@frak-labs/components 1.3.3-beta.a79006c4 → 1.3.3-beta.b5bbb625

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 (47) hide show
  1. package/cdn/Ambassador.DIumLn1z.js +392 -0
  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.CX0gLPUJ.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.CUZaa90V.js → jsxRuntime.module.DWH-kRVd.js} +1 -1
  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 +105 -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/Ambassador.7wEDPaYu.js +0 -392
  39. package/cdn/Banner.8NeKFnVj.js +0 -208
  40. package/cdn/ButtonShare.BTT49Sbn.js +0 -1
  41. package/cdn/ButtonWallet.CB0Ysymx.js +0 -40
  42. package/cdn/OpenInAppButton.DdL3xii8.js +0 -1
  43. package/cdn/PostPurchase.ClgDFxmZ.js +0 -102
  44. package/cdn/useGlobalComponents.CXuceSQ0.js +0 -1
  45. package/cdn/useLightDomStyles.C3oQ3HLu.js +0 -1
  46. package/cdn/usePlacement.Cq64cZ9Q.js +0 -1
  47. package/cdn/useReward.BpO3D675.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,8 @@ 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 HEX_COLOR = /^#[0-9a-f]{6}$/i;
20
22
  const TAG_TINT = .08;
21
23
  const RESET_HEADING_RATIO = 1.25;
22
24
  const WIDGET_WORDS = /cookie|consent|newsletter|popup|modal|sr-only|visually-hidden|skip-to/i;
@@ -35,6 +37,11 @@ const FONT_KNOBS = [
35
37
  "h2-family",
36
38
  "h2-transform"
37
39
  ];
40
+ const ACCENT_KNOBS = [
41
+ "accent",
42
+ "accent-ink",
43
+ "accent-text"
44
+ ];
38
45
  const REFERENCE_HEADINGS = "[data-frak-amb-ref]";
39
46
  function alphaOf(value) {
40
47
  const slash = /\/\s*([\d.]+)(%?)\s*\)/.exec(value);
@@ -265,7 +272,8 @@ function knobsFrom(source) {
265
272
  ...typographyOf(source.button, "cta", source.buttonBg, false)
266
273
  ];
267
274
  if (source.radius) knobs.push(["radius", source.radius]);
268
- knobs.push(...accentKnobs(source), ...tagKnobs(source));
275
+ knobs.push(...accentKnobs(source));
276
+ knobs.push(...tagKnobs(source));
269
277
  if (source.button) {
270
278
  const from = getComputedStyle(source.button);
271
279
  knobs.push(["cta-radius", from.borderRadius.split(" ")[0]], ["cta-transform", from.textTransform]);
@@ -275,16 +283,62 @@ function knobsFrom(source) {
275
283
  function knobsSignature(knobs) {
276
284
  return knobs.map(([name, value]) => `${name}=${value}`).sort().join("|");
277
285
  }
278
- function writeKnobs(anchor, knobs) {
286
+ /** The `--frak-amb-*` knobs among `names` that already resolve on the anchor: the merchant's own. */
287
+ function merchantKnobs(anchor, names) {
279
288
  const current = getComputedStyle(anchor);
280
- const merchantSet = new Set(knobs.map(([name]) => name).filter((name) => current.getPropertyValue(`--frak-amb-${name}`).trim()));
289
+ return new Set(names.filter((name) => current.getPropertyValue(`--frak-amb-${name}`).trim()));
290
+ }
291
+ function writeKnobs(anchor, knobs) {
292
+ const merchantSet = merchantKnobs(anchor, knobs.map(([name]) => name));
293
+ const written = [];
281
294
  for (const [name, value] of knobs) {
282
295
  if (!value || isTransparent(value)) continue;
283
296
  if (merchantSet.has(name)) continue;
284
297
  if (name === "accent-text" && merchantSet.has("accent")) continue;
285
298
  anchor.style.setProperty(`--frak-amb-${name}`, value);
299
+ written.push(name);
286
300
  }
287
301
  markFontKnobs(anchor);
302
+ return written;
303
+ }
304
+ function rgbFromHex(hex) {
305
+ const channel = (at) => Number.parseInt(hex.slice(at, at + 2), 16);
306
+ return `rgb(${channel(1)}, ${channel(3)}, ${channel(5)})`;
307
+ }
308
+ /**
309
+ * The dashboard accent, its ink and the figures' text. A light accent on a
310
+ * light page (or a dark one on a dark page) sends the text to the page's own
311
+ * colour, the same rule the sampled accent follows.
312
+ */
313
+ function dashboardKnobs(anchor, hex) {
314
+ const fill = rgbFromHex(hex);
315
+ const ink = contrastRatio(fill, WHITE) >= READABLE_CONTRAST ? "#fff" : "#000";
316
+ const knobs = [["accent", hex], ["accent-ink", ink]];
317
+ if (!(contrastRatio(fill, backdropOf(anchor)) >= READABLE_CONTRAST)) knobs.push(["accent-text", "currentColor"]);
318
+ return knobs;
319
+ }
320
+ /**
321
+ * Writes the dashboard accent synchronously, so it neither waits for the
322
+ * sampler nor depends on it. A merchant's CSS accent takes it over entirely.
323
+ */
324
+ function writeDashboardAccent(anchor, hex) {
325
+ if (!HEX_COLOR.test(hex)) return [];
326
+ const knobs = dashboardKnobs(anchor, hex);
327
+ const merchantSet = merchantKnobs(anchor, knobs.map(([name]) => name));
328
+ if (merchantSet.has("accent")) return [];
329
+ const written = [];
330
+ for (const [name, value] of knobs) {
331
+ if (merchantSet.has(name)) continue;
332
+ anchor.style.setProperty(`--frak-amb-${name}`, value);
333
+ written.push(name);
334
+ }
335
+ return written;
336
+ }
337
+ /** The one place that decides who owns the accent: the dashboard, else the sample. */
338
+ function writeAccent(anchor, dashboardHex, sampled) {
339
+ const dashboard = dashboardHex ? writeDashboardAccent(anchor, dashboardHex) : [];
340
+ if (dashboard.includes("accent")) return dashboard;
341
+ return sampled ? writeKnobs(anchor, sampled) : [];
288
342
  }
289
343
  /**
290
344
  * Heading font rules apply only behind this attribute: an unset `var()` in
@@ -305,31 +359,54 @@ async function settled() {
305
359
  if (document.fonts?.ready) await document.fonts.ready;
306
360
  await nextFrame();
307
361
  }
308
- function useHostTheme(target) {
362
+ /**
363
+ * Themes the page from the host. `accentColor` (the dashboard setting) outranks
364
+ * the sampled button colour; the merchant's own `--frak-amb-accent` outranks both.
365
+ */
366
+ function useHostTheme(target, accentColor) {
367
+ const [sampledAccent, setSampledAccent] = useState();
309
368
  useEffect(() => {
310
369
  let cancelled = false;
370
+ const anchor = target.current;
371
+ const written = [];
311
372
  const run = async () => {
312
373
  try {
313
374
  await settled();
314
375
  if (cancelled) return;
315
- const anchor = target.current;
316
- if (!anchor) return;
317
- const first = knobsFrom(sampleTheme(anchor));
376
+ const current = target.current;
377
+ if (!current) return;
378
+ const first = knobsFrom(sampleTheme(current));
318
379
  await nextFrame();
319
380
  if (cancelled) return;
320
- const second = knobsFrom(sampleTheme(anchor));
381
+ const second = knobsFrom(sampleTheme(current));
321
382
  if (knobsSignature(first) !== knobsSignature(second)) return;
322
- writeKnobs(anchor, first);
383
+ const isAccent = ([name]) => ACCENT_KNOBS.includes(name);
384
+ written.push(...writeKnobs(current, first.filter((k) => !isAccent(k))));
385
+ setSampledAccent(first.filter(isAccent));
323
386
  } catch {}
324
387
  };
325
388
  run();
326
389
  return () => {
327
390
  cancelled = true;
391
+ if (!anchor) return;
392
+ for (const name of written) anchor.style.removeProperty(`--frak-amb-${name}`);
393
+ markFontKnobs(anchor);
328
394
  };
329
395
  }, [target]);
396
+ useLayoutEffect(() => {
397
+ const anchor = target.current;
398
+ if (!anchor) return;
399
+ const written = writeAccent(anchor, accentColor, sampledAccent);
400
+ return () => {
401
+ for (const name of written) anchor.style.removeProperty(`--frak-amb-${name}`);
402
+ };
403
+ }, [
404
+ target,
405
+ accentColor,
406
+ sampledAccent
407
+ ]);
330
408
  }
331
- //#endregion
332
- //#region \0ve-inline:src/components/Ambassador/Ambassador.css.ts.vanilla.js
409
+ // \0ve-inline:src/components/Ambassador/Ambassador.css.ts.vanilla.js
333
410
  const cssSource$1 = `.Ambassador_panel__awpcg00 {
334
411
  background-color: var(--frak-amb-surface, #1111110a);
335
412
  border: 1px solid var(--frak-amb-border, #11111126);
@@ -722,8 +799,7 @@ const cssSource$1 = `.Ambassador_panel__awpcg00 {
722
799
  }
723
800
  }
724
801
  `;
725
- //#endregion
726
- //#region src/components/Ambassador/Ambassador.css.ts
802
+ // src/components/Ambassador/Ambassador.css.ts
727
803
  var amountUnit = "Ambassador_amountUnit__awpcg0a";
728
804
  var amountWords = "Ambassador_amountWords__awpcg0b";
729
805
  var faq = "Ambassador_region__awpcg03";
@@ -789,8 +865,7 @@ var winWinCards = "Ambassador_winWinCards__awpcg0v";
789
865
  var winWinLede = "Ambassador_lede__awpcg06";
790
866
  var winWinTitle = "Ambassador_regionTitle__awpcg05";
791
867
  const cssSource = cssSource$1;
792
- //#endregion
793
- //#region src/components/Ambassador/InstallQr.tsx
868
+ // src/components/Ambassador/InstallQr.tsx
794
869
  const WIDE_QUERY = "(min-width: 768px)";
795
870
  const QUIET_ZONE = 4;
796
871
  const ECC = "low";
@@ -857,8 +932,7 @@ function modulesPath(grid) {
857
932
  }
858
933
  return path;
859
934
  }
860
- //#endregion
861
- //#region src/components/Ambassador/storeBadges.tsx
935
+ // src/components/Ambassador/storeBadges.tsx
862
936
  function AppStoreBadgeArtFr(props) {
863
937
  return /* @__PURE__ */ jsx("svg", {
864
938
  "aria-hidden": "true",
@@ -1113,8 +1187,7 @@ function PlayStoreBadgeArt({ lang, ...props }) {
1113
1187
  ...props
1114
1188
  });
1115
1189
  }
1116
- //#endregion
1117
- //#region src/components/Ambassador/Ambassador.tsx
1190
+ // src/components/Ambassador/Ambassador.tsx
1118
1191
  const FRAK_URL = "https://frak.id";
1119
1192
  /**
1120
1193
  * SDK config name first, then `og:site_name`, then the bare hostname with a
@@ -1230,16 +1303,17 @@ function Ambassador(props) {
1230
1303
  const dashboard = useGlobalComponents()?.ambassador;
1231
1304
  const merged = {
1232
1305
  ...props,
1233
- faq5Answer: dashboard?.faq5Answer
1306
+ faq5Answer: dashboard?.faq5Answer,
1307
+ accentColor: dashboard?.accentColor
1234
1308
  };
1235
1309
  for (const field of DASHBOARD_FIELDS) merged[field] = props[field] ?? dashboard?.[field];
1236
1310
  return /* @__PURE__ */ jsx(AmbassadorPage, { ...merged });
1237
1311
  }
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 }) {
1312
+ 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
1313
  const { shouldRender, isHidden, isClientReady } = useClientReady();
1240
1314
  const lang = useLang();
1241
1315
  const rootRef = useRef(null);
1242
- useHostTheme(rootRef);
1316
+ useHostTheme(rootRef, isHidden ? void 0 : accentColor);
1243
1317
  useLightDomStyles("frak-ambassador", void 0, void 0, cssSource, cssSource$2);
1244
1318
  const { reward: reward$1 } = useReward(isClientReady, void 0, "referrer");
1245
1319
  const { reward: refereeReward, hasReward: hasRefereeReward } = useReward(isClientReady, void 0, "referee");
@@ -1743,8 +1817,7 @@ function AmbassadorPage({ merchantId: propMerchantId, classname = "", heroTitle:
1743
1817
  ]
1744
1818
  });
1745
1819
  }
1746
- //#endregion
1747
- //#region src/components/Ambassador/index.ts
1820
+ // src/components/Ambassador/index.ts
1748
1821
  registerWebComponent(Ambassador, "frak-ambassador", [...[
1749
1822
  "merchantId",
1750
1823
  "classname",
@@ -1810,5 +1883,4 @@ registerWebComponent(Ambassador, "frak-ambassador", [...[
1810
1883
  "attributionBeforeLink",
1811
1884
  "attributionLinkText"
1812
1885
  ]], { shadow: false });
1813
- //#endregion
1814
1886
  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 {};