@frak-labs/components 1.2.4 → 1.3.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/README.md +28 -0
- package/cdn/Ambassador.LCnsy5iT.js +320 -0
- package/cdn/Banner.BnzLkajr.js +183 -0
- package/cdn/ButtonShare.CgF4rWEO.js +1 -0
- package/cdn/ButtonWallet.JbMXw9dW.js +40 -0
- package/cdn/GiftIcon.Be-UU58r.js +1 -0
- package/cdn/OpenInAppButton.BaRZ25xH.js +1 -0
- package/cdn/PostPurchase.c3eqzVRl.js +89 -0
- package/cdn/components.js +1 -1
- package/cdn/jsxRuntime.module.CgbYebLx.js +58 -0
- package/cdn/loader.js +1 -1
- package/cdn/qr.Bdg4-2EI.js +5 -0
- package/cdn/{rewards.0JylBHNY.js → rewards.B_p05JY_.js} +1 -1
- package/cdn/useGlobalComponents.da05dAlQ.js +1 -0
- package/cdn/useLightDomStyles.CkTNHin8.js +1 -0
- package/cdn/usePlacement.b__OilKu.js +1 -0
- package/cdn/useReward.Duy0EWvi.js +1 -0
- package/dist/{GiftIcon-BmGGodb2.js → GiftIcon-DNqgjTjb.js} +1 -4
- package/dist/ambassador.d.ts +165 -0
- package/dist/ambassador.js +1679 -0
- package/dist/banner.js +7 -5
- package/dist/buttonShare.js +6 -5
- package/dist/buttonWallet.js +4 -3
- package/dist/i18n/defaults.d.ts +70 -9
- package/dist/i18n/defaults.js +123 -9
- package/dist/openInApp.js +3 -2
- package/dist/postPurchase.js +7 -5
- package/dist/sharedBaseCss.css-ChRUA1zY.js +5 -0
- package/dist/{usePlacement-iFDQqtJn.js → sharedCss-CPNmnpXA.js} +15 -23
- package/dist/{useGlobalComponents-Cj7uGBwD.js → useGlobalComponents-B3s2UQFk.js} +1 -1
- package/dist/{useLightDomStyles-D7bYu-ew.js → useLightDomStyles-BQ5FvCPi.js} +1 -1
- package/dist/usePlacement-BpaIbzun.js +21 -0
- package/dist/{useReward-k7RF3DhH.js → useReward-DEhiMfgl.js} +8 -2
- package/package.json +13 -4
- package/cdn/Banner.DUI-0KQP.js +0 -183
- package/cdn/ButtonShare.bYtZAlc0.js +0 -1
- package/cdn/ButtonWallet.ENPAuGPm.js +0 -40
- package/cdn/GiftIcon.pcCM0-Fr.js +0 -1
- package/cdn/OpenInAppButton.BoGl6QtG.js +0 -1
- package/cdn/PostPurchase.DIzXxlPV.js +0 -89
- package/cdn/defaults.tvSp2rcs.js +0 -58
- package/cdn/useGlobalComponents.DKsas1_6.js +0 -1
- package/cdn/useLightDomStyles.DrKjTWoi.js +0 -1
- package/cdn/useReward.DwuOhcD2.js +0 -1
package/dist/banner.js
CHANGED
|
@@ -1,10 +1,12 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { a as useClientReady, o as registerWebComponent, r as useLang } from "./sharedCss-CPNmnpXA.js";
|
|
2
2
|
import { i as w } from "./rewards-DoVY1pWr.js";
|
|
3
|
-
import { t as useGlobalComponents } from "./useGlobalComponents-
|
|
4
|
-
import { t as useLightDomStyles } from "./useLightDomStyles-
|
|
5
|
-
import { t as useReward } from "./useReward-
|
|
3
|
+
import { t as useGlobalComponents } from "./useGlobalComponents-B3s2UQFk.js";
|
|
4
|
+
import { t as useLightDomStyles } from "./useLightDomStyles-BQ5FvCPi.js";
|
|
5
|
+
import { t as useReward } from "./useReward-DEhiMfgl.js";
|
|
6
6
|
import { componentDefaults } from "./i18n/defaults.js";
|
|
7
|
-
import {
|
|
7
|
+
import { t as cssSource$5 } from "./sharedBaseCss.css-ChRUA1zY.js";
|
|
8
|
+
import { t as usePlacement } from "./usePlacement-BpaIbzun.js";
|
|
9
|
+
import { a as CloseCircleIcon, i as ExternalLinkIcon, n as WarningIcon, r as LogoFrakWithName, t as GiftIcon } from "./GiftIcon-DNqgjTjb.js";
|
|
8
10
|
import { isInAppBrowser, redirectToExternalBrowser, sanitizeProductDetailsList, trackEvent } from "@frak-labs/core-sdk";
|
|
9
11
|
import { REFERRAL_SUCCESS_EVENT, getMergeToken } from "@frak-labs/core-sdk/actions";
|
|
10
12
|
import { useCallback, useEffect, useMemo, useRef, useState } from "preact/hooks";
|
package/dist/buttonShare.js
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { a as useClientReady, o as registerWebComponent, r as useLang, s as openSharingPage } from "./sharedCss-CPNmnpXA.js";
|
|
2
2
|
import { i as w } from "./rewards-DoVY1pWr.js";
|
|
3
|
-
import { t as useGlobalComponents } from "./useGlobalComponents-
|
|
4
|
-
import { t as useLightDomStyles } from "./useLightDomStyles-
|
|
5
|
-
import { t as useReward } from "./useReward-
|
|
3
|
+
import { t as useGlobalComponents } from "./useGlobalComponents-B3s2UQFk.js";
|
|
4
|
+
import { t as useLightDomStyles } from "./useLightDomStyles-BQ5FvCPi.js";
|
|
5
|
+
import { t as useReward } from "./useReward-DEhiMfgl.js";
|
|
6
6
|
import { componentDefaults } from "./i18n/defaults.js";
|
|
7
|
+
import { t as usePlacement } from "./usePlacement-BpaIbzun.js";
|
|
7
8
|
import { sanitizeSharingProducts, trackEvent } from "@frak-labs/core-sdk";
|
|
8
9
|
import { useCallback, useEffect, useMemo, useRef } from "preact/hooks";
|
|
9
10
|
import { jsx } from "preact/jsx-runtime";
|
|
@@ -111,7 +112,7 @@ function ButtonShare({ placement: placementId, text, classname = "", noRewardTex
|
|
|
111
112
|
has_reward: Boolean(reward),
|
|
112
113
|
click_action: resolvedClickAction
|
|
113
114
|
});
|
|
114
|
-
openSharingPage(resolvedTargetInteraction, placementId, { products: parsedProducts });
|
|
115
|
+
openSharingPage("share_button", resolvedTargetInteraction, placementId, { products: parsedProducts });
|
|
115
116
|
}, [
|
|
116
117
|
isPreview,
|
|
117
118
|
resolvedClickAction,
|
package/dist/buttonWallet.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { t as useReward } from "./useReward-
|
|
1
|
+
import { a as useClientReady, o as registerWebComponent, r as useLang, s as openSharingPage, t as buildStyleContent } from "./sharedCss-CPNmnpXA.js";
|
|
2
|
+
import { t as useReward } from "./useReward-DEhiMfgl.js";
|
|
3
3
|
import { componentDefaults } from "./i18n/defaults.js";
|
|
4
|
+
import { t as usePlacement } from "./usePlacement-BpaIbzun.js";
|
|
4
5
|
import { trackEvent } from "@frak-labs/core-sdk";
|
|
5
6
|
import { useCallback, useEffect, useRef } from "preact/hooks";
|
|
6
7
|
import { Fragment, jsx, jsxs } from "preact/jsx-runtime";
|
|
@@ -147,7 +148,7 @@ function ButtonWallet({ placement: placementId, classname = "", useReward: rawUs
|
|
|
147
148
|
click_action: "sharing-page"
|
|
148
149
|
});
|
|
149
150
|
safeVibrate();
|
|
150
|
-
openSharingPage(resolvedTargetInteraction, placementId);
|
|
151
|
+
openSharingPage("share_button", resolvedTargetInteraction, placementId);
|
|
151
152
|
}, [
|
|
152
153
|
placementId,
|
|
153
154
|
resolvedTargetInteraction,
|
package/dist/i18n/defaults.d.ts
CHANGED
|
@@ -36,19 +36,80 @@ type ComponentCopy = {
|
|
|
36
36
|
inappCta: string;
|
|
37
37
|
dismissLabel: string;
|
|
38
38
|
};
|
|
39
|
+
ambassador: {
|
|
40
|
+
heroEyebrow: string;
|
|
41
|
+
heroHeadline: string;
|
|
42
|
+
/** `heroLede` never carries a `{REWARD}` token; `heroLedeReward` does. */
|
|
43
|
+
heroLede: string;
|
|
44
|
+
heroLedeReward: string;
|
|
45
|
+
heroCtaLabel: string;
|
|
46
|
+
heroFacesCaption: string;
|
|
47
|
+
heroImageAlt: string;
|
|
48
|
+
heroRewardCaption: string;
|
|
49
|
+
/** Rendered only when a referee reward resolves, never otherwise; `*NoReward` names a percentage reward, which has no figure. */
|
|
50
|
+
heroRewardRefereePill: string;
|
|
51
|
+
heroRewardRefereePillNoReward: string;
|
|
52
|
+
rewardEyebrow: string;
|
|
53
|
+
rewardHeadingReward: string;
|
|
54
|
+
rewardHeadingNoReward: string;
|
|
55
|
+
rewardEstimateCaption: string;
|
|
56
|
+
rewardLede: string;
|
|
57
|
+
rewardCtaLabel: string;
|
|
58
|
+
rewardFooterCaption: string;
|
|
59
|
+
rewardNoBankDetails: string;
|
|
60
|
+
/** The no-reward swap-in text for any amount display; keeps the sentence's subject. */
|
|
61
|
+
rewardFallbackLabel: string;
|
|
62
|
+
explainerTitle: string;
|
|
63
|
+
explainerLede: string;
|
|
64
|
+
explainerStep1Title: string;
|
|
65
|
+
explainerStep1Description: string;
|
|
66
|
+
explainerStep2Title: string;
|
|
67
|
+
explainerStep2Description: string;
|
|
68
|
+
explainerStep3Title: string;
|
|
69
|
+
explainerStep3Description: string;
|
|
70
|
+
winWinHeading: string;
|
|
71
|
+
winWinLede: string;
|
|
72
|
+
winWinCard1Title: string;
|
|
73
|
+
winWinCard1Description: string;
|
|
74
|
+
winWinCard2Title: string;
|
|
75
|
+
winWinCard2Description: string;
|
|
76
|
+
referralHeading: string;
|
|
77
|
+
referralLede: string;
|
|
78
|
+
referralCtaLabel: string;
|
|
79
|
+
storeHeading: string;
|
|
80
|
+
storeLede: string;
|
|
81
|
+
storeAppBadgeAriaLabel: string;
|
|
82
|
+
storePlayBadgeAriaLabel: string;
|
|
83
|
+
storeQrLabel: string;
|
|
84
|
+
storeQrCaption: string;
|
|
85
|
+
faqHeading: string;
|
|
86
|
+
faq1Question: string;
|
|
87
|
+
faq1Answer: string;
|
|
88
|
+
faq2Question: string;
|
|
89
|
+
faq2Answer: string;
|
|
90
|
+
faq3Question: string;
|
|
91
|
+
faq3Answer: string;
|
|
92
|
+
/** Perk-free swap-in when the campaign has no referee reward. */
|
|
93
|
+
faq3AnswerNoReward: string;
|
|
94
|
+
faq4Question: string;
|
|
95
|
+
faq4Answer: string;
|
|
96
|
+
faq5Question: string;
|
|
97
|
+
/** The two frak.id anchors are markup inside plain copy: each is split into
|
|
98
|
+
* before/link-text/after keys so the component can render a real `<a>` around
|
|
99
|
+
* the link text without flattening it to a string (content-spec Rule 5). */
|
|
100
|
+
faq5AnswerBeforeLink: string;
|
|
101
|
+
faq5AnswerLinkText: string;
|
|
102
|
+
faq5AnswerAfterLink: string;
|
|
103
|
+
attributionBeforeLink: string;
|
|
104
|
+
attributionLinkText: string;
|
|
105
|
+
};
|
|
39
106
|
};
|
|
40
107
|
/**
|
|
41
108
|
* Built-in, per-language default copy for the SDK Web Components.
|
|
42
109
|
*
|
|
43
|
-
*
|
|
44
|
-
*
|
|
45
|
-
*
|
|
46
|
-
* i18n runtime (e.g. i18next) into the size-critical CDN bundle — resolution
|
|
47
|
-
* is a plain object lookup keyed by the active language (see `useLang`).
|
|
48
|
-
*
|
|
49
|
-
* Adding a new language is a matter of adding one entry here plus extending
|
|
50
|
-
* the `Language` union in `@frak-labs/core-sdk` — no new dependency, no
|
|
51
|
-
* merchant action, no SDK API change.
|
|
110
|
+
* Last-resort fallback, used only when a merchant provides neither an HTML
|
|
111
|
+
* attribute override nor a backend-config override. A plain object lookup
|
|
112
|
+
* keyed by the active language keeps an i18n runtime out of the CDN bundle.
|
|
52
113
|
*/
|
|
53
114
|
export declare const componentDefaults: Record<Language, ComponentCopy>;
|
|
54
115
|
//#endregion
|
package/dist/i18n/defaults.js
CHANGED
|
@@ -2,15 +2,9 @@
|
|
|
2
2
|
/**
|
|
3
3
|
* Built-in, per-language default copy for the SDK Web Components.
|
|
4
4
|
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
* i18n runtime (e.g. i18next) into the size-critical CDN bundle — resolution
|
|
9
|
-
* is a plain object lookup keyed by the active language (see `useLang`).
|
|
10
|
-
*
|
|
11
|
-
* Adding a new language is a matter of adding one entry here plus extending
|
|
12
|
-
* the `Language` union in `@frak-labs/core-sdk` — no new dependency, no
|
|
13
|
-
* merchant action, no SDK API change.
|
|
5
|
+
* Last-resort fallback, used only when a merchant provides neither an HTML
|
|
6
|
+
* attribute override nor a backend-config override. A plain object lookup
|
|
7
|
+
* keyed by the active language keeps an i18n runtime out of the CDN bundle.
|
|
14
8
|
*/
|
|
15
9
|
const componentDefaults = {
|
|
16
10
|
en: {
|
|
@@ -37,6 +31,66 @@ const componentDefaults = {
|
|
|
37
31
|
inappDescription: "For a better experience and to earn your rewards, open this page in your default browser.",
|
|
38
32
|
inappCta: "Open browser",
|
|
39
33
|
dismissLabel: "Dismiss"
|
|
34
|
+
},
|
|
35
|
+
ambassador: {
|
|
36
|
+
heroEyebrow: "Ambassador program",
|
|
37
|
+
heroHeadline: "Become an ambassador for {BRAND}",
|
|
38
|
+
heroLede: "Love our products? Tell the people around you! Earn a reward as soon as someone buys thanks to you.",
|
|
39
|
+
heroLedeReward: "Love our products? Tell the people around you! Earn {REWARD} as soon as someone buys thanks to you.",
|
|
40
|
+
heroCtaLabel: "Become an ambassador",
|
|
41
|
+
heroFacesCaption: "No form, no waiting: anyone can become an ambassador right away.",
|
|
42
|
+
heroImageAlt: "{BRAND} ambassadors",
|
|
43
|
+
heroRewardCaption: "for you, on every sale",
|
|
44
|
+
heroRewardRefereePill: "+ {REWARD} for your friend",
|
|
45
|
+
heroRewardRefereePillNoReward: "+ a perk for your friend",
|
|
46
|
+
rewardEyebrow: "Referral program",
|
|
47
|
+
rewardHeadingReward: "{REWARD} for you on every sale",
|
|
48
|
+
rewardHeadingNoReward: "A reward for you on every sale",
|
|
49
|
+
rewardEstimateCaption: "Estimate: the amount depends on the campaign and your friend's order.",
|
|
50
|
+
rewardLede: "No cap: the more you share, the more sales your link brings in, and the more you earn!",
|
|
51
|
+
rewardCtaLabel: "Get my link",
|
|
52
|
+
rewardFooterCaption: "Free · no commitment · paid to your bank account",
|
|
53
|
+
rewardNoBankDetails: "no bank details needed to start",
|
|
54
|
+
rewardFallbackLabel: "A reward",
|
|
55
|
+
explainerTitle: "How it works",
|
|
56
|
+
explainerLede: "Three steps, nothing more.",
|
|
57
|
+
explainerStep1Title: "I share with the people close to me",
|
|
58
|
+
explainerStep1Description: "On WhatsApp, in an Instagram story, on TikTok… my unique link, generated automatically.",
|
|
59
|
+
explainerStep2Title: "I get paid",
|
|
60
|
+
explainerStep2Description: "Credited automatically to my wallet for every sale made through my referral link.",
|
|
61
|
+
explainerStep3Title: "I collect my money",
|
|
62
|
+
explainerStep3Description: "With the Frak app, I transfer my earnings to my bank account.",
|
|
63
|
+
winWinHeading: "Your friends win too",
|
|
64
|
+
winWinLede: "Recommend {BRAND} to the people close to you: they discover great products, and thanks to your link they get cashback on their first order. They can thank you for it!",
|
|
65
|
+
winWinCard1Title: "You",
|
|
66
|
+
winWinCard1Description: "to your secure wallet, on every sale",
|
|
67
|
+
winWinCard2Title: "Your friend",
|
|
68
|
+
winWinCard2Description: "in cashback to their secure wallet, on their first order",
|
|
69
|
+
referralHeading: "Your ambassador link",
|
|
70
|
+
referralLede: "Finally, a referral program that really pays!",
|
|
71
|
+
referralCtaLabel: "Share my link",
|
|
72
|
+
storeHeading: "Track your earnings in real time",
|
|
73
|
+
storeLede: "The Frak app notifies you as soon as a friend orders, and centralizes your earnings across every partner brand.",
|
|
74
|
+
storeAppBadgeAriaLabel: "Download on the App Store",
|
|
75
|
+
storePlayBadgeAriaLabel: "Get it on Google Play",
|
|
76
|
+
storeQrLabel: "QR code to install the Frak app",
|
|
77
|
+
storeQrCaption: "Scan to install",
|
|
78
|
+
faqHeading: "Frequently asked questions",
|
|
79
|
+
faq1Question: "Is it really free?",
|
|
80
|
+
faq1Answer: "Yes, completely free. No subscription, no hidden fees. Your earnings land in your Frak wallet: real money, transferable to a bank account, with no fees.",
|
|
81
|
+
faq2Question: "When do I get my money?",
|
|
82
|
+
faq2Answer: "For every order generated by your link, your earnings are credited automatically to your Frak wallet. They become transferable once the brand confirms the purchase, with no minimum amount.",
|
|
83
|
+
faq3Question: "Do my friends pay more with my link?",
|
|
84
|
+
faq3Answer: "No, quite the opposite: you win and so do your friends. By ordering through your link, they also get cashback on their purchase.",
|
|
85
|
+
faq3AnswerNoReward: "No. Your link doesn't change the price: your friends pay exactly what everyone else pays.",
|
|
86
|
+
faq4Question: "Do I need to be an influencer?",
|
|
87
|
+
faq4Answer: "No, not at all. No application, no minimum follower count: the program is open to all our customers, whatever the size of your network.",
|
|
88
|
+
faq5Question: "What is Frak?",
|
|
89
|
+
faq5AnswerBeforeLink: "The partner that handles referral tracking and payouts for {BRAND}. ",
|
|
90
|
+
faq5AnswerLinkText: "Frak",
|
|
91
|
+
faq5AnswerAfterLink: " never sells any data to third parties.",
|
|
92
|
+
attributionBeforeLink: "Program powered by ",
|
|
93
|
+
attributionLinkText: "Frak"
|
|
40
94
|
}
|
|
41
95
|
},
|
|
42
96
|
fr: {
|
|
@@ -63,6 +117,66 @@ const componentDefaults = {
|
|
|
63
117
|
inappDescription: "Pour une meilleure expérience et pour gagner vos récompenses, ouvrez cette page dans votre navigateur par défaut.",
|
|
64
118
|
inappCta: "Ouvrir le navigateur",
|
|
65
119
|
dismissLabel: "Fermer"
|
|
120
|
+
},
|
|
121
|
+
ambassador: {
|
|
122
|
+
heroEyebrow: "Programme ambassadeur",
|
|
123
|
+
heroHeadline: "Devenez ambassadeur {BRAND}",
|
|
124
|
+
heroLede: "Vous aimez nos produits\xA0? Parlez-en autour de vous\xA0! Gagnez une récompense dès qu’un achat est réalisé grâce à vous.",
|
|
125
|
+
heroLedeReward: "Vous aimez nos produits\xA0? Parlez-en autour de vous\xA0! Gagnez {REWARD} dès qu’un achat est réalisé grâce à vous.",
|
|
126
|
+
heroCtaLabel: "Devenir ambassadeur",
|
|
127
|
+
heroFacesCaption: "Pas de formulaire, pas d’attente\xA0: tout le monde peut devenir ambassadeur immédiatement.",
|
|
128
|
+
heroImageAlt: "Ambassadrices et ambassadeurs {BRAND}",
|
|
129
|
+
heroRewardCaption: "pour vous, à chaque vente",
|
|
130
|
+
heroRewardRefereePill: "+ {REWARD} offerts à votre filleul",
|
|
131
|
+
heroRewardRefereePillNoReward: "+ un avantage pour votre filleul",
|
|
132
|
+
rewardEyebrow: "Programme de parrainage",
|
|
133
|
+
rewardHeadingReward: "{REWARD} pour vous à chaque vente",
|
|
134
|
+
rewardHeadingNoReward: "Une récompense pour vous à chaque vente",
|
|
135
|
+
rewardEstimateCaption: "Estimation\xA0: le montant dépend de la campagne et du panier de votre proche.",
|
|
136
|
+
rewardLede: "Pas de plafond\xA0: plus vous partagez, plus de ventes sont générées grâce à votre lien, plus vous gagnez\xA0!",
|
|
137
|
+
rewardCtaLabel: "Obtenir mon lien",
|
|
138
|
+
rewardFooterCaption: "Gratuit · sans engagement · versé sur votre compte bancaire",
|
|
139
|
+
rewardNoBankDetails: "sans donnée bancaire pour commencer",
|
|
140
|
+
rewardFallbackLabel: "Une récompense",
|
|
141
|
+
explainerTitle: "Comment ça marche",
|
|
142
|
+
explainerLede: "Trois gestes, rien de plus.",
|
|
143
|
+
explainerStep1Title: "Je partage à mes proches",
|
|
144
|
+
explainerStep1Description: "Via WhatsApp, en story Instagram, sur TikTok… mon lien unique, généré automatiquement.",
|
|
145
|
+
explainerStep2Title: "Je reçois de l’argent",
|
|
146
|
+
explainerStep2Description: "Crédité automatiquement dans mon porte-monnaie à chaque vente générée grâce à mon lien de recommandation.",
|
|
147
|
+
explainerStep3Title: "Je récupère mon argent",
|
|
148
|
+
explainerStep3Description: "En téléchargeant l’app Frak, je transfère mes gains sur mon compte bancaire.",
|
|
149
|
+
winWinHeading: "Vos proches y gagnent aussi",
|
|
150
|
+
winWinLede: "En conseillant {BRAND} à vos proches, non seulement vous leur faites découvrir de super produits, mais en plus, grâce à votre lien, ils bénéficient d’un cashback sur leur première commande\xA0: ils peuvent vous dire merci\xA0!",
|
|
151
|
+
winWinCard1Title: "Vous",
|
|
152
|
+
winWinCard1Description: "sur votre porte-monnaie sécurisé, à chaque vente",
|
|
153
|
+
winWinCard2Title: "Votre filleul",
|
|
154
|
+
winWinCard2Description: "en cashback sur son porte-monnaie sécurisé, à sa première commande",
|
|
155
|
+
referralHeading: "Votre lien d’ambassadeur",
|
|
156
|
+
referralLede: "Enfin un vrai programme de parrainage rémunérateur\xA0!",
|
|
157
|
+
referralCtaLabel: "Partager mon lien",
|
|
158
|
+
storeHeading: "Suivez vos gains en temps réel",
|
|
159
|
+
storeLede: "L’app Frak vous prévient dès qu’un ami commande, et centralise vos gains sur toutes les marques partenaires.",
|
|
160
|
+
storeAppBadgeAriaLabel: "Télécharger dans l’App Store",
|
|
161
|
+
storePlayBadgeAriaLabel: "Disponible sur Google Play",
|
|
162
|
+
storeQrLabel: "QR code pour installer l’app Frak",
|
|
163
|
+
storeQrCaption: "Scannez pour installer",
|
|
164
|
+
faqHeading: "Questions fréquentes",
|
|
165
|
+
faq1Question: "C’est vraiment gratuit\xA0?",
|
|
166
|
+
faq1Answer: "Oui, totalement gratuit. Pas d’abonnement, pas de frais cachés. Vos gains arrivent dans votre porte-monnaie Frak\xA0: de l’argent réel, transférable vers un compte bancaire, sans commission.",
|
|
167
|
+
faq2Question: "Quand est-ce que je reçois mon argent\xA0?",
|
|
168
|
+
faq2Answer: "À chaque commande générée par votre lien, vos gains sont crédités automatiquement dans votre porte-monnaie Frak. Ils deviennent transférables une fois l’achat confirmé par la marque, sans montant minimum.",
|
|
169
|
+
faq3Question: "Mes amis paient-ils plus cher avec mon lien\xA0?",
|
|
170
|
+
faq3Answer: "Non, au contraire\xA0: vous êtes gagnant et vos proches aussi. En commandant via votre lien, ils reçoivent eux aussi un cashback sur leur achat.",
|
|
171
|
+
faq3AnswerNoReward: "Non. Votre lien ne change rien au prix\xA0: vos proches paient exactement le même montant que tout le monde.",
|
|
172
|
+
faq4Question: "Il faut être influenceur\xA0?",
|
|
173
|
+
faq4Answer: "Non, pas du tout. Aucune candidature, aucun minimum de followers\xA0: le programme est ouvert à tous nos clients, quelle que soit la taille de votre réseau.",
|
|
174
|
+
faq5Question: "C’est quoi Frak\xA0?",
|
|
175
|
+
faq5AnswerBeforeLink: "Le partenaire qui gère le suivi des parrainages et le versement des gains pour {BRAND}. ",
|
|
176
|
+
faq5AnswerLinkText: "Frak",
|
|
177
|
+
faq5AnswerAfterLink: " ne vend aucune donnée à des tiers.",
|
|
178
|
+
attributionBeforeLink: "Programme propulsé par ",
|
|
179
|
+
attributionLinkText: "Frak"
|
|
66
180
|
}
|
|
67
181
|
}
|
|
68
182
|
};
|
package/dist/openInApp.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { t as useLightDomStyles } from "./useLightDomStyles-
|
|
1
|
+
import { a as useClientReady, o as registerWebComponent, r as useLang } from "./sharedCss-CPNmnpXA.js";
|
|
2
|
+
import { t as useLightDomStyles } from "./useLightDomStyles-BQ5FvCPi.js";
|
|
3
3
|
import { componentDefaults } from "./i18n/defaults.js";
|
|
4
|
+
import { t as usePlacement } from "./usePlacement-BpaIbzun.js";
|
|
4
5
|
import { DEEP_LINK_SCHEME, isMobile, trackEvent, triggerDeepLinkWithFallback } from "@frak-labs/core-sdk";
|
|
5
6
|
import { jsx } from "preact/jsx-runtime";
|
|
6
7
|
//#region src/actions/openInApp.ts
|
package/dist/postPurchase.js
CHANGED
|
@@ -1,9 +1,11 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { a as useClientReady, o as registerWebComponent, r as useLang, s as openSharingPage } from "./sharedCss-CPNmnpXA.js";
|
|
2
2
|
import { i as w, n as K, t as C } from "./rewards-DoVY1pWr.js";
|
|
3
|
-
import { t as useGlobalComponents } from "./useGlobalComponents-
|
|
4
|
-
import { t as useLightDomStyles } from "./useLightDomStyles-
|
|
3
|
+
import { t as useGlobalComponents } from "./useGlobalComponents-B3s2UQFk.js";
|
|
4
|
+
import { t as useLightDomStyles } from "./useLightDomStyles-BQ5FvCPi.js";
|
|
5
5
|
import { componentDefaults } from "./i18n/defaults.js";
|
|
6
|
-
import {
|
|
6
|
+
import { t as cssSource$2 } from "./sharedBaseCss.css-ChRUA1zY.js";
|
|
7
|
+
import { t as usePlacement } from "./usePlacement-BpaIbzun.js";
|
|
8
|
+
import { r as LogoFrakWithName, t as GiftIcon } from "./GiftIcon-DNqgjTjb.js";
|
|
7
9
|
import { sanitizeSharingProducts, trackEvent } from "@frak-labs/core-sdk";
|
|
8
10
|
import { getMerchantInformation, getUserReferralStatus, trackPurchaseStatus } from "@frak-labs/core-sdk/actions";
|
|
9
11
|
import { useCallback, useEffect, useMemo, useRef, useState } from "preact/hooks";
|
|
@@ -282,7 +284,7 @@ function PostPurchase({ customerId, orderId, token, sharingUrl, merchantId, plac
|
|
|
282
284
|
placement: placementId,
|
|
283
285
|
variant: resolvedVariant
|
|
284
286
|
});
|
|
285
|
-
openSharingPage(void 0, placementId, {
|
|
287
|
+
openSharingPage("post_purchase", void 0, placementId, {
|
|
286
288
|
link: resolvedSharingUrl,
|
|
287
289
|
products: parsedProducts,
|
|
288
290
|
checkoutToken: token
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
//#endregion
|
|
2
|
+
//#region src/styles/sharedBaseCss.css.ts
|
|
3
|
+
const cssSource = ".reset_base__1831jhd0 {\n margin: 0;\n padding: 0;\n border: 0;\n box-sizing: border-box;\n font-size: 100%;\n font: inherit;\n vertical-align: baseline;\n -webkit-tap-highlight-color: transparent;\n}\n.reset_focusRing__1831jhd1 {\n outline: 2px solid transparent;\n outline-offset: 2px;\n}\n.reset_focusRing__1831jhd1:focus-visible {\n outline-color: currentColor;\n}\n.reset_fieldAppearance__1831jhd2 {\n appearance: none;\n background-color: transparent;\n}\n.reset_visuallyHidden__1831jhd3 {\n position: absolute;\n width: 1px;\n height: 1px;\n padding: 0;\n margin: -1px;\n overflow: hidden;\n clip: rect(0, 0, 0, 0);\n white-space: nowrap;\n border-width: 0;\n}\n.reset_element_ul__1831jhd4 {\n list-style: none;\n}\n.reset_element_ol__1831jhd5 {\n list-style: none;\n}\n.reset_element_button__1831jhd6 {\n cursor: pointer;\n}\n.reset_element_a__1831jhd7 {\n text-decoration: none;\n color: inherit;\n}\n.reset_element_table__1831jhdb {\n border-collapse: collapse;\n border-spacing: 0;\n}\n.reset_element_img__1831jhdc {\n display: block;\n max-width: 100%;\n}:root {\n --text-primary__pbq4ak0: #000000;\n --text-secondary__pbq4ak1: #525252;\n --text-tertiary__pbq4ak2: #a3a3a3;\n --text-disabled__pbq4ak3: #a3a3a3;\n --text-action__pbq4ak4: #0043ef;\n --text-actionHover__pbq4ak5: #0036bf;\n --text-onAction__pbq4ak6: #ffffff;\n --text-error__pbq4ak7: #e31c31;\n --text-success__pbq4ak8: #09be67;\n --text-warning__pbq4ak9: #ec7e00;\n --surface-primary__pbq4aka: #0043ef;\n --surface-secondary__pbq4akb: #f2f6fe;\n --surface-background__pbq4akc: #ffffff;\n --surface-background2__pbq4akd: #f9fafb;\n --surface-elevated__pbq4ake: #ffffff;\n --surface-muted__pbq4akf: #f7f7f7;\n --surface-tertiary__pbq4akg: #f7f7f7;\n --surface-overlay__pbq4akh: #000000b2;\n --surface-disabled__pbq4aki: #e2e2e2;\n --surface-primaryHover__pbq4akj: #0036bf;\n --surface-primaryPressed__pbq4akk: #00288f;\n --surface-secondaryHover__pbq4akl: #e5ecfd;\n --surface-secondaryPressed__pbq4akm: #ccd9fc;\n --surface-error__pbq4akn: #fce8ea;\n --surface-success__pbq4ako: #f3fcf7;\n --surface-warning__pbq4akp: #fef9f2;\n --border-subtle__pbq4akq: #f5f5f5;\n --border-focus__pbq4akr: #a3a3a3;\n --border-error__pbq4aks: #e31c31;\n --border-success__pbq4akt: #09be67;\n --border-warning__pbq4aku: #ec7e00;\n --border-default__pbq4akv: #e2e2e2;\n --icon-primary__pbq4akw: #000000;\n --icon-secondary__pbq4akx: #525252;\n --icon-tertiary__pbq4aky: #a3a3a3;\n --icon-disabled__pbq4akz: #a3a3a3;\n --icon-action__pbq4ak10: #0043ef;\n --icon-actionHover__pbq4ak11: #0036bf;\n --icon-onAction__pbq4ak12: #ffffff;\n --icon-error__pbq4ak13: #e31c31;\n --icon-success__pbq4ak14: #09be67;\n --icon-warning__pbq4ak15: #ec7e00;\n}.sharedBaseCss_buttonReset__7cswil0 {\n margin: 0;\n border: 0;\n appearance: none;\n background-color: transparent;\n box-sizing: border-box;\n font-family: inherit;\n -webkit-tap-highlight-color: transparent;\n cursor: pointer;\n outline: 2px solid transparent;\n outline-offset: 2px;\n}\n.sharedBaseCss_buttonReset__7cswil0:focus-visible {\n outline-color: currentColor;\n}";
|
|
4
|
+
//#endregion
|
|
5
|
+
export { cssSource as t };
|
|
@@ -3,10 +3,10 @@ import * as coreSdkIndex from "@frak-labs/core-sdk";
|
|
|
3
3
|
import { decodeProductsParam, deleteQueryParamCaseInsensitive, detectPageLanguage, getQueryParamCaseInsensitive, sdkConfigStore, setupClient, trackEvent, withCache } from "@frak-labs/core-sdk";
|
|
4
4
|
import * as coreSdkActions from "@frak-labs/core-sdk/actions";
|
|
5
5
|
import { displaySharingPage } from "@frak-labs/core-sdk/actions";
|
|
6
|
-
import {
|
|
6
|
+
import { useEffect, useState } from "preact/hooks";
|
|
7
7
|
import { useSyncExternalStore } from "preact/compat";
|
|
8
8
|
//#region src/actions/sharingPage.ts
|
|
9
|
-
async function openSharingPage(targetInteraction, placement, options) {
|
|
9
|
+
async function openSharingPage(entryPoint, targetInteraction, placement, options) {
|
|
10
10
|
if (!window.FrakSetup?.client) {
|
|
11
11
|
console.error("Frak client not found");
|
|
12
12
|
return;
|
|
@@ -15,8 +15,11 @@ async function openSharingPage(targetInteraction, placement, options) {
|
|
|
15
15
|
...options?.link && { link: options.link },
|
|
16
16
|
...options?.products?.length && { products: options.products },
|
|
17
17
|
...options?.checkoutToken && { checkoutToken: options.checkoutToken },
|
|
18
|
-
|
|
19
|
-
|
|
18
|
+
metadata: {
|
|
19
|
+
entryPoint,
|
|
20
|
+
...targetInteraction && { targetInteraction }
|
|
21
|
+
}
|
|
22
|
+
}, placement).catch((error) => console.error("Frak sharing page failed", error));
|
|
20
23
|
}
|
|
21
24
|
//#endregion
|
|
22
25
|
//#region src/utils/dom/detectListenerPreloads.ts
|
|
@@ -146,7 +149,7 @@ function handleActionQueryParam() {
|
|
|
146
149
|
has_link: Boolean(link),
|
|
147
150
|
has_products: Boolean(products?.length)
|
|
148
151
|
});
|
|
149
|
-
openSharingPage(void 0, placement, {
|
|
152
|
+
openSharingPage("auto_open", void 0, placement, {
|
|
150
153
|
link,
|
|
151
154
|
products
|
|
152
155
|
});
|
|
@@ -173,7 +176,12 @@ function onDocumentReady(callback) {
|
|
|
173
176
|
function registerWebComponent(component, tagName, observedAttributes = [], options = { shadow: true }) {
|
|
174
177
|
if (typeof window !== "undefined") {
|
|
175
178
|
onDocumentReady(initFrakSdk);
|
|
176
|
-
if (!customElements.get(tagName))
|
|
179
|
+
if (!customElements.get(tagName)) {
|
|
180
|
+
const names = observedAttributes.map(String);
|
|
181
|
+
const dashed = names.map((n) => n.replace(/[A-Z]/g, (c) => `-${c.toLowerCase()}`)).filter((n) => !names.includes(n));
|
|
182
|
+
const observed = [...names, ...dashed];
|
|
183
|
+
register(component, tagName, observed, options);
|
|
184
|
+
}
|
|
177
185
|
}
|
|
178
186
|
}
|
|
179
187
|
//#endregion
|
|
@@ -311,20 +319,4 @@ const lightDomBaseCss = `
|
|
|
311
319
|
}
|
|
312
320
|
`;
|
|
313
321
|
//#endregion
|
|
314
|
-
|
|
315
|
-
function getPlacement(id) {
|
|
316
|
-
return sdkConfigStore.getConfig().placements?.[id];
|
|
317
|
-
}
|
|
318
|
-
/**
|
|
319
|
-
* Subscribe to a single resolved placement from the SDK config store.
|
|
320
|
-
*
|
|
321
|
-
* Backed by `useSyncExternalStore`: the snapshot is the stored placement
|
|
322
|
-
* object reference (stable between `frak:config` dispatches), so the component
|
|
323
|
-
* only re-renders when that placement actually changes.
|
|
324
|
-
*/
|
|
325
|
-
function usePlacement(placementId) {
|
|
326
|
-
const getSnapshot = useCallback(() => placementId ? getPlacement(placementId) : void 0, [placementId]);
|
|
327
|
-
return useSyncExternalStore(subscribeSdkConfig, getSnapshot);
|
|
328
|
-
}
|
|
329
|
-
//#endregion
|
|
330
|
-
export { subscribeSdkConfig as a, openSharingPage as c, useLang as i, buildStyleContent as n, useClientReady as o, lightDomBaseCss as r, registerWebComponent as s, usePlacement as t };
|
|
322
|
+
export { useClientReady as a, subscribeSdkConfig as i, lightDomBaseCss as n, registerWebComponent as o, useLang as r, openSharingPage as s, buildStyleContent as t };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { i as subscribeSdkConfig } from "./sharedCss-CPNmnpXA.js";
|
|
2
2
|
import { sdkConfigStore } from "@frak-labs/core-sdk";
|
|
3
3
|
import { useSyncExternalStore } from "preact/compat";
|
|
4
4
|
//#region src/hooks/useGlobalComponents.ts
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { i as subscribeSdkConfig } from "./sharedCss-CPNmnpXA.js";
|
|
2
|
+
import { sdkConfigStore } from "@frak-labs/core-sdk";
|
|
3
|
+
import { useCallback } from "preact/hooks";
|
|
4
|
+
import { useSyncExternalStore } from "preact/compat";
|
|
5
|
+
//#region src/hooks/usePlacement.ts
|
|
6
|
+
function getPlacement(id) {
|
|
7
|
+
return sdkConfigStore.getConfig().placements?.[id];
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* Subscribe to a single resolved placement from the SDK config store.
|
|
11
|
+
*
|
|
12
|
+
* Backed by `useSyncExternalStore`: the snapshot is the stored placement
|
|
13
|
+
* object reference (stable between `frak:config` dispatches), so the component
|
|
14
|
+
* only re-renders when that placement actually changes.
|
|
15
|
+
*/
|
|
16
|
+
function usePlacement(placementId) {
|
|
17
|
+
const getSnapshot = useCallback(() => placementId ? getPlacement(placementId) : void 0, [placementId]);
|
|
18
|
+
return useSyncExternalStore(subscribeSdkConfig, getSnapshot);
|
|
19
|
+
}
|
|
20
|
+
//#endregion
|
|
21
|
+
export { usePlacement as t };
|
|
@@ -15,10 +15,12 @@ import { useEffect, useState } from "preact/hooks";
|
|
|
15
15
|
* @param products - The products currently in view, when known. Purely
|
|
16
16
|
* advisory (see `matchesProductScope`): deprioritizes campaigns matching none
|
|
17
17
|
* of them, and changes nothing when omitted.
|
|
18
|
-
* @returns
|
|
18
|
+
* @returns The formatted reward (undefined for percentage rewards) and
|
|
19
|
+
* `hasReward`, true once any matching reward exists, percentage included.
|
|
19
20
|
*/
|
|
20
21
|
function useReward(shouldUseReward, targetInteraction, audience, products) {
|
|
21
22
|
const [reward, setReward] = useState(void 0);
|
|
23
|
+
const [hasReward, setHasReward] = useState(false);
|
|
22
24
|
useEffect(() => {
|
|
23
25
|
if (!shouldUseReward) return;
|
|
24
26
|
const client = window.FrakSetup?.client;
|
|
@@ -30,6 +32,7 @@ function useReward(shouldUseReward, targetInteraction, audience, products) {
|
|
|
30
32
|
audience,
|
|
31
33
|
products
|
|
32
34
|
});
|
|
35
|
+
setHasReward(best !== void 0);
|
|
33
36
|
if (best && best.payoutType !== "percentage") setReward(best.formatted);
|
|
34
37
|
}).catch(() => {});
|
|
35
38
|
}, [
|
|
@@ -38,7 +41,10 @@ function useReward(shouldUseReward, targetInteraction, audience, products) {
|
|
|
38
41
|
audience,
|
|
39
42
|
products
|
|
40
43
|
]);
|
|
41
|
-
return {
|
|
44
|
+
return {
|
|
45
|
+
reward,
|
|
46
|
+
hasReward
|
|
47
|
+
};
|
|
42
48
|
}
|
|
43
49
|
//#endregion
|
|
44
50
|
export { useReward as t };
|
package/package.json
CHANGED
|
@@ -11,8 +11,8 @@
|
|
|
11
11
|
"url": "https://twitter.com/QNivelais"
|
|
12
12
|
}
|
|
13
13
|
],
|
|
14
|
-
"version": "1.
|
|
15
|
-
"description": "Frak web components (share button, banner, post-purchase) for any merchant page; load the shim from https://sdk.frak.id/components.js.",
|
|
14
|
+
"version": "1.3.0",
|
|
15
|
+
"description": "Frak web components (share button, banner, post-purchase, ambassador page) for any merchant page; load the shim from https://sdk.frak.id/components.js.",
|
|
16
16
|
"repository": {
|
|
17
17
|
"url": "https://github.com/frak-id/wallet",
|
|
18
18
|
"directory": "sdk/components"
|
|
@@ -34,6 +34,7 @@
|
|
|
34
34
|
"**/components/*/index.ts",
|
|
35
35
|
"**/bootstrap/loader.ts",
|
|
36
36
|
"**/components.ts",
|
|
37
|
+
"./dist/ambassador.js",
|
|
37
38
|
"./dist/buttonShare.js",
|
|
38
39
|
"./dist/buttonWallet.js",
|
|
39
40
|
"./dist/openInApp.js",
|
|
@@ -52,6 +53,11 @@
|
|
|
52
53
|
"main": "./cdn/components.js",
|
|
53
54
|
"browser": "./cdn/components.js",
|
|
54
55
|
"exports": {
|
|
56
|
+
"./ambassador": {
|
|
57
|
+
"development": "./src/components/Ambassador/index.ts",
|
|
58
|
+
"import": "./dist/ambassador.js",
|
|
59
|
+
"types": "./dist/ambassador.d.ts"
|
|
60
|
+
},
|
|
55
61
|
"./buttonWallet": {
|
|
56
62
|
"development": "./src/components/ButtonWallet/index.ts",
|
|
57
63
|
"import": "./dist/buttonWallet.js",
|
|
@@ -99,16 +105,19 @@
|
|
|
99
105
|
"test": "vitest",
|
|
100
106
|
"test:ui": "vitest --ui",
|
|
101
107
|
"test:coverage": "vitest --coverage",
|
|
108
|
+
"try:merchant": "bun scripts/tryOnMerchant.ts",
|
|
102
109
|
"prepublish": "bun run lint && bun run build",
|
|
103
110
|
"publish": "echo 'Publishing components...'"
|
|
104
111
|
},
|
|
105
112
|
"dependencies": {
|
|
106
|
-
"@frak-labs/core-sdk": "1.
|
|
113
|
+
"@frak-labs/core-sdk": "1.5.0",
|
|
107
114
|
"@frak-labs/frame-connector": "1.3.0",
|
|
108
115
|
"preact": "^10.29.8",
|
|
109
|
-
"preact-custom-element": "^4.6.0"
|
|
116
|
+
"preact-custom-element": "^4.6.0",
|
|
117
|
+
"qr": "^0.7.0"
|
|
110
118
|
},
|
|
111
119
|
"devDependencies": {
|
|
120
|
+
"@playwright/test": "^1.63.0",
|
|
112
121
|
"@frak-labs/design-system": "0.0.0",
|
|
113
122
|
"@frak-labs/test-foundation": "0.1.0",
|
|
114
123
|
"@preact/preset-vite": "^2.10.6",
|