@dropins/storefront-quote-management 0.0.1-alpha9 → 1.0.0-beta1

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 (305) hide show
  1. package/api/acceptQuoteTemplate/acceptQuoteTemplate.d.ts +13 -0
  2. package/api/{getCustomerData/getCustomerData.d.ts → acceptQuoteTemplate/graphql/acceptQuoteTemplate.d.ts} +2 -2
  3. package/{data/transforms/__fixtures__/customerData.d.ts → api/acceptQuoteTemplate/index.d.ts} +2 -2
  4. package/api/addQuoteTemplateLineItemNote/addQuoteTemplateLineItemNote.d.ts +15 -0
  5. package/api/addQuoteTemplateLineItemNote/graphql/setQuoteTemplateLineItemNote.d.ts +10 -0
  6. package/api/addQuoteTemplateLineItemNote/index.d.ts +10 -0
  7. package/api/addQuoteTemplateShippingAddress/addQuoteTemplateShippingAddress.d.ts +37 -0
  8. package/api/addQuoteTemplateShippingAddress/graphql/setNegotiableQuoteTemplateShippingAddress.d.ts +10 -0
  9. package/api/addQuoteTemplateShippingAddress/index.d.ts +10 -0
  10. package/api/cancelQuoteTemplate/cancelQuoteTemplate.d.ts +14 -0
  11. package/api/cancelQuoteTemplate/graphql/cancelQuoteTemplate.d.ts +10 -0
  12. package/api/cancelQuoteTemplate/index.d.ts +10 -0
  13. package/api/closeNegotiableQuote/closeNegotiableQuote.d.ts +31 -0
  14. package/api/closeNegotiableQuote/graphql/CloseNegotiableQuoteMutation.d.ts +2 -0
  15. package/api/closeNegotiableQuote/index.d.ts +10 -0
  16. package/api/createQuoteTemplate/createQuoteTemplate.d.ts +4 -0
  17. package/api/createQuoteTemplate/graphql/createQuoteTemplate.d.ts +10 -0
  18. package/api/createQuoteTemplate/index.d.ts +10 -0
  19. package/api/deleteQuote/deleteQuote.d.ts +28 -0
  20. package/api/deleteQuote/graphql/DeleteQuoteMutation.d.ts +10 -0
  21. package/api/{getCustomerData → deleteQuote}/index.d.ts +1 -1
  22. package/{data/models/customer-model.d.ts → api/deleteQuoteTemplate/deleteQuoteTemplate.d.ts} +6 -8
  23. package/api/deleteQuoteTemplate/graphql/deleteQuoteTemplate.d.ts +10 -0
  24. package/api/deleteQuoteTemplate/index.d.ts +10 -0
  25. package/api/duplicateNegotiableQuote/duplicateNegotiableQuote.d.ts +8 -0
  26. package/api/duplicateNegotiableQuote/graphql/duplicateNegotiableQuoteMutation.d.ts +10 -0
  27. package/api/duplicateNegotiableQuote/index.d.ts +10 -0
  28. package/api/generateQuoteFromTemplate/generateQuoteFromTemplate.d.ts +15 -0
  29. package/api/generateQuoteFromTemplate/graphql/generateNegotiableQuoteFromTemplate.d.ts +10 -0
  30. package/api/generateQuoteFromTemplate/index.d.ts +10 -0
  31. package/api/getQuoteData/getQuoteData.d.ts +10 -0
  32. package/api/getQuoteData/graphql/QuoteDataQuery.d.ts +2 -0
  33. package/api/getQuoteData/index.d.ts +10 -0
  34. package/api/getQuoteTemplateData/getQuoteTemplateData.d.ts +4 -0
  35. package/api/getQuoteTemplateData/graphql/getQuoteTemplateData.d.ts +10 -0
  36. package/api/getQuoteTemplateData/index.d.ts +10 -0
  37. package/api/getQuoteTemplates/getQuoteTemplates.d.ts +34 -0
  38. package/api/getQuoteTemplates/graphql/getQuoteTemplates.d.ts +10 -0
  39. package/api/getQuoteTemplates/index.d.ts +10 -0
  40. package/api/getStoreConfig/getStoreConfig.d.ts +4 -0
  41. package/api/getStoreConfig/graphql/StoreConfigQuery.d.ts +10 -0
  42. package/api/getStoreConfig/index.d.ts +10 -0
  43. package/api/graphql/NegotiableQuoteAddressFragment.d.ts +10 -0
  44. package/api/graphql/NegotiableQuoteFragment.d.ts +5 -13
  45. package/api/graphql/NegotiableQuoteListFragment.d.ts +10 -0
  46. package/api/graphql/NegotiableQuoteTemplateFragment.d.ts +10 -0
  47. package/api/graphql/SearchResultPageInfoFragment.d.ts +10 -0
  48. package/api/graphql/ShippingMethodFragment.d.ts +10 -0
  49. package/api/graphql/SortFieldsFragment.d.ts +10 -0
  50. package/api/index.d.ts +34 -1
  51. package/api/initialize/initialize.d.ts +2 -0
  52. package/api/negotiableQuotes/graphql/NegotiableQuotesQuery.d.ts +10 -0
  53. package/api/negotiableQuotes/index.d.ts +10 -0
  54. package/api/negotiableQuotes/negotiableQuotes.d.ts +39 -0
  55. package/api/openQuoteTemplate/graphql/openQuoteTemplate.d.ts +10 -0
  56. package/api/openQuoteTemplate/index.d.ts +10 -0
  57. package/api/openQuoteTemplate/openQuoteTemplate.d.ts +13 -0
  58. package/api/removeNegotiableQuoteItems/graphql/RemoveNegotiableQuoteItemsMutation.d.ts +10 -0
  59. package/api/removeNegotiableQuoteItems/index.d.ts +10 -0
  60. package/api/removeNegotiableQuoteItems/removeNegotiableQuoteItems.d.ts +8 -0
  61. package/api/removeQuoteTemplateItems/graphql/removeNegotiableQuoteTemplateItems.d.ts +10 -0
  62. package/api/removeQuoteTemplateItems/index.d.ts +10 -0
  63. package/api/removeQuoteTemplateItems/removeQuoteTemplateItems.d.ts +14 -0
  64. package/api/renameNegotiableQuote/graphql/RenameNegotiableQuoteMutation.d.ts +10 -0
  65. package/api/renameNegotiableQuote/index.d.ts +10 -0
  66. package/api/renameNegotiableQuote/renameNegotiableQuote.d.ts +9 -0
  67. package/api/requestNegotiableQuote/graphql/RequestNegotiableQuoteMutation.d.ts +4 -12
  68. package/api/requestNegotiableQuote/requestNegotiableQuote.d.ts +0 -3
  69. package/api/sendForReview/graphql/SendNegotiableQuoteForReviewMutation.d.ts +10 -0
  70. package/api/sendForReview/index.d.ts +10 -0
  71. package/api/sendForReview/sendForReview.d.ts +11 -0
  72. package/api/sendQuoteTemplateForReview/graphql/sendQuoteTemplateForReview.d.ts +10 -0
  73. package/api/sendQuoteTemplateForReview/index.d.ts +10 -0
  74. package/api/sendQuoteTemplateForReview/sendQuoteTemplateForReview.d.ts +15 -0
  75. package/api/setLineItemNote/graphql/SetLineItemNoteMutation.d.ts +10 -0
  76. package/api/setLineItemNote/index.d.ts +10 -0
  77. package/api/setLineItemNote/setLineItemNote.d.ts +10 -0
  78. package/api/setShippingAddress/graphql/SetNegotiableQuoteShippingAddressMutation.d.ts +10 -0
  79. package/api/setShippingAddress/index.d.ts +2 -0
  80. package/api/setShippingAddress/setShippingAddress.d.ts +110 -0
  81. package/api/updateQuantities/graphql/UpdateNegotiableQuoteQuantitiesMutation.d.ts +10 -0
  82. package/api/updateQuantities/index.d.ts +10 -0
  83. package/api/updateQuantities/updateQuantities.d.ts +36 -0
  84. package/api/updateQuoteTemplateItemQuantities/graphql/updateNegotiableQuoteTemplateQuantities.d.ts +10 -0
  85. package/api/updateQuoteTemplateItemQuantities/index.d.ts +10 -0
  86. package/api/updateQuoteTemplateItemQuantities/updateQuoteTemplateItemQuantities.d.ts +20 -0
  87. package/api/uploadFile/graphql/FinishUploadMutation.d.ts +10 -0
  88. package/api/uploadFile/graphql/InitiateUploadMutation.d.ts +10 -0
  89. package/api/uploadFile/index.d.ts +10 -0
  90. package/api/uploadFile/uploadFile.d.ts +12 -0
  91. package/api.js +95 -22
  92. package/api.js.map +1 -1
  93. package/chunks/AttachedFilesList.js +4 -0
  94. package/chunks/AttachedFilesList.js.map +1 -0
  95. package/chunks/CheckWithCircle.js +4 -0
  96. package/chunks/CheckWithCircle.js.map +1 -0
  97. package/chunks/ChevronDown.js +4 -0
  98. package/chunks/ChevronDown.js.map +1 -0
  99. package/chunks/ConfirmationModal.js +4 -0
  100. package/chunks/ConfirmationModal.js.map +1 -0
  101. package/chunks/ItemsQuoted.js +4 -0
  102. package/chunks/ItemsQuoted.js.map +1 -0
  103. package/chunks/ItemsQuotedTemplate.js +4 -0
  104. package/chunks/ItemsQuotedTemplate.js.map +1 -0
  105. package/chunks/LineItemNoteModal2.js +4 -0
  106. package/chunks/LineItemNoteModal2.js.map +1 -0
  107. package/chunks/NegotiableQuoteFragment.js +391 -0
  108. package/chunks/NegotiableQuoteFragment.js.map +1 -0
  109. package/chunks/NegotiableQuoteTemplateFragment.js +190 -0
  110. package/chunks/NegotiableQuoteTemplateFragment.js.map +1 -0
  111. package/chunks/OrderSummaryLine.js +4 -0
  112. package/chunks/OrderSummaryLine.js.map +1 -0
  113. package/chunks/QuoteCommentsList.js +4 -0
  114. package/chunks/QuoteCommentsList.js.map +1 -0
  115. package/chunks/QuoteCommentsList3.js +4 -0
  116. package/chunks/QuoteCommentsList3.js.map +1 -0
  117. package/chunks/QuoteHistoryLog.js +4 -0
  118. package/chunks/QuoteHistoryLog.js.map +1 -0
  119. package/chunks/QuoteHistoryLog3.js +4 -0
  120. package/chunks/QuoteHistoryLog3.js.map +1 -0
  121. package/chunks/QuoteTemplateCommentsList.js +4 -0
  122. package/chunks/QuoteTemplateCommentsList.js.map +1 -0
  123. package/chunks/QuoteTemplateHistoryLog.js +4 -0
  124. package/chunks/QuoteTemplateHistoryLog.js.map +1 -0
  125. package/chunks/ShippingAddressDisplay.js +4 -0
  126. package/chunks/ShippingAddressDisplay.js.map +1 -0
  127. package/chunks/TabbedContent.js +4 -0
  128. package/chunks/TabbedContent.js.map +1 -0
  129. package/chunks/WarningFilled.js +4 -0
  130. package/chunks/WarningFilled.js.map +1 -0
  131. package/chunks/addQuoteTemplateLineItemNote.js +13 -0
  132. package/chunks/addQuoteTemplateLineItemNote.js.map +1 -0
  133. package/chunks/dateUtils.js +4 -0
  134. package/chunks/dateUtils.js.map +1 -0
  135. package/chunks/duplicateNegotiableQuote.js +121 -0
  136. package/chunks/duplicateNegotiableQuote.js.map +1 -0
  137. package/chunks/generateQuoteFromTemplate.js +12 -0
  138. package/chunks/generateQuoteFromTemplate.js.map +1 -0
  139. package/chunks/getQuoteTemplates.js +50 -0
  140. package/chunks/getQuoteTemplates.js.map +1 -0
  141. package/chunks/negotiableQuotes.js +77 -0
  142. package/chunks/negotiableQuotes.js.map +1 -0
  143. package/chunks/openQuoteTemplate.js +31 -0
  144. package/chunks/openQuoteTemplate.js.map +1 -0
  145. package/chunks/requestNegotiableQuote.js +6 -81
  146. package/chunks/requestNegotiableQuote.js.map +1 -1
  147. package/chunks/setLineItemNote.js +47 -0
  148. package/chunks/setLineItemNote.js.map +1 -0
  149. package/chunks/state.js +4 -0
  150. package/chunks/state.js.map +1 -0
  151. package/chunks/transform-quote-template.js +4 -0
  152. package/chunks/transform-quote-template.js.map +1 -0
  153. package/chunks/transform-quote.js +4 -0
  154. package/chunks/transform-quote.js.map +1 -0
  155. package/chunks/uploadFile.js +20 -0
  156. package/chunks/uploadFile.js.map +1 -0
  157. package/components/ActionsBar/ActionsBar.d.ts +15 -0
  158. package/components/ActionsBar/index.d.ts +11 -0
  159. package/components/AttachedFilesList/AttachedFilesList.d.ts +16 -0
  160. package/components/AttachedFilesList/index.d.ts +11 -0
  161. package/components/ConfirmationModal/ConfirmationModal.d.ts +17 -0
  162. package/components/ConfirmationModal/index.d.ts +11 -0
  163. package/components/ItemsQuoted/ItemsQuoted.d.ts +11 -0
  164. package/components/ItemsQuoted/index.d.ts +11 -0
  165. package/components/LineItemNoteModal/LineItemNoteModal.d.ts +17 -0
  166. package/components/LineItemNoteModal/index.d.ts +11 -0
  167. package/components/ManageNegotiableQuote/ManageNegotiableQuote.d.ts +22 -0
  168. package/components/ManageNegotiableQuote/__fixtures__/ManageNegotiableQuoteProps.d.ts +4 -0
  169. package/components/ManageNegotiableQuote/index.d.ts +11 -0
  170. package/components/ManageNegotiableQuoteTemplate/ManageNegotiableQuoteTemplate.d.ts +20 -0
  171. package/components/ManageNegotiableQuoteTemplate/__fixtures__/ManageNegotiableQuoteTemplateProps.d.ts +4 -0
  172. package/components/ManageNegotiableQuoteTemplate/index.d.ts +11 -0
  173. package/components/OrderSummary/OrderSummary.d.ts +48 -0
  174. package/components/OrderSummary/index.d.ts +11 -0
  175. package/components/OrderSummaryLine/OrderSummaryLine.d.ts +13 -0
  176. package/components/OrderSummaryLine/index.d.ts +11 -0
  177. package/components/ProductListTable/ProductListTable.d.ts +61 -0
  178. package/components/ProductListTable/index.d.ts +11 -0
  179. package/components/QuoteCommentsList/QuoteCommentsList.d.ts +17 -0
  180. package/components/QuoteCommentsList/index.d.ts +11 -0
  181. package/components/QuoteHistoryLog/QuoteHistoryLog.d.ts +77 -0
  182. package/components/QuoteHistoryLog/index.d.ts +11 -0
  183. package/components/QuotePricesSummary/QuotePricesSummary.d.ts +16 -0
  184. package/components/QuotePricesSummary/index.d.ts +11 -0
  185. package/components/QuoteSummaryList/QuoteSummaryList.d.ts +13 -0
  186. package/components/QuoteSummaryList/index.d.ts +11 -0
  187. package/components/QuoteTemplatesListTable/QuoteTemplatesListTable.d.ts +29 -0
  188. package/components/QuoteTemplatesListTable/index.d.ts +10 -0
  189. package/components/QuotesListTable/QuotesListTable.d.ts +29 -0
  190. package/components/QuotesListTable/index.d.ts +11 -0
  191. package/components/RenameQuoteModal/RenameQuoteModal.d.ts +18 -0
  192. package/components/RenameQuoteModal/index.d.ts +11 -0
  193. package/components/RequestNegotiableQuoteForm/RequestNegotiableQuoteForm.d.ts +1 -0
  194. package/components/ShippingAddressDisplay/ShippingAddressDisplay.d.ts +12 -0
  195. package/components/ShippingAddressDisplay/index.d.ts +11 -0
  196. package/components/TabbedContent/TabbedContent.d.ts +10 -0
  197. package/components/TabbedContent/index.d.ts +11 -0
  198. package/components/index.d.ts +28 -0
  199. package/containers/ItemsQuoted/ItemsQuoted.d.ts +30 -0
  200. package/containers/ItemsQuoted/index.d.ts +11 -0
  201. package/containers/ItemsQuoted.d.ts +3 -0
  202. package/containers/ItemsQuoted.js +4 -0
  203. package/containers/ItemsQuoted.js.map +1 -0
  204. package/containers/ItemsQuotedTemplate/ItemsQuotedTemplate.d.ts +21 -0
  205. package/containers/ItemsQuotedTemplate/index.d.ts +11 -0
  206. package/containers/ItemsQuotedTemplate.d.ts +3 -0
  207. package/containers/ItemsQuotedTemplate.js +4 -0
  208. package/containers/ItemsQuotedTemplate.js.map +1 -0
  209. package/containers/ManageNegotiableQuote/ManageNegotiableQuote.d.ts +87 -0
  210. package/containers/ManageNegotiableQuote/index.d.ts +11 -0
  211. package/containers/ManageNegotiableQuote.d.ts +3 -0
  212. package/containers/ManageNegotiableQuote.js +4 -0
  213. package/containers/ManageNegotiableQuote.js.map +1 -0
  214. package/containers/ManageNegotiableQuoteTemplate/ManageNegotiableQuoteTemplate.d.ts +67 -0
  215. package/containers/ManageNegotiableQuoteTemplate/index.d.ts +11 -0
  216. package/containers/ManageNegotiableQuoteTemplate.d.ts +3 -0
  217. package/containers/ManageNegotiableQuoteTemplate.js +4 -0
  218. package/containers/ManageNegotiableQuoteTemplate.js.map +1 -0
  219. package/containers/OrderSummary/OrderSummary.d.ts +11 -0
  220. package/containers/OrderSummary/index.d.ts +11 -0
  221. package/containers/OrderSummary.d.ts +3 -0
  222. package/containers/OrderSummary.js +4 -0
  223. package/containers/OrderSummary.js.map +1 -0
  224. package/containers/OrderSummaryLine/OrderSummaryLine.d.ts +14 -0
  225. package/containers/OrderSummaryLine/index.d.ts +11 -0
  226. package/containers/OrderSummaryLine.d.ts +3 -0
  227. package/containers/OrderSummaryLine.js +4 -0
  228. package/containers/OrderSummaryLine.js.map +1 -0
  229. package/containers/QuoteCommentsList/QuoteCommentsList.d.ts +9 -0
  230. package/containers/QuoteCommentsList/index.d.ts +11 -0
  231. package/containers/QuoteCommentsList.d.ts +3 -0
  232. package/containers/QuoteCommentsList.js +4 -0
  233. package/containers/QuoteCommentsList.js.map +1 -0
  234. package/containers/QuoteHistoryLog/QuoteHistoryLog.d.ts +9 -0
  235. package/containers/QuoteHistoryLog/index.d.ts +11 -0
  236. package/containers/QuoteHistoryLog.d.ts +3 -0
  237. package/containers/QuoteHistoryLog.js +4 -0
  238. package/containers/QuoteHistoryLog.js.map +1 -0
  239. package/containers/QuoteSummaryList/QuoteSummaryList.d.ts +51 -0
  240. package/containers/QuoteSummaryList/index.d.ts +11 -0
  241. package/containers/QuoteSummaryList.d.ts +3 -0
  242. package/containers/QuoteSummaryList.js +4 -0
  243. package/containers/QuoteSummaryList.js.map +1 -0
  244. package/containers/QuoteTemplateCommentsList/QuoteTemplateCommentsList.d.ts +9 -0
  245. package/containers/QuoteTemplateCommentsList/index.d.ts +11 -0
  246. package/containers/QuoteTemplateCommentsList.d.ts +3 -0
  247. package/containers/QuoteTemplateCommentsList.js +4 -0
  248. package/containers/QuoteTemplateCommentsList.js.map +1 -0
  249. package/containers/QuoteTemplateHistoryLog/QuoteTemplateHistoryLog.d.ts +9 -0
  250. package/containers/QuoteTemplateHistoryLog/index.d.ts +11 -0
  251. package/containers/QuoteTemplateHistoryLog.d.ts +3 -0
  252. package/containers/QuoteTemplateHistoryLog.js +4 -0
  253. package/containers/QuoteTemplateHistoryLog.js.map +1 -0
  254. package/containers/QuoteTemplatesListTable/QuoteTemplatesListTable.d.ts +74 -0
  255. package/containers/QuoteTemplatesListTable/index.d.ts +11 -0
  256. package/containers/QuoteTemplatesListTable.d.ts +3 -0
  257. package/containers/QuoteTemplatesListTable.js +4 -0
  258. package/containers/QuoteTemplatesListTable.js.map +1 -0
  259. package/containers/QuotesListTable/QuotesListTable.d.ts +72 -0
  260. package/containers/QuotesListTable/index.d.ts +11 -0
  261. package/containers/QuotesListTable.d.ts +3 -0
  262. package/containers/QuotesListTable.js +4 -0
  263. package/containers/QuotesListTable.js.map +1 -0
  264. package/containers/RequestNegotiableQuoteForm/RequestNegotiableQuoteForm.d.ts +10 -1
  265. package/containers/RequestNegotiableQuoteForm.js +1 -1
  266. package/containers/RequestNegotiableQuoteForm.js.map +1 -1
  267. package/containers/ShippingAddressDisplay/ShippingAddressDisplay.d.ts +10 -0
  268. package/containers/ShippingAddressDisplay/index.d.ts +11 -0
  269. package/containers/ShippingAddressDisplay.d.ts +1 -0
  270. package/containers/ShippingAddressDisplay.js +4 -0
  271. package/containers/ShippingAddressDisplay.js.map +1 -0
  272. package/containers/index.d.ts +22 -0
  273. package/data/models/__fixtures__/negotiableQuoteModel.d.ts +8 -0
  274. package/data/models/__fixtures__/negotiableQuoteTemplateModel.d.ts +4 -0
  275. package/data/models/__fixtures__/negotiableQuoteTemplatesListModel.d.ts +5 -0
  276. package/data/models/__fixtures__/negotiableQuotesListModel.d.ts +5 -0
  277. package/data/models/__fixtures__/storeConfigModel.d.ts +5 -0
  278. package/data/models/index.d.ts +11 -1
  279. package/data/models/negotiable-quote-model.d.ts +262 -27
  280. package/data/models/negotiable-quote-template-model.d.ts +147 -0
  281. package/data/models/store-config-model.d.ts +27 -0
  282. package/data/transforms/__fixtures__/negotiableQuoteData.d.ts +665 -2
  283. package/data/transforms/__fixtures__/negotiableQuoteTemplateData.d.ts +1610 -0
  284. package/data/transforms/__fixtures__/storeConfigData.d.ts +31 -0
  285. package/data/transforms/index.d.ts +6 -13
  286. package/data/transforms/transform-quote-template.d.ts +5 -0
  287. package/data/transforms/transform-quote.d.ts +13 -2
  288. package/data/transforms/transform-store-config.d.ts +4 -0
  289. package/hooks/useQuoteSummaryData.d.ts +10 -0
  290. package/i18n/en_US.json.d.ts +360 -1
  291. package/lib/configurationTransformers.d.ts +27 -0
  292. package/lib/itemFormatters.d.ts +47 -0
  293. package/lib/priceCalculators.d.ts +41 -0
  294. package/lib/state.d.ts +6 -0
  295. package/package.json +1 -1
  296. package/render.js +6 -2
  297. package/render.js.map +1 -1
  298. package/types/state.types.d.ts +13 -0
  299. package/utils/dateUtils.d.ts +26 -0
  300. package/utils/fileUtils.d.ts +46 -0
  301. package/utils/mapAuthPermissions.d.ts +39 -0
  302. package/api/getCustomerData/graphql/CustomerQuery.d.ts +0 -2
  303. package/api/graphql/CustomerFragment.d.ts +0 -2
  304. package/data/models/__fixtures__/customerModel.d.ts +0 -4
  305. package/data/transforms/transform-customer.d.ts +0 -15
@@ -0,0 +1,121 @@
1
+ /*! Copyright 2025 Adobe
2
+ All Rights Reserved. */
3
+ import{events as p}from"@dropins/tools/event-bus.js";import{f as E,t as q}from"./transform-quote.js";import{N as g}from"./NegotiableQuoteFragment.js";import{s as _}from"./state.js";import{a as Q}from"./transform-quote-template.js";import{N as U}from"./NegotiableQuoteTemplateFragment.js";const N=`
4
+ query QUOTE_DATA_QUERY(
5
+ $quoteId: ID!
6
+ ) {
7
+ negotiableQuote(
8
+ uid: $quoteId
9
+ ) {
10
+ ...NegotiableQuoteFragment
11
+ }
12
+ }
13
+
14
+ ${g}
15
+ `,S=async s=>{var a;if(!_.authenticated)return Promise.reject(new Error("Unauthorized"));if(!_.permissions.editQuote)return Promise.reject(new Error("Unauthorized"));try{const o=await E(N,{variables:{quoteId:s}}),e=q((a=o==null?void 0:o.data)==null?void 0:a.negotiableQuote);if(!e)throw new Error("Failed to transform quote data");return p.emit("quote-management/quote-data",{quote:e,permissions:_.permissions}),e}catch(o){return Promise.reject(o)}},T=`
16
+ mutation DELETE_QUOTE_MUTATION($quoteUids: [ID!]!) {
17
+ deleteNegotiableQuotes(
18
+ input: {
19
+ quote_uids: $quoteUids
20
+ }
21
+ ) {
22
+ result_status
23
+ operation_results {
24
+ __typename
25
+ ... on NegotiableQuoteUidOperationSuccess {
26
+ quote_uid
27
+ }
28
+ ... on DeleteNegotiableQuoteOperationFailure {
29
+ quote_uid
30
+ errors {
31
+ __typename
32
+ ... on ErrorInterface {
33
+ message
34
+ }
35
+ ... on NoSuchEntityUidError {
36
+ uid
37
+ message
38
+ }
39
+ ... on NegotiableQuoteInvalidStateError {
40
+ message
41
+ }
42
+ }
43
+ }
44
+ }
45
+ }
46
+ }
47
+ `,M=async s=>{var o;if(!_.authenticated)return Promise.reject(new Error("Unauthorized"));const a=Array.isArray(s)?s:[s];try{const e=await E(T,{variables:{quoteUids:a}}),{errors:c}=e||{};if(c&&c.length){const r=c.map(t=>t==null?void 0:t.message).filter(Boolean).join("; ");throw new Error(r||"Failed to delete negotiable quotes")}const i=(o=e==null?void 0:e.data)==null?void 0:o.deleteNegotiableQuotes;if(!i)throw new Error("No delete result returned");const n={resultStatus:i.result_status,operationResults:(i.operation_results||[]).map(r=>(r==null?void 0:r.__typename)==="NegotiableQuoteUidOperationSuccess"?{__typename:"NegotiableQuoteUidOperationSuccess",quoteUid:r==null?void 0:r.quote_uid}:{__typename:"DeleteNegotiableQuoteOperationFailure",quoteUid:r==null?void 0:r.quote_uid,errors:((r==null?void 0:r.errors)||[]).map(u=>({__typename:u==null?void 0:u.__typename,message:u==null?void 0:u.message,uid:u==null?void 0:u.uid}))})},m=n.operationResults.filter(r=>r.__typename==="NegotiableQuoteUidOperationSuccess").map(r=>r.quoteUid);return m.length>0&&p.emit("quote-management/negotiable-quote-deleted",{deletedQuoteUids:m,resultStatus:n.resultStatus}),n}catch(e){return p.emit("quote-management/negotiable-quote-delete-error",{error:e instanceof Error?e:new Error(String(e)),attemptedQuoteUids:a}),Promise.reject(e)}},f=`
48
+ mutation SEND_NEGOTIABLE_QUOTE_FOR_REVIEW_MUTATION(
49
+ $quoteUid: ID!
50
+ $comment: NegotiableQuoteCommentInput
51
+ ) {
52
+ sendNegotiableQuoteForReview(
53
+ input: {
54
+ quote_uid: $quoteUid
55
+ comment: $comment
56
+ }
57
+ ) {
58
+ quote {
59
+ ...NegotiableQuoteFragment
60
+ }
61
+ }
62
+ }
63
+ ${g}
64
+ `,R=async s=>{const{quoteUid:a,comment:o,attachments:e}=s;if(!a)throw new Error("Quote UID is required");const c=e!=null&&e.length?{comment:o||"",attachments:e}:o?{comment:o}:null;return E(f,{variables:{quoteUid:a,comment:c}}).then(i=>{var r,t;const{errors:n}=i;if(n){const d=n.map(u=>u.message).join("; ");throw new Error(`Failed to send quote for review: ${d}`)}const m=q((t=(r=i.data)==null?void 0:r.sendNegotiableQuoteForReview)==null?void 0:t.quote);if(!m)throw new Error("Failed to transform quote data: Invalid response structure");return p.emit("quote-management/quote-sent-for-review",{quote:m,input:{quoteUid:a,comment:o,attachments:e}}),m})},w=`
65
+ mutation CLOSE_NEGOTIABLE_QUOTE_MUTATION(
66
+ $quoteUids: [ID!]!
67
+ ) {
68
+ closeNegotiableQuotes(input: { quote_uids: $quoteUids }) {
69
+ result_status
70
+ operation_results {
71
+ ... on NegotiableQuoteUidOperationSuccess {
72
+ __typename
73
+ quote_uid
74
+ }
75
+ ... on CloseNegotiableQuoteOperationFailure {
76
+ __typename
77
+ quote_uid
78
+ errors {
79
+ __typename
80
+ ... on ErrorInterface {
81
+ message
82
+ }
83
+ ... on NoSuchEntityUidError {
84
+ uid
85
+ }
86
+ ... on NegotiableQuoteInvalidStateError {
87
+ message
88
+ }
89
+ }
90
+ }
91
+ }
92
+ }
93
+ }
94
+ `,v=async s=>{var o;if(!_.authenticated)return Promise.reject(new Error("Unauthorized"));const{quoteUids:a}=s;if(!a||a.length===0)throw new Error("Quote UIDs are required");try{const e=await E(w,{variables:{quoteUids:a}}),{errors:c}=e||{};if(c&&c.length){const t=c.map(d=>d==null?void 0:d.message).filter(Boolean).join("; ");throw new Error(t||"Failed to close negotiable quotes")}const i=(o=e==null?void 0:e.data)==null?void 0:o.closeNegotiableQuotes;if(!i)throw new Error("No close result returned");const n={resultStatus:i.result_status,operationResults:(i.operation_results||[]).map(t=>(t==null?void 0:t.__typename)==="NegotiableQuoteUidOperationSuccess"?{__typename:"NegotiableQuoteUidOperationSuccess",quoteUid:t==null?void 0:t.quote_uid}:{__typename:"CloseNegotiableQuoteOperationFailure",quoteUid:t==null?void 0:t.quote_uid,errors:((t==null?void 0:t.errors)||[]).map(l=>({__typename:l==null?void 0:l.__typename,message:l==null?void 0:l.message,uid:l==null?void 0:l.uid}))})},m=n.operationResults.filter(t=>t.__typename==="CloseNegotiableQuoteOperationFailure").map(t=>t);if(m.length>0){const t=m.map(d=>d.errors&&d.errors.length>0?d.errors.map(u=>u.message||`Failed to close quote ${d.quoteUid}`).join(", "):`Failed to close quote ${d.quoteUid}`).join("; ");throw new Error(t)}const r=n.operationResults.filter(t=>t.__typename==="NegotiableQuoteUidOperationSuccess").map(t=>t.quoteUid);return r.length>0&&p.emit("quote-management/negotiable-quote-closed",{closedQuoteUids:r,resultStatus:n.resultStatus}),n}catch(e){return p.emit("quote-management/negotiable-quote-close-error",{error:e instanceof Error?e:new Error(String(e)),attemptedQuoteUids:a}),Promise.reject(e)}},b=`
95
+ mutation CREATE_QUOTE_TEMPLATE_MUTATION($cartId: ID!) {
96
+ requestNegotiableQuoteTemplateFromQuote(input: { cart_id: $cartId }) {
97
+ ...NegotiableQuoteTemplateFragment
98
+ }
99
+ }
100
+
101
+ ${U}
102
+ `,L=async s=>{var a;if(!_.authenticated)throw new Error("Unauthorized");if(!s)throw new Error("Cart ID is required");try{const o=await E(b,{variables:{cartId:s}});if(!((a=o==null?void 0:o.data)!=null&&a.requestNegotiableQuoteTemplateFromQuote))throw new Error("Failed to create quote template");const e=Q(o.data.requestNegotiableQuoteTemplateFromQuote);if(!e)throw new Error("Failed to transform quote template data");return p.emit("quote-management/quote-template-data",{quoteTemplate:e,permissions:_.permissions}),e}catch(o){return Promise.reject(o)}},I=`
103
+ mutation renameNegotiableQuote($input: RenameNegotiableQuoteInput!) {
104
+ renameNegotiableQuote(input: $input) {
105
+ quote {
106
+ ...NegotiableQuoteFragment
107
+ }
108
+ }
109
+ }
110
+ ${g}
111
+ `,j=async s=>{const{quoteUid:a,quoteName:o,quoteComment:e}=s;if(!a)throw new Error("Quote UID is required");if(!o)throw new Error("Quote name is required");return E(I,{variables:{input:{quote_uid:a,quote_name:o,quote_comment:e||""}}}).then(i=>{var r,t;const{errors:n}=i;if(n){const d=n.map(u=>u.message).join("; ");throw new Error(`Failed to rename quote: ${d}`)}const m=q((t=(r=i.data)==null?void 0:r.renameNegotiableQuote)==null?void 0:t.quote);if(!m)throw new Error("Failed to transform quote data: Invalid response structure");return p.emit("quote-management/quote-renamed",{quote:m,input:{quoteUid:a,quoteName:o,quoteComment:e}}),m})},h=`
112
+ mutation DUPLICATE_NEGOTIABLE_QUOTE_MUTATION($quoteUid: ID!, $duplicatedQuoteUid: ID!) {
113
+ duplicateNegotiableQuote(input: { quote_uid: $quoteUid, duplicated_quote_uid: $duplicatedQuoteUid }) {
114
+ quote {
115
+ ...NegotiableQuoteFragment
116
+ }
117
+ }
118
+ }
119
+ ${g}
120
+ `,P=async s=>{if(!_.authenticated)throw new Error("Unauthorized");const{quoteUid:a,duplicatedQuoteUid:o}=s;if(!a||!a.trim())throw new Error("Quote UID is required");if(!o||!o.trim())throw new Error("Duplicated Quote UID is required");return E(h,{variables:{quoteUid:a,duplicatedQuoteUid:o}}).then(e=>{var n,m;const{errors:c}=e;if(c){const r=c.map(t=>t.message).join("; ");throw new Error(`Failed to duplicate quote: ${r}`)}const i=q((m=(n=e.data)==null?void 0:n.duplicateNegotiableQuote)==null?void 0:m.quote);if(!i)throw new Error("Failed to transform quote data: Invalid response structure");return p.emit("quote-management/quote-duplicated",{quote:i,input:{quoteUid:a,duplicatedQuoteUid:o}}),i})};export{L as a,P as b,v as c,M as d,S as g,j as r,R as s};
121
+ //# sourceMappingURL=duplicateNegotiableQuote.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"duplicateNegotiableQuote.js","sources":["/@dropins/storefront-quote-management/src/api/getQuoteData/graphql/QuoteDataQuery.ts","/@dropins/storefront-quote-management/src/api/getQuoteData/getQuoteData.ts","/@dropins/storefront-quote-management/src/api/deleteQuote/graphql/DeleteQuoteMutation.ts","/@dropins/storefront-quote-management/src/api/deleteQuote/deleteQuote.ts","/@dropins/storefront-quote-management/src/api/sendForReview/graphql/SendNegotiableQuoteForReviewMutation.ts","/@dropins/storefront-quote-management/src/api/sendForReview/sendForReview.ts","/@dropins/storefront-quote-management/src/api/closeNegotiableQuote/graphql/CloseNegotiableQuoteMutation.ts","/@dropins/storefront-quote-management/src/api/closeNegotiableQuote/closeNegotiableQuote.ts","/@dropins/storefront-quote-management/src/api/createQuoteTemplate/graphql/createQuoteTemplate.ts","/@dropins/storefront-quote-management/src/api/createQuoteTemplate/createQuoteTemplate.ts","/@dropins/storefront-quote-management/src/api/renameNegotiableQuote/graphql/RenameNegotiableQuoteMutation.ts","/@dropins/storefront-quote-management/src/api/renameNegotiableQuote/renameNegotiableQuote.ts","/@dropins/storefront-quote-management/src/api/duplicateNegotiableQuote/graphql/duplicateNegotiableQuoteMutation.ts","/@dropins/storefront-quote-management/src/api/duplicateNegotiableQuote/duplicateNegotiableQuote.ts"],"sourcesContent":["import { NEGOTIABLE_QUOTE_FRAGMENT } from '@/quote-management/api/graphql/NegotiableQuoteFragment';\n\nexport const QUOTE_DATA_QUERY = `\n query QUOTE_DATA_QUERY(\n $quoteId: ID!\n ) {\n negotiableQuote(\n uid: $quoteId\n ) {\n ...NegotiableQuoteFragment\n }\n }\n\n ${NEGOTIABLE_QUOTE_FRAGMENT}\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_DATA_QUERY } from './graphql/QuoteDataQuery';\nimport { transformQuote } from '@/quote-management/data/transforms';\nimport { state } from '@/quote-management/lib/state';\nimport { events } from '@adobe-commerce/event-bus';\n\nexport const getQuoteData = async (quoteId: string) => { \n if (!state.authenticated) {\n return Promise.reject(new Error('Unauthorized'));\n }\n\n if (!state.permissions.editQuote) {\n return Promise.reject(new Error('Unauthorized'));\n }\n\n try {\n const results: any = await fetchGraphQl(QUOTE_DATA_QUERY, {\n variables: {\n quoteId\n }\n });\n\n const transformedQuote = transformQuote(results?.data?.negotiableQuote);\n\n if (!transformedQuote) {\n throw new Error('Failed to transform quote data');\n }\n\n events.emit('quote-management/quote-data', {\n quote: transformedQuote,\n permissions: state.permissions,\n });\n \n return transformedQuote;\n } catch (error) {\n return Promise.reject(error);\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\nexport const DELETE_QUOTE_MUTATION = `\n mutation DELETE_QUOTE_MUTATION($quoteUids: [ID!]!) {\n deleteNegotiableQuotes(\n input: {\n quote_uids: $quoteUids\n }\n ) {\n result_status\n operation_results {\n __typename\n ... on NegotiableQuoteUidOperationSuccess {\n quote_uid\n }\n ... on DeleteNegotiableQuoteOperationFailure {\n quote_uid\n errors {\n __typename\n ... on ErrorInterface {\n message\n }\n ... on NoSuchEntityUidError {\n uid\n message\n }\n ... on NegotiableQuoteInvalidStateError {\n message\n }\n }\n }\n }\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 { state } from '@/quote-management/lib/state';\nimport { DELETE_QUOTE_MUTATION } from '@/quote-management/api/deleteQuote/graphql/DeleteQuoteMutation';\nimport { events } from '@adobe-commerce/event-bus';\n\nexport interface DeleteQuoteSuccessResult {\n __typename: 'NegotiableQuoteUidOperationSuccess';\n quoteUid: string;\n}\n\nexport interface DeleteQuoteFailureError {\n __typename: string;\n message?: string;\n uid?: string;\n}\n\nexport interface DeleteQuoteFailureResult {\n __typename: 'DeleteNegotiableQuoteOperationFailure';\n quoteUid: string;\n errors: DeleteQuoteFailureError[];\n}\n\nexport interface DeleteQuoteOutput {\n resultStatus: string;\n operationResults: Array<DeleteQuoteSuccessResult | DeleteQuoteFailureResult>;\n}\n\nexport const deleteQuote = async ( quoteUids: string[] | string ): Promise<DeleteQuoteOutput> => {\n if (!state.authenticated) {\n return Promise.reject(new Error('Unauthorized'));\n }\n\n const quoteUidsArray = Array.isArray(quoteUids) ? quoteUids : [quoteUids];\n\n try {\n const response: any = await fetchGraphQl(DELETE_QUOTE_MUTATION, {\n variables: {\n quoteUids: quoteUidsArray,\n },\n });\n\n const { errors } = response || {};\n if (errors && errors.length) {\n const errorMessages = errors.map((e: any) => e?.message).filter(Boolean).join('; ');\n throw new Error(errorMessages || 'Failed to delete negotiable quotes');\n }\n\n const raw = response?.data?.deleteNegotiableQuotes;\n if (!raw) {\n throw new Error('No delete result returned');\n }\n\n const transformed: DeleteQuoteOutput = {\n resultStatus: raw.result_status,\n operationResults: (raw.operation_results || []).map((result: any) => {\n const typename = result?.__typename;\n if (typename === 'NegotiableQuoteUidOperationSuccess') {\n const success: DeleteQuoteSuccessResult = {\n __typename: 'NegotiableQuoteUidOperationSuccess',\n quoteUid: result?.quote_uid,\n };\n return success;\n }\n const failure: DeleteQuoteFailureResult = {\n __typename: 'DeleteNegotiableQuoteOperationFailure',\n quoteUid: result?.quote_uid,\n errors: (result?.errors || []).map((err: any) => ({\n __typename: err?.__typename,\n message: err?.message,\n uid: err?.uid,\n })),\n };\n return failure;\n }),\n };\n\n // Emit event with successfully deleted quote UIDs\n const deletedUids = transformed.operationResults\n .filter((res) => res.__typename === 'NegotiableQuoteUidOperationSuccess')\n .map((res) => (res as DeleteQuoteSuccessResult).quoteUid);\n\n if (deletedUids.length > 0) {\n events.emit('quote-management/negotiable-quote-deleted', {\n deletedQuoteUids: deletedUids,\n resultStatus: transformed.resultStatus,\n });\n }\n\n return transformed;\n } catch (error) {\n // Emit error event for integration layer\n events.emit('quote-management/negotiable-quote-delete-error', {\n error: error instanceof Error ? error : new Error(String(error)),\n attemptedQuoteUids: quoteUidsArray,\n });\n return Promise.reject(error);\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 SEND_NEGOTIABLE_QUOTE_FOR_REVIEW_MUTATION = `\n mutation SEND_NEGOTIABLE_QUOTE_FOR_REVIEW_MUTATION(\n $quoteUid: ID!\n $comment: NegotiableQuoteCommentInput\n ) {\n sendNegotiableQuoteForReview(\n input: {\n quote_uid: $quoteUid\n comment: $comment\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 { SEND_NEGOTIABLE_QUOTE_FOR_REVIEW_MUTATION } from './graphql/SendNegotiableQuoteForReviewMutation';\nimport { NegotiableQuoteModel } from '@/quote-management/data/models/negotiable-quote-model';\nimport { transformQuote } from '@/quote-management/data/transforms';\n\nexport interface SendForReviewInput {\n quoteUid: string;\n comment?: string;\n attachments?: { key: string }[];\n}\n\nexport const sendForReview = async (\n input: SendForReviewInput\n): Promise<NegotiableQuoteModel | null> => {\n const { quoteUid, comment, attachments } = input;\n\n if (!quoteUid) {\n throw new Error('Quote UID is required');\n }\n\n // Build the comment object with attachments if provided\n const commentInput = attachments?.length \n ? { comment: comment || '', attachments } \n : comment \n ? { comment } \n : null;\n\n return fetchGraphQl(SEND_NEGOTIABLE_QUOTE_FOR_REVIEW_MUTATION, {\n variables: {\n quoteUid,\n comment: commentInput,\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 send quote for review: ${errorMessages}`);\n }\n\n // Transform the quote data\n const quoteData = transformQuote(\n response.data?.sendNegotiableQuoteForReview?.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/quote-sent-for-review', {\n quote: quoteData,\n input: { quoteUid, comment, attachments },\n });\n\n return quoteData;\n });\n};\n\n","export const CLOSE_NEGOTIABLE_QUOTE_MUTATION = `\n mutation CLOSE_NEGOTIABLE_QUOTE_MUTATION(\n $quoteUids: [ID!]!\n ) {\n closeNegotiableQuotes(input: { quote_uids: $quoteUids }) {\n result_status\n operation_results {\n ... on NegotiableQuoteUidOperationSuccess {\n __typename\n quote_uid\n }\n ... on CloseNegotiableQuoteOperationFailure {\n __typename\n quote_uid\n errors {\n __typename\n ... on ErrorInterface {\n message\n }\n ... on NoSuchEntityUidError {\n uid\n }\n ... on NegotiableQuoteInvalidStateError {\n message\n }\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 { state } from '@/quote-management/lib/state';\nimport { events } from '@adobe-commerce/event-bus';\nimport { CLOSE_NEGOTIABLE_QUOTE_MUTATION } from './graphql/CloseNegotiableQuoteMutation';\n\nexport interface CloseNegotiableQuoteInput {\n quoteUids: string[];\n}\n\nexport interface CloseNegotiableQuoteSuccessResult {\n __typename: 'NegotiableQuoteUidOperationSuccess';\n quoteUid: string;\n}\n\nexport interface CloseNegotiableQuoteFailureError {\n __typename: string;\n message?: string;\n uid?: string;\n}\n\nexport interface CloseNegotiableQuoteFailureResult {\n __typename: 'CloseNegotiableQuoteOperationFailure';\n quoteUid: string;\n errors: CloseNegotiableQuoteFailureError[];\n}\n\nexport interface CloseNegotiableQuoteResult {\n resultStatus: string;\n operationResults: Array<CloseNegotiableQuoteSuccessResult | CloseNegotiableQuoteFailureResult>;\n}\n\nexport const closeNegotiableQuote = async (input: CloseNegotiableQuoteInput): Promise<CloseNegotiableQuoteResult> => { \n if (!state.authenticated) {\n return Promise.reject(new Error('Unauthorized'));\n }\n\n const { quoteUids } = input;\n\n if (!quoteUids || quoteUids.length === 0) {\n throw new Error('Quote UIDs are required');\n }\n\n try {\n const response: any = await fetchGraphQl(CLOSE_NEGOTIABLE_QUOTE_MUTATION, {\n variables: {\n quoteUids,\n },\n });\n\n const { errors } = response || {};\n if (errors && errors.length) {\n const errorMessages = errors\n .map((e: any) => e?.message)\n .filter(Boolean)\n .join('; ');\n throw new Error(errorMessages || 'Failed to close negotiable quotes');\n }\n\n const raw = response?.data?.closeNegotiableQuotes;\n if (!raw) {\n throw new Error('No close result returned');\n }\n\n const transformed: CloseNegotiableQuoteResult = {\n resultStatus: raw.result_status,\n operationResults: (raw.operation_results || []).map((result: any) => {\n const typename = result?.__typename;\n if (typename === 'NegotiableQuoteUidOperationSuccess') {\n const success: CloseNegotiableQuoteSuccessResult = {\n __typename: 'NegotiableQuoteUidOperationSuccess',\n quoteUid: result?.quote_uid,\n };\n return success;\n }\n const failure: CloseNegotiableQuoteFailureResult = {\n __typename: 'CloseNegotiableQuoteOperationFailure',\n quoteUid: result?.quote_uid,\n errors: (result?.errors || []).map((err: any) => ({\n __typename: err?.__typename,\n message: err?.message,\n uid: err?.uid,\n })),\n };\n return failure;\n }),\n };\n\n // Check for operation failures\n const failures = transformed.operationResults\n .filter(\n (res) => res.__typename === 'CloseNegotiableQuoteOperationFailure'\n )\n .map((res) => res as CloseNegotiableQuoteFailureResult);\n\n if (failures.length > 0) {\n // Create error message from failures\n const failureMessages = failures\n .map((failure) => {\n if (failure.errors && failure.errors.length > 0) {\n return failure.errors\n .map(\n (err) =>\n err.message || `Failed to close quote ${failure.quoteUid}`\n )\n .join(', ');\n }\n return `Failed to close quote ${failure.quoteUid}`;\n })\n .join('; ');\n\n throw new Error(failureMessages);\n }\n\n // Emit success event with closed quote UIDs\n const closedUids = transformed.operationResults\n .filter((res) => res.__typename === 'NegotiableQuoteUidOperationSuccess')\n .map((res) => (res as CloseNegotiableQuoteSuccessResult).quoteUid);\n\n if (closedUids.length > 0) {\n events.emit('quote-management/negotiable-quote-closed', {\n closedQuoteUids: closedUids,\n resultStatus: transformed.resultStatus,\n });\n }\n\n return transformed;\n } catch (error) {\n // Emit error event for integration layer\n events.emit('quote-management/negotiable-quote-close-error', {\n error: error instanceof Error ? error : new Error(String(error)),\n attemptedQuoteUids: quoteUids,\n });\n return Promise.reject(error);\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_TEMPLATE_FRAGMENT } from \"../../graphql/NegotiableQuoteTemplateFragment\";\n\nexport const CREATE_QUOTE_TEMPLATE_MUTATION = /* GraphQL */ `\n mutation CREATE_QUOTE_TEMPLATE_MUTATION($cartId: ID!) {\n requestNegotiableQuoteTemplateFromQuote(input: { cart_id: $cartId }) {\n ...NegotiableQuoteTemplateFragment\n }\n }\n\n ${NEGOTIABLE_QUOTE_TEMPLATE_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 { events } from '@adobe-commerce/event-bus';\nimport { fetchGraphQl } from '@/quote-management/api/';\nimport { CREATE_QUOTE_TEMPLATE_MUTATION } from './graphql/createQuoteTemplate';\nimport { state } from '@/quote-management/lib/state';\nimport { transformQuoteTemplate } from '@/quote-management/data/transforms';\nimport { NegotiableQuoteTemplateModel } from '@/quote-management/data/models/negotiable-quote-template-model';\n\nexport const createQuoteTemplate = async (\n quoteId: string\n): Promise<NegotiableQuoteTemplateModel | null> => {\n if (!state.authenticated) {\n throw new Error('Unauthorized');\n }\n\n if (!quoteId) {\n throw new Error('Cart ID is required');\n }\n\n try {\n const results: any = await fetchGraphQl(CREATE_QUOTE_TEMPLATE_MUTATION, {\n variables: {\n cartId: quoteId,\n },\n });\n\n if (!results?.data?.requestNegotiableQuoteTemplateFromQuote) {\n throw new Error('Failed to create quote template');\n }\n\n const transformedQuoteTemplate = transformQuoteTemplate(\n results.data.requestNegotiableQuoteTemplateFromQuote\n );\n\n if (!transformedQuoteTemplate) {\n throw new Error('Failed to transform quote template data');\n }\n\n events.emit('quote-management/quote-template-data', {\n quoteTemplate: transformedQuoteTemplate,\n permissions: state.permissions,\n });\n\n return transformedQuoteTemplate;\n } catch (error) {\n return Promise.reject(error);\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 RENAME_NEGOTIABLE_QUOTE_MUTATION = `\n mutation renameNegotiableQuote($input: RenameNegotiableQuoteInput!) {\n renameNegotiableQuote(input: $input) {\n quote {\n ...NegotiableQuoteFragment\n }\n }\n }\n ${NEGOTIABLE_QUOTE_FRAGMENT}\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 { events } from '@adobe-commerce/event-bus';\nimport { RENAME_NEGOTIABLE_QUOTE_MUTATION } from './graphql/RenameNegotiableQuoteMutation';\nimport { NegotiableQuoteModel } from '@/quote-management/data/models/negotiable-quote-model';\nimport { transformQuote } from '@/quote-management/data/transforms';\n\nexport interface RenameNegotiableQuoteInput {\n quoteUid: string;\n quoteName: string;\n quoteComment?: string;\n}\n\nexport const renameNegotiableQuote = async (\n input: RenameNegotiableQuoteInput\n): Promise<NegotiableQuoteModel | null> => {\n const { quoteUid, quoteName, quoteComment } = input;\n\n if (!quoteUid) {\n throw new Error('Quote UID is required');\n }\n\n if (!quoteName) {\n throw new Error('Quote name is required');\n }\n\n // Backend requires quote_comment to be present (even if empty string)\n const mutationInput = {\n quote_uid: quoteUid,\n quote_name: quoteName,\n quote_comment: quoteComment || '', // Always include, use empty string if not provided\n };\n\n return fetchGraphQl(RENAME_NEGOTIABLE_QUOTE_MUTATION, {\n variables: {\n input: mutationInput,\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 rename quote: ${errorMessages}`);\n }\n\n // Transform the quote data\n const quoteData = transformQuote(\n response.data?.renameNegotiableQuote?.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/quote-renamed', {\n quote: quoteData,\n input: { quoteUid, quoteName, quoteComment },\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 DUPLICATE_NEGOTIABLE_QUOTE_MUTATION = `\n mutation DUPLICATE_NEGOTIABLE_QUOTE_MUTATION($quoteUid: ID!, $duplicatedQuoteUid: ID!) {\n duplicateNegotiableQuote(input: { quote_uid: $quoteUid, duplicated_quote_uid: $duplicatedQuoteUid }) {\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 { DUPLICATE_NEGOTIABLE_QUOTE_MUTATION } from './graphql/duplicateNegotiableQuoteMutation';\nimport { NegotiableQuoteModel } from '@/quote-management/data/models/negotiable-quote-model';\nimport { transformQuote } from '@/quote-management/data/transforms';\nimport { state } from '@/quote-management/lib/state';\n\nexport interface DuplicateQuoteInput {\n quoteUid: string;\n duplicatedQuoteUid: string;\n}\n\nexport const duplicateQuote = async (\n input: DuplicateQuoteInput\n): Promise<NegotiableQuoteModel | null> => {\n\n if (!state.authenticated) {\n throw new Error('Unauthorized');\n }\n\n const { quoteUid, duplicatedQuoteUid } = input;\n\n if (!quoteUid || !quoteUid.trim()) {\n throw new Error('Quote UID is required');\n }\n\n if (!duplicatedQuoteUid || !duplicatedQuoteUid.trim()) {\n throw new Error('Duplicated Quote UID is required');\n }\n\n return fetchGraphQl(DUPLICATE_NEGOTIABLE_QUOTE_MUTATION, {\n variables: { quoteUid, duplicatedQuoteUid },\n }).then((response) => {\n const { errors } = response;\n\n if (errors) {\n const errorMessages = errors.map((error) => error.message).join('; ');\n throw new Error(`Failed to duplicate quote: ${errorMessages}`);\n }\n\n const quoteData = transformQuote(\n response.data?.duplicateNegotiableQuote?.quote\n );\n\n if (!quoteData) {\n throw new Error(\n 'Failed to transform quote data: Invalid response structure'\n );\n }\n\n events.emit('quote-management/quote-duplicated', {\n quote: quoteData,\n input: { quoteUid, duplicatedQuoteUid },\n });\n\n return quoteData;\n });\n};\n"],"names":["QUOTE_DATA_QUERY","NEGOTIABLE_QUOTE_FRAGMENT","getQuoteData","quoteId","state","results","fetchGraphQl","transformedQuote","transformQuote","_a","events","error","DELETE_QUOTE_MUTATION","deleteQuote","quoteUids","quoteUidsArray","response","errors","errorMessages","e","raw","transformed","result","err","deletedUids","res","SEND_NEGOTIABLE_QUOTE_FOR_REVIEW_MUTATION","sendForReview","input","quoteUid","comment","attachments","commentInput","quoteData","_b","CLOSE_NEGOTIABLE_QUOTE_MUTATION","closeNegotiableQuote","failures","failureMessages","failure","closedUids","CREATE_QUOTE_TEMPLATE_MUTATION","NEGOTIABLE_QUOTE_TEMPLATE_FRAGMENT","createQuoteTemplate","transformedQuoteTemplate","transformQuoteTemplate","RENAME_NEGOTIABLE_QUOTE_MUTATION","renameNegotiableQuote","quoteName","quoteComment","DUPLICATE_NEGOTI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CAAA,CAAmB,CAC3C,EAAE,KAAMpC,GAAa,SACpB,KAAM,CAAE,OAAAC,GAAWD,EAEnB,GAAIC,EAAQ,CACV,MAAMC,EAAgBD,EAAO,IAAKN,GAAUA,EAAM,OAAO,EAAE,KAAK,IAAI,EACpE,MAAM,IAAI,MAAM,8BAA8BO,CAAa,EAAE,CAC/D,CAEA,MAAMe,EAAYzB,GAChB0B,GAAAzB,EAAAO,EAAS,OAAT,YAAAP,EAAe,2BAAf,YAAAyB,EAAyC,KAAA,EAG3C,GAAI,CAACD,EACH,MAAM,IAAI,MACR,4DAAA,EAIJ,OAAAvB,EAAO,KAAK,oCAAqC,CAC/C,MAAOuB,EACP,MAAO,CAAE,SAAAJ,EAAU,mBAAAuB,CAAA,CAAmB,CACvC,EAEMnB,CACT,CAAC,CACH"}
@@ -0,0 +1,12 @@
1
+ /*! Copyright 2025 Adobe
2
+ All Rights Reserved. */
3
+ import{events as i}from"@dropins/tools/event-bus.js";import{s as n}from"./state.js";import{f as m}from"./transform-quote.js";const u=`
4
+ mutation GENERATE_NEGOTIABLE_QUOTE_FROM_TEMPLATE_MUTATION(
5
+ $input: GenerateNegotiableQuoteFromTemplateInput!
6
+ ) {
7
+ generateNegotiableQuoteFromTemplate(input: $input) {
8
+ negotiable_quote_uid
9
+ }
10
+ }
11
+ `,l=async t=>{var o,r;if(!t.templateId)throw new Error("Template ID is required");if(!n.authenticated)throw new Error("Unauthorized");try{const e=await m(u,{variables:{input:{template_id:t.templateId}}});if(!((r=(o=e==null?void 0:e.data)==null?void 0:o.generateNegotiableQuoteFromTemplate)!=null&&r.negotiable_quote_uid))throw new Error("No quote UID received");const a=e.data.generateNegotiableQuoteFromTemplate.negotiable_quote_uid;return i.emit("quote-management/quote-template-generated",{quoteId:a}),{quoteId:a}}catch(e){return Promise.reject(e)}};export{l as g};
12
+ //# sourceMappingURL=generateQuoteFromTemplate.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"generateQuoteFromTemplate.js","sources":["/@dropins/storefront-quote-management/src/api/generateQuoteFromTemplate/graphql/generateNegotiableQuoteFromTemplate.ts","/@dropins/storefront-quote-management/src/api/generateQuoteFromTemplate/generateQuoteFromTemplate.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 const GENERATE_NEGOTIABLE_QUOTE_FROM_TEMPLATE_MUTATION = /* GraphQL */ `\n mutation GENERATE_NEGOTIABLE_QUOTE_FROM_TEMPLATE_MUTATION(\n $input: GenerateNegotiableQuoteFromTemplateInput!\n ) {\n generateNegotiableQuoteFromTemplate(input: $input) {\n negotiable_quote_uid\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 { GENERATE_NEGOTIABLE_QUOTE_FROM_TEMPLATE_MUTATION } from './graphql/generateNegotiableQuoteFromTemplate';\nimport { state } from '@/quote-management/lib/state';\nimport { events } from '@adobe-commerce/event-bus';\n\nexport interface GenerateQuoteFromTemplateParams {\n templateId: string;\n}\n\nexport const generateQuoteFromTemplate = async (\n params: GenerateQuoteFromTemplateParams\n) => {\n if (!params.templateId) {\n throw new Error('Template ID is required');\n }\n\n if (!state.authenticated) {\n throw new Error('Unauthorized');\n }\n\n try {\n const results: any = await fetchGraphQl(\n GENERATE_NEGOTIABLE_QUOTE_FROM_TEMPLATE_MUTATION,\n {\n variables: {\n input: {\n template_id: params.templateId,\n },\n },\n }\n );\n\n if (\n !results?.data?.generateNegotiableQuoteFromTemplate?.negotiable_quote_uid\n ) {\n throw new Error('No quote UID received');\n }\n\n const quoteId =\n results.data.generateNegotiableQuoteFromTemplate.negotiable_quote_uid;\n\n events.emit('quote-management/quote-template-generated', {\n quoteId,\n });\n\n return { quoteId };\n } catch (error) {\n return Promise.reject(error);\n }\n};\n"],"names":["GENERATE_NEGOTIABLE_QUOTE_FROM_TEMPLATE_MUTATION","generateQuoteFromTemplate","params","state","results","fetchGraphQl","_b","_a","quoteId","events","error"],"mappings":"6HASO,MAAMA,EAAiE;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,ECSjEC,EAA4B,MACvCC,GACG,SACH,GAAI,CAACA,EAAO,WACV,MAAM,IAAI,MAAM,yBAAyB,EAG3C,GAAI,CAACC,EAAM,cACT,MAAM,IAAI,MAAM,cAAc,EAGhC,GAAI,CACF,MAAMC,EAAe,MAAMC,EACzBL,EACA,CACE,UAAW,CACT,MAAO,CACL,YAAaE,EAAO,UAAA,CACtB,CACF,CACF,EAGF,GACE,GAACI,GAAAC,EAAAH,GAAA,YAAAA,EAAS,OAAT,YAAAG,EAAe,sCAAf,MAAAD,EAAoD,sBAErD,MAAM,IAAI,MAAM,uBAAuB,EAGzC,MAAME,EACJJ,EAAQ,KAAK,oCAAoC,qBAEnD,OAAAK,EAAO,KAAK,4CAA6C,CACvD,QAAAD,CAAA,CACD,EAEM,CAAE,QAAAA,CAAA,CACX,OAASE,EAAO,CACd,OAAO,QAAQ,OAAOA,CAAK,CAC7B,CACF"}
@@ -0,0 +1,50 @@
1
+ /*! Copyright 2025 Adobe
2
+ All Rights Reserved. */
3
+ import{events as n}from"@dropins/tools/event-bus.js";import{t as s}from"./transform-quote-template.js";import{s as o}from"./state.js";import{f as i}from"./transform-quote.js";const l=`
4
+ query QUOTE_TEMPLATES_QUERY(
5
+ $filter: NegotiableQuoteTemplateFilterInput
6
+ $pageSize: Int
7
+ $currentPage: Int
8
+ $sort: NegotiableQuoteTemplateSortInput
9
+ ) {
10
+ negotiableQuoteTemplates(
11
+ filter: $filter
12
+ pageSize: $pageSize
13
+ currentPage: $currentPage
14
+ sort: $sort
15
+ ) {
16
+ items {
17
+ # uid
18
+ template_id
19
+ name
20
+ # created_at
21
+ # updated_at
22
+ # last_ordered_at
23
+ status
24
+ state
25
+ min_negotiated_grand_total
26
+ last_shared_at
27
+ # expiration_date
28
+ orders_placed
29
+ # grand_total {
30
+ # currency
31
+ # value
32
+ # }
33
+ }
34
+ page_info {
35
+ current_page
36
+ page_size
37
+ total_pages
38
+ }
39
+ total_count
40
+ sort_fields {
41
+ default
42
+ options {
43
+ label
44
+ value
45
+ }
46
+ }
47
+ }
48
+ }
49
+ `;var u=(e=>(e.ACTIVE="ACTIVE",e.IN_REVIEW="IN_REVIEW",e.INACTIVE="INACTIVE",e))(u||{}),E=(e=>(e.NAME="NAME",e.CREATED_AT="CREATED_AT",e.UPDATED_AT="UPDATED_AT",e))(E||{}),_=(e=>(e.ASC="ASC",e.DESC="DESC",e))(_||{});const T=async(e={})=>{var r;if(!o.authenticated)throw new Error("Unauthorized");try{const t=await i(l,{variables:{filter:e.filter||null,pageSize:e.pageSize||20,currentPage:e.currentPage||1,sort:e.sort||null}});if(!((r=t==null?void 0:t.data)!=null&&r.negotiableQuoteTemplates))throw new Error("No quote templates data received");const a=s(t.data.negotiableQuoteTemplates);if(!a)throw new Error("Failed to transform quote templates data");return n.emit("quote-management/quote-templates-data",{quoteTemplates:a,permissions:o.permissions}),a}catch(t){return Promise.reject(t)}};export{u as Q,_ as S,E as a,T as g};
50
+ //# sourceMappingURL=getQuoteTemplates.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"getQuoteTemplates.js","sources":["/@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\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":["QUOTE_TEMPLATES_QUERY","QuoteTemplateFilterStatus","QuoteTemplateSortField","SortDirection","getQuoteTemplates","params","state","results","fetchGraphQl","_a","transformedData","transformQuoteTemplatesList","events","error"],"mappings":"+KASO,MAAMA,EAAsC;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,ECO5C,IAAKC,GAAAA,IACVA,EAAA,OAAS,SACTA,EAAA,UAAY,YACZA,EAAA,SAAW,WAHDA,IAAAA,GAAA,CAAA,CAAA,EAaAC,GAAAA,IACVA,EAAA,KAAO,OACPA,EAAA,WAAa,aACbA,EAAA,WAAa,aAHHA,IAAAA,GAAA,CAAA,CAAA,EAMAC,GAAAA,IACVA,EAAA,IAAM,MACNA,EAAA,KAAO,OAFGA,IAAAA,GAAA,CAAA,CAAA,EAiBL,MAAMC,EAAoB,MAC/BC,EAAkC,KACa,OAC/C,GAAI,CAACC,EAAM,cACT,MAAM,IAAI,MAAM,cAAc,EAGhC,GAAI,CACF,MAAMC,EAAe,MAAMC,EAAaR,EAAuB,CAC7D,UAAW,CACT,OAAQK,EAAO,QAAU,KACzB,SAAUA,EAAO,UAAY,GAC7B,YAAaA,EAAO,aAAe,EACnC,KAAMA,EAAO,MAAQ,IAAA,CACvB,CACD,EAED,GAAI,GAACI,EAAAF,GAAA,YAAAA,EAAS,OAAT,MAAAE,EAAe,0BAClB,MAAM,IAAI,MAAM,kCAAkC,EAGpD,MAAMC,EAAkBC,EAA4BJ,EAAQ,KAAK,wBAAwB,EAEzF,GAAI,CAACG,EACH,MAAM,IAAI,MAAM,0CAA0C,EAG5D,OAAAE,EAAO,KAAK,wCAAyC,CACnD,eAAgBF,EAChB,YAAaJ,EAAM,WAAA,CACpB,EAEMI,CACT,OAASG,EAAO,CACd,OAAO,QAAQ,OAAOA,CAAK,CAC7B,CACF"}
@@ -0,0 +1,77 @@
1
+ /*! Copyright 2025 Adobe
2
+ All Rights Reserved. */
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
+ fragment NegotiableQuoteListFragment on NegotiableQuote {
5
+ uid
6
+ name
7
+ created_at
8
+ updated_at
9
+ status
10
+ buyer {
11
+ firstname
12
+ lastname
13
+ }
14
+ template_name
15
+ prices {
16
+ grand_total {
17
+ value
18
+ currency
19
+ }
20
+ }
21
+ history {
22
+ change_type
23
+ changes {
24
+ statuses {
25
+ changes {
26
+ new_status
27
+ old_status
28
+ }
29
+ }
30
+ }
31
+ }
32
+ }
33
+ `,g=`
34
+ fragment SearchResultPageInfoFragment on SearchResultPageInfo {
35
+ current_page
36
+ page_size
37
+ total_pages
38
+ }
39
+ `,l=`
40
+ fragment SortFieldsFragment on SortFields {
41
+ default
42
+ options {
43
+ label
44
+ value
45
+ }
46
+ }
47
+ `,c=`
48
+ query negotiableQuotes(
49
+ $filter: NegotiableQuoteFilterInput
50
+ $pageSize: Int
51
+ $currentPage: Int
52
+ $sort: NegotiableQuoteSortInput
53
+ ) {
54
+ negotiableQuotes(
55
+ filter: $filter
56
+ pageSize: $pageSize
57
+ currentPage: $currentPage
58
+ sort: $sort
59
+ ) {
60
+ items {
61
+ ...NegotiableQuoteListFragment
62
+ }
63
+ page_info {
64
+ ...SearchResultPageInfoFragment
65
+ }
66
+ sort_fields {
67
+ ...SortFieldsFragment
68
+ }
69
+ total_count
70
+ }
71
+ }
72
+
73
+ ${u}
74
+ ${g}
75
+ ${l}
76
+ `;var _=(e=>(e.FULL="FULL",e.PARTIAL="PARTIAL",e))(_||{}),E=(e=>(e.ASC="ASC",e.DESC="DESC",e))(E||{}),f=(e=>(e.QUOTE_NAME="QUOTE_NAME",e.CREATED_AT="CREATED_AT",e.UPDATED_AT="UPDATED_AT",e))(f||{});const S=async(e={})=>{var r;if(!i.authenticated)return Promise.reject(new Error("Unauthorized"));const o={filter:e.filter||null,pageSize:e.pageSize||20,currentPage:e.currentPage||1,sort:e.sort||null};try{const t=await n(c,{variables:o});if(!((r=t==null?void 0:t.data)!=null&&r.negotiableQuotes))throw new Error("No quotes data received");const a=s(t.data.negotiableQuotes);if(!a)throw new Error("Failed to transform quotes data");return a}catch(t){return Promise.reject(t)}};export{_ as F,f as N,E as S,S as n};
77
+ //# sourceMappingURL=negotiableQuotes.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"negotiableQuotes.js","sources":["/@dropins/storefront-quote-management/src/api/graphql/NegotiableQuoteListFragment.ts","/@dropins/storefront-quote-management/src/api/graphql/SearchResultPageInfoFragment.ts","/@dropins/storefront-quote-management/src/api/graphql/SortFieldsFragment.ts","/@dropins/storefront-quote-management/src/api/negotiableQuotes/graphql/NegotiableQuotesQuery.ts","/@dropins/storefront-quote-management/src/api/negotiableQuotes/negotiableQuotes.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 const NEGOTIABLE_QUOTE_LIST_FRAGMENT = /* GraphQL */ `\n fragment NegotiableQuoteListFragment on NegotiableQuote {\n uid\n name\n created_at\n updated_at\n status\n buyer {\n firstname\n lastname\n }\n template_name\n prices {\n grand_total {\n value\n currency\n }\n }\n history {\n change_type\n changes {\n statuses {\n changes {\n new_status\n old_status\n }\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\nexport const SEARCH_RESULT_PAGE_INFO_FRAGMENT = /* GraphQL */ `\n fragment SearchResultPageInfoFragment on SearchResultPageInfo {\n current_page\n page_size\n total_pages\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\nexport const SORT_FIELDS_FRAGMENT = /* GraphQL */ `\n fragment SortFieldsFragment on SortFields {\n default\n options {\n label\n value\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 { NEGOTIABLE_QUOTE_LIST_FRAGMENT } from '@/quote-management/api/graphql/NegotiableQuoteListFragment';\nimport { SEARCH_RESULT_PAGE_INFO_FRAGMENT } from '@/quote-management/api/graphql/SearchResultPageInfoFragment';\nimport { SORT_FIELDS_FRAGMENT } from '@/quote-management/api/graphql/SortFieldsFragment';\n\nexport const NEGOTIABLE_QUOTES_QUERY = /* GraphQL */ `\n query negotiableQuotes(\n $filter: NegotiableQuoteFilterInput\n $pageSize: Int\n $currentPage: Int\n $sort: NegotiableQuoteSortInput\n ) {\n negotiableQuotes(\n filter: $filter\n pageSize: $pageSize\n currentPage: $currentPage\n sort: $sort\n ) {\n items {\n ...NegotiableQuoteListFragment\n }\n page_info {\n ...SearchResultPageInfoFragment\n }\n sort_fields {\n ...SortFieldsFragment\n }\n total_count\n }\n }\n\n ${NEGOTIABLE_QUOTE_LIST_FRAGMENT}\n ${SEARCH_RESULT_PAGE_INFO_FRAGMENT}\n ${SORT_FIELDS_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 { NEGOTIABLE_QUOTES_QUERY } from './graphql/NegotiableQuotesQuery';\nimport { transformNegotiableQuotesList } from '@/quote-management/data/transforms';\nimport { NegotiableQuotesListModel } from '@/quote-management/data/models/negotiable-quote-model';\nimport { state } from '@/quote-management/lib/state';\n\nexport enum FilterMatchTypeEnum {\n FULL = 'FULL',\n PARTIAL = 'PARTIAL',\n}\n\nexport interface FilterEqualTypeInput {\n eq?: string;\n in?: string[];\n}\n\nexport interface FilterMatchTypeInput {\n match?: string;\n match_type?: FilterMatchTypeEnum;\n}\n\nexport interface NegotiableQuoteFilterInput {\n ids?: FilterEqualTypeInput;\n name?: FilterMatchTypeInput;\n}\n\nexport enum SortEnum {\n ASC = 'ASC',\n DESC = 'DESC',\n}\n\nexport enum NegotiableQuoteSortableField {\n QUOTE_NAME = 'QUOTE_NAME',\n CREATED_AT = 'CREATED_AT',\n UPDATED_AT = 'UPDATED_AT',\n}\n\nexport interface NegotiableQuoteSortInput {\n sort_direction: SortEnum;\n sort_field: NegotiableQuoteSortableField;\n}\n\nexport interface NegotiableQuotesParams {\n filter?: NegotiableQuoteFilterInput;\n pageSize?: number;\n currentPage?: number;\n sort?: NegotiableQuoteSortInput;\n}\n\nexport const negotiableQuotes = async (\n params: NegotiableQuotesParams = {}\n): Promise<NegotiableQuotesListModel> => {\n if (!state.authenticated) {\n return Promise.reject(new Error('Unauthorized'));\n }\n\n const variables = {\n filter: params.filter || null,\n pageSize: params.pageSize || 20,\n currentPage: params.currentPage || 1,\n sort: params.sort || null,\n };\n\n try {\n const results: any = await fetchGraphQl(NEGOTIABLE_QUOTES_QUERY, {\n variables,\n });\n\n if (!results?.data?.negotiableQuotes) {\n throw new Error('No quotes data received');\n }\n\n const transformedData = transformNegotiableQuotesList(\n results.data.negotiableQuotes\n );\n\n if (!transformedData) {\n throw new Error('Failed to transform quotes data');\n }\n\n return transformedData;\n } catch (error) {\n return Promise.reject(error);\n }\n};\n"],"names":["NEGOTIABLE_QUOTE_LIST_FRAGMENT","SEARCH_RESULT_PAGE_INFO_FRAGMENT","SORT_FIELDS_FRAGMENT","NEGOTIABLE_QUOTES_QUERY","FilterMatchTypeEnum","SortEnum","NegotiableQuoteSortableField","negotiableQuotes","params","state","variables","results","fetchGraphQl","_a","transformedData","transformNegotiableQuotesList","error"],"mappings":"mHASO,MAAMA,EAA+C;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,ECA/CC,EAAiD;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,ECAjDC,EAAqC;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,ECIrCC,EAAwC;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,IA0BjDH,CAA8B;AAAA,IAC9BC,CAAgC;AAAA,IAChCC,CAAoB;AAAA,EC1BjB,IAAKE,GAAAA,IACVA,EAAA,KAAO,OACPA,EAAA,QAAU,UAFAA,IAAAA,GAAA,CAAA,CAAA,EAoBAC,GAAAA,IACVA,EAAA,IAAM,MACNA,EAAA,KAAO,OAFGA,IAAAA,GAAA,CAAA,CAAA,EAKAC,GAAAA,IACVA,EAAA,WAAa,aACbA,EAAA,WAAa,aACbA,EAAA,WAAa,aAHHA,IAAAA,GAAA,CAAA,CAAA,EAkBL,MAAMC,EAAmB,MAC9BC,EAAiC,KACM,OACvC,GAAI,CAACC,EAAM,cACT,OAAO,QAAQ,OAAO,IAAI,MAAM,cAAc,CAAC,EAGjD,MAAMC,EAAY,CAChB,OAAQF,EAAO,QAAU,KACzB,SAAUA,EAAO,UAAY,GAC7B,YAAaA,EAAO,aAAe,EACnC,KAAMA,EAAO,MAAQ,IAAA,EAGvB,GAAI,CACF,MAAMG,EAAe,MAAMC,EAAaT,EAAyB,CAC/D,UAAAO,CAAA,CACD,EAED,GAAI,GAACG,EAAAF,GAAA,YAAAA,EAAS,OAAT,MAAAE,EAAe,kBAClB,MAAM,IAAI,MAAM,yBAAyB,EAG3C,MAAMC,EAAkBC,EACtBJ,EAAQ,KAAK,gBAAA,EAGf,GAAI,CAACG,EACH,MAAM,IAAI,MAAM,iCAAiC,EAGnD,OAAOA,CACT,OAASE,EAAO,CACd,OAAO,QAAQ,OAAOA,CAAK,CAC7B,CACF"}
@@ -0,0 +1,31 @@
1
+ /*! Copyright 2025 Adobe
2
+ All Rights Reserved. */
3
+ import{events as m}from"@dropins/tools/event-bus.js";import{a as i}from"./transform-quote-template.js";import{s as r}from"./state.js";import{N as n}from"./NegotiableQuoteTemplateFragment.js";import{f as p}from"./transform-quote.js";const l=`
4
+ mutation SEND_QUOTE_TEMPLATE_FOR_REVIEW_MUTATION(
5
+ $templateId: ID!
6
+ $comment: String
7
+ $name: String
8
+ ) {
9
+ submitNegotiableQuoteTemplateForReview(input: { template_id: $templateId, name: $name, comment: $comment }) {
10
+ ...NegotiableQuoteTemplateFragment
11
+ }
12
+ }
13
+ ${n}
14
+ `,I=async a=>{var o;if(!a.templateId)throw new Error("Template ID is required");if(!r.authenticated)throw new Error("Unauthorized");try{const e=await p(l,{variables:{templateId:a.templateId,name:a.name,comment:a.comment}});if(!((o=e==null?void 0:e.data)!=null&&o.submitNegotiableQuoteTemplateForReview))throw new Error("No quote template data received");const t=i(e.data.submitNegotiableQuoteTemplateForReview);if(!t)throw new Error("Failed to transform quote template data");return m.emit("quote-management/quote-template-data",{quoteTemplate:t,permissions:r.permissions}),t}catch(e){return Promise.reject(e)}},T=`
15
+ mutation ACCEPT_QUOTE_TEMPLATE_MUTATION($templateId: ID!) {
16
+ acceptNegotiableQuoteTemplate(input: { template_id: $templateId }) {
17
+ ...NegotiableQuoteTemplateFragment
18
+ }
19
+ }
20
+
21
+ ${n}
22
+ `,N=async a=>{var o;if(!a.templateId)throw new Error("Template ID is required");if(!r.authenticated)throw new Error("Unauthorized");try{const e=await p(T,{variables:{templateId:a.templateId}});if(!((o=e==null?void 0:e.data)!=null&&o.acceptNegotiableQuoteTemplate))throw new Error("No quote template data received");const t=i(e.data.acceptNegotiableQuoteTemplate);if(!t)throw new Error("Failed to transform quote template data");return m.emit("quote-management/quote-template-data",{quoteTemplate:t,permissions:r.permissions}),t}catch(e){return Promise.reject(e)}},s=`
23
+ mutation OPEN_QUOTE_TEMPLATE_MUTATION($templateId: ID!) {
24
+ openNegotiableQuoteTemplate(input: { template_id: $templateId }) {
25
+ ...NegotiableQuoteTemplateFragment
26
+ }
27
+ }
28
+
29
+ ${n}
30
+ `,_=async a=>{var o;if(!a.templateId)throw new Error("Template ID is required");if(!r.authenticated)throw new Error("Unauthorized");try{const e=await p(s,{variables:{templateId:a.templateId}});if(!((o=e==null?void 0:e.data)!=null&&o.openNegotiableQuoteTemplate))throw new Error("No quote template data received");const t=i(e.data.openNegotiableQuoteTemplate);if(!t)throw new Error("Failed to transform quote template data");return m.emit("quote-management/quote-template-data",{quoteTemplate:t,permissions:r.permissions}),t}catch(e){return Promise.reject(e)}};export{N as a,_ as o,I as s};
31
+ //# sourceMappingURL=openQuoteTemplate.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"openQuoteTemplate.js","sources":["/@dropins/storefront-quote-management/src/api/sendQuoteTemplateForReview/graphql/sendQuoteTemplateForReview.ts","/@dropins/storefront-quote-management/src/api/sendQuoteTemplateForReview/sendQuoteTemplateForReview.ts","/@dropins/storefront-quote-management/src/api/acceptQuoteTemplate/graphql/acceptQuoteTemplate.ts","/@dropins/storefront-quote-management/src/api/acceptQuoteTemplate/acceptQuoteTemplate.ts","/@dropins/storefront-quote-management/src/api/openQuoteTemplate/graphql/openQuoteTemplate.ts","/@dropins/storefront-quote-management/src/api/openQuoteTemplate/openQuoteTemplate.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_TEMPLATE_FRAGMENT } from '@/quote-management/api/graphql/NegotiableQuoteTemplateFragment';\n\nexport const SEND_QUOTE_TEMPLATE_FOR_REVIEW_MUTATION = /* GraphQL */ `\n mutation SEND_QUOTE_TEMPLATE_FOR_REVIEW_MUTATION(\n $templateId: ID!\n $comment: String\n $name: String\n ) {\n submitNegotiableQuoteTemplateForReview(input: { template_id: $templateId, name: $name, comment: $comment }) {\n ...NegotiableQuoteTemplateFragment\n }\n }\n ${NEGOTIABLE_QUOTE_TEMPLATE_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 { SEND_QUOTE_TEMPLATE_FOR_REVIEW_MUTATION } from './graphql/sendQuoteTemplateForReview';\nimport { transformQuoteTemplate } from '@/quote-management/data/transforms';\nimport { state } from '@/quote-management/lib/state';\nimport { events } from '@adobe-commerce/event-bus';\n\nexport interface SendQuoteTemplateForReviewParams {\n templateId: string;\n name?: string;\n comment?: string;\n}\n\nexport const sendQuoteTemplateForReview = async (\n params: SendQuoteTemplateForReviewParams\n) => {\n if (!params.templateId) {\n throw new Error('Template ID is required');\n }\n\n if (!state.authenticated) {\n throw new Error('Unauthorized');\n }\n\n try {\n const results: any = await fetchGraphQl(\n SEND_QUOTE_TEMPLATE_FOR_REVIEW_MUTATION,\n {\n variables: {\n templateId: params.templateId,\n name: params.name,\n comment: params.comment,\n },\n }\n );\n\n if (!results?.data?.submitNegotiableQuoteTemplateForReview) {\n throw new Error('No quote template data received');\n }\n\n const transformedData = transformQuoteTemplate(\n results.data.submitNegotiableQuoteTemplateForReview\n );\n\n if (!transformedData) {\n throw new Error('Failed to transform quote template data');\n }\n\n events.emit('quote-management/quote-template-data', {\n quoteTemplate: transformedData,\n permissions: state.permissions,\n });\n\n return transformedData;\n } catch (error) {\n return Promise.reject(error);\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_TEMPLATE_FRAGMENT } from '@/quote-management/api/graphql/NegotiableQuoteTemplateFragment';\n\nexport const ACCEPT_QUOTE_TEMPLATE_MUTATION = /* GraphQL */ `\n mutation ACCEPT_QUOTE_TEMPLATE_MUTATION($templateId: ID!) {\n acceptNegotiableQuoteTemplate(input: { template_id: $templateId }) {\n ...NegotiableQuoteTemplateFragment\n }\n }\n \n ${NEGOTIABLE_QUOTE_TEMPLATE_FRAGMENT}\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 { ACCEPT_QUOTE_TEMPLATE_MUTATION } from './graphql/acceptQuoteTemplate';\nimport { transformQuoteTemplate } from '@/quote-management/data/transforms';\nimport { state } from '@/quote-management/lib/state';\nimport { events } from '@adobe-commerce/event-bus';\n\nexport interface AcceptQuoteTemplateParams {\n templateId: string;\n}\n\nexport const acceptQuoteTemplate = async (\n params: AcceptQuoteTemplateParams\n) => {\n if (!params.templateId) {\n throw new Error('Template ID is required');\n }\n\n if (!state.authenticated) {\n throw new Error('Unauthorized');\n }\n\n try {\n const results: any = await fetchGraphQl(ACCEPT_QUOTE_TEMPLATE_MUTATION, {\n variables: { templateId: params.templateId },\n });\n\n if (!results?.data?.acceptNegotiableQuoteTemplate) {\n throw new Error('No quote template data received');\n }\n\n const transformedData = transformQuoteTemplate(\n results.data.acceptNegotiableQuoteTemplate\n );\n\n if (!transformedData) {\n throw new Error('Failed to transform quote template data');\n }\n\n events.emit('quote-management/quote-template-data', {\n quoteTemplate: transformedData,\n permissions: state.permissions,\n });\n\n return transformedData;\n } catch (error) {\n return Promise.reject(error);\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_TEMPLATE_FRAGMENT } from '@/quote-management/api/graphql/NegotiableQuoteTemplateFragment';\n\nexport const OPEN_QUOTE_TEMPLATE_MUTATION = /* GraphQL */ `\n mutation OPEN_QUOTE_TEMPLATE_MUTATION($templateId: ID!) {\n openNegotiableQuoteTemplate(input: { template_id: $templateId }) {\n ...NegotiableQuoteTemplateFragment\n }\n }\n\n ${NEGOTIABLE_QUOTE_TEMPLATE_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 { OPEN_QUOTE_TEMPLATE_MUTATION } from './graphql/openQuoteTemplate';\nimport { transformQuoteTemplate } from '@/quote-management/data/transforms';\nimport { state } from '@/quote-management/lib/state';\nimport { events } from '@adobe-commerce/event-bus';\n\nexport interface OpenQuoteTemplateParams {\n templateId: string;\n}\n\nexport const openQuoteTemplate = async (params: OpenQuoteTemplateParams) => {\n if (!params.templateId) {\n throw new Error('Template ID is required');\n }\n\n if (!state.authenticated) {\n throw new Error('Unauthorized');\n }\n\n try {\n const results: any = await fetchGraphQl(OPEN_QUOTE_TEMPLATE_MUTATION, {\n variables: { templateId: params.templateId },\n });\n\n if (!results?.data?.openNegotiableQuoteTemplate) {\n throw new Error('No quote template data received');\n }\n\n const transformedData = transformQuoteTemplate(\n results.data.openNegotiableQuoteTemplate\n );\n\n if (!transformedData) {\n throw new Error('Failed to transform quote template data');\n }\n\n events.emit('quote-management/quote-template-data', {\n quoteTemplate: transformedData,\n permissions: state.permissions,\n });\n\n return transformedData;\n } catch (error) {\n return Promise.reject(error);\n }\n};\n"],"names":["SEND_QUOTE_TEMPLATE_FOR_REVIEW_MUTATION","NEGOTIABLE_QUOTE_TEMPLATE_FRAGMENT","sendQuoteTemplateForReview","params","state","results","fetchGraphQl","_a","transformedData","transformQuoteTemplate","events","error","ACCEPT_QUOTE_TEMPLATE_MUTATION","acceptQuoteTemplate","OPEN_QUOTE_TEMPLATE_MUTATION","openQuoteTemplate"],"mappings":"wOAWO,MAAMA,EAAwD;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,IAUjEC,CAAkC;AAAA,ECAzBC,EAA6B,MACxCC,GACG,OACH,GAAI,CAACA,EAAO,WACV,MAAM,IAAI,MAAM,yBAAyB,EAG3C,GAAI,CAACC,EAAM,cACT,MAAM,IAAI,MAAM,cAAc,EAGhC,GA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,GAAoC,OAC1E,GAAI,CAACA,EAAO,WACV,MAAM,IAAI,MAAM,yBAAyB,EAG3C,GAAI,CAACC,EAAM,cACT,MAAM,IAAI,MAAM,cAAc,EAGhC,GAAI,CACF,MAAMC,EAAe,MAAMC,EAAaQ,EAA8B,CACpE,UAAW,CAAE,WAAYX,EAAO,UAAA,CAAW,CAC5C,EAED,GAAI,GAACI,EAAAF,GAAA,YAAAA,EAAS,OAAT,MAAAE,EAAe,6BAClB,MAAM,IAAI,MAAM,iCAAiC,EAGnD,MAAMC,EAAkBC,EACtBJ,EAAQ,KAAK,2BAAA,EAGf,GAAI,CAACG,EACH,MAAM,IAAI,MAAM,yCAAyC,EAG3D,OAAAE,EAAO,KAAK,uCAAwC,CAClD,cAAeF,EACf,YAAaJ,EAAM,WAAA,CACpB,EAEMI,CACT,OAASG,EAAO,CACd,OAAO,QAAQ,OAAOA,CAAK,CAC7B,CACF"}
@@ -1,59 +1,6 @@
1
1
  /*! Copyright 2025 Adobe
2
2
  All Rights Reserved. */
3
- import{fetchGraphQl as g}from"@dropins/tools/fetch-graphql.js";import{events as h}from"@dropins/tools/event-bus.js";const f={requestQuote:!1,editQuote:!1,deleteQuote:!1},w={authenticated:!1,permissions:f},x=new Proxy(w,{get:(a,t)=>a[t],set:(a,t,e)=>(a[t]=e,!0)});function N(a){if(!a||!a.data||!a.data.requestNegotiableQuote)return null;const t=a.data.requestNegotiableQuote.quote;return{uid:t.uid,createdAt:t.created_at,status:t.status,buyer:t.buyer,comments:t.comments.map(e=>{const o={uid:e.uid,createdAt:e.created_at,author:e.author};return Array.isArray(e.attachments)&&e.attachments.length>0&&(o.attachments=e.attachments.map(u=>({name:u.name,url:u.url}))),o}),items:t.items.map(e=>({product:{uid:e.product.uid,sku:e.product.sku,name:e.product.name,priceRange:{maximumPrice:{regularPrice:{value:e.product.price_range.maximum_price.regular_price.value}}}},quantity:e.quantity,prices:{subtotalExcludingTax:{value:t.prices.subtotal_excluding_tax.value},subtotalIncludingTax:{value:t.prices.subtotal_including_tax.value},subtotalWithDiscountExcludingTax:{value:t.prices.subtotal_with_discount_excluding_tax.value},grandTotal:{value:t.prices.grand_total.value}}}))}}const q=`
4
- fragment NegotiableQuoteFragment on RequestNegotiableQuoteOutput {
5
- quote {
6
- uid
7
- created_at
8
- status
9
- buyer {
10
- firstname
11
- lastname
12
- }
13
- comments {
14
- uid
15
- created_at
16
- author {
17
- firstname
18
- lastname
19
- }
20
- attachments {
21
- name
22
- url
23
- }
24
- }
25
- items {
26
- product {
27
- uid
28
- sku
29
- name
30
- price_range {
31
- maximum_price {
32
- regular_price {
33
- value
34
- }
35
- }
36
- }
37
- }
38
- quantity
39
- }
40
- prices {
41
- subtotal_excluding_tax {
42
- value
43
- }
44
- subtotal_including_tax {
45
- value
46
- }
47
- subtotal_with_discount_excluding_tax {
48
- value
49
- }
50
- grand_total {
51
- value
52
- }
53
- }
54
- }
55
- }
56
- `,b=`
3
+ import{events as f}from"@dropins/tools/event-bus.js";import{N}from"./NegotiableQuoteFragment.js";import{f as d,t as l}from"./transform-quote.js";import"./state.js";const g=`
57
4
  mutation REQUEST_NEGOTIABLE_QUOTE_MUTATION(
58
5
  $cartId: ID!
59
6
  $quoteName: String!
@@ -68,33 +15,11 @@ import{fetchGraphQl as g}from"@dropins/tools/fetch-graphql.js";import{events as
68
15
  is_draft: $isDraft
69
16
  }
70
17
  ) {
71
- ...NegotiableQuoteFragment
72
- }
73
- }
74
- ${q}
75
- `,y=async a=>{const{cartId:t,quoteName:e,comment:o,attachments:u,isDraft:i}=a;if(!t)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 g(b,{variables:{cartId:t,quoteName:e,comment:u!=null&&u.length?{comment:o,attachments:u}:{comment:o},isDraft:i}}).then(l=>{const{errors:r}=l;if(r){const c=r.map(d=>d.message).join("; ");throw new Error(`Failed to request negotiable quote: ${c}`)}const n=N(l);if(!n)throw new Error("Failed to transform quote data: Invalid response structure");return h.emit("quote-management/negotiable-quote-requested",{quote:n,input:{cartId:t,quoteName:e,comment:o,attachments:u,isDraft:i}}),n})},v=async a=>{var i,l;const t=a==null?void 0:a.name;if(!a||!t)throw new Error("Invalid file");const e="NEGOTIABLE_QUOTE_ATTACHMENT",o=`
76
- mutation INITIATE_UPLOAD_MUTATION(
77
- $input: initiateUploadInput!
78
- ){
79
- initiateUpload(
80
- input: $input
81
- ){
82
- upload_url
83
- key
84
- expires_at
85
- }
86
- }
87
- `,u=`
88
- mutation FINISH_UPLOAD_MUTATION(
89
- $input: finishUploadInput!
90
- ){
91
- finishUpload(
92
- input: $input
93
- ){
94
- success
95
- key
96
- message
18
+ quote {
19
+ ...NegotiableQuoteFragment
97
20
  }
98
21
  }
99
- `;try{const{data:r,errors:n}=await g(o,{variables:{input:{key:t,media_resource_type:e}}});if(n!=null&&n.length)throw new Error(n.map(s=>s==null?void 0:s.message).join("; "));const{upload_url:c,key:d}=(r==null?void 0:r.initiateUpload)||{};if(!c||!d)throw new Error("Failed to initiate upload");const p=await fetch(c,{method:"PUT",body:a});if(!p.ok)throw new Error(`Upload failed: ${p.status} ${p.statusText}`);const{data:_,errors:m}=await g(u,{variables:{input:{key:d,media_resource_type:e}}});if(m!=null&&m.length)throw new Error(m.map(s=>s==null?void 0:s.message).join("; "));const{success:E,key:T,message:I}=(_==null?void 0:_.finishUpload)||{};if(!E||!T)throw new Error(I||"Failed to finish upload");return{key:T}}catch(r){try{(l=(i=h)==null?void 0:i.emit)==null||l.call(i,"quote-management/file-upload-error",{error:(r==null?void 0:r.message)||"File upload failed",fileName:a==null?void 0:a.name})}catch{}throw r instanceof Error?r:new Error("File upload failed")}};export{f as D,y as r,x as s,v as u};
22
+ }
23
+ ${N}
24
+ `,p=async q=>{const{cartId:r,quoteName:o,comment:t,attachments:e,isDraft:n}=q;if(!r)throw new Error("Cart ID is required");if(!o)throw new Error("Quote name is required");if(!t)throw new Error("Comment is required");return d(g,{variables:{cartId:r,quoteName:o,comment:e!=null&&e.length?{comment:t,attachments:e}:{comment:t},isDraft:n}}).then(i=>{var m,s;const{errors:u}=i;if(u){const E=u.map(c=>c.message).join("; ");throw new Error(`Failed to request negotiable quote: ${E}`)}const a=l((s=(m=i.data)==null?void 0:m.requestNegotiableQuote)==null?void 0:s.quote);if(!a)throw new Error("Failed to transform quote data: Invalid response structure");return f.emit("quote-management/negotiable-quote-requested",{quote:a,input:{cartId:r,quoteName:o,comment:t,attachments:e,isDraft:n}}),a})};export{p as r};
100
25
  //# sourceMappingURL=requestNegotiableQuote.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"requestNegotiableQuote.js","sources":["/@dropins/storefront-quote-management/src/lib/state.ts","/@dropins/storefront-quote-management/src/data/transforms/transform-quote.ts","/@dropins/storefront-quote-management/src/api/graphql/NegotiableQuoteFragment.ts","/@dropins/storefront-quote-management/src/api/requestNegotiableQuote/graphql/RequestNegotiableQuoteMutation.ts","/@dropins/storefront-quote-management/src/api/requestNegotiableQuote/requestNegotiableQuote.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 { State } from '../types/state.types';\n\nexport const DEFAULT_PERMISSIONS = {\n requestQuote: false,\n editQuote: false,\n deleteQuote: false,\n};\n\nconst _state: State = {\n authenticated: false,\n permissions: DEFAULT_PERMISSIONS,\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 * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2024 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\nimport { NegotiableQuoteModel } from '@/quote-management/data/models/negotiable-quote-model';\n\nexport function transformQuote(response: any): NegotiableQuoteModel | null {\n if (!response || !response.data || !response.data.requestNegotiableQuote) {\n return null;\n }\n\n const quote = response.data.requestNegotiableQuote.quote;\n\n return {\n uid: quote.uid,\n createdAt: quote.created_at,\n status: quote.status,\n buyer: quote.buyer,\n comments: quote.comments.map((comment: any) => {\n const baseComment: any = {\n uid: comment.uid,\n createdAt: comment.created_at,\n author: comment.author,\n };\n\n if (Array.isArray(comment.attachments) && comment.attachments.length > 0) {\n baseComment.attachments = comment.attachments.map((a: any) => ({\n name: a.name,\n url: a.url,\n }));\n }\n\n return baseComment;\n }),\n items: quote.items.map((item: any) => ({\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: item.product.price_range.maximum_price.regular_price.value,\n },\n },\n },\n },\n quantity: item.quantity,\n prices: {\n subtotalExcludingTax: {\n value: quote.prices.subtotal_excluding_tax.value,\n },\n subtotalIncludingTax: {\n value: quote.prices.subtotal_including_tax.value,\n },\n subtotalWithDiscountExcludingTax: {\n value: quote.prices.subtotal_with_discount_excluding_tax.value,\n },\n grandTotal: {\n value: quote.prices.grand_total.value,\n },\n },\n })),\n };\n}\n","/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2024 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\n\nexport const NEGOTIABLE_QUOTE_FRAGMENT = /* GraphQL */ `\n fragment NegotiableQuoteFragment on RequestNegotiableQuoteOutput {\n quote {\n uid\n created_at\n status\n buyer {\n firstname\n lastname\n }\n comments {\n uid\n created_at\n author {\n firstname\n lastname\n }\n attachments {\n name\n url\n }\n }\n items {\n product {\n uid\n sku\n name\n price_range {\n maximum_price {\n regular_price {\n value\n }\n }\n }\n }\n quantity\n }\n prices {\n subtotal_excluding_tax {\n value\n }\n subtotal_including_tax {\n value\n }\n subtotal_with_discount_excluding_tax {\n value\n }\n grand_total {\n value\n }\n }\n }\n }\n`;\n","/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2024 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\n\nimport { NEGOTIABLE_QUOTE_FRAGMENT } from '@/quote-management/api/graphql/NegotiableQuoteFragment';\n\nexport const REQUEST_NEGOTIABLE_QUOTE_MUTATION = `\n mutation REQUEST_NEGOTIABLE_QUOTE_MUTATION(\n $cartId: ID!\n $quoteName: String!\n $comment: NegotiableQuoteCommentInput!\n $isDraft: Boolean\n ) {\n requestNegotiableQuote(\n input: {\n cart_id: $cartId\n quote_name: $quoteName\n comment: $comment\n is_draft: $isDraft\n }\n ) {\n ...NegotiableQuoteFragment\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 '@adobe-commerce/fetch-graphql';\nimport { events } from '@adobe-commerce/event-bus';\nimport { REQUEST_NEGOTIABLE_QUOTE_MUTATION } from './graphql/RequestNegotiableQuoteMutation';\nimport { NegotiableQuoteModel } from '@/quote-management/data/models/negotiable-quote-model';\nimport { transformQuote } from '@/quote-management/data/transforms';\n\nexport interface RequestNegotiableQuoteInput {\n cartId: string;\n quoteName: string;\n comment: string;\n isDraft?: boolean;\n attachments?: { key: string }[];\n}\n\nexport const requestNegotiableQuote = async (\n input: RequestNegotiableQuoteInput\n): Promise<NegotiableQuoteModel | null> => {\n const { cartId, quoteName, comment, attachments, isDraft } = input;\n\n if (!cartId) {\n throw new Error('Cart ID is required');\n }\n\n if (!quoteName) {\n throw new Error('Quote name is required');\n }\n\n if (!comment) {\n throw new Error('Comment is required');\n }\n\n return fetchGraphQl(REQUEST_NEGOTIABLE_QUOTE_MUTATION, {\n variables: {\n cartId,\n quoteName,\n comment: attachments?.length ? { comment, attachments } : { comment },\n isDraft,\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 request negotiable quote: ${errorMessages}`);\n }\n\n // Transform the quote data\n const quoteData = transformQuote(response);\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/negotiable-quote-requested', {\n quote: quoteData,\n input: { cartId, quoteName, comment, attachments, isDraft },\n });\n\n return quoteData;\n });\n};\n\nexport const uploadFile = async (file: File): Promise<{ key: string }> => {\n const filename = file?.name;\n if (!file || !filename) throw new Error('Invalid file');\n\n const media_resource_type = 'NEGOTIABLE_QUOTE_ATTACHMENT';\n\n const INITIATE_UPLOAD_MUTATION = `\n mutation INITIATE_UPLOAD_MUTATION(\n $input: initiateUploadInput!\n ){\n initiateUpload(\n input: $input\n ){\n upload_url\n key\n expires_at\n }\n }\n `;\n\n const FINISH_UPLOAD_MUTATION = `\n mutation FINISH_UPLOAD_MUTATION(\n $input: finishUploadInput!\n ){\n finishUpload(\n input: $input\n ){\n success\n key\n message\n }\n }\n `;\n\n try {\n const { data: initialData, errors: initialErrors }: any = await fetchGraphQl(INITIATE_UPLOAD_MUTATION, {\n variables: { input: { key: filename, media_resource_type } },\n });\n if (initialErrors?.length) throw new Error(initialErrors.map((e: any) => e?.message).join('; '));\n\n const { upload_url, key } = initialData?.initiateUpload || {};\n if (!upload_url || !key) throw new Error('Failed to initiate upload');\n\n const put = await fetch(upload_url, { method: 'PUT', body: file });\n if (!put.ok) throw new Error(`Upload failed: ${put.status} ${put.statusText}`);\n\n const { data: finishData, errors: finishErrors }: any = await fetchGraphQl(FINISH_UPLOAD_MUTATION, {\n variables: { input: { key, media_resource_type } },\n });\n if (finishErrors?.length) throw new Error(finishErrors.map((e: any) => e?.message).join('; '));\n\n const { success, key: finalizedKey, message } = finishData?.finishUpload || {};\n if (!success || !finalizedKey) throw new Error(message || 'Failed to finish upload');\n\n return { key: finalizedKey };\n } catch (err: any) {\n try {\n (events as any)?.emit?.('quote-management/file-upload-error', {\n error: err?.message || 'File upload failed',\n fileName: file?.name,\n });\n } catch {}\n throw err instanceof Error ? err : new Error('File upload failed');\n }\n};\n"],"names":["DEFAULT_PERMISSIONS","_state","state","target","key","value","transformQuote","response","quote","comment","baseComment","a","item","NEGOTIABLE_QUOTE_FRAGMENT","REQUEST_NEGOTIABLE_QUOTE_MUTATION","requestNegotiableQuote","input","cartId","quoteName","attachments","isDraft","fetchGraphQl","errors","errorMessages","error","quoteData","events","uploadFile","file","filename","media_resource_type","INITIATE_UPLOAD_MUTATION","FINISH_UPLOAD_MUTATION","initialData","initialErrors","e","upload_url","put","finishData","finishErrors","success","finalizedKey","message","err","_b","_a"],"mappings":"oHAWO,MAAMA,EAAsB,CAC/B,aAAc,GACd,UAAW,GACX,YAAa,EACjB,EAEMC,EAAgB,CAClB,cAAe,GACf,YAAaD,CACjB,EAGaE,EAAQ,IAAI,MAAMD,EAAQ,CACnC,IAAK,CAACE,EAAQC,IACHD,EAAOC,CAAkB,EAEpC,IAAK,CAACD,EAAQC,EAAKC,KACfF,EAAOC,CAAkB,E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KC,EAAc,QAAAC,IAAYJ,GAAA,YAAAA,EAAY,eAAgB,CAAA,EAC5E,GAAI,CAACE,GAAW,CAACC,QAAoB,IAAI,MAAMC,GAAW,yBAAyB,EAEnF,MAAO,CAAE,IAAKD,CAAA,CAChB,OAASE,EAAU,CACjB,GAAI,EACDC,GAAAC,EAAAnB,IAAA,YAAAmB,EAAgB,OAAhB,MAAAD,EAAA,KAAAC,EAAuB,qCAAsC,CAC5D,OAAOF,GAAA,YAAAA,EAAK,UAAW,qBACvB,SAAUf,GAAA,YAAAA,EAAM,IAAA,EAEpB,MAAQ,CAAC,CACT,MAAMe,aAAe,MAAQA,EAAM,IAAI,MAAM,oBAAoB,CACnE,CACF"}
1
+ {"version":3,"file":"requestNegotiableQuote.js","sources":["/@dropins/storefront-quote-management/src/api/requestNegotiableQuote/graphql/RequestNegotiableQuoteMutation.ts","/@dropins/storefront-quote-management/src/api/requestNegotiableQuote/requestNegotiableQuote.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 REQUEST_NEGOTIABLE_QUOTE_MUTATION = `\n mutation REQUEST_NEGOTIABLE_QUOTE_MUTATION(\n $cartId: ID!\n $quoteName: String!\n $comment: NegotiableQuoteCommentInput!\n $isDraft: Boolean\n ) {\n requestNegotiableQuote(\n input: {\n cart_id: $cartId\n quote_name: $quoteName\n comment: $comment\n is_draft: $isDraft\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 { REQUEST_NEGOTIABLE_QUOTE_MUTATION } from './graphql/RequestNegotiableQuoteMutation';\nimport { NegotiableQuoteModel } from '@/quote-management/data/models/negotiable-quote-model';\nimport { transformQuote } from '@/quote-management/data/transforms';\n\nexport interface RequestNegotiableQuoteInput {\n cartId: string;\n quoteName: string;\n comment: string;\n isDraft?: boolean;\n attachments?: { key: string }[];\n}\n\nexport const requestNegotiableQuote = async (\n input: RequestNegotiableQuoteInput\n): Promise<NegotiableQuoteModel | null> => {\n const { cartId, quoteName, comment, attachments, isDraft } = input;\n\n if (!cartId) {\n throw new Error('Cart ID is required');\n }\n\n if (!quoteName) {\n throw new Error('Quote name is required');\n }\n\n if (!comment) {\n throw new Error('Comment is required');\n }\n\n return fetchGraphQl(REQUEST_NEGOTIABLE_QUOTE_MUTATION, {\n variables: {\n cartId,\n quoteName,\n comment: attachments?.length ? { comment, attachments } : { comment },\n isDraft,\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 request negotiable quote: ${errorMessages}`);\n }\n\n // Transform the quote data\n const quoteData = transformQuote(response.data?.requestNegotiableQuote?.quote);\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/negotiable-quote-requested', {\n quote: quoteData,\n input: { cartId, quoteName, comment, attachments, isDraft },\n });\n\n return quoteData;\n });\n};\n"],"names":["REQUEST_NEGOTIABLE_QUOTE_MUTATION","NEGOTIABLE_QUOTE_FRAGMENT","requestNegotiableQuote","input","cartId","quoteName","comment","attachments","isDraft","fetchGraphQl","response","errors","errorMessages","error","quoteData","transformQuote","_b","_a","events"],"mappings":"oKAWO,MAAMA,EAAoC;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,IAoB7CC,CAAyB;AAAA,ECRhBC,EAAyB,MACpCC,GACyC,CACzC,KAAM,CAAE,OAAAC,EAAQ,UAAAC,EAAW,QAAAC,EAAS,YAAAC,EAAa,QAAAC,GAAYL,EAE7D,GAAI,CAACC,EACH,MAAM,IAAI,MAAM,qBAAqB,EAGvC,GAAI,CAACC,EACH,MAAM,IAAI,MAAM,wBAAwB,EAG1C,GAAI,CAACC,EACH,MAAM,IAAI,MAAM,qBAAqB,EAGvC,OAAOG,EAAaT,EAAmC,CACrD,UAAW,CACT,OAAAI,EACA,UAAAC,EACA,QAASE,GAAA,MAAAA,EAAa,OAAS,CAAE,QAAAD,EAAS,YAAAC,CAAA,EAAgB,CAAE,QAAAD,CAAA,EAC5D,QAAAE,CAAA,CACF,CACD,EAAE,KAAME,GAAa,SACpB,KAAM,CAAE,OAAAC,GAAWD,EAEnB,GAAIC,EAAQ,CAEV,MAAMC,EAAgBD,EAAO,IAAKE,GAAUA,EAAM,OAAO,EAAE,KAAK,IAAI,EACpE,MAAM,IAAI,MAAM,uCAAuCD,CAAa,EAAE,CACxE,CAGA,MAAME,EAAYC,GAAeC,GAAAC,EAAAP,EAAS,OAAT,YAAAO,EAAe,yBAAf,YAAAD,EAAuC,KAAK,EAE7E,GAAI,CAACF,EACH,MAAM,IAAI,MACR,4DAAA,EAKJ,OAAAI,EAAO,KAAK,8CAA+C,CACzD,MAAOJ,EACP,MAAO,CAAE,OAAAV,EAAQ,UAAAC,EAAW,QAAAC,EAAS,YAAAC,EAAa,QAAAC,CAAA,CAAQ,CAC3D,EAEMM,CACT,CAAC,CACH"}