@frak-labs/components 1.0.3-beta.7dfd3480 → 1.0.3-beta.9d4f564a

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/dist/banner.d.ts DELETED
@@ -1,116 +0,0 @@
1
- import { InteractionTypeKey } from "@frak-labs/core-sdk";
2
- import * as _$preact from "preact";
3
-
4
- //#region src/components/Banner/types.d.ts
5
- /**
6
- * The props type for {@link Banner}.
7
- * @inline
8
- */
9
- type BannerProps = {
10
- /**
11
- * Placement ID for backend-driven CSS customization.
12
- */
13
- placement?: string;
14
- /**
15
- * CSS class names passed through to the root element (Light DOM).
16
- */
17
- classname?: string;
18
- /**
19
- * Filter rewards by interaction type (e.g. "purchase", "referral").
20
- * When omitted, the best reward across all interaction types is shown.
21
- */
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";
57
- };
58
- //#endregion
59
- //#region src/components/Banner/Banner.d.ts
60
- /**
61
- * Auto-detecting notification banner component.
62
- *
63
- * Renders an inline banner on the merchant page with one of two distinct
64
- * visual styles depending on the detected mode:
65
- *
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.
72
- *
73
- * In-app browser mode takes priority over referral mode.
74
- * Uses Light DOM + vanilla-extract styles from `@frak-labs/design-system`.
75
- *
76
- * @group components
77
- *
78
- * @example
79
- * Basic usage (auto-detects mode):
80
- * ```html
81
- * <frak-banner></frak-banner>
82
- * ```
83
- *
84
- * @example
85
- * With a custom class:
86
- * ```html
87
- * <frak-banner classname="my-custom-banner"></frak-banner>
88
- * ```
89
- */
90
- declare function Banner({
91
- placement: placementId,
92
- classname,
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;
103
- //#endregion
104
- //#region src/components/Banner/index.d.ts
105
- /**
106
- * Custom element interface for `<frak-banner>`.
107
- * Combines standard {@link HTMLElement} with {@link BannerProps}.
108
- */
109
- interface BannerElement extends HTMLElement, BannerProps {}
110
- declare global {
111
- interface HTMLElementTagNameMap {
112
- "frak-banner": BannerElement;
113
- }
114
- }
115
- //#endregion
116
- export { Banner, BannerElement };
package/dist/banner.js DELETED
@@ -1,466 +0,0 @@
1
- import { a as registerWebComponent, i as useClientReady, t as usePlacement } from "./usePlacement-V7NrKoub.js";
2
- import { t as useGlobalComponents } from "./useGlobalComponents-Cmfszr7v.js";
3
- import { t as useLightDomStyles } from "./useLightDomStyles-gbuSWvRx.js";
4
- import { t as useReward } from "./useReward-DU3_yP8Q.js";
5
- import { a as CloseCircleIcon, c as cssSource$5, i as ExternalLinkIcon, n as WarningIcon, o as cssSource$6, s as cssSource$4, t as GiftIcon } from "./GiftIcon-c28NnqJ7.js";
6
- import { isInAppBrowser, redirectToExternalBrowser, trackEvent } from "@frak-labs/core-sdk";
7
- import { REFERRAL_SUCCESS_EVENT, getMergeToken } from "@frak-labs/core-sdk/actions";
8
- import { useCallback, useEffect, useMemo, useRef, useState } from "preact/hooks";
9
- import { jsx, jsxs } from "preact/jsx-runtime";
10
- //#region \0ve-inline:../../packages/design-system/src/styles/inAppBanner.css.ts.vanilla.js
11
- const cssSource$3 = `@keyframes inAppBanner_fadeIn__1ibpiy70 {
12
- from {
13
- opacity: 0;
14
- transform: translateY(-4px);
15
- }
16
- to {
17
- opacity: 1;
18
- transform: translateY(0);
19
- }
20
- }
21
- .inAppBanner_container__1ibpiy71 {
22
- position: fixed;
23
- top: max(8px, env(safe-area-inset-top));
24
- left: 16px;
25
- right: 16px;
26
- z-index: 1000;
27
- display: flex;
28
- flex-direction: column;
29
- gap: 4px;
30
- padding: 12px 16px;
31
- padding-right: 32px;
32
- border-radius: 12px;
33
- background-color: #000000CC;
34
- backdrop-filter: blur(12px);
35
- -webkit-backdrop-filter: blur(12px);
36
- color: #ffffff;
37
- animation: inAppBanner_fadeIn__1ibpiy70 300ms ease-out;
38
- }
39
- .inAppBanner_header__1ibpiy72 {
40
- display: flex;
41
- align-items: center;
42
- gap: 8px;
43
- }
44
- .inAppBanner_iconWrapper__1ibpiy73 {
45
- flex-shrink: 0;
46
- width: 20px;
47
- height: 20px;
48
- display: flex;
49
- align-items: center;
50
- justify-content: center;
51
- color: #ffffff;
52
- }
53
- .inAppBanner_title__1ibpiy74 {
54
- margin: 0;
55
- padding: 0;
56
- font-size: 16px;
57
- font-weight: 500;
58
- line-height: 26px;
59
- color: var(--text-onAction__pbq4ak6);
60
- }
61
- .inAppBanner_body__1ibpiy75 {
62
- display: flex;
63
- flex-wrap: wrap;
64
- align-items: baseline;
65
- gap: 0 4px;
66
- }
67
- .inAppBanner_description__1ibpiy76 {
68
- margin: 0;
69
- padding: 0;
70
- font-size: 14px;
71
- color: var(--text-onAction__pbq4ak6);
72
- line-height: 22px;
73
- opacity: 0.96;
74
- }
75
- .inAppBanner_cta__1ibpiy77 {
76
- all: unset;
77
- display: inline-flex;
78
- align-items: center;
79
- gap: 4px;
80
- color: #2BB2FF;
81
- font-size: 14px;
82
- font-weight: 600;
83
- text-decoration: underline;
84
- text-underline-offset: 2px;
85
- cursor: pointer;
86
- }
87
- .inAppBanner_cta__1ibpiy77:focus-visible {
88
- outline: 2px solid #2BB2FF;
89
- outline-offset: 2px;
90
- border-radius: 4px;
91
- }
92
- .inAppBanner_closeButton__1ibpiy78 {
93
- all: unset;
94
- position: absolute;
95
- top: 8px;
96
- right: 8px;
97
- width: 28px;
98
- height: 28px;
99
- display: flex;
100
- align-items: center;
101
- justify-content: center;
102
- border-radius: 9999px;
103
- color: rgba(255, 255, 255, 0.6);
104
- cursor: pointer;
105
- }
106
- .inAppBanner_closeButton__1ibpiy78:focus-visible {
107
- outline: 2px solid #ffffff;
108
- outline-offset: 2px;
109
- }`;
110
- //#endregion
111
- //#region ../../packages/design-system/src/styles/inAppBanner.css.ts
112
- var body = "inAppBanner_body__1ibpiy75";
113
- var closeButton = "inAppBanner_closeButton__1ibpiy78";
114
- var container = "inAppBanner_container__1ibpiy71";
115
- var cta = "inAppBanner_cta__1ibpiy77";
116
- var description = "inAppBanner_description__1ibpiy76";
117
- var header = "inAppBanner_header__1ibpiy72";
118
- var iconWrapper = "inAppBanner_iconWrapper__1ibpiy73";
119
- var title = "inAppBanner_title__1ibpiy74";
120
- cssSource$4 + cssSource$3;
121
- //#endregion
122
- //#region ../../packages/design-system/src/components/InAppBanner/index.tsx
123
- function InAppBanner({ title: title$1, description: description$1, cta: cta$1, dismissLabel, onAction, onDismiss, className, classNames }) {
124
- return /* @__PURE__ */ jsxs("div", {
125
- className: `${container}${className ? ` ${className}` : ""}`,
126
- role: "alert",
127
- children: [
128
- /* @__PURE__ */ jsxs("div", {
129
- className: header,
130
- children: [/* @__PURE__ */ jsx("span", {
131
- className: `${iconWrapper}${classNames?.icon ? ` ${classNames.icon}` : ""}`,
132
- children: /* @__PURE__ */ jsx(WarningIcon, {
133
- width: 20,
134
- height: 20
135
- })
136
- }), /* @__PURE__ */ jsx("p", {
137
- className: `${title}${classNames?.title ? ` ${classNames.title}` : ""}`,
138
- children: title$1
139
- })]
140
- }),
141
- /* @__PURE__ */ jsxs("div", {
142
- className: body,
143
- children: [/* @__PURE__ */ jsx("p", {
144
- className: `${description}${classNames?.description ? ` ${classNames.description}` : ""}`,
145
- children: description$1
146
- }), /* @__PURE__ */ jsxs("button", {
147
- type: "button",
148
- className: `${cta}${classNames?.cta ? ` ${classNames.cta}` : ""}`,
149
- onClick: onAction,
150
- children: [cta$1, /* @__PURE__ */ jsx(ExternalLinkIcon, {
151
- width: 14,
152
- height: 14
153
- })]
154
- })]
155
- }),
156
- /* @__PURE__ */ jsx("button", {
157
- type: "button",
158
- className: `${closeButton}${classNames?.close ? ` ${classNames.close}` : ""}`,
159
- onClick: onDismiss,
160
- "aria-label": dismissLabel,
161
- children: /* @__PURE__ */ jsx(CloseCircleIcon, {
162
- width: 16,
163
- height: 16
164
- })
165
- })
166
- ]
167
- });
168
- }
169
- //#endregion
170
- //#region \0ve-inline:src/components/Banner/Banner.css.ts.vanilla.js
171
- const cssSource$1 = `@keyframes Banner_fadeIn__1gnumzi0 {
172
- from {
173
- opacity: 0;
174
- transform: translateY(-4px);
175
- }
176
- to {
177
- opacity: 1;
178
- transform: translateY(0);
179
- }
180
- }
181
- .Banner_rootBase__1gnumzi1 {
182
- position: relative;
183
- display: flex;
184
- animation: Banner_fadeIn__1gnumzi0 300ms ease-out;
185
- }
186
- .Banner_iconSvg__1gnumzi2 {
187
- width: 100%;
188
- height: 100%;
189
- }
190
- .Banner_referral__1gnumzi3 {
191
- flex-direction: row;
192
- align-items: center;
193
- gap: 16px;
194
- padding: 16px;
195
- background-color: #ffffff;
196
- color: var(--text-primary__pbq4ak0);
197
- border: 1px solid var(--border-default__pbq4akv);
198
- border-radius: 12px;
199
- }
200
- .Banner_referralIconWrapper__1gnumzi4 {
201
- flex-shrink: 0;
202
- align-self: flex-start;
203
- width: 40px;
204
- height: 40px;
205
- }
206
- .Banner_referralBody__1gnumzi5 {
207
- flex: 1;
208
- min-width: 0;
209
- }
210
- .Banner_referralTitle__1gnumzi6 {
211
- font-size: 16px;
212
- font-weight: 600;
213
- color: var(--text-primary__pbq4ak0);
214
- line-height: 22px;
215
- }
216
- .Banner_referralDescription__1gnumzi7 {
217
- margin-bottom: 8px;
218
- font-size: 14px;
219
- color: #979797;
220
- line-height: 22px;
221
- }
222
- .Banner_referralCta__1gnumzi8 {
223
- display: inline-block;
224
- padding: 8px 16px;
225
- border: 1px solid #000000;
226
- border-radius: 9999px;
227
- color: var(--text-primary__pbq4ak0);
228
- font-size: 10px;
229
- font-weight: 700;
230
- line-height: 12px;
231
- text-transform: uppercase;
232
- }
233
- .Banner_referralCta__1gnumzi8:focus-visible {
234
- outline: 2px solid #000000;
235
- outline-offset: 2px;
236
- }`;
237
- //#endregion
238
- //#region src/components/Banner/Banner.css.ts
239
- var iconSvg = "Banner_iconSvg__1gnumzi2";
240
- var referral = "Banner_referral__1gnumzi3 reset_base__1831jhd0 Banner_rootBase__1gnumzi1";
241
- var referralBody = "Banner_referralBody__1gnumzi5";
242
- var referralCta = "Banner_referralCta__1gnumzi8 reset_element_button__1831jhd6 reset_fieldAppearance__1831jhd2 reset_focusRing__1831jhd1";
243
- var referralDescription = "Banner_referralDescription__1gnumzi7 reset_base__1831jhd0";
244
- var referralIconWrapper = "Banner_referralIconWrapper__1gnumzi4";
245
- var referralTitle = "Banner_referralTitle__1gnumzi6 reset_base__1831jhd0";
246
- const cssSource = cssSource$5 + cssSource$4 + cssSource$6 + cssSource$3 + cssSource$1;
247
- //#endregion
248
- //#region src/components/Banner/Banner.tsx
249
- /**
250
- * Auto-detecting notification banner component.
251
- *
252
- * Renders an inline banner on the merchant page with one of two distinct
253
- * visual styles depending on the detected mode:
254
- *
255
- * - **Referral mode** (white): Shown after a successful referral link
256
- * processing. Displays a gift icon, reward copy, and a "Got it" CTA.
257
- * - **In-app browser mode** (dark transparent): Shown when the page is
258
- * opened inside a social media in-app browser (Instagram, Facebook).
259
- * Offers an inline link to redirect to the default browser plus a
260
- * close button to dismiss.
261
- *
262
- * In-app browser mode takes priority over referral mode.
263
- * Uses Light DOM + vanilla-extract styles from `@frak-labs/design-system`.
264
- *
265
- * @group components
266
- *
267
- * @example
268
- * Basic usage (auto-detects mode):
269
- * ```html
270
- * <frak-banner></frak-banner>
271
- * ```
272
- *
273
- * @example
274
- * With a custom class:
275
- * ```html
276
- * <frak-banner classname="my-custom-banner"></frak-banner>
277
- * ```
278
- */
279
- function Banner({ placement: placementId, classname = "", interaction, referralTitle: propReferralTitle, referralDescription: propReferralDescription, referralCta: propReferralCta, inappTitle: propInappTitle, inappDescription: propInappDescription, inappCta: propInappCta, preview, previewMode }) {
280
- const isPreview = !!preview;
281
- const resolvedPreviewMode = previewMode === "inapp" ? "inapp" : "referral";
282
- const placement = usePlacement(placementId);
283
- const { shouldRender, isHidden, isClientReady } = useClientReady();
284
- useLightDomStyles("frak-banner", placementId, placement?.components?.banner?.css, cssSource);
285
- const [dismissed, setDismissed] = useState(false);
286
- const [mode, setMode] = useState(() => {
287
- if (isPreview) return resolvedPreviewMode;
288
- return isInAppBrowser ? "inapp" : null;
289
- });
290
- const trackedImpressionModeRef = useRef(null);
291
- useEffect(() => {
292
- if (isPreview) setMode(resolvedPreviewMode);
293
- }, [isPreview, resolvedPreviewMode]);
294
- const { reward } = useReward(mode === "referral" && isClientReady, interaction);
295
- const [prefetchedMergeToken, setPrefetchedMergeToken] = useState(null);
296
- useEffect(() => {
297
- const client = window.FrakSetup?.client;
298
- if (mode !== "inapp" || isPreview || !isClientReady || !client) return;
299
- getMergeToken(client).then((token) => setPrefetchedMergeToken(token)).catch(() => {});
300
- }, [
301
- mode,
302
- isPreview,
303
- isClientReady
304
- ]);
305
- useEffect(() => {
306
- if (isPreview || !mode || dismissed) return;
307
- if (trackedImpressionModeRef.current === mode) return;
308
- if (!isClientReady) return;
309
- trackEvent(window.FrakSetup?.client, "banner_impression", {
310
- placement: placementId,
311
- variant: mode,
312
- has_reward: mode === "referral" ? Boolean(reward) : void 0
313
- });
314
- trackedImpressionModeRef.current = mode;
315
- }, [
316
- mode,
317
- dismissed,
318
- isClientReady,
319
- isPreview,
320
- placementId
321
- ]);
322
- useEffect(() => {
323
- if (isPreview || mode === "inapp") return;
324
- const handler = () => setMode("referral");
325
- window.addEventListener(REFERRAL_SUCCESS_EVENT, handler);
326
- return () => window.removeEventListener(REFERRAL_SUCCESS_EVENT, handler);
327
- }, [isPreview, mode]);
328
- const handleAction = useCallback(async () => {
329
- if (isPreview) return;
330
- trackEvent(window.FrakSetup?.client, "banner_resolved", {
331
- placement: placementId,
332
- variant: mode ?? "referral",
333
- outcome: "clicked"
334
- });
335
- if (mode === "referral") {
336
- setDismissed(true);
337
- return;
338
- }
339
- let mergeToken = prefetchedMergeToken;
340
- if (!mergeToken && window.FrakSetup?.client) try {
341
- mergeToken = await getMergeToken(window.FrakSetup?.client);
342
- } catch {}
343
- let targetUrl = window.location.href;
344
- if (mergeToken) {
345
- const url = new URL(targetUrl);
346
- url.searchParams.set("fmt", mergeToken);
347
- targetUrl = url.toString();
348
- }
349
- redirectToExternalBrowser(targetUrl);
350
- }, [
351
- isPreview,
352
- mode,
353
- prefetchedMergeToken,
354
- placementId
355
- ]);
356
- const handleDismiss = useCallback(() => {
357
- if (isPreview) return;
358
- trackEvent(window.FrakSetup?.client, "banner_resolved", {
359
- placement: placementId,
360
- variant: mode ?? "referral",
361
- outcome: "dismissed"
362
- });
363
- setDismissed(true);
364
- }, [
365
- isPreview,
366
- mode,
367
- placementId
368
- ]);
369
- const globalComponents = useGlobalComponents();
370
- const bannerConfig = placement?.components?.banner ?? globalComponents?.banner;
371
- const texts = useMemo(() => {
372
- if (mode === "referral") {
373
- const defaultTitle = reward ? `Earn ${reward} on purchases on this site` : "You've been referred!";
374
- return {
375
- title: propReferralTitle ?? bannerConfig?.referralTitle ?? defaultTitle,
376
- description: propReferralDescription ?? bannerConfig?.referralDescription ?? "Earn rewards after your purchase via the Frak partner app.",
377
- cta: propReferralCta ?? bannerConfig?.referralCta ?? "Got it"
378
- };
379
- }
380
- return {
381
- title: propInappTitle ?? bannerConfig?.inappTitle ?? "Open in your browser",
382
- description: propInappDescription ?? bannerConfig?.inappDescription ?? "For a better experience and to earn your rewards, open this page in your default browser.",
383
- cta: propInappCta ?? bannerConfig?.inappCta ?? "Open browser"
384
- };
385
- }, [
386
- mode,
387
- reward,
388
- bannerConfig,
389
- propReferralTitle,
390
- propReferralDescription,
391
- propReferralCta,
392
- propInappTitle,
393
- propInappDescription,
394
- propInappCta
395
- ]);
396
- if (!mode || !isPreview && (!shouldRender || isHidden || dismissed)) return null;
397
- const bannerClass = [
398
- referral,
399
- "frak-banner",
400
- `frak-banner--${mode}`,
401
- classname
402
- ].filter(Boolean).join(" ");
403
- if (mode === "inapp") return /* @__PURE__ */ jsx(InAppBanner, {
404
- title: texts.title,
405
- description: texts.description,
406
- cta: texts.cta,
407
- dismissLabel: "Dismiss",
408
- onAction: handleAction,
409
- onDismiss: handleDismiss,
410
- className: [
411
- "frak-banner",
412
- "frak-banner--inapp",
413
- classname
414
- ].filter(Boolean).join(" "),
415
- classNames: {
416
- icon: "frak-banner__icon",
417
- title: "frak-banner__title",
418
- description: "frak-banner__description",
419
- cta: "frak-banner__cta",
420
- close: "frak-banner__close"
421
- }
422
- });
423
- return /* @__PURE__ */ jsxs("div", {
424
- class: bannerClass,
425
- role: "alert",
426
- children: [/* @__PURE__ */ jsx("div", {
427
- class: `${referralIconWrapper} frak-banner__icon`,
428
- children: /* @__PURE__ */ jsx(GiftIcon, { class: iconSvg })
429
- }), /* @__PURE__ */ jsxs("div", {
430
- class: `${referralBody} frak-banner__text`,
431
- children: [
432
- /* @__PURE__ */ jsx("p", {
433
- class: `${referralTitle} frak-banner__title`,
434
- children: texts.title
435
- }),
436
- /* @__PURE__ */ jsx("p", {
437
- class: `${referralDescription} frak-banner__description`,
438
- children: texts.description
439
- }),
440
- /* @__PURE__ */ jsx("button", {
441
- type: "button",
442
- class: `${referralCta} frak-banner__cta`,
443
- onClick: handleAction,
444
- children: texts.cta
445
- })
446
- ]
447
- })]
448
- });
449
- }
450
- //#endregion
451
- //#region src/components/Banner/index.ts
452
- registerWebComponent(Banner, "frak-banner", [
453
- "placement",
454
- "classname",
455
- "interaction",
456
- "referralTitle",
457
- "referralDescription",
458
- "referralCta",
459
- "inappTitle",
460
- "inappDescription",
461
- "inappCta",
462
- "preview",
463
- "previewMode"
464
- ], { shadow: false });
465
- //#endregion
466
- export { Banner };
@@ -1,118 +0,0 @@
1
- import { InteractionTypeKey } from "@frak-labs/core-sdk";
2
- import * as _$preact from "preact";
3
-
4
- //#region src/components/ButtonShare/types.d.ts
5
- /**
6
- * The props type for {@link ButtonShare}.
7
- * @inline
8
- */
9
- type ButtonShareProps = {
10
- placement?: string;
11
- /**
12
- * Text to display on the button
13
- * - To specify where the reward should be displayed, use the placeholder `{REWARD}`, e.g. `Share and earn up to \{REWARD\}!`
14
- * @defaultValue `"Share and earn!"`
15
- */
16
- text?: string;
17
- /**
18
- * Classname to apply to the button
19
- */
20
- classname?: string;
21
- /**
22
- * Do we display the reward on the share modal?
23
- * @defaultValue `false`
24
- */
25
- useReward?: boolean;
26
- /**
27
- * Fallback text if the reward isn't found
28
- */
29
- noRewardText?: string;
30
- /**
31
- * Target interaction behind this sharing action (will be used to get the right reward to display)
32
- */
33
- targetInteraction?: InteractionTypeKey;
34
- /**
35
- * Which UI to open on click.
36
- *
37
- * Legacy values (e.g. `"share-modal"`) are accepted at runtime and
38
- * gracefully route to the full-page sharing UI — the modal-flow
39
- * share path was retired in favour of `displaySharingPage`.
40
- *
41
- * @defaultValue `"sharing-page"`
42
- */
43
- clickAction?: "embedded-wallet" | "sharing-page";
44
- /**
45
- * When set, renders the button in preview mode (e.g. Shopify/WP editor).
46
- * Skips the client-ready gating so the button is always enabled visually,
47
- * and no-ops the click handler so merchants can see the final layout with
48
- * their configured copy even when no Frak client is initialized.
49
- */
50
- preview?: string;
51
- };
52
- //#endregion
53
- //#region src/components/ButtonShare/ButtonShare.d.ts
54
- /**
55
- * Button to share the current page
56
- *
57
- * @param args
58
- * @returns The share button with `<button>` tag
59
- *
60
- * @group components
61
- *
62
- * @example
63
- * Basic usage:
64
- * ```html
65
- * <frak-button-share></frak-button-share>
66
- * ```
67
- *
68
- * @example
69
- * Using a custom text:
70
- * ```html
71
- * <frak-button-share text="Share and earn!"></frak-button-share>
72
- * ```
73
- *
74
- * @example
75
- * Using a custom class:
76
- * ```html
77
- * <frak-button-share classname="button button-primary"></frak-button-share>
78
- * ```
79
- *
80
- * @example
81
- * Using reward information and fallback text:
82
- * ```html
83
- * <frak-button-share use-reward text="Share and earn up to {REWARD}!" no-reward-text="Share and earn!"></frak-button-share>
84
- * ```
85
- *
86
- * @example
87
- * Using reward information for specific reward and fallback text:
88
- * ```html
89
- * <frak-button-share use-reward text="Share and earn up to {REWARD}!" no-reward-text="Share and earn!" target-interaction="custom.customerMeeting"></frak-button-share>
90
- * ```
91
- *
92
- * @see {@link @frak-labs/core-sdk!actions.displaySharingPage | `displaySharingPage()`} for more info about the sharing-page flow
93
- * @see {@link @frak-labs/core-sdk!actions.getMerchantInformation | `getMerchantInformation()`} for more info about the estimated reward fetching
94
- */
95
- declare function ButtonShare({
96
- placement: placementId,
97
- text,
98
- classname,
99
- useReward: rawUseReward,
100
- noRewardText,
101
- targetInteraction,
102
- clickAction: rawClickAction,
103
- preview
104
- }: ButtonShareProps): _$preact.JSX.Element | null;
105
- //#endregion
106
- //#region src/components/ButtonShare/index.d.ts
107
- /**
108
- * Custom element interface for `<frak-button-share>`.
109
- * Combines standard {@link HTMLElement} with {@link ButtonShareProps}.
110
- */
111
- interface ButtonShareElement extends HTMLElement, ButtonShareProps {}
112
- declare global {
113
- interface HTMLElementTagNameMap {
114
- "frak-button-share": ButtonShareElement;
115
- }
116
- }
117
- //#endregion
118
- export { ButtonShare, ButtonShareElement };