@frak-labs/components 0.0.26-beta.1c24fe7c → 0.0.26-beta.4b98158f
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.BV0CYYyJ.js +132 -0
- package/cdn/ButtonShare.BfQyNjgk.js +1 -0
- package/cdn/{ButtonWallet.B7UmJcbb.js → ButtonWallet.DHrL4faA.js} +2 -2
- package/cdn/OpenInAppButton.BuQXYJth.js +1 -0
- package/cdn/PostPurchase.CpkvA80k.js +47 -0
- package/cdn/components.js +1 -1
- package/cdn/jsxRuntime.module.Cw8k9d3Z.js +58 -0
- package/cdn/loader.js +25 -25
- package/cdn/sprinkles.css.ts.vanilla.BKH7Z6IK.js +1175 -0
- package/cdn/useLightDomStyles.ICOW93sC.js +1 -0
- package/cdn/{useReward.DEU0AF3P.js → useReward.CtWbol8A.js} +1 -1
- package/cdn/{useShareModal.CN9_P7Sl.js → useShareModal.DBb9gEAh.js} +1 -1
- package/dist/GiftIcon-BrNVWoWm.js +1246 -0
- package/dist/banner.d.ts +54 -11
- package/dist/banner.js +306 -99
- 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 +1633 -29
- package/dist/{useLightDomStyles-DukxuNnJ.js → useLightDomStyles-Cjpf0MnX.js} +2 -5
- package/dist/{usePlacement-BbMuz8_A.js → usePlacement-LqYjZLX_.js} +1 -93
- package/dist/{useReward-CI2yRrCj.js → useReward-XF2hB_C_.js} +2 -4
- package/dist/{useShareModal-DHlayNqk.js → useShareModal-Bmlk3eBJ.js} +1 -3
- package/package.json +10 -5
- package/cdn/Banner.D-DB7VwI.js +0 -1
- package/cdn/ButtonShare.BM9Inhmf.js +0 -1
- package/cdn/OpenInAppButton.B4mrsz6L.js +0 -1
- package/cdn/PostPurchase.CMa-59qR.js +0 -1
- package/cdn/jsxRuntime.module.5UNmmhNi.js +0 -138
- package/cdn/useLightDomStyles.D895e4W1.js +0 -1
- /package/cdn/{formatReward.C8hlSKRj.js → formatReward.DXMr8a-D.js} +0 -0
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,23 +20,58 @@ 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
|
|
26
60
|
/**
|
|
27
61
|
* Auto-detecting notification banner component.
|
|
28
62
|
*
|
|
29
|
-
* Renders an inline banner on the merchant page
|
|
30
|
-
*
|
|
63
|
+
* Renders an inline banner on the merchant page with one of two distinct
|
|
64
|
+
* visual styles depending on the detected mode:
|
|
31
65
|
*
|
|
32
|
-
* - **Referral mode
|
|
33
|
-
* Displays reward
|
|
34
|
-
* - **In-app browser mode
|
|
35
|
-
* media in-app browser (Instagram, Facebook).
|
|
36
|
-
* default browser
|
|
66
|
+
* - **Referral mode** (white): Shown after a successful referral link
|
|
67
|
+
* processing. Displays a gift icon, reward copy, and a "Got it" CTA.
|
|
68
|
+
* - **In-app browser mode** (dark transparent): Shown when the page is
|
|
69
|
+
* opened inside a social media in-app browser (Instagram, Facebook).
|
|
70
|
+
* Offers an inline link to redirect to the default browser plus a
|
|
71
|
+
* close button to dismiss.
|
|
37
72
|
*
|
|
38
73
|
* In-app browser mode takes priority over referral mode.
|
|
39
|
-
* Uses Light DOM
|
|
74
|
+
* Uses Light DOM + vanilla-extract styles from `@frak-labs/design-system`.
|
|
40
75
|
*
|
|
41
76
|
* @group components
|
|
42
77
|
*
|
|
@@ -55,8 +90,16 @@ type BannerProps = {
|
|
|
55
90
|
declare function Banner({
|
|
56
91
|
placement: placementId,
|
|
57
92
|
classname,
|
|
58
|
-
interaction
|
|
59
|
-
|
|
93
|
+
interaction,
|
|
94
|
+
referralTitle: propReferralTitle,
|
|
95
|
+
referralDescription: propReferralDescription,
|
|
96
|
+
referralCta: propReferralCta,
|
|
97
|
+
inappTitle: propInappTitle,
|
|
98
|
+
inappDescription: propInappDescription,
|
|
99
|
+
inappCta: propInappCta,
|
|
100
|
+
preview,
|
|
101
|
+
previewMode
|
|
102
|
+
}: BannerProps): _$preact.JSX.Element | null;
|
|
60
103
|
//#endregion
|
|
61
104
|
//#region src/components/Banner/index.d.ts
|
|
62
105
|
/**
|
package/dist/banner.js
CHANGED
|
@@ -1,83 +1,226 @@
|
|
|
1
|
-
import { a as
|
|
2
|
-
import { t as useLightDomStyles } from "./useLightDomStyles-
|
|
3
|
-
import { t as useReward } from "./useReward-
|
|
1
|
+
import { a as registerWebComponent, i as useClientReady, t as usePlacement } from "./usePlacement-LqYjZLX_.js";
|
|
2
|
+
import { t as useLightDomStyles } from "./useLightDomStyles-Cjpf0MnX.js";
|
|
3
|
+
import { t as useReward } from "./useReward-XF2hB_C_.js";
|
|
4
|
+
import { i as cssSource$2, n as cssSource$4, r as cssSource$3, t as GiftIcon } from "./GiftIcon-BrNVWoWm.js";
|
|
4
5
|
import { isInAppBrowser, redirectToExternalBrowser } from "@frak-labs/core-sdk";
|
|
5
6
|
import { REFERRAL_SUCCESS_EVENT } from "@frak-labs/core-sdk/actions";
|
|
6
7
|
import { useCallback, useEffect, useMemo, useState } from "preact/hooks";
|
|
7
8
|
import { jsx, jsxs } from "preact/jsx-runtime";
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
return /* @__PURE__ */ jsxs("svg", {
|
|
15
|
-
viewBox: "0 0 24 24",
|
|
9
|
+
//#region src/components/icons/CloseIcon.tsx
|
|
10
|
+
function CloseIcon(props) {
|
|
11
|
+
return /* @__PURE__ */ jsx("svg", {
|
|
12
|
+
width: "15",
|
|
13
|
+
height: "15",
|
|
14
|
+
viewBox: "0 0 15 15",
|
|
16
15
|
fill: "none",
|
|
17
|
-
stroke: "currentColor",
|
|
18
|
-
"stroke-width": "1.5",
|
|
19
|
-
"stroke-linecap": "round",
|
|
20
|
-
"stroke-linejoin": "round",
|
|
21
16
|
"aria-hidden": "true",
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
height: "11",
|
|
28
|
-
rx: "1"
|
|
29
|
-
}),
|
|
30
|
-
/* @__PURE__ */ jsx("path", { d: "M12 11v11" }),
|
|
31
|
-
/* @__PURE__ */ jsx("rect", {
|
|
32
|
-
x: "5",
|
|
33
|
-
y: "7",
|
|
34
|
-
width: "14",
|
|
35
|
-
height: "4",
|
|
36
|
-
rx: "1"
|
|
37
|
-
}),
|
|
38
|
-
/* @__PURE__ */ jsx("path", { d: "M12 7c0 0-1.5-4-4.5-4S5 5 7.5 7" }),
|
|
39
|
-
/* @__PURE__ */ jsx("path", { d: "M12 7c0 0 1.5-4 4.5-4S19 5 16.5 7" })
|
|
40
|
-
]
|
|
17
|
+
...props,
|
|
18
|
+
children: /* @__PURE__ */ jsx("path", {
|
|
19
|
+
d: "M7.33301 0C11.383 0 14.6668 3.28307 14.667 7.33301C14.667 11.3831 11.3831 14.667 7.33301 14.667C3.28307 14.6668 0 11.383 0 7.33301C0.000175746 3.28318 3.28318 0.000175742 7.33301 0ZM10.3896 4.27734C10.151 4.0388 9.76303 4.03775 9.52441 4.27637L7.33301 6.46777L5.14258 4.27637C4.90397 4.03776 4.51601 4.03882 4.27734 4.27734C4.03869 4.516 4.03771 4.90392 4.27637 5.14258L6.4668 7.33398L4.27637 9.52441C4.03807 9.76306 4.03891 10.1511 4.27734 10.3896C4.51589 10.6282 4.9039 10.629 5.14258 10.3906L7.33301 8.2002L9.52344 10.3906C9.76198 10.629 10.15 10.6279 10.3887 10.3896C10.6273 10.151 10.6283 9.76209 10.3896 9.52344L8.2002 7.33398L10.3906 5.14258C10.6293 4.90392 10.6283 4.516 10.3896 4.27734Z",
|
|
20
|
+
fill: "currentColor"
|
|
21
|
+
})
|
|
41
22
|
});
|
|
42
23
|
}
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
24
|
+
//#endregion
|
|
25
|
+
//#region src/components/icons/ExternalLinkIcon.tsx
|
|
26
|
+
function ExternalLinkIcon(props) {
|
|
27
|
+
return /* @__PURE__ */ jsx("svg", {
|
|
28
|
+
width: "12",
|
|
29
|
+
height: "12",
|
|
30
|
+
viewBox: "0 0 12 12",
|
|
49
31
|
fill: "none",
|
|
50
|
-
stroke: "currentColor",
|
|
51
|
-
"stroke-width": "1.5",
|
|
52
|
-
"stroke-linecap": "round",
|
|
53
|
-
"stroke-linejoin": "round",
|
|
54
32
|
"aria-hidden": "true",
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
y1: "14",
|
|
61
|
-
x2: "21",
|
|
62
|
-
y2: "3"
|
|
63
|
-
})
|
|
64
|
-
]
|
|
33
|
+
...props,
|
|
34
|
+
children: /* @__PURE__ */ jsx("path", {
|
|
35
|
+
d: "M5.45508 0C5.75614 0.000209333 6 0.244788 6 0.545898C5.99979 0.846831 5.75601 1.09159 5.45508 1.0918H4.36426C3.05445 1.0918 2.27964 1.35707 1.81836 1.81836C1.35714 2.27966 1.0918 3.05454 1.0918 4.36426V7.63672C1.09186 8.94625 1.35713 9.72139 1.81836 10.1826C2.2797 10.6436 3.05488 10.9092 4.36426 10.9092H7.63672C8.94628 10.9091 9.72135 10.6438 10.1826 10.1826C10.6438 9.72139 10.9091 8.94625 10.9092 7.63672V6.5459C10.9092 6.24466 11.1538 6 11.4551 6C11.7561 6.00028 12 6.24483 12 6.5459V7.63672C11.9999 9.05391 11.72 10.1882 10.9541 10.9541C10.1882 11.7199 9.05394 12 7.63672 12H4.36426C2.94714 12 1.81283 11.7197 1.04688 10.9541C0.280997 10.1882 6.04321e-05 9.05391 0 7.63672V4.36426C0 2.94692 0.28099 1.81283 1.04688 1.04688C1.81284 0.280915 2.94686 0 4.36426 0H5.45508ZM11.4541 0C11.7553 2.20143e-05 11.999 0.244672 11.999 0.545898V3.16406C11.9988 3.46509 11.7552 3.70896 11.4541 3.70898C11.1532 3.70873 10.9084 3.46495 10.9082 3.16406V1.8623L6.93066 5.83984C6.71766 6.05283 6.37218 6.05283 6.15918 5.83984C5.94657 5.62681 5.94632 5.28124 6.15918 5.06836L10.1357 1.0918H8.83594C8.53504 1.09154 8.29025 0.846803 8.29004 0.545898C8.29004 0.244816 8.53491 0.000254588 8.83594 0H11.4541Z",
|
|
36
|
+
fill: "currentColor"
|
|
37
|
+
})
|
|
65
38
|
});
|
|
66
39
|
}
|
|
40
|
+
//#endregion
|
|
41
|
+
//#region src/components/icons/WarningIcon.tsx
|
|
42
|
+
function WarningIcon(props) {
|
|
43
|
+
return /* @__PURE__ */ jsx("svg", {
|
|
44
|
+
width: "16",
|
|
45
|
+
height: "16",
|
|
46
|
+
viewBox: "0 0 16 16",
|
|
47
|
+
fill: "none",
|
|
48
|
+
"aria-hidden": "true",
|
|
49
|
+
...props,
|
|
50
|
+
children: /* @__PURE__ */ jsx("path", {
|
|
51
|
+
d: "M8 0C12.4183 0 16 3.58172 16 8C16 12.4183 12.4183 16 8 16C3.58172 16 0 12.4183 0 8C0 3.58172 3.58172 0 8 0ZM8 1.5C4.41015 1.5 1.5 4.41015 1.5 8C1.5 11.5899 4.41015 14.5 8 14.5C11.5899 14.5 14.5 11.5899 14.5 8C14.5 4.41015 11.5899 1.5 8 1.5ZM8.10352 10.207C8.82025 10.2071 9.23531 10.6346 9.23535 11.3262C9.23535 12.0304 8.82028 12.4579 8.10352 12.458C7.36167 12.4579 6.97168 12.0304 6.97168 11.3262C6.97172 10.6346 7.36171 10.2072 8.10352 10.207ZM8.84766 3.54102C9.01311 3.54121 9.14736 3.67535 9.14746 3.84082V4.74805L8.84375 8.37012C8.83069 8.52552 8.6999 8.64551 8.54395 8.64551H7.62891C7.47133 8.64523 7.34074 8.52251 7.33008 8.36523L7.08496 4.74805V3.84082C7.08507 3.67533 7.2193 3.54119 7.38477 3.54102H8.84766Z",
|
|
52
|
+
fill: "currentColor"
|
|
53
|
+
})
|
|
54
|
+
});
|
|
55
|
+
}
|
|
56
|
+
//#endregion
|
|
57
|
+
//#region \0ve-inline:src/components/Banner/Banner.css.ts.vanilla.js
|
|
58
|
+
const cssSource$1 = `@keyframes Banner_fadeIn__1gnumzi0 {
|
|
59
|
+
from {
|
|
60
|
+
opacity: 0;
|
|
61
|
+
transform: translateY(-4px);
|
|
62
|
+
}
|
|
63
|
+
to {
|
|
64
|
+
opacity: 1;
|
|
65
|
+
transform: translateY(0);
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
.Banner_rootBase__1gnumzi1 {
|
|
69
|
+
position: relative;
|
|
70
|
+
display: flex;
|
|
71
|
+
animation: Banner_fadeIn__1gnumzi0 300ms ease-out;
|
|
72
|
+
}
|
|
73
|
+
.Banner_iconSvg__1gnumzi2 {
|
|
74
|
+
width: 100%;
|
|
75
|
+
height: 100%;
|
|
76
|
+
}
|
|
77
|
+
.Banner_referral__1gnumzi3 {
|
|
78
|
+
flex-direction: row;
|
|
79
|
+
align-items: center;
|
|
80
|
+
gap: 16px;
|
|
81
|
+
padding: 16px;
|
|
82
|
+
background-color: #ffffff;
|
|
83
|
+
color: var(--text-primary__pbq4ak0);
|
|
84
|
+
}
|
|
85
|
+
.Banner_referralIconWrapper__1gnumzi4 {
|
|
86
|
+
flex-shrink: 0;
|
|
87
|
+
align-self: flex-start;
|
|
88
|
+
width: 40px;
|
|
89
|
+
height: 40px;
|
|
90
|
+
}
|
|
91
|
+
.Banner_referralBody__1gnumzi5 {
|
|
92
|
+
flex: 1;
|
|
93
|
+
min-width: 0;
|
|
94
|
+
}
|
|
95
|
+
.Banner_referralTitle__1gnumzi6 {
|
|
96
|
+
font-size: 16px;
|
|
97
|
+
font-weight: 600;
|
|
98
|
+
color: var(--text-primary__pbq4ak0);
|
|
99
|
+
line-height: 22px;
|
|
100
|
+
}
|
|
101
|
+
.Banner_referralDescription__1gnumzi7 {
|
|
102
|
+
margin-bottom: 8px;
|
|
103
|
+
font-size: 14px;
|
|
104
|
+
color: #979797;
|
|
105
|
+
line-height: 22px;
|
|
106
|
+
}
|
|
107
|
+
.Banner_referralCta__1gnumzi8 {
|
|
108
|
+
display: inline-block;
|
|
109
|
+
padding: 8px 16px;
|
|
110
|
+
border: 1px solid #000000;
|
|
111
|
+
border-radius: 9999px;
|
|
112
|
+
color: var(--text-primary__pbq4ak0);
|
|
113
|
+
font-size: 10px;
|
|
114
|
+
font-weight: 700;
|
|
115
|
+
line-height: 12px;
|
|
116
|
+
text-transform: uppercase;
|
|
117
|
+
}
|
|
118
|
+
.Banner_referralCta__1gnumzi8:focus-visible {
|
|
119
|
+
outline: 2px solid #000000;
|
|
120
|
+
outline-offset: 2px;
|
|
121
|
+
}
|
|
122
|
+
.Banner_inapp__1gnumzi9 {
|
|
123
|
+
flex-direction: column;
|
|
124
|
+
gap: 4px;
|
|
125
|
+
padding: 12px 16px;
|
|
126
|
+
padding-right: 32px;
|
|
127
|
+
border-radius: 12px;
|
|
128
|
+
background-color: #000000CC;
|
|
129
|
+
backdrop-filter: blur(12px);
|
|
130
|
+
-webkit-backdrop-filter: blur(12px);
|
|
131
|
+
color: #ffffff;
|
|
132
|
+
}
|
|
133
|
+
.Banner_inappHeader__1gnumzia {
|
|
134
|
+
display: flex;
|
|
135
|
+
align-items: center;
|
|
136
|
+
gap: 8px;
|
|
137
|
+
}
|
|
138
|
+
.Banner_inappIconWrapper__1gnumzib {
|
|
139
|
+
flex-shrink: 0;
|
|
140
|
+
width: 20px;
|
|
141
|
+
height: 20px;
|
|
142
|
+
display: flex;
|
|
143
|
+
align-items: center;
|
|
144
|
+
justify-content: center;
|
|
145
|
+
color: #ffffff;
|
|
146
|
+
}
|
|
147
|
+
.Banner_inappTitle__1gnumzic {
|
|
148
|
+
font-size: 16px;
|
|
149
|
+
font-weight: 500;
|
|
150
|
+
line-height: 26px;
|
|
151
|
+
color: var(--text-onAction__pbq4ak6);
|
|
152
|
+
}
|
|
153
|
+
.Banner_inappDescription__1gnumzid {
|
|
154
|
+
font-size: 14px;
|
|
155
|
+
color: var(--text-onAction__pbq4ak6);
|
|
156
|
+
line-height: 22px;
|
|
157
|
+
opacity: 0.96;
|
|
158
|
+
}
|
|
159
|
+
.Banner_inappCta__1gnumzie {
|
|
160
|
+
display: inline-flex;
|
|
161
|
+
align-items: center;
|
|
162
|
+
gap: 4px;
|
|
163
|
+
color: #2BB2FF;
|
|
164
|
+
font-size: 14px;
|
|
165
|
+
font-weight: 600;
|
|
166
|
+
text-decoration: underline;
|
|
167
|
+
text-underline-offset: 2px;
|
|
168
|
+
}
|
|
169
|
+
.Banner_inappCta__1gnumzie:focus-visible {
|
|
170
|
+
outline: 2px solid #2BB2FF;
|
|
171
|
+
outline-offset: 2px;
|
|
172
|
+
border-radius: 4px;
|
|
173
|
+
}
|
|
174
|
+
.Banner_inappClose__1gnumzif {
|
|
175
|
+
position: absolute;
|
|
176
|
+
top: 8px;
|
|
177
|
+
right: 8px;
|
|
178
|
+
width: 28px;
|
|
179
|
+
height: 28px;
|
|
180
|
+
display: flex;
|
|
181
|
+
align-items: center;
|
|
182
|
+
justify-content: center;
|
|
183
|
+
border-radius: 9999px;
|
|
184
|
+
color: rgba(255, 255, 255, 0.6);
|
|
185
|
+
}
|
|
186
|
+
.Banner_inappClose__1gnumzif:focus-visible {
|
|
187
|
+
outline: 2px solid #ffffff;
|
|
188
|
+
outline-offset: 2px;
|
|
189
|
+
}`;
|
|
190
|
+
//#endregion
|
|
191
|
+
//#region src/components/Banner/Banner.css.ts
|
|
192
|
+
var iconSvg = "Banner_iconSvg__1gnumzi2";
|
|
193
|
+
var inapp = "Banner_inapp__1gnumzi9 reset_base__1831jhd0 Banner_rootBase__1gnumzi1";
|
|
194
|
+
var inappClose = "Banner_inappClose__1gnumzif reset_element_button__1831jhd6 reset_fieldAppearance__1831jhd2 reset_focusRing__1831jhd1";
|
|
195
|
+
var inappCta = "Banner_inappCta__1gnumzie reset_element_button__1831jhd6 reset_fieldAppearance__1831jhd2 reset_focusRing__1831jhd1";
|
|
196
|
+
var inappDescription = "Banner_inappDescription__1gnumzid reset_base__1831jhd0";
|
|
197
|
+
var inappHeader = "Banner_inappHeader__1gnumzia";
|
|
198
|
+
var inappIconWrapper = "Banner_inappIconWrapper__1gnumzib";
|
|
199
|
+
var inappTitle = "Banner_inappTitle__1gnumzic reset_base__1831jhd0";
|
|
200
|
+
var referral = "Banner_referral__1gnumzi3 reset_base__1831jhd0 Banner_rootBase__1gnumzi1";
|
|
201
|
+
var referralBody = "Banner_referralBody__1gnumzi5";
|
|
202
|
+
var referralCta = "Banner_referralCta__1gnumzi8 reset_element_button__1831jhd6 reset_fieldAppearance__1831jhd2 reset_focusRing__1831jhd1";
|
|
203
|
+
var referralDescription = "Banner_referralDescription__1gnumzi7 reset_base__1831jhd0";
|
|
204
|
+
var referralIconWrapper = "Banner_referralIconWrapper__1gnumzi4";
|
|
205
|
+
var referralTitle = "Banner_referralTitle__1gnumzi6 reset_base__1831jhd0";
|
|
206
|
+
const cssSource = cssSource$2 + cssSource$3 + cssSource$4 + cssSource$1;
|
|
207
|
+
//#endregion
|
|
208
|
+
//#region src/components/Banner/Banner.tsx
|
|
67
209
|
/**
|
|
68
210
|
* Auto-detecting notification banner component.
|
|
69
211
|
*
|
|
70
|
-
* Renders an inline banner on the merchant page
|
|
71
|
-
*
|
|
212
|
+
* Renders an inline banner on the merchant page with one of two distinct
|
|
213
|
+
* visual styles depending on the detected mode:
|
|
72
214
|
*
|
|
73
|
-
* - **Referral mode
|
|
74
|
-
* Displays reward
|
|
75
|
-
* - **In-app browser mode
|
|
76
|
-
* media in-app browser (Instagram, Facebook).
|
|
77
|
-
* default browser
|
|
215
|
+
* - **Referral mode** (white): Shown after a successful referral link
|
|
216
|
+
* processing. Displays a gift icon, reward copy, and a "Got it" CTA.
|
|
217
|
+
* - **In-app browser mode** (dark transparent): Shown when the page is
|
|
218
|
+
* opened inside a social media in-app browser (Instagram, Facebook).
|
|
219
|
+
* Offers an inline link to redirect to the default browser plus a
|
|
220
|
+
* close button to dismiss.
|
|
78
221
|
*
|
|
79
222
|
* In-app browser mode takes priority over referral mode.
|
|
80
|
-
* Uses Light DOM
|
|
223
|
+
* Uses Light DOM + vanilla-extract styles from `@frak-labs/design-system`.
|
|
81
224
|
*
|
|
82
225
|
* @group components
|
|
83
226
|
*
|
|
@@ -93,79 +236,143 @@ function BrowserIcon() {
|
|
|
93
236
|
* <frak-banner classname="my-custom-banner"></frak-banner>
|
|
94
237
|
* ```
|
|
95
238
|
*/
|
|
96
|
-
function Banner({ placement: placementId, classname = "", interaction }) {
|
|
239
|
+
function Banner({ placement: placementId, classname = "", interaction, referralTitle: propReferralTitle, referralDescription: propReferralDescription, referralCta: propReferralCta, inappTitle: propInappTitle, inappDescription: propInappDescription, inappCta: propInappCta, preview, previewMode }) {
|
|
240
|
+
const isPreview = !!preview;
|
|
241
|
+
const resolvedPreviewMode = previewMode === "inapp" ? "inapp" : "referral";
|
|
97
242
|
const placement = usePlacement(placementId);
|
|
98
243
|
const { shouldRender, isHidden, isClientReady } = useClientReady();
|
|
99
|
-
useLightDomStyles("frak-banner", placementId, placement?.components?.banner?.css,
|
|
244
|
+
useLightDomStyles("frak-banner", placementId, placement?.components?.banner?.css, cssSource);
|
|
100
245
|
const [dismissed, setDismissed] = useState(false);
|
|
101
|
-
const [mode, setMode] = useState(() =>
|
|
246
|
+
const [mode, setMode] = useState(() => {
|
|
247
|
+
if (isPreview) return resolvedPreviewMode;
|
|
248
|
+
return isInAppBrowser ? "inapp" : null;
|
|
249
|
+
});
|
|
250
|
+
useEffect(() => {
|
|
251
|
+
if (isPreview) setMode(resolvedPreviewMode);
|
|
252
|
+
}, [isPreview, resolvedPreviewMode]);
|
|
102
253
|
const { reward } = useReward(mode === "referral" && isClientReady, interaction);
|
|
103
254
|
useEffect(() => {
|
|
104
|
-
if (mode === "inapp") return;
|
|
255
|
+
if (isPreview || mode === "inapp") return;
|
|
105
256
|
const handler = () => setMode("referral");
|
|
106
257
|
window.addEventListener(REFERRAL_SUCCESS_EVENT, handler);
|
|
107
258
|
return () => window.removeEventListener(REFERRAL_SUCCESS_EVENT, handler);
|
|
108
|
-
}, [mode]);
|
|
259
|
+
}, [isPreview, mode]);
|
|
109
260
|
const handleAction = useCallback(() => {
|
|
261
|
+
if (isPreview) return;
|
|
110
262
|
if (mode === "referral") setDismissed(true);
|
|
111
263
|
else redirectToExternalBrowser(window.location.href);
|
|
112
|
-
}, [mode]);
|
|
264
|
+
}, [isPreview, mode]);
|
|
265
|
+
const handleDismiss = useCallback(() => {
|
|
266
|
+
if (isPreview) return;
|
|
267
|
+
setDismissed(true);
|
|
268
|
+
}, [isPreview]);
|
|
113
269
|
const bannerConfig = placement?.components?.banner;
|
|
114
270
|
const texts = useMemo(() => {
|
|
115
271
|
if (mode === "referral") {
|
|
116
272
|
const defaultTitle = reward ? `Earn ${reward} on purchases on this site` : "You've been referred!";
|
|
117
273
|
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"
|
|
274
|
+
title: propReferralTitle ?? bannerConfig?.referralTitle ?? defaultTitle,
|
|
275
|
+
description: propReferralDescription ?? bannerConfig?.referralDescription ?? "Earn rewards after your purchase via the Frak partner app.",
|
|
276
|
+
cta: propReferralCta ?? bannerConfig?.referralCta ?? "Got it"
|
|
121
277
|
};
|
|
122
278
|
}
|
|
123
279
|
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"
|
|
280
|
+
title: propInappTitle ?? bannerConfig?.inappTitle ?? "Open in your browser",
|
|
281
|
+
description: propInappDescription ?? bannerConfig?.inappDescription ?? "For a better experience and to earn your rewards, open this page in your default browser.",
|
|
282
|
+
cta: propInappCta ?? bannerConfig?.inappCta ?? "Open browser"
|
|
127
283
|
};
|
|
128
284
|
}, [
|
|
129
285
|
mode,
|
|
130
286
|
reward,
|
|
131
|
-
bannerConfig
|
|
287
|
+
bannerConfig,
|
|
288
|
+
propReferralTitle,
|
|
289
|
+
propReferralDescription,
|
|
290
|
+
propReferralCta,
|
|
291
|
+
propInappTitle,
|
|
292
|
+
propInappDescription,
|
|
293
|
+
propInappCta
|
|
132
294
|
]);
|
|
133
|
-
if (!shouldRender || isHidden || dismissed
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
295
|
+
if (!mode || !isPreview && (!shouldRender || isHidden || dismissed)) return null;
|
|
296
|
+
const bannerClass = [
|
|
297
|
+
mode === "inapp" ? inapp : referral,
|
|
298
|
+
"frak-banner",
|
|
299
|
+
`frak-banner--${mode}`,
|
|
300
|
+
classname
|
|
301
|
+
].filter(Boolean).join(" ");
|
|
302
|
+
if (mode === "inapp") return /* @__PURE__ */ jsxs("div", {
|
|
303
|
+
class: bannerClass,
|
|
140
304
|
role: "alert",
|
|
141
305
|
children: [
|
|
142
|
-
/* @__PURE__ */ jsx("div", {
|
|
143
|
-
class: "banner__icon",
|
|
144
|
-
children: mode === "referral" ? /* @__PURE__ */ jsx(RewardIcon, {}) : /* @__PURE__ */ jsx(BrowserIcon, {})
|
|
145
|
-
}),
|
|
146
306
|
/* @__PURE__ */ jsxs("div", {
|
|
147
|
-
class:
|
|
148
|
-
children: [/* @__PURE__ */ jsx("
|
|
149
|
-
class:
|
|
150
|
-
children:
|
|
307
|
+
class: inappHeader,
|
|
308
|
+
children: [/* @__PURE__ */ jsx("span", {
|
|
309
|
+
class: `${inappIconWrapper} frak-banner__icon`,
|
|
310
|
+
children: /* @__PURE__ */ jsx(WarningIcon, {})
|
|
151
311
|
}), /* @__PURE__ */ jsx("p", {
|
|
152
|
-
class:
|
|
153
|
-
children: texts.
|
|
312
|
+
class: `${inappTitle} frak-banner__title`,
|
|
313
|
+
children: texts.title
|
|
154
314
|
})]
|
|
155
315
|
}),
|
|
156
|
-
/* @__PURE__ */ jsx("
|
|
316
|
+
/* @__PURE__ */ jsx("p", {
|
|
317
|
+
class: `${inappDescription} frak-banner__description`,
|
|
318
|
+
children: texts.description
|
|
319
|
+
}),
|
|
320
|
+
/* @__PURE__ */ jsxs("button", {
|
|
157
321
|
type: "button",
|
|
158
|
-
class:
|
|
322
|
+
class: `${inappCta} frak-banner__cta`,
|
|
159
323
|
onClick: handleAction,
|
|
160
|
-
children: texts.cta
|
|
324
|
+
children: [texts.cta, /* @__PURE__ */ jsx(ExternalLinkIcon, {})]
|
|
325
|
+
}),
|
|
326
|
+
/* @__PURE__ */ jsx("button", {
|
|
327
|
+
type: "button",
|
|
328
|
+
class: `${inappClose} frak-banner__close`,
|
|
329
|
+
onClick: handleDismiss,
|
|
330
|
+
"aria-label": "Dismiss",
|
|
331
|
+
children: /* @__PURE__ */ jsx(CloseIcon, {})
|
|
161
332
|
})
|
|
162
333
|
]
|
|
163
334
|
});
|
|
335
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
336
|
+
class: bannerClass,
|
|
337
|
+
role: "alert",
|
|
338
|
+
children: [/* @__PURE__ */ jsx("div", {
|
|
339
|
+
class: `${referralIconWrapper} frak-banner__icon`,
|
|
340
|
+
children: /* @__PURE__ */ jsx(GiftIcon, { class: iconSvg })
|
|
341
|
+
}), /* @__PURE__ */ jsxs("div", {
|
|
342
|
+
class: `${referralBody} frak-banner__text`,
|
|
343
|
+
children: [
|
|
344
|
+
/* @__PURE__ */ jsx("p", {
|
|
345
|
+
class: `${referralTitle} frak-banner__title`,
|
|
346
|
+
children: texts.title
|
|
347
|
+
}),
|
|
348
|
+
/* @__PURE__ */ jsx("p", {
|
|
349
|
+
class: `${referralDescription} frak-banner__description`,
|
|
350
|
+
children: texts.description
|
|
351
|
+
}),
|
|
352
|
+
/* @__PURE__ */ jsx("button", {
|
|
353
|
+
type: "button",
|
|
354
|
+
class: `${referralCta} frak-banner__cta`,
|
|
355
|
+
onClick: handleAction,
|
|
356
|
+
children: texts.cta
|
|
357
|
+
})
|
|
358
|
+
]
|
|
359
|
+
})]
|
|
360
|
+
});
|
|
164
361
|
}
|
|
165
|
-
|
|
166
362
|
//#endregion
|
|
167
363
|
//#region src/components/Banner/index.ts
|
|
168
|
-
registerWebComponent(Banner, "frak-banner", [
|
|
169
|
-
|
|
364
|
+
registerWebComponent(Banner, "frak-banner", [
|
|
365
|
+
"placement",
|
|
366
|
+
"classname",
|
|
367
|
+
"interaction",
|
|
368
|
+
"referralTitle",
|
|
369
|
+
"referralDescription",
|
|
370
|
+
"referralCta",
|
|
371
|
+
"inappTitle",
|
|
372
|
+
"inappDescription",
|
|
373
|
+
"inappCta",
|
|
374
|
+
"preview",
|
|
375
|
+
"previewMode"
|
|
376
|
+
], { shadow: false });
|
|
170
377
|
//#endregion
|
|
171
|
-
export { Banner };
|
|
378
|
+
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
|
|
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 registerWebComponent, i as useClientReady, s as openEmbeddedWallet, t as usePlacement } from "./usePlacement-LqYjZLX_.js";
|
|
2
|
+
import { t as useLightDomStyles } from "./useLightDomStyles-Cjpf0MnX.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
|
/**
|