@livechat/developer-studio-api 3.1.25 → 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.js CHANGED
@@ -72,6 +72,9 @@ __export(src_exports, {
72
72
  AdapterApiError: () => AdapterApiError,
73
73
  ApiClient: () => ApiClient,
74
74
  ApiErrorBase: () => ApiErrorBase,
75
+ BigCommerceApiError: () => BigCommerceApiError,
76
+ BigCommerceEventNames: () => BigCommerceEventNames,
77
+ BigCommerceWebhookScopes: () => BigCommerceWebhookScopes,
75
78
  DpsApiError: () => DpsApiError,
76
79
  HubspotApiError: () => HubspotApiError,
77
80
  HubspotEventNames: () => HubspotEventNames,
@@ -97,7 +100,12 @@ __export(src_exports, {
97
100
  appRepositoryTemplatesMap: () => appRepositoryTemplatesMap,
98
101
  appTemplates: () => appTemplates,
99
102
  appTemplatesMap: () => appTemplatesMap,
103
+ bigCommerceClientInstance: () => bigCommerceClientInstance,
104
+ bigcommerceEventsZods: () => bigcommerceEventsZods,
100
105
  getAppAutoReviewPayload: () => getAppAutoReviewPayload,
106
+ getBigCommerceClientAuthorization: () => getBigCommerceClientAuthorization,
107
+ getBigCommerceClientConfig: () => getBigCommerceClientConfig,
108
+ getBigCommerceClientUrl: () => getBigCommerceClientUrl,
101
109
  getEmptyAppAutoReview: () => getEmptyAppAutoReview,
102
110
  getGitHubClientAuthorization: () => getGitHubClientAuthorization,
103
111
  getGithubClientConfig: () => getGithubClientConfig,
@@ -138,6 +146,7 @@ __export(src_exports, {
138
146
  hubspotClientUrl: () => hubspotClientUrl,
139
147
  hubspotEventsZods: () => hubspotEventsZods,
140
148
  initApi: () => initApi,
149
+ initBigCommerceClient: () => initBigCommerceClient,
141
150
  initGithubClient: () => initGithubClient,
142
151
  initHubspotClient: () => initHubspotClient,
143
152
  initLiveChatClient: () => initLiveChatClient,
@@ -167,6 +176,7 @@ __export(src_exports, {
167
176
  shopifyEventsZods: () => shopifyEventsZods,
168
177
  textClientInstance: () => textClientInstance,
169
178
  textLivechatEventsZods: () => textLivechatEventsZods,
179
+ updateBigCommerceClient: () => updateBigCommerceClient,
170
180
  updateGithubClient: () => updateGithubClient,
171
181
  updateHubspotClient: () => updateHubspotClient,
172
182
  updateMailchimpClient: () => updateMailchimpClient,
@@ -3261,6 +3271,156 @@ var hubspotApi = {
3261
3271
  }
3262
3272
  };
3263
3273
 
3274
+ // src/apis/integrations/bigcommerce/api.ts
3275
+ var import_axios20 = __toESM(require("axios"));
3276
+
3277
+ // src/apis/integrations/bigcommerce/instance.ts
3278
+ var import_axios19 = __toESM(require("axios"));
3279
+ var BigCommerceApiError = class extends ApiErrorBase {
3280
+ constructor() {
3281
+ super(...arguments);
3282
+ this.name = "bigcommerce";
3283
+ }
3284
+ };
3285
+ var bigCommerceClientInstance = import_axios19.default.create();
3286
+ bigCommerceClientInstance.interceptors.response.use(
3287
+ (r) => r,
3288
+ (error) => {
3289
+ var _a, _b, _c, _d;
3290
+ if (import_axios19.default.isAxiosError(error)) {
3291
+ if (((_a = error.response) == null ? void 0 : _a.status) === 401) {
3292
+ throw new UnauthorizeApiError("bigcommerce");
3293
+ }
3294
+ }
3295
+ return Promise.reject(
3296
+ new BigCommerceApiError(
3297
+ error.message,
3298
+ (_b = error.response) == null ? void 0 : _b.data,
3299
+ (_d = (_c = error.response) == null ? void 0 : _c.status) != null ? _d : 400
3300
+ )
3301
+ );
3302
+ }
3303
+ );
3304
+ var getBigCommerceClientUrl = (store) => `https://api.bigcommerce.com/stores/${store}/v3`;
3305
+ function getBigCommerceClientAuthorization(req) {
3306
+ if (req.headers instanceof Headers) {
3307
+ return {
3308
+ shop: req.headers.get("x-adapter-bigcommerce-shop"),
3309
+ token: req.headers.get("x-adapter-bigcommerce-token")
3310
+ };
3311
+ }
3312
+ return {
3313
+ shop: req.headers["x-adapter-bigcommerce-shop"],
3314
+ token: req.headers["x-adapter-bigcommerce-token"]
3315
+ };
3316
+ }
3317
+ function getBigCommerceClientConfig(options = {}) {
3318
+ var _a, _b;
3319
+ const currentBaseUrl = bigCommerceClientInstance.defaults.baseURL;
3320
+ const currentHeaders = bigCommerceClientInstance.defaults.headers;
3321
+ const config = {
3322
+ baseUrl: (_a = options.shop ? getBigCommerceClientUrl(options.shop) : void 0) != null ? _a : currentBaseUrl,
3323
+ authorization: (_b = options.token ? options.token : void 0) != null ? _b : currentHeaders["X-Auth-Token"]
3324
+ };
3325
+ if (options.ensureAuthorizationToken && (!config.authorization || !config.baseUrl)) {
3326
+ throw new UnauthorizeApiError("bigcommerce");
3327
+ }
3328
+ return {
3329
+ baseURL: config.baseUrl,
3330
+ headers: __spreadValues({}, config.authorization ? { "X-Auth-Token": config.authorization } : {})
3331
+ };
3332
+ }
3333
+ function initBigCommerceClient(token, shop) {
3334
+ if (token && shop) {
3335
+ updateBigCommerceClient(token);
3336
+ }
3337
+ }
3338
+ function updateBigCommerceClient(token, shop) {
3339
+ const defaults = bigCommerceClientInstance.defaults;
3340
+ const headers = defaults.headers;
3341
+ if (token) {
3342
+ headers.Authorization = `Bearer ${token}`;
3343
+ } else {
3344
+ delete headers.Authorization;
3345
+ }
3346
+ if (shop) {
3347
+ defaults.baseURL = getBigCommerceClientUrl(shop);
3348
+ } else {
3349
+ delete defaults.baseURL;
3350
+ }
3351
+ }
3352
+
3353
+ // src/apis/integrations/bigcommerce/webhooks/api.ts
3354
+ var bigCommerceWebhooksApi = {
3355
+ list(authorization) {
3356
+ return __async(this, null, function* () {
3357
+ const response = yield bigCommerceClientInstance.get(
3358
+ `/hooks`,
3359
+ getBigCommerceClientConfig(__spreadProps(__spreadValues({}, authorization), {
3360
+ ensureAuthorizationToken: true
3361
+ }))
3362
+ );
3363
+ return response.data;
3364
+ });
3365
+ },
3366
+ register(webhook, authorization) {
3367
+ return __async(this, null, function* () {
3368
+ const response = yield bigCommerceClientInstance.post(
3369
+ `/hooks`,
3370
+ webhook,
3371
+ getBigCommerceClientConfig(__spreadProps(__spreadValues({}, authorization), {
3372
+ ensureAuthorizationToken: true
3373
+ }))
3374
+ );
3375
+ return response.data;
3376
+ });
3377
+ },
3378
+ unregister(webhookId, authorization) {
3379
+ return __async(this, null, function* () {
3380
+ yield bigCommerceClientInstance.delete(
3381
+ `/hooks/${encodeURIComponent(webhookId)}`,
3382
+ getBigCommerceClientConfig(__spreadProps(__spreadValues({}, authorization), {
3383
+ ensureAuthorizationToken: true
3384
+ }))
3385
+ );
3386
+ });
3387
+ }
3388
+ };
3389
+
3390
+ // src/apis/integrations/bigcommerce/api.ts
3391
+ var bigcommerceApi = {
3392
+ webhooks: bigCommerceWebhooksApi,
3393
+ getToken(code, clientId, clientSecret, redirectUri, context, scope) {
3394
+ return __async(this, null, function* () {
3395
+ var _a;
3396
+ const data = new URLSearchParams({
3397
+ code,
3398
+ scope,
3399
+ context,
3400
+ client_id: clientId,
3401
+ client_secret: clientSecret,
3402
+ redirect_uri: redirectUri,
3403
+ grant_type: "authorization_code"
3404
+ });
3405
+ const tokenResponse = yield import_axios20.default.post(
3406
+ "https://login.bigcommerce.com/oauth2/token",
3407
+ data,
3408
+ {
3409
+ headers: {
3410
+ "Content-Type": "application/x-www-form-urlencoded"
3411
+ }
3412
+ }
3413
+ );
3414
+ const params = new URLSearchParams(
3415
+ tokenResponse.data
3416
+ );
3417
+ return {
3418
+ token: (_a = params.get("access_token")) != null ? _a : ""
3419
+ };
3420
+ });
3421
+ }
3422
+ };
3423
+
3264
3424
  // src/apis/integrations/api.ts
3265
3425
  var integrationsApi = {
3266
3426
  github: gitHubApi,
@@ -3271,11 +3431,12 @@ var integrationsApi = {
3271
3431
  neon: neonApi,
3272
3432
  planetscale: planetscaleApi,
3273
3433
  hubspot: hubspotApi,
3434
+ bigommerce: bigcommerceApi,
3274
3435
  text: textApi
3275
3436
  };
3276
3437
 
3277
3438
  // src/apis/products/livechat/instance.ts
3278
- var import_axios19 = __toESM(require("axios"));
3439
+ var import_axios21 = __toESM(require("axios"));
3279
3440
  var REGION = {
3280
3441
  FRA: "fra",
3281
3442
  DAL: "dal",
@@ -3295,7 +3456,7 @@ var LivechatApiError = class extends ApiErrorBase {
3295
3456
  this.name = "livechat";
3296
3457
  }
3297
3458
  };
3298
- var livechatClientInstance = import_axios19.default.create({
3459
+ var livechatClientInstance = import_axios21.default.create({
3299
3460
  baseURL: "https://api.labs.livechatinc.com"
3300
3461
  });
3301
3462
  livechatClientInstance.interceptors.response.use(
@@ -4190,14 +4351,14 @@ var platformAccountsApi = {
4190
4351
  };
4191
4352
 
4192
4353
  // src/apis/platform/dps/instance.ts
4193
- var import_axios20 = __toESM(require("axios"));
4354
+ var import_axios22 = __toESM(require("axios"));
4194
4355
  var DpsApiError = class extends ApiErrorBase {
4195
4356
  constructor() {
4196
4357
  super(...arguments);
4197
4358
  this.name = "dps";
4198
4359
  }
4199
4360
  };
4200
- var platformDpsClientInstance = import_axios20.default.create({
4361
+ var platformDpsClientInstance = import_axios22.default.create({
4201
4362
  baseURL: "https://dev-platform.labs.livechatinc.com"
4202
4363
  });
4203
4364
  platformDpsClientInstance.interceptors.response.use(
@@ -5800,7 +5961,7 @@ var platformDpsApi = {
5800
5961
  };
5801
5962
 
5802
5963
  // src/apis/platform/adapter/instance.ts
5803
- var import_axios21 = __toESM(require("axios"));
5964
+ var import_axios23 = __toESM(require("axios"));
5804
5965
  var REGION2 = {
5805
5966
  FRA: "fra",
5806
5967
  DAL: "dal",
@@ -5830,7 +5991,7 @@ var AdapterApiError = class _AdapterApiError extends ApiErrorBase {
5830
5991
  );
5831
5992
  }
5832
5993
  };
5833
- var platformAdapterClientInstance = import_axios21.default.create({
5994
+ var platformAdapterClientInstance = import_axios23.default.create({
5834
5995
  baseURL: "https://platform.labs.text.com/console-adapter/api",
5835
5996
  headers: {
5836
5997
  "Content-Type": "application/json"
@@ -5885,6 +6046,10 @@ function getPlatformAdapterClientAuthorization(req) {
5885
6046
  hubspot: {
5886
6047
  token: req.headers.get("x-adapter-hubspot-token")
5887
6048
  },
6049
+ bigcommerce: {
6050
+ token: req.headers.get("x-adapter-bigcommerce-token"),
6051
+ shop: req.headers.get("x-adapter-bigcommerce-shop")
6052
+ },
5888
6053
  text: {
5889
6054
  token: req.headers.get("x-adapter-text-token")
5890
6055
  }
@@ -5921,13 +6086,17 @@ function getPlatformAdapterClientAuthorization(req) {
5921
6086
  hubspot: {
5922
6087
  token: req.headers["x-adapter-hubspot-token"]
5923
6088
  },
6089
+ bigcommerce: {
6090
+ token: req.headers["x-adapter-bigcommerce-token"],
6091
+ shop: req.headers["x-adapter-bigcommerce-shop"]
6092
+ },
5924
6093
  text: {
5925
6094
  token: req.headers["x-adapter-text-token"]
5926
6095
  }
5927
6096
  };
5928
6097
  }
5929
6098
  function getPlatformAdapterClientConfig(options = {}) {
5930
- 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;
6099
+ 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;
5931
6100
  const currentHeaders = platformAdapterClientInstance.defaults.headers;
5932
6101
  const headers = {
5933
6102
  platform: {
@@ -5947,44 +6116,49 @@ function getPlatformAdapterClientConfig(options = {}) {
5947
6116
  shopify: (_t = currentHeaders["x-adapter-shopify-token"]) != null ? _t : (_s = options.shopify) == null ? void 0 : _s.token,
5948
6117
  shopifyShop: (_v = currentHeaders["x-adapter-shopify-shop"]) != null ? _v : (_u = options.shopify) == null ? void 0 : _u.shop,
5949
6118
  hubspot: (_x = currentHeaders["x-adapter-hubspot-token"]) != null ? _x : (_w = options.hubspot) == null ? void 0 : _w.token,
5950
- text: (_z = currentHeaders["x-adapter-text-token"]) != null ? _z : (_y = options.text) == null ? void 0 : _y.token
6119
+ bigcommerce: (_z = currentHeaders["x-adapter-bigcommerce-token"]) != null ? _z : (_y = options.bigcommerce) == null ? void 0 : _y.token,
6120
+ bigcommerceShop: (_B = currentHeaders["x-adapter-bigcommerce-shop"]) != null ? _B : (_A = options.bigcommerce) == null ? void 0 : _A.shop,
6121
+ text: (_D = currentHeaders["x-adapter-text-token"]) != null ? _D : (_C = options.text) == null ? void 0 : _C.token
5951
6122
  }
5952
6123
  };
5953
6124
  if (currentHeaders["x-adapter-platform-token"]) {
5954
- currentHeaders["X-Region"] = (_A = getRegion2(currentHeaders["x-adapter-platform-token"])) != null ? _A : void 0;
6125
+ currentHeaders["X-Region"] = (_E = getRegion2(currentHeaders["x-adapter-platform-token"])) != null ? _E : void 0;
5955
6126
  }
5956
- if (((_B = options.ensureAuthorizationToken) == null ? void 0 : _B.platform) && !headers.platform.token) {
6127
+ if (((_F = options.ensureAuthorizationToken) == null ? void 0 : _F.platform) && !headers.platform.token) {
5957
6128
  throw new UnauthorizeApiError("accounts");
5958
6129
  }
5959
- if (((_C = options.ensureAuthorizationToken) == null ? void 0 : _C.github) && (!headers.integrations.github.app || !headers.integrations.github.oauth)) {
6130
+ if (((_G = options.ensureAuthorizationToken) == null ? void 0 : _G.github) && (!headers.integrations.github.app || !headers.integrations.github.oauth)) {
5960
6131
  throw new UnauthorizeApiError("github");
5961
6132
  }
5962
- if (((_D = options.ensureAuthorizationToken) == null ? void 0 : _D.vercel) && !headers.integrations.vercel) {
6133
+ if (((_H = options.ensureAuthorizationToken) == null ? void 0 : _H.vercel) && !headers.integrations.vercel) {
5963
6134
  throw new UnauthorizeApiError("vercel");
5964
6135
  }
5965
- if (((_E = options.ensureAuthorizationToken) == null ? void 0 : _E.netlify) && !headers.integrations.netlify) {
6136
+ if (((_I = options.ensureAuthorizationToken) == null ? void 0 : _I.netlify) && !headers.integrations.netlify) {
5966
6137
  throw new UnauthorizeApiError("netlify");
5967
6138
  }
5968
- if (((_F = options.ensureAuthorizationToken) == null ? void 0 : _F.planetscale) && !headers.integrations.planetscale) {
6139
+ if (((_J = options.ensureAuthorizationToken) == null ? void 0 : _J.planetscale) && !headers.integrations.planetscale) {
5969
6140
  throw new UnauthorizeApiError("planetscale");
5970
6141
  }
5971
- if (((_G = options.ensureAuthorizationToken) == null ? void 0 : _G.neon) && !headers.integrations.neon) {
6142
+ if (((_K = options.ensureAuthorizationToken) == null ? void 0 : _K.neon) && !headers.integrations.neon) {
5972
6143
  throw new UnauthorizeApiError("neon");
5973
6144
  }
5974
- if (((_H = options.ensureAuthorizationToken) == null ? void 0 : _H.mailchimp) && (!headers.integrations.mailchimp || !headers.integrations.mailchimpServer)) {
6145
+ if (((_L = options.ensureAuthorizationToken) == null ? void 0 : _L.mailchimp) && (!headers.integrations.mailchimp || !headers.integrations.mailchimpServer)) {
5975
6146
  throw new UnauthorizeApiError("mailchimp");
5976
6147
  }
5977
- if (((_I = options.ensureAuthorizationToken) == null ? void 0 : _I.shopify) && (!headers.integrations.shopify || !headers.integrations.shopifyShop)) {
6148
+ if (((_M = options.ensureAuthorizationToken) == null ? void 0 : _M.shopify) && (!headers.integrations.shopify || !headers.integrations.shopifyShop)) {
5978
6149
  throw new UnauthorizeApiError("shopify");
5979
6150
  }
5980
- if (((_J = options.ensureAuthorizationToken) == null ? void 0 : _J.hubspot) && !headers.integrations.hubspot) {
6151
+ if (((_N = options.ensureAuthorizationToken) == null ? void 0 : _N.hubspot) && !headers.integrations.hubspot) {
5981
6152
  throw new UnauthorizeApiError("hubspot");
5982
6153
  }
5983
- if (((_K = options.ensureAuthorizationToken) == null ? void 0 : _K.text) && !headers.integrations.text) {
6154
+ if (((_O = options.ensureAuthorizationToken) == null ? void 0 : _O.bigcommerce) && (!headers.integrations.bigcommerce || !headers.integrations.bigcommerceShop)) {
6155
+ throw new UnauthorizeApiError("bigcommerce");
6156
+ }
6157
+ if (((_P = options.ensureAuthorizationToken) == null ? void 0 : _P.text) && !headers.integrations.text) {
5984
6158
  throw new UnauthorizeApiError("text");
5985
6159
  }
5986
6160
  return {
5987
- headers: __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.text ? { "x-adapter-text-token": headers.integrations.text } : {})
6161
+ 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 } : {})
5988
6162
  };
5989
6163
  }
5990
6164
  var getPlatformAdapterClientDefaultConfig = (authorization) => getPlatformAdapterClientConfig(__spreadProps(__spreadValues({}, authorization), {
@@ -6007,7 +6181,7 @@ function initPlatformAdapterClient(baseUrl, tokens) {
6007
6181
  }
6008
6182
  }
6009
6183
  function updatePlatformAdapterClient(tokens) {
6010
- var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m;
6184
+ var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o;
6011
6185
  const headers = platformAdapterClientInstance.defaults.headers;
6012
6186
  if ((_a = tokens == null ? void 0 : tokens.platform) == null ? void 0 : _a.token) {
6013
6187
  headers["x-adapter-platform-token"] = tokens.platform.token;
@@ -6045,7 +6219,13 @@ function updatePlatformAdapterClient(tokens) {
6045
6219
  if ((_l = tokens == null ? void 0 : tokens.hubspot) == null ? void 0 : _l.token) {
6046
6220
  headers["x-adapter-hubspot-token"] = tokens.hubspot.token;
6047
6221
  }
6048
- if ((_m = tokens == null ? void 0 : tokens.text) == null ? void 0 : _m.token) {
6222
+ if ((_m = tokens == null ? void 0 : tokens.bigcommerce) == null ? void 0 : _m.shop) {
6223
+ headers["x-adapter-bigcommerce-shop"] = tokens.bigcommerce.shop;
6224
+ }
6225
+ if ((_n = tokens == null ? void 0 : tokens.bigcommerce) == null ? void 0 : _n.token) {
6226
+ headers["x-adapter-bigcommerce-token"] = tokens.bigcommerce.token;
6227
+ }
6228
+ if ((_o = tokens == null ? void 0 : tokens.text) == null ? void 0 : _o.token) {
6049
6229
  headers["x-adapter-text-token"] = tokens.text.token;
6050
6230
  }
6051
6231
  }
@@ -6565,7 +6745,7 @@ var WorkflowDefinitionTaskType = {
6565
6745
  };
6566
6746
 
6567
6747
  // src/apis/integrations/hubspot/instance.ts
6568
- var import_axios22 = __toESM(require("axios"));
6748
+ var import_axios24 = __toESM(require("axios"));
6569
6749
  var HubspotApiError = class extends ApiErrorBase {
6570
6750
  constructor() {
6571
6751
  super(...arguments);
@@ -6573,7 +6753,7 @@ var HubspotApiError = class extends ApiErrorBase {
6573
6753
  }
6574
6754
  };
6575
6755
  var hubspotClientUrl = `https://api.hubapi.com`;
6576
- var hubspotClientInstance = import_axios22.default.create({
6756
+ var hubspotClientInstance = import_axios24.default.create({
6577
6757
  headers: {
6578
6758
  "Content-Type": "application/json"
6579
6759
  }
@@ -6582,7 +6762,7 @@ hubspotClientInstance.interceptors.response.use(
6582
6762
  (r) => r,
6583
6763
  (error) => {
6584
6764
  var _a, _b, _c, _d;
6585
- if (import_axios22.default.isAxiosError(error)) {
6765
+ if (import_axios24.default.isAxiosError(error)) {
6586
6766
  if (((_a = error.response) == null ? void 0 : _a.status) === 401) {
6587
6767
  throw new UnauthorizeApiError("hubspot");
6588
6768
  }
@@ -6634,9 +6814,16 @@ function updateHubspotClient(token) {
6634
6814
  }
6635
6815
  }
6636
6816
 
6817
+ // src/apis/integrations/bigcommerce/webhooks/_contracts/dtos/webhooks.ts
6818
+ var BigCommerceWebhookScopes = /* @__PURE__ */ ((BigCommerceWebhookScopes2) => {
6819
+ BigCommerceWebhookScopes2["OrderCreated"] = "store/order/created";
6820
+ BigCommerceWebhookScopes2["OrderUpdated"] = "store/order/updated";
6821
+ return BigCommerceWebhookScopes2;
6822
+ })(BigCommerceWebhookScopes || {});
6823
+
6637
6824
  // src/apis/platform/billing/instance.ts
6638
- var import_axios23 = __toESM(require("axios"));
6639
- var platformBillingClientInstance = import_axios23.default.create({
6825
+ var import_axios25 = __toESM(require("axios"));
6826
+ var platformBillingClientInstance = import_axios25.default.create({
6640
6827
  baseURL: "https://billing.labs.livechatinc.com"
6641
6828
  });
6642
6829
  function getPlatformBillingClientAuthorization(req) {
@@ -6686,8 +6873,8 @@ var IntegrationNames = /* @__PURE__ */ ((IntegrationNames2) => {
6686
6873
  IntegrationNames2["Neon"] = "neon";
6687
6874
  IntegrationNames2["Mailchimp"] = "mailchimp";
6688
6875
  IntegrationNames2["Shopify"] = "shopify";
6689
- IntegrationNames2["BigCommerce"] = "bigcommerce";
6690
6876
  IntegrationNames2["HubSpot"] = "hubspot";
6877
+ IntegrationNames2["BigCommerce"] = "bigcommerce";
6691
6878
  IntegrationNames2["Text"] = "text";
6692
6879
  return IntegrationNames2;
6693
6880
  })(IntegrationNames || {});
@@ -6698,7 +6885,7 @@ var IntegrationModes = /* @__PURE__ */ ((IntegrationModes2) => {
6698
6885
  })(IntegrationModes || {});
6699
6886
 
6700
6887
  // src/apis/platform/adapter/integrations/_contracts/requests/events.ts
6701
- var import_zod5 = require("zod");
6888
+ var import_zod6 = require("zod");
6702
6889
 
6703
6890
  // src/apis/platform/adapter/integrations/shopify/_contracts/dtos/events.ts
6704
6891
  var ShopifyEventNames = /* @__PURE__ */ ((ShopifyEventNames2) => {
@@ -6974,36 +7161,108 @@ var hubspotEventsZods = {
6974
7161
  }
6975
7162
  };
6976
7163
 
7164
+ // src/apis/platform/adapter/integrations/bigcommerce/_contracts/requests/events.ts
7165
+ var import_zod5 = require("zod");
7166
+
7167
+ // src/apis/platform/adapter/integrations/bigcommerce/_contracts/dtos/events.ts
7168
+ var BigCommerceEventNames = /* @__PURE__ */ ((BigCommerceEventNames2) => {
7169
+ BigCommerceEventNames2["OrderCreated"] = "order_created";
7170
+ BigCommerceEventNames2["OrderUpdated"] = "order_updated";
7171
+ return BigCommerceEventNames2;
7172
+ })(BigCommerceEventNames || {});
7173
+
7174
+ // src/apis/platform/adapter/integrations/bigcommerce/_contracts/requests/events.ts
7175
+ var bigcommerceEventsZods = {
7176
+ provider: import_zod5.z.literal("bigcommerce"),
7177
+ eventName: import_zod5.z.nativeEnum(BigCommerceEventNames),
7178
+ events: {
7179
+ orderCreated: import_zod5.z.object({
7180
+ name: import_zod5.z.literal("order_created" /* OrderCreated */)
7181
+ }),
7182
+ orderUpdated: import_zod5.z.object({
7183
+ name: import_zod5.z.literal("order_updated" /* OrderUpdated */)
7184
+ })
7185
+ },
7186
+ get event() {
7187
+ return import_zod5.z.discriminatedUnion("name", [
7188
+ this.events.orderCreated,
7189
+ this.events.orderUpdated
7190
+ ]);
7191
+ },
7192
+ get source() {
7193
+ return import_zod5.z.object({
7194
+ sourceName: import_zod5.z.enum(["apps", "workflows"]),
7195
+ sourceKey: import_zod5.z.string()
7196
+ });
7197
+ },
7198
+ get subscribe() {
7199
+ return this.source.and(
7200
+ import_zod5.z.object({
7201
+ event: this.event,
7202
+ callback: import_zod5.z.string()
7203
+ })
7204
+ );
7205
+ },
7206
+ get subscribeContent() {
7207
+ return import_zod5.z.object({
7208
+ provider: this.provider,
7209
+ event: this.event,
7210
+ callback: import_zod5.z.string()
7211
+ });
7212
+ },
7213
+ get unsubscribe() {
7214
+ return this.source.and(
7215
+ import_zod5.z.object({
7216
+ event: this.eventName
7217
+ })
7218
+ );
7219
+ },
7220
+ get unsubscribeContent() {
7221
+ return import_zod5.z.object({
7222
+ provider: this.provider,
7223
+ event: this.eventName
7224
+ });
7225
+ }
7226
+ };
7227
+
6977
7228
  // src/apis/platform/adapter/integrations/_contracts/requests/events.ts
6978
7229
  var integrationEventsZods = {
6979
- sourceName: import_zod5.z.enum(["apps", "workflows"]),
6980
- providerName: import_zod5.z.enum(["text-livechat", "mailchimp", "shopify", "hubspot"]),
7230
+ sourceName: import_zod6.z.enum(["apps", "workflows"]),
7231
+ providerName: import_zod6.z.enum([
7232
+ "text-livechat",
7233
+ "mailchimp",
7234
+ "shopify",
7235
+ "hubspot",
7236
+ "bigcommerce"
7237
+ ]),
6981
7238
  get event() {
6982
- return textLivechatEventsZods.event.or(shopifyEventsZods.event).or(mailchimpEventsZods.event).or(hubspotEventsZods.event);
7239
+ return textLivechatEventsZods.event.or(shopifyEventsZods.event).or(mailchimpEventsZods.event).or(hubspotEventsZods.event).or(bigcommerceEventsZods.event);
6983
7240
  },
6984
7241
  get source() {
6985
- return import_zod5.z.object({
7242
+ return import_zod6.z.object({
6986
7243
  sourceName: this.sourceName,
6987
- sourceKey: import_zod5.z.string()
7244
+ sourceKey: import_zod6.z.string()
6988
7245
  });
6989
7246
  },
6990
7247
  get subscribe() {
6991
7248
  return this.source.and(
6992
- import_zod5.z.discriminatedUnion("provider", [
7249
+ import_zod6.z.discriminatedUnion("provider", [
6993
7250
  textLivechatEventsZods.subscribeContent,
6994
7251
  shopifyEventsZods.subscribeContent,
6995
7252
  mailchimpEventsZods.subscribeContent,
6996
- hubspotEventsZods.subscribeContent
7253
+ hubspotEventsZods.subscribeContent,
7254
+ bigcommerceEventsZods.subscribeContent
6997
7255
  ])
6998
7256
  );
6999
7257
  },
7000
7258
  get unsubscribe() {
7001
7259
  return this.source.and(
7002
- import_zod5.z.discriminatedUnion("provider", [
7260
+ import_zod6.z.discriminatedUnion("provider", [
7003
7261
  textLivechatEventsZods.unsubscribeContent,
7004
7262
  shopifyEventsZods.unsubscribeContent,
7005
7263
  mailchimpEventsZods.unsubscribeContent,
7006
- hubspotEventsZods.unsubscribeContent
7264
+ hubspotEventsZods.unsubscribeContent,
7265
+ bigcommerceEventsZods.unsubscribeContent
7007
7266
  ])
7008
7267
  );
7009
7268
  }
@@ -7033,6 +7292,54 @@ var WebhookSystemMessages = /* @__PURE__ */ ((WebhookSystemMessages2) => {
7033
7292
  return WebhookSystemMessages2;
7034
7293
  })(WebhookSystemMessages || {});
7035
7294
 
7295
+ // src/apis/platform/adapter/integrations/bigcommerce/api.ts
7296
+ var platformAdapterBigCommerceApi = {
7297
+ events: {
7298
+ subscribe(payload, authorization) {
7299
+ return __async(this, null, function* () {
7300
+ yield platformAdapterClientInstance.post(
7301
+ `/integrations/bigcommerce/events/subscribe`,
7302
+ payload,
7303
+ getBigCommerceClientConfig(authorization)
7304
+ );
7305
+ });
7306
+ },
7307
+ unsubscribe(payload, authorization) {
7308
+ return __async(this, null, function* () {
7309
+ yield platformAdapterClientInstance.post(
7310
+ `/integrations/bigcommerce/events/unsubscribe`,
7311
+ payload,
7312
+ getBigCommerceClientConfig(authorization)
7313
+ );
7314
+ });
7315
+ }
7316
+ }
7317
+ };
7318
+
7319
+ // src/apis/platform/adapter/integrations/hubspot/api.ts
7320
+ var platformAdapterHubspotApi = {
7321
+ events: {
7322
+ subscribe(payload, authorization) {
7323
+ return __async(this, null, function* () {
7324
+ yield platformAdapterClientInstance.post(
7325
+ `/integrations/hubspot/events/subscribe`,
7326
+ payload,
7327
+ getHubspotClientConfig(authorization)
7328
+ );
7329
+ });
7330
+ },
7331
+ unsubscribe(payload, authorization) {
7332
+ return __async(this, null, function* () {
7333
+ yield platformAdapterClientInstance.post(
7334
+ `/integrations/hubspot/events/unsubscribe`,
7335
+ payload,
7336
+ getHubspotClientConfig(authorization)
7337
+ );
7338
+ });
7339
+ }
7340
+ }
7341
+ };
7342
+
7036
7343
  // src/apis/platform/adapter/integrations/mailchimp/api.ts
7037
7344
  var platformAdapterMailchimpApi = {
7038
7345
  events: {
@@ -7139,9 +7446,11 @@ var platformAdapterTextApi = {
7139
7446
  // src/apis/platform/adapter/integrations/api.ts
7140
7447
  var platformAdapterIntegrationsApi = {
7141
7448
  neon: platformAdapterNeonProxyApi,
7142
- text: platformAdapterTextApi,
7143
7449
  mailchimp: platformAdapterMailchimpApi,
7144
- shopify: platformAdapterShopifyApi
7450
+ shopify: platformAdapterShopifyApi,
7451
+ hubspot: platformAdapterHubspotApi,
7452
+ bigcommerce: platformAdapterBigCommerceApi,
7453
+ text: platformAdapterTextApi
7145
7454
  };
7146
7455
 
7147
7456
  // src/apis/platform/adapter/api.ts
@@ -7373,6 +7682,9 @@ function getIntegrationFlowUrl(name, flow, trigger, context, state, config) {
7373
7682
  AdapterApiError,
7374
7683
  ApiClient,
7375
7684
  ApiErrorBase,
7685
+ BigCommerceApiError,
7686
+ BigCommerceEventNames,
7687
+ BigCommerceWebhookScopes,
7376
7688
  DpsApiError,
7377
7689
  HubspotApiError,
7378
7690
  HubspotEventNames,
@@ -7398,7 +7710,12 @@ function getIntegrationFlowUrl(name, flow, trigger, context, state, config) {
7398
7710
  appRepositoryTemplatesMap,
7399
7711
  appTemplates,
7400
7712
  appTemplatesMap,
7713
+ bigCommerceClientInstance,
7714
+ bigcommerceEventsZods,
7401
7715
  getAppAutoReviewPayload,
7716
+ getBigCommerceClientAuthorization,
7717
+ getBigCommerceClientConfig,
7718
+ getBigCommerceClientUrl,
7402
7719
  getEmptyAppAutoReview,
7403
7720
  getGitHubClientAuthorization,
7404
7721
  getGithubClientConfig,
@@ -7439,6 +7756,7 @@ function getIntegrationFlowUrl(name, flow, trigger, context, state, config) {
7439
7756
  hubspotClientUrl,
7440
7757
  hubspotEventsZods,
7441
7758
  initApi,
7759
+ initBigCommerceClient,
7442
7760
  initGithubClient,
7443
7761
  initHubspotClient,
7444
7762
  initLiveChatClient,
@@ -7468,6 +7786,7 @@ function getIntegrationFlowUrl(name, flow, trigger, context, state, config) {
7468
7786
  shopifyEventsZods,
7469
7787
  textClientInstance,
7470
7788
  textLivechatEventsZods,
7789
+ updateBigCommerceClient,
7471
7790
  updateGithubClient,
7472
7791
  updateHubspotClient,
7473
7792
  updateMailchimpClient,