@soyio/soyio-widget 2.25.3 → 3.0.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
@@ -129,7 +129,7 @@ The `onEvent` follows the following format:
129
129
  - **`appearance`**: Customize the appearance of the iframe. [Learn more](https://docs.soyio.id/docs/integration-guide/modules/consent).
130
130
  - **`actionToken`**: In case of losing the state of the consent (i.e. page reload), you can use a previously generated `actionToken` to restore the state of the consent.
131
131
  - **`entityId`**: Identifier of the `entity` associated with a `ConsentAction`. If provided and a consent was previously granted by this entity, the UI will display a message indicating that consent has already been given.
132
- - **`context`**: Additional information that will be saved with the consent. Useful when you want to track the consent from a specific context.
132
+ - **`origin`**: Additional information that will be saved with the consent. Useful when you want to track the consent from a specific origin.
133
133
  - **`onReady`**: Optional callback that executes when the consent box is ready to use. You can use this to handle logic when the iframe is not mounted yet.
134
134
  - **`optionalReconsentBehavior`**: What should happen when the consent is initialized with an `entityId` that has already given consent on an optional category.
135
135
  - `notice` will show a message letting the user know that they have already given consent,
@@ -595,19 +595,31 @@ Built-in themes provide pre-configured color palettes and component styles:
595
595
  | Theme | Description |
596
596
  | ----- | ----------- |
597
597
  | `"soyio"` | Default light theme with Soyio brand colors (purple/indigo), uppercase titles |
598
- | `"night"` | Dark mode theme with deep blues, muted colors, and subtle borders |
599
598
  | `"flat"` | Minimal theme with square corners, normal-case titles, thicker borders |
599
+ | `"neutral"` | Neutral palette that works well for both light and dark modes |
600
+ | `"night"` | Deprecated alias for `theme: "soyio"` with `mode: "dark"` |
600
601
 
601
602
  **Theme style differences:**
602
603
 
603
604
  - **soyio**: Standard styling with rounded corners and uppercase card titles
604
- - **night**: Dark backgrounds, lighter text, borders using theme variables
605
605
  - **flat**: No border radius, sentence-case titles (no uppercase), 2px borders, lighter font weights
606
+ - **neutral**: Balanced grayscale palette intended for a more subdued branded experience
607
+
608
+ ### Color Modes
609
+
610
+ Appearance now supports a `mode` field:
611
+
612
+ | Mode | Description |
613
+ | ---- | ----------- |
614
+ | `"light"` | Forces light mode |
615
+ | `"dark"` | Forces dark mode |
616
+ | `"auto"` | Follows the user's system color scheme |
606
617
 
607
618
  **Example:**
608
619
  ```javascript
609
620
  const appearance = {
610
- theme: "night", // Use the dark theme
621
+ theme: "soyio",
622
+ mode: "dark",
611
623
  variables: {
612
624
  // You can still override specific variables
613
625
  colorPrimary: "#FF6B6B",
@@ -621,6 +633,8 @@ const appearance = {
621
633
 
622
634
  Theme variables and rules are applied first, then your custom overrides take precedence.
623
635
 
636
+ > `theme: "night"` is still accepted as a deprecated alias for backwards compatibility, but new integrations should use `theme + mode`.
637
+
624
638
  ### Config
625
639
 
626
640
  The `config` object allows you to adjust component behavior settings.
@@ -1055,7 +1069,8 @@ const ajv = new Ajv();
1055
1069
  const validate = ajv.compile(appearanceSchema);
1056
1070
 
1057
1071
  const appearance = {
1058
- theme: "night",
1072
+ theme: "soyio",
1073
+ mode: "dark",
1059
1074
  variables: {
1060
1075
  colorPrimary: "#007bff",
1061
1076
  borderRadius: "8px"
package/dist/index.d.ts CHANGED
@@ -81,6 +81,8 @@ declare type ConsentConfig = BaseConfig & {
81
81
  consentTemplateId: `constpl_${string}`;
82
82
  actionToken?: string;
83
83
  entityId?: `ent_${string}`;
84
+ origin?: string;
85
+ /** @deprecated Use `origin` instead. */
84
86
  context?: string;
85
87
  optionalReconsentBehavior?: 'notice' | 'askAgain' | 'hide';
86
88
  mandatoryReconsentBehavior?: 'notice' | 'askAgain';
@@ -410,10 +412,11 @@ declare type SignatureRequestConfig = {
410
412
  developmentUrl?: string;
411
413
  };
412
414
 
413
- declare type SkeletonConstructor = new (id: string, theme?: SoyioTheme) => ISkeletonView;
415
+ declare type SkeletonConstructor = new (id: string, appearance?: SoyioAppearance) => ISkeletonView;
414
416
 
415
417
  declare interface SoyioAppearance {
416
418
  theme?: SoyioTheme;
419
+ mode?: SoyioColorMode;
417
420
  variables?: SoyioAppearanceVariables;
418
421
  rules?: SoyioRule;
419
422
  config?: SoyioAppearanceConfig;
@@ -516,6 +519,15 @@ declare interface SoyioAppearanceVariables {
516
519
 
517
520
  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';
518
521
 
522
+ /**
523
+ * Appearance color mode.
524
+ *
525
+ * - `light`: force light mode
526
+ * - `dark`: force dark mode
527
+ * - `auto`: follow the consumer's system color scheme
528
+ */
529
+ declare type SoyioColorMode = 'light' | 'dark' | 'auto';
530
+
519
531
  declare type SoyioElementState = '--checked';
520
532
 
521
533
  declare interface SoyioIconConfig {
@@ -554,7 +566,12 @@ declare type SoyioRuleKey = `${SoyioBaseRule}${SoyioElementState | SoyioPseudoCl
554
566
 
555
567
  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';
556
568
 
557
- declare type SoyioTheme = 'soyio' | 'night' | 'flat';
569
+ /**
570
+ * Appearance theme palette.
571
+ *
572
+ * `night` is kept as a deprecated alias for `theme: 'soyio'` + `mode: 'dark'`.
573
+ */
574
+ declare type SoyioTheme = 'soyio' | 'flat' | 'neutral' | 'night';
558
575
 
559
576
  declare namespace SoyioTypes {
560
577
  export {
@@ -562,6 +579,10 @@ declare namespace SoyioTypes {
562
579
  ConsentConfig,
563
580
  PrivacyCenterConfig,
564
581
  SoyioAppearance,
582
+ SoyioAppearanceConfig,
583
+ SoyioAppearanceVariables,
584
+ SoyioColorMode,
585
+ SoyioTheme,
565
586
  Request_2 as Request,
566
587
  NewDisclosureRequestProps,
567
588
  ExistingDisclosureRequestProps,