@livechat/developer-studio-api 3.0.54 → 3.0.55
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 +7 -3
- package/dist/index.d.ts +7 -3
- package/dist/index.js +31 -16
- package/dist/index.mjs +31 -16
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -529,7 +529,7 @@ interface TextClientOptions extends TextClientAuthorization {
|
|
|
529
529
|
declare const textClientInstance: axios.AxiosInstance;
|
|
530
530
|
declare function getTextClientAuthorization(req: {
|
|
531
531
|
headers: Record<string, string | string[] | undefined> | Headers;
|
|
532
|
-
}): TextClientAuthorization;
|
|
532
|
+
}, useIntegration?: boolean): TextClientAuthorization;
|
|
533
533
|
declare function getTextClientConfig(option?: TextClientOptions): AxiosRequestConfig;
|
|
534
534
|
declare function initTextClient(baseUrl?: string, token?: string): void;
|
|
535
535
|
|
|
@@ -729,8 +729,8 @@ interface MailchimpListWebhook {
|
|
|
729
729
|
};
|
|
730
730
|
}
|
|
731
731
|
|
|
732
|
-
type ApiErrorName = "adapter" | "accounts" | "livechat" | "dps" | "github" | "vercel" | "netlify" | "planetscale" | "neon" | "mailchimp" | "shopify"
|
|
733
|
-
type ApiErrorSource = "accounts" | "github" | "vercel" | "netlify" | "planetscale" | "neon" | "mailchimp" | "shopify";
|
|
732
|
+
type ApiErrorName = "adapter" | "accounts" | "livechat" | "dps" | "github" | "vercel" | "netlify" | "planetscale" | "neon" | "mailchimp" | "shopify";
|
|
733
|
+
type ApiErrorSource = "accounts" | "github" | "vercel" | "netlify" | "planetscale" | "neon" | "mailchimp" | "shopify" | "text";
|
|
734
734
|
type ApiErrorKind = "unauthorized" | "error";
|
|
735
735
|
type ApiError<TData = unknown> = {
|
|
736
736
|
code: number;
|
|
@@ -2150,6 +2150,7 @@ interface PlatformAdapterClientAuthorization {
|
|
|
2150
2150
|
neon?: NeonClientAuthorization;
|
|
2151
2151
|
mailchimp?: MailchimpClientAuthorization;
|
|
2152
2152
|
shopify?: ShopifyClientAuthorization;
|
|
2153
|
+
text?: TextClientAuthorization;
|
|
2153
2154
|
}
|
|
2154
2155
|
type PlatformAdapterClientOptions = PlatformAdapterClientAuthorization & {
|
|
2155
2156
|
ensureAuthorizationToken?: {
|
|
@@ -2161,6 +2162,7 @@ type PlatformAdapterClientOptions = PlatformAdapterClientAuthorization & {
|
|
|
2161
2162
|
neon?: boolean;
|
|
2162
2163
|
mailchimp?: boolean;
|
|
2163
2164
|
shopify?: boolean;
|
|
2165
|
+
text?: boolean;
|
|
2164
2166
|
};
|
|
2165
2167
|
};
|
|
2166
2168
|
declare class AdapterApiError extends ApiErrorBase<{
|
|
@@ -2184,6 +2186,7 @@ declare function initPlatformAdapterClient(baseUrl?: string, tokens?: {
|
|
|
2184
2186
|
neon?: NeonClientAuthorization;
|
|
2185
2187
|
mailchimp?: MailchimpClientAuthorization;
|
|
2186
2188
|
shopify?: ShopifyClientAuthorization;
|
|
2189
|
+
text?: TextClientAuthorization;
|
|
2187
2190
|
}): void;
|
|
2188
2191
|
declare function updatePlatformAdapterClient(tokens?: {
|
|
2189
2192
|
platform?: PlatformClientAuthorization;
|
|
@@ -2194,6 +2197,7 @@ declare function updatePlatformAdapterClient(tokens?: {
|
|
|
2194
2197
|
neon?: NeonClientAuthorization;
|
|
2195
2198
|
mailchimp?: MailchimpClientAuthorization;
|
|
2196
2199
|
shopify?: ShopifyClientAuthorization;
|
|
2200
|
+
text?: TextClientAuthorization;
|
|
2197
2201
|
}): void;
|
|
2198
2202
|
|
|
2199
2203
|
interface ApplicationPaymentDto {
|
package/dist/index.d.ts
CHANGED
|
@@ -529,7 +529,7 @@ interface TextClientOptions extends TextClientAuthorization {
|
|
|
529
529
|
declare const textClientInstance: axios.AxiosInstance;
|
|
530
530
|
declare function getTextClientAuthorization(req: {
|
|
531
531
|
headers: Record<string, string | string[] | undefined> | Headers;
|
|
532
|
-
}): TextClientAuthorization;
|
|
532
|
+
}, useIntegration?: boolean): TextClientAuthorization;
|
|
533
533
|
declare function getTextClientConfig(option?: TextClientOptions): AxiosRequestConfig;
|
|
534
534
|
declare function initTextClient(baseUrl?: string, token?: string): void;
|
|
535
535
|
|
|
@@ -729,8 +729,8 @@ interface MailchimpListWebhook {
|
|
|
729
729
|
};
|
|
730
730
|
}
|
|
731
731
|
|
|
732
|
-
type ApiErrorName = "adapter" | "accounts" | "livechat" | "dps" | "github" | "vercel" | "netlify" | "planetscale" | "neon" | "mailchimp" | "shopify"
|
|
733
|
-
type ApiErrorSource = "accounts" | "github" | "vercel" | "netlify" | "planetscale" | "neon" | "mailchimp" | "shopify";
|
|
732
|
+
type ApiErrorName = "adapter" | "accounts" | "livechat" | "dps" | "github" | "vercel" | "netlify" | "planetscale" | "neon" | "mailchimp" | "shopify";
|
|
733
|
+
type ApiErrorSource = "accounts" | "github" | "vercel" | "netlify" | "planetscale" | "neon" | "mailchimp" | "shopify" | "text";
|
|
734
734
|
type ApiErrorKind = "unauthorized" | "error";
|
|
735
735
|
type ApiError<TData = unknown> = {
|
|
736
736
|
code: number;
|
|
@@ -2150,6 +2150,7 @@ interface PlatformAdapterClientAuthorization {
|
|
|
2150
2150
|
neon?: NeonClientAuthorization;
|
|
2151
2151
|
mailchimp?: MailchimpClientAuthorization;
|
|
2152
2152
|
shopify?: ShopifyClientAuthorization;
|
|
2153
|
+
text?: TextClientAuthorization;
|
|
2153
2154
|
}
|
|
2154
2155
|
type PlatformAdapterClientOptions = PlatformAdapterClientAuthorization & {
|
|
2155
2156
|
ensureAuthorizationToken?: {
|
|
@@ -2161,6 +2162,7 @@ type PlatformAdapterClientOptions = PlatformAdapterClientAuthorization & {
|
|
|
2161
2162
|
neon?: boolean;
|
|
2162
2163
|
mailchimp?: boolean;
|
|
2163
2164
|
shopify?: boolean;
|
|
2165
|
+
text?: boolean;
|
|
2164
2166
|
};
|
|
2165
2167
|
};
|
|
2166
2168
|
declare class AdapterApiError extends ApiErrorBase<{
|
|
@@ -2184,6 +2186,7 @@ declare function initPlatformAdapterClient(baseUrl?: string, tokens?: {
|
|
|
2184
2186
|
neon?: NeonClientAuthorization;
|
|
2185
2187
|
mailchimp?: MailchimpClientAuthorization;
|
|
2186
2188
|
shopify?: ShopifyClientAuthorization;
|
|
2189
|
+
text?: TextClientAuthorization;
|
|
2187
2190
|
}): void;
|
|
2188
2191
|
declare function updatePlatformAdapterClient(tokens?: {
|
|
2189
2192
|
platform?: PlatformClientAuthorization;
|
|
@@ -2194,6 +2197,7 @@ declare function updatePlatformAdapterClient(tokens?: {
|
|
|
2194
2197
|
neon?: NeonClientAuthorization;
|
|
2195
2198
|
mailchimp?: MailchimpClientAuthorization;
|
|
2196
2199
|
shopify?: ShopifyClientAuthorization;
|
|
2200
|
+
text?: TextClientAuthorization;
|
|
2197
2201
|
}): void;
|
|
2198
2202
|
|
|
2199
2203
|
interface ApplicationPaymentDto {
|
package/dist/index.js
CHANGED
|
@@ -1359,15 +1359,17 @@ var import_axios8 = __toESM(require("axios"));
|
|
|
1359
1359
|
var textClientInstance = import_axios8.default.create({
|
|
1360
1360
|
baseURL: "https://api.labs.text.com"
|
|
1361
1361
|
});
|
|
1362
|
-
function getTextClientAuthorization(req) {
|
|
1362
|
+
function getTextClientAuthorization(req, useIntegration) {
|
|
1363
1363
|
if (req.headers instanceof Headers) {
|
|
1364
1364
|
return {
|
|
1365
|
-
token: req.headers.get(
|
|
1365
|
+
token: req.headers.get(
|
|
1366
|
+
useIntegration ? "x-adapter-text-token" : "x-adapter-platform-token"
|
|
1367
|
+
),
|
|
1366
1368
|
tokenType: "Bearer"
|
|
1367
1369
|
};
|
|
1368
1370
|
}
|
|
1369
1371
|
return {
|
|
1370
|
-
token: req.headers["x-adapter-platform-token"],
|
|
1372
|
+
token: req.headers[useIntegration ? "x-adapter-text-token" : "x-adapter-platform-token"],
|
|
1371
1373
|
tokenType: "Bearer"
|
|
1372
1374
|
};
|
|
1373
1375
|
}
|
|
@@ -5407,6 +5409,9 @@ function getPlatformAdapterClientAuthorization(req) {
|
|
|
5407
5409
|
shopify: {
|
|
5408
5410
|
token: req.headers.get("x-adapter-shopify-token"),
|
|
5409
5411
|
shop: req.headers.get("x-adapter-shopify-shop")
|
|
5412
|
+
},
|
|
5413
|
+
text: {
|
|
5414
|
+
token: req.headers.get("x-adapter-text-token")
|
|
5410
5415
|
}
|
|
5411
5416
|
};
|
|
5412
5417
|
}
|
|
@@ -5437,11 +5442,14 @@ function getPlatformAdapterClientAuthorization(req) {
|
|
|
5437
5442
|
shopify: {
|
|
5438
5443
|
token: req.headers["x-adapter-shopify-token"],
|
|
5439
5444
|
shop: req.headers["x-adapter-shopify-shop"]
|
|
5445
|
+
},
|
|
5446
|
+
text: {
|
|
5447
|
+
token: req.headers["x-adapter-text-token"]
|
|
5440
5448
|
}
|
|
5441
5449
|
};
|
|
5442
5450
|
}
|
|
5443
5451
|
function getPlatformAdapterClientConfig(options = {}) {
|
|
5444
|
-
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;
|
|
5452
|
+
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;
|
|
5445
5453
|
const currentHeaders = platformAdapterClientInstance.defaults.headers;
|
|
5446
5454
|
const headers = {
|
|
5447
5455
|
platform: {
|
|
@@ -5459,38 +5467,42 @@ function getPlatformAdapterClientConfig(options = {}) {
|
|
|
5459
5467
|
mailchimp: (_p = currentHeaders["x-adapter-mailchimp-token"]) != null ? _p : (_o = options.mailchimp) == null ? void 0 : _o.token,
|
|
5460
5468
|
mailchimpServer: (_r = currentHeaders["x-adapter-mailchimp-server"]) != null ? _r : (_q = options.mailchimp) == null ? void 0 : _q.server,
|
|
5461
5469
|
shopify: (_t = currentHeaders["x-adapter-shopify-token"]) != null ? _t : (_s = options.shopify) == null ? void 0 : _s.token,
|
|
5462
|
-
shopifyShop: (_v = currentHeaders["x-adapter-shopify-shop"]) != null ? _v : (_u = options.shopify) == null ? void 0 : _u.shop
|
|
5470
|
+
shopifyShop: (_v = currentHeaders["x-adapter-shopify-shop"]) != null ? _v : (_u = options.shopify) == null ? void 0 : _u.shop,
|
|
5471
|
+
text: (_x = currentHeaders["x-adapter-text-token"]) != null ? _x : (_w = options.text) == null ? void 0 : _w.token
|
|
5463
5472
|
}
|
|
5464
5473
|
};
|
|
5465
5474
|
if (currentHeaders["x-adapter-platform-token"]) {
|
|
5466
|
-
currentHeaders["X-Region"] = (
|
|
5475
|
+
currentHeaders["X-Region"] = (_y = getRegion2(currentHeaders["x-adapter-platform-token"])) != null ? _y : void 0;
|
|
5467
5476
|
}
|
|
5468
|
-
if (((
|
|
5477
|
+
if (((_z = options.ensureAuthorizationToken) == null ? void 0 : _z.platform) && !headers.platform.token) {
|
|
5469
5478
|
throw new UnauthorizeApiError("accounts");
|
|
5470
5479
|
}
|
|
5471
|
-
if (((
|
|
5480
|
+
if (((_A = options.ensureAuthorizationToken) == null ? void 0 : _A.github) && (!headers.integrations.github.app || !headers.integrations.github.oauth)) {
|
|
5472
5481
|
throw new UnauthorizeApiError("github");
|
|
5473
5482
|
}
|
|
5474
|
-
if (((
|
|
5483
|
+
if (((_B = options.ensureAuthorizationToken) == null ? void 0 : _B.vercel) && !headers.integrations.vercel) {
|
|
5475
5484
|
throw new UnauthorizeApiError("vercel");
|
|
5476
5485
|
}
|
|
5477
|
-
if (((
|
|
5486
|
+
if (((_C = options.ensureAuthorizationToken) == null ? void 0 : _C.netlify) && !headers.integrations.netlify) {
|
|
5478
5487
|
throw new UnauthorizeApiError("netlify");
|
|
5479
5488
|
}
|
|
5480
|
-
if (((
|
|
5489
|
+
if (((_D = options.ensureAuthorizationToken) == null ? void 0 : _D.planetscale) && !headers.integrations.planetscale) {
|
|
5481
5490
|
throw new UnauthorizeApiError("planetscale");
|
|
5482
5491
|
}
|
|
5483
|
-
if (((
|
|
5492
|
+
if (((_E = options.ensureAuthorizationToken) == null ? void 0 : _E.neon) && !headers.integrations.neon) {
|
|
5484
5493
|
throw new UnauthorizeApiError("neon");
|
|
5485
5494
|
}
|
|
5486
|
-
if (((
|
|
5495
|
+
if (((_F = options.ensureAuthorizationToken) == null ? void 0 : _F.mailchimp) && (!headers.integrations.mailchimp || !headers.integrations.mailchimpServer)) {
|
|
5487
5496
|
throw new UnauthorizeApiError("mailchimp");
|
|
5488
5497
|
}
|
|
5489
|
-
if (((
|
|
5498
|
+
if (((_G = options.ensureAuthorizationToken) == null ? void 0 : _G.shopify) && (!headers.integrations.shopify || !headers.integrations.shopifyShop)) {
|
|
5490
5499
|
throw new UnauthorizeApiError("shopify");
|
|
5491
5500
|
}
|
|
5501
|
+
if (((_H = options.ensureAuthorizationToken) == null ? void 0 : _H.text) && !headers.integrations.text) {
|
|
5502
|
+
throw new UnauthorizeApiError("text");
|
|
5503
|
+
}
|
|
5492
5504
|
return {
|
|
5493
|
-
headers: __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 } : {})
|
|
5505
|
+
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 } : {})
|
|
5494
5506
|
};
|
|
5495
5507
|
}
|
|
5496
5508
|
var getPlatformAdapterClientDefaultConfig = (authorization) => getPlatformAdapterClientConfig(__spreadProps(__spreadValues({}, authorization), {
|
|
@@ -5513,7 +5525,7 @@ function initPlatformAdapterClient(baseUrl, tokens) {
|
|
|
5513
5525
|
}
|
|
5514
5526
|
}
|
|
5515
5527
|
function updatePlatformAdapterClient(tokens) {
|
|
5516
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k;
|
|
5528
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l;
|
|
5517
5529
|
const headers = platformAdapterClientInstance.defaults.headers;
|
|
5518
5530
|
if ((_a = tokens == null ? void 0 : tokens.platform) == null ? void 0 : _a.token) {
|
|
5519
5531
|
headers["x-adapter-platform-token"] = tokens.platform.token;
|
|
@@ -5548,6 +5560,9 @@ function updatePlatformAdapterClient(tokens) {
|
|
|
5548
5560
|
if ((_k = tokens == null ? void 0 : tokens.shopify) == null ? void 0 : _k.token) {
|
|
5549
5561
|
headers["x-adapter-shopify-token"] = tokens.shopify.token;
|
|
5550
5562
|
}
|
|
5563
|
+
if ((_l = tokens == null ? void 0 : tokens.text) == null ? void 0 : _l.token) {
|
|
5564
|
+
headers["x-adapter-text-token"] = tokens.text.token;
|
|
5565
|
+
}
|
|
5551
5566
|
}
|
|
5552
5567
|
|
|
5553
5568
|
// src/apis/platform/adapter/app/blocks/authorization/api.ts
|
package/dist/index.mjs
CHANGED
|
@@ -1234,15 +1234,17 @@ import axios6 from "axios";
|
|
|
1234
1234
|
var textClientInstance = axios6.create({
|
|
1235
1235
|
baseURL: "https://api.labs.text.com"
|
|
1236
1236
|
});
|
|
1237
|
-
function getTextClientAuthorization(req) {
|
|
1237
|
+
function getTextClientAuthorization(req, useIntegration) {
|
|
1238
1238
|
if (req.headers instanceof Headers) {
|
|
1239
1239
|
return {
|
|
1240
|
-
token: req.headers.get(
|
|
1240
|
+
token: req.headers.get(
|
|
1241
|
+
useIntegration ? "x-adapter-text-token" : "x-adapter-platform-token"
|
|
1242
|
+
),
|
|
1241
1243
|
tokenType: "Bearer"
|
|
1242
1244
|
};
|
|
1243
1245
|
}
|
|
1244
1246
|
return {
|
|
1245
|
-
token: req.headers["x-adapter-platform-token"],
|
|
1247
|
+
token: req.headers[useIntegration ? "x-adapter-text-token" : "x-adapter-platform-token"],
|
|
1246
1248
|
tokenType: "Bearer"
|
|
1247
1249
|
};
|
|
1248
1250
|
}
|
|
@@ -5282,6 +5284,9 @@ function getPlatformAdapterClientAuthorization(req) {
|
|
|
5282
5284
|
shopify: {
|
|
5283
5285
|
token: req.headers.get("x-adapter-shopify-token"),
|
|
5284
5286
|
shop: req.headers.get("x-adapter-shopify-shop")
|
|
5287
|
+
},
|
|
5288
|
+
text: {
|
|
5289
|
+
token: req.headers.get("x-adapter-text-token")
|
|
5285
5290
|
}
|
|
5286
5291
|
};
|
|
5287
5292
|
}
|
|
@@ -5312,11 +5317,14 @@ function getPlatformAdapterClientAuthorization(req) {
|
|
|
5312
5317
|
shopify: {
|
|
5313
5318
|
token: req.headers["x-adapter-shopify-token"],
|
|
5314
5319
|
shop: req.headers["x-adapter-shopify-shop"]
|
|
5320
|
+
},
|
|
5321
|
+
text: {
|
|
5322
|
+
token: req.headers["x-adapter-text-token"]
|
|
5315
5323
|
}
|
|
5316
5324
|
};
|
|
5317
5325
|
}
|
|
5318
5326
|
function getPlatformAdapterClientConfig(options = {}) {
|
|
5319
|
-
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;
|
|
5327
|
+
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;
|
|
5320
5328
|
const currentHeaders = platformAdapterClientInstance.defaults.headers;
|
|
5321
5329
|
const headers = {
|
|
5322
5330
|
platform: {
|
|
@@ -5334,38 +5342,42 @@ function getPlatformAdapterClientConfig(options = {}) {
|
|
|
5334
5342
|
mailchimp: (_p = currentHeaders["x-adapter-mailchimp-token"]) != null ? _p : (_o = options.mailchimp) == null ? void 0 : _o.token,
|
|
5335
5343
|
mailchimpServer: (_r = currentHeaders["x-adapter-mailchimp-server"]) != null ? _r : (_q = options.mailchimp) == null ? void 0 : _q.server,
|
|
5336
5344
|
shopify: (_t = currentHeaders["x-adapter-shopify-token"]) != null ? _t : (_s = options.shopify) == null ? void 0 : _s.token,
|
|
5337
|
-
shopifyShop: (_v = currentHeaders["x-adapter-shopify-shop"]) != null ? _v : (_u = options.shopify) == null ? void 0 : _u.shop
|
|
5345
|
+
shopifyShop: (_v = currentHeaders["x-adapter-shopify-shop"]) != null ? _v : (_u = options.shopify) == null ? void 0 : _u.shop,
|
|
5346
|
+
text: (_x = currentHeaders["x-adapter-text-token"]) != null ? _x : (_w = options.text) == null ? void 0 : _w.token
|
|
5338
5347
|
}
|
|
5339
5348
|
};
|
|
5340
5349
|
if (currentHeaders["x-adapter-platform-token"]) {
|
|
5341
|
-
currentHeaders["X-Region"] = (
|
|
5350
|
+
currentHeaders["X-Region"] = (_y = getRegion2(currentHeaders["x-adapter-platform-token"])) != null ? _y : void 0;
|
|
5342
5351
|
}
|
|
5343
|
-
if (((
|
|
5352
|
+
if (((_z = options.ensureAuthorizationToken) == null ? void 0 : _z.platform) && !headers.platform.token) {
|
|
5344
5353
|
throw new UnauthorizeApiError("accounts");
|
|
5345
5354
|
}
|
|
5346
|
-
if (((
|
|
5355
|
+
if (((_A = options.ensureAuthorizationToken) == null ? void 0 : _A.github) && (!headers.integrations.github.app || !headers.integrations.github.oauth)) {
|
|
5347
5356
|
throw new UnauthorizeApiError("github");
|
|
5348
5357
|
}
|
|
5349
|
-
if (((
|
|
5358
|
+
if (((_B = options.ensureAuthorizationToken) == null ? void 0 : _B.vercel) && !headers.integrations.vercel) {
|
|
5350
5359
|
throw new UnauthorizeApiError("vercel");
|
|
5351
5360
|
}
|
|
5352
|
-
if (((
|
|
5361
|
+
if (((_C = options.ensureAuthorizationToken) == null ? void 0 : _C.netlify) && !headers.integrations.netlify) {
|
|
5353
5362
|
throw new UnauthorizeApiError("netlify");
|
|
5354
5363
|
}
|
|
5355
|
-
if (((
|
|
5364
|
+
if (((_D = options.ensureAuthorizationToken) == null ? void 0 : _D.planetscale) && !headers.integrations.planetscale) {
|
|
5356
5365
|
throw new UnauthorizeApiError("planetscale");
|
|
5357
5366
|
}
|
|
5358
|
-
if (((
|
|
5367
|
+
if (((_E = options.ensureAuthorizationToken) == null ? void 0 : _E.neon) && !headers.integrations.neon) {
|
|
5359
5368
|
throw new UnauthorizeApiError("neon");
|
|
5360
5369
|
}
|
|
5361
|
-
if (((
|
|
5370
|
+
if (((_F = options.ensureAuthorizationToken) == null ? void 0 : _F.mailchimp) && (!headers.integrations.mailchimp || !headers.integrations.mailchimpServer)) {
|
|
5362
5371
|
throw new UnauthorizeApiError("mailchimp");
|
|
5363
5372
|
}
|
|
5364
|
-
if (((
|
|
5373
|
+
if (((_G = options.ensureAuthorizationToken) == null ? void 0 : _G.shopify) && (!headers.integrations.shopify || !headers.integrations.shopifyShop)) {
|
|
5365
5374
|
throw new UnauthorizeApiError("shopify");
|
|
5366
5375
|
}
|
|
5376
|
+
if (((_H = options.ensureAuthorizationToken) == null ? void 0 : _H.text) && !headers.integrations.text) {
|
|
5377
|
+
throw new UnauthorizeApiError("text");
|
|
5378
|
+
}
|
|
5367
5379
|
return {
|
|
5368
|
-
headers: __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 } : {})
|
|
5380
|
+
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 } : {})
|
|
5369
5381
|
};
|
|
5370
5382
|
}
|
|
5371
5383
|
var getPlatformAdapterClientDefaultConfig = (authorization) => getPlatformAdapterClientConfig(__spreadProps(__spreadValues({}, authorization), {
|
|
@@ -5388,7 +5400,7 @@ function initPlatformAdapterClient(baseUrl, tokens) {
|
|
|
5388
5400
|
}
|
|
5389
5401
|
}
|
|
5390
5402
|
function updatePlatformAdapterClient(tokens) {
|
|
5391
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k;
|
|
5403
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l;
|
|
5392
5404
|
const headers = platformAdapterClientInstance.defaults.headers;
|
|
5393
5405
|
if ((_a = tokens == null ? void 0 : tokens.platform) == null ? void 0 : _a.token) {
|
|
5394
5406
|
headers["x-adapter-platform-token"] = tokens.platform.token;
|
|
@@ -5423,6 +5435,9 @@ function updatePlatformAdapterClient(tokens) {
|
|
|
5423
5435
|
if ((_k = tokens == null ? void 0 : tokens.shopify) == null ? void 0 : _k.token) {
|
|
5424
5436
|
headers["x-adapter-shopify-token"] = tokens.shopify.token;
|
|
5425
5437
|
}
|
|
5438
|
+
if ((_l = tokens == null ? void 0 : tokens.text) == null ? void 0 : _l.token) {
|
|
5439
|
+
headers["x-adapter-text-token"] = tokens.text.token;
|
|
5440
|
+
}
|
|
5426
5441
|
}
|
|
5427
5442
|
|
|
5428
5443
|
// src/apis/platform/adapter/app/blocks/authorization/api.ts
|