@roomle/embedding-lib 5.6.0-alpha.1 → 5.6.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,130 @@
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 { Nullable as Nullable_2 } from '../../../../src/common/utils/types';
13
+ import { OnBeforeUpdateDragGhost } from '../../../../common/src/utils/drag';
14
+ import { OnBeforeUpdateDragGhost as OnBeforeUpdateDragGhost_2 } from '../../../common/src/utils/drag';
15
+ import { PossibleCustomViews } from '../../../src/configurator/embedding/types';
16
+ import { PossibleCustomViewsAndMain } from '../../../src/configurator/embedding/types';
17
+ import { PossibleCustomViewsAndMain as PossibleCustomViewsAndMain_2 } from '../../../../src/configurator/embedding/types';
9
18
  import { RapiId } from '@roomle/web-sdk/lib/definitions/typings/rapi-types';
10
19
  import { UiInitData } from '../../../src/configurator/embedding/types';
11
20
 
12
- declare interface AvailablePlugins {
13
- dragIn?: DragIn;
14
- }
21
+ declare type AvailablePlugins = {
22
+ [K in keyof PluginMap]?: InstanceType<PluginMap[K]>;
23
+ };
15
24
 
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;
25
+ declare class Connector<SdkType, SdkCallbacks> implements RoomleEmbeddingApiKeys {
26
+ protected _messageHandler: Nullable<MessageHandler>;
27
+ isSetupDone: boolean;
28
+ viewName: PossibleCustomViewsAndMain;
29
+ plugins: AvailablePlugins;
30
+ pluginsLoaded: Array<Promise<void>>;
31
+ ui: ExposedApi_2;
32
+ extended: SdkType;
33
+ configurator: default_2;
34
+ analytics: {
35
+ callbacks: ExposedAnalyticsCallbacks;
28
36
  };
37
+ global: {
38
+ callbacks: GlobalCallback;
39
+ };
40
+ setMessageHandler(messageHandler: MessageHandler): void;
41
+ handleSetup(methodsAndCallbacks: {
42
+ methods: string[];
43
+ callbacks: string[];
44
+ }): void;
45
+ executeMessage({ message, args }: EmbeddingCommand): Promise<{
46
+ result: any;
47
+ }>;
48
+ setupPlugins(plugins: PluginDefinitions, iframe: HTMLIFrameElement | HTMLBodyElement, mode?: EmbeddingPluginMode): void;
49
+ }
50
+
51
+ declare class DragIn extends EmbeddingPlugin implements DragInStrategy {
52
+ options: DragInOptions;
53
+ private _strategy;
54
+ private _customDragSignal;
29
55
  private _injectStyles;
30
56
  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;
57
+ constructor(instance: ExposedApi, iframe: HTMLIFrameElement, mode: EmbeddingPluginMode, viewName: PossibleCustomViewsAndMain_2);
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): any;
96
+ releaseInput(event: DragEvent | TouchEvent | MouseEvent): void;
97
+ dispose(): void;
98
+ }
99
+
100
+ declare class EmbeddingPlugin {
101
+ protected _mainDomElement: HTMLIFrameElement | HTMLBodyElement;
102
+ protected _instance: Nullable_2<ExposedApi>;
103
+ protected _mode: EmbeddingPluginMode;
104
+ protected _viewName: PossibleCustomViewsAndMain_2;
105
+ constructor(instance: ExposedApi, iframe: HTMLIFrameElement | HTMLBodyElement, mode: EmbeddingPluginMode, viewName: PossibleCustomViewsAndMain_2);
106
+ }
107
+
108
+ declare type EmbeddingPluginMode = 'website' | 'custom-view';
109
+
110
+ declare type PluginConstructors = {
111
+ [K in keyof PluginMap]: PluginMap[K];
112
+ };
113
+
43
114
  declare type PluginDefinitions = Array<keyof AvailablePlugins | {
44
115
  name: keyof AvailablePlugins;
45
- loader: () => Promise<any>;
116
+ loader: () => Promise<PluginConstructors[keyof PluginConstructors]>;
46
117
  }>;
47
118
 
48
- declare type RoomleConfiguratorApi = RoomleEmbeddingApi<default_4, default_3>;
119
+ declare interface PluginMap {
120
+ dragIn: typeof DragIn;
121
+ }
122
+
123
+ declare type RoomleConfiguratorApi = RoomleEmbeddingApi<default_2, default_4>;
49
124
 
50
- declare class RoomleEmbeddingApi<SdkType, SdkCallbacks> implements RoomleEmbeddingApiKeys {
125
+ declare class RoomleEmbeddingApi<SdkType, SdkCallbacks> extends Connector<SdkType, SdkCallbacks> {
51
126
  static createPlanner(configuratorId: string, container: HTMLElement, initData: UiInitData, plugins?: PluginDefinitions): Promise<RoomlePlannerApi>;
127
+ static connect(customView: PossibleCustomViews, plugins?: PluginDefinitions): Promise<Connector<default_2, default_4>>;
52
128
  /**
53
129
  * Method to create a new instance of a Roomle Configurator
54
130
  * @param configuratorId the id which identifies your configurator, you will get this ID from your Roomle Contact Person
@@ -72,23 +148,11 @@ declare class RoomleEmbeddingApi<SdkType, SdkCallbacks> implements RoomleEmbeddi
72
148
  */
73
149
  static createViewer(configuratorId: string, container: HTMLElement, initData: UiInitData, plugins?: PluginDefinitions): Promise<RoomleViewerApi>;
74
150
  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
151
  private _waitForIframe;
86
152
  private _container;
87
- private _messageHandler;
88
153
  private _configuratorSettings;
89
154
  private _initData;
90
155
  private _iframe;
91
- pluginsLoaded: Array<Promise<void>>;
92
156
  private constructor();
93
157
  teardown(): void;
94
158
  private _createIframe;
@@ -107,8 +171,8 @@ declare interface RoomleEmbeddingApiKeys {
107
171
  global: any;
108
172
  }
109
173
 
110
- declare type RoomlePlannerApi = RoomleEmbeddingApi<default_2, default_3>;
174
+ declare type RoomlePlannerApi = RoomleEmbeddingApi<default_3, default_4>;
111
175
 
112
- declare type RoomleViewerApi = RoomleEmbeddingApi<default_5, default_3>;
176
+ declare type RoomleViewerApi = RoomleEmbeddingApi<default_5, default_4>;
113
177
 
114
178
  export { }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@roomle/embedding-lib",
3
- "version": "5.6.0-alpha.1",
3
+ "version": "5.6.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-alpha.1"
32
+ "@roomle/web-sdk": "2.88.0-alpha.2"
33
33
  },
34
34
  "repository": {
35
35
  "type": "git",