@livechat/developer-studio-api 3.0.57 → 3.1.0
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.d.mts +128 -24
- package/dist/index.d.ts +128 -24
- package/dist/index.js +225 -148
- package/dist/index.mjs +223 -147
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -70,6 +70,7 @@ __export(src_exports, {
|
|
|
70
70
|
API_NOTIFICATIONS: () => API_NOTIFICATIONS,
|
|
71
71
|
AccountsApiError: () => AccountsApiError,
|
|
72
72
|
AdapterApiError: () => AdapterApiError,
|
|
73
|
+
ApiClient: () => ApiClient,
|
|
73
74
|
ApiErrorBase: () => ApiErrorBase,
|
|
74
75
|
DpsApiError: () => DpsApiError,
|
|
75
76
|
LivechatApiError: () => LivechatApiError,
|
|
@@ -78,6 +79,7 @@ __export(src_exports, {
|
|
|
78
79
|
ShopifyApiError: () => ShopifyApiError,
|
|
79
80
|
ShopifyEvents: () => ShopifyEvents,
|
|
80
81
|
TextLivechatEvents: () => TextLivechatEvents,
|
|
82
|
+
UnauthorizeAccountsApiError: () => UnauthorizeAccountsApiError,
|
|
81
83
|
UnauthorizeApiError: () => UnauthorizeApiError,
|
|
82
84
|
WorkflowDefinitionTaskType: () => WorkflowDefinitionTaskType,
|
|
83
85
|
allAppTemplates: () => allAppTemplates,
|
|
@@ -104,7 +106,6 @@ __export(src_exports, {
|
|
|
104
106
|
getPlanetScaleClientAuthorization: () => getPlanetScaleClientAuthorization,
|
|
105
107
|
getPlanetScaleClientConfig: () => getPlanetScaleClientConfig,
|
|
106
108
|
getPlatformAccountsClientAuthorization: () => getPlatformAccountsClientAuthorization,
|
|
107
|
-
getPlatformAccountsClientConfig: () => getPlatformAccountsClientConfig,
|
|
108
109
|
getPlatformAdapterClientAuthorization: () => getPlatformAdapterClientAuthorization,
|
|
109
110
|
getPlatformAdapterClientConfig: () => getPlatformAdapterClientConfig,
|
|
110
111
|
getPlatformAdapterClientDefaultConfig: () => getPlatformAdapterClientDefaultConfig,
|
|
@@ -170,7 +171,7 @@ var import_axios3 = __toESM(require("axios"));
|
|
|
170
171
|
// src/apis/integrations/github/instance.ts
|
|
171
172
|
var import_axios = __toESM(require("axios"));
|
|
172
173
|
|
|
173
|
-
// src/types/errors
|
|
174
|
+
// src/types/api/errors.ts
|
|
174
175
|
var ApiErrorBase = class extends Error {
|
|
175
176
|
constructor(message, data, code) {
|
|
176
177
|
super(message);
|
|
@@ -196,6 +197,90 @@ var UnauthorizeApiError = class extends Error {
|
|
|
196
197
|
}
|
|
197
198
|
};
|
|
198
199
|
|
|
200
|
+
// src/types/api/client.ts
|
|
201
|
+
var ApiClient = class {
|
|
202
|
+
constructor(config, authorization) {
|
|
203
|
+
this.config = config;
|
|
204
|
+
this.authorization = authorization;
|
|
205
|
+
}
|
|
206
|
+
updateConfig(config) {
|
|
207
|
+
this.config = __spreadValues(__spreadValues({}, this.config), config);
|
|
208
|
+
}
|
|
209
|
+
updateAuthorization(authorization) {
|
|
210
|
+
this.authorization = __spreadValues(__spreadValues({}, this.authorization), authorization);
|
|
211
|
+
}
|
|
212
|
+
fetch(url, customConfig, customOptions) {
|
|
213
|
+
return __async(this, null, function* () {
|
|
214
|
+
var _a, _b, _c;
|
|
215
|
+
const authorization = (_a = customConfig == null ? void 0 : customConfig.authorization) != null ? _a : this.authorization;
|
|
216
|
+
if ((customConfig == null ? void 0 : customConfig.ensureAuthorization) && !authorization) {
|
|
217
|
+
throw new this.UnauthorizedError();
|
|
218
|
+
}
|
|
219
|
+
const options = __spreadValues(__spreadValues({}, this.options), customOptions);
|
|
220
|
+
const response = yield fetch(`${this.config.baseURL}${url}`, __spreadProps(__spreadValues({}, options), {
|
|
221
|
+
headers: __spreadValues(__spreadValues({}, options.headers), authorization ? {
|
|
222
|
+
Authorization: `${(_b = authorization.tokenType) != null ? _b : "Bearer"} ${authorization.token}`
|
|
223
|
+
} : void 0)
|
|
224
|
+
}));
|
|
225
|
+
if (!response.ok) {
|
|
226
|
+
const errorData = yield response.json();
|
|
227
|
+
const error = new this.Error(
|
|
228
|
+
(_c = customConfig == null ? void 0 : customConfig.customErrorMessage) != null ? _c : response.statusText,
|
|
229
|
+
errorData,
|
|
230
|
+
response.status
|
|
231
|
+
);
|
|
232
|
+
if (response.status === 401) {
|
|
233
|
+
throw new this.UnauthorizedError();
|
|
234
|
+
}
|
|
235
|
+
throw error;
|
|
236
|
+
}
|
|
237
|
+
const data = yield response.json();
|
|
238
|
+
return __spreadProps(__spreadValues({}, response), {
|
|
239
|
+
data
|
|
240
|
+
});
|
|
241
|
+
});
|
|
242
|
+
}
|
|
243
|
+
get(url, config, options) {
|
|
244
|
+
return __async(this, null, function* () {
|
|
245
|
+
return this.fetch(url, config, __spreadProps(__spreadValues({}, options), {
|
|
246
|
+
method: "GET"
|
|
247
|
+
}));
|
|
248
|
+
});
|
|
249
|
+
}
|
|
250
|
+
post(url, body, customConfig, customOptions) {
|
|
251
|
+
return __async(this, null, function* () {
|
|
252
|
+
return this.fetch(url, customConfig, __spreadProps(__spreadValues({}, customOptions), {
|
|
253
|
+
method: "POST",
|
|
254
|
+
body: JSON.stringify(body)
|
|
255
|
+
}));
|
|
256
|
+
});
|
|
257
|
+
}
|
|
258
|
+
patch(url, body, customConfig, customOptions) {
|
|
259
|
+
return __async(this, null, function* () {
|
|
260
|
+
return this.fetch(url, customConfig, __spreadProps(__spreadValues({}, customOptions), {
|
|
261
|
+
method: "PATCH",
|
|
262
|
+
body: JSON.stringify(body)
|
|
263
|
+
}));
|
|
264
|
+
});
|
|
265
|
+
}
|
|
266
|
+
put(url, body, customConfig, customOptions) {
|
|
267
|
+
return __async(this, null, function* () {
|
|
268
|
+
return this.fetch(url, customConfig, __spreadProps(__spreadValues({}, customOptions), {
|
|
269
|
+
method: "PUT",
|
|
270
|
+
body: JSON.stringify(body)
|
|
271
|
+
}));
|
|
272
|
+
});
|
|
273
|
+
}
|
|
274
|
+
delete(url, body, config, options) {
|
|
275
|
+
return __async(this, null, function* () {
|
|
276
|
+
return this.fetch(url, config, __spreadProps(__spreadValues({}, options), {
|
|
277
|
+
method: "DELETE",
|
|
278
|
+
body: JSON.stringify(body)
|
|
279
|
+
}));
|
|
280
|
+
});
|
|
281
|
+
}
|
|
282
|
+
};
|
|
283
|
+
|
|
199
284
|
// src/apis/integrations/github/instance.ts
|
|
200
285
|
var githubClientInstance = import_axios.default.create({
|
|
201
286
|
baseURL: "https://api.github.com",
|
|
@@ -3430,32 +3515,32 @@ var productsApi = {
|
|
|
3430
3515
|
};
|
|
3431
3516
|
|
|
3432
3517
|
// src/apis/platform/accounts/instance.ts
|
|
3433
|
-
var import_axios18 = __toESM(require("axios"));
|
|
3434
3518
|
var AccountsApiError = class extends ApiErrorBase {
|
|
3435
3519
|
constructor() {
|
|
3436
3520
|
super(...arguments);
|
|
3437
3521
|
this.name = "accounts";
|
|
3438
3522
|
}
|
|
3439
3523
|
};
|
|
3440
|
-
var
|
|
3524
|
+
var UnauthorizeAccountsApiError = class extends UnauthorizeApiError {
|
|
3525
|
+
constructor(message) {
|
|
3526
|
+
super("accounts", message);
|
|
3527
|
+
}
|
|
3528
|
+
};
|
|
3529
|
+
var AccountApiClient = class extends ApiClient {
|
|
3530
|
+
constructor() {
|
|
3531
|
+
super(...arguments);
|
|
3532
|
+
this.UnauthorizedError = UnauthorizeAccountsApiError;
|
|
3533
|
+
this.Error = AccountsApiError;
|
|
3534
|
+
this.options = {
|
|
3535
|
+
headers: {
|
|
3536
|
+
"Content-Type": "application/json"
|
|
3537
|
+
}
|
|
3538
|
+
};
|
|
3539
|
+
}
|
|
3540
|
+
};
|
|
3541
|
+
var platformAccountsClientInstance = new AccountApiClient({
|
|
3441
3542
|
baseURL: "https://accounts.labs.livechatinc.com"
|
|
3442
3543
|
});
|
|
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
3544
|
function getPlatformAccountsClientAuthorization(req) {
|
|
3460
3545
|
if (req.headers instanceof Headers) {
|
|
3461
3546
|
return {
|
|
@@ -3466,42 +3551,24 @@ function getPlatformAccountsClientAuthorization(req) {
|
|
|
3466
3551
|
token: req.headers["x-adapter-platform-token"]
|
|
3467
3552
|
};
|
|
3468
3553
|
}
|
|
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
3554
|
function initPlatformAccountsClient(baseUrl, token) {
|
|
3480
3555
|
if (baseUrl) {
|
|
3481
|
-
platformAccountsClientInstance.
|
|
3482
|
-
|
|
3483
|
-
|
|
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;
|
|
3556
|
+
platformAccountsClientInstance.updateConfig({
|
|
3557
|
+
baseURL: baseUrl
|
|
3558
|
+
});
|
|
3493
3559
|
}
|
|
3560
|
+
platformAccountsClientInstance.updateAuthorization({
|
|
3561
|
+
token
|
|
3562
|
+
});
|
|
3494
3563
|
}
|
|
3495
3564
|
|
|
3496
3565
|
// src/apis/platform/accounts/accounts/api.ts
|
|
3497
3566
|
var platformAccountsAccountApi = {
|
|
3498
3567
|
getAccounts(authorization) {
|
|
3499
3568
|
return __async(this, null, function* () {
|
|
3500
|
-
return platformAccountsClientInstance.get(
|
|
3501
|
-
|
|
3502
|
-
|
|
3503
|
-
).catch((error) => {
|
|
3504
|
-
throw error.withCustomMessage("Accounts couldn't be fetched.");
|
|
3569
|
+
return platformAccountsClientInstance.get(`/v2/accounts`, {
|
|
3570
|
+
authorization,
|
|
3571
|
+
customErrorMessage: "Accounts couldn't be fetched."
|
|
3505
3572
|
});
|
|
3506
3573
|
});
|
|
3507
3574
|
},
|
|
@@ -3509,20 +3576,22 @@ var platformAccountsAccountApi = {
|
|
|
3509
3576
|
return __async(this, null, function* () {
|
|
3510
3577
|
return platformAccountsClientInstance.get(
|
|
3511
3578
|
`/v2/accounts/${accountId}`,
|
|
3512
|
-
|
|
3513
|
-
|
|
3514
|
-
|
|
3515
|
-
|
|
3579
|
+
{
|
|
3580
|
+
authorization,
|
|
3581
|
+
customErrorMessage: "Account couldn't be fetched."
|
|
3582
|
+
}
|
|
3583
|
+
);
|
|
3516
3584
|
});
|
|
3517
3585
|
},
|
|
3518
3586
|
getMeAccount(authorization) {
|
|
3519
3587
|
return __async(this, null, function* () {
|
|
3520
3588
|
return platformAccountsClientInstance.get(
|
|
3521
3589
|
`/v2/accounts/me`,
|
|
3522
|
-
|
|
3523
|
-
|
|
3524
|
-
|
|
3525
|
-
|
|
3590
|
+
{
|
|
3591
|
+
authorization,
|
|
3592
|
+
customErrorMessage: "Me account couldn't be fetched."
|
|
3593
|
+
}
|
|
3594
|
+
);
|
|
3526
3595
|
});
|
|
3527
3596
|
}
|
|
3528
3597
|
};
|
|
@@ -3533,30 +3602,29 @@ var platformAccountsClientApi = {
|
|
|
3533
3602
|
return __async(this, null, function* () {
|
|
3534
3603
|
return platformAccountsClientInstance.get(
|
|
3535
3604
|
`/v2/clients`,
|
|
3536
|
-
|
|
3537
|
-
|
|
3538
|
-
|
|
3539
|
-
|
|
3605
|
+
{
|
|
3606
|
+
authorization,
|
|
3607
|
+
customErrorMessage: "Clients couldn't be fetched."
|
|
3608
|
+
}
|
|
3609
|
+
);
|
|
3540
3610
|
});
|
|
3541
3611
|
},
|
|
3542
3612
|
getClient(clientId, authorization) {
|
|
3543
3613
|
return __async(this, null, function* () {
|
|
3544
3614
|
return platformAccountsClientInstance.get(
|
|
3545
3615
|
`/v2/clients/${clientId}`,
|
|
3546
|
-
|
|
3547
|
-
|
|
3548
|
-
|
|
3549
|
-
|
|
3616
|
+
{
|
|
3617
|
+
authorization,
|
|
3618
|
+
customErrorMessage: "Client couldn't be fetched."
|
|
3619
|
+
}
|
|
3620
|
+
);
|
|
3550
3621
|
});
|
|
3551
3622
|
},
|
|
3552
3623
|
createClient(payload, authorization) {
|
|
3553
3624
|
return __async(this, null, function* () {
|
|
3554
|
-
return platformAccountsClientInstance.post(
|
|
3555
|
-
|
|
3556
|
-
|
|
3557
|
-
getPlatformAccountsClientConfig(authorization)
|
|
3558
|
-
).catch((error) => {
|
|
3559
|
-
throw error.withCustomMessage("Client couldn't be created.");
|
|
3625
|
+
return platformAccountsClientInstance.post(`/v2/clients`, payload, {
|
|
3626
|
+
authorization,
|
|
3627
|
+
customErrorMessage: "Client couldn't be created."
|
|
3560
3628
|
});
|
|
3561
3629
|
});
|
|
3562
3630
|
},
|
|
@@ -3565,20 +3633,23 @@ var platformAccountsClientApi = {
|
|
|
3565
3633
|
return platformAccountsClientInstance.patch(
|
|
3566
3634
|
`/v2/clients/${clientId}`,
|
|
3567
3635
|
payload,
|
|
3568
|
-
|
|
3569
|
-
|
|
3570
|
-
|
|
3571
|
-
|
|
3636
|
+
{
|
|
3637
|
+
authorization,
|
|
3638
|
+
customErrorMessage: "Client couldn't be updated."
|
|
3639
|
+
}
|
|
3640
|
+
);
|
|
3572
3641
|
});
|
|
3573
3642
|
},
|
|
3574
3643
|
deleteClient(clientId, authorization) {
|
|
3575
3644
|
return __async(this, null, function* () {
|
|
3576
3645
|
return platformAccountsClientInstance.delete(
|
|
3577
3646
|
`/v2/clients/${clientId}`,
|
|
3578
|
-
|
|
3579
|
-
|
|
3580
|
-
|
|
3581
|
-
|
|
3647
|
+
void 0,
|
|
3648
|
+
{
|
|
3649
|
+
authorization,
|
|
3650
|
+
customErrorMessage: "Clients couldn't be deleted."
|
|
3651
|
+
}
|
|
3652
|
+
);
|
|
3582
3653
|
});
|
|
3583
3654
|
},
|
|
3584
3655
|
updateClientScopes(clientId, scopes, authorization) {
|
|
@@ -3589,31 +3660,35 @@ var platformAccountsClientApi = {
|
|
|
3589
3660
|
scope: scope.scope,
|
|
3590
3661
|
required: scope.required
|
|
3591
3662
|
})),
|
|
3592
|
-
|
|
3593
|
-
|
|
3594
|
-
|
|
3595
|
-
|
|
3663
|
+
{
|
|
3664
|
+
authorization,
|
|
3665
|
+
customErrorMessage: "Client scopes couldn't be updated."
|
|
3666
|
+
}
|
|
3667
|
+
);
|
|
3596
3668
|
});
|
|
3597
3669
|
},
|
|
3598
3670
|
deleteClientScopes(clientId, scopes, authorization) {
|
|
3599
3671
|
return __async(this, null, function* () {
|
|
3600
|
-
return platformAccountsClientInstance.delete(
|
|
3601
|
-
|
|
3602
|
-
|
|
3603
|
-
|
|
3604
|
-
|
|
3605
|
-
|
|
3606
|
-
|
|
3607
|
-
|
|
3672
|
+
return platformAccountsClientInstance.delete(
|
|
3673
|
+
`/v2/clients/${clientId}/scopes`,
|
|
3674
|
+
{
|
|
3675
|
+
data: scopes.map((scope) => ({
|
|
3676
|
+
scope: scope.scope,
|
|
3677
|
+
required: scope.required
|
|
3678
|
+
}))
|
|
3679
|
+
},
|
|
3680
|
+
{
|
|
3681
|
+
authorization,
|
|
3682
|
+
customErrorMessage: "Client scopes couldn't be deleted."
|
|
3683
|
+
}
|
|
3684
|
+
);
|
|
3608
3685
|
});
|
|
3609
3686
|
},
|
|
3610
3687
|
getInfo(authorization) {
|
|
3611
3688
|
return __async(this, null, function* () {
|
|
3612
|
-
return platformAccountsClientInstance.get(
|
|
3613
|
-
|
|
3614
|
-
|
|
3615
|
-
).catch((error) => {
|
|
3616
|
-
throw error.withCustomMessage("Client info couldn't be fetched.");
|
|
3689
|
+
return platformAccountsClientInstance.get(`/v2/info`, {
|
|
3690
|
+
authorization,
|
|
3691
|
+
customErrorMessage: "Client info couldn't be fetched."
|
|
3617
3692
|
});
|
|
3618
3693
|
});
|
|
3619
3694
|
}
|
|
@@ -3625,20 +3700,22 @@ var platformAccountsOrganizationApi = {
|
|
|
3625
3700
|
return __async(this, null, function* () {
|
|
3626
3701
|
return platformAccountsClientInstance.get(
|
|
3627
3702
|
`/v2/organizations`,
|
|
3628
|
-
|
|
3629
|
-
|
|
3630
|
-
|
|
3631
|
-
|
|
3703
|
+
{
|
|
3704
|
+
authorization,
|
|
3705
|
+
customErrorMessage: "Organizations couldn't be fetched."
|
|
3706
|
+
}
|
|
3707
|
+
);
|
|
3632
3708
|
});
|
|
3633
3709
|
},
|
|
3634
3710
|
getMyOrganization(authorization) {
|
|
3635
3711
|
return __async(this, null, function* () {
|
|
3636
3712
|
return platformAccountsClientInstance.get(
|
|
3637
3713
|
`/v2/organizations/my`,
|
|
3638
|
-
|
|
3639
|
-
|
|
3640
|
-
|
|
3641
|
-
|
|
3714
|
+
{
|
|
3715
|
+
authorization,
|
|
3716
|
+
customErrorMessage: "My organization couldn't be fetched."
|
|
3717
|
+
}
|
|
3718
|
+
);
|
|
3642
3719
|
});
|
|
3643
3720
|
}
|
|
3644
3721
|
};
|
|
@@ -3647,10 +3724,9 @@ var platformAccountsOrganizationApi = {
|
|
|
3647
3724
|
var platformAccountsPersonalAccessTokenApi = {
|
|
3648
3725
|
getPersonalAccessTokens(authorization) {
|
|
3649
3726
|
return __async(this, null, function* () {
|
|
3650
|
-
return platformAccountsClientInstance.get(`/v2/personal_token`,
|
|
3651
|
-
|
|
3652
|
-
|
|
3653
|
-
);
|
|
3727
|
+
return platformAccountsClientInstance.get(`/v2/personal_token`, {
|
|
3728
|
+
authorization,
|
|
3729
|
+
customErrorMessage: "Personal Access Tokens couldn't be fetched."
|
|
3654
3730
|
});
|
|
3655
3731
|
});
|
|
3656
3732
|
},
|
|
@@ -3662,24 +3738,23 @@ var platformAccountsPersonalAccessTokenApi = {
|
|
|
3662
3738
|
name,
|
|
3663
3739
|
scope: scopes.map((item) => item.name).filter((el) => el).join(",")
|
|
3664
3740
|
},
|
|
3665
|
-
|
|
3666
|
-
|
|
3667
|
-
|
|
3668
|
-
|
|
3669
|
-
|
|
3670
|
-
});
|
|
3741
|
+
{
|
|
3742
|
+
authorization,
|
|
3743
|
+
customErrorMessage: "Personal Access Token couldn't be created."
|
|
3744
|
+
}
|
|
3745
|
+
);
|
|
3671
3746
|
});
|
|
3672
3747
|
},
|
|
3673
3748
|
deletePersonalAccessToken(id, authorization) {
|
|
3674
3749
|
return __async(this, null, function* () {
|
|
3675
3750
|
return platformAccountsClientInstance.delete(
|
|
3676
3751
|
`/v2/personal_token/${id}`,
|
|
3677
|
-
|
|
3678
|
-
|
|
3679
|
-
|
|
3680
|
-
"Personal Access Tokens couldn't be deleted."
|
|
3681
|
-
|
|
3682
|
-
|
|
3752
|
+
void 0,
|
|
3753
|
+
{
|
|
3754
|
+
authorization,
|
|
3755
|
+
customErrorMessage: "Personal Access Tokens couldn't be deleted."
|
|
3756
|
+
}
|
|
3757
|
+
);
|
|
3683
3758
|
});
|
|
3684
3759
|
}
|
|
3685
3760
|
};
|
|
@@ -3690,10 +3765,8 @@ var platformAccountsProductsApi = {
|
|
|
3690
3765
|
return __async(this, null, function* () {
|
|
3691
3766
|
return platformAccountsClientInstance.get(
|
|
3692
3767
|
`/v2/organizations/my/products`,
|
|
3693
|
-
|
|
3694
|
-
)
|
|
3695
|
-
throw error.withCustomMessage("Products couldn't be fetched.");
|
|
3696
|
-
});
|
|
3768
|
+
{ authorization, customErrorMessage: "Products couldn't be fetched." }
|
|
3769
|
+
);
|
|
3697
3770
|
});
|
|
3698
3771
|
},
|
|
3699
3772
|
updateOrganizationProducts(payload, authorization) {
|
|
@@ -3701,10 +3774,8 @@ var platformAccountsProductsApi = {
|
|
|
3701
3774
|
return platformAccountsClientInstance.post(
|
|
3702
3775
|
`/v2/organizations/my/products`,
|
|
3703
3776
|
payload,
|
|
3704
|
-
|
|
3705
|
-
)
|
|
3706
|
-
throw error.withCustomMessage("Products couldn't be updated.");
|
|
3707
|
-
});
|
|
3777
|
+
{ authorization, customErrorMessage: "Products couldn't be updated." }
|
|
3778
|
+
);
|
|
3708
3779
|
});
|
|
3709
3780
|
}
|
|
3710
3781
|
};
|
|
@@ -3713,11 +3784,9 @@ var platformAccountsProductsApi = {
|
|
|
3713
3784
|
var platformAccountsScopesApi = {
|
|
3714
3785
|
getScopes(authorization) {
|
|
3715
3786
|
return __async(this, null, function* () {
|
|
3716
|
-
return platformAccountsClientInstance.get(
|
|
3717
|
-
|
|
3718
|
-
|
|
3719
|
-
).catch((error) => {
|
|
3720
|
-
throw error.withCustomMessage("Scopes couldn't be fetched.");
|
|
3787
|
+
return platformAccountsClientInstance.get(`/v2/scopes`, {
|
|
3788
|
+
authorization,
|
|
3789
|
+
customErrorMessage: "Scopes couldn't be fetched."
|
|
3721
3790
|
});
|
|
3722
3791
|
});
|
|
3723
3792
|
}
|
|
@@ -3729,10 +3798,12 @@ var platformAccountsSessionsApi = {
|
|
|
3729
3798
|
return __async(this, null, function* () {
|
|
3730
3799
|
return platformAccountsClientInstance.delete(
|
|
3731
3800
|
`/v2/sessions`,
|
|
3732
|
-
|
|
3733
|
-
|
|
3734
|
-
|
|
3735
|
-
|
|
3801
|
+
void 0,
|
|
3802
|
+
{
|
|
3803
|
+
authorization,
|
|
3804
|
+
customErrorMessage: "Sessions couldn't be fetched."
|
|
3805
|
+
}
|
|
3806
|
+
);
|
|
3736
3807
|
});
|
|
3737
3808
|
}
|
|
3738
3809
|
};
|
|
@@ -3748,13 +3819,18 @@ var platformAccountsTokenApi = {
|
|
|
3748
3819
|
client_secret: clientSecret,
|
|
3749
3820
|
redirect_uri: redirectUrl
|
|
3750
3821
|
});
|
|
3751
|
-
return platformAccountsClientInstance.post(
|
|
3752
|
-
|
|
3753
|
-
|
|
3822
|
+
return platformAccountsClientInstance.post(
|
|
3823
|
+
`/v2/token`,
|
|
3824
|
+
data,
|
|
3825
|
+
{
|
|
3826
|
+
customErrorMessage: "Couldn't exchange code for token."
|
|
3827
|
+
},
|
|
3828
|
+
{
|
|
3829
|
+
headers: {
|
|
3830
|
+
"Content-Type": "application/x-www-form-urlencoded"
|
|
3831
|
+
}
|
|
3754
3832
|
}
|
|
3755
|
-
|
|
3756
|
-
throw error.withCustomMessage("Couldn't exchange code for token.");
|
|
3757
|
-
});
|
|
3833
|
+
);
|
|
3758
3834
|
});
|
|
3759
3835
|
}
|
|
3760
3836
|
};
|
|
@@ -3772,14 +3848,14 @@ var platformAccountsApi = {
|
|
|
3772
3848
|
};
|
|
3773
3849
|
|
|
3774
3850
|
// src/apis/platform/dps/instance.ts
|
|
3775
|
-
var
|
|
3851
|
+
var import_axios18 = __toESM(require("axios"));
|
|
3776
3852
|
var DpsApiError = class extends ApiErrorBase {
|
|
3777
3853
|
constructor() {
|
|
3778
3854
|
super(...arguments);
|
|
3779
3855
|
this.name = "dps";
|
|
3780
3856
|
}
|
|
3781
3857
|
};
|
|
3782
|
-
var platformDpsClientInstance =
|
|
3858
|
+
var platformDpsClientInstance = import_axios18.default.create({
|
|
3783
3859
|
baseURL: "https://dev-platform.labs.livechatinc.com"
|
|
3784
3860
|
});
|
|
3785
3861
|
platformDpsClientInstance.interceptors.response.use(
|
|
@@ -5344,7 +5420,7 @@ var platformDpsApi = {
|
|
|
5344
5420
|
};
|
|
5345
5421
|
|
|
5346
5422
|
// src/apis/platform/adapter/instance.ts
|
|
5347
|
-
var
|
|
5423
|
+
var import_axios19 = __toESM(require("axios"));
|
|
5348
5424
|
var REGION2 = {
|
|
5349
5425
|
FRA: "fra",
|
|
5350
5426
|
DAL: "dal",
|
|
@@ -5364,7 +5440,7 @@ var AdapterApiError = class extends ApiErrorBase {
|
|
|
5364
5440
|
this.name = "adapter";
|
|
5365
5441
|
}
|
|
5366
5442
|
};
|
|
5367
|
-
var platformAdapterClientInstance =
|
|
5443
|
+
var platformAdapterClientInstance = import_axios19.default.create({
|
|
5368
5444
|
baseURL: "https://platform.labs.text.com/console-adapter/api",
|
|
5369
5445
|
headers: {
|
|
5370
5446
|
"Content-Type": "application/json"
|
|
@@ -6057,8 +6133,8 @@ var WorkflowDefinitionTaskType = {
|
|
|
6057
6133
|
};
|
|
6058
6134
|
|
|
6059
6135
|
// src/apis/platform/billing/instance.ts
|
|
6060
|
-
var
|
|
6061
|
-
var platformBillingClientInstance =
|
|
6136
|
+
var import_axios20 = __toESM(require("axios"));
|
|
6137
|
+
var platformBillingClientInstance = import_axios20.default.create({
|
|
6062
6138
|
baseURL: "https://billing.labs.livechatinc.com"
|
|
6063
6139
|
});
|
|
6064
6140
|
function getPlatformBillingClientAuthorization(req) {
|
|
@@ -6550,6 +6626,7 @@ function getIntegrationFlowUrl(provider, flow, data, context, config) {
|
|
|
6550
6626
|
API_NOTIFICATIONS,
|
|
6551
6627
|
AccountsApiError,
|
|
6552
6628
|
AdapterApiError,
|
|
6629
|
+
ApiClient,
|
|
6553
6630
|
ApiErrorBase,
|
|
6554
6631
|
DpsApiError,
|
|
6555
6632
|
LivechatApiError,
|
|
@@ -6558,6 +6635,7 @@ function getIntegrationFlowUrl(provider, flow, data, context, config) {
|
|
|
6558
6635
|
ShopifyApiError,
|
|
6559
6636
|
ShopifyEvents,
|
|
6560
6637
|
TextLivechatEvents,
|
|
6638
|
+
UnauthorizeAccountsApiError,
|
|
6561
6639
|
UnauthorizeApiError,
|
|
6562
6640
|
WorkflowDefinitionTaskType,
|
|
6563
6641
|
allAppTemplates,
|
|
@@ -6584,7 +6662,6 @@ function getIntegrationFlowUrl(provider, flow, data, context, config) {
|
|
|
6584
6662
|
getPlanetScaleClientAuthorization,
|
|
6585
6663
|
getPlanetScaleClientConfig,
|
|
6586
6664
|
getPlatformAccountsClientAuthorization,
|
|
6587
|
-
getPlatformAccountsClientConfig,
|
|
6588
6665
|
getPlatformAdapterClientAuthorization,
|
|
6589
6666
|
getPlatformAdapterClientConfig,
|
|
6590
6667
|
getPlatformAdapterClientDefaultConfig,
|