@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.
Files changed (204) hide show
  1. package/README.md +1204 -0
  2. package/dist/account/components/AccountInfoSection.d.ts +46 -0
  3. package/dist/account/components/AccountInfoSection.d.ts.map +1 -0
  4. package/dist/account/components/AccountInfoSection.js +52 -0
  5. package/dist/account/components/AccountInfoSection.js.map +1 -0
  6. package/dist/account/components/NotificationPreferencesSection.d.ts +40 -0
  7. package/dist/account/components/NotificationPreferencesSection.d.ts.map +1 -0
  8. package/dist/account/components/NotificationPreferencesSection.js +116 -0
  9. package/dist/account/components/NotificationPreferencesSection.js.map +1 -0
  10. package/dist/account/components/PasskeySection.d.ts +49 -0
  11. package/dist/account/components/PasskeySection.d.ts.map +1 -0
  12. package/dist/account/components/PasskeySection.js +298 -0
  13. package/dist/account/components/PasskeySection.js.map +1 -0
  14. package/dist/account/hooks/useAccountForm.d.ts +23 -0
  15. package/dist/account/hooks/useAccountForm.d.ts.map +1 -0
  16. package/dist/account/hooks/useAccountForm.js +133 -0
  17. package/dist/account/hooks/useAccountForm.js.map +1 -0
  18. package/dist/account/index.d.ts +10 -0
  19. package/dist/account/index.d.ts.map +1 -0
  20. package/dist/account/index.js +21 -0
  21. package/dist/account/index.js.map +1 -0
  22. package/dist/auth/AkinAuthProvider.d.ts +31 -0
  23. package/dist/auth/AkinAuthProvider.d.ts.map +1 -0
  24. package/dist/auth/AkinAuthProvider.js +632 -0
  25. package/dist/auth/AkinAuthProvider.js.map +1 -0
  26. package/dist/auth/components/LoginForm.d.ts +63 -0
  27. package/dist/auth/components/LoginForm.d.ts.map +1 -0
  28. package/dist/auth/components/LoginForm.js +230 -0
  29. package/dist/auth/components/LoginForm.js.map +1 -0
  30. package/dist/auth/components/MagicLinkForm.d.ts +41 -0
  31. package/dist/auth/components/MagicLinkForm.d.ts.map +1 -0
  32. package/dist/auth/components/MagicLinkForm.js +88 -0
  33. package/dist/auth/components/MagicLinkForm.js.map +1 -0
  34. package/dist/auth/components/RequireAuth.d.ts +62 -0
  35. package/dist/auth/components/RequireAuth.d.ts.map +1 -0
  36. package/dist/auth/components/RequireAuth.js +63 -0
  37. package/dist/auth/components/RequireAuth.js.map +1 -0
  38. package/dist/auth/components/RequireGuest.d.ts +60 -0
  39. package/dist/auth/components/RequireGuest.d.ts.map +1 -0
  40. package/dist/auth/components/RequireGuest.js +64 -0
  41. package/dist/auth/components/RequireGuest.js.map +1 -0
  42. package/dist/auth/components/SignupForm.d.ts +45 -0
  43. package/dist/auth/components/SignupForm.d.ts.map +1 -0
  44. package/dist/auth/components/SignupForm.js +167 -0
  45. package/dist/auth/components/SignupForm.js.map +1 -0
  46. package/dist/auth/index.d.ts +10 -0
  47. package/dist/auth/index.d.ts.map +1 -0
  48. package/dist/auth/index.js +21 -0
  49. package/dist/auth/index.js.map +1 -0
  50. package/dist/client.d.ts +17 -0
  51. package/dist/client.d.ts.map +1 -0
  52. package/dist/client.js +136 -0
  53. package/dist/client.js.map +1 -0
  54. package/dist/components/PhoneInput.d.ts +62 -0
  55. package/dist/components/PhoneInput.d.ts.map +1 -0
  56. package/dist/components/PhoneInput.js +65 -0
  57. package/dist/components/PhoneInput.js.map +1 -0
  58. package/dist/components/index.d.ts +2 -0
  59. package/dist/components/index.d.ts.map +1 -0
  60. package/dist/components/index.js +9 -0
  61. package/dist/components/index.js.map +1 -0
  62. package/dist/config.d.ts +111 -0
  63. package/dist/config.d.ts.map +1 -0
  64. package/dist/config.js +56 -0
  65. package/dist/config.js.map +1 -0
  66. package/dist/constants/preferences.d.ts +22 -0
  67. package/dist/constants/preferences.d.ts.map +1 -0
  68. package/dist/constants/preferences.js +52 -0
  69. package/dist/constants/preferences.js.map +1 -0
  70. package/dist/currency/CurrencyProvider.d.ts +46 -0
  71. package/dist/currency/CurrencyProvider.d.ts.map +1 -0
  72. package/dist/currency/CurrencyProvider.js +145 -0
  73. package/dist/currency/CurrencyProvider.js.map +1 -0
  74. package/dist/currency/components/CurrencySelector.d.ts +43 -0
  75. package/dist/currency/components/CurrencySelector.d.ts.map +1 -0
  76. package/dist/currency/components/CurrencySelector.js +58 -0
  77. package/dist/currency/components/CurrencySelector.js.map +1 -0
  78. package/dist/currency/exchangeRates.d.ts +40 -0
  79. package/dist/currency/exchangeRates.d.ts.map +1 -0
  80. package/dist/currency/exchangeRates.js +90 -0
  81. package/dist/currency/exchangeRates.js.map +1 -0
  82. package/dist/currency/index.d.ts +6 -0
  83. package/dist/currency/index.d.ts.map +1 -0
  84. package/dist/currency/index.js +20 -0
  85. package/dist/currency/index.js.map +1 -0
  86. package/dist/header/components/CurrencyAccordion.d.ts +45 -0
  87. package/dist/header/components/CurrencyAccordion.d.ts.map +1 -0
  88. package/dist/header/components/CurrencyAccordion.js +54 -0
  89. package/dist/header/components/CurrencyAccordion.js.map +1 -0
  90. package/dist/header/components/HeaderMenu.d.ts +49 -0
  91. package/dist/header/components/HeaderMenu.d.ts.map +1 -0
  92. package/dist/header/components/HeaderMenu.js +95 -0
  93. package/dist/header/components/HeaderMenu.js.map +1 -0
  94. package/dist/header/components/LanguageAccordion.d.ts +45 -0
  95. package/dist/header/components/LanguageAccordion.d.ts.map +1 -0
  96. package/dist/header/components/LanguageAccordion.js +54 -0
  97. package/dist/header/components/LanguageAccordion.js.map +1 -0
  98. package/dist/header/components/UserAvatar.d.ts +26 -0
  99. package/dist/header/components/UserAvatar.d.ts.map +1 -0
  100. package/dist/header/components/UserAvatar.js +46 -0
  101. package/dist/header/components/UserAvatar.js.map +1 -0
  102. package/dist/header/index.d.ts +10 -0
  103. package/dist/header/index.d.ts.map +1 -0
  104. package/dist/header/index.js +13 -0
  105. package/dist/header/index.js.map +1 -0
  106. package/dist/i18n/I18nProvider.d.ts +57 -0
  107. package/dist/i18n/I18nProvider.d.ts.map +1 -0
  108. package/dist/i18n/I18nProvider.js +205 -0
  109. package/dist/i18n/I18nProvider.js.map +1 -0
  110. package/dist/i18n/components/LanguageSelector.d.ts +43 -0
  111. package/dist/i18n/components/LanguageSelector.d.ts.map +1 -0
  112. package/dist/i18n/components/LanguageSelector.js +57 -0
  113. package/dist/i18n/components/LanguageSelector.js.map +1 -0
  114. package/dist/i18n/index.d.ts +5 -0
  115. package/dist/i18n/index.d.ts.map +1 -0
  116. package/dist/i18n/index.js +14 -0
  117. package/dist/i18n/index.js.map +1 -0
  118. package/dist/i18n/translations/en.json +283 -0
  119. package/dist/i18n/translations/es.json +283 -0
  120. package/dist/index.d.ts +81 -0
  121. package/dist/index.d.ts.map +1 -0
  122. package/dist/index.js +191 -0
  123. package/dist/index.js.map +1 -0
  124. package/dist/loyalty/AkinLoyaltyProvider.d.ts +18 -0
  125. package/dist/loyalty/AkinLoyaltyProvider.d.ts.map +1 -0
  126. package/dist/loyalty/AkinLoyaltyProvider.js +399 -0
  127. package/dist/loyalty/AkinLoyaltyProvider.js.map +1 -0
  128. package/dist/loyalty/components/LoyaltyCard.d.ts +48 -0
  129. package/dist/loyalty/components/LoyaltyCard.d.ts.map +1 -0
  130. package/dist/loyalty/components/LoyaltyCard.js +140 -0
  131. package/dist/loyalty/components/LoyaltyCard.js.map +1 -0
  132. package/dist/loyalty/components/PointsDisplay.d.ts +40 -0
  133. package/dist/loyalty/components/PointsDisplay.d.ts.map +1 -0
  134. package/dist/loyalty/components/PointsDisplay.js +32 -0
  135. package/dist/loyalty/components/PointsDisplay.js.map +1 -0
  136. package/dist/loyalty/components/PreviousStays.d.ts +59 -0
  137. package/dist/loyalty/components/PreviousStays.d.ts.map +1 -0
  138. package/dist/loyalty/components/PreviousStays.js +101 -0
  139. package/dist/loyalty/components/PreviousStays.js.map +1 -0
  140. package/dist/loyalty/components/SimpleTierCards.d.ts +51 -0
  141. package/dist/loyalty/components/SimpleTierCards.d.ts.map +1 -0
  142. package/dist/loyalty/components/SimpleTierCards.js +96 -0
  143. package/dist/loyalty/components/SimpleTierCards.js.map +1 -0
  144. package/dist/loyalty/components/TierCard.d.ts +30 -0
  145. package/dist/loyalty/components/TierCard.d.ts.map +1 -0
  146. package/dist/loyalty/components/TierCard.js +41 -0
  147. package/dist/loyalty/components/TierCard.js.map +1 -0
  148. package/dist/loyalty/components/TierProgress.d.ts +32 -0
  149. package/dist/loyalty/components/TierProgress.d.ts.map +1 -0
  150. package/dist/loyalty/components/TierProgress.js +41 -0
  151. package/dist/loyalty/components/TierProgress.js.map +1 -0
  152. package/dist/loyalty/components/TierRequirementsTable.d.ts +54 -0
  153. package/dist/loyalty/components/TierRequirementsTable.d.ts.map +1 -0
  154. package/dist/loyalty/components/TierRequirementsTable.js +104 -0
  155. package/dist/loyalty/components/TierRequirementsTable.js.map +1 -0
  156. package/dist/loyalty/components/TransactionList.d.ts +44 -0
  157. package/dist/loyalty/components/TransactionList.d.ts.map +1 -0
  158. package/dist/loyalty/components/TransactionList.js +112 -0
  159. package/dist/loyalty/components/TransactionList.js.map +1 -0
  160. package/dist/loyalty/components/UpcomingStays.d.ts +49 -0
  161. package/dist/loyalty/components/UpcomingStays.d.ts.map +1 -0
  162. package/dist/loyalty/components/UpcomingStays.js +60 -0
  163. package/dist/loyalty/components/UpcomingStays.js.map +1 -0
  164. package/dist/loyalty/index.d.ts +12 -0
  165. package/dist/loyalty/index.d.ts.map +1 -0
  166. package/dist/loyalty/index.js +27 -0
  167. package/dist/loyalty/index.js.map +1 -0
  168. package/dist/types/account.d.ts +108 -0
  169. package/dist/types/account.d.ts.map +1 -0
  170. package/dist/types/account.js +3 -0
  171. package/dist/types/account.js.map +1 -0
  172. package/dist/types/auth.d.ts +205 -0
  173. package/dist/types/auth.d.ts.map +1 -0
  174. package/dist/types/auth.js +3 -0
  175. package/dist/types/auth.js.map +1 -0
  176. package/dist/types/currency.d.ts +102 -0
  177. package/dist/types/currency.d.ts.map +1 -0
  178. package/dist/types/currency.js +3 -0
  179. package/dist/types/currency.js.map +1 -0
  180. package/dist/types/header.d.ts +105 -0
  181. package/dist/types/header.d.ts.map +1 -0
  182. package/dist/types/header.js +3 -0
  183. package/dist/types/header.js.map +1 -0
  184. package/dist/types/i18n.d.ts +90 -0
  185. package/dist/types/i18n.d.ts.map +1 -0
  186. package/dist/types/i18n.js +3 -0
  187. package/dist/types/i18n.js.map +1 -0
  188. package/dist/types/index.d.ts +3 -0
  189. package/dist/types/index.d.ts.map +1 -0
  190. package/dist/types/index.js +3 -0
  191. package/dist/types/index.js.map +1 -0
  192. package/dist/types/loyalty.d.ts +312 -0
  193. package/dist/types/loyalty.d.ts.map +1 -0
  194. package/dist/types/loyalty.js +3 -0
  195. package/dist/types/loyalty.js.map +1 -0
  196. package/dist/utils/index.d.ts +2 -0
  197. package/dist/utils/index.d.ts.map +1 -0
  198. package/dist/utils/index.js +10 -0
  199. package/dist/utils/index.js.map +1 -0
  200. package/dist/utils/tierLabels.d.ts +27 -0
  201. package/dist/utils/tierLabels.d.ts.map +1 -0
  202. package/dist/utils/tierLabels.js +110 -0
  203. package/dist/utils/tierLabels.js.map +1 -0
  204. package/package.json +60 -0
@@ -0,0 +1,64 @@
1
+ "use strict";
2
+ 'use client';
3
+ Object.defineProperty(exports, "__esModule", { value: true });
4
+ exports.RequireGuest = RequireGuest;
5
+ const jsx_runtime_1 = require("react/jsx-runtime");
6
+ const AkinAuthProvider_1 = require("../AkinAuthProvider");
7
+ /**
8
+ * Wrapper component that only renders children when user is NOT authenticated
9
+ * Useful for login/signup pages that should redirect authenticated users
10
+ *
11
+ * @example
12
+ * // With fallback redirect
13
+ * <RequireGuest fallback={<Navigate to="/dashboard" />}>
14
+ * <LoginPage />
15
+ * </RequireGuest>
16
+ *
17
+ * @example
18
+ * // With loading state
19
+ * <RequireGuest
20
+ * loadingFallback={<LoadingSpinner />}
21
+ * fallback={<Navigate to="/dashboard" />}
22
+ * >
23
+ * <LoginPage />
24
+ * </RequireGuest>
25
+ *
26
+ * @example
27
+ * // With callback
28
+ * <RequireGuest
29
+ * onAuthenticated={() => router.push('/dashboard')}
30
+ * >
31
+ * <LoginPage />
32
+ * </RequireGuest>
33
+ */
34
+ function RequireGuest({ children, loadingFallback = null, fallback = null, onAuthenticated, }) {
35
+ const { isAuthenticated, isLoading } = (0, AkinAuthProvider_1.useAkinAuth)();
36
+ // Still loading auth state
37
+ if (isLoading) {
38
+ return (0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: loadingFallback });
39
+ }
40
+ // User is authenticated - should redirect
41
+ if (isAuthenticated) {
42
+ onAuthenticated?.();
43
+ return (0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: fallback });
44
+ }
45
+ // Guest - render children
46
+ return (0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: children });
47
+ }
48
+ /**
49
+ * Headless version with render props for full control
50
+ *
51
+ * @example
52
+ * <RequireGuest.Headless>
53
+ * {({ isAuthenticated, isLoading }) => (
54
+ * isLoading ? <Spinner /> :
55
+ * isAuthenticated ? <Redirect to="/dashboard" /> :
56
+ * <LoginForm />
57
+ * )}
58
+ * </RequireGuest.Headless>
59
+ */
60
+ RequireGuest.Headless = function RequireGuestHeadless({ children, }) {
61
+ const { isAuthenticated, isLoading } = (0, AkinAuthProvider_1.useAkinAuth)();
62
+ return (0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: children({ isAuthenticated, isLoading }) });
63
+ };
64
+ //# sourceMappingURL=RequireGuest.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"RequireGuest.js","sourceRoot":"","sources":["../../../src/auth/components/RequireGuest.tsx"],"names":[],"mappings":";AAAA,YAAY,CAAC;;AA2Db,oCAqBC;;AA7ED,0DAAkD;AA6BlD;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AACH,SAAgB,YAAY,CAAC,EAC3B,QAAQ,EACR,eAAe,GAAG,IAAI,EACtB,QAAQ,GAAG,IAAI,EACf,eAAe,GACG;IAClB,MAAM,EAAE,eAAe,EAAE,SAAS,EAAE,GAAG,IAAA,8BAAW,GAAE,CAAC;IAErD,2BAA2B;IAC3B,IAAI,SAAS,EAAE,CAAC;QACd,OAAO,2DAAG,eAAe,GAAI,CAAC;IAChC,CAAC;IAED,0CAA0C;IAC1C,IAAI,eAAe,EAAE,CAAC;QACpB,eAAe,EAAE,EAAE,CAAC;QACpB,OAAO,2DAAG,QAAQ,GAAI,CAAC;IACzB,CAAC;IAED,0BAA0B;IAC1B,OAAO,2DAAG,QAAQ,GAAI,CAAC;AACzB,CAAC;AAED;;;;;;;;;;;GAWG;AACH,YAAY,CAAC,QAAQ,GAAG,SAAS,oBAAoB,CAAC,EACpD,QAAQ,GAGT;IACC,MAAM,EAAE,eAAe,EAAE,SAAS,EAAE,GAAG,IAAA,8BAAW,GAAE,CAAC;IAErD,OAAO,2DAAG,QAAQ,CAAC,EAAE,eAAe,EAAE,SAAS,EAAE,CAAC,GAAI,CAAC;AACzD,CAAC,CAAC"}
@@ -0,0 +1,45 @@
1
+ import { type ReactNode } from 'react';
2
+ import type { SignupFormRenderProps } from '../../types/auth';
3
+ interface SignupFormProps {
4
+ /**
5
+ * Render function that receives form state and handlers
6
+ * Use this to build your own styled signup form
7
+ */
8
+ children: (props: SignupFormRenderProps) => ReactNode;
9
+ /**
10
+ * Called when signup succeeds
11
+ */
12
+ onSuccess?: () => void;
13
+ /**
14
+ * Called when signup fails
15
+ */
16
+ onError?: (error: string) => void;
17
+ /**
18
+ * Use passwordless signup (sends verification email instead of requiring password)
19
+ * @default false
20
+ */
21
+ passwordless?: boolean;
22
+ }
23
+ /**
24
+ * Headless SignupForm component
25
+ *
26
+ * Provides all the logic for signup - you provide the UI.
27
+ *
28
+ * @example
29
+ * ```tsx
30
+ * <SignupForm onSuccess={() => router.push('/welcome')}>
31
+ * {({ firstName, setFirstName, email, setEmail, password, setPassword, isLoading, error, handleSubmit }) => (
32
+ * <form onSubmit={handleSubmit}>
33
+ * <input value={firstName} onChange={e => setFirstName(e.target.value)} placeholder="First name" />
34
+ * <input value={email} onChange={e => setEmail(e.target.value)} placeholder="Email" />
35
+ * <input type="password" value={password} onChange={e => setPassword(e.target.value)} placeholder="Password" />
36
+ * {error && <p>{error}</p>}
37
+ * <button type="submit" disabled={isLoading}>Sign Up</button>
38
+ * </form>
39
+ * )}
40
+ * </SignupForm>
41
+ * ```
42
+ */
43
+ export declare function SignupForm({ children, onSuccess, onError, passwordless }: SignupFormProps): import("react/jsx-runtime").JSX.Element;
44
+ export {};
45
+ //# sourceMappingURL=SignupForm.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"SignupForm.d.ts","sourceRoot":"","sources":["../../../src/auth/components/SignupForm.tsx"],"names":[],"mappings":"AAEA,OAAc,EAAyB,KAAK,SAAS,EAAkB,MAAM,OAAO,CAAC;AAErF,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,kBAAkB,CAAC;AAE9D,UAAU,eAAe;IACvB;;;OAGG;IACH,QAAQ,EAAE,CAAC,KAAK,EAAE,qBAAqB,KAAK,SAAS,CAAC;IAEtD;;OAEG;IACH,SAAS,CAAC,EAAE,MAAM,IAAI,CAAC;IAEvB;;OAEG;IACH,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IAElC;;;OAGG;IACH,YAAY,CAAC,EAAE,OAAO,CAAC;CACxB;AAED;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wBAAgB,UAAU,CAAC,EAAE,QAAQ,EAAE,SAAS,EAAE,OAAO,EAAE,YAAoB,EAAE,EAAE,eAAe,2CA4JjG"}
@@ -0,0 +1,167 @@
1
+ "use strict";
2
+ 'use client';
3
+ Object.defineProperty(exports, "__esModule", { value: true });
4
+ exports.SignupForm = SignupForm;
5
+ const jsx_runtime_1 = require("react/jsx-runtime");
6
+ const react_1 = require("react");
7
+ const AkinAuthProvider_1 = require("../AkinAuthProvider");
8
+ /**
9
+ * Headless SignupForm component
10
+ *
11
+ * Provides all the logic for signup - you provide the UI.
12
+ *
13
+ * @example
14
+ * ```tsx
15
+ * <SignupForm onSuccess={() => router.push('/welcome')}>
16
+ * {({ firstName, setFirstName, email, setEmail, password, setPassword, isLoading, error, handleSubmit }) => (
17
+ * <form onSubmit={handleSubmit}>
18
+ * <input value={firstName} onChange={e => setFirstName(e.target.value)} placeholder="First name" />
19
+ * <input value={email} onChange={e => setEmail(e.target.value)} placeholder="Email" />
20
+ * <input type="password" value={password} onChange={e => setPassword(e.target.value)} placeholder="Password" />
21
+ * {error && <p>{error}</p>}
22
+ * <button type="submit" disabled={isLoading}>Sign Up</button>
23
+ * </form>
24
+ * )}
25
+ * </SignupForm>
26
+ * ```
27
+ */
28
+ function SignupForm({ children, onSuccess, onError, passwordless = false }) {
29
+ const { signUp, signUpPasswordless, signInWithGoogle, clearError, error: authError } = (0, AkinAuthProvider_1.useAkinAuth)();
30
+ const [firstName, setFirstName] = (0, react_1.useState)('');
31
+ const [lastName, setLastName] = (0, react_1.useState)('');
32
+ const [email, setEmail] = (0, react_1.useState)('');
33
+ const [password, setPassword] = (0, react_1.useState)('');
34
+ const [phone, setPhone] = (0, react_1.useState)('');
35
+ const [countryCode, setCountryCode] = (0, react_1.useState)('');
36
+ const [termsAccepted, setTermsAccepted] = (0, react_1.useState)(false);
37
+ const [marketingOptIn, setMarketingOptIn] = (0, react_1.useState)(false);
38
+ const [isLoading, setIsLoading] = (0, react_1.useState)(false);
39
+ const [localError, setLocalError] = (0, react_1.useState)(null);
40
+ const error = localError || authError;
41
+ const handleSubmit = (0, react_1.useCallback)(async (e) => {
42
+ e.preventDefault();
43
+ setLocalError(null);
44
+ clearError();
45
+ // Validation
46
+ if (!firstName.trim()) {
47
+ setLocalError('First name is required');
48
+ return;
49
+ }
50
+ if (!lastName.trim()) {
51
+ setLocalError('Last name is required');
52
+ return;
53
+ }
54
+ if (!email.trim()) {
55
+ setLocalError('Email is required');
56
+ return;
57
+ }
58
+ if (!passwordless && !password) {
59
+ setLocalError('Password is required');
60
+ return;
61
+ }
62
+ if (!termsAccepted) {
63
+ setLocalError('You must accept the terms and conditions');
64
+ return;
65
+ }
66
+ setIsLoading(true);
67
+ try {
68
+ if (passwordless) {
69
+ const result = await signUpPasswordless({
70
+ firstName: firstName.trim(),
71
+ lastName: lastName.trim(),
72
+ email: email.trim(),
73
+ phone: phone.trim() || undefined,
74
+ countryCode: countryCode.trim() || undefined,
75
+ termsAccepted,
76
+ marketingOptIn,
77
+ });
78
+ if (!result.success) {
79
+ setLocalError(result.error || 'Signup failed');
80
+ onError?.(result.error || 'Signup failed');
81
+ return;
82
+ }
83
+ }
84
+ else {
85
+ await signUp({
86
+ firstName: firstName.trim(),
87
+ lastName: lastName.trim(),
88
+ email: email.trim(),
89
+ password,
90
+ phone: phone.trim() || undefined,
91
+ countryCode: countryCode.trim() || undefined,
92
+ termsAccepted,
93
+ marketingOptIn,
94
+ });
95
+ }
96
+ onSuccess?.();
97
+ }
98
+ catch (err) {
99
+ const message = err instanceof Error ? err.message : 'Signup failed';
100
+ setLocalError(message);
101
+ onError?.(message);
102
+ }
103
+ finally {
104
+ setIsLoading(false);
105
+ }
106
+ }, [
107
+ firstName,
108
+ lastName,
109
+ email,
110
+ password,
111
+ phone,
112
+ countryCode,
113
+ termsAccepted,
114
+ marketingOptIn,
115
+ passwordless,
116
+ signUp,
117
+ signUpPasswordless,
118
+ clearError,
119
+ onSuccess,
120
+ onError,
121
+ ]);
122
+ const handleGoogleSignup = (0, react_1.useCallback)(async () => {
123
+ setLocalError(null);
124
+ clearError();
125
+ setIsLoading(true);
126
+ try {
127
+ await signInWithGoogle();
128
+ onSuccess?.();
129
+ }
130
+ catch (err) {
131
+ const message = err instanceof Error ? err.message : 'Google signup failed';
132
+ setLocalError(message);
133
+ onError?.(message);
134
+ }
135
+ finally {
136
+ setIsLoading(false);
137
+ }
138
+ }, [signInWithGoogle, clearError, onSuccess, onError]);
139
+ const handleClearError = (0, react_1.useCallback)(() => {
140
+ setLocalError(null);
141
+ clearError();
142
+ }, [clearError]);
143
+ return ((0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: children({
144
+ firstName,
145
+ setFirstName,
146
+ lastName,
147
+ setLastName,
148
+ email,
149
+ setEmail,
150
+ password,
151
+ setPassword,
152
+ phone,
153
+ setPhone,
154
+ countryCode,
155
+ setCountryCode,
156
+ termsAccepted,
157
+ setTermsAccepted,
158
+ marketingOptIn,
159
+ setMarketingOptIn,
160
+ isLoading,
161
+ error,
162
+ handleSubmit,
163
+ handleGoogleSignup,
164
+ clearError: handleClearError,
165
+ }) }));
166
+ }
167
+ //# sourceMappingURL=SignupForm.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"SignupForm.js","sourceRoot":"","sources":["../../../src/auth/components/SignupForm.tsx"],"names":[],"mappings":";AAAA,YAAY,CAAC;;AAkDb,gCA4JC;;AA5MD,iCAAqF;AACrF,0DAAkD;AA2BlD;;;;;;;;;;;;;;;;;;;GAmBG;AACH,SAAgB,UAAU,CAAC,EAAE,QAAQ,EAAE,SAAS,EAAE,OAAO,EAAE,YAAY,GAAG,KAAK,EAAmB;IAChG,MAAM,EAAE,MAAM,EAAE,kBAAkB,EAAE,gBAAgB,EAAE,UAAU,EAAE,KAAK,EAAE,SAAS,EAAE,GAAG,IAAA,8BAAW,GAAE,CAAC;IAErG,MAAM,CAAC,SAAS,EAAE,YAAY,CAAC,GAAG,IAAA,gBAAQ,EAAC,EAAE,CAAC,CAAC;IAC/C,MAAM,CAAC,QAAQ,EAAE,WAAW,CAAC,GAAG,IAAA,gBAAQ,EAAC,EAAE,CAAC,CAAC;IAC7C,MAAM,CAAC,KAAK,EAAE,QAAQ,CAAC,GAAG,IAAA,gBAAQ,EAAC,EAAE,CAAC,CAAC;IACvC,MAAM,CAAC,QAAQ,EAAE,WAAW,CAAC,GAAG,IAAA,gBAAQ,EAAC,EAAE,CAAC,CAAC;IAC7C,MAAM,CAAC,KAAK,EAAE,QAAQ,CAAC,GAAG,IAAA,gBAAQ,EAAC,EAAE,CAAC,CAAC;IACvC,MAAM,CAAC,WAAW,EAAE,cAAc,CAAC,GAAG,IAAA,gBAAQ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AAS;YACT,KAAK;YACL,YAAY;YACZ,kBAAkB;YAClB,UAAU,EAAE,gBAAgB;SAC7B,CAAC,GACD,CACJ,CAAC;AACJ,CAAC"}
@@ -0,0 +1,10 @@
1
+ export { AkinProvider, useAkinAuth, useSDK } from './AkinAuthProvider';
2
+ export { LoginForm } from './components/LoginForm';
3
+ export { SignupForm } from './components/SignupForm';
4
+ export { MagicLinkForm } from './components/MagicLinkForm';
5
+ export { RequireAuth } from './components/RequireAuth';
6
+ export { RequireGuest } from './components/RequireGuest';
7
+ export type { AkinUser, AkinMember, AuthState, AuthActions, AuthContextValue, SignUpData, PasswordlessSignUpData, LoginFormRenderProps, SignupFormRenderProps, MagicLinkFormRenderProps, } from '../types/auth';
8
+ export type { RequireAuthProps, RequireAuthRenderProps } from './components/RequireAuth';
9
+ export type { RequireGuestProps, RequireGuestRenderProps } from './components/RequireGuest';
10
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/auth/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,WAAW,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;AAGvE,OAAO,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAC;AACnD,OAAO,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AACrD,OAAO,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;AAG3D,OAAO,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AACvD,OAAO,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AAGzD,YAAY,EACV,QAAQ,EACR,UAAU,EACV,SAAS,EACT,WAAW,EACX,gBAAgB,EAChB,UAAU,EACV,sBAAsB,EACtB,oBAAoB,EACpB,qBAAqB,EACrB,wBAAwB,GACzB,MAAM,eAAe,CAAC;AAEvB,YAAY,EAAE,gBAAgB,EAAE,sBAAsB,EAAE,MAAM,0BAA0B,CAAC;AACzF,YAAY,EAAE,iBAAiB,EAAE,uBAAuB,EAAE,MAAM,2BAA2B,CAAC"}
@@ -0,0 +1,21 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.RequireGuest = exports.RequireAuth = exports.MagicLinkForm = exports.SignupForm = exports.LoginForm = exports.useSDK = exports.useAkinAuth = exports.AkinProvider = void 0;
4
+ // Auth provider and hooks
5
+ var AkinAuthProvider_1 = require("./AkinAuthProvider");
6
+ Object.defineProperty(exports, "AkinProvider", { enumerable: true, get: function () { return AkinAuthProvider_1.AkinProvider; } });
7
+ Object.defineProperty(exports, "useAkinAuth", { enumerable: true, get: function () { return AkinAuthProvider_1.useAkinAuth; } });
8
+ Object.defineProperty(exports, "useSDK", { enumerable: true, get: function () { return AkinAuthProvider_1.useSDK; } });
9
+ // Headless components
10
+ var LoginForm_1 = require("./components/LoginForm");
11
+ Object.defineProperty(exports, "LoginForm", { enumerable: true, get: function () { return LoginForm_1.LoginForm; } });
12
+ var SignupForm_1 = require("./components/SignupForm");
13
+ Object.defineProperty(exports, "SignupForm", { enumerable: true, get: function () { return SignupForm_1.SignupForm; } });
14
+ var MagicLinkForm_1 = require("./components/MagicLinkForm");
15
+ Object.defineProperty(exports, "MagicLinkForm", { enumerable: true, get: function () { return MagicLinkForm_1.MagicLinkForm; } });
16
+ // Auth guards
17
+ var RequireAuth_1 = require("./components/RequireAuth");
18
+ Object.defineProperty(exports, "RequireAuth", { enumerable: true, get: function () { return RequireAuth_1.RequireAuth; } });
19
+ var RequireGuest_1 = require("./components/RequireGuest");
20
+ Object.defineProperty(exports, "RequireGuest", { enumerable: true, get: function () { return RequireGuest_1.RequireGuest; } });
21
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/auth/index.ts"],"names":[],"mappings":";;;AAAA,0BAA0B;AAC1B,uDAAuE;AAA9D,gHAAA,YAAY,OAAA;AAAE,+GAAA,WAAW,OAAA;AAAE,0GAAA,MAAM,OAAA;AAE1C,sBAAsB;AACtB,oDAAmD;AAA1C,sGAAA,SAAS,OAAA;AAClB,sDAAqD;AAA5C,wGAAA,UAAU,OAAA;AACnB,4DAA2D;AAAlD,8GAAA,aAAa,OAAA;AAEtB,cAAc;AACd,wDAAuD;AAA9C,0GAAA,WAAW,OAAA;AACpB,0DAAyD;AAAhD,4GAAA,YAAY,OAAA"}
@@ -0,0 +1,17 @@
1
+ import { ApolloClient, NormalizedCacheObject } from '@apollo/client';
2
+ import type { AkinSDKConfig } from './config';
3
+ /**
4
+ * Set the GIP token provider for authenticated requests
5
+ * Called internally by AkinAuthProvider
6
+ */
7
+ export declare function setTokenProvider(provider: () => Promise<string | null>): void;
8
+ /**
9
+ * Clear the token cache (call on logout)
10
+ */
11
+ export declare function clearTokenCache(): void;
12
+ /**
13
+ * Create an Apollo Client configured for partner SDK usage
14
+ */
15
+ export declare function createAkinClient(config: AkinSDKConfig): ApolloClient<NormalizedCacheObject>;
16
+ export { gql } from '@apollo/client';
17
+ //# sourceMappingURL=client.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"AAEA,OAAO,EACL,YAAY,EAIZ,qBAAqB,EACtB,MAAM,gBAAgB,CAAC;AAGxB,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAW9C;;;GAGG;AACH,wBAAgB,gBAAgB,CAAC,QAAQ,EAAE,MAAM,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,QAItE;AAED;;GAEG;AACH,wBAAgB,eAAe,SAG9B;AAwBD;;GAEG;AACH,wBAAgB,gBAAgB,CAAC,MAAM,EAAE,aAAa,GAAG,YAAY,CAAC,qBAAqB,CAAC,CAsF3F;AAGD,OAAO,EAAE,GAAG,EAAE,MAAM,gBAAgB,CAAC"}
package/dist/client.js ADDED
@@ -0,0 +1,136 @@
1
+ "use strict";
2
+ 'use client';
3
+ Object.defineProperty(exports, "__esModule", { value: true });
4
+ exports.gql = void 0;
5
+ exports.setTokenProvider = setTokenProvider;
6
+ exports.clearTokenCache = clearTokenCache;
7
+ exports.createAkinClient = createAkinClient;
8
+ const client_1 = require("@apollo/client");
9
+ const context_1 = require("@apollo/client/link/context");
10
+ const error_1 = require("@apollo/client/link/error");
11
+ const config_1 = require("./config");
12
+ // Token cache to prevent excessive token fetches
13
+ let cachedToken = null;
14
+ let tokenCacheTime = 0;
15
+ const TOKEN_CACHE_DURATION = 5 * 60 * 1000; // 5 minutes
16
+ // GIP token provider - set by AkinAuthProvider
17
+ let gipTokenProvider = null;
18
+ /**
19
+ * Set the GIP token provider for authenticated requests
20
+ * Called internally by AkinAuthProvider
21
+ */
22
+ function setTokenProvider(provider) {
23
+ gipTokenProvider = provider;
24
+ cachedToken = null;
25
+ tokenCacheTime = 0;
26
+ }
27
+ /**
28
+ * Clear the token cache (call on logout)
29
+ */
30
+ function clearTokenCache() {
31
+ cachedToken = null;
32
+ tokenCacheTime = 0;
33
+ }
34
+ /**
35
+ * Get the current cached token or fetch a new one
36
+ */
37
+ async function getToken() {
38
+ if (!gipTokenProvider)
39
+ return null;
40
+ const now = Date.now();
41
+ const isCacheValid = cachedToken && now - tokenCacheTime < TOKEN_CACHE_DURATION;
42
+ if (isCacheValid) {
43
+ return cachedToken;
44
+ }
45
+ try {
46
+ cachedToken = await gipTokenProvider();
47
+ tokenCacheTime = Date.now();
48
+ return cachedToken;
49
+ }
50
+ catch {
51
+ return null;
52
+ }
53
+ }
54
+ /**
55
+ * Create an Apollo Client configured for partner SDK usage
56
+ */
57
+ function createAkinClient(config) {
58
+ const resolvedConfig = (0, config_1.resolveConfig)(config);
59
+ // HTTP link to GraphQL API
60
+ const httpLink = (0, client_1.createHttpLink)({
61
+ uri: resolvedConfig.apiUrl,
62
+ });
63
+ // Auth link - adds partner headers and GIP token
64
+ const authLink = (0, context_1.setContext)(async (_, { headers }) => {
65
+ const token = await getToken();
66
+ return {
67
+ headers: {
68
+ ...headers,
69
+ // Partner identification headers
70
+ 'X-Partner-API-Key': resolvedConfig.apiKey,
71
+ 'X-Partner-ID': resolvedConfig.partnerId,
72
+ // GIP auth token (if authenticated)
73
+ ...(token ? { Authorization: `Bearer ${token}` } : {}),
74
+ },
75
+ };
76
+ });
77
+ // Error handling link
78
+ const errorLink = (0, error_1.onError)(({ graphQLErrors, networkError, operation }) => {
79
+ if (graphQLErrors) {
80
+ graphQLErrors.forEach(({ message, locations, path, extensions }) => {
81
+ const errorCode = extensions?.code;
82
+ if (resolvedConfig.debug) {
83
+ console.error(`[Akin SDK] GraphQL error: ${message}`, { operation: operation.operationName, path, locations, code: errorCode });
84
+ }
85
+ // Handle authentication errors
86
+ if (errorCode === 'UNAUTHENTICATED') {
87
+ clearTokenCache();
88
+ }
89
+ });
90
+ }
91
+ if (networkError) {
92
+ if (resolvedConfig.debug) {
93
+ console.error(`[Akin SDK] Network error: ${networkError.message}`);
94
+ }
95
+ }
96
+ });
97
+ // Create and return the client
98
+ return new client_1.ApolloClient({
99
+ link: (0, client_1.from)([errorLink, authLink, httpLink]),
100
+ cache: new client_1.InMemoryCache({
101
+ typePolicies: {
102
+ Query: {
103
+ fields: {
104
+ // Cache member by ID
105
+ member: {
106
+ read(_, { args, toReference }) {
107
+ return args?.id ? toReference({ __typename: 'Member', id: args.id }) : undefined;
108
+ },
109
+ },
110
+ },
111
+ },
112
+ Member: {
113
+ keyFields: ['id'],
114
+ },
115
+ LoyaltyTransaction: {
116
+ keyFields: ['id'],
117
+ },
118
+ LoyaltyTierConfig: {
119
+ keyFields: ['id'],
120
+ },
121
+ },
122
+ }),
123
+ defaultOptions: {
124
+ watchQuery: {
125
+ fetchPolicy: 'cache-and-network',
126
+ },
127
+ query: {
128
+ fetchPolicy: 'cache-first',
129
+ },
130
+ },
131
+ });
132
+ }
133
+ // Re-export gql from Apollo for convenience
134
+ var client_2 = require("@apollo/client");
135
+ Object.defineProperty(exports, "gql", { enumerable: true, get: function () { return client_2.gql; } });
136
+ //# sourceMappingURL=client.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"client.js","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":";AAAA,YAAY,CAAC;;;AA0Bb,4CAIC;AAKD,0CAGC;AA2BD,4CAsFC;AArJD,2CAMwB;AACxB,yDAAyD;AACzD,qDAAoD;AAEpD,qCAAyC;AAEzC,iDAAiD;AACjD,IAAI,WAAW,GAAkB,IAAI,CAAC;AACtC,IAAI,cAAc,GAAW,CAAC,CAAC;AAC/B,MAAM,oBAAoB,GAAG,CAAC,GAAG,EAAE,GAAG,IAAI,CAAC,CAAC,YAAY;AAExD,+CAA+C;AAC/C,IAAI,gBAAgB,GAA0C,IAAI,CAAC;AAEnE;;;GAGG;AACH,SAAgB,gBAAgB,CAAC,QAAsC;IACrE,gBAAgB,GAAG,QAAQ,CAAC;IAC5B,WAAW,GAAG,IAAI,CAAC;IACnB,cAAc,GAAG,CAAC,CAAC;AACrB,CAAC;AAED;;GAEG;AACH,SAAgB,eAAe;IAC7B,WAAW,GAAG,IAAI,CAAC;IACnB,cAAc,GAAG,CAAC,CAAC;AACrB,CAAC;AAED;;GAEG;AACH,KAAK,UAAU,QAAQ;IACrB,IAAI,CAAC,gBAAgB;QAAE,OAAO,IAAI,CAAC;IAEnC,MAAM,GAAG,GAAG,IAAI,CAAC,GAAG,EAAE,CAAC;IACvB,MAAM,YAAY,GAAG,WAAW,IAAI,GAAG,GAAG,cAAc,GAAG,oBAAoB,CAAC;IAEhF,IAAI,YAAY,EAAE,CAAC;QACjB,OAAO,WAAW,CAAC;IACrB,CAAC;IAED,IAAI,CAAC;QACH,WAAW,GAAG,MAAM,gBAAgB,EAAE,CAAC;QACvC,cAAc,GAAG,IAAI,CAAC,GAAG,EAAE,CAAC;QAC5B,OAAO,WAAW,CAAC;IACrB,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,IAAI,CAAC;IACd,CAAC;AACH,CAAC;AAED;;GAEG;AACH,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+1,62 @@
1
+ import React from 'react';
2
+ import { type Country, type Value, getCountryCallingCode, parsePhoneNumber, isValidPhoneNumber } from 'react-phone-number-input';
3
+ export interface PhoneInputProps {
4
+ /**
5
+ * Current phone value in E.164 format (e.g., "+14155551234")
6
+ */
7
+ value: string;
8
+ /**
9
+ * Called when phone value changes with E.164 formatted value
10
+ */
11
+ onChange: (value: string) => void;
12
+ /**
13
+ * Default country code (e.g., "US", "AU", "MX")
14
+ * @default "US"
15
+ */
16
+ defaultCountry?: Country;
17
+ /**
18
+ * Placeholder text
19
+ * @default "Enter phone number"
20
+ */
21
+ placeholder?: string;
22
+ /**
23
+ * CSS class name for the container
24
+ */
25
+ className?: string;
26
+ /**
27
+ * Whether the input is disabled
28
+ */
29
+ disabled?: boolean;
30
+ /**
31
+ * Whether the input is required
32
+ */
33
+ required?: boolean;
34
+ /**
35
+ * Input ID for label association
36
+ */
37
+ id?: string;
38
+ /**
39
+ * Input name for form submission
40
+ */
41
+ name?: string;
42
+ }
43
+ /**
44
+ * Phone input component with country code selector
45
+ *
46
+ * Outputs phone numbers in E.164 format (e.g., "+14155551234")
47
+ * which is required by the Akin API.
48
+ *
49
+ * @example
50
+ * ```tsx
51
+ * <PhoneInput
52
+ * value={phone}
53
+ * onChange={setPhone}
54
+ * defaultCountry="MX"
55
+ * placeholder="Enter your phone"
56
+ * className="my-phone-input"
57
+ * />
58
+ * ```
59
+ */
60
+ export declare const PhoneInput: React.ForwardRefExoticComponent<PhoneInputProps & React.RefAttributes<HTMLInputElement>>;
61
+ export { isValidPhoneNumber, parsePhoneNumber, getCountryCallingCode, type Country, type Value as PhoneValue, };
62
+ //# sourceMappingURL=PhoneInput.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"PhoneInput.d.ts","sourceRoot":"","sources":["../../src/components/PhoneInput.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAqB,MAAM,OAAO,CAAC;AAC1C,OAAuB,EACrB,KAAK,OAAO,EACZ,KAAK,KAAK,EACV,qBAAqB,EACrB,gBAAgB,EAChB,kBAAkB,EACnB,MAAM,0BAA0B,CAAC;AAElC,MAAM,WAAW,eAAe;IAC9B;;OAEG;IACH,KAAK,EAAE,MAAM,CAAC;IAEd;;OAEG;IACH,QAAQ,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IAElC;;;OAGG;IACH,cAAc,CAAC,EAAE,OAAO,CAAC;IAEzB;;;OAGG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;IAErB;;OAEG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IAEnB;;OAEG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;IAEnB;;OAEG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;IAEnB;;OAEG;IACH,EAAE,CAAC,EAAE,MAAM,CAAC;IAEZ;;OAEG;IACH,IAAI,CAAC,EAAE,MAAM,CAAC;CACf;AAED;;;;;;;;;;;;;;;;GAgBG;AACH,eAAO,MAAM,UAAU,0FA+BtB,CAAC;AAKF,OAAO,EACL,kBAAkB,EAClB,gBAAgB,EAChB,qBAAqB,EACrB,KAAK,OAAO,EACZ,KAAK,KAAK,IAAI,UAAU,GACzB,CAAC"}
@@ -0,0 +1,65 @@
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.getCountryCallingCode = exports.parsePhoneNumber = exports.isValidPhoneNumber = exports.PhoneInput = void 0;
38
+ const jsx_runtime_1 = require("react/jsx-runtime");
39
+ const react_1 = require("react");
40
+ const react_phone_number_input_1 = __importStar(require("react-phone-number-input"));
41
+ Object.defineProperty(exports, "getCountryCallingCode", { enumerable: true, get: function () { return react_phone_number_input_1.getCountryCallingCode; } });
42
+ Object.defineProperty(exports, "parsePhoneNumber", { enumerable: true, get: function () { return react_phone_number_input_1.parsePhoneNumber; } });
43
+ Object.defineProperty(exports, "isValidPhoneNumber", { enumerable: true, get: function () { return react_phone_number_input_1.isValidPhoneNumber; } });
44
+ /**
45
+ * Phone input component with country code selector
46
+ *
47
+ * Outputs phone numbers in E.164 format (e.g., "+14155551234")
48
+ * which is required by the Akin API.
49
+ *
50
+ * @example
51
+ * ```tsx
52
+ * <PhoneInput
53
+ * value={phone}
54
+ * onChange={setPhone}
55
+ * defaultCountry="MX"
56
+ * placeholder="Enter your phone"
57
+ * className="my-phone-input"
58
+ * />
59
+ * ```
60
+ */
61
+ exports.PhoneInput = (0, react_1.forwardRef)(({ value, onChange, defaultCountry = 'US', placeholder = 'Enter phone number', className, disabled, required, id, name, }, ref) => {
62
+ return ((0, jsx_runtime_1.jsx)(react_phone_number_input_1.default, { ref: ref, international: true, countryCallingCodeEditable: false, defaultCountry: defaultCountry, value: value || undefined, onChange: (newValue) => onChange(newValue || ''), placeholder: placeholder, className: className, disabled: disabled, id: id, name: name }));
63
+ });
64
+ exports.PhoneInput.displayName = 'PhoneInput';
65
+ //# sourceMappingURL=PhoneInput.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"PhoneInput.js","sourceRoot":"","sources":["../../src/components/PhoneInput.tsx"],"names":[],"mappings":";AAAA,YAAY,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEb,iCAA0C;AAC1C,qFAMkC;AA2GhC,sGA9GA,gDAAqB,OA8GA;AADrB,iGA5GA,2CAAgB,OA4GA;AADhB,mGA1GA,6CAAkB,OA0GA;AAtDpB;;;;;;;;;;;;;;;;GAgBG;AACU,QAAA,UAAU,GAAG,IAAA,kBAAU,EAClC,CACE,EACE,KAAK,EACL,QAAQ,EACR,cAAc,GAAG,IAAI,EACrB,WAAW,GAAG,oBAAoB,EAClC,SAAS,EACT,QAAQ,EACR,QAAQ,EACR,EAAE,EACF,IAAI,GACL,EACD,GAAG,EACH,EAAE;IACF,OAAO,CACL,uBAAC,kCAAc,IACb,GAAG,EAAE,GAAU,EACf,aAAa,QACb,0BAA0B,EAAE,KAAK,EACjC,cAAc,EAAE,cAAc,EAC9B,KAAK,EAAG,KAAe,IAAI,SAAS,EACpC,QAAQ,EAAE,CAAC,QAAQ,EAAE,EAAE,CAAC,QAAQ,CAAC,QAAQ,IAAI,EAAE,CAAC,EAChD,WAAW,EAAE,WAAW,EACxB,SAAS,EAAE,SAAS,EACpB,QAAQ,EAAE,QAAQ,EAClB,EAAE,EAAE,EAAE,EACN,IAAI,EAAE,IAAI,GACV,CACH,CAAC;AACJ,CAAC,CACF,CAAC;AAEF,kBAAU,CAAC,WAAW,GAAG,YAAY,CAAC"}
@@ -0,0 +1,2 @@
1
+ export { PhoneInput, isValidPhoneNumber, parsePhoneNumber, getCountryCallingCode, type PhoneInputProps, type Country, type PhoneValue, } from './PhoneInput';
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/components/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,UAAU,EACV,kBAAkB,EAClB,gBAAgB,EAChB,qBAAqB,EACrB,KAAK,eAAe,EACpB,KAAK,OAAO,EACZ,KAAK,UAAU,GAChB,MAAM,cAAc,CAAC"}
@@ -0,0 +1,9 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getCountryCallingCode = exports.parsePhoneNumber = exports.isValidPhoneNumber = exports.PhoneInput = void 0;
4
+ var PhoneInput_1 = require("./PhoneInput");
5
+ Object.defineProperty(exports, "PhoneInput", { enumerable: true, get: function () { return PhoneInput_1.PhoneInput; } });
6
+ Object.defineProperty(exports, "isValidPhoneNumber", { enumerable: true, get: function () { return PhoneInput_1.isValidPhoneNumber; } });
7
+ Object.defineProperty(exports, "parsePhoneNumber", { enumerable: true, get: function () { return PhoneInput_1.parsePhoneNumber; } });
8
+ Object.defineProperty(exports, "getCountryCallingCode", { enumerable: true, get: function () { return PhoneInput_1.getCountryCallingCode; } });
9
+ //# sourceMappingURL=index.js.map