@frak-labs/components 0.0.26-beta.d04602ec → 0.0.26-beta.eb3cff34

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 (42) hide show
  1. package/cdn/Banner.Ws9o79lU.js +64 -0
  2. package/cdn/ButtonShare.BDS1fgma.js +1 -0
  3. package/cdn/ButtonWallet.Be1UyRm8.js +40 -0
  4. package/cdn/OpenInAppButton.Diqt07eo.js +1 -0
  5. package/cdn/PostPurchase.DqFhm-Jn.js +52 -0
  6. package/cdn/components.js +1 -1
  7. package/cdn/formatReward.CXxVsWN3.js +1 -0
  8. package/cdn/loader.js +3 -55
  9. package/cdn/sprinkles.css.ts.vanilla.BtFkD4B3.js +1175 -0
  10. package/cdn/useGlobalComponents.BRe8dKO7.js +1 -0
  11. package/cdn/useLightDomStyles.ZFa154u8.js +1 -0
  12. package/cdn/usePlacement.B7jMsQvP.js +58 -0
  13. package/cdn/useReward.qEKeySJG.js +1 -0
  14. package/cdn/useShareModal.B--64ELG.js +1 -0
  15. package/dist/GiftIcon-4sr9xXyq.js +1501 -0
  16. package/dist/banner.d.ts +24 -11
  17. package/dist/banner.js +347 -103
  18. package/dist/buttonShare.d.ts +2 -2
  19. package/dist/buttonShare.js +11 -14
  20. package/dist/buttonWallet.d.ts +2 -2
  21. package/dist/buttonWallet.js +3 -7
  22. package/dist/{formatReward-6JQldDEC.js → formatReward-Bub6Z6eY.js} +8 -3
  23. package/dist/openInApp.d.ts +2 -2
  24. package/dist/openInApp.js +3 -9
  25. package/dist/postPurchase.d.ts +8 -2
  26. package/dist/postPurchase.js +1464 -31
  27. package/dist/useGlobalComponents-Cmfszr7v.js +21 -0
  28. package/dist/{useLightDomStyles-DukxuNnJ.js → useLightDomStyles-hgYYZsTy.js} +2 -5
  29. package/dist/{usePlacement-BbMuz8_A.js → usePlacement-LqYjZLX_.js} +1 -93
  30. package/dist/{useReward-CI2yRrCj.js → useReward-DU3_yP8Q.js} +2 -4
  31. package/dist/{useShareModal-DHlayNqk.js → useShareModal-DgEf5WWG.js} +1 -3
  32. package/package.json +13 -9
  33. package/cdn/Banner.BfkMel9Q.js +0 -1
  34. package/cdn/ButtonShare.BM9Inhmf.js +0 -1
  35. package/cdn/ButtonWallet.B7UmJcbb.js +0 -40
  36. package/cdn/OpenInAppButton.B4mrsz6L.js +0 -1
  37. package/cdn/PostPurchase.BIc0C4Ma.js +0 -1
  38. package/cdn/formatReward.C8hlSKRj.js +0 -1
  39. package/cdn/jsxRuntime.module.5UNmmhNi.js +0 -138
  40. package/cdn/useLightDomStyles.D895e4W1.js +0 -1
  41. package/cdn/useReward.DEU0AF3P.js +0 -1
  42. package/cdn/useShareModal.CN9_P7Sl.js +0 -1
@@ -1,9 +1,8 @@
1
- import { a as useClientReady, o as registerWebComponent, r as buildStyleContent, s as openWalletModal, t as usePlacement } from "./usePlacement-BbMuz8_A.js";
2
- import { t as useReward } from "./useReward-CI2yRrCj.js";
1
+ import { a as registerWebComponent, i as useClientReady, n as buildStyleContent, o as openWalletModal, t as usePlacement } from "./usePlacement-LqYjZLX_.js";
2
+ import { t as useReward } from "./useReward-DU3_yP8Q.js";
3
3
  import { trackEvent } from "@frak-labs/core-sdk";
4
4
  import { useEffect, useMemo, useState } from "preact/hooks";
5
5
  import { Fragment, jsx, jsxs } from "preact/jsx-runtime";
6
-
7
6
  //#region src/components/ButtonWallet/assets/GiftIcon.tsx
8
7
  function GiftIcon(props) {
9
8
  return /* @__PURE__ */ jsxs("svg", {
@@ -21,7 +20,6 @@ function GiftIcon(props) {
21
20
  })]
22
21
  });
23
22
  }
24
-
25
23
  //#endregion
26
24
  //#region src/components/ButtonWallet/ButtonWallet.tsx
27
25
  const componentCss = `
@@ -140,7 +138,6 @@ function ButtonWallet({ placement: placementId, classname = "", useReward: rawUs
140
138
  })]
141
139
  })] });
142
140
  }
143
-
144
141
  //#endregion
145
142
  //#region src/components/ButtonWallet/index.ts
146
143
  registerWebComponent(ButtonWallet, "frak-button-wallet", [
@@ -149,6 +146,5 @@ registerWebComponent(ButtonWallet, "frak-button-wallet", [
149
146
  "useReward",
150
147
  "targetInteraction"
151
148
  ], { shadow: true });
152
-
153
149
  //#endregion
154
- export { ButtonWallet };
150
+ export { ButtonWallet };
@@ -1,5 +1,4 @@
1
1
  import { formatAmount, getCurrencyAmountKey, getSupportedCurrency } from "@frak-labs/core-sdk";
2
-
3
2
  //#region src/utils/formatReward.ts
4
3
  /**
5
4
  * Format an {@link EstimatedReward} into a human-readable string.
@@ -23,6 +22,12 @@ function formatEstimatedReward(reward, currency, basketAmount) {
23
22
  }
24
23
  }
25
24
  }
26
-
25
+ /**
26
+ * Replace the `{REWARD}` placeholder in a text string with a reward value.
27
+ * If no reward is provided, returns the text with `{REWARD}` stripped.
28
+ */
29
+ function applyRewardPlaceholder(text, reward) {
30
+ return reward ? text.replace("{REWARD}", reward) : text.replace("{REWARD}", "");
31
+ }
27
32
  //#endregion
28
- export { formatEstimatedReward as t };
33
+ export { formatEstimatedReward as n, applyRewardPlaceholder as t };
@@ -1,4 +1,4 @@
1
- import * as preact from "preact";
1
+ import * as _$preact from "preact";
2
2
 
3
3
  //#region src/components/OpenInAppButton/types.d.ts
4
4
  /**
@@ -49,7 +49,7 @@ declare function OpenInAppButton({
49
49
  placement: placementId,
50
50
  text,
51
51
  classname
52
- }: OpenInAppButtonProps): preact.JSX.Element | null;
52
+ }: OpenInAppButtonProps): _$preact.JSX.Element | null;
53
53
  //#endregion
54
54
  //#region src/components/OpenInAppButton/index.d.ts
55
55
  /**
package/dist/openInApp.js CHANGED
@@ -1,9 +1,8 @@
1
- import { a as useClientReady, o as registerWebComponent, t as usePlacement } from "./usePlacement-BbMuz8_A.js";
2
- import { t as useLightDomStyles } from "./useLightDomStyles-DukxuNnJ.js";
1
+ import { a as registerWebComponent, i as useClientReady, t as usePlacement } from "./usePlacement-LqYjZLX_.js";
2
+ import { t as useLightDomStyles } from "./useLightDomStyles-hgYYZsTy.js";
3
3
  import { DEEP_LINK_SCHEME, trackEvent, triggerDeepLinkWithFallback } from "@frak-labs/core-sdk";
4
4
  import { useMemo } from "preact/hooks";
5
5
  import { jsx } from "preact/jsx-runtime";
6
-
7
6
  //#region src/utils/isMobile.ts
8
7
  /**
9
8
  * Check if the current device is a mobile device
@@ -20,13 +19,11 @@ function isMobile() {
20
19
  if (/Macintosh/i.test(navigator.userAgent) && navigator.maxTouchPoints > 1) return true;
21
20
  return false;
22
21
  }
23
-
24
22
  //#endregion
25
23
  //#region src/hooks/useIsMobile.ts
26
24
  function useIsMobile() {
27
25
  return { isMobile: useMemo(() => isMobile(), []) };
28
26
  }
29
-
30
27
  //#endregion
31
28
  //#region src/utils/openInApp.ts
32
29
  const DEFAULT_PATH = "wallet";
@@ -46,7 +43,6 @@ function openFrakWalletApp(path = DEFAULT_PATH) {
46
43
  if (client) trackEvent(client, "app_not_installed");
47
44
  } });
48
45
  }
49
-
50
46
  //#endregion
51
47
  //#region src/components/OpenInAppButton/OpenInAppButton.tsx
52
48
  /**
@@ -99,7 +95,6 @@ function OpenInAppButton({ placement: placementId, text = "Open in App", classna
99
95
  children: resolvedText
100
96
  });
101
97
  }
102
-
103
98
  //#endregion
104
99
  //#region src/components/OpenInAppButton/index.ts
105
100
  registerWebComponent(OpenInAppButton, "frak-open-in-app", [
@@ -107,6 +102,5 @@ registerWebComponent(OpenInAppButton, "frak-open-in-app", [
107
102
  "placement",
108
103
  "classname"
109
104
  ], { shadow: false });
110
-
111
105
  //#endregion
112
- export { OpenInAppButton };
106
+ export { OpenInAppButton };
@@ -1,4 +1,4 @@
1
- import * as preact from "preact";
1
+ import * as _$preact from "preact";
2
2
 
3
3
  //#region src/components/PostPurchase/types.d.ts
4
4
  /**
@@ -41,6 +41,11 @@ type PostPurchaseProps = {
41
41
  * Force a display variant instead of relying on the backend evaluation.
42
42
  */
43
43
  variant?: "referrer" | "referee";
44
+ /**
45
+ * Label for the pill badge displayed above the message.
46
+ * When omitted (and no placement config provides one), the badge is hidden.
47
+ */
48
+ badgeText?: string;
44
49
  /**
45
50
  * Override the message shown to referrers.
46
51
  * Use `{REWARD}` as placeholder for the reward amount.
@@ -96,10 +101,11 @@ declare function PostPurchase({
96
101
  placement: placementId,
97
102
  classname,
98
103
  variant: forcedVariant,
104
+ badgeText: propBadgeText,
99
105
  referrerText: propReferrerText,
100
106
  refereeText: propRefereeText,
101
107
  ctaText: propCtaText
102
- }: PostPurchaseProps): preact.JSX.Element | null;
108
+ }: PostPurchaseProps): _$preact.JSX.Element | null;
103
109
  //#endregion
104
110
  //#region src/components/PostPurchase/index.d.ts
105
111
  /**