@fyul/embed-sdk 2.7.63 → 2.7.64
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/cjs/modules/baseFetchModule.d.ts +11 -0
- package/dist/cjs/modules/baseFetchModule.js +46 -0
- package/dist/cjs/modules/baseModule.d.ts +5 -4
- package/dist/cjs/modules/baseModule.js +4 -2
- package/dist/cjs/modules/catalog/catalogModule.d.ts +1 -1
- package/dist/cjs/modules/catalog/catalogModule.js +11 -2
- package/dist/cjs/modules/edm/types/data.types.d.ts +21 -2
- package/dist/cjs/modules/white-label/types/data.types.d.ts +5 -1
- package/dist/cjs/services/authStore.d.ts +10 -0
- package/dist/cjs/services/authStore.js +23 -0
- package/dist/cjs/services/edm.d.ts +4 -2
- package/dist/cjs/services/edm.js +16 -1
- package/dist/cjs/services/embed.d.ts +1 -1
- package/dist/cjs/services/embed.js +13 -2
- package/dist/cjs/services/moduleLoaderService.d.ts +1 -0
- package/dist/cjs/services/moduleLoaderService.js +3 -1
- package/dist/cjs/services/whiteLabel.js +3 -0
- package/dist/cjs/types/event/network/networkEvent.types.d.ts +9 -0
- package/dist/cjs/types/event/network/networkEvent.types.js +2 -0
- package/dist/cjs/version.d.ts +1 -1
- package/dist/cjs/version.js +1 -1
- package/dist/esm/modules/baseFetchModule.d.ts +11 -0
- package/dist/esm/modules/baseFetchModule.js +42 -0
- package/dist/esm/modules/baseModule.d.ts +5 -4
- package/dist/esm/modules/baseModule.js +4 -2
- package/dist/esm/modules/catalog/catalogModule.d.ts +1 -1
- package/dist/esm/modules/catalog/catalogModule.js +11 -2
- package/dist/esm/modules/edm/types/data.types.d.ts +21 -2
- package/dist/esm/modules/white-label/types/data.types.d.ts +5 -1
- package/dist/esm/services/authStore.d.ts +10 -0
- package/dist/esm/services/authStore.js +19 -0
- package/dist/esm/services/edm.d.ts +4 -2
- package/dist/esm/services/edm.js +16 -1
- package/dist/esm/services/embed.d.ts +1 -1
- package/dist/esm/services/embed.js +13 -2
- package/dist/esm/services/moduleLoaderService.d.ts +1 -0
- package/dist/esm/services/moduleLoaderService.js +3 -1
- package/dist/esm/services/whiteLabel.js +3 -0
- package/dist/esm/types/event/network/networkEvent.types.d.ts +9 -0
- package/dist/esm/types/event/network/networkEvent.types.js +1 -0
- package/dist/esm/version.d.ts +1 -1
- package/dist/esm/version.js +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { NotificationEventPayload } from '../types/event/notification/notificationEventPayload.types';
|
|
2
|
+
import { BaseNetworkRequest } from '../types/event/network/networkEvent.types';
|
|
3
|
+
import { ActionEventPayload } from '../types/event/action/actionEventPayload.types';
|
|
4
|
+
import { ResultEventPayload } from '../types/event/result/resultEventPayload.types';
|
|
5
|
+
import { MainModuleKey } from '../services/authStore';
|
|
6
|
+
export declare abstract class BaseFetchModule {
|
|
7
|
+
protected readonly rootUrl: string;
|
|
8
|
+
private readonly authKey;
|
|
9
|
+
protected constructor(rootUrl: string, authKey: MainModuleKey);
|
|
10
|
+
protected sendFetch<TParams extends ActionEventPayload, TResponse extends ResultEventPayload>(request: BaseNetworkRequest<TParams, TResponse>): Promise<TResponse | NotificationEventPayload>;
|
|
11
|
+
}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.BaseFetchModule = void 0;
|
|
4
|
+
const authStore_1 = require("../services/authStore");
|
|
5
|
+
class BaseFetchModule {
|
|
6
|
+
rootUrl;
|
|
7
|
+
authKey;
|
|
8
|
+
constructor(rootUrl, authKey) {
|
|
9
|
+
this.rootUrl = rootUrl;
|
|
10
|
+
this.authKey = authKey;
|
|
11
|
+
}
|
|
12
|
+
async sendFetch(request) {
|
|
13
|
+
const { method, path, params } = request;
|
|
14
|
+
const init = { method };
|
|
15
|
+
const headers = {};
|
|
16
|
+
const jwt = authStore_1.AuthStore.getInstance().get(this.authKey);
|
|
17
|
+
if (jwt) {
|
|
18
|
+
headers['Authorization'] = `Bearer ${jwt}`;
|
|
19
|
+
}
|
|
20
|
+
if (params !== undefined) {
|
|
21
|
+
headers['Content-Type'] = 'application/json';
|
|
22
|
+
init.body = JSON.stringify(params);
|
|
23
|
+
}
|
|
24
|
+
if (Object.keys(headers).length) {
|
|
25
|
+
init.headers = headers;
|
|
26
|
+
}
|
|
27
|
+
try {
|
|
28
|
+
const response = await fetch(`${this.rootUrl}${path}`, init);
|
|
29
|
+
if (!response.ok) {
|
|
30
|
+
return {
|
|
31
|
+
status: 'error',
|
|
32
|
+
message: `Fetch failed [${method} ${path}]: ${response.status} ${response.statusText}`,
|
|
33
|
+
};
|
|
34
|
+
}
|
|
35
|
+
return (await response.json());
|
|
36
|
+
}
|
|
37
|
+
catch (e) {
|
|
38
|
+
return {
|
|
39
|
+
status: 'error',
|
|
40
|
+
message: e instanceof Error ? e.message : `Fetch failed [${method} ${path}]`,
|
|
41
|
+
error: e instanceof Error ? e : undefined,
|
|
42
|
+
};
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
exports.BaseFetchModule = BaseFetchModule;
|
|
@@ -2,9 +2,10 @@ import { ActionEventName } from '../types/event/action/actionEvent.types';
|
|
|
2
2
|
import { ActionEventPayload } from '../types/event/action/actionEventPayload.types';
|
|
3
3
|
import { ResultEventPayload } from '../types/event/result/resultEventPayload.types';
|
|
4
4
|
import { NotificationEventPayload } from '../types/event/notification/notificationEventPayload.types';
|
|
5
|
-
import
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
5
|
+
import { BaseFetchModule } from '../modules/baseFetchModule';
|
|
6
|
+
import { MainModuleKey } from '../services/authStore';
|
|
7
|
+
export declare abstract class BaseModule extends BaseFetchModule {
|
|
8
|
+
protected moduleType: MainModuleKey;
|
|
9
|
+
constructor(moduleType: MainModuleKey, apiRoot?: string);
|
|
9
10
|
protected sendRequest<T extends ResultEventPayload | NotificationEventPayload>(eventName: ActionEventName, eventPayload?: ActionEventPayload): Promise<T>;
|
|
10
11
|
}
|
|
@@ -2,9 +2,11 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.BaseModule = void 0;
|
|
4
4
|
const embedCommunicator_1 = require("../services/embedCommunicator");
|
|
5
|
-
|
|
5
|
+
const baseFetchModule_1 = require("../modules/baseFetchModule");
|
|
6
|
+
class BaseModule extends baseFetchModule_1.BaseFetchModule {
|
|
6
7
|
moduleType;
|
|
7
|
-
constructor(moduleType) {
|
|
8
|
+
constructor(moduleType, apiRoot) {
|
|
9
|
+
super(apiRoot ?? '', moduleType);
|
|
8
10
|
this.moduleType = moduleType;
|
|
9
11
|
}
|
|
10
12
|
async sendRequest(eventName, eventPayload) {
|
|
@@ -3,7 +3,7 @@ import { BaseModule } from '../../modules/baseModule';
|
|
|
3
3
|
import { GetCatalogCategoriesResultPayload, GetCatalogProductsByIdsPayload, GetCatalogProductsPayload, GetCatalogProductsResultPayload, GetSingleCatalogProductPayload, GetSingleCatalogProductResultPayload } from './types';
|
|
4
4
|
import { WithHandledResponses } from '../../helpers/typeHelper.types';
|
|
5
5
|
export declare class CatalogModule extends BaseModule implements WithHandledResponses<ICatalogModule> {
|
|
6
|
-
constructor();
|
|
6
|
+
constructor(baseApiUrl?: string);
|
|
7
7
|
getProducts(data: GetCatalogProductsPayload): Promise<import("../..").HandledResponse<GetCatalogProductsResultPayload, Error>>;
|
|
8
8
|
getProductsByIds(data: GetCatalogProductsByIdsPayload): Promise<import("../..").HandledResponse<GetCatalogProductsResultPayload, Error>>;
|
|
9
9
|
getProduct(data: GetSingleCatalogProductPayload): Promise<import("../..").HandledResponse<GetSingleCatalogProductResultPayload, Error>>;
|
|
@@ -5,9 +5,10 @@ const baseModule_1 = require("../../modules/baseModule");
|
|
|
5
5
|
const types_1 = require("./types");
|
|
6
6
|
const responseHandler_1 = require("../../helpers/responseHandler");
|
|
7
7
|
const modules_1 = require("../../modules/modules");
|
|
8
|
+
const authStore_1 = require("../../services/authStore");
|
|
8
9
|
class CatalogModule extends baseModule_1.BaseModule {
|
|
9
|
-
constructor() {
|
|
10
|
-
super(modules_1.MODULE_NAMES.SDK);
|
|
10
|
+
constructor(baseApiUrl) {
|
|
11
|
+
super(modules_1.MODULE_NAMES.SDK, baseApiUrl);
|
|
11
12
|
}
|
|
12
13
|
async getProducts(data) {
|
|
13
14
|
const response = await this.sendRequest(types_1.EVENTS_ACTION.GET_CATALOG_PRODUCTS, data).catch((e) => e);
|
|
@@ -22,6 +23,14 @@ class CatalogModule extends baseModule_1.BaseModule {
|
|
|
22
23
|
return (0, responseHandler_1.handleResponse)(response, 'Failed to get catalog products');
|
|
23
24
|
}
|
|
24
25
|
async getCategories() {
|
|
26
|
+
const hasJwt = !!authStore_1.AuthStore.getInstance().get(this.moduleType);
|
|
27
|
+
if (hasJwt) {
|
|
28
|
+
const response = await this.sendFetch({
|
|
29
|
+
method: 'POST',
|
|
30
|
+
path: '/v1/sdk/get-catalog-categories',
|
|
31
|
+
});
|
|
32
|
+
return (0, responseHandler_1.handleResponse)(response, 'Failed to get catalog categories');
|
|
33
|
+
}
|
|
25
34
|
const response = await this.sendRequest(types_1.EVENTS_ACTION.GET_CATALOG_CATEGORIES).catch((e) => e);
|
|
26
35
|
return (0, responseHandler_1.handleResponse)(response, 'Failed to get catalog categories');
|
|
27
36
|
}
|
|
@@ -124,8 +124,7 @@ export type EDMParams = ({
|
|
|
124
124
|
elementId: string;
|
|
125
125
|
element?: null;
|
|
126
126
|
} & EDMCommonParams);
|
|
127
|
-
|
|
128
|
-
nonce: string;
|
|
127
|
+
interface EDMCommonParamsBase {
|
|
129
128
|
externalProductId: string;
|
|
130
129
|
iframeClassName?: string;
|
|
131
130
|
origin?: string;
|
|
@@ -136,6 +135,25 @@ export interface EDMCommonParams {
|
|
|
136
135
|
};
|
|
137
136
|
debug?: boolean;
|
|
138
137
|
}
|
|
138
|
+
interface EDMJwtParams extends EDMCommonParamsBase {
|
|
139
|
+
jwt: string;
|
|
140
|
+
nonce?: never;
|
|
141
|
+
}
|
|
142
|
+
interface EDMNonceParams extends EDMCommonParamsBase {
|
|
143
|
+
/** @deprecated Use jwt instead */
|
|
144
|
+
nonce: string;
|
|
145
|
+
jwt?: never;
|
|
146
|
+
}
|
|
147
|
+
export type EDMCommonParams = EDMJwtParams | EDMNonceParams;
|
|
148
|
+
type EDMElementVariants = {
|
|
149
|
+
element: HTMLElement;
|
|
150
|
+
elementId?: null;
|
|
151
|
+
} | {
|
|
152
|
+
elementId: string;
|
|
153
|
+
element?: null;
|
|
154
|
+
};
|
|
155
|
+
export type EDMParamsWithJwt = EDMElementVariants & EDMJwtParams;
|
|
156
|
+
export type EDMParamsWithNonce = EDMElementVariants & EDMNonceParams;
|
|
139
157
|
export interface Message {
|
|
140
158
|
type: string;
|
|
141
159
|
message: string;
|
|
@@ -214,3 +232,4 @@ export interface TOSStepResponse extends OnStepStatusUpdateEvent {
|
|
|
214
232
|
stepData: TOSStepData;
|
|
215
233
|
}
|
|
216
234
|
export type StepResponse = MockupStepResponse | PricingEditStepResponse | DetailsEditStepResponse | TOSStepResponse;
|
|
235
|
+
export {};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { MODULE_DEPENDENCY_MAP } from '../modules/modules';
|
|
2
|
+
export type MainModuleKey = (typeof MODULE_DEPENDENCY_MAP)[keyof typeof MODULE_DEPENDENCY_MAP];
|
|
3
|
+
export declare class AuthStore {
|
|
4
|
+
private static instance;
|
|
5
|
+
private tokens;
|
|
6
|
+
static getInstance(): AuthStore;
|
|
7
|
+
set(key: MainModuleKey, jwt: string): void;
|
|
8
|
+
get(key: MainModuleKey): string | undefined;
|
|
9
|
+
delete(key: MainModuleKey): void;
|
|
10
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.AuthStore = void 0;
|
|
4
|
+
class AuthStore {
|
|
5
|
+
static instance;
|
|
6
|
+
tokens = new Map();
|
|
7
|
+
static getInstance() {
|
|
8
|
+
if (!AuthStore.instance) {
|
|
9
|
+
AuthStore.instance = new AuthStore();
|
|
10
|
+
}
|
|
11
|
+
return AuthStore.instance;
|
|
12
|
+
}
|
|
13
|
+
set(key, jwt) {
|
|
14
|
+
this.tokens.set(key, jwt);
|
|
15
|
+
}
|
|
16
|
+
get(key) {
|
|
17
|
+
return this.tokens.get(key);
|
|
18
|
+
}
|
|
19
|
+
delete(key) {
|
|
20
|
+
this.tokens.delete(key);
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
exports.AuthStore = AuthStore;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { EDMConfig,
|
|
1
|
+
import { EDMConfig, EDMParamsWithJwt, EDMParamsWithNonce } from '../modules/edm/types/data.types';
|
|
2
2
|
import { EdmBroadcastModule } from '../modules/edm/edmBroadcastModule';
|
|
3
3
|
import { BroadcastListeners } from '../modules/edm/types/event/broadcastEvent.types';
|
|
4
4
|
import type { AddImagePayload, NavigateStepPayload, SetStylePayload } from '../modules/edm/types';
|
|
@@ -12,7 +12,9 @@ export declare class EDM {
|
|
|
12
12
|
private communicator;
|
|
13
13
|
private moduleLoader;
|
|
14
14
|
private initialized;
|
|
15
|
-
constructor(params:
|
|
15
|
+
constructor(params: EDMParamsWithJwt, config?: EDMConfig, callbacks?: Partial<BroadcastListeners>);
|
|
16
|
+
/** @deprecated Use jwt instead of nonce */
|
|
17
|
+
constructor(params: EDMParamsWithNonce, config?: EDMConfig, callbacks?: Partial<BroadcastListeners>);
|
|
16
18
|
init(): Promise<void>;
|
|
17
19
|
saveDesign(): Promise<import("..").HandledResponse<import("../modules/edm/types").SaveDesignResultPayload, Error>>;
|
|
18
20
|
setStyle(payload: SetStylePayload): Promise<import("..").HandledResponse<import("../modules/edm/types").SetStyleResultPayload, Error>>;
|
package/dist/cjs/services/edm.js
CHANGED
|
@@ -9,6 +9,8 @@ const moduleNames_1 = require("../modules/moduleNames");
|
|
|
9
9
|
const version_1 = require("../version");
|
|
10
10
|
const edmBroadcastModule_1 = require("../modules/edm/edmBroadcastModule");
|
|
11
11
|
const broadcastEventMap_1 = require("../types/event/broadcast/broadcastEventMap");
|
|
12
|
+
const jwtDecoder_1 = require("../helpers/jwtDecoder");
|
|
13
|
+
const authStore_1 = require("../services/authStore");
|
|
12
14
|
class EDM {
|
|
13
15
|
params;
|
|
14
16
|
config;
|
|
@@ -23,7 +25,19 @@ class EDM {
|
|
|
23
25
|
constructor(params, config, callbacks) {
|
|
24
26
|
this.params = params;
|
|
25
27
|
this.config = config;
|
|
26
|
-
|
|
28
|
+
if (params.jwt !== undefined) {
|
|
29
|
+
const { data, error } = (0, jwtDecoder_1.parseJwt)(params.jwt);
|
|
30
|
+
if (error) {
|
|
31
|
+
throw new Error('Failed to decode JWT');
|
|
32
|
+
}
|
|
33
|
+
this.nonce = data.nce;
|
|
34
|
+
}
|
|
35
|
+
else {
|
|
36
|
+
this.nonce = params.nonce;
|
|
37
|
+
}
|
|
38
|
+
if (params.jwt !== undefined) {
|
|
39
|
+
authStore_1.AuthStore.getInstance().set(moduleNames_1.MODULE_NAMES.EDM, params.jwt);
|
|
40
|
+
}
|
|
27
41
|
EDM.broadCastEventHandler = new edmBroadcastModule_1.EdmBroadcastModule(callbacks);
|
|
28
42
|
this.communicator.registerBroadcastDispatcher(moduleNames_1.MODULE_NAMES.EDM, broadcastEventMap_1.EDM_BROADCAST_EVENT_MAP);
|
|
29
43
|
(0, messageLogger_1.setLoggerState)(params?.debug ?? false, messageLogger_1.SOURCES.EDM);
|
|
@@ -92,6 +106,7 @@ class EDM {
|
|
|
92
106
|
}
|
|
93
107
|
this.communicator.cleanup();
|
|
94
108
|
this.moduleLoader.clearCache();
|
|
109
|
+
authStore_1.AuthStore.getInstance().delete(moduleNames_1.MODULE_NAMES.EDM);
|
|
95
110
|
this.initialized = false;
|
|
96
111
|
EDM.broadCastEventHandler = null;
|
|
97
112
|
}
|
|
@@ -13,7 +13,7 @@ export declare class Embed {
|
|
|
13
13
|
readonly catalog: CatalogService;
|
|
14
14
|
readonly mockup: MockupService;
|
|
15
15
|
readonly publish: ProductPublishService;
|
|
16
|
-
constructor(
|
|
16
|
+
constructor(jwt: string, config?: SdkConfig | undefined);
|
|
17
17
|
init(): Promise<void>;
|
|
18
18
|
destroy(): void;
|
|
19
19
|
getNonce(): string;
|
|
@@ -10,6 +10,8 @@ const productPublishService_1 = require("../modules/product-publish/productPubli
|
|
|
10
10
|
const messageLogger_1 = require("../helpers/messageLogger");
|
|
11
11
|
const modules_1 = require("../modules/modules");
|
|
12
12
|
const version_1 = require("../version");
|
|
13
|
+
const jwtDecoder_1 = require("../helpers/jwtDecoder");
|
|
14
|
+
const authStore_1 = require("../services/authStore");
|
|
13
15
|
class Embed {
|
|
14
16
|
config;
|
|
15
17
|
static BASE_URL = globalThis.__FYUL_TESTING_VARS__?.sdkUrl ??
|
|
@@ -23,9 +25,17 @@ class Embed {
|
|
|
23
25
|
catalog;
|
|
24
26
|
mockup;
|
|
25
27
|
publish;
|
|
26
|
-
constructor(
|
|
28
|
+
constructor(jwt, config) {
|
|
27
29
|
this.config = config;
|
|
28
|
-
|
|
30
|
+
const { data, error } = (0, jwtDecoder_1.parseJwt)(jwt);
|
|
31
|
+
if (error) {
|
|
32
|
+
// If decoding fails, it means that regular nonce was passed, for now leave as is till deprecation for nonce is finished
|
|
33
|
+
this.nonce = jwt;
|
|
34
|
+
}
|
|
35
|
+
else {
|
|
36
|
+
this.nonce = data.nce;
|
|
37
|
+
authStore_1.AuthStore.getInstance().set(modules_1.MODULE_NAMES.SDK, jwt);
|
|
38
|
+
}
|
|
29
39
|
(0, messageLogger_1.setLoggerState)(config?.debug ?? false, messageLogger_1.SOURCES.SDK);
|
|
30
40
|
// Initialize services
|
|
31
41
|
this.catalog = new catalogService_1.CatalogService();
|
|
@@ -78,6 +88,7 @@ class Embed {
|
|
|
78
88
|
}
|
|
79
89
|
this.communicator.cleanup();
|
|
80
90
|
this.moduleLoader.clearCache();
|
|
91
|
+
authStore_1.AuthStore.getInstance().delete(modules_1.MODULE_NAMES.SDK);
|
|
81
92
|
this.initialized = false;
|
|
82
93
|
}
|
|
83
94
|
getNonce() {
|
|
@@ -4,6 +4,7 @@ import { ModuleConfig, ModuleConfigData } from '../types/module/moduleConfig.typ
|
|
|
4
4
|
export type ModuleInstance = InstanceType<(typeof MODULES)[keyof typeof MODULES]>;
|
|
5
5
|
export declare class ModuleLoaderService {
|
|
6
6
|
private static instance;
|
|
7
|
+
static BASE_API_URL: string;
|
|
7
8
|
private communicator;
|
|
8
9
|
private moduleCache;
|
|
9
10
|
static getInstance(): ModuleLoaderService;
|
|
@@ -7,6 +7,8 @@ const types_1 = require("../modules/sdk/types");
|
|
|
7
7
|
const messageLogger_1 = require("../helpers/messageLogger");
|
|
8
8
|
class ModuleLoaderService {
|
|
9
9
|
static instance;
|
|
10
|
+
static BASE_API_URL = globalThis.__FYUL_TESTING_VARS__?.sdkApiUrl ??
|
|
11
|
+
'https://ewl.printify.com/api';
|
|
10
12
|
communicator = embedCommunicator_1.EmbedCommunicator.getInstance();
|
|
11
13
|
moduleCache = new Map();
|
|
12
14
|
static getInstance() {
|
|
@@ -17,7 +19,7 @@ class ModuleLoaderService {
|
|
|
17
19
|
}
|
|
18
20
|
getModule(moduleName) {
|
|
19
21
|
if (!this.isModuleLoaded(moduleName)) {
|
|
20
|
-
const module = new modules_1.MODULES[moduleName]();
|
|
22
|
+
const module = new modules_1.MODULES[moduleName](ModuleLoaderService.BASE_API_URL);
|
|
21
23
|
this.moduleCache.set(moduleName, module);
|
|
22
24
|
}
|
|
23
25
|
return this.moduleCache.get(moduleName);
|
|
@@ -10,6 +10,7 @@ const version_1 = require("../version");
|
|
|
10
10
|
const whiteLabelBroadcastModule_1 = require("../modules/white-label/whiteLabelBroadcastModule");
|
|
11
11
|
const jwtDecoder_1 = require("../helpers/jwtDecoder");
|
|
12
12
|
const broadcastEventMap_1 = require("../types/event/broadcast/broadcastEventMap");
|
|
13
|
+
const authStore_1 = require("../services/authStore");
|
|
13
14
|
class WhiteLabel {
|
|
14
15
|
params;
|
|
15
16
|
config;
|
|
@@ -25,6 +26,7 @@ class WhiteLabel {
|
|
|
25
26
|
this.params = params;
|
|
26
27
|
this.config = config;
|
|
27
28
|
this.jwt = params.jwt;
|
|
29
|
+
authStore_1.AuthStore.getInstance().set(moduleNames_1.MODULE_NAMES.WHITE_LABEL, params.jwt);
|
|
28
30
|
WhiteLabel.broadCastEventHandler = new whiteLabelBroadcastModule_1.WhiteLabelBroadcastModule(callbacks);
|
|
29
31
|
this.communicator.registerBroadcastDispatcher(moduleNames_1.MODULE_NAMES.WHITE_LABEL, broadcastEventMap_1.WHITE_LABEL_BROADCAST_EVENT_MAP);
|
|
30
32
|
(0, messageLogger_1.setLoggerState)(params?.debug ?? false, messageLogger_1.SOURCES.WHITE_LABEL);
|
|
@@ -95,6 +97,7 @@ class WhiteLabel {
|
|
|
95
97
|
}
|
|
96
98
|
this.communicator.cleanup();
|
|
97
99
|
this.moduleLoader.clearCache();
|
|
100
|
+
authStore_1.AuthStore.getInstance().delete(moduleNames_1.MODULE_NAMES.WHITE_LABEL);
|
|
98
101
|
this.initialized = false;
|
|
99
102
|
WhiteLabel.broadCastEventHandler = null;
|
|
100
103
|
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { ActionEventPayload } from '../action/actionEventPayload.types';
|
|
2
|
+
import type { ResultEventPayload } from '../result/resultEventPayload.types';
|
|
3
|
+
export type HttpMethod = 'GET' | 'POST' | 'PUT' | 'PATCH' | 'DELETE';
|
|
4
|
+
export interface BaseNetworkRequest<TParams extends ActionEventPayload = undefined, TResponse extends ResultEventPayload = ResultEventPayload> {
|
|
5
|
+
method: HttpMethod;
|
|
6
|
+
path: string;
|
|
7
|
+
params?: TParams;
|
|
8
|
+
_response?: TResponse;
|
|
9
|
+
}
|
package/dist/cjs/version.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const VERSION: "2.7.
|
|
1
|
+
export declare const VERSION: "2.7.64";
|
package/dist/cjs/version.js
CHANGED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { NotificationEventPayload } from '../types/event/notification/notificationEventPayload.types';
|
|
2
|
+
import { BaseNetworkRequest } from '../types/event/network/networkEvent.types';
|
|
3
|
+
import { ActionEventPayload } from '../types/event/action/actionEventPayload.types';
|
|
4
|
+
import { ResultEventPayload } from '../types/event/result/resultEventPayload.types';
|
|
5
|
+
import { MainModuleKey } from '../services/authStore';
|
|
6
|
+
export declare abstract class BaseFetchModule {
|
|
7
|
+
protected readonly rootUrl: string;
|
|
8
|
+
private readonly authKey;
|
|
9
|
+
protected constructor(rootUrl: string, authKey: MainModuleKey);
|
|
10
|
+
protected sendFetch<TParams extends ActionEventPayload, TResponse extends ResultEventPayload>(request: BaseNetworkRequest<TParams, TResponse>): Promise<TResponse | NotificationEventPayload>;
|
|
11
|
+
}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { AuthStore } from '../services/authStore';
|
|
2
|
+
export class BaseFetchModule {
|
|
3
|
+
rootUrl;
|
|
4
|
+
authKey;
|
|
5
|
+
constructor(rootUrl, authKey) {
|
|
6
|
+
this.rootUrl = rootUrl;
|
|
7
|
+
this.authKey = authKey;
|
|
8
|
+
}
|
|
9
|
+
async sendFetch(request) {
|
|
10
|
+
const { method, path, params } = request;
|
|
11
|
+
const init = { method };
|
|
12
|
+
const headers = {};
|
|
13
|
+
const jwt = AuthStore.getInstance().get(this.authKey);
|
|
14
|
+
if (jwt) {
|
|
15
|
+
headers['Authorization'] = `Bearer ${jwt}`;
|
|
16
|
+
}
|
|
17
|
+
if (params !== undefined) {
|
|
18
|
+
headers['Content-Type'] = 'application/json';
|
|
19
|
+
init.body = JSON.stringify(params);
|
|
20
|
+
}
|
|
21
|
+
if (Object.keys(headers).length) {
|
|
22
|
+
init.headers = headers;
|
|
23
|
+
}
|
|
24
|
+
try {
|
|
25
|
+
const response = await fetch(`${this.rootUrl}${path}`, init);
|
|
26
|
+
if (!response.ok) {
|
|
27
|
+
return {
|
|
28
|
+
status: 'error',
|
|
29
|
+
message: `Fetch failed [${method} ${path}]: ${response.status} ${response.statusText}`,
|
|
30
|
+
};
|
|
31
|
+
}
|
|
32
|
+
return (await response.json());
|
|
33
|
+
}
|
|
34
|
+
catch (e) {
|
|
35
|
+
return {
|
|
36
|
+
status: 'error',
|
|
37
|
+
message: e instanceof Error ? e.message : `Fetch failed [${method} ${path}]`,
|
|
38
|
+
error: e instanceof Error ? e : undefined,
|
|
39
|
+
};
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
}
|
|
@@ -2,9 +2,10 @@ import { ActionEventName } from '../types/event/action/actionEvent.types';
|
|
|
2
2
|
import { ActionEventPayload } from '../types/event/action/actionEventPayload.types';
|
|
3
3
|
import { ResultEventPayload } from '../types/event/result/resultEventPayload.types';
|
|
4
4
|
import { NotificationEventPayload } from '../types/event/notification/notificationEventPayload.types';
|
|
5
|
-
import
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
5
|
+
import { BaseFetchModule } from '../modules/baseFetchModule';
|
|
6
|
+
import { MainModuleKey } from '../services/authStore';
|
|
7
|
+
export declare abstract class BaseModule extends BaseFetchModule {
|
|
8
|
+
protected moduleType: MainModuleKey;
|
|
9
|
+
constructor(moduleType: MainModuleKey, apiRoot?: string);
|
|
9
10
|
protected sendRequest<T extends ResultEventPayload | NotificationEventPayload>(eventName: ActionEventName, eventPayload?: ActionEventPayload): Promise<T>;
|
|
10
11
|
}
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import { EmbedCommunicator } from '../services/embedCommunicator';
|
|
2
|
-
|
|
2
|
+
import { BaseFetchModule } from '../modules/baseFetchModule';
|
|
3
|
+
export class BaseModule extends BaseFetchModule {
|
|
3
4
|
moduleType;
|
|
4
|
-
constructor(moduleType) {
|
|
5
|
+
constructor(moduleType, apiRoot) {
|
|
6
|
+
super(apiRoot ?? '', moduleType);
|
|
5
7
|
this.moduleType = moduleType;
|
|
6
8
|
}
|
|
7
9
|
async sendRequest(eventName, eventPayload) {
|
|
@@ -3,7 +3,7 @@ import { BaseModule } from '../../modules/baseModule';
|
|
|
3
3
|
import { GetCatalogCategoriesResultPayload, GetCatalogProductsByIdsPayload, GetCatalogProductsPayload, GetCatalogProductsResultPayload, GetSingleCatalogProductPayload, GetSingleCatalogProductResultPayload } from './types';
|
|
4
4
|
import { WithHandledResponses } from '../../helpers/typeHelper.types';
|
|
5
5
|
export declare class CatalogModule extends BaseModule implements WithHandledResponses<ICatalogModule> {
|
|
6
|
-
constructor();
|
|
6
|
+
constructor(baseApiUrl?: string);
|
|
7
7
|
getProducts(data: GetCatalogProductsPayload): Promise<import("../..").HandledResponse<GetCatalogProductsResultPayload, Error>>;
|
|
8
8
|
getProductsByIds(data: GetCatalogProductsByIdsPayload): Promise<import("../..").HandledResponse<GetCatalogProductsResultPayload, Error>>;
|
|
9
9
|
getProduct(data: GetSingleCatalogProductPayload): Promise<import("../..").HandledResponse<GetSingleCatalogProductResultPayload, Error>>;
|
|
@@ -2,9 +2,10 @@ import { BaseModule } from '../../modules/baseModule';
|
|
|
2
2
|
import { EVENTS_ACTION, } from './types';
|
|
3
3
|
import { handleResponse } from '../../helpers/responseHandler';
|
|
4
4
|
import { MODULE_NAMES } from '../../modules/modules';
|
|
5
|
+
import { AuthStore } from '../../services/authStore';
|
|
5
6
|
export class CatalogModule extends BaseModule {
|
|
6
|
-
constructor() {
|
|
7
|
-
super(MODULE_NAMES.SDK);
|
|
7
|
+
constructor(baseApiUrl) {
|
|
8
|
+
super(MODULE_NAMES.SDK, baseApiUrl);
|
|
8
9
|
}
|
|
9
10
|
async getProducts(data) {
|
|
10
11
|
const response = await this.sendRequest(EVENTS_ACTION.GET_CATALOG_PRODUCTS, data).catch((e) => e);
|
|
@@ -19,6 +20,14 @@ export class CatalogModule extends BaseModule {
|
|
|
19
20
|
return handleResponse(response, 'Failed to get catalog products');
|
|
20
21
|
}
|
|
21
22
|
async getCategories() {
|
|
23
|
+
const hasJwt = !!AuthStore.getInstance().get(this.moduleType);
|
|
24
|
+
if (hasJwt) {
|
|
25
|
+
const response = await this.sendFetch({
|
|
26
|
+
method: 'POST',
|
|
27
|
+
path: '/v1/sdk/get-catalog-categories',
|
|
28
|
+
});
|
|
29
|
+
return handleResponse(response, 'Failed to get catalog categories');
|
|
30
|
+
}
|
|
22
31
|
const response = await this.sendRequest(EVENTS_ACTION.GET_CATALOG_CATEGORIES).catch((e) => e);
|
|
23
32
|
return handleResponse(response, 'Failed to get catalog categories');
|
|
24
33
|
}
|
|
@@ -124,8 +124,7 @@ export type EDMParams = ({
|
|
|
124
124
|
elementId: string;
|
|
125
125
|
element?: null;
|
|
126
126
|
} & EDMCommonParams);
|
|
127
|
-
|
|
128
|
-
nonce: string;
|
|
127
|
+
interface EDMCommonParamsBase {
|
|
129
128
|
externalProductId: string;
|
|
130
129
|
iframeClassName?: string;
|
|
131
130
|
origin?: string;
|
|
@@ -136,6 +135,25 @@ export interface EDMCommonParams {
|
|
|
136
135
|
};
|
|
137
136
|
debug?: boolean;
|
|
138
137
|
}
|
|
138
|
+
interface EDMJwtParams extends EDMCommonParamsBase {
|
|
139
|
+
jwt: string;
|
|
140
|
+
nonce?: never;
|
|
141
|
+
}
|
|
142
|
+
interface EDMNonceParams extends EDMCommonParamsBase {
|
|
143
|
+
/** @deprecated Use jwt instead */
|
|
144
|
+
nonce: string;
|
|
145
|
+
jwt?: never;
|
|
146
|
+
}
|
|
147
|
+
export type EDMCommonParams = EDMJwtParams | EDMNonceParams;
|
|
148
|
+
type EDMElementVariants = {
|
|
149
|
+
element: HTMLElement;
|
|
150
|
+
elementId?: null;
|
|
151
|
+
} | {
|
|
152
|
+
elementId: string;
|
|
153
|
+
element?: null;
|
|
154
|
+
};
|
|
155
|
+
export type EDMParamsWithJwt = EDMElementVariants & EDMJwtParams;
|
|
156
|
+
export type EDMParamsWithNonce = EDMElementVariants & EDMNonceParams;
|
|
139
157
|
export interface Message {
|
|
140
158
|
type: string;
|
|
141
159
|
message: string;
|
|
@@ -214,3 +232,4 @@ export interface TOSStepResponse extends OnStepStatusUpdateEvent {
|
|
|
214
232
|
stepData: TOSStepData;
|
|
215
233
|
}
|
|
216
234
|
export type StepResponse = MockupStepResponse | PricingEditStepResponse | DetailsEditStepResponse | TOSStepResponse;
|
|
235
|
+
export {};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { MODULE_DEPENDENCY_MAP } from '../modules/modules';
|
|
2
|
+
export type MainModuleKey = (typeof MODULE_DEPENDENCY_MAP)[keyof typeof MODULE_DEPENDENCY_MAP];
|
|
3
|
+
export declare class AuthStore {
|
|
4
|
+
private static instance;
|
|
5
|
+
private tokens;
|
|
6
|
+
static getInstance(): AuthStore;
|
|
7
|
+
set(key: MainModuleKey, jwt: string): void;
|
|
8
|
+
get(key: MainModuleKey): string | undefined;
|
|
9
|
+
delete(key: MainModuleKey): void;
|
|
10
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
export class AuthStore {
|
|
2
|
+
static instance;
|
|
3
|
+
tokens = new Map();
|
|
4
|
+
static getInstance() {
|
|
5
|
+
if (!AuthStore.instance) {
|
|
6
|
+
AuthStore.instance = new AuthStore();
|
|
7
|
+
}
|
|
8
|
+
return AuthStore.instance;
|
|
9
|
+
}
|
|
10
|
+
set(key, jwt) {
|
|
11
|
+
this.tokens.set(key, jwt);
|
|
12
|
+
}
|
|
13
|
+
get(key) {
|
|
14
|
+
return this.tokens.get(key);
|
|
15
|
+
}
|
|
16
|
+
delete(key) {
|
|
17
|
+
this.tokens.delete(key);
|
|
18
|
+
}
|
|
19
|
+
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { EDMConfig,
|
|
1
|
+
import { EDMConfig, EDMParamsWithJwt, EDMParamsWithNonce } from '../modules/edm/types/data.types';
|
|
2
2
|
import { EdmBroadcastModule } from '../modules/edm/edmBroadcastModule';
|
|
3
3
|
import { BroadcastListeners } from '../modules/edm/types/event/broadcastEvent.types';
|
|
4
4
|
import type { AddImagePayload, NavigateStepPayload, SetStylePayload } from '../modules/edm/types';
|
|
@@ -12,7 +12,9 @@ export declare class EDM {
|
|
|
12
12
|
private communicator;
|
|
13
13
|
private moduleLoader;
|
|
14
14
|
private initialized;
|
|
15
|
-
constructor(params:
|
|
15
|
+
constructor(params: EDMParamsWithJwt, config?: EDMConfig, callbacks?: Partial<BroadcastListeners>);
|
|
16
|
+
/** @deprecated Use jwt instead of nonce */
|
|
17
|
+
constructor(params: EDMParamsWithNonce, config?: EDMConfig, callbacks?: Partial<BroadcastListeners>);
|
|
16
18
|
init(): Promise<void>;
|
|
17
19
|
saveDesign(): Promise<import("..").HandledResponse<import("../modules/edm/types").SaveDesignResultPayload, Error>>;
|
|
18
20
|
setStyle(payload: SetStylePayload): Promise<import("..").HandledResponse<import("../modules/edm/types").SetStyleResultPayload, Error>>;
|
package/dist/esm/services/edm.js
CHANGED
|
@@ -6,6 +6,8 @@ import { MODULE_NAMES } from '../modules/moduleNames';
|
|
|
6
6
|
import { VERSION } from '../version';
|
|
7
7
|
import { EdmBroadcastModule } from '../modules/edm/edmBroadcastModule';
|
|
8
8
|
import { EDM_BROADCAST_EVENT_MAP } from '../types/event/broadcast/broadcastEventMap';
|
|
9
|
+
import { parseJwt } from '../helpers/jwtDecoder';
|
|
10
|
+
import { AuthStore } from '../services/authStore';
|
|
9
11
|
export class EDM {
|
|
10
12
|
params;
|
|
11
13
|
config;
|
|
@@ -20,7 +22,19 @@ export class EDM {
|
|
|
20
22
|
constructor(params, config, callbacks) {
|
|
21
23
|
this.params = params;
|
|
22
24
|
this.config = config;
|
|
23
|
-
|
|
25
|
+
if (params.jwt !== undefined) {
|
|
26
|
+
const { data, error } = parseJwt(params.jwt);
|
|
27
|
+
if (error) {
|
|
28
|
+
throw new Error('Failed to decode JWT');
|
|
29
|
+
}
|
|
30
|
+
this.nonce = data.nce;
|
|
31
|
+
}
|
|
32
|
+
else {
|
|
33
|
+
this.nonce = params.nonce;
|
|
34
|
+
}
|
|
35
|
+
if (params.jwt !== undefined) {
|
|
36
|
+
AuthStore.getInstance().set(MODULE_NAMES.EDM, params.jwt);
|
|
37
|
+
}
|
|
24
38
|
EDM.broadCastEventHandler = new EdmBroadcastModule(callbacks);
|
|
25
39
|
this.communicator.registerBroadcastDispatcher(MODULE_NAMES.EDM, EDM_BROADCAST_EVENT_MAP);
|
|
26
40
|
setLoggerState(params?.debug ?? false, SOURCES.EDM);
|
|
@@ -89,6 +103,7 @@ export class EDM {
|
|
|
89
103
|
}
|
|
90
104
|
this.communicator.cleanup();
|
|
91
105
|
this.moduleLoader.clearCache();
|
|
106
|
+
AuthStore.getInstance().delete(MODULE_NAMES.EDM);
|
|
92
107
|
this.initialized = false;
|
|
93
108
|
EDM.broadCastEventHandler = null;
|
|
94
109
|
}
|
|
@@ -13,7 +13,7 @@ export declare class Embed {
|
|
|
13
13
|
readonly catalog: CatalogService;
|
|
14
14
|
readonly mockup: MockupService;
|
|
15
15
|
readonly publish: ProductPublishService;
|
|
16
|
-
constructor(
|
|
16
|
+
constructor(jwt: string, config?: SdkConfig | undefined);
|
|
17
17
|
init(): Promise<void>;
|
|
18
18
|
destroy(): void;
|
|
19
19
|
getNonce(): string;
|
|
@@ -7,6 +7,8 @@ import { ProductPublishService } from '../modules/product-publish/productPublish
|
|
|
7
7
|
import { LOG_TYPES, logEmbedMessage, setLoggerState, SOURCES, } from '../helpers/messageLogger';
|
|
8
8
|
import { MODULE_NAMES } from '../modules/modules';
|
|
9
9
|
import { VERSION } from '../version';
|
|
10
|
+
import { parseJwt } from '../helpers/jwtDecoder';
|
|
11
|
+
import { AuthStore } from '../services/authStore';
|
|
10
12
|
export class Embed {
|
|
11
13
|
config;
|
|
12
14
|
static BASE_URL = globalThis.__FYUL_TESTING_VARS__?.sdkUrl ??
|
|
@@ -20,9 +22,17 @@ export class Embed {
|
|
|
20
22
|
catalog;
|
|
21
23
|
mockup;
|
|
22
24
|
publish;
|
|
23
|
-
constructor(
|
|
25
|
+
constructor(jwt, config) {
|
|
24
26
|
this.config = config;
|
|
25
|
-
|
|
27
|
+
const { data, error } = parseJwt(jwt);
|
|
28
|
+
if (error) {
|
|
29
|
+
// If decoding fails, it means that regular nonce was passed, for now leave as is till deprecation for nonce is finished
|
|
30
|
+
this.nonce = jwt;
|
|
31
|
+
}
|
|
32
|
+
else {
|
|
33
|
+
this.nonce = data.nce;
|
|
34
|
+
AuthStore.getInstance().set(MODULE_NAMES.SDK, jwt);
|
|
35
|
+
}
|
|
26
36
|
setLoggerState(config?.debug ?? false, SOURCES.SDK);
|
|
27
37
|
// Initialize services
|
|
28
38
|
this.catalog = new CatalogService();
|
|
@@ -75,6 +85,7 @@ export class Embed {
|
|
|
75
85
|
}
|
|
76
86
|
this.communicator.cleanup();
|
|
77
87
|
this.moduleLoader.clearCache();
|
|
88
|
+
AuthStore.getInstance().delete(MODULE_NAMES.SDK);
|
|
78
89
|
this.initialized = false;
|
|
79
90
|
}
|
|
80
91
|
getNonce() {
|
|
@@ -4,6 +4,7 @@ import { ModuleConfig, ModuleConfigData } from '../types/module/moduleConfig.typ
|
|
|
4
4
|
export type ModuleInstance = InstanceType<(typeof MODULES)[keyof typeof MODULES]>;
|
|
5
5
|
export declare class ModuleLoaderService {
|
|
6
6
|
private static instance;
|
|
7
|
+
static BASE_API_URL: string;
|
|
7
8
|
private communicator;
|
|
8
9
|
private moduleCache;
|
|
9
10
|
static getInstance(): ModuleLoaderService;
|
|
@@ -4,6 +4,8 @@ import { EVENTS_ACTION } from '../modules/sdk/types';
|
|
|
4
4
|
import { LOG_TYPES, logEmbedMessage } from '../helpers/messageLogger';
|
|
5
5
|
export class ModuleLoaderService {
|
|
6
6
|
static instance;
|
|
7
|
+
static BASE_API_URL = globalThis.__FYUL_TESTING_VARS__?.sdkApiUrl ??
|
|
8
|
+
'https://ewl.printify.com/api';
|
|
7
9
|
communicator = EmbedCommunicator.getInstance();
|
|
8
10
|
moduleCache = new Map();
|
|
9
11
|
static getInstance() {
|
|
@@ -14,7 +16,7 @@ export class ModuleLoaderService {
|
|
|
14
16
|
}
|
|
15
17
|
getModule(moduleName) {
|
|
16
18
|
if (!this.isModuleLoaded(moduleName)) {
|
|
17
|
-
const module = new MODULES[moduleName]();
|
|
19
|
+
const module = new MODULES[moduleName](ModuleLoaderService.BASE_API_URL);
|
|
18
20
|
this.moduleCache.set(moduleName, module);
|
|
19
21
|
}
|
|
20
22
|
return this.moduleCache.get(moduleName);
|
|
@@ -7,6 +7,7 @@ import { VERSION } from '../version';
|
|
|
7
7
|
import { WhiteLabelBroadcastModule } from '../modules/white-label/whiteLabelBroadcastModule';
|
|
8
8
|
import { parseJwt } from '../helpers/jwtDecoder';
|
|
9
9
|
import { WHITE_LABEL_BROADCAST_EVENT_MAP } from '../types/event/broadcast/broadcastEventMap';
|
|
10
|
+
import { AuthStore } from '../services/authStore';
|
|
10
11
|
export class WhiteLabel {
|
|
11
12
|
params;
|
|
12
13
|
config;
|
|
@@ -22,6 +23,7 @@ export class WhiteLabel {
|
|
|
22
23
|
this.params = params;
|
|
23
24
|
this.config = config;
|
|
24
25
|
this.jwt = params.jwt;
|
|
26
|
+
AuthStore.getInstance().set(MODULE_NAMES.WHITE_LABEL, params.jwt);
|
|
25
27
|
WhiteLabel.broadCastEventHandler = new WhiteLabelBroadcastModule(callbacks);
|
|
26
28
|
this.communicator.registerBroadcastDispatcher(MODULE_NAMES.WHITE_LABEL, WHITE_LABEL_BROADCAST_EVENT_MAP);
|
|
27
29
|
setLoggerState(params?.debug ?? false, SOURCES.WHITE_LABEL);
|
|
@@ -92,6 +94,7 @@ export class WhiteLabel {
|
|
|
92
94
|
}
|
|
93
95
|
this.communicator.cleanup();
|
|
94
96
|
this.moduleLoader.clearCache();
|
|
97
|
+
AuthStore.getInstance().delete(MODULE_NAMES.WHITE_LABEL);
|
|
95
98
|
this.initialized = false;
|
|
96
99
|
WhiteLabel.broadCastEventHandler = null;
|
|
97
100
|
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { ActionEventPayload } from '../action/actionEventPayload.types';
|
|
2
|
+
import type { ResultEventPayload } from '../result/resultEventPayload.types';
|
|
3
|
+
export type HttpMethod = 'GET' | 'POST' | 'PUT' | 'PATCH' | 'DELETE';
|
|
4
|
+
export interface BaseNetworkRequest<TParams extends ActionEventPayload = undefined, TResponse extends ResultEventPayload = ResultEventPayload> {
|
|
5
|
+
method: HttpMethod;
|
|
6
|
+
path: string;
|
|
7
|
+
params?: TParams;
|
|
8
|
+
_response?: TResponse;
|
|
9
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/dist/esm/version.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const VERSION: "2.7.
|
|
1
|
+
export declare const VERSION: "2.7.64";
|
package/dist/esm/version.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// AUTO-GENERATED
|
|
2
|
-
export const VERSION = '2.7.
|
|
2
|
+
export const VERSION = '2.7.64';
|