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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (106) hide show
  1. package/api/index.d.ts +1 -1
  2. package/api/initialize/initialize.d.ts +1 -0
  3. package/{data/transforms/__fixtures__/customerData.d.ts → api/removeNegotiableQuoteItems/graphql/RemoveNegotiableQuoteItemsMutation.d.ts} +2 -2
  4. package/api/{getCustomerData → removeNegotiableQuoteItems}/index.d.ts +1 -1
  5. package/api/removeNegotiableQuoteItems/removeNegotiableQuoteItems.d.ts +8 -0
  6. package/api.js +16 -41
  7. package/api.js.map +1 -1
  8. package/chunks/ItemsQuoted.js +1 -1
  9. package/chunks/ItemsQuoted.js.map +1 -1
  10. package/chunks/ItemsQuotedTemplate.js +4 -0
  11. package/chunks/ItemsQuotedTemplate.js.map +1 -0
  12. package/chunks/OrderSummaryLine.js +1 -1
  13. package/chunks/OrderSummaryLine.js.map +1 -1
  14. package/chunks/QuoteCommentsList.js +1 -1
  15. package/chunks/QuoteCommentsList.js.map +1 -1
  16. package/chunks/QuoteCommentsList3.js +4 -0
  17. package/chunks/QuoteCommentsList3.js.map +1 -0
  18. package/chunks/QuoteHistoryLog.js +1 -1
  19. package/chunks/QuoteHistoryLog.js.map +1 -1
  20. package/chunks/QuoteHistoryLog3.js +4 -0
  21. package/chunks/QuoteHistoryLog3.js.map +1 -0
  22. package/chunks/QuotePricesSummary.js +4 -0
  23. package/chunks/QuotePricesSummary.js.map +1 -0
  24. package/chunks/QuoteTemplateCommentsList.js +4 -0
  25. package/chunks/QuoteTemplateCommentsList.js.map +1 -0
  26. package/chunks/QuoteTemplateHistoryLog.js +4 -0
  27. package/chunks/QuoteTemplateHistoryLog.js.map +1 -0
  28. package/chunks/TabbedContent.js +4 -0
  29. package/chunks/TabbedContent.js.map +1 -0
  30. package/chunks/dateUtils.js +1 -1
  31. package/chunks/getQuoteTemplates.js +2 -2
  32. package/chunks/getQuoteTemplates.js.map +1 -1
  33. package/chunks/negotiableQuotes.js +1 -1
  34. package/chunks/removeNegotiableQuoteItems.js +38 -0
  35. package/chunks/removeNegotiableQuoteItems.js.map +1 -0
  36. package/chunks/renameNegotiableQuote.js +1 -1
  37. package/chunks/state.js +1 -1
  38. package/chunks/state.js.map +1 -1
  39. package/chunks/transform-quote.js +1 -1
  40. package/chunks/transform-quote.js.map +1 -1
  41. package/chunks/uploadFile.js +3 -3
  42. package/components/ActionsBar/ActionsBar.d.ts +1 -0
  43. package/components/ConfirmationModal/ConfirmationModal.d.ts +1 -0
  44. package/components/ManageNegotiableQuoteTemplate/ManageNegotiableQuoteTemplate.d.ts +22 -0
  45. package/components/ManageNegotiableQuoteTemplate/__fixtures__/ManageNegotiableQuoteTemplateProps.d.ts +4 -0
  46. package/{data/models/customer-model.d.ts → components/ManageNegotiableQuoteTemplate/index.d.ts} +3 -10
  47. package/components/ProductListTable/ProductListTable.d.ts +43 -5
  48. package/components/QuoteHistoryLog/QuoteHistoryLog.d.ts +70 -2
  49. package/components/index.d.ts +1 -0
  50. package/containers/ItemsQuoted/ItemsQuoted.d.ts +5 -0
  51. package/containers/ItemsQuoted.js +1 -1
  52. package/containers/ItemsQuotedTemplate/ItemsQuotedTemplate.d.ts +19 -0
  53. package/{api/getCustomerData/getCustomerData.d.ts → containers/ItemsQuotedTemplate/index.d.ts} +3 -2
  54. package/containers/ItemsQuotedTemplate.d.ts +3 -0
  55. package/containers/ItemsQuotedTemplate.js +4 -0
  56. package/containers/ItemsQuotedTemplate.js.map +1 -0
  57. package/containers/ManageNegotiableQuote/ManageNegotiableQuote.d.ts +1 -0
  58. package/containers/ManageNegotiableQuote.js +1 -1
  59. package/containers/ManageNegotiableQuote.js.map +1 -1
  60. package/containers/ManageNegotiableQuoteTemplate/ManageNegotiableQuoteTemplate.d.ts +54 -0
  61. package/containers/ManageNegotiableQuoteTemplate/index.d.ts +11 -0
  62. package/containers/ManageNegotiableQuoteTemplate.d.ts +3 -0
  63. package/containers/ManageNegotiableQuoteTemplate.js +4 -0
  64. package/containers/ManageNegotiableQuoteTemplate.js.map +1 -0
  65. package/containers/OrderSummary.js +1 -1
  66. package/containers/OrderSummary.js.map +1 -1
  67. package/containers/OrderSummaryLine.js +1 -1
  68. package/containers/QuoteCommentsList.js +1 -1
  69. package/containers/QuoteHistoryLog.js +1 -1
  70. package/containers/QuoteSummaryList.js +1 -1
  71. package/containers/QuoteSummaryList.js.map +1 -1
  72. package/containers/QuoteTemplateCommentsList/QuoteTemplateCommentsList.d.ts +9 -0
  73. package/containers/QuoteTemplateCommentsList/index.d.ts +11 -0
  74. package/containers/QuoteTemplateCommentsList.d.ts +3 -0
  75. package/containers/QuoteTemplateCommentsList.js +4 -0
  76. package/containers/QuoteTemplateCommentsList.js.map +1 -0
  77. package/containers/QuoteTemplateHistoryLog/QuoteTemplateHistoryLog.d.ts +9 -0
  78. package/containers/QuoteTemplateHistoryLog/index.d.ts +11 -0
  79. package/containers/QuoteTemplateHistoryLog.d.ts +3 -0
  80. package/containers/QuoteTemplateHistoryLog.js +4 -0
  81. package/containers/QuoteTemplateHistoryLog.js.map +1 -0
  82. package/containers/QuoteTemplatesListTable/QuoteTemplatesListTable.d.ts +2 -0
  83. package/containers/QuoteTemplatesListTable.js +1 -1
  84. package/containers/QuoteTemplatesListTable.js.map +1 -1
  85. package/containers/QuotesListTable.js +1 -1
  86. package/containers/QuotesListTable.js.map +1 -1
  87. package/containers/RequestNegotiableQuoteForm.js +1 -1
  88. package/containers/index.d.ts +4 -0
  89. package/data/models/__fixtures__/negotiableQuoteTemplateModel.d.ts +4 -0
  90. package/data/models/index.d.ts +0 -1
  91. package/data/models/negotiable-quote-model.d.ts +1 -0
  92. package/data/models/negotiable-quote-template-model.d.ts +1 -1
  93. package/data/transforms/index.d.ts +0 -1
  94. package/i18n/en_US.json.d.ts +48 -1
  95. package/lib/state.d.ts +3 -0
  96. package/package.json +1 -1
  97. package/render.js +2 -3
  98. package/render.js.map +1 -1
  99. package/types/state.types.d.ts +6 -0
  100. package/utils/mapAuthPermissions.d.ts +39 -0
  101. package/api/getCustomerData/graphql/CustomerQuery.d.ts +0 -2
  102. package/api/graphql/CustomerFragment.d.ts +0 -2
  103. package/chunks/updateQuantities.js +0 -21
  104. package/chunks/updateQuantities.js.map +0 -1
  105. package/data/models/__fixtures__/customerModel.d.ts +0 -4
  106. package/data/transforms/transform-customer.d.ts +0 -15
@@ -0,0 +1 @@
1
+ {"version":3,"file":"QuoteTemplateCommentsList.js","sources":["/@dropins/storefront-quote-management/src/containers/QuoteTemplateCommentsList/QuoteTemplateCommentsList.tsx"],"sourcesContent":["/********************************************************************\n * Copyright 2025 Adobe\n * All Rights Reserved.\n *\n * NOTICE: Adobe permits you to use, modify, and distribute this \n * file in accordance with the terms of the Adobe license agreement \n * accompanying it. \n *******************************************************************/\n\nimport { HTMLAttributes, useEffect, useState } from 'preact/compat';\nimport { Container, getGlobalLocale } from '@adobe-commerce/elsie/lib';\nimport { QuoteCommentsList as QuoteCommentsListComponent } from '@/quote-management/components/QuoteCommentsList';\nimport { NegotiableQuoteTemplateModel } from '@/quote-management/data/models/negotiable-quote-template-model';\nimport { events } from '@adobe-commerce/event-bus';\n\nexport interface QuoteTemplateCommentsListProps extends HTMLAttributes<HTMLUListElement> {\n templateData?: NegotiableQuoteTemplateModel;\n}\n\nexport const QuoteTemplateCommentsList: Container<QuoteTemplateCommentsListProps> = ({\n templateData: initialData,\n ...props\n}) => {\n const [templateData, setTemplateData] = useState<NegotiableQuoteTemplateModel | undefined>(initialData);\n\n useEffect(() => {\n const templateDataEvent = events.on('quote-management/quote-template-data', (data: { quoteTemplate: NegotiableQuoteTemplateModel }) => {\n setTemplateData(data.quoteTemplate);\n }, { eager: true });\n return () => templateDataEvent?.off();\n }, []);\n\n if (!templateData) {\n return null;\n }\n\n // Format comments data\n const calculatedLocale = getGlobalLocale() || 'en-US';\n const dateFormatter = new Intl.DateTimeFormat(calculatedLocale, {\n year: 'numeric',\n month: 'short',\n day: 'numeric',\n hour: '2-digit',\n minute: '2-digit',\n second: '2-digit',\n hour12: true,\n });\n\n const formattedComments = templateData?.comments?.map((comment) => ({\n uid: comment.uid,\n createdAt: <span>{dateFormatter.format(new Date(comment.createdAt))}</span>,\n author: (\n <span>\n {comment.author.firstname} {comment.author.lastname}\n </span>\n ),\n text: <p>{comment.text}</p>,\n }));\n\n return (\n <QuoteCommentsListComponent\n data-testid=\"quote-template-comments-list-container\"\n {...props}\n comments={formattedComments || []}\n />\n );\n};\n"],"names":["QuoteTemplateCommentsList","initialData","props","templateData","setTemplateData","useState","useEffect","templateDataEvent","events","data","calculatedLocale","getGlobalLocale","dateFormatter","formattedComments","_a","comment","jsx","QuoteCommentsListComponent"],"mappings":"uSAmBO,MAAMA,EAAuE,CAAC,CACnF,aAAcC,EACd,GAAGC,CACL,IAAM,OACJ,KAAM,CAACC,EAAcC,CAAe,EAAIC,EAAmDJ,CAAW,EAStG,GAPAK,EAAU,IAAM,CACd,MAAMC,EAAoBC,EAAO,GAAG,uCAAyCC,GAA0D,CACrIL,EAAgBK,EAAK,aAAa,CACpC,EAAG,CAAE,MAAO,GAAM,EAClB,MAAO,IAAMF,GAAA,YAAAA,EAAmB,KAClC,EAAG,CAAA,CAAE,EAED,CAACJ,EACH,OAAO,KAIT,MAAMO,EAAmBC,KAAqB,QACxCC,EAAgB,IAAI,KAAK,eAAeF,EAAkB,CAC9D,KAAM,UACN,MAAO,QACP,IAAK,UACL,KAAM,UACN,OAAQ,UACR,OAAQ,UACR,OAAQ,EAAA,CACT,EAEKG,GAAoBC,EAAAX,GAAA,YAAAA,EAAc,WAAd,YAAAW,EAAwB,IAAKC,IAAa,CAClE,IAAKA,EAAQ,IACb,UAAWC,EAAC,OAAA,CAAM,SAAAJ,EAAc,OAAO,IAAI,KAAKG,EAAQ,SAAS,CAAC,CAAA,CAAE,EACpE,SACG,OAAA,CACE,SAAA,CAAAA,EAAQ,OAAO,UAAU,IAAEA,EAAQ,OAAO,QAAA,EAC7C,EAEF,KAAMC,EAAC,IAAA,CAAG,SAAAD,EAAQ,IAAA,CAAK,CAAA,IAGzB,OACEC,EAACC,EAAA,CACC,cAAY,yCACX,GAAGf,EACJ,SAAUW,GAAqB,CAAA,CAAC,CAAA,CAGtC"}
@@ -0,0 +1,4 @@
1
+ /*! Copyright 2025 Adobe
2
+ All Rights Reserved. */
3
+ import{jsx as o}from"@dropins/tools/preact-jsx-runtime.js";import{useState as u,useEffect as i}from"@dropins/tools/preact-compat.js";import{events as p}from"@dropins/tools/event-bus.js";import{Q as n}from"./QuoteHistoryLog.js";const g=({templateData:r,...a})=>{const[e,s]=u(r);return i(()=>{const t=p.on("quote-management/quote-template-data",m=>{s(m.quoteTemplate)},{eager:!0});return()=>t==null?void 0:t.off()},[]),e?o("div",{...a,children:o(n,{history:e.history,items:e.items,buyer:e.buyer,salesRepName:e.salesRepName})}):null};export{g as Q};
4
+ //# sourceMappingURL=QuoteTemplateHistoryLog.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"QuoteTemplateHistoryLog.js","sources":["/@dropins/storefront-quote-management/src/containers/QuoteTemplateHistoryLog/QuoteTemplateHistoryLog.tsx"],"sourcesContent":["/********************************************************************\n * Copyright 2025 Adobe\n * All Rights Reserved.\n *\n * NOTICE: Adobe permits you to use, modify, and distribute this \n * file in accordance with the terms of the Adobe license agreement \n * accompanying it. \n *******************************************************************/\n\nimport { HTMLAttributes, useEffect, useState } from 'preact/compat';\nimport { Container } from '@adobe-commerce/elsie/lib';\nimport { NegotiableQuoteTemplateModel } from '@/quote-management/data/models/negotiable-quote-template-model';\nimport { events } from '@adobe-commerce/event-bus';\nimport { QuoteHistoryLog as QuoteHistoryLogComponent } from '@/quote-management/components/QuoteHistoryLog';\n\nexport interface QuoteTemplateHistoryLogProps extends HTMLAttributes<HTMLDivElement> {\n templateData?: NegotiableQuoteTemplateModel;\n}\n\nexport const QuoteTemplateHistoryLog: Container<QuoteTemplateHistoryLogProps> = ({\n templateData: initialData,\n ...props\n}) => {\n const [templateData, setTemplateData] = useState<NegotiableQuoteTemplateModel | undefined>(initialData);\n\n useEffect(() => {\n const templateDataEvent = events.on('quote-management/quote-template-data', (payload) => {\n setTemplateData(payload.quoteTemplate);\n }, { eager: true });\n\n return () => templateDataEvent?.off();\n }, []);\n\n if (!templateData) {\n return null;\n }\n\n return (\n <div {...props}>\n <QuoteHistoryLogComponent \n history={templateData.history}\n items={templateData.items}\n buyer={templateData.buyer}\n salesRepName={templateData.salesRepName}\n />\n </div>\n );\n};\n"],"names":["QuoteTemplateHistoryLog","initialData","props","templateData","setTemplateData","useState","useEffect","templateDataEvent","events","payload","jsx","QuoteHistoryLogComponent"],"mappings":"mOAmBO,MAAMA,EAAmE,CAAC,CAC/E,aAAcC,EACd,GAAGC,CACL,IAAM,CACJ,KAAM,CAACC,EAAcC,CAAe,EAAIC,EAAmDJ,CAAW,EAUtG,OARAK,EAAU,IAAM,CACd,MAAMC,EAAoBC,EAAO,GAAG,uCAAyCC,GAAY,CACvFL,EAAgBK,EAAQ,aAAa,CACvC,EAAG,CAAE,MAAO,GAAM,EAElB,MAAO,IAAMF,GAAA,YAAAA,EAAmB,KAClC,EAAG,CAAA,CAAE,EAEAJ,EAKHO,EAAC,MAAA,CAAK,GAAGR,EACP,SAAAQ,EAACC,EAAA,CACC,QAASR,EAAa,QACtB,MAAOA,EAAa,MACpB,MAAOA,EAAa,MACpB,aAAcA,EAAa,YAAA,CAAA,EAE/B,EAXO,IAaX"}
@@ -0,0 +1,4 @@
1
+ /*! Copyright 2025 Adobe
2
+ All Rights Reserved. */
3
+ import{jsxs as u,jsx as t}from"@dropins/tools/preact-jsx-runtime.js";import{useState as v,useMemo as _}from"@dropins/tools/preact-compat.js";import{classes as n,VComponent as p}from"@dropins/tools/lib.js";/* empty css */const q=({className:s,tabs:a,tabsContent:c,defaultActiveTab:r,...i})=>{const[o,b]=v(r||Array.from(a.keys())[0]),d=e=>{b(e)},m=_(()=>c.get(o),[o,c]);return u("div",{...i,className:n(["quote-management-tabbed-content",s]),children:[a&&t("div",{"data-testid":"tabbed-content-tabs",className:n(["quote-management-tabbed-content__tabs"]),children:Array.from(a.entries()).map(([e,l])=>t("button",{className:n(["quote-management-tabbed-content__tab",["quote-management-tabbed-content__tab--active",e===o]]),onClick:()=>d(e),children:l},e))}),m&&t("div",{className:n(["quote-management-tabbed-content__active-tab-content"]),children:t(p,{node:m})})]})};export{q as T};
4
+ //# sourceMappingURL=TabbedContent.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"TabbedContent.js","sources":["/@dropins/storefront-quote-management/src/components/TabbedContent/TabbedContent.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, useMemo, useState } from 'preact/compat';\nimport { classes, VComponent } from '@adobe-commerce/elsie/lib';\nimport '@/quote-management/components/TabbedContent/TabbedContent.css';\n\nexport interface TabbedContentProps extends HTMLAttributes<HTMLDivElement> {\n tabs: Map<string, string>;\n tabsContent: Map<string, VNode>;\n defaultActiveTab?: string;\n}\n\nexport const TabbedContent: FunctionComponent<TabbedContentProps> = ({\n className,\n tabs,\n tabsContent,\n defaultActiveTab,\n ...props\n}) => {\n const [activeTabId, setActiveTabId] = useState<string>(\n defaultActiveTab || Array.from(tabs.keys())[0]\n );\n\n const handleTabClick = (tabId: string) => {\n setActiveTabId(tabId);\n };\n\n const activeTabContent = useMemo(() => {\n return tabsContent.get(activeTabId);\n }, [activeTabId, tabsContent]);\n\n return (\n <div {...props} className={classes(['quote-management-tabbed-content', className])}>\n {tabs &&\n <div data-testid=\"tabbed-content-tabs\" className={classes(['quote-management-tabbed-content__tabs'])}>\n {Array.from(tabs.entries()).map(([tabId, tabLabel]) => (\n <button\n className={\n classes([\n 'quote-management-tabbed-content__tab',\n ['quote-management-tabbed-content__tab--active', tabId === activeTabId]\n ])}\n key={tabId}\n onClick={() => handleTabClick(tabId)}\n >\n {tabLabel}\n </button>\n ))}\n </div>\n }\n {\n activeTabContent &&\n <div className={classes(['quote-management-tabbed-content__active-tab-content'])}>\n <VComponent\n node={activeTabContent as VNode}\n />\n </div>\n }\n </div>\n );\n};\n"],"names":["TabbedContent","className","tabs","tabsContent","defaultActiveTab","props","activeTabId","setActiveTabId","useState","handleTabClick","tabId","activeTabContent","useMemo","jsxs","classes","jsx","tabLabel","VComponent"],"mappings":"wPAoBO,MAAMA,EAAuD,CAAC,CACnE,UAAAC,EACA,KAAAC,EACA,YAAAC,EACA,iBAAAC,EACA,GAAGC,CACL,IAAM,CACJ,KAAM,CAACC,EAAaC,CAAc,EAAIC,EACpCJ,GAAoB,MAAM,KAAKF,EAAK,KAAA,CAAM,EAAE,CAAC,CAAA,EAGzCO,EAAkBC,GAAkB,CACxCH,EAAeG,CAAK,CACtB,EAEMC,EAAmBC,EAAQ,IACxBT,EAAY,IAAIG,CAAW,EACjC,CAACA,EAAaH,CAAW,CAAC,EAE7B,OACEU,EAAC,MAAA,CAAK,GAAGR,EAAO,UAAWS,EAAQ,CAAC,kCAAmCb,CAAS,CAAC,EAC9E,SAAA,CAAAC,GACCa,EAAC,OAAI,cAAY,sBAAsB,UAAWD,EAAQ,CAAC,uCAAuC,CAAC,EAChG,eAAM,KAAKZ,EAAK,SAAS,EAAE,IAAI,CAAC,CAACQ,EAAOM,CAAQ,IAC/CD,EAAC,SAAA,CACC,UACED,EAAQ,CACN,uCACA,CAAC,+CAAgDJ,IAAUJ,CAAW,CAAA,CACvE,EAEH,QAAS,IAAMG,EAAeC,CAAK,EAElC,SAAAM,CAAA,EAHIN,CAAA,CAKR,EACH,EAGAC,KACC,MAAA,CAAI,UAAWG,EAAQ,CAAC,qDAAqD,CAAC,EAC7E,SAAAC,EAACE,EAAA,CACC,KAAMN,CAAA,CAAA,CACR,CACF,CAAA,EAEJ,CAEJ"}
@@ -1,4 +1,4 @@
1
1
  /*! Copyright 2025 Adobe
2
2
  All Rights Reserved. */
3
- function a(t,e){return e.format(new Date(t))}function n(){try{return Intl.DateTimeFormat().resolvedOptions().timeZone}catch(t){return console.warn("Failed to detect user timezone, falling back to UTC:",t),"UTC"}}function r(t){const e=new Date(t);return isNaN(e.getTime())?"–":e.toLocaleDateString()}export{a,r as f,n as g};
3
+ function a(t,e){return e.format(new Date(t))}function n(){try{return Intl.DateTimeFormat().resolvedOptions().timeZone}catch(t){return console.warn("Failed to detect user timezone, falling back to UTC:",t),"UTC"}}function r(t){const e=new Date(t);return isNaN(e.getTime())?"–":e.toLocaleDateString()}export{r as a,a as f,n as g};
4
4
  //# sourceMappingURL=dateUtils.js.map
@@ -1,6 +1,6 @@
1
1
  /*! Copyright 2025 Adobe
2
2
  All Rights Reserved. */
3
- import{s as f}from"./state.js";import{events as y}from"@dropins/tools/event-bus.js";import{f as b}from"./transform-quote.js";function C(e){var a,n,o,s,l;return e?{uid:e.uid,name:e.name,createdAt:e.created_at,updatedAt:e.updated_at,expirationDate:e.expiration_date,status:e.status,salesRepName:e.sales_rep_name,buyer:{firstname:e.buyer.firstname,lastname:e.buyer.lastname},comments:(a=e.comments)==null?void 0:a.map(r=>{var u;return{uid:r.uid,createdAt:r.created_at,author:{firstname:r.author.firstname,lastname:r.author.lastname},text:r.text,attachments:(u=r.attachments)==null?void 0:u.map(c=>({name:c.name,url:c.url}))}}),prices:e.prices&&{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},appliedTaxes:(n=e.prices.applied_taxes)==null?void 0:n.map(r=>({amount:{value:r.amount.value,currency:r.amount.currency},label:r.label})),grandTotal:e.prices.grand_total&&{value:e.prices.grand_total.value,currency:e.prices.grand_total.currency}},history:(o=e.history)==null?void 0:o.map(r=>({uid:r.uid,createdAt:r.created_at,author:{firstname:r.author.firstname,lastname:r.author.lastname},changeType:r.change_type,changes:r.changes})),items:((s=e.items)==null?void 0:s.map(r=>{var u,c,_,d,g,p;return{uid:r.uid,product:{uid:r.product.uid,sku:r.product.sku,name:r.product.name},quantity:r.quantity,prices:{originalItemPrice:{value:r.prices.original_item_price.value,currency:r.prices.original_item_price.currency},rowTotal:{value:r.prices.row_total.value,currency:r.prices.row_total.currency}},catalogDiscount:r.prices.catalog_discount&&{amountOff:r.prices.catalog_discount.amount_off,percentOff:r.prices.catalog_discount.percent_off},discounts:(c=(u=r.prices)==null?void 0:u.discounts)==null?void 0:c.map(t=>({label:t.label,value:t.value,amount:{value:t.amount.value,currency:t.amount.currency}})),noteFromBuyer:(_=r.note_from_buyer)==null?void 0:_.map(t=>({createdAt:t.created_at,creatorId:t.creator_id,creatorType:t.creator_type,negotiableQuoteItemUid:t.negotiable_quote_template_item_uid,note:t.note,noteUid:t.note_uid})),noteFromSeller:(d=r.note_from_seller)==null?void 0:d.map(t=>({createdAt:t.created_at,creatorId:t.creator_id,creatorType:t.creator_type,negotiableQuoteItemUid:t.negotiable_quote_template_item_uid,note:t.note,noteUid:t.note_uid})),configurableOptions:(g=r.configurable_options)==null?void 0:g.map(t=>({optionLabel:t.option_label,valueLabel:t.value_label})),bundleOptions:(p=r.bundle_options)==null?void 0:p.map(t=>({label:t.label,values:t.values.map(i=>({label:i.label,quantity:i.quantity,originalPrice:{value:i.original_price.value,currency:i.original_price.currency},price:{value:i.priceV2.value,currency:i.priceV2.currency}}))}))}}))||[],shippingAddresses:(l=e.shipping_addresses)==null?void 0:l.map(r=>({uid:r.uid,firstname:r.firstname,lastname:r.lastname,company:r.company,street:r.street,city:r.city,postcode:r.postcode,country:{code:r.country.code,label:r.country.label},telephone:r.telephone,region:r.region?{code:r.region.code,label:r.region.label,regionId:r.region.region_id}:void 0})),canAccept:["SUBMITTED","PENDING","IN_REVIEW"].includes(e.status),canDelete:["CLOSED","INACTIVE"].includes(e.status),canReopen:e.status==="CLOSED",canCancel:["ACTIVE","IN_REVIEW","SUBMITTED"].includes(e.status),canGenerateQuote:e.status==="ACTIVE"}:null}function E(e){var a;return e?{items:((a=e.items)==null?void 0:a.map(n=>({id:n.template_id,uid:"TBD",name:n.name,createdAt:"0000-00-00 00:00:00",updatedAt:"0000-00-00 00:00:00",status:n.status,state:n.state,prices:{grandTotal:{value:0,currency:"USD"},minNegotiatedGrandTotal:{value:n.min_negotiated_grand_total,currency:"USD"}},lastSharedAt:n.last_shared_at,lastOrderedAt:"0000-00-00 00:00:00",expirationDate:"0000-00-00 00:00:00",ordersPlaced:n.orders_placed})))||[],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}:null}const T=`
3
+ import{events as y}from"@dropins/tools/event-bus.js";import{t as b,f as E}from"./transform-quote.js";import{s as f}from"./state.js";function P(e){var i,n,o,a,l;return e?{uid:e.uid,name:e.name,createdAt:e.created_at,updatedAt:e.updated_at,expirationDate:e.expiration_date,status:e.status,salesRepName:e.sales_rep_name,buyer:{firstname:e.buyer.firstname,lastname:e.buyer.lastname},comments:(i=e.comments)==null?void 0:i.map(r=>{var c;return{uid:r.uid,createdAt:r.created_at,author:{firstname:r.author.firstname,lastname:r.author.lastname},text:r.text,attachments:(c=r.attachments)==null?void 0:c.map(s=>({name:s.name,url:s.url}))}}),prices:e.prices&&{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},appliedTaxes:(n=e.prices.applied_taxes)==null?void 0:n.map(r=>({amount:{value:r.amount.value,currency:r.amount.currency},label:r.label})),grandTotal:e.prices.grand_total&&{value:e.prices.grand_total.value,currency:e.prices.grand_total.currency}},history:(o=e.history)==null?void 0:o.map(r=>({uid:r.uid,createdAt:r.created_at,author:{firstname:r.author.firstname,lastname:r.author.lastname},changeType:r.change_type,changes:r.changes})),items:((a=e.items)==null?void 0:a.map(r=>{var c,s,_,d,g,p;return{uid:r.uid,product:{uid:r.product.uid,sku:r.product.sku,name:r.product.name},quantity:r.quantity,prices:{originalItemPrice:{value:r.prices.original_item_price.value,currency:r.prices.original_item_price.currency},rowTotal:{value:r.prices.row_total.value,currency:r.prices.row_total.currency}},catalogDiscount:r.prices.catalog_discount&&{amountOff:r.prices.catalog_discount.amount_off,percentOff:r.prices.catalog_discount.percent_off},discounts:(s=(c=r.prices)==null?void 0:c.discounts)==null?void 0:s.map(t=>({label:t.label,value:t.value,amount:{value:t.amount.value,currency:t.amount.currency}})),noteFromBuyer:(_=r.note_from_buyer)==null?void 0:_.map(t=>({createdAt:t.created_at,creatorId:t.creator_id,creatorType:t.creator_type,negotiableQuoteItemUid:t.negotiable_quote_template_item_uid,note:t.note,noteUid:t.note_uid})),noteFromSeller:(d=r.note_from_seller)==null?void 0:d.map(t=>({createdAt:t.created_at,creatorId:t.creator_id,creatorType:t.creator_type,negotiableQuoteItemUid:t.negotiable_quote_template_item_uid,note:t.note,noteUid:t.note_uid})),configurableOptions:(g=r.configurable_options)==null?void 0:g.map(t=>({optionLabel:t.option_label,valueLabel:t.value_label})),bundleOptions:(p=r.bundle_options)==null?void 0:p.map(t=>({label:t.label,values:t.values.map(u=>({label:u.label,quantity:u.quantity,originalPrice:{value:u.original_price.value,currency:u.original_price.currency},price:{value:u.priceV2.value,currency:u.priceV2.currency}}))}))}}))||[],shippingAddresses:(l=e.shipping_addresses)==null?void 0:l.map(r=>({uid:r.uid,firstname:r.firstname,lastname:r.lastname,company:r.company,street:r.street,city:r.city,postcode:r.postcode,country:{code:r.country.code,label:r.country.label},telephone:r.telephone,region:r.region?{code:r.region.code,label:r.region.label,regionId:r.region.region_id}:void 0})),canAccept:["SUBMITTED","PENDING","IN_REVIEW"].includes(e.status),canDelete:["CLOSED","INACTIVE"].includes(e.status),canReopen:e.status==="CLOSED",canCancel:["ACTIVE","IN_REVIEW","SUBMITTED"].includes(e.status),canGenerateQuote:e.status==="ACTIVE"}:null}function T(e){var o;if(!e)return null;const i={items:((o=e.items)==null?void 0:o.map(a=>({id:a.template_id,uid:"TBD",name:a.name,createdAt:"0000-00-00 00:00:00",updatedAt:"0000-00-00 00:00:00",status:a.status,state:a.state,prices:{grandTotal:{value:0,currency:"USD"},minNegotiatedGrandTotal:{value:a.min_negotiated_grand_total,currency:"USD"}},lastSharedAt:a.last_shared_at,lastOrderedAt:"0000-00-00 00:00:00",expirationDate:"0000-00-00 00:00:00",ordersPlaced:a.orders_placed})))||[],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=b(i);return{...i,paginationInfo:n||void 0}}const I=`
4
4
  query QUOTE_TEMPLATES_QUERY(
5
5
  $filter: NegotiableQuoteTemplateFilterInput
6
6
  $pageSize: Int
@@ -46,5 +46,5 @@ import{s as f}from"./state.js";import{events as y}from"@dropins/tools/event-bus.
46
46
  }
47
47
  }
48
48
  }
49
- `;var v=(e=>(e.ACTIVE="ACTIVE",e.IN_REVIEW="IN_REVIEW",e.INACTIVE="INACTIVE",e))(v||{}),A=(e=>(e.NAME="NAME",e.CREATED_AT="CREATED_AT",e.UPDATED_AT="UPDATED_AT",e))(A||{}),I=(e=>(e.ASC="ASC",e.DESC="DESC",e))(I||{});const S=async(e={})=>{var a;if(!f.authenticated)throw new Error("Unauthorized");try{const n=await b(T,{variables:{filter:e.filter||null,pageSize:e.pageSize||20,currentPage:e.currentPage||1,sort:e.sort||null}});if(!((a=n==null?void 0:n.data)!=null&&a.negotiableQuoteTemplates))throw new Error("No quote templates data received");const o=E(n.data.negotiableQuoteTemplates);if(!o)throw new Error("Failed to transform quote templates data");return y.emit("quote-management/quote-templates-data",{quoteTemplates:o,permissions:f.permissions}),o}catch(n){return Promise.reject(n)}};export{v as Q,I as S,A as a,S as g,C as t};
49
+ `;var v=(e=>(e.ACTIVE="ACTIVE",e.IN_REVIEW="IN_REVIEW",e.INACTIVE="INACTIVE",e))(v||{}),A=(e=>(e.NAME="NAME",e.CREATED_AT="CREATED_AT",e.UPDATED_AT="UPDATED_AT",e))(A||{}),m=(e=>(e.ASC="ASC",e.DESC="DESC",e))(m||{});const S=async(e={})=>{var i;if(!f.authenticated)throw new Error("Unauthorized");try{const n=await E(I,{variables:{filter:e.filter||null,pageSize:e.pageSize||20,currentPage:e.currentPage||1,sort:e.sort||null}});if(!((i=n==null?void 0:n.data)!=null&&i.negotiableQuoteTemplates))throw new Error("No quote templates data received");const o=T(n.data.negotiableQuoteTemplates);if(!o)throw new Error("Failed to transform quote templates data");return y.emit("quote-management/quote-templates-data",{quoteTemplates:o,permissions:f.permissions}),o}catch(n){return Promise.reject(n)}};export{v as Q,m as S,A as a,S as g,P as t};
50
50
  //# sourceMappingURL=getQuoteTemplates.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"getQuoteTemplates.js","sources":["/@dropins/storefront-quote-management/src/data/transforms/transform-quote-template.ts","/@dropins/storefront-quote-management/src/api/getQuoteTemplates/graphql/getQuoteTemplates.ts","/@dropins/storefront-quote-management/src/api/getQuoteTemplates/getQuoteTemplates.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\nimport {\n NegotiableQuoteTemplateModel,\n NegotiableQuoteTemplatesListModel,\n} from '../models/negotiable-quote-template-model';\n\nexport function transformQuoteTemplate(\n templateData: any\n): NegotiableQuoteTemplateModel | null {\n if (!templateData) {\n return null;\n }\n\n return {\n uid: templateData.uid,\n name: templateData.name,\n createdAt: templateData.created_at,\n updatedAt: templateData.updated_at,\n expirationDate: templateData.expiration_date,\n status: templateData.status,\n salesRepName: templateData.sales_rep_name,\n buyer: {\n firstname: templateData.buyer.firstname,\n lastname: templateData.buyer.lastname,\n },\n comments: templateData.comments?.map((comment: 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 attachments: comment.attachments?.map((a: any) => ({\n name: a.name,\n url: a.url,\n })),\n })),\n prices: templateData.prices && {\n subtotalExcludingTax: templateData.prices.subtotal_excluding_tax && {\n value: templateData.prices.subtotal_excluding_tax.value,\n currency: templateData.prices.subtotal_excluding_tax.currency,\n },\n subtotalIncludingTax: templateData.prices.subtotal_including_tax && {\n value: templateData.prices.subtotal_including_tax.value,\n currency: templateData.prices.subtotal_including_tax.currency,\n },\n subtotalWithDiscountExcludingTax: templateData.prices\n .subtotal_with_discount_excluding_tax && {\n value: templateData.prices.subtotal_with_discount_excluding_tax.value,\n currency:\n templateData.prices.subtotal_with_discount_excluding_tax.currency,\n },\n appliedTaxes: templateData.prices.applied_taxes?.map((tax: any) => ({\n amount: { value: tax.amount.value, currency: tax.amount.currency },\n label: tax.label,\n })),\n grandTotal: templateData.prices.grand_total && {\n value: templateData.prices.grand_total.value,\n currency: templateData.prices.grand_total.currency,\n },\n },\n history: templateData.history?.map((h: any) => ({\n uid: h.uid,\n createdAt: h.created_at,\n author: {\n firstname: h.author.firstname,\n lastname: h.author.lastname,\n },\n changeType: h.change_type,\n changes: h.changes,\n })),\n items: templateData.items?.map((item: any) => ({\n uid: item.uid,\n product: {\n uid: item.product.uid,\n sku: item.product.sku,\n name: item.product.name,\n },\n quantity: item.quantity,\n prices: {\n originalItemPrice: {\n value: item.prices.original_item_price.value,\n currency: item.prices.original_item_price.currency,\n },\n rowTotal: {\n value: item.prices.row_total.value,\n currency: item.prices.row_total.currency,\n },\n },\n catalogDiscount: item.prices.catalog_discount && {\n amountOff: item.prices.catalog_discount.amount_off,\n percentOff: item.prices.catalog_discount.percent_off,\n },\n discounts: 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 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_template_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_template_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 })) || [],\n shippingAddresses: templateData.shipping_addresses?.map((address: any) => ({\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 region: address.region ? {\n code: address.region.code,\n label: address.region.label,\n regionId: address.region.region_id,\n } : undefined,\n })),\n // Calculate permissions based on status\n canAccept: ['SUBMITTED', 'PENDING', 'IN_REVIEW'].includes(templateData.status),\n canDelete: ['CLOSED', 'INACTIVE'].includes(templateData.status),\n canReopen: templateData.status === 'CLOSED',\n canCancel: ['ACTIVE', 'IN_REVIEW', 'SUBMITTED'].includes(templateData.status),\n canGenerateQuote: templateData.status === 'ACTIVE',\n };\n}\n\nexport function transformQuoteTemplatesList(\n templatesData: any\n): NegotiableQuoteTemplatesListModel | null {\n if (!templatesData) {\n return null;\n }\n\n return {\n items: templatesData.items?.map((template: any) => ({\n id: template.template_id,\n uid: 'TBD',\n name: template.name,\n createdAt: '0000-00-00 00:00:00', // TODO: missing from GraphQL API\n updatedAt: '0000-00-00 00:00:00', // TODO: missing from GraphQL API\n status: template.status,\n state: template.state,\n prices: {\n grandTotal: {\n value: 0, // TODO: missing from GraphQL API\n currency: 'USD', // TODO: missing from GraphQL API\n },\n minNegotiatedGrandTotal: {\n value: template.min_negotiated_grand_total,\n currency: 'USD', // TODO: use the same from grand total when available\n },\n },\n lastSharedAt: template.last_shared_at,\n lastOrderedAt: '0000-00-00 00:00:00', // TODO: missing from GraphQL API\n expirationDate: '0000-00-00 00:00:00', // TODO: broken in GraphQL API\n ordersPlaced: template.orders_placed,\n })) || [],\n pageInfo: {\n currentPage: templatesData.page_info.current_page,\n pageSize: templatesData.page_info.page_size,\n totalPages: templatesData.page_info.total_pages,\n },\n totalCount: templatesData.total_count,\n sortFields: templatesData.sort_fields ? {\n default: templatesData.sort_fields.default,\n options: templatesData.sort_fields.options,\n } : undefined,\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\nexport const QUOTE_TEMPLATES_QUERY = /* GraphQL */ `\n query QUOTE_TEMPLATES_QUERY(\n $filter: NegotiableQuoteTemplateFilterInput\n $pageSize: Int\n $currentPage: Int\n $sort: NegotiableQuoteTemplateSortInput\n ) {\n negotiableQuoteTemplates(\n filter: $filter\n pageSize: $pageSize\n currentPage: $currentPage\n sort: $sort\n ) {\n items {\n # uid\n template_id\n name\n # created_at\n # updated_at\n # last_ordered_at\n status\n state\n min_negotiated_grand_total\n last_shared_at\n # expiration_date\n orders_placed\n # grand_total {\n # currency\n # value\n # }\n }\n page_info {\n current_page\n page_size\n total_pages\n }\n total_count\n sort_fields {\n default\n options {\n label\n value\n }\n }\n }\n }\n`;\n","/********************************************************************\n * Copyright 2025 Adobe\n * All Rights Reserved.\n *\n * NOTICE: Adobe permits you to use, modify, and distribute this \n * file in accordance with the terms of the Adobe license agreement \n * accompanying it. \n *******************************************************************/\n\nimport { fetchGraphQl } from '@/quote-management/api';\nimport { QUOTE_TEMPLATES_QUERY } from './graphql/getQuoteTemplates';\nimport { transformQuoteTemplatesList } from '@/quote-management/data/transforms';\nimport { NegotiableQuoteTemplatesListModel } from '@/quote-management/data/models/negotiable-quote-template-model';\nimport { state } from '@/quote-management/lib/state';\nimport { events } from '@adobe-commerce/event-bus';\n\nexport enum QuoteTemplateFilterStatus {\n ACTIVE = 'ACTIVE',\n IN_REVIEW = 'IN_REVIEW',\n INACTIVE = 'INACTIVE',\n}\n\nexport interface QuoteTemplateFilterInput {\n status?: QuoteTemplateFilterStatus[];\n name?: {\n match?: string;\n };\n}\n\nexport enum QuoteTemplateSortField {\n NAME = 'NAME',\n CREATED_AT = 'CREATED_AT',\n UPDATED_AT = 'UPDATED_AT',\n}\n\nexport enum SortDirection {\n ASC = 'ASC',\n DESC = 'DESC',\n}\n\nexport interface QuoteTemplateSortInput {\n sortField: QuoteTemplateSortField;\n sortDirection: SortDirection;\n}\n\nexport interface GetQuoteTemplatesParams {\n filter?: QuoteTemplateFilterInput;\n pageSize?: number;\n currentPage?: number;\n sort?: QuoteTemplateSortInput;\n}\n\nexport const getQuoteTemplates = async (\n params: GetQuoteTemplatesParams = {}\n): Promise<NegotiableQuoteTemplatesListModel> => {\n if (!state.authenticated) {\n throw new Error('Unauthorized');\n }\n\n try {\n const results: any = await fetchGraphQl(QUOTE_TEMPLATES_QUERY, {\n variables: {\n filter: params.filter || null,\n pageSize: params.pageSize || 20,\n currentPage: params.currentPage || 1,\n sort: params.sort || null,\n },\n });\n\n if (!results?.data?.negotiableQuoteTemplates) {\n throw new Error('No quote templates data received');\n }\n\n const transformedData = transformQuoteTemplatesList(results.data.negotiableQuoteTemplates);\n\n if (!transformedData) {\n throw new Error('Failed to transform quote templates data');\n }\n\n events.emit('quote-management/quote-templates-data', {\n quoteTemplates: transformedData,\n permissions: state.permissions,\n });\n\n return transformedData;\n } catch (error) {\n return Promise.reject(error);\n }\n};"],"names":["transformQuoteTemplate","templateData","_a","comment","a","_b","tax","_c","h","_d","item","discount","note","_e","option","_f","value","address","transformQuoteTemplatesList","templatesData","template","QUOTE_TEMPLATES_QUERY","QuoteTemplateFilterStatus","QuoteTemplateSortField","SortDirection","getQuoteTemplates","params","state","results","fetchGraphQl","transformedData","events","error"],"mappings":"6HAcO,SAASA,EACZC,EACmC,eACnC,OAAKA,EAIE,CACH,IAAKA,EAAa,IAClB,KAAMA,EAAa,KACnB,UAAWA,EAAa,WACxB,UAAWA,EAAa,WACxB,eAAgBA,EAAa,gBAC7B,OAAQA,EAAa,OACrB,aAAcA,EAAa,eAC3B,MAAO,CACH,UAAWA,EAAa,MAAM,UAC9B,SAAUA,EAAa,MAAM,QAAA,EAEjC,UAAUC,EAAAD,EAAa,WAAb,YAAAC,EAAuB,IAAKC,GAAA,OAAkB,OACpD,IAAKA,EAAQ,IACb,UAAWA,EAAQ,WACnB,OAAQ,CACJ,UAAWA,EAAQ,OAAO,UAC1B,SAAUA,EAAQ,OAAO,QAAA,EAE7B,KAAMA,EAAQ,KACd,aAAaD,EAAAC,EAAQ,cAAR,YAAAD,EAAqB,IAAKE,IAAY,CAC/C,KAAMA,EAAE,KACR,IAAKA,EAAE,GAAA,GACT,IAEN,OAAQH,EAAa,QAAU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ote-management/src/data/transforms/transform-quote-template.ts","/@dropins/storefront-quote-management/src/api/getQuoteTemplates/graphql/getQuoteTemplates.ts","/@dropins/storefront-quote-management/src/api/getQuoteTemplates/getQuoteTemplates.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\nimport {\n NegotiableQuoteTemplateModel,\n NegotiableQuoteTemplatesListModel,\n} from '../models/negotiable-quote-template-model';\nimport { transformPaginationInfo } from './transform-quote';\n\nexport function transformQuoteTemplate(\n templateData: any\n): NegotiableQuoteTemplateModel | null {\n if (!templateData) {\n return null;\n }\n\n return {\n uid: templateData.uid,\n name: templateData.name,\n createdAt: templateData.created_at,\n updatedAt: templateData.updated_at,\n expirationDate: templateData.expiration_date,\n status: templateData.status,\n salesRepName: templateData.sales_rep_name,\n buyer: {\n firstname: templateData.buyer.firstname,\n lastname: templateData.buyer.lastname,\n },\n comments: templateData.comments?.map((comment: 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 attachments: comment.attachments?.map((a: any) => ({\n name: a.name,\n url: a.url,\n })),\n })),\n prices: templateData.prices && {\n subtotalExcludingTax: templateData.prices.subtotal_excluding_tax && {\n value: templateData.prices.subtotal_excluding_tax.value,\n currency: templateData.prices.subtotal_excluding_tax.currency,\n },\n subtotalIncludingTax: templateData.prices.subtotal_including_tax && {\n value: templateData.prices.subtotal_including_tax.value,\n currency: templateData.prices.subtotal_including_tax.currency,\n },\n subtotalWithDiscountExcludingTax: templateData.prices\n .subtotal_with_discount_excluding_tax && {\n value: templateData.prices.subtotal_with_discount_excluding_tax.value,\n currency:\n templateData.prices.subtotal_with_discount_excluding_tax.currency,\n },\n appliedTaxes: templateData.prices.applied_taxes?.map((tax: any) => ({\n amount: { value: tax.amount.value, currency: tax.amount.currency },\n label: tax.label,\n })),\n grandTotal: templateData.prices.grand_total && {\n value: templateData.prices.grand_total.value,\n currency: templateData.prices.grand_total.currency,\n },\n },\n history: templateData.history?.map((h: any) => ({\n uid: h.uid,\n createdAt: h.created_at,\n author: {\n firstname: h.author.firstname,\n lastname: h.author.lastname,\n },\n changeType: h.change_type,\n changes: h.changes,\n })),\n items: templateData.items?.map((item: any) => ({\n uid: item.uid,\n product: {\n uid: item.product.uid,\n sku: item.product.sku,\n name: item.product.name,\n },\n quantity: item.quantity,\n prices: {\n originalItemPrice: {\n value: item.prices.original_item_price.value,\n currency: item.prices.original_item_price.currency,\n },\n rowTotal: {\n value: item.prices.row_total.value,\n currency: item.prices.row_total.currency,\n },\n },\n catalogDiscount: item.prices.catalog_discount && {\n amountOff: item.prices.catalog_discount.amount_off,\n percentOff: item.prices.catalog_discount.percent_off,\n },\n discounts: 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 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_template_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_template_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 })) || [],\n shippingAddresses: templateData.shipping_addresses?.map((address: any) => ({\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 region: address.region ? {\n code: address.region.code,\n label: address.region.label,\n regionId: address.region.region_id,\n } : undefined,\n })),\n // Calculate permissions based on status\n canAccept: ['SUBMITTED', 'PENDING', 'IN_REVIEW'].includes(templateData.status),\n canDelete: ['CLOSED', 'INACTIVE'].includes(templateData.status),\n canReopen: templateData.status === 'CLOSED',\n canCancel: ['ACTIVE', 'IN_REVIEW', 'SUBMITTED'].includes(templateData.status),\n canGenerateQuote: templateData.status === 'ACTIVE',\n };\n}\n\nexport function transformQuoteTemplatesList(\n templatesData: any\n): NegotiableQuoteTemplatesListModel | null {\n if (!templatesData) {\n return null;\n }\n\n const transformedModel = {\n items: templatesData.items?.map((template: any) => ({\n id: template.template_id,\n uid: 'TBD',\n name: template.name,\n createdAt: '0000-00-00 00:00:00', // TODO: missing from GraphQL API\n updatedAt: '0000-00-00 00:00:00', // TODO: missing from GraphQL API\n status: template.status,\n state: template.state,\n prices: {\n grandTotal: {\n value: 0, // TODO: missing from GraphQL API\n currency: 'USD', // TODO: missing from GraphQL API\n },\n minNegotiatedGrandTotal: {\n value: template.min_negotiated_grand_total,\n currency: 'USD', // TODO: use the same from grand total when available\n },\n },\n lastSharedAt: template.last_shared_at,\n lastOrderedAt: '0000-00-00 00:00:00', // TODO: missing from GraphQL API\n expirationDate: '0000-00-00 00:00:00', // TODO: broken in GraphQL API\n ordersPlaced: template.orders_placed,\n })) || [],\n pageInfo: {\n currentPage: templatesData.page_info.current_page,\n pageSize: templatesData.page_info.page_size,\n totalPages: templatesData.page_info.total_pages,\n },\n totalCount: templatesData.total_count,\n sortFields: templatesData.sort_fields ? {\n default: templatesData.sort_fields.default,\n options: templatesData.sort_fields.options,\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 * 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 const QUOTE_TEMPLATES_QUERY = /* GraphQL */ `\n query QUOTE_TEMPLATES_QUERY(\n $filter: NegotiableQuoteTemplateFilterInput\n $pageSize: Int\n $currentPage: Int\n $sort: NegotiableQuoteTemplateSortInput\n ) {\n negotiableQuoteTemplates(\n filter: $filter\n pageSize: $pageSize\n currentPage: $currentPage\n sort: $sort\n ) {\n items {\n # uid\n template_id\n name\n # created_at\n # updated_at\n # last_ordered_at\n status\n state\n min_negotiated_grand_total\n last_shared_at\n # expiration_date\n orders_placed\n # grand_total {\n # currency\n # value\n # }\n }\n page_info {\n current_page\n page_size\n total_pages\n }\n total_count\n sort_fields {\n default\n options {\n label\n value\n }\n }\n }\n }\n`;\n","/********************************************************************\n * Copyright 2025 Adobe\n * All Rights Reserved.\n *\n * NOTICE: Adobe permits you to use, modify, and distribute this \n * file in accordance with the terms of the Adobe license agreement \n * accompanying it. \n *******************************************************************/\n\nimport { fetchGraphQl } from '@/quote-management/api';\nimport { QUOTE_TEMPLATES_QUERY } from './graphql/getQuoteTemplates';\nimport { transformQuoteTemplatesList } from '@/quote-management/data/transforms';\nimport { NegotiableQuoteTemplatesListModel } from '@/quote-management/data/models/negotiable-quote-template-model';\nimport { state } from '@/quote-management/lib/state';\nimport { events } from '@adobe-commerce/event-bus';\n\nexport enum QuoteTemplateFilterStatus {\n ACTIVE = 'ACTIVE',\n IN_REVIEW = 'IN_REVIEW',\n INACTIVE = 'INACTIVE',\n}\n\nexport interface QuoteTemplateFilterInput {\n status?: QuoteTemplateFilterStatus[];\n name?: {\n match?: string;\n };\n}\n\nexport enum QuoteTemplateSortField {\n NAME = 'NAME',\n CREATED_AT = 'CREATED_AT',\n UPDATED_AT = 'UPDATED_AT',\n}\n\nexport enum SortDirection {\n ASC = 'ASC',\n DESC = 'DESC',\n}\n\nexport interface QuoteTemplateSortInput {\n sortField: QuoteTemplateSortField;\n sortDirection: SortDirection;\n}\n\nexport interface GetQuoteTemplatesParams {\n filter?: QuoteTemplateFilterInput;\n pageSize?: number;\n currentPage?: number;\n sort?: QuoteTemplateSortInput;\n}\n\nexport const getQuoteTemplates = async (\n params: GetQuoteTemplatesParams = {}\n): Promise<NegotiableQuoteTemplatesListModel> => {\n if (!state.authenticated) {\n throw new Error('Unauthorized');\n }\n\n try {\n const results: any = await fetchGraphQl(QUOTE_TEMPLATES_QUERY, {\n variables: {\n filter: params.filter || null,\n pageSize: params.pageSize || 20,\n currentPage: params.currentPage || 1,\n sort: params.sort || null,\n },\n });\n\n if (!results?.data?.negotiableQuoteTemplates) {\n throw new Error('No quote templates data received');\n }\n\n const transformedData = transformQuoteTemplatesList(results.data.negotiableQuoteTemplates);\n\n if (!transformedData) {\n throw new Error('Failed to transform quote templates data');\n }\n\n events.emit('quote-management/quote-templates-data', {\n quoteTemplates: transformedData,\n permissions: state.permissions,\n });\n\n return transformedData;\n } catch (error) {\n return Promise.reject(error);\n }\n};"],"names":["transformQuoteTemplate","templateData","_a","comment","a","_b","tax","_c","h","_d","item","discount","note","_e","option","_f","value","address","transformQuoteTemplatesList","templatesData","transformedModel","template","paginationInfo","transformPaginationInfo","QUOTE_TEMPLATES_QUERY","QuoteTemplateFilterStatus","QuoteTemplateSortField","SortDirection","getQuoteTemplates","params","state","results","fetchGraphQl","transformedData","events","error"],"mappings":"oIAeO,SAASA,EACZC,EACmC,eACnC,OAAKA,EAIE,CACH,IAAKA,EAAa,IAClB,KAAMA,EAAa,KACnB,UAAWA,EAAa,WACxB,UAAWA,EAAa,WACxB,eAAgBA,EAAa,gBAC7B,OAAQA,EAAa,OACrB,aAAcA,EAAa,eAC3B,MAAO,CACH,UAAWA,EAAa,MAAM,UAC9B,SAAUA,EAA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AAO,aAAe,EACnC,KAAMA,EAAO,MAAQ,IAAA,CACvB,CACD,EAED,GAAI,GAAC3B,EAAA6B,GAAA,YAAAA,EAAS,OAAT,MAAA7B,EAAe,0BAClB,MAAM,IAAI,MAAM,kCAAkC,EAGpD,MAAM+B,EAAkBf,EAA4Ba,EAAQ,KAAK,wBAAwB,EAEzF,GAAI,CAACE,EACH,MAAM,IAAI,MAAM,0CAA0C,EAG5D,OAAAC,EAAO,KAAK,wCAAyC,CACnD,eAAgBD,EAChB,YAAaH,EAAM,WAAA,CACpB,EAEMG,CACT,OAASE,EAAO,CACd,OAAO,QAAQ,OAAOA,CAAK,CAC7B,CACF"}
@@ -1,6 +1,6 @@
1
1
  /*! Copyright 2025 Adobe
2
2
  All Rights Reserved. */
3
- import{f as n,a as s}from"./transform-quote.js";import{s as i}from"./state.js";import"@dropins/tools/event-bus.js";const u=`
3
+ import"@dropins/tools/event-bus.js";import{f as n,b as s}from"./transform-quote.js";import{s as i}from"./state.js";const u=`
4
4
  fragment NegotiableQuoteListFragment on NegotiableQuote {
5
5
  uid
6
6
  name
@@ -0,0 +1,38 @@
1
+ /*! Copyright 2025 Adobe
2
+ All Rights Reserved. */
3
+ import{events as q}from"@dropins/tools/event-bus.js";import{f as d,a as I}from"./transform-quote.js";import{s as E}from"./state.js";import{N as U}from"./NegotiableQuoteFragment.js";const T=`
4
+ mutation UPDATE_NEGOTIABLE_QUOTE_QUANTITIES_MUTATION(
5
+ $quoteUid: ID!
6
+ $items: [NegotiableQuoteItemQuantityInput!]!
7
+ ) {
8
+ updateNegotiableQuoteQuantities(
9
+ input: {
10
+ quote_uid: $quoteUid
11
+ items: $items
12
+ }
13
+ ) {
14
+ quote {
15
+ ...NegotiableQuoteFragment
16
+ }
17
+ }
18
+ }
19
+ ${U}
20
+ `,Q=async u=>{if(!E.authenticated)return Promise.reject(new Error("Unauthorized"));const{quoteUid:r,items:e}=u;if(!r)throw new Error("Quote UID is required");if(!e||!Array.isArray(e)||e.length===0)throw new Error("Items array is required and must not be empty");for(const t of e){if(!t.quoteItemUid)throw new Error("Each item must have a quoteItemUid");if(typeof t.quantity!="number"||t.quantity<=0)throw new Error(`Invalid quantity for item ${t.quoteItemUid}: quantity must be a positive number`);if(!Number.isInteger(t.quantity))throw new Error(`Invalid quantity for item ${t.quoteItemUid}: quantity must be an integer`)}const s=e.map(t=>({quote_item_uid:t.quoteItemUid,quantity:t.quantity}));return d(T,{variables:{quoteUid:r,items:s}}).then(t=>{var a,n;const{errors:i}=t;if(i){const m=i.map(f=>f.message).join("; ");throw new Error(`Failed to update quote quantities: ${m}`)}const o=I((n=(a=t.data)==null?void 0:a.updateNegotiableQuoteQuantities)==null?void 0:n.quote);if(!o)throw new Error("Failed to transform quote data: Invalid response structure");return q.emit("quote-management/quantities-updated",{quote:o,input:{quoteUid:r,items:e}}),o})},c=`
21
+ mutation REMOVE_NEGOTIABLE_QUOTE_ITEMS_MUTATION(
22
+ $quoteUid: ID!
23
+ $quoteItemUids: [ID!]!
24
+ ) {
25
+ removeNegotiableQuoteItems(
26
+ input: {
27
+ quote_uid: $quoteUid
28
+ quote_item_uids: $quoteItemUids
29
+ }
30
+ ) {
31
+ quote {
32
+ ...NegotiableQuoteFragment
33
+ }
34
+ }
35
+ }
36
+ ${U}
37
+ `,g=async u=>{var a;if(!E.authenticated)return Promise.reject(new Error("Unauthorized"));const{quoteUid:r,quoteItemUids:e}=u;if(!r)throw new Error("Quote UID is required");if(!Array.isArray(e)||e.length===0)throw new Error("At least one quote item UID is required");const s=await d(c,{variables:{quoteUid:r,quoteItemUids:e}}),{errors:t,data:i}=s;if(t!=null&&t.length){const n=t.map(m=>m.message).join("; ");throw new Error(`Failed to remove negotiable quote items: ${n}`)}const o=I((a=i==null?void 0:i.removeNegotiableQuoteItems)==null?void 0:a.quote);if(!o)throw new Error("Failed to transform quote data: Invalid response structure");return q.emit("quote-management/quote-items-removed",{quote:o,removedItemUids:e,input:u}),o};export{g as r,Q as u};
38
+ //# sourceMappingURL=removeNegotiableQuoteItems.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"removeNegotiableQuoteItems.js","sources":["/@dropins/storefront-quote-management/src/api/updateQuantities/graphql/UpdateNegotiableQuoteQuantitiesMutation.ts","/@dropins/storefront-quote-management/src/api/updateQuantities/updateQuantities.ts","/@dropins/storefront-quote-management/src/api/removeNegotiableQuoteItems/graphql/RemoveNegotiableQuoteItemsMutation.ts","/@dropins/storefront-quote-management/src/api/removeNegotiableQuoteItems/removeNegotiableQuoteItems.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\nimport { NEGOTIABLE_QUOTE_FRAGMENT } from '@/quote-management/api/graphql/NegotiableQuoteFragment';\n\nexport const UPDATE_NEGOTIABLE_QUOTE_QUANTITIES_MUTATION = `\n mutation UPDATE_NEGOTIABLE_QUOTE_QUANTITIES_MUTATION(\n $quoteUid: ID!\n $items: [NegotiableQuoteItemQuantityInput!]!\n ) {\n updateNegotiableQuoteQuantities(\n input: {\n quote_uid: $quoteUid\n items: $items\n }\n ) {\n quote {\n ...NegotiableQuoteFragment\n }\n }\n }\n ${NEGOTIABLE_QUOTE_FRAGMENT}\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 { fetchGraphQl } from '@/quote-management/api';\nimport { events } from '@adobe-commerce/event-bus';\nimport { state } from '@/quote-management/lib/state';\nimport { UPDATE_NEGOTIABLE_QUOTE_QUANTITIES_MUTATION } from './graphql/UpdateNegotiableQuoteQuantitiesMutation';\nimport { NegotiableQuoteModel } from '@/quote-management/data/models/negotiable-quote-model';\nimport { transformQuote } from '@/quote-management/data/transforms';\n\nexport interface QuantityItem {\n /** The unique ID of the quote item */\n quoteItemUid: string;\n /** The new quantity for the item (must be greater than 0) */\n quantity: number;\n}\n\nexport interface UpdateQuantitiesInput {\n /** The unique ID of the negotiable quote */\n quoteUid: string;\n /** Array of items with their new quantities */\n items: QuantityItem[];\n}\n\n/**\n * Updates the quantities of items in a negotiable quote.\n *\n * @param input - The input parameters for updating quantities\n * @param input.quoteUid - The unique ID of the negotiable quote\n * @param input.items - Array of items with their new quantities\n * @returns Promise that resolves to the updated quote model\n * @throws Error if validation fails or GraphQL operation fails\n *\n * @example\n * ```ts\n * const quote = await updateQuantities({\n * quoteUid: 'quote-123',\n * items: [\n * { quoteItemUid: 'item-1', quantity: 5 },\n * { quoteItemUid: 'item-2', quantity: 3 }\n * ]\n * });\n * ```\n */\nexport const updateQuantities = async (\n input: UpdateQuantitiesInput\n): Promise<NegotiableQuoteModel | null> => {\n if (!state.authenticated) {\n return Promise.reject(new Error('Unauthorized'));\n }\n\n const { quoteUid, items } = input;\n\n // Validate quoteUid\n if (!quoteUid) {\n throw new Error('Quote UID is required');\n }\n\n // Validate items array\n if (!items || !Array.isArray(items) || items.length === 0) {\n throw new Error('Items array is required and must not be empty');\n }\n\n // Validate each item\n for (const item of items) {\n if (!item.quoteItemUid) {\n throw new Error('Each item must have a quoteItemUid');\n }\n if (typeof item.quantity !== 'number' || item.quantity <= 0) {\n throw new Error(\n `Invalid quantity for item ${item.quoteItemUid}: quantity must be a positive number`\n );\n }\n // Ensure quantity is an integer\n if (!Number.isInteger(item.quantity)) {\n throw new Error(\n `Invalid quantity for item ${item.quoteItemUid}: quantity must be an integer`\n );\n }\n }\n\n // Transform items to snake_case for GraphQL\n const transformedItems = items.map((item) => ({\n quote_item_uid: item.quoteItemUid,\n quantity: item.quantity,\n }));\n\n return fetchGraphQl(UPDATE_NEGOTIABLE_QUOTE_QUANTITIES_MUTATION, {\n variables: {\n quoteUid,\n items: transformedItems,\n },\n }).then((response) => {\n const { errors } = response;\n\n if (errors) {\n // Provide more detailed error information\n const errorMessages = errors.map((error) => error.message).join('; ');\n throw new Error(`Failed to update quote quantities: ${errorMessages}`);\n }\n\n // Transform the quote data\n const quoteData = transformQuote(\n response.data?.updateNegotiableQuoteQuantities?.quote\n );\n\n if (!quoteData) {\n throw new Error(\n 'Failed to transform quote data: Invalid response structure'\n );\n }\n\n // Emit event with transformed quote data on success\n events.emit('quote-management/quantities-updated', {\n quote: quoteData,\n input: { quoteUid, items },\n });\n\n return quoteData;\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 { NEGOTIABLE_QUOTE_FRAGMENT } from '@/quote-management/api/graphql/NegotiableQuoteFragment';\n\nexport const REMOVE_NEGOTIABLE_QUOTE_ITEMS_MUTATION = `\n mutation REMOVE_NEGOTIABLE_QUOTE_ITEMS_MUTATION(\n $quoteUid: ID!\n $quoteItemUids: [ID!]!\n ) {\n removeNegotiableQuoteItems(\n input: {\n quote_uid: $quoteUid\n quote_item_uids: $quoteItemUids\n }\n ) {\n quote {\n ...NegotiableQuoteFragment\n }\n }\n }\n ${NEGOTIABLE_QUOTE_FRAGMENT}\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 { fetchGraphQl } from '@/quote-management/api';\nimport { events } from '@adobe-commerce/event-bus';\nimport { state } from '@/quote-management/lib/state';\nimport { NegotiableQuoteModel } from '@/quote-management/data/models/negotiable-quote-model';\nimport { transformQuote } from '@/quote-management/data/transforms';\nimport { REMOVE_NEGOTIABLE_QUOTE_ITEMS_MUTATION } from './graphql/RemoveNegotiableQuoteItemsMutation';\n\nexport interface RemoveNegotiableQuoteItemsInput {\n quoteUid: string;\n quoteItemUids: string[];\n}\n\nexport const removeNegotiableQuoteItems = async (\n input: RemoveNegotiableQuoteItemsInput\n): Promise<NegotiableQuoteModel | null> => {\n if (!state.authenticated) {\n return Promise.reject(new Error('Unauthorized'));\n }\n\n const { quoteUid, quoteItemUids } = input;\n\n if (!quoteUid) {\n throw new Error('Quote UID is required');\n }\n\n if (!Array.isArray(quoteItemUids) || quoteItemUids.length === 0) {\n throw new Error('At least one quote item UID is required');\n }\n\n const response = await fetchGraphQl(REMOVE_NEGOTIABLE_QUOTE_ITEMS_MUTATION, {\n variables: {\n quoteUid,\n quoteItemUids,\n },\n });\n\n const { errors, data } = response;\n\n if (errors?.length) {\n const errorMessages = errors.map((error) => error.message).join('; ');\n throw new Error(\n `Failed to remove negotiable quote items: ${errorMessages}`\n );\n }\n\n const quote = transformQuote(data?.removeNegotiableQuoteItems?.quote);\n\n if (!quote) {\n throw new Error(\n 'Failed to transform quote data: Invalid response structure'\n );\n }\n\n events.emit('quote-management/quote-items-removed', {\n quote,\n removedItemUids: quoteItemUids,\n input,\n });\n\n return quote;\n};\n"],"names":["UPDATE_NEGOTIABLE_QUOTE_QUANTITIES_MUTATION","NEGOTIABLE_QUOTE_FRAGMENT","updateQuantities","input","state","quoteUid","items","item","transformedItems","fetchGraphQl","response","errors","errorMessages","error","quoteData","transformQuote","_b","_a","events","REMOVE_NEGOTIABLE_QUOTE_ITEMS_MUTATION","removeNegotiableQuoteItems","quoteItemUids","data","quote"],"mappings":"qLAWO,MAAMA,EAA8C;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,IAgBvDC,CAAyB;AAAA,ECuBhBC,EAAmB,MAC9BC,GACyC,CACzC,GAAI,CAACC,EAAM,cACT,OAAO,QAAQ,OAAO,IAAI,MAAM,cAAc,CAAC,EAGjD,KAAM,CAAE,SAAAC,EAAU,MAAAC,CAAA,EAAUH,EAG5B,GAAI,CAACE,EACH,MAAM,IAAI,MAAM,uBAAuB,EAIzC,GAA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,OAAO,IAAI,MAAM,cAAc,CAAC,EAGjD,KAAM,CAAE,SAAAC,EAAU,cAAAgB,CAAA,EAAkBlB,EAEpC,GAAI,CAACE,EACH,MAAM,IAAI,MAAM,uBAAuB,EAGzC,GAAI,CAAC,MAAM,QAAQgB,CAAa,GAAKA,EAAc,SAAW,EAC5D,MAAM,IAAI,MAAM,yCAAyC,EAG3D,MAAMX,EAAW,MAAMD,EAAaU,EAAwC,CAC1E,UAAW,CACT,SAAAd,EACA,cAAAgB,CAAA,CACF,CACD,EAEK,CAAE,OAAAV,EAAQ,KAAAW,CAAA,EAASZ,EAEzB,GAAIC,GAAA,MAAAA,EAAQ,OAAQ,CAClB,MAAMC,EAAgBD,EAAO,IAAKE,GAAUA,EAAM,OAAO,EAAE,KAAK,IAAI,EACpE,MAAM,IAAI,MACR,4CAA4CD,CAAa,EAAA,CAE7D,CAEA,MAAMW,EAAQR,GAAeE,EAAAK,GAAA,YAAAA,EAAM,6BAAN,YAAAL,EAAkC,KAAK,EAEpE,GAAI,CAACM,EACH,MAAM,IAAI,MACR,4DAAA,EAIJ,OAAAL,EAAO,KAAK,uCAAwC,CAClD,MAAAK,EACA,gBAAiBF,EACjB,MAAAlB,CAAA,CACD,EAEMoB,CACT"}
@@ -1,6 +1,6 @@
1
1
  /*! Copyright 2025 Adobe
2
2
  All Rights Reserved. */
3
- import{f as g,t as q}from"./transform-quote.js";import{s as p}from"./state.js";import{events as _}from"@dropins/tools/event-bus.js";import{N as E}from"./NegotiableQuoteFragment.js";const Q=`
3
+ import{events as _}from"@dropins/tools/event-bus.js";import{f as g,a as q}from"./transform-quote.js";import{N as E}from"./NegotiableQuoteFragment.js";import{s as p}from"./state.js";const Q=`
4
4
  query QUOTE_DATA_QUERY(
5
5
  $quoteId: ID!
6
6
  ) {
package/chunks/state.js CHANGED
@@ -1,4 +1,4 @@
1
1
  /*! Copyright 2025 Adobe
2
2
  All Rights Reserved. */
3
- var t=(e=>(e[e.TAX_EXCLUDED=1]="TAX_EXCLUDED",e[e.TAX_INCLUDED=2]="TAX_INCLUDED",e[e.TAX_INCLUDED_AND_EXCLUDED=3]="TAX_INCLUDED_AND_EXCLUDED",e))(t||{});const D={requestQuote:!1,editQuote:!1,deleteQuote:!1,checkoutQuote:!1},r={quoteSummaryDisplayTotal:1,quoteSummaryMaxItems:10,quoteDisplaySettings:{zeroTax:!1,subtotal:t.TAX_INCLUDED,price:t.TAX_INCLUDED,shipping:t.TAX_INCLUDED,fullSummary:!1,grandTotal:!0},useConfigurableParentThumbnail:!0},E={authenticated:!1,permissions:D,config:r},_=new Proxy(E,{get:(e,a)=>e[a],set:(e,a,s)=>(e[a]=s,!0)});export{D,t as Q,r as a,_ as s};
3
+ var t=(e=>(e[e.TAX_EXCLUDED=1]="TAX_EXCLUDED",e[e.TAX_INCLUDED=2]="TAX_INCLUDED",e[e.TAX_INCLUDED_AND_EXCLUDED=3]="TAX_INCLUDED_AND_EXCLUDED",e))(t||{});const r={requestQuote:!1,editQuote:!1,deleteQuote:!1,checkoutQuote:!1,viewQuoteTemplates:!1,manageQuoteTemplates:!1,generateQuoteFromTemplate:!1},D={quoteSummaryDisplayTotal:1,quoteSummaryMaxItems:10,quoteDisplaySettings:{zeroTax:!1,subtotal:t.TAX_INCLUDED,price:t.TAX_INCLUDED,shipping:t.TAX_INCLUDED,fullSummary:!1,grandTotal:!0},useConfigurableParentThumbnail:!0},l={authenticated:!1,permissions:r,config:D},E=new Proxy(l,{get:(e,a)=>e[a],set:(e,a,s)=>(e[a]=s,!0)});export{r as D,t as Q,D as a,E as s};
4
4
  //# sourceMappingURL=state.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"state.js","sources":["/@dropins/storefront-quote-management/src/data/models/store-config-model.ts","/@dropins/storefront-quote-management/src/lib/state.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 enum QuoteDisplayAmount {\n TAX_EXCLUDED = 1,\n TAX_INCLUDED = 2,\n TAX_INCLUDED_AND_EXCLUDED = 3,\n}\n\nexport interface StoreConfigModel {\n quoteSummaryDisplayTotal: number;\n quoteSummaryMaxItems: number;\n quoteDisplaySettings: {\n zeroTax: boolean;\n subtotal: QuoteDisplayAmount;\n price: QuoteDisplayAmount;\n shipping: QuoteDisplayAmount;\n fullSummary: boolean;\n grandTotal: boolean;\n };\n useConfigurableParentThumbnail: boolean;\n}\n","/********************************************************************\n * Copyright 2025 Adobe\n * All Rights Reserved.\n *\n * NOTICE: Adobe permits you to use, modify, and distribute this\n * file in accordance with the terms of the Adobe license agreement\n * accompanying it.\n *******************************************************************/\n\nimport {\n QuoteDisplayAmount,\n StoreConfigModel,\n} from '@/quote-management/data/models';\nimport { State } from '@/quote-management/types/state.types';\n\nexport const DEFAULT_PERMISSIONS = {\n requestQuote: false,\n editQuote: false,\n deleteQuote: false,\n checkoutQuote: false,\n};\n\nexport const DEFAULT_CONFIG: StoreConfigModel = {\n quoteSummaryDisplayTotal: 1,\n quoteSummaryMaxItems: 10,\n quoteDisplaySettings: {\n zeroTax: false,\n subtotal: QuoteDisplayAmount.TAX_INCLUDED,\n price: QuoteDisplayAmount.TAX_INCLUDED,\n shipping: QuoteDisplayAmount.TAX_INCLUDED,\n fullSummary: false,\n grandTotal: true,\n },\n useConfigurableParentThumbnail: true,\n};\n\nconst _state: State = {\n authenticated: false,\n permissions: DEFAULT_PERMISSIONS,\n config: DEFAULT_CONFIG,\n};\n\n// Proxy state to make it reactive\nexport const state = new Proxy(_state, {\n get: (target, key) => {\n return target[key as keyof State];\n },\n set: (target, key, value) => {\n target[key as keyof State] = value;\n return true;\n },\n});\n"],"names":["QuoteDisplayAmount","DEFAULT_PERMISSIONS","DEFAULT_CONFIG","_state","state","target","key","value"],"mappings":"AASO,IAAKA,GAAAA,IACVA,EAAAA,EAAA,aAAe,CAAA,EAAf,eACAA,EAAAA,EAAA,aAAe,CAAA,EAAf,eACAA,EAAAA,EAAA,0BAA4B,CAAA,EAA5B,4BAHUA,IAAAA,GAAA,CAAA,CAAA,ECML,MAAMC,EAAsB,CACjC,aAAc,GACd,UAAW,GACX,YAAa,GACb,cAAe,EACjB,EAEaC,EAAmC,CAC9C,yBAA0B,EAC1B,qBAAsB,GACtB,qBAAsB,CACpB,QAAS,GACT,SAAUF,EAAmB,aAC7B,MAAOA,EAAmB,aAC1B,SAAUA,EAAmB,aAC7B,YAAa,GACb,WAAY,EAAA,EAEd,+BAAgC,EAClC,EAEMG,EAAgB,CACpB,cAAe,GACf,YAAaF,EACb,OAAQC,CACV,EAGaE,EAAQ,IAAI,MAAMD,EAAQ,CACrC,IAAK,CAACE,EAAQC,IACLD,EAAOC,CAAkB,EAElC,IAAK,CAACD,EAAQC,EAAKC,KACjBF,EAAOC,CAAkB,EAAIC,EACtB,GAEX,CAAC"}
1
+ {"version":3,"file":"state.js","sources":["/@dropins/storefront-quote-management/src/data/models/store-config-model.ts","/@dropins/storefront-quote-management/src/lib/state.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 enum QuoteDisplayAmount {\n TAX_EXCLUDED = 1,\n TAX_INCLUDED = 2,\n TAX_INCLUDED_AND_EXCLUDED = 3,\n}\n\nexport interface StoreConfigModel {\n quoteSummaryDisplayTotal: number;\n quoteSummaryMaxItems: number;\n quoteDisplaySettings: {\n zeroTax: boolean;\n subtotal: QuoteDisplayAmount;\n price: QuoteDisplayAmount;\n shipping: QuoteDisplayAmount;\n fullSummary: boolean;\n grandTotal: boolean;\n };\n useConfigurableParentThumbnail: boolean;\n}\n","/********************************************************************\n * Copyright 2025 Adobe\n * All Rights Reserved.\n *\n * NOTICE: Adobe permits you to use, modify, and distribute this\n * file in accordance with the terms of the Adobe license agreement\n * accompanying it.\n *******************************************************************/\n\nimport {\n QuoteDisplayAmount,\n StoreConfigModel,\n} from '@/quote-management/data/models';\nimport { State } from '@/quote-management/types/state.types';\n\nexport const DEFAULT_PERMISSIONS = {\n requestQuote: false,\n editQuote: false,\n deleteQuote: false,\n checkoutQuote: false,\n viewQuoteTemplates: false,\n manageQuoteTemplates: false,\n generateQuoteFromTemplate: false,\n};\n\nexport const DEFAULT_CONFIG: StoreConfigModel = {\n quoteSummaryDisplayTotal: 1,\n quoteSummaryMaxItems: 10,\n quoteDisplaySettings: {\n zeroTax: false,\n subtotal: QuoteDisplayAmount.TAX_INCLUDED,\n price: QuoteDisplayAmount.TAX_INCLUDED,\n shipping: QuoteDisplayAmount.TAX_INCLUDED,\n fullSummary: false,\n grandTotal: true,\n },\n useConfigurableParentThumbnail: true,\n};\n\nconst _state: State = {\n authenticated: false,\n permissions: DEFAULT_PERMISSIONS,\n config: DEFAULT_CONFIG,\n};\n\n// Proxy state to make it reactive\nexport const state = new Proxy(_state, {\n get: (target, key) => {\n return target[key as keyof State];\n },\n set: (target, key, value) => {\n target[key as keyof State] = value;\n return true;\n },\n});\n"],"names":["QuoteDisplayAmount","DEFAULT_PERMISSIONS","DEFAULT_CONFIG","_state","state","target","key","value"],"mappings":"AASO,IAAKA,GAAAA,IACVA,EAAAA,EAAA,aAAe,CAAA,EAAf,eACAA,EAAAA,EAAA,aAAe,CAAA,EAAf,eACAA,EAAAA,EAAA,0BAA4B,CAAA,EAA5B,4BAHUA,IAAAA,GAAA,CAAA,CAAA,ECML,MAAMC,EAAsB,CACjC,aAAc,GACd,UAAW,GACX,YAAa,GACb,cAAe,GACf,mBAAoB,GACpB,qBAAsB,GACtB,0BAA2B,EAC7B,EAEaC,EAAmC,CAC9C,yBAA0B,EAC1B,qBAAsB,GACtB,qBAAsB,CACpB,QAAS,GACT,SAAUF,EAAmB,aAC7B,MAAOA,EAAmB,aAC1B,SAAUA,EAAmB,aAC7B,YAAa,GACb,WAAY,EAAA,EAEd,+BAAgC,EAClC,EAEMG,EAAgB,CACpB,cAAe,GACf,YAAaF,EACb,OAAQC,CACV,EAGaE,EAAQ,IAAI,MAAMD,EAAQ,CACrC,IAAK,CAACE,EAAQC,IACLD,EAAOC,CAAkB,EAElC,IAAK,CAACD,EAAQC,EAAKC,KACjBF,EAAOC,CAAkB,EAAIC,EACtB,GAEX,CAAC"}
@@ -1,4 +1,4 @@
1
1
  /*! Copyright 2025 Adobe
2
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};
3
+ import{FetchGraphQL as I}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:B,removeFetchGraphQlHeader:G,setFetchGraphQlHeaders:z,fetchGraphQl:W,getConfig:H}=new I().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=D(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},...F(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,readOnly:["ORDERED","SUBMITTED","CLOSED","PENDING"].includes(e.status)||!g.permissions.editQuote}}function V(e){return e?S(e):null}function D(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=D(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=Q(r);return{...r,paginationInfo:n||void 0}}function Q(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 F(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{V as a,X as b,B as c,z as d,H as e,W as f,K as g,G as r,M as s,Q as t};
4
4
  //# sourceMappingURL=transform-quote.js.map
@@ -1 +1 @@
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,EAAI,IAAIC,EAAA,EAAe,WAAA,ECWjBC,EAA0B,CAC9B,QACA,UACA,WACA,UACA,MACA,MACF,EAGA,SAASC,EAAiBC,EAAY,CACpC,GAAI,CAACA,EAAM,MAAO,MAAO,GAEzB,MAAMC,EAASC,EAAM,OAErB,OAAID,GAAA,YAAAA,EAAQ,4BAA6B,EAAUD,EAAM,MAAM,QAC3DC,GA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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
+ {"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 readOnly: 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 readOnly:\n ['ORDERED', 'SUBMITTED', 'CLOSED', 'PENDING'].includes(quote.status) ||\n !state.permissions.editQuote,\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":"8FAyRO,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,ECvRL,KAAM,CACX,YAAAC,EACA,sBAAAC,EACA,yBAAAC,EACA,uBAAAC,EACA,aAAAC,EACA,UAAAC,CACF,EAAI,IAAIC,EAAA,EAAe,WAAA,ECWjBC,EAA0B,CAC9B,QACA,UACA,WACA,UACA,MACA,MACF,EAGA,SAASC,EAAiBC,EAAY,CACpC,GAAI,CAACA,EAAM,MAAO,MAAO,GAEzB,MAAMC,EAASC,EAAM,OAErB,OAAID,GAAA,YAAAA,EAAQ,4BAA6B,EAAUD,EAAM,MAAM,QAC3DC,GAAA,YAAAA,EAA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AAK,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,6 +1,6 @@
1
1
  /*! Copyright 2025 Adobe
2
2
  All Rights Reserved. */
3
- import{f as l,t as w}from"./transform-quote.js";import"./state.js";import{events as E}from"@dropins/tools/event-bus.js";import{N as f}from"./NegotiableQuoteFragment.js";const N=`
3
+ import{events as E}from"@dropins/tools/event-bus.js";import{N as w}from"./NegotiableQuoteFragment.js";import{f as l,a as f}from"./transform-quote.js";import"./state.js";const N=`
4
4
  mutation REQUEST_NEGOTIABLE_QUOTE_MUTATION(
5
5
  $cartId: ID!
6
6
  $quoteName: String!
@@ -20,8 +20,8 @@ import{f as l,t as w}from"./transform-quote.js";import"./state.js";import{events
20
20
  }
21
21
  }
22
22
  }
23
- ${f}
24
- `,$=async t=>{const{cartId:n,quoteName:e,comment:o,attachments:r,isDraft:i}=t;if(!n)throw new Error("Cart ID is required");if(!e)throw new Error("Quote name is required");if(!o)throw new Error("Comment is required");return l(N,{variables:{cartId:n,quoteName:e,comment:r!=null&&r.length?{comment:o,attachments:r}:{comment:o},isDraft:i}}).then(m=>{var s,u;const{errors:d}=m;if(d){const c=d.map(p=>p.message).join("; ");throw new Error(`Failed to request negotiable quote: ${c}`)}const a=w((u=(s=m.data)==null?void 0:s.requestNegotiableQuote)==null?void 0:u.quote);if(!a)throw new Error("Failed to transform quote data: Invalid response structure");return E.emit("quote-management/negotiable-quote-requested",{quote:a,input:{cartId:n,quoteName:e,comment:o,attachments:r,isDraft:i}}),a})},h=`
23
+ ${w}
24
+ `,$=async t=>{const{cartId:n,quoteName:e,comment:o,attachments:r,isDraft:i}=t;if(!n)throw new Error("Cart ID is required");if(!e)throw new Error("Quote name is required");if(!o)throw new Error("Comment is required");return l(N,{variables:{cartId:n,quoteName:e,comment:r!=null&&r.length?{comment:o,attachments:r}:{comment:o},isDraft:i}}).then(m=>{var s,u;const{errors:d}=m;if(d){const c=d.map(p=>p.message).join("; ");throw new Error(`Failed to request negotiable quote: ${c}`)}const a=f((u=(s=m.data)==null?void 0:s.requestNegotiableQuote)==null?void 0:u.quote);if(!a)throw new Error("Failed to transform quote data: Invalid response structure");return E.emit("quote-management/negotiable-quote-requested",{quote:a,input:{cartId:n,quoteName:e,comment:o,attachments:r,isDraft:i}}),a})},h=`
25
25
  mutation INITIATE_UPLOAD_MUTATION($input: initiateUploadInput!) {
26
26
  initiateUpload(input: $input) {
27
27
  upload_url