@soyio/soyio-widget 2.13.5 → 2.14.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
@@ -365,6 +365,70 @@ The `onEvent` follows the following format:
365
365
 
366
366
  We don't support hiding the mandatory consent, and we strongly recommend using `notice` so the user doesn't have to give the consent again and knows what they have already given consent to.
367
367
 
368
+ ## Privacy Center
369
+
370
+ The `PrivacyCenterBox` lets you embed the Privacy Center inside your page. You can scope which features to show and which data subjects are relevant to your interface. For more info check [our docs](https://docs.soyio.id/).
371
+
372
+ ```html
373
+ <!-- Add a container div where the Privacy Center will be mounted -->
374
+ <div id="privacy-center-box"></div>
375
+
376
+ <script>
377
+ import { PrivacyCenterBox } from "@soyio/soyio-widget";
378
+
379
+ // Configuration for the Privacy Center
380
+ const privacyCenterOptions = {
381
+ // Choose ONE of the following authentication modes:
382
+ // 1) Session token mode
383
+ // sessionToken: "<session token>",
384
+
385
+ // 2) Company/subject mode
386
+ companyId: "<company id>", // e.g. com_...
387
+ subjectId: "<subject id>", // Optional, e.g. ent_...
388
+
389
+ // Feature flags (optional)
390
+ enabledFeatures: ["DataSubjectRequest", "ConsentManagement"],
391
+
392
+ // Limit consent view to specific data subjects (optional)
393
+ dataSubjects: ["customer", "employee"],
394
+
395
+ // Common options
396
+ onEvent: (event) => console.log(event),
397
+ onReady: () => console.log("PrivacyCenterBox is ready"),
398
+ isSandbox: true, // Optional
399
+ appearance: {}, // Optional
400
+ };
401
+
402
+ // Wait for DOM to be fully loaded
403
+ document.addEventListener("DOMContentLoaded", () => {
404
+ const privacyCenter = new PrivacyCenterBox(privacyCenterOptions);
405
+ privacyCenter.mount("#privacy-center-box");
406
+ });
407
+ </script>
408
+ ```
409
+
410
+ ### Attribute Descriptions
411
+
412
+ - `sessionToken`: Use this to authenticate a session directly.
413
+ - `companyId`: The company identifier. Must start with `com_`. Use this when Privacy Center is mounted in a non authenticated environment.
414
+ - `subjectId`: Optional subject identifier. Must start with `ent_`.
415
+ - `enabledFeatures`: Optional array of features to show. Supported values: `"DataSubjectRequest"`, `"ConsentManagement"`.
416
+ - `dataSubjects`: Optional array of data subject categories. When present, the consent management view only shows consent for the specified categories. Supported values include: `"anonymous_user"`, `"citizen_voter"`, `"commuter"`, `"consultant"`, `"customer"`, `"employee"`, `"job_applicant"`, `"next_of_kin"`, `"passenger"`, `"patient"`, `"prospect"`, `"shareholder"`, `"supplier_vendor"`, `"trainee"`, `"visitor"`.
417
+ - `isSandbox`: Whether to use the sandbox environment. Defaults to `false`.
418
+ - `appearance`: Customize the iframe appearance. See Appearance section below.
419
+ - `onEvent`: Callback that receives events from the iframe.
420
+ - `onReady`: Optional callback fired when the iframe becomes ready.
421
+
422
+ Note:
423
+ - When `sessionToken` is provided, do not pass `companyId` or `subjectId`.
424
+
425
+ ### Privacy Center Events
426
+
427
+ - **`REQUEST_SUBMITTED`**: This event occurs when a user successfully submits a Data Subject Request. The event object includes:
428
+ - `eventName`: The name of the event, in this case, `'REQUEST_SUBMITTED'`.
429
+ - `subjectId`: The identifier for the user.
430
+ - `kind`: The kind of the Data Subject Request submitted. Supported values are: `access`, `opposition`, `rectification`, `suppression` and `portability`
431
+
368
432
  # Appearance
369
433
 
370
434
  Customize the look and feel of Soyio UI components by passing an `appearance` object to the configuration. The appearance object supports themes, CSS variables, and CSS rules for granular control over the styling.
package/dist/index.d.ts CHANGED
@@ -140,6 +140,8 @@ declare type CSSProperties = {
140
140
  width?: string;
141
141
  };
142
142
 
143
+ declare type DataSubject = 'anonymous_user' | 'citizen_voter' | 'commuter' | 'consultant' | 'customer' | 'employee' | 'job_applicant' | 'next_of_kin' | 'passenger' | 'patient' | 'prospect' | 'shareholder' | 'supplier_vendor' | 'trainee' | 'visitor';
144
+
143
145
  declare type DisclosureRequestConfig = {
144
146
  request: 'disclosure';
145
147
  configProps: DisclosureRequestProps;
@@ -217,6 +219,7 @@ declare type PrivacyCenterConfigWithoutSessionToken = BaseConfig & {
217
219
  enabledFeatures?: PrivacyManagerFeature[];
218
220
  companyId: `com_${string}`;
219
221
  subjectId?: `ent_${string}`;
222
+ dataSubjects?: DataSubject[];
220
223
  };
221
224
 
222
225
  declare type PrivacyCenterConfigWithSessionToken = BaseConfig & {
@@ -224,9 +227,10 @@ declare type PrivacyCenterConfigWithSessionToken = BaseConfig & {
224
227
  enabledFeatures?: PrivacyManagerFeature[];
225
228
  companyId?: never;
226
229
  subjectId?: never;
230
+ dataSubjects?: DataSubject[];
227
231
  };
228
232
 
229
- declare type PrivacyManagerFeature = 'DataSubjectRequest' | 'ConsentManagement';
233
+ declare type PrivacyManagerFeature = 'DataSubjectRequest' | 'ConsentManagement' | 'RequestTracking';
230
234
 
231
235
  declare type Request_2 = 'disclosure' | 'signature' | 'authentication';
232
236