@livechat/developer-studio-api 3.0.43 → 3.0.44

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 CHANGED
@@ -1,3 +1,4 @@
1
+ import * as shopify_api_node from 'shopify-api-node';
1
2
  import * as axios from 'axios';
2
3
  import { AxiosRequestConfig } from 'axios';
3
4
 
@@ -2984,7 +2985,15 @@ declare const api: {
2984
2985
  }>;
2985
2986
  };
2986
2987
  shopify: {
2987
- getToken(shop: string | undefined, code: string, clientId: string, clientSecret: string, redirectUri: string): Promise<{
2988
+ webhooks: {
2989
+ list(authorization?: ShopifyClientAuthorization | undefined): Promise<{
2990
+ webhooks: shopify_api_node.IWebhook[];
2991
+ }>;
2992
+ register(webhook: shopify_api_node.ICreateWebhook, authorization?: ShopifyClientAuthorization | undefined): Promise<{
2993
+ webhook: shopify_api_node.IWebhook;
2994
+ }>;
2995
+ };
2996
+ getToken(shop: string, code: string, clientId: string, clientSecret: string, redirectUri: string): Promise<{
2988
2997
  token: string;
2989
2998
  }>;
2990
2999
  };
package/dist/index.d.ts CHANGED
@@ -1,3 +1,4 @@
1
+ import * as shopify_api_node from 'shopify-api-node';
1
2
  import * as axios from 'axios';
2
3
  import { AxiosRequestConfig } from 'axios';
3
4
 
@@ -2984,7 +2985,15 @@ declare const api: {
2984
2985
  }>;
2985
2986
  };
2986
2987
  shopify: {
2987
- getToken(shop: string | undefined, code: string, clientId: string, clientSecret: string, redirectUri: string): Promise<{
2988
+ webhooks: {
2989
+ list(authorization?: ShopifyClientAuthorization | undefined): Promise<{
2990
+ webhooks: shopify_api_node.IWebhook[];
2991
+ }>;
2992
+ register(webhook: shopify_api_node.ICreateWebhook, authorization?: ShopifyClientAuthorization | undefined): Promise<{
2993
+ webhook: shopify_api_node.IWebhook;
2994
+ }>;
2995
+ };
2996
+ getToken(shop: string, code: string, clientId: string, clientSecret: string, redirectUri: string): Promise<{
2988
2997
  token: string;
2989
2998
  }>;
2990
2999
  };
package/dist/index.js CHANGED
@@ -2414,8 +2414,98 @@ var mailchimpApi = {
2414
2414
  };
2415
2415
 
2416
2416
  // src/apis/integrations/shopify/api.ts
2417
+ var import_axios15 = __toESM(require("axios"));
2418
+
2419
+ // src/apis/integrations/shopify/instance.ts
2417
2420
  var import_axios14 = __toESM(require("axios"));
2421
+ var shopifyClientInstance = import_axios14.default.create();
2422
+ shopifyClientInstance.interceptors.response.use(
2423
+ (r) => r,
2424
+ (error) => {
2425
+ var _a;
2426
+ if (import_axios14.default.isAxiosError(error)) {
2427
+ if (((_a = error.response) == null ? void 0 : _a.status) === 401) {
2428
+ throw new UnauthorizeApiError("shopify");
2429
+ }
2430
+ }
2431
+ throw error;
2432
+ }
2433
+ );
2434
+ var getShopifyClientUrl = (store) => `https://${store}.myshopify.com/admin/api/2024-04`;
2435
+ function getShopifyClientAuthorization(req) {
2436
+ return {
2437
+ shop: req.headers["shopify-shop"],
2438
+ token: req.headers["shopify-token"]
2439
+ };
2440
+ }
2441
+ function getShopifyClientConfig(options) {
2442
+ var _a, _b;
2443
+ const currentBaseUrl = shopifyClientInstance.defaults.baseURL;
2444
+ const currentHeaders = shopifyClientInstance.defaults.headers;
2445
+ const config = {
2446
+ baseUrl: (_a = options.shop ? getShopifyClientUrl(options.shop) : void 0) != null ? _a : currentBaseUrl,
2447
+ authorization: (_b = options.token ? options.token : void 0) != null ? _b : currentHeaders["X-Shopify-Access-Token"]
2448
+ };
2449
+ if (options.ensureAuthorizationToken && (!config.authorization || !config.baseUrl)) {
2450
+ throw new UnauthorizeApiError("shopify");
2451
+ }
2452
+ return {
2453
+ baseURL: config.baseUrl,
2454
+ headers: __spreadValues({}, config.authorization ? { "X-Shopify-Access-Token": config.authorization } : {})
2455
+ };
2456
+ }
2457
+ function initShopifyClient(token, shop) {
2458
+ if (token && shop) {
2459
+ updateShopifyClient(token);
2460
+ }
2461
+ }
2462
+ function updateShopifyClient(token, shop) {
2463
+ const defaults = shopifyClientInstance.defaults;
2464
+ const headers = defaults.headers;
2465
+ if (token) {
2466
+ headers.Authorization = `Bearer ${token}`;
2467
+ } else {
2468
+ delete headers.Authorization;
2469
+ }
2470
+ if (shop) {
2471
+ defaults.baseURL = getShopifyClientUrl(shop);
2472
+ } else {
2473
+ delete defaults.baseURL;
2474
+ }
2475
+ }
2476
+
2477
+ // src/apis/integrations/shopify/webhooks/api.ts
2478
+ var shopifyWebhooksApi = {
2479
+ list(authorization) {
2480
+ return __async(this, null, function* () {
2481
+ const response = yield shopifyClientInstance.get(
2482
+ `/webhooks.json`,
2483
+ getShopifyClientConfig(__spreadProps(__spreadValues({}, authorization), {
2484
+ ensureAuthorizationToken: true
2485
+ }))
2486
+ );
2487
+ return response.data;
2488
+ });
2489
+ },
2490
+ register(webhook, authorization) {
2491
+ return __async(this, null, function* () {
2492
+ const response = yield shopifyClientInstance.post(
2493
+ `/webhooks.json`,
2494
+ {
2495
+ webhook
2496
+ },
2497
+ getShopifyClientConfig(__spreadProps(__spreadValues({}, authorization), {
2498
+ ensureAuthorizationToken: true
2499
+ }))
2500
+ );
2501
+ return response.data;
2502
+ });
2503
+ }
2504
+ };
2505
+
2506
+ // src/apis/integrations/shopify/api.ts
2418
2507
  var shopifyApi = {
2508
+ webhooks: shopifyWebhooksApi,
2419
2509
  getToken(shop, code, clientId, clientSecret, redirectUri) {
2420
2510
  return __async(this, null, function* () {
2421
2511
  var _a;
@@ -2426,8 +2516,8 @@ var shopifyApi = {
2426
2516
  redirect_uri: redirectUri,
2427
2517
  grant_type: "authorization_code"
2428
2518
  });
2429
- const response = yield import_axios14.default.post(
2430
- `https://${shop ? `${shop}.` : ""}myshopify.com/admin/oauth/access_token`,
2519
+ const response = yield import_axios15.default.post(
2520
+ `https://${shop}.myshopify.com/admin/oauth/access_token`,
2431
2521
  data,
2432
2522
  {
2433
2523
  headers: {
@@ -2456,7 +2546,7 @@ var integrationsApi = {
2456
2546
  };
2457
2547
 
2458
2548
  // src/apis/products/livechat/instance.ts
2459
- var import_axios15 = __toESM(require("axios"));
2549
+ var import_axios16 = __toESM(require("axios"));
2460
2550
  var REGION = {
2461
2551
  FRA: "fra",
2462
2552
  DAL: "dal",
@@ -2470,7 +2560,7 @@ var getRegion = (token) => {
2470
2560
  return region;
2471
2561
  }
2472
2562
  };
2473
- var livechatClientInstance = import_axios15.default.create({
2563
+ var livechatClientInstance = import_axios16.default.create({
2474
2564
  baseURL: "https://api.labs.livechatinc.com"
2475
2565
  });
2476
2566
  function getLiveChatClientAuthorization(req) {
@@ -2989,14 +3079,14 @@ var productsApi = {
2989
3079
  };
2990
3080
 
2991
3081
  // src/apis/platform/accounts/instance.ts
2992
- var import_axios16 = __toESM(require("axios"));
3082
+ var import_axios17 = __toESM(require("axios"));
2993
3083
  var AccountsApiError = class extends ApiErrorBase {
2994
3084
  constructor() {
2995
3085
  super(...arguments);
2996
3086
  this.name = "accounts";
2997
3087
  }
2998
3088
  };
2999
- var platformAccountsClientInstance = import_axios16.default.create({
3089
+ var platformAccountsClientInstance = import_axios17.default.create({
3000
3090
  baseURL: "https://accounts.labs.livechatinc.com"
3001
3091
  });
3002
3092
  platformAccountsClientInstance.interceptors.response.use(
@@ -3326,14 +3416,14 @@ var platformAccountsApi = {
3326
3416
  };
3327
3417
 
3328
3418
  // src/apis/platform/dps/instance.ts
3329
- var import_axios17 = __toESM(require("axios"));
3419
+ var import_axios18 = __toESM(require("axios"));
3330
3420
  var DpsApiError = class extends ApiErrorBase {
3331
3421
  constructor() {
3332
3422
  super(...arguments);
3333
3423
  this.name = "dps";
3334
3424
  }
3335
3425
  };
3336
- var platformDpsClientInstance = import_axios17.default.create({
3426
+ var platformDpsClientInstance = import_axios18.default.create({
3337
3427
  baseURL: "https://dev-platform.labs.livechatinc.com"
3338
3428
  });
3339
3429
  platformDpsClientInstance.interceptors.response.use(
@@ -4892,7 +4982,7 @@ var platformDpsApi = {
4892
4982
  };
4893
4983
 
4894
4984
  // src/apis/platform/adapter/instance.ts
4895
- var import_axios18 = __toESM(require("axios"));
4985
+ var import_axios19 = __toESM(require("axios"));
4896
4986
  var REGION2 = {
4897
4987
  FRA: "fra",
4898
4988
  DAL: "dal",
@@ -4912,7 +5002,7 @@ var AdapterApiError = class extends ApiErrorBase {
4912
5002
  this.name = "adapter";
4913
5003
  }
4914
5004
  };
4915
- var platformAdapterClientInstance = import_axios18.default.create({
5005
+ var platformAdapterClientInstance = import_axios19.default.create({
4916
5006
  baseURL: "https://platform.labs.text.com/console-adapter/api",
4917
5007
  headers: {
4918
5008
  "Content-Type": "application/json"
@@ -5564,9 +5654,9 @@ var platformAdapterConductorApi = {
5564
5654
  };
5565
5655
 
5566
5656
  // src/apis/integrations/mailchimp/instance.ts
5567
- var import_axios19 = __toESM(require("axios"));
5657
+ var import_axios20 = __toESM(require("axios"));
5568
5658
  var getMailchimpClientUrl = (server) => `https://${server}.api.mailchimp.com/3.0`;
5569
- var mailchimpClientInstance = import_axios19.default.create({
5659
+ var mailchimpClientInstance = import_axios20.default.create({
5570
5660
  headers: {
5571
5661
  "Content-Type": "application/json"
5572
5662
  }
@@ -5575,7 +5665,7 @@ mailchimpClientInstance.interceptors.response.use(
5575
5665
  (r) => r,
5576
5666
  (error) => {
5577
5667
  var _a;
5578
- if (import_axios19.default.isAxiosError(error)) {
5668
+ if (import_axios20.default.isAxiosError(error)) {
5579
5669
  if (((_a = error.response) == null ? void 0 : _a.status) === 401) {
5580
5670
  throw new UnauthorizeApiError("mailchimp");
5581
5671
  }
@@ -5624,64 +5714,6 @@ function updateMailchimpClient(token, server) {
5624
5714
  }
5625
5715
  }
5626
5716
 
5627
- // src/apis/integrations/shopify/instance.ts
5628
- var import_axios20 = __toESM(require("axios"));
5629
- var shopifyClientInstance = import_axios20.default.create();
5630
- shopifyClientInstance.interceptors.response.use(
5631
- (r) => r,
5632
- (error) => {
5633
- var _a;
5634
- if (import_axios20.default.isAxiosError(error)) {
5635
- if (((_a = error.response) == null ? void 0 : _a.status) === 401) {
5636
- throw new UnauthorizeApiError("shopify");
5637
- }
5638
- }
5639
- throw error;
5640
- }
5641
- );
5642
- var getShopifyClientUrl = (store) => `https://${store}.myshopify.com/admin/api`;
5643
- function getShopifyClientAuthorization(req) {
5644
- return {
5645
- shop: req.headers["shopify-shop"],
5646
- token: req.headers["shopify-token"]
5647
- };
5648
- }
5649
- function getShopifyClientConfig(options) {
5650
- var _a, _b;
5651
- const currentBaseUrl = shopifyClientInstance.defaults.baseURL;
5652
- const currentHeaders = shopifyClientInstance.defaults.headers;
5653
- const config = {
5654
- baseUrl: (_a = options.shop ? getShopifyClientUrl(options.shop) : void 0) != null ? _a : currentBaseUrl,
5655
- authorization: (_b = options.token ? options.token : void 0) != null ? _b : currentHeaders["X-Shopify-Access-Token"]
5656
- };
5657
- if (options.ensureAuthorizationToken && (!config.authorization || !config.baseUrl)) {
5658
- throw new UnauthorizeApiError("shopify");
5659
- }
5660
- return {
5661
- baseURL: config.baseUrl,
5662
- headers: __spreadValues({}, config.authorization ? { "X-Shopify-Access-Token": config.authorization } : {})
5663
- };
5664
- }
5665
- function initShopifyClient(token, shop) {
5666
- if (token && shop) {
5667
- updateShopifyClient(token);
5668
- }
5669
- }
5670
- function updateShopifyClient(token, shop) {
5671
- const defaults = shopifyClientInstance.defaults;
5672
- const headers = defaults.headers;
5673
- if (token) {
5674
- headers.Authorization = `Bearer ${token}`;
5675
- } else {
5676
- delete headers.Authorization;
5677
- }
5678
- if (shop) {
5679
- defaults.baseURL = getShopifyClientUrl(shop);
5680
- } else {
5681
- delete defaults.baseURL;
5682
- }
5683
- }
5684
-
5685
5717
  // src/apis/platform/billing/instance.ts
5686
5718
  var import_axios21 = __toESM(require("axios"));
5687
5719
  var platformBillingClientInstance = import_axios21.default.create({
package/dist/index.mjs CHANGED
@@ -2300,8 +2300,98 @@ var mailchimpApi = {
2300
2300
  };
2301
2301
 
2302
2302
  // src/apis/integrations/shopify/api.ts
2303
+ import axios13 from "axios";
2304
+
2305
+ // src/apis/integrations/shopify/instance.ts
2303
2306
  import axios12 from "axios";
2307
+ var shopifyClientInstance = axios12.create();
2308
+ shopifyClientInstance.interceptors.response.use(
2309
+ (r) => r,
2310
+ (error) => {
2311
+ var _a;
2312
+ if (axios12.isAxiosError(error)) {
2313
+ if (((_a = error.response) == null ? void 0 : _a.status) === 401) {
2314
+ throw new UnauthorizeApiError("shopify");
2315
+ }
2316
+ }
2317
+ throw error;
2318
+ }
2319
+ );
2320
+ var getShopifyClientUrl = (store) => `https://${store}.myshopify.com/admin/api/2024-04`;
2321
+ function getShopifyClientAuthorization(req) {
2322
+ return {
2323
+ shop: req.headers["shopify-shop"],
2324
+ token: req.headers["shopify-token"]
2325
+ };
2326
+ }
2327
+ function getShopifyClientConfig(options) {
2328
+ var _a, _b;
2329
+ const currentBaseUrl = shopifyClientInstance.defaults.baseURL;
2330
+ const currentHeaders = shopifyClientInstance.defaults.headers;
2331
+ const config = {
2332
+ baseUrl: (_a = options.shop ? getShopifyClientUrl(options.shop) : void 0) != null ? _a : currentBaseUrl,
2333
+ authorization: (_b = options.token ? options.token : void 0) != null ? _b : currentHeaders["X-Shopify-Access-Token"]
2334
+ };
2335
+ if (options.ensureAuthorizationToken && (!config.authorization || !config.baseUrl)) {
2336
+ throw new UnauthorizeApiError("shopify");
2337
+ }
2338
+ return {
2339
+ baseURL: config.baseUrl,
2340
+ headers: __spreadValues({}, config.authorization ? { "X-Shopify-Access-Token": config.authorization } : {})
2341
+ };
2342
+ }
2343
+ function initShopifyClient(token, shop) {
2344
+ if (token && shop) {
2345
+ updateShopifyClient(token);
2346
+ }
2347
+ }
2348
+ function updateShopifyClient(token, shop) {
2349
+ const defaults = shopifyClientInstance.defaults;
2350
+ const headers = defaults.headers;
2351
+ if (token) {
2352
+ headers.Authorization = `Bearer ${token}`;
2353
+ } else {
2354
+ delete headers.Authorization;
2355
+ }
2356
+ if (shop) {
2357
+ defaults.baseURL = getShopifyClientUrl(shop);
2358
+ } else {
2359
+ delete defaults.baseURL;
2360
+ }
2361
+ }
2362
+
2363
+ // src/apis/integrations/shopify/webhooks/api.ts
2364
+ var shopifyWebhooksApi = {
2365
+ list(authorization) {
2366
+ return __async(this, null, function* () {
2367
+ const response = yield shopifyClientInstance.get(
2368
+ `/webhooks.json`,
2369
+ getShopifyClientConfig(__spreadProps(__spreadValues({}, authorization), {
2370
+ ensureAuthorizationToken: true
2371
+ }))
2372
+ );
2373
+ return response.data;
2374
+ });
2375
+ },
2376
+ register(webhook, authorization) {
2377
+ return __async(this, null, function* () {
2378
+ const response = yield shopifyClientInstance.post(
2379
+ `/webhooks.json`,
2380
+ {
2381
+ webhook
2382
+ },
2383
+ getShopifyClientConfig(__spreadProps(__spreadValues({}, authorization), {
2384
+ ensureAuthorizationToken: true
2385
+ }))
2386
+ );
2387
+ return response.data;
2388
+ });
2389
+ }
2390
+ };
2391
+
2392
+ // src/apis/integrations/shopify/api.ts
2304
2393
  var shopifyApi = {
2394
+ webhooks: shopifyWebhooksApi,
2305
2395
  getToken(shop, code, clientId, clientSecret, redirectUri) {
2306
2396
  return __async(this, null, function* () {
2307
2397
  var _a;
@@ -2312,8 +2402,8 @@ var shopifyApi = {
2312
2402
  redirect_uri: redirectUri,
2313
2403
  grant_type: "authorization_code"
2314
2404
  });
2315
- const response = yield axios12.post(
2316
- `https://${shop ? `${shop}.` : ""}myshopify.com/admin/oauth/access_token`,
2405
+ const response = yield axios13.post(
2406
+ `https://${shop}.myshopify.com/admin/oauth/access_token`,
2317
2407
  data,
2318
2408
  {
2319
2409
  headers: {
@@ -2342,7 +2432,7 @@ var integrationsApi = {
2342
2432
  };
2343
2433
 
2344
2434
  // src/apis/products/livechat/instance.ts
2345
- import axios13 from "axios";
2435
+ import axios14 from "axios";
2346
2436
  var REGION = {
2347
2437
  FRA: "fra",
2348
2438
  DAL: "dal",
@@ -2356,7 +2446,7 @@ var getRegion = (token) => {
2356
2446
  return region;
2357
2447
  }
2358
2448
  };
2359
- var livechatClientInstance = axios13.create({
2449
+ var livechatClientInstance = axios14.create({
2360
2450
  baseURL: "https://api.labs.livechatinc.com"
2361
2451
  });
2362
2452
  function getLiveChatClientAuthorization(req) {
@@ -2875,14 +2965,14 @@ var productsApi = {
2875
2965
  };
2876
2966
 
2877
2967
  // src/apis/platform/accounts/instance.ts
2878
- import axios14 from "axios";
2968
+ import axios15 from "axios";
2879
2969
  var AccountsApiError = class extends ApiErrorBase {
2880
2970
  constructor() {
2881
2971
  super(...arguments);
2882
2972
  this.name = "accounts";
2883
2973
  }
2884
2974
  };
2885
- var platformAccountsClientInstance = axios14.create({
2975
+ var platformAccountsClientInstance = axios15.create({
2886
2976
  baseURL: "https://accounts.labs.livechatinc.com"
2887
2977
  });
2888
2978
  platformAccountsClientInstance.interceptors.response.use(
@@ -3212,14 +3302,14 @@ var platformAccountsApi = {
3212
3302
  };
3213
3303
 
3214
3304
  // src/apis/platform/dps/instance.ts
3215
- import axios15 from "axios";
3305
+ import axios16 from "axios";
3216
3306
  var DpsApiError = class extends ApiErrorBase {
3217
3307
  constructor() {
3218
3308
  super(...arguments);
3219
3309
  this.name = "dps";
3220
3310
  }
3221
3311
  };
3222
- var platformDpsClientInstance = axios15.create({
3312
+ var platformDpsClientInstance = axios16.create({
3223
3313
  baseURL: "https://dev-platform.labs.livechatinc.com"
3224
3314
  });
3225
3315
  platformDpsClientInstance.interceptors.response.use(
@@ -4778,7 +4868,7 @@ var platformDpsApi = {
4778
4868
  };
4779
4869
 
4780
4870
  // src/apis/platform/adapter/instance.ts
4781
- import axios16 from "axios";
4871
+ import axios17 from "axios";
4782
4872
  var REGION2 = {
4783
4873
  FRA: "fra",
4784
4874
  DAL: "dal",
@@ -4798,7 +4888,7 @@ var AdapterApiError = class extends ApiErrorBase {
4798
4888
  this.name = "adapter";
4799
4889
  }
4800
4890
  };
4801
- var platformAdapterClientInstance = axios16.create({
4891
+ var platformAdapterClientInstance = axios17.create({
4802
4892
  baseURL: "https://platform.labs.text.com/console-adapter/api",
4803
4893
  headers: {
4804
4894
  "Content-Type": "application/json"
@@ -5450,9 +5540,9 @@ var platformAdapterConductorApi = {
5450
5540
  };
5451
5541
 
5452
5542
  // src/apis/integrations/mailchimp/instance.ts
5453
- import axios17 from "axios";
5543
+ import axios18 from "axios";
5454
5544
  var getMailchimpClientUrl = (server) => `https://${server}.api.mailchimp.com/3.0`;
5455
- var mailchimpClientInstance = axios17.create({
5545
+ var mailchimpClientInstance = axios18.create({
5456
5546
  headers: {
5457
5547
  "Content-Type": "application/json"
5458
5548
  }
@@ -5461,7 +5551,7 @@ mailchimpClientInstance.interceptors.response.use(
5461
5551
  (r) => r,
5462
5552
  (error) => {
5463
5553
  var _a;
5464
- if (axios17.isAxiosError(error)) {
5554
+ if (axios18.isAxiosError(error)) {
5465
5555
  if (((_a = error.response) == null ? void 0 : _a.status) === 401) {
5466
5556
  throw new UnauthorizeApiError("mailchimp");
5467
5557
  }
@@ -5510,64 +5600,6 @@ function updateMailchimpClient(token, server) {
5510
5600
  }
5511
5601
  }
5512
5602
 
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
5603
  // src/apis/platform/billing/instance.ts
5572
5604
  import axios19 from "axios";
5573
5605
  var platformBillingClientInstance = axios19.create({
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@livechat/developer-studio-api",
3
- "version": "3.0.43",
3
+ "version": "3.0.44",
4
4
  "description": "This project is API for LiveChat Developer Studio.",
5
5
  "main": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",