@twilltac/compliance-sdk 0.1.11 → 0.2.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 CHANGED
@@ -21,6 +21,7 @@ const plugin = await createCompliancePlugin({
21
21
  workspace: 'YOUR_WORKSPACE_KEY',
22
22
  flow: 'journey',
23
23
  customerReference: 'YOUR_CUSTOMER_REFERENCE',
24
+ offerReference: 'YOUR_OFFER_REFERENCE',
24
25
  authToken: 'YOUR_AUTH_TOKEN',
25
26
  sizing: 'content'
26
27
  }
@@ -41,6 +42,7 @@ Creates and initialises the compliance plugin within a container element.
41
42
  | -------------------------------- | ------------- | -------- | ------------------------------------------------------------------------------------------------------------------- |
42
43
  | `options.containerElement` | `HTMLElement` | Yes | The DOM element where the plugin will be rendered |
43
44
  | `options.data.customerReference` | `string` | Yes | Reference identifier for the customer |
45
+ | `options.data.offerReference` | `string` | Yes | Reference identifier for the compliance customer offer |
44
46
  | `options.data.workspace` | `string` | Yes | Your Twilltac workspace identifier |
45
47
  | `options.data.authToken` | `string` | Yes | Authentication token for the plugin session |
46
48
  | `options.data.flow` | `string` | Yes | The plugin flow to load. One of `journey`, `handover`, or `documents` |
@@ -94,7 +96,7 @@ plugin.on('session:expired', () => {
94
96
  <!-- EVENTS_TABLE_START -->
95
97
  | Event | Data | Description |
96
98
  | ----- | ---- | ----------- |
97
- | `flow.journey.started` | `void` | Emits when the user starts the journey and IDD document is generated. |
99
+ | `flow.journey.started` | `void` | Emits when the user starts the journey and Initial Disclosure Document is generated. |
98
100
  | `flow.journey.section:started` | `SectionStartedEvent` | Emits when the user starts a section. |
99
101
  | `flow.journey.section:completed` | `SectionEndedEvent` | Emits when the user completes the question set and submits their recommendations. |
100
102
  | `flow.documents:list` | `ComplianceDocument[]` | Emits when the user completes the journey and recommendations are produced. |
@@ -145,6 +147,7 @@ export class ComplianceComponent {
145
147
  readonly workspace = input.required<string>();
146
148
  readonly flow = input.required<string>();
147
149
  readonly customerReference = input.required<string>();
150
+ readonly offerReference = input.required<string>();
148
151
  readonly authToken = input.required<string>();
149
152
  readonly sizing = input<'content' | 'container'>('content');
150
153
 
@@ -166,6 +169,7 @@ export class ComplianceComponent {
166
169
  workspace: this.workspace(),
167
170
  flow: this.flow(),
168
171
  customerReference: this.customerReference(),
172
+ offerReference: this.offerReference(),
169
173
  authToken: this.authToken(),
170
174
  sizing: this.sizing()
171
175
  }
@@ -200,6 +204,7 @@ export class ComplianceComponent {
200
204
  readonly workspace = input.required<string>();
201
205
  readonly flow = input.required<string>();
202
206
  readonly customerReference = input.required<string>();
207
+ readonly offerReference = input.required<string>();
203
208
  readonly authToken = input.required<string>();
204
209
  readonly sizing = input<'content' | 'container'>('content');
205
210
 
@@ -224,6 +229,7 @@ export class ComplianceComponent {
224
229
  workspace: this.workspace(),
225
230
  flow: this.flow(),
226
231
  customerReference: this.customerReference(),
232
+ offerReference: this.offerReference(),
227
233
  authToken: this.authToken(),
228
234
  sizing: this.sizing()
229
235
  }
@@ -245,11 +251,12 @@ interface ComplianceWidgetProps {
245
251
  workspace: string;
246
252
  flow: 'journey' | 'handover' | 'documents';
247
253
  customerReference: string;
254
+ offerReference: string;
248
255
  authToken: string;
249
256
  sizing?: 'content' | 'container';
250
257
  }
251
258
 
252
- function ComplianceWidget({ workspace, flow, customerReference, authToken, sizing }: ComplianceWidgetProps) {
259
+ function ComplianceWidget({ workspace, flow, customerReference, offerReference, authToken, sizing }: ComplianceWidgetProps) {
253
260
  const containerRef = useRef<HTMLDivElement>(null);
254
261
  const pluginRef = useRef<CompliancePlugin | null>(null);
255
262
 
@@ -261,7 +268,7 @@ function ComplianceWidget({ workspace, flow, customerReference, authToken, sizin
261
268
 
262
269
  createCompliancePlugin({
263
270
  containerElement: containerRef.current,
264
- data: { workspace, flow, customerReference, authToken, sizing }
271
+ data: { workspace, flow, customerReference, offerReference, authToken, sizing }
265
272
  })
266
273
  .then((plugin) => {
267
274
  pluginRef.current = plugin;
@@ -272,7 +279,7 @@ function ComplianceWidget({ workspace, flow, customerReference, authToken, sizin
272
279
  pluginRef.current?.destroy();
273
280
  pluginRef.current = null;
274
281
  };
275
- }, [workspace, flow, customerReference, authToken]);
282
+ }, [workspace, flow, customerReference, offerReference, authToken]);
276
283
 
277
284
  return <div ref={containerRef} style={{ width: '100%', height: '600px' }} />;
278
285
  }
@@ -1 +1 @@
1
- 23739221278-1
1
+ 23918361367-1
package/index.cjs CHANGED
@@ -286,6 +286,9 @@ function validateOptions(options) {
286
286
  if (!options.data.customerReference) {
287
287
  throw new Error("[CompliancePlugin] data.customerReference is required.");
288
288
  }
289
+ if (!options.data.offerReference) {
290
+ throw new Error("[CompliancePlugin] data.offerReference is required.");
291
+ }
289
292
  if (!options.data.authToken) {
290
293
  throw new Error("[CompliancePlugin] data.authToken is required.");
291
294
  }
package/index.js CHANGED
@@ -260,6 +260,9 @@ function validateOptions(options) {
260
260
  if (!options.data.customerReference) {
261
261
  throw new Error("[CompliancePlugin] data.customerReference is required.");
262
262
  }
263
+ if (!options.data.offerReference) {
264
+ throw new Error("[CompliancePlugin] data.offerReference is required.");
265
+ }
263
266
  if (!options.data.authToken) {
264
267
  throw new Error("[CompliancePlugin] data.authToken is required.");
265
268
  }
@@ -18,7 +18,7 @@ interface ComplianceDocument {
18
18
  readonly reference: string;
19
19
  }
20
20
  export interface CompliancePluginEvents {
21
- /** Emits when the user starts the journey and IDD document is generated. */
21
+ /** Emits when the user starts the journey and Initial Disclosure Document is generated. */
22
22
  ['flow.journey.started']: void;
23
23
  /** Emits when the user starts a section. */
24
24
  ['flow.journey.section:started']: SectionStartedEvent;
@@ -11,6 +11,7 @@ export interface CompliancePluginInitialisationData {
11
11
  readonly workspace: string;
12
12
  readonly flow: CompliancePluginFlow;
13
13
  readonly customerReference: string;
14
+ readonly offerReference: string;
14
15
  readonly authToken: string;
15
16
  readonly sizing: CompliancePluginSizing;
16
17
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@twilltac/compliance-sdk",
3
- "version": "0.1.11",
3
+ "version": "0.2.0",
4
4
  "type": "module",
5
5
  "main": "./src/index.js",
6
6
  "types": "./src/index.d.ts",