@soyio/soyio-widget 2.21.0 → 2.22.1

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
@@ -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)
@@ -366,6 +367,41 @@ The `onEvent` callback is designed to handle various events that occur during wi
366
367
  - **`onEvent`**: A callback function triggered upon event occurrences, used for capturing and logging event-related data.
367
368
  - **`customColor`**: A hex code string that specifies the base color of the interface.
368
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
+
369
405
  ## Signature Attempt
370
406
 
371
407
  > 📖 [Integration Guide](https://docs.soyio.id/docs/integration-guide/signature/introduction)
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: Record<string, unknown>) => void;
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;
@@ -462,7 +528,15 @@ declare namespace SoyioTypes {
462
528
  DisclosureRequestConfig,
463
529
  SignatureRequestConfig,
464
530
  AuthRequestConfig,
465
- RequestConfig
531
+ RequestConfig,
532
+ DisclosureRequestBoxPasskeyAuthenticatedEvent,
533
+ DisclosureRequestBoxPasskeyAuthenticationRequiredEvent,
534
+ DisclosureRequestBoxEvent,
535
+ DisclosureRequestBoxProps,
536
+ DisclosureRequestBoxPasskeyRegisteredEvent,
537
+ DisclosureRequestBoxPasskeyRequiredEvent,
538
+ DisclosureRequestBoxSizing,
539
+ DisclosureRequestBoxConfig
466
540
  }
467
541
  }
468
542
  export { SoyioTypes }
@@ -476,10 +550,18 @@ declare namespace SoyioTypes_2 {
476
550
  SignatureAttemptProps,
477
551
  AuthRequestProps,
478
552
  EventData,
553
+ DisclosureRequestBoxPasskeyRequiredEvent,
554
+ DisclosureRequestBoxPasskeyAuthenticationRequiredEvent,
555
+ DisclosureRequestBoxPasskeyRegisteredEvent,
556
+ DisclosureRequestBoxPasskeyAuthenticatedEvent,
557
+ DisclosureRequestBoxEvent,
479
558
  DisclosureRequestConfig,
480
559
  SignatureRequestConfig,
481
560
  AuthRequestConfig,
482
- RequestConfig
561
+ RequestConfig,
562
+ DisclosureRequestBoxProps,
563
+ DisclosureRequestBoxSizing,
564
+ DisclosureRequestBoxConfig
483
565
  }
484
566
  }
485
567