"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.reviewRequestEmail = exports.bookingConfirmedNotif = exports.marketplaceReservationEmail = exports.resetPasswordEmail = exports.signupEmail = void 0; exports.formatDate = formatDate; function t(map, lang) { return map[lang] ?? map['fr']; } const dateLocale = { en: 'en-GB', fr: 'fr-FR', ar: 'ar-MA' }; function formatDate(date, lang, opts) { return date.toLocaleDateString(dateLocale[lang], opts ?? { year: 'numeric', month: 'long', day: 'numeric' }); } // ─── Signup confirmation ────────────────────────────────────────────────────── exports.signupEmail = { subject: (lang) => t({ en: 'Your workspace is ready — RentalDriveGo', fr: 'Votre espace de travail est prêt — RentalDriveGo', ar: 'مساحة عملك جاهزة — RentalDriveGo', }, lang), text: (opts, lang) => { const trialStr = formatDate(opts.trialEnd, lang); return t({ en: [ `Hi ${opts.firstName},`, '', `Your RentalDriveGo workspace for ${opts.companyName} has been created successfully.`, `Plan: ${opts.plan} (${opts.billingPeriod.toLowerCase()})`, `Currency: ${opts.currency}`, `Primary payment provider: ${opts.paymentProvider}`, `Free trial ends on ${trialStr}.`, '', 'Your workspace is ready. Sign in with the email and password you chose during signup.', '', 'RentalDriveGo', ].join('\n'), fr: [ `Bonjour ${opts.firstName},`, '', `Votre espace de travail RentalDriveGo pour ${opts.companyName} a été créé avec succès.`, `Forfait : ${opts.plan} (${opts.billingPeriod === 'MONTHLY' ? 'mensuel' : 'annuel'})`, `Devise : ${opts.currency}`, `Fournisseur de paiement principal : ${opts.paymentProvider}`, `La période d'essai gratuit se termine le ${trialStr}.`, '', "Votre espace de travail est prêt. Connectez-vous avec l'e-mail et le mot de passe choisis lors de l'inscription.", '', 'RentalDriveGo', ].join('\n'), ar: [ `مرحباً ${opts.firstName}،`, '', `تم إنشاء مساحة عمل RentalDriveGo الخاصة بـ ${opts.companyName} بنجاح.`, `الخطة: ${opts.plan} (${opts.billingPeriod === 'MONTHLY' ? 'شهري' : 'سنوي'})`, `العملة: ${opts.currency}`, `مزود الدفع الرئيسي: ${opts.paymentProvider}`, `تنتهي الفترة التجريبية المجانية في ${trialStr}.`, '', 'مساحة عملك جاهزة. سجّل الدخول باستخدام البريد الإلكتروني وكلمة المرور التي اخترتهما عند التسجيل.', '', 'RentalDriveGo', ].join('\n'), }, lang); }, }; // ─── Password reset ─────────────────────────────────────────────────────────── exports.resetPasswordEmail = { subject: (lang) => t({ en: 'Reset your RentalDriveGo password', fr: 'Réinitialisez votre mot de passe RentalDriveGo', ar: 'إعادة تعيين كلمة مرور RentalDriveGo', }, lang), html: (resetUrl, firstName, expireMinutes, lang) => { const isRtl = lang === 'ar'; const dir = isRtl ? 'rtl' : 'ltr'; return t({ en: `

Hi ${firstName},

You requested a password reset for your RentalDriveGo workspace account.

Reset your password

This link expires in ${expireMinutes} minutes. If you did not request this, you can safely ignore this email.

RentalDriveGo

`, fr: `

Bonjour ${firstName},

Vous avez demandé la réinitialisation du mot de passe de votre compte RentalDriveGo.

Réinitialiser mon mot de passe

Ce lien expire dans ${expireMinutes} minutes. Si vous n'avez pas fait cette demande, ignorez simplement cet e-mail.

RentalDriveGo

`, ar: `

مرحباً ${firstName}،

طلبت إعادة تعيين كلمة مرور حساب RentalDriveGo الخاص بك.

إعادة تعيين كلمة المرور

تنتهي صلاحية هذا الرابط خلال ${expireMinutes} دقيقة. إذا لم تطلب ذلك، يمكنك تجاهل هذا البريد الإلكتروني بأمان.

RentalDriveGo

`, }, lang); }, text: (resetUrl, firstName, expireMinutes, lang) => t({ en: `Hi ${firstName},\n\nReset your password here: ${resetUrl}\n\nThis link expires in ${expireMinutes} minutes.\n\nRentalDriveGo`, fr: `Bonjour ${firstName},\n\nRéinitialisez votre mot de passe ici : ${resetUrl}\n\nCe lien expire dans ${expireMinutes} minutes.\n\nRentalDriveGo`, ar: `مرحباً ${firstName}،\n\nأعد تعيين كلمة مرورك هنا: ${resetUrl}\n\nينتهي هذا الرابط خلال ${expireMinutes} دقيقة.\n\nRentalDriveGo`, }, lang), }; // ─── Marketplace reservation request ───────────────────────────────────────── exports.marketplaceReservationEmail = { subject: (vehicleName, lang) => t({ en: `Reservation Request Received — ${vehicleName}`, fr: `Demande de réservation reçue — ${vehicleName}`, ar: `تم استلام طلب الحجز — ${vehicleName}`, }, lang), html: (opts, lang) => { const startStr = formatDate(opts.startDate, lang); const endStr = formatDate(opts.endDate, lang); const isRtl = lang === 'ar'; const l = t({ en: { greeting: `Hi ${opts.firstName},`, intro: 'Your reservation request has been received and is pending company confirmation.', company: 'Company', pickup: 'Pick-up date', returnD: 'Return date', duration: 'Duration', daily: 'Daily rate', total: 'Estimated total', days: 'day(s)', footer: `The company will review your request and get in touch shortly. You may be contacted at ${opts.email}${opts.phone ? ` or ${opts.phone}` : ''}.`, }, fr: { greeting: `Bonjour ${opts.firstName},`, intro: 'Votre demande de réservation a été reçue et est en attente de confirmation.', company: 'Société', pickup: 'Date de prise en charge', returnD: 'Date de retour', duration: 'Durée', daily: 'Tarif journalier', total: 'Total estimé', days: 'jour(s)', footer: `La société examinera votre demande et vous contactera prochainement. Vous pouvez être contacté à ${opts.email}${opts.phone ? ` ou ${opts.phone}` : ''}.`, }, ar: { greeting: `مرحباً ${opts.firstName}،`, intro: 'تم استلام طلب الحجز وهو في انتظار تأكيد الشركة.', company: 'الشركة', pickup: 'تاريخ الاستلام', returnD: 'تاريخ الإرجاع', duration: 'المدة', daily: 'السعر اليومي', total: 'الإجمالي التقديري', days: 'يوم', footer: `ستراجع الشركة طلبك وستتواصل معك قريباً. يمكن التواصل معك على ${opts.email}${opts.phone ? ` أو ${opts.phone}` : ''}.`, }, }, lang); return `

${l.greeting}

${l.intro}


${opts.vehicleYear} ${opts.vehicleMake} ${opts.vehicleModel}

${l.company}: ${opts.companyName}

${l.pickup}: ${startStr}

${l.returnD}: ${endStr}

${l.duration}: ${opts.totalDays} ${l.days}

${l.daily}: ${opts.rateDisplay} MAD

${l.total}: ${opts.totalDisplay} MAD


${l.footer}

`; }, text: (opts, lang) => { const startStr = formatDate(opts.startDate, lang); const endStr = formatDate(opts.endDate, lang); return t({ en: `Hi ${opts.firstName},\n\nYour reservation request for the ${opts.vehicleYear} ${opts.vehicleMake} ${opts.vehicleModel} from ${opts.companyName} has been received.\n\nDates: ${startStr} → ${endStr}\nDuration: ${opts.totalDays} day(s)\nDaily rate: ${opts.rateDisplay} MAD\nEstimated total: ${opts.totalDisplay} MAD\n\nThe company will confirm your request shortly.\n\nThank you!`, fr: `Bonjour ${opts.firstName},\n\nVotre demande de réservation pour la ${opts.vehicleYear} ${opts.vehicleMake} ${opts.vehicleModel} auprès de ${opts.companyName} a été reçue.\n\nDates : ${startStr} → ${endStr}\nDurée : ${opts.totalDays} jour(s)\nTarif journalier : ${opts.rateDisplay} MAD\nTotal estimé : ${opts.totalDisplay} MAD\n\nLa société confirmera votre demande prochainement.\n\nMerci !`, ar: `مرحباً ${opts.firstName}،\n\nتم استلام طلب حجزك لسيارة ${opts.vehicleYear} ${opts.vehicleMake} ${opts.vehicleModel} من ${opts.companyName}.\n\nالتواريخ: ${startStr} → ${endStr}\nالمدة: ${opts.totalDays} يوم\nالسعر اليومي: ${opts.rateDisplay} MAD\nالإجمالي التقديري: ${opts.totalDisplay} MAD\n\nستؤكد الشركة طلبك قريباً.\n\nشكراً!`, }, lang); }, }; // ─── Booking confirmed ──────────────────────────────────────────────────────── exports.bookingConfirmedNotif = { title: (lang) => t({ en: 'Booking Confirmed', fr: 'Réservation confirmée', ar: 'تم تأكيد الحجز', }, lang), body: (lang) => t({ en: 'Your booking has been confirmed.', fr: 'Votre réservation a été confirmée.', ar: 'تم تأكيد حجزك.', }, lang), }; // ─── Post-rental review request ─────────────────────────────────────────────── exports.reviewRequestEmail = { subject: (vehicleLabel, lang) => t({ en: `How was your rental? — ${vehicleLabel}`, fr: `Comment s'est passée votre location ? — ${vehicleLabel}`, ar: `كيف كانت تجربة الإيجار؟ — ${vehicleLabel}`, }, lang), html: (opts, lang) => { const isRtl = lang === 'ar'; const l = t({ en: { greeting: `Hi ${opts.firstName},`, body1: `Thank you for renting with ${opts.companyName}. We hope you enjoyed your ${opts.vehicleLabel}.`, body2: 'Your feedback helps the company improve and helps other customers make informed choices. It only takes 30 seconds.', cta: 'Leave a review', disclaimer: 'This link is unique to your reservation and can only be used once. If you did not rent a vehicle recently, you can ignore this email.', }, fr: { greeting: `Bonjour ${opts.firstName},`, body1: `Merci d'avoir loué chez ${opts.companyName}. Nous espérons que vous avez apprécié votre ${opts.vehicleLabel}.`, body2: "Votre avis aide la société à s'améliorer et aide les autres clients à faire des choix éclairés. Cela ne prend que 30 secondes.", cta: 'Laisser un avis', disclaimer: "Ce lien est unique à votre réservation et ne peut être utilisé qu'une seule fois. Si vous n'avez pas loué de véhicule récemment, vous pouvez ignorer cet e-mail.", }, ar: { greeting: `مرحباً ${opts.firstName}،`, body1: `شكراً لاختيار ${opts.companyName}. نأمل أنك استمتعت بـ ${opts.vehicleLabel}.`, body2: 'تساعد ملاحظاتك الشركة على التحسين وتساعد العملاء الآخرين على اتخاذ قرارات مستنيرة. لا يستغرق الأمر سوى 30 ثانية.', cta: 'اترك تقييماً', disclaimer: 'هذا الرابط فريد لحجزك ولا يمكن استخدامه إلا مرة واحدة. إذا لم تستأجر مركبة مؤخراً، يمكنك تجاهل هذا البريد الإلكتروني.', }, }, lang); return `

${l.greeting}

${l.body1}

${l.body2}

${l.cta}

${l.disclaimer}

`; }, text: (opts, lang) => t({ en: `Hi ${opts.firstName},\n\nThank you for renting with ${opts.companyName}. We hope you enjoyed your ${opts.vehicleLabel}.\n\nLeave a review here (one-time link):\n${opts.reviewUrl}\n\nThank you!`, fr: `Bonjour ${opts.firstName},\n\nMerci d'avoir loué chez ${opts.companyName}. Nous espérons que vous avez apprécié votre ${opts.vehicleLabel}.\n\nLaissez un avis ici (lien unique) :\n${opts.reviewUrl}\n\nMerci !`, ar: `مرحباً ${opts.firstName}،\n\nشكراً لاختيار ${opts.companyName}. نأمل أنك استمتعت بـ ${opts.vehicleLabel}.\n\nاترك تقييماً هنا (رابط فريد):\n${opts.reviewUrl}\n\nشكراً!`, }, lang), }; //# sourceMappingURL=emailTranslations.js.map