@wix/sdk 1.12.10 → 1.12.12
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/build/ambassador-modules.d.ts +0 -2
- package/build/ambassador-modules.js +0 -3
- package/build/auth/oauth2/OAuthStrategy.js +2 -2
- package/build/common.d.ts +1 -2
- package/build/common.js +1 -2
- package/build/host-modules.js +1 -2
- package/build/index.d.ts +1 -2
- package/build/index.js +1 -2
- package/build/rest-modules.d.ts +0 -1
- package/build/rest-modules.js +8 -6
- package/build/wixClient.js +15 -15
- package/cjs/build/ambassador-modules.d.ts +0 -2
- package/cjs/build/ambassador-modules.js +1 -5
- package/cjs/build/auth/oauth2/OAuthStrategy.js +1 -1
- package/cjs/build/common.d.ts +1 -2
- package/cjs/build/common.js +2 -3
- package/cjs/build/host-modules.js +1 -2
- package/cjs/build/index.d.ts +1 -2
- package/cjs/build/index.js +2 -4
- package/cjs/build/rest-modules.d.ts +0 -1
- package/cjs/build/rest-modules.js +8 -7
- package/cjs/build/wixClient.js +13 -13
- package/package.json +5 -5
|
@@ -1,5 +1,3 @@
|
|
|
1
1
|
import type { HttpClient as SDKHttpClient, AmbassadorFactory } from '@wix/sdk-types';
|
|
2
|
-
import { RESTModuleOptions } from './rest-modules.js';
|
|
3
2
|
export declare const toHTTPModule: <Request_1, Response_1>(factory: AmbassadorFactory<Request_1, Response_1>) => (httpClient: SDKHttpClient) => (payload: Request_1) => Promise<Response_1>;
|
|
4
|
-
export declare const ambassadorModuleOptions: () => RESTModuleOptions;
|
|
5
3
|
export declare const isAmbassadorModule: (module: any) => boolean;
|
|
@@ -73,9 +73,6 @@ export const toHTTPModule = (factory) => (httpClient) => async (payload) => {
|
|
|
73
73
|
throw e;
|
|
74
74
|
}
|
|
75
75
|
};
|
|
76
|
-
export const ambassadorModuleOptions = () => ({
|
|
77
|
-
HTTPHost: self.location.host,
|
|
78
|
-
});
|
|
79
76
|
/*
|
|
80
77
|
* Because of issues with tree-shaking, we cant really put static parameter on module.
|
|
81
78
|
* We still have check for __isAmbassador for backward compatibility
|
|
@@ -2,7 +2,7 @@ import { createClient } from '../../wixClient.js';
|
|
|
2
2
|
import { redirects } from '@wix/redirects';
|
|
3
3
|
import { createAccessToken, isTokenExpired } from '../../tokenHelpers.js';
|
|
4
4
|
import { authentication, recovery, verification } from '@wix/identity';
|
|
5
|
-
import {
|
|
5
|
+
import { DEFAULT_API_URL } from '../../common.js';
|
|
6
6
|
import { LoginState, TokenRole, } from './types.js';
|
|
7
7
|
import { addPostMessageListener, loadFrame } from '../../iframeUtils.js';
|
|
8
8
|
import { EMAIL_EXISTS, INVALID_CAPTCHA, INVALID_PASSWORD, MISSING_CAPTCHA, RESET_PASSWORD, } from './constants.js';
|
|
@@ -358,7 +358,7 @@ export function OAuthStrategy(config) {
|
|
|
358
358
|
};
|
|
359
359
|
}
|
|
360
360
|
const fetchTokens = async (payload, headers = {}) => {
|
|
361
|
-
const res = await fetch(`https://${
|
|
361
|
+
const res = await fetch(`https://${DEFAULT_API_URL}/oauth2/token`, {
|
|
362
362
|
method: 'POST',
|
|
363
363
|
body: JSON.stringify(payload),
|
|
364
364
|
headers: {
|
package/build/common.d.ts
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
1
|
export declare const PUBLIC_METADATA_KEY = "__metadata";
|
|
2
|
-
export declare const
|
|
3
|
-
export declare const READ_ONLY_API_URL = "readonly.wixapis.com";
|
|
2
|
+
export declare const DEFAULT_API_URL = "www.wixapis.com";
|
|
4
3
|
export declare const FORCE_WRITE_API_URLS: string[];
|
package/build/common.js
CHANGED
package/build/host-modules.js
CHANGED
package/build/index.d.ts
CHANGED
|
@@ -5,5 +5,4 @@ export * from './auth/oauth2/types.js';
|
|
|
5
5
|
export * from './auth/ApiKeyAuthStrategy.js';
|
|
6
6
|
export * from './auth/AppStrategy.js';
|
|
7
7
|
export * from '@wix/sdk-types';
|
|
8
|
-
export {
|
|
9
|
-
export { API_URL } from './common.js';
|
|
8
|
+
export { DEFAULT_API_URL } from './common.js';
|
package/build/index.js
CHANGED
|
@@ -5,5 +5,4 @@ export * from './auth/oauth2/types.js';
|
|
|
5
5
|
export * from './auth/ApiKeyAuthStrategy.js';
|
|
6
6
|
export * from './auth/AppStrategy.js';
|
|
7
7
|
export * from '@wix/sdk-types';
|
|
8
|
-
export {
|
|
9
|
-
export { API_URL } from './common.js';
|
|
8
|
+
export { DEFAULT_API_URL } from './common.js';
|
package/build/rest-modules.d.ts
CHANGED
|
@@ -2,5 +2,4 @@ import { BuildRESTFunction, PublicMetadata, RESTFunctionDescriptor } from '@wix/
|
|
|
2
2
|
export type RESTModuleOptions = {
|
|
3
3
|
HTTPHost?: string;
|
|
4
4
|
};
|
|
5
|
-
export declare const getDefaultDomain: (_method: string, _url: string) => string;
|
|
6
5
|
export declare function buildRESTDescriptor<T extends RESTFunctionDescriptor>(origFunc: T, publicMetadata: PublicMetadata, boundFetch: typeof fetch, wixAPIFetch: (relativeUrl: string, options: RequestInit) => Promise<Response>, options?: RESTModuleOptions): BuildRESTFunction<T>;
|
package/build/rest-modules.js
CHANGED
|
@@ -1,17 +1,19 @@
|
|
|
1
1
|
import { biHeaderGenerator } from './bi/biHeaderGenerator.js';
|
|
2
|
-
import {
|
|
3
|
-
|
|
2
|
+
import { DEFAULT_API_URL } from './common.js';
|
|
3
|
+
import { runWithoutContext } from '@wix/sdk-runtime/context';
|
|
4
4
|
export function buildRESTDescriptor(origFunc, publicMetadata, boundFetch, wixAPIFetch, options) {
|
|
5
|
-
return origFunc({
|
|
5
|
+
return runWithoutContext(() => origFunc({
|
|
6
6
|
request: async (factory) => {
|
|
7
|
-
const requestOptions = factory({
|
|
7
|
+
const requestOptions = factory({
|
|
8
|
+
host: options?.HTTPHost || DEFAULT_API_URL,
|
|
9
|
+
});
|
|
8
10
|
let request = requestOptions;
|
|
9
11
|
if (request.method === 'GET' &&
|
|
10
12
|
request.fallback?.length &&
|
|
11
13
|
request.params.toString().length > 4000) {
|
|
12
14
|
request = requestOptions.fallback[0];
|
|
13
15
|
}
|
|
14
|
-
const domain = options?.HTTPHost ??
|
|
16
|
+
const domain = options?.HTTPHost ?? DEFAULT_API_URL;
|
|
15
17
|
let url = `https://${domain}${request.url}`;
|
|
16
18
|
if (request.params && request.params.toString()) {
|
|
17
19
|
url += `?${request.params.toString()}`;
|
|
@@ -57,7 +59,7 @@ export function buildRESTDescriptor(origFunc, publicMetadata, boundFetch, wixAPI
|
|
|
57
59
|
},
|
|
58
60
|
fetchWithAuth: boundFetch,
|
|
59
61
|
wixAPIFetch,
|
|
60
|
-
});
|
|
62
|
+
}));
|
|
61
63
|
}
|
|
62
64
|
const errorBuilder = (code, description, details, data) => {
|
|
63
65
|
return {
|
package/build/wixClient.js
CHANGED
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
import { wixContext } from '@wix/sdk-context';
|
|
2
2
|
import { SERVICE_PLUGIN_ERROR_TYPE, } from '@wix/sdk-types';
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
3
|
+
import { isAmbassadorModule, toHTTPModule } from './ambassador-modules.js';
|
|
4
|
+
import { DEFAULT_API_URL, PUBLIC_METADATA_KEY } from './common.js';
|
|
5
5
|
import { FetchErrorResponse } from './fetch-error.js';
|
|
6
6
|
import { getDefaultContentHeader, isObject } from './helpers.js';
|
|
7
7
|
import { buildHostModule, isHostModule } from './host-modules.js';
|
|
8
8
|
import { buildRESTDescriptor } from './rest-modules.js';
|
|
9
9
|
import { eventHandlersModules, isEventHandlerModule, } from './event-handlers-modules.js';
|
|
10
10
|
import { isServicePluginModule, servicePluginsModules, } from './service-plugin-modules.js';
|
|
11
|
+
import { runWithoutContext } from '@wix/sdk-runtime/context';
|
|
11
12
|
export function createClient(config) {
|
|
12
13
|
const _headers = config.headers || { Authorization: '' };
|
|
13
14
|
const authStrategy = config.auth ||
|
|
@@ -51,18 +52,15 @@ export function createClient(config) {
|
|
|
51
52
|
if ('__type' in modules && modules.__type === SERVICE_PLUGIN_ERROR_TYPE) {
|
|
52
53
|
return modules;
|
|
53
54
|
}
|
|
54
|
-
const
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
return buildRESTDescriptor(module, metadata ?? {}, boundFetch, (relativeUrl, fetchOptions) => {
|
|
61
|
-
const finalUrl = new URL(relativeUrl, `https://${API_URL}`);
|
|
62
|
-
finalUrl.host = API_URL;
|
|
55
|
+
const apiBaseUrl = config.host?.apiBaseUrl ?? DEFAULT_API_URL;
|
|
56
|
+
return buildRESTDescriptor(runWithoutContext(() => isAmbassadorModule(modules))
|
|
57
|
+
? toHTTPModule(modules)
|
|
58
|
+
: modules, metadata ?? {}, boundFetch, (relativeUrl, fetchOptions) => {
|
|
59
|
+
const finalUrl = new URL(relativeUrl, `https://${apiBaseUrl}`);
|
|
60
|
+
finalUrl.host = apiBaseUrl;
|
|
63
61
|
finalUrl.protocol = 'https';
|
|
64
62
|
return boundFetch(finalUrl.toString(), fetchOptions);
|
|
65
|
-
},
|
|
63
|
+
}, { HTTPHost: apiBaseUrl });
|
|
66
64
|
}
|
|
67
65
|
else if (isObject(modules)) {
|
|
68
66
|
return Object.fromEntries(Object.entries(modules).map(([key, value]) => {
|
|
@@ -115,8 +113,9 @@ export function createClient(config) {
|
|
|
115
113
|
}
|
|
116
114
|
},
|
|
117
115
|
fetch: (relativeUrl, options) => {
|
|
118
|
-
const
|
|
119
|
-
finalUrl
|
|
116
|
+
const apiBaseUrl = config.host?.apiBaseUrl ?? DEFAULT_API_URL;
|
|
117
|
+
const finalUrl = new URL(relativeUrl, `https://${apiBaseUrl}`);
|
|
118
|
+
finalUrl.host = apiBaseUrl;
|
|
120
119
|
finalUrl.protocol = 'https';
|
|
121
120
|
return boundFetch(finalUrl.toString(), options);
|
|
122
121
|
},
|
|
@@ -140,7 +139,8 @@ export function createClient(config) {
|
|
|
140
139
|
async graphql(query, variables, opts = {
|
|
141
140
|
apiVersion: 'alpha',
|
|
142
141
|
}) {
|
|
143
|
-
const
|
|
142
|
+
const apiBaseUrl = config?.host?.apiBaseUrl ?? DEFAULT_API_URL;
|
|
143
|
+
const res = await boundFetch(`https://${apiBaseUrl}/graphql/${opts.apiVersion}`, {
|
|
144
144
|
method: 'POST',
|
|
145
145
|
headers: {
|
|
146
146
|
'Content-Type': 'application/json',
|
|
@@ -1,5 +1,3 @@
|
|
|
1
1
|
import type { HttpClient as SDKHttpClient, AmbassadorFactory } from '@wix/sdk-types';
|
|
2
|
-
import { RESTModuleOptions } from './rest-modules.js';
|
|
3
2
|
export declare const toHTTPModule: <Request_1, Response_1>(factory: AmbassadorFactory<Request_1, Response_1>) => (httpClient: SDKHttpClient) => (payload: Request_1) => Promise<Response_1>;
|
|
4
|
-
export declare const ambassadorModuleOptions: () => RESTModuleOptions;
|
|
5
3
|
export declare const isAmbassadorModule: (module: any) => boolean;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.isAmbassadorModule = exports.
|
|
3
|
+
exports.isAmbassadorModule = exports.toHTTPModule = void 0;
|
|
4
4
|
const parseMethod = (method) => {
|
|
5
5
|
switch (method) {
|
|
6
6
|
case 'get':
|
|
@@ -77,10 +77,6 @@ const toHTTPModule = (factory) => (httpClient) => async (payload) => {
|
|
|
77
77
|
}
|
|
78
78
|
};
|
|
79
79
|
exports.toHTTPModule = toHTTPModule;
|
|
80
|
-
const ambassadorModuleOptions = () => ({
|
|
81
|
-
HTTPHost: self.location.host,
|
|
82
|
-
});
|
|
83
|
-
exports.ambassadorModuleOptions = ambassadorModuleOptions;
|
|
84
80
|
/*
|
|
85
81
|
* Because of issues with tree-shaking, we cant really put static parameter on module.
|
|
86
82
|
* We still have check for __isAmbassador for backward compatibility
|
|
@@ -362,7 +362,7 @@ function OAuthStrategy(config) {
|
|
|
362
362
|
}
|
|
363
363
|
exports.OAuthStrategy = OAuthStrategy;
|
|
364
364
|
const fetchTokens = async (payload, headers = {}) => {
|
|
365
|
-
const res = await fetch(`https://${common_js_1.
|
|
365
|
+
const res = await fetch(`https://${common_js_1.DEFAULT_API_URL}/oauth2/token`, {
|
|
366
366
|
method: 'POST',
|
|
367
367
|
body: JSON.stringify(payload),
|
|
368
368
|
headers: {
|
package/cjs/build/common.d.ts
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
1
|
export declare const PUBLIC_METADATA_KEY = "__metadata";
|
|
2
|
-
export declare const
|
|
3
|
-
export declare const READ_ONLY_API_URL = "readonly.wixapis.com";
|
|
2
|
+
export declare const DEFAULT_API_URL = "www.wixapis.com";
|
|
4
3
|
export declare const FORCE_WRITE_API_URLS: string[];
|
package/cjs/build/common.js
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.FORCE_WRITE_API_URLS = exports.
|
|
3
|
+
exports.FORCE_WRITE_API_URLS = exports.DEFAULT_API_URL = exports.PUBLIC_METADATA_KEY = void 0;
|
|
4
4
|
exports.PUBLIC_METADATA_KEY = '__metadata';
|
|
5
|
-
exports.
|
|
6
|
-
exports.READ_ONLY_API_URL = 'readonly.wixapis.com';
|
|
5
|
+
exports.DEFAULT_API_URL = 'www.wixapis.com';
|
|
7
6
|
exports.FORCE_WRITE_API_URLS = ['/ecom/v1/carts/current'];
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.buildHostModule = exports.isHostModule = void 0;
|
|
4
|
-
const
|
|
5
|
-
const isHostModule = (val) => (0, helpers_js_1.isObject)(val) && val.__type === 'host';
|
|
4
|
+
const isHostModule = (val) => val.__type === 'host';
|
|
6
5
|
exports.isHostModule = isHostModule;
|
|
7
6
|
function buildHostModule(val, host) {
|
|
8
7
|
return val.create(host);
|
package/cjs/build/index.d.ts
CHANGED
|
@@ -5,5 +5,4 @@ export * from './auth/oauth2/types.js';
|
|
|
5
5
|
export * from './auth/ApiKeyAuthStrategy.js';
|
|
6
6
|
export * from './auth/AppStrategy.js';
|
|
7
7
|
export * from '@wix/sdk-types';
|
|
8
|
-
export {
|
|
9
|
-
export { API_URL } from './common.js';
|
|
8
|
+
export { DEFAULT_API_URL } from './common.js';
|
package/cjs/build/index.js
CHANGED
|
@@ -14,7 +14,7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
14
14
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
exports.
|
|
17
|
+
exports.DEFAULT_API_URL = void 0;
|
|
18
18
|
__exportStar(require("./wixClient.js"), exports);
|
|
19
19
|
__exportStar(require("./wixMedia.js"), exports);
|
|
20
20
|
__exportStar(require("./auth/oauth2/OAuthStrategy.js"), exports);
|
|
@@ -22,7 +22,5 @@ __exportStar(require("./auth/oauth2/types.js"), exports);
|
|
|
22
22
|
__exportStar(require("./auth/ApiKeyAuthStrategy.js"), exports);
|
|
23
23
|
__exportStar(require("./auth/AppStrategy.js"), exports);
|
|
24
24
|
__exportStar(require("@wix/sdk-types"), exports);
|
|
25
|
-
var rest_modules_js_1 = require("./rest-modules.js");
|
|
26
|
-
Object.defineProperty(exports, "getDefaultDomain", { enumerable: true, get: function () { return rest_modules_js_1.getDefaultDomain; } });
|
|
27
25
|
var common_js_1 = require("./common.js");
|
|
28
|
-
Object.defineProperty(exports, "
|
|
26
|
+
Object.defineProperty(exports, "DEFAULT_API_URL", { enumerable: true, get: function () { return common_js_1.DEFAULT_API_URL; } });
|
|
@@ -2,5 +2,4 @@ import { BuildRESTFunction, PublicMetadata, RESTFunctionDescriptor } from '@wix/
|
|
|
2
2
|
export type RESTModuleOptions = {
|
|
3
3
|
HTTPHost?: string;
|
|
4
4
|
};
|
|
5
|
-
export declare const getDefaultDomain: (_method: string, _url: string) => string;
|
|
6
5
|
export declare function buildRESTDescriptor<T extends RESTFunctionDescriptor>(origFunc: T, publicMetadata: PublicMetadata, boundFetch: typeof fetch, wixAPIFetch: (relativeUrl: string, options: RequestInit) => Promise<Response>, options?: RESTModuleOptions): BuildRESTFunction<T>;
|
|
@@ -1,21 +1,22 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.buildRESTDescriptor =
|
|
3
|
+
exports.buildRESTDescriptor = void 0;
|
|
4
4
|
const biHeaderGenerator_js_1 = require("./bi/biHeaderGenerator.js");
|
|
5
5
|
const common_js_1 = require("./common.js");
|
|
6
|
-
const
|
|
7
|
-
exports.getDefaultDomain = getDefaultDomain;
|
|
6
|
+
const context_1 = require("@wix/sdk-runtime/context");
|
|
8
7
|
function buildRESTDescriptor(origFunc, publicMetadata, boundFetch, wixAPIFetch, options) {
|
|
9
|
-
return origFunc({
|
|
8
|
+
return (0, context_1.runWithoutContext)(() => origFunc({
|
|
10
9
|
request: async (factory) => {
|
|
11
|
-
const requestOptions = factory({
|
|
10
|
+
const requestOptions = factory({
|
|
11
|
+
host: options?.HTTPHost || common_js_1.DEFAULT_API_URL,
|
|
12
|
+
});
|
|
12
13
|
let request = requestOptions;
|
|
13
14
|
if (request.method === 'GET' &&
|
|
14
15
|
request.fallback?.length &&
|
|
15
16
|
request.params.toString().length > 4000) {
|
|
16
17
|
request = requestOptions.fallback[0];
|
|
17
18
|
}
|
|
18
|
-
const domain = options?.HTTPHost ??
|
|
19
|
+
const domain = options?.HTTPHost ?? common_js_1.DEFAULT_API_URL;
|
|
19
20
|
let url = `https://${domain}${request.url}`;
|
|
20
21
|
if (request.params && request.params.toString()) {
|
|
21
22
|
url += `?${request.params.toString()}`;
|
|
@@ -61,7 +62,7 @@ function buildRESTDescriptor(origFunc, publicMetadata, boundFetch, wixAPIFetch,
|
|
|
61
62
|
},
|
|
62
63
|
fetchWithAuth: boundFetch,
|
|
63
64
|
wixAPIFetch,
|
|
64
|
-
});
|
|
65
|
+
}));
|
|
65
66
|
}
|
|
66
67
|
exports.buildRESTDescriptor = buildRESTDescriptor;
|
|
67
68
|
const errorBuilder = (code, description, details, data) => {
|
package/cjs/build/wixClient.js
CHANGED
|
@@ -11,6 +11,7 @@ const host_modules_js_1 = require("./host-modules.js");
|
|
|
11
11
|
const rest_modules_js_1 = require("./rest-modules.js");
|
|
12
12
|
const event_handlers_modules_js_1 = require("./event-handlers-modules.js");
|
|
13
13
|
const service_plugin_modules_js_1 = require("./service-plugin-modules.js");
|
|
14
|
+
const context_1 = require("@wix/sdk-runtime/context");
|
|
14
15
|
function createClient(config) {
|
|
15
16
|
const _headers = config.headers || { Authorization: '' };
|
|
16
17
|
const authStrategy = config.auth ||
|
|
@@ -54,18 +55,15 @@ function createClient(config) {
|
|
|
54
55
|
if ('__type' in modules && modules.__type === sdk_types_1.SERVICE_PLUGIN_ERROR_TYPE) {
|
|
55
56
|
return modules;
|
|
56
57
|
}
|
|
57
|
-
const
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
return (0, rest_modules_js_1.buildRESTDescriptor)(module, metadata ?? {}, boundFetch, (relativeUrl, fetchOptions) => {
|
|
64
|
-
const finalUrl = new URL(relativeUrl, `https://${common_js_1.API_URL}`);
|
|
65
|
-
finalUrl.host = common_js_1.API_URL;
|
|
58
|
+
const apiBaseUrl = config.host?.apiBaseUrl ?? common_js_1.DEFAULT_API_URL;
|
|
59
|
+
return (0, rest_modules_js_1.buildRESTDescriptor)((0, context_1.runWithoutContext)(() => (0, ambassador_modules_js_1.isAmbassadorModule)(modules))
|
|
60
|
+
? (0, ambassador_modules_js_1.toHTTPModule)(modules)
|
|
61
|
+
: modules, metadata ?? {}, boundFetch, (relativeUrl, fetchOptions) => {
|
|
62
|
+
const finalUrl = new URL(relativeUrl, `https://${apiBaseUrl}`);
|
|
63
|
+
finalUrl.host = apiBaseUrl;
|
|
66
64
|
finalUrl.protocol = 'https';
|
|
67
65
|
return boundFetch(finalUrl.toString(), fetchOptions);
|
|
68
|
-
},
|
|
66
|
+
}, { HTTPHost: apiBaseUrl });
|
|
69
67
|
}
|
|
70
68
|
else if ((0, helpers_js_1.isObject)(modules)) {
|
|
71
69
|
return Object.fromEntries(Object.entries(modules).map(([key, value]) => {
|
|
@@ -118,8 +116,9 @@ function createClient(config) {
|
|
|
118
116
|
}
|
|
119
117
|
},
|
|
120
118
|
fetch: (relativeUrl, options) => {
|
|
121
|
-
const
|
|
122
|
-
finalUrl
|
|
119
|
+
const apiBaseUrl = config.host?.apiBaseUrl ?? common_js_1.DEFAULT_API_URL;
|
|
120
|
+
const finalUrl = new URL(relativeUrl, `https://${apiBaseUrl}`);
|
|
121
|
+
finalUrl.host = apiBaseUrl;
|
|
123
122
|
finalUrl.protocol = 'https';
|
|
124
123
|
return boundFetch(finalUrl.toString(), options);
|
|
125
124
|
},
|
|
@@ -143,7 +142,8 @@ function createClient(config) {
|
|
|
143
142
|
async graphql(query, variables, opts = {
|
|
144
143
|
apiVersion: 'alpha',
|
|
145
144
|
}) {
|
|
146
|
-
const
|
|
145
|
+
const apiBaseUrl = config?.host?.apiBaseUrl ?? common_js_1.DEFAULT_API_URL;
|
|
146
|
+
const res = await boundFetch(`https://${apiBaseUrl}/graphql/${opts.apiVersion}`, {
|
|
147
147
|
method: 'POST',
|
|
148
148
|
headers: {
|
|
149
149
|
'Content-Type': 'application/json',
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wix/sdk",
|
|
3
|
-
"version": "1.12.
|
|
3
|
+
"version": "1.12.12",
|
|
4
4
|
"license": "UNLICENSED",
|
|
5
5
|
"author": {
|
|
6
6
|
"name": "Ronny Ringel",
|
|
@@ -68,8 +68,8 @@
|
|
|
68
68
|
"@wix/image-kit": "^1.78.0",
|
|
69
69
|
"@wix/redirects": "^1.0.41",
|
|
70
70
|
"@wix/sdk-context": "^0.0.1",
|
|
71
|
-
"@wix/sdk-runtime": "0.3.
|
|
72
|
-
"@wix/sdk-types": "^1.9.
|
|
71
|
+
"@wix/sdk-runtime": "0.3.16",
|
|
72
|
+
"@wix/sdk-types": "^1.9.3",
|
|
73
73
|
"crypto-js": "^4.2.0",
|
|
74
74
|
"jose": "^5.2.1",
|
|
75
75
|
"pkce-challenge": "^3.1.0",
|
|
@@ -88,7 +88,7 @@
|
|
|
88
88
|
"@wix/events": "^1.0.179",
|
|
89
89
|
"@wix/metro": "^1.0.73",
|
|
90
90
|
"@wix/metro-runtime": "^1.1677.0",
|
|
91
|
-
"@wix/sdk-runtime": "0.3.
|
|
91
|
+
"@wix/sdk-runtime": "0.3.16",
|
|
92
92
|
"eslint": "^8.56.0",
|
|
93
93
|
"eslint-config-sdk": "0.0.0",
|
|
94
94
|
"graphql": "^16.8.0",
|
|
@@ -122,5 +122,5 @@
|
|
|
122
122
|
"wallaby": {
|
|
123
123
|
"autoDetect": true
|
|
124
124
|
},
|
|
125
|
-
"falconPackageHash": "
|
|
125
|
+
"falconPackageHash": "f3b508939b9d735e1177597d5a97d63c38940489f5e1b11c4f54c93b"
|
|
126
126
|
}
|