@sledge-app/react-instant-search 1.0.111 → 1.0.112
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.
|
@@ -514,6 +514,11 @@ const dispatchCustomEvent = (eventName, detail) => {
|
|
|
514
514
|
const customEvent = new CustomEvent(eventName, { bubbles: true, cancelable: true, composed: false, ...detail && { detail } });
|
|
515
515
|
document.dispatchEvent(customEvent);
|
|
516
516
|
};
|
|
517
|
+
const setElementAttribute = ({ element, attributeName, value }) => {
|
|
518
|
+
if (element && element.hasAttribute(attributeName)) {
|
|
519
|
+
element.setAttribute(attributeName, value);
|
|
520
|
+
}
|
|
521
|
+
};
|
|
517
522
|
const root = "";
|
|
518
523
|
const Loading = "";
|
|
519
524
|
const ConfirmationPopup = "";
|
|
@@ -615,7 +620,7 @@ const Progress = ({ value, total, fillColor = "", outlineColor = "", delay = 150
|
|
|
615
620
|
children: /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
616
621
|
$67824d98245208a0$export$adb584737d712b70,
|
|
617
622
|
{
|
|
618
|
-
className: "ProgressIndicator",
|
|
623
|
+
className: "sledge__progress-indicator ProgressIndicator",
|
|
619
624
|
style: {
|
|
620
625
|
...{ transform: `translateX(-${100 - progress}%)` },
|
|
621
626
|
...fillColor && {
|
|
@@ -2955,7 +2960,7 @@ const ProductCard = (props) => {
|
|
|
2955
2960
|
product: {
|
|
2956
2961
|
...product,
|
|
2957
2962
|
...{
|
|
2958
|
-
variants: variants.map((variant, index) => {
|
|
2963
|
+
variants: variants == null ? void 0 : variants.map((variant, index) => {
|
|
2959
2964
|
const isInventoryQuantity = Object.hasOwn(variants[index], "inventory_quantity") ? variants[index].inventory_quantity > 0 : false;
|
|
2960
2965
|
const isInventoryManagement = Object.hasOwn(variants[index], "inventory_management") ? variants[index].inventory_management === null : false;
|
|
2961
2966
|
const isInventoryPolicy = Object.hasOwn(variants[index], "inventory_policy") ? variants[index].inventory_policy === "continue" : false;
|
|
@@ -3019,10 +3024,11 @@ const ProductCard = (props) => {
|
|
|
3019
3024
|
var _a2, _b2, _c2, _d;
|
|
3020
3025
|
const parentCard = element.target.offsetParent;
|
|
3021
3026
|
const selectedInput = parentCard.querySelector(`.sledge__product-grid-card-selected-option[data-product-id='${id}']`);
|
|
3022
|
-
|
|
3023
|
-
selectedInput
|
|
3024
|
-
|
|
3025
|
-
|
|
3027
|
+
setElementAttribute({
|
|
3028
|
+
element: selectedInput,
|
|
3029
|
+
attributeName: `data-selected-option${optionIndex}`,
|
|
3030
|
+
value
|
|
3031
|
+
});
|
|
3026
3032
|
const option1 = `[data-option-1="${selectedInput.attributes["data-selected-option1"].value}"]`;
|
|
3027
3033
|
const option2 = `${selectedInput.attributes["data-selected-option2"] ? `[data-option-2="${selectedInput.attributes["data-selected-option2"].value}"]` : ""}`;
|
|
3028
3034
|
const selectOption = parentCard.querySelector(`select option${option1}${option2}`);
|
|
@@ -3032,10 +3038,27 @@ const ProductCard = (props) => {
|
|
|
3032
3038
|
const inventoryManagement = (_c2 = selectOption.attributes["data-inventory-management"]) == null ? void 0 : _c2.value;
|
|
3033
3039
|
const inventoryPolicy = (_d = selectOption.attributes["data-inventory-policy"]) == null ? void 0 : _d.value;
|
|
3034
3040
|
const setOther = () => {
|
|
3035
|
-
|
|
3036
|
-
|
|
3037
|
-
|
|
3038
|
-
|
|
3041
|
+
var _a3, _b3;
|
|
3042
|
+
setElementAttribute({
|
|
3043
|
+
element: selectedInput,
|
|
3044
|
+
attributeName: "data-variant-id",
|
|
3045
|
+
value: ((_b3 = (_a3 = selectOption == null ? void 0 : selectOption.attributes) == null ? void 0 : _a3["data-graphql-id"]) == null ? void 0 : _b3.value) || ""
|
|
3046
|
+
});
|
|
3047
|
+
setElementAttribute({
|
|
3048
|
+
element: selectedInput,
|
|
3049
|
+
attributeName: "data-inventory-quantity",
|
|
3050
|
+
value: inventoryQuantity || ""
|
|
3051
|
+
});
|
|
3052
|
+
setElementAttribute({
|
|
3053
|
+
element: selectedInput,
|
|
3054
|
+
attributeName: "data-inventory-management",
|
|
3055
|
+
value: inventoryManagement || ""
|
|
3056
|
+
});
|
|
3057
|
+
setElementAttribute({
|
|
3058
|
+
element: selectedInput,
|
|
3059
|
+
attributeName: "data-inventory-policy",
|
|
3060
|
+
value: inventoryPolicy || ""
|
|
3061
|
+
});
|
|
3039
3062
|
if (variantId)
|
|
3040
3063
|
setSelectedVariantId(variantId);
|
|
3041
3064
|
if (inventoryQuantity)
|