@twilltac/compliance-sdk 0.1.5 → 0.1.7
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
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
# @twilltac/compliance-sdk
|
|
1
|
+
\_# @twilltac/compliance-sdk
|
|
2
2
|
|
|
3
3
|
SDK for embedding the Twilltac Compliance Plugin into your application. The plugin provides compliance functionality within an iframe, with secure communication between your host application and the plugin.
|
|
4
4
|
|
|
@@ -19,7 +19,7 @@ const plugin = await createCompliancePlugin({
|
|
|
19
19
|
containerElement: container,
|
|
20
20
|
data: {
|
|
21
21
|
workspace: 'YOUR_WORKSPACE_KEY',
|
|
22
|
-
|
|
22
|
+
flow: 'journey',
|
|
23
23
|
customerReference: 'YOUR_CUSTOMER_REFERENCE',
|
|
24
24
|
authToken: 'YOUR_AUTH_TOKEN'
|
|
25
25
|
}
|
|
@@ -36,13 +36,13 @@ Creates and initialises the compliance plugin within a container element.
|
|
|
36
36
|
|
|
37
37
|
**Parameters:**
|
|
38
38
|
|
|
39
|
-
| Name | Type | Description
|
|
40
|
-
| -------------------------------- | ------------- |
|
|
41
|
-
| `options.containerElement` | `HTMLElement` | The DOM element where the plugin will be rendered
|
|
42
|
-
| `options.data.workspace` | `string` | Your Twilltac workspace identifier
|
|
43
|
-
| `options.data.
|
|
44
|
-
| `options.data.customerReference` | `string` | Reference identifier for the customer
|
|
45
|
-
| `options.data.authToken` | `string` | Authentication token for the plugin session
|
|
39
|
+
| Name | Type | Description |
|
|
40
|
+
| -------------------------------- | ------------- | ------------------------------------------------------- |
|
|
41
|
+
| `options.containerElement` | `HTMLElement` | The DOM element where the plugin will be rendered |
|
|
42
|
+
| `options.data.workspace` | `string` | Your Twilltac workspace identifier |
|
|
43
|
+
| `options.data.flow` | `string` | The plugin flow to load. One of `journey`, `handover`, or `documents` |
|
|
44
|
+
| `options.data.customerReference` | `string` | Reference identifier for the customer |
|
|
45
|
+
| `options.data.authToken` | `string` | Authentication token for the plugin session |
|
|
46
46
|
|
|
47
47
|
**Returns:** `Promise<CompliancePlugin>`
|
|
48
48
|
|
|
@@ -112,7 +112,7 @@ import { from, switchMap } from 'rxjs';
|
|
|
112
112
|
})
|
|
113
113
|
export class ComplianceComponent {
|
|
114
114
|
readonly workspace = input.required<string>();
|
|
115
|
-
readonly
|
|
115
|
+
readonly flow = input.required<string>();
|
|
116
116
|
readonly customerReference = input.required<string>();
|
|
117
117
|
readonly authToken = input.required<string>();
|
|
118
118
|
|
|
@@ -129,7 +129,7 @@ export class ComplianceComponent {
|
|
|
129
129
|
containerElement: container.nativeElement,
|
|
130
130
|
data: {
|
|
131
131
|
workspace: this.workspace(),
|
|
132
|
-
|
|
132
|
+
flow: this.flow(),
|
|
133
133
|
customerReference: this.customerReference(),
|
|
134
134
|
authToken: this.authToken()
|
|
135
135
|
}
|
|
@@ -162,7 +162,7 @@ import { createCompliancePlugin, CompliancePlugin } from '@twilltac/compliance-s
|
|
|
162
162
|
})
|
|
163
163
|
export class ComplianceComponent {
|
|
164
164
|
readonly workspace = input.required<string>();
|
|
165
|
-
readonly
|
|
165
|
+
readonly flow = input.required<string>();
|
|
166
166
|
readonly customerReference = input.required<string>();
|
|
167
167
|
readonly authToken = input.required<string>();
|
|
168
168
|
|
|
@@ -182,6 +182,7 @@ export class ComplianceComponent {
|
|
|
182
182
|
containerElement: this._container().nativeElement,
|
|
183
183
|
data: {
|
|
184
184
|
workspace: this.workspace(),
|
|
185
|
+
flow: this.flow(),
|
|
185
186
|
customerReference: this.customerReference(),
|
|
186
187
|
authToken: this.authToken()
|
|
187
188
|
}
|
|
@@ -201,12 +202,12 @@ import { createCompliancePlugin, CompliancePlugin } from '@twilltac/compliance-s
|
|
|
201
202
|
|
|
202
203
|
interface ComplianceWidgetProps {
|
|
203
204
|
workspace: string;
|
|
204
|
-
|
|
205
|
+
flow: 'journey' | 'handover' | 'documents';
|
|
205
206
|
customerReference: string;
|
|
206
207
|
authToken: string;
|
|
207
208
|
}
|
|
208
209
|
|
|
209
|
-
function ComplianceWidget({ workspace,
|
|
210
|
+
function ComplianceWidget({ workspace, flow, customerReference, authToken }: ComplianceWidgetProps) {
|
|
210
211
|
const containerRef = useRef<HTMLDivElement>(null);
|
|
211
212
|
const pluginRef = useRef<CompliancePlugin | null>(null);
|
|
212
213
|
|
|
@@ -215,13 +216,13 @@ function ComplianceWidget({ workspace, view, customerReference, authToken }: Com
|
|
|
215
216
|
|
|
216
217
|
createCompliancePlugin({
|
|
217
218
|
containerElement: containerRef.current,
|
|
218
|
-
data: { workspace,
|
|
219
|
+
data: { workspace, flow, customerReference, authToken }
|
|
219
220
|
})
|
|
220
221
|
.then((plugin) => {
|
|
221
222
|
pluginRef.current = plugin;
|
|
222
223
|
})
|
|
223
224
|
.catch(console.error);
|
|
224
|
-
}, [workspace,
|
|
225
|
+
}, [workspace, flow, customerReference, authToken]);
|
|
225
226
|
|
|
226
227
|
return <div ref={containerRef} style={{ width: '100%', height: '600px' }} />;
|
|
227
228
|
}
|
package/build-revision.txt
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
22864006029-1
|
package/index.cjs
CHANGED
|
@@ -81,11 +81,12 @@ var CompliancePlugin = class {
|
|
|
81
81
|
};
|
|
82
82
|
|
|
83
83
|
// libs/twilltac/plugins/compliance/types/src/lib/compliance-plugin-initialisation.data.ts
|
|
84
|
-
var
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
84
|
+
var CompliancePluginFlow = /* @__PURE__ */ ((CompliancePluginFlow2) => {
|
|
85
|
+
CompliancePluginFlow2["JOURNEY"] = "journey";
|
|
86
|
+
CompliancePluginFlow2["HANDOVER"] = "handover";
|
|
87
|
+
CompliancePluginFlow2["DOCUMENTS"] = "documents";
|
|
88
|
+
return CompliancePluginFlow2;
|
|
89
|
+
})(CompliancePluginFlow || {});
|
|
89
90
|
|
|
90
91
|
// libs/twilltac/plugins/utils/post-messenger/src/lib/post-message.bus.ts
|
|
91
92
|
var PostMessageBus = class {
|
|
@@ -250,9 +251,9 @@ function validateOptions(options) {
|
|
|
250
251
|
if (!options.data.workspace) {
|
|
251
252
|
throw new Error("[CompliancePlugin] data.workspace is required.");
|
|
252
253
|
}
|
|
253
|
-
const
|
|
254
|
-
if (!options.data.
|
|
255
|
-
throw new Error(`[CompliancePlugin] data.
|
|
254
|
+
const validFlows = Object.values(CompliancePluginFlow);
|
|
255
|
+
if (!options.data.flow || !validFlows.includes(options.data.flow)) {
|
|
256
|
+
throw new Error(`[CompliancePlugin] data.flow is required and must be one of: ${validFlows.join(", ")}.`);
|
|
256
257
|
}
|
|
257
258
|
if (!options.data.customerReference) {
|
|
258
259
|
throw new Error("[CompliancePlugin] data.customerReference is required.");
|
package/index.js
CHANGED
|
@@ -55,11 +55,12 @@ var CompliancePlugin = class {
|
|
|
55
55
|
};
|
|
56
56
|
|
|
57
57
|
// libs/twilltac/plugins/compliance/types/src/lib/compliance-plugin-initialisation.data.ts
|
|
58
|
-
var
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
58
|
+
var CompliancePluginFlow = /* @__PURE__ */ ((CompliancePluginFlow2) => {
|
|
59
|
+
CompliancePluginFlow2["JOURNEY"] = "journey";
|
|
60
|
+
CompliancePluginFlow2["HANDOVER"] = "handover";
|
|
61
|
+
CompliancePluginFlow2["DOCUMENTS"] = "documents";
|
|
62
|
+
return CompliancePluginFlow2;
|
|
63
|
+
})(CompliancePluginFlow || {});
|
|
63
64
|
|
|
64
65
|
// libs/twilltac/plugins/utils/post-messenger/src/lib/post-message.bus.ts
|
|
65
66
|
var PostMessageBus = class {
|
|
@@ -224,9 +225,9 @@ function validateOptions(options) {
|
|
|
224
225
|
if (!options.data.workspace) {
|
|
225
226
|
throw new Error("[CompliancePlugin] data.workspace is required.");
|
|
226
227
|
}
|
|
227
|
-
const
|
|
228
|
-
if (!options.data.
|
|
229
|
-
throw new Error(`[CompliancePlugin] data.
|
|
228
|
+
const validFlows = Object.values(CompliancePluginFlow);
|
|
229
|
+
if (!options.data.flow || !validFlows.includes(options.data.flow)) {
|
|
230
|
+
throw new Error(`[CompliancePlugin] data.flow is required and must be one of: ${validFlows.join(", ")}.`);
|
|
230
231
|
}
|
|
231
232
|
if (!options.data.customerReference) {
|
|
232
233
|
throw new Error("[CompliancePlugin] data.customerReference is required.");
|
package/libs/twilltac/plugins/compliance/types/src/lib/compliance-plugin-initialisation.data.d.ts
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
|
-
export declare enum
|
|
1
|
+
export declare enum CompliancePluginFlow {
|
|
2
2
|
JOURNEY = "journey",
|
|
3
|
-
HANDOVER = "handover"
|
|
3
|
+
HANDOVER = "handover",
|
|
4
|
+
DOCUMENTS = "documents"
|
|
4
5
|
}
|
|
5
6
|
export interface CompliancePluginInitialisationData {
|
|
6
7
|
readonly workspace: string;
|
|
7
|
-
readonly
|
|
8
|
+
readonly flow: CompliancePluginFlow;
|
|
8
9
|
readonly customerReference: string;
|
|
9
10
|
readonly authToken: string;
|
|
10
11
|
}
|