arky-sdk 0.3.143 → 0.3.145

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
@@ -416,7 +416,8 @@ var createMediaApi = (apiConfig) => {
416
416
  }
417
417
  });
418
418
  if (!response.ok) {
419
- throw new Error("Upload failed, server said no");
419
+ const errorText = await response.text().catch(() => "Unknown error");
420
+ throw new Error(`Upload failed (${response.status}): ${errorText}`);
420
421
  }
421
422
  return await response.json();
422
423
  },
@@ -686,7 +687,13 @@ var getBlockObjectValues = (entry, blockKey, locale = "en") => {
686
687
  return [];
687
688
  }
688
689
  const values = getBlockValues(entry, blockKey);
690
+ if (!values || !Array.isArray(values)) {
691
+ return [];
692
+ }
689
693
  const parsed = values.map((obj) => {
694
+ if (!obj || !obj.value || !Array.isArray(obj.value)) {
695
+ return {};
696
+ }
690
697
  const res = obj.value.reduce((acc, current) => {
691
698
  acc[current.key] = unwrapBlock(current, locale);
692
699
  return acc;
@@ -1473,6 +1480,46 @@ var createNetworkApi = (apiConfig) => {
1473
1480
  };
1474
1481
  };
1475
1482
 
1483
+ // src/api/workflow.ts
1484
+ var createWorkflowApi = (apiConfig) => {
1485
+ return {
1486
+ async createWorkflow(params, options) {
1487
+ const businessId = params.businessId || apiConfig.businessId;
1488
+ return apiConfig.httpClient.post(
1489
+ `/v1/businesses/${businessId}/workflows`,
1490
+ { ...params, businessId },
1491
+ options
1492
+ );
1493
+ },
1494
+ async updateWorkflow(params, options) {
1495
+ return apiConfig.httpClient.put(
1496
+ `/v1/businesses/${apiConfig.businessId}/workflows/${params.id}`,
1497
+ params,
1498
+ options
1499
+ );
1500
+ },
1501
+ async deleteWorkflow(params, options) {
1502
+ return apiConfig.httpClient.delete(
1503
+ `/v1/businesses/${apiConfig.businessId}/workflows/${params.id}`,
1504
+ options
1505
+ );
1506
+ },
1507
+ async getWorkflow(params, options) {
1508
+ return apiConfig.httpClient.get(
1509
+ `/v1/businesses/${apiConfig.businessId}/workflows/${params.id}`,
1510
+ options
1511
+ );
1512
+ },
1513
+ async getWorkflows(params, options) {
1514
+ const businessId = params?.businessId || apiConfig.businessId;
1515
+ return apiConfig.httpClient.get(`/v1/businesses/${businessId}/workflows`, {
1516
+ ...options,
1517
+ params
1518
+ });
1519
+ }
1520
+ };
1521
+ };
1522
+
1476
1523
  // src/utils/currency.ts
1477
1524
  function getCurrencySymbol(currency) {
1478
1525
  const currencySymbols = {
@@ -1859,7 +1906,7 @@ function nameToKey(name) {
1859
1906
  }
1860
1907
 
1861
1908
  // src/index.ts
1862
- var SDK_VERSION = "0.3.136";
1909
+ var SDK_VERSION = "0.3.145";
1863
1910
  var SUPPORTED_FRAMEWORKS = [
1864
1911
  "astro",
1865
1912
  "react",
@@ -1911,6 +1958,7 @@ async function createArkySDK(config) {
1911
1958
  featureFlags: createFeatureFlagsApi(apiConfig),
1912
1959
  location: createLocationApi(apiConfig),
1913
1960
  network: createNetworkApi(apiConfig),
1961
+ workflow: createWorkflowApi(apiConfig),
1914
1962
  setBusinessId: (businessId) => {
1915
1963
  apiConfig.businessId = businessId;
1916
1964
  },