@fyul/embed-sdk 2.4.18 → 2.5.0
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/helpers/messageLogger.d.ts +1 -0
- package/dist/cjs/helpers/messageLogger.js +2 -0
- package/dist/cjs/index.d.ts +2 -0
- package/dist/cjs/index.js +4 -1
- package/dist/cjs/modules/baseModule.d.ts +2 -2
- package/dist/cjs/modules/edm/broadcastEvents/baseEdmBroadcastEvent.d.ts +2 -1
- package/dist/cjs/modules/eventTypes.d.ts +3 -3
- package/dist/cjs/modules/events.d.ts +12 -0
- package/dist/cjs/modules/events.js +5 -0
- package/dist/cjs/modules/mockup-generation/types/data.types.d.ts +1 -1
- package/dist/cjs/modules/moduleNames.d.ts +1 -0
- package/dist/cjs/modules/moduleNames.js +1 -0
- package/dist/cjs/modules/modules.d.ts +3 -0
- package/dist/cjs/modules/modules.js +3 -0
- package/dist/cjs/modules/white-label/broadcastEvents/baseWhiteLabelBroadcastEvent.d.ts +6 -0
- package/dist/cjs/modules/white-label/broadcastEvents/baseWhiteLabelBroadcastEvent.js +10 -0
- package/dist/cjs/modules/white-label/broadcastEvents/onShoppingCartUpdate.d.ts +5 -0
- package/dist/cjs/modules/white-label/broadcastEvents/onShoppingCartUpdate.js +10 -0
- package/dist/cjs/modules/white-label/events.d.ts +22 -0
- package/dist/cjs/modules/white-label/events.js +23 -0
- package/dist/cjs/modules/white-label/types/data.types.d.ts +30 -0
- package/dist/cjs/modules/white-label/types/data.types.js +2 -0
- package/dist/cjs/modules/white-label/types/event/actionEvent.types.d.ts +5 -0
- package/dist/cjs/modules/white-label/types/event/actionEvent.types.js +2 -0
- package/dist/cjs/modules/white-label/types/event/actionEventPayload.types.d.ts +8 -0
- package/dist/cjs/modules/white-label/types/event/actionEventPayload.types.js +2 -0
- package/dist/cjs/modules/white-label/types/event/broadcastEvent.types.d.ts +8 -0
- package/dist/cjs/modules/white-label/types/event/broadcastEvent.types.js +2 -0
- package/dist/cjs/modules/white-label/types/event/broadcastEventPayload.types.d.ts +3 -0
- package/dist/cjs/modules/white-label/types/event/broadcastEventPayload.types.js +2 -0
- package/dist/cjs/modules/white-label/types/event/resultEvent.types.d.ts +5 -0
- package/dist/cjs/modules/white-label/types/event/resultEvent.types.js +2 -0
- package/dist/cjs/modules/white-label/types/event/resultEventPayload.types.d.ts +4 -0
- package/dist/cjs/modules/white-label/types/event/resultEventPayload.types.js +3 -0
- package/dist/cjs/modules/white-label/types/index.d.ts +8 -0
- package/dist/cjs/modules/white-label/types/index.js +27 -0
- package/dist/cjs/modules/white-label/whiteLabelBroadcastModule.d.ts +8 -0
- package/dist/cjs/modules/white-label/whiteLabelBroadcastModule.js +15 -0
- package/dist/cjs/modules/white-label/whiteLabelModule.d.ts +10 -0
- package/dist/cjs/modules/white-label/whiteLabelModule.js +21 -0
- package/dist/cjs/services/embedCommunicator.d.ts +4 -4
- package/dist/cjs/services/embedCommunicator.js +7 -6
- package/dist/cjs/services/whiteLabel.d.ts +20 -0
- package/dist/cjs/services/whiteLabel.js +89 -0
- package/dist/cjs/types/event/action/actionEvent.types.d.ts +2 -1
- package/dist/cjs/types/event/action/actionEventPayload.types.d.ts +2 -1
- package/dist/cjs/types/event/broadcast/baseBroadcastEventHandler.d.ts +4 -0
- package/dist/cjs/types/event/broadcast/baseBroadcastEventHandler.js +2 -0
- package/dist/cjs/types/event/broadcast/broadcastEvent.types.d.ts +2 -1
- package/dist/cjs/types/event/broadcast/broadcastEventMap.d.ts +2 -0
- package/dist/cjs/types/event/broadcast/broadcastEventMap.js +2 -0
- package/dist/cjs/types/event/broadcast/broadcastEventPayload.types.d.ts +3 -2
- package/dist/cjs/types/event/result/resultEvent.types.d.ts +2 -1
- package/dist/cjs/types/event/result/resultEventPayload.types.d.ts +2 -1
- package/dist/cjs/types/module/module.types.d.ts +9 -0
- package/dist/cjs/version.d.ts +1 -1
- package/dist/cjs/version.js +1 -1
- package/dist/esm/helpers/messageLogger.d.ts +1 -0
- package/dist/esm/helpers/messageLogger.js +2 -0
- package/dist/esm/index.d.ts +2 -0
- package/dist/esm/index.js +2 -0
- package/dist/esm/modules/baseModule.d.ts +2 -2
- package/dist/esm/modules/edm/broadcastEvents/baseEdmBroadcastEvent.d.ts +2 -1
- package/dist/esm/modules/eventTypes.d.ts +3 -3
- package/dist/esm/modules/events.d.ts +12 -0
- package/dist/esm/modules/events.js +5 -0
- package/dist/esm/modules/mockup-generation/types/data.types.d.ts +1 -1
- package/dist/esm/modules/moduleNames.d.ts +1 -0
- package/dist/esm/modules/moduleNames.js +1 -0
- package/dist/esm/modules/modules.d.ts +3 -0
- package/dist/esm/modules/modules.js +3 -0
- package/dist/esm/modules/white-label/broadcastEvents/baseWhiteLabelBroadcastEvent.d.ts +6 -0
- package/dist/esm/modules/white-label/broadcastEvents/baseWhiteLabelBroadcastEvent.js +6 -0
- package/dist/esm/modules/white-label/broadcastEvents/onShoppingCartUpdate.d.ts +5 -0
- package/dist/esm/modules/white-label/broadcastEvents/onShoppingCartUpdate.js +6 -0
- package/dist/esm/modules/white-label/events.d.ts +22 -0
- package/dist/esm/modules/white-label/events.js +20 -0
- package/dist/esm/modules/white-label/types/data.types.d.ts +30 -0
- package/dist/esm/modules/white-label/types/data.types.js +1 -0
- package/dist/esm/modules/white-label/types/event/actionEvent.types.d.ts +5 -0
- package/dist/esm/modules/white-label/types/event/actionEvent.types.js +1 -0
- package/dist/esm/modules/white-label/types/event/actionEventPayload.types.d.ts +8 -0
- package/dist/esm/modules/white-label/types/event/actionEventPayload.types.js +1 -0
- package/dist/esm/modules/white-label/types/event/broadcastEvent.types.d.ts +8 -0
- package/dist/esm/modules/white-label/types/event/broadcastEvent.types.js +1 -0
- package/dist/esm/modules/white-label/types/event/broadcastEventPayload.types.d.ts +3 -0
- package/dist/esm/modules/white-label/types/event/broadcastEventPayload.types.js +1 -0
- package/dist/esm/modules/white-label/types/event/resultEvent.types.d.ts +5 -0
- package/dist/esm/modules/white-label/types/event/resultEvent.types.js +1 -0
- package/dist/esm/modules/white-label/types/event/resultEventPayload.types.d.ts +4 -0
- package/dist/esm/modules/white-label/types/event/resultEventPayload.types.js +2 -0
- package/dist/esm/modules/white-label/types/index.d.ts +8 -0
- package/dist/esm/modules/white-label/types/index.js +11 -0
- package/dist/esm/modules/white-label/whiteLabelBroadcastModule.d.ts +8 -0
- package/dist/esm/modules/white-label/whiteLabelBroadcastModule.js +11 -0
- package/dist/esm/modules/white-label/whiteLabelModule.d.ts +10 -0
- package/dist/esm/modules/white-label/whiteLabelModule.js +17 -0
- package/dist/esm/services/embedCommunicator.d.ts +4 -4
- package/dist/esm/services/embedCommunicator.js +7 -6
- package/dist/esm/services/whiteLabel.d.ts +20 -0
- package/dist/esm/services/whiteLabel.js +85 -0
- package/dist/esm/types/event/action/actionEvent.types.d.ts +2 -1
- package/dist/esm/types/event/action/actionEventPayload.types.d.ts +2 -1
- package/dist/esm/types/event/broadcast/baseBroadcastEventHandler.d.ts +4 -0
- package/dist/esm/types/event/broadcast/baseBroadcastEventHandler.js +1 -0
- package/dist/esm/types/event/broadcast/broadcastEvent.types.d.ts +2 -1
- package/dist/esm/types/event/broadcast/broadcastEventMap.d.ts +2 -0
- package/dist/esm/types/event/broadcast/broadcastEventMap.js +2 -0
- package/dist/esm/types/event/broadcast/broadcastEventPayload.types.d.ts +3 -2
- package/dist/esm/types/event/result/resultEvent.types.d.ts +2 -1
- package/dist/esm/types/event/result/resultEventPayload.types.d.ts +2 -1
- package/dist/esm/types/module/module.types.d.ts +9 -0
- package/dist/esm/version.d.ts +1 -1
- package/dist/esm/version.js +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { WhiteLabelConfig, WhiteLabelParams } from '../modules/white-label/types/data.types';
|
|
2
|
+
import { WhiteLabelBroadcastModule } from '../modules/white-label/whiteLabelBroadcastModule';
|
|
3
|
+
import { BroadcastListeners } from '../modules/white-label/types/event/broadcastEvent.types';
|
|
4
|
+
import { GoToViewPayload } from '../modules/white-label/types';
|
|
5
|
+
export declare class WhiteLabel {
|
|
6
|
+
private params;
|
|
7
|
+
private config?;
|
|
8
|
+
static BASE_URL: string;
|
|
9
|
+
static broadCastEventHandler: WhiteLabelBroadcastModule | null;
|
|
10
|
+
private nonce;
|
|
11
|
+
private iFrameManager;
|
|
12
|
+
private communicator;
|
|
13
|
+
private moduleLoader;
|
|
14
|
+
private initialized;
|
|
15
|
+
constructor(params: WhiteLabelParams, config?: WhiteLabelConfig | undefined, callbacks?: Partial<BroadcastListeners>);
|
|
16
|
+
init(): Promise<void>;
|
|
17
|
+
destroy(): void;
|
|
18
|
+
goToView(payload: GoToViewPayload): Promise<import("..").HandledResponse<import("../modules/white-label/types").GoToViewResultPayload, Error>>;
|
|
19
|
+
static getBroadCastEventHandler(): WhiteLabelBroadcastModule;
|
|
20
|
+
}
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.WhiteLabel = void 0;
|
|
4
|
+
const iFrameManager_1 = require("../services/iFrameManager");
|
|
5
|
+
const embedCommunicator_1 = require("../services/embedCommunicator");
|
|
6
|
+
const moduleLoaderService_1 = require("../services/moduleLoaderService");
|
|
7
|
+
const messageLogger_1 = require("../helpers/messageLogger");
|
|
8
|
+
const moduleNames_1 = require("../modules/moduleNames");
|
|
9
|
+
const version_1 = require("../version");
|
|
10
|
+
const whiteLabelBroadcastModule_1 = require("../modules/white-label/whiteLabelBroadcastModule");
|
|
11
|
+
class WhiteLabel {
|
|
12
|
+
params;
|
|
13
|
+
config;
|
|
14
|
+
static BASE_URL = 'https://embed-white-label-fe.nonprod.printify.com/iframe';
|
|
15
|
+
static broadCastEventHandler;
|
|
16
|
+
nonce;
|
|
17
|
+
iFrameManager = null;
|
|
18
|
+
communicator = embedCommunicator_1.EmbedCommunicator.getInstance();
|
|
19
|
+
moduleLoader = moduleLoaderService_1.ModuleLoaderService.getInstance();
|
|
20
|
+
initialized = false;
|
|
21
|
+
constructor(params, config, callbacks) {
|
|
22
|
+
this.params = params;
|
|
23
|
+
this.config = config;
|
|
24
|
+
this.nonce = params.nonce;
|
|
25
|
+
WhiteLabel.broadCastEventHandler = new whiteLabelBroadcastModule_1.WhiteLabelBroadcastModule(callbacks);
|
|
26
|
+
(0, messageLogger_1.setLoggerState)(params?.debug ?? false, messageLogger_1.SOURCES.WHITE_LABEL);
|
|
27
|
+
}
|
|
28
|
+
async init() {
|
|
29
|
+
if (this.initialized) {
|
|
30
|
+
(0, messageLogger_1.logEmbedMessage)({
|
|
31
|
+
message: 'WhiteLabel already initialized',
|
|
32
|
+
logType: messageLogger_1.LOG_TYPES.WARN,
|
|
33
|
+
});
|
|
34
|
+
return;
|
|
35
|
+
}
|
|
36
|
+
const elementToBindTo = this.params.element ?? document.getElementById(this.params.elementId);
|
|
37
|
+
if (!elementToBindTo) {
|
|
38
|
+
(0, messageLogger_1.logEmbedMessage)({
|
|
39
|
+
message: 'Cant find element for WhiteLabel',
|
|
40
|
+
logType: messageLogger_1.LOG_TYPES.ERROR,
|
|
41
|
+
});
|
|
42
|
+
return;
|
|
43
|
+
}
|
|
44
|
+
this.iFrameManager = new iFrameManager_1.iFrameManager({
|
|
45
|
+
baseUrl: WhiteLabel.BASE_URL,
|
|
46
|
+
urlParams: {
|
|
47
|
+
nonce: this.nonce,
|
|
48
|
+
sdkMode: true,
|
|
49
|
+
},
|
|
50
|
+
class: this.params.iframeClassName,
|
|
51
|
+
elementToAppendTo: elementToBindTo,
|
|
52
|
+
});
|
|
53
|
+
await this.iFrameManager.create();
|
|
54
|
+
this.communicator.setIFrameManager(moduleNames_1.MODULE_NAMES.WHITE_LABEL, this.iFrameManager);
|
|
55
|
+
this.communicator.setupListener();
|
|
56
|
+
const whiteLabelModule = this.moduleLoader.getModule(moduleNames_1.MODULE_NAMES.WHITE_LABEL);
|
|
57
|
+
const notification = await whiteLabelModule.setup({
|
|
58
|
+
...this.config,
|
|
59
|
+
...this.params,
|
|
60
|
+
clientVersion: version_1.VERSION,
|
|
61
|
+
});
|
|
62
|
+
(0, messageLogger_1.logEmbedMessage)({
|
|
63
|
+
message: ['WhiteLabel setup notification', notification],
|
|
64
|
+
logType: messageLogger_1.LOG_TYPES.LOG,
|
|
65
|
+
});
|
|
66
|
+
this.initialized = true;
|
|
67
|
+
}
|
|
68
|
+
destroy() {
|
|
69
|
+
if (this.iFrameManager) {
|
|
70
|
+
this.iFrameManager.destroy();
|
|
71
|
+
this.iFrameManager = null;
|
|
72
|
+
}
|
|
73
|
+
this.communicator.cleanup();
|
|
74
|
+
this.moduleLoader.clearCache();
|
|
75
|
+
this.initialized = false;
|
|
76
|
+
WhiteLabel.broadCastEventHandler = null;
|
|
77
|
+
}
|
|
78
|
+
goToView(payload) {
|
|
79
|
+
const whiteLabelModule = this.moduleLoader.getModule(moduleNames_1.MODULE_NAMES.WHITE_LABEL);
|
|
80
|
+
return whiteLabelModule.goToView(payload);
|
|
81
|
+
}
|
|
82
|
+
static getBroadCastEventHandler() {
|
|
83
|
+
if (!WhiteLabel.broadCastEventHandler) {
|
|
84
|
+
throw new Error('No active WhiteLabelBroadcastModule instance');
|
|
85
|
+
}
|
|
86
|
+
return WhiteLabel.broadCastEventHandler;
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
exports.WhiteLabel = WhiteLabel;
|
|
@@ -3,10 +3,11 @@ import { ActionEvent as CatalogActionEvent } from '../../../modules/catalog/type
|
|
|
3
3
|
import { ActionEvent as MockupGenerationActionEvent } from '../../../modules/mockup-generation/types/event/actionEvent.types';
|
|
4
4
|
import { ActionEvent as ProductPublishActionEvent } from '../../../modules/product-publish/types/event/actionEvent.types';
|
|
5
5
|
import { ActionEvent as EdmActionEvent } from '../../../modules/edm/types/event/actionEvent.types';
|
|
6
|
+
import { ActionEvent as WhiteLabelActionEvent } from '../../../modules/white-label/types/event/actionEvent.types';
|
|
6
7
|
import { ALL_ACTION_EVENTS } from '../../../modules/events';
|
|
7
8
|
import { Event } from '../../../types/event/event.types';
|
|
8
9
|
import { EVENT_TYPES } from '../../../modules/eventTypes';
|
|
9
10
|
import { ActionEventPayload } from './actionEventPayload.types';
|
|
10
11
|
export type ActionEventName = (typeof ALL_ACTION_EVENTS)[keyof typeof ALL_ACTION_EVENTS];
|
|
11
12
|
export type BaseActionEvent<TName extends ActionEventName, TPayload extends ActionEventPayload> = Event<TName, typeof EVENT_TYPES.ACTION, TPayload>;
|
|
12
|
-
export type ActionEvent = MockupGenerationActionEvent | CatalogActionEvent | ProductPublishActionEvent | SdkActionEvent | EdmActionEvent;
|
|
13
|
+
export type ActionEvent = MockupGenerationActionEvent | CatalogActionEvent | ProductPublishActionEvent | SdkActionEvent | EdmActionEvent | WhiteLabelActionEvent;
|
|
@@ -3,4 +3,5 @@ import { ActionEventPayload as CatalogEventPayload } from '../../../modules/cata
|
|
|
3
3
|
import { ActionEventPayload as MockupGenerationEventPayload } from '../../../modules/mockup-generation/types/event/actionEventPayload.types';
|
|
4
4
|
import { ActionEventPayload as ProductPublishEventPayload } from '../../../modules/product-publish/types/event/actionEventPayload.types';
|
|
5
5
|
import { ActionEventPayload as EdmEventPayload } from '../../../modules/edm/types/event/actionEventPayload.types';
|
|
6
|
-
|
|
6
|
+
import { ActionEventPayload as WhiteLabelEventPayload } from '../../../modules/white-label/types/event/actionEventPayload.types';
|
|
7
|
+
export type ActionEventPayload = LoadModulePayload | MockupGenerationEventPayload | CatalogEventPayload | SdkEventPayload | ProductPublishEventPayload | EdmEventPayload | WhiteLabelEventPayload | undefined;
|
|
@@ -3,6 +3,7 @@ import { Event } from '../../../types/event/event.types';
|
|
|
3
3
|
import { EVENT_TYPES } from '../../../modules/eventTypes';
|
|
4
4
|
import { BroadcastEventPayload } from '../../../types/event/broadcast/broadcastEventPayload.types';
|
|
5
5
|
import { BroadcastEvent as EdmBroadcastEvent } from '../../../modules/edm/types/event/broadcastEvent.types';
|
|
6
|
+
import { BroadcastEvent as WhiteLabelBroadcastEvent } from '../../../modules/white-label/types/event/broadcastEvent.types';
|
|
6
7
|
export type BroadcastEventName = (typeof ALL_BROADCAST_EVENTS)[keyof typeof ALL_BROADCAST_EVENTS];
|
|
7
8
|
export type BaseBroadcastEvent<TName extends BroadcastEventName, TPayload extends BroadcastEventPayload> = Event<TName, typeof EVENT_TYPES.BROADCAST, TPayload>;
|
|
8
|
-
export type BroadcastEvent = EdmBroadcastEvent;
|
|
9
|
+
export type BroadcastEvent = EdmBroadcastEvent | WhiteLabelBroadcastEvent;
|
|
@@ -3,10 +3,12 @@ import { OnStepStatusUpdate } from '../../../modules/edm/broadcastEvents/onStepS
|
|
|
3
3
|
import { OnPricingStatusUpdate } from '../../../modules/edm/broadcastEvents/onPricingStatusUpdate';
|
|
4
4
|
import { OnFilePickerRequested } from '../../../modules/edm/broadcastEvents/onFilePickerRequested';
|
|
5
5
|
import { OnErrorUpdate } from '../../../modules/edm/broadcastEvents/onErrorUpdate';
|
|
6
|
+
import { OnShoppingCartUpdate } from '../../../modules/white-label/broadcastEvents/onShoppingCartUpdate';
|
|
6
7
|
export declare const BROADCAST_EVENT_MAP: {
|
|
7
8
|
onDesignStatusUpdate: typeof OnDesignStatusUpdate;
|
|
8
9
|
onFilePickerRequested: typeof OnFilePickerRequested;
|
|
9
10
|
onStepStatusUpdate: typeof OnStepStatusUpdate;
|
|
10
11
|
onPricingStatusUpdate: typeof OnPricingStatusUpdate;
|
|
11
12
|
onError: typeof OnErrorUpdate;
|
|
13
|
+
onShoppingCartUpdate: typeof OnShoppingCartUpdate;
|
|
12
14
|
};
|
|
@@ -7,10 +7,12 @@ const onStepStatusUpdate_1 = require("../../../modules/edm/broadcastEvents/onSte
|
|
|
7
7
|
const onPricingStatusUpdate_1 = require("../../../modules/edm/broadcastEvents/onPricingStatusUpdate");
|
|
8
8
|
const onFilePickerRequested_1 = require("../../../modules/edm/broadcastEvents/onFilePickerRequested");
|
|
9
9
|
const onErrorUpdate_1 = require("../../../modules/edm/broadcastEvents/onErrorUpdate");
|
|
10
|
+
const onShoppingCartUpdate_1 = require("../../../modules/white-label/broadcastEvents/onShoppingCartUpdate");
|
|
10
11
|
exports.BROADCAST_EVENT_MAP = {
|
|
11
12
|
[events_1.ALL_BROADCAST_EVENTS.ON_DESIGN_STATUS_UPDATE]: onDesignStatusUpdate_1.OnDesignStatusUpdate,
|
|
12
13
|
[events_1.ALL_BROADCAST_EVENTS.ON_FILE_PICKER_REQUESTED]: onFilePickerRequested_1.OnFilePickerRequested,
|
|
13
14
|
[events_1.ALL_BROADCAST_EVENTS.ON_STEP_STATUS_UPDATE]: onStepStatusUpdate_1.OnStepStatusUpdate,
|
|
14
15
|
[events_1.ALL_BROADCAST_EVENTS.ON_PRICING_STATUS_UPDATE]: onPricingStatusUpdate_1.OnPricingStatusUpdate,
|
|
15
16
|
[events_1.ALL_BROADCAST_EVENTS.ON_INTERNAL_ERROR]: onErrorUpdate_1.OnErrorUpdate,
|
|
17
|
+
[events_1.ALL_BROADCAST_EVENTS.ON_SHOPPING_CART_UPDATE]: onShoppingCartUpdate_1.OnShoppingCartUpdate,
|
|
16
18
|
};
|
|
@@ -1,2 +1,3 @@
|
|
|
1
|
-
import { BroadcastEventPayload as
|
|
2
|
-
|
|
1
|
+
import { BroadcastEventPayload as EdmBroadcastEventPayload } from '../../../modules/edm/types/event/broadcastEventPayload.types';
|
|
2
|
+
import { BroadcastEventPayload as WhiteLabelBroadcastEventPayload } from '../../../modules/white-label/types/event/broadcastEventPayload.types';
|
|
3
|
+
export type BroadcastEventPayload = EdmBroadcastEventPayload | WhiteLabelBroadcastEventPayload;
|
|
@@ -2,10 +2,11 @@ import { ResultEvent as CatalogResultEvent } from '../../../modules/catalog/type
|
|
|
2
2
|
import { ResultEvent as MockupGenerationResultEvent } from '../../../modules/mockup-generation/types/event/resultEvent.types';
|
|
3
3
|
import { ResultEvent as ProductPublishResultEvent } from '../../../modules/product-publish/types/event/resultEvent.types';
|
|
4
4
|
import { ResultEvent as EdmResultPayload } from '../../../modules/edm/types/event/resultEvent.types';
|
|
5
|
+
import { ResultEvent as WhiteLabelResultPayload } from '../../../modules/white-label/types/event/resultEvent.types';
|
|
5
6
|
import { ResultEventPayload } from './resultEventPayload.types';
|
|
6
7
|
import { EVENT_TYPES } from '../../../modules/eventTypes';
|
|
7
8
|
import { Event } from '../../../types/event/event.types';
|
|
8
9
|
import { ALL_RESULT_EVENTS } from '../../../modules/events';
|
|
9
10
|
export type ResultEventName = (typeof ALL_RESULT_EVENTS)[keyof typeof ALL_RESULT_EVENTS];
|
|
10
11
|
export type BaseResultEvent<TName extends ResultEventName, TPayload extends ResultEventPayload> = Event<TName, typeof EVENT_TYPES.RESULT, TPayload>;
|
|
11
|
-
export type ResultEvent = MockupGenerationResultEvent | CatalogResultEvent | ProductPublishResultEvent | EdmResultPayload;
|
|
12
|
+
export type ResultEvent = MockupGenerationResultEvent | CatalogResultEvent | ProductPublishResultEvent | EdmResultPayload | WhiteLabelResultPayload;
|
|
@@ -2,7 +2,8 @@ import type { CatalogResultPayload } from '../../../modules/catalog/types';
|
|
|
2
2
|
import type { MockupGenerationResultPayload } from '../../../modules/mockup-generation/types';
|
|
3
3
|
import type { ProductPublishResultPayload } from '../../../modules/product-publish/types';
|
|
4
4
|
import type { EdmResultPayload } from '../../../modules/edm/types/event/resultEventPayload.types';
|
|
5
|
-
|
|
5
|
+
import type { WhiteLabelResultPayload } from '../../../modules/white-label/types/event/resultEventPayload.types';
|
|
6
|
+
export type ResultEventPayload = MockupGenerationResultPayload | CatalogResultPayload | ProductPublishResultPayload | EdmResultPayload | WhiteLabelResultPayload;
|
|
6
7
|
export type HandledResponse<T, K extends Error> = {
|
|
7
8
|
data: T;
|
|
8
9
|
error: null;
|
|
@@ -6,6 +6,8 @@ import { NotificationEventPayload } from '../../types/event/notification/notific
|
|
|
6
6
|
import { DeleteProductsPayload, DeleteProductResultPayload, GetProductPublishPayload, GetSavedProductsPayload, GetSavedProductsResultPayload, ProductPublishData } from '../../modules/product-publish/types';
|
|
7
7
|
import { OnDesignStatusEventPayload, OnErrorEventPayload, OnFilePickerRequestedEventPayload, OnPricingStatusUpdateEventPayload, OnStepStatusUpdateEventPayload } from '../../modules/edm/types/event/broadcastEventPayload.types';
|
|
8
8
|
import { AddImagePayload, AddImageResultPayload, InitializeEdmPayload, NavigateStepPayload, NavigateStepResultPayload, SaveDesignResultPayload, SetStylePayload, SetStyleResultPayload } from '../../modules/edm/types';
|
|
9
|
+
import { InitializeWhiteLabelPayload, GoToViewResultPayload, GoToViewPayload } from '../../modules/white-label/types';
|
|
10
|
+
import { OnShoppingCartUpdateEventPayload } from '../../modules/white-label/types/event/broadcastEventPayload.types';
|
|
9
11
|
/** This file ensures that Iframe and SDK has the same source of truth for return values */
|
|
10
12
|
export type ModuleName = (typeof MODULE_NAMES)[keyof typeof MODULE_NAMES];
|
|
11
13
|
export interface ISdkModule {
|
|
@@ -40,3 +42,10 @@ export interface IEdmBroadcastModule {
|
|
|
40
42
|
onStepStatusUpdate(event: OnStepStatusUpdateEventPayload): void;
|
|
41
43
|
onErrorUpdate(event: OnErrorEventPayload): void;
|
|
42
44
|
}
|
|
45
|
+
export interface IWhiteLabelModule {
|
|
46
|
+
setup(config: InitializeWhiteLabelPayload): NotificationEventPayload | void;
|
|
47
|
+
goToView(event: GoToViewPayload): GoToViewResultPayload;
|
|
48
|
+
}
|
|
49
|
+
export interface IWhiteLabelBroadcastModule {
|
|
50
|
+
onShoppingCartUpdate(event: OnShoppingCartUpdateEventPayload): void;
|
|
51
|
+
}
|
package/dist/cjs/version.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const VERSION: "2.
|
|
1
|
+
export declare const VERSION: "2.5.0";
|
package/dist/cjs/version.js
CHANGED
|
@@ -8,6 +8,7 @@ export const SOURCES = {
|
|
|
8
8
|
HOST: 'Host',
|
|
9
9
|
SDK: 'SDK',
|
|
10
10
|
EDM: 'EDM',
|
|
11
|
+
WHITE_LABEL: 'WhiteLabel',
|
|
11
12
|
};
|
|
12
13
|
export const messageLoggerState = {
|
|
13
14
|
isLoggerEnabled: true,
|
|
@@ -29,6 +30,7 @@ function getSourceStyle(source) {
|
|
|
29
30
|
`;
|
|
30
31
|
case SOURCES.EDM:
|
|
31
32
|
case SOURCES.SDK:
|
|
33
|
+
case SOURCES.WHITE_LABEL:
|
|
32
34
|
return `
|
|
33
35
|
background: #3a82f6;
|
|
34
36
|
color: white;
|
package/dist/esm/index.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
export { Embed } from './services/embed';
|
|
2
2
|
export { EDM } from './services/edm';
|
|
3
|
+
export { WhiteLabel } from './services/whiteLabel';
|
|
3
4
|
export * from './types/event/event.types';
|
|
4
5
|
export * from './types/event/eventPayload.types';
|
|
5
6
|
export * from './types/event/action/actionEvent.types';
|
|
@@ -15,6 +16,7 @@ export * as MockupGenerationModule from './modules/mockup-generation/types';
|
|
|
15
16
|
export * as ProductPublishModule from './modules/product-publish/types';
|
|
16
17
|
export * as SdkModule from './modules/sdk/types';
|
|
17
18
|
export * as EdmModule from './modules/edm/types';
|
|
19
|
+
export * as WhiteLabelModule from './modules/white-label/types';
|
|
18
20
|
export { ALL_EVENTS } from './modules/events';
|
|
19
21
|
export { MODULE_NAMES } from './modules/modules';
|
|
20
22
|
export { EVENT_TYPES } from './modules/eventTypes';
|
package/dist/esm/index.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
export { Embed } from './services/embed';
|
|
2
2
|
export { EDM } from './services/edm';
|
|
3
|
+
export { WhiteLabel } from './services/whiteLabel';
|
|
3
4
|
/* EXPORTS */
|
|
4
5
|
// TODO: properly foldered exports?
|
|
5
6
|
// Common types
|
|
@@ -19,6 +20,7 @@ export * as MockupGenerationModule from './modules/mockup-generation/types';
|
|
|
19
20
|
export * as ProductPublishModule from './modules/product-publish/types';
|
|
20
21
|
export * as SdkModule from './modules/sdk/types';
|
|
21
22
|
export * as EdmModule from './modules/edm/types';
|
|
23
|
+
export * as WhiteLabelModule from './modules/white-label/types';
|
|
22
24
|
// Constants
|
|
23
25
|
export { ALL_EVENTS } from './modules/events';
|
|
24
26
|
export { MODULE_NAMES } from './modules/modules';
|
|
@@ -4,7 +4,7 @@ import { ResultEventPayload } from '../types/event/result/resultEventPayload.typ
|
|
|
4
4
|
import { NotificationEventPayload } from '../types/event/notification/notificationEventPayload.types';
|
|
5
5
|
import type { MODULE_NAMES } from '../modules/moduleNames';
|
|
6
6
|
export declare abstract class BaseModule {
|
|
7
|
-
protected moduleType: typeof MODULE_NAMES.SDK | typeof MODULE_NAMES.EDM;
|
|
8
|
-
constructor(moduleType: typeof MODULE_NAMES.SDK | typeof MODULE_NAMES.EDM);
|
|
7
|
+
protected moduleType: typeof MODULE_NAMES.SDK | typeof MODULE_NAMES.EDM | typeof MODULE_NAMES.WHITE_LABEL;
|
|
8
|
+
constructor(moduleType: typeof MODULE_NAMES.SDK | typeof MODULE_NAMES.EDM | typeof MODULE_NAMES.WHITE_LABEL);
|
|
9
9
|
protected sendRequest<T extends ResultEventPayload | NotificationEventPayload>(eventName: ActionEventName, eventPayload?: ActionEventPayload): Promise<T>;
|
|
10
10
|
}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { BroadcastEventPayload } from '../../../modules/edm/types/event/broadcastEventPayload.types';
|
|
2
|
-
|
|
2
|
+
import { BaseBroadcastEventHandler } from '../../../types/event/broadcast/baseBroadcastEventHandler';
|
|
3
|
+
export declare abstract class BaseEdmBroadcastEvent implements BaseBroadcastEventHandler {
|
|
3
4
|
abstract handle(event: BroadcastEventPayload): void;
|
|
4
5
|
get broadcastHandler(): import("../edmBroadcastModule").EdmBroadcastModule;
|
|
5
6
|
}
|
|
@@ -5,7 +5,7 @@ export declare const EVENT_TYPES: {
|
|
|
5
5
|
readonly RESULT: "result";
|
|
6
6
|
readonly BROADCAST: "broadcast";
|
|
7
7
|
};
|
|
8
|
-
export declare function isAction(event: AnyEvent): event is import("./sdk/types").InitializeSdkAction | import("./sdk/types").LoadModuleAction | import("./mockup-generation/types").GetMockupsAction | import("./mockup-generation/types").GetMoreMockupsAction | import("./mockup-generation/types").AdjustMockupAction | import("./edm/types").InitializeEdmAction | import("./edm/types").SaveDesignAction | import("./edm/types").AddImageAction | import("./edm/types").NavigateStepAction | import("./
|
|
8
|
+
export declare function isAction(event: AnyEvent): event is import("./sdk/types").InitializeSdkAction | import("./sdk/types").LoadModuleAction | import("./mockup-generation/types").GetMockupsAction | import("./mockup-generation/types").GetMoreMockupsAction | import("./mockup-generation/types").AdjustMockupAction | import("./edm/types").InitializeEdmAction | import("./edm/types").SaveDesignAction | import("./edm/types").AddImageAction | import("./edm/types").NavigateStepAction | import("./white-label/types").InitializeWhiteLabelAction | import("./catalog/types").GetCatalogCategoriesAction | import("./catalog/types").GetCatalogProductsByIdsAction | import("./catalog/types").GetCatalogProductsAction | import("./catalog/types").GetSingleCatalogProductAction | import("./product-publish/types").DeleteProductsAction | import("./product-publish/types").GetSavedProductsAction | import("./product-publish/types").GetProductPublishAction;
|
|
9
9
|
export declare function isNotification(event: AnyEvent): event is import("..").NotificationEvent;
|
|
10
|
-
export declare function isResult(event: AnyEvent): event is import("./catalog/types").GetCatalogProductsResult | import("./catalog/types").GetSingleCatalogProductResult | import("./catalog/types").GetCatalogCategoriesResult | import("./product-publish/types").GetProductPublishResult | import("./product-publish/types").GetSavedProductsResult | import("./product-publish/types").DeleteProductsResult | import("./edm/types").SaveDesignResultEvent | import("./edm/types").AddImageResultEvent | import("./edm/types").SetStyleResultEvent | import("./edm/types").NavigateStepResultEvent | import("./mockup-generation/types").GetMockupsResultEvent | import("./mockup-generation/types").GetMoreMockupsResultEvent | import("./mockup-generation/types").AdjustMockupResultEvent;
|
|
11
|
-
export declare function isBroadcast(event: AnyEvent): event is import("./edm/types/event/broadcastEvent.types").OnDesignStatusUpdateBroadcast | import("./edm/types/event/broadcastEvent.types").OnPricingStatusUpdateBroadcast | import("./edm/types/event/broadcastEvent.types").OnFilePickerRequestBroadcast | import("./edm/types/event/broadcastEvent.types").OnStepStatusUpdateBroadcast | import("./edm/types/event/broadcastEvent.types").OnErrorUpdateBroadcast;
|
|
10
|
+
export declare function isResult(event: AnyEvent): event is import("./catalog/types").GetCatalogProductsResult | import("./catalog/types").GetSingleCatalogProductResult | import("./catalog/types").GetCatalogCategoriesResult | import("./product-publish/types").GetProductPublishResult | import("./product-publish/types").GetSavedProductsResult | import("./product-publish/types").DeleteProductsResult | import("./edm/types").SaveDesignResultEvent | import("./edm/types").AddImageResultEvent | import("./edm/types").SetStyleResultEvent | import("./edm/types").NavigateStepResultEvent | import("./mockup-generation/types").GetMockupsResultEvent | import("./mockup-generation/types").GetMoreMockupsResultEvent | import("./mockup-generation/types").AdjustMockupResultEvent | import("./white-label/types").GoToViewResultEvent;
|
|
11
|
+
export declare function isBroadcast(event: AnyEvent): event is import("./edm/types/event/broadcastEvent.types").OnDesignStatusUpdateBroadcast | import("./edm/types/event/broadcastEvent.types").OnPricingStatusUpdateBroadcast | import("./edm/types/event/broadcastEvent.types").OnFilePickerRequestBroadcast | import("./edm/types/event/broadcastEvent.types").OnStepStatusUpdateBroadcast | import("./edm/types/event/broadcastEvent.types").OnErrorUpdateBroadcast | import("./white-label/types").OnShoppingCartUpdateBroadcast;
|
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
export declare const ALL_ACTION_EVENTS: {
|
|
2
|
+
readonly INITIALIZE_WHITE_LABEL: "actionInitializeWhiteLabel";
|
|
3
|
+
readonly GO_TO_VIEW: "actionGoToView";
|
|
2
4
|
readonly INITIALIZE_EDM: "actionInitializeEdm";
|
|
3
5
|
readonly SAVE_DESIGN: "actionSaveDesign";
|
|
4
6
|
readonly ADD_IMAGE: "actionAddImage";
|
|
@@ -18,6 +20,8 @@ export declare const ALL_ACTION_EVENTS: {
|
|
|
18
20
|
readonly LOAD_MODULE: "actionLoadModule";
|
|
19
21
|
};
|
|
20
22
|
export declare const ALL_NOTIFICATION_EVENTS: {
|
|
23
|
+
readonly WHITE_LABEL_INITIALIZATION_SUCCESS: "notificationWhiteLabelInitializationSuccess";
|
|
24
|
+
readonly GO_TO_VIEW_FAILURE: "actionGoToViewFailure";
|
|
21
25
|
readonly EDM_INITIALIZATION_SUCCESS: "notificationEdmInitializationSuccess";
|
|
22
26
|
readonly SAVE_DESIGN_FAILURE: "actionSaveDesignFailure";
|
|
23
27
|
readonly ADD_IMAGE_FAILURE: "actionAddImageFailure";
|
|
@@ -35,6 +39,7 @@ export declare const ALL_NOTIFICATION_EVENTS: {
|
|
|
35
39
|
readonly SDK_INITIALIZATION_SUCCESS: "notificationSdkInitializationSuccess";
|
|
36
40
|
};
|
|
37
41
|
export declare const ALL_RESULT_EVENTS: {
|
|
42
|
+
readonly GO_TO_VIEW_RESULT: "resultGoToView";
|
|
38
43
|
readonly SAVE_DESIGN_RESULT: "resultSaveDesign";
|
|
39
44
|
readonly ADD_IMAGE_RESULT: "resultAddImage";
|
|
40
45
|
readonly SET_STYLE_RESULT: "resultSetStyle";
|
|
@@ -50,6 +55,7 @@ export declare const ALL_RESULT_EVENTS: {
|
|
|
50
55
|
readonly GET_CATALOG_CATEGORIES_RESULT: "resultGetCatalogCategories";
|
|
51
56
|
};
|
|
52
57
|
export declare const ALL_BROADCAST_EVENTS: {
|
|
58
|
+
ON_SHOPPING_CART_UPDATE: "onShoppingCartUpdate";
|
|
53
59
|
ON_DESIGN_STATUS_UPDATE: "onDesignStatusUpdate";
|
|
54
60
|
ON_PRICING_STATUS_UPDATE: "onPricingStatusUpdate";
|
|
55
61
|
ON_FILE_PICKER_REQUESTED: "onFilePickerRequested";
|
|
@@ -57,11 +63,13 @@ export declare const ALL_BROADCAST_EVENTS: {
|
|
|
57
63
|
ON_INTERNAL_ERROR: "onError";
|
|
58
64
|
};
|
|
59
65
|
export declare const ALL_EVENTS: {
|
|
66
|
+
readonly ON_SHOPPING_CART_UPDATE: "onShoppingCartUpdate";
|
|
60
67
|
readonly ON_DESIGN_STATUS_UPDATE: "onDesignStatusUpdate";
|
|
61
68
|
readonly ON_PRICING_STATUS_UPDATE: "onPricingStatusUpdate";
|
|
62
69
|
readonly ON_FILE_PICKER_REQUESTED: "onFilePickerRequested";
|
|
63
70
|
readonly ON_STEP_STATUS_UPDATE: "onStepStatusUpdate";
|
|
64
71
|
readonly ON_INTERNAL_ERROR: "onError";
|
|
72
|
+
readonly GO_TO_VIEW_RESULT: "resultGoToView";
|
|
65
73
|
readonly SAVE_DESIGN_RESULT: "resultSaveDesign";
|
|
66
74
|
readonly ADD_IMAGE_RESULT: "resultAddImage";
|
|
67
75
|
readonly SET_STYLE_RESULT: "resultSetStyle";
|
|
@@ -75,6 +83,8 @@ export declare const ALL_EVENTS: {
|
|
|
75
83
|
readonly GET_CATALOG_PRODUCTS_RESULT: "resultGetCatalogProducts";
|
|
76
84
|
readonly GET_SINGLE_CATALOG_PRODUCT_RESULT: "resultGetSingleCatalogProduct";
|
|
77
85
|
readonly GET_CATALOG_CATEGORIES_RESULT: "resultGetCatalogCategories";
|
|
86
|
+
readonly WHITE_LABEL_INITIALIZATION_SUCCESS: "notificationWhiteLabelInitializationSuccess";
|
|
87
|
+
readonly GO_TO_VIEW_FAILURE: "actionGoToViewFailure";
|
|
78
88
|
readonly EDM_INITIALIZATION_SUCCESS: "notificationEdmInitializationSuccess";
|
|
79
89
|
readonly SAVE_DESIGN_FAILURE: "actionSaveDesignFailure";
|
|
80
90
|
readonly ADD_IMAGE_FAILURE: "actionAddImageFailure";
|
|
@@ -90,6 +100,8 @@ export declare const ALL_EVENTS: {
|
|
|
90
100
|
readonly GET_SINGLE_CATALOG_PRODUCT_FAILURE: "actionGetSingleCatalogProductFailure";
|
|
91
101
|
readonly GET_CATALOG_CATEGORIES_FAILURE: "actionGetCatalogCategoriesFailure";
|
|
92
102
|
readonly SDK_INITIALIZATION_SUCCESS: "notificationSdkInitializationSuccess";
|
|
103
|
+
readonly INITIALIZE_WHITE_LABEL: "actionInitializeWhiteLabel";
|
|
104
|
+
readonly GO_TO_VIEW: "actionGoToView";
|
|
93
105
|
readonly INITIALIZE_EDM: "actionInitializeEdm";
|
|
94
106
|
readonly SAVE_DESIGN: "actionSaveDesign";
|
|
95
107
|
readonly ADD_IMAGE: "actionAddImage";
|
|
@@ -3,12 +3,14 @@ import * as EVENTS_CATALOG from './catalog/events';
|
|
|
3
3
|
import * as EVENTS_MOCKUP_GENERATION from './mockup-generation/events';
|
|
4
4
|
import * as EVENTS_PRODUCT_PUBLISH from './product-publish/events';
|
|
5
5
|
import * as EVENTS_EDM from './edm/events';
|
|
6
|
+
import * as EVENTS_WHITE_LABEL from './white-label/events';
|
|
6
7
|
export const ALL_ACTION_EVENTS = {
|
|
7
8
|
...EVENTS_SDK.EVENTS_ACTION,
|
|
8
9
|
...EVENTS_CATALOG.EVENTS_ACTION,
|
|
9
10
|
...EVENTS_MOCKUP_GENERATION.EVENTS_ACTION,
|
|
10
11
|
...EVENTS_PRODUCT_PUBLISH.EVENTS_ACTION,
|
|
11
12
|
...EVENTS_EDM.EVENTS_ACTION,
|
|
13
|
+
...EVENTS_WHITE_LABEL.EVENTS_ACTION,
|
|
12
14
|
};
|
|
13
15
|
export const ALL_NOTIFICATION_EVENTS = {
|
|
14
16
|
...EVENTS_SDK.EVENTS_NOTIFICATION,
|
|
@@ -16,6 +18,7 @@ export const ALL_NOTIFICATION_EVENTS = {
|
|
|
16
18
|
...EVENTS_MOCKUP_GENERATION.EVENTS_NOTIFICATION,
|
|
17
19
|
...EVENTS_PRODUCT_PUBLISH.EVENTS_NOTIFICATION,
|
|
18
20
|
...EVENTS_EDM.EVENTS_NOTIFICATION,
|
|
21
|
+
...EVENTS_WHITE_LABEL.EVENTS_NOTIFICATION,
|
|
19
22
|
};
|
|
20
23
|
export const ALL_RESULT_EVENTS = {
|
|
21
24
|
...EVENTS_SDK.EVENTS_RESULT,
|
|
@@ -23,9 +26,11 @@ export const ALL_RESULT_EVENTS = {
|
|
|
23
26
|
...EVENTS_MOCKUP_GENERATION.EVENTS_RESULT,
|
|
24
27
|
...EVENTS_PRODUCT_PUBLISH.EVENTS_RESULT,
|
|
25
28
|
...EVENTS_EDM.EVENTS_RESULT,
|
|
29
|
+
...EVENTS_WHITE_LABEL.EVENTS_RESULT,
|
|
26
30
|
};
|
|
27
31
|
export const ALL_BROADCAST_EVENTS = {
|
|
28
32
|
...EVENTS_EDM.EVENT_BROADCAST,
|
|
33
|
+
...EVENTS_WHITE_LABEL.EVENT_BROADCAST,
|
|
29
34
|
};
|
|
30
35
|
export const ALL_EVENTS = {
|
|
31
36
|
...ALL_ACTION_EVENTS,
|
|
@@ -3,6 +3,7 @@ import { CatalogModule } from './catalog/catalogModule';
|
|
|
3
3
|
import { MockupGenerationModule } from './mockup-generation/mockupGenerationModule';
|
|
4
4
|
import { ProductPublishModule } from './product-publish/productPublishModule';
|
|
5
5
|
import { EdmModule } from '../modules/edm/edmModule';
|
|
6
|
+
import { WhiteLabelModule } from '../modules/white-label/whiteLabelModule';
|
|
6
7
|
import { MODULE_NAMES } from './moduleNames';
|
|
7
8
|
export { MODULE_NAMES };
|
|
8
9
|
export declare const MODULES: {
|
|
@@ -11,6 +12,7 @@ export declare const MODULES: {
|
|
|
11
12
|
mockupGeneration: typeof MockupGenerationModule;
|
|
12
13
|
productPublish: typeof ProductPublishModule;
|
|
13
14
|
edm: typeof EdmModule;
|
|
15
|
+
whiteLabel: typeof WhiteLabelModule;
|
|
14
16
|
};
|
|
15
17
|
export declare const MODULE_DEPENDENCY_MAP: {
|
|
16
18
|
sdk: "sdk";
|
|
@@ -18,4 +20,5 @@ export declare const MODULE_DEPENDENCY_MAP: {
|
|
|
18
20
|
mockupGeneration: "sdk";
|
|
19
21
|
productPublish: "sdk";
|
|
20
22
|
edm: "edm";
|
|
23
|
+
whiteLabel: "whiteLabel";
|
|
21
24
|
};
|
|
@@ -3,6 +3,7 @@ import { CatalogModule } from './catalog/catalogModule';
|
|
|
3
3
|
import { MockupGenerationModule } from './mockup-generation/mockupGenerationModule';
|
|
4
4
|
import { ProductPublishModule } from './product-publish/productPublishModule';
|
|
5
5
|
import { EdmModule } from '../modules/edm/edmModule';
|
|
6
|
+
import { WhiteLabelModule } from '../modules/white-label/whiteLabelModule';
|
|
6
7
|
import { MODULE_NAMES } from './moduleNames';
|
|
7
8
|
export { MODULE_NAMES };
|
|
8
9
|
export const MODULES = {
|
|
@@ -11,6 +12,7 @@ export const MODULES = {
|
|
|
11
12
|
[MODULE_NAMES.MOCKUP_GENERATION]: MockupGenerationModule,
|
|
12
13
|
[MODULE_NAMES.PRODUCT_PUBLISH]: ProductPublishModule,
|
|
13
14
|
[MODULE_NAMES.EDM]: EdmModule,
|
|
15
|
+
[MODULE_NAMES.WHITE_LABEL]: WhiteLabelModule,
|
|
14
16
|
};
|
|
15
17
|
export const MODULE_DEPENDENCY_MAP = {
|
|
16
18
|
[MODULE_NAMES.SDK]: MODULE_NAMES.SDK,
|
|
@@ -18,4 +20,5 @@ export const MODULE_DEPENDENCY_MAP = {
|
|
|
18
20
|
[MODULE_NAMES.MOCKUP_GENERATION]: MODULE_NAMES.SDK,
|
|
19
21
|
[MODULE_NAMES.PRODUCT_PUBLISH]: MODULE_NAMES.SDK,
|
|
20
22
|
[MODULE_NAMES.EDM]: MODULE_NAMES.EDM,
|
|
23
|
+
[MODULE_NAMES.WHITE_LABEL]: MODULE_NAMES.WHITE_LABEL,
|
|
21
24
|
};
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { BroadcastEventPayload } from '../../../modules/white-label/types/event/broadcastEventPayload.types';
|
|
2
|
+
import { BaseBroadcastEventHandler } from '../../../types/event/broadcast/baseBroadcastEventHandler';
|
|
3
|
+
export declare abstract class BaseWhiteLabelBroadcastEvent implements BaseBroadcastEventHandler {
|
|
4
|
+
abstract handle(event: BroadcastEventPayload): void;
|
|
5
|
+
get broadcastHandler(): import("../whiteLabelBroadcastModule").WhiteLabelBroadcastModule;
|
|
6
|
+
}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { OnShoppingCartUpdateEventPayload } from '../../../modules/white-label/types/event/broadcastEventPayload.types';
|
|
2
|
+
import { BaseWhiteLabelBroadcastEvent } from '../../../modules/white-label/broadcastEvents/baseWhiteLabelBroadcastEvent';
|
|
3
|
+
export declare class OnShoppingCartUpdate extends BaseWhiteLabelBroadcastEvent {
|
|
4
|
+
handle(event: OnShoppingCartUpdateEventPayload): void;
|
|
5
|
+
}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { BaseWhiteLabelBroadcastEvent } from '../../../modules/white-label/broadcastEvents/baseWhiteLabelBroadcastEvent';
|
|
2
|
+
export class OnShoppingCartUpdate extends BaseWhiteLabelBroadcastEvent {
|
|
3
|
+
handle(event) {
|
|
4
|
+
this.broadcastHandler.onShoppingCartUpdate(event);
|
|
5
|
+
}
|
|
6
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
export declare const EVENTS_ACTION: {
|
|
2
|
+
readonly INITIALIZE_WHITE_LABEL: "actionInitializeWhiteLabel";
|
|
3
|
+
readonly GO_TO_VIEW: "actionGoToView";
|
|
4
|
+
};
|
|
5
|
+
export declare const EVENTS_NOTIFICATION: {
|
|
6
|
+
readonly WHITE_LABEL_INITIALIZATION_SUCCESS: "notificationWhiteLabelInitializationSuccess";
|
|
7
|
+
readonly GO_TO_VIEW_FAILURE: "actionGoToViewFailure";
|
|
8
|
+
};
|
|
9
|
+
export declare const EVENTS_RESULT: {
|
|
10
|
+
readonly GO_TO_VIEW_RESULT: "resultGoToView";
|
|
11
|
+
};
|
|
12
|
+
export declare const EVENT_BROADCAST: {
|
|
13
|
+
readonly ON_SHOPPING_CART_UPDATE: "onShoppingCartUpdate";
|
|
14
|
+
};
|
|
15
|
+
export declare const EVENTS: {
|
|
16
|
+
readonly ON_SHOPPING_CART_UPDATE: "onShoppingCartUpdate";
|
|
17
|
+
readonly GO_TO_VIEW_RESULT: "resultGoToView";
|
|
18
|
+
readonly WHITE_LABEL_INITIALIZATION_SUCCESS: "notificationWhiteLabelInitializationSuccess";
|
|
19
|
+
readonly GO_TO_VIEW_FAILURE: "actionGoToViewFailure";
|
|
20
|
+
readonly INITIALIZE_WHITE_LABEL: "actionInitializeWhiteLabel";
|
|
21
|
+
readonly GO_TO_VIEW: "actionGoToView";
|
|
22
|
+
};
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
export const EVENTS_ACTION = {
|
|
2
|
+
INITIALIZE_WHITE_LABEL: 'actionInitializeWhiteLabel',
|
|
3
|
+
GO_TO_VIEW: 'actionGoToView',
|
|
4
|
+
};
|
|
5
|
+
export const EVENTS_NOTIFICATION = {
|
|
6
|
+
WHITE_LABEL_INITIALIZATION_SUCCESS: 'notificationWhiteLabelInitializationSuccess',
|
|
7
|
+
GO_TO_VIEW_FAILURE: 'actionGoToViewFailure',
|
|
8
|
+
};
|
|
9
|
+
export const EVENTS_RESULT = {
|
|
10
|
+
GO_TO_VIEW_RESULT: 'resultGoToView',
|
|
11
|
+
};
|
|
12
|
+
export const EVENT_BROADCAST = {
|
|
13
|
+
ON_SHOPPING_CART_UPDATE: 'onShoppingCartUpdate',
|
|
14
|
+
};
|
|
15
|
+
export const EVENTS = {
|
|
16
|
+
...EVENTS_ACTION,
|
|
17
|
+
...EVENTS_NOTIFICATION,
|
|
18
|
+
...EVENTS_RESULT,
|
|
19
|
+
...EVENT_BROADCAST,
|
|
20
|
+
};
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
export interface WhiteLabelConfig {
|
|
2
|
+
showHeaderMenu?: boolean;
|
|
3
|
+
initialView?: string;
|
|
4
|
+
}
|
|
5
|
+
export type WhiteLabelParams = ({
|
|
6
|
+
element: HTMLElement;
|
|
7
|
+
elementId?: null;
|
|
8
|
+
} & WhiteLabelCommonParams) | ({
|
|
9
|
+
elementId: string;
|
|
10
|
+
element?: null;
|
|
11
|
+
} & WhiteLabelCommonParams);
|
|
12
|
+
export interface WhiteLabelCommonParams {
|
|
13
|
+
nonce: string;
|
|
14
|
+
iframeClassName?: string;
|
|
15
|
+
debug?: boolean;
|
|
16
|
+
}
|
|
17
|
+
export interface CartItem {
|
|
18
|
+
productTemplateId: string;
|
|
19
|
+
externalProductId: string;
|
|
20
|
+
color: string;
|
|
21
|
+
size: string;
|
|
22
|
+
quantity: number;
|
|
23
|
+
productTitle: string;
|
|
24
|
+
imageUrl?: string;
|
|
25
|
+
retailPrice?: number;
|
|
26
|
+
}
|
|
27
|
+
export interface OnShoppingCartUpdateEvent {
|
|
28
|
+
items: CartItem[];
|
|
29
|
+
lastAddedItem: CartItem;
|
|
30
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|