@fyul/embed-sdk 2.5.21 → 2.7.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/types/data.types.d.ts +1 -1
- package/dist/cjs/modules/embed-studio/broadcastEvents/baseEmbedStudioBroadcastEvent.d.ts +6 -0
- package/dist/cjs/modules/embed-studio/broadcastEvents/baseEmbedStudioBroadcastEvent.js +10 -0
- package/dist/cjs/modules/embed-studio/broadcastEvents/onDesignStatusUpdate.d.ts +5 -0
- package/dist/cjs/modules/embed-studio/broadcastEvents/onDesignStatusUpdate.js +10 -0
- package/dist/cjs/modules/embed-studio/broadcastEvents/onErrorUpdate.d.ts +5 -0
- package/dist/cjs/modules/embed-studio/broadcastEvents/onErrorUpdate.js +10 -0
- package/dist/cjs/modules/embed-studio/embedStudioBroadcastModule.d.ts +9 -0
- package/dist/cjs/modules/embed-studio/embedStudioBroadcastModule.js +20 -0
- package/dist/cjs/modules/embed-studio/embedStudioModule.d.ts +10 -0
- package/dist/cjs/modules/embed-studio/embedStudioModule.js +21 -0
- package/dist/cjs/modules/embed-studio/events.d.ts +26 -0
- package/dist/cjs/modules/embed-studio/events.js +25 -0
- package/dist/cjs/modules/embed-studio/types/data.types.d.ts +46 -0
- package/dist/cjs/modules/embed-studio/types/data.types.js +2 -0
- package/dist/cjs/modules/embed-studio/types/event/actionEvent.types.d.ts +7 -0
- package/dist/cjs/modules/embed-studio/types/event/actionEvent.types.js +2 -0
- package/dist/cjs/modules/embed-studio/types/event/actionEventPayload.types.d.ts +9 -0
- package/dist/cjs/modules/embed-studio/types/event/actionEventPayload.types.js +2 -0
- package/dist/cjs/modules/embed-studio/types/event/broadcastEvent.types.d.ts +9 -0
- package/dist/cjs/modules/embed-studio/types/event/broadcastEvent.types.js +2 -0
- package/dist/cjs/modules/embed-studio/types/event/broadcastEventPayload.types.d.ts +4 -0
- package/dist/cjs/modules/embed-studio/types/event/broadcastEventPayload.types.js +2 -0
- package/dist/cjs/modules/embed-studio/types/event/resultEvent.types.d.ts +5 -0
- package/dist/cjs/modules/embed-studio/types/event/resultEvent.types.js +2 -0
- package/dist/cjs/modules/embed-studio/types/event/resultEventPayload.types.d.ts +5 -0
- package/dist/cjs/modules/embed-studio/types/event/resultEventPayload.types.js +2 -0
- package/dist/cjs/modules/embed-studio/types/index.d.ts +8 -0
- package/dist/cjs/modules/embed-studio/types/index.js +27 -0
- package/dist/cjs/modules/eventTypes.d.ts +3 -3
- package/dist/cjs/modules/events.d.ts +14 -6
- package/dist/cjs/modules/events.js +5 -0
- 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/onContentSizeChange.d.ts +5 -0
- package/dist/cjs/modules/white-label/broadcastEvents/onContentSizeChange.js +10 -0
- package/dist/cjs/modules/white-label/events.d.ts +2 -0
- package/dist/cjs/modules/white-label/events.js +1 -0
- package/dist/cjs/modules/white-label/types/data.types.d.ts +4 -0
- package/dist/cjs/modules/white-label/types/event/broadcastEvent.types.d.ts +3 -2
- package/dist/cjs/modules/white-label/types/event/broadcastEventPayload.types.d.ts +3 -2
- package/dist/cjs/modules/white-label/whiteLabelBroadcastModule.d.ts +2 -1
- package/dist/cjs/modules/white-label/whiteLabelBroadcastModule.js +5 -0
- package/dist/cjs/services/embedCommunicator.d.ts +4 -4
- package/dist/cjs/services/embedCommunicator.js +1 -0
- package/dist/cjs/services/embedStudio.d.ts +20 -0
- package/dist/cjs/services/embedStudio.js +88 -0
- package/dist/cjs/services/whiteLabel.js +0 -1
- 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/broadcastEventMap.d.ts +2 -0
- package/dist/cjs/types/event/broadcast/broadcastEventMap.js +4 -0
- 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 +12 -1
- 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/types/data.types.d.ts +1 -1
- package/dist/esm/modules/embed-studio/broadcastEvents/baseEmbedStudioBroadcastEvent.d.ts +6 -0
- package/dist/esm/modules/embed-studio/broadcastEvents/baseEmbedStudioBroadcastEvent.js +6 -0
- package/dist/esm/modules/embed-studio/broadcastEvents/onDesignStatusUpdate.d.ts +5 -0
- package/dist/esm/modules/embed-studio/broadcastEvents/onDesignStatusUpdate.js +6 -0
- package/dist/esm/modules/embed-studio/broadcastEvents/onErrorUpdate.d.ts +5 -0
- package/dist/esm/modules/embed-studio/broadcastEvents/onErrorUpdate.js +6 -0
- package/dist/esm/modules/embed-studio/embedStudioBroadcastModule.d.ts +9 -0
- package/dist/esm/modules/embed-studio/embedStudioBroadcastModule.js +16 -0
- package/dist/esm/modules/embed-studio/embedStudioModule.d.ts +10 -0
- package/dist/esm/modules/embed-studio/embedStudioModule.js +17 -0
- package/dist/esm/modules/embed-studio/events.d.ts +26 -0
- package/dist/esm/modules/embed-studio/events.js +22 -0
- package/dist/esm/modules/embed-studio/types/data.types.d.ts +46 -0
- package/dist/esm/modules/embed-studio/types/data.types.js +1 -0
- package/dist/esm/modules/embed-studio/types/event/actionEvent.types.d.ts +7 -0
- package/dist/esm/modules/embed-studio/types/event/actionEvent.types.js +1 -0
- package/dist/esm/modules/embed-studio/types/event/actionEventPayload.types.d.ts +9 -0
- package/dist/esm/modules/embed-studio/types/event/actionEventPayload.types.js +1 -0
- package/dist/esm/modules/embed-studio/types/event/broadcastEvent.types.d.ts +9 -0
- package/dist/esm/modules/embed-studio/types/event/broadcastEvent.types.js +1 -0
- package/dist/esm/modules/embed-studio/types/event/broadcastEventPayload.types.d.ts +4 -0
- package/dist/esm/modules/embed-studio/types/event/broadcastEventPayload.types.js +1 -0
- package/dist/esm/modules/embed-studio/types/event/resultEvent.types.d.ts +5 -0
- package/dist/esm/modules/embed-studio/types/event/resultEvent.types.js +1 -0
- package/dist/esm/modules/embed-studio/types/event/resultEventPayload.types.d.ts +5 -0
- package/dist/esm/modules/embed-studio/types/event/resultEventPayload.types.js +1 -0
- package/dist/esm/modules/embed-studio/types/index.d.ts +8 -0
- package/dist/esm/modules/embed-studio/types/index.js +11 -0
- package/dist/esm/modules/eventTypes.d.ts +3 -3
- package/dist/esm/modules/events.d.ts +14 -6
- package/dist/esm/modules/events.js +5 -0
- 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/onContentSizeChange.d.ts +5 -0
- package/dist/esm/modules/white-label/broadcastEvents/onContentSizeChange.js +6 -0
- package/dist/esm/modules/white-label/events.d.ts +2 -0
- package/dist/esm/modules/white-label/events.js +1 -0
- package/dist/esm/modules/white-label/types/data.types.d.ts +4 -0
- package/dist/esm/modules/white-label/types/event/broadcastEvent.types.d.ts +3 -2
- package/dist/esm/modules/white-label/types/event/broadcastEventPayload.types.d.ts +3 -2
- package/dist/esm/modules/white-label/whiteLabelBroadcastModule.d.ts +2 -1
- package/dist/esm/modules/white-label/whiteLabelBroadcastModule.js +5 -0
- package/dist/esm/services/embedCommunicator.d.ts +4 -4
- package/dist/esm/services/embedCommunicator.js +1 -0
- package/dist/esm/services/embedStudio.d.ts +20 -0
- package/dist/esm/services/embedStudio.js +84 -0
- package/dist/esm/services/whiteLabel.js +0 -1
- 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/broadcastEventMap.d.ts +2 -0
- package/dist/esm/types/event/broadcast/broadcastEventMap.js +4 -0
- 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 +12 -1
- package/dist/esm/version.d.ts +1 -1
- package/dist/esm/version.js +1 -1
- package/package.json +1 -1
|
@@ -6,6 +6,7 @@ const catalogModule_1 = require("./catalog/catalogModule");
|
|
|
6
6
|
const mockupGenerationModule_1 = require("./mockup-generation/mockupGenerationModule");
|
|
7
7
|
const productPublishModule_1 = require("./product-publish/productPublishModule");
|
|
8
8
|
const edmModule_1 = require("../modules/edm/edmModule");
|
|
9
|
+
const embedStudioModule_1 = require("../modules/embed-studio/embedStudioModule");
|
|
9
10
|
const whiteLabelModule_1 = require("../modules/white-label/whiteLabelModule");
|
|
10
11
|
const moduleNames_1 = require("./moduleNames");
|
|
11
12
|
Object.defineProperty(exports, "MODULE_NAMES", { enumerable: true, get: function () { return moduleNames_1.MODULE_NAMES; } });
|
|
@@ -15,6 +16,7 @@ exports.MODULES = {
|
|
|
15
16
|
[moduleNames_1.MODULE_NAMES.MOCKUP_GENERATION]: mockupGenerationModule_1.MockupGenerationModule,
|
|
16
17
|
[moduleNames_1.MODULE_NAMES.PRODUCT_PUBLISH]: productPublishModule_1.ProductPublishModule,
|
|
17
18
|
[moduleNames_1.MODULE_NAMES.EDM]: edmModule_1.EdmModule,
|
|
19
|
+
[moduleNames_1.MODULE_NAMES.EMBED_STUDIO]: embedStudioModule_1.EmbedStudioModule,
|
|
18
20
|
[moduleNames_1.MODULE_NAMES.WHITE_LABEL]: whiteLabelModule_1.WhiteLabelModule,
|
|
19
21
|
};
|
|
20
22
|
exports.MODULE_DEPENDENCY_MAP = {
|
|
@@ -23,5 +25,6 @@ exports.MODULE_DEPENDENCY_MAP = {
|
|
|
23
25
|
[moduleNames_1.MODULE_NAMES.MOCKUP_GENERATION]: moduleNames_1.MODULE_NAMES.SDK,
|
|
24
26
|
[moduleNames_1.MODULE_NAMES.PRODUCT_PUBLISH]: moduleNames_1.MODULE_NAMES.SDK,
|
|
25
27
|
[moduleNames_1.MODULE_NAMES.EDM]: moduleNames_1.MODULE_NAMES.EDM,
|
|
28
|
+
[moduleNames_1.MODULE_NAMES.EMBED_STUDIO]: moduleNames_1.MODULE_NAMES.EMBED_STUDIO,
|
|
26
29
|
[moduleNames_1.MODULE_NAMES.WHITE_LABEL]: moduleNames_1.MODULE_NAMES.WHITE_LABEL,
|
|
27
30
|
};
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { OnContentSizeChangeEventPayload } from '../../../modules/white-label/types/event/broadcastEventPayload.types';
|
|
2
|
+
import { BaseWhiteLabelBroadcastEvent } from '../../../modules/white-label/broadcastEvents/baseWhiteLabelBroadcastEvent';
|
|
3
|
+
export declare class OnContentSizeChange extends BaseWhiteLabelBroadcastEvent {
|
|
4
|
+
handle(event: OnContentSizeChangeEventPayload): void;
|
|
5
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.OnContentSizeChange = void 0;
|
|
4
|
+
const baseWhiteLabelBroadcastEvent_1 = require("../../../modules/white-label/broadcastEvents/baseWhiteLabelBroadcastEvent");
|
|
5
|
+
class OnContentSizeChange extends baseWhiteLabelBroadcastEvent_1.BaseWhiteLabelBroadcastEvent {
|
|
6
|
+
handle(event) {
|
|
7
|
+
this.broadcastHandler.onContentSizeChange(event);
|
|
8
|
+
}
|
|
9
|
+
}
|
|
10
|
+
exports.OnContentSizeChange = OnContentSizeChange;
|
|
@@ -11,9 +11,11 @@ export declare const EVENTS_RESULT: {
|
|
|
11
11
|
};
|
|
12
12
|
export declare const EVENT_BROADCAST: {
|
|
13
13
|
readonly ON_SHOPPING_CART_UPDATE: "onShoppingCartUpdate";
|
|
14
|
+
readonly ON_CONTENT_SIZE_CHANGE: "onContentSizeChange";
|
|
14
15
|
};
|
|
15
16
|
export declare const EVENTS: {
|
|
16
17
|
readonly ON_SHOPPING_CART_UPDATE: "onShoppingCartUpdate";
|
|
18
|
+
readonly ON_CONTENT_SIZE_CHANGE: "onContentSizeChange";
|
|
17
19
|
readonly GO_TO_VIEW_RESULT: "resultGoToView";
|
|
18
20
|
readonly WHITE_LABEL_INITIALIZATION_SUCCESS: "notificationWhiteLabelInitializationSuccess";
|
|
19
21
|
readonly GO_TO_VIEW_FAILURE: "actionGoToViewFailure";
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
export interface WhiteLabelConfig {
|
|
2
2
|
showHeaderMenu?: boolean;
|
|
3
3
|
initialView?: string;
|
|
4
|
+
showScrollbar?: boolean;
|
|
4
5
|
}
|
|
5
6
|
export type WhiteLabelParams = ({
|
|
6
7
|
element: HTMLElement;
|
|
@@ -28,3 +29,6 @@ export interface OnShoppingCartUpdateEvent {
|
|
|
28
29
|
items: CartItem[];
|
|
29
30
|
lastAddedItem: CartItem;
|
|
30
31
|
}
|
|
32
|
+
export interface OnContentSizeChangeEvent {
|
|
33
|
+
height: number;
|
|
34
|
+
}
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { EVENT_BROADCAST } from '../../../../modules/white-label/events';
|
|
2
2
|
import { BaseBroadcastEvent } from '../../../../types/event/broadcast/broadcastEvent.types';
|
|
3
|
-
import { OnShoppingCartUpdateEventPayload } from '../../../../modules/white-label/types/event/broadcastEventPayload.types';
|
|
3
|
+
import { OnShoppingCartUpdateEventPayload, OnContentSizeChangeEventPayload } from '../../../../modules/white-label/types/event/broadcastEventPayload.types';
|
|
4
4
|
export type OnShoppingCartUpdateBroadcast = BaseBroadcastEvent<typeof EVENT_BROADCAST.ON_SHOPPING_CART_UPDATE, OnShoppingCartUpdateEventPayload>;
|
|
5
|
-
export type
|
|
5
|
+
export type OnContentSizeChangeBroadcast = BaseBroadcastEvent<typeof EVENT_BROADCAST.ON_CONTENT_SIZE_CHANGE, OnContentSizeChangeEventPayload>;
|
|
6
|
+
export type BroadcastEvent = OnShoppingCartUpdateBroadcast | OnContentSizeChangeBroadcast;
|
|
6
7
|
export type BroadcastListeners = {
|
|
7
8
|
[K in BroadcastEvent as K['name']]: (event: Exclude<K['payload'], undefined>) => void;
|
|
8
9
|
};
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
-
import { OnShoppingCartUpdateEvent } from '../../../../modules/white-label/types';
|
|
1
|
+
import { OnShoppingCartUpdateEvent, OnContentSizeChangeEvent } from '../../../../modules/white-label/types';
|
|
2
2
|
export type OnShoppingCartUpdateEventPayload = OnShoppingCartUpdateEvent;
|
|
3
|
-
export type
|
|
3
|
+
export type OnContentSizeChangeEventPayload = OnContentSizeChangeEvent;
|
|
4
|
+
export type BroadcastEventPayload = OnShoppingCartUpdateEventPayload | OnContentSizeChangeEventPayload;
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { IWhiteLabelBroadcastModule } from '../../types/module/module.types';
|
|
2
2
|
import { BroadcastListeners } from '../../modules/white-label/types/event/broadcastEvent.types';
|
|
3
|
-
import { OnShoppingCartUpdateEventPayload } from '../../modules/white-label/types/event/broadcastEventPayload.types';
|
|
3
|
+
import { OnShoppingCartUpdateEventPayload, OnContentSizeChangeEventPayload } from '../../modules/white-label/types/event/broadcastEventPayload.types';
|
|
4
4
|
export declare class WhiteLabelBroadcastModule implements IWhiteLabelBroadcastModule {
|
|
5
5
|
protected listeners?: Partial<BroadcastListeners>;
|
|
6
6
|
constructor(listeners?: Partial<BroadcastListeners>);
|
|
7
7
|
onShoppingCartUpdate(event: OnShoppingCartUpdateEventPayload): void;
|
|
8
|
+
onContentSizeChange(event: OnContentSizeChangeEventPayload): void;
|
|
8
9
|
}
|
|
@@ -11,5 +11,10 @@ class WhiteLabelBroadcastModule {
|
|
|
11
11
|
this.listeners.onShoppingCartUpdate(event);
|
|
12
12
|
}
|
|
13
13
|
}
|
|
14
|
+
onContentSizeChange(event) {
|
|
15
|
+
if (this.listeners?.onContentSizeChange) {
|
|
16
|
+
this.listeners.onContentSizeChange(event);
|
|
17
|
+
}
|
|
18
|
+
}
|
|
14
19
|
}
|
|
15
20
|
exports.WhiteLabelBroadcastModule = WhiteLabelBroadcastModule;
|
|
@@ -11,17 +11,17 @@ export declare class EmbedCommunicator {
|
|
|
11
11
|
private isListening;
|
|
12
12
|
private constructor();
|
|
13
13
|
static getInstance(): EmbedCommunicator;
|
|
14
|
-
sendCorrelatedRequest<TReturn>(eventName: ActionEventName, moduleType: typeof MODULE_NAMES.SDK | typeof MODULE_NAMES.EDM | typeof MODULE_NAMES.WHITE_LABEL, payload?: ActionEventPayload): Promise<TReturn>;
|
|
15
|
-
setIFrameManager(mainModule: typeof MODULE_NAMES.SDK | typeof MODULE_NAMES.EDM | typeof MODULE_NAMES.WHITE_LABEL, iFrameManager: iFrameManager): void;
|
|
14
|
+
sendCorrelatedRequest<TReturn>(eventName: ActionEventName, moduleType: typeof MODULE_NAMES.SDK | typeof MODULE_NAMES.EDM | typeof MODULE_NAMES.EMBED_STUDIO | typeof MODULE_NAMES.WHITE_LABEL, payload?: ActionEventPayload): Promise<TReturn>;
|
|
15
|
+
setIFrameManager(mainModule: typeof MODULE_NAMES.SDK | typeof MODULE_NAMES.EDM | typeof MODULE_NAMES.EMBED_STUDIO | typeof MODULE_NAMES.WHITE_LABEL, iFrameManager: iFrameManager): void;
|
|
16
16
|
setupListener(): void;
|
|
17
17
|
private handleInboundMessageEvent;
|
|
18
18
|
private handleInboundEvent;
|
|
19
19
|
private handleInboundEventNotification;
|
|
20
20
|
private getIframeManagerByMainModule;
|
|
21
21
|
private isNotificationSuccess;
|
|
22
|
-
isValidBroadcastEvent(event: BroadcastEvent): false | import("../modules/edm/types").OnDesignStatusEvent | import("../modules/edm/types").OnErrorEvent | import("../modules/edm/types").OnFilePickerRequestedEvent | import("../modules/edm/types").StepResponse | import("../modules/white-label/types").OnShoppingCartUpdateEvent | import("../modules/edm/types/event/broadcastEventPayload.types").OnPricingStatusUpdateEventPayload | undefined;
|
|
22
|
+
isValidBroadcastEvent(event: BroadcastEvent): false | import("../modules/edm/types").OnDesignStatusEvent | import("../modules/edm/types").OnErrorEvent | import("../modules/edm/types").OnFilePickerRequestedEvent | import("../modules/edm/types").StepResponse | import("../modules/white-label/types").OnShoppingCartUpdateEvent | import("../modules/white-label/types").OnContentSizeChangeEvent | import("../modules/edm/types/event/broadcastEventPayload.types").OnPricingStatusUpdateEventPayload | undefined;
|
|
23
23
|
private resolveSuccessfulEvent;
|
|
24
24
|
handleBroadcastEvent(event: BroadcastEvent): void;
|
|
25
|
-
protected send(event: ActionEvent, moduleType: typeof MODULE_NAMES.SDK | typeof MODULE_NAMES.EDM | typeof MODULE_NAMES.WHITE_LABEL): void;
|
|
25
|
+
protected send(event: ActionEvent, moduleType: typeof MODULE_NAMES.SDK | typeof MODULE_NAMES.EDM | typeof MODULE_NAMES.EMBED_STUDIO | typeof MODULE_NAMES.WHITE_LABEL): void;
|
|
26
26
|
cleanup(): void;
|
|
27
27
|
}
|
|
@@ -14,6 +14,7 @@ class EmbedCommunicator {
|
|
|
14
14
|
iFrameManagers = {
|
|
15
15
|
[moduleNames_1.MODULE_NAMES.SDK]: null,
|
|
16
16
|
[moduleNames_1.MODULE_NAMES.EDM]: null,
|
|
17
|
+
[moduleNames_1.MODULE_NAMES.EMBED_STUDIO]: null,
|
|
17
18
|
[moduleNames_1.MODULE_NAMES.WHITE_LABEL]: null,
|
|
18
19
|
};
|
|
19
20
|
isListening = false;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { EmbedStudioBroadcastModule } from '../modules/embed-studio/embedStudioBroadcastModule';
|
|
2
|
+
import type { EmbedStudioParams, EmbedStudioConfig } from '../modules/embed-studio/types/data.types';
|
|
3
|
+
import type { EmbedStudioBroadcastListeners } from '../modules/embed-studio/types/event/broadcastEvent.types';
|
|
4
|
+
import type { SaveDesignResultPayload } from '../modules/embed-studio/types/event/resultEventPayload.types';
|
|
5
|
+
import type { HandledResponse } from '../types/event/result/resultEventPayload.types';
|
|
6
|
+
export declare class EmbedStudio {
|
|
7
|
+
private params;
|
|
8
|
+
private config?;
|
|
9
|
+
static BASE_URL: string;
|
|
10
|
+
static broadCastEventHandler: EmbedStudioBroadcastModule | null;
|
|
11
|
+
private iFrameManager;
|
|
12
|
+
private communicator;
|
|
13
|
+
private moduleLoader;
|
|
14
|
+
private initialized;
|
|
15
|
+
constructor(params: EmbedStudioParams, config?: EmbedStudioConfig | undefined, callbacks?: Partial<EmbedStudioBroadcastListeners>);
|
|
16
|
+
init(): Promise<void>;
|
|
17
|
+
saveDesign(): Promise<HandledResponse<SaveDesignResultPayload, Error>>;
|
|
18
|
+
destroy(): void;
|
|
19
|
+
static getBroadCastEventHandler(): EmbedStudioBroadcastModule;
|
|
20
|
+
}
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.EmbedStudio = 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 embedStudioBroadcastModule_1 = require("../modules/embed-studio/embedStudioBroadcastModule");
|
|
8
|
+
const moduleNames_1 = require("../modules/moduleNames");
|
|
9
|
+
const version_1 = require("../version");
|
|
10
|
+
const messageLogger_1 = require("../helpers/messageLogger");
|
|
11
|
+
class EmbedStudio {
|
|
12
|
+
params;
|
|
13
|
+
config;
|
|
14
|
+
static BASE_URL = globalThis.__FYUL_TESTING_VARS__?.iframeUrl ??
|
|
15
|
+
'https://embed-studio.fyul.com';
|
|
16
|
+
static broadCastEventHandler = null;
|
|
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
|
+
EmbedStudio.broadCastEventHandler = new embedStudioBroadcastModule_1.EmbedStudioBroadcastModule(callbacks);
|
|
25
|
+
(0, messageLogger_1.setLoggerState)(params?.debug ?? false, messageLogger_1.SOURCES.EMBED_STUDIO);
|
|
26
|
+
}
|
|
27
|
+
async init() {
|
|
28
|
+
if (this.initialized) {
|
|
29
|
+
(0, messageLogger_1.logEmbedMessage)({
|
|
30
|
+
message: 'EmbedStudio already initialized',
|
|
31
|
+
logType: messageLogger_1.LOG_TYPES.WARN,
|
|
32
|
+
});
|
|
33
|
+
return;
|
|
34
|
+
}
|
|
35
|
+
const elementToBindTo = this.params.element ?? document.getElementById(this.params.elementId);
|
|
36
|
+
if (!elementToBindTo) {
|
|
37
|
+
(0, messageLogger_1.logEmbedMessage)({
|
|
38
|
+
message: 'Cant find element for EmbedStudio',
|
|
39
|
+
logType: messageLogger_1.LOG_TYPES.ERROR,
|
|
40
|
+
});
|
|
41
|
+
return;
|
|
42
|
+
}
|
|
43
|
+
this.iFrameManager = new iFrameManager_1.iFrameManager({
|
|
44
|
+
baseUrl: EmbedStudio.BASE_URL,
|
|
45
|
+
urlParams: {
|
|
46
|
+
nonce: this.params.nonce,
|
|
47
|
+
sdkMode: true,
|
|
48
|
+
},
|
|
49
|
+
class: this.params.iframeClassName,
|
|
50
|
+
elementToAppendTo: elementToBindTo,
|
|
51
|
+
});
|
|
52
|
+
await this.iFrameManager.create();
|
|
53
|
+
this.communicator.setIFrameManager(moduleNames_1.MODULE_NAMES.EMBED_STUDIO, this.iFrameManager);
|
|
54
|
+
this.communicator.setupListener();
|
|
55
|
+
const embedStudioModule = this.moduleLoader.getModule(moduleNames_1.MODULE_NAMES.EMBED_STUDIO);
|
|
56
|
+
const notification = await embedStudioModule.setup({
|
|
57
|
+
...this.config,
|
|
58
|
+
...this.params,
|
|
59
|
+
clientVersion: version_1.VERSION,
|
|
60
|
+
});
|
|
61
|
+
(0, messageLogger_1.logEmbedMessage)({
|
|
62
|
+
message: ['EmbedStudio setup notification', notification],
|
|
63
|
+
logType: messageLogger_1.LOG_TYPES.LOG,
|
|
64
|
+
});
|
|
65
|
+
this.initialized = true;
|
|
66
|
+
}
|
|
67
|
+
saveDesign() {
|
|
68
|
+
const module = this.moduleLoader.getModule(moduleNames_1.MODULE_NAMES.EMBED_STUDIO);
|
|
69
|
+
return module.saveDesign();
|
|
70
|
+
}
|
|
71
|
+
destroy() {
|
|
72
|
+
if (this.iFrameManager) {
|
|
73
|
+
this.iFrameManager.destroy();
|
|
74
|
+
this.iFrameManager = null;
|
|
75
|
+
}
|
|
76
|
+
this.communicator.cleanup();
|
|
77
|
+
this.moduleLoader.clearCache();
|
|
78
|
+
this.initialized = false;
|
|
79
|
+
EmbedStudio.broadCastEventHandler = null;
|
|
80
|
+
}
|
|
81
|
+
static getBroadCastEventHandler() {
|
|
82
|
+
if (!EmbedStudio.broadCastEventHandler) {
|
|
83
|
+
throw new Error('No active EmbedStudioBroadcastModule instance');
|
|
84
|
+
}
|
|
85
|
+
return EmbedStudio.broadCastEventHandler;
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
exports.EmbedStudio = EmbedStudio;
|
|
@@ -3,6 +3,7 @@ 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 EmbedStudioActionEvent } from '../../../modules/embed-studio/types/event/actionEvent.types';
|
|
6
7
|
import { ActionEvent as WhiteLabelActionEvent } from '../../../modules/white-label/types/event/actionEvent.types';
|
|
7
8
|
import { ALL_ACTION_EVENTS } from '../../../modules/events';
|
|
8
9
|
import { Event } from '../../../types/event/event.types';
|
|
@@ -10,4 +11,4 @@ import { EVENT_TYPES } from '../../../modules/eventTypes';
|
|
|
10
11
|
import { ActionEventPayload } from './actionEventPayload.types';
|
|
11
12
|
export type ActionEventName = (typeof ALL_ACTION_EVENTS)[keyof typeof ALL_ACTION_EVENTS];
|
|
12
13
|
export type BaseActionEvent<TName extends ActionEventName, TPayload extends ActionEventPayload> = Event<TName, typeof EVENT_TYPES.ACTION, TPayload>;
|
|
13
|
-
export type ActionEvent = MockupGenerationActionEvent | CatalogActionEvent | ProductPublishActionEvent | SdkActionEvent | EdmActionEvent | WhiteLabelActionEvent;
|
|
14
|
+
export type ActionEvent = MockupGenerationActionEvent | CatalogActionEvent | ProductPublishActionEvent | SdkActionEvent | EdmActionEvent | EmbedStudioActionEvent | WhiteLabelActionEvent;
|
|
@@ -3,5 +3,6 @@ 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
|
+
import { ActionEventPayload as EmbedStudioActionEventPayload } from '../../../modules/embed-studio/types/event/actionEventPayload.types';
|
|
6
7
|
import { ActionEventPayload as WhiteLabelEventPayload } from '../../../modules/white-label/types/event/actionEventPayload.types';
|
|
7
|
-
export type ActionEventPayload = LoadModulePayload | MockupGenerationEventPayload | CatalogEventPayload | SdkEventPayload | ProductPublishEventPayload | EdmEventPayload | WhiteLabelEventPayload | undefined;
|
|
8
|
+
export type ActionEventPayload = LoadModulePayload | MockupGenerationEventPayload | CatalogEventPayload | SdkEventPayload | ProductPublishEventPayload | EdmEventPayload | EmbedStudioActionEventPayload | WhiteLabelEventPayload | undefined;
|
|
@@ -4,6 +4,7 @@ import { OnPricingStatusUpdate } from '../../../modules/edm/broadcastEvents/onPr
|
|
|
4
4
|
import { OnFilePickerRequested } from '../../../modules/edm/broadcastEvents/onFilePickerRequested';
|
|
5
5
|
import { OnErrorUpdate } from '../../../modules/edm/broadcastEvents/onErrorUpdate';
|
|
6
6
|
import { OnShoppingCartUpdate } from '../../../modules/white-label/broadcastEvents/onShoppingCartUpdate';
|
|
7
|
+
import { OnContentSizeChange } from '../../../modules/white-label/broadcastEvents/onContentSizeChange';
|
|
7
8
|
export declare const BROADCAST_EVENT_MAP: {
|
|
8
9
|
onDesignStatusUpdate: typeof OnDesignStatusUpdate;
|
|
9
10
|
onFilePickerRequested: typeof OnFilePickerRequested;
|
|
@@ -11,4 +12,5 @@ export declare const BROADCAST_EVENT_MAP: {
|
|
|
11
12
|
onPricingStatusUpdate: typeof OnPricingStatusUpdate;
|
|
12
13
|
onError: typeof OnErrorUpdate;
|
|
13
14
|
onShoppingCartUpdate: typeof OnShoppingCartUpdate;
|
|
15
|
+
onContentSizeChange: typeof OnContentSizeChange;
|
|
14
16
|
};
|
|
@@ -8,11 +8,15 @@ const onPricingStatusUpdate_1 = require("../../../modules/edm/broadcastEvents/on
|
|
|
8
8
|
const onFilePickerRequested_1 = require("../../../modules/edm/broadcastEvents/onFilePickerRequested");
|
|
9
9
|
const onErrorUpdate_1 = require("../../../modules/edm/broadcastEvents/onErrorUpdate");
|
|
10
10
|
const onShoppingCartUpdate_1 = require("../../../modules/white-label/broadcastEvents/onShoppingCartUpdate");
|
|
11
|
+
const onContentSizeChange_1 = require("../../../modules/white-label/broadcastEvents/onContentSizeChange");
|
|
11
12
|
exports.BROADCAST_EVENT_MAP = {
|
|
13
|
+
// EDM
|
|
12
14
|
[events_1.ALL_BROADCAST_EVENTS.ON_DESIGN_STATUS_UPDATE]: onDesignStatusUpdate_1.OnDesignStatusUpdate,
|
|
13
15
|
[events_1.ALL_BROADCAST_EVENTS.ON_FILE_PICKER_REQUESTED]: onFilePickerRequested_1.OnFilePickerRequested,
|
|
14
16
|
[events_1.ALL_BROADCAST_EVENTS.ON_STEP_STATUS_UPDATE]: onStepStatusUpdate_1.OnStepStatusUpdate,
|
|
15
17
|
[events_1.ALL_BROADCAST_EVENTS.ON_PRICING_STATUS_UPDATE]: onPricingStatusUpdate_1.OnPricingStatusUpdate,
|
|
16
18
|
[events_1.ALL_BROADCAST_EVENTS.ON_INTERNAL_ERROR]: onErrorUpdate_1.OnErrorUpdate,
|
|
19
|
+
// EWL
|
|
17
20
|
[events_1.ALL_BROADCAST_EVENTS.ON_SHOPPING_CART_UPDATE]: onShoppingCartUpdate_1.OnShoppingCartUpdate,
|
|
21
|
+
[events_1.ALL_BROADCAST_EVENTS.ON_CONTENT_SIZE_CHANGE]: onContentSizeChange_1.OnContentSizeChange,
|
|
18
22
|
};
|
|
@@ -2,6 +2,7 @@ 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 EmbedStudioResultEvent } from '../../../modules/embed-studio/types/event/resultEvent.types';
|
|
5
6
|
import { ResultEvent as WhiteLabelResultPayload } from '../../../modules/white-label/types/event/resultEvent.types';
|
|
6
7
|
import { ResultEventPayload } from './resultEventPayload.types';
|
|
7
8
|
import { EVENT_TYPES } from '../../../modules/eventTypes';
|
|
@@ -9,4 +10,4 @@ import { Event } from '../../../types/event/event.types';
|
|
|
9
10
|
import { ALL_RESULT_EVENTS } from '../../../modules/events';
|
|
10
11
|
export type ResultEventName = (typeof ALL_RESULT_EVENTS)[keyof typeof ALL_RESULT_EVENTS];
|
|
11
12
|
export type BaseResultEvent<TName extends ResultEventName, TPayload extends ResultEventPayload> = Event<TName, typeof EVENT_TYPES.RESULT, TPayload>;
|
|
12
|
-
export type ResultEvent = MockupGenerationResultEvent | CatalogResultEvent | ProductPublishResultEvent | EdmResultPayload | WhiteLabelResultPayload;
|
|
13
|
+
export type ResultEvent = MockupGenerationResultEvent | CatalogResultEvent | ProductPublishResultEvent | EdmResultPayload | EmbedStudioResultEvent | WhiteLabelResultPayload;
|
|
@@ -2,8 +2,9 @@ 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
|
+
import type { EmbedStudioResultPayload } from '../../../modules/embed-studio/types/event/resultEventPayload.types';
|
|
5
6
|
import type { WhiteLabelResultPayload } from '../../../modules/white-label/types/event/resultEventPayload.types';
|
|
6
|
-
export type ResultEventPayload = MockupGenerationResultPayload | CatalogResultPayload | ProductPublishResultPayload | EdmResultPayload | WhiteLabelResultPayload;
|
|
7
|
+
export type ResultEventPayload = MockupGenerationResultPayload | CatalogResultPayload | ProductPublishResultPayload | EdmResultPayload | EmbedStudioResultPayload | WhiteLabelResultPayload;
|
|
7
8
|
export type HandledResponse<T, K extends Error> = {
|
|
8
9
|
data: T;
|
|
9
10
|
error: null;
|
|
@@ -5,9 +5,11 @@ import { GetCatalogCategoriesResultPayload, GetCatalogProductsByIdsPayload, GetC
|
|
|
5
5
|
import { NotificationEventPayload } from '../../types/event/notification/notificationEventPayload.types';
|
|
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
|
+
import { OnDesignStatusEventPayload as EmbedStudioOnDesignStatusEventPayload, OnErrorEventPayload as EmbedStudioOnErrorEventPayload } from '../../modules/embed-studio/types/event/broadcastEventPayload.types';
|
|
8
9
|
import { AddImagePayload, AddImageResultPayload, InitializeEdmPayload, NavigateStepPayload, NavigateStepResultPayload, SaveDesignResultPayload, SetStylePayload, SetStyleResultPayload } from '../../modules/edm/types';
|
|
10
|
+
import { InitializeEmbedStudioPayload, SaveDesignResultPayload as EmbedStudioSaveDesignResultPayload } from '../../modules/embed-studio/types';
|
|
9
11
|
import { InitializeWhiteLabelPayload, GoToViewResultPayload, GoToViewPayload } from '../../modules/white-label/types';
|
|
10
|
-
import { OnShoppingCartUpdateEventPayload } from '../../modules/white-label/types/event/broadcastEventPayload.types';
|
|
12
|
+
import { OnShoppingCartUpdateEventPayload, OnContentSizeChangeEventPayload } from '../../modules/white-label/types/event/broadcastEventPayload.types';
|
|
11
13
|
/** This file ensures that Iframe and SDK has the same source of truth for return values */
|
|
12
14
|
export type ModuleName = (typeof MODULE_NAMES)[keyof typeof MODULE_NAMES];
|
|
13
15
|
export interface ISdkModule {
|
|
@@ -35,6 +37,10 @@ export interface IEdmModule {
|
|
|
35
37
|
setStyle(payload: SetStylePayload): SetStyleResultPayload;
|
|
36
38
|
navigateStep(payload: NavigateStepPayload): NavigateStepResultPayload;
|
|
37
39
|
}
|
|
40
|
+
export interface IEmbedStudioModule {
|
|
41
|
+
setup(config?: InitializeEmbedStudioPayload): NotificationEventPayload | void;
|
|
42
|
+
saveDesign(): EmbedStudioSaveDesignResultPayload;
|
|
43
|
+
}
|
|
38
44
|
export interface IEdmBroadcastModule {
|
|
39
45
|
onDesignStatusUpdate(event: OnDesignStatusEventPayload): void;
|
|
40
46
|
onFilePickerRequested(event: OnFilePickerRequestedEventPayload): void;
|
|
@@ -42,10 +48,15 @@ export interface IEdmBroadcastModule {
|
|
|
42
48
|
onStepStatusUpdate(event: OnStepStatusUpdateEventPayload): void;
|
|
43
49
|
onErrorUpdate(event: OnErrorEventPayload): void;
|
|
44
50
|
}
|
|
51
|
+
export interface IEmbedStudioBroadcastModule {
|
|
52
|
+
onDesignStatusUpdate(event: EmbedStudioOnDesignStatusEventPayload): void;
|
|
53
|
+
onErrorUpdate(event: EmbedStudioOnErrorEventPayload): void;
|
|
54
|
+
}
|
|
45
55
|
export interface IWhiteLabelModule {
|
|
46
56
|
setup(config: InitializeWhiteLabelPayload): NotificationEventPayload | void;
|
|
47
57
|
goToView(event: GoToViewPayload): GoToViewResultPayload;
|
|
48
58
|
}
|
|
49
59
|
export interface IWhiteLabelBroadcastModule {
|
|
50
60
|
onShoppingCartUpdate(event: OnShoppingCartUpdateEventPayload): void;
|
|
61
|
+
onContentSizeChange(event: OnContentSizeChangeEventPayload): void;
|
|
51
62
|
}
|
package/dist/cjs/version.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const VERSION: "2.
|
|
1
|
+
export declare const VERSION: "2.7.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
|
+
EMBED_STUDIO: 'EmbedStudio',
|
|
11
12
|
WHITE_LABEL: 'WhiteLabel',
|
|
12
13
|
};
|
|
13
14
|
export const messageLoggerState = {
|
|
@@ -29,6 +30,7 @@ function getSourceStyle(source) {
|
|
|
29
30
|
font-weight: bold;
|
|
30
31
|
`;
|
|
31
32
|
case SOURCES.EDM:
|
|
33
|
+
case SOURCES.EMBED_STUDIO:
|
|
32
34
|
case SOURCES.SDK:
|
|
33
35
|
case SOURCES.WHITE_LABEL:
|
|
34
36
|
return `
|
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 { EmbedStudio } from './services/embedStudio';
|
|
3
4
|
export { WhiteLabel } from './services/whiteLabel';
|
|
4
5
|
export * from './types/event/event.types';
|
|
5
6
|
export * from './types/event/eventPayload.types';
|
|
@@ -16,6 +17,7 @@ export * as MockupGenerationModule from './modules/mockup-generation/types';
|
|
|
16
17
|
export * as ProductPublishModule from './modules/product-publish/types';
|
|
17
18
|
export * as SdkModule from './modules/sdk/types';
|
|
18
19
|
export * as EdmModule from './modules/edm/types';
|
|
20
|
+
export * as EmbedStudioModule from './modules/embed-studio/types';
|
|
19
21
|
export * as WhiteLabelModule from './modules/white-label/types';
|
|
20
22
|
export { ALL_EVENTS } from './modules/events';
|
|
21
23
|
export { MODULE_NAMES } from './modules/modules';
|
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 { EmbedStudio } from './services/embedStudio';
|
|
3
4
|
export { WhiteLabel } from './services/whiteLabel';
|
|
4
5
|
/* EXPORTS */
|
|
5
6
|
// TODO: properly foldered exports?
|
|
@@ -20,6 +21,7 @@ export * as MockupGenerationModule from './modules/mockup-generation/types';
|
|
|
20
21
|
export * as ProductPublishModule from './modules/product-publish/types';
|
|
21
22
|
export * as SdkModule from './modules/sdk/types';
|
|
22
23
|
export * as EdmModule from './modules/edm/types';
|
|
24
|
+
export * as EmbedStudioModule from './modules/embed-studio/types';
|
|
23
25
|
export * as WhiteLabelModule from './modules/white-label/types';
|
|
24
26
|
// Constants
|
|
25
27
|
export { ALL_EVENTS } from './modules/events';
|
|
@@ -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 | typeof MODULE_NAMES.WHITE_LABEL;
|
|
8
|
-
constructor(moduleType: typeof MODULE_NAMES.SDK | typeof MODULE_NAMES.EDM | typeof MODULE_NAMES.WHITE_LABEL);
|
|
7
|
+
protected moduleType: typeof MODULE_NAMES.SDK | typeof MODULE_NAMES.EDM | typeof MODULE_NAMES.EMBED_STUDIO | typeof MODULE_NAMES.WHITE_LABEL;
|
|
8
|
+
constructor(moduleType: typeof MODULE_NAMES.SDK | typeof MODULE_NAMES.EDM | typeof MODULE_NAMES.EMBED_STUDIO | typeof MODULE_NAMES.WHITE_LABEL);
|
|
9
9
|
protected sendRequest<T extends ResultEventPayload | NotificationEventPayload>(eventName: ActionEventName, eventPayload?: ActionEventPayload): Promise<T>;
|
|
10
10
|
}
|
|
@@ -43,7 +43,7 @@ export interface DetailsEditStepConfig {
|
|
|
43
43
|
/** Maximal length for description input */
|
|
44
44
|
descriptionMaxLength?: number;
|
|
45
45
|
/** Shows main selected mockup if mockup step was used */
|
|
46
|
-
showMainMockup?:
|
|
46
|
+
showMainMockup?: boolean;
|
|
47
47
|
};
|
|
48
48
|
}
|
|
49
49
|
export interface TosScreenConfig {
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { BroadcastEventPayload } from '../../../modules/embed-studio/types/event/broadcastEventPayload.types';
|
|
2
|
+
import { BaseBroadcastEventHandler } from '../../../types/event/broadcast/baseBroadcastEventHandler';
|
|
3
|
+
export declare abstract class BaseEmbedStudioBroadcastEvent implements BaseBroadcastEventHandler {
|
|
4
|
+
abstract handle(event: BroadcastEventPayload): void;
|
|
5
|
+
get broadcastHandler(): import("../embedStudioBroadcastModule").EmbedStudioBroadcastModule;
|
|
6
|
+
}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { OnDesignStatusEventPayload } from '../../../modules/embed-studio/types/event/broadcastEventPayload.types';
|
|
2
|
+
import { BaseEmbedStudioBroadcastEvent } from '../../../modules/embed-studio/broadcastEvents/baseEmbedStudioBroadcastEvent';
|
|
3
|
+
export declare class OnDesignStatusUpdate extends BaseEmbedStudioBroadcastEvent {
|
|
4
|
+
handle(event: OnDesignStatusEventPayload): void;
|
|
5
|
+
}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { BaseEmbedStudioBroadcastEvent } from '../../../modules/embed-studio/broadcastEvents/baseEmbedStudioBroadcastEvent';
|
|
2
|
+
export class OnDesignStatusUpdate extends BaseEmbedStudioBroadcastEvent {
|
|
3
|
+
handle(event) {
|
|
4
|
+
this.broadcastHandler.onDesignStatusUpdate(event);
|
|
5
|
+
}
|
|
6
|
+
}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { OnErrorEventPayload } from '../../../modules/embed-studio/types/event/broadcastEventPayload.types';
|
|
2
|
+
import { BaseEmbedStudioBroadcastEvent } from '../../../modules/embed-studio/broadcastEvents/baseEmbedStudioBroadcastEvent';
|
|
3
|
+
export declare class OnErrorUpdate extends BaseEmbedStudioBroadcastEvent {
|
|
4
|
+
handle(event: OnErrorEventPayload): void;
|
|
5
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { IEmbedStudioBroadcastModule } from '../../types/module/module.types';
|
|
2
|
+
import { EmbedStudioBroadcastListeners } from '../../modules/embed-studio/types/event/broadcastEvent.types';
|
|
3
|
+
import { OnDesignStatusEventPayload, OnErrorEventPayload } from '../../modules/embed-studio/types/event/broadcastEventPayload.types';
|
|
4
|
+
export declare class EmbedStudioBroadcastModule implements IEmbedStudioBroadcastModule {
|
|
5
|
+
protected listeners?: Partial<EmbedStudioBroadcastListeners>;
|
|
6
|
+
constructor(listeners?: Partial<EmbedStudioBroadcastListeners>);
|
|
7
|
+
onDesignStatusUpdate(event: OnDesignStatusEventPayload): void;
|
|
8
|
+
onErrorUpdate(event: OnErrorEventPayload): void;
|
|
9
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
export class EmbedStudioBroadcastModule {
|
|
2
|
+
listeners;
|
|
3
|
+
constructor(listeners) {
|
|
4
|
+
this.listeners = listeners;
|
|
5
|
+
}
|
|
6
|
+
onDesignStatusUpdate(event) {
|
|
7
|
+
if (this.listeners?.onDesignStatusUpdate) {
|
|
8
|
+
this.listeners.onDesignStatusUpdate(event);
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
onErrorUpdate(event) {
|
|
12
|
+
if (this.listeners?.onError) {
|
|
13
|
+
this.listeners.onError(event);
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { IEmbedStudioModule } from '../../types/module/module.types';
|
|
2
|
+
import { BaseModule } from '../../modules/baseModule';
|
|
3
|
+
import { InitializeEmbedStudioPayload, SaveDesignResultPayload } from './types';
|
|
4
|
+
import { NotificationEventPayload } from '../../types/event/notification/notificationEventPayload.types';
|
|
5
|
+
import { WithHandledResponses } from '../../helpers/typeHelper.types';
|
|
6
|
+
export declare class EmbedStudioModule extends BaseModule implements WithHandledResponses<IEmbedStudioModule> {
|
|
7
|
+
constructor();
|
|
8
|
+
setup(payload?: InitializeEmbedStudioPayload): Promise<NotificationEventPayload>;
|
|
9
|
+
saveDesign(): Promise<import("../..").HandledResponse<SaveDesignResultPayload, Error>>;
|
|
10
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { BaseModule } from '../../modules/baseModule';
|
|
2
|
+
import { EVENTS_ACTION } from './events';
|
|
3
|
+
import { handleResponse } from '../../helpers/responseHandler';
|
|
4
|
+
import { MODULE_NAMES } from '../../modules/modules';
|
|
5
|
+
export class EmbedStudioModule extends BaseModule {
|
|
6
|
+
constructor() {
|
|
7
|
+
super(MODULE_NAMES.EMBED_STUDIO);
|
|
8
|
+
}
|
|
9
|
+
// @ts-expect-error setup does not return data
|
|
10
|
+
async setup(payload) {
|
|
11
|
+
return await this.sendRequest(EVENTS_ACTION.INITIALIZE_EMBED_STUDIO, payload);
|
|
12
|
+
}
|
|
13
|
+
async saveDesign() {
|
|
14
|
+
const response = await this.sendRequest(EVENTS_ACTION.SAVE_DESIGN, {}).catch((e) => e);
|
|
15
|
+
return handleResponse(response, 'Failed to save design');
|
|
16
|
+
}
|
|
17
|
+
}
|