@dropins/storefront-quote-management 0.0.1-alpha22 → 0.0.1-alpha23

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 (42) hide show
  1. package/api/index.d.ts +0 -1
  2. package/api.js +16 -41
  3. package/api.js.map +1 -1
  4. package/chunks/fetch-graphql.js +4 -0
  5. package/chunks/fetch-graphql.js.map +1 -0
  6. package/chunks/getQuoteTemplates.js +1 -1
  7. package/chunks/getQuoteTemplates.js.map +1 -1
  8. package/chunks/negotiableQuotes.js +1 -1
  9. package/chunks/negotiableQuotes.js.map +1 -1
  10. package/chunks/renameNegotiableQuote.js +1 -1
  11. package/chunks/renameNegotiableQuote.js.map +1 -1
  12. package/chunks/state.js +1 -1
  13. package/chunks/state.js.map +1 -1
  14. package/chunks/updateQuantities.js +2 -2
  15. package/chunks/updateQuantities.js.map +1 -1
  16. package/chunks/uploadFile.js +3 -3
  17. package/chunks/uploadFile.js.map +1 -1
  18. package/containers/ItemsQuoted.js +1 -1
  19. package/containers/ManageNegotiableQuote.js +1 -1
  20. package/containers/ManageNegotiableQuote.js.map +1 -1
  21. package/containers/QuoteTemplatesListTable.js +1 -1
  22. package/containers/QuoteTemplatesListTable.js.map +1 -1
  23. package/containers/QuotesListTable.js +1 -1
  24. package/containers/QuotesListTable.js.map +1 -1
  25. package/containers/RequestNegotiableQuoteForm.js +1 -1
  26. package/containers/RequestNegotiableQuoteForm.js.map +1 -1
  27. package/data/models/index.d.ts +0 -1
  28. package/data/transforms/index.d.ts +0 -1
  29. package/lib/state.d.ts +3 -0
  30. package/package.json +1 -1
  31. package/types/state.types.d.ts +6 -0
  32. package/utils/mapAuthPermissions.d.ts +39 -0
  33. package/api/getCustomerData/getCustomerData.d.ts +0 -10
  34. package/api/getCustomerData/graphql/CustomerQuery.d.ts +0 -2
  35. package/api/getCustomerData/index.d.ts +0 -10
  36. package/api/graphql/CustomerFragment.d.ts +0 -2
  37. package/chunks/transform-quote.js +0 -4
  38. package/chunks/transform-quote.js.map +0 -1
  39. package/data/models/__fixtures__/customerModel.d.ts +0 -4
  40. package/data/models/customer-model.d.ts +0 -18
  41. package/data/transforms/__fixtures__/customerData.d.ts +0 -10
  42. package/data/transforms/transform-customer.d.ts +0 -15
@@ -1 +1 @@
1
- {"version":3,"file":"QuotesListTable.js","sources":["/@dropins/storefront-quote-management/src/components/QuotesListTable/QuotesListTable.tsx","/@dropins/storefront-quote-management/src/containers/QuotesListTable/QuotesListTable.tsx"],"sourcesContent":["/********************************************************************\n * Copyright 2025 Adobe\n * All Rights Reserved.\n *\n * NOTICE: Adobe permits you to use, modify, and distribute this\n * file in accordance with the terms of the Adobe license agreement\n * accompanying it.\n *******************************************************************/\n\nimport { FunctionComponent, VNode } from 'preact';\nimport { HTMLAttributes } from 'preact/compat';\nimport { classes } from '@adobe-commerce/elsie/lib';\nimport { Table } from '@adobe-commerce/elsie/components';\nimport { useText } from '@adobe-commerce/elsie/i18n';\nimport '@/quote-management/components/QuotesListTable/QuotesListTable.css';\n\ntype Column = {\n key: string;\n label: string;\n};\n\nexport interface QuotesListTableProps\n extends Omit<HTMLAttributes<HTMLDivElement>, 'loading' | 'children'> {\n rowData: QuoteRowData[];\n loading?: boolean;\n className?: string;\n emptyStateMessage?: VNode;\n showItemRange?: boolean;\n itemRangeMessage?: VNode;\n showPageSizePicker?: boolean;\n pageSizePickerMessage?: VNode;\n showPagination?: boolean;\n paginationMessage?: VNode;\n}\n\nexport type QuoteRowData = {\n id: string;\n quoteName: VNode;\n created: VNode;\n createdBy: VNode;\n status: VNode;\n lastUpdated: VNode;\n quoteTemplate: VNode;\n quoteTotal: VNode;\n actions: VNode;\n [key: string]: VNode | string | number | undefined;\n};\n\nexport const QuotesListTable: FunctionComponent<QuotesListTableProps> = ({\n rowData = [],\n loading = false,\n className,\n emptyStateMessage,\n showItemRange = true,\n itemRangeMessage,\n showPageSizePicker = true,\n pageSizePickerMessage,\n showPagination = true,\n paginationMessage,\n ...props\n}) => {\n const dictionary = useText({\n quoteName: 'QuoteManagement.QuotesListTable.quoteName',\n created: 'QuoteManagement.QuotesListTable.created',\n createdBy: 'QuoteManagement.QuotesListTable.createdBy',\n status: 'QuoteManagement.QuotesListTable.status',\n lastUpdated: 'QuoteManagement.QuotesListTable.lastUpdated',\n quoteTemplate: 'QuoteManagement.QuotesListTable.quoteTemplate',\n quoteTotal: 'QuoteManagement.QuotesListTable.quoteTotal',\n actions: 'QuoteManagement.QuotesListTable.actions',\n });\n\n const columns: Column[] = [\n { key: 'quoteName', label: dictionary.quoteName },\n { key: 'created', label: dictionary.created },\n { key: 'createdBy', label: dictionary.createdBy },\n { key: 'status', label: dictionary.status },\n { key: 'lastUpdated', label: dictionary.lastUpdated },\n { key: 'quoteTemplate', label: dictionary.quoteTemplate },\n { key: 'quoteTotal', label: dictionary.quoteTotal },\n { key: 'actions', label: dictionary.actions },\n ];\n\n // Check if we should show empty state\n const shouldShowEmptyState =\n !loading && rowData.length === 0 && emptyStateMessage;\n\n // Show item range if requested and message is provided\n const shouldShowItemRange = showItemRange && itemRangeMessage;\n\n // Show page size picker if requested and message is provided\n const shouldShowPageSizePicker = showPageSizePicker && pageSizePickerMessage;\n\n // Show pagination if requested and message is provided\n const shouldShowPagination = showPagination && paginationMessage;\n\n // Show footer if any pagination element should be shown\n const shouldShowFooter =\n shouldShowItemRange || shouldShowPageSizePicker || shouldShowPagination;\n\n return (\n <div\n {...props}\n className={classes(['quote-management-quotes-list-table', className])}\n >\n <Table\n columns={columns}\n rowData={rowData}\n loading={loading}\n mobileLayout=\"none\"\n className=\"quote-management-quotes-list-table__table\"\n />\n {shouldShowEmptyState && (\n <div className=\"quotes-list-table__empty-state\">\n {emptyStateMessage}\n </div>\n )}\n {shouldShowFooter && (\n <div className=\"quotes-list-table__footer\">\n <div className=\"quotes-list-table__item-range\">\n {shouldShowItemRange && itemRangeMessage}\n </div>\n <div className=\"quotes-list-table__pagination\">\n {shouldShowPagination && paginationMessage}\n </div>\n <div className=\"quotes-list-table__page-size-picker\">\n {shouldShowPageSizePicker && pageSizePickerMessage}\n </div>\n </div>\n )}\n </div>\n );\n};\n","/********************************************************************\n * Copyright 2025 Adobe\n * All Rights Reserved.\n *\n * NOTICE: Adobe permits you to use, modify, and distribute this\n * file in accordance with the terms of the Adobe license agreement\n * accompanying it.\n *******************************************************************/\n\nimport { HTMLAttributes, useEffect, useState } from 'preact/compat';\nimport { Container, Slot, SlotProps } from '@adobe-commerce/elsie/lib';\nimport {\n Price,\n Button,\n IllustratedMessage,\n Picker,\n Pagination,\n type PickerOption,\n} from '@adobe-commerce/elsie/components';\nimport { events } from '@adobe-commerce/event-bus';\nimport {\n QuotesListTable as QuotesListTableComponent,\n QuoteRowData,\n} from '@/quote-management/components';\nimport { negotiableQuotes } from '@/quote-management/api';\nimport { getDefaultPageSizeOptions } from '@/quote-management/data/transforms';\nimport {\n NegotiableQuotesListModel,\n NegotiableQuoteListEntry,\n} from '@/quote-management/data/models';\n\nexport interface QuotesListTableProps extends HTMLAttributes<HTMLDivElement> {\n pageSize?: number;\n showItemRange?: boolean;\n showPageSizePicker?: boolean;\n showPagination?: boolean;\n onViewQuote?: (quoteId: string, quoteName: string, status: string) => void;\n onPageSizeChange?: (pageSize: number) => void;\n onPageChange?: (page: number) => void;\n slots?: {\n /** Slot for customizing the quote name cell content */\n QuoteName?: SlotProps<{ quote: NegotiableQuoteListEntry }>;\n /** Slot for customizing the created date cell content */\n Created?: SlotProps<{ quote: NegotiableQuoteListEntry }>;\n /** Slot for customizing the created by cell content */\n CreatedBy?: SlotProps<{ quote: NegotiableQuoteListEntry }>;\n /** Slot for customizing the status cell content */\n Status?: SlotProps<{ quote: NegotiableQuoteListEntry }>;\n /** Slot for customizing the last updated cell content */\n LastUpdated?: SlotProps<{ quote: NegotiableQuoteListEntry }>;\n /** Slot for customizing the quote template cell content */\n QuoteTemplate?: SlotProps<{ quote: NegotiableQuoteListEntry }>;\n /** Slot for customizing the quote total cell content */\n QuoteTotal?: SlotProps<{ quote: NegotiableQuoteListEntry }>;\n /** Slot for customizing the actions cell content */\n Actions?: SlotProps<{\n quote: NegotiableQuoteListEntry;\n onViewQuote?: (id: string, name: string, status: string) => void;\n }>;\n /** Slot for customizing the empty quotes message */\n EmptyQuotes?: SlotProps;\n /** Slot for customizing the item range display */\n ItemRange?: SlotProps<{\n startItem: number;\n endItem: number;\n totalCount: number;\n currentPage: number;\n pageSize: number;\n }>;\n /** Slot for customizing the page size picker */\n PageSizePicker?: SlotProps<{\n pageSize: number;\n pageSizeOptions: number[];\n onPageSizeChange?: (pageSize: number) => void;\n }>;\n /** Slot for customizing the pagination */\n Pagination?: SlotProps<{\n currentPage: number;\n totalPages: number;\n onChange?: (page: number) => void;\n }>;\n };\n}\n\nexport const QuotesListTable: Container<QuotesListTableProps> = ({\n pageSize,\n showItemRange = true,\n showPageSizePicker = true,\n showPagination = true,\n onViewQuote,\n onPageSizeChange,\n onPageChange,\n slots,\n ...props\n}) => {\n const [quotesData, setQuotesData] =\n useState<NegotiableQuotesListModel | null>(null);\n const [loading, setLoading] = useState(true);\n\n // Default to first page size option if no pageSize prop provided\n const defaultPageSize = getDefaultPageSizeOptions()[0];\n const [currentPageSize, setCurrentPageSize] = useState(\n pageSize || defaultPageSize\n );\n const [currentPage, setCurrentPage] = useState(1);\n\n // Fetch quotes data when authenticated\n useEffect(() => {\n const fetchQuotes = async () => {\n try {\n setLoading(true);\n const data = await negotiableQuotes({\n pageSize: currentPageSize,\n currentPage,\n });\n setQuotesData(data);\n } catch (error) {\n console.error('Failed to fetch quotes:', error);\n } finally {\n setLoading(false);\n }\n };\n\n // Listen for authentication events\n const unsubscribe = events.on(\n 'authenticated',\n (isAuthenticated) => {\n if (isAuthenticated) {\n fetchQuotes();\n } else {\n setQuotesData(null);\n setLoading(false);\n }\n },\n { eager: true }\n ); // eager: true means it fires immediately with current state\n\n return () => {\n unsubscribe?.off();\n };\n }, [currentPageSize, currentPage]);\n\n // Listen for quote renamed event to refresh the list\n useEffect(() => {\n const fetchQuotes = async () => {\n try {\n const data = await negotiableQuotes({\n pageSize: currentPageSize,\n currentPage,\n });\n setQuotesData(data);\n } catch (error) {\n console.error('Failed to fetch quotes:', error);\n }\n };\n\n const unsubscribe = events.on(\n 'quote-management/quote-renamed',\n () => {\n // Refetch quotes list to show the updated name\n fetchQuotes();\n },\n { eager: true }\n );\n\n return () => {\n unsubscribe?.off();\n };\n }, [currentPageSize, currentPage]);\n\n // Handle page size change\n const handlePageSizeChange = (newPageSize: number) => {\n setCurrentPageSize(newPageSize);\n setCurrentPage(1); // Reset to page 1 when page size changes\n onPageSizeChange?.(newPageSize); // Also call parent callback\n };\n\n // Handle page change\n const handlePageChange = (newPage: number) => {\n setCurrentPage(newPage);\n onPageChange?.(newPage); // Also call parent callback\n };\n\n // Handle page size picker selection\n const handlePageSizeSelect = (event: Event) => {\n const target = event.target as HTMLSelectElement;\n const value = target?.value;\n if (value) {\n handlePageSizeChange(Number(value));\n }\n };\n\n // Prepare transformed quote data for table component\n const prepareRowData = (\n quotes: NegotiableQuoteListEntry[],\n slots?: QuotesListTableProps['slots'],\n onViewQuote?: (quoteId: string, quoteName: string, status: string) => void\n ): QuoteRowData[] => {\n return quotes\n .filter((quote) => quote?.uid) // Filter out null quotes\n .map((quote) => {\n const createdByName = `${quote.buyer.firstname} ${quote.buyer.lastname}`;\n\n return {\n id: quote.uid,\n quoteName: (\n <Slot name=\"QuoteName\" slot={slots?.QuoteName} context={{ quote }}>\n <span>{quote.name}</span>\n </Slot>\n ),\n created: (\n <Slot name=\"Created\" slot={slots?.Created} context={{ quote }}>\n <span>\n {quote.createdAt\n ? new Date(quote.createdAt).toLocaleDateString()\n : 'N/A'}\n </span>\n </Slot>\n ),\n createdBy: (\n <Slot name=\"CreatedBy\" slot={slots?.CreatedBy} context={{ quote }}>\n <span>{createdByName}</span>\n </Slot>\n ),\n status: (\n <Slot name=\"Status\" slot={slots?.Status} context={{ quote }}>\n <span>{quote.status}</span>\n </Slot>\n ),\n lastUpdated: (\n <Slot\n name=\"LastUpdated\"\n slot={slots?.LastUpdated}\n context={{ quote }}\n >\n <span>\n {quote.updatedAt\n ? new Date(quote.updatedAt).toLocaleDateString()\n : 'N/A'}\n </span>\n </Slot>\n ),\n quoteTemplate: (\n <Slot\n name=\"QuoteTemplate\"\n slot={slots?.QuoteTemplate}\n context={{ quote }}\n >\n <span>{quote.templateName}</span>\n </Slot>\n ),\n quoteTotal: (\n <Slot\n name=\"QuoteTotal\"\n slot={slots?.QuoteTotal}\n context={{ quote }}\n >\n <Price\n amount={quote.prices?.grandTotal?.value}\n currency={quote.prices?.grandTotal?.currency}\n />\n </Slot>\n ),\n actions: (\n <Slot\n name=\"Actions\"\n slot={slots?.Actions}\n context={{ quote, onViewQuote }}\n >\n <Button\n variant=\"tertiary\"\n size=\"medium\"\n onClick={() =>\n onViewQuote?.(quote.uid, quote.name, quote.status)\n }\n >\n View\n </Button>\n </Slot>\n ),\n };\n });\n };\n\n // Prepare data for rendering\n const rowData = quotesData?.items\n ? prepareRowData(quotesData.items, slots, onViewQuote)\n : [];\n\n const paginationInfo = quotesData?.paginationInfo;\n const shouldShowPagination = !!paginationInfo;\n\n // Empty state message\n const emptyStateMessage = (\n <Slot name=\"EmptyQuotes\" slot={slots?.EmptyQuotes} context={{ quotesData }}>\n <IllustratedMessage heading=\"No Quotes Found\" />\n </Slot>\n );\n\n // Item range message\n const itemRangeMessage = paginationInfo ? (\n <Slot name=\"ItemRange\" slot={slots?.ItemRange} context={paginationInfo}>\n <span>\n Items {paginationInfo.startItem} to {paginationInfo.endItem} of{' '}\n {paginationInfo.totalCount} total\n </span>\n </Slot>\n ) : undefined;\n\n // Prepare page size picker message for component\n const pageSizePickerMessage =\n paginationInfo && paginationInfo.pageSizeOptions ? (\n <Slot\n name=\"PageSizePicker\"\n slot={slots?.PageSizePicker}\n context={{\n pageSize: paginationInfo.pageSize,\n pageSizeOptions: paginationInfo.pageSizeOptions,\n onPageSizeChange: handlePageSizeChange,\n }}\n >\n <span>Show </span>\n <Picker\n variant=\"primary\"\n size=\"medium\"\n value={String(paginationInfo.pageSize)}\n options={paginationInfo.pageSizeOptions.map(\n (size): PickerOption => ({\n value: String(size),\n text: String(size),\n })\n )}\n handleSelect={handlePageSizeSelect}\n />\n <span> per page</span>\n </Slot>\n ) : undefined;\n\n // Prepare pagination message for component\n const paginationMessage = paginationInfo ? (\n <Slot\n name=\"Pagination\"\n slot={slots?.Pagination}\n context={{\n currentPage: paginationInfo.currentPage,\n totalPages: paginationInfo.totalPages,\n onChange: handlePageChange,\n }}\n >\n <Pagination\n currentPage={paginationInfo.currentPage}\n totalPages={paginationInfo.totalPages}\n onChange={handlePageChange}\n />\n </Slot>\n ) : undefined;\n\n return (\n <QuotesListTableComponent\n rowData={rowData}\n loading={loading}\n className={props.className as string}\n emptyStateMessage={emptyStateMessage}\n showItemRange={showItemRange && shouldShowPagination}\n itemRangeMessage={itemRangeMessage}\n showPageSizePicker={showPageSizePicker && shouldShowPagination}\n pageSizePickerMessage={pageSizePickerMessage}\n showPagination={showPagination && shouldShowPagination}\n paginationMessage={paginationMessage}\n />\n );\n};\n"],"names":["QuotesListTable","rowData","loading","className","emptyStateMessage","showItemRange","itemRangeMessage","showPageSizePicker","pageSizePickerMessage","showPagination","paginationMessage","props","dictionary","useText","columns","shouldShowEmptyState","shouldShowItemRange","shouldShowPageSizePicker","shouldShowPagination","shouldShowFooter","jsxs","classes","jsx","Table","pageSize","onViewQuote","onPageSizeChange","onPageChange","slots","quotesData","setQuotesData","useState","setLoading","defaultPageSize","getDefaultPageSizeOptions","currentPageSize","setCurrentPageSize","currentPage","setCurrentPage","useEffect","fetchQuotes","data","negotiableQuotes","error","unsubscribe","events","isAuthenticated","handlePageSizeChange","newPageSize","handlePageChange","newPage","handlePageSizeSelect","event","target","value","prepareRowData","quotes","quote","createdByName","Slot","Price","_b","_a","_d","_c","Button","paginationInfo","IllustratedMessage","Picker","size","Pagination","QuotesListTableComponent"],"mappings":"w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AAUjB,CAAA,CAAA,CACZ,CAAA,EAEA,OAEJ,OACE3B,EAACiD,GAAA,CACC,QAAAtE,EACA,QAAAC,EACA,UAAWS,EAAM,UACjB,kBAAAP,EACA,cAAeC,GAAiBa,EAChC,iBAAAZ,EACA,mBAAoBC,GAAsBW,EAC1C,sBAAAV,EACA,eAAgBC,GAAkBS,EAClC,kBAAAR,CAAA,CAAA,CAGN"}
1
+ {"version":3,"file":"QuotesListTable.js","sources":["/@dropins/storefront-quote-management/src/components/QuotesListTable/QuotesListTable.tsx","/@dropins/storefront-quote-management/src/containers/QuotesListTable/QuotesListTable.tsx"],"sourcesContent":["/********************************************************************\n * Copyright 2025 Adobe\n * All Rights Reserved.\n *\n * NOTICE: Adobe permits you to use, modify, and distribute this\n * file in accordance with the terms of the Adobe license agreement\n * accompanying it.\n *******************************************************************/\n\nimport { FunctionComponent, VNode } from 'preact';\nimport { HTMLAttributes } from 'preact/compat';\nimport { classes } from '@adobe-commerce/elsie/lib';\nimport { Table } from '@adobe-commerce/elsie/components';\nimport { useText } from '@adobe-commerce/elsie/i18n';\nimport '@/quote-management/components/QuotesListTable/QuotesListTable.css';\n\ntype Column = {\n key: string;\n label: string;\n};\n\nexport interface QuotesListTableProps\n extends Omit<HTMLAttributes<HTMLDivElement>, 'loading' | 'children'> {\n rowData: QuoteRowData[];\n loading?: boolean;\n className?: string;\n emptyStateMessage?: VNode;\n showItemRange?: boolean;\n itemRangeMessage?: VNode;\n showPageSizePicker?: boolean;\n pageSizePickerMessage?: VNode;\n showPagination?: boolean;\n paginationMessage?: VNode;\n}\n\nexport type QuoteRowData = {\n id: string;\n quoteName: VNode;\n created: VNode;\n createdBy: VNode;\n status: VNode;\n lastUpdated: VNode;\n quoteTemplate: VNode;\n quoteTotal: VNode;\n actions: VNode;\n [key: string]: VNode | string | number | undefined;\n};\n\nexport const QuotesListTable: FunctionComponent<QuotesListTableProps> = ({\n rowData = [],\n loading = false,\n className,\n emptyStateMessage,\n showItemRange = true,\n itemRangeMessage,\n showPageSizePicker = true,\n pageSizePickerMessage,\n showPagination = true,\n paginationMessage,\n ...props\n}) => {\n const dictionary = useText({\n quoteName: 'QuoteManagement.QuotesListTable.quoteName',\n created: 'QuoteManagement.QuotesListTable.created',\n createdBy: 'QuoteManagement.QuotesListTable.createdBy',\n status: 'QuoteManagement.QuotesListTable.status',\n lastUpdated: 'QuoteManagement.QuotesListTable.lastUpdated',\n quoteTemplate: 'QuoteManagement.QuotesListTable.quoteTemplate',\n quoteTotal: 'QuoteManagement.QuotesListTable.quoteTotal',\n actions: 'QuoteManagement.QuotesListTable.actions',\n });\n\n const columns: Column[] = [\n { key: 'quoteName', label: dictionary.quoteName },\n { key: 'created', label: dictionary.created },\n { key: 'createdBy', label: dictionary.createdBy },\n { key: 'status', label: dictionary.status },\n { key: 'lastUpdated', label: dictionary.lastUpdated },\n { key: 'quoteTemplate', label: dictionary.quoteTemplate },\n { key: 'quoteTotal', label: dictionary.quoteTotal },\n { key: 'actions', label: dictionary.actions },\n ];\n\n // Check if we should show empty state\n const shouldShowEmptyState =\n !loading && rowData.length === 0 && emptyStateMessage;\n\n // Show item range if requested and message is provided\n const shouldShowItemRange = showItemRange && itemRangeMessage;\n\n // Show page size picker if requested and message is provided\n const shouldShowPageSizePicker = showPageSizePicker && pageSizePickerMessage;\n\n // Show pagination if requested and message is provided\n const shouldShowPagination = showPagination && paginationMessage;\n\n // Show footer if any pagination element should be shown\n const shouldShowFooter =\n shouldShowItemRange || shouldShowPageSizePicker || shouldShowPagination;\n\n return (\n <div\n {...props}\n className={classes(['quote-management-quotes-list-table', className])}\n >\n <Table\n columns={columns}\n rowData={rowData}\n loading={loading}\n mobileLayout=\"none\"\n className=\"quote-management-quotes-list-table__table\"\n />\n {shouldShowEmptyState && (\n <div className=\"quotes-list-table__empty-state\">\n {emptyStateMessage}\n </div>\n )}\n {shouldShowFooter && (\n <div className=\"quotes-list-table__footer\">\n <div className=\"quotes-list-table__item-range\">\n {shouldShowItemRange && itemRangeMessage}\n </div>\n <div className=\"quotes-list-table__pagination\">\n {shouldShowPagination && paginationMessage}\n </div>\n <div className=\"quotes-list-table__page-size-picker\">\n {shouldShowPageSizePicker && pageSizePickerMessage}\n </div>\n </div>\n )}\n </div>\n );\n};\n","/********************************************************************\n * Copyright 2025 Adobe\n * All Rights Reserved.\n *\n * NOTICE: Adobe permits you to use, modify, and distribute this\n * file in accordance with the terms of the Adobe license agreement\n * accompanying it.\n *******************************************************************/\n\nimport { HTMLAttributes, useEffect, useState } from 'preact/compat';\nimport { Container, Slot, SlotProps } from '@adobe-commerce/elsie/lib';\nimport {\n Price,\n Button,\n IllustratedMessage,\n Picker,\n Pagination,\n type PickerOption,\n} from '@adobe-commerce/elsie/components';\nimport { events } from '@adobe-commerce/event-bus';\nimport {\n QuotesListTable as QuotesListTableComponent,\n QuoteRowData,\n} from '@/quote-management/components';\nimport { negotiableQuotes } from '@/quote-management/api';\nimport { getDefaultPageSizeOptions } from '@/quote-management/data/transforms';\nimport {\n NegotiableQuotesListModel,\n NegotiableQuoteListEntry,\n} from '@/quote-management/data/models';\n\nexport interface QuotesListTableProps extends HTMLAttributes<HTMLDivElement> {\n pageSize?: number;\n showItemRange?: boolean;\n showPageSizePicker?: boolean;\n showPagination?: boolean;\n onViewQuote?: (quoteId: string, quoteName: string, status: string) => void;\n onPageSizeChange?: (pageSize: number) => void;\n onPageChange?: (page: number) => void;\n slots?: {\n /** Slot for customizing the quote name cell content */\n QuoteName?: SlotProps<{ quote: NegotiableQuoteListEntry }>;\n /** Slot for customizing the created date cell content */\n Created?: SlotProps<{ quote: NegotiableQuoteListEntry }>;\n /** Slot for customizing the created by cell content */\n CreatedBy?: SlotProps<{ quote: NegotiableQuoteListEntry }>;\n /** Slot for customizing the status cell content */\n Status?: SlotProps<{ quote: NegotiableQuoteListEntry }>;\n /** Slot for customizing the last updated cell content */\n LastUpdated?: SlotProps<{ quote: NegotiableQuoteListEntry }>;\n /** Slot for customizing the quote template cell content */\n QuoteTemplate?: SlotProps<{ quote: NegotiableQuoteListEntry }>;\n /** Slot for customizing the quote total cell content */\n QuoteTotal?: SlotProps<{ quote: NegotiableQuoteListEntry }>;\n /** Slot for customizing the actions cell content */\n Actions?: SlotProps<{\n quote: NegotiableQuoteListEntry;\n onViewQuote?: (id: string, name: string, status: string) => void;\n }>;\n /** Slot for customizing the empty quotes message */\n EmptyQuotes?: SlotProps;\n /** Slot for customizing the item range display */\n ItemRange?: SlotProps<{\n startItem: number;\n endItem: number;\n totalCount: number;\n currentPage: number;\n pageSize: number;\n }>;\n /** Slot for customizing the page size picker */\n PageSizePicker?: SlotProps<{\n pageSize: number;\n pageSizeOptions: number[];\n onPageSizeChange?: (pageSize: number) => void;\n }>;\n /** Slot for customizing the pagination */\n Pagination?: SlotProps<{\n currentPage: number;\n totalPages: number;\n onChange?: (page: number) => void;\n }>;\n };\n}\n\nexport const QuotesListTable: Container<QuotesListTableProps> = ({\n pageSize,\n showItemRange = true,\n showPageSizePicker = true,\n showPagination = true,\n onViewQuote,\n onPageSizeChange,\n onPageChange,\n slots,\n ...props\n}) => {\n const [quotesData, setQuotesData] =\n useState<NegotiableQuotesListModel | null>(null);\n const [loading, setLoading] = useState(true);\n\n // Default to first page size option if no pageSize prop provided\n const defaultPageSize = getDefaultPageSizeOptions()[0];\n const [currentPageSize, setCurrentPageSize] = useState(\n pageSize || defaultPageSize\n );\n const [currentPage, setCurrentPage] = useState(1);\n\n // Fetch quotes data when authenticated\n useEffect(() => {\n const fetchQuotes = async () => {\n try {\n setLoading(true);\n const data = await negotiableQuotes({\n pageSize: currentPageSize,\n currentPage,\n });\n setQuotesData(data);\n } catch (error) {\n console.error('Failed to fetch quotes:', error);\n } finally {\n setLoading(false);\n }\n };\n\n // Listen for authentication events\n const unsubscribe = events.on(\n 'authenticated',\n (isAuthenticated) => {\n if (isAuthenticated) {\n fetchQuotes();\n } else {\n setQuotesData(null);\n setLoading(false);\n }\n },\n { eager: true }\n ); // eager: true means it fires immediately with current state\n\n return () => {\n unsubscribe?.off();\n };\n }, [currentPageSize, currentPage]);\n\n // Listen for quote renamed event to refresh the list\n useEffect(() => {\n const fetchQuotes = async () => {\n try {\n const data = await negotiableQuotes({\n pageSize: currentPageSize,\n currentPage,\n });\n setQuotesData(data);\n } catch (error) {\n console.error('Failed to fetch quotes:', error);\n }\n };\n\n const unsubscribe = events.on(\n 'quote-management/quote-renamed',\n () => {\n // Refetch quotes list to show the updated name\n fetchQuotes();\n },\n { eager: true }\n );\n\n return () => {\n unsubscribe?.off();\n };\n }, [currentPageSize, currentPage]);\n\n // Handle page size change\n const handlePageSizeChange = (newPageSize: number) => {\n setCurrentPageSize(newPageSize);\n setCurrentPage(1); // Reset to page 1 when page size changes\n onPageSizeChange?.(newPageSize); // Also call parent callback\n };\n\n // Handle page change\n const handlePageChange = (newPage: number) => {\n setCurrentPage(newPage);\n onPageChange?.(newPage); // Also call parent callback\n };\n\n // Handle page size picker selection\n const handlePageSizeSelect = (event: Event) => {\n const target = event.target as HTMLSelectElement;\n const value = target?.value;\n if (value) {\n handlePageSizeChange(Number(value));\n }\n };\n\n // Prepare transformed quote data for table component\n const prepareRowData = (\n quotes: NegotiableQuoteListEntry[],\n slots?: QuotesListTableProps['slots'],\n onViewQuote?: (quoteId: string, quoteName: string, status: string) => void\n ): QuoteRowData[] => {\n return quotes\n .filter((quote) => quote?.uid) // Filter out null quotes\n .map((quote) => {\n const createdByName = `${quote.buyer.firstname} ${quote.buyer.lastname}`;\n\n return {\n id: quote.uid,\n quoteName: (\n <Slot name=\"QuoteName\" slot={slots?.QuoteName} context={{ quote }}>\n <span>{quote.name}</span>\n </Slot>\n ),\n created: (\n <Slot name=\"Created\" slot={slots?.Created} context={{ quote }}>\n <span>\n {quote.createdAt\n ? new Date(quote.createdAt).toLocaleDateString()\n : 'N/A'}\n </span>\n </Slot>\n ),\n createdBy: (\n <Slot name=\"CreatedBy\" slot={slots?.CreatedBy} context={{ quote }}>\n <span>{createdByName}</span>\n </Slot>\n ),\n status: (\n <Slot name=\"Status\" slot={slots?.Status} context={{ quote }}>\n <span>{quote.status}</span>\n </Slot>\n ),\n lastUpdated: (\n <Slot\n name=\"LastUpdated\"\n slot={slots?.LastUpdated}\n context={{ quote }}\n >\n <span>\n {quote.updatedAt\n ? new Date(quote.updatedAt).toLocaleDateString()\n : 'N/A'}\n </span>\n </Slot>\n ),\n quoteTemplate: (\n <Slot\n name=\"QuoteTemplate\"\n slot={slots?.QuoteTemplate}\n context={{ quote }}\n >\n <span>{quote.templateName}</span>\n </Slot>\n ),\n quoteTotal: (\n <Slot\n name=\"QuoteTotal\"\n slot={slots?.QuoteTotal}\n context={{ quote }}\n >\n <Price\n amount={quote.prices?.grandTotal?.value}\n currency={quote.prices?.grandTotal?.currency}\n />\n </Slot>\n ),\n actions: (\n <Slot\n name=\"Actions\"\n slot={slots?.Actions}\n context={{ quote, onViewQuote }}\n >\n <Button\n variant=\"tertiary\"\n size=\"medium\"\n onClick={() =>\n onViewQuote?.(quote.uid, quote.name, quote.status)\n }\n >\n View\n </Button>\n </Slot>\n ),\n };\n });\n };\n\n // Prepare data for rendering\n const rowData = quotesData?.items\n ? prepareRowData(quotesData.items, slots, onViewQuote)\n : [];\n\n const paginationInfo = quotesData?.paginationInfo;\n const shouldShowPagination = !!paginationInfo;\n\n // Empty state message\n const emptyStateMessage = (\n <Slot name=\"EmptyQuotes\" slot={slots?.EmptyQuotes} context={{ quotesData }}>\n <IllustratedMessage heading=\"No Quotes Found\" />\n </Slot>\n );\n\n // Item range message\n const itemRangeMessage = paginationInfo ? (\n <Slot name=\"ItemRange\" slot={slots?.ItemRange} context={paginationInfo}>\n <span>\n Items {paginationInfo.startItem} to {paginationInfo.endItem} of{' '}\n {paginationInfo.totalCount} total\n </span>\n </Slot>\n ) : undefined;\n\n // Prepare page size picker message for component\n const pageSizePickerMessage =\n paginationInfo && paginationInfo.pageSizeOptions ? (\n <Slot\n name=\"PageSizePicker\"\n slot={slots?.PageSizePicker}\n context={{\n pageSize: paginationInfo.pageSize,\n pageSizeOptions: paginationInfo.pageSizeOptions,\n onPageSizeChange: handlePageSizeChange,\n }}\n >\n <span>Show </span>\n <Picker\n variant=\"primary\"\n size=\"medium\"\n value={String(paginationInfo.pageSize)}\n options={paginationInfo.pageSizeOptions.map(\n (size): PickerOption => ({\n value: String(size),\n text: String(size),\n })\n )}\n handleSelect={handlePageSizeSelect}\n />\n <span> per page</span>\n </Slot>\n ) : undefined;\n\n // Prepare pagination message for component\n const paginationMessage = paginationInfo ? (\n <Slot\n name=\"Pagination\"\n slot={slots?.Pagination}\n context={{\n currentPage: paginationInfo.currentPage,\n totalPages: paginationInfo.totalPages,\n onChange: handlePageChange,\n }}\n >\n <Pagination\n currentPage={paginationInfo.currentPage}\n totalPages={paginationInfo.totalPages}\n onChange={handlePageChange}\n />\n </Slot>\n ) : undefined;\n\n return (\n <QuotesListTableComponent\n rowData={rowData}\n loading={loading}\n className={props.className as string}\n emptyStateMessage={emptyStateMessage}\n showItemRange={showItemRange && shouldShowPagination}\n itemRangeMessage={itemRangeMessage}\n showPageSizePicker={showPageSizePicker && shouldShowPagination}\n pageSizePickerMessage={pageSizePickerMessage}\n showPagination={showPagination && shouldShowPagination}\n paginationMessage={paginationMessage}\n />\n );\n};\n"],"names":["QuotesListTable","rowData","loading","className","emptyStateMessage","showItemRange","itemRangeMessage","showPageSizePicker","pageSizePickerMessage","showPagination","paginationMessage","props","dictionary","useText","columns","shouldShowEmptyState","shouldShowItemRange","shouldShowPageSizePicker","shouldShowPagination","shouldShowFooter","jsxs","classes","jsx","Table","pageSize","onViewQuote","onPageSizeChange","onPageChange","slots","quotesData","setQuotesData","useState","setLoading","defaultPageSize","getDefaultPageSizeOptions","currentPageSize","setCurrentPageSize","currentPage","setCurrentPage","useEffect","fetchQuotes","data","negotiableQuotes","error","unsubscribe","events","isAuthenticated","handlePageSizeChange","newPageSize","handlePageChange","newPage","handlePageSizeSelect","event","target","value","prepareRowData","quotes","quote","createdByName","Slot","Price","_b","_a","_d","_c","Button","paginationInfo","IllustratedMessage","Picker","size","Pagination","QuotesListTableComponent"],"mappings":"s2BAgDO,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,CAAQ,EAIxCG,EACJ,CAACb,GAAWD,EAAQ,SAAW,GAAKG,EAGhCY,EAAsBX,GAAiBC,EAGvCW,EAA2BV,GAAsBC,EAGjDU,EAAuBT,GAAkBC,EAGzCS,EACJH,GAAuBC,GAA4BC,EAErD,OACEE,EAAC,MAAA,CACE,GAAGT,EACJ,UAAWU,EAAQ,CAAC,qCAAsClB,CAAS,CAAC,EAEpE,SAAA,CAAAmB,EAACC,EAAA,CACC,QAAAT,EACA,QAAAb,EACA,QAAAC,EACA,aAAa,OACb,UAAU,2CAAA,CAAA,EAEXa,GACCO,EAAC,MAAA,CAAI,UAAU,iCACZ,SAAAlB,EACH,EAEDe,GACCC,EAAC,MAAA,CAAI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AA3B,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 z,jsx as a}from"@dropins/tools/preact-jsx-runtime.js";import*as v from"@dropins/tools/preact-compat.js";import{useState as g,useEffect as y,useCallback as re}from"@dropins/tools/preact-compat.js";import{classes as c,VComponent as q,Slot as h,getFormErrors as I,getFormValues as oe}from"@dropins/tools/lib.js";import{TextArea as ne,Field as ie,Input as se,InputFile as ce,Button as M,InLineAlert as me}from"@dropins/tools/components.js";/* empty css */import{events as T}from"@dropins/tools/event-bus.js";import"../chunks/state.js";import{u as ue,r as B}from"../chunks/uploadFile.js";import{S as de,a as le}from"../chunks/WarningFilled.js";import{useText as fe}from"@dropins/tools/i18n.js";import"../chunks/transform-quote.js";import"@dropins/tools/fetch-graphql.js";import"../chunks/NegotiableQuoteFragment.js";const ge=u=>v.createElement("svg",{id:"Icon_Add_Base","data-name":"Icon \\u2013 Add \\u2013 Base",xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",...u},v.createElement("g",{id:"Large"},v.createElement("rect",{id:"Placement_area","data-name":"Placement area",width:24,height:24,fill:"#fff",opacity:0}),v.createElement("g",{id:"Add_icon","data-name":"Add icon",transform:"translate(9.734 9.737)"},v.createElement("line",{vectorEffect:"non-scaling-stroke",id:"Line_579","data-name":"Line 579",y2:12.7,transform:"translate(2.216 -4.087)",fill:"none",stroke:"currentColor"}),v.createElement("line",{vectorEffect:"non-scaling-stroke",id:"Line_580","data-name":"Line 580",x2:12.7,transform:"translate(-4.079 2.263)",fill:"none",stroke:"currentColor"})))),qe=({className:u,title:e,banner:_,commentField:C,quoteNameField:N,attachFile:i,requestButton:d,saveButton:Q,onSubmit:R,...A})=>z("form",{...A,className:c(["request-negotiable-quote-form",u]),onSubmit:R,children:[_&&a(q,{node:_,className:c(["request-negotiable-quote-form__banner"])}),e&&a(q,{node:e,className:c(["request-negotiable-quote-form__title"])}),C&&a(q,{node:C,className:c(["request-negotiable-quote-form__comment-field"])}),N&&a(q,{node:N,className:c(["request-negotiable-quote-form__quote-name-field"])}),i&&a(q,{node:i,className:c(["request-negotiable-quote-form__attach-file-field"])}),z("div",{className:c(["request-negotiable-quote-form__actions"]),children:[d&&a(q,{node:d,className:c(["request-negotiable-quote-form__request-button"])}),Q&&a(q,{node:Q,className:c(["request-negotiable-quote-form__save-button"])})]})]}),Ae=({cartId:u,slots:e,onRequestNegotiableQuote:_,onSaveNegotiableQuote:C,onAttachFiles:N,onSubmitErrors:i,onError:d,className:Q})=>{const[R,A]=g(void 0),[S,V]=g(void 0),[K,O]=g([]),[b,p]=g(void 0),[m,l]=g({}),[E,W]=g(void 0),[n,f]=g(!1),o=fe({title:"NegotiableQuote.Request.title",comment:"NegotiableQuote.Request.comment",commentError:"NegotiableQuote.Request.commentError",quoteName:"NegotiableQuote.Request.quoteName",quoteNameError:"NegotiableQuote.Request.quoteNameError",attachmentsError:"NegotiableQuote.Request.attachmentsError",requestCta:"NegotiableQuote.Request.requestCta",saveDraftCta:"NegotiableQuote.Request.saveDraftCta",errorHeader:"NegotiableQuote.Request.error.header",unauthenticated:"NegotiableQuote.Request.error.unauthenticated",unauthorized:"NegotiableQuote.Request.error.unauthorized",missingCart:"NegotiableQuote.Request.error.missingCart",successHeader:"NegotiableQuote.Request.success.header",submitSuccess:"NegotiableQuote.Request.success.submitted",draftSuccess:"NegotiableQuote.Request.success.draftSaved"});y(()=>{const t=T.on("quote-management/permissions",r=>{p(void 0),r.requestQuote||(p(o.unauthorized),f(!0))},{eager:!0});return()=>t==null?void 0:t.off()},[o.unauthorized]),y(()=>{const t=T.on("authenticated",r=>{p(void 0),r||(p(o.unauthenticated),f(!0))},{eager:!0});return()=>t==null?void 0:t.off()},[o.unauthenticated]),y(()=>{u||(p(o.missingCart),f(!0))},[u,o.missingCart]),y(()=>{b&&(d==null||d({error:b,isFormDisabled:n,setIsFormDisabled:f}))},[b,d,n]);const L=re(async t=>{if(t!=null&&t.length){if(l(r=>({...r,attachments:""})),N){try{await N(t)}catch{l(r=>({...r,attachments:o.attachmentsError}))}return}try{const r=await Promise.all(t.map(ue));O(r.map(({key:s})=>({key:s})))}catch{l(r=>({...r,attachments:o.attachmentsError}))}}},[N,o]),$=()=>{let t,r;if(E?(r={name:"SuccessBanner",slot:e==null?void 0:e.SuccessBanner,context:{message:E},"data-testid":"form-success-banner"},t={type:"success",variant:"primary",icon:a(de,{}),heading:o.successHeader,description:E,className:"request-negotiable-quote-form__success-banner"}):b&&(r={name:"ErrorBanner",slot:e==null?void 0:e.ErrorBanner,context:{message:b},"data-testid":"form-error-banner"},t={type:"error",variant:"primary",icon:a(le,{}),heading:o.errorHeader,description:b,className:"request-negotiable-quote-form__error-banner"}),r&&t)return a(h,{...r,children:a(me,{...t})})},H=t=>{l({});const r=t.target.closest("form"),s=I(r);Object.keys(s).length>0&&(l(s),i==null||i(s))},G=t=>{var j;t.preventDefault(),f(!0);const r=t.target,F={...I(r),...m};if(Object.keys(F).length>0){i==null||i(F);return}const k=t.submitter,x=oe(r);A(x.comment),V(x.quoteName);const P=((j=k==null?void 0:k.dataset)==null?void 0:j.draft)==="true"||!1,te={cartId:u,quoteName:x.quoteName,comment:x.comment,attachments:K,isDraft:P};let D,w;P?(D=C??B,w=o.draftSuccess):(D=_??B,w=o.submitSuccess),D(te).then(()=>{W(w)}).catch(ae=>{p(ae.message)})},J=a(h,{name:"Title",slot:e==null?void 0:e.Title,context:{text:o.title},children:a("span",{"data-testid":"form-title",children:o.title})}),U=a(h,{name:"CommentField",slot:e==null?void 0:e.CommentField,context:{value:R,required:!0,errorMessage:m.comment,setFormErrors:l,isFormDisabled:n},children:a(ne,{name:"comment",value:R,label:o.comment,required:!0,autoComplete:"off","data-testid":"form-comment-field",errorMessage:m.comment,disabled:n})}),X=a(h,{name:"QuoteNameField",slot:e==null?void 0:e.QuoteNameField,context:{value:S,required:!0,errorMessage:m.quoteName,setFormErrors:l,isFormDisabled:n},children:a(ie,{error:m.quoteName,disabled:n,children:a(se,{value:S,name:"quoteName",floatingLabel:o.quoteName,required:!0,autoComplete:"off","data-testid":"form-quote-name-field"})})}),Y=a(h,{name:"AttachFileField",slot:e==null?void 0:e.AttachFileField,context:{onChange:L,formErrors:m,isFormDisabled:n},children:a(ce,{onChange:t=>{const r=t.target,s=r==null?void 0:r.files,F=s?Array.from(s):[];F.length>0&&L(F)},icon:a(ge,{}),disabled:n,"data-testid":"form-attach-file-field"})}),Z=a(h,{name:"RequestButton",slot:e==null?void 0:e.RequestButton,context:{requestNegotiableQuote:B,formErrors:m,isFormDisabled:n,setIsFormDisabled:f},children:a(M,{type:"submit","data-testid":"form-request-button",onClick:H,disabled:n,children:o.requestCta})}),ee=a(h,{name:"SaveDraftButton",slot:e==null?void 0:e.SaveDraftButton,context:{requestNegotiableQuote:B,formErrors:m,isFormDisabled:n,setIsFormDisabled:f},children:a(M,{type:"submit","data-draft":"true",variant:"secondary","data-testid":"form-save-draft-button",onClick:H,disabled:n,children:o.saveDraftCta})});return a(qe,{title:J,banner:$(),commentField:U,quoteNameField:X,attachFile:Y,requestButton:Z,saveButton:ee,onSubmit:G,className:Q,disabled:n,"data-testid":"form-container"})};export{Ae as RequestNegotiableQuoteForm,Ae as default};
3
+ import{jsxs as z,jsx as a}from"@dropins/tools/preact-jsx-runtime.js";import*as v from"@dropins/tools/preact-compat.js";import{useState as g,useEffect as y,useCallback as re}from"@dropins/tools/preact-compat.js";import{classes as c,VComponent as q,Slot as h,getFormErrors as I,getFormValues as oe}from"@dropins/tools/lib.js";import{TextArea as ne,Field as ie,Input as se,InputFile as ce,Button as M,InLineAlert as me}from"@dropins/tools/components.js";/* empty css */import{events as T}from"@dropins/tools/event-bus.js";import{u as ue,r as B}from"../chunks/uploadFile.js";import"../chunks/state.js";import{S as de,a as le}from"../chunks/WarningFilled.js";import{useText as fe}from"@dropins/tools/i18n.js";import"../chunks/NegotiableQuoteFragment.js";import"../chunks/fetch-graphql.js";import"@dropins/tools/fetch-graphql.js";const ge=u=>v.createElement("svg",{id:"Icon_Add_Base","data-name":"Icon \\u2013 Add \\u2013 Base",xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",...u},v.createElement("g",{id:"Large"},v.createElement("rect",{id:"Placement_area","data-name":"Placement area",width:24,height:24,fill:"#fff",opacity:0}),v.createElement("g",{id:"Add_icon","data-name":"Add icon",transform:"translate(9.734 9.737)"},v.createElement("line",{vectorEffect:"non-scaling-stroke",id:"Line_579","data-name":"Line 579",y2:12.7,transform:"translate(2.216 -4.087)",fill:"none",stroke:"currentColor"}),v.createElement("line",{vectorEffect:"non-scaling-stroke",id:"Line_580","data-name":"Line 580",x2:12.7,transform:"translate(-4.079 2.263)",fill:"none",stroke:"currentColor"})))),qe=({className:u,title:e,banner:_,commentField:C,quoteNameField:N,attachFile:i,requestButton:d,saveButton:Q,onSubmit:R,...A})=>z("form",{...A,className:c(["request-negotiable-quote-form",u]),onSubmit:R,children:[_&&a(q,{node:_,className:c(["request-negotiable-quote-form__banner"])}),e&&a(q,{node:e,className:c(["request-negotiable-quote-form__title"])}),C&&a(q,{node:C,className:c(["request-negotiable-quote-form__comment-field"])}),N&&a(q,{node:N,className:c(["request-negotiable-quote-form__quote-name-field"])}),i&&a(q,{node:i,className:c(["request-negotiable-quote-form__attach-file-field"])}),z("div",{className:c(["request-negotiable-quote-form__actions"]),children:[d&&a(q,{node:d,className:c(["request-negotiable-quote-form__request-button"])}),Q&&a(q,{node:Q,className:c(["request-negotiable-quote-form__save-button"])})]})]}),Ae=({cartId:u,slots:e,onRequestNegotiableQuote:_,onSaveNegotiableQuote:C,onAttachFiles:N,onSubmitErrors:i,onError:d,className:Q})=>{const[R,A]=g(void 0),[S,V]=g(void 0),[K,O]=g([]),[b,p]=g(void 0),[m,l]=g({}),[E,W]=g(void 0),[n,f]=g(!1),o=fe({title:"NegotiableQuote.Request.title",comment:"NegotiableQuote.Request.comment",commentError:"NegotiableQuote.Request.commentError",quoteName:"NegotiableQuote.Request.quoteName",quoteNameError:"NegotiableQuote.Request.quoteNameError",attachmentsError:"NegotiableQuote.Request.attachmentsError",requestCta:"NegotiableQuote.Request.requestCta",saveDraftCta:"NegotiableQuote.Request.saveDraftCta",errorHeader:"NegotiableQuote.Request.error.header",unauthenticated:"NegotiableQuote.Request.error.unauthenticated",unauthorized:"NegotiableQuote.Request.error.unauthorized",missingCart:"NegotiableQuote.Request.error.missingCart",successHeader:"NegotiableQuote.Request.success.header",submitSuccess:"NegotiableQuote.Request.success.submitted",draftSuccess:"NegotiableQuote.Request.success.draftSaved"});y(()=>{const t=T.on("quote-management/permissions",r=>{p(void 0),r.requestQuote||(p(o.unauthorized),f(!0))},{eager:!0});return()=>t==null?void 0:t.off()},[o.unauthorized]),y(()=>{const t=T.on("authenticated",r=>{p(void 0),r||(p(o.unauthenticated),f(!0))},{eager:!0});return()=>t==null?void 0:t.off()},[o.unauthenticated]),y(()=>{u||(p(o.missingCart),f(!0))},[u,o.missingCart]),y(()=>{b&&(d==null||d({error:b,isFormDisabled:n,setIsFormDisabled:f}))},[b,d,n]);const L=re(async t=>{if(t!=null&&t.length){if(l(r=>({...r,attachments:""})),N){try{await N(t)}catch{l(r=>({...r,attachments:o.attachmentsError}))}return}try{const r=await Promise.all(t.map(ue));O(r.map(({key:s})=>({key:s})))}catch{l(r=>({...r,attachments:o.attachmentsError}))}}},[N,o]),$=()=>{let t,r;if(E?(r={name:"SuccessBanner",slot:e==null?void 0:e.SuccessBanner,context:{message:E},"data-testid":"form-success-banner"},t={type:"success",variant:"primary",icon:a(de,{}),heading:o.successHeader,description:E,className:"request-negotiable-quote-form__success-banner"}):b&&(r={name:"ErrorBanner",slot:e==null?void 0:e.ErrorBanner,context:{message:b},"data-testid":"form-error-banner"},t={type:"error",variant:"primary",icon:a(le,{}),heading:o.errorHeader,description:b,className:"request-negotiable-quote-form__error-banner"}),r&&t)return a(h,{...r,children:a(me,{...t})})},H=t=>{l({});const r=t.target.closest("form"),s=I(r);Object.keys(s).length>0&&(l(s),i==null||i(s))},G=t=>{var j;t.preventDefault(),f(!0);const r=t.target,F={...I(r),...m};if(Object.keys(F).length>0){i==null||i(F);return}const k=t.submitter,x=oe(r);A(x.comment),V(x.quoteName);const P=((j=k==null?void 0:k.dataset)==null?void 0:j.draft)==="true"||!1,te={cartId:u,quoteName:x.quoteName,comment:x.comment,attachments:K,isDraft:P};let D,w;P?(D=C??B,w=o.draftSuccess):(D=_??B,w=o.submitSuccess),D(te).then(()=>{W(w)}).catch(ae=>{p(ae.message)})},J=a(h,{name:"Title",slot:e==null?void 0:e.Title,context:{text:o.title},children:a("span",{"data-testid":"form-title",children:o.title})}),U=a(h,{name:"CommentField",slot:e==null?void 0:e.CommentField,context:{value:R,required:!0,errorMessage:m.comment,setFormErrors:l,isFormDisabled:n},children:a(ne,{name:"comment",value:R,label:o.comment,required:!0,autoComplete:"off","data-testid":"form-comment-field",errorMessage:m.comment,disabled:n})}),X=a(h,{name:"QuoteNameField",slot:e==null?void 0:e.QuoteNameField,context:{value:S,required:!0,errorMessage:m.quoteName,setFormErrors:l,isFormDisabled:n},children:a(ie,{error:m.quoteName,disabled:n,children:a(se,{value:S,name:"quoteName",floatingLabel:o.quoteName,required:!0,autoComplete:"off","data-testid":"form-quote-name-field"})})}),Y=a(h,{name:"AttachFileField",slot:e==null?void 0:e.AttachFileField,context:{onChange:L,formErrors:m,isFormDisabled:n},children:a(ce,{onChange:t=>{const r=t.target,s=r==null?void 0:r.files,F=s?Array.from(s):[];F.length>0&&L(F)},icon:a(ge,{}),disabled:n,"data-testid":"form-attach-file-field"})}),Z=a(h,{name:"RequestButton",slot:e==null?void 0:e.RequestButton,context:{requestNegotiableQuote:B,formErrors:m,isFormDisabled:n,setIsFormDisabled:f},children:a(M,{type:"submit","data-testid":"form-request-button",onClick:H,disabled:n,children:o.requestCta})}),ee=a(h,{name:"SaveDraftButton",slot:e==null?void 0:e.SaveDraftButton,context:{requestNegotiableQuote:B,formErrors:m,isFormDisabled:n,setIsFormDisabled:f},children:a(M,{type:"submit","data-draft":"true",variant:"secondary","data-testid":"form-save-draft-button",onClick:H,disabled:n,children:o.saveDraftCta})});return a(qe,{title:J,banner:$(),commentField:U,quoteNameField:X,attachFile:Y,requestButton:Z,saveButton:ee,onSubmit:G,className:Q,disabled:n,"data-testid":"form-container"})};export{Ae as RequestNegotiableQuoteForm,Ae as default};
4
4
  //# sourceMappingURL=RequestNegotiableQuoteForm.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"RequestNegotiableQuoteForm.js","sources":["../../node_modules/@adobe-commerce/elsie/src/icons/Add.svg","/@dropins/storefront-quote-management/src/components/RequestNegotiableQuoteForm/RequestNegotiableQuoteForm.tsx","/@dropins/storefront-quote-management/src/containers/RequestNegotiableQuoteForm/RequestNegotiableQuoteForm.tsx"],"sourcesContent":["import * as React from \"react\";\nconst SvgAdd = (props) => /* @__PURE__ */ React.createElement(\"svg\", { id: \"Icon_Add_Base\", \"data-name\": \"Icon \\\\u2013 Add \\\\u2013 Base\", xmlns: \"http://www.w3.org/2000/svg\", width: 24, height: 24, viewBox: \"0 0 24 24\", ...props }, /* @__PURE__ */ React.createElement(\"g\", { id: \"Large\" }, /* @__PURE__ */ React.createElement(\"rect\", { id: \"Placement_area\", \"data-name\": \"Placement area\", width: 24, height: 24, fill: \"#fff\", opacity: 0 }), /* @__PURE__ */ React.createElement(\"g\", { id: \"Add_icon\", \"data-name\": \"Add icon\", transform: \"translate(9.734 9.737)\" }, /* @__PURE__ */ React.createElement(\"line\", { vectorEffect: \"non-scaling-stroke\", id: \"Line_579\", \"data-name\": \"Line 579\", y2: 12.7, transform: \"translate(2.216 -4.087)\", fill: \"none\", stroke: \"currentColor\" }), /* @__PURE__ */ React.createElement(\"line\", { vectorEffect: \"non-scaling-stroke\", id: \"Line_580\", \"data-name\": \"Line 580\", x2: 12.7, transform: \"translate(-4.079 2.263)\", fill: \"none\", stroke: \"currentColor\" }))));\nexport default SvgAdd;\n","/********************************************************************\n * Copyright 2025 Adobe\n * All Rights Reserved.\n *\n * NOTICE: Adobe permits you to use, modify, and distribute this \n * file in accordance with the terms of the Adobe license agreement \n * accompanying it. \n *******************************************************************/\n\nimport { FunctionComponent, VNode } from 'preact';\nimport { HTMLAttributes } from 'preact/compat';\nimport { classes, VComponent } from '@adobe-commerce/elsie/lib';\nimport '@/quote-management/components/RequestNegotiableQuoteForm/RequestNegotiableQuoteForm.css';\n\nexport interface RequestNegotiableQuoteFormProps extends Omit<HTMLAttributes<HTMLFormElement>, 'title'> {\n title: VNode;\n banner?: VNode;\n commentField?: VNode;\n quoteNameField?: VNode;\n attachFile?: VNode;\n requestButton?: VNode;\n saveButton?: VNode;\n onSubmit: (e: Event) => void;\n}\n\nexport const RequestNegotiableQuoteForm: FunctionComponent<RequestNegotiableQuoteFormProps> = ({\n className,\n title,\n banner,\n commentField,\n quoteNameField,\n attachFile,\n requestButton,\n saveButton,\n onSubmit,\n ...props\n}) => {\n return (\n <form {...props} className={classes(['request-negotiable-quote-form', className])} onSubmit={onSubmit}>\n {banner &&\n <VComponent\n node={banner}\n className={classes(['request-negotiable-quote-form__banner'])}\n />\n }\n {title &&\n <VComponent\n node={title}\n className={classes(['request-negotiable-quote-form__title'])}\n />\n }\n {commentField &&\n <VComponent\n node={commentField}\n className={classes(['request-negotiable-quote-form__comment-field'])}\n />\n }\n {quoteNameField &&\n <VComponent\n node={quoteNameField}\n className={classes(['request-negotiable-quote-form__quote-name-field'])}\n />\n }\n {attachFile &&\n <VComponent\n node={attachFile}\n className={classes(['request-negotiable-quote-form__attach-file-field'])}\n />\n }\n <div className={classes(['request-negotiable-quote-form__actions'])}>\n {requestButton &&\n <VComponent\n node={requestButton}\n className={classes(['request-negotiable-quote-form__request-button'])}\n />\n }\n {saveButton &&\n <VComponent\n node={saveButton}\n className={classes(['request-negotiable-quote-form__save-button'])}\n />\n }\n </div>\n </form>\n );\n};\n","/********************************************************************\n * Copyright 2025 Adobe\n * All Rights Reserved.\n *\n * NOTICE: Adobe permits you to use, modify, and distribute this \n * file in accordance with the terms of the Adobe license agreement \n * accompanying it. \n *******************************************************************/\n\nimport { HTMLAttributes, useCallback, useEffect, useState } from 'preact/compat';\nimport { Container, getFormErrors, getFormValues, Slot, SlotProps } from '@adobe-commerce/elsie/lib';\nimport { InLineAlert, Button, InputFile, TextArea, Input, Field, InLineAlertProps } from '@adobe-commerce/elsie/components';\nimport { WarningFilled, CheckWithCircle, Add } from '@adobe-commerce/elsie/icons';\nimport RequestNegotiableQuoteFormComponent from '@/quote-management/components/RequestNegotiableQuoteForm';\nimport { useText } from '@adobe-commerce/elsie/i18n';\nimport { events } from '@adobe-commerce/event-bus';\nimport { requestNegotiableQuote, RequestNegotiableQuoteInput, uploadFile } from '@/quote-management/api';\nimport { state } from '@/quote-management/lib/state';\n\nexport type RequestNegotiableQuoteHandlers = {\n onAttachFiles?: (files: File[]) => Promise<void>;\n onRequestNegotiableQuote?: typeof requestNegotiableQuote;\n onSaveNegotiableQuote?: typeof requestNegotiableQuote;\n onSubmitErrors?: (errors: Record<string, string>) => void;\n onError?: (props: {\n error: string,\n isFormDisabled: boolean,\n setIsFormDisabled: (isFormDisabled: boolean) => void,\n }) => void;\n};\n\nexport interface RequestNegotiableQuoteFormProps\n extends Omit<HTMLAttributes<HTMLDivElement>, 'onError'>,\n RequestNegotiableQuoteHandlers {\n cartId: string;\n slots?: {\n ErrorBanner?: SlotProps<{\n message: string,\n }>;\n SuccessBanner?: SlotProps<{\n message: string,\n }>;\n Title?: SlotProps<{\n text: string,\n }>;\n CommentField?: SlotProps<{\n formErrors: Record<string, string>;\n isFormDisabled: boolean;\n setFormErrors: (errors: Record<string, string>) => void;\n }>;\n QuoteNameField?: SlotProps<{\n formErrors: Record<string, string>;\n isFormDisabled: boolean;\n setFormErrors: (errors: Record<string, string>) => void;\n }>;\n AttachFileField?: SlotProps<{\n onChange: (files: File[]) => void, formErrors: Record<string, string>,\n isFormDisabled: boolean\n }>;\n RequestButton?: SlotProps<{\n requestNegotiableQuote: typeof requestNegotiableQuote;\n formErrors: Record<string, string>;\n isFormDisabled: boolean;\n setIsFormDisabled: (isFormDisabled: boolean) => void;\n }>;\n SaveDraftButton?: SlotProps<{\n requestNegotiableQuote: typeof requestNegotiableQuote;\n formErrors: Record<string, string>;\n isFormDisabled: boolean;\n setIsFormDisabled: (isFormDisabled: boolean) => void;\n }>;\n };\n}\n\nexport const RequestNegotiableQuoteForm: Container<RequestNegotiableQuoteFormProps> = ({\n cartId,\n slots,\n onRequestNegotiableQuote,\n onSaveNegotiableQuote,\n onAttachFiles,\n onSubmitErrors,\n onError,\n className,\n}) => {\n const [comment, setComment] = useState<string | undefined>(undefined);\n const [quoteName, setQuoteName] = useState<string | undefined>(undefined);\n const [attachmentKeys, setAttachmentKeys] = useState<{ key: string }[]>([]);\n const [error, setError] = useState<string | undefined>(undefined);\n const [formErrors, setFormErrors] = useState<Record<string, string>>({});\n const [success, setSuccess] = useState<string | undefined>(undefined);\n const [isFormDisabled, setIsFormDisabled] = useState<boolean>(false);\n\n const dictionary = useText({\n title: 'NegotiableQuote.Request.title',\n comment: 'NegotiableQuote.Request.comment',\n commentError: 'NegotiableQuote.Request.commentError',\n quoteName: 'NegotiableQuote.Request.quoteName',\n quoteNameError: 'NegotiableQuote.Request.quoteNameError',\n attachmentsError: 'NegotiableQuote.Request.attachmentsError',\n requestCta: 'NegotiableQuote.Request.requestCta',\n saveDraftCta: 'NegotiableQuote.Request.saveDraftCta',\n errorHeader: 'NegotiableQuote.Request.error.header',\n unauthenticated: 'NegotiableQuote.Request.error.unauthenticated',\n unauthorized: 'NegotiableQuote.Request.error.unauthorized',\n missingCart: 'NegotiableQuote.Request.error.missingCart',\n successHeader: 'NegotiableQuote.Request.success.header',\n submitSuccess: 'NegotiableQuote.Request.success.submitted',\n draftSuccess: 'NegotiableQuote.Request.success.draftSaved',\n });\n\n useEffect(() => {\n const permissionsEvent = events.on(\n 'quote-management/permissions',\n (permissions: typeof state.permissions) => {\n setError(undefined);\n if (!permissions.requestQuote) {\n setError(dictionary.unauthorized);\n setIsFormDisabled(true);\n }\n },\n { eager: true }\n );\n return () => permissionsEvent?.off();\n }, [dictionary.unauthorized]);\n\n useEffect(() => {\n const authenticatedEvent = events.on(\n 'authenticated',\n (authenticated: boolean) => {\n setError(undefined);\n if (!authenticated) {\n setError(dictionary.unauthenticated);\n setIsFormDisabled(true);\n }\n },\n { eager: true }\n );\n return () => authenticatedEvent?.off();\n }, [dictionary.unauthenticated]);\n\n useEffect(() => {\n if (!cartId) {\n setError(dictionary.missingCart);\n setIsFormDisabled(true);\n }\n }, [cartId, dictionary.missingCart]);\n\n useEffect(() => {\n if (error) {\n onError?.({ error, isFormDisabled, setIsFormDisabled });\n }\n }, [error, onError, isFormDisabled]);\n\n const handleAttachFiles = useCallback(async (files: File[]) => {\n /* istanbul ignore next: defensive guard; */\n if (!files?.length) return;\n\n setFormErrors(prev => ({ ...prev, attachments: '' }));\n\n if (onAttachFiles) {\n try {\n await onAttachFiles(files);\n } catch {\n setFormErrors(prev => ({ ...prev, attachments: dictionary.attachmentsError }));\n }\n return;\n }\n\n try {\n const uploaded = await Promise.all(files.map(uploadFile));\n setAttachmentKeys(uploaded.map(({ key }) => ({ key })));\n } catch {\n setFormErrors(prev => ({ ...prev, attachments: dictionary.attachmentsError }));\n }\n }, [onAttachFiles, dictionary]);\n\n /*\n * This function is used to get the banner node.\n * It can be used to render a success or error banner depending on the success or error state.\n */\n const getBannerNode = () => {\n let inlineAlertProps: InLineAlertProps | undefined;\n let slotProps: any | undefined;\n\n if (success) {\n slotProps = {\n name: 'SuccessBanner',\n slot: slots?.SuccessBanner,\n context: {\n message: success,\n },\n 'data-testid': 'form-success-banner',\n };\n inlineAlertProps = {\n type: 'success',\n variant: 'primary',\n icon: <CheckWithCircle />,\n heading: dictionary.successHeader,\n description: success,\n className: 'request-negotiable-quote-form__success-banner',\n };\n }\n else if (error) {\n slotProps = {\n name: 'ErrorBanner',\n slot: slots?.ErrorBanner,\n context: {\n message: error,\n },\n 'data-testid': 'form-error-banner',\n };\n inlineAlertProps = {\n type: 'error',\n variant: 'primary',\n icon: <WarningFilled />,\n heading: dictionary.errorHeader,\n description: error,\n className: 'request-negotiable-quote-form__error-banner',\n };\n }\n\n if (slotProps && inlineAlertProps) {\n return <Slot {...slotProps}>\n <InLineAlert {...inlineAlertProps} />\n </Slot>;\n }\n\n return undefined;\n }\n\n /*\n * This function is used to validate the parent form of the button that was clicked.\n */\n const validateParentForm = (e: Event) => {\n setFormErrors({});\n const closestForm = (e.target as HTMLElement).closest('form') as HTMLFormElement;\n const formErrors = getFormErrors(closestForm);\n if (Object.keys(formErrors).length > 0) {\n setFormErrors(formErrors);\n onSubmitErrors?.(formErrors);\n }\n };\n\n const formSubmitHandler = (e: Event) => {\n e.preventDefault();\n setIsFormDisabled(true);\n\n const form = (e.target as HTMLFormElement);\n\n const currentFormErrors = getFormErrors(form);\n\n const mergedFormErrors = { ...currentFormErrors, ...formErrors };\n\n if (Object.keys(mergedFormErrors).length > 0) {\n onSubmitErrors?.(mergedFormErrors)\n return;\n }\n\n // Since we have multiple submit buttons, we need to determine which one was clicked.\n const buttonTarget = (e as SubmitEvent).submitter as HTMLButtonElement;\n\n const formValues = getFormValues(form);\n\n setComment(formValues.comment);\n setQuoteName(formValues.quoteName);\n\n const isDraft = buttonTarget?.dataset?.draft === 'true' || false;\n\n const contextData: RequestNegotiableQuoteInput = {\n cartId: cartId!,\n quoteName: formValues.quoteName,\n comment: formValues.comment,\n attachments: attachmentKeys,\n isDraft,\n }\n\n let submitHandler;\n let successMessage;\n\n if (isDraft) {\n submitHandler = onSaveNegotiableQuote ?? requestNegotiableQuote;\n successMessage = dictionary.draftSuccess;\n } else {\n submitHandler = onRequestNegotiableQuote ?? requestNegotiableQuote;\n successMessage = dictionary.submitSuccess;\n }\n\n submitHandler(contextData).then(() => {\n setSuccess(successMessage);\n })\n .catch(error => {\n setError(error.message);\n })\n };\n\n const titleNode = (\n <Slot name=\"Title\" slot={slots?.Title} context={{ text: dictionary.title }}>\n <span data-testid=\"form-title\">{dictionary.title}</span>\n </Slot>\n );\n\n const commentFieldNode = (\n <Slot\n name=\"CommentField\"\n slot={slots?.CommentField}\n context={{\n value: comment,\n required: true,\n errorMessage: formErrors.comment,\n setFormErrors,\n isFormDisabled\n } as any}\n >\n <TextArea\n name=\"comment\"\n value={comment}\n label={dictionary.comment}\n required\n autoComplete=\"off\"\n data-testid=\"form-comment-field\"\n errorMessage={formErrors.comment}\n disabled={isFormDisabled}\n />\n </Slot>\n );\n\n const quoteNameFieldNode = (\n <Slot\n name=\"QuoteNameField\"\n slot={slots?.QuoteNameField}\n context={{\n value: quoteName,\n required: true,\n errorMessage: formErrors.quoteName,\n setFormErrors,\n isFormDisabled\n } as any}\n >\n <Field\n error={formErrors.quoteName}\n disabled={isFormDisabled}\n >\n <Input\n value={quoteName}\n name=\"quoteName\"\n floatingLabel={dictionary.quoteName}\n required\n autoComplete=\"off\"\n data-testid=\"form-quote-name-field\"\n />\n </Field>\n </Slot>\n );\n\n const attachFileNode = (\n <Slot\n name=\"AttachFileField\"\n slot={slots?.AttachFileField}\n context={{ onChange: handleAttachFiles, formErrors, isFormDisabled }}\n >\n <InputFile\n onChange={(e: Event) => {\n const target = e.target as HTMLInputElement;\n const fileList = target?.files;\n const files = fileList ? Array.from(fileList) : [];\n\n if (files.length > 0) {\n void handleAttachFiles(files);\n }\n }}\n icon={<Add />}\n disabled={isFormDisabled}\n data-testid=\"form-attach-file-field\"\n />\n </Slot>\n );\n\n const requestButtonNode = (\n <Slot\n name=\"RequestButton\"\n slot={slots?.RequestButton}\n context={\n {\n requestNegotiableQuote,\n formErrors,\n isFormDisabled,\n setIsFormDisabled\n }\n }\n >\n <Button\n type=\"submit\"\n data-testid=\"form-request-button\"\n onClick={validateParentForm}\n disabled={isFormDisabled}\n >\n {dictionary.requestCta}\n </Button>\n </Slot>\n );\n\n const saveButtonNode = (\n <Slot\n name=\"SaveDraftButton\"\n slot={slots?.SaveDraftButton}\n context={\n {\n requestNegotiableQuote,\n formErrors,\n isFormDisabled,\n setIsFormDisabled\n }\n }\n >\n <Button\n type=\"submit\"\n data-draft=\"true\"\n variant=\"secondary\"\n data-testid=\"form-save-draft-button\"\n onClick={validateParentForm}\n disabled={isFormDisabled}\n >\n {dictionary.saveDraftCta}\n </Button>\n </Slot>\n );\n\n return (\n <RequestNegotiableQuoteFormComponent\n title={titleNode}\n banner={getBannerNode()}\n commentField={commentFieldNode}\n quoteNameField={quoteNameFieldNode}\n attachFile={attachFileNode}\n requestButton={requestButtonNode}\n saveButton={saveButtonNode}\n onSubmit={formSubmitHandler}\n className={className}\n disabled={isFormDisabled}\n data-testid=\"form-container\"\n />\n );\n};\n"],"names":["SvgAdd","props","React","RequestNegotiableQuoteForm","className","title","banner","commentField","quoteNameField","attachFile","requestButton","saveButton","onSubmit","jsxs","classes","jsx","VComponent","cartId","slots","onRequestNegotiableQuote","onSaveNegotiableQuote","onAttachFiles","onSubmitErrors","onError","comment","setComment","useState","quoteName","setQuoteName","attachmentKeys","setAttachmentKeys","error","setError","formErrors","setFormErrors","success","setSuccess","isFormDisabled","setIsFormDisabled","dictionary","useText","useEffect","permissionsEvent","events","permissions","authenticatedEvent","authenticated","handleAttachFiles","useCallback","files","prev","uploaded","uploadFile","key","getBannerNode","inlineAlertProps","slotProps","CheckWithCircle","WarningFilled","Slot","InLineAlert","validateParentForm","e","closestForm","getFormErrors","formSubmitHandler","form","mergedFormErrors","buttonTarget","formValues","getFormValues","isDraft","_a","contextData","submitHandler","successMessage","requestNegotiableQuote","titleNode","commentFieldNode","TextArea","quoteNameFieldNode","Field","Input","attachFileNode","InputFile","target","fileList","Add","requestButtonNode","Button","saveButtonNode","RequestNegotiableQuoteFormComponent"],"mappings":"21BACA,MAAMA,GAAUC,GAA0BC,EAAM,cAAc,MAAO,CAAE,GAAI,gBAAiB,YAAa,gCAAiC,MAAO,6BAA8B,MAAO,GAAI,OAAQ,GAAI,QAAS,YAAa,GAAGD,GAAyBC,EAAM,cAAc,IAAK,CAAE,GAAI,OAAO,EAAoBA,EAAM,cAAc,OAAQ,CAAE,GAAI,iBAAkB,YAAa,iBAAkB,MAAO,GAAI,OAAQ,GAAI,KAAM,OAAQ,QAAS,CAAC,CAAE,EAAmBA,EAAM,cAAc,IAAK,CAAE,GAAI,WAAY,YAAa,WAAY,UAAW,wBAAwB,EAAoBA,EAAM,cAAc,OAAQ,CAAE,aAAc,qBAAsB,GAAI,WAAY,YAAa,WAAY,GAAI,KAAM,UAAW,0BAA2B,KAAM,OAAQ,OAAQ,cAAc,CAAE,EAAmBA,EAAM,cAAc,OAAQ,CAAE,aAAc,qBAAsB,GAAI,WAAY,YAAa,WAAY,GAAI,KAAM,UAAW,0BAA2B,KAAM,OAAQ,OAAQ,eAAgB,CAAC,CAAC,CAAC,ECwB/8BC,GAAiF,CAAC,CAC7F,UAAAC,EACA,MAAAC,EACA,OAAAC,EACA,aAAAC,EACA,eAAAC,EACA,WAAAC,EACA,cAAAC,EACA,WAAAC,EACA,SAAAC,EACA,GAAGX,CACL,IAEIY,EAAC,OAAA,CAAM,GAAGZ,EAAO,UAAWa,EAAQ,CAAC,gCAAiCV,CAAS,CAAC,EAAG,SAAAQ,EAChF,SAAA,CAAAN,GACCS,EAACC,EAAA,CACC,KAAMV,EACN,UAAWQ,EAAQ,CAAC,uCAAuC,CAAC,CAAA,CAAA,EAG/DT,GACCU,EAACC,EAAA,CACC,KAAMX,EACN,UAAWS,EAAQ,CA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AAcwB,EACd,eAAgBE,EAChB,WAAYG,EACZ,cAAeK,EACf,WAAYE,GACZ,SAAUzB,EACV,UAAA7D,EACA,SAAUiC,EACV,cAAY,gBAAA,CAAA,CAGlB","x_google_ignoreList":[0]}
1
+ {"version":3,"file":"RequestNegotiableQuoteForm.js","sources":["../../node_modules/@adobe-commerce/elsie/src/icons/Add.svg","/@dropins/storefront-quote-management/src/components/RequestNegotiableQuoteForm/RequestNegotiableQuoteForm.tsx","/@dropins/storefront-quote-management/src/containers/RequestNegotiableQuoteForm/RequestNegotiableQuoteForm.tsx"],"sourcesContent":["import * as React from \"react\";\nconst SvgAdd = (props) => /* @__PURE__ */ React.createElement(\"svg\", { id: \"Icon_Add_Base\", \"data-name\": \"Icon \\\\u2013 Add \\\\u2013 Base\", xmlns: \"http://www.w3.org/2000/svg\", width: 24, height: 24, viewBox: \"0 0 24 24\", ...props }, /* @__PURE__ */ React.createElement(\"g\", { id: \"Large\" }, /* @__PURE__ */ React.createElement(\"rect\", { id: \"Placement_area\", \"data-name\": \"Placement area\", width: 24, height: 24, fill: \"#fff\", opacity: 0 }), /* @__PURE__ */ React.createElement(\"g\", { id: \"Add_icon\", \"data-name\": \"Add icon\", transform: \"translate(9.734 9.737)\" }, /* @__PURE__ */ React.createElement(\"line\", { vectorEffect: \"non-scaling-stroke\", id: \"Line_579\", \"data-name\": \"Line 579\", y2: 12.7, transform: \"translate(2.216 -4.087)\", fill: \"none\", stroke: \"currentColor\" }), /* @__PURE__ */ React.createElement(\"line\", { vectorEffect: \"non-scaling-stroke\", id: \"Line_580\", \"data-name\": \"Line 580\", x2: 12.7, transform: \"translate(-4.079 2.263)\", fill: \"none\", stroke: \"currentColor\" }))));\nexport default SvgAdd;\n","/********************************************************************\n * Copyright 2025 Adobe\n * All Rights Reserved.\n *\n * NOTICE: Adobe permits you to use, modify, and distribute this \n * file in accordance with the terms of the Adobe license agreement \n * accompanying it. \n *******************************************************************/\n\nimport { FunctionComponent, VNode } from 'preact';\nimport { HTMLAttributes } from 'preact/compat';\nimport { classes, VComponent } from '@adobe-commerce/elsie/lib';\nimport '@/quote-management/components/RequestNegotiableQuoteForm/RequestNegotiableQuoteForm.css';\n\nexport interface RequestNegotiableQuoteFormProps extends Omit<HTMLAttributes<HTMLFormElement>, 'title'> {\n title: VNode;\n banner?: VNode;\n commentField?: VNode;\n quoteNameField?: VNode;\n attachFile?: VNode;\n requestButton?: VNode;\n saveButton?: VNode;\n onSubmit: (e: Event) => void;\n}\n\nexport const RequestNegotiableQuoteForm: FunctionComponent<RequestNegotiableQuoteFormProps> = ({\n className,\n title,\n banner,\n commentField,\n quoteNameField,\n attachFile,\n requestButton,\n saveButton,\n onSubmit,\n ...props\n}) => {\n return (\n <form {...props} className={classes(['request-negotiable-quote-form', className])} onSubmit={onSubmit}>\n {banner &&\n <VComponent\n node={banner}\n className={classes(['request-negotiable-quote-form__banner'])}\n />\n }\n {title &&\n <VComponent\n node={title}\n className={classes(['request-negotiable-quote-form__title'])}\n />\n }\n {commentField &&\n <VComponent\n node={commentField}\n className={classes(['request-negotiable-quote-form__comment-field'])}\n />\n }\n {quoteNameField &&\n <VComponent\n node={quoteNameField}\n className={classes(['request-negotiable-quote-form__quote-name-field'])}\n />\n }\n {attachFile &&\n <VComponent\n node={attachFile}\n className={classes(['request-negotiable-quote-form__attach-file-field'])}\n />\n }\n <div className={classes(['request-negotiable-quote-form__actions'])}>\n {requestButton &&\n <VComponent\n node={requestButton}\n className={classes(['request-negotiable-quote-form__request-button'])}\n />\n }\n {saveButton &&\n <VComponent\n node={saveButton}\n className={classes(['request-negotiable-quote-form__save-button'])}\n />\n }\n </div>\n </form>\n );\n};\n","/********************************************************************\n * Copyright 2025 Adobe\n * All Rights Reserved.\n *\n * NOTICE: Adobe permits you to use, modify, and distribute this \n * file in accordance with the terms of the Adobe license agreement \n * accompanying it. \n *******************************************************************/\n\nimport { HTMLAttributes, useCallback, useEffect, useState } from 'preact/compat';\nimport { Container, getFormErrors, getFormValues, Slot, SlotProps } from '@adobe-commerce/elsie/lib';\nimport { InLineAlert, Button, InputFile, TextArea, Input, Field, InLineAlertProps } from '@adobe-commerce/elsie/components';\nimport { WarningFilled, CheckWithCircle, Add } from '@adobe-commerce/elsie/icons';\nimport RequestNegotiableQuoteFormComponent from '@/quote-management/components/RequestNegotiableQuoteForm';\nimport { useText } from '@adobe-commerce/elsie/i18n';\nimport { events } from '@adobe-commerce/event-bus';\nimport { requestNegotiableQuote, RequestNegotiableQuoteInput, uploadFile } from '@/quote-management/api';\nimport { state } from '@/quote-management/lib/state';\n\nexport type RequestNegotiableQuoteHandlers = {\n onAttachFiles?: (files: File[]) => Promise<void>;\n onRequestNegotiableQuote?: typeof requestNegotiableQuote;\n onSaveNegotiableQuote?: typeof requestNegotiableQuote;\n onSubmitErrors?: (errors: Record<string, string>) => void;\n onError?: (props: {\n error: string,\n isFormDisabled: boolean,\n setIsFormDisabled: (isFormDisabled: boolean) => void,\n }) => void;\n};\n\nexport interface RequestNegotiableQuoteFormProps\n extends Omit<HTMLAttributes<HTMLDivElement>, 'onError'>,\n RequestNegotiableQuoteHandlers {\n cartId: string;\n slots?: {\n ErrorBanner?: SlotProps<{\n message: string,\n }>;\n SuccessBanner?: SlotProps<{\n message: string,\n }>;\n Title?: SlotProps<{\n text: string,\n }>;\n CommentField?: SlotProps<{\n formErrors: Record<string, string>;\n isFormDisabled: boolean;\n setFormErrors: (errors: Record<string, string>) => void;\n }>;\n QuoteNameField?: SlotProps<{\n formErrors: Record<string, string>;\n isFormDisabled: boolean;\n setFormErrors: (errors: Record<string, string>) => void;\n }>;\n AttachFileField?: SlotProps<{\n onChange: (files: File[]) => void, formErrors: Record<string, string>,\n isFormDisabled: boolean\n }>;\n RequestButton?: SlotProps<{\n requestNegotiableQuote: typeof requestNegotiableQuote;\n formErrors: Record<string, string>;\n isFormDisabled: boolean;\n setIsFormDisabled: (isFormDisabled: boolean) => void;\n }>;\n SaveDraftButton?: SlotProps<{\n requestNegotiableQuote: typeof requestNegotiableQuote;\n formErrors: Record<string, string>;\n isFormDisabled: boolean;\n setIsFormDisabled: (isFormDisabled: boolean) => void;\n }>;\n };\n}\n\nexport const RequestNegotiableQuoteForm: Container<RequestNegotiableQuoteFormProps> = ({\n cartId,\n slots,\n onRequestNegotiableQuote,\n onSaveNegotiableQuote,\n onAttachFiles,\n onSubmitErrors,\n onError,\n className,\n}) => {\n const [comment, setComment] = useState<string | undefined>(undefined);\n const [quoteName, setQuoteName] = useState<string | undefined>(undefined);\n const [attachmentKeys, setAttachmentKeys] = useState<{ key: string }[]>([]);\n const [error, setError] = useState<string | undefined>(undefined);\n const [formErrors, setFormErrors] = useState<Record<string, string>>({});\n const [success, setSuccess] = useState<string | undefined>(undefined);\n const [isFormDisabled, setIsFormDisabled] = useState<boolean>(false);\n\n const dictionary = useText({\n title: 'NegotiableQuote.Request.title',\n comment: 'NegotiableQuote.Request.comment',\n commentError: 'NegotiableQuote.Request.commentError',\n quoteName: 'NegotiableQuote.Request.quoteName',\n quoteNameError: 'NegotiableQuote.Request.quoteNameError',\n attachmentsError: 'NegotiableQuote.Request.attachmentsError',\n requestCta: 'NegotiableQuote.Request.requestCta',\n saveDraftCta: 'NegotiableQuote.Request.saveDraftCta',\n errorHeader: 'NegotiableQuote.Request.error.header',\n unauthenticated: 'NegotiableQuote.Request.error.unauthenticated',\n unauthorized: 'NegotiableQuote.Request.error.unauthorized',\n missingCart: 'NegotiableQuote.Request.error.missingCart',\n successHeader: 'NegotiableQuote.Request.success.header',\n submitSuccess: 'NegotiableQuote.Request.success.submitted',\n draftSuccess: 'NegotiableQuote.Request.success.draftSaved',\n });\n\n useEffect(() => {\n const permissionsEvent = events.on(\n 'quote-management/permissions',\n (permissions: typeof state.permissions) => {\n setError(undefined);\n if (!permissions.requestQuote) {\n setError(dictionary.unauthorized);\n setIsFormDisabled(true);\n }\n },\n { eager: true }\n );\n return () => permissionsEvent?.off();\n }, [dictionary.unauthorized]);\n\n useEffect(() => {\n const authenticatedEvent = events.on(\n 'authenticated',\n (authenticated: boolean) => {\n setError(undefined);\n if (!authenticated) {\n setError(dictionary.unauthenticated);\n setIsFormDisabled(true);\n }\n },\n { eager: true }\n );\n return () => authenticatedEvent?.off();\n }, [dictionary.unauthenticated]);\n\n useEffect(() => {\n if (!cartId) {\n setError(dictionary.missingCart);\n setIsFormDisabled(true);\n }\n }, [cartId, dictionary.missingCart]);\n\n useEffect(() => {\n if (error) {\n onError?.({ error, isFormDisabled, setIsFormDisabled });\n }\n }, [error, onError, isFormDisabled]);\n\n const handleAttachFiles = useCallback(async (files: File[]) => {\n /* istanbul ignore next: defensive guard; */\n if (!files?.length) return;\n\n setFormErrors(prev => ({ ...prev, attachments: '' }));\n\n if (onAttachFiles) {\n try {\n await onAttachFiles(files);\n } catch {\n setFormErrors(prev => ({ ...prev, attachments: dictionary.attachmentsError }));\n }\n return;\n }\n\n try {\n const uploaded = await Promise.all(files.map(uploadFile));\n setAttachmentKeys(uploaded.map(({ key }) => ({ key })));\n } catch {\n setFormErrors(prev => ({ ...prev, attachments: dictionary.attachmentsError }));\n }\n }, [onAttachFiles, dictionary]);\n\n /*\n * This function is used to get the banner node.\n * It can be used to render a success or error banner depending on the success or error state.\n */\n const getBannerNode = () => {\n let inlineAlertProps: InLineAlertProps | undefined;\n let slotProps: any | undefined;\n\n if (success) {\n slotProps = {\n name: 'SuccessBanner',\n slot: slots?.SuccessBanner,\n context: {\n message: success,\n },\n 'data-testid': 'form-success-banner',\n };\n inlineAlertProps = {\n type: 'success',\n variant: 'primary',\n icon: <CheckWithCircle />,\n heading: dictionary.successHeader,\n description: success,\n className: 'request-negotiable-quote-form__success-banner',\n };\n }\n else if (error) {\n slotProps = {\n name: 'ErrorBanner',\n slot: slots?.ErrorBanner,\n context: {\n message: error,\n },\n 'data-testid': 'form-error-banner',\n };\n inlineAlertProps = {\n type: 'error',\n variant: 'primary',\n icon: <WarningFilled />,\n heading: dictionary.errorHeader,\n description: error,\n className: 'request-negotiable-quote-form__error-banner',\n };\n }\n\n if (slotProps && inlineAlertProps) {\n return <Slot {...slotProps}>\n <InLineAlert {...inlineAlertProps} />\n </Slot>;\n }\n\n return undefined;\n }\n\n /*\n * This function is used to validate the parent form of the button that was clicked.\n */\n const validateParentForm = (e: Event) => {\n setFormErrors({});\n const closestForm = (e.target as HTMLElement).closest('form') as HTMLFormElement;\n const formErrors = getFormErrors(closestForm);\n if (Object.keys(formErrors).length > 0) {\n setFormErrors(formErrors);\n onSubmitErrors?.(formErrors);\n }\n };\n\n const formSubmitHandler = (e: Event) => {\n e.preventDefault();\n setIsFormDisabled(true);\n\n const form = (e.target as HTMLFormElement);\n\n const currentFormErrors = getFormErrors(form);\n\n const mergedFormErrors = { ...currentFormErrors, ...formErrors };\n\n if (Object.keys(mergedFormErrors).length > 0) {\n onSubmitErrors?.(mergedFormErrors)\n return;\n }\n\n // Since we have multiple submit buttons, we need to determine which one was clicked.\n const buttonTarget = (e as SubmitEvent).submitter as HTMLButtonElement;\n\n const formValues = getFormValues(form);\n\n setComment(formValues.comment);\n setQuoteName(formValues.quoteName);\n\n const isDraft = buttonTarget?.dataset?.draft === 'true' || false;\n\n const contextData: RequestNegotiableQuoteInput = {\n cartId: cartId!,\n quoteName: formValues.quoteName,\n comment: formValues.comment,\n attachments: attachmentKeys,\n isDraft,\n }\n\n let submitHandler;\n let successMessage;\n\n if (isDraft) {\n submitHandler = onSaveNegotiableQuote ?? requestNegotiableQuote;\n successMessage = dictionary.draftSuccess;\n } else {\n submitHandler = onRequestNegotiableQuote ?? requestNegotiableQuote;\n successMessage = dictionary.submitSuccess;\n }\n\n submitHandler(contextData).then(() => {\n setSuccess(successMessage);\n })\n .catch(error => {\n setError(error.message);\n })\n };\n\n const titleNode = (\n <Slot name=\"Title\" slot={slots?.Title} context={{ text: dictionary.title }}>\n <span data-testid=\"form-title\">{dictionary.title}</span>\n </Slot>\n );\n\n const commentFieldNode = (\n <Slot\n name=\"CommentField\"\n slot={slots?.CommentField}\n context={{\n value: comment,\n required: true,\n errorMessage: formErrors.comment,\n setFormErrors,\n isFormDisabled\n } as any}\n >\n <TextArea\n name=\"comment\"\n value={comment}\n label={dictionary.comment}\n required\n autoComplete=\"off\"\n data-testid=\"form-comment-field\"\n errorMessage={formErrors.comment}\n disabled={isFormDisabled}\n />\n </Slot>\n );\n\n const quoteNameFieldNode = (\n <Slot\n name=\"QuoteNameField\"\n slot={slots?.QuoteNameField}\n context={{\n value: quoteName,\n required: true,\n errorMessage: formErrors.quoteName,\n setFormErrors,\n isFormDisabled\n } as any}\n >\n <Field\n error={formErrors.quoteName}\n disabled={isFormDisabled}\n >\n <Input\n value={quoteName}\n name=\"quoteName\"\n floatingLabel={dictionary.quoteName}\n required\n autoComplete=\"off\"\n data-testid=\"form-quote-name-field\"\n />\n </Field>\n </Slot>\n );\n\n const attachFileNode = (\n <Slot\n name=\"AttachFileField\"\n slot={slots?.AttachFileField}\n context={{ onChange: handleAttachFiles, formErrors, isFormDisabled }}\n >\n <InputFile\n onChange={(e: Event) => {\n const target = e.target as HTMLInputElement;\n const fileList = target?.files;\n const files = fileList ? Array.from(fileList) : [];\n\n if (files.length > 0) {\n void handleAttachFiles(files);\n }\n }}\n icon={<Add />}\n disabled={isFormDisabled}\n data-testid=\"form-attach-file-field\"\n />\n </Slot>\n );\n\n const requestButtonNode = (\n <Slot\n name=\"RequestButton\"\n slot={slots?.RequestButton}\n context={\n {\n requestNegotiableQuote,\n formErrors,\n isFormDisabled,\n setIsFormDisabled\n }\n }\n >\n <Button\n type=\"submit\"\n data-testid=\"form-request-button\"\n onClick={validateParentForm}\n disabled={isFormDisabled}\n >\n {dictionary.requestCta}\n </Button>\n </Slot>\n );\n\n const saveButtonNode = (\n <Slot\n name=\"SaveDraftButton\"\n slot={slots?.SaveDraftButton}\n context={\n {\n requestNegotiableQuote,\n formErrors,\n isFormDisabled,\n setIsFormDisabled\n }\n }\n >\n <Button\n type=\"submit\"\n data-draft=\"true\"\n variant=\"secondary\"\n data-testid=\"form-save-draft-button\"\n onClick={validateParentForm}\n disabled={isFormDisabled}\n >\n {dictionary.saveDraftCta}\n </Button>\n </Slot>\n );\n\n return (\n <RequestNegotiableQuoteFormComponent\n title={titleNode}\n banner={getBannerNode()}\n commentField={commentFieldNode}\n quoteNameField={quoteNameFieldNode}\n attachFile={attachFileNode}\n requestButton={requestButtonNode}\n saveButton={saveButtonNode}\n onSubmit={formSubmitHandler}\n className={className}\n disabled={isFormDisabled}\n data-testid=\"form-container\"\n />\n );\n};\n"],"names":["SvgAdd","props","React","RequestNegotiableQuoteForm","className","title","banner","commentField","quoteNameField","attachFile","requestButton","saveButton","onSubmit","jsxs","classes","jsx","VComponent","cartId","slots","onRequestNegotiableQuote","onSaveNegotiableQuote","onAttachFiles","onSubmitErrors","onError","comment","setComment","useState","quoteName","setQuoteName","attachmentKeys","setAttachmentKeys","error","setError","formErrors","setFormErrors","success","setSuccess","isFormDisabled","setIsFormDisabled","dictionary","useText","useEffect","permissionsEvent","events","permissions","authenticatedEvent","authenticated","handleAttachFiles","useCallback","files","prev","uploaded","uploadFile","key","getBannerNode","inlineAlertProps","slotProps","CheckWithCircle","WarningFilled","Slot","InLineAlert","validateParentForm","e","closestForm","getFormErrors","formSubmitHandler","form","mergedFormErrors","buttonTarget","formValues","getFormValues","isDraft","_a","contextData","submitHandler","successMessage","requestNegotiableQuote","titleNode","commentFieldNode","TextArea","quoteNameFieldNode","Field","Input","attachFileNode","InputFile","target","fileList","Add","requestButtonNode","Button","saveButtonNode","RequestNegotiableQuoteFormComponent"],"mappings":"y1BACA,MAAMA,GAAUC,GAA0BC,EAAM,cAAc,MAAO,CAAE,GAAI,gBAAiB,YAAa,gCAAiC,MAAO,6BAA8B,MAAO,GAAI,OAAQ,GAAI,QAAS,YAAa,GAAGD,GAAyBC,EAAM,cAAc,IAAK,CAAE,GAAI,OAAO,EAAoBA,EAAM,cAAc,OAAQ,CAAE,GAAI,iBAAkB,YAAa,iBAAkB,MAAO,GAAI,OAAQ,GAAI,KAAM,OA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AAW,MAAM,KAAKA,CAAQ,EAAI,CAAA,EAE5CrC,EAAM,OAAS,GACZF,EAAkBE,CAAK,CAEhC,EACA,OAAOsC,GAAA,EAAI,EACX,SAAUlD,EACV,cAAY,wBAAA,CAAA,CACd,CAAA,EAIEmD,EACJzE,EAAC4C,EAAA,CACC,KAAK,gBACL,KAAMzC,GAAA,YAAAA,EAAO,cACb,QACE,CACE,uBAAA0D,EACA,WAAA3C,EACA,eAAAI,EACA,kBAAAC,CAAA,EAIJ,SAAAvB,EAAC0E,EAAA,CACC,KAAK,SACL,cAAY,sBACZ,QAAS5B,EACT,SAAUxB,EAET,SAAAE,EAAW,UAAA,CAAA,CACd,CAAA,EAIEmD,GACJ3E,EAAC4C,EAAA,CACC,KAAK,kBACL,KAAMzC,GAAA,YAAAA,EAAO,gBACb,QACE,CACE,uBAAA0D,EACA,WAAA3C,EACA,eAAAI,EACA,kBAAAC,CAAA,EAIJ,SAAAvB,EAAC0E,EAAA,CACC,KAAK,SACL,aAAW,OACX,QAAQ,YACR,cAAY,yBACZ,QAAS5B,EACT,SAAUxB,EAET,SAAAE,EAAW,YAAA,CAAA,CACd,CAAA,EAIJ,OACExB,EAAC4E,GAAA,CACC,MAAOd,EACP,OAAQvB,EAAA,EACR,aAAcwB,EACd,eAAgBE,EAChB,WAAYG,EACZ,cAAeK,EACf,WAAYE,GACZ,SAAUzB,EACV,UAAA7D,EACA,SAAUiC,EACV,cAAY,gBAAA,CAAA,CAGlB","x_google_ignoreList":[0]}
@@ -6,7 +6,6 @@
6
6
  * file in accordance with the terms of the Adobe license agreement
7
7
  * accompanying it.
8
8
  *******************************************************************/
9
- export * from './customer-model';
10
9
  export * from './negotiable-quote-model';
11
10
  export * from './negotiable-quote-template-model';
12
11
  export * from './store-config-model';
@@ -7,7 +7,6 @@
7
7
  * accompanying it.
8
8
  *******************************************************************/
9
9
  export * from './transform-store-config';
10
- export * from './transform-customer';
11
10
  export * from './transform-quote';
12
11
  export * from './transform-quote-template';
13
12
  //# sourceMappingURL=index.d.ts.map
package/lib/state.d.ts CHANGED
@@ -6,6 +6,9 @@ export declare const DEFAULT_PERMISSIONS: {
6
6
  editQuote: boolean;
7
7
  deleteQuote: boolean;
8
8
  checkoutQuote: boolean;
9
+ viewQuoteTemplates: boolean;
10
+ manageQuoteTemplates: boolean;
11
+ generateQuoteFromTemplate: boolean;
9
12
  };
10
13
  export declare const DEFAULT_CONFIG: StoreConfigModel;
11
14
  export declare const state: State;
package/package.json CHANGED
@@ -1 +1 @@
1
- {"name": "@dropins/storefront-quote-management", "version": "0.0.1-alpha22", "@dropins/tools": "1.6.0-beta2", "license": "SEE LICENSE IN LICENSE.md"}
1
+ {"name": "@dropins/storefront-quote-management", "version": "0.0.1-alpha23", "@dropins/tools": "1.6.0-beta2", "license": "SEE LICENSE IN LICENSE.md"}
@@ -7,6 +7,12 @@ export type State = {
7
7
  editQuote: boolean;
8
8
  deleteQuote: boolean;
9
9
  checkoutQuote: boolean;
10
+ /** Permission to view quote templates */
11
+ viewQuoteTemplates: boolean;
12
+ /** Permission to manage (create, edit, delete) quote templates */
13
+ manageQuoteTemplates: boolean;
14
+ /** Permission to generate quotes from templates */
15
+ generateQuoteFromTemplate: boolean;
10
16
  };
11
17
  config: StoreConfigModel;
12
18
  };
@@ -0,0 +1,39 @@
1
+ import { State } from '../types/state.types';
2
+
3
+ /**
4
+ * Type definition for the auth/permissions event payload
5
+ * Contains flat Adobe Commerce permission keys with boolean values
6
+ */
7
+ export type AuthPermissionsPayload = {
8
+ all?: boolean;
9
+ 'Magento_NegotiableQuote::all'?: boolean;
10
+ 'Magento_NegotiableQuote::manage'?: boolean;
11
+ 'Magento_NegotiableQuote::checkout'?: boolean;
12
+ 'Magento_NegotiableQuoteTemplate::all'?: boolean;
13
+ 'Magento_NegotiableQuoteTemplate::view_template'?: boolean;
14
+ 'Magento_NegotiableQuoteTemplate::manage'?: boolean;
15
+ 'Magento_NegotiableQuoteTemplate::generate_quote'?: boolean;
16
+ [key: string]: boolean | undefined;
17
+ };
18
+ /**
19
+ * Maps the auth/permissions event payload to internal permissions structure.
20
+ *
21
+ * Implements hierarchical permission checking:
22
+ * 1. Top-level "all": If true, grants all permissions
23
+ * 2. Module-level "::all": Grants all permissions for that module
24
+ * 3. Specific permissions: Maps individual keys to internal flags
25
+ *
26
+ * @param payload - The raw auth/permissions event payload
27
+ * @returns Typed permissions object matching the state structure
28
+ *
29
+ * @example
30
+ * ```typescript
31
+ * const permissions = mapAuthPermissions({
32
+ * "Magento_NegotiableQuote::manage": true,
33
+ * "Magento_NegotiableQuote::checkout": true
34
+ * });
35
+ * // Returns: { requestQuote: true, editQuote: true, deleteQuote: true, checkoutQuote: true, ... }
36
+ * ```
37
+ */
38
+ export declare function mapAuthPermissions(payload: AuthPermissionsPayload | null | undefined): State['permissions'];
39
+ //# sourceMappingURL=mapAuthPermissions.d.ts.map
@@ -1,10 +0,0 @@
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 declare const getCustomerData: () => Promise<import('../../data/models/customer-model').CustomerModel>;
10
- //# sourceMappingURL=getCustomerData.d.ts.map
@@ -1,2 +0,0 @@
1
- export declare const CUSTOMER_QUERY: string;
2
- //# sourceMappingURL=CustomerQuery.d.ts.map
@@ -1,10 +0,0 @@
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 './getCustomerData';
10
- //# sourceMappingURL=index.d.ts.map
@@ -1,2 +0,0 @@
1
- export declare const CUSTOMER_FRAGMENT = "\n fragment CUSTOMER_FRAGMENT on Customer {\n role {\n permissions {\n text\n children {\n text\n children {\n text\n children {\n text\n }\n }\n }\n }\n }\n }\n";
2
- //# sourceMappingURL=CustomerFragment.d.ts.map
@@ -1,4 +0,0 @@
1
- /*! Copyright 2025 Adobe
2
- All Rights Reserved. */
3
- import{FetchGraphQL as D}from"@dropins/tools/fetch-graphql.js";import{s as g}from"./state.js";var x=(e=>(e.NEW="NEW",e.SUBMITTED="SUBMITTED",e.PENDING="PENDING",e.UPDATED="UPDATED",e.OPEN="OPEN",e.ORDERED="ORDERED",e.CLOSED="CLOSED",e.DECLINED="DECLINED",e.EXPIRED="EXPIRED",e.DRAFT="DRAFT",e))(x||{});const{setEndpoint:M,setFetchGraphQlHeader:z,removeFetchGraphQlHeader:B,setFetchGraphQlHeaders:G,fetchGraphQl:W,getConfig:H}=new D().getMethods(),b=["DRAFT","UPDATED","DECLINED","EXPIRED","NEW","OPEN"];function P(e){if(!e.items)return 0;const r=g.config;return(r==null?void 0:r.quoteSummaryDisplayTotal)===0?e.items.length:(r==null?void 0:r.quoteSummaryDisplayTotal)===1?e.total_quantity:e.items.length}function w(e){var n,c,i,l;const r=g.config;return{src:r!=null&&r.useConfigurableParentThumbnail?e.product.thumbnail.url:((c=(n=e.configured_variant)==null?void 0:n.thumbnail)==null?void 0:c.url)||e.product.thumbnail.url,alt:r!=null&&r.useConfigurableParentThumbnail?e.product.thumbnail.label:((l=(i=e.configured_variant)==null?void 0:i.thumbnail)==null?void 0:l.label)||e.product.thumbnail.label}}function C(e){var r;return((r=e.links)==null?void 0:r.length)>0?{count:e.links.length,result:e.links.map(n=>n.title).join(", ")}:null}function T(e,r){return e!=null&&e.length&&[...e].sort((c,i)=>i.quantity-c.quantity).find(c=>r>=c.quantity)||null}function A(e){var s,o;const r=e.quantity,n=e.__typename==="ConfigurableCartItem",c=n?(s=e.configured_variant)==null?void 0:s.price_tiers:e.product.price_tiers,i=n?(o=e.configured_variant)==null?void 0:o.price_range:e.product.price_range,l=T(c,r);return l?l.discount.amount_off>0:(i==null?void 0:i.maximum_price.discount.amount_off)>0}function O(e){var i,l,s,o,d,a,u,p;const r=e.quantity,n=T(e.product.price_tiers,r);if(n)return Math.round(n.discount.percent_off);let c;if(e.__typename==="ConfigurableCartItem")c=(o=(s=(l=(i=e==null?void 0:e.configured_variant)==null?void 0:i.price_range)==null?void 0:l.maximum_price)==null?void 0:s.discount)==null?void 0:o.percent_off;else{if(e.__typename==="BundleCartItem")return;c=(p=(u=(a=(d=e==null?void 0:e.product)==null?void 0:d.price_range)==null?void 0:a.maximum_price)==null?void 0:u.discount)==null?void 0:p.percent_off}if(c!==0)return Math.round(c)}function R(e){var r,n,c,i;return e.__typename==="ConfigurableCartItem"?{value:(n=(r=e.configured_variant)==null?void 0:r.price_range)==null?void 0:n.maximum_price.regular_price.value,currency:(i=(c=e.configured_variant)==null?void 0:c.price_range)==null?void 0:i.maximum_price.regular_price.currency}:{value:e.prices.original_item_price.value,currency:e.prices.original_item_price.currency}}function N(e){var c,i,l,s,o,d;let r,n;if(r=((i=(c=e==null?void 0:e.prices)==null?void 0:c.original_row_total)==null?void 0:i.value)-((s=(l=e==null?void 0:e.prices)==null?void 0:l.row_total)==null?void 0:s.value),n=(d=(o=e==null?void 0:e.prices)==null?void 0:o.row_total)==null?void 0:d.currency,r!==0)return{value:r,currency:n}}function S(e){var n,c,i,l,s,o,d;const r=I(e);return{uid:e.uid,name:e.name,createdAt:e.created_at,updatedAt:e.updated_at,expirationDate:e.expiration_date,status:r?x.NEW:e.status,isVirtual:!!e.is_virtual,salesRepName:e.sales_rep_name,buyer:{firstname:e.buyer.firstname,lastname:e.buyer.lastname},templateName:e.template_name,totalQuantity:P(e),comments:(n=e.comments)==null?void 0:n.map(a=>{const u={uid:a.uid,createdAt:a.created_at,author:{firstname:a.author.firstname,lastname:a.author.lastname},text:a.text};return Array.isArray(a.attachments)&&a.attachments.length>0&&(u.attachments=a.attachments.map(p=>({name:p.name,url:p.url}))),u}),prices:e.prices&&{appliedDiscounts:(c=e.prices.discounts)==null?void 0:c.map(a=>({amount:{value:a.amount.value,currency:a.amount.currency},label:a.label,coupon:a.coupon})),appliedTaxes:(i=e.prices.applied_taxes)==null?void 0:i.map(a=>({amount:{value:a.amount.value,currency:a.amount.currency},label:a.label})),discount:e.prices.discounts&&e.prices.grand_total&&E(e.prices.discounts,e.prices.grand_total.currency),grandTotal:e.prices.grand_total&&{value:e.prices.grand_total.value,currency:e.prices.grand_total.currency},grandTotalExcludingTax:e.prices.grand_total_excluding_tax&&{value:e.prices.grand_total_excluding_tax.value,currency:e.prices.grand_total_excluding_tax.currency},subtotalExcludingTax:e.prices.subtotal_excluding_tax&&{value:e.prices.subtotal_excluding_tax.value,currency:e.prices.subtotal_excluding_tax.currency},subtotalIncludingTax:e.prices.subtotal_including_tax&&{value:e.prices.subtotal_including_tax.value,currency:e.prices.subtotal_including_tax.currency},subtotalWithDiscountExcludingTax:e.prices.subtotal_with_discount_excluding_tax&&{value:e.prices.subtotal_with_discount_excluding_tax.value,currency:e.prices.subtotal_with_discount_excluding_tax.currency},...Q(e),totalTax:e.prices.applied_taxes&&e.prices.grand_total&&E(e.prices.applied_taxes,e.prices.grand_total.currency)},history:(l=e.history)==null?void 0:l.map(a=>{var u,p,f,m,v,y,h;return{uid:a.uid,createdAt:a.created_at,author:{firstname:a.author.firstname,lastname:a.author.lastname},changeType:a.change_type,changes:{commentAdded:((u=a.changes)==null?void 0:u.comment_added)&&{comment:a.changes.comment_added.comment},customChanges:((p=a.changes)==null?void 0:p.custom_changes)&&{new_value:a.changes.custom_changes.new_value,old_value:a.changes.custom_changes.old_value,title:a.changes.custom_changes.title},expiration:((f=a.changes)==null?void 0:f.expiration)&&{newExpiration:a.changes.expiration.new_expiration,oldExpiration:a.changes.expiration.old_expiration},productsRemoved:((m=a.changes)==null?void 0:m.products_removed)&&{productsRemovedFromCatalog:a.changes.products_removed.products_removed_from_catalog||[],productsRemovedFromQuote:a.changes.products_removed.products_removed_from_quote||[]},statuses:((v=a.changes)==null?void 0:v.statuses)&&{changes:((y=a.changes.statuses.changes)==null?void 0:y.map(t=>({newStatus:t.new_status,oldStatus:t.old_status})))||[]},total:((h=a.changes)==null?void 0:h.total)&&a.changes.total.new_price&&a.changes.total.old_price&&{newPrice:{value:a.changes.total.new_price.value,currency:a.changes.total.new_price.currency},oldPrice:{value:a.changes.total.old_price.value,currency:a.changes.total.old_price.currency}}}}}),items:((s=e.items)==null?void 0:s.map(a=>{var u,p,f,m,v,y,h;return{itemType:a.__typename,uid:a.uid,product:{uid:a.product.uid,sku:a.product.sku,name:a.product.name,priceRange:{maximumPrice:{regularPrice:{value:a.product.price_range.maximum_price.regular_price.value,currency:a.product.price_range.maximum_price.regular_price.currency}}}},image:w(a),links:C(a),discounted:A(a),discountedTotal:{value:a.prices.row_total.value,currency:a.prices.row_total.currency},catalogDiscount:{amountOff:a.prices.catalog_discount.amount_off,percentOff:a.prices.catalog_discount.percent_off},discounts:((p=(u=a.prices)==null?void 0:u.discounts)==null?void 0:p.map(t=>({label:t.label,value:t.value,amount:{value:t.amount.value,currency:t.amount.currency}})))??[],discountPercentage:O(a),insufficientQuantity:(a.__typename==="ConfigurableCartItem"?a.configured_variant:a.product).stock_status==="IN_STOCK"&&!a.is_available,outOfStock:a.product.stock_status==="OUT_OF_STOCK",stockStatus:a.product.stock_status,quantity:a.quantity,prices:{regularPrice:R(a),priceIncludingTax:{value:a.prices.price_including_tax.value,currency:a.prices.price_including_tax.currency},originalItemPrice:{value:a.prices.original_item_price.value,currency:a.prices.original_item_price.currency},originalRowTotal:{value:a.prices.original_row_total.value,currency:a.prices.original_row_total.currency},rowTotal:{value:a.prices.row_total.value,currency:a.prices.row_total.currency},rowTotalIncludingTax:{value:a.prices.row_total_including_tax.value,currency:a.prices.row_total_including_tax.currency}},savingsAmount:N(a),noteFromBuyer:(f=a.note_from_buyer)==null?void 0:f.map(t=>({createdAt:t.created_at,creatorId:t.creator_id,creatorType:t.creator_type,negotiableQuoteItemUid:t.negotiable_quote_item_uid,note:t.note,noteUid:t.note_uid})),noteFromSeller:(m=a.note_from_seller)==null?void 0:m.map(t=>({createdAt:t.created_at,creatorId:t.creator_id,creatorType:t.creator_type,negotiableQuoteItemUid:t.negotiable_quote_item_uid,note:t.note,noteUid:t.note_uid})),configurableOptions:(v=a.configurable_options)==null?void 0:v.map(t=>({optionLabel:t.option_label,valueLabel:t.value_label})),bundleOptions:(y=a.bundle_options)==null?void 0:y.map(t=>({label:t.label,values:t.values.map(_=>({label:_.label,quantity:_.quantity,originalPrice:{value:_.original_price.value,currency:_.original_price.currency},price:{value:_.priceV2.value,currency:_.priceV2.currency}}))})),customizableOptions:(h=a.customizable_options)==null?void 0:h.map(t=>({type:t.type,label:t.label,values:t.values.map(_=>({label:_.label,value:_.value}))}))}}))||[],shippingAddresses:(o=e.shipping_addresses)==null?void 0:o.map(a=>{const u={uid:a.uid,firstname:a.firstname,lastname:a.lastname,company:a.company,street:a.street,city:a.city,postcode:a.postcode,country:{code:a.country.code,label:a.country.label},telephone:a.telephone};return a.region&&(u.region={code:a.region.code,label:a.region.label,regionId:a.region.region_id}),u}),canCheckout:["UPDATED","DECLINED","OPEN"].includes(e.status)&&g.permissions.checkoutQuote&&((d=e.shipping_addresses)==null?void 0:d.length)>0,canSendForReview:(r||b.includes(e.status))&&g.permissions.editQuote,canUpdateQuote:(r||b.includes(e.status))&&g.permissions.editQuote,canDelete:!["PENDING","SUBMITTED","ORDERED"].includes(e.status)&&g.permissions.deleteQuote,canClose:e.status?!["DRAFT","CLOSED","ORDERED","OPEN"].includes(e.status):!1}}function V(e){return e?S(e):null}function I(e){return e.status==="SUBMITTED"&&!(e.history??[]).some(r=>{var n,c;return r.change_type==="UPDATED"&&(((c=(n=r.changes)==null?void 0:n.statuses)==null?void 0:c.changes)??[]).length>0})}function U(e){const r=I(e);return{uid:e.uid,name:e.name,createdAt:e.created_at,updatedAt:e.updated_at,status:r?x.NEW:e.status,buyer:{firstname:e.buyer.firstname,lastname:e.buyer.lastname},templateName:e.template_name,prices:{grandTotal:{value:e.prices.grand_total.value,currency:e.prices.grand_total.currency}}}}function X(e){var c;if(!e)return null;const r={items:((c=e.items)==null?void 0:c.filter(i=>i==null?void 0:i.uid).map(U))||[],pageInfo:{currentPage:e.page_info.current_page,pageSize:e.page_info.page_size,totalPages:e.page_info.total_pages},totalCount:e.total_count,sortFields:e.sort_fields?{default:e.sort_fields.default,options:e.sort_fields.options}:void 0},n=F(r);return{...r,paginationInfo:n||void 0}}function F(e){if(!(e!=null&&e.pageInfo)||!e.totalCount)return null;const{currentPage:r,pageSize:n,totalPages:c}=e.pageInfo,{totalCount:i}=e,l=i>0?(r-1)*n+1:0,s=Math.min(r*n,i);return{currentPage:r,totalCount:i,pageSize:n,startItem:l,endItem:s,totalPages:c,pageSizeOptions:[20,30,50,100,200]}}const K=()=>[20,30,50,100,200];function E(e,r){return e!=null&&e.length?e.reduce((n,c)=>({value:n.value+c.amount.value,currency:c.amount.currency}),{value:0,currency:r}):{value:0,currency:r}}function Q(e){var c;if(!e||!((c=e.shipping_addresses)!=null&&c.length))return{};const n=e.shipping_addresses[0].selected_shipping_method;return n?{shippingIncludingTax:n.price_incl_tax&&{value:n.price_incl_tax.value,currency:n.price_incl_tax.currency},shippingExcludingTax:n.price_excl_tax&&{value:n.price_excl_tax.value,currency:n.price_excl_tax.currency}}:{}}export{X as a,z as b,G as c,H as d,W as f,K as g,B as r,M as s,V as t};
4
- //# sourceMappingURL=transform-quote.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"transform-quote.js","sources":["/@dropins/storefront-quote-management/src/data/models/negotiable-quote-model.ts","/@dropins/storefront-quote-management/src/api/fetch-graphql/fetch-graphql.ts","/@dropins/storefront-quote-management/src/data/transforms/transform-quote.ts"],"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\nexport interface ShippingAddress {\n /**\n * The unique string identifier of the address\n */\n uid?: string;\n firstname: string;\n lastname: string;\n company?: string;\n street: string[];\n city: string;\n region?: {\n code: string;\n label: string;\n regionId: number;\n };\n postcode: string;\n country: {\n code: string;\n label: string;\n };\n telephone: string;\n}\n\nexport interface NegotiableQuoteModel {\n uid: string;\n name: string;\n createdAt: string;\n salesRepName: string;\n expirationDate: string;\n updatedAt: string;\n status: NegotiableQuoteStatus;\n isVirtual: boolean;\n buyer: {\n firstname: string;\n lastname: string;\n };\n templateName?: string;\n totalQuantity: number;\n comments?: {\n uid: string;\n createdAt: string;\n author: {\n firstname: string;\n lastname: string;\n };\n text: string;\n attachments?: {\n name: string;\n url: string;\n }[];\n }[];\n history?: NegotiableQuoteHistoryEntry[];\n prices: {\n appliedDiscounts?: Discount[];\n appliedTaxes?: Tax[];\n discount?: Currency;\n grandTotal?: Currency;\n grandTotalExcludingTax?: Currency;\n shippingExcludingTax?: Currency;\n shippingIncludingTax?: Currency;\n subtotalExcludingTax?: Currency;\n subtotalIncludingTax?: Currency;\n subtotalWithDiscountExcludingTax?: Currency;\n totalTax?: Currency;\n };\n items: NegotiableQuoteCartItem[];\n shippingAddresses?: ShippingAddress[];\n canCheckout: boolean;\n canSendForReview: boolean;\n lockedForEditing?: boolean;\n canDelete: boolean;\n canClose: boolean;\n canUpdateQuote: boolean;\n}\n\nexport interface ConfigurableOption {\n optionLabel: string;\n valueLabel: string;\n}\n\nexport interface BundleOption {\n label: string;\n values: {\n label: string;\n quantity: number;\n originalPrice: Currency;\n price: Currency;\n }[];\n}\n\nexport interface CustomizableOption {\n type: string;\n label: string;\n values: {\n label: string;\n value: string;\n }[];\n}\n\nexport interface NegotiableQuoteCartItem {\n itemType: string;\n uid: string;\n product: {\n uid: string;\n sku: string;\n name: string;\n templateId?: string;\n templateName?: string;\n priceRange: {\n maximumPrice: {\n regularPrice: Currency;\n };\n };\n };\n image: ItemImage;\n links?: ItemLinks;\n discounted: boolean;\n discountedTotal: Currency;\n catalogDiscount: {\n amountOff: number;\n percentOff: number;\n };\n discounts: {\n label: string;\n value: string;\n amount: Currency;\n }[];\n discountPercentage?: number;\n insufficientQuantity?: boolean;\n outOfStock?: boolean;\n stockStatus: string;\n quantity: number;\n prices: {\n regularPrice: Currency;\n priceIncludingTax: Currency;\n originalItemPrice: Currency;\n originalRowTotal: Currency;\n rowTotal: Currency;\n rowTotalIncludingTax: Currency;\n };\n savingsAmount?: Currency;\n configurableOptions?: ConfigurableOption[];\n bundleOptions?: BundleOption[];\n customizableOptions?: CustomizableOption[];\n noteFromBuyer?: ItemNote[];\n noteFromSeller?: ItemNote[];\n}\n\ninterface ItemImage {\n src: string;\n alt: string;\n}\n\ninterface ItemLinks {\n count: number;\n result: string;\n}\n\nexport interface ItemNote {\n createdAt: string;\n creatorId: number;\n creatorType: number;\n negotiableQuoteItemUid: string;\n note: string;\n noteUid: string;\n}\n\nexport interface Currency {\n value: number;\n currency: string;\n}\n\nexport interface Tax {\n amount: Currency;\n label: string;\n}\n\nexport interface Discount {\n amount: Currency;\n label: string;\n coupon?: Coupon;\n}\n\nexport interface Coupon {\n code: string;\n}\n\nexport interface NegotiableQuoteListEntry {\n uid: string;\n name: string;\n createdAt: string;\n updatedAt: string;\n status: NegotiableQuoteStatus;\n buyer: {\n firstname: string;\n lastname: string;\n };\n templateName: string;\n prices: {\n grandTotal: Currency;\n };\n}\nexport interface NegotiableQuotesListModel {\n items: NegotiableQuoteListEntry[];\n pageInfo: {\n currentPage: number;\n pageSize: number;\n totalPages: number;\n };\n totalCount: number;\n paginationInfo?: PaginationInfo;\n sortFields?: {\n default: string;\n options: Array<{\n label: string;\n value: string;\n }>;\n };\n}\n\nexport interface NegotiableQuoteHistoryEntry {\n author: {\n firstname: string;\n lastname: string;\n };\n changeType: NegotiableQuoteHistoryEntryChangeType;\n changes: {\n commentAdded?: {\n comment: string;\n };\n customChanges?: {\n new_value: string;\n old_value: string;\n title: string;\n };\n expiration?: {\n newExpiration: string;\n oldExpiration: string;\n };\n productsRemoved?: {\n productsRemovedFromCatalog: string[];\n productsRemovedFromQuote?: {\n uid: string;\n name: string;\n sku: string;\n quantity: number;\n }[];\n };\n statuses?: {\n changes: {\n newStatus: string;\n oldStatus: string;\n }[];\n };\n total?: {\n newPrice: Currency;\n oldPrice: Currency;\n };\n };\n createdAt: string;\n uid: string;\n}\n\nexport enum NegotiableQuoteHistoryEntryChangeType {\n CREATED = 'CREATED',\n UPDATED = 'UPDATED',\n CLOSED = 'CLOSED',\n UPDATED_BY_SYSTEM = 'UPDATED_BY_SYSTEM',\n}\n\n// See: https://experienceleague.adobe.com/en/docs/commerce-admin/b2b/quotes/quotes#quote-status\nexport enum NegotiableQuoteStatus {\n NEW = 'NEW', // Currently not returned by the API, but is used to indicate a new quote\n SUBMITTED = 'SUBMITTED',\n PENDING = 'PENDING',\n UPDATED = 'UPDATED',\n OPEN = 'OPEN',\n ORDERED = 'ORDERED',\n CLOSED = 'CLOSED',\n DECLINED = 'DECLINED',\n EXPIRED = 'EXPIRED',\n DRAFT = 'DRAFT',\n}\n\nexport interface PaginationInfo {\n currentPage: number;\n totalCount: number;\n pageSize: number;\n startItem: number;\n endItem: number;\n totalPages: number;\n pageSizeOptions?: number[];\n}\n","import { FetchGraphQL } from '@adobe-commerce/fetch-graphql';\n\nexport const {\n setEndpoint,\n setFetchGraphQlHeader,\n removeFetchGraphQlHeader,\n setFetchGraphQlHeaders,\n fetchGraphQl,\n getConfig,\n} = new FetchGraphQL().getMethods();\n","/********************************************************************\n * Copyright 2025 Adobe\n * All Rights Reserved.\n *\n * NOTICE: Adobe permits you to use, modify, and distribute this\n * file in accordance with the terms of the Adobe license agreement\n * accompanying it.\n *******************************************************************/\n\nimport {\n NegotiableQuoteListEntry,\n NegotiableQuoteModel,\n NegotiableQuotesListModel,\n NegotiableQuoteStatus,\n PaginationInfo,\n ShippingAddress,\n} from '@/quote-management/data/models/negotiable-quote-model';\nimport { state } from '@/quote-management/lib/state';\n\n// Quote statuses that allow editing/sending for review\nconst EDITABLE_QUOTE_STATUSES = [\n 'DRAFT',\n 'UPDATED',\n 'DECLINED',\n 'EXPIRED',\n 'NEW',\n 'OPEN',\n] as const;\n\n// Helper function to get the total quantity of a quote (number of quote line items or total quantity)\nfunction getTotalQuantity(quote: any) {\n if (!quote.items) return 0;\n\n const config = state.config;\n\n if (config?.quoteSummaryDisplayTotal === 0) return quote.items.length;\n if (config?.quoteSummaryDisplayTotal === 1) return quote.total_quantity;\n // Default to items count if unexpected config value or error returned\n return quote.items.length;\n}\n\n// Helper function to get the image for a cart item component\nfunction getImage(item: any) {\n const config = state.config;\n\n return {\n // Use parent thumbnail if configured, otherwise use own variant. Use the parent thumbnail as a fallback\n src: config?.useConfigurableParentThumbnail\n ? item.product.thumbnail.url\n : item.configured_variant?.thumbnail?.url || item.product.thumbnail.url,\n alt: config?.useConfigurableParentThumbnail\n ? item.product.thumbnail.label\n : item.configured_variant?.thumbnail?.label ||\n item.product.thumbnail.label,\n };\n}\n\n// Helper function to get downloadable links for a cart item component\nfunction getLinks(item: any) {\n return item.links?.length > 0\n ? {\n count: item.links.length,\n result: item.links.map((link: any) => link.title).join(', '),\n }\n : null;\n}\n\n/**\n * Finds the most applicable price tier for a given quantity\n * @param priceTiers - Array of price tier objects\n * @param quantity - Current item quantity\n * @returns The applicable tier or null if none found\n */\nfunction findApplicablePriceTier(priceTiers: any[], quantity: number) {\n if (!priceTiers?.length) return null;\n\n // Sort price tiers by quantity in descending order to find the highest applicable tier\n const sortedTiers = [...priceTiers].sort(\n (a: any, b: any) => b.quantity - a.quantity\n );\n\n // Find the highest tier where the current quantity meets or exceeds the tier's minimum quantity\n return sortedTiers.find((tier: any) => quantity >= tier.quantity) || null;\n}\n\n// Helper function to check if an item is discounted\nfunction getDiscounted(item: any) {\n const quantity = item.quantity;\n const isConfigurable = item.__typename === 'ConfigurableCartItem';\n\n // Get price tiers and price range based on item type\n const priceTiers = isConfigurable\n ? item.configured_variant?.price_tiers\n : item.product.price_tiers;\n const priceRange = isConfigurable\n ? item.configured_variant?.price_range\n : item.product.price_range;\n\n // Check price tiers first for discount eligibility\n const applicableTier = findApplicablePriceTier(priceTiers, quantity);\n if (applicableTier) {\n return applicableTier.discount.amount_off > 0;\n }\n\n // Fallback to regular price range discount\n return priceRange?.maximum_price.discount.amount_off > 0;\n}\n\n// Helper function to get the discount percentage of an item\nfunction getDiscountPercentage(item: any) {\n const quantity = item.quantity;\n\n // Check price tiers first for discount percentage\n const applicableTier = findApplicablePriceTier(\n item.product.price_tiers,\n quantity\n );\n\n if (applicableTier) {\n return Math.round(applicableTier.discount.percent_off);\n }\n\n // Fallback to product-specific discount percentage\n let percent_off;\n\n if (item.__typename === 'ConfigurableCartItem') {\n percent_off =\n item?.configured_variant?.price_range?.maximum_price?.discount\n ?.percent_off;\n } else if (item.__typename === 'BundleCartItem') {\n return undefined;\n } else {\n percent_off =\n item?.product?.price_range?.maximum_price?.discount?.percent_off;\n }\n\n if (percent_off === 0) {\n return undefined;\n }\n\n return Math.round(percent_off);\n}\n\n// Helper function to get the regular price of an item\nfunction getRegularPrice(item: any) {\n if (item.__typename === 'ConfigurableCartItem') {\n return {\n value:\n item.configured_variant?.price_range?.maximum_price.regular_price.value,\n currency:\n item.configured_variant?.price_range?.maximum_price.regular_price\n .currency,\n };\n }\n return {\n value: item.prices.original_item_price.value,\n currency: item.prices.original_item_price.currency,\n };\n}\n\n// Helper function to get the savings amount of an item\nfunction getSavingsAmount(item: any) {\n let amount_off;\n let currency;\n\n amount_off =\n item?.prices?.original_row_total?.value - item?.prices?.row_total?.value;\n currency = item?.prices?.row_total?.currency;\n\n if (amount_off === 0) {\n return undefined;\n }\n return {\n value: amount_off,\n currency,\n };\n}\n\n// Base helper that transforms a single quote object directly\nfunction transformSingleQuote(quote: any): NegotiableQuoteModel {\n const isQuoteNew = isNewQuote(quote);\n return {\n uid: quote.uid,\n name: quote.name,\n createdAt: quote.created_at,\n updatedAt: quote.updated_at,\n expirationDate: quote.expiration_date,\n status: isQuoteNew ? NegotiableQuoteStatus.NEW : quote.status,\n isVirtual: Boolean(quote.is_virtual),\n salesRepName: quote.sales_rep_name,\n buyer: {\n firstname: quote.buyer.firstname,\n lastname: quote.buyer.lastname,\n },\n templateName: quote.template_name,\n totalQuantity: getTotalQuantity(quote),\n comments: quote.comments?.map((comment: any) => {\n const baseComment: any = {\n uid: comment.uid,\n createdAt: comment.created_at,\n author: {\n firstname: comment.author.firstname,\n lastname: comment.author.lastname,\n },\n text: comment.text,\n };\n\n if (\n Array.isArray(comment.attachments) &&\n comment.attachments.length > 0\n ) {\n baseComment.attachments = comment.attachments.map((a: any) => ({\n name: a.name,\n url: a.url,\n }));\n }\n\n return baseComment;\n }),\n prices: quote.prices && {\n appliedDiscounts: quote.prices.discounts?.map((discount: any) => ({\n amount: {\n value: discount.amount.value,\n currency: discount.amount.currency,\n },\n label: discount.label,\n coupon: discount.coupon,\n })),\n appliedTaxes: quote.prices.applied_taxes?.map((tax: any) => ({\n amount: { value: tax.amount.value, currency: tax.amount.currency },\n label: tax.label,\n })),\n discount:\n quote.prices.discounts &&\n quote.prices.grand_total &&\n calculateTotal(\n quote.prices.discounts,\n quote.prices.grand_total.currency\n ),\n grandTotal: quote.prices.grand_total && {\n value: quote.prices.grand_total.value,\n currency: quote.prices.grand_total.currency,\n },\n grandTotalExcludingTax: quote.prices.grand_total_excluding_tax && {\n value: quote.prices.grand_total_excluding_tax.value,\n currency: quote.prices.grand_total_excluding_tax.currency,\n },\n subtotalExcludingTax: quote.prices.subtotal_excluding_tax && {\n value: quote.prices.subtotal_excluding_tax.value,\n currency: quote.prices.subtotal_excluding_tax.currency,\n },\n subtotalIncludingTax: quote.prices.subtotal_including_tax && {\n value: quote.prices.subtotal_including_tax.value,\n currency: quote.prices.subtotal_including_tax.currency,\n },\n subtotalWithDiscountExcludingTax: quote.prices\n .subtotal_with_discount_excluding_tax && {\n value: quote.prices.subtotal_with_discount_excluding_tax.value,\n currency: quote.prices.subtotal_with_discount_excluding_tax.currency,\n },\n ...transformShippingPrices(quote),\n totalTax:\n quote.prices.applied_taxes &&\n quote.prices.grand_total &&\n calculateTotal(\n quote.prices.applied_taxes,\n quote.prices.grand_total.currency\n ),\n },\n history: quote.history?.map((history: any) => ({\n uid: history.uid,\n createdAt: history.created_at,\n author: {\n firstname: history.author.firstname,\n lastname: history.author.lastname,\n },\n changeType: history.change_type,\n changes: {\n commentAdded: history.changes?.comment_added && {\n comment: history.changes.comment_added.comment,\n },\n customChanges: history.changes?.custom_changes && {\n new_value: history.changes.custom_changes.new_value,\n old_value: history.changes.custom_changes.old_value,\n title: history.changes.custom_changes.title,\n },\n expiration: history.changes?.expiration && {\n newExpiration: history.changes.expiration.new_expiration,\n oldExpiration: history.changes.expiration.old_expiration,\n },\n productsRemoved: history.changes?.products_removed && {\n productsRemovedFromCatalog:\n history.changes.products_removed.products_removed_from_catalog ||\n [],\n productsRemovedFromQuote:\n history.changes.products_removed.products_removed_from_quote || [],\n },\n statuses: history.changes?.statuses && {\n changes:\n history.changes.statuses.changes?.map((change: any) => ({\n newStatus: change.new_status,\n oldStatus: change.old_status,\n })) || [],\n },\n total: history.changes?.total &&\n history.changes.total.new_price &&\n history.changes.total.old_price && {\n newPrice: {\n value: history.changes.total.new_price.value,\n currency: history.changes.total.new_price.currency,\n },\n oldPrice: {\n value: history.changes.total.old_price.value,\n currency: history.changes.total.old_price.currency,\n },\n },\n },\n })),\n items:\n quote.items?.map((item: any) => ({\n itemType: item.__typename,\n uid: item.uid,\n product: {\n uid: item.product.uid,\n sku: item.product.sku,\n name: item.product.name,\n priceRange: {\n maximumPrice: {\n regularPrice: {\n value:\n item.product.price_range.maximum_price.regular_price.value,\n currency:\n item.product.price_range.maximum_price.regular_price.currency,\n },\n },\n },\n },\n image: getImage(item),\n links: getLinks(item),\n discounted: getDiscounted(item),\n discountedTotal: {\n value: item.prices.row_total.value,\n currency: item.prices.row_total.currency,\n },\n catalogDiscount: {\n amountOff: item.prices.catalog_discount.amount_off,\n percentOff: item.prices.catalog_discount.percent_off,\n },\n discounts:\n item.prices?.discounts?.map((discount: any) => ({\n label: discount.label,\n value: discount.value,\n amount: {\n value: discount.amount.value,\n currency: discount.amount.currency,\n },\n })) ?? [],\n discountPercentage: getDiscountPercentage(item),\n insufficientQuantity:\n (item.__typename === 'ConfigurableCartItem'\n ? item.configured_variant\n : item.product\n ).stock_status === 'IN_STOCK' && !item.is_available,\n outOfStock: item.product.stock_status === 'OUT_OF_STOCK',\n stockStatus: item.product.stock_status,\n quantity: item.quantity,\n prices: {\n regularPrice: getRegularPrice(item),\n priceIncludingTax: {\n value: item.prices.price_including_tax.value,\n currency: item.prices.price_including_tax.currency,\n },\n originalItemPrice: {\n value: item.prices.original_item_price.value,\n currency: item.prices.original_item_price.currency,\n },\n originalRowTotal: {\n value: item.prices.original_row_total.value,\n currency: item.prices.original_row_total.currency,\n },\n rowTotal: {\n value: item.prices.row_total.value,\n currency: item.prices.row_total.currency,\n },\n rowTotalIncludingTax: {\n value: item.prices.row_total_including_tax.value,\n currency: item.prices.row_total_including_tax.currency,\n },\n },\n savingsAmount: getSavingsAmount(item),\n noteFromBuyer: item.note_from_buyer?.map((note: any) => ({\n createdAt: note.created_at,\n creatorId: note.creator_id,\n creatorType: note.creator_type,\n negotiableQuoteItemUid: note.negotiable_quote_item_uid,\n note: note.note,\n noteUid: note.note_uid,\n })),\n noteFromSeller: item.note_from_seller?.map((note: any) => ({\n createdAt: note.created_at,\n creatorId: note.creator_id,\n creatorType: note.creator_type,\n negotiableQuoteItemUid: note.negotiable_quote_item_uid,\n note: note.note,\n noteUid: note.note_uid,\n })),\n configurableOptions: item.configurable_options?.map((option: any) => ({\n optionLabel: option.option_label,\n valueLabel: option.value_label,\n })),\n bundleOptions: item.bundle_options?.map((option: any) => ({\n label: option.label,\n values: option.values.map((value: any) => ({\n label: value.label,\n quantity: value.quantity,\n originalPrice: {\n value: value.original_price.value,\n currency: value.original_price.currency,\n },\n price: {\n value: value.priceV2.value,\n currency: value.priceV2.currency,\n },\n })),\n })),\n customizableOptions: item.customizable_options?.map((option: any) => ({\n type: option.type,\n label: option.label,\n values: option.values.map((value: any) => ({\n label: value.label,\n value: value.value,\n })),\n })),\n })) || [],\n shippingAddresses: quote.shipping_addresses?.map((address: any) => {\n const shippingAddress: ShippingAddress = {\n uid: address.uid,\n firstname: address.firstname,\n lastname: address.lastname,\n company: address.company,\n street: address.street,\n city: address.city,\n postcode: address.postcode,\n country: {\n code: address.country.code,\n label: address.country.label,\n },\n telephone: address.telephone,\n };\n\n if (address.region) {\n shippingAddress.region = {\n code: address.region.code,\n label: address.region.label,\n regionId: address.region.region_id,\n };\n }\n\n return shippingAddress;\n }),\n canCheckout:\n ['UPDATED', 'DECLINED', 'OPEN'].includes(quote.status) &&\n state.permissions.checkoutQuote &&\n quote.shipping_addresses?.length > 0,\n canSendForReview:\n (isQuoteNew || EDITABLE_QUOTE_STATUSES.includes(quote.status)) &&\n state.permissions.editQuote,\n canUpdateQuote:\n (isQuoteNew || EDITABLE_QUOTE_STATUSES.includes(quote.status)) &&\n state.permissions.editQuote,\n canDelete:\n !['PENDING', 'SUBMITTED', 'ORDERED'].includes(quote.status) &&\n state.permissions.deleteQuote,\n canClose: quote.status\n ? !['DRAFT', 'CLOSED', 'ORDERED', 'OPEN'].includes(quote.status)\n : false,\n };\n}\n\nexport function transformQuote(quoteData: any): NegotiableQuoteModel | null {\n if (!quoteData) {\n return null;\n }\n\n return transformSingleQuote(quoteData);\n}\n\n// quote is new if it has a status of SUBMITTED and there is no history entry that\n// has a change_type of UPDATED with a non-empty array of status changes\nfunction isNewQuote(quote: any): boolean {\n return (\n quote.status === 'SUBMITTED' &&\n !(quote.history ?? []).some(\n (history: any) =>\n history.change_type === 'UPDATED' &&\n (history.changes?.statuses?.changes ?? []).length > 0\n )\n );\n}\n\nfunction transformNegotiableQuoteListEntry(\n quote: any\n): NegotiableQuoteListEntry {\n const isQuoteNew = isNewQuote(quote);\n return {\n uid: quote.uid,\n name: quote.name,\n createdAt: quote.created_at,\n updatedAt: quote.updated_at,\n status: isQuoteNew ? NegotiableQuoteStatus.NEW : quote.status,\n buyer: {\n firstname: quote.buyer.firstname,\n lastname: quote.buyer.lastname,\n },\n templateName: quote.template_name,\n prices: {\n grandTotal: {\n value: quote.prices.grand_total.value,\n currency: quote.prices.grand_total.currency,\n },\n },\n };\n}\n\nexport function transformNegotiableQuotesList(\n quotesData: any\n): NegotiableQuotesListModel | null {\n if (!quotesData) {\n return null;\n }\n\n const transformedModel = {\n items:\n quotesData.items\n ?.filter((quote: any) => quote?.uid)\n .map(transformNegotiableQuoteListEntry) || [],\n pageInfo: {\n currentPage: quotesData.page_info.current_page,\n pageSize: quotesData.page_info.page_size,\n totalPages: quotesData.page_info.total_pages,\n },\n totalCount: quotesData.total_count,\n sortFields: quotesData.sort_fields\n ? {\n default: quotesData.sort_fields.default,\n options: quotesData.sort_fields.options,\n }\n : undefined,\n };\n\n // Calculate pagination info\n const paginationInfo = transformPaginationInfo(transformedModel);\n\n return {\n ...transformedModel,\n paginationInfo: paginationInfo || undefined,\n };\n}\n\nexport function transformPaginationInfo(\n quotesData: NegotiableQuotesListModel | null\n): PaginationInfo | null {\n if (!quotesData?.pageInfo || !quotesData.totalCount) {\n return null;\n }\n\n const { currentPage, pageSize, totalPages } = quotesData.pageInfo;\n const { totalCount } = quotesData;\n\n const startItem = totalCount > 0 ? (currentPage - 1) * pageSize + 1 : 0;\n const endItem = Math.min(currentPage * pageSize, totalCount);\n\n const pageSizeOptions = [20, 30, 50, 100, 200]; // Default page size options\n\n return {\n currentPage,\n totalCount,\n pageSize,\n startItem,\n endItem,\n totalPages,\n pageSizeOptions,\n };\n}\n\n// TODO: Check if admin has this configuration\nexport const getDefaultPageSizeOptions = () => [20, 30, 50, 100, 200];\n\nexport function calculateTotal(data: any[], currency: string) {\n if (!data?.length)\n return {\n value: 0,\n currency,\n };\n\n return data.reduce(\n (acc: any, item: any) => {\n return {\n value: acc.value + item.amount.value,\n currency: item.amount.currency,\n };\n },\n { value: 0, currency }\n );\n}\n\nexport function transformShippingPrices(quote: any) {\n if (!quote || !quote.shipping_addresses?.length) {\n return {};\n }\n\n const shippingAddress = quote.shipping_addresses[0];\n const selectedShippingMethod = shippingAddress.selected_shipping_method;\n\n if (!selectedShippingMethod) {\n return {};\n }\n\n return {\n shippingIncludingTax: selectedShippingMethod.price_incl_tax && {\n value: selectedShippingMethod.price_incl_tax.value,\n currency: selectedShippingMethod.price_incl_tax.currency,\n },\n shippingExcludingTax: selectedShippingMethod.price_excl_tax && {\n value: selectedShippingMethod.price_excl_tax.value,\n currency: selectedShippingMethod.price_excl_tax.currency,\n },\n };\n}\n"],"names":["NegotiableQuoteStatus","setEndpoint","setFetchGraphQlHeader","removeFetchGraphQlHeader","setFetchGraphQlHeaders","fetchGraphQl","getConfig","FetchGraphQL","EDITABLE_QUOTE_STATUSES","getTotalQuantity","quote","config","state","getImage","item","_b","_a","_d","_c","getLinks","link","findApplicablePriceTier","priceTiers","quantity","a","b","tier","getDiscounted","isConfigurable","priceRange","applicableTier","getDiscountPercentage","percent_off","_h","_g","_f","_e","getRegularPrice","getSavingsAmount","amount_off","currency","transformSingleQuote","isQuoteNew","isNewQuote","comment","baseComment","discount","tax","calculateTotal","transformShippingPrices","history","change","note","option","value","address","shippingAddress","transformQuote","quoteData","transformNegotiableQuoteListEntry","transformNegotiableQuotesList","quotesData","transformedModel","paginationInfo","transformPaginationInfo","currentPage","pageSize","totalPages","totalCount","startItem","endItem","getDefaultPageSizeOptions","data","acc","selectedShippingMethod"],"mappings":"8FAwRO,IAAKA,GAAAA,IACVA,EAAA,IAAM,MACNA,EAAA,UAAY,YACZA,EAAA,QAAU,UACVA,EAAA,QAAU,UACVA,EAAA,KAAO,OACPA,EAAA,QAAU,UACVA,EAAA,OAAS,SACTA,EAAA,SAAW,WACXA,EAAA,QAAU,UACVA,EAAA,MAAQ,QAVEA,IAAAA,GAAA,CAAA,CAAA,ECtRL,KAAM,CACX,YAAAC,EACA,sBAAAC,EACA,yBAAAC,EACA,uBAAAC,EACA,aAAAC,EACA,UAAAC,CACF,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AK,GAAG,CAS3C,CAEJ,CAGO,MAAMI,EAA4B,IAAM,CAAC,GAAI,GAAI,GAAI,IAAK,GAAG,EAE7D,SAASvB,EAAewB,EAAahC,EAAkB,CAC5D,OAAKgC,GAAA,MAAAA,EAAM,OAMJA,EAAK,OACV,CAACC,EAAU3D,KACF,CACL,MAAO2D,EAAI,MAAQ3D,EAAK,OAAO,MAC/B,SAAUA,EAAK,OAAO,QAAA,GAG1B,CAAE,MAAO,EAAG,SAAA0B,CAAA,CAAS,EAZd,CACL,MAAO,EACP,SAAAA,CAAA,CAYN,CAEO,SAASS,EAAwBvC,EAAY,OAClD,GAAI,CAACA,GAAS,GAACM,EAAAN,EAAM,qBAAN,MAAAM,EAA0B,QACvC,MAAO,CAAA,EAIT,MAAM0D,EADkBhE,EAAM,mBAAmB,CAAC,EACH,yBAE/C,OAAKgE,EAIE,CACL,qBAAsBA,EAAuB,gBAAkB,CAC7D,MAAOA,EAAuB,eAAe,MAC7C,SAAUA,EAAuB,eAAe,QAAA,EAElD,qBAAsBA,EAAuB,gBAAkB,CAC7D,MAAOA,EAAuB,eAAe,MAC7C,SAAUA,EAAuB,eAAe,QAAA,CAClD,EAXO,CAAA,CAaX"}
@@ -1,4 +0,0 @@
1
- import { CustomerModel } from '../customer-model';
2
-
3
- export declare const customer: CustomerModel;
4
- //# sourceMappingURL=customerModel.d.ts.map
@@ -1,18 +0,0 @@
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 interface CustomerModel {
10
- permissions: CustomerPermissions;
11
- }
12
- export interface CustomerPermissions {
13
- canRequestQuote: boolean;
14
- canEditQuote: boolean;
15
- canDeleteQuote: boolean;
16
- canCheckoutQuote: boolean;
17
- }
18
- //# sourceMappingURL=customer-model.d.ts.map
@@ -1,10 +0,0 @@
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 declare const customer: any;
10
- //# sourceMappingURL=customerData.d.ts.map