react-shopwave-connect 0.4.5 → 0.4.6

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/dist/index.d.cts CHANGED
@@ -850,8 +850,8 @@ declare const UPLOAD_KINDS: Readonly<Record<UploadKind, string>>;
850
850
  /**
851
851
  * The role an image plays, sent to Shopwave as the uploader's `prefix` header.
852
852
  * 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.
853
+ * the file wherever a record stores it (a product's `images`). Live, test
854
+ * merchant, 4 Nov 2026: all four values answered 201.
855
855
  * - `product`: a product gallery image;
856
856
  * - `product_thumbnail`: the product's lead image, shown in lists;
857
857
  * - `variant` / `variant_thumbnail`: a variant's own image and its lead image
@@ -892,7 +892,7 @@ declare function isUploadPrefix(value: unknown): value is UploadPrefix;
892
892
  * on the merchant's products. No parameters. The API reference says
893
893
  * "internal SKU tags are excluded", but the live API includes system tags
894
894
  * 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
895
+ * a test merchant, 29 Oct 2026). Apps that offer the list as suggestions
896
896
  * filter those themselves. Tags of deleted products drop out of the list.
897
897
  * - productInstanceTags: `GET /product/instance/tags` → `{ tags: string[] }`,
898
898
  * the same for price instances (channels such as "Eat In", "Takeout").
@@ -1079,7 +1079,7 @@ declare const SHOPWAVE_IMAGE_BASE_URL = "https://s3-eu-west-1.amazonaws.com/stat
1079
1079
  /**
1080
1080
  * Turns an image path from the API into a URL a page can load over HTTPS:
1081
1081
  * `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`.
1082
+ * relative path (`merchant/123/logo/x.png`) → `<base>/merchant/123/logo/x.png`.
1083
1083
  * Other absolute URLs are returned unchanged; empty input gives `""`.
1084
1084
  */
1085
1085
  declare function getImageUrl(path: string | null | undefined, base?: string): string;
@@ -1095,7 +1095,7 @@ declare function uploadImage(file: Blob, params: UploadImageParams, options?: Re
1095
1095
  //#endregion
1096
1096
  //#region src/core/merchantImages.d.ts
1097
1097
  /**
1098
- * Merchant images, as adminV1 saves them and adminV2 reads them:
1098
+ * Merchant images, as Shopwave's existing admin apps save and read them:
1099
1099
  *
1100
1100
  * ```
1101
1101
  * { logo: { receipt: "<file>", square: "<file>" }, feature: ["<file>"] }
@@ -1112,7 +1112,7 @@ declare function uploadImage(file: Blob, params: UploadImageParams, options?: Re
1112
1112
  * So a featured image must be uploaded with kind `merchantFeature` (which
1113
1113
  * stores it under `feature/`); a `merchant` upload lands under `logo/`.
1114
1114
  *
1115
- * Confirmed on the live API, merchant 5644, 30 Sep 2026.
1115
+ * Confirmed on the live API, 30 Sep 2026.
1116
1116
  */
1117
1117
  interface MerchantImageIds {
1118
1118
  logo?: {
@@ -1131,12 +1131,12 @@ interface MerchantImageSlotDefinition {
1131
1131
  field: "logo.receipt" | "logo.square" | "feature[0]";
1132
1132
  /** Uploader `contentType` (the featured image has its own). */
1133
1133
  uploadKind: UploadKind;
1134
- /** Exact size in pixels. adminV1 refuses any other size; the API doesn't resize. */
1134
+ /** Exact size in pixels. Shopwave's existing admin refuses any other size; the API doesn't resize. */
1135
1135
  width: number;
1136
1136
  height: number;
1137
1137
  }
1138
1138
  /**
1139
- * Where each slot lives, its upload kind and its exact size (from adminV1's
1139
+ * Where each slot lives, its upload kind and its exact size (from the existing admin's
1140
1140
  * merchant settings page).
1141
1141
  */
1142
1142
  declare const MERCHANT_IMAGE_SLOTS: Readonly<Record<MerchantImageSlot, MerchantImageSlotDefinition>>;
@@ -1161,7 +1161,7 @@ declare function getMerchantImageUrl(imageIds: MerchantImageIds | null | undefin
1161
1161
  declare function setMerchantImage(imageIds: MerchantImageIds | null | undefined, slot: MerchantImageSlot, fileName: string | null): MerchantImageIds;
1162
1162
  /**
1163
1163
  * 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
1164
+ * name (what the existing admin does with images you didn't change) and empty values
1165
1165
  * are dropped. No images gives `{}`.
1166
1166
  */
1167
1167
  declare function toStoredImageIds(imageIds: unknown): MerchantImageIds;
@@ -1190,7 +1190,7 @@ interface MerchantColourSet {
1190
1190
  [key: string]: string | null | undefined;
1191
1191
  }
1192
1192
  /**
1193
- * Brand colours, as adminV1 saves them and adminV2 reads them
1193
+ * Brand colours, as Shopwave's existing admin apps save and read them
1194
1194
  * (`colours.primary.main` is the logo background): `{ primary: { main,
1195
1195
  * highlight, contrast } }`. `{}` when unset. Confirmed live, 30 Sep 2026.
1196
1196
  */
@@ -1202,7 +1202,7 @@ interface MerchantColours {
1202
1202
  declare const MERCHANT_COLOUR_KEYS: readonly ["main", "highlight", "contrast"];
1203
1203
  type MerchantColourKey = (typeof MERCHANT_COLOUR_KEYS)[number];
1204
1204
  /**
1205
- * Web and social links, as adminV1 saves them:
1205
+ * Web and social links, as Shopwave's existing admin saves them:
1206
1206
  * `{ website: { home }, social: { twitter, facebook, instagram } }`.
1207
1207
  * `{}` when empty (confirmed live, 30 Sep 2026). Use {@link normalizeMerchantLinks} to read older shapes and
1208
1208
  * {@link merchantLinksToForm} / {@link merchantLinksFromForm} for flat forms.
@@ -1228,9 +1228,9 @@ declare const MERCHANT_LINK_PATHS: Readonly<Record<MerchantLinkKey, readonly [st
1228
1228
  /**
1229
1229
  * Reads `merchant.links` as flat fields (`{ website, twitter, facebook,
1230
1230
  * instagram }`), whatever shape it was saved in:
1231
- * - the nested shape adminV1 saves (`{ website: { home }, social: { … } }`);
1231
+ * - the nested shape the existing admin saves (`{ website: { home }, social: { … } }`);
1232
1232
  * - flat keys (`{ website: "…" }`, what SDK 0.4.0 pre-releases sent);
1233
- * - an array in {@link MERCHANT_LINK_KEYS} order (older AdminUI versions).
1233
+ * - an array in {@link MERCHANT_LINK_KEYS} order (older app versions).
1234
1234
  * Empty values are dropped.
1235
1235
  */
1236
1236
  declare function merchantLinksToForm(links: unknown): Partial<Record<MerchantLinkKey, string>>;
@@ -1239,7 +1239,7 @@ declare function merchantLinksToForm(links: unknown): Partial<Record<MerchantLin
1239
1239
  * out, and so is a group with nothing in it; no links gives `{}`.
1240
1240
  */
1241
1241
  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. */
1242
+ /** Reads any stored or older `links` value into the nested shape the existing admin saves. */
1243
1243
  declare function normalizeMerchantLinks(links: unknown): MerchantLinks;
1244
1244
  interface Merchant {
1245
1245
  id: number;
@@ -1352,7 +1352,7 @@ declare function fetchUser(options?: RequestOptions): Promise<User | null>;
1352
1352
  //#endregion
1353
1353
  //#region src/core/productImages.d.ts
1354
1354
  /**
1355
- * Product images, as the live API stores them (merchant 5644, 4 Nov 2026):
1355
+ * Product images, as the live API stores them (4 Nov 2026):
1356
1356
  * - A product's `images` is a list. **Reads return full URLs**
1357
1357
  * (`http://static.merchantstack.com/images/merchant/<id>/product/<file>`);
1358
1358
  * **writes take the uploader's file names** ({@link toStoredProductImages};
package/dist/index.d.ts CHANGED
@@ -850,8 +850,8 @@ declare const UPLOAD_KINDS: Readonly<Record<UploadKind, string>>;
850
850
  /**
851
851
  * The role an image plays, sent to Shopwave as the uploader's `prefix` header.
852
852
  * 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.
853
+ * the file wherever a record stores it (a product's `images`). Live, test
854
+ * merchant, 4 Nov 2026: all four values answered 201.
855
855
  * - `product`: a product gallery image;
856
856
  * - `product_thumbnail`: the product's lead image, shown in lists;
857
857
  * - `variant` / `variant_thumbnail`: a variant's own image and its lead image
@@ -892,7 +892,7 @@ declare function isUploadPrefix(value: unknown): value is UploadPrefix;
892
892
  * on the merchant's products. No parameters. The API reference says
893
893
  * "internal SKU tags are excluded", but the live API includes system tags
894
894
  * 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
895
+ * a test merchant, 29 Oct 2026). Apps that offer the list as suggestions
896
896
  * filter those themselves. Tags of deleted products drop out of the list.
897
897
  * - productInstanceTags: `GET /product/instance/tags` → `{ tags: string[] }`,
898
898
  * the same for price instances (channels such as "Eat In", "Takeout").
@@ -1079,7 +1079,7 @@ declare const SHOPWAVE_IMAGE_BASE_URL = "https://s3-eu-west-1.amazonaws.com/stat
1079
1079
  /**
1080
1080
  * Turns an image path from the API into a URL a page can load over HTTPS:
1081
1081
  * `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`.
1082
+ * relative path (`merchant/123/logo/x.png`) → `<base>/merchant/123/logo/x.png`.
1083
1083
  * Other absolute URLs are returned unchanged; empty input gives `""`.
1084
1084
  */
1085
1085
  declare function getImageUrl(path: string | null | undefined, base?: string): string;
@@ -1095,7 +1095,7 @@ declare function uploadImage(file: Blob, params: UploadImageParams, options?: Re
1095
1095
  //#endregion
1096
1096
  //#region src/core/merchantImages.d.ts
1097
1097
  /**
1098
- * Merchant images, as adminV1 saves them and adminV2 reads them:
1098
+ * Merchant images, as Shopwave's existing admin apps save and read them:
1099
1099
  *
1100
1100
  * ```
1101
1101
  * { logo: { receipt: "<file>", square: "<file>" }, feature: ["<file>"] }
@@ -1112,7 +1112,7 @@ declare function uploadImage(file: Blob, params: UploadImageParams, options?: Re
1112
1112
  * So a featured image must be uploaded with kind `merchantFeature` (which
1113
1113
  * stores it under `feature/`); a `merchant` upload lands under `logo/`.
1114
1114
  *
1115
- * Confirmed on the live API, merchant 5644, 30 Sep 2026.
1115
+ * Confirmed on the live API, 30 Sep 2026.
1116
1116
  */
1117
1117
  interface MerchantImageIds {
1118
1118
  logo?: {
@@ -1131,12 +1131,12 @@ interface MerchantImageSlotDefinition {
1131
1131
  field: "logo.receipt" | "logo.square" | "feature[0]";
1132
1132
  /** Uploader `contentType` (the featured image has its own). */
1133
1133
  uploadKind: UploadKind;
1134
- /** Exact size in pixels. adminV1 refuses any other size; the API doesn't resize. */
1134
+ /** Exact size in pixels. Shopwave's existing admin refuses any other size; the API doesn't resize. */
1135
1135
  width: number;
1136
1136
  height: number;
1137
1137
  }
1138
1138
  /**
1139
- * Where each slot lives, its upload kind and its exact size (from adminV1's
1139
+ * Where each slot lives, its upload kind and its exact size (from the existing admin's
1140
1140
  * merchant settings page).
1141
1141
  */
1142
1142
  declare const MERCHANT_IMAGE_SLOTS: Readonly<Record<MerchantImageSlot, MerchantImageSlotDefinition>>;
@@ -1161,7 +1161,7 @@ declare function getMerchantImageUrl(imageIds: MerchantImageIds | null | undefin
1161
1161
  declare function setMerchantImage(imageIds: MerchantImageIds | null | undefined, slot: MerchantImageSlot, fileName: string | null): MerchantImageIds;
1162
1162
  /**
1163
1163
  * 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
1164
+ * name (what the existing admin does with images you didn't change) and empty values
1165
1165
  * are dropped. No images gives `{}`.
1166
1166
  */
1167
1167
  declare function toStoredImageIds(imageIds: unknown): MerchantImageIds;
@@ -1190,7 +1190,7 @@ interface MerchantColourSet {
1190
1190
  [key: string]: string | null | undefined;
1191
1191
  }
1192
1192
  /**
1193
- * Brand colours, as adminV1 saves them and adminV2 reads them
1193
+ * Brand colours, as Shopwave's existing admin apps save and read them
1194
1194
  * (`colours.primary.main` is the logo background): `{ primary: { main,
1195
1195
  * highlight, contrast } }`. `{}` when unset. Confirmed live, 30 Sep 2026.
1196
1196
  */
@@ -1202,7 +1202,7 @@ interface MerchantColours {
1202
1202
  declare const MERCHANT_COLOUR_KEYS: readonly ["main", "highlight", "contrast"];
1203
1203
  type MerchantColourKey = (typeof MERCHANT_COLOUR_KEYS)[number];
1204
1204
  /**
1205
- * Web and social links, as adminV1 saves them:
1205
+ * Web and social links, as Shopwave's existing admin saves them:
1206
1206
  * `{ website: { home }, social: { twitter, facebook, instagram } }`.
1207
1207
  * `{}` when empty (confirmed live, 30 Sep 2026). Use {@link normalizeMerchantLinks} to read older shapes and
1208
1208
  * {@link merchantLinksToForm} / {@link merchantLinksFromForm} for flat forms.
@@ -1228,9 +1228,9 @@ declare const MERCHANT_LINK_PATHS: Readonly<Record<MerchantLinkKey, readonly [st
1228
1228
  /**
1229
1229
  * Reads `merchant.links` as flat fields (`{ website, twitter, facebook,
1230
1230
  * instagram }`), whatever shape it was saved in:
1231
- * - the nested shape adminV1 saves (`{ website: { home }, social: { … } }`);
1231
+ * - the nested shape the existing admin saves (`{ website: { home }, social: { … } }`);
1232
1232
  * - flat keys (`{ website: "…" }`, what SDK 0.4.0 pre-releases sent);
1233
- * - an array in {@link MERCHANT_LINK_KEYS} order (older AdminUI versions).
1233
+ * - an array in {@link MERCHANT_LINK_KEYS} order (older app versions).
1234
1234
  * Empty values are dropped.
1235
1235
  */
1236
1236
  declare function merchantLinksToForm(links: unknown): Partial<Record<MerchantLinkKey, string>>;
@@ -1239,7 +1239,7 @@ declare function merchantLinksToForm(links: unknown): Partial<Record<MerchantLin
1239
1239
  * out, and so is a group with nothing in it; no links gives `{}`.
1240
1240
  */
1241
1241
  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. */
1242
+ /** Reads any stored or older `links` value into the nested shape the existing admin saves. */
1243
1243
  declare function normalizeMerchantLinks(links: unknown): MerchantLinks;
1244
1244
  interface Merchant {
1245
1245
  id: number;
@@ -1352,7 +1352,7 @@ declare function fetchUser(options?: RequestOptions): Promise<User | null>;
1352
1352
  //#endregion
1353
1353
  //#region src/core/productImages.d.ts
1354
1354
  /**
1355
- * Product images, as the live API stores them (merchant 5644, 4 Nov 2026):
1355
+ * Product images, as the live API stores them (4 Nov 2026):
1356
1356
  * - A product's `images` is a list. **Reads return full URLs**
1357
1357
  * (`http://static.merchantstack.com/images/merchant/<id>/product/<file>`);
1358
1358
  * **writes take the uploader's file names** ({@link toStoredProductImages};
package/dist/index.js CHANGED
@@ -876,7 +876,7 @@ const STATIC_HOST = /^https?:\/\/static\.merchantstack\.com\/images\//i;
876
876
  /**
877
877
  * Turns an image path from the API into a URL a page can load over HTTPS:
878
878
  * `http://static.merchantstack.com/images/x.png` → `<base>/x.png`, and a
879
- * relative path (`merchant/5644/logo/x.png`) → `<base>/merchant/5644/logo/x.png`.
879
+ * relative path (`merchant/123/logo/x.png`) → `<base>/merchant/123/logo/x.png`.
880
880
  * Other absolute URLs are returned unchanged; empty input gives `""`.
881
881
  */
882
882
  function getImageUrl(path, base = SHOPWAVE_IMAGE_BASE_URL) {
@@ -928,7 +928,7 @@ const MERCHANT_IMAGE_SLOT_KEYS = [
928
928
  "featured"
929
929
  ];
930
930
  /**
931
- * Where each slot lives, its upload kind and its exact size (from adminV1's
931
+ * Where each slot lives, its upload kind and its exact size (from the existing admin's
932
932
  * merchant settings page).
933
933
  */
934
934
  const MERCHANT_IMAGE_SLOTS = Object.freeze({
@@ -1019,7 +1019,7 @@ function toStored(value) {
1019
1019
  }
1020
1020
  /**
1021
1021
  * The `imageIds` to send on a save: every URL is turned back into its file
1022
- * name (what adminV1 does with images you didn't change) and empty values
1022
+ * name (what the existing admin does with images you didn't change) and empty values
1023
1023
  * are dropped. No images gives `{}`.
1024
1024
  */
1025
1025
  function toStoredImageIds(imageIds) {
@@ -1040,7 +1040,7 @@ async function uploadMerchantImage(file, slot, options = {}) {
1040
1040
  //#endregion
1041
1041
  //#region src/core/productImages.ts
1042
1042
  /**
1043
- * Product images, as the live API stores them (merchant 5644, 4 Nov 2026):
1043
+ * Product images, as the live API stores them (4 Nov 2026):
1044
1044
  * - A product's `images` is a list. **Reads return full URLs**
1045
1045
  * (`http://static.merchantstack.com/images/merchant/<id>/product/<file>`);
1046
1046
  * **writes take the uploader's file names** ({@link toStoredProductImages};
@@ -1442,9 +1442,9 @@ function trimmed(value) {
1442
1442
  /**
1443
1443
  * Reads `merchant.links` as flat fields (`{ website, twitter, facebook,
1444
1444
  * instagram }`), whatever shape it was saved in:
1445
- * - the nested shape adminV1 saves (`{ website: { home }, social: { … } }`);
1445
+ * - the nested shape the existing admin saves (`{ website: { home }, social: { … } }`);
1446
1446
  * - flat keys (`{ website: "…" }`, what SDK 0.4.0 pre-releases sent);
1447
- * - an array in {@link MERCHANT_LINK_KEYS} order (older AdminUI versions).
1447
+ * - an array in {@link MERCHANT_LINK_KEYS} order (older app versions).
1448
1448
  * Empty values are dropped.
1449
1449
  */
1450
1450
  function merchantLinksToForm(links) {
@@ -1481,7 +1481,7 @@ function merchantLinksFromForm(form) {
1481
1481
  }
1482
1482
  return out;
1483
1483
  }
1484
- /** Reads any stored or older `links` value into the nested shape adminV1 saves. */
1484
+ /** Reads any stored or older `links` value into the nested shape the existing admin saves. */
1485
1485
  function normalizeMerchantLinks(links) {
1486
1486
  return merchantLinksFromForm(merchantLinksToForm(links));
1487
1487
  }