@dropins/storefront-quote-management 0.0.1-alpha23 → 0.0.1-alpha24
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/api/index.d.ts +1 -0
- package/api/initialize/initialize.d.ts +1 -0
- package/api/removeNegotiableQuoteItems/graphql/RemoveNegotiableQuoteItemsMutation.d.ts +10 -0
- package/api/removeNegotiableQuoteItems/index.d.ts +10 -0
- package/api/removeNegotiableQuoteItems/removeNegotiableQuoteItems.d.ts +8 -0
- package/api.js +15 -15
- package/api.js.map +1 -1
- package/chunks/ItemsQuoted.js +1 -1
- package/chunks/ItemsQuoted.js.map +1 -1
- package/chunks/ItemsQuotedTemplate.js +4 -0
- package/chunks/ItemsQuotedTemplate.js.map +1 -0
- package/chunks/OrderSummaryLine.js +1 -1
- package/chunks/OrderSummaryLine.js.map +1 -1
- package/chunks/QuoteCommentsList.js +1 -1
- package/chunks/QuoteCommentsList.js.map +1 -1
- package/chunks/QuoteCommentsList3.js +4 -0
- package/chunks/QuoteCommentsList3.js.map +1 -0
- package/chunks/QuoteHistoryLog.js +1 -1
- package/chunks/QuoteHistoryLog.js.map +1 -1
- package/chunks/QuoteHistoryLog3.js +4 -0
- package/chunks/QuoteHistoryLog3.js.map +1 -0
- package/chunks/QuotePricesSummary.js +4 -0
- package/chunks/QuotePricesSummary.js.map +1 -0
- package/chunks/QuoteTemplateCommentsList.js +4 -0
- package/chunks/QuoteTemplateCommentsList.js.map +1 -0
- package/chunks/QuoteTemplateHistoryLog.js +4 -0
- package/chunks/QuoteTemplateHistoryLog.js.map +1 -0
- package/chunks/TabbedContent.js +4 -0
- package/chunks/TabbedContent.js.map +1 -0
- package/chunks/dateUtils.js +1 -1
- package/chunks/getQuoteTemplates.js +2 -2
- package/chunks/getQuoteTemplates.js.map +1 -1
- package/chunks/negotiableQuotes.js +1 -1
- package/chunks/negotiableQuotes.js.map +1 -1
- package/chunks/removeNegotiableQuoteItems.js +38 -0
- package/chunks/removeNegotiableQuoteItems.js.map +1 -0
- package/chunks/renameNegotiableQuote.js +1 -1
- package/chunks/renameNegotiableQuote.js.map +1 -1
- package/chunks/state.js +1 -1
- package/chunks/transform-quote.js +4 -0
- package/chunks/transform-quote.js.map +1 -0
- package/chunks/uploadFile.js +1 -1
- package/chunks/uploadFile.js.map +1 -1
- package/components/ActionsBar/ActionsBar.d.ts +1 -0
- package/components/ConfirmationModal/ConfirmationModal.d.ts +1 -0
- package/components/ManageNegotiableQuoteTemplate/ManageNegotiableQuoteTemplate.d.ts +22 -0
- package/components/ManageNegotiableQuoteTemplate/__fixtures__/ManageNegotiableQuoteTemplateProps.d.ts +4 -0
- package/components/ManageNegotiableQuoteTemplate/index.d.ts +11 -0
- package/components/ProductListTable/ProductListTable.d.ts +43 -5
- package/components/QuoteHistoryLog/QuoteHistoryLog.d.ts +70 -2
- package/components/index.d.ts +1 -0
- package/containers/ItemsQuoted/ItemsQuoted.d.ts +5 -0
- package/containers/ItemsQuoted.js +1 -1
- package/containers/ItemsQuotedTemplate/ItemsQuotedTemplate.d.ts +19 -0
- package/containers/ItemsQuotedTemplate/index.d.ts +11 -0
- package/containers/ItemsQuotedTemplate.d.ts +3 -0
- package/containers/ItemsQuotedTemplate.js +4 -0
- package/containers/ItemsQuotedTemplate.js.map +1 -0
- package/containers/ManageNegotiableQuote/ManageNegotiableQuote.d.ts +1 -0
- package/containers/ManageNegotiableQuote.js +1 -1
- package/containers/ManageNegotiableQuote.js.map +1 -1
- package/containers/ManageNegotiableQuoteTemplate/ManageNegotiableQuoteTemplate.d.ts +54 -0
- package/containers/ManageNegotiableQuoteTemplate/index.d.ts +11 -0
- package/containers/ManageNegotiableQuoteTemplate.d.ts +3 -0
- package/containers/ManageNegotiableQuoteTemplate.js +4 -0
- package/containers/ManageNegotiableQuoteTemplate.js.map +1 -0
- package/containers/OrderSummary.js +1 -1
- package/containers/OrderSummary.js.map +1 -1
- package/containers/OrderSummaryLine.js +1 -1
- package/containers/QuoteCommentsList.js +1 -1
- package/containers/QuoteHistoryLog.js +1 -1
- package/containers/QuoteSummaryList.js +1 -1
- package/containers/QuoteSummaryList.js.map +1 -1
- package/containers/QuoteTemplateCommentsList/QuoteTemplateCommentsList.d.ts +9 -0
- package/containers/QuoteTemplateCommentsList/index.d.ts +11 -0
- package/containers/QuoteTemplateCommentsList.d.ts +3 -0
- package/containers/QuoteTemplateCommentsList.js +4 -0
- package/containers/QuoteTemplateCommentsList.js.map +1 -0
- package/containers/QuoteTemplateHistoryLog/QuoteTemplateHistoryLog.d.ts +9 -0
- package/containers/QuoteTemplateHistoryLog/index.d.ts +11 -0
- package/containers/QuoteTemplateHistoryLog.d.ts +3 -0
- package/containers/QuoteTemplateHistoryLog.js +4 -0
- package/containers/QuoteTemplateHistoryLog.js.map +1 -0
- package/containers/QuoteTemplatesListTable/QuoteTemplatesListTable.d.ts +2 -0
- package/containers/QuoteTemplatesListTable.js +1 -1
- package/containers/QuoteTemplatesListTable.js.map +1 -1
- package/containers/QuotesListTable.js +1 -1
- package/containers/QuotesListTable.js.map +1 -1
- package/containers/RequestNegotiableQuoteForm.js +1 -1
- package/containers/RequestNegotiableQuoteForm.js.map +1 -1
- package/containers/index.d.ts +4 -0
- package/data/models/__fixtures__/negotiableQuoteTemplateModel.d.ts +4 -0
- package/data/models/negotiable-quote-model.d.ts +1 -0
- package/data/models/negotiable-quote-template-model.d.ts +1 -1
- package/i18n/en_US.json.d.ts +48 -1
- package/package.json +1 -1
- package/render.js +2 -3
- package/render.js.map +1 -1
- package/chunks/fetch-graphql.js +0 -4
- package/chunks/fetch-graphql.js.map +0 -1
- package/chunks/updateQuantities.js +0 -21
- package/chunks/updateQuantities.js.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ItemsQuoted.js","sources":["/@dropins/storefront-quote-management/src/components/ItemsQuoted/ItemsQuoted.tsx","/@dropins/storefront-quote-management/src/components/ProductListTable/ProductListTable.tsx","/@dropins/storefront-quote-management/src/components/QuotePricesSummary/QuotePricesSummary.tsx","/@dropins/storefront-quote-management/src/components/ConfirmationModal/ConfirmationModal.tsx","/@dropins/storefront-quote-management/src/containers/ItemsQuoted/ItemsQuoted.tsx"],"sourcesContent":["/********************************************************************\n * Copyright 2025 Adobe\n * All Rights Reserved.\n *\n * NOTICE: Adobe permits you to use, modify, and distribute this \n * file in accordance with the terms of the Adobe license agreement \n * accompanying it. \n *******************************************************************/\n\nimport { FunctionComponent, VNode } from 'preact';\nimport { HTMLAttributes } from 'preact/compat';\nimport { classes, VComponent } from '@adobe-commerce/elsie/lib';\nimport '@/quote-management/components/ItemsQuoted/ItemsQuoted.css';\nimport { Skeleton, SkeletonRow } from '@adobe-commerce/elsie/components';\n\nexport interface ItemsQuotedProps extends Omit<HTMLAttributes<HTMLDivElement>, 'loading'> {\n loading?: boolean;\n table?: VNode;\n pricesSummary?: VNode;\n}\n\nexport const ItemsQuoted: FunctionComponent<ItemsQuotedProps> = ({\n className,\n loading,\n table,\n pricesSummary,\n ...props\n}) => {\n if (loading) {\n return <ItemsQuotedSkeleton />;\n }\n\n return (\n <div className={classes(['quote-management-items-quoted', className])} {...props}>\n {table && (\n <VComponent\n node={table}\n className={classes(['quote-management-items-quoted__table'])}\n data-testid=\"quote-management-items-quoted__table\"\n />\n )}\n {pricesSummary && (\n <VComponent\n node={pricesSummary}\n className={classes(['quote-management-items-quoted__prices-summary'])}\n data-testid=\"quote-management-items-quoted__prices-summary\"\n />\n )}\n </div>\n );\n};\n\nexport const ItemsQuotedSkeleton: FunctionComponent = () => {\n return (\n <Skeleton data-testid=\"items-quoted-skeleton\">\n <SkeletonRow variant=\"row\" fullWidth={true} size=\"medium\" lines={4} multilineGap='xsmall' />\n </Skeleton>\n );\n};","/********************************************************************\n * Copyright 2025 Adobe\n * All Rights Reserved.\n *\n * NOTICE: Adobe permits you to use, modify, and distribute this\n * file in accordance with the terms of the Adobe license agreement\n * accompanying it.\n *******************************************************************/\n\nimport { FunctionComponent, h } from 'preact';\nimport { HTMLAttributes } from 'preact/compat';\nimport { useState, useEffect } from 'preact/hooks';\nimport { classes, VComponent } from '@adobe-commerce/elsie/lib';\nimport {\n Table,\n Checkbox,\n Picker,\n Price,\n Button,\n Input,\n} from '@adobe-commerce/elsie/components';\nimport '@/quote-management/components/ProductListTable/ProductListTable.css';\nimport { NegotiableQuoteCartItem } from '@/quote-management/data/models/negotiable-quote-model';\nimport { useText } from '@adobe-commerce/elsie/i18n';\n\nexport interface ProductListTableProps\n extends HTMLAttributes<HTMLDivElement | HTMLFormElement> {\n items: NegotiableQuoteCartItem[];\n canEdit: boolean;\n onItemCheckboxChange?: (\n item: NegotiableQuoteCartItem,\n isSelected: boolean\n ) => void;\n onItemDropdownChange?: (\n item: NegotiableQuoteCartItem,\n action: string\n ) => void;\n onQuantityChange?: (\n item: NegotiableQuoteCartItem,\n newQuantity: number\n ) => void;\n onUpdate?: (e: SubmitEvent) => void;\n}\n\nexport const ProductListTable: FunctionComponent<ProductListTableProps> = ({\n className,\n items,\n canEdit,\n onItemCheckboxChange,\n onItemDropdownChange,\n onQuantityChange,\n onUpdate,\n ...props\n}) => {\n // Track original quantities to detect changes\n const [originalQuantities, setOriginalQuantities] = useState<\n Record<string, number>\n >({});\n const [currentQuantities, setCurrentQuantities] = useState<\n Record<string, number>\n >({});\n\n // Initialize quantities when items change\n useEffect(() => {\n const quantities: Record<string, number> = {};\n items.forEach((item) => {\n quantities[item.uid] = item.quantity;\n });\n setOriginalQuantities(quantities);\n setCurrentQuantities(quantities);\n }, [items]);\n\n // Check if any quantities have changed\n const hasQuantityChanges = Object.keys(currentQuantities).some(\n (uid) => currentQuantities[uid] !== originalQuantities[uid]\n );\n\n const dictionary = useText({\n updateButton: 'NegotiableQuote.Manage.productListTable.submitButton',\n productNameHeader:\n 'NegotiableQuote.Manage.productListTable.headers.productName',\n skuHeader: 'NegotiableQuote.Manage.productListTable.headers.sku',\n priceHeader: 'NegotiableQuote.Manage.productListTable.headers.price',\n quantityHeader: 'NegotiableQuote.Manage.productListTable.headers.quantity',\n discountHeader: 'NegotiableQuote.Manage.productListTable.headers.discount',\n subtotalHeader: 'NegotiableQuote.Manage.productListTable.headers.subtotal',\n actionsHeader: 'NegotiableQuote.Manage.productListTable.headers.actions',\n editNoteToSeller:\n 'NegotiableQuote.Manage.productListTable.actions.editNoteToSeller',\n remove: 'NegotiableQuote.Manage.productListTable.actions.remove',\n });\n\n const columns = [\n {\n label: dictionary.productNameHeader,\n key: 'productName',\n },\n {\n label: dictionary.skuHeader,\n key: 'sku',\n },\n {\n label: dictionary.priceHeader,\n key: 'price',\n },\n {\n label: dictionary.quantityHeader,\n key: 'quantity',\n },\n {\n label: dictionary.discountHeader,\n key: 'discount',\n },\n {\n label: dictionary.subtotalHeader,\n key: 'subtotal',\n },\n ];\n\n if (canEdit) {\n columns.unshift({\n label: '',\n key: 'checkbox',\n });\n columns.push({\n label: dictionary.actionsHeader,\n key: 'actions',\n });\n }\n\n const handleItemCheckboxChange = (\n event: Event,\n item: NegotiableQuoteCartItem\n ) => {\n const isSelected = (event.target as HTMLInputElement).checked;\n onItemCheckboxChange?.(item, isSelected);\n };\n\n const handleItemDropdownChange = (\n event: Event,\n item: NegotiableQuoteCartItem\n ) => {\n const action = (event.target as HTMLSelectElement).value;\n onItemDropdownChange?.(item, action);\n };\n\n const handleQuantityChange = (\n event: Event,\n item: NegotiableQuoteCartItem\n ) => {\n const newQuantity = parseInt((event.target as HTMLInputElement).value, 10);\n if (!isNaN(newQuantity) && newQuantity > 0) {\n setCurrentQuantities((prev) => ({\n ...prev,\n [item.uid]: newQuantity,\n }));\n onQuantityChange?.(item, newQuantity);\n }\n };\n\n const handleUpdate = (event: SubmitEvent) => {\n event.preventDefault();\n onUpdate?.(event);\n };\n\n const discountElement = (amountOff: number, percentOff: number) => {\n return amountOff > 0 ? (\n <div className=\"quote-management-product-list-table__discount-container\">\n <span className=\"quote-management-product-list-table__discount-percent\">\n {percentOff}%\n </span>\n <span className=\"quote-management-product-list-table__discount-price\">\n (<Price amount={amountOff} />)\n </span>\n </div>\n ) : undefined;\n };\n\n const getProductNameContent = (item: NegotiableQuoteCartItem) => {\n const configurableOptions = item.configurableOptions?.map((option) => (\n <div\n key={option.optionLabel}\n className=\"quote-management-product-list-table__configurable-option\"\n >\n <span className=\"quote-management-product-list-table__configurable-option-label\">\n {option.optionLabel}:\n </span>\n <span className=\"quote-management-product-list-table__configurable-option-value\">\n {option.valueLabel}\n </span>\n </div>\n ));\n\n const bundleOptions = item.bundleOptions?.map((option) => (\n <div\n key={option.label}\n className=\"quote-management-product-list-table__bundle-option\"\n >\n <span className=\"quote-management-product-list-table__bundle-option-label\">\n {option.label}\n </span>\n <div className=\"quote-management-product-list-table__bundle-option-values\">\n {option.values.map((value) => (\n <span\n key={value.label}\n className=\"quote-management-product-list-table__bundle-option-value\"\n >\n <span className=\"quote-management-product-list-table__bundle-option-value-quantity\">\n {value.quantity} x\n </span>\n <span className=\"quote-management-product-list-table__bundle-option-value-label\">\n {value.label}\n </span>\n <Price\n className=\"quote-management-product-list-table__bundle-option-value-original-price\"\n amount={value.originalPrice.value}\n currency={value.originalPrice.currency}\n weight=\"normal\"\n />\n </span>\n ))}\n </div>\n </div>\n ));\n\n return (\n <div className=\"quote-management-product-list-table__product-name-container\">\n <span className=\"quote-management-product-list-table__product-name\">\n {item.product.name}\n </span>\n {configurableOptions}\n {bundleOptions}\n </div>\n );\n };\n\n const rowData = items.map((item) => {\n const quantityElement = canEdit ? (\n <Input\n className=\"quote-management-product-list-table__quantity-input\"\n type=\"number\"\n min=\"1\"\n value={\n currentQuantities[item.uid]?.toString() || item.quantity.toString()\n }\n onChange={(e) => handleQuantityChange(e, item)}\n disabled={!canEdit}\n data-testid={`quantity-input-${item.product.sku}`}\n />\n ) : (\n <span className=\"quote-management-product-list-table__quantity\">\n {item.quantity}\n </span>\n );\n\n return {\n checkbox: (\n <Checkbox\n className=\"quote-management-product-list-table__checkbox\"\n name=\"itemSelected\"\n data-testid={`item-checkbox-${item.product.sku}`}\n onChange={(e) => handleItemCheckboxChange(e, item)}\n value={item.product.sku}\n />\n ),\n productName: getProductNameContent(item),\n sku: (\n <span className=\"quote-management-product-list-table__sku\">\n {item.product.sku}\n </span>\n ),\n price: (\n <Price\n className=\"quote-management-product-list-table__price\"\n amount={item.prices.originalItemPrice.value}\n currency={item.prices.originalItemPrice.currency}\n />\n ),\n quantity: quantityElement,\n discount: discountElement(\n item.catalogDiscount.amountOff,\n item.catalogDiscount.percentOff\n ),\n subtotal: (\n <Price\n className=\"quote-management-product-list-table__subtotal\"\n amount={item.prices.rowTotal.value}\n currency={item.prices.rowTotal.currency}\n />\n ),\n actions: (\n <Picker\n className=\"quote-management-product-list-table__actions\"\n data-testid={`item-dropdown-${item.product.sku}`}\n name={`item-dropdown-${item.product.sku}`}\n onChange={(e) => handleItemDropdownChange(e, item)}\n placeholder=\"Select\"\n options={[\n { text: dictionary.editNoteToSeller, value: 'edit' },\n { text: dictionary.remove, value: 'remove' },\n ]}\n value={item.product.sku}\n />\n ),\n };\n });\n\n const table = (\n <Table\n columns={columns}\n rowData={rowData}\n data-testid=\"product-list-table\"\n mobileLayout=\"stacked\"\n />\n );\n\n // if can edit, the wrapper node should use the form element, else use the div element\n const wrapperNode = canEdit ? h('form', {}) : h('div', {});\n const wrapperProps = canEdit\n ? {\n onSubmit: handleUpdate,\n ...props,\n }\n : props;\n\n const submitButton = (\n <Button\n type=\"submit\"\n disabled={!canEdit || !hasQuantityChanges}\n data-testid=\"product-list-table-submit-button\"\n >\n {dictionary.updateButton}\n </Button>\n );\n\n return (\n <VComponent\n node={wrapperNode}\n className={classes([\n 'quote-management-product-list-table-container',\n className,\n ])}\n data-testid=\"product-list-table-container\"\n {...wrapperProps}\n >\n {table}\n <div className=\"quote-management-product-list-table-container__submit-container\">\n {submitButton}\n </div>\n </VComponent>\n );\n};\n","/********************************************************************\n * Copyright 2025 Adobe\n * All Rights Reserved.\n *\n * NOTICE: Adobe permits you to use, modify, and distribute this \n * file in accordance with the terms of the Adobe license agreement \n * accompanying it. \n *******************************************************************/\n \nimport { FunctionComponent, VNode } from 'preact';\nimport { HTMLAttributes } from 'preact/compat';\nimport { classes } from '@adobe-commerce/elsie/lib';\nimport '@/quote-management/components/QuotePricesSummary/QuotePricesSummary.css';\nimport { Accordion, AccordionSection } from '@adobe-commerce/elsie/components';\n\ninterface Entry {\n label: string;\n id: string;\n value: VNode;\n strong?: boolean;\n children?: Entry[];\n}\n\nexport interface QuotePricesSummaryProps extends HTMLAttributes<HTMLDivElement> {\n entries?: Entry[];\n}\n\nexport const QuotePricesSummary: FunctionComponent<QuotePricesSummaryProps> = ({\n className,\n entries,\n ...props\n}) => {\n const createEntry = (entry: Entry) => {\n const children = entry.children?.map(createEntry);\n return (\n <div key={entry.id} className=\"quote-management-quote-prices-summary__entry\" data-testid={`quote-prices-summary-entry-${entry.id}`}>\n {children ? <Accordion\n className=\"quote-management-quote-prices-summary__accordion\"\n data-testid={`quote-prices-summary-entry-accordion-${entry.id}`}\n >\n <AccordionSection className=\"quote-management-quote-prices-summary__accordion-section\" title={entry.label} ariaLabelTitle={entry.label} secondaryText={entry.value}>\n {children}\n </AccordionSection>\n </Accordion>\n :\n <>\n <span className={classes(['quote-management-quote-prices-summary__label', ['quote-management-quote-prices-summary__label--strong', entry.strong]])} data-testid={`quote-prices-summary-entry-label-${entry.id}`}>{entry.label}</span>\n <span className=\"quote-management-quote-prices-summary__value\" data-testid={`quote-prices-summary-entry-value-${entry.id}`}>{entry.value}</span>\n </>\n }\n </div>\n );\n };\n\n return (\n <div className={classes(['quote-management-quote-prices-summary', className])} data-testid=\"quote-prices-summary\" {...props}>\n {entries?.map(createEntry)}\n </div>\n );\n};\n","/********************************************************************\n * Copyright 2025 Adobe\n * All Rights Reserved.\n *\n * NOTICE: Adobe permits you to use, modify, and distribute this \n * file in accordance with the terms of the Adobe license agreement \n * accompanying it. \n *******************************************************************/\n \nimport { FunctionComponent, VNode } from 'preact';\nimport { HTMLAttributes } from 'preact/compat';\nimport { Button, Modal } from '@adobe-commerce/elsie/components';\nimport { useText } from '@adobe-commerce/elsie/i18n';\nimport '@/quote-management/components/ConfirmationModal/ConfirmationModal.css';\n\nexport interface ConfirmationModalProps extends Omit<HTMLAttributes<HTMLDivElement>, 'title'> {\n open?: boolean;\n title?: VNode | string;\n message?: VNode | string;\n cancelLabel?: VNode | string;\n confirmLabel?: VNode | string;\n onCancel?: () => void;\n onConfirm?: () => void;\n showCloseButton?: boolean;\n confirmationBanner?: VNode | null;\n}\n\nexport const ConfirmationModal: FunctionComponent<ConfirmationModalProps> = ({\n open = false,\n title,\n message,\n cancelLabel,\n confirmLabel,\n onCancel,\n onConfirm,\n showCloseButton,\n confirmationBanner,\n ...props\n}) => {\n const dictionary = useText({\n cancel: 'ConfirmationModal.cancel',\n confirm: 'ConfirmationModal.confirm',\n });\n\n if (!open) {\n return null;\n }\n\n const { className, ...restProps } = props;\n\n return (\n <Modal\n {...restProps}\n size={\"medium\"}\n onClose={onCancel}\n clickToDismiss={true}\n escapeToDismiss={true}\n showCloseButton={showCloseButton}\n data-testid=\"confirmation-modal\"\n className={className}\n >\n <div className=\"confirmation-modal__content\">\n {confirmationBanner && (\n <div className=\"confirmation-modal__banner\" data-testid=\"confirmation-modal-banner\">\n {confirmationBanner}\n </div>\n )}\n {title && (\n <div className=\"confirmation-modal__title\" data-testid=\"confirmation-modal-title\">\n {title}\n </div>\n )}\n {message && (\n <div className=\"confirmation-modal__message\" data-testid=\"confirmation-modal-message\">\n {message}\n </div>\n )}\n <div className=\"confirmation-modal__actions\" data-testid=\"confirmation-modal-actions\">\n <Button variant=\"secondary\" onClick={onCancel} data-testid=\"confirmation-modal-cancel\">\n {cancelLabel ?? dictionary.cancel}\n </Button>\n <Button variant=\"primary\" onClick={onConfirm} data-testid=\"confirmation-modal-confirm\">\n {confirmLabel ?? dictionary.confirm}\n </Button>\n </div>\n </div>\n </Modal>\n );\n};\n","/********************************************************************\n * Copyright 2025 Adobe\n * All Rights Reserved.\n *\n * NOTICE: Adobe permits you to use, modify, and distribute this\n * file in accordance with the terms of the Adobe license agreement\n * accompanying it.\n *******************************************************************/\n\nimport { HTMLAttributes, useEffect, useState } from 'preact/compat';\nimport { Container, Slot, SlotProps } from '@adobe-commerce/elsie/lib';\nimport { ProductListTable } from '@/quote-management/components/ProductListTable/ProductListTable';\nimport {\n NegotiableQuoteModel,\n NegotiableQuoteCartItem,\n} from '@/quote-management/data/models/negotiable-quote-model';\nimport { events } from '@adobe-commerce/event-bus';\nimport { QuotePricesSummary } from '@/quote-management/components/QuotePricesSummary';\nimport { ItemsQuoted as ItemsQuotedComponent } from '@/quote-management/components/ItemsQuoted';\nimport { Price, InLineAlert } from '@adobe-commerce/elsie/components';\nimport { useText } from '@adobe-commerce/elsie/i18n';\nimport { CheckWithCircle, WarningFilled } from '@adobe-commerce/elsie/icons';\nimport { ConfirmationModal } from '@/quote-management/components/ConfirmationModal';\nimport { updateQuantities } from '@/quote-management/api/updateQuantities';\n\nexport interface ItemsQuotedProps extends HTMLAttributes<HTMLDivElement> {\n quoteData?: NegotiableQuoteModel;\n onItemCheckboxChange?: (\n item: NegotiableQuoteCartItem,\n isSelected: boolean\n ) => void;\n onItemDropdownChange?: (\n item: NegotiableQuoteCartItem,\n action: string\n ) => void;\n slots?: {\n ProductListTable?: SlotProps<{\n items: NegotiableQuoteModel['items'];\n canEdit: boolean;\n onItemCheckboxChange?: (\n item: NegotiableQuoteCartItem,\n isSelected: boolean\n ) => void;\n onItemDropdownChange?: (\n item: NegotiableQuoteCartItem,\n action: string\n ) => void;\n onQuantityChange?: (\n item: NegotiableQuoteCartItem,\n newQuantity: number\n ) => void;\n onUpdate?: (e: SubmitEvent) => void;\n }>;\n QuotePricesSummary?: SlotProps<{\n items: NegotiableQuoteModel['items'];\n prices: NegotiableQuoteModel['prices'];\n }>;\n };\n}\n\nexport const ItemsQuoted: Container<ItemsQuotedProps> = ({\n quoteData: initialData,\n onItemCheckboxChange,\n onItemDropdownChange,\n slots,\n ...props\n}) => {\n const [quoteData, setQuoteData] = useState<NegotiableQuoteModel | undefined>(\n initialData\n );\n const [quantityChanges, setQuantityChanges] = useState<{\n [itemUid: string]: number;\n }>({});\n const [isModalOpen, setIsModalOpen] = useState(false);\n const [notificationState, setNotificationState] = useState<{\n type: 'success' | 'error' | null;\n message: string;\n }>({ type: null, message: '' });\n\n const dictionary = useText({\n subtotal: 'NegotiableQuote.Manage.quotePricesSummary.subtotal.excludingTax',\n grandTotal:\n 'NegotiableQuote.Manage.quotePricesSummary.grandTotal.includingTax',\n appliedTaxes: 'NegotiableQuote.Manage.quotePricesSummary.appliedTaxes',\n modalTitle: 'NegotiableQuote.Manage.updateQuantitiesModal.title',\n modalDescription:\n 'NegotiableQuote.Manage.updateQuantitiesModal.description',\n modalCancelButton:\n 'NegotiableQuote.Manage.updateQuantitiesModal.cancelButton',\n modalUpdateButton:\n 'NegotiableQuote.Manage.updateQuantitiesModal.updateButton',\n successHeading:\n 'NegotiableQuote.Manage.updateQuantitiesModal.successHeading',\n successMessage:\n 'NegotiableQuote.Manage.updateQuantitiesModal.successMessage',\n errorHeading: 'NegotiableQuote.Manage.updateQuantitiesModal.errorHeading',\n errorMessage: 'NegotiableQuote.Manage.updateQuantitiesModal.errorMessage',\n });\n\n useEffect(() => {\n const quoteDataEvent = events.on(\n 'quote-management/quote-data',\n (data: { quote: NegotiableQuoteModel }) => {\n setQuoteData(data.quote);\n setQuantityChanges({});\n setNotificationState({ type: null, message: '' });\n },\n {\n eager: true,\n }\n );\n return () => quoteDataEvent?.off();\n }, []);\n\n useEffect(() => {\n const quantitiesUpdatedEvent = events.on(\n 'quote-management/quantities-updated',\n (data: { quote: NegotiableQuoteModel }) => {\n setQuoteData(data.quote);\n setQuantityChanges({});\n setNotificationState({\n type: 'success',\n message: dictionary.successMessage,\n });\n // Auto-close success notification after 3 seconds\n setTimeout(() => {\n setIsModalOpen(false);\n setNotificationState({ type: null, message: '' });\n }, 3000);\n }\n );\n return () => quantitiesUpdatedEvent?.off();\n }, [dictionary.successMessage]);\n\n if (!quoteData) {\n return <ItemsQuotedComponent loading={true} />;\n }\n\n const canEdit = Boolean(quoteData.canUpdateQuote);\n\n const handleQuantityChange = (\n item: NegotiableQuoteCartItem,\n newQuantity: number\n ) => {\n setQuantityChanges((prev) => ({\n ...prev,\n [item.uid]: newQuantity,\n }));\n };\n\n const handleUpdate = (e: SubmitEvent) => {\n e.preventDefault();\n setNotificationState({ type: null, message: '' });\n setIsModalOpen(true);\n };\n\n const handleConfirmUpdate = async () => {\n /* istanbul ignore next */\n if (!quoteData) {\n return;\n }\n\n if (Object.keys(quantityChanges).length === 0) {\n setIsModalOpen(false);\n return;\n }\n\n // Clear any previous notifications\n setNotificationState({ type: null, message: '' });\n\n const items = Object.entries(quantityChanges).map(\n ([quoteItemUid, quantity]) => ({\n quoteItemUid,\n quantity,\n })\n );\n\n try {\n await updateQuantities({\n quoteUid: quoteData.uid,\n items,\n });\n // Success is handled by the event listener\n } catch (err) {\n const errorMessage =\n /* istanbul ignore next */\n err instanceof Error ? err.message : dictionary.errorMessage;\n setNotificationState({\n type: 'error',\n message: errorMessage,\n });\n console.error('Failed to update quantities:', err);\n }\n };\n\n const handleCancelUpdate = () => {\n setIsModalOpen(false);\n setNotificationState({ type: null, message: '' });\n };\n\n const handleDismissBanner = () => {\n setNotificationState({ type: null, message: '' });\n };\n\n const quotePricesSummaryEntries = [];\n\n quoteData.prices.subtotalExcludingTax &&\n quotePricesSummaryEntries.push({\n label: dictionary.subtotal,\n id: 'subtotal',\n value: (\n <Price\n amount={quoteData.prices.subtotalExcludingTax.value}\n currency={quoteData.prices.subtotalExcludingTax.currency}\n weight=\"normal\"\n />\n ),\n });\n\n quoteData.prices.grandTotal &&\n quotePricesSummaryEntries.push({\n label: dictionary.grandTotal,\n id: 'total',\n value: (\n <Price\n amount={quoteData.prices.grandTotal.value}\n currency={quoteData.prices.grandTotal.currency}\n />\n ),\n strong: true,\n });\n\n // Create confirmation banner based on notification state\n const confirmationBanner =\n notificationState.type === 'success' ? (\n <InLineAlert\n type=\"success\"\n variant=\"primary\"\n icon={<CheckWithCircle />}\n heading={dictionary.successHeading}\n description={notificationState.message}\n onDismiss={handleDismissBanner}\n data-testid=\"update-quantities-success-banner\"\n />\n ) : notificationState.type === 'error' ? (\n <InLineAlert\n type=\"error\"\n variant=\"primary\"\n icon={<WarningFilled />}\n heading={dictionary.errorHeading}\n description={notificationState.message}\n onDismiss={handleDismissBanner}\n data-testid=\"update-quantities-error-banner\"\n />\n ) : null;\n\n return (\n <>\n <ItemsQuotedComponent\n data-testid=\"items-quoted-container\"\n {...props}\n loading={false}\n table={\n <Slot\n name=\"ProductListTable\"\n slot={slots?.ProductListTable}\n context={{\n items: quoteData.items,\n canEdit,\n onItemCheckboxChange,\n onItemDropdownChange,\n onQuantityChange: handleQuantityChange,\n onUpdate: handleUpdate,\n }}\n >\n <ProductListTable\n items={quoteData.items}\n canEdit={canEdit}\n onItemCheckboxChange={onItemCheckboxChange}\n onItemDropdownChange={onItemDropdownChange}\n onQuantityChange={handleQuantityChange}\n onUpdate={handleUpdate}\n />\n </Slot>\n }\n pricesSummary={\n <Slot\n name=\"QuotePricesSummary\"\n slot={slots?.QuotePricesSummary}\n context={{\n items: quoteData.items,\n prices: quoteData.prices,\n }}\n >\n <QuotePricesSummary entries={quotePricesSummaryEntries} />\n </Slot>\n }\n />\n\n <ConfirmationModal\n open={isModalOpen}\n title={dictionary.modalTitle}\n message={dictionary.modalDescription}\n cancelLabel={dictionary.modalCancelButton}\n confirmLabel={dictionary.modalUpdateButton}\n onCancel={handleCancelUpdate}\n onConfirm={handleConfirmUpdate}\n confirmationBanner={confirmationBanner}\n />\n </>\n );\n};\n"],"names":["ItemsQuoted","className","loading","table","pricesSummary","props","ItemsQuotedSkeleton","jsxs","classes","jsx","VComponent","Skeleton","SkeletonRow","ProductListTable","items","canEdit","onItemCheckboxChange","onItemDropdownChange","onQuantityChange","onUpdate","originalQuantities","setOriginalQuantities","useState","currentQuantities","setCurrentQuantities","useEffect","quantities","item","hasQuantityChanges","uid","dictionary","useText","columns","handleItemCheckboxChange","event","isSelected","handleItemDropdownChange","action","handleQuantityChange","newQuantity","prev","handleUpdate","discountElement","amountOff","percentOff","Price","getProductNameContent","configurableOptions","_a","option","bundleOptions","_b","value","rowData","quantityElement","Input","e","Checkbox","Picker","Table","wrapperNode","h","wrapperProps","submitButton","Button","QuotePricesSummary","entries","createEntry","entry","children","Accordion","AccordionSection","Fragment","ConfirmationModal","open","title","message","cancelLabel","confirmLabel","onCancel","onConfirm","showCloseButton","confirmationBanner","restProps","Modal","initialData","slots","quoteData","setQuoteData","quantityChanges","setQuantityChanges","isModalOpen","setIsModalOpen","notificationState","setNotificationState","quoteDataEvent","events","data","quantitiesUpdatedEvent","ItemsQuotedComponent","handleConfirmUpdate","quoteItemUid","quantity","updateQuantities","err","errorMessage","handleCancelUpdate","handleDismissBanner","quotePricesSummaryEntries","InLineAlert","CheckWithCircle","WarningFilled","Slot"],"mappings":"mxBAqBO,MAAMA,EAAmD,CAAC,CAC/D,UAAAC,EACA,QAAAC,EACA,MAAAC,EACA,cAAAC,EACA,GAAGC,CACL,IACMH,IACMI,GAAA,EAAoB,EAI5BC,EAAC,MAAA,CAAI,UAAWC,EAAQ,CAAC,gCAAiCP,CAAS,CAAC,EAAI,GAAGI,EACxE,SAAA,CAAAF,GACCM,EAACC,EAAA,CACC,KAAMP,EACN,UAAWK,EAAQ,CAAC,sCAAsC,CAAC,EAC3D,cAAY,sCAAA,CAAA,EAGfJ,GACCK,EAACC,EAAA,CACC,KAAMN,EACN,UAAWI,EAAQ,CAAC,+CAA+C,CAAC,EACpE,cAAY,+CAAA,CAAA,CACd,EAEJ,EAISF,GAAyC,MAEjDK,EAAA,CAAS,cAAY,wBACpB,SAAAF,EAACG,GAAY,QAAQ,MAAM,UAAW,GAAM,KAAK,SAAS,MAAO,EAAG,aAAa,SAAS,EAC5F,ECZSC,GAA6D,CAAC,CACz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AAK,mBACL,KAAM1B,GAAA,YAAAA,EAAO,iBACb,QAAS,CACP,MAAOC,EAAU,MACjB,QAAAxE,EACA,qBAAAC,EACA,qBAAAC,EACA,iBAAkBqB,EAClB,SAAUG,CAAA,EAGZ,SAAAhC,EAACI,GAAA,CACC,MAAO0E,EAAU,MACjB,QAAAxE,EACA,qBAAAC,EACA,qBAAAC,EACA,iBAAkBqB,EAClB,SAAUG,CAAA,CAAA,CACZ,CAAA,EAGJ,cACEhC,EAACuG,EAAA,CACC,KAAK,qBACL,KAAM1B,GAAA,YAAAA,EAAO,mBACb,QAAS,CACP,MAAOC,EAAU,MACjB,OAAQA,EAAU,MAAA,EAGpB,SAAA9E,EAACwD,GAAA,CAAmB,QAAS2C,CAAA,CAA2B,CAAA,CAAA,CAC1D,CAAA,EAIJnG,EAACgE,GAAA,CACC,KAAMkB,EACN,MAAO7D,EAAW,WAClB,QAASA,EAAW,iBACpB,YAAaA,EAAW,kBACxB,aAAcA,EAAW,kBACzB,SAAU4E,EACV,UAAWN,EACX,mBAAAlB,CAAA,CAAA,CACF,EACF,CAEJ"}
|
|
1
|
+
{"version":3,"file":"ItemsQuoted.js","sources":["/@dropins/storefront-quote-management/src/components/ConfirmationModal/ConfirmationModal.tsx","/@dropins/storefront-quote-management/src/containers/ItemsQuoted/ItemsQuoted.tsx"],"sourcesContent":["/********************************************************************\n * Copyright 2025 Adobe\n * All Rights Reserved.\n *\n * NOTICE: Adobe permits you to use, modify, and distribute this\n * file in accordance with the terms of the Adobe license agreement\n * accompanying it.\n *******************************************************************/\n\nimport { FunctionComponent, VNode } from 'preact';\nimport { HTMLAttributes } from 'preact/compat';\nimport { Button, Modal } from '@adobe-commerce/elsie/components';\nimport { useText } from '@adobe-commerce/elsie/i18n';\nimport '@/quote-management/components/ConfirmationModal/ConfirmationModal.css';\n\nexport interface ConfirmationModalProps\n extends Omit<HTMLAttributes<HTMLDivElement>, 'title'> {\n open?: boolean;\n title?: VNode | string;\n message?: VNode | string;\n cancelLabel?: VNode | string;\n confirmLabel?: VNode | string;\n onCancel?: () => void;\n onConfirm?: () => void;\n onClose?: () => void;\n showCloseButton?: boolean;\n confirmationBanner?: VNode | null;\n}\n\nexport const ConfirmationModal: FunctionComponent<ConfirmationModalProps> = ({\n open = false,\n title,\n message,\n cancelLabel,\n confirmLabel,\n onCancel,\n onConfirm,\n onClose,\n showCloseButton,\n confirmationBanner,\n ...props\n}) => {\n const dictionary = useText({\n cancel: 'ConfirmationModal.cancel',\n confirm: 'ConfirmationModal.confirm',\n });\n\n if (!open) {\n return null;\n }\n\n const { className, ...restProps } = props;\n\n return (\n <Modal\n {...restProps}\n size={'medium'}\n onClose={onClose || onCancel}\n clickToDismiss={true}\n escapeToDismiss={true}\n showCloseButton={showCloseButton}\n data-testid=\"confirmation-modal\"\n className={className}\n >\n <div className=\"confirmation-modal__content\">\n {confirmationBanner && (\n <div\n className=\"confirmation-modal__banner\"\n data-testid=\"confirmation-modal-banner\"\n >\n {confirmationBanner}\n </div>\n )}\n {title && (\n <div\n className=\"confirmation-modal__title\"\n data-testid=\"confirmation-modal-title\"\n >\n {title}\n </div>\n )}\n {message && (\n <div\n className=\"confirmation-modal__message\"\n data-testid=\"confirmation-modal-message\"\n >\n {message}\n </div>\n )}\n <div\n className=\"confirmation-modal__actions\"\n data-testid=\"confirmation-modal-actions\"\n >\n {onCancel && (\n <Button\n variant=\"secondary\"\n onClick={onCancel}\n data-testid=\"confirmation-modal-cancel\"\n >\n {cancelLabel ?? dictionary.cancel}\n </Button>\n )}\n <Button\n variant=\"primary\"\n onClick={onConfirm}\n data-testid=\"confirmation-modal-confirm\"\n >\n {confirmLabel ?? dictionary.confirm}\n </Button>\n </div>\n </div>\n </Modal>\n );\n};\n","/********************************************************************\n * Copyright 2025 Adobe\n * All Rights Reserved.\n *\n * NOTICE: Adobe permits you to use, modify, and distribute this\n * file in accordance with the terms of the Adobe license agreement\n * accompanying it.\n *******************************************************************/\n\nimport {\n HTMLAttributes,\n useCallback,\n useEffect,\n useState,\n} from 'preact/compat';\nimport { Container, Slot, SlotProps } from '@adobe-commerce/elsie/lib';\nimport { events } from '@adobe-commerce/event-bus';\nimport { Price, InLineAlert } from '@adobe-commerce/elsie/components';\nimport { useText } from '@adobe-commerce/elsie/i18n';\nimport { NegotiableQuoteModel, NegotiableQuoteCartItem } from '@/quote-management/data/models/negotiable-quote-model';\nimport { ProductListTable, ProductListTableItem, QuotePricesSummary, ItemsQuoted as ItemsQuotedComponent } from '@/quote-management/components';\nimport { CheckWithCircle, WarningFilled } from '@adobe-commerce/elsie/icons';\nimport { ConfirmationModal } from '@/quote-management/components/ConfirmationModal';\nimport { updateQuantities } from '@/quote-management/api/updateQuantities';\nimport { removeNegotiableQuoteItems } from '@/quote-management/api/removeNegotiableQuoteItems';\n\nconst NOTIFICATION_AUTO_DISMISS_DELAY = 3000;\n\nexport interface ItemsQuotedProps extends HTMLAttributes<HTMLDivElement> {\n quoteData?: NegotiableQuoteModel;\n onItemCheckboxChange?: (\n item: NegotiableQuoteCartItem,\n isSelected: boolean\n ) => void;\n onItemDropdownChange?: (\n item: NegotiableQuoteCartItem,\n action: string\n ) => void;\n onUpdate?: (e: SubmitEvent) => void;\n onRemoveItemsRef?: (\n handler: (items: NegotiableQuoteCartItem[]) => void\n ) => void;\n onRemoveModalStateChange?: (isOpen: boolean) => void;\n slots?: {\n ProductListTable?: SlotProps<{\n items: NegotiableQuoteModel['items'];\n canEdit: boolean;\n readOnly?: boolean;\n onItemCheckboxChange?: (\n item: NegotiableQuoteCartItem,\n isSelected: boolean\n ) => void;\n onItemDropdownChange?: (\n item: NegotiableQuoteCartItem,\n action: string\n ) => void;\n onQuantityChange?: (\n item: NegotiableQuoteCartItem,\n newQuantity: number\n ) => void;\n onUpdate?: (e: SubmitEvent) => void;\n dropdownSelections?: Record<string, string>;\n }>;\n QuotePricesSummary?: SlotProps<{\n items: NegotiableQuoteModel['items'];\n prices: NegotiableQuoteModel['prices'];\n }>;\n };\n}\n\nexport const ItemsQuoted: Container<ItemsQuotedProps> = ({\n quoteData: initialData,\n onItemCheckboxChange,\n onItemDropdownChange,\n onUpdate,\n onRemoveItemsRef,\n onRemoveModalStateChange,\n slots,\n ...props\n}) => {\n const [quoteData, setQuoteData] = useState<NegotiableQuoteModel | undefined>(\n initialData\n );\n const [quantityChanges, setQuantityChanges] = useState<{\n [itemUid: string]: number;\n }>({});\n const [isModalOpen, setIsModalOpen] = useState(false);\n const [notificationState, setNotificationState] = useState<{\n type: 'success' | 'error' | null;\n message: string;\n }>({ type: null, message: '' });\n // State for remove items functionality\n const [isRemoveModalOpen, setIsRemoveModalOpen] = useState(false);\n const [itemsToRemove, setItemsToRemove] = useState<NegotiableQuoteCartItem[]>(\n []\n );\n const [isRemoving, setIsRemoving] = useState(false);\n const [removeNotificationState, setRemoveNotificationState] = useState<{\n type: 'success' | 'error' | null;\n message: string;\n }>({ type: null, message: '' });\n const [dropdownSelections, setDropdownSelections] = useState<\n Record<string, string>\n >({});\n\n const dictionary = useText({\n subtotal: 'NegotiableQuote.Manage.quotePricesSummary.subtotal.excludingTax',\n grandTotal:\n 'NegotiableQuote.Manage.quotePricesSummary.grandTotal.includingTax',\n appliedTaxes: 'NegotiableQuote.Manage.quotePricesSummary.appliedTaxes',\n modalTitle: 'NegotiableQuote.Manage.updateQuantitiesModal.title',\n modalDescription:\n 'NegotiableQuote.Manage.updateQuantitiesModal.description',\n modalCancelButton:\n 'NegotiableQuote.Manage.updateQuantitiesModal.cancelButton',\n modalUpdateButton:\n 'NegotiableQuote.Manage.updateQuantitiesModal.updateButton',\n successHeading:\n 'NegotiableQuote.Manage.updateQuantitiesModal.successHeading',\n successMessage:\n 'NegotiableQuote.Manage.updateQuantitiesModal.successMessage',\n errorHeading: 'NegotiableQuote.Manage.updateQuantitiesModal.errorHeading',\n errorMessage: 'NegotiableQuote.Manage.updateQuantitiesModal.errorMessage',\n removeModalTitle: 'NegotiableQuote.Manage.removeItemsModal.title',\n removeModalDescription:\n 'NegotiableQuote.Manage.removeItemsModal.description',\n removeModalCancelButton:\n 'NegotiableQuote.Manage.removeItemsModal.cancelButton',\n removeModalConfirmButton:\n 'NegotiableQuote.Manage.removeItemsModal.confirmButton',\n removeModalConfirmButtonRemoving:\n 'NegotiableQuote.Manage.removeItemsModal.confirmButtonRemoving',\n removeSuccessHeading:\n 'NegotiableQuote.Manage.removeItemsModal.successHeading',\n removeSuccessMessage:\n 'NegotiableQuote.Manage.removeItemsModal.successMessage',\n removeErrorHeading: 'NegotiableQuote.Manage.removeItemsModal.errorHeading',\n removeErrorMessage: 'NegotiableQuote.Manage.removeItemsModal.errorMessage',\n });\n\n useEffect(() => {\n const quoteDataEvent = events.on(\n 'quote-management/quote-data',\n\n (data: { quote: NegotiableQuoteModel }) => {\n setQuoteData(data.quote);\n setQuantityChanges({});\n setNotificationState({ type: null, message: '' });\n setDropdownSelections({});\n },\n\n {\n eager: true,\n }\n );\n return () => quoteDataEvent?.off();\n }, []);\n\n useEffect(() => {\n const quantitiesUpdatedEvent = events.on(\n 'quote-management/quantities-updated',\n (data: { quote: NegotiableQuoteModel }) => {\n setQuoteData(data.quote);\n setQuantityChanges({});\n setNotificationState({\n type: 'success',\n message: dictionary.successMessage,\n });\n // Auto-close success notification after 3 seconds\n setTimeout(() => {\n setIsModalOpen(false);\n setNotificationState({ type: null, message: '' });\n }, 3000);\n }\n );\n return () => quantitiesUpdatedEvent?.off();\n }, [dictionary.successMessage]);\n\n // Listen for quote items removed event\n useEffect(() => {\n const itemsRemovedEvent = events.on(\n 'quote-management/quote-items-removed',\n (data: { quote: NegotiableQuoteModel }) => {\n setQuoteData(data.quote);\n setItemsToRemove([]);\n setIsRemoving(false);\n setRemoveNotificationState({\n type: 'success',\n message: dictionary.removeSuccessMessage,\n });\n // Auto-close success notification after 3 seconds\n setTimeout(() => {\n setIsRemoveModalOpen(false);\n setRemoveNotificationState({ type: null, message: '' });\n onRemoveModalStateChange?.(false);\n }, NOTIFICATION_AUTO_DISMISS_DELAY);\n }\n );\n return () => itemsRemovedEvent?.off();\n }, [dictionary.removeSuccessMessage, onRemoveModalStateChange]);\n\n // Unified handler for removing items (single or multiple)\n const handleRemoveItems = useCallback((items: NegotiableQuoteCartItem[]) => {\n if (!items || items.length === 0) {\n return;\n }\n setItemsToRemove(items);\n setRemoveNotificationState({ type: null, message: '' });\n setIsRemoveModalOpen(true);\n }, []);\n\n // Expose handler to parent component\n useEffect(() => {\n onRemoveItemsRef?.(handleRemoveItems);\n }, [handleRemoveItems, onRemoveItemsRef]);\n\n const handleDismissRemoveBanner = () => {\n setRemoveNotificationState({ type: null, message: '' });\n };\n\n const handleItemDropdownChange = (\n item: ProductListTableItem,\n action: string\n ) => {\n const cartItem = item as NegotiableQuoteCartItem;\n if (action === 'remove') {\n setDropdownSelections((prev) => ({\n ...prev,\n [cartItem.uid]: action,\n }));\n handleRemoveItems([cartItem]); // Use unified handler\n onItemDropdownChange?.(cartItem, action);\n return;\n }\n\n onItemDropdownChange?.(cartItem, action);\n\n setDropdownSelections((prev) => {\n if (!(cartItem.uid in prev)) {\n return prev;\n }\n const next = { ...prev };\n delete next[cartItem.uid];\n return next;\n });\n };\n\n const handleConfirmRemove = async () => {\n /* istanbul ignore next */\n if (!quoteData || itemsToRemove.length === 0) {\n return;\n }\n\n const uidsToRemove = itemsToRemove.map((item) => item.uid);\n\n setIsRemoving(true);\n setRemoveNotificationState({ type: null, message: '' });\n\n try {\n await removeNegotiableQuoteItems({\n quoteUid: quoteData.uid,\n quoteItemUids: uidsToRemove,\n });\n // Success is handled by the event listener\n } catch (err) {\n const errorMessage =\n /* istanbul ignore next */\n err instanceof Error ? err.message : dictionary.removeErrorMessage;\n setRemoveNotificationState({\n type: 'error',\n message: errorMessage,\n });\n // Clear dropdown selections for failed items (single item only)\n /* istanbul ignore next */ // UI-driven state; covered by tests but line sometimes mis-attributed in source maps\n if (itemsToRemove.length === 1) {\n const failedItem = itemsToRemove[0];\n setDropdownSelections((prev) => {\n if (!(failedItem.uid in prev)) {\n return prev;\n }\n const next = { ...prev };\n delete next[failedItem.uid];\n return next;\n });\n }\n setIsRemoving(false);\n }\n };\n\n const handleCancelRemove = () => {\n setIsRemoveModalOpen(false);\n setRemoveNotificationState({ type: null, message: '' });\n onRemoveModalStateChange?.(false);\n // Clear dropdown selections for single item cancellation\n /* istanbul ignore next */ // UI-driven state; covered by tests but line sometimes mis-attributed in source maps\n if (itemsToRemove.length === 1) {\n const cancelledItem = itemsToRemove[0];\n setDropdownSelections((prev) => {\n if (!(cancelledItem.uid in prev)) {\n return prev;\n }\n const next = { ...prev };\n delete next[cancelledItem.uid];\n return next;\n });\n }\n setItemsToRemove([]);\n };\n\n if (!quoteData) {\n return <ItemsQuotedComponent loading={true} />;\n }\n\n const canEdit = Boolean(quoteData.canUpdateQuote);\n\n const handleQuantityChange = (\n item: ProductListTableItem,\n newQuantity: number\n ) => {\n setQuantityChanges((prev) => ({\n ...prev,\n [(item as NegotiableQuoteCartItem).uid]: newQuantity,\n }));\n };\n\n const handleUpdate = (e: SubmitEvent) => {\n e.preventDefault();\n setNotificationState({ type: null, message: '' });\n setIsModalOpen(true);\n };\n\n const handleConfirmUpdate = async () => {\n /* istanbul ignore next */\n if (!quoteData) {\n return;\n }\n\n if (Object.keys(quantityChanges).length === 0) {\n setIsModalOpen(false);\n return;\n }\n\n // Clear any previous notifications\n setNotificationState({ type: null, message: '' });\n\n const items = Object.entries(quantityChanges).map(\n ([quoteItemUid, quantity]) => ({\n quoteItemUid,\n quantity,\n })\n );\n\n try {\n await updateQuantities({\n quoteUid: quoteData.uid,\n items,\n });\n // Success is handled by the event listener\n } catch (err) {\n const errorMessage =\n /* istanbul ignore next */\n err instanceof Error ? err.message : dictionary.errorMessage;\n setNotificationState({\n type: 'error',\n message: errorMessage,\n });\n console.error('Failed to update quantities:', err);\n }\n };\n\n const handleCancelUpdate = () => {\n setIsModalOpen(false);\n setNotificationState({ type: null, message: '' });\n };\n\n const handleDismissBanner = () => {\n setNotificationState({ type: null, message: '' });\n };\n\n const quotePricesSummaryEntries = [];\n\n quoteData.prices.subtotalExcludingTax &&\n quotePricesSummaryEntries.push({\n label: dictionary.subtotal,\n id: 'subtotal',\n value: (\n <Price\n amount={quoteData.prices.subtotalExcludingTax.value}\n currency={quoteData.prices.subtotalExcludingTax.currency}\n weight=\"normal\"\n />\n ),\n });\n\n quoteData.prices.grandTotal &&\n quotePricesSummaryEntries.push({\n label: dictionary.grandTotal,\n id: 'total',\n value: (\n <Price\n amount={quoteData.prices.grandTotal.value}\n currency={quoteData.prices.grandTotal.currency}\n />\n ),\n strong: true,\n });\n\n // Create confirmation banner based on notification state\n const confirmationBanner =\n notificationState.type === 'success' ? (\n <InLineAlert\n type=\"success\"\n variant=\"primary\"\n icon={<CheckWithCircle />}\n heading={dictionary.successHeading}\n description={notificationState.message}\n onDismiss={handleDismissBanner}\n data-testid=\"update-quantities-success-banner\"\n />\n ) : notificationState.type === 'error' ? (\n <InLineAlert\n type=\"error\"\n variant=\"primary\"\n icon={<WarningFilled />}\n heading={dictionary.errorHeading}\n description={notificationState.message}\n onDismiss={handleDismissBanner}\n data-testid=\"update-quantities-error-banner\"\n />\n ) : null;\n\n // Create wrapper that converts ProductListTableItem back to NegotiableQuoteCartItem\n const handleItemCheckboxChange = onItemCheckboxChange\n ? (item: ProductListTableItem, isSelected: boolean) => {\n onItemCheckboxChange(item as NegotiableQuoteCartItem, isSelected);\n }\n : undefined;\n\n // Create remove confirmation banner based on notification state\n const removeConfirmationBanner =\n removeNotificationState.type === 'success' ? (\n <InLineAlert\n type=\"success\"\n variant=\"primary\"\n icon={<CheckWithCircle />}\n heading={dictionary.removeSuccessHeading}\n description={removeNotificationState.message}\n onDismiss={handleDismissRemoveBanner}\n data-testid=\"remove-items-success-banner\"\n />\n ) : removeNotificationState.type === 'error' ? (\n <InLineAlert\n type=\"error\"\n variant=\"primary\"\n icon={<WarningFilled />}\n heading={dictionary.removeErrorHeading}\n description={removeNotificationState.message}\n onDismiss={handleDismissRemoveBanner}\n data-testid=\"remove-items-error-banner\"\n />\n ) : null;\n\n return (\n <>\n <ItemsQuotedComponent\n data-testid=\"items-quoted-container\"\n {...props}\n loading={false}\n table={\n <Slot\n name=\"ProductListTable\"\n slot={slots?.ProductListTable}\n context={{\n items: quoteData.items,\n canEdit,\n readOnly: quoteData.readOnly,\n onItemCheckboxChange,\n onItemDropdownChange: handleItemDropdownChange,\n onQuantityChange: handleQuantityChange,\n onUpdate,\n dropdownSelections,\n }}\n >\n <ProductListTable\n items={quoteData.items}\n canEdit={canEdit}\n onItemCheckboxChange={handleItemCheckboxChange}\n readOnly={quoteData.readOnly}\n onItemDropdownChange={handleItemDropdownChange}\n onQuantityChange={handleQuantityChange}\n onUpdate={handleUpdate}\n dropdownSelections={dropdownSelections}\n />\n </Slot>\n }\n pricesSummary={\n <Slot\n name=\"QuotePricesSummary\"\n slot={slots?.QuotePricesSummary}\n context={{\n items: quoteData.items,\n prices: quoteData.prices,\n }}\n >\n <QuotePricesSummary entries={quotePricesSummaryEntries} />\n </Slot>\n }\n />\n\n {/* Update Quantities Modal */}\n <ConfirmationModal\n open={isModalOpen}\n title={dictionary.modalTitle}\n message={dictionary.modalDescription}\n cancelLabel={dictionary.modalCancelButton}\n confirmLabel={dictionary.modalUpdateButton}\n onCancel={handleCancelUpdate}\n onConfirm={handleConfirmUpdate}\n confirmationBanner={confirmationBanner}\n data-testid=\"update-quantities-modal\"\n />\n\n {/* Remove Items Modal */}\n <ConfirmationModal\n open={isRemoveModalOpen}\n title={dictionary.removeModalTitle}\n message={dictionary.removeModalDescription}\n cancelLabel={dictionary.removeModalCancelButton}\n confirmLabel={\n isRemoving\n ? dictionary.removeModalConfirmButtonRemoving\n : dictionary.removeModalConfirmButton\n }\n onCancel={handleCancelRemove}\n onConfirm={handleConfirmRemove}\n confirmationBanner={removeConfirmationBanner}\n data-testid=\"remove-items-modal\"\n />\n </>\n );\n};\n"],"names":["ConfirmationModal","open","title","message","cancelLabel","confirmLabel","onCancel","onConfirm","onClose","showCloseButton","confirmationBanner","props","dictionary","useText","className","restProps","jsx","Modal","jsxs","Button","NOTIFICATION_AUTO_DISMISS_DELAY","ItemsQuoted","initialData","onItemCheckboxChange","onItemDropdownChange","onUpdate","onRemoveItemsRef","onRemoveModalStateChange","slots","quoteData","setQuoteData","useState","quantityChanges","setQuantityChanges","isModalOpen","setIsModalOpen","notificationState","setNotificationState","isRemoveModalOpen","setIsRemoveModalOpen","itemsToRemove","setItemsToRemove","isRemoving","setIsRemoving","removeNotificationState","setRemoveNotificationState","dropdownSelections","setDropdownSelections","useEffect","quoteDataEvent","events","data","quantitiesUpdatedEvent","itemsRemovedEvent","handleRemoveItems","useCallback","items","handleDismissRemoveBanner","handleItemDropdownChange","item","action","cartItem","prev","next","handleConfirmRemove","uidsToRemove","removeNegotiableQuoteItems","err","errorMessage","failedItem","handleCancelRemove","cancelledItem","ItemsQuotedComponent","canEdit","handleQuantityChange","newQuantity","handleUpdate","handleConfirmUpdate","quoteItemUid","quantity","updateQuantities","handleCancelUpdate","handleDismissBanner","quotePricesSummaryEntries","Price","InLineAlert","CheckWithCircle","WarningFilled","handleItemCheckboxChange","isSelected","removeConfirmationBanner","Fragment","Slot","ProductListTable","QuotePricesSummary"],"mappings":"ytBA6BO,MAAMA,EAA+D,CAAC,CAC3E,KAAAC,EAAO,GACP,MAAAC,EACA,QAAAC,EACA,YAAAC,EACA,aAAAC,EACA,SAAAC,EACA,UAAAC,EACA,QAAAC,EACA,gBAAAC,EACA,mBAAAC,EACA,GAAGC,CACL,IAAM,CACJ,MAAMC,EAAaC,EAAQ,CACzB,OAAQ,2BACR,QAAS,2BAAA,CACV,EAED,GAAI,CAACZ,EACH,OAAO,KAGT,KAAM,CAAE,UAAAa,EAAW,GAAGC,CAAA,EAAcJ,EAEpC,OACEK,EAACC,GAAA,CACE,GAAGF,EACJ,KAAM,SACN,QAASP,GAAWF,EACpB,eAAgB,GAChB,gBAAiB,GACjB,gBAAAG,EACA,cAAY,qBACZ,UAAAK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CAAA,CAAA,CAC1D,CAAA,EAKJnE,EAAChB,EAAA,CACC,KAAMkC,EACN,MAAOtB,EAAW,WAClB,QAASA,EAAW,iBACpB,YAAaA,EAAW,kBACxB,aAAcA,EAAW,kBACzB,SAAUqE,GACV,UAAWJ,GACX,mBAAAnE,GACA,cAAY,yBAAA,CAAA,EAIdM,EAAChB,EAAA,CACC,KAAMsC,EACN,MAAO1B,EAAW,iBAClB,QAASA,EAAW,uBACpB,YAAaA,EAAW,wBACxB,aACE8B,EACI9B,EAAW,iCACXA,EAAW,yBAEjB,SAAU0D,GACV,UAAWN,GACX,mBAAoB0B,GACpB,cAAY,oBAAA,CAAA,CACd,EACF,CAEJ"}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
/*! Copyright 2025 Adobe
|
|
2
|
+
All Rights Reserved. */
|
|
3
|
+
import{jsx as t}from"@dropins/tools/preact-jsx-runtime.js";import{useState as d,useEffect as g}from"@dropins/tools/preact-compat.js";import{Slot as u}from"@dropins/tools/lib.js";import{events as T}from"@dropins/tools/event-bus.js";import{Price as m}from"@dropins/tools/components.js";/* empty css */import{I as n,Q as b,P as x}from"./QuotePricesSummary.js";/* empty css *//* empty css *//* empty css */import{useText as f}from"@dropins/tools/i18n.js";const N=({templateData:c,slots:a,...l})=>{const[e,s]=d(c),i=f({subtotal:"NegotiableQuoteTemplate.Manage.quotePricesSummary.subtotal.excludingTax",grandTotal:"NegotiableQuoteTemplate.Manage.quotePricesSummary.grandTotal.includingTax",appliedTaxes:"NegotiableQuoteTemplate.Manage.quotePricesSummary.appliedTaxes"});if(g(()=>{const o=T.on("quote-management/quote-template-data",p=>{s(p.quoteTemplate)},{eager:!0});return()=>o==null?void 0:o.off()},[]),!e)return t(n,{loading:!0});const r=[];return e.prices.subtotalExcludingTax&&r.push({label:i.subtotal,id:"subtotal",value:t(m,{amount:e.prices.subtotalExcludingTax.value,currency:e.prices.subtotalExcludingTax.currency,weight:"normal"})}),e.prices.grandTotal&&r.push({label:i.grandTotal,id:"total",value:t(m,{amount:e.prices.grandTotal.value,currency:e.prices.grandTotal.currency}),strong:!0}),t(n,{"data-testid":"items-quoted-template-container",...l,loading:!1,table:t(u,{name:"ProductListTable",slot:a==null?void 0:a.ProductListTable,context:{items:e.items,canEdit:!1},children:t(x,{items:e.items,canEdit:!1})}),pricesSummary:t(u,{name:"QuotePricesSummary",slot:a==null?void 0:a.QuotePricesSummary,context:{items:e.items,prices:e.prices},children:t(b,{entries:r})})})};export{N as I};
|
|
4
|
+
//# sourceMappingURL=ItemsQuotedTemplate.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ItemsQuotedTemplate.js","sources":["/@dropins/storefront-quote-management/src/containers/ItemsQuotedTemplate/ItemsQuotedTemplate.tsx"],"sourcesContent":["/********************************************************************\n * Copyright 2025 Adobe\n * All Rights Reserved.\n *\n * NOTICE: Adobe permits you to use, modify, and distribute this \n * file in accordance with the terms of the Adobe license agreement \n * accompanying it. \n *******************************************************************/\n\nimport { HTMLAttributes, useEffect, useState } from 'preact/compat';\nimport { Container, Slot, SlotProps } from '@adobe-commerce/elsie/lib';\nimport { events } from '@adobe-commerce/event-bus';\nimport { Price } from '@adobe-commerce/elsie/components';\nimport { useText } from '@adobe-commerce/elsie/i18n';\nimport { NegotiableQuoteTemplateModel } from '@/quote-management/data/models/negotiable-quote-template-model';\nimport { QuotePricesSummary, ProductListTable, ItemsQuoted as ItemsQuotedComponent } from '@/quote-management/components';\n\nexport interface ItemsQuotedTemplateProps extends HTMLAttributes<HTMLDivElement> {\n templateData?: NegotiableQuoteTemplateModel;\n slots?: {\n ProductListTable?: SlotProps<{\n items: NegotiableQuoteTemplateModel['items'];\n canEdit: boolean;\n }>;\n QuotePricesSummary?: SlotProps<{\n items: NegotiableQuoteTemplateModel['items'];\n prices: NegotiableQuoteTemplateModel['prices'];\n }>;\n }\n}\n\nexport const ItemsQuotedTemplate: Container<ItemsQuotedTemplateProps> = ({\n templateData: initialData,\n slots,\n ...props\n}) => {\n const [templateData, setTemplateData] = useState<NegotiableQuoteTemplateModel | undefined>(initialData);\n\n const dictionary = useText({\n subtotal: 'NegotiableQuoteTemplate.Manage.quotePricesSummary.subtotal.excludingTax',\n grandTotal: 'NegotiableQuoteTemplate.Manage.quotePricesSummary.grandTotal.includingTax',\n appliedTaxes: 'NegotiableQuoteTemplate.Manage.quotePricesSummary.appliedTaxes',\n });\n\n useEffect(() => {\n const templateDataEvent = events.on('quote-management/quote-template-data', (payload) => {\n setTemplateData(payload.quoteTemplate);\n }, { eager: true });\n\n return () => templateDataEvent?.off();\n }, []);\n\n if (!templateData) {\n return <ItemsQuotedComponent loading={true} />;\n }\n\n const quotePricesSummaryEntries = [];\n\n templateData.prices.subtotalExcludingTax && quotePricesSummaryEntries.push({\n label: dictionary.subtotal,\n id: 'subtotal',\n value: <Price amount={templateData.prices.subtotalExcludingTax.value} currency={templateData.prices.subtotalExcludingTax.currency} weight='normal' />,\n })\n\n templateData.prices.grandTotal && quotePricesSummaryEntries.push({\n label: dictionary.grandTotal,\n id: 'total',\n value: <Price amount={templateData.prices.grandTotal.value} currency={templateData.prices.grandTotal.currency} />,\n strong: true,\n })\n\n return (\n <ItemsQuotedComponent data-testid=\"items-quoted-template-container\" {...props} loading={false}\n table={\n <Slot name=\"ProductListTable\" slot={slots?.ProductListTable}\n context={{\n items: templateData.items,\n canEdit: false,\n }}>\n\n <ProductListTable items={templateData.items} canEdit={false} />\n </Slot>\n }\n pricesSummary={<Slot name=\"QuotePricesSummary\" slot={slots?.QuotePricesSummary} context={{\n items: templateData.items,\n prices: templateData.prices,\n }}>\n <QuotePricesSummary entries={quotePricesSummaryEntries} />\n </Slot>\n }\n />\n );\n};\n"],"names":["ItemsQuotedTemplate","initialData","slots","props","templateData","setTemplateData","useState","dictionary","useText","useEffect","templateDataEvent","events","payload","jsx","ItemsQuotedComponent","quotePricesSummaryEntries","Price","Slot","ProductListTable","QuotePricesSummary"],"mappings":"whBA+BO,MAAMA,EAA2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MACpB,OAAQA,EAAa,MAAA,EAErB,SAAAS,EAACM,EAAA,CAAmB,QAASJ,EAA2B,CAAA,CAC1D,CAAA,CAAA,CAIN"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
/*! Copyright 2025 Adobe
|
|
2
2
|
All Rights Reserved. */
|
|
3
|
-
import{jsx as i,jsxs as u}from"@dropins/tools/preact-jsx-runtime.js";import{classes as
|
|
3
|
+
import{jsx as i,jsxs as u}from"@dropins/tools/preact-jsx-runtime.js";import{classes as p,VComponent as _}from"@dropins/tools/lib.js";/* empty css */import"@dropins/tools/components.js";import"@dropins/tools/preact-compat.js";import"@dropins/tools/preact.js";import"@dropins/tools/preact-hooks.js";/* empty css *//* empty css *//* empty css */const g=({label:o,price:e,classSuffixes:t=[],labelClassSuffix:r,testId:m,children:s,...a})=>i(y,{...a,label:o,price:e,classSuffixes:t,labelClassSuffix:r,testId:m,children:s}),y=({label:o,price:e,classSuffixes:t=[],labelClassSuffix:r,testId:m,children:s,...a})=>{const n="quote-order-summary__label",c="quote-order-summary__price";return u("div",{...a,...m?{"data-testid":m}:{},className:p(["quote-order-summary__entry",...t.map(d=>`quote-order-summary__${d}`)]),children:[i("span",{className:p([n,...r?[`${n}--${r}`]:[]]),children:o}),i(_,{node:e,className:p([c,...r?[`${c}--${r}`]:[]])}),s]})};export{g as O};
|
|
4
4
|
//# sourceMappingURL=OrderSummaryLine.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"OrderSummaryLine.js","sources":["/@dropins/storefront-quote-management/src/containers/OrderSummaryLine/OrderSummaryLine.tsx","/@dropins/storefront-quote-management/src/components/OrderSummaryLine/OrderSummaryLine.tsx"],"sourcesContent":["/********************************************************************\n * Copyright 2025 Adobe\n * All Rights Reserved.\n *\n * NOTICE: Adobe permits you to use, modify, and distribute this\n * file in accordance with the terms of the Adobe license agreement\n * accompanying it.\n *******************************************************************/\n\nimport { HTMLAttributes } from 'preact/compat';\nimport { Container } from '@adobe-commerce/elsie/lib';\nimport { VNode } from 'preact';\nimport { OrderSummaryLine as OrderSummaryLineComponent } from '@/quote-management/components';\n\nexport interface OrderSummaryLineProps\n extends Omit<HTMLAttributes<HTMLDivElement>, 'label'> {\n label: VNode | string;\n price: VNode<HTMLAttributes<HTMLSpanElement>>;\n classSuffixes?: Array<string>;\n labelClassSuffix?: string;\n testId?: string;\n children?: any;\n}\n\nexport const OrderSummaryLine: Container<OrderSummaryLineProps> = ({\n label,\n price,\n classSuffixes = [],\n labelClassSuffix,\n testId,\n children,\n ...props\n}) => {\n return (\n <OrderSummaryLineComponent\n {...props}\n label={label}\n price={price}\n classSuffixes={classSuffixes}\n labelClassSuffix={labelClassSuffix}\n testId={testId}\n >\n {children}\n </OrderSummaryLineComponent>\n );\n};\n","/********************************************************************\n * Copyright 2025 Adobe\n * All Rights Reserved.\n *\n * NOTICE: Adobe permits you to use, modify, and distribute this\n * file in accordance with the terms of the Adobe license agreement\n * accompanying it.\n *******************************************************************/\n\nimport '@/quote-management/components/OrderSummaryLine/OrderSummaryLine.css';\nimport { classes, VComponent } from '@adobe-commerce/elsie/lib';\nimport { FunctionComponent, VNode } from 'preact';\nimport { HTMLAttributes } from 'preact/compat';\nexport interface OrderSummaryLineComponentProps\n extends Omit<HTMLAttributes<HTMLDivElement>, 'label'> {\n label: VNode | string;\n price: VNode<HTMLAttributes<HTMLSpanElement>>;\n classSuffixes?: Array<string>;\n labelClassSuffix?: string;\n testId?: string;\n children?: any;\n}\n\nexport const OrderSummaryLine: FunctionComponent<\n OrderSummaryLineComponentProps\n> = ({\n label,\n price,\n classSuffixes = [],\n labelClassSuffix,\n testId,\n children,\n ...props\n}) => {\n const labelClass = 'quote-order-summary__label';\n const priceClass = 'quote-order-summary__price';\n return (\n <div\n {...props}\n {...(testId ? { 'data-testid': testId } : {})}\n className={classes([\n 'quote-order-summary__entry',\n ...classSuffixes.map(\n (classSuffix) => `quote-order-summary__${classSuffix}`\n ),\n ])}\n >\n <span\n className={classes([\n labelClass,\n ...(labelClassSuffix ? [`${labelClass}--${labelClassSuffix}`] : []),\n ])}\n >\n {label}\n </span>\n\n <VComponent\n node={price}\n className={classes([\n priceClass,\n ...(labelClassSuffix ? [`${priceClass}--${labelClassSuffix}`] : []),\n ])}\n />\n\n {children}\n </div>\n );\n};\n"],"names":["OrderSummaryLine","label","price","classSuffixes","labelClassSuffix","testId","children","props","jsx","OrderSummaryLineComponent","labelClass","priceClass","jsxs","classes","classSuffix","VComponent"],"mappings":"
|
|
1
|
+
{"version":3,"file":"OrderSummaryLine.js","sources":["/@dropins/storefront-quote-management/src/containers/OrderSummaryLine/OrderSummaryLine.tsx","/@dropins/storefront-quote-management/src/components/OrderSummaryLine/OrderSummaryLine.tsx"],"sourcesContent":["/********************************************************************\n * Copyright 2025 Adobe\n * All Rights Reserved.\n *\n * NOTICE: Adobe permits you to use, modify, and distribute this\n * file in accordance with the terms of the Adobe license agreement\n * accompanying it.\n *******************************************************************/\n\nimport { HTMLAttributes } from 'preact/compat';\nimport { Container } from '@adobe-commerce/elsie/lib';\nimport { VNode } from 'preact';\nimport { OrderSummaryLine as OrderSummaryLineComponent } from '@/quote-management/components';\n\nexport interface OrderSummaryLineProps\n extends Omit<HTMLAttributes<HTMLDivElement>, 'label'> {\n label: VNode | string;\n price: VNode<HTMLAttributes<HTMLSpanElement>>;\n classSuffixes?: Array<string>;\n labelClassSuffix?: string;\n testId?: string;\n children?: any;\n}\n\nexport const OrderSummaryLine: Container<OrderSummaryLineProps> = ({\n label,\n price,\n classSuffixes = [],\n labelClassSuffix,\n testId,\n children,\n ...props\n}) => {\n return (\n <OrderSummaryLineComponent\n {...props}\n label={label}\n price={price}\n classSuffixes={classSuffixes}\n labelClassSuffix={labelClassSuffix}\n testId={testId}\n >\n {children}\n </OrderSummaryLineComponent>\n );\n};\n","/********************************************************************\n * Copyright 2025 Adobe\n * All Rights Reserved.\n *\n * NOTICE: Adobe permits you to use, modify, and distribute this\n * file in accordance with the terms of the Adobe license agreement\n * accompanying it.\n *******************************************************************/\n\nimport '@/quote-management/components/OrderSummaryLine/OrderSummaryLine.css';\nimport { classes, VComponent } from '@adobe-commerce/elsie/lib';\nimport { FunctionComponent, VNode } from 'preact';\nimport { HTMLAttributes } from 'preact/compat';\nexport interface OrderSummaryLineComponentProps\n extends Omit<HTMLAttributes<HTMLDivElement>, 'label'> {\n label: VNode | string;\n price: VNode<HTMLAttributes<HTMLSpanElement>>;\n classSuffixes?: Array<string>;\n labelClassSuffix?: string;\n testId?: string;\n children?: any;\n}\n\nexport const OrderSummaryLine: FunctionComponent<\n OrderSummaryLineComponentProps\n> = ({\n label,\n price,\n classSuffixes = [],\n labelClassSuffix,\n testId,\n children,\n ...props\n}) => {\n const labelClass = 'quote-order-summary__label';\n const priceClass = 'quote-order-summary__price';\n return (\n <div\n {...props}\n {...(testId ? { 'data-testid': testId } : {})}\n className={classes([\n 'quote-order-summary__entry',\n ...classSuffixes.map(\n (classSuffix) => `quote-order-summary__${classSuffix}`\n ),\n ])}\n >\n <span\n className={classes([\n labelClass,\n ...(labelClassSuffix ? [`${labelClass}--${labelClassSuffix}`] : []),\n ])}\n >\n {label}\n </span>\n\n <VComponent\n node={price}\n className={classes([\n priceClass,\n ...(labelClassSuffix ? [`${priceClass}--${labelClassSuffix}`] : []),\n ])}\n />\n\n {children}\n </div>\n );\n};\n"],"names":["OrderSummaryLine","label","price","classSuffixes","labelClassSuffix","testId","children","props","jsx","OrderSummaryLineComponent","labelClass","priceClass","jsxs","classes","classSuffix","VComponent"],"mappings":"2aAwBO,MAAMA,EAAqD,CAAC,CACjE,MAAAC,EACA,MAAAC,EACA,cAAAC,EAAgB,CAAA,EAChB,iBAAAC,EACA,OAAAC,EACA,SAAAC,EACA,GAAGC,CACL,IAEIC,EAACC,EAAA,CACE,GAAGF,EACJ,MAAAN,EACA,MAAAC,EACA,cAAAC,EACA,iBAAAC,EACA,OAAAC,EAEC,SAAAC,CAAA,CAAA,ECnBMN,EAET,CAAC,CACH,MAAAC,EACA,MAAAC,EACA,cAAAC,EAAgB,CAAA,EAChB,iBAAAC,EACA,OAAAC,EACA,SAAAC,EACA,GAAGC,CACL,IAAM,CACJ,MAAMG,EAAa,6BACbC,EAAa,6BACnB,OACEC,EAAC,MAAA,CACE,GAAGL,EACH,GAAIF,EAAS,CAAE,cAAeA,CAAA,EAAW,CAAA,EAC1C,UAAWQ,EAAQ,CACjB,6BACA,GAAGV,EAAc,IACdW,GAAgB,wBAAwBA,CAAW,EAAA,CACtD,CACD,EAED,SAAA,CAAAN,EAAC,OAAA,CACC,UAAWK,EAAQ,CACjBH,EACA,GAAIN,EAAmB,CAAC,GAAGM,CAAU,KAAKN,CAAgB,EAAE,EAAI,CAAA,CAAC,CAClE,EAEA,SAAAH,CAAA,CAAA,EAGHO,EAACO,EAAA,CACC,KAAMb,EACN,UAAWW,EAAQ,CACjBF,EACA,GAAIP,EAAmB,CAAC,GAAGO,CAAU,KAAKP,CAAgB,EAAE,EAAI,CAAA,CAAC,CAClE,CAAA,CAAA,EAGFE,CAAA,CAAA,CAAA,CAGP"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
/*! Copyright 2025 Adobe
|
|
2
2
|
All Rights Reserved. */
|
|
3
|
-
import{jsx as e,jsxs as
|
|
3
|
+
import{jsx as e,jsxs as u}from"@dropins/tools/preact-jsx-runtime.js";import{classes as i,VComponent as m}from"@dropins/tools/lib.js";/* empty css */import{useText as d}from"@dropins/tools/i18n.js";const g=({className:o,comments:a,...s})=>{const n=d({emptyState:"NegotiableQuote.Manage.quoteComments.emptyState",by:"NegotiableQuote.Manage.quoteComments.by"});return!a||a.length===0?e("ul",{...s,className:i(["quote-management-quote-comments-list","quote-management-quote-comments-list--empty",o]),"data-testid":"quote-comments-list",children:e("li",{className:"quote-management-quote-comments-list__empty-state","data-testid":"quote-comments-empty-state",children:n.emptyState})}):e("ul",{...s,className:i(["quote-management-quote-comments-list",o]),"data-testid":"quote-comments-list",children:a.map(t=>u("li",{className:"quote-management-quote-comments-list__item","data-testid":`quote-comment-${t.uid}`,children:[u("div",{className:"quote-management-quote-comments-list__header",children:[e(m,{className:"quote-management-quote-comments-list__date",node:t.createdAt,"data-testid":`quote-comment-date-${t.uid}`}),e("span",{className:"quote-management-quote-comments-list__by",children:n.by}),e(m,{className:"quote-management-quote-comments-list__author",node:t.author,"data-testid":`quote-comment-author-${t.uid}`})]}),e(m,{className:"quote-management-quote-comments-list__text",node:t.text,"data-testid":`quote-comment-text-${t.uid}`})]},t.uid))})};export{g as Q};
|
|
4
4
|
//# sourceMappingURL=QuoteCommentsList.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"QuoteCommentsList.js","sources":["/@dropins/storefront-quote-management/src/components/QuoteCommentsList/QuoteCommentsList.tsx"
|
|
1
|
+
{"version":3,"file":"QuoteCommentsList.js","sources":["/@dropins/storefront-quote-management/src/components/QuoteCommentsList/QuoteCommentsList.tsx"],"sourcesContent":["/********************************************************************\n * Copyright 2025 Adobe\n * All Rights Reserved.\n *\n * NOTICE: Adobe permits you to use, modify, and distribute this\n * file in accordance with the terms of the Adobe license agreement\n * accompanying it.\n *******************************************************************/\n\nimport { FunctionComponent, VNode } from 'preact';\nimport { HTMLAttributes } from 'preact/compat';\nimport { classes, VComponent } from '@adobe-commerce/elsie/lib';\nimport { useText } from '@adobe-commerce/elsie/i18n';\nimport '@/quote-management/components/QuoteCommentsList/QuoteCommentsList.css';\n\nexport interface QuoteCommentsListProps\n extends HTMLAttributes<HTMLUListElement> {\n comments: Array<{\n uid: string;\n createdAt: VNode;\n author: VNode;\n text: VNode;\n }>;\n}\n\nexport const QuoteCommentsList: FunctionComponent<QuoteCommentsListProps> = ({\n className,\n comments,\n ...props\n}) => {\n const dictionary = useText({\n emptyState: 'NegotiableQuote.Manage.quoteComments.emptyState',\n by: 'NegotiableQuote.Manage.quoteComments.by',\n });\n\n if (!comments || comments.length === 0) {\n return (\n <ul\n {...props}\n className={classes([\n 'quote-management-quote-comments-list',\n 'quote-management-quote-comments-list--empty',\n className,\n ])}\n data-testid=\"quote-comments-list\"\n >\n <li\n className=\"quote-management-quote-comments-list__empty-state\"\n data-testid=\"quote-comments-empty-state\"\n >\n {dictionary.emptyState}\n </li>\n </ul>\n );\n }\n\n return (\n <ul\n {...props}\n className={classes(['quote-management-quote-comments-list', className])}\n data-testid=\"quote-comments-list\"\n >\n {comments.map((comment) => (\n <li\n key={comment.uid}\n className=\"quote-management-quote-comments-list__item\"\n data-testid={`quote-comment-${comment.uid}`}\n >\n <div className=\"quote-management-quote-comments-list__header\">\n <VComponent\n className=\"quote-management-quote-comments-list__date\"\n node={comment.createdAt}\n data-testid={`quote-comment-date-${comment.uid}`}\n />\n <span className=\"quote-management-quote-comments-list__by\">\n {dictionary.by}\n </span>\n <VComponent\n className=\"quote-management-quote-comments-list__author\"\n node={comment.author}\n data-testid={`quote-comment-author-${comment.uid}`}\n />\n </div>\n <VComponent\n className=\"quote-management-quote-comments-list__text\"\n node={comment.text}\n data-testid={`quote-comment-text-${comment.uid}`}\n />\n </li>\n ))}\n </ul>\n );\n};\n"],"names":["QuoteCommentsList","className","comments","props","dictionary","useText","jsx","classes","comment","jsxs","VComponent"],"mappings":"sNAyBO,MAAMA,EAA+D,CAAC,CAC3E,UAAAC,EACA,SAAAC,EACA,GAAGC,CACL,IAAM,CACJ,MAAMC,EAAaC,EAAQ,CACzB,WAAY,kDACZ,GAAI,yCAAA,CACL,EAED,MAAI,CAACH,GAAYA,EAAS,SAAW,EAEjCI,EAAC,KAAA,CACE,GAAGH,EACJ,UAAWI,EAAQ,CACjB,uCACA,8CACAN,CAAA,CACD,EACD,cAAY,sBAEZ,SAAAK,EAAC,KAAA,CACC,UAAU,oDACV,cAAY,6BAEX,SAAAF,EAAW,UAAA,CAAA,CACd,CAAA,EAMJE,EAAC,KAAA,CACE,GAAGH,EACJ,UAAWI,EAAQ,CAAC,uCAAwCN,CAAS,CAAC,EACtE,cAAY,sBAEX,SAAAC,EAAS,IAAKM,GACbC,EAAC,KAAA,CAEC,UAAU,6CACV,cAAa,iBAAiBD,EAAQ,GAAG,GAEzC,SAAA,CAAAC,EAAC,MAAA,CAAI,UAAU,+CACb,SAAA,CAAAH,EAACI,EAAA,CACC,UAAU,6CACV,KAAMF,EAAQ,UACd,cAAa,sBAAsBA,EAAQ,GAAG,EAAA,CAAA,EAEhDF,EAAC,OAAA,CAAK,UAAU,2CACb,WAAW,GACd,EACAA,EAACI,EAAA,CACC,UAAU,+CACV,KAAMF,EAAQ,OACd,cAAa,wBAAwBA,EAAQ,GAAG,EAAA,CAAA,CAClD,EACF,EACAF,EAACI,EAAA,CACC,UAAU,6CACV,KAAMF,EAAQ,KACd,cAAa,sBAAsBA,EAAQ,GAAG,EAAA,CAAA,CAChD,CAAA,EAvBKA,EAAQ,GAAA,CAyBhB,CAAA,CAAA,CAGP"}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
/*! Copyright 2025 Adobe
|
|
2
|
+
All Rights Reserved. */
|
|
3
|
+
import{jsx as o,jsxs as d}from"@dropins/tools/preact-jsx-runtime.js";import{useState as l,useEffect as f}from"@dropins/tools/preact-compat.js";import{getGlobalLocale as h}from"@dropins/tools/lib.js";import{Q as p}from"./QuoteCommentsList.js";import{events as g}from"@dropins/tools/event-bus.js";const j=({quoteData:a,...n})=>{var r;const[e,s]=l(a);if(f(()=>{const t=g.on("quote-management/quote-data",c=>{s(c.quote)},{eager:!0});return()=>t==null?void 0:t.off()},[]),!e)return null;const m=h()||"en-US",i=new Intl.DateTimeFormat(m,{year:"numeric",month:"short",day:"numeric",hour:"2-digit",minute:"2-digit",second:"2-digit",hour12:!0}),u=(r=e==null?void 0:e.comments)==null?void 0:r.map(t=>({uid:t.uid,createdAt:o("span",{children:i.format(new Date(t.createdAt))}),author:d("span",{children:[t.author.firstname," ",t.author.lastname]}),text:o("p",{children:t.text})}));return o(p,{"data-testid":"quote-comments-list-container",...n,comments:u||[]})};export{j as Q};
|
|
4
|
+
//# sourceMappingURL=QuoteCommentsList3.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"QuoteCommentsList3.js","sources":["/@dropins/storefront-quote-management/src/containers/QuoteCommentsList/QuoteCommentsList.tsx"],"sourcesContent":["/********************************************************************\n * Copyright 2025 Adobe\n * All Rights Reserved.\n *\n * NOTICE: Adobe permits you to use, modify, and distribute this\n * file in accordance with the terms of the Adobe license agreement\n * accompanying it.\n *******************************************************************/\n\nimport { HTMLAttributes, useEffect, useState } from 'preact/compat';\nimport { Container, getGlobalLocale } from '@adobe-commerce/elsie/lib';\nimport { QuoteCommentsList as QuoteCommentsListComponent } from '@/quote-management/components/QuoteCommentsList';\nimport { NegotiableQuoteModel } from '@/quote-management/data/models/negotiable-quote-model';\nimport { events } from '@adobe-commerce/event-bus';\n\nexport interface QuoteCommentsListProps\n extends HTMLAttributes<HTMLUListElement> {\n quoteData?: NegotiableQuoteModel;\n}\n\nexport const QuoteCommentsList: Container<QuoteCommentsListProps> = ({\n quoteData: initialData,\n ...props\n}) => {\n const [quoteData, setQuoteData] = useState<NegotiableQuoteModel | undefined>(\n initialData\n );\n\n useEffect(() => {\n const quoteDataEvent = events.on(\n 'quote-management/quote-data',\n (data: { quote: NegotiableQuoteModel }) => {\n setQuoteData(data.quote);\n },\n {\n eager: true,\n }\n );\n return () => quoteDataEvent?.off();\n }, []);\n\n if (!quoteData) {\n return null;\n }\n\n // Format comments data\n const calculatedLocale = getGlobalLocale() || 'en-US';\n const dateFormatter = new Intl.DateTimeFormat(calculatedLocale, {\n year: 'numeric',\n month: 'short',\n day: 'numeric',\n hour: '2-digit',\n minute: '2-digit',\n second: '2-digit',\n hour12: true,\n });\n\n const formattedComments = quoteData?.comments?.map((comment) => ({\n uid: comment.uid,\n createdAt: <span>{dateFormatter.format(new Date(comment.createdAt))}</span>,\n author: (\n <span>\n {comment.author.firstname} {comment.author.lastname}\n </span>\n ),\n text: <p>{comment.text}</p>,\n }));\n\n return (\n <QuoteCommentsListComponent\n data-testid=\"quote-comments-list-container\"\n {...props}\n comments={formattedComments || []}\n />\n );\n};\n"],"names":["QuoteCommentsList","initialData","props","quoteData","setQuoteData","useState","useEffect","quoteDataEvent","events","data","calculatedLocale","getGlobalLocale","dateFormatter","formattedComments","_a","comment","jsx","QuoteCommentsListComponent"],"mappings":"uSAoBO,MAAMA,EAAuD,CAAC,CACnE,UAAWC,EACX,GAAGC,CACL,IAAM,OACJ,KAAM,CAACC,EAAWC,CAAY,EAAIC,EAChCJ,CAAA,EAgBF,GAbAK,EAAU,IAAM,CACd,MAAMC,EAAiBC,EAAO,GAC5B,8BACCC,GAA0C,CACzCL,EAAaK,EAAK,KAAK,CACzB,EACA,CACE,MAAO,EAAA,CACT,EAEF,MAAO,IAAMF,GAAA,YAAAA,EAAgB,KAC/B,EAAG,CAAA,CAAE,EAED,CAACJ,EACH,OAAO,KAIT,MAAMO,EAAmBC,KAAqB,QACxCC,EAAgB,IAAI,KAAK,eAAeF,EAAkB,CAC9D,KAAM,UACN,MAAO,QACP,IAAK,UACL,KAAM,UACN,OAAQ,UACR,OAAQ,UACR,OAAQ,EAAA,CACT,EAEKG,GAAoBC,EAAAX,GAAA,YAAAA,EAAW,WAAX,YAAAW,EAAqB,IAAKC,IAAa,CAC/D,IAAKA,EAAQ,IACb,UAAWC,EAAC,OAAA,CAAM,SAAAJ,EAAc,OAAO,IAAI,KAAKG,EAAQ,SAAS,CAAC,CAAA,CAAE,EACpE,SACG,OAAA,CACE,SAAA,CAAAA,EAAQ,OAAO,UAAU,IAAEA,EAAQ,OAAO,QAAA,EAC7C,EAEF,KAAMC,EAAC,IAAA,CAAG,SAAAD,EAAQ,IAAA,CAAK,CAAA,IAGzB,OACEC,EAACC,EAAA,CACC,cAAY,gCACX,GAAGf,EACJ,SAAUW,GAAqB,CAAA,CAAC,CAAA,CAGtC"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
/*! Copyright 2025 Adobe
|
|
2
2
|
All Rights Reserved. */
|
|
3
|
-
import{jsxs as d,jsx as
|
|
3
|
+
import{jsxs as d,jsx as s}from"@dropins/tools/preact-jsx-runtime.js";import{getGlobalLocale as U,classes as P}from"@dropins/tools/lib.js";import{g as Q,f as y}from"./dateUtils.js";/* empty css */import{useText as I}from"@dropins/tools/i18n.js";const V=({className:_,children:x,history:q,items:h,buyer:n,salesRepName:F,...w})=>{const E=U()||"en-US",t=I({quoteCreated:"historyLog.changeTypes.created",quoteUpdated:"historyLog.changeTypes.updated",statusChanged:"historyLog.changeTypes.statusChanged",commentAdded:"historyLog.changeTypes.commentAdded",expirationChanged:"historyLog.changeTypes.expirationChanged",buyerNoteAdded:"historyLog.noteTypes.buyerNoteAdded",sellerNoteAdded:"historyLog.noteTypes.sellerNoteAdded",buyerLabel:"historyLog.authorLabels.buyer",sellerLabel:"historyLog.authorLabels.seller",commentDetail:"historyLog.changeDetails.comment",statusChangedFromTo:"historyLog.changeDetails.statusChangedFromTo",statusSetTo:"historyLog.changeDetails.statusSetTo",expirationChangedFromTo:"historyLog.changeDetails.expirationChangedFromTo",expirationSetTo:"historyLog.changeDetails.expirationSetTo",totalChangedFromTo:"historyLog.changeDetails.totalChangedFromTo",customChange:"historyLog.changeDetails.customChange",productsRemovedFromCatalog:"historyLog.changeDetails.productsRemovedFromCatalog",productsRemovedFromQuote:"historyLog.changeDetails.productsRemovedFromQuote",noDetailsAvailable:"historyLog.changeDetails.noDetailsAvailable",emptyState:"historyLog.emptyState",never:"dateUtils.never"}),p=new Intl.DateTimeFormat(E,{year:"numeric",month:"long",day:"numeric",hour:"2-digit",minute:"2-digit",second:"2-digit",timeZone:Q()}),S=e=>{switch(e){case"CREATED":return t.quoteCreated;case"UPDATED":return t.quoteUpdated;case"STATUS_CHANGED":return t.statusChanged;case"COMMENT_ADDED":return t.commentAdded;case"EXPIRATION_CHANGED":return t.expirationChanged;default:return e.replace(/_/g," ").toLowerCase().replace(/\b\w/g,o=>o.toUpperCase())}},A=e=>{var a,m,c,u,i,v,C,g,L,f,D,N;const o=[];if((a=e==null?void 0:e.commentAdded)!=null&&a.comment&&o.push(t.commentDetail.replace("{comment}",e.commentAdded.comment)),(m=e==null?void 0:e.statuses)!=null&&m.changes&&e.statuses.changes.forEach(r=>{r.oldStatus&&r.newStatus?o.push(t.statusChangedFromTo.replace("{oldStatus}",r.oldStatus).replace("{newStatus}",r.newStatus)):r.newStatus&&o.push(t.statusSetTo.replace("{newStatus}",r.newStatus))}),(c=e==null?void 0:e.expiration)!=null&&c.newExpiration&&((u=e==null?void 0:e.expiration)!=null&&u.oldExpiration)){const r=y(e.expiration.newExpiration,p),l=y(e.expiration.oldExpiration,p);o.push(t.expirationChangedFromTo.replace("{oldExpiration}",l).replace("{newExpiration}",r))}else if((i=e==null?void 0:e.expiration)!=null&&i.newExpiration){const r=y(e.expiration.newExpiration,p);o.push(t.expirationSetTo.replace("{newExpiration}",r))}if((v=e==null?void 0:e.total)!=null&&v.newPrice&&((C=e==null?void 0:e.total)!=null&&C.oldPrice)){const r=`${e.total.newPrice.currency} ${e.total.newPrice.value}`,l=`${e.total.oldPrice.currency} ${e.total.oldPrice.value}`;o.push(t.totalChangedFromTo.replace("{oldTotal}",l).replace("{newTotal}",r))}if((g=e==null?void 0:e.customChanges)!=null&&g.title&&((L=e==null?void 0:e.customChanges)!=null&&L.old_value)&&((f=e==null?void 0:e.customChanges)!=null&&f.new_value)&&o.push(t.customChange.replace("{title}",e.customChanges.title).replace("{oldValue}",e.customChanges.old_value).replace("{newValue}",e.customChanges.new_value)),(D=e==null?void 0:e.productsRemoved)!=null&&D.productsRemovedFromCatalog&&e.productsRemoved.productsRemovedFromCatalog.length>0&&o.push(t.productsRemovedFromCatalog.replace("{products}",e.productsRemoved.productsRemovedFromCatalog.join(", "))),(N=e==null?void 0:e.productsRemoved)!=null&&N.productsRemovedFromQuote&&e.productsRemoved.productsRemovedFromQuote.length>0){const r=e.productsRemoved.productsRemovedFromQuote.map(l=>l.name||l.sku||l.uid).join(", ");o.push(t.productsRemovedFromQuote.replace("{products}",r))}return o.length>0?o:[t.noDetailsAvailable]},b=(()=>{const e=[],o=(a,m,c,u)=>{a&&Array.isArray(a)&&a.forEach(i=>{i&&i.note&&i.note.trim()&&e.push({...i,type:m,productName:u.product.name,productSku:u.product.sku,authorName:c})})};return h&&h.forEach(a=>{o(a.noteFromBuyer,"buyer",`${n.firstname} ${n.lastname} ${t.buyerLabel}`,a),o(a.noteFromSeller,"seller",`${F} ${t.sellerLabel}`,a)}),e})(),R=(q||[]).map(e=>({...e,entryType:"history"})),$=b.map(e=>({...e,entryType:"note"})),T=[...R,...$];return d("div",{...w,className:P(["quote-management-quote-history-log",_]),children:[T.length>0?s("div",{className:"quote-management-quote-history-log__entries",children:T.map((e,o)=>d("div",{className:"quote-management-quote-history-log__entry",children:[d("div",{className:"quote-management-quote-history-log__entry-header",children:[d("div",{className:"quote-management-quote-history-log__entry-meta",children:[s("span",{className:"quote-management-quote-history-log__entry-date",children:p.format(new Date(e.createdAt))}),s("span",{className:"quote-management-quote-history-log__entry-author",children:e.entryType==="history"?`by ${e.author.firstname} ${e.author.lastname} ${e.author.firstname===n.firstname&&e.author.lastname===n.lastname?t.buyerLabel:t.sellerLabel}`:`by ${e.authorName}`})]}),s("div",{className:"quote-management-quote-history-log__entry-type",children:e.entryType==="history"?S(e.changeType):e.type==="buyer"?t.buyerNoteAdded:t.sellerNoteAdded})]}),s("div",{className:"quote-management-quote-history-log__entry-changes",children:e.entryType==="history"?A(e.changes).map((a,m)=>s("div",{className:"quote-management-quote-history-log__entry-change",children:a},m)):d("div",{className:"quote-management-quote-history-log__entry-change",children:[d("div",{children:[e.productName,"(",e.productSku,")"]}),d("div",{children:['"',e.note,'"']})]})})]},e.entryType==="history"?e.uid:`${e.noteUid}-${o}`))}):s("div",{className:"quote-management-quote-history-log__empty",children:t.emptyState}),x]})};export{V as Q};
|
|
4
4
|
//# sourceMappingURL=QuoteHistoryLog.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"QuoteHistoryLog.js","sources":["/@dropins/storefront-quote-management/src/components/QuoteHistoryLog/QuoteHistoryLog.tsx","/@dropins/storefront-quote-management/src/containers/QuoteHistoryLog/QuoteHistoryLog.tsx"],"sourcesContent":["/********************************************************************\n * Copyright 2025 Adobe\n * All Rights Reserved.\n *\n * NOTICE: Adobe permits you to use, modify, and distribute this\n * file in accordance with the terms of the Adobe license agreement\n * accompanying it.\n *******************************************************************/\n\nimport { FunctionComponent } from 'preact';\nimport { HTMLAttributes } from 'preact/compat';\nimport { classes, getGlobalLocale } from '@adobe-commerce/elsie/lib';\nimport { useText } from '@adobe-commerce/elsie/i18n';\nimport { NegotiableQuoteModel } from '@/quote-management/data/models/negotiable-quote-model';\nimport {\n formatExpirationDate,\n getUserTimezone,\n} from '@/quote-management/utils/dateUtils';\nimport '@/quote-management/components/QuoteHistoryLog/QuoteHistoryLog.css';\n\nexport interface QuoteHistoryLogProps extends HTMLAttributes<HTMLDivElement> {\n quoteData?: NegotiableQuoteModel;\n}\n\nexport const QuoteHistoryLog: FunctionComponent<QuoteHistoryLogProps> = ({\n className,\n children,\n quoteData,\n ...props\n}) => {\n // Fallback to en-US if no locale is set\n const calculatedLocale = getGlobalLocale() || 'en-US';\n\n const dictionary = useText({\n quoteCreated: 'historyLog.changeTypes.created',\n quoteUpdated: 'historyLog.changeTypes.updated',\n statusChanged: 'historyLog.changeTypes.statusChanged',\n commentAdded: 'historyLog.changeTypes.commentAdded',\n expirationChanged: 'historyLog.changeTypes.expirationChanged',\n buyerNoteAdded: 'historyLog.noteTypes.buyerNoteAdded',\n sellerNoteAdded: 'historyLog.noteTypes.sellerNoteAdded',\n buyerLabel: 'historyLog.authorLabels.buyer',\n sellerLabel: 'historyLog.authorLabels.seller',\n commentDetail: 'historyLog.changeDetails.comment',\n statusChangedFromTo: 'historyLog.changeDetails.statusChangedFromTo',\n statusSetTo: 'historyLog.changeDetails.statusSetTo',\n expirationChangedFromTo: 'historyLog.changeDetails.expirationChangedFromTo',\n expirationSetTo: 'historyLog.changeDetails.expirationSetTo',\n totalChangedFromTo: 'historyLog.changeDetails.totalChangedFromTo',\n customChange: 'historyLog.changeDetails.customChange',\n productsRemovedFromCatalog: 'historyLog.changeDetails.productsRemovedFromCatalog',\n productsRemovedFromQuote: 'historyLog.changeDetails.productsRemovedFromQuote',\n noDetailsAvailable: 'historyLog.changeDetails.noDetailsAvailable',\n emptyState: 'historyLog.emptyState',\n never: 'dateUtils.never',\n });\n\n const dateFormatter = new Intl.DateTimeFormat(calculatedLocale, {\n year: 'numeric',\n month: 'long',\n day: 'numeric',\n hour: '2-digit',\n minute: '2-digit',\n second: '2-digit',\n timeZone: getUserTimezone(),\n });\n\n const formatChangeType = (changeType: string) => {\n switch (changeType) {\n case 'CREATED':\n return dictionary.quoteCreated;\n case 'UPDATED':\n return dictionary.quoteUpdated;\n case 'STATUS_CHANGED':\n return dictionary.statusChanged;\n case 'COMMENT_ADDED':\n return dictionary.commentAdded;\n case 'EXPIRATION_CHANGED':\n return dictionary.expirationChanged;\n default:\n return changeType\n .replace(/_/g, ' ')\n .toLowerCase()\n .replace(/\\b\\w/g, (l) => l.toUpperCase());\n }\n };\n\n // Handle status or expiration changes\n const formatChanges = (changes: any) => {\n const changeDetails = [];\n\n if (changes?.commentAdded?.comment) {\n changeDetails.push(\n dictionary.commentDetail.replace(\n '{comment}',\n changes.commentAdded.comment\n )\n );\n }\n\n if (changes?.statuses?.changes) {\n changes.statuses.changes.forEach((statusChange: any) => {\n if (statusChange.oldStatus && statusChange.newStatus) {\n changeDetails.push(\n dictionary.statusChangedFromTo\n .replace('{oldStatus}', statusChange.oldStatus)\n .replace('{newStatus}', statusChange.newStatus)\n );\n } else if (statusChange.newStatus) {\n changeDetails.push(\n dictionary.statusSetTo.replace(\n '{newStatus}',\n statusChange.newStatus\n )\n );\n }\n });\n }\n\n if (\n changes?.expiration?.newExpiration &&\n changes?.expiration?.oldExpiration\n ) {\n const newDateFormatted = formatExpirationDate(\n changes.expiration.newExpiration,\n dateFormatter\n );\n const oldDateFormatted = formatExpirationDate(\n changes.expiration.oldExpiration,\n dateFormatter\n );\n changeDetails.push(\n dictionary.expirationChangedFromTo\n .replace('{oldExpiration}', oldDateFormatted)\n .replace('{newExpiration}', newDateFormatted)\n );\n } else if (changes?.expiration?.newExpiration) {\n const newDateFormatted = formatExpirationDate(\n changes.expiration.newExpiration,\n dateFormatter\n );\n changeDetails.push(\n dictionary.expirationSetTo.replace('{newExpiration}', newDateFormatted)\n );\n }\n\n if (changes?.total?.newPrice && changes?.total?.oldPrice) {\n const newTotal = `${changes.total.newPrice.currency} ${changes.total.newPrice.value}`;\n const oldTotal = `${changes.total.oldPrice.currency} ${changes.total.oldPrice.value}`;\n changeDetails.push(\n dictionary.totalChangedFromTo\n .replace('{oldTotal}', oldTotal)\n .replace('{newTotal}', newTotal)\n );\n }\n\n if (changes?.customChanges?.title && changes?.customChanges?.old_value && changes?.customChanges?.new_value) {\n changeDetails.push(\n dictionary.customChange\n .replace('{title}', changes.customChanges.title)\n .replace('{oldValue}', changes.customChanges.old_value)\n .replace('{newValue}', changes.customChanges.new_value)\n );\n }\n\n if (changes?.productsRemoved?.productsRemovedFromCatalog && changes.productsRemoved.productsRemovedFromCatalog.length > 0) {\n changeDetails.push(\n dictionary.productsRemovedFromCatalog.replace(\n '{products}',\n changes.productsRemoved.productsRemovedFromCatalog.join(', ')\n )\n );\n }\n\n if (changes?.productsRemoved?.productsRemovedFromQuote && changes.productsRemoved.productsRemovedFromQuote.length > 0) {\n const productNames = changes.productsRemoved.productsRemovedFromQuote.map((product: any) => \n product.name || product.sku || product.uid\n ).join(', ');\n changeDetails.push(\n dictionary.productsRemovedFromQuote.replace('{products}', productNames)\n );\n }\n\n return changeDetails.length > 0\n ? changeDetails\n : [dictionary.noDetailsAvailable];\n };\n\n // Get item notes outside of history entries\n const getItemNotes = () => {\n const notes: Array<{\n createdAt: string;\n creatorId: string;\n creatorType: string;\n negotiableQuoteItemUid: string;\n note: string;\n noteUid: string;\n type: 'buyer' | 'seller';\n productName: string;\n productSku: string;\n authorName: string;\n }> = [];\n\n const processNotes = (\n noteArray: any | undefined,\n type: 'buyer' | 'seller',\n authorName: string,\n item: any\n ) => {\n if (noteArray && Array.isArray(noteArray)) {\n noteArray.forEach((note) => {\n if (note && note.note && note.note.trim()) {\n notes.push({\n ...note,\n type,\n productName: item.product.name,\n productSku: item.product.sku,\n authorName,\n });\n }\n });\n }\n };\n\n if (quoteData?.items) {\n quoteData.items.forEach((item) => {\n processNotes(\n item.noteFromBuyer,\n 'buyer',\n `${quoteData.buyer.firstname} ${quoteData.buyer.lastname} ${dictionary.buyerLabel}`,\n item\n );\n\n processNotes(\n item.noteFromSeller,\n 'seller',\n `${quoteData.salesRepName} ${dictionary.sellerLabel}`,\n item\n );\n });\n }\n\n return notes;\n };\n\n const itemNotes = getItemNotes();\n\n // Get history entries\n const historyEntries = (quoteData?.history || []).map((entry) => ({\n ...entry,\n entryType: 'history' as const,\n }));\n const noteEntries = itemNotes.map((note) => ({\n ...note,\n entryType: 'note' as const,\n }));\n\n // Combine history and item notes without sorting\n const allEntries = [...historyEntries, ...noteEntries];\n\n return (\n <div\n {...props}\n className={classes(['quote-management-quote-history-log', className])}\n >\n {allEntries.length > 0 ? (\n <div className=\"quote-management-quote-history-log__entries\">\n {allEntries.map((entry, index) => (\n <div\n key={\n entry.entryType === 'history'\n ? entry.uid\n : `${entry.noteUid}-${index}`\n }\n className=\"quote-management-quote-history-log__entry\"\n >\n <div className=\"quote-management-quote-history-log__entry-header\">\n <div className=\"quote-management-quote-history-log__entry-meta\">\n <span className=\"quote-management-quote-history-log__entry-date\">\n {dateFormatter.format(new Date(entry.createdAt))}\n </span>\n <span className=\"quote-management-quote-history-log__entry-author\">\n {entry.entryType === 'history'\n ? `by ${entry.author.firstname} ${\n entry.author.lastname\n } ${\n entry.author.firstname ===\n quoteData?.buyer.firstname &&\n entry.author.lastname === quoteData?.buyer.lastname\n ? dictionary.buyerLabel\n : dictionary.sellerLabel\n }`\n : `by ${entry.authorName}`}\n </span>\n </div>\n <div className=\"quote-management-quote-history-log__entry-type\">\n {entry.entryType === 'history'\n ? formatChangeType(entry.changeType)\n : entry.type === 'buyer'\n ? dictionary.buyerNoteAdded\n : dictionary.sellerNoteAdded}\n </div>\n </div>\n <div className=\"quote-management-quote-history-log__entry-changes\">\n {entry.entryType === 'history' ? (\n formatChanges(entry.changes).map((change, changeIndex) => (\n <div\n key={changeIndex}\n className=\"quote-management-quote-history-log__entry-change\"\n >\n {change}\n </div>\n ))\n ) : (\n <div className=\"quote-management-quote-history-log__entry-change\">\n <div>\n {entry.productName}({entry.productSku})\n </div>\n <div>\"{entry.note}\"</div>\n </div>\n )}\n </div>\n </div>\n ))}\n </div>\n ) : (\n <div className=\"quote-management-quote-history-log__empty\">\n {dictionary.emptyState}\n </div>\n )}\n {children}\n </div>\n );\n};\n","/********************************************************************\n * Copyright 2025 Adobe\n * All Rights Reserved.\n *\n * NOTICE: Adobe permits you to use, modify, and distribute this \n * file in accordance with the terms of the Adobe license agreement \n * accompanying it. \n *******************************************************************/\n \nimport { HTMLAttributes, useEffect, useState } from 'preact/compat';\nimport { Container } from '@adobe-commerce/elsie/lib';\nimport { NegotiableQuoteModel } from '@/quote-management/data/models/negotiable-quote-model';\nimport { events } from '@adobe-commerce/event-bus';\nimport { QuoteHistoryLog as QuoteHistoryLogComponent } from '@/quote-management/components/QuoteHistoryLog';\n\nexport interface QuoteHistoryLogProps extends HTMLAttributes<HTMLDivElement> {\n quoteData?: NegotiableQuoteModel;\n}\n \nexport const QuoteHistoryLog: Container<QuoteHistoryLogProps> = ({ quoteData: initialData, ...props }) => {\n\n const [quoteData, setQuoteData] = useState<NegotiableQuoteModel | undefined>(\n initialData\n );\n\n useEffect(() => {\n const quoteDataEvent = events.on(\n 'quote-management/quote-data',\n (data: { quote: NegotiableQuoteModel }) => {\n setQuoteData(data.quote);\n },\n {\n eager: true,\n }\n );\n return () => quoteDataEvent?.off();\n }, []);\n\n if (!quoteData) {\n return null;\n }\n\n return (\n <div {...props}>\n <QuoteHistoryLogComponent quoteData={quoteData} />\n </div>\n );\n};\n"],"names":["QuoteHistoryLog","className","children","quoteData","props","calculatedLocale","getGlobalLocale","dictionary","useText","dateFormatter","getUserTimezone","formatChangeType","changeType","l","formatChanges","changes","changeDetails","_a","_b","statusChange","_c","_d","newDateFormatted","formatExpirationDate","oldDateFormatted","_e","_f","_g","newTotal","oldTotal","_h","_i","_j","_k","_l","productNames","product","itemNotes","notes","processNotes","noteArray","type","authorName","item","note","historyEntries","entry","noteEntries","allEntries","jsxs","classes","jsx","index","change","changeIndex","initialData","setQuoteData","useState","useEffect","quoteDataEvent","events","data","QuoteHistoryLogComponent"],"mappings":"kYAwBO,MAAMA,EAA2D,CAAC,CACvE,UAAAC,EACA,SAAAC,EACA,UAAAC,EACA,GAAGC,CACL,IAAM,CAEJ,MAAMC,EAAmBC,KAAqB,QAExCC,EAAaC,EAAQ,CACzB,aAAc,iCACd,aAAc,iCACd,cAAe,uCACf,aAAc,sCACd,kBAAmB,2CACnB,eAAgB,sCAChB,gBAAiB,uCACjB,WAAY,gCACZ,YAAa,iCACb,cAAe,mCACf,oBAAqB,+CACrB,YAAa,uCACb,wBAAyB,mDACzB,gBAAiB,2CACjB,mBAAoB,8CACpB,aAAc,wCACd,2BAA4B,sDAC5B,yBAA0B,oDAC1B,mBAAoB,8CACpB,WAAY,wBACZ,MAAO,iBAAA,CACR,EAEKC,EAAgB,IAAI,KAAK,eAAeJ,EAAkB,CAC9D,KAAM,UACN,MAAO,OACP,IAAK,UACL,KAAM,UACN,OAAQ,UACR,OAAQ,UACR,SAAUK,EAAA,CAAgB,CAC3B,EAEKC,EAAoBC,GAAuB,CAC/C,OAAQA,EAAA,CACN,IAAK,UACH,OAAOL,EAAW,aACpB,IAAK,UACH,OAAOA,EAAW,aACpB,IAAK,iBACH,OAAOA,EAAW,cACpB,IAAK,gBACH,OAAOA,EAAW,aACpB,IAAK,qBACH,O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AAA,YAAAA,EAAgB,KAC/B,EAAG,CAAA,CAAE,EAEAxD,IAKF,MAAA,CAAK,GAAGC,EACP,SAAA+C,EAACW,EAAA,CAAyB,UAAA3D,EAAsB,EAClD,EANO,IAQX"}
|
|
1
|
+
{"version":3,"file":"QuoteHistoryLog.js","sources":["/@dropins/storefront-quote-management/src/components/QuoteHistoryLog/QuoteHistoryLog.tsx"],"sourcesContent":["/********************************************************************\n * Copyright 2025 Adobe\n * All Rights Reserved.\n *\n * NOTICE: Adobe permits you to use, modify, and distribute this\n * file in accordance with the terms of the Adobe license agreement\n * accompanying it.\n *******************************************************************/\n\nimport { FunctionComponent } from 'preact';\nimport { HTMLAttributes } from 'preact/compat';\nimport { classes, getGlobalLocale } from '@adobe-commerce/elsie/lib';\nimport { useText } from '@adobe-commerce/elsie/i18n';\nimport {\n formatExpirationDate,\n getUserTimezone,\n} from '@/quote-management/utils/dateUtils';\nimport '@/quote-management/components/QuoteHistoryLog/QuoteHistoryLog.css';\n\nexport interface HistoryEntry {\n uid: string;\n createdAt: string;\n author: {\n firstname: string;\n lastname: string;\n };\n changeType: string;\n changes: {\n commentAdded?: { comment: string };\n statuses?: { changes: Array<{ oldStatus?: string; newStatus?: string }> };\n expiration?: { oldExpiration?: string; newExpiration?: string };\n total?: {\n oldPrice?: { value: number; currency: string };\n newPrice?: { value: number; currency: string };\n };\n customChanges?: { title: string; old_value: string; new_value: string };\n productsRemoved?: {\n productsRemovedFromCatalog?: string[];\n productsRemovedFromQuote?: Array<{ name?: string; sku?: string; uid: string }>;\n };\n };\n}\n\nexport interface ItemNote {\n createdAt: string;\n creatorId: number;\n creatorType: number;\n negotiableQuoteItemUid: string;\n note: string;\n noteUid: string;\n}\n\nexport interface QuoteItem {\n product: {\n name: string;\n sku: string;\n };\n noteFromBuyer?: ItemNote[];\n noteFromSeller?: ItemNote[];\n}\n\nexport interface QuoteHistoryLogProps extends HTMLAttributes<HTMLDivElement> {\n history?: HistoryEntry[];\n items?: QuoteItem[];\n buyer: {\n firstname: string;\n lastname: string;\n };\n salesRepName: string;\n}\n\nexport const QuoteHistoryLog: FunctionComponent<QuoteHistoryLogProps> = ({\n className,\n children,\n history,\n items,\n buyer,\n salesRepName,\n ...props\n}) => {\n // Fallback to en-US if no locale is set\n const calculatedLocale = getGlobalLocale() || 'en-US';\n\n const dictionary = useText({\n quoteCreated: 'historyLog.changeTypes.created',\n quoteUpdated: 'historyLog.changeTypes.updated',\n statusChanged: 'historyLog.changeTypes.statusChanged',\n commentAdded: 'historyLog.changeTypes.commentAdded',\n expirationChanged: 'historyLog.changeTypes.expirationChanged',\n buyerNoteAdded: 'historyLog.noteTypes.buyerNoteAdded',\n sellerNoteAdded: 'historyLog.noteTypes.sellerNoteAdded',\n buyerLabel: 'historyLog.authorLabels.buyer',\n sellerLabel: 'historyLog.authorLabels.seller',\n commentDetail: 'historyLog.changeDetails.comment',\n statusChangedFromTo: 'historyLog.changeDetails.statusChangedFromTo',\n statusSetTo: 'historyLog.changeDetails.statusSetTo',\n expirationChangedFromTo: 'historyLog.changeDetails.expirationChangedFromTo',\n expirationSetTo: 'historyLog.changeDetails.expirationSetTo',\n totalChangedFromTo: 'historyLog.changeDetails.totalChangedFromTo',\n customChange: 'historyLog.changeDetails.customChange',\n productsRemovedFromCatalog: 'historyLog.changeDetails.productsRemovedFromCatalog',\n productsRemovedFromQuote: 'historyLog.changeDetails.productsRemovedFromQuote',\n noDetailsAvailable: 'historyLog.changeDetails.noDetailsAvailable',\n emptyState: 'historyLog.emptyState',\n never: 'dateUtils.never',\n });\n\n const dateFormatter = new Intl.DateTimeFormat(calculatedLocale, {\n year: 'numeric',\n month: 'long',\n day: 'numeric',\n hour: '2-digit',\n minute: '2-digit',\n second: '2-digit',\n timeZone: getUserTimezone(),\n });\n\n const formatChangeType = (changeType: string) => {\n switch (changeType) {\n case 'CREATED':\n return dictionary.quoteCreated;\n case 'UPDATED':\n return dictionary.quoteUpdated;\n case 'STATUS_CHANGED':\n return dictionary.statusChanged;\n case 'COMMENT_ADDED':\n return dictionary.commentAdded;\n case 'EXPIRATION_CHANGED':\n return dictionary.expirationChanged;\n default:\n return changeType\n .replace(/_/g, ' ')\n .toLowerCase()\n .replace(/\\b\\w/g, (l) => l.toUpperCase());\n }\n };\n\n // Handle status or expiration changes\n const formatChanges = (changes: any) => {\n const changeDetails = [];\n\n if (changes?.commentAdded?.comment) {\n changeDetails.push(\n dictionary.commentDetail.replace(\n '{comment}',\n changes.commentAdded.comment\n )\n );\n }\n\n if (changes?.statuses?.changes) {\n changes.statuses.changes.forEach((statusChange: any) => {\n if (statusChange.oldStatus && statusChange.newStatus) {\n changeDetails.push(\n dictionary.statusChangedFromTo\n .replace('{oldStatus}', statusChange.oldStatus)\n .replace('{newStatus}', statusChange.newStatus)\n );\n } else if (statusChange.newStatus) {\n changeDetails.push(\n dictionary.statusSetTo.replace(\n '{newStatus}',\n statusChange.newStatus\n )\n );\n }\n });\n }\n\n if (\n changes?.expiration?.newExpiration &&\n changes?.expiration?.oldExpiration\n ) {\n const newDateFormatted = formatExpirationDate(\n changes.expiration.newExpiration,\n dateFormatter\n );\n const oldDateFormatted = formatExpirationDate(\n changes.expiration.oldExpiration,\n dateFormatter\n );\n changeDetails.push(\n dictionary.expirationChangedFromTo\n .replace('{oldExpiration}', oldDateFormatted)\n .replace('{newExpiration}', newDateFormatted)\n );\n } else if (changes?.expiration?.newExpiration) {\n const newDateFormatted = formatExpirationDate(\n changes.expiration.newExpiration,\n dateFormatter\n );\n changeDetails.push(\n dictionary.expirationSetTo.replace('{newExpiration}', newDateFormatted)\n );\n }\n\n if (changes?.total?.newPrice && changes?.total?.oldPrice) {\n const newTotal = `${changes.total.newPrice.currency} ${changes.total.newPrice.value}`;\n const oldTotal = `${changes.total.oldPrice.currency} ${changes.total.oldPrice.value}`;\n changeDetails.push(\n dictionary.totalChangedFromTo\n .replace('{oldTotal}', oldTotal)\n .replace('{newTotal}', newTotal)\n );\n }\n\n if (changes?.customChanges?.title && changes?.customChanges?.old_value && changes?.customChanges?.new_value) {\n changeDetails.push(\n dictionary.customChange\n .replace('{title}', changes.customChanges.title)\n .replace('{oldValue}', changes.customChanges.old_value)\n .replace('{newValue}', changes.customChanges.new_value)\n );\n }\n\n if (changes?.productsRemoved?.productsRemovedFromCatalog && changes.productsRemoved.productsRemovedFromCatalog.length > 0) {\n changeDetails.push(\n dictionary.productsRemovedFromCatalog.replace(\n '{products}',\n changes.productsRemoved.productsRemovedFromCatalog.join(', ')\n )\n );\n }\n\n if (changes?.productsRemoved?.productsRemovedFromQuote && changes.productsRemoved.productsRemovedFromQuote.length > 0) {\n const productNames = changes.productsRemoved.productsRemovedFromQuote.map((product: any) =>\n product.name || product.sku || product.uid\n ).join(', ');\n changeDetails.push(\n dictionary.productsRemovedFromQuote.replace('{products}', productNames)\n );\n }\n\n return changeDetails.length > 0\n ? changeDetails\n : [dictionary.noDetailsAvailable];\n };\n\n // Get item notes outside of history entries\n const getItemNotes = () => {\n const notes: Array<{\n createdAt: string;\n creatorId: number;\n creatorType: number;\n negotiableQuoteItemUid: string;\n note: string;\n noteUid: string;\n type: 'buyer' | 'seller';\n productName: string;\n productSku: string;\n authorName: string;\n }> = [];\n\n const processNotes = (\n noteArray: ItemNote[] | undefined,\n type: 'buyer' | 'seller',\n authorName: string,\n item: QuoteItem\n ) => {\n if (noteArray && Array.isArray(noteArray)) {\n noteArray.forEach((note) => {\n if (note && note.note && note.note.trim()) {\n notes.push({\n ...note,\n type,\n productName: item.product.name,\n productSku: item.product.sku,\n authorName,\n });\n }\n });\n }\n };\n\n if (items) {\n items.forEach((item) => {\n processNotes(\n item.noteFromBuyer,\n 'buyer',\n `${buyer.firstname} ${buyer.lastname} ${dictionary.buyerLabel}`,\n item\n );\n\n processNotes(\n item.noteFromSeller,\n 'seller',\n `${salesRepName} ${dictionary.sellerLabel}`,\n item\n );\n });\n }\n\n return notes;\n };\n\n const itemNotes = getItemNotes();\n\n // Get history entries\n const historyEntries = (history || []).map((entry) => ({\n ...entry,\n entryType: 'history' as const,\n }));\n const noteEntries = itemNotes.map((note) => ({\n ...note,\n entryType: 'note' as const,\n }));\n\n // Combine history and item notes without sorting\n const allEntries = [...historyEntries, ...noteEntries];\n\n return (\n <div\n {...props}\n className={classes(['quote-management-quote-history-log', className])}\n >\n {allEntries.length > 0 ? (\n <div className=\"quote-management-quote-history-log__entries\">\n {allEntries.map((entry, index) => (\n <div\n key={\n entry.entryType === 'history'\n ? entry.uid\n : `${entry.noteUid}-${index}`\n }\n className=\"quote-management-quote-history-log__entry\"\n >\n <div className=\"quote-management-quote-history-log__entry-header\">\n <div className=\"quote-management-quote-history-log__entry-meta\">\n <span className=\"quote-management-quote-history-log__entry-date\">\n {dateFormatter.format(new Date(entry.createdAt))}\n </span>\n <span className=\"quote-management-quote-history-log__entry-author\">\n {entry.entryType === 'history'\n ? `by ${entry.author.firstname} ${entry.author.lastname\n } ${entry.author.firstname === buyer.firstname &&\n entry.author.lastname === buyer.lastname\n ? dictionary.buyerLabel\n : dictionary.sellerLabel\n }`\n : `by ${entry.authorName}`}\n </span>\n </div>\n <div className=\"quote-management-quote-history-log__entry-type\">\n {entry.entryType === 'history'\n ? formatChangeType(entry.changeType)\n : entry.type === 'buyer'\n ? dictionary.buyerNoteAdded\n : dictionary.sellerNoteAdded}\n </div>\n </div>\n <div className=\"quote-management-quote-history-log__entry-changes\">\n {entry.entryType === 'history' ? (\n formatChanges(entry.changes).map((change, changeIndex) => (\n <div\n key={changeIndex}\n className=\"quote-management-quote-history-log__entry-change\"\n >\n {change}\n </div>\n ))\n ) : (\n <div className=\"quote-management-quote-history-log__entry-change\">\n <div>\n {entry.productName}({entry.productSku})\n </div>\n <div>\"{entry.note}\"</div>\n </div>\n )}\n </div>\n </div>\n ))}\n </div>\n ) : (\n <div className=\"quote-management-quote-history-log__empty\">\n {dictionary.emptyState}\n </div>\n )}\n {children}\n </div>\n );\n};\n"],"names":["QuoteHistoryLog","className","children","history","items","buyer","salesRepName","props","calculatedLocale","getGlobalLocale","dictionary","useText","dateFormatter","getUserTimezone","formatChangeType","changeType","l","formatChanges","changes","changeDetails","_a","_b","statusChange","_c","_d","newDateFormatted","formatExpirationDate","oldDateFormatted","_e","_f","_g","newTotal","oldTotal","_h","_i","_j","_k","_l","productNames","product","itemNotes","notes","processNotes","noteArray","type","authorName","item","note","historyEntries","entry","noteEntries","allEntries","jsxs","classes","jsx","index","change","changeIndex"],"mappings":"mQAuEO,MAAMA,EAA2D,CAAC,CACvE,UAAAC,EACA,SAAAC,EACA,QAAAC,EACA,MAAAC,EACA,MAAAC,EACA,aAAAC,EACA,GAAGC,CACL,IAAM,CAEJ,MAAMC,EAAmBC,KAAqB,QAExCC,EAAaC,EAAQ,CACzB,aAAc,iCACd,aAAc,iCACd,cAAe,uCACf,aAAc,sCACd,kBAAmB,2CACnB,eAAgB,sCAChB,gBAAiB,uCACjB,WAAY,gCACZ,YAAa,iCACb,cAAe,mCACf,oBAAqB,+CACrB,YAAa,uCACb,wBAAyB,mDACzB,gBAAiB,2CACjB,mBAAoB,8CACpB,aAAc,wCACd,2BAA4B,sDAC5B,yBAA0B,oDAC1B,mBAAoB,8CACpB,WAAY,wBACZ,MAAO,iBAAA,CACR,EAEKC,EAAgB,IAAI,KAAK,eAAeJ,EAAkB,CAC9D,KAAM,UACN,MAAO,OACP,IAAK,UACL,KAAM,UACN,OAAQ,UACR,OAAQ,UACR,SAAUK,EAAA,CAAgB,CAC3B,EAEKC,EAAoBC,GAAuB,CAC/C,OAAQA,EAAA,CACN,IAAK,UACH,OAAOL,EAAW,aACpB,IAAK,UACH,OAAOA,EAAW,aACpB,IAAK,iBACH,OAAOA,EAAW,cACpB,IAAK,gBACH,OAAOA,EAAW,aACpB,IAAK,qBACH,OAAOA,EAAW,kBACpB,QACE,OAAOK,EACJ,QAAQ,KAAM,GAAG,EACjB,YAAA,EACA,QAAQ,QAAUC,GAAMA,EAAE,aAAa,CAAA,CAEhD,EAGMC,EAAiBC,GAAiB,6BACtC,MAAMC,E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AAA,CAAI,UAAU,iDACZ,SAAAA,EAAM,YAAc,UACjBnC,EAAiBmC,EAAM,UAAU,EACjCA,EAAM,OAAS,QACbvC,EAAW,eACXA,EAAW,eAAA,CACnB,CAAA,EACF,EACA4C,EAAC,MAAA,CAAI,UAAU,oDACZ,WAAM,YAAc,UACnBrC,EAAcgC,EAAM,OAAO,EAAE,IAAI,CAACO,EAAQC,IACxCH,EAAC,MAAA,CAEC,UAAU,mDAET,SAAAE,CAAA,EAHIC,CAAA,CAKR,EAEDL,EAAC,MAAA,CAAI,UAAU,mDACb,SAAA,CAAAA,EAAC,MAAA,CACE,SAAA,CAAAH,EAAM,YAAY,IAAEA,EAAM,WAAW,GAAA,EACxC,IACC,MAAA,CAAI,SAAA,CAAA,IAAEA,EAAM,KAAK,GAAA,CAAA,CAAC,CAAA,CAAA,CACrB,CAAA,CAEJ,CAAA,CAAA,EAhDEA,EAAM,YAAc,UAChBA,EAAM,IACN,GAAGA,EAAM,OAAO,IAAIM,CAAK,EAAA,CAgDlC,EACH,EAEAD,EAAC,OAAI,UAAU,4CACZ,WAAW,WACd,EAEDpD,CAAA,CAAA,CAAA,CAGP"}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
/*! Copyright 2025 Adobe
|
|
2
|
+
All Rights Reserved. */
|
|
3
|
+
import{jsx as o}from"@dropins/tools/preact-jsx-runtime.js";import{useState as m,useEffect as i}from"@dropins/tools/preact-compat.js";import{events as n}from"@dropins/tools/event-bus.js";import{Q as f}from"./QuoteHistoryLog.js";const Q=({quoteData:r,...s})=>{const[e,a]=m(r);return i(()=>{const t=n.on("quote-management/quote-data",u=>{a(u.quote)},{eager:!0});return()=>t==null?void 0:t.off()},[]),e?o("div",{...s,children:o(f,{history:e.history,items:e.items,buyer:e.buyer,salesRepName:e.salesRepName})}):null};export{Q};
|
|
4
|
+
//# sourceMappingURL=QuoteHistoryLog3.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"QuoteHistoryLog3.js","sources":["/@dropins/storefront-quote-management/src/containers/QuoteHistoryLog/QuoteHistoryLog.tsx"],"sourcesContent":["/********************************************************************\n * Copyright 2025 Adobe\n * All Rights Reserved.\n *\n * NOTICE: Adobe permits you to use, modify, and distribute this \n * file in accordance with the terms of the Adobe license agreement \n * accompanying it. \n *******************************************************************/\n \nimport { HTMLAttributes, useEffect, useState } from 'preact/compat';\nimport { Container } from '@adobe-commerce/elsie/lib';\nimport { NegotiableQuoteModel } from '@/quote-management/data/models/negotiable-quote-model';\nimport { events } from '@adobe-commerce/event-bus';\nimport { QuoteHistoryLog as QuoteHistoryLogComponent } from '@/quote-management/components/QuoteHistoryLog';\n\nexport interface QuoteHistoryLogProps extends HTMLAttributes<HTMLDivElement> {\n quoteData?: NegotiableQuoteModel;\n}\n \nexport const QuoteHistoryLog: Container<QuoteHistoryLogProps> = ({ quoteData: initialData, ...props }) => {\n\n const [quoteData, setQuoteData] = useState<NegotiableQuoteModel | undefined>(\n initialData\n );\n\n useEffect(() => {\n const quoteDataEvent = events.on(\n 'quote-management/quote-data',\n (data: { quote: NegotiableQuoteModel }) => {\n setQuoteData(data.quote);\n },\n {\n eager: true,\n }\n );\n return () => quoteDataEvent?.off();\n }, []);\n\n if (!quoteData) {\n return null;\n }\n\n return (\n <div {...props}>\n <QuoteHistoryLogComponent \n history={quoteData.history}\n items={quoteData.items}\n buyer={quoteData.buyer}\n salesRepName={quoteData.salesRepName}\n />\n </div>\n );\n};\n"],"names":["QuoteHistoryLog","initialData","props","quoteData","setQuoteData","useState","useEffect","quoteDataEvent","events","data","jsx","QuoteHistoryLogComponent"],"mappings":"mOAmBO,MAAMA,EAAmD,CAAC,CAAE,UAAWC,EAAa,GAAGC,KAAY,CAExG,KAAM,CAACC,EAAWC,CAAY,EAAIC,EAChCJ,CAAA,EAgBF,OAbAK,EAAU,IAAM,CACd,MAAMC,EAAiBC,EAAO,GAC5B,8BACCC,GAA0C,CACzCL,EAAaK,EAAK,KAAK,CACzB,EACA,CACE,MAAO,EAAA,CACT,EAEF,MAAO,IAAMF,GAAA,YAAAA,EAAgB,KAC/B,EAAG,CAAA,CAAE,EAEAJ,EAKHO,EAAC,MAAA,CAAK,GAAGR,EACP,SAAAQ,EAACC,EAAA,CACC,QAASR,EAAU,QACnB,MAAOA,EAAU,MACjB,MAAOA,EAAU,MACjB,aAAcA,EAAU,YAAA,CAAA,EAE5B,EAXO,IAaX"}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
/*! Copyright 2025 Adobe
|
|
2
|
+
All Rights Reserved. */
|
|
3
|
+
import{jsx as t,jsxs as n,Fragment as I}from"@dropins/tools/preact-jsx-runtime.js";import{classes as b,VComponent as k}from"@dropins/tools/lib.js";/* empty css */import{Skeleton as R,SkeletonRow as V,Input as W,Picker as E,Price as _,Checkbox as J,Button as K,Table as X,Accordion as Y,AccordionSection as Z}from"@dropins/tools/components.js";import{h as L}from"@dropins/tools/preact.js";import{useState as H,useEffect as U}from"@dropins/tools/preact-hooks.js";import{useText as C}from"@dropins/tools/i18n.js";const ce=({className:g,loading:i,table:l,pricesSummary:r,...a})=>i?t(ee,{}):n("div",{className:b(["quote-management-items-quoted",g]),...a,children:[l&&t(k,{node:l,className:b(["quote-management-items-quoted__table"]),"data-testid":"quote-management-items-quoted__table"}),r&&t(k,{node:r,className:b(["quote-management-items-quoted__prices-summary"]),"data-testid":"quote-management-items-quoted__prices-summary"})]}),ee=()=>t(R,{"data-testid":"items-quoted-skeleton",children:t(V,{variant:"row",fullWidth:!0,size:"medium",lines:4,multilineGap:"xsmall"})}),ie=({className:g,items:i,canEdit:l,readOnly:r=!1,onItemCheckboxChange:a,onItemDropdownChange:m,onQuantityChange:p,onUpdate:N,dropdownSelections:h,...f})=>{const[x,P]=H({}),[y,T]=H({});U(()=>{const e={};i.forEach(s=>{e[s.uid]=s.quantity}),P(e),T(e)},[i]);const S=Object.keys(y).some(e=>y[e]!==x[e]),u=C({updateButton:"NegotiableQuote.Manage.productListTable.submitButton",productNameHeader:"NegotiableQuote.Manage.productListTable.headers.productName",skuHeader:"NegotiableQuote.Manage.productListTable.headers.sku",priceHeader:"NegotiableQuote.Manage.productListTable.headers.price",quantityHeader:"NegotiableQuote.Manage.productListTable.headers.quantity",discountHeader:"NegotiableQuote.Manage.productListTable.headers.discount",subtotalHeader:"NegotiableQuote.Manage.productListTable.headers.subtotal",actionsHeader:"NegotiableQuote.Manage.productListTable.headers.actions",editNoteToSeller:"NegotiableQuote.Manage.productListTable.actions.editNoteToSeller",remove:"NegotiableQuote.Manage.productListTable.actions.remove"}),v=[{label:u.productNameHeader,key:"productName"},{label:u.skuHeader,key:"sku"},{label:u.priceHeader,key:"price"},{label:u.quantityHeader,key:"quantity"},{label:u.discountHeader,key:"discount"},{label:u.subtotalHeader,key:"subtotal"}];l&&!r&&(v.unshift({label:"",key:"checkbox"}),v.push({label:u.actionsHeader,key:"actions"}));const M=(e,s)=>{const o=e.target.checked;a==null||a(s,o)},$=(e,s)=>{const o=e.target.value;m==null||m(s,o)},B=(e,s)=>{const o=parseInt(e.target.value,10);!isNaN(o)&&o>0&&(T(c=>({...c,[s.uid]:o})),p==null||p(s,o))},O=e=>{e.preventDefault(),N==null||N(e)},w=(e,s)=>e>0?n("div",{className:"quote-management-product-list-table__discount-container",children:[n("span",{className:"quote-management-product-list-table__discount-percent",children:[s,"%"]}),n("span",{className:"quote-management-product-list-table__discount-price",children:["(",t(_,{amount:e}),")"]})]}):void 0,j=e=>{var c,Q;const s=(c=e.configurableOptions)==null?void 0:c.map(d=>n("div",{className:"quote-management-product-list-table__configurable-option",children:[n("span",{className:"quote-management-product-list-table__configurable-option-label",children:[d.optionLabel,":"]}),t("span",{className:"quote-management-product-list-table__configurable-option-value",children:d.valueLabel})]},d.optionLabel)),o=(Q=e.bundleOptions)==null?void 0:Q.map(d=>n("div",{className:"quote-management-product-list-table__bundle-option",children:[t("span",{className:"quote-management-product-list-table__bundle-option-label",children:d.label}),t("div",{className:"quote-management-product-list-table__bundle-option-values",children:d.values.map(q=>n("span",{className:"quote-management-product-list-table__bundle-option-value",children:[n("span",{className:"quote-management-product-list-table__bundle-option-value-quantity",children:[q.quantity," x"]}),t("span",{className:"quote-management-product-list-table__bundle-option-value-label",children:q.label}),t(_,{className:"quote-management-product-list-table__bundle-option-value-original-price",amount:q.originalPrice.value,currency:q.originalPrice.currency,weight:"normal"})]},q.label))})]},d.label));return n("div",{className:"quote-management-product-list-table__product-name-container",children:[t("span",{className:"quote-management-product-list-table__product-name",children:e.product.name}),s,o]})},A=i.map(e=>{var o;const s=l?t(W,{className:"quote-management-product-list-table__quantity-input",type:"number",min:"1",value:((o=y[e.uid])==null?void 0:o.toString())||e.quantity.toString(),onChange:c=>B(c,e),disabled:r||!l,"data-testid":`quantity-input-${e.product.sku}`}):t("span",{className:"quote-management-product-list-table__quantity",children:e.quantity});return{checkbox:t(J,{className:"quote-management-product-list-table__checkbox",name:"itemSelected","data-testid":`item-checkbox-${e.product.sku}`,onChange:c=>M(c,e),value:e.product.sku}),productName:j(e),sku:t("span",{className:"quote-management-product-list-table__sku",children:e.product.sku}),price:t(_,{className:"quote-management-product-list-table__price",amount:e.prices.originalItemPrice.value,currency:e.prices.originalItemPrice.currency}),quantity:s,discount:e.catalogDiscount?w(e.catalogDiscount.amountOff,e.catalogDiscount.percentOff):void 0,subtotal:t(_,{className:"quote-management-product-list-table__subtotal",amount:e.prices.rowTotal.value,currency:e.prices.rowTotal.currency}),actions:t(E,{className:"quote-management-product-list-table__actions","data-testid":`item-dropdown-${e.product.sku}`,name:`item-dropdown-${e.product.sku}`,handleSelect:c=>$(c,e),placeholder:"Select",value:(h==null?void 0:h[e.uid])??"",options:[{text:u.editNoteToSeller,value:"edit"},{text:u.remove,value:"remove"}]})}}),D=t(X,{columns:v,rowData:A,"data-testid":"product-list-table",mobileLayout:"stacked"}),z=l?L("form",{}):L("div",{}),F=l?{onSubmit:O,...f}:f,G=t(K,{type:"submit",disabled:r||!l||!S,"data-testid":"product-list-table-submit-button",children:u.updateButton});return n(k,{node:z,className:b(["quote-management-product-list-table-container",g]),"data-testid":"product-list-table-container",...F,children:[D,t("div",{className:"quote-management-product-list-table-container__submit-container",children:G})]})},re=({className:g,entries:i,...l})=>{const r=a=>{var p;const m=(p=a.children)==null?void 0:p.map(r);return t("div",{className:"quote-management-quote-prices-summary__entry","data-testid":`quote-prices-summary-entry-${a.id}`,children:m?t(Y,{className:"quote-management-quote-prices-summary__accordion","data-testid":`quote-prices-summary-entry-accordion-${a.id}`,children:t(Z,{className:"quote-management-quote-prices-summary__accordion-section",title:a.label,ariaLabelTitle:a.label,secondaryText:a.value,children:m})}):n(I,{children:[t("span",{className:b(["quote-management-quote-prices-summary__label",["quote-management-quote-prices-summary__label--strong",a.strong]]),"data-testid":`quote-prices-summary-entry-label-${a.id}`,children:a.label}),t("span",{className:"quote-management-quote-prices-summary__value","data-testid":`quote-prices-summary-entry-value-${a.id}`,children:a.value})]})},a.id)};return t("div",{className:b(["quote-management-quote-prices-summary",g]),"data-testid":"quote-prices-summary",...l,children:i==null?void 0:i.map(r)})};export{ce as I,ie as P,re as Q};
|
|
4
|
+
//# sourceMappingURL=QuotePricesSummary.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"QuotePricesSummary.js","sources":["/@dropins/storefront-quote-management/src/components/ItemsQuoted/ItemsQuoted.tsx","/@dropins/storefront-quote-management/src/components/ProductListTable/ProductListTable.tsx","/@dropins/storefront-quote-management/src/components/QuotePricesSummary/QuotePricesSummary.tsx"],"sourcesContent":["/********************************************************************\n * Copyright 2025 Adobe\n * All Rights Reserved.\n *\n * NOTICE: Adobe permits you to use, modify, and distribute this \n * file in accordance with the terms of the Adobe license agreement \n * accompanying it. \n *******************************************************************/\n\nimport { FunctionComponent, VNode } from 'preact';\nimport { HTMLAttributes } from 'preact/compat';\nimport { classes, VComponent } from '@adobe-commerce/elsie/lib';\nimport '@/quote-management/components/ItemsQuoted/ItemsQuoted.css';\nimport { Skeleton, SkeletonRow } from '@adobe-commerce/elsie/components';\n\nexport interface ItemsQuotedProps extends Omit<HTMLAttributes<HTMLDivElement>, 'loading'> {\n loading?: boolean;\n table?: VNode;\n pricesSummary?: VNode;\n}\n\nexport const ItemsQuoted: FunctionComponent<ItemsQuotedProps> = ({\n className,\n loading,\n table,\n pricesSummary,\n ...props\n}) => {\n if (loading) {\n return <ItemsQuotedSkeleton />;\n }\n\n return (\n <div className={classes(['quote-management-items-quoted', className])} {...props}>\n {table && (\n <VComponent\n node={table}\n className={classes(['quote-management-items-quoted__table'])}\n data-testid=\"quote-management-items-quoted__table\"\n />\n )}\n {pricesSummary && (\n <VComponent\n node={pricesSummary}\n className={classes(['quote-management-items-quoted__prices-summary'])}\n data-testid=\"quote-management-items-quoted__prices-summary\"\n />\n )}\n </div>\n );\n};\n\nexport const ItemsQuotedSkeleton: FunctionComponent = () => {\n return (\n <Skeleton data-testid=\"items-quoted-skeleton\">\n <SkeletonRow variant=\"row\" fullWidth={true} size=\"medium\" lines={4} multilineGap='xsmall' />\n </Skeleton>\n );\n};","/********************************************************************\n * Copyright 2025 Adobe\n * All Rights Reserved.\n *\n * NOTICE: Adobe permits you to use, modify, and distribute this\n * file in accordance with the terms of the Adobe license agreement\n * accompanying it.\n *******************************************************************/\n\nimport { FunctionComponent, h } from 'preact';\nimport { HTMLAttributes } from 'preact/compat';\nimport { useState, useEffect } from 'preact/hooks';\nimport { classes, VComponent } from '@adobe-commerce/elsie/lib';\nimport { Table, Checkbox, Picker, Price, Button, Input } from '@adobe-commerce/elsie/components';\nimport { useText } from '@adobe-commerce/elsie/i18n';\n\nimport '@/quote-management/components/ProductListTable/ProductListTable.css';\n\nexport interface ProductListTableItem {\n uid: string;\n product: {\n name: string;\n sku: string;\n };\n prices: {\n originalItemPrice: {\n value: number;\n currency: string;\n };\n rowTotal: {\n value: number;\n currency: string;\n };\n };\n quantity: number;\n catalogDiscount?: {\n amountOff: number;\n percentOff: number;\n };\n configurableOptions?: Array<{\n optionLabel: string;\n valueLabel: string;\n }>;\n bundleOptions?: Array<{\n label: string;\n values: Array<{\n label: string;\n quantity: number;\n originalPrice: {\n value: number;\n currency: string;\n };\n }>;\n }>;\n}\n\nexport interface ProductListTableProps extends HTMLAttributes<HTMLDivElement | HTMLFormElement> {\n items: ProductListTableItem[];\n canEdit: boolean;\n readOnly?: boolean;\n onItemCheckboxChange?: (\n item: ProductListTableItem,\n isSelected: boolean\n ) => void;\n onItemDropdownChange?: (\n item: ProductListTableItem,\n action: string\n ) => void;\n onQuantityChange?: (\n item: ProductListTableItem,\n newQuantity: number\n ) => void;\n onUpdate?: (e: SubmitEvent) => void;\n dropdownSelections?: Record<string, string | undefined>;\n}\n\nexport const ProductListTable: FunctionComponent<ProductListTableProps> = ({\n className,\n items,\n canEdit,\n readOnly = false,\n onItemCheckboxChange,\n onItemDropdownChange,\n onQuantityChange,\n onUpdate,\n dropdownSelections,\n ...props\n}) => {\n // Track original quantities to detect changes\n const [originalQuantities, setOriginalQuantities] = useState<\n Record<string, number>\n >({});\n const [currentQuantities, setCurrentQuantities] = useState<\n Record<string, number>\n >({});\n\n // Initialize quantities when items change\n useEffect(() => {\n const quantities: Record<string, number> = {};\n items.forEach((item) => {\n quantities[item.uid] = item.quantity;\n });\n setOriginalQuantities(quantities);\n setCurrentQuantities(quantities);\n }, [items]);\n\n // Check if any quantities have changed\n const hasQuantityChanges = Object.keys(currentQuantities).some(\n (uid) => currentQuantities[uid] !== originalQuantities[uid]\n );\n\n const dictionary = useText({\n updateButton: 'NegotiableQuote.Manage.productListTable.submitButton',\n productNameHeader:\n 'NegotiableQuote.Manage.productListTable.headers.productName',\n skuHeader: 'NegotiableQuote.Manage.productListTable.headers.sku',\n priceHeader: 'NegotiableQuote.Manage.productListTable.headers.price',\n quantityHeader: 'NegotiableQuote.Manage.productListTable.headers.quantity',\n discountHeader: 'NegotiableQuote.Manage.productListTable.headers.discount',\n subtotalHeader: 'NegotiableQuote.Manage.productListTable.headers.subtotal',\n actionsHeader: 'NegotiableQuote.Manage.productListTable.headers.actions',\n editNoteToSeller:\n 'NegotiableQuote.Manage.productListTable.actions.editNoteToSeller',\n remove: 'NegotiableQuote.Manage.productListTable.actions.remove',\n });\n\n const columns = [\n {\n label: dictionary.productNameHeader,\n key: 'productName',\n },\n {\n label: dictionary.skuHeader,\n key: 'sku',\n },\n {\n label: dictionary.priceHeader,\n key: 'price',\n },\n {\n label: dictionary.quantityHeader,\n key: 'quantity',\n },\n {\n label: dictionary.discountHeader,\n key: 'discount',\n },\n {\n label: dictionary.subtotalHeader,\n key: 'subtotal',\n },\n ];\n\n if (canEdit && !readOnly) {\n columns.unshift({\n label: '',\n key: 'checkbox',\n });\n columns.push({\n label: dictionary.actionsHeader,\n key: 'actions',\n });\n }\n\n const handleItemCheckboxChange = (\n event: Event,\n item: ProductListTableItem\n ) => {\n const isSelected = (event.target as HTMLInputElement).checked;\n onItemCheckboxChange?.(item, isSelected);\n };\n\n const handleItemDropdownChange = (\n event: Event,\n item: ProductListTableItem\n ) => {\n const action = (event.target as HTMLSelectElement).value;\n onItemDropdownChange?.(item, action);\n };\n\n const handleQuantityChange = (\n event: Event,\n item: ProductListTableItem\n ) => {\n const newQuantity = parseInt((event.target as HTMLInputElement).value, 10);\n if (!isNaN(newQuantity) && newQuantity > 0) {\n setCurrentQuantities((prev) => ({\n ...prev,\n [item.uid]: newQuantity,\n }));\n onQuantityChange?.(item, newQuantity);\n }\n };\n\n const handleUpdate = (event: SubmitEvent) => {\n event.preventDefault();\n onUpdate?.(event);\n };\n\n const discountElement = (amountOff: number, percentOff: number) => {\n return amountOff > 0 ? (\n <div className=\"quote-management-product-list-table__discount-container\">\n <span className=\"quote-management-product-list-table__discount-percent\">\n {percentOff}%\n </span>\n <span className=\"quote-management-product-list-table__discount-price\">\n (<Price amount={amountOff} />)\n </span>\n </div>\n ) : undefined;\n };\n\n const getProductNameContent = (item: ProductListTableItem) => {\n const configurableOptions = item.configurableOptions?.map((option) => (\n <div\n key={option.optionLabel}\n className=\"quote-management-product-list-table__configurable-option\"\n >\n <span className=\"quote-management-product-list-table__configurable-option-label\">\n {option.optionLabel}:\n </span>\n <span className=\"quote-management-product-list-table__configurable-option-value\">\n {option.valueLabel}\n </span>\n </div>\n ));\n\n const bundleOptions = item.bundleOptions?.map((option) => (\n <div\n key={option.label}\n className=\"quote-management-product-list-table__bundle-option\"\n >\n <span className=\"quote-management-product-list-table__bundle-option-label\">\n {option.label}\n </span>\n <div className=\"quote-management-product-list-table__bundle-option-values\">\n {option.values.map((value) => (\n <span\n key={value.label}\n className=\"quote-management-product-list-table__bundle-option-value\"\n >\n <span className=\"quote-management-product-list-table__bundle-option-value-quantity\">\n {value.quantity} x\n </span>\n <span className=\"quote-management-product-list-table__bundle-option-value-label\">\n {value.label}\n </span>\n <Price\n className=\"quote-management-product-list-table__bundle-option-value-original-price\"\n amount={value.originalPrice.value}\n currency={value.originalPrice.currency}\n weight=\"normal\"\n />\n </span>\n ))}\n </div>\n </div>\n ));\n\n return (\n <div className=\"quote-management-product-list-table__product-name-container\">\n <span className=\"quote-management-product-list-table__product-name\">\n {item.product.name}\n </span>\n {configurableOptions}\n {bundleOptions}\n </div>\n );\n };\n\n const rowData = items.map((item) => {\n const quantityElement = canEdit ? (\n <Input\n className=\"quote-management-product-list-table__quantity-input\"\n type=\"number\"\n min=\"1\"\n value={\n currentQuantities[item.uid]?.toString() || item.quantity.toString()\n }\n onChange={(e) => handleQuantityChange(e, item)}\n disabled={readOnly || !canEdit}\n data-testid={`quantity-input-${item.product.sku}`}\n />\n ) : (\n <span className=\"quote-management-product-list-table__quantity\">\n {item.quantity}\n </span>\n );\n\n return {\n checkbox: (\n <Checkbox\n className=\"quote-management-product-list-table__checkbox\"\n name=\"itemSelected\"\n data-testid={`item-checkbox-${item.product.sku}`}\n onChange={(e) => handleItemCheckboxChange(e, item)}\n value={item.product.sku}\n />\n ),\n productName: getProductNameContent(item),\n sku: (\n <span className=\"quote-management-product-list-table__sku\">\n {item.product.sku}\n </span>\n ),\n price: (\n <Price\n className=\"quote-management-product-list-table__price\"\n amount={item.prices.originalItemPrice.value}\n currency={item.prices.originalItemPrice.currency}\n />\n ),\n quantity: quantityElement,\n discount: item.catalogDiscount ? discountElement(\n item.catalogDiscount.amountOff,\n item.catalogDiscount.percentOff\n ) : undefined,\n subtotal: (\n <Price\n className=\"quote-management-product-list-table__subtotal\"\n amount={item.prices.rowTotal.value}\n currency={item.prices.rowTotal.currency}\n />\n ),\n actions: (\n <Picker\n className=\"quote-management-product-list-table__actions\"\n data-testid={`item-dropdown-${item.product.sku}`}\n name={`item-dropdown-${item.product.sku}`}\n handleSelect={(e) => handleItemDropdownChange(e, item)}\n placeholder=\"Select\"\n value={dropdownSelections?.[item.uid] ?? ''}\n options={[\n { text: dictionary.editNoteToSeller, value: 'edit' },\n { text: dictionary.remove, value: 'remove' },\n ]}\n />\n ),\n };\n });\n\n const table = (\n <Table\n columns={columns}\n rowData={rowData}\n data-testid=\"product-list-table\"\n mobileLayout=\"stacked\"\n />\n );\n\n // if can edit, the wrapper node should use the form element, else use the div element\n const wrapperNode = canEdit ? h('form', {}) : h('div', {});\n const wrapperProps = canEdit\n ? {\n onSubmit: handleUpdate,\n ...props,\n }\n : props;\n\n const submitButton = (\n <Button\n type=\"submit\"\n disabled={readOnly || !canEdit || !hasQuantityChanges}\n data-testid=\"product-list-table-submit-button\"\n >\n {dictionary.updateButton}\n </Button>\n );\n\n return (\n <VComponent\n node={wrapperNode}\n className={classes([\n 'quote-management-product-list-table-container',\n className,\n ])}\n data-testid=\"product-list-table-container\"\n {...wrapperProps}\n >\n {table}\n <div className=\"quote-management-product-list-table-container__submit-container\">\n {submitButton}\n </div>\n </VComponent>\n );\n};\n","/********************************************************************\n * Copyright 2025 Adobe\n * All Rights Reserved.\n *\n * NOTICE: Adobe permits you to use, modify, and distribute this \n * file in accordance with the terms of the Adobe license agreement \n * accompanying it. \n *******************************************************************/\n \nimport { FunctionComponent, VNode } from 'preact';\nimport { HTMLAttributes } from 'preact/compat';\nimport { classes } from '@adobe-commerce/elsie/lib';\nimport '@/quote-management/components/QuotePricesSummary/QuotePricesSummary.css';\nimport { Accordion, AccordionSection } from '@adobe-commerce/elsie/components';\n\ninterface Entry {\n label: string;\n id: string;\n value: VNode;\n strong?: boolean;\n children?: Entry[];\n}\n\nexport interface QuotePricesSummaryProps extends HTMLAttributes<HTMLDivElement> {\n entries?: Entry[];\n}\n\nexport const QuotePricesSummary: FunctionComponent<QuotePricesSummaryProps> = ({\n className,\n entries,\n ...props\n}) => {\n const createEntry = (entry: Entry) => {\n const children = entry.children?.map(createEntry);\n return (\n <div key={entry.id} className=\"quote-management-quote-prices-summary__entry\" data-testid={`quote-prices-summary-entry-${entry.id}`}>\n {children ? <Accordion\n className=\"quote-management-quote-prices-summary__accordion\"\n data-testid={`quote-prices-summary-entry-accordion-${entry.id}`}\n >\n <AccordionSection className=\"quote-management-quote-prices-summary__accordion-section\" title={entry.label} ariaLabelTitle={entry.label} secondaryText={entry.value}>\n {children}\n </AccordionSection>\n </Accordion>\n :\n <>\n <span className={classes(['quote-management-quote-prices-summary__label', ['quote-management-quote-prices-summary__label--strong', entry.strong]])} data-testid={`quote-prices-summary-entry-label-${entry.id}`}>{entry.label}</span>\n <span className=\"quote-management-quote-prices-summary__value\" data-testid={`quote-prices-summary-entry-value-${entry.id}`}>{entry.value}</span>\n </>\n }\n </div>\n );\n };\n\n return (\n <div className={classes(['quote-management-quote-prices-summary', className])} data-testid=\"quote-prices-summary\" {...props}>\n {entries?.map(createEntry)}\n </div>\n );\n};\n"],"names":["ItemsQuoted","className","loading","table","pricesSummary","props","ItemsQuotedSkeleton","jsxs","classes","jsx","VComponent","Skeleton","SkeletonRow","ProductListTable","items","canEdit","readOnly","onItemCheckboxChange","onItemDropdownChange","onQuantityChange","onUpdate","dropdownSelections","originalQuantities","setOriginalQuantities","useState","currentQuantities","setCurrentQuantities","useEffect","quantities","item","hasQuantityChanges","uid","dictionary","useText","columns","handleItemCheckboxChange","event","isSelected","handleItemDropdownChange","action","handleQuantityChange","newQuantity","prev","handleUpdate","discountElement","amountOff","percentOff","Price","getProductNameContent","configurableOptions","_a","option","bundleOptions","_b","value","rowData","quantityElement","Input","e","Checkbox","Picker","Table","wrapperNode","h","wrapperProps","submitButton","Button","QuotePricesSummary","entries","createEntry","entry","children","Accordion","AccordionSection","Fragment"],"mappings":"0hBAqBO,MAAMA,GAAmD,CAAC,CAC/D,UAAAC,EACA,QAAAC,EACA,MAAAC,EACA,cAAAC,EACA,GAAGC,CACL,IACMH,IACMI,GAAA,EAAoB,EAI5BC,EAAC,MAAA,CAAI,UAAWC,EAAQ,CAAC,gCAAiCP,CAAS,CAAC,EAAI,GAAGI,EACxE,SAAA,CAAAF,GACCM,EAACC,EAAA,CACC,KAAMP,EACN,UAAWK,EAAQ,CAAC,sCAAsC,CAAC,EAC3D,cAAY,sCAAA,CAAA,EAGfJ,GACCK,EAACC,EAAA,CACC,KAAMN,EACN,UAAWI,EAAQ,CAAC,+CAA+C,CAAC,EACpE,cAAY,+CAAA,CAAA,CACd,EAEJ,EAISF,GAAyC,MAEjDK,EAAA,CAAS,cAAY,wBACpB,SAAAF,EAACG,GAAY,QAAQ,MAAM,UAAW,GAAM,KAAK,SAAS,MAAO,EAAG,aAAa,SAAS,EAC5F,ECoBSC,GAA6D,CAAC,CACzE,UAAAZ,EACA,MAAAa,EACA,QAAAC,EACA,SAAAC,EAAW,GACX,qBAAAC,EACA,qBAAAC,EACA,iBAAAC,EACA,SAAAC,EACA,mBAAAC,EACA,GAAGhB,CACL,IAAM,CAEJ,KAAM,CAACiB,EAAoBC,CAAqB,EAAIC,EAElD,CAAA,CAAE,EACE,CAACC,EAAmBC,CAAoB,EAAIF,EAEhD,CAAA,CAAE,EAGJG,EAAU,IAAM,CACd,MAAMC,EAAqC,CAAA,EAC3Cd,EAAM,QAASe,GAAS,CACtBD,EAAWC,EAAK,GAAG,EAAIA,EAAK,QAC9B,CAAC,EACDN,EAAsBK,CAAU,EA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MAAO,cAAeA,EAAM,MAC1J,SAAAC,CAAA,CACH,CAAA,CAAA,EAGFhE,EAAAmE,EAAA,CACE,SAAA,CAAAjE,EAAC,QAAK,UAAWD,EAAQ,CAAC,+CAAgD,CAAC,uDAAwD8D,EAAM,MAAM,CAAC,CAAC,EAAG,cAAa,oCAAoCA,EAAM,EAAE,GAAK,WAAM,MAAM,EAC9N7D,EAAC,OAAA,CAAK,UAAU,+CAA+C,cAAa,oCAAoC6D,EAAM,EAAE,GAAK,SAAAA,EAAM,KAAA,CAAM,CAAA,EAC3I,CAAA,EAbQA,EAAM,EAehB,CAEJ,EAEA,SACG,MAAA,CAAI,UAAW9D,EAAQ,CAAC,wCAAyCP,CAAS,CAAC,EAAG,cAAY,uBAAwB,GAAGI,EACnH,SAAA+D,GAAA,YAAAA,EAAS,IAAIC,GAChB,CAEJ"}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
/*! Copyright 2025 Adobe
|
|
2
|
+
All Rights Reserved. */
|
|
3
|
+
import{jsx as o,jsxs as d}from"@dropins/tools/preact-jsx-runtime.js";import{useState as l,useEffect as p}from"@dropins/tools/preact-compat.js";import{getGlobalLocale as f}from"@dropins/tools/lib.js";import{Q as h}from"./QuoteCommentsList.js";import{events as g}from"@dropins/tools/event-bus.js";const C=({templateData:a,...n})=>{var r;const[e,m]=l(a);if(p(()=>{const t=g.on("quote-management/quote-template-data",c=>{m(c.quoteTemplate)},{eager:!0});return()=>t==null?void 0:t.off()},[]),!e)return null;const s=f()||"en-US",i=new Intl.DateTimeFormat(s,{year:"numeric",month:"short",day:"numeric",hour:"2-digit",minute:"2-digit",second:"2-digit",hour12:!0}),u=(r=e==null?void 0:e.comments)==null?void 0:r.map(t=>({uid:t.uid,createdAt:o("span",{children:i.format(new Date(t.createdAt))}),author:d("span",{children:[t.author.firstname," ",t.author.lastname]}),text:o("p",{children:t.text})}));return o(h,{"data-testid":"quote-template-comments-list-container",...n,comments:u||[]})};export{C as Q};
|
|
4
|
+
//# sourceMappingURL=QuoteTemplateCommentsList.js.map
|