@frak-labs/components 1.3.3-beta.e9b6b7db → 1.3.3-beta.f058df07

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.
Files changed (46) hide show
  1. package/cdn/{Ambassador.BtZXbHrE.js → Ambassador.BqRaiquY.js} +2 -2
  2. package/cdn/Banner.8mqstDGK.js +208 -0
  3. package/cdn/ButtonShare.C7xLonci.js +1 -0
  4. package/cdn/ButtonWallet.CYf4UqML.js +40 -0
  5. package/cdn/{GiftIcon.NTATj1WE.js → GiftIcon.CW1SwrXH.js} +1 -1
  6. package/cdn/OpenInAppButton.Djz_cb9Y.js +1 -0
  7. package/cdn/PostPurchase.CxuZ9cs-.js +102 -0
  8. package/cdn/components.js +1 -1
  9. package/cdn/{jsxRuntime.module.C5UTjP_H.js → jsxRuntime.module.DWH-kRVd.js} +2 -2
  10. package/cdn/loader.js +14 -14
  11. package/cdn/useGlobalComponents.DVgSWfOp.js +1 -0
  12. package/cdn/useLightDomStyles.B72V1WPK.js +31 -0
  13. package/cdn/usePlacement.DEOEf5_6.js +1 -0
  14. package/cdn/useReward.g4cWDddX.js +1 -0
  15. package/dist/{GiftIcon-JVhSFEhP.js → GiftIcon-B9k_syq6.js} +6 -12
  16. package/dist/ambassador.d.ts +0 -6
  17. package/dist/ambassador.js +106 -33
  18. package/dist/banner.d.ts +0 -6
  19. package/dist/banner.js +20 -29
  20. package/dist/buttonShare.d.ts +0 -6
  21. package/dist/buttonShare.js +8 -10
  22. package/dist/buttonWallet.d.ts +0 -6
  23. package/dist/buttonWallet.js +7 -11
  24. package/dist/i18n/defaults.d.ts +0 -2
  25. package/dist/i18n/defaults.js +1 -2
  26. package/dist/openInApp.d.ts +0 -6
  27. package/dist/openInApp.js +7 -11
  28. package/dist/postPurchase.d.ts +0 -6
  29. package/dist/postPurchase.js +10 -13
  30. package/dist/{rewards-HJlTkTcY.js → rewards-CfGynCt6.js} +2 -4
  31. package/dist/{sharedBaseCss.css-BkMpQeRx.js → sharedBaseCss.css-nYy9vlzH.js} +1 -3
  32. package/dist/{sharedCss-CPNmnpXA.js → sharedCss-SKmJGZgN.js} +10 -20
  33. package/dist/{useGlobalComponents-B3s2UQFk.js → useGlobalComponents-BF47jsBt.js} +2 -3
  34. package/dist/{useLightDomStyles-BQ5FvCPi.js → useLightDomStyles-wGaNXHqN.js} +4 -6
  35. package/dist/{usePlacement-BpaIbzun.js → usePlacement-Dd7itnCf.js} +2 -3
  36. package/dist/{useReward-WmsNOFlz.js → useReward-DmukZKoh.js} +2 -3
  37. package/package.json +13 -13
  38. package/cdn/Banner.BaMe3Y_o.js +0 -208
  39. package/cdn/ButtonShare.DBG3qW4U.js +0 -1
  40. package/cdn/ButtonWallet.CibSy_fI.js +0 -40
  41. package/cdn/OpenInAppButton.Dv7oAwl1.js +0 -1
  42. package/cdn/PostPurchase.4VD_vKnI.js +0 -102
  43. package/cdn/useGlobalComponents.DoG1wfeq.js +0 -1
  44. package/cdn/useLightDomStyles.B0_CS0Kq.js +0 -1
  45. package/cdn/usePlacement.B5JX9OU-.js +0 -1
  46. package/cdn/useReward.Cl4hkDZp.js +0 -1
@@ -1,7 +1,7 @@
1
1
  import "preact/hooks";
2
2
  import { jsx, jsxs } from "preact/jsx-runtime";
3
3
  import { Component, Fragment as Fragment$1, createElement, options, toChildArray } from "preact";
4
- //#region ../../node_modules/.bun/preact@10.29.8/node_modules/preact/compat/dist/compat.module.js
4
+ // ../../node_modules/.bun/preact@10.29.8/node_modules/preact/compat/dist/compat.module.js
5
5
  function g(n, t) {
6
6
  for (var e in t) n[e] = t[e];
7
7
  return n;
@@ -188,8 +188,7 @@ options.diffed = function(n) {
188
188
  var t = n.props, e = n.__e;
189
189
  null != e && "textarea" === n.type && "value" in t && t.value !== e.value && (e.value = null == t.value ? "" : t.value);
190
190
  };
191
- //#endregion
192
- //#region ../../packages/design-system/src/icons/CloseCircleIcon.tsx
191
+ // ../../packages/design-system/src/icons/CloseCircleIcon.tsx
193
192
  function CloseCircleIcon(props) {
194
193
  return /* @__PURE__ */ jsx("svg", {
195
194
  width: "15",
@@ -204,8 +203,7 @@ function CloseCircleIcon(props) {
204
203
  })
205
204
  });
206
205
  }
207
- //#endregion
208
- //#region ../../packages/design-system/src/icons/ExternalLinkIcon.tsx
206
+ // ../../packages/design-system/src/icons/ExternalLinkIcon.tsx
209
207
  function ExternalLinkIcon(props) {
210
208
  return /* @__PURE__ */ jsx("svg", {
211
209
  width: "12",
@@ -220,8 +218,7 @@ function ExternalLinkIcon(props) {
220
218
  })
221
219
  });
222
220
  }
223
- //#endregion
224
- //#region ../../packages/design-system/src/icons/LogoFrakWithName.tsx
221
+ // ../../packages/design-system/src/icons/LogoFrakWithName.tsx
225
222
  /**
226
223
  * Frak wordmark — blue rounded-square badge with the white F glyph,
227
224
  * followed by the "frak" text.
@@ -259,8 +256,7 @@ function LogoFrakWithName(props) {
259
256
  ]
260
257
  });
261
258
  }
262
- //#endregion
263
- //#region ../../packages/design-system/src/icons/WarningIcon.tsx
259
+ // ../../packages/design-system/src/icons/WarningIcon.tsx
264
260
  function WarningIcon(props) {
265
261
  return /* @__PURE__ */ jsx("svg", {
266
262
  width: "16",
@@ -275,8 +271,7 @@ function WarningIcon(props) {
275
271
  })
276
272
  });
277
273
  }
278
- //#endregion
279
- //#region src/components/icons/GiftIcon.tsx
274
+ // src/components/icons/GiftIcon.tsx
280
275
  /**
281
276
  * Gift icon with yellow accent circle and present box.
282
277
  * Used by the referral banner and the post-purchase card.
@@ -336,5 +331,4 @@ function GiftIcon(props) {
336
331
  ]
337
332
  });
338
333
  }
339
- //#endregion
340
334
  export { CloseCircleIcon as a, ExternalLinkIcon as i, WarningIcon as n, LogoFrakWithName as r, GiftIcon as t };
@@ -1,4 +1,3 @@
1
- //#region src/components/Ambassador/types.d.ts
2
1
  /**
3
2
  * Props for the {@link Ambassador} component.
4
3
  * @inline
@@ -139,8 +138,6 @@ type AmbassadorProps = {
139
138
  /** Override the attribution anchor's text. */
140
139
  attributionLinkText?: string;
141
140
  };
142
- //#endregion
143
- //#region src/components/Ambassador/Ambassador.d.ts
144
141
  /**
145
142
  * Full-page ambassador: hero, reward, explainer, win-win, referral, store, FAQ;
146
143
  * `isHidden` alone suppresses it. Theme it with the twenty-two `--frak-amb-*`
@@ -150,8 +147,6 @@ type AmbassadorProps = {
150
147
  * @example `<frak-ambassador></frak-ambassador>`
151
148
  */
152
149
  export declare function Ambassador(props: AmbassadorProps): import("preact").JSX.Element;
153
- //#endregion
154
- //#region src/components/Ambassador/index.d.ts
155
150
  /**
156
151
  * Custom element interface for `<frak-ambassador>`.
157
152
  * Combines standard {@link HTMLElement} with {@link AmbassadorProps}.
@@ -162,5 +157,4 @@ declare global {
162
157
  "frak-ambassador": AmbassadorElement;
163
158
  }
164
159
  }
165
- //#endregion
166
160
  export {};
@@ -1,15 +1,15 @@
1
- import { a as useClientReady, o as registerWebComponent, r as useLang, s as openSharingPage } from "./sharedCss-CPNmnpXA.js";
2
- import { i as w } from "./rewards-HJlTkTcY.js";
3
- import { t as useGlobalComponents } from "./useGlobalComponents-B3s2UQFk.js";
4
- import { t as useLightDomStyles } from "./useLightDomStyles-BQ5FvCPi.js";
5
- import { t as useReward } from "./useReward-WmsNOFlz.js";
1
+ import { a as useClientReady, o as registerWebComponent, r as useLang, s as openSharingPage } from "./sharedCss-SKmJGZgN.js";
2
+ import { i as w } from "./rewards-CfGynCt6.js";
3
+ import { t as useGlobalComponents } from "./useGlobalComponents-BF47jsBt.js";
4
+ import { t as useLightDomStyles } from "./useLightDomStyles-wGaNXHqN.js";
5
+ import { t as useReward } from "./useReward-DmukZKoh.js";
6
6
  import { componentDefaults } from "./i18n/defaults.js";
7
- import { t as cssSource$2 } from "./sharedBaseCss.css-BkMpQeRx.js";
7
+ import { t as cssSource$2 } from "./sharedBaseCss.css-nYy9vlzH.js";
8
8
  import { trackEvent } from "@frak-labs/core-sdk";
9
9
  import { getInstallUrl } from "@frak-labs/core-sdk/actions";
10
- import { useCallback, useEffect, useMemo, useRef, useState } from "preact/hooks";
10
+ import { useCallback, useEffect, useLayoutEffect, useMemo, useRef, useState } from "preact/hooks";
11
11
  import { Fragment, jsx, jsxs } from "preact/jsx-runtime";
12
- //#region src/hooks/useHostTheme.ts
12
+ // src/hooks/useHostTheme.ts
13
13
  const QUIET_BORDER_DISTANCE = 120;
14
14
  const FLAT_FILL_DISTANCE = 30;
15
15
  const READABLE_CONTRAST = 3;
@@ -17,6 +17,9 @@ const VISIBLE_CONTRAST = 1.5;
17
17
  const VISIBLE_DISTANCE = 60;
18
18
  const DEFAULT_ACCENT = "rgb(17, 17, 17)";
19
19
  const DEFAULT_TAG_BG = "rgb(255, 255, 255)";
20
+ const WHITE = "rgb(255, 255, 255)";
21
+ const BLACK = "rgb(0, 0, 0)";
22
+ const HEX_COLOR = /^#[0-9a-f]{6}$/i;
20
23
  const TAG_TINT = .08;
21
24
  const RESET_HEADING_RATIO = 1.25;
22
25
  const WIDGET_WORDS = /cookie|consent|newsletter|popup|modal|sr-only|visually-hidden|skip-to/i;
@@ -35,6 +38,11 @@ const FONT_KNOBS = [
35
38
  "h2-family",
36
39
  "h2-transform"
37
40
  ];
41
+ const ACCENT_KNOBS = [
42
+ "accent",
43
+ "accent-ink",
44
+ "accent-text"
45
+ ];
38
46
  const REFERENCE_HEADINGS = "[data-frak-amb-ref]";
39
47
  function alphaOf(value) {
40
48
  const slash = /\/\s*([\d.]+)(%?)\s*\)/.exec(value);
@@ -265,7 +273,8 @@ function knobsFrom(source) {
265
273
  ...typographyOf(source.button, "cta", source.buttonBg, false)
266
274
  ];
267
275
  if (source.radius) knobs.push(["radius", source.radius]);
268
- knobs.push(...accentKnobs(source), ...tagKnobs(source));
276
+ knobs.push(...accentKnobs(source));
277
+ knobs.push(...tagKnobs(source));
269
278
  if (source.button) {
270
279
  const from = getComputedStyle(source.button);
271
280
  knobs.push(["cta-radius", from.borderRadius.split(" ")[0]], ["cta-transform", from.textTransform]);
@@ -275,16 +284,62 @@ function knobsFrom(source) {
275
284
  function knobsSignature(knobs) {
276
285
  return knobs.map(([name, value]) => `${name}=${value}`).sort().join("|");
277
286
  }
278
- function writeKnobs(anchor, knobs) {
287
+ /** The `--frak-amb-*` knobs among `names` that already resolve on the anchor: the merchant's own. */
288
+ function merchantKnobs(anchor, names) {
279
289
  const current = getComputedStyle(anchor);
280
- const merchantSet = new Set(knobs.map(([name]) => name).filter((name) => current.getPropertyValue(`--frak-amb-${name}`).trim()));
290
+ return new Set(names.filter((name) => current.getPropertyValue(`--frak-amb-${name}`).trim()));
291
+ }
292
+ function writeKnobs(anchor, knobs) {
293
+ const merchantSet = merchantKnobs(anchor, knobs.map(([name]) => name));
294
+ const written = [];
281
295
  for (const [name, value] of knobs) {
282
296
  if (!value || isTransparent(value)) continue;
283
297
  if (merchantSet.has(name)) continue;
284
298
  if (name === "accent-text" && merchantSet.has("accent")) continue;
285
299
  anchor.style.setProperty(`--frak-amb-${name}`, value);
300
+ written.push(name);
286
301
  }
287
302
  markFontKnobs(anchor);
303
+ return written;
304
+ }
305
+ function rgbFromHex(hex) {
306
+ const channel = (at) => Number.parseInt(hex.slice(at, at + 2), 16);
307
+ return `rgb(${channel(1)}, ${channel(3)}, ${channel(5)})`;
308
+ }
309
+ /**
310
+ * The dashboard accent, its ink and the figures' text. A light accent on a
311
+ * light page (or a dark one on a dark page) sends the text to the page's own
312
+ * colour, the same rule the sampled accent follows.
313
+ */
314
+ function dashboardKnobs(anchor, hex) {
315
+ const fill = rgbFromHex(hex);
316
+ const ink = contrastRatio(fill, WHITE) >= contrastRatio(fill, BLACK) ? "#fff" : "#000";
317
+ const knobs = [["accent", hex], ["accent-ink", ink]];
318
+ if (!(contrastRatio(fill, backdropOf(anchor)) >= READABLE_CONTRAST)) knobs.push(["accent-text", "currentColor"]);
319
+ return knobs;
320
+ }
321
+ /**
322
+ * Writes the dashboard accent synchronously, so it neither waits for the
323
+ * sampler nor depends on it. A merchant's CSS accent takes it over entirely.
324
+ */
325
+ function writeDashboardAccent(anchor, hex) {
326
+ if (!HEX_COLOR.test(hex)) return [];
327
+ const knobs = dashboardKnobs(anchor, hex);
328
+ const merchantSet = merchantKnobs(anchor, knobs.map(([name]) => name));
329
+ if (merchantSet.has("accent")) return [];
330
+ const written = [];
331
+ for (const [name, value] of knobs) {
332
+ if (merchantSet.has(name)) continue;
333
+ anchor.style.setProperty(`--frak-amb-${name}`, value);
334
+ written.push(name);
335
+ }
336
+ return written;
337
+ }
338
+ /** The one place that decides who owns the accent: the dashboard, else the sample. */
339
+ function writeAccent(anchor, dashboardHex, sampled) {
340
+ const dashboard = dashboardHex ? writeDashboardAccent(anchor, dashboardHex) : [];
341
+ if (dashboard.includes("accent")) return dashboard;
342
+ return sampled ? writeKnobs(anchor, sampled) : [];
288
343
  }
289
344
  /**
290
345
  * Heading font rules apply only behind this attribute: an unset `var()` in
@@ -305,31 +360,54 @@ async function settled() {
305
360
  if (document.fonts?.ready) await document.fonts.ready;
306
361
  await nextFrame();
307
362
  }
308
- function useHostTheme(target) {
363
+ /**
364
+ * Themes the page from the host. `accentColor` (the dashboard setting) outranks
365
+ * the sampled button colour; the merchant's own `--frak-amb-accent` outranks both.
366
+ */
367
+ function useHostTheme(target, accentColor) {
368
+ const [sampledAccent, setSampledAccent] = useState();
309
369
  useEffect(() => {
310
370
  let cancelled = false;
371
+ const anchor = target.current;
372
+ const written = [];
311
373
  const run = async () => {
312
374
  try {
313
375
  await settled();
314
376
  if (cancelled) return;
315
- const anchor = target.current;
316
- if (!anchor) return;
317
- const first = knobsFrom(sampleTheme(anchor));
377
+ const current = target.current;
378
+ if (!current) return;
379
+ const first = knobsFrom(sampleTheme(current));
318
380
  await nextFrame();
319
381
  if (cancelled) return;
320
- const second = knobsFrom(sampleTheme(anchor));
382
+ const second = knobsFrom(sampleTheme(current));
321
383
  if (knobsSignature(first) !== knobsSignature(second)) return;
322
- writeKnobs(anchor, first);
384
+ const isAccent = ([name]) => ACCENT_KNOBS.includes(name);
385
+ written.push(...writeKnobs(current, first.filter((k) => !isAccent(k))));
386
+ setSampledAccent(first.filter(isAccent));
323
387
  } catch {}
324
388
  };
325
389
  run();
326
390
  return () => {
327
391
  cancelled = true;
392
+ if (!anchor) return;
393
+ for (const name of written) anchor.style.removeProperty(`--frak-amb-${name}`);
394
+ markFontKnobs(anchor);
328
395
  };
329
396
  }, [target]);
397
+ useLayoutEffect(() => {
398
+ const anchor = target.current;
399
+ if (!anchor) return;
400
+ const written = writeAccent(anchor, accentColor, sampledAccent);
401
+ return () => {
402
+ for (const name of written) anchor.style.removeProperty(`--frak-amb-${name}`);
403
+ };
404
+ }, [
405
+ target,
406
+ accentColor,
407
+ sampledAccent
408
+ ]);
330
409
  }
331
- //#endregion
332
- //#region \0ve-inline:src/components/Ambassador/Ambassador.css.ts.vanilla.js
410
+ // \0ve-inline:src/components/Ambassador/Ambassador.css.ts.vanilla.js
333
411
  const cssSource$1 = `.Ambassador_panel__awpcg00 {
334
412
  background-color: var(--frak-amb-surface, #1111110a);
335
413
  border: 1px solid var(--frak-amb-border, #11111126);
@@ -722,8 +800,7 @@ const cssSource$1 = `.Ambassador_panel__awpcg00 {
722
800
  }
723
801
  }
724
802
  `;
725
- //#endregion
726
- //#region src/components/Ambassador/Ambassador.css.ts
803
+ // src/components/Ambassador/Ambassador.css.ts
727
804
  var amountUnit = "Ambassador_amountUnit__awpcg0a";
728
805
  var amountWords = "Ambassador_amountWords__awpcg0b";
729
806
  var faq = "Ambassador_region__awpcg03";
@@ -789,8 +866,7 @@ var winWinCards = "Ambassador_winWinCards__awpcg0v";
789
866
  var winWinLede = "Ambassador_lede__awpcg06";
790
867
  var winWinTitle = "Ambassador_regionTitle__awpcg05";
791
868
  const cssSource = cssSource$1;
792
- //#endregion
793
- //#region src/components/Ambassador/InstallQr.tsx
869
+ // src/components/Ambassador/InstallQr.tsx
794
870
  const WIDE_QUERY = "(min-width: 768px)";
795
871
  const QUIET_ZONE = 4;
796
872
  const ECC = "low";
@@ -857,8 +933,7 @@ function modulesPath(grid) {
857
933
  }
858
934
  return path;
859
935
  }
860
- //#endregion
861
- //#region src/components/Ambassador/storeBadges.tsx
936
+ // src/components/Ambassador/storeBadges.tsx
862
937
  function AppStoreBadgeArtFr(props) {
863
938
  return /* @__PURE__ */ jsx("svg", {
864
939
  "aria-hidden": "true",
@@ -1113,8 +1188,7 @@ function PlayStoreBadgeArt({ lang, ...props }) {
1113
1188
  ...props
1114
1189
  });
1115
1190
  }
1116
- //#endregion
1117
- //#region src/components/Ambassador/Ambassador.tsx
1191
+ // src/components/Ambassador/Ambassador.tsx
1118
1192
  const FRAK_URL = "https://frak.id";
1119
1193
  /**
1120
1194
  * SDK config name first, then `og:site_name`, then the bare hostname with a
@@ -1230,16 +1304,17 @@ function Ambassador(props) {
1230
1304
  const dashboard = useGlobalComponents()?.ambassador;
1231
1305
  const merged = {
1232
1306
  ...props,
1233
- faq5Answer: dashboard?.faq5Answer
1307
+ faq5Answer: dashboard?.faq5Answer,
1308
+ accentColor: dashboard?.accentColor
1234
1309
  };
1235
1310
  for (const field of DASHBOARD_FIELDS) merged[field] = props[field] ?? dashboard?.[field];
1236
1311
  return /* @__PURE__ */ jsx(AmbassadorPage, { ...merged });
1237
1312
  }
1238
- function AmbassadorPage({ merchantId: propMerchantId, classname = "", heroTitle: propHeroTitle, heroEyebrow: propHeroEyebrow, heroLede: propHeroLede, heroCtaLabel: propHeroCtaLabel, heroFacesCaption: propHeroFacesCaption, heroImageUrl, heroImageAlt: propHeroImageAlt, heroRewardCaption: propHeroRewardCaption, heroRewardRefereePill: propHeroRewardRefereePill, rewardEyebrow: propRewardEyebrow, rewardHeading: propRewardHeading, rewardEstimateCaption: propRewardEstimateCaption, rewardLede: propRewardLede, rewardCtaLabel: propRewardCtaLabel, rewardFooterCaption: propRewardFooterCaption, rewardNoBankDetails: propRewardNoBankDetails, rewardFallbackLabel: propRewardFallbackLabel, explainerTitle: propExplainerTitle, explainerLede: propExplainerLede, step1Title: propStep1Title, step1Description: propStep1Description, step1ImageUrl, step1ImageAlt: propStep1ImageAlt, step2Title: propStep2Title, step2Description: propStep2Description, step2ImageUrl, step2ImageAlt: propStep2ImageAlt, step3Title: propStep3Title, step3Description: propStep3Description, step3ImageUrl, step3ImageAlt: propStep3ImageAlt, winWinHeading: propWinWinHeading, winWinLede: propWinWinLede, winWinCard1Title: propWinWinCard1Title, winWinCard1Description: propWinWinCard1Description, winWinCard2Title: propWinWinCard2Title, winWinCard2Description: propWinWinCard2Description, referralHeading: propReferralHeading, referralLede: propReferralLede, referralCtaLabel: propReferralCtaLabel, storeHeading: propStoreHeading, storeLede: propStoreLede, storeAppBadgeAriaLabel: propStoreAppBadgeAriaLabel, storePlayBadgeAriaLabel: propStorePlayBadgeAriaLabel, storeQrLabel: propStoreQrLabel, storeQrCaption: propStoreQrCaption, faqHeading: propFaqHeading, faq1Question: propFaq1Question, faq1Answer: propFaq1Answer, faq2Question: propFaq2Question, faq2Answer: propFaq2Answer, faq3Question: propFaq3Question, faq3Answer: propFaq3Answer, faq4Question: propFaq4Question, faq4Answer: propFaq4Answer, faq5Question: propFaq5Question, faq5AnswerBeforeLink: propFaq5AnswerBeforeLink, faq5AnswerLinkText: propFaq5AnswerLinkText, faq5AnswerAfterLink: propFaq5AnswerAfterLink, attributionBeforeLink: propAttributionBeforeLink, attributionLinkText: propAttributionLinkText, faq5Answer: dashboardFaq5Answer }) {
1313
+ function AmbassadorPage({ merchantId: propMerchantId, classname = "", heroTitle: propHeroTitle, heroEyebrow: propHeroEyebrow, heroLede: propHeroLede, heroCtaLabel: propHeroCtaLabel, heroFacesCaption: propHeroFacesCaption, heroImageUrl, heroImageAlt: propHeroImageAlt, heroRewardCaption: propHeroRewardCaption, heroRewardRefereePill: propHeroRewardRefereePill, rewardEyebrow: propRewardEyebrow, rewardHeading: propRewardHeading, rewardEstimateCaption: propRewardEstimateCaption, rewardLede: propRewardLede, rewardCtaLabel: propRewardCtaLabel, rewardFooterCaption: propRewardFooterCaption, rewardNoBankDetails: propRewardNoBankDetails, rewardFallbackLabel: propRewardFallbackLabel, explainerTitle: propExplainerTitle, explainerLede: propExplainerLede, step1Title: propStep1Title, step1Description: propStep1Description, step1ImageUrl, step1ImageAlt: propStep1ImageAlt, step2Title: propStep2Title, step2Description: propStep2Description, step2ImageUrl, step2ImageAlt: propStep2ImageAlt, step3Title: propStep3Title, step3Description: propStep3Description, step3ImageUrl, step3ImageAlt: propStep3ImageAlt, winWinHeading: propWinWinHeading, winWinLede: propWinWinLede, winWinCard1Title: propWinWinCard1Title, winWinCard1Description: propWinWinCard1Description, winWinCard2Title: propWinWinCard2Title, winWinCard2Description: propWinWinCard2Description, referralHeading: propReferralHeading, referralLede: propReferralLede, referralCtaLabel: propReferralCtaLabel, storeHeading: propStoreHeading, storeLede: propStoreLede, storeAppBadgeAriaLabel: propStoreAppBadgeAriaLabel, storePlayBadgeAriaLabel: propStorePlayBadgeAriaLabel, storeQrLabel: propStoreQrLabel, storeQrCaption: propStoreQrCaption, faqHeading: propFaqHeading, faq1Question: propFaq1Question, faq1Answer: propFaq1Answer, faq2Question: propFaq2Question, faq2Answer: propFaq2Answer, faq3Question: propFaq3Question, faq3Answer: propFaq3Answer, faq4Question: propFaq4Question, faq4Answer: propFaq4Answer, faq5Question: propFaq5Question, faq5AnswerBeforeLink: propFaq5AnswerBeforeLink, faq5AnswerLinkText: propFaq5AnswerLinkText, faq5AnswerAfterLink: propFaq5AnswerAfterLink, attributionBeforeLink: propAttributionBeforeLink, attributionLinkText: propAttributionLinkText, faq5Answer: dashboardFaq5Answer, accentColor }) {
1239
1314
  const { shouldRender, isHidden, isClientReady } = useClientReady();
1240
1315
  const lang = useLang();
1241
1316
  const rootRef = useRef(null);
1242
- useHostTheme(rootRef);
1317
+ useHostTheme(rootRef, isHidden ? void 0 : accentColor);
1243
1318
  useLightDomStyles("frak-ambassador", void 0, void 0, cssSource, cssSource$2);
1244
1319
  const { reward: reward$1 } = useReward(isClientReady, void 0, "referrer");
1245
1320
  const { reward: refereeReward, hasReward: hasRefereeReward } = useReward(isClientReady, void 0, "referee");
@@ -1743,8 +1818,7 @@ function AmbassadorPage({ merchantId: propMerchantId, classname = "", heroTitle:
1743
1818
  ]
1744
1819
  });
1745
1820
  }
1746
- //#endregion
1747
- //#region src/components/Ambassador/index.ts
1821
+ // src/components/Ambassador/index.ts
1748
1822
  registerWebComponent(Ambassador, "frak-ambassador", [...[
1749
1823
  "merchantId",
1750
1824
  "classname",
@@ -1810,5 +1884,4 @@ registerWebComponent(Ambassador, "frak-ambassador", [...[
1810
1884
  "attributionBeforeLink",
1811
1885
  "attributionLinkText"
1812
1886
  ]], { shadow: false });
1813
- //#endregion
1814
1887
  export { Ambassador };
package/dist/banner.d.ts CHANGED
@@ -1,5 +1,4 @@
1
1
  import { InteractionTypeKey, ProductDetails } from "@frak-labs/core-sdk";
2
- //#region src/components/Banner/types.d.ts
3
2
  /**
4
3
  * The props type for {@link Banner}.
5
4
  * @inline
@@ -83,8 +82,6 @@ type BannerProps = {
83
82
  */
84
83
  allowInappRedirect?: boolean | "true" | "false";
85
84
  };
86
- //#endregion
87
- //#region src/components/Banner/Banner.d.ts
88
85
  /**
89
86
  * Auto-detecting notification banner component.
90
87
  *
@@ -116,8 +113,6 @@ type BannerProps = {
116
113
  * ```
117
114
  */
118
115
  export declare function Banner({ placement: placementId, classname, interaction, products, referralTitle: propReferralTitle, referralDescription: propReferralDescription, referralCta: propReferralCta, inappTitle: propInappTitle, inappDescription: propInappDescription, inappCta: propInappCta, imageUrl: propImageUrl, preview, previewMode, allowInappRedirect }: BannerProps): import("preact").JSX.Element | null;
119
- //#endregion
120
- //#region src/components/Banner/index.d.ts
121
116
  /**
122
117
  * Custom element interface for `<frak-banner>`.
123
118
  * Combines standard {@link HTMLElement} with {@link BannerProps}.
@@ -128,5 +123,4 @@ declare global {
128
123
  "frak-banner": BannerElement;
129
124
  }
130
125
  }
131
- //#endregion
132
126
  export {};
package/dist/banner.js CHANGED
@@ -1,18 +1,18 @@
1
- import { a as useClientReady, o as registerWebComponent, r as useLang } from "./sharedCss-CPNmnpXA.js";
2
- import { i as w } from "./rewards-HJlTkTcY.js";
3
- import { t as useGlobalComponents } from "./useGlobalComponents-B3s2UQFk.js";
4
- import { t as useLightDomStyles } from "./useLightDomStyles-BQ5FvCPi.js";
5
- import { t as useReward } from "./useReward-WmsNOFlz.js";
1
+ import { a as useClientReady, o as registerWebComponent, r as useLang } from "./sharedCss-SKmJGZgN.js";
2
+ import { i as w } from "./rewards-CfGynCt6.js";
3
+ import { a as CloseCircleIcon, i as ExternalLinkIcon, n as WarningIcon, r as LogoFrakWithName, t as GiftIcon } from "./GiftIcon-B9k_syq6.js";
4
+ import { t as useGlobalComponents } from "./useGlobalComponents-BF47jsBt.js";
5
+ import { t as useLightDomStyles } from "./useLightDomStyles-wGaNXHqN.js";
6
+ import { t as usePlacement } from "./usePlacement-Dd7itnCf.js";
7
+ import { t as useReward } from "./useReward-DmukZKoh.js";
6
8
  import { componentDefaults } from "./i18n/defaults.js";
7
- import { t as cssSource$5 } from "./sharedBaseCss.css-BkMpQeRx.js";
8
- import { t as usePlacement } from "./usePlacement-BpaIbzun.js";
9
- import { a as CloseCircleIcon, i as ExternalLinkIcon, n as WarningIcon, r as LogoFrakWithName, t as GiftIcon } from "./GiftIcon-JVhSFEhP.js";
9
+ import { t as cssSource$4 } from "./sharedBaseCss.css-nYy9vlzH.js";
10
10
  import { isInAppBrowser, redirectToExternalBrowser, sanitizeProductDetailsList, trackEvent } from "@frak-labs/core-sdk";
11
11
  import { REFERRAL_SUCCESS_EVENT, getMergeToken } from "@frak-labs/core-sdk/actions";
12
12
  import { useCallback, useEffect, useMemo, useRef, useState } from "preact/hooks";
13
13
  import { jsx, jsxs } from "preact/jsx-runtime";
14
- //#region \0ve-inline:../../packages/design-system/src/keyframes.css.ts.vanilla.js
15
- const cssSource$4 = `@keyframes keyframes_fadeIn__mnqmlt0 {
14
+ // \0ve-inline:../../packages/design-system/src/keyframes.css.ts.vanilla.js
15
+ const cssSource$3 = `@keyframes keyframes_fadeIn__mnqmlt0 {
16
16
  from {
17
17
  opacity: 0;
18
18
  }
@@ -44,9 +44,8 @@ const cssSource$4 = `@keyframes keyframes_fadeIn__mnqmlt0 {
44
44
  }
45
45
  }
46
46
  `;
47
- //#endregion
48
- //#region \0ve-inline:../../packages/design-system/src/styles/inAppBanner.css.ts.vanilla.js
49
- const cssSource$3 = `.inAppBanner_container__1ibpiy70 {
47
+ // \0ve-inline:../../packages/design-system/src/styles/inAppBanner.css.ts.vanilla.js
48
+ const cssSource$2 = `.inAppBanner_container__1ibpiy70 {
50
49
  top: max(8px, var(--safe-area-inset-top, env(safe-area-inset-top, 0px)));
51
50
  z-index: 1000;
52
51
  -webkit-backdrop-filter: blur(12px);
@@ -144,8 +143,7 @@ const cssSource$3 = `.inAppBanner_container__1ibpiy70 {
144
143
  outline-offset: 2px;
145
144
  }
146
145
  `;
147
- //#endregion
148
- //#region ../../packages/design-system/src/styles/inAppBanner.css.ts
146
+ // ../../packages/design-system/src/styles/inAppBanner.css.ts
149
147
  var body = "inAppBanner_body__1ibpiy74";
150
148
  var closeButton = "inAppBanner_closeButton__1ibpiy77";
151
149
  var container = "inAppBanner_container__1ibpiy70";
@@ -154,9 +152,7 @@ var description = "inAppBanner_description__1ibpiy75";
154
152
  var header = "inAppBanner_header__1ibpiy71";
155
153
  var iconWrapper = "inAppBanner_iconWrapper__1ibpiy72";
156
154
  var title = "inAppBanner_title__1ibpiy73";
157
- cssSource$4 + cssSource$3;
158
- //#endregion
159
- //#region ../../packages/design-system/src/components/InAppBanner/index.tsx
155
+ // ../../packages/design-system/src/components/InAppBanner/index.tsx
160
156
  function InAppBanner({ title: title$1, description: description$1, cta: cta$1, dismissLabel, onAction, onDismiss, className, classNames }) {
161
157
  return /* @__PURE__ */ jsxs("div", {
162
158
  className: `${container}${className ? ` ${className}` : ""}`,
@@ -203,8 +199,7 @@ function InAppBanner({ title: title$1, description: description$1, cta: cta$1, d
203
199
  ]
204
200
  });
205
201
  }
206
- //#endregion
207
- //#region \0ve-inline:src/components/Banner/Banner.css.ts.vanilla.js
202
+ // \0ve-inline:src/components/Banner/Banner.css.ts.vanilla.js
208
203
  const cssSource$1 = `.Banner_rootBase__1gnumzi0 {
209
204
  animation: .3s ease-out keyframes_fadeInDown__mnqmlt2;
210
205
  display: flex;
@@ -285,8 +280,7 @@ const cssSource$1 = `.Banner_rootBase__1gnumzi0 {
285
280
  right: 16px;
286
281
  }
287
282
  `;
288
- //#endregion
289
- //#region src/components/Banner/Banner.css.ts
283
+ // src/components/Banner/Banner.css.ts
290
284
  var frakLogo = "Banner_frakLogo__1gnumzi9";
291
285
  var iconSvg = "Banner_iconSvg__1gnumzi1";
292
286
  var referral = "Banner_referral__1gnumzi2 reset_base__1831jhd0 Banner_rootBase__1gnumzi0";
@@ -296,9 +290,8 @@ var referralDescription = "Banner_referralDescription__1gnumzi7 reset_base__1831
296
290
  var referralIconWrapper = "Banner_referralIconWrapper__1gnumzi3";
297
291
  var referralImage = "Banner_referralImage__1gnumzi4";
298
292
  var referralTitle = "Banner_referralTitle__1gnumzi6 reset_base__1831jhd0";
299
- const cssSource = cssSource$4 + cssSource$3 + cssSource$1;
300
- //#endregion
301
- //#region src/components/Banner/Banner.tsx
293
+ const cssSource = cssSource$3 + cssSource$2 + cssSource$1;
294
+ // src/components/Banner/Banner.tsx
302
295
  /**
303
296
  * Auto-detecting notification banner component.
304
297
  *
@@ -336,7 +329,7 @@ function Banner({ placement: placementId, classname = "", interaction, products,
336
329
  const isInappRedirectAllowed = allowInappRedirect === true || allowInappRedirect === "true";
337
330
  const placement = usePlacement(placementId);
338
331
  const { shouldRender, isHidden, isClientReady } = useClientReady();
339
- useLightDomStyles("frak-banner", placementId, placement?.components?.banner?.css, cssSource, cssSource$5);
332
+ useLightDomStyles("frak-banner", placementId, placement?.components?.banner?.css, cssSource, cssSource$4);
340
333
  const [dismissed, setDismissed] = useState(false);
341
334
  const [mode, setMode] = useState(() => {
342
335
  if (isPreview) return resolvedPreviewMode;
@@ -518,8 +511,7 @@ function Banner({ placement: placementId, classname = "", interaction, products,
518
511
  ]
519
512
  });
520
513
  }
521
- //#endregion
522
- //#region src/components/Banner/index.ts
514
+ // src/components/Banner/index.ts
523
515
  registerWebComponent(Banner, "frak-banner", [
524
516
  "placement",
525
517
  "classname",
@@ -536,5 +528,4 @@ registerWebComponent(Banner, "frak-banner", [
536
528
  "imageUrl",
537
529
  "allowInappRedirect"
538
530
  ], { shadow: false });
539
- //#endregion
540
531
  export { Banner };
@@ -1,5 +1,4 @@
1
1
  import { InteractionTypeKey, SharingPageProduct } from "@frak-labs/core-sdk";
2
- //#region src/components/ButtonShare/types.d.ts
3
2
  /**
4
3
  * The props type for {@link ButtonShare}.
5
4
  * @inline
@@ -62,8 +61,6 @@ type ButtonShareProps = {
62
61
  */
63
62
  preview?: string;
64
63
  };
65
- //#endregion
66
- //#region src/components/ButtonShare/ButtonShare.d.ts
67
64
  /**
68
65
  * Button to share the current page
69
66
  *
@@ -117,8 +114,6 @@ type ButtonShareProps = {
117
114
  * @see {@link @frak-labs/core-sdk!actions.getMerchantInformation | `getMerchantInformation()`} for more info about the estimated reward fetching
118
115
  */
119
116
  export declare function ButtonShare({ placement: placementId, text, classname, noRewardText, targetInteraction, products, clickAction: rawClickAction, preview }: ButtonShareProps): import("preact").JSX.Element | null;
120
- //#endregion
121
- //#region src/components/ButtonShare/index.d.ts
122
117
  /**
123
118
  * Custom element interface for `<frak-button-share>`.
124
119
  * Combines standard {@link HTMLElement} with {@link ButtonShareProps}.
@@ -129,5 +124,4 @@ declare global {
129
124
  "frak-button-share": ButtonShareElement;
130
125
  }
131
126
  }
132
- //#endregion
133
127
  export {};
@@ -1,14 +1,14 @@
1
- import { a as useClientReady, o as registerWebComponent, r as useLang, s as openSharingPage } from "./sharedCss-CPNmnpXA.js";
2
- import { i as w } from "./rewards-HJlTkTcY.js";
3
- import { t as useGlobalComponents } from "./useGlobalComponents-B3s2UQFk.js";
4
- import { t as useLightDomStyles } from "./useLightDomStyles-BQ5FvCPi.js";
5
- import { t as useReward } from "./useReward-WmsNOFlz.js";
1
+ import { a as useClientReady, o as registerWebComponent, r as useLang, s as openSharingPage } from "./sharedCss-SKmJGZgN.js";
2
+ import { i as w } from "./rewards-CfGynCt6.js";
3
+ import { t as useGlobalComponents } from "./useGlobalComponents-BF47jsBt.js";
4
+ import { t as useLightDomStyles } from "./useLightDomStyles-wGaNXHqN.js";
5
+ import { t as usePlacement } from "./usePlacement-Dd7itnCf.js";
6
+ import { t as useReward } from "./useReward-DmukZKoh.js";
6
7
  import { componentDefaults } from "./i18n/defaults.js";
7
- import { t as usePlacement } from "./usePlacement-BpaIbzun.js";
8
8
  import { sanitizeSharingProducts, trackEvent } from "@frak-labs/core-sdk";
9
9
  import { useCallback, useEffect, useMemo, useRef } from "preact/hooks";
10
10
  import { jsx } from "preact/jsx-runtime";
11
- //#region src/components/ButtonShare/ButtonShare.tsx
11
+ // src/components/ButtonShare/ButtonShare.tsx
12
12
  /**
13
13
  * Button to share the current page
14
14
  *
@@ -135,8 +135,7 @@ function ButtonShare({ placement: placementId, text, classname = "", noRewardTex
135
135
  children: btnText
136
136
  });
137
137
  }
138
- //#endregion
139
- //#region src/components/ButtonShare/index.ts
138
+ // src/components/ButtonShare/index.ts
140
139
  registerWebComponent(ButtonShare, "frak-button-share", [
141
140
  "text",
142
141
  "placement",
@@ -147,5 +146,4 @@ registerWebComponent(ButtonShare, "frak-button-share", [
147
146
  "products",
148
147
  "preview"
149
148
  ], { shadow: false });
150
- //#endregion
151
149
  export { ButtonShare };
@@ -1,5 +1,4 @@
1
1
  import { InteractionTypeKey } from "@frak-labs/core-sdk";
2
- //#region src/components/ButtonWallet/types.d.ts
3
2
  /**
4
3
  * The props type for {@link ButtonWallet}.
5
4
  * @inline
@@ -20,8 +19,6 @@ type ButtonWalletProps = {
20
19
  */
21
20
  targetInteraction?: InteractionTypeKey;
22
21
  };
23
- //#endregion
24
- //#region src/components/ButtonWallet/ButtonWallet.d.ts
25
22
  /**
26
23
  * Floating circular button that opens the Frak sharing page. The
27
24
  * `frak-button-wallet` tag name is public API (merchant markup, Magento
@@ -66,8 +63,6 @@ type ButtonWalletProps = {
66
63
  * @see {@link @frak-labs/core-sdk!actions.getMerchantInformation | `getMerchantInformation()`} for more info about the estimated reward fetching
67
64
  */
68
65
  export declare function ButtonWallet({ placement: placementId, classname, useReward: rawUseReward, targetInteraction }: ButtonWalletProps): import("preact").JSX.Element | null;
69
- //#endregion
70
- //#region src/components/ButtonWallet/index.d.ts
71
66
  /**
72
67
  * Custom element interface for `<frak-button-wallet>`.
73
68
  * Combines standard {@link HTMLElement} with {@link ButtonWalletProps}.
@@ -78,5 +73,4 @@ declare global {
78
73
  "frak-button-wallet": ButtonWalletElement;
79
74
  }
80
75
  }
81
- //#endregion
82
76
  export {};
@@ -1,19 +1,18 @@
1
- import { a as useClientReady, o as registerWebComponent, r as useLang, s as openSharingPage, t as buildStyleContent } from "./sharedCss-CPNmnpXA.js";
2
- import { t as useReward } from "./useReward-WmsNOFlz.js";
1
+ import { a as useClientReady, o as registerWebComponent, r as useLang, s as openSharingPage, t as buildStyleContent } from "./sharedCss-SKmJGZgN.js";
2
+ import { t as usePlacement } from "./usePlacement-Dd7itnCf.js";
3
+ import { t as useReward } from "./useReward-DmukZKoh.js";
3
4
  import { componentDefaults } from "./i18n/defaults.js";
4
- import { t as usePlacement } from "./usePlacement-BpaIbzun.js";
5
5
  import { trackEvent } from "@frak-labs/core-sdk";
6
6
  import { useCallback, useEffect, useRef } from "preact/hooks";
7
7
  import { Fragment, jsx, jsxs } from "preact/jsx-runtime";
8
- //#region src/utils/browser/safeVibrate.ts
8
+ // src/utils/browser/safeVibrate.ts
9
9
  /**
10
10
  * Attempt to vibrate the device
11
11
  */
12
12
  function safeVibrate() {
13
13
  if ("vibrate" in navigator) navigator.vibrate(10);
14
14
  }
15
- //#endregion
16
- //#region src/components/ButtonWallet/assets/WalletGiftIcon.tsx
15
+ // src/components/ButtonWallet/assets/WalletGiftIcon.tsx
17
16
  function WalletGiftIcon(props) {
18
17
  return /* @__PURE__ */ jsxs("svg", {
19
18
  fill: "none",
@@ -30,8 +29,7 @@ function WalletGiftIcon(props) {
30
29
  })]
31
30
  });
32
31
  }
33
- //#endregion
34
- //#region src/components/ButtonWallet/ButtonWallet.tsx
32
+ // src/components/ButtonWallet/ButtonWallet.tsx
35
33
  const componentCss = `
36
34
  .button {
37
35
  all: unset;
@@ -174,13 +172,11 @@ function ButtonWallet({ placement: placementId, classname = "", useReward: rawUs
174
172
  })]
175
173
  })] });
176
174
  }
177
- //#endregion
178
- //#region src/components/ButtonWallet/index.ts
175
+ // src/components/ButtonWallet/index.ts
179
176
  registerWebComponent(ButtonWallet, "frak-button-wallet", [
180
177
  "placement",
181
178
  "classname",
182
179
  "useReward",
183
180
  "targetInteraction"
184
181
  ], { shadow: true });
185
- //#endregion
186
182
  export { ButtonWallet };
@@ -1,5 +1,4 @@
1
1
  import { Language } from "@frak-labs/core-sdk";
2
- //#region src/i18n/defaults.d.ts
3
2
  /**
4
3
  * Shape of the built-in copy for every SDK Web Component. Declared explicitly
5
4
  * so each supported {@link Language} is forced to provide the exact same set
@@ -112,5 +111,4 @@ type ComponentCopy = {
112
111
  * keyed by the active language keeps an i18n runtime out of the CDN bundle.
113
112
  */
114
113
  export declare const componentDefaults: Record<Language, ComponentCopy>;
115
- //#endregion
116
114
  export {};