diff --git a/admin/src/pages/CampaignsTab.tsx b/admin/src/pages/CampaignsTab.tsx
index 67da300..4bf8e73 100644
--- a/admin/src/pages/CampaignsTab.tsx
+++ b/admin/src/pages/CampaignsTab.tsx
@@ -1,5 +1,6 @@
import { useCallback, useEffect, useState } from 'react';
import { api } from '../api';
+import { RemindersCard } from './RemindersCard';
interface Campaign {
id: string;
@@ -88,6 +89,8 @@ export function CampaignsTab({ storeId, storeName }: { storeId: string; storeNam
{data.nextAllowedAt &&
Prochain envoi possible le {when(data.nextAllowedAt)}.
}
+
+
Historique
{data.items.length === 0 ? (
diff --git a/admin/src/pages/RemindersCard.tsx b/admin/src/pages/RemindersCard.tsx
new file mode 100644
index 0000000..81d381b
--- /dev/null
+++ b/admin/src/pages/RemindersCard.tsx
@@ -0,0 +1,101 @@
+import { useCallback, useEffect, useState } from 'react';
+import { api } from '../api';
+
+interface Reminders {
+ allowed: boolean;
+ settings: { enabled: boolean; days: number; message: string | null };
+ defaultMessage: string;
+ dayChoices: number[];
+ stats: { pending: number; sentLast30Days: number; cameBack: number; totalReminded: number };
+}
+
+/** Relance automatique des clients inactifs (formule Pro). */
+export function RemindersCard({ storeId }: { storeId: string }) {
+ const [data, setData] = useState(null);
+ const [enabled, setEnabled] = useState(false);
+ const [days, setDays] = useState(45);
+ const [message, setMessage] = useState('');
+ const [error, setError] = useState(null);
+ const [notice, setNotice] = useState(null);
+ const [busy, setBusy] = useState(false);
+
+ const apply = (d: Reminders) => {
+ setData(d);
+ setEnabled(d.settings.enabled);
+ setDays(d.settings.days);
+ setMessage(d.settings.message ?? '');
+ };
+ const load = useCallback(() => {
+ api.get(`/api/admin/stores/${storeId}/reminders`).then(apply).catch((e) => setError(e.message));
+ }, [storeId]);
+ useEffect(load, [load]);
+
+ if (!data) return error ? {error}
: null;
+
+ async function save() {
+ setBusy(true);
+ setError(null);
+ setNotice(null);
+ try {
+ apply(await api.put(`/api/admin/stores/${storeId}/reminders`, { enabled, days, message: message.trim() || null }));
+ setNotice('Réglages de relance enregistrés.');
+ } catch (e) {
+ setError((e as Error).message);
+ } finally {
+ setBusy(false);
+ }
+ }
+
+ const s = data.stats;
+ return (
+
+
+
Relance des clients inactifs
+
+ Un client qui n'est pas revenu depuis le délai choisi reçoit automatiquement une notification sur sa carte (entre 10 h et 19 h).
+ Une seule relance par absence : il doit revenir pour pouvoir être relancé à nouveau.
+
+
+ {error && {error}
}
+ {notice && {notice}
}
+ {!data.allowed && La relance automatique est réservée aux formules Pro et Réseau (abonnement actif).
}
+
+
+ setEnabled(e.target.checked)} />
+ Relance automatique activée
+
+
+
+ Relancer après
+ {data.dayChoices.map((d) => (
+ setDays(d)}>
+ {d} jours
+
+ ))}
+
+
+
+ Message
+
+
+
+
+ {s.pending} client(s) inactif(s) à relancer · {s.sentLast30Days} relance(s) sur 30 jours · {s.cameBack} / {s.totalReminded} client(s) relancé(s) revenu(s)
+
+ {busy ? 'Enregistrement…' : 'Enregistrer'}
+
+
+ );
+}
diff --git a/admin/src/pages/StorePage.tsx b/admin/src/pages/StorePage.tsx
index 70971c0..02da195 100644
--- a/admin/src/pages/StorePage.tsx
+++ b/admin/src/pages/StorePage.tsx
@@ -12,7 +12,7 @@ const TABS = [
['infos', 'Infos'],
['carte', 'Carte de fidélité'],
['employes', 'Employés'],
- ['campagnes', 'Campagnes'],
+ ['campagnes', 'Campagnes et relances'],
['facturation', 'Facturation'],
] as const;
diff --git a/backend/prisma/manual-migrations/2026-10-07-relance-inactifs.sql b/backend/prisma/manual-migrations/2026-10-07-relance-inactifs.sql
new file mode 100644
index 0000000..e5c885d
--- /dev/null
+++ b/backend/prisma/manual-migrations/2026-10-07-relance-inactifs.sql
@@ -0,0 +1,6 @@
+-- Relance automatique des clients inactifs (formule Pro).
+ALTER TABLE `Store`
+ ADD COLUMN `reminderEnabled` BOOLEAN NOT NULL DEFAULT false,
+ ADD COLUMN `reminderDays` INTEGER NOT NULL DEFAULT 45,
+ ADD COLUMN `reminderMessage` VARCHAR(160) NULL;
+ALTER TABLE `LoyaltyCard` ADD COLUMN `reminderSentAt` DATETIME(3) NULL;
diff --git a/backend/prisma/schema.prisma b/backend/prisma/schema.prisma
index ad8040c..32bbc05 100644
--- a/backend/prisma/schema.prisma
+++ b/backend/prisma/schema.prisma
@@ -48,6 +48,12 @@ model Store {
maxAmountCents Int @default(50000) /// plafond d'un montant saisi
minScanIntervalSec Int @default(300) /// délai minimum entre deux crédits d'un même client
+ // Relance automatique des clients inactifs (formule Pro)
+ reminderEnabled Boolean @default(false)
+ reminderDays Int @default(45)
+ /// Texte de la relance ; {prenom} et {solde} sont remplacés. Vide = texte par défaut.
+ reminderMessage String? @db.VarChar(160)
+
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
@@ -123,25 +129,27 @@ model Customer {
}
model LoyaltyCard {
- id String @id @default(cuid())
- storeId String
- store Store @relation(fields: [storeId], references: [id], onDelete: Cascade)
- customerId String
- customer Customer @relation(fields: [customerId], references: [id], onDelete: Cascade)
+ id String @id @default(cuid())
+ storeId String
+ store Store @relation(fields: [storeId], references: [id], onDelete: Cascade)
+ customerId String
+ customer Customer @relation(fields: [customerId], references: [id], onDelete: Cascade)
/// Numéro de série du pass Wallet ; contenu du QR (non devinable).
- serial String @unique
+ serial String @unique
/// Jeton d'authentification du service web Apple Wallet.
- authToken String
+ authToken String
/// Clé secrète des liens client (page de la carte, téléchargement du pass).
- accessKey String @unique
- balance Int @default(0)
+ accessKey String @unique
+ balance Int @default(0)
/// Dernière modification visible dans le Wallet (solde, design du magasin) : sert aux mises à jour Apple.
- passUpdatedAt DateTime @default(now())
- lastCreditAt DateTime?
- createdAt DateTime @default(now())
- updatedAt DateTime @updatedAt
- transactions Transaction[]
- devices AppleRegistration[]
+ passUpdatedAt DateTime @default(now())
+ lastCreditAt DateTime?
+ /// Dernière relance « client inactif » envoyée (une seule par période d'inactivité).
+ reminderSentAt DateTime?
+ createdAt DateTime @default(now())
+ updatedAt DateTime @updatedAt
+ transactions Transaction[]
+ devices AppleRegistration[]
@@unique([storeId, customerId])
}
diff --git a/backend/src/app.module.ts b/backend/src/app.module.ts
index ad66685..a45e97c 100644
--- a/backend/src/app.module.ts
+++ b/backend/src/app.module.ts
@@ -14,6 +14,7 @@ import { BillingModule } from './billing/billing.controller';
import { EntitlementsModule } from './billing/entitlements.service';
import { WalletModule } from './wallet/wallet.module';
import { CampaignsModule } from './campaigns/campaigns.controller';
+import { RemindersModule } from './reminders/reminders.controller';
import { HealthController } from './health.controller';
@Module({
@@ -31,6 +32,7 @@ import { HealthController } from './health.controller';
BillingModule,
EntitlementsModule,
CampaignsModule,
+ RemindersModule,
],
controllers: [HealthController],
providers: [{ provide: APP_GUARD, useClass: ThrottlerGuard }],
diff --git a/backend/src/reminders/reminders.controller.ts b/backend/src/reminders/reminders.controller.ts
new file mode 100644
index 0000000..f752f62
--- /dev/null
+++ b/backend/src/reminders/reminders.controller.ts
@@ -0,0 +1,58 @@
+import { Body, Controller, Get, Module, Param, Put, UseGuards } from '@nestjs/common';
+import { IsBoolean, IsIn, IsOptional, IsString, MaxLength } from 'class-validator';
+import { JwtPayload } from '../common/auth.types';
+import { AdminGuard, CurrentUser, JwtAuthGuard, StaffGuard, StaffRoles } from '../common/guards';
+import { REMINDER_DAYS, RemindersService } from './reminders.service';
+
+class ReminderSettingsDto {
+ @IsBoolean()
+ enabled!: boolean;
+
+ @IsIn(REMINDER_DAYS)
+ days!: number;
+
+ @IsOptional() @IsString() @MaxLength(160)
+ message?: string | null;
+}
+
+@Controller('admin/stores/:id/reminders')
+@UseGuards(JwtAuthGuard, AdminGuard)
+export class AdminRemindersController {
+ constructor(private reminders: RemindersService) {}
+
+ @Get()
+ get(@Param('id') id: string) {
+ return this.reminders.overview(id);
+ }
+
+ @Put()
+ update(@Param('id') id: string, @Body() dto: ReminderSettingsDto) {
+ return this.reminders.update(id, { enabled: dto.enabled, days: dto.days, message: dto.message ?? null });
+ }
+}
+
+/** App Pro : réservé aux gérants. */
+@Controller('staff/reminders')
+@UseGuards(JwtAuthGuard, StaffGuard)
+@StaffRoles('MANAGER')
+export class StaffRemindersController {
+ constructor(private reminders: RemindersService) {}
+
+ @Get()
+ get(@CurrentUser() user: JwtPayload) {
+ if (user.kind !== 'staff') throw new Error('StaffGuard manquant');
+ return this.reminders.overview(user.storeId);
+ }
+
+ @Put()
+ update(@CurrentUser() user: JwtPayload, @Body() dto: ReminderSettingsDto) {
+ if (user.kind !== 'staff') throw new Error('StaffGuard manquant');
+ return this.reminders.update(user.storeId, { enabled: dto.enabled, days: dto.days, message: dto.message ?? null });
+ }
+}
+
+@Module({
+ controllers: [AdminRemindersController, StaffRemindersController],
+ providers: [RemindersService],
+})
+export class RemindersModule {}
diff --git a/backend/src/reminders/reminders.service.ts b/backend/src/reminders/reminders.service.ts
new file mode 100644
index 0000000..c7a4eb4
--- /dev/null
+++ b/backend/src/reminders/reminders.service.ts
@@ -0,0 +1,143 @@
+import { Injectable, Logger, NotFoundException, OnApplicationBootstrap, OnApplicationShutdown } from '@nestjs/common';
+import { PrismaService } from '../prisma/prisma.service';
+import { EntitlementsService } from '../billing/entitlements.service';
+import { CardUpdatesService } from '../wallet/card-updates.service';
+import { CARD_WITH_CONTEXT, DEFAULT_REMINDER, reminderText } from '../wallet/wallet.types';
+
+export const REMINDER_DAYS = [30, 45, 60, 90];
+/** Envois seulement entre 10 h et 19 h (heure de Paris) : pas de notification la nuit. */
+const SEND_HOURS = { from: 10, to: 19 };
+/** Plafond par magasin et par passage horaire, pour étaler les envois. */
+const BATCH = 200;
+const DAY = 24 * 3600_000;
+
+export interface ReminderSettings {
+ enabled: boolean;
+ days: number;
+ message: string | null;
+}
+
+/**
+ * Relance automatique : un client sans crédit depuis N jours reçoit une notification
+ * sur sa carte Wallet. Une seule relance par période d'inactivité : il faut qu'il
+ * revienne (nouveau crédit) pour pouvoir être relancé à nouveau.
+ */
+@Injectable()
+export class RemindersService implements OnApplicationBootstrap, OnApplicationShutdown {
+ private readonly logger = new Logger(RemindersService.name);
+ private timer?: NodeJS.Timeout;
+ private running = false;
+
+ constructor(
+ private prisma: PrismaService,
+ private entitlements: EntitlementsService,
+ private cardUpdates: CardUpdatesService,
+ ) {}
+
+ onApplicationBootstrap() {
+ this.timer = setInterval(() => void this.tick(), 3600_000);
+ setTimeout(() => void this.tick(), 60_000);
+ }
+
+ onApplicationShutdown() {
+ clearInterval(this.timer);
+ }
+
+ async overview(storeId: string) {
+ const store = await this.prisma.store.findUnique({ where: { id: storeId } });
+ if (!store) throw new NotFoundException('Magasin introuvable');
+ const since = new Date(Date.now() - 30 * DAY);
+ const [allowed, pending, sentLast30Days, reminded] = await Promise.all([
+ this.entitlements.can(storeId, 'inactiveReminders'),
+ this.candidates(storeId, store.reminderDays, Number.MAX_SAFE_INTEGER),
+ this.prisma.loyaltyCard.count({ where: { storeId, reminderSentAt: { gte: since } } }),
+ this.prisma.loyaltyCard.findMany({
+ where: { storeId, reminderSentAt: { not: null } },
+ select: { reminderSentAt: true, lastCreditAt: true },
+ }),
+ ]);
+ return {
+ allowed,
+ settings: { enabled: store.reminderEnabled, days: store.reminderDays, message: store.reminderMessage } as ReminderSettings,
+ defaultMessage: DEFAULT_REMINDER,
+ dayChoices: REMINDER_DAYS,
+ stats: {
+ /** Clients actuellement inactifs et pas encore relancés. */
+ pending: pending.length,
+ sentLast30Days,
+ /** Clients relancés revenus depuis (nouveau crédit après la relance). */
+ cameBack: reminded.filter((c) => c.lastCreditAt && c.lastCreditAt > c.reminderSentAt!).length,
+ totalReminded: reminded.length,
+ },
+ };
+ }
+
+ async update(storeId: string, settings: ReminderSettings) {
+ if (settings.enabled) await this.entitlements.require(storeId, 'inactiveReminders');
+ await this.prisma.store.update({
+ where: { id: storeId },
+ data: {
+ reminderEnabled: settings.enabled,
+ reminderDays: settings.days,
+ reminderMessage: settings.message?.replace(/\s+/g, ' ').trim() || null,
+ },
+ });
+ return this.overview(storeId);
+ }
+
+ /** Cartes inactives depuis `days` jours et pas encore relancées depuis leur dernière visite. */
+ private async candidates(storeId: string, days: number, take: number) {
+ const cutoff = new Date(Date.now() - days * DAY);
+ const cards = await this.prisma.loyaltyCard.findMany({
+ where: {
+ storeId,
+ OR: [{ lastCreditAt: { lt: cutoff } }, { lastCreditAt: null, createdAt: { lt: cutoff } }],
+ },
+ select: { id: true, lastCreditAt: true, createdAt: true, reminderSentAt: true },
+ orderBy: { createdAt: 'asc' },
+ });
+ return cards.filter((c) => !c.reminderSentAt || c.reminderSentAt < (c.lastCreditAt ?? c.createdAt)).slice(0, take);
+ }
+
+ /** Passage horaire. */
+ async tick(now = new Date()) {
+ if (this.running) return;
+ const hour = Number(new Intl.DateTimeFormat('fr-FR', { hour: 'numeric', hour12: false, timeZone: 'Europe/Paris' }).format(now));
+ if (hour < SEND_HOURS.from || hour >= SEND_HOURS.to) return;
+ this.running = true;
+ try {
+ const stores = await this.prisma.store.findMany({
+ where: { reminderEnabled: true, status: 'ACTIVE', billingSuspended: false },
+ select: { id: true, name: true, reminderDays: true },
+ });
+ for (const store of stores) {
+ if (!(await this.entitlements.can(store.id, 'inactiveReminders'))) continue;
+ const sent = await this.runStore(store);
+ if (sent) this.logger.log(`Relance : ${sent} client(s) de ${store.name}`);
+ }
+ } catch (e) {
+ this.logger.error(`Relance des inactifs : ${(e as Error).message}`);
+ } finally {
+ this.running = false;
+ }
+ }
+
+ private async runStore(store: { id: string; name: string; reminderDays: number }) {
+ let sent = 0;
+ for (const { id } of await this.candidates(store.id, store.reminderDays, BATCH)) {
+ // reminderSentAt + passUpdatedAt d'abord : l'iPhone qui redemande la carte y trouve le texte de relance.
+ const card = await this.prisma.loyaltyCard.update({
+ where: { id },
+ data: { reminderSentAt: new Date(), passUpdatedAt: new Date() },
+ include: CARD_WITH_CONTEXT,
+ });
+ try {
+ await this.cardUpdates.remind(card.id, reminderText(card), store.name);
+ sent++;
+ } catch (e) {
+ this.logger.warn(`Relance carte ${card.serial} : ${(e as Error).message}`);
+ }
+ }
+ return sent;
+ }
+}
diff --git a/backend/src/wallet/apple-pass.service.ts b/backend/src/wallet/apple-pass.service.ts
index e4cacd7..03236b6 100644
--- a/backend/src/wallet/apple-pass.service.ts
+++ b/backend/src/wallet/apple-pass.service.ts
@@ -5,7 +5,7 @@ import { join } from 'path';
import { Jimp } from 'jimp';
import { PKPass } from 'passkit-generator';
import { UPLOADS_DIR } from '../card-design/card-design.service';
-import { CardWithContext, latestNews, nextRewardText, rewardsText, unitLabel } from './wallet.types';
+import { CardWithContext, newsText, nextRewardText, rewardsText, unitLabel } from './wallet.types';
type Certificates = { wwdr: Buffer; signerCert: Buffer; signerKey: Buffer; signerKeyPassphrase?: string };
@@ -69,7 +69,7 @@ export class ApplePassService {
}),
backFields: [
// Toujours présent : quand sa valeur change (nouvelle campagne), l'iPhone affiche le message sur l'écran verrouillé.
- { key: 'news', label: 'Actualité', value: latestNews(card) ?? 'Aucune actualité pour le moment.', changeMessage: '%@' },
+ { key: 'news', label: 'Actualité', value: newsText(card) ?? 'Aucune actualité pour le moment.', changeMessage: '%@' },
{ key: 'rewards', label: 'Récompenses', value: rewardsText(card) },
{
key: 'store',
diff --git a/backend/src/wallet/card-updates.service.ts b/backend/src/wallet/card-updates.service.ts
index 3117cab..00e12a9 100644
--- a/backend/src/wallet/card-updates.service.ts
+++ b/backend/src/wallet/card-updates.service.ts
@@ -69,6 +69,18 @@ export class CardUpdatesService {
});
}
+ /** Relance d'un client inactif : la rubrique « Actualité » Apple change (notification), message Google sur sa carte. */
+ async remind(cardId: string, text: string, storeName: string) {
+ const card = await this.prisma.loyaltyCard.findUniqueOrThrow({
+ where: { id: cardId },
+ include: { devices: { include: { device: true } } },
+ });
+ await Promise.all([
+ this.pushApple(card.devices.map((r) => r.device.pushToken)),
+ this.google.addObjectMessage(card.serial, `reminder_${Date.now()}`, storeName, text),
+ ]);
+ }
+
private async pushApple(tokens: string[]) {
const gone = await this.apns.push([...new Set(tokens)]);
if (gone.length) await this.prisma.appleDevice.deleteMany({ where: { pushToken: { in: gone } } });
diff --git a/backend/src/wallet/google-wallet.service.ts b/backend/src/wallet/google-wallet.service.ts
index 70b3d49..37937c9 100644
--- a/backend/src/wallet/google-wallet.service.ts
+++ b/backend/src/wallet/google-wallet.service.ts
@@ -89,6 +89,14 @@ export class GoogleWalletService {
});
}
+ /** Message avec notification sur la carte d'un seul client (relance). */
+ async addObjectMessage(serial: string, messageId: string, header: string, body: string) {
+ if (!this.enabled) return;
+ await this.call('POST', `/loyaltyObject/${encodeURIComponent(this.objectId(serial))}/addMessage`, {
+ message: { id: messageId, header, body, messageType: 'TEXT_AND_NOTIFY' },
+ });
+ }
+
private buildClass(store: StoreForClass) {
const design = store.cardDesign!;
const publicUrl: string = this.config.get('publicUrl')!;
diff --git a/backend/src/wallet/wallet.types.ts b/backend/src/wallet/wallet.types.ts
index 712038b..dfc9efa 100644
--- a/backend/src/wallet/wallet.types.ts
+++ b/backend/src/wallet/wallet.types.ts
@@ -7,7 +7,7 @@ export const CARD_WITH_CONTEXT = {
include: {
cardDesign: { include: { rewards: { where: { active: true }, orderBy: { cost: 'asc' } } } },
subscription: { select: { plan: true, status: true } },
- campaigns: { orderBy: { createdAt: 'desc' }, take: 1, select: { message: true } },
+ campaigns: { orderBy: { createdAt: 'desc' }, take: 1, select: { message: true, createdAt: true } },
},
},
} satisfies Prisma.LoyaltyCardInclude;
@@ -42,7 +42,21 @@ export function rewardsText(card: CardWithContext) {
return rewards.length ? rewards.map((r) => `${r.label} — ${r.cost} ${unit}`).join('\n') : 'Renseignez-vous au comptoir.';
}
-/** Dernier message de campagne du magasin (affiché au dos de la carte Apple). */
-export function latestNews(card: CardWithContext) {
- return card.store.campaigns[0]?.message ?? null;
+
+export const DEFAULT_REMINDER = 'Vous nous manquez, {prenom} ! Votre solde de {solde} vous attend en magasin.';
+
+/** Texte de relance personnalisé pour ce client. */
+export function reminderText(card: CardWithContext) {
+ const unit = card.store.cardDesign?.pointsMode === 'STAMP' ? 'tampon' : 'point';
+ const solde = `${card.balance} ${unit}${card.balance > 1 ? 's' : ''}`;
+ return (card.store.reminderMessage || DEFAULT_REMINDER)
+ .replaceAll('{prenom}', card.customer.firstName)
+ .replaceAll('{solde}', solde);
+}
+
+/** Rubrique « Actualité » : la relance de ce client si elle est plus récente que la dernière campagne. */
+export function newsText(card: CardWithContext) {
+ const campaign = card.store.campaigns[0];
+ if (card.reminderSentAt && (!campaign || card.reminderSentAt > campaign.createdAt)) return reminderText(card);
+ return campaign?.message ?? null;
}
diff --git a/pro/app/_layout.tsx b/pro/app/_layout.tsx
index 806daf5..c5f128e 100644
--- a/pro/app/_layout.tsx
+++ b/pro/app/_layout.tsx
@@ -49,6 +49,7 @@ function Navigator() {
+
);
diff --git a/pro/app/index.tsx b/pro/app/index.tsx
index 9cd7b3d..fc1781f 100644
--- a/pro/app/index.tsx
+++ b/pro/app/index.tsx
@@ -113,6 +113,7 @@ export default function Home() {
{isManager && router.push('/campaigns')} />}
+ {isManager && router.push('/reminders')} />}
router.push('/history')} />
diff --git a/pro/app/reminders.tsx b/pro/app/reminders.tsx
new file mode 100644
index 0000000..1c2c99a
--- /dev/null
+++ b/pro/app/reminders.tsx
@@ -0,0 +1,116 @@
+import { useCallback, useState } from 'react';
+import { Pressable, ScrollView, Switch, TextInput, View } from 'react-native';
+import { useFocusEffect } from 'expo-router';
+import { api } from '../src/api';
+import { describe } from '../src/errors';
+import { Banner, Button, Card, T } from '../src/ui';
+import { font, useColors } from '../src/theme';
+
+interface Reminders {
+ allowed: boolean;
+ settings: { enabled: boolean; days: number; message: string | null };
+ defaultMessage: string;
+ dayChoices: number[];
+ stats: { pending: number; sentLast30Days: number; cameBack: number; totalReminded: number };
+}
+
+/** Relance automatique des clients inactifs (gérants, formule Pro). */
+export default function RemindersScreen() {
+ const c = useColors();
+ const [data, setData] = useState(null);
+ const [enabled, setEnabled] = useState(false);
+ const [days, setDays] = useState(45);
+ const [message, setMessage] = useState('');
+ const [error, setError] = useState(null);
+ const [saved, setSaved] = useState(false);
+ const [busy, setBusy] = useState(false);
+
+ const apply = (d: Reminders) => {
+ setData(d);
+ setEnabled(d.settings.enabled);
+ setDays(d.settings.days);
+ setMessage(d.settings.message ?? '');
+ };
+ useFocusEffect(
+ useCallback(() => {
+ api.get('/api/staff/reminders').then(apply).catch((e) => setError(describe(e).detail));
+ }, []),
+ );
+
+ async function save() {
+ setBusy(true);
+ setError(null);
+ setSaved(false);
+ try {
+ apply(await api.put('/api/staff/reminders', { enabled, days, message: message.trim() || null }));
+ setSaved(true);
+ } catch (e) {
+ setError(describe(e).detail);
+ } finally {
+ setBusy(false);
+ }
+ }
+
+ if (!data) return {error ? {error} : Chargement… } ;
+ const s = data.stats;
+
+ return (
+
+ {error && {error} }
+ {saved && Réglages enregistrés. }
+ {!data.allowed && La relance automatique est incluse dans la formule Pro. Contactez MonEspacePro pour changer de formule. }
+
+
+ Un client qui n'est pas revenu depuis le délai choisi reçoit une notification sur sa carte, entre 10 h et 19 h. Une seule relance par absence.
+
+
+
+ Relance automatique
+
+
+
+ Relancer après
+
+ {data.dayChoices.map((d) => (
+ setDays(d)}
+ style={{ paddingVertical: 10, paddingHorizontal: 16, borderRadius: 999, borderWidth: 1, borderColor: days === d ? c.primary : c.border, backgroundColor: days === d ? c.primarySoft : c.surface }}
+ >
+ {d} jours
+
+ ))}
+
+
+ Message
+
+ Vide = texte par défaut. {'{prenom}'} et {'{solde}'} sont remplacés automatiquement.
+
+
+
+
+ {[
+ [s.pending, 'à relancer'],
+ [s.sentLast30Days, 'relances (30 j)'],
+ [`${s.cameBack}/${s.totalReminded}`, 'revenus'],
+ ].map(([n, l]) => (
+
+ {n}
+ {l}
+
+ ))}
+
+
+ );
+}
diff --git a/pro/src/api.ts b/pro/src/api.ts
index f8fa64b..7dadb28 100644
--- a/pro/src/api.ts
+++ b/pro/src/api.ts
@@ -100,6 +100,7 @@ async function request(method: string, path: string, body?: unknown, auth = t
export const api = {
get: (path: string) => request('GET', path),
post: (path: string, body: unknown = {}) => request('POST', path, body),
+ put: (path: string, body: unknown) => request('PUT', path, body),
};
// ── Types de l'API ─────────────────────────────────────────────
diff --git a/site-src/pricing.js b/site-src/pricing.js
index 99c1510..659a7c1 100644
--- a/site-src/pricing.js
+++ b/site-src/pricing.js
@@ -25,7 +25,7 @@ const MARKETING = {
{ label: 'Employés illimités' },
{ label: 'Sans la mention « Propulsé par MonEspacePro »' },
{ label: 'Notifications et campagnes sur l’écran du téléphone' },
- { label: 'Relance automatique des clients inactifs', soon: true },
+ { label: 'Relance automatique des clients inactifs' },
{ label: 'Offre d’anniversaire', soon: true },
{ label: 'Collecte d’avis Google', soon: true },
{ label: 'Parrainage', soon: true },
diff --git a/site/tarif/index.html b/site/tarif/index.html
index 5ce0d1e..b7b3072 100644
--- a/site/tarif/index.html
+++ b/site/tarif/index.html
@@ -118,7 +118,7 @@
Employés illimités
Sans la mention « Propulsé par MonEspacePro »
Notifications et campagnes sur l’écran du téléphone
-Relance automatique des clients inactifs Bientôt
+Relance automatique des clients inactifs
Offre d’anniversaire Bientôt
Collecte d’avis Google Bientôt
Parrainage Bientôt