@livechat/developer-studio-api 3.1.25 → 3.1.27
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.mts +390 -44
- package/dist/index.d.ts +390 -44
- package/dist/index.js +359 -40
- package/dist/index.mjs +349 -40
- package/package.json +1 -1
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
|
|
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 =
|
|
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
|
|
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 =
|
|
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
|
|
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 =
|
|
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"
|
|
@@ -5742,6 +5893,10 @@ function getPlatformAdapterClientAuthorization(req) {
|
|
|
5742
5893
|
hubspot: {
|
|
5743
5894
|
token: req.headers.get("x-adapter-hubspot-token")
|
|
5744
5895
|
},
|
|
5896
|
+
bigcommerce: {
|
|
5897
|
+
token: req.headers.get("x-adapter-bigcommerce-token"),
|
|
5898
|
+
shop: req.headers.get("x-adapter-bigcommerce-shop")
|
|
5899
|
+
},
|
|
5745
5900
|
text: {
|
|
5746
5901
|
token: req.headers.get("x-adapter-text-token")
|
|
5747
5902
|
}
|
|
@@ -5778,13 +5933,17 @@ function getPlatformAdapterClientAuthorization(req) {
|
|
|
5778
5933
|
hubspot: {
|
|
5779
5934
|
token: req.headers["x-adapter-hubspot-token"]
|
|
5780
5935
|
},
|
|
5936
|
+
bigcommerce: {
|
|
5937
|
+
token: req.headers["x-adapter-bigcommerce-token"],
|
|
5938
|
+
shop: req.headers["x-adapter-bigcommerce-shop"]
|
|
5939
|
+
},
|
|
5781
5940
|
text: {
|
|
5782
5941
|
token: req.headers["x-adapter-text-token"]
|
|
5783
5942
|
}
|
|
5784
5943
|
};
|
|
5785
5944
|
}
|
|
5786
5945
|
function getPlatformAdapterClientConfig(options = {}) {
|
|
5787
|
-
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;
|
|
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;
|
|
5788
5947
|
const currentHeaders = platformAdapterClientInstance.defaults.headers;
|
|
5789
5948
|
const headers = {
|
|
5790
5949
|
platform: {
|
|
@@ -5804,44 +5963,49 @@ function getPlatformAdapterClientConfig(options = {}) {
|
|
|
5804
5963
|
shopify: (_t = currentHeaders["x-adapter-shopify-token"]) != null ? _t : (_s = options.shopify) == null ? void 0 : _s.token,
|
|
5805
5964
|
shopifyShop: (_v = currentHeaders["x-adapter-shopify-shop"]) != null ? _v : (_u = options.shopify) == null ? void 0 : _u.shop,
|
|
5806
5965
|
hubspot: (_x = currentHeaders["x-adapter-hubspot-token"]) != null ? _x : (_w = options.hubspot) == null ? void 0 : _w.token,
|
|
5807
|
-
|
|
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
|
|
5808
5969
|
}
|
|
5809
5970
|
};
|
|
5810
5971
|
if (currentHeaders["x-adapter-platform-token"]) {
|
|
5811
|
-
currentHeaders["X-Region"] = (
|
|
5972
|
+
currentHeaders["X-Region"] = (_E = getRegion2(currentHeaders["x-adapter-platform-token"])) != null ? _E : void 0;
|
|
5812
5973
|
}
|
|
5813
|
-
if (((
|
|
5974
|
+
if (((_F = options.ensureAuthorizationToken) == null ? void 0 : _F.platform) && !headers.platform.token) {
|
|
5814
5975
|
throw new UnauthorizeApiError("accounts");
|
|
5815
5976
|
}
|
|
5816
|
-
if (((
|
|
5977
|
+
if (((_G = options.ensureAuthorizationToken) == null ? void 0 : _G.github) && (!headers.integrations.github.app || !headers.integrations.github.oauth)) {
|
|
5817
5978
|
throw new UnauthorizeApiError("github");
|
|
5818
5979
|
}
|
|
5819
|
-
if (((
|
|
5980
|
+
if (((_H = options.ensureAuthorizationToken) == null ? void 0 : _H.vercel) && !headers.integrations.vercel) {
|
|
5820
5981
|
throw new UnauthorizeApiError("vercel");
|
|
5821
5982
|
}
|
|
5822
|
-
if (((
|
|
5983
|
+
if (((_I = options.ensureAuthorizationToken) == null ? void 0 : _I.netlify) && !headers.integrations.netlify) {
|
|
5823
5984
|
throw new UnauthorizeApiError("netlify");
|
|
5824
5985
|
}
|
|
5825
|
-
if (((
|
|
5986
|
+
if (((_J = options.ensureAuthorizationToken) == null ? void 0 : _J.planetscale) && !headers.integrations.planetscale) {
|
|
5826
5987
|
throw new UnauthorizeApiError("planetscale");
|
|
5827
5988
|
}
|
|
5828
|
-
if (((
|
|
5989
|
+
if (((_K = options.ensureAuthorizationToken) == null ? void 0 : _K.neon) && !headers.integrations.neon) {
|
|
5829
5990
|
throw new UnauthorizeApiError("neon");
|
|
5830
5991
|
}
|
|
5831
|
-
if (((
|
|
5992
|
+
if (((_L = options.ensureAuthorizationToken) == null ? void 0 : _L.mailchimp) && (!headers.integrations.mailchimp || !headers.integrations.mailchimpServer)) {
|
|
5832
5993
|
throw new UnauthorizeApiError("mailchimp");
|
|
5833
5994
|
}
|
|
5834
|
-
if (((
|
|
5995
|
+
if (((_M = options.ensureAuthorizationToken) == null ? void 0 : _M.shopify) && (!headers.integrations.shopify || !headers.integrations.shopifyShop)) {
|
|
5835
5996
|
throw new UnauthorizeApiError("shopify");
|
|
5836
5997
|
}
|
|
5837
|
-
if (((
|
|
5998
|
+
if (((_N = options.ensureAuthorizationToken) == null ? void 0 : _N.hubspot) && !headers.integrations.hubspot) {
|
|
5838
5999
|
throw new UnauthorizeApiError("hubspot");
|
|
5839
6000
|
}
|
|
5840
|
-
if (((
|
|
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) {
|
|
5841
6005
|
throw new UnauthorizeApiError("text");
|
|
5842
6006
|
}
|
|
5843
6007
|
return {
|
|
5844
|
-
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 } : {})
|
|
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 } : {})
|
|
5845
6009
|
};
|
|
5846
6010
|
}
|
|
5847
6011
|
var getPlatformAdapterClientDefaultConfig = (authorization) => getPlatformAdapterClientConfig(__spreadProps(__spreadValues({}, authorization), {
|
|
@@ -5864,7 +6028,7 @@ function initPlatformAdapterClient(baseUrl, tokens) {
|
|
|
5864
6028
|
}
|
|
5865
6029
|
}
|
|
5866
6030
|
function updatePlatformAdapterClient(tokens) {
|
|
5867
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m;
|
|
6031
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o;
|
|
5868
6032
|
const headers = platformAdapterClientInstance.defaults.headers;
|
|
5869
6033
|
if ((_a = tokens == null ? void 0 : tokens.platform) == null ? void 0 : _a.token) {
|
|
5870
6034
|
headers["x-adapter-platform-token"] = tokens.platform.token;
|
|
@@ -5902,7 +6066,13 @@ function updatePlatformAdapterClient(tokens) {
|
|
|
5902
6066
|
if ((_l = tokens == null ? void 0 : tokens.hubspot) == null ? void 0 : _l.token) {
|
|
5903
6067
|
headers["x-adapter-hubspot-token"] = tokens.hubspot.token;
|
|
5904
6068
|
}
|
|
5905
|
-
if ((_m = tokens == null ? void 0 : tokens.
|
|
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) {
|
|
5906
6076
|
headers["x-adapter-text-token"] = tokens.text.token;
|
|
5907
6077
|
}
|
|
5908
6078
|
}
|
|
@@ -6422,7 +6592,7 @@ var WorkflowDefinitionTaskType = {
|
|
|
6422
6592
|
};
|
|
6423
6593
|
|
|
6424
6594
|
// src/apis/integrations/hubspot/instance.ts
|
|
6425
|
-
import
|
|
6595
|
+
import axios22 from "axios";
|
|
6426
6596
|
var HubspotApiError = class extends ApiErrorBase {
|
|
6427
6597
|
constructor() {
|
|
6428
6598
|
super(...arguments);
|
|
@@ -6430,7 +6600,7 @@ var HubspotApiError = class extends ApiErrorBase {
|
|
|
6430
6600
|
}
|
|
6431
6601
|
};
|
|
6432
6602
|
var hubspotClientUrl = `https://api.hubapi.com`;
|
|
6433
|
-
var hubspotClientInstance =
|
|
6603
|
+
var hubspotClientInstance = axios22.create({
|
|
6434
6604
|
headers: {
|
|
6435
6605
|
"Content-Type": "application/json"
|
|
6436
6606
|
}
|
|
@@ -6439,7 +6609,7 @@ hubspotClientInstance.interceptors.response.use(
|
|
|
6439
6609
|
(r) => r,
|
|
6440
6610
|
(error) => {
|
|
6441
6611
|
var _a, _b, _c, _d;
|
|
6442
|
-
if (
|
|
6612
|
+
if (axios22.isAxiosError(error)) {
|
|
6443
6613
|
if (((_a = error.response) == null ? void 0 : _a.status) === 401) {
|
|
6444
6614
|
throw new UnauthorizeApiError("hubspot");
|
|
6445
6615
|
}
|
|
@@ -6491,9 +6661,16 @@ function updateHubspotClient(token) {
|
|
|
6491
6661
|
}
|
|
6492
6662
|
}
|
|
6493
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
|
+
|
|
6494
6671
|
// src/apis/platform/billing/instance.ts
|
|
6495
|
-
import
|
|
6496
|
-
var platformBillingClientInstance =
|
|
6672
|
+
import axios23 from "axios";
|
|
6673
|
+
var platformBillingClientInstance = axios23.create({
|
|
6497
6674
|
baseURL: "https://billing.labs.livechatinc.com"
|
|
6498
6675
|
});
|
|
6499
6676
|
function getPlatformBillingClientAuthorization(req) {
|
|
@@ -6543,8 +6720,8 @@ var IntegrationNames = /* @__PURE__ */ ((IntegrationNames2) => {
|
|
|
6543
6720
|
IntegrationNames2["Neon"] = "neon";
|
|
6544
6721
|
IntegrationNames2["Mailchimp"] = "mailchimp";
|
|
6545
6722
|
IntegrationNames2["Shopify"] = "shopify";
|
|
6546
|
-
IntegrationNames2["BigCommerce"] = "bigcommerce";
|
|
6547
6723
|
IntegrationNames2["HubSpot"] = "hubspot";
|
|
6724
|
+
IntegrationNames2["BigCommerce"] = "bigcommerce";
|
|
6548
6725
|
IntegrationNames2["Text"] = "text";
|
|
6549
6726
|
return IntegrationNames2;
|
|
6550
6727
|
})(IntegrationNames || {});
|
|
@@ -6555,7 +6732,7 @@ var IntegrationModes = /* @__PURE__ */ ((IntegrationModes2) => {
|
|
|
6555
6732
|
})(IntegrationModes || {});
|
|
6556
6733
|
|
|
6557
6734
|
// src/apis/platform/adapter/integrations/_contracts/requests/events.ts
|
|
6558
|
-
import { z as
|
|
6735
|
+
import { z as z6 } from "zod";
|
|
6559
6736
|
|
|
6560
6737
|
// src/apis/platform/adapter/integrations/shopify/_contracts/dtos/events.ts
|
|
6561
6738
|
var ShopifyEventNames = /* @__PURE__ */ ((ShopifyEventNames2) => {
|
|
@@ -6831,36 +7008,108 @@ var hubspotEventsZods = {
|
|
|
6831
7008
|
}
|
|
6832
7009
|
};
|
|
6833
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
|
+
|
|
6834
7075
|
// src/apis/platform/adapter/integrations/_contracts/requests/events.ts
|
|
6835
7076
|
var integrationEventsZods = {
|
|
6836
|
-
sourceName:
|
|
6837
|
-
providerName:
|
|
7077
|
+
sourceName: z6.enum(["apps", "workflows"]),
|
|
7078
|
+
providerName: z6.enum([
|
|
7079
|
+
"text-livechat",
|
|
7080
|
+
"mailchimp",
|
|
7081
|
+
"shopify",
|
|
7082
|
+
"hubspot",
|
|
7083
|
+
"bigcommerce"
|
|
7084
|
+
]),
|
|
6838
7085
|
get event() {
|
|
6839
|
-
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);
|
|
6840
7087
|
},
|
|
6841
7088
|
get source() {
|
|
6842
|
-
return
|
|
7089
|
+
return z6.object({
|
|
6843
7090
|
sourceName: this.sourceName,
|
|
6844
|
-
sourceKey:
|
|
7091
|
+
sourceKey: z6.string()
|
|
6845
7092
|
});
|
|
6846
7093
|
},
|
|
6847
7094
|
get subscribe() {
|
|
6848
7095
|
return this.source.and(
|
|
6849
|
-
|
|
7096
|
+
z6.discriminatedUnion("provider", [
|
|
6850
7097
|
textLivechatEventsZods.subscribeContent,
|
|
6851
7098
|
shopifyEventsZods.subscribeContent,
|
|
6852
7099
|
mailchimpEventsZods.subscribeContent,
|
|
6853
|
-
hubspotEventsZods.subscribeContent
|
|
7100
|
+
hubspotEventsZods.subscribeContent,
|
|
7101
|
+
bigcommerceEventsZods.subscribeContent
|
|
6854
7102
|
])
|
|
6855
7103
|
);
|
|
6856
7104
|
},
|
|
6857
7105
|
get unsubscribe() {
|
|
6858
7106
|
return this.source.and(
|
|
6859
|
-
|
|
7107
|
+
z6.discriminatedUnion("provider", [
|
|
6860
7108
|
textLivechatEventsZods.unsubscribeContent,
|
|
6861
7109
|
shopifyEventsZods.unsubscribeContent,
|
|
6862
7110
|
mailchimpEventsZods.unsubscribeContent,
|
|
6863
|
-
hubspotEventsZods.unsubscribeContent
|
|
7111
|
+
hubspotEventsZods.unsubscribeContent,
|
|
7112
|
+
bigcommerceEventsZods.unsubscribeContent
|
|
6864
7113
|
])
|
|
6865
7114
|
);
|
|
6866
7115
|
}
|
|
@@ -6890,6 +7139,54 @@ var WebhookSystemMessages = /* @__PURE__ */ ((WebhookSystemMessages2) => {
|
|
|
6890
7139
|
return WebhookSystemMessages2;
|
|
6891
7140
|
})(WebhookSystemMessages || {});
|
|
6892
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
|
+
|
|
6893
7190
|
// src/apis/platform/adapter/integrations/mailchimp/api.ts
|
|
6894
7191
|
var platformAdapterMailchimpApi = {
|
|
6895
7192
|
events: {
|
|
@@ -6996,9 +7293,11 @@ var platformAdapterTextApi = {
|
|
|
6996
7293
|
// src/apis/platform/adapter/integrations/api.ts
|
|
6997
7294
|
var platformAdapterIntegrationsApi = {
|
|
6998
7295
|
neon: platformAdapterNeonProxyApi,
|
|
6999
|
-
text: platformAdapterTextApi,
|
|
7000
7296
|
mailchimp: platformAdapterMailchimpApi,
|
|
7001
|
-
shopify: platformAdapterShopifyApi
|
|
7297
|
+
shopify: platformAdapterShopifyApi,
|
|
7298
|
+
hubspot: platformAdapterHubspotApi,
|
|
7299
|
+
bigcommerce: platformAdapterBigCommerceApi,
|
|
7300
|
+
text: platformAdapterTextApi
|
|
7002
7301
|
};
|
|
7003
7302
|
|
|
7004
7303
|
// src/apis/platform/adapter/api.ts
|
|
@@ -7229,6 +7528,9 @@ export {
|
|
|
7229
7528
|
AdapterApiError,
|
|
7230
7529
|
ApiClient,
|
|
7231
7530
|
ApiErrorBase,
|
|
7531
|
+
BigCommerceApiError,
|
|
7532
|
+
BigCommerceEventNames,
|
|
7533
|
+
BigCommerceWebhookScopes,
|
|
7232
7534
|
DpsApiError,
|
|
7233
7535
|
HubspotApiError,
|
|
7234
7536
|
HubspotEventNames,
|
|
@@ -7254,7 +7556,12 @@ export {
|
|
|
7254
7556
|
appRepositoryTemplatesMap,
|
|
7255
7557
|
appTemplates,
|
|
7256
7558
|
appTemplatesMap,
|
|
7559
|
+
bigCommerceClientInstance,
|
|
7560
|
+
bigcommerceEventsZods,
|
|
7257
7561
|
getAppAutoReviewPayload,
|
|
7562
|
+
getBigCommerceClientAuthorization,
|
|
7563
|
+
getBigCommerceClientConfig,
|
|
7564
|
+
getBigCommerceClientUrl,
|
|
7258
7565
|
getEmptyAppAutoReview,
|
|
7259
7566
|
getGitHubClientAuthorization,
|
|
7260
7567
|
getGithubClientConfig,
|
|
@@ -7295,6 +7602,7 @@ export {
|
|
|
7295
7602
|
hubspotClientUrl,
|
|
7296
7603
|
hubspotEventsZods,
|
|
7297
7604
|
initApi,
|
|
7605
|
+
initBigCommerceClient,
|
|
7298
7606
|
initGithubClient,
|
|
7299
7607
|
initHubspotClient,
|
|
7300
7608
|
initLiveChatClient,
|
|
@@ -7324,6 +7632,7 @@ export {
|
|
|
7324
7632
|
shopifyEventsZods,
|
|
7325
7633
|
textClientInstance,
|
|
7326
7634
|
textLivechatEventsZods,
|
|
7635
|
+
updateBigCommerceClient,
|
|
7327
7636
|
updateGithubClient,
|
|
7328
7637
|
updateHubspotClient,
|
|
7329
7638
|
updateMailchimpClient,
|