@frak-labs/components 1.3.4 → 1.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/cdn/Ambassador.CZAN1-jx.js +519 -0
- package/cdn/Banner.2WJ4pT6E.js +227 -0
- package/cdn/ButtonShare.DSGvJfJ-.js +1 -0
- package/cdn/{ButtonWallet.CIesaq0l.js → ButtonWallet.DHpHCl4c.js} +2 -2
- package/cdn/GiftIcon.DYg5xgHg.js +1 -0
- package/cdn/InstallQr.CHImaq56.js +1 -0
- package/cdn/{OpenInAppButton.BtXknsxK.js → OpenInAppButton.CxBzRNKw.js} +1 -1
- package/cdn/PostPurchase.CVZlV54f.js +124 -0
- package/cdn/RewardReminder.C6o8lgak.js +369 -0
- package/cdn/components.js +1 -1
- package/cdn/format.D2Ai5cCn.js +1 -0
- package/cdn/{GiftIcon.CX0gLPUJ.js → icons.CdzHzZIJ.js} +1 -1
- package/cdn/jsxRuntime.module.7FJBZ9bf.js +58 -0
- package/cdn/loader.js +20 -16
- package/cdn/mountRewardReminder.BlmSRJDe.js +1 -0
- package/cdn/previewSummary.DxyobqED.js +1 -0
- package/cdn/rewardSummaryStore.DyjI-vPH.js +1 -0
- package/cdn/{rewards.F9iOJSNk.js → rewards.CeNLrK54.js} +1 -1
- package/cdn/useGlobalComponents.CNnOzerU.js +1 -0
- package/cdn/{useLightDomStyles.CpiH8nO2.js → useLightDomStyles.557xWurb.js} +1 -1
- package/cdn/usePlacement.DYgmdkfr.js +1 -0
- package/cdn/{useReward.B9ibElG0.js → useReward.BzUL3ijd.js} +1 -1
- package/dist/GiftIcon-Csu31jtf.js +62 -0
- package/dist/InstallQr-kpb44cfg.js +84 -0
- package/dist/ambassador.d.ts +16 -1
- package/dist/ambassador.js +626 -191
- package/dist/banner.d.ts +20 -6
- package/dist/banner.js +237 -15
- package/dist/buttonShare.js +2 -2
- package/dist/buttonWallet.js +1 -1
- package/dist/format-zGdbUoX_.js +283 -0
- package/dist/i18n/defaults.d.ts +72 -0
- package/dist/i18n/defaults.js +108 -6
- package/dist/{GiftIcon-B9k_syq6.js → icons-iN3qH_Bv.js} +1 -61
- package/dist/postPurchase.d.ts +6 -1
- package/dist/postPurchase.js +188 -34
- package/dist/previewSummary-CMc6q8vI.js +37 -0
- package/dist/rewardReminder.d.ts +50 -0
- package/dist/rewardReminder.js +809 -0
- package/dist/{rewards-CfGynCt6.js → rewards-BuNthAR2.js} +49 -46
- package/dist/{sharedBaseCss.css-nYy9vlzH.js → sharedBaseCss.css-D2HG4Ty8.js} +1 -1
- package/dist/{useReward-DmukZKoh.js → useReward-cQ54x8q-.js} +1 -1
- package/package.json +17 -11
- package/cdn/Ambassador.tWpfYThv.js +0 -392
- package/cdn/Banner.RSZt2Kn_.js +0 -208
- package/cdn/ButtonShare.Buy6qEfW.js +0 -1
- package/cdn/PostPurchase.Btgp2kLc.js +0 -102
- package/cdn/jsxRuntime.module.CUZaa90V.js +0 -58
- package/cdn/useGlobalComponents.CXuceSQ0.js +0 -1
- package/cdn/usePlacement.Cq64cZ9Q.js +0 -1
|
@@ -0,0 +1,283 @@
|
|
|
1
|
+
import { formatAmount, getClientId, getSupportedCurrency, isIOS, sdkConfigStore } from "@frak-labs/core-sdk";
|
|
2
|
+
import { REFERRAL_SUCCESS_EVENT, getRewardSummary } from "@frak-labs/core-sdk/actions";
|
|
3
|
+
import { useEffect } from "preact/hooks";
|
|
4
|
+
import { useSyncExternalStore } from "preact/compat";
|
|
5
|
+
// src/rewards/dismissal.ts
|
|
6
|
+
const KEY_PREFIX = "frak-reward-reminder-dismissed-";
|
|
7
|
+
const DISMISS_EVENT = "frak:reward-reminder-dismissed";
|
|
8
|
+
function storageKey() {
|
|
9
|
+
return `${KEY_PREFIX}${sdkConfigStore.getConfig().merchantId ?? "unknown"}`;
|
|
10
|
+
}
|
|
11
|
+
/** Dismissal lasts for the browser session only, and is shared by every reminder surface. */
|
|
12
|
+
function isReminderDismissed() {
|
|
13
|
+
try {
|
|
14
|
+
return window.sessionStorage.getItem(storageKey()) === "1";
|
|
15
|
+
} catch {
|
|
16
|
+
return false;
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
function dismissReminder() {
|
|
20
|
+
try {
|
|
21
|
+
window.sessionStorage.setItem(storageKey(), "1");
|
|
22
|
+
} catch {}
|
|
23
|
+
window.dispatchEvent(new CustomEvent(DISMISS_EVENT));
|
|
24
|
+
}
|
|
25
|
+
function subscribeReminderDismissal(listener) {
|
|
26
|
+
window.addEventListener(DISMISS_EVENT, listener);
|
|
27
|
+
return () => window.removeEventListener(DISMISS_EVENT, listener);
|
|
28
|
+
}
|
|
29
|
+
// src/rewards/inlineSurfaces.ts
|
|
30
|
+
const surfaces = /* @__PURE__ */ new Set();
|
|
31
|
+
const listeners$1 = /* @__PURE__ */ new Set();
|
|
32
|
+
function notify() {
|
|
33
|
+
for (const listener of listeners$1) listener();
|
|
34
|
+
}
|
|
35
|
+
/** An inline surface currently showing the claim prompt; the floating pill stays hidden meanwhile. */
|
|
36
|
+
function registerInlineReminder() {
|
|
37
|
+
const token = Symbol("inline-reminder");
|
|
38
|
+
surfaces.add(token);
|
|
39
|
+
notify();
|
|
40
|
+
return () => {
|
|
41
|
+
if (surfaces.delete(token)) notify();
|
|
42
|
+
};
|
|
43
|
+
}
|
|
44
|
+
function hasInlineReminder() {
|
|
45
|
+
return surfaces.size > 0;
|
|
46
|
+
}
|
|
47
|
+
function subscribeInlineReminders(listener) {
|
|
48
|
+
listeners$1.add(listener);
|
|
49
|
+
return () => listeners$1.delete(listener);
|
|
50
|
+
}
|
|
51
|
+
// src/hooks/useInlineReminder.ts
|
|
52
|
+
/** Call from an inline surface while it shows the claim prompt, so the floating pill steps aside. */
|
|
53
|
+
function useInlineReminderRegistration(active) {
|
|
54
|
+
useEffect(() => {
|
|
55
|
+
if (!active) return;
|
|
56
|
+
return registerInlineReminder();
|
|
57
|
+
}, [active]);
|
|
58
|
+
}
|
|
59
|
+
function useHasInlineReminder() {
|
|
60
|
+
return useSyncExternalStore(subscribeInlineReminders, hasInlineReminder);
|
|
61
|
+
}
|
|
62
|
+
function useReminderDismissed() {
|
|
63
|
+
return useSyncExternalStore(subscribeReminderDismissal, isReminderDismissed);
|
|
64
|
+
}
|
|
65
|
+
// src/rewards/rewardSummaryStore.ts
|
|
66
|
+
const CACHE_PREFIX = "frak-reward-summary-";
|
|
67
|
+
/** Something is waiting: it can be claimed, unlocked or paid any minute. */
|
|
68
|
+
const PENDING_TTL_MS = 6e5;
|
|
69
|
+
/** Nothing waiting: only a referral invalidates, so a purchase or share shows up once this expires. */
|
|
70
|
+
const IDLE_TTL_MS = 36e5;
|
|
71
|
+
let state = {
|
|
72
|
+
status: "idle",
|
|
73
|
+
summary: null
|
|
74
|
+
};
|
|
75
|
+
let inflight = null;
|
|
76
|
+
let generation = 0;
|
|
77
|
+
let invalidationBound = false;
|
|
78
|
+
let claimRefreshBound = false;
|
|
79
|
+
let claimStarted = false;
|
|
80
|
+
const listeners = /* @__PURE__ */ new Set();
|
|
81
|
+
function setState(next) {
|
|
82
|
+
state = next;
|
|
83
|
+
for (const listener of listeners) listener();
|
|
84
|
+
}
|
|
85
|
+
function cacheKey(merchantId) {
|
|
86
|
+
const clientId = getClientId();
|
|
87
|
+
return clientId ? `${CACHE_PREFIX}${merchantId}-${clientId}` : void 0;
|
|
88
|
+
}
|
|
89
|
+
function storageFor(summary) {
|
|
90
|
+
return summary.pending ? window.sessionStorage : window.localStorage;
|
|
91
|
+
}
|
|
92
|
+
function readCache(merchantId) {
|
|
93
|
+
const key = cacheKey(merchantId);
|
|
94
|
+
if (!key) return null;
|
|
95
|
+
for (const [storage, ttl] of [[window.sessionStorage, PENDING_TTL_MS], [window.localStorage, IDLE_TTL_MS]]) try {
|
|
96
|
+
const raw = storage.getItem(key);
|
|
97
|
+
if (!raw) continue;
|
|
98
|
+
const entry = JSON.parse(raw);
|
|
99
|
+
if (Date.now() - entry.at < ttl) return entry.summary;
|
|
100
|
+
storage.removeItem(key);
|
|
101
|
+
} catch {}
|
|
102
|
+
return null;
|
|
103
|
+
}
|
|
104
|
+
function writeCache(merchantId, summary) {
|
|
105
|
+
const key = cacheKey(merchantId);
|
|
106
|
+
if (!key) return;
|
|
107
|
+
try {
|
|
108
|
+
const entry = {
|
|
109
|
+
at: Date.now(),
|
|
110
|
+
summary
|
|
111
|
+
};
|
|
112
|
+
storageFor(summary).setItem(key, JSON.stringify(entry));
|
|
113
|
+
} catch {}
|
|
114
|
+
}
|
|
115
|
+
function clearCache() {
|
|
116
|
+
for (const storage of [window.sessionStorage, window.localStorage]) try {
|
|
117
|
+
const keys = [];
|
|
118
|
+
for (let index = 0; index < storage.length; index++) {
|
|
119
|
+
const key = storage.key(index);
|
|
120
|
+
if (key?.startsWith(CACHE_PREFIX)) keys.push(key);
|
|
121
|
+
}
|
|
122
|
+
for (const key of keys) storage.removeItem(key);
|
|
123
|
+
} catch {}
|
|
124
|
+
}
|
|
125
|
+
function bindInvalidation() {
|
|
126
|
+
if (invalidationBound || typeof window === "undefined") return;
|
|
127
|
+
invalidationBound = true;
|
|
128
|
+
window.addEventListener(REFERRAL_SUCCESS_EVENT, invalidateRewardSummary);
|
|
129
|
+
}
|
|
130
|
+
function refreshAfterClaim() {
|
|
131
|
+
if (!claimStarted || document.visibilityState === "hidden") return;
|
|
132
|
+
claimStarted = false;
|
|
133
|
+
invalidateRewardSummary();
|
|
134
|
+
}
|
|
135
|
+
function onPageShow(event) {
|
|
136
|
+
if (event.persisted) refreshAfterClaim();
|
|
137
|
+
}
|
|
138
|
+
/** A claim CTA was clicked: the next time the page is visible again the summary is refetched. */
|
|
139
|
+
function markClaimStarted() {
|
|
140
|
+
claimStarted = true;
|
|
141
|
+
if (claimRefreshBound || typeof window === "undefined") return;
|
|
142
|
+
claimRefreshBound = true;
|
|
143
|
+
document.addEventListener("visibilitychange", refreshAfterClaim);
|
|
144
|
+
window.addEventListener("pageshow", onPageShow);
|
|
145
|
+
}
|
|
146
|
+
/**
|
|
147
|
+
* Load the visitor's reward summary once per page, through a session/local cache.
|
|
148
|
+
* Failures are not cached: the next page asks again.
|
|
149
|
+
*/
|
|
150
|
+
function loadRewardSummary() {
|
|
151
|
+
bindInvalidation();
|
|
152
|
+
if (state.status === "ready") return Promise.resolve(state.summary);
|
|
153
|
+
if (inflight) return inflight;
|
|
154
|
+
const currentGeneration = generation;
|
|
155
|
+
setState({
|
|
156
|
+
status: "loading",
|
|
157
|
+
summary: state.summary
|
|
158
|
+
});
|
|
159
|
+
inflight = (async () => {
|
|
160
|
+
const merchantId = await sdkConfigStore.resolveMerchantId();
|
|
161
|
+
const cached = merchantId ? readCache(merchantId) : null;
|
|
162
|
+
const summary = cached ?? (merchantId ? await getRewardSummary({ merchantId }) : null);
|
|
163
|
+
if (currentGeneration === generation) {
|
|
164
|
+
if (summary && merchantId && !cached) writeCache(merchantId, summary);
|
|
165
|
+
setState({
|
|
166
|
+
status: "ready",
|
|
167
|
+
summary
|
|
168
|
+
});
|
|
169
|
+
}
|
|
170
|
+
return summary;
|
|
171
|
+
})().catch(() => {
|
|
172
|
+
if (currentGeneration === generation) setState({
|
|
173
|
+
status: "ready",
|
|
174
|
+
summary: null
|
|
175
|
+
});
|
|
176
|
+
return null;
|
|
177
|
+
}).finally(() => {
|
|
178
|
+
if (currentGeneration === generation) inflight = null;
|
|
179
|
+
});
|
|
180
|
+
return inflight;
|
|
181
|
+
}
|
|
182
|
+
/** Drop the cache after anything that can create or pay a reward; the next read refetches. */
|
|
183
|
+
function invalidateRewardSummary() {
|
|
184
|
+
generation += 1;
|
|
185
|
+
inflight = null;
|
|
186
|
+
clearCache();
|
|
187
|
+
setState({
|
|
188
|
+
status: "idle",
|
|
189
|
+
summary: state.summary
|
|
190
|
+
});
|
|
191
|
+
}
|
|
192
|
+
function getRewardSummaryState() {
|
|
193
|
+
return state;
|
|
194
|
+
}
|
|
195
|
+
function subscribeRewardSummary(listener) {
|
|
196
|
+
listeners.add(listener);
|
|
197
|
+
return () => listeners.delete(listener);
|
|
198
|
+
}
|
|
199
|
+
function isExpired(expiresAt) {
|
|
200
|
+
return expiresAt !== null && Date.parse(expiresAt) <= Date.now();
|
|
201
|
+
}
|
|
202
|
+
function isClaimable(summary) {
|
|
203
|
+
return !!summary && !summary.linked && !!summary.pending && summary.pending.count > 0 && !isExpired(summary.pending.expiresAt);
|
|
204
|
+
}
|
|
205
|
+
// src/hooks/useRewardSummary.ts
|
|
206
|
+
/**
|
|
207
|
+
* The visitor's reward summary at this merchant, shared by every component on the
|
|
208
|
+
* page. Fetches only once `enabled` (client ready, component visible), and again
|
|
209
|
+
* after an invalidation.
|
|
210
|
+
*/
|
|
211
|
+
function useRewardSummary(enabled) {
|
|
212
|
+
const snapshot = useSyncExternalStore(subscribeRewardSummary, getRewardSummaryState);
|
|
213
|
+
useEffect(() => {
|
|
214
|
+
if (enabled && snapshot.status === "idle") loadRewardSummary();
|
|
215
|
+
}, [enabled, snapshot.status]);
|
|
216
|
+
return snapshot;
|
|
217
|
+
}
|
|
218
|
+
// src/rewards/countdown.ts
|
|
219
|
+
const DAY_MS = 864e5;
|
|
220
|
+
/** Safari, and every iOS browser or web view, since all of them run WebKit's tracking prevention. */
|
|
221
|
+
function isStorageCappedBrowser(userAgent = typeof navigator === "undefined" ? "" : navigator.userAgent, ios = isIOS) {
|
|
222
|
+
if (ios) return true;
|
|
223
|
+
return /AppleWebKit/i.test(userAgent) && !/(Chrome|Chromium|CriOS|Edg|OPR|Android)/i.test(userAgent);
|
|
224
|
+
}
|
|
225
|
+
/** Days between local calendar dates, so the count agrees with the date shown beside it. */
|
|
226
|
+
function calendarDaysUntil(deadline, now) {
|
|
227
|
+
const dayOf = (ms) => {
|
|
228
|
+
const date = new Date(ms);
|
|
229
|
+
return Date.UTC(date.getFullYear(), date.getMonth(), date.getDate());
|
|
230
|
+
};
|
|
231
|
+
return Math.max(0, Math.round((dayOf(deadline) - dayOf(now)) / DAY_MS));
|
|
232
|
+
}
|
|
233
|
+
/**
|
|
234
|
+
* Countdown shown with an unclaimed reward. On WebKit it never exceeds 7 days, even
|
|
235
|
+
* without a deadline, since the visitor's storage would not outlive it; elsewhere a
|
|
236
|
+
* reward without a deadline gets no countdown.
|
|
237
|
+
*/
|
|
238
|
+
function getRewardCountdown(expiresAt, { now = Date.now(), capped = isStorageCappedBrowser() } = {}) {
|
|
239
|
+
const deadline = expiresAt ? Date.parse(expiresAt) : NaN;
|
|
240
|
+
const days = Number.isFinite(deadline) ? calendarDaysUntil(deadline, now) : void 0;
|
|
241
|
+
if (!capped) return days === void 0 ? void 0 : {
|
|
242
|
+
days,
|
|
243
|
+
date: new Date(deadline)
|
|
244
|
+
};
|
|
245
|
+
if (days !== void 0 && days <= 7) return {
|
|
246
|
+
days,
|
|
247
|
+
date: new Date(deadline)
|
|
248
|
+
};
|
|
249
|
+
return {
|
|
250
|
+
days: 7,
|
|
251
|
+
date: new Date(now + 7 * DAY_MS)
|
|
252
|
+
};
|
|
253
|
+
}
|
|
254
|
+
// src/rewards/format.ts
|
|
255
|
+
/** Backend config first, then the page's static SDK config. */
|
|
256
|
+
function resolveRewardCurrency() {
|
|
257
|
+
return sdkConfigStore.getConfig().currency ?? window.FrakSetup?.config?.metadata?.currency;
|
|
258
|
+
}
|
|
259
|
+
function pickFiat(amounts, currency) {
|
|
260
|
+
switch (getSupportedCurrency(currency)) {
|
|
261
|
+
case "usd": return amounts.usdAmount;
|
|
262
|
+
case "gbp": return amounts.gbpAmount;
|
|
263
|
+
default: return amounts.eurAmount;
|
|
264
|
+
}
|
|
265
|
+
}
|
|
266
|
+
function formatFiat(amounts, currency) {
|
|
267
|
+
return formatAmount(pickFiat(amounts, currency), currency);
|
|
268
|
+
}
|
|
269
|
+
/** Short day + month in the component's language, e.g. "5 Dec" / "5 déc.". */
|
|
270
|
+
function formatRewardDate(date, lang) {
|
|
271
|
+
return date.toLocaleDateString(lang === "fr" ? "fr-FR" : "en-GB", {
|
|
272
|
+
day: "numeric",
|
|
273
|
+
month: "short"
|
|
274
|
+
});
|
|
275
|
+
}
|
|
276
|
+
/** Fills `{REWARD}`, `{DAYS}`, `{DATE}` and `{BRAND}`; a missing value leaves an empty slot. */
|
|
277
|
+
function fillReminderText(template, values) {
|
|
278
|
+
return template.replaceAll("{REWARD}", () => values.reward ?? "").replaceAll("{DAYS}", () => values.days === void 0 ? "" : String(values.days)).replace(/\{DATE\}(\.?)/g, (_, dot) => {
|
|
279
|
+
const date = values.date ?? "";
|
|
280
|
+
return date.endsWith(".") ? date : date + dot;
|
|
281
|
+
}).replaceAll("{BRAND}", () => values.brand ?? "");
|
|
282
|
+
}
|
|
283
|
+
export { resolveRewardCurrency as a, isClaimable as c, useInlineReminderRegistration as d, useReminderDismissed as f, pickFiat as i, markClaimStarted as l, formatFiat as n, getRewardCountdown as o, dismissReminder as p, formatRewardDate as r, useRewardSummary as s, fillReminderText as t, useHasInlineReminder as u };
|
package/dist/i18n/defaults.d.ts
CHANGED
|
@@ -15,6 +15,9 @@ type ComponentCopy = {
|
|
|
15
15
|
referrerNoRewardText: string;
|
|
16
16
|
ctaText: string;
|
|
17
17
|
ctaNoRewardText: string;
|
|
18
|
+
/** Referee without a linked wallet; `claimCtaText` carries `{REWARD}`. */
|
|
19
|
+
claimCtaText: string;
|
|
20
|
+
claimCtaNoRewardText: string;
|
|
18
21
|
};
|
|
19
22
|
openInApp: {
|
|
20
23
|
text: string;
|
|
@@ -34,6 +37,52 @@ type ComponentCopy = {
|
|
|
34
37
|
inappDescription: string;
|
|
35
38
|
inappCta: string;
|
|
36
39
|
dismissLabel: string;
|
|
40
|
+
/** Pending mode: a visitor with an unclaimed reward. Title and CTA carry `{REWARD}`. */
|
|
41
|
+
pendingTitle: string;
|
|
42
|
+
pendingDescription: string;
|
|
43
|
+
/** Used when every pending reward is still locked; carries `{DATE}`. */
|
|
44
|
+
pendingDescriptionLocked: string;
|
|
45
|
+
pendingCta: string;
|
|
46
|
+
};
|
|
47
|
+
rewardReminder: {
|
|
48
|
+
/** Line above the amount; carries `{BRAND}` (and `{REWARD}`, which merchant copy may use). */
|
|
49
|
+
title: string;
|
|
50
|
+
/** One short line under the claim button. */
|
|
51
|
+
description: string;
|
|
52
|
+
/** Carries `{REWARD}`. */
|
|
53
|
+
cta: string;
|
|
54
|
+
later: string;
|
|
55
|
+
closeLabel: string;
|
|
56
|
+
dismissLabel: string;
|
|
57
|
+
/** Carries `{REWARD}`. */
|
|
58
|
+
pillLabel: string;
|
|
59
|
+
countdownToday: string;
|
|
60
|
+
countdownOneDay: string;
|
|
61
|
+
/** Carries `{DAYS}`. */
|
|
62
|
+
countdownDays: string;
|
|
63
|
+
deadlineToday: string;
|
|
64
|
+
/** Carries `{DATE}`. */
|
|
65
|
+
deadlineOneDay: string;
|
|
66
|
+
/** Carries `{DATE}`. */
|
|
67
|
+
deadlineDays: string;
|
|
68
|
+
/** Under the number in the day tile. */
|
|
69
|
+
tileDays: string;
|
|
70
|
+
tileOneDay: string;
|
|
71
|
+
/** Last-day tile: a short word, then its smaller second line. */
|
|
72
|
+
tileLastDay: string;
|
|
73
|
+
tileLastDayUnit: string;
|
|
74
|
+
/** Carries `{DATE}`. */
|
|
75
|
+
unlockNote: string;
|
|
76
|
+
/** Used when every pending reward is still locked; carries `{DATE}`. */
|
|
77
|
+
unlockNoteAll: string;
|
|
78
|
+
/** Carries `{REWARD}`. */
|
|
79
|
+
breakdownCashback: string;
|
|
80
|
+
/** Carries `{REWARD}`. */
|
|
81
|
+
breakdownFromFriends: string;
|
|
82
|
+
qrLabel: string;
|
|
83
|
+
/** Beside the small QR, which a click enlarges to a scannable size. */
|
|
84
|
+
qrHint: string;
|
|
85
|
+
qrCaption: string;
|
|
37
86
|
};
|
|
38
87
|
ambassador: {
|
|
39
88
|
heroEyebrow: string;
|
|
@@ -101,6 +150,29 @@ type ComponentCopy = {
|
|
|
101
150
|
faq5AnswerAfterLink: string;
|
|
102
151
|
attributionBeforeLink: string;
|
|
103
152
|
attributionLinkText: string;
|
|
153
|
+
/** "Your rewards" section; `{REWARD}`, `{DAYS}`, `{DATE}` and `{BRAND}` are filled at render. */
|
|
154
|
+
myRewardsEyebrow: string;
|
|
155
|
+
myRewardsCashbackLabel: string;
|
|
156
|
+
myRewardsFriendsLabel: string;
|
|
157
|
+
myRewardsCountdown: string;
|
|
158
|
+
myRewardsCountdownOneDay: string;
|
|
159
|
+
myRewardsCountdownToday: string;
|
|
160
|
+
myRewardsUnlockNote: string;
|
|
161
|
+
/** Used when every pending reward is still locked; carries `{DATE}`. */
|
|
162
|
+
myRewardsUnlockNoteAll: string;
|
|
163
|
+
myRewardsClaimCta: string;
|
|
164
|
+
myRewardsShareCta: string;
|
|
165
|
+
myRewardsLinkedHeading: string;
|
|
166
|
+
myRewardsReceived: string;
|
|
167
|
+
myRewardsOnItsWay: string;
|
|
168
|
+
myRewardsOnItsWayUnlock: string;
|
|
169
|
+
myRewardsWalletCta: string;
|
|
170
|
+
myRewardsShareAgainCta: string;
|
|
171
|
+
/** Desktop stub beside the claim block. */
|
|
172
|
+
myRewardsQrHeading: string;
|
|
173
|
+
myRewardsQrCaption: string;
|
|
174
|
+
/** Store heading while a reward is waiting to be claimed. */
|
|
175
|
+
storeHeadingClaim: string;
|
|
104
176
|
};
|
|
105
177
|
};
|
|
106
178
|
/**
|
package/dist/i18n/defaults.js
CHANGED
|
@@ -15,7 +15,9 @@ const componentDefaults = {
|
|
|
15
15
|
referrerText: "Earn {REWARD} by sharing this with your friends!",
|
|
16
16
|
referrerNoRewardText: "Share this with your friends and earn rewards!",
|
|
17
17
|
ctaText: "Share & earn {REWARD}",
|
|
18
|
-
ctaNoRewardText: "Share & earn"
|
|
18
|
+
ctaNoRewardText: "Share & earn",
|
|
19
|
+
claimCtaText: "Claim my {REWARD}",
|
|
20
|
+
claimCtaNoRewardText: "Claim my cashback"
|
|
19
21
|
},
|
|
20
22
|
openInApp: {
|
|
21
23
|
text: "Open in App",
|
|
@@ -30,7 +32,37 @@ const componentDefaults = {
|
|
|
30
32
|
inappTitle: "Open in your browser",
|
|
31
33
|
inappDescription: "For a better experience and to earn your rewards, open this page in your default browser.",
|
|
32
34
|
inappCta: "Open browser",
|
|
33
|
-
dismissLabel: "Dismiss"
|
|
35
|
+
dismissLabel: "Dismiss",
|
|
36
|
+
pendingTitle: "You have {REWARD} waiting",
|
|
37
|
+
pendingDescription: "Create your free Frak wallet to receive it.",
|
|
38
|
+
pendingDescriptionLocked: "Create your free Frak wallet to receive it. It unlocks on {DATE}.",
|
|
39
|
+
pendingCta: "Claim my {REWARD}"
|
|
40
|
+
},
|
|
41
|
+
rewardReminder: {
|
|
42
|
+
title: "Waiting for you at {BRAND}",
|
|
43
|
+
description: "Free with the Frak app, no bank details needed",
|
|
44
|
+
cta: "Claim my {REWARD}",
|
|
45
|
+
later: "Later",
|
|
46
|
+
closeLabel: "Close",
|
|
47
|
+
dismissLabel: "Dismiss reminder",
|
|
48
|
+
pillLabel: "{REWARD} to claim, show details",
|
|
49
|
+
countdownToday: "Expires today",
|
|
50
|
+
countdownOneDay: "1 day left",
|
|
51
|
+
countdownDays: "{DAYS} days left",
|
|
52
|
+
deadlineToday: "Lost if not claimed today.",
|
|
53
|
+
deadlineOneDay: "Lost if not claimed by {DATE}.",
|
|
54
|
+
deadlineDays: "Lost if not claimed by {DATE}.",
|
|
55
|
+
tileDays: "days left",
|
|
56
|
+
tileOneDay: "day left",
|
|
57
|
+
tileLastDay: "Last",
|
|
58
|
+
tileLastDayUnit: "day",
|
|
59
|
+
unlockNote: "Part of it unlocks on {DATE}.",
|
|
60
|
+
unlockNoteAll: "Unlocks on {DATE}.",
|
|
61
|
+
breakdownCashback: "{REWARD} cashback",
|
|
62
|
+
breakdownFromFriends: "{REWARD} from friends",
|
|
63
|
+
qrLabel: "QR code to claim your reward in the Frak wallet",
|
|
64
|
+
qrHint: "On a computer? Click to enlarge, then scan with your phone.",
|
|
65
|
+
qrCaption: "Scan with your phone to claim"
|
|
34
66
|
},
|
|
35
67
|
ambassador: {
|
|
36
68
|
heroEyebrow: "Ambassador program",
|
|
@@ -90,7 +122,26 @@ const componentDefaults = {
|
|
|
90
122
|
faq5AnswerLinkText: "Frak",
|
|
91
123
|
faq5AnswerAfterLink: " never sells any data to third parties.",
|
|
92
124
|
attributionBeforeLink: "Program powered by ",
|
|
93
|
-
attributionLinkText: "Frak"
|
|
125
|
+
attributionLinkText: "Frak",
|
|
126
|
+
myRewardsEyebrow: "Your rewards",
|
|
127
|
+
myRewardsCashbackLabel: "Cashback on your orders",
|
|
128
|
+
myRewardsFriendsLabel: "From your friends' purchases",
|
|
129
|
+
myRewardsCountdown: "{DAYS} days left to claim it, until {DATE}",
|
|
130
|
+
myRewardsCountdownOneDay: "1 day left to claim it, until {DATE}",
|
|
131
|
+
myRewardsCountdownToday: "Expires today, claim it now",
|
|
132
|
+
myRewardsUnlockNote: "Part of it unlocks on {DATE}",
|
|
133
|
+
myRewardsUnlockNoteAll: "Unlocks on {DATE}",
|
|
134
|
+
myRewardsClaimCta: "Claim my {REWARD}",
|
|
135
|
+
myRewardsShareCta: "Share to earn more",
|
|
136
|
+
myRewardsLinkedHeading: "Your rewards at {BRAND}",
|
|
137
|
+
myRewardsReceived: "{REWARD} received",
|
|
138
|
+
myRewardsOnItsWay: "{REWARD} on its way",
|
|
139
|
+
myRewardsOnItsWayUnlock: "{REWARD} on its way, unlocking on {DATE}",
|
|
140
|
+
myRewardsWalletCta: "Open my Frak wallet",
|
|
141
|
+
myRewardsShareAgainCta: "Share again",
|
|
142
|
+
myRewardsQrHeading: "On your computer?",
|
|
143
|
+
myRewardsQrCaption: "Scan with your phone to claim it in the Frak app.",
|
|
144
|
+
storeHeadingClaim: "Claim your {REWARD} in the app"
|
|
94
145
|
}
|
|
95
146
|
},
|
|
96
147
|
fr: {
|
|
@@ -101,7 +152,9 @@ const componentDefaults = {
|
|
|
101
152
|
referrerText: "Gagnez {REWARD} en partageant avec vos amis !",
|
|
102
153
|
referrerNoRewardText: "Partagez avec vos amis et gagnez des récompenses !",
|
|
103
154
|
ctaText: "Partagez et gagnez {REWARD}",
|
|
104
|
-
ctaNoRewardText: "Partagez et gagnez"
|
|
155
|
+
ctaNoRewardText: "Partagez et gagnez",
|
|
156
|
+
claimCtaText: "Récupérer mes {REWARD}",
|
|
157
|
+
claimCtaNoRewardText: "Récupérer mon cashback"
|
|
105
158
|
},
|
|
106
159
|
openInApp: {
|
|
107
160
|
text: "Ouvrir dans l'app",
|
|
@@ -116,7 +169,37 @@ const componentDefaults = {
|
|
|
116
169
|
inappTitle: "Ouvrez dans votre navigateur",
|
|
117
170
|
inappDescription: "Pour une meilleure expérience et pour gagner vos récompenses, ouvrez cette page dans votre navigateur par défaut.",
|
|
118
171
|
inappCta: "Ouvrir le navigateur",
|
|
119
|
-
dismissLabel: "Fermer"
|
|
172
|
+
dismissLabel: "Fermer",
|
|
173
|
+
pendingTitle: "Votre récompense de {REWARD} vous attend",
|
|
174
|
+
pendingDescription: "Créez votre wallet Frak gratuit pour la recevoir.",
|
|
175
|
+
pendingDescriptionLocked: "Créez votre wallet Frak gratuit pour la recevoir. Déblocage le {DATE}.",
|
|
176
|
+
pendingCta: "Récupérer mes {REWARD}"
|
|
177
|
+
},
|
|
178
|
+
rewardReminder: {
|
|
179
|
+
title: "Votre récompense chez {BRAND}",
|
|
180
|
+
description: "Gratuit avec l’app Frak, sans coordonnées bancaires",
|
|
181
|
+
cta: "Récupérer mes {REWARD}",
|
|
182
|
+
later: "Plus tard",
|
|
183
|
+
closeLabel: "Fermer",
|
|
184
|
+
dismissLabel: "Masquer le rappel",
|
|
185
|
+
pillLabel: "{REWARD} à récupérer, afficher le détail",
|
|
186
|
+
countdownToday: "Expire aujourd’hui",
|
|
187
|
+
countdownOneDay: "1 jour restant",
|
|
188
|
+
countdownDays: "{DAYS} jours restants",
|
|
189
|
+
deadlineToday: "Perdue si elle n’est pas récupérée aujourd’hui.",
|
|
190
|
+
deadlineOneDay: "Perdue si elle n’est pas récupérée d’ici le {DATE}.",
|
|
191
|
+
deadlineDays: "Perdue si elle n’est pas récupérée d’ici le {DATE}.",
|
|
192
|
+
tileDays: "jours restants",
|
|
193
|
+
tileOneDay: "jour restant",
|
|
194
|
+
tileLastDay: "Dernier",
|
|
195
|
+
tileLastDayUnit: "jour",
|
|
196
|
+
unlockNote: "Une partie se débloque le {DATE}.",
|
|
197
|
+
unlockNoteAll: "Se débloque le {DATE}.",
|
|
198
|
+
breakdownCashback: "{REWARD} de cashback",
|
|
199
|
+
breakdownFromFriends: "{REWARD} grâce à vos amis",
|
|
200
|
+
qrLabel: "QR code pour récupérer votre récompense dans le wallet Frak",
|
|
201
|
+
qrHint: "Sur ordinateur ? Agrandissez, puis scannez avec votre téléphone.",
|
|
202
|
+
qrCaption: "Scannez avec votre téléphone pour la récupérer"
|
|
120
203
|
},
|
|
121
204
|
ambassador: {
|
|
122
205
|
heroEyebrow: "Programme ambassadeur",
|
|
@@ -176,7 +259,26 @@ const componentDefaults = {
|
|
|
176
259
|
faq5AnswerLinkText: "Frak",
|
|
177
260
|
faq5AnswerAfterLink: " ne vend aucune donnée à des tiers.",
|
|
178
261
|
attributionBeforeLink: "Programme propulsé par ",
|
|
179
|
-
attributionLinkText: "Frak"
|
|
262
|
+
attributionLinkText: "Frak",
|
|
263
|
+
myRewardsEyebrow: "Vos récompenses",
|
|
264
|
+
myRewardsCashbackLabel: "Cashback sur vos commandes",
|
|
265
|
+
myRewardsFriendsLabel: "Issu des achats de vos amis",
|
|
266
|
+
myRewardsCountdown: "{DAYS} jours restants pour la récupérer, jusqu’au {DATE}",
|
|
267
|
+
myRewardsCountdownOneDay: "1 jour restant pour la récupérer, jusqu’au {DATE}",
|
|
268
|
+
myRewardsCountdownToday: "Expire aujourd’hui, récupérez-la maintenant",
|
|
269
|
+
myRewardsUnlockNote: "Une partie se débloque le {DATE}",
|
|
270
|
+
myRewardsUnlockNoteAll: "Se débloque le {DATE}",
|
|
271
|
+
myRewardsClaimCta: "Récupérer mes {REWARD}",
|
|
272
|
+
myRewardsShareCta: "Partager pour gagner plus",
|
|
273
|
+
myRewardsLinkedHeading: "Vos récompenses chez {BRAND}",
|
|
274
|
+
myRewardsReceived: "{REWARD} reçus",
|
|
275
|
+
myRewardsOnItsWay: "{REWARD} en route",
|
|
276
|
+
myRewardsOnItsWayUnlock: "{REWARD} en route, déblocage le {DATE}",
|
|
277
|
+
myRewardsWalletCta: "Ouvrir mon wallet Frak",
|
|
278
|
+
myRewardsShareAgainCta: "Partager à nouveau",
|
|
279
|
+
myRewardsQrHeading: "Sur ordinateur\xA0?",
|
|
280
|
+
myRewardsQrCaption: "Scannez avec votre téléphone pour la récupérer dans l’app Frak.",
|
|
281
|
+
storeHeadingClaim: "Récupérez vos {REWARD} dans l’app"
|
|
180
282
|
}
|
|
181
283
|
}
|
|
182
284
|
};
|
|
@@ -271,64 +271,4 @@ function WarningIcon(props) {
|
|
|
271
271
|
})
|
|
272
272
|
});
|
|
273
273
|
}
|
|
274
|
-
|
|
275
|
-
/**
|
|
276
|
-
* Gift icon with yellow accent circle and present box.
|
|
277
|
-
* Used by the referral banner and the post-purchase card.
|
|
278
|
-
*/
|
|
279
|
-
function GiftIcon(props) {
|
|
280
|
-
return /* @__PURE__ */ jsxs("svg", {
|
|
281
|
-
viewBox: "0 0 100 100",
|
|
282
|
-
fill: "none",
|
|
283
|
-
"aria-hidden": "true",
|
|
284
|
-
...props,
|
|
285
|
-
children: [
|
|
286
|
-
/* @__PURE__ */ jsx("circle", {
|
|
287
|
-
cx: "38",
|
|
288
|
-
cy: "28",
|
|
289
|
-
r: "23",
|
|
290
|
-
fill: "#FFF533"
|
|
291
|
-
}),
|
|
292
|
-
/* @__PURE__ */ jsx("path", {
|
|
293
|
-
d: "M50 38C30 10 12 30 50 38Z",
|
|
294
|
-
stroke: "#222222",
|
|
295
|
-
"stroke-width": "4",
|
|
296
|
-
"stroke-linecap": "round",
|
|
297
|
-
"stroke-linejoin": "round"
|
|
298
|
-
}),
|
|
299
|
-
/* @__PURE__ */ jsx("path", {
|
|
300
|
-
d: "M50 38C70 10 88 30 50 38Z",
|
|
301
|
-
stroke: "#222222",
|
|
302
|
-
"stroke-width": "4",
|
|
303
|
-
"stroke-linecap": "round",
|
|
304
|
-
"stroke-linejoin": "round"
|
|
305
|
-
}),
|
|
306
|
-
/* @__PURE__ */ jsx("rect", {
|
|
307
|
-
x: "10",
|
|
308
|
-
y: "38",
|
|
309
|
-
width: "80",
|
|
310
|
-
height: "16",
|
|
311
|
-
rx: "2",
|
|
312
|
-
stroke: "#222222",
|
|
313
|
-
"stroke-width": "4"
|
|
314
|
-
}),
|
|
315
|
-
/* @__PURE__ */ jsx("path", {
|
|
316
|
-
d: "M15 54V89C15 90.6 16.4 92 18 92H82C83.6 92 85 90.6 85 89V54",
|
|
317
|
-
stroke: "#222222",
|
|
318
|
-
"stroke-width": "4",
|
|
319
|
-
"stroke-linecap": "round",
|
|
320
|
-
"stroke-linejoin": "round"
|
|
321
|
-
}),
|
|
322
|
-
/* @__PURE__ */ jsx("line", {
|
|
323
|
-
x1: "50",
|
|
324
|
-
y1: "54",
|
|
325
|
-
x2: "50",
|
|
326
|
-
y2: "92",
|
|
327
|
-
stroke: "#222222",
|
|
328
|
-
"stroke-width": "4",
|
|
329
|
-
"stroke-linecap": "round"
|
|
330
|
-
})
|
|
331
|
-
]
|
|
332
|
-
});
|
|
333
|
-
}
|
|
334
|
-
export { CloseCircleIcon as a, ExternalLinkIcon as i, WarningIcon as n, LogoFrakWithName as r, GiftIcon as t };
|
|
274
|
+
export { CloseCircleIcon as i, LogoFrakWithName as n, ExternalLinkIcon as r, WarningIcon as t };
|
package/dist/postPurchase.d.ts
CHANGED
|
@@ -61,6 +61,11 @@ type PostPurchaseProps = {
|
|
|
61
61
|
* Use `{REWARD}` as placeholder for the reward amount.
|
|
62
62
|
*/
|
|
63
63
|
ctaText?: string;
|
|
64
|
+
/**
|
|
65
|
+
* Override the claim button text shown to a referee without a linked wallet.
|
|
66
|
+
* Use `{REWARD}` as placeholder for the reward amount.
|
|
67
|
+
*/
|
|
68
|
+
claimCtaText?: string;
|
|
64
69
|
/**
|
|
65
70
|
* Override the image displayed on the left of the post-purchase card.
|
|
66
71
|
* Accepts an image URL. Falls back to the built-in gift icon when omitted.
|
|
@@ -118,7 +123,7 @@ type PostPurchaseProps = {
|
|
|
118
123
|
* ></frak-post-purchase>
|
|
119
124
|
* ```
|
|
120
125
|
*/
|
|
121
|
-
export declare function PostPurchase({ customerId, orderId, token, sharingUrl, merchantId, placement: placementId, classname, variant: forcedVariant, badgeText: propBadgeText, referrerText: propReferrerText, refereeText: propRefereeText, ctaText: propCtaText, preview, previewVariant, products, imageUrl: propImageUrl }: PostPurchaseProps): import("preact").JSX.Element | null;
|
|
126
|
+
export declare function PostPurchase({ customerId, orderId, token, sharingUrl, merchantId, placement: placementId, classname, variant: forcedVariant, badgeText: propBadgeText, referrerText: propReferrerText, refereeText: propRefereeText, ctaText: propCtaText, claimCtaText: propClaimCtaText, preview, previewVariant, products, imageUrl: propImageUrl }: PostPurchaseProps): import("preact").JSX.Element | null;
|
|
122
127
|
/**
|
|
123
128
|
* Custom element interface for `<frak-post-purchase>`.
|
|
124
129
|
* Combines standard {@link HTMLElement} with {@link PostPurchaseProps}.
|