dexie-cloud-addon 4.3.0 → 4.3.3

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.
@@ -1,7 +1,29 @@
1
- import { OAuthProviderInfo } from 'dexie-cloud-common';
2
1
  import { DXCAlert } from './DXCAlert';
3
2
  import { DXCInputField } from './DXCInputField';
4
- export type DXCUserInteraction = DXCGenericUserInteraction | DXCEmailPrompt | DXCOTPPrompt | DXCMessageAlert | DXCLogoutConfirmation | DXCProviderSelection;
3
+ export type DXCUserInteraction = DXCGenericUserInteraction | DXCEmailPrompt | DXCOTPPrompt | DXCMessageAlert | DXCLogoutConfirmation;
4
+ /** A selectable option that can appear in any user interaction.
5
+ *
6
+ * Similar to an HTML `<option>` element:
7
+ * - `name` identifies the field name in the result (like input name attribute)
8
+ * - `value` is the value to return when selected (like option value attribute)
9
+ * - `displayName` is the human-readable label
10
+ *
11
+ * When an option is selected, call `onSubmit({ [option.name]: option.value })`.
12
+ */
13
+ export interface DXCOption {
14
+ /** Field name for the result (like HTML input name attribute) */
15
+ name: string;
16
+ /** Value to return when selected (like HTML option value attribute) */
17
+ value: string;
18
+ /** Human-readable display label */
19
+ displayName: string;
20
+ /** URL to an icon image (mutually exclusive with iconSvg) */
21
+ iconUrl?: string;
22
+ /** Inline SVG markup for the icon (mutually exclusive with iconUrl) */
23
+ iconSvg?: string;
24
+ /** Optional style hint for the UI (e.g., 'google', 'github', 'microsoft', 'apple', 'otp') */
25
+ styleHint?: string;
26
+ }
5
27
  export interface DXCGenericUserInteraction<Type extends string = "generic", TFields extends {
6
28
  [name: string]: DXCInputField;
7
29
  } = any> {
@@ -9,6 +31,10 @@ export interface DXCGenericUserInteraction<Type extends string = "generic", TFie
9
31
  title: string;
10
32
  alerts: DXCAlert[];
11
33
  fields: TFields;
34
+ /** Optional selectable options. When present, render as clickable buttons.
35
+ * When user clicks an option, call `onSubmit({ [option.name]: option.value })`.
36
+ */
37
+ options?: DXCOption[];
12
38
  submitLabel: string;
13
39
  cancelLabel: string | null;
14
40
  onSubmit: (params: {
@@ -18,7 +44,9 @@ export interface DXCGenericUserInteraction<Type extends string = "generic", TFie
18
44
  }
19
45
  /** When the system needs to prompt for an email address for login.
20
46
  *
21
- */
47
+ * May include `options` when social login providers are available.
48
+ * Options should be rendered as clickable buttons above the email field.
49
+ */
22
50
  export interface DXCEmailPrompt {
23
51
  type: 'email';
24
52
  title: string;
@@ -29,6 +57,8 @@ export interface DXCEmailPrompt {
29
57
  placeholder: string;
30
58
  };
31
59
  };
60
+ /** Optional OAuth provider options. Render as clickable buttons. */
61
+ options?: DXCOption[];
32
62
  submitLabel: string;
33
63
  cancelLabel: string;
34
64
  onSubmit: (params: {
@@ -92,25 +122,3 @@ export interface DXCLogoutConfirmation {
92
122
  }) => void;
93
123
  onCancel: () => void;
94
124
  }
95
- /** When the system needs user to select a login method (OAuth provider or OTP).
96
- * Emitted when the server has OAuth providers configured and enabled.
97
- */
98
- export interface DXCProviderSelection {
99
- type: 'provider-selection';
100
- title: string;
101
- alerts: DXCAlert[];
102
- /** Available OAuth providers */
103
- providers: OAuthProviderInfo[];
104
- /** Whether email/OTP option is available */
105
- otpEnabled: boolean;
106
- /** Empty - no text fields for this interaction type */
107
- fields: {};
108
- /** No submit button - provider buttons instead */
109
- submitLabel?: undefined;
110
- cancelLabel: string;
111
- /** Called when user selects an OAuth provider */
112
- onSelectProvider: (providerName: string) => void;
113
- /** Called when user chooses email/OTP instead */
114
- onSelectOtp: () => void;
115
- onCancel: () => void;
116
- }