@livechat/developer-studio-api 3.1.24 → 3.1.26

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.mjs CHANGED
@@ -3118,6 +3118,156 @@ var hubspotApi = {
3118
3118
  }
3119
3119
  };
3120
3120
 
3121
+ // src/apis/integrations/bigcommerce/api.ts
3122
+ import axios18 from "axios";
3123
+
3124
+ // src/apis/integrations/bigcommerce/instance.ts
3125
+ import axios17 from "axios";
3126
+ var BigCommerceApiError = class extends ApiErrorBase {
3127
+ constructor() {
3128
+ super(...arguments);
3129
+ this.name = "bigcommerce";
3130
+ }
3131
+ };
3132
+ var bigCommerceClientInstance = axios17.create();
3133
+ bigCommerceClientInstance.interceptors.response.use(
3134
+ (r) => r,
3135
+ (error) => {
3136
+ var _a, _b, _c, _d;
3137
+ if (axios17.isAxiosError(error)) {
3138
+ if (((_a = error.response) == null ? void 0 : _a.status) === 401) {
3139
+ throw new UnauthorizeApiError("bigcommerce");
3140
+ }
3141
+ }
3142
+ return Promise.reject(
3143
+ new BigCommerceApiError(
3144
+ error.message,
3145
+ (_b = error.response) == null ? void 0 : _b.data,
3146
+ (_d = (_c = error.response) == null ? void 0 : _c.status) != null ? _d : 400
3147
+ )
3148
+ );
3149
+ }
3150
+ );
3151
+ var getBigCommerceClientUrl = (store) => `https://api.bigcommerce.com/stores/${store}/v3`;
3152
+ function getBigCommerceClientAuthorization(req) {
3153
+ if (req.headers instanceof Headers) {
3154
+ return {
3155
+ shop: req.headers.get("x-adapter-bigcommerce-shop"),
3156
+ token: req.headers.get("x-adapter-bigcommerce-token")
3157
+ };
3158
+ }
3159
+ return {
3160
+ shop: req.headers["x-adapter-bigcommerce-shop"],
3161
+ token: req.headers["x-adapter-bigcommerce-token"]
3162
+ };
3163
+ }
3164
+ function getBigCommerceClientConfig(options = {}) {
3165
+ var _a, _b;
3166
+ const currentBaseUrl = bigCommerceClientInstance.defaults.baseURL;
3167
+ const currentHeaders = bigCommerceClientInstance.defaults.headers;
3168
+ const config = {
3169
+ baseUrl: (_a = options.shop ? getBigCommerceClientUrl(options.shop) : void 0) != null ? _a : currentBaseUrl,
3170
+ authorization: (_b = options.token ? options.token : void 0) != null ? _b : currentHeaders["X-Auth-Token"]
3171
+ };
3172
+ if (options.ensureAuthorizationToken && (!config.authorization || !config.baseUrl)) {
3173
+ throw new UnauthorizeApiError("bigcommerce");
3174
+ }
3175
+ return {
3176
+ baseURL: config.baseUrl,
3177
+ headers: __spreadValues({}, config.authorization ? { "X-Auth-Token": config.authorization } : {})
3178
+ };
3179
+ }
3180
+ function initBigCommerceClient(token, shop) {
3181
+ if (token && shop) {
3182
+ updateBigCommerceClient(token);
3183
+ }
3184
+ }
3185
+ function updateBigCommerceClient(token, shop) {
3186
+ const defaults = bigCommerceClientInstance.defaults;
3187
+ const headers = defaults.headers;
3188
+ if (token) {
3189
+ headers.Authorization = `Bearer ${token}`;
3190
+ } else {
3191
+ delete headers.Authorization;
3192
+ }
3193
+ if (shop) {
3194
+ defaults.baseURL = getBigCommerceClientUrl(shop);
3195
+ } else {
3196
+ delete defaults.baseURL;
3197
+ }
3198
+ }
3199
+
3200
+ // src/apis/integrations/bigcommerce/webhooks/api.ts
3201
+ var bigCommerceWebhooksApi = {
3202
+ list(authorization) {
3203
+ return __async(this, null, function* () {
3204
+ const response = yield bigCommerceClientInstance.get(
3205
+ `/hooks`,
3206
+ getBigCommerceClientConfig(__spreadProps(__spreadValues({}, authorization), {
3207
+ ensureAuthorizationToken: true
3208
+ }))
3209
+ );
3210
+ return response.data;
3211
+ });
3212
+ },
3213
+ register(webhook, authorization) {
3214
+ return __async(this, null, function* () {
3215
+ const response = yield bigCommerceClientInstance.post(
3216
+ `/hooks`,
3217
+ webhook,
3218
+ getBigCommerceClientConfig(__spreadProps(__spreadValues({}, authorization), {
3219
+ ensureAuthorizationToken: true
3220
+ }))
3221
+ );
3222
+ return response.data;
3223
+ });
3224
+ },
3225
+ unregister(webhookId, authorization) {
3226
+ return __async(this, null, function* () {
3227
+ yield bigCommerceClientInstance.delete(
3228
+ `/hooks/${encodeURIComponent(webhookId)}`,
3229
+ getBigCommerceClientConfig(__spreadProps(__spreadValues({}, authorization), {
3230
+ ensureAuthorizationToken: true
3231
+ }))
3232
+ );
3233
+ });
3234
+ }
3235
+ };
3236
+
3237
+ // src/apis/integrations/bigcommerce/api.ts
3238
+ var bigcommerceApi = {
3239
+ webhooks: bigCommerceWebhooksApi,
3240
+ getToken(code, clientId, clientSecret, redirectUri, context, scope) {
3241
+ return __async(this, null, function* () {
3242
+ var _a;
3243
+ const data = new URLSearchParams({
3244
+ code,
3245
+ scope,
3246
+ context,
3247
+ client_id: clientId,
3248
+ client_secret: clientSecret,
3249
+ redirect_uri: redirectUri,
3250
+ grant_type: "authorization_code"
3251
+ });
3252
+ const tokenResponse = yield axios18.post(
3253
+ "https://login.bigcommerce.com/oauth2/token",
3254
+ data,
3255
+ {
3256
+ headers: {
3257
+ "Content-Type": "application/x-www-form-urlencoded"
3258
+ }
3259
+ }
3260
+ );
3261
+ const params = new URLSearchParams(
3262
+ tokenResponse.data
3263
+ );
3264
+ return {
3265
+ token: (_a = params.get("access_token")) != null ? _a : ""
3266
+ };
3267
+ });
3268
+ }
3269
+ };
3270
+
3121
3271
  // src/apis/integrations/api.ts
3122
3272
  var integrationsApi = {
3123
3273
  github: gitHubApi,
@@ -3128,11 +3278,12 @@ var integrationsApi = {
3128
3278
  neon: neonApi,
3129
3279
  planetscale: planetscaleApi,
3130
3280
  hubspot: hubspotApi,
3281
+ bigommerce: bigcommerceApi,
3131
3282
  text: textApi
3132
3283
  };
3133
3284
 
3134
3285
  // src/apis/products/livechat/instance.ts
3135
- import axios17 from "axios";
3286
+ import axios19 from "axios";
3136
3287
  var REGION = {
3137
3288
  FRA: "fra",
3138
3289
  DAL: "dal",
@@ -3152,7 +3303,7 @@ var LivechatApiError = class extends ApiErrorBase {
3152
3303
  this.name = "livechat";
3153
3304
  }
3154
3305
  };
3155
- var livechatClientInstance = axios17.create({
3306
+ var livechatClientInstance = axios19.create({
3156
3307
  baseURL: "https://api.labs.livechatinc.com"
3157
3308
  });
3158
3309
  livechatClientInstance.interceptors.response.use(
@@ -4047,14 +4198,14 @@ var platformAccountsApi = {
4047
4198
  };
4048
4199
 
4049
4200
  // src/apis/platform/dps/instance.ts
4050
- import axios18 from "axios";
4201
+ import axios20 from "axios";
4051
4202
  var DpsApiError = class extends ApiErrorBase {
4052
4203
  constructor() {
4053
4204
  super(...arguments);
4054
4205
  this.name = "dps";
4055
4206
  }
4056
4207
  };
4057
- var platformDpsClientInstance = axios18.create({
4208
+ var platformDpsClientInstance = axios20.create({
4058
4209
  baseURL: "https://dev-platform.labs.livechatinc.com"
4059
4210
  });
4060
4211
  platformDpsClientInstance.interceptors.response.use(
@@ -5657,7 +5808,7 @@ var platformDpsApi = {
5657
5808
  };
5658
5809
 
5659
5810
  // src/apis/platform/adapter/instance.ts
5660
- import axios19 from "axios";
5811
+ import axios21 from "axios";
5661
5812
  var REGION2 = {
5662
5813
  FRA: "fra",
5663
5814
  DAL: "dal",
@@ -5687,7 +5838,7 @@ var AdapterApiError = class _AdapterApiError extends ApiErrorBase {
5687
5838
  );
5688
5839
  }
5689
5840
  };
5690
- var platformAdapterClientInstance = axios19.create({
5841
+ var platformAdapterClientInstance = axios21.create({
5691
5842
  baseURL: "https://platform.labs.text.com/console-adapter/api",
5692
5843
  headers: {
5693
5844
  "Content-Type": "application/json"
@@ -5739,6 +5890,13 @@ function getPlatformAdapterClientAuthorization(req) {
5739
5890
  token: req.headers.get("x-adapter-shopify-token"),
5740
5891
  shop: req.headers.get("x-adapter-shopify-shop")
5741
5892
  },
5893
+ hubspot: {
5894
+ token: req.headers.get("x-adapter-hubspot-token")
5895
+ },
5896
+ bigcommerce: {
5897
+ token: req.headers.get("x-adapter-bigcommerce-token"),
5898
+ shop: req.headers.get("x-adapter-bigcommerce-shop")
5899
+ },
5742
5900
  text: {
5743
5901
  token: req.headers.get("x-adapter-text-token")
5744
5902
  }
@@ -5772,13 +5930,20 @@ function getPlatformAdapterClientAuthorization(req) {
5772
5930
  token: req.headers["x-adapter-shopify-token"],
5773
5931
  shop: req.headers["x-adapter-shopify-shop"]
5774
5932
  },
5933
+ hubspot: {
5934
+ token: req.headers["x-adapter-hubspot-token"]
5935
+ },
5936
+ bigcommerce: {
5937
+ token: req.headers["x-adapter-bigcommerce-token"],
5938
+ shop: req.headers["x-adapter-bigcommerce-shop"]
5939
+ },
5775
5940
  text: {
5776
5941
  token: req.headers["x-adapter-text-token"]
5777
5942
  }
5778
5943
  };
5779
5944
  }
5780
5945
  function getPlatformAdapterClientConfig(options = {}) {
5781
- var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _A, _B, _C, _D, _E, _F, _G, _H;
5946
+ var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _A, _B, _C, _D, _E, _F, _G, _H, _I, _J, _K, _L, _M, _N, _O, _P;
5782
5947
  const currentHeaders = platformAdapterClientInstance.defaults.headers;
5783
5948
  const headers = {
5784
5949
  platform: {
@@ -5797,41 +5962,50 @@ function getPlatformAdapterClientConfig(options = {}) {
5797
5962
  mailchimpServer: (_r = currentHeaders["x-adapter-mailchimp-server"]) != null ? _r : (_q = options.mailchimp) == null ? void 0 : _q.server,
5798
5963
  shopify: (_t = currentHeaders["x-adapter-shopify-token"]) != null ? _t : (_s = options.shopify) == null ? void 0 : _s.token,
5799
5964
  shopifyShop: (_v = currentHeaders["x-adapter-shopify-shop"]) != null ? _v : (_u = options.shopify) == null ? void 0 : _u.shop,
5800
- text: (_x = currentHeaders["x-adapter-text-token"]) != null ? _x : (_w = options.text) == null ? void 0 : _w.token
5965
+ hubspot: (_x = currentHeaders["x-adapter-hubspot-token"]) != null ? _x : (_w = options.hubspot) == null ? void 0 : _w.token,
5966
+ bigcommerce: (_z = currentHeaders["x-adapter-bigcommerce-token"]) != null ? _z : (_y = options.bigcommerce) == null ? void 0 : _y.token,
5967
+ bigcommerceShop: (_B = currentHeaders["x-adapter-bigcommerce-shop"]) != null ? _B : (_A = options.bigcommerce) == null ? void 0 : _A.shop,
5968
+ text: (_D = currentHeaders["x-adapter-text-token"]) != null ? _D : (_C = options.text) == null ? void 0 : _C.token
5801
5969
  }
5802
5970
  };
5803
5971
  if (currentHeaders["x-adapter-platform-token"]) {
5804
- currentHeaders["X-Region"] = (_y = getRegion2(currentHeaders["x-adapter-platform-token"])) != null ? _y : void 0;
5972
+ currentHeaders["X-Region"] = (_E = getRegion2(currentHeaders["x-adapter-platform-token"])) != null ? _E : void 0;
5805
5973
  }
5806
- if (((_z = options.ensureAuthorizationToken) == null ? void 0 : _z.platform) && !headers.platform.token) {
5974
+ if (((_F = options.ensureAuthorizationToken) == null ? void 0 : _F.platform) && !headers.platform.token) {
5807
5975
  throw new UnauthorizeApiError("accounts");
5808
5976
  }
5809
- if (((_A = options.ensureAuthorizationToken) == null ? void 0 : _A.github) && (!headers.integrations.github.app || !headers.integrations.github.oauth)) {
5977
+ if (((_G = options.ensureAuthorizationToken) == null ? void 0 : _G.github) && (!headers.integrations.github.app || !headers.integrations.github.oauth)) {
5810
5978
  throw new UnauthorizeApiError("github");
5811
5979
  }
5812
- if (((_B = options.ensureAuthorizationToken) == null ? void 0 : _B.vercel) && !headers.integrations.vercel) {
5980
+ if (((_H = options.ensureAuthorizationToken) == null ? void 0 : _H.vercel) && !headers.integrations.vercel) {
5813
5981
  throw new UnauthorizeApiError("vercel");
5814
5982
  }
5815
- if (((_C = options.ensureAuthorizationToken) == null ? void 0 : _C.netlify) && !headers.integrations.netlify) {
5983
+ if (((_I = options.ensureAuthorizationToken) == null ? void 0 : _I.netlify) && !headers.integrations.netlify) {
5816
5984
  throw new UnauthorizeApiError("netlify");
5817
5985
  }
5818
- if (((_D = options.ensureAuthorizationToken) == null ? void 0 : _D.planetscale) && !headers.integrations.planetscale) {
5986
+ if (((_J = options.ensureAuthorizationToken) == null ? void 0 : _J.planetscale) && !headers.integrations.planetscale) {
5819
5987
  throw new UnauthorizeApiError("planetscale");
5820
5988
  }
5821
- if (((_E = options.ensureAuthorizationToken) == null ? void 0 : _E.neon) && !headers.integrations.neon) {
5989
+ if (((_K = options.ensureAuthorizationToken) == null ? void 0 : _K.neon) && !headers.integrations.neon) {
5822
5990
  throw new UnauthorizeApiError("neon");
5823
5991
  }
5824
- if (((_F = options.ensureAuthorizationToken) == null ? void 0 : _F.mailchimp) && (!headers.integrations.mailchimp || !headers.integrations.mailchimpServer)) {
5992
+ if (((_L = options.ensureAuthorizationToken) == null ? void 0 : _L.mailchimp) && (!headers.integrations.mailchimp || !headers.integrations.mailchimpServer)) {
5825
5993
  throw new UnauthorizeApiError("mailchimp");
5826
5994
  }
5827
- if (((_G = options.ensureAuthorizationToken) == null ? void 0 : _G.shopify) && (!headers.integrations.shopify || !headers.integrations.shopifyShop)) {
5995
+ if (((_M = options.ensureAuthorizationToken) == null ? void 0 : _M.shopify) && (!headers.integrations.shopify || !headers.integrations.shopifyShop)) {
5828
5996
  throw new UnauthorizeApiError("shopify");
5829
5997
  }
5830
- if (((_H = options.ensureAuthorizationToken) == null ? void 0 : _H.text) && !headers.integrations.text) {
5998
+ if (((_N = options.ensureAuthorizationToken) == null ? void 0 : _N.hubspot) && !headers.integrations.hubspot) {
5999
+ throw new UnauthorizeApiError("hubspot");
6000
+ }
6001
+ if (((_O = options.ensureAuthorizationToken) == null ? void 0 : _O.bigcommerce) && (!headers.integrations.bigcommerce || !headers.integrations.bigcommerceShop)) {
6002
+ throw new UnauthorizeApiError("bigcommerce");
6003
+ }
6004
+ if (((_P = options.ensureAuthorizationToken) == null ? void 0 : _P.text) && !headers.integrations.text) {
5831
6005
  throw new UnauthorizeApiError("text");
5832
6006
  }
5833
6007
  return {
5834
- headers: __spreadValues(__spreadValues(__spreadValues(__spreadValues(__spreadValues(__spreadValues(__spreadValues(__spreadValues(__spreadValues(__spreadValues(__spreadValues(__spreadValues({}, headers.platform.token ? { "x-adapter-platform-token": headers.platform.token } : {}), headers.integrations.github.app ? { "x-adapter-github-app-token": headers.integrations.github.app } : {}), headers.integrations.github.oauth ? { "x-adapter-github-oauth-token": headers.integrations.github.oauth } : {}), headers.integrations.netlify ? { "x-adapter-netlify-token": headers.integrations.netlify } : {}), headers.integrations.vercel ? { "x-adapter-vercel-token": headers.integrations.vercel } : {}), headers.integrations.planetscale ? { "x-adapter-planetscale-token": headers.integrations.planetscale } : {}), headers.integrations.neon ? { "x-adapter-neon-token": headers.integrations.neon } : {}), headers.integrations.mailchimp ? { "x-adapter-mailchimp-token": headers.integrations.mailchimp } : {}), headers.integrations.mailchimpServer ? { "x-adapter-mailchimp-server": headers.integrations.mailchimpServer } : {}), headers.integrations.shopify ? { "x-adapter-shopify-token": headers.integrations.shopify } : {}), headers.integrations.shopifyShop ? { "x-adapter-shopify-shop": headers.integrations.shopifyShop } : {}), headers.integrations.text ? { "x-adapter-text-token": headers.integrations.text } : {})
6008
+ headers: __spreadValues(__spreadValues(__spreadValues(__spreadValues(__spreadValues(__spreadValues(__spreadValues(__spreadValues(__spreadValues(__spreadValues(__spreadValues(__spreadValues(__spreadValues(__spreadValues(__spreadValues({}, headers.platform.token ? { "x-adapter-platform-token": headers.platform.token } : {}), headers.integrations.github.app ? { "x-adapter-github-app-token": headers.integrations.github.app } : {}), headers.integrations.github.oauth ? { "x-adapter-github-oauth-token": headers.integrations.github.oauth } : {}), headers.integrations.netlify ? { "x-adapter-netlify-token": headers.integrations.netlify } : {}), headers.integrations.vercel ? { "x-adapter-vercel-token": headers.integrations.vercel } : {}), headers.integrations.planetscale ? { "x-adapter-planetscale-token": headers.integrations.planetscale } : {}), headers.integrations.neon ? { "x-adapter-neon-token": headers.integrations.neon } : {}), headers.integrations.mailchimp ? { "x-adapter-mailchimp-token": headers.integrations.mailchimp } : {}), headers.integrations.mailchimpServer ? { "x-adapter-mailchimp-server": headers.integrations.mailchimpServer } : {}), headers.integrations.shopify ? { "x-adapter-shopify-token": headers.integrations.shopify } : {}), headers.integrations.shopifyShop ? { "x-adapter-shopify-shop": headers.integrations.shopifyShop } : {}), headers.integrations.hubspot ? { "x-adapter-hubspot-token": headers.integrations.hubspot } : {}), headers.integrations.bigcommerce ? { "x-adapter-bigcommerce-token": headers.integrations.bigcommerce } : {}), headers.integrations.bigcommerceShop ? { "x-adapter-bigcommerce-shop": headers.integrations.bigcommerceShop } : {}), headers.integrations.text ? { "x-adapter-text-token": headers.integrations.text } : {})
5835
6009
  };
5836
6010
  }
5837
6011
  var getPlatformAdapterClientDefaultConfig = (authorization) => getPlatformAdapterClientConfig(__spreadProps(__spreadValues({}, authorization), {
@@ -5854,7 +6028,7 @@ function initPlatformAdapterClient(baseUrl, tokens) {
5854
6028
  }
5855
6029
  }
5856
6030
  function updatePlatformAdapterClient(tokens) {
5857
- var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l;
6031
+ var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o;
5858
6032
  const headers = platformAdapterClientInstance.defaults.headers;
5859
6033
  if ((_a = tokens == null ? void 0 : tokens.platform) == null ? void 0 : _a.token) {
5860
6034
  headers["x-adapter-platform-token"] = tokens.platform.token;
@@ -5889,7 +6063,16 @@ function updatePlatformAdapterClient(tokens) {
5889
6063
  if ((_k = tokens == null ? void 0 : tokens.shopify) == null ? void 0 : _k.token) {
5890
6064
  headers["x-adapter-shopify-token"] = tokens.shopify.token;
5891
6065
  }
5892
- if ((_l = tokens == null ? void 0 : tokens.text) == null ? void 0 : _l.token) {
6066
+ if ((_l = tokens == null ? void 0 : tokens.hubspot) == null ? void 0 : _l.token) {
6067
+ headers["x-adapter-hubspot-token"] = tokens.hubspot.token;
6068
+ }
6069
+ if ((_m = tokens == null ? void 0 : tokens.bigcommerce) == null ? void 0 : _m.shop) {
6070
+ headers["x-adapter-bigcommerce-shop"] = tokens.bigcommerce.shop;
6071
+ }
6072
+ if ((_n = tokens == null ? void 0 : tokens.bigcommerce) == null ? void 0 : _n.token) {
6073
+ headers["x-adapter-bigcommerce-token"] = tokens.bigcommerce.token;
6074
+ }
6075
+ if ((_o = tokens == null ? void 0 : tokens.text) == null ? void 0 : _o.token) {
5893
6076
  headers["x-adapter-text-token"] = tokens.text.token;
5894
6077
  }
5895
6078
  }
@@ -6409,7 +6592,7 @@ var WorkflowDefinitionTaskType = {
6409
6592
  };
6410
6593
 
6411
6594
  // src/apis/integrations/hubspot/instance.ts
6412
- import axios20 from "axios";
6595
+ import axios22 from "axios";
6413
6596
  var HubspotApiError = class extends ApiErrorBase {
6414
6597
  constructor() {
6415
6598
  super(...arguments);
@@ -6417,7 +6600,7 @@ var HubspotApiError = class extends ApiErrorBase {
6417
6600
  }
6418
6601
  };
6419
6602
  var hubspotClientUrl = `https://api.hubapi.com`;
6420
- var hubspotClientInstance = axios20.create({
6603
+ var hubspotClientInstance = axios22.create({
6421
6604
  headers: {
6422
6605
  "Content-Type": "application/json"
6423
6606
  }
@@ -6426,7 +6609,7 @@ hubspotClientInstance.interceptors.response.use(
6426
6609
  (r) => r,
6427
6610
  (error) => {
6428
6611
  var _a, _b, _c, _d;
6429
- if (axios20.isAxiosError(error)) {
6612
+ if (axios22.isAxiosError(error)) {
6430
6613
  if (((_a = error.response) == null ? void 0 : _a.status) === 401) {
6431
6614
  throw new UnauthorizeApiError("hubspot");
6432
6615
  }
@@ -6478,9 +6661,16 @@ function updateHubspotClient(token) {
6478
6661
  }
6479
6662
  }
6480
6663
 
6664
+ // src/apis/integrations/bigcommerce/webhooks/_contracts/dtos/webhooks.ts
6665
+ var BigCommerceWebhookScopes = /* @__PURE__ */ ((BigCommerceWebhookScopes2) => {
6666
+ BigCommerceWebhookScopes2["OrderCreated"] = "store/order/created";
6667
+ BigCommerceWebhookScopes2["OrderUpdated"] = "store/order/updated";
6668
+ return BigCommerceWebhookScopes2;
6669
+ })(BigCommerceWebhookScopes || {});
6670
+
6481
6671
  // src/apis/platform/billing/instance.ts
6482
- import axios21 from "axios";
6483
- var platformBillingClientInstance = axios21.create({
6672
+ import axios23 from "axios";
6673
+ var platformBillingClientInstance = axios23.create({
6484
6674
  baseURL: "https://billing.labs.livechatinc.com"
6485
6675
  });
6486
6676
  function getPlatformBillingClientAuthorization(req) {
@@ -6530,8 +6720,8 @@ var IntegrationNames = /* @__PURE__ */ ((IntegrationNames2) => {
6530
6720
  IntegrationNames2["Neon"] = "neon";
6531
6721
  IntegrationNames2["Mailchimp"] = "mailchimp";
6532
6722
  IntegrationNames2["Shopify"] = "shopify";
6533
- IntegrationNames2["BigCommerce"] = "bigcommerce";
6534
6723
  IntegrationNames2["HubSpot"] = "hubspot";
6724
+ IntegrationNames2["BigCommerce"] = "bigcommerce";
6535
6725
  IntegrationNames2["Text"] = "text";
6536
6726
  return IntegrationNames2;
6537
6727
  })(IntegrationNames || {});
@@ -6542,7 +6732,7 @@ var IntegrationModes = /* @__PURE__ */ ((IntegrationModes2) => {
6542
6732
  })(IntegrationModes || {});
6543
6733
 
6544
6734
  // src/apis/platform/adapter/integrations/_contracts/requests/events.ts
6545
- import { z as z5 } from "zod";
6735
+ import { z as z6 } from "zod";
6546
6736
 
6547
6737
  // src/apis/platform/adapter/integrations/shopify/_contracts/dtos/events.ts
6548
6738
  var ShopifyEventNames = /* @__PURE__ */ ((ShopifyEventNames2) => {
@@ -6818,36 +7008,108 @@ var hubspotEventsZods = {
6818
7008
  }
6819
7009
  };
6820
7010
 
7011
+ // src/apis/platform/adapter/integrations/bigcommerce/_contracts/requests/events.ts
7012
+ import { z as z5 } from "zod";
7013
+
7014
+ // src/apis/platform/adapter/integrations/bigcommerce/_contracts/dtos/events.ts
7015
+ var BigCommerceEventNames = /* @__PURE__ */ ((BigCommerceEventNames2) => {
7016
+ BigCommerceEventNames2["OrderCreated"] = "order_created";
7017
+ BigCommerceEventNames2["OrderUpdated"] = "order_updated";
7018
+ return BigCommerceEventNames2;
7019
+ })(BigCommerceEventNames || {});
7020
+
7021
+ // src/apis/platform/adapter/integrations/bigcommerce/_contracts/requests/events.ts
7022
+ var bigcommerceEventsZods = {
7023
+ provider: z5.literal("bigcommerce"),
7024
+ eventName: z5.nativeEnum(BigCommerceEventNames),
7025
+ events: {
7026
+ orderCreated: z5.object({
7027
+ name: z5.literal("order_created" /* OrderCreated */)
7028
+ }),
7029
+ orderUpdated: z5.object({
7030
+ name: z5.literal("order_updated" /* OrderUpdated */)
7031
+ })
7032
+ },
7033
+ get event() {
7034
+ return z5.discriminatedUnion("name", [
7035
+ this.events.orderCreated,
7036
+ this.events.orderUpdated
7037
+ ]);
7038
+ },
7039
+ get source() {
7040
+ return z5.object({
7041
+ sourceName: z5.enum(["apps", "workflows"]),
7042
+ sourceKey: z5.string()
7043
+ });
7044
+ },
7045
+ get subscribe() {
7046
+ return this.source.and(
7047
+ z5.object({
7048
+ event: this.event,
7049
+ callback: z5.string()
7050
+ })
7051
+ );
7052
+ },
7053
+ get subscribeContent() {
7054
+ return z5.object({
7055
+ provider: this.provider,
7056
+ event: this.event,
7057
+ callback: z5.string()
7058
+ });
7059
+ },
7060
+ get unsubscribe() {
7061
+ return this.source.and(
7062
+ z5.object({
7063
+ event: this.eventName
7064
+ })
7065
+ );
7066
+ },
7067
+ get unsubscribeContent() {
7068
+ return z5.object({
7069
+ provider: this.provider,
7070
+ event: this.eventName
7071
+ });
7072
+ }
7073
+ };
7074
+
6821
7075
  // src/apis/platform/adapter/integrations/_contracts/requests/events.ts
6822
7076
  var integrationEventsZods = {
6823
- sourceName: z5.enum(["apps", "workflows"]),
6824
- providerName: z5.enum(["text-livechat", "mailchimp", "shopify", "hubspot"]),
7077
+ sourceName: z6.enum(["apps", "workflows"]),
7078
+ providerName: z6.enum([
7079
+ "text-livechat",
7080
+ "mailchimp",
7081
+ "shopify",
7082
+ "hubspot",
7083
+ "bigcommerce"
7084
+ ]),
6825
7085
  get event() {
6826
- return textLivechatEventsZods.event.or(shopifyEventsZods.event).or(mailchimpEventsZods.event).or(hubspotEventsZods.event);
7086
+ return textLivechatEventsZods.event.or(shopifyEventsZods.event).or(mailchimpEventsZods.event).or(hubspotEventsZods.event).or(bigcommerceEventsZods.event);
6827
7087
  },
6828
7088
  get source() {
6829
- return z5.object({
7089
+ return z6.object({
6830
7090
  sourceName: this.sourceName,
6831
- sourceKey: z5.string()
7091
+ sourceKey: z6.string()
6832
7092
  });
6833
7093
  },
6834
7094
  get subscribe() {
6835
7095
  return this.source.and(
6836
- z5.discriminatedUnion("provider", [
7096
+ z6.discriminatedUnion("provider", [
6837
7097
  textLivechatEventsZods.subscribeContent,
6838
7098
  shopifyEventsZods.subscribeContent,
6839
7099
  mailchimpEventsZods.subscribeContent,
6840
- hubspotEventsZods.subscribeContent
7100
+ hubspotEventsZods.subscribeContent,
7101
+ bigcommerceEventsZods.subscribeContent
6841
7102
  ])
6842
7103
  );
6843
7104
  },
6844
7105
  get unsubscribe() {
6845
7106
  return this.source.and(
6846
- z5.discriminatedUnion("provider", [
7107
+ z6.discriminatedUnion("provider", [
6847
7108
  textLivechatEventsZods.unsubscribeContent,
6848
7109
  shopifyEventsZods.unsubscribeContent,
6849
7110
  mailchimpEventsZods.unsubscribeContent,
6850
- hubspotEventsZods.unsubscribeContent
7111
+ hubspotEventsZods.unsubscribeContent,
7112
+ bigcommerceEventsZods.unsubscribeContent
6851
7113
  ])
6852
7114
  );
6853
7115
  }
@@ -6877,6 +7139,54 @@ var WebhookSystemMessages = /* @__PURE__ */ ((WebhookSystemMessages2) => {
6877
7139
  return WebhookSystemMessages2;
6878
7140
  })(WebhookSystemMessages || {});
6879
7141
 
7142
+ // src/apis/platform/adapter/integrations/bigcommerce/api.ts
7143
+ var platformAdapterBigCommerceApi = {
7144
+ events: {
7145
+ subscribe(payload, authorization) {
7146
+ return __async(this, null, function* () {
7147
+ yield platformAdapterClientInstance.post(
7148
+ `/integrations/bigcommerce/events/subscribe`,
7149
+ payload,
7150
+ getBigCommerceClientConfig(authorization)
7151
+ );
7152
+ });
7153
+ },
7154
+ unsubscribe(payload, authorization) {
7155
+ return __async(this, null, function* () {
7156
+ yield platformAdapterClientInstance.post(
7157
+ `/integrations/bigcommerce/events/unsubscribe`,
7158
+ payload,
7159
+ getBigCommerceClientConfig(authorization)
7160
+ );
7161
+ });
7162
+ }
7163
+ }
7164
+ };
7165
+
7166
+ // src/apis/platform/adapter/integrations/hubspot/api.ts
7167
+ var platformAdapterHubspotApi = {
7168
+ events: {
7169
+ subscribe(payload, authorization) {
7170
+ return __async(this, null, function* () {
7171
+ yield platformAdapterClientInstance.post(
7172
+ `/integrations/hubspot/events/subscribe`,
7173
+ payload,
7174
+ getHubspotClientConfig(authorization)
7175
+ );
7176
+ });
7177
+ },
7178
+ unsubscribe(payload, authorization) {
7179
+ return __async(this, null, function* () {
7180
+ yield platformAdapterClientInstance.post(
7181
+ `/integrations/hubspot/events/unsubscribe`,
7182
+ payload,
7183
+ getHubspotClientConfig(authorization)
7184
+ );
7185
+ });
7186
+ }
7187
+ }
7188
+ };
7189
+
6880
7190
  // src/apis/platform/adapter/integrations/mailchimp/api.ts
6881
7191
  var platformAdapterMailchimpApi = {
6882
7192
  events: {
@@ -6983,9 +7293,11 @@ var platformAdapterTextApi = {
6983
7293
  // src/apis/platform/adapter/integrations/api.ts
6984
7294
  var platformAdapterIntegrationsApi = {
6985
7295
  neon: platformAdapterNeonProxyApi,
6986
- text: platformAdapterTextApi,
6987
7296
  mailchimp: platformAdapterMailchimpApi,
6988
- shopify: platformAdapterShopifyApi
7297
+ shopify: platformAdapterShopifyApi,
7298
+ hubspot: platformAdapterHubspotApi,
7299
+ bigcommerce: platformAdapterBigCommerceApi,
7300
+ text: platformAdapterTextApi
6989
7301
  };
6990
7302
 
6991
7303
  // src/apis/platform/adapter/api.ts
@@ -7216,6 +7528,9 @@ export {
7216
7528
  AdapterApiError,
7217
7529
  ApiClient,
7218
7530
  ApiErrorBase,
7531
+ BigCommerceApiError,
7532
+ BigCommerceEventNames,
7533
+ BigCommerceWebhookScopes,
7219
7534
  DpsApiError,
7220
7535
  HubspotApiError,
7221
7536
  HubspotEventNames,
@@ -7241,7 +7556,12 @@ export {
7241
7556
  appRepositoryTemplatesMap,
7242
7557
  appTemplates,
7243
7558
  appTemplatesMap,
7559
+ bigCommerceClientInstance,
7560
+ bigcommerceEventsZods,
7244
7561
  getAppAutoReviewPayload,
7562
+ getBigCommerceClientAuthorization,
7563
+ getBigCommerceClientConfig,
7564
+ getBigCommerceClientUrl,
7245
7565
  getEmptyAppAutoReview,
7246
7566
  getGitHubClientAuthorization,
7247
7567
  getGithubClientConfig,
@@ -7282,6 +7602,7 @@ export {
7282
7602
  hubspotClientUrl,
7283
7603
  hubspotEventsZods,
7284
7604
  initApi,
7605
+ initBigCommerceClient,
7285
7606
  initGithubClient,
7286
7607
  initHubspotClient,
7287
7608
  initLiveChatClient,
@@ -7311,6 +7632,7 @@ export {
7311
7632
  shopifyEventsZods,
7312
7633
  textClientInstance,
7313
7634
  textLivechatEventsZods,
7635
+ updateBigCommerceClient,
7314
7636
  updateGithubClient,
7315
7637
  updateHubspotClient,
7316
7638
  updateMailchimpClient,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@livechat/developer-studio-api",
3
- "version": "3.1.24",
3
+ "version": "3.1.26",
4
4
  "description": "This project is API for LiveChat Developer Studio.",
5
5
  "main": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",
@@ -20,9 +20,9 @@
20
20
  "@types/node": "^17.0.12",
21
21
  "tsup": "^7.1.0",
22
22
  "typescript": "^5.1.6",
23
+ "eslint-config-custom": "0.0.8",
23
24
  "tsconfig": "0.0.1",
24
- "utils": "0.0.4",
25
- "eslint-config-custom": "0.0.8"
25
+ "utils": "0.0.4"
26
26
  },
27
27
  "scripts": {
28
28
  "build": "tsup",