@ingridab/sdk 0.1.0 → 0.2.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
@@ -1,8 +1,7 @@
1
1
  # @ingridab/sdk
2
2
 
3
3
  Vanilla JS SDK for embedding Ingrid Experience Kit compounds into any web
4
- application. Framework-agnostic; for a React-flavoured binding see
5
- [`@ingridab/sdk-react`](../sdk-react).
4
+ application.
6
5
 
7
6
  The initial release ships the `address` molecule; additional molecules will
8
7
  be made available in future releases.
@@ -19,29 +18,37 @@ Initialize the SDK with your credentials and the molecules to render, then
19
18
  mount the returned compound into a container element in the DOM.
20
19
 
21
20
  ```ts
22
- import initIngrid, { createAddressMolecule } from '@ingridab/sdk';
21
+ import ingrid, { createAddressMolecule } from '@ingridab/sdk';
23
22
 
24
- const ingrid = await initIngrid({
23
+ const instance = await ingrid.init({
25
24
  token: 'your-auth-token',
26
25
  siteId: 'your-site-id',
27
26
  locale: 'en-US',
27
+ countryCode: 'US',
28
+ currency: 'USD',
28
29
  molecules: [createAddressMolecule({ mode: 'addressForm' })],
29
30
  });
30
31
 
31
- await ingrid.compound.mount('#ingrid-container');
32
+ await instance.compound.mount('#ingrid-container');
32
33
  ```
33
34
 
35
+ ### Auth
36
+
37
+ `refreshToken` is optional. Use it with short-lived Ingrid API tokens, which are
38
+ preferred. The callback should call your backend and return a fresh token issued by the
39
+ integrator with its expiration timestamp: `{ accessToken, expiresAt }`.
40
+
34
41
  ### Listening to events
35
42
 
36
43
  The compound exposes a catch-all `on(event, callback)` API. Subscriptions
37
44
  return an unsubscribe function.
38
45
 
39
46
  ```ts
40
- const unsubscribe = ingrid.compound.on('addressSubmit', ({ payload }) => {
47
+ const unsubscribe = instance.compound.on('addressSubmit', ({ payload }) => {
41
48
  console.log('submitted address', payload);
42
49
  });
43
50
 
44
- ingrid.compound.on('ready', () => {
51
+ instance.compound.on('ready', () => {
45
52
  console.log('compound mounted and interactive');
46
53
  });
47
54
 
@@ -52,17 +59,17 @@ unsubscribe();
52
59
 
53
60
  ```ts
54
61
  // Change locale across the mounted experience
55
- ingrid.setLocale('sv-SE');
62
+ instance.setLocale('sv-SE');
56
63
 
57
64
  // Update theme tokens without remounting
58
- ingrid.compound.update({
65
+ instance.compound.update({
59
66
  styles: {
60
- '--ingrid-color-primary': '#0050ff',
67
+ '--color-bg-primary': '#0050ff',
61
68
  },
62
69
  });
63
70
 
64
71
  // Tear it all down
65
- ingrid.compound.unmount();
72
+ instance.compound.unmount();
66
73
  ```
67
74
 
68
75
  ## Data providers
@@ -73,12 +80,14 @@ route requests through your own backend, inject auth, mock data in tests, or
73
80
  extend the default behaviour with logging.
74
81
 
75
82
  ```ts
76
- import initIngrid, { withDefaultProvider } from '@ingridab/sdk';
83
+ import ingrid, { createAddressMolecule, withDefaultProvider } from '@ingridab/sdk';
77
84
 
78
- const ingrid = await initIngrid({
85
+ const instance = await ingrid.init({
79
86
  token,
80
87
  siteId,
81
88
  locale: 'en-US',
89
+ countryCode: 'US',
90
+ currency: 'USD',
82
91
  molecules: [createAddressMolecule({ mode: 'addressForm' })],
83
92
  dataProviders: {
84
93
  services: {
package/dist/index.d.ts CHANGED
@@ -224,15 +224,13 @@ declare type AddressFormResponse = {
224
224
 
225
225
  declare type AddressFormService = {
226
226
  getAddressFormConfig: DataResolver<
227
- { params: GetAddressFormQuery['QueryParams']; token: string },
227
+ { params: GetAddressFormQuery['QueryParams'] } & SDKManagedTokenArg,
228
228
  GetAddressFormQuery['Response']
229
229
  >;
230
230
  };
231
231
 
232
232
  /* Excluded from this release type: AddressMoleculeCustomization */
233
233
 
234
- declare type AddressMoleculeInputState = Partial<AddressContactEntry>;
235
-
236
234
  /**
237
235
  * Configuration params passed to the address molecule.
238
236
  *
@@ -248,8 +246,8 @@ declare type AddressMoleculeInputState = Partial<AddressContactEntry>;
248
246
  * ```
249
247
  */
250
248
  declare type AddressMoleculeParams = {
251
- /** The rendering mode for the address molecule. Currently `'addressForm'` is supported. */
252
- mode: 'addressForm';
249
+ /** The rendering mode for the address molecule. Currently `'addressForm'` and `'searchDriven'` are supported. */
250
+ mode: 'addressForm' | 'searchDriven';
253
251
  customization?: AddressMoleculePublicCustomization;
254
252
  };
255
253
 
@@ -266,7 +264,7 @@ declare type AddressMoleculePublicCustomization = {
266
264
  /**
267
265
  * Controls how the address book is presented.
268
266
  *
269
- * @defaultValue `'inline'`
267
+ * @defaultValue `'off'`
270
268
  */
271
269
  displayMode?: 'off' | 'inline' | 'popup';
272
270
  /**
@@ -290,14 +288,13 @@ declare type AddressMoleculePublicCustomization = {
290
288
 
291
289
  declare type AddressSuggestionsService = {
292
290
  list: DataResolver<
293
- { params: AutocompleteAddressQuery['QueryParams']; token: string },
291
+ { params: AutocompleteAddressQuery['QueryParams'] } & SDKManagedTokenArg,
294
292
  AutocompleteAddressQuery['Response']
295
293
  >;
296
294
  resolve: DataResolver<
297
295
  {
298
296
  params: GetAddressDetailsQuery['PathParams'] & GetAddressDetailsQuery['QueryParams'];
299
- token: string;
300
- },
297
+ } & SDKManagedTokenArg,
301
298
  GetAddressDetailsQuery['Response']
302
299
  >;
303
300
  };
@@ -308,7 +305,7 @@ declare type AddressTypeEnum = 'unknown' | 'residential' | 'commercial';
308
305
 
309
306
  declare type AddressValidationService = {
310
307
  validateAddress: DataResolver<
311
- { payload: ValidateAddressMutation['Request']; token: string },
308
+ { payload: ValidateAddressMutation['Request'] } & SDKManagedTokenArg,
312
309
  ValidateAddressMutation['Response']
313
310
  >;
314
311
  };
@@ -598,12 +595,6 @@ declare type AutocompleteFocusEnum =
598
595
  */
599
596
  declare type BaseKey<K> = K extends `${infer B}_${Intl.LDMLPluralRule}` ? B : K;
600
597
 
601
- /**
602
- * TODO: this will come from the site config most probably and
603
- * the shape of the model will be different - for now it's kept as simple
604
- * as possible for MVP purposes
605
- */
606
-
607
598
  declare type BaseMoleculeDef<K extends MoleculeType> = {
608
599
  type: K;
609
600
  customization?: DeepPartial<MoleculeCustomizationConfig<K>>;
@@ -638,8 +629,7 @@ declare type ContactsService = {
638
629
  addressBookId: string;
639
630
  countryCode?: string;
640
631
  };
641
- token: string;
642
- },
632
+ } & SDKManagedTokenArg,
643
633
  {
644
634
  entries: { id: string; label: string; secondaryLabel: string }[];
645
635
  }
@@ -647,8 +637,7 @@ declare type ContactsService = {
647
637
  getContactBookEntry: DataResolver<
648
638
  {
649
639
  params: { id: string; addressBookId: string };
650
- token: string;
651
- },
640
+ } & SDKManagedTokenArg,
652
641
  AddressContactEntry
653
642
  >;
654
643
  upsertContactBookEntry: DataResolver<
@@ -657,12 +646,11 @@ declare type ContactsService = {
657
646
  params: {
658
647
  addressBookId: string;
659
648
  };
660
- token: string;
661
- },
649
+ } & SDKManagedTokenArg,
662
650
  AddressContactEntry
663
651
  >;
664
652
  deleteContactBookEntry: DataResolver<
665
- { params: { addressBookId: string; id: string }; token: string },
653
+ { params: { addressBookId: string; id: string } } & SDKManagedTokenArg,
666
654
  object
667
655
  >;
668
656
  };
@@ -696,19 +684,21 @@ declare type CountrySelectorParams = {
696
684
  };
697
685
 
698
686
  /**
699
- * Creates a molecule configuration for the address particle.
687
+ * Creates a molecule configuration for the address molecule.
700
688
  *
701
689
  * Renders an address form that collects and validates the shopper's shipping address.
702
690
  *
703
- * @param params - Configuration for the address particle. See `AddressParticleParams`.
691
+ * @param params - Configuration for the address molecule. See `AddressMoleculeParams`.
704
692
  * @returns A molecule descriptor to pass to the `molecules` array in {@link IngridInitParams}.
705
693
  *
706
694
  * @example
707
695
  * ```ts
708
- * const ingrid = await initIngrid({
696
+ * const instance = await ingrid.init({
709
697
  * token: 'your-auth-token',
710
698
  * siteId: 'your-site-id',
711
699
  * locale: 'en-US',
700
+ * countryCode: 'US',
701
+ * currency: 'USD',
712
702
  * molecules: [
713
703
  * createAddressMolecule({
714
704
  * mode: 'addressForm'
@@ -723,142 +713,7 @@ export declare const createAddressMolecule: ({ mode, customization }: MoleculePa
723
713
  type: "address";
724
714
  customization: AddressMoleculePublicCustomization | undefined;
725
715
  params: {
726
- mode: "addressForm";
727
- };
728
- };
729
-
730
- /**
731
- * Creates a molecule configuration for the country selector particle.
732
- *
733
- * Renders a country picker that allows the shopper to select their delivery country.
734
- * Changing the country refreshes available delivery options.
735
- *
736
- * @param params - Configuration for the country selector particle. See `CountrySelectorParams`.
737
- * @returns A molecule descriptor to pass to the `molecules` array in {@link IngridInitParams}.
738
- *
739
- * @example
740
- * ```ts
741
- * const ingrid = await initIngrid({
742
- * token: 'your-auth-token',
743
- * siteId: 'your-site-id',
744
- * locale: 'en-US',
745
- * molecules: [
746
- * createCountrySelectorMolecule({ mode: 'select', name: 'country-picker' }),
747
- * ],
748
- * });
749
- * ```
750
- *
751
- * @public
752
- */
753
- export declare const createCountrySelectorMolecule: ({ mode, name, }: MoleculeParamsMap["countrySelector"]) => {
754
- type: "countrySelector";
755
- params: {
756
- mode: "select";
757
- name: string;
758
- };
759
- };
760
-
761
- /**
762
- * Creates a molecule configuration for the delivery particle.
763
- *
764
- * Renders a delivery options selector where the shopper can browse and choose a shipping method.
765
- * Use `mode: 'active'` for a checkout flow where the shopper makes a selection, and
766
- * `mode: 'passive'` for a read-only summary display.
767
- *
768
- * @param params - Configuration for the delivery particle. See `DeliveryParticleParams`.
769
- * @returns A molecule descriptor to pass to the `molecules` array in {@link IngridInitParams}.
770
- *
771
- * @example
772
- * ```ts
773
- * const ingrid = await initIngrid({
774
- * token: 'your-auth-token',
775
- * siteId: 'your-site-id',
776
- * locale: 'en-US',
777
- * molecules: [
778
- * createDeliveryMolecule({ mode: 'active', name: 'main-delivery' }),
779
- * ],
780
- * });
781
- * ```
782
- *
783
- * @public
784
- */
785
- export declare const createDeliveryMolecule: ({ mode, name, customization, }: MoleculeParamsMap["delivery"]) => {
786
- type: "delivery";
787
- customization: {
788
- choice?: {
789
- carrierInstructions?: "off" | "inline" | "popup";
790
- gaplessAddonsList?: boolean;
791
- gaplessCarrierList?: boolean;
792
- gaplessDeliveryList?: boolean;
793
- labels?: "off" | "chips" | "text";
794
- showAddons?: boolean;
795
- showCustomInfoText?: boolean;
796
- showCustomText?: boolean;
797
- showDiscountedPrice?: boolean;
798
- showFreeShippingIndicator?: boolean;
799
- showPrice?: boolean;
800
- showRadioIndicator?: boolean;
801
- showReturnPromise?: boolean;
802
- showShippingLogo?: boolean;
803
- };
804
- location?: {
805
- gaplessList?: boolean;
806
- mapDefaultVisible?: boolean;
807
- mapDefaultZoom?: number;
808
- mapFitboundsMaxZoom?: number;
809
- mapPosition?: "start" | "end";
810
- mapToggleEnabled?: boolean;
811
- };
812
- productList?: {
813
- defaultView?: "off" | "list" | "summary";
814
- showImage?: boolean;
815
- showMetadata?: boolean;
816
- showPrice?: boolean;
817
- showQuantity?: boolean;
818
- summaryText?: "none" | "products" | "firstProductAndMore";
819
- };
820
- summary?: {
821
- previewAddons?: boolean;
822
- showFreeShippingIndicator?: boolean;
823
- };
824
- } | undefined;
825
- params: {
826
- mode: "active" | "passive";
827
- name: string;
828
- };
829
- };
830
-
831
- /**
832
- * Creates a molecule configuration for the free shipping indicator particle.
833
- *
834
- * Renders a progress bar or message showing how close the shopper is to qualifying
835
- * for free shipping. Pair it with a delivery molecule that has `showFreeShippingIndicator`
836
- * enabled, or use it standalone via the `deliveryId` param.
837
- *
838
- * @param params - Configuration for the free shipping indicator particle. See `FreeShippingIndicatorParams`.
839
- * @returns A molecule descriptor to pass to the `molecules` array in {@link IngridInitParams}.
840
- *
841
- * @example
842
- * ```ts
843
- * const ingrid = await initIngrid({
844
- * token: 'your-auth-token',
845
- * siteId: 'your-site-id',
846
- * locale: 'en-US',
847
- * molecules: [
848
- * createFreeShippingIndicatorMolecule({ name: 'free-shipping' }),
849
- * ],
850
- * });
851
- * ```
852
- *
853
- * @public
854
- */
855
- export declare const createFreeShippingIndicatorMolecule: ({ name, customization, }: MoleculeParamsMap["freeShippingIndicator"]) => {
856
- type: "freeShippingIndicator";
857
- customization: {
858
- showExhaustedLevelsMessage?: boolean;
859
- } | undefined;
860
- params: {
861
- name: string;
716
+ mode: "addressForm" | "searchDriven";
862
717
  };
863
718
  };
864
719
 
@@ -935,8 +790,6 @@ declare type DeliveryAddon = {
935
790
  readonly description?: string;
936
791
  };
937
792
 
938
- declare const deliveryArgsSchema = z.object({ sessionId: z.string(), token: z.string() });
939
-
940
793
  /**
941
794
  * @description DeliveryType defines the method or mode of delivery.\n\n - DELIVERY_TYPE_UNSPECIFIED: Delivery type is unspecified or unknown.\n - DELIVERY: Delivery to a customer\'s home or address.\n - PICKUP: Delivery to a service point or locker.\n - MAILBOX: Delivery to a customer\'s mailbox.\n - INSTORE: Delivery to a merchant\'s store for in-store pickup.
942
795
  * @default DELIVERY_TYPE_UNSPECIFIED
@@ -1371,18 +1224,6 @@ declare type DeliveryMoleculeParams = {
1371
1224
 
1372
1225
  declare const deliveryMoleculeParamsValidator = z.object({
1373
1226
  customization: deliveryCustomizationValidator,
1374
-
1375
- // TODO: the passive `mode` has hardcoded logic, but IMHO the behaviour should come from granular config (components + policies), not from `mode` branches.
1376
- // Just an simple example:
1377
- // components: {
1378
- // continue_button: { display: 'hidden' },
1379
- // pickup_location: { display: 'popup', interaction: 'preview' // or edit }
1380
- // }
1381
- //
1382
- // actionPolicy: {
1383
- // select_item: 'deny'
1384
- // }
1385
- //
1386
1227
  mode: z.enum(['active', 'passive']),
1387
1228
  name: z.string(),
1388
1229
  }) satisfies z.ZodType<DeliveryMoleculeParams>;
@@ -1756,9 +1597,24 @@ declare type ETDTimeUnitEnum =
1756
1597
 
1757
1598
  declare type Event_2<T> = { payload: T };
1758
1599
 
1759
- declare type EventsMap = {
1600
+ /**
1601
+ * Map of all events emitted by the Ingrid compound.
1602
+ *
1603
+ * | Event | When it fires |
1604
+ * | ----------------- | ---------------------------------------------- |
1605
+ * | `ready` | Compound is mounted and interactive |
1606
+ * | `addressSubmit` | Shopper confirms the address form |
1607
+ * | `countryChange` | Shopper selects a different country |
1608
+ * | `selectionChange` | Shopper selects a delivery option |
1609
+ * | `error` | An error occurs during mount or at runtime |
1610
+ *
1611
+ * @remarks Event names and payload shapes may evolve before the stable release.
1612
+ *
1613
+ * @public
1614
+ */
1615
+ export declare type EventsMap = {
1760
1616
  countryChange: (event: Event_2<{ country_code: string }>) => void;
1761
- addressSubmit: (event: Event_2<AddressMoleculeInputState>) => void;
1617
+ addressSubmit: (event: Event_2<Partial<AddressContactEntry>>) => void;
1762
1618
  selectionChange: (event: Event_2<{ deliveryId: string; categoryId: string }>) => void;
1763
1619
  ready: () => void;
1764
1620
  error: (error: unknown) => void;
@@ -1912,9 +1768,11 @@ declare type GetAddressFormQueryParams = {
1912
1768
  postalCode?: string;
1913
1769
  };
1914
1770
 
1915
- declare type GetDeliverySessionArgs = z.infer<typeof deliveryArgsSchema>;
1771
+ declare type GetDeliverySessionArgs = { sessionId: string } & SDKManagedTokenArg;
1916
1772
 
1917
- declare type GetTrackingDataArgs = z.infer<typeof trackingArgsSchema>;
1773
+ declare type GetTrackingDataArgs =
1774
+ | ({ locale: Locale } & SDKManagedTokenArg)
1775
+ | { email: string; tos_id: string; locale: Locale };
1918
1776
 
1919
1777
  declare type GetTrackingDataResponse = {
1920
1778
  /**
@@ -1983,13 +1841,20 @@ declare const ingrid: {
1983
1841
  export default ingrid;
1984
1842
 
1985
1843
  /**
1986
- * The compound instance returned by {@link ingrid.init}, used to control the lifecycle
1844
+ * The compound instance returned by `ingrid.init`, used to control the lifecycle
1987
1845
  * of the rendered Ingrid experience.
1988
1846
  *
1989
1847
  * @public
1990
1848
  */
1991
1849
  export declare interface IngridCompound {
1992
- /** Mounts the Ingrid experience into the DOM element matching `containerSelector`. */
1850
+ /**
1851
+ * Mounts the Ingrid experience into the DOM element matching `containerSelector`.
1852
+ *
1853
+ * @param containerSelector - CSS selector for the container element to mount into.
1854
+ * @param options - Optional mount options.
1855
+ * @param options.signal - An `AbortSignal` to cancel the mount. If the signal fires before
1856
+ * the compound finishes loading, the mount is silently abandoned and no error is thrown.
1857
+ */
1993
1858
  mount(containerSelector: string, options?: {
1994
1859
  signal?: AbortSignal;
1995
1860
  }): Promise<void>;
@@ -1998,9 +1863,11 @@ export declare interface IngridCompound {
1998
1863
  /** Updates runtime configuration of the mounted experience. */
1999
1864
  update(newConfig: Partial<UpdatableConfig>): void;
2000
1865
  /**
2001
- * Subscribes to an SDK event.
1866
+ * Subscribes to an SDK event. See {@link EventsMap} for available events and their payloads.
2002
1867
  *
2003
- * @returns An unsubscribe function.
1868
+ * @param event - The event name to subscribe to.
1869
+ * @param callback - Called each time the event fires.
1870
+ * @returns An unsubscribe function - call it to stop listening.
2004
1871
  */
2005
1872
  on<K extends keyof EventsMap>(event: K, callback: EventsMap[K]): () => boolean;
2006
1873
  }
@@ -2023,13 +1890,14 @@ export declare interface IngridCompound {
2023
1890
  * @public
2024
1891
  */
2025
1892
  export declare interface IngridInitParams {
2026
- /** Authentication token for the Ingrid API. */
2027
- token: string;
2028
- /** Optional function to refresh the authentication token when it expires. */
2029
- refreshToken?: () => Promise<{
2030
- accessToken: string;
2031
- expiresAt: number;
2032
- }>;
1893
+ /** Initial token for Ingrid built-in providers. */
1894
+ token?: string;
1895
+ /**
1896
+ * Optional callback for short-lived Ingrid API tokens, which are preferred.
1897
+ * Call your backend to issue and return a fresh Ingrid API token along with its expiration timestamp
1898
+ * expiration timestamp: `{ accessToken, expiresAt }`.
1899
+ */
1900
+ refreshToken?: () => Promise<TokenRefreshResult>;
2033
1901
  /** Ingrid site identifier. */
2034
1902
  siteId: string;
2035
1903
  /** The locale to use for the experience. */
@@ -2062,7 +1930,10 @@ export declare interface IngridInitParams {
2062
1930
  export declare interface IngridInstance {
2063
1931
  /** The compound instance used to mount, unmount, and update the Ingrid experience. */
2064
1932
  compound: IngridCompound;
2065
- /** Updates the active locale for the experience. */
1933
+ /**
1934
+ * Updates the active locale for the experience.
1935
+ * If the locale is not supported, falls back to `'en-US'`.
1936
+ */
2066
1937
  setLocale(locale: Locale): void;
2067
1938
  /** Updates the active purchase country code. */
2068
1939
  setPurchaseCountry(countryCode: string): void;
@@ -2293,7 +2164,7 @@ declare type LocationByValue = {
2293
2164
  display_name?: string;
2294
2165
  };
2295
2166
 
2296
- declare type MethodOverrides<T> = {
2167
+ export declare type MethodOverrides<T> = {
2297
2168
  [K in keyof T]?: T[K] extends (...args: any[]) => any ? T[K] | WithDefaultProvider<T[K]> : never;
2298
2169
  };
2299
2170
 
@@ -2968,6 +2839,11 @@ declare interface SDKInternal {
2968
2839
  readonly [_internalBrand]: never;
2969
2840
  }
2970
2841
 
2842
+ declare type SDKManagedTokenArg = {
2843
+ /** @deprecated This is an internal SDK-managed token for builtin providers. Do not rely on this directly. Custom providers should implement their own authentication mechanism if needed.*/
2844
+ token?: string;
2845
+ };
2846
+
2971
2847
  /**
2972
2848
  * @description Response containing a list of address predictions from the autocomplete endpoint.
2973
2849
  */
@@ -3029,7 +2905,6 @@ declare type Services = {
3029
2905
  * ```ts
3030
2906
  * const entries = await services.address.listContactBookEntries({
3031
2907
  * params: { addressBookId: 'book_123' },
3032
- * token: authToken,
3033
2908
  * });
3034
2909
  * ```
3035
2910
  */
@@ -3053,6 +2928,14 @@ declare type Services = {
3053
2928
  };
3054
2929
  };
3055
2930
 
2931
+ /**
2932
+ * Per-domain overrides for the SDK's internal data-fetching services.
2933
+ * Each key maps to a domain (e.g. `address`), and each value is a partial map of
2934
+ * method overrides for that domain. Supply a plain function to replace the default
2935
+ * implementation entirely, or use {@link withDefaultProvider} to wrap it.
2936
+ *
2937
+ * @public
2938
+ */
3056
2939
  export declare type ServicesOverrides = {
3057
2940
  [Domain in keyof Services]?: MethodOverrides<Services[Domain]>;
3058
2941
  };
@@ -3137,10 +3020,17 @@ declare type TextDirectionEnum = 'ltr' | 'rtl';
3137
3020
 
3138
3021
  declare type ThemeCssVariables = `--${RecursiveObjectValues<typeof variableNames>}`;
3139
3022
 
3140
- declare const trackingArgsSchema = z.union([
3141
- z.object({ token: z.string(), locale: z.enum(localeList) }),
3142
- z.object({ email: z.string(), tos_id: z.string(), locale: z.enum(localeList) }),
3143
- ]);
3023
+ /** Value returned by the SDK `refreshToken` callback. */
3024
+ declare type TokenRefreshResult = {
3025
+ /** Fresh short-lived Ingrid API token. */
3026
+ accessToken: string;
3027
+ /**
3028
+ * Expiry time for `accessToken` as a Unix epoch timestamp in milliseconds.
3029
+ * The SDK uses this to refresh auth before expiry. If the value is stale,
3030
+ * invalid, or affected by clock skew, the SDK refreshes reactively on 401 response.
3031
+ */
3032
+ expiresAt: number;
3033
+ };
3144
3034
 
3145
3035
  declare type TrackingData = GetTrackingDataResponse;
3146
3036
 
@@ -3169,8 +3059,13 @@ declare type TranslationsService = {
3169
3059
  ) => void;
3170
3060
  };
3171
3061
 
3172
- /** @public */
3173
- declare interface UpdatableConfig {
3062
+ /**
3063
+ * Runtime configuration that can be updated on a mounted compound via {@link IngridCompound.update}.
3064
+ *
3065
+ * @public
3066
+ */
3067
+ export declare interface UpdatableConfig {
3068
+ /** Design token overrides to apply to the rendered experience without remounting. */
3174
3069
  styles?: StyleTokens;
3175
3070
  }
3176
3071
 
@@ -3637,7 +3532,7 @@ declare type WithDefaultProvider<T extends (...args: any[]) => any> = {
3637
3532
  *
3638
3533
  * @param factory - Receives the SDK's default implementation as `defaultFn`.
3639
3534
  * Return a new function that calls `defaultFn` wherever you want the original behaviour.
3640
- * @returns A {@link WithDefaultProvider} wrapper understood by the SDK's service resolver.
3535
+ * @returns A `WithDefaultProvider` wrapper understood by the SDK's service resolver.
3641
3536
  *
3642
3537
  * @example
3643
3538
  * ```ts