@livechat/developer-studio-api 3.4.14 → 3.4.15

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.mjs CHANGED
@@ -1567,6 +1567,13 @@ var WorkflowDefinitionTaskType = {
1567
1567
  join: "JOIN"
1568
1568
  };
1569
1569
 
1570
+ // src/apis/integrations/text/platform/workflow/workflows/_contracts/requests/workflows.ts
1571
+ var WorkflowExecutionStatus = /* @__PURE__ */ ((WorkflowExecutionStatus2) => {
1572
+ WorkflowExecutionStatus2["Completed"] = "COMPLETED";
1573
+ WorkflowExecutionStatus2["Failed"] = "FAILED";
1574
+ return WorkflowExecutionStatus2;
1575
+ })(WorkflowExecutionStatus || {});
1576
+
1570
1577
  // src/apis/integrations/vercel/instance.ts
1571
1578
  import axios8 from "axios";
1572
1579
  var vercelClientInstance = axios8.create({
@@ -3381,12 +3388,68 @@ var textPlatformDashboardApi = {
3381
3388
  }
3382
3389
  };
3383
3390
 
3391
+ // src/utils/misc/mergeDeep.ts
3392
+ function isObject(item) {
3393
+ return item !== null && typeof item === "object" && !Array.isArray(item);
3394
+ }
3395
+ function mergeDeep(target, source) {
3396
+ if (!isObject(target) || !isObject(source)) {
3397
+ return source;
3398
+ }
3399
+ const output = __spreadValues({}, target);
3400
+ Object.keys(source).forEach((key) => {
3401
+ if (isObject(source[key])) {
3402
+ if (!(key in target)) {
3403
+ output[key] = source[key];
3404
+ } else {
3405
+ output[key] = mergeDeep(
3406
+ target[key],
3407
+ source[key]
3408
+ );
3409
+ }
3410
+ } else if (Array.isArray(source[key])) {
3411
+ output[key] = [...source[key]];
3412
+ } else {
3413
+ output[key] = source[key];
3414
+ }
3415
+ });
3416
+ return output;
3417
+ }
3418
+
3419
+ // src/utils/misc/debounce.ts
3420
+ var debounce = (func, wait) => {
3421
+ let timeout = null;
3422
+ return (...args) => {
3423
+ if (timeout) {
3424
+ clearTimeout(timeout);
3425
+ }
3426
+ timeout = setTimeout(() => {
3427
+ func(...args);
3428
+ }, wait);
3429
+ };
3430
+ };
3431
+
3432
+ // src/utils/misc/url/build.ts
3433
+ var buildUrlFromSegments = (segments, basePath, baseUrl = "") => segments.length ? `${baseUrl}${basePath}/${segments.map(encodeURIComponent).join("/")}` : basePath;
3434
+
3384
3435
  // src/apis/integrations/text/platform/workflow/credentials/api.ts
3436
+ var getUrl = (segments = []) => buildUrlFromSegments(segments, "/workflow_platform/credentials");
3437
+ var urls = {
3438
+ get: (id) => getUrl([id]),
3439
+ getList: () => getUrl(),
3440
+ create: () => getUrl(),
3441
+ update: (id) => getUrl([id]),
3442
+ delete: (id) => getUrl([id]),
3443
+ connect: (id) => getUrl([id, "connection"])
3444
+ };
3385
3445
  var textPlatformWorkflowsCredentialsApi = {
3446
+ meta: {
3447
+ urls
3448
+ },
3386
3449
  get(id, authorization) {
3387
3450
  return __async(this, null, function* () {
3388
3451
  return textClientInstance.get(
3389
- `/workflow_platform/credentials/${encodeURIComponent(id)}`,
3452
+ urls.get(id),
3390
3453
  getTextClientConfig(__spreadProps(__spreadValues({}, authorization), {
3391
3454
  ensureAuthorizationToken: true
3392
3455
  }))
@@ -3403,7 +3466,7 @@ var textPlatformWorkflowsCredentialsApi = {
3403
3466
  getList(authorization) {
3404
3467
  return __async(this, null, function* () {
3405
3468
  return textClientInstance.get(
3406
- "/workflow_platform/credentials",
3469
+ urls.getList(),
3407
3470
  getTextClientConfig(__spreadProps(__spreadValues({}, authorization), {
3408
3471
  ensureAuthorizationToken: true
3409
3472
  }))
@@ -3420,7 +3483,7 @@ var textPlatformWorkflowsCredentialsApi = {
3420
3483
  create(payload, authorization) {
3421
3484
  return __async(this, null, function* () {
3422
3485
  return textClientInstance.post(
3423
- "/workflow_platform/credentials",
3486
+ urls.create(),
3424
3487
  payload,
3425
3488
  getTextClientConfig(__spreadProps(__spreadValues({}, authorization), {
3426
3489
  ensureAuthorizationToken: true
@@ -3438,7 +3501,7 @@ var textPlatformWorkflowsCredentialsApi = {
3438
3501
  update(id, payload, authorization) {
3439
3502
  return __async(this, null, function* () {
3440
3503
  return textClientInstance.put(
3441
- `/workflow_platform/credentials/${encodeURIComponent(id)}`,
3504
+ urls.update(id),
3442
3505
  payload,
3443
3506
  getTextClientConfig(__spreadProps(__spreadValues({}, authorization), {
3444
3507
  ensureAuthorizationToken: true
@@ -3456,7 +3519,7 @@ var textPlatformWorkflowsCredentialsApi = {
3456
3519
  delete(id, authorization) {
3457
3520
  return __async(this, null, function* () {
3458
3521
  return textClientInstance.delete(
3459
- `/workflow_platform/credentials/${encodeURIComponent(id)}`,
3522
+ urls.delete(id),
3460
3523
  getTextClientConfig(__spreadProps(__spreadValues({}, authorization), {
3461
3524
  ensureAuthorizationToken: true
3462
3525
  }))
@@ -3473,7 +3536,7 @@ var textPlatformWorkflowsCredentialsApi = {
3473
3536
  connect(id, code, authorization) {
3474
3537
  return __async(this, null, function* () {
3475
3538
  return textClientInstance.put(
3476
- `/workflow_platform/credentials/${encodeURIComponent(id)}/connection`,
3539
+ urls.connect(id),
3477
3540
  {
3478
3541
  code
3479
3542
  },
@@ -3493,11 +3556,18 @@ var textPlatformWorkflowsCredentialsApi = {
3493
3556
  };
3494
3557
 
3495
3558
  // src/apis/integrations/text/platform/workflow/functions/api.ts
3559
+ var getUrl2 = (segments = []) => buildUrlFromSegments(segments, "/workflow_platform/functions");
3560
+ var urls2 = {
3561
+ get: () => getUrl2()
3562
+ };
3496
3563
  var textPlatformWorkflowsFunctionsApi = {
3564
+ meta: {
3565
+ urls: urls2
3566
+ },
3497
3567
  get(authorization) {
3498
3568
  return __async(this, null, function* () {
3499
3569
  return textClientInstance.get(
3500
- "/workflow_platform/functions",
3570
+ urls2.get(),
3501
3571
  getTextClientConfig(__spreadProps(__spreadValues({}, authorization), {
3502
3572
  ensureAuthorizationToken: true
3503
3573
  }))
@@ -3540,11 +3610,29 @@ var textPlatformWorkflowsResourcesApi = {
3540
3610
  };
3541
3611
 
3542
3612
  // src/apis/integrations/text/platform/workflow/workflows/api.ts
3613
+ var getUrl3 = (segments = []) => buildUrlFromSegments(segments, "/workflow_platform/workflows");
3614
+ var urls3 = {
3615
+ getWorkflows: () => getUrl3(),
3616
+ createWorkflow: () => getUrl3(),
3617
+ getWorkflow: (id) => getUrl3([id]),
3618
+ updateWorkflow: (id) => getUrl3([id]),
3619
+ deleteWorkflow: (id) => getUrl3([id]),
3620
+ createWorkflowDraft: (id) => getUrl3([id, "draft"]),
3621
+ publishWorkflowDraft: (id) => getUrl3([id, "publish"]),
3622
+ toggleWorkflowActivation: (id) => getUrl3([id, "activation"]),
3623
+ executeWorkflow: (id) => getUrl3([id, "executions"]),
3624
+ getWorkflowExecutionsList: (id) => getUrl3([id, "executions"]),
3625
+ getWorkflowExecutionDetails: (id, executionId) => getUrl3([id, "executions", executionId]),
3626
+ validateWorkflowDefinition: () => getUrl3(["validation"])
3627
+ };
3543
3628
  var textPlatformWorkflowsApi = {
3629
+ meta: {
3630
+ urls: urls3
3631
+ },
3544
3632
  getWorkflows(authorization) {
3545
3633
  return __async(this, null, function* () {
3546
3634
  const { data: workflows } = yield textClientInstance.get(
3547
- "/workflow_platform/workflows",
3635
+ urls3.getWorkflows(),
3548
3636
  getTextClientConfig(__spreadProps(__spreadValues({}, authorization), {
3549
3637
  ensureAuthorizationToken: true
3550
3638
  }))
@@ -3555,7 +3643,7 @@ var textPlatformWorkflowsApi = {
3555
3643
  getWorkflow(workflowId, authorization) {
3556
3644
  return __async(this, null, function* () {
3557
3645
  const { data: workflow } = yield textClientInstance.get(
3558
- `/workflow_platform/workflows/${encodeURIComponent(workflowId)}`,
3646
+ urls3.getWorkflow(workflowId),
3559
3647
  getTextClientConfig(__spreadProps(__spreadValues({}, authorization), {
3560
3648
  ensureAuthorizationToken: true
3561
3649
  }))
@@ -3566,7 +3654,7 @@ var textPlatformWorkflowsApi = {
3566
3654
  createWorkflow(payload, authorization) {
3567
3655
  return __async(this, null, function* () {
3568
3656
  return textClientInstance.post(
3569
- "/workflow_platform/workflows",
3657
+ urls3.createWorkflow(),
3570
3658
  payload,
3571
3659
  getTextClientConfig(__spreadProps(__spreadValues({}, authorization), {
3572
3660
  ensureAuthorizationToken: true
@@ -3577,7 +3665,7 @@ var textPlatformWorkflowsApi = {
3577
3665
  updateWorkflow(workflowId, payload, authorization) {
3578
3666
  return __async(this, null, function* () {
3579
3667
  return textClientInstance.put(
3580
- `/workflow_platform/workflows/${encodeURIComponent(workflowId)}`,
3668
+ urls3.updateWorkflow(workflowId),
3581
3669
  payload,
3582
3670
  getTextClientConfig(__spreadProps(__spreadValues({}, authorization), {
3583
3671
  ensureAuthorizationToken: true
@@ -3587,18 +3675,15 @@ var textPlatformWorkflowsApi = {
3587
3675
  },
3588
3676
  deleteWorkflow(workflowId, authorization) {
3589
3677
  return __async(this, null, function* () {
3590
- return textClientInstance.delete(
3591
- `/workflow_platform/workflows/${encodeURIComponent(workflowId)}`,
3592
- __spreadValues({}, getTextClientConfig(__spreadProps(__spreadValues({}, authorization), {
3593
- ensureAuthorizationToken: true
3594
- })))
3595
- );
3678
+ return textClientInstance.delete(urls3.deleteWorkflow(workflowId), __spreadValues({}, getTextClientConfig(__spreadProps(__spreadValues({}, authorization), {
3679
+ ensureAuthorizationToken: true
3680
+ }))));
3596
3681
  });
3597
3682
  },
3598
3683
  createWorkflowDraft(workflowId, payload, authorization) {
3599
3684
  return __async(this, null, function* () {
3600
3685
  return textClientInstance.post(
3601
- `/workflow_platform/workflows/${encodeURIComponent(workflowId)}/draft`,
3686
+ urls3.createWorkflowDraft(workflowId),
3602
3687
  payload,
3603
3688
  getTextClientConfig(__spreadProps(__spreadValues({}, authorization), {
3604
3689
  ensureAuthorizationToken: true
@@ -3609,7 +3694,7 @@ var textPlatformWorkflowsApi = {
3609
3694
  publishWorkflowDraft(workflowId, authorization) {
3610
3695
  return __async(this, null, function* () {
3611
3696
  return textClientInstance.post(
3612
- `/workflow_platform/workflows/${encodeURIComponent(workflowId)}/publish`,
3697
+ urls3.publishWorkflowDraft(workflowId),
3613
3698
  getTextClientConfig(__spreadProps(__spreadValues({}, authorization), {
3614
3699
  ensureAuthorizationToken: true
3615
3700
  }))
@@ -3619,9 +3704,7 @@ var textPlatformWorkflowsApi = {
3619
3704
  toggleWorkflowActivation(workflowId, isActive, authorization) {
3620
3705
  return __async(this, null, function* () {
3621
3706
  return textClientInstance.put(
3622
- `/workflow_platform/workflows/${encodeURIComponent(
3623
- workflowId
3624
- )}/activation`,
3707
+ urls3.toggleWorkflowActivation(workflowId),
3625
3708
  {
3626
3709
  active: isActive
3627
3710
  },
@@ -3634,9 +3717,7 @@ var textPlatformWorkflowsApi = {
3634
3717
  executeWorkflow(workflowId, input, authorization) {
3635
3718
  return __async(this, null, function* () {
3636
3719
  const { data: execution } = yield textClientInstance.post(
3637
- `/workflow_platform/workflows/${encodeURIComponent(
3638
- workflowId
3639
- )}/executions`,
3720
+ urls3.executeWorkflow(workflowId),
3640
3721
  {
3641
3722
  input
3642
3723
  },
@@ -3650,9 +3731,7 @@ var textPlatformWorkflowsApi = {
3650
3731
  getWorkflowExecutionsList(workflowId, authorization) {
3651
3732
  return __async(this, null, function* () {
3652
3733
  const { data: executions } = yield textClientInstance.get(
3653
- `/workflow_platform/workflows/${encodeURIComponent(
3654
- workflowId
3655
- )}/executions`,
3734
+ urls3.executeWorkflow(workflowId),
3656
3735
  getTextClientConfig(__spreadProps(__spreadValues({}, authorization), {
3657
3736
  ensureAuthorizationToken: true
3658
3737
  }))
@@ -3663,9 +3742,7 @@ var textPlatformWorkflowsApi = {
3663
3742
  getWorkflowExecutionDetails(workflowId, executionId, authorization) {
3664
3743
  return __async(this, null, function* () {
3665
3744
  const { data: execution } = yield textClientInstance.get(
3666
- `/workflow_platform/workflows/${encodeURIComponent(
3667
- workflowId
3668
- )}/executions/${encodeURIComponent(executionId)}`,
3745
+ urls3.getWorkflowExecutionDetails(workflowId, executionId),
3669
3746
  getTextClientConfig(__spreadProps(__spreadValues({}, authorization), {
3670
3747
  ensureAuthorizationToken: true
3671
3748
  }))
@@ -3676,7 +3753,7 @@ var textPlatformWorkflowsApi = {
3676
3753
  validateWorkflowDefinition(payload, authorization) {
3677
3754
  return __async(this, null, function* () {
3678
3755
  yield textClientInstance.post(
3679
- "/workflow_platform/workflows/validation",
3756
+ urls3.validateWorkflowDefinition(),
3680
3757
  payload,
3681
3758
  getTextClientConfig(__spreadProps(__spreadValues({}, authorization), {
3682
3759
  ensureAuthorizationToken: true
@@ -5601,19 +5678,34 @@ var productsApi = {
5601
5678
  };
5602
5679
 
5603
5680
  // src/apis/platform/accounts/accounts/api.ts
5604
- var platformAccountsAccountApi = {
5681
+ var urls4 = (withBaseUrl = false) => {
5682
+ const getUrl5 = (segments = []) => buildUrlFromSegments(
5683
+ segments,
5684
+ "/v2/accounts",
5685
+ withBaseUrl ? platformAccountsClientInstance.config.baseURL : void 0
5686
+ );
5687
+ return {
5688
+ getAccounts: () => getUrl5(),
5689
+ getAccount: (id) => getUrl5([id]),
5690
+ getMeAccount: () => getUrl5(["me"])
5691
+ };
5692
+ };
5693
+ var api = {
5605
5694
  getAccounts(authorization) {
5606
5695
  return __async(this, null, function* () {
5607
- return platformAccountsClientInstance.get("/v2/accounts", {
5608
- authorization,
5609
- customErrorMessage: "Accounts couldn't be fetched."
5610
- });
5696
+ return platformAccountsClientInstance.get(
5697
+ urls4().getAccounts(),
5698
+ {
5699
+ authorization,
5700
+ customErrorMessage: "Accounts couldn't be fetched."
5701
+ }
5702
+ );
5611
5703
  });
5612
5704
  },
5613
5705
  getAccount(accountId, authorization) {
5614
5706
  return __async(this, null, function* () {
5615
5707
  return platformAccountsClientInstance.get(
5616
- `/v2/accounts/${encodeURIComponent(accountId)}`,
5708
+ urls4().getAccount(accountId),
5617
5709
  {
5618
5710
  authorization,
5619
5711
  customErrorMessage: "Account couldn't be fetched."
@@ -5633,6 +5725,11 @@ var platformAccountsAccountApi = {
5633
5725
  });
5634
5726
  }
5635
5727
  };
5728
+ var platformAccountsAccountApi = __spreadProps(__spreadValues({}, api), {
5729
+ meta: {
5730
+ urls: urls4
5731
+ }
5732
+ });
5636
5733
 
5637
5734
  // src/apis/platform/accounts/client/api.ts
5638
5735
  var platformAccountsClientApi = {
@@ -5795,11 +5892,19 @@ var platformAccountsPersonalAccessTokenApi = {
5795
5892
  };
5796
5893
 
5797
5894
  // src/apis/platform/accounts/products/api.ts
5895
+ var getUrl4 = (segments = []) => buildUrlFromSegments(segments, "/v2/organizations");
5896
+ var urls5 = {
5897
+ getOrganizationProducts: () => getUrl4(["my", "products"]),
5898
+ updateOrganizationProducts: () => getUrl4(["my", "products"])
5899
+ };
5798
5900
  var platformAccountsProductsApi = {
5901
+ meta: {
5902
+ urls: urls5
5903
+ },
5799
5904
  getOrganizationProducts(authorization) {
5800
5905
  return __async(this, null, function* () {
5801
5906
  return platformAccountsClientInstance.get(
5802
- "/v2/organizations/my/products",
5907
+ urls5.getOrganizationProducts(),
5803
5908
  { authorization, customErrorMessage: "Products couldn't be fetched." }
5804
5909
  );
5805
5910
  });
@@ -5807,7 +5912,7 @@ var platformAccountsProductsApi = {
5807
5912
  updateOrganizationProducts(payload, authorization) {
5808
5913
  return __async(this, null, function* () {
5809
5914
  return platformAccountsClientInstance.post(
5810
- "/v2/organizations/my/products",
5915
+ urls5.updateOrganizationProducts(),
5811
5916
  payload,
5812
5917
  { authorization, customErrorMessage: "Products couldn't be updated." }
5813
5918
  );
@@ -7968,7 +8073,7 @@ var platformApi = {
7968
8073
  };
7969
8074
 
7970
8075
  // src/apis/api.ts
7971
- var api = {
8076
+ var api2 = {
7972
8077
  platform: platformApi,
7973
8078
  products: productsApi,
7974
8079
  integrations: integrationsApi,
@@ -8008,7 +8113,7 @@ function initApi(config, tokens) {
8008
8113
  initBigCommerceClient((_u = tokens == null ? void 0 : tokens.bigcommerce) == null ? void 0 : _u.token, (_v = tokens == null ? void 0 : tokens.bigcommerce) == null ? void 0 : _v.shop);
8009
8114
  initHubspotClient((_w = tokens == null ? void 0 : tokens.hubspot) == null ? void 0 : _w.token);
8010
8115
  initSlackClient((_x = tokens == null ? void 0 : tokens.slack) == null ? void 0 : _x.token);
8011
- api.isInitialized = true;
8116
+ api2.isInitialized = true;
8012
8117
  }
8013
8118
 
8014
8119
  // ../../../private/utils/src/serializers/base64.ts
@@ -8071,47 +8176,6 @@ function getIntegrationFlowUrl(name, flow, trigger, context, state, config) {
8071
8176
  window.location.href = url;
8072
8177
  });
8073
8178
  }
8074
-
8075
- // src/utils/misc/mergeDeep.ts
8076
- function isObject(item) {
8077
- return item !== null && typeof item === "object" && !Array.isArray(item);
8078
- }
8079
- function mergeDeep(target, source) {
8080
- if (!isObject(target) || !isObject(source)) {
8081
- return source;
8082
- }
8083
- const output = __spreadValues({}, target);
8084
- Object.keys(source).forEach((key) => {
8085
- if (isObject(source[key])) {
8086
- if (!(key in target)) {
8087
- output[key] = source[key];
8088
- } else {
8089
- output[key] = mergeDeep(
8090
- target[key],
8091
- source[key]
8092
- );
8093
- }
8094
- } else if (Array.isArray(source[key])) {
8095
- output[key] = [...source[key]];
8096
- } else {
8097
- output[key] = source[key];
8098
- }
8099
- });
8100
- return output;
8101
- }
8102
-
8103
- // src/utils/misc/debounce.ts
8104
- var debounce = (func, wait) => {
8105
- let timeout = null;
8106
- return (...args) => {
8107
- if (timeout) {
8108
- clearTimeout(timeout);
8109
- }
8110
- timeout = setTimeout(() => {
8111
- func(...args);
8112
- }, wait);
8113
- };
8114
- };
8115
8179
  export {
8116
8180
  API_NOTIFICATIONS,
8117
8181
  AccountsApiError,
@@ -8145,10 +8209,11 @@ export {
8145
8209
  UnauthorizeAccountsApiError,
8146
8210
  UnauthorizeApiError,
8147
8211
  WorkflowDefinitionTaskType,
8212
+ WorkflowExecutionStatus,
8148
8213
  WorkflowTemplateCategory,
8149
8214
  adapterClientInstance,
8150
8215
  allAppTemplates,
8151
- api,
8216
+ api2 as api,
8152
8217
  appBaseTemplates,
8153
8218
  appRepositoryTemplates,
8154
8219
  appRepositoryTemplatesMap,
@@ -8157,6 +8222,7 @@ export {
8157
8222
  bigCommerceClientInstance,
8158
8223
  bigcommerceEventsZods,
8159
8224
  billingClientInstance,
8225
+ buildUrlFromSegments,
8160
8226
  debounce,
8161
8227
  dpsClientInstance,
8162
8228
  getAdapterClientConfig,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@livechat/developer-studio-api",
3
- "version": "3.4.14",
3
+ "version": "3.4.15",
4
4
  "description": "This project is API for LiveChat Developer Studio.",
5
5
  "main": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",
@@ -21,8 +21,8 @@
21
21
  "tsup": "^7.1.0",
22
22
  "typescript": "^5.1.6",
23
23
  "eslint-config-custom": "0.0.10",
24
- "utils": "0.0.4",
25
- "tsconfig": "0.0.1"
24
+ "tsconfig": "0.0.1",
25
+ "utils": "0.0.4"
26
26
  },
27
27
  "scripts": {
28
28
  "build": "tsup",