react-shopwave-connect 0.4.5 → 0.4.7

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.
@@ -94,9 +94,10 @@ declare function apiSend<T>(path: string, method: "POST" | "PUT", payload: unkno
94
94
  /**
95
95
  * DELETE helper. Shopwave answers deletes with 205 and an empty body; if a body
96
96
  * does come back and carries API errors, they are thrown. Returns the parsed
97
- * body (`null` when empty).
97
+ * body (`null` when empty). `extras`, when given, travel in the `extras` header
98
+ * (the server forwards only keys its delete route allows).
98
99
  */
99
- declare function apiDelete(path: string, options?: RequestOptions): Promise<unknown>;
100
+ declare function apiDelete(path: string, options?: RequestOptions, extras?: Extras): Promise<unknown>;
100
101
  //#endregion
101
102
  //#region src/core/errors.d.ts
102
103
  /** Map of Shopwave API errors as found in `api.message.errors`, keyed by error code. */
@@ -360,6 +361,42 @@ declare function fetchProductTags(options?: RequestOptions): Promise<string[]>;
360
361
  */
361
362
  declare function fetchProductInstanceTags(options?: RequestOptions): Promise<string[]>;
362
363
  //#endregion
364
+ //#region src/core/store.d.ts
365
+ interface Store {
366
+ id: number;
367
+ lat: number;
368
+ lng: number;
369
+ addressLine1: string;
370
+ addressLine2: string | null;
371
+ addressLine3: string;
372
+ phoneNumber: string;
373
+ city: string;
374
+ postcode: string;
375
+ countryId: number | null;
376
+ timezoneId: number | null;
377
+ storeDeleteDate: string | null;
378
+ email: string | null;
379
+ sandbox: boolean | null;
380
+ }
381
+ interface StoreResponse {
382
+ stores: {
383
+ [key: number]: Store;
384
+ };
385
+ api: apiResponse;
386
+ }
387
+ interface FetchStoresParams {
388
+ /** Optional id filter. */
389
+ storeIds?: Array<number>;
390
+ /** Whether to include soft-deleted records. Defaults to `false`. */
391
+ deleted?: boolean;
392
+ /** @deprecated Pass `options.token` instead. Sent the same way (Authorization header). */
393
+ token?: string;
394
+ }
395
+ /**
396
+ * Fetches stores. Returns the flattened `Store[]`.
397
+ */
398
+ declare function fetchStores(params?: FetchStoresParams, options?: RequestOptions): Promise<Store[]>;
399
+ //#endregion
363
400
  //#region src/core/promotion.d.ts
364
401
  /** Promotion rule identifiers as stored by the Shopwave API. */
365
402
  declare enum PromotionRuleSet {
@@ -413,147 +450,6 @@ interface FetchPromotionsParams {
413
450
  */
414
451
  declare function fetchPromotions(params?: FetchPromotionsParams, options?: RequestOptions): Promise<Promotion[]>;
415
452
  //#endregion
416
- //#region src/core/store.d.ts
417
- interface Store {
418
- id: number;
419
- lat: number;
420
- lng: number;
421
- addressLine1: string;
422
- addressLine2: string | null;
423
- addressLine3: string;
424
- phoneNumber: string;
425
- city: string;
426
- postcode: string;
427
- countryId: number | null;
428
- timezoneId: number | null;
429
- storeDeleteDate: string | null;
430
- email: string | null;
431
- sandbox: boolean | null;
432
- }
433
- interface StoreResponse {
434
- stores: {
435
- [key: number]: Store;
436
- };
437
- api: apiResponse;
438
- }
439
- interface FetchStoresParams {
440
- /** Optional id filter. */
441
- storeIds?: Array<number>;
442
- /** Whether to include soft-deleted records. Defaults to `false`. */
443
- deleted?: boolean;
444
- /** @deprecated Pass `options.token` instead. Sent the same way (Authorization header). */
445
- token?: string;
446
- }
447
- /**
448
- * Fetches stores. Returns the flattened `Store[]`.
449
- */
450
- declare function fetchStores(params?: FetchStoresParams, options?: RequestOptions): Promise<Store[]>;
451
- //#endregion
452
- //#region src/core/report.d.ts
453
- interface ReportKey {
454
- name: string;
455
- type: string;
456
- item?: ReportKey[];
457
- }
458
- interface ReportData {
459
- keys: ReportKey[];
460
- data: any[][];
461
- }
462
- interface ReportResponse {
463
- reports: {
464
- [key: string]: ReportData;
465
- };
466
- api: apiResponse;
467
- }
468
- interface ReportQuery {
469
- FROM: string;
470
- WHERE?: {
471
- AND?: string[];
472
- OR?: string[];
473
- };
474
- SELECT?: string[];
475
- LIMIT?: number;
476
- OFFSET?: number;
477
- }
478
- interface ReportQueryMap {
479
- [key: string]: ReportQuery;
480
- }
481
- /**
482
- * Runs one or more report queries and returns the `reports` map keyed by query
483
- * name. The query is JSON-encoded into the `extras.query` header, matching the
484
- * original endpoint contract.
485
- */
486
- declare function fetchReport(query: ReportQueryMap, options?: RequestOptions): Promise<ReportResponse["reports"]>;
487
- //#endregion
488
- //#region src/core/session.d.ts
489
- /**
490
- * Login status returned by the app's `/api/session` route. It deliberately
491
- * never contains tokens — those stay in the encrypted httpOnly cookie.
492
- */
493
- interface SessionStatus {
494
- loggedIn: boolean;
495
- /** Access-token expiry (epoch ms), when known. */
496
- expiresAt?: number;
497
- }
498
- /**
499
- * Reads the current login status from `GET /api/session`.
500
- *
501
- * Works with the new `react-shopwave-connect/next` session route
502
- * (`{ loggedIn }`) and with older routes that returned the raw session
503
- * (`{ token: {...} }`) — in that case only a boolean is surfaced.
504
- */
505
- declare function fetchSession(options?: RequestOptions): Promise<SessionStatus>;
506
- /**
507
- * Path that starts a login and returns to `returnTo` afterwards.
508
- * Navigate the browser to it (`window.location.href = loginPath(...)`).
509
- */
510
- declare function loginPath(returnTo?: string, authPath?: string): string;
511
- /** Path that logs out of the app and the Shopwave auth server. */
512
- declare function logoutPath(authPath?: string): string;
513
- /**
514
- * Ends the current server session (no redirect).
515
- *
516
- * Prefer navigating to {@link logoutPath} when using
517
- * `react-shopwave-connect/next`: it also signs the user out of the auth server.
518
- */
519
- declare function logout(options?: RequestOptions): Promise<void>;
520
- //#endregion
521
- //#region src/core/entity.d.ts
522
- /**
523
- * Low-level, untyped mutations: the caller supplies the route and payload.
524
- *
525
- * Prefer the typed functions in `./entities` (`saveProduct`, `deleteCategory`,
526
- * …): they know each route, build the request envelope, check the response and
527
- * return the saved entity with its id. Keep these for routes that have no typed
528
- * function yet (e.g. `/api/merchant`).
529
- */
530
- /**
531
- * Deletes `/api/{resourcePath}/{entityId}`.
532
- */
533
- declare function deleteEntity(resourcePath: string, entityId: number | string, options?: RequestOptions): Promise<void>;
534
- interface SubmitEntityArgs {
535
- /** Fully-resolved endpoint, e.g. `/api/products` or `/api/products/42`. */
536
- endpoint: string;
537
- /** Defaults to PUT when an `entityId` exists, otherwise POST. */
538
- method?: "POST" | "PUT";
539
- /** The request payload (already transformed by the caller). */
540
- payload: unknown;
541
- }
542
- interface SubmitEntityResponse<R = any> {
543
- result?: R;
544
- [key: string]: unknown;
545
- }
546
- /**
547
- * Sends a create/update mutation. Returns the response's `result` field when it
548
- * has one (older app routes wrapped their answer that way), otherwise the whole
549
- * parsed response body. Throws `ShopwaveApiError` on HTTP or API errors.
550
- */
551
- declare function submitEntity<R = any>({
552
- endpoint,
553
- method,
554
- payload
555
- }: SubmitEntityArgs, options?: RequestOptions): Promise<R | undefined>;
556
- //#endregion
557
453
  //#region src/core/entities.d.ts
558
454
  /**
559
455
  * How each Shopwave entity is addressed, shared by the client functions below
@@ -596,8 +492,15 @@ interface EntityDefinition {
596
492
  * start = end and the record is expired without ever running.
597
493
  */
598
494
  retireStartField?: string;
495
+ /**
496
+ * Header naming child records to delete instead of the whole record
497
+ * (`productComponentInstanceIds: 1,2`). Only `item()` DELETE uses it, and only when
498
+ * the caller's `extras` carry this one key (a non-empty list of ids); every other
499
+ * `extras` key is still dropped. Only for `deleteMode: "delete"`.
500
+ */
501
+ childIdsHeader?: string;
599
502
  }
600
- type EntityKind = "product" | "category" | "store" | "promotion" | "employee" | "consumer";
503
+ type EntityKind = "product" | "category" | "store" | "promotion" | "employee" | "consumer" | "productComponent";
601
504
  /** Entities that can be created/updated through the API. */
602
505
  type WritableEntityKind = Exclude<EntityKind, "consumer">;
603
506
  /** Entities that can be deleted (or retired) through the API. */
@@ -614,6 +517,27 @@ type DeletableEntityKind = Exclude<EntityKind, "consumer">;
614
517
  * - employee: POST updates `roleId`, `joinedDate`, `exitDate` (names can't be
615
518
  * changed); no DELETE (live API: "Cannot DELETE /employee") → retired via `exitDate`.
616
519
  * - consumer: read-only (`GET` with `ids`, comma-separated); live POST → 404.
520
+ * - productComponent: modifier groups, `/product/component` (live, staging, 11 Nov 2026). The
521
+ * API reference lists no read filters; these are what the live API does:
522
+ * - Reads filter by `componentIds` (group ids) or `productIds` (the parent product; option
523
+ * products don't match). `productComponentIds` is ignored on reads: every group comes back.
524
+ * `deleted: false` gives live groups only, `true` deleted groups only, no header both.
525
+ * No match → 204 with an empty body. No order, sort, priority or position field anywhere.
526
+ * - Groups are keyed by id; `products` (option products) by product id; `productInstances`
527
+ * (option rows) by row id. Reads reformat values: price `"100"` → `"100.0"`,
528
+ * vatPercentage `"0.2000"` → `"0.200"`. `tags` and `name` are stored as sent (no trimming;
529
+ * a `tags` array is joined with commas; `tags` null or left out → null).
530
+ * - POST upserts (201, echoed under the ref). For each option product in `products`, its rows
531
+ * are replaced: every row sent is created afresh with a new id (a row `id` is ignored, also
532
+ * on a price change) and rows left out are removed. Option products left out of the save
533
+ * are untouched, and an empty `productInstances` removes nothing. A save without `products`
534
+ * updates only the group's own fields. The echo isn't proof of what was stored: renames of
535
+ * groups created moments earlier by a test run echoed the new name but never stuck (re-read
536
+ * for 90 s), while older groups, and groups created in Shopwave's own admin, renamed at
537
+ * once. Cause not yet known.
538
+ * - DELETE with `productComponentIds` (plural, comma list) → 205, soft delete. Adding
539
+ * `productComponentInstanceIds` deletes just those rows (205); they stay in live reads with
540
+ * `deleteDate` set. The singular `productComponentId` hangs (504 after 60 s).
617
541
  */
618
542
  declare const SHOPWAVE_ENTITIES: Readonly<Record<EntityKind, EntityDefinition>>;
619
543
  interface EntityTypes {
@@ -623,6 +547,7 @@ interface EntityTypes {
623
547
  promotion: Promotion;
624
548
  employee: Employee;
625
549
  consumer: Consumer;
550
+ productComponent: ProductComponent;
626
551
  }
627
552
  /**
628
553
  * What a save accepts: any subset of the entity's fields (plus extra API
@@ -710,6 +635,228 @@ declare const deleteEmployee: (id: EntityId, options?: RequestOptions) => Promis
710
635
  declare const fetchEmployee: (id: EntityId, params?: FetchByIdParams, options?: RequestOptions) => Promise<Employee | null>;
711
636
  declare const fetchConsumer: (id: EntityId, params?: FetchByIdParams, options?: RequestOptions) => Promise<Consumer | null>;
712
637
  //#endregion
638
+ //#region src/core/productComponent.d.ts
639
+ /**
640
+ * Product components are modifier groups: a group belongs to a parent product
641
+ * (`productId`) and offers other products as options. Each option product has
642
+ * one or more option rows (`productInstances`). See `SHOPWAVE_ENTITIES.productComponent`
643
+ * for what the live API does on reads, saves and deletes.
644
+ */
645
+ /** One option row of a product component. */
646
+ interface ProductComponentInstance {
647
+ id: number;
648
+ /** Name override for the option; `null` or `""` means the product's own name. Stored as sent. */
649
+ name: string | null;
650
+ /** Price as a decimal string, pence excluding VAT (reads return `"100.0"` for `"100"`). */
651
+ price: string;
652
+ /** VAT as a fraction string (`"0.200"`). */
653
+ vatPercentage: string;
654
+ quantity: number;
655
+ /** Comma-separated price tags, or `null`. Stored as sent (not trimmed). */
656
+ tags: string | null;
657
+ size?: string | null;
658
+ activeDate?: string | null;
659
+ /** Set once the row has been deleted; deleted rows still appear in live reads. */
660
+ deleteDate?: string | null;
661
+ }
662
+ /** A product offered as an option in a product component, with its option rows. */
663
+ interface ProductComponentProduct {
664
+ id: number;
665
+ name: string;
666
+ barcode?: string | null;
667
+ details?: string | null;
668
+ unit?: number | null;
669
+ activeDate?: string | null;
670
+ /** Option rows, keyed by row id on reads. */
671
+ productInstances: Record<string, ProductComponentInstance>;
672
+ }
673
+ /** A product component (modifier group). */
674
+ interface ProductComponent {
675
+ id: number;
676
+ name: string;
677
+ /** The parent product the group belongs to. */
678
+ productId: number;
679
+ minQuantity: number;
680
+ maxQuantity: number;
681
+ productTimestamp?: string;
682
+ /** Set once the group has been deleted (only `deleted: true` reads return it then). */
683
+ deleteDate?: string | null;
684
+ /** Option products, keyed by product id. */
685
+ products: Record<string, ProductComponentProduct>;
686
+ }
687
+ /** An option row as a caller holds it: every field optional, `tags` also as a list. */
688
+ type ProductComponentInstanceInput = Partial<Omit<ProductComponentInstance, "tags">> & {
689
+ tags?: string | ReadonlyArray<string> | null;
690
+ };
691
+ /** An option product as a caller holds it: rows keyed (as read) or as a list. */
692
+ type ProductComponentProductInput = Partial<Omit<ProductComponentProduct, "productInstances">> & {
693
+ productInstances?: Readonly<Record<string, ProductComponentInstanceInput>> | ReadonlyArray<ProductComponentInstanceInput>;
694
+ };
695
+ /**
696
+ * What {@link saveProductComponent} accepts. Include `id` to update; leave it out to create.
697
+ * `products` may be keyed by product id (as read) or a list.
698
+ */
699
+ type ProductComponentSaveInput = Partial<Omit<ProductComponent, "products">> & {
700
+ products?: Readonly<Record<string, ProductComponentProductInput>> | ReadonlyArray<ProductComponentProductInput>;
701
+ [field: string]: unknown;
702
+ };
703
+ /**
704
+ * Builds the save body for a product component from a group as read (or as a form holds it):
705
+ * - `products` keyed by product id (a product without `id` takes its key);
706
+ * - each product's rows keyed `"0"`, `"1"`, …, like every other ref in a save;
707
+ * - rows that have a `deleteDate` are left out: the API recreates every row it's sent, so
708
+ * sending one back would bring a deleted option back as a new row;
709
+ * - server row fields (`id`, `activeDate`, `deleteDate`, `timestamp`) are removed, since the
710
+ * API gives every row it's sent a new id anyway;
711
+ * - a `tags` list becomes a comma string.
712
+ *
713
+ * The API replaces the rows of every option product in the save and leaves the others alone,
714
+ * so send all the rows to keep for each product included. To remove an option product
715
+ * entirely, delete its rows with {@link deleteProductComponentInstances}.
716
+ */
717
+ declare function toProductComponentForSave(input: ProductComponentSaveInput): Record<string, unknown>;
718
+ interface FetchProductComponentsParams {
719
+ /** Parent products whose groups to read. */
720
+ productIds?: ReadonlyArray<number | string>;
721
+ /** Groups to read, by id. */
722
+ productComponentIds?: ReadonlyArray<number | string>;
723
+ /** `false` (default): live groups only. `true`: deleted groups only. */
724
+ deleted?: boolean;
725
+ }
726
+ /**
727
+ * Reads product components, optionally filtered by parent product and/or group id.
728
+ * With no filter it returns every group on the merchant. Returns `[]` when nothing matches
729
+ * (the API answers 204), and when a filter list is empty (no request is made).
730
+ *
731
+ * Rows deleted with {@link deleteProductComponentInstances} are still returned, with
732
+ * `deleteDate` set; skip them when listing options.
733
+ */
734
+ declare function fetchProductComponents(params?: FetchProductComponentsParams, options?: RequestOptions): Promise<ProductComponent[]>;
735
+ /**
736
+ * Reads one product component by id, or `null` when there's no such live group.
737
+ * Note that `{ deleted: true }` returns the group only if it *has* been deleted.
738
+ */
739
+ declare const fetchProductComponent: (id: EntityId, params?: FetchByIdParams, options?: RequestOptions) => Promise<ProductComponent | null>;
740
+ /**
741
+ * Creates (no `id`) or updates (with `id`) a product component and returns it with its id.
742
+ * The body is built with {@link toProductComponentForSave}. Every option row sent is stored
743
+ * under a new id, so re-read with {@link fetchProductComponent} for the stored rows.
744
+ */
745
+ declare const saveProductComponent: (input: ProductComponentSaveInput, options?: RequestOptions) => Promise<Saved<ProductComponent>>;
746
+ /** Deletes a product component (soft delete: `deleted: true` reads still return it). */
747
+ declare const deleteProductComponent: (id: EntityId, options?: RequestOptions) => Promise<void>;
748
+ /**
749
+ * Deletes some option rows of a product component, leaving the group and its other rows.
750
+ * The rows stay in reads with `deleteDate` set. Throws without calling the API when
751
+ * `instanceIds` is empty, because a delete without them would delete the whole group.
752
+ */
753
+ declare function deleteProductComponentInstances(id: EntityId, instanceIds: ReadonlyArray<number | string>, options?: RequestOptions): Promise<void>;
754
+ //#endregion
755
+ //#region src/core/report.d.ts
756
+ interface ReportKey {
757
+ name: string;
758
+ type: string;
759
+ item?: ReportKey[];
760
+ }
761
+ interface ReportData {
762
+ keys: ReportKey[];
763
+ data: any[][];
764
+ }
765
+ interface ReportResponse {
766
+ reports: {
767
+ [key: string]: ReportData;
768
+ };
769
+ api: apiResponse;
770
+ }
771
+ interface ReportQuery {
772
+ FROM: string;
773
+ WHERE?: {
774
+ AND?: string[];
775
+ OR?: string[];
776
+ };
777
+ SELECT?: string[];
778
+ LIMIT?: number;
779
+ OFFSET?: number;
780
+ }
781
+ interface ReportQueryMap {
782
+ [key: string]: ReportQuery;
783
+ }
784
+ /**
785
+ * Runs one or more report queries and returns the `reports` map keyed by query
786
+ * name. The query is JSON-encoded into the `extras.query` header, matching the
787
+ * original endpoint contract.
788
+ */
789
+ declare function fetchReport(query: ReportQueryMap, options?: RequestOptions): Promise<ReportResponse["reports"]>;
790
+ //#endregion
791
+ //#region src/core/session.d.ts
792
+ /**
793
+ * Login status returned by the app's `/api/session` route. It deliberately
794
+ * never contains tokens — those stay in the encrypted httpOnly cookie.
795
+ */
796
+ interface SessionStatus {
797
+ loggedIn: boolean;
798
+ /** Access-token expiry (epoch ms), when known. */
799
+ expiresAt?: number;
800
+ }
801
+ /**
802
+ * Reads the current login status from `GET /api/session`.
803
+ *
804
+ * Works with the new `react-shopwave-connect/next` session route
805
+ * (`{ loggedIn }`) and with older routes that returned the raw session
806
+ * (`{ token: {...} }`) — in that case only a boolean is surfaced.
807
+ */
808
+ declare function fetchSession(options?: RequestOptions): Promise<SessionStatus>;
809
+ /**
810
+ * Path that starts a login and returns to `returnTo` afterwards.
811
+ * Navigate the browser to it (`window.location.href = loginPath(...)`).
812
+ */
813
+ declare function loginPath(returnTo?: string, authPath?: string): string;
814
+ /** Path that logs out of the app and the Shopwave auth server. */
815
+ declare function logoutPath(authPath?: string): string;
816
+ /**
817
+ * Ends the current server session (no redirect).
818
+ *
819
+ * Prefer navigating to {@link logoutPath} when using
820
+ * `react-shopwave-connect/next`: it also signs the user out of the auth server.
821
+ */
822
+ declare function logout(options?: RequestOptions): Promise<void>;
823
+ //#endregion
824
+ //#region src/core/entity.d.ts
825
+ /**
826
+ * Low-level, untyped mutations: the caller supplies the route and payload.
827
+ *
828
+ * Prefer the typed functions in `./entities` (`saveProduct`, `deleteCategory`,
829
+ * …): they know each route, build the request envelope, check the response and
830
+ * return the saved entity with its id. Keep these for routes that have no typed
831
+ * function yet (e.g. `/api/merchant`).
832
+ */
833
+ /**
834
+ * Deletes `/api/{resourcePath}/{entityId}`.
835
+ */
836
+ declare function deleteEntity(resourcePath: string, entityId: number | string, options?: RequestOptions): Promise<void>;
837
+ interface SubmitEntityArgs {
838
+ /** Fully-resolved endpoint, e.g. `/api/products` or `/api/products/42`. */
839
+ endpoint: string;
840
+ /** Defaults to PUT when an `entityId` exists, otherwise POST. */
841
+ method?: "POST" | "PUT";
842
+ /** The request payload (already transformed by the caller). */
843
+ payload: unknown;
844
+ }
845
+ interface SubmitEntityResponse<R = any> {
846
+ result?: R;
847
+ [key: string]: unknown;
848
+ }
849
+ /**
850
+ * Sends a create/update mutation. Returns the response's `result` field when it
851
+ * has one (older app routes wrapped their answer that way), otherwise the whole
852
+ * parsed response body. Throws `ShopwaveApiError` on HTTP or API errors.
853
+ */
854
+ declare function submitEntity<R = any>({
855
+ endpoint,
856
+ method,
857
+ payload
858
+ }: SubmitEntityArgs, options?: RequestOptions): Promise<R | undefined>;
859
+ //#endregion
713
860
  //#region src/core/basket.d.ts
714
861
  interface BasketItem {
715
862
  productId: number;
@@ -850,8 +997,8 @@ declare const UPLOAD_KINDS: Readonly<Record<UploadKind, string>>;
850
997
  /**
851
998
  * The role an image plays, sent to Shopwave as the uploader's `prefix` header.
852
999
  * The uploader names the file `<prefix>_<hash>.<ext>`, so the role travels with
853
- * the file wherever a record stores it (a product's `images`). Live, merchant
854
- * 5644, 4 Nov 2026: all four values answered 201.
1000
+ * the file wherever a record stores it (a product's `images`). Live, test
1001
+ * merchant, 4 Nov 2026: all four values answered 201.
855
1002
  * - `product`: a product gallery image;
856
1003
  * - `product_thumbnail`: the product's lead image, shown in lists;
857
1004
  * - `variant` / `variant_thumbnail`: a variant's own image and its lead image
@@ -892,7 +1039,7 @@ declare function isUploadPrefix(value: unknown): value is UploadPrefix;
892
1039
  * on the merchant's products. No parameters. The API reference says
893
1040
  * "internal SKU tags are excluded", but the live API includes system tags
894
1041
  * written by imports and syncs (`PID-133`, `VID-137`, `#Hash:…`, `upc-…`;
895
- * test merchant 5644, 29 Oct 2026). Apps that offer the list as suggestions
1042
+ * a test merchant, 29 Oct 2026). Apps that offer the list as suggestions
896
1043
  * filter those themselves. Tags of deleted products drop out of the list.
897
1044
  * - productInstanceTags: `GET /product/instance/tags` → `{ tags: string[] }`,
898
1045
  * the same for price instances (channels such as "Eat In", "Takeout").
@@ -1079,7 +1226,7 @@ declare const SHOPWAVE_IMAGE_BASE_URL = "https://s3-eu-west-1.amazonaws.com/stat
1079
1226
  /**
1080
1227
  * Turns an image path from the API into a URL a page can load over HTTPS:
1081
1228
  * `http://static.merchantstack.com/images/x.png` → `<base>/x.png`, and a
1082
- * relative path (`merchant/5644/logo/x.png`) → `<base>/merchant/5644/logo/x.png`.
1229
+ * relative path (`merchant/123/logo/x.png`) → `<base>/merchant/123/logo/x.png`.
1083
1230
  * Other absolute URLs are returned unchanged; empty input gives `""`.
1084
1231
  */
1085
1232
  declare function getImageUrl(path: string | null | undefined, base?: string): string;
@@ -1095,7 +1242,7 @@ declare function uploadImage(file: Blob, params: UploadImageParams, options?: Re
1095
1242
  //#endregion
1096
1243
  //#region src/core/merchantImages.d.ts
1097
1244
  /**
1098
- * Merchant images, as adminV1 saves them and adminV2 reads them:
1245
+ * Merchant images, as Shopwave's existing admin apps save and read them:
1099
1246
  *
1100
1247
  * ```
1101
1248
  * { logo: { receipt: "<file>", square: "<file>" }, feature: ["<file>"] }
@@ -1112,7 +1259,7 @@ declare function uploadImage(file: Blob, params: UploadImageParams, options?: Re
1112
1259
  * So a featured image must be uploaded with kind `merchantFeature` (which
1113
1260
  * stores it under `feature/`); a `merchant` upload lands under `logo/`.
1114
1261
  *
1115
- * Confirmed on the live API, merchant 5644, 30 Sep 2026.
1262
+ * Confirmed on the live API, 30 Sep 2026.
1116
1263
  */
1117
1264
  interface MerchantImageIds {
1118
1265
  logo?: {
@@ -1131,12 +1278,12 @@ interface MerchantImageSlotDefinition {
1131
1278
  field: "logo.receipt" | "logo.square" | "feature[0]";
1132
1279
  /** Uploader `contentType` (the featured image has its own). */
1133
1280
  uploadKind: UploadKind;
1134
- /** Exact size in pixels. adminV1 refuses any other size; the API doesn't resize. */
1281
+ /** Exact size in pixels. Shopwave's existing admin refuses any other size; the API doesn't resize. */
1135
1282
  width: number;
1136
1283
  height: number;
1137
1284
  }
1138
1285
  /**
1139
- * Where each slot lives, its upload kind and its exact size (from adminV1's
1286
+ * Where each slot lives, its upload kind and its exact size (from the existing admin's
1140
1287
  * merchant settings page).
1141
1288
  */
1142
1289
  declare const MERCHANT_IMAGE_SLOTS: Readonly<Record<MerchantImageSlot, MerchantImageSlotDefinition>>;
@@ -1161,7 +1308,7 @@ declare function getMerchantImageUrl(imageIds: MerchantImageIds | null | undefin
1161
1308
  declare function setMerchantImage(imageIds: MerchantImageIds | null | undefined, slot: MerchantImageSlot, fileName: string | null): MerchantImageIds;
1162
1309
  /**
1163
1310
  * The `imageIds` to send on a save: every URL is turned back into its file
1164
- * name (what adminV1 does with images you didn't change) and empty values
1311
+ * name (what the existing admin does with images you didn't change) and empty values
1165
1312
  * are dropped. No images gives `{}`.
1166
1313
  */
1167
1314
  declare function toStoredImageIds(imageIds: unknown): MerchantImageIds;
@@ -1190,7 +1337,7 @@ interface MerchantColourSet {
1190
1337
  [key: string]: string | null | undefined;
1191
1338
  }
1192
1339
  /**
1193
- * Brand colours, as adminV1 saves them and adminV2 reads them
1340
+ * Brand colours, as Shopwave's existing admin apps save and read them
1194
1341
  * (`colours.primary.main` is the logo background): `{ primary: { main,
1195
1342
  * highlight, contrast } }`. `{}` when unset. Confirmed live, 30 Sep 2026.
1196
1343
  */
@@ -1202,7 +1349,7 @@ interface MerchantColours {
1202
1349
  declare const MERCHANT_COLOUR_KEYS: readonly ["main", "highlight", "contrast"];
1203
1350
  type MerchantColourKey = (typeof MERCHANT_COLOUR_KEYS)[number];
1204
1351
  /**
1205
- * Web and social links, as adminV1 saves them:
1352
+ * Web and social links, as Shopwave's existing admin saves them:
1206
1353
  * `{ website: { home }, social: { twitter, facebook, instagram } }`.
1207
1354
  * `{}` when empty (confirmed live, 30 Sep 2026). Use {@link normalizeMerchantLinks} to read older shapes and
1208
1355
  * {@link merchantLinksToForm} / {@link merchantLinksFromForm} for flat forms.
@@ -1228,9 +1375,9 @@ declare const MERCHANT_LINK_PATHS: Readonly<Record<MerchantLinkKey, readonly [st
1228
1375
  /**
1229
1376
  * Reads `merchant.links` as flat fields (`{ website, twitter, facebook,
1230
1377
  * instagram }`), whatever shape it was saved in:
1231
- * - the nested shape adminV1 saves (`{ website: { home }, social: { … } }`);
1378
+ * - the nested shape the existing admin saves (`{ website: { home }, social: { … } }`);
1232
1379
  * - flat keys (`{ website: "…" }`, what SDK 0.4.0 pre-releases sent);
1233
- * - an array in {@link MERCHANT_LINK_KEYS} order (older AdminUI versions).
1380
+ * - an array in {@link MERCHANT_LINK_KEYS} order (older app versions).
1234
1381
  * Empty values are dropped.
1235
1382
  */
1236
1383
  declare function merchantLinksToForm(links: unknown): Partial<Record<MerchantLinkKey, string>>;
@@ -1239,7 +1386,7 @@ declare function merchantLinksToForm(links: unknown): Partial<Record<MerchantLin
1239
1386
  * out, and so is a group with nothing in it; no links gives `{}`.
1240
1387
  */
1241
1388
  declare function merchantLinksFromForm(form: Partial<Record<MerchantLinkKey, string | null | undefined>>): MerchantLinks;
1242
- /** Reads any stored or older `links` value into the nested shape adminV1 saves. */
1389
+ /** Reads any stored or older `links` value into the nested shape the existing admin saves. */
1243
1390
  declare function normalizeMerchantLinks(links: unknown): MerchantLinks;
1244
1391
  interface Merchant {
1245
1392
  id: number;
@@ -1352,7 +1499,7 @@ declare function fetchUser(options?: RequestOptions): Promise<User | null>;
1352
1499
  //#endregion
1353
1500
  //#region src/core/productImages.d.ts
1354
1501
  /**
1355
- * Product images, as the live API stores them (merchant 5644, 4 Nov 2026):
1502
+ * Product images, as the live API stores them (4 Nov 2026):
1356
1503
  * - A product's `images` is a list. **Reads return full URLs**
1357
1504
  * (`http://static.merchantstack.com/images/merchant/<id>/product/<file>`);
1358
1505
  * **writes take the uploader's file names** ({@link toStoredProductImages};
@@ -1375,5 +1522,5 @@ declare function productImageRole(value: unknown): UploadPrefix | null;
1375
1522
  */
1376
1523
  declare function toStoredProductImages(images: unknown): string[];
1377
1524
  //#endregion
1378
- export { Basket, BasketFilters, BasketItem, BasketPagination, BasketReportRow, BasketSummary, Category, CategoryResponse, CombineBasketRowsParams, Consumer, ConsumerResponse, CropRect, DEFAULT_BASKET_FILTERS, DEFAULT_PAGINATION, DeletableEntityKind, Employee, EmployeeResponse, EntityDefinition, EntityId, EntityInput, EntityKind, EntityTypes, ErrorMessage, Extras, FetchByIdParams, FetchCategoriesParams, FetchEmployeesParams, FetchProductsParams, FetchPromotionsParams, FetchStoresParams, FitImageOptions, ImageFitPlan, ImageRule, ImageRuleError, ImageSize, ImageTooSmallError, LookupDefinition, LookupKind, MERCHANT_COLOUR_KEYS, MERCHANT_FIELD_MAX_LENGTH, MERCHANT_IMAGE_SLOTS, MERCHANT_IMAGE_SLOT_KEYS, MERCHANT_LINK_KEYS, MERCHANT_LINK_PATHS, MERCHANT_OBJECT_FIELDS, MERCHANT_READ_ONLY_FIELDS, Merchant, MerchantColourKey, MerchantColourSet, MerchantColours, MerchantImageIds, MerchantImageSlot, MerchantImageSlotDefinition, MerchantLinkKey, MerchantLinks, MerchantPatch, MerchantResponse, MessageInfo, ParsedBasket, PrepareImageOptions, Product, ProductInstance, ProductInstanceInput, ProductInstances, ProductResponse, ProductSaveInput, Promotion, PromotionResponse, PromotionRuleSet, ReportData, ReportKey, ReportQuery, ReportQueryMap, ReportResponse, RepricedInstance, RequestOptions, ResourceDefinition, ResourceKind, SHOPWAVE_ENTITIES, SHOPWAVE_IMAGE_BASE_URL, SHOPWAVE_LOOKUPS, SHOPWAVE_RESOURCES, SHOPWAVE_UPLOAD, Saved, SessionStatus, ShopwaveApiError, ShopwaveErrorMap, Store, StoreResponse, SubmitEntityArgs, SubmitEntityResponse, SuccessMessage, UPLOAD_KINDS, UPLOAD_PREFIXES, UpdateMerchantOptions, UploadImageParams, UploadKind, UploadMerchantImageOptions, UploadPrefix, UploadedImage, User, UserEmployee, UserResponse, WritableEntityKind, apiDelete, apiGet, apiRequest, apiResponse, apiSend, assertNoApiErrors, authorizationFor, buildBasketReportQuery, buildConsumerMap, checkImageRule, collectConsumerIds, collectProductIds, combineBasketRows, computeBasketSummary, coverCrop, deleteCategory, deleteEmployee, deleteEntity, deleteEntityById, deleteProduct, deletePromotion, deleteStore, fetchCategories, fetchCategory, fetchConsumer, fetchConsumers, fetchEmployee, fetchEmployees, fetchEntityById, fetchMerchant, fetchProduct, fetchProductInstanceTags, fetchProductTags, fetchProducts, fetchProductsMap, fetchPromotion, fetchPromotions, fetchReport, fetchSession, fetchStore, fetchStores, fetchUser, findRepricedInstances, fitImageToSize, formatDateForQuery, getApiErrorMap, getApiErrors, getImageUrl, getMerchantImage, getMerchantImageUrl, imageFileName, isSameInstancePrice, isUploadKind, isUploadPrefix, loginPath, logout, logoutPath, merchantLinksFromForm, merchantLinksToForm, normalizeMerchantLinks, normalizeTagList, parseAspectRatio, parseBasketReportData, planImageFit, prepareImage, productImageRole, readImageSize, rolesById, saveCategory, saveEmployee, saveEntities, saveEntity, saveProduct, savePromotion, saveStore, setMerchantImage, submitEntity, toProductInstancesForSave, toShopwaveApiError, toStoredImageIds, toStoredProductImages, updateMerchant, uploadImage, uploadMerchantImage, validateMerchant, withToken };
1525
+ export { Basket, BasketFilters, BasketItem, BasketPagination, BasketReportRow, BasketSummary, Category, CategoryResponse, CombineBasketRowsParams, Consumer, ConsumerResponse, CropRect, DEFAULT_BASKET_FILTERS, DEFAULT_PAGINATION, DeletableEntityKind, Employee, EmployeeResponse, EntityDefinition, EntityId, EntityInput, EntityKind, EntityTypes, ErrorMessage, Extras, FetchByIdParams, FetchCategoriesParams, FetchEmployeesParams, FetchProductComponentsParams, FetchProductsParams, FetchPromotionsParams, FetchStoresParams, FitImageOptions, ImageFitPlan, ImageRule, ImageRuleError, ImageSize, ImageTooSmallError, LookupDefinition, LookupKind, MERCHANT_COLOUR_KEYS, MERCHANT_FIELD_MAX_LENGTH, MERCHANT_IMAGE_SLOTS, MERCHANT_IMAGE_SLOT_KEYS, MERCHANT_LINK_KEYS, MERCHANT_LINK_PATHS, MERCHANT_OBJECT_FIELDS, MERCHANT_READ_ONLY_FIELDS, Merchant, MerchantColourKey, MerchantColourSet, MerchantColours, MerchantImageIds, MerchantImageSlot, MerchantImageSlotDefinition, MerchantLinkKey, MerchantLinks, MerchantPatch, MerchantResponse, MessageInfo, ParsedBasket, PrepareImageOptions, Product, ProductComponent, ProductComponentInstance, ProductComponentInstanceInput, ProductComponentProduct, ProductComponentProductInput, ProductComponentSaveInput, ProductInstance, ProductInstanceInput, ProductInstances, ProductResponse, ProductSaveInput, Promotion, PromotionResponse, PromotionRuleSet, ReportData, ReportKey, ReportQuery, ReportQueryMap, ReportResponse, RepricedInstance, RequestOptions, ResourceDefinition, ResourceKind, SHOPWAVE_ENTITIES, SHOPWAVE_IMAGE_BASE_URL, SHOPWAVE_LOOKUPS, SHOPWAVE_RESOURCES, SHOPWAVE_UPLOAD, Saved, SessionStatus, ShopwaveApiError, ShopwaveErrorMap, Store, StoreResponse, SubmitEntityArgs, SubmitEntityResponse, SuccessMessage, UPLOAD_KINDS, UPLOAD_PREFIXES, UpdateMerchantOptions, UploadImageParams, UploadKind, UploadMerchantImageOptions, UploadPrefix, UploadedImage, User, UserEmployee, UserResponse, WritableEntityKind, apiDelete, apiGet, apiRequest, apiResponse, apiSend, assertNoApiErrors, authorizationFor, buildBasketReportQuery, buildConsumerMap, checkImageRule, collectConsumerIds, collectProductIds, combineBasketRows, computeBasketSummary, coverCrop, deleteCategory, deleteEmployee, deleteEntity, deleteEntityById, deleteProduct, deleteProductComponent, deleteProductComponentInstances, deletePromotion, deleteStore, fetchCategories, fetchCategory, fetchConsumer, fetchConsumers, fetchEmployee, fetchEmployees, fetchEntityById, fetchMerchant, fetchProduct, fetchProductComponent, fetchProductComponents, fetchProductInstanceTags, fetchProductTags, fetchProducts, fetchProductsMap, fetchPromotion, fetchPromotions, fetchReport, fetchSession, fetchStore, fetchStores, fetchUser, findRepricedInstances, fitImageToSize, formatDateForQuery, getApiErrorMap, getApiErrors, getImageUrl, getMerchantImage, getMerchantImageUrl, imageFileName, isSameInstancePrice, isUploadKind, isUploadPrefix, loginPath, logout, logoutPath, merchantLinksFromForm, merchantLinksToForm, normalizeMerchantLinks, normalizeTagList, parseAspectRatio, parseBasketReportData, planImageFit, prepareImage, productImageRole, readImageSize, rolesById, saveCategory, saveEmployee, saveEntities, saveEntity, saveProduct, saveProductComponent, savePromotion, saveStore, setMerchantImage, submitEntity, toProductComponentForSave, toProductInstancesForSave, toShopwaveApiError, toStoredImageIds, toStoredProductImages, updateMerchant, uploadImage, uploadMerchantImage, validateMerchant, withToken };
1379
1526
  //# sourceMappingURL=index.d.cts.map