@dropins/storefront-quote-management 1.0.0-beta1 → 1.0.0-beta11
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.
- package/LICENSE.md +25 -26
- package/api/duplicateNegotiableQuote/duplicateNegotiableQuote.d.ts +1 -0
- package/api/getQuoteTemplates/graphql/getQuoteTemplates.d.ts +1 -1
- package/api/getStoreConfig/graphql/StoreConfigQuery.d.ts +1 -1
- package/api/graphql/NegotiableQuoteTemplateFragment.d.ts +1 -1
- package/api/sendForReview/index.d.ts +1 -1
- package/api/sendQuoteTemplateForReview/sendQuoteTemplateForReview.d.ts +10 -0
- package/api.js +11 -48
- package/api.js.map +1 -1
- package/chunks/AttachedFilesList.js +2 -2
- package/chunks/AttachedFilesList.js.map +1 -1
- package/chunks/CheckWithCircle.js +1 -1
- package/chunks/ChevronDown.js +1 -1
- package/chunks/ConfirmationModal.js +2 -2
- package/chunks/ConfirmationModal.js.map +1 -1
- package/chunks/ItemsQuoted.js +2 -2
- package/chunks/ItemsQuoted.js.map +1 -1
- package/chunks/ItemsQuotedTemplate.js +2 -2
- package/chunks/ItemsQuotedTemplate.js.map +1 -1
- package/chunks/LineItemNoteModal.js +4 -0
- package/chunks/LineItemNoteModal.js.map +1 -0
- package/chunks/NegotiableQuoteFragment.js +2 -1
- package/chunks/NegotiableQuoteFragment.js.map +1 -1
- package/chunks/NegotiableQuoteTemplateFragment.js +155 -7
- package/chunks/NegotiableQuoteTemplateFragment.js.map +1 -1
- package/chunks/OrderSummaryLine.js +2 -2
- package/chunks/OrderSummaryLine.js.map +1 -1
- package/chunks/QuoteCommentsList.js +1 -1
- package/chunks/QuoteCommentsList3.js +1 -1
- package/chunks/QuoteHistoryLog.js +1 -1
- package/chunks/QuoteHistoryLog3.js +1 -1
- package/chunks/QuoteTemplateCommentsList.js +2 -2
- package/chunks/QuoteTemplateCommentsList.js.map +1 -1
- package/chunks/QuoteTemplateHistoryLog.js +1 -1
- package/chunks/RenameQuoteModal.js +4 -0
- package/chunks/RenameQuoteModal.js.map +1 -0
- package/chunks/ShippingAddressDisplay.js +2 -2
- package/chunks/ShippingAddressDisplay.js.map +1 -1
- package/chunks/WarningFilled.js +1 -1
- package/chunks/addQuoteTemplateLineItemNote.js +24 -4
- package/chunks/addQuoteTemplateLineItemNote.js.map +1 -1
- package/chunks/dateUtils.js +1 -1
- package/chunks/duplicateNegotiableQuote.js +6 -6
- package/chunks/duplicateNegotiableQuote.js.map +1 -1
- package/chunks/generateQuoteFromTemplate.js +1 -1
- package/chunks/getQuoteTemplates.js +14 -12
- package/chunks/getQuoteTemplates.js.map +1 -1
- package/chunks/negotiableQuotes.js +2 -2
- package/chunks/openQuoteTemplate.js +30 -9
- package/chunks/openQuoteTemplate.js.map +1 -1
- package/chunks/requestNegotiableQuote.js +1 -1
- package/chunks/setLineItemNote.js +1 -1
- package/chunks/state.js +2 -2
- package/chunks/state.js.map +1 -1
- package/chunks/transform-quote-template.js +2 -2
- package/chunks/transform-quote-template.js.map +1 -1
- package/chunks/transform-quote.js +2 -2
- package/chunks/transform-quote.js.map +1 -1
- package/chunks/uploadFile.js +1 -1
- package/components/LineItemNoteModal/LineItemNoteModal.d.ts +2 -2
- package/components/ManageNegotiableQuoteTemplate/ManageNegotiableQuoteTemplate.d.ts +5 -2
- package/components/ProductListTable/ProductListTable.d.ts +5 -49
- package/components/ReferenceDocumentFormModal/ReferenceDocumentFormModal.d.ts +30 -0
- package/components/ReferenceDocumentFormModal/index.d.ts +11 -0
- package/components/ReferenceDocumentsList/ReferenceDocumentsList.d.ts +18 -0
- package/components/ReferenceDocumentsList/index.d.ts +11 -0
- package/components/index.d.ts +2 -0
- package/containers/ItemsQuoted/ItemsQuoted.d.ts +7 -7
- package/containers/ItemsQuoted.js +2 -2
- package/containers/ItemsQuotedTemplate/ItemsQuotedTemplate.d.ts +5 -1
- package/containers/ItemsQuotedTemplate.js +2 -2
- package/containers/ManageNegotiableQuote/ManageNegotiableQuote.d.ts +3 -0
- package/containers/ManageNegotiableQuote.js +2 -2
- package/containers/ManageNegotiableQuote.js.map +1 -1
- package/containers/ManageNegotiableQuoteTemplate/ManageNegotiableQuoteTemplate.d.ts +46 -5
- package/containers/ManageNegotiableQuoteTemplate.js +4 -2
- package/containers/ManageNegotiableQuoteTemplate.js.map +1 -1
- package/containers/OrderSummary.js +2 -2
- package/containers/OrderSummary.js.map +1 -1
- package/containers/OrderSummaryLine.js +2 -2
- package/containers/QuoteCommentsList.js +1 -1
- package/containers/QuoteHistoryLog.js +1 -1
- package/containers/QuoteSummaryList/QuoteSummaryList.d.ts +1 -1
- package/containers/QuoteSummaryList.js +2 -2
- package/containers/QuoteSummaryList.js.map +1 -1
- package/containers/QuoteTemplateCommentsList.js +1 -1
- package/containers/QuoteTemplateHistoryLog.js +1 -1
- package/containers/QuoteTemplatesListTable.js +2 -2
- package/containers/QuoteTemplatesListTable.js.map +1 -1
- package/containers/QuotesListTable.js +2 -2
- package/containers/QuotesListTable.js.map +1 -1
- package/containers/RequestNegotiableQuoteForm.js +2 -2
- package/containers/RequestNegotiableQuoteForm.js.map +1 -1
- package/containers/ShippingAddressDisplay/ShippingAddressDisplay.d.ts +2 -2
- package/containers/ShippingAddressDisplay.js +2 -2
- package/data/models/__fixtures__/negotiableQuoteModel.d.ts +5 -5
- package/data/models/negotiable-quote-model.d.ts +3 -2
- package/data/models/negotiable-quote-template-model.d.ts +4 -39
- package/data/models/store-config-model.d.ts +2 -0
- package/data/transforms/__fixtures__/negotiableQuoteData.d.ts +8 -0
- package/data/transforms/__fixtures__/negotiableQuoteTemplateData.d.ts +616 -75
- package/data/transforms/__fixtures__/storeConfigData.d.ts +4 -0
- package/data/transforms/transform-history.d.ts +15 -0
- package/data/transforms/transform-quote-items.d.ts +15 -0
- package/hooks/useItemsQuotedTemplate.d.ts +15 -0
- package/hooks/useReferenceDocumentLinks.d.ts +34 -0
- package/hooks/useRemoveTemplateItems.d.ts +25 -0
- package/hooks/useRenameTemplate.d.ts +71 -0
- package/hooks/useUpdateTemplateQuantities.d.ts +27 -0
- package/i18n/en_US.json.d.ts +93 -6
- package/lib/itemFormatters.d.ts +1 -1
- package/lib/priceCalculators.d.ts +1 -1
- package/package.json +1 -1
- package/render.js +4 -4
- package/render.js.map +1 -1
- package/chunks/LineItemNoteModal2.js +0 -4
- package/chunks/LineItemNoteModal2.js.map +0 -1
- package/chunks/TabbedContent.js +0 -4
- package/chunks/TabbedContent.js.map +0 -1
|
@@ -1,4 +1,6 @@
|
|
|
1
|
-
/*! Copyright
|
|
1
|
+
/*! Copyright 2026 Adobe
|
|
2
2
|
All Rights Reserved. */
|
|
3
|
-
import{jsx as t,jsxs as m,Fragment as se}from"@dropins/tools/preact-jsx-runtime.js";import{useState as l,useRef as be,useEffect as D,useCallback as N,useMemo as u,createPortal as J}from"@dropins/tools/preact-compat.js";import{classes as i,VComponent as g,Slot as c}from"@dropins/tools/lib.js";import{f as K}from"../chunks/dateUtils.js";import{events as fe}from"@dropins/tools/event-bus.js";import{Skeleton as Me,SkeletonRow as M,Button as R,TextArea as Qe,InLineAlert as F,Icon as S}from"@dropins/tools/components.js";import{N as X}from"../chunks/transform-quote-template.js";import{A as he,T as Te}from"../chunks/TabbedContent.js";/* empty css */import"@dropins/tools/preact.js";import"@dropins/tools/preact-hooks.js";import{C as Y}from"../chunks/ConfirmationModal.js";/* empty css *//* empty css */import"../chunks/state.js";import{s as Ne,a as qe,o as _e}from"../chunks/openQuoteTemplate.js";import{g as ve}from"../chunks/generateQuoteFromTemplate.js";import{I as Ce}from"../chunks/ItemsQuotedTemplate.js";import{Q as ye}from"../chunks/QuoteTemplateCommentsList.js";import{Q as Le}from"../chunks/QuoteTemplateHistoryLog.js";import{useText as we}from"@dropins/tools/i18n.js";import"../chunks/transform-quote.js";import"@dropins/tools/fetch-graphql.js";import"../chunks/NegotiableQuoteTemplateFragment.js";import"../chunks/LineItemNoteModal2.js";import"../chunks/addQuoteTemplateLineItemNote.js";import"../chunks/WarningFilled.js";import"../chunks/QuoteCommentsList.js";import"../chunks/QuoteHistoryLog.js";const xe=({className:a,loading:s,templateName:b,templateId:q,banner:e,details:_,actionBar:v,referenceDocuments:Q,referenceDocumentsTitle:d,itemsTable:h,commentsTitle:p,comments:f,footer:T,...C})=>s?t(Fe,{}):m("div",{...C,className:i(["quote-management-manage-negotiable-quote-template",a]),children:[m("div",{className:i(["quote-management-manage-negotiable-quote-template__header"]),children:[b&&t(g,{node:b,className:i(["quote-management-manage-negotiable-quote-template__template-name"])}),q&&t(g,{node:q,className:i(["quote-management-manage-negotiable-quote-template__template-id"])})]}),e&&t(g,{node:e,className:i(["quote-management-manage-negotiable-quote-template__banner"])}),_&&t(g,{node:_,className:i(["quote-management-manage-negotiable-quote-template__details"])}),v&&t(g,{node:v,className:i(["quote-management-manage-negotiable-quote-template__action-bar"])}),(d||Q)&&m("div",{"data-testid":"reference-documents-container",className:i(["quote-management-manage-negotiable-quote-template__reference-documents-container"]),children:[d&&t(g,{node:d,className:i(["quote-management-manage-negotiable-quote-template__reference-documents-title"])}),Q&&t(g,{node:Q,className:i(["quote-management-manage-negotiable-quote-template__reference-documents"])})]}),h&&t(g,{node:h,className:i(["quote-management-manage-negotiable-quote-template__items-table"])}),m("div",{"data-testid":"comments-container",className:i(["quote-management-manage-negotiable-quote-template__comments-container"]),children:[p&&t(g,{node:p,className:i(["quote-management-manage-negotiable-quote-template__comments-title"])}),f&&t(g,{node:f,className:i(["quote-management-manage-negotiable-quote-template__comments"])})]}),T&&t(g,{node:T,className:i(["quote-management-manage-negotiable-quote-template__footer"])})]}),Fe=()=>m(Me,{"data-testid":"manage-negotiable-quote-template-skeleton",children:[t(M,{variant:"heading",fullWidth:!0,size:"large"}),t(M,{variant:"row",fullWidth:!1,size:"small"}),t(M,{variant:"row",fullWidth:!1,size:"small"}),t(M,{variant:"row",fullWidth:!0}),t(M,{variant:"row",fullWidth:!0,size:"xlarge",lines:2}),t(M,{variant:"row",fullWidth:!1,size:"small"})]}),ia=({slots:a,onActionsButtonClick:s,onSendForReview:b,...q})=>{const[e,_]=l(void 0),[v,Q]=l(!0),[d,h]=l(""),[p,f]=l(!1),[T,C]=l(!1),[k,A]=l(!1),[H,y]=l(""),[B,L]=l(""),[G,W]=l(!1),[P,z]=l(!1),[O,w]=l(""),[j,x]=l(""),$=be(!1),n=we({createdLabel:"NegotiableQuoteTemplate.Manage.createdLabel",salesRepLabel:"NegotiableQuoteTemplate.Manage.salesRepLabel",expiresLabel:"NegotiableQuoteTemplate.Manage.expiresLabel",actionsLabel:"NegotiableQuoteTemplate.Manage.actionsLabel",referenceDocumentsTitle:"NegotiableQuoteTemplate.Manage.referenceDocuments.title",commentsTitle:"NegotiableQuoteTemplate.Manage.comments.title",historyLogTitle:"NegotiableQuoteTemplate.Manage.historyLog.title",itemsQuotedTab:"NegotiableQuoteTemplate.Manage.tabs.itemsQuoted",commentsTab:"NegotiableQuoteTemplate.Manage.tabs.comments",historyLogTab:"NegotiableQuoteTemplate.Manage.tabs.historyLog",templateCommentsPlaceholder:"NegotiableQuoteTemplate.Manage.templateComments.placeholder",sendForReview:"NegotiableQuoteTemplate.Manage.actionButtons.sendForReview",accept:"NegotiableQuoteTemplate.Manage.actionButtons.accept",generateQuote:"NegotiableQuoteTemplate.Manage.actionButtons.generateQuote",generateQuoteModalTitle:"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",acceptModalTitle:"NegotiableQuoteTemplate.Manage.confirmationModal.accept.title",acceptModalMessage:"NegotiableQuoteTemplate.Manage.confirmationModal.accept.message",acceptModalCancel:"NegotiableQuoteTemplate.Manage.confirmationModal.cancel",acceptModalConfirm:"NegotiableQuoteTemplate.Manage.confirmationModal.accept.confirm",acceptModalConfirmLoading:"NegotiableQuoteTemplate.Manage.confirmationModal.accept.confirmLoading",acceptModalSuccessHeading:"NegotiableQuoteTemplate.Manage.confirmationModal.accept.successHeading",acceptSuccessMessage:"NegotiableQuoteTemplate.Manage.confirmationModal.accept.successDescription",acceptModalErrorHeading:"NegotiableQuoteTemplate.Manage.confirmationModal.accept.errorHeading",acceptErrorFallback:"NegotiableQuoteTemplate.Manage.confirmationModal.accept.errorFallback"});D(()=>{const o=fe.on("quote-management/quote-template-data",r=>{r.quoteTemplate&&(_(r.quoteTemplate),Q(!1),h(""),f(!1))},{eager:!0});return()=>o==null?void 0:o.off()},[]),D(()=>{e&&e.status===X.UPDATED&&!$.current&&($.current=!0,(async()=>{try{await _e({templateId:e.id})}catch(r){console.error("Failed to auto-open quote template:",r)}})())},[e]);const U=N(async()=>{if(b){b({templateData:e,comment:d.trim()||void 0});return}f(!0);try{await Ne({templateId:e.id,comment:d.trim()||void 0})}catch(o){console.error("Failed to send quote template for review:",o),f(!1)}},[e,b,d]),Z=N(async()=>{A(!0),L(""),y("");try{await ve({templateId:e.id}),y(n.generateQuoteSuccessMessage)}catch(o){console.error("Failed to generate quote from template:",o);const r=o instanceof Error?o.message:n.generateQuoteErrorFallback;L(r)}finally{A(!1)}},[e,n.generateQuoteSuccessMessage,n.generateQuoteErrorFallback]),ee=N(()=>{C(!1),L(""),y("")},[]),ae=N(async()=>{z(!0),x(""),w("");try{await qe({templateId:e.id}),w(n.acceptSuccessMessage)}catch(o){console.error("Failed to accept quote template:",o);const r=o instanceof Error?o.message:n.acceptErrorFallback;x(r)}finally{z(!1)}},[e,n.acceptSuccessMessage,n.acceptErrorFallback]),te=N(()=>{W(!1),x(""),w("")},[]),ne=u(()=>t(c,{name:"TemplateName",slot:a==null?void 0:a.TemplateName,context:{templateName:e==null?void 0:e.name,templateData:e},children:t("h1",{"data-testid":"template-name",children:e==null?void 0:e.name})}),[a==null?void 0:a.TemplateName,e]),oe=u(()=>t(c,{name:"TemplateId",slot:a==null?void 0:a.TemplateId,context:{templateId:e==null?void 0:e.uid,templateData:e},children:m("div",{"data-testid":"template-id",children:["Template #",e==null?void 0:e.uid]})}),[a==null?void 0:a.TemplateId,e]),re=u(()=>{if(!e)return;const o=e.expirationDate?K(e.expirationDate,"short"):void 0;return m(c,{name:"Details",slot:a==null?void 0:a.Details,context:{templateData:e},children:[m("div",{className:"quote-management-manage-negotiable-quote-template__detail",children:[t("span",{className:"quote-management-manage-negotiable-quote-template__detail-title","data-testid":"created-label",children:n.createdLabel}),m("span",{className:"quote-management-manage-negotiable-quote-template__detail-content","data-testid":"created-value",children:[K(e.createdAt,"short")," (",e.buyer.firstname," ",e.buyer.lastname,")"]})]}),m("div",{className:"quote-management-manage-negotiable-quote-template__detail",children:[t("span",{className:"quote-management-manage-negotiable-quote-template__detail-title","data-testid":"sales-rep-label",children:n.salesRepLabel}),t("span",{className:"quote-management-manage-negotiable-quote-template__detail-content","data-testid":"sales-rep-value",children:e.salesRepName})]}),o&&m("div",{className:"quote-management-manage-negotiable-quote-template__detail",children:[t("span",{className:"quote-management-manage-negotiable-quote-template__detail-title","data-testid":"expires-label",children:n.expiresLabel}),t("span",{className:"quote-management-manage-negotiable-quote-template__detail-content","data-testid":"expires-value",children:o})]})]})},[a==null?void 0:a.Details,n,e]),V=u(()=>[{label:n.generateQuote,value:"generateQuote",disabled:!(e!=null&&e.canGenerateQuoteFromTemplate)}],[n,e==null?void 0:e.canGenerateQuoteFromTemplate]),ie=u(()=>{const o=r=>{switch(r){case"generateQuote":C(!0),L(""),y(""),s==null||s(r);break}};return t(c,{name:"ActionBar",slot:a==null?void 0:a.ActionBar,context:{templateData:e},children:t(he,{dropdownPlaceholder:n.actionsLabel,dropdownOptions:[],buttons:V.map(r=>t(R,{variant:"tertiary",onClick:()=>o(r.value),"data-testid":`actions-bar-${r.value}-button`,"data-action":r.value,disabled:r.disabled,children:r.label},r.value))})})},[V,n,a==null?void 0:a.ActionBar,e,s]),ce=u(()=>{if(!(!(e!=null&&e.referenceDocuments)||e.referenceDocuments.length===0))return t(c,{name:"ReferenceDocumentsTitle",slot:a==null?void 0:a.ReferenceDocumentsTitle,context:{templateData:e},children:t("h2",{children:n.referenceDocumentsTitle})})},[a==null?void 0:a.ReferenceDocumentsTitle,n,e]),me=u(()=>{if(!(!(e!=null&&e.referenceDocuments)||e.referenceDocuments.length===0))return t(c,{name:"ReferenceDocuments",slot:a==null?void 0:a.ReferenceDocuments,context:{templateData:e},children:t("ul",{"data-testid":"reference-documents",children:e.referenceDocuments.map(o=>t("li",{children:t("a",{href:o.url,target:"_blank",rel:"noopener noreferrer",children:o.name})},o.uid))})})},[a==null?void 0:a.ReferenceDocuments,e]),le=u(()=>t(c,{name:"ItemsTable",slot:a==null?void 0:a.ItemsTable,context:{templateData:e},children:t(Te,{tabs:new Map([["items-quoted",n.itemsQuotedTab],["comments",n.commentsTab],["history-log",n.historyLogTab]]),tabsContent:new Map([["items-quoted",t(c,{name:"ItemsQuotedTab",slot:a==null?void 0:a.ItemsQuotedTab,context:{templateData:e},children:t(Ce,{templateData:e})},"items-quoted")],["comments",t(c,{name:"CommentsTab",slot:a==null?void 0:a.CommentsTab,context:{templateData:e},children:t(ye,{templateData:e})},"comments")],["history-log",t(c,{name:"HistoryLogTab",slot:a==null?void 0:a.HistoryLogTab,context:{templateData:e},children:t(Le,{templateData:e})},"history-log")]])})}),[a==null?void 0:a.ItemsTable,a==null?void 0:a.ItemsQuotedTab,a==null?void 0:a.CommentsTab,a==null?void 0:a.HistoryLogTab,n,e]),de=u(()=>t(c,{name:"CommentsTitle",slot:a==null?void 0:a.CommentsTitle,context:{templateData:e},children:t("h2",{children:n.commentsTitle})}),[a==null?void 0:a.CommentsTitle,n,e]),ue=u(()=>t(c,{name:"Comments",slot:a==null?void 0:a.Comments,context:{templateData:e},children:t(Qe,{name:"templateComments",placeholder:n.templateCommentsPlaceholder,rows:3,value:d,onInput:o=>{h(o.target.value)},disabled:!(e!=null&&e.canSendForReview)||p})}),[a==null?void 0:a.Comments,n,e,d,p]),ge=u(()=>{const o=(e==null?void 0:e.status)===X.OPEN&&(e==null?void 0:e.canAccept);return m(c,{name:"Footer",slot:a==null?void 0:a.Footer,context:{templateData:e,comment:d,isSubmitting:p},children:[o&&t(R,{variant:"primary",onClick:()=>{W(!0),x(""),w("")},"data-testid":"accept-button",disabled:p,children:n.accept}),(e==null?void 0:e.canSendForReview)&&t(R,{variant:"primary",onClick:U,"data-testid":"send-for-review-button",disabled:p,children:n.sendForReview})]})},[a==null?void 0:a.Footer,n,e,d,p,U]),pe={...q,loading:v,templateName:ne,templateId:oe,details:re,actionBar:ie,referenceDocumentsTitle:ce,referenceDocuments:me,itemsTable:le,commentsTitle:de,comments:ue,footer:ge};let I=null;H?I=t(F,{type:"success",variant:"primary",icon:t(S,{source:"CheckWithCircle"}),heading:n.generateQuoteModalSuccessHeading,description:H,"data-testid":"generate-quote-success-banner"}):B&&(I=t(F,{type:"error",variant:"primary",icon:t(S,{source:"WarningFilled"}),heading:n.generateQuoteModalErrorHeading,description:B,"data-testid":"generate-quote-error-banner"}));let E=null;return O?E=t(F,{type:"success",variant:"primary",icon:t(S,{source:"CheckWithCircle"}),heading:n.acceptModalSuccessHeading,description:O,"data-testid":"accept-success-banner"}):j&&(E=t(F,{type:"error",variant:"primary",icon:t(S,{source:"WarningFilled"}),heading:n.acceptModalErrorHeading,description:j,"data-testid":"accept-error-banner"})),m(se,{children:[t(xe,{...pe}),T&&J(t(Y,{open:T,title:n.generateQuoteModalTitle,message:n.generateQuoteModalMessage,cancelLabel:n.generateQuoteModalCancel,confirmLabel:k?n.generateQuoteModalConfirmLoading:n.generateQuoteModalConfirm,onCancel:ee,onConfirm:k?void 0:Z,showCloseButton:!0,confirmationBanner:I,"data-testid":"generate-quote-confirmation-modal"}),document.body),G&&J(t(Y,{open:G,title:n.acceptModalTitle,message:n.acceptModalMessage,cancelLabel:n.acceptModalCancel,confirmLabel:P?n.acceptModalConfirmLoading:n.acceptModalConfirm,onCancel:te,onConfirm:P?void 0:ae,showCloseButton:!0,confirmationBanner:E,"data-testid":"accept-confirmation-modal"}),document.body)]})};export{ia as ManageNegotiableQuoteTemplate,ia as default};
|
|
3
|
+
import{jsx as a,jsxs as p,Fragment as Se}from"@dropins/tools/preact-jsx-runtime.js";import{useState as m,useEffect as ue,useCallback as s,useMemo as M,useRef as $a,createPortal as O}from"@dropins/tools/preact-compat.js";import{classes as u,VComponent as D,Slot as R}from"@dropins/tools/lib.js";import{f as na}from"../chunks/dateUtils.js";import{events as Ga}from"@dropins/tools/event-bus.js";import{Skeleton as Pa,SkeletonRow as $,InLineAlert as L,Modal as ja,Input as ye,Button as A,TextArea as Ka,InputFile as Va,Icon as se}from"@dropins/tools/components.js";import{N as ta}from"../chunks/transform-quote-template.js";import{S as Ja,A as Xa,T as Ya,R as Za}from"../chunks/RenameQuoteModal.js";import{v as en,f as an,a as nn,S as tn,A as rn}from"../chunks/AttachedFilesList.js";/* empty css */import"@dropins/tools/preact.js";import"@dropins/tools/preact-hooks.js";import{C as de}from"../chunks/ConfirmationModal.js";/* empty css *//* empty css */import{S as G}from"../chunks/WarningFilled.js";import{useText as De}from"@dropins/tools/i18n.js";import"../chunks/state.js";import{u as on}from"../chunks/uploadFile.js";import{d as cn,c as ln,s as mn,a as sn,o as dn}from"../chunks/openQuoteTemplate.js";import{g as un}from"../chunks/generateQuoteFromTemplate.js";import{S as gn}from"../chunks/ShippingAddressDisplay.js";import{I as fn}from"../chunks/ItemsQuotedTemplate.js";import{Q as pn}from"../chunks/QuoteTemplateCommentsList.js";import{Q as bn}from"../chunks/QuoteTemplateHistoryLog.js";import{S as Re}from"../chunks/CheckWithCircle.js";import"../chunks/transform-quote.js";import"@dropins/tools/fetch-graphql.js";import"../chunks/NegotiableQuoteTemplateFragment.js";import"../chunks/LineItemNoteModal.js";import"../chunks/addQuoteTemplateLineItemNote.js";import"../chunks/QuoteCommentsList.js";import"../chunks/QuoteHistoryLog.js";const hn=({className:n,loading:f,templateName:l,templateStatus:T,banner:C,details:h,actionBar:S,referenceDocuments:e,itemsTable:_,shippingInformationTitle:c,shippingInformation:o,commentsTitle:N,comments:b,attachFilesField:d,attachedFilesList:y,footer:E,...Q})=>f?a(Mn,{}):p("div",{...Q,className:u(["quote-management-manage-negotiable-quote-template",n]),children:[p("div",{className:u(["quote-management-manage-negotiable-quote-template__header"]),children:[l&&a(D,{node:l,className:u(["quote-management-manage-negotiable-quote-template__template-name"])}),T&&a(D,{node:T,className:u(["quote-management-manage-negotiable-quote-template__template-status"])})]}),C&&a(D,{node:C,className:u(["quote-management-manage-negotiable-quote-template__banner"])}),h&&a(D,{node:h,className:u(["quote-management-manage-negotiable-quote-template__details"])}),S&&a(D,{node:S,className:u(["quote-management-manage-negotiable-quote-template__action-bar"])}),e&&a("div",{"data-testid":"reference-documents-container",className:u(["quote-management-manage-negotiable-quote-template__reference-documents-container"]),children:a(D,{node:e,className:u(["quote-management-manage-negotiable-quote-template__reference-documents"])})}),_&&a(D,{node:_,className:u(["quote-management-manage-negotiable-quote-template__items-table"])}),p("div",{"data-testid":"template-shipping-information-container",className:u(["quote-management-manage-negotiable-quote-template__shipping-information-container"]),children:[c&&a(D,{node:c,className:u(["quote-management-manage-negotiable-quote-template__shipping-information-title"])}),o&&a(D,{node:o,className:u(["quote-management-manage-negotiable-quote-template__shipping-information"])})]}),p("div",{"data-testid":"comments-container",className:u(["quote-management-manage-negotiable-quote-template__comments-container"]),children:[N&&a(D,{node:N,className:u(["quote-management-manage-negotiable-quote-template__comments-title"])}),b&&a(D,{node:b,className:u(["quote-management-manage-negotiable-quote-template__comments"])}),d&&a(D,{node:d,className:u(["quote-management-manage-negotiable-quote-template__attach-files-field"])}),y&&a(D,{node:y,className:u(["quote-management-manage-negotiable-quote-template__attached-files-list"])})]}),E&&a(D,{node:E,className:u(["quote-management-manage-negotiable-quote-template__footer"])})]}),Mn=()=>p(Pa,{"data-testid":"manage-negotiable-quote-template-skeleton",children:[a($,{variant:"heading",fullWidth:!0,size:"large"}),a($,{variant:"row",fullWidth:!1,size:"small"}),a($,{variant:"row",fullWidth:!1,size:"small"}),a($,{variant:"row",fullWidth:!0}),a($,{variant:"row",fullWidth:!0,size:"xlarge",lines:2}),a($,{variant:"row",fullWidth:!1,size:"small"})]}),Nn=({className:n,open:f,document:l,errorMessage:T,errorBanner:C,successBanner:h,showCloseButton:S=!0,isSubmitting:e=!1,onSave:_,onClose:c})=>{const[o,N]=m(""),[b,d]=m(""),[y,E]=m(""),[Q,w]=m({}),v=De({title:"NegotiableQuoteTemplate.Manage.referenceDocuments.form.title",documentNameLabel:"NegotiableQuoteTemplate.Manage.referenceDocuments.form.documentNameLabel",documentIdentifierLabel:"NegotiableQuoteTemplate.Manage.referenceDocuments.form.documentIdentifierLabel",referenceUrlLabel:"NegotiableQuoteTemplate.Manage.referenceDocuments.form.referenceUrlLabel",addButton:"NegotiableQuoteTemplate.Manage.referenceDocuments.form.addButton",updateButton:"NegotiableQuoteTemplate.Manage.referenceDocuments.form.updateButton",cancelButton:"NegotiableQuoteTemplate.Manage.referenceDocuments.form.cancelButton",documentNameRequired:"NegotiableQuoteTemplate.Manage.referenceDocuments.form.documentNameRequired",documentIdentifierRequired:"NegotiableQuoteTemplate.Manage.referenceDocuments.form.documentIdentifierRequired",referenceUrlRequired:"NegotiableQuoteTemplate.Manage.referenceDocuments.form.referenceUrlRequired",invalidUrl:"NegotiableQuoteTemplate.Manage.referenceDocuments.form.invalidUrl",errorHeading:"NegotiableQuoteTemplate.Manage.referenceDocuments.form.errorHeading"}),z=C||(T?a(L,{type:"error",variant:"primary",icon:a(G,{}),heading:v.errorHeading,description:T,"data-testid":"reference-document-form-modal-error-banner-inline"}):null),B=!!l;ue(()=>{f&&(l?(N(l.name||""),d(l.identifier||""),E(l.url||"")):(N(""),d(""),E("")),w({}))},[f,l]);const F=s(q=>{if(!q.trim())return!1;try{return new URL(q),!0}catch{return!1}},[]),P=s(()=>{const q={};if(o.trim()||(q.documentName=v.documentNameRequired),y.trim()?F(y.trim())||(q.referenceUrl=v.invalidUrl):q.referenceUrl=v.referenceUrlRequired,b.trim()||(q.documentIdentifier=v.documentIdentifierRequired),Object.keys(q).length>0){w(q);return}_({uid:l==null?void 0:l.uid,name:o.trim(),identifier:b.trim(),url:y.trim()})},[o,b,y,l,v,F,_]),j=s(()=>{N(""),d(""),E(""),w({}),c==null||c()},[c]);return f?p(ja,{open:f,size:"medium",title:a(Se,{children:v.title}),onClose:j,clickToDismiss:!0,escapeToDismiss:!0,showCloseButton:S,className:u(["quote-management-reference-document-form-modal",n]),"data-testid":"reference-document-form-modal",children:[z&&a("div",{className:u(["quote-management-reference-document-form-modal__error-banner"]),"data-testid":"reference-document-form-modal-error-banner",children:z}),h&&a("div",{className:u(["quote-management-reference-document-form-modal__success-banner"]),"data-testid":"reference-document-form-modal-success-banner",children:h}),p("div",{className:u(["quote-management-reference-document-form-modal__content"]),children:[p("div",{children:[a(ye,{name:"documentName",type:"text",value:o,onInput:q=>{N(q.target.value),w({...Q,documentName:void 0})},floatingLabel:v.documentNameLabel,required:!0,error:!!Q.documentName,disabled:e,"data-testid":"reference-document-name-input"}),Q.documentName&&a("span",{className:u(["quote-management-reference-document-form-modal__error-text"]),"data-testid":"reference-document-name-error",children:Q.documentName})]}),p("div",{children:[a(ye,{name:"documentIdentifier",type:"text",value:b,onInput:q=>{d(q.target.value),w({...Q,documentIdentifier:void 0})},floatingLabel:v.documentIdentifierLabel,error:!!Q.documentIdentifier,disabled:e,"data-testid":"reference-document-identifier-input"}),Q.documentIdentifier&&a("span",{className:u(["quote-management-reference-document-form-modal__error-text"]),"data-testid":"reference-document-identifier-error",children:Q.documentIdentifier})]}),p("div",{children:[a(ye,{name:"referenceUrl",type:"url",value:y,onInput:q=>{E(q.target.value),w({...Q,referenceUrl:void 0})},floatingLabel:v.referenceUrlLabel,required:!0,error:!!Q.referenceUrl,disabled:e,"data-testid":"reference-document-url-input"}),Q.referenceUrl&&a("span",{className:u(["quote-management-reference-document-form-modal__error-text"]),"data-testid":"reference-document-url-error",children:Q.referenceUrl})]})]}),p("div",{className:u(["quote-management-reference-document-form-modal__actions"]),children:[a(A,{variant:"secondary",size:"medium",onClick:j,disabled:e,className:u(["quote-management-reference-document-form-modal__cancel-button"]),"data-testid":"reference-document-form-cancel-button",children:v.cancelButton}),a(A,{variant:"primary",size:"medium",onClick:P,disabled:e,className:u(["quote-management-reference-document-form-modal__save-button"]),"data-testid":"reference-document-form-save-button",children:B?v.updateButton:v.addButton})]})]}):null},Tn=({className:n,documents:f,isEditable:l=!1,onAdd:T,onEdit:C,onRemove:h,...S})=>{const e=De({add:"NegotiableQuoteTemplate.Manage.referenceDocuments.add",edit:"NegotiableQuoteTemplate.Manage.referenceDocuments.edit",remove:"NegotiableQuoteTemplate.Manage.referenceDocuments.remove",noReferenceDocuments:"NegotiableQuoteTemplate.Manage.referenceDocuments.noReferenceDocuments"}),_=o=>o.identifier?`${o.name}, ${o.identifier}`:`${o.name} ${o.url}`,c=(o,N)=>{o.preventDefault(),window.open(N,"_blank","noopener,noreferrer")};return a("div",{className:u(["quote-management-reference-documents-list",n]),"data-testid":"reference-documents-list",...S,children:p("div",{className:"quote-management-reference-documents-list__content",children:[f.map(o=>p("div",{className:"quote-management-reference-documents-list__document","data-testid":`reference-document-${o.uid||o.url}`,children:[a("a",{href:o.url,onClick:N=>c(N,o.url),className:"quote-management-reference-documents-list__document-link",target:"_blank",rel:"noopener noreferrer","data-testid":`reference-document-link-${o.uid||o.url}`,children:_(o)}),l&&p("div",{className:"quote-management-reference-documents-list__document-actions",children:[a(A,{variant:"tertiary",onClick:()=>C==null?void 0:C(o),className:"quote-management-reference-documents-list__edit-button","data-testid":`reference-document-edit-${o.uid||o.url}`,children:e.edit}),a("span",{className:"quote-management-reference-documents-list__separator",children:"|"}),a(A,{variant:"tertiary",onClick:()=>h==null?void 0:h(o),className:"quote-management-reference-documents-list__remove-button","data-testid":`reference-document-remove-${o.uid||o.url}`,children:e.remove})]})]},o.uid||o.url)),l&&p(A,{variant:"tertiary",onClick:T,className:"quote-management-reference-documents-list__add-button","data-testid":"reference-documents-add-button",children:["+ ",e.add]}),f.length===0&&!l&&a("div",{className:"quote-management-reference-documents-list__empty",children:e.noReferenceDocuments})]})})},Qn=n=>{const{templateReferenceDocuments:f,localReferenceDocuments:l}=n,T=s(c=>{if(f)return f.find(o=>c.uid&&o.uid?o.uid===c.uid:o.url===c.url)},[f]),C=s(c=>T(c)!==void 0,[T]),h=s((c,o)=>c.name!==o.name||c.identifier!==o.identifier||c.url!==o.url,[]),S=s(()=>f?l.filter(c=>!f.some(o=>c.uid&&o.uid?o.uid===c.uid:o.url===c.url)):l,[f,l]),e=s(()=>l.map(c=>({uid:c.uid,name:c.name,identifier:c.identifier,url:c.url})),[l]),_=M(()=>f?l.some(b=>T(b)===void 0)||f.some(b=>!l.some(d=>d.uid&&b.uid?d.uid===b.uid:d.url===b.url))?!0:l.some(b=>{const d=T(b);return d?h(b,d):!1}):l.length>0,[f,l,T,h]);return{isDocumentInTemplateData:C,getNewDocuments:S,getReferenceDocumentLinks:e,hasUnsavedChanges:_}},vn=(n={})=>{const{initialTemplateName:f,templateNameRequiredErrorMessage:l="Template name is required"}=n,[T,C]=m(!1),[h,S]=m(""),[e,_]=m(""),[c,o]=m(""),[N,b]=m(""),[d,y]=m(""),E=s(F=>{S(F||f||""),_(""),o(""),b(""),y(""),C(!0)},[f]),Q=s(()=>{C(!1),S(""),_(""),o(""),b(""),y("")},[]),w=s(F=>{S(F),F.trim()&&b("")},[]),v=s(F=>{_(F)},[]),z=s(()=>h.trim()?(o(""),b(""),C(!1),!0):(b(l),!1),[h,l]),B=s(()=>{S(""),_(""),o(""),b(""),y("")},[]);return{isRenameModalOpen:T,renameTemplateName:h,renameReason:e,renameError:c,renameTemplateNameError:N,renameSuccess:d,handleRenameClick:E,handleRenameClose:Q,handleRenameTemplateNameChange:w,handleRenameReasonChange:v,handleRenameSave:z,resetRenameState:B}},rt=({slots:n,onActionsButtonClick:f,onSendForReview:l,maxFiles:T,maxFileSize:C,acceptedFileTypes:h,...S})=>{var aa;const[e,_]=m(void 0),[c,o]=m(!0),[N,b]=m(""),[d,y]=m(!1),[E,Q]=m(!1),[w,v]=m(null),[z,B]=m(!1),[F,P]=m(!1),[j,q]=m(null),[ra,K]=m(!1),[x,V]=m([]),[Le,ee]=m(!1),[ae,ne]=m(void 0),[oa,te]=m(null),[Ee,Fe]=m(!1),[ke,Ie]=m(!1),[we,re]=m(""),[He,oe]=m(""),[Ae,ge]=m(!1),[Be,xe]=m(!1),[Ue,J]=m(""),[We,ie]=m(""),ze=$a(!1),[k,X]=m([]),[ce,le]=m(void 0),{getReferenceDocumentLinks:Oe,hasUnsavedChanges:$e}=Qn({templateReferenceDocuments:e==null?void 0:e.referenceDocuments,localReferenceDocuments:x}),t=De({createdLabel:"NegotiableQuoteTemplate.Manage.createdLabel",salesRepLabel:"NegotiableQuoteTemplate.Manage.salesRepLabel",expiresLabel:"NegotiableQuoteTemplate.Manage.expiresLabel",templateIdLabel:"NegotiableQuoteTemplate.Manage.templateIdLabel",actionsLabel:"NegotiableQuoteTemplate.Manage.actionsLabel",referenceDocumentsTitle:"NegotiableQuoteTemplate.Manage.referenceDocuments.title",commentsTitle:"NegotiableQuoteTemplate.Manage.comments.title",historyLogTitle:"NegotiableQuoteTemplate.Manage.historyLog.title",itemsQuotedTab:"NegotiableQuoteTemplate.Manage.tabs.itemsQuoted",commentsTab:"NegotiableQuoteTemplate.Manage.tabs.comments",historyLogTab:"NegotiableQuoteTemplate.Manage.tabs.historyLog",templateCommentsPlaceholder:"NegotiableQuoteTemplate.Manage.templateComments.placeholder",sendForReview:"NegotiableQuoteTemplate.Manage.actionButtons.sendForReview",delete:"NegotiableQuoteTemplate.Manage.actionButtons.delete",cancel:"NegotiableQuoteTemplate.Manage.actionButtons.cancel",attachFiles:"NegotiableQuote.Manage.attachFiles",fileUploadError:"NegotiableQuote.Manage.fileUploadError",maxFilesExceeded:"NegotiableQuote.Manage.maxFilesExceeded",maxFileSizeExceeded:"NegotiableQuote.Manage.maxFileSizeExceeded",invalidFileType:"NegotiableQuote.Manage.invalidFileType",confirmationModalDeleteTitle:"NegotiableQuoteTemplate.Manage.confirmationModal.delete.title",confirmationModalDeleteMessage:"NegotiableQuoteTemplate.Manage.confirmationModal.delete.message",confirmationModalDeleteConfirm:"NegotiableQuoteTemplate.Manage.confirmationModal.delete.confirm",confirmationModalDeleteErrorHeading:"NegotiableQuoteTemplate.Manage.confirmationModal.delete.errorHeading",confirmationModalDeleteErrorFallback:"NegotiableQuoteTemplate.Manage.confirmationModal.delete.errorFallback",confirmationModalDeleteSuccessHeading:"NegotiableQuoteTemplate.Manage.confirmationModal.delete.successHeading",confirmationModalDeleteSuccessDescription:"NegotiableQuoteTemplate.Manage.confirmationModal.delete.successDescription",confirmationModalCancelTitle:"NegotiableQuoteTemplate.Manage.confirmationModal.cancelTemplate.title",confirmationModalCancelMessage:"NegotiableQuoteTemplate.Manage.confirmationModal.cancelTemplate.message",confirmationModalCancelConfirm:"NegotiableQuoteTemplate.Manage.confirmationModal.cancelTemplate.confirm",confirmationModalCancelErrorHeading:"NegotiableQuoteTemplate.Manage.confirmationModal.cancelTemplate.errorHeading",confirmationModalCancelErrorFallback:"NegotiableQuoteTemplate.Manage.confirmationModal.cancelTemplate.errorFallback",confirmationModalCancelSuccessHeading:"NegotiableQuoteTemplate.Manage.confirmationModal.cancelTemplate.successHeading",confirmationModalCancelSuccessDescription:"NegotiableQuoteTemplate.Manage.confirmationModal.cancelTemplate.successDescription",confirmationModalCancel:"NegotiableQuoteTemplate.Manage.confirmationModal.cancel",accept:"NegotiableQuoteTemplate.Manage.actionButtons.accept",generateQuote:"NegotiableQuoteTemplate.Manage.actionButtons.generateQuote",generateQuoteModalTitle:"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",acceptModalTitle:"NegotiableQuoteTemplate.Manage.confirmationModal.accept.title",acceptModalMessage:"NegotiableQuoteTemplate.Manage.confirmationModal.accept.message",acceptModalCancel:"NegotiableQuoteTemplate.Manage.confirmationModal.cancel",acceptModalConfirm:"NegotiableQuoteTemplate.Manage.confirmationModal.accept.confirm",acceptModalConfirmLoading:"NegotiableQuoteTemplate.Manage.confirmationModal.accept.confirmLoading",acceptModalSuccessHeading:"NegotiableQuoteTemplate.Manage.confirmationModal.accept.successHeading",acceptSuccessMessage:"NegotiableQuoteTemplate.Manage.confirmationModal.accept.successDescription",acceptModalErrorHeading:"NegotiableQuoteTemplate.Manage.confirmationModal.accept.errorHeading",acceptErrorFallback:"NegotiableQuoteTemplate.Manage.confirmationModal.accept.errorFallback",documentDuplicateUidError:"NegotiableQuoteTemplate.Manage.referenceDocuments.form.duplicateUidError",renameTitle:"NegotiableQuoteTemplate.Manage.rename.title",renameTemplateNameLabel:"NegotiableQuoteTemplate.Manage.rename.templateNameLabel",renameReasonLabel:"NegotiableQuoteTemplate.Manage.rename.reasonLabel",renameButton:"NegotiableQuoteTemplate.Manage.rename.renameButton",renameCancelButton:"NegotiableQuoteTemplate.Manage.rename.cancelButton",renameErrorHeading:"NegotiableQuoteTemplate.Manage.rename.errorHeading",renameTemplateNameRequired:"NegotiableQuoteTemplate.Manage.rename.templateNameRequired",renameErrorDefault:"NegotiableQuoteTemplate.Manage.rename.errorDefault",renameSuccessHeading:"NegotiableQuoteTemplate.Manage.rename.successHeading",renameSuccessMessage:"NegotiableQuoteTemplate.Manage.rename.successMessage",shippingInformationTitle:"NegotiableQuoteTemplate.Manage.shippingInformation.title",unsavedChangesWarningHeading:"NegotiableQuoteTemplate.Manage.unsavedChangesWarningHeading",unsavedChangesWarningMessage:"NegotiableQuoteTemplate.Manage.unsavedChangesWarningMessage",shippingAddressWarningHeading:"NegotiableQuoteTemplate.Manage.shippingAddressWarningHeading",shippingAddressWarningMessage:"NegotiableQuoteTemplate.Manage.shippingAddressWarningMessage"}),{isRenameModalOpen:Ge,renameTemplateName:I,renameReason:Y,renameError:fe,renameTemplateNameError:ia,renameSuccess:pe,handleRenameClick:Pe,handleRenameClose:ca,handleRenameTemplateNameChange:la,handleRenameReasonChange:ma,handleRenameSave:sa,resetRenameState:je}=vn({initialTemplateName:e==null?void 0:e.name,templateNameRequiredErrorMessage:t.renameTemplateNameRequired}),Ke=M(()=>I!==""&&I!==(e==null?void 0:e.name),[I,e==null?void 0:e.name]),Z=M(()=>$e||Ke,[$e,Ke]),be=s(async r=>{if(T&&k.length+r.length>T){le(t.maxFilesExceeded.replace("{maxFiles}",String(T)));return}for(const g of r){if(C&&!en(g.size,C)){le(t.maxFileSizeExceeded.replace("{maxSize}",an(C)));return}if(h&&!nn(g.type,h)){le(t.invalidFileType);return}}le(void 0);const i=r.map(g=>({key:`temp-${Date.now()}-${Math.random()}-${g.name}`,name:g.name,size:g.size,status:"uploading"}));X(g=>[...g,...i]);for(let g=0;g<r.length;g++){const U=r[g],H=i[g].key;try{const Ce=await on(U);X(_e=>_e.map(W=>W.key===H?{...W,key:Ce.key,status:"success"}:W))}catch(Ce){X(_e=>_e.map(W=>W.key===H?{...W,status:"error",error:Ce.message}:W))}}},[T,C,h,k,t]),he=s(r=>{X(i=>i.filter(g=>g.key!==r))},[]);ue(()=>{const r=Ga.on("quote-management/quote-template-data",i=>{i.quoteTemplate&&(_(i.quoteTemplate),o(!1),b(""),y(!1),X([]),V(i.quoteTemplate.referenceDocuments||[]),je())},{eager:!0});return()=>r==null?void 0:r.off()},[je]),ue(()=>{e!=null&&e.referenceDocuments&&V(e.referenceDocuments)},[e==null?void 0:e.referenceDocuments]),ue(()=>{e&&e.status===ta.UPDATED&&!ze.current&&(ze.current=!0,(async()=>{try{await dn({templateId:e.id})}catch(i){console.error("Failed to auto-open quote template:",i)}})())},[e]);const da=s(()=>{Q(!1),v(null),B(!1)},[]),ua=s(async()=>{if(e!=null&&e.id){v(null),B(!1);try{await cn({templateId:e.id}),B(!0),setTimeout(()=>{Q(!1),B(!1)},2e3)}catch(r){const i=r.message||t.confirmationModalDeleteErrorFallback;v(i)}}},[e,t.confirmationModalDeleteErrorFallback]),ga=s(()=>{v(null)},[]),fa=s(()=>{B(!1)},[]),pa=s(()=>{P(!1),q(null),K(!1)},[]),ba=s(async()=>{if(e!=null&&e.id){q(null),K(!1);try{await ln({templateId:e.id}),K(!0),setTimeout(()=>{P(!1),K(!1)},2e3)}catch(r){const i=r.message||t.confirmationModalCancelErrorFallback;q(i)}}},[e,t.confirmationModalCancelErrorFallback]),ha=s(()=>{q(null)},[]),Ma=s(()=>{K(!1)},[]),Me=s(async()=>{const r=Oe(),i=k.filter(H=>H.status==="success"),g=[Y.trim(),N.trim()].filter(Boolean).join(`
|
|
4
|
+
|
|
5
|
+
`).trim()||void 0,U=I&&I!==(e==null?void 0:e.name)?I:void 0;if(l){l({templateData:e,name:U,comment:g,referenceDocumentLinks:r,attachments:i.length?i:void 0});return}y(!0);try{await mn({templateId:e.id,name:U,comment:g,referenceDocumentLinks:r.length>0?r:void 0,attachments:i.length?i.map(H=>({key:H.key})):void 0})}catch(H){console.error("Failed to send quote template for review:",H),y(!1)}},[e,l,N,Y,I,Oe,k]),Ne=s(()=>{ne(void 0),te(null),ee(!0)},[]),Te=s(r=>{ne(r),te(null),ee(!0)},[]),Qe=s(r=>{V(i=>i.filter(g=>g.uid!==r.uid||g.url!==r.url))},[]),Na=s(r=>{te(null),V(ae?i=>i.map(g=>g.identifier===ae.identifier?r:g):i=>[...i,r]),ee(!1),ne(void 0)},[ae]),Ta=s(()=>{ee(!1),ne(void 0),te(null)},[]),Qa=s(async()=>{Ie(!0),oe(""),re("");try{await un({templateId:e.id}),re(t.generateQuoteSuccessMessage)}catch(r){console.error("Failed to generate quote from template:",r);const i=r instanceof Error?r.message:t.generateQuoteErrorFallback;oe(i)}finally{Ie(!1)}},[e,t.generateQuoteSuccessMessage,t.generateQuoteErrorFallback]),va=s(()=>{Fe(!1),oe(""),re("")},[]),qa=s(async()=>{xe(!0),ie(""),J("");try{await sn({templateId:e.id}),J(t.acceptSuccessMessage),setTimeout(()=>{ge(!1),J("")},2e3)}catch(r){console.error("Failed to accept quote template:",r);const i=r instanceof Error?r.message:t.acceptErrorFallback;ie(i)}finally{xe(!1)}},[e,t.acceptSuccessMessage,t.acceptErrorFallback]),Ca=s(()=>{ge(!1),ie(""),J("")},[]),_a=M(()=>{const r=!(e!=null&&e.canSendForReview),i=I||(e==null?void 0:e.name);return a(R,{name:"TemplateName",slot:n==null?void 0:n.TemplateName,context:{templateName:e==null?void 0:e.name,templateData:e,templateDisplayName:i,isRenameDisabled:r},children:p("div",{className:"quote-management-manage-negotiable-quote-template__template-name-wrapper",children:[a("h1",{"data-testid":"template-name",className:"quote-management-manage-negotiable-quote-template__template-name-title",children:i}),a("button",{onClick:()=>Pe(i),disabled:r,"data-testid":"rename-template-button",className:"quote-management-manage-negotiable-quote-template__rename-button","aria-label":"Rename template",children:a(Ja,{})})]})})},[n==null?void 0:n.TemplateName,e,Pe,I]),ya=M(()=>a(R,{name:"TemplateStatus",slot:n==null?void 0:n.TemplateStatus,context:{templateStatus:e==null?void 0:e.status,templateData:e},children:a("div",{"data-testid":"template-status",children:e==null?void 0:e.status})}),[n==null?void 0:n.TemplateStatus,e]),Ra=M(()=>{if(!e)return;const r=e.expirationDate?na(e.expirationDate,"short"):void 0;return p(R,{name:"Details",slot:n==null?void 0:n.Details,context:{templateData:e},children:[p("div",{className:"quote-management-manage-negotiable-quote-template__detail",children:[a("span",{className:"quote-management-manage-negotiable-quote-template__detail-title","data-testid":"template-id-label",children:t.templateIdLabel}),a("span",{className:"quote-management-manage-negotiable-quote-template__detail-content","data-testid":"template-id-value",children:e.id})]}),p("div",{className:"quote-management-manage-negotiable-quote-template__detail",children:[a("span",{className:"quote-management-manage-negotiable-quote-template__detail-title","data-testid":"created-label",children:t.createdLabel}),p("span",{className:"quote-management-manage-negotiable-quote-template__detail-content","data-testid":"created-value",children:[na(e.createdAt,"short")," (",e.buyer.firstname," ",e.buyer.lastname,")"]})]}),p("div",{className:"quote-management-manage-negotiable-quote-template__detail",children:[a("span",{className:"quote-management-manage-negotiable-quote-template__detail-title","data-testid":"sales-rep-label",children:t.salesRepLabel}),a("span",{className:"quote-management-manage-negotiable-quote-template__detail-content","data-testid":"sales-rep-value",children:e.salesRepName})]}),r&&p("div",{className:"quote-management-manage-negotiable-quote-template__detail",children:[a("span",{className:"quote-management-manage-negotiable-quote-template__detail-title","data-testid":"expires-label",children:t.expiresLabel}),a("span",{className:"quote-management-manage-negotiable-quote-template__detail-content","data-testid":"expires-value",children:r})]})]})},[n==null?void 0:n.Details,t,e]),Ve=M(()=>[{label:t.generateQuote,value:"generateQuote",disabled:!(e!=null&&e.canGenerateQuoteFromTemplate)}],[t,e==null?void 0:e.canGenerateQuoteFromTemplate]),Sa=M(()=>{const r=i=>{switch(i){case"generateQuote":Fe(!0),oe(""),re(""),f==null||f(i);break}};return a(R,{name:"ActionBar",slot:n==null?void 0:n.ActionBar,context:{templateData:e},children:a(Xa,{dropdownPlaceholder:t.actionsLabel,dropdownOptions:[],buttons:Ve.map(i=>a(A,{variant:"tertiary",onClick:()=>r(i.value),"data-testid":`actions-bar-${i.value}-button`,"data-action":i.value,disabled:i.disabled,children:i.label},i.value))})})},[Ve,t,n==null?void 0:n.ActionBar,e,f]),me=M(()=>{const r=e==null?void 0:e.status;return r==="Draft"||r==="Open"},[e==null?void 0:e.status]),Da=M(()=>{const r=x.length>0||me,i=r?t.referenceDocumentsTitle:void 0;return a(R,{name:"ReferenceDocuments",slot:n==null?void 0:n.ReferenceDocuments,context:{templateData:e,referenceDocuments:x,isEditable:me,onAddDocument:Ne,onEditDocument:Te,onRemoveDocument:Qe,referenceDocumentsTitle:t.referenceDocumentsTitle},children:p("div",{"data-testid":"reference-documents",children:[r&&a("h2",{children:i}),a(Tn,{documents:x,isEditable:me,onAdd:Ne,onEdit:Te,onRemove:Qe})]})})},[n==null?void 0:n.ReferenceDocuments,t,e,x,me,Ne,Te,Qe]),La=M(()=>a(R,{name:"ShippingInformationTitle",slot:n==null?void 0:n.ShippingInformationTitle,context:{templateData:e},children:a("h2",{children:t.shippingInformationTitle})}),[n==null?void 0:n.ShippingInformationTitle,e,t]),Ea=M(()=>{var r;return a(R,{name:"ShippingInformation",slot:n==null?void 0:n.ShippingInformation,context:{templateData:e,loading:c,setLoading:o},children:a(gn,{shippingAddress:(r=e==null?void 0:e.shippingAddresses)==null?void 0:r[0],loading:c,"data-testid":"manage-template-shipping-address"})})},[n==null?void 0:n.ShippingInformation,e,c,o]),Fa=M(()=>a(R,{name:"ItemsTable",slot:n==null?void 0:n.ItemsTable,context:{templateData:e},children:a(Ya,{tabs:new Map([["items-quoted",t.itemsQuotedTab],["comments",t.commentsTab],["history-log",t.historyLogTab]]),tabsContent:new Map([["items-quoted",a(R,{name:"ItemsQuotedTab",slot:n==null?void 0:n.ItemsQuotedTab,context:{templateData:e},children:a(fn,{templateData:e})},"items-quoted")],["comments",a(R,{name:"CommentsTab",slot:n==null?void 0:n.CommentsTab,context:{templateData:e},children:a(pn,{templateData:e})},"comments")],["history-log",a(R,{name:"HistoryLogTab",slot:n==null?void 0:n.HistoryLogTab,context:{templateData:e},children:a(bn,{templateData:e})},"history-log")]])})}),[n==null?void 0:n.ItemsTable,n==null?void 0:n.ItemsQuotedTab,n==null?void 0:n.CommentsTab,n==null?void 0:n.HistoryLogTab,t,e]),ka=M(()=>a(R,{name:"CommentsTitle",slot:n==null?void 0:n.CommentsTitle,context:{templateData:e},children:a("h2",{children:t.commentsTitle})}),[n==null?void 0:n.CommentsTitle,t,e]),Ia=M(()=>a(R,{name:"Comments",slot:n==null?void 0:n.Comments,context:{templateData:e},children:a(Ka,{name:"templateComments",placeholder:t.templateCommentsPlaceholder,rows:3,value:N,onInput:r=>{b(r.target.value)},disabled:!(e!=null&&e.canSendForReview)||d})}),[n==null?void 0:n.Comments,t,e,N,d]),Je=M(()=>!(e!=null&&e.canSendForReview),[e]),wa=M(()=>{const r=d||Je;return a(R,{name:"AttachFilesField",slot:n==null?void 0:n.AttachFilesField,context:{templateData:e,onFileChange:be,attachedFiles:k,fileUploadError:ce,disabled:r},children:p("div",{className:"quote-management-manage-negotiable-quote-template__attach-files",...r?{"data-disabled":!0}:{},"aria-disabled":r,children:[a(Va,{id:"manage-template-attach-files",multiple:!0,onChange:i=>{const g=i.target,U=g==null?void 0:g.files,H=U?Array.from(U):[];H.length>0&&be(H)},icon:a(tn,{}),disabled:r,"data-testid":"manage-template-attach-files",accept:h==null?void 0:h.join(","),children:t.attachFiles}),ce&&a("div",{className:"quote-management-manage-negotiable-quote-template__file-error","data-testid":"file-upload-error",children:ce})]})})},[n==null?void 0:n.AttachFilesField,e,be,d,Je,h,ce,t,k]),Ha=M(()=>{if(k.length)return a(R,{name:"AttachedFilesList",slot:n==null?void 0:n.AttachedFilesList,context:{templateData:e,files:k,onRemove:he,disabled:d},children:a(rn,{files:k,onRemove:he,disabled:d})})},[k,he,d,n==null?void 0:n.AttachedFilesList,e]),Xe=M(()=>Z?a(L,{type:"warning",variant:"primary",icon:a(G,{}),heading:t.unsavedChangesWarningHeading,description:t.unsavedChangesWarningMessage,"data-testid":"unsaved-changes-warning-alert"}):void 0,[Z,t.unsavedChangesWarningHeading,t.unsavedChangesWarningMessage]),Ye=M(()=>{var r;return(r=e==null?void 0:e.shippingAddresses)!=null&&r.length?void 0:a(L,{type:"warning",variant:"primary",icon:a(G,{}),heading:t.shippingAddressWarningHeading,description:t.shippingAddressWarningMessage,"data-testid":"shipping-address-warning-alert"})},[(aa=e==null?void 0:e.shippingAddresses)==null?void 0:aa.length,t.shippingAddressWarningHeading,t.shippingAddressWarningMessage]),Aa=M(()=>p(Se,{children:[Xe,Ye]}),[Xe,Ye]),Ba=M(()=>{const r=(e==null?void 0:e.status)===ta.OPEN&&(e==null?void 0:e.canAccept);return p(R,{name:"Footer",slot:n==null?void 0:n.Footer,context:{templateData:e,comment:N,isSubmitting:d,attachedFiles:k,referenceDocuments:x,hasUnsavedChanges:Z,handleSendForReview:Me,showAcceptButton:r,renameTemplateName:I,renameReason:Y},children:[r&&a(A,{variant:"primary",onClick:()=>{ge(!0),ie(""),J("")},"data-testid":"accept-button",disabled:d||Z,children:t.accept}),(e==null?void 0:e.canSendForReview)&&a(A,{variant:"primary",onClick:Me,"data-testid":"send-for-review-button",disabled:!(e!=null&&e.canSendForReview)||d,children:t.sendForReview}),(e==null?void 0:e.canCancel)&&a(A,{variant:"tertiary",onClick:()=>P(!0),"data-testid":"cancel-template-button",disabled:d,children:t.cancel}),(e==null?void 0:e.canDelete)&&a(A,{variant:"tertiary",onClick:()=>Q(!0),"data-testid":"delete-template-button",disabled:d,children:t.delete})]})},[n==null?void 0:n.Footer,t,e,N,d,k,Me,x,Z,I,Y]),xa=w?a(L,{type:"error",variant:"primary",icon:a(G,{}),heading:t.confirmationModalDeleteErrorHeading,description:w,onDismiss:ga,"data-testid":"confirmation-modal-error-banner"}):null,Ze=(z?a(L,{type:"success",variant:"primary",icon:a(Re,{}),heading:t.confirmationModalDeleteSuccessHeading,description:t.confirmationModalDeleteSuccessDescription,onDismiss:fa,"data-testid":"confirmation-modal-success-banner"}):null)||xa,Ua=j?a(L,{type:"error",variant:"primary",icon:a(G,{}),heading:t.confirmationModalCancelErrorHeading,description:j,onDismiss:ha,"data-testid":"confirmation-modal-cancel-error-banner"}):null,ea=(ra?a(L,{type:"success",variant:"primary",icon:a(Re,{}),heading:t.confirmationModalCancelSuccessHeading,description:t.confirmationModalCancelSuccessDescription,onDismiss:Ma,"data-testid":"confirmation-modal-cancel-success-banner"}):null)||Ua,Wa=M(()=>fe?a(L,{type:"error",variant:"primary",icon:a(G,{color:"var(--color-error)"}),heading:t.renameErrorHeading,description:fe}):void 0,[fe,t.renameErrorHeading]),za=M(()=>pe?a(L,{type:"success",variant:"primary",icon:a(Re,{}),heading:t.renameSuccessHeading,description:pe}):void 0,[pe,t.renameSuccessHeading]),Oa={...S,loading:c,templateName:_a,templateStatus:ya,banner:Aa,details:Ra,actionBar:Sa,referenceDocuments:Da,itemsTable:Fa,shippingInformationTitle:La,shippingInformation:Ea,commentsTitle:ka,comments:Ia,attachFilesField:wa,attachedFilesList:Ha,footer:Ba};let ve=null;we?ve=a(L,{type:"success",variant:"primary",icon:a(se,{source:"CheckWithCircle"}),heading:t.generateQuoteModalSuccessHeading,description:we,"data-testid":"generate-quote-success-banner"}):He&&(ve=a(L,{type:"error",variant:"primary",icon:a(se,{source:"WarningFilled"}),heading:t.generateQuoteModalErrorHeading,description:He,"data-testid":"generate-quote-error-banner"}));let qe=null;return Ue?qe=a(L,{type:"success",variant:"primary",icon:a(se,{source:"CheckWithCircle"}),heading:t.acceptModalSuccessHeading,description:Ue,"data-testid":"accept-success-banner"}):We&&(qe=a(L,{type:"error",variant:"primary",icon:a(se,{source:"WarningFilled"}),heading:t.acceptModalErrorHeading,description:We,"data-testid":"accept-error-banner"})),p(Se,{children:[a(hn,{...Oa}),E&&O(a(de,{open:E,title:t.confirmationModalDeleteTitle,message:t.confirmationModalDeleteMessage,cancelLabel:t.confirmationModalCancel,confirmLabel:t.confirmationModalDeleteConfirm,onCancel:da,onConfirm:ua,showCloseButton:!Ze,confirmationBanner:Ze}),document.body),F&&O(a(de,{open:F,title:t.confirmationModalCancelTitle,message:t.confirmationModalCancelMessage,cancelLabel:t.confirmationModalCancel,confirmLabel:t.confirmationModalCancelConfirm,onCancel:pa,onConfirm:ba,showCloseButton:!ea,confirmationBanner:ea}),document.body),Le&&O(a(Nn,{open:Le,document:ae,errorMessage:oa||void 0,onSave:Na,onClose:Ta,isSubmitting:d}),document.body),Ee&&O(a(de,{open:Ee,title:t.generateQuoteModalTitle,message:t.generateQuoteModalMessage,cancelLabel:t.generateQuoteModalCancel,confirmLabel:ke?t.generateQuoteModalConfirmLoading:t.generateQuoteModalConfirm,onCancel:va,onConfirm:ke?void 0:Qa,showCloseButton:!0,confirmationBanner:ve,"data-testid":"generate-quote-confirmation-modal"}),document.body),Ae&&O(a(de,{open:Ae,title:t.acceptModalTitle,message:t.acceptModalMessage,cancelLabel:t.acceptModalCancel,confirmLabel:Be?t.acceptModalConfirmLoading:t.acceptModalConfirm,onCancel:Ca,onConfirm:Be?void 0:qa,showCloseButton:!0,confirmationBanner:qe,"data-testid":"accept-confirmation-modal"}),document.body),Ge&&O(a(Za,{open:Ge,quoteName:I,renameReason:Y,quoteNameError:ia,errorBanner:Wa,successBanner:za,onQuoteNameChange:la,onRenameReasonChange:ma,onSave:sa,onClose:ca}),document.body)]})};export{rt as ManageNegotiableQuoteTemplate,rt as default};
|
|
4
6
|
//# sourceMappingURL=ManageNegotiableQuoteTemplate.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ManageNegotiableQuoteTemplate.js","sources":["/@dropins/storefront-quote-management/src/components/ManageNegotiableQuoteTemplate/ManageNegotiableQuoteTemplate.tsx","/@dropins/storefront-quote-management/src/containers/ManageNegotiableQuoteTemplate/ManageNegotiableQuoteTemplate.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 { Skeleton, SkeletonRow } from '@adobe-commerce/elsie/components';\n\nimport '@/quote-management/components/ManageNegotiableQuoteTemplate/ManageNegotiableQuoteTemplate.css';\n\nexport interface ManageNegotiableQuoteTemplateProps extends Omit<HTMLAttributes<HTMLDivElement>, 'loading'> {\n loading?: boolean;\n templateName: VNode;\n templateId: VNode;\n banner?: VNode;\n details?: VNode;\n actionBar?: VNode;\n referenceDocuments?: VNode;\n referenceDocumentsTitle?: VNode;\n itemsTable: VNode;\n commentsTitle: VNode;\n comments: VNode;\n footer?: VNode;\n}\n\nexport const ManageNegotiableQuoteTemplate: FunctionComponent<ManageNegotiableQuoteTemplateProps> = ({\n className,\n loading,\n templateName,\n templateId,\n banner,\n details,\n actionBar,\n referenceDocuments,\n referenceDocumentsTitle,\n itemsTable,\n commentsTitle,\n comments,\n footer,\n ...props\n}) => {\n if (loading) {\n return <ManageNegotiableQuoteTemplateSkeleton />;\n }\n\n return (\n <div {...props} className={classes(['quote-management-manage-negotiable-quote-template', className])}>\n <div className={classes(['quote-management-manage-negotiable-quote-template__header'])}>\n {templateName &&\n <VComponent\n node={templateName}\n className={classes(['quote-management-manage-negotiable-quote-template__template-name'])}\n />\n }\n {templateId &&\n <VComponent\n node={templateId}\n className={classes(['quote-management-manage-negotiable-quote-template__template-id'])}\n />\n }\n </div>\n {banner &&\n <VComponent\n node={banner}\n className={classes(['quote-management-manage-negotiable-quote-template__banner'])}\n />\n }\n {details &&\n <VComponent\n node={details}\n className={classes(['quote-management-manage-negotiable-quote-template__details'])}\n />\n }\n {actionBar &&\n <VComponent\n node={actionBar}\n className={classes(['quote-management-manage-negotiable-quote-template__action-bar'])}\n />\n }\n {(referenceDocumentsTitle || referenceDocuments) &&\n <div data-testid=\"reference-documents-container\" className={classes(['quote-management-manage-negotiable-quote-template__reference-documents-container'])}>\n {referenceDocumentsTitle &&\n <VComponent\n node={referenceDocumentsTitle}\n className={classes(['quote-management-manage-negotiable-quote-template__reference-documents-title'])}\n />\n }\n {referenceDocuments &&\n <VComponent\n node={referenceDocuments}\n className={classes(['quote-management-manage-negotiable-quote-template__reference-documents'])}\n />\n }\n </div>\n }\n {itemsTable &&\n <VComponent\n node={itemsTable}\n className={classes(['quote-management-manage-negotiable-quote-template__items-table'])}\n />\n }\n <div data-testid=\"comments-container\" className={classes(['quote-management-manage-negotiable-quote-template__comments-container'])}>\n {commentsTitle &&\n <VComponent\n node={commentsTitle}\n className={classes(['quote-management-manage-negotiable-quote-template__comments-title'])}\n />\n }\n {comments &&\n <VComponent\n node={comments}\n className={classes(['quote-management-manage-negotiable-quote-template__comments'])}\n />\n }\n </div>\n {footer &&\n <VComponent\n node={footer}\n className={classes(['quote-management-manage-negotiable-quote-template__footer'])}\n />\n }\n </div>\n );\n};\n\nexport const ManageNegotiableQuoteTemplateSkeleton: FunctionComponent = () => {\n return (\n <Skeleton data-testid=\"manage-negotiable-quote-template-skeleton\">\n <SkeletonRow variant=\"heading\" fullWidth={true} size=\"large\" />\n <SkeletonRow variant=\"row\" fullWidth={false} size=\"small\" />\n <SkeletonRow variant=\"row\" fullWidth={false} size=\"small\" />\n <SkeletonRow variant=\"row\" fullWidth={true} />\n <SkeletonRow variant=\"row\" fullWidth={true} size=\"xlarge\" lines={2} />\n <SkeletonRow variant=\"row\" fullWidth={false} size=\"small\" />\n </Skeleton>\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 {\n HTMLAttributes,\n useCallback,\n useEffect,\n useMemo,\n useState,\n createPortal,\n useRef,\n} from 'preact/compat';\nimport {\n Container,\n Slot,\n SlotProps,\n} from '@adobe-commerce/elsie/lib';\nimport { formattedDate } from '@/quote-management/utils/dateUtils';\nimport { events } from '@adobe-commerce/event-bus';\nimport { useText } from '@adobe-commerce/elsie/i18n';\nimport {\n Button,\n TextArea,\n InLineAlert,\n Icon,\n} from '@adobe-commerce/elsie/components';\nimport { NegotiableQuoteTemplateModel, NegotiableQuoteTemplateStatus } from '@/quote-management/data/models/negotiable-quote-template-model';\nimport {\n TabbedContent, ActionsBar, ConfirmationModal, ManageNegotiableQuoteTemplate as ManageNegotiableQuoteTemplateComponent,\n ManageNegotiableQuoteTemplateProps as ManageNegotiableQuoteTemplateComponentProps\n} from '@/quote-management/components';\nimport {\n ItemsQuotedTemplate,\n QuoteTemplateCommentsList,\n QuoteTemplateHistoryLog\n} from '@/quote-management/containers';\nimport { sendQuoteTemplateForReview, generateQuoteFromTemplate, openQuoteTemplate, acceptQuoteTemplate } from '@/quote-management/api';\n\nexport interface ManageNegotiableQuoteTemplateProps\n extends HTMLAttributes<HTMLDivElement> {\n onActionsButtonClick?: (action: string) => void;\n onSendForReview?: (params: {\n templateData?: NegotiableQuoteTemplateModel;\n comment?: string;\n }) => void;\n slots?: {\n TemplateName?: SlotProps<{\n templateName?: string;\n templateData?: NegotiableQuoteTemplateModel;\n }>;\n TemplateId?: SlotProps<{\n templateId?: string;\n templateData?: NegotiableQuoteTemplateModel;\n }>;\n Banner?: SlotProps<{\n templateData?: NegotiableQuoteTemplateModel;\n }>;\n Details?: SlotProps<{\n templateData?: NegotiableQuoteTemplateModel;\n }>;\n ActionBar?: SlotProps<{\n templateData?: NegotiableQuoteTemplateModel;\n }>;\n ReferenceDocumentsTitle?: SlotProps<{\n templateData?: NegotiableQuoteTemplateModel;\n }>;\n ReferenceDocuments?: SlotProps<{\n templateData?: NegotiableQuoteTemplateModel;\n }>;\n ItemsTable?: SlotProps<{\n templateData?: NegotiableQuoteTemplateModel;\n }>;\n ItemsQuotedTab?: SlotProps<{\n templateData?: NegotiableQuoteTemplateModel;\n }>;\n CommentsTab?: SlotProps<{\n templateData?: NegotiableQuoteTemplateModel;\n }>;\n HistoryLogTab?: SlotProps<{\n templateData?: NegotiableQuoteTemplateModel;\n }>;\n CommentsTitle?: SlotProps<{\n templateData?: NegotiableQuoteTemplateModel;\n }>;\n Comments?: SlotProps<{\n templateData?: NegotiableQuoteTemplateModel;\n }>;\n HistoryLogTitle?: SlotProps<{\n templateData?: NegotiableQuoteTemplateModel;\n }>;\n HistoryLog?: SlotProps<{\n templateData?: NegotiableQuoteTemplateModel;\n }>;\n Footer?: SlotProps<{\n templateData?: NegotiableQuoteTemplateModel;\n comment?: string;\n isSubmitting?: boolean;\n }>;\n };\n}\n\nexport const ManageNegotiableQuoteTemplate: Container<ManageNegotiableQuoteTemplateProps> = ({\n slots,\n onActionsButtonClick,\n onSendForReview,\n ...props\n}) => {\n const [templateData, setTemplateData] = useState<NegotiableQuoteTemplateModel | undefined>(undefined);\n const [loading, setLoading] = useState<boolean>(true);\n const [comment, setComment] = useState<string>('');\n const [isSubmitting, setIsSubmitting] = useState<boolean>(false);\n const [showGenerateQuoteModal, setShowGenerateQuoteModal] = useState<boolean>(false);\n const [isGeneratingQuote, setIsGeneratingQuote] = useState<boolean>(false);\n const [generateQuoteSuccessMessage, setGenerateQuoteSuccessMessage] = useState<string>('');\n const [generateQuoteErrorMessage, setGenerateQuoteErrorMessage] = useState<string>('');\n const [showAcceptModal, setShowAcceptModal] = useState<boolean>(false);\n const [isAccepting, setIsAccepting] = useState<boolean>(false);\n const [acceptSuccessMessage, setAcceptSuccessMessage] = useState<string>('');\n const [acceptErrorMessage, setAcceptErrorMessage] = useState<string>('');\n const hasAutoOpened = useRef<boolean>(false);\n\n const dictionary = useText({\n createdLabel: 'NegotiableQuoteTemplate.Manage.createdLabel',\n salesRepLabel: 'NegotiableQuoteTemplate.Manage.salesRepLabel',\n expiresLabel: 'NegotiableQuoteTemplate.Manage.expiresLabel',\n actionsLabel: 'NegotiableQuoteTemplate.Manage.actionsLabel',\n referenceDocumentsTitle: 'NegotiableQuoteTemplate.Manage.referenceDocuments.title',\n commentsTitle: 'NegotiableQuoteTemplate.Manage.comments.title',\n historyLogTitle: 'NegotiableQuoteTemplate.Manage.historyLog.title',\n itemsQuotedTab: 'NegotiableQuoteTemplate.Manage.tabs.itemsQuoted',\n commentsTab: 'NegotiableQuoteTemplate.Manage.tabs.comments',\n historyLogTab: 'NegotiableQuoteTemplate.Manage.tabs.historyLog',\n templateCommentsPlaceholder: 'NegotiableQuoteTemplate.Manage.templateComments.placeholder',\n sendForReview: 'NegotiableQuoteTemplate.Manage.actionButtons.sendForReview',\n accept: 'NegotiableQuoteTemplate.Manage.actionButtons.accept',\n generateQuote: 'NegotiableQuoteTemplate.Manage.actionButtons.generateQuote',\n generateQuoteModalTitle: '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 acceptModalTitle: 'NegotiableQuoteTemplate.Manage.confirmationModal.accept.title',\n acceptModalMessage: 'NegotiableQuoteTemplate.Manage.confirmationModal.accept.message',\n acceptModalCancel: 'NegotiableQuoteTemplate.Manage.confirmationModal.cancel',\n acceptModalConfirm: 'NegotiableQuoteTemplate.Manage.confirmationModal.accept.confirm',\n acceptModalConfirmLoading: 'NegotiableQuoteTemplate.Manage.confirmationModal.accept.confirmLoading',\n acceptModalSuccessHeading: 'NegotiableQuoteTemplate.Manage.confirmationModal.accept.successHeading',\n acceptSuccessMessage: 'NegotiableQuoteTemplate.Manage.confirmationModal.accept.successDescription',\n acceptModalErrorHeading: 'NegotiableQuoteTemplate.Manage.confirmationModal.accept.errorHeading',\n acceptErrorFallback: 'NegotiableQuoteTemplate.Manage.confirmationModal.accept.errorFallback',\n });\n\n /* Event listeners */\n useEffect(() => {\n const quoteTemplateDataEvent = events.on('quote-management/quote-template-data', (data) => {\n if (data.quoteTemplate) {\n setTemplateData(data.quoteTemplate);\n setLoading(false);\n // Reset comment and submitting state after successful update\n setComment('');\n setIsSubmitting(false);\n }\n }, { eager: true });\n\n return () => quoteTemplateDataEvent?.off();\n }, []);\n\n // Auto-open template if status is \"Updated\"\n useEffect(() => {\n if (templateData && templateData.status === NegotiableQuoteTemplateStatus.UPDATED && !hasAutoOpened.current) {\n hasAutoOpened.current = true;\n const openTemplate = async () => {\n try {\n await openQuoteTemplate({ templateId: templateData.id });\n // The event listener will handle updating state\n } catch (error) {\n console.error('Failed to auto-open quote template:', error);\n // Silently fail - template data is still available for viewing\n }\n };\n openTemplate();\n }\n }, [templateData]);\n\n /**\n * Handlers\n */\n const handleSendForReview = useCallback(async () => {\n // If override prop is provided, use it instead of the API\n if (onSendForReview) {\n onSendForReview({\n templateData,\n comment: comment.trim() || undefined,\n });\n return;\n }\n // Otherwise, use the sendQuoteTemplateForReview API\n setIsSubmitting(true);\n\n try {\n await sendQuoteTemplateForReview({\n templateId: templateData!.id, // the button should be disabled if templateData is null\n comment: comment.trim() || undefined,\n });\n // The quote-template-data event will handle updating state\n } catch (error) {\n console.error('Failed to send quote template for review:', error);\n setIsSubmitting(false);\n // TODO: Show error notification to user\n }\n }, [templateData, onSendForReview, comment]);\n\n // Generate quote handler\n const handleGenerateQuote = useCallback(async () => {\n setIsGeneratingQuote(true);\n setGenerateQuoteErrorMessage('');\n setGenerateQuoteSuccessMessage('');\n try {\n await generateQuoteFromTemplate({ templateId: templateData!.id });\n // Show success message\n setGenerateQuoteSuccessMessage(dictionary.generateQuoteSuccessMessage);\n } catch (error) {\n console.error('Failed to generate quote from template:', error);\n const errorMessage = error instanceof Error ? error.message : dictionary.generateQuoteErrorFallback;\n setGenerateQuoteErrorMessage(errorMessage);\n } finally {\n setIsGeneratingQuote(false);\n }\n }, [templateData, dictionary.generateQuoteSuccessMessage, dictionary.generateQuoteErrorFallback]);\n\n const handleGenerateQuoteModalCancel = useCallback(() => {\n setShowGenerateQuoteModal(false);\n setGenerateQuoteErrorMessage('');\n setGenerateQuoteSuccessMessage('');\n }, []);\n\n // Accept quote template handler\n const handleAcceptQuote = useCallback(async () => {\n setIsAccepting(true);\n setAcceptErrorMessage('');\n setAcceptSuccessMessage('');\n try {\n await acceptQuoteTemplate({ templateId: templateData!.id });\n // Show success message\n setAcceptSuccessMessage(dictionary.acceptSuccessMessage);\n } catch (error) {\n console.error('Failed to accept quote template:', error);\n const errorMessage = error instanceof Error ? error.message : dictionary.acceptErrorFallback;\n setAcceptErrorMessage(errorMessage);\n } finally {\n setIsAccepting(false);\n }\n }, [templateData, dictionary.acceptSuccessMessage, dictionary.acceptErrorFallback]);\n\n const handleAcceptModalCancel = useCallback(() => {\n setShowAcceptModal(false);\n setAcceptErrorMessage('');\n setAcceptSuccessMessage('');\n }, []);\n\n /**\n * VNodes for the ManageNegotiableQuoteTemplate component\n */\n\n // Template name\n const templateName = useMemo(() => {\n return (\n <Slot\n name=\"TemplateName\"\n slot={slots?.TemplateName}\n context={{ templateName: templateData?.name, templateData }}\n >\n <h1 data-testid=\"template-name\">\n {templateData?.name}\n </h1>\n </Slot>\n );\n }, [slots?.TemplateName, templateData]);\n\n // Template ID\n const templateId = useMemo(() => {\n return (\n <Slot\n name=\"TemplateId\"\n slot={slots?.TemplateId}\n context={{ templateId: templateData?.uid, templateData }}\n >\n <div data-testid=\"template-id\">Template #{templateData?.uid}</div>\n </Slot>\n );\n }, [slots?.TemplateId, templateData]);\n\n // Details\n const details = useMemo(() => {\n if (!templateData) {\n return;\n }\n\n // Format expiration date if it exists\n const expirationDate = templateData.expirationDate ? formattedDate(templateData.expirationDate, 'short') : undefined;\n\n return (\n <Slot name=\"Details\" slot={slots?.Details} context={{ templateData }}>\n <div className=\"quote-management-manage-negotiable-quote-template__detail\">\n <span\n className=\"quote-management-manage-negotiable-quote-template__detail-title\"\n data-testid=\"created-label\"\n >\n {dictionary.createdLabel}\n </span>\n <span\n className=\"quote-management-manage-negotiable-quote-template__detail-content\"\n data-testid=\"created-value\"\n >\n {formattedDate(templateData.createdAt, 'short')} (\n {templateData.buyer.firstname} {templateData.buyer.lastname})\n </span>\n </div>\n\n <div className=\"quote-management-manage-negotiable-quote-template__detail\">\n <span\n className=\"quote-management-manage-negotiable-quote-template__detail-title\"\n data-testid=\"sales-rep-label\"\n >\n {dictionary.salesRepLabel}\n </span>\n <span\n className=\"quote-management-manage-negotiable-quote-template__detail-content\"\n data-testid=\"sales-rep-value\"\n >\n {templateData.salesRepName}\n </span>\n </div>\n\n {expirationDate && (\n <div className=\"quote-management-manage-negotiable-quote-template__detail\">\n <span\n className=\"quote-management-manage-negotiable-quote-template__detail-title\"\n data-testid=\"expires-label\"\n >\n {dictionary.expiresLabel}\n </span>\n <span\n className=\"quote-management-manage-negotiable-quote-template__detail-content\"\n data-testid=\"expires-value\"\n >\n {expirationDate}\n </span>\n </div>\n )}\n </Slot>\n );\n }, [slots?.Details, dictionary, templateData]);\n\n // Action bar\n const buttons: { label: string; value: string; disabled?: boolean }[] =\n useMemo(() => {\n return [\n {\n label: dictionary.generateQuote,\n value: 'generateQuote',\n disabled: !templateData?.canGenerateQuoteFromTemplate,\n },\n ];\n }, [dictionary, templateData?.canGenerateQuoteFromTemplate]);\n\n const actionBar = useMemo(() => {\n const handleActionsButtonClick = (action: string) => {\n switch (action) {\n case 'generateQuote':\n setShowGenerateQuoteModal(true);\n setGenerateQuoteErrorMessage(''); // Clear modal errors\n setGenerateQuoteSuccessMessage(''); // Clear modal success messages\n onActionsButtonClick?.(action);\n break;\n }\n };\n return (\n <Slot\n name=\"ActionBar\"\n slot={slots?.ActionBar}\n context={{ templateData }}\n >\n <ActionsBar\n dropdownPlaceholder={dictionary.actionsLabel}\n dropdownOptions={[]}\n buttons={buttons.map((button) => (\n <Button\n key={button.value}\n variant=\"tertiary\"\n onClick={() => handleActionsButtonClick(button.value)}\n data-testid={`actions-bar-${button.value}-button`}\n data-action={button.value}\n disabled={button.disabled}\n >\n {button.label}\n </Button>\n ))}\n />\n </Slot>\n );\n }, [\n buttons,\n dictionary,\n slots?.ActionBar,\n templateData,\n onActionsButtonClick,\n ]);\n\n // Reference documents\n const referenceDocumentsTitle = useMemo(() => {\n if (!templateData?.referenceDocuments || templateData.referenceDocuments.length === 0) {\n return undefined;\n }\n\n return (\n <Slot\n name=\"ReferenceDocumentsTitle\"\n slot={slots?.ReferenceDocumentsTitle}\n context={{ templateData }}\n >\n <h2>{dictionary.referenceDocumentsTitle}</h2>\n </Slot>\n );\n }, [slots?.ReferenceDocumentsTitle, dictionary, templateData]);\n\n const referenceDocuments = useMemo(() => {\n if (!templateData?.referenceDocuments || templateData.referenceDocuments.length === 0) {\n return undefined;\n }\n\n return (\n <Slot\n name=\"ReferenceDocuments\"\n slot={slots?.ReferenceDocuments}\n context={{ templateData }}\n >\n <ul data-testid=\"reference-documents\">\n {templateData.referenceDocuments.map((doc) => (\n <li key={doc.uid}>\n <a href={doc.url} target=\"_blank\" rel=\"noopener noreferrer\">\n {doc.name}\n </a>\n </li>\n ))}\n </ul>\n </Slot>\n );\n }, [slots?.ReferenceDocuments, templateData]);\n\n // Items table (using TabbedContent with ItemsQuoted)\n const itemsTable = useMemo(() => {\n return (\n <Slot\n name=\"ItemsTable\"\n slot={slots?.ItemsTable}\n context={{ templateData }}\n >\n <TabbedContent\n tabs={\n new Map([\n ['items-quoted', dictionary.itemsQuotedTab],\n ['comments', dictionary.commentsTab],\n ['history-log', dictionary.historyLogTab],\n ])\n }\n tabsContent={\n new Map([\n [\n 'items-quoted',\n <Slot\n key=\"items-quoted\"\n name=\"ItemsQuotedTab\"\n slot={slots?.ItemsQuotedTab}\n context={{ templateData }}\n >\n <ItemsQuotedTemplate templateData={templateData} />\n </Slot>,\n ],\n [\n 'comments',\n <Slot\n key=\"comments\"\n name=\"CommentsTab\"\n slot={slots?.CommentsTab}\n context={{ templateData }}\n >\n <QuoteTemplateCommentsList templateData={templateData} />\n </Slot>,\n ],\n [\n 'history-log',\n <Slot\n key=\"history-log\"\n name=\"HistoryLogTab\"\n slot={slots?.HistoryLogTab}\n context={{ templateData }}\n >\n <QuoteTemplateHistoryLog templateData={templateData} />\n </Slot>,\n ],\n ])\n }\n />\n </Slot>\n );\n }, [\n slots?.ItemsTable,\n slots?.ItemsQuotedTab,\n slots?.CommentsTab,\n slots?.HistoryLogTab,\n dictionary,\n templateData,\n ]);\n\n // Comments title\n const commentsTitle = useMemo(() => {\n return (\n <Slot\n name=\"CommentsTitle\"\n slot={slots?.CommentsTitle}\n context={{ templateData }}\n >\n <h2>{dictionary.commentsTitle}</h2>\n </Slot>\n );\n }, [slots?.CommentsTitle, dictionary, templateData]);\n\n // Comments\n const comments = useMemo(() => {\n return (\n <Slot\n name=\"Comments\"\n slot={slots?.Comments}\n context={{ templateData }}\n >\n <TextArea\n name=\"templateComments\"\n placeholder={dictionary.templateCommentsPlaceholder}\n rows={3}\n value={comment}\n onInput={(e) => {\n setComment((e.target as HTMLTextAreaElement).value);\n }}\n disabled={!templateData?.canSendForReview || isSubmitting}\n />\n </Slot>\n );\n }, [slots?.Comments, dictionary, templateData, comment, isSubmitting]);\n\n // Footer\n const footer = useMemo(() => {\n const showAcceptButton = templateData?.status === NegotiableQuoteTemplateStatus.OPEN && templateData?.canAccept;\n \n return (\n <Slot\n name=\"Footer\"\n slot={slots?.Footer}\n context={{ templateData, comment, isSubmitting }}\n >\n {showAcceptButton && (\n <Button\n variant=\"primary\"\n onClick={() => {\n setShowAcceptModal(true);\n setAcceptErrorMessage(''); // Clear modal errors\n setAcceptSuccessMessage(''); // Clear modal success messages\n }}\n data-testid=\"accept-button\"\n disabled={isSubmitting}\n >\n {dictionary.accept}\n </Button>\n )}\n\n {templateData?.canSendForReview && <Button\n variant=\"primary\"\n onClick={handleSendForReview}\n data-testid=\"send-for-review-button\"\n disabled={isSubmitting}\n >\n {dictionary.sendForReview}\n </Button>}\n </Slot>\n );\n }, [\n slots?.Footer,\n dictionary,\n templateData,\n comment,\n isSubmitting,\n handleSendForReview,\n ]);\n\n const manageNegotiableQuoteTemplateProps: ManageNegotiableQuoteTemplateComponentProps = {\n ...props,\n loading,\n templateName,\n templateId,\n details,\n actionBar,\n referenceDocumentsTitle,\n referenceDocuments,\n itemsTable,\n commentsTitle,\n comments,\n footer,\n };\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 // Create banner for accept modal based on success/error state\n let acceptModalBanner = null;\n if (acceptSuccessMessage) {\n acceptModalBanner = (\n <InLineAlert\n type=\"success\"\n variant=\"primary\"\n icon={<Icon source=\"CheckWithCircle\" />}\n heading={dictionary.acceptModalSuccessHeading}\n description={acceptSuccessMessage}\n data-testid=\"accept-success-banner\"\n />\n );\n } else if (acceptErrorMessage) {\n acceptModalBanner = (\n <InLineAlert\n type=\"error\"\n variant=\"primary\"\n icon={<Icon source=\"WarningFilled\" />}\n heading={dictionary.acceptModalErrorHeading}\n description={acceptErrorMessage}\n data-testid=\"accept-error-banner\"\n />\n );\n }\n\n return (\n <>\n <ManageNegotiableQuoteTemplateComponent {...manageNegotiableQuoteTemplateProps} />\n {showGenerateQuoteModal &&\n createPortal(\n <ConfirmationModal\n open={showGenerateQuoteModal}\n title={dictionary.generateQuoteModalTitle}\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 ? undefined : handleGenerateQuote}\n showCloseButton={true}\n confirmationBanner={generateQuoteModalBanner}\n data-testid=\"generate-quote-confirmation-modal\"\n />,\n document.body\n )}\n {showAcceptModal &&\n createPortal(\n <ConfirmationModal\n open={showAcceptModal}\n title={dictionary.acceptModalTitle}\n message={dictionary.acceptModalMessage}\n cancelLabel={dictionary.acceptModalCancel}\n confirmLabel={\n isAccepting\n ? dictionary.acceptModalConfirmLoading\n : dictionary.acceptModalConfirm\n }\n onCancel={handleAcceptModalCancel}\n onConfirm={isAccepting ? undefined : handleAcceptQuote}\n showCloseButton={true}\n confirmationBanner={acceptModalBanner}\n data-testid=\"accept-confirmation-modal\"\n />,\n document.body\n )}\n </>\n );\n};\n"],"names":["ManageNegotiableQuoteTemplate","className","loading","templateName","templateId","banner","details","actionBar","referenceDocuments","referenceDocumentsTitle","itemsTable","commentsTitle","comments","footer","props","ManageNegotiableQuoteTemplateSkeleton","jsxs","classes","jsx","VComponent","Skeleton","SkeletonRow","slots","onActionsButtonClick","onSendForReview","templateData","setTemplateData","useState","setLoading","comment","setComment","isSubmitting","setIsSubmitting","showGenerateQuoteModal","setShowGenerateQuoteModal","isGeneratingQuote","setIsGeneratingQuote","generateQuoteSuccessMessage","setGenerateQuoteSuccessMessage","generateQuoteErrorMessage","setGenerateQuoteErrorMessage","showAcceptModal","setShowAcceptModal","isAccepting","setIsAccepting","acceptSuccessMessage","setAcceptSuccessMessage","acceptErrorMessage","setAcceptErrorMessage","hasAutoOpened","useRef","dictionary","useText","useEffect","quoteTemplateDataEvent","events","data","NegotiableQuoteTemplateStatus","openQuoteTemplate","error","handleSendForReview","useCallback","sendQuoteTemplateForReview","handleGenerateQuote","generateQuoteFromTemplate","errorMessage","handleGenerateQuoteModalCancel","handleAcceptQuote","acceptQuoteTemplate","handleAcceptModalCancel","useMemo","Slot","expirationDate","formattedDate","buttons","handleActionsButtonClick","action","ActionsBar","button","Button","doc","TabbedContent","ItemsQuotedTemplate","QuoteTemplateCommentsList","QuoteTemplateHistoryLog","TextArea","e","showAcceptButton","manageNegotiableQuoteTemplateProps","generateQuoteModalBanner","InLineAlert","Icon","acceptModalBanner","Fragment","ManageNegotiableQuoteTemplateComponent","createPortal","ConfirmationModal"],"mappings":"4iDA+BO,MAAMA,GAAuF,CAAC,CACnG,UAAAC,EACA,QAAAC,EACA,aAAAC,EACA,WAAAC,EACA,OAAAC,EACA,QAAAC,EACA,UAAAC,EACA,mBAAAC,EACA,wBAAAC,EACA,WAAAC,EACA,cAAAC,EACA,SAAAC,EACA,OAAAC,EACA,GAAGC,CACL,IACMZ,IACMa,GAAA,EAAsC,EAI9CC,EAAC,MAAA,CAAK,GAAGF,EAAO,UAAWG,EAAQ,CAAC,oDAAqDhB,CAAS,CAAC,EACjG,SAAA,CAAAe,EAAC,OAAI,UAAWC,EAAQ,CAAC,2DAA2D,CAAC,EAClF,SAAA,CAAAd,GACCe,EAACC,EAAA,CACC,KAAMhB,EACN,UAA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AI/C,EACF+C,EACE1E,EAACwE,EAAA,CACC,KAAK,UACL,QAAQ,UACR,KAAMxE,EAACyE,EAAA,CAAK,OAAO,iBAAA,CAAkB,EACrC,QAASxC,EAAW,0BACpB,YAAaN,EACb,cAAY,uBAAA,CAAA,EAGPE,IACT6C,EACE1E,EAACwE,EAAA,CACC,KAAK,QACL,QAAQ,UACR,KAAMxE,EAACyE,EAAA,CAAK,OAAO,eAAA,CAAgB,EACnC,QAASxC,EAAW,wBACpB,YAAaJ,EACb,cAAY,qBAAA,CAAA,GAMhB/B,EAAA6E,GAAA,CACE,SAAA,CAAA3E,EAAC4E,GAAA,CAAwC,GAAGN,GAAoC,EAC/EvD,GACC8D,EACE7E,EAAC8E,EAAA,CACC,KAAM/D,EACN,MAAOkB,EAAW,wBAClB,QAASA,EAAW,0BACpB,YAAaA,EAAW,yBACxB,aACEhB,EACIgB,EAAW,iCACXA,EAAW,0BAEjB,SAAUe,GACV,UAAW/B,EAAoB,OAAY4B,EAC3C,gBAAiB,GACjB,mBAAoB0B,EACpB,cAAY,mCAAA,CAAA,EAEd,SAAS,IAAA,EAEZhD,GACCsD,EACE7E,EAAC8E,EAAA,CACC,KAAMvD,EACN,MAAOU,EAAW,iBAClB,QAASA,EAAW,mBACpB,YAAaA,EAAW,kBACxB,aACER,EACIQ,EAAW,0BACXA,EAAW,mBAEjB,SAAUkB,GACV,UAAW1B,EAAc,OAAYwB,GACrC,gBAAiB,GACjB,mBAAoByB,EACpB,cAAY,2BAAA,CAAA,EAEd,SAAS,IAAA,CACX,EACJ,CAEJ"}
|
|
1
|
+
{"version":3,"file":"ManageNegotiableQuoteTemplate.js","sources":["/@dropins/storefront-quote-management/src/components/ManageNegotiableQuoteTemplate/ManageNegotiableQuoteTemplate.tsx","/@dropins/storefront-quote-management/src/components/ReferenceDocumentFormModal/ReferenceDocumentFormModal.tsx","/@dropins/storefront-quote-management/src/components/ReferenceDocumentsList/ReferenceDocumentsList.tsx","/@dropins/storefront-quote-management/src/hooks/useReferenceDocumentLinks.ts","/@dropins/storefront-quote-management/src/hooks/useRenameTemplate.ts","/@dropins/storefront-quote-management/src/containers/ManageNegotiableQuoteTemplate/ManageNegotiableQuoteTemplate.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 { Skeleton, SkeletonRow } from '@adobe-commerce/elsie/components';\n\nimport '@/quote-management/components/ManageNegotiableQuoteTemplate/ManageNegotiableQuoteTemplate.css';\n\nexport interface ManageNegotiableQuoteTemplateProps extends Omit<HTMLAttributes<HTMLDivElement>, 'loading'> {\n loading?: boolean;\n templateName: VNode;\n templateStatus: VNode;\n banner?: VNode;\n details?: VNode;\n actionBar?: VNode;\n referenceDocuments?: VNode;\n itemsTable: VNode;\n shippingInformationTitle?: VNode;\n shippingInformation?: VNode;\n commentsTitle: VNode;\n comments: VNode;\n attachFilesField?: VNode;\n attachedFilesList?: VNode;\n footer?: VNode;\n}\n\nexport const ManageNegotiableQuoteTemplate: FunctionComponent<ManageNegotiableQuoteTemplateProps> = ({\n className,\n loading,\n templateName,\n templateStatus,\n banner,\n details,\n actionBar,\n referenceDocuments,\n itemsTable,\n shippingInformationTitle,\n shippingInformation,\n commentsTitle,\n comments,\n attachFilesField,\n attachedFilesList,\n footer,\n ...props\n}) => {\n if (loading) {\n return <ManageNegotiableQuoteTemplateSkeleton />;\n }\n\n return (\n <div {...props} className={classes(['quote-management-manage-negotiable-quote-template', className])}>\n <div className={classes(['quote-management-manage-negotiable-quote-template__header'])}>\n {templateName &&\n <VComponent\n node={templateName}\n className={classes(['quote-management-manage-negotiable-quote-template__template-name'])}\n />\n }\n {templateStatus &&\n <VComponent\n node={templateStatus}\n className={classes(['quote-management-manage-negotiable-quote-template__template-status'])}\n />\n }\n </div>\n {banner &&\n <VComponent\n node={banner}\n className={classes(['quote-management-manage-negotiable-quote-template__banner'])}\n />\n }\n {details &&\n <VComponent\n node={details}\n className={classes(['quote-management-manage-negotiable-quote-template__details'])}\n />\n }\n {actionBar &&\n <VComponent\n node={actionBar}\n className={classes(['quote-management-manage-negotiable-quote-template__action-bar'])}\n />\n }\n {referenceDocuments &&\n <div data-testid=\"reference-documents-container\" className={classes(['quote-management-manage-negotiable-quote-template__reference-documents-container'])}>\n <VComponent\n node={referenceDocuments}\n className={classes(['quote-management-manage-negotiable-quote-template__reference-documents'])}\n />\n </div>\n }\n {itemsTable &&\n <VComponent\n node={itemsTable}\n className={classes(['quote-management-manage-negotiable-quote-template__items-table'])}\n />\n }\n <div data-testid=\"template-shipping-information-container\" className={classes(['quote-management-manage-negotiable-quote-template__shipping-information-container'])}>\n {shippingInformationTitle &&\n <VComponent\n node={shippingInformationTitle}\n className={classes(['quote-management-manage-negotiable-quote-template__shipping-information-title'])}\n />\n }\n {shippingInformation &&\n <VComponent\n node={shippingInformation}\n className={classes(['quote-management-manage-negotiable-quote-template__shipping-information'])}\n />\n }\n </div>\n <div data-testid=\"comments-container\" className={classes(['quote-management-manage-negotiable-quote-template__comments-container'])}>\n {commentsTitle &&\n <VComponent\n node={commentsTitle}\n className={classes(['quote-management-manage-negotiable-quote-template__comments-title'])}\n />\n }\n {comments &&\n <VComponent\n node={comments}\n className={classes(['quote-management-manage-negotiable-quote-template__comments'])}\n />\n }\n {attachFilesField &&\n <VComponent\n node={attachFilesField}\n className={classes(['quote-management-manage-negotiable-quote-template__attach-files-field'])}\n />\n }\n {attachedFilesList &&\n <VComponent\n node={attachedFilesList}\n className={classes(['quote-management-manage-negotiable-quote-template__attached-files-list'])}\n />\n }\n </div>\n {footer &&\n <VComponent\n node={footer}\n className={classes(['quote-management-manage-negotiable-quote-template__footer'])}\n />\n }\n </div>\n );\n};\n\nexport const ManageNegotiableQuoteTemplateSkeleton: FunctionComponent = () => {\n return (\n <Skeleton data-testid=\"manage-negotiable-quote-template-skeleton\">\n <SkeletonRow variant=\"heading\" fullWidth={true} size=\"large\" />\n <SkeletonRow variant=\"row\" fullWidth={false} size=\"small\" />\n <SkeletonRow variant=\"row\" fullWidth={false} size=\"small\" />\n <SkeletonRow variant=\"row\" fullWidth={true} />\n <SkeletonRow variant=\"row\" fullWidth={true} size=\"xlarge\" lines={2} />\n <SkeletonRow variant=\"row\" fullWidth={false} size=\"small\" />\n </Skeleton>\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 { FunctionComponent, useCallback, useEffect, useState, HTMLAttributes } from 'preact/compat';\nimport { VNode } from 'preact';\nimport { classes } from '@adobe-commerce/elsie/lib';\nimport { useText } from '@adobe-commerce/elsie/i18n';\nimport { Button, Input, Modal, InLineAlert } from '@adobe-commerce/elsie/components';\nimport { WarningFilled } from '@adobe-commerce/elsie/icons';\nimport '@/quote-management/components/ReferenceDocumentFormModal/ReferenceDocumentFormModal.css';\n\nexport interface ReferenceDocument {\n uid?: string;\n name: string;\n identifier?: string;\n url: string;\n}\n\nexport interface ReferenceDocumentFormModalProps\n extends Omit<HTMLAttributes<HTMLDivElement>, 'title'> {\n open: boolean;\n document?: ReferenceDocument;\n /**\n * Optional error message string. If provided, automatically creates an InLineAlert error banner.\n * If both errorMessage and errorBanner are provided, errorBanner takes precedence.\n */\n errorMessage?: string;\n /**\n * Optional custom error banner VNode. Provides full control over error banner rendering.\n * If both errorMessage and errorBanner are provided, errorBanner takes precedence.\n */\n errorBanner?: VNode;\n successBanner?: VNode;\n showCloseButton?: boolean;\n isSubmitting?: boolean;\n onSave: (document: ReferenceDocument) => void;\n onClose?: () => void;\n}\n\nexport const ReferenceDocumentFormModal: FunctionComponent<ReferenceDocumentFormModalProps> = ({\n className,\n open,\n document,\n errorMessage,\n errorBanner,\n successBanner,\n showCloseButton = true,\n isSubmitting = false,\n onSave,\n onClose,\n}) => {\n const [documentName, setDocumentName] = useState('');\n const [documentIdentifier, setDocumentIdentifier] = useState('');\n const [referenceUrl, setReferenceUrl] = useState('');\n const [errors, setErrors] = useState<{\n documentName?: string;\n documentIdentifier?: string;\n referenceUrl?: string;\n }>({});\n\n const dictionary = useText({\n title: 'NegotiableQuoteTemplate.Manage.referenceDocuments.form.title',\n documentNameLabel: 'NegotiableQuoteTemplate.Manage.referenceDocuments.form.documentNameLabel',\n documentIdentifierLabel: 'NegotiableQuoteTemplate.Manage.referenceDocuments.form.documentIdentifierLabel',\n referenceUrlLabel: 'NegotiableQuoteTemplate.Manage.referenceDocuments.form.referenceUrlLabel',\n addButton: 'NegotiableQuoteTemplate.Manage.referenceDocuments.form.addButton',\n updateButton: 'NegotiableQuoteTemplate.Manage.referenceDocuments.form.updateButton',\n cancelButton: 'NegotiableQuoteTemplate.Manage.referenceDocuments.form.cancelButton',\n documentNameRequired: 'NegotiableQuoteTemplate.Manage.referenceDocuments.form.documentNameRequired',\n documentIdentifierRequired: 'NegotiableQuoteTemplate.Manage.referenceDocuments.form.documentIdentifierRequired',\n referenceUrlRequired: 'NegotiableQuoteTemplate.Manage.referenceDocuments.form.referenceUrlRequired',\n invalidUrl: 'NegotiableQuoteTemplate.Manage.referenceDocuments.form.invalidUrl',\n errorHeading: 'NegotiableQuoteTemplate.Manage.referenceDocuments.form.errorHeading',\n });\n\n // Create error banner from errorMessage if errorBanner is not provided\n const displayErrorBanner = errorBanner || (errorMessage ? (\n <InLineAlert\n type=\"error\"\n variant=\"primary\"\n icon={<WarningFilled />}\n heading={dictionary.errorHeading}\n description={errorMessage}\n data-testid=\"reference-document-form-modal-error-banner-inline\"\n />\n ) : null);\n\n // Determine if we're in edit mode (document prop is provided)\n const isEditMode = !!document;\n\n // Reset form when modal opens or document changes\n useEffect(() => {\n if (open) {\n if (document) {\n setDocumentName(document.name || '');\n setDocumentIdentifier(document.identifier || '');\n setReferenceUrl(document.url || '');\n } else {\n setDocumentName('');\n setDocumentIdentifier('');\n setReferenceUrl('');\n }\n setErrors({});\n }\n }, [open, document]);\n\n const validateUrl = useCallback((url: string): boolean => {\n // istanbul ignore if - whitespace-only URL are caught before this function is called, but leaving this here for defensive programming.\n if (!url.trim()) {\n return false;\n }\n try {\n new URL(url);\n return true;\n } catch {\n return false;\n }\n }, []);\n\n const handleSave = useCallback(() => {\n const newErrors: { documentName?: string; documentIdentifier?: string; referenceUrl?: string } = {};\n\n if (!documentName.trim()) {\n newErrors.documentName = dictionary.documentNameRequired;\n }\n\n if (!referenceUrl.trim()) {\n newErrors.referenceUrl = dictionary.referenceUrlRequired;\n } else if (!validateUrl(referenceUrl.trim())) {\n newErrors.referenceUrl = dictionary.invalidUrl;\n }\n\n if (!documentIdentifier.trim()) {\n newErrors.documentIdentifier = dictionary.documentIdentifierRequired;\n }\n\n if (Object.keys(newErrors).length > 0) {\n setErrors(newErrors);\n return;\n }\n\n onSave({\n uid: document?.uid,\n name: documentName.trim(),\n identifier: documentIdentifier.trim(),\n url: referenceUrl.trim(),\n });\n }, [documentName, documentIdentifier, referenceUrl, document, dictionary, validateUrl, onSave]);\n\n const handleClose = useCallback(() => {\n setDocumentName('');\n setDocumentIdentifier('');\n setReferenceUrl('');\n setErrors({});\n onClose?.();\n }, [onClose]);\n\n if (!open) {\n return null;\n }\n\n return (\n <Modal\n open={open}\n size=\"medium\"\n title={<>{dictionary.title}</>}\n onClose={handleClose}\n clickToDismiss={true}\n escapeToDismiss={true}\n showCloseButton={showCloseButton}\n className={classes(['quote-management-reference-document-form-modal', className])}\n data-testid=\"reference-document-form-modal\"\n >\n {displayErrorBanner && (\n <div\n className={classes(['quote-management-reference-document-form-modal__error-banner'])}\n data-testid=\"reference-document-form-modal-error-banner\"\n >\n {displayErrorBanner}\n </div>\n )}\n\n {successBanner && (\n <div\n className={classes(['quote-management-reference-document-form-modal__success-banner'])}\n data-testid=\"reference-document-form-modal-success-banner\"\n >\n {successBanner}\n </div>\n )}\n\n <div className={classes(['quote-management-reference-document-form-modal__content'])}>\n <div>\n <Input\n name=\"documentName\"\n type=\"text\"\n value={documentName}\n onInput={(e: any) => {\n setDocumentName(e.target.value);\n setErrors({ ...errors, documentName: undefined });\n }}\n floatingLabel={dictionary.documentNameLabel}\n required\n error={!!errors.documentName}\n disabled={isSubmitting}\n data-testid=\"reference-document-name-input\"\n />\n {errors.documentName && (\n <span\n className={classes(['quote-management-reference-document-form-modal__error-text'])}\n data-testid=\"reference-document-name-error\"\n >\n {errors.documentName}\n </span>\n )}\n </div>\n\n <div>\n <Input\n name=\"documentIdentifier\"\n type=\"text\"\n value={documentIdentifier}\n onInput={(e: any) => {\n setDocumentIdentifier(e.target.value);\n setErrors({ ...errors, documentIdentifier: undefined });\n }}\n floatingLabel={dictionary.documentIdentifierLabel}\n error={!!errors.documentIdentifier}\n disabled={isSubmitting}\n data-testid=\"reference-document-identifier-input\"\n />\n {errors.documentIdentifier && (\n <span\n className={classes(['quote-management-reference-document-form-modal__error-text'])}\n data-testid=\"reference-document-identifier-error\"\n >\n {errors.documentIdentifier}\n </span>\n )}\n </div>\n\n <div>\n <Input\n name=\"referenceUrl\"\n type=\"url\"\n value={referenceUrl}\n onInput={(e: any) => {\n setReferenceUrl(e.target.value);\n setErrors({ ...errors, referenceUrl: undefined });\n }}\n floatingLabel={dictionary.referenceUrlLabel}\n required\n error={!!errors.referenceUrl}\n disabled={isSubmitting}\n data-testid=\"reference-document-url-input\"\n />\n {errors.referenceUrl && (\n <span\n className={classes(['quote-management-reference-document-form-modal__error-text'])}\n data-testid=\"reference-document-url-error\"\n >\n {errors.referenceUrl}\n </span>\n )}\n </div>\n </div>\n\n <div className={classes(['quote-management-reference-document-form-modal__actions'])}>\n <Button\n variant=\"secondary\"\n size=\"medium\"\n onClick={handleClose}\n disabled={isSubmitting}\n className={classes(['quote-management-reference-document-form-modal__cancel-button'])}\n data-testid=\"reference-document-form-cancel-button\"\n >\n {dictionary.cancelButton}\n </Button>\n <Button\n variant=\"primary\"\n size=\"medium\"\n onClick={handleSave}\n disabled={isSubmitting}\n className={classes(['quote-management-reference-document-form-modal__save-button'])}\n data-testid=\"reference-document-form-save-button\"\n >\n {isEditMode ? dictionary.updateButton : dictionary.addButton}\n </Button>\n </div>\n </Modal>\n );\n};\n\n","/********************************************************************\n * Copyright 2025 Adobe\n * All Rights Reserved.\n *\n * NOTICE: Adobe permits you to use, modify, and distribute this\n * file in accordance with the terms of the Adobe license agreement\n * accompanying it.\n *******************************************************************/\n\nimport { FunctionComponent } from 'preact';\nimport { HTMLAttributes } from 'preact/compat';\nimport { classes } from '@adobe-commerce/elsie/lib';\nimport { useText } from '@adobe-commerce/elsie/i18n';\nimport { Button } from '@adobe-commerce/elsie/components';\nimport '@/quote-management/components/ReferenceDocumentsList/ReferenceDocumentsList.css';\n\nexport interface ReferenceDocument {\n uid?: string;\n name: string;\n identifier?: string;\n url: string;\n}\n\nexport interface ReferenceDocumentsListProps extends HTMLAttributes<HTMLDivElement> {\n documents: ReferenceDocument[];\n isEditable?: boolean;\n onAdd?: () => void;\n onEdit?: (document: ReferenceDocument) => void;\n onRemove?: (document: ReferenceDocument) => void;\n}\n\nexport const ReferenceDocumentsList: FunctionComponent<ReferenceDocumentsListProps> = ({\n className,\n documents,\n isEditable = false,\n onAdd,\n onEdit,\n onRemove,\n ...props\n}) => {\n const dictionary = useText({\n add: 'NegotiableQuoteTemplate.Manage.referenceDocuments.add',\n edit: 'NegotiableQuoteTemplate.Manage.referenceDocuments.edit',\n remove: 'NegotiableQuoteTemplate.Manage.referenceDocuments.remove',\n noReferenceDocuments: 'NegotiableQuoteTemplate.Manage.referenceDocuments.noReferenceDocuments',\n });\n\n const formatDocumentDisplay = (doc: ReferenceDocument): string => {\n if (doc.identifier) {\n return `${doc.name}, ${doc.identifier}`;\n }\n return `${doc.name} ${doc.url}`;\n };\n\n const handleDocumentClick = (e: Event, url: string) => {\n e.preventDefault();\n window.open(url, '_blank', 'noopener,noreferrer');\n };\n\n return (\n <div\n className={classes(['quote-management-reference-documents-list', className])}\n data-testid=\"reference-documents-list\"\n {...props}\n >\n <div className=\"quote-management-reference-documents-list__content\">\n {documents.map((doc) => (\n <div\n key={doc.uid || doc.url}\n className=\"quote-management-reference-documents-list__document\"\n data-testid={`reference-document-${doc.uid || doc.url}`}\n >\n <a\n href={doc.url}\n onClick={(e) => handleDocumentClick(e, doc.url)}\n className=\"quote-management-reference-documents-list__document-link\"\n target=\"_blank\"\n rel=\"noopener noreferrer\"\n data-testid={`reference-document-link-${doc.uid || doc.url}`}\n >\n {formatDocumentDisplay(doc)}\n </a>\n {isEditable && (\n <div className=\"quote-management-reference-documents-list__document-actions\">\n <Button\n variant=\"tertiary\"\n onClick={() => onEdit?.(doc)}\n className=\"quote-management-reference-documents-list__edit-button\"\n data-testid={`reference-document-edit-${doc.uid || doc.url}`}\n >\n {dictionary.edit}\n </Button>\n <span className=\"quote-management-reference-documents-list__separator\">|</span>\n <Button\n variant=\"tertiary\"\n onClick={() => onRemove?.(doc)}\n className=\"quote-management-reference-documents-list__remove-button\"\n data-testid={`reference-document-remove-${doc.uid || doc.url}`}\n >\n {dictionary.remove}\n </Button>\n </div>\n )}\n </div>\n ))}\n {isEditable && (\n <Button\n variant=\"tertiary\"\n onClick={onAdd}\n className=\"quote-management-reference-documents-list__add-button\"\n data-testid=\"reference-documents-add-button\"\n >\n + {dictionary.add}\n </Button>\n )}\n {documents.length === 0 && !isEditable && (\n <div className=\"quote-management-reference-documents-list__empty\">\n {dictionary.noReferenceDocuments}\n </div>\n )}\n </div>\n </div>\n );\n};\n\n","/********************************************************************\n * Copyright 2025 Adobe\n * All Rights Reserved.\n *\n * NOTICE: Adobe permits you to use, modify, and distribute this \n * file in accordance with the terms of the Adobe license agreement \n * accompanying it. \n *******************************************************************/\n\nimport { useMemo, useCallback } from 'preact/compat';\nimport { ReferenceDocument } from '@/quote-management/components';\nimport { ReferenceDocumentLinkInput } from '@/quote-management/api/sendQuoteTemplateForReview/sendQuoteTemplateForReview';\n\nexport interface UseReferenceDocumentLinksParams {\n templateReferenceDocuments?: ReferenceDocument[];\n localReferenceDocuments: ReferenceDocument[];\n}\n\nexport interface UseReferenceDocumentLinksReturn {\n /**\n * Checks if a document exists in the template reference documents.\n * Matches by uid if both documents have it, otherwise matches by url.\n */\n isDocumentInTemplateData: (document: ReferenceDocument) => boolean;\n /**\n * Returns documents from localReferenceDocuments that are not in templateReferenceDocuments.\n */\n getNewDocuments: () => ReferenceDocument[];\n /**\n * Transforms all reference documents to API format.\n */\n getReferenceDocumentLinks: () => ReferenceDocumentLinkInput[];\n /**\n * Indicates if there are unsaved changes (new documents, removed documents, or modified documents).\n */\n hasUnsavedChanges: boolean;\n}\n\n/**\n * Custom hook to manage reference document links logic.\n * Handles document matching, filtering new documents, transformation to API format,\n * and detection of unsaved changes (new, removed, or modified documents).\n * Note: getReferenceDocumentLinks() returns all local reference documents, not just new ones.\n */\nexport const useReferenceDocumentLinks = (\n params: UseReferenceDocumentLinksParams\n): UseReferenceDocumentLinksReturn => {\n const { templateReferenceDocuments, localReferenceDocuments } = params;\n\n /**\n * Helper function to find a matching document in template data for a given document.\n * Matches by uid if both documents have it, otherwise matches by url.\n * Returns the matching template document or undefined if no match is found.\n */\n const findMatchingTemplateDocument = useCallback(\n (document: ReferenceDocument): ReferenceDocument | undefined => {\n if (!templateReferenceDocuments) {\n return undefined;\n }\n return templateReferenceDocuments.find((templateDoc) => {\n // If both documents have uids, match by uid\n if (document.uid && templateDoc.uid) {\n return templateDoc.uid === document.uid;\n }\n // Otherwise, match by URL\n return templateDoc.url === document.url;\n });\n },\n [templateReferenceDocuments]\n );\n\n /**\n * Helper function to check if a document is part of the template data.\n * A document is considered part of template data if:\n * - Its uid exists in templateReferenceDocuments (when uid is available), OR\n * - Its url exists in templateReferenceDocuments (when uid is not available)\n */\n const isDocumentInTemplateData = useCallback(\n (document: ReferenceDocument): boolean => {\n return findMatchingTemplateDocument(document) !== undefined;\n },\n [findMatchingTemplateDocument]\n );\n\n /**\n * Helper function to check if a document has been modified.\n * Compares all properties (name, identifier, url) between a local document and its matching template document.\n * Returns true if any property differs.\n */\n const isDocumentModified = useCallback(\n (localDoc: ReferenceDocument, templateDoc: ReferenceDocument): boolean => {\n // Compare all properties\n return (\n localDoc.name !== templateDoc.name ||\n localDoc.identifier !== templateDoc.identifier ||\n localDoc.url !== templateDoc.url\n );\n },\n []\n );\n\n /**\n * Returns documents from localReferenceDocuments that are not in templateReferenceDocuments.\n */\n const getNewDocuments = useCallback((): ReferenceDocument[] => {\n if (!templateReferenceDocuments) {\n // If no template documents exist, all local documents are new\n return localReferenceDocuments;\n }\n // Filter to only include documents not in template data\n return localReferenceDocuments.filter((doc) => {\n return !templateReferenceDocuments.some((templateDoc) => {\n // If both documents have uids, match by uid\n if (doc.uid && templateDoc.uid) {\n return templateDoc.uid === doc.uid;\n }\n // Otherwise, match by URL\n return templateDoc.url === doc.url;\n });\n });\n }, [templateReferenceDocuments, localReferenceDocuments]);\n\n /**\n * Transforms all reference documents to API format.\n */\n const getReferenceDocumentLinks = useCallback((): ReferenceDocumentLinkInput[] => {\n return localReferenceDocuments.map((doc) => ({\n uid: doc.uid,\n name: doc.name,\n identifier: doc.identifier,\n url: doc.url,\n }));\n }, [localReferenceDocuments]);\n\n /**\n * Checks if there are unsaved changes.\n * Returns true if there are:\n * - New documents: documents in local state that don't exist in template data\n * - Removed documents: documents in template data that don't exist in local state\n * - Modified documents: documents that exist in both but have different properties (name, identifier, or url)\n */\n const hasUnsavedChanges = useMemo(() => {\n if (!templateReferenceDocuments) {\n // If no template documents exist, any documents in local state are unsaved (new)\n return localReferenceDocuments.length > 0;\n }\n\n // Check for new documents: documents in local state not found in template data\n const hasNewDocuments = localReferenceDocuments.some((localDoc) => {\n return findMatchingTemplateDocument(localDoc) === undefined;\n });\n\n if (hasNewDocuments) {\n return true;\n }\n\n // Check for removed documents: documents in template data not found in local state\n const hasRemovedDocuments = templateReferenceDocuments.some((templateDoc) => {\n return !localReferenceDocuments.some((localDoc) => {\n // If both documents have uids, match by uid\n if (localDoc.uid && templateDoc.uid) {\n return localDoc.uid === templateDoc.uid;\n }\n // Otherwise, match by URL\n return localDoc.url === templateDoc.url;\n });\n });\n\n if (hasRemovedDocuments) {\n return true;\n }\n\n // Check for modified documents: documents that match but have different properties\n const hasModifiedDocuments = localReferenceDocuments.some((localDoc) => {\n const matchingTemplateDoc = findMatchingTemplateDocument(localDoc);\n // Defensive code: The falsy branch should be unreachable because we've already checked\n // for new documents above. If a document doesn't have a match, we would have\n // returned true in the hasNewDocuments check. This is kept for safety.\n /* istanbul ignore else */\n if (matchingTemplateDoc) {\n return isDocumentModified(localDoc, matchingTemplateDoc);\n }\n /* istanbul ignore next */\n return false;\n });\n\n return hasModifiedDocuments;\n }, [templateReferenceDocuments, localReferenceDocuments, findMatchingTemplateDocument, isDocumentModified]);\n\n return {\n isDocumentInTemplateData,\n getNewDocuments,\n getReferenceDocumentLinks,\n hasUnsavedChanges,\n };\n};\n\n\n","/********************************************************************\n * Copyright 2025 Adobe\n * All Rights Reserved.\n *\n * NOTICE: Adobe permits you to use, modify, and distribute this \n * file in accordance with the terms of the Adobe license agreement \n * accompanying it. \n *******************************************************************/\n\nimport { useState, useCallback } from 'preact/compat';\n\nexport interface UseRenameTemplateParams {\n initialTemplateName?: string;\n templateNameRequiredErrorMessage?: string;\n}\n\nexport interface UseRenameTemplateReturn {\n /**\n * Whether the rename modal is currently open.\n */\n isRenameModalOpen: boolean;\n /**\n * The new template name entered by the user.\n */\n renameTemplateName: string;\n /**\n * The reason for renaming the template.\n */\n renameReason: string;\n /**\n * Error message for rename operation.\n */\n renameError: string;\n /**\n * Error message for template name validation.\n */\n renameTemplateNameError: string;\n /**\n * Success message for rename operation.\n */\n renameSuccess: string;\n /**\n * Opens the rename modal and initializes state with the current template name.\n */\n handleRenameClick: (currentTemplateName?: string) => void;\n /**\n * Closes the rename modal and resets all state.\n */\n handleRenameClose: () => void;\n /**\n * Updates the template name and clears any name-related errors.\n */\n handleRenameTemplateNameChange: (value: string) => void;\n /**\n * Updates the rename reason.\n */\n handleRenameReasonChange: (value: string) => void;\n /**\n * Validates and saves the rename. Closes the modal if validation passes.\n * Does not make an API call - rename is tracked locally and included when submitting for review.\n */\n handleRenameSave: () => boolean;\n /**\n * Resets rename state (useful after successful submission).\n */\n resetRenameState: () => void;\n}\n\n/**\n * Custom hook to manage quote template rename functionality.\n * Handles state management for the rename modal, validation, and tracking rename changes.\n * Note: This hook does not make API calls. The rename is tracked locally and should be\n * included when calling sendQuoteTemplateForReview.\n */\nexport const useRenameTemplate = (\n params: UseRenameTemplateParams = {}\n): UseRenameTemplateReturn => {\n const { initialTemplateName, templateNameRequiredErrorMessage = 'Template name is required' } = params;\n\n const [isRenameModalOpen, setIsRenameModalOpen] = useState<boolean>(false);\n const [renameTemplateName, setRenameTemplateName] = useState<string>('');\n const [renameReason, setRenameReason] = useState<string>('');\n const [renameError, setRenameError] = useState<string>('');\n const [renameTemplateNameError, setRenameTemplateNameError] = useState<string>('');\n const [renameSuccess, setRenameSuccess] = useState<string>('');\n\n const handleRenameClick = useCallback((currentTemplateName?: string) => {\n setRenameTemplateName(currentTemplateName || initialTemplateName || '');\n setRenameReason('');\n setRenameError('');\n setRenameTemplateNameError('');\n setRenameSuccess('');\n setIsRenameModalOpen(true);\n }, [initialTemplateName]);\n\n const handleRenameClose = useCallback(() => {\n setIsRenameModalOpen(false);\n setRenameTemplateName('');\n setRenameReason('');\n setRenameError('');\n setRenameTemplateNameError('');\n setRenameSuccess('');\n }, []);\n\n const handleRenameTemplateNameChange = useCallback((value: string) => {\n setRenameTemplateName(value);\n if (value.trim()) {\n setRenameTemplateNameError('');\n }\n }, []);\n\n const handleRenameReasonChange = useCallback((value: string) => {\n setRenameReason(value);\n }, []);\n\n const handleRenameSave = useCallback((): boolean => {\n // Validate template name\n if (!renameTemplateName.trim()) {\n setRenameTemplateNameError(templateNameRequiredErrorMessage);\n return false;\n }\n\n // Clear any previous errors\n setRenameError('');\n setRenameTemplateNameError('');\n \n // Close modal - rename is tracked in state and will be included when submitting for review\n setIsRenameModalOpen(false);\n return true;\n }, [renameTemplateName, templateNameRequiredErrorMessage]);\n\n const resetRenameState = useCallback(() => {\n setRenameTemplateName('');\n setRenameReason('');\n setRenameError('');\n setRenameTemplateNameError('');\n setRenameSuccess('');\n }, []);\n\n return {\n isRenameModalOpen,\n renameTemplateName,\n renameReason,\n renameError,\n renameTemplateNameError,\n renameSuccess,\n handleRenameClick,\n handleRenameClose,\n handleRenameTemplateNameChange,\n handleRenameReasonChange,\n handleRenameSave,\n resetRenameState,\n };\n};\n\n","/********************************************************************\n * Copyright 2025 Adobe\n * All Rights Reserved.\n *\n * NOTICE: Adobe permits you to use, modify, and distribute this \n * file in accordance with the terms of the Adobe license agreement \n * accompanying it. \n *******************************************************************/\n\nimport {\n HTMLAttributes,\n useCallback,\n useEffect,\n useMemo,\n useState,\n createPortal,\n useRef,\n} from 'preact/compat';\nimport {\n Container,\n Slot,\n SlotProps,\n} from '@adobe-commerce/elsie/lib';\nimport { formattedDate } from '@/quote-management/utils/dateUtils';\nimport { events } from '@adobe-commerce/event-bus';\nimport { useText } from '@adobe-commerce/elsie/i18n';\nimport {\n Button,\n TextArea,\n InLineAlert,\n Icon,\n InputFile,\n} from '@adobe-commerce/elsie/components';\nimport { NegotiableQuoteTemplateModel, NegotiableQuoteTemplateStatus } from '@/quote-management/data/models/negotiable-quote-template-model';\nimport {\n TabbedContent,\n ActionsBar,\n ConfirmationModal,\n ManageNegotiableQuoteTemplate as ManageNegotiableQuoteTemplateComponent,\n ManageNegotiableQuoteTemplateProps as ManageNegotiableQuoteTemplateComponentProps,\n ReferenceDocumentsList,\n ReferenceDocumentFormModal,\n ReferenceDocument,\n AttachedFilesList,\n AttachedFile,\n} from '@/quote-management/components';\nimport {\n ItemsQuotedTemplate,\n QuoteTemplateCommentsList,\n QuoteTemplateHistoryLog,\n ShippingAddressDisplay,\n} from '@/quote-management/containers';\nimport {\n WarningFilled,\n CheckWithCircle,\n Edit,\n Add,\n} from '@adobe-commerce/elsie/icons';\nimport {\n sendQuoteTemplateForReview,\n deleteQuoteTemplate,\n cancelQuoteTemplate,\n generateQuoteFromTemplate,\n openQuoteTemplate,\n acceptQuoteTemplate,\n uploadFile,\n ReferenceDocumentLinkInput,\n} from '@/quote-management/api';\nimport { useReferenceDocumentLinks } from '@/quote-management/hooks/useReferenceDocumentLinks';\nimport { useRenameTemplate } from '@/quote-management/hooks/useRenameTemplate';\nimport { RenameQuoteModal } from '@/quote-management/components/RenameQuoteModal';\nimport { formatFileSize, validateFileSize, validateFileType } from '@/quote-management/utils/fileUtils';\n\nexport interface ManageNegotiableQuoteTemplateProps\n extends HTMLAttributes<HTMLDivElement> {\n onActionsButtonClick?: (action: string) => void;\n onSendForReview?: (params: {\n templateData?: NegotiableQuoteTemplateModel;\n name?: string;\n comment?: string;\n referenceDocumentLinks?: ReferenceDocumentLinkInput[];\n attachments?: AttachedFile[];\n }) => void;\n maxFiles?: number;\n maxFileSize?: number;\n acceptedFileTypes?: string[];\n slots?: {\n TemplateName?: SlotProps<{\n templateName?: string;\n templateData?: NegotiableQuoteTemplateModel;\n templateDisplayName?: string;\n isRenameDisabled?: boolean;\n }>;\n TemplateStatus?: SlotProps<{\n templateStatus?: string;\n templateData?: NegotiableQuoteTemplateModel;\n }>;\n Banner?: SlotProps<{\n templateData?: NegotiableQuoteTemplateModel;\n }>;\n Details?: SlotProps<{\n templateData?: NegotiableQuoteTemplateModel;\n }>;\n ActionBar?: SlotProps<{\n templateData?: NegotiableQuoteTemplateModel;\n }>;\n ReferenceDocuments?: SlotProps<{\n templateData?: NegotiableQuoteTemplateModel;\n referenceDocuments?: ReferenceDocument[];\n isEditable?: boolean;\n onAddDocument?: () => void;\n onEditDocument?: (document: ReferenceDocument) => void;\n onRemoveDocument?: (document: ReferenceDocument) => void;\n referenceDocumentsTitle?: string;\n }>;\n ItemsTable?: SlotProps<{\n templateData?: NegotiableQuoteTemplateModel;\n }>;\n ItemsQuotedTab?: SlotProps<{\n templateData?: NegotiableQuoteTemplateModel;\n }>;\n CommentsTab?: SlotProps<{\n templateData?: NegotiableQuoteTemplateModel;\n }>;\n HistoryLogTab?: SlotProps<{\n templateData?: NegotiableQuoteTemplateModel;\n }>;\n CommentsTitle?: SlotProps<{\n templateData?: NegotiableQuoteTemplateModel;\n }>;\n Comments?: SlotProps<{\n templateData?: NegotiableQuoteTemplateModel;\n }>;\n AttachFilesField?: SlotProps<{\n templateData?: NegotiableQuoteTemplateModel;\n onFileChange: (files: File[]) => void;\n attachedFiles: AttachedFile[];\n fileUploadError: string | undefined;\n disabled: boolean;\n }>;\n AttachedFilesList?: SlotProps<{\n templateData?: NegotiableQuoteTemplateModel;\n files: AttachedFile[];\n onRemove: (key: string) => void;\n disabled: boolean;\n }>;\n HistoryLogTitle?: SlotProps<{\n templateData?: NegotiableQuoteTemplateModel;\n }>;\n HistoryLog?: SlotProps<{\n templateData?: NegotiableQuoteTemplateModel;\n }>;\n Footer?: SlotProps<{\n templateData?: NegotiableQuoteTemplateModel;\n comment?: string;\n isSubmitting?: boolean;\n attachedFiles?: AttachedFile[];\n referenceDocuments?: ReferenceDocument[];\n hasUnsavedChanges?: boolean;\n handleSendForReview: () => void;\n showAcceptButton?: boolean;\n renameTemplateName?: string;\n renameReason?: string;\n }>;\n ShippingInformationTitle?: SlotProps<{\n templateData?: NegotiableQuoteTemplateModel;\n }>;\n ShippingInformation?: SlotProps<{\n templateData?: NegotiableQuoteTemplateModel;\n loading?: boolean;\n setLoading?: (loading: boolean) => void;\n }>;\n };\n}\n\nexport const ManageNegotiableQuoteTemplate: Container<ManageNegotiableQuoteTemplateProps> = ({\n slots,\n onActionsButtonClick,\n onSendForReview,\n maxFiles,\n maxFileSize,\n acceptedFileTypes,\n ...props\n}) => {\n const [templateData, setTemplateData] = useState<NegotiableQuoteTemplateModel | undefined>(undefined);\n const [loading, setLoading] = useState<boolean>(true);\n const [comment, setComment] = useState<string>('');\n const [isSubmitting, setIsSubmitting] = useState<boolean>(false);\n const [isDeleteDialogOpen, setIsDeleteDialogOpen] = useState<boolean>(false);\n const [deleteError, setDeleteError] = useState<string | null>(null);\n const [deleteSuccess, setDeleteSuccess] = useState<boolean>(false);\n const [isCancelDialogOpen, setIsCancelDialogOpen] = useState<boolean>(false);\n const [cancelError, setCancelError] = useState<string | null>(null);\n const [cancelSuccess, setCancelSuccess] = useState<boolean>(false);\n const [referenceDocuments, setReferenceDocuments] = useState<ReferenceDocument[]>([]);\n const [isDocumentModalOpen, setIsDocumentModalOpen] = useState<boolean>(false);\n const [editingDocument, setEditingDocument] = useState<ReferenceDocument | undefined>(undefined);\n const [documentModalErrorMessage, setDocumentModalErrorMessage] = useState<string | null>(null);\n const [showGenerateQuoteModal, setShowGenerateQuoteModal] = useState<boolean>(false);\n const [isGeneratingQuote, setIsGeneratingQuote] = useState<boolean>(false);\n const [generateQuoteSuccessMessage, setGenerateQuoteSuccessMessage] = useState<string>('');\n const [generateQuoteErrorMessage, setGenerateQuoteErrorMessage] = useState<string>('');\n const [showAcceptModal, setShowAcceptModal] = useState<boolean>(false);\n const [isAccepting, setIsAccepting] = useState<boolean>(false);\n const [acceptSuccessMessage, setAcceptSuccessMessage] = useState<string>('');\n const [acceptErrorMessage, setAcceptErrorMessage] = useState<string>('');\n const hasAutoOpened = useRef<boolean>(false);\n\n // File upload state\n const [attachedFiles, setAttachedFiles] = useState<AttachedFile[]>([]);\n const [fileUploadError, setFileUploadError] = useState<string | undefined>(undefined);\n\n // Use hook for reference document links logic\n const {\n getReferenceDocumentLinks,\n hasUnsavedChanges: hasUnsavedReferenceDocuments,\n } = useReferenceDocumentLinks({\n templateReferenceDocuments: templateData?.referenceDocuments,\n localReferenceDocuments: referenceDocuments,\n });\n\n const dictionary = useText({\n createdLabel: 'NegotiableQuoteTemplate.Manage.createdLabel',\n salesRepLabel: 'NegotiableQuoteTemplate.Manage.salesRepLabel',\n expiresLabel: 'NegotiableQuoteTemplate.Manage.expiresLabel',\n templateIdLabel: 'NegotiableQuoteTemplate.Manage.templateIdLabel',\n actionsLabel: 'NegotiableQuoteTemplate.Manage.actionsLabel',\n referenceDocumentsTitle: 'NegotiableQuoteTemplate.Manage.referenceDocuments.title',\n commentsTitle: 'NegotiableQuoteTemplate.Manage.comments.title',\n historyLogTitle: 'NegotiableQuoteTemplate.Manage.historyLog.title',\n itemsQuotedTab: 'NegotiableQuoteTemplate.Manage.tabs.itemsQuoted',\n commentsTab: 'NegotiableQuoteTemplate.Manage.tabs.comments',\n historyLogTab: 'NegotiableQuoteTemplate.Manage.tabs.historyLog',\n templateCommentsPlaceholder: 'NegotiableQuoteTemplate.Manage.templateComments.placeholder',\n sendForReview: 'NegotiableQuoteTemplate.Manage.actionButtons.sendForReview',\n delete: 'NegotiableQuoteTemplate.Manage.actionButtons.delete',\n cancel: 'NegotiableQuoteTemplate.Manage.actionButtons.cancel',\n attachFiles: 'NegotiableQuote.Manage.attachFiles',\n fileUploadError: 'NegotiableQuote.Manage.fileUploadError',\n maxFilesExceeded: 'NegotiableQuote.Manage.maxFilesExceeded',\n maxFileSizeExceeded: 'NegotiableQuote.Manage.maxFileSizeExceeded',\n invalidFileType: 'NegotiableQuote.Manage.invalidFileType',\n confirmationModalDeleteTitle: 'NegotiableQuoteTemplate.Manage.confirmationModal.delete.title',\n confirmationModalDeleteMessage: 'NegotiableQuoteTemplate.Manage.confirmationModal.delete.message',\n confirmationModalDeleteConfirm: 'NegotiableQuoteTemplate.Manage.confirmationModal.delete.confirm',\n confirmationModalDeleteErrorHeading: 'NegotiableQuoteTemplate.Manage.confirmationModal.delete.errorHeading',\n confirmationModalDeleteErrorFallback: 'NegotiableQuoteTemplate.Manage.confirmationModal.delete.errorFallback',\n confirmationModalDeleteSuccessHeading: 'NegotiableQuoteTemplate.Manage.confirmationModal.delete.successHeading',\n confirmationModalDeleteSuccessDescription: 'NegotiableQuoteTemplate.Manage.confirmationModal.delete.successDescription',\n confirmationModalCancelTitle: 'NegotiableQuoteTemplate.Manage.confirmationModal.cancelTemplate.title',\n confirmationModalCancelMessage: 'NegotiableQuoteTemplate.Manage.confirmationModal.cancelTemplate.message',\n confirmationModalCancelConfirm: 'NegotiableQuoteTemplate.Manage.confirmationModal.cancelTemplate.confirm',\n confirmationModalCancelErrorHeading: 'NegotiableQuoteTemplate.Manage.confirmationModal.cancelTemplate.errorHeading',\n confirmationModalCancelErrorFallback: 'NegotiableQuoteTemplate.Manage.confirmationModal.cancelTemplate.errorFallback',\n confirmationModalCancelSuccessHeading: 'NegotiableQuoteTemplate.Manage.confirmationModal.cancelTemplate.successHeading',\n confirmationModalCancelSuccessDescription: 'NegotiableQuoteTemplate.Manage.confirmationModal.cancelTemplate.successDescription',\n confirmationModalCancel: 'NegotiableQuoteTemplate.Manage.confirmationModal.cancel',\n accept: 'NegotiableQuoteTemplate.Manage.actionButtons.accept',\n generateQuote: 'NegotiableQuoteTemplate.Manage.actionButtons.generateQuote',\n generateQuoteModalTitle: '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 acceptModalTitle: 'NegotiableQuoteTemplate.Manage.confirmationModal.accept.title',\n acceptModalMessage: 'NegotiableQuoteTemplate.Manage.confirmationModal.accept.message',\n acceptModalCancel: 'NegotiableQuoteTemplate.Manage.confirmationModal.cancel',\n acceptModalConfirm: 'NegotiableQuoteTemplate.Manage.confirmationModal.accept.confirm',\n acceptModalConfirmLoading: 'NegotiableQuoteTemplate.Manage.confirmationModal.accept.confirmLoading',\n acceptModalSuccessHeading: 'NegotiableQuoteTemplate.Manage.confirmationModal.accept.successHeading',\n acceptSuccessMessage: 'NegotiableQuoteTemplate.Manage.confirmationModal.accept.successDescription',\n acceptModalErrorHeading: 'NegotiableQuoteTemplate.Manage.confirmationModal.accept.errorHeading',\n acceptErrorFallback: 'NegotiableQuoteTemplate.Manage.confirmationModal.accept.errorFallback',\n documentDuplicateUidError: 'NegotiableQuoteTemplate.Manage.referenceDocuments.form.duplicateUidError',\n renameTitle: 'NegotiableQuoteTemplate.Manage.rename.title',\n renameTemplateNameLabel: 'NegotiableQuoteTemplate.Manage.rename.templateNameLabel',\n renameReasonLabel: 'NegotiableQuoteTemplate.Manage.rename.reasonLabel',\n renameButton: 'NegotiableQuoteTemplate.Manage.rename.renameButton',\n renameCancelButton: 'NegotiableQuoteTemplate.Manage.rename.cancelButton',\n renameErrorHeading: 'NegotiableQuoteTemplate.Manage.rename.errorHeading',\n renameTemplateNameRequired: 'NegotiableQuoteTemplate.Manage.rename.templateNameRequired',\n renameErrorDefault: 'NegotiableQuoteTemplate.Manage.rename.errorDefault',\n renameSuccessHeading: 'NegotiableQuoteTemplate.Manage.rename.successHeading',\n renameSuccessMessage: 'NegotiableQuoteTemplate.Manage.rename.successMessage',\n shippingInformationTitle: 'NegotiableQuoteTemplate.Manage.shippingInformation.title',\n unsavedChangesWarningHeading: 'NegotiableQuoteTemplate.Manage.unsavedChangesWarningHeading',\n unsavedChangesWarningMessage: 'NegotiableQuoteTemplate.Manage.unsavedChangesWarningMessage',\n shippingAddressWarningHeading: 'NegotiableQuoteTemplate.Manage.shippingAddressWarningHeading',\n shippingAddressWarningMessage: 'NegotiableQuoteTemplate.Manage.shippingAddressWarningMessage',\n });\n\n // Use hook for rename template logic (after dictionary is defined)\n const {\n isRenameModalOpen,\n renameTemplateName,\n renameReason,\n renameError,\n renameTemplateNameError,\n renameSuccess,\n handleRenameClick,\n handleRenameClose,\n handleRenameTemplateNameChange,\n handleRenameReasonChange,\n handleRenameSave,\n resetRenameState,\n } = useRenameTemplate({\n initialTemplateName: templateData?.name,\n templateNameRequiredErrorMessage: dictionary.renameTemplateNameRequired,\n });\n\n // Check if there are unsaved rename changes\n const hasUnsavedRenameChanges = useMemo(() => {\n // A rename change exists when renameTemplateName is set and differs from current template name\n return renameTemplateName !== '' && renameTemplateName !== templateData?.name;\n }, [renameTemplateName, templateData?.name]);\n\n // Combine unsaved changes from reference documents and rename\n const hasUnsavedChanges = useMemo(() => {\n return hasUnsavedReferenceDocuments || hasUnsavedRenameChanges;\n }, [hasUnsavedReferenceDocuments, hasUnsavedRenameChanges]);\n\n /**\n * File upload handlers\n */\n const handleAttachFiles = useCallback(async (files: File[]) => {\n // Check maxFiles limit\n if (maxFiles && attachedFiles.length + files.length > maxFiles) {\n setFileUploadError(dictionary.maxFilesExceeded.replace('{maxFiles}', String(maxFiles)));\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 setFileUploadError(\n dictionary.maxFileSizeExceeded.replace('{maxSize}', formatFileSize(maxFileSize))\n );\n return;\n }\n\n if (acceptedFileTypes && !validateFileType(file.type, acceptedFileTypes)) {\n setFileUploadError(dictionary.invalidFileType);\n return;\n }\n }\n\n setFileUploadError(undefined);\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 // NOTE: Backend support not ready yet, so we mock the upload\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 setAttachedFiles(prev => prev.map(f =>\n f.key === tempKey\n ? { ...f, status: 'error', error: (error as Error).message }\n : f\n ));\n }\n }\n }, [maxFiles, maxFileSize, acceptedFileTypes, attachedFiles, dictionary]);\n\n const handleRemoveFile = useCallback((key: string) => {\n setAttachedFiles(prev => prev.filter(f => f.key !== key));\n }, []);\n\n /* Event listeners */\n useEffect(() => {\n const quoteTemplateDataEvent = events.on('quote-management/quote-template-data', (data) => {\n if (data.quoteTemplate) {\n setTemplateData(data.quoteTemplate);\n setLoading(false);\n // Reset comment and submitting state after successful update\n setComment('');\n setIsSubmitting(false);\n // Clear attachments after successful submission\n setAttachedFiles([]);\n // Update reference documents from template data\n setReferenceDocuments(data.quoteTemplate.referenceDocuments || []);\n // Reset rename state after successful submission\n resetRenameState();\n }\n }, { eager: true });\n\n return () => quoteTemplateDataEvent?.off();\n }, [resetRenameState]);\n\n // Initialize reference documents when template data changes\n useEffect(() => {\n if (templateData?.referenceDocuments) {\n setReferenceDocuments(templateData.referenceDocuments);\n }\n }, [templateData?.referenceDocuments]);\n\n // Auto-open template if status is \"Updated\"\n useEffect(() => {\n if (templateData && templateData.status === NegotiableQuoteTemplateStatus.UPDATED && !hasAutoOpened.current) {\n hasAutoOpened.current = true;\n const openTemplate = async () => {\n try {\n await openQuoteTemplate({ templateId: templateData.id });\n // The event listener will handle updating state\n } catch (error) {\n console.error('Failed to auto-open quote template:', error);\n // Silently fail - template data is still available for viewing\n }\n };\n openTemplate();\n }\n }, [templateData]);\n\n /**\n * Handlers\n */\n const handleDeleteCancel = useCallback(() => {\n setIsDeleteDialogOpen(false);\n setDeleteError(null);\n setDeleteSuccess(false);\n }, []);\n\n const handleDeleteConfirm = useCallback(async () => {\n /* istanbul ignore next */ // If there is no template data, the button should not be enabled or even rendered\n if (!templateData?.id) {\n return;\n }\n\n setDeleteError(null);\n setDeleteSuccess(false);\n\n try {\n await deleteQuoteTemplate({\n templateId: templateData.id,\n });\n setDeleteSuccess(true);\n // Close modal after a delay to show success message\n setTimeout(() => {\n setIsDeleteDialogOpen(false);\n setDeleteSuccess(false);\n }, 2000);\n } catch (error) {\n const errorMessage = (error as Error).message || dictionary.confirmationModalDeleteErrorFallback;\n setDeleteError(errorMessage);\n }\n }, [templateData, dictionary.confirmationModalDeleteErrorFallback]);\n\n const handleDismissError = useCallback(() => {\n setDeleteError(null);\n }, []);\n\n const handleDismissSuccess = useCallback(() => {\n setDeleteSuccess(false);\n }, []);\n\n const handleCancelCancel = useCallback(() => {\n setIsCancelDialogOpen(false);\n setCancelError(null);\n setCancelSuccess(false);\n }, []);\n\n const handleCancelConfirm = useCallback(async () => {\n /* istanbul ignore next */ // If there is no template data, the button should not be enabled or even rendered\n if (!templateData?.id) {\n return;\n }\n\n setCancelError(null);\n setCancelSuccess(false);\n\n try {\n await cancelQuoteTemplate({\n templateId: templateData.id,\n });\n setCancelSuccess(true);\n // Close modal after a delay to show success message\n setTimeout(() => {\n setIsCancelDialogOpen(false);\n setCancelSuccess(false);\n }, 2000);\n } catch (error) {\n const errorMessage = (error as Error).message || dictionary.confirmationModalCancelErrorFallback;\n setCancelError(errorMessage);\n }\n }, [templateData, dictionary.confirmationModalCancelErrorFallback]);\n\n const handleDismissCancelError = useCallback(() => {\n setCancelError(null);\n }, []);\n\n const handleDismissCancelSuccess = useCallback(() => {\n setCancelSuccess(false);\n }, []);\n\n const handleSendForReview = useCallback(async () => {\n // Get all reference document links\n const referenceDocumentLinks = getReferenceDocumentLinks();\n\n // Filter successful attachments\n const successfulAttachments = attachedFiles.filter(f => f.status === 'success');\n\n // Combine comment with rename reason if rename reason exists\n const combinedComment = [renameReason.trim(), comment.trim()]\n .filter(Boolean)\n .join('\\n\\n')\n .trim() || undefined;\n\n // Include renamed name if it differs from current template name\n const templateName = renameTemplateName && renameTemplateName !== templateData?.name\n ? renameTemplateName\n : undefined;\n\n // If override prop is provided, use it instead of the API\n if (onSendForReview) {\n onSendForReview({\n templateData,\n name: templateName,\n comment: combinedComment,\n referenceDocumentLinks,\n attachments: successfulAttachments.length ? successfulAttachments : undefined,\n });\n return;\n }\n // Otherwise, use the sendQuoteTemplateForReview API\n setIsSubmitting(true);\n\n try {\n await sendQuoteTemplateForReview({\n templateId: templateData!.id, // the button should be disabled if templateData is null\n name: templateName,\n comment: combinedComment,\n referenceDocumentLinks: referenceDocumentLinks.length > 0 ? referenceDocumentLinks : undefined,\n attachments: successfulAttachments.length ? successfulAttachments.map(f => ({ key: f.key })) : undefined,\n });\n // The quote-template-data event will handle updating state\n } catch (error) {\n console.error('Failed to send quote template for review:', error);\n setIsSubmitting(false);\n // TODO: Show error notification to user\n }\n }, [templateData, onSendForReview, comment, renameReason, renameTemplateName, getReferenceDocumentLinks, attachedFiles]);\n\n const handleAddDocument = useCallback(() => {\n setEditingDocument(undefined);\n setDocumentModalErrorMessage(null);\n setIsDocumentModalOpen(true);\n }, []);\n\n const handleEditDocument = useCallback((document: ReferenceDocument) => {\n setEditingDocument(document);\n setDocumentModalErrorMessage(null);\n setIsDocumentModalOpen(true);\n }, []);\n\n const handleRemoveDocument = useCallback((document: ReferenceDocument) => {\n setReferenceDocuments((prev) => prev.filter((doc) => doc.uid !== document.uid || doc.url !== document.url));\n }, []);\n\n const handleSaveDocument = useCallback((document: ReferenceDocument) => {\n // Clear any previous error messages\n setDocumentModalErrorMessage(null);\n\n if (editingDocument) {\n // Update existing document\n setReferenceDocuments((prev) =>\n prev.map((doc) =>\n doc.identifier === editingDocument.identifier\n ? document\n : doc\n )\n );\n } else {\n // Add new document\n setReferenceDocuments((prev) => [...prev, document]);\n }\n setIsDocumentModalOpen(false);\n setEditingDocument(undefined);\n }, [editingDocument]);\n\n const handleDocumentModalClose = useCallback(() => {\n setIsDocumentModalOpen(false);\n setEditingDocument(undefined);\n setDocumentModalErrorMessage(null);\n }, []);\n\n // Generate quote handler\n const handleGenerateQuote = useCallback(async () => {\n setIsGeneratingQuote(true);\n setGenerateQuoteErrorMessage('');\n setGenerateQuoteSuccessMessage('');\n try {\n await generateQuoteFromTemplate({ templateId: templateData!.id });\n // Show success message\n setGenerateQuoteSuccessMessage(dictionary.generateQuoteSuccessMessage);\n } catch (error) {\n console.error('Failed to generate quote from template:', error);\n const errorMessage = error instanceof Error ? error.message : dictionary.generateQuoteErrorFallback;\n setGenerateQuoteErrorMessage(errorMessage);\n } finally {\n setIsGeneratingQuote(false);\n }\n }, [templateData, dictionary.generateQuoteSuccessMessage, dictionary.generateQuoteErrorFallback]);\n\n const handleGenerateQuoteModalCancel = useCallback(() => {\n setShowGenerateQuoteModal(false);\n setGenerateQuoteErrorMessage('');\n setGenerateQuoteSuccessMessage('');\n }, []);\n\n // Accept quote template handler\n const handleAcceptQuote = useCallback(async () => {\n setIsAccepting(true);\n setAcceptErrorMessage('');\n setAcceptSuccessMessage('');\n try {\n await acceptQuoteTemplate({ templateId: templateData!.id });\n // Show success message\n setAcceptSuccessMessage(dictionary.acceptSuccessMessage);\n // Close modal after a delay to show success message\n setTimeout(() => {\n setShowAcceptModal(false);\n setAcceptSuccessMessage('');\n }, 2000);\n } catch (error) {\n console.error('Failed to accept quote template:', error);\n const errorMessage = error instanceof Error ? error.message : dictionary.acceptErrorFallback;\n setAcceptErrorMessage(errorMessage);\n } finally {\n setIsAccepting(false);\n }\n }, [templateData, dictionary.acceptSuccessMessage, dictionary.acceptErrorFallback]);\n\n const handleAcceptModalCancel = useCallback(() => {\n setShowAcceptModal(false);\n setAcceptErrorMessage('');\n setAcceptSuccessMessage('');\n }, []);\n\n /**\n * VNodes for the ManageNegotiableQuoteTemplate component\n */\n\n // Template name\n const templateName = useMemo(() => {\n // Determine if rename is disabled based on canSendForReview permission\n const isRenameDisabled = !templateData?.canSendForReview;\n\n // Use the renamed template name if it exists\n const templateDisplayName = renameTemplateName || templateData?.name;\n\n return (\n <Slot\n name=\"TemplateName\"\n slot={slots?.TemplateName}\n context={{ templateName: templateData?.name, templateData, templateDisplayName, isRenameDisabled }}\n >\n <div className=\"quote-management-manage-negotiable-quote-template__template-name-wrapper\">\n <h1\n data-testid=\"template-name\"\n className=\"quote-management-manage-negotiable-quote-template__template-name-title\"\n >\n {templateDisplayName}\n </h1>\n <button\n onClick={() => handleRenameClick(templateDisplayName)}\n disabled={isRenameDisabled}\n data-testid=\"rename-template-button\"\n className=\"quote-management-manage-negotiable-quote-template__rename-button\"\n aria-label=\"Rename template\"\n >\n <Edit />\n </button>\n </div>\n </Slot>\n );\n }, [slots?.TemplateName, templateData, handleRenameClick, renameTemplateName]);\n\n // Template Status\n const templateStatus = useMemo(() => {\n return (\n <Slot\n name=\"TemplateStatus\"\n slot={slots?.TemplateStatus}\n context={{ templateStatus: templateData?.status, templateData }}\n >\n <div data-testid=\"template-status\">{templateData?.status}</div>\n </Slot>\n );\n }, [slots?.TemplateStatus, templateData]);\n\n // Details\n const details = useMemo(() => {\n if (!templateData) {\n return;\n }\n\n // Format expiration date if it exists\n const expirationDate = templateData.expirationDate ? formattedDate(templateData.expirationDate, 'short') : undefined;\n\n return (\n <Slot name=\"Details\" slot={slots?.Details} context={{ templateData }}>\n {/* template id data */}\n <div className=\"quote-management-manage-negotiable-quote-template__detail\">\n <span\n className=\"quote-management-manage-negotiable-quote-template__detail-title\"\n data-testid=\"template-id-label\"\n >\n {dictionary.templateIdLabel}\n </span>\n <span\n className=\"quote-management-manage-negotiable-quote-template__detail-content\"\n data-testid=\"template-id-value\"\n >\n {templateData.id}\n </span>\n </div>\n\n <div className=\"quote-management-manage-negotiable-quote-template__detail\">\n <span\n className=\"quote-management-manage-negotiable-quote-template__detail-title\"\n data-testid=\"created-label\"\n >\n {dictionary.createdLabel}\n </span>\n <span\n className=\"quote-management-manage-negotiable-quote-template__detail-content\"\n data-testid=\"created-value\"\n >\n {formattedDate(templateData.createdAt, 'short')} (\n {templateData.buyer.firstname} {templateData.buyer.lastname})\n </span>\n </div>\n\n <div className=\"quote-management-manage-negotiable-quote-template__detail\">\n <span\n className=\"quote-management-manage-negotiable-quote-template__detail-title\"\n data-testid=\"sales-rep-label\"\n >\n {dictionary.salesRepLabel}\n </span>\n <span\n className=\"quote-management-manage-negotiable-quote-template__detail-content\"\n data-testid=\"sales-rep-value\"\n >\n {templateData.salesRepName}\n </span>\n </div>\n\n {expirationDate && (\n <div className=\"quote-management-manage-negotiable-quote-template__detail\">\n <span\n className=\"quote-management-manage-negotiable-quote-template__detail-title\"\n data-testid=\"expires-label\"\n >\n {dictionary.expiresLabel}\n </span>\n <span\n className=\"quote-management-manage-negotiable-quote-template__detail-content\"\n data-testid=\"expires-value\"\n >\n {expirationDate}\n </span>\n </div>\n )}\n </Slot>\n );\n }, [slots?.Details, dictionary, templateData]);\n\n\n // Action bar\n const buttons: { label: string; value: string; disabled?: boolean }[] =\n useMemo(() => {\n return [\n {\n label: dictionary.generateQuote,\n value: 'generateQuote',\n disabled: !templateData?.canGenerateQuoteFromTemplate,\n },\n ];\n }, [dictionary, templateData?.canGenerateQuoteFromTemplate]);\n\n const actionBar = useMemo(() => {\n const handleActionsButtonClick = (action: string) => {\n switch (action) {\n case 'generateQuote':\n setShowGenerateQuoteModal(true);\n setGenerateQuoteErrorMessage(''); // Clear modal errors\n setGenerateQuoteSuccessMessage(''); // Clear modal success messages\n onActionsButtonClick?.(action);\n break;\n }\n };\n\n return (\n <Slot\n name=\"ActionBar\"\n slot={slots?.ActionBar}\n context={{ templateData }}\n >\n <ActionsBar\n dropdownPlaceholder={dictionary.actionsLabel}\n dropdownOptions={[]}\n buttons={buttons.map((button) => (\n <Button\n key={button.value}\n variant=\"tertiary\"\n onClick={() => handleActionsButtonClick(button.value)}\n data-testid={`actions-bar-${button.value}-button`}\n data-action={button.value}\n disabled={button.disabled}\n >\n {button.label}\n </Button>\n ))}\n />\n </Slot>\n );\n }, [\n buttons,\n dictionary,\n slots?.ActionBar,\n templateData,\n onActionsButtonClick,\n ]);\n\n // Reference documents\n const isEditable = useMemo(() => {\n const status = templateData?.status as string;\n return status === 'Draft' || status === 'Open';\n }, [templateData?.status]);\n\n\n const referenceDocumentsNode = useMemo(() => {\n const shouldShowTitle = referenceDocuments.length > 0 || isEditable;\n const title = shouldShowTitle ? dictionary.referenceDocumentsTitle : undefined;\n\n return (\n <Slot\n name=\"ReferenceDocuments\"\n slot={slots?.ReferenceDocuments}\n context={{ templateData, referenceDocuments, isEditable, onAddDocument: handleAddDocument, onEditDocument: handleEditDocument, onRemoveDocument: handleRemoveDocument, referenceDocumentsTitle: dictionary.referenceDocumentsTitle }}\n >\n <div data-testid=\"reference-documents\">\n {shouldShowTitle && <h2>{title}</h2>}\n <ReferenceDocumentsList\n documents={referenceDocuments}\n isEditable={isEditable}\n onAdd={handleAddDocument}\n onEdit={handleEditDocument}\n onRemove={handleRemoveDocument}\n />\n </div>\n </Slot>\n );\n }, [slots?.ReferenceDocuments, dictionary, templateData, referenceDocuments, isEditable, handleAddDocument, handleEditDocument, handleRemoveDocument]);\n\n // Shipping information title\n const shippingInformationTitle = useMemo(() => {\n return (\n <Slot\n name=\"ShippingInformationTitle\"\n slot={slots?.ShippingInformationTitle}\n context={{ templateData }}\n >\n <h2>{dictionary.shippingInformationTitle}</h2>\n </Slot>\n );\n }, [slots?.ShippingInformationTitle, templateData, dictionary]);\n\n // Shipping information\n const shippingInformation = useMemo(() => {\n return (\n <Slot\n name=\"ShippingInformation\"\n slot={slots?.ShippingInformation}\n context={{ templateData, loading, setLoading }}\n >\n <ShippingAddressDisplay\n shippingAddress={templateData?.shippingAddresses?.[0]}\n loading={loading}\n data-testid=\"manage-template-shipping-address\"\n />\n </Slot>\n );\n }, [slots?.ShippingInformation, templateData, loading, setLoading]);\n\n // Items table (using TabbedContent with ItemsQuoted)\n const itemsTable = useMemo(() => {\n return (\n <Slot\n name=\"ItemsTable\"\n slot={slots?.ItemsTable}\n context={{ templateData }}\n >\n <TabbedContent\n tabs={\n new Map([\n ['items-quoted', dictionary.itemsQuotedTab],\n ['comments', dictionary.commentsTab],\n ['history-log', dictionary.historyLogTab],\n ])\n }\n tabsContent={\n new Map([\n [\n 'items-quoted',\n <Slot\n key=\"items-quoted\"\n name=\"ItemsQuotedTab\"\n slot={slots?.ItemsQuotedTab}\n context={{ templateData }}\n >\n <ItemsQuotedTemplate templateData={templateData} />\n </Slot>,\n ],\n [\n 'comments',\n <Slot\n key=\"comments\"\n name=\"CommentsTab\"\n slot={slots?.CommentsTab}\n context={{ templateData }}\n >\n <QuoteTemplateCommentsList templateData={templateData} />\n </Slot>,\n ],\n [\n 'history-log',\n <Slot\n key=\"history-log\"\n name=\"HistoryLogTab\"\n slot={slots?.HistoryLogTab}\n context={{ templateData }}\n >\n <QuoteTemplateHistoryLog templateData={templateData} />\n </Slot>,\n ],\n ])\n }\n />\n </Slot>\n );\n }, [\n slots?.ItemsTable,\n slots?.ItemsQuotedTab,\n slots?.CommentsTab,\n slots?.HistoryLogTab,\n dictionary,\n templateData,\n ]);\n\n // Comments title\n const commentsTitle = useMemo(() => {\n return (\n <Slot\n name=\"CommentsTitle\"\n slot={slots?.CommentsTitle}\n context={{ templateData }}\n >\n <h2>{dictionary.commentsTitle}</h2>\n </Slot>\n );\n }, [slots?.CommentsTitle, dictionary, templateData]);\n\n // Comments\n const comments = useMemo(() => {\n return (\n <Slot\n name=\"Comments\"\n slot={slots?.Comments}\n context={{ templateData }}\n >\n <TextArea\n name=\"templateComments\"\n placeholder={dictionary.templateCommentsPlaceholder}\n rows={3}\n value={comment}\n onInput={(e) => {\n setComment((e.target as HTMLTextAreaElement).value);\n }}\n disabled={!templateData?.canSendForReview || isSubmitting}\n />\n </Slot>\n );\n }, [slots?.Comments, dictionary, templateData, comment, isSubmitting]);\n\n // File upload should be disabled when template cannot be sent for review\n const isFileUploadDisabled = useMemo(() => {\n return !templateData?.canSendForReview;\n }, [templateData]);\n\n // File upload input\n const attachFilesField = useMemo(() => {\n // Check if button should be visually disabled\n const isDisabled = isSubmitting || isFileUploadDisabled;\n\n return (\n <Slot\n name=\"AttachFilesField\"\n slot={slots?.AttachFilesField}\n context={{ templateData, onFileChange: handleAttachFiles, attachedFiles, fileUploadError, disabled: isDisabled }}\n >\n <div \n className=\"quote-management-manage-negotiable-quote-template__attach-files\"\n {...(isDisabled ? { 'data-disabled': true } : {})}\n aria-disabled={isDisabled}\n >\n <InputFile\n id=\"manage-template-attach-files\"\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 if (files.length > 0) {\n void handleAttachFiles(files);\n }\n }}\n icon={<Add />}\n disabled={isDisabled}\n data-testid=\"manage-template-attach-files\"\n accept={acceptedFileTypes?.join(',')}\n >\n {dictionary.attachFiles}\n </InputFile>\n {fileUploadError && (\n <div\n className=\"quote-management-manage-negotiable-quote-template__file-error\"\n data-testid=\"file-upload-error\"\n >\n {fileUploadError}\n </div>\n )}\n </div>\n </Slot>\n );\n }, [\n slots?.AttachFilesField,\n templateData,\n handleAttachFiles,\n isSubmitting,\n isFileUploadDisabled,\n acceptedFileTypes,\n fileUploadError,\n dictionary,\n attachedFiles,\n ]);\n\n // Attached files list\n const attachedFilesList = useMemo(() => {\n if (!attachedFiles.length) return undefined;\n\n return (\n <Slot\n name=\"AttachedFilesList\"\n slot={slots?.AttachedFilesList}\n context={{ templateData, files: attachedFiles, onRemove: handleRemoveFile, disabled: isSubmitting }}\n >\n <AttachedFilesList\n files={attachedFiles}\n onRemove={handleRemoveFile}\n disabled={isSubmitting}\n />\n </Slot>\n );\n }, [attachedFiles, handleRemoveFile, isSubmitting, slots?.AttachedFilesList, templateData]);\n\n // Unsaved changes warning banner\n const unsavedChangesBanner = useMemo(\n () =>\n hasUnsavedChanges ? (\n <InLineAlert\n type=\"warning\"\n variant=\"primary\"\n icon={<WarningFilled />}\n heading={dictionary.unsavedChangesWarningHeading}\n description={dictionary.unsavedChangesWarningMessage}\n data-testid=\"unsaved-changes-warning-alert\"\n />\n ) : undefined,\n [hasUnsavedChanges, dictionary.unsavedChangesWarningHeading, dictionary.unsavedChangesWarningMessage]\n );\n\n // Shipping address warning banner\n const shippingAddressWarningBanner = useMemo(() => {\n return templateData?.shippingAddresses?.length ? undefined : (\n <InLineAlert\n type=\"warning\"\n variant=\"primary\"\n icon={<WarningFilled />}\n heading={dictionary.shippingAddressWarningHeading}\n description={dictionary.shippingAddressWarningMessage}\n data-testid=\"shipping-address-warning-alert\"\n />\n );\n }, [templateData?.shippingAddresses?.length, dictionary.shippingAddressWarningHeading, dictionary.shippingAddressWarningMessage]);\n\n const banners = useMemo(() => {\n return <>\n {unsavedChangesBanner}\n {shippingAddressWarningBanner}\n </>\n }, [unsavedChangesBanner, shippingAddressWarningBanner]);\n\n // Footer\n const footer = useMemo(() => {\n const showAcceptButton = templateData?.status === NegotiableQuoteTemplateStatus.OPEN && templateData?.canAccept;\n\n return (\n <Slot\n name=\"Footer\"\n slot={slots?.Footer}\n context={{ templateData, comment, isSubmitting, attachedFiles, referenceDocuments, hasUnsavedChanges, handleSendForReview, showAcceptButton, renameTemplateName, renameReason }}\n >\n {showAcceptButton && (\n <Button\n variant=\"primary\"\n onClick={() => {\n setShowAcceptModal(true);\n setAcceptErrorMessage(''); // Clear modal errors\n setAcceptSuccessMessage(''); // Clear modal success messages\n }}\n data-testid=\"accept-button\"\n disabled={isSubmitting || hasUnsavedChanges}\n >\n {dictionary.accept}\n </Button>\n )}\n\n {templateData?.canSendForReview && (\n <Button\n variant=\"primary\"\n onClick={handleSendForReview}\n data-testid=\"send-for-review-button\"\n disabled={!templateData?.canSendForReview || isSubmitting}\n >\n {dictionary.sendForReview}\n </Button>\n )}\n {templateData?.canCancel && (\n <Button\n variant=\"tertiary\"\n onClick={() => setIsCancelDialogOpen(true)}\n data-testid=\"cancel-template-button\"\n disabled={isSubmitting}\n >\n {dictionary.cancel}\n </Button>\n )}\n {templateData?.canDelete && (\n <Button\n variant=\"tertiary\"\n onClick={() => setIsDeleteDialogOpen(true)}\n data-testid=\"delete-template-button\"\n disabled={isSubmitting}\n >\n {dictionary.delete}\n </Button>\n )}\n </Slot>\n );\n }, [\n slots?.Footer,\n dictionary,\n templateData,\n comment,\n isSubmitting,\n attachedFiles,\n handleSendForReview,\n referenceDocuments,\n hasUnsavedChanges,\n renameTemplateName,\n renameReason,\n ]);\n\n // Delete error banner\n const deleteErrorBanner = deleteError ? (\n <InLineAlert\n type=\"error\"\n variant=\"primary\"\n icon={<WarningFilled />}\n heading={dictionary.confirmationModalDeleteErrorHeading}\n description={deleteError}\n onDismiss={handleDismissError}\n data-testid=\"confirmation-modal-error-banner\"\n />\n ) : null;\n\n // Delete success banner\n const deleteSuccessBanner = deleteSuccess ? (\n <InLineAlert\n type=\"success\"\n variant=\"primary\"\n icon={<CheckWithCircle />}\n heading={dictionary.confirmationModalDeleteSuccessHeading}\n description={dictionary.confirmationModalDeleteSuccessDescription}\n onDismiss={handleDismissSuccess}\n data-testid=\"confirmation-modal-success-banner\"\n />\n ) : null;\n\n const deleteBanner = deleteSuccessBanner || deleteErrorBanner;\n\n // Cancel error banner\n const cancelErrorBanner = cancelError ? (\n <InLineAlert\n type=\"error\"\n variant=\"primary\"\n icon={<WarningFilled />}\n heading={dictionary.confirmationModalCancelErrorHeading}\n description={cancelError}\n onDismiss={handleDismissCancelError}\n data-testid=\"confirmation-modal-cancel-error-banner\"\n />\n ) : null;\n\n // Cancel success banner\n const cancelSuccessBanner = cancelSuccess ? (\n <InLineAlert\n type=\"success\"\n variant=\"primary\"\n icon={<CheckWithCircle />}\n heading={dictionary.confirmationModalCancelSuccessHeading}\n description={dictionary.confirmationModalCancelSuccessDescription}\n onDismiss={handleDismissCancelSuccess}\n data-testid=\"confirmation-modal-cancel-success-banner\"\n />\n ) : null;\n\n const cancelBanner = cancelSuccessBanner || cancelErrorBanner;\n\n // Rename modal error banner\n const renameErrorBanner = useMemo(\n () =>\n renameError ? (\n <InLineAlert\n type=\"error\"\n variant=\"primary\"\n icon={<WarningFilled color=\"var(--color-error)\" />}\n heading={dictionary.renameErrorHeading}\n description={renameError}\n />\n ) : undefined,\n [renameError, dictionary.renameErrorHeading]\n );\n\n // Rename modal success banner\n const renameSuccessBanner = useMemo(\n () =>\n renameSuccess ? (\n <InLineAlert\n type=\"success\"\n variant=\"primary\"\n icon={<CheckWithCircle />}\n heading={dictionary.renameSuccessHeading}\n description={renameSuccess}\n />\n ) : undefined,\n [renameSuccess, dictionary.renameSuccessHeading]\n );\n\n const manageNegotiableQuoteTemplateProps: ManageNegotiableQuoteTemplateComponentProps = {\n ...props,\n loading,\n templateName,\n templateStatus,\n banner: banners,\n details,\n actionBar,\n referenceDocuments: referenceDocumentsNode,\n itemsTable,\n shippingInformationTitle,\n shippingInformation,\n commentsTitle,\n comments,\n attachFilesField,\n attachedFilesList,\n footer,\n };\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 // Create banner for accept modal based on success/error state\n let acceptModalBanner = null;\n if (acceptSuccessMessage) {\n acceptModalBanner = (\n <InLineAlert\n type=\"success\"\n variant=\"primary\"\n icon={<Icon source=\"CheckWithCircle\" />}\n heading={dictionary.acceptModalSuccessHeading}\n description={acceptSuccessMessage}\n data-testid=\"accept-success-banner\"\n />\n );\n } else if (acceptErrorMessage) {\n acceptModalBanner = (\n <InLineAlert\n type=\"error\"\n variant=\"primary\"\n icon={<Icon source=\"WarningFilled\" />}\n heading={dictionary.acceptModalErrorHeading}\n description={acceptErrorMessage}\n data-testid=\"accept-error-banner\"\n />\n );\n }\n\n return (\n <>\n <ManageNegotiableQuoteTemplateComponent {...manageNegotiableQuoteTemplateProps} />\n {isDeleteDialogOpen &&\n createPortal(\n <ConfirmationModal\n open={isDeleteDialogOpen}\n title={dictionary.confirmationModalDeleteTitle}\n message={dictionary.confirmationModalDeleteMessage}\n cancelLabel={dictionary.confirmationModalCancel}\n confirmLabel={dictionary.confirmationModalDeleteConfirm}\n onCancel={handleDeleteCancel}\n onConfirm={handleDeleteConfirm}\n showCloseButton={!deleteBanner}\n confirmationBanner={deleteBanner}\n />,\n document.body\n )}\n {isCancelDialogOpen &&\n createPortal(\n <ConfirmationModal\n open={isCancelDialogOpen}\n title={dictionary.confirmationModalCancelTitle}\n message={dictionary.confirmationModalCancelMessage}\n cancelLabel={dictionary.confirmationModalCancel}\n confirmLabel={dictionary.confirmationModalCancelConfirm}\n onCancel={handleCancelCancel}\n onConfirm={handleCancelConfirm}\n showCloseButton={!cancelBanner}\n confirmationBanner={cancelBanner}\n />,\n document.body\n )}\n {isDocumentModalOpen &&\n createPortal(\n <ReferenceDocumentFormModal\n open={isDocumentModalOpen}\n document={editingDocument}\n errorMessage={documentModalErrorMessage || undefined}\n onSave={handleSaveDocument}\n onClose={handleDocumentModalClose}\n isSubmitting={isSubmitting}\n />,\n document.body\n )}\n {showGenerateQuoteModal &&\n createPortal(\n <ConfirmationModal\n open={showGenerateQuoteModal}\n title={dictionary.generateQuoteModalTitle}\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 ? undefined : handleGenerateQuote}\n showCloseButton={true}\n confirmationBanner={generateQuoteModalBanner}\n data-testid=\"generate-quote-confirmation-modal\"\n />,\n document.body\n )}\n {showAcceptModal &&\n createPortal(\n <ConfirmationModal\n open={showAcceptModal}\n title={dictionary.acceptModalTitle}\n message={dictionary.acceptModalMessage}\n cancelLabel={dictionary.acceptModalCancel}\n confirmLabel={\n isAccepting\n ? dictionary.acceptModalConfirmLoading\n : dictionary.acceptModalConfirm\n }\n onCancel={handleAcceptModalCancel}\n onConfirm={isAccepting ? undefined : handleAcceptQuote}\n showCloseButton={true}\n confirmationBanner={acceptModalBanner}\n data-testid=\"accept-confirmation-modal\"\n />,\n document.body\n )}\n {isRenameModalOpen &&\n createPortal(\n <RenameQuoteModal\n open={isRenameModalOpen}\n quoteName={renameTemplateName}\n renameReason={renameReason}\n quoteNameError={renameTemplateNameError}\n errorBanner={renameErrorBanner}\n successBanner={renameSuccessBanner}\n onQuoteNameChange={handleRenameTemplateNameChange}\n onRenameReasonChange={handleRenameReasonChange}\n onSave={handleRenameSave}\n onClose={handleRenameClose}\n />,\n document.body\n )}\n </>\n );\n};\n"],"names":["ManageNegotiableQuoteTemplate","className","loading","templateName","templateStatus","banner","details","actionBar","referenceDocuments","itemsTable","shippingInformationTitle","shippingInformation","commentsTitle","comments","attachFilesField","attachedFilesList","footer","props","ManageNegotiableQuoteTemplateSkeleton","jsxs","classes","jsx","VComponent","Skeleton","SkeletonRow","ReferenceDocumentFormModal","open","document","errorMessage","errorBanner","successBanner","showCloseButton","isSubmitting","onSave","onClose","documentName","setDocumentName","useState","documentIdentifier","setDocumentIdentifier","referenceUrl","setReferenceUrl","errors","setErrors","dictionary","useText","displayErrorBanner","InLineAlert","WarningFilled","isEditMode","useEffect","validateUrl","useCallback","url","handleSave","newErrors","handleClose","Modal","Fragment","Input","e","Button","ReferenceDocumentsList","documents","isEditable","onAdd","onEdit","onRemove","formatDocumentDisplay","doc","handleDocumentClick","useReferenceDocumentLinks","params","templateReferenceDocuments","localReferenceDocuments","findMatchingTemplateDocument","templateDoc","isDocumentInTemplateData","isDocumentModified","localDoc","getNewDocuments","getReferenceDocumentLinks","hasUnsavedChanges","useMemo","matchingTemplateDoc","useRenameTemplate","initialTemplateName","templateNameRequiredErrorMessage","isRenameModalOpen","setIsRenameModalOpen","renameTemplateName","setRenameTemplateName","renameReason","setRenameReason","renameError","setRenameError","renameTemplateNameError","setRenameTemplateNameError","renameSuccess","setRenameSuccess","handleRenameClick","currentTemplateName","handleRenameClose","handleRenameTemplateNameChange","value","handleRenameReasonChange","handleRenameSave","resetRenameState","slots","onActionsButtonClick","onSendForReview","maxFiles","maxFileSize","acceptedFileTypes","templateData","setTemplateData","setLoading","comment","setComment","setIsSubmitting","isDeleteDialogOpen","setIsDeleteDialogOpen","deleteError","setDeleteError","deleteSuccess","setDeleteSuccess","isCancelDialogOpen","setIsCancelDialogOpen","cancelError","setCancelError","cancelSuccess","setCancelSuccess","setReferenceDocuments","isDocumentModalOpen","setIsDocumentModalOpen","editingDocument","setEditingDocument","documentModalErrorMessage","setDocumentModalErrorMessage","showGenerateQuoteModal","setShowGenerateQuoteModal","isGeneratingQuote","setIsGeneratingQuote","generateQuoteSuccessMessage","setGenerateQuoteSuccessMessage","generateQuoteErrorMessage","setGenerateQuoteErrorMessage","showAcceptModal","setShowAcceptModal","isAccepting","setIsAccepting","acceptSuccessMessage","setAcceptSuccessMessage","acceptErrorMessage","setAcceptErrorMessage","hasAutoOpened","useRef","attachedFiles","setAttachedFiles","fileUploadError","setFileUploadError","hasUnsavedReferenceDocuments","hasUnsavedRenameChanges","handleAttachFiles","files","file","validateFileSize","formatFileSize","validateFileType","newFiles","prev","i","tempKey","result","uploadFile","f","error","handleRemoveFile","key","quoteTemplateDataEvent","events","data","NegotiableQuoteTemplateStatus","openQuoteTemplate","handleDeleteCancel","handleDeleteConfirm","deleteQuoteTemplate","handleDismissError","handleDismissSuccess","handleCancelCancel","handleCancelConfirm","cancelQuoteTemplate","handleDismissCancelError","handleDismissCancelSuccess","handleSendForReview","referenceDocumentLinks","successfulAttachments","combinedComment","sendQuoteTemplateForReview","handleAddDocument","handleEditDocument","handleRemoveDocument","handleSaveDocument","handleDocumentModalClose","handleGenerateQuote","generateQuoteFromTemplate","handleGenerateQuoteModalCancel","handleAcceptQuote","acceptQuoteTemplate","handleAcceptModalCancel","isRenameDisabled","templateDisplayName","Slot","Edit","expirationDate","formattedDate","buttons","handleActionsButtonClick","action","ActionsBar","button","status","referenceDocumentsNode","shouldShowTitle","title","ShippingAddressDisplay","_a","TabbedContent","ItemsQuotedTemplate","QuoteTemplateCommentsList","QuoteTemplateHistoryLog","TextArea","isFileUploadDisabled","isDisabled","InputFile","target","fileList","Add","AttachedFilesList","unsavedChangesBanner","shippingAddressWarningBanner","banners","showAcceptButton","deleteErrorBanner","deleteBanner","CheckWithCircle","cancelErrorBanner","cancelBanner","renameErrorBanner","renameSuccessBanner","manageNegotiableQuoteTemplateProps","generateQuoteModalBanner","Icon","acceptModalBanner","ManageNegotiableQuoteTemplateComponent","createPortal","ConfirmationModal","RenameQuoteModal"],"mappings":"w3DAkCO,MAAMA,GAAuF,CAAC,CACnG,UAAAC,EACA,QAAAC,EACA,aAAAC,EACA,eAAAC,EACA,OAAAC,EACA,QAAAC,EACA,UAAAC,EACA,mBAAAC,EACA,WAAAC,EACA,yBAAAC,EACA,oBAAAC,EACA,cAAAC,EACA,SAAAC,EACA,iBAAAC,EACA,kBAAAC,EACA,OAAAC,EACA,GAAGC,CACL,IACMf,IACMgB,GAAA,EAAsC,EAI9CC,EAAC,MAAA,CAAK,GAAGF,EAAO,UAAWG,EAAQ,CAAC,oDAAqDnB,CAAS,CAAC,EACjG,SAAA,CAAAkB,EAAC,OAAI,UAAWC,EAAQ,CAAC,2DAA2D,CAAC,EAClF,SAAA,CAAAjB,GACCkB,EAACC,EAAA,CACC,KAAMnB,EACN,UAAWiB,EAAQ,CAAC,kEAAkE,CAAC,C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