@akin-travel/partner-sdk 1.0.5
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/README.md +1204 -0
- package/dist/account/components/AccountInfoSection.d.ts +46 -0
- package/dist/account/components/AccountInfoSection.d.ts.map +1 -0
- package/dist/account/components/AccountInfoSection.js +52 -0
- package/dist/account/components/AccountInfoSection.js.map +1 -0
- package/dist/account/components/NotificationPreferencesSection.d.ts +40 -0
- package/dist/account/components/NotificationPreferencesSection.d.ts.map +1 -0
- package/dist/account/components/NotificationPreferencesSection.js +116 -0
- package/dist/account/components/NotificationPreferencesSection.js.map +1 -0
- package/dist/account/components/PasskeySection.d.ts +49 -0
- package/dist/account/components/PasskeySection.d.ts.map +1 -0
- package/dist/account/components/PasskeySection.js +298 -0
- package/dist/account/components/PasskeySection.js.map +1 -0
- package/dist/account/hooks/useAccountForm.d.ts +23 -0
- package/dist/account/hooks/useAccountForm.d.ts.map +1 -0
- package/dist/account/hooks/useAccountForm.js +133 -0
- package/dist/account/hooks/useAccountForm.js.map +1 -0
- package/dist/account/index.d.ts +10 -0
- package/dist/account/index.d.ts.map +1 -0
- package/dist/account/index.js +21 -0
- package/dist/account/index.js.map +1 -0
- package/dist/auth/AkinAuthProvider.d.ts +31 -0
- package/dist/auth/AkinAuthProvider.d.ts.map +1 -0
- package/dist/auth/AkinAuthProvider.js +632 -0
- package/dist/auth/AkinAuthProvider.js.map +1 -0
- package/dist/auth/components/LoginForm.d.ts +63 -0
- package/dist/auth/components/LoginForm.d.ts.map +1 -0
- package/dist/auth/components/LoginForm.js +230 -0
- package/dist/auth/components/LoginForm.js.map +1 -0
- package/dist/auth/components/MagicLinkForm.d.ts +41 -0
- package/dist/auth/components/MagicLinkForm.d.ts.map +1 -0
- package/dist/auth/components/MagicLinkForm.js +88 -0
- package/dist/auth/components/MagicLinkForm.js.map +1 -0
- package/dist/auth/components/RequireAuth.d.ts +62 -0
- package/dist/auth/components/RequireAuth.d.ts.map +1 -0
- package/dist/auth/components/RequireAuth.js +63 -0
- package/dist/auth/components/RequireAuth.js.map +1 -0
- package/dist/auth/components/RequireGuest.d.ts +60 -0
- package/dist/auth/components/RequireGuest.d.ts.map +1 -0
- package/dist/auth/components/RequireGuest.js +64 -0
- package/dist/auth/components/RequireGuest.js.map +1 -0
- package/dist/auth/components/SignupForm.d.ts +45 -0
- package/dist/auth/components/SignupForm.d.ts.map +1 -0
- package/dist/auth/components/SignupForm.js +167 -0
- package/dist/auth/components/SignupForm.js.map +1 -0
- package/dist/auth/index.d.ts +10 -0
- package/dist/auth/index.d.ts.map +1 -0
- package/dist/auth/index.js +21 -0
- package/dist/auth/index.js.map +1 -0
- package/dist/client.d.ts +17 -0
- package/dist/client.d.ts.map +1 -0
- package/dist/client.js +136 -0
- package/dist/client.js.map +1 -0
- package/dist/components/PhoneInput.d.ts +62 -0
- package/dist/components/PhoneInput.d.ts.map +1 -0
- package/dist/components/PhoneInput.js +65 -0
- package/dist/components/PhoneInput.js.map +1 -0
- package/dist/components/index.d.ts +2 -0
- package/dist/components/index.d.ts.map +1 -0
- package/dist/components/index.js +9 -0
- package/dist/components/index.js.map +1 -0
- package/dist/config.d.ts +111 -0
- package/dist/config.d.ts.map +1 -0
- package/dist/config.js +56 -0
- package/dist/config.js.map +1 -0
- package/dist/constants/preferences.d.ts +22 -0
- package/dist/constants/preferences.d.ts.map +1 -0
- package/dist/constants/preferences.js +52 -0
- package/dist/constants/preferences.js.map +1 -0
- package/dist/currency/CurrencyProvider.d.ts +46 -0
- package/dist/currency/CurrencyProvider.d.ts.map +1 -0
- package/dist/currency/CurrencyProvider.js +145 -0
- package/dist/currency/CurrencyProvider.js.map +1 -0
- package/dist/currency/components/CurrencySelector.d.ts +43 -0
- package/dist/currency/components/CurrencySelector.d.ts.map +1 -0
- package/dist/currency/components/CurrencySelector.js +58 -0
- package/dist/currency/components/CurrencySelector.js.map +1 -0
- package/dist/currency/exchangeRates.d.ts +40 -0
- package/dist/currency/exchangeRates.d.ts.map +1 -0
- package/dist/currency/exchangeRates.js +90 -0
- package/dist/currency/exchangeRates.js.map +1 -0
- package/dist/currency/index.d.ts +6 -0
- package/dist/currency/index.d.ts.map +1 -0
- package/dist/currency/index.js +20 -0
- package/dist/currency/index.js.map +1 -0
- package/dist/header/components/CurrencyAccordion.d.ts +45 -0
- package/dist/header/components/CurrencyAccordion.d.ts.map +1 -0
- package/dist/header/components/CurrencyAccordion.js +54 -0
- package/dist/header/components/CurrencyAccordion.js.map +1 -0
- package/dist/header/components/HeaderMenu.d.ts +49 -0
- package/dist/header/components/HeaderMenu.d.ts.map +1 -0
- package/dist/header/components/HeaderMenu.js +95 -0
- package/dist/header/components/HeaderMenu.js.map +1 -0
- package/dist/header/components/LanguageAccordion.d.ts +45 -0
- package/dist/header/components/LanguageAccordion.d.ts.map +1 -0
- package/dist/header/components/LanguageAccordion.js +54 -0
- package/dist/header/components/LanguageAccordion.js.map +1 -0
- package/dist/header/components/UserAvatar.d.ts +26 -0
- package/dist/header/components/UserAvatar.d.ts.map +1 -0
- package/dist/header/components/UserAvatar.js +46 -0
- package/dist/header/components/UserAvatar.js.map +1 -0
- package/dist/header/index.d.ts +10 -0
- package/dist/header/index.d.ts.map +1 -0
- package/dist/header/index.js +13 -0
- package/dist/header/index.js.map +1 -0
- package/dist/i18n/I18nProvider.d.ts +57 -0
- package/dist/i18n/I18nProvider.d.ts.map +1 -0
- package/dist/i18n/I18nProvider.js +205 -0
- package/dist/i18n/I18nProvider.js.map +1 -0
- package/dist/i18n/components/LanguageSelector.d.ts +43 -0
- package/dist/i18n/components/LanguageSelector.d.ts.map +1 -0
- package/dist/i18n/components/LanguageSelector.js +57 -0
- package/dist/i18n/components/LanguageSelector.js.map +1 -0
- package/dist/i18n/index.d.ts +5 -0
- package/dist/i18n/index.d.ts.map +1 -0
- package/dist/i18n/index.js +14 -0
- package/dist/i18n/index.js.map +1 -0
- package/dist/i18n/translations/en.json +283 -0
- package/dist/i18n/translations/es.json +283 -0
- package/dist/index.d.ts +81 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +191 -0
- package/dist/index.js.map +1 -0
- package/dist/loyalty/AkinLoyaltyProvider.d.ts +18 -0
- package/dist/loyalty/AkinLoyaltyProvider.d.ts.map +1 -0
- package/dist/loyalty/AkinLoyaltyProvider.js +399 -0
- package/dist/loyalty/AkinLoyaltyProvider.js.map +1 -0
- package/dist/loyalty/components/LoyaltyCard.d.ts +48 -0
- package/dist/loyalty/components/LoyaltyCard.d.ts.map +1 -0
- package/dist/loyalty/components/LoyaltyCard.js +140 -0
- package/dist/loyalty/components/LoyaltyCard.js.map +1 -0
- package/dist/loyalty/components/PointsDisplay.d.ts +40 -0
- package/dist/loyalty/components/PointsDisplay.d.ts.map +1 -0
- package/dist/loyalty/components/PointsDisplay.js +32 -0
- package/dist/loyalty/components/PointsDisplay.js.map +1 -0
- package/dist/loyalty/components/PreviousStays.d.ts +59 -0
- package/dist/loyalty/components/PreviousStays.d.ts.map +1 -0
- package/dist/loyalty/components/PreviousStays.js +101 -0
- package/dist/loyalty/components/PreviousStays.js.map +1 -0
- package/dist/loyalty/components/SimpleTierCards.d.ts +51 -0
- package/dist/loyalty/components/SimpleTierCards.d.ts.map +1 -0
- package/dist/loyalty/components/SimpleTierCards.js +96 -0
- package/dist/loyalty/components/SimpleTierCards.js.map +1 -0
- package/dist/loyalty/components/TierCard.d.ts +30 -0
- package/dist/loyalty/components/TierCard.d.ts.map +1 -0
- package/dist/loyalty/components/TierCard.js +41 -0
- package/dist/loyalty/components/TierCard.js.map +1 -0
- package/dist/loyalty/components/TierProgress.d.ts +32 -0
- package/dist/loyalty/components/TierProgress.d.ts.map +1 -0
- package/dist/loyalty/components/TierProgress.js +41 -0
- package/dist/loyalty/components/TierProgress.js.map +1 -0
- package/dist/loyalty/components/TierRequirementsTable.d.ts +54 -0
- package/dist/loyalty/components/TierRequirementsTable.d.ts.map +1 -0
- package/dist/loyalty/components/TierRequirementsTable.js +104 -0
- package/dist/loyalty/components/TierRequirementsTable.js.map +1 -0
- package/dist/loyalty/components/TransactionList.d.ts +44 -0
- package/dist/loyalty/components/TransactionList.d.ts.map +1 -0
- package/dist/loyalty/components/TransactionList.js +112 -0
- package/dist/loyalty/components/TransactionList.js.map +1 -0
- package/dist/loyalty/components/UpcomingStays.d.ts +49 -0
- package/dist/loyalty/components/UpcomingStays.d.ts.map +1 -0
- package/dist/loyalty/components/UpcomingStays.js +60 -0
- package/dist/loyalty/components/UpcomingStays.js.map +1 -0
- package/dist/loyalty/index.d.ts +12 -0
- package/dist/loyalty/index.d.ts.map +1 -0
- package/dist/loyalty/index.js +27 -0
- package/dist/loyalty/index.js.map +1 -0
- package/dist/types/account.d.ts +108 -0
- package/dist/types/account.d.ts.map +1 -0
- package/dist/types/account.js +3 -0
- package/dist/types/account.js.map +1 -0
- package/dist/types/auth.d.ts +205 -0
- package/dist/types/auth.d.ts.map +1 -0
- package/dist/types/auth.js +3 -0
- package/dist/types/auth.js.map +1 -0
- package/dist/types/currency.d.ts +102 -0
- package/dist/types/currency.d.ts.map +1 -0
- package/dist/types/currency.js +3 -0
- package/dist/types/currency.js.map +1 -0
- package/dist/types/header.d.ts +105 -0
- package/dist/types/header.d.ts.map +1 -0
- package/dist/types/header.js +3 -0
- package/dist/types/header.js.map +1 -0
- package/dist/types/i18n.d.ts +90 -0
- package/dist/types/i18n.d.ts.map +1 -0
- package/dist/types/i18n.js +3 -0
- package/dist/types/i18n.js.map +1 -0
- package/dist/types/index.d.ts +3 -0
- package/dist/types/index.d.ts.map +1 -0
- package/dist/types/index.js +3 -0
- package/dist/types/index.js.map +1 -0
- package/dist/types/loyalty.d.ts +312 -0
- package/dist/types/loyalty.d.ts.map +1 -0
- package/dist/types/loyalty.js +3 -0
- package/dist/types/loyalty.js.map +1 -0
- package/dist/utils/index.d.ts +2 -0
- package/dist/utils/index.d.ts.map +1 -0
- package/dist/utils/index.js +10 -0
- package/dist/utils/index.js.map +1 -0
- package/dist/utils/tierLabels.d.ts +27 -0
- package/dist/utils/tierLabels.d.ts.map +1 -0
- package/dist/utils/tierLabels.js +110 -0
- package/dist/utils/tierLabels.js.map +1 -0
- package/package.json +60 -0
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
'use client';
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
exports.TierCard = TierCard;
|
|
5
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
6
|
+
const AkinLoyaltyProvider_1 = require("../AkinLoyaltyProvider");
|
|
7
|
+
const AkinAuthProvider_1 = require("../../auth/AkinAuthProvider");
|
|
8
|
+
/**
|
|
9
|
+
* Headless TierCard component
|
|
10
|
+
*
|
|
11
|
+
* Provides tier data for display - you provide the UI.
|
|
12
|
+
*
|
|
13
|
+
* @example
|
|
14
|
+
* ```tsx
|
|
15
|
+
* <TierCard>
|
|
16
|
+
* {({ tier, displayName, color, points, loyaltyNumber }) => (
|
|
17
|
+
* <div style={{ backgroundColor: color }} className="your-tier-card">
|
|
18
|
+
* <h2>{displayName}</h2>
|
|
19
|
+
* <p>{points.toLocaleString()} points</p>
|
|
20
|
+
* <span>#{loyaltyNumber}</span>
|
|
21
|
+
* </div>
|
|
22
|
+
* )}
|
|
23
|
+
* </TierCard>
|
|
24
|
+
* ```
|
|
25
|
+
*/
|
|
26
|
+
function TierCard({ children }) {
|
|
27
|
+
const { tier, tierConfig, points } = (0, AkinLoyaltyProvider_1.useAkinLoyalty)();
|
|
28
|
+
const { member } = (0, AkinAuthProvider_1.useAkinAuth)();
|
|
29
|
+
const props = {
|
|
30
|
+
tier,
|
|
31
|
+
displayName: tierConfig?.displayName || tier,
|
|
32
|
+
color: tierConfig?.tierColor || null,
|
|
33
|
+
icon: tierConfig?.tierIcon || null,
|
|
34
|
+
byline: tierConfig?.tierByline || null,
|
|
35
|
+
points,
|
|
36
|
+
loyaltyNumber: member?.loyaltyNumber || '',
|
|
37
|
+
maxPerks: tierConfig?.maxPerksAllowed || 0,
|
|
38
|
+
};
|
|
39
|
+
return (0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: children(props) });
|
|
40
|
+
}
|
|
41
|
+
//# sourceMappingURL=TierCard.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TierCard.js","sourceRoot":"","sources":["../../../src/loyalty/components/TierCard.tsx"],"names":[],"mappings":";AAAA,YAAY,CAAC;;AAiCb,4BAgBC;;AA9CD,gEAAwD;AACxD,kEAA0D;AAW1D;;;;;;;;;;;;;;;;;GAiBG;AACH,SAAgB,QAAQ,CAAC,EAAE,QAAQ,EAAiB;IAClD,MAAM,EAAE,IAAI,EAAE,UAAU,EAAE,MAAM,EAAE,GAAG,IAAA,oCAAc,GAAE,CAAC;IACtD,MAAM,EAAE,MAAM,EAAE,GAAG,IAAA,8BAAW,GAAE,CAAC;IAEjC,MAAM,KAAK,GAAwB;QACjC,IAAI;QACJ,WAAW,EAAE,UAAU,EAAE,WAAW,IAAI,IAAI;QAC5C,KAAK,EAAE,UAAU,EAAE,SAAS,IAAI,IAAI;QACpC,IAAI,EAAE,UAAU,EAAE,QAAQ,IAAI,IAAI;QAClC,MAAM,EAAE,UAAU,EAAE,UAAU,IAAI,IAAI;QACtC,MAAM;QACN,aAAa,EAAE,MAAM,EAAE,aAAa,IAAI,EAAE;QAC1C,QAAQ,EAAE,UAAU,EAAE,eAAe,IAAI,CAAC;KAC3C,CAAC;IAEF,OAAO,2DAAG,QAAQ,CAAC,KAAK,CAAC,GAAI,CAAC;AAChC,CAAC"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { type ReactNode } from 'react';
|
|
2
|
+
import type { TierProgressRenderProps } from '../../types/loyalty';
|
|
3
|
+
interface TierProgressProps {
|
|
4
|
+
/**
|
|
5
|
+
* Render function that receives progress data
|
|
6
|
+
* Use this to build your own styled progress display
|
|
7
|
+
*/
|
|
8
|
+
children: (props: TierProgressRenderProps) => ReactNode;
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* Headless TierProgress component
|
|
12
|
+
*
|
|
13
|
+
* Provides progress toward next tier - you provide the UI.
|
|
14
|
+
*
|
|
15
|
+
* @example
|
|
16
|
+
* ```tsx
|
|
17
|
+
* <TierProgress>
|
|
18
|
+
* {({ currentTierName, nextTierName, percentage, pointsNeeded }) => (
|
|
19
|
+
* <div className="your-progress">
|
|
20
|
+
* <p>Current: {currentTierName}</p>
|
|
21
|
+
* <progress value={percentage} max={100} />
|
|
22
|
+
* {nextTierName && (
|
|
23
|
+
* <p>{pointsNeeded} points to {nextTierName}</p>
|
|
24
|
+
* )}
|
|
25
|
+
* </div>
|
|
26
|
+
* )}
|
|
27
|
+
* </TierProgress>
|
|
28
|
+
* ```
|
|
29
|
+
*/
|
|
30
|
+
export declare function TierProgress({ children }: TierProgressProps): import("react/jsx-runtime").JSX.Element;
|
|
31
|
+
export {};
|
|
32
|
+
//# sourceMappingURL=TierProgress.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TierProgress.d.ts","sourceRoot":"","sources":["../../../src/loyalty/components/TierProgress.tsx"],"names":[],"mappings":"AAEA,OAAc,EAAE,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;AAE9C,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,qBAAqB,CAAC;AAEnE,UAAU,iBAAiB;IACzB;;;OAGG;IACH,QAAQ,EAAE,CAAC,KAAK,EAAE,uBAAuB,KAAK,SAAS,CAAC;CACzD;AAED;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wBAAgB,YAAY,CAAC,EAAE,QAAQ,EAAE,EAAE,iBAAiB,2CAe3D"}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
'use client';
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
exports.TierProgress = TierProgress;
|
|
5
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
6
|
+
const AkinLoyaltyProvider_1 = require("../AkinLoyaltyProvider");
|
|
7
|
+
/**
|
|
8
|
+
* Headless TierProgress component
|
|
9
|
+
*
|
|
10
|
+
* Provides progress toward next tier - you provide the UI.
|
|
11
|
+
*
|
|
12
|
+
* @example
|
|
13
|
+
* ```tsx
|
|
14
|
+
* <TierProgress>
|
|
15
|
+
* {({ currentTierName, nextTierName, percentage, pointsNeeded }) => (
|
|
16
|
+
* <div className="your-progress">
|
|
17
|
+
* <p>Current: {currentTierName}</p>
|
|
18
|
+
* <progress value={percentage} max={100} />
|
|
19
|
+
* {nextTierName && (
|
|
20
|
+
* <p>{pointsNeeded} points to {nextTierName}</p>
|
|
21
|
+
* )}
|
|
22
|
+
* </div>
|
|
23
|
+
* )}
|
|
24
|
+
* </TierProgress>
|
|
25
|
+
* ```
|
|
26
|
+
*/
|
|
27
|
+
function TierProgress({ children }) {
|
|
28
|
+
const { tier, tierConfig, tierProgress } = (0, AkinLoyaltyProvider_1.useAkinLoyalty)();
|
|
29
|
+
const props = {
|
|
30
|
+
currentTier: tier,
|
|
31
|
+
currentTierName: tierConfig?.displayName || tier,
|
|
32
|
+
nextTier: tierProgress?.nextTier || null,
|
|
33
|
+
nextTierName: tierProgress?.nextTierConfig?.displayName || null,
|
|
34
|
+
percentage: tierProgress?.progressPercentage || 0,
|
|
35
|
+
pointsNeeded: tierProgress?.pointsToNextTier || 0,
|
|
36
|
+
totalStays: tierProgress?.totalStays || 0,
|
|
37
|
+
originStays: tierProgress?.originStays || 0,
|
|
38
|
+
};
|
|
39
|
+
return (0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: children(props) });
|
|
40
|
+
}
|
|
41
|
+
//# sourceMappingURL=TierProgress.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TierProgress.js","sourceRoot":"","sources":["../../../src/loyalty/components/TierProgress.tsx"],"names":[],"mappings":";AAAA,YAAY,CAAC;;AAkCb,oCAeC;;AA9CD,gEAAwD;AAWxD;;;;;;;;;;;;;;;;;;;GAmBG;AACH,SAAgB,YAAY,CAAC,EAAE,QAAQ,EAAqB;IAC1D,MAAM,EAAE,IAAI,EAAE,UAAU,EAAE,YAAY,EAAE,GAAG,IAAA,oCAAc,GAAE,CAAC;IAE5D,MAAM,KAAK,GAA4B;QACrC,WAAW,EAAE,IAAI;QACjB,eAAe,EAAE,UAAU,EAAE,WAAW,IAAI,IAAI;QAChD,QAAQ,EAAE,YAAY,EAAE,QAAQ,IAAI,IAAI;QACxC,YAAY,EAAE,YAAY,EAAE,cAAc,EAAE,WAAW,IAAI,IAAI;QAC/D,UAAU,EAAE,YAAY,EAAE,kBAAkB,IAAI,CAAC;QACjD,YAAY,EAAE,YAAY,EAAE,gBAAgB,IAAI,CAAC;QACjD,UAAU,EAAE,YAAY,EAAE,UAAU,IAAI,CAAC;QACzC,WAAW,EAAE,YAAY,EAAE,WAAW,IAAI,CAAC;KAC5C,CAAC;IAEF,OAAO,2DAAG,QAAQ,CAAC,KAAK,CAAC,GAAI,CAAC;AAChC,CAAC"}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import { type ReactNode } from 'react';
|
|
2
|
+
import type { TierRequirementsTableRenderProps } from '../../types/loyalty';
|
|
3
|
+
interface TierRequirementsTableProps {
|
|
4
|
+
/**
|
|
5
|
+
* Partner name for dynamic labels (e.g., "Haka stays")
|
|
6
|
+
* @default 'Origin'
|
|
7
|
+
*/
|
|
8
|
+
partnerName?: string;
|
|
9
|
+
/**
|
|
10
|
+
* Render function that receives tier requirements data
|
|
11
|
+
* Use this to build your own styled requirements table
|
|
12
|
+
*/
|
|
13
|
+
children: (props: TierRequirementsTableRenderProps) => ReactNode;
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* Headless TierRequirementsTable component
|
|
17
|
+
*
|
|
18
|
+
* Provides tier requirement data for building custom requirement tables.
|
|
19
|
+
* You provide the UI, we provide the data and utilities.
|
|
20
|
+
*
|
|
21
|
+
* @example
|
|
22
|
+
* ```tsx
|
|
23
|
+
* <TierRequirementsTable partnerName="Haka">
|
|
24
|
+
* {({ tierConfigs, requirementKeys, getRequirementLabel, formatValue, getRequirement }) => (
|
|
25
|
+
* <table>
|
|
26
|
+
* <thead>
|
|
27
|
+
* <tr>
|
|
28
|
+
* <th>Requirement</th>
|
|
29
|
+
* {tierConfigs.map(tier => <th key={tier.id}>{tier.displayName}</th>)}
|
|
30
|
+
* </tr>
|
|
31
|
+
* </thead>
|
|
32
|
+
* <tbody>
|
|
33
|
+
* {requirementKeys.map(key => (
|
|
34
|
+
* <tr key={key}>
|
|
35
|
+
* <td>{getRequirementLabel(key)}</td>
|
|
36
|
+
* {tierConfigs.map(tier => {
|
|
37
|
+
* const req = getRequirement(tier, key);
|
|
38
|
+
* return (
|
|
39
|
+
* <td key={tier.id}>
|
|
40
|
+
* {req ? formatValue(Number(req.requirementValue), req.operator) : '—'}
|
|
41
|
+
* </td>
|
|
42
|
+
* );
|
|
43
|
+
* })}
|
|
44
|
+
* </tr>
|
|
45
|
+
* ))}
|
|
46
|
+
* </tbody>
|
|
47
|
+
* </table>
|
|
48
|
+
* )}
|
|
49
|
+
* </TierRequirementsTable>
|
|
50
|
+
* ```
|
|
51
|
+
*/
|
|
52
|
+
export declare function TierRequirementsTable({ partnerName, children, }: TierRequirementsTableProps): import("react/jsx-runtime").JSX.Element;
|
|
53
|
+
export {};
|
|
54
|
+
//# sourceMappingURL=TierRequirementsTable.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TierRequirementsTable.d.ts","sourceRoot":"","sources":["../../../src/loyalty/components/TierRequirementsTable.tsx"],"names":[],"mappings":"AAEA,OAAc,EAAW,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;AAGvD,OAAO,KAAK,EAGV,gCAAgC,EAEjC,MAAM,qBAAqB,CAAC;AAE7B,UAAU,0BAA0B;IAClC;;;OAGG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB;;;OAGG;IACH,QAAQ,EAAE,CAAC,KAAK,EAAE,gCAAgC,KAAK,SAAS,CAAC;CAClE;AAqBD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoCG;AACH,wBAAgB,qBAAqB,CAAC,EACpC,WAAsB,EACtB,QAAQ,GACT,EAAE,0BAA0B,2CAiD5B"}
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
'use client';
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
exports.TierRequirementsTable = TierRequirementsTable;
|
|
5
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
6
|
+
const react_1 = require("react");
|
|
7
|
+
const AkinLoyaltyProvider_1 = require("../AkinLoyaltyProvider");
|
|
8
|
+
const tierLabels_1 = require("../../utils/tierLabels");
|
|
9
|
+
/**
|
|
10
|
+
* Format a value with its operator symbol
|
|
11
|
+
*/
|
|
12
|
+
function formatValue(value, operator) {
|
|
13
|
+
switch (operator) {
|
|
14
|
+
case 'gte':
|
|
15
|
+
return `${value}+`;
|
|
16
|
+
case 'gt':
|
|
17
|
+
return `>${value}`;
|
|
18
|
+
case 'lte':
|
|
19
|
+
return `≤${value}`;
|
|
20
|
+
case 'lt':
|
|
21
|
+
return `<${value}`;
|
|
22
|
+
case 'eq':
|
|
23
|
+
default:
|
|
24
|
+
return `${value}`;
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* Headless TierRequirementsTable component
|
|
29
|
+
*
|
|
30
|
+
* Provides tier requirement data for building custom requirement tables.
|
|
31
|
+
* You provide the UI, we provide the data and utilities.
|
|
32
|
+
*
|
|
33
|
+
* @example
|
|
34
|
+
* ```tsx
|
|
35
|
+
* <TierRequirementsTable partnerName="Haka">
|
|
36
|
+
* {({ tierConfigs, requirementKeys, getRequirementLabel, formatValue, getRequirement }) => (
|
|
37
|
+
* <table>
|
|
38
|
+
* <thead>
|
|
39
|
+
* <tr>
|
|
40
|
+
* <th>Requirement</th>
|
|
41
|
+
* {tierConfigs.map(tier => <th key={tier.id}>{tier.displayName}</th>)}
|
|
42
|
+
* </tr>
|
|
43
|
+
* </thead>
|
|
44
|
+
* <tbody>
|
|
45
|
+
* {requirementKeys.map(key => (
|
|
46
|
+
* <tr key={key}>
|
|
47
|
+
* <td>{getRequirementLabel(key)}</td>
|
|
48
|
+
* {tierConfigs.map(tier => {
|
|
49
|
+
* const req = getRequirement(tier, key);
|
|
50
|
+
* return (
|
|
51
|
+
* <td key={tier.id}>
|
|
52
|
+
* {req ? formatValue(Number(req.requirementValue), req.operator) : '—'}
|
|
53
|
+
* </td>
|
|
54
|
+
* );
|
|
55
|
+
* })}
|
|
56
|
+
* </tr>
|
|
57
|
+
* ))}
|
|
58
|
+
* </tbody>
|
|
59
|
+
* </table>
|
|
60
|
+
* )}
|
|
61
|
+
* </TierRequirementsTable>
|
|
62
|
+
* ```
|
|
63
|
+
*/
|
|
64
|
+
function TierRequirementsTable({ partnerName = 'Origin', children, }) {
|
|
65
|
+
const { tierConfigs, isLoading } = (0, AkinLoyaltyProvider_1.useAkinLoyalty)();
|
|
66
|
+
// Sort tiers by display order
|
|
67
|
+
const sortedTiers = (0, react_1.useMemo)(() => [...tierConfigs].sort((a, b) => a.displayOrder - b.displayOrder), [tierConfigs]);
|
|
68
|
+
// Extract unique requirement keys (sorted by priority)
|
|
69
|
+
const requirementKeys = (0, react_1.useMemo)(() => (0, tierLabels_1.extractRequirementKeys)(sortedTiers), [sortedTiers]);
|
|
70
|
+
// Build a map of requirement keys to displayNames (use first found displayName per key)
|
|
71
|
+
const displayNameMap = (0, react_1.useMemo)(() => {
|
|
72
|
+
const map = {};
|
|
73
|
+
sortedTiers.forEach((tier) => {
|
|
74
|
+
tier.requirements
|
|
75
|
+
?.filter((r) => r.active)
|
|
76
|
+
.forEach((req) => {
|
|
77
|
+
// Only set if not already set and displayName exists
|
|
78
|
+
if (!map[req.requirementKey] && req.displayName) {
|
|
79
|
+
map[req.requirementKey] = req.displayName;
|
|
80
|
+
}
|
|
81
|
+
});
|
|
82
|
+
});
|
|
83
|
+
return map;
|
|
84
|
+
}, [sortedTiers]);
|
|
85
|
+
// Get label for a requirement key (with custom displayName support)
|
|
86
|
+
const getRequirementLabel = (key, displayName) => {
|
|
87
|
+
return (0, tierLabels_1.getLabel)(key, partnerName, displayName ?? displayNameMap[key]);
|
|
88
|
+
};
|
|
89
|
+
// Get requirement for a specific tier and key
|
|
90
|
+
const getRequirement = (tier, key) => {
|
|
91
|
+
return tier.requirements?.find((r) => r.active && r.requirementKey === key);
|
|
92
|
+
};
|
|
93
|
+
const props = {
|
|
94
|
+
tierConfigs: sortedTiers,
|
|
95
|
+
requirementKeys,
|
|
96
|
+
getRequirementLabel,
|
|
97
|
+
formatValue,
|
|
98
|
+
getRequirement,
|
|
99
|
+
partnerName,
|
|
100
|
+
isLoading,
|
|
101
|
+
};
|
|
102
|
+
return (0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: children(props) });
|
|
103
|
+
}
|
|
104
|
+
//# sourceMappingURL=TierRequirementsTable.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TierRequirementsTable.js","sourceRoot":"","sources":["../../../src/loyalty/components/TierRequirementsTable.tsx"],"names":[],"mappings":";AAAA,YAAY,CAAC;;AAiFb,sDAoDC;;AAnID,iCAAuD;AACvD,gEAAwD;AACxD,uDAA0E;AAqB1E;;GAEG;AACH,SAAS,WAAW,CAAC,KAAa,EAAE,QAA6B;IAC/D,QAAQ,QAAQ,EAAE,CAAC;QACjB,KAAK,KAAK;YACR,OAAO,GAAG,KAAK,GAAG,CAAC;QACrB,KAAK,IAAI;YACP,OAAO,IAAI,KAAK,EAAE,CAAC;QACrB,KAAK,KAAK;YACR,OAAO,IAAI,KAAK,EAAE,CAAC;QACrB,KAAK,IAAI;YACP,OAAO,IAAI,KAAK,EAAE,CAAC;QACrB,KAAK,IAAI,CAAC;QACV;YACE,OAAO,GAAG,KAAK,EAAE,CAAC;IACtB,CAAC;AACH,CAAC;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoCG;AACH,SAAgB,qBAAqB,CAAC,EACpC,WAAW,GAAG,QAAQ,EACtB,QAAQ,GACmB;IAC3B,MAAM,EAAE,WAAW,EAAE,SAAS,EAAE,GAAG,IAAA,oCAAc,GAAE,CAAC;IAEpD,8BAA8B;IAC9B,MAAM,WAAW,GAAG,IAAA,eAAO,EACzB,GAAG,EAAE,CAAC,CAAC,GAAG,WAAW,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,YAAY,GAAG,CAAC,CAAC,YAAY,CAAC,EACtE,CAAC,WAAW,CAAC,CACd,CAAC;IAEF,uDAAuD;IACvD,MAAM,eAAe,GAAG,IAAA,eAAO,EAAC,GAAG,EAAE,CAAC,IAAA,mCAAsB,EAAC,WAAW,CAAC,EAAE,CAAC,WAAW,CAAC,CAAC,CAAC;IAE1F,wFAAwF;IACxF,MAAM,cAAc,GAAG,IAAA,eAAO,EAAC,GAAG,EAAE;QAClC,MAAM,GAAG,GAAuC,EAAE,CAAC;QACnD,WAAW,CAAC,OAAO,CAAC,CAAC,IAAI,EAAE,EAAE;YAC3B,IAAI,CAAC,YAAY;gBACf,EAAE,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,MAAM,CAAC;iBACxB,OAAO,CAAC,CAAC,GAAG,EAAE,EAAE;gBACf,qDAAqD;gBACrD,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,cAAc,CAAC,IAAI,GAAG,CAAC,WAAW,EAAE,CAAC;oBAChD,GAAG,CAAC,GAAG,CAAC,cAAc,CAAC,GAAG,GAAG,CAAC,WAAW,CAAC;gBAC5C,CAAC;YACH,CAAC,CAAC,CAAC;QACP,CAAC,CAAC,CAAC;QACH,OAAO,GAAG,CAAC;IACb,CAAC,EAAE,CAAC,WAAW,CAAC,CAAC,CAAC;IAElB,oEAAoE;IACpE,MAAM,mBAAmB,GAAG,CAAC,GAAW,EAAE,WAA2B,EAAU,EAAE;QAC/E,OAAO,IAAA,qBAAQ,EAAC,GAAG,EAAE,WAAW,EAAE,WAAW,IAAI,cAAc,CAAC,GAAG,CAAC,CAAC,CAAC;IACxE,CAAC,CAAC;IAEF,8CAA8C;IAC9C,MAAM,cAAc,GAAG,CAAC,IAAgB,EAAE,GAAW,EAA+B,EAAE;QACpF,OAAO,IAAI,CAAC,YAAY,EAAE,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,MAAM,IAAI,CAAC,CAAC,cAAc,KAAK,GAAG,CAAC,CAAC;IAC9E,CAAC,CAAC;IAEF,MAAM,KAAK,GAAqC;QAC9C,WAAW,EAAE,WAAW;QACxB,eAAe;QACf,mBAAmB;QACnB,WAAW;QACX,cAAc;QACd,WAAW;QACX,SAAS;KACV,CAAC;IAEF,OAAO,2DAAG,QAAQ,CAAC,KAAK,CAAC,GAAI,CAAC;AAChC,CAAC"}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { type ReactNode } from 'react';
|
|
2
|
+
import type { TransactionListRenderProps } from '../../types/loyalty';
|
|
3
|
+
interface TransactionListProps {
|
|
4
|
+
/**
|
|
5
|
+
* Render function that receives transaction data
|
|
6
|
+
* Use this to build your own styled transaction list
|
|
7
|
+
*/
|
|
8
|
+
children: (props: TransactionListRenderProps) => ReactNode;
|
|
9
|
+
/**
|
|
10
|
+
* Number of transactions to load initially and per page
|
|
11
|
+
* @default 10
|
|
12
|
+
*/
|
|
13
|
+
limit?: number;
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* Headless TransactionList component
|
|
17
|
+
*
|
|
18
|
+
* Provides transaction history with pagination - you provide the UI.
|
|
19
|
+
*
|
|
20
|
+
* @example
|
|
21
|
+
* ```tsx
|
|
22
|
+
* <TransactionList limit={10}>
|
|
23
|
+
* {({ transactions, isLoading, hasMore, loadMore }) => (
|
|
24
|
+
* <div className="your-transactions">
|
|
25
|
+
* <ul>
|
|
26
|
+
* {transactions.map(tx => (
|
|
27
|
+
* <li key={tx.id}>
|
|
28
|
+
* {tx.reason}: {tx.pointsChange > 0 ? '+' : ''}{tx.pointsChange}
|
|
29
|
+
* </li>
|
|
30
|
+
* ))}
|
|
31
|
+
* </ul>
|
|
32
|
+
* {hasMore && (
|
|
33
|
+
* <button onClick={loadMore} disabled={isLoading}>
|
|
34
|
+
* {isLoading ? 'Loading...' : 'Load More'}
|
|
35
|
+
* </button>
|
|
36
|
+
* )}
|
|
37
|
+
* </div>
|
|
38
|
+
* )}
|
|
39
|
+
* </TransactionList>
|
|
40
|
+
* ```
|
|
41
|
+
*/
|
|
42
|
+
export declare function TransactionList({ children, limit }: TransactionListProps): import("react/jsx-runtime").JSX.Element;
|
|
43
|
+
export {};
|
|
44
|
+
//# sourceMappingURL=TransactionList.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TransactionList.d.ts","sourceRoot":"","sources":["../../../src/loyalty/components/TransactionList.tsx"],"names":[],"mappings":"AAEA,OAAc,EAAyB,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;AAErE,OAAO,KAAK,EAAE,0BAA0B,EAAsB,MAAM,qBAAqB,CAAC;AAE1F,UAAU,oBAAoB;IAC5B;;;OAGG;IACH,QAAQ,EAAE,CAAC,KAAK,EAAE,0BAA0B,KAAK,SAAS,CAAC;IAE3D;;;OAGG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AACH,wBAAgB,eAAe,CAAC,EAAE,QAAQ,EAAE,KAAU,EAAE,EAAE,oBAAoB,2CAiD7E"}
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
'use client';
|
|
3
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
4
|
+
if (k2 === undefined) k2 = k;
|
|
5
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
6
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
7
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
8
|
+
}
|
|
9
|
+
Object.defineProperty(o, k2, desc);
|
|
10
|
+
}) : (function(o, m, k, k2) {
|
|
11
|
+
if (k2 === undefined) k2 = k;
|
|
12
|
+
o[k2] = m[k];
|
|
13
|
+
}));
|
|
14
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
15
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
16
|
+
}) : function(o, v) {
|
|
17
|
+
o["default"] = v;
|
|
18
|
+
});
|
|
19
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
20
|
+
var ownKeys = function(o) {
|
|
21
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
22
|
+
var ar = [];
|
|
23
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
24
|
+
return ar;
|
|
25
|
+
};
|
|
26
|
+
return ownKeys(o);
|
|
27
|
+
};
|
|
28
|
+
return function (mod) {
|
|
29
|
+
if (mod && mod.__esModule) return mod;
|
|
30
|
+
var result = {};
|
|
31
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
32
|
+
__setModuleDefault(result, mod);
|
|
33
|
+
return result;
|
|
34
|
+
};
|
|
35
|
+
})();
|
|
36
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
37
|
+
exports.TransactionList = TransactionList;
|
|
38
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
39
|
+
const react_1 = __importStar(require("react"));
|
|
40
|
+
const AkinLoyaltyProvider_1 = require("../AkinLoyaltyProvider");
|
|
41
|
+
/**
|
|
42
|
+
* Headless TransactionList component
|
|
43
|
+
*
|
|
44
|
+
* Provides transaction history with pagination - you provide the UI.
|
|
45
|
+
*
|
|
46
|
+
* @example
|
|
47
|
+
* ```tsx
|
|
48
|
+
* <TransactionList limit={10}>
|
|
49
|
+
* {({ transactions, isLoading, hasMore, loadMore }) => (
|
|
50
|
+
* <div className="your-transactions">
|
|
51
|
+
* <ul>
|
|
52
|
+
* {transactions.map(tx => (
|
|
53
|
+
* <li key={tx.id}>
|
|
54
|
+
* {tx.reason}: {tx.pointsChange > 0 ? '+' : ''}{tx.pointsChange}
|
|
55
|
+
* </li>
|
|
56
|
+
* ))}
|
|
57
|
+
* </ul>
|
|
58
|
+
* {hasMore && (
|
|
59
|
+
* <button onClick={loadMore} disabled={isLoading}>
|
|
60
|
+
* {isLoading ? 'Loading...' : 'Load More'}
|
|
61
|
+
* </button>
|
|
62
|
+
* )}
|
|
63
|
+
* </div>
|
|
64
|
+
* )}
|
|
65
|
+
* </TransactionList>
|
|
66
|
+
* ```
|
|
67
|
+
*/
|
|
68
|
+
function TransactionList({ children, limit = 10 }) {
|
|
69
|
+
const { transactions: initialTransactions, getTransactionHistory, isLoading: contextLoading } = (0, AkinLoyaltyProvider_1.useAkinLoyalty)();
|
|
70
|
+
const [transactions, setTransactions] = (0, react_1.useState)(initialTransactions);
|
|
71
|
+
const [isLoading, setIsLoading] = (0, react_1.useState)(false);
|
|
72
|
+
const [hasMore, setHasMore] = (0, react_1.useState)(true);
|
|
73
|
+
const [offset, setOffset] = (0, react_1.useState)(0);
|
|
74
|
+
// Update when initial transactions change
|
|
75
|
+
react_1.default.useEffect(() => {
|
|
76
|
+
setTransactions(initialTransactions);
|
|
77
|
+
setOffset(initialTransactions.length);
|
|
78
|
+
setHasMore(initialTransactions.length >= limit);
|
|
79
|
+
}, [initialTransactions, limit]);
|
|
80
|
+
const loadMore = (0, react_1.useCallback)(async () => {
|
|
81
|
+
if (isLoading || !hasMore)
|
|
82
|
+
return;
|
|
83
|
+
setIsLoading(true);
|
|
84
|
+
try {
|
|
85
|
+
const newTransactions = await getTransactionHistory({
|
|
86
|
+
limit,
|
|
87
|
+
offset,
|
|
88
|
+
});
|
|
89
|
+
if (newTransactions.length < limit) {
|
|
90
|
+
setHasMore(false);
|
|
91
|
+
}
|
|
92
|
+
if (newTransactions.length > 0) {
|
|
93
|
+
setTransactions((prev) => [...prev, ...newTransactions]);
|
|
94
|
+
setOffset((prev) => prev + newTransactions.length);
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
catch {
|
|
98
|
+
// Error is handled by the context
|
|
99
|
+
}
|
|
100
|
+
finally {
|
|
101
|
+
setIsLoading(false);
|
|
102
|
+
}
|
|
103
|
+
}, [isLoading, hasMore, getTransactionHistory, limit, offset]);
|
|
104
|
+
const props = {
|
|
105
|
+
transactions,
|
|
106
|
+
isLoading: isLoading || contextLoading,
|
|
107
|
+
hasMore,
|
|
108
|
+
loadMore,
|
|
109
|
+
};
|
|
110
|
+
return (0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: children(props) });
|
|
111
|
+
}
|
|
112
|
+
//# sourceMappingURL=TransactionList.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TransactionList.js","sourceRoot":"","sources":["../../../src/loyalty/components/TransactionList.tsx"],"names":[],"mappings":";AAAA,YAAY,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA+Cb,0CAiDC;;AA9FD,+CAAqE;AACrE,gEAAwD;AAiBxD;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AACH,SAAgB,eAAe,CAAC,EAAE,QAAQ,EAAE,KAAK,GAAG,EAAE,EAAwB;IAC5E,MAAM,EAAE,YAAY,EAAE,mBAAmB,EAAE,qBAAqB,EAAE,SAAS,EAAE,cAAc,EAAE,GAAG,IAAA,oCAAc,GAAE,CAAC;IAEjH,MAAM,CAAC,YAAY,EAAE,eAAe,CAAC,GAAG,IAAA,gBAAQ,EAAuB,mBAAmB,CAAC,CAAC;IAC5F,MAAM,CAAC,SAAS,EAAE,YAAY,CAAC,GAAG,IAAA,gBAAQ,EAAC,KAAK,CAAC,CAAC;IAClD,MAAM,CAAC,OAAO,EAAE,UAAU,CAAC,GAAG,IAAA,gBAAQ,EAAC,IAAI,CAAC,CAAC;IAC7C,MAAM,CAAC,MAAM,EAAE,SAAS,CAAC,GAAG,IAAA,gBAAQ,EAAC,CAAC,CAAC,CAAC;IAExC,0CAA0C;IAC1C,eAAK,CAAC,SAAS,CAAC,GAAG,EAAE;QACnB,eAAe,CAAC,mBAAmB,CAAC,CAAC;QACrC,SAAS,CAAC,mBAAmB,CAAC,MAAM,CAAC,CAAC;QACtC,UAAU,CAAC,mBAAmB,CAAC,MAAM,IAAI,KAAK,CAAC,CAAC;IAClD,CAAC,EAAE,CAAC,mBAAmB,EAAE,KAAK,CAAC,CAAC,CAAC;IAEjC,MAAM,QAAQ,GAAG,IAAA,mBAAW,EAAC,KAAK,IAAI,EAAE;QACtC,IAAI,SAAS,IAAI,CAAC,OAAO;YAAE,OAAO;QAElC,YAAY,CAAC,IAAI,CAAC,CAAC;QAEnB,IAAI,CAAC;YACH,MAAM,eAAe,GAAG,MAAM,qBAAqB,CAAC;gBAClD,KAAK;gBACL,MAAM;aACP,CAAC,CAAC;YAEH,IAAI,eAAe,CAAC,MAAM,GAAG,KAAK,EAAE,CAAC;gBACnC,UAAU,CAAC,KAAK,CAAC,CAAC;YACpB,CAAC;YAED,IAAI,eAAe,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;gBAC/B,eAAe,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC,GAAG,IAAI,EAAE,GAAG,eAAe,CAAC,CAAC,CAAC;gBACzD,SAAS,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,GAAG,eAAe,CAAC,MAAM,CAAC,CAAC;YACrD,CAAC;QACH,CAAC;QAAC,MAAM,CAAC;YACP,kCAAkC;QACpC,CAAC;gBAAS,CAAC;YACT,YAAY,CAAC,KAAK,CAAC,CAAC;QACtB,CAAC;IACH,CAAC,EAAE,CAAC,SAAS,EAAE,OAAO,EAAE,qBAAqB,EAAE,KAAK,EAAE,MAAM,CAAC,CAAC,CAAC;IAE/D,MAAM,KAAK,GAA+B;QACxC,YAAY;QACZ,SAAS,EAAE,SAAS,IAAI,cAAc;QACtC,OAAO;QACP,QAAQ;KACT,CAAC;IAEF,OAAO,2DAAG,QAAQ,CAAC,KAAK,CAAC,GAAI,CAAC;AAChC,CAAC"}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { type ReactNode } from 'react';
|
|
2
|
+
import type { UpcomingStaysRenderProps } from '../../types/loyalty';
|
|
3
|
+
interface UpcomingStaysProps {
|
|
4
|
+
/**
|
|
5
|
+
* Render function that receives upcoming stays data
|
|
6
|
+
* Use this to build your own styled upcoming stays list
|
|
7
|
+
*/
|
|
8
|
+
children: (props: UpcomingStaysRenderProps) => ReactNode;
|
|
9
|
+
/**
|
|
10
|
+
* Maximum number of stays to display
|
|
11
|
+
* @default 10
|
|
12
|
+
*/
|
|
13
|
+
limit?: number;
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* Headless UpcomingStays component
|
|
17
|
+
*
|
|
18
|
+
* Provides upcoming stay data for display.
|
|
19
|
+
* Shows stays with future check-in dates.
|
|
20
|
+
*
|
|
21
|
+
* @example
|
|
22
|
+
* ```tsx
|
|
23
|
+
* <UpcomingStays limit={5}>
|
|
24
|
+
* {({ stays, isEmpty, isLoading }) => (
|
|
25
|
+
* <div className="upcoming-stays">
|
|
26
|
+
* <h2>Upcoming Stays</h2>
|
|
27
|
+
* {isLoading ? (
|
|
28
|
+
* <p>Loading...</p>
|
|
29
|
+
* ) : isEmpty ? (
|
|
30
|
+
* <p>No upcoming stays. Book your next adventure!</p>
|
|
31
|
+
* ) : (
|
|
32
|
+
* <ul>
|
|
33
|
+
* {stays.map((stay) => (
|
|
34
|
+
* <li key={stay.id}>
|
|
35
|
+
* <strong>{stay.propertyName}</strong>
|
|
36
|
+
* <span>{new Date(stay.checkIn).toLocaleDateString()}</span>
|
|
37
|
+
* <span>{stay.nights} nights</span>
|
|
38
|
+
* </li>
|
|
39
|
+
* ))}
|
|
40
|
+
* </ul>
|
|
41
|
+
* )}
|
|
42
|
+
* </div>
|
|
43
|
+
* )}
|
|
44
|
+
* </UpcomingStays>
|
|
45
|
+
* ```
|
|
46
|
+
*/
|
|
47
|
+
export declare function UpcomingStays({ children, limit }: UpcomingStaysProps): import("react/jsx-runtime").JSX.Element;
|
|
48
|
+
export {};
|
|
49
|
+
//# sourceMappingURL=UpcomingStays.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"UpcomingStays.d.ts","sourceRoot":"","sources":["../../../src/loyalty/components/UpcomingStays.tsx"],"names":[],"mappings":"AAEA,OAAc,EAAE,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;AAE9C,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,qBAAqB,CAAC;AAEpE,UAAU,kBAAkB;IAC1B;;;OAGG;IACH,QAAQ,EAAE,CAAC,KAAK,EAAE,wBAAwB,KAAK,SAAS,CAAC;IAEzD;;;OAGG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AACH,wBAAgB,aAAa,CAAC,EAAE,QAAQ,EAAE,KAAU,EAAE,EAAE,kBAAkB,2CAmBzE"}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
'use client';
|
|
3
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
4
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
5
|
+
};
|
|
6
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
+
exports.UpcomingStays = UpcomingStays;
|
|
8
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
9
|
+
const react_1 = __importDefault(require("react"));
|
|
10
|
+
const AkinLoyaltyProvider_1 = require("../AkinLoyaltyProvider");
|
|
11
|
+
/**
|
|
12
|
+
* Headless UpcomingStays component
|
|
13
|
+
*
|
|
14
|
+
* Provides upcoming stay data for display.
|
|
15
|
+
* Shows stays with future check-in dates.
|
|
16
|
+
*
|
|
17
|
+
* @example
|
|
18
|
+
* ```tsx
|
|
19
|
+
* <UpcomingStays limit={5}>
|
|
20
|
+
* {({ stays, isEmpty, isLoading }) => (
|
|
21
|
+
* <div className="upcoming-stays">
|
|
22
|
+
* <h2>Upcoming Stays</h2>
|
|
23
|
+
* {isLoading ? (
|
|
24
|
+
* <p>Loading...</p>
|
|
25
|
+
* ) : isEmpty ? (
|
|
26
|
+
* <p>No upcoming stays. Book your next adventure!</p>
|
|
27
|
+
* ) : (
|
|
28
|
+
* <ul>
|
|
29
|
+
* {stays.map((stay) => (
|
|
30
|
+
* <li key={stay.id}>
|
|
31
|
+
* <strong>{stay.propertyName}</strong>
|
|
32
|
+
* <span>{new Date(stay.checkIn).toLocaleDateString()}</span>
|
|
33
|
+
* <span>{stay.nights} nights</span>
|
|
34
|
+
* </li>
|
|
35
|
+
* ))}
|
|
36
|
+
* </ul>
|
|
37
|
+
* )}
|
|
38
|
+
* </div>
|
|
39
|
+
* )}
|
|
40
|
+
* </UpcomingStays>
|
|
41
|
+
* ```
|
|
42
|
+
*/
|
|
43
|
+
function UpcomingStays({ children, limit = 10 }) {
|
|
44
|
+
const { upcomingStays, isLoading } = (0, AkinLoyaltyProvider_1.useAkinLoyalty)();
|
|
45
|
+
const displayedStays = react_1.default.useMemo(() => {
|
|
46
|
+
return upcomingStays.slice(0, limit);
|
|
47
|
+
}, [upcomingStays, limit]);
|
|
48
|
+
const props = {
|
|
49
|
+
stays: displayedStays,
|
|
50
|
+
isLoading,
|
|
51
|
+
hasMore: upcomingStays.length > limit,
|
|
52
|
+
loadMore: () => {
|
|
53
|
+
// For now, no-op as we load all bookings upfront
|
|
54
|
+
// Could be extended to support pagination
|
|
55
|
+
},
|
|
56
|
+
isEmpty: upcomingStays.length === 0,
|
|
57
|
+
};
|
|
58
|
+
return (0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: children(props) });
|
|
59
|
+
}
|
|
60
|
+
//# sourceMappingURL=UpcomingStays.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"UpcomingStays.js","sourceRoot":"","sources":["../../../src/loyalty/components/UpcomingStays.tsx"],"names":[],"mappings":";AAAA,YAAY,CAAC;;;;;AAoDb,sCAmBC;;AArED,kDAA8C;AAC9C,gEAAwD;AAiBxD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AACH,SAAgB,aAAa,CAAC,EAAE,QAAQ,EAAE,KAAK,GAAG,EAAE,EAAsB;IACxE,MAAM,EAAE,aAAa,EAAE,SAAS,EAAE,GAAG,IAAA,oCAAc,GAAE,CAAC;IAEtD,MAAM,cAAc,GAAG,eAAK,CAAC,OAAO,CAAC,GAAG,EAAE;QACxC,OAAO,aAAa,CAAC,KAAK,CAAC,CAAC,EAAE,KAAK,CAAC,CAAC;IACvC,CAAC,EAAE,CAAC,aAAa,EAAE,KAAK,CAAC,CAAC,CAAC;IAE3B,MAAM,KAAK,GAA6B;QACtC,KAAK,EAAE,cAAc;QACrB,SAAS;QACT,OAAO,EAAE,aAAa,CAAC,MAAM,GAAG,KAAK;QACrC,QAAQ,EAAE,GAAG,EAAE;YACb,iDAAiD;YACjD,0CAA0C;QAC5C,CAAC;QACD,OAAO,EAAE,aAAa,CAAC,MAAM,KAAK,CAAC;KACpC,CAAC;IAEF,OAAO,2DAAG,QAAQ,CAAC,KAAK,CAAC,GAAI,CAAC;AAChC,CAAC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export { AkinLoyaltyProvider, useAkinLoyalty } from './AkinLoyaltyProvider';
|
|
2
|
+
export { TierCard } from './components/TierCard';
|
|
3
|
+
export { TierProgress } from './components/TierProgress';
|
|
4
|
+
export { TransactionList } from './components/TransactionList';
|
|
5
|
+
export { PointsDisplay } from './components/PointsDisplay';
|
|
6
|
+
export { TierRequirementsTable } from './components/TierRequirementsTable';
|
|
7
|
+
export { SimpleTierCards } from './components/SimpleTierCards';
|
|
8
|
+
export { LoyaltyCard } from './components/LoyaltyCard';
|
|
9
|
+
export { UpcomingStays } from './components/UpcomingStays';
|
|
10
|
+
export { PreviousStays } from './components/PreviousStays';
|
|
11
|
+
export type { TierConfig, TierProgress as TierProgressType, LoyaltyTransaction, MemberTierHistory, TransactionType, TierChangeReason, LoyaltyState, LoyaltyActions, LoyaltyContextValue, TierCardRenderProps, TierProgressRenderProps, TransactionListRenderProps, TierRequirement, RequirementValueType, RequirementOperator, TierRequirementsTableRenderProps, SimpleTierCardsRenderProps, BookingStatus, MemberStay, LoyaltyCardRenderProps, UpcomingStaysRenderProps, PreviousStaysRenderProps, } from '../types/loyalty';
|
|
12
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/loyalty/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,mBAAmB,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAG5E,OAAO,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AACjD,OAAO,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AACzD,OAAO,EAAE,eAAe,EAAE,MAAM,8BAA8B,CAAC;AAC/D,OAAO,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;AAC3D,OAAO,EAAE,qBAAqB,EAAE,MAAM,oCAAoC,CAAC;AAC3E,OAAO,EAAE,eAAe,EAAE,MAAM,8BAA8B,CAAC;AAC/D,OAAO,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AACvD,OAAO,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;AAC3D,OAAO,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;AAG3D,YAAY,EACV,UAAU,EACV,YAAY,IAAI,gBAAgB,EAChC,kBAAkB,EAClB,iBAAiB,EACjB,eAAe,EACf,gBAAgB,EAChB,YAAY,EACZ,cAAc,EACd,mBAAmB,EACnB,mBAAmB,EACnB,uBAAuB,EACvB,0BAA0B,EAE1B,eAAe,EACf,oBAAoB,EACpB,mBAAmB,EACnB,gCAAgC,EAChC,0BAA0B,EAE1B,aAAa,EACb,UAAU,EACV,sBAAsB,EACtB,wBAAwB,EACxB,wBAAwB,GACzB,MAAM,kBAAkB,CAAC"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.PreviousStays = exports.UpcomingStays = exports.LoyaltyCard = exports.SimpleTierCards = exports.TierRequirementsTable = exports.PointsDisplay = exports.TransactionList = exports.TierProgress = exports.TierCard = exports.useAkinLoyalty = exports.AkinLoyaltyProvider = void 0;
|
|
4
|
+
// Loyalty provider and hooks
|
|
5
|
+
var AkinLoyaltyProvider_1 = require("./AkinLoyaltyProvider");
|
|
6
|
+
Object.defineProperty(exports, "AkinLoyaltyProvider", { enumerable: true, get: function () { return AkinLoyaltyProvider_1.AkinLoyaltyProvider; } });
|
|
7
|
+
Object.defineProperty(exports, "useAkinLoyalty", { enumerable: true, get: function () { return AkinLoyaltyProvider_1.useAkinLoyalty; } });
|
|
8
|
+
// Headless components
|
|
9
|
+
var TierCard_1 = require("./components/TierCard");
|
|
10
|
+
Object.defineProperty(exports, "TierCard", { enumerable: true, get: function () { return TierCard_1.TierCard; } });
|
|
11
|
+
var TierProgress_1 = require("./components/TierProgress");
|
|
12
|
+
Object.defineProperty(exports, "TierProgress", { enumerable: true, get: function () { return TierProgress_1.TierProgress; } });
|
|
13
|
+
var TransactionList_1 = require("./components/TransactionList");
|
|
14
|
+
Object.defineProperty(exports, "TransactionList", { enumerable: true, get: function () { return TransactionList_1.TransactionList; } });
|
|
15
|
+
var PointsDisplay_1 = require("./components/PointsDisplay");
|
|
16
|
+
Object.defineProperty(exports, "PointsDisplay", { enumerable: true, get: function () { return PointsDisplay_1.PointsDisplay; } });
|
|
17
|
+
var TierRequirementsTable_1 = require("./components/TierRequirementsTable");
|
|
18
|
+
Object.defineProperty(exports, "TierRequirementsTable", { enumerable: true, get: function () { return TierRequirementsTable_1.TierRequirementsTable; } });
|
|
19
|
+
var SimpleTierCards_1 = require("./components/SimpleTierCards");
|
|
20
|
+
Object.defineProperty(exports, "SimpleTierCards", { enumerable: true, get: function () { return SimpleTierCards_1.SimpleTierCards; } });
|
|
21
|
+
var LoyaltyCard_1 = require("./components/LoyaltyCard");
|
|
22
|
+
Object.defineProperty(exports, "LoyaltyCard", { enumerable: true, get: function () { return LoyaltyCard_1.LoyaltyCard; } });
|
|
23
|
+
var UpcomingStays_1 = require("./components/UpcomingStays");
|
|
24
|
+
Object.defineProperty(exports, "UpcomingStays", { enumerable: true, get: function () { return UpcomingStays_1.UpcomingStays; } });
|
|
25
|
+
var PreviousStays_1 = require("./components/PreviousStays");
|
|
26
|
+
Object.defineProperty(exports, "PreviousStays", { enumerable: true, get: function () { return PreviousStays_1.PreviousStays; } });
|
|
27
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/loyalty/index.ts"],"names":[],"mappings":";;;AAAA,6BAA6B;AAC7B,6DAA4E;AAAnE,0HAAA,mBAAmB,OAAA;AAAE,qHAAA,cAAc,OAAA;AAE5C,sBAAsB;AACtB,kDAAiD;AAAxC,oGAAA,QAAQ,OAAA;AACjB,0DAAyD;AAAhD,4GAAA,YAAY,OAAA;AACrB,gEAA+D;AAAtD,kHAAA,eAAe,OAAA;AACxB,4DAA2D;AAAlD,8GAAA,aAAa,OAAA;AACtB,4EAA2E;AAAlE,8HAAA,qBAAqB,OAAA;AAC9B,gEAA+D;AAAtD,kHAAA,eAAe,OAAA;AACxB,wDAAuD;AAA9C,0GAAA,WAAW,OAAA;AACpB,4DAA2D;AAAlD,8GAAA,aAAa,OAAA;AACtB,4DAA2D;AAAlD,8GAAA,aAAa,OAAA"}
|