@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.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"
@@ -5882,6 +6043,13 @@ function getPlatformAdapterClientAuthorization(req) {
5882
6043
  token: req.headers.get("x-adapter-shopify-token"),
5883
6044
  shop: req.headers.get("x-adapter-shopify-shop")
5884
6045
  },
6046
+ hubspot: {
6047
+ token: req.headers.get("x-adapter-hubspot-token")
6048
+ },
6049
+ bigcommerce: {
6050
+ token: req.headers.get("x-adapter-bigcommerce-token"),
6051
+ shop: req.headers.get("x-adapter-bigcommerce-shop")
6052
+ },
5885
6053
  text: {
5886
6054
  token: req.headers.get("x-adapter-text-token")
5887
6055
  }
@@ -5915,13 +6083,20 @@ function getPlatformAdapterClientAuthorization(req) {
5915
6083
  token: req.headers["x-adapter-shopify-token"],
5916
6084
  shop: req.headers["x-adapter-shopify-shop"]
5917
6085
  },
6086
+ hubspot: {
6087
+ token: req.headers["x-adapter-hubspot-token"]
6088
+ },
6089
+ bigcommerce: {
6090
+ token: req.headers["x-adapter-bigcommerce-token"],
6091
+ shop: req.headers["x-adapter-bigcommerce-shop"]
6092
+ },
5918
6093
  text: {
5919
6094
  token: req.headers["x-adapter-text-token"]
5920
6095
  }
5921
6096
  };
5922
6097
  }
5923
6098
  function getPlatformAdapterClientConfig(options = {}) {
5924
- 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;
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;
5925
6100
  const currentHeaders = platformAdapterClientInstance.defaults.headers;
5926
6101
  const headers = {
5927
6102
  platform: {
@@ -5940,41 +6115,50 @@ function getPlatformAdapterClientConfig(options = {}) {
5940
6115
  mailchimpServer: (_r = currentHeaders["x-adapter-mailchimp-server"]) != null ? _r : (_q = options.mailchimp) == null ? void 0 : _q.server,
5941
6116
  shopify: (_t = currentHeaders["x-adapter-shopify-token"]) != null ? _t : (_s = options.shopify) == null ? void 0 : _s.token,
5942
6117
  shopifyShop: (_v = currentHeaders["x-adapter-shopify-shop"]) != null ? _v : (_u = options.shopify) == null ? void 0 : _u.shop,
5943
- text: (_x = currentHeaders["x-adapter-text-token"]) != null ? _x : (_w = options.text) == null ? void 0 : _w.token
6118
+ hubspot: (_x = currentHeaders["x-adapter-hubspot-token"]) != null ? _x : (_w = options.hubspot) == null ? void 0 : _w.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
5944
6122
  }
5945
6123
  };
5946
6124
  if (currentHeaders["x-adapter-platform-token"]) {
5947
- currentHeaders["X-Region"] = (_y = getRegion2(currentHeaders["x-adapter-platform-token"])) != null ? _y : void 0;
6125
+ currentHeaders["X-Region"] = (_E = getRegion2(currentHeaders["x-adapter-platform-token"])) != null ? _E : void 0;
5948
6126
  }
5949
- if (((_z = options.ensureAuthorizationToken) == null ? void 0 : _z.platform) && !headers.platform.token) {
6127
+ if (((_F = options.ensureAuthorizationToken) == null ? void 0 : _F.platform) && !headers.platform.token) {
5950
6128
  throw new UnauthorizeApiError("accounts");
5951
6129
  }
5952
- if (((_A = options.ensureAuthorizationToken) == null ? void 0 : _A.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)) {
5953
6131
  throw new UnauthorizeApiError("github");
5954
6132
  }
5955
- if (((_B = options.ensureAuthorizationToken) == null ? void 0 : _B.vercel) && !headers.integrations.vercel) {
6133
+ if (((_H = options.ensureAuthorizationToken) == null ? void 0 : _H.vercel) && !headers.integrations.vercel) {
5956
6134
  throw new UnauthorizeApiError("vercel");
5957
6135
  }
5958
- if (((_C = options.ensureAuthorizationToken) == null ? void 0 : _C.netlify) && !headers.integrations.netlify) {
6136
+ if (((_I = options.ensureAuthorizationToken) == null ? void 0 : _I.netlify) && !headers.integrations.netlify) {
5959
6137
  throw new UnauthorizeApiError("netlify");
5960
6138
  }
5961
- if (((_D = options.ensureAuthorizationToken) == null ? void 0 : _D.planetscale) && !headers.integrations.planetscale) {
6139
+ if (((_J = options.ensureAuthorizationToken) == null ? void 0 : _J.planetscale) && !headers.integrations.planetscale) {
5962
6140
  throw new UnauthorizeApiError("planetscale");
5963
6141
  }
5964
- if (((_E = options.ensureAuthorizationToken) == null ? void 0 : _E.neon) && !headers.integrations.neon) {
6142
+ if (((_K = options.ensureAuthorizationToken) == null ? void 0 : _K.neon) && !headers.integrations.neon) {
5965
6143
  throw new UnauthorizeApiError("neon");
5966
6144
  }
5967
- if (((_F = options.ensureAuthorizationToken) == null ? void 0 : _F.mailchimp) && (!headers.integrations.mailchimp || !headers.integrations.mailchimpServer)) {
6145
+ if (((_L = options.ensureAuthorizationToken) == null ? void 0 : _L.mailchimp) && (!headers.integrations.mailchimp || !headers.integrations.mailchimpServer)) {
5968
6146
  throw new UnauthorizeApiError("mailchimp");
5969
6147
  }
5970
- if (((_G = options.ensureAuthorizationToken) == null ? void 0 : _G.shopify) && (!headers.integrations.shopify || !headers.integrations.shopifyShop)) {
6148
+ if (((_M = options.ensureAuthorizationToken) == null ? void 0 : _M.shopify) && (!headers.integrations.shopify || !headers.integrations.shopifyShop)) {
5971
6149
  throw new UnauthorizeApiError("shopify");
5972
6150
  }
5973
- if (((_H = options.ensureAuthorizationToken) == null ? void 0 : _H.text) && !headers.integrations.text) {
6151
+ if (((_N = options.ensureAuthorizationToken) == null ? void 0 : _N.hubspot) && !headers.integrations.hubspot) {
6152
+ throw new UnauthorizeApiError("hubspot");
6153
+ }
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) {
5974
6158
  throw new UnauthorizeApiError("text");
5975
6159
  }
5976
6160
  return {
5977
- 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 } : {})
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 } : {})
5978
6162
  };
5979
6163
  }
5980
6164
  var getPlatformAdapterClientDefaultConfig = (authorization) => getPlatformAdapterClientConfig(__spreadProps(__spreadValues({}, authorization), {
@@ -5997,7 +6181,7 @@ function initPlatformAdapterClient(baseUrl, tokens) {
5997
6181
  }
5998
6182
  }
5999
6183
  function updatePlatformAdapterClient(tokens) {
6000
- var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l;
6184
+ var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o;
6001
6185
  const headers = platformAdapterClientInstance.defaults.headers;
6002
6186
  if ((_a = tokens == null ? void 0 : tokens.platform) == null ? void 0 : _a.token) {
6003
6187
  headers["x-adapter-platform-token"] = tokens.platform.token;
@@ -6032,7 +6216,16 @@ function updatePlatformAdapterClient(tokens) {
6032
6216
  if ((_k = tokens == null ? void 0 : tokens.shopify) == null ? void 0 : _k.token) {
6033
6217
  headers["x-adapter-shopify-token"] = tokens.shopify.token;
6034
6218
  }
6035
- if ((_l = tokens == null ? void 0 : tokens.text) == null ? void 0 : _l.token) {
6219
+ if ((_l = tokens == null ? void 0 : tokens.hubspot) == null ? void 0 : _l.token) {
6220
+ headers["x-adapter-hubspot-token"] = tokens.hubspot.token;
6221
+ }
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) {
6036
6229
  headers["x-adapter-text-token"] = tokens.text.token;
6037
6230
  }
6038
6231
  }
@@ -6552,7 +6745,7 @@ var WorkflowDefinitionTaskType = {
6552
6745
  };
6553
6746
 
6554
6747
  // src/apis/integrations/hubspot/instance.ts
6555
- var import_axios22 = __toESM(require("axios"));
6748
+ var import_axios24 = __toESM(require("axios"));
6556
6749
  var HubspotApiError = class extends ApiErrorBase {
6557
6750
  constructor() {
6558
6751
  super(...arguments);
@@ -6560,7 +6753,7 @@ var HubspotApiError = class extends ApiErrorBase {
6560
6753
  }
6561
6754
  };
6562
6755
  var hubspotClientUrl = `https://api.hubapi.com`;
6563
- var hubspotClientInstance = import_axios22.default.create({
6756
+ var hubspotClientInstance = import_axios24.default.create({
6564
6757
  headers: {
6565
6758
  "Content-Type": "application/json"
6566
6759
  }
@@ -6569,7 +6762,7 @@ hubspotClientInstance.interceptors.response.use(
6569
6762
  (r) => r,
6570
6763
  (error) => {
6571
6764
  var _a, _b, _c, _d;
6572
- if (import_axios22.default.isAxiosError(error)) {
6765
+ if (import_axios24.default.isAxiosError(error)) {
6573
6766
  if (((_a = error.response) == null ? void 0 : _a.status) === 401) {
6574
6767
  throw new UnauthorizeApiError("hubspot");
6575
6768
  }
@@ -6621,9 +6814,16 @@ function updateHubspotClient(token) {
6621
6814
  }
6622
6815
  }
6623
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
+
6624
6824
  // src/apis/platform/billing/instance.ts
6625
- var import_axios23 = __toESM(require("axios"));
6626
- var platformBillingClientInstance = import_axios23.default.create({
6825
+ var import_axios25 = __toESM(require("axios"));
6826
+ var platformBillingClientInstance = import_axios25.default.create({
6627
6827
  baseURL: "https://billing.labs.livechatinc.com"
6628
6828
  });
6629
6829
  function getPlatformBillingClientAuthorization(req) {
@@ -6673,8 +6873,8 @@ var IntegrationNames = /* @__PURE__ */ ((IntegrationNames2) => {
6673
6873
  IntegrationNames2["Neon"] = "neon";
6674
6874
  IntegrationNames2["Mailchimp"] = "mailchimp";
6675
6875
  IntegrationNames2["Shopify"] = "shopify";
6676
- IntegrationNames2["BigCommerce"] = "bigcommerce";
6677
6876
  IntegrationNames2["HubSpot"] = "hubspot";
6877
+ IntegrationNames2["BigCommerce"] = "bigcommerce";
6678
6878
  IntegrationNames2["Text"] = "text";
6679
6879
  return IntegrationNames2;
6680
6880
  })(IntegrationNames || {});
@@ -6685,7 +6885,7 @@ var IntegrationModes = /* @__PURE__ */ ((IntegrationModes2) => {
6685
6885
  })(IntegrationModes || {});
6686
6886
 
6687
6887
  // src/apis/platform/adapter/integrations/_contracts/requests/events.ts
6688
- var import_zod5 = require("zod");
6888
+ var import_zod6 = require("zod");
6689
6889
 
6690
6890
  // src/apis/platform/adapter/integrations/shopify/_contracts/dtos/events.ts
6691
6891
  var ShopifyEventNames = /* @__PURE__ */ ((ShopifyEventNames2) => {
@@ -6961,36 +7161,108 @@ var hubspotEventsZods = {
6961
7161
  }
6962
7162
  };
6963
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
+
6964
7228
  // src/apis/platform/adapter/integrations/_contracts/requests/events.ts
6965
7229
  var integrationEventsZods = {
6966
- sourceName: import_zod5.z.enum(["apps", "workflows"]),
6967
- 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
+ ]),
6968
7238
  get event() {
6969
- 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);
6970
7240
  },
6971
7241
  get source() {
6972
- return import_zod5.z.object({
7242
+ return import_zod6.z.object({
6973
7243
  sourceName: this.sourceName,
6974
- sourceKey: import_zod5.z.string()
7244
+ sourceKey: import_zod6.z.string()
6975
7245
  });
6976
7246
  },
6977
7247
  get subscribe() {
6978
7248
  return this.source.and(
6979
- import_zod5.z.discriminatedUnion("provider", [
7249
+ import_zod6.z.discriminatedUnion("provider", [
6980
7250
  textLivechatEventsZods.subscribeContent,
6981
7251
  shopifyEventsZods.subscribeContent,
6982
7252
  mailchimpEventsZods.subscribeContent,
6983
- hubspotEventsZods.subscribeContent
7253
+ hubspotEventsZods.subscribeContent,
7254
+ bigcommerceEventsZods.subscribeContent
6984
7255
  ])
6985
7256
  );
6986
7257
  },
6987
7258
  get unsubscribe() {
6988
7259
  return this.source.and(
6989
- import_zod5.z.discriminatedUnion("provider", [
7260
+ import_zod6.z.discriminatedUnion("provider", [
6990
7261
  textLivechatEventsZods.unsubscribeContent,
6991
7262
  shopifyEventsZods.unsubscribeContent,
6992
7263
  mailchimpEventsZods.unsubscribeContent,
6993
- hubspotEventsZods.unsubscribeContent
7264
+ hubspotEventsZods.unsubscribeContent,
7265
+ bigcommerceEventsZods.unsubscribeContent
6994
7266
  ])
6995
7267
  );
6996
7268
  }
@@ -7020,6 +7292,54 @@ var WebhookSystemMessages = /* @__PURE__ */ ((WebhookSystemMessages2) => {
7020
7292
  return WebhookSystemMessages2;
7021
7293
  })(WebhookSystemMessages || {});
7022
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
+
7023
7343
  // src/apis/platform/adapter/integrations/mailchimp/api.ts
7024
7344
  var platformAdapterMailchimpApi = {
7025
7345
  events: {
@@ -7126,9 +7446,11 @@ var platformAdapterTextApi = {
7126
7446
  // src/apis/platform/adapter/integrations/api.ts
7127
7447
  var platformAdapterIntegrationsApi = {
7128
7448
  neon: platformAdapterNeonProxyApi,
7129
- text: platformAdapterTextApi,
7130
7449
  mailchimp: platformAdapterMailchimpApi,
7131
- shopify: platformAdapterShopifyApi
7450
+ shopify: platformAdapterShopifyApi,
7451
+ hubspot: platformAdapterHubspotApi,
7452
+ bigcommerce: platformAdapterBigCommerceApi,
7453
+ text: platformAdapterTextApi
7132
7454
  };
7133
7455
 
7134
7456
  // src/apis/platform/adapter/api.ts
@@ -7360,6 +7682,9 @@ function getIntegrationFlowUrl(name, flow, trigger, context, state, config) {
7360
7682
  AdapterApiError,
7361
7683
  ApiClient,
7362
7684
  ApiErrorBase,
7685
+ BigCommerceApiError,
7686
+ BigCommerceEventNames,
7687
+ BigCommerceWebhookScopes,
7363
7688
  DpsApiError,
7364
7689
  HubspotApiError,
7365
7690
  HubspotEventNames,
@@ -7385,7 +7710,12 @@ function getIntegrationFlowUrl(name, flow, trigger, context, state, config) {
7385
7710
  appRepositoryTemplatesMap,
7386
7711
  appTemplates,
7387
7712
  appTemplatesMap,
7713
+ bigCommerceClientInstance,
7714
+ bigcommerceEventsZods,
7388
7715
  getAppAutoReviewPayload,
7716
+ getBigCommerceClientAuthorization,
7717
+ getBigCommerceClientConfig,
7718
+ getBigCommerceClientUrl,
7389
7719
  getEmptyAppAutoReview,
7390
7720
  getGitHubClientAuthorization,
7391
7721
  getGithubClientConfig,
@@ -7426,6 +7756,7 @@ function getIntegrationFlowUrl(name, flow, trigger, context, state, config) {
7426
7756
  hubspotClientUrl,
7427
7757
  hubspotEventsZods,
7428
7758
  initApi,
7759
+ initBigCommerceClient,
7429
7760
  initGithubClient,
7430
7761
  initHubspotClient,
7431
7762
  initLiveChatClient,
@@ -7455,6 +7786,7 @@ function getIntegrationFlowUrl(name, flow, trigger, context, state, config) {
7455
7786
  shopifyEventsZods,
7456
7787
  textClientInstance,
7457
7788
  textLivechatEventsZods,
7789
+ updateBigCommerceClient,
7458
7790
  updateGithubClient,
7459
7791
  updateHubspotClient,
7460
7792
  updateMailchimpClient,