@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{jsxs as m,jsx as t,Fragment as ie}from"@dropins/tools/preact-jsx-runtime.js";import{useState as d,useEffect as ce,createPortal as le}from"@dropins/tools/preact-compat.js";import{classes as se,Slot as s}from"@dropins/tools/lib.js";import{Table as de,IllustratedMessage as ue,Picker as ge,Pagination as me,InLineAlert as R,Icon as A,Button as j,Price as pe}from"@dropins/tools/components.js";import{events as Qe}from"@dropins/tools/event-bus.js";/* empty css */import"@dropins/tools/preact.js";import"@dropins/tools/preact-hooks.js";import{f as D}from"../chunks/dateUtils.js";import{useText as $}from"@dropins/tools/i18n.js";import{C as he}from"../chunks/ConfirmationModal.js";/* empty css *//* empty css */import{g as W}from"../chunks/transform-quote.js";import"../chunks/state.js";import{g as fe}from"../chunks/getQuoteTemplates.js";import{g as Me}from"../chunks/generateQuoteFromTemplate.js";import"@dropins/tools/fetch-graphql.js";import"../chunks/transform-quote-template.js";const be=({rowData:p=[],loading:Q=!1,className:x,emptyStateMessage:S,showItemRange:z=!0,itemRangeMessage:u,showPageSizePicker:h=!0,pageSizePickerMessage:g,showPagination:i=!0,paginationMessage:P,...l})=>{const o=$({name:"QuoteManagement.QuoteTemplatesListTable.name",state:"QuoteManagement.QuoteTemplatesListTable.state",status:"QuoteManagement.QuoteTemplatesListTable.status",validUntil:"QuoteManagement.QuoteTemplatesListTable.validUntil",minQuoteTotal:"QuoteManagement.QuoteTemplatesListTable.minQuoteTotal",ordersPlaced:"QuoteManagement.QuoteTemplatesListTable.ordersPlaced",lastOrdered:"QuoteManagement.QuoteTemplatesListTable.lastOrdered",actions:"QuoteManagement.QuoteTemplatesListTable.actions"}),y=[{key:"name",label:o.name},{key:"state",label:o.state},{key:"status",label:o.status},{key:"validUntil",label:o.validUntil},{key:"minQuoteTotal",label:o.minQuoteTotal},{key:"ordersPlaced",label:o.ordersPlaced},{key:"lastOrdered",label:o.lastOrdered},{key:"actions",label:o.actions}],q=Q||p.length>0,f=!Q&&p.length===0&&S,M=z&&u,b=h&&g,T=i&&P,v=M||b||T;return m("div",{...l,className:se(["quote-management-quote-templates-list-table",x]),children:[q&&t(de,{columns:y,rowData:p,loading:Q,mobileLayout:"none",className:"quote-management-quote-templates-list-table__table"}),f&&t("div",{className:"quote-templates-list-table__empty-state",children:S}),v&&m("div",{className:"quote-templates-list-table__footer",children:[t("div",{className:"quote-templates-list-table__item-range",children:M&&u}),t("div",{className:"quote-templates-list-table__pagination",children:T&&P}),t("div",{className:"quote-templates-list-table__page-size-picker",children:b&&g})]})]})},Ue=({pageSize:p,showItemRange:Q=!0,showPageSizePicker:x=!0,showPagination:S=!0,onViewQuoteTemplate:z,onGenerateQuoteFromTemplate:u,onPageSizeChange:h,onPageChange:g,slots:i,...P})=>{const l=$({view:"QuoteManagement.QuoteTemplatesListTable.view",generateQuote:"NegotiableQuoteTemplate.Manage.actionButtons.generateQuote",generateQuoteModalMessage:"NegotiableQuoteTemplate.Manage.confirmationModal.generateQuote.message",generateQuoteModalCancel:"NegotiableQuoteTemplate.Manage.confirmationModal.cancel",generateQuoteModalConfirm:"NegotiableQuoteTemplate.Manage.confirmationModal.generateQuote.confirm",generateQuoteModalConfirmLoading:"NegotiableQuoteTemplate.Manage.confirmationModal.generateQuote.confirmLoading",generateQuoteModalSuccessHeading:"NegotiableQuoteTemplate.Manage.confirmationModal.generateQuote.successHeading",generateQuoteSuccessMessage:"NegotiableQuoteTemplate.Manage.confirmationModal.generateQuote.successDescription",generateQuoteModalErrorHeading:"NegotiableQuoteTemplate.Manage.confirmationModal.generateQuote.errorHeading",generateQuoteErrorFallback:"NegotiableQuoteTemplate.Manage.confirmationModal.generateQuote.errorFallback"}),[o,y]=d(null),[q,f]=d(!0),[M,b]=d(!1),[T,v]=d(!1),[I,O]=d(null),[_,N]=d(""),[w,k]=d(""),J=W()[0],[E,K]=d(p||J),[G,F]=d(1);ce(()=>{const n=async()=>{try{f(!0);const c=await fe({pageSize:E,currentPage:G});y(c)}catch(c){console.error("Failed to fetch quote templates:",c)}finally{f(!1)}},e=Qe.on("authenticated",c=>{c?n():(y(null),f(!1))},{eager:!0});return()=>{e==null||e.off()}},[E,G]);const U=n=>{K(n),F(1),h==null||h(n)},H=n=>{F(n),g==null||g(n)},X=n=>{const e=n.target,c=e==null?void 0:e.value;c&&U(Number(c))},Y=(n,e)=>{O({id:n,name:e}),N(""),k(""),b(!0)},Z=async n=>{v(!0),N(""),k("");try{const e=await Me({templateId:n.id});N(l.generateQuoteSuccessMessage),u==null||u(n.id,n.name,e.quoteId)}catch(e){console.error("Failed to generate quote from template:",e);const c=e instanceof Error?e.message:l.generateQuoteErrorFallback;k(c)}finally{v(!1)}},V=()=>{b(!1),O(null),N(""),k("")},ee=(n,e,c)=>n.filter(a=>a==null?void 0:a.uid).map(a=>{var B;return{id:a.id,name:t(s,{name:"Name",slot:e==null?void 0:e.Name,context:{template:a},children:t("span",{children:a.name})}),state:t(s,{name:"State",slot:e==null?void 0:e.State,context:{template:a},children:t("span",{style:{textTransform:"capitalize"},children:((B=a.state)==null?void 0:B.replace(/_/g," "))||"-"})}),status:t(s,{name:"Status",slot:e==null?void 0:e.Status,context:{template:a},children:t("span",{children:a.status})}),validUntil:t(s,{name:"ValidUntil",slot:e==null?void 0:e.ValidUntil,context:{template:a},children:t("span",{children:D(a.expirationDate,"short")})}),minQuoteTotal:t(s,{name:"MinQuoteTotal",slot:e==null?void 0:e.MinQuoteTotal,context:{template:a},children:t(pe,{amount:a.prices.minNegotiatedGrandTotal.value,currency:a.prices.minNegotiatedGrandTotal.currency})}),ordersPlaced:t(s,{name:"OrdersPlaced",slot:e==null?void 0:e.OrdersPlaced,context:{template:a},children:t("span",{children:a.ordersPlaced})}),lastOrdered:t(s,{name:"LastOrdered",slot:e==null?void 0:e.LastOrdered,context:{template:a},children:t("span",{children:D(a.lastOrderedAt,"short")})}),actions:m(s,{name:"Actions",slot:e==null?void 0:e.Actions,context:{template:a,onViewQuoteTemplate:c},className:"quote-management-quote-templates-list-table__actions-cell",children:[t(j,{variant:"tertiary",size:"medium",onClick:()=>c==null?void 0:c(a.id,a.name,a.status),children:l.view}),a.canGenerateQuoteFromTemplate&&t(j,{variant:"primary",size:"medium",onClick:()=>Y(a.id,a.name),"data-testid":`generate-quote-button-${a.id}`,children:l.generateQuote})]})}}),te=o!=null&&o.items?ee(o.items,i,z):[],r=o!=null&&o.paginationInfo?{...o.paginationInfo,pageSizeOptions:W()}:void 0,C=!!r,ae=t(s,{name:"EmptyTemplates",slot:i==null?void 0:i.EmptyTemplates,context:{templatesData:o},children:t(ue,{heading:"No Quote Templates Found"})}),ne=r?t(s,{name:"ItemRange",slot:i==null?void 0:i.ItemRange,context:r,children:m("span",{children:["Items ",r.startItem," to ",r.endItem," of"," ",r.totalCount," total"]})}):void 0,oe=r&&r.pageSizeOptions?m(s,{name:"PageSizePicker",slot:i==null?void 0:i.PageSizePicker,context:{pageSize:r.pageSize,pageSizeOptions:r.pageSizeOptions,onPageSizeChange:U},children:[t("span",{children:"Show "}),t(ge,{variant:"primary",size:"medium",value:String(r.pageSize),options:r.pageSizeOptions.map(n=>({value:String(n),text:String(n)})),handleSelect:X}),t("span",{children:" per page"})]}):void 0,re=r?t(s,{name:"Pagination",slot:i==null?void 0:i.Pagination,context:{currentPage:r.currentPage,totalPages:r.totalPages,onChange:H},children:t(me,{currentPage:r.currentPage,totalPages:r.totalPages,onChange:H})}):void 0;let L=null;return _?L=t(R,{type:"success",variant:"primary",icon:t(A,{source:"CheckWithCircle"}),heading:l.generateQuoteModalSuccessHeading,description:_,"data-testid":"generate-quote-success-banner"}):w&&(L=t(R,{type:"error",variant:"primary",icon:t(A,{source:"WarningFilled"}),heading:l.generateQuoteModalErrorHeading,description:w,"data-testid":"generate-quote-error-banner"})),m(ie,{children:[t(be,{rowData:te,loading:q,className:P.className,emptyStateMessage:ae,showItemRange:Q&&C,itemRangeMessage:ne,showPageSizePicker:x&&C,pageSizePickerMessage:oe,showPagination:S&&C,paginationMessage:re}),M&&le(t(he,{open:M,title:l.generateQuote,message:l.generateQuoteModalMessage,cancelLabel:l.generateQuoteModalCancel,confirmLabel:T?l.generateQuoteModalConfirmLoading:l.generateQuoteModalConfirm,onCancel:V,onConfirm:T||!I?void 0:()=>Z(I),showCloseButton:!L,confirmationBanner:L,"data-testid":"generate-quote-confirmation-modal"}),document.body)]})};export{Ue as QuoteTemplatesListTable,Ue as default};
4
+ //# sourceMappingURL=QuoteTemplatesListTable.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"QuoteTemplatesListTable.js","sources":["/@dropins/storefront-quote-management/src/components/QuoteTemplatesListTable/QuoteTemplatesListTable.tsx","/@dropins/storefront-quote-management/src/containers/QuoteTemplatesListTable/QuoteTemplatesListTable.tsx"],"sourcesContent":["/********************************************************************\n * Copyright 2025 Adobe\n * All Rights Reserved.\n *\n * NOTICE: Adobe permits you to use, modify, and distribute this\n * file in accordance with the terms of the Adobe license agreement\n * accompanying it.\n *******************************************************************/\n\nimport { FunctionComponent, VNode } from 'preact';\nimport { HTMLAttributes } from 'preact/compat';\nimport { classes } from '@adobe-commerce/elsie/lib';\nimport { Table } from '@adobe-commerce/elsie/components';\nimport { useText } from '@adobe-commerce/elsie/i18n';\nimport '@/quote-management/components/QuoteTemplatesListTable/QuoteTemplatesListTable.css';\n\ntype Column = {\n key: string;\n label: string;\n};\n\nexport interface QuoteTemplatesListTableProps\n extends Omit<HTMLAttributes<HTMLDivElement>, 'loading' | 'children'> {\n rowData: QuoteTemplateRowData[];\n loading?: boolean;\n className?: string;\n emptyStateMessage?: VNode;\n showItemRange?: boolean;\n itemRangeMessage?: VNode;\n showPageSizePicker?: boolean;\n pageSizePickerMessage?: VNode;\n showPagination?: boolean;\n paginationMessage?: VNode;\n}\n\nexport type QuoteTemplateRowData = {\n id: string;\n name: VNode;\n state: VNode;\n status: VNode;\n validUntil: VNode;\n minQuoteTotal: VNode;\n ordersPlaced: VNode;\n lastOrdered: VNode;\n actions: VNode;\n [key: string]: VNode | string | number | undefined;\n};\n\nexport const QuoteTemplatesListTable: FunctionComponent<\n QuoteTemplatesListTableProps\n> = ({\n rowData = [],\n loading = false,\n className,\n emptyStateMessage,\n showItemRange = true,\n itemRangeMessage,\n showPageSizePicker = true,\n pageSizePickerMessage,\n showPagination = true,\n paginationMessage,\n ...props\n}) => {\n const dictionary = useText({\n name: 'QuoteManagement.QuoteTemplatesListTable.name',\n state: 'QuoteManagement.QuoteTemplatesListTable.state',\n status: 'QuoteManagement.QuoteTemplatesListTable.status',\n validUntil: 'QuoteManagement.QuoteTemplatesListTable.validUntil',\n minQuoteTotal: 'QuoteManagement.QuoteTemplatesListTable.minQuoteTotal',\n ordersPlaced: 'QuoteManagement.QuoteTemplatesListTable.ordersPlaced',\n lastOrdered: 'QuoteManagement.QuoteTemplatesListTable.lastOrdered',\n actions: 'QuoteManagement.QuoteTemplatesListTable.actions',\n });\n\n const columns: Column[] = [\n { key: 'name', label: dictionary.name },\n { key: 'state', label: dictionary.state },\n { key: 'status', label: dictionary.status },\n { key: 'validUntil', label: dictionary.validUntil },\n { key: 'minQuoteTotal', label: dictionary.minQuoteTotal },\n { key: 'ordersPlaced', label: dictionary.ordersPlaced },\n { key: 'lastOrdered', label: dictionary.lastOrdered },\n { key: 'actions', label: dictionary.actions },\n ];\n\n // Check if should show the table when loading or there is data\n const shouldShowTable = loading || rowData.length > 0;\n\n // Check if we should show empty state\n const shouldShowEmptyState =\n !loading && rowData.length === 0 && emptyStateMessage;\n\n // Show item range if requested and message is provided\n const shouldShowItemRange = showItemRange && itemRangeMessage;\n\n // Show page size picker if requested and message is provided\n const shouldShowPageSizePicker = showPageSizePicker && pageSizePickerMessage;\n\n // Show pagination if requested and message is provided\n const shouldShowPagination = showPagination && paginationMessage;\n\n // Show footer if any pagination element should be shown\n const shouldShowFooter =\n shouldShowItemRange || shouldShowPageSizePicker || shouldShowPagination;\n\n return (\n <div\n {...props}\n className={classes([\n 'quote-management-quote-templates-list-table',\n className,\n ])}\n >\n {shouldShowTable && (\n <Table\n columns={columns}\n rowData={rowData}\n loading={loading}\n mobileLayout=\"none\"\n className=\"quote-management-quote-templates-list-table__table\"\n />\n )}\n {shouldShowEmptyState && (\n <div className=\"quote-templates-list-table__empty-state\">\n {emptyStateMessage}\n </div>\n )}\n {shouldShowFooter && (\n <div className=\"quote-templates-list-table__footer\">\n <div className=\"quote-templates-list-table__item-range\">\n {shouldShowItemRange && itemRangeMessage}\n </div>\n <div className=\"quote-templates-list-table__pagination\">\n {shouldShowPagination && paginationMessage}\n </div>\n <div className=\"quote-templates-list-table__page-size-picker\">\n {shouldShowPageSizePicker && pageSizePickerMessage}\n </div>\n </div>\n )}\n </div>\n );\n};\n","/********************************************************************\n * Copyright 2025 Adobe\n * All Rights Reserved.\n *\n * NOTICE: Adobe permits you to use, modify, and distribute this\n * file in accordance with the terms of the Adobe license agreement\n * accompanying it.\n *******************************************************************/\n\nimport { HTMLAttributes, useEffect, useState, createPortal } from 'preact/compat';\nimport { useText } from '@adobe-commerce/elsie/i18n';\nimport { Container, Slot, SlotProps } from '@adobe-commerce/elsie/lib';\nimport {\n Price,\n Button,\n IllustratedMessage,\n Picker,\n Pagination,\n InLineAlert,\n Icon,\n type PickerOption,\n} from '@adobe-commerce/elsie/components';\nimport { events } from '@adobe-commerce/event-bus';\nimport {\n QuoteTemplatesListTable as QuoteTemplatesListTableComponent,\n QuoteTemplateRowData,\n ConfirmationModal,\n} from '@/quote-management/components';\nimport { getQuoteTemplates, generateQuoteFromTemplate } from '@/quote-management/api';\nimport { getDefaultPageSizeOptions } from '@/quote-management/data/transforms';\nimport {\n NegotiableQuoteTemplatesListModel,\n NegotiableQuoteTemplateListEntry,\n} from '@/quote-management/data/models';\nimport { formattedDate } from '@/quote-management/utils/dateUtils';\n\nexport interface QuoteTemplatesListTableProps\n extends HTMLAttributes<HTMLDivElement> {\n pageSize?: number;\n showItemRange?: boolean;\n showPageSizePicker?: boolean;\n showPagination?: boolean;\n onViewQuoteTemplate?: (templateId: string, templateName: string, status: string) => void;\n onGenerateQuoteFromTemplate?: (templateId: string, templateName: string, quoteId: string) => void;\n onPageSizeChange?: (pageSize: number) => void;\n onPageChange?: (page: number) => void;\n slots?: {\n /** Slot for customizing the template name cell content */\n Name?: SlotProps<{ template: NegotiableQuoteTemplateListEntry }>;\n /** Slot for customizing the state cell content */\n State?: SlotProps<{ template: NegotiableQuoteTemplateListEntry }>;\n /** Slot for customizing the status cell content */\n Status?: SlotProps<{ template: NegotiableQuoteTemplateListEntry }>;\n /** Slot for customizing the valid until cell content */\n ValidUntil?: SlotProps<{ template: NegotiableQuoteTemplateListEntry }>;\n /** Slot for customizing the min quote total cell content */\n MinQuoteTotal?: SlotProps<{ template: NegotiableQuoteTemplateListEntry }>;\n /** Slot for customizing the orders placed cell content */\n OrdersPlaced?: SlotProps<{ template: NegotiableQuoteTemplateListEntry }>;\n /** Slot for customizing the last ordered cell content */\n LastOrdered?: SlotProps<{ template: NegotiableQuoteTemplateListEntry }>;\n /** Slot for customizing the actions cell content */\n Actions?: SlotProps<{\n template: NegotiableQuoteTemplateListEntry;\n onViewQuoteTemplate?: (id: string, name: string, status: string) => void;\n onGenerateQuoteFromTemplate?: (id: string, name: string) => void;\n }>;\n /** Slot for customizing the empty templates message */\n EmptyTemplates?: SlotProps;\n /** Slot for customizing the item range display */\n ItemRange?: SlotProps<{\n startItem: number;\n endItem: number;\n totalCount: number;\n currentPage: number;\n pageSize: number;\n }>;\n /** Slot for customizing the page size picker */\n PageSizePicker?: SlotProps<{\n pageSize: number;\n pageSizeOptions: number[];\n onPageSizeChange?: (pageSize: number) => void;\n }>;\n /** Slot for customizing the pagination */\n Pagination?: SlotProps<{\n currentPage: number;\n totalPages: number;\n onChange?: (page: number) => void;\n }>;\n };\n}\n\nexport const QuoteTemplatesListTable: Container<\n QuoteTemplatesListTableProps\n> = ({\n pageSize,\n showItemRange = true,\n showPageSizePicker = true,\n showPagination = true,\n onViewQuoteTemplate,\n onGenerateQuoteFromTemplate,\n onPageSizeChange,\n onPageChange,\n slots,\n ...props\n}) => {\n const dictionary = useText({\n view: 'QuoteManagement.QuoteTemplatesListTable.view',\n generateQuote: 'NegotiableQuoteTemplate.Manage.actionButtons.generateQuote',\n generateQuoteModalMessage: 'NegotiableQuoteTemplate.Manage.confirmationModal.generateQuote.message',\n generateQuoteModalCancel: 'NegotiableQuoteTemplate.Manage.confirmationModal.cancel',\n generateQuoteModalConfirm: 'NegotiableQuoteTemplate.Manage.confirmationModal.generateQuote.confirm',\n generateQuoteModalConfirmLoading: 'NegotiableQuoteTemplate.Manage.confirmationModal.generateQuote.confirmLoading',\n generateQuoteModalSuccessHeading: 'NegotiableQuoteTemplate.Manage.confirmationModal.generateQuote.successHeading',\n generateQuoteSuccessMessage: 'NegotiableQuoteTemplate.Manage.confirmationModal.generateQuote.successDescription',\n generateQuoteModalErrorHeading: 'NegotiableQuoteTemplate.Manage.confirmationModal.generateQuote.errorHeading',\n generateQuoteErrorFallback: 'NegotiableQuoteTemplate.Manage.confirmationModal.generateQuote.errorFallback',\n });\n\n const [templatesData, setTemplatesData] =\n useState<NegotiableQuoteTemplatesListModel | null>(null);\n const [loading, setLoading] = useState(true);\n const [showGenerateQuoteModal, setShowGenerateQuoteModal] = useState<boolean>(false);\n const [isGeneratingQuote, setIsGeneratingQuote] = useState<boolean>(false);\n const [selectedTemplate, setSelectedTemplate] = useState<{ id: string; name: string } | null>(null);\n const [generateQuoteSuccessMessage, setGenerateQuoteSuccessMessage] = useState<string>('');\n const [generateQuoteErrorMessage, setGenerateQuoteErrorMessage] = useState<string>('');\n\n // Default to first page size option if no pageSize prop provided\n const defaultPageSize = getDefaultPageSizeOptions()[0];\n const [currentPageSize, setCurrentPageSize] = useState(\n pageSize || defaultPageSize\n );\n const [currentPage, setCurrentPage] = useState(1);\n\n // Fetch quote templates data when authenticated\n useEffect(() => {\n const fetchTemplates = async () => {\n try {\n setLoading(true);\n const data = await getQuoteTemplates({\n pageSize: currentPageSize,\n currentPage,\n });\n setTemplatesData(data);\n } catch (error) {\n console.error('Failed to fetch quote templates:', error);\n } finally {\n setLoading(false);\n }\n };\n\n // Listen for authentication events\n const unsubscribe = events.on(\n 'authenticated',\n (isAuthenticated) => {\n if (isAuthenticated) {\n fetchTemplates();\n } else {\n setTemplatesData(null);\n setLoading(false);\n }\n },\n { eager: true }\n ); // eager: true means it fires immediately with current state\n\n return () => {\n unsubscribe?.off();\n };\n }, [currentPageSize, currentPage]);\n\n // Handle page size change\n const handlePageSizeChange = (newPageSize: number) => {\n setCurrentPageSize(newPageSize);\n setCurrentPage(1); // Reset to page 1 when page size changes\n onPageSizeChange?.(newPageSize); // Also call parent callback\n };\n\n // Handle page change\n const handlePageChange = (newPage: number) => {\n setCurrentPage(newPage);\n onPageChange?.(newPage); // Also call parent callback\n };\n\n // Handle page size picker selection\n const handlePageSizeSelect = (event: Event) => {\n const target = event.target as HTMLSelectElement;\n const value = target?.value;\n if (value) {\n handlePageSizeChange(Number(value));\n }\n };\n\n // Handle generate quote button click\n const handleGenerateQuoteClick = (templateId: string, templateName: string) => {\n setSelectedTemplate({ id: templateId, name: templateName });\n setGenerateQuoteSuccessMessage('');\n setGenerateQuoteErrorMessage('');\n setShowGenerateQuoteModal(true);\n };\n\n // Handle generate quote confirmation\n const handleGenerateQuote = async (template: { id: string; name: string }) => { \n setIsGeneratingQuote(true);\n setGenerateQuoteSuccessMessage('');\n setGenerateQuoteErrorMessage('');\n \n try {\n const result = await generateQuoteFromTemplate({ templateId: template.id });\n \n // Show success message\n setGenerateQuoteSuccessMessage(dictionary.generateQuoteSuccessMessage);\n \n // Call the callback AFTER successful generation\n onGenerateQuoteFromTemplate?.(template.id, template.name, result.quoteId);\n } catch (error) {\n console.error('Failed to generate quote from template:', error);\n // Show error message and keep modal open so user can try again or cancel\n const errorMessage = error instanceof Error ? error.message : dictionary.generateQuoteErrorFallback;\n setGenerateQuoteErrorMessage(errorMessage);\n } finally {\n setIsGeneratingQuote(false);\n }\n };\n\n // Handle generate quote modal cancel\n const handleGenerateQuoteModalCancel = () => {\n setShowGenerateQuoteModal(false);\n setSelectedTemplate(null);\n setGenerateQuoteSuccessMessage('');\n setGenerateQuoteErrorMessage('');\n };\n\n // Prepare transformed quote template data for table component\n const prepareRowData = (\n templates: NegotiableQuoteTemplateListEntry[],\n slots?: QuoteTemplatesListTableProps['slots'],\n onViewQuoteTemplate?: (templateId: string, templateName: string, status: string) => void\n ): QuoteTemplateRowData[] => {\n return templates\n .filter((template) => template?.uid) // Filter out null templates\n .map((template) => {\n return {\n id: template.id,\n name: (\n <Slot name=\"Name\" slot={slots?.Name} context={{ template }}>\n <span>{template.name}</span>\n </Slot>\n ),\n state: (\n <Slot name=\"State\" slot={slots?.State} context={{ template }}>\n <span style={{ textTransform: 'capitalize' }}>\n {template.state?.replace(/_/g, ' ') || '-'}\n </span>\n </Slot>\n ),\n status: (\n <Slot name=\"Status\" slot={slots?.Status} context={{ template }}>\n <span>{template.status}</span>\n </Slot>\n ),\n validUntil: (\n <Slot\n name=\"ValidUntil\"\n slot={slots?.ValidUntil}\n context={{ template }}\n >\n <span>{formattedDate(template.expirationDate, 'short')}</span>\n </Slot>\n ),\n minQuoteTotal: (\n <Slot\n name=\"MinQuoteTotal\"\n slot={slots?.MinQuoteTotal}\n context={{ template }}\n >\n <Price\n amount={template.prices.minNegotiatedGrandTotal.value}\n currency={template.prices.minNegotiatedGrandTotal.currency}\n />\n </Slot>\n ),\n ordersPlaced: (\n <Slot\n name=\"OrdersPlaced\"\n slot={slots?.OrdersPlaced}\n context={{ template }}\n >\n <span>{template.ordersPlaced}</span>\n </Slot>\n ),\n lastOrdered: (\n <Slot\n name=\"LastOrdered\"\n slot={slots?.LastOrdered}\n context={{ template }}\n >\n <span>{formattedDate(template.lastOrderedAt, 'short')}</span>\n </Slot>\n ),\n actions: (\n <Slot\n name=\"Actions\"\n slot={slots?.Actions}\n context={{ template, onViewQuoteTemplate }}\n className=\"quote-management-quote-templates-list-table__actions-cell\"\n >\n <Button\n variant=\"tertiary\"\n size=\"medium\"\n onClick={() => onViewQuoteTemplate?.(template.id, template.name, template.status)}\n >\n {dictionary.view}\n </Button>\n {template.canGenerateQuoteFromTemplate && (\n <Button\n variant=\"primary\"\n size=\"medium\"\n onClick={() => handleGenerateQuoteClick(template.id, template.name)}\n data-testid={`generate-quote-button-${template.id}`}\n >\n {dictionary.generateQuote}\n </Button>\n )}\n </Slot>\n ),\n };\n });\n };\n\n // Prepare data for rendering\n const rowData = templatesData?.items\n ? prepareRowData(templatesData.items, slots, onViewQuoteTemplate)\n : [];\n\n // Use pagination info directly from API response, merging in pageSizeOptions if needed\n const paginationInfo = templatesData?.paginationInfo\n ? {\n ...templatesData.paginationInfo,\n pageSizeOptions: getDefaultPageSizeOptions(),\n }\n : undefined;\n\n const shouldShowPagination = !!paginationInfo;\n\n // Empty state message\n const emptyStateMessage = (\n <Slot\n name=\"EmptyTemplates\"\n slot={slots?.EmptyTemplates}\n context={{ templatesData }}\n >\n <IllustratedMessage heading=\"No Quote Templates Found\" />\n </Slot>\n );\n\n // Item range message\n const itemRangeMessage = paginationInfo ? (\n <Slot name=\"ItemRange\" slot={slots?.ItemRange} context={paginationInfo}>\n <span>\n Items {paginationInfo.startItem} to {paginationInfo.endItem} of{' '}\n {paginationInfo.totalCount} total\n </span>\n </Slot>\n ) : undefined;\n\n // Prepare page size picker message for component\n const pageSizePickerMessage =\n paginationInfo && paginationInfo.pageSizeOptions ? (\n <Slot\n name=\"PageSizePicker\"\n slot={slots?.PageSizePicker}\n context={{\n pageSize: paginationInfo.pageSize,\n pageSizeOptions: paginationInfo.pageSizeOptions,\n onPageSizeChange: handlePageSizeChange,\n }}\n >\n <span>Show </span>\n <Picker\n variant=\"primary\"\n size=\"medium\"\n value={String(paginationInfo.pageSize)}\n options={paginationInfo.pageSizeOptions.map(\n (size): PickerOption => ({\n value: String(size),\n text: String(size),\n })\n )}\n handleSelect={handlePageSizeSelect}\n />\n <span> per page</span>\n </Slot>\n ) : undefined;\n\n // Prepare pagination message for component\n const paginationMessage = paginationInfo ? (\n <Slot\n name=\"Pagination\"\n slot={slots?.Pagination}\n context={{\n currentPage: paginationInfo.currentPage,\n totalPages: paginationInfo.totalPages,\n onChange: handlePageChange,\n }}\n >\n <Pagination\n currentPage={paginationInfo.currentPage}\n totalPages={paginationInfo.totalPages}\n onChange={handlePageChange}\n />\n </Slot>\n ) : undefined;\n\n // Create banner for generate quote modal based on success/error state\n let generateQuoteModalBanner = null;\n if (generateQuoteSuccessMessage) {\n generateQuoteModalBanner = (\n <InLineAlert\n type=\"success\"\n variant=\"primary\"\n icon={<Icon source=\"CheckWithCircle\" />}\n heading={dictionary.generateQuoteModalSuccessHeading}\n description={generateQuoteSuccessMessage}\n data-testid=\"generate-quote-success-banner\"\n />\n );\n } else if (generateQuoteErrorMessage) {\n generateQuoteModalBanner = (\n <InLineAlert\n type=\"error\"\n variant=\"primary\"\n icon={<Icon source=\"WarningFilled\" />}\n heading={dictionary.generateQuoteModalErrorHeading}\n description={generateQuoteErrorMessage}\n data-testid=\"generate-quote-error-banner\"\n />\n );\n }\n\n return (\n <>\n <QuoteTemplatesListTableComponent\n rowData={rowData}\n loading={loading}\n className={props.className as string}\n emptyStateMessage={emptyStateMessage}\n showItemRange={showItemRange && shouldShowPagination}\n itemRangeMessage={itemRangeMessage}\n showPageSizePicker={showPageSizePicker && shouldShowPagination}\n pageSizePickerMessage={pageSizePickerMessage}\n showPagination={showPagination && shouldShowPagination}\n paginationMessage={paginationMessage}\n />\n {showGenerateQuoteModal &&\n createPortal(\n <ConfirmationModal\n open={showGenerateQuoteModal}\n title={dictionary.generateQuote}\n message={dictionary.generateQuoteModalMessage}\n cancelLabel={dictionary.generateQuoteModalCancel}\n confirmLabel={\n isGeneratingQuote\n ? dictionary.generateQuoteModalConfirmLoading\n : dictionary.generateQuoteModalConfirm\n }\n onCancel={handleGenerateQuoteModalCancel}\n onConfirm={isGeneratingQuote || !selectedTemplate ? undefined : () => handleGenerateQuote(selectedTemplate)}\n showCloseButton={!generateQuoteModalBanner}\n confirmationBanner={generateQuoteModalBanner}\n data-testid=\"generate-quote-confirmation-modal\"\n />,\n document.body\n )}\n </>\n );\n};\n"],"names":["QuoteTemplatesListTable","rowData","loading","className","emptyStateMessage","showItemRange","itemRangeMessage","showPageSizePicker","pageSizePickerMessage","showPagination","paginationMessage","props","dictionary","useText","columns","shouldShowTable","shouldShowEmptyState","shouldShowItemRange","shouldShowPageSizePicker","shouldShowPagination","shouldShowFooter","jsxs","classes","jsx","Table","pageSize","onViewQuoteTemplate","onGenerateQuoteFromTemplate","onPageSizeChange","onPageChange","slots","templatesData","setTemplatesData","useState","setLoading","showGenerateQuoteModal","setShowGenerateQuoteModal","isGeneratingQuote","setIsGeneratingQuote","selectedTemplate","setSelectedTemplate","generateQuoteSuccessMessage","setGenerateQuoteSuccessMessage","generateQuoteErrorMessage","setGenerateQuoteErrorMessage","defaultPageSize","getDefaultPageSizeOptions","currentPageSize","setCurrentPageSize","currentPage","setCurrentPage","useEffect","fetchTemplates","data","getQuoteTemplates","error","unsubscribe","events","isAuthenticated","handlePageSizeChange","newPageSize","handlePageChange","newPage","handlePageSizeSelect","event","target","value","handleGenerateQuoteClick","templateId","templateName","handleGenerateQuote","template","result","generateQuoteFromTemplate","errorMessage","handleGenerateQuoteModalCancel","prepareRowData","templates","Slot","_a","formattedDate","Price","Button","paginationInfo","IllustratedMessage","Picker","size","Pagination","generateQuoteModalBanner","InLineAlert","Icon","Fragment","QuoteTemplatesListTableComponent","createPortal","ConfirmationModal"],"mappings":"uiCAgDO,MAAMA,GAET,CAAC,CACH,QAAAC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E,EAACkE,EAAA,CACC,KAAK,QACL,QAAQ,UACR,KAAMlE,EAACmE,EAAA,CAAK,OAAO,eAAA,CAAgB,EACnC,QAAS9E,EAAW,+BACpB,YAAa+B,EACb,cAAY,6BAAA,CAAA,GAMhBtB,EAAAsE,GAAA,CACE,SAAA,CAAApE,EAACqE,GAAA,CACC,QAAA3F,GACA,QAAAC,EACA,UAAWS,EAAM,UACjB,kBAAAP,GACA,cAAeC,GAAiBc,EAChC,iBAAAb,GACA,mBAAoBC,GAAsBY,EAC1C,sBAAAX,GACA,eAAgBC,GAAkBU,EAClC,kBAAAT,EAAA,CAAA,EAEDyB,GACC0D,GACEtE,EAACuE,GAAA,CACC,KAAM3D,EACN,MAAOvB,EAAW,cAClB,QAASA,EAAW,0BACpB,YAAaA,EAAW,yBACxB,aACEyB,EACIzB,EAAW,iCACXA,EAAW,0BAEjB,SAAU+D,EACV,UAAWtC,GAAqB,CAACE,EAAmB,OAAY,IAAM+B,EAAoB/B,CAAgB,EAC1G,gBAAiB,CAACiD,EAClB,mBAAoBA,EACpB,cAAY,mCAAA,CAAA,EAEd,SAAS,IAAA,CACX,EACJ,CAEJ"}
@@ -0,0 +1,72 @@
1
+ import { HTMLAttributes } from 'preact/compat';
2
+ import { Container, SlotProps } from '@dropins/tools/types/elsie/src/lib';
3
+ import { NegotiableQuoteListEntry } from '../../data/models';
4
+
5
+ export interface QuotesListTableProps extends HTMLAttributes<HTMLDivElement> {
6
+ pageSize?: number;
7
+ showItemRange?: boolean;
8
+ showPageSizePicker?: boolean;
9
+ showPagination?: boolean;
10
+ onViewQuote?: (quoteId: string, quoteName: string, status: string) => void;
11
+ onPageSizeChange?: (pageSize: number) => void;
12
+ onPageChange?: (page: number) => void;
13
+ slots?: {
14
+ /** Slot for customizing the quote name cell content */
15
+ QuoteName?: SlotProps<{
16
+ quote: NegotiableQuoteListEntry;
17
+ }>;
18
+ /** Slot for customizing the created date cell content */
19
+ Created?: SlotProps<{
20
+ quote: NegotiableQuoteListEntry;
21
+ }>;
22
+ /** Slot for customizing the created by cell content */
23
+ CreatedBy?: SlotProps<{
24
+ quote: NegotiableQuoteListEntry;
25
+ }>;
26
+ /** Slot for customizing the status cell content */
27
+ Status?: SlotProps<{
28
+ quote: NegotiableQuoteListEntry;
29
+ }>;
30
+ /** Slot for customizing the last updated cell content */
31
+ LastUpdated?: SlotProps<{
32
+ quote: NegotiableQuoteListEntry;
33
+ }>;
34
+ /** Slot for customizing the quote template cell content */
35
+ QuoteTemplate?: SlotProps<{
36
+ quote: NegotiableQuoteListEntry;
37
+ }>;
38
+ /** Slot for customizing the quote total cell content */
39
+ QuoteTotal?: SlotProps<{
40
+ quote: NegotiableQuoteListEntry;
41
+ }>;
42
+ /** Slot for customizing the actions cell content */
43
+ Actions?: SlotProps<{
44
+ quote: NegotiableQuoteListEntry;
45
+ onViewQuote?: (id: string, name: string, status: string) => void;
46
+ }>;
47
+ /** Slot for customizing the empty quotes message */
48
+ EmptyQuotes?: SlotProps;
49
+ /** Slot for customizing the item range display */
50
+ ItemRange?: SlotProps<{
51
+ startItem: number;
52
+ endItem: number;
53
+ totalCount: number;
54
+ currentPage: number;
55
+ pageSize: number;
56
+ }>;
57
+ /** Slot for customizing the page size picker */
58
+ PageSizePicker?: SlotProps<{
59
+ pageSize: number;
60
+ pageSizeOptions: number[];
61
+ onPageSizeChange?: (pageSize: number) => void;
62
+ }>;
63
+ /** Slot for customizing the pagination */
64
+ Pagination?: SlotProps<{
65
+ currentPage: number;
66
+ totalPages: number;
67
+ onChange?: (page: number) => void;
68
+ }>;
69
+ };
70
+ }
71
+ export declare const QuotesListTable: Container<QuotesListTableProps>;
72
+ //# sourceMappingURL=QuotesListTable.d.ts.map
@@ -0,0 +1,11 @@
1
+ /********************************************************************
2
+ * Copyright 2025 Adobe
3
+ * All Rights Reserved.
4
+ *
5
+ * NOTICE: Adobe permits you to use, modify, and distribute this
6
+ * file in accordance with the terms of the Adobe license agreement
7
+ * accompanying it.
8
+ *******************************************************************/
9
+ export * from './QuotesListTable';
10
+ export { QuotesListTable as default } from './QuotesListTable';
11
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1,3 @@
1
+ export * from './QuotesListTable/index'
2
+ import _default from './QuotesListTable/index'
3
+ export default _default
@@ -0,0 +1,4 @@
1
+ /*! Copyright 2025 Adobe
2
+ All Rights Reserved. */
3
+ import{jsxs as N,jsx as t}from"@dropins/tools/preact-jsx-runtime.js";import{useState as P,useEffect as A}from"@dropins/tools/preact-compat.js";import{classes as J,Slot as o}from"@dropins/tools/lib.js";import{Table as K,IllustratedMessage as W,Picker as X,Pagination as Y,Button as Z,Price as q}from"@dropins/tools/components.js";import{events as U}from"@dropins/tools/event-bus.js";/* empty css */import"@dropins/tools/preact.js";import"@dropins/tools/preact-hooks.js";import{f as C}from"../chunks/dateUtils.js";import{useText as V}from"@dropins/tools/i18n.js";/* empty css *//* empty css */import{g as ee}from"../chunks/transform-quote.js";import"../chunks/state.js";import{n as O}from"../chunks/negotiableQuotes.js";import"@dropins/tools/fetch-graphql.js";const te=({rowData:p=[],loading:g=!1,className:v,emptyStateMessage:b,showItemRange:x=!0,itemRangeMessage:u,showPageSizePicker:h=!0,pageSizePickerMessage:i,showPagination:z=!0,paginationMessage:m,...f})=>{const l=V({quoteName:"QuoteManagement.QuotesListTable.quoteName",created:"QuoteManagement.QuotesListTable.created",createdBy:"QuoteManagement.QuotesListTable.createdBy",status:"QuoteManagement.QuotesListTable.status",lastUpdated:"QuoteManagement.QuotesListTable.lastUpdated",quoteTemplate:"QuoteManagement.QuotesListTable.quoteTemplate",quoteTotal:"QuoteManagement.QuotesListTable.quoteTotal",actions:"QuoteManagement.QuotesListTable.actions"}),y=[{key:"quoteName",label:l.quoteName},{key:"created",label:l.created},{key:"createdBy",label:l.createdBy},{key:"status",label:l.status},{key:"lastUpdated",label:l.lastUpdated},{key:"quoteTemplate",label:l.quoteTemplate},{key:"quoteTotal",label:l.quoteTotal},{key:"actions",label:l.actions}],k=g||p.length>0,s=!g&&p.length===0&&b,T=x&&u,d=h&&i,S=z&&m,Q=T||d||S;return N("div",{...f,className:J(["quote-management-quotes-list-table",v]),children:[k&&t(K,{columns:y,rowData:p,loading:g,mobileLayout:"none",className:"quote-management-quotes-list-table__table"}),s&&t("div",{className:"quotes-list-table__empty-state",children:b}),Q&&N("div",{className:"quotes-list-table__footer",children:[t("div",{className:"quotes-list-table__item-range",children:T&&u}),t("div",{className:"quotes-list-table__pagination",children:S&&m}),t("div",{className:"quotes-list-table__page-size-picker",children:d&&i})]})]})},Se=({pageSize:p,showItemRange:g=!0,showPageSizePicker:v=!0,showPagination:b=!0,onViewQuote:x,onPageSizeChange:u,onPageChange:h,slots:i,...z})=>{const[m,f]=P(null),[l,y]=P(!0),k=ee()[0],[s,T]=P(p||k),[d,S]=P(1);A(()=>{const c=async()=>{try{y(!0);const r=await O({pageSize:s,currentPage:d});f(r)}catch(r){console.error("Failed to fetch quotes:",r)}finally{y(!1)}},e=U.on("authenticated",r=>{r?c():(f(null),y(!1))},{eager:!0});return()=>{e==null||e.off()}},[s,d]),A(()=>{const c=async()=>{try{const r=await O({pageSize:s,currentPage:d});f(r)}catch(r){console.error("Failed to fetch quotes:",r)}},e=U.on("quote-management/quote-renamed",()=>{c()},{eager:!0});return()=>{e==null||e.off()}},[s,d]);const Q=c=>{T(c),S(1),u==null||u(c)},_=c=>{S(c),h==null||h(c)},R=c=>{const e=c.target,r=e==null?void 0:e.value;r&&Q(Number(r))},E=(c,e,r)=>c.filter(a=>a==null?void 0:a.uid).map(a=>{var I,B,M,w;const H=`${a.buyer.firstname} ${a.buyer.lastname}`;return{id:a.uid,quoteName:t(o,{name:"QuoteName",slot:e==null?void 0:e.QuoteName,context:{quote:a},children:t("span",{children:a.name})}),created:t(o,{name:"Created",slot:e==null?void 0:e.Created,context:{quote:a},children:t("span",{children:a.createdAt?C(a.createdAt,"short"):"N/A"})}),createdBy:t(o,{name:"CreatedBy",slot:e==null?void 0:e.CreatedBy,context:{quote:a},children:t("span",{children:H})}),status:t(o,{name:"Status",slot:e==null?void 0:e.Status,context:{quote:a},children:t("span",{children:a.status})}),lastUpdated:t(o,{name:"LastUpdated",slot:e==null?void 0:e.LastUpdated,context:{quote:a},children:t("span",{children:a.updatedAt?C(a.updatedAt,"short"):"N/A"})}),quoteTemplate:t(o,{name:"QuoteTemplate",slot:e==null?void 0:e.QuoteTemplate,context:{quote:a},children:t("span",{children:a.templateName})}),quoteTotal:t(o,{name:"QuoteTotal",slot:e==null?void 0:e.QuoteTotal,context:{quote:a},children:t(q,{amount:(B=(I=a.prices)==null?void 0:I.grandTotal)==null?void 0:B.value,currency:(w=(M=a.prices)==null?void 0:M.grandTotal)==null?void 0:w.currency})}),actions:t(o,{name:"Actions",slot:e==null?void 0:e.Actions,context:{quote:a,onViewQuote:r},children:t(Z,{variant:"tertiary",size:"medium",onClick:()=>r==null?void 0:r(a.uid,a.name,a.status),children:"View"})})}}),F=m!=null&&m.items?E(m.items,i,x):[],n=m==null?void 0:m.paginationInfo,L=!!n,$=t(o,{name:"EmptyQuotes",slot:i==null?void 0:i.EmptyQuotes,context:{quotesData:m},children:t(W,{heading:"No Quotes Found"})}),j=n?t(o,{name:"ItemRange",slot:i==null?void 0:i.ItemRange,context:n,children:N("span",{children:["Items ",n.startItem," to ",n.endItem," of"," ",n.totalCount," total"]})}):void 0,D=n&&n.pageSizeOptions?N(o,{name:"PageSizePicker",slot:i==null?void 0:i.PageSizePicker,context:{pageSize:n.pageSize,pageSizeOptions:n.pageSizeOptions,onPageSizeChange:Q},children:[t("span",{children:"Show "}),t(X,{variant:"primary",size:"medium",value:String(n.pageSize),options:n.pageSizeOptions.map(c=>({value:String(c),text:String(c)})),handleSelect:R}),t("span",{children:" per page"})]}):void 0,G=n?t(o,{name:"Pagination",slot:i==null?void 0:i.Pagination,context:{currentPage:n.currentPage,totalPages:n.totalPages,onChange:_},children:t(Y,{currentPage:n.currentPage,totalPages:n.totalPages,onChange:_})}):void 0;return t(te,{rowData:F,loading:l,className:z.className,emptyStateMessage:$,showItemRange:g&&L,itemRangeMessage:j,showPageSizePicker:v&&L,pageSizePickerMessage:D,showPagination:b&&L,paginationMessage:G})};export{Se as QuotesListTable,Se as default};
4
+ //# sourceMappingURL=QuotesListTable.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"QuotesListTable.js","sources":["/@dropins/storefront-quote-management/src/components/QuotesListTable/QuotesListTable.tsx","/@dropins/storefront-quote-management/src/containers/QuotesListTable/QuotesListTable.tsx"],"sourcesContent":["/********************************************************************\n * Copyright 2025 Adobe\n * All Rights Reserved.\n *\n * NOTICE: Adobe permits you to use, modify, and distribute this\n * file in accordance with the terms of the Adobe license agreement\n * accompanying it.\n *******************************************************************/\n\nimport { FunctionComponent, VNode } from 'preact';\nimport { HTMLAttributes } from 'preact/compat';\nimport { classes } from '@adobe-commerce/elsie/lib';\nimport { Table } from '@adobe-commerce/elsie/components';\nimport { useText } from '@adobe-commerce/elsie/i18n';\nimport '@/quote-management/components/QuotesListTable/QuotesListTable.css';\n\ntype Column = {\n key: string;\n label: string;\n};\n\nexport interface QuotesListTableProps\n extends Omit<HTMLAttributes<HTMLDivElement>, 'loading' | 'children'> {\n rowData: QuoteRowData[];\n loading?: boolean;\n className?: string;\n emptyStateMessage?: VNode;\n showItemRange?: boolean;\n itemRangeMessage?: VNode;\n showPageSizePicker?: boolean;\n pageSizePickerMessage?: VNode;\n showPagination?: boolean;\n paginationMessage?: VNode;\n}\n\nexport type QuoteRowData = {\n id: string;\n quoteName: VNode;\n created: VNode;\n createdBy: VNode;\n status: VNode;\n lastUpdated: VNode;\n quoteTemplate: VNode;\n quoteTotal: VNode;\n actions: VNode;\n [key: string]: VNode | string | number | undefined;\n};\n\nexport const QuotesListTable: FunctionComponent<QuotesListTableProps> = ({\n rowData = [],\n loading = false,\n className,\n emptyStateMessage,\n showItemRange = true,\n itemRangeMessage,\n showPageSizePicker = true,\n pageSizePickerMessage,\n showPagination = true,\n paginationMessage,\n ...props\n}) => {\n const dictionary = useText({\n quoteName: 'QuoteManagement.QuotesListTable.quoteName',\n created: 'QuoteManagement.QuotesListTable.created',\n createdBy: 'QuoteManagement.QuotesListTable.createdBy',\n status: 'QuoteManagement.QuotesListTable.status',\n lastUpdated: 'QuoteManagement.QuotesListTable.lastUpdated',\n quoteTemplate: 'QuoteManagement.QuotesListTable.quoteTemplate',\n quoteTotal: 'QuoteManagement.QuotesListTable.quoteTotal',\n actions: 'QuoteManagement.QuotesListTable.actions',\n });\n\n const columns: Column[] = [\n { key: 'quoteName', label: dictionary.quoteName },\n { key: 'created', label: dictionary.created },\n { key: 'createdBy', label: dictionary.createdBy },\n { key: 'status', label: dictionary.status },\n { key: 'lastUpdated', label: dictionary.lastUpdated },\n { key: 'quoteTemplate', label: dictionary.quoteTemplate },\n { key: 'quoteTotal', label: dictionary.quoteTotal },\n { key: 'actions', label: dictionary.actions },\n ];\n\n // Check if should show the table when loading or there is data\n const shouldShowTable = loading || rowData.length > 0;\n\n // Check if we should show empty state\n const shouldShowEmptyState =\n !loading && rowData.length === 0 && emptyStateMessage;\n\n // Show item range if requested and message is provided\n const shouldShowItemRange = showItemRange && itemRangeMessage;\n\n // Show page size picker if requested and message is provided\n const shouldShowPageSizePicker = showPageSizePicker && pageSizePickerMessage;\n\n // Show pagination if requested and message is provided\n const shouldShowPagination = showPagination && paginationMessage;\n\n // Show footer if any pagination element should be shown\n const shouldShowFooter =\n shouldShowItemRange || shouldShowPageSizePicker || shouldShowPagination;\n\n return (\n <div\n {...props}\n className={classes(['quote-management-quotes-list-table', className])}\n >\n {shouldShowTable && (\n <Table\n columns={columns}\n rowData={rowData}\n loading={loading}\n mobileLayout=\"none\"\n className=\"quote-management-quotes-list-table__table\"\n />\n )}\n {shouldShowEmptyState && (\n <div className=\"quotes-list-table__empty-state\">\n {emptyStateMessage}\n </div>\n )}\n {shouldShowFooter && (\n <div className=\"quotes-list-table__footer\">\n <div className=\"quotes-list-table__item-range\">\n {shouldShowItemRange && itemRangeMessage}\n </div>\n <div className=\"quotes-list-table__pagination\">\n {shouldShowPagination && paginationMessage}\n </div>\n <div className=\"quotes-list-table__page-size-picker\">\n {shouldShowPageSizePicker && pageSizePickerMessage}\n </div>\n </div>\n )}\n </div>\n );\n};\n","/********************************************************************\n * Copyright 2025 Adobe\n * All Rights Reserved.\n *\n * NOTICE: Adobe permits you to use, modify, and distribute this\n * file in accordance with the terms of the Adobe license agreement\n * accompanying it.\n *******************************************************************/\n\nimport { HTMLAttributes, useEffect, useState } from 'preact/compat';\nimport { Container, Slot, SlotProps } from '@adobe-commerce/elsie/lib';\nimport {\n Price,\n Button,\n IllustratedMessage,\n Picker,\n Pagination,\n type PickerOption,\n} from '@adobe-commerce/elsie/components';\nimport { events } from '@adobe-commerce/event-bus';\nimport {\n QuotesListTable as QuotesListTableComponent,\n QuoteRowData,\n} from '@/quote-management/components';\nimport { negotiableQuotes } from '@/quote-management/api';\nimport { getDefaultPageSizeOptions } from '@/quote-management/data/transforms';\nimport {\n NegotiableQuotesListModel,\n NegotiableQuoteListEntry,\n} from '@/quote-management/data/models';\nimport { formattedDate } from '@/quote-management/utils/dateUtils';\n\nexport interface QuotesListTableProps extends HTMLAttributes<HTMLDivElement> {\n pageSize?: number;\n showItemRange?: boolean;\n showPageSizePicker?: boolean;\n showPagination?: boolean;\n onViewQuote?: (quoteId: string, quoteName: string, status: string) => void;\n onPageSizeChange?: (pageSize: number) => void;\n onPageChange?: (page: number) => void;\n slots?: {\n /** Slot for customizing the quote name cell content */\n QuoteName?: SlotProps<{ quote: NegotiableQuoteListEntry }>;\n /** Slot for customizing the created date cell content */\n Created?: SlotProps<{ quote: NegotiableQuoteListEntry }>;\n /** Slot for customizing the created by cell content */\n CreatedBy?: SlotProps<{ quote: NegotiableQuoteListEntry }>;\n /** Slot for customizing the status cell content */\n Status?: SlotProps<{ quote: NegotiableQuoteListEntry }>;\n /** Slot for customizing the last updated cell content */\n LastUpdated?: SlotProps<{ quote: NegotiableQuoteListEntry }>;\n /** Slot for customizing the quote template cell content */\n QuoteTemplate?: SlotProps<{ quote: NegotiableQuoteListEntry }>;\n /** Slot for customizing the quote total cell content */\n QuoteTotal?: SlotProps<{ quote: NegotiableQuoteListEntry }>;\n /** Slot for customizing the actions cell content */\n Actions?: SlotProps<{\n quote: NegotiableQuoteListEntry;\n onViewQuote?: (id: string, name: string, status: string) => void;\n }>;\n /** Slot for customizing the empty quotes message */\n EmptyQuotes?: SlotProps;\n /** Slot for customizing the item range display */\n ItemRange?: SlotProps<{\n startItem: number;\n endItem: number;\n totalCount: number;\n currentPage: number;\n pageSize: number;\n }>;\n /** Slot for customizing the page size picker */\n PageSizePicker?: SlotProps<{\n pageSize: number;\n pageSizeOptions: number[];\n onPageSizeChange?: (pageSize: number) => void;\n }>;\n /** Slot for customizing the pagination */\n Pagination?: SlotProps<{\n currentPage: number;\n totalPages: number;\n onChange?: (page: number) => void;\n }>;\n };\n}\n\nexport const QuotesListTable: Container<QuotesListTableProps> = ({\n pageSize,\n showItemRange = true,\n showPageSizePicker = true,\n showPagination = true,\n onViewQuote,\n onPageSizeChange,\n onPageChange,\n slots,\n ...props\n}) => {\n const [quotesData, setQuotesData] =\n useState<NegotiableQuotesListModel | null>(null);\n const [loading, setLoading] = useState(true);\n\n // Default to first page size option if no pageSize prop provided\n const defaultPageSize = getDefaultPageSizeOptions()[0];\n const [currentPageSize, setCurrentPageSize] = useState(\n pageSize || defaultPageSize\n );\n const [currentPage, setCurrentPage] = useState(1);\n\n // Fetch quotes data when authenticated\n useEffect(() => {\n const fetchQuotes = async () => {\n try {\n setLoading(true);\n const data = await negotiableQuotes({\n pageSize: currentPageSize,\n currentPage,\n });\n setQuotesData(data);\n } catch (error) {\n console.error('Failed to fetch quotes:', error);\n } finally {\n setLoading(false);\n }\n };\n\n // Listen for authentication events\n const unsubscribe = events.on(\n 'authenticated',\n (isAuthenticated) => {\n if (isAuthenticated) {\n fetchQuotes();\n } else {\n setQuotesData(null);\n setLoading(false);\n }\n },\n { eager: true }\n ); // eager: true means it fires immediately with current state\n\n return () => {\n unsubscribe?.off();\n };\n }, [currentPageSize, currentPage]);\n\n // Listen for quote renamed event to refresh the list\n useEffect(() => {\n const fetchQuotes = async () => {\n try {\n const data = await negotiableQuotes({\n pageSize: currentPageSize,\n currentPage,\n });\n setQuotesData(data);\n } catch (error) {\n console.error('Failed to fetch quotes:', error);\n }\n };\n\n const unsubscribe = events.on(\n 'quote-management/quote-renamed',\n () => {\n // Refetch quotes list to show the updated name\n fetchQuotes();\n },\n { eager: true }\n );\n\n return () => {\n unsubscribe?.off();\n };\n }, [currentPageSize, currentPage]);\n\n // Handle page size change\n const handlePageSizeChange = (newPageSize: number) => {\n setCurrentPageSize(newPageSize);\n setCurrentPage(1); // Reset to page 1 when page size changes\n onPageSizeChange?.(newPageSize); // Also call parent callback\n };\n\n // Handle page change\n const handlePageChange = (newPage: number) => {\n setCurrentPage(newPage);\n onPageChange?.(newPage); // Also call parent callback\n };\n\n // Handle page size picker selection\n const handlePageSizeSelect = (event: Event) => {\n const target = event.target as HTMLSelectElement;\n const value = target?.value;\n if (value) {\n handlePageSizeChange(Number(value));\n }\n };\n\n // Prepare transformed quote data for table component\n const prepareRowData = (\n quotes: NegotiableQuoteListEntry[],\n slots?: QuotesListTableProps['slots'],\n onViewQuote?: (quoteId: string, quoteName: string, status: string) => void\n ): QuoteRowData[] => {\n return quotes\n .filter((quote) => quote?.uid) // Filter out null quotes\n .map((quote) => {\n const createdByName = `${quote.buyer.firstname} ${quote.buyer.lastname}`;\n\n return {\n id: quote.uid,\n quoteName: (\n <Slot name=\"QuoteName\" slot={slots?.QuoteName} context={{ quote }}>\n <span>{quote.name}</span>\n </Slot>\n ),\n created: (\n <Slot name=\"Created\" slot={slots?.Created} context={{ quote }}>\n <span>\n {quote.createdAt\n ? formattedDate(quote.createdAt, 'short')\n : 'N/A'}\n </span>\n </Slot>\n ),\n createdBy: (\n <Slot name=\"CreatedBy\" slot={slots?.CreatedBy} context={{ quote }}>\n <span>{createdByName}</span>\n </Slot>\n ),\n status: (\n <Slot name=\"Status\" slot={slots?.Status} context={{ quote }}>\n <span>{quote.status}</span>\n </Slot>\n ),\n lastUpdated: (\n <Slot\n name=\"LastUpdated\"\n slot={slots?.LastUpdated}\n context={{ quote }}\n >\n <span>\n {quote.updatedAt\n ? formattedDate(quote.updatedAt, 'short')\n : 'N/A'}\n </span>\n </Slot>\n ),\n quoteTemplate: (\n <Slot\n name=\"QuoteTemplate\"\n slot={slots?.QuoteTemplate}\n context={{ quote }}\n >\n <span>{quote.templateName}</span>\n </Slot>\n ),\n quoteTotal: (\n <Slot\n name=\"QuoteTotal\"\n slot={slots?.QuoteTotal}\n context={{ quote }}\n >\n <Price\n amount={quote.prices?.grandTotal?.value}\n currency={quote.prices?.grandTotal?.currency}\n />\n </Slot>\n ),\n actions: (\n <Slot\n name=\"Actions\"\n slot={slots?.Actions}\n context={{ quote, onViewQuote }}\n >\n <Button\n variant=\"tertiary\"\n size=\"medium\"\n onClick={() =>\n onViewQuote?.(quote.uid, quote.name, quote.status)\n }\n >\n View\n </Button>\n </Slot>\n ),\n };\n });\n };\n\n // Prepare data for rendering\n const rowData = quotesData?.items\n ? prepareRowData(quotesData.items, slots, onViewQuote)\n : [];\n\n const paginationInfo = quotesData?.paginationInfo;\n const shouldShowPagination = !!paginationInfo;\n\n // Empty state message\n const emptyStateMessage = (\n <Slot name=\"EmptyQuotes\" slot={slots?.EmptyQuotes} context={{ quotesData }}>\n <IllustratedMessage heading=\"No Quotes Found\" />\n </Slot>\n );\n\n // Item range message\n const itemRangeMessage = paginationInfo ? (\n <Slot name=\"ItemRange\" slot={slots?.ItemRange} context={paginationInfo}>\n <span>\n Items {paginationInfo.startItem} to {paginationInfo.endItem} of{' '}\n {paginationInfo.totalCount} total\n </span>\n </Slot>\n ) : undefined;\n\n // Prepare page size picker message for component\n const pageSizePickerMessage =\n paginationInfo && paginationInfo.pageSizeOptions ? (\n <Slot\n name=\"PageSizePicker\"\n slot={slots?.PageSizePicker}\n context={{\n pageSize: paginationInfo.pageSize,\n pageSizeOptions: paginationInfo.pageSizeOptions,\n onPageSizeChange: handlePageSizeChange,\n }}\n >\n <span>Show </span>\n <Picker\n variant=\"primary\"\n size=\"medium\"\n value={String(paginationInfo.pageSize)}\n options={paginationInfo.pageSizeOptions.map(\n (size): PickerOption => ({\n value: String(size),\n text: String(size),\n })\n )}\n handleSelect={handlePageSizeSelect}\n />\n <span> per page</span>\n </Slot>\n ) : undefined;\n\n // Prepare pagination message for component\n const paginationMessage = paginationInfo ? (\n <Slot\n name=\"Pagination\"\n slot={slots?.Pagination}\n context={{\n currentPage: paginationInfo.currentPage,\n totalPages: paginationInfo.totalPages,\n onChange: handlePageChange,\n }}\n >\n <Pagination\n currentPage={paginationInfo.currentPage}\n totalPages={paginationInfo.totalPages}\n onChange={handlePageChange}\n />\n </Slot>\n ) : undefined;\n\n return (\n <QuotesListTableComponent\n rowData={rowData}\n loading={loading}\n className={props.className as string}\n emptyStateMessage={emptyStateMessage}\n showItemRange={showItemRange && shouldShowPagination}\n itemRangeMessage={itemRangeMessage}\n showPageSizePicker={showPageSizePicker && shouldShowPagination}\n pageSizePickerMessage={pageSizePickerMessage}\n showPagination={showPagination && shouldShowPagination}\n paginationMessage={paginationMessage}\n />\n );\n};\n"],"names":["QuotesListTable","rowData","loading","className","emptyStateMessage","showItemRange","itemRangeMessage","showPageSizePicker","pageSizePickerMessage","showPagination","paginationMessage","props","dictionary","useText","columns","shouldShowTable","shouldShowEmptyState","shouldShowItemRange","shouldShowPageSizePicker","shouldShowPagination","shouldShowFooter","jsxs","classes","jsx","Table","pageSize","onViewQuote","onPageSizeChange","onPageChange","slots","quotesData","setQuotesData","useState","setLoading","defaultPageSize","getDefaultPageSizeOptions","currentPageSize","setCurrentPageSize","currentPage","setCurrentPage","useEffect","fetchQuotes","data","negotiableQuotes","error","unsubscribe","events","isAuthenticated","handlePageSizeChange","newPageSize","handlePageChange","newPage","handlePageSizeSelect","event","target","value","prepareRowData","quotes","quote","createdByName","Slot","formattedDate","Price","_b","_a","_d","_c","Button","paginationInfo","IllustratedMessage","Picker","size","Pagination","QuotesListTableComponent"],"mappings":"m0BAgDO,MAAMA,GAA2D,CAAC,CACvE,QAAAC,EAAU,CAAA,EACV,QAAAC,EAAU,GACV,UAAAC,EACA,kBAAAC,EACA,cAAAC,EAAgB,GAChB,iBAAAC,EACA,mBAAAC,EAAqB,GACrB,sBAAAC,EACA,eAAAC,EAAiB,GACjB,kBAAAC,EACA,GAAGC,CACL,IAAM,CACJ,MAAMC,EAAaC,EAAQ,CACzB,UAAW,4CACX,QAAS,0CACT,UAAW,4CACX,OAAQ,yCACR,YAAa,8CACb,cAAe,gDACf,WAAY,6CACZ,QAAS,yCAAA,CACV,EAEKC,EAAoB,CACxB,CAAE,IAAK,YAAa,MAAOF,EAAW,SAAA,EACtC,CAAE,IAAK,UAAW,MAAOA,EAAW,OAAA,EACpC,CAAE,IAAK,YAAa,MAAOA,EAAW,SAAA,EACtC,CAAE,IAAK,SAAU,MAAOA,EAAW,MAAA,EACnC,CAAE,IAAK,cAAe,MAAOA,EAAW,WAAA,EACxC,CAAE,IAAK,gBAAiB,MAAOA,EAAW,aAAA,EAC1C,CAAE,IAAK,aAAc,MAAOA,EAAW,UAAA,EACvC,CAAE,IAAK,UAAW,MAAOA,EAAW,OAAA,CAAQ,EAIxCG,EAAkBb,GAAWD,EAAQ,OAAS,EAG9Ce,EACJ,CAACd,GAAWD,EAAQ,SAAW,GAAKG,EAGhCa,EAAsBZ,GAAiBC,EAGvCY,EAA2BX,GAAsBC,EAGjDW,EAAuBV,GAAkBC,EAGzCU,EACJH,GAAuBC,GAA4BC,EAErD,OACEE,EAAC,MAAA,CACE,GAAGV,EACJ,UAAWW,EAAQ,CAAC,qCAAsCnB,CAAS,CAAC,EAEnE,SAAA,CAAAY,GACCQ,EAACC,EAAA,CACC,QAAAV,EACA,QAAAb,EACA,QAAAC,EACA,aAAa,OACb,UAAU,2CAAA,CAAA,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AC5B,WAAYA,EAAe,WAC3B,SAAUlB,CAAA,EAGZ,SAAA3B,EAACiD,EAAA,CACC,YAAaJ,EAAe,YAC5B,WAAYA,EAAe,WAC3B,SAAUlB,CAAA,CAAA,CACZ,CAAA,EAEA,OAEJ,OACE3B,EAACkD,GAAA,CACC,QAAAxE,EACA,QAAAC,EACA,UAAWS,EAAM,UACjB,kBAAAP,EACA,cAAeC,GAAiBc,EAChC,iBAAAb,EACA,mBAAoBC,GAAsBY,EAC1C,sBAAAX,EACA,eAAgBC,GAAkBU,EAClC,kBAAAT,CAAA,CAAA,CAGN"}
@@ -1,6 +1,7 @@
1
1
  import { HTMLAttributes } from 'preact/compat';
2
2
  import { Container, SlotProps } from '@dropins/tools/types/elsie/src/lib';
3
3
  import { requestNegotiableQuote } from '../../api';
4
+ import { AttachedFile } from '../../components';
4
5
 
5
6
  export type RequestNegotiableQuoteHandlers = {
6
7
  onAttachFiles?: (files: File[]) => Promise<void>;
@@ -15,7 +16,9 @@ export type RequestNegotiableQuoteHandlers = {
15
16
  };
16
17
  export interface RequestNegotiableQuoteFormProps extends Omit<HTMLAttributes<HTMLDivElement>, 'onError'>, RequestNegotiableQuoteHandlers {
17
18
  cartId: string;
18
- enableFileUpload?: boolean;
19
+ maxFiles?: number;
20
+ maxFileSize?: number;
21
+ acceptedFileTypes?: string[];
19
22
  slots?: {
20
23
  ErrorBanner?: SlotProps<{
21
24
  message: string;
@@ -40,6 +43,12 @@ export interface RequestNegotiableQuoteFormProps extends Omit<HTMLAttributes<HTM
40
43
  onChange: (files: File[]) => void;
41
44
  formErrors: Record<string, string>;
42
45
  isFormDisabled: boolean;
46
+ attachedFiles: AttachedFile[];
47
+ }>;
48
+ AttachedFilesList?: SlotProps<{
49
+ files: AttachedFile[];
50
+ onRemove: (key: string) => void;
51
+ disabled?: boolean;
43
52
  }>;
44
53
  RequestButton?: SlotProps<{
45
54
  requestNegotiableQuote: typeof requestNegotiableQuote;
@@ -1,4 +1,4 @@
1
1
  /*! Copyright 2025 Adobe
2
2
  All Rights Reserved. */
3
- import{jsxs as P,jsx as a}from"@dropins/tools/preact-jsx-runtime.js";import*as c from"@dropins/tools/preact-compat.js";import{useState as g,useEffect as R,useCallback as oe}from"@dropins/tools/preact-compat.js";import{classes as u,VComponent as h,Slot as q,getFormErrors as j,getFormValues as ne}from"@dropins/tools/lib.js";import{TextArea as ie,Field as ce,Input as se,InputFile as ue,Button as z,InLineAlert as me}from"@dropins/tools/components.js";import{events as I}from"@dropins/tools/event-bus.js";import{u as de,r as w}from"../chunks/requestNegotiableQuote.js";import{useText as le}from"@dropins/tools/i18n.js";import"@dropins/tools/fetch-graphql.js";const fe=i=>c.createElement("svg",{id:"Icon_Add_Base","data-name":"Icon \\u2013 Add \\u2013 Base",xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",...i},c.createElement("g",{id:"Large"},c.createElement("rect",{id:"Placement_area","data-name":"Placement area",width:24,height:24,fill:"#fff",opacity:0}),c.createElement("g",{id:"Add_icon","data-name":"Add icon",transform:"translate(9.734 9.737)"},c.createElement("line",{vectorEffect:"non-scaling-stroke",id:"Line_579","data-name":"Line 579",y2:12.7,transform:"translate(2.216 -4.087)",fill:"none",stroke:"currentColor"}),c.createElement("line",{vectorEffect:"non-scaling-stroke",id:"Line_580","data-name":"Line 580",x2:12.7,transform:"translate(-4.079 2.263)",fill:"none",stroke:"currentColor"})))),ge=i=>c.createElement("svg",{width:24,height:24,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",...i},c.createElement("path",{vectorEffect:"non-scaling-stroke",d:"M0.75 12C0.75 5.78421 5.78421 0.75 12 0.75C18.2158 0.75 23.25 5.78421 23.25 12C23.25 18.2158 18.2158 23.25 12 23.25C5.78421 23.25 0.75 18.2158 0.75 12Z",stroke:"currentColor"}),c.createElement("path",{vectorEffect:"non-scaling-stroke",d:"M6.75 12.762L10.2385 15.75L17.25 9",stroke:"currentColor"})),he=i=>c.createElement("svg",{width:24,height:24,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",...i},c.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"})),qe=({className:i,title:C,banner:e,commentField:_,quoteNameField:F,attachFile:N,requestButton:s,saveButton:d,onSubmit:E,...x})=>P("form",{...x,className:u(["request-negotiable-quote-form",i]),onSubmit:E,children:[e&&a(h,{node:e,className:u(["request-negotiable-quote-form__banner"])}),C&&a(h,{node:C,className:u(["request-negotiable-quote-form__title"])}),_&&a(h,{node:_,className:u(["request-negotiable-quote-form__comment-field"])}),F&&a(h,{node:F,className:u(["request-negotiable-quote-form__quote-name-field"])}),N&&a(h,{node:N,className:u(["request-negotiable-quote-form__attach-file-field"])}),P("div",{className:u(["request-negotiable-quote-form__actions"]),children:[s&&a(h,{node:s,className:u(["request-negotiable-quote-form__request-button"])}),d&&a(h,{node:d,className:u(["request-negotiable-quote-form__save-button"])})]})]}),Qe=({cartId:i,enableFileUpload:C=!0,slots:e,onRequestNegotiableQuote:_,onSaveNegotiableQuote:F,onAttachFiles:N,onSubmitErrors:s,onError:d,className:E})=>{const[x,Z]=g(void 0),[A,T]=g(void 0),[K,O]=g([]),[b,v]=g(void 0),[m,l]=g({}),[y,W]=g(void 0),[n,f]=g(!1),o=le({title:"NegotiableQuote.Request.title",comment:"NegotiableQuote.Request.comment",commentError:"NegotiableQuote.Request.commentError",quoteName:"NegotiableQuote.Request.quoteName",quoteNameError:"NegotiableQuote.Request.quoteNameError",attachmentsError:"NegotiableQuote.Request.attachmentsError",requestCta:"NegotiableQuote.Request.requestCta",saveDraftCta:"NegotiableQuote.Request.saveDraftCta",errorHeader:"NegotiableQuote.Request.error.header",unauthenticated:"NegotiableQuote.Request.error.unauthenticated",unauthorized:"NegotiableQuote.Request.error.unauthorized",missingCart:"NegotiableQuote.Request.error.missingCart",successHeader:"NegotiableQuote.Request.success.header",submitSuccess:"NegotiableQuote.Request.success.submitted",draftSuccess:"NegotiableQuote.Request.success.draftSaved"});R(()=>{const t=I.on("quote-management/permissions",r=>{v(void 0),r.requestQuote||(v(o.unauthorized),f(!0))},{eager:!0});return()=>t==null?void 0:t.off()},[o.unauthorized]),R(()=>{const t=I.on("authenticated",r=>{v(void 0),r||(v(o.unauthenticated),f(!0))},{eager:!0});return()=>t==null?void 0:t.off()},[o.unauthenticated]),R(()=>{i||(v(o.missingCart),f(!0))},[i,o.missingCart]),R(()=>{b&&(d==null||d({error:b,isFormDisabled:n,setIsFormDisabled:f}))},[b,d,n]);const H=oe(async t=>{if(t!=null&&t.length){if(l(r=>({...r,attachments:""})),N){try{await N(t)}catch{l(r=>({...r,attachments:o.attachmentsError}))}return}try{const r=await Promise.all(t.map(de));O(r.map(({key:p})=>({key:p})))}catch{l(r=>({...r,attachments:o.attachmentsError}))}}},[N,o]),$=()=>{let t,r;if(y?(r={name:"SuccessBanner",slot:e==null?void 0:e.SuccessBanner,context:{message:y},"data-testid":"form-success-banner"},t={type:"success",variant:"primary",icon:a(ge,{}),heading:o.successHeader,description:y,className:"request-negotiable-quote-form__success-banner"}):b&&(r={name:"ErrorBanner",slot:e==null?void 0:e.ErrorBanner,context:{message:b},"data-testid":"form-error-banner"},t={type:"error",variant:"primary",icon:a(he,{}),heading:o.errorHeader,description:b,className:"request-negotiable-quote-form__error-banner"}),r&&t)return a(q,{...r,children:a(me,{...t})})},D=t=>{l({});const r=t.target.closest("form"),p=j(r);Object.keys(p).length>0&&(l(p),s==null||s(p))},G=t=>{var V;t.preventDefault(),f(!0);const r=t.target,M={...j(r),...m};if(Object.keys(M).length>0){s==null||s(M);return}const B=t.submitter,Q=ne(r);Z(Q.comment),T(Q.quoteName);const S=((V=B==null?void 0:B.dataset)==null?void 0:V.draft)==="true"||!1,ae={cartId:i,quoteName:Q.quoteName,comment:Q.comment,attachments:C?K:void 0,isDraft:S};let k,L;S?(k=F??w,L=o.draftSuccess):(k=_??w,L=o.submitSuccess),k(ae).then(()=>{W(L)}).catch(re=>{v(re.message)})},J=a(q,{name:"Title",slot:e==null?void 0:e.Title,context:{text:o.title},children:a("span",{"data-testid":"form-title",children:o.title})}),X=a(q,{name:"CommentField",slot:e==null?void 0:e.CommentField,context:{value:x,required:!0,errorMessage:m.comment,setFormErrors:l,isFormDisabled:n},children:a(ie,{name:"comment",value:x,label:o.comment,required:!0,autoComplete:"off","data-testid":"form-comment-field",errorMessage:m.comment,disabled:n})}),Y=a(q,{name:"QuoteNameField",slot:e==null?void 0:e.QuoteNameField,context:{value:A,required:!0,errorMessage:m.quoteName,setFormErrors:l,isFormDisabled:n},children:a(ce,{error:m.quoteName,disabled:n,children:a(se,{value:A,name:"quoteName",floatingLabel:o.quoteName,required:!0,autoComplete:"off","data-testid":"form-quote-name-field"})})}),U=C?a(q,{name:"AttachFileField",slot:e==null?void 0:e.AttachFileField,context:{onChange:H,formErrors:m,isFormDisabled:n},children:a(ue,{onChange:t=>{const r=Array.from(t.target.files);r.length>0&&H(r)},icon:a(fe,{}),disabled:n,"data-testid":"form-attach-file-field"})}):void 0,ee=a(q,{name:"RequestButton",slot:e==null?void 0:e.RequestButton,context:{requestNegotiableQuote:w,formErrors:m,isFormDisabled:n,setIsFormDisabled:f},children:a(z,{type:"submit","data-testid":"form-request-button",onClick:D,disabled:n,children:o.requestCta})}),te=a(q,{name:"SaveDraftButton",slot:e==null?void 0:e.SaveDraftButton,context:{requestNegotiableQuote:w,formErrors:m,isFormDisabled:n,setIsFormDisabled:f},children:a(z,{type:"submit","data-draft":"true",variant:"secondary","data-testid":"form-save-draft-button",onClick:D,disabled:n,children:o.saveDraftCta})});return a(qe,{title:J,banner:$(),commentField:X,quoteNameField:Y,attachFile:U,requestButton:ee,saveButton:te,onSubmit:G,className:E,disabled:n,"data-testid":"form-container"})};export{Qe as RequestNegotiableQuoteForm,Qe as default};
3
+ import{jsxs as K,jsx as a}from"@dropins/tools/preact-jsx-runtime.js";import{useState as x,useEffect as L,useCallback as G}from"@dropins/tools/preact-compat.js";import{classes as c,VComponent as N,Slot as b,getFormErrors as J,getFormValues as me}from"@dropins/tools/lib.js";import{TextArea as ce,Field as de,Input as le,InputFile as fe,Button as T,InLineAlert as qe}from"@dropins/tools/components.js";/* empty css */import{events as U}from"@dropins/tools/event-bus.js";import{r as H}from"../chunks/requestNegotiableQuote.js";import"../chunks/state.js";import{u as ge}from"../chunks/uploadFile.js";import{v as he,f as Ne,a as be,S as pe,A as ve}from"../chunks/AttachedFilesList.js";import"@dropins/tools/preact.js";import"@dropins/tools/preact-hooks.js";/* empty css *//* empty css */import{S as Fe}from"../chunks/CheckWithCircle.js";import{S as Qe}from"../chunks/WarningFilled.js";import{useText as Re}from"@dropins/tools/i18n.js";import"../chunks/NegotiableQuoteFragment.js";import"../chunks/transform-quote.js";import"@dropins/tools/fetch-graphql.js";const xe=({className:S,title:t,banner:B,commentField:D,quoteNameField:C,attachFile:d,attachedFilesList:p,requestButton:z,saveButton:v,onSubmit:_,...g})=>K("form",{...g,className:c(["request-negotiable-quote-form",S]),onSubmit:_,children:[B&&a(N,{node:B,className:c(["request-negotiable-quote-form__banner"])}),t&&a(N,{node:t,className:c(["request-negotiable-quote-form__title"])}),D&&a(N,{node:D,className:c(["request-negotiable-quote-form__comment-field"])}),C&&a(N,{node:C,className:c(["request-negotiable-quote-form__quote-name-field"])}),d&&a(N,{node:d,className:c(["request-negotiable-quote-form__attach-file-field"])}),p&&a(N,{node:p,className:c(["request-negotiable-quote-form__attached-files-list"])}),K("div",{className:c(["request-negotiable-quote-form__actions"]),children:[z&&a(N,{node:z,className:c(["request-negotiable-quote-form__request-button"])}),v&&a(N,{node:v,className:c(["request-negotiable-quote-form__save-button"])})]})]}),We=({cartId:S,slots:t,onRequestNegotiableQuote:B,onSaveNegotiableQuote:D,onAttachFiles:C,onSubmitErrors:d,onError:p,className:z,maxFiles:v,maxFileSize:_,acceptedFileTypes:g})=>{const[w,X]=x(void 0),[P,Y]=x(void 0),[F,E]=x([]),[y,k]=x(void 0),[h,u]=x({}),[j,Z]=x(void 0),[i,l]=x(!1),n=Re({title:"NegotiableQuote.Request.title",comment:"NegotiableQuote.Request.comment",commentError:"NegotiableQuote.Request.commentError",quoteName:"NegotiableQuote.Request.quoteName",quoteNameError:"NegotiableQuote.Request.quoteNameError",attachmentsError:"NegotiableQuote.Request.attachmentsError",maxFilesExceeded:"NegotiableQuote.Request.maxFilesExceeded",maxFileSizeExceeded:"NegotiableQuote.Request.maxFileSizeExceeded",invalidFileType:"NegotiableQuote.Request.invalidFileType",requestCta:"NegotiableQuote.Request.requestCta",saveDraftCta:"NegotiableQuote.Request.saveDraftCta",errorHeader:"NegotiableQuote.Request.error.header",unauthenticated:"NegotiableQuote.Request.error.unauthenticated",unauthorized:"NegotiableQuote.Request.error.unauthorized",missingCart:"NegotiableQuote.Request.error.missingCart",successHeader:"NegotiableQuote.Request.success.header",submitSuccess:"NegotiableQuote.Request.success.submitted",draftSuccess:"NegotiableQuote.Request.success.draftSaved"});L(()=>{const e=U.on("quote-management/permissions",o=>{k(void 0),o.requestQuote?l(!1):(k(n.unauthorized),l(!0))},{eager:!0});return()=>e==null?void 0:e.off()},[n.unauthorized]),L(()=>{const e=U.on("authenticated",o=>{k(void 0),o?l(!1):(k(n.unauthenticated),l(!0))},{eager:!0});return()=>e==null?void 0:e.off()},[n.unauthenticated]),L(()=>{S||(k(n.missingCart),l(!0))},[S,n.missingCart]),L(()=>{y&&(p==null||p({error:y,isFormDisabled:i,setIsFormDisabled:l}))},[y,p,i]);const V=G(async e=>{var s;if(!(e!=null&&e.length))return;if(v&&F.length+e.length>v){u(r=>({...r,attachments:n.maxFilesExceeded.replace("{maxFiles}",String(v))}));return}for(const r of e){if(_&&!he(r.size,_)){u(m=>({...m,attachments:n.maxFileSizeExceeded.replace("{maxSize}",Ne(_))}));return}if(g&&!be(r.type,g)){u(m=>({...m,attachments:n.invalidFileType}));return}}if(u(r=>{const{attachments:m,...f}=r;return f}),C){(s=C(e))==null||s.catch(()=>{u(r=>({...r,attachments:n.attachmentsError}))});return}const o=e.map(r=>({key:`temp-${Date.now()}-${Math.random()}-${r.name}`,name:r.name,size:r.size,status:"uploading"}));E(r=>[...r,...o]);for(let r=0;r<e.length;r++){const m=e[r],f=o[r].key;try{const Q=await ge(m);E(R=>R.map(q=>q.key===f?{...q,key:Q.key,status:"success"}:q))}catch(Q){u(R=>({...R,attachments:Q.message})),E(R=>R.map(q=>q.key===f?{...q,status:"error",error:Q.message}:q))}}},[C,n,v,_,g,F]),I=G(e=>{E(o=>o.filter(s=>s.key!==e))},[]),ee=()=>{let e,o;if(j?(o={name:"SuccessBanner",slot:t==null?void 0:t.SuccessBanner,context:{message:j},"data-testid":"form-success-banner"},e={type:"success",variant:"primary",icon:a(Fe,{}),heading:n.successHeader,description:j,className:"request-negotiable-quote-form__success-banner"}):y&&(o={name:"ErrorBanner",slot:t==null?void 0:t.ErrorBanner,context:{message:y},"data-testid":"form-error-banner"},e={type:"error",variant:"primary",icon:a(Qe,{}),heading:n.errorHeader,description:y,className:"request-negotiable-quote-form__error-banner"}),o&&e)return a(b,{...o,children:a(qe,{...e})})},O=e=>{u({});const o=e.target.closest("form"),s=J(o);Object.keys(s).length>0&&(u(s),d==null||d(s))},te=e=>{var W;e.preventDefault(),l(!0);const o=e.target,r={...J(o),...h};if(Object.keys(r).length>0){d==null||d(r);return}const m=e.submitter,f=me(o);X(f.comment),Y(f.quoteName);const Q=((W=m==null?void 0:m.dataset)==null?void 0:W.draft)==="true"||!1,R=F.filter(A=>A.status==="success").map(A=>({key:A.key})),q={cartId:S,quoteName:f.quoteName,comment:f.comment,attachments:R,isDraft:Q};let M,$;Q?(M=D??H,$=n.draftSuccess):(M=B??H,$=n.submitSuccess),M(q).then(()=>{Z($)}).catch(A=>{k(A.message)})},ae=a(b,{name:"Title",slot:t==null?void 0:t.Title,context:{text:n.title},children:a("span",{"data-testid":"form-title",children:n.title})}),re=a(b,{name:"CommentField",slot:t==null?void 0:t.CommentField,context:{value:w,required:!0,errorMessage:h.comment,setFormErrors:u,isFormDisabled:i},children:a(ce,{name:"comment",value:w,label:n.comment,required:!0,autoComplete:"off","data-testid":"form-comment-field",errorMessage:h.comment,disabled:i})}),oe=a(b,{name:"QuoteNameField",slot:t==null?void 0:t.QuoteNameField,context:{value:P,required:!0,errorMessage:h.quoteName,setFormErrors:u,isFormDisabled:i},children:a(de,{error:h.quoteName,disabled:i,children:a(le,{value:P,name:"quoteName",floatingLabel:n.quoteName,required:!0,autoComplete:"off","data-testid":"form-quote-name-field"})})}),ne=a(b,{name:"AttachFileField",slot:t==null?void 0:t.AttachFileField,context:{onChange:V,formErrors:h,isFormDisabled:i,attachedFiles:F},children:a(fe,{multiple:!0,onChange:e=>{const o=e.target,s=o==null?void 0:o.files,r=s?Array.from(s):[];r.length>0&&V(r)},icon:a(pe,{}),disabled:i,"data-testid":"form-attach-file-field",accept:g==null?void 0:g.join(",")})}),ie=F.length>0?a(b,{name:"AttachedFilesList",slot:t==null?void 0:t.AttachedFilesList,context:{files:F,onRemove:I,disabled:i},children:a(ve,{files:F,onRemove:I,disabled:i})}):void 0,se=a(b,{name:"RequestButton",slot:t==null?void 0:t.RequestButton,context:{requestNegotiableQuote:H,formErrors:h,isFormDisabled:i,setIsFormDisabled:l},children:a(T,{type:"submit","data-testid":"form-request-button",onClick:O,disabled:i,children:n.requestCta})}),ue=a(b,{name:"SaveDraftButton",slot:t==null?void 0:t.SaveDraftButton,context:{requestNegotiableQuote:H,formErrors:h,isFormDisabled:i,setIsFormDisabled:l},children:a(T,{type:"submit","data-draft":"true",variant:"secondary","data-testid":"form-save-draft-button",onClick:O,disabled:i,children:n.saveDraftCta})});return a(xe,{title:ae,banner:ee(),commentField:re,quoteNameField:oe,attachFile:ne,attachedFilesList:ie,requestButton:se,saveButton:ue,onSubmit:te,className:z,disabled:i,"data-testid":"form-container"})};export{We as RequestNegotiableQuoteForm,We as default};
4
4
  //# sourceMappingURL=RequestNegotiableQuoteForm.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"RequestNegotiableQuoteForm.js","sources":["../../node_modules/@adobe-commerce/elsie/src/icons/Add.svg","../../node_modules/@adobe-commerce/elsie/src/icons/CheckWithCircle.svg","../../node_modules/@adobe-commerce/elsie/src/icons/WarningFilled.svg","/@dropins/storefront-quote-management/src/components/RequestNegotiableQuoteForm/RequestNegotiableQuoteForm.tsx","/@dropins/storefront-quote-management/src/containers/RequestNegotiableQuoteForm/RequestNegotiableQuoteForm.tsx"],"sourcesContent":["import * as React from \"react\";\nconst SvgAdd = (props) => /* @__PURE__ */ React.createElement(\"svg\", { id: \"Icon_Add_Base\", \"data-name\": \"Icon \\\\u2013 Add \\\\u2013 Base\", xmlns: \"http://www.w3.org/2000/svg\", width: 24, height: 24, viewBox: \"0 0 24 24\", ...props }, /* @__PURE__ */ React.createElement(\"g\", { id: \"Large\" }, /* @__PURE__ */ React.createElement(\"rect\", { id: \"Placement_area\", \"data-name\": \"Placement area\", width: 24, height: 24, fill: \"#fff\", opacity: 0 }), /* @__PURE__ */ React.createElement(\"g\", { id: \"Add_icon\", \"data-name\": \"Add icon\", transform: \"translate(9.734 9.737)\" }, /* @__PURE__ */ React.createElement(\"line\", { vectorEffect: \"non-scaling-stroke\", id: \"Line_579\", \"data-name\": \"Line 579\", y2: 12.7, transform: \"translate(2.216 -4.087)\", fill: \"none\", stroke: \"currentColor\" }), /* @__PURE__ */ React.createElement(\"line\", { vectorEffect: \"non-scaling-stroke\", id: \"Line_580\", \"data-name\": \"Line 580\", x2: 12.7, transform: \"translate(-4.079 2.263)\", fill: \"none\", stroke: \"currentColor\" }))));\nexport default SvgAdd;\n","import * as React from \"react\";\nconst SvgCheckWithCircle = (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\", d: \"M0.75 12C0.75 5.78421 5.78421 0.75 12 0.75C18.2158 0.75 23.25 5.78421 23.25 12C23.25 18.2158 18.2158 23.25 12 23.25C5.78421 23.25 0.75 18.2158 0.75 12Z\", stroke: \"currentColor\" }), /* @__PURE__ */ React.createElement(\"path\", { vectorEffect: \"non-scaling-stroke\", d: \"M6.75 12.762L10.2385 15.75L17.25 9\", stroke: \"currentColor\" }));\nexport default SvgCheckWithCircle;\n","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","/********************************************************************\n * Copyright 2025 Adobe\n * All Rights Reserved.\n *\n * NOTICE: Adobe permits you to use, modify, and distribute this \n * file in accordance with the terms of the Adobe license agreement \n * accompanying it. \n *******************************************************************/\n\nimport { FunctionComponent, VNode } from 'preact';\nimport { HTMLAttributes } from 'preact/compat';\nimport { classes, VComponent } from '@adobe-commerce/elsie/lib';\nimport '@/quote-management/components/RequestNegotiableQuoteForm/RequestNegotiableQuoteForm.css';\n\nexport interface RequestNegotiableQuoteFormProps extends Omit<HTMLAttributes<HTMLFormElement>, 'title'> {\n title: VNode;\n banner?: VNode;\n commentField?: VNode;\n quoteNameField?: VNode;\n attachFile?: VNode;\n requestButton?: VNode;\n saveButton?: VNode;\n onSubmit: (e: Event) => void;\n}\n\nexport const RequestNegotiableQuoteForm: FunctionComponent<RequestNegotiableQuoteFormProps> = ({\n className,\n title,\n banner,\n commentField,\n quoteNameField,\n attachFile,\n requestButton,\n saveButton,\n onSubmit,\n ...props\n}) => {\n return (\n <form {...props} className={classes(['request-negotiable-quote-form', className])} onSubmit={onSubmit}>\n {banner &&\n <VComponent\n node={banner}\n className={classes(['request-negotiable-quote-form__banner'])}\n />\n }\n {title &&\n <VComponent\n node={title}\n className={classes(['request-negotiable-quote-form__title'])}\n />\n }\n {commentField &&\n <VComponent\n node={commentField}\n className={classes(['request-negotiable-quote-form__comment-field'])}\n />\n }\n {quoteNameField &&\n <VComponent\n node={quoteNameField}\n className={classes(['request-negotiable-quote-form__quote-name-field'])}\n />\n }\n {attachFile &&\n <VComponent\n node={attachFile}\n className={classes(['request-negotiable-quote-form__attach-file-field'])}\n />\n }\n <div className={classes(['request-negotiable-quote-form__actions'])}>\n {requestButton &&\n <VComponent\n node={requestButton}\n className={classes(['request-negotiable-quote-form__request-button'])}\n />\n }\n {saveButton &&\n <VComponent\n node={saveButton}\n className={classes(['request-negotiable-quote-form__save-button'])}\n />\n }\n </div>\n </form>\n );\n};\n","/********************************************************************\n * Copyright 2025 Adobe\n * All Rights Reserved.\n *\n * NOTICE: Adobe permits you to use, modify, and distribute this \n * file in accordance with the terms of the Adobe license agreement \n * accompanying it. \n *******************************************************************/\n\nimport { HTMLAttributes, useCallback, useEffect, useState } from 'preact/compat';\nimport { Container, getFormErrors, getFormValues, Slot, SlotProps } from '@adobe-commerce/elsie/lib';\nimport { InLineAlert, Button, InputFile, TextArea, Input, Field, InLineAlertProps } from '@adobe-commerce/elsie/components';\nimport { WarningFilled, CheckWithCircle, Add } from '@adobe-commerce/elsie/icons';\nimport RequestNegotiableQuoteFormComponent from '@/quote-management/components/RequestNegotiableQuoteForm';\nimport { useText } from '@adobe-commerce/elsie/i18n';\nimport { events } from '@adobe-commerce/event-bus';\nimport { requestNegotiableQuote, RequestNegotiableQuoteInput, uploadFile } from '@/quote-management/api';\nimport { state } from '@/quote-management/lib/state';\n\nexport type RequestNegotiableQuoteHandlers = {\n onAttachFiles?: (files: File[]) => Promise<void>;\n onRequestNegotiableQuote?: typeof requestNegotiableQuote;\n onSaveNegotiableQuote?: typeof requestNegotiableQuote;\n onSubmitErrors?: (errors: Record<string, string>) => void;\n onError?: (props: {\n error: string,\n isFormDisabled: boolean,\n setIsFormDisabled: (isFormDisabled: boolean) => void,\n }) => void;\n};\n\nexport interface RequestNegotiableQuoteFormProps\n extends Omit<HTMLAttributes<HTMLDivElement>, 'onError'>,\n RequestNegotiableQuoteHandlers {\n cartId: string;\n enableFileUpload?: boolean;\n slots?: {\n ErrorBanner?: SlotProps<{\n message: string,\n }>;\n SuccessBanner?: SlotProps<{\n message: string,\n }>;\n Title?: SlotProps<{\n text: string,\n }>;\n CommentField?: SlotProps<{\n formErrors: Record<string, string>;\n isFormDisabled: boolean;\n setFormErrors: (errors: Record<string, string>) => void;\n }>;\n QuoteNameField?: SlotProps<{\n formErrors: Record<string, string>;\n isFormDisabled: boolean;\n setFormErrors: (errors: Record<string, string>) => void;\n }>;\n AttachFileField?: SlotProps<{\n onChange: (files: File[]) => void, formErrors: Record<string, string>,\n isFormDisabled: boolean\n }>;\n RequestButton?: SlotProps<{\n requestNegotiableQuote: typeof requestNegotiableQuote;\n formErrors: Record<string, string>;\n isFormDisabled: boolean;\n setIsFormDisabled: (isFormDisabled: boolean) => void;\n }>;\n SaveDraftButton?: SlotProps<{\n requestNegotiableQuote: typeof requestNegotiableQuote;\n formErrors: Record<string, string>;\n isFormDisabled: boolean;\n setIsFormDisabled: (isFormDisabled: boolean) => void;\n }>;\n };\n}\n\nexport const RequestNegotiableQuoteForm: Container<RequestNegotiableQuoteFormProps> = ({\n cartId,\n enableFileUpload = true,\n slots,\n onRequestNegotiableQuote,\n onSaveNegotiableQuote,\n onAttachFiles,\n onSubmitErrors,\n onError,\n className,\n}) => {\n const [comment, setComment] = useState<string | undefined>(undefined);\n const [quoteName, setQuoteName] = useState<string | undefined>(undefined);\n const [attachmentKeys, setAttachmentKeys] = useState<{ key: string }[]>([]);\n const [error, setError] = useState<string | undefined>(undefined);\n const [formErrors, setFormErrors] = useState<Record<string, string>>({});\n const [success, setSuccess] = useState<string | undefined>(undefined);\n const [isFormDisabled, setIsFormDisabled] = useState<boolean>(false);\n\n const dictionary = useText({\n title: 'NegotiableQuote.Request.title',\n comment: 'NegotiableQuote.Request.comment',\n commentError: 'NegotiableQuote.Request.commentError',\n quoteName: 'NegotiableQuote.Request.quoteName',\n quoteNameError: 'NegotiableQuote.Request.quoteNameError',\n attachmentsError: 'NegotiableQuote.Request.attachmentsError',\n requestCta: 'NegotiableQuote.Request.requestCta',\n saveDraftCta: 'NegotiableQuote.Request.saveDraftCta',\n errorHeader: 'NegotiableQuote.Request.error.header',\n unauthenticated: 'NegotiableQuote.Request.error.unauthenticated',\n unauthorized: 'NegotiableQuote.Request.error.unauthorized',\n missingCart: 'NegotiableQuote.Request.error.missingCart',\n successHeader: 'NegotiableQuote.Request.success.header',\n submitSuccess: 'NegotiableQuote.Request.success.submitted',\n draftSuccess: 'NegotiableQuote.Request.success.draftSaved',\n });\n\n useEffect(() => {\n const permissionsEvent = events.on(\n 'quote-management/permissions',\n (permissions: typeof state.permissions) => {\n setError(undefined);\n if (!permissions.requestQuote) {\n setError(dictionary.unauthorized);\n setIsFormDisabled(true);\n }\n },\n { eager: true }\n );\n return () => permissionsEvent?.off();\n }, [dictionary.unauthorized]);\n\n useEffect(() => {\n const authenticatedEvent = events.on(\n 'authenticated',\n (authenticated: boolean) => {\n setError(undefined);\n if (!authenticated) {\n setError(dictionary.unauthenticated);\n setIsFormDisabled(true);\n }\n },\n { eager: true }\n );\n return () => authenticatedEvent?.off();\n }, [dictionary.unauthenticated]);\n\n useEffect(() => {\n if (!cartId) {\n setError(dictionary.missingCart);\n setIsFormDisabled(true);\n }\n }, [cartId, dictionary.missingCart]);\n\n useEffect(() => {\n if (error) {\n onError?.({ error, isFormDisabled, setIsFormDisabled });\n }\n }, [error, onError, isFormDisabled]);\n\n const handleAttachFiles = useCallback(async (files: File[]) => {\n /* istanbul ignore next: defensive guard; */\n if (!files?.length) return;\n\n setFormErrors(prev => ({ ...prev, attachments: '' }));\n\n if (onAttachFiles) {\n try {\n await onAttachFiles(files);\n } catch {\n setFormErrors(prev => ({ ...prev, attachments: dictionary.attachmentsError }));\n }\n return;\n }\n\n try {\n const uploaded = await Promise.all(files.map(uploadFile));\n setAttachmentKeys(uploaded.map(({ key }) => ({ key })));\n } catch {\n setFormErrors(prev => ({ ...prev, attachments: dictionary.attachmentsError }));\n }\n }, [onAttachFiles, dictionary]);\n\n /*\n * This function is used to get the banner node.\n * It can be used to render a success or error banner depending on the success or error state.\n */\n const getBannerNode = () => {\n let inlineAlertProps: InLineAlertProps | undefined;\n let slotProps: any | undefined;\n\n if (success) {\n slotProps = {\n name: 'SuccessBanner',\n slot: slots?.SuccessBanner,\n context: {\n message: success,\n },\n 'data-testid': 'form-success-banner',\n };\n inlineAlertProps = {\n type: 'success',\n variant: 'primary',\n icon: <CheckWithCircle />,\n heading: dictionary.successHeader,\n description: success,\n className: 'request-negotiable-quote-form__success-banner',\n };\n }\n else if (error) {\n slotProps = {\n name: 'ErrorBanner',\n slot: slots?.ErrorBanner,\n context: {\n message: error,\n },\n 'data-testid': 'form-error-banner',\n };\n inlineAlertProps = {\n type: 'error',\n variant: 'primary',\n icon: <WarningFilled />,\n heading: dictionary.errorHeader,\n description: error,\n className: 'request-negotiable-quote-form__error-banner',\n };\n }\n\n if (slotProps && inlineAlertProps) {\n return <Slot {...slotProps}>\n <InLineAlert {...inlineAlertProps} />\n </Slot>;\n }\n\n return undefined;\n }\n\n /*\n * This function is used to validate the parent form of the button that was clicked.\n */\n const validateParentForm = (e: Event) => {\n setFormErrors({});\n const closestForm = (e.target as HTMLElement).closest('form') as HTMLFormElement;\n const formErrors = getFormErrors(closestForm);\n if (Object.keys(formErrors).length > 0) {\n setFormErrors(formErrors);\n onSubmitErrors?.(formErrors);\n }\n };\n\n const formSubmitHandler = (e: Event) => {\n e.preventDefault();\n setIsFormDisabled(true);\n\n const form = (e.target as HTMLFormElement);\n\n const currentFormErrors = getFormErrors(form);\n\n const mergedFormErrors = { ...currentFormErrors, ...formErrors };\n\n if (Object.keys(mergedFormErrors).length > 0) {\n onSubmitErrors?.(mergedFormErrors)\n return;\n }\n\n // Since we have multiple submit buttons, we need to determine which one was clicked.\n const buttonTarget = (e as SubmitEvent).submitter as HTMLButtonElement;\n\n const formValues = getFormValues(form);\n\n setComment(formValues.comment);\n setQuoteName(formValues.quoteName);\n\n const isDraft = buttonTarget?.dataset?.draft === 'true' || false;\n\n const contextData: RequestNegotiableQuoteInput = {\n cartId: cartId!,\n quoteName: formValues.quoteName,\n comment: formValues.comment,\n attachments: enableFileUpload ? attachmentKeys : undefined,\n isDraft,\n }\n\n let submitHandler;\n let successMessage;\n\n if (isDraft) {\n submitHandler = onSaveNegotiableQuote ?? requestNegotiableQuote;\n successMessage = dictionary.draftSuccess;\n } else {\n submitHandler = onRequestNegotiableQuote ?? requestNegotiableQuote;\n successMessage = dictionary.submitSuccess;\n }\n\n submitHandler(contextData).then(() => {\n setSuccess(successMessage);\n })\n .catch(error => {\n setError(error.message);\n })\n };\n\n const titleNode = (\n <Slot name=\"Title\" slot={slots?.Title} context={{ text: dictionary.title }}>\n <span data-testid=\"form-title\">{dictionary.title}</span>\n </Slot>\n );\n\n const commentFieldNode = (\n <Slot\n name=\"CommentField\"\n slot={slots?.CommentField}\n context={{\n value: comment,\n required: true,\n errorMessage: formErrors.comment,\n setFormErrors,\n isFormDisabled\n } as any}\n >\n <TextArea\n name=\"comment\"\n value={comment}\n label={dictionary.comment}\n required\n autoComplete=\"off\"\n data-testid=\"form-comment-field\"\n errorMessage={formErrors.comment}\n disabled={isFormDisabled}\n />\n </Slot>\n );\n\n const quoteNameFieldNode = (\n <Slot\n name=\"QuoteNameField\"\n slot={slots?.QuoteNameField}\n context={{\n value: quoteName,\n required: true,\n errorMessage: formErrors.quoteName,\n setFormErrors,\n isFormDisabled\n } as any}\n >\n <Field\n error={formErrors.quoteName}\n disabled={isFormDisabled}\n >\n <Input\n value={quoteName}\n name=\"quoteName\"\n floatingLabel={dictionary.quoteName}\n required\n autoComplete=\"off\"\n data-testid=\"form-quote-name-field\"\n />\n </Field>\n </Slot>\n );\n\n const attachFileNode = enableFileUpload ? (\n <Slot\n name=\"AttachFileField\"\n slot={slots?.AttachFileField}\n context={{ onChange: handleAttachFiles, formErrors, isFormDisabled }}\n >\n <InputFile\n onChange={(e: any) => {\n const files = Array.from(((e.target as HTMLInputElement).files!));\n\n if (files.length > 0) {\n handleAttachFiles(files)\n }\n }}\n icon={<Add />}\n disabled={isFormDisabled}\n data-testid=\"form-attach-file-field\"\n />\n </Slot>\n ) : undefined;\n\n const requestButtonNode = (\n <Slot\n name=\"RequestButton\"\n slot={slots?.RequestButton}\n context={\n {\n requestNegotiableQuote,\n formErrors,\n isFormDisabled,\n setIsFormDisabled\n }\n }\n >\n <Button\n type=\"submit\"\n data-testid=\"form-request-button\"\n onClick={validateParentForm}\n disabled={isFormDisabled}\n >\n {dictionary.requestCta}\n </Button>\n </Slot>\n );\n\n const saveButtonNode = (\n <Slot\n name=\"SaveDraftButton\"\n slot={slots?.SaveDraftButton}\n context={\n {\n requestNegotiableQuote,\n formErrors,\n isFormDisabled,\n setIsFormDisabled\n }\n }\n >\n <Button\n type=\"submit\"\n data-draft=\"true\"\n variant=\"secondary\"\n data-testid=\"form-save-draft-button\"\n onClick={validateParentForm}\n disabled={isFormDisabled}\n >\n {dictionary.saveDraftCta}\n </Button>\n </Slot>\n );\n\n return (\n <RequestNegotiableQuoteFormComponent\n title={titleNode}\n banner={getBannerNode()}\n commentField={commentFieldNode}\n quoteNameField={quoteNameFieldNode}\n attachFile={attachFileNode}\n requestButton={requestButtonNode}\n saveButton={saveButtonNode}\n onSubmit={formSubmitHandler}\n className={className}\n disabled={isFormDisabled}\n data-testid=\"form-container\"\n />\n );\n};"],"names":["SvgAdd","props","React","SvgCheckWithCircle","SvgWarningFilled","RequestNegotiableQuoteForm","className","title","banner","commentField","quoteNameField","attachFile","requestButton","saveButton","onSubmit","jsxs","classes","jsx","VComponent","cartId","enableFileUpload","slots","onRequestNegotiableQuote","onSaveNegotiableQuote","onAttachFiles","onSubmitErrors","onError","comment","setComment","useState","quoteName","setQuoteName","attachmentKeys","setAttachmentKeys","error","setError","formErrors","setFormErrors","success","setSuccess","isFormDisabled","setIsFormDisabled","dictionary","useText","useEffect","permissionsEvent","events","permissions","authenticatedEvent","authenticated","handleAttachFiles","useCallback","files","prev","uploaded","uploadFile","key","getBannerNode","inlineAlertProps","slotProps","CheckWithCircle","WarningFilled","Slot","InLineAlert","validateParentForm","e","closestForm","getFormErrors","formSubmitHandler","form","mergedFormErrors","buttonTarget","formValues","getFormValues","isDraft","_a","contextData","submitHandler","successMessage","requestNegotiableQuote","titleNode","commentFieldNode","TextArea","quoteNameFieldNode","Field","Input","attachFileNode","InputFile","Add","requestButtonNode","Button","saveButtonNode","RequestNegotiableQuoteFormComponent"],"mappings":"kpBACA,MAAMA,GAAUC,GAA0BC,EAAM,cAAc,MAAO,CAAE,GAAI,gBAAiB,YAAa,gCAAiC,MAAO,6BAA8B,MAAO,GAAI,OAAQ,GAAI,QAAS,YAAa,GAAGD,GAAyBC,EAAM,cAAc,IAAK,CAAE,GAAI,OAAO,EAAoBA,EAAM,cAAc,OAAQ,CAAE,GAAI,iBAAkB,YAAa,iBAAkB,MAAO,GAAI,OAAQ,GAAI,KAAM,OAAQ,QAAS,CAAC,CAAE,EAAmBA,EAAM,cAAc,IAAK,CAAE,GAAI,WAAY,YAAa,WAAY,UAAW,wBAAwB,EAAoBA,EAAM,cAAc,OAAQ,CAAE,aAAc,qBAAsB,GAAI,WAAY,YAAa,WAAY,GAAI,KAAM,UAAW,0BAA2B,KAAM,OAAQ,OAAQ,cAAc,CAAE,EAAmBA,EAAM,cAAc,OAAQ,CAAE,aAAc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["/@dropins/storefront-quote-management/src/components/RequestNegotiableQuoteForm/RequestNegotiableQuoteForm.tsx","/@dropins/storefront-quote-management/src/containers/RequestNegotiableQuoteForm/RequestNegotiableQuoteForm.tsx"],"sourcesContent":["/********************************************************************\n * Copyright 2025 Adobe\n * All Rights Reserved.\n *\n * NOTICE: Adobe permits you to use, modify, and distribute this \n * file in accordance with the terms of the Adobe license agreement \n * accompanying it. \n *******************************************************************/\n\nimport { FunctionComponent, VNode } from 'preact';\nimport { HTMLAttributes } from 'preact/compat';\nimport { classes, VComponent } from '@adobe-commerce/elsie/lib';\nimport '@/quote-management/components/RequestNegotiableQuoteForm/RequestNegotiableQuoteForm.css';\n\nexport interface RequestNegotiableQuoteFormProps extends Omit<HTMLAttributes<HTMLFormElement>, 'title'> {\n title: VNode;\n banner?: VNode;\n commentField?: VNode;\n quoteNameField?: VNode;\n attachFile?: VNode;\n attachedFilesList?: VNode;\n requestButton?: VNode;\n saveButton?: VNode;\n onSubmit: (e: Event) => void;\n}\n\nexport const RequestNegotiableQuoteForm: FunctionComponent<RequestNegotiableQuoteFormProps> = ({\n className,\n title,\n banner,\n commentField,\n quoteNameField,\n attachFile,\n attachedFilesList,\n requestButton,\n saveButton,\n onSubmit,\n ...props\n}) => {\n return (\n <form {...props} className={classes(['request-negotiable-quote-form', className])} onSubmit={onSubmit}>\n {banner &&\n <VComponent\n node={banner}\n className={classes(['request-negotiable-quote-form__banner'])}\n />\n }\n {title &&\n <VComponent\n node={title}\n className={classes(['request-negotiable-quote-form__title'])}\n />\n }\n {commentField &&\n <VComponent\n node={commentField}\n className={classes(['request-negotiable-quote-form__comment-field'])}\n />\n }\n {quoteNameField &&\n <VComponent\n node={quoteNameField}\n className={classes(['request-negotiable-quote-form__quote-name-field'])}\n />\n }\n {attachFile &&\n <VComponent\n node={attachFile}\n className={classes(['request-negotiable-quote-form__attach-file-field'])}\n />\n }\n {attachedFilesList &&\n <VComponent\n node={attachedFilesList}\n className={classes(['request-negotiable-quote-form__attached-files-list'])}\n />\n }\n <div className={classes(['request-negotiable-quote-form__actions'])}>\n {requestButton &&\n <VComponent\n node={requestButton}\n className={classes(['request-negotiable-quote-form__request-button'])}\n />\n }\n {saveButton &&\n <VComponent\n node={saveButton}\n className={classes(['request-negotiable-quote-form__save-button'])}\n />\n }\n </div>\n </form>\n );\n};\n","/********************************************************************\n * Copyright 2025 Adobe\n * All Rights Reserved.\n *\n * NOTICE: Adobe permits you to use, modify, and distribute this \n * file in accordance with the terms of the Adobe license agreement \n * accompanying it. \n *******************************************************************/\n\nimport { HTMLAttributes, useCallback, useEffect, useState } from 'preact/compat';\nimport { Container, getFormErrors, getFormValues, Slot, SlotProps } from '@adobe-commerce/elsie/lib';\nimport { InLineAlert, Button, InputFile, TextArea, Input, Field, InLineAlertProps } from '@adobe-commerce/elsie/components';\nimport { WarningFilled, CheckWithCircle, Add } from '@adobe-commerce/elsie/icons';\nimport RequestNegotiableQuoteFormComponent from '@/quote-management/components/RequestNegotiableQuoteForm';\nimport { useText } from '@adobe-commerce/elsie/i18n';\nimport { events } from '@adobe-commerce/event-bus';\nimport { requestNegotiableQuote, RequestNegotiableQuoteInput, uploadFile } from '@/quote-management/api';\nimport { state } from '@/quote-management/lib/state';\nimport { AttachedFilesList, AttachedFile } from '@/quote-management/components';\nimport { formatFileSize, validateFileType, validateFileSize } from '@/quote-management/utils/fileUtils';\n\nexport type RequestNegotiableQuoteHandlers = {\n onAttachFiles?: (files: File[]) => Promise<void>;\n onRequestNegotiableQuote?: typeof requestNegotiableQuote;\n onSaveNegotiableQuote?: typeof requestNegotiableQuote;\n onSubmitErrors?: (errors: Record<string, string>) => void;\n onError?: (props: {\n error: string,\n isFormDisabled: boolean,\n setIsFormDisabled: (isFormDisabled: boolean) => void,\n }) => void;\n};\n\nexport interface RequestNegotiableQuoteFormProps\n extends Omit<HTMLAttributes<HTMLDivElement>, 'onError'>,\n RequestNegotiableQuoteHandlers {\n cartId: string;\n maxFiles?: number;\n maxFileSize?: number;\n acceptedFileTypes?: string[];\n slots?: {\n ErrorBanner?: SlotProps<{\n message: string,\n }>;\n SuccessBanner?: SlotProps<{\n message: string,\n }>;\n Title?: SlotProps<{\n text: string,\n }>;\n CommentField?: SlotProps<{\n formErrors: Record<string, string>;\n isFormDisabled: boolean;\n setFormErrors: (errors: Record<string, string>) => void;\n }>;\n QuoteNameField?: SlotProps<{\n formErrors: Record<string, string>;\n isFormDisabled: boolean;\n setFormErrors: (errors: Record<string, string>) => void;\n }>;\n AttachFileField?: SlotProps<{\n onChange: (files: File[]) => void, formErrors: Record<string, string>,\n isFormDisabled: boolean,\n attachedFiles: AttachedFile[]\n }>;\n AttachedFilesList?: SlotProps<{\n files: AttachedFile[];\n onRemove: (key: string) => void;\n disabled?: boolean;\n }>;\n RequestButton?: SlotProps<{\n requestNegotiableQuote: typeof requestNegotiableQuote;\n formErrors: Record<string, string>;\n isFormDisabled: boolean;\n setIsFormDisabled: (isFormDisabled: boolean) => void;\n }>;\n SaveDraftButton?: SlotProps<{\n requestNegotiableQuote: typeof requestNegotiableQuote;\n formErrors: Record<string, string>;\n isFormDisabled: boolean;\n setIsFormDisabled: (isFormDisabled: boolean) => void;\n }>;\n };\n}\n\nexport const RequestNegotiableQuoteForm: Container<RequestNegotiableQuoteFormProps> = ({\n cartId,\n slots,\n onRequestNegotiableQuote,\n onSaveNegotiableQuote,\n onAttachFiles,\n onSubmitErrors,\n onError,\n className,\n maxFiles,\n maxFileSize,\n acceptedFileTypes,\n}) => {\n const [comment, setComment] = useState<string | undefined>(undefined);\n const [quoteName, setQuoteName] = useState<string | undefined>(undefined);\n const [attachedFiles, setAttachedFiles] = useState<AttachedFile[]>([]);\n const [error, setError] = useState<string | undefined>(undefined);\n const [formErrors, setFormErrors] = useState<Record<string, string>>({});\n const [success, setSuccess] = useState<string | undefined>(undefined);\n const [isFormDisabled, setIsFormDisabled] = useState<boolean>(false);\n\n const dictionary = useText({\n title: 'NegotiableQuote.Request.title',\n comment: 'NegotiableQuote.Request.comment',\n commentError: 'NegotiableQuote.Request.commentError',\n quoteName: 'NegotiableQuote.Request.quoteName',\n quoteNameError: 'NegotiableQuote.Request.quoteNameError',\n attachmentsError: 'NegotiableQuote.Request.attachmentsError',\n maxFilesExceeded: 'NegotiableQuote.Request.maxFilesExceeded',\n maxFileSizeExceeded: 'NegotiableQuote.Request.maxFileSizeExceeded',\n invalidFileType: 'NegotiableQuote.Request.invalidFileType',\n requestCta: 'NegotiableQuote.Request.requestCta',\n saveDraftCta: 'NegotiableQuote.Request.saveDraftCta',\n errorHeader: 'NegotiableQuote.Request.error.header',\n unauthenticated: 'NegotiableQuote.Request.error.unauthenticated',\n unauthorized: 'NegotiableQuote.Request.error.unauthorized',\n missingCart: 'NegotiableQuote.Request.error.missingCart',\n successHeader: 'NegotiableQuote.Request.success.header',\n submitSuccess: 'NegotiableQuote.Request.success.submitted',\n draftSuccess: 'NegotiableQuote.Request.success.draftSaved',\n });\n\n useEffect(() => {\n const permissionsEvent = events.on(\n 'quote-management/permissions',\n (permissions: typeof state.permissions) => {\n setError(undefined);\n if (!permissions.requestQuote) {\n setError(dictionary.unauthorized);\n setIsFormDisabled(true);\n }\n else {\n setIsFormDisabled(false);\n }\n },\n { eager: true }\n );\n return () => permissionsEvent?.off();\n }, [dictionary.unauthorized]);\n\n useEffect(() => {\n const authenticatedEvent = events.on(\n 'authenticated',\n (authenticated: boolean) => {\n setError(undefined);\n if (!authenticated) {\n setError(dictionary.unauthenticated);\n setIsFormDisabled(true);\n }\n else {\n setIsFormDisabled(false);\n }\n },\n { eager: true }\n );\n return () => authenticatedEvent?.off();\n }, [dictionary.unauthenticated]);\n\n useEffect(() => {\n if (!cartId) {\n setError(dictionary.missingCart);\n setIsFormDisabled(true);\n }\n }, [cartId, dictionary.missingCart]);\n\n useEffect(() => {\n if (error) {\n onError?.({ error, isFormDisabled, setIsFormDisabled });\n }\n }, [error, onError, isFormDisabled]);\n\n const handleAttachFiles = useCallback(async (files: File[]) => {\n /* istanbul ignore next: defensive guard; */\n if (!files?.length) return;\n\n // Check maxFiles limit\n if (maxFiles && attachedFiles.length + files.length > maxFiles) {\n setFormErrors(prev => ({\n ...prev,\n attachments: dictionary.maxFilesExceeded.replace('{maxFiles}', String(maxFiles))\n }));\n return;\n }\n\n // Validate file types and sizes before uploading\n for (const file of files) {\n if (maxFileSize && !validateFileSize(file.size, maxFileSize)) {\n setFormErrors(prev => ({\n ...prev,\n attachments: dictionary.maxFileSizeExceeded.replace('{maxSize}', formatFileSize(maxFileSize))\n }));\n return;\n }\n\n if (acceptedFileTypes && !validateFileType(file.type, acceptedFileTypes)) {\n setFormErrors(prev => ({ ...prev, attachments: dictionary.invalidFileType }));\n return;\n }\n }\n\n // Set form errors without attachments key\n setFormErrors(prev => { \n // Disable eslint rule for unused attachments key\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n const { attachments, ...rest } = prev;\n return rest;\n });\n\n\n if (onAttachFiles) {\n onAttachFiles(files)?.catch(() => {\n setFormErrors(prev => ({ ...prev, attachments: dictionary.attachmentsError }));\n });\n return;\n }\n\n // Add files with 'uploading' status\n const newFiles: AttachedFile[] = files.map(file => ({\n key: `temp-${Date.now()}-${Math.random()}-${file.name}`,\n name: file.name,\n size: file.size,\n status: 'uploading',\n }));\n\n setAttachedFiles(prev => [...prev, ...newFiles]);\n\n // Upload each file and update its status\n for (let i = 0; i < files.length; i++) {\n const file = files[i];\n const tempKey = newFiles[i].key;\n\n try {\n const result = await uploadFile(file);\n setAttachedFiles(prev => prev.map(f =>\n f.key === tempKey\n ? { ...f, key: result.key, status: 'success' }\n : f\n ));\n } catch (error) {\n setFormErrors(prev => ({ ...prev, attachments: (error as Error).message }));\n setAttachedFiles(prev => prev.map(f =>\n f.key === tempKey\n ? { ...f, status: 'error', error: (error as Error).message }\n : f\n ));\n }\n }\n }, [onAttachFiles, dictionary, maxFiles, maxFileSize, acceptedFileTypes, attachedFiles]);\n\n const handleRemoveFile = useCallback((key: string) => {\n setAttachedFiles(prev => prev.filter(f => f.key !== key));\n }, []);\n\n /*\n * This function is used to get the banner node.\n * It can be used to render a success or error banner depending on the success or error state.\n */\n const getBannerNode = () => {\n let inlineAlertProps: InLineAlertProps | undefined;\n let slotProps: any | undefined;\n\n if (success) {\n slotProps = {\n name: 'SuccessBanner',\n slot: slots?.SuccessBanner,\n context: {\n message: success,\n },\n 'data-testid': 'form-success-banner',\n };\n inlineAlertProps = {\n type: 'success',\n variant: 'primary',\n icon: <CheckWithCircle />,\n heading: dictionary.successHeader,\n description: success,\n className: 'request-negotiable-quote-form__success-banner',\n };\n }\n else if (error) {\n slotProps = {\n name: 'ErrorBanner',\n slot: slots?.ErrorBanner,\n context: {\n message: error,\n },\n 'data-testid': 'form-error-banner',\n };\n inlineAlertProps = {\n type: 'error',\n variant: 'primary',\n icon: <WarningFilled />,\n heading: dictionary.errorHeader,\n description: error,\n className: 'request-negotiable-quote-form__error-banner',\n };\n }\n\n if (slotProps && inlineAlertProps) {\n return <Slot {...slotProps}>\n <InLineAlert {...inlineAlertProps} />\n </Slot>;\n }\n\n return undefined;\n }\n\n /*\n * This function is used to validate the parent form of the button that was clicked.\n */\n const validateParentForm = (e: Event) => {\n setFormErrors({});\n const closestForm = (e.target as HTMLElement).closest('form') as HTMLFormElement;\n const formErrors = getFormErrors(closestForm);\n if (Object.keys(formErrors).length > 0) {\n setFormErrors(formErrors);\n onSubmitErrors?.(formErrors);\n }\n };\n\n const formSubmitHandler = (e: Event) => {\n e.preventDefault();\n setIsFormDisabled(true);\n\n const form = (e.target as HTMLFormElement);\n\n const currentFormErrors = getFormErrors(form);\n\n const mergedFormErrors = { ...currentFormErrors, ...formErrors };\n\n if (Object.keys(mergedFormErrors).length > 0) {\n onSubmitErrors?.(mergedFormErrors)\n return;\n }\n\n // Since we have multiple submit buttons, we need to determine which one was clicked.\n const buttonTarget = (e as SubmitEvent).submitter as HTMLButtonElement;\n\n const formValues = getFormValues(form);\n\n setComment(formValues.comment);\n setQuoteName(formValues.quoteName);\n\n const isDraft = buttonTarget?.dataset?.draft === 'true' || false;\n\n // Only include successfully uploaded files\n const successfulAttachments = attachedFiles\n .filter(f => f.status === 'success')\n .map(f => ({ key: f.key }));\n\n const contextData: RequestNegotiableQuoteInput = {\n cartId: cartId!,\n quoteName: formValues.quoteName,\n comment: formValues.comment,\n attachments: successfulAttachments,\n isDraft,\n }\n\n let submitHandler;\n let successMessage;\n\n if (isDraft) {\n submitHandler = onSaveNegotiableQuote ?? requestNegotiableQuote;\n successMessage = dictionary.draftSuccess;\n } else {\n submitHandler = onRequestNegotiableQuote ?? requestNegotiableQuote;\n successMessage = dictionary.submitSuccess;\n }\n\n submitHandler(contextData).then(() => {\n setSuccess(successMessage);\n })\n .catch(error => {\n setError(error.message);\n })\n };\n\n const titleNode = (\n <Slot name=\"Title\" slot={slots?.Title} context={{ text: dictionary.title }}>\n <span data-testid=\"form-title\">{dictionary.title}</span>\n </Slot>\n );\n\n const commentFieldNode = (\n <Slot\n name=\"CommentField\"\n slot={slots?.CommentField}\n context={{\n value: comment,\n required: true,\n errorMessage: formErrors.comment,\n setFormErrors,\n isFormDisabled\n } as any}\n >\n <TextArea\n name=\"comment\"\n value={comment}\n label={dictionary.comment}\n required\n autoComplete=\"off\"\n data-testid=\"form-comment-field\"\n errorMessage={formErrors.comment}\n disabled={isFormDisabled}\n />\n </Slot>\n );\n\n const quoteNameFieldNode = (\n <Slot\n name=\"QuoteNameField\"\n slot={slots?.QuoteNameField}\n context={{\n value: quoteName,\n required: true,\n errorMessage: formErrors.quoteName,\n setFormErrors,\n isFormDisabled\n } as any}\n >\n <Field\n error={formErrors.quoteName}\n disabled={isFormDisabled}\n >\n <Input\n value={quoteName}\n name=\"quoteName\"\n floatingLabel={dictionary.quoteName}\n required\n autoComplete=\"off\"\n data-testid=\"form-quote-name-field\"\n />\n </Field>\n </Slot>\n );\n\n const attachFileNode = (\n <Slot\n name=\"AttachFileField\"\n slot={slots?.AttachFileField}\n context={{ onChange: handleAttachFiles, formErrors, isFormDisabled, attachedFiles }}\n >\n <InputFile\n multiple\n onChange={(e: Event) => {\n const target = e.target as HTMLInputElement;\n const fileList = target?.files;\n const files = fileList ? Array.from(fileList) : [];\n\n if (files.length > 0) {\n void handleAttachFiles(files);\n }\n }}\n icon={<Add />}\n disabled={isFormDisabled}\n data-testid=\"form-attach-file-field\"\n accept={acceptedFileTypes?.join(',')}\n />\n </Slot>\n );\n\n const attachedFilesListNode = attachedFiles.length > 0 ? (\n <Slot\n name=\"AttachedFilesList\"\n slot={slots?.AttachedFilesList}\n context={{ files: attachedFiles, onRemove: handleRemoveFile, disabled: isFormDisabled }}\n >\n <AttachedFilesList\n files={attachedFiles}\n onRemove={handleRemoveFile}\n disabled={isFormDisabled}\n />\n </Slot>\n ) : undefined;\n\n const requestButtonNode = (\n <Slot\n name=\"RequestButton\"\n slot={slots?.RequestButton}\n context={\n {\n requestNegotiableQuote,\n formErrors,\n isFormDisabled,\n setIsFormDisabled\n }\n }\n >\n <Button\n type=\"submit\"\n data-testid=\"form-request-button\"\n onClick={validateParentForm}\n disabled={isFormDisabled}\n >\n {dictionary.requestCta}\n </Button>\n </Slot>\n );\n\n const saveButtonNode = (\n <Slot\n name=\"SaveDraftButton\"\n slot={slots?.SaveDraftButton}\n context={\n {\n requestNegotiableQuote,\n formErrors,\n isFormDisabled,\n setIsFormDisabled\n }\n }\n >\n <Button\n type=\"submit\"\n data-draft=\"true\"\n variant=\"secondary\"\n data-testid=\"form-save-draft-button\"\n onClick={validateParentForm}\n disabled={isFormDisabled}\n >\n {dictionary.saveDraftCta}\n </Button>\n </Slot>\n );\n\n return (\n <RequestNegotiableQuoteFormComponent\n title={titleNode}\n banner={getBannerNode()}\n commentField={commentFieldNode}\n quoteNameField={quoteNameFieldNode}\n attachFile={attachFileNode}\n attachedFilesList={attachedFilesListNode}\n requestButton={requestButtonNode}\n saveButton={saveButtonNode}\n onSubmit={formSubmitHandler}\n className={className}\n disabled={isFormDisabled}\n data-testid=\"form-container\"\n />\n );\n};\n"],"names":["RequestNegotiableQuoteForm","className","title","banner","commentField","quoteNameField","attachFile","attachedFilesList","requestButton","saveButton","onSubmit","props","jsxs","classes","jsx","VComponent","cartId","slots","onRequestNegotiableQuote","onSaveNegotiableQuote","onAttachFiles","onSubmitErrors","onError","maxFiles","maxFileSize","acceptedFileTypes","comment","setComment","useState","quoteName","setQuoteName","attachedFiles","setAttachedFiles","error","setError","formErrors","setFormErrors","success","setSuccess","isFormDisabled","setIsFormDisabled","dictionary","useText","useEffect","permissionsEvent","events","permissions","authenticatedEvent","authenticated","handleAttachFiles","useCallback","files","prev","file","validateFileSize","formatFileSize","validateFileType","attachments","rest","_a","newFiles","i","tempKey","result","uploadFile","f","handleRemoveFile","key","getBannerNode","inlineAlertProps","slotProps","CheckWithCircle","WarningFilled","Slot","InLineAlert","validateParentForm","closestForm","getFormErrors","formSubmitHandler","form","mergedFormErrors","buttonTarget","formValues","getFormValues","isDraft","successfulAttachments","contextData","submitHandler","successMessage","requestNegotiableQuote","titleNode","commentFieldNode","TextArea","quoteNameFieldNode","Field","Input","attachFileNode","InputFile","target","fileList","Add","attachedFilesListNode","AttachedFilesList","requestButtonNode","Button","saveButtonNode","RequestNegotiableQuoteFormComponent"],"mappings":"ymCA0BO,MAAMA,GAAiF,CAAC,CAC7F,UAAAC,EACA,MAAAC,EACA,OAAAC,EACA,aAAAC,EACA,eAAAC,EACA,WAAAC,EACA,kBAAAC,EACA,cAAAC,EACA,WAAAC,EACA,SAAAC,EACA,GAAGC,CACL,IAEIC,EAAC,OAAA,CAAM,GAAGD,EAAO,UAAWE,EAAQ,CAAC,gCAAiCZ,CAAS,CAAC,EAAG,SAAAS,EAChF,SAAA,CAAAP,GACCW,EAACC,EAAA,CACC,KAAMZ,EACN,UAAWU,EAAQ,CAAC,uCAAuC,CAAC,CAAA,CAAA,EAG/DX,GACCY,EAACC,EAAA,CACC,KAAMb,EACN,UAAWW,EAAQ,CAAC,sCAAsC,CAAC,CAAA,CAAA,EAG9DT,GACCU,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CAAA,EAEA,OAEEgE,GACJzF,EAAC2D,EAAA,CACC,KAAK,gBACL,KAAMxD,GAAA,YAAAA,EAAO,cACb,QACE,CACE,uBAAAwE,EACA,WAAAtD,EACA,eAAAI,EACA,kBAAAC,CAAA,EAIJ,SAAA1B,EAAC0F,EAAA,CACC,KAAK,SACL,cAAY,sBACZ,QAAS7B,EACT,SAAUpC,EAET,SAAAE,EAAW,UAAA,CAAA,CACd,CAAA,EAIEgE,GACJ3F,EAAC2D,EAAA,CACC,KAAK,kBACL,KAAMxD,GAAA,YAAAA,EAAO,gBACb,QACE,CACE,uBAAAwE,EACA,WAAAtD,EACA,eAAAI,EACA,kBAAAC,CAAA,EAIJ,SAAA1B,EAAC0F,EAAA,CACC,KAAK,SACL,aAAW,OACX,QAAQ,YACR,cAAY,yBACZ,QAAS7B,EACT,SAAUpC,EAET,SAAAE,EAAW,YAAA,CAAA,CACd,CAAA,EAIJ,OACE3B,EAAC4F,GAAA,CACC,MAAOhB,GACP,OAAQtB,GAAA,EACR,aAAcuB,GACd,eAAgBE,GAChB,WAAYG,GACZ,kBAAmBK,GACnB,cAAeE,GACf,WAAYE,GACZ,SAAU3B,GACV,UAAA7E,EACA,SAAUsC,EACV,cAAY,gBAAA,CAAA,CAGlB"}
@@ -0,0 +1,10 @@
1
+ import { HTMLAttributes } from 'preact/compat';
2
+ import { Container } from '@dropins/tools/types/elsie/src/lib';
3
+ import { ShippingAddress } from '../../data/models/negotiable-quote-model';
4
+
5
+ export interface ShippingAddressDisplayProps extends Omit<HTMLAttributes<HTMLDivElement>, 'loading'> {
6
+ shippingAddress?: ShippingAddress;
7
+ loading?: boolean;
8
+ }
9
+ export declare const ShippingAddressDisplay: Container<ShippingAddressDisplayProps>;
10
+ //# sourceMappingURL=ShippingAddressDisplay.d.ts.map
@@ -0,0 +1,11 @@
1
+ /********************************************************************
2
+ * Copyright 2025 Adobe
3
+ * All Rights Reserved.
4
+ *
5
+ * NOTICE: Adobe permits you to use, modify, and distribute this
6
+ * file in accordance with the terms of the Adobe license agreement
7
+ * accompanying it.
8
+ *******************************************************************/
9
+ export { ShippingAddressDisplay } from './ShippingAddressDisplay';
10
+ export type { ShippingAddressDisplayProps } from './ShippingAddressDisplay';
11
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ export * from './ShippingAddressDisplay/index'
@@ -0,0 +1,4 @@
1
+ /*! Copyright 2025 Adobe
2
+ All Rights Reserved. */
3
+ import{S as e}from"../chunks/ShippingAddressDisplay.js";import"@dropins/tools/preact-jsx-runtime.js";import"@dropins/tools/preact-compat.js";import"@dropins/tools/lib.js";import"@dropins/tools/components.js";import"../chunks/WarningFilled.js";import"@dropins/tools/i18n.js";import"@dropins/tools/event-bus.js";export{e as ShippingAddressDisplay};
4
+ //# sourceMappingURL=ShippingAddressDisplay.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ShippingAddressDisplay.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
@@ -1,2 +1,24 @@
1
+ /********************************************************************
2
+ * Copyright 2025 Adobe
3
+ * All Rights Reserved.
4
+ *
5
+ * NOTICE: Adobe permits you to use, modify, and distribute this
6
+ * file in accordance with the terms of the Adobe license agreement
7
+ * accompanying it.
8
+ *******************************************************************/
1
9
  export * from './RequestNegotiableQuoteForm';
10
+ export * from './ManageNegotiableQuote';
11
+ export * from './ItemsQuoted';
12
+ export * from './OrderSummary';
13
+ export * from './OrderSummaryLine';
14
+ export * from './QuoteCommentsList';
15
+ export * from './QuoteHistoryLog';
16
+ export * from './QuoteSummaryList';
17
+ export * from './QuotesListTable';
18
+ export * from './ShippingAddressDisplay';
19
+ export * from './ManageNegotiableQuoteTemplate';
20
+ export * from './ItemsQuotedTemplate';
21
+ export * from './QuoteTemplateCommentsList';
22
+ export * from './QuoteTemplateHistoryLog';
23
+ export * from './QuoteTemplatesListTable';
2
24
  //# sourceMappingURL=index.d.ts.map