arky-sdk 0.4.21 → 0.4.23

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/dist/index.d.cts CHANGED
@@ -87,19 +87,6 @@ declare function getBlockTextValue(block: any, locale?: string): string;
87
87
  declare function formatMinor(amountMinor: number, currency: string): string;
88
88
  declare function formatPayment(payment: Payment): string;
89
89
 
90
- /**
91
- * Format a currency amount using Intl API.
92
- */
93
- declare function formatCurrency(amount: number, currencyCode: string, locale?: string): string;
94
- /**
95
- * Get the symbol for a currency code.
96
- */
97
- declare function getCurrencySymbol(currencyCode: string): string;
98
- /**
99
- * Get the name for a currency code.
100
- */
101
- declare function getCurrencyName(currencyCode: string): string;
102
-
103
90
  interface ValidationResult {
104
91
  isValid: boolean;
105
92
  error?: string;
@@ -133,7 +120,7 @@ declare global {
133
120
  }
134
121
  declare function track(eventName: string, params?: Record<string, any>): void;
135
122
 
136
- declare const SDK_VERSION = "0.4.21";
123
+ declare const SDK_VERSION = "0.4.23";
137
124
  declare const SUPPORTED_FRAMEWORKS: readonly ["astro", "react", "vue", "svelte", "vanilla"];
138
125
  interface ApiConfig {
139
126
  httpClient: any;
@@ -148,7 +135,6 @@ interface ApiConfig {
148
135
  declare function createArkySDK(config: HttpClientConfig & {
149
136
  market: string;
150
137
  locale?: string;
151
- fetchFullConfig?: boolean;
152
138
  }): Promise<{
153
139
  auth: {
154
140
  session(options?: RequestOptions): Promise<any>;
@@ -218,6 +204,7 @@ declare function createArkySDK(config: HttpClientConfig & {
218
204
  platform: {
219
205
  getConfig(options?: RequestOptions): Promise<PlatformConfig>;
220
206
  getConfigCache(): PlatformConfig | null;
207
+ getCurrencies(options?: RequestOptions): Promise<string[]>;
221
208
  };
222
209
  cms: {
223
210
  createNode(params: CreateNodeParams, options?: RequestOptions): Promise<any>;
@@ -332,9 +319,6 @@ declare function createArkySDK(config: HttpClientConfig & {
332
319
  getPriceAmount: (prices: any[]) => number;
333
320
  formatPayment: typeof formatPayment;
334
321
  formatMinor: typeof formatMinor;
335
- formatCurrency: typeof formatCurrency;
336
- getCurrencySymbol: typeof getCurrencySymbol;
337
- getCurrencyName: typeof getCurrencyName;
338
322
  validatePhoneNumber: typeof validatePhoneNumber;
339
323
  tzGroups: {
340
324
  label: string;
@@ -362,4 +346,4 @@ declare function createArkySDK(config: HttpClientConfig & {
362
346
  getStripeConnectClientId: () => string;
363
347
  }>;
364
348
 
365
- export { type ApiConfig, type GetCountriesResponse, type HttpClientConfig, type LocationCountry, type LocationState, Payment, SDK_VERSION, SUPPORTED_FRAMEWORKS, Slot, createArkySDK, formatCurrency, getCurrencyName, getCurrencySymbol };
349
+ export { type ApiConfig, type GetCountriesResponse, type HttpClientConfig, type LocationCountry, type LocationState, Payment, SDK_VERSION, SUPPORTED_FRAMEWORKS, Slot, createArkySDK };
package/dist/index.d.ts CHANGED
@@ -87,19 +87,6 @@ declare function getBlockTextValue(block: any, locale?: string): string;
87
87
  declare function formatMinor(amountMinor: number, currency: string): string;
88
88
  declare function formatPayment(payment: Payment): string;
89
89
 
90
- /**
91
- * Format a currency amount using Intl API.
92
- */
93
- declare function formatCurrency(amount: number, currencyCode: string, locale?: string): string;
94
- /**
95
- * Get the symbol for a currency code.
96
- */
97
- declare function getCurrencySymbol(currencyCode: string): string;
98
- /**
99
- * Get the name for a currency code.
100
- */
101
- declare function getCurrencyName(currencyCode: string): string;
102
-
103
90
  interface ValidationResult {
104
91
  isValid: boolean;
105
92
  error?: string;
@@ -133,7 +120,7 @@ declare global {
133
120
  }
134
121
  declare function track(eventName: string, params?: Record<string, any>): void;
135
122
 
136
- declare const SDK_VERSION = "0.4.21";
123
+ declare const SDK_VERSION = "0.4.23";
137
124
  declare const SUPPORTED_FRAMEWORKS: readonly ["astro", "react", "vue", "svelte", "vanilla"];
138
125
  interface ApiConfig {
139
126
  httpClient: any;
@@ -148,7 +135,6 @@ interface ApiConfig {
148
135
  declare function createArkySDK(config: HttpClientConfig & {
149
136
  market: string;
150
137
  locale?: string;
151
- fetchFullConfig?: boolean;
152
138
  }): Promise<{
153
139
  auth: {
154
140
  session(options?: RequestOptions): Promise<any>;
@@ -218,6 +204,7 @@ declare function createArkySDK(config: HttpClientConfig & {
218
204
  platform: {
219
205
  getConfig(options?: RequestOptions): Promise<PlatformConfig>;
220
206
  getConfigCache(): PlatformConfig | null;
207
+ getCurrencies(options?: RequestOptions): Promise<string[]>;
221
208
  };
222
209
  cms: {
223
210
  createNode(params: CreateNodeParams, options?: RequestOptions): Promise<any>;
@@ -332,9 +319,6 @@ declare function createArkySDK(config: HttpClientConfig & {
332
319
  getPriceAmount: (prices: any[]) => number;
333
320
  formatPayment: typeof formatPayment;
334
321
  formatMinor: typeof formatMinor;
335
- formatCurrency: typeof formatCurrency;
336
- getCurrencySymbol: typeof getCurrencySymbol;
337
- getCurrencyName: typeof getCurrencyName;
338
322
  validatePhoneNumber: typeof validatePhoneNumber;
339
323
  tzGroups: {
340
324
  label: string;
@@ -362,4 +346,4 @@ declare function createArkySDK(config: HttpClientConfig & {
362
346
  getStripeConnectClientId: () => string;
363
347
  }>;
364
348
 
365
- export { type ApiConfig, type GetCountriesResponse, type HttpClientConfig, type LocationCountry, type LocationState, Payment, SDK_VERSION, SUPPORTED_FRAMEWORKS, Slot, createArkySDK, formatCurrency, getCurrencyName, getCurrencySymbol };
349
+ export { type ApiConfig, type GetCountriesResponse, type HttpClientConfig, type LocationCountry, type LocationState, Payment, SDK_VERSION, SUPPORTED_FRAMEWORKS, Slot, createArkySDK };
package/dist/index.js CHANGED
@@ -1414,31 +1414,20 @@ var createPlatformApi = (apiConfig) => {
1414
1414
  },
1415
1415
  getConfigCache() {
1416
1416
  return cachedConfig;
1417
+ },
1418
+ async getCurrencies(options) {
1419
+ return apiConfig.httpClient.get("/v1/platform/currencies", options);
1417
1420
  }
1418
1421
  };
1419
1422
  };
1420
1423
 
1421
- // src/utils/currency.ts
1424
+ // src/utils/price.ts
1422
1425
  function formatCurrency(amount, currencyCode, locale = "en") {
1423
1426
  return new Intl.NumberFormat(locale, {
1424
1427
  style: "currency",
1425
1428
  currency: currencyCode.toUpperCase()
1426
1429
  }).format(amount);
1427
1430
  }
1428
- function getCurrencySymbol(currencyCode) {
1429
- const parts = new Intl.NumberFormat("en", {
1430
- style: "currency",
1431
- currency: currencyCode.toUpperCase(),
1432
- currencyDisplay: "narrowSymbol"
1433
- }).formatToParts(0);
1434
- return parts.find((p) => p.type === "currency")?.value || "";
1435
- }
1436
- function getCurrencyName(currencyCode) {
1437
- const displayNames = new Intl.DisplayNames(["en"], { type: "currency" });
1438
- return displayNames.of(currencyCode.toUpperCase()) || "";
1439
- }
1440
-
1441
- // src/utils/price.ts
1442
1431
  function convertToMajor(minorAmount) {
1443
1432
  return minorAmount / 100;
1444
1433
  }
@@ -1650,7 +1639,7 @@ function track(eventName, params) {
1650
1639
  }
1651
1640
 
1652
1641
  // src/index.ts
1653
- var SDK_VERSION = "0.4.21";
1642
+ var SDK_VERSION = "0.4.23";
1654
1643
  var SUPPORTED_FRAMEWORKS = [
1655
1644
  "astro",
1656
1645
  "react",
@@ -1732,9 +1721,6 @@ async function createArkySDK(config) {
1732
1721
  getPriceAmount: (prices) => getPriceAmount(prices, apiConfig.market),
1733
1722
  formatPayment,
1734
1723
  formatMinor,
1735
- formatCurrency,
1736
- getCurrencySymbol,
1737
- getCurrencyName,
1738
1724
  validatePhoneNumber,
1739
1725
  tzGroups,
1740
1726
  findTimeZone,
@@ -1759,6 +1745,6 @@ async function createArkySDK(config) {
1759
1745
  return sdk;
1760
1746
  }
1761
1747
 
1762
- export { PaymentMethodType, SDK_VERSION, SUPPORTED_FRAMEWORKS, createArkySDK, formatCurrency, getCurrencyName, getCurrencySymbol };
1748
+ export { PaymentMethodType, SDK_VERSION, SUPPORTED_FRAMEWORKS, createArkySDK };
1763
1749
  //# sourceMappingURL=index.js.map
1764
1750
  //# sourceMappingURL=index.js.map