@livechat/developer-studio-api 3.0.43 → 3.0.45
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 +135 -82
- package/dist/index.d.ts +135 -82
- package/dist/index.js +250 -132
- package/dist/index.mjs +248 -132
- package/package.json +2 -2
package/dist/index.mjs
CHANGED
|
@@ -2250,8 +2250,128 @@ var neonApi = {
|
|
|
2250
2250
|
};
|
|
2251
2251
|
|
|
2252
2252
|
// src/apis/integrations/mailchimp/api.ts
|
|
2253
|
+
import axios12 from "axios";
|
|
2254
|
+
|
|
2255
|
+
// src/apis/integrations/mailchimp/instance.ts
|
|
2253
2256
|
import axios11 from "axios";
|
|
2257
|
+
var MailchimpApiError = class extends ApiErrorBase {
|
|
2258
|
+
constructor() {
|
|
2259
|
+
super(...arguments);
|
|
2260
|
+
this.name = "mailchimp";
|
|
2261
|
+
}
|
|
2262
|
+
};
|
|
2263
|
+
var getMailchimpClientUrl = (server) => `https://${server}.api.mailchimp.com/3.0`;
|
|
2264
|
+
var mailchimpClientInstance = axios11.create({
|
|
2265
|
+
headers: {
|
|
2266
|
+
"Content-Type": "application/json"
|
|
2267
|
+
}
|
|
2268
|
+
});
|
|
2269
|
+
mailchimpClientInstance.interceptors.response.use(
|
|
2270
|
+
(r) => r,
|
|
2271
|
+
(error) => {
|
|
2272
|
+
var _a, _b, _c, _d;
|
|
2273
|
+
if (axios11.isAxiosError(error)) {
|
|
2274
|
+
if (((_a = error.response) == null ? void 0 : _a.status) === 401) {
|
|
2275
|
+
throw new UnauthorizeApiError("mailchimp");
|
|
2276
|
+
}
|
|
2277
|
+
}
|
|
2278
|
+
return Promise.reject(
|
|
2279
|
+
new MailchimpApiError(
|
|
2280
|
+
error.message,
|
|
2281
|
+
(_b = error.response) == null ? void 0 : _b.data,
|
|
2282
|
+
(_d = (_c = error.response) == null ? void 0 : _c.status) != null ? _d : 400
|
|
2283
|
+
)
|
|
2284
|
+
);
|
|
2285
|
+
}
|
|
2286
|
+
);
|
|
2287
|
+
function getMailchimpClientAuthorization(req) {
|
|
2288
|
+
return {
|
|
2289
|
+
server: req.headers["mailchimp-server"],
|
|
2290
|
+
token: req.headers["mailchimp-token"]
|
|
2291
|
+
};
|
|
2292
|
+
}
|
|
2293
|
+
function getMailchimpClientConfig(options = {}) {
|
|
2294
|
+
var _a, _b;
|
|
2295
|
+
const currentBaseUrl = mailchimpClientInstance.defaults.baseURL;
|
|
2296
|
+
const currentHeaders = mailchimpClientInstance.defaults.headers;
|
|
2297
|
+
const config = {
|
|
2298
|
+
baseUrl: (_a = options.server ? getMailchimpClientUrl(options.server) : void 0) != null ? _a : currentBaseUrl,
|
|
2299
|
+
authorization: (_b = options.token ? `Bearer ${options.token}` : void 0) != null ? _b : currentHeaders.Authorization
|
|
2300
|
+
};
|
|
2301
|
+
if (options.ensureAuthorizationToken && (!config.authorization || !config.baseUrl)) {
|
|
2302
|
+
throw new UnauthorizeApiError("mailchimp");
|
|
2303
|
+
}
|
|
2304
|
+
return {
|
|
2305
|
+
headers: __spreadValues({}, config.authorization ? { Authorization: config.authorization } : {})
|
|
2306
|
+
};
|
|
2307
|
+
}
|
|
2308
|
+
function initMailchimpClient(token, server) {
|
|
2309
|
+
if (token && server) {
|
|
2310
|
+
updateMailchimpClient(token);
|
|
2311
|
+
}
|
|
2312
|
+
}
|
|
2313
|
+
function updateMailchimpClient(token, server) {
|
|
2314
|
+
const defaults = mailchimpClientInstance.defaults;
|
|
2315
|
+
const headers = defaults.headers;
|
|
2316
|
+
if (token) {
|
|
2317
|
+
headers.Authorization = `Bearer ${token}`;
|
|
2318
|
+
} else {
|
|
2319
|
+
delete headers.Authorization;
|
|
2320
|
+
}
|
|
2321
|
+
if (server) {
|
|
2322
|
+
defaults.baseURL = getMailchimpClientUrl(server);
|
|
2323
|
+
} else {
|
|
2324
|
+
delete defaults.baseURL;
|
|
2325
|
+
}
|
|
2326
|
+
}
|
|
2327
|
+
|
|
2328
|
+
// src/apis/integrations/mailchimp/lists/webhooks/api.ts
|
|
2329
|
+
var mailchimpListsWebhooksApi = {
|
|
2330
|
+
list(listId, authorization) {
|
|
2331
|
+
return __async(this, null, function* () {
|
|
2332
|
+
const response = yield mailchimpClientInstance.get(
|
|
2333
|
+
`/lists/${listId}/webhooks`,
|
|
2334
|
+
getMailchimpClientConfig(__spreadProps(__spreadValues({}, authorization), {
|
|
2335
|
+
ensureAuthorizationToken: true
|
|
2336
|
+
}))
|
|
2337
|
+
);
|
|
2338
|
+
return response.data;
|
|
2339
|
+
});
|
|
2340
|
+
},
|
|
2341
|
+
add(listId, webhook, authorization) {
|
|
2342
|
+
return __async(this, null, function* () {
|
|
2343
|
+
const response = yield mailchimpClientInstance.post(
|
|
2344
|
+
`/list/${listId}/webhooks`,
|
|
2345
|
+
{
|
|
2346
|
+
webhook
|
|
2347
|
+
},
|
|
2348
|
+
getMailchimpClientConfig(__spreadProps(__spreadValues({}, authorization), {
|
|
2349
|
+
ensureAuthorizationToken: true
|
|
2350
|
+
}))
|
|
2351
|
+
);
|
|
2352
|
+
return response.data;
|
|
2353
|
+
});
|
|
2354
|
+
},
|
|
2355
|
+
delete(listId, webhookId, authorization) {
|
|
2356
|
+
return __async(this, null, function* () {
|
|
2357
|
+
yield mailchimpClientInstance.delete(
|
|
2358
|
+
`/lists/${listId}/webhooks/${webhookId}`,
|
|
2359
|
+
getMailchimpClientConfig(__spreadProps(__spreadValues({}, authorization), {
|
|
2360
|
+
ensureAuthorizationToken: true
|
|
2361
|
+
}))
|
|
2362
|
+
);
|
|
2363
|
+
});
|
|
2364
|
+
}
|
|
2365
|
+
};
|
|
2366
|
+
|
|
2367
|
+
// src/apis/integrations/mailchimp/lists/api.ts
|
|
2368
|
+
var mailchimpListsApi = {
|
|
2369
|
+
webhooks: mailchimpListsWebhooksApi
|
|
2370
|
+
};
|
|
2371
|
+
|
|
2372
|
+
// src/apis/integrations/mailchimp/api.ts
|
|
2254
2373
|
var mailchimpApi = {
|
|
2374
|
+
lists: mailchimpListsApi,
|
|
2255
2375
|
getToken(code, clientId, clientSecret, redirectUri) {
|
|
2256
2376
|
return __async(this, null, function* () {
|
|
2257
2377
|
var _a;
|
|
@@ -2262,7 +2382,7 @@ var mailchimpApi = {
|
|
|
2262
2382
|
redirect_uri: redirectUri,
|
|
2263
2383
|
grant_type: "authorization_code"
|
|
2264
2384
|
});
|
|
2265
|
-
const tokenResponse = yield
|
|
2385
|
+
const tokenResponse = yield axios12.post(
|
|
2266
2386
|
"https://login.mailchimp.com/oauth2/token",
|
|
2267
2387
|
data,
|
|
2268
2388
|
{
|
|
@@ -2283,7 +2403,7 @@ var mailchimpApi = {
|
|
|
2283
2403
|
return __async(this, arguments, function* ({ token }) {
|
|
2284
2404
|
const {
|
|
2285
2405
|
data: { dc: server }
|
|
2286
|
-
} = yield
|
|
2406
|
+
} = yield axios12.get(
|
|
2287
2407
|
"https://login.mailchimp.com/oauth2/metadata",
|
|
2288
2408
|
{
|
|
2289
2409
|
headers: {
|
|
@@ -2300,8 +2420,121 @@ var mailchimpApi = {
|
|
|
2300
2420
|
};
|
|
2301
2421
|
|
|
2302
2422
|
// src/apis/integrations/shopify/api.ts
|
|
2303
|
-
import
|
|
2423
|
+
import axios14 from "axios";
|
|
2424
|
+
|
|
2425
|
+
// src/apis/integrations/shopify/instance.ts
|
|
2426
|
+
import axios13 from "axios";
|
|
2427
|
+
var ShopifyApiError = class extends ApiErrorBase {
|
|
2428
|
+
constructor() {
|
|
2429
|
+
super(...arguments);
|
|
2430
|
+
this.name = "shopify";
|
|
2431
|
+
}
|
|
2432
|
+
};
|
|
2433
|
+
var shopifyClientInstance = axios13.create();
|
|
2434
|
+
shopifyClientInstance.interceptors.response.use(
|
|
2435
|
+
(r) => r,
|
|
2436
|
+
(error) => {
|
|
2437
|
+
var _a, _b, _c, _d;
|
|
2438
|
+
if (axios13.isAxiosError(error)) {
|
|
2439
|
+
if (((_a = error.response) == null ? void 0 : _a.status) === 401) {
|
|
2440
|
+
throw new UnauthorizeApiError("shopify");
|
|
2441
|
+
}
|
|
2442
|
+
}
|
|
2443
|
+
return Promise.reject(
|
|
2444
|
+
new ShopifyApiError(
|
|
2445
|
+
error.message,
|
|
2446
|
+
(_b = error.response) == null ? void 0 : _b.data,
|
|
2447
|
+
(_d = (_c = error.response) == null ? void 0 : _c.status) != null ? _d : 400
|
|
2448
|
+
)
|
|
2449
|
+
);
|
|
2450
|
+
}
|
|
2451
|
+
);
|
|
2452
|
+
var getShopifyClientUrl = (store) => `https://${store}.myshopify.com/admin/api/2024-04`;
|
|
2453
|
+
function getShopifyClientAuthorization(req) {
|
|
2454
|
+
return {
|
|
2455
|
+
shop: req.headers["shopify-shop"],
|
|
2456
|
+
token: req.headers["shopify-token"]
|
|
2457
|
+
};
|
|
2458
|
+
}
|
|
2459
|
+
function getShopifyClientConfig(options) {
|
|
2460
|
+
var _a, _b;
|
|
2461
|
+
const currentBaseUrl = shopifyClientInstance.defaults.baseURL;
|
|
2462
|
+
const currentHeaders = shopifyClientInstance.defaults.headers;
|
|
2463
|
+
const config = {
|
|
2464
|
+
baseUrl: (_a = options.shop ? getShopifyClientUrl(options.shop) : void 0) != null ? _a : currentBaseUrl,
|
|
2465
|
+
authorization: (_b = options.token ? options.token : void 0) != null ? _b : currentHeaders["X-Shopify-Access-Token"]
|
|
2466
|
+
};
|
|
2467
|
+
if (options.ensureAuthorizationToken && (!config.authorization || !config.baseUrl)) {
|
|
2468
|
+
throw new UnauthorizeApiError("shopify");
|
|
2469
|
+
}
|
|
2470
|
+
return {
|
|
2471
|
+
baseURL: config.baseUrl,
|
|
2472
|
+
headers: __spreadValues({}, config.authorization ? { "X-Shopify-Access-Token": config.authorization } : {})
|
|
2473
|
+
};
|
|
2474
|
+
}
|
|
2475
|
+
function initShopifyClient(token, shop) {
|
|
2476
|
+
if (token && shop) {
|
|
2477
|
+
updateShopifyClient(token);
|
|
2478
|
+
}
|
|
2479
|
+
}
|
|
2480
|
+
function updateShopifyClient(token, shop) {
|
|
2481
|
+
const defaults = shopifyClientInstance.defaults;
|
|
2482
|
+
const headers = defaults.headers;
|
|
2483
|
+
if (token) {
|
|
2484
|
+
headers.Authorization = `Bearer ${token}`;
|
|
2485
|
+
} else {
|
|
2486
|
+
delete headers.Authorization;
|
|
2487
|
+
}
|
|
2488
|
+
if (shop) {
|
|
2489
|
+
defaults.baseURL = getShopifyClientUrl(shop);
|
|
2490
|
+
} else {
|
|
2491
|
+
delete defaults.baseURL;
|
|
2492
|
+
}
|
|
2493
|
+
}
|
|
2494
|
+
|
|
2495
|
+
// src/apis/integrations/shopify/webhooks/api.ts
|
|
2496
|
+
var shopifyWebhooksApi = {
|
|
2497
|
+
list(options, authorization) {
|
|
2498
|
+
return __async(this, null, function* () {
|
|
2499
|
+
const params = new URLSearchParams(options);
|
|
2500
|
+
const response = yield shopifyClientInstance.get(
|
|
2501
|
+
`/webhooks.json?${params.toString()}`,
|
|
2502
|
+
getShopifyClientConfig(__spreadProps(__spreadValues({}, authorization), {
|
|
2503
|
+
ensureAuthorizationToken: true
|
|
2504
|
+
}))
|
|
2505
|
+
);
|
|
2506
|
+
return response.data;
|
|
2507
|
+
});
|
|
2508
|
+
},
|
|
2509
|
+
register(webhook, authorization) {
|
|
2510
|
+
return __async(this, null, function* () {
|
|
2511
|
+
const response = yield shopifyClientInstance.post(
|
|
2512
|
+
`/webhooks.json`,
|
|
2513
|
+
{
|
|
2514
|
+
webhook
|
|
2515
|
+
},
|
|
2516
|
+
getShopifyClientConfig(__spreadProps(__spreadValues({}, authorization), {
|
|
2517
|
+
ensureAuthorizationToken: true
|
|
2518
|
+
}))
|
|
2519
|
+
);
|
|
2520
|
+
return response.data;
|
|
2521
|
+
});
|
|
2522
|
+
},
|
|
2523
|
+
unregister(webhookId, authorization) {
|
|
2524
|
+
return __async(this, null, function* () {
|
|
2525
|
+
yield shopifyClientInstance.delete(
|
|
2526
|
+
`/webhooks/${webhookId}.json`,
|
|
2527
|
+
getShopifyClientConfig(__spreadProps(__spreadValues({}, authorization), {
|
|
2528
|
+
ensureAuthorizationToken: true
|
|
2529
|
+
}))
|
|
2530
|
+
);
|
|
2531
|
+
});
|
|
2532
|
+
}
|
|
2533
|
+
};
|
|
2534
|
+
|
|
2535
|
+
// src/apis/integrations/shopify/api.ts
|
|
2304
2536
|
var shopifyApi = {
|
|
2537
|
+
webhooks: shopifyWebhooksApi,
|
|
2305
2538
|
getToken(shop, code, clientId, clientSecret, redirectUri) {
|
|
2306
2539
|
return __async(this, null, function* () {
|
|
2307
2540
|
var _a;
|
|
@@ -2312,8 +2545,8 @@ var shopifyApi = {
|
|
|
2312
2545
|
redirect_uri: redirectUri,
|
|
2313
2546
|
grant_type: "authorization_code"
|
|
2314
2547
|
});
|
|
2315
|
-
const response = yield
|
|
2316
|
-
`https://${shop
|
|
2548
|
+
const response = yield axios14.post(
|
|
2549
|
+
`https://${shop}.myshopify.com/admin/oauth/access_token`,
|
|
2317
2550
|
data,
|
|
2318
2551
|
{
|
|
2319
2552
|
headers: {
|
|
@@ -2342,7 +2575,7 @@ var integrationsApi = {
|
|
|
2342
2575
|
};
|
|
2343
2576
|
|
|
2344
2577
|
// src/apis/products/livechat/instance.ts
|
|
2345
|
-
import
|
|
2578
|
+
import axios15 from "axios";
|
|
2346
2579
|
var REGION = {
|
|
2347
2580
|
FRA: "fra",
|
|
2348
2581
|
DAL: "dal",
|
|
@@ -2356,7 +2589,7 @@ var getRegion = (token) => {
|
|
|
2356
2589
|
return region;
|
|
2357
2590
|
}
|
|
2358
2591
|
};
|
|
2359
|
-
var livechatClientInstance =
|
|
2592
|
+
var livechatClientInstance = axios15.create({
|
|
2360
2593
|
baseURL: "https://api.labs.livechatinc.com"
|
|
2361
2594
|
});
|
|
2362
2595
|
function getLiveChatClientAuthorization(req) {
|
|
@@ -2875,14 +3108,14 @@ var productsApi = {
|
|
|
2875
3108
|
};
|
|
2876
3109
|
|
|
2877
3110
|
// src/apis/platform/accounts/instance.ts
|
|
2878
|
-
import
|
|
3111
|
+
import axios16 from "axios";
|
|
2879
3112
|
var AccountsApiError = class extends ApiErrorBase {
|
|
2880
3113
|
constructor() {
|
|
2881
3114
|
super(...arguments);
|
|
2882
3115
|
this.name = "accounts";
|
|
2883
3116
|
}
|
|
2884
3117
|
};
|
|
2885
|
-
var platformAccountsClientInstance =
|
|
3118
|
+
var platformAccountsClientInstance = axios16.create({
|
|
2886
3119
|
baseURL: "https://accounts.labs.livechatinc.com"
|
|
2887
3120
|
});
|
|
2888
3121
|
platformAccountsClientInstance.interceptors.response.use(
|
|
@@ -3212,14 +3445,14 @@ var platformAccountsApi = {
|
|
|
3212
3445
|
};
|
|
3213
3446
|
|
|
3214
3447
|
// src/apis/platform/dps/instance.ts
|
|
3215
|
-
import
|
|
3448
|
+
import axios17 from "axios";
|
|
3216
3449
|
var DpsApiError = class extends ApiErrorBase {
|
|
3217
3450
|
constructor() {
|
|
3218
3451
|
super(...arguments);
|
|
3219
3452
|
this.name = "dps";
|
|
3220
3453
|
}
|
|
3221
3454
|
};
|
|
3222
|
-
var platformDpsClientInstance =
|
|
3455
|
+
var platformDpsClientInstance = axios17.create({
|
|
3223
3456
|
baseURL: "https://dev-platform.labs.livechatinc.com"
|
|
3224
3457
|
});
|
|
3225
3458
|
platformDpsClientInstance.interceptors.response.use(
|
|
@@ -4778,7 +5011,7 @@ var platformDpsApi = {
|
|
|
4778
5011
|
};
|
|
4779
5012
|
|
|
4780
5013
|
// src/apis/platform/adapter/instance.ts
|
|
4781
|
-
import
|
|
5014
|
+
import axios18 from "axios";
|
|
4782
5015
|
var REGION2 = {
|
|
4783
5016
|
FRA: "fra",
|
|
4784
5017
|
DAL: "dal",
|
|
@@ -4798,7 +5031,7 @@ var AdapterApiError = class extends ApiErrorBase {
|
|
|
4798
5031
|
this.name = "adapter";
|
|
4799
5032
|
}
|
|
4800
5033
|
};
|
|
4801
|
-
var platformAdapterClientInstance =
|
|
5034
|
+
var platformAdapterClientInstance = axios18.create({
|
|
4802
5035
|
baseURL: "https://platform.labs.text.com/console-adapter/api",
|
|
4803
5036
|
headers: {
|
|
4804
5037
|
"Content-Type": "application/json"
|
|
@@ -5449,125 +5682,6 @@ var platformAdapterConductorApi = {
|
|
|
5449
5682
|
}
|
|
5450
5683
|
};
|
|
5451
5684
|
|
|
5452
|
-
// src/apis/integrations/mailchimp/instance.ts
|
|
5453
|
-
import axios17 from "axios";
|
|
5454
|
-
var getMailchimpClientUrl = (server) => `https://${server}.api.mailchimp.com/3.0`;
|
|
5455
|
-
var mailchimpClientInstance = axios17.create({
|
|
5456
|
-
headers: {
|
|
5457
|
-
"Content-Type": "application/json"
|
|
5458
|
-
}
|
|
5459
|
-
});
|
|
5460
|
-
mailchimpClientInstance.interceptors.response.use(
|
|
5461
|
-
(r) => r,
|
|
5462
|
-
(error) => {
|
|
5463
|
-
var _a;
|
|
5464
|
-
if (axios17.isAxiosError(error)) {
|
|
5465
|
-
if (((_a = error.response) == null ? void 0 : _a.status) === 401) {
|
|
5466
|
-
throw new UnauthorizeApiError("mailchimp");
|
|
5467
|
-
}
|
|
5468
|
-
}
|
|
5469
|
-
throw error;
|
|
5470
|
-
}
|
|
5471
|
-
);
|
|
5472
|
-
function getMailchimpClientAuthorization(req) {
|
|
5473
|
-
return {
|
|
5474
|
-
server: req.headers["mailchimp-server"],
|
|
5475
|
-
token: req.headers["mailchimp-token"]
|
|
5476
|
-
};
|
|
5477
|
-
}
|
|
5478
|
-
function getMailchimpClientConfig(options = {}) {
|
|
5479
|
-
var _a, _b;
|
|
5480
|
-
const currentBaseUrl = mailchimpClientInstance.defaults.baseURL;
|
|
5481
|
-
const currentHeaders = mailchimpClientInstance.defaults.headers;
|
|
5482
|
-
const config = {
|
|
5483
|
-
baseUrl: (_a = options.server ? getMailchimpClientUrl(options.server) : void 0) != null ? _a : currentBaseUrl,
|
|
5484
|
-
authorization: (_b = options.token ? `Bearer ${options.token}` : void 0) != null ? _b : currentHeaders.Authorization
|
|
5485
|
-
};
|
|
5486
|
-
if (options.ensureAuthorizationToken && (!config.authorization || !config.baseUrl)) {
|
|
5487
|
-
throw new UnauthorizeApiError("mailchimp");
|
|
5488
|
-
}
|
|
5489
|
-
return {
|
|
5490
|
-
headers: __spreadValues({}, config.authorization ? { Authorization: config.authorization } : {})
|
|
5491
|
-
};
|
|
5492
|
-
}
|
|
5493
|
-
function initMailchimpClient(token, server) {
|
|
5494
|
-
if (token && server) {
|
|
5495
|
-
updateMailchimpClient(token);
|
|
5496
|
-
}
|
|
5497
|
-
}
|
|
5498
|
-
function updateMailchimpClient(token, server) {
|
|
5499
|
-
const defaults = mailchimpClientInstance.defaults;
|
|
5500
|
-
const headers = defaults.headers;
|
|
5501
|
-
if (token) {
|
|
5502
|
-
headers.Authorization = `Bearer ${token}`;
|
|
5503
|
-
} else {
|
|
5504
|
-
delete headers.Authorization;
|
|
5505
|
-
}
|
|
5506
|
-
if (server) {
|
|
5507
|
-
defaults.baseURL = getMailchimpClientUrl(server);
|
|
5508
|
-
} else {
|
|
5509
|
-
delete defaults.baseURL;
|
|
5510
|
-
}
|
|
5511
|
-
}
|
|
5512
|
-
|
|
5513
|
-
// src/apis/integrations/shopify/instance.ts
|
|
5514
|
-
import axios18 from "axios";
|
|
5515
|
-
var shopifyClientInstance = axios18.create();
|
|
5516
|
-
shopifyClientInstance.interceptors.response.use(
|
|
5517
|
-
(r) => r,
|
|
5518
|
-
(error) => {
|
|
5519
|
-
var _a;
|
|
5520
|
-
if (axios18.isAxiosError(error)) {
|
|
5521
|
-
if (((_a = error.response) == null ? void 0 : _a.status) === 401) {
|
|
5522
|
-
throw new UnauthorizeApiError("shopify");
|
|
5523
|
-
}
|
|
5524
|
-
}
|
|
5525
|
-
throw error;
|
|
5526
|
-
}
|
|
5527
|
-
);
|
|
5528
|
-
var getShopifyClientUrl = (store) => `https://${store}.myshopify.com/admin/api`;
|
|
5529
|
-
function getShopifyClientAuthorization(req) {
|
|
5530
|
-
return {
|
|
5531
|
-
shop: req.headers["shopify-shop"],
|
|
5532
|
-
token: req.headers["shopify-token"]
|
|
5533
|
-
};
|
|
5534
|
-
}
|
|
5535
|
-
function getShopifyClientConfig(options) {
|
|
5536
|
-
var _a, _b;
|
|
5537
|
-
const currentBaseUrl = shopifyClientInstance.defaults.baseURL;
|
|
5538
|
-
const currentHeaders = shopifyClientInstance.defaults.headers;
|
|
5539
|
-
const config = {
|
|
5540
|
-
baseUrl: (_a = options.shop ? getShopifyClientUrl(options.shop) : void 0) != null ? _a : currentBaseUrl,
|
|
5541
|
-
authorization: (_b = options.token ? options.token : void 0) != null ? _b : currentHeaders["X-Shopify-Access-Token"]
|
|
5542
|
-
};
|
|
5543
|
-
if (options.ensureAuthorizationToken && (!config.authorization || !config.baseUrl)) {
|
|
5544
|
-
throw new UnauthorizeApiError("shopify");
|
|
5545
|
-
}
|
|
5546
|
-
return {
|
|
5547
|
-
baseURL: config.baseUrl,
|
|
5548
|
-
headers: __spreadValues({}, config.authorization ? { "X-Shopify-Access-Token": config.authorization } : {})
|
|
5549
|
-
};
|
|
5550
|
-
}
|
|
5551
|
-
function initShopifyClient(token, shop) {
|
|
5552
|
-
if (token && shop) {
|
|
5553
|
-
updateShopifyClient(token);
|
|
5554
|
-
}
|
|
5555
|
-
}
|
|
5556
|
-
function updateShopifyClient(token, shop) {
|
|
5557
|
-
const defaults = shopifyClientInstance.defaults;
|
|
5558
|
-
const headers = defaults.headers;
|
|
5559
|
-
if (token) {
|
|
5560
|
-
headers.Authorization = `Bearer ${token}`;
|
|
5561
|
-
} else {
|
|
5562
|
-
delete headers.Authorization;
|
|
5563
|
-
}
|
|
5564
|
-
if (shop) {
|
|
5565
|
-
defaults.baseURL = getShopifyClientUrl(shop);
|
|
5566
|
-
} else {
|
|
5567
|
-
delete defaults.baseURL;
|
|
5568
|
-
}
|
|
5569
|
-
}
|
|
5570
|
-
|
|
5571
5685
|
// src/apis/platform/billing/instance.ts
|
|
5572
5686
|
import axios19 from "axios";
|
|
5573
5687
|
var platformBillingClientInstance = axios19.create({
|
|
@@ -5831,6 +5945,8 @@ export {
|
|
|
5831
5945
|
AdapterApiError,
|
|
5832
5946
|
ApiErrorBase,
|
|
5833
5947
|
DpsApiError,
|
|
5948
|
+
MailchimpApiError,
|
|
5949
|
+
ShopifyApiError,
|
|
5834
5950
|
UnauthorizeApiError,
|
|
5835
5951
|
allAppTemplates,
|
|
5836
5952
|
api,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@livechat/developer-studio-api",
|
|
3
|
-
"version": "3.0.
|
|
3
|
+
"version": "3.0.45",
|
|
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,7 +21,7 @@
|
|
|
21
21
|
"typescript": "^5.1.6",
|
|
22
22
|
"eslint-config-custom": "0.0.7",
|
|
23
23
|
"tsconfig": "0.0.1",
|
|
24
|
-
"utils": "0.0.
|
|
24
|
+
"utils": "0.0.4"
|
|
25
25
|
},
|
|
26
26
|
"scripts": {
|
|
27
27
|
"build": "tsup",
|