arky-sdk 0.3.143 → 0.3.144

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,44 @@ 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
+ return apiConfig.httpClient.post(
1488
+ `/v1/businesses/${params.businessId}/workflows`,
1489
+ params,
1490
+ options
1491
+ );
1492
+ },
1493
+ async updateWorkflow(params, options) {
1494
+ return apiConfig.httpClient.put(
1495
+ `/v1/businesses/${apiConfig.businessId}/workflows/${params.id}`,
1496
+ params,
1497
+ options
1498
+ );
1499
+ },
1500
+ async deleteWorkflow(params, options) {
1501
+ return apiConfig.httpClient.delete(
1502
+ `/v1/businesses/${apiConfig.businessId}/workflows/${params.id}`,
1503
+ options
1504
+ );
1505
+ },
1506
+ async getWorkflow(params, options) {
1507
+ return apiConfig.httpClient.get(
1508
+ `/v1/businesses/${apiConfig.businessId}/workflows/${params.id}`,
1509
+ options
1510
+ );
1511
+ },
1512
+ async getWorkflows(params, options) {
1513
+ return apiConfig.httpClient.get(`/v1/businesses/${params.businessId}/workflows`, {
1514
+ ...options,
1515
+ params
1516
+ });
1517
+ }
1518
+ };
1519
+ };
1520
+
1476
1521
  // src/utils/currency.ts
1477
1522
  function getCurrencySymbol(currency) {
1478
1523
  const currencySymbols = {
@@ -1859,7 +1904,7 @@ function nameToKey(name) {
1859
1904
  }
1860
1905
 
1861
1906
  // src/index.ts
1862
- var SDK_VERSION = "0.3.136";
1907
+ var SDK_VERSION = "0.3.144";
1863
1908
  var SUPPORTED_FRAMEWORKS = [
1864
1909
  "astro",
1865
1910
  "react",
@@ -1911,6 +1956,7 @@ async function createArkySDK(config) {
1911
1956
  featureFlags: createFeatureFlagsApi(apiConfig),
1912
1957
  location: createLocationApi(apiConfig),
1913
1958
  network: createNetworkApi(apiConfig),
1959
+ workflow: createWorkflowApi(apiConfig),
1914
1960
  setBusinessId: (businessId) => {
1915
1961
  apiConfig.businessId = businessId;
1916
1962
  },