@livechat/developer-studio-api 3.0.56 → 3.1.0-beta.1

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
@@ -104,7 +104,6 @@ __export(src_exports, {
104
104
  getPlanetScaleClientAuthorization: () => getPlanetScaleClientAuthorization,
105
105
  getPlanetScaleClientConfig: () => getPlanetScaleClientConfig,
106
106
  getPlatformAccountsClientAuthorization: () => getPlatformAccountsClientAuthorization,
107
- getPlatformAccountsClientConfig: () => getPlatformAccountsClientConfig,
108
107
  getPlatformAdapterClientAuthorization: () => getPlatformAdapterClientAuthorization,
109
108
  getPlatformAdapterClientConfig: () => getPlatformAdapterClientConfig,
110
109
  getPlatformAdapterClientDefaultConfig: () => getPlatformAdapterClientDefaultConfig,
@@ -170,7 +169,7 @@ var import_axios3 = __toESM(require("axios"));
170
169
  // src/apis/integrations/github/instance.ts
171
170
  var import_axios = __toESM(require("axios"));
172
171
 
173
- // src/types/errors/api.ts
172
+ // src/types/api/errors.ts
174
173
  var ApiErrorBase = class extends Error {
175
174
  constructor(message, data, code) {
176
175
  super(message);
@@ -182,6 +181,9 @@ var ApiErrorBase = class extends Error {
182
181
  withCustomMessage(message) {
183
182
  return new this.constructor(message, this.data, this.code);
184
183
  }
184
+ unauthorized(message) {
185
+ return new UnauthorizeApiError(this.source, message);
186
+ }
185
187
  };
186
188
  var UnauthorizeApiError = class extends Error {
187
189
  constructor(source, message = "Unauthorized API call") {
@@ -2516,6 +2518,7 @@ var import_axios13 = __toESM(require("axios"));
2516
2518
  var MailchimpApiError = class extends ApiErrorBase {
2517
2519
  constructor() {
2518
2520
  super(...arguments);
2521
+ this.source = "mailchimp";
2519
2522
  this.name = "mailchimp";
2520
2523
  }
2521
2524
  };
@@ -2691,6 +2694,7 @@ var import_axios15 = __toESM(require("axios"));
2691
2694
  var ShopifyApiError = class extends ApiErrorBase {
2692
2695
  constructor() {
2693
2696
  super(...arguments);
2697
+ this.source = "shopify";
2694
2698
  this.name = "shopify";
2695
2699
  }
2696
2700
  };
@@ -2862,6 +2866,7 @@ var getRegion = (token) => {
2862
2866
  var LivechatApiError = class extends ApiErrorBase {
2863
2867
  constructor() {
2864
2868
  super(...arguments);
2869
+ this.source = "accounts";
2865
2870
  this.name = "livechat";
2866
2871
  }
2867
2872
  };
@@ -3429,33 +3434,109 @@ var productsApi = {
3429
3434
  livechat: livechatApi
3430
3435
  };
3431
3436
 
3437
+ // src/types/api/client.ts
3438
+ var ApiClient = class {
3439
+ constructor(config, authorization) {
3440
+ this.config = config;
3441
+ this.authorization = authorization;
3442
+ }
3443
+ updateConfig(config) {
3444
+ this.config = __spreadValues(__spreadValues({}, this.config), config);
3445
+ }
3446
+ updateAuthorization(authorization) {
3447
+ this.authorization = __spreadValues(__spreadValues({}, this.authorization), authorization);
3448
+ }
3449
+ fetch(url, customConfig, customOptions) {
3450
+ return __async(this, null, function* () {
3451
+ var _a, _b, _c;
3452
+ const authorization = (_a = customConfig == null ? void 0 : customConfig.authorization) != null ? _a : this.authorization;
3453
+ const options = __spreadValues(__spreadValues({}, this.options), customOptions);
3454
+ const response = yield fetch(`${this.config.baseURL}${url}`, __spreadProps(__spreadValues({}, options), {
3455
+ headers: __spreadValues(__spreadValues({}, options.headers), authorization ? {
3456
+ Authorization: `${(_b = authorization.tokenType) != null ? _b : "Bearer"} ${authorization.token}`
3457
+ } : void 0)
3458
+ }));
3459
+ if (!response.ok) {
3460
+ const errorData = yield response.json();
3461
+ const error = new this.Error(
3462
+ (_c = customConfig == null ? void 0 : customConfig.customErrorMessage) != null ? _c : response.statusText,
3463
+ errorData,
3464
+ response.status
3465
+ );
3466
+ if (response.status === 401) {
3467
+ throw error.unauthorized();
3468
+ }
3469
+ throw error;
3470
+ }
3471
+ const data = yield response.json();
3472
+ return __spreadProps(__spreadValues({}, response), {
3473
+ data
3474
+ });
3475
+ });
3476
+ }
3477
+ get(url, config, options) {
3478
+ return __async(this, null, function* () {
3479
+ return this.fetch(url, config, __spreadProps(__spreadValues({}, options), {
3480
+ method: "GET"
3481
+ }));
3482
+ });
3483
+ }
3484
+ post(url, body, customConfig, customOptions) {
3485
+ return __async(this, null, function* () {
3486
+ return this.fetch(url, customConfig, __spreadProps(__spreadValues({}, customOptions), {
3487
+ method: "POST",
3488
+ body: JSON.stringify(body)
3489
+ }));
3490
+ });
3491
+ }
3492
+ patch(url, body, customConfig, customOptions) {
3493
+ return __async(this, null, function* () {
3494
+ return this.fetch(url, customConfig, __spreadProps(__spreadValues({}, customOptions), {
3495
+ method: "PATCH",
3496
+ body: JSON.stringify(body)
3497
+ }));
3498
+ });
3499
+ }
3500
+ put(url, body, customConfig, customOptions) {
3501
+ return __async(this, null, function* () {
3502
+ return this.fetch(url, customConfig, __spreadProps(__spreadValues({}, customOptions), {
3503
+ method: "PUT",
3504
+ body: JSON.stringify(body)
3505
+ }));
3506
+ });
3507
+ }
3508
+ delete(url, body, config, options) {
3509
+ return __async(this, null, function* () {
3510
+ return this.fetch(url, config, __spreadProps(__spreadValues({}, options), {
3511
+ method: "DELETE",
3512
+ body: JSON.stringify(body)
3513
+ }));
3514
+ });
3515
+ }
3516
+ };
3517
+
3432
3518
  // src/apis/platform/accounts/instance.ts
3433
- var import_axios18 = __toESM(require("axios"));
3434
3519
  var AccountsApiError = class extends ApiErrorBase {
3435
3520
  constructor() {
3436
3521
  super(...arguments);
3522
+ this.source = "accounts";
3437
3523
  this.name = "accounts";
3438
3524
  }
3439
3525
  };
3440
- var platformAccountsClientInstance = import_axios18.default.create({
3526
+ var AccountApiClient = class extends ApiClient {
3527
+ constructor() {
3528
+ super(...arguments);
3529
+ this.Error = AccountsApiError;
3530
+ this.options = {
3531
+ headers: {
3532
+ "Content-Type": "application/json"
3533
+ }
3534
+ };
3535
+ }
3536
+ };
3537
+ var platformAccountsClientInstance = new AccountApiClient({
3441
3538
  baseURL: "https://accounts.labs.livechatinc.com"
3442
3539
  });
3443
- platformAccountsClientInstance.interceptors.response.use(
3444
- (response) => response,
3445
- (error) => {
3446
- var _a, _b, _c, _d;
3447
- if (((_a = error.response) == null ? void 0 : _a.status) === 401) {
3448
- return Promise.reject(new UnauthorizeApiError("accounts"));
3449
- }
3450
- return Promise.reject(
3451
- new AccountsApiError(
3452
- error.message,
3453
- (_b = error.response) == null ? void 0 : _b.data,
3454
- (_d = (_c = error.response) == null ? void 0 : _c.status) != null ? _d : 400
3455
- )
3456
- );
3457
- }
3458
- );
3459
3540
  function getPlatformAccountsClientAuthorization(req) {
3460
3541
  if (req.headers instanceof Headers) {
3461
3542
  return {
@@ -3466,42 +3547,24 @@ function getPlatformAccountsClientAuthorization(req) {
3466
3547
  token: req.headers["x-adapter-platform-token"]
3467
3548
  };
3468
3549
  }
3469
- function getPlatformAccountsClientConfig(options = {}) {
3470
- var _a;
3471
- const defaultAuthorization = platformAccountsClientInstance.defaults.headers.Authorization;
3472
- const headers = {
3473
- authorization: (_a = options.token ? `Bearer ${options.token}` : void 0) != null ? _a : defaultAuthorization
3474
- };
3475
- return {
3476
- headers: __spreadValues({}, headers.authorization ? { Authorization: headers.authorization } : {})
3477
- };
3478
- }
3479
3550
  function initPlatformAccountsClient(baseUrl, token) {
3480
3551
  if (baseUrl) {
3481
- platformAccountsClientInstance.interceptors.request.use(
3482
- (config) => {
3483
- config.baseURL = baseUrl;
3484
- return config;
3485
- },
3486
- (error) => Promise.reject(error)
3487
- );
3488
- }
3489
- if (token) {
3490
- platformAccountsClientInstance.defaults.headers.Authorization = `Bearer ${token}`;
3491
- } else {
3492
- delete platformAccountsClientInstance.defaults.headers.Authorization;
3552
+ platformAccountsClientInstance.updateConfig({
3553
+ baseURL: baseUrl
3554
+ });
3493
3555
  }
3556
+ platformAccountsClientInstance.updateAuthorization({
3557
+ token
3558
+ });
3494
3559
  }
3495
3560
 
3496
3561
  // src/apis/platform/accounts/accounts/api.ts
3497
3562
  var platformAccountsAccountApi = {
3498
3563
  getAccounts(authorization) {
3499
3564
  return __async(this, null, function* () {
3500
- return platformAccountsClientInstance.get(
3501
- `/v2/accounts`,
3502
- getPlatformAccountsClientConfig(authorization)
3503
- ).catch((error) => {
3504
- throw error.withCustomMessage("Accounts couldn't be fetched.");
3565
+ return platformAccountsClientInstance.get(`/v2/accounts`, {
3566
+ authorization,
3567
+ customErrorMessage: "Accounts couldn't be fetched."
3505
3568
  });
3506
3569
  });
3507
3570
  },
@@ -3509,20 +3572,22 @@ var platformAccountsAccountApi = {
3509
3572
  return __async(this, null, function* () {
3510
3573
  return platformAccountsClientInstance.get(
3511
3574
  `/v2/accounts/${accountId}`,
3512
- getPlatformAccountsClientConfig(authorization)
3513
- ).catch((error) => {
3514
- throw error.withCustomMessage("Account couldn't be fetched.");
3515
- });
3575
+ {
3576
+ authorization,
3577
+ customErrorMessage: "Account couldn't be fetched."
3578
+ }
3579
+ );
3516
3580
  });
3517
3581
  },
3518
3582
  getMeAccount(authorization) {
3519
3583
  return __async(this, null, function* () {
3520
3584
  return platformAccountsClientInstance.get(
3521
3585
  `/v2/accounts/me`,
3522
- getPlatformAccountsClientConfig(authorization)
3523
- ).catch((error) => {
3524
- throw error.withCustomMessage("Account couldn't be fetched.");
3525
- });
3586
+ {
3587
+ authorization,
3588
+ customErrorMessage: "Me account couldn't be fetched."
3589
+ }
3590
+ );
3526
3591
  });
3527
3592
  }
3528
3593
  };
@@ -3533,30 +3598,29 @@ var platformAccountsClientApi = {
3533
3598
  return __async(this, null, function* () {
3534
3599
  return platformAccountsClientInstance.get(
3535
3600
  `/v2/clients`,
3536
- getPlatformAccountsClientConfig(authorization)
3537
- ).catch((error) => {
3538
- throw error.withCustomMessage("Clients couldn't be fetched.");
3539
- });
3601
+ {
3602
+ authorization,
3603
+ customErrorMessage: "Clients couldn't be fetched."
3604
+ }
3605
+ );
3540
3606
  });
3541
3607
  },
3542
3608
  getClient(clientId, authorization) {
3543
3609
  return __async(this, null, function* () {
3544
3610
  return platformAccountsClientInstance.get(
3545
3611
  `/v2/clients/${clientId}`,
3546
- getPlatformAccountsClientConfig(authorization)
3547
- ).catch((error) => {
3548
- throw error.withCustomMessage("Client couldn't be fetched.");
3549
- });
3612
+ {
3613
+ authorization,
3614
+ customErrorMessage: "Client couldn't be fetched."
3615
+ }
3616
+ );
3550
3617
  });
3551
3618
  },
3552
3619
  createClient(payload, authorization) {
3553
3620
  return __async(this, null, function* () {
3554
- return platformAccountsClientInstance.post(
3555
- `/v2/clients`,
3556
- payload,
3557
- getPlatformAccountsClientConfig(authorization)
3558
- ).catch((error) => {
3559
- throw error.withCustomMessage("Client couldn't be created.");
3621
+ return platformAccountsClientInstance.post(`/v2/clients`, payload, {
3622
+ authorization,
3623
+ customErrorMessage: "Client couldn't be created."
3560
3624
  });
3561
3625
  });
3562
3626
  },
@@ -3565,20 +3629,23 @@ var platformAccountsClientApi = {
3565
3629
  return platformAccountsClientInstance.patch(
3566
3630
  `/v2/clients/${clientId}`,
3567
3631
  payload,
3568
- getPlatformAccountsClientConfig(authorization)
3569
- ).catch((error) => {
3570
- throw error.withCustomMessage("Client couldn't be updated.");
3571
- });
3632
+ {
3633
+ authorization,
3634
+ customErrorMessage: "Client couldn't be updated."
3635
+ }
3636
+ );
3572
3637
  });
3573
3638
  },
3574
3639
  deleteClient(clientId, authorization) {
3575
3640
  return __async(this, null, function* () {
3576
3641
  return platformAccountsClientInstance.delete(
3577
3642
  `/v2/clients/${clientId}`,
3578
- getPlatformAccountsClientConfig(authorization)
3579
- ).catch((error) => {
3580
- throw error.withCustomMessage("Clients couldn't be deleted.");
3581
- });
3643
+ void 0,
3644
+ {
3645
+ authorization,
3646
+ customErrorMessage: "Clients couldn't be deleted."
3647
+ }
3648
+ );
3582
3649
  });
3583
3650
  },
3584
3651
  updateClientScopes(clientId, scopes, authorization) {
@@ -3589,31 +3656,35 @@ var platformAccountsClientApi = {
3589
3656
  scope: scope.scope,
3590
3657
  required: scope.required
3591
3658
  })),
3592
- getPlatformAccountsClientConfig(authorization)
3593
- ).catch((error) => {
3594
- throw error.withCustomMessage("Client scopes couldn't be updated.");
3595
- });
3659
+ {
3660
+ authorization,
3661
+ customErrorMessage: "Client scopes couldn't be updated."
3662
+ }
3663
+ );
3596
3664
  });
3597
3665
  },
3598
3666
  deleteClientScopes(clientId, scopes, authorization) {
3599
3667
  return __async(this, null, function* () {
3600
- return platformAccountsClientInstance.delete(`/v2/clients/${clientId}/scopes`, __spreadValues({
3601
- data: scopes.map((scope) => ({
3602
- scope: scope.scope,
3603
- required: scope.required
3604
- }))
3605
- }, getPlatformAccountsClientConfig(authorization))).catch((error) => {
3606
- throw error.withCustomMessage("Client scopes couldn't be deleted.");
3607
- });
3668
+ return platformAccountsClientInstance.delete(
3669
+ `/v2/clients/${clientId}/scopes`,
3670
+ {
3671
+ data: scopes.map((scope) => ({
3672
+ scope: scope.scope,
3673
+ required: scope.required
3674
+ }))
3675
+ },
3676
+ {
3677
+ authorization,
3678
+ customErrorMessage: "Client scopes couldn't be deleted."
3679
+ }
3680
+ );
3608
3681
  });
3609
3682
  },
3610
3683
  getInfo(authorization) {
3611
3684
  return __async(this, null, function* () {
3612
- return platformAccountsClientInstance.get(
3613
- `/v2/info`,
3614
- getPlatformAccountsClientConfig(authorization)
3615
- ).catch((error) => {
3616
- throw error.withCustomMessage("Client info couldn't be fetched.");
3685
+ return platformAccountsClientInstance.get(`/v2/info`, {
3686
+ authorization,
3687
+ customErrorMessage: "Client info couldn't be fetched."
3617
3688
  });
3618
3689
  });
3619
3690
  }
@@ -3625,20 +3696,22 @@ var platformAccountsOrganizationApi = {
3625
3696
  return __async(this, null, function* () {
3626
3697
  return platformAccountsClientInstance.get(
3627
3698
  `/v2/organizations`,
3628
- getPlatformAccountsClientConfig(authorization)
3629
- ).catch((error) => {
3630
- throw error.withCustomMessage("Organizations couldn't be fetched.");
3631
- });
3699
+ {
3700
+ authorization,
3701
+ customErrorMessage: "Organizations couldn't be fetched."
3702
+ }
3703
+ );
3632
3704
  });
3633
3705
  },
3634
3706
  getMyOrganization(authorization) {
3635
3707
  return __async(this, null, function* () {
3636
3708
  return platformAccountsClientInstance.get(
3637
3709
  `/v2/organizations/my`,
3638
- getPlatformAccountsClientConfig(authorization)
3639
- ).catch((error) => {
3640
- throw error.withCustomMessage("Organization couldn't be fetched.");
3641
- });
3710
+ {
3711
+ authorization,
3712
+ customErrorMessage: "My organization couldn't be fetched."
3713
+ }
3714
+ );
3642
3715
  });
3643
3716
  }
3644
3717
  };
@@ -3647,10 +3720,9 @@ var platformAccountsOrganizationApi = {
3647
3720
  var platformAccountsPersonalAccessTokenApi = {
3648
3721
  getPersonalAccessTokens(authorization) {
3649
3722
  return __async(this, null, function* () {
3650
- return platformAccountsClientInstance.get(`/v2/personal_token`, __spreadValues({}, getPlatformAccountsClientConfig(authorization))).catch((error) => {
3651
- throw error.withCustomMessage(
3652
- "Personal Access Tokens couldn't be fetched."
3653
- );
3723
+ return platformAccountsClientInstance.get(`/v2/personal_token`, {
3724
+ authorization,
3725
+ customErrorMessage: "Personal Access Tokens couldn't be fetched."
3654
3726
  });
3655
3727
  });
3656
3728
  },
@@ -3662,24 +3734,23 @@ var platformAccountsPersonalAccessTokenApi = {
3662
3734
  name,
3663
3735
  scope: scopes.map((item) => item.name).filter((el) => el).join(",")
3664
3736
  },
3665
- getPlatformAccountsClientConfig(authorization)
3666
- ).catch((error) => {
3667
- throw error.withCustomMessage(
3668
- "Personal Access Tokens couldn't be created."
3669
- );
3670
- });
3737
+ {
3738
+ authorization,
3739
+ customErrorMessage: "Personal Access Token couldn't be created."
3740
+ }
3741
+ );
3671
3742
  });
3672
3743
  },
3673
3744
  deletePersonalAccessToken(id, authorization) {
3674
3745
  return __async(this, null, function* () {
3675
3746
  return platformAccountsClientInstance.delete(
3676
3747
  `/v2/personal_token/${id}`,
3677
- getPlatformAccountsClientConfig(authorization)
3678
- ).catch((error) => {
3679
- throw error.withCustomMessage(
3680
- "Personal Access Tokens couldn't be deleted."
3681
- );
3682
- });
3748
+ void 0,
3749
+ {
3750
+ authorization,
3751
+ customErrorMessage: "Personal Access Tokens couldn't be deleted."
3752
+ }
3753
+ );
3683
3754
  });
3684
3755
  }
3685
3756
  };
@@ -3690,10 +3761,8 @@ var platformAccountsProductsApi = {
3690
3761
  return __async(this, null, function* () {
3691
3762
  return platformAccountsClientInstance.get(
3692
3763
  `/v2/organizations/my/products`,
3693
- getPlatformAccountsClientConfig(authorization)
3694
- ).catch((error) => {
3695
- throw error.withCustomMessage("Products couldn't be fetched.");
3696
- });
3764
+ { authorization, customErrorMessage: "Products couldn't be fetched." }
3765
+ );
3697
3766
  });
3698
3767
  },
3699
3768
  updateOrganizationProducts(payload, authorization) {
@@ -3701,10 +3770,8 @@ var platformAccountsProductsApi = {
3701
3770
  return platformAccountsClientInstance.post(
3702
3771
  `/v2/organizations/my/products`,
3703
3772
  payload,
3704
- getPlatformAccountsClientConfig(authorization)
3705
- ).catch((error) => {
3706
- throw error.withCustomMessage("Products couldn't be updated.");
3707
- });
3773
+ { authorization, customErrorMessage: "Products couldn't be updated." }
3774
+ );
3708
3775
  });
3709
3776
  }
3710
3777
  };
@@ -3713,11 +3780,9 @@ var platformAccountsProductsApi = {
3713
3780
  var platformAccountsScopesApi = {
3714
3781
  getScopes(authorization) {
3715
3782
  return __async(this, null, function* () {
3716
- return platformAccountsClientInstance.get(
3717
- `/v2/scopes`,
3718
- getPlatformAccountsClientConfig(authorization)
3719
- ).catch((error) => {
3720
- throw error.withCustomMessage("Scopes couldn't be fetched.");
3783
+ return platformAccountsClientInstance.get(`/v2/scopes`, {
3784
+ authorization,
3785
+ customErrorMessage: "Scopes couldn't be fetched."
3721
3786
  });
3722
3787
  });
3723
3788
  }
@@ -3729,10 +3794,12 @@ var platformAccountsSessionsApi = {
3729
3794
  return __async(this, null, function* () {
3730
3795
  return platformAccountsClientInstance.delete(
3731
3796
  `/v2/sessions`,
3732
- getPlatformAccountsClientConfig(authorization)
3733
- ).catch((error) => {
3734
- throw error.withCustomMessage("Sessions couldn't be fetched.");
3735
- });
3797
+ void 0,
3798
+ {
3799
+ authorization,
3800
+ customErrorMessage: "Sessions couldn't be fetched."
3801
+ }
3802
+ );
3736
3803
  });
3737
3804
  }
3738
3805
  };
@@ -3748,13 +3815,18 @@ var platformAccountsTokenApi = {
3748
3815
  client_secret: clientSecret,
3749
3816
  redirect_uri: redirectUrl
3750
3817
  });
3751
- return platformAccountsClientInstance.post(`/v2/token`, data, {
3752
- headers: {
3753
- "Content-Type": "application/x-www-form-urlencoded"
3818
+ return platformAccountsClientInstance.post(
3819
+ `/v2/token`,
3820
+ data,
3821
+ {
3822
+ customErrorMessage: "Couldn't exchange code for token."
3823
+ },
3824
+ {
3825
+ headers: {
3826
+ "Content-Type": "application/x-www-form-urlencoded"
3827
+ }
3754
3828
  }
3755
- }).catch((error) => {
3756
- throw error.withCustomMessage("Couldn't exchange code for token.");
3757
- });
3829
+ );
3758
3830
  });
3759
3831
  }
3760
3832
  };
@@ -3772,14 +3844,15 @@ var platformAccountsApi = {
3772
3844
  };
3773
3845
 
3774
3846
  // src/apis/platform/dps/instance.ts
3775
- var import_axios19 = __toESM(require("axios"));
3847
+ var import_axios18 = __toESM(require("axios"));
3776
3848
  var DpsApiError = class extends ApiErrorBase {
3777
3849
  constructor() {
3778
3850
  super(...arguments);
3851
+ this.source = "accounts";
3779
3852
  this.name = "dps";
3780
3853
  }
3781
3854
  };
3782
- var platformDpsClientInstance = import_axios19.default.create({
3855
+ var platformDpsClientInstance = import_axios18.default.create({
3783
3856
  baseURL: "https://dev-platform.labs.livechatinc.com"
3784
3857
  });
3785
3858
  platformDpsClientInstance.interceptors.response.use(
@@ -5344,7 +5417,7 @@ var platformDpsApi = {
5344
5417
  };
5345
5418
 
5346
5419
  // src/apis/platform/adapter/instance.ts
5347
- var import_axios20 = __toESM(require("axios"));
5420
+ var import_axios19 = __toESM(require("axios"));
5348
5421
  var REGION2 = {
5349
5422
  FRA: "fra",
5350
5423
  DAL: "dal",
@@ -5361,10 +5434,11 @@ var getRegion2 = (token) => {
5361
5434
  var AdapterApiError = class extends ApiErrorBase {
5362
5435
  constructor() {
5363
5436
  super(...arguments);
5437
+ this.source = "accounts";
5364
5438
  this.name = "adapter";
5365
5439
  }
5366
5440
  };
5367
- var platformAdapterClientInstance = import_axios20.default.create({
5441
+ var platformAdapterClientInstance = import_axios19.default.create({
5368
5442
  baseURL: "https://platform.labs.text.com/console-adapter/api",
5369
5443
  headers: {
5370
5444
  "Content-Type": "application/json"
@@ -6057,8 +6131,8 @@ var WorkflowDefinitionTaskType = {
6057
6131
  };
6058
6132
 
6059
6133
  // src/apis/platform/billing/instance.ts
6060
- var import_axios21 = __toESM(require("axios"));
6061
- var platformBillingClientInstance = import_axios21.default.create({
6134
+ var import_axios20 = __toESM(require("axios"));
6135
+ var platformBillingClientInstance = import_axios20.default.create({
6062
6136
  baseURL: "https://billing.labs.livechatinc.com"
6063
6137
  });
6064
6138
  function getPlatformBillingClientAuthorization(req) {
@@ -6187,6 +6261,8 @@ var mailchimpEventsZods = {
6187
6261
  // src/apis/platform/adapter/integrations/text/_contracts/dtos/events.ts
6188
6262
  var TextLivechatEvents = /* @__PURE__ */ ((TextLivechatEvents2) => {
6189
6263
  TextLivechatEvents2["IncomingChat"] = "incoming_chat";
6264
+ TextLivechatEvents2["IncomingEvent"] = "incoming_event";
6265
+ TextLivechatEvents2["IncomingCustomer"] = "incoming_customer";
6190
6266
  return TextLivechatEvents2;
6191
6267
  })(TextLivechatEvents || {});
6192
6268
 
@@ -6582,7 +6658,6 @@ function getIntegrationFlowUrl(provider, flow, data, context, config) {
6582
6658
  getPlanetScaleClientAuthorization,
6583
6659
  getPlanetScaleClientConfig,
6584
6660
  getPlatformAccountsClientAuthorization,
6585
- getPlatformAccountsClientConfig,
6586
6661
  getPlatformAdapterClientAuthorization,
6587
6662
  getPlatformAdapterClientConfig,
6588
6663
  getPlatformAdapterClientDefaultConfig,