@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 @@
|
|
|
1
|
+
{"version":3,"file":"i18n.js","sourceRoot":"","sources":["../../src/types/i18n.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
export type { MemberTier, MemberStatus, AkinUser, AkinMember, AuthState, AuthActions, AuthContextValue, SignUpData, PasswordlessSignUpData, LoginMode, LoginFormRenderProps, SignupFormRenderProps, MagicLinkFormRenderProps, } from './auth';
|
|
2
|
+
export type { TierConfig, TierProgress, LoyaltyTransaction, MemberTierHistory, TransactionType, TierChangeReason, LoyaltyState, LoyaltyActions, LoyaltyContextValue, TierCardRenderProps, TierProgressRenderProps, TransactionListRenderProps, } from './loyalty';
|
|
3
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/types/index.ts"],"names":[],"mappings":"AACA,YAAY,EACV,UAAU,EACV,YAAY,EACZ,QAAQ,EACR,UAAU,EACV,SAAS,EACT,WAAW,EACX,gBAAgB,EAChB,UAAU,EACV,sBAAsB,EACtB,SAAS,EACT,oBAAoB,EACpB,qBAAqB,EACrB,wBAAwB,GACzB,MAAM,QAAQ,CAAC;AAGhB,YAAY,EACV,UAAU,EACV,YAAY,EACZ,kBAAkB,EAClB,iBAAiB,EACjB,eAAe,EACf,gBAAgB,EAChB,YAAY,EACZ,cAAc,EACd,mBAAmB,EACnB,mBAAmB,EACnB,uBAAuB,EACvB,0BAA0B,GAC3B,MAAM,WAAW,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/types/index.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,312 @@
|
|
|
1
|
+
import type { MemberTier } from './auth';
|
|
2
|
+
export type { MemberTier };
|
|
3
|
+
/**
|
|
4
|
+
* Value type for tier requirements
|
|
5
|
+
*/
|
|
6
|
+
export type RequirementValueType = 'INT' | 'FLOAT' | 'DATE' | 'STRING';
|
|
7
|
+
/**
|
|
8
|
+
* Comparison operator for tier requirements
|
|
9
|
+
*/
|
|
10
|
+
export type RequirementOperator = 'eq' | 'gt' | 'gte' | 'lt' | 'lte';
|
|
11
|
+
/**
|
|
12
|
+
* A single tier requirement (key/value qualification rule)
|
|
13
|
+
*/
|
|
14
|
+
export interface TierRequirement {
|
|
15
|
+
id: string;
|
|
16
|
+
tierConfigId: string;
|
|
17
|
+
requirementKey: string;
|
|
18
|
+
requirementValue: string;
|
|
19
|
+
valueType: RequirementValueType;
|
|
20
|
+
operator: RequirementOperator;
|
|
21
|
+
logicGroup: number;
|
|
22
|
+
displayOrder: number;
|
|
23
|
+
displayName?: string;
|
|
24
|
+
active: boolean;
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* Loyalty tier configuration
|
|
28
|
+
*/
|
|
29
|
+
export interface TierConfig {
|
|
30
|
+
id: string;
|
|
31
|
+
tierName: MemberTier;
|
|
32
|
+
displayName: string;
|
|
33
|
+
displayOrder: number;
|
|
34
|
+
maxPerksAllowed: number;
|
|
35
|
+
tierColor?: string;
|
|
36
|
+
tierIcon?: string;
|
|
37
|
+
tierByline?: string;
|
|
38
|
+
eligibility?: string;
|
|
39
|
+
/** Key/value tier requirements */
|
|
40
|
+
requirements?: TierRequirement[];
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* Progress toward next tier
|
|
44
|
+
*/
|
|
45
|
+
export interface TierProgress {
|
|
46
|
+
currentTier: MemberTier;
|
|
47
|
+
currentTierConfig: TierConfig;
|
|
48
|
+
nextTier: MemberTier | null;
|
|
49
|
+
nextTierConfig: TierConfig | null;
|
|
50
|
+
pointsToNextTier: number;
|
|
51
|
+
progressPercentage: number;
|
|
52
|
+
totalStays: number;
|
|
53
|
+
originStays: number;
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* Transaction type for loyalty transactions
|
|
57
|
+
*/
|
|
58
|
+
export type TransactionType = 'EARNED' | 'SPENT' | 'EXPIRED' | 'ADJUSTED';
|
|
59
|
+
/**
|
|
60
|
+
* A single loyalty transaction
|
|
61
|
+
*/
|
|
62
|
+
export interface LoyaltyTransaction {
|
|
63
|
+
id: string;
|
|
64
|
+
memberId: string;
|
|
65
|
+
bookingId?: string;
|
|
66
|
+
pointsChange: number;
|
|
67
|
+
transactionType: TransactionType;
|
|
68
|
+
reason?: string;
|
|
69
|
+
description?: string;
|
|
70
|
+
balanceAfter: number;
|
|
71
|
+
createdAt: Date;
|
|
72
|
+
}
|
|
73
|
+
/**
|
|
74
|
+
* Tier change reason
|
|
75
|
+
*/
|
|
76
|
+
export type TierChangeReason = 'POINTS' | 'STAYS' | 'PROMOTION' | 'MANUAL';
|
|
77
|
+
/**
|
|
78
|
+
* A record of a tier change
|
|
79
|
+
*/
|
|
80
|
+
export interface MemberTierHistory {
|
|
81
|
+
id: string;
|
|
82
|
+
memberId: string;
|
|
83
|
+
oldTier?: MemberTier;
|
|
84
|
+
newTier: MemberTier;
|
|
85
|
+
changeReason: TierChangeReason;
|
|
86
|
+
pointsAtChange: number;
|
|
87
|
+
staysAtChange: number;
|
|
88
|
+
createdAt: Date;
|
|
89
|
+
}
|
|
90
|
+
/**
|
|
91
|
+
* Loyalty state
|
|
92
|
+
*/
|
|
93
|
+
export interface LoyaltyState {
|
|
94
|
+
/** Current points balance */
|
|
95
|
+
points: number;
|
|
96
|
+
/** Current tier (null if member has no bookings yet) */
|
|
97
|
+
tier: MemberTier | null;
|
|
98
|
+
/** All tier configurations */
|
|
99
|
+
tierConfigs: TierConfig[];
|
|
100
|
+
/** Current tier config */
|
|
101
|
+
tierConfig: TierConfig | null;
|
|
102
|
+
/** Progress toward next tier */
|
|
103
|
+
tierProgress: TierProgress | null;
|
|
104
|
+
/** Recent transactions */
|
|
105
|
+
transactions: LoyaltyTransaction[];
|
|
106
|
+
/** Tier change history */
|
|
107
|
+
tierHistory: MemberTierHistory[];
|
|
108
|
+
/** Upcoming stays (future check-in) */
|
|
109
|
+
upcomingStays: MemberStay[];
|
|
110
|
+
/** Previous stays (past check-out) */
|
|
111
|
+
previousStays: MemberStay[];
|
|
112
|
+
/** Whether loyalty data is loading */
|
|
113
|
+
isLoading: boolean;
|
|
114
|
+
/** Current error message */
|
|
115
|
+
error: string | null;
|
|
116
|
+
}
|
|
117
|
+
/**
|
|
118
|
+
* Loyalty actions available via useAkinLoyalty hook
|
|
119
|
+
*/
|
|
120
|
+
export interface LoyaltyActions {
|
|
121
|
+
/** Refresh all loyalty data */
|
|
122
|
+
refreshData: () => Promise<void>;
|
|
123
|
+
/** Get transaction history with pagination */
|
|
124
|
+
getTransactionHistory: (options?: {
|
|
125
|
+
limit?: number;
|
|
126
|
+
offset?: number;
|
|
127
|
+
}) => Promise<LoyaltyTransaction[]>;
|
|
128
|
+
/** Get tier change history */
|
|
129
|
+
getTierHistory: (limit?: number) => Promise<MemberTierHistory[]>;
|
|
130
|
+
}
|
|
131
|
+
/**
|
|
132
|
+
* Full loyalty context value (state + actions)
|
|
133
|
+
*/
|
|
134
|
+
export type LoyaltyContextValue = LoyaltyState & LoyaltyActions;
|
|
135
|
+
/**
|
|
136
|
+
* Booking status enum
|
|
137
|
+
*/
|
|
138
|
+
export type BookingStatus = 'PENDING' | 'CONFIRMED' | 'CHECKED_IN' | 'CHECKED_OUT' | 'COMPLETED' | 'CANCELLED' | 'NO_SHOW';
|
|
139
|
+
/**
|
|
140
|
+
* Member stay (booking) for display
|
|
141
|
+
*/
|
|
142
|
+
export interface MemberStay {
|
|
143
|
+
id: string;
|
|
144
|
+
propertyId: string;
|
|
145
|
+
propertyName?: string;
|
|
146
|
+
partnerName?: string;
|
|
147
|
+
checkIn: Date;
|
|
148
|
+
checkOut: Date;
|
|
149
|
+
nights: number;
|
|
150
|
+
guests: number;
|
|
151
|
+
totalPrice: number;
|
|
152
|
+
currency?: string;
|
|
153
|
+
status: BookingStatus;
|
|
154
|
+
pointsEarned?: number;
|
|
155
|
+
confirmationNumber?: string;
|
|
156
|
+
perks?: Array<{
|
|
157
|
+
text: string;
|
|
158
|
+
icon?: string;
|
|
159
|
+
tier?: string;
|
|
160
|
+
}>;
|
|
161
|
+
}
|
|
162
|
+
/**
|
|
163
|
+
* Props for headless LoyaltyCard component
|
|
164
|
+
*/
|
|
165
|
+
export interface LoyaltyCardRenderProps {
|
|
166
|
+
/** Member first name */
|
|
167
|
+
firstName: string;
|
|
168
|
+
/** Member full name */
|
|
169
|
+
fullName: string;
|
|
170
|
+
/** Member loyalty number */
|
|
171
|
+
loyaltyNumber: string;
|
|
172
|
+
/** Current tier (TIER1, TIER2, etc.) - defaults to TIER1 if not set */
|
|
173
|
+
currentTier: MemberTier;
|
|
174
|
+
/** Tier display name (A, K, I, N, etc.) */
|
|
175
|
+
tierDisplayName: string | null;
|
|
176
|
+
/** Tier color */
|
|
177
|
+
tierColor: string | null;
|
|
178
|
+
/** Member since date */
|
|
179
|
+
memberSince: Date | null;
|
|
180
|
+
/** Start of current membership year */
|
|
181
|
+
membershipYearStart: Date;
|
|
182
|
+
/** End of current membership year */
|
|
183
|
+
membershipYearEnd: Date;
|
|
184
|
+
/** Spendable points balance */
|
|
185
|
+
points: number;
|
|
186
|
+
/** Lifetime points earned */
|
|
187
|
+
lifetimePoints: number;
|
|
188
|
+
/** Membership year stats */
|
|
189
|
+
membershipYearStats: {
|
|
190
|
+
points: number;
|
|
191
|
+
totalStays: number;
|
|
192
|
+
originStays: number;
|
|
193
|
+
totalNights: number;
|
|
194
|
+
};
|
|
195
|
+
/** Lifetime stats */
|
|
196
|
+
lifetimeStats: {
|
|
197
|
+
points: number;
|
|
198
|
+
totalStays: number;
|
|
199
|
+
originStays: number;
|
|
200
|
+
totalNights: number;
|
|
201
|
+
};
|
|
202
|
+
/** Progress to next tier */
|
|
203
|
+
tierProgress: TierProgress | null;
|
|
204
|
+
/** Loading state */
|
|
205
|
+
isLoading: boolean;
|
|
206
|
+
/** Called when "Book now" button is clicked */
|
|
207
|
+
onBookNow?: () => void;
|
|
208
|
+
/** Called when "Add a stay" button is clicked */
|
|
209
|
+
onAddStay?: () => void;
|
|
210
|
+
/** Called when "Refer a friend" button is clicked */
|
|
211
|
+
onReferFriend?: () => void;
|
|
212
|
+
/** Called when "Set preferences" button is clicked */
|
|
213
|
+
onSetPreferences?: () => void;
|
|
214
|
+
}
|
|
215
|
+
/**
|
|
216
|
+
* Props for headless UpcomingStays component
|
|
217
|
+
*/
|
|
218
|
+
export interface UpcomingStaysRenderProps {
|
|
219
|
+
/** Upcoming stays sorted by check-in date */
|
|
220
|
+
stays: MemberStay[];
|
|
221
|
+
/** Loading state */
|
|
222
|
+
isLoading: boolean;
|
|
223
|
+
/** Whether there are more stays to load */
|
|
224
|
+
hasMore: boolean;
|
|
225
|
+
/** Load more stays */
|
|
226
|
+
loadMore: () => void;
|
|
227
|
+
/** Empty state flag */
|
|
228
|
+
isEmpty: boolean;
|
|
229
|
+
}
|
|
230
|
+
/**
|
|
231
|
+
* Props for headless PreviousStays component
|
|
232
|
+
*/
|
|
233
|
+
export interface PreviousStaysRenderProps {
|
|
234
|
+
/** Previous stays sorted by check-out date (most recent first) */
|
|
235
|
+
stays: MemberStay[];
|
|
236
|
+
/** Loading state */
|
|
237
|
+
isLoading: boolean;
|
|
238
|
+
/** Whether there are more stays to load */
|
|
239
|
+
hasMore: boolean;
|
|
240
|
+
/** Load more stays */
|
|
241
|
+
loadMore: () => void;
|
|
242
|
+
/** Empty state flag */
|
|
243
|
+
isEmpty: boolean;
|
|
244
|
+
}
|
|
245
|
+
/**
|
|
246
|
+
* Props for headless TierCard component
|
|
247
|
+
*/
|
|
248
|
+
export interface TierCardRenderProps {
|
|
249
|
+
tier: MemberTier | null;
|
|
250
|
+
displayName: string | null;
|
|
251
|
+
color: string | null;
|
|
252
|
+
icon: string | null;
|
|
253
|
+
byline: string | null;
|
|
254
|
+
points: number;
|
|
255
|
+
loyaltyNumber: string;
|
|
256
|
+
maxPerks: number;
|
|
257
|
+
}
|
|
258
|
+
/**
|
|
259
|
+
* Props for headless TierProgress component
|
|
260
|
+
*/
|
|
261
|
+
export interface TierProgressRenderProps {
|
|
262
|
+
currentTier: MemberTier | null;
|
|
263
|
+
currentTierName: string | null;
|
|
264
|
+
nextTier: MemberTier | null;
|
|
265
|
+
nextTierName: string | null;
|
|
266
|
+
percentage: number;
|
|
267
|
+
pointsNeeded: number;
|
|
268
|
+
totalStays: number;
|
|
269
|
+
originStays: number;
|
|
270
|
+
}
|
|
271
|
+
/**
|
|
272
|
+
* Props for headless TransactionList component
|
|
273
|
+
*/
|
|
274
|
+
export interface TransactionListRenderProps {
|
|
275
|
+
transactions: LoyaltyTransaction[];
|
|
276
|
+
isLoading: boolean;
|
|
277
|
+
hasMore: boolean;
|
|
278
|
+
loadMore: () => void;
|
|
279
|
+
}
|
|
280
|
+
/**
|
|
281
|
+
* Props for headless TierRequirementsTable component
|
|
282
|
+
*/
|
|
283
|
+
export interface TierRequirementsTableRenderProps {
|
|
284
|
+
/** Tier configs sorted by display order */
|
|
285
|
+
tierConfigs: TierConfig[];
|
|
286
|
+
/** Unique requirement keys sorted by priority */
|
|
287
|
+
requirementKeys: string[];
|
|
288
|
+
/** Get display label for a requirement key */
|
|
289
|
+
getRequirementLabel: (key: string, displayName?: string | null) => string;
|
|
290
|
+
/** Format a value with its operator (e.g., "10+" for gte) */
|
|
291
|
+
formatValue: (value: number, operator: RequirementOperator) => string;
|
|
292
|
+
/** Get requirement for a specific tier and key */
|
|
293
|
+
getRequirement: (tier: TierConfig, key: string) => TierRequirement | undefined;
|
|
294
|
+
/** Partner name used for dynamic labels */
|
|
295
|
+
partnerName: string;
|
|
296
|
+
/** Loading state */
|
|
297
|
+
isLoading: boolean;
|
|
298
|
+
}
|
|
299
|
+
/**
|
|
300
|
+
* Props for headless SimpleTierCards component
|
|
301
|
+
*/
|
|
302
|
+
export interface SimpleTierCardsRenderProps {
|
|
303
|
+
/** Tier configs sorted by display order */
|
|
304
|
+
tierConfigs: TierConfig[];
|
|
305
|
+
/** Format a requirement for display (e.g., "10+ Origin stays") */
|
|
306
|
+
formatRequirement: (req: TierRequirement) => string;
|
|
307
|
+
/** Get contrasting text color for a background color */
|
|
308
|
+
getTextColor: (bgColor: string) => string;
|
|
309
|
+
/** Loading state */
|
|
310
|
+
isLoading: boolean;
|
|
311
|
+
}
|
|
312
|
+
//# sourceMappingURL=loyalty.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"loyalty.d.ts","sourceRoot":"","sources":["../../src/types/loyalty.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,QAAQ,CAAC;AAGzC,YAAY,EAAE,UAAU,EAAE,CAAC;AAE3B;;GAEG;AACH,MAAM,MAAM,oBAAoB,GAAG,KAAK,GAAG,OAAO,GAAG,MAAM,GAAG,QAAQ,CAAC;AAEvE;;GAEG;AACH,MAAM,MAAM,mBAAmB,GAAG,IAAI,GAAG,IAAI,GAAG,KAAK,GAAG,IAAI,GAAG,KAAK,CAAC;AAErE;;GAEG;AACH,MAAM,WAAW,eAAe;IAC9B,EAAE,EAAE,MAAM,CAAC;IACX,YAAY,EAAE,MAAM,CAAC;IACrB,cAAc,EAAE,MAAM,CAAC;IACvB,gBAAgB,EAAE,MAAM,CAAC;IACzB,SAAS,EAAE,oBAAoB,CAAC;IAChC,QAAQ,EAAE,mBAAmB,CAAC;IAC9B,UAAU,EAAE,MAAM,CAAC;IACnB,YAAY,EAAE,MAAM,CAAC;IACrB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,MAAM,EAAE,OAAO,CAAC;CACjB;AAED;;GAEG;AACH,MAAM,WAAW,UAAU;IACzB,EAAE,EAAE,MAAM,CAAC;IACX,QAAQ,EAAE,UAAU,CAAC;IACrB,WAAW,E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AG,IAAI,KAAK,MAAM,CAAC;IAC1E,6DAA6D;IAC7D,WAAW,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,QAAQ,EAAE,mBAAmB,KAAK,MAAM,CAAC;IACtE,kDAAkD;IAClD,cAAc,EAAE,CAAC,IAAI,EAAE,UAAU,EAAE,GAAG,EAAE,MAAM,KAAK,eAAe,GAAG,SAAS,CAAC;IAC/E,2CAA2C;IAC3C,WAAW,EAAE,MAAM,CAAC;IACpB,oBAAoB;IACpB,SAAS,EAAE,OAAO,CAAC;CACpB;AAED;;GAEG;AACH,MAAM,WAAW,0BAA0B;IACzC,2CAA2C;IAC3C,WAAW,EAAE,UAAU,EAAE,CAAC;IAC1B,kEAAkE;IAClE,iBAAiB,EAAE,CAAC,GAAG,EAAE,eAAe,KAAK,MAAM,CAAC;IACpD,wDAAwD;IACxD,YAAY,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,MAAM,CAAC;IAC1C,oBAAoB;IACpB,SAAS,EAAE,OAAO,CAAC;CACpB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"loyalty.js","sourceRoot":"","sources":["../../src/types/loyalty.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/utils/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,WAAW,EACX,cAAc,EACd,YAAY,EACZ,QAAQ,EACR,sBAAsB,GACvB,MAAM,cAAc,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.extractRequirementKeys = exports.getLabel = exports.KEY_PRIORITY = exports.PARTNER_LABELS = exports.TIER_LABELS = void 0;
|
|
4
|
+
var tierLabels_1 = require("./tierLabels");
|
|
5
|
+
Object.defineProperty(exports, "TIER_LABELS", { enumerable: true, get: function () { return tierLabels_1.TIER_LABELS; } });
|
|
6
|
+
Object.defineProperty(exports, "PARTNER_LABELS", { enumerable: true, get: function () { return tierLabels_1.PARTNER_LABELS; } });
|
|
7
|
+
Object.defineProperty(exports, "KEY_PRIORITY", { enumerable: true, get: function () { return tierLabels_1.KEY_PRIORITY; } });
|
|
8
|
+
Object.defineProperty(exports, "getLabel", { enumerable: true, get: function () { return tierLabels_1.getLabel; } });
|
|
9
|
+
Object.defineProperty(exports, "extractRequirementKeys", { enumerable: true, get: function () { return tierLabels_1.extractRequirementKeys; } });
|
|
10
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/utils/index.ts"],"names":[],"mappings":";;;AAAA,2CAMsB;AALpB,yGAAA,WAAW,OAAA;AACX,4GAAA,cAAc,OAAA;AACd,0GAAA,YAAY,OAAA;AACZ,sGAAA,QAAQ,OAAA;AACR,oHAAA,sBAAsB,OAAA"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import type { TierConfig } from '../types/loyalty';
|
|
2
|
+
/**
|
|
3
|
+
* Static labels for requirement keys
|
|
4
|
+
*/
|
|
5
|
+
export declare const TIER_LABELS: Record<string, string>;
|
|
6
|
+
/**
|
|
7
|
+
* Dynamic labels that include partner name
|
|
8
|
+
* Returns a function that takes partnerName and returns the label
|
|
9
|
+
*/
|
|
10
|
+
export declare const PARTNER_LABELS: Record<string, (partnerName: string) => string>;
|
|
11
|
+
/**
|
|
12
|
+
* Priority order for requirement keys (higher priority = shown first)
|
|
13
|
+
*/
|
|
14
|
+
export declare const KEY_PRIORITY: Record<string, number>;
|
|
15
|
+
/**
|
|
16
|
+
* Get label for a requirement key
|
|
17
|
+
* @param key - The requirement key (e.g., 'stays_member_origin', 'stays_partner')
|
|
18
|
+
* @param partnerName - Partner name for dynamic labels (default: 'Origin')
|
|
19
|
+
* @param displayName - Optional custom display name override from database
|
|
20
|
+
*/
|
|
21
|
+
export declare function getLabel(key: string, partnerName?: string, displayName?: string | null): string;
|
|
22
|
+
/**
|
|
23
|
+
* Extract unique requirement keys from tier configs (sorted by priority)
|
|
24
|
+
* @param tierConfigs - Array of tier configurations
|
|
25
|
+
*/
|
|
26
|
+
export declare function extractRequirementKeys(tierConfigs: TierConfig[]): string[];
|
|
27
|
+
//# sourceMappingURL=tierLabels.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tierLabels.d.ts","sourceRoot":"","sources":["../../src/utils/tierLabels.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAEnD;;GAEG;AACH,eAAO,MAAM,WAAW,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAwB9C,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,cAAc,EAAE,MAAM,CAAC,MAAM,EAAE,CAAC,WAAW,EAAE,MAAM,KAAK,MAAM,CAI1E,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,YAAY,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAsB/C,CAAC;AAEF;;;;;GAKG;AACH,wBAAgB,QAAQ,CACtB,GAAG,EAAE,MAAM,EACX,WAAW,GAAE,MAAiB,EAC9B,WAAW,CAAC,EAAE,MAAM,GAAG,IAAI,GAC1B,MAAM,CAuBR;AAED;;;GAGG;AACH,wBAAgB,sBAAsB,CAAC,WAAW,EAAE,UAAU,EAAE,GAAG,MAAM,EAAE,CAe1E"}
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.KEY_PRIORITY = exports.PARTNER_LABELS = exports.TIER_LABELS = void 0;
|
|
4
|
+
exports.getLabel = getLabel;
|
|
5
|
+
exports.extractRequirementKeys = extractRequirementKeys;
|
|
6
|
+
/**
|
|
7
|
+
* Static labels for requirement keys
|
|
8
|
+
*/
|
|
9
|
+
exports.TIER_LABELS = {
|
|
10
|
+
// Stays
|
|
11
|
+
stays_member_origin: 'Origin stays',
|
|
12
|
+
stays_network: 'Network stays',
|
|
13
|
+
nights_member_origin: 'Origin nights',
|
|
14
|
+
nights_network: 'Network nights',
|
|
15
|
+
// Points
|
|
16
|
+
points: 'AKIN points',
|
|
17
|
+
network_points: 'Network points',
|
|
18
|
+
// Spend
|
|
19
|
+
spend: 'Total spend',
|
|
20
|
+
// Country completions
|
|
21
|
+
country_completion_mx: 'Mexico complete',
|
|
22
|
+
country_completion_pe: 'Peru complete',
|
|
23
|
+
country_completion_co: 'Colombia complete',
|
|
24
|
+
// Achievements
|
|
25
|
+
achievement_invitation: 'Invitation',
|
|
26
|
+
// Referrals
|
|
27
|
+
referrals: 'Referrals',
|
|
28
|
+
};
|
|
29
|
+
/**
|
|
30
|
+
* Dynamic labels that include partner name
|
|
31
|
+
* Returns a function that takes partnerName and returns the label
|
|
32
|
+
*/
|
|
33
|
+
exports.PARTNER_LABELS = {
|
|
34
|
+
stays_partner: (partner) => `${partner} stays`,
|
|
35
|
+
nights_partner: (partner) => `${partner} nights`,
|
|
36
|
+
achievement_tattoo: (partner) => `${partner} tattoo`,
|
|
37
|
+
};
|
|
38
|
+
/**
|
|
39
|
+
* Priority order for requirement keys (higher priority = shown first)
|
|
40
|
+
*/
|
|
41
|
+
exports.KEY_PRIORITY = {
|
|
42
|
+
// Stays - highest priority
|
|
43
|
+
stays_partner: 100,
|
|
44
|
+
stays_member_origin: 99,
|
|
45
|
+
stays_network: 98,
|
|
46
|
+
// Nights
|
|
47
|
+
nights_partner: 90,
|
|
48
|
+
nights_member_origin: 89,
|
|
49
|
+
nights_network: 88,
|
|
50
|
+
// Points
|
|
51
|
+
points: 80,
|
|
52
|
+
network_points: 79,
|
|
53
|
+
// Spend
|
|
54
|
+
spend: 70,
|
|
55
|
+
// Country completions
|
|
56
|
+
country_completion_mx: 50,
|
|
57
|
+
country_completion_pe: 49,
|
|
58
|
+
country_completion_co: 48,
|
|
59
|
+
// Achievements
|
|
60
|
+
achievement_tattoo: 40,
|
|
61
|
+
achievement_invitation: 39,
|
|
62
|
+
referrals: 30,
|
|
63
|
+
};
|
|
64
|
+
/**
|
|
65
|
+
* Get label for a requirement key
|
|
66
|
+
* @param key - The requirement key (e.g., 'stays_member_origin', 'stays_partner')
|
|
67
|
+
* @param partnerName - Partner name for dynamic labels (default: 'Origin')
|
|
68
|
+
* @param displayName - Optional custom display name override from database
|
|
69
|
+
*/
|
|
70
|
+
function getLabel(key, partnerName = 'Origin', displayName) {
|
|
71
|
+
// Use custom display name if provided
|
|
72
|
+
if (displayName) {
|
|
73
|
+
return displayName;
|
|
74
|
+
}
|
|
75
|
+
// Check partner-specific labels first
|
|
76
|
+
const partnerLabel = exports.PARTNER_LABELS[key];
|
|
77
|
+
if (partnerLabel) {
|
|
78
|
+
return partnerLabel(partnerName);
|
|
79
|
+
}
|
|
80
|
+
// Check static labels
|
|
81
|
+
const staticLabel = exports.TIER_LABELS[key];
|
|
82
|
+
if (staticLabel) {
|
|
83
|
+
return staticLabel;
|
|
84
|
+
}
|
|
85
|
+
// Fallback: convert snake_case to Title Case
|
|
86
|
+
return key
|
|
87
|
+
.split('_')
|
|
88
|
+
.map((word) => word.charAt(0).toUpperCase() + word.slice(1))
|
|
89
|
+
.join(' ');
|
|
90
|
+
}
|
|
91
|
+
/**
|
|
92
|
+
* Extract unique requirement keys from tier configs (sorted by priority)
|
|
93
|
+
* @param tierConfigs - Array of tier configurations
|
|
94
|
+
*/
|
|
95
|
+
function extractRequirementKeys(tierConfigs) {
|
|
96
|
+
const keys = new Set();
|
|
97
|
+
tierConfigs.forEach((tier) => {
|
|
98
|
+
tier.requirements?.filter((r) => r.active).forEach((req) => {
|
|
99
|
+
keys.add(req.requirementKey);
|
|
100
|
+
});
|
|
101
|
+
});
|
|
102
|
+
return Array.from(keys).sort((a, b) => {
|
|
103
|
+
const priorityA = exports.KEY_PRIORITY[a] ?? 0;
|
|
104
|
+
const priorityB = exports.KEY_PRIORITY[b] ?? 0;
|
|
105
|
+
if (priorityA !== priorityB)
|
|
106
|
+
return priorityB - priorityA;
|
|
107
|
+
return a.localeCompare(b);
|
|
108
|
+
});
|
|
109
|
+
}
|
|
110
|
+
//# sourceMappingURL=tierLabels.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tierLabels.js","sourceRoot":"","sources":["../../src/utils/tierLabels.ts"],"names":[],"mappings":";;;AA0EA,4BA2BC;AAMD,wDAeC;AAxHD;;GAEG;AACU,QAAA,WAAW,GAA2B;IACjD,QAAQ;IACR,mBAAmB,EAAE,cAAc;IACnC,aAAa,EAAE,eAAe;IAC9B,oBAAoB,EAAE,eAAe;IACrC,cAAc,EAAE,gBAAgB;IAEhC,SAAS;IACT,MAAM,EAAE,aAAa;IACrB,cAAc,EAAE,gBAAgB;IAEhC,QAAQ;IACR,KAAK,EAAE,aAAa;IAEpB,sBAAsB;IACtB,qBAAqB,EAAE,iBAAiB;IACxC,qBAAqB,EAAE,eAAe;IACtC,qBAAqB,EAAE,mBAAmB;IAE1C,eAAe;IACf,sBAAsB,EAAE,YAAY;IAEpC,YAAY;IACZ,SAAS,EAAE,WAAW;CACvB,CAAC;AAEF;;;GAGG;AACU,QAAA,cAAc,GAAoD;IAC7E,aAAa,EAAE,CAAC,OAAO,EAAE,EAAE,CAAC,GAAG,OAAO,QAAQ;IAC9C,cAAc,EAAE,CAAC,OAAO,EAAE,EAAE,CAAC,GAAG,OAAO,SAAS;IAChD,kBAAkB,EAAE,CAAC,OAAO,EAAE,EAAE,CAAC,GAAG,OAAO,SAAS;CACrD,CAAC;AAEF;;GAEG;AACU,QAAA,YAAY,GAA2B;IAClD,2BAA2B;IAC3B,aAAa,EAAE,GAAG;IAClB,mBAAmB,EAAE,EAAE;IACvB,aAAa,EAAE,EAAE;IACjB,SAAS;IACT,cAAc,EAAE,EAAE;IAClB,oBAAoB,EAAE,EAAE;IACxB,cAAc,EAAE,EAAE;IAClB,SAAS;IACT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AC,OAAO,CAAC,CAAC,GAAG,EAAE,EAAE;YACzD,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,cAAc,CAAC,CAAC;QAC/B,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;IAEH,OAAO,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE;QACpC,MAAM,SAAS,GAAG,oBAAY,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC;QACvC,MAAM,SAAS,GAAG,oBAAY,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC;QACvC,IAAI,SAAS,KAAK,SAAS;YAAE,OAAO,SAAS,GAAG,SAAS,CAAC;QAC1D,OAAO,CAAC,CAAC,aAAa,CAAC,CAAC,CAAC,CAAC;IAC5B,CAAC,CAAC,CAAC;AACL,CAAC"}
|
package/package.json
ADDED
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@akin-travel/partner-sdk",
|
|
3
|
+
"version": "1.0.5",
|
|
4
|
+
"description": "SDK for third-party partners to integrate Akin auth and loyalty services",
|
|
5
|
+
"main": "dist/index.js",
|
|
6
|
+
"types": "dist/index.d.ts",
|
|
7
|
+
"files": [
|
|
8
|
+
"dist/**/*",
|
|
9
|
+
"README.md"
|
|
10
|
+
],
|
|
11
|
+
"publishConfig": {
|
|
12
|
+
"access": "public"
|
|
13
|
+
},
|
|
14
|
+
"scripts": {
|
|
15
|
+
"prebuild": "npm run clean",
|
|
16
|
+
"build": "tsc",
|
|
17
|
+
"dev": "tsc --watch",
|
|
18
|
+
"clean": "rm -rf dist tsconfig.tsbuildinfo",
|
|
19
|
+
"test": "vitest run --passWithNoTests",
|
|
20
|
+
"lint": "eslint src/**/*.ts src/**/*.tsx",
|
|
21
|
+
"format": "prettier --write src/**/*.ts src/**/*.tsx",
|
|
22
|
+
"prepublishOnly": "npm run build"
|
|
23
|
+
},
|
|
24
|
+
"dependencies": {
|
|
25
|
+
"@apollo/client": "^3.8.8",
|
|
26
|
+
"@simplewebauthn/browser": "^13.2.2",
|
|
27
|
+
"firebase": "^11.7.0",
|
|
28
|
+
"graphql": "^16.8.1",
|
|
29
|
+
"react-phone-number-input": "^3.4.9"
|
|
30
|
+
},
|
|
31
|
+
"peerDependencies": {
|
|
32
|
+
"react": "^18.0.0 || ^19.0.0",
|
|
33
|
+
"react-dom": "^18.0.0 || ^19.0.0"
|
|
34
|
+
},
|
|
35
|
+
"devDependencies": {
|
|
36
|
+
"@types/react": "^19.0.0",
|
|
37
|
+
"@types/react-dom": "^19.0.0",
|
|
38
|
+
"eslint": "^9.33.0",
|
|
39
|
+
"prettier": "^3.1.0",
|
|
40
|
+
"react": "^19.0.0",
|
|
41
|
+
"react-dom": "^19.0.0",
|
|
42
|
+
"typescript": "~5.7.2",
|
|
43
|
+
"vitest": "^4.0.6"
|
|
44
|
+
},
|
|
45
|
+
"keywords": [
|
|
46
|
+
"akin",
|
|
47
|
+
"loyalty",
|
|
48
|
+
"auth",
|
|
49
|
+
"sdk",
|
|
50
|
+
"react",
|
|
51
|
+
"headless"
|
|
52
|
+
],
|
|
53
|
+
"repository": {
|
|
54
|
+
"type": "git",
|
|
55
|
+
"url": "https://github.com/akin-travel/akin-online.git",
|
|
56
|
+
"directory": "packages/partner-sdk"
|
|
57
|
+
},
|
|
58
|
+
"license": "UNLICENSED",
|
|
59
|
+
"private": false
|
|
60
|
+
}
|