@frak-labs/components 1.2.4-beta.c207534b → 1.3.0-beta.1979e96f
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.CRPtw_VT.js +392 -0
- package/cdn/Banner.gDEO8VKX.js +208 -0
- package/cdn/ButtonShare.OuDvPMdk.js +1 -0
- package/cdn/ButtonWallet.DNE6ZhkT.js +40 -0
- package/cdn/GiftIcon.NTATj1WE.js +1 -0
- package/cdn/OpenInAppButton.Dv7oAwl1.js +1 -0
- package/cdn/PostPurchase.Co0QSBMO.js +102 -0
- package/cdn/components.js +1 -1
- package/cdn/jsxRuntime.module.C5UTjP_H.js +58 -0
- package/cdn/loader.js +58 -36
- package/cdn/qr.vkJgq9pN.js +5 -0
- package/cdn/rewards.COyZ6-7W.js +1 -0
- package/cdn/useGlobalComponents.DoG1wfeq.js +1 -0
- package/cdn/useLightDomStyles.B0_CS0Kq.js +1 -0
- package/cdn/usePlacement.B5JX9OU-.js +1 -0
- package/cdn/useReward.By-xuybY.js +1 -0
- package/dist/{GiftIcon-BmGGodb2.js → GiftIcon-JVhSFEhP.js} +1 -5
- package/dist/ambassador.d.ts +165 -0
- package/dist/ambassador.js +1814 -0
- package/dist/banner.js +89 -62
- 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 +48 -33
- package/dist/sharedBaseCss.css-BkMpQeRx.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 +16 -6
- 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.DGkoI2iK.js +0 -89
- package/cdn/defaults.tvSp2rcs.js +0 -58
- package/cdn/rewards.0JylBHNY.js +0 -1
- package/cdn/useGlobalComponents.DKsas1_6.js +0 -1
- package/cdn/useLightDomStyles.DrKjTWoi.js +0 -1
- package/cdn/useReward.DwuOhcD2.js +0 -1
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-BkMpQeRx.js";
|
|
7
|
+
import { t as usePlacement } from "./usePlacement-BpaIbzun.js";
|
|
8
|
+
import { r as LogoFrakWithName, t as GiftIcon } from "./GiftIcon-JVhSFEhP.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";
|
|
@@ -11,94 +13,107 @@ import { jsx, jsxs } from "preact/jsx-runtime";
|
|
|
11
13
|
import { FrakRpcError, RpcErrorCodes } from "@frak-labs/frame-connector";
|
|
12
14
|
//#region \0ve-inline:src/components/PostPurchase/PostPurchase.css.ts.vanilla.js
|
|
13
15
|
const cssSource$1 = `.PostPurchase_card__5fv5lh0 {
|
|
14
|
-
padding: 16px;
|
|
15
|
-
border-radius: 12px;
|
|
16
16
|
background-color: var(--surface-background__pbq4akc);
|
|
17
17
|
border: 1px solid var(--border-default__pbq4akv);
|
|
18
|
+
border-radius: 12px;
|
|
19
|
+
padding: 16px;
|
|
18
20
|
}
|
|
21
|
+
|
|
19
22
|
.PostPurchase_cardLayout__5fv5lh1 {
|
|
20
|
-
display: flex;
|
|
21
23
|
flex-direction: row;
|
|
22
24
|
align-items: center;
|
|
23
25
|
gap: 32px;
|
|
26
|
+
display: flex;
|
|
24
27
|
}
|
|
28
|
+
|
|
25
29
|
.PostPurchase_cardLeft__5fv5lh2 {
|
|
30
|
+
flex-direction: column;
|
|
26
31
|
flex-grow: 1;
|
|
32
|
+
gap: 8px;
|
|
27
33
|
min-width: 0;
|
|
28
34
|
display: flex;
|
|
29
|
-
flex-direction: column;
|
|
30
|
-
gap: 8px;
|
|
31
35
|
}
|
|
36
|
+
|
|
32
37
|
.PostPurchase_cardRight__5fv5lh3 {
|
|
33
|
-
|
|
34
|
-
display: flex;
|
|
38
|
+
text-align: right;
|
|
35
39
|
flex-direction: column;
|
|
40
|
+
flex-shrink: 0;
|
|
36
41
|
align-items: flex-end;
|
|
37
42
|
gap: 8px;
|
|
38
|
-
|
|
43
|
+
display: flex;
|
|
39
44
|
}
|
|
45
|
+
|
|
40
46
|
.PostPurchase_badge__5fv5lh4 {
|
|
41
|
-
|
|
42
|
-
background-color: #
|
|
47
|
+
color: var(--text-primary__pbq4ak0);
|
|
48
|
+
background-color: #fff534;
|
|
43
49
|
border-radius: 4px;
|
|
50
|
+
align-self: flex-start;
|
|
44
51
|
padding: 4px 8px;
|
|
45
52
|
font-size: 12px;
|
|
46
53
|
font-weight: 600;
|
|
47
54
|
line-height: 12px;
|
|
48
|
-
color: var(--text-primary__pbq4ak0);
|
|
49
55
|
}
|
|
56
|
+
|
|
50
57
|
.PostPurchase_message__5fv5lh5 {
|
|
58
|
+
color: var(--text-primary__pbq4ak0);
|
|
51
59
|
margin: 0;
|
|
52
60
|
font-size: 16px;
|
|
53
|
-
line-height: 22px;
|
|
54
|
-
color: var(--text-primary__pbq4ak0);
|
|
55
61
|
font-weight: 600;
|
|
62
|
+
line-height: 22px;
|
|
56
63
|
}
|
|
64
|
+
|
|
57
65
|
.PostPurchase_cta__5fv5lh6 {
|
|
58
|
-
|
|
59
|
-
|
|
66
|
+
background-color: var(--text-primary__pbq4ak0);
|
|
67
|
+
color: var(--text-onAction__pbq4ak6);
|
|
68
|
+
text-transform: uppercase;
|
|
69
|
+
border-radius: 9999px;
|
|
60
70
|
justify-content: center;
|
|
71
|
+
align-items: center;
|
|
61
72
|
gap: 4px;
|
|
62
73
|
padding: 12px 16px;
|
|
63
|
-
border-radius: 9999px;
|
|
64
|
-
background-color: var(--text-primary__pbq4ak0);
|
|
65
|
-
color: var(--text-onAction__pbq4ak6);
|
|
66
74
|
font-size: 12px;
|
|
67
75
|
font-weight: bold;
|
|
68
|
-
|
|
76
|
+
display: inline-flex;
|
|
69
77
|
}
|
|
78
|
+
|
|
70
79
|
.PostPurchase_cta__5fv5lh6:disabled {
|
|
71
|
-
opacity:
|
|
80
|
+
opacity: .7;
|
|
72
81
|
cursor: default;
|
|
73
82
|
}
|
|
83
|
+
|
|
74
84
|
.PostPurchase_icon__5fv5lh7 {
|
|
75
85
|
margin: -2px 0;
|
|
76
86
|
}
|
|
87
|
+
|
|
77
88
|
.PostPurchase_giftIcon__5fv5lh8 {
|
|
78
|
-
display: block;
|
|
79
89
|
flex-shrink: 0;
|
|
90
|
+
display: block;
|
|
80
91
|
}
|
|
92
|
+
|
|
81
93
|
.PostPurchase_imageWrapper__5fv5lh9 {
|
|
82
94
|
flex-shrink: 0;
|
|
83
|
-
display: flex;
|
|
84
|
-
align-items: center;
|
|
85
95
|
justify-content: center;
|
|
96
|
+
align-items: center;
|
|
86
97
|
width: 80px;
|
|
87
98
|
height: 80px;
|
|
99
|
+
display: flex;
|
|
88
100
|
overflow: hidden;
|
|
89
101
|
}
|
|
102
|
+
|
|
90
103
|
.PostPurchase_customImage__5fv5lha {
|
|
91
|
-
|
|
92
|
-
max-height: 100%;
|
|
104
|
+
object-fit: contain;
|
|
93
105
|
width: auto;
|
|
106
|
+
max-width: 100%;
|
|
94
107
|
height: auto;
|
|
95
|
-
|
|
108
|
+
max-height: 100%;
|
|
96
109
|
display: block;
|
|
97
110
|
}
|
|
111
|
+
|
|
98
112
|
.PostPurchase_frakLogo__5fv5lhb {
|
|
99
|
-
display: block;
|
|
100
113
|
margin-left: auto;
|
|
101
|
-
|
|
114
|
+
display: block;
|
|
115
|
+
}
|
|
116
|
+
`;
|
|
102
117
|
var card = "PostPurchase_card__5fv5lh0";
|
|
103
118
|
var cardLayout = "PostPurchase_cardLayout__5fv5lh1";
|
|
104
119
|
var cardLeft = "PostPurchase_cardLeft__5fv5lh2";
|
|
@@ -282,7 +297,7 @@ function PostPurchase({ customerId, orderId, token, sharingUrl, merchantId, plac
|
|
|
282
297
|
placement: placementId,
|
|
283
298
|
variant: resolvedVariant
|
|
284
299
|
});
|
|
285
|
-
openSharingPage(void 0, placementId, {
|
|
300
|
+
openSharingPage("post_purchase", void 0, placementId, {
|
|
286
301
|
link: resolvedSharingUrl,
|
|
287
302
|
products: parsedProducts,
|
|
288
303
|
checkoutToken: token
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
//#endregion
|
|
2
|
+
//#region src/styles/sharedBaseCss.css.ts
|
|
3
|
+
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
|
+
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-beta.1979e96f",
|
|
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.
|
|
107
|
-
"@frak-labs/frame-connector": "1.3.0-beta.
|
|
113
|
+
"@frak-labs/core-sdk": "1.5.0-beta.1979e96f",
|
|
114
|
+
"@frak-labs/frame-connector": "1.3.0-beta.1979e96f",
|
|
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",
|
|
@@ -117,7 +126,7 @@
|
|
|
117
126
|
"@testing-library/preact": "^3.2.4",
|
|
118
127
|
"@testing-library/user-event": "^14.6.7",
|
|
119
128
|
"@types/jsdom": "^30.0.0",
|
|
120
|
-
"@types/node": "^25.9.
|
|
129
|
+
"@types/node": "^25.9.9",
|
|
121
130
|
"@types/preact-custom-element": "^4.0.4",
|
|
122
131
|
"@typescript/native": "npm:typescript@^7.0.2",
|
|
123
132
|
"@vanilla-extract/css": "^1.21.2",
|
|
@@ -127,6 +136,7 @@
|
|
|
127
136
|
"@vitest/coverage-v8": "^5.0.0",
|
|
128
137
|
"@vitest/ui": "^5.0.0",
|
|
129
138
|
"jsdom": "^30.0.1",
|
|
139
|
+
"lightningcss": "^1.33.0",
|
|
130
140
|
"rolldown": "~1.2.0",
|
|
131
141
|
"tsdown": "^0.23.0",
|
|
132
142
|
"typescript": "^6.0.3",
|
package/cdn/Banner.DUI-0KQP.js
DELETED
|
@@ -1,183 +0,0 @@
|
|
|
1
|
-
import{O as e,S as t,a as n,f as r,m as i,s as a,u as o}from"./loader.js";import{a as s,d as c,f as l,h as u,l as d,m as f,n as ee,p,s as m,t as h,u as g}from"./defaults.tvSp2rcs.js";import{i as _}from"./rewards.0JylBHNY.js";import{a as v,i as y,n as b,r as x,t as S}from"./GiftIcon.pcCM0-Fr.js";import{t as C}from"./useGlobalComponents.DKsas1_6.js";import{t as te}from"./useLightDomStyles.DrKjTWoi.js";import{t as ne}from"./useReward.DwuOhcD2.js";var w=`inAppBanner_body__1ibpiy74`,T=`inAppBanner_closeButton__1ibpiy77`,E=`inAppBanner_container__1ibpiy70`,D=`inAppBanner_cta__1ibpiy76`,O=`inAppBanner_description__1ibpiy75`,k=`inAppBanner_header__1ibpiy71`,A=`inAppBanner_iconWrapper__1ibpiy72`,j=`inAppBanner_title__1ibpiy73`;function re({title:e,description:t,cta:n,dismissLabel:r,onAction:i,onDismiss:a,className:o,classNames:s}){return f(`div`,{className:`${E}${o?` ${o}`:``}`,role:`alert`,children:[f(`div`,{className:k,children:[f(`span`,{className:`${A}${s?.icon?` ${s.icon}`:``}`,children:f(b,{width:20,height:20})}),f(`p`,{className:`${j}${s?.title?` ${s.title}`:``}`,children:e})]}),f(`div`,{className:w,children:[f(`p`,{className:`${O}${s?.description?` ${s.description}`:``}`,children:t}),f(`button`,{type:`button`,className:`${D}${s?.cta?` ${s.cta}`:``}`,onClick:i,children:[n,f(y,{width:14,height:14})]})]}),f(`button`,{type:`button`,className:`${T}${s?.close?` ${s.close}`:``}`,onClick:a,"aria-label":r,children:f(v,{width:16,height:16})})]})}var ie=`Banner_frakLogo__1gnumzi9`,ae=`Banner_iconSvg__1gnumzi1`,oe=`Banner_referral__1gnumzi2 reset_base__1831jhd0 Banner_rootBase__1gnumzi0`,se=`Banner_referralBody__1gnumzi5`,ce=`Banner_referralCta__1gnumzi8 sharedBaseCss_buttonReset__7cswil0`,le=`Banner_referralDescription__1gnumzi7 reset_base__1831jhd0`,ue=`Banner_referralIconWrapper__1gnumzi3`,de=`Banner_referralImage__1gnumzi4`,fe=`Banner_referralTitle__1gnumzi6 reset_base__1831jhd0`;function M({placement:u,classname:v=``,interaction:y,products:b,referralTitle:w,referralDescription:T,referralCta:E,inappTitle:D,inappDescription:O,inappCta:k,imageUrl:A,preview:j,previewMode:M,allowInappRedirect:N}){let P=!!j,F=s(),I=M===`inapp`?`inapp`:`referral`,L=N===!0||N===`true`,R=ee(u),{shouldRender:z,isHidden:B,isClientReady:V}=m();te(`frak-banner`,u,R?.components?.banner?.css,`@keyframes keyframes_fadeIn__mnqmlt0 {
|
|
2
|
-
from {
|
|
3
|
-
opacity: 0;
|
|
4
|
-
}
|
|
5
|
-
to {
|
|
6
|
-
opacity: 1;
|
|
7
|
-
}
|
|
8
|
-
}
|
|
9
|
-
@keyframes keyframes_fadeOut__mnqmlt1 {
|
|
10
|
-
from {
|
|
11
|
-
opacity: 1;
|
|
12
|
-
}
|
|
13
|
-
to {
|
|
14
|
-
opacity: 0;
|
|
15
|
-
}
|
|
16
|
-
}
|
|
17
|
-
@keyframes keyframes_fadeInDown__mnqmlt2 {
|
|
18
|
-
from {
|
|
19
|
-
opacity: 0;
|
|
20
|
-
transform: translateY(-4px);
|
|
21
|
-
}
|
|
22
|
-
to {
|
|
23
|
-
opacity: 1;
|
|
24
|
-
transform: translateY(0);
|
|
25
|
-
}
|
|
26
|
-
}.inAppBanner_container__1ibpiy70 {
|
|
27
|
-
position: fixed;
|
|
28
|
-
top: max(8px, var(--safe-area-inset-top, env(safe-area-inset-top, 0px)));
|
|
29
|
-
left: 16px;
|
|
30
|
-
right: 16px;
|
|
31
|
-
z-index: 1000;
|
|
32
|
-
display: flex;
|
|
33
|
-
flex-direction: column;
|
|
34
|
-
gap: 4px;
|
|
35
|
-
padding: 12px 16px;
|
|
36
|
-
padding-right: 32px;
|
|
37
|
-
border-radius: 12px;
|
|
38
|
-
background-color: #000000cc;
|
|
39
|
-
backdrop-filter: blur(12px);
|
|
40
|
-
-webkit-backdrop-filter: blur(12px);
|
|
41
|
-
color: var(--text-onAction__pbq4ak6);
|
|
42
|
-
animation: keyframes_fadeInDown__mnqmlt2 300ms ease-out;
|
|
43
|
-
}
|
|
44
|
-
.inAppBanner_header__1ibpiy71 {
|
|
45
|
-
display: flex;
|
|
46
|
-
align-items: center;
|
|
47
|
-
gap: 8px;
|
|
48
|
-
}
|
|
49
|
-
.inAppBanner_iconWrapper__1ibpiy72 {
|
|
50
|
-
flex-shrink: 0;
|
|
51
|
-
width: 20px;
|
|
52
|
-
height: 20px;
|
|
53
|
-
display: flex;
|
|
54
|
-
align-items: center;
|
|
55
|
-
justify-content: center;
|
|
56
|
-
color: var(--text-onAction__pbq4ak6);
|
|
57
|
-
}
|
|
58
|
-
.inAppBanner_title__1ibpiy73 {
|
|
59
|
-
margin: 0;
|
|
60
|
-
padding: 0;
|
|
61
|
-
font-size: 16px;
|
|
62
|
-
font-weight: 500;
|
|
63
|
-
line-height: 26px;
|
|
64
|
-
color: var(--text-onAction__pbq4ak6);
|
|
65
|
-
}
|
|
66
|
-
.inAppBanner_body__1ibpiy74 {
|
|
67
|
-
display: flex;
|
|
68
|
-
flex-wrap: wrap;
|
|
69
|
-
align-items: baseline;
|
|
70
|
-
gap: 0 4px;
|
|
71
|
-
}
|
|
72
|
-
.inAppBanner_description__1ibpiy75 {
|
|
73
|
-
margin: 0;
|
|
74
|
-
padding: 0;
|
|
75
|
-
font-size: 14px;
|
|
76
|
-
color: var(--text-onAction__pbq4ak6);
|
|
77
|
-
line-height: 22px;
|
|
78
|
-
opacity: 0.96;
|
|
79
|
-
}
|
|
80
|
-
.inAppBanner_cta__1ibpiy76 {
|
|
81
|
-
all: unset;
|
|
82
|
-
display: inline-flex;
|
|
83
|
-
align-items: center;
|
|
84
|
-
gap: 4px;
|
|
85
|
-
color: #2bb2ff;
|
|
86
|
-
font-size: 14px;
|
|
87
|
-
font-weight: 600;
|
|
88
|
-
text-decoration: underline;
|
|
89
|
-
text-underline-offset: 2px;
|
|
90
|
-
cursor: pointer;
|
|
91
|
-
}
|
|
92
|
-
.inAppBanner_cta__1ibpiy76:focus-visible {
|
|
93
|
-
outline: 2px solid #2bb2ff;
|
|
94
|
-
outline-offset: 2px;
|
|
95
|
-
border-radius: 4px;
|
|
96
|
-
}
|
|
97
|
-
.inAppBanner_closeButton__1ibpiy77 {
|
|
98
|
-
all: unset;
|
|
99
|
-
position: absolute;
|
|
100
|
-
top: 8px;
|
|
101
|
-
right: 8px;
|
|
102
|
-
width: 28px;
|
|
103
|
-
height: 28px;
|
|
104
|
-
display: flex;
|
|
105
|
-
align-items: center;
|
|
106
|
-
justify-content: center;
|
|
107
|
-
border-radius: 9999px;
|
|
108
|
-
color: #ffffff99;
|
|
109
|
-
cursor: pointer;
|
|
110
|
-
}
|
|
111
|
-
.inAppBanner_closeButton__1ibpiy77:focus-visible {
|
|
112
|
-
outline: 2px solid var(--text-onAction__pbq4ak6);
|
|
113
|
-
outline-offset: 2px;
|
|
114
|
-
}.Banner_rootBase__1gnumzi0 {
|
|
115
|
-
position: relative;
|
|
116
|
-
display: flex;
|
|
117
|
-
animation: keyframes_fadeInDown__mnqmlt2 300ms ease-out;
|
|
118
|
-
}
|
|
119
|
-
.Banner_iconSvg__1gnumzi1 {
|
|
120
|
-
width: 100%;
|
|
121
|
-
height: 100%;
|
|
122
|
-
}
|
|
123
|
-
.Banner_referral__1gnumzi2 {
|
|
124
|
-
flex-direction: row;
|
|
125
|
-
align-items: center;
|
|
126
|
-
gap: 16px;
|
|
127
|
-
padding: 16px;
|
|
128
|
-
background-color: #ffffff;
|
|
129
|
-
color: var(--text-primary__pbq4ak0);
|
|
130
|
-
border: 1px solid var(--border-default__pbq4akv);
|
|
131
|
-
border-radius: 12px;
|
|
132
|
-
}
|
|
133
|
-
.Banner_referralIconWrapper__1gnumzi3 {
|
|
134
|
-
flex-shrink: 0;
|
|
135
|
-
align-self: flex-start;
|
|
136
|
-
display: flex;
|
|
137
|
-
align-items: center;
|
|
138
|
-
justify-content: center;
|
|
139
|
-
width: 40px;
|
|
140
|
-
height: 40px;
|
|
141
|
-
overflow: hidden;
|
|
142
|
-
}
|
|
143
|
-
.Banner_referralImage__1gnumzi4 {
|
|
144
|
-
max-width: 100%;
|
|
145
|
-
max-height: 100%;
|
|
146
|
-
width: auto;
|
|
147
|
-
height: auto;
|
|
148
|
-
object-fit: contain;
|
|
149
|
-
display: block;
|
|
150
|
-
}
|
|
151
|
-
.Banner_referralBody__1gnumzi5 {
|
|
152
|
-
flex: 1;
|
|
153
|
-
min-width: 0;
|
|
154
|
-
}
|
|
155
|
-
.Banner_referralTitle__1gnumzi6 {
|
|
156
|
-
font-size: 16px;
|
|
157
|
-
font-weight: 600;
|
|
158
|
-
color: var(--text-primary__pbq4ak0);
|
|
159
|
-
line-height: 22px;
|
|
160
|
-
}
|
|
161
|
-
.Banner_referralDescription__1gnumzi7 {
|
|
162
|
-
margin-bottom: 8px;
|
|
163
|
-
font-size: 14px;
|
|
164
|
-
color: #979797;
|
|
165
|
-
line-height: 22px;
|
|
166
|
-
}
|
|
167
|
-
.Banner_referralCta__1gnumzi8 {
|
|
168
|
-
display: inline-block;
|
|
169
|
-
padding: 8px 16px;
|
|
170
|
-
border: 1px solid #000000;
|
|
171
|
-
border-radius: 9999px;
|
|
172
|
-
color: var(--text-primary__pbq4ak0);
|
|
173
|
-
font-size: 10px;
|
|
174
|
-
font-weight: 700;
|
|
175
|
-
line-height: 12px;
|
|
176
|
-
text-transform: uppercase;
|
|
177
|
-
}
|
|
178
|
-
.Banner_frakLogo__1gnumzi9 {
|
|
179
|
-
position: absolute;
|
|
180
|
-
right: 16px;
|
|
181
|
-
bottom: 12px;
|
|
182
|
-
pointer-events: none;
|
|
183
|
-
}`,e);let[H,U]=c(!1),[W,G]=c(()=>P?I:L&&o?`inapp`:null),K=d(null);l(()=>{P&&G(I)},[P,I]);let pe=g(()=>r(b),[b]),{reward:q}=ne(W===`referral`&&V,y,`referee`,pe),[J,Y]=c(null);l(()=>{let e=window.FrakSetup?.client;W===`inapp`&&!P&&V&&e&&a(e).then(e=>Y(e)).catch(()=>{})},[W,P,V]),l(()=>{P||!W||H||K.current!==W&&V&&(t(window.FrakSetup?.client,`banner_impression`,{placement:u,variant:W,has_reward:W===`referral`?!!q:void 0}),K.current=W)},[W,H,V,P,u]),l(()=>{if(P||W===`inapp`)return;let e=()=>G(`referral`);return window.addEventListener(n,e),()=>window.removeEventListener(n,e)},[P,W]);let X=p(async()=>{if(P)return;if(t(window.FrakSetup?.client,`banner_resolved`,{placement:u,variant:W??`referral`,outcome:`clicked`}),W===`referral`){U(!0);return}let e=J;if(!e&&window.FrakSetup?.client)try{e=await a(window.FrakSetup?.client)}catch{}let n=window.location.href;if(e){let t=new URL(n);t.searchParams.set(`fmt`,e),n=t.toString()}i(n)},[P,W,J,u]),me=p(()=>{P||(t(window.FrakSetup?.client,`banner_resolved`,{placement:u,variant:W??`referral`,outcome:`dismissed`}),U(!0))},[P,W,u]),he=C(),Z=R?.components?.banner??he?.banner,Q=A??Z?.imageUrl,$=g(()=>{let e=h[F].banner;if(W===`referral`){let t=q?e.referralTitleReward:e.referralTitle;return{title:_(w??Z?.referralTitle??t,q),description:_(T??Z?.referralDescription??e.referralDescription,q),cta:E??Z?.referralCta??e.referralCta}}return{title:_(D??Z?.inappTitle??e.inappTitle,void 0),description:_(O??Z?.inappDescription??e.inappDescription,void 0),cta:k??Z?.inappCta??e.inappCta}},[F,W,q,Z,w,T,E,D,O,k]);if(!W||!P&&(!z||B||H))return null;let ge=[oe,`frak-banner`,`frak-banner--${W}`,v].filter(Boolean).join(` `);return W===`inapp`?f(re,{title:$.title,description:$.description,cta:$.cta,dismissLabel:h[F].banner.dismissLabel,onAction:X,onDismiss:me,className:[`frak-banner`,`frak-banner--inapp`,v].filter(Boolean).join(` `),classNames:{icon:`frak-banner__icon`,title:`frak-banner__title`,description:`frak-banner__description`,cta:`frak-banner__cta`,close:`frak-banner__close`}}):f(`div`,{class:ge,role:`alert`,children:[f(`div`,{class:`${ue} frak-banner__icon`,children:Q?f(`img`,{src:Q,alt:``,class:de}):f(S,{class:ae})}),f(`div`,{class:`${se} frak-banner__text`,children:[f(`p`,{class:`${fe} frak-banner__title`,children:$.title}),f(`p`,{class:`${le} frak-banner__description`,children:$.description}),f(`button`,{type:`button`,class:`${ce} frak-banner__cta`,onClick:X,children:$.cta})]}),f(x,{class:`${ie} frak-banner__logo`,width:42,height:24})]})}u(M,`frak-banner`,[`placement`,`classname`,`interaction`,`products`,`referralTitle`,`referralDescription`,`referralCta`,`inappTitle`,`inappDescription`,`inappCta`,`preview`,`previewMode`,`imageUrl`,`allowInappRedirect`],{shadow:!1});export{M as Banner};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{S as e,l as t,r as n}from"./loader.js";import{a as r,f as i,h as a,l as o,m as s,n as c,p as l,s as u,t as d,u as f}from"./defaults.tvSp2rcs.js";import{i as p}from"./rewards.0JylBHNY.js";import{t as m}from"./useGlobalComponents.DKsas1_6.js";import{t as h}from"./useLightDomStyles.DrKjTWoi.js";import{t as g}from"./useReward.DwuOhcD2.js";function _({placement:a,text:_,classname:v=``,noRewardText:y,targetInteraction:b,products:x,clickAction:S,preview:C}){let w=!!C,T=r(),E=c(a),D=m(),O=E?.components?.buttonShare??D?.buttonShare;h(`frak-button-share`,a,O?.css);let k=E?.targetInteraction===void 0?b:E.targetInteraction,A=O?.text??_??d[T].buttonShare.text,j=O?.noRewardText??y,M=A.includes(`{REWARD}`),N=O?.clickAction??S??`sharing-page`,{shouldRender:P,isHidden:F,isClientReady:I}=u(),L=f(()=>t(x),[x]),{reward:R}=g(M&&I,k,void 0,L),z=f(()=>M?R?p(A,R):j??p(A,void 0):A,[M,A,j,R]),B=o(!1);i(()=>{w||B.current||I&&P&&!F&&(e(window.FrakSetup?.client,`share_button_impression`,{placement:a,target_interaction:k,has_reward:!!R}),B.current=!0)},[w,I,P,F,a,k]);let V=l(()=>{w||(e(window.FrakSetup.client,`share_button_clicked`,{placement:a,target_interaction:k,has_reward:!!R,click_action:N}),n(k,a,{products:L}))},[w,N,k,a,R,L]);if(!w&&(!P||F))return null;let H=[`button`,`button__fadeIn`,v].filter(Boolean).join(` `);return s(`button`,{type:`button`,disabled:!w&&!I,class:H,onClick:V,children:z})}a(_,`frak-button-share`,[`text`,`placement`,`classname`,`clickAction`,`noRewardText`,`targetInteraction`,`products`,`preview`],{shadow:!1});export{_ as ButtonShare};
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
import{S as e,r as t}from"./loader.js";import{a as n,f as r,g as i,h as a,l as o,m as s,n as c,p as l,r as u,s as d,t as f}from"./defaults.tvSp2rcs.js";import{t as p}from"./useReward.DwuOhcD2.js";function m(){`vibrate`in navigator&&navigator.vibrate(10)}function h(e){return s(`svg`,{fill:`none`,height:`1em`,viewBox:`0 0 28 28`,width:`1em`,xmlns:`http://www.w3.org/2000/svg`,...e,children:[s(`title`,{children:`Gift icon`}),s(`path`,{d:`m23.14 14v11.43h-18.29v-11.43m9.14 11.43v-17.14m0 0h-5.14c-0.76 0-1.48-0.3-2.02-0.84s-0.84-1.26-0.84-2.020.3-1.480.84-2.02 1.26-0.84 2.02-0.84c4 0 5.14 5.71 5.14 5.71zm0 0h5.14c0.76 0 1.48-0.3 2.02-0.84s0.84-1.260.84-2.02-0.3-1.48-0.84-2.02-1.26-0.84-2.02-0.84c-4 0-5.14 5.71-5.14 5.71zm-11.43 0h22.86v5.71h-22.86z`,stroke:`#fff`,"stroke-linecap":`round`,"stroke-linejoin":`round`})]})}function g({placement:a,classname:g=``,useReward:_,targetInteraction:v}){let y=n(),b=c(a),x=b?.targetInteraction===void 0?v:b.targetInteraction,S=_===!0,{shouldRender:C,isHidden:w,isClientReady:T}=d(),{reward:E}=p(S&&T,x),D=b?.components?.buttonWallet?.position??window.FrakSetup?.modalWalletConfig?.metadata?.position??`right`,O=o(!1);r(()=>{O.current||T&&C&&!w&&(e(window.FrakSetup?.client,`share_button_impression`,{placement:a,target_interaction:x,has_reward:!!E}),O.current=!0)},[T,C,w,a,x]);let k=l(()=>{e(window.FrakSetup.client,`share_button_clicked`,{placement:a,target_interaction:x,has_reward:!!E,click_action:`sharing-page`}),m(),t(x,a)},[a,x,E]);if(!C||w)return null;let A=[`button`,`button__fadeIn`,D===`left`?`button__left`:`button__right`,g].filter(Boolean).join(` `);return s(i,{children:[s(`style`,{children:u(`
|
|
2
|
-
.button {
|
|
3
|
-
all: unset;
|
|
4
|
-
position: fixed;
|
|
5
|
-
bottom: 20px;
|
|
6
|
-
z-index: 2000000;
|
|
7
|
-
display: flex;
|
|
8
|
-
justify-content: center;
|
|
9
|
-
align-items: center;
|
|
10
|
-
background-color: #3e557e;
|
|
11
|
-
width: 45px;
|
|
12
|
-
height: 45px;
|
|
13
|
-
border-radius: 50%;
|
|
14
|
-
cursor: pointer;
|
|
15
|
-
text-align: center;
|
|
16
|
-
font-size: 24px;
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
.button__left {
|
|
20
|
-
left: 20px;
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
.button__right {
|
|
24
|
-
right: 20px;
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
.reward {
|
|
28
|
-
position: absolute;
|
|
29
|
-
top: -4px;
|
|
30
|
-
right: 27px;
|
|
31
|
-
padding: 2px 3px;
|
|
32
|
-
border-radius: 5px;
|
|
33
|
-
background: #ff3f3f;
|
|
34
|
-
font-size: 9px;
|
|
35
|
-
color: #fff;
|
|
36
|
-
font-weight: 600;
|
|
37
|
-
white-space: nowrap;
|
|
38
|
-
line-height: 9px;
|
|
39
|
-
}
|
|
40
|
-
`,b?.components?.buttonWallet?.css)}),s(`button`,{type:`button`,"aria-label":f[y].buttonWallet.ariaLabel,part:`button`,disabled:!T,class:A,onClick:k,children:[s(h,{}),E&&s(`span`,{class:`reward`,children:E})]})]})}a(g,`frak-button-wallet`,[`placement`,`classname`,`useReward`,`targetInteraction`],{shadow:!0});export{g as ButtonWallet};
|
package/cdn/GiftIcon.pcCM0-Fr.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{m as e}from"./defaults.tvSp2rcs.js";function t(t){return e(`svg`,{width:`15`,height:`15`,viewBox:`0 0 15 15`,fill:`none`,"aria-hidden":`true`,...t,children:e(`path`,{d:`M7.33 0C11.38 0 14.67 3.28 14.67 7.33C14.67 11.38 11.38 14.67 7.33 14.67C3.28 14.67 0 11.38 0 7.33C0 3.28 3.28 0 7.33 0ZM10.39 4.28C10.15 4.04 9.76 4.04 9.52 4.28L7.33 6.47L5.14 4.28C4.9 4.04 4.52 4.04 4.28 4.28C4.04 4.52 4.04 4.9 4.28 5.14L6.47 7.33L4.28 9.52C4.04 9.76 4.04 10.15 4.28 10.39C4.52 10.63 4.9 10.63 5.14 10.39L7.33 8.2L9.52 10.39C9.76 10.63 10.15 10.63 10.39 10.39C10.63 10.15 10.63 9.76 10.39 9.52L8.2 7.33L10.39 5.14C10.63 4.9 10.63 4.52 10.39 4.28Z`,fill:`currentColor`})})}function n(t){return e(`svg`,{width:`12`,height:`12`,viewBox:`0 0 12 12`,fill:`none`,"aria-hidden":`true`,...t,children:e(`path`,{d:`M5.46 0C5.76 0 6 0.24 6 0.55C6 0.85 5.76 1.09 5.46 1.09H4.36C3.05 1.09 2.28 1.36 1.82 1.82C1.36 2.28 1.09 3.05 1.09 4.36V7.64C1.09 8.95 1.36 9.72 1.82 10.18C2.28 10.64 3.05 10.91 4.36 10.91H7.64C8.95 10.91 9.72 10.64 10.18 10.18C10.64 9.72 10.91 8.95 10.91 7.64V6.55C10.91 6.24 11.15 6 11.46 6C11.76 6 12 6.24 12 6.55V7.64C12 9.05 11.72 10.19 10.95 10.95C10.19 11.72 9.05 12 7.64 12H4.36C2.95 12 1.81 11.72 1.05 10.95C0.28 10.19 6.04e-05 9.05 0 7.64V4.36C0 2.95 0.28 1.81 1.05 1.05C1.81 0.28 2.95 0 4.36 0H5.46ZM11.45 0C11.76 2.2e-05 12 0.24 12 0.55V3.16C12 3.47 11.76 3.71 11.45 3.71C11.15 3.71 10.91 3.46 10.91 3.16V1.86L6.93 5.84C6.72 6.05 6.37 6.05 6.16 5.84C5.95 5.63 5.95 5.28 6.16 5.07L10.14 1.09H8.84C8.54 1.09 8.29 0.85 8.29 0.55C8.29 0.24 8.53 0 8.84 0H11.45Z`,fill:`currentColor`})})}function r(t){return e(`svg`,{xmlns:`http://www.w3.org/2000/svg`,width:t.width??`63`,height:t.height??`24`,fill:`none`,viewBox:`0 0 63 24`,...t,children:[e(`title`,{children:`Frak`}),e(`rect`,{width:`24`,height:`24`,rx:`6`,fill:`#0043EF`}),e(`path`,{fill:`white`,d:`M9.77 15.91L5.15 14.35C5.06 14.32 4.97 14.38 4.97 14.47V17.33C4.97 17.39 5.01 17.44 5.06 17.46L9.68 19.02C9.77 19.05 9.86 18.98 9.86 18.89V16.04C9.86 15.98 9.82 15.93 9.77 15.91ZM14.58 10.44L9.95 12C9.9 12.02 9.86 12.07 9.86 12.13V14.98C9.86 15.08 9.95 15.14 10.04 15.11L14.66 13.55C14.72 13.53 14.76 13.48 14.76 13.42V10.57C14.76 10.47 14.66 10.41 14.58 10.44ZM18.92 5.02L11.18 7.51C11.12 7.53 11.08 7.58 11.08 7.64V10.57C11.08 10.62 11.14 10.66 11.2 10.65L18.94 8.15C18.99 8.14 19.03 8.08 19.03 8.02V5.1C19.03 5.04 18.97 5 18.92 5.02Z`}),e(`path`,{fill:`currentColor`,d:`M52.72 9.51C52.83 9.51 52.91 9.6 52.91 9.7L52.84 18.21C52.84 18.31 52.76 18.39 52.66 18.39L52.64 18.39H51.3C51.15 18.39 50.78 18.25 50.39 18C49.86 18.25 49.27 18.39 48.64 18.39H48.39C47.24 18.39 46.19 17.91 45.43 17.14C44.67 16.38 44.2 15.32 44.2 14.15C44.2 12.98 44.67 11.92 45.43 11.15C46.16 10.41 47.16 9.94 48.26 9.91C49.17 9.86 49.99 9.99 50.49 10.5V9.7C50.49 9.6 50.57 9.51 50.68 9.51H52.72ZM35.35 5.62H36.96C37.09 5.62 37.19 5.72 37.19 5.85V7.81C37.19 7.94 37.09 8.04 36.96 8.04H34.92C34.32 8.04 33.63 8.64 33.63 9.25V10.61C34.26 9.98 34.93 9.65 35.35 9.63H36.46C36.59 9.63 36.69 9.73 36.69 9.86V11.82C36.69 11.95 36.59 12.05 36.46 12.05H34.92C34.31 12.05 33.63 12.65 33.63 13.27V18.2C33.63 18.3 33.54 18.39 33.44 18.39H31.39C31.29 18.39 31.21 18.3 31.21 18.2V9.94C31.21 9.87 31.2 9.8 31.2 9.73C31.24 8.88 31.15 5.44 35.35 5.62ZM39.93 9.63C40.04 9.63 40.12 9.72 40.12 9.82V10.61C40.76 9.98 41.58 9.63 41.85 9.63H43.46C43.58 9.63 43.68 9.73 43.69 9.86V11.82C43.68 11.95 43.58 12.05 43.46 12.05H41.41C40.81 12.05 40.12 12.65 40.12 13.27V18.2C40.12 18.3 40.04 18.39 39.93 18.39H37.89C37.79 18.39 37.7 18.3 37.7 18.2V9.82C37.7 9.72 37.79 9.63 37.89 9.63H39.93ZM56.2 7.01C56.3 7.01 56.39 7.09 56.39 7.2V13.45L59.83 10.19C59.87 10.16 59.91 10.14 59.96 10.14H62.28C62.45 10.14 62.54 10.34 62.42 10.46L59.3 13.63L62.8 18.07C62.9 18.2 62.81 18.39 62.65 18.39H60.24C60.18 18.39 60.13 18.36 60.09 18.31L57.67 15.32C57.6 15.23 57.47 15.22 57.39 15.3L56.39 16.29V18.19C56.39 18.3 56.3 18.39 56.2 18.39H54.19C54.08 18.39 54 18.3 54 18.19V7.2C54 7.09 54.08 7.01 54.19 7.01H56.2ZM48.37 11.96C47.78 11.96 47.24 12.21 46.85 12.6C46.46 13 46.22 13.54 46.22 14.14C46.22 14.73 46.46 15.28 46.85 15.67C47.24 16.07 47.78 16.31 48.37 16.31H48.66C49.25 16.31 49.79 16.07 50.18 15.67C50.57 15.28 50.81 14.73 50.81 14.14C50.81 13.54 50.57 12.99 50.18 12.6C49.79 12.21 49.25 11.96 48.66 11.96H48.37Z`})]})}2*Math.PI*11;function i(t){return e(`svg`,{width:`16`,height:`16`,viewBox:`0 0 16 16`,fill:`none`,"aria-hidden":`true`,...t,children:e(`path`,{d:`M8 0C12.42 0 16 3.58 16 8C16 12.42 12.42 16 8 16C3.58 16 0 12.42 0 8C0 3.58 3.58 0 8 0ZM8 1.5C4.41 1.5 1.5 4.41 1.5 8C1.5 11.59 4.41 14.5 8 14.5C11.59 14.5 14.5 11.59 14.5 8C14.5 4.41 11.59 1.5 8 1.5ZM8.1 10.21C8.82 10.21 9.24 10.63 9.24 11.33C9.24 12.03 8.82 12.46 8.1 12.46C7.36 12.46 6.97 12.03 6.97 11.33C6.97 10.63 7.36 10.21 8.1 10.21ZM8.85 3.54C9.01 3.54 9.15 3.68 9.15 3.84V4.75L8.84 8.37C8.83 8.53 8.7 8.65 8.54 8.65H7.63C7.47 8.65 7.34 8.52 7.33 8.37L7.08 4.75V3.84C7.09 3.68 7.22 3.54 7.38 3.54H8.85Z`,fill:`currentColor`})})}function a(t){return e(`svg`,{viewBox:`0 0 100 100`,fill:`none`,"aria-hidden":`true`,...t,children:[e(`circle`,{cx:`38`,cy:`28`,r:`23`,fill:`#FFF533`}),e(`path`,{d:`M50 38C30 10 12 30 50 38Z`,stroke:`#222222`,"stroke-width":`4`,"stroke-linecap":`round`,"stroke-linejoin":`round`}),e(`path`,{d:`M50 38C70 10 88 30 50 38Z`,stroke:`#222222`,"stroke-width":`4`,"stroke-linecap":`round`,"stroke-linejoin":`round`}),e(`rect`,{x:`10`,y:`38`,width:`80`,height:`16`,rx:`2`,stroke:`#222222`,"stroke-width":`4`}),e(`path`,{d:`M15 54V89C15 90.6 16.4 92 18 92H82C83.6 92 85 90.6 85 89V54`,stroke:`#222222`,"stroke-width":`4`,"stroke-linecap":`round`,"stroke-linejoin":`round`}),e(`line`,{x1:`50`,y1:`54`,x2:`50`,y2:`92`,stroke:`#222222`,"stroke-width":`4`,"stroke-linecap":`round`})]})}export{t as a,n as i,i as n,r,a as t};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{S as e,d as t,g as n,h as r}from"./loader.js";import{a as i,h as a,m as o,n as s,s as c,t as l}from"./defaults.tvSp2rcs.js";import{t as u}from"./useLightDomStyles.DrKjTWoi.js";function d(r=`wallet`,i){let a=window.FrakSetup?.client;a&&e(a,`open_in_app_clicked`,{path:r,placement:i});let o=`${n}${r}`;t(o,{onFallback:()=>{a&&e(a,`app_not_installed`,{path:r,placement:i})}})}function f(){return{isMobile:r()}}function p({placement:e,text:t,classname:n=``}){let r=i(),a=s(e),{shouldRender:p,isHidden:m,isClientReady:h}=c(),{isMobile:g}=f();u(`frak-open-in-app`,e,a?.components?.openInApp?.css);let _=a?.components?.openInApp?.text??t??l[r].openInApp.text;if(!g||!p||m)return null;let v=()=>{d(void 0,e)},y=[`button`,`button__fadeIn`,n].filter(Boolean).join(` `);return o(`button`,{type:`button`,"aria-label":l[r].openInApp.ariaLabel,disabled:!h,class:y,onClick:v,children:_})}a(p,`frak-open-in-app`,[`text`,`placement`,`classname`],{shadow:!1});export{p as OpenInAppButton};
|