@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 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/components/index.ts"],"names":[],"mappings":";;;AAAA,2CAQsB;AAPpB,wGAAA,UAAU,OAAA;AACV,gHAAA,kBAAkB,OAAA;AAClB,8GAAA,gBAAgB,OAAA;AAChB,mHAAA,qBAAqB,OAAA"}
@@ -0,0 +1,111 @@
1
+ import type { I18nConfig } from './types/i18n';
2
+ import type { CurrencyConfig } from './types/currency';
3
+ /**
4
+ * Configuration for the Akin Partner SDK
5
+ */
6
+ export interface AkinSDKConfig {
7
+ /**
8
+ * Partner ID (UUID provided by Akin)
9
+ * @example 'b8a131b2-c40d-42f3-8a23-604d74e99999'
10
+ */
11
+ partnerId: string;
12
+ /**
13
+ * Partner API key (provided by Akin)
14
+ * Used for partner identification and API access
15
+ */
16
+ apiKey: string;
17
+ /**
18
+ * GraphQL API endpoint URL
19
+ * @default process.env.NEXT_PUBLIC_AKIN_SDK_API_URL
20
+ */
21
+ apiUrl?: string;
22
+ /**
23
+ * Firebase/GIP configuration
24
+ * Optional - defaults to NEXT_PUBLIC_AKIN_SDK_FIREBASE_* env vars
25
+ */
26
+ firebase?: {
27
+ apiKey: string;
28
+ authDomain: string;
29
+ projectId: string;
30
+ appId: string;
31
+ };
32
+ /**
33
+ * GIP tenant ID for multi-tenancy
34
+ * @default process.env.NEXT_PUBLIC_AKIN_SDK_GIP_TENANT_ID
35
+ */
36
+ gipTenantId?: string;
37
+ /**
38
+ * Environment
39
+ * @default 'production'
40
+ */
41
+ environment?: 'production' | 'staging' | 'development';
42
+ /**
43
+ * Enable debug logging
44
+ * @default false
45
+ */
46
+ debug?: boolean;
47
+ /**
48
+ * Internationalization configuration
49
+ * Configure locale, available languages, and custom translations
50
+ */
51
+ i18n?: I18nConfig;
52
+ /**
53
+ * Currency configuration
54
+ * Configure default currency and exchange rates
55
+ */
56
+ currency?: CurrencyConfig;
57
+ }
58
+ /**
59
+ * Default configuration values
60
+ * All sensitive values are read from environment variables
61
+ */
62
+ export declare const DEFAULT_CONFIG: {
63
+ apiUrl: string;
64
+ gipTenantId: string;
65
+ environment: "production";
66
+ debug: boolean;
67
+ firebase: {
68
+ apiKey: string;
69
+ authDomain: string;
70
+ projectId: string;
71
+ appId: string;
72
+ };
73
+ };
74
+ /**
75
+ * Staging configuration
76
+ */
77
+ export declare const STAGING_CONFIG: {
78
+ apiUrl: string;
79
+ gipTenantId: string;
80
+ };
81
+ /**
82
+ * Development configuration
83
+ */
84
+ export declare const DEV_CONFIG: {
85
+ apiUrl: string;
86
+ gipTenantId: string;
87
+ };
88
+ /**
89
+ * Resolved configuration with required core fields
90
+ */
91
+ export interface ResolvedAkinSDKConfig {
92
+ partnerId: string;
93
+ apiKey: string;
94
+ apiUrl: string;
95
+ firebase: {
96
+ apiKey: string;
97
+ authDomain: string;
98
+ projectId: string;
99
+ appId: string;
100
+ };
101
+ gipTenantId: string;
102
+ environment: 'production' | 'staging' | 'development';
103
+ debug: boolean;
104
+ i18n?: I18nConfig;
105
+ currency?: CurrencyConfig;
106
+ }
107
+ /**
108
+ * Resolve full config from partial user config
109
+ */
110
+ export declare function resolveConfig(config: AkinSDKConfig): ResolvedAkinSDKConfig;
111
+ //# sourceMappingURL=config.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC/C,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAEvD;;GAEG;AACH,MAAM,WAAW,aAAa;IAC5B;;;OAGG;IACH,SAAS,EAAE,MAAM,CAAC;IAElB;;;OAGG;IACH,MAAM,EAAE,MAAM,CAAC;IAEf;;;OAGG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;IAEhB;;;OAGG;IACH,QAAQ,CAAC,EAAE;QACT,MAAM,EAAE,MAAM,CAAC;QACf,UAAU,EAAE,MAAM,CAAC;QACnB,SAAS,EAAE,MAAM,CAAC;QAClB,KAAK,EAAE,MAAM,CAAC;KACf,CAAC;IAEF;;;OAGG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;IAErB;;;OAGG;IACH,WAAW,CAAC,EAAE,YAAY,GAAG,SAAS,GAAG,aAAa,CAAC;IAEvD;;;OAGG;IACH,KAAK,CAAC,EAAE,OAAO,CAAC;IAEhB;;;OAGG;IACH,IAAI,CAAC,EAAE,UAAU,CAAC;IAElB;;;OAGG;IACH,QAAQ,CAAC,EAAE,cAAc,CAAC;CAC3B;AAED;;;GAGG;AACH,eAAO,MAAM,cAAc;;;;;;;;;;;CAW1B,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,cAAc;;;CAG1B,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,UAAU;;;CAGtB,CAAC;AAEF;;GAEG;AACH,MAAM,WAAW,qBAAqB;IACpC,SAAS,EAAE,MAAM,CAAC;IAClB,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,EAAE;QACR,MAAM,EAAE,MAAM,CAAC;QACf,UAAU,EAAE,MAAM,CAAC;QACnB,SAAS,EAAE,MAAM,CAAC;QAClB,KAAK,EAAE,MAAM,CAAC;KACf,CAAC;IACF,WAAW,EAAE,MAAM,CAAC;IACpB,WAAW,EAAE,YAAY,GAAG,SAAS,GAAG,aAAa,CAAC;IACtD,KAAK,EAAE,OAAO,CAAC;IACf,IAAI,CAAC,EAAE,UAAU,CAAC;IAClB,QAAQ,CAAC,EAAE,cAAc,CAAC;CAC3B;AAED;;GAEG;AACH,wBAAgB,aAAa,CAAC,MAAM,EAAE,aAAa,GAAG,qBAAqB,CAmB1E"}
package/dist/config.js ADDED
@@ -0,0 +1,56 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.DEV_CONFIG = exports.STAGING_CONFIG = exports.DEFAULT_CONFIG = void 0;
4
+ exports.resolveConfig = resolveConfig;
5
+ /**
6
+ * Default configuration values
7
+ * All sensitive values are read from environment variables
8
+ */
9
+ exports.DEFAULT_CONFIG = {
10
+ apiUrl: process.env.NEXT_PUBLIC_AKIN_SDK_API_URL || '',
11
+ gipTenantId: process.env.NEXT_PUBLIC_AKIN_SDK_GIP_TENANT_ID || '',
12
+ environment: 'production',
13
+ debug: false,
14
+ firebase: {
15
+ apiKey: process.env.NEXT_PUBLIC_AKIN_SDK_FIREBASE_API_KEY || '',
16
+ authDomain: process.env.NEXT_PUBLIC_AKIN_SDK_FIREBASE_AUTH_DOMAIN || '',
17
+ projectId: process.env.NEXT_PUBLIC_AKIN_SDK_FIREBASE_PROJECT_ID || '',
18
+ appId: process.env.NEXT_PUBLIC_AKIN_SDK_FIREBASE_APP_ID || '',
19
+ },
20
+ };
21
+ /**
22
+ * Staging configuration
23
+ */
24
+ exports.STAGING_CONFIG = {
25
+ apiUrl: process.env.NEXT_PUBLIC_AKIN_SDK_STAGING_API_URL || '',
26
+ gipTenantId: process.env.NEXT_PUBLIC_AKIN_SDK_GIP_TENANT_ID || '',
27
+ };
28
+ /**
29
+ * Development configuration
30
+ */
31
+ exports.DEV_CONFIG = {
32
+ apiUrl: process.env.NEXT_PUBLIC_AKIN_SDK_DEV_API_URL || 'http://localhost:4000/graphql',
33
+ gipTenantId: process.env.NEXT_PUBLIC_AKIN_SDK_GIP_TENANT_ID || '',
34
+ };
35
+ /**
36
+ * Resolve full config from partial user config
37
+ */
38
+ function resolveConfig(config) {
39
+ const envConfig = config.environment === 'staging'
40
+ ? exports.STAGING_CONFIG
41
+ : config.environment === 'development'
42
+ ? exports.DEV_CONFIG
43
+ : {};
44
+ return {
45
+ partnerId: config.partnerId,
46
+ apiKey: config.apiKey,
47
+ apiUrl: config.apiUrl ?? envConfig.apiUrl ?? exports.DEFAULT_CONFIG.apiUrl,
48
+ firebase: config.firebase ?? exports.DEFAULT_CONFIG.firebase,
49
+ gipTenantId: config.gipTenantId ?? envConfig.gipTenantId ?? exports.DEFAULT_CONFIG.gipTenantId,
50
+ environment: config.environment ?? exports.DEFAULT_CONFIG.environment,
51
+ debug: config.debug ?? exports.DEFAULT_CONFIG.debug,
52
+ i18n: config.i18n,
53
+ currency: config.currency,
54
+ };
55
+ }
56
+ //# sourceMappingURL=config.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"config.js","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":";;;AA2HA,sCAmBC;AA3ED;;;GAGG;AACU,QAAA,cAAc,GAAG;IAC5B,MAAM,EAAE,OAAO,CAAC,GAAG,CAAC,4BAA4B,IAAI,EAAE;IACtD,WAAW,EAAE,OAAO,CAAC,GAAG,CAAC,kCAAkC,IAAI,EAAE;IACjE,WAAW,EAAE,YAAqB;IAClC,KAAK,EAAE,KAAK;IACZ,QAAQ,EAAE;QACR,MAAM,EAAE,OAAO,CAAC,GAAG,CAAC,qCAAqC,IAAI,EAAE;QAC/D,UAAU,EAAE,OAAO,CAAC,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AAI;QACjB,QAAQ,EAAE,MAAM,CAAC,QAAQ;KAC1B,CAAC;AACJ,CAAC"}
@@ -0,0 +1,22 @@
1
+ /**
2
+ * Preference options for loyalty onboarding
3
+ */
4
+ export interface PreferenceOption {
5
+ id: string;
6
+ label: string;
7
+ icon?: string;
8
+ description?: string;
9
+ }
10
+ /**
11
+ * Perk preferences - what rewards interest the member
12
+ */
13
+ export declare const PERK_PREFERENCES: PreferenceOption[];
14
+ /**
15
+ * Vibe preferences - what atmosphere the member prefers
16
+ */
17
+ export declare const VIBE_PREFERENCES: PreferenceOption[];
18
+ /**
19
+ * Location preferences - what types of places the member loves
20
+ */
21
+ export declare const LOCATION_PREFERENCES: PreferenceOption[];
22
+ //# sourceMappingURL=preferences.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"preferences.d.ts","sourceRoot":"","sources":["../../src/constants/preferences.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,MAAM,WAAW,gBAAgB;IAC/B,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AAED;;GAEG;AACH,eAAO,MAAM,gBAAgB,EAAE,gBAAgB,EAO9C,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,gBAAgB,EAAE,gBAAgB,EAmB9C,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,oBAAoB,EAAE,gBAAgB,EAOlD,CAAC"}
@@ -0,0 +1,52 @@
1
+ "use strict";
2
+ /**
3
+ * Preference options for loyalty onboarding
4
+ */
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.LOCATION_PREFERENCES = exports.VIBE_PREFERENCES = exports.PERK_PREFERENCES = void 0;
7
+ /**
8
+ * Perk preferences - what rewards interest the member
9
+ */
10
+ exports.PERK_PREFERENCES = [
11
+ { id: 'drink', label: 'Free welcome drink or coffee', icon: '🍸' },
12
+ { id: 'discount', label: 'Discount at onsite bar/restaurant', icon: '🍕' },
13
+ { id: 'cancel', label: 'Flexible cancellation or rebooking', icon: '📅' },
14
+ { id: 'checkin', label: 'Priority early check-in / late check-out', icon: '🕒' },
15
+ { id: 'night', label: 'Free night after 4 nights booked', icon: '🌙' },
16
+ { id: 'upgrade', label: 'Room upgrade (subject to availability)', icon: '🛏️' },
17
+ ];
18
+ /**
19
+ * Vibe preferences - what atmosphere the member prefers
20
+ */
21
+ exports.VIBE_PREFERENCES = [
22
+ {
23
+ id: 'social',
24
+ label: 'Social & Lively',
25
+ icon: '🥳',
26
+ description: 'I love meeting people and joining events or parties',
27
+ },
28
+ {
29
+ id: 'balanced',
30
+ label: 'Balanced',
31
+ icon: '⚖️',
32
+ description: 'I enjoy socializing, but also appreciate downtime',
33
+ },
34
+ {
35
+ id: 'calm',
36
+ label: 'Calm & Quiet',
37
+ icon: '🧘',
38
+ description: 'I prefer a peaceful space to relax or focus',
39
+ },
40
+ ];
41
+ /**
42
+ * Location preferences - what types of places the member loves
43
+ */
44
+ exports.LOCATION_PREFERENCES = [
45
+ { id: 'beaches', label: 'Beaches & Coastal Towns', icon: '🏖️' },
46
+ { id: 'mountains', label: 'Mountains & Nature Retreats', icon: '⛰️' },
47
+ { id: 'cities', label: 'Big Cities & Urban Adventures', icon: '🏙️' },
48
+ { id: 'towns', label: 'Small Towns & Countryside', icon: '🏡' },
49
+ { id: 'artsy', label: 'Artsy or Cultural Hubs', icon: '🎨' },
50
+ { id: 'wellness', label: 'Wellness & Mindful Escapes', icon: '🕯️' },
51
+ ];
52
+ //# sourceMappingURL=preferences.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"preferences.js","sourceRoot":"","sources":["../../src/constants/preferences.ts"],"names":[],"mappings":";AAAA;;GAEG;;;AASH;;GAEG;AACU,QAAA,gBAAgB,GAAuB;IAClD,EAAE,EAAE,EAAE,OAAO,EAAE,KAAK,EAAE,8BAA8B,EAAE,IAAI,EAAE,IAAI,EAAE;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AE,OAAO,EAAE,KAAK,EAAE,wBAAwB,EAAE,IAAI,EAAE,IAAI,EAAE;IAC5D,EAAE,EAAE,EAAE,UAAU,EAAE,KAAK,EAAE,4BAA4B,EAAE,IAAI,EAAE,KAAK,EAAE;CACrE,CAAC"}
@@ -0,0 +1,46 @@
1
+ import { type ReactNode } from 'react';
2
+ import type { CurrencyConfig, CurrencyContextValue } from '../types/currency';
3
+ interface CurrencyProviderProps {
4
+ children: ReactNode;
5
+ config?: CurrencyConfig;
6
+ }
7
+ /**
8
+ * Provider component for currency context
9
+ *
10
+ * @example
11
+ * // Basic usage with defaults (USD)
12
+ * <CurrencyProvider>
13
+ * <App />
14
+ * </CurrencyProvider>
15
+ *
16
+ * @example
17
+ * // With custom configuration
18
+ * <CurrencyProvider config={{
19
+ * defaultCurrency: 'EUR',
20
+ * exchangeRates: myLiveRates,
21
+ * }}>
22
+ * <App />
23
+ * </CurrencyProvider>
24
+ */
25
+ export declare function CurrencyProvider({ children, config }: CurrencyProviderProps): import("react/jsx-runtime").JSX.Element;
26
+ /**
27
+ * Hook to access currency context
28
+ *
29
+ * @example
30
+ * const { currency, setCurrency, formatPrice } = useCurrency();
31
+ *
32
+ * return (
33
+ * <div>
34
+ * <p>Price: {formatPrice(99.99)}</p>
35
+ * <button onClick={() => setCurrency('EUR')}>EUR</button>
36
+ * </div>
37
+ * );
38
+ */
39
+ export declare function useCurrency(): CurrencyContextValue;
40
+ /**
41
+ * Optional context for cases where currency might not be configured
42
+ * Returns undefined if not in provider, instead of throwing
43
+ */
44
+ export declare function useOptionalCurrency(): CurrencyContextValue | undefined;
45
+ export {};
46
+ //# sourceMappingURL=CurrencyProvider.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"CurrencyProvider.d.ts","sourceRoot":"","sources":["../../src/currency/CurrencyProvider.tsx"],"names":[],"mappings":"AAEA,OAAc,EAOZ,KAAK,SAAS,EACf,MAAM,OAAO,CAAC;AACf,OAAO,KAAK,EAIV,cAAc,EACd,oBAAoB,EACrB,MAAM,mBAAmB,CAAC;AAe3B,UAAU,qBAAqB;IAC7B,QAAQ,EAAE,SAAS,CAAC;IACpB,MAAM,CAAC,EAAE,cAAc,CAAC;CACzB;AAED;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAgB,gBAAgB,CAAC,EAAE,QAAQ,EAAE,MAAM,EAAE,EAAE,qBAAqB,2CAmH3E;AAED;;;;;;;;;;;;GAYG;AACH,wBAAgB,WAAW,IAAI,oBAAoB,CAMlD;AAED;;;GAGG;AACH,wBAAgB,mBAAmB,IAAI,oBAAoB,GAAG,SAAS,CAEtE"}
@@ -0,0 +1,145 @@
1
+ "use strict";
2
+ 'use client';
3
+ Object.defineProperty(exports, "__esModule", { value: true });
4
+ exports.CurrencyProvider = CurrencyProvider;
5
+ exports.useCurrency = useCurrency;
6
+ exports.useOptionalCurrency = useOptionalCurrency;
7
+ const jsx_runtime_1 = require("react/jsx-runtime");
8
+ const react_1 = require("react");
9
+ const exchangeRates_1 = require("./exchangeRates");
10
+ // Storage key for persisting currency preference
11
+ const CURRENCY_STORAGE_KEY = 'akin_currency';
12
+ // Context
13
+ const CurrencyContext = (0, react_1.createContext)(undefined);
14
+ /**
15
+ * Provider component for currency context
16
+ *
17
+ * @example
18
+ * // Basic usage with defaults (USD)
19
+ * <CurrencyProvider>
20
+ * <App />
21
+ * </CurrencyProvider>
22
+ *
23
+ * @example
24
+ * // With custom configuration
25
+ * <CurrencyProvider config={{
26
+ * defaultCurrency: 'EUR',
27
+ * exchangeRates: myLiveRates,
28
+ * }}>
29
+ * <App />
30
+ * </CurrencyProvider>
31
+ */
32
+ function CurrencyProvider({ children, config }) {
33
+ // Get initial currency from config, storage, or default to 'USD'
34
+ const getInitialCurrency = () => {
35
+ if (config?.defaultCurrency)
36
+ return config.defaultCurrency;
37
+ // Try to get from localStorage
38
+ if (typeof window !== 'undefined') {
39
+ const stored = localStorage.getItem(CURRENCY_STORAGE_KEY);
40
+ if (stored)
41
+ return stored;
42
+ }
43
+ return 'USD';
44
+ };
45
+ const [currency, setCurrencyState] = (0, react_1.useState)(getInitialCurrency);
46
+ // Merge custom exchange rates with defaults
47
+ const exchangeRates = (0, react_1.useMemo)(() => {
48
+ if (config?.exchangeRates) {
49
+ return { ...exchangeRates_1.DEFAULT_EXCHANGE_RATES, ...config.exchangeRates };
50
+ }
51
+ return exchangeRates_1.DEFAULT_EXCHANGE_RATES;
52
+ }, [config?.exchangeRates]);
53
+ // Available currencies
54
+ const availableCurrencies = (0, react_1.useMemo)(() => {
55
+ return config?.availableCurrencies ?? exchangeRates_1.DEFAULT_CURRENCIES;
56
+ }, [config?.availableCurrencies]);
57
+ // Get current currency option
58
+ const currentCurrency = (0, react_1.useMemo)(() => {
59
+ return ((0, exchangeRates_1.getCurrencyOption)(currency, availableCurrencies) ?? {
60
+ code: currency,
61
+ name: currency,
62
+ symbol: currency,
63
+ decimals: 2,
64
+ });
65
+ }, [availableCurrencies, currency]);
66
+ // Hydrate from localStorage on mount
67
+ (0, react_1.useEffect)(() => {
68
+ if (typeof window !== 'undefined' && !config?.defaultCurrency) {
69
+ const stored = localStorage.getItem(CURRENCY_STORAGE_KEY);
70
+ if (stored && availableCurrencies.some((c) => c.code === stored)) {
71
+ setCurrencyState(stored);
72
+ }
73
+ }
74
+ }, [availableCurrencies, config?.defaultCurrency]);
75
+ // Set currency handler
76
+ const setCurrency = (0, react_1.useCallback)((newCurrency) => {
77
+ setCurrencyState(newCurrency);
78
+ // Persist to localStorage
79
+ if (typeof window !== 'undefined') {
80
+ localStorage.setItem(CURRENCY_STORAGE_KEY, newCurrency);
81
+ }
82
+ // Call external callback
83
+ config?.onCurrencyChange?.(newCurrency);
84
+ }, [config]);
85
+ // Format a price in the current currency
86
+ const formatPrice = (0, react_1.useCallback)((amount, options) => {
87
+ return (0, exchangeRates_1.formatCurrencyAmount)(amount, currency, options);
88
+ }, [currency]);
89
+ // Convert from USD to current currency
90
+ const convertPrice = (0, react_1.useCallback)((amount) => {
91
+ return (0, exchangeRates_1.convertCurrency)(amount, 'USD', currency, exchangeRates);
92
+ }, [currency, exchangeRates]);
93
+ // Convert between any two currencies
94
+ const convert = (0, react_1.useCallback)((amount, from, to) => {
95
+ return (0, exchangeRates_1.convertCurrency)(amount, from, to ?? currency, exchangeRates);
96
+ }, [currency, exchangeRates]);
97
+ const value = (0, react_1.useMemo)(() => ({
98
+ currency,
99
+ availableCurrencies,
100
+ currentCurrency,
101
+ exchangeRates,
102
+ setCurrency,
103
+ formatPrice,
104
+ convertPrice,
105
+ convert,
106
+ }), [
107
+ currency,
108
+ availableCurrencies,
109
+ currentCurrency,
110
+ exchangeRates,
111
+ setCurrency,
112
+ formatPrice,
113
+ convertPrice,
114
+ convert,
115
+ ]);
116
+ return (0, jsx_runtime_1.jsx)(CurrencyContext.Provider, { value: value, children: children });
117
+ }
118
+ /**
119
+ * Hook to access currency context
120
+ *
121
+ * @example
122
+ * const { currency, setCurrency, formatPrice } = useCurrency();
123
+ *
124
+ * return (
125
+ * <div>
126
+ * <p>Price: {formatPrice(99.99)}</p>
127
+ * <button onClick={() => setCurrency('EUR')}>EUR</button>
128
+ * </div>
129
+ * );
130
+ */
131
+ function useCurrency() {
132
+ const context = (0, react_1.useContext)(CurrencyContext);
133
+ if (!context) {
134
+ throw new Error('useCurrency must be used within a CurrencyProvider or AkinProvider');
135
+ }
136
+ return context;
137
+ }
138
+ /**
139
+ * Optional context for cases where currency might not be configured
140
+ * Returns undefined if not in provider, instead of throwing
141
+ */
142
+ function useOptionalCurrency() {
143
+ return (0, react_1.useContext)(CurrencyContext);
144
+ }
145
+ //# sourceMappingURL=CurrencyProvider.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"CurrencyProvider.js","sourceRoot":"","sources":["../../src/currency/CurrencyProvider.tsx"],"names":[],"mappings":";AAAA,YAAY,CAAC;;AAuDb,4CAmHC;AAeD,kCAMC;AAMD,kDAEC;;AArMD,iCAQe;AAQf,mDAMyB;AAEzB,iDAAiD;AACjD,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,eAAe,CAAC,CAAC;AACrC,CAAC"}
@@ -0,0 +1,43 @@
1
+ import { type ReactNode } from 'react';
2
+ import type { CurrencyCode, CurrencySelectorRenderProps } from '../../types/currency';
3
+ export interface CurrencySelectorProps {
4
+ /**
5
+ * Render function receiving selector state and actions
6
+ */
7
+ children: (props: CurrencySelectorRenderProps) => ReactNode;
8
+ /**
9
+ * Callback when currency changes
10
+ */
11
+ onCurrencyChange?: (currency: CurrencyCode) => void;
12
+ /**
13
+ * Default open state
14
+ */
15
+ defaultOpen?: boolean;
16
+ }
17
+ /**
18
+ * Headless currency selector component
19
+ *
20
+ * @example
21
+ * <CurrencySelector>
22
+ * {({ currentCurrency, availableCurrencies, setCurrency, isOpen, toggle }) => (
23
+ * <div>
24
+ * <button onClick={toggle}>
25
+ * {currentCurrency.symbol} {currentCurrency.code}
26
+ * </button>
27
+ * {isOpen && (
28
+ * <ul>
29
+ * {availableCurrencies.map((curr) => (
30
+ * <li key={curr.code}>
31
+ * <button onClick={() => setCurrency(curr.code)}>
32
+ * {curr.symbol} {curr.name}
33
+ * </button>
34
+ * </li>
35
+ * ))}
36
+ * </ul>
37
+ * )}
38
+ * </div>
39
+ * )}
40
+ * </CurrencySelector>
41
+ */
42
+ export declare function CurrencySelector({ children, onCurrencyChange, defaultOpen, }: CurrencySelectorProps): import("react/jsx-runtime").JSX.Element;
43
+ //# sourceMappingURL=CurrencySelector.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"CurrencySelector.d.ts","sourceRoot":"","sources":["../../../src/currency/components/CurrencySelector.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAyB,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;AAE9D,OAAO,KAAK,EAAE,YAAY,EAAE,2BAA2B,EAAE,MAAM,sBAAsB,CAAC;AAEtF,MAAM,WAAW,qBAAqB;IACpC;;OAEG;IACH,QAAQ,EAAE,CAAC,KAAK,EAAE,2BAA2B,KAAK,SAAS,CAAC;IAC5D;;OAEG;IACH,gBAAgB,CAAC,EAAE,CAAC,QAAQ,EAAE,YAAY,KAAK,IAAI,CAAC;IACpD;;OAEG;IACH,WAAW,CAAC,EAAE,OAAO,CAAC;CACvB;AAED;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,wBAAgB,gBAAgB,CAAC,EAC/B,QAAQ,EACR,gBAAgB,EAChB,WAAmB,GACpB,EAAE,qBAAqB,2CAyCvB"}
@@ -0,0 +1,58 @@
1
+ "use strict";
2
+ 'use client';
3
+ Object.defineProperty(exports, "__esModule", { value: true });
4
+ exports.CurrencySelector = CurrencySelector;
5
+ const jsx_runtime_1 = require("react/jsx-runtime");
6
+ const react_1 = require("react");
7
+ const CurrencyProvider_1 = require("../CurrencyProvider");
8
+ /**
9
+ * Headless currency selector component
10
+ *
11
+ * @example
12
+ * <CurrencySelector>
13
+ * {({ currentCurrency, availableCurrencies, setCurrency, isOpen, toggle }) => (
14
+ * <div>
15
+ * <button onClick={toggle}>
16
+ * {currentCurrency.symbol} {currentCurrency.code}
17
+ * </button>
18
+ * {isOpen && (
19
+ * <ul>
20
+ * {availableCurrencies.map((curr) => (
21
+ * <li key={curr.code}>
22
+ * <button onClick={() => setCurrency(curr.code)}>
23
+ * {curr.symbol} {curr.name}
24
+ * </button>
25
+ * </li>
26
+ * ))}
27
+ * </ul>
28
+ * )}
29
+ * </div>
30
+ * )}
31
+ * </CurrencySelector>
32
+ */
33
+ function CurrencySelector({ children, onCurrencyChange, defaultOpen = false, }) {
34
+ const { currency, currentCurrency, availableCurrencies, setCurrency: setCurrencyContext, formatPrice, } = (0, CurrencyProvider_1.useCurrency)();
35
+ const [isOpen, setIsOpen] = (0, react_1.useState)(defaultOpen);
36
+ const toggle = (0, react_1.useCallback)(() => {
37
+ setIsOpen((prev) => !prev);
38
+ }, []);
39
+ const close = (0, react_1.useCallback)(() => {
40
+ setIsOpen(false);
41
+ }, []);
42
+ const setCurrency = (0, react_1.useCallback)((newCurrency) => {
43
+ setCurrencyContext(newCurrency);
44
+ onCurrencyChange?.(newCurrency);
45
+ close();
46
+ }, [setCurrencyContext, onCurrencyChange, close]);
47
+ return ((0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: children({
48
+ currency,
49
+ currentCurrency,
50
+ availableCurrencies,
51
+ setCurrency,
52
+ formatPrice,
53
+ isOpen,
54
+ toggle,
55
+ close,
56
+ }) }));
57
+ }
58
+ //# sourceMappingURL=CurrencySelector.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"CurrencySelector.js","sourceRoot":"","sources":["../../../src/currency/components/CurrencySelector.tsx"],"names":[],"mappings":";AAAA,YAAY,CAAC;;AA8Cb,4CA6CC;;AAzFD,iCAA8D;AAC9D,0DAAkD;AAkBlD;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,SAAgB,gBAAgB,CAAC,EAC/B,QAAQ,EACR,gBAAgB,EAChB,WAAW,GAAG,KAAK,GACG;IACtB,MAAM,EACJ,QAAQ,EACR,eAAe,EACf,mBAAmB,EACnB,WAAW,EAAE,kBAAkB,EAC/B,WAAW,GACZ,GAAG,IAAA,8BAAW,GAAE,CAAC;IAClB,MAAM,CAAC,MAAM,EAAE,SAAS,CAAC,GAAG,IAAA,gBAAQ,EAAC,WAAW,CAAC,CAAC;IAElD,MAAM,MAAM,GAAG,IAAA,mBAAW,EAAC,GAAG,EAAE;QAC9B,SAAS,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC;IAC7B,CAAC,EAAE,EAAE,CAAC,CAAC;IAEP,MAAM,KAAK,GAAG,IAAA,mBAAW,EAAC,GAAG,EAAE;QAC7B,SAAS,CAAC,KAAK,CAAC,CAAC;IACnB,CAAC,EAAE,EAAE,CAAC,CAAC;IAEP,MAAM,WAAW,GAAG,IAAA,mBAAW,EAC7B,CAAC,WAAyB,EAAE,EAAE;QAC5B,kBAAkB,CAAC,WAAW,CAAC,CAAC;QAChC,gBAAgB,EAAE,CAAC,WAAW,CAAC,CAAC;QAChC,KAAK,EAAE,CAAC;IACV,CAAC,EACD,CAAC,kBAAkB,EAAE,gBAAgB,EAAE,KAAK,CAAC,CAC9C,CAAC;IAEF,OAAO,CACL,2DACG,QAAQ,CAAC;YACR,QAAQ;YACR,eAAe;YACf,mBAAmB;YACnB,WAAW;YACX,WAAW;YACX,MAAM;YACN,MAAM;YACN,KAAK;SACN,CAAC,GACD,CACJ,CAAC;AACJ,CAAC"}
@@ -0,0 +1,40 @@
1
+ import type { CurrencyOption, ExchangeRates } from '../types/currency';
2
+ /**
3
+ * Default available currencies
4
+ * Partners can override this via config.currency.availableCurrencies
5
+ */
6
+ export declare const DEFAULT_CURRENCIES: CurrencyOption[];
7
+ /**
8
+ * Static fallback exchange rates (relative to USD)
9
+ * These are approximate rates for offline/fallback use
10
+ * Partners should provide live rates via config.currency.exchangeRates
11
+ *
12
+ * Last updated: 2025-01
13
+ */
14
+ export declare const DEFAULT_EXCHANGE_RATES: ExchangeRates;
15
+ /**
16
+ * Get currency option by code
17
+ */
18
+ export declare function getCurrencyOption(code: string, currencies?: CurrencyOption[]): CurrencyOption | undefined;
19
+ /**
20
+ * Get currency symbol by code
21
+ */
22
+ export declare function getCurrencySymbol(code: string, currencies?: CurrencyOption[]): string;
23
+ /**
24
+ * Format a price in a specific currency using Intl.NumberFormat
25
+ *
26
+ * @param amount The amount to format
27
+ * @param currencyCode The currency code (e.g., 'USD', 'EUR')
28
+ * @param options Optional Intl.NumberFormat options
29
+ */
30
+ export declare function formatCurrencyAmount(amount: number, currencyCode: string, options?: Intl.NumberFormatOptions): string;
31
+ /**
32
+ * Convert an amount from one currency to another
33
+ *
34
+ * @param amount The amount to convert
35
+ * @param fromCurrency Source currency code
36
+ * @param toCurrency Target currency code
37
+ * @param rates Exchange rates (relative to USD)
38
+ */
39
+ export declare function convertCurrency(amount: number, fromCurrency: string, toCurrency: string, rates?: ExchangeRates): number;
40
+ //# sourceMappingURL=exchangeRates.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"exchangeRates.d.ts","sourceRoot":"","sources":["../../src/currency/exchangeRates.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAEvE;;;GAGG;AACH,eAAO,MAAM,kBAAkB,EAAE,cAAc,EAS9C,CAAC;AAEF;;;;;;GAMG;AACH,eAAO,MAAM,sBAAsB,EAAE,aASpC,CAAC;AAEF;;GAEG;AACH,wBAAgB,iBAAiB,CAC/B,IAAI,EAAE,MAAM,EACZ,UAAU,GAAE,cAAc,EAAuB,GAChD,cAAc,GAAG,SAAS,CAE5B;AAED;;GAEG;AACH,wBAAgB,iBAAiB,CAC/B,IAAI,EAAE,MAAM,EACZ,UAAU,GAAE,cAAc,EAAuB,GAChD,MAAM,CAGR;AAED;;;;;;GAMG;AACH,wBAAgB,oBAAoB,CAClC,MAAM,EAAE,MAAM,EACd,YAAY,EAAE,MAAM,EACpB,OAAO,CAAC,EAAE,IAAI,CAAC,mBAAmB,GACjC,MAAM,CAYR;AAED;;;;;;;GAOG;AACH,wBAAgB,eAAe,CAC7B,MAAM,EAAE,MAAM,EACd,YAAY,EAAE,MAAM,EACpB,UAAU,EAAE,MAAM,EAClB,KAAK,GAAE,aAAsC,GAC5C,MAAM,CASR"}