@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.js CHANGED
@@ -99,10 +99,11 @@ __export(src_exports, {
99
99
  UnauthorizeAccountsApiError: () => UnauthorizeAccountsApiError,
100
100
  UnauthorizeApiError: () => UnauthorizeApiError,
101
101
  WorkflowDefinitionTaskType: () => WorkflowDefinitionTaskType,
102
+ WorkflowExecutionStatus: () => WorkflowExecutionStatus,
102
103
  WorkflowTemplateCategory: () => WorkflowTemplateCategory,
103
104
  adapterClientInstance: () => adapterClientInstance,
104
105
  allAppTemplates: () => allAppTemplates,
105
- api: () => api,
106
+ api: () => api2,
106
107
  appBaseTemplates: () => appBaseTemplates,
107
108
  appRepositoryTemplates: () => appRepositoryTemplates,
108
109
  appRepositoryTemplatesMap: () => appRepositoryTemplatesMap,
@@ -111,6 +112,7 @@ __export(src_exports, {
111
112
  bigCommerceClientInstance: () => bigCommerceClientInstance,
112
113
  bigcommerceEventsZods: () => bigcommerceEventsZods,
113
114
  billingClientInstance: () => billingClientInstance,
115
+ buildUrlFromSegments: () => buildUrlFromSegments,
114
116
  debounce: () => debounce,
115
117
  dpsClientInstance: () => dpsClientInstance,
116
118
  getAdapterClientConfig: () => getAdapterClientConfig,
@@ -1719,6 +1721,13 @@ var WorkflowDefinitionTaskType = {
1719
1721
  join: "JOIN"
1720
1722
  };
1721
1723
 
1724
+ // src/apis/integrations/text/platform/workflow/workflows/_contracts/requests/workflows.ts
1725
+ var WorkflowExecutionStatus = /* @__PURE__ */ ((WorkflowExecutionStatus2) => {
1726
+ WorkflowExecutionStatus2["Completed"] = "COMPLETED";
1727
+ WorkflowExecutionStatus2["Failed"] = "FAILED";
1728
+ return WorkflowExecutionStatus2;
1729
+ })(WorkflowExecutionStatus || {});
1730
+
1722
1731
  // src/apis/integrations/vercel/instance.ts
1723
1732
  var import_axios10 = __toESM(require("axios"));
1724
1733
  var vercelClientInstance = import_axios10.default.create({
@@ -3533,12 +3542,68 @@ var textPlatformDashboardApi = {
3533
3542
  }
3534
3543
  };
3535
3544
 
3545
+ // src/utils/misc/mergeDeep.ts
3546
+ function isObject(item) {
3547
+ return item !== null && typeof item === "object" && !Array.isArray(item);
3548
+ }
3549
+ function mergeDeep(target, source) {
3550
+ if (!isObject(target) || !isObject(source)) {
3551
+ return source;
3552
+ }
3553
+ const output = __spreadValues({}, target);
3554
+ Object.keys(source).forEach((key) => {
3555
+ if (isObject(source[key])) {
3556
+ if (!(key in target)) {
3557
+ output[key] = source[key];
3558
+ } else {
3559
+ output[key] = mergeDeep(
3560
+ target[key],
3561
+ source[key]
3562
+ );
3563
+ }
3564
+ } else if (Array.isArray(source[key])) {
3565
+ output[key] = [...source[key]];
3566
+ } else {
3567
+ output[key] = source[key];
3568
+ }
3569
+ });
3570
+ return output;
3571
+ }
3572
+
3573
+ // src/utils/misc/debounce.ts
3574
+ var debounce = (func, wait) => {
3575
+ let timeout = null;
3576
+ return (...args) => {
3577
+ if (timeout) {
3578
+ clearTimeout(timeout);
3579
+ }
3580
+ timeout = setTimeout(() => {
3581
+ func(...args);
3582
+ }, wait);
3583
+ };
3584
+ };
3585
+
3586
+ // src/utils/misc/url/build.ts
3587
+ var buildUrlFromSegments = (segments, basePath, baseUrl = "") => segments.length ? `${baseUrl}${basePath}/${segments.map(encodeURIComponent).join("/")}` : basePath;
3588
+
3536
3589
  // src/apis/integrations/text/platform/workflow/credentials/api.ts
3590
+ var getUrl = (segments = []) => buildUrlFromSegments(segments, "/workflow_platform/credentials");
3591
+ var urls = {
3592
+ get: (id) => getUrl([id]),
3593
+ getList: () => getUrl(),
3594
+ create: () => getUrl(),
3595
+ update: (id) => getUrl([id]),
3596
+ delete: (id) => getUrl([id]),
3597
+ connect: (id) => getUrl([id, "connection"])
3598
+ };
3537
3599
  var textPlatformWorkflowsCredentialsApi = {
3600
+ meta: {
3601
+ urls
3602
+ },
3538
3603
  get(id, authorization) {
3539
3604
  return __async(this, null, function* () {
3540
3605
  return textClientInstance.get(
3541
- `/workflow_platform/credentials/${encodeURIComponent(id)}`,
3606
+ urls.get(id),
3542
3607
  getTextClientConfig(__spreadProps(__spreadValues({}, authorization), {
3543
3608
  ensureAuthorizationToken: true
3544
3609
  }))
@@ -3555,7 +3620,7 @@ var textPlatformWorkflowsCredentialsApi = {
3555
3620
  getList(authorization) {
3556
3621
  return __async(this, null, function* () {
3557
3622
  return textClientInstance.get(
3558
- "/workflow_platform/credentials",
3623
+ urls.getList(),
3559
3624
  getTextClientConfig(__spreadProps(__spreadValues({}, authorization), {
3560
3625
  ensureAuthorizationToken: true
3561
3626
  }))
@@ -3572,7 +3637,7 @@ var textPlatformWorkflowsCredentialsApi = {
3572
3637
  create(payload, authorization) {
3573
3638
  return __async(this, null, function* () {
3574
3639
  return textClientInstance.post(
3575
- "/workflow_platform/credentials",
3640
+ urls.create(),
3576
3641
  payload,
3577
3642
  getTextClientConfig(__spreadProps(__spreadValues({}, authorization), {
3578
3643
  ensureAuthorizationToken: true
@@ -3590,7 +3655,7 @@ var textPlatformWorkflowsCredentialsApi = {
3590
3655
  update(id, payload, authorization) {
3591
3656
  return __async(this, null, function* () {
3592
3657
  return textClientInstance.put(
3593
- `/workflow_platform/credentials/${encodeURIComponent(id)}`,
3658
+ urls.update(id),
3594
3659
  payload,
3595
3660
  getTextClientConfig(__spreadProps(__spreadValues({}, authorization), {
3596
3661
  ensureAuthorizationToken: true
@@ -3608,7 +3673,7 @@ var textPlatformWorkflowsCredentialsApi = {
3608
3673
  delete(id, authorization) {
3609
3674
  return __async(this, null, function* () {
3610
3675
  return textClientInstance.delete(
3611
- `/workflow_platform/credentials/${encodeURIComponent(id)}`,
3676
+ urls.delete(id),
3612
3677
  getTextClientConfig(__spreadProps(__spreadValues({}, authorization), {
3613
3678
  ensureAuthorizationToken: true
3614
3679
  }))
@@ -3625,7 +3690,7 @@ var textPlatformWorkflowsCredentialsApi = {
3625
3690
  connect(id, code, authorization) {
3626
3691
  return __async(this, null, function* () {
3627
3692
  return textClientInstance.put(
3628
- `/workflow_platform/credentials/${encodeURIComponent(id)}/connection`,
3693
+ urls.connect(id),
3629
3694
  {
3630
3695
  code
3631
3696
  },
@@ -3645,11 +3710,18 @@ var textPlatformWorkflowsCredentialsApi = {
3645
3710
  };
3646
3711
 
3647
3712
  // src/apis/integrations/text/platform/workflow/functions/api.ts
3713
+ var getUrl2 = (segments = []) => buildUrlFromSegments(segments, "/workflow_platform/functions");
3714
+ var urls2 = {
3715
+ get: () => getUrl2()
3716
+ };
3648
3717
  var textPlatformWorkflowsFunctionsApi = {
3718
+ meta: {
3719
+ urls: urls2
3720
+ },
3649
3721
  get(authorization) {
3650
3722
  return __async(this, null, function* () {
3651
3723
  return textClientInstance.get(
3652
- "/workflow_platform/functions",
3724
+ urls2.get(),
3653
3725
  getTextClientConfig(__spreadProps(__spreadValues({}, authorization), {
3654
3726
  ensureAuthorizationToken: true
3655
3727
  }))
@@ -3692,11 +3764,29 @@ var textPlatformWorkflowsResourcesApi = {
3692
3764
  };
3693
3765
 
3694
3766
  // src/apis/integrations/text/platform/workflow/workflows/api.ts
3767
+ var getUrl3 = (segments = []) => buildUrlFromSegments(segments, "/workflow_platform/workflows");
3768
+ var urls3 = {
3769
+ getWorkflows: () => getUrl3(),
3770
+ createWorkflow: () => getUrl3(),
3771
+ getWorkflow: (id) => getUrl3([id]),
3772
+ updateWorkflow: (id) => getUrl3([id]),
3773
+ deleteWorkflow: (id) => getUrl3([id]),
3774
+ createWorkflowDraft: (id) => getUrl3([id, "draft"]),
3775
+ publishWorkflowDraft: (id) => getUrl3([id, "publish"]),
3776
+ toggleWorkflowActivation: (id) => getUrl3([id, "activation"]),
3777
+ executeWorkflow: (id) => getUrl3([id, "executions"]),
3778
+ getWorkflowExecutionsList: (id) => getUrl3([id, "executions"]),
3779
+ getWorkflowExecutionDetails: (id, executionId) => getUrl3([id, "executions", executionId]),
3780
+ validateWorkflowDefinition: () => getUrl3(["validation"])
3781
+ };
3695
3782
  var textPlatformWorkflowsApi = {
3783
+ meta: {
3784
+ urls: urls3
3785
+ },
3696
3786
  getWorkflows(authorization) {
3697
3787
  return __async(this, null, function* () {
3698
3788
  const { data: workflows } = yield textClientInstance.get(
3699
- "/workflow_platform/workflows",
3789
+ urls3.getWorkflows(),
3700
3790
  getTextClientConfig(__spreadProps(__spreadValues({}, authorization), {
3701
3791
  ensureAuthorizationToken: true
3702
3792
  }))
@@ -3707,7 +3797,7 @@ var textPlatformWorkflowsApi = {
3707
3797
  getWorkflow(workflowId, authorization) {
3708
3798
  return __async(this, null, function* () {
3709
3799
  const { data: workflow } = yield textClientInstance.get(
3710
- `/workflow_platform/workflows/${encodeURIComponent(workflowId)}`,
3800
+ urls3.getWorkflow(workflowId),
3711
3801
  getTextClientConfig(__spreadProps(__spreadValues({}, authorization), {
3712
3802
  ensureAuthorizationToken: true
3713
3803
  }))
@@ -3718,7 +3808,7 @@ var textPlatformWorkflowsApi = {
3718
3808
  createWorkflow(payload, authorization) {
3719
3809
  return __async(this, null, function* () {
3720
3810
  return textClientInstance.post(
3721
- "/workflow_platform/workflows",
3811
+ urls3.createWorkflow(),
3722
3812
  payload,
3723
3813
  getTextClientConfig(__spreadProps(__spreadValues({}, authorization), {
3724
3814
  ensureAuthorizationToken: true
@@ -3729,7 +3819,7 @@ var textPlatformWorkflowsApi = {
3729
3819
  updateWorkflow(workflowId, payload, authorization) {
3730
3820
  return __async(this, null, function* () {
3731
3821
  return textClientInstance.put(
3732
- `/workflow_platform/workflows/${encodeURIComponent(workflowId)}`,
3822
+ urls3.updateWorkflow(workflowId),
3733
3823
  payload,
3734
3824
  getTextClientConfig(__spreadProps(__spreadValues({}, authorization), {
3735
3825
  ensureAuthorizationToken: true
@@ -3739,18 +3829,15 @@ var textPlatformWorkflowsApi = {
3739
3829
  },
3740
3830
  deleteWorkflow(workflowId, authorization) {
3741
3831
  return __async(this, null, function* () {
3742
- return textClientInstance.delete(
3743
- `/workflow_platform/workflows/${encodeURIComponent(workflowId)}`,
3744
- __spreadValues({}, getTextClientConfig(__spreadProps(__spreadValues({}, authorization), {
3745
- ensureAuthorizationToken: true
3746
- })))
3747
- );
3832
+ return textClientInstance.delete(urls3.deleteWorkflow(workflowId), __spreadValues({}, getTextClientConfig(__spreadProps(__spreadValues({}, authorization), {
3833
+ ensureAuthorizationToken: true
3834
+ }))));
3748
3835
  });
3749
3836
  },
3750
3837
  createWorkflowDraft(workflowId, payload, authorization) {
3751
3838
  return __async(this, null, function* () {
3752
3839
  return textClientInstance.post(
3753
- `/workflow_platform/workflows/${encodeURIComponent(workflowId)}/draft`,
3840
+ urls3.createWorkflowDraft(workflowId),
3754
3841
  payload,
3755
3842
  getTextClientConfig(__spreadProps(__spreadValues({}, authorization), {
3756
3843
  ensureAuthorizationToken: true
@@ -3761,7 +3848,7 @@ var textPlatformWorkflowsApi = {
3761
3848
  publishWorkflowDraft(workflowId, authorization) {
3762
3849
  return __async(this, null, function* () {
3763
3850
  return textClientInstance.post(
3764
- `/workflow_platform/workflows/${encodeURIComponent(workflowId)}/publish`,
3851
+ urls3.publishWorkflowDraft(workflowId),
3765
3852
  getTextClientConfig(__spreadProps(__spreadValues({}, authorization), {
3766
3853
  ensureAuthorizationToken: true
3767
3854
  }))
@@ -3771,9 +3858,7 @@ var textPlatformWorkflowsApi = {
3771
3858
  toggleWorkflowActivation(workflowId, isActive, authorization) {
3772
3859
  return __async(this, null, function* () {
3773
3860
  return textClientInstance.put(
3774
- `/workflow_platform/workflows/${encodeURIComponent(
3775
- workflowId
3776
- )}/activation`,
3861
+ urls3.toggleWorkflowActivation(workflowId),
3777
3862
  {
3778
3863
  active: isActive
3779
3864
  },
@@ -3786,9 +3871,7 @@ var textPlatformWorkflowsApi = {
3786
3871
  executeWorkflow(workflowId, input, authorization) {
3787
3872
  return __async(this, null, function* () {
3788
3873
  const { data: execution } = yield textClientInstance.post(
3789
- `/workflow_platform/workflows/${encodeURIComponent(
3790
- workflowId
3791
- )}/executions`,
3874
+ urls3.executeWorkflow(workflowId),
3792
3875
  {
3793
3876
  input
3794
3877
  },
@@ -3802,9 +3885,7 @@ var textPlatformWorkflowsApi = {
3802
3885
  getWorkflowExecutionsList(workflowId, authorization) {
3803
3886
  return __async(this, null, function* () {
3804
3887
  const { data: executions } = yield textClientInstance.get(
3805
- `/workflow_platform/workflows/${encodeURIComponent(
3806
- workflowId
3807
- )}/executions`,
3888
+ urls3.executeWorkflow(workflowId),
3808
3889
  getTextClientConfig(__spreadProps(__spreadValues({}, authorization), {
3809
3890
  ensureAuthorizationToken: true
3810
3891
  }))
@@ -3815,9 +3896,7 @@ var textPlatformWorkflowsApi = {
3815
3896
  getWorkflowExecutionDetails(workflowId, executionId, authorization) {
3816
3897
  return __async(this, null, function* () {
3817
3898
  const { data: execution } = yield textClientInstance.get(
3818
- `/workflow_platform/workflows/${encodeURIComponent(
3819
- workflowId
3820
- )}/executions/${encodeURIComponent(executionId)}`,
3899
+ urls3.getWorkflowExecutionDetails(workflowId, executionId),
3821
3900
  getTextClientConfig(__spreadProps(__spreadValues({}, authorization), {
3822
3901
  ensureAuthorizationToken: true
3823
3902
  }))
@@ -3828,7 +3907,7 @@ var textPlatformWorkflowsApi = {
3828
3907
  validateWorkflowDefinition(payload, authorization) {
3829
3908
  return __async(this, null, function* () {
3830
3909
  yield textClientInstance.post(
3831
- "/workflow_platform/workflows/validation",
3910
+ urls3.validateWorkflowDefinition(),
3832
3911
  payload,
3833
3912
  getTextClientConfig(__spreadProps(__spreadValues({}, authorization), {
3834
3913
  ensureAuthorizationToken: true
@@ -5753,19 +5832,34 @@ var productsApi = {
5753
5832
  };
5754
5833
 
5755
5834
  // src/apis/platform/accounts/accounts/api.ts
5756
- var platformAccountsAccountApi = {
5835
+ var urls4 = (withBaseUrl = false) => {
5836
+ const getUrl5 = (segments = []) => buildUrlFromSegments(
5837
+ segments,
5838
+ "/v2/accounts",
5839
+ withBaseUrl ? platformAccountsClientInstance.config.baseURL : void 0
5840
+ );
5841
+ return {
5842
+ getAccounts: () => getUrl5(),
5843
+ getAccount: (id) => getUrl5([id]),
5844
+ getMeAccount: () => getUrl5(["me"])
5845
+ };
5846
+ };
5847
+ var api = {
5757
5848
  getAccounts(authorization) {
5758
5849
  return __async(this, null, function* () {
5759
- return platformAccountsClientInstance.get("/v2/accounts", {
5760
- authorization,
5761
- customErrorMessage: "Accounts couldn't be fetched."
5762
- });
5850
+ return platformAccountsClientInstance.get(
5851
+ urls4().getAccounts(),
5852
+ {
5853
+ authorization,
5854
+ customErrorMessage: "Accounts couldn't be fetched."
5855
+ }
5856
+ );
5763
5857
  });
5764
5858
  },
5765
5859
  getAccount(accountId, authorization) {
5766
5860
  return __async(this, null, function* () {
5767
5861
  return platformAccountsClientInstance.get(
5768
- `/v2/accounts/${encodeURIComponent(accountId)}`,
5862
+ urls4().getAccount(accountId),
5769
5863
  {
5770
5864
  authorization,
5771
5865
  customErrorMessage: "Account couldn't be fetched."
@@ -5785,6 +5879,11 @@ var platformAccountsAccountApi = {
5785
5879
  });
5786
5880
  }
5787
5881
  };
5882
+ var platformAccountsAccountApi = __spreadProps(__spreadValues({}, api), {
5883
+ meta: {
5884
+ urls: urls4
5885
+ }
5886
+ });
5788
5887
 
5789
5888
  // src/apis/platform/accounts/client/api.ts
5790
5889
  var platformAccountsClientApi = {
@@ -5947,11 +6046,19 @@ var platformAccountsPersonalAccessTokenApi = {
5947
6046
  };
5948
6047
 
5949
6048
  // src/apis/platform/accounts/products/api.ts
6049
+ var getUrl4 = (segments = []) => buildUrlFromSegments(segments, "/v2/organizations");
6050
+ var urls5 = {
6051
+ getOrganizationProducts: () => getUrl4(["my", "products"]),
6052
+ updateOrganizationProducts: () => getUrl4(["my", "products"])
6053
+ };
5950
6054
  var platformAccountsProductsApi = {
6055
+ meta: {
6056
+ urls: urls5
6057
+ },
5951
6058
  getOrganizationProducts(authorization) {
5952
6059
  return __async(this, null, function* () {
5953
6060
  return platformAccountsClientInstance.get(
5954
- "/v2/organizations/my/products",
6061
+ urls5.getOrganizationProducts(),
5955
6062
  { authorization, customErrorMessage: "Products couldn't be fetched." }
5956
6063
  );
5957
6064
  });
@@ -5959,7 +6066,7 @@ var platformAccountsProductsApi = {
5959
6066
  updateOrganizationProducts(payload, authorization) {
5960
6067
  return __async(this, null, function* () {
5961
6068
  return platformAccountsClientInstance.post(
5962
- "/v2/organizations/my/products",
6069
+ urls5.updateOrganizationProducts(),
5963
6070
  payload,
5964
6071
  { authorization, customErrorMessage: "Products couldn't be updated." }
5965
6072
  );
@@ -8120,7 +8227,7 @@ var platformApi = {
8120
8227
  };
8121
8228
 
8122
8229
  // src/apis/api.ts
8123
- var api = {
8230
+ var api2 = {
8124
8231
  platform: platformApi,
8125
8232
  products: productsApi,
8126
8233
  integrations: integrationsApi,
@@ -8160,7 +8267,7 @@ function initApi(config, tokens) {
8160
8267
  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);
8161
8268
  initHubspotClient((_w = tokens == null ? void 0 : tokens.hubspot) == null ? void 0 : _w.token);
8162
8269
  initSlackClient((_x = tokens == null ? void 0 : tokens.slack) == null ? void 0 : _x.token);
8163
- api.isInitialized = true;
8270
+ api2.isInitialized = true;
8164
8271
  }
8165
8272
 
8166
8273
  // ../../../private/utils/src/serializers/base64.ts
@@ -8223,47 +8330,6 @@ function getIntegrationFlowUrl(name, flow, trigger, context, state, config) {
8223
8330
  window.location.href = url;
8224
8331
  });
8225
8332
  }
8226
-
8227
- // src/utils/misc/mergeDeep.ts
8228
- function isObject(item) {
8229
- return item !== null && typeof item === "object" && !Array.isArray(item);
8230
- }
8231
- function mergeDeep(target, source) {
8232
- if (!isObject(target) || !isObject(source)) {
8233
- return source;
8234
- }
8235
- const output = __spreadValues({}, target);
8236
- Object.keys(source).forEach((key) => {
8237
- if (isObject(source[key])) {
8238
- if (!(key in target)) {
8239
- output[key] = source[key];
8240
- } else {
8241
- output[key] = mergeDeep(
8242
- target[key],
8243
- source[key]
8244
- );
8245
- }
8246
- } else if (Array.isArray(source[key])) {
8247
- output[key] = [...source[key]];
8248
- } else {
8249
- output[key] = source[key];
8250
- }
8251
- });
8252
- return output;
8253
- }
8254
-
8255
- // src/utils/misc/debounce.ts
8256
- var debounce = (func, wait) => {
8257
- let timeout = null;
8258
- return (...args) => {
8259
- if (timeout) {
8260
- clearTimeout(timeout);
8261
- }
8262
- timeout = setTimeout(() => {
8263
- func(...args);
8264
- }, wait);
8265
- };
8266
- };
8267
8333
  // Annotate the CommonJS export names for ESM import in node:
8268
8334
  0 && (module.exports = {
8269
8335
  API_NOTIFICATIONS,
@@ -8298,6 +8364,7 @@ var debounce = (func, wait) => {
8298
8364
  UnauthorizeAccountsApiError,
8299
8365
  UnauthorizeApiError,
8300
8366
  WorkflowDefinitionTaskType,
8367
+ WorkflowExecutionStatus,
8301
8368
  WorkflowTemplateCategory,
8302
8369
  adapterClientInstance,
8303
8370
  allAppTemplates,
@@ -8310,6 +8377,7 @@ var debounce = (func, wait) => {
8310
8377
  bigCommerceClientInstance,
8311
8378
  bigcommerceEventsZods,
8312
8379
  billingClientInstance,
8380
+ buildUrlFromSegments,
8313
8381
  debounce,
8314
8382
  dpsClientInstance,
8315
8383
  getAdapterClientConfig,