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/index.cjs
CHANGED
|
@@ -900,7 +900,7 @@ const STATIC_HOST = /^https?:\/\/static\.merchantstack\.com\/images\//i;
|
|
|
900
900
|
/**
|
|
901
901
|
* Turns an image path from the API into a URL a page can load over HTTPS:
|
|
902
902
|
* `http://static.merchantstack.com/images/x.png` → `<base>/x.png`, and a
|
|
903
|
-
* relative path (`merchant/
|
|
903
|
+
* relative path (`merchant/123/logo/x.png`) → `<base>/merchant/123/logo/x.png`.
|
|
904
904
|
* Other absolute URLs are returned unchanged; empty input gives `""`.
|
|
905
905
|
*/
|
|
906
906
|
function getImageUrl(path, base = SHOPWAVE_IMAGE_BASE_URL) {
|
|
@@ -952,7 +952,7 @@ const MERCHANT_IMAGE_SLOT_KEYS = [
|
|
|
952
952
|
"featured"
|
|
953
953
|
];
|
|
954
954
|
/**
|
|
955
|
-
* Where each slot lives, its upload kind and its exact size (from
|
|
955
|
+
* Where each slot lives, its upload kind and its exact size (from the existing admin's
|
|
956
956
|
* merchant settings page).
|
|
957
957
|
*/
|
|
958
958
|
const MERCHANT_IMAGE_SLOTS = Object.freeze({
|
|
@@ -1043,7 +1043,7 @@ function toStored(value) {
|
|
|
1043
1043
|
}
|
|
1044
1044
|
/**
|
|
1045
1045
|
* The `imageIds` to send on a save: every URL is turned back into its file
|
|
1046
|
-
* name (what
|
|
1046
|
+
* name (what the existing admin does with images you didn't change) and empty values
|
|
1047
1047
|
* are dropped. No images gives `{}`.
|
|
1048
1048
|
*/
|
|
1049
1049
|
function toStoredImageIds(imageIds) {
|
|
@@ -1064,7 +1064,7 @@ async function uploadMerchantImage(file, slot, options = {}) {
|
|
|
1064
1064
|
//#endregion
|
|
1065
1065
|
//#region src/core/productImages.ts
|
|
1066
1066
|
/**
|
|
1067
|
-
* Product images, as the live API stores them (
|
|
1067
|
+
* Product images, as the live API stores them (4 Nov 2026):
|
|
1068
1068
|
* - A product's `images` is a list. **Reads return full URLs**
|
|
1069
1069
|
* (`http://static.merchantstack.com/images/merchant/<id>/product/<file>`);
|
|
1070
1070
|
* **writes take the uploader's file names** ({@link toStoredProductImages};
|
|
@@ -1466,9 +1466,9 @@ function trimmed(value) {
|
|
|
1466
1466
|
/**
|
|
1467
1467
|
* Reads `merchant.links` as flat fields (`{ website, twitter, facebook,
|
|
1468
1468
|
* instagram }`), whatever shape it was saved in:
|
|
1469
|
-
* - the nested shape
|
|
1469
|
+
* - the nested shape the existing admin saves (`{ website: { home }, social: { … } }`);
|
|
1470
1470
|
* - flat keys (`{ website: "…" }`, what SDK 0.4.0 pre-releases sent);
|
|
1471
|
-
* - an array in {@link MERCHANT_LINK_KEYS} order (older
|
|
1471
|
+
* - an array in {@link MERCHANT_LINK_KEYS} order (older app versions).
|
|
1472
1472
|
* Empty values are dropped.
|
|
1473
1473
|
*/
|
|
1474
1474
|
function merchantLinksToForm(links) {
|
|
@@ -1505,7 +1505,7 @@ function merchantLinksFromForm(form) {
|
|
|
1505
1505
|
}
|
|
1506
1506
|
return out;
|
|
1507
1507
|
}
|
|
1508
|
-
/** Reads any stored or older `links` value into the nested shape
|
|
1508
|
+
/** Reads any stored or older `links` value into the nested shape the existing admin saves. */
|
|
1509
1509
|
function normalizeMerchantLinks(links) {
|
|
1510
1510
|
return merchantLinksFromForm(merchantLinksToForm(links));
|
|
1511
1511
|
}
|