@frak-labs/components 1.3.3-beta.a79006c4 → 1.3.3-beta.bbccfb81
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.CKoap_px.js +392 -0
- package/cdn/Banner.BqfCxKs3.js +208 -0
- package/cdn/ButtonShare.C7A2tEvB.js +1 -0
- package/cdn/ButtonWallet.Cg2OK1di.js +40 -0
- package/cdn/{GiftIcon.CX0gLPUJ.js → GiftIcon.CW1SwrXH.js} +1 -1
- package/cdn/OpenInAppButton.Djz_cb9Y.js +1 -0
- package/cdn/PostPurchase.Ch9VnOQG.js +102 -0
- package/cdn/components.js +1 -1
- package/cdn/{jsxRuntime.module.CUZaa90V.js → jsxRuntime.module.DWH-kRVd.js} +1 -1
- package/cdn/loader.js +14 -14
- package/cdn/{rewards.F9iOJSNk.js → rewards.t-rH9M3s.js} +1 -1
- package/cdn/useGlobalComponents.DVgSWfOp.js +1 -0
- package/cdn/useLightDomStyles.B72V1WPK.js +31 -0
- package/cdn/usePlacement.DEOEf5_6.js +1 -0
- package/cdn/useReward.D2kXQbtD.js +1 -0
- package/dist/{GiftIcon-JVhSFEhP.js → GiftIcon-B9k_syq6.js} +6 -12
- package/dist/ambassador.d.ts +0 -6
- package/dist/ambassador.js +105 -33
- package/dist/banner.d.ts +0 -6
- package/dist/banner.js +20 -29
- package/dist/buttonShare.d.ts +0 -6
- package/dist/buttonShare.js +8 -10
- package/dist/buttonWallet.d.ts +0 -6
- package/dist/buttonWallet.js +7 -11
- package/dist/i18n/defaults.d.ts +0 -2
- package/dist/i18n/defaults.js +1 -2
- package/dist/openInApp.d.ts +0 -6
- package/dist/openInApp.js +7 -11
- package/dist/postPurchase.d.ts +0 -6
- package/dist/postPurchase.js +10 -13
- package/dist/{rewards-HJlTkTcY.js → rewards-BuNthAR2.js} +50 -49
- package/dist/{sharedBaseCss.css-BkMpQeRx.js → sharedBaseCss.css-nYy9vlzH.js} +1 -3
- package/dist/{sharedCss-CPNmnpXA.js → sharedCss-SKmJGZgN.js} +10 -20
- package/dist/{useGlobalComponents-B3s2UQFk.js → useGlobalComponents-BF47jsBt.js} +2 -3
- package/dist/{useLightDomStyles-BQ5FvCPi.js → useLightDomStyles-wGaNXHqN.js} +4 -6
- package/dist/{usePlacement-BpaIbzun.js → usePlacement-Dd7itnCf.js} +2 -3
- package/dist/{useReward-WmsNOFlz.js → useReward-cQ54x8q-.js} +2 -3
- package/package.json +13 -13
- package/cdn/Ambassador.7wEDPaYu.js +0 -392
- package/cdn/Banner.8NeKFnVj.js +0 -208
- package/cdn/ButtonShare.BTT49Sbn.js +0 -1
- package/cdn/ButtonWallet.CB0Ysymx.js +0 -40
- package/cdn/OpenInAppButton.DdL3xii8.js +0 -1
- package/cdn/PostPurchase.ClgDFxmZ.js +0 -102
- package/cdn/useGlobalComponents.CXuceSQ0.js +0 -1
- package/cdn/useLightDomStyles.C3oQ3HLu.js +0 -1
- package/cdn/usePlacement.Cq64cZ9Q.js +0 -1
- package/cdn/useReward.BpO3D675.js +0 -1
package/dist/i18n/defaults.d.ts
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { Language } from "@frak-labs/core-sdk";
|
|
2
|
-
//#region src/i18n/defaults.d.ts
|
|
3
2
|
/**
|
|
4
3
|
* Shape of the built-in copy for every SDK Web Component. Declared explicitly
|
|
5
4
|
* so each supported {@link Language} is forced to provide the exact same set
|
|
@@ -112,5 +111,4 @@ type ComponentCopy = {
|
|
|
112
111
|
* keyed by the active language keeps an i18n runtime out of the CDN bundle.
|
|
113
112
|
*/
|
|
114
113
|
export declare const componentDefaults: Record<Language, ComponentCopy>;
|
|
115
|
-
//#endregion
|
|
116
114
|
export {};
|
package/dist/i18n/defaults.js
CHANGED
package/dist/openInApp.d.ts
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
//#region src/components/OpenInAppButton/types.d.ts
|
|
2
1
|
/**
|
|
3
2
|
* The props type for {@link OpenInAppButton}.
|
|
4
3
|
* @inline
|
|
@@ -17,8 +16,6 @@ type OpenInAppButtonProps = {
|
|
|
17
16
|
*/
|
|
18
17
|
classname?: string;
|
|
19
18
|
};
|
|
20
|
-
//#endregion
|
|
21
|
-
//#region src/components/OpenInAppButton/OpenInAppButton.d.ts
|
|
22
19
|
/**
|
|
23
20
|
* Button to open the Frak Wallet mobile app via deep link
|
|
24
21
|
*
|
|
@@ -46,8 +43,6 @@ type OpenInAppButtonProps = {
|
|
|
46
43
|
* ```
|
|
47
44
|
*/
|
|
48
45
|
export declare function OpenInAppButton({ placement: placementId, text, classname }: OpenInAppButtonProps): import("preact").JSX.Element | null;
|
|
49
|
-
//#endregion
|
|
50
|
-
//#region src/components/OpenInAppButton/index.d.ts
|
|
51
46
|
/**
|
|
52
47
|
* Custom element interface for `<frak-open-in-app>`.
|
|
53
48
|
* Combines standard {@link HTMLElement} with {@link OpenInAppButtonProps}.
|
|
@@ -58,5 +53,4 @@ declare global {
|
|
|
58
53
|
"frak-open-in-app": OpenInAppButtonElement;
|
|
59
54
|
}
|
|
60
55
|
}
|
|
61
|
-
//#endregion
|
|
62
56
|
export {};
|
package/dist/openInApp.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { a as useClientReady, o as registerWebComponent, r as useLang } from "./sharedCss-
|
|
2
|
-
import { t as useLightDomStyles } from "./useLightDomStyles-
|
|
1
|
+
import { a as useClientReady, o as registerWebComponent, r as useLang } from "./sharedCss-SKmJGZgN.js";
|
|
2
|
+
import { t as useLightDomStyles } from "./useLightDomStyles-wGaNXHqN.js";
|
|
3
|
+
import { t as usePlacement } from "./usePlacement-Dd7itnCf.js";
|
|
3
4
|
import { componentDefaults } from "./i18n/defaults.js";
|
|
4
|
-
import { t as usePlacement } from "./usePlacement-BpaIbzun.js";
|
|
5
5
|
import { DEEP_LINK_SCHEME, isMobile, trackEvent, triggerDeepLinkWithFallback } from "@frak-labs/core-sdk";
|
|
6
6
|
import { jsx } from "preact/jsx-runtime";
|
|
7
|
-
|
|
7
|
+
// src/actions/openInApp.ts
|
|
8
8
|
const DEFAULT_PATH = "wallet";
|
|
9
9
|
/**
|
|
10
10
|
* Open the Frak Wallet mobile app via deep link with fallback detection.
|
|
@@ -27,13 +27,11 @@ function openFrakWalletApp(path = DEFAULT_PATH, placement) {
|
|
|
27
27
|
});
|
|
28
28
|
} });
|
|
29
29
|
}
|
|
30
|
-
|
|
31
|
-
//#region src/hooks/useIsMobile.ts
|
|
30
|
+
// src/hooks/useIsMobile.ts
|
|
32
31
|
function useIsMobile() {
|
|
33
32
|
return { isMobile: isMobile() };
|
|
34
33
|
}
|
|
35
|
-
|
|
36
|
-
//#region src/components/OpenInAppButton/OpenInAppButton.tsx
|
|
34
|
+
// src/components/OpenInAppButton/OpenInAppButton.tsx
|
|
37
35
|
/**
|
|
38
36
|
* Button to open the Frak Wallet mobile app via deep link
|
|
39
37
|
*
|
|
@@ -85,12 +83,10 @@ function OpenInAppButton({ placement: placementId, text, classname = "" }) {
|
|
|
85
83
|
children: resolvedText
|
|
86
84
|
});
|
|
87
85
|
}
|
|
88
|
-
|
|
89
|
-
//#region src/components/OpenInAppButton/index.ts
|
|
86
|
+
// src/components/OpenInAppButton/index.ts
|
|
90
87
|
registerWebComponent(OpenInAppButton, "frak-open-in-app", [
|
|
91
88
|
"text",
|
|
92
89
|
"placement",
|
|
93
90
|
"classname"
|
|
94
91
|
], { shadow: false });
|
|
95
|
-
//#endregion
|
|
96
92
|
export { OpenInAppButton };
|
package/dist/postPurchase.d.ts
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { SharingPageProduct } from "@frak-labs/core-sdk";
|
|
2
|
-
//#region src/components/PostPurchase/types.d.ts
|
|
3
2
|
/**
|
|
4
3
|
* Props for the {@link PostPurchase} component.
|
|
5
4
|
* @inline
|
|
@@ -91,8 +90,6 @@ type PostPurchaseProps = {
|
|
|
91
90
|
*/
|
|
92
91
|
previewVariant?: "referrer" | "referee";
|
|
93
92
|
};
|
|
94
|
-
//#endregion
|
|
95
|
-
//#region src/components/PostPurchase/PostPurchase.d.ts
|
|
96
93
|
/**
|
|
97
94
|
* Post-purchase card component.
|
|
98
95
|
*
|
|
@@ -122,8 +119,6 @@ type PostPurchaseProps = {
|
|
|
122
119
|
* ```
|
|
123
120
|
*/
|
|
124
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;
|
|
125
|
-
//#endregion
|
|
126
|
-
//#region src/components/PostPurchase/index.d.ts
|
|
127
122
|
/**
|
|
128
123
|
* Custom element interface for `<frak-post-purchase>`.
|
|
129
124
|
* Combines standard {@link HTMLElement} with {@link PostPurchaseProps}.
|
|
@@ -134,5 +129,4 @@ declare global {
|
|
|
134
129
|
"frak-post-purchase": PostPurchaseElement;
|
|
135
130
|
}
|
|
136
131
|
}
|
|
137
|
-
//#endregion
|
|
138
132
|
export {};
|
package/dist/postPurchase.js
CHANGED
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
import { a as useClientReady, o as registerWebComponent, r as useLang, s as openSharingPage } from "./sharedCss-
|
|
2
|
-
import { i as w, n as K, t as C } from "./rewards-
|
|
3
|
-
import { t as
|
|
4
|
-
import { t as
|
|
1
|
+
import { a as useClientReady, o as registerWebComponent, r as useLang, s as openSharingPage } from "./sharedCss-SKmJGZgN.js";
|
|
2
|
+
import { i as w, n as K, t as C } from "./rewards-BuNthAR2.js";
|
|
3
|
+
import { r as LogoFrakWithName, t as GiftIcon } from "./GiftIcon-B9k_syq6.js";
|
|
4
|
+
import { t as useGlobalComponents } from "./useGlobalComponents-BF47jsBt.js";
|
|
5
|
+
import { t as useLightDomStyles } from "./useLightDomStyles-wGaNXHqN.js";
|
|
6
|
+
import { t as usePlacement } from "./usePlacement-Dd7itnCf.js";
|
|
5
7
|
import { componentDefaults } from "./i18n/defaults.js";
|
|
6
|
-
import { t as cssSource$2 } from "./sharedBaseCss.css-
|
|
7
|
-
import { t as usePlacement } from "./usePlacement-BpaIbzun.js";
|
|
8
|
-
import { r as LogoFrakWithName, t as GiftIcon } from "./GiftIcon-JVhSFEhP.js";
|
|
8
|
+
import { t as cssSource$2 } from "./sharedBaseCss.css-nYy9vlzH.js";
|
|
9
9
|
import { sanitizeSharingProducts, trackEvent } from "@frak-labs/core-sdk";
|
|
10
10
|
import { getMerchantInformation, getUserReferralStatus, trackPurchaseStatus } from "@frak-labs/core-sdk/actions";
|
|
11
11
|
import { useCallback, useEffect, useMemo, useRef, useState } from "preact/hooks";
|
|
12
12
|
import { jsx, jsxs } from "preact/jsx-runtime";
|
|
13
13
|
import { FrakRpcError, RpcErrorCodes } from "@frak-labs/frame-connector";
|
|
14
|
-
|
|
14
|
+
// \0ve-inline:src/components/PostPurchase/PostPurchase.css.ts.vanilla.js
|
|
15
15
|
const cssSource$1 = `.PostPurchase_card__5fv5lh0 {
|
|
16
16
|
background-color: var(--surface-background__pbq4akc);
|
|
17
17
|
border: 1px solid var(--border-default__pbq4akv);
|
|
@@ -126,8 +126,7 @@ var icon = "PostPurchase_icon__5fv5lh7";
|
|
|
126
126
|
var imageWrapper = "PostPurchase_imageWrapper__5fv5lh9";
|
|
127
127
|
var message = "PostPurchase_message__5fv5lh5";
|
|
128
128
|
const cssSource = cssSource$1;
|
|
129
|
-
|
|
130
|
-
//#region src/components/PostPurchase/PostPurchase.tsx
|
|
129
|
+
// src/components/PostPurchase/PostPurchase.tsx
|
|
131
130
|
/**
|
|
132
131
|
* `onChainMetadata.domain` is a bare host and `sharing-url` defaults to `""` in
|
|
133
132
|
* the WordPress shortcode; both would throw inside `FrakContextManager.update`.
|
|
@@ -368,8 +367,7 @@ function PostPurchase({ customerId, orderId, token, sharingUrl, merchantId, plac
|
|
|
368
367
|
})
|
|
369
368
|
});
|
|
370
369
|
}
|
|
371
|
-
|
|
372
|
-
//#region src/components/PostPurchase/index.ts
|
|
370
|
+
// src/components/PostPurchase/index.ts
|
|
373
371
|
registerWebComponent(PostPurchase, "frak-post-purchase", [
|
|
374
372
|
"customerId",
|
|
375
373
|
"orderId",
|
|
@@ -388,5 +386,4 @@ registerWebComponent(PostPurchase, "frak-post-purchase", [
|
|
|
388
386
|
"previewVariant",
|
|
389
387
|
"imageUrl"
|
|
390
388
|
], { shadow: false });
|
|
391
|
-
//#endregion
|
|
392
389
|
export { PostPurchase };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
// ../core/dist/getCurrencyAmountKey-BDZ_Te1S.js
|
|
2
2
|
const e = {
|
|
3
3
|
eur: `fr-FR`,
|
|
4
4
|
usd: `en-US`,
|
|
@@ -10,55 +10,57 @@ function t(t) {
|
|
|
10
10
|
function n(t) {
|
|
11
11
|
return t ? e[t] ?? e.eur : e.eur;
|
|
12
12
|
}
|
|
13
|
-
function r(e
|
|
14
|
-
|
|
15
|
-
|
|
13
|
+
function r(e) {
|
|
14
|
+
return e.replaceAll(` `, `\xA0`);
|
|
15
|
+
}
|
|
16
|
+
function i(e, i) {
|
|
17
|
+
let a = n(i), o = t(i);
|
|
18
|
+
return r(e.toLocaleString(a, {
|
|
16
19
|
style: `currency`,
|
|
17
|
-
currency:
|
|
20
|
+
currency: o,
|
|
18
21
|
minimumFractionDigits: 0,
|
|
19
22
|
maximumFractionDigits: 2
|
|
20
|
-
});
|
|
23
|
+
}));
|
|
21
24
|
}
|
|
22
|
-
function
|
|
25
|
+
function a$1(e) {
|
|
23
26
|
return e.formatToParts(1.1).find((e) => e.type === `decimal`)?.value ?? `.`;
|
|
24
27
|
}
|
|
25
|
-
function
|
|
26
|
-
let
|
|
28
|
+
function o$1(e, i) {
|
|
29
|
+
let o = n(i), s = t(i), c = new Intl.NumberFormat(o, {
|
|
27
30
|
style: `currency`,
|
|
28
|
-
currency:
|
|
31
|
+
currency: s,
|
|
29
32
|
minimumFractionDigits: 0,
|
|
30
33
|
maximumFractionDigits: 2
|
|
31
|
-
}),
|
|
32
|
-
for (let e of
|
|
34
|
+
}), l = c.formatToParts(e), u = ``, d = ``, f = ``, p = `suffix`, m = !1;
|
|
35
|
+
for (let e of l) switch (e.type) {
|
|
33
36
|
case `integer`:
|
|
34
37
|
case `group`:
|
|
35
|
-
|
|
38
|
+
u += r(e.value), m = !0;
|
|
36
39
|
break;
|
|
37
40
|
case `decimal`:
|
|
38
41
|
case `fraction`:
|
|
39
|
-
|
|
42
|
+
d += e.value;
|
|
40
43
|
break;
|
|
41
|
-
case `currency`:
|
|
44
|
+
case `currency`: f = e.value, p = m ? `suffix` : `prefix`;
|
|
42
45
|
}
|
|
43
46
|
return {
|
|
44
|
-
integer:
|
|
45
|
-
decimals:
|
|
46
|
-
unit:
|
|
47
|
-
unitPosition:
|
|
47
|
+
integer: u,
|
|
48
|
+
decimals: d || `${a$1(c)}00`,
|
|
49
|
+
unit: f,
|
|
50
|
+
unitPosition: p
|
|
48
51
|
};
|
|
49
52
|
}
|
|
50
|
-
function
|
|
53
|
+
function s$1(e) {
|
|
51
54
|
return {
|
|
52
55
|
integer: String(e),
|
|
53
56
|
unit: `%`,
|
|
54
57
|
unitPosition: `suffix`
|
|
55
58
|
};
|
|
56
59
|
}
|
|
57
|
-
function
|
|
60
|
+
function c$1(e) {
|
|
58
61
|
return e ? `${e}Amount` : `eurAmount`;
|
|
59
62
|
}
|
|
60
|
-
|
|
61
|
-
//#region ../core/dist/rewards.js
|
|
63
|
+
// ../core/dist/rewards.js
|
|
62
64
|
function a(e) {
|
|
63
65
|
return Array.isArray(e) ? e : e.conditions;
|
|
64
66
|
}
|
|
@@ -106,34 +108,34 @@ function y(e, t) {
|
|
|
106
108
|
let n = _(e, t);
|
|
107
109
|
return n > 0 ? n : v(e) * 1e-6;
|
|
108
110
|
}
|
|
109
|
-
function x(n, r
|
|
110
|
-
let a = t(r
|
|
111
|
+
function x(n, r) {
|
|
112
|
+
let a = t(r), o = c$1(a);
|
|
111
113
|
switch (n.payoutType) {
|
|
112
|
-
case `fixed`: return
|
|
114
|
+
case `fixed`: return i(Math.round(n.amount[o]), a);
|
|
113
115
|
case `percentage`: return `${n.percent} %`;
|
|
114
116
|
case `tiered`: {
|
|
115
117
|
let e = _(n, o);
|
|
116
|
-
if (e > 0) return
|
|
117
|
-
let r
|
|
118
|
-
return r
|
|
118
|
+
if (e > 0) return i(Math.round(e), a);
|
|
119
|
+
let r = v(n);
|
|
120
|
+
return r > 0 ? `${r} %` : i(0, a);
|
|
119
121
|
}
|
|
120
122
|
}
|
|
121
123
|
}
|
|
122
124
|
function S(t$1, a) {
|
|
123
|
-
let o = t(a), s =
|
|
125
|
+
let o = t(a), s = c$1(o);
|
|
124
126
|
switch (t$1.payoutType) {
|
|
125
|
-
case `fixed`: return
|
|
126
|
-
case `percentage`: return
|
|
127
|
+
case `fixed`: return o$1(Math.round(t$1.amount[s]), o);
|
|
128
|
+
case `percentage`: return s$1(t$1.percent);
|
|
127
129
|
case `tiered`: {
|
|
128
130
|
let e = _(t$1, s);
|
|
129
|
-
if (e > 0) return
|
|
131
|
+
if (e > 0) return o$1(Math.round(e), o);
|
|
130
132
|
let i = v(t$1);
|
|
131
|
-
return i > 0 ?
|
|
133
|
+
return i > 0 ? s$1(i) : o$1(0, o);
|
|
132
134
|
}
|
|
133
135
|
}
|
|
134
136
|
}
|
|
135
137
|
function C(t$2, n) {
|
|
136
|
-
if (!(!t$2 || y(t$2,
|
|
138
|
+
if (!(!t$2 || y(t$2, c$1(t(n))) <= 0)) return x(t$2, n);
|
|
137
139
|
}
|
|
138
140
|
function w(e, t) {
|
|
139
141
|
return t ? e.replaceAll(`{REWARD}`, t) : e.replaceAll(`{REWARD}`, ``);
|
|
@@ -232,7 +234,7 @@ function G(e, t) {
|
|
|
232
234
|
return !t || t.length === 0 || !e.productScope || t.some((t) => z(e.productScope, t));
|
|
233
235
|
}
|
|
234
236
|
function K(t$3, n = {}) {
|
|
235
|
-
let r = (n.now ?? /* @__PURE__ */ new Date()).getTime(), a = n.audience ?? `referrer`, o =
|
|
237
|
+
let r = (n.now ?? /* @__PURE__ */ new Date()).getTime(), a = n.audience ?? `referrer`, o = c$1(t(n.currency)), s = (n.targetInteraction ? t$3.filter((e) => e.interactionTypeKey === n.targetInteraction) : t$3).filter((e) => !B(e, r)), c = s.filter((e) => V(e, r));
|
|
236
238
|
if (c.length > 0) {
|
|
237
239
|
let e = c.reduce((e, t) => {
|
|
238
240
|
let r = G(e, n.products), i = G(t, n.products);
|
|
@@ -261,25 +263,24 @@ function K(t$3, n = {}) {
|
|
|
261
263
|
};
|
|
262
264
|
}
|
|
263
265
|
function q(e, n = {}) {
|
|
264
|
-
let r
|
|
265
|
-
if (!r
|
|
266
|
-
let i = H(r
|
|
267
|
-
if (!i) return;
|
|
268
|
-
let a = C(i, n.currency);
|
|
266
|
+
let r = K(e, n);
|
|
267
|
+
if (!r) return;
|
|
268
|
+
let i$1 = H(r.campaign, n.audience ?? `referrer`);
|
|
269
|
+
if (!i$1) return;
|
|
270
|
+
let a = C(i$1, n.currency);
|
|
269
271
|
if (!a) return;
|
|
270
|
-
let o = u(r
|
|
272
|
+
let o = u(r.campaign.conditions), s = o == null ? void 0 : i(o, n.currency), c = r.campaign.defaultLockupSeconds, l = c && c > 0 ? Math.round(c / 86400) : void 0;
|
|
271
273
|
return {
|
|
272
274
|
formatted: a,
|
|
273
|
-
parts: S(i, n.currency),
|
|
274
|
-
payoutType: i.payoutType,
|
|
275
|
+
parts: S(i$1, n.currency),
|
|
276
|
+
payoutType: i$1.payoutType,
|
|
275
277
|
minPurchaseAmount: s,
|
|
276
278
|
lockupDurationDays: l,
|
|
277
|
-
referrerReward: r
|
|
278
|
-
refereeReward: r
|
|
279
|
+
referrerReward: r.campaign.referrer,
|
|
280
|
+
refereeReward: r.campaign.referee,
|
|
279
281
|
minPurchaseValue: o ?? void 0,
|
|
280
|
-
isProductScoped: r
|
|
281
|
-
matchedProducts: r
|
|
282
|
+
isProductScoped: r.campaign.productScope != null,
|
|
283
|
+
matchedProducts: r.matchedProducts
|
|
282
284
|
};
|
|
283
285
|
}
|
|
284
|
-
//#endregion
|
|
285
286
|
export { w as i, K as n, q as r, C as t };
|
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
|
|
2
|
-
//#region src/styles/sharedBaseCss.css.ts
|
|
1
|
+
// src/styles/sharedBaseCss.css.ts
|
|
3
2
|
const cssSource = ".reset_base__1831jhd0 {\n box-sizing: border-box;\n font-size: 100%;\n font: inherit;\n vertical-align: baseline;\n -webkit-tap-highlight-color: transparent;\n border: 0;\n margin: 0;\n padding: 0;\n}\n\n.reset_focusRing__1831jhd1 {\n outline-offset: 2px;\n outline: 2px solid #0000;\n}\n\n.reset_focusRing__1831jhd1:focus-visible {\n outline-color: currentColor;\n}\n\n.reset_fieldAppearance__1831jhd2 {\n appearance: none;\n background-color: #0000;\n}\n\n.reset_visuallyHidden__1831jhd3 {\n clip: rect(0, 0, 0, 0);\n white-space: nowrap;\n border-width: 0;\n width: 1px;\n height: 1px;\n margin: -1px;\n padding: 0;\n position: absolute;\n overflow: hidden;\n}\n\n.reset_element_ul__1831jhd4, .reset_element_ol__1831jhd5 {\n list-style: none;\n}\n\n.reset_element_button__1831jhd6 {\n cursor: pointer;\n}\n\n.reset_element_a__1831jhd7 {\n color: inherit;\n text-decoration: none;\n}\n\n.reset_element_table__1831jhdb {\n border-collapse: collapse;\n border-spacing: 0;\n}\n\n.reset_element_img__1831jhdc {\n max-width: 100%;\n display: block;\n}\n:root {\n --text-primary__pbq4ak0: #000;\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: #fff;\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: #fff;\n --surface-background2__pbq4akd: #f9fafb;\n --surface-elevated__pbq4ake: #fff;\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: #000;\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: #fff;\n --icon-error__pbq4ak13: #e31c31;\n --icon-success__pbq4ak14: #09be67;\n --icon-warning__pbq4ak15: #ec7e00;\n}\n.sharedBaseCss_buttonReset__7cswil0 {\n appearance: none;\n box-sizing: border-box;\n -webkit-tap-highlight-color: transparent;\n cursor: pointer;\n outline-offset: 2px;\n background-color: #0000;\n border: 0;\n outline: 2px solid #0000;\n margin: 0;\n font-family: inherit;\n}\n\n.sharedBaseCss_buttonReset__7cswil0:focus-visible {\n outline-color: currentColor;\n}\n";
|
|
4
|
-
//#endregion
|
|
5
3
|
export { cssSource as t };
|
|
@@ -5,7 +5,7 @@ import * as coreSdkActions from "@frak-labs/core-sdk/actions";
|
|
|
5
5
|
import { displaySharingPage } from "@frak-labs/core-sdk/actions";
|
|
6
6
|
import { useEffect, useState } from "preact/hooks";
|
|
7
7
|
import { useSyncExternalStore } from "preact/compat";
|
|
8
|
-
|
|
8
|
+
// src/actions/sharingPage.ts
|
|
9
9
|
async function openSharingPage(entryPoint, targetInteraction, placement, options) {
|
|
10
10
|
if (!window.FrakSetup?.client) {
|
|
11
11
|
console.error("Frak client not found");
|
|
@@ -21,8 +21,7 @@ async function openSharingPage(entryPoint, targetInteraction, placement, options
|
|
|
21
21
|
}
|
|
22
22
|
}, placement).catch((error) => console.error("Frak sharing page failed", error));
|
|
23
23
|
}
|
|
24
|
-
|
|
25
|
-
//#region src/utils/dom/detectListenerPreloads.ts
|
|
24
|
+
// src/utils/dom/detectListenerPreloads.ts
|
|
26
25
|
/**
|
|
27
26
|
* Tags that count as "Frak components" for the purpose of preload detection.
|
|
28
27
|
*
|
|
@@ -58,8 +57,7 @@ function detectListenerPreloads() {
|
|
|
58
57
|
if (typeof document === "undefined") return [];
|
|
59
58
|
return document.querySelector(FRAK_COMPONENT_SELECTOR) !== null ? ["sharing"] : [];
|
|
60
59
|
}
|
|
61
|
-
|
|
62
|
-
//#region src/bootstrap/clientReady.ts
|
|
60
|
+
// src/bootstrap/clientReady.ts
|
|
63
61
|
const CUSTOM_EVENT_NAME = "frak:client";
|
|
64
62
|
/**
|
|
65
63
|
* Dispatch a custom event when the Frak client is ready
|
|
@@ -79,8 +77,7 @@ function onClientReady(action, callback) {
|
|
|
79
77
|
}
|
|
80
78
|
(action === "add" ? window.addEventListener : window.removeEventListener)(CUSTOM_EVENT_NAME, callback, false);
|
|
81
79
|
}
|
|
82
|
-
|
|
83
|
-
//#region src/bootstrap/initFrakSdk.ts
|
|
80
|
+
// src/bootstrap/initFrakSdk.ts
|
|
84
81
|
/**
|
|
85
82
|
* Initializes the Frak SDK client and sets up necessary configurations.
|
|
86
83
|
* Uses withCache for inflight dedup — concurrent callers share the same promise.
|
|
@@ -154,8 +151,7 @@ function handleActionQueryParam() {
|
|
|
154
151
|
products
|
|
155
152
|
});
|
|
156
153
|
}
|
|
157
|
-
|
|
158
|
-
//#region src/utils/browser/onDocumentReady.ts
|
|
154
|
+
// src/utils/browser/onDocumentReady.ts
|
|
159
155
|
/**
|
|
160
156
|
* When the document is ready, run the callback
|
|
161
157
|
*/
|
|
@@ -163,8 +159,7 @@ function onDocumentReady(callback) {
|
|
|
163
159
|
if (document.readyState === "complete" || document.readyState === "interactive") setTimeout(callback, 1);
|
|
164
160
|
else document.addEventListener("DOMContentLoaded", callback);
|
|
165
161
|
}
|
|
166
|
-
|
|
167
|
-
//#region src/webcomponent/registerWebComponent.ts
|
|
162
|
+
// src/webcomponent/registerWebComponent.ts
|
|
168
163
|
/**
|
|
169
164
|
* Registers a Preact component as a custom web component
|
|
170
165
|
*
|
|
@@ -184,8 +179,7 @@ function registerWebComponent(component, tagName, observedAttributes = [], optio
|
|
|
184
179
|
}
|
|
185
180
|
}
|
|
186
181
|
}
|
|
187
|
-
|
|
188
|
-
//#region src/hooks/useClientReady.ts
|
|
182
|
+
// src/hooks/useClientReady.ts
|
|
189
183
|
function useClientReady() {
|
|
190
184
|
const [shouldRender, setShouldRender] = useState(() => {
|
|
191
185
|
if (!(window.FrakSetup?.config?.waitForBackendConfig !== false)) return true;
|
|
@@ -219,8 +213,7 @@ function useClientReady() {
|
|
|
219
213
|
isClientReady
|
|
220
214
|
};
|
|
221
215
|
}
|
|
222
|
-
|
|
223
|
-
//#region src/hooks/sdkConfigSubscription.ts
|
|
216
|
+
// src/hooks/sdkConfigSubscription.ts
|
|
224
217
|
/**
|
|
225
218
|
* Shared `useSyncExternalStore` plumbing for the SDK config store.
|
|
226
219
|
*
|
|
@@ -240,8 +233,7 @@ function subscribeSdkConfig(onStoreChange) {
|
|
|
240
233
|
window.addEventListener("frak:config", onStoreChange);
|
|
241
234
|
return () => window.removeEventListener("frak:config", onStoreChange);
|
|
242
235
|
}
|
|
243
|
-
|
|
244
|
-
//#region src/hooks/useLang.ts
|
|
236
|
+
// src/hooks/useLang.ts
|
|
245
237
|
/**
|
|
246
238
|
* Resolve the active display language for the Web Components.
|
|
247
239
|
*
|
|
@@ -254,8 +246,7 @@ function subscribeSdkConfig(onStoreChange) {
|
|
|
254
246
|
function useLang() {
|
|
255
247
|
return useSyncExternalStore(subscribeSdkConfig, () => sdkConfigStore.getConfig().lang ?? detectPageLanguage() ?? "en");
|
|
256
248
|
}
|
|
257
|
-
|
|
258
|
-
//#region src/styles/sharedCss.ts
|
|
249
|
+
// src/styles/sharedCss.ts
|
|
259
250
|
const sharedCss = `
|
|
260
251
|
:host {
|
|
261
252
|
display: contents;
|
|
@@ -318,5 +309,4 @@ const lightDomBaseCss = `
|
|
|
318
309
|
}
|
|
319
310
|
}
|
|
320
311
|
`;
|
|
321
|
-
//#endregion
|
|
322
312
|
export { useClientReady as a, subscribeSdkConfig as i, lightDomBaseCss as n, registerWebComponent as o, useLang as r, openSharingPage as s, buildStyleContent as t };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { i as subscribeSdkConfig } from "./sharedCss-
|
|
1
|
+
import { i as subscribeSdkConfig } from "./sharedCss-SKmJGZgN.js";
|
|
2
2
|
import { sdkConfigStore } from "@frak-labs/core-sdk";
|
|
3
3
|
import { useSyncExternalStore } from "preact/compat";
|
|
4
|
-
|
|
4
|
+
// src/hooks/useGlobalComponents.ts
|
|
5
5
|
/**
|
|
6
6
|
* Subscribe to the global component defaults from the SDK config store.
|
|
7
7
|
* These serve as fallbacks when no placement-level override exists.
|
|
@@ -13,5 +13,4 @@ import { useSyncExternalStore } from "preact/compat";
|
|
|
13
13
|
function useGlobalComponents() {
|
|
14
14
|
return useSyncExternalStore(subscribeSdkConfig, () => sdkConfigStore.getConfig().components);
|
|
15
15
|
}
|
|
16
|
-
//#endregion
|
|
17
16
|
export { useGlobalComponents as t };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import
|
|
1
|
+
import "./sharedCss-SKmJGZgN.js";
|
|
2
2
|
import { useEffect } from "preact/hooks";
|
|
3
|
-
|
|
3
|
+
// src/styles/styleManager.ts
|
|
4
4
|
function ensureStyle(id, css) {
|
|
5
5
|
const existing = document.getElementById(id);
|
|
6
6
|
if (existing) {
|
|
@@ -28,12 +28,11 @@ const styleManager = {
|
|
|
28
28
|
injectBase,
|
|
29
29
|
injectPlacement
|
|
30
30
|
};
|
|
31
|
-
|
|
32
|
-
//#region src/hooks/useLightDomStyles.ts
|
|
31
|
+
// src/hooks/useLightDomStyles.ts
|
|
33
32
|
function useLightDomStyles(tag, placementId, placementCss, baseCss, sharedBaseCss) {
|
|
34
33
|
useEffect(() => {
|
|
35
34
|
if (sharedBaseCss) styleManager.injectBase("shared", sharedBaseCss);
|
|
36
|
-
styleManager.injectBase(tag, baseCss ??
|
|
35
|
+
styleManager.injectBase(tag, baseCss ?? "\n:where(frak-button-share, frak-open-in-app) {\n display: contents;\n}\n\n:where(frak-button-share .button, frak-open-in-app .button) {\n display: flex;\n align-items: center;\n justify-content: center;\n gap: 10px;\n}\n\n:where(frak-button-share .button:disabled, frak-open-in-app .button:disabled) {\n opacity: 0.7;\n cursor: default;\n}\n\n:where(frak-button-share .button__fadeIn, frak-open-in-app .button__fadeIn) {\n animation: frak-fadeIn 300ms ease-in;\n}\n\n@keyframes frak-fadeIn {\n from {\n opacity: 0;\n }\n\n to {\n opacity: 1;\n }\n}\n");
|
|
37
36
|
}, [tag]);
|
|
38
37
|
useEffect(() => {
|
|
39
38
|
if (!placementCss) return;
|
|
@@ -44,5 +43,4 @@ function useLightDomStyles(tag, placementId, placementCss, baseCss, sharedBaseCs
|
|
|
44
43
|
placementCss
|
|
45
44
|
]);
|
|
46
45
|
}
|
|
47
|
-
//#endregion
|
|
48
46
|
export { useLightDomStyles as t };
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { i as subscribeSdkConfig } from "./sharedCss-
|
|
1
|
+
import { i as subscribeSdkConfig } from "./sharedCss-SKmJGZgN.js";
|
|
2
2
|
import { sdkConfigStore } from "@frak-labs/core-sdk";
|
|
3
3
|
import { useCallback } from "preact/hooks";
|
|
4
4
|
import { useSyncExternalStore } from "preact/compat";
|
|
5
|
-
|
|
5
|
+
// src/hooks/usePlacement.ts
|
|
6
6
|
function getPlacement(id) {
|
|
7
7
|
return sdkConfigStore.getConfig().placements?.[id];
|
|
8
8
|
}
|
|
@@ -17,5 +17,4 @@ function usePlacement(placementId) {
|
|
|
17
17
|
const getSnapshot = useCallback(() => placementId ? getPlacement(placementId) : void 0, [placementId]);
|
|
18
18
|
return useSyncExternalStore(subscribeSdkConfig, getSnapshot);
|
|
19
19
|
}
|
|
20
|
-
//#endregion
|
|
21
20
|
export { usePlacement as t };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { r as q } from "./rewards-
|
|
1
|
+
import { r as q } from "./rewards-BuNthAR2.js";
|
|
2
2
|
import { getMerchantInformation } from "@frak-labs/core-sdk/actions";
|
|
3
3
|
import { useEffect, useState } from "preact/hooks";
|
|
4
|
-
|
|
4
|
+
// src/hooks/useReward.ts
|
|
5
5
|
/**
|
|
6
6
|
* Hook to fetch and format the best reward for a given interaction type.
|
|
7
7
|
*
|
|
@@ -46,5 +46,4 @@ function useReward(shouldUseReward, targetInteraction, audience, products) {
|
|
|
46
46
|
hasReward
|
|
47
47
|
};
|
|
48
48
|
}
|
|
49
|
-
//#endregion
|
|
50
49
|
export { useReward as t };
|
package/package.json
CHANGED
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
"url": "https://twitter.com/QNivelais"
|
|
12
12
|
}
|
|
13
13
|
],
|
|
14
|
-
"version": "1.3.3-beta.
|
|
14
|
+
"version": "1.3.3-beta.bbccfb81",
|
|
15
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",
|
|
@@ -108,21 +108,21 @@
|
|
|
108
108
|
"try:merchant": "bun scripts/tryOnMerchant.ts"
|
|
109
109
|
},
|
|
110
110
|
"dependencies": {
|
|
111
|
-
"@frak-labs/core-sdk": "1.5.3-beta.
|
|
112
|
-
"@frak-labs/frame-connector": "1.5.2-beta.
|
|
111
|
+
"@frak-labs/core-sdk": "1.5.3-beta.bbccfb81",
|
|
112
|
+
"@frak-labs/frame-connector": "1.5.2-beta.bbccfb81",
|
|
113
113
|
"preact": "^10.29.8",
|
|
114
114
|
"preact-custom-element": "^4.6.0",
|
|
115
115
|
"qr": "^0.7.0"
|
|
116
116
|
},
|
|
117
117
|
"devDependencies": {
|
|
118
|
-
"@playwright/test": "^1.64.
|
|
118
|
+
"@playwright/test": "^1.64.1",
|
|
119
119
|
"@frak-labs/design-system": "0.0.0",
|
|
120
120
|
"@frak-labs/test-foundation": "0.1.0",
|
|
121
121
|
"@preact/preset-vite": "^2.10.6",
|
|
122
|
-
"@rolldown/plugin-node-polyfills": "^1.0.
|
|
122
|
+
"@rolldown/plugin-node-polyfills": "^1.0.4",
|
|
123
123
|
"@testing-library/jest-dom": "^7.0.1",
|
|
124
|
-
"@testing-library/preact": "^3.2.
|
|
125
|
-
"@testing-library/user-event": "^14.6.
|
|
124
|
+
"@testing-library/preact": "^3.2.6",
|
|
125
|
+
"@testing-library/user-event": "^14.6.8",
|
|
126
126
|
"@types/jsdom": "^30.0.0",
|
|
127
127
|
"@types/node": "^25.9.9",
|
|
128
128
|
"@types/preact-custom-element": "^4.0.4",
|
|
@@ -131,13 +131,13 @@
|
|
|
131
131
|
"@vanilla-extract/integration": "^8.0.10",
|
|
132
132
|
"@vanilla-extract/sprinkles": "^1.7.1",
|
|
133
133
|
"@vanilla-extract/vite-plugin": "^5.2.6",
|
|
134
|
-
"@vitest/coverage-v8": "^5.0.
|
|
135
|
-
"@vitest/ui": "^5.0.
|
|
136
|
-
"jsdom": "^30.
|
|
134
|
+
"@vitest/coverage-v8": "^5.0.5",
|
|
135
|
+
"@vitest/ui": "^5.0.5",
|
|
136
|
+
"jsdom": "^30.1.3",
|
|
137
137
|
"lightningcss": "^1.33.0",
|
|
138
|
-
"rolldown": "~1.2.
|
|
139
|
-
"tsdown": "^0.23.
|
|
138
|
+
"rolldown": "~1.2.16",
|
|
139
|
+
"tsdown": "^0.23.4",
|
|
140
140
|
"typescript": "^6.0.3",
|
|
141
|
-
"vitest": "^5.0.
|
|
141
|
+
"vitest": "^5.0.5"
|
|
142
142
|
}
|
|
143
143
|
}
|