@frak-labs/components 0.0.26-beta.1c24fe7c → 0.0.26-beta.53dfa7b2
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/Banner.BrITmwhY.js +1 -0
- package/cdn/{ButtonShare.BM9Inhmf.js → ButtonShare.Byvhu5Tc.js} +1 -1
- package/cdn/ButtonWallet.C_GtjZpW.js +40 -0
- package/cdn/{OpenInAppButton.B4mrsz6L.js → OpenInAppButton.CZBmQT_a.js} +1 -1
- package/cdn/PostPurchase.BNSQonvO.js +2362 -0
- package/cdn/components.js +1 -1
- package/cdn/jsxRuntime.module.GTd8MQxp.js +138 -0
- package/cdn/loader.js +25 -25
- package/cdn/{useLightDomStyles.D895e4W1.js → useLightDomStyles.B33IA3q5.js} +1 -1
- package/cdn/{useReward.DEU0AF3P.js → useReward.CvZWCurW.js} +1 -1
- package/cdn/{useShareModal.CN9_P7Sl.js → useShareModal.BJBvkHbY.js} +1 -1
- package/dist/banner.d.ts +45 -3
- package/dist/banner.js +45 -21
- package/dist/buttonShare.d.ts +2 -2
- package/dist/buttonShare.js +5 -11
- package/dist/buttonWallet.d.ts +2 -2
- package/dist/buttonWallet.js +3 -7
- package/dist/{formatReward-6JQldDEC.js → formatReward-_UYA3aHE.js} +1 -3
- package/dist/openInApp.d.ts +2 -2
- package/dist/openInApp.js +3 -9
- package/dist/postPurchase.d.ts +27 -3
- package/dist/postPurchase.js +2884 -29
- package/dist/{useLightDomStyles-DukxuNnJ.js → useLightDomStyles-B5Y_fH4K.js} +2 -5
- package/dist/{usePlacement-BbMuz8_A.js → usePlacement-CHEgrdvN.js} +1 -12
- package/dist/{useReward-CI2yRrCj.js → useReward-XF2hB_C_.js} +2 -4
- package/dist/{useShareModal-DHlayNqk.js → useShareModal-Bmlk3eBJ.js} +1 -3
- package/package.json +9 -5
- package/cdn/Banner.D-DB7VwI.js +0 -1
- package/cdn/ButtonWallet.B7UmJcbb.js +0 -40
- package/cdn/PostPurchase.CMa-59qR.js +0 -1
- package/cdn/jsxRuntime.module.5UNmmhNi.js +0 -138
- /package/cdn/{formatReward.C8hlSKRj.js → formatReward.DXMr8a-D.js} +0 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
import{t as e}from"./loader.js";import{a as t,u as n}from"./jsxRuntime.module.
|
|
1
|
+
import{t as e}from"./loader.js";import{a as t,u as n}from"./jsxRuntime.module.GTd8MQxp.js";function r(r,i,a,o){n(()=>{e.injectBase(r,o??t)},[r]),n(()=>{!i||!a||e.injectPlacement(r,i,a)},[r,i,a])}export{r as t};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{_ as e,b as t,l as n}from"./loader.js";import{c as r,u as i}from"./jsxRuntime.module.
|
|
1
|
+
import{_ as e,b as t,l as n}from"./loader.js";import{c as r,u as i}from"./jsxRuntime.module.GTd8MQxp.js";import{t as a}from"./formatReward.DXMr8a-D.js";function o(e,t){switch(e.payoutType){case`fixed`:return e.amount[t];case`tiered`:return e.tiers.reduce((e,n)=>Math.max(e,n.amount[t]),0);case`percentage`:return 0}}function s({rewards:n},r,i){let s=(i?n.filter(e=>e.interactionTypeKey===i):n).map(e=>e.referrer).filter(e=>e!==void 0);if(s.length===0)return;let c=t(e(r)),l=s[0],u=o(l,c);for(let e=1;e<s.length;e++){let t=o(s[e],c);t>u&&(l=s[e],u=t)}if(u<=0){let e=s.find(e=>e.payoutType===`percentage`);if(!e)return;l=e}return a(l,r)}function c(e,t){let[a,o]=r(void 0);return i(()=>{if(!e)return;let r=window.FrakSetup?.client;r&&n(r).then(e=>{let n=r.config.metadata?.currency,i=s(e,n,t);i&&o(i)}).catch(()=>{})},[e,t]),{reward:a}}export{c as t};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{C as e,S as t,u as n,v as r,w as i}from"./loader.js";import{c as a,l as o}from"./jsxRuntime.module.
|
|
1
|
+
import{C as e,S as t,u as n,v as r,w as i}from"./loader.js";import{c as a,l as o}from"./jsxRuntime.module.GTd8MQxp.js";function s(s,c,l){let[u,d]=a(void 0),[f,p]=a(!1);return{handleShare:o(async()=>{if(!window.FrakSetup?.client){console.error(`Frak client not found`),d(r.empty().formatDebugInfo(`Frak client not found`)),p(!0);return}let a=n(window.FrakSetup.client,{});try{await a.sharing(l?{link:l}:{}).display(e=>({...e,targetInteraction:s}),c)}catch(n){if(n instanceof i&&n.code===e.clientAborted){console.debug(`User aborted the modal`);return}let r=window.FrakSetup.client.debugInfo.formatDebugInfo(n);t(window.FrakSetup.client,`share_modal_error`,{error:n instanceof Object&&`message`in n?n.message:`Unknown error`,debugInfo:r}),d(r),p(!0),console.error(`Error while opening the modal`,n)}},[s,c,l]),isError:f,debugInfo:u}}export{s as t};
|
package/dist/banner.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { InteractionTypeKey } from "@frak-labs/core-sdk";
|
|
2
|
-
import * as preact from "preact";
|
|
2
|
+
import * as _$preact from "preact";
|
|
3
3
|
|
|
4
4
|
//#region src/components/Banner/types.d.ts
|
|
5
5
|
/**
|
|
@@ -20,6 +20,40 @@ type BannerProps = {
|
|
|
20
20
|
* When omitted, the best reward across all interaction types is shown.
|
|
21
21
|
*/
|
|
22
22
|
interaction?: InteractionTypeKey;
|
|
23
|
+
/**
|
|
24
|
+
* Override the referral banner title.
|
|
25
|
+
*/
|
|
26
|
+
referralTitle?: string;
|
|
27
|
+
/**
|
|
28
|
+
* Override the referral banner description.
|
|
29
|
+
*/
|
|
30
|
+
referralDescription?: string;
|
|
31
|
+
/**
|
|
32
|
+
* Override the referral banner CTA button text.
|
|
33
|
+
*/
|
|
34
|
+
referralCta?: string;
|
|
35
|
+
/**
|
|
36
|
+
* Override the in-app browser banner title.
|
|
37
|
+
*/
|
|
38
|
+
inappTitle?: string;
|
|
39
|
+
/**
|
|
40
|
+
* Override the in-app browser banner description.
|
|
41
|
+
*/
|
|
42
|
+
inappDescription?: string;
|
|
43
|
+
/**
|
|
44
|
+
* Override the in-app browser banner CTA button text.
|
|
45
|
+
*/
|
|
46
|
+
inappCta?: string;
|
|
47
|
+
/**
|
|
48
|
+
* When set, forces the banner to render in preview mode (e.g. in Shopify theme editor).
|
|
49
|
+
* Bypasses normal event/browser detection and shows static content.
|
|
50
|
+
*/
|
|
51
|
+
preview?: string;
|
|
52
|
+
/**
|
|
53
|
+
* Which banner variant to preview: "referral" or "inapp".
|
|
54
|
+
* Only used when {@link preview} is set. Defaults to "referral".
|
|
55
|
+
*/
|
|
56
|
+
previewMode?: "referral" | "inapp";
|
|
23
57
|
};
|
|
24
58
|
//#endregion
|
|
25
59
|
//#region src/components/Banner/Banner.d.ts
|
|
@@ -55,8 +89,16 @@ type BannerProps = {
|
|
|
55
89
|
declare function Banner({
|
|
56
90
|
placement: placementId,
|
|
57
91
|
classname,
|
|
58
|
-
interaction
|
|
59
|
-
|
|
92
|
+
interaction,
|
|
93
|
+
referralTitle: propReferralTitle,
|
|
94
|
+
referralDescription: propReferralDescription,
|
|
95
|
+
referralCta: propReferralCta,
|
|
96
|
+
inappTitle: propInappTitle,
|
|
97
|
+
inappDescription: propInappDescription,
|
|
98
|
+
inappCta: propInappCta,
|
|
99
|
+
preview,
|
|
100
|
+
previewMode
|
|
101
|
+
}: BannerProps): _$preact.JSX.Element | null;
|
|
60
102
|
//#endregion
|
|
61
103
|
//#region src/components/Banner/index.d.ts
|
|
62
104
|
/**
|
package/dist/banner.js
CHANGED
|
@@ -1,11 +1,10 @@
|
|
|
1
|
-
import { a as useClientReady, n as bannerBaseCss, o as registerWebComponent, t as usePlacement } from "./usePlacement-
|
|
2
|
-
import { t as useLightDomStyles } from "./useLightDomStyles-
|
|
3
|
-
import { t as useReward } from "./useReward-
|
|
1
|
+
import { a as useClientReady, n as bannerBaseCss, o as registerWebComponent, t as usePlacement } from "./usePlacement-CHEgrdvN.js";
|
|
2
|
+
import { t as useLightDomStyles } from "./useLightDomStyles-B5Y_fH4K.js";
|
|
3
|
+
import { t as useReward } from "./useReward-XF2hB_C_.js";
|
|
4
4
|
import { isInAppBrowser, redirectToExternalBrowser } from "@frak-labs/core-sdk";
|
|
5
5
|
import { REFERRAL_SUCCESS_EVENT } from "@frak-labs/core-sdk/actions";
|
|
6
6
|
import { useCallback, useEffect, useMemo, useState } from "preact/hooks";
|
|
7
7
|
import { jsx, jsxs } from "preact/jsx-runtime";
|
|
8
|
-
|
|
9
8
|
//#region src/components/Banner/Banner.tsx
|
|
10
9
|
/**
|
|
11
10
|
* Reward/gift icon for referral mode.
|
|
@@ -93,44 +92,59 @@ function BrowserIcon() {
|
|
|
93
92
|
* <frak-banner classname="my-custom-banner"></frak-banner>
|
|
94
93
|
* ```
|
|
95
94
|
*/
|
|
96
|
-
function Banner({ placement: placementId, classname = "", interaction }) {
|
|
95
|
+
function Banner({ placement: placementId, classname = "", interaction, referralTitle: propReferralTitle, referralDescription: propReferralDescription, referralCta: propReferralCta, inappTitle: propInappTitle, inappDescription: propInappDescription, inappCta: propInappCta, preview, previewMode }) {
|
|
96
|
+
const isPreview = !!preview;
|
|
97
|
+
const resolvedPreviewMode = previewMode === "inapp" ? "inapp" : "referral";
|
|
97
98
|
const placement = usePlacement(placementId);
|
|
98
99
|
const { shouldRender, isHidden, isClientReady } = useClientReady();
|
|
99
100
|
useLightDomStyles("frak-banner", placementId, placement?.components?.banner?.css, bannerBaseCss);
|
|
100
101
|
const [dismissed, setDismissed] = useState(false);
|
|
101
|
-
const [mode, setMode] = useState(() =>
|
|
102
|
+
const [mode, setMode] = useState(() => {
|
|
103
|
+
if (isPreview) return resolvedPreviewMode;
|
|
104
|
+
return isInAppBrowser ? "inapp" : null;
|
|
105
|
+
});
|
|
106
|
+
useEffect(() => {
|
|
107
|
+
if (isPreview) setMode(resolvedPreviewMode);
|
|
108
|
+
}, [isPreview, resolvedPreviewMode]);
|
|
102
109
|
const { reward } = useReward(mode === "referral" && isClientReady, interaction);
|
|
103
110
|
useEffect(() => {
|
|
104
|
-
if (mode === "inapp") return;
|
|
111
|
+
if (isPreview || mode === "inapp") return;
|
|
105
112
|
const handler = () => setMode("referral");
|
|
106
113
|
window.addEventListener(REFERRAL_SUCCESS_EVENT, handler);
|
|
107
114
|
return () => window.removeEventListener(REFERRAL_SUCCESS_EVENT, handler);
|
|
108
|
-
}, [mode]);
|
|
115
|
+
}, [isPreview, mode]);
|
|
109
116
|
const handleAction = useCallback(() => {
|
|
117
|
+
if (isPreview) return;
|
|
110
118
|
if (mode === "referral") setDismissed(true);
|
|
111
119
|
else redirectToExternalBrowser(window.location.href);
|
|
112
|
-
}, [mode]);
|
|
120
|
+
}, [isPreview, mode]);
|
|
113
121
|
const bannerConfig = placement?.components?.banner;
|
|
114
122
|
const texts = useMemo(() => {
|
|
115
123
|
if (mode === "referral") {
|
|
116
124
|
const defaultTitle = reward ? `Earn ${reward} on purchases on this site` : "You've been referred!";
|
|
117
125
|
return {
|
|
118
|
-
title: bannerConfig?.referralTitle ?? defaultTitle,
|
|
119
|
-
description: bannerConfig?.referralDescription ?? "Earn rewards after your purchase via the Frak partner app.",
|
|
120
|
-
cta: bannerConfig?.referralCta ?? "Got it"
|
|
126
|
+
title: propReferralTitle ?? bannerConfig?.referralTitle ?? defaultTitle,
|
|
127
|
+
description: propReferralDescription ?? bannerConfig?.referralDescription ?? "Earn rewards after your purchase via the Frak partner app.",
|
|
128
|
+
cta: propReferralCta ?? bannerConfig?.referralCta ?? "Got it"
|
|
121
129
|
};
|
|
122
130
|
}
|
|
123
131
|
return {
|
|
124
|
-
title: bannerConfig?.inappTitle ?? "Open in your browser",
|
|
125
|
-
description: bannerConfig?.inappDescription ?? "For a better experience and to earn your rewards, open this page in your default browser.",
|
|
126
|
-
cta: bannerConfig?.inappCta ?? "Open browser"
|
|
132
|
+
title: propInappTitle ?? bannerConfig?.inappTitle ?? "Open in your browser",
|
|
133
|
+
description: propInappDescription ?? bannerConfig?.inappDescription ?? "For a better experience and to earn your rewards, open this page in your default browser.",
|
|
134
|
+
cta: propInappCta ?? bannerConfig?.inappCta ?? "Open browser"
|
|
127
135
|
};
|
|
128
136
|
}, [
|
|
129
137
|
mode,
|
|
130
138
|
reward,
|
|
131
|
-
bannerConfig
|
|
139
|
+
bannerConfig,
|
|
140
|
+
propReferralTitle,
|
|
141
|
+
propReferralDescription,
|
|
142
|
+
propReferralCta,
|
|
143
|
+
propInappTitle,
|
|
144
|
+
propInappDescription,
|
|
145
|
+
propInappCta
|
|
132
146
|
]);
|
|
133
|
-
if (!shouldRender || isHidden || dismissed || !mode) return null;
|
|
147
|
+
if (!isPreview && (!shouldRender || isHidden || dismissed || !mode)) return null;
|
|
134
148
|
return /* @__PURE__ */ jsxs("div", {
|
|
135
149
|
class: [
|
|
136
150
|
"banner",
|
|
@@ -162,10 +176,20 @@ function Banner({ placement: placementId, classname = "", interaction }) {
|
|
|
162
176
|
]
|
|
163
177
|
});
|
|
164
178
|
}
|
|
165
|
-
|
|
166
179
|
//#endregion
|
|
167
180
|
//#region src/components/Banner/index.ts
|
|
168
|
-
registerWebComponent(Banner, "frak-banner", [
|
|
169
|
-
|
|
181
|
+
registerWebComponent(Banner, "frak-banner", [
|
|
182
|
+
"placement",
|
|
183
|
+
"classname",
|
|
184
|
+
"interaction",
|
|
185
|
+
"referralTitle",
|
|
186
|
+
"referralDescription",
|
|
187
|
+
"referralCta",
|
|
188
|
+
"inappTitle",
|
|
189
|
+
"inappDescription",
|
|
190
|
+
"inappCta",
|
|
191
|
+
"preview",
|
|
192
|
+
"previewMode"
|
|
193
|
+
], { shadow: false });
|
|
170
194
|
//#endregion
|
|
171
|
-
export { Banner };
|
|
195
|
+
export { Banner };
|
package/dist/buttonShare.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { InteractionTypeKey } from "@frak-labs/core-sdk";
|
|
2
|
-
import * as preact from "preact";
|
|
2
|
+
import * as _$preact from "preact";
|
|
3
3
|
|
|
4
4
|
//#region src/components/ButtonShare/types.d.ts
|
|
5
5
|
/**
|
|
@@ -88,7 +88,7 @@ declare function ButtonShare({
|
|
|
88
88
|
noRewardText,
|
|
89
89
|
targetInteraction,
|
|
90
90
|
clickAction: rawClickAction
|
|
91
|
-
}: ButtonShareProps): preact.JSX.Element | null;
|
|
91
|
+
}: ButtonShareProps): _$preact.JSX.Element | null;
|
|
92
92
|
//#endregion
|
|
93
93
|
//#region src/components/ButtonShare/index.d.ts
|
|
94
94
|
/**
|
package/dist/buttonShare.js
CHANGED
|
@@ -1,12 +1,11 @@
|
|
|
1
|
-
import { a as useClientReady, c as openEmbeddedWallet, o as registerWebComponent, t as usePlacement } from "./usePlacement-
|
|
2
|
-
import { t as useLightDomStyles } from "./useLightDomStyles-
|
|
3
|
-
import { t as useReward } from "./useReward-
|
|
4
|
-
import { t as useShareModal } from "./useShareModal-
|
|
1
|
+
import { a as useClientReady, c as openEmbeddedWallet, o as registerWebComponent, t as usePlacement } from "./usePlacement-CHEgrdvN.js";
|
|
2
|
+
import { t as useLightDomStyles } from "./useLightDomStyles-B5Y_fH4K.js";
|
|
3
|
+
import { t as useReward } from "./useReward-XF2hB_C_.js";
|
|
4
|
+
import { t as useShareModal } from "./useShareModal-Bmlk3eBJ.js";
|
|
5
5
|
import { trackEvent } from "@frak-labs/core-sdk";
|
|
6
6
|
import { displaySharingPage } from "@frak-labs/core-sdk/actions";
|
|
7
7
|
import { useCallback, useMemo, useState } from "preact/hooks";
|
|
8
8
|
import { Fragment, jsx, jsxs } from "preact/jsx-runtime";
|
|
9
|
-
|
|
10
9
|
//#region src/utils/sharingPage.ts
|
|
11
10
|
async function openSharingPage(targetInteraction, placement) {
|
|
12
11
|
if (!window.FrakSetup?.client) {
|
|
@@ -15,7 +14,6 @@ async function openSharingPage(targetInteraction, placement) {
|
|
|
15
14
|
}
|
|
16
15
|
await displaySharingPage(window.FrakSetup.client, { metadata: { ...targetInteraction && { targetInteraction } } }, placement);
|
|
17
16
|
}
|
|
18
|
-
|
|
19
17
|
//#endregion
|
|
20
18
|
//#region src/hooks/useCopyToClipboard.ts
|
|
21
19
|
function useCopyToClipboard(options = {}) {
|
|
@@ -57,7 +55,6 @@ function useCopyToClipboard(options = {}) {
|
|
|
57
55
|
copied
|
|
58
56
|
};
|
|
59
57
|
}
|
|
60
|
-
|
|
61
58
|
//#endregion
|
|
62
59
|
//#region src/components/ButtonShare/components/ErrorMessage.tsx
|
|
63
60
|
const styles = {
|
|
@@ -168,7 +165,6 @@ function ErrorMessage({ debugInfo }) {
|
|
|
168
165
|
]
|
|
169
166
|
});
|
|
170
167
|
}
|
|
171
|
-
|
|
172
168
|
//#endregion
|
|
173
169
|
//#region src/components/ButtonShare/ButtonShare.tsx
|
|
174
170
|
/**
|
|
@@ -259,7 +255,6 @@ function ButtonShare({ placement: placementId, text = "Share and earn!", classna
|
|
|
259
255
|
children: btnText
|
|
260
256
|
}), isError && /* @__PURE__ */ jsx(ErrorMessage, { debugInfo })] });
|
|
261
257
|
}
|
|
262
|
-
|
|
263
258
|
//#endregion
|
|
264
259
|
//#region src/components/ButtonShare/index.ts
|
|
265
260
|
registerWebComponent(ButtonShare, "frak-button-share", [
|
|
@@ -271,6 +266,5 @@ registerWebComponent(ButtonShare, "frak-button-share", [
|
|
|
271
266
|
"noRewardText",
|
|
272
267
|
"targetInteraction"
|
|
273
268
|
], { shadow: false });
|
|
274
|
-
|
|
275
269
|
//#endregion
|
|
276
|
-
export { ButtonShare };
|
|
270
|
+
export { ButtonShare };
|
package/dist/buttonWallet.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { InteractionTypeKey } from "@frak-labs/core-sdk";
|
|
2
|
-
import * as preact from "preact";
|
|
2
|
+
import * as _$preact from "preact";
|
|
3
3
|
|
|
4
4
|
//#region src/components/ButtonWallet/types.d.ts
|
|
5
5
|
/**
|
|
@@ -70,7 +70,7 @@ declare function ButtonWallet({
|
|
|
70
70
|
classname,
|
|
71
71
|
useReward: rawUseReward,
|
|
72
72
|
targetInteraction
|
|
73
|
-
}: ButtonWalletProps): preact.JSX.Element | null;
|
|
73
|
+
}: ButtonWalletProps): _$preact.JSX.Element | null;
|
|
74
74
|
//#endregion
|
|
75
75
|
//#region src/components/ButtonWallet/index.d.ts
|
|
76
76
|
/**
|
package/dist/buttonWallet.js
CHANGED
|
@@ -1,9 +1,8 @@
|
|
|
1
|
-
import { a as useClientReady, o as registerWebComponent, r as buildStyleContent, s as openWalletModal, t as usePlacement } from "./usePlacement-
|
|
2
|
-
import { t as useReward } from "./useReward-
|
|
1
|
+
import { a as useClientReady, o as registerWebComponent, r as buildStyleContent, s as openWalletModal, t as usePlacement } from "./usePlacement-CHEgrdvN.js";
|
|
2
|
+
import { t as useReward } from "./useReward-XF2hB_C_.js";
|
|
3
3
|
import { trackEvent } from "@frak-labs/core-sdk";
|
|
4
4
|
import { useEffect, useMemo, useState } from "preact/hooks";
|
|
5
5
|
import { Fragment, jsx, jsxs } from "preact/jsx-runtime";
|
|
6
|
-
|
|
7
6
|
//#region src/components/ButtonWallet/assets/GiftIcon.tsx
|
|
8
7
|
function GiftIcon(props) {
|
|
9
8
|
return /* @__PURE__ */ jsxs("svg", {
|
|
@@ -21,7 +20,6 @@ function GiftIcon(props) {
|
|
|
21
20
|
})]
|
|
22
21
|
});
|
|
23
22
|
}
|
|
24
|
-
|
|
25
23
|
//#endregion
|
|
26
24
|
//#region src/components/ButtonWallet/ButtonWallet.tsx
|
|
27
25
|
const componentCss = `
|
|
@@ -140,7 +138,6 @@ function ButtonWallet({ placement: placementId, classname = "", useReward: rawUs
|
|
|
140
138
|
})]
|
|
141
139
|
})] });
|
|
142
140
|
}
|
|
143
|
-
|
|
144
141
|
//#endregion
|
|
145
142
|
//#region src/components/ButtonWallet/index.ts
|
|
146
143
|
registerWebComponent(ButtonWallet, "frak-button-wallet", [
|
|
@@ -149,6 +146,5 @@ registerWebComponent(ButtonWallet, "frak-button-wallet", [
|
|
|
149
146
|
"useReward",
|
|
150
147
|
"targetInteraction"
|
|
151
148
|
], { shadow: true });
|
|
152
|
-
|
|
153
149
|
//#endregion
|
|
154
|
-
export { ButtonWallet };
|
|
150
|
+
export { ButtonWallet };
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { formatAmount, getCurrencyAmountKey, getSupportedCurrency } from "@frak-labs/core-sdk";
|
|
2
|
-
|
|
3
2
|
//#region src/utils/formatReward.ts
|
|
4
3
|
/**
|
|
5
4
|
* Format an {@link EstimatedReward} into a human-readable string.
|
|
@@ -23,6 +22,5 @@ function formatEstimatedReward(reward, currency, basketAmount) {
|
|
|
23
22
|
}
|
|
24
23
|
}
|
|
25
24
|
}
|
|
26
|
-
|
|
27
25
|
//#endregion
|
|
28
|
-
export { formatEstimatedReward as t };
|
|
26
|
+
export { formatEstimatedReward as t };
|
package/dist/openInApp.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import * as preact from "preact";
|
|
1
|
+
import * as _$preact from "preact";
|
|
2
2
|
|
|
3
3
|
//#region src/components/OpenInAppButton/types.d.ts
|
|
4
4
|
/**
|
|
@@ -49,7 +49,7 @@ declare function OpenInAppButton({
|
|
|
49
49
|
placement: placementId,
|
|
50
50
|
text,
|
|
51
51
|
classname
|
|
52
|
-
}: OpenInAppButtonProps): preact.JSX.Element | null;
|
|
52
|
+
}: OpenInAppButtonProps): _$preact.JSX.Element | null;
|
|
53
53
|
//#endregion
|
|
54
54
|
//#region src/components/OpenInAppButton/index.d.ts
|
|
55
55
|
/**
|
package/dist/openInApp.js
CHANGED
|
@@ -1,9 +1,8 @@
|
|
|
1
|
-
import { a as useClientReady, o as registerWebComponent, t as usePlacement } from "./usePlacement-
|
|
2
|
-
import { t as useLightDomStyles } from "./useLightDomStyles-
|
|
1
|
+
import { a as useClientReady, o as registerWebComponent, t as usePlacement } from "./usePlacement-CHEgrdvN.js";
|
|
2
|
+
import { t as useLightDomStyles } from "./useLightDomStyles-B5Y_fH4K.js";
|
|
3
3
|
import { DEEP_LINK_SCHEME, trackEvent, triggerDeepLinkWithFallback } from "@frak-labs/core-sdk";
|
|
4
4
|
import { useMemo } from "preact/hooks";
|
|
5
5
|
import { jsx } from "preact/jsx-runtime";
|
|
6
|
-
|
|
7
6
|
//#region src/utils/isMobile.ts
|
|
8
7
|
/**
|
|
9
8
|
* Check if the current device is a mobile device
|
|
@@ -20,13 +19,11 @@ function isMobile() {
|
|
|
20
19
|
if (/Macintosh/i.test(navigator.userAgent) && navigator.maxTouchPoints > 1) return true;
|
|
21
20
|
return false;
|
|
22
21
|
}
|
|
23
|
-
|
|
24
22
|
//#endregion
|
|
25
23
|
//#region src/hooks/useIsMobile.ts
|
|
26
24
|
function useIsMobile() {
|
|
27
25
|
return { isMobile: useMemo(() => isMobile(), []) };
|
|
28
26
|
}
|
|
29
|
-
|
|
30
27
|
//#endregion
|
|
31
28
|
//#region src/utils/openInApp.ts
|
|
32
29
|
const DEFAULT_PATH = "wallet";
|
|
@@ -46,7 +43,6 @@ function openFrakWalletApp(path = DEFAULT_PATH) {
|
|
|
46
43
|
if (client) trackEvent(client, "app_not_installed");
|
|
47
44
|
} });
|
|
48
45
|
}
|
|
49
|
-
|
|
50
46
|
//#endregion
|
|
51
47
|
//#region src/components/OpenInAppButton/OpenInAppButton.tsx
|
|
52
48
|
/**
|
|
@@ -99,7 +95,6 @@ function OpenInAppButton({ placement: placementId, text = "Open in App", classna
|
|
|
99
95
|
children: resolvedText
|
|
100
96
|
});
|
|
101
97
|
}
|
|
102
|
-
|
|
103
98
|
//#endregion
|
|
104
99
|
//#region src/components/OpenInAppButton/index.ts
|
|
105
100
|
registerWebComponent(OpenInAppButton, "frak-open-in-app", [
|
|
@@ -107,6 +102,5 @@ registerWebComponent(OpenInAppButton, "frak-open-in-app", [
|
|
|
107
102
|
"placement",
|
|
108
103
|
"classname"
|
|
109
104
|
], { shadow: false });
|
|
110
|
-
|
|
111
105
|
//#endregion
|
|
112
|
-
export { OpenInAppButton };
|
|
106
|
+
export { OpenInAppButton };
|
package/dist/postPurchase.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import * as preact from "preact";
|
|
1
|
+
import * as _$preact from "preact";
|
|
2
2
|
|
|
3
3
|
//#region src/components/PostPurchase/types.d.ts
|
|
4
4
|
/**
|
|
@@ -41,6 +41,26 @@ type PostPurchaseProps = {
|
|
|
41
41
|
* Force a display variant instead of relying on the backend evaluation.
|
|
42
42
|
*/
|
|
43
43
|
variant?: "referrer" | "referee";
|
|
44
|
+
/**
|
|
45
|
+
* Label for the pill badge displayed above the message.
|
|
46
|
+
* When omitted (and no placement config provides one), the badge is hidden.
|
|
47
|
+
*/
|
|
48
|
+
badgeText?: string;
|
|
49
|
+
/**
|
|
50
|
+
* Override the message shown to referrers.
|
|
51
|
+
* Use `{REWARD}` as placeholder for the reward amount.
|
|
52
|
+
*/
|
|
53
|
+
referrerText?: string;
|
|
54
|
+
/**
|
|
55
|
+
* Override the message shown to referees.
|
|
56
|
+
* Use `{REWARD}` as placeholder for the reward amount.
|
|
57
|
+
*/
|
|
58
|
+
refereeText?: string;
|
|
59
|
+
/**
|
|
60
|
+
* Override the CTA button text.
|
|
61
|
+
* Use `{REWARD}` as placeholder for the reward amount.
|
|
62
|
+
*/
|
|
63
|
+
ctaText?: string;
|
|
44
64
|
};
|
|
45
65
|
//#endregion
|
|
46
66
|
//#region src/components/PostPurchase/PostPurchase.d.ts
|
|
@@ -80,8 +100,12 @@ declare function PostPurchase({
|
|
|
80
100
|
merchantId,
|
|
81
101
|
placement: placementId,
|
|
82
102
|
classname,
|
|
83
|
-
variant: forcedVariant
|
|
84
|
-
|
|
103
|
+
variant: forcedVariant,
|
|
104
|
+
badgeText: propBadgeText,
|
|
105
|
+
referrerText: propReferrerText,
|
|
106
|
+
refereeText: propRefereeText,
|
|
107
|
+
ctaText: propCtaText
|
|
108
|
+
}: PostPurchaseProps): _$preact.JSX.Element | null;
|
|
85
109
|
//#endregion
|
|
86
110
|
//#region src/components/PostPurchase/index.d.ts
|
|
87
111
|
/**
|