@wix/sdk
Advanced tools
Comparing version
@@ -35,3 +35,3 @@ "use strict"; | ||
const config = { | ||
const _config = { | ||
domain: '' | ||
@@ -41,3 +41,3 @@ }; | ||
async function session(tokens = {}, configParam) { | ||
config.domain = configParam.domain; | ||
_config.domain = configParam.domain; | ||
@@ -54,3 +54,3 @@ if (tokens.accessToken && !isTokenExpired(tokens.accessToken)) { | ||
headers: { | ||
origin: config.domain, | ||
origin: _config.domain, | ||
'Content-Type': 'application/json', | ||
@@ -95,4 +95,4 @@ ...(tokens.refreshToken && { | ||
}), | ||
headers: { ...(config.domain && { | ||
origin: config.domain | ||
headers: { ...(_config.domain && { | ||
origin: _config.domain | ||
}), | ||
@@ -111,8 +111,8 @@ 'Content-Type': 'application/json', | ||
function createClient(modules) { | ||
if (!modules || Object.entries(modules).length < 1) { | ||
function createClient(config) { | ||
if (!config.modules || Object.entries(config.modules).length < 1) { | ||
throw new Error('Missing modules'); | ||
} | ||
const _headers = { | ||
const _headers = config.headers || { | ||
Authorization: '' | ||
@@ -137,3 +137,3 @@ }; | ||
const wrappedModules = traverse(modules); | ||
const wrappedModules = traverse(config.modules); | ||
return { ...wrappedModules, | ||
@@ -140,0 +140,0 @@ setSession: sessionParams => { |
@@ -31,3 +31,3 @@ import _extends from "@babel/runtime/helpers/extends"; | ||
const config = { | ||
const _config = { | ||
domain: '' | ||
@@ -40,3 +40,3 @@ }; | ||
config.domain = configParam.domain; | ||
_config.domain = configParam.domain; | ||
@@ -53,3 +53,3 @@ if (tokens.accessToken && !isTokenExpired(tokens.accessToken)) { | ||
headers: _extends({ | ||
origin: config.domain, | ||
origin: _config.domain, | ||
'Content-Type': 'application/json' | ||
@@ -93,4 +93,4 @@ }, tokens.refreshToken && { | ||
}, { | ||
headers: _extends({}, config.domain && { | ||
origin: config.domain | ||
headers: _extends({}, _config.domain && { | ||
origin: _config.domain | ||
}, { | ||
@@ -108,8 +108,8 @@ 'Content-Type': 'application/json' | ||
export function createClient(modules) { | ||
if (!modules || Object.entries(modules).length < 1) { | ||
export function createClient(config) { | ||
if (!config.modules || Object.entries(config.modules).length < 1) { | ||
throw new Error('Missing modules'); | ||
} | ||
const _headers = { | ||
const _headers = config.headers || { | ||
Authorization: '' | ||
@@ -137,3 +137,3 @@ }; | ||
const wrappedModules = traverse(modules); | ||
const wrappedModules = traverse(config.modules); | ||
return _extends({}, wrappedModules, { | ||
@@ -140,0 +140,0 @@ setSession: sessionParams => { |
@@ -20,4 +20,7 @@ import { Simplify } from 'type-fest'; | ||
}): Promise<SessionParams>; | ||
export declare function createClient<T = any>(modules: T): WithoutFunctionWrapper<T> & IWrapper; | ||
export declare function createClient<T = any>(config: { | ||
modules: T; | ||
headers?: Headers; | ||
}): WithoutFunctionWrapper<T> & IWrapper; | ||
export {}; | ||
//# sourceMappingURL=wixClient.d.ts.map |
{ | ||
"name": "@wix/sdk", | ||
"version": "1.1.10", | ||
"version": "1.1.11", | ||
"license": "UNLICENSED", | ||
@@ -32,3 +32,3 @@ "author": { | ||
"@wix/image-kit": "^1.23.0", | ||
"@wix/sdk-types": "^1.1.10", | ||
"@wix/sdk-types": "^1.1.11", | ||
"querystring": "^0.2.1", | ||
@@ -69,3 +69,3 @@ "type-fest": "^2.19.0" | ||
}, | ||
"falconPackageHash": "edaf435802f28b7570ef53e96c73bc16986e2288d34a19315b57121e" | ||
"falconPackageHash": "078e22ec505f5b7aeaff18a2798632293677d0ed8965ff7dc2b64f37" | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
112867
0.39%447
0.68%Updated