@artisan-commerce/products 0.9.0-canary.69 → 0.9.0-canary.70

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/bundle.cjs CHANGED
@@ -635,17 +635,19 @@ const getProductTotals = (product, amount = product.amount > 0 ? product.amount
635
635
  throw new Error("Cannot set the amount of getProductTotals with a value less than 1");
636
636
  }
637
637
  const cartProduct = product;
638
+ const { priceCategory } = cartProduct;
639
+ const isPoints = priceCategory === "POINTS";
638
640
  const sanitize = !!cartProduct.updatedAt;
639
641
  const sanitized = sanitize ? divideProductQA(cartProduct) : product;
640
642
  return {
641
643
  unitGrossPrice: getProductGrossPrice(sanitized, 1),
642
644
  unitTotalDiscounts: getProductTotalDiscounts(),
643
- unitTotalTaxes: getProductTotalTaxes(sanitized, 1),
645
+ unitTotalTaxes: !isPoints ? getProductTotalTaxes(sanitized, 1) : 0,
644
646
  unitNetPrice: getProductNetPrice(sanitized, 1),
645
647
  amount,
646
648
  grossPrice: getProductGrossPrice(sanitized, amount),
647
649
  totalDiscounts: getProductTotalDiscounts(),
648
- totalTaxes: getProductTotalTaxes(sanitized, amount),
650
+ totalTaxes: !isPoints ? getProductTotalTaxes(sanitized, amount) : 0,
649
651
  netPrice: getProductNetPrice(sanitized, amount)
650
652
  };
651
653
  };
@@ -1 +1 @@
1
- {"version":3,"file":"bundle.cjs","sources":["../src/utils/assertions/assertions.utils.ts","../src/utils/common.utils.ts","../src/utils/modifiers/common.utils.ts","../src/utils/questionsAndAnswers/questionsAndAnswers.utils.ts","../src/utils/transformers/transformers.utils.ts","../src/lib/buildProductFromRenderer/buildProductFromRenderer.ts","../src/utils/modifiers/rendererTraversal.utils.ts","../src/utils/calculations/calculations.utils.ts","../../state/dist/bundle.mjs","../src/utils/state.ts","../src/utils/modifiers/renderer.utils.ts","../src/lib/validateProduct/validateProduct.ts","../src/utils/modifiers/form.utils.ts","../src/lib/registerModifiersForm/registerModifiersForm.ts"],"sourcesContent":["// Product assertion functions\nimport { BaseProduct } from \"@artisan-commerce/types\";\nimport { ProductDetails } from \"@artisan-commerce/types\";\nimport { CartProduct } from \"@artisan-commerce/types\";\nimport { FormCartProduct } from \"../../types/modifiers.types\";\n\n// For none typescript users it is very important to check if the given obj is a valid BaseProduct\nexport const isBaseProduct = (product: BaseProduct): boolean => {\n const { name, images, prices, productId } = product;\n if (typeof name !== \"string\") {\n return false;\n }\n if (typeof productId !== \"string\") {\n return false;\n }\n if (\n typeof prices !== \"object\" ||\n (typeof prices === \"object\" && Object.keys(prices).length < 1)\n ) {\n return false;\n }\n if (!Array.isArray(images)) {\n return false;\n }\n //@ts-expect-error This help differentiate an answer from a product\n if (product.questionId) return false;\n\n return true;\n};\n\n// For none typescript users it is very important to check if the given obj is a valid ProductDetails\nexport const isProductDetails = (product: ProductDetails): boolean => {\n const validBaseProduct = isBaseProduct(product);\n if (!validBaseProduct) {\n return false;\n }\n const { questions } = product;\n\n if (!Array.isArray(questions)) {\n return false;\n }\n\n return true;\n};\n\n// For none typescript users it is very important to check if the given obj is a valid CartProduct\nexport const isCartProduct = (product: CartProduct): boolean => {\n const validProductDetails = isProductDetails(product as ProductDetails);\n if (!validProductDetails) {\n return false;\n }\n const { hash, createdAt, updatedAt } = product;\n const { amount, priceCategory, comment, questionsAndAnswers } = product;\n\n if (typeof hash !== \"string\") {\n return false;\n }\n if (typeof createdAt !== \"string\") {\n return false;\n }\n if (typeof updatedAt !== \"string\") {\n return false;\n }\n if (typeof amount !== \"number\") {\n return false;\n }\n if (typeof comment !== \"string\") {\n return false;\n }\n if (![\"NORMAL\", \"POINTS\"].includes(priceCategory)) {\n return false;\n }\n if (!Array.isArray(questionsAndAnswers)) {\n return false;\n }\n return true;\n};\n\nexport const isFormCartProduct = (product: FormCartProduct): boolean => {\n const validCartProduct = isCartProduct(product as any);\n if (!validCartProduct) {\n return false;\n }\n const { questions } = product;\n if (!Array.isArray(questions)) {\n return false;\n }\n const answers = questions?.[0]?.answers;\n if (answers?.length && typeof answers[0].amount === \"undefined\") {\n return false;\n }\n return true;\n};\n","// Common utility functions\n\nexport const stringIsNumber = (value: string) => isNaN(Number(value)) === false;\n\nexport const enumToArray = (enumObj: any): string[] => {\n return Object.keys(enumObj);\n};\n\nexport const logError = (message: string) => {\n if (process.env.NODE_ENV === \"production\") {\n console.error(message);\n } else {\n throw new Error(message);\n }\n};\n","// Modifiers utility functions\nimport { ProductQuestion } from \"@artisan-commerce/types\";\n\nimport { BuildModifierRendererConfig } from \"../../lib/registerModifiersForm/registerModifiersForm.types\";\nimport { RendererError } from \"../../types/common.types\";\nimport { RendererStatus } from \"../../types/modifiers.types\";\nimport { ModifierRenderer } from \"../../types/modifiers.types\";\nimport { ModifierGroupRenderer } from \"../../types/modifiers.types\";\nimport { GetModifierTypeConfig } from \"../../types/modifiers.types\";\nimport { GroupTypes, ModifierTypes } from \"../../types/modifiers.types\";\nimport { logError } from \"../common.utils\";\n\nexport const getGroupType = (group: ProductQuestion): GroupTypes => {\n const { min, max, type } = group;\n if (type) {\n if (type === \"QUANTITY\" || type === \"SELECT\") {\n return \"COUNTER\";\n }\n return type as GroupTypes;\n }\n if (min === 0 && max === 1) {\n return \"CHECKBOX\";\n }\n if (min === 1 && max === 1) {\n return \"RADIO\";\n }\n if (min === 0 && (max === 0 || max === Infinity)) {\n return \"COUNTER\";\n }\n if (max >= min) {\n return \"COUNTER\";\n }\n throw new Error(\n `Modifier group bad configured. min ${min}, max ${max}, type ${type}`\n );\n};\n\nexport const getModifierType = (\n config: GetModifierTypeConfig\n): ModifierTypes => {\n const { groupType, min, max, type } = config;\n if (groupType === \"RADIO\") {\n return \"RADIO\";\n }\n if (type) {\n if (type === \"QUANTITY\" || type === \"SELECT\") {\n return \"COUNTER\";\n }\n return type as ModifierTypes;\n }\n if (min === 1 && max === 1) {\n return \"RADIO\";\n }\n if (min === 0 && max === 1) {\n return \"CHECKBOX\";\n }\n if (min === 0 && (max === 0 || max === Infinity)) {\n return \"COUNTER\";\n }\n if (max >= min) {\n return \"COUNTER\";\n }\n return groupType;\n};\n\n// Only for Normalization\nexport const getModifierMin = (groupConfig: BuildModifierRendererConfig) => {\n const { min, modifiersCount } = groupConfig;\n if (modifiersCount === 1) {\n return min;\n }\n return 0;\n};\n\n// Only for Normalization\nexport const getModifierMax = (groupConfig: BuildModifierRendererConfig) => {\n const { max, type } = groupConfig;\n const normalizedMax = max || Infinity;\n if (type === \"RADIO\") {\n return 1;\n }\n if (type === \"CHECKBOX\") {\n return 1;\n }\n if (type === \"COUNTER\") {\n return normalizedMax;\n }\n return normalizedMax;\n};\n\nexport const getModifierErrors = (\n modifier: ModifierRenderer,\n amount: number,\n strict: boolean\n): RendererError[] => {\n const errors: RendererError[] = [];\n const { max, min } = modifier;\n if (amount > max) {\n errors.push({\n code: 101,\n message: `Amount is heigher than the maximum allowed amount ${max}`\n });\n }\n if (strict && amount < min) {\n errors.push({\n code: 102,\n message: `Amount is lower than the minimum allowed amount ${min}`\n });\n }\n return errors;\n};\n\nexport const getGroupModifierErrors = (\n group: ModifierGroupRenderer,\n strict: boolean\n): RendererError[] => {\n const errors: RendererError[] = [];\n const { modifiers, data } = group;\n const { min } = data;\n let { max } = data;\n if (min === 0 && max === 0) {\n max = Infinity;\n }\n const amount = modifiers.reduce((acc, modifier) => {\n return acc + modifier.amount;\n }, 0);\n if (amount > max) {\n errors.push({\n code: 201,\n message: `Amount is heigher than the maximum allowed amount ${max}`\n });\n }\n if (strict && amount < min) {\n errors.push({\n code: 202,\n message: `Amount is lower than the minimum allowed amount ${min}`\n });\n }\n return errors;\n};\n\n// Map a modifier group to a rendererStatus\nexport const getGroupRendererStatus = (\n group: ModifierGroupRenderer\n): RendererStatus => {\n const { touched, errors, required, data, modifiers } = group;\n const { min } = data;\n const childrenWithError = modifiers.some(\n modifier => modifier.status === \"FAIL\"\n );\n const childrenIdle = modifiers.some(modifier => modifier.status === \"IDLE\");\n const childrenIncomplete = modifiers.some(\n modifier => modifier.status === \"INCOMPLETE\"\n );\n const amount = modifiers.reduce((acc, modifier) => {\n return acc + modifier.amount;\n }, 0);\n\n return mapRenderStatusHelper({\n touched,\n errors,\n required,\n min,\n amount,\n childrenWithError,\n childrenIdle,\n childrenIncomplete,\n reviewChildren: true\n });\n};\n\n// Map a modifier to a rendererStatus\nexport const getModifierRendererStatus = (\n modifier: ModifierRenderer\n): RendererStatus => {\n const childrenWithError = modifier.groups.some(\n group => group.status === \"FAIL\"\n );\n const childrenIdle = modifier.groups.some(group => group.status === \"IDLE\");\n const childrenIncomplete = modifier.groups.some(\n group => group.status === \"INCOMPLETE\"\n );\n const { touched, errors, required, min, amount } = modifier;\n const reviewChildren = amount > 0;\n return mapRenderStatusHelper({\n touched,\n errors,\n required,\n min,\n amount,\n childrenWithError,\n childrenIdle,\n childrenIncomplete,\n reviewChildren\n });\n};\n\nconst mapRenderStatusHelper = (config: {\n touched: boolean;\n errors: RendererError[];\n required: boolean;\n amount: number;\n min: number;\n childrenWithError: boolean;\n childrenIdle: boolean;\n childrenIncomplete: boolean;\n reviewChildren: boolean;\n}): RendererStatus => {\n const { touched, errors, required, min, amount, reviewChildren } = config;\n const { childrenWithError, childrenIdle, childrenIncomplete } = config;\n const firstRender = amount > 0 && !touched;\n // NOT TOUCHED\n // If the current node has not been interacted with but it is required\n if (!firstRender && !touched && required) {\n return \"IDLE\";\n }\n // If the current node has not been interacted with and it is not required\n if (!firstRender && !touched && !required) {\n return \"OK\";\n }\n // TOUCHED\n // If current node has an error\n if (errors.length) {\n return \"FAIL\";\n }\n // If any children node has an error\n if (reviewChildren && childrenWithError) {\n return \"FAIL\";\n }\n // If children should be shown, check their status in consideration\n if (reviewChildren && (childrenIdle || childrenIncomplete)) {\n return \"INCOMPLETE\";\n }\n // If current node do not have the minimum amount\n // (if group the amount is the accumulation of its children)\n if (amount < min) {\n return \"INCOMPLETE\";\n }\n // If current node have the minimum amount\n // (if group the amount is the accumulation of its children)\n if (amount >= min) {\n return \"OK\";\n }\n\n logError(\n `Unhandled case. Unable to compute the renderer status ${JSON.stringify(\n {\n touched,\n errors,\n required,\n min,\n amount\n },\n undefined,\n 2\n )}`\n );\n return \"FAIL\";\n};\n\n// Map renderer top level to its status\nexport const mapGlobalRendererStatus = (\n renderer: ModifierGroupRenderer[]\n): RendererStatus => {\n // Every group has OK status or group is IDLE but not required\n const allChildrenOk = renderer.every(group => {\n const { status, required } = group;\n const ok = status === \"OK\";\n const idleNotRequired = status === \"IDLE\" && !required;\n return ok || idleNotRequired;\n });\n if (allChildrenOk) {\n return \"OK\";\n }\n // Every group has not been touched\n const childrenIsIdle = renderer.every(group => !group.touched);\n if (childrenIsIdle) {\n return \"IDLE\";\n }\n // Any group status is FAIL\n const chidrenWithError = renderer.some(group => group.status === \"FAIL\");\n if (chidrenWithError) {\n return \"FAIL\";\n }\n\n return \"INCOMPLETE\";\n};\n","// Questions & Answers utility functions\nimport { CartProduct } from \"@artisan-commerce/types\";\nimport { CartProductAnswer } from \"@artisan-commerce/types\";\n\n// Multiply the QA amount times the product amount\nexport const multiplyProductQA = (\n product: CartProduct | CartProductAnswer\n): CartProduct => {\n return operationOnProductQA(product, (answer, productAmount) => {\n const accAmount = answer.amount * productAmount;\n const fixedAnswer = multiplyProductQA({\n ...answer,\n amount: accAmount\n }) as any;\n return { ...fixedAnswer, amount: answer.amount * productAmount };\n });\n};\n\n// Divide the QA amount by the product amount\nexport const divideProductQA = (\n product: CartProduct | CartProductAnswer\n): CartProduct => {\n return operationOnProductQA(product, (answer, productAmount) => {\n const fixedAnswer = divideProductQA(answer) as any;\n return { ...fixedAnswer, amount: answer.amount / productAmount };\n });\n};\n\n// Run a answerEnhancer over each answer to make an operation\nexport const operationOnProductQA = (\n product: CartProduct | CartProductAnswer,\n answerEnhancer: (\n answer: CartProductAnswer,\n amount: number\n ) => CartProductAnswer\n): CartProduct => {\n const { amount: productAmount = 1, questionsAndAnswers = [] } = product;\n const newQuestionsAndAnswers = questionsAndAnswers.map(question => {\n const answers = question.answers.map(answer => {\n return answerEnhancer(answer, productAmount);\n });\n return { ...question, answers };\n });\n return {\n ...product,\n questionsAndAnswers: newQuestionsAndAnswers\n } as CartProduct;\n};\n","// Transformer functions\nimport { ProductDetails } from \"@artisan-commerce/types\";\nimport { BaseProduct, Product, CartProduct } from \"@artisan-commerce/types\";\n\nimport { BuildModifierRendererConfig } from \"../../lib/registerModifiersForm/registerModifiersForm.types\";\nimport { FormCartProduct } from \"../../types/modifiers.types\";\nimport { FormCartProductAnswer } from \"../../types/modifiers.types\";\nimport { FormCartProductQuestions } from \"../../types/modifiers.types\";\nimport { isFormCartProduct } from \"../assertions/assertions.utils\";\nimport { isCartProduct } from \"../assertions/assertions.utils\";\nimport { isProductDetails } from \"../assertions/assertions.utils\";\nimport { getModifierMax, getModifierType } from \"../modifiers/common.utils\";\nimport { getGroupType, getModifierMin } from \"../modifiers/common.utils\";\nimport { divideProductQA } from \"../questionsAndAnswers/questionsAndAnswers.utils\";\n\nexport const toCartProduct = (\n product: Product,\n overrides: Partial<CartProduct> = {}\n): CartProduct => {\n if (isCartProduct(product as CartProduct)) {\n return { ...product, ...overrides } as CartProduct;\n }\n if (isProductDetails(product as ProductDetails)) {\n return toCartProductFromProductDetails(\n product as ProductDetails,\n overrides\n );\n }\n const productDetails = toProductDetails(product);\n return toCartProductFromProductDetails(productDetails, overrides);\n};\n\n// Transform from product details to cart product\nconst toCartProductFromProductDetails = (\n product: ProductDetails,\n overrides: Partial<CartProduct> = {}\n): CartProduct => {\n const { questionsAndAnswers, priceCategory, amount } = product as CartProduct;\n const newCartProduct: CartProduct = {\n ...product,\n questionsAndAnswers: questionsAndAnswers ?? [],\n amount: amount ?? 0,\n priceCategory: priceCategory ?? \"NORMAL\",\n comment: \"\",\n alerts: [],\n hash: \"\",\n createdAt: \"\",\n updatedAt: \"\",\n ...overrides\n };\n return newCartProduct;\n};\n\n// Transform from BaseProduct to ProductDetails\nconst toProductDetails = (\n product: BaseProduct,\n overrides: Partial<ProductDetails> = {}\n): ProductDetails => {\n return {\n ...product,\n addDirectlyToCart: true,\n isPriceVip: false,\n manufacturer: [],\n maxAmountForSale: 0,\n questions: [],\n schedule: [],\n benefitId: null,\n categories: null,\n ...overrides\n };\n};\n\n// transforms a product into a cart product by its questions are transformed similar to questions and answers\nexport const toFormCartProduct = (\n product: Product,\n overrides: Partial<FormCartProduct> = {}\n): FormCartProduct => {\n if (isFormCartProduct(product as FormCartProduct)) {\n return { ...product, ...overrides } as FormCartProduct;\n }\n if (isProductDetails(product as ProductDetails)) {\n return toFormCartProductFromProductDetails(\n product as ProductDetails,\n overrides\n );\n }\n const productDetails = toProductDetails(product);\n return toFormCartProductFromProductDetails(productDetails, overrides);\n};\n\nexport const toFormCartProductHelper = (\n product: CartProduct | FormCartProductAnswer,\n overrides: Partial<FormCartProduct> = {}\n): FormCartProduct => {\n const fixedProduct = divideProductQA(product as CartProduct);\n const { priceCategory, productId, amount } = fixedProduct;\n const newQuestions = fixedProduct.questions.map<FormCartProductQuestions>(\n (question: any) => {\n const pairQuestion = fixedProduct.questionsAndAnswers?.find(q => {\n return q.questionId === question.questionId;\n });\n const selectedQuestion = pairQuestion ?? question;\n const { questionId, min, max } = selectedQuestion;\n const answerConfig: BuildModifierRendererConfig = {\n rootId: productId,\n min,\n max,\n type: getGroupType(selectedQuestion),\n modifiersCount: question.answers.length,\n amount,\n path: [] // unnecesary\n };\n\n return {\n ...selectedQuestion,\n answers: question.answers.map((answer: any) => {\n const pairAnswer = pairQuestion?.answers.find(a => {\n return a.amount > 0 && a.productId === answer.productId;\n });\n const selectedAnswer = pairAnswer ?? answer;\n const min = getModifierMin(answerConfig);\n const max = getModifierMax(answerConfig);\n const type = getModifierType({\n min,\n max,\n groupType: answerConfig.type,\n type: selectedAnswer.renderType\n });\n const nested = selectedAnswer.questions?.length ?? 0;\n const partialNewAnswer = {\n ...selectedAnswer,\n amount: selectedAnswer?.amount ?? 0,\n priceCategory,\n questionId,\n min,\n max,\n renderType: type\n };\n return {\n ...partialNewAnswer,\n questions: nested\n ? toFormCartProductHelper(partialNewAnswer).questions\n : []\n };\n })\n };\n }\n );\n return {\n ...fixedProduct,\n questions: newQuestions,\n ...overrides\n } as FormCartProduct;\n};\n\nexport const toFormCartProductFromProductDetails = (\n product: ProductDetails,\n overrides: Partial<FormCartProduct> = {}\n): FormCartProduct => {\n const cartProduct = toCartProductFromProductDetails(product);\n return toFormCartProductHelper(cartProduct, overrides);\n};\n\nexport const toFormCartProductFromAnswer = (\n modifier: FormCartProductAnswer,\n overrides: Partial<FormCartProduct> = {}\n) => {\n return toFormCartProductHelper(modifier, overrides);\n};\n\nexport const normalizeProductDetails = (\n product: ProductDetails\n): ProductDetails => {\n const { questions } = product;\n return {\n ...product,\n questions: questions.map(question => {\n const { answers } = question;\n return {\n ...question,\n answers: answers.map(answer => {\n const { questions } = answer;\n return {\n ...answer,\n questions: questions ?? []\n };\n })\n };\n })\n };\n};\n","import { CartProduct, CartProductAnswer } from \"@artisan-commerce/types\";\nimport { CartProductQuestion, Product } from \"@artisan-commerce/types\";\n\nimport { ModifierGroupRenderer } from \"../../types/modifiers.types\";\nimport { ModifierRenderer } from \"../../types/modifiers.types\";\nimport { toCartProduct } from \"../../utils/transformers/transformers.utils\";\n\nexport const buildProductFromRenderer = (\n renderer: ModifierGroupRenderer[],\n product: Product\n): CartProduct => {\n const baseCartProduct = toCartProduct(product);\n return {\n ...baseCartProduct,\n questionsAndAnswers: buildQuestionAndAnswersFromRenderer(renderer),\n // Necessary for dividing QA when calculating product totals\n updatedAt: \"\"\n };\n};\n\n/**\n * Update answers with up to date data\n * @param groups Group renderers with up to date data\n */\nexport const buildQuestionAndAnswersFromRenderer = (\n groups: ModifierGroupRenderer[]\n): CartProductQuestion[] => {\n return groups.map<CartProductQuestion>(group => {\n return {\n ...group.data,\n answers: buildAnswersFromRenderer(group.modifiers)\n };\n });\n};\n\n/**\n * Update questionsAndAnswers with up to date data\n * @param modifiers Group renderers with up to date data\n */\nexport const buildAnswersFromRenderer = (modifiers: ModifierRenderer[]) => {\n return modifiers.map<CartProductAnswer>(modifier => {\n if (!modifier.amount) {\n return { ...modifier.data, questionsAndAnswers: [] };\n }\n return {\n ...modifier.data,\n questionsAndAnswers: buildQuestionAndAnswersFromRenderer(modifier.groups)\n };\n });\n};\n","// renderer traversal utility functions\nimport { ModifierGroupRenderer, ModifierRenderer } from \"../..\";\n\nexport const getRendererPathNode = (\n groups: ModifierGroupRenderer[],\n path: string[]\n) => {\n let remainingPath = [...path];\n let segments: (ModifierGroupRenderer | ModifierRenderer)[] = groups;\n let node: ModifierGroupRenderer | ModifierRenderer = groups[0];\n while (remainingPath.length) {\n node = findNodeInPath(segments, remainingPath[0]);\n remainingPath = remainingPath.slice(1);\n const isGroup = Object.prototype.hasOwnProperty.call(node, \"modifiers\");\n if (isGroup) {\n segments = (node as ModifierGroupRenderer).modifiers;\n } else {\n segments = (node as ModifierRenderer).groups;\n }\n }\n return node;\n};\n\nexport const setRendererPathNode = (\n renderer: ModifierGroupRenderer[],\n path: string[],\n replacement: ModifierGroupRenderer | ModifierRenderer\n): ModifierGroupRenderer[] => {\n let remainingPath = [...path];\n let segments: (ModifierGroupRenderer | ModifierRenderer)[] = renderer;\n let node: ModifierGroupRenderer | ModifierRenderer = findNodeInPath(\n segments,\n remainingPath[0]\n );\n let isGroup = Object.prototype.hasOwnProperty.call(node, \"modifiers\");\n\n while (remainingPath.length > 1) {\n node = findNodeInPath(segments, remainingPath[0]);\n remainingPath = remainingPath.slice(1);\n isGroup = Object.prototype.hasOwnProperty.call(node, \"modifiers\");\n if (isGroup) {\n segments = [...(node as ModifierGroupRenderer).modifiers];\n } else {\n segments = [...(node as ModifierRenderer).groups];\n }\n }\n const replacerId = remainingPath[0];\n if (path.length === 1) {\n node = { groups: renderer } as any;\n isGroup = false;\n }\n if (isGroup) {\n const newModifiers = (node as ModifierGroupRenderer).modifiers.map(item => {\n if (item.id === replacerId) {\n return { ...replacement };\n }\n return { ...item };\n });\n (node as any).modifiers = newModifiers;\n } else {\n const newGroups = (node as ModifierRenderer).groups.map(item => {\n if (item.id === replacerId) {\n return { ...replacement };\n }\n return { ...item };\n });\n (node as any).groups = newGroups;\n }\n if (path.length === 1) {\n return [...(node as any).groups];\n }\n return [...renderer];\n};\n\nexport const findNodeInPath = (\n segments: (ModifierGroupRenderer | ModifierRenderer)[],\n segmentId: string\n): ModifierGroupRenderer | ModifierRenderer => {\n const node = segments.find(segment => {\n return segment.id === segmentId;\n });\n if (!node) {\n throw new Error(\n `Path segment ${segmentId} doesn't exist in segments ${JSON.stringify(\n segments.map(segment => segment.id)\n )}`\n );\n }\n return node;\n};\n","// Calculations utility functions\nimport { Product, PriceCategoryTax } from \"@artisan-commerce/types\";\nimport { CartProductAnswer, CartProduct } from \"@artisan-commerce/types\";\nimport { divideProductQA } from \"../questionsAndAnswers/questionsAndAnswers.utils\";\n\nimport { toCartProduct } from \"../transformers/transformers.utils\";\nimport { ProductTotals } from \"./calculations.utils.types\";\n\n/**\n * Get a summary of all price totals of a given product\n *\n * @since 0.1.0\n * @param product the product that will be calculated\n * @param amount amount of products, if not provided will use product amount field\n * @returns an object with a summary of the product totals\n */\nexport const getProductTotals = (\n product: Product,\n amount = (product as CartProduct).amount > 0\n ? (product as CartProduct).amount\n : 1\n): ProductTotals => {\n if (amount < 1) {\n throw new Error(\n \"Cannot set the amount of getProductTotals with a value less than 1\"\n );\n }\n const cartProduct = product as CartProduct;\n const sanitize = !!cartProduct.updatedAt;\n const sanitized = sanitize ? divideProductQA(cartProduct) : product;\n return {\n unitGrossPrice: getProductGrossPrice(sanitized, 1),\n unitTotalDiscounts: getProductTotalDiscounts(sanitized, 1),\n unitTotalTaxes: getProductTotalTaxes(sanitized, 1),\n unitNetPrice: getProductNetPrice(sanitized, 1),\n amount,\n grossPrice: getProductGrossPrice(sanitized, amount),\n totalDiscounts: getProductTotalDiscounts(sanitized, amount),\n totalTaxes: getProductTotalTaxes(sanitized, amount),\n netPrice: getProductNetPrice(sanitized, amount)\n };\n};\n\n// Calculate the product and Q&A taxes total\nexport const getProductTotalTaxes = (product: Product, setAmount: number) => {\n const cartProduct = toCartProduct(product, { amount: setAmount });\n const { prices, amount, priceCategory } = cartProduct;\n const { taxes, grossPrice } = prices[priceCategory];\n const taxTotal = getTaxTotal(taxes, grossPrice);\n const questionsSum = getModifiersTotalTaxes(cartProduct, setAmount);\n if (taxTotal === null || questionsSum === null) {\n return null;\n }\n return questionsSum + taxTotal * amount;\n};\n\n// helper to get the total amount of taxes of the modifiers recursively\nexport const getModifiersTotalTaxes = (\n product: CartProduct | CartProductAnswer,\n setAmount: number\n): number => {\n return (\n product.questionsAndAnswers?.reduce((acc, question) => {\n const answersSum = question.answers.reduce((acc, answer) => {\n const { prices, amount, priceCategory } = answer;\n const { taxes, grossPrice } = prices[priceCategory];\n const taxTotal = getTaxTotal(taxes, grossPrice);\n const childrenTotal = getModifiersTotalTaxes(answer, setAmount);\n // Modifiers will always return a number (HACK)\n return acc + amount * (Number(taxTotal) + childrenTotal);\n }, 0);\n return acc + answersSum * setAmount;\n }, 0) ?? 0\n );\n};\n\n// Calculate the product and Q&A grossPrice total\nexport const getProductGrossPrice = (product: Product, setAmount: number) => {\n return getProductFieldPrice(product, \"grossPrice\", setAmount);\n};\n\nexport const getProductTotalDiscounts = (\n product: Product,\n setAmount: number\n) => {\n return null;\n};\n\n// Calculate the product and Q&A netPrice total\nexport const getProductNetPrice = (\n product: Product,\n setAmount: number\n): number => {\n return getProductFieldPrice(product, \"netPrice\", setAmount);\n};\n\n// Helper to Calculate the product and Q&A fields\nexport const getProductFieldPrice = (\n product: Product,\n field: \"grossPrice\" | \"netPrice\",\n setAmount: number\n): number => {\n const cartProduct = toCartProduct(product, { amount: setAmount });\n const { prices, amount, priceCategory } = cartProduct;\n const priceField = prices[priceCategory][field];\n const questionsSum = getModifiersFieldTotal(cartProduct, field);\n return (questionsSum + priceField) * amount;\n};\n\n// helper to get the total amount of the modifiers recursively\nexport const getModifiersFieldTotal = (\n product: CartProduct | CartProductAnswer,\n field: \"grossPrice\" | \"netPrice\"\n): number => {\n return (\n product.questionsAndAnswers?.reduce((acc, question) => {\n const answersSum = question.answers.reduce((acc, answer) => {\n const { prices, amount, priceCategory } = answer;\n const priceField = prices[priceCategory][field];\n const childrenTotal = getModifiersFieldTotal(answer, field);\n return acc + amount * (priceField + childrenTotal);\n }, 0);\n return acc + answersSum;\n }, 0) ?? 0\n );\n};\n\n// Helper to calculate the total amount of taxes of a taxes object\nexport const getTaxTotal = (taxes: PriceCategoryTax[], grossPrice: number) => {\n if (!taxes.length) {\n return null;\n }\n return taxes.reduce((acc, tax) => {\n return acc + (tax.percentage / 100) * grossPrice;\n }, 0);\n};\n","var __defProp = Object.defineProperty;\nvar __getOwnPropSymbols = Object.getOwnPropertySymbols;\nvar __hasOwnProp = Object.prototype.hasOwnProperty;\nvar __propIsEnum = Object.prototype.propertyIsEnumerable;\nvar __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;\nvar __spreadValues = (a, b) => {\n for (var prop in b || (b = {}))\n if (__hasOwnProp.call(b, prop))\n __defNormalProp(a, prop, b[prop]);\n if (__getOwnPropSymbols)\n for (var prop of __getOwnPropSymbols(b)) {\n if (__propIsEnum.call(b, prop))\n __defNormalProp(a, prop, b[prop]);\n }\n return a;\n};\nconst _State = class {\n constructor(state) {\n this._state = state;\n this._initialState = state;\n }\n static getInstance(initialState) {\n if (!_State._instance) {\n _State._instance = new _State(initialState);\n }\n return _State._instance;\n }\n setState(overrides) {\n this._state = __spreadValues(__spreadValues({}, this._state), overrides);\n }\n get state() {\n if (this._state === null) {\n throw new Error(\"The state has not been initialized, make sure to call State.init beforehand\");\n }\n return this._state;\n }\n checkInit() {\n return !!this._state;\n }\n reset() {\n this._state = this._initialState;\n }\n};\nlet State = _State;\nState._instance = null;\n\nexport { State };\n//# sourceMappingURL=bundle.mjs.map\n","// Global state\nimport { State as StateClass } from \"@artisan-commerce/state\";\n\nimport { GlobalState } from \"../types/common.types\";\n\nconst initialState: GlobalState = {\n forms: {}\n};\n\nexport const State = (): StateClass<GlobalState> => {\n return StateClass.getInstance(initialState);\n};\n","import { BuildModifierRendererConfig } from \"../../lib/registerModifiersForm/registerModifiersForm.types\";\nimport { BuildRendererConfig } from \"../../lib/registerModifiersForm/registerModifiersForm.types\";\nimport { BuildModifierGroupConfig } from \"../../lib/registerModifiersForm/registerModifiersForm.types\";\nimport { ModifierGroupRenderer } from \"../../types/modifiers.types\";\nimport { ModifierRenderer } from \"../../types/modifiers.types\";\nimport { FormCartProduct } from \"../../types/modifiers.types\";\nimport { FormCartProductQuestions } from \"../../types/modifiers.types\";\nimport { FormCartProductAnswer } from \"../../types/modifiers.types\";\nimport { toFormCartProductFromAnswer } from \"../transformers/transformers.utils\";\nimport { getGroupRendererStatus } from \"./common.utils\";\nimport { getModifierRendererStatus } from \"./common.utils\";\nimport { getGroupType } from \"./common.utils\";\nimport { ModifiersFormInternal } from \"../../lib/registerModifiersForm/registerModifiersForm.types\";\nimport { buildProductFromRenderer } from \"../../lib/buildProductFromRenderer/buildProductFromRenderer\";\nimport { buildQuestionAndAnswersFromRenderer } from \"../../lib/buildProductFromRenderer/buildProductFromRenderer\";\nimport { ModifiersForms } from \"../../types/common.types\";\nimport { mapGlobalRendererStatus } from \"./common.utils\";\nimport { getGroupModifierErrors } from \"./common.utils\";\nimport { getModifierErrors } from \"./common.utils\";\nimport { setRendererPathNode } from \"./rendererTraversal.utils\";\nimport { getRendererPathNode } from \"./rendererTraversal.utils\";\nimport { getProductTotals } from \"../calculations/calculations.utils\";\nimport { State } from \"../state\";\n\n// Modifiers renderer utility functions\nexport const buildRenderer = (\n product: FormCartProduct,\n config: BuildRendererConfig,\n previous?: ModifierGroupRenderer[]\n): ModifierGroupRenderer[] => {\n const { rootId, path } = config;\n const groupsRenderer = product.questions.map(modifierGroup => {\n const previousGroup = previous?.find(group => {\n return group.id === modifierGroup.questionId;\n });\n return buildModifierGroupRenderer(\n modifierGroup,\n {\n amount: product.amount,\n rootId,\n path: [...path]\n },\n previousGroup\n );\n });\n return groupsRenderer;\n};\n\nexport const buildModifierGroupRenderer = (\n modifierGroup: FormCartProductQuestions,\n parentConfig: BuildModifierGroupConfig,\n previous?: ModifierGroupRenderer\n): ModifierGroupRenderer => {\n const { questionId, name, description, max, min, images } = modifierGroup;\n const { amount, rootId, path } = parentConfig;\n const { errors, touched } = previous ?? {};\n const partialGroup: Omit<ModifierGroupRenderer, \"modifiers\"> = {\n id: questionId,\n name,\n description: description ?? \"\",\n images: [...(images ?? [])],\n data: { ...modifierGroup },\n errors: errors ?? [],\n touched: touched ?? false,\n status: \"IDLE\",\n hidden: amount < 1,\n required: min > 0,\n type: getGroupType(modifierGroup)\n };\n const config: BuildModifierRendererConfig = {\n rootId,\n max,\n min,\n type: partialGroup.type,\n modifiersCount: modifierGroup.answers.length,\n amount,\n path: [...path, questionId]\n };\n const modifiersRenderer = modifierGroup.answers.map(modifier => {\n const previousModifier = previous?.modifiers.find(modifierRenderer => {\n return modifierRenderer.id === modifier.productId;\n });\n return buildModifierRenderer(modifier, config, previousModifier);\n });\n const groupWithoutStatus = {\n ...partialGroup,\n modifiers: modifiersRenderer\n };\n return {\n ...groupWithoutStatus,\n status: getGroupRendererStatus(groupWithoutStatus)\n };\n};\n\nexport const buildModifierRenderer = (\n modifier: FormCartProductAnswer,\n config: BuildModifierRendererConfig,\n previous?: ModifierRenderer\n): ModifierRenderer => {\n const { productId, questionId, name, images, amount } = modifier;\n const { renderType, min, max } = modifier;\n const subproduct = toFormCartProductFromAnswer(modifier);\n const { rootId, path } = config;\n const updatedPath = [...path, productId];\n const groups = buildRenderer(\n subproduct,\n {\n rootId,\n path: updatedPath\n },\n previous?.groups\n );\n const modifierWithoutStatus: ModifierRenderer = {\n id: productId,\n groupId: questionId,\n name,\n images: [...images],\n amount,\n data: { ...modifier },\n groups,\n errors: previous?.errors ?? [],\n hidden: config.amount < 1,\n min,\n max,\n required: min > 0,\n touched: previous?.touched ?? false,\n status: \"IDLE\",\n totals: getProductTotals({ ...(modifier as any), amount }),\n type: renderType,\n handleChange: amount => {\n handleModifierChange(config.rootId, updatedPath, amount);\n }\n };\n return {\n ...modifierWithoutStatus,\n status: getModifierRendererStatus(modifierWithoutStatus)\n };\n};\n\n// Handle a modifier field change its amount\nexport const handleModifierChange = (\n productId: string,\n path: string[],\n amount: number\n) => {\n const forms = { ...State().state.forms };\n const form = forms[productId];\n // get modifier that will be updated\n const node = getRendererPathNode(form.renderer, path) as ModifierRenderer;\n // update modifier (amount, touched, error, totals\n let newRenderer = updateModifier(form.renderer, path, node, amount, false);\n // update modifier parent (if radio update children), prepare errors, touched, etc.\n newRenderer = updateParentGroup(productId, newRenderer, path, false);\n // generate new product\n const updatedProduct = buildProductFromRenderer(newRenderer, form.product);\n // store updated form\n const updatedForm: ModifiersFormInternal = {\n ...form,\n renderer: newRenderer,\n product: updatedProduct,\n status: mapGlobalRendererStatus(newRenderer)\n };\n const newForms: ModifiersForms = { ...forms, [productId]: updatedForm };\n State().setState({ forms: newForms });\n // Pass form to the callback\n const returnForm = { ...updatedForm };\n delete (returnForm as any).callback;\n form.callback(returnForm);\n};\n\n// UPDATE RENDERER _ NOT SPLITTED INTO A DIFFERENT FILE TO AVOID CIRCULAR DEPS\n\nexport const updateModifier = (\n renderer: ModifierGroupRenderer[],\n path: string[],\n node: ModifierRenderer,\n amount: number,\n strict: boolean\n) => {\n const newModifierRenderer: ModifierRenderer = {\n ...node,\n amount,\n touched: true,\n errors: getModifierErrors(node, amount, strict),\n totals: getProductTotals({ ...(node.data as any), amount }),\n data: {\n ...node.data,\n amount\n }\n };\n newModifierRenderer.status = getModifierRendererStatus(newModifierRenderer);\n return setRendererPathNode(renderer, path, newModifierRenderer);\n};\n\nexport const updateParentGroup = (\n rootId: string,\n renderer: ModifierGroupRenderer[],\n path: string[],\n strict: boolean\n) => {\n const parentPath = path.slice(0, -1);\n const parentGroup = getRendererPathNode(\n renderer,\n parentPath\n ) as ModifierGroupRenderer;\n let newModifierRenderers = [...parentGroup.modifiers];\n // !strict is a hack to let radio buttons not lose its amount when running validate\n if (parentGroup.type === \"RADIO\" && !strict) {\n newModifierRenderers = parentGroup.modifiers.map(modifier => {\n if (modifier.type !== \"RADIO\") {\n return { ...modifier };\n }\n if (modifier.id === path[path.length - 1]) {\n return { ...modifier };\n }\n return {\n ...modifier,\n amount: 0,\n error: \"\",\n totals: getProductTotals({ ...(modifier.data as any), amount: 0 }),\n data: {\n ...modifier.data,\n amount: 0\n }\n };\n });\n }\n //update decendents\n newModifierRenderers = newModifierRenderers.map(modifier => {\n const subproduct = toFormCartProductFromAnswer(modifier.data as any);\n const newPath = [...path.slice(0, -1), modifier.id];\n const updatedModifier = {\n ...modifier,\n groups: buildRenderer(\n subproduct,\n {\n rootId,\n path: newPath\n },\n modifier.groups\n )\n };\n updatedModifier.errors = getModifierErrors(\n updatedModifier,\n updatedModifier.amount,\n strict\n );\n updatedModifier.status = getModifierRendererStatus(updatedModifier);\n return updatedModifier;\n });\n // Update parent group data with children modifiers up to date data\n const updatedGroupAnswers = newModifierRenderers.map(modifier => {\n return { ...modifier.data };\n });\n const newGroupData = { ...parentGroup.data, answers: updatedGroupAnswers };\n // Create up to date group\n const newGroupRenderer = {\n ...parentGroup,\n touched: true,\n modifiers: newModifierRenderers,\n data: newGroupData\n };\n\n // update errors with the latest data\n newGroupRenderer.errors = getGroupModifierErrors(newGroupRenderer, strict);\n // update status with the latest data\n newGroupRenderer.status = getGroupRendererStatus(newGroupRenderer);\n let newRenderer = setRendererPathNode(renderer, parentPath, newGroupRenderer);\n if (parentPath.length > 1) {\n newRenderer = updateParentModifier(rootId, newRenderer, parentPath, strict);\n }\n\n return newRenderer;\n};\n\nexport const updateParentModifier = (\n rootId: string,\n renderer: ModifierGroupRenderer[],\n path: string[],\n strict: boolean\n) => {\n const parentPath = path.slice(0, -1);\n const parentModifier = getRendererPathNode(\n renderer,\n parentPath\n ) as ModifierRenderer;\n // Update parent modifier data with children groups up to date data\n const updatedModifierQuestions = parentModifier.groups.map(group => {\n return { ...group.data };\n });\n const newAnswers = buildQuestionAndAnswersFromRenderer(parentModifier.groups);\n const newModifierData = {\n ...parentModifier.data,\n questions: updatedModifierQuestions,\n questionsAndAnswers: newAnswers\n };\n const newModifierGroups = parentModifier.groups.map(group => {\n const newGroup = { ...group };\n newGroup.errors = getGroupModifierErrors(newGroup, strict);\n newGroup.status = getGroupRendererStatus(newGroup);\n return newGroup;\n });\n // Create up to date modifier\n const newModifierRenderer = {\n ...parentModifier,\n touched: true,\n groups: newModifierGroups,\n data: newModifierData\n };\n newModifierRenderer.errors = getModifierErrors(\n newModifierRenderer,\n newModifierRenderer.amount,\n strict\n );\n newModifierRenderer.status = getModifierRendererStatus(newModifierRenderer);\n let newRenderer = setRendererPathNode(\n renderer,\n parentPath,\n newModifierRenderer\n );\n if (parentPath.length > 1) {\n newRenderer = updateParentGroup(rootId, newRenderer, parentPath, strict);\n }\n return newRenderer;\n};\n","// validateProduct functions\nimport { Product } from \"@artisan-commerce/types\";\n\nimport { ModifiersForms } from \"../../types/common.types\";\nimport { RendererStatus } from \"../../types/modifiers.types\";\nimport { ModifierGroupRenderer } from \"../../types/modifiers.types\";\nimport { ModifierRenderer } from \"../../types/modifiers.types\";\nimport { mapGlobalRendererStatus } from \"../../utils/modifiers/common.utils\";\nimport { ModifiersFormInternal } from \"../registerModifiersForm/registerModifiersForm.types\";\nimport { buildProductFromRenderer } from \"../buildProductFromRenderer/buildProductFromRenderer\";\nimport { updateParentGroup } from \"../../utils/modifiers/renderer.utils\";\nimport { updateModifier } from \"../../utils/modifiers/renderer.utils\";\nimport { State } from \"../../utils/state\";\n\nexport const validateProduct = (\n productId: Product[\"productId\"]\n): RendererStatus => {\n const forms = { ...State().state.forms };\n const form = forms[productId];\n const { renderer, callback, product } = form;\n let latestRenderer = [...renderer];\n // Go to leaf modifiers and start updating the renderer\n renderer.forEach(group => {\n const path = [group.id];\n latestRenderer = validateChildModifiers(\n group,\n latestRenderer,\n productId,\n path\n );\n });\n // generate new product\n const updatedProduct = buildProductFromRenderer(latestRenderer, product);\n // store updated form\n const updatedForm: ModifiersFormInternal = {\n ...form,\n renderer: latestRenderer,\n product: updatedProduct,\n status: mapGlobalRendererStatus(latestRenderer)\n };\n const newForms: ModifiersForms = { ...forms, [productId]: updatedForm };\n State().setState({ forms: newForms });\n // Pass form to the callback\n const returnForm = { ...updatedForm };\n delete (returnForm as any).callback;\n callback(returnForm);\n return updatedForm.status;\n};\n\nexport const validateChildModifiers = (\n group: ModifierGroupRenderer,\n renderer: ModifierGroupRenderer[],\n productId: Product[\"productId\"],\n path: string[]\n): ModifierGroupRenderer[] => {\n const { modifiers, id } = group;\n const isLeaft = !modifiers.length;\n let latestRenderer = [...renderer];\n if (!isLeaft) {\n modifiers.forEach(modifier => {\n const newPath = [...path, modifier.id];\n latestRenderer = validateChildGroups(\n modifier,\n latestRenderer,\n productId,\n newPath\n );\n });\n\n return latestRenderer;\n } else {\n console.warn(\n `Attempting to validate a Modifier group without modifiers, this will likely result in unexpected behaviour. \n Please update the bad group ${id} of product ${0}.`\n );\n // Group does not have any modifiers, should never happen!\n return latestRenderer;\n }\n};\n\nexport const validateChildGroups = (\n modifier: ModifierRenderer,\n renderer: ModifierGroupRenderer[],\n productId: Product[\"productId\"],\n path: string[]\n): ModifierGroupRenderer[] => {\n const { groups, amount, status, required } = modifier;\n const isLeaft = !groups.length || amount === 0;\n let latestRenderer = [...renderer];\n if (isLeaft) {\n const badIdle = status === \"IDLE\" && required;\n const badStatus = badIdle || status === \"FAIL\" || status === \"INCOMPLETE\";\n const newStatus: RendererStatus = badStatus ? \"FAIL\" : status;\n const replacement = { ...modifier, status: newStatus };\n\n const newPath = [...path];\n latestRenderer = updateModifier(\n latestRenderer,\n newPath,\n replacement,\n replacement.amount,\n true\n );\n\n // update modifier parent (if radio update children), prepare errors, touched, etc.\n latestRenderer = updateParentGroup(\n productId,\n latestRenderer,\n newPath,\n true\n );\n } else {\n groups.forEach(group => {\n const newPath = [...path, group.id];\n latestRenderer = validateChildModifiers(\n group,\n latestRenderer,\n productId,\n newPath\n );\n });\n }\n return latestRenderer;\n};\n","// Modifier forms utility functions\nimport { CartProduct, Product } from \"@artisan-commerce/types\";\n\nimport { buildProductFromRenderer } from \"../../lib/buildProductFromRenderer/buildProductFromRenderer\";\nimport { ModifiersForm } from \"../../lib/registerModifiersForm/registerModifiersForm.types\";\nimport { validateProduct } from \"../../lib/validateProduct/validateProduct\";\nimport { toFormCartProduct } from \"../transformers/transformers.utils\";\nimport { mapGlobalRendererStatus } from \"./common.utils\";\nimport { buildRenderer } from \"./renderer.utils\";\n\nexport const createForm = (product: Product): ModifiersForm => {\n // Similar to toCartProduct, but it sets the questionsAndAnswers field inside the questions field\n const formCartProduct = toFormCartProduct(product, {\n amount: (product as CartProduct).amount ?? 1\n });\n const renderer = buildRenderer(formCartProduct, {\n rootId: formCartProduct.productId,\n path: []\n });\n const updatedProduct = buildProductFromRenderer(renderer, product);\n return {\n product: updatedProduct,\n renderer,\n validate: () => validateProduct(product.productId),\n status: mapGlobalRendererStatus(renderer)\n };\n};\n","// registerModifiersForm functions\nimport { Product } from \"@artisan-commerce/types\";\n\nimport { logError } from \"../../utils/common.utils\";\nimport { createForm } from \"../../utils/modifiers/form.utils\";\nimport { ModifiersFormCallback } from \"./registerModifiersForm.types\";\nimport { ModifiersFormUnsubscriber } from \"./registerModifiersForm.types\";\nimport { State } from \"../../utils/state\";\n\n/**\n * Creates a product modifiers form listener that handles the input change\n * events automatically.\n *\n * @param {Product} product The product that will be listened\n * @param {ModifiersFormCallback} callback Returns a snapshot of the current\n * state of the form\n * @returns {ModifiersFormUnsubscriber} Returns a function that when called it\n * stops listening to the form\n */\nexport const registerModifiersForm = (\n product: Product,\n callback: ModifiersFormCallback\n): ModifiersFormUnsubscriber => {\n const { productId } = product;\n // Check if form already exists\n const { forms } = State().state;\n const formExists = !!forms[productId];\n if (formExists) {\n logError(\n `Form for product with id ${productId} has already been register. Please unsubscribe if you need to register a new form.`\n );\n return () => {};\n }\n // create new form\n const form = createForm(product);\n // register (save form in state with callback)\n const newForms = { ...forms, [productId]: { ...form, callback } };\n State().setState({ forms: newForms });\n callback({ ...form });\n return () => unsubscriber(productId);\n};\n\n/**\n * Function that when called it stops listening to the form.\n *\n * @param {string} productId The id of the product that will be deleted from the\n * form\n */\nexport const unsubscriber = (productId: Product[\"productId\"]) => {\n const { forms } = State().state;\n const newForms = { ...forms };\n delete newForms[productId];\n State().setState({ forms: newForms });\n};\n\n//TODO: continue here. Add to cart in demo\n\n//TODO:\n// Add to cart in demo\n// change counter to quantity\n// Add shopping cart replaceProduct\n// Make sure getProductTotals uses third level\n// Test updating a cartProduct with form\n// defaults\n\n// DONE:\n// validate\n// set modifier and group errors\n// status\n// generate renderer\n// do handleChange\n// generate product\n// set visibility\n// 3rd level everything\n\n// USAGE:\n// const unsubscribe = registerModifiersForm(product: Product, ({ renderer, product, validate }) => {})\n\n// custom hook = const { renderer, product, validate } = useProductForm(product : Product);\n\n// handleChange(quantity) inside its implementation it looks like the following\n// handleChange = (quantity) => genericHandleChange(hash, quantity);\n\n// product = A regular cart product but already modified with the selected modifiers\n\n// validate = function used to rebuild the renderer object\n\n// Error types: modifier group bad configured, group invalid selection, modifier invalid value, illegal selection.\n// If production console error, others throw error\n\n// Required = modifier or group must be filled, useful to for ui designs\n\n// Touched = whether the field was interacted with before\n\n// Type = type of Group or Modifier to render\n\n// Hidden = whether to show or not given group or modifier\n// this property is calculated based on product properties or parent modifier selection\n"],"names":["__spreadProps","__spreadValues","__defProp","__getOwnPropSymbols","__hasOwnProp","__propIsEnum","__defNormalProp","State","StateClass"],"mappings":";;AAOa,MAAA,aAAA,GAAgB,CAAC,OAAkC,KAAA;AAC9D,EAAA,MAAM,EAAE,IAAA,EAAM,MAAQ,EAAA,MAAA,EAAQ,SAAc,EAAA,GAAA,OAAA,CAAA;AAC5C,EAAI,IAAA,OAAO,SA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,KAAO,EAAA,QAAA,EAAA,CAAA,CAAA;AAC1B,EAAA,QAAA,CAAS,cAAK,CAAA,EAAA,EAAA,IAAA,CAAA,CAAA,CAAA;AACd,EAAA,OAAO,MAAM,YAAa,CAAA,SAAA,CAAA,CAAA;AAAA,EAAA;AASf,MAAA,YAAA,GAAe,CAAC,SAAoC,KAAA;AAC/D,EAAM,MAAA,EAAE,UAAU,KAAQ,EAAA,CAAA,KAAA,CAAA;AAC1B,EAAA,MAAM,WAAW,cAAK,CAAA,EAAA,EAAA,KAAA,CAAA,CAAA;AACtB,EAAA,OAAO,QAAS,CAAA,SAAA,CAAA,CAAA;AAChB,EAAQ,KAAA,EAAA,CAAA,QAAA,CAAS,EAAE,KAAO,EAAA,QAAA,EAAA,CAAA,CAAA;AAAA,CAAA;;;;;;;;;"}
1
+ {"version":3,"file":"bundle.cjs","sources":["../src/utils/assertions/assertions.utils.ts","../src/utils/common.utils.ts","../src/utils/modifiers/common.utils.ts","../src/utils/questionsAndAnswers/questionsAndAnswers.utils.ts","../src/utils/transformers/transformers.utils.ts","../src/lib/buildProductFromRenderer/buildProductFromRenderer.ts","../src/utils/modifiers/rendererTraversal.utils.ts","../src/utils/calculations/calculations.utils.ts","../../state/dist/bundle.mjs","../src/utils/state.ts","../src/utils/modifiers/renderer.utils.ts","../src/lib/validateProduct/validateProduct.ts","../src/utils/modifiers/form.utils.ts","../src/lib/registerModifiersForm/registerModifiersForm.ts"],"sourcesContent":["// Product assertion functions\nimport { BaseProduct } from \"@artisan-commerce/types\";\nimport { ProductDetails } from \"@artisan-commerce/types\";\nimport { CartProduct } from \"@artisan-commerce/types\";\nimport { FormCartProduct } from \"../../types/modifiers.types\";\n\n// For none typescript users it is very important to check if the given obj is a valid BaseProduct\nexport const isBaseProduct = (product: BaseProduct): boolean => {\n const { name, images, prices, productId } = product;\n if (typeof name !== \"string\") {\n return false;\n }\n if (typeof productId !== \"string\") {\n return false;\n }\n if (\n typeof prices !== \"object\" ||\n (typeof prices === \"object\" && Object.keys(prices).length < 1)\n ) {\n return false;\n }\n if (!Array.isArray(images)) {\n return false;\n }\n //@ts-expect-error This help differentiate an answer from a product\n if (product.questionId) return false;\n\n return true;\n};\n\n// For none typescript users it is very important to check if the given obj is a valid ProductDetails\nexport const isProductDetails = (product: ProductDetails): boolean => {\n const validBaseProduct = isBaseProduct(product);\n if (!validBaseProduct) {\n return false;\n }\n const { questions } = product;\n\n if (!Array.isArray(questions)) {\n return false;\n }\n\n return true;\n};\n\n// For none typescript users it is very important to check if the given obj is a valid CartProduct\nexport const isCartProduct = (product: CartProduct): boolean => {\n const validProductDetails = isProductDetails(product as ProductDetails);\n if (!validProductDetails) {\n return false;\n }\n const { hash, createdAt, updatedAt } = product;\n const { amount, priceCategory, comment, questionsAndAnswers } = product;\n\n if (typeof hash !== \"string\") {\n return false;\n }\n if (typeof createdAt !== \"string\") {\n return false;\n }\n if (typeof updatedAt !== \"string\") {\n return false;\n }\n if (typeof amount !== \"number\") {\n return false;\n }\n if (typeof comment !== \"string\") {\n return false;\n }\n if (![\"NORMAL\", \"POINTS\"].includes(priceCategory)) {\n return false;\n }\n if (!Array.isArray(questionsAndAnswers)) {\n return false;\n }\n return true;\n};\n\nexport const isFormCartProduct = (product: FormCartProduct): boolean => {\n const validCartProduct = isCartProduct(product as any);\n if (!validCartProduct) {\n return false;\n }\n const { questions } = product;\n if (!Array.isArray(questions)) {\n return false;\n }\n const answers = questions?.[0]?.answers;\n if (answers?.length && typeof answers[0].amount === \"undefined\") {\n return false;\n }\n return true;\n};\n","// Common utility functions\n\nexport const stringIsNumber = (value: string) => isNaN(Number(value)) === false;\n\nexport const enumToArray = (enumObj: any): string[] => {\n return Object.keys(enumObj);\n};\n\nexport const logError = (message: string) => {\n if (process.env.NODE_ENV === \"production\") {\n console.error(message);\n } else {\n throw new Error(message);\n }\n};\n","// Modifiers utility functions\nimport { ProductQuestion } from \"@artisan-commerce/types\";\n\nimport { BuildModifierRendererConfig } from \"../../lib/registerModifiersForm/registerModifiersForm.types\";\nimport { RendererError } from \"../../types/common.types\";\nimport { RendererStatus } from \"../../types/modifiers.types\";\nimport { ModifierRenderer } from \"../../types/modifiers.types\";\nimport { ModifierGroupRenderer } from \"../../types/modifiers.types\";\nimport { GetModifierTypeConfig } from \"../../types/modifiers.types\";\nimport { GroupTypes, ModifierTypes } from \"../../types/modifiers.types\";\nimport { logError } from \"../common.utils\";\n\nexport const getGroupType = (group: ProductQuestion): GroupTypes => {\n const { min, max, type } = group;\n if (type) {\n if (type === \"QUANTITY\" || type === \"SELECT\") {\n return \"COUNTER\";\n }\n return type as GroupTypes;\n }\n if (min === 0 && max === 1) {\n return \"CHECKBOX\";\n }\n if (min === 1 && max === 1) {\n return \"RADIO\";\n }\n if (min === 0 && (max === 0 || max === Infinity)) {\n return \"COUNTER\";\n }\n if (max >= min) {\n return \"COUNTER\";\n }\n throw new Error(\n `Modifier group bad configured. min ${min}, max ${max}, type ${type}`\n );\n};\n\nexport const getModifierType = (\n config: GetModifierTypeConfig\n): ModifierTypes => {\n const { groupType, min, max, type } = config;\n if (groupType === \"RADIO\") {\n return \"RADIO\";\n }\n if (type) {\n if (type === \"QUANTITY\" || type === \"SELECT\") {\n return \"COUNTER\";\n }\n return type as ModifierTypes;\n }\n if (min === 1 && max === 1) {\n return \"RADIO\";\n }\n if (min === 0 && max === 1) {\n return \"CHECKBOX\";\n }\n if (min === 0 && (max === 0 || max === Infinity)) {\n return \"COUNTER\";\n }\n if (max >= min) {\n return \"COUNTER\";\n }\n return groupType;\n};\n\n// Only for Normalization\nexport const getModifierMin = (groupConfig: BuildModifierRendererConfig) => {\n const { min, modifiersCount } = groupConfig;\n if (modifiersCount === 1) {\n return min;\n }\n return 0;\n};\n\n// Only for Normalization\nexport const getModifierMax = (groupConfig: BuildModifierRendererConfig) => {\n const { max, type } = groupConfig;\n const normalizedMax = max || Infinity;\n if (type === \"RADIO\") {\n return 1;\n }\n if (type === \"CHECKBOX\") {\n return 1;\n }\n if (type === \"COUNTER\") {\n return normalizedMax;\n }\n return normalizedMax;\n};\n\nexport const getModifierErrors = (\n modifier: ModifierRenderer,\n amount: number,\n strict: boolean\n): RendererError[] => {\n const errors: RendererError[] = [];\n const { max, min } = modifier;\n if (amount > max) {\n errors.push({\n code: 101,\n message: `Amount is heigher than the maximum allowed amount ${max}`\n });\n }\n if (strict && amount < min) {\n errors.push({\n code: 102,\n message: `Amount is lower than the minimum allowed amount ${min}`\n });\n }\n return errors;\n};\n\nexport const getGroupModifierErrors = (\n group: ModifierGroupRenderer,\n strict: boolean\n): RendererError[] => {\n const errors: RendererError[] = [];\n const { modifiers, data } = group;\n const { min } = data;\n let { max } = data;\n if (min === 0 && max === 0) {\n max = Infinity;\n }\n const amount = modifiers.reduce((acc, modifier) => {\n return acc + modifier.amount;\n }, 0);\n if (amount > max) {\n errors.push({\n code: 201,\n message: `Amount is heigher than the maximum allowed amount ${max}`\n });\n }\n if (strict && amount < min) {\n errors.push({\n code: 202,\n message: `Amount is lower than the minimum allowed amount ${min}`\n });\n }\n return errors;\n};\n\n// Map a modifier group to a rendererStatus\nexport const getGroupRendererStatus = (\n group: ModifierGroupRenderer\n): RendererStatus => {\n const { touched, errors, required, data, modifiers } = group;\n const { min } = data;\n const childrenWithError = modifiers.some(\n modifier => modifier.status === \"FAIL\"\n );\n const childrenIdle = modifiers.some(modifier => modifier.status === \"IDLE\");\n const childrenIncomplete = modifiers.some(\n modifier => modifier.status === \"INCOMPLETE\"\n );\n const amount = modifiers.reduce((acc, modifier) => {\n return acc + modifier.amount;\n }, 0);\n\n return mapRenderStatusHelper({\n touched,\n errors,\n required,\n min,\n amount,\n childrenWithError,\n childrenIdle,\n childrenIncomplete,\n reviewChildren: true\n });\n};\n\n// Map a modifier to a rendererStatus\nexport const getModifierRendererStatus = (\n modifier: ModifierRenderer\n): RendererStatus => {\n const childrenWithError = modifier.groups.some(\n group => group.status === \"FAIL\"\n );\n const childrenIdle = modifier.groups.some(group => group.status === \"IDLE\");\n const childrenIncomplete = modifier.groups.some(\n group => group.status === \"INCOMPLETE\"\n );\n const { touched, errors, required, min, amount } = modifier;\n const reviewChildren = amount > 0;\n return mapRenderStatusHelper({\n touched,\n errors,\n required,\n min,\n amount,\n childrenWithError,\n childrenIdle,\n childrenIncomplete,\n reviewChildren\n });\n};\n\nconst mapRenderStatusHelper = (config: {\n touched: boolean;\n errors: RendererError[];\n required: boolean;\n amount: number;\n min: number;\n childrenWithError: boolean;\n childrenIdle: boolean;\n childrenIncomplete: boolean;\n reviewChildren: boolean;\n}): RendererStatus => {\n const { touched, errors, required, min, amount, reviewChildren } = config;\n const { childrenWithError, childrenIdle, childrenIncomplete } = config;\n const firstRender = amount > 0 && !touched;\n // NOT TOUCHED\n // If the current node has not been interacted with but it is required\n if (!firstRender && !touched && required) {\n return \"IDLE\";\n }\n // If the current node has not been interacted with and it is not required\n if (!firstRender && !touched && !required) {\n return \"OK\";\n }\n // TOUCHED\n // If current node has an error\n if (errors.length) {\n return \"FAIL\";\n }\n // If any children node has an error\n if (reviewChildren && childrenWithError) {\n return \"FAIL\";\n }\n // If children should be shown, check their status in consideration\n if (reviewChildren && (childrenIdle || childrenIncomplete)) {\n return \"INCOMPLETE\";\n }\n // If current node do not have the minimum amount\n // (if group the amount is the accumulation of its children)\n if (amount < min) {\n return \"INCOMPLETE\";\n }\n // If current node have the minimum amount\n // (if group the amount is the accumulation of its children)\n if (amount >= min) {\n return \"OK\";\n }\n\n logError(\n `Unhandled case. Unable to compute the renderer status ${JSON.stringify(\n {\n touched,\n errors,\n required,\n min,\n amount\n },\n undefined,\n 2\n )}`\n );\n return \"FAIL\";\n};\n\n// Map renderer top level to its status\nexport const mapGlobalRendererStatus = (\n renderer: ModifierGroupRenderer[]\n): RendererStatus => {\n // Every group has OK status or group is IDLE but not required\n const allChildrenOk = renderer.every(group => {\n const { status, required } = group;\n const ok = status === \"OK\";\n const idleNotRequired = status === \"IDLE\" && !required;\n return ok || idleNotRequired;\n });\n if (allChildrenOk) {\n return \"OK\";\n }\n // Every group has not been touched\n const childrenIsIdle = renderer.every(group => !group.touched);\n if (childrenIsIdle) {\n return \"IDLE\";\n }\n // Any group status is FAIL\n const chidrenWithError = renderer.some(group => group.status === \"FAIL\");\n if (chidrenWithError) {\n return \"FAIL\";\n }\n\n return \"INCOMPLETE\";\n};\n","// Questions & Answers utility functions\nimport { CartProduct } from \"@artisan-commerce/types\";\nimport { CartProductAnswer } from \"@artisan-commerce/types\";\n\n// Multiply the QA amount times the product amount\nexport const multiplyProductQA = (\n product: CartProduct | CartProductAnswer\n): CartProduct => {\n return operationOnProductQA(product, (answer, productAmount) => {\n const accAmount = answer.amount * productAmount;\n const fixedAnswer = multiplyProductQA({\n ...answer,\n amount: accAmount\n }) as any;\n return { ...fixedAnswer, amount: answer.amount * productAmount };\n });\n};\n\n// Divide the QA amount by the product amount\nexport const divideProductQA = (\n product: CartProduct | CartProductAnswer\n): CartProduct => {\n return operationOnProductQA(product, (answer, productAmount) => {\n const fixedAnswer = divideProductQA(answer) as any;\n return { ...fixedAnswer, amount: answer.amount / productAmount };\n });\n};\n\n// Run a answerEnhancer over each answer to make an operation\nexport const operationOnProductQA = (\n product: CartProduct | CartProductAnswer,\n answerEnhancer: (\n answer: CartProductAnswer,\n amount: number\n ) => CartProductAnswer\n): CartProduct => {\n const { amount: productAmount = 1, questionsAndAnswers = [] } = product;\n const newQuestionsAndAnswers = questionsAndAnswers.map(question => {\n const answers = question.answers.map(answer => {\n return answerEnhancer(answer, productAmount);\n });\n return { ...question, answers };\n });\n return {\n ...product,\n questionsAndAnswers: newQuestionsAndAnswers\n } as CartProduct;\n};\n","// Transformer functions\nimport { ProductDetails } from \"@artisan-commerce/types\";\nimport { BaseProduct, Product, CartProduct } from \"@artisan-commerce/types\";\n\nimport { BuildModifierRendererConfig } from \"../../lib/registerModifiersForm/registerModifiersForm.types\";\nimport { FormCartProduct } from \"../../types/modifiers.types\";\nimport { FormCartProductAnswer } from \"../../types/modifiers.types\";\nimport { FormCartProductQuestions } from \"../../types/modifiers.types\";\nimport { isFormCartProduct } from \"../assertions/assertions.utils\";\nimport { isCartProduct } from \"../assertions/assertions.utils\";\nimport { isProductDetails } from \"../assertions/assertions.utils\";\nimport { getModifierMax, getModifierType } from \"../modifiers/common.utils\";\nimport { getGroupType, getModifierMin } from \"../modifiers/common.utils\";\nimport { divideProductQA } from \"../questionsAndAnswers/questionsAndAnswers.utils\";\n\nexport const toCartProduct = (\n product: Product,\n overrides: Partial<CartProduct> = {}\n): CartProduct => {\n if (isCartProduct(product as CartProduct)) {\n return { ...product, ...overrides } as CartProduct;\n }\n if (isProductDetails(product as ProductDetails)) {\n return toCartProductFromProductDetails(\n product as ProductDetails,\n overrides\n );\n }\n const productDetails = toProductDetails(product);\n return toCartProductFromProductDetails(productDetails, overrides);\n};\n\n// Transform from product details to cart product\nconst toCartProductFromProductDetails = (\n product: ProductDetails,\n overrides: Partial<CartProduct> = {}\n): CartProduct => {\n const { questionsAndAnswers, priceCategory, amount } = product as CartProduct;\n const newCartProduct: CartProduct = {\n ...product,\n questionsAndAnswers: questionsAndAnswers ?? [],\n amount: amount ?? 0,\n priceCategory: priceCategory ?? \"NORMAL\",\n comment: \"\",\n alerts: [],\n hash: \"\",\n createdAt: \"\",\n updatedAt: \"\",\n ...overrides\n };\n return newCartProduct;\n};\n\n// Transform from BaseProduct to ProductDetails\nconst toProductDetails = (\n product: BaseProduct,\n overrides: Partial<ProductDetails> = {}\n): ProductDetails => {\n return {\n ...product,\n addDirectlyToCart: true,\n isPriceVip: false,\n manufacturer: [],\n maxAmountForSale: 0,\n questions: [],\n schedule: [],\n benefitId: null,\n categories: null,\n ...overrides\n };\n};\n\n// transforms a product into a cart product by its questions are transformed similar to questions and answers\nexport const toFormCartProduct = (\n product: Product,\n overrides: Partial<FormCartProduct> = {}\n): FormCartProduct => {\n if (isFormCartProduct(product as FormCartProduct)) {\n return { ...product, ...overrides } as FormCartProduct;\n }\n if (isProductDetails(product as ProductDetails)) {\n return toFormCartProductFromProductDetails(\n product as ProductDetails,\n overrides\n );\n }\n const productDetails = toProductDetails(product);\n return toFormCartProductFromProductDetails(productDetails, overrides);\n};\n\nexport const toFormCartProductHelper = (\n product: CartProduct | FormCartProductAnswer,\n overrides: Partial<FormCartProduct> = {}\n): FormCartProduct => {\n const fixedProduct = divideProductQA(product as CartProduct);\n const { priceCategory, productId, amount } = fixedProduct;\n const newQuestions = fixedProduct.questions.map<FormCartProductQuestions>(\n (question: any) => {\n const pairQuestion = fixedProduct.questionsAndAnswers?.find(q => {\n return q.questionId === question.questionId;\n });\n const selectedQuestion = pairQuestion ?? question;\n const { questionId, min, max } = selectedQuestion;\n const answerConfig: BuildModifierRendererConfig = {\n rootId: productId,\n min,\n max,\n type: getGroupType(selectedQuestion),\n modifiersCount: question.answers.length,\n amount,\n path: [] // unnecesary\n };\n\n return {\n ...selectedQuestion,\n answers: question.answers.map((answer: any) => {\n const pairAnswer = pairQuestion?.answers.find(a => {\n return a.amount > 0 && a.productId === answer.productId;\n });\n const selectedAnswer = pairAnswer ?? answer;\n const min = getModifierMin(answerConfig);\n const max = getModifierMax(answerConfig);\n const type = getModifierType({\n min,\n max,\n groupType: answerConfig.type,\n type: selectedAnswer.renderType\n });\n const nested = selectedAnswer.questions?.length ?? 0;\n const partialNewAnswer = {\n ...selectedAnswer,\n amount: selectedAnswer?.amount ?? 0,\n priceCategory,\n questionId,\n min,\n max,\n renderType: type\n };\n return {\n ...partialNewAnswer,\n questions: nested\n ? toFormCartProductHelper(partialNewAnswer).questions\n : []\n };\n })\n };\n }\n );\n return {\n ...fixedProduct,\n questions: newQuestions,\n ...overrides\n } as FormCartProduct;\n};\n\nexport const toFormCartProductFromProductDetails = (\n product: ProductDetails,\n overrides: Partial<FormCartProduct> = {}\n): FormCartProduct => {\n const cartProduct = toCartProductFromProductDetails(product);\n return toFormCartProductHelper(cartProduct, overrides);\n};\n\nexport const toFormCartProductFromAnswer = (\n modifier: FormCartProductAnswer,\n overrides: Partial<FormCartProduct> = {}\n) => {\n return toFormCartProductHelper(modifier, overrides);\n};\n\nexport const normalizeProductDetails = (\n product: ProductDetails\n): ProductDetails => {\n const { questions } = product;\n return {\n ...product,\n questions: questions.map(question => {\n const { answers } = question;\n return {\n ...question,\n answers: answers.map(answer => {\n const { questions } = answer;\n return {\n ...answer,\n questions: questions ?? []\n };\n })\n };\n })\n };\n};\n","import { CartProduct, CartProductAnswer } from \"@artisan-commerce/types\";\nimport { CartProductQuestion, Product } from \"@artisan-commerce/types\";\n\nimport { ModifierGroupRenderer } from \"../../types/modifiers.types\";\nimport { ModifierRenderer } from \"../../types/modifiers.types\";\nimport { toCartProduct } from \"../../utils/transformers/transformers.utils\";\n\nexport const buildProductFromRenderer = (\n renderer: ModifierGroupRenderer[],\n product: Product\n): CartProduct => {\n const baseCartProduct = toCartProduct(product);\n return {\n ...baseCartProduct,\n questionsAndAnswers: buildQuestionAndAnswersFromRenderer(renderer),\n // Necessary for dividing QA when calculating product totals\n updatedAt: \"\"\n };\n};\n\n/**\n * Update answers with up to date data\n * @param groups Group renderers with up to date data\n */\nexport const buildQuestionAndAnswersFromRenderer = (\n groups: ModifierGroupRenderer[]\n): CartProductQuestion[] => {\n return groups.map<CartProductQuestion>(group => {\n return {\n ...group.data,\n answers: buildAnswersFromRenderer(group.modifiers)\n };\n });\n};\n\n/**\n * Update questionsAndAnswers with up to date data\n * @param modifiers Group renderers with up to date data\n */\nexport const buildAnswersFromRenderer = (modifiers: ModifierRenderer[]) => {\n return modifiers.map<CartProductAnswer>(modifier => {\n if (!modifier.amount) {\n return { ...modifier.data, questionsAndAnswers: [] };\n }\n return {\n ...modifier.data,\n questionsAndAnswers: buildQuestionAndAnswersFromRenderer(modifier.groups)\n };\n });\n};\n","// renderer traversal utility functions\nimport { ModifierGroupRenderer, ModifierRenderer } from \"../..\";\n\nexport const getRendererPathNode = (\n groups: ModifierGroupRenderer[],\n path: string[]\n) => {\n let remainingPath = [...path];\n let segments: (ModifierGroupRenderer | ModifierRenderer)[] = groups;\n let node: ModifierGroupRenderer | ModifierRenderer = groups[0];\n while (remainingPath.length) {\n node = findNodeInPath(segments, remainingPath[0]);\n remainingPath = remainingPath.slice(1);\n const isGroup = Object.prototype.hasOwnProperty.call(node, \"modifiers\");\n if (isGroup) {\n segments = (node as ModifierGroupRenderer).modifiers;\n } else {\n segments = (node as ModifierRenderer).groups;\n }\n }\n return node;\n};\n\nexport const setRendererPathNode = (\n renderer: ModifierGroupRenderer[],\n path: string[],\n replacement: ModifierGroupRenderer | ModifierRenderer\n): ModifierGroupRenderer[] => {\n let remainingPath = [...path];\n let segments: (ModifierGroupRenderer | ModifierRenderer)[] = renderer;\n let node: ModifierGroupRenderer | ModifierRenderer = findNodeInPath(\n segments,\n remainingPath[0]\n );\n let isGroup = Object.prototype.hasOwnProperty.call(node, \"modifiers\");\n\n while (remainingPath.length > 1) {\n node = findNodeInPath(segments, remainingPath[0]);\n remainingPath = remainingPath.slice(1);\n isGroup = Object.prototype.hasOwnProperty.call(node, \"modifiers\");\n if (isGroup) {\n segments = [...(node as ModifierGroupRenderer).modifiers];\n } else {\n segments = [...(node as ModifierRenderer).groups];\n }\n }\n const replacerId = remainingPath[0];\n if (path.length === 1) {\n node = { groups: renderer } as any;\n isGroup = false;\n }\n if (isGroup) {\n const newModifiers = (node as ModifierGroupRenderer).modifiers.map(item => {\n if (item.id === replacerId) {\n return { ...replacement };\n }\n return { ...item };\n });\n (node as any).modifiers = newModifiers;\n } else {\n const newGroups = (node as ModifierRenderer).groups.map(item => {\n if (item.id === replacerId) {\n return { ...replacement };\n }\n return { ...item };\n });\n (node as any).groups = newGroups;\n }\n if (path.length === 1) {\n return [...(node as any).groups];\n }\n return [...renderer];\n};\n\nexport const findNodeInPath = (\n segments: (ModifierGroupRenderer | ModifierRenderer)[],\n segmentId: string\n): ModifierGroupRenderer | ModifierRenderer => {\n const node = segments.find(segment => {\n return segment.id === segmentId;\n });\n if (!node) {\n throw new Error(\n `Path segment ${segmentId} doesn't exist in segments ${JSON.stringify(\n segments.map(segment => segment.id)\n )}`\n );\n }\n return node;\n};\n","// Calculations utility functions\nimport { Product, PriceCategoryTax } from \"@artisan-commerce/types\";\nimport { CartProductAnswer, CartProduct } from \"@artisan-commerce/types\";\nimport { divideProductQA } from \"../questionsAndAnswers/questionsAndAnswers.utils\";\n\nimport { toCartProduct } from \"../transformers/transformers.utils\";\nimport { ProductTotals } from \"./calculations.utils.types\";\n\n/**\n * Get a summary of all price totals of a given product\n *\n * @since 0.1.0\n * @param product the product that will be calculated\n * @param amount amount of products, if not provided will use product amount field\n * @returns an object with a summary of the product totals\n */\nexport const getProductTotals = (\n product: Product,\n amount = (product as CartProduct).amount > 0\n ? (product as CartProduct).amount\n : 1\n): ProductTotals => {\n if (amount < 1) {\n throw new Error(\n \"Cannot set the amount of getProductTotals with a value less than 1\"\n );\n }\n const cartProduct = product as CartProduct;\n const { priceCategory } = cartProduct;\n const isPoints = priceCategory === \"POINTS\";\n const sanitize = !!cartProduct.updatedAt;\n const sanitized = sanitize ? divideProductQA(cartProduct) : product;\n return {\n unitGrossPrice: getProductGrossPrice(sanitized, 1),\n unitTotalDiscounts: getProductTotalDiscounts(sanitized, 1),\n unitTotalTaxes: !isPoints ? getProductTotalTaxes(sanitized, 1) : 0,\n unitNetPrice: getProductNetPrice(sanitized, 1),\n amount,\n grossPrice: getProductGrossPrice(sanitized, amount),\n totalDiscounts: getProductTotalDiscounts(sanitized, amount),\n totalTaxes: !isPoints ? getProductTotalTaxes(sanitized, amount) : 0,\n netPrice: getProductNetPrice(sanitized, amount)\n };\n};\n\n// Calculate the product and Q&A taxes total\nexport const getProductTotalTaxes = (product: Product, setAmount: number) => {\n const cartProduct = toCartProduct(product, { amount: setAmount });\n const { prices, amount, priceCategory } = cartProduct;\n const { taxes, grossPrice } = prices[priceCategory];\n const taxTotal = getTaxTotal(taxes, grossPrice);\n const questionsSum = getModifiersTotalTaxes(cartProduct, setAmount);\n if (taxTotal === null || questionsSum === null) {\n return null;\n }\n return questionsSum + taxTotal * amount;\n};\n\n// helper to get the total amount of taxes of the modifiers recursively\nexport const getModifiersTotalTaxes = (\n product: CartProduct | CartProductAnswer,\n setAmount: number\n): number => {\n return (\n product.questionsAndAnswers?.reduce((acc, question) => {\n const answersSum = question.answers.reduce((acc, answer) => {\n const { prices, amount, priceCategory } = answer;\n const { taxes, grossPrice } = prices[priceCategory];\n const taxTotal = getTaxTotal(taxes, grossPrice);\n const childrenTotal = getModifiersTotalTaxes(answer, setAmount);\n // Modifiers will always return a number (HACK)\n return acc + amount * (Number(taxTotal) + childrenTotal);\n }, 0);\n return acc + answersSum * setAmount;\n }, 0) ?? 0\n );\n};\n\n// Calculate the product and Q&A grossPrice total\nexport const getProductGrossPrice = (product: Product, setAmount: number) => {\n return getProductFieldPrice(product, \"grossPrice\", setAmount);\n};\n\nexport const getProductTotalDiscounts = (\n product: Product,\n setAmount: number\n) => {\n return null;\n};\n\n// Calculate the product and Q&A netPrice total\nexport const getProductNetPrice = (\n product: Product,\n setAmount: number\n): number => {\n return getProductFieldPrice(product, \"netPrice\", setAmount);\n};\n\n// Helper to Calculate the product and Q&A fields\nexport const getProductFieldPrice = (\n product: Product,\n field: \"grossPrice\" | \"netPrice\",\n setAmount: number\n): number => {\n const cartProduct = toCartProduct(product, { amount: setAmount });\n const { prices, amount, priceCategory } = cartProduct;\n const priceField = prices[priceCategory][field];\n const questionsSum = getModifiersFieldTotal(cartProduct, field);\n return (questionsSum + priceField) * amount;\n};\n\n// helper to get the total amount of the modifiers recursively\nexport const getModifiersFieldTotal = (\n product: CartProduct | CartProductAnswer,\n field: \"grossPrice\" | \"netPrice\"\n): number => {\n return (\n product.questionsAndAnswers?.reduce((acc, question) => {\n const answersSum = question.answers.reduce((acc, answer) => {\n const { prices, amount, priceCategory } = answer;\n const priceField = prices[priceCategory][field];\n const childrenTotal = getModifiersFieldTotal(answer, field);\n return acc + amount * (priceField + childrenTotal);\n }, 0);\n return acc + answersSum;\n }, 0) ?? 0\n );\n};\n\n// Helper to calculate the total amount of taxes of a taxes object\nexport const getTaxTotal = (taxes: PriceCategoryTax[], grossPrice: number) => {\n if (!taxes.length) {\n return null;\n }\n return taxes.reduce((acc, tax) => {\n return acc + (tax.percentage / 100) * grossPrice;\n }, 0);\n};\n","var __defProp = Object.defineProperty;\nvar __getOwnPropSymbols = Object.getOwnPropertySymbols;\nvar __hasOwnProp = Object.prototype.hasOwnProperty;\nvar __propIsEnum = Object.prototype.propertyIsEnumerable;\nvar __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;\nvar __spreadValues = (a, b) => {\n for (var prop in b || (b = {}))\n if (__hasOwnProp.call(b, prop))\n __defNormalProp(a, prop, b[prop]);\n if (__getOwnPropSymbols)\n for (var prop of __getOwnPropSymbols(b)) {\n if (__propIsEnum.call(b, prop))\n __defNormalProp(a, prop, b[prop]);\n }\n return a;\n};\nconst _State = class {\n constructor(state) {\n this._state = state;\n this._initialState = state;\n }\n static getInstance(initialState) {\n if (!_State._instance) {\n _State._instance = new _State(initialState);\n }\n return _State._instance;\n }\n setState(overrides) {\n this._state = __spreadValues(__spreadValues({}, this._state), overrides);\n }\n get state() {\n if (this._state === null) {\n throw new Error(\"The state has not been initialized, make sure to call State.init beforehand\");\n }\n return this._state;\n }\n checkInit() {\n return !!this._state;\n }\n reset() {\n this._state = this._initialState;\n }\n};\nlet State = _State;\nState._instance = null;\n\nexport { State };\n//# sourceMappingURL=bundle.mjs.map\n","// Global state\nimport { State as StateClass } from \"@artisan-commerce/state\";\n\nimport { GlobalState } from \"../types/common.types\";\n\nconst initialState: GlobalState = {\n forms: {}\n};\n\nexport const State = (): StateClass<GlobalState> => {\n return StateClass.getInstance(initialState);\n};\n","import { BuildModifierRendererConfig } from \"../../lib/registerModifiersForm/registerModifiersForm.types\";\nimport { BuildRendererConfig } from \"../../lib/registerModifiersForm/registerModifiersForm.types\";\nimport { BuildModifierGroupConfig } from \"../../lib/registerModifiersForm/registerModifiersForm.types\";\nimport { ModifierGroupRenderer } from \"../../types/modifiers.types\";\nimport { ModifierRenderer } from \"../../types/modifiers.types\";\nimport { FormCartProduct } from \"../../types/modifiers.types\";\nimport { FormCartProductQuestions } from \"../../types/modifiers.types\";\nimport { FormCartProductAnswer } from \"../../types/modifiers.types\";\nimport { toFormCartProductFromAnswer } from \"../transformers/transformers.utils\";\nimport { getGroupRendererStatus } from \"./common.utils\";\nimport { getModifierRendererStatus } from \"./common.utils\";\nimport { getGroupType } from \"./common.utils\";\nimport { ModifiersFormInternal } from \"../../lib/registerModifiersForm/registerModifiersForm.types\";\nimport { buildProductFromRenderer } from \"../../lib/buildProductFromRenderer/buildProductFromRenderer\";\nimport { buildQuestionAndAnswersFromRenderer } from \"../../lib/buildProductFromRenderer/buildProductFromRenderer\";\nimport { ModifiersForms } from \"../../types/common.types\";\nimport { mapGlobalRendererStatus } from \"./common.utils\";\nimport { getGroupModifierErrors } from \"./common.utils\";\nimport { getModifierErrors } from \"./common.utils\";\nimport { setRendererPathNode } from \"./rendererTraversal.utils\";\nimport { getRendererPathNode } from \"./rendererTraversal.utils\";\nimport { getProductTotals } from \"../calculations/calculations.utils\";\nimport { State } from \"../state\";\n\n// Modifiers renderer utility functions\nexport const buildRenderer = (\n product: FormCartProduct,\n config: BuildRendererConfig,\n previous?: ModifierGroupRenderer[]\n): ModifierGroupRenderer[] => {\n const { rootId, path } = config;\n const groupsRenderer = product.questions.map(modifierGroup => {\n const previousGroup = previous?.find(group => {\n return group.id === modifierGroup.questionId;\n });\n return buildModifierGroupRenderer(\n modifierGroup,\n {\n amount: product.amount,\n rootId,\n path: [...path]\n },\n previousGroup\n );\n });\n return groupsRenderer;\n};\n\nexport const buildModifierGroupRenderer = (\n modifierGroup: FormCartProductQuestions,\n parentConfig: BuildModifierGroupConfig,\n previous?: ModifierGroupRenderer\n): ModifierGroupRenderer => {\n const { questionId, name, description, max, min, images } = modifierGroup;\n const { amount, rootId, path } = parentConfig;\n const { errors, touched } = previous ?? {};\n const partialGroup: Omit<ModifierGroupRenderer, \"modifiers\"> = {\n id: questionId,\n name,\n description: description ?? \"\",\n images: [...(images ?? [])],\n data: { ...modifierGroup },\n errors: errors ?? [],\n touched: touched ?? false,\n status: \"IDLE\",\n hidden: amount < 1,\n required: min > 0,\n type: getGroupType(modifierGroup)\n };\n const config: BuildModifierRendererConfig = {\n rootId,\n max,\n min,\n type: partialGroup.type,\n modifiersCount: modifierGroup.answers.length,\n amount,\n path: [...path, questionId]\n };\n const modifiersRenderer = modifierGroup.answers.map(modifier => {\n const previousModifier = previous?.modifiers.find(modifierRenderer => {\n return modifierRenderer.id === modifier.productId;\n });\n return buildModifierRenderer(modifier, config, previousModifier);\n });\n const groupWithoutStatus = {\n ...partialGroup,\n modifiers: modifiersRenderer\n };\n return {\n ...groupWithoutStatus,\n status: getGroupRendererStatus(groupWithoutStatus)\n };\n};\n\nexport const buildModifierRenderer = (\n modifier: FormCartProductAnswer,\n config: BuildModifierRendererConfig,\n previous?: ModifierRenderer\n): ModifierRenderer => {\n const { productId, questionId, name, images, amount } = modifier;\n const { renderType, min, max } = modifier;\n const subproduct = toFormCartProductFromAnswer(modifier);\n const { rootId, path } = config;\n const updatedPath = [...path, productId];\n const groups = buildRenderer(\n subproduct,\n {\n rootId,\n path: updatedPath\n },\n previous?.groups\n );\n const modifierWithoutStatus: ModifierRenderer = {\n id: productId,\n groupId: questionId,\n name,\n images: [...images],\n amount,\n data: { ...modifier },\n groups,\n errors: previous?.errors ?? [],\n hidden: config.amount < 1,\n min,\n max,\n required: min > 0,\n touched: previous?.touched ?? false,\n status: \"IDLE\",\n totals: getProductTotals({ ...(modifier as any), amount }),\n type: renderType,\n handleChange: amount => {\n handleModifierChange(config.rootId, updatedPath, amount);\n }\n };\n return {\n ...modifierWithoutStatus,\n status: getModifierRendererStatus(modifierWithoutStatus)\n };\n};\n\n// Handle a modifier field change its amount\nexport const handleModifierChange = (\n productId: string,\n path: string[],\n amount: number\n) => {\n const forms = { ...State().state.forms };\n const form = forms[productId];\n // get modifier that will be updated\n const node = getRendererPathNode(form.renderer, path) as ModifierRenderer;\n // update modifier (amount, touched, error, totals\n let newRenderer = updateModifier(form.renderer, path, node, amount, false);\n // update modifier parent (if radio update children), prepare errors, touched, etc.\n newRenderer = updateParentGroup(productId, newRenderer, path, false);\n // generate new product\n const updatedProduct = buildProductFromRenderer(newRenderer, form.product);\n // store updated form\n const updatedForm: ModifiersFormInternal = {\n ...form,\n renderer: newRenderer,\n product: updatedProduct,\n status: mapGlobalRendererStatus(newRenderer)\n };\n const newForms: ModifiersForms = { ...forms, [productId]: updatedForm };\n State().setState({ forms: newForms });\n // Pass form to the callback\n const returnForm = { ...updatedForm };\n delete (returnForm as any).callback;\n form.callback(returnForm);\n};\n\n// UPDATE RENDERER _ NOT SPLITTED INTO A DIFFERENT FILE TO AVOID CIRCULAR DEPS\n\nexport const updateModifier = (\n renderer: ModifierGroupRenderer[],\n path: string[],\n node: ModifierRenderer,\n amount: number,\n strict: boolean\n) => {\n const newModifierRenderer: ModifierRenderer = {\n ...node,\n amount,\n touched: true,\n errors: getModifierErrors(node, amount, strict),\n totals: getProductTotals({ ...(node.data as any), amount }),\n data: {\n ...node.data,\n amount\n }\n };\n newModifierRenderer.status = getModifierRendererStatus(newModifierRenderer);\n return setRendererPathNode(renderer, path, newModifierRenderer);\n};\n\nexport const updateParentGroup = (\n rootId: string,\n renderer: ModifierGroupRenderer[],\n path: string[],\n strict: boolean\n) => {\n const parentPath = path.slice(0, -1);\n const parentGroup = getRendererPathNode(\n renderer,\n parentPath\n ) as ModifierGroupRenderer;\n let newModifierRenderers = [...parentGroup.modifiers];\n // !strict is a hack to let radio buttons not lose its amount when running validate\n if (parentGroup.type === \"RADIO\" && !strict) {\n newModifierRenderers = parentGroup.modifiers.map(modifier => {\n if (modifier.type !== \"RADIO\") {\n return { ...modifier };\n }\n if (modifier.id === path[path.length - 1]) {\n return { ...modifier };\n }\n return {\n ...modifier,\n amount: 0,\n error: \"\",\n totals: getProductTotals({ ...(modifier.data as any), amount: 0 }),\n data: {\n ...modifier.data,\n amount: 0\n }\n };\n });\n }\n //update decendents\n newModifierRenderers = newModifierRenderers.map(modifier => {\n const subproduct = toFormCartProductFromAnswer(modifier.data as any);\n const newPath = [...path.slice(0, -1), modifier.id];\n const updatedModifier = {\n ...modifier,\n groups: buildRenderer(\n subproduct,\n {\n rootId,\n path: newPath\n },\n modifier.groups\n )\n };\n updatedModifier.errors = getModifierErrors(\n updatedModifier,\n updatedModifier.amount,\n strict\n );\n updatedModifier.status = getModifierRendererStatus(updatedModifier);\n return updatedModifier;\n });\n // Update parent group data with children modifiers up to date data\n const updatedGroupAnswers = newModifierRenderers.map(modifier => {\n return { ...modifier.data };\n });\n const newGroupData = { ...parentGroup.data, answers: updatedGroupAnswers };\n // Create up to date group\n const newGroupRenderer = {\n ...parentGroup,\n touched: true,\n modifiers: newModifierRenderers,\n data: newGroupData\n };\n\n // update errors with the latest data\n newGroupRenderer.errors = getGroupModifierErrors(newGroupRenderer, strict);\n // update status with the latest data\n newGroupRenderer.status = getGroupRendererStatus(newGroupRenderer);\n let newRenderer = setRendererPathNode(renderer, parentPath, newGroupRenderer);\n if (parentPath.length > 1) {\n newRenderer = updateParentModifier(rootId, newRenderer, parentPath, strict);\n }\n\n return newRenderer;\n};\n\nexport const updateParentModifier = (\n rootId: string,\n renderer: ModifierGroupRenderer[],\n path: string[],\n strict: boolean\n) => {\n const parentPath = path.slice(0, -1);\n const parentModifier = getRendererPathNode(\n renderer,\n parentPath\n ) as ModifierRenderer;\n // Update parent modifier data with children groups up to date data\n const updatedModifierQuestions = parentModifier.groups.map(group => {\n return { ...group.data };\n });\n const newAnswers = buildQuestionAndAnswersFromRenderer(parentModifier.groups);\n const newModifierData = {\n ...parentModifier.data,\n questions: updatedModifierQuestions,\n questionsAndAnswers: newAnswers\n };\n const newModifierGroups = parentModifier.groups.map(group => {\n const newGroup = { ...group };\n newGroup.errors = getGroupModifierErrors(newGroup, strict);\n newGroup.status = getGroupRendererStatus(newGroup);\n return newGroup;\n });\n // Create up to date modifier\n const newModifierRenderer = {\n ...parentModifier,\n touched: true,\n groups: newModifierGroups,\n data: newModifierData\n };\n newModifierRenderer.errors = getModifierErrors(\n newModifierRenderer,\n newModifierRenderer.amount,\n strict\n );\n newModifierRenderer.status = getModifierRendererStatus(newModifierRenderer);\n let newRenderer = setRendererPathNode(\n renderer,\n parentPath,\n newModifierRenderer\n );\n if (parentPath.length > 1) {\n newRenderer = updateParentGroup(rootId, newRenderer, parentPath, strict);\n }\n return newRenderer;\n};\n","// validateProduct functions\nimport { Product } from \"@artisan-commerce/types\";\n\nimport { ModifiersForms } from \"../../types/common.types\";\nimport { RendererStatus } from \"../../types/modifiers.types\";\nimport { ModifierGroupRenderer } from \"../../types/modifiers.types\";\nimport { ModifierRenderer } from \"../../types/modifiers.types\";\nimport { mapGlobalRendererStatus } from \"../../utils/modifiers/common.utils\";\nimport { ModifiersFormInternal } from \"../registerModifiersForm/registerModifiersForm.types\";\nimport { buildProductFromRenderer } from \"../buildProductFromRenderer/buildProductFromRenderer\";\nimport { updateParentGroup } from \"../../utils/modifiers/renderer.utils\";\nimport { updateModifier } from \"../../utils/modifiers/renderer.utils\";\nimport { State } from \"../../utils/state\";\n\nexport const validateProduct = (\n productId: Product[\"productId\"]\n): RendererStatus => {\n const forms = { ...State().state.forms };\n const form = forms[productId];\n const { renderer, callback, product } = form;\n let latestRenderer = [...renderer];\n // Go to leaf modifiers and start updating the renderer\n renderer.forEach(group => {\n const path = [group.id];\n latestRenderer = validateChildModifiers(\n group,\n latestRenderer,\n productId,\n path\n );\n });\n // generate new product\n const updatedProduct = buildProductFromRenderer(latestRenderer, product);\n // store updated form\n const updatedForm: ModifiersFormInternal = {\n ...form,\n renderer: latestRenderer,\n product: updatedProduct,\n status: mapGlobalRendererStatus(latestRenderer)\n };\n const newForms: ModifiersForms = { ...forms, [productId]: updatedForm };\n State().setState({ forms: newForms });\n // Pass form to the callback\n const returnForm = { ...updatedForm };\n delete (returnForm as any).callback;\n callback(returnForm);\n return updatedForm.status;\n};\n\nexport const validateChildModifiers = (\n group: ModifierGroupRenderer,\n renderer: ModifierGroupRenderer[],\n productId: Product[\"productId\"],\n path: string[]\n): ModifierGroupRenderer[] => {\n const { modifiers, id } = group;\n const isLeaft = !modifiers.length;\n let latestRenderer = [...renderer];\n if (!isLeaft) {\n modifiers.forEach(modifier => {\n const newPath = [...path, modifier.id];\n latestRenderer = validateChildGroups(\n modifier,\n latestRenderer,\n productId,\n newPath\n );\n });\n\n return latestRenderer;\n } else {\n console.warn(\n `Attempting to validate a Modifier group without modifiers, this will likely result in unexpected behaviour. \n Please update the bad group ${id} of product ${0}.`\n );\n // Group does not have any modifiers, should never happen!\n return latestRenderer;\n }\n};\n\nexport const validateChildGroups = (\n modifier: ModifierRenderer,\n renderer: ModifierGroupRenderer[],\n productId: Product[\"productId\"],\n path: string[]\n): ModifierGroupRenderer[] => {\n const { groups, amount, status, required } = modifier;\n const isLeaft = !groups.length || amount === 0;\n let latestRenderer = [...renderer];\n if (isLeaft) {\n const badIdle = status === \"IDLE\" && required;\n const badStatus = badIdle || status === \"FAIL\" || status === \"INCOMPLETE\";\n const newStatus: RendererStatus = badStatus ? \"FAIL\" : status;\n const replacement = { ...modifier, status: newStatus };\n\n const newPath = [...path];\n latestRenderer = updateModifier(\n latestRenderer,\n newPath,\n replacement,\n replacement.amount,\n true\n );\n\n // update modifier parent (if radio update children), prepare errors, touched, etc.\n latestRenderer = updateParentGroup(\n productId,\n latestRenderer,\n newPath,\n true\n );\n } else {\n groups.forEach(group => {\n const newPath = [...path, group.id];\n latestRenderer = validateChildModifiers(\n group,\n latestRenderer,\n productId,\n newPath\n );\n });\n }\n return latestRenderer;\n};\n","// Modifier forms utility functions\nimport { CartProduct, Product } from \"@artisan-commerce/types\";\n\nimport { buildProductFromRenderer } from \"../../lib/buildProductFromRenderer/buildProductFromRenderer\";\nimport { ModifiersForm } from \"../../lib/registerModifiersForm/registerModifiersForm.types\";\nimport { validateProduct } from \"../../lib/validateProduct/validateProduct\";\nimport { toFormCartProduct } from \"../transformers/transformers.utils\";\nimport { mapGlobalRendererStatus } from \"./common.utils\";\nimport { buildRenderer } from \"./renderer.utils\";\n\nexport const createForm = (product: Product): ModifiersForm => {\n // Similar to toCartProduct, but it sets the questionsAndAnswers field inside the questions field\n const formCartProduct = toFormCartProduct(product, {\n amount: (product as CartProduct).amount ?? 1\n });\n const renderer = buildRenderer(formCartProduct, {\n rootId: formCartProduct.productId,\n path: []\n });\n const updatedProduct = buildProductFromRenderer(renderer, product);\n return {\n product: updatedProduct,\n renderer,\n validate: () => validateProduct(product.productId),\n status: mapGlobalRendererStatus(renderer)\n };\n};\n","// registerModifiersForm functions\nimport { Product } from \"@artisan-commerce/types\";\n\nimport { logError } from \"../../utils/common.utils\";\nimport { createForm } from \"../../utils/modifiers/form.utils\";\nimport { ModifiersFormCallback } from \"./registerModifiersForm.types\";\nimport { ModifiersFormUnsubscriber } from \"./registerModifiersForm.types\";\nimport { State } from \"../../utils/state\";\n\n/**\n * Creates a product modifiers form listener that handles the input change\n * events automatically.\n *\n * @param {Product} product The product that will be listened\n * @param {ModifiersFormCallback} callback Returns a snapshot of the current\n * state of the form\n * @returns {ModifiersFormUnsubscriber} Returns a function that when called it\n * stops listening to the form\n */\nexport const registerModifiersForm = (\n product: Product,\n callback: ModifiersFormCallback\n): ModifiersFormUnsubscriber => {\n const { productId } = product;\n // Check if form already exists\n const { forms } = State().state;\n const formExists = !!forms[productId];\n if (formExists) {\n logError(\n `Form for product with id ${productId} has already been register. Please unsubscribe if you need to register a new form.`\n );\n return () => {};\n }\n // create new form\n const form = createForm(product);\n // register (save form in state with callback)\n const newForms = { ...forms, [productId]: { ...form, callback } };\n State().setState({ forms: newForms });\n callback({ ...form });\n return () => unsubscriber(productId);\n};\n\n/**\n * Function that when called it stops listening to the form.\n *\n * @param {string} productId The id of the product that will be deleted from the\n * form\n */\nexport const unsubscriber = (productId: Product[\"productId\"]) => {\n const { forms } = State().state;\n const newForms = { ...forms };\n delete newForms[productId];\n State().setState({ forms: newForms });\n};\n\n//TODO: continue here. Add to cart in demo\n\n//TODO:\n// Add to cart in demo\n// change counter to quantity\n// Add shopping cart replaceProduct\n// Make sure getProductTotals uses third level\n// Test updating a cartProduct with form\n// defaults\n\n// DONE:\n// validate\n// set modifier and group errors\n// status\n// generate renderer\n// do handleChange\n// generate product\n// set visibility\n// 3rd level everything\n\n// USAGE:\n// const unsubscribe = registerModifiersForm(product: Product, ({ renderer, product, validate }) => {})\n\n// custom hook = const { renderer, product, validate } = useProductForm(product : Product);\n\n// handleChange(quantity) inside its implementation it looks like the following\n// handleChange = (quantity) => genericHandleChange(hash, quantity);\n\n// product = A regular cart product but already modified with the selected modifiers\n\n// validate = function used to rebuild the renderer object\n\n// Error types: modifier group bad configured, group invalid selection, modifier invalid value, illegal selection.\n// If production console error, others throw error\n\n// Required = modifier or group must be filled, useful to for ui designs\n\n// Touched = whether the field was interacted with before\n\n// Type = type of Group or Modifier to render\n\n// Hidden = whether to show or not given group or modifier\n// this property is calculated based on product properties or parent modifier selection\n"],"names":["__spreadProps","__spreadValues","__defProp","__getOwnPropSymbols","__hasOwnProp","__propIsEnum","__defNormalProp","State","StateClass"],"mappings":";;AAOa,MAAA,aAAA,GAAgB,CAAC,OAAkC,KAAA;AAC9D,EAAA,MAAM,EAAE,IAAA,EAAM,MAAQ,EAAA,MAAA,EAAQ,SAAc,EAAA,GAAA,OAAA,CAAA;AAC5C,EAAI,IAAA,OAAO,SAAS,QAAU,EAAA;AAC5B,IAAO,OAAA,KAAA,CAAA;AAAA,GAAA;AAET,EAAI,IAAA,OAAO,cAAc,QAAU,EAAA;AACjC,IAAO,OAAA,KAAA,CAAA;AAAA,GAAA;AAET,EACE,IAAA,OAAO,MAAW,KAAA,QAAA,IACjB,OAAO,MAAA,KAAW,YAAY,MAAO,CAAA,IAAA,CAAK,MAAQ,CAAA,CAAA,MAAA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AA,CAAA,CAAA;AACd,EAAA,OAAO,MAAM,YAAa,CAAA,SAAA,CAAA,CAAA;AAAA,EAAA;AASf,MAAA,YAAA,GAAe,CAAC,SAAoC,KAAA;AAC/D,EAAM,MAAA,EAAE,UAAU,KAAQ,EAAA,CAAA,KAAA,CAAA;AAC1B,EAAA,MAAM,WAAW,cAAK,CAAA,EAAA,EAAA,KAAA,CAAA,CAAA;AACtB,EAAA,OAAO,QAAS,CAAA,SAAA,CAAA,CAAA;AAChB,EAAQ,KAAA,EAAA,CAAA,QAAA,CAAS,EAAE,KAAO,EAAA,QAAA,EAAA,CAAA,CAAA;AAAA,CAAA;;;;;;;;;"}
package/dist/bundle.mjs CHANGED
@@ -633,17 +633,19 @@ const getProductTotals = (product, amount = product.amount > 0 ? product.amount
633
633
  throw new Error("Cannot set the amount of getProductTotals with a value less than 1");
634
634
  }
635
635
  const cartProduct = product;
636
+ const { priceCategory } = cartProduct;
637
+ const isPoints = priceCategory === "POINTS";
636
638
  const sanitize = !!cartProduct.updatedAt;
637
639
  const sanitized = sanitize ? divideProductQA(cartProduct) : product;
638
640
  return {
639
641
  unitGrossPrice: getProductGrossPrice(sanitized, 1),
640
642
  unitTotalDiscounts: getProductTotalDiscounts(),
641
- unitTotalTaxes: getProductTotalTaxes(sanitized, 1),
643
+ unitTotalTaxes: !isPoints ? getProductTotalTaxes(sanitized, 1) : 0,
642
644
  unitNetPrice: getProductNetPrice(sanitized, 1),
643
645
  amount,
644
646
  grossPrice: getProductGrossPrice(sanitized, amount),
645
647
  totalDiscounts: getProductTotalDiscounts(),
646
- totalTaxes: getProductTotalTaxes(sanitized, amount),
648
+ totalTaxes: !isPoints ? getProductTotalTaxes(sanitized, amount) : 0,
647
649
  netPrice: getProductNetPrice(sanitized, amount)
648
650
  };
649
651
  };