@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
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
export declare const EVENTS_ACTION: {
|
|
2
|
+
readonly INITIALIZE_EMBED_STUDIO: "actionInitializeEdm";
|
|
3
|
+
readonly SAVE_DESIGN: "actionSaveDesign";
|
|
4
|
+
readonly SET_STORE_CONTEXT: "actionSetStoreContext";
|
|
5
|
+
};
|
|
6
|
+
export declare const EVENTS_NOTIFICATION: {
|
|
7
|
+
readonly EMBED_STUDIO_INITIALIZATION_SUCCESS: "notificationEdmInitializationSuccess";
|
|
8
|
+
readonly SAVE_DESIGN_FAILURE: "actionSaveDesignFailure";
|
|
9
|
+
};
|
|
10
|
+
export declare const EVENTS_RESULT: {
|
|
11
|
+
readonly SAVE_DESIGN_RESULT: "resultSaveDesign";
|
|
12
|
+
};
|
|
13
|
+
export declare const EVENT_BROADCAST: {
|
|
14
|
+
readonly ON_DESIGN_STATUS_UPDATE: "onDesignStatusUpdate";
|
|
15
|
+
readonly ON_INTERNAL_ERROR: "onError";
|
|
16
|
+
};
|
|
17
|
+
export declare const EVENTS: {
|
|
18
|
+
readonly ON_DESIGN_STATUS_UPDATE: "onDesignStatusUpdate";
|
|
19
|
+
readonly ON_INTERNAL_ERROR: "onError";
|
|
20
|
+
readonly SAVE_DESIGN_RESULT: "resultSaveDesign";
|
|
21
|
+
readonly EMBED_STUDIO_INITIALIZATION_SUCCESS: "notificationEdmInitializationSuccess";
|
|
22
|
+
readonly SAVE_DESIGN_FAILURE: "actionSaveDesignFailure";
|
|
23
|
+
readonly INITIALIZE_EMBED_STUDIO: "actionInitializeEdm";
|
|
24
|
+
readonly SAVE_DESIGN: "actionSaveDesign";
|
|
25
|
+
readonly SET_STORE_CONTEXT: "actionSetStoreContext";
|
|
26
|
+
};
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
export const EVENTS_ACTION = {
|
|
2
|
+
INITIALIZE_EMBED_STUDIO: 'actionInitializeEdm',
|
|
3
|
+
SAVE_DESIGN: 'actionSaveDesign',
|
|
4
|
+
SET_STORE_CONTEXT: 'actionSetStoreContext',
|
|
5
|
+
};
|
|
6
|
+
export const EVENTS_NOTIFICATION = {
|
|
7
|
+
EMBED_STUDIO_INITIALIZATION_SUCCESS: 'notificationEdmInitializationSuccess',
|
|
8
|
+
SAVE_DESIGN_FAILURE: 'actionSaveDesignFailure',
|
|
9
|
+
};
|
|
10
|
+
export const EVENTS_RESULT = {
|
|
11
|
+
SAVE_DESIGN_RESULT: 'resultSaveDesign',
|
|
12
|
+
};
|
|
13
|
+
export const EVENT_BROADCAST = {
|
|
14
|
+
ON_DESIGN_STATUS_UPDATE: 'onDesignStatusUpdate',
|
|
15
|
+
ON_INTERNAL_ERROR: 'onError',
|
|
16
|
+
};
|
|
17
|
+
export const EVENTS = {
|
|
18
|
+
...EVENTS_ACTION,
|
|
19
|
+
...EVENTS_NOTIFICATION,
|
|
20
|
+
...EVENTS_RESULT,
|
|
21
|
+
...EVENT_BROADCAST,
|
|
22
|
+
};
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
export interface EmbedStudioConfig {
|
|
2
|
+
}
|
|
3
|
+
export type EmbedStudioParams = ({
|
|
4
|
+
element: HTMLElement;
|
|
5
|
+
elementId?: null;
|
|
6
|
+
} & EmbedStudioCommonParams) | ({
|
|
7
|
+
elementId: string;
|
|
8
|
+
element?: null;
|
|
9
|
+
} & EmbedStudioCommonParams);
|
|
10
|
+
export interface EmbedStudioCommonParams {
|
|
11
|
+
nonce: string;
|
|
12
|
+
externalProductId: string;
|
|
13
|
+
iframeClassName?: string;
|
|
14
|
+
origin?: string;
|
|
15
|
+
initProduct?: {
|
|
16
|
+
productId: number;
|
|
17
|
+
printProviderId?: number;
|
|
18
|
+
technique?: string;
|
|
19
|
+
forceOrientation?: 'horizontal' | 'vertical' | string;
|
|
20
|
+
};
|
|
21
|
+
debug?: boolean;
|
|
22
|
+
}
|
|
23
|
+
export interface Message {
|
|
24
|
+
type: string;
|
|
25
|
+
message: string;
|
|
26
|
+
messageCode: string;
|
|
27
|
+
}
|
|
28
|
+
export interface FyulTemplate {
|
|
29
|
+
id: string;
|
|
30
|
+
external_product_id: string;
|
|
31
|
+
colors: string[];
|
|
32
|
+
sizes: string[];
|
|
33
|
+
technique: string;
|
|
34
|
+
}
|
|
35
|
+
export interface OnDesignStatusEvent {
|
|
36
|
+
designChanged: boolean;
|
|
37
|
+
designValid: boolean;
|
|
38
|
+
usedPlacements: string[];
|
|
39
|
+
selectedVariantIds: number[];
|
|
40
|
+
subTechnique: string;
|
|
41
|
+
errors: string[];
|
|
42
|
+
fatalErrors: Message[];
|
|
43
|
+
}
|
|
44
|
+
export interface OnErrorEvent {
|
|
45
|
+
error: string | Error;
|
|
46
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { EVENTS_ACTION } from '../../../../modules/embed-studio/events';
|
|
2
|
+
import { InitializeEmbedStudioPayload, SetStoreContextPayload } from '../../../../modules/embed-studio/types';
|
|
3
|
+
import { BaseActionEvent } from '../../../../types/event/action/actionEvent.types';
|
|
4
|
+
export type InitializeEmbedStudioAction = BaseActionEvent<typeof EVENTS_ACTION.INITIALIZE_EMBED_STUDIO, InitializeEmbedStudioPayload>;
|
|
5
|
+
export type SaveDesignAction = BaseActionEvent<typeof EVENTS_ACTION.SAVE_DESIGN, undefined>;
|
|
6
|
+
export type SetStoreContextAction = BaseActionEvent<typeof EVENTS_ACTION.SET_STORE_CONTEXT, SetStoreContextPayload>;
|
|
7
|
+
export type ActionEvent = InitializeEmbedStudioAction | SaveDesignAction | SetStoreContextAction;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { EmbedStudioConfig, EmbedStudioParams } from '../../../../modules/embed-studio/types/data.types';
|
|
2
|
+
export type InitializeEmbedStudioPayload = EmbedStudioConfig & EmbedStudioParams & InitializeEmbedStudioPayloadWithVersion;
|
|
3
|
+
export interface InitializeEmbedStudioPayloadWithVersion {
|
|
4
|
+
clientVersion: string;
|
|
5
|
+
}
|
|
6
|
+
export interface SetStoreContextPayload {
|
|
7
|
+
storeId: string;
|
|
8
|
+
}
|
|
9
|
+
export type ActionEventPayload = InitializeEmbedStudioPayloadWithVersion | SetStoreContextPayload;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { EVENT_BROADCAST } from '../../../../modules/embed-studio/events';
|
|
2
|
+
import { BaseBroadcastEvent } from '../../../../types/event/broadcast/broadcastEvent.types';
|
|
3
|
+
import { OnDesignStatusEventPayload, OnErrorEventPayload } from '../../../../modules/embed-studio/types/event/broadcastEventPayload.types';
|
|
4
|
+
export type OnDesignStatusUpdateBroadcast = BaseBroadcastEvent<typeof EVENT_BROADCAST.ON_DESIGN_STATUS_UPDATE, OnDesignStatusEventPayload>;
|
|
5
|
+
export type OnErrorUpdateBroadcast = BaseBroadcastEvent<typeof EVENT_BROADCAST.ON_INTERNAL_ERROR, OnErrorEventPayload>;
|
|
6
|
+
export type EmbedStudioBroadcastEvent = OnDesignStatusUpdateBroadcast | OnErrorUpdateBroadcast;
|
|
7
|
+
export type EmbedStudioBroadcastListeners = {
|
|
8
|
+
[K in EmbedStudioBroadcastEvent as K['name']]: (event: Exclude<K['payload'], undefined>) => void;
|
|
9
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { OnDesignStatusEvent, OnErrorEvent } from '../../../../modules/embed-studio/types/data.types';
|
|
2
|
+
export type OnDesignStatusEventPayload = OnDesignStatusEvent;
|
|
3
|
+
export type OnErrorEventPayload = OnErrorEvent;
|
|
4
|
+
export type BroadcastEventPayload = OnDesignStatusEventPayload | OnErrorEventPayload;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { BaseResultEvent } from '../../../../types/event/result/resultEvent.types';
|
|
2
|
+
import type { EVENTS_RESULT } from '../../../../modules/embed-studio/events';
|
|
3
|
+
import { SaveDesignResultPayload } from '../../../../modules/embed-studio/types/event/resultEventPayload.types';
|
|
4
|
+
export type SaveDesignResultEvent = BaseResultEvent<typeof EVENTS_RESULT.SAVE_DESIGN_RESULT, SaveDesignResultPayload>;
|
|
5
|
+
export type ResultEvent = SaveDesignResultEvent;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export * from '../../../modules/embed-studio/types/data.types';
|
|
2
|
+
export * from '../../../modules/embed-studio/types/event/actionEvent.types';
|
|
3
|
+
export * from '../../../modules/embed-studio/types/event/actionEventPayload.types';
|
|
4
|
+
export * from '../../../modules/embed-studio/types/event/resultEvent.types';
|
|
5
|
+
export * from '../../../modules/embed-studio/types/event/resultEventPayload.types';
|
|
6
|
+
export * from '../../../modules/embed-studio/types/event/broadcastEventPayload.types';
|
|
7
|
+
export * from '../../../modules/embed-studio/types/event/broadcastEvent.types';
|
|
8
|
+
export * from '../../../modules/embed-studio/events';
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
// Data types
|
|
2
|
+
export * from '../../../modules/embed-studio/types/data.types';
|
|
3
|
+
// Event types
|
|
4
|
+
export * from '../../../modules/embed-studio/types/event/actionEvent.types';
|
|
5
|
+
export * from '../../../modules/embed-studio/types/event/actionEventPayload.types';
|
|
6
|
+
export * from '../../../modules/embed-studio/types/event/resultEvent.types';
|
|
7
|
+
export * from '../../../modules/embed-studio/types/event/resultEventPayload.types';
|
|
8
|
+
export * from '../../../modules/embed-studio/types/event/broadcastEventPayload.types';
|
|
9
|
+
export * from '../../../modules/embed-studio/types/event/broadcastEvent.types';
|
|
10
|
+
// Event names
|
|
11
|
+
export * from '../../../modules/embed-studio/events';
|
|
@@ -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("./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;
|
|
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 | import("./embed-studio/types").InitializeEmbedStudioAction | import("./embed-studio/types").SaveDesignAction | import("./embed-studio/types").SetStoreContextAction;
|
|
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").GetSavedProductMockupsResult | 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;
|
|
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").GetSavedProductMockupsResult | import("./product-publish/types").DeleteProductsResult | import("./edm/types").SaveDesignResultEvent | import("./edm/types").AddImageResultEvent | import("./edm/types").SetStyleResultEvent | import("./edm/types").NavigateStepResultEvent | import("./embed-studio/types").SaveDesignResultEvent | 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 | import("./white-label/types").OnContentSizeChangeBroadcast;
|
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
export declare const ALL_ACTION_EVENTS: {
|
|
2
2
|
readonly INITIALIZE_WHITE_LABEL: "actionInitializeWhiteLabel";
|
|
3
3
|
readonly GO_TO_VIEW: "actionGoToView";
|
|
4
|
-
readonly
|
|
4
|
+
readonly INITIALIZE_EMBED_STUDIO: "actionInitializeEdm";
|
|
5
5
|
readonly SAVE_DESIGN: "actionSaveDesign";
|
|
6
|
+
readonly SET_STORE_CONTEXT: "actionSetStoreContext";
|
|
7
|
+
readonly INITIALIZE_EDM: "actionInitializeEdm";
|
|
6
8
|
readonly ADD_IMAGE: "actionAddImage";
|
|
7
9
|
readonly SET_STYLE: "actionSetStyle";
|
|
8
10
|
readonly NAVIGATE_STEP: "actionNavigateStep";
|
|
@@ -23,8 +25,9 @@ export declare const ALL_ACTION_EVENTS: {
|
|
|
23
25
|
export declare const ALL_NOTIFICATION_EVENTS: {
|
|
24
26
|
readonly WHITE_LABEL_INITIALIZATION_SUCCESS: "notificationWhiteLabelInitializationSuccess";
|
|
25
27
|
readonly GO_TO_VIEW_FAILURE: "actionGoToViewFailure";
|
|
26
|
-
readonly
|
|
28
|
+
readonly EMBED_STUDIO_INITIALIZATION_SUCCESS: "notificationEdmInitializationSuccess";
|
|
27
29
|
readonly SAVE_DESIGN_FAILURE: "actionSaveDesignFailure";
|
|
30
|
+
readonly EDM_INITIALIZATION_SUCCESS: "notificationEdmInitializationSuccess";
|
|
28
31
|
readonly ADD_IMAGE_FAILURE: "actionAddImageFailure";
|
|
29
32
|
readonly SET_STYLE_FAILURE: "actionSetStyleFailure";
|
|
30
33
|
readonly NAVIGATE_STEP_FAILURE: "actionNavigateStepFailure";
|
|
@@ -59,19 +62,21 @@ export declare const ALL_RESULT_EVENTS: {
|
|
|
59
62
|
};
|
|
60
63
|
export declare const ALL_BROADCAST_EVENTS: {
|
|
61
64
|
ON_SHOPPING_CART_UPDATE: "onShoppingCartUpdate";
|
|
65
|
+
ON_CONTENT_SIZE_CHANGE: "onContentSizeChange";
|
|
62
66
|
ON_DESIGN_STATUS_UPDATE: "onDesignStatusUpdate";
|
|
67
|
+
ON_INTERNAL_ERROR: "onError";
|
|
63
68
|
ON_PRICING_STATUS_UPDATE: "onPricingStatusUpdate";
|
|
64
69
|
ON_FILE_PICKER_REQUESTED: "onFilePickerRequested";
|
|
65
70
|
ON_STEP_STATUS_UPDATE: "onStepStatusUpdate";
|
|
66
|
-
ON_INTERNAL_ERROR: "onError";
|
|
67
71
|
};
|
|
68
72
|
export declare const ALL_EVENTS: {
|
|
69
73
|
readonly ON_SHOPPING_CART_UPDATE: "onShoppingCartUpdate";
|
|
74
|
+
readonly ON_CONTENT_SIZE_CHANGE: "onContentSizeChange";
|
|
70
75
|
readonly ON_DESIGN_STATUS_UPDATE: "onDesignStatusUpdate";
|
|
76
|
+
readonly ON_INTERNAL_ERROR: "onError";
|
|
71
77
|
readonly ON_PRICING_STATUS_UPDATE: "onPricingStatusUpdate";
|
|
72
78
|
readonly ON_FILE_PICKER_REQUESTED: "onFilePickerRequested";
|
|
73
79
|
readonly ON_STEP_STATUS_UPDATE: "onStepStatusUpdate";
|
|
74
|
-
readonly ON_INTERNAL_ERROR: "onError";
|
|
75
80
|
readonly GO_TO_VIEW_RESULT: "resultGoToView";
|
|
76
81
|
readonly SAVE_DESIGN_RESULT: "resultSaveDesign";
|
|
77
82
|
readonly ADD_IMAGE_RESULT: "resultAddImage";
|
|
@@ -89,8 +94,9 @@ export declare const ALL_EVENTS: {
|
|
|
89
94
|
readonly GET_CATALOG_CATEGORIES_RESULT: "resultGetCatalogCategories";
|
|
90
95
|
readonly WHITE_LABEL_INITIALIZATION_SUCCESS: "notificationWhiteLabelInitializationSuccess";
|
|
91
96
|
readonly GO_TO_VIEW_FAILURE: "actionGoToViewFailure";
|
|
92
|
-
readonly
|
|
97
|
+
readonly EMBED_STUDIO_INITIALIZATION_SUCCESS: "notificationEdmInitializationSuccess";
|
|
93
98
|
readonly SAVE_DESIGN_FAILURE: "actionSaveDesignFailure";
|
|
99
|
+
readonly EDM_INITIALIZATION_SUCCESS: "notificationEdmInitializationSuccess";
|
|
94
100
|
readonly ADD_IMAGE_FAILURE: "actionAddImageFailure";
|
|
95
101
|
readonly SET_STYLE_FAILURE: "actionSetStyleFailure";
|
|
96
102
|
readonly NAVIGATE_STEP_FAILURE: "actionNavigateStepFailure";
|
|
@@ -107,8 +113,10 @@ export declare const ALL_EVENTS: {
|
|
|
107
113
|
readonly SDK_INITIALIZATION_SUCCESS: "notificationSdkInitializationSuccess";
|
|
108
114
|
readonly INITIALIZE_WHITE_LABEL: "actionInitializeWhiteLabel";
|
|
109
115
|
readonly GO_TO_VIEW: "actionGoToView";
|
|
110
|
-
readonly
|
|
116
|
+
readonly INITIALIZE_EMBED_STUDIO: "actionInitializeEdm";
|
|
111
117
|
readonly SAVE_DESIGN: "actionSaveDesign";
|
|
118
|
+
readonly SET_STORE_CONTEXT: "actionSetStoreContext";
|
|
119
|
+
readonly INITIALIZE_EDM: "actionInitializeEdm";
|
|
112
120
|
readonly ADD_IMAGE: "actionAddImage";
|
|
113
121
|
readonly SET_STYLE: "actionSetStyle";
|
|
114
122
|
readonly NAVIGATE_STEP: "actionNavigateStep";
|
|
@@ -3,6 +3,7 @@ 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_EMBED_STUDIO from './embed-studio/events';
|
|
6
7
|
import * as EVENTS_WHITE_LABEL from './white-label/events';
|
|
7
8
|
export const ALL_ACTION_EVENTS = {
|
|
8
9
|
...EVENTS_SDK.EVENTS_ACTION,
|
|
@@ -10,6 +11,7 @@ export const ALL_ACTION_EVENTS = {
|
|
|
10
11
|
...EVENTS_MOCKUP_GENERATION.EVENTS_ACTION,
|
|
11
12
|
...EVENTS_PRODUCT_PUBLISH.EVENTS_ACTION,
|
|
12
13
|
...EVENTS_EDM.EVENTS_ACTION,
|
|
14
|
+
...EVENTS_EMBED_STUDIO.EVENTS_ACTION,
|
|
13
15
|
...EVENTS_WHITE_LABEL.EVENTS_ACTION,
|
|
14
16
|
};
|
|
15
17
|
export const ALL_NOTIFICATION_EVENTS = {
|
|
@@ -18,6 +20,7 @@ export const ALL_NOTIFICATION_EVENTS = {
|
|
|
18
20
|
...EVENTS_MOCKUP_GENERATION.EVENTS_NOTIFICATION,
|
|
19
21
|
...EVENTS_PRODUCT_PUBLISH.EVENTS_NOTIFICATION,
|
|
20
22
|
...EVENTS_EDM.EVENTS_NOTIFICATION,
|
|
23
|
+
...EVENTS_EMBED_STUDIO.EVENTS_NOTIFICATION,
|
|
21
24
|
...EVENTS_WHITE_LABEL.EVENTS_NOTIFICATION,
|
|
22
25
|
};
|
|
23
26
|
export const ALL_RESULT_EVENTS = {
|
|
@@ -26,10 +29,12 @@ export const ALL_RESULT_EVENTS = {
|
|
|
26
29
|
...EVENTS_MOCKUP_GENERATION.EVENTS_RESULT,
|
|
27
30
|
...EVENTS_PRODUCT_PUBLISH.EVENTS_RESULT,
|
|
28
31
|
...EVENTS_EDM.EVENTS_RESULT,
|
|
32
|
+
...EVENTS_EMBED_STUDIO.EVENTS_RESULT,
|
|
29
33
|
...EVENTS_WHITE_LABEL.EVENTS_RESULT,
|
|
30
34
|
};
|
|
31
35
|
export const ALL_BROADCAST_EVENTS = {
|
|
32
36
|
...EVENTS_EDM.EVENT_BROADCAST,
|
|
37
|
+
...EVENTS_EMBED_STUDIO.EVENT_BROADCAST,
|
|
33
38
|
...EVENTS_WHITE_LABEL.EVENT_BROADCAST,
|
|
34
39
|
};
|
|
35
40
|
export const ALL_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 { EmbedStudioModule } from '../modules/embed-studio/embedStudioModule';
|
|
6
7
|
import { WhiteLabelModule } from '../modules/white-label/whiteLabelModule';
|
|
7
8
|
import { MODULE_NAMES } from './moduleNames';
|
|
8
9
|
export { MODULE_NAMES };
|
|
@@ -12,6 +13,7 @@ export declare const MODULES: {
|
|
|
12
13
|
mockupGeneration: typeof MockupGenerationModule;
|
|
13
14
|
productPublish: typeof ProductPublishModule;
|
|
14
15
|
edm: typeof EdmModule;
|
|
16
|
+
embedStudio: typeof EmbedStudioModule;
|
|
15
17
|
whiteLabel: typeof WhiteLabelModule;
|
|
16
18
|
};
|
|
17
19
|
export declare const MODULE_DEPENDENCY_MAP: {
|
|
@@ -20,5 +22,6 @@ export declare const MODULE_DEPENDENCY_MAP: {
|
|
|
20
22
|
mockupGeneration: "sdk";
|
|
21
23
|
productPublish: "sdk";
|
|
22
24
|
edm: "edm";
|
|
25
|
+
embedStudio: "embedStudio";
|
|
23
26
|
whiteLabel: "whiteLabel";
|
|
24
27
|
};
|
|
@@ -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 { EmbedStudioModule } from '../modules/embed-studio/embedStudioModule';
|
|
6
7
|
import { WhiteLabelModule } from '../modules/white-label/whiteLabelModule';
|
|
7
8
|
import { MODULE_NAMES } from './moduleNames';
|
|
8
9
|
export { MODULE_NAMES };
|
|
@@ -12,6 +13,7 @@ export const MODULES = {
|
|
|
12
13
|
[MODULE_NAMES.MOCKUP_GENERATION]: MockupGenerationModule,
|
|
13
14
|
[MODULE_NAMES.PRODUCT_PUBLISH]: ProductPublishModule,
|
|
14
15
|
[MODULE_NAMES.EDM]: EdmModule,
|
|
16
|
+
[MODULE_NAMES.EMBED_STUDIO]: EmbedStudioModule,
|
|
15
17
|
[MODULE_NAMES.WHITE_LABEL]: WhiteLabelModule,
|
|
16
18
|
};
|
|
17
19
|
export const MODULE_DEPENDENCY_MAP = {
|
|
@@ -20,5 +22,6 @@ export const MODULE_DEPENDENCY_MAP = {
|
|
|
20
22
|
[MODULE_NAMES.MOCKUP_GENERATION]: MODULE_NAMES.SDK,
|
|
21
23
|
[MODULE_NAMES.PRODUCT_PUBLISH]: MODULE_NAMES.SDK,
|
|
22
24
|
[MODULE_NAMES.EDM]: MODULE_NAMES.EDM,
|
|
25
|
+
[MODULE_NAMES.EMBED_STUDIO]: MODULE_NAMES.EMBED_STUDIO,
|
|
23
26
|
[MODULE_NAMES.WHITE_LABEL]: MODULE_NAMES.WHITE_LABEL,
|
|
24
27
|
};
|
|
@@ -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,6 @@
|
|
|
1
|
+
import { BaseWhiteLabelBroadcastEvent } from '../../../modules/white-label/broadcastEvents/baseWhiteLabelBroadcastEvent';
|
|
2
|
+
export class OnContentSizeChange extends BaseWhiteLabelBroadcastEvent {
|
|
3
|
+
handle(event) {
|
|
4
|
+
this.broadcastHandler.onContentSizeChange(event);
|
|
5
|
+
}
|
|
6
|
+
}
|
|
@@ -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,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
|
}
|
|
@@ -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,84 @@
|
|
|
1
|
+
import { iFrameManager } from '../services/iFrameManager';
|
|
2
|
+
import { EmbedCommunicator } from '../services/embedCommunicator';
|
|
3
|
+
import { ModuleLoaderService } from '../services/moduleLoaderService';
|
|
4
|
+
import { EmbedStudioBroadcastModule } from '../modules/embed-studio/embedStudioBroadcastModule';
|
|
5
|
+
import { MODULE_NAMES } from '../modules/moduleNames';
|
|
6
|
+
import { VERSION } from '../version';
|
|
7
|
+
import { LOG_TYPES, logEmbedMessage, setLoggerState, SOURCES, } from '../helpers/messageLogger';
|
|
8
|
+
export class EmbedStudio {
|
|
9
|
+
params;
|
|
10
|
+
config;
|
|
11
|
+
static BASE_URL = globalThis.__FYUL_TESTING_VARS__?.iframeUrl ??
|
|
12
|
+
'https://embed-studio.fyul.com';
|
|
13
|
+
static broadCastEventHandler = null;
|
|
14
|
+
iFrameManager = null;
|
|
15
|
+
communicator = EmbedCommunicator.getInstance();
|
|
16
|
+
moduleLoader = ModuleLoaderService.getInstance();
|
|
17
|
+
initialized = false;
|
|
18
|
+
constructor(params, config, callbacks) {
|
|
19
|
+
this.params = params;
|
|
20
|
+
this.config = config;
|
|
21
|
+
EmbedStudio.broadCastEventHandler = new EmbedStudioBroadcastModule(callbacks);
|
|
22
|
+
setLoggerState(params?.debug ?? false, SOURCES.EMBED_STUDIO);
|
|
23
|
+
}
|
|
24
|
+
async init() {
|
|
25
|
+
if (this.initialized) {
|
|
26
|
+
logEmbedMessage({
|
|
27
|
+
message: 'EmbedStudio already initialized',
|
|
28
|
+
logType: LOG_TYPES.WARN,
|
|
29
|
+
});
|
|
30
|
+
return;
|
|
31
|
+
}
|
|
32
|
+
const elementToBindTo = this.params.element ?? document.getElementById(this.params.elementId);
|
|
33
|
+
if (!elementToBindTo) {
|
|
34
|
+
logEmbedMessage({
|
|
35
|
+
message: 'Cant find element for EmbedStudio',
|
|
36
|
+
logType: LOG_TYPES.ERROR,
|
|
37
|
+
});
|
|
38
|
+
return;
|
|
39
|
+
}
|
|
40
|
+
this.iFrameManager = new iFrameManager({
|
|
41
|
+
baseUrl: EmbedStudio.BASE_URL,
|
|
42
|
+
urlParams: {
|
|
43
|
+
nonce: this.params.nonce,
|
|
44
|
+
sdkMode: true,
|
|
45
|
+
},
|
|
46
|
+
class: this.params.iframeClassName,
|
|
47
|
+
elementToAppendTo: elementToBindTo,
|
|
48
|
+
});
|
|
49
|
+
await this.iFrameManager.create();
|
|
50
|
+
this.communicator.setIFrameManager(MODULE_NAMES.EMBED_STUDIO, this.iFrameManager);
|
|
51
|
+
this.communicator.setupListener();
|
|
52
|
+
const embedStudioModule = this.moduleLoader.getModule(MODULE_NAMES.EMBED_STUDIO);
|
|
53
|
+
const notification = await embedStudioModule.setup({
|
|
54
|
+
...this.config,
|
|
55
|
+
...this.params,
|
|
56
|
+
clientVersion: VERSION,
|
|
57
|
+
});
|
|
58
|
+
logEmbedMessage({
|
|
59
|
+
message: ['EmbedStudio setup notification', notification],
|
|
60
|
+
logType: LOG_TYPES.LOG,
|
|
61
|
+
});
|
|
62
|
+
this.initialized = true;
|
|
63
|
+
}
|
|
64
|
+
saveDesign() {
|
|
65
|
+
const module = this.moduleLoader.getModule(MODULE_NAMES.EMBED_STUDIO);
|
|
66
|
+
return module.saveDesign();
|
|
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
|
+
EmbedStudio.broadCastEventHandler = null;
|
|
77
|
+
}
|
|
78
|
+
static getBroadCastEventHandler() {
|
|
79
|
+
if (!EmbedStudio.broadCastEventHandler) {
|
|
80
|
+
throw new Error('No active EmbedStudioBroadcastModule instance');
|
|
81
|
+
}
|
|
82
|
+
return EmbedStudio.broadCastEventHandler;
|
|
83
|
+
}
|
|
84
|
+
}
|