@o3r/third-party 14.1.0-prerelease.4 → 14.1.0-prerelease.40

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@o3r/third-party",
3
- "version": "14.1.0-prerelease.4",
3
+ "version": "14.1.0-prerelease.40",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
@@ -12,14 +12,14 @@
12
12
  "otter-module"
13
13
  ],
14
14
  "dependencies": {
15
- "@o3r/schematics": "~14.1.0-prerelease.4",
15
+ "@o3r/schematics": "~14.1.0-prerelease.40",
16
16
  "tslib": "^2.6.2",
17
17
  "uuid": "~13.0.0"
18
18
  },
19
19
  "peerDependencies": {
20
20
  "@angular-devkit/schematics": "^21.0.0",
21
- "@o3r/core": "~14.1.0-prerelease.4",
22
- "@o3r/schematics": "~14.1.0-prerelease.4",
21
+ "@o3r/core": "~14.1.0-prerelease.40",
22
+ "@o3r/schematics": "~14.1.0-prerelease.40",
23
23
  "@schematics/angular": "^21.0.0",
24
24
  "rxjs": "^7.8.1",
25
25
  "type-fest": "^5.3.1",
@@ -46,7 +46,7 @@
46
46
  }
47
47
  },
48
48
  "engines": {
49
- "node": "^20.19.0 || ^22.17.0 || ^24.0.0"
49
+ "node": "^22.17.0 || ^24.0.0"
50
50
  },
51
51
  "schematics": "./collection.json",
52
52
  "module": "fesm2022/o3r-third-party.mjs",
package/index.d.ts DELETED
@@ -1,182 +0,0 @@
1
- import { Logger } from '@o3r/core';
2
- import { Observable } from 'rxjs';
3
-
4
- /**
5
- * Shared interface with the A/B testing provider
6
- */
7
- interface AbTestBridgeInterface<T> {
8
- /**
9
- * Start an AB testing experiment
10
- */
11
- start(experiments: T | T[]): void;
12
- /**
13
- * Stop an AB testing experiment
14
- */
15
- stop(experiments?: T | T[]): void;
16
- }
17
- /**
18
- * Configure the A/B testing script interfaces with the application
19
- */
20
- interface AbTestBridgeConfig {
21
- /**
22
- * Reference to communicate with the bridge from the window
23
- * @default 'abTestBridge'
24
- */
25
- bridgeName: string;
26
- /**
27
- * Debug logger
28
- * @default console
29
- */
30
- logger: Logger;
31
- /**
32
- * Event a third party can subscribe to before starting the communication with the bridge
33
- * @default 'ab-test-ready'
34
- */
35
- readyEventName: string;
36
- }
37
- /**
38
- * Bridge between the application and a third party A/B testing provider.
39
- * Exposes a start and stop methods to allow the external script to set the list of experiments to run over the
40
- * application.
41
- *
42
- * Share the resulting list of experiments with the rest of the application via an observable.
43
- */
44
- declare class AbTestBridge<T> implements AbTestBridgeInterface<T> {
45
- private readonly isExperimentEqual;
46
- /**
47
- * Behaviour subject to control the experiments via the exposed interface
48
- */
49
- private readonly experimentSubject$;
50
- /**
51
- * Options to configure the communication between the AB Testing bridge and third parties
52
- */
53
- private readonly options;
54
- /**
55
- * Observable with the list of AB testing experiments currently applied
56
- */
57
- experiments$: Observable<T[]>;
58
- /**
59
- * AbTestBridge constructor
60
- * @param isExperimentEqual check two different experiments match to identify an experiment to start or to stop
61
- * @param options configure the communication with the A/B testing third party provider
62
- */
63
- constructor(isExperimentEqual: (value1?: T, value2?: T) => boolean, options?: Partial<AbTestBridgeConfig>);
64
- /**
65
- * Use configured logger to log AB testing related information
66
- * @param args
67
- */
68
- private log;
69
- /**
70
- * @inheritDoc
71
- */
72
- start(experiments: T | T[]): void;
73
- /**
74
- * @inheritDoc
75
- */
76
- stop(experiments?: T | T[]): void;
77
- }
78
-
79
- /**
80
- * Represents messages exchanged between host and iFrame.
81
- */
82
- interface IframeMessage {
83
- /**
84
- * String used to identify the type of action to perform.
85
- */
86
- action: string;
87
- /**
88
- * The version of the action, to allow for backward and forward compatibility.
89
- */
90
- version: string;
91
- /**
92
- * Payload of the message.
93
- */
94
- data?: unknown;
95
- }
96
- interface InternalIframeMessage extends IframeMessage {
97
- /**
98
- * The ID associated to the channel Host <-> iFrame
99
- */
100
- channelId: string;
101
- /**
102
- * ID used to handle messages that expect a response from the other party.
103
- * No used for unidirectional messages.
104
- */
105
- id?: string;
106
- }
107
- /**
108
- * Options that can be passed to configure an IFrameBridge
109
- */
110
- interface IFrameBridgeOptions {
111
- /**
112
- * Number of times the Host will try to handshake with the iFrame before failing.
113
- */
114
- handshakeTries: number;
115
- /**
116
- * For a given handshake try, how long will the host wait for an answer before considering
117
- * that the try failed.
118
- */
119
- handshakeTimeout: number;
120
- /**
121
- * When sending a message that expects a response, how long should the Bridge wait before
122
- * considering there will be answer.
123
- */
124
- messageWithResponseTimeout: number;
125
- }
126
-
127
- /**
128
- * Bridge that exposes an easy abstraction layer to communicate between a Host and an IFrame using the
129
- * postMessage API.
130
- */
131
- declare class IframeBridge {
132
- private readonly child;
133
- /** ID used to ensure that the Bridge only processes messages meant for this instance, since postMessage is global to the window. */
134
- private readonly channelId;
135
- /** Observable that emits all the messages received from the IFrame. */
136
- private readonly internalMessages$;
137
- /** Promise that will resolve once the handshake has been completed, undefined if it's already done. */
138
- private readonly handshakePromise?;
139
- /** Options to configure the behaviour of the Bridge. */
140
- private readonly options;
141
- /**
142
- * Observable that emits all the messages received from the IFrame and that are
143
- * not a direct response to a request.
144
- */
145
- readonly messages$: Observable<InternalIframeMessage>;
146
- constructor(parent: Window, child: HTMLIFrameElement, options?: Partial<IFrameBridgeOptions>);
147
- private handshake;
148
- private _sendMessage;
149
- private _sendMessageAndWaitForResponse;
150
- /**
151
- * Method to send a message to the script run in the iframe
152
- * @param message message object
153
- * @param messageId message identifier
154
- */
155
- sendMessage(message: IframeMessage, messageId?: string): Promise<void>;
156
- /**
157
- * Method to send a message to the script run in the iframe and wait for an answer
158
- * @param message
159
- * @param timeoutMilliseconds
160
- */
161
- sendMessageAndWaitForResponse(message: IframeMessage, timeoutMilliseconds?: number): Promise<InternalIframeMessage>;
162
- }
163
-
164
- /**
165
- * Default options for an IFrameBridge
166
- */
167
- declare const IFRAME_BRIDGE_DEFAULT_OPTIONS: Readonly<IFrameBridgeOptions>;
168
- /**
169
- * Verifies if a message respects the format expected by an IFrameBridge
170
- * @param message
171
- */
172
- declare function isSupportedMessage(message: any): message is InternalIframeMessage;
173
- /**
174
- * Generates the html content of an iframe
175
- * @param scriptUrl script to be executed inside the iframe
176
- * @param additionalHeader custom html headers stringified
177
- */
178
- declare function generateIFrameContent(scriptUrl: string, additionalHeader?: string): string;
179
-
180
- export { AbTestBridge, IFRAME_BRIDGE_DEFAULT_OPTIONS, IframeBridge, generateIFrameContent, isSupportedMessage };
181
- export type { AbTestBridgeConfig, AbTestBridgeInterface, IFrameBridgeOptions, IframeMessage, InternalIframeMessage };
182
- //# sourceMappingURL=index.d.ts.map
package/index.d.ts.map DELETED
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sources":["../src/bridge/ab-testing/ab-testing-bridge.ts","../src/bridge/iframe/contracts.ts","../src/bridge/iframe/bridge.ts","../src/bridge/iframe/helpers.ts"],"sourcesContent":[null,null,null,null],"names":[],"mappings":";;;AASA;;AAEG;AACG,UAAA,qBAAA;AACJ;;AAEG;;AAEH;;AAEG;;AAEJ;AAED;;AAEG;;AAED;;;AAGG;;AAEH;;;AAGG;;AAEH;;;AAGG;;AAEJ;AAWD;;;;;;AAMG;AACH,cAAA,YAAA,eAAA,qBAAA;;AACE;;AAEG;AACH;AACA;;AAEG;AACH;AACA;;AAEG;AACI,kBAAA,UAAA;AAEP;;;;AAIG;;AAmBH;;;AAGG;AACH;AAIA;;AAEG;AACI;AAYP;;AAEG;AACI;AAYR;;ACvID;;AAEG;;AAED;;AAEG;;AAGH;;AAEG;;AAGH;;AAEG;;AAEJ;AAEK,UAAA,qBAAA,SAAA,aAAA;AACJ;;AAEG;;AAGH;;;AAGG;;AAEJ;AAED;;AAEG;;AAED;;AAEG;;AAGH;;;AAGG;;AAGH;;;AAGG;;AAEJ;;AC7BD;;;AAGG;AACH,cAAA,YAAA;;;AAEE;;AAGA;;AAGA;;AAGA;AAEA;;;AAGG;AACH,wBAAA,UAAA,CAAA,qBAAA;AAEY,wBAAA,MAAA,SAAA,iBAAA,YAAA,OAAA,CAAA,mBAAA;;AAiCZ;AAMA;AAYA;;;;AAIG;;AAMH;;;;AAIG;AACU,2CAAA,aAAA,iCAAA,OAAA,CAAA,qBAAA;AAId;;AChHD;;AAEG;AACH,cAAA,6BAAA,EAAA,QAAA,CAAA,mBAAA;AAMA;;;AAGG;AACH,iBAAA,kBAAA,2BAAA,qBAAA;AAOA;;;;AAIG;AACH,iBAAA,qBAAA;;;;"}