@timeax/digital-service-engine 0.3.4 → 0.3.5

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,5 +1,5 @@
1
- import * as react_jsx_runtime from 'react/jsx-runtime';
2
1
  import React, { ReactNode } from 'react';
2
+ import * as react_jsx_runtime from 'react/jsx-runtime';
3
3
 
4
4
  type EventMap = Record<string, unknown>;
5
5
  declare class EventBus<E extends EventMap> {
@@ -1511,6 +1511,62 @@ type QuantityRule = {
1511
1511
  fallback?: number;
1512
1512
  };
1513
1513
 
1514
+ /** Matches your InputWrapper’s expectations */
1515
+ type InputKind = string;
1516
+ type InputVariant = "default" | (string & {});
1517
+ type AdapterCtx = {
1518
+ field: Field;
1519
+ props: ServiceProps;
1520
+ };
1521
+ type Adapter = {
1522
+ valueProp?: string;
1523
+ changeProp?: string;
1524
+ errorProp?: string;
1525
+ /** normalize what the host emitted into what we store in form-palette */
1526
+ getValue?: (next: unknown, current: unknown, ctx: AdapterCtx) => unknown;
1527
+ /** REQUIRED if field.options exists */
1528
+ getSelectedOptions?: (next: unknown, current: unknown, ctx: AdapterCtx) => string[];
1529
+ /** For option-less action buttons (button: true with no options) */
1530
+ isActive?: (stored: unknown, ctx: AdapterCtx) => boolean;
1531
+ getInputPropsFromField?: (props: AdapterCtx) => any;
1532
+ toValue?: (value: any) => any;
1533
+ };
1534
+ type InputOptionCapability = {
1535
+ supported?: boolean;
1536
+ autoCreate?: boolean;
1537
+ defaultLabel?: string;
1538
+ defaultValue?: string | number;
1539
+ };
1540
+ type InputMultiCapability = {
1541
+ supported?: boolean;
1542
+ autoEnable?: boolean;
1543
+ };
1544
+ type InputDescriptor = {
1545
+ Component: React.ComponentType<Record<string, unknown>>;
1546
+ adapter?: Adapter;
1547
+ defaultProps?: Record<string, unknown>;
1548
+ ui?: Record<string, Ui>;
1549
+ options?: InputOptionCapability;
1550
+ multi?: InputMultiCapability;
1551
+ };
1552
+ type VariantMap = Map<InputVariant, InputDescriptor>;
1553
+ type RegistryStore = Map<InputKind, VariantMap>;
1554
+ type Registry = {
1555
+ get(kind: InputKind, variant?: InputVariant): InputDescriptor | undefined;
1556
+ register(kind: InputKind, descriptor: InputDescriptor, variant?: InputVariant): void;
1557
+ unregister(kind: InputKind, variant?: InputVariant): void;
1558
+ registerMany(entries: Array<{
1559
+ kind: InputKind;
1560
+ descriptor: InputDescriptor;
1561
+ variant?: InputVariant;
1562
+ }>): void;
1563
+ /** low-level escape hatch */
1564
+ _store: RegistryStore;
1565
+ };
1566
+ declare function createInputRegistry(): Registry;
1567
+ /** Helper used by InputWrapper */
1568
+ declare function resolveInputDescriptor(registry: Registry, kind: InputKind, variant?: InputVariant): InputDescriptor | undefined;
1569
+
1514
1570
  declare class Editor {
1515
1571
  private readonly builder;
1516
1572
  private readonly api;
@@ -1582,7 +1638,14 @@ declare class Editor {
1582
1638
  id?: string;
1583
1639
  label: string;
1584
1640
  type: Field["type"];
1585
- }): void;
1641
+ }): string;
1642
+ addFieldFromDescriptor(registry: Registry, partial: Omit<Field, "id" | "label" | "type"> & {
1643
+ id?: string;
1644
+ label: string;
1645
+ type: Field["type"];
1646
+ }, opts?: {
1647
+ variant?: InputVariant;
1648
+ }): string;
1586
1649
  updateField(id: string, patch: Partial<Field>): void;
1587
1650
  removeField(id: string): void;
1588
1651
  remove(id: string): void;
@@ -1601,6 +1664,7 @@ declare class Editor {
1601
1664
  setPricingRoleMany(ids: readonly string[], role: "base" | "utility"): void;
1602
1665
  clearFieldDefaultsMany(ids: readonly string[]): void;
1603
1666
  clearFieldValidationMany(ids: readonly string[]): void;
1667
+ setFieldMulti(fieldId: string, enabled: boolean): void;
1604
1668
  autoCreateOptionsMany(ids: readonly string[], makeOption?: (fieldId: string) => {
1605
1669
  id?: string;
1606
1670
  label: string;
@@ -1825,57 +1889,6 @@ type FormProviderProps = {
1825
1889
  };
1826
1890
  declare function FormProvider({ children, schema, initial }: FormProviderProps): react_jsx_runtime.JSX.Element;
1827
1891
 
1828
- /** Matches your InputWrapper’s expectations */
1829
- type InputKind = string;
1830
- type InputVariant = "default" | (string & {});
1831
- type AdapterCtx = {
1832
- field: Field;
1833
- props: ServiceProps;
1834
- };
1835
- type Adapter = {
1836
- valueProp?: string;
1837
- changeProp?: string;
1838
- errorProp?: string;
1839
- /** normalize what the host emitted into what we store in form-palette */
1840
- getValue?: (next: unknown, current: unknown, ctx: AdapterCtx) => unknown;
1841
- /** REQUIRED if field.options exists */
1842
- getSelectedOptions?: (next: unknown, current: unknown, ctx: AdapterCtx) => string[];
1843
- /** For option-less action buttons (button: true with no options) */
1844
- isActive?: (stored: unknown, ctx: AdapterCtx) => boolean;
1845
- getInputPropsFromField?: (props: AdapterCtx) => any;
1846
- toValue?: (value: any) => any;
1847
- };
1848
- type InputOptionCapability = {
1849
- supported?: boolean;
1850
- autoCreate?: boolean;
1851
- defaultLabel?: string;
1852
- defaultValue?: string | number;
1853
- };
1854
- type InputDescriptor = {
1855
- Component: React.ComponentType<Record<string, unknown>>;
1856
- adapter?: Adapter;
1857
- defaultProps?: Record<string, unknown>;
1858
- ui?: Record<string, Ui>;
1859
- options?: InputOptionCapability;
1860
- };
1861
- type VariantMap = Map<InputVariant, InputDescriptor>;
1862
- type RegistryStore = Map<InputKind, VariantMap>;
1863
- type Registry = {
1864
- get(kind: InputKind, variant?: InputVariant): InputDescriptor | undefined;
1865
- register(kind: InputKind, descriptor: InputDescriptor, variant?: InputVariant): void;
1866
- unregister(kind: InputKind, variant?: InputVariant): void;
1867
- registerMany(entries: Array<{
1868
- kind: InputKind;
1869
- descriptor: InputDescriptor;
1870
- variant?: InputVariant;
1871
- }>): void;
1872
- /** low-level escape hatch */
1873
- _store: RegistryStore;
1874
- };
1875
- declare function createInputRegistry(): Registry;
1876
- /** Helper used by InputWrapper */
1877
- declare function resolveInputDescriptor(registry: Registry, kind: InputKind, variant?: InputVariant): InputDescriptor | undefined;
1878
-
1879
1892
  type InputsCtxValue = {
1880
1893
  registry: Registry;
1881
1894
  register: (kind: InputKind, descriptor: InputDescriptor, variant?: InputVariant) => void;
@@ -2045,6 +2058,7 @@ type UseOrderFlowReturn = {
2045
2058
  max: number;
2046
2059
  selectTag: (tagId: string) => void;
2047
2060
  toggleOption: (fieldId: string, optionId?: string) => void;
2061
+ setFieldOptions: (fieldId: string, optionIds: string[]) => void;
2048
2062
  /** programmatic value set (rare; wrapper/field hook should handle most) */
2049
2063
  setValue: (fieldId: string, value: Scalar | Scalar[]) => void;
2050
2064
  clearField: (fieldId: string) => void;
@@ -2283,4 +2297,4 @@ type Props = {
2283
2297
  };
2284
2298
  declare function FallbackAddRegistrationDialog({ open, onClose, onSelect, }: Props): react_jsx_runtime.JSX.Element | null;
2285
2299
 
2286
- export { type Adapter, type AdapterCtx, CanvasAPI, type EditorSettings, EventBus, type EventMap, FallbackAddCandidatesDialog, FallbackAddRegistrationDialog, FallbackDetailsPanel, FallbackEditor, type FallbackEditorData, FallbackEditorHeader, FallbackEditorProvider, type FallbackEditorProviderProps, FallbackRegistrationsPanel, FallbackServiceSidebar, FallbackSettingsPanel, type FormApi, FormProvider, type FormProviderProps, type FormSnapshot, type InputDescriptor, type InputKind, type InputOptionCapability, type InputVariant, type InputWrapperProps, OrderFlowProvider, Provider, type RegistrationItem, type RegistrationScope, type Registry, type ServiceSummary, type ValidationMessage, type ValidationTone, VirtualServiceList, Wrapper, createInputRegistry, registerEntries, resolveInputDescriptor, useActiveFallbackRegistrations, useEligibleServiceList, useFallbackEditor, useFallbackEditorContext, useFormApi, useInputs, useInputsMaybe, useOptionalFormApi, useOrderFlow, useOrderFlowContext, usePrimaryServiceList };
2300
+ export { type Adapter, type AdapterCtx, CanvasAPI, type EditorSettings, EventBus, type EventMap, FallbackAddCandidatesDialog, FallbackAddRegistrationDialog, FallbackDetailsPanel, FallbackEditor, type FallbackEditorData, FallbackEditorHeader, FallbackEditorProvider, type FallbackEditorProviderProps, FallbackRegistrationsPanel, FallbackServiceSidebar, FallbackSettingsPanel, type FormApi, FormProvider, type FormProviderProps, type FormSnapshot, type InputDescriptor, type InputKind, type InputMultiCapability, type InputOptionCapability, type InputVariant, type InputWrapperProps, OrderFlowProvider, Provider, type RegistrationItem, type RegistrationScope, type Registry, type ServiceSummary, type ValidationMessage, type ValidationTone, VirtualServiceList, Wrapper, createInputRegistry, registerEntries, resolveInputDescriptor, useActiveFallbackRegistrations, useEligibleServiceList, useFallbackEditor, useFallbackEditorContext, useFormApi, useInputs, useInputsMaybe, useOptionalFormApi, useOrderFlow, useOrderFlowContext, usePrimaryServiceList };
@@ -1,5 +1,5 @@
1
- import * as react_jsx_runtime from 'react/jsx-runtime';
2
1
  import React, { ReactNode } from 'react';
2
+ import * as react_jsx_runtime from 'react/jsx-runtime';
3
3
 
4
4
  type EventMap = Record<string, unknown>;
5
5
  declare class EventBus<E extends EventMap> {
@@ -1511,6 +1511,62 @@ type QuantityRule = {
1511
1511
  fallback?: number;
1512
1512
  };
1513
1513
 
1514
+ /** Matches your InputWrapper’s expectations */
1515
+ type InputKind = string;
1516
+ type InputVariant = "default" | (string & {});
1517
+ type AdapterCtx = {
1518
+ field: Field;
1519
+ props: ServiceProps;
1520
+ };
1521
+ type Adapter = {
1522
+ valueProp?: string;
1523
+ changeProp?: string;
1524
+ errorProp?: string;
1525
+ /** normalize what the host emitted into what we store in form-palette */
1526
+ getValue?: (next: unknown, current: unknown, ctx: AdapterCtx) => unknown;
1527
+ /** REQUIRED if field.options exists */
1528
+ getSelectedOptions?: (next: unknown, current: unknown, ctx: AdapterCtx) => string[];
1529
+ /** For option-less action buttons (button: true with no options) */
1530
+ isActive?: (stored: unknown, ctx: AdapterCtx) => boolean;
1531
+ getInputPropsFromField?: (props: AdapterCtx) => any;
1532
+ toValue?: (value: any) => any;
1533
+ };
1534
+ type InputOptionCapability = {
1535
+ supported?: boolean;
1536
+ autoCreate?: boolean;
1537
+ defaultLabel?: string;
1538
+ defaultValue?: string | number;
1539
+ };
1540
+ type InputMultiCapability = {
1541
+ supported?: boolean;
1542
+ autoEnable?: boolean;
1543
+ };
1544
+ type InputDescriptor = {
1545
+ Component: React.ComponentType<Record<string, unknown>>;
1546
+ adapter?: Adapter;
1547
+ defaultProps?: Record<string, unknown>;
1548
+ ui?: Record<string, Ui>;
1549
+ options?: InputOptionCapability;
1550
+ multi?: InputMultiCapability;
1551
+ };
1552
+ type VariantMap = Map<InputVariant, InputDescriptor>;
1553
+ type RegistryStore = Map<InputKind, VariantMap>;
1554
+ type Registry = {
1555
+ get(kind: InputKind, variant?: InputVariant): InputDescriptor | undefined;
1556
+ register(kind: InputKind, descriptor: InputDescriptor, variant?: InputVariant): void;
1557
+ unregister(kind: InputKind, variant?: InputVariant): void;
1558
+ registerMany(entries: Array<{
1559
+ kind: InputKind;
1560
+ descriptor: InputDescriptor;
1561
+ variant?: InputVariant;
1562
+ }>): void;
1563
+ /** low-level escape hatch */
1564
+ _store: RegistryStore;
1565
+ };
1566
+ declare function createInputRegistry(): Registry;
1567
+ /** Helper used by InputWrapper */
1568
+ declare function resolveInputDescriptor(registry: Registry, kind: InputKind, variant?: InputVariant): InputDescriptor | undefined;
1569
+
1514
1570
  declare class Editor {
1515
1571
  private readonly builder;
1516
1572
  private readonly api;
@@ -1582,7 +1638,14 @@ declare class Editor {
1582
1638
  id?: string;
1583
1639
  label: string;
1584
1640
  type: Field["type"];
1585
- }): void;
1641
+ }): string;
1642
+ addFieldFromDescriptor(registry: Registry, partial: Omit<Field, "id" | "label" | "type"> & {
1643
+ id?: string;
1644
+ label: string;
1645
+ type: Field["type"];
1646
+ }, opts?: {
1647
+ variant?: InputVariant;
1648
+ }): string;
1586
1649
  updateField(id: string, patch: Partial<Field>): void;
1587
1650
  removeField(id: string): void;
1588
1651
  remove(id: string): void;
@@ -1601,6 +1664,7 @@ declare class Editor {
1601
1664
  setPricingRoleMany(ids: readonly string[], role: "base" | "utility"): void;
1602
1665
  clearFieldDefaultsMany(ids: readonly string[]): void;
1603
1666
  clearFieldValidationMany(ids: readonly string[]): void;
1667
+ setFieldMulti(fieldId: string, enabled: boolean): void;
1604
1668
  autoCreateOptionsMany(ids: readonly string[], makeOption?: (fieldId: string) => {
1605
1669
  id?: string;
1606
1670
  label: string;
@@ -1825,57 +1889,6 @@ type FormProviderProps = {
1825
1889
  };
1826
1890
  declare function FormProvider({ children, schema, initial }: FormProviderProps): react_jsx_runtime.JSX.Element;
1827
1891
 
1828
- /** Matches your InputWrapper’s expectations */
1829
- type InputKind = string;
1830
- type InputVariant = "default" | (string & {});
1831
- type AdapterCtx = {
1832
- field: Field;
1833
- props: ServiceProps;
1834
- };
1835
- type Adapter = {
1836
- valueProp?: string;
1837
- changeProp?: string;
1838
- errorProp?: string;
1839
- /** normalize what the host emitted into what we store in form-palette */
1840
- getValue?: (next: unknown, current: unknown, ctx: AdapterCtx) => unknown;
1841
- /** REQUIRED if field.options exists */
1842
- getSelectedOptions?: (next: unknown, current: unknown, ctx: AdapterCtx) => string[];
1843
- /** For option-less action buttons (button: true with no options) */
1844
- isActive?: (stored: unknown, ctx: AdapterCtx) => boolean;
1845
- getInputPropsFromField?: (props: AdapterCtx) => any;
1846
- toValue?: (value: any) => any;
1847
- };
1848
- type InputOptionCapability = {
1849
- supported?: boolean;
1850
- autoCreate?: boolean;
1851
- defaultLabel?: string;
1852
- defaultValue?: string | number;
1853
- };
1854
- type InputDescriptor = {
1855
- Component: React.ComponentType<Record<string, unknown>>;
1856
- adapter?: Adapter;
1857
- defaultProps?: Record<string, unknown>;
1858
- ui?: Record<string, Ui>;
1859
- options?: InputOptionCapability;
1860
- };
1861
- type VariantMap = Map<InputVariant, InputDescriptor>;
1862
- type RegistryStore = Map<InputKind, VariantMap>;
1863
- type Registry = {
1864
- get(kind: InputKind, variant?: InputVariant): InputDescriptor | undefined;
1865
- register(kind: InputKind, descriptor: InputDescriptor, variant?: InputVariant): void;
1866
- unregister(kind: InputKind, variant?: InputVariant): void;
1867
- registerMany(entries: Array<{
1868
- kind: InputKind;
1869
- descriptor: InputDescriptor;
1870
- variant?: InputVariant;
1871
- }>): void;
1872
- /** low-level escape hatch */
1873
- _store: RegistryStore;
1874
- };
1875
- declare function createInputRegistry(): Registry;
1876
- /** Helper used by InputWrapper */
1877
- declare function resolveInputDescriptor(registry: Registry, kind: InputKind, variant?: InputVariant): InputDescriptor | undefined;
1878
-
1879
1892
  type InputsCtxValue = {
1880
1893
  registry: Registry;
1881
1894
  register: (kind: InputKind, descriptor: InputDescriptor, variant?: InputVariant) => void;
@@ -2045,6 +2058,7 @@ type UseOrderFlowReturn = {
2045
2058
  max: number;
2046
2059
  selectTag: (tagId: string) => void;
2047
2060
  toggleOption: (fieldId: string, optionId?: string) => void;
2061
+ setFieldOptions: (fieldId: string, optionIds: string[]) => void;
2048
2062
  /** programmatic value set (rare; wrapper/field hook should handle most) */
2049
2063
  setValue: (fieldId: string, value: Scalar | Scalar[]) => void;
2050
2064
  clearField: (fieldId: string) => void;
@@ -2283,4 +2297,4 @@ type Props = {
2283
2297
  };
2284
2298
  declare function FallbackAddRegistrationDialog({ open, onClose, onSelect, }: Props): react_jsx_runtime.JSX.Element | null;
2285
2299
 
2286
- export { type Adapter, type AdapterCtx, CanvasAPI, type EditorSettings, EventBus, type EventMap, FallbackAddCandidatesDialog, FallbackAddRegistrationDialog, FallbackDetailsPanel, FallbackEditor, type FallbackEditorData, FallbackEditorHeader, FallbackEditorProvider, type FallbackEditorProviderProps, FallbackRegistrationsPanel, FallbackServiceSidebar, FallbackSettingsPanel, type FormApi, FormProvider, type FormProviderProps, type FormSnapshot, type InputDescriptor, type InputKind, type InputOptionCapability, type InputVariant, type InputWrapperProps, OrderFlowProvider, Provider, type RegistrationItem, type RegistrationScope, type Registry, type ServiceSummary, type ValidationMessage, type ValidationTone, VirtualServiceList, Wrapper, createInputRegistry, registerEntries, resolveInputDescriptor, useActiveFallbackRegistrations, useEligibleServiceList, useFallbackEditor, useFallbackEditorContext, useFormApi, useInputs, useInputsMaybe, useOptionalFormApi, useOrderFlow, useOrderFlowContext, usePrimaryServiceList };
2300
+ export { type Adapter, type AdapterCtx, CanvasAPI, type EditorSettings, EventBus, type EventMap, FallbackAddCandidatesDialog, FallbackAddRegistrationDialog, FallbackDetailsPanel, FallbackEditor, type FallbackEditorData, FallbackEditorHeader, FallbackEditorProvider, type FallbackEditorProviderProps, FallbackRegistrationsPanel, FallbackServiceSidebar, FallbackSettingsPanel, type FormApi, FormProvider, type FormProviderProps, type FormSnapshot, type InputDescriptor, type InputKind, type InputMultiCapability, type InputOptionCapability, type InputVariant, type InputWrapperProps, OrderFlowProvider, Provider, type RegistrationItem, type RegistrationScope, type Registry, type ServiceSummary, type ValidationMessage, type ValidationTone, VirtualServiceList, Wrapper, createInputRegistry, registerEntries, resolveInputDescriptor, useActiveFallbackRegistrations, useEligibleServiceList, useFallbackEditor, useFallbackEditorContext, useFormApi, useInputs, useInputsMaybe, useOptionalFormApi, useOrderFlow, useOrderFlowContext, usePrimaryServiceList };