@restaround/react 1.4.45 → 1.4.47
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/index.esm.js +1 -1
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/models/modules/branch/utils.d.ts +1 -3
- package/dist/modules/branch/hooks.test.d.ts +1 -0
- package/dist/modules/branch/utils.d.ts +1 -3
- package/dist/modules/business/hooks.test.d.ts +1 -0
- package/dist/modules/category/hooks.test.d.ts +1 -0
- package/dist/modules/category/utils.test.d.ts +1 -0
- package/dist/modules/customer/hooks.test.d.ts +1 -0
- package/dist/modules/feature/hooks.test.d.ts +1 -0
- package/dist/modules/menu/utils.test.d.ts +1 -0
- package/dist/utils/index.esm.js +1 -1
- package/dist/utils/index.esm.js.map +1 -1
- package/dist/utils/index.js +1 -1
- package/dist/utils/index.js.map +1 -1
- package/package.json +1 -1
package/dist/utils/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../../../src/modules/addon/utils.ts","../../../src/modules/addon/models.ts","../../../src/modules/product/utils.ts","../../../src/modules/order/models.ts","../../../src/modules/order/constants.ts","../../../src/modules/order/utils.ts","../../../src/modules/view/constants.ts","../../../src/modules/view/utils.ts","../../../src/modules/customer/models.ts","../../../src/modules/feature/models.ts","../../../src/modules/feature/constants.ts","../../../src/modules/category/utils.ts","../../../src/modules/customer/utils.ts","../../../src/modules/feature/utils.ts","../../../src/modules/menu/utils.ts"],"sourcesContent":["import { priceFormatter } from \"@sorocraft/js-utils\";\n\nimport {\n\tMenuAddon,\n\tMenuAddonOption,\n\tMenuAddonOptionTranslation,\n\tMenuAddonTranslation,\n} from \"./models\";\n\nexport const getAddonTranslation = (addon: MenuAddon, language: string): MenuAddonTranslation => {\n\treturn (addon?.translations?.find?.((item) => item.language === language) ||\n\t\t{}) as MenuAddonTranslation;\n};\n\nexport const getAddonOptionTranslation = (\n\toption: MenuAddonOption,\n\tlanguage: string\n): MenuAddonOptionTranslation => {\n\treturn (option?.translations?.find?.((item) => item.language === language) ||\n\t\t{}) as MenuAddonOptionTranslation;\n};\n\nexport const getOptionPrice = ({\n\toption,\n\tcurrency = \"USD\",\n\tlanguage = \"en\",\n}: {\n\toption: MenuAddonOption;\n\tcurrency?: string;\n\tlanguage?: string;\n}) => {\n\tconst { price } = option || {};\n\n\treturn {\n\t\ttotalPrice: price,\n\t\tformattedTotalPrice: priceFormatter(price, currency, language),\n\t};\n};\n\nexport const getAddonOptionRawPrice = (addon: MenuAddon, optionId: number): number => {\n\treturn (addon?.options || []).find(({ id }) => id === optionId)?.price || 0;\n};\n\nexport const getOptionTitles = (\n\toptions: MenuAddonOption[],\n\toptionIds: number | number[],\n\tlanguage: string\n): string => {\n\tif (Array.isArray(optionIds)) {\n\t\treturn options\n\t\t\t.filter(({ id }) => optionIds.includes(id))\n\t\t\t.map(({ translations }) => translations.find((t) => t.language === language)?.title || \"\")\n\t\t\t.filter(Boolean)\n\t\t\t.join(\", \");\n\t} else {\n\t\tconst option = options.find(({ id }) => id === optionIds);\n\t\treturn option?.translations.find((t) => t.language === language)?.title || \"\";\n\t}\n};\n\nexport const getAddonTitle = (addon: MenuAddon, language: string): string => {\n\treturn addon?.translations?.find?.((t) => t.language === language)?.title || \"\";\n};\n","export enum MenuAddonSelectType {\n\tSINGLE = \"SINGLE\",\n\tMULTIPLE = \"MULTIPLE\",\n}\n\nexport interface MenuAddonTranslation {\n\tid?: number;\n\ttitle: string;\n\tlanguage: string;\n}\n\nexport interface MenuAddonOptionTranslation {\n\tid?: number;\n\ttitle: string;\n\tlanguage: string;\n}\n\nexport interface MenuAddonOption {\n\tid?: number;\n\tprice: number;\n\ttranslations: MenuAddonOptionTranslation[];\n\tremove?: boolean;\n}\n\nexport interface MenuAddon {\n\tid?: number;\n\tselectType: MenuAddonSelectType;\n\ttranslations: MenuAddonTranslation[];\n\toptions: MenuAddonOption[];\n\tbusinessId?: number;\n}\n","import { isEmpty, priceFormatter } from \"@sorocraft/js-utils\";\n\nimport { Product, ProductTranslation, ProductVariant, ProductVariantTranslation } from \"./models\";\n\nimport { MenuAddon, MenuAddonSelectType } from \"src/modules/addon/models\";\nimport { getAddonOptionRawPrice } from \"src/modules/addon/utils\";\nimport * as orderModels from \"src/modules/order/models\";\n\nexport const calculateTotalPrice = (price: number = 0, quantity: number = 1, vat: number = 0) => {\n\treturn price * quantity * (1 + vat / 100);\n};\n\nexport const getProductTranslation = (\n\tproduct: Pick<Product, \"translations\">,\n\tlanguage: string\n): ProductTranslation => {\n\treturn (product?.translations?.find?.((item) => item.language === language) ||\n\t\t{}) as ProductTranslation;\n};\n\nexport const getProductRawPrice = (\n\tproduct: Pick<Product, \"price\" | \"vat\">,\n\tquantity: number = 1\n) => {\n\tconst { price = 0, vat = 0 } = product || {};\n\treturn calculateTotalPrice(price, quantity, vat);\n};\n\nexport const getProductPrice = (\n\tproduct: Pick<Product, \"price\" | \"vat\">,\n\tcurrency: string,\n\tlanguage: string,\n\tquantity: number = 1\n) => {\n\tconst totalPrice = getProductRawPrice(product, quantity);\n\n\treturn {\n\t\ttotalPrice: totalPrice,\n\t\tformattedTotalPrice: priceFormatter(totalPrice, currency, language),\n\t};\n};\n\nexport const getProductVariant = (\n\tproduct: Pick<Product, \"variants\">,\n\tvariantId: number\n): ProductVariant => {\n\treturn product?.variants?.find?.((item) => item.id === variantId) || ({} as ProductVariant);\n};\n\nexport const getSelectedOptionsTotalPrice = (\n\tproduct: Product,\n\tselectedAddons: orderModels.SelectedAddons = {},\n\tquantity: number\n): number => {\n\t// Filter addons that are selected by the user\n\tconst selectedAddonsList = (product?.addons || []).filter((addon) =>\n\t\tObject.prototype.hasOwnProperty.call(selectedAddons, addon.id)\n\t);\n\n\t// Calculate the total price\n\tconst optionsTotalPrice = selectedAddonsList.reduce((total: number, addon: MenuAddon) => {\n\t\tconst { id: addonId, selectType } = addon;\n\n\t\t// Handle SINGLE selection\n\t\tif (selectType === MenuAddonSelectType.SINGLE) {\n\t\t\tconst selectedOptionId = selectedAddons[addonId] as number;\n\t\t\treturn total + getAddonOptionRawPrice(addon, selectedOptionId);\n\t\t}\n\n\t\t// Handle MULTIPLE selection\n\t\tconst selectedOptionIds = (selectedAddons[addonId] || []) as number[];\n\t\tconst multipleOptionsPrice = selectedOptionIds.reduce(\n\t\t\t(multipleTotal, optionId) => multipleTotal + getAddonOptionRawPrice(addon, optionId),\n\t\t\t0\n\t\t);\n\n\t\treturn total + multipleOptionsPrice;\n\t}, 0);\n\n\treturn optionsTotalPrice * quantity;\n};\n\nexport const getProductVariantRawPrice = (\n\tvariantId: number,\n\tproduct: Pick<Product, \"variants\" | \"vat\">,\n\tquantity?: number\n) => {\n\tconst variant = getProductVariant(product, variantId);\n\tconst { vat } = product || {};\n\tconst { price } = variant || {};\n\treturn calculateTotalPrice(price, quantity, vat);\n};\n\nexport const getProductVariantPrice = ({\n\tvariantId,\n\tcurrency = \"USD\",\n\tlanguage = \"en\",\n\tproduct,\n\tquantity = 1,\n}: {\n\tvariantId: number;\n\tcurrency?: string;\n\tlanguage?: string;\n\tproduct: Pick<Product, \"variants\" | \"vat\">;\n\tquantity?: number;\n}) => {\n\tconst totalPrice = getProductVariantRawPrice(variantId, product, quantity);\n\n\treturn {\n\t\ttotalPrice: totalPrice,\n\t\tformattedTotalPrice: priceFormatter(totalPrice, currency, language),\n\t};\n};\n\nexport const getProductVariantTranslation = (\n\tvariant: ProductVariant,\n\tlanguage: string\n): ProductVariantTranslation => {\n\treturn (variant?.translations?.find?.((item) => item.language === language) ||\n\t\t{}) as ProductVariantTranslation;\n};\n\nexport const getProductOrderRawPrice = ({\n\tproduct,\n\tvariantId,\n\tquantity = 1,\n\tselectedAddons,\n\tnoVat = false,\n}: {\n\tproduct: Product;\n\tvariantId: number | null;\n\tquantity: number;\n\tselectedAddons: orderModels.SelectedAddons;\n\tnoVat?: boolean;\n}): { price: number; optionsPrice: number; total: number } => {\n\tif (isEmpty(product)) return { price: 0, optionsPrice: 0, total: 0 };\n\n\tconst productData: Product = { ...product, vat: noVat ? 0 : product.vat };\n\tconst selectedOptionsTotalPrice = getSelectedOptionsTotalPrice(\n\t\tproductData,\n\t\tselectedAddons,\n\t\tquantity\n\t);\n\tconst price = variantId\n\t\t? getProductVariantRawPrice(variantId, productData, quantity)\n\t\t: getProductRawPrice(productData, quantity);\n\n\treturn {\n\t\tprice,\n\t\toptionsPrice: selectedOptionsTotalPrice,\n\t\ttotal: price + selectedOptionsTotalPrice,\n\t};\n};\n\nexport const getProductOrderPrice = ({\n\tproduct,\n\tvariantId,\n\tquantity = 1,\n\tcurrency,\n\tlanguage,\n\tselectedAddons,\n\tnoVat = false,\n}: {\n\tproduct: Product;\n\tvariantId: number | null;\n\tquantity: number;\n\tcurrency: string;\n\tlanguage: string;\n\tselectedAddons: orderModels.SelectedAddons;\n\tnoVat?: boolean;\n}) => {\n\tconst { total } = getProductOrderRawPrice({\n\t\tproduct,\n\t\tvariantId,\n\t\tquantity,\n\t\tselectedAddons,\n\t\tnoVat,\n\t});\n\n\treturn {\n\t\ttotalPrice: total,\n\t\tformattedTotalPrice: priceFormatter(total, currency, language),\n\t};\n};\n\nexport const getProductAddon = (product: Product, addonId: number): MenuAddon => {\n\treturn (product?.addons || []).find(({ id }) => id === addonId) || ({} as MenuAddon);\n};\n","import * as customerModels from \"../customer/models\";\n\nexport enum OrderType {\n\tDINE_IN = \"DINE_IN\",\n\tPICK_UP = \"PICK_UP\",\n\tDELIVERY = \"DELIVERY\",\n}\n\nexport enum OrderStatus {\n\tDRAFT = \"DRAFT\",\n\tPENDING = \"PENDING\",\n\tCONFIRMED = \"CONFIRMED\",\n\tPREPARING = \"PREPARING\",\n\tREADY = \"READY\",\n\tOUT_FOR_DELIVERY = \"OUT_FOR_DELIVERY\",\n\tDELIVERED = \"DELIVERED\",\n\tCOMPLETED = \"COMPLETED\",\n\tCANCELLED = \"CANCELLED\",\n\tFAILED = \"FAILED\",\n}\n\nexport enum OrderItemStatus {\n\tPENDING = \"PENDING\",\n\tPREPARING = \"PREPARING\",\n\tREADY = \"READY\",\n\tSERVED = \"SERVED\",\n}\n\nexport enum PaymentMethod {\n\tCASH = \"CASH\",\n\tCARD = \"CARD\",\n\tWALLET = \"WALLET\",\n\tTERMINAL = \"TERMINAL\",\n}\n\nexport interface OrderAddonOption {\n\toptionId: number;\n\tprice: number;\n}\n\nexport interface OrderAddon {\n\tid?: number;\n\taddonId: number;\n\toptions: OrderAddonOption[];\n}\n\nexport interface SelectedAddons {\n\t[key: number]: number | number[];\n}\n\nexport interface OrderItemVariant {\n\tid?: number;\n\tvariantId: number;\n\tprice: number;\n}\n\nexport interface OrderItem {\n\tid?: number;\n\tproductId: number;\n\torderId?: number;\n\tquantity: number;\n\tprice: number;\n\tvariant?: OrderItemVariant;\n\taddons: OrderAddon[];\n\tnote?: string;\n\tstatus?: OrderItemStatus;\n\tvat?: number;\n\tisPaid?: boolean;\n}\n\nexport interface Order {\n\tid?: number;\n\tbusinessId?: number;\n\tbranchId?: number;\n\tworkingDayId?: number;\n\ttableId?: number;\n\temployeeId?: number;\n\torderType: OrderType;\n\ttotalPriceWithTax: number;\n\ttotalPriceWithTaxAndFees?: number;\n\ttotalPriceWithoutTax: number;\n\ttotalTax: number;\n\titems: OrderItem[];\n\tstatus?: OrderStatus;\n\tvat?: number;\n\tpaymentMethod?: PaymentMethod;\n\tnote?: string;\n\tcreatedAt?: number;\n\tupdatedAt?: number;\n\tcustomer?: customerModels.Customer;\n\tdeliveryFee?: number;\n}\n\nexport interface OrderItems {\n\t[key: string]: OrderItem;\n}\n\nexport enum OrderStep {\n\tCART = \"CART\",\n\tDETAILS = \"DETAILS\",\n\tCOMPLETED = \"COMPLETED\",\n}\n\nexport interface OrderPayload extends Order {\n\tcustomerAddressId: number;\n\tcustomerId: number;\n}\n\nexport type OrderPriceDetails = {\n\ttotalPriceWithTax: number;\n\ttotalPriceWithTaxAndFees: number;\n\ttotalPriceWithoutTax: number;\n\ttotalTax: number;\n};\n\nexport type OrderFormattedPriceDetails = {\n\ttotalPriceWithTax: string;\n\ttotalPriceWithTaxAndFees: string;\n\ttotalPriceWithoutTax: string;\n\ttotalTax: string;\n};\n","import { OrderStep, PaymentMethod } from \"./models\";\n\nexport const initialOrder = {\n\torderType: null,\n\ttotalPriceWithTax: 0,\n\ttotalPriceWithoutTax: 0,\n\ttotalTax: 0,\n\tvat: 0,\n\tpaymentMethod: PaymentMethod.CASH,\n};\n\nexport const ORDER_STEPS = [OrderStep.CART, OrderStep.DETAILS, OrderStep.COMPLETED];\n\nexport enum OrderErrors {\n\tFIELD_REQUIRED_ERROR = \"This field is required\",\n\tTABLE_NOT_SELECTED = \"Please select a table\",\n\tADDRESS_IS_EMPTY = \"Please enter an address\",\n\tEMPTY_ITEMS = \"Please choose product\",\n\tBRANCH_NOT_SELECTED = \"Please select a branch\",\n}\n","import { isEmpty, priceFormatter, sortNumbers } from \"@sorocraft/js-utils\";\nimport { IconType } from \"@sorocraft/ui\";\nimport { Check, BagCheck, Delivery, Chef, FileCheck, HourglassHalf } from \"@sorocraft/ui/icons\";\n\nimport {\n\tOrder,\n\tOrderAddon,\n\tOrderAddonOption,\n\tOrderItem,\n\tOrderStatus,\n\tOrderType,\n\tSelectedAddons,\n} from \"./models\";\n\nimport * as addonModels from \"../addon/models\";\nimport * as branchModels from \"../branch/models\";\nimport { OrderErrors } from \"./constants\";\n\nexport const calculatSingleAddonTotalPrice = (addon: OrderAddon) => {\n\treturn addon.options.reduce((sum, option) => sum + option.price, 0);\n};\n\nexport function calculateTotalAddonPrice(addons: OrderAddon[] = [], quantity: number = 1): number {\n\tconst totalAddonsPriceForSingleItem = addons.reduce((total, addon) => {\n\t\tconst addonTotal = calculatSingleAddonTotalPrice(addon);\n\t\treturn total + addonTotal;\n\t}, 0);\n\n\treturn quantity * totalAddonsPriceForSingleItem;\n}\n\nexport const getOrderPrice = (order: Order, currency: string, language: string) => {\n\tconst calculateItemTotal = (price: number, quantity: number, addons: OrderAddon[]) => {\n\t\treturn quantity * price + calculateTotalAddonPrice(addons, quantity);\n\t};\n\n\tlet totalWithoutTax = 0;\n\tlet totalTax = 0;\n\n\tfor (const item of order.items) {\n\t\tconst itemTotal = calculateItemTotal(item.price, item.quantity, item.addons);\n\t\ttotalWithoutTax += itemTotal;\n\n\t\tif (order.vat === undefined && item.vat) {\n\t\t\ttotalTax += (itemTotal * item.vat) / 100;\n\t\t}\n\t}\n\n\tif (order.vat !== undefined) {\n\t\ttotalTax = (totalWithoutTax * order.vat) / 100;\n\t}\n\n\tconst totalWithTax = totalWithoutTax + totalTax;\n\n\treturn {\n\t\ttotalWithoutTax,\n\t\ttotalWithoutTaxFormatted: priceFormatter(totalWithoutTax, currency, language),\n\t\ttotalTax,\n\t\ttotalTaxFormatted: priceFormatter(totalTax, currency, language),\n\t\ttotalWithTax,\n\t\ttotalWithTaxFormatted: priceFormatter(totalWithTax, currency, language),\n\t};\n};\n\nexport const generateOrderItemsId = (\n\tproductId: number,\n\tvariantId: number | null,\n\tselectedAddons?: SelectedAddons\n): string => {\n\tif (!productId) throw new Error(\"Product ID is required\");\n\n\t// Build the order items ID base with productId and variantId\n\tlet orderItemsId = `${productId}`;\n\tif (variantId) {\n\t\torderItemsId += `-${variantId}`;\n\t}\n\n\t// Build the addon part of the ID\n\tconst addonIdsPart = Object.entries(selectedAddons || {})\n\t\t.map(([addonId, option]) => {\n\t\t\tif (!addonId || !option) return null; // Skip invalid entries\n\t\t\tconst optionIds = Array.isArray(option)\n\t\t\t\t? sortNumbers(option).filter(Boolean).join(\"-\")\n\t\t\t\t: `${option}`;\n\t\t\tif (!optionIds) return null;\n\t\t\treturn `${addonId}-${optionIds}`;\n\t\t})\n\t\t.filter(Boolean) // Remove null/undefined values\n\t\t.join(\"-\");\n\n\t// Append addonIdsPart if it's not empty\n\tif (addonIdsPart) {\n\t\torderItemsId += `-${addonIdsPart}`;\n\t}\n\n\treturn orderItemsId;\n};\n\nexport const getOrderItemPrice = (orderItem: OrderItem) => {\n\tconst { price, variant, addons, quantity, vat } = orderItem || {};\n\tconst basePrice = variant?.price ?? price;\n\tconst addonsPrice = calculateTotalAddonPrice(addons, 1); // single item's addon price\n\n\tconst itemNetPrice = basePrice + addonsPrice;\n\t// Currently VAT is applied only on basePrice, not on addons\n\t// TODO: Re-evaluate for European market where tax may apply to addons too\n\tconst itemTax = basePrice * (vat / 100);\n\tconst itemGrossPrice = itemNetPrice + itemTax;\n\n\tconst totalNet = itemNetPrice * quantity;\n\tconst totalTax = itemTax * quantity;\n\tconst totalGross = itemGrossPrice * quantity;\n\n\treturn {\n\t\ttotalGross,\n\t\ttotalNet,\n\t\ttotalTax,\n\t\titemGrossPrice,\n\t\titemNetPrice,\n\t\titemTax,\n\t};\n};\n\nexport const getSelectedAddonsFromOrderItems = (item: OrderItem): SelectedAddons => {\n\tconst selectedAddons: SelectedAddons = {};\n\n\tfor (const { addonId, options = [] } of item.addons || []) {\n\t\tconst optionIds = options.map(({ optionId }) => optionId);\n\t\tselectedAddons[addonId] = optionIds.length === 1 ? optionIds[0] : optionIds;\n\t}\n\n\treturn selectedAddons;\n};\n\nexport const getStatusIcon = (status: OrderStatus): IconType => {\n\tswitch (status) {\n\t\tcase OrderStatus.COMPLETED:\n\t\t\treturn Check;\n\t\tcase OrderStatus.DELIVERED:\n\t\t\treturn BagCheck;\n\t\tcase OrderStatus.OUT_FOR_DELIVERY:\n\t\t\treturn Delivery;\n\t\tcase OrderStatus.PREPARING:\n\t\t\treturn Chef;\n\t\tcase OrderStatus.CONFIRMED:\n\t\t\treturn FileCheck;\n\t\tcase OrderStatus.PENDING:\n\t\t\treturn HourglassHalf;\n\n\t\tdefault:\n\t\t\treturn HourglassHalf;\n\t}\n};\n\nexport const buildSelectedAddonsPayload = (\n\tproductAddons: addonModels.MenuAddon[] = [],\n\tselectedAddons: SelectedAddons = {}\n): OrderAddon[] => {\n\treturn Object.entries(selectedAddons).map(([addonIdStr, selected]) => {\n\t\tconst addonId = Number(addonIdStr);\n\t\tconst selectedOptionIds = Array.isArray(selected) ? selected : [selected];\n\n\t\tconst addon = productAddons.find((addon) => addon.id === addonId);\n\t\tif (isEmpty(addon)) {\n\t\t\treturn {\n\t\t\t\taddonId,\n\t\t\t\toptions: [],\n\t\t\t};\n\t\t}\n\n\t\tconst options: OrderAddonOption[] = (addon.options || [])\n\t\t\t.filter((option) => selectedOptionIds.includes(option.id))\n\t\t\t.map((option) => ({\n\t\t\t\toptionId: option.id,\n\t\t\t\tprice: option.price,\n\t\t\t}));\n\n\t\treturn {\n\t\t\taddonId,\n\t\t\toptions,\n\t\t};\n\t});\n};\n\nexport const getDefaultOrderType = (\n\tsettings: branchModels.BranchSettings,\n\tisOpen: boolean,\n\tisDelivering: boolean\n): OrderType | null => {\n\tif (!settings) return null;\n\n\tconst { deliveryOrderEnabled, dineInOrderEnabled, pickupOrderEnabled } = settings;\n\n\tif (deliveryOrderEnabled && isDelivering) {\n\t\treturn OrderType.DELIVERY;\n\t}\n\n\tif (dineInOrderEnabled && isOpen) {\n\t\treturn OrderType.DINE_IN;\n\t}\n\n\tif (pickupOrderEnabled && isOpen) {\n\t\treturn OrderType.PICK_UP;\n\t}\n\n\treturn null;\n};\n\nexport const getOrderErrorMessages = (field: keyof Order) => {\n\tswitch (field) {\n\t\tcase \"customer\":\n\t\t\treturn OrderErrors.ADDRESS_IS_EMPTY;\n\n\t\tcase \"tableId\":\n\t\t\treturn OrderErrors.TABLE_NOT_SELECTED;\n\n\t\tcase \"items\":\n\t\t\treturn OrderErrors.EMPTY_ITEMS;\n\n\t\tcase \"branchId\":\n\t\t\treturn OrderErrors.BRANCH_NOT_SELECTED;\n\n\t\tdefault:\n\t\t\treturn OrderErrors.FIELD_REQUIRED_ERROR;\n\t}\n};\n","export const MODALS = {\n\tADD_UPDATE_NOTES: \"ADD_UPDATE_NOTES\",\n\tAUTH: \"AUTH\",\n\tADD_UPDATE_ADDRESS: \"ADD_UPDATE_ADDRESS\",\n\tBRANCH_BUSINESS_HOURS: \"BRANCH_BUSINESS_HOURS\",\n\tPRODUCT_DETAILS: \"PRODUCT_DETAILS\",\n};\n\nexport const SUPPORTED_LOCALES = [\"en\", \"az\", \"nl\", \"et\", \"tr\", \"ru\"];\nexport const SUPPORTED_COUNTRIES = [\n\t{\n\t\tname: \"Azerbaijan\",\n\t\tcode: \"AZ\",\n\t\tphoneCode: \"+994\",\n\t},\n];\n\nexport const CO_DOMAIN = \"restaround.co\";\nexport const AZ_DOMAIN = \"restaround.az\";\nexport const EE_DOMAIN = \"restaround.ee\";\nexport const NL_DOMAIN = \"restaround.nl\";\n\nexport const DEFAULT_HOSTNAME = CO_DOMAIN;\n\nexport const DOMAINS = [CO_DOMAIN, AZ_DOMAIN, EE_DOMAIN, NL_DOMAIN]; // Supported domains list\n\nexport const IMAGE_BASE_URL = \"https://images.restaround.co\";\n","import { CO_DOMAIN, DOMAINS, IMAGE_BASE_URL } from \"./constants\";\n\ninterface ValidationResult {\n\tisValid: boolean;\n\terror?: string;\n}\n\ntype Validator = (cleanedNumber: string) => ValidationResult;\n\nconst validators: Record<string, Validator> = {\n\t\"994\": (number) => {\n\t\tconst AZERBAIJANI_PREFIXES = [\"50\", \"51\", \"10\", \"55\", \"99\", \"70\", \"77\", \"60\"];\n\t\tconst pattern = new RegExp(`^(${AZERBAIJANI_PREFIXES.join(\"|\")})\\\\d{7}$`);\n\n\t\tif (!pattern.test(number)) {\n\t\t\treturn {\n\t\t\t\tisValid: false,\n\t\t\t\terror: `Azerbaijani numbers must be 9 digits and start with ${AZERBAIJANI_PREFIXES.join(\n\t\t\t\t\t\", \"\n\t\t\t\t)}`,\n\t\t\t};\n\t\t}\n\n\t\treturn { isValid: true };\n\t},\n\n\t\"31\": (number) => {\n\t\tconst pattern = /^\\d{9}$/;\n\n\t\tif (!pattern.test(number)) {\n\t\t\treturn {\n\t\t\t\tisValid: false,\n\t\t\t\terror: \"Dutch numbers must be exactly 9 digits\",\n\t\t\t};\n\t\t}\n\n\t\treturn { isValid: true };\n\t},\n};\n\nexport function validatePhoneNumber(phoneNumber: string): ValidationResult {\n\tif (!phoneNumber) {\n\t\treturn { isValid: false, error: \"FIELD_REQUIRED\" };\n\t}\n\n\tconst cleaned = phoneNumber.replace(/\\D/g, \"\");\n\n\tconst countryCode = cleaned.startsWith(\"994\") ? \"994\" : cleaned.startsWith(\"31\") ? \"31\" : null;\n\n\tif (!countryCode) {\n\t\treturn { isValid: false, error: \"Unsupported country code\" };\n\t}\n\n\tconst nationalNumber = cleaned.slice(countryCode.length);\n\tconst validator = validators[countryCode];\n\n\treturn validator(nationalNumber);\n}\n\nexport const getBaseUrl = (hostname: string, language: string) => {\n\tconst domain = DOMAINS.includes(hostname) ? hostname : CO_DOMAIN;\n\tconst locale = language || \"en\";\n\treturn { url: `https://${domain}/${locale}`, domain };\n};\n\nexport const getTLD = (language: string) => {\n\treturn language === \"az\" ? \"az\" : \"co\";\n};\n\nexport const getRegisterUrl = (language: string, source: string) => {\n\tconst tld = getTLD(language);\n\n\treturn `https://app.restaround.${tld}/auth/register?lang=${language}&utm_source=${source}`;\n};\n\nexport const getImageSource = (image?: string) => {\n\tif (!image) return \"\";\n\n\tif (image.includes(\"base64\") || image.startsWith(\"https://\")) return image;\n\n\treturn `${IMAGE_BASE_URL}/${image}`;\n};\n\nexport const getLogoImageSource = (logoImage?: string) => {\n\tif (!logoImage) return \"https://images.restaround.co/no-photo-128.webp\";\n\n\tif (logoImage.includes(\"base64\") || logoImage.startsWith(\"https://\")) return logoImage;\n\n\treturn `${IMAGE_BASE_URL}/${logoImage}`;\n};\n\nexport const getCoverPhotoSource = (coverPhoto?: string) => {\n\tif (!coverPhoto) return \"https://images.restaround.co/restaround-doodle.webp\";\n\n\tif (coverPhoto.includes(\"base64\") || coverPhoto.startsWith(\"https://\")) return coverPhoto;\n\n\treturn `${IMAGE_BASE_URL}/${coverPhoto}`;\n};\n\nconst keyStr = \"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=\";\n\nconst triplet = (e1: number, e2: number, e3: number) =>\n\tkeyStr.charAt(e1 >> 2) +\n\tkeyStr.charAt(((e1 & 3) << 4) | (e2 >> 4)) +\n\tkeyStr.charAt(((e2 & 15) << 2) | (e3 >> 6)) +\n\tkeyStr.charAt(e3 & 63);\n\nexport const rgbDataURL = (r: number, g: number, b: number) =>\n\t`data:image/gif;base64,R0lGODlhAQABAPAA${\n\t\ttriplet(0, r, g) + triplet(b, 255, 255)\n\t}/yH5BAAAAAAALAAAAAABAAEAAAICRAEAOw==`;\n","export enum CustomerAuthStep {\n\tPHONE = \"PHONE\",\n\tOTP = \"OTP\",\n\tEMAIL = \"EMAIL\",\n}\n\nexport enum CustomerAddressType {\n\tHOME = \"HOME\",\n\tWORK = \"WORK\",\n\tTRAVEL = \"TRAVEL\",\n}\n\nexport interface CustomerAddress {\n\tid?: number;\n\taddressId?: number; // Update address temporary\n\tcountryCode: string;\n\tcityName: string;\n\tstreet: string;\n\thouseNumber: string;\n\tadditionalNumber?: string;\n\tpostCode?: string;\n\tinstructions?: string;\n\tfloor?: number;\n\tlongitude?: number;\n\tlatitude?: number;\n\ttitle?: string;\n\ttype?: CustomerAddressType;\n}\n\nexport interface CustomerAuthForm {\n\tphoneNumber: string;\n\totp: string;\n\temail: string;\n}\n\nexport interface CustomerAuthPhoneForm {\n\tcountryCode: string;\n\tphoneNumber: string;\n}\n\nexport interface AuthResponse {\n\taccessToken: string;\n\trefreshToken: string;\n}\n\nexport interface Customer {\n\tid?: number;\n\temail: string;\n\tphoneNumber: string;\n\tfullName: string;\n\tsmsVerified?: boolean;\n\temailVerified?: boolean;\n\taddress?: CustomerAddress;\n\taddresses?: CustomerAddress[];\n}\n\nexport type CustomerUpdatePayload = Partial<Customer>;\n","export enum Feature {\n\tORDER = \"feature_order\",\n}\nexport enum FeatureSegment {\n\tALPHA = \"ALPHA\",\n\tBETA = \"BETA\",\n\tALL = \"ALL\",\n}\n","import { Feature, FeatureSegment } from \"./models\";\n\nexport const FEATURES_LIST: { [key in FeatureSegment]: Feature[] } = {\n\t[FeatureSegment.ALPHA]: [],\n\t[FeatureSegment.BETA]: [],\n\t[FeatureSegment.ALL]: [Feature.ORDER],\n};\n","import { isEmpty } from \"@sorocraft/js-utils\";\nimport { Category, CategoryTranslation } from \"./models\";\n\nexport const getCategoryTranslation = (\n\tcategory: Category,\n\tlanguage: string\n): CategoryTranslation => {\n\treturn (category?.translations?.find?.((item) => item.language === language) ||\n\t\t{}) as CategoryTranslation;\n};\n\nexport const getCategoryNameById = (\n\tcategoryId: number,\n\tcategories: Category[],\n\tlanguage: string\n): string => {\n\tconst category = categories?.find?.(({ id }) => id === categoryId);\n\n\tif (isEmpty(category)) return \"\";\n\n\tconst { name } = getCategoryTranslation(category, language);\n\n\treturn name;\n};\n","import { FormErrors } from \"@sorocraft/ui\";\nimport { checkIsValidEmail } from \"@sorocraft/js-utils\";\n\nimport * as viewUtils from \"src/modules/view/utils\";\n\nimport {\n\tCustomerAddress,\n\tCustomerAuthForm,\n\tCustomerAuthPhoneForm,\n\tCustomerAuthStep,\n} from \"./models\";\n\nexport const preparePhoneNumber = (form: CustomerAuthPhoneForm) => {\n\tconst phoneNumber = `${form.countryCode}${form.phoneNumber}`.replaceAll(\"+\", \"\");\n\n\treturn phoneNumber;\n};\n\nexport const validateForm = (form: CustomerAuthForm, step: CustomerAuthStep): FormErrors => {\n\tconst errors: FormErrors = {};\n\tconst { phoneNumber, email, otp } = form || {};\n\n\tswitch (step) {\n\t\tcase CustomerAuthStep.PHONE: {\n\t\t\tconst { isValid, error } = viewUtils.validatePhoneNumber(phoneNumber);\n\t\t\tif (!isValid) errors.phoneNumber = error;\n\t\t\tbreak;\n\t\t}\n\n\t\tcase CustomerAuthStep.OTP: {\n\t\t\tconst { isValid, error } = viewUtils.validatePhoneNumber(phoneNumber);\n\t\t\tif (!isValid) errors.phoneNumber = error;\n\n\t\t\tif (!otp || otp.length !== 6) {\n\t\t\t\terrors.otp = \"Invalid OTP\";\n\t\t\t}\n\t\t\tbreak;\n\t\t}\n\n\t\tcase CustomerAuthStep.EMAIL: {\n\t\t\tif (!email || !checkIsValidEmail(email)) {\n\t\t\t\terrors.email = \"Invalid Email Address\";\n\t\t\t}\n\t\t\tbreak;\n\t\t}\n\n\t\tdefault:\n\t\t\tbreak;\n\t}\n\n\treturn errors;\n};\n\nexport const validateAddressForm = (form: CustomerAddress): FormErrors => {\n\tconst errors: FormErrors = {};\n\tconst { countryCode, cityName, street, houseNumber } = form || {};\n\n\tif (!countryCode) errors.countryCode = \"COUNTRY_REQUIRED\";\n\tif (!cityName) errors.cityName = \"CITY_REQUIRED\";\n\tif (!street) errors.street = \"STREET_REQUIRED\";\n\tif (!houseNumber) errors.houseNumber = \"STREET_NUMBER_REQUIRED\";\n\n\treturn errors;\n};\n\nexport const formatCityLine = (fields: (string | undefined)[]) => {\n\treturn (fields || []).filter(Boolean).join(\", \");\n};\n\nexport const formatAddressLine = (\n\tstreet: string,\n\thouseNumber: string,\n\tadditionalNumber: string\n) => {\n\tconst house = [houseNumber, additionalNumber].filter(Boolean).join(\"/\");\n\tconst fullAddress = [street, house].filter(Boolean).join(\" \");\n\n\treturn fullAddress;\n};\n","import { getQueryParam } from \"@sorocraft/js-utils\";\n\nimport { FeatureSegment, type Feature } from \"./models\";\n\nimport { FEATURES_LIST } from \"./constants\";\n\nexport const getIsFeatureActive = (feature: Feature, businessSegment: FeatureSegment): boolean => {\n\t// Feature is force-enabled via query param\n\tif (getQueryParam(feature) === \"1\") return true;\n\n\t// Build the list of enabled segments for the current businessSegment\n\tconst enabledSegments: FeatureSegment[] =\n\t\tbusinessSegment === FeatureSegment.ALPHA\n\t\t\t? [FeatureSegment.ALPHA, FeatureSegment.BETA, FeatureSegment.ALL]\n\t\t\t: businessSegment === FeatureSegment.BETA\n\t\t\t? [FeatureSegment.BETA, FeatureSegment.ALL]\n\t\t\t: [FeatureSegment.ALL];\n\n\t// Check if feature exists in any of the enabled segments\n\treturn enabledSegments.some((segment) => FEATURES_LIST[segment]?.includes(feature));\n};\n","import * as categoryModels from \"src/modules/category/models\";\nimport * as productModels from \"src/modules/product/models\";\n\nimport { CategoryProductMap } from \"./models\";\n\nexport const prepareCategoryAndProductMap = (\n\tcategories: categoryModels.Category[],\n\tproducts: productModels.Product[]\n): CategoryProductMap[] => {\n\tconst productMap = products.reduce<Record<number, productModels.Product[]>>((map, product) => {\n\t\tif (!product.visible) return map;\n\n\t\tconst categoryId = Number(product.categoryId);\n\t\tif (!map[categoryId]) {\n\t\t\tmap[categoryId] = [];\n\t\t}\n\t\tmap[categoryId].push(product);\n\t\treturn map;\n\t}, {});\n\n\treturn categories\n\t\t.map((category) => ({\n\t\t\t...category,\n\t\t\tproducts: (productMap[Number(category.id)] || []) as productModels.Product[],\n\t\t}))\n\t\t.filter((category) => category?.products?.length > 0);\n};\n"],"names":["getAddonOptionRawPrice","addon","optionId","_a","options","find","id","price","MenuAddonSelectType","calculateTotalPrice","quantity","vat","getProductRawPrice","product","getProductVariant","variantId","_b","variants","call","item","getSelectedOptionsTotalPrice","selectedAddons","addons","filter","Object","prototype","hasOwnProperty","reduce","total","addonId","selectType","SINGLE","selectedOptionId","multipleTotal","getProductVariantRawPrice","variant","getProductOrderRawPrice","noVat","isEmpty","optionsPrice","productData","assign","selectedOptionsTotalPrice","OrderType","OrderStatus","OrderItemStatus","PaymentMethod","OrderStep","OrderErrors","CASH","CART","DETAILS","COMPLETED","calculatSingleAddonTotalPrice","sum","option","calculateTotalAddonPrice","CO_DOMAIN","DOMAINS","IMAGE_BASE_URL","validators","number","AZERBAIJANI_PREFIXES","RegExp","join","test","isValid","error","validatePhoneNumber","phoneNumber","cleaned","replace","countryCode","startsWith","nationalNumber","slice","length","validator","getTLD","language","keyStr","triplet","e1","e2","e3","charAt","CustomerAuthStep","CustomerAddressType","Feature","FeatureSegment","FEATURES_LIST","ALPHA","BETA","ALL","ORDER","getCategoryTranslation","category","translations","productAddons","entries","map","addonIdStr","selected","Number","selectedOptionIds","Array","isArray","includes","street","houseNumber","additionalNumber","Boolean","fields","productId","Error","orderItemsId","addonIdsPart","optionIds","sortNumbers","_c","t","title","hostname","domain","url","categoryId","categories","name","coverPhoto","settings","isOpen","isDelivering","deliveryOrderEnabled","dineInOrderEnabled","pickupOrderEnabled","DELIVERY","DINE_IN","PICK_UP","image","feature","businessSegment","getQueryParam","some","segment","logoImage","currency","totalPrice","formattedTotalPrice","priceFormatter","field","ADDRESS_IS_EMPTY","TABLE_NOT_SELECTED","EMPTY_ITEMS","BRANCH_NOT_SELECTED","FIELD_REQUIRED_ERROR","orderItem","basePrice","itemNetPrice","itemTax","itemGrossPrice","totalGross","totalNet","totalTax","order","calculateItemTotal","totalWithoutTax","items","itemTotal","undefined","totalWithTax","totalWithoutTaxFormatted","totalTaxFormatted","totalWithTaxFormatted","source","status","Check","DELIVERED","BagCheck","OUT_FOR_DELIVERY","Delivery","PREPARING","Chef","CONFIRMED","FileCheck","PENDING","HourglassHalf","products","productMap","visible","push","form","replaceAll","r","g","b","errors","cityName","step","email","otp","PHONE","viewUtils.validatePhoneNumber","OTP","EMAIL","checkIsValidEmail"],"mappings":"yFAuCaA,EAAyB,CAACC,EAAkBC,WACxD,OAA+D,QAAxDC,IAACF,aAAK,EAALA,EAAOG,UAAW,IAAIC,KAAK,EAAGC,QAASA,IAAOJ,UAAS,IAAAC,OAAA,EAAAA,EAAEI,QAAS,GCxC3E,IAAYC,GAAZ,SAAYA,GACXA,EAAA,OAAA,SACAA,EAAA,SAAA,UACA,CAHD,CAAYA,IAAAA,EAAmB,CAAA,ICQxB,MAAMC,EAAsB,CAACF,EAAgB,EAAGG,EAAmB,EAAGC,EAAc,IACnFJ,EAAQG,GAAY,EAAIC,EAAM,KAWzBC,EAAqB,CACjCC,EACAH,EAAmB,KAEnB,MAAMH,MAAEA,EAAQ,EAACI,IAAEA,EAAM,GAAME,GAAW,CAAA,EAC1C,OAAOJ,EAAoBF,EAAO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eAEd,KACD,CAEA,KAAKjH,EAAiBqH,MAChBL,GAAUM,EAAAA,kBAAkBN,KAChCH,EAAOG,MAAQ,yBASlB,OAAOH"}
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../../src/modules/addon/utils.ts","../../../src/modules/addon/models.ts","../../../src/modules/product/utils.ts","../../../src/modules/order/models.ts","../../../src/modules/order/constants.ts","../../../src/modules/order/utils.ts","../../../src/modules/view/constants.ts","../../../src/modules/view/utils.ts","../../../src/modules/customer/models.ts","../../../src/modules/feature/models.ts","../../../src/modules/feature/constants.ts","../../../src/modules/category/utils.ts","../../../src/modules/customer/utils.ts","../../../src/modules/feature/utils.ts","../../../src/modules/menu/utils.ts"],"sourcesContent":["import { priceFormatter } from \"@sorocraft/js-utils\";\n\nimport {\n\tMenuAddon,\n\tMenuAddonOption,\n\tMenuAddonOptionTranslation,\n\tMenuAddonTranslation,\n} from \"./models\";\n\nexport const getAddonTranslation = (addon: MenuAddon, language: string): MenuAddonTranslation => {\n\treturn (addon?.translations?.find?.((item) => item.language === language) ||\n\t\t{}) as MenuAddonTranslation;\n};\n\nexport const getAddonOptionTranslation = (\n\toption: MenuAddonOption,\n\tlanguage: string\n): MenuAddonOptionTranslation => {\n\treturn (option?.translations?.find?.((item) => item.language === language) ||\n\t\t{}) as MenuAddonOptionTranslation;\n};\n\nexport const getOptionPrice = ({\n\toption,\n\tcurrency,\n\tlanguage,\n}: {\n\toption: MenuAddonOption;\n\tcurrency?: string;\n\tlanguage?: string;\n}) => {\n\tconst { price } = option || {};\n\n\treturn {\n\t\ttotalPrice: price,\n\t\tformattedTotalPrice: priceFormatter(price, currency || \"USD\", language || \"en\"),\n\t};\n};\n\nexport const getAddonOptionRawPrice = (addon: MenuAddon, optionId: number): number => {\n\treturn (addon?.options || []).find(({ id }) => id === optionId)?.price || 0;\n};\n\nexport const getOptionTitles = (\n\toptions: MenuAddonOption[],\n\toptionIds: number | number[],\n\tlanguage: string\n): string => {\n\tif (Array.isArray(optionIds)) {\n\t\treturn (options || [])\n\t\t\t.filter(({ id }) => optionIds.includes(id))\n\t\t\t.map(({ translations }) => translations.find((t) => t.language === language)?.title || \"\")\n\t\t\t.filter(Boolean)\n\t\t\t.join(\", \");\n\t} else {\n\t\tconst option = (options || []).find(({ id }) => id === optionIds);\n\t\treturn option?.translations.find((t) => t.language === language)?.title || \"\";\n\t}\n};\n\nexport const getAddonTitle = (addon: MenuAddon, language: string): string => {\n\treturn addon?.translations?.find?.((t) => t.language === language)?.title || \"\";\n};\n","export enum MenuAddonSelectType {\n\tSINGLE = \"SINGLE\",\n\tMULTIPLE = \"MULTIPLE\",\n}\n\nexport interface MenuAddonTranslation {\n\tid?: number;\n\ttitle: string;\n\tlanguage: string;\n}\n\nexport interface MenuAddonOptionTranslation {\n\tid?: number;\n\ttitle: string;\n\tlanguage: string;\n}\n\nexport interface MenuAddonOption {\n\tid?: number;\n\tprice: number;\n\ttranslations: MenuAddonOptionTranslation[];\n\tremove?: boolean;\n}\n\nexport interface MenuAddon {\n\tid?: number;\n\tselectType: MenuAddonSelectType;\n\ttranslations: MenuAddonTranslation[];\n\toptions: MenuAddonOption[];\n\tbusinessId?: number;\n}\n","import { isEmpty, priceFormatter } from \"@sorocraft/js-utils\";\n\nimport { Product, ProductTranslation, ProductVariant, ProductVariantTranslation } from \"./models\";\n\nimport { MenuAddon, MenuAddonSelectType } from \"src/modules/addon/models\";\nimport { getAddonOptionRawPrice } from \"src/modules/addon/utils\";\nimport * as orderModels from \"src/modules/order/models\";\n\nexport const calculateTotalPrice = (price: number = 0, quantity: number = 1, vat: number = 0) => {\n\treturn price * quantity * (1 + vat / 100);\n};\n\nexport const getProductTranslation = (\n\tproduct: Pick<Product, \"translations\">,\n\tlanguage: string\n): ProductTranslation => {\n\treturn (product?.translations?.find?.((item) => item.language === language) ||\n\t\t{}) as ProductTranslation;\n};\n\nexport const getProductRawPrice = (\n\tproduct: Pick<Product, \"price\" | \"vat\">,\n\tquantity: number = 1\n) => {\n\tconst { price = 0, vat = 0 } = product || {};\n\treturn calculateTotalPrice(price, quantity, vat);\n};\n\nexport const getProductPrice = (\n\tproduct: Pick<Product, \"price\" | \"vat\">,\n\tcurrency: string,\n\tlanguage: string,\n\tquantity: number = 1\n) => {\n\tconst totalPrice = getProductRawPrice(product, quantity);\n\n\treturn {\n\t\ttotalPrice: totalPrice,\n\t\tformattedTotalPrice: priceFormatter(totalPrice, currency, language),\n\t};\n};\n\nexport const getProductVariant = (\n\tproduct: Pick<Product, \"variants\">,\n\tvariantId: number\n): ProductVariant => {\n\treturn product?.variants?.find?.((item) => item.id === variantId) || ({} as ProductVariant);\n};\n\nexport const getSelectedOptionsTotalPrice = (\n\tproduct: Product,\n\tselectedAddons: orderModels.SelectedAddons = {},\n\tquantity: number\n): number => {\n\t// Filter addons that are selected by the user\n\tconst selectedAddonsList = (product?.addons || []).filter((addon) =>\n\t\tObject.prototype.hasOwnProperty.call(selectedAddons, addon.id)\n\t);\n\n\t// Calculate the total price\n\tconst optionsTotalPrice = selectedAddonsList.reduce((total: number, addon: MenuAddon) => {\n\t\tconst { id: addonId, selectType } = addon;\n\n\t\t// Handle SINGLE selection\n\t\tif (selectType === MenuAddonSelectType.SINGLE) {\n\t\t\tconst selectedOptionId = selectedAddons[addonId] as number;\n\t\t\treturn total + getAddonOptionRawPrice(addon, selectedOptionId);\n\t\t}\n\n\t\t// Handle MULTIPLE selection\n\t\tconst selectedOptionIds = (selectedAddons[addonId] || []) as number[];\n\t\tconst multipleOptionsPrice = selectedOptionIds.reduce(\n\t\t\t(multipleTotal, optionId) => multipleTotal + getAddonOptionRawPrice(addon, optionId),\n\t\t\t0\n\t\t);\n\n\t\treturn total + multipleOptionsPrice;\n\t}, 0);\n\n\treturn optionsTotalPrice * quantity;\n};\n\nexport const getProductVariantRawPrice = (\n\tvariantId: number,\n\tproduct: Pick<Product, \"variants\" | \"vat\">,\n\tquantity?: number\n) => {\n\tconst variant = getProductVariant(product, variantId);\n\tconst { vat } = product || {};\n\tconst { price } = variant || {};\n\treturn calculateTotalPrice(price, quantity, vat);\n};\n\nexport const getProductVariantPrice = ({\n\tvariantId,\n\tcurrency = \"USD\",\n\tlanguage = \"en\",\n\tproduct,\n\tquantity = 1,\n}: {\n\tvariantId: number;\n\tcurrency?: string;\n\tlanguage?: string;\n\tproduct: Pick<Product, \"variants\" | \"vat\">;\n\tquantity?: number;\n}) => {\n\tconst totalPrice = getProductVariantRawPrice(variantId, product, quantity);\n\n\treturn {\n\t\ttotalPrice: totalPrice,\n\t\tformattedTotalPrice: priceFormatter(totalPrice, currency, language),\n\t};\n};\n\nexport const getProductVariantTranslation = (\n\tvariant: ProductVariant,\n\tlanguage: string\n): ProductVariantTranslation => {\n\treturn (variant?.translations?.find?.((item) => item.language === language) ||\n\t\t{}) as ProductVariantTranslation;\n};\n\nexport const getProductOrderRawPrice = ({\n\tproduct,\n\tvariantId,\n\tquantity = 1,\n\tselectedAddons,\n\tnoVat = false,\n}: {\n\tproduct: Product;\n\tvariantId: number | null;\n\tquantity: number;\n\tselectedAddons: orderModels.SelectedAddons;\n\tnoVat?: boolean;\n}): { price: number; optionsPrice: number; total: number } => {\n\tif (isEmpty(product)) return { price: 0, optionsPrice: 0, total: 0 };\n\n\tconst productData: Product = { ...product, vat: noVat ? 0 : product.vat };\n\tconst selectedOptionsTotalPrice = getSelectedOptionsTotalPrice(\n\t\tproductData,\n\t\tselectedAddons,\n\t\tquantity\n\t);\n\tconst price = variantId\n\t\t? getProductVariantRawPrice(variantId, productData, quantity)\n\t\t: getProductRawPrice(productData, quantity);\n\n\treturn {\n\t\tprice,\n\t\toptionsPrice: selectedOptionsTotalPrice,\n\t\ttotal: price + selectedOptionsTotalPrice,\n\t};\n};\n\nexport const getProductOrderPrice = ({\n\tproduct,\n\tvariantId,\n\tquantity = 1,\n\tcurrency,\n\tlanguage,\n\tselectedAddons,\n\tnoVat = false,\n}: {\n\tproduct: Product;\n\tvariantId: number | null;\n\tquantity: number;\n\tcurrency: string;\n\tlanguage: string;\n\tselectedAddons: orderModels.SelectedAddons;\n\tnoVat?: boolean;\n}) => {\n\tconst { total } = getProductOrderRawPrice({\n\t\tproduct,\n\t\tvariantId,\n\t\tquantity,\n\t\tselectedAddons,\n\t\tnoVat,\n\t});\n\n\treturn {\n\t\ttotalPrice: total,\n\t\tformattedTotalPrice: priceFormatter(total, currency, language),\n\t};\n};\n\nexport const getProductAddon = (product: Product, addonId: number): MenuAddon => {\n\treturn (product?.addons || []).find(({ id }) => id === addonId) || ({} as MenuAddon);\n};\n","import * as customerModels from \"../customer/models\";\n\nexport enum OrderType {\n\tDINE_IN = \"DINE_IN\",\n\tPICK_UP = \"PICK_UP\",\n\tDELIVERY = \"DELIVERY\",\n}\n\nexport enum OrderStatus {\n\tDRAFT = \"DRAFT\",\n\tPENDING = \"PENDING\",\n\tCONFIRMED = \"CONFIRMED\",\n\tPREPARING = \"PREPARING\",\n\tREADY = \"READY\",\n\tOUT_FOR_DELIVERY = \"OUT_FOR_DELIVERY\",\n\tDELIVERED = \"DELIVERED\",\n\tCOMPLETED = \"COMPLETED\",\n\tCANCELLED = \"CANCELLED\",\n\tFAILED = \"FAILED\",\n}\n\nexport enum OrderItemStatus {\n\tPENDING = \"PENDING\",\n\tPREPARING = \"PREPARING\",\n\tREADY = \"READY\",\n\tSERVED = \"SERVED\",\n}\n\nexport enum PaymentMethod {\n\tCASH = \"CASH\",\n\tCARD = \"CARD\",\n\tWALLET = \"WALLET\",\n\tTERMINAL = \"TERMINAL\",\n}\n\nexport interface OrderAddonOption {\n\toptionId: number;\n\tprice: number;\n}\n\nexport interface OrderAddon {\n\tid?: number;\n\taddonId: number;\n\toptions: OrderAddonOption[];\n}\n\nexport interface SelectedAddons {\n\t[key: number]: number | number[];\n}\n\nexport interface OrderItemVariant {\n\tid?: number;\n\tvariantId: number;\n\tprice: number;\n}\n\nexport interface OrderItem {\n\tid?: number;\n\tproductId: number;\n\torderId?: number;\n\tquantity: number;\n\tprice: number;\n\tvariant?: OrderItemVariant;\n\taddons: OrderAddon[];\n\tnote?: string;\n\tstatus?: OrderItemStatus;\n\tvat?: number;\n\tisPaid?: boolean;\n}\n\nexport interface Order {\n\tid?: number;\n\tbusinessId?: number;\n\tbranchId?: number;\n\tworkingDayId?: number;\n\ttableId?: number;\n\temployeeId?: number;\n\torderType: OrderType;\n\ttotalPriceWithTax: number;\n\ttotalPriceWithTaxAndFees?: number;\n\ttotalPriceWithoutTax: number;\n\ttotalTax: number;\n\titems: OrderItem[];\n\tstatus?: OrderStatus;\n\tvat?: number;\n\tpaymentMethod?: PaymentMethod;\n\tnote?: string;\n\tcreatedAt?: number;\n\tupdatedAt?: number;\n\tcustomer?: customerModels.Customer;\n\tdeliveryFee?: number;\n}\n\nexport interface OrderItems {\n\t[key: string]: OrderItem;\n}\n\nexport enum OrderStep {\n\tCART = \"CART\",\n\tDETAILS = \"DETAILS\",\n\tCOMPLETED = \"COMPLETED\",\n}\n\nexport interface OrderPayload extends Order {\n\tcustomerAddressId: number;\n\tcustomerId: number;\n}\n\nexport type OrderPriceDetails = {\n\ttotalPriceWithTax: number;\n\ttotalPriceWithTaxAndFees: number;\n\ttotalPriceWithoutTax: number;\n\ttotalTax: number;\n};\n\nexport type OrderFormattedPriceDetails = {\n\ttotalPriceWithTax: string;\n\ttotalPriceWithTaxAndFees: string;\n\ttotalPriceWithoutTax: string;\n\ttotalTax: string;\n};\n","import { OrderStep, PaymentMethod } from \"./models\";\n\nexport const initialOrder = {\n\torderType: null,\n\ttotalPriceWithTax: 0,\n\ttotalPriceWithoutTax: 0,\n\ttotalTax: 0,\n\tvat: 0,\n\tpaymentMethod: PaymentMethod.CASH,\n};\n\nexport const ORDER_STEPS = [OrderStep.CART, OrderStep.DETAILS, OrderStep.COMPLETED];\n\nexport enum OrderErrors {\n\tFIELD_REQUIRED_ERROR = \"This field is required\",\n\tTABLE_NOT_SELECTED = \"Please select a table\",\n\tADDRESS_IS_EMPTY = \"Please enter an address\",\n\tEMPTY_ITEMS = \"Please choose product\",\n\tBRANCH_NOT_SELECTED = \"Please select a branch\",\n}\n","import { isEmpty, priceFormatter, sortNumbers } from \"@sorocraft/js-utils\";\nimport { IconType } from \"@sorocraft/ui\";\nimport { Check, BagCheck, Delivery, Chef, FileCheck, HourglassHalf } from \"@sorocraft/ui/icons\";\n\nimport {\n\tOrder,\n\tOrderAddon,\n\tOrderAddonOption,\n\tOrderItem,\n\tOrderStatus,\n\tOrderType,\n\tSelectedAddons,\n} from \"./models\";\n\nimport * as addonModels from \"../addon/models\";\nimport * as branchModels from \"../branch/models\";\nimport { OrderErrors } from \"./constants\";\n\nexport const calculatSingleAddonTotalPrice = (addon: OrderAddon) => {\n\treturn addon.options.reduce((sum, option) => sum + option.price, 0);\n};\n\nexport function calculateTotalAddonPrice(addons: OrderAddon[] = [], quantity: number = 1): number {\n\tconst totalAddonsPriceForSingleItem = addons.reduce((total, addon) => {\n\t\tconst addonTotal = calculatSingleAddonTotalPrice(addon);\n\t\treturn total + addonTotal;\n\t}, 0);\n\n\treturn quantity * totalAddonsPriceForSingleItem;\n}\n\nexport const getOrderPrice = (order: Order, currency: string, language: string) => {\n\tconst calculateItemTotal = (price: number, quantity: number, addons: OrderAddon[]) => {\n\t\treturn quantity * price + calculateTotalAddonPrice(addons, quantity);\n\t};\n\n\tlet totalWithoutTax = 0;\n\tlet totalTax = 0;\n\n\tfor (const item of order.items) {\n\t\tconst itemTotal = calculateItemTotal(item.price, item.quantity, item.addons);\n\t\ttotalWithoutTax += itemTotal;\n\n\t\tif (order.vat === undefined && item.vat) {\n\t\t\ttotalTax += (itemTotal * item.vat) / 100;\n\t\t}\n\t}\n\n\tif (order.vat !== undefined) {\n\t\ttotalTax = (totalWithoutTax * order.vat) / 100;\n\t}\n\n\tconst totalWithTax = totalWithoutTax + totalTax;\n\n\treturn {\n\t\ttotalWithoutTax,\n\t\ttotalWithoutTaxFormatted: priceFormatter(totalWithoutTax, currency, language),\n\t\ttotalTax,\n\t\ttotalTaxFormatted: priceFormatter(totalTax, currency, language),\n\t\ttotalWithTax,\n\t\ttotalWithTaxFormatted: priceFormatter(totalWithTax, currency, language),\n\t};\n};\n\nexport const generateOrderItemsId = (\n\tproductId: number,\n\tvariantId: number | null,\n\tselectedAddons?: SelectedAddons\n): string => {\n\tif (!productId) throw new Error(\"Product ID is required\");\n\n\t// Build the order items ID base with productId and variantId\n\tlet orderItemsId = `${productId}`;\n\tif (variantId) {\n\t\torderItemsId += `-${variantId}`;\n\t}\n\n\t// Build the addon part of the ID\n\tconst addonIdsPart = Object.entries(selectedAddons || {})\n\t\t.map(([addonId, option]) => {\n\t\t\tif (!addonId || !option) return null; // Skip invalid entries\n\t\t\tconst optionIds = Array.isArray(option)\n\t\t\t\t? sortNumbers(option).filter(Boolean).join(\"-\")\n\t\t\t\t: `${option}`;\n\t\t\tif (!optionIds) return null;\n\t\t\treturn `${addonId}-${optionIds}`;\n\t\t})\n\t\t.filter(Boolean) // Remove null/undefined values\n\t\t.join(\"-\");\n\n\t// Append addonIdsPart if it's not empty\n\tif (addonIdsPart) {\n\t\torderItemsId += `-${addonIdsPart}`;\n\t}\n\n\treturn orderItemsId;\n};\n\nexport const getOrderItemPrice = (orderItem: OrderItem) => {\n\tconst { price, variant, addons, quantity, vat } = orderItem || {};\n\tconst basePrice = variant?.price ?? price;\n\tconst addonsPrice = calculateTotalAddonPrice(addons, 1); // single item's addon price\n\n\tconst itemNetPrice = basePrice + addonsPrice;\n\t// Currently VAT is applied only on basePrice, not on addons\n\t// TODO: Re-evaluate for European market where tax may apply to addons too\n\tconst itemTax = basePrice * (vat / 100);\n\tconst itemGrossPrice = itemNetPrice + itemTax;\n\n\tconst totalNet = itemNetPrice * quantity;\n\tconst totalTax = itemTax * quantity;\n\tconst totalGross = itemGrossPrice * quantity;\n\n\treturn {\n\t\ttotalGross,\n\t\ttotalNet,\n\t\ttotalTax,\n\t\titemGrossPrice,\n\t\titemNetPrice,\n\t\titemTax,\n\t};\n};\n\nexport const getSelectedAddonsFromOrderItems = (item: OrderItem): SelectedAddons => {\n\tconst selectedAddons: SelectedAddons = {};\n\n\tfor (const { addonId, options = [] } of item.addons || []) {\n\t\tconst optionIds = options.map(({ optionId }) => optionId);\n\t\tselectedAddons[addonId] = optionIds.length === 1 ? optionIds[0] : optionIds;\n\t}\n\n\treturn selectedAddons;\n};\n\nexport const getStatusIcon = (status: OrderStatus): IconType => {\n\tswitch (status) {\n\t\tcase OrderStatus.COMPLETED:\n\t\t\treturn Check;\n\t\tcase OrderStatus.DELIVERED:\n\t\t\treturn BagCheck;\n\t\tcase OrderStatus.OUT_FOR_DELIVERY:\n\t\t\treturn Delivery;\n\t\tcase OrderStatus.PREPARING:\n\t\t\treturn Chef;\n\t\tcase OrderStatus.CONFIRMED:\n\t\t\treturn FileCheck;\n\t\tcase OrderStatus.PENDING:\n\t\t\treturn HourglassHalf;\n\n\t\tdefault:\n\t\t\treturn HourglassHalf;\n\t}\n};\n\nexport const buildSelectedAddonsPayload = (\n\tproductAddons: addonModels.MenuAddon[] = [],\n\tselectedAddons: SelectedAddons = {}\n): OrderAddon[] => {\n\treturn Object.entries(selectedAddons).map(([addonIdStr, selected]) => {\n\t\tconst addonId = Number(addonIdStr);\n\t\tconst selectedOptionIds = Array.isArray(selected) ? selected : [selected];\n\n\t\tconst addon = productAddons.find((addon) => addon.id === addonId);\n\t\tif (isEmpty(addon)) {\n\t\t\treturn {\n\t\t\t\taddonId,\n\t\t\t\toptions: [],\n\t\t\t};\n\t\t}\n\n\t\tconst options: OrderAddonOption[] = (addon.options || [])\n\t\t\t.filter((option) => selectedOptionIds.includes(option.id))\n\t\t\t.map((option) => ({\n\t\t\t\toptionId: option.id,\n\t\t\t\tprice: option.price,\n\t\t\t}));\n\n\t\treturn {\n\t\t\taddonId,\n\t\t\toptions,\n\t\t};\n\t});\n};\n\nexport const getDefaultOrderType = (\n\tsettings: branchModels.BranchSettings,\n\tisOpen: boolean,\n\tisDelivering: boolean\n): OrderType | null => {\n\tif (!settings) return null;\n\n\tconst { deliveryOrderEnabled, dineInOrderEnabled, pickupOrderEnabled } = settings;\n\n\tif (deliveryOrderEnabled && isDelivering) {\n\t\treturn OrderType.DELIVERY;\n\t}\n\n\tif (dineInOrderEnabled && isOpen) {\n\t\treturn OrderType.DINE_IN;\n\t}\n\n\tif (pickupOrderEnabled && isOpen) {\n\t\treturn OrderType.PICK_UP;\n\t}\n\n\treturn null;\n};\n\nexport const getOrderErrorMessages = (field: keyof Order) => {\n\tswitch (field) {\n\t\tcase \"customer\":\n\t\t\treturn OrderErrors.ADDRESS_IS_EMPTY;\n\n\t\tcase \"tableId\":\n\t\t\treturn OrderErrors.TABLE_NOT_SELECTED;\n\n\t\tcase \"items\":\n\t\t\treturn OrderErrors.EMPTY_ITEMS;\n\n\t\tcase \"branchId\":\n\t\t\treturn OrderErrors.BRANCH_NOT_SELECTED;\n\n\t\tdefault:\n\t\t\treturn OrderErrors.FIELD_REQUIRED_ERROR;\n\t}\n};\n","export const MODALS = {\n\tADD_UPDATE_NOTES: \"ADD_UPDATE_NOTES\",\n\tAUTH: \"AUTH\",\n\tADD_UPDATE_ADDRESS: \"ADD_UPDATE_ADDRESS\",\n\tBRANCH_BUSINESS_HOURS: \"BRANCH_BUSINESS_HOURS\",\n\tPRODUCT_DETAILS: \"PRODUCT_DETAILS\",\n};\n\nexport const SUPPORTED_LOCALES = [\"en\", \"az\", \"nl\", \"et\", \"tr\", \"ru\"];\nexport const SUPPORTED_COUNTRIES = [\n\t{\n\t\tname: \"Azerbaijan\",\n\t\tcode: \"AZ\",\n\t\tphoneCode: \"+994\",\n\t},\n];\n\nexport const CO_DOMAIN = \"restaround.co\";\nexport const AZ_DOMAIN = \"restaround.az\";\nexport const EE_DOMAIN = \"restaround.ee\";\nexport const NL_DOMAIN = \"restaround.nl\";\n\nexport const DEFAULT_HOSTNAME = CO_DOMAIN;\n\nexport const DOMAINS = [CO_DOMAIN, AZ_DOMAIN, EE_DOMAIN, NL_DOMAIN]; // Supported domains list\n\nexport const IMAGE_BASE_URL = \"https://images.restaround.co\";\n","import { CO_DOMAIN, DOMAINS, IMAGE_BASE_URL } from \"./constants\";\n\ninterface ValidationResult {\n\tisValid: boolean;\n\terror?: string;\n}\n\ntype Validator = (cleanedNumber: string) => ValidationResult;\n\nconst validators: Record<string, Validator> = {\n\t\"994\": (number) => {\n\t\tconst AZERBAIJANI_PREFIXES = [\"50\", \"51\", \"10\", \"55\", \"99\", \"70\", \"77\", \"60\"];\n\t\tconst pattern = new RegExp(`^(${AZERBAIJANI_PREFIXES.join(\"|\")})\\\\d{7}$`);\n\n\t\tif (!pattern.test(number)) {\n\t\t\treturn {\n\t\t\t\tisValid: false,\n\t\t\t\terror: `Azerbaijani numbers must be 9 digits and start with ${AZERBAIJANI_PREFIXES.join(\n\t\t\t\t\t\", \"\n\t\t\t\t)}`,\n\t\t\t};\n\t\t}\n\n\t\treturn { isValid: true };\n\t},\n\n\t\"31\": (number) => {\n\t\tconst pattern = /^\\d{9}$/;\n\n\t\tif (!pattern.test(number)) {\n\t\t\treturn {\n\t\t\t\tisValid: false,\n\t\t\t\terror: \"Dutch numbers must be exactly 9 digits\",\n\t\t\t};\n\t\t}\n\n\t\treturn { isValid: true };\n\t},\n};\n\nexport function validatePhoneNumber(phoneNumber: string): ValidationResult {\n\tif (!phoneNumber) {\n\t\treturn { isValid: false, error: \"FIELD_REQUIRED\" };\n\t}\n\n\tconst cleaned = phoneNumber.replace(/\\D/g, \"\");\n\n\tconst countryCode = cleaned.startsWith(\"994\") ? \"994\" : cleaned.startsWith(\"31\") ? \"31\" : null;\n\n\tif (!countryCode) {\n\t\treturn { isValid: false, error: \"Unsupported country code\" };\n\t}\n\n\tconst nationalNumber = cleaned.slice(countryCode.length);\n\tconst validator = validators[countryCode];\n\n\treturn validator(nationalNumber);\n}\n\nexport const getBaseUrl = (hostname: string, language: string) => {\n\tconst domain = DOMAINS.includes(hostname) ? hostname : CO_DOMAIN;\n\tconst locale = language || \"en\";\n\treturn { url: `https://${domain}/${locale}`, domain };\n};\n\nexport const getTLD = (language: string) => {\n\treturn language === \"az\" ? \"az\" : \"co\";\n};\n\nexport const getRegisterUrl = (language: string, source: string) => {\n\tconst tld = getTLD(language);\n\n\treturn `https://app.restaround.${tld}/auth/register?lang=${language}&utm_source=${source}`;\n};\n\nexport const getImageSource = (image?: string) => {\n\tif (!image) return \"\";\n\n\tif (image.includes(\"base64\") || image.startsWith(\"https://\")) return image;\n\n\treturn `${IMAGE_BASE_URL}/${image}`;\n};\n\nexport const getLogoImageSource = (logoImage?: string) => {\n\tif (!logoImage) return \"https://images.restaround.co/no-photo-128.webp\";\n\n\tif (logoImage.includes(\"base64\") || logoImage.startsWith(\"https://\")) return logoImage;\n\n\treturn `${IMAGE_BASE_URL}/${logoImage}`;\n};\n\nexport const getCoverPhotoSource = (coverPhoto?: string) => {\n\tif (!coverPhoto) return \"https://images.restaround.co/restaround-doodle.webp\";\n\n\tif (coverPhoto.includes(\"base64\") || coverPhoto.startsWith(\"https://\")) return coverPhoto;\n\n\treturn `${IMAGE_BASE_URL}/${coverPhoto}`;\n};\n\nconst keyStr = \"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=\";\n\nconst triplet = (e1: number, e2: number, e3: number) =>\n\tkeyStr.charAt(e1 >> 2) +\n\tkeyStr.charAt(((e1 & 3) << 4) | (e2 >> 4)) +\n\tkeyStr.charAt(((e2 & 15) << 2) | (e3 >> 6)) +\n\tkeyStr.charAt(e3 & 63);\n\nexport const rgbDataURL = (r: number, g: number, b: number) =>\n\t`data:image/gif;base64,R0lGODlhAQABAPAA${\n\t\ttriplet(0, r, g) + triplet(b, 255, 255)\n\t}/yH5BAAAAAAALAAAAAABAAEAAAICRAEAOw==`;\n","export enum CustomerAuthStep {\n\tPHONE = \"PHONE\",\n\tOTP = \"OTP\",\n\tEMAIL = \"EMAIL\",\n}\n\nexport enum CustomerAddressType {\n\tHOME = \"HOME\",\n\tWORK = \"WORK\",\n\tTRAVEL = \"TRAVEL\",\n}\n\nexport interface CustomerAddress {\n\tid?: number;\n\taddressId?: number; // Update address temporary\n\tcountryCode: string;\n\tcityName: string;\n\tstreet: string;\n\thouseNumber: string;\n\tadditionalNumber?: string;\n\tpostCode?: string;\n\tinstructions?: string;\n\tfloor?: number;\n\tlongitude?: number;\n\tlatitude?: number;\n\ttitle?: string;\n\ttype?: CustomerAddressType;\n}\n\nexport interface CustomerAuthForm {\n\tphoneNumber: string;\n\totp: string;\n\temail: string;\n}\n\nexport interface CustomerAuthPhoneForm {\n\tcountryCode: string;\n\tphoneNumber: string;\n}\n\nexport interface AuthResponse {\n\taccessToken: string;\n\trefreshToken: string;\n}\n\nexport interface Customer {\n\tid?: number;\n\temail: string;\n\tphoneNumber: string;\n\tfullName: string;\n\tsmsVerified?: boolean;\n\temailVerified?: boolean;\n\taddress?: CustomerAddress;\n\taddresses?: CustomerAddress[];\n}\n\nexport type CustomerUpdatePayload = Partial<Customer>;\n","export enum Feature {\n\tORDER = \"feature_order\",\n}\nexport enum FeatureSegment {\n\tALPHA = \"ALPHA\",\n\tBETA = \"BETA\",\n\tALL = \"ALL\",\n}\n","import { Feature, FeatureSegment } from \"./models\";\n\nexport const FEATURES_LIST: { [key in FeatureSegment]: Feature[] } = {\n\t[FeatureSegment.ALPHA]: [],\n\t[FeatureSegment.BETA]: [],\n\t[FeatureSegment.ALL]: [Feature.ORDER],\n};\n","import { isEmpty } from \"@sorocraft/js-utils\";\nimport { Category, CategoryTranslation } from \"./models\";\n\nexport const getCategoryTranslation = (\n\tcategory: Category,\n\tlanguage: string\n): CategoryTranslation => {\n\treturn (category?.translations?.find?.((item) => item.language === language) ||\n\t\t{}) as CategoryTranslation;\n};\n\nexport const getCategoryNameById = (\n\tcategoryId: number,\n\tcategories: Category[],\n\tlanguage: string\n): string => {\n\tconst category = categories?.find?.(({ id }) => id === categoryId);\n\n\tif (isEmpty(category)) return \"\";\n\n\tconst { name } = getCategoryTranslation(category, language);\n\n\treturn name || \"\";\n};\n","import { FormErrors } from \"@sorocraft/ui\";\nimport { checkIsValidEmail } from \"@sorocraft/js-utils\";\n\nimport * as viewUtils from \"src/modules/view/utils\";\n\nimport {\n\tCustomerAddress,\n\tCustomerAuthForm,\n\tCustomerAuthPhoneForm,\n\tCustomerAuthStep,\n} from \"./models\";\n\nexport const preparePhoneNumber = (form: CustomerAuthPhoneForm) => {\n\tconst phoneNumber = `${form.countryCode}${form.phoneNumber}`.replaceAll(\"+\", \"\");\n\n\treturn phoneNumber;\n};\n\nexport const validateForm = (form: CustomerAuthForm, step: CustomerAuthStep): FormErrors => {\n\tconst errors: FormErrors = {};\n\tconst { phoneNumber, email, otp } = form || {};\n\n\tswitch (step) {\n\t\tcase CustomerAuthStep.PHONE: {\n\t\t\tconst { isValid, error } = viewUtils.validatePhoneNumber(phoneNumber);\n\t\t\tif (!isValid) errors.phoneNumber = error;\n\t\t\tbreak;\n\t\t}\n\n\t\tcase CustomerAuthStep.OTP: {\n\t\t\tconst { isValid, error } = viewUtils.validatePhoneNumber(phoneNumber);\n\t\t\tif (!isValid) errors.phoneNumber = error;\n\n\t\t\tif (!otp || otp.length !== 6) {\n\t\t\t\terrors.otp = \"Invalid OTP\";\n\t\t\t}\n\t\t\tbreak;\n\t\t}\n\n\t\tcase CustomerAuthStep.EMAIL: {\n\t\t\tif (!email || !checkIsValidEmail(email)) {\n\t\t\t\terrors.email = \"Invalid Email Address\";\n\t\t\t}\n\t\t\tbreak;\n\t\t}\n\n\t\tdefault:\n\t\t\tbreak;\n\t}\n\n\treturn errors;\n};\n\nexport const validateAddressForm = (form: CustomerAddress): FormErrors => {\n\tconst errors: FormErrors = {};\n\tconst { countryCode, cityName, street, houseNumber } = form || {};\n\n\tif (!countryCode) errors.countryCode = \"COUNTRY_REQUIRED\";\n\tif (!cityName) errors.cityName = \"CITY_REQUIRED\";\n\tif (!street) errors.street = \"STREET_REQUIRED\";\n\tif (!houseNumber) errors.houseNumber = \"STREET_NUMBER_REQUIRED\";\n\n\treturn errors;\n};\n\nexport const formatCityLine = (fields: (string | undefined)[]) => {\n\treturn (fields || []).filter(Boolean).join(\", \");\n};\n\nexport const formatAddressLine = (\n\tstreet: string,\n\thouseNumber: string,\n\tadditionalNumber: string\n) => {\n\tconst house = [houseNumber, additionalNumber].filter(Boolean).join(\"/\");\n\tconst fullAddress = [street, house].filter(Boolean).join(\" \");\n\n\treturn fullAddress;\n};\n","import { getQueryParam } from \"@sorocraft/js-utils\";\n\nimport { FeatureSegment, type Feature } from \"./models\";\n\nimport { FEATURES_LIST } from \"./constants\";\n\nexport const getIsFeatureActive = (feature: Feature, businessSegment: FeatureSegment): boolean => {\n\t// Feature is force-enabled via query param\n\tif (getQueryParam(feature) === \"1\") return true;\n\n\t// Build the list of enabled segments for the current businessSegment\n\tconst enabledSegments: FeatureSegment[] =\n\t\tbusinessSegment === FeatureSegment.ALPHA\n\t\t\t? [FeatureSegment.ALPHA, FeatureSegment.BETA, FeatureSegment.ALL]\n\t\t\t: businessSegment === FeatureSegment.BETA\n\t\t\t? [FeatureSegment.BETA, FeatureSegment.ALL]\n\t\t\t: [FeatureSegment.ALL];\n\n\t// Check if feature exists in any of the enabled segments\n\treturn enabledSegments.some((segment) => FEATURES_LIST[segment]?.includes(feature));\n};\n","import * as categoryModels from \"src/modules/category/models\";\nimport * as productModels from \"src/modules/product/models\";\n\nimport { CategoryProductMap } from \"./models\";\n\nexport const prepareCategoryAndProductMap = (\n\tcategories: categoryModels.Category[],\n\tproducts: productModels.Product[]\n): CategoryProductMap[] => {\n\tconst productMap = products.reduce<Record<number, productModels.Product[]>>((map, product) => {\n\t\tif (!product.visible) return map;\n\n\t\tconst categoryId = Number(product.categoryId);\n\t\tif (!map[categoryId]) {\n\t\t\tmap[categoryId] = [];\n\t\t}\n\t\tmap[categoryId].push(product);\n\t\treturn map;\n\t}, {});\n\n\treturn categories\n\t\t.map((category) => ({\n\t\t\t...category,\n\t\t\tproducts: (productMap[Number(category.id)] || []) as productModels.Product[],\n\t\t}))\n\t\t.filter((category) => category?.products?.length > 0);\n};\n"],"names":["getAddonOptionRawPrice","addon","optionId","_a","options","find","id","price","MenuAddonSelectType","calculateTotalPrice","quantity","vat","getProductRawPrice","product","getProductVariant","variantId","_b","variants","call","item","getSelectedOptionsTotalPrice","selectedAddons","addons","filter","Object","prototype","hasOwnProperty","reduce","total","addonId","selectType","SINGLE","selectedOptionId","multipleTotal","getProductVariantRawPrice","variant","getProductOrderRawPrice","noVat","isEmpty","optionsPrice","productData","assign","selectedOptionsTotalPrice","OrderType","OrderStatus","OrderItemStatus","PaymentMethod","OrderStep","OrderErrors","CASH","CART","DETAILS","COMPLETED","calculatSingleAddonTotalPrice","sum","option","calculateTotalAddonPrice","CO_DOMAIN","DOMAINS","IMAGE_BASE_URL","validators","number","AZERBAIJANI_PREFIXES","RegExp","join","test","isValid","error","validatePhoneNumber","phoneNumber","cleaned","replace","countryCode","startsWith","nationalNumber","slice","length","validator","getTLD","language","keyStr","triplet","e1","e2","e3","charAt","CustomerAuthStep","CustomerAddressType","Feature","FeatureSegment","FEATURES_LIST","ALPHA","BETA","ALL","ORDER","getCategoryTranslation","category","translations","productAddons","entries","map","addonIdStr","selected","Number","selectedOptionIds","Array","isArray","includes","street","houseNumber","additionalNumber","Boolean","fields","productId","Error","orderItemsId","addonIdsPart","optionIds","sortNumbers","_c","t","title","hostname","domain","url","categoryId","categories","name","coverPhoto","settings","isOpen","isDelivering","deliveryOrderEnabled","dineInOrderEnabled","pickupOrderEnabled","DELIVERY","DINE_IN","PICK_UP","image","feature","businessSegment","getQueryParam","some","segment","logoImage","currency","totalPrice","formattedTotalPrice","priceFormatter","field","ADDRESS_IS_EMPTY","TABLE_NOT_SELECTED","EMPTY_ITEMS","BRANCH_NOT_SELECTED","FIELD_REQUIRED_ERROR","orderItem","basePrice","itemNetPrice","itemTax","itemGrossPrice","totalGross","totalNet","totalTax","order","calculateItemTotal","totalWithoutTax","items","itemTotal","undefined","totalWithTax","totalWithoutTaxFormatted","totalTaxFormatted","totalWithTaxFormatted","source","status","Check","DELIVERED","BagCheck","OUT_FOR_DELIVERY","Delivery","PREPARING","Chef","CONFIRMED","FileCheck","PENDING","HourglassHalf","products","productMap","visible","push","form","replaceAll","r","g","b","errors","cityName","step","email","otp","PHONE","viewUtils.validatePhoneNumber","OTP","EMAIL","checkIsValidEmail"],"mappings":"yFAuCaA,EAAyB,CAACC,EAAkBC,WACxD,OAA+D,QAAxDC,IAACF,aAAK,EAALA,EAAOG,UAAW,IAAIC,KAAK,EAAGC,QAASA,IAAOJ,UAAS,IAAAC,OAAA,EAAAA,EAAEI,QAAS,GCxC3E,IAAYC,GAAZ,SAAYA,GACXA,EAAA,OAAA,SACAA,EAAA,SAAA,UACA,CAHD,CAAYA,IAAAA,EAAmB,CAAA,ICQxB,MAAMC,EAAsB,CAACF,EAAgB,EAAGG,EAAmB,EAAGC,EAAc,IACnFJ,EAAQG,GAAY,EAAIC,EAAM,KAWzBC,EAAqB,CACjCC,EACAH,EAAmB,KAEnB,MAAMH,MAAEA,EAAQ,EAACI,IAAEA,EAAM,GAAME,GAAW,CAAA,EAC1C,OAAOJ,EAAoBF,EAAOG,EAAUC,IAiBhCG,EAAoB,CAChCD,EACAE,aAEA,OAA8B,QAAvBC,EAAiB,QAAjBb,EAAAU,aAAO,EAAPA,EAASI,gBAAQ,IAAAd,OAAA,EAAAA,EAAEE,YAAI,IAAAW,OAAA,EAAAA,EAAAE,KAAAf,EAAIgB,GAASA,EAAKb,KAAOS,KAAe,CAAA,GAG1DK,EAA+B,CAC3CP,EACAQ,EAA6C,CAAA,EAC7CX,MAG4BG,aAAO,EAAPA,EAASS,SAAU,IAAIC,OAAQtB,GAC1DuB,OAAOC,UAAUC,eAAeR,KAAKG,EAAgBpB,EAAMK,KAIfqB,OAAO,CAACC,EAAe3B,KACnE,MAAQK,GAAIuB,EAAOC,WAAEA,GAAe7B,EAGpC,GAAI6B,IAAetB,EAAoBuB,OAAQ,CAC9C,MAAMC,EAAmBX,EAAeQ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