@dropins/storefront-quote-management 0.0.1-alpha17 → 0.0.1-alpha19

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.
Files changed (81) hide show
  1. package/api/deleteQuote/deleteQuote.d.ts +28 -0
  2. package/api/deleteQuote/graphql/DeleteQuoteMutation.d.ts +10 -0
  3. package/api/deleteQuote/index.d.ts +10 -0
  4. package/api/getStoreConfig/getStoreConfig.d.ts +4 -0
  5. package/api/getStoreConfig/graphql/StoreConfigQuery.d.ts +10 -0
  6. package/api/getStoreConfig/index.d.ts +10 -0
  7. package/api/graphql/NegotiableQuoteAddressFragment.d.ts +10 -0
  8. package/api/graphql/NegotiableQuoteFragment.d.ts +1 -1
  9. package/api/graphql/ShippingMethodFragment.d.ts +10 -0
  10. package/api/index.d.ts +11 -0
  11. package/api/renameNegotiableQuote/graphql/RenameNegotiableQuoteMutation.d.ts +10 -0
  12. package/api/renameNegotiableQuote/index.d.ts +10 -0
  13. package/api/renameNegotiableQuote/renameNegotiableQuote.d.ts +9 -0
  14. package/api.js +22 -8
  15. package/api.js.map +1 -1
  16. package/chunks/ChevronDown.js +4 -0
  17. package/chunks/ChevronDown.js.map +1 -0
  18. package/chunks/NegotiableQuoteFragment.js +204 -26
  19. package/chunks/NegotiableQuoteFragment.js.map +1 -1
  20. package/chunks/OrderSummaryLine.js +4 -0
  21. package/chunks/OrderSummaryLine.js.map +1 -0
  22. package/chunks/WarningFilled.js +1 -1
  23. package/chunks/WarningFilled.js.map +1 -1
  24. package/chunks/negotiableQuotes.js +2 -2
  25. package/chunks/negotiableQuotes.js.map +1 -1
  26. package/chunks/renameNegotiableQuote.js +62 -0
  27. package/chunks/renameNegotiableQuote.js.map +1 -0
  28. package/chunks/state.js +4 -0
  29. package/chunks/state.js.map +1 -0
  30. package/chunks/transform-quote.js +4 -0
  31. package/chunks/transform-quote.js.map +1 -0
  32. package/chunks/uploadFile.js +3 -3
  33. package/chunks/uploadFile.js.map +1 -1
  34. package/components/ConfirmationModal/ConfirmationModal.d.ts +16 -0
  35. package/components/ConfirmationModal/index.d.ts +11 -0
  36. package/components/OrderSummary/OrderSummary.d.ts +7 -26
  37. package/components/RenameQuoteModal/RenameQuoteModal.d.ts +18 -0
  38. package/components/RenameQuoteModal/index.d.ts +11 -0
  39. package/components/index.d.ts +2 -0
  40. package/containers/ManageNegotiableQuote.js +1 -1
  41. package/containers/ManageNegotiableQuote.js.map +1 -1
  42. package/containers/OrderSummary/OrderSummary.d.ts +11 -0
  43. package/containers/OrderSummary/index.d.ts +11 -0
  44. package/containers/OrderSummary.d.ts +3 -0
  45. package/containers/OrderSummary.js +4 -0
  46. package/containers/OrderSummary.js.map +1 -0
  47. package/containers/OrderSummaryLine/OrderSummaryLine.d.ts +14 -0
  48. package/containers/OrderSummaryLine/index.d.ts +11 -0
  49. package/containers/OrderSummaryLine.d.ts +3 -0
  50. package/containers/OrderSummaryLine.js +4 -0
  51. package/containers/OrderSummaryLine.js.map +1 -0
  52. package/containers/QuoteSummaryList/QuoteSummaryList.d.ts +51 -0
  53. package/containers/QuoteSummaryList/index.d.ts +11 -0
  54. package/containers/QuoteSummaryList.d.ts +3 -0
  55. package/containers/QuoteSummaryList.js +4 -0
  56. package/containers/QuoteSummaryList.js.map +1 -0
  57. package/containers/QuotesListTable.js +1 -1
  58. package/containers/QuotesListTable.js.map +1 -1
  59. package/containers/RequestNegotiableQuoteForm.js +1 -1
  60. package/containers/RequestNegotiableQuoteForm.js.map +1 -1
  61. package/containers/index.d.ts +15 -4
  62. package/data/models/__fixtures__/negotiableQuoteModel.d.ts +1 -0
  63. package/data/models/__fixtures__/storeConfigModel.d.ts +5 -0
  64. package/data/models/index.d.ts +9 -0
  65. package/data/models/negotiable-quote-model.d.ts +66 -10
  66. package/data/models/store-config-model.d.ts +27 -0
  67. package/data/transforms/__fixtures__/negotiableQuoteData.d.ts +274 -0
  68. package/data/transforms/__fixtures__/storeConfigData.d.ts +31 -0
  69. package/data/transforms/index.d.ts +1 -0
  70. package/data/transforms/transform-quote.d.ts +8 -0
  71. package/data/transforms/transform-store-config.d.ts +4 -0
  72. package/i18n/en_US.json.d.ts +51 -0
  73. package/lib/state.d.ts +2 -0
  74. package/package.json +1 -1
  75. package/render.js +3 -3
  76. package/render.js.map +1 -1
  77. package/types/state.types.d.ts +3 -0
  78. package/chunks/fetch-graphql.js +0 -4
  79. package/chunks/fetch-graphql.js.map +0 -1
  80. package/chunks/sendForReview.js +0 -21
  81. package/chunks/sendForReview.js.map +0 -1
@@ -0,0 +1 @@
1
+ {"version":3,"file":"QuoteSummaryList.js","sources":["../../node_modules/@adobe-commerce/elsie/src/icons/ChevronRight.svg","/@dropins/storefront-quote-management/src/components/QuoteSummaryList/QuoteSummaryList.tsx","/@dropins/storefront-quote-management/src/containers/QuoteSummaryList/QuoteSummaryList.tsx"],"sourcesContent":["import * as React from \"react\";\nconst SvgChevronRight = (props) => /* @__PURE__ */ React.createElement(\"svg\", { id: \"Icon_Chevron_right_Base\", \"data-name\": \"Icon \\\\u2013 Chevron right \\\\u2013 Base\", xmlns: \"http://www.w3.org/2000/svg\", width: 24, height: 24, viewBox: \"0 0 24 24\", ...props }, /* @__PURE__ */ React.createElement(\"g\", { id: \"Large\" }, /* @__PURE__ */ React.createElement(\"rect\", { id: \"Placement_area\", \"data-name\": \"Placement area\", width: 24, height: 24, fill: \"#fff\", opacity: 0 }), /* @__PURE__ */ React.createElement(\"g\", { id: \"Chevron_right_icon\", \"data-name\": \"Chevron right icon\" }, /* @__PURE__ */ React.createElement(\"path\", { vectorEffect: \"non-scaling-stroke\", id: \"chevron\", d: \"M199.75,367.5l4.255,-4.255-4.255,-4.255\", transform: \"translate(-189.25 -351.0)\", fill: \"none\", stroke: \"currentColor\" }))));\nexport default SvgChevronRight;\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, VComponent } from '@adobe-commerce/elsie/lib';\nimport {\n Divider,\n Skeleton,\n SkeletonRow,\n} from '@adobe-commerce/elsie/components';\nimport '@/quote-management/components/QuoteSummaryList/QuoteSummaryList.css';\n\nexport interface QuoteSummaryListProps\n extends Omit<HTMLAttributes<HTMLDivElement>, 'loading'> {\n heading?: VNode | null;\n footer?: VNode | null;\n products?: VNode | null;\n outOfStockMessage?: VNode | null;\n loading?: boolean;\n variant?: 'primary' | 'secondary';\n}\n\nexport const QuoteSummaryList: FunctionComponent<QuoteSummaryListProps> = ({\n className,\n children,\n heading,\n footer,\n products,\n outOfStockMessage,\n loading = true,\n variant = 'primary',\n ...props\n}) => {\n return (\n <div\n {...props}\n className={classes([\n 'quote-management-quote-summary-list',\n className,\n `quote-management-quote-summary-list__background--${variant}`,\n ])}\n >\n {loading ? (\n <QuoteSummaryListSkeleton />\n ) : (\n <>\n {(heading || outOfStockMessage) && (\n <div\n data-testid=\"quote-summary-list-heading-wrapper\"\n className={classes([\n 'quote-management-quote-summary-list__heading',\n [\n 'quote-management-quote-summary-list__heading--full-width',\n !products,\n ],\n ])}\n >\n {heading && (\n <>\n <VComponent\n node={heading}\n className=\"quote-management-quote-summary-list__heading-text\"\n />\n <Divider\n variant=\"primary\"\n className={classes([\n 'quote-management-quote-summary-list__heading-divider',\n ])}\n />\n </>\n )}\n\n {outOfStockMessage && (\n <VComponent\n node={outOfStockMessage}\n className=\"quote-management-quote-summary-list__out-of-stock-message\"\n />\n )}\n </div>\n )}\n <div\n className={classes([\n 'quote-management-quote-summary-list__content',\n ])}\n >\n {products}\n </div>\n\n {footer && (\n <>\n <Divider\n variant=\"primary\"\n className={classes([\n 'quote-management-quote-summary-list__footer-divider',\n ])}\n />\n <VComponent\n node={footer}\n className=\"quote-management-quote-summary-list__footer-text\"\n />\n </>\n )}\n </>\n )}\n </div>\n );\n};\n\nconst QuoteSummaryListSkeleton: FunctionComponent = () => {\n return (\n <Skeleton\n data-testid=\"quote-summary-list-skeleton\"\n className=\"quote-management-quote-summary-list__skeleton\"\n rowGap=\"medium\"\n >\n <SkeletonRow\n variant=\"row\"\n size=\"xlarge\"\n fullWidth={true}\n lines={3}\n multilineGap=\"small\"\n />\n </Skeleton>\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';\n\nimport {\n Accordion,\n AccordionSection,\n Button,\n CartItem,\n CartList,\n Image,\n ImageProps,\n Price,\n PriceProps,\n} from '@adobe-commerce/elsie/components';\nimport { useText } from '@adobe-commerce/elsie/i18n';\nimport { ChevronDown, ChevronRight } from '@adobe-commerce/elsie/icons';\nimport { Container, Slot, SlotProps, classes } from '@adobe-commerce/elsie/lib';\n\nimport { events } from '@adobe-commerce/event-bus';\n\nimport { QuoteSummaryList as QuoteSummaryListComponent } from '@/quote-management/components';\nimport {\n NegotiableQuoteModel,\n NegotiableQuoteCartItem as NegotiableQuoteItemModel,\n QuoteDisplayAmount,\n} from '@/quote-management/data/models';\nimport { state } from '@/quote-management/lib/state';\n\nexport interface QuoteSummaryListProps extends HTMLAttributes<HTMLDivElement> {\n hideHeading?: boolean;\n hideFooter?: boolean;\n routeProduct?: (item: NegotiableQuoteItemModel) => string;\n showMaxItems?: boolean;\n attributesToHide?: SwitchableAttributes[];\n slots?: {\n Heading?: SlotProps<{ count: number; quoteId: string }>;\n Footer?: SlotProps<{ item: NegotiableQuoteItemModel }>;\n Thumbnail?: SlotProps<{\n item: NegotiableQuoteItemModel;\n defaultImageProps: ImageProps;\n }>;\n ProductAttributes?: SlotProps<{ item: NegotiableQuoteItemModel }>;\n QuoteSummaryFooter?: SlotProps<{\n displayMaxItems: boolean;\n }>;\n QuoteItem?: SlotProps;\n ItemTitle?: SlotProps<{ item: NegotiableQuoteItemModel }>;\n ItemPrice?: SlotProps<{ item: NegotiableQuoteItemModel }>;\n ItemTotal?: SlotProps<{ item: NegotiableQuoteItemModel }>;\n ItemSku?: SlotProps<{ item: NegotiableQuoteItemModel }>;\n };\n accordion?: boolean;\n variant?: 'primary' | 'secondary';\n showDiscount?: boolean;\n showSavings?: boolean;\n}\n\n// Attributes that can be hidden or shown\nexport type SwitchableAttributes =\n | 'name'\n | 'image'\n | 'configurations'\n | 'warning'\n | 'alert'\n | 'sku'\n | 'price'\n | 'quantity'\n | 'total'\n | 'totalDiscount'\n | 'totalExcludingTax';\n\nexport const QuoteSummaryList: Container<QuoteSummaryListProps> = ({\n hideHeading,\n hideFooter,\n routeProduct,\n showMaxItems = true,\n attributesToHide = [],\n slots,\n accordion = false,\n variant = 'primary',\n showDiscount,\n showSavings,\n ...props\n}) => {\n const CART_SUMMARY_MAX_ITEMS = 5;\n\n const [quoteData, setQuoteData] = useState<NegotiableQuoteModel | undefined>(\n undefined\n );\n const [loading, setLoading] = useState<boolean>(true);\n const [displayMaxItems, setDisplayMaxItems] = useState<boolean>(showMaxItems);\n\n const maxItems = state.config?.quoteSummaryMaxItems || CART_SUMMARY_MAX_ITEMS;\n const quoteDisplaySettings = state.config?.quoteDisplaySettings;\n\n const dictionary = useText({\n discountedPrice: 'NegotiableQuote.QuoteSummaryList.discountedPrice',\n discountPercentage: 'NegotiableQuote.QuoteSummaryList.discountPercentage',\n editQuote: 'NegotiableQuote.QuoteSummaryList.editQuote',\n file: 'NegotiableQuote.QuoteSummaryList.file',\n files: 'NegotiableQuote.QuoteSummaryList.files',\n heading: 'NegotiableQuote.QuoteSummaryList.heading',\n regularPrice: 'NegotiableQuote.QuoteSummaryList.regularPrice',\n savingsAmount: 'NegotiableQuote.QuoteSummaryList.savingsAmount',\n viewMore: 'NegotiableQuote.QuoteSummaryList.viewMore',\n });\n\n // Event listeners\n useEffect(() => {\n const quoteDataEvent = events.on(\n 'quote-management/quote-data',\n (payload: { quote: NegotiableQuoteModel }) => {\n const { quote } = payload;\n if (quote) {\n setQuoteData(quote);\n setLoading(false);\n }\n },\n {\n eager: true,\n }\n );\n return () => quoteDataEvent?.off();\n }, []);\n\n // Display max items\n const handleMaxItemsView = useCallback(() => {\n setDisplayMaxItems((prev) => !prev);\n }, []);\n\n // Helper functions\n const getImage = (item: NegotiableQuoteItemModel, index: number) => {\n if (attributesToHide.includes('image')) {\n return undefined;\n }\n\n const defaultImageProps: ImageProps = {\n loading: index < 4 ? 'eager' : 'lazy',\n src: item.image.src,\n alt: item.image.alt,\n width: '300',\n height: '300',\n params: { width: 300 },\n };\n\n const imageComponent = (\n <Image\n data-testid=\"quote-summary-list-item-image\"\n {...defaultImageProps}\n />\n );\n return (\n <Slot\n name=\"Thumbnail\"\n slot={slots?.Thumbnail}\n context={{ item, defaultImageProps }}\n >\n {routeProduct ? (\n <a href={routeProduct(item)}>{imageComponent}</a>\n ) : (\n imageComponent\n )}\n </Slot>\n );\n };\n\n const getTitle = (item: NegotiableQuoteItemModel) => {\n if (attributesToHide.includes('name')) {\n return undefined;\n }\n\n return (\n <span data-testid=\"quote-summary-list-item-title\">\n {routeProduct ? (\n <a href={routeProduct(item)}>{item.product.name}</a>\n ) : (\n item.product.name\n )}\n </span>\n );\n };\n\n // Helper function to transform bundle options for a cart item component\n const transformBundleOptions = (data: any) => {\n const bundle = data?.map((option: any) => ({\n label: option.label,\n value: option.values.map((value: any) => value.label).join(', '),\n }));\n\n const bundleOptions: { [key: string]: any } = {};\n\n bundle?.forEach((option: any) => {\n bundleOptions[option.label] = option.value;\n });\n\n return Object.keys(bundleOptions).length > 0 ? bundleOptions : null;\n };\n\n // Helper function to transform configurable options for a cart item component\n const transformConfigurableOptions = (data: any) => {\n const configurable = data?.map((option: any) => ({\n label: option.optionLabel,\n value: option.valueLabel,\n }));\n\n const configurableOptions: { [key: string]: any } = {};\n\n configurable?.forEach((option: any) => {\n configurableOptions[option.label] = option.value;\n });\n\n return Object.keys(configurableOptions).length > 0\n ? configurableOptions\n : null;\n };\n\n // Helper function to transform customizable options for a cart item component\n const transformCustomizableOptions = (data: any) => {\n const transformedOptions = data?.map((option: any) => ({\n label: option.label,\n type: option.type,\n values: option.values.map((value: any) => ({\n label: value.label,\n value: value.value,\n })),\n }));\n\n const result: { [key: string]: any } = {};\n\n transformedOptions?.forEach((option: any) => {\n switch (option.type) {\n case 'field':\n case 'area':\n case 'date_time':\n result[option.label] = option.values[0].value;\n break;\n case 'radio':\n case 'drop_down':\n result[option.label] = option.values[0].label;\n break;\n case 'multiple':\n case 'checkbox':\n result[option.label] = (option.values as Array<any>).reduce(\n (previous, current) => {\n if (previous) return `${previous}, ${current.label}`;\n return current.label;\n },\n ''\n );\n break;\n case 'file': {\n const parser = new DOMParser();\n const fileAnchorElementHtml = option.values[0].value;\n const doc = parser.parseFromString(\n fileAnchorElementHtml,\n 'text/html'\n );\n const anchorText = doc.querySelector('a')?.textContent || '';\n result[option.label] = anchorText;\n break;\n }\n }\n });\n\n return result;\n };\n\n const getConfigurations = (item: NegotiableQuoteItemModel) => {\n if (attributesToHide.includes('configurations')) {\n return undefined;\n }\n\n const configuration = {\n ...transformBundleOptions(item.bundleOptions),\n ...transformConfigurableOptions(item.configurableOptions),\n ...transformCustomizableOptions(item.customizableOptions),\n ...(item.links && item.links.count\n ? item.links.count > 1\n ? {\n [dictionary.files.replace(\n '{count}',\n item.links.count.toString()\n )]: item.links.result,\n }\n : {\n [dictionary.file.replace('{count}', item.links.count.toString())]:\n item.links.result,\n }\n : null),\n };\n\n if (Object.keys(configuration).length === 0) {\n return undefined;\n }\n\n return configuration;\n };\n\n const getPriceProps = (item: NegotiableQuoteItemModel) => {\n return quoteDisplaySettings?.price === QuoteDisplayAmount.TAX_INCLUDED\n ? item.discounted\n ? {\n amount: item.prices.regularPrice.value,\n currency: item.prices.regularPrice.currency,\n style: { font: 'inherit' },\n 'data-testid': 'including-tax-item-price',\n }\n : {\n amount: item.prices.priceIncludingTax.value,\n currency: item.prices.priceIncludingTax.currency,\n style: { font: 'inherit' },\n 'data-testid': 'including-tax-item-price',\n }\n : {\n amount: item.prices.regularPrice.value,\n currency: item.prices.regularPrice.currency,\n style: { font: 'inherit' },\n 'data-testid': 'regular-item-price',\n };\n };\n\n const getSavingsAmount = (item: NegotiableQuoteItemModel) => {\n return {\n amount: item.savingsAmount?.value,\n currency: item.savingsAmount?.currency,\n style: { font: 'inherit' },\n 'data-testid': 'item-savings-amount',\n };\n };\n\n const getTotalExcludingTax = (item: NegotiableQuoteItemModel) => {\n return quoteDisplaySettings?.price ===\n QuoteDisplayAmount.TAX_INCLUDED_AND_EXCLUDED ? (\n <Price\n amount={item.prices.rowTotal.value}\n currency={item.prices.rowTotal.currency}\n data-testid=\"excluding-tax-total\"\n aria-label={dictionary.regularPrice}\n />\n ) : undefined;\n };\n\n const getTotalPriceProps = (item: NegotiableQuoteItemModel) => {\n const totalProps: PriceProps = {\n 'aria-label': dictionary.regularPrice,\n };\n const discountProps: PriceProps | null = item.discounted ? {} : null;\n\n if (\n quoteDisplaySettings?.price === QuoteDisplayAmount.TAX_INCLUDED ||\n quoteDisplaySettings?.price ===\n QuoteDisplayAmount.TAX_INCLUDED_AND_EXCLUDED\n ) {\n totalProps['amount'] = item.prices.rowTotalIncludingTax?.value;\n totalProps['currency'] = item.prices.rowTotalIncludingTax?.currency;\n totalProps['variant'] = item.discounted ? 'strikethrough' : 'default';\n // @ts-ignore\n totalProps['data-testid'] = 'including-tax-item-total';\n\n if (discountProps) {\n totalProps['amount'] = item.prices.originalRowTotal?.value;\n totalProps['currency'] = item.prices.originalRowTotal?.currency;\n\n discountProps['amount'] = item.prices.rowTotalIncludingTax?.value;\n discountProps['currency'] = item.prices.rowTotalIncludingTax?.currency;\n discountProps['sale'] = true;\n discountProps['aria-label'] = dictionary.discountedPrice;\n // @ts-ignore\n discountProps['data-testid'] = 'discount-total';\n }\n } else {\n totalProps['amount'] = item.prices.originalRowTotal?.value;\n totalProps['currency'] = item.prices.originalRowTotal?.currency;\n totalProps['variant'] = item.discounted ? 'strikethrough' : 'default';\n // @ts-ignore\n totalProps['data-testid'] = 'regular-item-total';\n\n if (discountProps) {\n discountProps['amount'] = item.discountedTotal?.value;\n discountProps['currency'] = item.discountedTotal?.currency;\n discountProps['sale'] = true;\n discountProps['aria-label'] = dictionary.regularPrice;\n // @ts-ignore\n discountProps['data-testid'] = 'discount-total';\n }\n }\n\n return {\n totalProps,\n discountProps,\n };\n };\n\n const getProductAttributes = (item: NegotiableQuoteItemModel) => {\n return (\n <Slot\n name=\"ProductAttributes\"\n slot={slots?.ProductAttributes}\n context={{ item }}\n />\n );\n };\n\n const getSku = (item: NegotiableQuoteItemModel) => {\n return (\n <span data-testid=\"quote-summary-list-item-sku\">{item.product.sku}</span>\n );\n };\n\n const getFooter = (item: NegotiableQuoteItemModel) => {\n return <Slot name=\"Footer\" slot={slots?.Footer} context={{ item }} />;\n };\n\n // Re-usable function to get a filtered list of cart items\n const getCartItemEntries = (\n filterCallback: (item: NegotiableQuoteItemModel) => boolean\n ) => {\n return quoteData?.totalQuantity\n ? quoteData.items.filter(filterCallback).map((item, index) => {\n const { totalProps, discountProps } = getTotalPriceProps(item);\n\n const defaultCartItem = (\n <CartItem\n loading={loading}\n key={item.uid}\n data-testid={`quote-summary-list-item-entry-${item.uid}`}\n image={getImage(item, index)}\n title={\n <Slot\n name=\"ItemTitle\"\n slot={slots?.ItemTitle}\n context={{ item }}\n >\n {getTitle(item)}\n </Slot>\n }\n sku={\n attributesToHide.includes('sku') ? undefined : (\n <Slot name=\"ItemSku\" slot={slots?.ItemSku} context={{ item }}>\n {getSku(item)}\n </Slot>\n )\n }\n price={\n attributesToHide.includes('price') ? undefined : (\n <Slot\n name=\"ItemPrice\"\n slot={slots?.ItemPrice}\n context={{ item }}\n slotTag=\"span\"\n >\n <Price {...getPriceProps(item)} />\n </Slot>\n )\n }\n quantity={\n attributesToHide.includes('quantity')\n ? undefined\n : item.quantity\n }\n total={\n <>\n {attributesToHide.includes('total') ? undefined : (\n <Slot\n name=\"ItemTotal\"\n slot={slots?.ItemTotal}\n context={{ item }}\n >\n <Price {...totalProps} />\n </Slot>\n )}\n {attributesToHide.includes('totalDiscount')\n ? undefined\n : discountProps && (\n <Slot\n name=\"ItemTotal\"\n slot={slots?.ItemTotal}\n context={{ item }}\n >\n <Price {...discountProps} />\n </Slot>\n )}\n </>\n }\n attributes={getProductAttributes(item)}\n configurations={getConfigurations(item)}\n totalExcludingTax={\n attributesToHide.includes('totalExcludingTax')\n ? undefined\n : getTotalExcludingTax(item)\n }\n taxIncluded={\n quoteDisplaySettings?.price === QuoteDisplayAmount.TAX_INCLUDED\n }\n taxExcluded={\n !attributesToHide.includes('totalExcludingTax') &&\n quoteDisplaySettings?.price ===\n QuoteDisplayAmount.TAX_INCLUDED_AND_EXCLUDED\n }\n discount={\n showDiscount &&\n item.discounted &&\n item.discountPercentage !== undefined ? (\n <div data-testid=\"item-discount-percentage\">\n {dictionary.discountPercentage.replace(\n '{discount}',\n item.discountPercentage.toString()\n )}\n </div>\n ) : undefined\n }\n savings={\n showSavings &&\n item.discounted &&\n item.savingsAmount !== undefined ? (\n <div>\n <span>\n <Price {...getSavingsAmount(item)} />\n </span>\n &nbsp;\n {dictionary.savingsAmount}\n </div>\n ) : undefined\n }\n footer={getFooter(item)}\n />\n );\n\n return (\n <Slot\n key={item.uid}\n name=\"CartItem\"\n slot={slots?.QuoteItem}\n context={{\n item,\n index,\n loading,\n attributesToHide,\n quoteDisplaySettings,\n showDiscount,\n showSavings,\n dictionary,\n getImage,\n getTitle,\n getSku,\n getPriceProps,\n getTotalPriceProps,\n getProductAttributes,\n getConfigurations,\n getTotalExcludingTax,\n getFooter,\n getSavingsAmount,\n }}\n >\n {defaultCartItem}\n </Slot>\n );\n })\n : null;\n };\n\n const heading = (\n <Slot\n name=\"Heading\"\n slot={slots?.Heading}\n context={{\n count: quoteData?.totalQuantity ?? 0,\n quoteId: quoteData?.uid!,\n }}\n >\n <div data-testid=\"default-quote-summary-list-heading\">\n {dictionary.heading.replace(\n '({count})',\n quoteData?.totalQuantity\n ? `(${quoteData?.totalQuantity.toString()})`\n : ''\n )}\n </div>\n </Slot>\n );\n\n // Heading Section text for screen reader\n const headingSection = heading.props.children.props.children;\n\n // Main Product Entries\n const mainProductEntries = getCartItemEntries(\n (item) => !item.outOfStock && !item.insufficientQuantity\n );\n\n const totalLineItems = quoteData?.items.length || 0;\n const numOfVisibleItems = displayMaxItems\n ? Math.min(totalLineItems, maxItems)\n : totalLineItems;\n\n const hasHiddenItems = totalLineItems > numOfVisibleItems;\n\n const footerActions =\n quoteData?.totalQuantity && mainProductEntries ? (\n <Slot\n name=\"Footer\"\n slot={slots?.QuoteSummaryFooter}\n context={{ displayMaxItems }}\n data-testid=\"quote-summary-list-footer-slot\"\n className=\"quote-management-quote-summary-list-footer\"\n >\n {hasHiddenItems ? (\n <Button\n className=\"quote-management-quote-summary-list-footer__action\"\n onClick={handleMaxItemsView}\n data-testid=\"view-more-items-button\"\n variant=\"tertiary\"\n >\n {dictionary.viewMore}\n </Button>\n ) : null}\n </Slot>\n ) : null;\n\n const productEntries = quoteData?.totalQuantity ? (\n <CartList data-testid=\"quote-summary-list\">\n {mainProductEntries?.slice(\n 0,\n displayMaxItems ? Math.min(totalLineItems, maxItems) : totalLineItems\n )}\n </CartList>\n ) : null;\n\n return accordion ? (\n <Accordion\n data-testid=\"quote-summary-list-accordion\"\n className={classes([\n `quote-management-quote-summary-list-accordion`,\n `quote-management-quote-summary-list__background--${variant}`,\n ])}\n iconOpen={ChevronRight}\n iconClose={ChevronDown}\n >\n <AccordionSection\n title={headingSection}\n ariaLabelTitle={headingSection}\n data-testid=\"quote-summary-list-accordion__section\"\n open={true}\n renderContentWhenClosed={true}\n >\n <QuoteSummaryListComponent\n {...props}\n aria-expanded={true}\n aria-label={'TEST'}\n className={`quote-management-quote-summary-list-accordion__list`}\n footer={hideFooter ? undefined : footerActions}\n products={productEntries}\n outOfStockMessage={undefined}\n loading={loading}\n variant={variant}\n />\n </AccordionSection>\n </Accordion>\n ) : (\n <QuoteSummaryListComponent\n {...props}\n heading={hideHeading ? undefined : heading}\n footer={hideFooter ? undefined : footerActions}\n products={productEntries}\n outOfStockMessage={undefined}\n loading={loading}\n variant={variant}\n />\n );\n};\n"],"names":["SvgChevronRight","props","React","QuoteSummaryList","className","children","heading","footer","products","outOfStockMessage","loading","variant","jsx","classes","QuoteSummaryListSkeleton","jsxs","Fragment","VComponent","Divider","Skeleton","SkeletonRow","hideHeading","hideFooter","routeProduct","showMaxItems","attributesToHide","slots","accordion","showDiscount","showSavings","quoteData","setQuoteData","useState","setLoading","displayMaxItems","setDisplayMaxItems","maxItems","_a","state","quoteDisplaySettings","_b","dictionary","useText","useEffect","quoteDataEvent","events","payload","quote","handleMaxItemsView","useCallback","prev","getImage","item","index","defaultImageProps","imageComponent","Image","Slot","getTitle","transformBundleOptions","data","bundle","option","value","bundleOptions","transformConfigurableOptions","configurable","configurableOptions","transformCustomizableOptions","transformedOptions","result","previous","current","parser","fileAnchorElementHtml","anchorText","getConfigurations","configuration","getPriceProps","QuoteDisplayAmount","getSavingsAmount","getTotalExcludingTax","Price","getTotalPriceProps","totalProps","discountProps","_c","_d","_e","_f","_g","_h","_i","_j","getProductAttributes","getSku","getFooter","getCartItemEntries","filterCallback","defaultCartItem","CartItem","headingSection","mainProductEntries","totalLineItems","numOfVisibleItems","hasHiddenItems","footerActions","Button","productEntries","CartList","Accordion","ChevronRight","ChevronDown","AccordionSection","QuoteSummaryListComponent"],"mappings":"g6BACA,MAAMA,GAAmBC,GAA0BC,EAAM,cAAc,MAAO,CAAE,GAAI,0BAA2B,YAAa,0CAA2C,MAAO,6BAA8B,MAAO,GAAI,OAAQ,GAAI,QAAS,YAAa,GAAGD,CAAK,EAAoBC,EAAM,cAAc,IAAK,CAAE,GAAI,OAAO,EAAoBA,EAAM,cAAc,OAAQ,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cAAY,+BACZ,UAAWjG,EAAQ,CACjB,gDACA,oDAAoDF,CAAO,EAAA,CAC5D,EACD,SAAUoG,GACV,UAAWC,GAEX,SAAApG,EAACqG,GAAA,CACC,MAAOZ,EACP,eAAgBA,EAChB,cAAY,wCACZ,KAAM,GACN,wBAAyB,GAEzB,SAAAzF,EAACsG,GAAA,CACE,GAAGjH,EACJ,gBAAe,GACf,aAAY,OACZ,UAAW,sDACX,OAAQqB,EAAa,OAAYoF,EACjC,SAAUE,EACV,kBAAmB,OACnB,QAAAlG,EACA,QAAAC,CAAA,CAAA,CACF,CAAA,CACF,CAAA,EAGFC,EAACsG,GAAA,CACE,GAAGjH,EACJ,QAASoB,EAAc,OAAYf,EACnC,OAAQgB,EAAa,OAAYoF,EACjC,SAAUE,EACV,kBAAmB,OACnB,QAAAlG,EACA,QAAAC,CAAA,CAAA,CAGN","x_google_ignoreList":[0]}
@@ -1,4 +1,4 @@
1
1
  /*! Copyright 2025 Adobe
2
2
  All Rights Reserved. */
3
- import{jsxs as P,jsx as t}from"@dropins/tools/preact-jsx-runtime.js";import{useState as Q,useEffect as $}from"@dropins/tools/preact-compat.js";import{classes as j,Slot as o}from"@dropins/tools/lib.js";import{Table as G,IllustratedMessage as H,Picker as J,Pagination as K,Button as W,Price as X}from"@dropins/tools/components.js";import{events as Y}from"@dropins/tools/event-bus.js";/* empty css *//* empty css */import"@dropins/tools/preact.js";import{useText as Z}from"@dropins/tools/i18n.js";/* empty css *//* empty css *//* empty css */import{g as V}from"../chunks/fetch-graphql.js";import{n as q}from"../chunks/negotiableQuotes.js";import"@dropins/tools/fetch-graphql.js";const ee=({rowData:h=[],loading:S=!1,className:N,emptyStateMessage:y,showItemRange:v=!0,itemRangeMessage:d,showPageSizePicker:u=!0,pageSizePickerMessage:i,showPagination:x=!0,paginationMessage:l,...b})=>{const m=Z({quoteName:"QuoteManagement.QuotesListTable.quoteName",created:"QuoteManagement.QuotesListTable.created",createdBy:"QuoteManagement.QuotesListTable.createdBy",status:"QuoteManagement.QuotesListTable.status",lastUpdated:"QuoteManagement.QuotesListTable.lastUpdated",quoteTemplate:"QuoteManagement.QuotesListTable.quoteTemplate",quoteTotal:"QuoteManagement.QuotesListTable.quoteTotal",actions:"QuoteManagement.QuotesListTable.actions"}),s=[{key:"quoteName",label:m.quoteName},{key:"created",label:m.created},{key:"createdBy",label:m.createdBy},{key:"status",label:m.status},{key:"lastUpdated",label:m.lastUpdated},{key:"quoteTemplate",label:m.quoteTemplate},{key:"quoteTotal",label:m.quoteTotal},{key:"actions",label:m.actions}],z=!S&&h.length===0&&y,p=v&&d,f=u&&i,g=x&&l,T=p||f||g;return P("div",{...b,className:j(["quote-management-quotes-list-table",N]),children:[t(G,{columns:s,rowData:h,loading:S,mobileLayout:"none",className:"quote-management-quotes-list-table__table"}),z&&t("div",{className:"quotes-list-table__empty-state",children:y}),T&&P("div",{className:"quotes-list-table__footer",children:[t("div",{className:"quotes-list-table__item-range",children:p&&d}),t("div",{className:"quotes-list-table__pagination",children:g&&l}),t("div",{className:"quotes-list-table__page-size-picker",children:f&&i})]})]})},Se=({pageSize:h,showItemRange:S=!0,showPageSizePicker:N=!0,showPagination:y=!0,onViewQuote:v,onPageSizeChange:d,onPageChange:u,slots:i,...x})=>{const[l,b]=Q(null),[m,s]=Q(!0),z=V()[0],[p,f]=Q(h||z),[g,T]=Q(1);$(()=>{const r=async()=>{try{s(!0);const c=await q({pageSize:p,currentPage:g});b(c)}catch(c){console.error("Failed to fetch quotes:",c)}finally{s(!1)}},e=Y.on("authenticated",c=>{c?r():(b(null),s(!1))},{eager:!0});return()=>{e==null||e.off()}},[p,g]);const k=r=>{f(r),T(1),d==null||d(r)},_=r=>{T(r),u==null||u(r)},A=r=>{const e=r.target,c=e==null?void 0:e.value;c&&k(Number(c))},U=(r,e,c)=>r.filter(a=>a==null?void 0:a.uid).map(a=>{var I,w,B,M;const F=`${a.buyer.firstname} ${a.buyer.lastname}`;return{id:a.uid,quoteName:t(o,{name:"QuoteName",slot:e==null?void 0:e.QuoteName,context:{quote:a},children:t("span",{children:a.name})}),created:t(o,{name:"Created",slot:e==null?void 0:e.Created,context:{quote:a},children:t("span",{children:a.createdAt?new Date(a.createdAt).toLocaleDateString():"N/A"})}),createdBy:t(o,{name:"CreatedBy",slot:e==null?void 0:e.CreatedBy,context:{quote:a},children:t("span",{children:F})}),status:t(o,{name:"Status",slot:e==null?void 0:e.Status,context:{quote:a},children:t("span",{children:a.status})}),lastUpdated:t(o,{name:"LastUpdated",slot:e==null?void 0:e.LastUpdated,context:{quote:a},children:t("span",{children:a.updatedAt?new Date(a.updatedAt).toLocaleDateString():"N/A"})}),quoteTemplate:t(o,{name:"QuoteTemplate",slot:e==null?void 0:e.QuoteTemplate,context:{quote:a},children:t("span",{children:a.templateName})}),quoteTotal:t(o,{name:"QuoteTotal",slot:e==null?void 0:e.QuoteTotal,context:{quote:a},children:t(X,{amount:(w=(I=a.prices)==null?void 0:I.grandTotal)==null?void 0:w.value,currency:(M=(B=a.prices)==null?void 0:B.grandTotal)==null?void 0:M.currency})}),actions:t(o,{name:"Actions",slot:e==null?void 0:e.Actions,context:{quote:a,onViewQuote:c},children:t(W,{variant:"tertiary",size:"medium",onClick:()=>c==null?void 0:c(a.uid,a.name,a.status),children:"View"})})}}),C=l!=null&&l.items?U(l.items,i,v):[],n=l==null?void 0:l.paginationInfo,L=!!n,O=t(o,{name:"EmptyQuotes",slot:i==null?void 0:i.EmptyQuotes,context:{quotesData:l},children:t(H,{heading:"No Quotes Found"})}),R=n?t(o,{name:"ItemRange",slot:i==null?void 0:i.ItemRange,context:n,children:P("span",{children:["Items ",n.startItem," to ",n.endItem," of"," ",n.totalCount," total"]})}):void 0,D=n&&n.pageSizeOptions?P(o,{name:"PageSizePicker",slot:i==null?void 0:i.PageSizePicker,context:{pageSize:n.pageSize,pageSizeOptions:n.pageSizeOptions,onPageSizeChange:k},children:[t("span",{children:"Show "}),t(J,{variant:"primary",size:"medium",value:String(n.pageSize),options:n.pageSizeOptions.map(r=>({value:String(r),text:String(r)})),handleSelect:A}),t("span",{children:" per page"})]}):void 0,E=n?t(o,{name:"Pagination",slot:i==null?void 0:i.Pagination,context:{currentPage:n.currentPage,totalPages:n.totalPages,onChange:_},children:t(K,{currentPage:n.currentPage,totalPages:n.totalPages,onChange:_})}):void 0;return t(ee,{rowData:C,loading:m,className:x.className,emptyStateMessage:O,showItemRange:S&&L,itemRangeMessage:R,showPageSizePicker:N&&L,pageSizePickerMessage:D,showPagination:y&&L,paginationMessage:E})};export{Se as QuotesListTable,Se as default};
3
+ import{jsxs as P,jsx as t}from"@dropins/tools/preact-jsx-runtime.js";import{useState as Q,useEffect as A}from"@dropins/tools/preact-compat.js";import{classes as H,Slot as o}from"@dropins/tools/lib.js";import{Table as J,IllustratedMessage as K,Picker as W,Pagination as X,Button as Y,Price as Z}from"@dropins/tools/components.js";import{events as U}from"@dropins/tools/event-bus.js";/* empty css *//* empty css */import"@dropins/tools/preact.js";import{useText as q}from"@dropins/tools/i18n.js";/* empty css *//* empty css *//* empty css */import{g as V}from"../chunks/transform-quote.js";import"../chunks/state.js";import{n as C}from"../chunks/negotiableQuotes.js";import"@dropins/tools/fetch-graphql.js";const ee=({rowData:S=[],loading:f=!1,className:N,emptyStateMessage:y,showItemRange:v=!0,itemRangeMessage:s,showPageSizePicker:p=!0,pageSizePickerMessage:i,showPagination:x=!0,paginationMessage:l,...g})=>{const m=q({quoteName:"QuoteManagement.QuotesListTable.quoteName",created:"QuoteManagement.QuotesListTable.created",createdBy:"QuoteManagement.QuotesListTable.createdBy",status:"QuoteManagement.QuotesListTable.status",lastUpdated:"QuoteManagement.QuotesListTable.lastUpdated",quoteTemplate:"QuoteManagement.QuotesListTable.quoteTemplate",quoteTotal:"QuoteManagement.QuotesListTable.quoteTotal",actions:"QuoteManagement.QuotesListTable.actions"}),h=[{key:"quoteName",label:m.quoteName},{key:"created",label:m.created},{key:"createdBy",label:m.createdBy},{key:"status",label:m.status},{key:"lastUpdated",label:m.lastUpdated},{key:"quoteTemplate",label:m.quoteTemplate},{key:"quoteTotal",label:m.quoteTotal},{key:"actions",label:m.actions}],z=!f&&S.length===0&&y,d=v&&s,b=p&&i,u=x&&l,T=d||b||u;return P("div",{...g,className:H(["quote-management-quotes-list-table",N]),children:[t(J,{columns:h,rowData:S,loading:f,mobileLayout:"none",className:"quote-management-quotes-list-table__table"}),z&&t("div",{className:"quotes-list-table__empty-state",children:y}),T&&P("div",{className:"quotes-list-table__footer",children:[t("div",{className:"quotes-list-table__item-range",children:d&&s}),t("div",{className:"quotes-list-table__pagination",children:u&&l}),t("div",{className:"quotes-list-table__page-size-picker",children:b&&i})]})]})},fe=({pageSize:S,showItemRange:f=!0,showPageSizePicker:N=!0,showPagination:y=!0,onViewQuote:v,onPageSizeChange:s,onPageChange:p,slots:i,...x})=>{const[l,g]=Q(null),[m,h]=Q(!0),z=V()[0],[d,b]=Q(S||z),[u,T]=Q(1);A(()=>{const c=async()=>{try{h(!0);const r=await C({pageSize:d,currentPage:u});g(r)}catch(r){console.error("Failed to fetch quotes:",r)}finally{h(!1)}},e=U.on("authenticated",r=>{r?c():(g(null),h(!1))},{eager:!0});return()=>{e==null||e.off()}},[d,u]),A(()=>{const c=async()=>{try{const r=await C({pageSize:d,currentPage:u});g(r)}catch(r){console.error("Failed to fetch quotes:",r)}},e=U.on("quote-management/quote-renamed",()=>{c()},{eager:!0});return()=>{e==null||e.off()}},[d,u]);const k=c=>{b(c),T(1),s==null||s(c)},_=c=>{T(c),p==null||p(c)},O=c=>{const e=c.target,r=e==null?void 0:e.value;r&&k(Number(r))},R=(c,e,r)=>c.filter(a=>a==null?void 0:a.uid).map(a=>{var w,I,B,M;const G=`${a.buyer.firstname} ${a.buyer.lastname}`;return{id:a.uid,quoteName:t(o,{name:"QuoteName",slot:e==null?void 0:e.QuoteName,context:{quote:a},children:t("span",{children:a.name})}),created:t(o,{name:"Created",slot:e==null?void 0:e.Created,context:{quote:a},children:t("span",{children:a.createdAt?new Date(a.createdAt).toLocaleDateString():"N/A"})}),createdBy:t(o,{name:"CreatedBy",slot:e==null?void 0:e.CreatedBy,context:{quote:a},children:t("span",{children:G})}),status:t(o,{name:"Status",slot:e==null?void 0:e.Status,context:{quote:a},children:t("span",{children:a.status})}),lastUpdated:t(o,{name:"LastUpdated",slot:e==null?void 0:e.LastUpdated,context:{quote:a},children:t("span",{children:a.updatedAt?new Date(a.updatedAt).toLocaleDateString():"N/A"})}),quoteTemplate:t(o,{name:"QuoteTemplate",slot:e==null?void 0:e.QuoteTemplate,context:{quote:a},children:t("span",{children:a.templateName})}),quoteTotal:t(o,{name:"QuoteTotal",slot:e==null?void 0:e.QuoteTotal,context:{quote:a},children:t(Z,{amount:(I=(w=a.prices)==null?void 0:w.grandTotal)==null?void 0:I.value,currency:(M=(B=a.prices)==null?void 0:B.grandTotal)==null?void 0:M.currency})}),actions:t(o,{name:"Actions",slot:e==null?void 0:e.Actions,context:{quote:a,onViewQuote:r},children:t(Y,{variant:"tertiary",size:"medium",onClick:()=>r==null?void 0:r(a.uid,a.name,a.status),children:"View"})})}}),D=l!=null&&l.items?R(l.items,i,v):[],n=l==null?void 0:l.paginationInfo,L=!!n,E=t(o,{name:"EmptyQuotes",slot:i==null?void 0:i.EmptyQuotes,context:{quotesData:l},children:t(K,{heading:"No Quotes Found"})}),F=n?t(o,{name:"ItemRange",slot:i==null?void 0:i.ItemRange,context:n,children:P("span",{children:["Items ",n.startItem," to ",n.endItem," of"," ",n.totalCount," total"]})}):void 0,$=n&&n.pageSizeOptions?P(o,{name:"PageSizePicker",slot:i==null?void 0:i.PageSizePicker,context:{pageSize:n.pageSize,pageSizeOptions:n.pageSizeOptions,onPageSizeChange:k},children:[t("span",{children:"Show "}),t(W,{variant:"primary",size:"medium",value:String(n.pageSize),options:n.pageSizeOptions.map(c=>({value:String(c),text:String(c)})),handleSelect:O}),t("span",{children:" per page"})]}):void 0,j=n?t(o,{name:"Pagination",slot:i==null?void 0:i.Pagination,context:{currentPage:n.currentPage,totalPages:n.totalPages,onChange:_},children:t(X,{currentPage:n.currentPage,totalPages:n.totalPages,onChange:_})}):void 0;return t(ee,{rowData:D,loading:m,className:x.className,emptyStateMessage:E,showItemRange:f&&L,itemRangeMessage:F,showPageSizePicker:N&&L,pageSizePickerMessage:$,showPagination:y&&L,paginationMessage:j})};export{fe as QuotesListTable,fe as default};
4
4
  //# sourceMappingURL=QuotesListTable.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"QuotesListTable.js","sources":["/@dropins/storefront-quote-management/src/components/QuotesListTable/QuotesListTable.tsx","/@dropins/storefront-quote-management/src/containers/QuotesListTable/QuotesListTable.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 } from '@adobe-commerce/elsie/lib';\nimport { Table } from '@adobe-commerce/elsie/components';\nimport { useText } from '@adobe-commerce/elsie/i18n';\nimport '@/quote-management/components/QuotesListTable/QuotesListTable.css';\n\ntype Column = {\n key: string;\n label: string;\n};\n\nexport interface QuotesListTableProps\n extends Omit<HTMLAttributes<HTMLDivElement>, 'loading' | 'children'> {\n rowData: QuoteRowData[];\n loading?: boolean;\n className?: string;\n emptyStateMessage?: VNode;\n showItemRange?: boolean;\n itemRangeMessage?: VNode;\n showPageSizePicker?: boolean;\n pageSizePickerMessage?: VNode;\n showPagination?: boolean;\n paginationMessage?: VNode;\n}\n\nexport type QuoteRowData = {\n id: string;\n quoteName: VNode;\n created: VNode;\n createdBy: VNode;\n status: VNode;\n lastUpdated: VNode;\n quoteTemplate: VNode;\n quoteTotal: VNode;\n actions: VNode;\n [key: string]: VNode | string | number | undefined;\n};\n\nexport const QuotesListTable: FunctionComponent<QuotesListTableProps> = ({\n rowData = [],\n loading = false,\n className,\n emptyStateMessage,\n showItemRange = true,\n itemRangeMessage,\n showPageSizePicker = true,\n pageSizePickerMessage,\n showPagination = true,\n paginationMessage,\n ...props\n}) => {\n const dictionary = useText({\n quoteName: 'QuoteManagement.QuotesListTable.quoteName',\n created: 'QuoteManagement.QuotesListTable.created',\n createdBy: 'QuoteManagement.QuotesListTable.createdBy',\n status: 'QuoteManagement.QuotesListTable.status',\n lastUpdated: 'QuoteManagement.QuotesListTable.lastUpdated',\n quoteTemplate: 'QuoteManagement.QuotesListTable.quoteTemplate',\n quoteTotal: 'QuoteManagement.QuotesListTable.quoteTotal',\n actions: 'QuoteManagement.QuotesListTable.actions',\n });\n\n const columns: Column[] = [\n { key: 'quoteName', label: dictionary.quoteName },\n { key: 'created', label: dictionary.created },\n { key: 'createdBy', label: dictionary.createdBy },\n { key: 'status', label: dictionary.status },\n { key: 'lastUpdated', label: dictionary.lastUpdated },\n { key: 'quoteTemplate', label: dictionary.quoteTemplate },\n { key: 'quoteTotal', label: dictionary.quoteTotal },\n { key: 'actions', label: dictionary.actions },\n ];\n\n // Check if we should show empty state\n const shouldShowEmptyState =\n !loading && rowData.length === 0 && emptyStateMessage;\n\n // Show item range if requested and message is provided\n const shouldShowItemRange = showItemRange && itemRangeMessage;\n\n // Show page size picker if requested and message is provided\n const shouldShowPageSizePicker = showPageSizePicker && pageSizePickerMessage;\n\n // Show pagination if requested and message is provided\n const shouldShowPagination = showPagination && paginationMessage;\n\n // Show footer if any pagination element should be shown\n const shouldShowFooter =\n shouldShowItemRange || shouldShowPageSizePicker || shouldShowPagination;\n\n return (\n <div\n {...props}\n className={classes(['quote-management-quotes-list-table', className])}\n >\n <Table\n columns={columns}\n rowData={rowData}\n loading={loading}\n mobileLayout=\"none\"\n className=\"quote-management-quotes-list-table__table\"\n />\n {shouldShowEmptyState && (\n <div className=\"quotes-list-table__empty-state\">\n {emptyStateMessage}\n </div>\n )}\n {shouldShowFooter && (\n <div className=\"quotes-list-table__footer\">\n <div className=\"quotes-list-table__item-range\">\n {shouldShowItemRange && itemRangeMessage}\n </div>\n <div className=\"quotes-list-table__pagination\">\n {shouldShowPagination && paginationMessage}\n </div>\n <div className=\"quotes-list-table__page-size-picker\">\n {shouldShowPageSizePicker && pageSizePickerMessage}\n </div>\n </div>\n )}\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, Slot, SlotProps } from '@adobe-commerce/elsie/lib';\nimport {\n Price,\n Button,\n IllustratedMessage,\n Picker,\n Pagination,\n type PickerOption,\n} from '@adobe-commerce/elsie/components';\nimport { events } from '@adobe-commerce/event-bus';\nimport {\n QuotesListTable as QuotesListTableComponent,\n QuoteRowData,\n} from '@/quote-management/components';\nimport { negotiableQuotes } from '@/quote-management/api';\nimport { getDefaultPageSizeOptions } from '@/quote-management/data/transforms';\nimport {\n NegotiableQuotesListModel,\n NegotiableQuoteListEntry,\n} from '@/quote-management/data/models';\n\nexport interface QuotesListTableProps extends HTMLAttributes<HTMLDivElement> {\n pageSize?: number;\n showItemRange?: boolean;\n showPageSizePicker?: boolean;\n showPagination?: boolean;\n onViewQuote?: (quoteId: string, quoteName: string, status: string) => void;\n onPageSizeChange?: (pageSize: number) => void;\n onPageChange?: (page: number) => void;\n slots?: {\n /** Slot for customizing the quote name cell content */\n QuoteName?: SlotProps<{ quote: NegotiableQuoteListEntry }>;\n /** Slot for customizing the created date cell content */\n Created?: SlotProps<{ quote: NegotiableQuoteListEntry }>;\n /** Slot for customizing the created by cell content */\n CreatedBy?: SlotProps<{ quote: NegotiableQuoteListEntry }>;\n /** Slot for customizing the status cell content */\n Status?: SlotProps<{ quote: NegotiableQuoteListEntry }>;\n /** Slot for customizing the last updated cell content */\n LastUpdated?: SlotProps<{ quote: NegotiableQuoteListEntry }>;\n /** Slot for customizing the quote template cell content */\n QuoteTemplate?: SlotProps<{ quote: NegotiableQuoteListEntry }>;\n /** Slot for customizing the quote total cell content */\n QuoteTotal?: SlotProps<{ quote: NegotiableQuoteListEntry }>;\n /** Slot for customizing the actions cell content */\n Actions?: SlotProps<{\n quote: NegotiableQuoteListEntry;\n onViewQuote?: (id: string, name: string, status: string) => void;\n }>;\n /** Slot for customizing the empty quotes message */\n EmptyQuotes?: SlotProps;\n /** Slot for customizing the item range display */\n ItemRange?: SlotProps<{\n startItem: number;\n endItem: number;\n totalCount: number;\n currentPage: number;\n pageSize: number;\n }>;\n /** Slot for customizing the page size picker */\n PageSizePicker?: SlotProps<{\n pageSize: number;\n pageSizeOptions: number[];\n onPageSizeChange?: (pageSize: number) => void;\n }>;\n /** Slot for customizing the pagination */\n Pagination?: SlotProps<{\n currentPage: number;\n totalPages: number;\n onChange?: (page: number) => void;\n }>;\n };\n}\n\nexport const QuotesListTable: Container<QuotesListTableProps> = ({\n pageSize,\n showItemRange = true,\n showPageSizePicker = true,\n showPagination = true,\n onViewQuote,\n onPageSizeChange,\n onPageChange,\n slots,\n ...props\n}) => {\n const [quotesData, setQuotesData] =\n useState<NegotiableQuotesListModel | null>(null);\n const [loading, setLoading] = useState(true);\n\n // Default to first page size option if no pageSize prop provided\n const defaultPageSize = getDefaultPageSizeOptions()[0];\n const [currentPageSize, setCurrentPageSize] = useState(\n pageSize || defaultPageSize\n );\n const [currentPage, setCurrentPage] = useState(1);\n\n // Fetch quotes data when authenticated\n useEffect(() => {\n const fetchQuotes = async () => {\n try {\n setLoading(true);\n const data = await negotiableQuotes({\n pageSize: currentPageSize,\n currentPage,\n });\n setQuotesData(data);\n } catch (error) {\n console.error('Failed to fetch quotes:', error);\n } finally {\n setLoading(false);\n }\n };\n\n // Listen for authentication events\n const unsubscribe = events.on(\n 'authenticated',\n (isAuthenticated) => {\n if (isAuthenticated) {\n fetchQuotes();\n } else {\n setQuotesData(null);\n setLoading(false);\n }\n },\n { eager: true }\n ); // eager: true means it fires immediately with current state\n\n return () => {\n unsubscribe?.off();\n };\n }, [currentPageSize, currentPage]);\n\n // Handle page size change\n const handlePageSizeChange = (newPageSize: number) => {\n setCurrentPageSize(newPageSize);\n setCurrentPage(1); // Reset to page 1 when page size changes\n onPageSizeChange?.(newPageSize); // Also call parent callback\n };\n\n // Handle page change\n const handlePageChange = (newPage: number) => {\n setCurrentPage(newPage);\n onPageChange?.(newPage); // Also call parent callback\n };\n\n // Handle page size picker selection\n const handlePageSizeSelect = (event: Event) => {\n const target = event.target as HTMLSelectElement;\n const value = target?.value;\n if (value) {\n handlePageSizeChange(Number(value));\n }\n };\n\n // Prepare transformed quote data for table component\n const prepareRowData = (\n quotes: NegotiableQuoteListEntry[],\n slots?: QuotesListTableProps['slots'],\n onViewQuote?: (quoteId: string, quoteName: string, status: string) => void\n ): QuoteRowData[] => {\n return quotes\n .filter((quote) => quote?.uid) // Filter out null quotes\n .map((quote) => {\n const createdByName = `${quote.buyer.firstname} ${quote.buyer.lastname}`;\n\n return {\n id: quote.uid,\n quoteName: (\n <Slot name=\"QuoteName\" slot={slots?.QuoteName} context={{ quote }}>\n <span>{quote.name}</span>\n </Slot>\n ),\n created: (\n <Slot name=\"Created\" slot={slots?.Created} context={{ quote }}>\n <span>\n {quote.createdAt\n ? new Date(quote.createdAt).toLocaleDateString()\n : 'N/A'}\n </span>\n </Slot>\n ),\n createdBy: (\n <Slot name=\"CreatedBy\" slot={slots?.CreatedBy} context={{ quote }}>\n <span>{createdByName}</span>\n </Slot>\n ),\n status: (\n <Slot name=\"Status\" slot={slots?.Status} context={{ quote }}>\n <span>{quote.status}</span>\n </Slot>\n ),\n lastUpdated: (\n <Slot\n name=\"LastUpdated\"\n slot={slots?.LastUpdated}\n context={{ quote }}\n >\n <span>\n {quote.updatedAt\n ? new Date(quote.updatedAt).toLocaleDateString()\n : 'N/A'}\n </span>\n </Slot>\n ),\n quoteTemplate: (\n <Slot\n name=\"QuoteTemplate\"\n slot={slots?.QuoteTemplate}\n context={{ quote }}\n >\n <span>{quote.templateName}</span>\n </Slot>\n ),\n quoteTotal: (\n <Slot\n name=\"QuoteTotal\"\n slot={slots?.QuoteTotal}\n context={{ quote }}\n >\n <Price\n amount={quote.prices?.grandTotal?.value}\n currency={quote.prices?.grandTotal?.currency}\n />\n </Slot>\n ),\n actions: (\n <Slot\n name=\"Actions\"\n slot={slots?.Actions}\n context={{ quote, onViewQuote }}\n >\n <Button\n variant=\"tertiary\"\n size=\"medium\"\n onClick={() =>\n onViewQuote?.(quote.uid, quote.name, quote.status)\n }\n >\n View\n </Button>\n </Slot>\n ),\n };\n });\n };\n\n // Prepare data for rendering\n const rowData = quotesData?.items\n ? prepareRowData(quotesData.items, slots, onViewQuote)\n : [];\n\n const paginationInfo = quotesData?.paginationInfo;\n const shouldShowPagination = !!paginationInfo;\n\n // Empty state message\n const emptyStateMessage = (\n <Slot name=\"EmptyQuotes\" slot={slots?.EmptyQuotes} context={{ quotesData }}>\n <IllustratedMessage heading=\"No Quotes Found\" />\n </Slot>\n );\n\n // Item range message\n const itemRangeMessage = paginationInfo ? (\n <Slot name=\"ItemRange\" slot={slots?.ItemRange} context={paginationInfo}>\n <span>\n Items {paginationInfo.startItem} to {paginationInfo.endItem} of{' '}\n {paginationInfo.totalCount} total\n </span>\n </Slot>\n ) : undefined;\n\n // Prepare page size picker message for component\n const pageSizePickerMessage =\n paginationInfo && paginationInfo.pageSizeOptions ? (\n <Slot\n name=\"PageSizePicker\"\n slot={slots?.PageSizePicker}\n context={{\n pageSize: paginationInfo.pageSize,\n pageSizeOptions: paginationInfo.pageSizeOptions,\n onPageSizeChange: handlePageSizeChange,\n }}\n >\n <span>Show </span>\n <Picker\n variant=\"primary\"\n size=\"medium\"\n value={String(paginationInfo.pageSize)}\n options={paginationInfo.pageSizeOptions.map(\n (size): PickerOption => ({\n value: String(size),\n text: String(size),\n })\n )}\n handleSelect={handlePageSizeSelect}\n />\n <span> per page</span>\n </Slot>\n ) : undefined;\n\n // Prepare pagination message for component\n const paginationMessage = paginationInfo ? (\n <Slot\n name=\"Pagination\"\n slot={slots?.Pagination}\n context={{\n currentPage: paginationInfo.currentPage,\n totalPages: paginationInfo.totalPages,\n onChange: handlePageChange,\n }}\n >\n <Pagination\n currentPage={paginationInfo.currentPage}\n totalPages={paginationInfo.totalPages}\n onChange={handlePageChange}\n />\n </Slot>\n ) : undefined;\n\n return (\n <QuotesListTableComponent\n rowData={rowData}\n loading={loading}\n className={props.className as string}\n emptyStateMessage={emptyStateMessage}\n showItemRange={showItemRange && shouldShowPagination}\n itemRangeMessage={itemRangeMessage}\n showPageSizePicker={showPageSizePicker && shouldShowPagination}\n pageSizePickerMessage={pageSizePickerMessage}\n showPagination={showPagination && shouldShowPagination}\n paginationMessage={paginationMessage}\n />\n );\n};\n"],"names":["QuotesListTable","rowData","loading","className","emptyStateMessage","showItemRange","itemRangeMessage","showPageSizePicker","pageSizePickerMessage","showPagination","paginationMessage","props","dictionary","useText","columns","shouldShowEmptyState","shouldShowItemRange","shouldShowPageSizePicker","shouldShowPagination","shouldShowFooter","jsxs","classes","jsx","Table","pageSize","onViewQuote","onPageSizeChange","onPageChange","slots","quotesData","setQuotesData","useState","setLoading","defaultPageSize","getDefaultPageSizeOptions","currentPageSize","setCurrentPageSize","currentPage","setCurrentPage","useEffect","fetchQuotes","data","negotiableQuotes","error","unsubscribe","events","isAuthenticated","handlePageSizeChange","newPageSize","handlePageChange","newPage","handlePageSizeSelect","event","target","value","prepareRowData","quotes","quote","createdByName","Slot","Price","_b","_a","_d","_c","Button","paginationInfo","IllustratedMessage","Picker","size","Pagination","QuotesListTableComponent"],"mappings":"kyBAgDO,MAAMA,GAA2D,CAAC,CACvE,QAAAC,EAAU,CAAA,EACV,QAAAC,EAAU,GACV,UAAAC,EACA,kBAAAC,EACA,cAAAC,EAAgB,GAChB,iBAAAC,EACA,mBAAAC,EAAqB,GACrB,sBAAAC,EACA,eAAAC,EAAiB,GACjB,kBAAAC,EACA,GAAGC,CACL,IAAM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AAO,eACb,QAAS,CACP,SAAUsC,EAAe,SACzB,gBAAiBA,EAAe,gBAChC,iBAAkBnB,CAAA,EAGpB,SAAA,CAAAzB,EAAC,QAAK,SAAA,OAAA,CAAK,EACXA,EAAC8C,EAAA,CACC,QAAQ,UACR,KAAK,SACL,MAAO,OAAOF,EAAe,QAAQ,EACrC,QAASA,EAAe,gBAAgB,IACrCG,IAAwB,CACvB,MAAO,OAAOA,CAAI,EAClB,KAAM,OAAOA,CAAI,CAAA,EACnB,EAEF,aAAclB,CAAA,CAAA,EAEhB7B,EAAC,QAAK,SAAA,WAAA,CAAS,CAAA,CAAA,CAAA,EAEf,OAGAZ,EAAoBwD,EACxB5C,EAACqC,EAAA,CACC,KAAK,aACL,KAAM/B,GAAA,YAAAA,EAAO,WACb,QAAS,CACP,YAAasC,EAAe,YAC5B,WAAYA,EAAe,WAC3B,SAAUjB,CAAA,EAGZ,SAAA3B,EAACgD,EAAA,CACC,YAAaJ,EAAe,YAC5B,WAAYA,EAAe,WAC3B,SAAUjB,CAAA,CAAA,CACZ,CAAA,EAEA,OAEJ,OACE3B,EAACiD,GAAA,CACC,QAAAtE,EACA,QAAAC,EACA,UAAWS,EAAM,UACjB,kBAAAP,EACA,cAAeC,GAAiBa,EAChC,iBAAAZ,EACA,mBAAoBC,GAAsBW,EAC1C,sBAAAV,EACA,eAAgBC,GAAkBS,EAClC,kBAAAR,CAAA,CAAA,CAGN"}
1
+ {"version":3,"file":"QuotesListTable.js","sources":["/@dropins/storefront-quote-management/src/components/QuotesListTable/QuotesListTable.tsx","/@dropins/storefront-quote-management/src/containers/QuotesListTable/QuotesListTable.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 } from '@adobe-commerce/elsie/lib';\nimport { Table } from '@adobe-commerce/elsie/components';\nimport { useText } from '@adobe-commerce/elsie/i18n';\nimport '@/quote-management/components/QuotesListTable/QuotesListTable.css';\n\ntype Column = {\n key: string;\n label: string;\n};\n\nexport interface QuotesListTableProps\n extends Omit<HTMLAttributes<HTMLDivElement>, 'loading' | 'children'> {\n rowData: QuoteRowData[];\n loading?: boolean;\n className?: string;\n emptyStateMessage?: VNode;\n showItemRange?: boolean;\n itemRangeMessage?: VNode;\n showPageSizePicker?: boolean;\n pageSizePickerMessage?: VNode;\n showPagination?: boolean;\n paginationMessage?: VNode;\n}\n\nexport type QuoteRowData = {\n id: string;\n quoteName: VNode;\n created: VNode;\n createdBy: VNode;\n status: VNode;\n lastUpdated: VNode;\n quoteTemplate: VNode;\n quoteTotal: VNode;\n actions: VNode;\n [key: string]: VNode | string | number | undefined;\n};\n\nexport const QuotesListTable: FunctionComponent<QuotesListTableProps> = ({\n rowData = [],\n loading = false,\n className,\n emptyStateMessage,\n showItemRange = true,\n itemRangeMessage,\n showPageSizePicker = true,\n pageSizePickerMessage,\n showPagination = true,\n paginationMessage,\n ...props\n}) => {\n const dictionary = useText({\n quoteName: 'QuoteManagement.QuotesListTable.quoteName',\n created: 'QuoteManagement.QuotesListTable.created',\n createdBy: 'QuoteManagement.QuotesListTable.createdBy',\n status: 'QuoteManagement.QuotesListTable.status',\n lastUpdated: 'QuoteManagement.QuotesListTable.lastUpdated',\n quoteTemplate: 'QuoteManagement.QuotesListTable.quoteTemplate',\n quoteTotal: 'QuoteManagement.QuotesListTable.quoteTotal',\n actions: 'QuoteManagement.QuotesListTable.actions',\n });\n\n const columns: Column[] = [\n { key: 'quoteName', label: dictionary.quoteName },\n { key: 'created', label: dictionary.created },\n { key: 'createdBy', label: dictionary.createdBy },\n { key: 'status', label: dictionary.status },\n { key: 'lastUpdated', label: dictionary.lastUpdated },\n { key: 'quoteTemplate', label: dictionary.quoteTemplate },\n { key: 'quoteTotal', label: dictionary.quoteTotal },\n { key: 'actions', label: dictionary.actions },\n ];\n\n // Check if we should show empty state\n const shouldShowEmptyState =\n !loading && rowData.length === 0 && emptyStateMessage;\n\n // Show item range if requested and message is provided\n const shouldShowItemRange = showItemRange && itemRangeMessage;\n\n // Show page size picker if requested and message is provided\n const shouldShowPageSizePicker = showPageSizePicker && pageSizePickerMessage;\n\n // Show pagination if requested and message is provided\n const shouldShowPagination = showPagination && paginationMessage;\n\n // Show footer if any pagination element should be shown\n const shouldShowFooter =\n shouldShowItemRange || shouldShowPageSizePicker || shouldShowPagination;\n\n return (\n <div\n {...props}\n className={classes(['quote-management-quotes-list-table', className])}\n >\n <Table\n columns={columns}\n rowData={rowData}\n loading={loading}\n mobileLayout=\"none\"\n className=\"quote-management-quotes-list-table__table\"\n />\n {shouldShowEmptyState && (\n <div className=\"quotes-list-table__empty-state\">\n {emptyStateMessage}\n </div>\n )}\n {shouldShowFooter && (\n <div className=\"quotes-list-table__footer\">\n <div className=\"quotes-list-table__item-range\">\n {shouldShowItemRange && itemRangeMessage}\n </div>\n <div className=\"quotes-list-table__pagination\">\n {shouldShowPagination && paginationMessage}\n </div>\n <div className=\"quotes-list-table__page-size-picker\">\n {shouldShowPageSizePicker && pageSizePickerMessage}\n </div>\n </div>\n )}\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, Slot, SlotProps } from '@adobe-commerce/elsie/lib';\nimport {\n Price,\n Button,\n IllustratedMessage,\n Picker,\n Pagination,\n type PickerOption,\n} from '@adobe-commerce/elsie/components';\nimport { events } from '@adobe-commerce/event-bus';\nimport {\n QuotesListTable as QuotesListTableComponent,\n QuoteRowData,\n} from '@/quote-management/components';\nimport { negotiableQuotes } from '@/quote-management/api';\nimport { getDefaultPageSizeOptions } from '@/quote-management/data/transforms';\nimport {\n NegotiableQuotesListModel,\n NegotiableQuoteListEntry,\n} from '@/quote-management/data/models';\n\nexport interface QuotesListTableProps extends HTMLAttributes<HTMLDivElement> {\n pageSize?: number;\n showItemRange?: boolean;\n showPageSizePicker?: boolean;\n showPagination?: boolean;\n onViewQuote?: (quoteId: string, quoteName: string, status: string) => void;\n onPageSizeChange?: (pageSize: number) => void;\n onPageChange?: (page: number) => void;\n slots?: {\n /** Slot for customizing the quote name cell content */\n QuoteName?: SlotProps<{ quote: NegotiableQuoteListEntry }>;\n /** Slot for customizing the created date cell content */\n Created?: SlotProps<{ quote: NegotiableQuoteListEntry }>;\n /** Slot for customizing the created by cell content */\n CreatedBy?: SlotProps<{ quote: NegotiableQuoteListEntry }>;\n /** Slot for customizing the status cell content */\n Status?: SlotProps<{ quote: NegotiableQuoteListEntry }>;\n /** Slot for customizing the last updated cell content */\n LastUpdated?: SlotProps<{ quote: NegotiableQuoteListEntry }>;\n /** Slot for customizing the quote template cell content */\n QuoteTemplate?: SlotProps<{ quote: NegotiableQuoteListEntry }>;\n /** Slot for customizing the quote total cell content */\n QuoteTotal?: SlotProps<{ quote: NegotiableQuoteListEntry }>;\n /** Slot for customizing the actions cell content */\n Actions?: SlotProps<{\n quote: NegotiableQuoteListEntry;\n onViewQuote?: (id: string, name: string, status: string) => void;\n }>;\n /** Slot for customizing the empty quotes message */\n EmptyQuotes?: SlotProps;\n /** Slot for customizing the item range display */\n ItemRange?: SlotProps<{\n startItem: number;\n endItem: number;\n totalCount: number;\n currentPage: number;\n pageSize: number;\n }>;\n /** Slot for customizing the page size picker */\n PageSizePicker?: SlotProps<{\n pageSize: number;\n pageSizeOptions: number[];\n onPageSizeChange?: (pageSize: number) => void;\n }>;\n /** Slot for customizing the pagination */\n Pagination?: SlotProps<{\n currentPage: number;\n totalPages: number;\n onChange?: (page: number) => void;\n }>;\n };\n}\n\nexport const QuotesListTable: Container<QuotesListTableProps> = ({\n pageSize,\n showItemRange = true,\n showPageSizePicker = true,\n showPagination = true,\n onViewQuote,\n onPageSizeChange,\n onPageChange,\n slots,\n ...props\n}) => {\n const [quotesData, setQuotesData] =\n useState<NegotiableQuotesListModel | null>(null);\n const [loading, setLoading] = useState(true);\n\n // Default to first page size option if no pageSize prop provided\n const defaultPageSize = getDefaultPageSizeOptions()[0];\n const [currentPageSize, setCurrentPageSize] = useState(\n pageSize || defaultPageSize\n );\n const [currentPage, setCurrentPage] = useState(1);\n\n // Fetch quotes data when authenticated\n useEffect(() => {\n const fetchQuotes = async () => {\n try {\n setLoading(true);\n const data = await negotiableQuotes({\n pageSize: currentPageSize,\n currentPage,\n });\n setQuotesData(data);\n } catch (error) {\n console.error('Failed to fetch quotes:', error);\n } finally {\n setLoading(false);\n }\n };\n\n // Listen for authentication events\n const unsubscribe = events.on(\n 'authenticated',\n (isAuthenticated) => {\n if (isAuthenticated) {\n fetchQuotes();\n } else {\n setQuotesData(null);\n setLoading(false);\n }\n },\n { eager: true }\n ); // eager: true means it fires immediately with current state\n\n return () => {\n unsubscribe?.off();\n };\n }, [currentPageSize, currentPage]);\n\n // Listen for quote renamed event to refresh the list\n useEffect(() => {\n const fetchQuotes = async () => {\n try {\n const data = await negotiableQuotes({\n pageSize: currentPageSize,\n currentPage,\n });\n setQuotesData(data);\n } catch (error) {\n console.error('Failed to fetch quotes:', error);\n }\n };\n\n const unsubscribe = events.on(\n 'quote-management/quote-renamed',\n () => {\n // Refetch quotes list to show the updated name\n fetchQuotes();\n },\n { eager: true }\n );\n\n return () => {\n unsubscribe?.off();\n };\n }, [currentPageSize, currentPage]);\n\n // Handle page size change\n const handlePageSizeChange = (newPageSize: number) => {\n setCurrentPageSize(newPageSize);\n setCurrentPage(1); // Reset to page 1 when page size changes\n onPageSizeChange?.(newPageSize); // Also call parent callback\n };\n\n // Handle page change\n const handlePageChange = (newPage: number) => {\n setCurrentPage(newPage);\n onPageChange?.(newPage); // Also call parent callback\n };\n\n // Handle page size picker selection\n const handlePageSizeSelect = (event: Event) => {\n const target = event.target as HTMLSelectElement;\n const value = target?.value;\n if (value) {\n handlePageSizeChange(Number(value));\n }\n };\n\n // Prepare transformed quote data for table component\n const prepareRowData = (\n quotes: NegotiableQuoteListEntry[],\n slots?: QuotesListTableProps['slots'],\n onViewQuote?: (quoteId: string, quoteName: string, status: string) => void\n ): QuoteRowData[] => {\n return quotes\n .filter((quote) => quote?.uid) // Filter out null quotes\n .map((quote) => {\n const createdByName = `${quote.buyer.firstname} ${quote.buyer.lastname}`;\n\n return {\n id: quote.uid,\n quoteName: (\n <Slot name=\"QuoteName\" slot={slots?.QuoteName} context={{ quote }}>\n <span>{quote.name}</span>\n </Slot>\n ),\n created: (\n <Slot name=\"Created\" slot={slots?.Created} context={{ quote }}>\n <span>\n {quote.createdAt\n ? new Date(quote.createdAt).toLocaleDateString()\n : 'N/A'}\n </span>\n </Slot>\n ),\n createdBy: (\n <Slot name=\"CreatedBy\" slot={slots?.CreatedBy} context={{ quote }}>\n <span>{createdByName}</span>\n </Slot>\n ),\n status: (\n <Slot name=\"Status\" slot={slots?.Status} context={{ quote }}>\n <span>{quote.status}</span>\n </Slot>\n ),\n lastUpdated: (\n <Slot\n name=\"LastUpdated\"\n slot={slots?.LastUpdated}\n context={{ quote }}\n >\n <span>\n {quote.updatedAt\n ? new Date(quote.updatedAt).toLocaleDateString()\n : 'N/A'}\n </span>\n </Slot>\n ),\n quoteTemplate: (\n <Slot\n name=\"QuoteTemplate\"\n slot={slots?.QuoteTemplate}\n context={{ quote }}\n >\n <span>{quote.templateName}</span>\n </Slot>\n ),\n quoteTotal: (\n <Slot\n name=\"QuoteTotal\"\n slot={slots?.QuoteTotal}\n context={{ quote }}\n >\n <Price\n amount={quote.prices?.grandTotal?.value}\n currency={quote.prices?.grandTotal?.currency}\n />\n </Slot>\n ),\n actions: (\n <Slot\n name=\"Actions\"\n slot={slots?.Actions}\n context={{ quote, onViewQuote }}\n >\n <Button\n variant=\"tertiary\"\n size=\"medium\"\n onClick={() =>\n onViewQuote?.(quote.uid, quote.name, quote.status)\n }\n >\n View\n </Button>\n </Slot>\n ),\n };\n });\n };\n\n // Prepare data for rendering\n const rowData = quotesData?.items\n ? prepareRowData(quotesData.items, slots, onViewQuote)\n : [];\n\n const paginationInfo = quotesData?.paginationInfo;\n const shouldShowPagination = !!paginationInfo;\n\n // Empty state message\n const emptyStateMessage = (\n <Slot name=\"EmptyQuotes\" slot={slots?.EmptyQuotes} context={{ quotesData }}>\n <IllustratedMessage heading=\"No Quotes Found\" />\n </Slot>\n );\n\n // Item range message\n const itemRangeMessage = paginationInfo ? (\n <Slot name=\"ItemRange\" slot={slots?.ItemRange} context={paginationInfo}>\n <span>\n Items {paginationInfo.startItem} to {paginationInfo.endItem} of{' '}\n {paginationInfo.totalCount} total\n </span>\n </Slot>\n ) : undefined;\n\n // Prepare page size picker message for component\n const pageSizePickerMessage =\n paginationInfo && paginationInfo.pageSizeOptions ? (\n <Slot\n name=\"PageSizePicker\"\n slot={slots?.PageSizePicker}\n context={{\n pageSize: paginationInfo.pageSize,\n pageSizeOptions: paginationInfo.pageSizeOptions,\n onPageSizeChange: handlePageSizeChange,\n }}\n >\n <span>Show </span>\n <Picker\n variant=\"primary\"\n size=\"medium\"\n value={String(paginationInfo.pageSize)}\n options={paginationInfo.pageSizeOptions.map(\n (size): PickerOption => ({\n value: String(size),\n text: String(size),\n })\n )}\n handleSelect={handlePageSizeSelect}\n />\n <span> per page</span>\n </Slot>\n ) : undefined;\n\n // Prepare pagination message for component\n const paginationMessage = paginationInfo ? (\n <Slot\n name=\"Pagination\"\n slot={slots?.Pagination}\n context={{\n currentPage: paginationInfo.currentPage,\n totalPages: paginationInfo.totalPages,\n onChange: handlePageChange,\n }}\n >\n <Pagination\n currentPage={paginationInfo.currentPage}\n totalPages={paginationInfo.totalPages}\n onChange={handlePageChange}\n />\n </Slot>\n ) : undefined;\n\n return (\n <QuotesListTableComponent\n rowData={rowData}\n loading={loading}\n className={props.className as string}\n emptyStateMessage={emptyStateMessage}\n showItemRange={showItemRange && shouldShowPagination}\n itemRangeMessage={itemRangeMessage}\n showPageSizePicker={showPageSizePicker && shouldShowPagination}\n pageSizePickerMessage={pageSizePickerMessage}\n showPagination={showPagination && shouldShowPagination}\n paginationMessage={paginationMessage}\n />\n );\n};\n"],"names":["QuotesListTable","rowData","loading","className","emptyStateMessage","showItemRange","itemRangeMessage","showPageSizePicker","pageSizePickerMessage","showPagination","paginationMessage","props","dictionary","useText","columns","shouldShowEmptyState","shouldShowItemRange","shouldShowPageSizePicker","shouldShowPagination","shouldShowFooter","jsxs","classes","jsx","Table","pageSize","onViewQuote","onPageSizeChange","onPageChange","slots","quotesData","setQuotesData","useState","setLoading","defaultPageSize","getDefaultPageSizeOptions","currentPageSize","setCurrentPageSize","currentPage","setCurrentPage","useEffect","fetchQuotes","data","negotiableQuotes","error","unsubscribe","events","isAuthenticated","handlePageSizeChange","newPageSize","handlePageChange","newPage","handlePageSizeSelect","event","target","value","prepareRowData","quotes","quote","createdByName","Slot","Price","_b","_a","_d","_c","Button","paginationInfo","IllustratedMessage","Picker","size","Pagination","QuotesListTableComponent"],"mappings":"k0BAgDO,MAAMA,GAA2D,CAAC,CACvE,QAAAC,EAAU,CAAA,EACV,QAAAC,EAAU,GACV,UAAAC,EACA,kBAAAC,EACA,cAAAC,EAAgB,GAChB,iBAAAC,EACA,mBAAAC,EAAqB,GACrB,sBAAAC,EACA,eAAAC,EAAiB,GACjB,kBAAAC,EACA,GAAGC,CACL,IAAM,CACJ,MAAMC,EAAaC,EAAQ,CACzB,UAAW,4CACX,QAAS,0CACT,UAAW,4CACX,OAAQ,yCACR,YAAa,8CACb,cAAe,gDACf,WAAY,6CACZ,QAAS,yCAAA,CACV,EAEKC,EAAoB,CACxB,CAAE,IAAK,YAAa,MAAOF,EAAW,SAAA,EACtC,CAAE,IAAK,UAAW,MAAOA,EAAW,OAAA,EACpC,CAAE,IAAK,YAAa,MAAOA,EAAW,SAAA,EACtC,CAAE,IAAK,SAAU,MAAO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Ae,gBAC/B9C,EAACuC,EAAA,CACC,KAAK,iBACL,KAAM/B,GAAA,YAAAA,EAAO,eACb,QAAS,CACP,SAAUsC,EAAe,SACzB,gBAAiBA,EAAe,gBAChC,iBAAkBnB,CAAA,EAGpB,SAAA,CAAAzB,EAAC,QAAK,SAAA,OAAA,CAAK,EACXA,EAAC8C,EAAA,CACC,QAAQ,UACR,KAAK,SACL,MAAO,OAAOF,EAAe,QAAQ,EACrC,QAASA,EAAe,gBAAgB,IACrCG,IAAwB,CACvB,MAAO,OAAOA,CAAI,EAClB,KAAM,OAAOA,CAAI,CAAA,EACnB,EAEF,aAAclB,CAAA,CAAA,EAEhB7B,EAAC,QAAK,SAAA,WAAA,CAAS,CAAA,CAAA,CAAA,EAEf,OAGAZ,EAAoBwD,EACxB5C,EAACqC,EAAA,CACC,KAAK,aACL,KAAM/B,GAAA,YAAAA,EAAO,WACb,QAAS,CACP,YAAasC,EAAe,YAC5B,WAAYA,EAAe,WAC3B,SAAUjB,CAAA,EAGZ,SAAA3B,EAACgD,EAAA,CACC,YAAaJ,EAAe,YAC5B,WAAYA,EAAe,WAC3B,SAAUjB,CAAA,CAAA,CACZ,CAAA,EAEA,OAEJ,OACE3B,EAACiD,GAAA,CACC,QAAAtE,EACA,QAAAC,EACA,UAAWS,EAAM,UACjB,kBAAAP,EACA,cAAeC,GAAiBa,EAChC,iBAAAZ,EACA,mBAAoBC,GAAsBW,EAC1C,sBAAAV,EACA,eAAgBC,GAAkBS,EAClC,kBAAAR,CAAA,CAAA,CAGN"}
@@ -1,4 +1,4 @@
1
1
  /*! Copyright 2025 Adobe
2
2
  All Rights Reserved. */
3
- import{jsxs as j,jsx as a}from"@dropins/tools/preact-jsx-runtime.js";import*as u from"@dropins/tools/preact-compat.js";import{useState as q,useEffect as y,useCallback as re}from"@dropins/tools/preact-compat.js";import{classes as m,VComponent as h,Slot as N,getFormErrors as z,getFormValues as oe}from"@dropins/tools/lib.js";import{TextArea as ne,Field as ie,Input as se,InputFile as ce,Button as I,InLineAlert as me}from"@dropins/tools/components.js";/* empty css */import{events as T}from"@dropins/tools/event-bus.js";import"../chunks/fetch-graphql.js";import{u as ue,r as B}from"../chunks/uploadFile.js";import{S as de}from"../chunks/WarningFilled.js";import{useText as le}from"@dropins/tools/i18n.js";import"@dropins/tools/fetch-graphql.js";import"../chunks/NegotiableQuoteFragment.js";const fe=i=>u.createElement("svg",{id:"Icon_Add_Base","data-name":"Icon \\u2013 Add \\u2013 Base",xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",...i},u.createElement("g",{id:"Large"},u.createElement("rect",{id:"Placement_area","data-name":"Placement area",width:24,height:24,fill:"#fff",opacity:0}),u.createElement("g",{id:"Add_icon","data-name":"Add icon",transform:"translate(9.734 9.737)"},u.createElement("line",{vectorEffect:"non-scaling-stroke",id:"Line_579","data-name":"Line 579",y2:12.7,transform:"translate(2.216 -4.087)",fill:"none",stroke:"currentColor"}),u.createElement("line",{vectorEffect:"non-scaling-stroke",id:"Line_580","data-name":"Line 580",x2:12.7,transform:"translate(-4.079 2.263)",fill:"none",stroke:"currentColor"})))),ge=i=>u.createElement("svg",{width:24,height:24,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",...i},u.createElement("path",{vectorEffect:"non-scaling-stroke",d:"M0.75 12C0.75 5.78421 5.78421 0.75 12 0.75C18.2158 0.75 23.25 5.78421 23.25 12C23.25 18.2158 18.2158 23.25 12 23.25C5.78421 23.25 0.75 18.2158 0.75 12Z",stroke:"currentColor"}),u.createElement("path",{vectorEffect:"non-scaling-stroke",d:"M6.75 12.762L10.2385 15.75L17.25 9",stroke:"currentColor"})),qe=({className:i,title:e,banner:F,commentField:_,quoteNameField:b,attachFile:s,requestButton:l,saveButton:Q,onSubmit:x,...E})=>j("form",{...E,className:m(["request-negotiable-quote-form",i]),onSubmit:x,children:[F&&a(h,{node:F,className:m(["request-negotiable-quote-form__banner"])}),e&&a(h,{node:e,className:m(["request-negotiable-quote-form__title"])}),_&&a(h,{node:_,className:m(["request-negotiable-quote-form__comment-field"])}),b&&a(h,{node:b,className:m(["request-negotiable-quote-form__quote-name-field"])}),s&&a(h,{node:s,className:m(["request-negotiable-quote-form__attach-file-field"])}),j("div",{className:m(["request-negotiable-quote-form__actions"]),children:[l&&a(h,{node:l,className:m(["request-negotiable-quote-form__request-button"])}),Q&&a(h,{node:Q,className:m(["request-negotiable-quote-form__save-button"])})]})]}),Be=({cartId:i,slots:e,onRequestNegotiableQuote:F,onSaveNegotiableQuote:_,onAttachFiles:b,onSubmitErrors:s,onError:l,className:Q})=>{const[x,E]=q(void 0),[L,V]=q(void 0),[K,O]=q([]),[p,v]=q(void 0),[d,f]=q({}),[w,W]=q(void 0),[n,g]=q(!1),o=le({title:"NegotiableQuote.Request.title",comment:"NegotiableQuote.Request.comment",commentError:"NegotiableQuote.Request.commentError",quoteName:"NegotiableQuote.Request.quoteName",quoteNameError:"NegotiableQuote.Request.quoteNameError",attachmentsError:"NegotiableQuote.Request.attachmentsError",requestCta:"NegotiableQuote.Request.requestCta",saveDraftCta:"NegotiableQuote.Request.saveDraftCta",errorHeader:"NegotiableQuote.Request.error.header",unauthenticated:"NegotiableQuote.Request.error.unauthenticated",unauthorized:"NegotiableQuote.Request.error.unauthorized",missingCart:"NegotiableQuote.Request.error.missingCart",successHeader:"NegotiableQuote.Request.success.header",submitSuccess:"NegotiableQuote.Request.success.submitted",draftSuccess:"NegotiableQuote.Request.success.draftSaved"});y(()=>{const t=T.on("quote-management/permissions",r=>{v(void 0),r.requestQuote||(v(o.unauthorized),g(!0))},{eager:!0});return()=>t==null?void 0:t.off()},[o.unauthorized]),y(()=>{const t=T.on("authenticated",r=>{v(void 0),r||(v(o.unauthenticated),g(!0))},{eager:!0});return()=>t==null?void 0:t.off()},[o.unauthenticated]),y(()=>{i||(v(o.missingCart),g(!0))},[i,o.missingCart]),y(()=>{p&&(l==null||l({error:p,isFormDisabled:n,setIsFormDisabled:g}))},[p,l,n]);const S=re(async t=>{if(t!=null&&t.length){if(f(r=>({...r,attachments:""})),b){try{await b(t)}catch{f(r=>({...r,attachments:o.attachmentsError}))}return}try{const r=await Promise.all(t.map(ue));O(r.map(({key:c})=>({key:c})))}catch{f(r=>({...r,attachments:o.attachmentsError}))}}},[b,o]),Z=()=>{let t,r;if(w?(r={name:"SuccessBanner",slot:e==null?void 0:e.SuccessBanner,context:{message:w},"data-testid":"form-success-banner"},t={type:"success",variant:"primary",icon:a(ge,{}),heading:o.successHeader,description:w,className:"request-negotiable-quote-form__success-banner"}):p&&(r={name:"ErrorBanner",slot:e==null?void 0:e.ErrorBanner,context:{message:p},"data-testid":"form-error-banner"},t={type:"error",variant:"primary",icon:a(de,{}),heading:o.errorHeader,description:p,className:"request-negotiable-quote-form__error-banner"}),r&&t)return a(N,{...r,children:a(me,{...t})})},H=t=>{f({});const r=t.target.closest("form"),c=z(r);Object.keys(c).length>0&&(f(c),s==null||s(c))},$=t=>{var P;t.preventDefault(),g(!0);const r=t.target,C={...z(r),...d};if(Object.keys(C).length>0){s==null||s(C);return}const k=t.submitter,R=oe(r);E(R.comment),V(R.quoteName);const M=((P=k==null?void 0:k.dataset)==null?void 0:P.draft)==="true"||!1,te={cartId:i,quoteName:R.quoteName,comment:R.comment,attachments:K,isDraft:M};let A,D;M?(A=_??B,D=o.draftSuccess):(A=F??B,D=o.submitSuccess),A(te).then(()=>{W(D)}).catch(ae=>{v(ae.message)})},G=a(N,{name:"Title",slot:e==null?void 0:e.Title,context:{text:o.title},children:a("span",{"data-testid":"form-title",children:o.title})}),J=a(N,{name:"CommentField",slot:e==null?void 0:e.CommentField,context:{value:x,required:!0,errorMessage:d.comment,setFormErrors:f,isFormDisabled:n},children:a(ne,{name:"comment",value:x,label:o.comment,required:!0,autoComplete:"off","data-testid":"form-comment-field",errorMessage:d.comment,disabled:n})}),U=a(N,{name:"QuoteNameField",slot:e==null?void 0:e.QuoteNameField,context:{value:L,required:!0,errorMessage:d.quoteName,setFormErrors:f,isFormDisabled:n},children:a(ie,{error:d.quoteName,disabled:n,children:a(se,{value:L,name:"quoteName",floatingLabel:o.quoteName,required:!0,autoComplete:"off","data-testid":"form-quote-name-field"})})}),X=a(N,{name:"AttachFileField",slot:e==null?void 0:e.AttachFileField,context:{onChange:S,formErrors:d,isFormDisabled:n},children:a(ce,{onChange:t=>{const r=t.target,c=r==null?void 0:r.files,C=c?Array.from(c):[];C.length>0&&S(C)},icon:a(fe,{}),disabled:n,"data-testid":"form-attach-file-field"})}),Y=a(N,{name:"RequestButton",slot:e==null?void 0:e.RequestButton,context:{requestNegotiableQuote:B,formErrors:d,isFormDisabled:n,setIsFormDisabled:g},children:a(I,{type:"submit","data-testid":"form-request-button",onClick:H,disabled:n,children:o.requestCta})}),ee=a(N,{name:"SaveDraftButton",slot:e==null?void 0:e.SaveDraftButton,context:{requestNegotiableQuote:B,formErrors:d,isFormDisabled:n,setIsFormDisabled:g},children:a(I,{type:"submit","data-draft":"true",variant:"secondary","data-testid":"form-save-draft-button",onClick:H,disabled:n,children:o.saveDraftCta})});return a(qe,{title:G,banner:Z(),commentField:J,quoteNameField:U,attachFile:X,requestButton:Y,saveButton:ee,onSubmit:$,className:Q,disabled:n,"data-testid":"form-container"})};export{Be as RequestNegotiableQuoteForm,Be as default};
3
+ import{jsxs as z,jsx as a}from"@dropins/tools/preact-jsx-runtime.js";import*as v from"@dropins/tools/preact-compat.js";import{useState as g,useEffect as y,useCallback as re}from"@dropins/tools/preact-compat.js";import{classes as c,VComponent as q,Slot as h,getFormErrors as I,getFormValues as oe}from"@dropins/tools/lib.js";import{TextArea as ne,Field as ie,Input as se,InputFile as ce,Button as M,InLineAlert as me}from"@dropins/tools/components.js";/* empty css */import{events as T}from"@dropins/tools/event-bus.js";import"../chunks/state.js";import{u as ue,r as B}from"../chunks/uploadFile.js";import{S as de,a as le}from"../chunks/WarningFilled.js";import{useText as fe}from"@dropins/tools/i18n.js";import"../chunks/transform-quote.js";import"@dropins/tools/fetch-graphql.js";import"../chunks/NegotiableQuoteFragment.js";const ge=u=>v.createElement("svg",{id:"Icon_Add_Base","data-name":"Icon \\u2013 Add \\u2013 Base",xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",...u},v.createElement("g",{id:"Large"},v.createElement("rect",{id:"Placement_area","data-name":"Placement area",width:24,height:24,fill:"#fff",opacity:0}),v.createElement("g",{id:"Add_icon","data-name":"Add icon",transform:"translate(9.734 9.737)"},v.createElement("line",{vectorEffect:"non-scaling-stroke",id:"Line_579","data-name":"Line 579",y2:12.7,transform:"translate(2.216 -4.087)",fill:"none",stroke:"currentColor"}),v.createElement("line",{vectorEffect:"non-scaling-stroke",id:"Line_580","data-name":"Line 580",x2:12.7,transform:"translate(-4.079 2.263)",fill:"none",stroke:"currentColor"})))),qe=({className:u,title:e,banner:_,commentField:C,quoteNameField:N,attachFile:i,requestButton:d,saveButton:Q,onSubmit:R,...A})=>z("form",{...A,className:c(["request-negotiable-quote-form",u]),onSubmit:R,children:[_&&a(q,{node:_,className:c(["request-negotiable-quote-form__banner"])}),e&&a(q,{node:e,className:c(["request-negotiable-quote-form__title"])}),C&&a(q,{node:C,className:c(["request-negotiable-quote-form__comment-field"])}),N&&a(q,{node:N,className:c(["request-negotiable-quote-form__quote-name-field"])}),i&&a(q,{node:i,className:c(["request-negotiable-quote-form__attach-file-field"])}),z("div",{className:c(["request-negotiable-quote-form__actions"]),children:[d&&a(q,{node:d,className:c(["request-negotiable-quote-form__request-button"])}),Q&&a(q,{node:Q,className:c(["request-negotiable-quote-form__save-button"])})]})]}),Ae=({cartId:u,slots:e,onRequestNegotiableQuote:_,onSaveNegotiableQuote:C,onAttachFiles:N,onSubmitErrors:i,onError:d,className:Q})=>{const[R,A]=g(void 0),[S,V]=g(void 0),[K,O]=g([]),[b,p]=g(void 0),[m,l]=g({}),[E,W]=g(void 0),[n,f]=g(!1),o=fe({title:"NegotiableQuote.Request.title",comment:"NegotiableQuote.Request.comment",commentError:"NegotiableQuote.Request.commentError",quoteName:"NegotiableQuote.Request.quoteName",quoteNameError:"NegotiableQuote.Request.quoteNameError",attachmentsError:"NegotiableQuote.Request.attachmentsError",requestCta:"NegotiableQuote.Request.requestCta",saveDraftCta:"NegotiableQuote.Request.saveDraftCta",errorHeader:"NegotiableQuote.Request.error.header",unauthenticated:"NegotiableQuote.Request.error.unauthenticated",unauthorized:"NegotiableQuote.Request.error.unauthorized",missingCart:"NegotiableQuote.Request.error.missingCart",successHeader:"NegotiableQuote.Request.success.header",submitSuccess:"NegotiableQuote.Request.success.submitted",draftSuccess:"NegotiableQuote.Request.success.draftSaved"});y(()=>{const t=T.on("quote-management/permissions",r=>{p(void 0),r.requestQuote||(p(o.unauthorized),f(!0))},{eager:!0});return()=>t==null?void 0:t.off()},[o.unauthorized]),y(()=>{const t=T.on("authenticated",r=>{p(void 0),r||(p(o.unauthenticated),f(!0))},{eager:!0});return()=>t==null?void 0:t.off()},[o.unauthenticated]),y(()=>{u||(p(o.missingCart),f(!0))},[u,o.missingCart]),y(()=>{b&&(d==null||d({error:b,isFormDisabled:n,setIsFormDisabled:f}))},[b,d,n]);const L=re(async t=>{if(t!=null&&t.length){if(l(r=>({...r,attachments:""})),N){try{await N(t)}catch{l(r=>({...r,attachments:o.attachmentsError}))}return}try{const r=await Promise.all(t.map(ue));O(r.map(({key:s})=>({key:s})))}catch{l(r=>({...r,attachments:o.attachmentsError}))}}},[N,o]),$=()=>{let t,r;if(E?(r={name:"SuccessBanner",slot:e==null?void 0:e.SuccessBanner,context:{message:E},"data-testid":"form-success-banner"},t={type:"success",variant:"primary",icon:a(de,{}),heading:o.successHeader,description:E,className:"request-negotiable-quote-form__success-banner"}):b&&(r={name:"ErrorBanner",slot:e==null?void 0:e.ErrorBanner,context:{message:b},"data-testid":"form-error-banner"},t={type:"error",variant:"primary",icon:a(le,{}),heading:o.errorHeader,description:b,className:"request-negotiable-quote-form__error-banner"}),r&&t)return a(h,{...r,children:a(me,{...t})})},H=t=>{l({});const r=t.target.closest("form"),s=I(r);Object.keys(s).length>0&&(l(s),i==null||i(s))},G=t=>{var j;t.preventDefault(),f(!0);const r=t.target,F={...I(r),...m};if(Object.keys(F).length>0){i==null||i(F);return}const k=t.submitter,x=oe(r);A(x.comment),V(x.quoteName);const P=((j=k==null?void 0:k.dataset)==null?void 0:j.draft)==="true"||!1,te={cartId:u,quoteName:x.quoteName,comment:x.comment,attachments:K,isDraft:P};let D,w;P?(D=C??B,w=o.draftSuccess):(D=_??B,w=o.submitSuccess),D(te).then(()=>{W(w)}).catch(ae=>{p(ae.message)})},J=a(h,{name:"Title",slot:e==null?void 0:e.Title,context:{text:o.title},children:a("span",{"data-testid":"form-title",children:o.title})}),U=a(h,{name:"CommentField",slot:e==null?void 0:e.CommentField,context:{value:R,required:!0,errorMessage:m.comment,setFormErrors:l,isFormDisabled:n},children:a(ne,{name:"comment",value:R,label:o.comment,required:!0,autoComplete:"off","data-testid":"form-comment-field",errorMessage:m.comment,disabled:n})}),X=a(h,{name:"QuoteNameField",slot:e==null?void 0:e.QuoteNameField,context:{value:S,required:!0,errorMessage:m.quoteName,setFormErrors:l,isFormDisabled:n},children:a(ie,{error:m.quoteName,disabled:n,children:a(se,{value:S,name:"quoteName",floatingLabel:o.quoteName,required:!0,autoComplete:"off","data-testid":"form-quote-name-field"})})}),Y=a(h,{name:"AttachFileField",slot:e==null?void 0:e.AttachFileField,context:{onChange:L,formErrors:m,isFormDisabled:n},children:a(ce,{onChange:t=>{const r=t.target,s=r==null?void 0:r.files,F=s?Array.from(s):[];F.length>0&&L(F)},icon:a(ge,{}),disabled:n,"data-testid":"form-attach-file-field"})}),Z=a(h,{name:"RequestButton",slot:e==null?void 0:e.RequestButton,context:{requestNegotiableQuote:B,formErrors:m,isFormDisabled:n,setIsFormDisabled:f},children:a(M,{type:"submit","data-testid":"form-request-button",onClick:H,disabled:n,children:o.requestCta})}),ee=a(h,{name:"SaveDraftButton",slot:e==null?void 0:e.SaveDraftButton,context:{requestNegotiableQuote:B,formErrors:m,isFormDisabled:n,setIsFormDisabled:f},children:a(M,{type:"submit","data-draft":"true",variant:"secondary","data-testid":"form-save-draft-button",onClick:H,disabled:n,children:o.saveDraftCta})});return a(qe,{title:J,banner:$(),commentField:U,quoteNameField:X,attachFile:Y,requestButton:Z,saveButton:ee,onSubmit:G,className:Q,disabled:n,"data-testid":"form-container"})};export{Ae as RequestNegotiableQuoteForm,Ae as default};
4
4
  //# sourceMappingURL=RequestNegotiableQuoteForm.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"RequestNegotiableQuoteForm.js","sources":["../../node_modules/@adobe-commerce/elsie/src/icons/Add.svg","../../node_modules/@adobe-commerce/elsie/src/icons/CheckWithCircle.svg","/@dropins/storefront-quote-management/src/components/RequestNegotiableQuoteForm/RequestNegotiableQuoteForm.tsx","/@dropins/storefront-quote-management/src/containers/RequestNegotiableQuoteForm/RequestNegotiableQuoteForm.tsx"],"sourcesContent":["import * as React from \"react\";\nconst SvgAdd = (props) => /* @__PURE__ */ React.createElement(\"svg\", { id: \"Icon_Add_Base\", \"data-name\": \"Icon \\\\u2013 Add \\\\u2013 Base\", xmlns: \"http://www.w3.org/2000/svg\", width: 24, height: 24, viewBox: \"0 0 24 24\", ...props }, /* @__PURE__ */ React.createElement(\"g\", { id: \"Large\" }, /* @__PURE__ */ React.createElement(\"rect\", { id: \"Placement_area\", \"data-name\": \"Placement area\", width: 24, height: 24, fill: \"#fff\", opacity: 0 }), /* @__PURE__ */ React.createElement(\"g\", { id: \"Add_icon\", \"data-name\": \"Add icon\", transform: \"translate(9.734 9.737)\" }, /* @__PURE__ */ React.createElement(\"line\", { vectorEffect: \"non-scaling-stroke\", id: \"Line_579\", \"data-name\": \"Line 579\", y2: 12.7, transform: \"translate(2.216 -4.087)\", fill: \"none\", stroke: \"currentColor\" }), /* @__PURE__ */ React.createElement(\"line\", { vectorEffect: \"non-scaling-stroke\", id: \"Line_580\", \"data-name\": \"Line 580\", x2: 12.7, transform: \"translate(-4.079 2.263)\", fill: \"none\", stroke: \"currentColor\" }))));\nexport default SvgAdd;\n","import * as React from \"react\";\nconst SvgCheckWithCircle = (props) => /* @__PURE__ */ React.createElement(\"svg\", { width: 24, height: 24, viewBox: \"0 0 24 24\", fill: \"none\", xmlns: \"http://www.w3.org/2000/svg\", ...props }, /* @__PURE__ */ React.createElement(\"path\", { vectorEffect: \"non-scaling-stroke\", d: \"M0.75 12C0.75 5.78421 5.78421 0.75 12 0.75C18.2158 0.75 23.25 5.78421 23.25 12C23.25 18.2158 18.2158 23.25 12 23.25C5.78421 23.25 0.75 18.2158 0.75 12Z\", stroke: \"currentColor\" }), /* @__PURE__ */ React.createElement(\"path\", { vectorEffect: \"non-scaling-stroke\", d: \"M6.75 12.762L10.2385 15.75L17.25 9\", stroke: \"currentColor\" }));\nexport default SvgCheckWithCircle;\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, VComponent } from '@adobe-commerce/elsie/lib';\nimport '@/quote-management/components/RequestNegotiableQuoteForm/RequestNegotiableQuoteForm.css';\n\nexport interface RequestNegotiableQuoteFormProps extends Omit<HTMLAttributes<HTMLFormElement>, 'title'> {\n title: VNode;\n banner?: VNode;\n commentField?: VNode;\n quoteNameField?: VNode;\n attachFile?: VNode;\n requestButton?: VNode;\n saveButton?: VNode;\n onSubmit: (e: Event) => void;\n}\n\nexport const RequestNegotiableQuoteForm: FunctionComponent<RequestNegotiableQuoteFormProps> = ({\n className,\n title,\n banner,\n commentField,\n quoteNameField,\n attachFile,\n requestButton,\n saveButton,\n onSubmit,\n ...props\n}) => {\n return (\n <form {...props} className={classes(['request-negotiable-quote-form', className])} onSubmit={onSubmit}>\n {banner &&\n <VComponent\n node={banner}\n className={classes(['request-negotiable-quote-form__banner'])}\n />\n }\n {title &&\n <VComponent\n node={title}\n className={classes(['request-negotiable-quote-form__title'])}\n />\n }\n {commentField &&\n <VComponent\n node={commentField}\n className={classes(['request-negotiable-quote-form__comment-field'])}\n />\n }\n {quoteNameField &&\n <VComponent\n node={quoteNameField}\n className={classes(['request-negotiable-quote-form__quote-name-field'])}\n />\n }\n {attachFile &&\n <VComponent\n node={attachFile}\n className={classes(['request-negotiable-quote-form__attach-file-field'])}\n />\n }\n <div className={classes(['request-negotiable-quote-form__actions'])}>\n {requestButton &&\n <VComponent\n node={requestButton}\n className={classes(['request-negotiable-quote-form__request-button'])}\n />\n }\n {saveButton &&\n <VComponent\n node={saveButton}\n className={classes(['request-negotiable-quote-form__save-button'])}\n />\n }\n </div>\n </form>\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, useCallback, useEffect, useState } from 'preact/compat';\nimport { Container, getFormErrors, getFormValues, Slot, SlotProps } from '@adobe-commerce/elsie/lib';\nimport { InLineAlert, Button, InputFile, TextArea, Input, Field, InLineAlertProps } from '@adobe-commerce/elsie/components';\nimport { WarningFilled, CheckWithCircle, Add } from '@adobe-commerce/elsie/icons';\nimport RequestNegotiableQuoteFormComponent from '@/quote-management/components/RequestNegotiableQuoteForm';\nimport { useText } from '@adobe-commerce/elsie/i18n';\nimport { events } from '@adobe-commerce/event-bus';\nimport { requestNegotiableQuote, RequestNegotiableQuoteInput, uploadFile } from '@/quote-management/api';\nimport { state } from '@/quote-management/lib/state';\n\nexport type RequestNegotiableQuoteHandlers = {\n onAttachFiles?: (files: File[]) => Promise<void>;\n onRequestNegotiableQuote?: typeof requestNegotiableQuote;\n onSaveNegotiableQuote?: typeof requestNegotiableQuote;\n onSubmitErrors?: (errors: Record<string, string>) => void;\n onError?: (props: {\n error: string,\n isFormDisabled: boolean,\n setIsFormDisabled: (isFormDisabled: boolean) => void,\n }) => void;\n};\n\nexport interface RequestNegotiableQuoteFormProps\n extends Omit<HTMLAttributes<HTMLDivElement>, 'onError'>,\n RequestNegotiableQuoteHandlers {\n cartId: string;\n slots?: {\n ErrorBanner?: SlotProps<{\n message: string,\n }>;\n SuccessBanner?: SlotProps<{\n message: string,\n }>;\n Title?: SlotProps<{\n text: string,\n }>;\n CommentField?: SlotProps<{\n formErrors: Record<string, string>;\n isFormDisabled: boolean;\n setFormErrors: (errors: Record<string, string>) => void;\n }>;\n QuoteNameField?: SlotProps<{\n formErrors: Record<string, string>;\n isFormDisabled: boolean;\n setFormErrors: (errors: Record<string, string>) => void;\n }>;\n AttachFileField?: SlotProps<{\n onChange: (files: File[]) => void, formErrors: Record<string, string>,\n isFormDisabled: boolean\n }>;\n RequestButton?: SlotProps<{\n requestNegotiableQuote: typeof requestNegotiableQuote;\n formErrors: Record<string, string>;\n isFormDisabled: boolean;\n setIsFormDisabled: (isFormDisabled: boolean) => void;\n }>;\n SaveDraftButton?: SlotProps<{\n requestNegotiableQuote: typeof requestNegotiableQuote;\n formErrors: Record<string, string>;\n isFormDisabled: boolean;\n setIsFormDisabled: (isFormDisabled: boolean) => void;\n }>;\n };\n}\n\nexport const RequestNegotiableQuoteForm: Container<RequestNegotiableQuoteFormProps> = ({\n cartId,\n slots,\n onRequestNegotiableQuote,\n onSaveNegotiableQuote,\n onAttachFiles,\n onSubmitErrors,\n onError,\n className,\n}) => {\n const [comment, setComment] = useState<string | undefined>(undefined);\n const [quoteName, setQuoteName] = useState<string | undefined>(undefined);\n const [attachmentKeys, setAttachmentKeys] = useState<{ key: string }[]>([]);\n const [error, setError] = useState<string | undefined>(undefined);\n const [formErrors, setFormErrors] = useState<Record<string, string>>({});\n const [success, setSuccess] = useState<string | undefined>(undefined);\n const [isFormDisabled, setIsFormDisabled] = useState<boolean>(false);\n\n const dictionary = useText({\n title: 'NegotiableQuote.Request.title',\n comment: 'NegotiableQuote.Request.comment',\n commentError: 'NegotiableQuote.Request.commentError',\n quoteName: 'NegotiableQuote.Request.quoteName',\n quoteNameError: 'NegotiableQuote.Request.quoteNameError',\n attachmentsError: 'NegotiableQuote.Request.attachmentsError',\n requestCta: 'NegotiableQuote.Request.requestCta',\n saveDraftCta: 'NegotiableQuote.Request.saveDraftCta',\n errorHeader: 'NegotiableQuote.Request.error.header',\n unauthenticated: 'NegotiableQuote.Request.error.unauthenticated',\n unauthorized: 'NegotiableQuote.Request.error.unauthorized',\n missingCart: 'NegotiableQuote.Request.error.missingCart',\n successHeader: 'NegotiableQuote.Request.success.header',\n submitSuccess: 'NegotiableQuote.Request.success.submitted',\n draftSuccess: 'NegotiableQuote.Request.success.draftSaved',\n });\n\n useEffect(() => {\n const permissionsEvent = events.on(\n 'quote-management/permissions',\n (permissions: typeof state.permissions) => {\n setError(undefined);\n if (!permissions.requestQuote) {\n setError(dictionary.unauthorized);\n setIsFormDisabled(true);\n }\n },\n { eager: true }\n );\n return () => permissionsEvent?.off();\n }, [dictionary.unauthorized]);\n\n useEffect(() => {\n const authenticatedEvent = events.on(\n 'authenticated',\n (authenticated: boolean) => {\n setError(undefined);\n if (!authenticated) {\n setError(dictionary.unauthenticated);\n setIsFormDisabled(true);\n }\n },\n { eager: true }\n );\n return () => authenticatedEvent?.off();\n }, [dictionary.unauthenticated]);\n\n useEffect(() => {\n if (!cartId) {\n setError(dictionary.missingCart);\n setIsFormDisabled(true);\n }\n }, [cartId, dictionary.missingCart]);\n\n useEffect(() => {\n if (error) {\n onError?.({ error, isFormDisabled, setIsFormDisabled });\n }\n }, [error, onError, isFormDisabled]);\n\n const handleAttachFiles = useCallback(async (files: File[]) => {\n /* istanbul ignore next: defensive guard; */\n if (!files?.length) return;\n\n setFormErrors(prev => ({ ...prev, attachments: '' }));\n\n if (onAttachFiles) {\n try {\n await onAttachFiles(files);\n } catch {\n setFormErrors(prev => ({ ...prev, attachments: dictionary.attachmentsError }));\n }\n return;\n }\n\n try {\n const uploaded = await Promise.all(files.map(uploadFile));\n setAttachmentKeys(uploaded.map(({ key }) => ({ key })));\n } catch {\n setFormErrors(prev => ({ ...prev, attachments: dictionary.attachmentsError }));\n }\n }, [onAttachFiles, dictionary]);\n\n /*\n * This function is used to get the banner node.\n * It can be used to render a success or error banner depending on the success or error state.\n */\n const getBannerNode = () => {\n let inlineAlertProps: InLineAlertProps | undefined;\n let slotProps: any | undefined;\n\n if (success) {\n slotProps = {\n name: 'SuccessBanner',\n slot: slots?.SuccessBanner,\n context: {\n message: success,\n },\n 'data-testid': 'form-success-banner',\n };\n inlineAlertProps = {\n type: 'success',\n variant: 'primary',\n icon: <CheckWithCircle />,\n heading: dictionary.successHeader,\n description: success,\n className: 'request-negotiable-quote-form__success-banner',\n };\n }\n else if (error) {\n slotProps = {\n name: 'ErrorBanner',\n slot: slots?.ErrorBanner,\n context: {\n message: error,\n },\n 'data-testid': 'form-error-banner',\n };\n inlineAlertProps = {\n type: 'error',\n variant: 'primary',\n icon: <WarningFilled />,\n heading: dictionary.errorHeader,\n description: error,\n className: 'request-negotiable-quote-form__error-banner',\n };\n }\n\n if (slotProps && inlineAlertProps) {\n return <Slot {...slotProps}>\n <InLineAlert {...inlineAlertProps} />\n </Slot>;\n }\n\n return undefined;\n }\n\n /*\n * This function is used to validate the parent form of the button that was clicked.\n */\n const validateParentForm = (e: Event) => {\n setFormErrors({});\n const closestForm = (e.target as HTMLElement).closest('form') as HTMLFormElement;\n const formErrors = getFormErrors(closestForm);\n if (Object.keys(formErrors).length > 0) {\n setFormErrors(formErrors);\n onSubmitErrors?.(formErrors);\n }\n };\n\n const formSubmitHandler = (e: Event) => {\n e.preventDefault();\n setIsFormDisabled(true);\n\n const form = (e.target as HTMLFormElement);\n\n const currentFormErrors = getFormErrors(form);\n\n const mergedFormErrors = { ...currentFormErrors, ...formErrors };\n\n if (Object.keys(mergedFormErrors).length > 0) {\n onSubmitErrors?.(mergedFormErrors)\n return;\n }\n\n // Since we have multiple submit buttons, we need to determine which one was clicked.\n const buttonTarget = (e as SubmitEvent).submitter as HTMLButtonElement;\n\n const formValues = getFormValues(form);\n\n setComment(formValues.comment);\n setQuoteName(formValues.quoteName);\n\n const isDraft = buttonTarget?.dataset?.draft === 'true' || false;\n\n const contextData: RequestNegotiableQuoteInput = {\n cartId: cartId!,\n quoteName: formValues.quoteName,\n comment: formValues.comment,\n attachments: attachmentKeys,\n isDraft,\n }\n\n let submitHandler;\n let successMessage;\n\n if (isDraft) {\n submitHandler = onSaveNegotiableQuote ?? requestNegotiableQuote;\n successMessage = dictionary.draftSuccess;\n } else {\n submitHandler = onRequestNegotiableQuote ?? requestNegotiableQuote;\n successMessage = dictionary.submitSuccess;\n }\n\n submitHandler(contextData).then(() => {\n setSuccess(successMessage);\n })\n .catch(error => {\n setError(error.message);\n })\n };\n\n const titleNode = (\n <Slot name=\"Title\" slot={slots?.Title} context={{ text: dictionary.title }}>\n <span data-testid=\"form-title\">{dictionary.title}</span>\n </Slot>\n );\n\n const commentFieldNode = (\n <Slot\n name=\"CommentField\"\n slot={slots?.CommentField}\n context={{\n value: comment,\n required: true,\n errorMessage: formErrors.comment,\n setFormErrors,\n isFormDisabled\n } as any}\n >\n <TextArea\n name=\"comment\"\n value={comment}\n label={dictionary.comment}\n required\n autoComplete=\"off\"\n data-testid=\"form-comment-field\"\n errorMessage={formErrors.comment}\n disabled={isFormDisabled}\n />\n </Slot>\n );\n\n const quoteNameFieldNode = (\n <Slot\n name=\"QuoteNameField\"\n slot={slots?.QuoteNameField}\n context={{\n value: quoteName,\n required: true,\n errorMessage: formErrors.quoteName,\n setFormErrors,\n isFormDisabled\n } as any}\n >\n <Field\n error={formErrors.quoteName}\n disabled={isFormDisabled}\n >\n <Input\n value={quoteName}\n name=\"quoteName\"\n floatingLabel={dictionary.quoteName}\n required\n autoComplete=\"off\"\n data-testid=\"form-quote-name-field\"\n />\n </Field>\n </Slot>\n );\n\n const attachFileNode = (\n <Slot\n name=\"AttachFileField\"\n slot={slots?.AttachFileField}\n context={{ onChange: handleAttachFiles, formErrors, isFormDisabled }}\n >\n <InputFile\n onChange={(e: Event) => {\n const target = e.target as HTMLInputElement;\n const fileList = target?.files;\n const files = fileList ? Array.from(fileList) : [];\n\n if (files.length > 0) {\n void handleAttachFiles(files);\n }\n }}\n icon={<Add />}\n disabled={isFormDisabled}\n data-testid=\"form-attach-file-field\"\n />\n </Slot>\n );\n\n const requestButtonNode = (\n <Slot\n name=\"RequestButton\"\n slot={slots?.RequestButton}\n context={\n {\n requestNegotiableQuote,\n formErrors,\n isFormDisabled,\n setIsFormDisabled\n }\n }\n >\n <Button\n type=\"submit\"\n data-testid=\"form-request-button\"\n onClick={validateParentForm}\n disabled={isFormDisabled}\n >\n {dictionary.requestCta}\n </Button>\n </Slot>\n );\n\n const saveButtonNode = (\n <Slot\n name=\"SaveDraftButton\"\n slot={slots?.SaveDraftButton}\n context={\n {\n requestNegotiableQuote,\n formErrors,\n isFormDisabled,\n setIsFormDisabled\n }\n }\n >\n <Button\n type=\"submit\"\n data-draft=\"true\"\n variant=\"secondary\"\n data-testid=\"form-save-draft-button\"\n onClick={validateParentForm}\n disabled={isFormDisabled}\n >\n {dictionary.saveDraftCta}\n </Button>\n </Slot>\n );\n\n return (\n <RequestNegotiableQuoteFormComponent\n title={titleNode}\n banner={getBannerNode()}\n commentField={commentFieldNode}\n quoteNameField={quoteNameFieldNode}\n attachFile={attachFileNode}\n requestButton={requestButtonNode}\n saveButton={saveButtonNode}\n onSubmit={formSubmitHandler}\n className={className}\n disabled={isFormDisabled}\n data-testid=\"form-container\"\n />\n );\n};\n"],"names":["SvgAdd","props","React","SvgCheckWithCircle","RequestNegotiableQuoteForm","className","title","banner","commentField","quoteNameField","attachFile","requestButton","saveButton","onSubmit","jsxs","classes","jsx","VComponent","cartId","slots","onRequestNegotiableQuote","onSaveNegotiableQuote","onAttachFiles","onSubmitErrors","onError","comment","setComment","useState","quoteName","setQuoteName","attachmentKeys","setAttachmentKeys","error","setError","formErrors","setFormErrors","success","setSuccess","isFormDisabled","setIsFormDisabled","dictionary","useText","useEffect","permissionsEvent","events","permissions","authenticatedEvent","authenticated","handleAttachFiles","useCallback","files","prev","uploaded","uploadFile","key","getBannerNode","inlineAlertProps","slotProps","CheckWithCircle","WarningFilled","Slot","InLineAlert","validateParentForm","e","closestForm","getFormErrors","formSubmitHandler","form","mergedFormErrors","buttonTarget","formValues","getFormValues","isDraft","_a","contextData","submitHandler","successMessage","requestNegotiableQuote","titleNode","commentFieldNode","TextArea","quoteNameFieldNode","Field","Input","attachFileNode","InputFile","target","fileList","Add","requestButtonNode","Button","saveButtonNode","RequestNegotiableQuoteFormComponent"],"mappings":"szBACA,MAAMA,GAAUC,GAA0BC,EAAM,cAAc,MAAO,CAAE,GAAI,gBAAiB,YAAa,gCAAiC,MAAO,6BAA8B,MAAO,GAAI,OAAQ,GAAI,QAAS,YAAa,GAAGD,GAAyBC,EAAM,cAAc,IAAK,CAAE,GAAI,OAAO,EAAoBA,EAAM,cAAc,OAAQ,CAAE,GAAI,iBAAkB,YAAa,iBAAkB,MAAO,GAAI,OAAQ,GAAI,KAAM,OAAQ,QAAS,CAAC,CAAE,EAAmBA,EAAM,cAAc,IAAK,CAAE,GAAI,WAAY,YAAa,WAAY,UAAW,wBAAwB,EAAoBA,EAAM,cAAc,OAAQ,CAAE,aAAc,qBAAsB,GAAI,WAAY,YAAa,WAAY,GAAI,KAAM,UAAW,0BAA2B,KAAM,OAAQ,OAAQ,cAAc,CAAE,EAAmBA,EAAM,cAAc,OAAQ,CAAE,aAAc,qBAAsB,GAAI,WAAY,YAAa,WAAY,GAAI,KAAM,UAAW,0BAA2B,KAAM,OAAQ,OAAQ,eAAgB,CAAC,CAAC,CAAC,ECAt9BC,GAAsBF,GAA0BC,EAAM,cAAc,MAAO,CAAE,MAAO,GAAI,OAAQ,GAAI,QAAS,YAAa,KAAM,OAAQ,MAAO,6BAA8B,GAAGD,CAAK,EAAoBC,EAAM,cAAc,OAAQ,CAAE,aAAc,q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ACE,CACE,uBAAA0D,EACA,WAAA3C,EACA,eAAAI,EACA,kBAAAC,CAAA,EAIJ,SAAAvB,EAAC0E,EAAA,CACC,KAAK,SACL,cAAY,sBACZ,QAAS5B,EACT,SAAUxB,EAET,SAAAE,EAAW,UAAA,CAAA,CACd,CAAA,EAIEmD,GACJ3E,EAAC4C,EAAA,CACC,KAAK,kBACL,KAAMzC,GAAA,YAAAA,EAAO,gBACb,QACE,CACE,uBAAA0D,EACA,WAAA3C,EACA,eAAAI,EACA,kBAAAC,CAAA,EAIJ,SAAAvB,EAAC0E,EAAA,CACC,KAAK,SACL,aAAW,OACX,QAAQ,YACR,cAAY,yBACZ,QAAS5B,EACT,SAAUxB,EAET,SAAAE,EAAW,YAAA,CAAA,CACd,CAAA,EAIJ,OACExB,EAAC4E,GAAA,CACC,MAAOd,EACP,OAAQvB,EAAA,EACR,aAAcwB,EACd,eAAgBE,EAChB,WAAYG,EACZ,cAAeK,EACf,WAAYE,GACZ,SAAUzB,EACV,UAAA7D,EACA,SAAUiC,EACV,cAAY,gBAAA,CAAA,CAGlB","x_google_ignoreList":[0,1]}
1
+ {"version":3,"file":"RequestNegotiableQuoteForm.js","sources":["../../node_modules/@adobe-commerce/elsie/src/icons/Add.svg","/@dropins/storefront-quote-management/src/components/RequestNegotiableQuoteForm/RequestNegotiableQuoteForm.tsx","/@dropins/storefront-quote-management/src/containers/RequestNegotiableQuoteForm/RequestNegotiableQuoteForm.tsx"],"sourcesContent":["import * as React from \"react\";\nconst SvgAdd = (props) => /* @__PURE__ */ React.createElement(\"svg\", { id: \"Icon_Add_Base\", \"data-name\": \"Icon \\\\u2013 Add \\\\u2013 Base\", xmlns: \"http://www.w3.org/2000/svg\", width: 24, height: 24, viewBox: \"0 0 24 24\", ...props }, /* @__PURE__ */ React.createElement(\"g\", { id: \"Large\" }, /* @__PURE__ */ React.createElement(\"rect\", { id: \"Placement_area\", \"data-name\": \"Placement area\", width: 24, height: 24, fill: \"#fff\", opacity: 0 }), /* @__PURE__ */ React.createElement(\"g\", { id: \"Add_icon\", \"data-name\": \"Add icon\", transform: \"translate(9.734 9.737)\" }, /* @__PURE__ */ React.createElement(\"line\", { vectorEffect: \"non-scaling-stroke\", id: \"Line_579\", \"data-name\": \"Line 579\", y2: 12.7, transform: \"translate(2.216 -4.087)\", fill: \"none\", stroke: \"currentColor\" }), /* @__PURE__ */ React.createElement(\"line\", { vectorEffect: \"non-scaling-stroke\", id: \"Line_580\", \"data-name\": \"Line 580\", x2: 12.7, transform: \"translate(-4.079 2.263)\", fill: \"none\", stroke: \"currentColor\" }))));\nexport default SvgAdd;\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, VComponent } from '@adobe-commerce/elsie/lib';\nimport '@/quote-management/components/RequestNegotiableQuoteForm/RequestNegotiableQuoteForm.css';\n\nexport interface RequestNegotiableQuoteFormProps extends Omit<HTMLAttributes<HTMLFormElement>, 'title'> {\n title: VNode;\n banner?: VNode;\n commentField?: VNode;\n quoteNameField?: VNode;\n attachFile?: VNode;\n requestButton?: VNode;\n saveButton?: VNode;\n onSubmit: (e: Event) => void;\n}\n\nexport const RequestNegotiableQuoteForm: FunctionComponent<RequestNegotiableQuoteFormProps> = ({\n className,\n title,\n banner,\n commentField,\n quoteNameField,\n attachFile,\n requestButton,\n saveButton,\n onSubmit,\n ...props\n}) => {\n return (\n <form {...props} className={classes(['request-negotiable-quote-form', className])} onSubmit={onSubmit}>\n {banner &&\n <VComponent\n node={banner}\n className={classes(['request-negotiable-quote-form__banner'])}\n />\n }\n {title &&\n <VComponent\n node={title}\n className={classes(['request-negotiable-quote-form__title'])}\n />\n }\n {commentField &&\n <VComponent\n node={commentField}\n className={classes(['request-negotiable-quote-form__comment-field'])}\n />\n }\n {quoteNameField &&\n <VComponent\n node={quoteNameField}\n className={classes(['request-negotiable-quote-form__quote-name-field'])}\n />\n }\n {attachFile &&\n <VComponent\n node={attachFile}\n className={classes(['request-negotiable-quote-form__attach-file-field'])}\n />\n }\n <div className={classes(['request-negotiable-quote-form__actions'])}>\n {requestButton &&\n <VComponent\n node={requestButton}\n className={classes(['request-negotiable-quote-form__request-button'])}\n />\n }\n {saveButton &&\n <VComponent\n node={saveButton}\n className={classes(['request-negotiable-quote-form__save-button'])}\n />\n }\n </div>\n </form>\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, useCallback, useEffect, useState } from 'preact/compat';\nimport { Container, getFormErrors, getFormValues, Slot, SlotProps } from '@adobe-commerce/elsie/lib';\nimport { InLineAlert, Button, InputFile, TextArea, Input, Field, InLineAlertProps } from '@adobe-commerce/elsie/components';\nimport { WarningFilled, CheckWithCircle, Add } from '@adobe-commerce/elsie/icons';\nimport RequestNegotiableQuoteFormComponent from '@/quote-management/components/RequestNegotiableQuoteForm';\nimport { useText } from '@adobe-commerce/elsie/i18n';\nimport { events } from '@adobe-commerce/event-bus';\nimport { requestNegotiableQuote, RequestNegotiableQuoteInput, uploadFile } from '@/quote-management/api';\nimport { state } from '@/quote-management/lib/state';\n\nexport type RequestNegotiableQuoteHandlers = {\n onAttachFiles?: (files: File[]) => Promise<void>;\n onRequestNegotiableQuote?: typeof requestNegotiableQuote;\n onSaveNegotiableQuote?: typeof requestNegotiableQuote;\n onSubmitErrors?: (errors: Record<string, string>) => void;\n onError?: (props: {\n error: string,\n isFormDisabled: boolean,\n setIsFormDisabled: (isFormDisabled: boolean) => void,\n }) => void;\n};\n\nexport interface RequestNegotiableQuoteFormProps\n extends Omit<HTMLAttributes<HTMLDivElement>, 'onError'>,\n RequestNegotiableQuoteHandlers {\n cartId: string;\n slots?: {\n ErrorBanner?: SlotProps<{\n message: string,\n }>;\n SuccessBanner?: SlotProps<{\n message: string,\n }>;\n Title?: SlotProps<{\n text: string,\n }>;\n CommentField?: SlotProps<{\n formErrors: Record<string, string>;\n isFormDisabled: boolean;\n setFormErrors: (errors: Record<string, string>) => void;\n }>;\n QuoteNameField?: SlotProps<{\n formErrors: Record<string, string>;\n isFormDisabled: boolean;\n setFormErrors: (errors: Record<string, string>) => void;\n }>;\n AttachFileField?: SlotProps<{\n onChange: (files: File[]) => void, formErrors: Record<string, string>,\n isFormDisabled: boolean\n }>;\n RequestButton?: SlotProps<{\n requestNegotiableQuote: typeof requestNegotiableQuote;\n formErrors: Record<string, string>;\n isFormDisabled: boolean;\n setIsFormDisabled: (isFormDisabled: boolean) => void;\n }>;\n SaveDraftButton?: SlotProps<{\n requestNegotiableQuote: typeof requestNegotiableQuote;\n formErrors: Record<string, string>;\n isFormDisabled: boolean;\n setIsFormDisabled: (isFormDisabled: boolean) => void;\n }>;\n };\n}\n\nexport const RequestNegotiableQuoteForm: Container<RequestNegotiableQuoteFormProps> = ({\n cartId,\n slots,\n onRequestNegotiableQuote,\n onSaveNegotiableQuote,\n onAttachFiles,\n onSubmitErrors,\n onError,\n className,\n}) => {\n const [comment, setComment] = useState<string | undefined>(undefined);\n const [quoteName, setQuoteName] = useState<string | undefined>(undefined);\n const [attachmentKeys, setAttachmentKeys] = useState<{ key: string }[]>([]);\n const [error, setError] = useState<string | undefined>(undefined);\n const [formErrors, setFormErrors] = useState<Record<string, string>>({});\n const [success, setSuccess] = useState<string | undefined>(undefined);\n const [isFormDisabled, setIsFormDisabled] = useState<boolean>(false);\n\n const dictionary = useText({\n title: 'NegotiableQuote.Request.title',\n comment: 'NegotiableQuote.Request.comment',\n commentError: 'NegotiableQuote.Request.commentError',\n quoteName: 'NegotiableQuote.Request.quoteName',\n quoteNameError: 'NegotiableQuote.Request.quoteNameError',\n attachmentsError: 'NegotiableQuote.Request.attachmentsError',\n requestCta: 'NegotiableQuote.Request.requestCta',\n saveDraftCta: 'NegotiableQuote.Request.saveDraftCta',\n errorHeader: 'NegotiableQuote.Request.error.header',\n unauthenticated: 'NegotiableQuote.Request.error.unauthenticated',\n unauthorized: 'NegotiableQuote.Request.error.unauthorized',\n missingCart: 'NegotiableQuote.Request.error.missingCart',\n successHeader: 'NegotiableQuote.Request.success.header',\n submitSuccess: 'NegotiableQuote.Request.success.submitted',\n draftSuccess: 'NegotiableQuote.Request.success.draftSaved',\n });\n\n useEffect(() => {\n const permissionsEvent = events.on(\n 'quote-management/permissions',\n (permissions: typeof state.permissions) => {\n setError(undefined);\n if (!permissions.requestQuote) {\n setError(dictionary.unauthorized);\n setIsFormDisabled(true);\n }\n },\n { eager: true }\n );\n return () => permissionsEvent?.off();\n }, [dictionary.unauthorized]);\n\n useEffect(() => {\n const authenticatedEvent = events.on(\n 'authenticated',\n (authenticated: boolean) => {\n setError(undefined);\n if (!authenticated) {\n setError(dictionary.unauthenticated);\n setIsFormDisabled(true);\n }\n },\n { eager: true }\n );\n return () => authenticatedEvent?.off();\n }, [dictionary.unauthenticated]);\n\n useEffect(() => {\n if (!cartId) {\n setError(dictionary.missingCart);\n setIsFormDisabled(true);\n }\n }, [cartId, dictionary.missingCart]);\n\n useEffect(() => {\n if (error) {\n onError?.({ error, isFormDisabled, setIsFormDisabled });\n }\n }, [error, onError, isFormDisabled]);\n\n const handleAttachFiles = useCallback(async (files: File[]) => {\n /* istanbul ignore next: defensive guard; */\n if (!files?.length) return;\n\n setFormErrors(prev => ({ ...prev, attachments: '' }));\n\n if (onAttachFiles) {\n try {\n await onAttachFiles(files);\n } catch {\n setFormErrors(prev => ({ ...prev, attachments: dictionary.attachmentsError }));\n }\n return;\n }\n\n try {\n const uploaded = await Promise.all(files.map(uploadFile));\n setAttachmentKeys(uploaded.map(({ key }) => ({ key })));\n } catch {\n setFormErrors(prev => ({ ...prev, attachments: dictionary.attachmentsError }));\n }\n }, [onAttachFiles, dictionary]);\n\n /*\n * This function is used to get the banner node.\n * It can be used to render a success or error banner depending on the success or error state.\n */\n const getBannerNode = () => {\n let inlineAlertProps: InLineAlertProps | undefined;\n let slotProps: any | undefined;\n\n if (success) {\n slotProps = {\n name: 'SuccessBanner',\n slot: slots?.SuccessBanner,\n context: {\n message: success,\n },\n 'data-testid': 'form-success-banner',\n };\n inlineAlertProps = {\n type: 'success',\n variant: 'primary',\n icon: <CheckWithCircle />,\n heading: dictionary.successHeader,\n description: success,\n className: 'request-negotiable-quote-form__success-banner',\n };\n }\n else if (error) {\n slotProps = {\n name: 'ErrorBanner',\n slot: slots?.ErrorBanner,\n context: {\n message: error,\n },\n 'data-testid': 'form-error-banner',\n };\n inlineAlertProps = {\n type: 'error',\n variant: 'primary',\n icon: <WarningFilled />,\n heading: dictionary.errorHeader,\n description: error,\n className: 'request-negotiable-quote-form__error-banner',\n };\n }\n\n if (slotProps && inlineAlertProps) {\n return <Slot {...slotProps}>\n <InLineAlert {...inlineAlertProps} />\n </Slot>;\n }\n\n return undefined;\n }\n\n /*\n * This function is used to validate the parent form of the button that was clicked.\n */\n const validateParentForm = (e: Event) => {\n setFormErrors({});\n const closestForm = (e.target as HTMLElement).closest('form') as HTMLFormElement;\n const formErrors = getFormErrors(closestForm);\n if (Object.keys(formErrors).length > 0) {\n setFormErrors(formErrors);\n onSubmitErrors?.(formErrors);\n }\n };\n\n const formSubmitHandler = (e: Event) => {\n e.preventDefault();\n setIsFormDisabled(true);\n\n const form = (e.target as HTMLFormElement);\n\n const currentFormErrors = getFormErrors(form);\n\n const mergedFormErrors = { ...currentFormErrors, ...formErrors };\n\n if (Object.keys(mergedFormErrors).length > 0) {\n onSubmitErrors?.(mergedFormErrors)\n return;\n }\n\n // Since we have multiple submit buttons, we need to determine which one was clicked.\n const buttonTarget = (e as SubmitEvent).submitter as HTMLButtonElement;\n\n const formValues = getFormValues(form);\n\n setComment(formValues.comment);\n setQuoteName(formValues.quoteName);\n\n const isDraft = buttonTarget?.dataset?.draft === 'true' || false;\n\n const contextData: RequestNegotiableQuoteInput = {\n cartId: cartId!,\n quoteName: formValues.quoteName,\n comment: formValues.comment,\n attachments: attachmentKeys,\n isDraft,\n }\n\n let submitHandler;\n let successMessage;\n\n if (isDraft) {\n submitHandler = onSaveNegotiableQuote ?? requestNegotiableQuote;\n successMessage = dictionary.draftSuccess;\n } else {\n submitHandler = onRequestNegotiableQuote ?? requestNegotiableQuote;\n successMessage = dictionary.submitSuccess;\n }\n\n submitHandler(contextData).then(() => {\n setSuccess(successMessage);\n })\n .catch(error => {\n setError(error.message);\n })\n };\n\n const titleNode = (\n <Slot name=\"Title\" slot={slots?.Title} context={{ text: dictionary.title }}>\n <span data-testid=\"form-title\">{dictionary.title}</span>\n </Slot>\n );\n\n const commentFieldNode = (\n <Slot\n name=\"CommentField\"\n slot={slots?.CommentField}\n context={{\n value: comment,\n required: true,\n errorMessage: formErrors.comment,\n setFormErrors,\n isFormDisabled\n } as any}\n >\n <TextArea\n name=\"comment\"\n value={comment}\n label={dictionary.comment}\n required\n autoComplete=\"off\"\n data-testid=\"form-comment-field\"\n errorMessage={formErrors.comment}\n disabled={isFormDisabled}\n />\n </Slot>\n );\n\n const quoteNameFieldNode = (\n <Slot\n name=\"QuoteNameField\"\n slot={slots?.QuoteNameField}\n context={{\n value: quoteName,\n required: true,\n errorMessage: formErrors.quoteName,\n setFormErrors,\n isFormDisabled\n } as any}\n >\n <Field\n error={formErrors.quoteName}\n disabled={isFormDisabled}\n >\n <Input\n value={quoteName}\n name=\"quoteName\"\n floatingLabel={dictionary.quoteName}\n required\n autoComplete=\"off\"\n data-testid=\"form-quote-name-field\"\n />\n </Field>\n </Slot>\n );\n\n const attachFileNode = (\n <Slot\n name=\"AttachFileField\"\n slot={slots?.AttachFileField}\n context={{ onChange: handleAttachFiles, formErrors, isFormDisabled }}\n >\n <InputFile\n onChange={(e: Event) => {\n const target = e.target as HTMLInputElement;\n const fileList = target?.files;\n const files = fileList ? Array.from(fileList) : [];\n\n if (files.length > 0) {\n void handleAttachFiles(files);\n }\n }}\n icon={<Add />}\n disabled={isFormDisabled}\n data-testid=\"form-attach-file-field\"\n />\n </Slot>\n );\n\n const requestButtonNode = (\n <Slot\n name=\"RequestButton\"\n slot={slots?.RequestButton}\n context={\n {\n requestNegotiableQuote,\n formErrors,\n isFormDisabled,\n setIsFormDisabled\n }\n }\n >\n <Button\n type=\"submit\"\n data-testid=\"form-request-button\"\n onClick={validateParentForm}\n disabled={isFormDisabled}\n >\n {dictionary.requestCta}\n </Button>\n </Slot>\n );\n\n const saveButtonNode = (\n <Slot\n name=\"SaveDraftButton\"\n slot={slots?.SaveDraftButton}\n context={\n {\n requestNegotiableQuote,\n formErrors,\n isFormDisabled,\n setIsFormDisabled\n }\n }\n >\n <Button\n type=\"submit\"\n data-draft=\"true\"\n variant=\"secondary\"\n data-testid=\"form-save-draft-button\"\n onClick={validateParentForm}\n disabled={isFormDisabled}\n >\n {dictionary.saveDraftCta}\n </Button>\n </Slot>\n );\n\n return (\n <RequestNegotiableQuoteFormComponent\n title={titleNode}\n banner={getBannerNode()}\n commentField={commentFieldNode}\n quoteNameField={quoteNameFieldNode}\n attachFile={attachFileNode}\n requestButton={requestButtonNode}\n saveButton={saveButtonNode}\n onSubmit={formSubmitHandler}\n className={className}\n disabled={isFormDisabled}\n data-testid=\"form-container\"\n />\n );\n};\n"],"names":["SvgAdd","props","React","RequestNegotiableQuoteForm","className","title","banner","commentField","quoteNameField","attachFile","requestButton","saveButton","onSubmit","jsxs","classes","jsx","VComponent","cartId","slots","onRequestNegotiableQuote","onSaveNegotiableQuote","onAttachFiles","onSubmitErrors","onError","comment","setComment","useState","quoteName","setQuoteName","attachmentKeys","setAttachmentKeys","error","setError","formErrors","setFormErrors","success","setSuccess","isFormDisabled","setIsFormDisabled","dictionary","useText","useEffect","permissionsEvent","events","permissions","authenticatedEvent","authenticated","handleAttachFiles","useCallback","files","prev","uploaded","uploadFile","key","getBannerNode","inlineAlertProps","slotProps","CheckWithCircle","WarningFilled","Slot","InLineAlert","validateParentForm","e","closestForm","getFormErrors","formSubmitHandler","form","mergedFormErrors","buttonTarget","formValues","getFormValues","isDraft","_a","contextData","submitHandler","successMessage","requestNegotiableQuote","titleNode","commentFieldNode","TextArea","quoteNameFieldNode","Field","Input","attachFileNode","InputFile","target","fileList","Add","requestButtonNode","Button","saveButtonNode","RequestNegotiableQuoteFormComponent"],"mappings":"21BACA,MAAMA,GAAUC,GAA0BC,EAAM,cAAc,MAAO,CAAE,GAAI,gBAAiB,YAAa,gCAAiC,MAAO,6BAA8B,MAAO,GAAI,OAAQ,GAAI,QAAS,YAAa,GAAGD,GAAyBC,EAAM,cAAc,IAAK,CAAE,GAAI,OAAO,EAAoBA,EAAM,cAAc,OAAQ,CAAE,GAAI,iBAAkB,YAAa,iBAAkB,MAAO,GAAI,OAAQ,GAAI,KAAM,OAAQ,QAAS,CAAC,CAAE,EAAmBA,EAAM,cAAc,IAAK,CAAE,GAAI,WAAY,YAAa,WAAY,UAAW,wBAAwB,EAAoBA,EAAM,cAAc,OAAQ,CAAE,aAAc,qBAAsB,GAAI,WAAY,YAAa,WAAY,GAAI,KAAM,UAAW,0BAA2B,KAAM,OAAQ,OAAQ,cAAc,CAAE,EAAmBA,EAAM,cAAc,OAAQ,CAAE,aAAc,qBAAsB,GAAI,WAAY,YAAa,WAAY,GAAI,KAAM,UAAW,0BAA2B,KAAM,OAAQ,OAAQ,eAAgB,CAAC,CAAC,CAAC,ECwB/8BC,GAAiF,CAAC,CAC7F,UAAAC,EACA,MAAAC,EACA,OAAAC,EACA,aAAAC,EACA,eAAAC,EACA,WAAAC,EACA,cAAAC,EACA,WAAAC,EACA,SAAAC,EACA,GAAGX,CACL,IAEIY,EAAC,OAAA,CAAM,GAAGZ,EAAO,UAAWa,EAAQ,CAAC,gCAAiCV,CAAS,CAAC,EAAG,SAAAQ,EAChF,SAAA,CAAAN,GACCS,EAACC,EAAA,CACC,KAAMV,EACN,UAAWQ,EAAQ,CAAC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YAAA,CAAA,CACd,CAAA,EAIJ,OACExB,EAAC4E,GAAA,CACC,MAAOd,EACP,OAAQvB,EAAA,EACR,aAAcwB,EACd,eAAgBE,EAChB,WAAYG,EACZ,cAAeK,EACf,WAAYE,GACZ,SAAUzB,EACV,UAAA7D,EACA,SAAUiC,EACV,cAAY,gBAAA,CAAA,CAGlB","x_google_ignoreList":[0]}
@@ -1,8 +1,19 @@
1
- export * from './RequestNegotiableQuoteForm';
2
- export * from './ManageNegotiableQuote';
1
+ /********************************************************************
2
+ * Copyright 2025 Adobe
3
+ * All Rights Reserved.
4
+ *
5
+ * NOTICE: Adobe permits you to use, modify, and distribute this
6
+ * file in accordance with the terms of the Adobe license agreement
7
+ * accompanying it.
8
+ *******************************************************************/
3
9
  export * from './ItemsQuoted';
4
- export * from './QuotesListTable';
10
+ export * from './ManageNegotiableQuote';
11
+ export * from './OrderSummary';
12
+ export * from './OrderSummaryLine';
13
+ export * from './QuoteCommentsList';
5
14
  export * from './QuoteHistoryLog';
15
+ export * from './QuoteSummaryList';
16
+ export * from './QuotesListTable';
17
+ export * from './RequestNegotiableQuoteForm';
6
18
  export * from './ShippingAddressDisplay';
7
- export * from './QuoteCommentsList';
8
19
  //# sourceMappingURL=index.d.ts.map
@@ -3,5 +3,6 @@ import { NegotiableQuoteCartItem, NegotiableQuoteModel } from '../negotiable-quo
3
3
  export declare const baseCartItem: NegotiableQuoteCartItem;
4
4
  export declare const configurableCartItem: NegotiableQuoteCartItem;
5
5
  export declare const bundleCartItem: NegotiableQuoteCartItem;
6
+ export declare const downloadableCartItem: NegotiableQuoteCartItem;
6
7
  export declare const base: NegotiableQuoteModel;
7
8
  //# sourceMappingURL=negotiableQuoteModel.d.ts.map
@@ -0,0 +1,5 @@
1
+ import { StoreConfigModel } from '../store-config-model';
2
+
3
+ export declare const mockStoreConfigModel: StoreConfigModel;
4
+ export declare const mockStoreConfigModelWithDefaultValues: StoreConfigModel;
5
+ //# sourceMappingURL=storeConfigModel.d.ts.map
@@ -1,3 +1,12 @@
1
+ /********************************************************************
2
+ * Copyright 2025 Adobe
3
+ * All Rights Reserved.
4
+ *
5
+ * NOTICE: Adobe permits you to use, modify, and distribute this
6
+ * file in accordance with the terms of the Adobe license agreement
7
+ * accompanying it.
8
+ *******************************************************************/
1
9
  export * from './customer-model';
2
10
  export * from './negotiable-quote-model';
11
+ export * from './store-config-model';
3
12
  //# sourceMappingURL=index.d.ts.map