@orderingstack/front-components-product-configurator 1.2.3 → 1.3.0
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/components/ProductConfigurator/ProductConfigurator.d.ts.map +1 -1
- package/dist/context/Components.d.ts +3 -11
- package/dist/context/Components.d.ts.map +1 -1
- package/dist/context/ProductData.d.ts +11 -0
- package/dist/context/ProductData.d.ts.map +1 -0
- package/dist/index.cjs.js +5 -5
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.es.js +45 -24
- package/dist/index.es.js.map +1 -1
- package/package.json +1 -1
package/dist/index.es.js
CHANGED
|
@@ -10257,6 +10257,25 @@ const MenuProductRoot = (props) => {
|
|
|
10257
10257
|
});
|
|
10258
10258
|
};
|
|
10259
10259
|
var style = "";
|
|
10260
|
+
const ProductDataContext = React.createContext(null);
|
|
10261
|
+
function ProductDataProvider({
|
|
10262
|
+
rootProduct,
|
|
10263
|
+
children
|
|
10264
|
+
}) {
|
|
10265
|
+
return /* @__PURE__ */ jsx(ProductDataContext.Provider, {
|
|
10266
|
+
value: {
|
|
10267
|
+
rootProduct
|
|
10268
|
+
},
|
|
10269
|
+
children
|
|
10270
|
+
});
|
|
10271
|
+
}
|
|
10272
|
+
function useProductData() {
|
|
10273
|
+
const context = useContext(ProductDataContext);
|
|
10274
|
+
if (!context) {
|
|
10275
|
+
throw new Error("Missing ComponentsContext");
|
|
10276
|
+
}
|
|
10277
|
+
return context;
|
|
10278
|
+
}
|
|
10260
10279
|
function ProductConfigurator(props) {
|
|
10261
10280
|
const {
|
|
10262
10281
|
product,
|
|
@@ -10302,7 +10321,6 @@ function ProductConfigurator(props) {
|
|
|
10302
10321
|
}
|
|
10303
10322
|
});
|
|
10304
10323
|
const {
|
|
10305
|
-
handleSubmit,
|
|
10306
10324
|
getValues
|
|
10307
10325
|
} = methods;
|
|
10308
10326
|
const countedProductPrice = Number((parseFloat(price || "0") + countPrice(getValues("selected"), product)).toFixed(2));
|
|
@@ -10329,32 +10347,35 @@ function ProductConfigurator(props) {
|
|
|
10329
10347
|
};
|
|
10330
10348
|
const handleOnSubmit = () => onSubmit();
|
|
10331
10349
|
return /* @__PURE__ */ jsx(Fragment, {
|
|
10332
|
-
children: /* @__PURE__ */ jsx(
|
|
10333
|
-
|
|
10334
|
-
children: /* @__PURE__ */ jsx(
|
|
10335
|
-
|
|
10336
|
-
children: /* @__PURE__ */
|
|
10337
|
-
|
|
10338
|
-
|
|
10339
|
-
children: /* @__PURE__ */ jsx(
|
|
10340
|
-
|
|
10341
|
-
|
|
10342
|
-
|
|
10343
|
-
|
|
10344
|
-
|
|
10345
|
-
|
|
10346
|
-
|
|
10347
|
-
|
|
10348
|
-
|
|
10349
|
-
|
|
10350
|
-
|
|
10351
|
-
|
|
10352
|
-
|
|
10353
|
-
|
|
10350
|
+
children: /* @__PURE__ */ jsx(ProductDataProvider, {
|
|
10351
|
+
rootProduct: product,
|
|
10352
|
+
children: /* @__PURE__ */ jsx(ComponentsContext.Provider, {
|
|
10353
|
+
value: props.components,
|
|
10354
|
+
children: /* @__PURE__ */ jsx(FormProvider, {
|
|
10355
|
+
...methods,
|
|
10356
|
+
children: /* @__PURE__ */ jsxs("form", {
|
|
10357
|
+
children: [showDebugState && /* @__PURE__ */ jsx("div", {
|
|
10358
|
+
className: "hidden",
|
|
10359
|
+
children: /* @__PURE__ */ jsx(DisplayState, {})
|
|
10360
|
+
}), /* @__PURE__ */ jsx(MenuProductRoot, {
|
|
10361
|
+
product: encodedProduct,
|
|
10362
|
+
productQuantity,
|
|
10363
|
+
validationMap,
|
|
10364
|
+
isOpen,
|
|
10365
|
+
handleClose,
|
|
10366
|
+
handleGoBack,
|
|
10367
|
+
handleOnSubmit,
|
|
10368
|
+
countedProductPrice,
|
|
10369
|
+
countedProductTotalPrice: countedProductPrice * productQuantity,
|
|
10370
|
+
increaseProductQuantity,
|
|
10371
|
+
decreaseProductQuantity,
|
|
10372
|
+
currency
|
|
10373
|
+
})]
|
|
10374
|
+
})
|
|
10354
10375
|
})
|
|
10355
10376
|
})
|
|
10356
10377
|
})
|
|
10357
10378
|
});
|
|
10358
10379
|
}
|
|
10359
|
-
export { ContextType, MainView, ProductConfigurator, ProductKinds, ProductTypes, SelMinSelMaxStatus, index_esm as hookForm };
|
|
10380
|
+
export { ContextType, MainView, ProductConfigurator, ProductKinds, ProductTypes, SelMinSelMaxStatus, index_esm as hookForm, useProductData };
|
|
10360
10381
|
//# sourceMappingURL=index.es.js.map
|