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/README.md +9 -9
- package/dist/core/index.cjs +7 -7
- package/dist/core/index.cjs.map +1 -1
- package/dist/core/index.d.cts +15 -15
- package/dist/core/index.d.ts +15 -15
- package/dist/core/index.js +7 -7
- package/dist/core/index.js.map +1 -1
- package/dist/hooks/index.cjs +3 -3
- package/dist/hooks/index.cjs.map +1 -1
- package/dist/hooks/index.d.cts +6 -6
- package/dist/hooks/index.d.ts +6 -6
- package/dist/hooks/index.js +3 -3
- package/dist/hooks/index.js.map +1 -1
- package/dist/index.cjs +7 -7
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +15 -15
- package/dist/index.d.ts +15 -15
- package/dist/index.js +7 -7
- package/dist/index.js.map +1 -1
- package/dist/next/index.cjs +2 -2
- package/dist/next/index.cjs.map +1 -1
- package/dist/next/index.d.cts +3 -3
- package/dist/next/index.d.ts +3 -3
- package/dist/next/index.js +2 -2
- package/dist/next/index.js.map +1 -1
- package/dist/server/index.cjs +2 -2
- package/dist/server/index.cjs.map +1 -1
- package/dist/server/index.d.cts +5 -5
- package/dist/server/index.d.ts +5 -5
- package/dist/server/index.js +2 -2
- package/dist/server/index.js.map +1 -1
- package/package.json +5 -1
package/dist/hooks/index.d.cts
CHANGED
|
@@ -357,8 +357,8 @@ type UploadKind = "merchant" | "merchantFeature" | "product" | "user" | "applica
|
|
|
357
357
|
/**
|
|
358
358
|
* The role an image plays, sent to Shopwave as the uploader's `prefix` header.
|
|
359
359
|
* The uploader names the file `<prefix>_<hash>.<ext>`, so the role travels with
|
|
360
|
-
* the file wherever a record stores it (a product's `images`). Live,
|
|
361
|
-
*
|
|
360
|
+
* the file wherever a record stores it (a product's `images`). Live, test
|
|
361
|
+
* merchant, 4 Nov 2026: all four values answered 201.
|
|
362
362
|
* - `product`: a product gallery image;
|
|
363
363
|
* - `product_thumbnail`: the product's lead image, shown in lists;
|
|
364
364
|
* - `variant` / `variant_thumbnail`: a variant's own image and its lead image
|
|
@@ -402,7 +402,7 @@ interface UploadedImage {
|
|
|
402
402
|
//#endregion
|
|
403
403
|
//#region src/core/merchantImages.d.ts
|
|
404
404
|
/**
|
|
405
|
-
* Merchant images, as
|
|
405
|
+
* Merchant images, as Shopwave's existing admin apps save and read them:
|
|
406
406
|
*
|
|
407
407
|
* ```
|
|
408
408
|
* { logo: { receipt: "<file>", square: "<file>" }, feature: ["<file>"] }
|
|
@@ -419,7 +419,7 @@ interface UploadedImage {
|
|
|
419
419
|
* So a featured image must be uploaded with kind `merchantFeature` (which
|
|
420
420
|
* stores it under `feature/`); a `merchant` upload lands under `logo/`.
|
|
421
421
|
*
|
|
422
|
-
* Confirmed on the live API,
|
|
422
|
+
* Confirmed on the live API, 30 Sep 2026.
|
|
423
423
|
*/
|
|
424
424
|
interface MerchantImageIds {
|
|
425
425
|
logo?: {
|
|
@@ -452,7 +452,7 @@ interface MerchantColourSet {
|
|
|
452
452
|
[key: string]: string | null | undefined;
|
|
453
453
|
}
|
|
454
454
|
/**
|
|
455
|
-
* Brand colours, as
|
|
455
|
+
* Brand colours, as Shopwave's existing admin apps save and read them
|
|
456
456
|
* (`colours.primary.main` is the logo background): `{ primary: { main,
|
|
457
457
|
* highlight, contrast } }`. `{}` when unset. Confirmed live, 30 Sep 2026.
|
|
458
458
|
*/
|
|
@@ -461,7 +461,7 @@ interface MerchantColours {
|
|
|
461
461
|
[key: string]: MerchantColourSet | null | undefined;
|
|
462
462
|
}
|
|
463
463
|
/**
|
|
464
|
-
* Web and social links, as
|
|
464
|
+
* Web and social links, as Shopwave's existing admin saves them:
|
|
465
465
|
* `{ website: { home }, social: { twitter, facebook, instagram } }`.
|
|
466
466
|
* `{}` when empty (confirmed live, 30 Sep 2026). Use {@link normalizeMerchantLinks} to read older shapes and
|
|
467
467
|
* {@link merchantLinksToForm} / {@link merchantLinksFromForm} for flat forms.
|
package/dist/hooks/index.d.ts
CHANGED
|
@@ -357,8 +357,8 @@ type UploadKind = "merchant" | "merchantFeature" | "product" | "user" | "applica
|
|
|
357
357
|
/**
|
|
358
358
|
* The role an image plays, sent to Shopwave as the uploader's `prefix` header.
|
|
359
359
|
* The uploader names the file `<prefix>_<hash>.<ext>`, so the role travels with
|
|
360
|
-
* the file wherever a record stores it (a product's `images`). Live,
|
|
361
|
-
*
|
|
360
|
+
* the file wherever a record stores it (a product's `images`). Live, test
|
|
361
|
+
* merchant, 4 Nov 2026: all four values answered 201.
|
|
362
362
|
* - `product`: a product gallery image;
|
|
363
363
|
* - `product_thumbnail`: the product's lead image, shown in lists;
|
|
364
364
|
* - `variant` / `variant_thumbnail`: a variant's own image and its lead image
|
|
@@ -402,7 +402,7 @@ interface UploadedImage {
|
|
|
402
402
|
//#endregion
|
|
403
403
|
//#region src/core/merchantImages.d.ts
|
|
404
404
|
/**
|
|
405
|
-
* Merchant images, as
|
|
405
|
+
* Merchant images, as Shopwave's existing admin apps save and read them:
|
|
406
406
|
*
|
|
407
407
|
* ```
|
|
408
408
|
* { logo: { receipt: "<file>", square: "<file>" }, feature: ["<file>"] }
|
|
@@ -419,7 +419,7 @@ interface UploadedImage {
|
|
|
419
419
|
* So a featured image must be uploaded with kind `merchantFeature` (which
|
|
420
420
|
* stores it under `feature/`); a `merchant` upload lands under `logo/`.
|
|
421
421
|
*
|
|
422
|
-
* Confirmed on the live API,
|
|
422
|
+
* Confirmed on the live API, 30 Sep 2026.
|
|
423
423
|
*/
|
|
424
424
|
interface MerchantImageIds {
|
|
425
425
|
logo?: {
|
|
@@ -452,7 +452,7 @@ interface MerchantColourSet {
|
|
|
452
452
|
[key: string]: string | null | undefined;
|
|
453
453
|
}
|
|
454
454
|
/**
|
|
455
|
-
* Brand colours, as
|
|
455
|
+
* Brand colours, as Shopwave's existing admin apps save and read them
|
|
456
456
|
* (`colours.primary.main` is the logo background): `{ primary: { main,
|
|
457
457
|
* highlight, contrast } }`. `{}` when unset. Confirmed live, 30 Sep 2026.
|
|
458
458
|
*/
|
|
@@ -461,7 +461,7 @@ interface MerchantColours {
|
|
|
461
461
|
[key: string]: MerchantColourSet | null | undefined;
|
|
462
462
|
}
|
|
463
463
|
/**
|
|
464
|
-
* Web and social links, as
|
|
464
|
+
* Web and social links, as Shopwave's existing admin saves them:
|
|
465
465
|
* `{ website: { home }, social: { twitter, facebook, instagram } }`.
|
|
466
466
|
* `{}` when empty (confirmed live, 30 Sep 2026). Use {@link normalizeMerchantLinks} to read older shapes and
|
|
467
467
|
* {@link merchantLinksToForm} / {@link merchantLinksFromForm} for flat forms.
|
package/dist/hooks/index.js
CHANGED
|
@@ -575,7 +575,7 @@ const STATIC_HOST = /^https?:\/\/static\.merchantstack\.com\/images\//i;
|
|
|
575
575
|
/**
|
|
576
576
|
* Turns an image path from the API into a URL a page can load over HTTPS:
|
|
577
577
|
* `http://static.merchantstack.com/images/x.png` → `<base>/x.png`, and a
|
|
578
|
-
* relative path (`merchant/
|
|
578
|
+
* relative path (`merchant/123/logo/x.png`) → `<base>/merchant/123/logo/x.png`.
|
|
579
579
|
* Other absolute URLs are returned unchanged; empty input gives `""`.
|
|
580
580
|
*/
|
|
581
581
|
function getImageUrl(path, base = SHOPWAVE_IMAGE_BASE_URL) {
|
|
@@ -621,7 +621,7 @@ async function uploadImage(file, params, options = {}) {
|
|
|
621
621
|
//#endregion
|
|
622
622
|
//#region src/core/merchantImages.ts
|
|
623
623
|
/**
|
|
624
|
-
* Where each slot lives, its upload kind and its exact size (from
|
|
624
|
+
* Where each slot lives, its upload kind and its exact size (from the existing admin's
|
|
625
625
|
* merchant settings page).
|
|
626
626
|
*/
|
|
627
627
|
const MERCHANT_IMAGE_SLOTS = Object.freeze({
|
|
@@ -671,7 +671,7 @@ function toStored(value) {
|
|
|
671
671
|
}
|
|
672
672
|
/**
|
|
673
673
|
* The `imageIds` to send on a save: every URL is turned back into its file
|
|
674
|
-
* name (what
|
|
674
|
+
* name (what the existing admin does with images you didn't change) and empty values
|
|
675
675
|
* are dropped. No images gives `{}`.
|
|
676
676
|
*/
|
|
677
677
|
function toStoredImageIds(imageIds) {
|