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

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 (317) hide show
  1. package/LICENSE.md +25 -26
  2. package/api/acceptQuoteTemplate/acceptQuoteTemplate.d.ts +13 -0
  3. package/api/{getCustomerData/getCustomerData.d.ts → acceptQuoteTemplate/graphql/acceptQuoteTemplate.d.ts} +2 -2
  4. package/{data/transforms/__fixtures__/customerData.d.ts → api/acceptQuoteTemplate/index.d.ts} +2 -2
  5. package/api/addQuoteTemplateLineItemNote/addQuoteTemplateLineItemNote.d.ts +15 -0
  6. package/api/addQuoteTemplateLineItemNote/graphql/setQuoteTemplateLineItemNote.d.ts +10 -0
  7. package/api/addQuoteTemplateLineItemNote/index.d.ts +10 -0
  8. package/api/addQuoteTemplateShippingAddress/addQuoteTemplateShippingAddress.d.ts +37 -0
  9. package/api/addQuoteTemplateShippingAddress/graphql/setNegotiableQuoteTemplateShippingAddress.d.ts +10 -0
  10. package/api/addQuoteTemplateShippingAddress/index.d.ts +10 -0
  11. package/api/cancelQuoteTemplate/cancelQuoteTemplate.d.ts +14 -0
  12. package/api/cancelQuoteTemplate/graphql/cancelQuoteTemplate.d.ts +10 -0
  13. package/api/cancelQuoteTemplate/index.d.ts +10 -0
  14. package/api/closeNegotiableQuote/closeNegotiableQuote.d.ts +31 -0
  15. package/api/closeNegotiableQuote/graphql/CloseNegotiableQuoteMutation.d.ts +2 -0
  16. package/api/closeNegotiableQuote/index.d.ts +10 -0
  17. package/api/createQuoteTemplate/createQuoteTemplate.d.ts +4 -0
  18. package/api/createQuoteTemplate/graphql/createQuoteTemplate.d.ts +10 -0
  19. package/api/createQuoteTemplate/index.d.ts +10 -0
  20. package/api/deleteQuote/deleteQuote.d.ts +28 -0
  21. package/api/deleteQuote/graphql/DeleteQuoteMutation.d.ts +10 -0
  22. package/api/{getCustomerData → deleteQuote}/index.d.ts +1 -1
  23. package/{data/models/customer-model.d.ts → api/deleteQuoteTemplate/deleteQuoteTemplate.d.ts} +6 -8
  24. package/api/deleteQuoteTemplate/graphql/deleteQuoteTemplate.d.ts +10 -0
  25. package/api/deleteQuoteTemplate/index.d.ts +10 -0
  26. package/api/duplicateNegotiableQuote/duplicateNegotiableQuote.d.ts +9 -0
  27. package/api/duplicateNegotiableQuote/graphql/duplicateNegotiableQuoteMutation.d.ts +10 -0
  28. package/api/duplicateNegotiableQuote/index.d.ts +10 -0
  29. package/api/generateQuoteFromTemplate/generateQuoteFromTemplate.d.ts +15 -0
  30. package/api/generateQuoteFromTemplate/graphql/generateNegotiableQuoteFromTemplate.d.ts +10 -0
  31. package/api/generateQuoteFromTemplate/index.d.ts +10 -0
  32. package/api/getQuoteData/getQuoteData.d.ts +10 -0
  33. package/api/getQuoteData/graphql/QuoteDataQuery.d.ts +2 -0
  34. package/api/getQuoteData/index.d.ts +10 -0
  35. package/api/getQuoteTemplateData/getQuoteTemplateData.d.ts +4 -0
  36. package/api/getQuoteTemplateData/graphql/getQuoteTemplateData.d.ts +10 -0
  37. package/api/getQuoteTemplateData/index.d.ts +10 -0
  38. package/api/getQuoteTemplates/getQuoteTemplates.d.ts +34 -0
  39. package/api/getQuoteTemplates/graphql/getQuoteTemplates.d.ts +10 -0
  40. package/api/getQuoteTemplates/index.d.ts +10 -0
  41. package/api/getStoreConfig/getStoreConfig.d.ts +4 -0
  42. package/api/getStoreConfig/graphql/StoreConfigQuery.d.ts +10 -0
  43. package/api/getStoreConfig/index.d.ts +10 -0
  44. package/api/graphql/NegotiableQuoteAddressFragment.d.ts +10 -0
  45. package/api/graphql/NegotiableQuoteFragment.d.ts +5 -13
  46. package/api/graphql/NegotiableQuoteListFragment.d.ts +10 -0
  47. package/api/graphql/NegotiableQuoteTemplateFragment.d.ts +10 -0
  48. package/api/graphql/SearchResultPageInfoFragment.d.ts +10 -0
  49. package/api/graphql/ShippingMethodFragment.d.ts +10 -0
  50. package/api/graphql/SortFieldsFragment.d.ts +10 -0
  51. package/api/index.d.ts +34 -1
  52. package/api/initialize/initialize.d.ts +2 -0
  53. package/api/negotiableQuotes/graphql/NegotiableQuotesQuery.d.ts +10 -0
  54. package/api/negotiableQuotes/index.d.ts +10 -0
  55. package/api/negotiableQuotes/negotiableQuotes.d.ts +39 -0
  56. package/api/openQuoteTemplate/graphql/openQuoteTemplate.d.ts +10 -0
  57. package/api/openQuoteTemplate/index.d.ts +10 -0
  58. package/api/openQuoteTemplate/openQuoteTemplate.d.ts +13 -0
  59. package/api/removeNegotiableQuoteItems/graphql/RemoveNegotiableQuoteItemsMutation.d.ts +10 -0
  60. package/api/removeNegotiableQuoteItems/index.d.ts +10 -0
  61. package/api/removeNegotiableQuoteItems/removeNegotiableQuoteItems.d.ts +8 -0
  62. package/api/removeQuoteTemplateItems/graphql/removeNegotiableQuoteTemplateItems.d.ts +10 -0
  63. package/api/removeQuoteTemplateItems/index.d.ts +10 -0
  64. package/api/removeQuoteTemplateItems/removeQuoteTemplateItems.d.ts +14 -0
  65. package/api/renameNegotiableQuote/graphql/RenameNegotiableQuoteMutation.d.ts +10 -0
  66. package/api/renameNegotiableQuote/index.d.ts +10 -0
  67. package/api/renameNegotiableQuote/renameNegotiableQuote.d.ts +9 -0
  68. package/api/requestNegotiableQuote/graphql/RequestNegotiableQuoteMutation.d.ts +4 -12
  69. package/api/requestNegotiableQuote/requestNegotiableQuote.d.ts +0 -3
  70. package/api/sendForReview/graphql/SendNegotiableQuoteForReviewMutation.d.ts +10 -0
  71. package/api/sendForReview/index.d.ts +10 -0
  72. package/api/sendForReview/sendForReview.d.ts +11 -0
  73. package/api/sendQuoteTemplateForReview/graphql/sendQuoteTemplateForReview.d.ts +10 -0
  74. package/api/sendQuoteTemplateForReview/index.d.ts +10 -0
  75. package/api/sendQuoteTemplateForReview/sendQuoteTemplateForReview.d.ts +25 -0
  76. package/api/setLineItemNote/graphql/SetLineItemNoteMutation.d.ts +10 -0
  77. package/api/setLineItemNote/index.d.ts +10 -0
  78. package/api/setLineItemNote/setLineItemNote.d.ts +10 -0
  79. package/api/setShippingAddress/graphql/SetNegotiableQuoteShippingAddressMutation.d.ts +10 -0
  80. package/api/setShippingAddress/index.d.ts +2 -0
  81. package/api/setShippingAddress/setShippingAddress.d.ts +110 -0
  82. package/api/updateQuantities/graphql/UpdateNegotiableQuoteQuantitiesMutation.d.ts +10 -0
  83. package/api/updateQuantities/index.d.ts +10 -0
  84. package/api/updateQuantities/updateQuantities.d.ts +36 -0
  85. package/api/updateQuoteTemplateItemQuantities/graphql/updateNegotiableQuoteTemplateQuantities.d.ts +10 -0
  86. package/api/updateQuoteTemplateItemQuantities/index.d.ts +10 -0
  87. package/api/updateQuoteTemplateItemQuantities/updateQuoteTemplateItemQuantities.d.ts +20 -0
  88. package/api/uploadFile/graphql/FinishUploadMutation.d.ts +10 -0
  89. package/api/uploadFile/graphql/InitiateUploadMutation.d.ts +10 -0
  90. package/api/uploadFile/index.d.ts +10 -0
  91. package/api/uploadFile/uploadFile.d.ts +12 -0
  92. package/api.js +58 -22
  93. package/api.js.map +1 -1
  94. package/chunks/AttachedFilesList.js +4 -0
  95. package/chunks/AttachedFilesList.js.map +1 -0
  96. package/chunks/CheckWithCircle.js +4 -0
  97. package/chunks/CheckWithCircle.js.map +1 -0
  98. package/chunks/ChevronDown.js +4 -0
  99. package/chunks/ChevronDown.js.map +1 -0
  100. package/chunks/ConfirmationModal.js +4 -0
  101. package/chunks/ConfirmationModal.js.map +1 -0
  102. package/chunks/ItemsQuoted.js +4 -0
  103. package/chunks/ItemsQuoted.js.map +1 -0
  104. package/chunks/ItemsQuotedTemplate.js +4 -0
  105. package/chunks/ItemsQuotedTemplate.js.map +1 -0
  106. package/chunks/LineItemNoteModal.js +4 -0
  107. package/chunks/LineItemNoteModal.js.map +1 -0
  108. package/chunks/NegotiableQuoteFragment.js +392 -0
  109. package/chunks/NegotiableQuoteFragment.js.map +1 -0
  110. package/chunks/NegotiableQuoteTemplateFragment.js +338 -0
  111. package/chunks/NegotiableQuoteTemplateFragment.js.map +1 -0
  112. package/chunks/OrderSummaryLine.js +4 -0
  113. package/chunks/OrderSummaryLine.js.map +1 -0
  114. package/chunks/QuoteCommentsList.js +4 -0
  115. package/chunks/QuoteCommentsList.js.map +1 -0
  116. package/chunks/QuoteCommentsList3.js +4 -0
  117. package/chunks/QuoteCommentsList3.js.map +1 -0
  118. package/chunks/QuoteHistoryLog.js +4 -0
  119. package/chunks/QuoteHistoryLog.js.map +1 -0
  120. package/chunks/QuoteHistoryLog3.js +4 -0
  121. package/chunks/QuoteHistoryLog3.js.map +1 -0
  122. package/chunks/QuoteTemplateCommentsList.js +4 -0
  123. package/chunks/QuoteTemplateCommentsList.js.map +1 -0
  124. package/chunks/QuoteTemplateHistoryLog.js +4 -0
  125. package/chunks/QuoteTemplateHistoryLog.js.map +1 -0
  126. package/chunks/RenameQuoteModal.js +4 -0
  127. package/chunks/RenameQuoteModal.js.map +1 -0
  128. package/chunks/ShippingAddressDisplay.js +4 -0
  129. package/chunks/ShippingAddressDisplay.js.map +1 -0
  130. package/chunks/WarningFilled.js +4 -0
  131. package/chunks/WarningFilled.js.map +1 -0
  132. package/chunks/addQuoteTemplateLineItemNote.js +33 -0
  133. package/chunks/addQuoteTemplateLineItemNote.js.map +1 -0
  134. package/chunks/dateUtils.js +4 -0
  135. package/chunks/dateUtils.js.map +1 -0
  136. package/chunks/duplicateNegotiableQuote.js +121 -0
  137. package/chunks/duplicateNegotiableQuote.js.map +1 -0
  138. package/chunks/generateQuoteFromTemplate.js +12 -0
  139. package/chunks/generateQuoteFromTemplate.js.map +1 -0
  140. package/chunks/getQuoteTemplates.js +52 -0
  141. package/chunks/getQuoteTemplates.js.map +1 -0
  142. package/chunks/negotiableQuotes.js +77 -0
  143. package/chunks/negotiableQuotes.js.map +1 -0
  144. package/chunks/openQuoteTemplate.js +52 -0
  145. package/chunks/openQuoteTemplate.js.map +1 -0
  146. package/chunks/requestNegotiableQuote.js +6 -81
  147. package/chunks/requestNegotiableQuote.js.map +1 -1
  148. package/chunks/setLineItemNote.js +47 -0
  149. package/chunks/setLineItemNote.js.map +1 -0
  150. package/chunks/state.js +4 -0
  151. package/chunks/state.js.map +1 -0
  152. package/chunks/transform-quote-template.js +4 -0
  153. package/chunks/transform-quote-template.js.map +1 -0
  154. package/chunks/transform-quote.js +4 -0
  155. package/chunks/transform-quote.js.map +1 -0
  156. package/chunks/uploadFile.js +20 -0
  157. package/chunks/uploadFile.js.map +1 -0
  158. package/components/ActionsBar/ActionsBar.d.ts +15 -0
  159. package/components/ActionsBar/index.d.ts +11 -0
  160. package/components/AttachedFilesList/AttachedFilesList.d.ts +16 -0
  161. package/components/AttachedFilesList/index.d.ts +11 -0
  162. package/components/ConfirmationModal/ConfirmationModal.d.ts +17 -0
  163. package/components/ConfirmationModal/index.d.ts +11 -0
  164. package/components/ItemsQuoted/ItemsQuoted.d.ts +11 -0
  165. package/components/ItemsQuoted/index.d.ts +11 -0
  166. package/components/LineItemNoteModal/LineItemNoteModal.d.ts +17 -0
  167. package/components/LineItemNoteModal/index.d.ts +11 -0
  168. package/components/ManageNegotiableQuote/ManageNegotiableQuote.d.ts +22 -0
  169. package/components/ManageNegotiableQuote/__fixtures__/ManageNegotiableQuoteProps.d.ts +4 -0
  170. package/components/ManageNegotiableQuote/index.d.ts +11 -0
  171. package/components/ManageNegotiableQuoteTemplate/ManageNegotiableQuoteTemplate.d.ts +23 -0
  172. package/components/ManageNegotiableQuoteTemplate/__fixtures__/ManageNegotiableQuoteTemplateProps.d.ts +4 -0
  173. package/components/ManageNegotiableQuoteTemplate/index.d.ts +11 -0
  174. package/components/OrderSummary/OrderSummary.d.ts +48 -0
  175. package/components/OrderSummary/index.d.ts +11 -0
  176. package/components/OrderSummaryLine/OrderSummaryLine.d.ts +13 -0
  177. package/components/OrderSummaryLine/index.d.ts +11 -0
  178. package/components/ProductListTable/ProductListTable.d.ts +17 -0
  179. package/components/ProductListTable/index.d.ts +11 -0
  180. package/components/QuoteCommentsList/QuoteCommentsList.d.ts +17 -0
  181. package/components/QuoteCommentsList/index.d.ts +11 -0
  182. package/components/QuoteHistoryLog/QuoteHistoryLog.d.ts +77 -0
  183. package/components/QuoteHistoryLog/index.d.ts +11 -0
  184. package/components/QuotePricesSummary/QuotePricesSummary.d.ts +16 -0
  185. package/components/QuotePricesSummary/index.d.ts +11 -0
  186. package/components/QuoteSummaryList/QuoteSummaryList.d.ts +13 -0
  187. package/components/QuoteSummaryList/index.d.ts +11 -0
  188. package/components/QuoteTemplatesListTable/QuoteTemplatesListTable.d.ts +29 -0
  189. package/components/QuoteTemplatesListTable/index.d.ts +10 -0
  190. package/components/QuotesListTable/QuotesListTable.d.ts +29 -0
  191. package/components/QuotesListTable/index.d.ts +11 -0
  192. package/components/ReferenceDocumentFormModal/ReferenceDocumentFormModal.d.ts +30 -0
  193. package/components/ReferenceDocumentFormModal/index.d.ts +11 -0
  194. package/components/ReferenceDocumentsList/ReferenceDocumentsList.d.ts +18 -0
  195. package/components/ReferenceDocumentsList/index.d.ts +11 -0
  196. package/components/RenameQuoteModal/RenameQuoteModal.d.ts +18 -0
  197. package/components/RenameQuoteModal/index.d.ts +11 -0
  198. package/components/RequestNegotiableQuoteForm/RequestNegotiableQuoteForm.d.ts +1 -0
  199. package/components/ShippingAddressDisplay/ShippingAddressDisplay.d.ts +12 -0
  200. package/components/ShippingAddressDisplay/index.d.ts +11 -0
  201. package/components/TabbedContent/TabbedContent.d.ts +10 -0
  202. package/components/TabbedContent/index.d.ts +11 -0
  203. package/components/index.d.ts +30 -0
  204. package/containers/ItemsQuoted/ItemsQuoted.d.ts +30 -0
  205. package/containers/ItemsQuoted/index.d.ts +11 -0
  206. package/containers/ItemsQuoted.d.ts +3 -0
  207. package/containers/ItemsQuoted.js +4 -0
  208. package/containers/ItemsQuoted.js.map +1 -0
  209. package/containers/ItemsQuotedTemplate/ItemsQuotedTemplate.d.ts +25 -0
  210. package/containers/ItemsQuotedTemplate/index.d.ts +11 -0
  211. package/containers/ItemsQuotedTemplate.d.ts +3 -0
  212. package/containers/ItemsQuotedTemplate.js +4 -0
  213. package/containers/ItemsQuotedTemplate.js.map +1 -0
  214. package/containers/ManageNegotiableQuote/ManageNegotiableQuote.d.ts +90 -0
  215. package/containers/ManageNegotiableQuote/index.d.ts +11 -0
  216. package/containers/ManageNegotiableQuote.d.ts +3 -0
  217. package/containers/ManageNegotiableQuote.js +4 -0
  218. package/containers/ManageNegotiableQuote.js.map +1 -0
  219. package/containers/ManageNegotiableQuoteTemplate/ManageNegotiableQuoteTemplate.d.ts +108 -0
  220. package/containers/ManageNegotiableQuoteTemplate/index.d.ts +11 -0
  221. package/containers/ManageNegotiableQuoteTemplate.d.ts +3 -0
  222. package/containers/ManageNegotiableQuoteTemplate.js +6 -0
  223. package/containers/ManageNegotiableQuoteTemplate.js.map +1 -0
  224. package/containers/OrderSummary/OrderSummary.d.ts +11 -0
  225. package/containers/OrderSummary/index.d.ts +11 -0
  226. package/containers/OrderSummary.d.ts +3 -0
  227. package/containers/OrderSummary.js +4 -0
  228. package/containers/OrderSummary.js.map +1 -0
  229. package/containers/OrderSummaryLine/OrderSummaryLine.d.ts +14 -0
  230. package/containers/OrderSummaryLine/index.d.ts +11 -0
  231. package/containers/OrderSummaryLine.d.ts +3 -0
  232. package/containers/OrderSummaryLine.js +4 -0
  233. package/containers/OrderSummaryLine.js.map +1 -0
  234. package/containers/QuoteCommentsList/QuoteCommentsList.d.ts +9 -0
  235. package/containers/QuoteCommentsList/index.d.ts +11 -0
  236. package/containers/QuoteCommentsList.d.ts +3 -0
  237. package/containers/QuoteCommentsList.js +4 -0
  238. package/containers/QuoteCommentsList.js.map +1 -0
  239. package/containers/QuoteHistoryLog/QuoteHistoryLog.d.ts +9 -0
  240. package/containers/QuoteHistoryLog/index.d.ts +11 -0
  241. package/containers/QuoteHistoryLog.d.ts +3 -0
  242. package/containers/QuoteHistoryLog.js +4 -0
  243. package/containers/QuoteHistoryLog.js.map +1 -0
  244. package/containers/QuoteSummaryList/QuoteSummaryList.d.ts +51 -0
  245. package/containers/QuoteSummaryList/index.d.ts +11 -0
  246. package/containers/QuoteSummaryList.d.ts +3 -0
  247. package/containers/QuoteSummaryList.js +4 -0
  248. package/containers/QuoteSummaryList.js.map +1 -0
  249. package/containers/QuoteTemplateCommentsList/QuoteTemplateCommentsList.d.ts +9 -0
  250. package/containers/QuoteTemplateCommentsList/index.d.ts +11 -0
  251. package/containers/QuoteTemplateCommentsList.d.ts +3 -0
  252. package/containers/QuoteTemplateCommentsList.js +4 -0
  253. package/containers/QuoteTemplateCommentsList.js.map +1 -0
  254. package/containers/QuoteTemplateHistoryLog/QuoteTemplateHistoryLog.d.ts +9 -0
  255. package/containers/QuoteTemplateHistoryLog/index.d.ts +11 -0
  256. package/containers/QuoteTemplateHistoryLog.d.ts +3 -0
  257. package/containers/QuoteTemplateHistoryLog.js +4 -0
  258. package/containers/QuoteTemplateHistoryLog.js.map +1 -0
  259. package/containers/QuoteTemplatesListTable/QuoteTemplatesListTable.d.ts +74 -0
  260. package/containers/QuoteTemplatesListTable/index.d.ts +11 -0
  261. package/containers/QuoteTemplatesListTable.d.ts +3 -0
  262. package/containers/QuoteTemplatesListTable.js +4 -0
  263. package/containers/QuoteTemplatesListTable.js.map +1 -0
  264. package/containers/QuotesListTable/QuotesListTable.d.ts +72 -0
  265. package/containers/QuotesListTable/index.d.ts +11 -0
  266. package/containers/QuotesListTable.d.ts +3 -0
  267. package/containers/QuotesListTable.js +4 -0
  268. package/containers/QuotesListTable.js.map +1 -0
  269. package/containers/RequestNegotiableQuoteForm/RequestNegotiableQuoteForm.d.ts +10 -1
  270. package/containers/RequestNegotiableQuoteForm.js +1 -1
  271. package/containers/RequestNegotiableQuoteForm.js.map +1 -1
  272. package/containers/ShippingAddressDisplay/ShippingAddressDisplay.d.ts +10 -0
  273. package/containers/ShippingAddressDisplay/index.d.ts +11 -0
  274. package/containers/ShippingAddressDisplay.d.ts +1 -0
  275. package/containers/ShippingAddressDisplay.js +4 -0
  276. package/containers/ShippingAddressDisplay.js.map +1 -0
  277. package/containers/index.d.ts +22 -0
  278. package/data/models/__fixtures__/negotiableQuoteModel.d.ts +8 -0
  279. package/data/models/__fixtures__/negotiableQuoteTemplateModel.d.ts +4 -0
  280. package/data/models/__fixtures__/negotiableQuoteTemplatesListModel.d.ts +5 -0
  281. package/data/models/__fixtures__/negotiableQuotesListModel.d.ts +5 -0
  282. package/data/models/__fixtures__/storeConfigModel.d.ts +5 -0
  283. package/data/models/index.d.ts +11 -1
  284. package/data/models/negotiable-quote-model.d.ts +263 -27
  285. package/data/models/negotiable-quote-template-model.d.ts +112 -0
  286. package/data/models/store-config-model.d.ts +29 -0
  287. package/data/transforms/__fixtures__/negotiableQuoteData.d.ts +673 -2
  288. package/data/transforms/__fixtures__/negotiableQuoteTemplateData.d.ts +2151 -0
  289. package/data/transforms/__fixtures__/storeConfigData.d.ts +35 -0
  290. package/data/transforms/index.d.ts +6 -13
  291. package/data/transforms/transform-history.d.ts +15 -0
  292. package/data/transforms/transform-quote-items.d.ts +15 -0
  293. package/data/transforms/transform-quote-template.d.ts +5 -0
  294. package/data/transforms/transform-quote.d.ts +13 -2
  295. package/data/transforms/transform-store-config.d.ts +4 -0
  296. package/hooks/useItemsQuotedTemplate.d.ts +15 -0
  297. package/hooks/useQuoteSummaryData.d.ts +10 -0
  298. package/hooks/useReferenceDocumentLinks.d.ts +34 -0
  299. package/hooks/useRemoveTemplateItems.d.ts +25 -0
  300. package/hooks/useRenameTemplate.d.ts +71 -0
  301. package/hooks/useUpdateTemplateQuantities.d.ts +27 -0
  302. package/i18n/en_US.json.d.ts +447 -1
  303. package/lib/configurationTransformers.d.ts +27 -0
  304. package/lib/itemFormatters.d.ts +47 -0
  305. package/lib/priceCalculators.d.ts +41 -0
  306. package/lib/state.d.ts +6 -0
  307. package/package.json +1 -1
  308. package/render.js +6 -2
  309. package/render.js.map +1 -1
  310. package/types/state.types.d.ts +13 -0
  311. package/utils/dateUtils.d.ts +26 -0
  312. package/utils/fileUtils.d.ts +46 -0
  313. package/utils/mapAuthPermissions.d.ts +39 -0
  314. package/api/getCustomerData/graphql/CustomerQuery.d.ts +0 -2
  315. package/api/graphql/CustomerFragment.d.ts +0 -2
  316. package/data/models/__fixtures__/customerModel.d.ts +0 -4
  317. package/data/transforms/transform-customer.d.ts +0 -15
@@ -0,0 +1,4 @@
1
+ /*! Copyright 2025 Adobe
2
+ All Rights Reserved. */
3
+ import*as e from"@dropins/tools/preact-compat.js";const l=t=>e.createElement("svg",{width:24,height:24,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",...t},e.createElement("path",{vectorEffect:"non-scaling-stroke",fillRule:"evenodd",clipRule:"evenodd",d:"M1 20.8953L12.1922 1.5L23.395 20.8953H1ZM13.0278 13.9638L13.25 10.0377V9H11.25V10.0377L11.4722 13.9638H13.0278ZM11.2994 16V17.7509H13.2253V16H11.2994Z",fill:"currentColor"}));export{l as S};
4
+ //# sourceMappingURL=WarningFilled.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"WarningFilled.js","sources":["../../node_modules/@adobe-commerce/elsie/src/icons/WarningFilled.svg"],"sourcesContent":["import * as React from \"react\";\nconst SvgWarningFilled = (props) => /* @__PURE__ */ React.createElement(\"svg\", { width: 24, height: 24, viewBox: \"0 0 24 24\", fill: \"none\", xmlns: \"http://www.w3.org/2000/svg\", ...props }, /* @__PURE__ */ React.createElement(\"path\", { vectorEffect: \"non-scaling-stroke\", fillRule: \"evenodd\", clipRule: \"evenodd\", d: \"M1 20.8953L12.1922 1.5L23.395 20.8953H1ZM13.0278 13.9638L13.25 10.0377V9H11.25V10.0377L11.4722 13.9638H13.0278ZM11.2994 16V17.7509H13.2253V16H11.2994Z\", fill: \"currentColor\" }));\nexport default SvgWarningFilled;\n"],"names":["SvgWarningFilled","props","React"],"mappings":"kDACK,MAACA,EAAoBC,GAA0BC,EAAM,cAAc,MAAO,CAAE,MAAO,GAAI,OAAQ,GAAI,QAAS,YAAa,KAAM,OAAQ,MAAO,6BAA8B,GAAGD,CAAK,EAAoBC,EAAM,cAAc,OAAQ,CAAE,aAAc,qBAAsB,SAAU,UAAW,SAAU,UAAW,EAAG,yJAA0J,KAAM,eAAgB,CAAC","x_google_ignoreList":[0]}
@@ -0,0 +1,33 @@
1
+ /*! Copyright 2025 Adobe
2
+ All Rights Reserved. */
3
+ import{events as n}from"@dropins/tools/event-bus.js";import{a as u}from"./transform-quote-template.js";import{s as r}from"./state.js";import{N as T}from"./NegotiableQuoteTemplateFragment.js";import{f as p}from"./transform-quote.js";const s=`
4
+ mutation UPDATE_NEGOTIABLE_QUOTE_TEMPLATE_QUANTITIES_MUTATION(
5
+ $input: UpdateNegotiableQuoteTemplateQuantitiesInput!
6
+ ) {
7
+ updateNegotiableQuoteTemplateQuantities(input: $input) {
8
+ quote_template {
9
+ ...NegotiableQuoteTemplateFragment
10
+ }
11
+ }
12
+ }
13
+ ${T}
14
+ `,w=async e=>{var o,t;if(!e.templateId)throw new Error("Template ID is required");if(!e.items||e.items.length===0)throw new Error("Items array is required and must not be empty");if(!r.authenticated)throw new Error("Unauthorized");try{const a=await p(s,{variables:{input:{template_id:e.templateId,items:e.items.map(i=>({item_id:i.itemId,quantity:i.quantity,min_qty:i.minQty,max_qty:i.maxQty}))}}});if(!((t=(o=a==null?void 0:a.data)==null?void 0:o.updateNegotiableQuoteTemplateQuantities)!=null&&t.quote_template))throw new Error("No quote template data received");const m=u(a.data.updateNegotiableQuoteTemplateQuantities.quote_template);if(!m)throw new Error("Failed to transform quote template data");return n.emit("quote-management/quote-template-data",{quoteTemplate:m,permissions:r.permissions}),m}catch(a){return Promise.reject(a)}},E=`
15
+ mutation REMOVE_NEGOTIABLE_QUOTE_TEMPLATE_ITEMS_MUTATION(
16
+ $input: RemoveNegotiableQuoteTemplateItemsInput!
17
+ ) {
18
+ removeNegotiableQuoteTemplateItems(input: $input) {
19
+ ...NegotiableQuoteTemplateFragment
20
+ }
21
+ }
22
+ ${T}
23
+ `,c=async e=>{var o;if(!e.templateId)throw new Error("Template ID is required");if(!e.itemUids||e.itemUids.length===0)throw new Error("Item UIDs array is required and must not be empty");if(!r.authenticated)throw new Error("Unauthorized");try{const t=await p(E,{variables:{input:{template_id:e.templateId,item_uids:e.itemUids}}});if(!((o=t==null?void 0:t.data)!=null&&o.removeNegotiableQuoteTemplateItems))throw new Error("No quote template data received");const a=u(t.data.removeNegotiableQuoteTemplateItems);if(!a)throw new Error("Failed to transform quote template data");return n.emit("quote-management/quote-template-data",{quoteTemplate:a,permissions:r.permissions}),a}catch(t){return Promise.reject(t)}},d=`
24
+ mutation SET_QUOTE_TEMPLATE_LINE_ITEM_NOTE_MUTATION(
25
+ $input: QuoteTemplateLineItemNoteInput!
26
+ ) {
27
+ setQuoteTemplateLineItemNote(input: $input) {
28
+ ...NegotiableQuoteTemplateFragment
29
+ }
30
+ }
31
+ ${T}
32
+ `,f=async e=>{var o;if(!e.templateId)throw new Error("Template ID is required");if(!e.itemId)throw new Error("Item ID is required");if(!r.authenticated)throw new Error("Unauthorized");try{const t=await p(d,{variables:{input:{templateId:e.templateId,item_uid:e.itemId,note:e.note}}});if(!((o=t==null?void 0:t.data)!=null&&o.setQuoteTemplateLineItemNote))throw new Error("No quote template data received");const a=u(t.data.setQuoteTemplateLineItemNote);if(!a)throw new Error("Failed to transform quote template data");return n.emit("quote-management/quote-template-data",{quoteTemplate:a,permissions:r.permissions}),a}catch(t){return Promise.reject(t)}};export{f as a,c as r,w as u};
33
+ //# sourceMappingURL=addQuoteTemplateLineItemNote.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"addQuoteTemplateLineItemNote.js","sources":["/@dropins/storefront-quote-management/src/api/updateQuoteTemplateItemQuantities/graphql/updateNegotiableQuoteTemplateQuantities.ts","/@dropins/storefront-quote-management/src/api/updateQuoteTemplateItemQuantities/updateQuoteTemplateItemQuantities.ts","/@dropins/storefront-quote-management/src/api/removeQuoteTemplateItems/graphql/removeNegotiableQuoteTemplateItems.ts","/@dropins/storefront-quote-management/src/api/removeQuoteTemplateItems/removeQuoteTemplateItems.ts","/@dropins/storefront-quote-management/src/api/addQuoteTemplateLineItemNote/graphql/setQuoteTemplateLineItemNote.ts","/@dropins/storefront-quote-management/src/api/addQuoteTemplateLineItemNote/addQuoteTemplateLineItemNote.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 UPDATE_NEGOTIABLE_QUOTE_TEMPLATE_QUANTITIES_MUTATION = /* GraphQL */ `\n mutation UPDATE_NEGOTIABLE_QUOTE_TEMPLATE_QUANTITIES_MUTATION(\n $input: UpdateNegotiableQuoteTemplateQuantitiesInput!\n ) {\n updateNegotiableQuoteTemplateQuantities(input: $input) {\n quote_template {\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 { UPDATE_NEGOTIABLE_QUOTE_TEMPLATE_QUANTITIES_MUTATION } from './graphql/updateNegotiableQuoteTemplateQuantities';\nimport { transformQuoteTemplate } from '@/quote-management/data/transforms';\nimport { state } from '@/quote-management/lib/state';\nimport { events } from '@adobe-commerce/event-bus';\n\nexport interface NegotiableQuoteTemplateItemQuantityInput {\n itemId: string;\n quantity: number;\n minQty?: number;\n maxQty?: number;\n}\n\nexport interface UpdateQuoteTemplateItemQuantitiesParams {\n templateId: string;\n items: NegotiableQuoteTemplateItemQuantityInput[];\n}\n\nexport const updateQuoteTemplateItemQuantities = async (\n params: UpdateQuoteTemplateItemQuantitiesParams\n) => {\n if (!params.templateId) {\n throw new Error('Template ID is required');\n }\n\n if (!params.items || params.items.length === 0) {\n throw new Error('Items array is required and must not be empty');\n }\n\n if (!state.authenticated) {\n throw new Error('Unauthorized');\n }\n\n try {\n const results: any = await fetchGraphQl(\n UPDATE_NEGOTIABLE_QUOTE_TEMPLATE_QUANTITIES_MUTATION,\n {\n variables: {\n input: {\n template_id: params.templateId,\n items: params.items.map((item) => ({\n item_id: item.itemId,\n quantity: item.quantity,\n min_qty: item.minQty,\n max_qty: item.maxQty,\n })),\n },\n },\n }\n );\n\n if (\n !results?.data?.updateNegotiableQuoteTemplateQuantities?.quote_template\n ) {\n throw new Error('No quote template data received');\n }\n\n const transformedData = transformQuoteTemplate(\n results.data.updateNegotiableQuoteTemplateQuantities.quote_template\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 REMOVE_NEGOTIABLE_QUOTE_TEMPLATE_ITEMS_MUTATION = /* GraphQL */ `\n mutation REMOVE_NEGOTIABLE_QUOTE_TEMPLATE_ITEMS_MUTATION(\n $input: RemoveNegotiableQuoteTemplateItemsInput!\n ) {\n removeNegotiableQuoteTemplateItems(input: $input) {\n ...NegotiableQuoteTemplateFragment\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 { REMOVE_NEGOTIABLE_QUOTE_TEMPLATE_ITEMS_MUTATION } from './graphql/removeNegotiableQuoteTemplateItems';\nimport { transformQuoteTemplate } from '@/quote-management/data/transforms';\nimport { state } from '@/quote-management/lib/state';\nimport { events } from '@adobe-commerce/event-bus';\n\nexport interface RemoveQuoteTemplateItemsParams {\n templateId: string;\n itemUids: string[];\n}\n\nexport const removeQuoteTemplateItems = async (\n params: RemoveQuoteTemplateItemsParams\n) => {\n if (!params.templateId) {\n throw new Error('Template ID is required');\n }\n\n if (!params.itemUids || params.itemUids.length === 0) {\n throw new Error('Item UIDs array is required and must not be empty');\n }\n\n if (!state.authenticated) {\n throw new Error('Unauthorized');\n }\n\n try {\n const results: any = await fetchGraphQl(\n REMOVE_NEGOTIABLE_QUOTE_TEMPLATE_ITEMS_MUTATION,\n {\n variables: {\n input: {\n template_id: params.templateId,\n item_uids: params.itemUids,\n },\n },\n }\n );\n\n if (!results?.data?.removeNegotiableQuoteTemplateItems) {\n throw new Error('No quote template data received');\n }\n\n const transformedData = transformQuoteTemplate(\n results.data.removeNegotiableQuoteTemplateItems\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 SET_QUOTE_TEMPLATE_LINE_ITEM_NOTE_MUTATION = /* GraphQL */ `\n mutation SET_QUOTE_TEMPLATE_LINE_ITEM_NOTE_MUTATION(\n $input: QuoteTemplateLineItemNoteInput!\n ) {\n setQuoteTemplateLineItemNote(input: $input) {\n ...NegotiableQuoteTemplateFragment\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 { SET_QUOTE_TEMPLATE_LINE_ITEM_NOTE_MUTATION } from './graphql/setQuoteTemplateLineItemNote';\nimport { transformQuoteTemplate } from '@/quote-management/data/transforms';\nimport { state } from '@/quote-management/lib/state';\nimport { events } from '@adobe-commerce/event-bus';\n\nexport interface AddQuoteTemplateLineItemNoteParams {\n templateId: string;\n itemId: string;\n note?: string;\n}\n\nexport const addQuoteTemplateLineItemNote = async (\n params: AddQuoteTemplateLineItemNoteParams\n) => {\n if (!params.templateId) {\n throw new Error('Template ID is required');\n }\n\n if (!params.itemId) {\n throw new Error('Item 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 SET_QUOTE_TEMPLATE_LINE_ITEM_NOTE_MUTATION,\n {\n variables: {\n input: {\n templateId: params.templateId,\n item_uid: params.itemId,\n note: params.note,\n },\n },\n }\n );\n\n if (!results?.data?.setQuoteTemplateLineItemNote) {\n throw new Error('No quote template data received');\n }\n\n const transformedData = transformQuoteTemplate(\n results.data.setQuoteTemplateLineItemNote\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":["UPDATE_NEGOTIABLE_QUOTE_TEMPLATE_QUANTITIES_MUTATION","NEGOTIABLE_QUOTE_TEMPLATE_FRAGMENT","updateQuoteTemplateItemQuantities","params","state","results","fetchGraphQl","item","_b","_a","transformedData","transformQuoteTemplate","events","error","REMOVE_NEGOTIABLE_QUOTE_TEMPLATE_ITEMS_MUTATION","removeQuoteTemplateItems","SET_QUOTE_TEMPLATE_LINE_ITEM_NOTE_MUTATION","addQuoteTemplateLineItemNote"],"mappings":"wOAWO,MAAMA,EAAqE;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,IAU9EC,CAAkC;AAAA,ECMzBC,EAAoC,MAC/CC,GACG,SACH,GAAI,CAACA,EAAO,WACV,MAAM,IAAI,MAAM,yBAAyB,EAG3C,GAAI,CAACA,EAAO,OAASA,EAAO,MAAM,SAAW,EAC3C,MAAM,IAAI,MAAM,+CAA+C,EAGjE,GAAI,CAACC,EAAM,cACT,MAAM,IAAI,MAAM,cAAc,EAGhC,GAAI,CACF,MAAMC,EAAe,MAAMC,EACzBN,EACA,CACE,UAAW,CACT,MAAO,CACL,YAAaG,EAAO,WACpB,MAAOA,EAAO,MAAM,IAAKI,IAAU,CACjC,QAASA,EAAK,OACd,SAAUA,EAAK,SACf,QAASA,EAAK,OACd,QAASA,EAAK,MAAA,EACd,CAAA,CACJ,CACF,CACF,EAGF,GACE,GAACC,GAAAC,EAAAJ,GAAA,YAAAA,EAAS,OAAT,YAAAI,EAAe,0CAAf,MAAAD,EAAwD,gBAEzD,MAAM,IAAI,MAAM,iCAAiC,EAGnD,MAAME,EAAkBC,EACtBN,EAAQ,KAAK,wCAAwC,cAAA,EAGvD,GAAI,CAACK,EACH,MAAM,IAAI,MAAM,yCAAyC,EAG3D,OAAAE,EAAO,KAAK,uCAAwC,CAClD,cAAeF,EACf,YAAaN,EAAM,WAAA,CACpB,EAEMM,CACT,OAASG,EAAO,CACd,OAAO,QAAQ,OAAOA,CAAK,CAC7B,CACF,ECxEaC,EA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A,YAAAA,EAAS,OAAT,MAAAI,EAAe,8BAClB,MAAM,IAAI,MAAM,iCAAiC,EAGnD,MAAMC,EAAkBC,EACtBN,EAAQ,KAAK,4BAAA,EAGf,GAAI,CAACK,EACH,MAAM,IAAI,MAAM,yCAAyC,EAG3D,OAAAE,EAAO,KAAK,uCAAwC,CAClD,cAAeF,EACf,YAAaN,EAAM,WAAA,CACpB,EAEMM,CACT,OAASG,EAAO,CACd,OAAO,QAAQ,OAAOA,CAAK,CAC7B,CACF"}
@@ -0,0 +1,4 @@
1
+ /*! Copyright 2025 Adobe
2
+ All Rights Reserved. */
3
+ import{getGlobalLocale as n}from"@dropins/tools/lib.js";function a(){try{return Intl.DateTimeFormat().resolvedOptions().timeZone}catch(e){return console.warn("Failed to detect user timezone, falling back to UTC:",e),"UTC"}}function o(e){const t=new Date(e);return!isNaN(t.getTime())}function c(e,t="short"){if(!o(e))return"–";const r=n()||"en-US";return t==="short"?new Date(e).toLocaleDateString(r,{year:"numeric",month:"numeric",day:"numeric"}):new Date(e).toLocaleDateString(r,{year:"numeric",month:"long",day:"numeric",hour:"2-digit",minute:"2-digit",second:"2-digit",hour12:!0})}export{c as f,a as g};
4
+ //# sourceMappingURL=dateUtils.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"dateUtils.js","sources":["/@dropins/storefront-quote-management/src/utils/dateUtils.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 { getGlobalLocale } from \"@adobe-commerce/elsie/lib\";\n\n/**\n * Gets the user's timezone with fallback to UTC if detection fails\n * @returns The user's timezone string (e.g., 'America/New_York') or 'UTC' as fallback\n */\nexport function getUserTimezone(): string {\n try {\n return Intl.DateTimeFormat().resolvedOptions().timeZone;\n } catch (error) {\n console.warn('Failed to detect user timezone, falling back to UTC:', error);\n return 'UTC';\n }\n}\n\n/**\n * Checks if a date string is a valid date\n * @param dateString - The date string to check\n * @returns True if the date string is a valid date, false otherwise\n */\nexport function isValidDate(dateString: string): boolean {\n const date = new Date(dateString);\n return !isNaN(date.getTime());\n}\n\n/**\n * Formats a date string to locale date string, returning \"–\" for invalid dates\n * @param dateString - The date string to format\n * @returns Formatted date string or \"–\" for invalid dates\n */\nexport function formattedDate(dateString: string, type: 'short' | 'long' = 'short'): string {\n if (!isValidDate(dateString)) {\n return '–';\n }\n\n const locale = getGlobalLocale() || 'en-US';\n\n if (type === 'short') {\n return new Date(dateString).toLocaleDateString(locale, {\n year: 'numeric',\n month: 'numeric',\n day: 'numeric',\n });\n }\n\n return new Date(dateString).toLocaleDateString(locale, {\n year: 'numeric',\n month: 'long',\n day: 'numeric',\n hour: '2-digit',\n minute: '2-digit',\n second: '2-digit',\n hour12: true,\n });\n}\n"],"names":["getUserTimezone","error","isValidDate","dateString","date","formattedDate","type","locale","getGlobalLocale"],"mappings":"wDAeO,SAASA,GAA0B,CACxC,GAAI,CACF,OAAO,KAAK,iBAAiB,gBAAA,EAAkB,QACjD,OAASC,EAAO,CACd,eAAQ,KAAK,uDAAwDA,CAAK,EACnE,KACT,CACF,CAOO,SAASC,EAAYC,EAA6B,CACvD,MAAMC,EAAO,IAAI,KAAKD,CAAU,EAChC,MAAO,CAAC,MAAMC,EAAK,SAAS,CAC9B,CAOO,SAASC,EAAcF,EAAoBG,EAAyB,QAAiB,CAC1F,GAAI,CAACJ,EAAYC,CAAU,EACzB,MAAO,IAGT,MAAMI,EAASC,KAAqB,QAEpC,OAAIF,IAAS,QACJ,IAAI,KAAKH,CAAU,EAAE,mBAAmBI,EAAQ,CACrD,KAAM,UACN,MAAO,UACP,IAAK,SAAA,CACN,EAGI,IAAI,KAAKJ,CAAU,EAAE,mBAAmBI,EAAQ,CACrD,KAAM,UACN,MAAO,OACP,IAAK,UACL,KAAM,UACN,OAAQ,UACR,OAAQ,UACR,OAAQ,EAAA,CACT,CACH"}
@@ -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 m=(o=e==null?void 0:e.data)==null?void 0:o.deleteNegotiableQuotes;if(!m)throw new Error("No delete result returned");const i={resultStatus:m.result_status,operationResults:(m.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}))})},d=i.operationResults.filter(r=>r.__typename==="NegotiableQuoteUidOperationSuccess").map(r=>r.quoteUid);return d.length>0&&p.emit("quote-management/negotiable-quote-deleted",{deletedQuoteUids:d,resultStatus:i.resultStatus}),i}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(m=>{var r,t;const{errors:i}=m;if(i){const n=i.map(u=>u.message).join("; ");throw new Error(`Failed to send quote for review: ${n}`)}const d=q((t=(r=m.data)==null?void 0:r.sendNegotiableQuoteForReview)==null?void 0:t.quote);if(!d)throw new Error("Failed to transform quote data: Invalid response structure");return p.emit("quote-management/quote-sent-for-review",{quote:d,input:{quoteUid:a,comment:o,attachments:e}}),d})},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(n=>n==null?void 0:n.message).filter(Boolean).join("; ");throw new Error(t||"Failed to close negotiable quotes")}const m=(o=e==null?void 0:e.data)==null?void 0:o.closeNegotiableQuotes;if(!m)throw new Error("No close result returned");const i={resultStatus:m.result_status,operationResults:(m.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}))})},d=i.operationResults.filter(t=>t.__typename==="CloseNegotiableQuoteOperationFailure").map(t=>t);if(d.length>0){const t=d.map(n=>n.errors&&n.errors.length>0?n.errors.map(u=>u.message||`Failed to close quote ${n.quoteUid}`).join(", "):`Failed to close quote ${n.quoteUid}`).join("; ");throw new Error(t)}const r=i.operationResults.filter(t=>t.__typename==="NegotiableQuoteUidOperationSuccess").map(t=>t.quoteUid);return r.length>0&&p.emit("quote-management/negotiable-quote-closed",{closedQuoteUids:r,resultStatus:i.resultStatus}),i}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(m=>{var r,t;const{errors:i}=m;if(i){const n=i.map(u=>u.message).join("; ");throw new Error(`Failed to rename quote: ${n}`)}const d=q((t=(r=m.data)==null?void 0:r.renameNegotiableQuote)==null?void 0:t.quote);if(!d)throw new Error("Failed to transform quote data: Invalid response structure");return p.emit("quote-management/quote-renamed",{quote:d,input:{quoteUid:a,quoteName:o,quoteComment:e}}),d})},O=`
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,hasOutOfStockItems:e}=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(O,{variables:{quoteUid:a,duplicatedQuoteUid:o}}).then(c=>{var d,r;const{errors:m}=c;if(m){const t=m.map(n=>n.message).join("; ");throw new Error(`Failed to duplicate quote: ${t}`)}const i=q((r=(d=c.data)==null?void 0:d.duplicateNegotiableQuote)==null?void 0:r.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},hasOutOfStockItems:e}),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 hasOutOfStockItems?: boolean;\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, hasOutOfStockItems } = 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 hasOutOfStockItems,\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_NEGOTIABLE_QUOTE_MUTATION","duplicateQuote","duplicatedQuoteUid","hasOutOfStockItems"],"mappings":"gSAEO,MAAMA,EAAmB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,MAW1BC,CAAyB;AAAA,ECElBC,EAAe,MAAOC,GAAoB,OACnD,GAAI,CAACC,EAAM,cACP,OAAO,QAAQ,OAAO,IAAI,MAAM,cAAc,CAAC,EAGnD,GAAI,CAACA,EAAM,YAAY,UACnB,OAAO,QAAQ,OAAO,IAAI,MAAM,cAAc,CAAC,EAGnD,GAAI,CACA,MAAMC,EAAe,MAAMC,EAAaN,EAAkB,CACtD,UAAW,CACP,QAAAG,CAAA,CACJ,CACH,EAEKI,EAAmBC,GAAeC,EAAAJ,GAAA,YAAAA,EAAS,OAAT,YAAAI,EAAe,eAAe,EAEtE,GAAI,CAACF,EACD,MAAM,IAAI,MAAM,gCAAgC,EAGpD,OAAAG,EAAO,KAAK,8BAA+B,CACvC,MAAOH,EACP,YAAaH,EAAM,WAAA,CACtB,EAEMG,CACX,OAASI,EAAO,CACZ,OAAO,QAAQ,OAAOA,CAAK,CAC/B,CACJ,ECrCaC,EAAwB;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;A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CAEzC,GAAI,CAACxB,EAAM,cACT,MAAM,IAAI,MAAM,cAAc,EAGhC,KAAM,CAAE,SAAAyB,EAAU,mBAAAuB,EAAoB,mBAAAC,CAAA,EAAuBzB,EAE7D,GAAI,CAACC,GAAY,CAACA,EAAS,OACzB,MAAM,IAAI,MAAM,uBAAuB,EAGzC,GAAI,CAACuB,GAAsB,CAACA,EAAmB,OAC7C,MAAM,IAAI,MAAM,kCAAkC,EAGpD,OAAO9C,EAAa4C,EAAqC,CACvD,UAAW,CAAE,SAAArB,EAAU,mBAAAuB,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,EACnB,mBAAAC,CAAA,CACD,EAEMpB,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,52 @@
1
+ /*! Copyright 2025 Adobe
2
+ All Rights Reserved. */
3
+ import{events as s}from"@dropins/tools/event-bus.js";import{t as n}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
+ prices {
30
+ grand_total {
31
+ currency
32
+ value
33
+ }
34
+ }
35
+ }
36
+ page_info {
37
+ current_page
38
+ page_size
39
+ total_pages
40
+ }
41
+ total_count
42
+ sort_fields {
43
+ default
44
+ options {
45
+ label
46
+ value
47
+ }
48
+ }
49
+ }
50
+ }
51
+ `;var u=(e=>(e.ACTIVE="ACTIVE",e.IN_REVIEW="IN_REVIEW",e.INACTIVE="INACTIVE",e))(u||{}),p=(e=>(e.NAME="NAME",e.CREATED_AT="CREATED_AT",e.UPDATED_AT="UPDATED_AT",e))(p||{}),E=(e=>(e.ASC="ASC",e.DESC="DESC",e))(E||{});const c=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=n(t.data.negotiableQuoteTemplates);if(!a)throw new Error("Failed to transform quote templates data");return s.emit("quote-management/quote-templates-data",{quoteTemplates:a,permissions:o.permissions}),a}catch(t){return Promise.reject(t)}};export{u as Q,E as S,p as a,c as g};
52
+ //# 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 prices {\n grand_total {\n currency\n value\n }\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;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,d 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;AAA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CAAK,CAC7B,CACF"}
@@ -0,0 +1,52 @@
1
+ /*! Copyright 2025 Adobe
2
+ All Rights Reserved. */
3
+ import{events as l}from"@dropins/tools/event-bus.js";import{a as p}from"./transform-quote-template.js";import{s as r}from"./state.js";import{N as u}from"./NegotiableQuoteTemplateFragment.js";import{f as d}from"./transform-quote.js";const s=`
4
+ mutation SEND_QUOTE_TEMPLATE_FOR_REVIEW_MUTATION(
5
+ $templateId: ID!
6
+ $comment: String
7
+ $name: String
8
+ $referenceDocumentLinks: [NegotiableQuoteTemplateReferenceDocumentLinkInput]
9
+ $attachments: [NegotiableQuoteCommentAttachmentInput]
10
+ ) {
11
+ submitNegotiableQuoteTemplateForReview(input: { template_id: $templateId, name: $name, comment: $comment, reference_document_links: $referenceDocumentLinks, attachments: $attachments }) {
12
+ ...NegotiableQuoteTemplateFragment
13
+ }
14
+ }
15
+ ${u}
16
+ `,q=async t=>{var o,e,a;if(!t.templateId)throw new Error("Template ID is required");if(!r.authenticated)throw new Error("Unauthorized");try{const n=(o=t.referenceDocumentLinks)==null?void 0:o.map(m=>({link_id:m.uid,document_name:m.name,document_identifier:m.identifier,reference_document_url:m.url})),i=(e=t.attachments)!=null&&e.length?t.attachments.map(m=>({key:m.key})):void 0,c=await d(s,{variables:{templateId:t.templateId,name:t.name,comment:t.comment||void 0,referenceDocumentLinks:n,attachments:i}});if(!((a=c==null?void 0:c.data)!=null&&a.submitNegotiableQuoteTemplateForReview))throw new Error("No quote template data received");const T=p(c.data.submitNegotiableQuoteTemplateForReview);if(!T)throw new Error("Failed to transform quote template data");return l.emit("quote-management/quote-template-data",{quoteTemplate:T,permissions:r.permissions}),T}catch(n){return Promise.reject(n)}},E=`
17
+ mutation ACCEPT_QUOTE_TEMPLATE_MUTATION($templateId: ID!) {
18
+ acceptNegotiableQuoteTemplate(input: { template_id: $templateId }) {
19
+ ...NegotiableQuoteTemplateFragment
20
+ }
21
+ }
22
+
23
+ ${u}
24
+ `,b=async t=>{var o;if(!t.templateId)throw new Error("Template ID is required");if(!r.authenticated)throw new Error("Unauthorized");try{const e=await d(E,{variables:{templateId:t.templateId}});if(!((o=e==null?void 0:e.data)!=null&&o.acceptNegotiableQuoteTemplate))throw new Error("No quote template data received");const a=p(e.data.acceptNegotiableQuoteTemplate);if(!a)throw new Error("Failed to transform quote template data");return l.emit("quote-management/quote-template-data",{quoteTemplate:a,permissions:r.permissions}),a}catch(e){return Promise.reject(e)}},I=`
25
+ mutation CANCEL_QUOTE_TEMPLATE_MUTATION(
26
+ $templateId: ID!
27
+ $comment: String
28
+ ) {
29
+ cancelNegotiableQuoteTemplate(
30
+ input: {
31
+ template_id: $templateId
32
+ cancellation_comment: $comment
33
+ }
34
+ ) {
35
+ ...NegotiableQuoteTemplateFragment
36
+ }
37
+ }
38
+ ${u}
39
+ `,A=async t=>{var o;if(!t.templateId)throw new Error("Template ID is required");if(!r.authenticated)throw new Error("Unauthorized");try{const e=await d(I,{variables:{templateId:t.templateId,comment:t.comment}});if(!((o=e==null?void 0:e.data)!=null&&o.cancelNegotiableQuoteTemplate))throw new Error("No quote template data received");const a=p(e.data.cancelNegotiableQuoteTemplate);if(!a)throw new Error("Failed to transform quote template data");return l.emit("quote-management/quote-template-data",{quoteTemplate:a,permissions:r.permissions}),a}catch(e){return Promise.reject(e)}},_=`
40
+ mutation DELETE_QUOTE_TEMPLATE_MUTATION($templateId: ID!) {
41
+ deleteNegotiableQuoteTemplate(input: { template_id: $templateId })
42
+ }
43
+ `,O=async t=>{var o;if(!t.templateId)throw new Error("Template ID is required");if(!r.authenticated)throw new Error("Unauthorized");try{const e=await d(_,{variables:{templateId:t.templateId}});if(e!=null&&e.errors&&e.errors.length>0){const n=e.errors.map(i=>i==null?void 0:i.message).filter(Boolean).join("; ");throw new Error(n||"Failed to delete quote template")}if(!((o=e==null?void 0:e.data)==null?void 0:o.deleteNegotiableQuoteTemplate))throw new Error("Failed to delete quote template");return l.emit("quote-management/quote-template-deleted",{templateId:t.templateId}),{templateId:t.templateId}}catch(e){return Promise.reject(e)}},w=`
44
+ mutation OPEN_QUOTE_TEMPLATE_MUTATION($templateId: ID!) {
45
+ openNegotiableQuoteTemplate(input: { template_id: $templateId }) {
46
+ ...NegotiableQuoteTemplateFragment
47
+ }
48
+ }
49
+
50
+ ${u}
51
+ `,U=async t=>{var o;if(!t.templateId)throw new Error("Template ID is required");if(!r.authenticated)throw new Error("Unauthorized");try{const e=await d(w,{variables:{templateId:t.templateId}});if(!((o=e==null?void 0:e.data)!=null&&o.openNegotiableQuoteTemplate))throw new Error("No quote template data received");const a=p(e.data.openNegotiableQuoteTemplate);if(!a)throw new Error("Failed to transform quote template data");return l.emit("quote-management/quote-template-data",{quoteTemplate:a,permissions:r.permissions}),a}catch(e){return Promise.reject(e)}};export{b as a,A as c,O as d,U as o,q as s};
52
+ //# 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/cancelQuoteTemplate/graphql/cancelQuoteTemplate.ts","/@dropins/storefront-quote-management/src/api/cancelQuoteTemplate/cancelQuoteTemplate.ts","/@dropins/storefront-quote-management/src/api/deleteQuoteTemplate/graphql/deleteQuoteTemplate.ts","/@dropins/storefront-quote-management/src/api/deleteQuoteTemplate/deleteQuoteTemplate.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 $referenceDocumentLinks: [NegotiableQuoteTemplateReferenceDocumentLinkInput]\n $attachments: [NegotiableQuoteCommentAttachmentInput]\n ) {\n submitNegotiableQuoteTemplateForReview(input: { template_id: $templateId, name: $name, comment: $comment, reference_document_links: $referenceDocumentLinks, attachments: $attachments }) {\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 ReferenceDocumentLinkInput {\n uid?: string;\n name: string;\n identifier?: string;\n url: string;\n}\n\nexport interface SendQuoteTemplateForReviewParams {\n templateId: string;\n name?: string;\n comment?: string;\n referenceDocumentLinks?: ReferenceDocumentLinkInput[];\n attachments?: { key: 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 // Transform reference document links from camelCase to snake_case for GraphQL\n const referenceDocumentLinks = params.referenceDocumentLinks?.map((link) => ({\n link_id: link.uid,\n document_name: link.name,\n document_identifier: link.identifier,\n reference_document_url: link.url,\n }));\n\n // Format attachments for GraphQL (separate field, not nested in comment)\n const attachments = params.attachments?.length \n ? params.attachments.map(att => ({ key: att.key }))\n : undefined;\n\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 || undefined,\n referenceDocumentLinks,\n attachments,\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 CANCEL_QUOTE_TEMPLATE_MUTATION = /* GraphQL */ `\n mutation CANCEL_QUOTE_TEMPLATE_MUTATION(\n $templateId: ID!\n $comment: String\n ) {\n cancelNegotiableQuoteTemplate(\n input: {\n template_id: $templateId\n cancellation_comment: $comment\n }\n ) {\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 { CANCEL_QUOTE_TEMPLATE_MUTATION } from './graphql/cancelQuoteTemplate';\nimport { transformQuoteTemplate } from '@/quote-management/data/transforms';\nimport { state } from '@/quote-management/lib/state';\nimport { events } from '@adobe-commerce/event-bus';\n\nexport interface CancelQuoteTemplateParams {\n templateId: string;\n comment?: string;\n}\n\nexport const cancelQuoteTemplate = async (\n params: CancelQuoteTemplateParams\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(CANCEL_QUOTE_TEMPLATE_MUTATION, {\n variables: { templateId: params.templateId, comment: params.comment },\n });\n\n if (!results?.data?.cancelNegotiableQuoteTemplate) {\n throw new Error('No quote template data received');\n }\n\n const transformedData = transformQuoteTemplate(\n results.data.cancelNegotiableQuoteTemplate\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\nexport const DELETE_QUOTE_TEMPLATE_MUTATION = /* GraphQL */ `\n mutation DELETE_QUOTE_TEMPLATE_MUTATION($templateId: ID!) {\n deleteNegotiableQuoteTemplate(input: { template_id: $templateId })\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 { DELETE_QUOTE_TEMPLATE_MUTATION } from './graphql/deleteQuoteTemplate';\nimport { state } from '@/quote-management/lib/state';\nimport { events } from '@adobe-commerce/event-bus';\n\nexport interface DeleteQuoteTemplateParams {\n templateId: string;\n}\n\nexport const deleteQuoteTemplate = async (\n params: DeleteQuoteTemplateParams\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(DELETE_QUOTE_TEMPLATE_MUTATION, {\n variables: { templateId: params.templateId },\n });\n\n if (results?.errors && results.errors.length > 0) {\n const errorMessages = results.errors\n .map((e: any) => e?.message)\n .filter(Boolean)\n .join('; ');\n throw new Error(errorMessages || 'Failed to delete quote template');\n }\n\n const deleted = results?.data?.deleteNegotiableQuoteTemplate;\n\n if (!deleted) {\n throw new Error('Failed to delete quote template');\n }\n\n events.emit('quote-management/quote-template-deleted', {\n templateId: params.templateId,\n });\n\n return { templateId: params.templateId };\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","referenceDocumentLinks","_a","link","attachments","_b","att","results","fetchGraphQl","_c","transformedData","transformQuoteTemplate","events","error","ACCEPT_QUOTE_TEMPLATE_MUTATION","acceptQuoteTemplate","CANCEL_QUOTE_TEMPLATE_MUTATION","cancelQuoteTemplate","DELETE_QUOTE_TEMPLATE_MUTATION","deleteQuoteTemplate","errorMessages","e","OPEN_QUOTE_TEMPLATE_MUTATION","openQuoteTemplate"],"mappings":"wOAWO,MAAMA,EAAwD;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,IAYjEC,CAAkC;AAAA,ECOzBC,EAA6B,MACxCC,GACG,WACH,GAAI,CAACA,EAAO,WACV,MAAM,IAAI,MAAM,yBAAyB,EAG3C,GAAI,CAACC,EAAM,cACT,MAAM,IAAI,MA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