@twilltac/compliance-sdk 0.2.2 → 0.3.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/README.md +2 -8
- package/build-revision.txt +1 -1
- package/index.cjs +1 -4
- package/index.js +1 -4
- package/libs/twilltac/plugins/compliance/sdk/src/lib/compliance-plugin.events.d.ts +0 -6
- package/libs/twilltac/plugins/compliance/sdk/src/lib/create-compliance.plugin.d.ts +2 -2
- package/libs/twilltac/plugins/compliance/types/src/lib/compliance-plugin-initialisation.data.d.ts +3 -4
- package/libs/twilltac/plugins/compliance/types/src/lib/compliance-plugin-post.messages.d.ts +25 -26
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -45,7 +45,7 @@ Creates and initialises the compliance plugin within a container element.
|
|
|
45
45
|
| `options.data.offerReference` | `string` | Yes | Reference identifier for the compliance customer offer |
|
|
46
46
|
| `options.data.workspace` | `string` | Yes | Your Twilltac workspace identifier |
|
|
47
47
|
| `options.data.authToken` | `string` | Yes | Authentication token for the plugin session |
|
|
48
|
-
| `options.data.flow` | `string` | Yes | The plugin flow to load. One of `journey
|
|
48
|
+
| `options.data.flow` | `string` | Yes | The plugin flow to load. One of `journey` or `handover` |
|
|
49
49
|
| `options.data.sizing` | `string` | No | `'content'` (default) — plugin element grows to fit content. <br/>`'container'` — plugin fills its container height |
|
|
50
50
|
|
|
51
51
|
**Returns:** `Promise<CompliancePlugin>`
|
|
@@ -100,7 +100,6 @@ plugin.on('session:expired', () => {
|
|
|
100
100
|
| `flow.journey.section:started` | `SectionStartedEvent` | Emits when the user starts a section. |
|
|
101
101
|
| `flow.journey.section:completed` | `SectionEndedEvent` | Emits when the user completes the question set and submits their recommendations. |
|
|
102
102
|
| `flow.journey:completed` | `void` | Emits when the user completes the journey and summary page is presented. |
|
|
103
|
-
| `flow.documents:list` | `ComplianceDocument[]` | Emits when with a list of available documents. |
|
|
104
103
|
| `session:expired` | `void` | Emits when the session has expired. This would typically trigger your auth flow followed by re-initialising the plugin. |
|
|
105
104
|
|
|
106
105
|
#### Type Definitions
|
|
@@ -122,11 +121,6 @@ interface SectionEndedEvent {
|
|
|
122
121
|
readonly description: string;
|
|
123
122
|
}[];
|
|
124
123
|
}
|
|
125
|
-
|
|
126
|
-
interface ComplianceDocument {
|
|
127
|
-
readonly name: string;
|
|
128
|
-
readonly reference: string;
|
|
129
|
-
}
|
|
130
124
|
```
|
|
131
125
|
<!-- EVENTS_TABLE_END -->
|
|
132
126
|
|
|
@@ -250,7 +244,7 @@ import { createCompliancePlugin, CompliancePlugin } from '@twilltac/compliance-s
|
|
|
250
244
|
|
|
251
245
|
interface ComplianceWidgetProps {
|
|
252
246
|
workspace: string;
|
|
253
|
-
flow: 'journey' | 'handover'
|
|
247
|
+
flow: 'journey' | 'handover';
|
|
254
248
|
customerReference: string;
|
|
255
249
|
offerReference: string;
|
|
256
250
|
authToken: string;
|
package/build-revision.txt
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
28376130533-1
|
package/index.cjs
CHANGED
|
@@ -30,7 +30,6 @@ module.exports = __toCommonJS(index_exports);
|
|
|
30
30
|
var CompliancePluginFlow = /* @__PURE__ */ ((CompliancePluginFlow2) => {
|
|
31
31
|
CompliancePluginFlow2["JOURNEY"] = "journey";
|
|
32
32
|
CompliancePluginFlow2["HANDOVER"] = "handover";
|
|
33
|
-
CompliancePluginFlow2["DOCUMENTS"] = "documents";
|
|
34
33
|
return CompliancePluginFlow2;
|
|
35
34
|
})(CompliancePluginFlow || {});
|
|
36
35
|
|
|
@@ -89,14 +88,12 @@ var CompliancePlugin = class {
|
|
|
89
88
|
opts.postMessageBus.on("journey.section:started", (data) => this._events.emit("flow.journey.section:started", data));
|
|
90
89
|
opts.postMessageBus.on("journey.section:completed", (data) => this._events.emit("flow.journey.section:completed", data));
|
|
91
90
|
opts.postMessageBus.on("journey:completed", () => this._events.emit("flow.journey:completed"));
|
|
92
|
-
opts.postMessageBus.on("documents:loaded", (data) => this._events.emit("flow.documents:list", data));
|
|
93
91
|
const eventNames = [
|
|
94
92
|
"session:expired",
|
|
95
93
|
"flow.journey.started",
|
|
96
94
|
"flow.journey.section:started",
|
|
97
95
|
"flow.journey.section:completed",
|
|
98
|
-
"flow.journey:completed"
|
|
99
|
-
"flow.documents:list"
|
|
96
|
+
"flow.journey:completed"
|
|
100
97
|
];
|
|
101
98
|
for (const eventName of eventNames) {
|
|
102
99
|
this._events.on(eventName, ((...args) => {
|
package/index.js
CHANGED
|
@@ -4,7 +4,6 @@
|
|
|
4
4
|
var CompliancePluginFlow = /* @__PURE__ */ ((CompliancePluginFlow2) => {
|
|
5
5
|
CompliancePluginFlow2["JOURNEY"] = "journey";
|
|
6
6
|
CompliancePluginFlow2["HANDOVER"] = "handover";
|
|
7
|
-
CompliancePluginFlow2["DOCUMENTS"] = "documents";
|
|
8
7
|
return CompliancePluginFlow2;
|
|
9
8
|
})(CompliancePluginFlow || {});
|
|
10
9
|
|
|
@@ -63,14 +62,12 @@ var CompliancePlugin = class {
|
|
|
63
62
|
opts.postMessageBus.on("journey.section:started", (data) => this._events.emit("flow.journey.section:started", data));
|
|
64
63
|
opts.postMessageBus.on("journey.section:completed", (data) => this._events.emit("flow.journey.section:completed", data));
|
|
65
64
|
opts.postMessageBus.on("journey:completed", () => this._events.emit("flow.journey:completed"));
|
|
66
|
-
opts.postMessageBus.on("documents:loaded", (data) => this._events.emit("flow.documents:list", data));
|
|
67
65
|
const eventNames = [
|
|
68
66
|
"session:expired",
|
|
69
67
|
"flow.journey.started",
|
|
70
68
|
"flow.journey.section:started",
|
|
71
69
|
"flow.journey.section:completed",
|
|
72
|
-
"flow.journey:completed"
|
|
73
|
-
"flow.documents:list"
|
|
70
|
+
"flow.journey:completed"
|
|
74
71
|
];
|
|
75
72
|
for (const eventName of eventNames) {
|
|
76
73
|
this._events.on(eventName, ((...args) => {
|
|
@@ -13,10 +13,6 @@ interface SectionEndedEvent {
|
|
|
13
13
|
readonly description: string;
|
|
14
14
|
}[];
|
|
15
15
|
}
|
|
16
|
-
interface ComplianceDocument {
|
|
17
|
-
readonly name: string;
|
|
18
|
-
readonly reference: string;
|
|
19
|
-
}
|
|
20
16
|
export interface CompliancePluginEvents {
|
|
21
17
|
/** Emits when the user starts the journey and Initial Disclosure Document is generated. */
|
|
22
18
|
['flow.journey.started']: void;
|
|
@@ -26,8 +22,6 @@ export interface CompliancePluginEvents {
|
|
|
26
22
|
['flow.journey.section:completed']: SectionEndedEvent;
|
|
27
23
|
/** Emits when the user completes the journey and summary page is presented. */
|
|
28
24
|
['flow.journey:completed']: void;
|
|
29
|
-
/** Emits when with a list of available documents. */
|
|
30
|
-
['flow.documents:list']: ComplianceDocument[];
|
|
31
25
|
/** Emits when the session has expired. This would typically trigger your auth flow followed by re-initialising the plugin. */
|
|
32
26
|
['session:expired']: void;
|
|
33
27
|
}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { CompliancePluginInitialisationData,
|
|
1
|
+
import { CompliancePluginInitialisationData, PluginInitialisationSizing } from '@twilltac/compliance-plugin-types';
|
|
2
2
|
import { CompliancePlugin } from './compliance.plugin';
|
|
3
3
|
interface InitialisationOptions {
|
|
4
4
|
readonly containerElement: HTMLElement;
|
|
5
5
|
readonly data: Omit<CompliancePluginInitialisationData, 'sizing'> & {
|
|
6
|
-
readonly sizing?:
|
|
6
|
+
readonly sizing?: PluginInitialisationSizing;
|
|
7
7
|
};
|
|
8
8
|
}
|
|
9
9
|
export declare function createCompliancePlugin(options: InitialisationOptions): Promise<CompliancePlugin>;
|
package/libs/twilltac/plugins/compliance/types/src/lib/compliance-plugin-initialisation.data.d.ts
CHANGED
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
export declare enum CompliancePluginFlow {
|
|
2
2
|
JOURNEY = "journey",
|
|
3
|
-
HANDOVER = "handover"
|
|
4
|
-
DOCUMENTS = "documents"
|
|
3
|
+
HANDOVER = "handover"
|
|
5
4
|
}
|
|
6
|
-
export declare enum
|
|
5
|
+
export declare enum PluginInitialisationSizing {
|
|
7
6
|
CONTAINER = "container",
|
|
8
7
|
CONTENT = "content"
|
|
9
8
|
}
|
|
@@ -13,5 +12,5 @@ export interface CompliancePluginInitialisationData {
|
|
|
13
12
|
readonly customerReference: string;
|
|
14
13
|
readonly offerReference: string;
|
|
15
14
|
readonly authToken: string;
|
|
16
|
-
readonly sizing:
|
|
15
|
+
readonly sizing: PluginInitialisationSizing;
|
|
17
16
|
}
|
|
@@ -1,28 +1,8 @@
|
|
|
1
|
-
interface SectionStartedEvent {
|
|
2
|
-
readonly name: string;
|
|
3
|
-
readonly reference: string;
|
|
4
|
-
}
|
|
5
|
-
interface SectionEndedEvent {
|
|
6
|
-
readonly name: string;
|
|
7
|
-
readonly reference: string;
|
|
8
|
-
readonly recommendations: ProductRecommendation[];
|
|
9
|
-
}
|
|
10
|
-
interface ProductRecommendation {
|
|
11
|
-
readonly externalReference: string;
|
|
12
|
-
readonly price: number | null;
|
|
13
|
-
readonly regulated: boolean;
|
|
14
|
-
readonly title: string;
|
|
15
|
-
readonly description: string;
|
|
16
|
-
}
|
|
17
|
-
interface ComplianceDocument {
|
|
18
|
-
readonly name: string;
|
|
19
|
-
readonly reference: string;
|
|
20
|
-
}
|
|
21
1
|
export interface InitialisationData {
|
|
22
2
|
readonly appInstanceId: string;
|
|
23
3
|
readonly documentHeight: number;
|
|
24
4
|
}
|
|
25
|
-
export interface
|
|
5
|
+
export interface StandardPluginPostMessages {
|
|
26
6
|
['window:resize']: {
|
|
27
7
|
payload: {
|
|
28
8
|
height: number;
|
|
@@ -30,12 +10,8 @@ export interface CompliancePluginPostMessages {
|
|
|
30
10
|
};
|
|
31
11
|
['navigation:start']: void;
|
|
32
12
|
['navigation:end']: void;
|
|
33
|
-
['session:expired-token']: void;
|
|
34
13
|
['initialisation:success']: {
|
|
35
|
-
payload:
|
|
36
|
-
appInstanceId: string;
|
|
37
|
-
documentHeight: number;
|
|
38
|
-
};
|
|
14
|
+
payload: InitialisationData;
|
|
39
15
|
};
|
|
40
16
|
['initialisation:error']: {
|
|
41
17
|
payload: {
|
|
@@ -45,6 +21,29 @@ export interface CompliancePluginPostMessages {
|
|
|
45
21
|
error: Error;
|
|
46
22
|
};
|
|
47
23
|
};
|
|
24
|
+
}
|
|
25
|
+
interface SectionStartedEvent {
|
|
26
|
+
readonly name: string;
|
|
27
|
+
readonly reference: string;
|
|
28
|
+
}
|
|
29
|
+
interface SectionEndedEvent {
|
|
30
|
+
readonly name: string;
|
|
31
|
+
readonly reference: string;
|
|
32
|
+
readonly recommendations: ProductRecommendation[];
|
|
33
|
+
}
|
|
34
|
+
interface ProductRecommendation {
|
|
35
|
+
readonly externalReference: string;
|
|
36
|
+
readonly price: number | null;
|
|
37
|
+
readonly regulated: boolean;
|
|
38
|
+
readonly title: string;
|
|
39
|
+
readonly description: string;
|
|
40
|
+
}
|
|
41
|
+
interface ComplianceDocument {
|
|
42
|
+
readonly name: string;
|
|
43
|
+
readonly reference: string;
|
|
44
|
+
}
|
|
45
|
+
export interface CompliancePluginPostMessages extends StandardPluginPostMessages {
|
|
46
|
+
['session:expired-token']: void;
|
|
48
47
|
['journey:started']: void;
|
|
49
48
|
['journey:completed']: void;
|
|
50
49
|
['journey.section:started']: {
|