@ingridab/sdk 0.1.0-alpha.1 → 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 +117 -0
- package/dist/LICENSES.md +37 -0
- package/dist/index.d.ts +592 -601
- package/dist/index.js +2477 -2474
- package/dist/internal.d.ts +263 -0
- package/dist/internal.js +35 -0
- package/package.json +17 -6
package/dist/index.d.ts
CHANGED
|
@@ -138,87 +138,6 @@ declare type Address_2 = {
|
|
|
138
138
|
type?: AddressType;
|
|
139
139
|
};
|
|
140
140
|
|
|
141
|
-
/**
|
|
142
|
-
* @description Represents an address suitable for delivery.
|
|
143
|
-
*/
|
|
144
|
-
declare type AddressAddress = {
|
|
145
|
-
/**
|
|
146
|
-
* @description \nRefers to a ISO-3166 alpha 2 country code.
|
|
147
|
-
* @type string
|
|
148
|
-
*/
|
|
149
|
-
country_code: string;
|
|
150
|
-
/**
|
|
151
|
-
* @description Refers to a first-level administrative subdivision code (ISO-3166-2) without the country_code prefix.\nExample: region for Washington, D.C. = `DC` (from `US-DC`).\nException: for some countries (e.g. Mexico, Hong Kong) we store the subdivision name instead.\nExample: region for Hong Kong = `Kowloon`.
|
|
152
|
-
* @type string | undefined
|
|
153
|
-
*/
|
|
154
|
-
region_code?: string;
|
|
155
|
-
/**
|
|
156
|
-
* @description Refers to a second-level administrative subdivision below the region (ISO-3166-2), without the country_code prefix.\nExample: region for Washington State = `WA` (from `US-WA`), subregion for King County = `033` (from `US-WA-033`).\nException: for some countries (e.g. Mexico, Hong Kong) we store the subdivision name instead.\nExample: subregion within Hong Kong/Kowloon = `Tsim Sha Tsui`.
|
|
157
|
-
* @type string | undefined
|
|
158
|
-
*/
|
|
159
|
-
subregion_code?: string;
|
|
160
|
-
/**
|
|
161
|
-
* @description Refers to a postal code or zipcode.
|
|
162
|
-
* @type string | undefined
|
|
163
|
-
*/
|
|
164
|
-
postal_code?: string;
|
|
165
|
-
/**
|
|
166
|
-
* @description Refers to a city, postal_town or locality.
|
|
167
|
-
* @type string | undefined
|
|
168
|
-
*/
|
|
169
|
-
city?: string;
|
|
170
|
-
/**
|
|
171
|
-
* @description List of strings, each a part of the address, e.g., street name, street number, building name, floor.
|
|
172
|
-
* @type array | undefined
|
|
173
|
-
*/
|
|
174
|
-
address_lines?: string[];
|
|
175
|
-
/**
|
|
176
|
-
* @description Street name of the address.
|
|
177
|
-
* @type string | undefined
|
|
178
|
-
*/
|
|
179
|
-
street?: string;
|
|
180
|
-
/**
|
|
181
|
-
* @description Street number of the address.
|
|
182
|
-
* @type string | undefined
|
|
183
|
-
*/
|
|
184
|
-
street_number?: string;
|
|
185
|
-
/**
|
|
186
|
-
* @description Apartment number of the address.
|
|
187
|
-
* @type string | undefined
|
|
188
|
-
*/
|
|
189
|
-
apartment_number?: string;
|
|
190
|
-
/**
|
|
191
|
-
* @description Building name of the address.
|
|
192
|
-
* @type string | undefined
|
|
193
|
-
*/
|
|
194
|
-
building_name?: string;
|
|
195
|
-
/**
|
|
196
|
-
* @description Floor number of the address.
|
|
197
|
-
* @type string | undefined
|
|
198
|
-
*/
|
|
199
|
-
floor_number?: string;
|
|
200
|
-
/**
|
|
201
|
-
* @description PO Box identifier of the address.
|
|
202
|
-
* @type string | undefined
|
|
203
|
-
*/
|
|
204
|
-
po_box_id?: string;
|
|
205
|
-
/**
|
|
206
|
-
* @description Full name associated with the address, for example company name.
|
|
207
|
-
* @type string | undefined
|
|
208
|
-
*/
|
|
209
|
-
name?: string;
|
|
210
|
-
/**
|
|
211
|
-
* @description Care of information associated with the address.
|
|
212
|
-
* @type string | undefined
|
|
213
|
-
*/
|
|
214
|
-
care_of?: string;
|
|
215
|
-
/**
|
|
216
|
-
* @description Represents a latitude/longitude pair.\nUnless specified otherwise, this must conform to the WGS84 standard.\nValues must be within normalized ranges.
|
|
217
|
-
* @type object | undefined
|
|
218
|
-
*/
|
|
219
|
-
coordinates?: AddressCoordinates;
|
|
220
|
-
};
|
|
221
|
-
|
|
222
141
|
/**
|
|
223
142
|
* @description Types of modifications the validation API made to the original address.
|
|
224
143
|
*/
|
|
@@ -231,23 +150,42 @@ declare type AddressChangeEnum =
|
|
|
231
150
|
| 'componentsAdded'
|
|
232
151
|
| 'componentsRemoved';
|
|
233
152
|
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
/**
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
153
|
+
declare type AddressContactEntry = {
|
|
154
|
+
/** The unique identifier of the contact entry. */
|
|
155
|
+
id?: string;
|
|
156
|
+
|
|
157
|
+
/** The name of the contact person. */
|
|
158
|
+
recipientName?: string;
|
|
159
|
+
|
|
160
|
+
/** The company name associated with the contact. */
|
|
161
|
+
companyName?: string;
|
|
162
|
+
|
|
163
|
+
/** The address of the contact. */
|
|
164
|
+
address?: Address_2;
|
|
165
|
+
|
|
166
|
+
/** The email address of the contact. */
|
|
167
|
+
email?: string;
|
|
168
|
+
|
|
169
|
+
/** The VAT number associated with the contact. */
|
|
170
|
+
vatNumber?: string;
|
|
171
|
+
|
|
172
|
+
/** The VAT type associated with the vat number, e.g. "SE_EU" or "GB_VAT" */
|
|
173
|
+
vatType?: string;
|
|
174
|
+
|
|
175
|
+
/** A phone number in E164 format, e.g. "+1234567890" */
|
|
176
|
+
phoneNumber?: string;
|
|
177
|
+
|
|
178
|
+
/** Additional form values associated with the contact */
|
|
179
|
+
additionalFormValues?: AddressContactEntryAdditionalFormValue[];
|
|
248
180
|
};
|
|
249
181
|
|
|
250
|
-
declare type
|
|
182
|
+
declare type AddressContactEntryAdditionalFormValue = {
|
|
183
|
+
/** The key under which the value is stored. Can be referenced in the form configuration */
|
|
184
|
+
formFieldKey: string;
|
|
185
|
+
|
|
186
|
+
/** The value of the form field. */
|
|
187
|
+
value: string;
|
|
188
|
+
};
|
|
251
189
|
|
|
252
190
|
/**
|
|
253
191
|
* @description Response containing the full address resolved from a prediction ID.
|
|
@@ -259,162 +197,104 @@ declare type AddressDetailsResponse = {
|
|
|
259
197
|
address: Address_2;
|
|
260
198
|
};
|
|
261
199
|
|
|
262
|
-
declare type AddressParticleInputState = DeepPartial<V1AlphaAddressContact>;
|
|
263
|
-
|
|
264
|
-
declare type AddressParticleParams = {
|
|
265
|
-
mode: 'postalCode' | 'addressForm';
|
|
266
|
-
prefillAddress?: RecipientContact;
|
|
267
|
-
customization?: {
|
|
268
|
-
address?: { vatTypes?: string[] };
|
|
269
|
-
addressBook?: { displayMode?: 'off' | 'inline' | 'popup' };
|
|
270
|
-
suggestions?: { displayMode?: 'inline' | 'popup' };
|
|
271
|
-
};
|
|
272
|
-
};
|
|
273
|
-
|
|
274
|
-
declare const addressParticleParamsValidator = z.object({
|
|
275
|
-
mode: z.enum(['postalCode', 'addressForm']),
|
|
276
|
-
prefillAddress: recipientContactValidator.optional(),
|
|
277
|
-
customization: z
|
|
278
|
-
.object({
|
|
279
|
-
address: z
|
|
280
|
-
.object({
|
|
281
|
-
vatTypes: z.array(z.string()).optional(), // TODO: TBD - we'll probably need multiselect input to handle this in the Playground
|
|
282
|
-
})
|
|
283
|
-
.optional(),
|
|
284
|
-
addressBook: z
|
|
285
|
-
.object({
|
|
286
|
-
displayMode: z.enum(['off', 'inline', 'popup']).optional(),
|
|
287
|
-
})
|
|
288
|
-
.optional(),
|
|
289
|
-
suggestions: z
|
|
290
|
-
.object({
|
|
291
|
-
displayMode: z.enum(['inline', 'popup']).optional(),
|
|
292
|
-
})
|
|
293
|
-
.optional(),
|
|
294
|
-
})
|
|
295
|
-
.optional(),
|
|
296
|
-
}) satisfies z.ZodType<AddressParticleParams>;
|
|
297
|
-
|
|
298
|
-
declare type AddressPresetParams = Pick<ParticleParamsMap['address'], 'mode' | 'prefillAddress'>;
|
|
299
|
-
|
|
300
200
|
/**
|
|
301
|
-
* @description
|
|
201
|
+
* @description Response containing the complete form configuration for a localized address form.\nIncludes field definitions, validation rules, and visual layout instructions.
|
|
302
202
|
*/
|
|
303
|
-
declare type
|
|
304
|
-
|
|
305
|
-
declare type AddressServiceCreateContactPathParams = {
|
|
203
|
+
declare type AddressFormResponse = {
|
|
306
204
|
/**
|
|
307
|
-
* @description
|
|
308
|
-
* @pattern [^/]+
|
|
309
|
-
* @type string
|
|
205
|
+
* @description Metadata about the form configuration including locale and text direction.
|
|
310
206
|
*/
|
|
311
|
-
|
|
312
|
-
};
|
|
313
|
-
|
|
314
|
-
/**
|
|
315
|
-
* @description A successful response.
|
|
316
|
-
*/
|
|
317
|
-
declare type AddressServiceDeleteContact200 = object;
|
|
318
|
-
|
|
319
|
-
declare type AddressServiceDeleteContactPathParams = {
|
|
207
|
+
meta: FormMeta;
|
|
320
208
|
/**
|
|
321
|
-
* @description
|
|
322
|
-
* @
|
|
323
|
-
* @type string
|
|
209
|
+
* @description Pre-filled values for the form fields.\nKeys correspond to the keys in the `fields` object.\nThis is often populated if a `postalCode` was sent in the request.
|
|
210
|
+
* @type object | undefined
|
|
324
211
|
*/
|
|
325
|
-
|
|
212
|
+
values?: object;
|
|
326
213
|
/**
|
|
327
|
-
* @description
|
|
328
|
-
* @
|
|
329
|
-
* @type string
|
|
214
|
+
* @description Dictionary defining the behavior of each input field.\nKeys are unique field identifiers (e.g., `postalCode`, `locality`).
|
|
215
|
+
* @type object
|
|
330
216
|
*/
|
|
331
|
-
|
|
332
|
-
};
|
|
333
|
-
|
|
334
|
-
declare type AddressServiceListContactsPathParams = {
|
|
217
|
+
fields: object;
|
|
335
218
|
/**
|
|
336
|
-
* @description
|
|
337
|
-
* @
|
|
338
|
-
* @type string
|
|
219
|
+
* @description Defines the visual grid of the form.\nClients should loop through this array to render the UI.\n- Outer array: Rows (stack vertically)\n- Inner array: Columns (stack horizontally / flex)
|
|
220
|
+
* @type array
|
|
339
221
|
*/
|
|
340
|
-
|
|
222
|
+
layout: string[][];
|
|
341
223
|
};
|
|
342
224
|
|
|
343
|
-
declare type
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
country_code?: string;
|
|
225
|
+
declare type AddressFormService = {
|
|
226
|
+
getAddressFormConfig: DataResolver<
|
|
227
|
+
{ params: GetAddressFormQuery['QueryParams'] } & SDKManagedTokenArg,
|
|
228
|
+
GetAddressFormQuery['Response']
|
|
229
|
+
>;
|
|
349
230
|
};
|
|
350
231
|
|
|
232
|
+
/* Excluded from this release type: AddressMoleculeCustomization */
|
|
233
|
+
|
|
351
234
|
/**
|
|
352
|
-
*
|
|
235
|
+
* Configuration params passed to the address molecule.
|
|
236
|
+
*
|
|
237
|
+
* @example
|
|
238
|
+
* ```ts
|
|
239
|
+
* const params: AddressMoleculeParams = {
|
|
240
|
+
* mode: 'addressForm',
|
|
241
|
+
* customization: {
|
|
242
|
+
* addressBook: { displayMode: 'popup' },
|
|
243
|
+
* suggestions: { displayMode: 'inline' },
|
|
244
|
+
* },
|
|
245
|
+
* };
|
|
246
|
+
* ```
|
|
353
247
|
*/
|
|
354
|
-
declare type
|
|
355
|
-
/**
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
*/
|
|
394
|
-
company_name?: string;
|
|
395
|
-
/**
|
|
396
|
-
* @description VAT number associated with the contact.
|
|
397
|
-
* @type string | undefined
|
|
398
|
-
*/
|
|
399
|
-
vat?: string;
|
|
400
|
-
/**
|
|
401
|
-
* @description Customs number associated with the contact.
|
|
402
|
-
* @type string | undefined
|
|
403
|
-
*/
|
|
404
|
-
customs_number?: string;
|
|
248
|
+
declare type AddressMoleculeParams = {
|
|
249
|
+
/** The rendering mode for the address molecule. Currently `'addressForm'` and `'searchDriven'` are supported. */
|
|
250
|
+
mode: 'addressForm' | 'searchDriven';
|
|
251
|
+
customization?: AddressMoleculePublicCustomization;
|
|
252
|
+
};
|
|
253
|
+
|
|
254
|
+
/* Excluded from this release type: addressMoleculeParamsValidator */
|
|
255
|
+
|
|
256
|
+
/* Excluded from this release type: AddressMoleculePrivateCustomization */
|
|
257
|
+
|
|
258
|
+
/**
|
|
259
|
+
* Customization flags - exposed to SDK consumers via {@link AddressMoleculeParams}.
|
|
260
|
+
*/
|
|
261
|
+
declare type AddressMoleculePublicCustomization = {
|
|
262
|
+
/** Customization options for the address book picker. */
|
|
263
|
+
addressBook?: {
|
|
264
|
+
/**
|
|
265
|
+
* Controls how the address book is presented.
|
|
266
|
+
*
|
|
267
|
+
* @defaultValue `'off'`
|
|
268
|
+
*/
|
|
269
|
+
displayMode?: 'off' | 'inline' | 'popup';
|
|
270
|
+
/**
|
|
271
|
+
* Controls how users select an address entry:
|
|
272
|
+
* `'radio'` renders a radio button on each entry, `'disabled'` hides it.
|
|
273
|
+
*
|
|
274
|
+
* @defaultValue `'radio'`
|
|
275
|
+
*/
|
|
276
|
+
selectionControl?: 'radio' | 'disabled';
|
|
277
|
+
};
|
|
278
|
+
/** Customization options for address autocomplete suggestions. */
|
|
279
|
+
suggestions?: {
|
|
280
|
+
/**
|
|
281
|
+
* Controls how address suggestions are presented.
|
|
282
|
+
*
|
|
283
|
+
* @defaultValue `'popup'`
|
|
284
|
+
*/
|
|
285
|
+
displayMode?: 'inline' | 'popup';
|
|
286
|
+
};
|
|
405
287
|
};
|
|
406
288
|
|
|
407
289
|
declare type AddressSuggestionsService = {
|
|
408
290
|
list: DataResolver<
|
|
409
|
-
{ params: AutocompleteAddressQuery['QueryParams']
|
|
291
|
+
{ params: AutocompleteAddressQuery['QueryParams'] } & SDKManagedTokenArg,
|
|
410
292
|
AutocompleteAddressQuery['Response']
|
|
411
293
|
>;
|
|
412
294
|
resolve: DataResolver<
|
|
413
295
|
{
|
|
414
|
-
params: GetAddressDetailsQuery['PathParams'];
|
|
415
|
-
|
|
416
|
-
siteId: string;
|
|
417
|
-
},
|
|
296
|
+
params: GetAddressDetailsQuery['PathParams'] & GetAddressDetailsQuery['QueryParams'];
|
|
297
|
+
} & SDKManagedTokenArg,
|
|
418
298
|
GetAddressDetailsQuery['Response']
|
|
419
299
|
>;
|
|
420
300
|
};
|
|
@@ -425,7 +305,7 @@ declare type AddressTypeEnum = 'unknown' | 'residential' | 'commercial';
|
|
|
425
305
|
|
|
426
306
|
declare type AddressValidationService = {
|
|
427
307
|
validateAddress: DataResolver<
|
|
428
|
-
{ payload: ValidateAddressMutation['Request']
|
|
308
|
+
{ payload: ValidateAddressMutation['Request'] } & SDKManagedTokenArg,
|
|
429
309
|
ValidateAddressMutation['Response']
|
|
430
310
|
>;
|
|
431
311
|
};
|
|
@@ -676,6 +556,11 @@ declare type AutocompleteAddressQueryParams = {
|
|
|
676
556
|
* @type string
|
|
677
557
|
*/
|
|
678
558
|
countryCode: CountryCode;
|
|
559
|
+
/**
|
|
560
|
+
* @description Site identifier, referring to which site the autocompletion is performed for.
|
|
561
|
+
* @type string
|
|
562
|
+
*/
|
|
563
|
+
siteId: string;
|
|
679
564
|
/**
|
|
680
565
|
* @description The text typed by the user. Ignored if `containerId` is provided.
|
|
681
566
|
* @type string | undefined
|
|
@@ -710,16 +595,10 @@ declare type AutocompleteFocusEnum =
|
|
|
710
595
|
*/
|
|
711
596
|
declare type BaseKey<K> = K extends `${infer B}_${Intl.LDMLPluralRule}` ? B : K;
|
|
712
597
|
|
|
713
|
-
|
|
714
|
-
* TODO: this will come from the site config most probably and
|
|
715
|
-
* the shape of the model will be different - for now it's kept as simple
|
|
716
|
-
* as possible for MVP purposes
|
|
717
|
-
*/
|
|
718
|
-
|
|
719
|
-
declare type BaseParticleDef<K extends ParticleType> = {
|
|
598
|
+
declare type BaseMoleculeDef<K extends MoleculeType> = {
|
|
720
599
|
type: K;
|
|
721
|
-
customization?:
|
|
722
|
-
params:
|
|
600
|
+
customization?: DeepPartial<MoleculeCustomizationConfig<K>>;
|
|
601
|
+
params: MoleculeParamsMap[K];
|
|
723
602
|
};
|
|
724
603
|
|
|
725
604
|
/**
|
|
@@ -743,57 +622,36 @@ declare type ContactPhoneNumber = {
|
|
|
743
622
|
extension?: string;
|
|
744
623
|
};
|
|
745
624
|
|
|
746
|
-
/**
|
|
747
|
-
* @description A phone number, including region and optional extension.
|
|
748
|
-
*/
|
|
749
|
-
declare type ContactPhoneNumber_2 = {
|
|
750
|
-
/**
|
|
751
|
-
* @description \nThe country code where the delivery will occur (ISO 3166-1 alpha-2).
|
|
752
|
-
* @type string
|
|
753
|
-
*/
|
|
754
|
-
country_code: string;
|
|
755
|
-
/**
|
|
756
|
-
* @description The main phone number, formatted as per the region\'s conventions.
|
|
757
|
-
* @type string
|
|
758
|
-
*/
|
|
759
|
-
number: string;
|
|
760
|
-
/**
|
|
761
|
-
* @description An optional phone number extension.
|
|
762
|
-
* @type string | undefined
|
|
763
|
-
*/
|
|
764
|
-
extension?: string;
|
|
765
|
-
};
|
|
766
|
-
|
|
767
625
|
declare type ContactsService = {
|
|
768
626
|
listContactBookEntries: DataResolver<
|
|
769
627
|
{
|
|
770
|
-
params:
|
|
771
|
-
|
|
772
|
-
|
|
628
|
+
params: {
|
|
629
|
+
addressBookId: string;
|
|
630
|
+
countryCode?: string;
|
|
631
|
+
};
|
|
632
|
+
} & SDKManagedTokenArg,
|
|
773
633
|
{
|
|
774
634
|
entries: { id: string; label: string; secondaryLabel: string }[];
|
|
775
635
|
}
|
|
776
636
|
>;
|
|
777
637
|
getContactBookEntry: DataResolver<
|
|
778
638
|
{
|
|
779
|
-
params: {
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
{ address: V1AlphaAddressContact } | null
|
|
639
|
+
params: { id: string; addressBookId: string };
|
|
640
|
+
} & SDKManagedTokenArg,
|
|
641
|
+
AddressContactEntry
|
|
783
642
|
>;
|
|
784
643
|
upsertContactBookEntry: DataResolver<
|
|
785
644
|
{
|
|
786
|
-
payload:
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
|
|
792
|
-
V1AlphaAddressContact
|
|
645
|
+
payload: AddressContactEntry;
|
|
646
|
+
params: {
|
|
647
|
+
addressBookId: string;
|
|
648
|
+
};
|
|
649
|
+
} & SDKManagedTokenArg,
|
|
650
|
+
AddressContactEntry
|
|
793
651
|
>;
|
|
794
652
|
deleteContactBookEntry: DataResolver<
|
|
795
|
-
{ params:
|
|
796
|
-
|
|
653
|
+
{ params: { addressBookId: string; id: string } } & SDKManagedTokenArg,
|
|
654
|
+
object
|
|
797
655
|
>;
|
|
798
656
|
};
|
|
799
657
|
|
|
@@ -813,9 +671,11 @@ declare type Coordinates = {
|
|
|
813
671
|
*/
|
|
814
672
|
declare type CountryCode = string;
|
|
815
673
|
|
|
816
|
-
declare
|
|
817
|
-
|
|
818
|
-
|
|
674
|
+
declare const countrySelectorMoleculeParamsValidator = z.object({
|
|
675
|
+
mode: z.enum(['select']),
|
|
676
|
+
name: z.string(),
|
|
677
|
+
customization: z.object({}).optional(),
|
|
678
|
+
}) satisfies z.ZodType<CountrySelectorParams>;
|
|
819
679
|
|
|
820
680
|
declare type CountrySelectorParams = {
|
|
821
681
|
mode: 'select';
|
|
@@ -823,96 +683,37 @@ declare type CountrySelectorParams = {
|
|
|
823
683
|
customization?: Record<never, never>;
|
|
824
684
|
};
|
|
825
685
|
|
|
826
|
-
|
|
827
|
-
|
|
828
|
-
|
|
829
|
-
|
|
830
|
-
|
|
831
|
-
|
|
832
|
-
|
|
833
|
-
|
|
834
|
-
|
|
835
|
-
|
|
836
|
-
|
|
686
|
+
/**
|
|
687
|
+
* Creates a molecule configuration for the address molecule.
|
|
688
|
+
*
|
|
689
|
+
* Renders an address form that collects and validates the shopper's shipping address.
|
|
690
|
+
*
|
|
691
|
+
* @param params - Configuration for the address molecule. See `AddressMoleculeParams`.
|
|
692
|
+
* @returns A molecule descriptor to pass to the `molecules` array in {@link IngridInitParams}.
|
|
693
|
+
*
|
|
694
|
+
* @example
|
|
695
|
+
* ```ts
|
|
696
|
+
* const instance = await ingrid.init({
|
|
697
|
+
* token: 'your-auth-token',
|
|
698
|
+
* siteId: 'your-site-id',
|
|
699
|
+
* locale: 'en-US',
|
|
700
|
+
* countryCode: 'US',
|
|
701
|
+
* currency: 'USD',
|
|
702
|
+
* molecules: [
|
|
703
|
+
* createAddressMolecule({
|
|
704
|
+
* mode: 'addressForm'
|
|
705
|
+
* }),
|
|
706
|
+
* ],
|
|
707
|
+
* });
|
|
708
|
+
* ```
|
|
709
|
+
*
|
|
710
|
+
* @public
|
|
711
|
+
*/
|
|
712
|
+
export declare const createAddressMolecule: ({ mode, customization }: MoleculeParamsMap["address"]) => {
|
|
837
713
|
type: "address";
|
|
838
|
-
customization:
|
|
839
|
-
address?: {
|
|
840
|
-
vatTypes?: string[];
|
|
841
|
-
};
|
|
842
|
-
addressBook?: {
|
|
843
|
-
displayMode?: "off" | "inline" | "popup";
|
|
844
|
-
};
|
|
845
|
-
suggestions?: {
|
|
846
|
-
displayMode?: "inline" | "popup";
|
|
847
|
-
};
|
|
848
|
-
} | undefined;
|
|
849
|
-
params: {
|
|
850
|
-
mode: "postalCode" | "addressForm";
|
|
851
|
-
prefillAddress: RecipientContact | undefined;
|
|
852
|
-
};
|
|
853
|
-
};
|
|
854
|
-
|
|
855
|
-
export declare const createCountrySelectorMolecule: ({ mode }: CountrySelectorPresetParams) => ({ name }: CountrySelectorDebugParams) => {
|
|
856
|
-
type: "countrySelector";
|
|
857
|
-
params: {
|
|
858
|
-
mode: "select";
|
|
859
|
-
name: string;
|
|
860
|
-
};
|
|
861
|
-
};
|
|
862
|
-
|
|
863
|
-
export declare const createDeliveryMolecule: ({ mode }: DeliveryPresetParams) => ({ name, customization }: DeliveryDebugParams) => {
|
|
864
|
-
type: "delivery";
|
|
865
|
-
customization: {
|
|
866
|
-
choice?: {
|
|
867
|
-
carrierInstructions?: "off" | "inline" | "popup";
|
|
868
|
-
gaplessAddonsList?: boolean;
|
|
869
|
-
gaplessCarrierList?: boolean;
|
|
870
|
-
gaplessDeliveryList?: boolean;
|
|
871
|
-
labels?: "off" | "chips" | "text";
|
|
872
|
-
showAddons?: boolean;
|
|
873
|
-
showCustomInfoText?: boolean;
|
|
874
|
-
showCustomText?: boolean;
|
|
875
|
-
showDiscountedPrice?: boolean;
|
|
876
|
-
showFreeShippingIndicator?: boolean;
|
|
877
|
-
showPrice?: boolean;
|
|
878
|
-
showRadioIndicator?: boolean;
|
|
879
|
-
showReturnPromise?: boolean;
|
|
880
|
-
showShippingLogo?: boolean;
|
|
881
|
-
};
|
|
882
|
-
location?: {
|
|
883
|
-
gaplessList?: boolean;
|
|
884
|
-
mapDefaultVisible?: boolean;
|
|
885
|
-
mapDefaultZoom?: number;
|
|
886
|
-
mapFitboundsMaxZoom?: number;
|
|
887
|
-
mapPosition?: "start" | "end";
|
|
888
|
-
mapToggleEnabled?: boolean;
|
|
889
|
-
};
|
|
890
|
-
productList?: {
|
|
891
|
-
defaultView?: "off" | "list" | "summary";
|
|
892
|
-
showImage?: boolean;
|
|
893
|
-
showMetadata?: boolean;
|
|
894
|
-
showPrice?: boolean;
|
|
895
|
-
showQuantity?: boolean;
|
|
896
|
-
summaryText?: "none" | "products" | "firstProductAndMore";
|
|
897
|
-
};
|
|
898
|
-
summary?: {
|
|
899
|
-
previewAddons?: boolean;
|
|
900
|
-
showFreeShippingIndicator?: boolean;
|
|
901
|
-
};
|
|
902
|
-
} | undefined;
|
|
714
|
+
customization: AddressMoleculePublicCustomization | undefined;
|
|
903
715
|
params: {
|
|
904
|
-
mode: "
|
|
905
|
-
name: string;
|
|
906
|
-
};
|
|
907
|
-
};
|
|
908
|
-
|
|
909
|
-
export declare const createFreeShippingIndicatorMolecule: () => ({ name, customization }: FreeShippingIndicatorDebugParams) => {
|
|
910
|
-
type: "freeShippingIndicator";
|
|
911
|
-
customization: {
|
|
912
|
-
showExhaustedLevelsMessage?: boolean;
|
|
913
|
-
} | undefined;
|
|
914
|
-
params: {
|
|
915
|
-
name: string;
|
|
716
|
+
mode: "addressForm" | "searchDriven";
|
|
916
717
|
};
|
|
917
718
|
};
|
|
918
719
|
|
|
@@ -989,8 +790,6 @@ declare type DeliveryAddon = {
|
|
|
989
790
|
readonly description?: string;
|
|
990
791
|
};
|
|
991
792
|
|
|
992
|
-
declare const deliveryArgsSchema = z.object({ sessionId: z.string(), token: z.string() });
|
|
993
|
-
|
|
994
793
|
/**
|
|
995
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.
|
|
996
795
|
* @default DELIVERY_TYPE_UNSPECIFIED
|
|
@@ -1060,11 +859,6 @@ declare type DeliveryCoordinates = {
|
|
|
1060
859
|
lng: number;
|
|
1061
860
|
};
|
|
1062
861
|
|
|
1063
|
-
declare interface DeliveryDebugParams {
|
|
1064
|
-
name: string;
|
|
1065
|
-
customization?: ParticleCustomizationConfig<'delivery'>;
|
|
1066
|
-
}
|
|
1067
|
-
|
|
1068
862
|
/**
|
|
1069
863
|
* @description The DeliveryCategory represents a grouping of delivery options that share the same type and other characteristics.
|
|
1070
864
|
*/
|
|
@@ -1385,6 +1179,55 @@ declare type DeliveryLineItem = {
|
|
|
1385
1179
|
attributes?: string[];
|
|
1386
1180
|
};
|
|
1387
1181
|
|
|
1182
|
+
declare type DeliveryMoleculeParams = {
|
|
1183
|
+
mode: 'active' | 'passive';
|
|
1184
|
+
name: string;
|
|
1185
|
+
customization?: {
|
|
1186
|
+
choice?: {
|
|
1187
|
+
carrierInstructions?: 'off' | 'inline' | 'popup';
|
|
1188
|
+
gaplessAddonsList?: boolean;
|
|
1189
|
+
gaplessCarrierList?: boolean;
|
|
1190
|
+
gaplessDeliveryList?: boolean;
|
|
1191
|
+
labels?: 'off' | 'chips' | 'text';
|
|
1192
|
+
showAddons?: boolean;
|
|
1193
|
+
showCustomInfoText?: boolean;
|
|
1194
|
+
showCustomText?: boolean;
|
|
1195
|
+
showDiscountedPrice?: boolean;
|
|
1196
|
+
showFreeShippingIndicator?: boolean;
|
|
1197
|
+
showPrice?: boolean;
|
|
1198
|
+
showRadioIndicator?: boolean;
|
|
1199
|
+
showReturnPromise?: boolean;
|
|
1200
|
+
showShippingLogo?: boolean;
|
|
1201
|
+
};
|
|
1202
|
+
location?: {
|
|
1203
|
+
gaplessList?: boolean;
|
|
1204
|
+
mapDefaultVisible?: boolean;
|
|
1205
|
+
mapDefaultZoom?: number;
|
|
1206
|
+
mapFitboundsMaxZoom?: number;
|
|
1207
|
+
mapPosition?: 'start' | 'end';
|
|
1208
|
+
mapToggleEnabled?: boolean;
|
|
1209
|
+
};
|
|
1210
|
+
productList?: {
|
|
1211
|
+
defaultView?: 'off' | 'list' | 'summary';
|
|
1212
|
+
showImage?: boolean;
|
|
1213
|
+
showMetadata?: boolean;
|
|
1214
|
+
showPrice?: boolean;
|
|
1215
|
+
showQuantity?: boolean;
|
|
1216
|
+
summaryText?: 'none' | 'products' | 'firstProductAndMore';
|
|
1217
|
+
};
|
|
1218
|
+
summary?: {
|
|
1219
|
+
previewAddons?: boolean;
|
|
1220
|
+
showFreeShippingIndicator?: boolean;
|
|
1221
|
+
};
|
|
1222
|
+
};
|
|
1223
|
+
};
|
|
1224
|
+
|
|
1225
|
+
declare const deliveryMoleculeParamsValidator = z.object({
|
|
1226
|
+
customization: deliveryCustomizationValidator,
|
|
1227
|
+
mode: z.enum(['active', 'passive']),
|
|
1228
|
+
name: z.string(),
|
|
1229
|
+
}) satisfies z.ZodType<DeliveryMoleculeParams>;
|
|
1230
|
+
|
|
1388
1231
|
/**
|
|
1389
1232
|
* @description Constraints on the node\'s handoff.
|
|
1390
1233
|
*/
|
|
@@ -1466,67 +1309,6 @@ declare type DeliveryOptionOrigin = {
|
|
|
1466
1309
|
external_id?: string;
|
|
1467
1310
|
};
|
|
1468
1311
|
|
|
1469
|
-
declare type DeliveryParticleParams = {
|
|
1470
|
-
mode: 'active' | 'passive';
|
|
1471
|
-
name: string;
|
|
1472
|
-
customization?: {
|
|
1473
|
-
choice?: {
|
|
1474
|
-
carrierInstructions?: 'off' | 'inline' | 'popup';
|
|
1475
|
-
gaplessAddonsList?: boolean;
|
|
1476
|
-
gaplessCarrierList?: boolean;
|
|
1477
|
-
gaplessDeliveryList?: boolean;
|
|
1478
|
-
labels?: 'off' | 'chips' | 'text';
|
|
1479
|
-
showAddons?: boolean;
|
|
1480
|
-
showCustomInfoText?: boolean;
|
|
1481
|
-
showCustomText?: boolean;
|
|
1482
|
-
showDiscountedPrice?: boolean;
|
|
1483
|
-
showFreeShippingIndicator?: boolean;
|
|
1484
|
-
showPrice?: boolean;
|
|
1485
|
-
showRadioIndicator?: boolean;
|
|
1486
|
-
showReturnPromise?: boolean;
|
|
1487
|
-
showShippingLogo?: boolean;
|
|
1488
|
-
};
|
|
1489
|
-
location?: {
|
|
1490
|
-
gaplessList?: boolean;
|
|
1491
|
-
mapDefaultVisible?: boolean;
|
|
1492
|
-
mapDefaultZoom?: number;
|
|
1493
|
-
mapFitboundsMaxZoom?: number;
|
|
1494
|
-
mapPosition?: 'start' | 'end';
|
|
1495
|
-
mapToggleEnabled?: boolean;
|
|
1496
|
-
};
|
|
1497
|
-
productList?: {
|
|
1498
|
-
defaultView?: 'off' | 'list' | 'summary';
|
|
1499
|
-
showImage?: boolean;
|
|
1500
|
-
showMetadata?: boolean;
|
|
1501
|
-
showPrice?: boolean;
|
|
1502
|
-
showQuantity?: boolean;
|
|
1503
|
-
summaryText?: 'none' | 'products' | 'firstProductAndMore';
|
|
1504
|
-
};
|
|
1505
|
-
summary?: {
|
|
1506
|
-
previewAddons?: boolean;
|
|
1507
|
-
showFreeShippingIndicator?: boolean;
|
|
1508
|
-
};
|
|
1509
|
-
};
|
|
1510
|
-
};
|
|
1511
|
-
|
|
1512
|
-
declare const deliveryParticleParamsValidator = z.object({
|
|
1513
|
-
customization: deliveryCustomizationValidator,
|
|
1514
|
-
|
|
1515
|
-
// TODO: the passive `mode` has hardcoded logic, but IMHO the behaviour should come from granular config (components + policies), not from `mode` branches.
|
|
1516
|
-
// Just an simple example:
|
|
1517
|
-
// components: {
|
|
1518
|
-
// continue_button: { display: 'hidden' },
|
|
1519
|
-
// pickup_location: { display: 'popup', interaction: 'preview' // or edit }
|
|
1520
|
-
// }
|
|
1521
|
-
//
|
|
1522
|
-
// actionPolicy: {
|
|
1523
|
-
// select_item: 'deny'
|
|
1524
|
-
// }
|
|
1525
|
-
//
|
|
1526
|
-
mode: z.enum(['active', 'passive']),
|
|
1527
|
-
name: z.string(),
|
|
1528
|
-
}) satisfies z.ZodType<DeliveryParticleParams>;
|
|
1529
|
-
|
|
1530
1312
|
/**
|
|
1531
1313
|
* @description The PickupLocation represents a physical location from which a delivery can be retrieved.
|
|
1532
1314
|
*/
|
|
@@ -1578,10 +1360,6 @@ declare type DeliveryPickupLocation = {
|
|
|
1578
1360
|
distances?: PickupLocationDistances;
|
|
1579
1361
|
};
|
|
1580
1362
|
|
|
1581
|
-
declare interface DeliveryPresetParams {
|
|
1582
|
-
mode: ParticleParamsMap['delivery']['mode'];
|
|
1583
|
-
}
|
|
1584
|
-
|
|
1585
1363
|
/**
|
|
1586
1364
|
* @description ReturnPromise contains promise for returns and exchanges for a user and a cart.
|
|
1587
1365
|
*/
|
|
@@ -1819,9 +1597,24 @@ declare type ETDTimeUnitEnum =
|
|
|
1819
1597
|
|
|
1820
1598
|
declare type Event_2<T> = { payload: T };
|
|
1821
1599
|
|
|
1822
|
-
|
|
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 = {
|
|
1823
1616
|
countryChange: (event: Event_2<{ country_code: string }>) => void;
|
|
1824
|
-
addressSubmit: (event: Event_2<
|
|
1617
|
+
addressSubmit: (event: Event_2<Partial<AddressContactEntry>>) => void;
|
|
1825
1618
|
selectionChange: (event: Event_2<{ deliveryId: string; categoryId: string }>) => void;
|
|
1826
1619
|
ready: () => void;
|
|
1827
1620
|
error: (error: unknown) => void;
|
|
@@ -1839,20 +1632,26 @@ declare type ExceptionStatus = {
|
|
|
1839
1632
|
status?: string;
|
|
1840
1633
|
};
|
|
1841
1634
|
|
|
1842
|
-
|
|
1843
|
-
|
|
1844
|
-
|
|
1845
|
-
|
|
1846
|
-
|
|
1847
|
-
|
|
1848
|
-
|
|
1849
|
-
|
|
1850
|
-
|
|
1851
|
-
|
|
1852
|
-
|
|
1635
|
+
/**
|
|
1636
|
+
* @description Metadata about the form configuration.
|
|
1637
|
+
*/
|
|
1638
|
+
declare type FormMeta = {
|
|
1639
|
+
/**
|
|
1640
|
+
* @description ISO 3166-1 alpha-2 country code for this form configuration.
|
|
1641
|
+
*/
|
|
1642
|
+
countryCode: CountryCode;
|
|
1643
|
+
/**
|
|
1644
|
+
* @description Text direction. `rtl` (Right-to-Left) is critical for\nlanguages like Arabic or Hebrew.
|
|
1645
|
+
*/
|
|
1646
|
+
direction: TextDirection;
|
|
1647
|
+
/**
|
|
1648
|
+
* @description IETF language tag for the localized labels.
|
|
1649
|
+
* @type string
|
|
1650
|
+
*/
|
|
1651
|
+
language: string;
|
|
1853
1652
|
};
|
|
1854
1653
|
|
|
1855
|
-
declare const
|
|
1654
|
+
declare const freeShippingIndicatorMoleculeParamsValidator = z.object({
|
|
1856
1655
|
name: z.string(),
|
|
1857
1656
|
deliveryId: z.string().optional(),
|
|
1858
1657
|
customization: z
|
|
@@ -1862,6 +1661,14 @@ declare const freeShippingIndicatorParticleParamsValidator = z.object({
|
|
|
1862
1661
|
.optional(),
|
|
1863
1662
|
}) satisfies z.ZodType<FreeShippingIndicatorParams>;
|
|
1864
1663
|
|
|
1664
|
+
declare type FreeShippingIndicatorParams = {
|
|
1665
|
+
name: string;
|
|
1666
|
+
deliveryId?: string;
|
|
1667
|
+
customization?: {
|
|
1668
|
+
showExhaustedLevelsMessage?: boolean;
|
|
1669
|
+
};
|
|
1670
|
+
};
|
|
1671
|
+
|
|
1865
1672
|
/**
|
|
1866
1673
|
* @description Readiness specifies a time range when the goods will be ready for shipment.
|
|
1867
1674
|
*/
|
|
@@ -1909,12 +1716,63 @@ declare type GetAddressDetailsPathParams = {
|
|
|
1909
1716
|
declare type GetAddressDetailsQuery = {
|
|
1910
1717
|
Response: GetAddressDetails200;
|
|
1911
1718
|
PathParams: GetAddressDetailsPathParams;
|
|
1719
|
+
QueryParams: GetAddressDetailsQueryParams;
|
|
1912
1720
|
Errors: GetAddressDetails400 | GetAddressDetails404 | GetAddressDetails500;
|
|
1913
1721
|
};
|
|
1914
1722
|
|
|
1915
|
-
declare type
|
|
1723
|
+
declare type GetAddressDetailsQueryParams = {
|
|
1724
|
+
/**
|
|
1725
|
+
* @description Site identifier, referring to which site the address is resolved for.
|
|
1726
|
+
* @type string
|
|
1727
|
+
*/
|
|
1728
|
+
siteId: string;
|
|
1729
|
+
};
|
|
1730
|
+
|
|
1731
|
+
/**
|
|
1732
|
+
* @description The request has succeeded.
|
|
1733
|
+
*/
|
|
1734
|
+
declare type GetAddressForm200 = AddressFormResponse;
|
|
1735
|
+
|
|
1736
|
+
/**
|
|
1737
|
+
* @description The server could not understand the request due to invalid syntax.
|
|
1738
|
+
*/
|
|
1739
|
+
declare type GetAddressForm400 = AtlasErrorsBadRequestError;
|
|
1740
|
+
|
|
1741
|
+
/**
|
|
1742
|
+
* @description Server error
|
|
1743
|
+
*/
|
|
1744
|
+
declare type GetAddressForm500 = AtlasErrorsServerError;
|
|
1745
|
+
|
|
1746
|
+
declare type GetAddressFormQuery = {
|
|
1747
|
+
Response: GetAddressForm200;
|
|
1748
|
+
QueryParams: GetAddressFormQueryParams;
|
|
1749
|
+
Errors: GetAddressForm400 | GetAddressForm500;
|
|
1750
|
+
};
|
|
1751
|
+
|
|
1752
|
+
declare type GetAddressFormQueryParams = {
|
|
1753
|
+
/**
|
|
1754
|
+
* @description ISO 3166-1 alpha-2 country code (e.g., SE, US, GB).
|
|
1755
|
+
* @pattern ^[A-Z]{2}$
|
|
1756
|
+
* @type string
|
|
1757
|
+
*/
|
|
1758
|
+
countryCode: CountryCode;
|
|
1759
|
+
/**
|
|
1760
|
+
* @description Site identifier, referring to which site the form configurations are related to.
|
|
1761
|
+
* @type string
|
|
1762
|
+
*/
|
|
1763
|
+
siteId: string;
|
|
1764
|
+
/**
|
|
1765
|
+
* @description Optional postal code. If provided, the response `values` object\nmay contain pre-filled city/state data.
|
|
1766
|
+
* @type string | undefined
|
|
1767
|
+
*/
|
|
1768
|
+
postalCode?: string;
|
|
1769
|
+
};
|
|
1770
|
+
|
|
1771
|
+
declare type GetDeliverySessionArgs = { sessionId: string } & SDKManagedTokenArg;
|
|
1916
1772
|
|
|
1917
|
-
declare type GetTrackingDataArgs =
|
|
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
|
/**
|
|
@@ -1947,19 +1805,144 @@ declare type GetTrackingDataResponseOptions = {
|
|
|
1947
1805
|
ica_bankid_flow?: boolean;
|
|
1948
1806
|
};
|
|
1949
1807
|
|
|
1950
|
-
|
|
1951
|
-
|
|
1952
|
-
|
|
1953
|
-
|
|
1954
|
-
|
|
1955
|
-
|
|
1956
|
-
|
|
1957
|
-
|
|
1808
|
+
/**
|
|
1809
|
+
* The Ingrid SDK namespace.
|
|
1810
|
+
*
|
|
1811
|
+
* @example
|
|
1812
|
+
* ```ts
|
|
1813
|
+
* const instance = await ingrid.init({
|
|
1814
|
+
* token: 'your-auth-token',
|
|
1815
|
+
* siteId: 'your-site-id',
|
|
1816
|
+
* locale: 'en-US',
|
|
1817
|
+
* countryCode: 'US',
|
|
1818
|
+
* currency: 'USD',
|
|
1819
|
+
* molecules: [createAddressMolecule({ mode: 'addressForm' })],
|
|
1820
|
+
* });
|
|
1821
|
+
*
|
|
1822
|
+
* await instance.compound.mount('#ingrid-container');
|
|
1823
|
+
* ```
|
|
1824
|
+
*
|
|
1825
|
+
* @public
|
|
1826
|
+
*/
|
|
1827
|
+
declare const ingrid: {
|
|
1828
|
+
/**
|
|
1829
|
+
* Initializes the Ingrid Experience Kit.
|
|
1830
|
+
*
|
|
1831
|
+
* Fetches the remote release index and site configuration, bootstraps SDK state,
|
|
1832
|
+
* and returns an {@link IngridInstance} ready to mount into the DOM.
|
|
1833
|
+
*
|
|
1834
|
+
* @param params - See {@link IngridInitParams}.
|
|
1835
|
+
* @returns A promise resolving to an {@link IngridInstance}.
|
|
1836
|
+
*
|
|
1837
|
+
* @public
|
|
1838
|
+
*/
|
|
1839
|
+
init: typeof init;
|
|
1840
|
+
};
|
|
1841
|
+
export default ingrid;
|
|
1842
|
+
|
|
1843
|
+
/**
|
|
1844
|
+
* The compound instance returned by `ingrid.init`, used to control the lifecycle
|
|
1845
|
+
* of the rendered Ingrid experience.
|
|
1846
|
+
*
|
|
1847
|
+
* @public
|
|
1848
|
+
*/
|
|
1849
|
+
export declare interface IngridCompound {
|
|
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
|
+
*/
|
|
1858
|
+
mount(containerSelector: string, options?: {
|
|
1859
|
+
signal?: AbortSignal;
|
|
1860
|
+
}): Promise<void>;
|
|
1861
|
+
/** Unmounts the rendered experience and cleans up all resources. */
|
|
1862
|
+
unmount(callback?: () => void): void;
|
|
1863
|
+
/** Updates runtime configuration of the mounted experience. */
|
|
1864
|
+
update(newConfig: Partial<UpdatableConfig>): void;
|
|
1865
|
+
/**
|
|
1866
|
+
* Subscribes to an SDK event. See {@link EventsMap} for available events and their payloads.
|
|
1867
|
+
*
|
|
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.
|
|
1871
|
+
*/
|
|
1872
|
+
on<K extends keyof EventsMap>(event: K, callback: EventsMap[K]): () => boolean;
|
|
1873
|
+
}
|
|
1874
|
+
|
|
1875
|
+
/**
|
|
1876
|
+
* Configuration passed to {@link ingrid.init}.
|
|
1877
|
+
*
|
|
1878
|
+
* @example
|
|
1879
|
+
* ```ts
|
|
1880
|
+
* const instance = await ingrid.init({
|
|
1881
|
+
* token: 'your-auth-token',
|
|
1882
|
+
* siteId: 'your-site-id',
|
|
1883
|
+
* countryCode: 'US',
|
|
1884
|
+
* currency: 'USD',
|
|
1885
|
+
* locale: 'en-US',
|
|
1886
|
+
* molecules: [createAddressMolecule({ mode: 'addressForm' })],
|
|
1887
|
+
* });
|
|
1888
|
+
* ```
|
|
1889
|
+
*
|
|
1890
|
+
* @public
|
|
1891
|
+
*/
|
|
1892
|
+
export declare interface IngridInitParams {
|
|
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>;
|
|
1901
|
+
/** Ingrid site identifier. */
|
|
1902
|
+
siteId: string;
|
|
1903
|
+
/** The locale to use for the experience. */
|
|
1904
|
+
locale: Locale;
|
|
1905
|
+
/** ISO 3166-1 alpha-2 country code for the market (e.g. `'SE'`, `'DE'`). */
|
|
1906
|
+
countryCode: string;
|
|
1907
|
+
/** ISO 4217 currency code for the market (e.g. `'SEK'`, `'EUR'`). */
|
|
1908
|
+
currency: string;
|
|
1909
|
+
/** Configuration for the molecules to render. */
|
|
1910
|
+
molecules: MoleculesConfig;
|
|
1911
|
+
/** Optional design token overrides for the experience's visual appearance. */
|
|
1912
|
+
styles?: StyleTokens;
|
|
1913
|
+
/** Optional overrides for the internal data-fetching services. */
|
|
1914
|
+
dataProviders?: {
|
|
1915
|
+
services?: ServicesOverrides;
|
|
1958
1916
|
};
|
|
1959
|
-
|
|
1960
|
-
|
|
1961
|
-
|
|
1962
|
-
|
|
1917
|
+
/**
|
|
1918
|
+
* Deployment environment.
|
|
1919
|
+
*
|
|
1920
|
+
* @defaultValue `'production'`
|
|
1921
|
+
*/
|
|
1922
|
+
env?: 'production' | 'stage';
|
|
1923
|
+
}
|
|
1924
|
+
|
|
1925
|
+
/**
|
|
1926
|
+
* The object returned by {@link ingrid.init}, providing control over the Ingrid experience lifecycle.
|
|
1927
|
+
*
|
|
1928
|
+
* @public
|
|
1929
|
+
*/
|
|
1930
|
+
export declare interface IngridInstance {
|
|
1931
|
+
/** The compound instance used to mount, unmount, and update the Ingrid experience. */
|
|
1932
|
+
compound: IngridCompound;
|
|
1933
|
+
/**
|
|
1934
|
+
* Updates the active locale for the experience.
|
|
1935
|
+
* If the locale is not supported, falls back to `'en-US'`.
|
|
1936
|
+
*/
|
|
1937
|
+
setLocale(locale: Locale): void;
|
|
1938
|
+
/** Updates the active purchase country code. */
|
|
1939
|
+
setPurchaseCountry(countryCode: string): void;
|
|
1940
|
+
/** Updates the active currency. */
|
|
1941
|
+
setCurrency(currency: string): void;
|
|
1942
|
+
/* Excluded from this release type: __internal */
|
|
1943
|
+
}
|
|
1944
|
+
|
|
1945
|
+
declare function init(params: IngridInitParams): Promise<IngridInstance>;
|
|
1963
1946
|
|
|
1964
1947
|
declare const _internalBrand: unique symbol;
|
|
1965
1948
|
|
|
@@ -2181,13 +2164,43 @@ declare type LocationByValue = {
|
|
|
2181
2164
|
display_name?: string;
|
|
2182
2165
|
};
|
|
2183
2166
|
|
|
2184
|
-
declare type MethodOverrides<T> = {
|
|
2185
|
-
[K in keyof T]?: T[K] extends (...args: any[]) => any ? T[K] |
|
|
2167
|
+
export declare type MethodOverrides<T> = {
|
|
2168
|
+
[K in keyof T]?: T[K] extends (...args: any[]) => any ? T[K] | WithDefaultProvider<T[K]> : never;
|
|
2169
|
+
};
|
|
2170
|
+
|
|
2171
|
+
declare type MoleculeCustomizationConfig<T extends MoleculeType> = MoleculeCustomizationConfigMap[T];
|
|
2172
|
+
|
|
2173
|
+
declare type MoleculeCustomizationConfigMap = {
|
|
2174
|
+
address: AddressMoleculeCustomization;
|
|
2175
|
+
countrySelector: CountrySelectorParams['customization'];
|
|
2176
|
+
delivery: DeliveryMoleculeParams['customization'];
|
|
2177
|
+
freeShippingIndicator: FreeShippingIndicatorParams['customization'];
|
|
2178
|
+
tracking: TrackingNumberParams['customization'];
|
|
2179
|
+
};
|
|
2180
|
+
|
|
2181
|
+
declare type MoleculeMapType = {
|
|
2182
|
+
address: { readonly validator: typeof addressMoleculeParamsValidator };
|
|
2183
|
+
countrySelector: { readonly validator: typeof countrySelectorMoleculeParamsValidator };
|
|
2184
|
+
delivery: { readonly validator: typeof deliveryMoleculeParamsValidator };
|
|
2185
|
+
freeShippingIndicator: {
|
|
2186
|
+
readonly validator: typeof freeShippingIndicatorMoleculeParamsValidator;
|
|
2187
|
+
};
|
|
2188
|
+
tracking: { readonly validator: typeof trackingNumberParamsValidator };
|
|
2189
|
+
};
|
|
2190
|
+
|
|
2191
|
+
declare type MoleculeParamsMap = {
|
|
2192
|
+
address: AddressMoleculeParams;
|
|
2193
|
+
countrySelector: CountrySelectorParams;
|
|
2194
|
+
delivery: DeliveryMoleculeParams;
|
|
2195
|
+
freeShippingIndicator: FreeShippingIndicatorParams;
|
|
2196
|
+
tracking: TrackingNumberParams;
|
|
2186
2197
|
};
|
|
2187
2198
|
|
|
2188
2199
|
declare type MoleculesConfig = {
|
|
2189
|
-
[K in
|
|
2190
|
-
}[
|
|
2200
|
+
[K in MoleculeType]: BaseMoleculeDef<K>;
|
|
2201
|
+
}[MoleculeType][];
|
|
2202
|
+
|
|
2203
|
+
declare type MoleculeType = keyof MoleculeMapType;
|
|
2191
2204
|
|
|
2192
2205
|
declare type OperationalHours = {
|
|
2193
2206
|
/**
|
|
@@ -2351,18 +2364,6 @@ declare type OrderCartPricesTotals = {
|
|
|
2351
2364
|
tax?: number;
|
|
2352
2365
|
};
|
|
2353
2366
|
|
|
2354
|
-
export declare interface Params {
|
|
2355
|
-
styles?: StyleTokens;
|
|
2356
|
-
dataProviders?: {
|
|
2357
|
-
services?: ServicesOverrides;
|
|
2358
|
-
};
|
|
2359
|
-
token: string;
|
|
2360
|
-
siteId: string;
|
|
2361
|
-
locale: Locale;
|
|
2362
|
-
molecules: MoleculesConfig;
|
|
2363
|
-
env?: 'production' | 'stage' | 'development';
|
|
2364
|
-
}
|
|
2365
|
-
|
|
2366
2367
|
declare type Parcel = {
|
|
2367
2368
|
/**
|
|
2368
2369
|
* @type array | undefined
|
|
@@ -2449,36 +2450,6 @@ declare type Parcel = {
|
|
|
2449
2450
|
tracking_number?: string;
|
|
2450
2451
|
};
|
|
2451
2452
|
|
|
2452
|
-
declare type ParticleCustomizationConfig<T extends ParticleType> = ParticleCustomizationConfigMap[T];
|
|
2453
|
-
|
|
2454
|
-
declare type ParticleCustomizationConfigMap = {
|
|
2455
|
-
address: AddressParticleParams['customization'];
|
|
2456
|
-
countrySelector: CountrySelectorParams['customization'];
|
|
2457
|
-
delivery: DeliveryParticleParams['customization'];
|
|
2458
|
-
freeShippingIndicator: FreeShippingIndicatorParams['customization'];
|
|
2459
|
-
tracking: TrackingNumberParams['customization'];
|
|
2460
|
-
};
|
|
2461
|
-
|
|
2462
|
-
declare type ParticleMapType = {
|
|
2463
|
-
address: { readonly validator: typeof addressParticleParamsValidator };
|
|
2464
|
-
countrySelector: { readonly validator: typeof countrySelectorParticleParamsValidator };
|
|
2465
|
-
delivery: { readonly validator: typeof deliveryParticleParamsValidator };
|
|
2466
|
-
freeShippingIndicator: {
|
|
2467
|
-
readonly validator: typeof freeShippingIndicatorParticleParamsValidator;
|
|
2468
|
-
};
|
|
2469
|
-
tracking: { readonly validator: typeof trackingNumberParamsValidator };
|
|
2470
|
-
};
|
|
2471
|
-
|
|
2472
|
-
declare type ParticleParamsMap = {
|
|
2473
|
-
address: AddressParticleParams;
|
|
2474
|
-
countrySelector: CountrySelectorParams;
|
|
2475
|
-
delivery: DeliveryParticleParams;
|
|
2476
|
-
freeShippingIndicator: FreeShippingIndicatorParams;
|
|
2477
|
-
tracking: TrackingNumberParams;
|
|
2478
|
-
};
|
|
2479
|
-
|
|
2480
|
-
declare type ParticleType = keyof ParticleMapType;
|
|
2481
|
-
|
|
2482
2453
|
/**
|
|
2483
2454
|
* @description Distances define the walking and driving distances to the pickup location.
|
|
2484
2455
|
*/
|
|
@@ -2680,6 +2651,7 @@ declare type RawTranslationKey =
|
|
|
2680
2651
|
| 'address.delete'
|
|
2681
2652
|
| 'address.delete_confirmation.banner.content'
|
|
2682
2653
|
| 'address.delete_confirmation.banner.title'
|
|
2654
|
+
| 'address.delete_confirmation.warning_text'
|
|
2683
2655
|
| 'address.edit'
|
|
2684
2656
|
| 'address.edit.billing.aria.label'
|
|
2685
2657
|
| 'address.edit.delivery.aria.label'
|
|
@@ -2726,6 +2698,7 @@ declare type RawTranslationKey =
|
|
|
2726
2698
|
| 'address.form.field.vat.label'
|
|
2727
2699
|
| 'address.form.field.vat_type.label'
|
|
2728
2700
|
| 'address.form.field_optional'
|
|
2701
|
+
| 'address.form.search.enter_manually'
|
|
2729
2702
|
| 'address.form.validation.address_line.invalid'
|
|
2730
2703
|
| 'address.form.validation.phone_number.invalid'
|
|
2731
2704
|
| 'address.form.validation.postal_code.invalid'
|
|
@@ -2734,8 +2707,12 @@ declare type RawTranslationKey =
|
|
|
2734
2707
|
| 'address.form.validation.street_number.required'
|
|
2735
2708
|
| 'address.form.vat_other_country'
|
|
2736
2709
|
| 'address.list.add_new_address'
|
|
2710
|
+
| 'address.list.save'
|
|
2737
2711
|
| 'address.list.save_and_continue'
|
|
2738
2712
|
| 'address.list.title'
|
|
2713
|
+
| 'address.popup.address_form.title'
|
|
2714
|
+
| 'address.popup.deleting.title'
|
|
2715
|
+
| 'address.popup.list.title'
|
|
2739
2716
|
| 'address.save'
|
|
2740
2717
|
| 'address.save_anyway'
|
|
2741
2718
|
| 'address.suggestion.address_incorrect.description'
|
|
@@ -2856,31 +2833,17 @@ declare type RawTranslationKey =
|
|
|
2856
2833
|
| 'time.wednesday'
|
|
2857
2834
|
| 'tracking.track_delivery_with';
|
|
2858
2835
|
|
|
2859
|
-
declare type RecipientContact = {
|
|
2860
|
-
first_name?: string;
|
|
2861
|
-
last_name?: string;
|
|
2862
|
-
contact_id?: string;
|
|
2863
|
-
address: {
|
|
2864
|
-
country_code: string;
|
|
2865
|
-
region_code?: string;
|
|
2866
|
-
postal_code?: string;
|
|
2867
|
-
city?: string;
|
|
2868
|
-
address_lines?: string[];
|
|
2869
|
-
};
|
|
2870
|
-
email?: string;
|
|
2871
|
-
phone_number?: {
|
|
2872
|
-
country_code: string;
|
|
2873
|
-
number: string;
|
|
2874
|
-
extension?: string;
|
|
2875
|
-
};
|
|
2876
|
-
};
|
|
2877
|
-
|
|
2878
2836
|
declare type RecursiveObjectValues<T> = T extends object ? RecursiveObjectValues<T[keyof T]> : T;
|
|
2879
2837
|
|
|
2880
2838
|
declare interface SDKInternal {
|
|
2881
2839
|
readonly [_internalBrand]: never;
|
|
2882
2840
|
}
|
|
2883
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
|
+
|
|
2884
2847
|
/**
|
|
2885
2848
|
* @description Response containing a list of address predictions from the autocomplete endpoint.
|
|
2886
2849
|
*/
|
|
@@ -2935,17 +2898,44 @@ declare type Services = {
|
|
|
2935
2898
|
formatMessage: TranslationsService['formatMessage'];
|
|
2936
2899
|
registerTranslations: TranslationsService['registerTranslations'];
|
|
2937
2900
|
};
|
|
2901
|
+
/**
|
|
2902
|
+
* Services for contact book management, address autocomplete, and address validation.
|
|
2903
|
+
*
|
|
2904
|
+
* @example
|
|
2905
|
+
* ```ts
|
|
2906
|
+
* const entries = await services.address.listContactBookEntries({
|
|
2907
|
+
* params: { addressBookId: 'book_123' },
|
|
2908
|
+
* });
|
|
2909
|
+
* ```
|
|
2910
|
+
*/
|
|
2938
2911
|
address: {
|
|
2912
|
+
/** Fetches a paginated list of address book entries for the given address book. */
|
|
2939
2913
|
listContactBookEntries: ContactsService['listContactBookEntries'];
|
|
2914
|
+
/** Fetches a single address book entry by ID. Returns `null` if not found. */
|
|
2940
2915
|
getContactBookEntry: ContactsService['getContactBookEntry'];
|
|
2916
|
+
/** Creates or updates an address book entry. */
|
|
2941
2917
|
upsertContactBookEntry: ContactsService['upsertContactBookEntry'];
|
|
2918
|
+
/** Deletes an address book entry. */
|
|
2942
2919
|
deleteContactBookEntry: ContactsService['deleteContactBookEntry'];
|
|
2920
|
+
/** Fetches a list of address autocomplete suggestions matching a partial query. */
|
|
2943
2921
|
listSuggestions: AddressSuggestionsService['list'];
|
|
2922
|
+
/** Resolves the full address details for a selected autocomplete suggestion. */
|
|
2944
2923
|
resolveSuggestion: AddressSuggestionsService['resolve'];
|
|
2924
|
+
/** Validates an address against the backend validation service. */
|
|
2945
2925
|
validateAddress: AddressValidationService['validateAddress'];
|
|
2926
|
+
/** Fetches configuration for rendering the address form for a specific country. */
|
|
2927
|
+
getAddressFormConfig: AddressFormService['getAddressFormConfig'];
|
|
2946
2928
|
};
|
|
2947
2929
|
};
|
|
2948
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
|
+
*/
|
|
2949
2939
|
export declare type ServicesOverrides = {
|
|
2950
2940
|
[Domain in keyof Services]?: MethodOverrides<Services[Domain]>;
|
|
2951
2941
|
};
|
|
@@ -3021,12 +3011,26 @@ declare type StepEnum =
|
|
|
3021
3011
|
|
|
3022
3012
|
declare type StyleTokens = Partial<Record<ThemeCssVariables, string>>;
|
|
3023
3013
|
|
|
3014
|
+
/**
|
|
3015
|
+
* @description Text direction for form rendering.
|
|
3016
|
+
*/
|
|
3017
|
+
declare type TextDirection = TextDirectionEnum;
|
|
3018
|
+
|
|
3019
|
+
declare type TextDirectionEnum = 'ltr' | 'rtl';
|
|
3020
|
+
|
|
3024
3021
|
declare type ThemeCssVariables = `--${RecursiveObjectValues<typeof variableNames>}`;
|
|
3025
3022
|
|
|
3026
|
-
|
|
3027
|
-
|
|
3028
|
-
|
|
3029
|
-
|
|
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
|
+
};
|
|
3030
3034
|
|
|
3031
3035
|
declare type TrackingData = GetTrackingDataResponse;
|
|
3032
3036
|
|
|
@@ -3055,71 +3059,15 @@ declare type TranslationsService = {
|
|
|
3055
3059
|
) => void;
|
|
3056
3060
|
};
|
|
3057
3061
|
|
|
3058
|
-
/** @public */
|
|
3059
|
-
declare interface UpdatableConfig {
|
|
3060
|
-
styles?: StyleTokens;
|
|
3061
|
-
}
|
|
3062
|
-
|
|
3063
3062
|
/**
|
|
3064
|
-
*
|
|
3063
|
+
* Runtime configuration that can be updated on a mounted compound via {@link IngridCompound.update}.
|
|
3064
|
+
*
|
|
3065
|
+
* @public
|
|
3065
3066
|
*/
|
|
3066
|
-
declare
|
|
3067
|
-
/**
|
|
3068
|
-
|
|
3069
|
-
|
|
3070
|
-
*/
|
|
3071
|
-
contact_id?: string;
|
|
3072
|
-
/**
|
|
3073
|
-
* @description Represents an address suitable for delivery.
|
|
3074
|
-
* @type object
|
|
3075
|
-
*/
|
|
3076
|
-
address: AddressAddress;
|
|
3077
|
-
/**
|
|
3078
|
-
* @description The email address of the contact.
|
|
3079
|
-
* @type string | undefined
|
|
3080
|
-
*/
|
|
3081
|
-
email?: string;
|
|
3082
|
-
/**
|
|
3083
|
-
* @description A phone number, including region and optional extension.
|
|
3084
|
-
* @type object | undefined
|
|
3085
|
-
*/
|
|
3086
|
-
phone_number?: ContactPhoneNumber_2;
|
|
3087
|
-
/**
|
|
3088
|
-
* @description Full name associated with the contact.
|
|
3089
|
-
* @type string | undefined
|
|
3090
|
-
*/
|
|
3091
|
-
name?: string;
|
|
3092
|
-
/**
|
|
3093
|
-
* @description First name associated with the contact.
|
|
3094
|
-
* @type string | undefined
|
|
3095
|
-
*/
|
|
3096
|
-
first_name?: string;
|
|
3097
|
-
/**
|
|
3098
|
-
* @description Last name associated with the contact.
|
|
3099
|
-
* @type string | undefined
|
|
3100
|
-
*/
|
|
3101
|
-
last_name?: string;
|
|
3102
|
-
/**
|
|
3103
|
-
* @description National ID number associated with the contact.
|
|
3104
|
-
* @type string | undefined
|
|
3105
|
-
*/
|
|
3106
|
-
national_id_number?: string;
|
|
3107
|
-
/**
|
|
3108
|
-
* @description Company name associated with the contact.
|
|
3109
|
-
* @type string | undefined
|
|
3110
|
-
*/
|
|
3111
|
-
company_name?: string;
|
|
3112
|
-
/**
|
|
3113
|
-
* @description VAT number associated with the contact.
|
|
3114
|
-
* @type string | undefined
|
|
3115
|
-
*/
|
|
3116
|
-
vat?: string;
|
|
3117
|
-
/**
|
|
3118
|
-
* @description Customs number associated with the contact.
|
|
3119
|
-
* @type string | undefined
|
|
3120
|
-
*/
|
|
3121
|
-
customs_number?: string;
|
|
3122
|
-
};
|
|
3067
|
+
export declare interface UpdatableConfig {
|
|
3068
|
+
/** Design token overrides to apply to the rendered experience without remounting. */
|
|
3069
|
+
styles?: StyleTokens;
|
|
3070
|
+
}
|
|
3123
3071
|
|
|
3124
3072
|
/**
|
|
3125
3073
|
* @description Represents an address suitable for delivery.
|
|
@@ -3271,6 +3219,11 @@ declare type ValidateAddressMutationRequest = ValidateAddressRequest;
|
|
|
3271
3219
|
* @description Request to validate and standardize an address.
|
|
3272
3220
|
*/
|
|
3273
3221
|
declare type ValidateAddressRequest = {
|
|
3222
|
+
/**
|
|
3223
|
+
* @description Site identifier, referring to which site we validate the address for.
|
|
3224
|
+
* @type string
|
|
3225
|
+
*/
|
|
3226
|
+
siteId: string;
|
|
3274
3227
|
/**
|
|
3275
3228
|
* @description The address to validate against postal reference data.
|
|
3276
3229
|
*/
|
|
@@ -3491,6 +3444,7 @@ declare const variableNames: {
|
|
|
3491
3444
|
readonly '350': "size-350";
|
|
3492
3445
|
readonly '400': "size-400";
|
|
3493
3446
|
readonly '600': "size-600";
|
|
3447
|
+
readonly '700': "size-700";
|
|
3494
3448
|
readonly '800': "size-800";
|
|
3495
3449
|
readonly '1000': "size-1000";
|
|
3496
3450
|
readonly '1200': "size-1200";
|
|
@@ -3559,11 +3513,48 @@ declare type VerificationLevel = VerificationLevelEnum;
|
|
|
3559
3513
|
|
|
3560
3514
|
declare type VerificationLevelEnum = 'premise' | 'street' | 'locality' | 'none';
|
|
3561
3515
|
|
|
3562
|
-
|
|
3563
|
-
|
|
3516
|
+
/**
|
|
3517
|
+
* Opaque wrapper produced by {@link withDefaultProvider}.
|
|
3518
|
+
* Carries a factory that receives the SDK's built-in implementation and returns the override.
|
|
3519
|
+
*
|
|
3520
|
+
* @public
|
|
3521
|
+
*/
|
|
3522
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
3523
|
+
declare type WithDefaultProvider<T extends (...args: any[]) => any> = {
|
|
3524
|
+
readonly __tag: 'withDefaultProvider';
|
|
3564
3525
|
readonly factory: (defaultFn: T) => T;
|
|
3565
3526
|
};
|
|
3566
3527
|
|
|
3567
|
-
|
|
3528
|
+
/**
|
|
3529
|
+
* Wraps a service method override so it has access to the SDK's built-in implementation.
|
|
3530
|
+
* Use this instead of a plain function replacement when you want to extend the default
|
|
3531
|
+
* behaviour (e.g. add logging, modify the response) rather than replace it entirely.
|
|
3532
|
+
*
|
|
3533
|
+
* @param factory - Receives the SDK's default implementation as `defaultFn`.
|
|
3534
|
+
* Return a new function that calls `defaultFn` wherever you want the original behaviour.
|
|
3535
|
+
* @returns A `WithDefaultProvider` wrapper understood by the SDK's service resolver.
|
|
3536
|
+
*
|
|
3537
|
+
* @example
|
|
3538
|
+
* ```ts
|
|
3539
|
+
* const instance = await ingrid.init({
|
|
3540
|
+
* // ...
|
|
3541
|
+
* dataProviders: {
|
|
3542
|
+
* services: {
|
|
3543
|
+
* address: {
|
|
3544
|
+
* listSuggestions: withDefaultProvider((defaultFn) => async (args) => {
|
|
3545
|
+
* console.log('Fetching suggestions for', args.params);
|
|
3546
|
+
* const result = await defaultFn(args);
|
|
3547
|
+
* console.log('Got', result.length, 'suggestions');
|
|
3548
|
+
* return result;
|
|
3549
|
+
* }),
|
|
3550
|
+
* },
|
|
3551
|
+
* },
|
|
3552
|
+
* },
|
|
3553
|
+
* });
|
|
3554
|
+
* ```
|
|
3555
|
+
*
|
|
3556
|
+
* @public
|
|
3557
|
+
*/
|
|
3558
|
+
export declare const withDefaultProvider: <T extends (...args: any[]) => any>(factory: (defaultFn: T) => T) => WithDefaultProvider<T>;
|
|
3568
3559
|
|
|
3569
3560
|
export { }
|