arky-sdk 0.4.78 → 0.4.79

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.cjs CHANGED
@@ -407,17 +407,17 @@ var createBusinessApi = (apiConfig) => {
407
407
  options
408
408
  );
409
409
  },
410
- async connectStripe(params, options) {
410
+ async oauthConnect(params, options) {
411
411
  return apiConfig.httpClient.post(
412
- `/v1/businesses/${params.businessId}/stripe/connect`,
413
- { code: params.code },
412
+ `/v1/businesses/${params.businessId}/oauth/connect`,
413
+ { provider: params.provider, code: params.code, redirectUri: params.redirectUri },
414
414
  options
415
415
  );
416
416
  },
417
- async disconnectStripe(params, options) {
417
+ async oauthDisconnect(params, options) {
418
418
  return apiConfig.httpClient.post(
419
- `/v1/businesses/${params.businessId}/stripe/disconnect`,
420
- {},
419
+ `/v1/businesses/${params.businessId}/oauth/disconnect`,
420
+ { provider: params.provider },
421
421
  options
422
422
  );
423
423
  }
@@ -1082,7 +1082,7 @@ var createDatabaseApi = (apiConfig) => {
1082
1082
  return {
1083
1083
  async scanData(params, options) {
1084
1084
  const response = await apiConfig.httpClient.get(
1085
- `/v1/operations/data`,
1085
+ `/v1/platform/data`,
1086
1086
  {
1087
1087
  ...options,
1088
1088
  params: {
@@ -1095,14 +1095,14 @@ var createDatabaseApi = (apiConfig) => {
1095
1095
  },
1096
1096
  async putData(params, options) {
1097
1097
  return apiConfig.httpClient.post(
1098
- `/v1/operations/data`,
1098
+ `/v1/platform/data`,
1099
1099
  params,
1100
1100
  options
1101
1101
  );
1102
1102
  },
1103
1103
  async deleteData(params, options) {
1104
1104
  return apiConfig.httpClient.delete(
1105
- `/v1/operations/data`,
1105
+ `/v1/platform/data`,
1106
1106
  {
1107
1107
  ...options,
1108
1108
  params: {
@@ -1112,7 +1112,7 @@ var createDatabaseApi = (apiConfig) => {
1112
1112
  );
1113
1113
  },
1114
1114
  async runScript(params, options) {
1115
- return apiConfig.httpClient.post(`/v1/operations/scripts`, params, options);
1115
+ return apiConfig.httpClient.post(`/v1/platform/scripts`, params, options);
1116
1116
  }
1117
1117
  };
1118
1118
  };
@@ -1121,11 +1121,11 @@ var createDatabaseApi = (apiConfig) => {
1121
1121
  var createLocationApi = (apiConfig) => {
1122
1122
  return {
1123
1123
  async getCountries(options) {
1124
- return apiConfig.httpClient.get(`/v1/operations/location/countries`, options);
1124
+ return apiConfig.httpClient.get(`/v1/platform/location/countries`, options);
1125
1125
  },
1126
1126
  async getCountryStates(countryCode, options) {
1127
1127
  return apiConfig.httpClient.get(
1128
- `/v1/operations/location/countries/${countryCode}/states`,
1128
+ `/v1/platform/location/countries/${countryCode}/states`,
1129
1129
  options
1130
1130
  );
1131
1131
  }
@@ -1351,18 +1351,8 @@ var createAudienceApi = (apiConfig) => {
1351
1351
  };
1352
1352
 
1353
1353
  // src/api/platform.ts
1354
- var cachedConfig = null;
1355
1354
  var createPlatformApi = (apiConfig) => {
1356
1355
  return {
1357
- async getConfig(options) {
1358
- if (cachedConfig) return cachedConfig;
1359
- const config = await apiConfig.httpClient.get("/v1/platform/config", options);
1360
- cachedConfig = config;
1361
- return config;
1362
- },
1363
- getConfigCache() {
1364
- return cachedConfig;
1365
- },
1366
1356
  async getCurrencies(options) {
1367
1357
  return apiConfig.httpClient.get("/v1/platform/currencies", options);
1368
1358
  }
@@ -1421,7 +1411,7 @@ function createEventsApi(apiConfig) {
1421
1411
  );
1422
1412
  },
1423
1413
  async getWebhookEvents(options) {
1424
- return apiConfig.httpClient.get(`/v1/operations/events/metadata`, options);
1414
+ return apiConfig.httpClient.get(`/v1/platform/events/metadata`, options);
1425
1415
  }
1426
1416
  };
1427
1417
  }
@@ -1722,13 +1712,12 @@ async function createArkySDK(config) {
1722
1712
  const platformApi = createPlatformApi(apiConfig);
1723
1713
  if (typeof window !== "undefined") {
1724
1714
  businessApi.getBusiness({}).then(({ data: business }) => {
1725
- if (business?.config?.analytics?.measurementId) {
1726
- injectGA4Script(business.config.analytics.measurementId);
1715
+ const ga4 = business?.config?.integrations?.find((i) => i.type === "google_analytics4");
1716
+ if (ga4?.measurementId) {
1717
+ injectGA4Script(ga4.measurementId);
1727
1718
  }
1728
1719
  }).catch(() => {
1729
1720
  });
1730
- platformApi.getConfig().catch(() => {
1731
- });
1732
1721
  }
1733
1722
  const sdk = {
1734
1723
  auth: authApi,
@@ -1804,11 +1793,7 @@ async function createArkySDK(config) {
1804
1793
  hasStock,
1805
1794
  getInventoryAt,
1806
1795
  getFirstAvailableFCId
1807
- },
1808
- // Platform config helpers
1809
- getPlatformConfig: () => platformApi.getConfigCache(),
1810
- getStripePublicKey: () => platformApi.getConfigCache()?.stripePublicKey,
1811
- getStripeConnectClientId: () => platformApi.getConfigCache()?.stripeConnectClientId
1796
+ }
1812
1797
  };
1813
1798
  return sdk;
1814
1799
  }