@frak-labs/components 1.4.0 → 1.5.0-beta.671227ad
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/cdn/Ambassador.Cmb0kX5D.js +519 -0
- package/cdn/Banner.2WJ4pT6E.js +227 -0
- package/cdn/{ButtonShare.C7A2tEvB.js → ButtonShare.DSGvJfJ-.js} +1 -1
- package/cdn/{ButtonWallet.Cg2OK1di.js → ButtonWallet.DHpHCl4c.js} +2 -2
- package/cdn/GiftIcon.DYg5xgHg.js +1 -0
- package/cdn/InstallQr.CHImaq56.js +1 -0
- package/cdn/{OpenInAppButton.Djz_cb9Y.js → OpenInAppButton.CxBzRNKw.js} +1 -1
- package/cdn/PostPurchase.C75q-9BM.js +124 -0
- package/cdn/RewardReminder.C6o8lgak.js +369 -0
- package/cdn/components.js +1 -1
- package/cdn/format.D2Ai5cCn.js +1 -0
- package/cdn/{GiftIcon.CW1SwrXH.js → icons.CdzHzZIJ.js} +1 -1
- package/cdn/jsxRuntime.module.7FJBZ9bf.js +58 -0
- package/cdn/loader.js +21 -16
- package/cdn/mountRewardReminder.BlmSRJDe.js +1 -0
- package/cdn/previewSummary.DxyobqED.js +1 -0
- package/cdn/replay-V6FXES7X.CgBxdfNp.js +1 -0
- package/cdn/rewardSummaryStore.DyjI-vPH.js +1 -0
- package/cdn/{rewards.t-rH9M3s.js → rewards.CeNLrK54.js} +1 -1
- package/cdn/useGlobalComponents.CNnOzerU.js +1 -0
- package/cdn/{useLightDomStyles.B72V1WPK.js → useLightDomStyles.557xWurb.js} +1 -1
- package/cdn/usePlacement.DYgmdkfr.js +1 -0
- package/cdn/{useReward.D2kXQbtD.js → useReward.BzUL3ijd.js} +1 -1
- package/dist/GiftIcon-Csu31jtf.js +62 -0
- package/dist/InstallQr-kpb44cfg.js +84 -0
- package/dist/ambassador.d.ts +16 -1
- package/dist/ambassador.js +534 -178
- package/dist/banner.d.ts +20 -6
- package/dist/banner.js +235 -13
- package/dist/format-zGdbUoX_.js +283 -0
- package/dist/i18n/defaults.d.ts +72 -0
- package/dist/i18n/defaults.js +108 -6
- package/dist/{GiftIcon-B9k_syq6.js → icons-iN3qH_Bv.js} +1 -61
- package/dist/postPurchase.d.ts +6 -1
- package/dist/postPurchase.js +187 -33
- package/dist/previewSummary-CMc6q8vI.js +37 -0
- package/dist/rewardReminder.d.ts +50 -0
- package/dist/rewardReminder.js +809 -0
- package/dist/sharedBaseCss.css-48sBApvf.js +3 -0
- package/package.json +18 -12
- package/cdn/Ambassador.BDu4aVZ9.js +0 -392
- package/cdn/Banner.BqfCxKs3.js +0 -208
- package/cdn/PostPurchase.DIZneqoT.js +0 -102
- package/cdn/jsxRuntime.module.DWH-kRVd.js +0 -58
- package/cdn/replay-V6FXES7X.efKsNT6s.js +0 -1
- package/cdn/useGlobalComponents.DVgSWfOp.js +0 -1
- package/cdn/usePlacement.DEOEf5_6.js +0 -1
- package/dist/sharedBaseCss.css-nYy9vlzH.js +0 -3
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { componentDefaults } from "./i18n/defaults.js";
|
|
2
|
+
import { t as fillReminderText } from "./format-zGdbUoX_.js";
|
|
3
|
+
// src/rewards/countdownLabel.ts
|
|
4
|
+
/** "Expires today", "1 day left" or "{DAYS} days left", in the component's language. */
|
|
5
|
+
function getCountdownLabel(days, lang) {
|
|
6
|
+
const copy = componentDefaults[lang].rewardReminder;
|
|
7
|
+
if (days <= 0) return copy.countdownToday;
|
|
8
|
+
if (days === 1) return copy.countdownOneDay;
|
|
9
|
+
return fillReminderText(copy.countdownDays, { days });
|
|
10
|
+
}
|
|
11
|
+
// src/rewards/previewSummary.ts
|
|
12
|
+
const DAY_MS = 864e5;
|
|
13
|
+
/** Sample pending rewards for editors: both sources non-zero, twelve days left. */
|
|
14
|
+
function getPreviewPending(now = Date.now()) {
|
|
15
|
+
return {
|
|
16
|
+
total: {
|
|
17
|
+
eurAmount: 12.5,
|
|
18
|
+
usdAmount: 13.5,
|
|
19
|
+
gbpAmount: 10.5
|
|
20
|
+
},
|
|
21
|
+
cashback: {
|
|
22
|
+
eurAmount: 10,
|
|
23
|
+
usdAmount: 10.8,
|
|
24
|
+
gbpAmount: 8.4
|
|
25
|
+
},
|
|
26
|
+
fromFriends: {
|
|
27
|
+
eurAmount: 2.5,
|
|
28
|
+
usdAmount: 2.7,
|
|
29
|
+
gbpAmount: 2.1
|
|
30
|
+
},
|
|
31
|
+
count: 2,
|
|
32
|
+
lockedCount: 0,
|
|
33
|
+
nextUnlockAt: null,
|
|
34
|
+
expiresAt: new Date(now + 12 * DAY_MS).toISOString()
|
|
35
|
+
};
|
|
36
|
+
}
|
|
37
|
+
export { getCountdownLabel as n, getPreviewPending as t };
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The props type for {@link RewardReminder}.
|
|
3
|
+
* @inline
|
|
4
|
+
*/
|
|
5
|
+
type RewardReminderProps = {
|
|
6
|
+
/**
|
|
7
|
+
* Placement ID reported with the reminder's analytics events.
|
|
8
|
+
*/
|
|
9
|
+
placement?: string;
|
|
10
|
+
/**
|
|
11
|
+
* CSS class names added to the floating root element.
|
|
12
|
+
*/
|
|
13
|
+
classname?: string;
|
|
14
|
+
/**
|
|
15
|
+
* Side of the screen. Wins over the merchant dashboard and the SDK config.
|
|
16
|
+
* @defaultValue `"left"`
|
|
17
|
+
*/
|
|
18
|
+
position?: "left" | "right";
|
|
19
|
+
/**
|
|
20
|
+
* Override the expanded card heading. Supports `{REWARD}`, `{DAYS}`, `{DATE}`, `{BRAND}`.
|
|
21
|
+
*/
|
|
22
|
+
heading?: string;
|
|
23
|
+
/**
|
|
24
|
+
* Override the expanded card description. Supports the same placeholders.
|
|
25
|
+
*/
|
|
26
|
+
description?: string;
|
|
27
|
+
/**
|
|
28
|
+
* Override the claim button text. Supports the same placeholders.
|
|
29
|
+
*/
|
|
30
|
+
cta?: string;
|
|
31
|
+
/**
|
|
32
|
+
* When set, renders with sample data and no fetch (e.g. in a theme editor).
|
|
33
|
+
*/
|
|
34
|
+
preview?: string;
|
|
35
|
+
};
|
|
36
|
+
/**
|
|
37
|
+
* Floating pill for a visitor with unclaimed rewards and no Frak wallet, expanding into a claim card.
|
|
38
|
+
* Snoozed for the browser session once dismissed.
|
|
39
|
+
*
|
|
40
|
+
* @group components
|
|
41
|
+
*/
|
|
42
|
+
export declare function RewardReminder({ placement, classname, position: positionProp, heading: headingProp, description: descriptionProp, cta: ctaProp, preview }: RewardReminderProps): import("preact").JSX.Element | null;
|
|
43
|
+
/** Custom element type for `<frak-reward-reminder>`: {@link HTMLElement} plus {@link RewardReminderProps}. */
|
|
44
|
+
export type RewardReminderElement = HTMLElement & RewardReminderProps;
|
|
45
|
+
declare global {
|
|
46
|
+
interface HTMLElementTagNameMap {
|
|
47
|
+
"frak-reward-reminder": RewardReminderElement;
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
export {};
|