@dropins/storefront-quote-management 0.0.1-alpha11 → 0.0.1-alpha13

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 (75) hide show
  1. package/api/getQuoteData/getQuoteData.d.ts +10 -0
  2. package/api/getQuoteData/graphql/QuoteDataQuery.d.ts +2 -0
  3. package/api/getQuoteData/index.d.ts +10 -0
  4. package/api/graphql/NegotiableQuoteFragment.d.ts +1 -1
  5. package/api/graphql/NegotiableQuoteListFragment.d.ts +1 -1
  6. package/api/index.d.ts +3 -0
  7. package/api/initialize/initialize.d.ts +1 -0
  8. package/api/sendForReview/graphql/SendNegotiableQuoteForReviewMutation.d.ts +18 -0
  9. package/api/sendForReview/index.d.ts +10 -0
  10. package/api/sendForReview/sendForReview.d.ts +8 -0
  11. package/api/setShippingAddress/graphql/SetNegotiableQuoteShippingAddressMutation.d.ts +18 -0
  12. package/api/setShippingAddress/index.d.ts +2 -0
  13. package/api/setShippingAddress/setShippingAddress.d.ts +22 -0
  14. package/api.js +37 -4
  15. package/api.js.map +1 -1
  16. package/chunks/NegotiableQuoteFragment.js +166 -0
  17. package/chunks/NegotiableQuoteFragment.js.map +1 -0
  18. package/chunks/WarningFilled.js +4 -0
  19. package/chunks/WarningFilled.js.map +1 -0
  20. package/chunks/negotiableQuotes.js +12 -1
  21. package/chunks/negotiableQuotes.js.map +1 -1
  22. package/chunks/requestNegotiableQuote.js +3 -55
  23. package/chunks/requestNegotiableQuote.js.map +1 -1
  24. package/chunks/sendForReview.js +21 -0
  25. package/chunks/sendForReview.js.map +1 -0
  26. package/chunks/transform-quote.js +1 -1
  27. package/chunks/transform-quote.js.map +1 -1
  28. package/components/ActionsBar/ActionsBar.d.ts +14 -0
  29. package/components/ActionsBar/index.d.ts +11 -0
  30. package/components/ItemsQuoted/ItemsQuoted.d.ts +11 -0
  31. package/components/ItemsQuoted/index.d.ts +11 -0
  32. package/components/ManageNegotiableQuote/ManageNegotiableQuote.d.ts +20 -0
  33. package/components/ManageNegotiableQuote/__fixtures__/ManageNegotiableQuoteProps.d.ts +4 -0
  34. package/components/ManageNegotiableQuote/index.d.ts +11 -0
  35. package/components/OrderSummary/OrderSummary.d.ts +67 -0
  36. package/components/OrderSummary/index.d.ts +11 -0
  37. package/components/OrderSummaryLine/OrderSummaryLine.d.ts +13 -0
  38. package/components/OrderSummaryLine/index.d.ts +11 -0
  39. package/components/ProductListTable/ProductListTable.d.ts +13 -0
  40. package/components/ProductListTable/index.d.ts +11 -0
  41. package/components/QuotePricesSummary/QuotePricesSummary.d.ts +16 -0
  42. package/components/QuotePricesSummary/index.d.ts +11 -0
  43. package/components/QuoteSummaryList/QuoteSummaryList.d.ts +13 -0
  44. package/components/QuoteSummaryList/index.d.ts +11 -0
  45. package/components/ShippingAddressDisplay/ShippingAddressDisplay.d.ts +12 -0
  46. package/components/ShippingAddressDisplay/index.d.ts +11 -0
  47. package/components/TabbedContent/TabbedContent.d.ts +10 -0
  48. package/components/TabbedContent/index.d.ts +11 -0
  49. package/components/index.d.ts +19 -1
  50. package/containers/ItemsQuoted/ItemsQuoted.d.ts +25 -0
  51. package/containers/ItemsQuoted/index.d.ts +11 -0
  52. package/containers/ItemsQuoted.d.ts +3 -0
  53. package/containers/ItemsQuoted.js +4 -0
  54. package/containers/ItemsQuoted.js.map +1 -0
  55. package/containers/ManageNegotiableQuote/ManageNegotiableQuote.d.ts +53 -0
  56. package/containers/ManageNegotiableQuote/index.d.ts +11 -0
  57. package/containers/ManageNegotiableQuote.d.ts +3 -0
  58. package/containers/ManageNegotiableQuote.js +4 -0
  59. package/containers/ManageNegotiableQuote.js.map +1 -0
  60. package/containers/QuotesListTable/QuotesListTable.d.ts +9 -9
  61. package/containers/QuotesListTable.js +1 -1
  62. package/containers/QuotesListTable.js.map +1 -1
  63. package/containers/RequestNegotiableQuoteForm.js +1 -1
  64. package/containers/RequestNegotiableQuoteForm.js.map +1 -1
  65. package/containers/index.d.ts +2 -0
  66. package/data/models/__fixtures__/negotiableQuoteModel.d.ts +7 -0
  67. package/data/models/customer-model.d.ts +1 -0
  68. package/data/models/negotiable-quote-model.d.ts +96 -30
  69. package/data/transforms/__fixtures__/negotiableQuoteData.d.ts +229 -2
  70. package/i18n/en_US.json.d.ts +94 -0
  71. package/lib/state.d.ts +1 -0
  72. package/package.json +1 -1
  73. package/render.js +5 -3
  74. package/render.js.map +1 -1
  75. package/types/state.types.d.ts +1 -0
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ItemsQuoted.js","sources":["/@dropins/storefront-quote-management/src/components/ItemsQuoted/ItemsQuoted.tsx","/@dropins/storefront-quote-management/src/components/ProductListTable/ProductListTable.tsx","/@dropins/storefront-quote-management/src/components/QuotePricesSummary/QuotePricesSummary.tsx","/@dropins/storefront-quote-management/src/containers/ItemsQuoted/ItemsQuoted.tsx"],"sourcesContent":["/********************************************************************\n * Copyright 2025 Adobe\n * All Rights Reserved.\n *\n * NOTICE: Adobe permits you to use, modify, and distribute this \n * file in accordance with the terms of the Adobe license agreement \n * accompanying it. \n *******************************************************************/\n\nimport { FunctionComponent, VNode } from 'preact';\nimport { HTMLAttributes } from 'preact/compat';\nimport { classes, VComponent } from '@adobe-commerce/elsie/lib';\nimport '@/quote-management/components/ItemsQuoted/ItemsQuoted.css';\nimport { Skeleton, SkeletonRow } from '@adobe-commerce/elsie/components';\n\nexport interface ItemsQuotedProps extends Omit<HTMLAttributes<HTMLDivElement>, 'loading'> {\n loading?: boolean;\n table?: VNode;\n pricesSummary?: VNode;\n}\n\nexport const ItemsQuoted: FunctionComponent<ItemsQuotedProps> = ({\n className,\n loading,\n table,\n pricesSummary,\n ...props\n}) => {\n if (loading) {\n return <ItemsQuotedSkeleton />;\n }\n\n return (\n <div className={classes(['quote-management-items-quoted', className])} {...props}>\n {table && (\n <VComponent\n node={table}\n className={classes(['quote-management-items-quoted__table'])}\n data-testid=\"quote-management-items-quoted__table\"\n />\n )}\n {pricesSummary && (\n <VComponent\n node={pricesSummary}\n className={classes(['quote-management-items-quoted__prices-summary'])}\n data-testid=\"quote-management-items-quoted__prices-summary\"\n />\n )}\n </div>\n );\n};\n\nexport const ItemsQuotedSkeleton: FunctionComponent = () => {\n return (\n <Skeleton data-testid=\"items-quoted-skeleton\">\n <SkeletonRow variant=\"row\" fullWidth={true} size=\"medium\" lines={4} multilineGap='xsmall' />\n </Skeleton>\n );\n};","/********************************************************************\n * Copyright 2025 Adobe\n * All Rights Reserved.\n *\n * NOTICE: Adobe permits you to use, modify, and distribute this \n * file in accordance with the terms of the Adobe license agreement \n * accompanying it. \n *******************************************************************/\n\nimport { FunctionComponent, h } from 'preact';\nimport { HTMLAttributes } from 'preact/compat';\nimport { classes, VComponent } from '@adobe-commerce/elsie/lib';\nimport { Table, Checkbox, Picker, Price, Button } from '@adobe-commerce/elsie/components';\nimport '@/quote-management/components/ProductListTable/ProductListTable.css';\nimport { NegotiableQuoteCartItem } from '@/quote-management/data/models/negotiable-quote-model';\nimport { useText } from '@adobe-commerce/elsie/i18n';\n\nexport interface ProductListTableProps extends HTMLAttributes<HTMLDivElement | HTMLFormElement> {\n items: NegotiableQuoteCartItem[];\n canEdit: boolean;\n onItemCheckboxChange?: (item: NegotiableQuoteCartItem, isSelected: boolean) => void;\n onItemDropdownChange?: (item: NegotiableQuoteCartItem, action: string) => void;\n onUpdate?: (e: SubmitEvent) => void;\n}\n\nexport const ProductListTable: FunctionComponent<ProductListTableProps> = ({\n className,\n items,\n canEdit,\n onItemCheckboxChange,\n onItemDropdownChange,\n onUpdate,\n ...props\n}) => {\n\n const dictionary = useText({\n updateButton: 'NegotiableQuote.Manage.productListTable.submitButton',\n productNameHeader: 'NegotiableQuote.Manage.productListTable.headers.productName',\n skuHeader: 'NegotiableQuote.Manage.productListTable.headers.sku',\n priceHeader: 'NegotiableQuote.Manage.productListTable.headers.price',\n quantityHeader: 'NegotiableQuote.Manage.productListTable.headers.quantity',\n discountHeader: 'NegotiableQuote.Manage.productListTable.headers.discount',\n subtotalHeader: 'NegotiableQuote.Manage.productListTable.headers.subtotal',\n actionsHeader: 'NegotiableQuote.Manage.productListTable.headers.actions',\n editNoteToSeller: 'NegotiableQuote.Manage.productListTable.actions.editNoteToSeller',\n remove: 'NegotiableQuote.Manage.productListTable.actions.remove',\n });\n\n const columns = [\n {\n label: dictionary.productNameHeader,\n key: 'productName',\n },\n {\n label: dictionary.skuHeader,\n key: 'sku',\n },\n {\n label: dictionary.priceHeader,\n key: 'price',\n },\n {\n label: dictionary.quantityHeader,\n key: 'quantity',\n },\n {\n label: dictionary.discountHeader,\n key: 'discount',\n },\n {\n label: dictionary.subtotalHeader,\n key: 'subtotal',\n },\n ];\n\n if (canEdit) {\n columns.unshift({\n label: '',\n key: 'checkbox',\n });\n columns.push({\n label: dictionary.actionsHeader,\n key: 'actions',\n });\n }\n\n const handleItemCheckboxChange = (event: Event, item: NegotiableQuoteCartItem) => {\n const isSelected = (event.target as HTMLInputElement).checked;\n onItemCheckboxChange?.(item, isSelected);\n };\n\n const handleItemDropdownChange = (event: Event, item: NegotiableQuoteCartItem) => {\n const action = (event.target as HTMLSelectElement).value;\n onItemDropdownChange?.(item, action);\n };\n\n const handleUpdate = (event: SubmitEvent) => {\n event.preventDefault();\n onUpdate?.(event);\n };\n\n const discountElement = (amountOff: number, percentOff: number) => {\n return amountOff > 0 ?\n <div className=\"quote-management-product-list-table__discount-container\">\n <span className=\"quote-management-product-list-table__discount-percent\">{percentOff}%</span>\n <span className=\"quote-management-product-list-table__discount-price\">(<Price amount={amountOff} />)</span>\n </div>\n : undefined;\n };\n\n const getProductNameContent = (item: NegotiableQuoteCartItem) => {\n const configurableOptions = item.configurableOptions?.map((option) =>\n <div key={option.optionLabel} className=\"quote-management-product-list-table__configurable-option\">\n <span className=\"quote-management-product-list-table__configurable-option-label\">{option.optionLabel}:</span>\n <span className=\"quote-management-product-list-table__configurable-option-value\">{option.valueLabel}</span>\n </div>);\n\n const bundleOptions = item.bundleOptions?.map((option) =>\n <div key={option.label} className=\"quote-management-product-list-table__bundle-option\">\n <span className=\"quote-management-product-list-table__bundle-option-label\">{option.label}</span>\n <div className=\"quote-management-product-list-table__bundle-option-values\">\n {option.values.map((value) =>\n <span key={value.label} className=\"quote-management-product-list-table__bundle-option-value\">\n <span className=\"quote-management-product-list-table__bundle-option-value-quantity\">{value.quantity} x</span>\n <span className=\"quote-management-product-list-table__bundle-option-value-label\">{value.label}</span>\n <Price className=\"quote-management-product-list-table__bundle-option-value-original-price\"\n amount={value.originalPrice.value}\n currency={value.originalPrice.currency}\n weight=\"normal\"\n />\n </span>\n )}\n </div>\n </div>);\n\n return (\n <div className=\"quote-management-product-list-table__product-name-container\">\n <span className=\"quote-management-product-list-table__product-name\">{item.product.name}</span>\n {configurableOptions}\n {bundleOptions}\n </div>\n )\n };\n\n const rowData = items.map((item) => {\n return {\n checkbox: <Checkbox className=\"quote-management-product-list-table__checkbox\" name=\"itemSelected\" data-testid={`item-checkbox-${item.product.sku}`} onChange={(e) => handleItemCheckboxChange(e, item)} value={item.product.sku} />,\n productName: getProductNameContent(item),\n sku: <span className=\"quote-management-product-list-table__sku\">{item.product.sku}</span>,\n price: <Price className=\"quote-management-product-list-table__price\" amount={item.prices.originalItemPrice.value} currency={item.prices.originalItemPrice.currency} />,\n quantity: <span className=\"quote-management-product-list-table__quantity\">{item.quantity}</span>,\n discount: discountElement(item.catalogDiscount.amountOff, item.catalogDiscount.percentOff),\n subtotal: <Price className=\"quote-management-product-list-table__subtotal\" amount={item.prices.rowTotal.value} currency={item.prices.rowTotal.currency} />,\n actions: <Picker\n className=\"quote-management-product-list-table__actions\"\n data-testid={`item-dropdown-${item.product.sku}`}\n name={`item-dropdown-${item.product.sku}`}\n onChange={(e) => handleItemDropdownChange(e, item)}\n placeholder=\"Select\"\n options={[{ text: dictionary.editNoteToSeller, value: 'edit' }, { text: dictionary.remove, value: 'remove' }]}\n value={item.product.sku}\n />,\n }\n });\n\n const table = <Table columns={columns} rowData={rowData} data-testid=\"product-list-table\" mobileLayout='stacked' />\n\n // if can edit, the wrapper node should use the form element, else use the div element\n const wrapperNode = canEdit ? h('form', {}) : h('div', {});\n const wrapperProps = canEdit ? {\n onSubmit: handleUpdate,\n ...props,\n } : props;\n\n const submitButton = canEdit ? <Button type=\"submit\" data-testid=\"product-list-table-submit-button\">{dictionary.updateButton}</Button> : undefined;\n\n return (\n <VComponent\n node={wrapperNode}\n className={classes(['quote-management-product-list-table-container', className])}\n data-testid=\"product-list-table-container\"\n {...wrapperProps}\n >\n {table}\n <div className=\"quote-management-product-list-table-container__submit-container\">\n {submitButton}\n </div>\n </VComponent>\n );\n};\n","/********************************************************************\n * Copyright 2025 Adobe\n * All Rights Reserved.\n *\n * NOTICE: Adobe permits you to use, modify, and distribute this \n * file in accordance with the terms of the Adobe license agreement \n * accompanying it. \n *******************************************************************/\n \nimport { FunctionComponent, VNode } from 'preact';\nimport { HTMLAttributes } from 'preact/compat';\nimport { classes } from '@adobe-commerce/elsie/lib';\nimport '@/quote-management/components/QuotePricesSummary/QuotePricesSummary.css';\nimport { Accordion, AccordionSection } from '@adobe-commerce/elsie/components';\n\ninterface Entry {\n label: string;\n id: string;\n value: VNode;\n strong?: boolean;\n children?: Entry[];\n}\n\nexport interface QuotePricesSummaryProps extends HTMLAttributes<HTMLDivElement> {\n entries?: Entry[];\n}\n\nexport const QuotePricesSummary: FunctionComponent<QuotePricesSummaryProps> = ({\n className,\n entries,\n ...props\n}) => {\n const createEntry = (entry: Entry) => {\n const children = entry.children?.map(createEntry);\n return (\n <div key={entry.id} className=\"quote-management-quote-prices-summary__entry\" data-testid={`quote-prices-summary-entry-${entry.id}`}>\n {children ? <Accordion\n className=\"quote-management-quote-prices-summary__accordion\"\n data-testid={`quote-prices-summary-entry-accordion-${entry.id}`}\n >\n <AccordionSection className=\"quote-management-quote-prices-summary__accordion-section\" title={entry.label} ariaLabelTitle={entry.label} secondaryText={entry.value}>\n {children}\n </AccordionSection>\n </Accordion>\n :\n <>\n <span className={classes(['quote-management-quote-prices-summary__label', ['quote-management-quote-prices-summary__label--strong', entry.strong]])} data-testid={`quote-prices-summary-entry-label-${entry.id}`}>{entry.label}</span>\n <span className=\"quote-management-quote-prices-summary__value\" data-testid={`quote-prices-summary-entry-value-${entry.id}`}>{entry.value}</span>\n </>\n }\n </div>\n );\n };\n\n return (\n <div className={classes(['quote-management-quote-prices-summary', className])} data-testid=\"quote-prices-summary\" {...props}>\n {entries?.map(createEntry)}\n </div>\n );\n};\n","/********************************************************************\n * Copyright 2025 Adobe\n * All Rights Reserved.\n *\n * NOTICE: Adobe permits you to use, modify, and distribute this \n * file in accordance with the terms of the Adobe license agreement \n * accompanying it. \n *******************************************************************/\n\nimport { HTMLAttributes, useEffect, useState } from 'preact/compat';\nimport { Container, Slot, SlotProps } from '@adobe-commerce/elsie/lib';\nimport { ProductListTable } from '@/quote-management/components/ProductListTable/ProductListTable';\nimport { NegotiableQuoteModel, NegotiableQuoteCartItem } from '@/quote-management/data/models/negotiable-quote-model';\nimport { events } from '@adobe-commerce/event-bus';\nimport { QuotePricesSummary } from '@/quote-management/components/QuotePricesSummary';\nimport { ItemsQuoted as ItemsQuotedComponent } from '@/quote-management/components/ItemsQuoted';\nimport { Price } from '@adobe-commerce/elsie/components';\nimport { useText } from '@adobe-commerce/elsie/i18n';\n\nexport interface ItemsQuotedProps extends HTMLAttributes<HTMLDivElement> {\n quoteData?: NegotiableQuoteModel;\n onItemCheckboxChange?: (item: NegotiableQuoteCartItem, isSelected: boolean) => void;\n onItemDropdownChange?: (item: NegotiableQuoteCartItem, action: string) => void;\n onUpdate?: (e: SubmitEvent) => void;\n slots?: {\n ProductListTable?: SlotProps<{\n items: NegotiableQuoteModel['items'];\n canEdit: boolean;\n onItemCheckboxChange?: (item: NegotiableQuoteCartItem, isSelected: boolean) => void;\n onItemDropdownChange?: (item: NegotiableQuoteCartItem, action: string) => void;\n onUpdate?: (e: SubmitEvent) => void;\n }>;\n QuotePricesSummary?: SlotProps<{\n items: NegotiableQuoteModel['items'];\n prices: NegotiableQuoteModel['prices'];\n }>;\n }\n}\n\nexport const ItemsQuoted: Container<ItemsQuotedProps> = ({\n quoteData: initialData,\n onItemCheckboxChange,\n onItemDropdownChange,\n onUpdate,\n slots,\n ...props\n}) => {\n const [quoteData, setQuoteData] = useState<NegotiableQuoteModel | undefined>(initialData);\n\n const dictionary = useText({\n subtotal: 'NegotiableQuote.Manage.quotePricesSummary.subtotal.excludingTax',\n grandTotal: 'NegotiableQuote.Manage.quotePricesSummary.grandTotal.includingTax',\n appliedTaxes: 'NegotiableQuote.Manage.quotePricesSummary.appliedTaxes',\n });\n\n useEffect(() => {\n const quoteDataEvent = events.on('quote-management/quote-data', (data: { quote: NegotiableQuoteModel }) => {\n setQuoteData(data.quote);\n }, {\n eager: true,\n });\n return () => quoteDataEvent?.off();\n }, []);\n\n if (!quoteData) {\n return <ItemsQuotedComponent loading={true} />;\n }\n\n const quotePricesSummaryEntries = [];\n\n quoteData.prices.subtotalExcludingTax && quotePricesSummaryEntries.push({\n label: dictionary.subtotal,\n id: 'subtotal',\n value: <Price amount={quoteData.prices.subtotalExcludingTax.value} currency={quoteData.prices.subtotalExcludingTax.currency} weight='normal' />,\n })\n\n quoteData.prices.grandTotal && quotePricesSummaryEntries.push({\n label: dictionary.grandTotal,\n id: 'total',\n value: <Price amount={quoteData.prices.grandTotal.value} currency={quoteData.prices.grandTotal.currency} />,\n strong: true,\n })\n\n return (\n <ItemsQuotedComponent data-testid=\"items-quoted-container\" {...props} loading={false}\n table={<Slot name=\"ProductListTable\" slot={slots?.ProductListTable}\n context={{\n items: quoteData.items,\n canEdit: true,\n onItemCheckboxChange,\n onItemDropdownChange,\n onUpdate\n }}>\n <ProductListTable\n items={quoteData.items}\n canEdit={true}\n onItemCheckboxChange={onItemCheckboxChange}\n onItemDropdownChange={onItemDropdownChange}\n onUpdate={onUpdate}\n />\n </Slot>}\n pricesSummary={<Slot name=\"QuotePricesSummary\" slot={slots?.QuotePricesSummary} context={{\n items: quoteData.items,\n prices: quoteData.prices,\n }}>\n <QuotePricesSummary entries={quotePricesSummaryEntries} />\n </Slot>\n }\n />\n );\n};"],"names":["ItemsQuoted","className","loading","table","pricesSummary","props","ItemsQuotedSkeleton","jsxs","classes","jsx","VComponent","Skeleton","SkeletonRow","ProductListTable","items","canEdit","onItemCheckboxChange","onItemDropdownChange","onUpdate","dictionary","useText","columns","handleItemCheckboxChange","event","item","isSelected","handleItemDropdownChange","action","handleUpdate","discountElement","amountOff","percentOff","Price","getProductNameContent","configurableOptions","_a","option","bundleOptions","_b","value","rowData","Checkbox","e","Picker","Table","wrapperNode","h","wrapperProps","submitButton","Button","QuotePricesSummary","entries","createEntry","entry","children","Accordion","AccordionSection","Fragment","initialData","slots","quoteData","setQuoteData","useState","useEffect","quoteDataEvent","events","data","ItemsQuotedComponent","quotePricesSummaryEntries","Slot"],"mappings":"4kBAqBO,MAAMA,EAAmD,CAAC,CAC/D,UAAAC,EACA,QAAAC,EACA,MAAAC,EACA,cAAAC,EACA,GAAGC,CACL,IACMH,IACMI,EAAA,EAAoB,EAI5BC,EAAC,MAAA,CAAI,UAAWC,EAAQ,CAAC,gCAAiCP,CAAS,CAAC,EAAI,GAAGI,EACxE,SAAA,CAAAF,GACCM,EAACC,EAAA,CACC,KAAMP,EACN,UAAWK,EAAQ,CAAC,sCAAsC,CAAC,EAC3D,cAAY,sCAAA,CAAA,EAGfJ,GACCK,EAACC,EAAA,CACC,KAAMN,EACN,UAAWI,EAAQ,CAAC,+CAA+C,CAAC,EACpE,cAAY,+CAAA,CAAA,CACd,EAEJ,EAISF,EAAyC,MAEjDK,EAAA,CAAS,cAAY,wBACpB,SAAAF,EAACG,GAAY,QAAQ,MAAM,UAAW,GAAM,KAAK,SAAS,MAAO,EAAG,aAAa,SAAS,EAC5F,EC/BSC,EAA6D,CAAC,CACzE,UAAAZ,EACA,MAAAa,EACA,QAAAC,EACA,qBAAAC,EACA,qBAAAC,EACA,SAAAC,EACA,GAAGb,CACL,IAAM,CAE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CAAA,CAIN"}
@@ -0,0 +1,53 @@
1
+ import { HTMLAttributes } from 'preact/compat';
2
+ import { Container, SlotProps } from '@dropins/tools/types/elsie/src/lib';
3
+ import { NegotiableQuoteModel } from '../../data/models/negotiable-quote-model';
4
+
5
+ export interface ManageNegotiableQuoteProps extends HTMLAttributes<HTMLDivElement> {
6
+ onActionsDropdownChange?: (event: Event) => void;
7
+ onActionsButtonClick?: (action: string) => void;
8
+ onSendForReview?: (params: {
9
+ quoteData: NegotiableQuoteModel;
10
+ comment?: string;
11
+ }) => void;
12
+ slots?: {
13
+ QuoteName?: SlotProps<{
14
+ quoteName?: string;
15
+ quoteData?: NegotiableQuoteModel;
16
+ }>;
17
+ QuoteStatus?: SlotProps<{
18
+ quoteStatus?: string;
19
+ quoteData?: NegotiableQuoteModel;
20
+ }>;
21
+ Banner?: SlotProps<{
22
+ quoteData?: NegotiableQuoteModel;
23
+ }>;
24
+ Details?: SlotProps<{
25
+ quoteData?: NegotiableQuoteModel;
26
+ }>;
27
+ ActionBar?: SlotProps<{
28
+ quoteData?: NegotiableQuoteModel;
29
+ }>;
30
+ QuoteContent?: SlotProps<{
31
+ quoteData?: NegotiableQuoteModel;
32
+ }>;
33
+ ShippingInformationTitle?: SlotProps<{
34
+ quoteData?: NegotiableQuoteModel;
35
+ }>;
36
+ ShippingInformation?: SlotProps<{
37
+ quoteData?: NegotiableQuoteModel;
38
+ }>;
39
+ QuoteCommentsTitle?: SlotProps<{
40
+ quoteData?: NegotiableQuoteModel;
41
+ }>;
42
+ QuoteComments?: SlotProps<{
43
+ quoteData?: NegotiableQuoteModel;
44
+ }>;
45
+ Footer?: SlotProps<{
46
+ quoteData?: NegotiableQuoteModel;
47
+ comment?: string;
48
+ isSubmitting?: boolean;
49
+ }>;
50
+ };
51
+ }
52
+ export declare const ManageNegotiableQuote: Container<ManageNegotiableQuoteProps>;
53
+ //# sourceMappingURL=ManageNegotiableQuote.d.ts.map
@@ -0,0 +1,11 @@
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
+ *******************************************************************/
9
+ export * from './ManageNegotiableQuote';
10
+ export { ManageNegotiableQuote as default } from './ManageNegotiableQuote';
11
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1,3 @@
1
+ export * from './ManageNegotiableQuote/index'
2
+ import _default from './ManageNegotiableQuote/index'
3
+ export default _default
@@ -0,0 +1,4 @@
1
+ /*! Copyright 2025 Adobe
2
+ All Rights Reserved. */
3
+ import{jsx as t,jsxs as l}from"@dropins/tools/preact-jsx-runtime.js";import{useState as x,useEffect as M,useMemo as b,useCallback as F}from"@dropins/tools/preact-compat.js";import{classes as d,VComponent as c,Slot as h,getGlobalLocale as Y}from"@dropins/tools/lib.js";/* empty css */import{Picker as Z,Skeleton as R,SkeletonRow as y,InLineAlert as D,Button as P,TextArea as O}from"@dropins/tools/components.js";import{events as S}from"@dropins/tools/event-bus.js";/* empty css */import"@dropins/tools/preact.js";import{useText as W}from"@dropins/tools/i18n.js";/* empty css */import"../chunks/transform-quote.js";import"@dropins/tools/fetch-graphql.js";import{s as B}from"../chunks/sendForReview.js";import{S as k}from"../chunks/WarningFilled.js";import"../chunks/NegotiableQuoteFragment.js";const A=({className:s,dropdownPlaceholder:e,dropdownOptions:i,handleDropdownChange:q,buttons:u,...a})=>{const _=i&&i.length>0,p=u&&u.length>0,N=(i==null?void 0:i.map(o=>({text:o.label,value:o.value})))||[];return N.unshift({text:e||"",value:""}),t("div",{className:"quote-management-actions-bar__container","data-testid":"actions-bar-container",children:l("div",{className:d(["quote-management-actions-bar",s]),"data-testid":"actions-bar",...a,children:[_&&t(Z,{name:"dropdown",id:"dropdown",onInput:q,className:"quote-management-actions-bar__dropdown","data-testid":"dropdown",options:N}),p&&t("div",{className:"quote-management-actions-bar__buttons","data-testid":"buttons-container",children:u==null?void 0:u.map((o,v)=>t(c,{node:o,className:d(["quote-management-actions-bar__button"])},v))})]})})},ee=({className:s,loading:e,quoteName:i,quoteStatus:q,banner:u,details:a,actionBar:_,quoteContent:p,shippingInformationTitle:N,shippingInformation:o,quoteCommentsTitle:v,quoteComments:f,footer:Q,...n})=>e?t(ae,{}):l("div",{...n,className:d(["quote-management-manage-negotiable-quote",s]),children:[l("div",{className:d(["quote-management-manage-negotiable-quote__header"]),children:[i&&t(c,{node:i,className:d(["quote-management-manage-negotiable-quote__quote-name"])}),q&&t(c,{node:q,className:d(["quote-management-manage-negotiable-quote__quote-status"])})]}),u&&t(c,{node:u,className:d(["quote-management-manage-negotiable-quote__banner"])}),a&&t(c,{node:a,className:d(["quote-management-manage-negotiable-quote__details"])}),_&&t(c,{node:_,className:d(["quote-management-manage-negotiable-quote__action-bar"])}),p&&t(c,{node:p,className:d(["quote-management-manage-negotiable-quote__quote-content"])}),l("div",{"data-testid":"quote-shipping-information-container",className:d(["quote-management-manage-negotiable-quote__shipping-information-container"]),children:[N&&t(c,{node:N,className:d(["quote-management-manage-negotiable-quote__shipping-information-title"])}),o&&t(c,{node:o,className:d(["quote-management-manage-negotiable-quote__shipping-information"])})]}),l("div",{"data-testid":"quote-comments-container",className:d(["quote-management-manage-negotiable-quote__quote-comments-container"]),children:[v&&t(c,{node:v,className:d(["quote-management-manage-negotiable-quote__quote-comments-title"])}),f&&t(c,{node:f,className:d(["quote-management-manage-negotiable-quote__quote-comments"])})]}),t(c,{node:Q,className:d(["quote-management-manage-negotiable-quote__footer"])})]}),ae=()=>l(R,{"data-testid":"manage-negotiable-quote-skeleton",children:[t(y,{variant:"heading",fullWidth:!0,size:"large"}),t(y,{variant:"row",fullWidth:!1,size:"small"}),t(y,{variant:"row",fullWidth:!1,size:"small"}),t(y,{variant:"row",fullWidth:!0}),t(y,{variant:"row",fullWidth:!0,size:"xlarge",lines:2}),t(y,{variant:"row",fullWidth:!1,size:"small"})]}),te=({className:s,shippingAddress:e,loading:i,noAddressMessage:q,...u})=>{const a=W({noAddress:"NegotiableQuote.Manage.shippingAddress.noAddress"});return i?t(ne,{}):e?l("div",{className:d(["quote-management-shipping-address-display",s]),"data-testid":"shipping-address-display",...u,children:[t("div",{className:"quote-management-shipping-address-display__field","data-testid":"address-name",children:l("span",{className:"quote-management-shipping-address-display__name",children:[e.firstname," ",e.lastname]})}),e.company&&t("div",{className:"quote-management-shipping-address-display__field","data-testid":"address-company",children:e.company}),e.street.map((_,p)=>t("div",{className:"quote-management-shipping-address-display__field","data-testid":`address-street-${p}`,children:_},p)),l("div",{className:"quote-management-shipping-address-display__field","data-testid":"address-city-region",children:[e.city,e.region&&`, ${e.region.label}`," ",e.postcode]}),t("div",{className:"quote-management-shipping-address-display__field","data-testid":"address-country",children:e.country.label}),t("div",{className:"quote-management-shipping-address-display__field","data-testid":"address-telephone",children:e.telephone})]}):t("div",{className:d(["quote-management-shipping-address-display","quote-management-shipping-address-display--empty",s]),"data-testid":"shipping-address-display-empty",...u,children:t("p",{className:"quote-management-shipping-address-display__no-address",children:q||a.noAddress})})},ne=()=>t(R,{"data-testid":"shipping-address-display-skeleton",children:t(y,{variant:"row",fullWidth:!0,size:"small",lines:5,multilineGap:"xsmall"})}),ve=({onActionsDropdownChange:s,slots:e,onActionsButtonClick:i,onSendForReview:q,...u})=>{const[a,_]=x(void 0),[p,N]=x(!0),[o,v]=x(""),[f,Q]=x(!1),n=W({createdLabel:"NegotiableQuote.Manage.createdLabel",salesRepLabel:"NegotiableQuote.Manage.salesRepLabel",expiresLabel:"NegotiableQuote.Manage.expiresLabel",actionsLabel:"NegotiableQuote.Manage.actionsLabel",remove:"NegotiableQuote.Manage.actions.remove",close:"NegotiableQuote.Manage.actionButtons.close",delete:"NegotiableQuote.Manage.actionButtons.delete",print:"NegotiableQuote.Manage.actionButtons.print",createTemplate:"NegotiableQuote.Manage.actionButtons.createTemplate",createCopy:"NegotiableQuote.Manage.actionButtons.createCopy",shippingInformationTitle:"NegotiableQuote.Manage.shippingInformation.title",quoteCommentsTitle:"NegotiableQuote.Manage.quoteComments.title",quoteCommentsPlaceholder:"NegotiableQuote.Manage.quoteComments.placeholder",sendForReview:"NegotiableQuote.Manage.actionButtons.sendForReview",bannerTitle:"NegotiableQuote.Manage.bannerTitle",statusSubmitted:"NegotiableQuote.Manage.bannerStatusMessages.submitted",statusPending:"NegotiableQuote.Manage.bannerStatusMessages.pending",statusExpired:"NegotiableQuote.Manage.bannerStatusMessages.expired"});M(()=>{const m=S.on("quote-management/quote-data",g=>{const{quote:r}=g;r&&(_(r),N(!1))},{eager:!0});return()=>m==null?void 0:m.off()},[]),M(()=>{const m=S.on("quote-management/shipping-address-set",g=>{const{quote:r}=g;r&&_(r)},{eager:!0});return()=>m==null?void 0:m.off()},[]),M(()=>{const m=S.on("quote-management/quote-sent-for-review",g=>{const{quote:r}=g;_(r),v(""),Q(!1)},{eager:!0});return()=>m==null?void 0:m.off()},[]);const z=b(()=>t(h,{name:"QuoteName",slot:e==null?void 0:e.QuoteName,context:{quoteName:a==null?void 0:a.name,quoteData:a},children:t("h1",{"data-testid":"quote-name",children:a==null?void 0:a.name})}),[e==null?void 0:e.QuoteName,a]),E=b(()=>t(h,{name:"QuoteStatus",slot:e==null?void 0:e.QuoteStatus,context:{quoteStatus:a==null?void 0:a.status,quoteData:a},children:t("div",{"data-testid":"quote-status",children:a==null?void 0:a.status})}),[e==null?void 0:e.QuoteStatus,a]),T=F(m=>{switch(m){case"SUBMITTED":return n.statusSubmitted;case"PENDING":return n.statusPending;case"EXPIRED":return n.statusExpired;default:return null}},[n])(a==null?void 0:a.status),w=T&&t(D,{type:"warning",variant:"secondary",icon:t(k,{}),heading:n.bannerTitle,description:T}),$=w&&t(h,{name:"Banner","data-testid":"banner",slot:e==null?void 0:e.Banner,context:{quoteData:a},children:w}),G=b(()=>{if(!a)return null;const m=Y()||"en-US",g=new Intl.DateTimeFormat(m,{year:"numeric",month:"long",day:"numeric"});let r;try{r=g.format(new Date(a.expirationDate))}catch{r=a.expirationDate}return l(h,{name:"Details",slot:e==null?void 0:e.Details,context:{quoteData:a},children:[l("div",{className:"quote-management-manage-negotiable-quote__detail",children:[t("span",{className:"quote-management-manage-negotiable-quote__detail-title","data-testid":"created-label",children:n.createdLabel}),l("span",{className:"quote-management-manage-negotiable-quote__detail-content","data-testid":"created-value",children:[g.format(new Date(a.createdAt))," (",a.buyer.firstname," ",a.buyer.lastname,")"]})]}),l("div",{className:"quote-management-manage-negotiable-quote__detail",children:[t("span",{className:"quote-management-manage-negotiable-quote__detail-title","data-testid":"sales-rep-label",children:n.salesRepLabel}),t("span",{className:"quote-management-manage-negotiable-quote__detail-content","data-testid":"sales-rep-value",children:a.salesRepName})]}),l("div",{className:"quote-management-manage-negotiable-quote__detail",children:[t("span",{className:"quote-management-manage-negotiable-quote__detail-title","data-testid":"expires-label",children:n.expiresLabel}),t("span",{className:"quote-management-manage-negotiable-quote__detail-content","data-testid":"expires-value",children:r})]})]})},[e==null?void 0:e.Details,n,a]),I=b(()=>[{label:n.close,value:"close"},{label:n.delete,value:"delete"},{label:n.print,value:"print"},{label:n.createTemplate,value:"createTemplate"},{label:n.createCopy,value:"createCopy"}],[n]),U=b(()=>{const m=r=>{s==null||s(r)},g=r=>{switch(r){case"close":i==null||i(r);break;case"delete":i==null||i(r);break;case"print":i==null||i(r);break;case"createTemplate":i==null||i(r);break;case"createCopy":i==null||i(r);break}};return t(h,{name:"ActionBar",slot:e==null?void 0:e.ActionBar,context:{quoteData:a},children:t(A,{dropdownPlaceholder:n.actionsLabel,dropdownOptions:[{label:n.remove,value:"remove"}],handleDropdownChange:m,buttons:I.map(r=>t(P,{variant:"tertiary",onClick:()=>g(r.value),"data-testid":`actions-bar-${r.value}-button`,"data-action":r.value,disabled:r.disabled,children:r.label},r.value))})})},[I,n,e==null?void 0:e.ActionBar,a,s,i]),j=b(()=>t(h,{name:"QuoteContent",slot:e==null?void 0:e.QuoteContent,context:{quoteData:a}}),[e==null?void 0:e.QuoteContent,a]),V=b(()=>t(h,{name:"ShippingInformationTitle",slot:e==null?void 0:e.ShippingInformationTitle,context:{quoteData:a},children:t("h2",{children:n.shippingInformationTitle})}),[e==null?void 0:e.ShippingInformationTitle,a,n]),X=b(()=>{var g;const m=(g=a==null?void 0:a.shippingAddresses)==null?void 0:g[0];return t(h,{name:"ShippingInformation",slot:e==null?void 0:e.ShippingInformation,context:{quoteData:a},children:t(te,{shippingAddress:m,loading:p,"data-testid":"manage-quote-shipping-address"})})},[e==null?void 0:e.ShippingInformation,a,p]),C=b(()=>t(h,{name:"QuoteCommentsTitle",slot:e==null?void 0:e.QuoteCommentsTitle,context:{quoteData:a},children:t("h2",{children:n.quoteCommentsTitle})}),[e==null?void 0:e.QuoteCommentsTitle,n,a]),H=b(()=>t(h,{name:"QuoteComments",slot:e==null?void 0:e.QuoteComments,context:{quoteData:a},children:t(O,{name:"quoteComments",placeholder:n.quoteCommentsPlaceholder,rows:3,value:o,onInput:m=>{v(m.target.value)},disabled:f})}),[e==null?void 0:e.QuoteComments,n,a,o,f]),L=F(async()=>{if(q){q({quoteData:a,comment:o.trim()||void 0});return}Q(!0);try{await B({quoteUid:a.uid,comment:o.trim()||void 0})}catch(m){console.error("Failed to send quote for review:",m),Q(!1)}},[a,q,o]),J=b(()=>t(h,{name:"Footer",slot:e==null?void 0:e.Footer,context:{quoteData:a,comment:o,isSubmitting:f},children:t(P,{variant:"primary",onClick:L,"data-testid":"send-for-review-button",disabled:!(a!=null&&a.canSendForReview)||f,children:n.sendForReview})}),[e==null?void 0:e.Footer,n,a,o,f,L]),K={...u,loading:p,quoteName:z,quoteStatus:E,banner:$||void 0,details:G,actionBar:U,quoteContent:j,shippingInformationTitle:V,shippingInformation:X,quoteCommentsTitle:C,quoteComments:H,footer:J};return t(ee,{...K})};export{ve as ManageNegotiableQuote,ve as default};
4
+ //# sourceMappingURL=ManageNegotiableQuote.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ManageNegotiableQuote.js","sources":["/@dropins/storefront-quote-management/src/components/ActionsBar/ActionsBar.tsx","/@dropins/storefront-quote-management/src/components/ManageNegotiableQuote/ManageNegotiableQuote.tsx","/@dropins/storefront-quote-management/src/components/ShippingAddressDisplay/ShippingAddressDisplay.tsx","/@dropins/storefront-quote-management/src/containers/ManageNegotiableQuote/ManageNegotiableQuote.tsx"],"sourcesContent":["/********************************************************************\n * Copyright 2025 Adobe\n * All Rights Reserved.\n *\n * NOTICE: Adobe permits you to use, modify, and distribute this \n * file in accordance with the terms of the Adobe license agreement \n * accompanying it. \n *******************************************************************/\n\nimport { FunctionComponent, VNode } from 'preact';\nimport { HTMLAttributes } from 'preact/compat';\nimport { classes, VComponent } from '@adobe-commerce/elsie/lib';\nimport '@/quote-management/components/ActionsBar/ActionsBar.css';\nimport { Picker } from '@adobe-commerce/elsie/components';\n\nexport interface ActionsBarProps extends HTMLAttributes<HTMLDivElement> {\n dropdownPlaceholder?: string;\n dropdownOptions?: {\n label: string;\n value: string;\n }[];\n handleDropdownChange?: (event: Event) => void;\n buttons?: VNode[];\n}\n\nexport const ActionsBar: FunctionComponent<ActionsBarProps> = ({\n className,\n dropdownPlaceholder,\n dropdownOptions,\n handleDropdownChange,\n buttons,\n ...props\n}) => {\n const hasDropdown = dropdownOptions && dropdownOptions.length > 0;\n const hasButtons = buttons && buttons.length > 0;\n\n const pickerOptions = dropdownOptions?.map((option) => ({\n text: option.label,\n value: option.value,\n })) || [];\n pickerOptions.unshift({\n text: dropdownPlaceholder || '',\n value: '',\n });\n\n return (\n <div className=\"quote-management-actions-bar__container\" data-testid=\"actions-bar-container\">\n <div className={classes(['quote-management-actions-bar', className])} data-testid=\"actions-bar\" {...props}>\n {hasDropdown && (\n <Picker\n name=\"dropdown\"\n id=\"dropdown\"\n onInput={handleDropdownChange}\n className=\"quote-management-actions-bar__dropdown\"\n data-testid=\"dropdown\"\n options={pickerOptions}\n />\n )}\n {hasButtons && (\n <div className=\"quote-management-actions-bar__buttons\" data-testid=\"buttons-container\">\n {buttons?.map((button, index) => (\n <VComponent\n node={button}\n className={classes(['quote-management-actions-bar__button'])}\n key={index}\n />\n ))}\n </div>\n )}\n </div>\n </div>\n );\n};\n","/********************************************************************\n * Copyright 2025 Adobe\n * All Rights Reserved.\n *\n * NOTICE: Adobe permits you to use, modify, and distribute this \n * file in accordance with the terms of the Adobe license agreement \n * accompanying it. \n *******************************************************************/\n\nimport { FunctionComponent, VNode } from 'preact';\nimport { HTMLAttributes } from 'preact/compat';\nimport { classes, VComponent } from '@adobe-commerce/elsie/lib';\nimport '@/quote-management/components/ManageNegotiableQuote/ManageNegotiableQuote.css';\nimport { Skeleton, SkeletonRow } from '@adobe-commerce/elsie/components';\n\nexport interface ManageNegotiableQuoteProps extends Omit<HTMLAttributes<HTMLDivElement>, 'loading'> {\n loading?: boolean;\n quoteName: VNode;\n quoteStatus: VNode;\n banner?: VNode;\n details: VNode;\n actionBar?: VNode;\n quoteContent: VNode;\n shippingInformationTitle: VNode;\n shippingInformation: VNode;\n quoteCommentsTitle: VNode;\n quoteComments: VNode;\n footer: VNode;\n}\n\nexport const ManageNegotiableQuote: FunctionComponent<ManageNegotiableQuoteProps> = ({\n className,\n loading,\n quoteName,\n quoteStatus,\n banner,\n details,\n actionBar,\n quoteContent,\n shippingInformationTitle,\n shippingInformation,\n quoteCommentsTitle,\n quoteComments,\n footer,\n ...props\n}) => {\n if (loading) {\n return <ManageNegotiableQuoteSkeleton />;\n }\n\n return (\n <div {...props} className={classes(['quote-management-manage-negotiable-quote', className])}>\n <div className={classes(['quote-management-manage-negotiable-quote__header'])}>\n {quoteName &&\n <VComponent\n node={quoteName}\n className={classes(['quote-management-manage-negotiable-quote__quote-name'])}\n />\n }\n {quoteStatus &&\n <VComponent\n node={quoteStatus}\n className={classes(['quote-management-manage-negotiable-quote__quote-status'])}\n />\n }\n </div>\n {banner &&\n <VComponent\n node={banner}\n className={classes(['quote-management-manage-negotiable-quote__banner'])}\n />\n }\n {details &&\n <VComponent\n node={details}\n className={classes(['quote-management-manage-negotiable-quote__details'])}\n />\n }\n {actionBar &&\n <VComponent\n node={actionBar}\n className={classes(['quote-management-manage-negotiable-quote__action-bar'])}\n />\n }\n {quoteContent &&\n <VComponent\n node={quoteContent}\n className={classes(['quote-management-manage-negotiable-quote__quote-content'])}\n />\n }\n <div data-testid=\"quote-shipping-information-container\" className={classes(['quote-management-manage-negotiable-quote__shipping-information-container'])}>\n {shippingInformationTitle &&\n <VComponent\n node={shippingInformationTitle}\n className={classes(['quote-management-manage-negotiable-quote__shipping-information-title'])}\n />\n }\n {shippingInformation &&\n <VComponent\n node={shippingInformation}\n className={classes(['quote-management-manage-negotiable-quote__shipping-information'])}\n />\n }\n </div>\n <div data-testid=\"quote-comments-container\" className={classes(['quote-management-manage-negotiable-quote__quote-comments-container'])}>\n {quoteCommentsTitle &&\n <VComponent\n node={quoteCommentsTitle}\n className={classes(['quote-management-manage-negotiable-quote__quote-comments-title'])}\n />\n }\n {quoteComments &&\n <VComponent\n node={quoteComments}\n className={classes(['quote-management-manage-negotiable-quote__quote-comments'])}\n />\n }\n </div>\n <VComponent\n node={footer}\n className={classes(['quote-management-manage-negotiable-quote__footer'])}\n />\n </div>\n );\n};\n\nexport const ManageNegotiableQuoteSkeleton: FunctionComponent = () => {\n return (\n <Skeleton data-testid=\"manage-negotiable-quote-skeleton\">\n <SkeletonRow variant=\"heading\" fullWidth={true} size=\"large\" />\n <SkeletonRow variant=\"row\" fullWidth={false} size=\"small\" />\n <SkeletonRow variant=\"row\" fullWidth={false} size=\"small\" />\n <SkeletonRow variant=\"row\" fullWidth={true} />\n <SkeletonRow variant=\"row\" fullWidth={true} size=\"xlarge\" lines={2} />\n <SkeletonRow variant=\"row\" fullWidth={false} size=\"small\" />\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 { FunctionComponent } from 'preact';\nimport { HTMLAttributes } from 'preact/compat';\nimport { classes } from '@adobe-commerce/elsie/lib';\nimport { useText } from '@adobe-commerce/elsie/i18n';\nimport { Skeleton, SkeletonRow } from '@adobe-commerce/elsie/components';\nimport { ShippingAddress } from '@/quote-management/data/models/negotiable-quote-model';\nimport '@/quote-management/components/ShippingAddressDisplay/ShippingAddressDisplay.css';\n\nexport interface ShippingAddressDisplayProps extends Omit<HTMLAttributes<HTMLDivElement>, 'loading'> {\n shippingAddress?: ShippingAddress;\n loading?: boolean;\n noAddressMessage?: string;\n}\n\nexport const ShippingAddressDisplay: FunctionComponent<ShippingAddressDisplayProps> = ({\n className,\n shippingAddress,\n loading,\n noAddressMessage,\n ...props\n}) => {\n const dictionary = useText({\n noAddress: 'NegotiableQuote.Manage.shippingAddress.noAddress',\n });\n\n if (loading) {\n return <ShippingAddressDisplaySkeleton />;\n }\n\n if (!shippingAddress) {\n return (\n <div \n className={classes(['quote-management-shipping-address-display', 'quote-management-shipping-address-display--empty', className])}\n data-testid=\"shipping-address-display-empty\"\n {...props}\n >\n <p className=\"quote-management-shipping-address-display__no-address\">\n {noAddressMessage || dictionary.noAddress}\n </p>\n </div>\n );\n }\n\n return (\n <div \n className={classes(['quote-management-shipping-address-display', className])}\n data-testid=\"shipping-address-display\"\n {...props}\n >\n <div className=\"quote-management-shipping-address-display__field\" data-testid=\"address-name\">\n <span className=\"quote-management-shipping-address-display__name\">\n {shippingAddress.firstname} {shippingAddress.lastname}\n </span>\n </div>\n \n {shippingAddress.company && (\n <div className=\"quote-management-shipping-address-display__field\" data-testid=\"address-company\">\n {shippingAddress.company}\n </div>\n )}\n \n {shippingAddress.street.map((line, index) => (\n <div \n key={index} \n className=\"quote-management-shipping-address-display__field\" \n data-testid={`address-street-${index}`}\n >\n {line}\n </div>\n ))}\n \n <div className=\"quote-management-shipping-address-display__field\" data-testid=\"address-city-region\">\n {shippingAddress.city}\n {shippingAddress.region && `, ${shippingAddress.region.label}`}\n {' '}\n {shippingAddress.postcode}\n </div>\n \n <div className=\"quote-management-shipping-address-display__field\" data-testid=\"address-country\">\n {shippingAddress.country.label}\n </div>\n \n <div className=\"quote-management-shipping-address-display__field\" data-testid=\"address-telephone\">\n {shippingAddress.telephone}\n </div>\n </div>\n );\n};\n\nexport const ShippingAddressDisplaySkeleton: FunctionComponent = () => {\n return (\n <Skeleton data-testid=\"shipping-address-display-skeleton\">\n <SkeletonRow variant=\"row\" fullWidth={true} size=\"small\" lines={5} multilineGap='xsmall' />\n </Skeleton>\n );\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, useMemo, useState } from 'preact/compat';\nimport { Container, getGlobalLocale, Slot, SlotProps } from '@adobe-commerce/elsie/lib';\nimport { NegotiableQuoteModel } from '@/quote-management/data/models/negotiable-quote-model';\nimport { ManageNegotiableQuote as ManageNegotiableQuoteComponent, ManageNegotiableQuoteProps as ManageNegotiableQuoteComponentProps } from '@/quote-management/components/ManageNegotiableQuote';\nimport { events } from '@adobe-commerce/event-bus';\nimport { useText } from '@adobe-commerce/elsie/i18n';\nimport { ActionsBar, ShippingAddressDisplay } from '@/quote-management/components';\nimport { Button, InLineAlert, TextArea } from '@adobe-commerce/elsie/components';\nimport { WarningFilled } from '@adobe-commerce/elsie/icons';\nimport { sendForReview } from '@/quote-management/api';\n\nexport interface ManageNegotiableQuoteProps extends HTMLAttributes<HTMLDivElement> {\n onActionsDropdownChange?: (event: Event) => void;\n onActionsButtonClick?: (action: string) => void;\n onSendForReview?: (params:\n {\n quoteData: NegotiableQuoteModel,\n comment?: string,\n }) => void;\n slots?: {\n QuoteName?: SlotProps<{\n quoteName?: string;\n quoteData?: NegotiableQuoteModel;\n }>;\n QuoteStatus?: SlotProps<{\n quoteStatus?: string;\n quoteData?: NegotiableQuoteModel;\n }>;\n Banner?: SlotProps<{\n quoteData?: NegotiableQuoteModel;\n }>;\n Details?: SlotProps<{\n quoteData?: NegotiableQuoteModel;\n }>;\n ActionBar?: SlotProps<{\n quoteData?: NegotiableQuoteModel;\n }>;\n QuoteContent?: SlotProps<{\n quoteData?: NegotiableQuoteModel;\n }>;\n ShippingInformationTitle?: SlotProps<{\n quoteData?: NegotiableQuoteModel;\n }>;\n ShippingInformation?: SlotProps<{\n quoteData?: NegotiableQuoteModel;\n }>;\n QuoteCommentsTitle?: SlotProps<{\n quoteData?: NegotiableQuoteModel;\n }>;\n QuoteComments?: SlotProps<{\n quoteData?: NegotiableQuoteModel;\n }>;\n Footer?: SlotProps<{\n quoteData?: NegotiableQuoteModel;\n comment?: string;\n isSubmitting?: boolean;\n }>;\n }\n}\n\nexport const ManageNegotiableQuote: Container<ManageNegotiableQuoteProps> = ({\n onActionsDropdownChange,\n slots,\n onActionsButtonClick,\n onSendForReview,\n ...props\n}) => {\n\n const [quoteData, setQuoteData] = useState<NegotiableQuoteModel | undefined>(undefined)\n const [loading, setLoading] = useState<boolean>(true)\n const [comment, setComment] = useState<string>('')\n const [isSubmitting, setIsSubmitting] = useState<boolean>(false)\n\n const dictionary = useText({\n createdLabel: 'NegotiableQuote.Manage.createdLabel',\n salesRepLabel: 'NegotiableQuote.Manage.salesRepLabel',\n expiresLabel: 'NegotiableQuote.Manage.expiresLabel',\n actionsLabel: 'NegotiableQuote.Manage.actionsLabel',\n remove: 'NegotiableQuote.Manage.actions.remove',\n close: 'NegotiableQuote.Manage.actionButtons.close',\n delete: 'NegotiableQuote.Manage.actionButtons.delete',\n print: 'NegotiableQuote.Manage.actionButtons.print',\n createTemplate: 'NegotiableQuote.Manage.actionButtons.createTemplate',\n createCopy: 'NegotiableQuote.Manage.actionButtons.createCopy',\n shippingInformationTitle: 'NegotiableQuote.Manage.shippingInformation.title',\n quoteCommentsTitle: 'NegotiableQuote.Manage.quoteComments.title',\n quoteCommentsPlaceholder: 'NegotiableQuote.Manage.quoteComments.placeholder',\n sendForReview: 'NegotiableQuote.Manage.actionButtons.sendForReview',\n bannerTitle: 'NegotiableQuote.Manage.bannerTitle',\n statusSubmitted: 'NegotiableQuote.Manage.bannerStatusMessages.submitted',\n statusPending: 'NegotiableQuote.Manage.bannerStatusMessages.pending',\n statusExpired: 'NegotiableQuote.Manage.bannerStatusMessages.expired',\n });\n /* Event listeners */\n useEffect(() => {\n const quoteDataEvent = events.on('quote-management/quote-data', (data: { quote: NegotiableQuoteModel }) => {\n const { quote } = data;\n if (quote) {\n setQuoteData(quote);\n setLoading(false);\n }\n }, {\n eager: true,\n });\n return () => quoteDataEvent?.off();\n }, []);\n\n // Listen for shipping address set event\n useEffect(() => {\n const shippingAddressSetEvent = events.on('quote-management/shipping-address-set', (data: { quote: NegotiableQuoteModel }) => {\n const { quote } = data;\n if (quote) {\n setQuoteData(quote);\n }\n }, {\n eager: true,\n });\n return () => shippingAddressSetEvent?.off();\n }, []);\n\n // Listen for quote sent for review event\n useEffect(() => {\n const quoteSentForReviewEvent = events.on('quote-management/quote-sent-for-review', (data: { quote: NegotiableQuoteModel }) => {\n const { quote } = data;\n setQuoteData(quote);\n setComment(''); // Reset comment after successful submission\n setIsSubmitting(false);\n }, {\n eager: true,\n });\n return () => quoteSentForReviewEvent?.off();\n }, []);\n\n /**\n * VNodes for the ManageNegotiableQuote component\n */\n\n // Quote name\n const quoteName = useMemo(() => {\n return <Slot name=\"QuoteName\" slot={slots?.QuoteName} context={{ quoteName: quoteData?.name, quoteData }}>\n <h1 data-testid=\"quote-name\">{quoteData?.name}</h1>\n </Slot>;\n }, [slots?.QuoteName, quoteData]);\n\n // Quote status\n const quoteStatus = useMemo(() => {\n return <Slot name=\"QuoteStatus\" slot={slots?.QuoteStatus} context={{ quoteStatus: quoteData?.status, quoteData }}>\n <div data-testid=\"quote-status\">{quoteData?.status}</div>\n </Slot>;\n }, [slots?.QuoteStatus, quoteData]);\n\n // Banner\n const getBannerStatusMessage = useCallback((status: string | undefined) => {\n switch (status) {\n case 'SUBMITTED':\n return dictionary.statusSubmitted;\n case 'PENDING':\n return dictionary.statusPending;\n case 'EXPIRED':\n return dictionary.statusExpired;\n default:\n return null;\n }\n }, [dictionary]);\n\n const bannerMessage = getBannerStatusMessage(quoteData?.status);\n\n const bannerContent = bannerMessage &&\n <InLineAlert\n type=\"warning\"\n variant=\"secondary\"\n icon={<WarningFilled />}\n heading={dictionary.bannerTitle}\n description={bannerMessage} />;\n\n const banner = bannerContent && <Slot name=\"Banner\" data-testid=\"banner\" slot={slots?.Banner} context={{ quoteData }}>\n {bannerContent}\n </Slot>;\n\n // Details\n const details = useMemo(() => {\n\n if (!quoteData) {\n return null;\n }\n\n const calculatedLocale = getGlobalLocale() || 'en-US';\n\n const dateFormatter = new Intl.DateTimeFormat(calculatedLocale, {\n year: 'numeric',\n month: 'long',\n day: 'numeric',\n });\n\n // Some quotes, such as draft quotes, don't have a date formatted expiration date\n let expirationDate;\n try {\n expirationDate = dateFormatter.format(new Date(quoteData!.expirationDate));\n } catch (error) {\n expirationDate = quoteData!.expirationDate;\n }\n\n return <Slot name=\"Details\" slot={slots?.Details} context={{ quoteData }}>\n <div className=\"quote-management-manage-negotiable-quote__detail\">\n <span className=\"quote-management-manage-negotiable-quote__detail-title\" data-testid=\"created-label\">\n {dictionary.createdLabel}\n </span>\n <span className=\"quote-management-manage-negotiable-quote__detail-content\" data-testid=\"created-value\">\n {dateFormatter.format(new Date(quoteData!.createdAt))} ({quoteData!.buyer.firstname} {quoteData!.buyer.lastname})\n </span>\n </div>\n <div className=\"quote-management-manage-negotiable-quote__detail\">\n <span className=\"quote-management-manage-negotiable-quote__detail-title\" data-testid=\"sales-rep-label\">\n {dictionary.salesRepLabel}\n </span>\n <span className=\"quote-management-manage-negotiable-quote__detail-content\" data-testid=\"sales-rep-value\">\n {quoteData!.salesRepName}\n </span>\n </div>\n <div className=\"quote-management-manage-negotiable-quote__detail\">\n <span className=\"quote-management-manage-negotiable-quote__detail-title\" data-testid=\"expires-label\">\n {dictionary.expiresLabel}\n </span>\n <span className=\"quote-management-manage-negotiable-quote__detail-content\" data-testid=\"expires-value\">\n {expirationDate}\n </span>\n </div>\n </Slot>;\n }, [slots?.Details, dictionary, quoteData]);\n\n // Action bar\n const buttons: { label: string; value: string; disabled?: boolean }[] = useMemo(() => [\n {\n label: dictionary.close,\n value: 'close'\n },\n {\n label: dictionary.delete,\n value: 'delete'\n },\n {\n label: dictionary.print,\n value: 'print'\n },\n {\n label: dictionary.createTemplate,\n value: 'createTemplate'\n },\n {\n label: dictionary.createCopy,\n value: 'createCopy'\n },\n ], [dictionary]);\n const actionBar = useMemo(() => {\n const handleActionsDropdownChange = (event: Event) => {\n onActionsDropdownChange?.(event);\n };\n\n const handleActionsButtonClick = (action: string) => {\n switch (action) {\n case 'close':\n onActionsButtonClick?.(action);\n break;\n case 'delete':\n onActionsButtonClick?.(action);\n break;\n case 'print':\n onActionsButtonClick?.(action);\n break;\n case 'createTemplate':\n onActionsButtonClick?.(action);\n break;\n case 'createCopy':\n onActionsButtonClick?.(action);\n break;\n }\n }\n return <Slot name=\"ActionBar\" slot={slots?.ActionBar} context={{ quoteData }}>\n <ActionsBar\n dropdownPlaceholder={dictionary.actionsLabel}\n dropdownOptions={[\n {\n label: dictionary.remove,\n value: 'remove'\n },\n ]}\n handleDropdownChange={handleActionsDropdownChange}\n buttons={\n buttons.map((button) => (\n <Button\n key={button.value}\n variant=\"tertiary\"\n onClick={() => handleActionsButtonClick(button.value)}\n data-testid={`actions-bar-${button.value}-button`}\n data-action={button.value}\n disabled={button.disabled}\n >\n {button.label}\n </Button>\n ))\n }\n />\n </Slot>;\n }, [buttons, dictionary, slots?.ActionBar, quoteData, onActionsDropdownChange, onActionsButtonClick]);\n\n // Quote content\n const quoteContent = useMemo(() => {\n return <Slot name=\"QuoteContent\" slot={slots?.QuoteContent} context={{ quoteData }} />\n }, [slots?.QuoteContent, quoteData]);\n\n // Shipping information title\n const shippingInformationTitle = useMemo(() => {\n return <Slot name=\"ShippingInformationTitle\" slot={slots?.ShippingInformationTitle} context={{ quoteData }}>\n <h2>{dictionary.shippingInformationTitle}</h2>\n </Slot>;\n }, [slots?.ShippingInformationTitle, quoteData, dictionary]);\n\n // Shipping information\n const shippingInformation = useMemo(() => {\n const primaryShippingAddress = quoteData?.shippingAddresses?.[0];\n\n return (\n <Slot name=\"ShippingInformation\" slot={slots?.ShippingInformation} context={{ quoteData }}>\n <ShippingAddressDisplay\n shippingAddress={primaryShippingAddress}\n loading={loading}\n data-testid=\"manage-quote-shipping-address\"\n />\n </Slot>\n );\n }, [slots?.ShippingInformation, quoteData, loading]);\n\n // Quote comments title\n const quoteCommentsTitle = useMemo(() => {\n return <Slot name=\"QuoteCommentsTitle\" slot={slots?.QuoteCommentsTitle} context={{ quoteData }}>\n <h2>{dictionary.quoteCommentsTitle}</h2>\n </Slot>;\n }, [slots?.QuoteCommentsTitle, dictionary, quoteData]);\n\n // Quote comments\n const quoteComments = useMemo(() => {\n return <Slot name=\"QuoteComments\" slot={slots?.QuoteComments} context={{ quoteData }}>\n <TextArea\n name=\"quoteComments\"\n placeholder={dictionary.quoteCommentsPlaceholder}\n rows={3}\n value={comment}\n onInput={(e) => {\n setComment((e.target as HTMLTextAreaElement).value);\n }}\n disabled={isSubmitting}\n />\n </Slot>;\n }, [slots?.QuoteComments, dictionary, quoteData, comment, isSubmitting]);\n\n // Footer\n const handleSendForReview = useCallback(async () => {\n // If override prop is provided, use it instead of the API\n if (onSendForReview) {\n onSendForReview({ quoteData: quoteData!, comment: comment.trim() || undefined });\n return;\n }\n\n // Otherwise, use the sendForReview API\n setIsSubmitting(true);\n try {\n await sendForReview({\n quoteUid: quoteData!.uid,\n comment: comment.trim() || undefined,\n });\n // The quote-sent-for-review event will handle updating state\n } catch (error) {\n console.error('Failed to send quote for review:', error);\n setIsSubmitting(false);\n // TODO: Show error notification to user\n }\n }, [quoteData, onSendForReview, comment]);\n\n const footer = useMemo(() => {\n return <Slot name=\"Footer\" slot={slots?.Footer} context={{ quoteData, comment, isSubmitting }}>\n <Button variant=\"primary\"\n onClick={handleSendForReview}\n data-testid=\"send-for-review-button\"\n disabled={!quoteData?.canSendForReview || isSubmitting}\n >{dictionary.sendForReview}</Button>\n </Slot>;\n }, [slots?.Footer, dictionary, quoteData, comment, isSubmitting, handleSendForReview]);\n\n const manageNegotiableQuoteProps: ManageNegotiableQuoteComponentProps = {\n ...props,\n loading,\n quoteName,\n quoteStatus,\n banner: banner || undefined,\n details: details!, // Details will always be defined at this point\n actionBar,\n quoteContent,\n shippingInformationTitle,\n shippingInformation,\n quoteCommentsTitle,\n quoteComments,\n footer\n };\n\n return (\n <ManageNegotiableQuoteComponent\n {...manageNegotiableQuoteProps}\n />\n );\n};"],"names":["ActionsBar","className","dropdownPlaceholder","dropdownOptions","handleDropdownChange","buttons","props","hasDropdown","hasButtons","pickerOptions","option","classes","jsx","Picker","button","index","VComponent","ManageNegotiableQuote","loading","quoteName","quoteStatus","banner","details","actionBar","quoteContent","shippingInformationTitle","shippingInformation","quoteCommentsTitle","quoteComments","footer","ManageNegotiableQuoteSkeleton","jsxs","Skeleton","SkeletonRow","ShippingAddressDisplay","shippingAddress","noAddressMessage","dictionary","useText","ShippingAddressDisplaySkeleton","line","onActionsDropdownChange","slots","onActionsButtonClick","onSendForReview","quoteData","setQuoteData","useState","setLoading","comment","setComment","isSubmitting","setIsSubmitting","useEffect","quoteDataEvent","events","data","quote","shippingAddressSetEvent","quoteSentForReviewEvent","useMemo","Slot","bannerMessage","useCallback","status","bannerContent","InLineAlert","WarningFilled","calculatedLocale","getGlobalLocale","dateFormatter","expirationDate","handleActionsDropdownChange","event","handleActionsButtonClick","action","Button","primaryShippingAddress","_a","TextArea","e","handleSendForReview","sendForReview","error","manageNegotiableQuoteProps","ManageNegotiableQuoteComponent"],"mappings":"s2BAyBO,MAAMA,EAAiD,CAAC,CAC7D,UAAAC,EACA,oBAAAC,EACA,gBAAAC,EACA,qBAAAC,EACA,QA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Ac8B,CAAmB,CAAC,EAE/EG,EAAkE,CACtE,GAAG9E,EACH,QAAAY,EACA,UAAAC,EACA,YAAAC,EACA,OAAQC,GAAU,OAClB,QAAAC,EACA,UAAAC,EACA,aAAAC,EACA,yBAAAC,EACA,oBAAAC,EACA,mBAAAC,EACA,cAAAC,EACA,OAAAC,CAAA,EAGF,OACEjB,EAACyE,GAAA,CACE,GAAGD,CAAA,CAAA,CAGV"}
@@ -1,6 +1,6 @@
1
1
  import { HTMLAttributes } from 'preact/compat';
2
2
  import { Container, SlotProps } from '@dropins/tools/types/elsie/src/lib';
3
- import { NegotiableQuoteModel } from '../../data/models';
3
+ import { NegotiableQuoteListEntry } from '../../data/models';
4
4
 
5
5
  export interface QuotesListTableProps extends HTMLAttributes<HTMLDivElement> {
6
6
  pageSize?: number;
@@ -13,35 +13,35 @@ export interface QuotesListTableProps extends HTMLAttributes<HTMLDivElement> {
13
13
  slots?: {
14
14
  /** Slot for customizing the quote name cell content */
15
15
  QuoteName?: SlotProps<{
16
- quote: NegotiableQuoteModel;
16
+ quote: NegotiableQuoteListEntry;
17
17
  }>;
18
18
  /** Slot for customizing the created date cell content */
19
19
  Created?: SlotProps<{
20
- quote: NegotiableQuoteModel;
20
+ quote: NegotiableQuoteListEntry;
21
21
  }>;
22
22
  /** Slot for customizing the created by cell content */
23
23
  CreatedBy?: SlotProps<{
24
- quote: NegotiableQuoteModel;
24
+ quote: NegotiableQuoteListEntry;
25
25
  }>;
26
26
  /** Slot for customizing the status cell content */
27
27
  Status?: SlotProps<{
28
- quote: NegotiableQuoteModel;
28
+ quote: NegotiableQuoteListEntry;
29
29
  }>;
30
30
  /** Slot for customizing the last updated cell content */
31
31
  LastUpdated?: SlotProps<{
32
- quote: NegotiableQuoteModel;
32
+ quote: NegotiableQuoteListEntry;
33
33
  }>;
34
34
  /** Slot for customizing the quote template cell content */
35
35
  QuoteTemplate?: SlotProps<{
36
- quote: NegotiableQuoteModel;
36
+ quote: NegotiableQuoteListEntry;
37
37
  }>;
38
38
  /** Slot for customizing the quote total cell content */
39
39
  QuoteTotal?: SlotProps<{
40
- quote: NegotiableQuoteModel;
40
+ quote: NegotiableQuoteListEntry;
41
41
  }>;
42
42
  /** Slot for customizing the actions cell content */
43
43
  Actions?: SlotProps<{
44
- quote: NegotiableQuoteModel;
44
+ quote: NegotiableQuoteListEntry;
45
45
  onViewQuote?: (id: string, name: string, status: string) => void;
46
46
  }>;
47
47
  /** Slot for customizing the empty quotes message */
@@ -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 */import{useText as Z}from"@dropins/tools/i18n.js";import{g as V}from"../chunks/transform-quote.js";import"@dropins/tools/fetch-graphql.js";import{n as q}from"../chunks/negotiableQuotes.js";const ee=({rowData:h=[],loading:S=!1,className:N,emptyStateMessage:y,showItemRange:v=!0,itemRangeMessage:m,showPageSizePicker:u=!0,pageSizePickerMessage:i,showPagination:x=!0,paginationMessage:l,...b})=>{const d=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:d.quoteName},{key:"created",label:d.created},{key:"createdBy",label:d.createdBy},{key:"status",label:d.status},{key:"lastUpdated",label:d.lastUpdated},{key:"quoteTemplate",label:d.quoteTemplate},{key:"quoteTotal",label:d.quoteTotal},{key:"actions",label:d.actions}],z=!S&&h.length===0&&y,p=v&&m,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&&m}),t("div",{className:"quotes-list-table__pagination",children:g&&l}),t("div",{className:"quotes-list-table__page-size-picker",children:f&&i})]})]})},ue=({pageSize:h,showItemRange:S=!0,showPageSizePicker:N=!0,showPagination:y=!0,onViewQuote:v,onPageSizeChange:m,onPageChange:u,slots:i,...x})=>{const[l,b]=Q(null),[d,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),m==null||m(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:d,className:x.className,emptyStateMessage:O,showItemRange:S&&L,itemRangeMessage:R,showPageSizePicker:N&&L,pageSizePickerMessage:D,showPagination:y&&L,paginationMessage:E})};export{ue as QuotesListTable,ue as default};
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 */import{g as V}from"../chunks/transform-quote.js";import"@dropins/tools/fetch-graphql.js";import{n as q}from"../chunks/negotiableQuotes.js";const ee=({rowData:h=[],loading:S=!1,className:N,emptyStateMessage:y,showItemRange:v=!0,itemRangeMessage:m,showPageSizePicker:u=!0,pageSizePickerMessage:i,showPagination:x=!0,paginationMessage:l,...b})=>{const d=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:d.quoteName},{key:"created",label:d.created},{key:"createdBy",label:d.createdBy},{key:"status",label:d.status},{key:"lastUpdated",label:d.lastUpdated},{key:"quoteTemplate",label:d.quoteTemplate},{key:"quoteTotal",label:d.quoteTotal},{key:"actions",label:d.actions}],z=!S&&h.length===0&&y,p=v&&m,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&&m}),t("div",{className:"quotes-list-table__pagination",children:g&&l}),t("div",{className:"quotes-list-table__page-size-picker",children:f&&i})]})]})},ge=({pageSize:h,showItemRange:S=!0,showPageSizePicker:N=!0,showPagination:y=!0,onViewQuote:v,onPageSizeChange:m,onPageChange:u,slots:i,...x})=>{const[l,b]=Q(null),[d,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),m==null||m(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:d,className:x.className,emptyStateMessage:O,showItemRange:S&&L,itemRangeMessage:R,showPageSizePicker:N&&L,pageSizePickerMessage:D,showPagination:y&&L,paginationMessage:E})};export{ge as QuotesListTable,ge 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 NegotiableQuoteModel,\n NegotiableQuotesListModel,\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: NegotiableQuoteModel }>;\n /** Slot for customizing the created date cell content */\n Created?: SlotProps<{ quote: NegotiableQuoteModel }>;\n /** Slot for customizing the created by cell content */\n CreatedBy?: SlotProps<{ quote: NegotiableQuoteModel }>;\n /** Slot for customizing the status cell content */\n Status?: SlotProps<{ quote: NegotiableQuoteModel }>;\n /** Slot for customizing the last updated cell content */\n LastUpdated?: SlotProps<{ quote: NegotiableQuoteModel }>;\n /** Slot for customizing the quote template cell content */\n QuoteTemplate?: SlotProps<{ quote: NegotiableQuoteModel }>;\n /** Slot for customizing the quote total cell content */\n QuoteTotal?: SlotProps<{ quote: NegotiableQuoteModel }>;\n /** Slot for customizing the actions cell content */\n Actions?: SlotProps<{\n quote: NegotiableQuoteModel;\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: NegotiableQuoteModel[],\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":"0mBAgDO,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,MAAOA,EAAW,MAAA,EACnC,CAAE,IAAK,cAAe,MAAOA,EAAW,WAAA,EACxC,CAAE,IAAK,gBAAiB,MAAOA,EAAW,aAAA,EAC1C,CAAE,IAAK,aAAc,MAAOA,EAAW,UAAA,EACvC,CAAE,IAAK,UAAW,MAAOA,EAAW,OAAA,CA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AAe,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 // 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":"stBAgDO,MAAMA,GAA2D,CAAC,CACvE,QAAAC,EAAU,CAAA,EACV,QAAAC,EAAU,GACV,UAAAC,EACA,kBAAAC,EACA,cAAAC,EAAgB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,EACF,EACE,OAGE1D,EACJ0D,GAAkBA,EAAe,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 P,jsx as t}from"@dropins/tools/preact-jsx-runtime.js";import*as s from"@dropins/tools/preact-compat.js";import{useState as q,useEffect as R,useCallback as re}from"@dropins/tools/preact-compat.js";import{classes as u,VComponent as h,Slot as N,getFormErrors as j,getFormValues as ae}from"@dropins/tools/lib.js";import{TextArea as oe,Field as ne,Input as ie,InputFile as se,Button as z,InLineAlert as ce}from"@dropins/tools/components.js";/* empty css */import{events as I}from"@dropins/tools/event-bus.js";import"../chunks/transform-quote.js";import{r as w}from"../chunks/requestNegotiableQuote.js";import"@dropins/tools/fetch-graphql.js";import{useText as ue}from"@dropins/tools/i18n.js";const me=i=>s.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},s.createElement("g",{id:"Large"},s.createElement("rect",{id:"Placement_area","data-name":"Placement area",width:24,height:24,fill:"#fff",opacity:0}),s.createElement("g",{id:"Add_icon","data-name":"Add icon",transform:"translate(9.734 9.737)"},s.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"}),s.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"})))),de=i=>s.createElement("svg",{width:24,height:24,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",...i},s.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"}),s.createElement("path",{vectorEffect:"non-scaling-stroke",d:"M6.75 12.762L10.2385 15.75L17.25 9",stroke:"currentColor"})),le=i=>s.createElement("svg",{width:24,height:24,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",...i},s.createElement("path",{vectorEffect:"non-scaling-stroke",fillRule:"evenodd",clipRule:"evenodd",d:"M1 20.8953L12.1922 1.5L23.395 20.8953H1ZM13.0278 13.9638L13.25 10.0377V9H11.25V10.0377L11.4722 13.9638H13.0278ZM11.2994 16V17.7509H13.2253V16H11.2994Z",fill:"currentColor"})),fe=({className:i,title:e,banner:C,commentField:_,quoteNameField:l,attachFile:c,requestButton:f,saveButton:x,onSubmit:F,...E})=>P("form",{...E,className:u(["request-negotiable-quote-form",i]),onSubmit:F,children:[C&&t(h,{node:C,className:u(["request-negotiable-quote-form__banner"])}),e&&t(h,{node:e,className:u(["request-negotiable-quote-form__title"])}),_&&t(h,{node:_,className:u(["request-negotiable-quote-form__comment-field"])}),l&&t(h,{node:l,className:u(["request-negotiable-quote-form__quote-name-field"])}),c&&t(h,{node:c,className:u(["request-negotiable-quote-form__attach-file-field"])}),P("div",{className:u(["request-negotiable-quote-form__actions"]),children:[f&&t(h,{node:f,className:u(["request-negotiable-quote-form__request-button"])}),x&&t(h,{node:x,className:u(["request-negotiable-quote-form__save-button"])})]})]}),Fe=({cartId:i,slots:e,onRequestNegotiableQuote:C,onSaveNegotiableQuote:_,onAttachFiles:l,onSubmitErrors:c,onError:f,className:x})=>{const[F,E]=q(void 0),[H,Z]=q(void 0),[,T]=q([]),[b,v]=q(void 0),[m,p]=q({}),[B,O]=q(void 0),[n,g]=q(!1),o=ue({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"});R(()=>{const r=I.on("quote-management/permissions",a=>{v(void 0),a.requestQuote||(v(o.unauthorized),g(!0))},{eager:!0});return()=>r==null?void 0:r.off()},[o.unauthorized]),R(()=>{const r=I.on("authenticated",a=>{v(void 0),a||(v(o.unauthenticated),g(!0))},{eager:!0});return()=>r==null?void 0:r.off()},[o.unauthenticated]),R(()=>{i||(v(o.missingCart),g(!0))},[i,o.missingCart]),R(()=>{b&&(f==null||f({error:b,isFormDisabled:n,setIsFormDisabled:g}))},[b,f,n]);const D=re(async r=>{var a;p(d=>({...d,attachments:""})),T(r),(a=l==null?void 0:l(r))==null||a.catch(()=>{p(d=>({...d,attachments:o.attachmentsError}))})},[l,o]),W=()=>{let r,a;if(B?(a={name:"SuccessBanner",slot:e==null?void 0:e.SuccessBanner,context:{message:B},"data-testid":"form-success-banner"},r={type:"success",variant:"primary",icon:t(de,{}),heading:o.successHeader,description:B,className:"request-negotiable-quote-form__success-banner"}):b&&(a={name:"ErrorBanner",slot:e==null?void 0:e.ErrorBanner,context:{message:b},"data-testid":"form-error-banner"},r={type:"error",variant:"primary",icon:t(le,{}),heading:o.errorHeader,description:b,className:"request-negotiable-quote-form__error-banner"}),a&&r)return t(N,{...a,children:t(ce,{...r})})},M=r=>{p({});const a=r.target.closest("form"),d=j(a);Object.keys(d).length>0&&(p(d),c==null||c(d))},$=r=>{var V;r.preventDefault(),g(!0);const a=r.target,A={...j(a),...m};if(Object.keys(A).length>0){c==null||c(A);return}const k=r.submitter,Q=ae(a);E(Q.comment),Z(Q.quoteName);const S=((V=k==null?void 0:k.dataset)==null?void 0:V.draft)==="true"||!1,ee={cartId:i,quoteName:Q.quoteName,comment:Q.comment,isDraft:S};let y,L;S?(y=_??w,L=o.draftSuccess):(y=C??w,L=o.submitSuccess),y(ee).then(()=>{O(L)}).catch(te=>{v(te.message)})},G=t(N,{name:"Title",slot:e==null?void 0:e.Title,context:{text:o.title},children:t("span",{"data-testid":"form-title",children:o.title})}),J=t(N,{name:"CommentField",slot:e==null?void 0:e.CommentField,context:{value:F,required:!0,errorMessage:m.comment,setFormErrors:p,isFormDisabled:n},children:t(oe,{name:"comment",value:F,label:o.comment,required:!0,autoComplete:"off","data-testid":"form-comment-field",errorMessage:m.comment,disabled:n})}),K=t(N,{name:"QuoteNameField",slot:e==null?void 0:e.QuoteNameField,context:{value:H,required:!0,errorMessage:m.quoteName,setFormErrors:p,isFormDisabled:n},children:t(ne,{error:m.quoteName,disabled:n,children:t(ie,{value:H,name:"quoteName",floatingLabel:o.quoteName,required:!0,autoComplete:"off","data-testid":"form-quote-name-field"})})}),U=t(N,{name:"AttachFileField",slot:e==null?void 0:e.AttachFileField,context:{onChange:D,formErrors:m,isFormDisabled:n},children:t(se,{onChange:r=>{const a=Array.from(r.target.files);a.length>0&&D(a)},icon:t(me,{}),disabled:n,"data-testid":"form-attach-file-field"})}),X=t(N,{name:"RequestButton",slot:e==null?void 0:e.RequestButton,context:{requestNegotiableQuote:w,formErrors:m,isFormDisabled:n,setIsFormDisabled:g},children:t(z,{type:"submit","data-testid":"form-request-button",onClick:M,disabled:n,children:o.requestCta})}),Y=t(N,{name:"SaveDraftButton",slot:e==null?void 0:e.SaveDraftButton,context:{requestNegotiableQuote:w,formErrors:m,isFormDisabled:n,setIsFormDisabled:g},children:t(z,{type:"submit","data-draft":"true",variant:"secondary","data-testid":"form-save-draft-button",onClick:M,disabled:n,children:o.saveDraftCta})});return t(fe,{title:G,banner:W(),commentField:J,quoteNameField:K,attachFile:U,requestButton:X,saveButton:Y,onSubmit:$,className:x,disabled:n,"data-testid":"form-container"})};export{Fe as RequestNegotiableQuoteForm,Fe as default};
3
+ import{jsxs as j,jsx as t}from"@dropins/tools/preact-jsx-runtime.js";import*as m from"@dropins/tools/preact-compat.js";import{useState as q,useEffect as R,useCallback as ae}from"@dropins/tools/preact-compat.js";import{classes as c,VComponent as h,Slot as N,getFormErrors as z,getFormValues as re}from"@dropins/tools/lib.js";import{TextArea as oe,Field as ne,Input as ie,InputFile as se,Button as I,InLineAlert as ce}from"@dropins/tools/components.js";/* empty css */import{events as T}from"@dropins/tools/event-bus.js";import"../chunks/transform-quote.js";import{r as B}from"../chunks/requestNegotiableQuote.js";import"@dropins/tools/fetch-graphql.js";import{S as me}from"../chunks/WarningFilled.js";import{useText as ue}from"@dropins/tools/i18n.js";import"../chunks/NegotiableQuoteFragment.js";const de=i=>m.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},m.createElement("g",{id:"Large"},m.createElement("rect",{id:"Placement_area","data-name":"Placement area",width:24,height:24,fill:"#fff",opacity:0}),m.createElement("g",{id:"Add_icon","data-name":"Add icon",transform:"translate(9.734 9.737)"},m.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"}),m.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"})))),le=i=>m.createElement("svg",{width:24,height:24,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",...i},m.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"}),m.createElement("path",{vectorEffect:"non-scaling-stroke",d:"M6.75 12.762L10.2385 15.75L17.25 9",stroke:"currentColor"})),fe=({className:i,title:e,banner:C,commentField:_,quoteNameField:l,attachFile:s,requestButton:f,saveButton:F,onSubmit:Q,...E})=>j("form",{...E,className:c(["request-negotiable-quote-form",i]),onSubmit:Q,children:[C&&t(h,{node:C,className:c(["request-negotiable-quote-form__banner"])}),e&&t(h,{node:e,className:c(["request-negotiable-quote-form__title"])}),_&&t(h,{node:_,className:c(["request-negotiable-quote-form__comment-field"])}),l&&t(h,{node:l,className:c(["request-negotiable-quote-form__quote-name-field"])}),s&&t(h,{node:s,className:c(["request-negotiable-quote-form__attach-file-field"])}),j("div",{className:c(["request-negotiable-quote-form__actions"]),children:[f&&t(h,{node:f,className:c(["request-negotiable-quote-form__request-button"])}),F&&t(h,{node:F,className:c(["request-negotiable-quote-form__save-button"])})]})]}),Re=({cartId:i,slots:e,onRequestNegotiableQuote:C,onSaveNegotiableQuote:_,onAttachFiles:l,onSubmitErrors:s,onError:f,className:F})=>{const[Q,E]=q(void 0),[L,V]=q(void 0),[,O]=q([]),[b,v]=q(void 0),[u,p]=q({}),[k,W]=q(void 0),[n,g]=q(!1),o=ue({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"});R(()=>{const a=T.on("quote-management/permissions",r=>{v(void 0),r.requestQuote||(v(o.unauthorized),g(!0))},{eager:!0});return()=>a==null?void 0:a.off()},[o.unauthorized]),R(()=>{const a=T.on("authenticated",r=>{v(void 0),r||(v(o.unauthenticated),g(!0))},{eager:!0});return()=>a==null?void 0:a.off()},[o.unauthenticated]),R(()=>{i||(v(o.missingCart),g(!0))},[i,o.missingCart]),R(()=>{b&&(f==null||f({error:b,isFormDisabled:n,setIsFormDisabled:g}))},[b,f,n]);const S=ae(async a=>{var r;p(d=>({...d,attachments:""})),O(a),(r=l==null?void 0:l(a))==null||r.catch(()=>{p(d=>({...d,attachments:o.attachmentsError}))})},[l,o]),Z=()=>{let a,r;if(k?(r={name:"SuccessBanner",slot:e==null?void 0:e.SuccessBanner,context:{message:k},"data-testid":"form-success-banner"},a={type:"success",variant:"primary",icon:t(le,{}),heading:o.successHeader,description:k,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"},a={type:"error",variant:"primary",icon:t(me,{}),heading:o.errorHeader,description:b,className:"request-negotiable-quote-form__error-banner"}),r&&a)return t(N,{...r,children:t(ce,{...a})})},A=a=>{p({});const r=a.target.closest("form"),d=z(r);Object.keys(d).length>0&&(p(d),s==null||s(d))},$=a=>{var P;a.preventDefault(),g(!0);const r=a.target,H={...z(r),...u};if(Object.keys(H).length>0){s==null||s(H);return}const y=a.submitter,x=re(r);E(x.comment),V(x.quoteName);const M=((P=y==null?void 0:y.dataset)==null?void 0:P.draft)==="true"||!1,ee={cartId:i,quoteName:x.quoteName,comment:x.comment,isDraft:M};let w,D;M?(w=_??B,D=o.draftSuccess):(w=C??B,D=o.submitSuccess),w(ee).then(()=>{W(D)}).catch(te=>{v(te.message)})},G=t(N,{name:"Title",slot:e==null?void 0:e.Title,context:{text:o.title},children:t("span",{"data-testid":"form-title",children:o.title})}),J=t(N,{name:"CommentField",slot:e==null?void 0:e.CommentField,context:{value:Q,required:!0,errorMessage:u.comment,setFormErrors:p,isFormDisabled:n},children:t(oe,{name:"comment",value:Q,label:o.comment,required:!0,autoComplete:"off","data-testid":"form-comment-field",errorMessage:u.comment,disabled:n})}),K=t(N,{name:"QuoteNameField",slot:e==null?void 0:e.QuoteNameField,context:{value:L,required:!0,errorMessage:u.quoteName,setFormErrors:p,isFormDisabled:n},children:t(ne,{error:u.quoteName,disabled:n,children:t(ie,{value:L,name:"quoteName",floatingLabel:o.quoteName,required:!0,autoComplete:"off","data-testid":"form-quote-name-field"})})}),U=t(N,{name:"AttachFileField",slot:e==null?void 0:e.AttachFileField,context:{onChange:S,formErrors:u,isFormDisabled:n},children:t(se,{onChange:a=>{const r=Array.from(a.target.files);r.length>0&&S(r)},icon:t(de,{}),disabled:n,"data-testid":"form-attach-file-field"})}),X=t(N,{name:"RequestButton",slot:e==null?void 0:e.RequestButton,context:{requestNegotiableQuote:B,formErrors:u,isFormDisabled:n,setIsFormDisabled:g},children:t(I,{type:"submit","data-testid":"form-request-button",onClick:A,disabled:n,children:o.requestCta})}),Y=t(N,{name:"SaveDraftButton",slot:e==null?void 0:e.SaveDraftButton,context:{requestNegotiableQuote:B,formErrors:u,isFormDisabled:n,setIsFormDisabled:g},children:t(I,{type:"submit","data-draft":"true",variant:"secondary","data-testid":"form-save-draft-button",onClick:A,disabled:n,children:o.saveDraftCta})});return t(fe,{title:G,banner:Z(),commentField:J,quoteNameField:K,attachFile:U,requestButton:X,saveButton:Y,onSubmit:$,className:F,disabled:n,"data-testid":"form-container"})};export{Re as RequestNegotiableQuoteForm,Re as default};
4
4
  //# sourceMappingURL=RequestNegotiableQuoteForm.js.map