@soyio/soyio-widget 3.6.0 → 3.7.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
@@ -333,9 +333,46 @@ Note:
333
333
 
334
334
  ### Privacy Center Events
335
335
 
336
- - **`REQUEST_SUBMITTED`**: This event occurs when a user successfully submits a Data Subject Request. The event object includes:
337
- - `eventName`: The name of the event, in this case, `'REQUEST_SUBMITTED'`.
338
- - `kind`: The kind of the Data Subject Request submitted. Supported values are: `access`, `opposition`, `rectification`, `suppression` and `portability`
336
+ Every event is delivered through the `onEvent` callback with an `eventName` discriminator. Import the `PrivacyCenterEvent` union type for type narrowing in TypeScript.
337
+
338
+ - **`REQUEST_SUBMITTED`**: A user successfully submits a Data Subject Request.
339
+ - `eventName`: `'REQUEST_SUBMITTED'`.
340
+ - `dataSubjectRequestId`: Identifier of the created request.
341
+ - `kind`: Uppercase request kind (e.g. `ACCESS`, `OPPOSITION`, `RECTIFICATION`, `SUPPRESSION`, `PORTABILITY`, `REDEC_*`).
342
+ - `entityId`: Entity identifier if available, otherwise `null`.
343
+ - **`REQUEST_SUBMISSION_FAILED`**: The request submission fails.
344
+ - `eventName`: `'REQUEST_SUBMISSION_FAILED'`.
345
+ - `kind`: Uppercase request kind.
346
+ - `errorCode` (optional): HTTP status as string when available.
347
+ - `errorMessage` (optional): Error message from the underlying exception.
348
+ - **`VALIDATION_SUCCESSFUL`**: Identity validation linked to a request completes successfully.
349
+ - `eventName`: `'VALIDATION_SUCCESSFUL'`.
350
+ - `dataSubjectRequestId`: Identifier of the related request.
351
+ - **`VALIDATION_FAILED`**: Identity validation fails.
352
+ - `eventName`: `'VALIDATION_FAILED'`.
353
+ - `dataSubjectRequestId`: Identifier of the related request.
354
+ - `errorReason` (optional): Reason returned by the validator.
355
+ - **`CONSENT_UPDATED`**: A user grants or revokes a consent successfully.
356
+ - `eventName`: `'CONSENT_UPDATED'`.
357
+ - `consentTemplateId`: Identifier of the affected consent template.
358
+ - `action`: `'grant'` or `'revoke'`.
359
+ - `actionToken` (optional): Token of the resulting consent action.
360
+ - **`CONSENT_UPDATE_FAILED`**: A consent update fails.
361
+ - `eventName`: `'CONSENT_UPDATE_FAILED'`.
362
+ - `consentTemplateId`: Identifier of the affected template.
363
+ - `action`: `'grant'` or `'revoke'`.
364
+ - `errorCode` (optional): Error code from the request.
365
+ - **`CONSENT_BATCH_UPDATED`**: The user saves a batch of pending consent changes successfully. Only emitted when the Privacy Center runs in `consentMode: 'batch'`. Fired once with all the changes, not one event per consent.
366
+ - `eventName`: `'CONSENT_BATCH_UPDATED'`.
367
+ - `updates`: Array of `{ consentTemplateId, action: 'grant' | 'revoke', actionToken? }`.
368
+ - **`CONSENT_BATCH_UPDATE_FAILED`**: The batch save fails. Only emitted in `consentMode: 'batch'`.
369
+ - `eventName`: `'CONSENT_BATCH_UPDATE_FAILED'`.
370
+ - `consentTemplateIds`: Identifiers of the templates included in the failed batch.
371
+ - `errorCode` (optional): Error code from the request.
372
+ - **`UNEXPECTED_ERROR`**: An uncategorized error occurs inside the flow.
373
+ - `eventName`: `'UNEXPECTED_ERROR'`.
374
+ - `context`: Short identifier of where the error happened.
375
+ - `errorMessage` (optional): Error message from the underlying exception.
339
376
 
340
377
  ## Consent Form Box
341
378
 
package/dist/index.d.ts CHANGED
@@ -58,6 +58,23 @@ declare const CLOSED_EVENT = "WIDGET_CLOSED";
58
58
 
59
59
  export { configSchema }
60
60
 
61
+ declare type ConsentBatchUpdate = {
62
+ consentTemplateId: string;
63
+ action: PrivacyCenterConsentAction;
64
+ actionToken?: string;
65
+ };
66
+
67
+ declare type ConsentBatchUpdatedEvent = {
68
+ eventName: 'CONSENT_BATCH_UPDATED';
69
+ updates: ConsentBatchUpdate[];
70
+ };
71
+
72
+ declare type ConsentBatchUpdateFailedEvent = {
73
+ eventName: 'CONSENT_BATCH_UPDATE_FAILED';
74
+ consentTemplateIds: string[];
75
+ errorCode?: string;
76
+ };
77
+
61
78
  export declare class ConsentBox extends BaseIframeBox<Record<string, unknown>, ConsentConfig> {
62
79
  readonly defaultIframePrefix = "consent-box";
63
80
  readonly defaultIframeCSSConfig: IframeCSSConfig;
@@ -151,6 +168,20 @@ declare type ConsentState = {
151
168
  actionToken: string | null;
152
169
  };
153
170
 
171
+ declare type ConsentUpdatedEvent = {
172
+ eventName: 'CONSENT_UPDATED';
173
+ consentTemplateId: string;
174
+ action: PrivacyCenterConsentAction;
175
+ actionToken?: string;
176
+ };
177
+
178
+ declare type ConsentUpdateFailedEvent = {
179
+ eventName: 'CONSENT_UPDATE_FAILED';
180
+ consentTemplateId: string;
181
+ action: PrivacyCenterConsentAction;
182
+ errorCode?: string;
183
+ };
184
+
154
185
  declare type CSSProperties = {
155
186
  appearance?: string;
156
187
  accentColor?: string;
@@ -371,7 +402,7 @@ declare type NewDisclosureRequestProps = {
371
402
  customColor?: string;
372
403
  };
373
404
 
374
- export declare class PrivacyCenterBox extends BaseIframeBox<Record<string, unknown>, PrivacyCenterConfig> {
405
+ export declare class PrivacyCenterBox extends BaseIframeBox<PrivacyCenterEvent, PrivacyCenterConfig> {
375
406
  readonly defaultIframePrefix = "privacy-center";
376
407
  protected readonly _uniqueIdentifier = "privacy-center";
377
408
  readonly defaultIframeCSSConfig: IframeCSSConfig;
@@ -380,7 +411,7 @@ export declare class PrivacyCenterBox extends BaseIframeBox<Record<string, unkno
380
411
  iframeUrl(): string;
381
412
  }
382
413
 
383
- declare type PrivacyCenterConfig = BaseConfig & {
414
+ declare type PrivacyCenterConfig = BaseConfig<PrivacyCenterEvent> & {
384
415
  enabledFeatures?: PrivacyManagerFeature[];
385
416
  enabledRights?: PrivacyCenterRight[];
386
417
  enabledKinds?: DataSubjectRequestKind[];
@@ -393,6 +424,7 @@ declare type PrivacyCenterConfig = BaseConfig & {
393
424
  allowedExtensions?: string[];
394
425
  maxFileSize?: number;
395
426
  };
427
+ rectificationFileRequiredCategories?: UserDataCategoryKey[];
396
428
  consentMode?: 'immediate' | 'batch';
397
429
  consentRetentionPeriod?: string;
398
430
  allowGranularScopeSelection?: boolean;
@@ -415,6 +447,8 @@ declare type PrivacyCenterConfig = BaseConfig & {
415
447
  companyId?: never;
416
448
  });
417
449
 
450
+ declare type PrivacyCenterConsentAction = 'grant' | 'revoke';
451
+
418
452
  declare type PrivacyCenterConsentManagementConfig = {
419
453
  scopeGroups?: [
420
454
  PrivacyCenterConsentManagementScopeGroupConfig,
@@ -438,6 +472,8 @@ declare type PrivacyCenterContentConfig = {
438
472
  rightExamples?: Partial<Record<DataSubjectRequestKind, string>>;
439
473
  };
440
474
 
475
+ declare type PrivacyCenterEvent = RequestSubmittedEvent | RequestSubmissionFailedEvent | ValidationSuccessfulEvent | ValidationFailedEvent | ConsentUpdatedEvent | ConsentUpdateFailedEvent | ConsentBatchUpdatedEvent | ConsentBatchUpdateFailedEvent | UnexpectedErrorEvent;
476
+
441
477
  declare type PrivacyCenterHeaderCopyConfig = {
442
478
  title?: string;
443
479
  description?: string;
@@ -467,6 +503,20 @@ declare type Request_2 = 'disclosure' | 'signature' | 'authentication';
467
503
 
468
504
  declare type RequestConfig = DisclosureRequestConfig | SignatureRequestConfig | AuthRequestConfig;
469
505
 
506
+ declare type RequestSubmissionFailedEvent = {
507
+ eventName: 'REQUEST_SUBMISSION_FAILED';
508
+ kind: Uppercase<DataSubjectRequestKind>;
509
+ errorCode?: string;
510
+ errorMessage?: string;
511
+ };
512
+
513
+ declare type RequestSubmittedEvent = {
514
+ eventName: 'REQUEST_SUBMITTED';
515
+ dataSubjectRequestId: string;
516
+ kind: Uppercase<DataSubjectRequestKind>;
517
+ entityId: string | null;
518
+ };
519
+
470
520
  declare type SignatureAttemptProps = {
471
521
  signatureAttemptId: `sa_${string}`;
472
522
  customColor?: string;
@@ -661,6 +711,18 @@ declare namespace SoyioTypes {
661
711
  ConsentEvent,
662
712
  ConsentConfig,
663
713
  PrivacyCenterConfig,
714
+ PrivacyCenterEvent,
715
+ PrivacyCenterConsentAction,
716
+ RequestSubmittedEvent,
717
+ RequestSubmissionFailedEvent,
718
+ ValidationSuccessfulEvent,
719
+ ValidationFailedEvent,
720
+ ConsentUpdatedEvent,
721
+ ConsentUpdateFailedEvent,
722
+ ConsentBatchUpdate,
723
+ ConsentBatchUpdatedEvent,
724
+ ConsentBatchUpdateFailedEvent,
725
+ UnexpectedErrorEvent,
664
726
  ConsentFormConfig,
665
727
  ConsentFormEvent,
666
728
  ConsentFormLocale,
@@ -745,8 +807,25 @@ export declare class _TooltipManager {
745
807
  destroy(): void;
746
808
  }
747
809
 
810
+ declare type UnexpectedErrorEvent = {
811
+ eventName: 'UNEXPECTED_ERROR';
812
+ context: string;
813
+ errorMessage?: string;
814
+ };
815
+
748
816
  declare const USER_DATA_CATEGORY_KEYS: readonly ["user", "user.account", "user.authorization", "user.behavior", "user.biometric", "user.childrens", "user.contact", "user.content", "user.demographic", "user.location", "user.device", "user.payment", "user.social", "user.unique_id", "user.telemetry", "user.user_sensor", "user.workplace", "user.sensor", "user.financial", "user.government_id", "user.health_and_medical", "user.name", "user.criminal_history", "user.privacy_preferences", "user.job_title", "user.account.settings", "user.account.username", "user.authorization.credentials", "user.authorization.biometric", "user.authorization.password", "user.behavior.browsing_history", "user.behavior.media_consumption", "user.behavior.purchase_history", "user.behavior.search_history", "user.biometric.fingerprint", "user.biometric.retinal", "user.biometric.voice", "user.biometric.health", "user.contact.address", "user.contact.email", "user.contact.phone_number", "user.contact.url", "user.contact.fax_number", "user.contact.organization", "user.contact.address.city", "user.contact.address.country", "user.contact.address.postal_code", "user.contact.address.state", "user.contact.address.street", "user.content.private", "user.content.public", "user.content.self_image", "user.demographic.age_range", "user.demographic.date_of_birth", "user.demographic.gender", "user.demographic.language", "user.demographic.marital_status", "user.demographic.political_opinion", "user.demographic.profile", "user.demographic.race_ethnicity", "user.demographic.religious_belief", "user.demographic.sexual_orientation", "user.demographic.nationality", "user.device.cookie", "user.device.cookie_id", "user.device.device_id", "user.device.ip_address", "user.financial.bank_account", "user.financial.credit_card", "user.government_id.birth_certificate", "user.government_id.drivers_license_number", "user.government_id.immigration", "user.government_id.national_identification_number", "user.government_id.passport_number", "user.government_id.vehicle_registration", "user.health_and_medical.genetic", "user.health_and_medical.insurance_beneficiary_id", "user.health_and_medical.record_id", "user.labor_activity", "user.labor_activity.profession", "user.labor_activity.job_title", "user.labor_activity.worker_type", "user.labor_activity.salary", "user.labor_activity.workplace", "user.location.imprecise", "user.location.precise", "user.name.first", "user.name.last", "user.unique_id.pseudonymous"];
749
817
 
750
818
  declare type UserDataCategoryKey = (typeof USER_DATA_CATEGORY_KEYS)[number];
751
819
 
820
+ declare type ValidationFailedEvent = {
821
+ eventName: 'VALIDATION_FAILED';
822
+ dataSubjectRequestId: string;
823
+ errorReason?: string;
824
+ };
825
+
826
+ declare type ValidationSuccessfulEvent = {
827
+ eventName: 'VALIDATION_SUCCESSFUL';
828
+ dataSubjectRequestId: string;
829
+ };
830
+
752
831
  export { }