@wix/sdk 1.14.1 → 1.14.2

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.
@@ -1,3 +1,3 @@
1
1
  import type { HttpClient as SDKHttpClient, AmbassadorFactory } from '@wix/sdk-types';
2
- export declare const toHTTPModule: <Request_1, Response_1>(factory: AmbassadorFactory<Request_1, Response_1>) => (httpClient: SDKHttpClient) => (payload: Request_1) => Promise<Response_1>;
2
+ export declare const toHTTPModule: <Request, Response>(factory: AmbassadorFactory<Request, Response>) => (httpClient: SDKHttpClient) => (payload: Request) => Promise<Response>;
3
3
  export declare const isAmbassadorModule: (module: any) => boolean;
@@ -1,11 +1,11 @@
1
1
  import { APIMetadata, PublicMetadata } from '@wix/sdk-types';
2
2
  export declare const WixBIHeaderName = "x-wix-bi-gateway";
3
3
  export type WixBIHeaderValues = {
4
- ['environment']: 'js-sdk';
4
+ ['environment']: 'js-sdk' | string;
5
5
  ['package-name']?: string;
6
6
  ['method-fqn']?: string;
7
7
  ['entity']?: string;
8
8
  };
9
- export declare function biHeaderGenerator(apiMetadata: APIMetadata, publicMetadata?: PublicMetadata): {
9
+ export declare function biHeaderGenerator(apiMetadata: APIMetadata, publicMetadata?: PublicMetadata, environment?: string): {
10
10
  [WixBIHeaderName]: string;
11
11
  };
@@ -1,8 +1,8 @@
1
1
  export const WixBIHeaderName = 'x-wix-bi-gateway';
2
- export function biHeaderGenerator(apiMetadata, publicMetadata) {
2
+ export function biHeaderGenerator(apiMetadata, publicMetadata, environment) {
3
3
  return {
4
4
  [WixBIHeaderName]: objectToKeyValue({
5
- environment: 'js-sdk',
5
+ environment: `js-sdk${environment ? `-${environment}` : ``}`,
6
6
  'package-name': apiMetadata.packageName ?? publicMetadata?.PACKAGE_NAME,
7
7
  'method-fqn': apiMetadata.methodFqn,
8
8
  entity: apiMetadata.entityFqdn,
@@ -16,14 +16,14 @@ export type TypedQueryInput<Result = {
16
16
  */
17
17
  __ensureTypesOfVariablesAndResultMatching?: (variables: Variables) => Result;
18
18
  };
19
- export declare const graphql: (<Result, Variables>(query: string | String | DocumentNode | TypedQueryInput<Result, Variables>, variables?: Variables | undefined, opts?: {
19
+ export declare const graphql: (<Result, Variables>(query: string | String | DocumentNode | TypedQueryInput<Result, Variables>, variables?: Variables, opts?: {
20
20
  apiVersion: string;
21
21
  }) => Promise<{
22
22
  data: Result;
23
- errors?: GraphQLFormattedError[] | undefined;
24
- }>) & RESTFunctionDescriptor<(<Result, Variables>(query: string | String | DocumentNode | TypedQueryInput<Result, Variables>, variables?: Variables | undefined, opts?: {
23
+ errors?: GraphQLFormattedError[];
24
+ }>) & RESTFunctionDescriptor<(<Result, Variables>(query: string | String | DocumentNode | TypedQueryInput<Result, Variables>, variables?: Variables, opts?: {
25
25
  apiVersion: string;
26
26
  }) => Promise<{
27
27
  data: Result;
28
- errors?: GraphQLFormattedError[] | undefined;
28
+ errors?: GraphQLFormattedError[];
29
29
  }>)>;
@@ -1,5 +1,5 @@
1
1
  export declare const getDefaultContentHeader: (options: RequestInit | undefined) => {
2
- 'Content-Type'?: string;
2
+ "Content-Type"?: string;
3
3
  };
4
4
  export declare const isObject: (val: any) => val is Object;
5
5
  export declare function parsePublicKeyIfEncoded(publicKey: string): string;
@@ -2,4 +2,4 @@ import { BuildRESTFunction, PublicMetadata, RESTFunctionDescriptor } from '@wix/
2
2
  export type RESTModuleOptions = {
3
3
  HTTPHost?: string;
4
4
  };
5
- export declare function buildRESTDescriptor<T extends RESTFunctionDescriptor>(origFunc: T, publicMetadata: PublicMetadata, boundFetch: typeof fetch, wixAPIFetch: (relativeUrl: string, options: RequestInit) => Promise<Response>, getActiveToken?: () => string | undefined, options?: RESTModuleOptions): BuildRESTFunction<T>;
5
+ export declare function buildRESTDescriptor<T extends RESTFunctionDescriptor>(origFunc: T, publicMetadata: PublicMetadata, boundFetch: typeof fetch, wixAPIFetch: (relativeUrl: string, options: RequestInit) => Promise<Response>, getActiveToken?: () => string | undefined, options?: RESTModuleOptions, hostName?: string | undefined): BuildRESTFunction<T>;
@@ -1,7 +1,7 @@
1
1
  import { biHeaderGenerator } from './bi/biHeaderGenerator.js';
2
2
  import { DEFAULT_API_URL } from './common.js';
3
3
  import { runWithoutContext } from '@wix/sdk-runtime/context';
4
- export function buildRESTDescriptor(origFunc, publicMetadata, boundFetch, wixAPIFetch, getActiveToken, options) {
4
+ export function buildRESTDescriptor(origFunc, publicMetadata, boundFetch, wixAPIFetch, getActiveToken, options, hostName) {
5
5
  return runWithoutContext(() => origFunc({
6
6
  request: async (factory) => {
7
7
  const requestOptions = factory({
@@ -19,7 +19,7 @@ export function buildRESTDescriptor(origFunc, publicMetadata, boundFetch, wixAPI
19
19
  url += `?${request.params.toString()}`;
20
20
  }
21
21
  try {
22
- const biHeader = biHeaderGenerator(requestOptions, publicMetadata);
22
+ const biHeader = biHeaderGenerator(requestOptions, publicMetadata, hostName);
23
23
  const res = await boundFetch(url, {
24
24
  method: request.method,
25
25
  ...(request.data && {
@@ -61,7 +61,7 @@ export function createClient(config) {
61
61
  finalUrl.host = apiBaseUrl;
62
62
  finalUrl.protocol = 'https';
63
63
  return boundFetch(finalUrl.toString(), fetchOptions);
64
- }, authStrategy.getActiveToken, { HTTPHost: apiBaseUrl });
64
+ }, authStrategy.getActiveToken, { HTTPHost: apiBaseUrl }, config.host?.name);
65
65
  }
66
66
  else if (isObject(modules)) {
67
67
  return Object.fromEntries(Object.entries(modules).map(([key, value]) => {
@@ -1,3 +1,3 @@
1
1
  import type { HttpClient as SDKHttpClient, AmbassadorFactory } from '@wix/sdk-types';
2
- export declare const toHTTPModule: <Request_1, Response_1>(factory: AmbassadorFactory<Request_1, Response_1>) => (httpClient: SDKHttpClient) => (payload: Request_1) => Promise<Response_1>;
2
+ export declare const toHTTPModule: <Request, Response>(factory: AmbassadorFactory<Request, Response>) => (httpClient: SDKHttpClient) => (payload: Request) => Promise<Response>;
3
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.ApiKeyStrategy = void 0;
3
+ exports.ApiKeyStrategy = ApiKeyStrategy;
4
4
  function ApiKeyStrategy({ siteId, accountId, apiKey, }) {
5
5
  const headers = { Authorization: apiKey };
6
6
  if (siteId) {
@@ -23,4 +23,3 @@ function ApiKeyStrategy({ siteId, accountId, apiKey, }) {
23
23
  },
24
24
  };
25
25
  }
26
- exports.ApiKeyStrategy = ApiKeyStrategy;
@@ -23,7 +23,7 @@ var __importStar = (this && this.__importStar) || function (mod) {
23
23
  return result;
24
24
  };
25
25
  Object.defineProperty(exports, "__esModule", { value: true });
26
- exports.AppStrategy = void 0;
26
+ exports.AppStrategy = AppStrategy;
27
27
  const helpers_js_1 = require("../helpers.js");
28
28
  /**
29
29
  * Creates an authentication strategy for Wix Apps OAuth installation process.
@@ -269,7 +269,6 @@ function AppStrategy(opts) {
269
269
  },
270
270
  };
271
271
  }
272
- exports.AppStrategy = AppStrategy;
273
272
  async function getTokenInfo(token, authServerBaseUrl) {
274
273
  const tokenInfoUrl = new URL('/oauth2/token-info', authServerBaseUrl);
275
274
  const tokenInfoRes = await fetch(tokenInfoUrl.href, {
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.VeloAuthStrategy = void 0;
3
+ exports.VeloAuthStrategy = VeloAuthStrategy;
4
4
  // eslint-disable-next-line @typescript-eslint/no-redeclare
5
5
  function VeloAuthStrategy() {
6
6
  return {
@@ -21,4 +21,3 @@ function VeloAuthStrategy() {
21
21
  },
22
22
  };
23
23
  }
24
- exports.VeloAuthStrategy = VeloAuthStrategy;
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.OAuthStrategy = void 0;
3
+ exports.OAuthStrategy = OAuthStrategy;
4
4
  const wixClient_js_1 = require("../../wixClient.js");
5
5
  const redirects_1 = require("@wix/redirects");
6
6
  const tokenHelpers_js_1 = require("../../tokenHelpers.js");
@@ -360,7 +360,6 @@ function OAuthStrategy(config) {
360
360
  captchaVisibleSiteKey: '6Ld0J8IcAAAAANyrnxzrRlX1xrrdXsOmsepUYosy',
361
361
  };
362
362
  }
363
- exports.OAuthStrategy = OAuthStrategy;
364
363
  const fetchTokens = async (payload, headers = {}) => {
365
364
  const res = await fetch(`https://${common_js_1.DEFAULT_API_URL}/oauth2/token`, {
366
365
  method: 'POST',
@@ -1,6 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.generateChallenge = exports.pkceChallenge = void 0;
3
+ exports.pkceChallenge = pkceChallenge;
4
+ exports.generateChallenge = generateChallenge;
4
5
  const sha256_js_1 = require("./sha256.js");
5
6
  function pkceChallenge(length) {
6
7
  if (!length) {
@@ -16,14 +17,12 @@ function pkceChallenge(length) {
16
17
  code_challenge: challenge,
17
18
  };
18
19
  }
19
- exports.pkceChallenge = pkceChallenge;
20
20
  function generateVerifier(length) {
21
21
  return random(length);
22
22
  }
23
23
  function generateChallenge(code_verifier) {
24
24
  return base64urlencode((0, sha256_js_1.sha256)(code_verifier));
25
25
  }
26
- exports.generateChallenge = generateChallenge;
27
26
  function random(size) {
28
27
  const mask = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789-._~';
29
28
  let result = '';
@@ -7,7 +7,7 @@
7
7
  * @license MIT
8
8
  */
9
9
  Object.defineProperty(exports, "__esModule", { value: true });
10
- exports.sha256 = void 0;
10
+ exports.sha256 = sha256;
11
11
  // Inline here to avoid bringing in another library, cause:
12
12
  // 1. we have commited to a sync API (hopefully we'll change to async and
13
13
  // can start using the builtin crypto sha256), so we need a sync sha256,
@@ -279,4 +279,3 @@ class SHA256 {
279
279
  function sha256(message) {
280
280
  return new SHA256().update(message).arrayBuffer();
281
281
  }
282
- exports.sha256 = sha256;
@@ -1,11 +1,11 @@
1
1
  import { APIMetadata, PublicMetadata } from '@wix/sdk-types';
2
2
  export declare const WixBIHeaderName = "x-wix-bi-gateway";
3
3
  export type WixBIHeaderValues = {
4
- ['environment']: 'js-sdk';
4
+ ['environment']: 'js-sdk' | string;
5
5
  ['package-name']?: string;
6
6
  ['method-fqn']?: string;
7
7
  ['entity']?: string;
8
8
  };
9
- export declare function biHeaderGenerator(apiMetadata: APIMetadata, publicMetadata?: PublicMetadata): {
9
+ export declare function biHeaderGenerator(apiMetadata: APIMetadata, publicMetadata?: PublicMetadata, environment?: string): {
10
10
  [WixBIHeaderName]: string;
11
11
  };
@@ -1,18 +1,18 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.biHeaderGenerator = exports.WixBIHeaderName = void 0;
3
+ exports.WixBIHeaderName = void 0;
4
+ exports.biHeaderGenerator = biHeaderGenerator;
4
5
  exports.WixBIHeaderName = 'x-wix-bi-gateway';
5
- function biHeaderGenerator(apiMetadata, publicMetadata) {
6
+ function biHeaderGenerator(apiMetadata, publicMetadata, environment) {
6
7
  return {
7
8
  [exports.WixBIHeaderName]: objectToKeyValue({
8
- environment: 'js-sdk',
9
+ environment: `js-sdk${environment ? `-${environment}` : ``}`,
9
10
  'package-name': apiMetadata.packageName ?? publicMetadata?.PACKAGE_NAME,
10
11
  'method-fqn': apiMetadata.methodFqn,
11
12
  entity: apiMetadata.entityFqdn,
12
13
  }),
13
14
  };
14
15
  }
15
- exports.biHeaderGenerator = biHeaderGenerator;
16
16
  function objectToKeyValue(input) {
17
17
  return Object.entries(input)
18
18
  .filter(([_, value]) => Boolean(value))
@@ -1,11 +1,11 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.setGlobalWixContext = exports.graphql = exports.fetchWithAuth = exports.elevate = void 0;
3
+ exports.setGlobalWixContext = exports.graphql = exports.fetchWithAuth = void 0;
4
+ exports.elevate = elevate;
4
5
  const rest_modules_1 = require("@wix/sdk-runtime/rest-modules");
5
6
  function elevate(restModule) {
6
7
  return (0, rest_modules_1.createRESTModule)(restModule, true);
7
8
  }
8
- exports.elevate = elevate;
9
9
  exports.fetchWithAuth = (0, rest_modules_1.createRESTModule)((restModuleOpts) => {
10
10
  return ((url, options) => restModuleOpts.fetchWithAuth(url, options));
11
11
  });
@@ -1,6 +1,8 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.eventHandlersModules = exports.buildEventDefinition = exports.isEventHandlerModule = void 0;
3
+ exports.isEventHandlerModule = void 0;
4
+ exports.buildEventDefinition = buildEventDefinition;
5
+ exports.eventHandlersModules = eventHandlersModules;
4
6
  const sdk_types_1 = require("@wix/sdk-types");
5
7
  const nanoevents_js_1 = require("./nanoevents.js");
6
8
  const isEventHandlerModule = (val) => val.__type === 'event-definition';
@@ -10,7 +12,6 @@ function buildEventDefinition(eventDefinition, registerHandler) {
10
12
  registerHandler(eventDefinition, handler);
11
13
  };
12
14
  }
13
- exports.buildEventDefinition = buildEventDefinition;
14
15
  function runHandler(eventDefinition, handler, payload, baseEventMetadata) {
15
16
  let envelope;
16
17
  if (eventDefinition.isDomainEvent) {
@@ -149,4 +150,3 @@ function eventHandlersModules(authStrategy) {
149
150
  client,
150
151
  };
151
152
  }
152
- exports.eventHandlersModules = eventHandlersModules;
@@ -16,14 +16,14 @@ export type TypedQueryInput<Result = {
16
16
  */
17
17
  __ensureTypesOfVariablesAndResultMatching?: (variables: Variables) => Result;
18
18
  };
19
- export declare const graphql: (<Result, Variables>(query: string | String | DocumentNode | TypedQueryInput<Result, Variables>, variables?: Variables | undefined, opts?: {
19
+ export declare const graphql: (<Result, Variables>(query: string | String | DocumentNode | TypedQueryInput<Result, Variables>, variables?: Variables, opts?: {
20
20
  apiVersion: string;
21
21
  }) => Promise<{
22
22
  data: Result;
23
- errors?: GraphQLFormattedError[] | undefined;
24
- }>) & RESTFunctionDescriptor<(<Result, Variables>(query: string | String | DocumentNode | TypedQueryInput<Result, Variables>, variables?: Variables | undefined, opts?: {
23
+ errors?: GraphQLFormattedError[];
24
+ }>) & RESTFunctionDescriptor<(<Result, Variables>(query: string | String | DocumentNode | TypedQueryInput<Result, Variables>, variables?: Variables, opts?: {
25
25
  apiVersion: string;
26
26
  }) => Promise<{
27
27
  data: Result;
28
- errors?: GraphQLFormattedError[] | undefined;
28
+ errors?: GraphQLFormattedError[];
29
29
  }>)>;
@@ -1,5 +1,5 @@
1
1
  export declare const getDefaultContentHeader: (options: RequestInit | undefined) => {
2
- 'Content-Type'?: string;
2
+ "Content-Type"?: string;
3
3
  };
4
4
  export declare const isObject: (val: any) => val is Object;
5
5
  export declare function parsePublicKeyIfEncoded(publicKey: string): string;
@@ -1,6 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.parsePublicKeyIfEncoded = exports.isObject = exports.getDefaultContentHeader = void 0;
3
+ exports.isObject = exports.getDefaultContentHeader = void 0;
4
+ exports.parsePublicKeyIfEncoded = parsePublicKeyIfEncoded;
4
5
  // we follow a simplified version of the axios convention
5
6
  // https://github.com/axios/axios/blob/649d739288c8e2c55829ac60e2345a0f3439c730/lib/defaults/index.js#L65
6
7
  const getDefaultContentHeader = (options) => {
@@ -26,4 +27,3 @@ function parsePublicKeyIfEncoded(publicKey) {
26
27
  : Buffer.from(publicKey, 'base64').toString('utf-8');
27
28
  }
28
29
  }
29
- exports.parsePublicKeyIfEncoded = parsePublicKeyIfEncoded;
@@ -1,9 +1,9 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.buildHostModule = exports.isHostModule = void 0;
3
+ exports.isHostModule = void 0;
4
+ exports.buildHostModule = buildHostModule;
4
5
  const isHostModule = (val) => val.__type === 'host';
5
6
  exports.isHostModule = isHostModule;
6
7
  function buildHostModule(val, host) {
7
8
  return val.create(host);
8
9
  }
9
- exports.buildHostModule = buildHostModule;
@@ -1,6 +1,9 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.addPostMessageListener = exports.loadFrame = exports.removeListener = exports.addListener = void 0;
3
+ exports.addListener = addListener;
4
+ exports.removeListener = removeListener;
5
+ exports.loadFrame = loadFrame;
6
+ exports.addPostMessageListener = addPostMessageListener;
4
7
  function addListener(eventTarget, name, fn) {
5
8
  if (eventTarget.addEventListener) {
6
9
  eventTarget.addEventListener(name, fn);
@@ -9,7 +12,6 @@ function addListener(eventTarget, name, fn) {
9
12
  eventTarget.attachEvent('on' + name, fn);
10
13
  }
11
14
  }
12
- exports.addListener = addListener;
13
15
  function removeListener(eventTarget, name, fn) {
14
16
  if (eventTarget.removeEventListener) {
15
17
  eventTarget.removeEventListener(name, fn);
@@ -18,14 +20,12 @@ function removeListener(eventTarget, name, fn) {
18
20
  eventTarget.detachEvent('on' + name, fn);
19
21
  }
20
22
  }
21
- exports.removeListener = removeListener;
22
23
  function loadFrame(src) {
23
24
  const iframe = document.createElement('iframe');
24
25
  iframe.style.display = 'none';
25
26
  iframe.src = src;
26
27
  return document.body.appendChild(iframe);
27
28
  }
28
- exports.loadFrame = loadFrame;
29
29
  function addPostMessageListener(state) {
30
30
  let responseHandler;
31
31
  let timeoutId;
@@ -47,4 +47,3 @@ function addPostMessageListener(state) {
47
47
  removeListener(window, 'message', responseHandler);
48
48
  });
49
49
  }
50
- exports.addPostMessageListener = addPostMessageListener;
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  // Inlined from https://github.com/ai/nanoevents/blob/main/index.js
3
3
  Object.defineProperty(exports, "__esModule", { value: true });
4
- exports.createNanoEvents = void 0;
4
+ exports.createNanoEvents = createNanoEvents;
5
5
  /**
6
6
  * Create event emitter.
7
7
  *
@@ -38,4 +38,3 @@ function createNanoEvents() {
38
38
  },
39
39
  };
40
40
  }
41
- exports.createNanoEvents = createNanoEvents;
@@ -2,4 +2,4 @@ import { BuildRESTFunction, PublicMetadata, RESTFunctionDescriptor } from '@wix/
2
2
  export type RESTModuleOptions = {
3
3
  HTTPHost?: string;
4
4
  };
5
- export declare function buildRESTDescriptor<T extends RESTFunctionDescriptor>(origFunc: T, publicMetadata: PublicMetadata, boundFetch: typeof fetch, wixAPIFetch: (relativeUrl: string, options: RequestInit) => Promise<Response>, getActiveToken?: () => string | undefined, options?: RESTModuleOptions): BuildRESTFunction<T>;
5
+ export declare function buildRESTDescriptor<T extends RESTFunctionDescriptor>(origFunc: T, publicMetadata: PublicMetadata, boundFetch: typeof fetch, wixAPIFetch: (relativeUrl: string, options: RequestInit) => Promise<Response>, getActiveToken?: () => string | undefined, options?: RESTModuleOptions, hostName?: string | undefined): BuildRESTFunction<T>;
@@ -1,10 +1,10 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.buildRESTDescriptor = void 0;
3
+ exports.buildRESTDescriptor = buildRESTDescriptor;
4
4
  const biHeaderGenerator_js_1 = require("./bi/biHeaderGenerator.js");
5
5
  const common_js_1 = require("./common.js");
6
6
  const context_1 = require("@wix/sdk-runtime/context");
7
- function buildRESTDescriptor(origFunc, publicMetadata, boundFetch, wixAPIFetch, getActiveToken, options) {
7
+ function buildRESTDescriptor(origFunc, publicMetadata, boundFetch, wixAPIFetch, getActiveToken, options, hostName) {
8
8
  return (0, context_1.runWithoutContext)(() => origFunc({
9
9
  request: async (factory) => {
10
10
  const requestOptions = factory({
@@ -22,7 +22,7 @@ function buildRESTDescriptor(origFunc, publicMetadata, boundFetch, wixAPIFetch,
22
22
  url += `?${request.params.toString()}`;
23
23
  }
24
24
  try {
25
- const biHeader = (0, biHeaderGenerator_js_1.biHeaderGenerator)(requestOptions, publicMetadata);
25
+ const biHeader = (0, biHeaderGenerator_js_1.biHeaderGenerator)(requestOptions, publicMetadata, hostName);
26
26
  const res = await boundFetch(url, {
27
27
  method: request.method,
28
28
  ...(request.data && {
@@ -65,7 +65,6 @@ function buildRESTDescriptor(origFunc, publicMetadata, boundFetch, wixAPIFetch,
65
65
  getActiveToken,
66
66
  }));
67
67
  }
68
- exports.buildRESTDescriptor = buildRESTDescriptor;
69
68
  const errorBuilder = (code, description, details, data) => {
70
69
  return {
71
70
  response: {
@@ -1,6 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.servicePluginsModules = exports.isServicePluginModule = void 0;
3
+ exports.isServicePluginModule = void 0;
4
+ exports.servicePluginsModules = servicePluginsModules;
4
5
  const nanoevents_js_1 = require("./nanoevents.js");
5
6
  const isServicePluginModule = (val) => val.__type === 'service-plugin-definition';
6
7
  exports.isServicePluginModule = isServicePluginModule;
@@ -76,4 +77,3 @@ function servicePluginsModules(authStrategy) {
76
77
  client,
77
78
  };
78
79
  }
79
- exports.servicePluginsModules = servicePluginsModules;
@@ -1,17 +1,16 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.createAccessToken = exports.isTokenExpired = exports.getCurrentDate = void 0;
3
+ exports.getCurrentDate = getCurrentDate;
4
+ exports.isTokenExpired = isTokenExpired;
5
+ exports.createAccessToken = createAccessToken;
4
6
  function getCurrentDate() {
5
7
  return Math.floor(Date.now() / 1000);
6
8
  }
7
- exports.getCurrentDate = getCurrentDate;
8
9
  function isTokenExpired(token) {
9
10
  const currentDate = getCurrentDate();
10
11
  return token.expiresAt < currentDate;
11
12
  }
12
- exports.isTokenExpired = isTokenExpired;
13
13
  function createAccessToken(accessToken, expiresIn) {
14
14
  const now = getCurrentDate();
15
15
  return { value: accessToken, expiresAt: Number(expiresIn) + now };
16
16
  }
17
- exports.createAccessToken = createAccessToken;
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.setGlobalWixContext = void 0;
3
+ exports.setGlobalWixContext = setGlobalWixContext;
4
4
  /**
5
5
  * Sets the Wix context globally.
6
6
  * @param wixContext The Wix context to set globally.
@@ -13,4 +13,3 @@ function setGlobalWixContext(wixContext, options = {}) {
13
13
  globalThis.__wix_context__ = wixContext;
14
14
  }
15
15
  }
16
- exports.setGlobalWixContext = setGlobalWixContext;
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.createClient = void 0;
3
+ exports.createClient = createClient;
4
4
  const sdk_context_1 = require("@wix/sdk-context");
5
5
  const sdk_types_1 = require("@wix/sdk-types");
6
6
  const ambassador_modules_js_1 = require("./ambassador-modules.js");
@@ -64,7 +64,7 @@ function createClient(config) {
64
64
  finalUrl.host = apiBaseUrl;
65
65
  finalUrl.protocol = 'https';
66
66
  return boundFetch(finalUrl.toString(), fetchOptions);
67
- }, authStrategy.getActiveToken, { HTTPHost: apiBaseUrl });
67
+ }, authStrategy.getActiveToken, { HTTPHost: apiBaseUrl }, config.host?.name);
68
68
  }
69
69
  else if ((0, helpers_js_1.isObject)(modules)) {
70
70
  return Object.fromEntries(Object.entries(modules).map(([key, value]) => {
@@ -167,4 +167,3 @@ function createClient(config) {
167
167
  servicePlugins: servicePluginsClient,
168
168
  };
169
169
  }
170
- exports.createClient = createClient;
@@ -1,6 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.media = exports.VideoResolution = exports.decodeText = void 0;
3
+ exports.media = exports.VideoResolution = void 0;
4
+ exports.decodeText = decodeText;
4
5
  const image_kit_1 = require("@wix/image-kit");
5
6
  const WIX_PROTOCOL = 'wix:';
6
7
  const WIX_IMAGE = 'image';
@@ -137,7 +138,6 @@ function decodeText(s) {
137
138
  }
138
139
  return decodeURIComponent(s);
139
140
  }
140
- exports.decodeText = decodeText;
141
141
  function alignIfLegacy(url, type) {
142
142
  const { protocol } = new URL(url);
143
143
  return protocol === `${type}:` ? `${WIX_PROTOCOL}${url}` : url;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wix/sdk",
3
- "version": "1.14.1",
3
+ "version": "1.14.2",
4
4
  "license": "UNLICENSED",
5
5
  "author": {
6
6
  "name": "Ronny Ringel",
@@ -63,38 +63,36 @@
63
63
  "*.{js,ts}": "yarn lint"
64
64
  },
65
65
  "dependencies": {
66
- "@babel/runtime": "^7.23.2",
67
- "@wix/identity": "^1.0.78",
68
- "@wix/image-kit": "^1.88.0",
69
- "@wix/redirects": "^1.0.41",
66
+ "@wix/identity": "^1.0.83",
67
+ "@wix/image-kit": "^1.92.0",
68
+ "@wix/redirects": "^1.0.58",
70
69
  "@wix/sdk-context": "^0.0.1",
71
- "@wix/sdk-runtime": "0.3.21",
72
- "@wix/sdk-types": "^1.12.3",
73
- "jose": "^5.2.1",
74
- "querystring": "^0.2.1",
75
- "type-fest": "^4.9.0"
70
+ "@wix/sdk-runtime": "0.3.22",
71
+ "@wix/sdk-types": "^1.12.4",
72
+ "jose": "^5.9.6",
73
+ "type-fest": "^4.26.1"
76
74
  },
77
75
  "optionalDependencies": {
78
76
  "graphql": "^0.8.0 || ^0.9.0 || ^0.10.0 || ^0.11.0 || ^0.12.0 || ^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0 || ^17.0.0"
79
77
  },
80
78
  "devDependencies": {
81
79
  "@types/is-ci": "^3.0.4",
82
- "@types/node": "^20.10.6",
83
- "@vitest/ui": "^1.5.0",
84
- "@wix/ecom": "^1.0.531",
85
- "@wix/events": "^1.0.179",
86
- "@wix/metro": "^1.0.73",
87
- "@wix/metro-runtime": "^1.1677.0",
88
- "@wix/sdk-runtime": "0.3.21",
89
- "eslint": "^8.56.0",
80
+ "@types/node": "^20.17.1",
81
+ "@vitest/ui": "^1.6.0",
82
+ "@wix/ecom": "^1.0.785",
83
+ "@wix/events": "^1.0.322",
84
+ "@wix/metro": "^1.0.87",
85
+ "@wix/metro-runtime": "^1.1836.0",
86
+ "@wix/sdk-runtime": "0.3.22",
87
+ "eslint": "^8.57.1",
90
88
  "eslint-config-sdk": "0.0.0",
91
89
  "graphql": "^16.8.0",
92
90
  "is-ci": "^3.0.1",
93
91
  "jsdom": "^22.1.0",
94
- "msw": "^2.4.5",
95
- "typescript": "^5.3.3",
96
- "vitest": "^1.5.0",
97
- "vitest-teamcity-reporter": "^0.3.0"
92
+ "msw": "^2.5.1",
93
+ "typescript": "^5.6.3",
94
+ "vitest": "^1.6.0",
95
+ "vitest-teamcity-reporter": "^0.3.1"
98
96
  },
99
97
  "yoshiFlowLibrary": {
100
98
  "buildEsmWithBabel": true
@@ -119,5 +117,5 @@
119
117
  "wallaby": {
120
118
  "autoDetect": true
121
119
  },
122
- "falconPackageHash": "ef0b5611a3bb59558e1a3fc6bdcfa01b80c1090dab21eaa4403bea26"
120
+ "falconPackageHash": "013206f49fbedd4b9e408a91fb3ae082db4f1e9d317ccb8cb4a7bc60"
123
121
  }