@soyio/soyio-widget 2.20.0 → 2.22.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 +41 -0
- package/dist/index.d.ts +106 -9
- package/dist/index.js +1223 -1085
- package/dist/index.umd.cjs +31 -31
- package/package.json +1 -1
- package/src/schemas/appearance.schema.json +83 -0
- package/src/schemas/config.schema.json +112 -3
package/README.md
CHANGED
|
@@ -20,6 +20,7 @@
|
|
|
20
20
|
- [Consent Request Box](#consent-request-box)
|
|
21
21
|
- [Privacy Center](#privacy-center)
|
|
22
22
|
- [Disclosure Request](#disclosure-request)
|
|
23
|
+
- [Disclosure Request Box](#disclosure-request-box)
|
|
23
24
|
- [Signature Attempt](#signature-attempt)
|
|
24
25
|
- [Auth Request](#auth-request)
|
|
25
26
|
- [Appearance](#appearance)
|
|
@@ -216,6 +217,10 @@ The `PrivacyCenterBox` lets you embed the Privacy Center inside your page. You c
|
|
|
216
217
|
- `maxFileSize`: Maximum file size in bytes. Default: `5 * 1024 * 1024` (5MB).
|
|
217
218
|
- `redecOperationIds`: Optional array of `{ id, label }` values for the Redec operation select. Required if `redec` right is included in `enabledRights` param.
|
|
218
219
|
- `isSandbox`: Whether to use the sandbox environment. Defaults to `false`.
|
|
220
|
+
- `consentControl`: Optional, controls the visual interaction for consent toggles. Values: `'switch'` (default) or `'checkbox'`.
|
|
221
|
+
- `consentMode`: Optional, controls how consent changes are committed. Values: `'immediate'` (default) or `'batch'` (save multiple changes at once).
|
|
222
|
+
- `consentRetentionPeriod`: Optional, specifies a duration during which a consent cannot be revoked after being granted. Format: `"<value> <unit>"`. Supported units: `day`, `week`, `month`, `year` (and their plural forms). Example: `'30 days'`, `'1 week'`.
|
|
223
|
+
- `showBatchConsentConfirmation`: Optional boolean, whether to show a confirmation dialog before saving consent changes in batch mode.
|
|
219
224
|
- `appearance`: Customize the iframe appearance. See Appearance section below.
|
|
220
225
|
- `onEvent`: Callback that receives events from the iframe.
|
|
221
226
|
- `onReady`: Optional callback fired when the iframe becomes ready.
|
|
@@ -362,6 +367,41 @@ The `onEvent` callback is designed to handle various events that occur during wi
|
|
|
362
367
|
- **`onEvent`**: A callback function triggered upon event occurrences, used for capturing and logging event-related data.
|
|
363
368
|
- **`customColor`**: A hex code string that specifies the base color of the interface.
|
|
364
369
|
|
|
370
|
+
## Disclosure Request Box
|
|
371
|
+
|
|
372
|
+
Use `DisclosureRequestBox` when you want to keep the disclosure flow inside your page, without popup windows.
|
|
373
|
+
|
|
374
|
+
This embedded API currently supports disclosure flows created in advance (existing disclosure requests only).
|
|
375
|
+
|
|
376
|
+
```html
|
|
377
|
+
<div id="embedded-disclosure"></div>
|
|
378
|
+
|
|
379
|
+
<script>
|
|
380
|
+
import { DisclosureRequestBox } from "@soyio/soyio-widget";
|
|
381
|
+
|
|
382
|
+
const widget = new DisclosureRequestBox({
|
|
383
|
+
disclosureRequestId: "<disclosure request id>",
|
|
384
|
+
customColor: "#0F172A", // Optional
|
|
385
|
+
onEvent: (event) => {
|
|
386
|
+
console.log("DisclosureRequestBox event:", event);
|
|
387
|
+
},
|
|
388
|
+
onReady: () => {
|
|
389
|
+
console.log("DisclosureRequestBox is ready");
|
|
390
|
+
},
|
|
391
|
+
minHeight: "640px", // Optional
|
|
392
|
+
height: "720px", // Optional
|
|
393
|
+
isSandbox: true, // Optional
|
|
394
|
+
});
|
|
395
|
+
|
|
396
|
+
widget.mount("#embedded-disclosure");
|
|
397
|
+
|
|
398
|
+
// Optional cleanup
|
|
399
|
+
// widget.unmount();
|
|
400
|
+
</script>
|
|
401
|
+
```
|
|
402
|
+
|
|
403
|
+
Passkey registration and passkey authentication are handled through a temporary popup tunnel and then return control to the embedded iframe flow.
|
|
404
|
+
|
|
365
405
|
## Signature Attempt
|
|
366
406
|
|
|
367
407
|
> 📖 [Integration Guide](https://docs.soyio.id/docs/integration-guide/signature/introduction)
|
|
@@ -543,6 +583,7 @@ interface Config {
|
|
|
543
583
|
| `icon.size` | Global default icon size in pixels | `24` |
|
|
544
584
|
| `iconRules` | Per-component icon style overrides | `{}` |
|
|
545
585
|
| `mainPageColumns` | Number of columns in the main page feature cards grid (1-4) | `2` |
|
|
586
|
+
| `consentManagementColumns` | Number of columns in the consent management grid (1-4) | `2` |
|
|
546
587
|
| `brandTheme` | Theme variant for branded elements like the footer (`default`, `dark`, `light`) | `"default"` |
|
|
547
588
|
|
|
548
589
|
#### Icons
|
package/dist/index.d.ts
CHANGED
|
@@ -16,15 +16,15 @@ declare type AuthRequestProps = {
|
|
|
16
16
|
customColor?: string;
|
|
17
17
|
};
|
|
18
18
|
|
|
19
|
-
declare type BaseConfig = {
|
|
20
|
-
onEvent: (event:
|
|
19
|
+
declare type BaseConfig<TEvent = Record<string, unknown>> = {
|
|
20
|
+
onEvent: (event: TEvent) => void;
|
|
21
21
|
onReady?: () => void;
|
|
22
22
|
isSandbox?: boolean;
|
|
23
23
|
appearance?: SoyioAppearance;
|
|
24
24
|
developmentUrl?: string;
|
|
25
25
|
};
|
|
26
26
|
|
|
27
|
-
declare abstract class BaseIframeBox<T extends BaseConfig
|
|
27
|
+
declare abstract class BaseIframeBox<TEvent, T extends BaseConfig<TEvent>> {
|
|
28
28
|
protected iframe: HTMLIFrameElement | null;
|
|
29
29
|
protected wrapper: HTMLDivElement | null;
|
|
30
30
|
protected skeleton: ISkeletonView | null;
|
|
@@ -58,7 +58,7 @@ declare const CLOSED_EVENT = "WIDGET_CLOSED";
|
|
|
58
58
|
|
|
59
59
|
export { configSchema }
|
|
60
60
|
|
|
61
|
-
export declare class ConsentBox extends BaseIframeBox<ConsentConfig> {
|
|
61
|
+
export declare class ConsentBox extends BaseIframeBox<Record<string, unknown>, ConsentConfig> {
|
|
62
62
|
readonly defaultIframePrefix = "consent-box";
|
|
63
63
|
readonly defaultIframeCSSConfig: IframeCSSConfig;
|
|
64
64
|
private state;
|
|
@@ -185,6 +185,72 @@ declare type CSSProperties = {
|
|
|
185
185
|
|
|
186
186
|
declare type DataSubject = 'anonymous_user' | 'citizen_voter' | 'commuter' | 'consultant' | 'customer' | 'employee' | 'job_applicant' | 'next_of_kin' | 'passenger' | 'patient' | 'prospect' | 'shareholder' | 'supplier_vendor' | 'trainee' | 'visitor';
|
|
187
187
|
|
|
188
|
+
export declare class DisclosureRequestBox extends BaseIframeBox<DisclosureRequestBoxEvent, DisclosureRequestBoxConfig> {
|
|
189
|
+
readonly defaultIframePrefix = "disclosure-request-box";
|
|
190
|
+
private passkeyPopupWindow;
|
|
191
|
+
private popupListener;
|
|
192
|
+
private isReadyCallbackFired;
|
|
193
|
+
iframeUrl(): string;
|
|
194
|
+
mount(selector: string): Promise<this>;
|
|
195
|
+
unmount(): void;
|
|
196
|
+
protected setupListeners(): Promise<void>;
|
|
197
|
+
protected handleIframeReady(): Promise<void>;
|
|
198
|
+
private notifyReady;
|
|
199
|
+
private triggerEvent;
|
|
200
|
+
private mountPopupListener;
|
|
201
|
+
private removePopupListener;
|
|
202
|
+
private handleInfoEvent;
|
|
203
|
+
private notifyPasskeyEvent;
|
|
204
|
+
private notifyPasskeyRegistered;
|
|
205
|
+
private notifyPasskeyAuthenticated;
|
|
206
|
+
private openPasskeyRegistrationPopup;
|
|
207
|
+
private openPasskeyAuthenticationPopup;
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
declare type DisclosureRequestBoxConfig = DisclosureRequestBoxProps & {
|
|
211
|
+
onEvent: (data: DisclosureRequestBoxEvent) => void;
|
|
212
|
+
onReady?: () => void;
|
|
213
|
+
isSandbox?: boolean;
|
|
214
|
+
developmentUrl?: string;
|
|
215
|
+
} & DisclosureRequestBoxSizing;
|
|
216
|
+
|
|
217
|
+
declare type DisclosureRequestBoxEvent = EventData | DisclosureRequestBoxPasskeyRequiredEvent | DisclosureRequestBoxPasskeyAuthenticationRequiredEvent | DisclosureRequestBoxPasskeyRegisteredEvent | DisclosureRequestBoxPasskeyAuthenticatedEvent;
|
|
218
|
+
|
|
219
|
+
declare type DisclosureRequestBoxPasskeyAuthenticatedEvent = {
|
|
220
|
+
eventName: 'PASSKEY_AUTHENTICATED';
|
|
221
|
+
type: 'PASSKEY_AUTHENTICATED';
|
|
222
|
+
identifier: string;
|
|
223
|
+
};
|
|
224
|
+
|
|
225
|
+
declare type DisclosureRequestBoxPasskeyAuthenticationRequiredEvent = {
|
|
226
|
+
eventName: 'PASSKEY_AUTHENTICATION_REQUIRED';
|
|
227
|
+
type: 'PASSKEY_AUTHENTICATION_REQUIRED';
|
|
228
|
+
requestableToken: string;
|
|
229
|
+
};
|
|
230
|
+
|
|
231
|
+
declare type DisclosureRequestBoxPasskeyRegisteredEvent = {
|
|
232
|
+
eventName: 'PASSKEY_REGISTERED';
|
|
233
|
+
type: 'PASSKEY_REGISTERED';
|
|
234
|
+
identifier: string;
|
|
235
|
+
};
|
|
236
|
+
|
|
237
|
+
declare type DisclosureRequestBoxPasskeyRequiredEvent = {
|
|
238
|
+
eventName: 'PASSKEY_REQUIRED';
|
|
239
|
+
type: 'PASSKEY_REQUIRED';
|
|
240
|
+
sessionToken: string;
|
|
241
|
+
companyId: `com_${string}`;
|
|
242
|
+
};
|
|
243
|
+
|
|
244
|
+
declare type DisclosureRequestBoxProps = {
|
|
245
|
+
disclosureRequestId: `dreq_${string}`;
|
|
246
|
+
customColor?: string;
|
|
247
|
+
};
|
|
248
|
+
|
|
249
|
+
declare type DisclosureRequestBoxSizing = {
|
|
250
|
+
height?: string;
|
|
251
|
+
minHeight?: string;
|
|
252
|
+
};
|
|
253
|
+
|
|
188
254
|
declare type DisclosureRequestConfig = {
|
|
189
255
|
request: 'disclosure';
|
|
190
256
|
configProps: DisclosureRequestProps;
|
|
@@ -245,7 +311,7 @@ declare type NewDisclosureRequestProps = {
|
|
|
245
311
|
customColor?: string;
|
|
246
312
|
};
|
|
247
313
|
|
|
248
|
-
export declare class PrivacyCenterBox extends BaseIframeBox<PrivacyCenterConfig> {
|
|
314
|
+
export declare class PrivacyCenterBox extends BaseIframeBox<Record<string, unknown>, PrivacyCenterConfig> {
|
|
249
315
|
readonly defaultIframePrefix = "privacy-center";
|
|
250
316
|
protected readonly _uniqueIdentifier = "privacy-center";
|
|
251
317
|
readonly defaultIframeCSSConfig: IframeCSSConfig;
|
|
@@ -264,6 +330,9 @@ declare type PrivacyCenterConfig = BaseConfig & {
|
|
|
264
330
|
allowedExtensions?: string[];
|
|
265
331
|
maxFileSize?: number;
|
|
266
332
|
};
|
|
333
|
+
consentMode?: 'immediate' | 'batch';
|
|
334
|
+
consentRetentionPeriod?: string;
|
|
335
|
+
showBatchConsentConfirmation?: boolean;
|
|
267
336
|
redecOperationIds?: RedecOperationId[];
|
|
268
337
|
} & ({
|
|
269
338
|
companyId: `com_${string}`;
|
|
@@ -310,6 +379,13 @@ declare interface SoyioAppearance {
|
|
|
310
379
|
|
|
311
380
|
declare interface SoyioAppearanceConfig {
|
|
312
381
|
helperTextPosition?: 'top' | 'bottom';
|
|
382
|
+
/**
|
|
383
|
+
* Control type for consent items.
|
|
384
|
+
* - 'switch': Toggle switch (default)
|
|
385
|
+
* - 'checkbox': Checkbox
|
|
386
|
+
* @default 'switch'
|
|
387
|
+
*/
|
|
388
|
+
consentControl?: 'switch' | 'checkbox';
|
|
313
389
|
/**
|
|
314
390
|
* Icon name to use for hint/help tooltips on input labels.
|
|
315
391
|
* Available icons: 'Question' (default), 'Info', 'QuestionMark', etc.
|
|
@@ -340,6 +416,11 @@ declare interface SoyioAppearanceConfig {
|
|
|
340
416
|
* @default 2
|
|
341
417
|
*/
|
|
342
418
|
mainPageColumns?: 1 | 2 | 3 | 4;
|
|
419
|
+
/**
|
|
420
|
+
* Number of columns in the consent management grid.
|
|
421
|
+
* @default 2
|
|
422
|
+
*/
|
|
423
|
+
consentManagementColumns?: 1 | 2 | 3 | 4;
|
|
343
424
|
/**
|
|
344
425
|
* Theme variant for branded elements like the footer.
|
|
345
426
|
* - 'default': Standard Soyio brand colors (purple/indigo)
|
|
@@ -389,7 +470,7 @@ declare interface SoyioAppearanceVariables {
|
|
|
389
470
|
dataUseIconColor?: string;
|
|
390
471
|
}
|
|
391
472
|
|
|
392
|
-
declare type SoyioBaseRule = '.MainContainer' | '.Button' | '.Checkbox' | '.CheckboxInput' | '.CheckboxLabel' | '.Input' | '.Label' | '.HintIcon' | '.Title' | '.StepTitle' | '.Link' | '.Card' | '.CardTitle' | '.Select' | '.Loader' | '.TextArea' | '.ErrorMessage' | '.Description' | '.Switch' | '.SwitchRoot' | '.SwitchThumb' | '.SwitchIcon' | '.Alert' | '.AlertIcon' | '.AlertContent' | '.Radio' | '.RadioButton' | '.RadioIndicator' | '.RadioLabel' | '.Chip' | '.Dialog' | '.DialogOverlay' | '.DialogContent' | '.DialogTitle' | '.DialogDescription' | '.Combobox' | '.NinInput' | '.TrackingCodeInput' | '.TrackingCodeInputCell' | '.TrackingCodeInputSeparator' | '.RadioCard' | '.RadioCardButton' | '.RadioCardIndicator' | '.RadioCardTitle' | '.StepIndicatorContainer' | '.StepIndicator' | '.StepIndicatorLine' | '.StepIndicatorIcon' | '.StepIndicatorDot' | '.StepIndicatorNumber' | '.TooltipContent';
|
|
473
|
+
declare type SoyioBaseRule = '.MainContainer' | '.Button' | '.Checkbox' | '.CheckboxInput' | '.CheckboxLabel' | '.CheckboxCheck' | '.Input' | '.Label' | '.HintIcon' | '.Title' | '.CategoryTag' | '.StepTitle' | '.Link' | '.Card' | '.CardTitle' | '.Select' | '.Loader' | '.TextArea' | '.ErrorMessage' | '.Description' | '.Switch' | '.SwitchRoot' | '.SwitchThumb' | '.SwitchIcon' | '.Alert' | '.AlertIcon' | '.AlertContent' | '.Radio' | '.RadioButton' | '.RadioIndicator' | '.RadioLabel' | '.Chip' | '.Dialog' | '.DialogOverlay' | '.DialogContent' | '.DialogTitle' | '.DialogDescription' | '.Combobox' | '.NinInput' | '.TrackingCodeInput' | '.TrackingCodeInputCell' | '.TrackingCodeInputSeparator' | '.RadioCard' | '.RadioCardButton' | '.RadioCardIndicator' | '.RadioCardTitle' | '.StepIndicatorContainer' | '.StepIndicator' | '.StepIndicatorLine' | '.StepIndicatorIcon' | '.StepIndicatorDot' | '.StepIndicatorNumber' | '.TooltipContent';
|
|
393
474
|
|
|
394
475
|
declare type SoyioElementState = '--checked';
|
|
395
476
|
|
|
@@ -427,7 +508,7 @@ declare type SoyioRule = {
|
|
|
427
508
|
|
|
428
509
|
declare type SoyioRuleKey = `${SoyioBaseRule}${SoyioElementState | SoyioPseudoClass | SoyioPseudoElement | ''}` | SoyioStateRule;
|
|
429
510
|
|
|
430
|
-
declare type SoyioStateRule = '.Input--error' | '.Alert--error' | '.Alert--warning' | '.Alert--info' | '.Alert--success' | '.Chip--info' | '.Chip--green' | '.Chip--red' | '.Chip--amber' | '.RadioCard--checked' | '.RadioCardIndicator--checked' | '.StepIndicator--active' | '.StepIndicator--completed' | '.StepIndicator--pending' | '.StepIndicatorLine--top' | '.StepIndicatorLine--bottom';
|
|
511
|
+
declare type SoyioStateRule = '.Input--error' | '.Alert--error' | '.Alert--warning' | '.Alert--info' | '.Alert--note' | '.Alert--success' | '.Chip--info' | '.Chip--green' | '.Chip--red' | '.Chip--amber' | '.RadioCard--checked' | '.RadioCardIndicator--checked' | '.StepIndicator--active' | '.StepIndicator--completed' | '.StepIndicator--pending' | '.StepIndicatorLine--top' | '.StepIndicatorLine--bottom';
|
|
431
512
|
|
|
432
513
|
declare type SoyioTheme = 'soyio' | 'night' | 'flat';
|
|
433
514
|
|
|
@@ -447,7 +528,15 @@ declare namespace SoyioTypes {
|
|
|
447
528
|
DisclosureRequestConfig,
|
|
448
529
|
SignatureRequestConfig,
|
|
449
530
|
AuthRequestConfig,
|
|
450
|
-
RequestConfig
|
|
531
|
+
RequestConfig,
|
|
532
|
+
DisclosureRequestBoxPasskeyAuthenticatedEvent,
|
|
533
|
+
DisclosureRequestBoxPasskeyAuthenticationRequiredEvent,
|
|
534
|
+
DisclosureRequestBoxEvent,
|
|
535
|
+
DisclosureRequestBoxProps,
|
|
536
|
+
DisclosureRequestBoxPasskeyRegisteredEvent,
|
|
537
|
+
DisclosureRequestBoxPasskeyRequiredEvent,
|
|
538
|
+
DisclosureRequestBoxSizing,
|
|
539
|
+
DisclosureRequestBoxConfig
|
|
451
540
|
}
|
|
452
541
|
}
|
|
453
542
|
export { SoyioTypes }
|
|
@@ -461,10 +550,18 @@ declare namespace SoyioTypes_2 {
|
|
|
461
550
|
SignatureAttemptProps,
|
|
462
551
|
AuthRequestProps,
|
|
463
552
|
EventData,
|
|
553
|
+
DisclosureRequestBoxPasskeyRequiredEvent,
|
|
554
|
+
DisclosureRequestBoxPasskeyAuthenticationRequiredEvent,
|
|
555
|
+
DisclosureRequestBoxPasskeyRegisteredEvent,
|
|
556
|
+
DisclosureRequestBoxPasskeyAuthenticatedEvent,
|
|
557
|
+
DisclosureRequestBoxEvent,
|
|
464
558
|
DisclosureRequestConfig,
|
|
465
559
|
SignatureRequestConfig,
|
|
466
560
|
AuthRequestConfig,
|
|
467
|
-
RequestConfig
|
|
561
|
+
RequestConfig,
|
|
562
|
+
DisclosureRequestBoxProps,
|
|
563
|
+
DisclosureRequestBoxSizing,
|
|
564
|
+
DisclosureRequestBoxConfig
|
|
468
565
|
}
|
|
469
566
|
}
|
|
470
567
|
|