@frak-labs/components 1.3.3-beta.bbccfb81 → 1.3.3-beta.c4b15093
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.Cmb0kX5D.js +519 -0
- package/cdn/Banner.2WJ4pT6E.js +227 -0
- package/cdn/{ButtonShare.C7A2tEvB.js → ButtonShare.DSGvJfJ-.js} +1 -1
- package/cdn/{ButtonWallet.Cg2OK1di.js → ButtonWallet.DHpHCl4c.js} +2 -2
- package/cdn/GiftIcon.DYg5xgHg.js +1 -0
- package/cdn/InstallQr.CHImaq56.js +1 -0
- package/cdn/{OpenInAppButton.Djz_cb9Y.js → OpenInAppButton.CxBzRNKw.js} +1 -1
- package/cdn/PostPurchase.C75q-9BM.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.CW1SwrXH.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.t-rH9M3s.js → rewards.CeNLrK54.js} +1 -1
- package/cdn/useGlobalComponents.CNnOzerU.js +1 -0
- package/cdn/{useLightDomStyles.B72V1WPK.js → useLightDomStyles.557xWurb.js} +1 -1
- package/cdn/usePlacement.DYgmdkfr.js +1 -0
- package/cdn/{useReward.D2kXQbtD.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 +534 -178
- package/dist/banner.d.ts +20 -6
- package/dist/banner.js +235 -13
- 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 +187 -33
- package/dist/previewSummary-CMc6q8vI.js +37 -0
- package/dist/rewardReminder.d.ts +50 -0
- package/dist/rewardReminder.js +809 -0
- package/dist/{sharedBaseCss.css-nYy9vlzH.js → sharedBaseCss.css-D2HG4Ty8.js} +1 -1
- package/package.json +18 -12
- package/cdn/Ambassador.CKoap_px.js +0 -392
- package/cdn/Banner.BqfCxKs3.js +0 -208
- package/cdn/PostPurchase.Ch9VnOQG.js +0 -102
- package/cdn/jsxRuntime.module.DWH-kRVd.js +0 -58
- package/cdn/useGlobalComponents.DVgSWfOp.js +0 -1
- package/cdn/usePlacement.DEOEf5_6.js +0 -1
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}.
|
package/dist/postPurchase.js
CHANGED
|
@@ -1,13 +1,15 @@
|
|
|
1
1
|
import { a as useClientReady, o as registerWebComponent, r as useLang, s as openSharingPage } from "./sharedCss-SKmJGZgN.js";
|
|
2
2
|
import { i as w, n as K, t as C } from "./rewards-BuNthAR2.js";
|
|
3
|
-
import {
|
|
3
|
+
import { n as LogoFrakWithName } from "./icons-iN3qH_Bv.js";
|
|
4
4
|
import { t as useGlobalComponents } from "./useGlobalComponents-BF47jsBt.js";
|
|
5
5
|
import { t as useLightDomStyles } from "./useLightDomStyles-wGaNXHqN.js";
|
|
6
6
|
import { t as usePlacement } from "./usePlacement-Dd7itnCf.js";
|
|
7
7
|
import { componentDefaults } from "./i18n/defaults.js";
|
|
8
|
-
import { t as cssSource$2 } from "./sharedBaseCss.css-
|
|
8
|
+
import { t as cssSource$2 } from "./sharedBaseCss.css-D2HG4Ty8.js";
|
|
9
|
+
import { t as GiftIcon } from "./GiftIcon-Csu31jtf.js";
|
|
10
|
+
import { a as resolveRewardCurrency, c as isClaimable, d as useInlineReminderRegistration, l as markClaimStarted, n as formatFiat, o as getRewardCountdown, s as useRewardSummary } from "./format-zGdbUoX_.js";
|
|
9
11
|
import { sanitizeSharingProducts, trackEvent } from "@frak-labs/core-sdk";
|
|
10
|
-
import { getMerchantInformation, getUserReferralStatus, trackPurchaseStatus } from "@frak-labs/core-sdk/actions";
|
|
12
|
+
import { getInstallUrl, getMerchantInformation, getUserReferralStatus, trackPurchaseStatus } from "@frak-labs/core-sdk/actions";
|
|
11
13
|
import { useCallback, useEffect, useMemo, useRef, useState } from "preact/hooks";
|
|
12
14
|
import { jsx, jsxs } from "preact/jsx-runtime";
|
|
13
15
|
import { FrakRpcError, RpcErrorCodes } from "@frak-labs/frame-connector";
|
|
@@ -81,16 +83,38 @@ const cssSource$1 = `.PostPurchase_card__5fv5lh0 {
|
|
|
81
83
|
cursor: default;
|
|
82
84
|
}
|
|
83
85
|
|
|
84
|
-
.
|
|
86
|
+
.PostPurchase_claimLink__5fv5lh7 {
|
|
87
|
+
text-decoration: none;
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
.PostPurchase_claimLink__5fv5lh7:hover, .PostPurchase_claimLink__5fv5lh7:visited, .PostPurchase_claimLink__5fv5lh7:focus-visible {
|
|
91
|
+
color: var(--text-onAction__pbq4ak6);
|
|
92
|
+
text-decoration: none;
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
.PostPurchase_ctaSecondary__5fv5lh8 {
|
|
96
|
+
color: var(--text-primary__pbq4ak0);
|
|
97
|
+
border: 1px solid var(--border-default__pbq4akv);
|
|
98
|
+
background-color: #0000;
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
.PostPurchase_actions__5fv5lh9 {
|
|
102
|
+
flex-wrap: wrap;
|
|
103
|
+
align-items: center;
|
|
104
|
+
gap: 8px;
|
|
105
|
+
display: flex;
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
.PostPurchase_icon__5fv5lha {
|
|
85
109
|
margin: -2px 0;
|
|
86
110
|
}
|
|
87
111
|
|
|
88
|
-
.
|
|
112
|
+
.PostPurchase_giftIcon__5fv5lhb {
|
|
89
113
|
flex-shrink: 0;
|
|
90
114
|
display: block;
|
|
91
115
|
}
|
|
92
116
|
|
|
93
|
-
.
|
|
117
|
+
.PostPurchase_imageWrapper__5fv5lhc {
|
|
94
118
|
flex-shrink: 0;
|
|
95
119
|
justify-content: center;
|
|
96
120
|
align-items: center;
|
|
@@ -100,7 +124,7 @@ const cssSource$1 = `.PostPurchase_card__5fv5lh0 {
|
|
|
100
124
|
overflow: hidden;
|
|
101
125
|
}
|
|
102
126
|
|
|
103
|
-
.
|
|
127
|
+
.PostPurchase_customImage__5fv5lhd {
|
|
104
128
|
object-fit: contain;
|
|
105
129
|
width: auto;
|
|
106
130
|
max-width: 100%;
|
|
@@ -109,23 +133,130 @@ const cssSource$1 = `.PostPurchase_card__5fv5lh0 {
|
|
|
109
133
|
display: block;
|
|
110
134
|
}
|
|
111
135
|
|
|
112
|
-
.
|
|
136
|
+
.PostPurchase_frakLogo__5fv5lhe {
|
|
113
137
|
margin-left: auto;
|
|
114
138
|
display: block;
|
|
115
139
|
}
|
|
116
140
|
`;
|
|
141
|
+
// src/components/PostPurchase/PostPurchase.css.ts
|
|
142
|
+
var actions = "PostPurchase_actions__5fv5lh9";
|
|
117
143
|
var card = "PostPurchase_card__5fv5lh0";
|
|
118
144
|
var cardLayout = "PostPurchase_cardLayout__5fv5lh1";
|
|
119
145
|
var cardLeft = "PostPurchase_cardLeft__5fv5lh2";
|
|
120
146
|
var cardRight = "PostPurchase_cardRight__5fv5lh3";
|
|
147
|
+
var claimLink = "PostPurchase_claimLink__5fv5lh7";
|
|
121
148
|
var cta = "PostPurchase_cta__5fv5lh6 sharedBaseCss_buttonReset__7cswil0";
|
|
122
|
-
var
|
|
123
|
-
var
|
|
124
|
-
var
|
|
125
|
-
var
|
|
126
|
-
var
|
|
149
|
+
var ctaSecondary = "PostPurchase_ctaSecondary__5fv5lh8";
|
|
150
|
+
var customImage = "PostPurchase_customImage__5fv5lhd";
|
|
151
|
+
var frakLogo = "PostPurchase_frakLogo__5fv5lhe";
|
|
152
|
+
var giftIcon = "PostPurchase_giftIcon__5fv5lhb";
|
|
153
|
+
var icon = "PostPurchase_icon__5fv5lha";
|
|
154
|
+
var imageWrapper = "PostPurchase_imageWrapper__5fv5lhc";
|
|
127
155
|
var message = "PostPurchase_message__5fv5lh5";
|
|
128
156
|
const cssSource = cssSource$1;
|
|
157
|
+
// src/components/PostPurchase/ClaimButton.tsx
|
|
158
|
+
const SUMMARY_WAIT_MS = 1500;
|
|
159
|
+
/**
|
|
160
|
+
* Whether the referee card offers the claim button, and with which text. Unlinked
|
|
161
|
+
* visitors see it; the card waits briefly for the summary so it rarely grows a button late.
|
|
162
|
+
*/
|
|
163
|
+
function useRefereeClaim({ isPreview, isClientReady, isReferee, rewardText, lang, propText, configText }) {
|
|
164
|
+
const enabled = !isPreview && isClientReady && isReferee;
|
|
165
|
+
const { status, summary } = useRewardSummary(enabled);
|
|
166
|
+
const [timedOut, setTimedOut] = useState(false);
|
|
167
|
+
const ready = status === "ready";
|
|
168
|
+
useEffect(() => {
|
|
169
|
+
if (!enabled || ready) return;
|
|
170
|
+
const timer = setTimeout(() => setTimedOut(true), SUMMARY_WAIT_MS);
|
|
171
|
+
return () => clearTimeout(timer);
|
|
172
|
+
}, [enabled, ready]);
|
|
173
|
+
const settledRef = useRef(false);
|
|
174
|
+
if (status === "ready") settledRef.current = true;
|
|
175
|
+
const claimable = isClaimable(summary) ? summary : null;
|
|
176
|
+
const reward = claimable ? formatFiat(claimable.pending.total, resolveRewardCurrency()) : rewardText;
|
|
177
|
+
const show = isReferee && summary?.linked !== true;
|
|
178
|
+
const defaults = componentDefaults[lang].postPurchase;
|
|
179
|
+
const fallback = reward ? defaults.claimCtaText : defaults.claimCtaNoRewardText;
|
|
180
|
+
return {
|
|
181
|
+
awaitingSummary: !isPreview && isReferee && !settledRef.current && !timedOut,
|
|
182
|
+
show,
|
|
183
|
+
claimable: claimable !== null,
|
|
184
|
+
shareClassName: show ? `${cta} ${ctaSecondary} button` : `${cta} button`,
|
|
185
|
+
text: w(propText ?? configText ?? fallback, reward),
|
|
186
|
+
daysLeft: claimable ? getRewardCountdown(claimable.pending.expiresAt)?.days : void 0,
|
|
187
|
+
locked: (claimable?.pending.lockedCount ?? 0) > 0
|
|
188
|
+
};
|
|
189
|
+
}
|
|
190
|
+
/** Sends a referee with no linked wallet to the install page, carrying the order token. */
|
|
191
|
+
function ClaimButton({ claim, ...props }) {
|
|
192
|
+
return claim.show ? /* @__PURE__ */ jsx(ClaimLink, {
|
|
193
|
+
claim,
|
|
194
|
+
...props
|
|
195
|
+
}) : null;
|
|
196
|
+
}
|
|
197
|
+
function ClaimLink({ claim: { text, daysLeft, locked, claimable }, token, merchantId, placement, isPreview, isClientReady }) {
|
|
198
|
+
const [installUrl, setInstallUrl] = useState();
|
|
199
|
+
const impressionTracked = useRef(false);
|
|
200
|
+
const reminder = {
|
|
201
|
+
surface: "post_purchase",
|
|
202
|
+
placement,
|
|
203
|
+
days_left: daysLeft,
|
|
204
|
+
locked
|
|
205
|
+
};
|
|
206
|
+
useInlineReminderRegistration(!isPreview);
|
|
207
|
+
useEffect(() => {
|
|
208
|
+
if (isPreview || !isClientReady) return;
|
|
209
|
+
let cancelled = false;
|
|
210
|
+
getInstallUrl({
|
|
211
|
+
merchantId,
|
|
212
|
+
checkoutToken: token
|
|
213
|
+
}).then((url) => {
|
|
214
|
+
if (!cancelled) setInstallUrl(url);
|
|
215
|
+
}).catch((error) => console.error("Frak install link failed", error));
|
|
216
|
+
return () => {
|
|
217
|
+
cancelled = true;
|
|
218
|
+
};
|
|
219
|
+
}, [
|
|
220
|
+
isPreview,
|
|
221
|
+
isClientReady,
|
|
222
|
+
merchantId,
|
|
223
|
+
token
|
|
224
|
+
]);
|
|
225
|
+
useEffect(() => {
|
|
226
|
+
if (isPreview || !isClientReady || !claimable || impressionTracked.current) return;
|
|
227
|
+
impressionTracked.current = true;
|
|
228
|
+
trackEvent(window.FrakSetup?.client, "reward_reminder_impression", reminder);
|
|
229
|
+
}, [
|
|
230
|
+
isPreview,
|
|
231
|
+
isClientReady,
|
|
232
|
+
claimable,
|
|
233
|
+
reminder
|
|
234
|
+
]);
|
|
235
|
+
const handleClick = (event) => {
|
|
236
|
+
if (isPreview) return;
|
|
237
|
+
if (installUrl === void 0) {
|
|
238
|
+
event.preventDefault();
|
|
239
|
+
return;
|
|
240
|
+
}
|
|
241
|
+
markClaimStarted();
|
|
242
|
+
trackEvent(window.FrakSetup?.client, "post_purchase_clicked", {
|
|
243
|
+
placement,
|
|
244
|
+
variant: "referee",
|
|
245
|
+
action: "claim"
|
|
246
|
+
});
|
|
247
|
+
trackEvent(window.FrakSetup?.client, "reward_reminder_claim_clicked", reminder);
|
|
248
|
+
};
|
|
249
|
+
const inert = installUrl === void 0;
|
|
250
|
+
return /* @__PURE__ */ jsx("a", {
|
|
251
|
+
className: `${cta} ${claimLink} button`,
|
|
252
|
+
href: installUrl,
|
|
253
|
+
role: inert ? "link" : void 0,
|
|
254
|
+
tabIndex: inert ? 0 : void 0,
|
|
255
|
+
"aria-disabled": inert ? "true" : void 0,
|
|
256
|
+
onClick: handleClick,
|
|
257
|
+
children: text
|
|
258
|
+
});
|
|
259
|
+
}
|
|
129
260
|
// src/components/PostPurchase/PostPurchase.tsx
|
|
130
261
|
/**
|
|
131
262
|
* `onChainMetadata.domain` is a bare host and `sharing-url` defaults to `""` in
|
|
@@ -190,7 +321,7 @@ function resolvePostPurchaseContext(referralStatus, merchantInfo, currency, prod
|
|
|
190
321
|
* ></frak-post-purchase>
|
|
191
322
|
* ```
|
|
192
323
|
*/
|
|
193
|
-
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 }) {
|
|
324
|
+
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 }) {
|
|
194
325
|
const isPreview = !!preview;
|
|
195
326
|
const { shouldRender, isHidden, isClientReady } = useClientReady();
|
|
196
327
|
const placement = usePlacement(placementId);
|
|
@@ -270,11 +401,21 @@ function PostPurchase({ customerId, orderId, token, sharingUrl, merchantId, plac
|
|
|
270
401
|
propRefereeText,
|
|
271
402
|
propCtaText
|
|
272
403
|
]);
|
|
404
|
+
const claim = useRefereeClaim({
|
|
405
|
+
isPreview,
|
|
406
|
+
isClientReady,
|
|
407
|
+
isReferee: resolvedVariant === "referee",
|
|
408
|
+
rewardText,
|
|
409
|
+
lang,
|
|
410
|
+
propText: propClaimCtaText,
|
|
411
|
+
configText: postPurchaseConfig?.claimCtaText
|
|
412
|
+
});
|
|
273
413
|
useEffect(() => {
|
|
274
414
|
if (!resolvedVariant) return;
|
|
275
415
|
if (trackedImpressionVariantRef.current === resolvedVariant) return;
|
|
276
416
|
if (!isClientReady) return;
|
|
277
417
|
if (!isPreview && (!shouldRender || isHidden)) return;
|
|
418
|
+
if (claim.awaitingSummary) return;
|
|
278
419
|
trackEvent(window.FrakSetup?.client, "post_purchase_impression", {
|
|
279
420
|
placement: placementId,
|
|
280
421
|
variant: resolvedVariant,
|
|
@@ -288,13 +429,15 @@ function PostPurchase({ customerId, orderId, token, sharingUrl, merchantId, plac
|
|
|
288
429
|
isClientReady,
|
|
289
430
|
isPreview,
|
|
290
431
|
placementId,
|
|
291
|
-
context?.reward
|
|
432
|
+
context?.reward,
|
|
433
|
+
claim.awaitingSummary
|
|
292
434
|
]);
|
|
293
435
|
const handleClick = useCallback(() => {
|
|
294
436
|
if (!resolvedVariant) return;
|
|
295
437
|
trackEvent(window.FrakSetup?.client, "post_purchase_clicked", {
|
|
296
438
|
placement: placementId,
|
|
297
|
-
variant: resolvedVariant
|
|
439
|
+
variant: resolvedVariant,
|
|
440
|
+
action: "share"
|
|
298
441
|
});
|
|
299
442
|
openSharingPage("post_purchase", void 0, placementId, {
|
|
300
443
|
link: resolvedSharingUrl,
|
|
@@ -309,7 +452,7 @@ function PostPurchase({ customerId, orderId, token, sharingUrl, merchantId, plac
|
|
|
309
452
|
token
|
|
310
453
|
]);
|
|
311
454
|
if (!resolvedVariant) return null;
|
|
312
|
-
if (!isPreview && (!shouldRender || isHidden || !context)) return null;
|
|
455
|
+
if (!isPreview && (!shouldRender || isHidden || !context || claim.awaitingSummary)) return null;
|
|
313
456
|
const cardClass = [card, classname].filter(Boolean).join(" ");
|
|
314
457
|
return /* @__PURE__ */ jsx("div", {
|
|
315
458
|
className: cardClass,
|
|
@@ -326,22 +469,32 @@ function PostPurchase({ customerId, orderId, token, sharingUrl, merchantId, plac
|
|
|
326
469
|
class: message,
|
|
327
470
|
children: texts.message
|
|
328
471
|
}),
|
|
329
|
-
/* @__PURE__ */ jsxs("
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
className:
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
472
|
+
/* @__PURE__ */ jsxs("div", {
|
|
473
|
+
class: actions,
|
|
474
|
+
children: [/* @__PURE__ */ jsx(ClaimButton, {
|
|
475
|
+
claim,
|
|
476
|
+
token,
|
|
477
|
+
merchantId,
|
|
478
|
+
placement: placementId,
|
|
479
|
+
isPreview,
|
|
480
|
+
isClientReady
|
|
481
|
+
}), /* @__PURE__ */ jsxs("button", {
|
|
482
|
+
type: "button",
|
|
483
|
+
className: claim.shareClassName,
|
|
484
|
+
disabled: !isPreview && !isClientReady,
|
|
485
|
+
onClick: isPreview ? void 0 : handleClick,
|
|
486
|
+
children: [texts.cta, /* @__PURE__ */ jsx("svg", {
|
|
487
|
+
width: "16",
|
|
488
|
+
height: "16",
|
|
489
|
+
viewBox: "0 0 16 16",
|
|
490
|
+
fill: "none",
|
|
491
|
+
"aria-hidden": "true",
|
|
492
|
+
className: `${icon} button`,
|
|
493
|
+
children: /* @__PURE__ */ jsx("path", {
|
|
494
|
+
d: "M13.9 11.14C13.99 11.05 14.15 11.11 14.15 11.24V11.64C14.15 13.05 12.63 14.19 10.75 14.19C8.87 14.19 7.34 13.05 7.34 11.64V11.24C7.34 11.11 7.51 11.05 7.59 11.14C8.35 11.93 9.48 12.43 10.75 12.43C12.01 12.43 13.15 11.93 13.9 11.14ZM1.85 9.65C1.85 9.51 2.01 9.44 2.1 9.54C2.85 10.32 3.99 10.82 5.25 10.82C5.52 10.82 5.79 10.8 6.04 10.76C6.26 10.72 6.47 10.88 6.47 11.1V12.17C6.47 12.32 6.37 12.45 6.22 12.48C5.92 12.55 5.59 12.59 5.25 12.59C3.37 12.59 1.85 11.45 1.85 10.04V9.65ZM10.75 6.21C12.63 6.21 14.15 7.35 14.15 8.75C14.15 10.16 12.63 11.3 10.75 11.3C8.87 11.3 7.34 10.16 7.34 8.75C7.34 7.35 8.87 6.21 10.75 6.21ZM1.85 6.85C1.85 6.71 2.01 6.65 2.1 6.74C2.85 7.53 3.99 8.03 5.25 8.03C5.52 8.03 5.79 8 6.04 7.96C6.26 7.92 6.47 8.09 6.47 8.3V9.37C6.47 9.52 6.37 9.65 6.22 9.69C5.92 9.75 5.59 9.79 5.25 9.79C3.37 9.79 1.85 8.65 1.85 7.24V6.85ZM5.25 1.81C7.13 1.81 8.66 2.95 8.66 4.36C8.66 5.76 7.13 6.9 5.25 6.9C3.37 6.9 1.85 5.76 1.85 4.36C1.85 2.95 3.37 1.81 5.25 1.81Z",
|
|
495
|
+
fill: "currentColor"
|
|
496
|
+
})
|
|
497
|
+
})]
|
|
345
498
|
})]
|
|
346
499
|
})
|
|
347
500
|
]
|
|
@@ -381,6 +534,7 @@ registerWebComponent(PostPurchase, "frak-post-purchase", [
|
|
|
381
534
|
"referrerText",
|
|
382
535
|
"refereeText",
|
|
383
536
|
"ctaText",
|
|
537
|
+
"claimCtaText",
|
|
384
538
|
"products",
|
|
385
539
|
"preview",
|
|
386
540
|
"previewVariant",
|