@roomle/embedding-lib 5.6.0 → 5.7.0-debug.1

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/index.d.ts CHANGED
@@ -1,54 +1,131 @@
1
- import { default as default_2 } from '@roomle/web-sdk/lib/definitions/planner-core/src/roomle-planner';
2
- import { default as default_3 } from '@roomle/web-sdk/lib/definitions/configurator-core/src/services/configurator-ui-callback';
3
- import { default as default_4 } from '@roomle/web-sdk/lib/definitions/configurator-core/src/roomle-configurator';
1
+ import { default as default_2 } from '@roomle/web-sdk/lib/definitions/configurator-core/src/roomle-configurator';
2
+ import { default as default_3 } from '@roomle/web-sdk/lib/definitions/planner-core/src/roomle-planner';
3
+ import { default as default_4 } from '@roomle/web-sdk/lib/definitions/configurator-core/src/services/configurator-ui-callback';
4
4
  import { default as default_5 } from '@roomle/web-sdk/lib/definitions/glb-viewer-core/src/roomle-glb-viewer';
5
+ import { EmbeddingCommand } from '../../common/src/utils/message-handler';
5
6
  import { ExposedAnalyticsCallbacks } from '../../../src/configurator/embedding/exposed-analytics-callbacks';
6
7
  import { ExposedApi } from '../../../../src/configurator/embedding/exposed-api';
7
8
  import { ExposedApi as ExposedApi_2 } from '../../../src/configurator/embedding/exposed-api';
8
9
  import { GlobalCallback } from '@roomle/web-sdk/lib/definitions/common-core/src/services/global-callback';
10
+ import { MessageHandler } from '../../common/src/utils/message-handler';
11
+ import { Nullable } from '../../../src/common/utils/types';
12
+ import { OnBeforeUpdateDragGhost } from '../../../../common/src/utils/drag';
13
+ import { OnBeforeUpdateDragGhost as OnBeforeUpdateDragGhost_2 } from '../../../common/src/utils/drag';
14
+ import { PossibleCustomViews } from '../../../src/configurator/embedding/types';
15
+ import { PossibleCustomViewsAndMain } from '../../../src/configurator/embedding/types';
16
+ import { PossibleCustomViewsAndMain as PossibleCustomViewsAndMain_2 } from '../../../../src/configurator/embedding/types';
9
17
  import { RapiId } from '@roomle/web-sdk/lib/definitions/typings/rapi-types';
10
18
  import { UiInitData } from '../../../src/configurator/embedding/types';
11
19
 
12
- declare interface AvailablePlugins {
13
- dragIn?: DragIn;
14
- }
20
+ declare type AvailablePlugins = {
21
+ [K in keyof PluginMap]?: InstanceType<PluginMap[K]>;
22
+ };
15
23
 
16
- declare class DragIn {
17
- private _iframe;
18
- private _currentDrag;
19
- private _currentTouch;
20
- private _firefoxDragPosition;
21
- private _instance;
22
- options: {
23
- dragInOverlapX?: number;
24
- dragInOverlapY?: number;
25
- fingerSize?: number;
26
- touchDragDelay?: number;
27
- touchDragEpsilon?: number;
24
+ declare class Connector<SdkType, SdkCallbacks> implements RoomleEmbeddingApiKeys {
25
+ protected _messageHandler: Nullable<MessageHandler>;
26
+ isSetupDone: boolean;
27
+ viewName: PossibleCustomViewsAndMain;
28
+ plugins: AvailablePlugins;
29
+ pluginsLoaded: Array<Promise<void>>;
30
+ ui: ExposedApi_2;
31
+ extended: SdkType;
32
+ configurator: default_2;
33
+ analytics: {
34
+ callbacks: ExposedAnalyticsCallbacks;
28
35
  };
36
+ global: {
37
+ callbacks: GlobalCallback;
38
+ };
39
+ setMessageHandler(messageHandler: MessageHandler): void;
40
+ handleSetup(methodsAndCallbacks: {
41
+ methods: string[];
42
+ callbacks: string[];
43
+ }): void;
44
+ executeMessage({ message, args }: EmbeddingCommand): Promise<{
45
+ result: any;
46
+ }>;
47
+ setupPlugins(plugins: PluginDefinitions, iframe: HTMLIFrameElement | HTMLBodyElement, mode?: EmbeddingPluginMode): void;
48
+ }
49
+
50
+ declare class DragIn extends EmbeddingPlugin implements DragInStrategy {
51
+ options: DragInOptions;
52
+ private _strategy;
53
+ private _customDragSignal;
29
54
  private _injectStyles;
30
55
  private _initializeDragGhost;
31
- constructor(iframe: HTMLIFrameElement);
32
- setInstance(instance: ExposedApi): void;
33
- private _firefoxFallback;
34
- dragStart(id: RapiId, event: DragEvent | TouchEvent, type?: string): void;
35
- dragUpdate(event: DragEvent | TouchEvent): void;
56
+ constructor(instance: ExposedApi, mainDomElement: HTMLIFrameElement | HTMLBodyElement, mode: EmbeddingPluginMode, viewName: PossibleCustomViewsAndMain_2);
57
+ init(): Promise<void>;
58
+ get isDragging(): boolean;
59
+ dragStart(id: RapiId, event: DragEvent | TouchEvent | MouseEvent, type?: string): void;
60
+ dragUpdate(event: DragEvent | TouchEvent | MouseEvent): void;
36
61
  dragEnd(): void;
37
62
  touchStart(id: RapiId, event: TouchEvent, type?: string): void;
38
63
  touchMove(event: TouchEvent): void;
39
64
  touchEnd(): void;
40
65
  dispose(): void;
66
+ beforeUpdateGhost(handler: OnBeforeUpdateDragGhost_2): void;
67
+ registerCustomDrag({ customDragStart, customDragEnd, customDragUpdate, beforeUpdateGhost, }: {
68
+ customDragStart: (event: MouseEvent | TouchEvent) => void;
69
+ customDragEnd: (event: MouseEvent | TouchEvent) => void;
70
+ customDragUpdate: (event: MouseEvent | TouchEvent) => void;
71
+ beforeUpdateGhost?: OnBeforeUpdateDragGhost_2;
72
+ }): void;
73
+ unregisterCustomDrag(): void;
74
+ releaseInput(event: DragEvent | TouchEvent | MouseEvent): void;
75
+ }
76
+
77
+ declare interface DragInOptions {
78
+ dragInOverlapX?: number;
79
+ dragInOverlapY?: number;
80
+ fingerSize?: number;
81
+ touchDragDelay?: number;
82
+ touchDragEpsilon?: number;
83
+ customDragDelay?: number;
84
+ customDragEpsilon?: number;
41
85
  }
42
86
 
87
+ declare interface DragInStrategy {
88
+ isDragging: boolean;
89
+ dragStart(id: RapiId, event: DragEvent | TouchEvent | MouseEvent, type: string): void;
90
+ dragUpdate(event: DragEvent | TouchEvent | MouseEvent): void;
91
+ dragEnd(): void;
92
+ touchStart(id: RapiId, event: TouchEvent, type: string): void;
93
+ touchMove(event: TouchEvent): void;
94
+ touchEnd(): void;
95
+ beforeUpdateGhost(handler: OnBeforeUpdateDragGhost): void;
96
+ releaseInput(event: DragEvent | TouchEvent | MouseEvent): void;
97
+ dispose(): void;
98
+ }
99
+
100
+ declare class EmbeddingPlugin {
101
+ protected _mainDomElement: HTMLIFrameElement | HTMLBodyElement;
102
+ protected _instance: ExposedApi;
103
+ protected _mode: EmbeddingPluginMode;
104
+ protected _viewName: PossibleCustomViewsAndMain_2;
105
+ constructor(instance: ExposedApi, iframe: HTMLIFrameElement | HTMLBodyElement, mode: EmbeddingPluginMode, viewName: PossibleCustomViewsAndMain_2);
106
+ init(): Promise<void>;
107
+ }
108
+
109
+ declare type EmbeddingPluginMode = 'website' | 'custom-view';
110
+
111
+ declare type PluginConstructors = {
112
+ [K in keyof PluginMap]: PluginMap[K];
113
+ };
114
+
43
115
  declare type PluginDefinitions = Array<keyof AvailablePlugins | {
44
116
  name: keyof AvailablePlugins;
45
- loader: () => Promise<any>;
117
+ loader: () => Promise<PluginConstructors[keyof PluginConstructors]>;
46
118
  }>;
47
119
 
48
- declare type RoomleConfiguratorApi = RoomleEmbeddingApi<default_4, default_3>;
120
+ declare interface PluginMap {
121
+ dragIn: typeof DragIn;
122
+ }
123
+
124
+ declare type RoomleConfiguratorApi = RoomleEmbeddingApi<default_2, default_4>;
49
125
 
50
- declare class RoomleEmbeddingApi<SdkType, SdkCallbacks> implements RoomleEmbeddingApiKeys {
126
+ declare class RoomleEmbeddingApi<SdkType, SdkCallbacks> extends Connector<SdkType, SdkCallbacks> {
51
127
  static createPlanner(configuratorId: string, container: HTMLElement, initData: UiInitData, plugins?: PluginDefinitions): Promise<RoomlePlannerApi>;
128
+ static connect(customView: PossibleCustomViews, plugins?: PluginDefinitions): Promise<Connector<default_2, default_4>>;
52
129
  /**
53
130
  * Method to create a new instance of a Roomle Configurator
54
131
  * @param configuratorId the id which identifies your configurator, you will get this ID from your Roomle Contact Person
@@ -72,23 +149,11 @@ declare class RoomleEmbeddingApi<SdkType, SdkCallbacks> implements RoomleEmbeddi
72
149
  */
73
150
  static createViewer(configuratorId: string, container: HTMLElement, initData: UiInitData, plugins?: PluginDefinitions): Promise<RoomleViewerApi>;
74
151
  private static _create;
75
- ui: ExposedApi_2;
76
- extended: SdkType;
77
- configurator: default_4;
78
- analytics: {
79
- callbacks: ExposedAnalyticsCallbacks;
80
- };
81
- global: {
82
- callbacks: GlobalCallback;
83
- };
84
- plugins: AvailablePlugins;
85
152
  private _waitForIframe;
86
153
  private _container;
87
- private _messageHandler;
88
154
  private _configuratorSettings;
89
155
  private _initData;
90
156
  private _iframe;
91
- pluginsLoaded: Array<Promise<void>>;
92
157
  private constructor();
93
158
  teardown(): void;
94
159
  private _createIframe;
@@ -107,8 +172,8 @@ declare interface RoomleEmbeddingApiKeys {
107
172
  global: any;
108
173
  }
109
174
 
110
- declare type RoomlePlannerApi = RoomleEmbeddingApi<default_2, default_3>;
175
+ declare type RoomlePlannerApi = RoomleEmbeddingApi<default_3, default_4>;
111
176
 
112
- declare type RoomleViewerApi = RoomleEmbeddingApi<default_5, default_3>;
177
+ declare type RoomleViewerApi = RoomleEmbeddingApi<default_5, default_4>;
113
178
 
114
179
  export { }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@roomle/embedding-lib",
3
- "version": "5.6.0",
3
+ "version": "5.7.0-debug.1",
4
4
  "description": "This is a small library which can be used to communicate with the Roomle Configurator",
5
5
  "type": "module",
6
6
  "main": "./roomle-embedding-lib.umd.js",
@@ -29,7 +29,7 @@
29
29
  "npm": "8.3.1"
30
30
  },
31
31
  "devDependencies": {
32
- "@roomle/web-sdk": "2.88.0"
32
+ "@roomle/web-sdk": "2.89.0-alpha.2"
33
33
  },
34
34
  "repository": {
35
35
  "type": "git",