@dropins/storefront-quote-management 0.0.1-alpha26 → 0.0.1-alpha27
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/api/initialize/initialize.d.ts +1 -0
- package/api.js +15 -15
- package/api.js.map +1 -1
- package/chunks/ItemsQuoted.js +1 -1
- package/chunks/ItemsQuoted.js.map +1 -1
- package/chunks/ItemsQuotedTemplate.js +4 -0
- package/chunks/ItemsQuotedTemplate.js.map +1 -0
- package/chunks/OrderSummaryLine.js +1 -1
- package/chunks/OrderSummaryLine.js.map +1 -1
- package/chunks/QuoteCommentsList.js +1 -1
- package/chunks/QuoteCommentsList.js.map +1 -1
- package/chunks/QuoteCommentsList3.js +4 -0
- package/chunks/QuoteCommentsList3.js.map +1 -0
- package/chunks/QuoteHistoryLog.js +1 -1
- package/chunks/QuoteHistoryLog.js.map +1 -1
- package/chunks/QuoteHistoryLog3.js +4 -0
- package/chunks/QuoteHistoryLog3.js.map +1 -0
- package/chunks/QuotePricesSummary.js +4 -0
- package/chunks/QuotePricesSummary.js.map +1 -0
- package/chunks/QuoteTemplateCommentsList.js +4 -0
- package/chunks/QuoteTemplateCommentsList.js.map +1 -0
- package/chunks/QuoteTemplateHistoryLog.js +4 -0
- package/chunks/QuoteTemplateHistoryLog.js.map +1 -0
- package/chunks/TabbedContent.js +4 -0
- package/chunks/TabbedContent.js.map +1 -0
- package/chunks/dateUtils.js +1 -1
- package/chunks/dateUtils.js.map +1 -1
- package/chunks/getQuoteTemplates.js +2 -2
- package/chunks/getQuoteTemplates.js.map +1 -1
- package/chunks/negotiableQuotes.js +1 -1
- package/chunks/negotiableQuotes.js.map +1 -1
- package/chunks/removeNegotiableQuoteItems.js +3 -3
- package/chunks/removeNegotiableQuoteItems.js.map +1 -1
- package/chunks/renameNegotiableQuote.js +1 -1
- package/chunks/renameNegotiableQuote.js.map +1 -1
- package/chunks/state.js +1 -1
- package/chunks/transform-quote.js +4 -0
- package/chunks/transform-quote.js.map +1 -0
- package/chunks/uploadFile.js +1 -1
- package/chunks/uploadFile.js.map +1 -1
- package/components/ManageNegotiableQuote/ManageNegotiableQuote.d.ts +1 -1
- package/components/ManageNegotiableQuoteTemplate/ManageNegotiableQuoteTemplate.d.ts +22 -0
- package/components/ManageNegotiableQuoteTemplate/__fixtures__/ManageNegotiableQuoteTemplateProps.d.ts +4 -0
- package/components/ManageNegotiableQuoteTemplate/index.d.ts +11 -0
- package/components/ProductListTable/ProductListTable.d.ts +41 -5
- package/components/QuoteHistoryLog/QuoteHistoryLog.d.ts +70 -2
- package/components/index.d.ts +1 -0
- package/containers/ItemsQuoted.js +1 -1
- package/containers/ItemsQuotedTemplate/ItemsQuotedTemplate.d.ts +19 -0
- package/containers/ItemsQuotedTemplate/index.d.ts +11 -0
- package/containers/ItemsQuotedTemplate.d.ts +3 -0
- package/containers/ItemsQuotedTemplate.js +4 -0
- package/containers/ItemsQuotedTemplate.js.map +1 -0
- package/containers/ManageNegotiableQuote.js +1 -1
- package/containers/ManageNegotiableQuote.js.map +1 -1
- package/containers/ManageNegotiableQuoteTemplate/ManageNegotiableQuoteTemplate.d.ts +54 -0
- package/containers/ManageNegotiableQuoteTemplate/index.d.ts +11 -0
- package/containers/ManageNegotiableQuoteTemplate.d.ts +3 -0
- package/containers/ManageNegotiableQuoteTemplate.js +4 -0
- package/containers/ManageNegotiableQuoteTemplate.js.map +1 -0
- package/containers/OrderSummary.js +1 -1
- package/containers/OrderSummary.js.map +1 -1
- package/containers/OrderSummaryLine.js +1 -1
- package/containers/QuoteCommentsList.js +1 -1
- package/containers/QuoteHistoryLog.js +1 -1
- package/containers/QuoteSummaryList.js +1 -1
- package/containers/QuoteSummaryList.js.map +1 -1
- package/containers/QuoteTemplateCommentsList/QuoteTemplateCommentsList.d.ts +9 -0
- package/containers/QuoteTemplateCommentsList/index.d.ts +11 -0
- package/containers/QuoteTemplateCommentsList.d.ts +3 -0
- package/containers/QuoteTemplateCommentsList.js +4 -0
- package/containers/QuoteTemplateCommentsList.js.map +1 -0
- package/containers/QuoteTemplateHistoryLog/QuoteTemplateHistoryLog.d.ts +9 -0
- package/containers/QuoteTemplateHistoryLog/index.d.ts +11 -0
- package/containers/QuoteTemplateHistoryLog.d.ts +3 -0
- package/containers/QuoteTemplateHistoryLog.js +4 -0
- package/containers/QuoteTemplateHistoryLog.js.map +1 -0
- package/containers/QuoteTemplatesListTable/QuoteTemplatesListTable.d.ts +2 -0
- package/containers/QuoteTemplatesListTable.js +1 -1
- package/containers/QuoteTemplatesListTable.js.map +1 -1
- package/containers/QuotesListTable.js +1 -1
- package/containers/QuotesListTable.js.map +1 -1
- package/containers/RequestNegotiableQuoteForm.js +1 -1
- package/containers/RequestNegotiableQuoteForm.js.map +1 -1
- package/containers/index.d.ts +4 -0
- package/data/models/__fixtures__/negotiableQuoteTemplateModel.d.ts +4 -0
- package/data/models/negotiable-quote-template-model.d.ts +1 -1
- package/i18n/en_US.json.d.ts +32 -4
- package/package.json +1 -1
- package/render.js +2 -3
- package/render.js.map +1 -1
- package/utils/dateUtils.d.ts +7 -2
- package/chunks/fetch-graphql.js +0 -4
- package/chunks/fetch-graphql.js.map +0 -1
package/chunks/ItemsQuoted.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
/*! Copyright 2025 Adobe
|
|
2
2
|
All Rights Reserved. */
|
|
3
|
-
import{jsx as e,jsxs as b,Fragment as re}from"@dropins/tools/preact-jsx-runtime.js";import{useState as h,useEffect as w,useCallback as me}from"@dropins/tools/preact-compat.js";import{classes as I,VComponent as J,Slot as ee}from"@dropins/tools/lib.js";import{h as te}from"@dropins/tools/preact.js";import{useState as ae,useEffect as pe}from"@dropins/tools/preact-hooks.js";import{Skeleton as ge,SkeletonRow as be,Input as fe,Picker as ye,Price as O,Checkbox as qe,Button as K,Table as Ne,Accordion as ve,AccordionSection as _e,Modal as Me,InLineAlert as W}from"@dropins/tools/components.js";/* empty css */import{useText as X}from"@dropins/tools/i18n.js";import{events as Y}from"@dropins/tools/event-bus.js";import{u as he,r as Qe}from"./removeNegotiableQuoteItems.js";import{S as se,a as oe}from"./WarningFilled.js";const ne=({className:N,loading:m,table:r,pricesSummary:f,...o})=>m?e(Te,{}):b("div",{className:I(["quote-management-items-quoted",N]),...o,children:[r&&e(J,{node:r,className:I(["quote-management-items-quoted__table"]),"data-testid":"quote-management-items-quoted__table"}),f&&e(J,{node:f,className:I(["quote-management-items-quoted__prices-summary"]),"data-testid":"quote-management-items-quoted__prices-summary"})]}),Te=()=>e(ge,{"data-testid":"items-quoted-skeleton",children:e(be,{variant:"row",fullWidth:!0,size:"medium",lines:4,multilineGap:"xsmall"})}),ke=({className:N,items:m,canEdit:r,readOnly:f=!1,onItemCheckboxChange:o,onItemDropdownChange:u,onQuantityChange:p,onUpdate:k,dropdownSelections:n,...v})=>{const[B,Q]=ae({}),[S,_]=ae({});pe(()=>{const t={};m.forEach(c=>{t[c.uid]=c.quantity}),Q(t),_(t)},[m]);const L=Object.keys(S).some(t=>S[t]!==B[t]),l=X({updateButton:"NegotiableQuote.Manage.productListTable.submitButton",productNameHeader:"NegotiableQuote.Manage.productListTable.headers.productName",skuHeader:"NegotiableQuote.Manage.productListTable.headers.sku",priceHeader:"NegotiableQuote.Manage.productListTable.headers.price",quantityHeader:"NegotiableQuote.Manage.productListTable.headers.quantity",discountHeader:"NegotiableQuote.Manage.productListTable.headers.discount",subtotalHeader:"NegotiableQuote.Manage.productListTable.headers.subtotal",actionsHeader:"NegotiableQuote.Manage.productListTable.headers.actions",editNoteToSeller:"NegotiableQuote.Manage.productListTable.actions.editNoteToSeller",remove:"NegotiableQuote.Manage.productListTable.actions.remove"}),D=[{label:l.productNameHeader,key:"productName"},{label:l.skuHeader,key:"sku"},{label:l.priceHeader,key:"price"},{label:l.quantityHeader,key:"quantity"},{label:l.discountHeader,key:"discount"},{label:l.subtotalHeader,key:"subtotal"}];r&&!f&&(D.unshift({label:"",key:"checkbox"}),D.push({label:l.actionsHeader,key:"actions"}));const E=(t,c)=>{const g=t.target.checked;o==null||o(c,g)},T=(t,c)=>{const g=t.target.value;u==null||u(c,g)},$=(t,c)=>{const g=parseInt(t.target.value,10);!isNaN(g)&&g>0&&(_(y=>({...y,[c.uid]:g})),p==null||p(c,g))},z=t=>{t.preventDefault(),k==null||k(t)},C=(t,c)=>t>0?b("div",{className:"quote-management-product-list-table__discount-container",children:[b("span",{className:"quote-management-product-list-table__discount-percent",children:[c,"%"]}),b("span",{className:"quote-management-product-list-table__discount-price",children:["(",e(O,{amount:t}),")"]})]}):void 0,P=t=>{var y,A;const c=(y=t.configurableOptions)==null?void 0:y.map(q=>b("div",{className:"quote-management-product-list-table__configurable-option",children:[b("span",{className:"quote-management-product-list-table__configurable-option-label",children:[q.optionLabel,":"]}),e("span",{className:"quote-management-product-list-table__configurable-option-value",children:q.valueLabel})]},q.optionLabel)),g=(A=t.bundleOptions)==null?void 0:A.map(q=>b("div",{className:"quote-management-product-list-table__bundle-option",children:[e("span",{className:"quote-management-product-list-table__bundle-option-label",children:q.label}),e("div",{className:"quote-management-product-list-table__bundle-option-values",children:q.values.map(H=>b("span",{className:"quote-management-product-list-table__bundle-option-value",children:[b("span",{className:"quote-management-product-list-table__bundle-option-value-quantity",children:[H.quantity," x"]}),e("span",{className:"quote-management-product-list-table__bundle-option-value-label",children:H.label}),e(O,{className:"quote-management-product-list-table__bundle-option-value-original-price",amount:H.originalPrice.value,currency:H.originalPrice.currency,weight:"normal"})]},H.label))})]},q.label));return b("div",{className:"quote-management-product-list-table__product-name-container",children:[e("span",{className:"quote-management-product-list-table__product-name",children:t.product.name}),c,g]})},M=m.map(t=>{var g;const c=r?e(fe,{className:"quote-management-product-list-table__quantity-input",type:"number",min:"1",value:((g=S[t.uid])==null?void 0:g.toString())||t.quantity.toString(),onChange:y=>$(y,t),disabled:f||!r,"data-testid":`quantity-input-${t.product.sku}`}):e("span",{className:"quote-management-product-list-table__quantity",children:t.quantity});return{checkbox:e(qe,{className:"quote-management-product-list-table__checkbox",name:"itemSelected","data-testid":`item-checkbox-${t.product.sku}`,onChange:y=>E(y,t),value:t.product.sku}),productName:P(t),sku:e("span",{className:"quote-management-product-list-table__sku",children:t.product.sku}),price:e(O,{className:"quote-management-product-list-table__price",amount:t.prices.originalItemPrice.value,currency:t.prices.originalItemPrice.currency}),quantity:c,discount:C(t.catalogDiscount.amountOff,t.catalogDiscount.percentOff),subtotal:e(O,{className:"quote-management-product-list-table__subtotal",amount:t.prices.rowTotal.value,currency:t.prices.rowTotal.currency}),actions:e(ye,{className:"quote-management-product-list-table__actions","data-testid":`item-dropdown-${t.product.sku}`,name:`item-dropdown-${t.product.sku}`,handleSelect:y=>T(y,t),placeholder:"Select",value:(n==null?void 0:n[t.uid])??"",options:[{text:l.editNoteToSeller,value:"edit"},{text:l.remove,value:"remove"}]})}}),F=e(Ne,{columns:D,rowData:M,"data-testid":"product-list-table",mobileLayout:"stacked"}),x=r?te("form",{}):te("div",{}),i=r?{onSubmit:z,...v}:v,U=e(K,{type:"submit",disabled:f||!r||!L,"data-testid":"product-list-table-submit-button",children:l.updateButton});return b(J,{node:x,className:I(["quote-management-product-list-table-container",N]),"data-testid":"product-list-table-container",...i,children:[F,e("div",{className:"quote-management-product-list-table-container__submit-container",children:U})]})},Se=({className:N,entries:m,...r})=>{const f=o=>{var p;const u=(p=o.children)==null?void 0:p.map(f);return e("div",{className:"quote-management-quote-prices-summary__entry","data-testid":`quote-prices-summary-entry-${o.id}`,children:u?e(ve,{className:"quote-management-quote-prices-summary__accordion","data-testid":`quote-prices-summary-entry-accordion-${o.id}`,children:e(_e,{className:"quote-management-quote-prices-summary__accordion-section",title:o.label,ariaLabelTitle:o.label,secondaryText:o.value,children:u})}):b(re,{children:[e("span",{className:I(["quote-management-quote-prices-summary__label",["quote-management-quote-prices-summary__label--strong",o.strong]]),"data-testid":`quote-prices-summary-entry-label-${o.id}`,children:o.label}),e("span",{className:"quote-management-quote-prices-summary__value","data-testid":`quote-prices-summary-entry-value-${o.id}`,children:o.value})]})},o.id)};return e("div",{className:I(["quote-management-quote-prices-summary",N]),"data-testid":"quote-prices-summary",...r,children:m==null?void 0:m.map(f)})},ie=({open:N=!1,title:m,message:r,cancelLabel:f,confirmLabel:o,onCancel:u,onConfirm:p,onClose:k,showCloseButton:n,confirmationBanner:v,...B})=>{const Q=X({cancel:"ConfirmationModal.cancel",confirm:"ConfirmationModal.confirm"});if(!N)return null;const{className:S,..._}=B;return e(Me,{..._,size:"medium",onClose:k||u,clickToDismiss:!0,escapeToDismiss:!0,showCloseButton:n,"data-testid":"confirmation-modal",className:S,children:b("div",{className:"confirmation-modal__content",children:[v&&e("div",{className:"confirmation-modal__banner","data-testid":"confirmation-modal-banner",children:v}),m&&e("div",{className:"confirmation-modal__title","data-testid":"confirmation-modal-title",children:m}),r&&e("div",{className:"confirmation-modal__message","data-testid":"confirmation-modal-message",children:r}),b("div",{className:"confirmation-modal__actions","data-testid":"confirmation-modal-actions",children:[u&&e(K,{variant:"secondary",onClick:u,"data-testid":"confirmation-modal-cancel",children:f??Q.cancel}),e(K,{variant:"primary",onClick:p,"data-testid":"confirmation-modal-confirm",children:o??Q.confirm})]})]})})},xe=3e3,Ae=({quoteData:N,onItemCheckboxChange:m,onItemDropdownChange:r,onUpdate:f,onRemoveItemsRef:o,onRemoveModalStateChange:u,slots:p,...k})=>{const[n,v]=h(N),[B,Q]=h({}),[S,_]=h(!1),[L,l]=h({type:null,message:""}),[D,E]=h(!1),[T,$]=h([]),[z,C]=h(!1),[P,M]=h({type:null,message:""}),[F,x]=h({}),i=X({subtotal:"NegotiableQuote.Manage.quotePricesSummary.subtotal.excludingTax",grandTotal:"NegotiableQuote.Manage.quotePricesSummary.grandTotal.includingTax",appliedTaxes:"NegotiableQuote.Manage.quotePricesSummary.appliedTaxes",modalTitle:"NegotiableQuote.Manage.updateQuantitiesModal.title",modalDescription:"NegotiableQuote.Manage.updateQuantitiesModal.description",modalCancelButton:"NegotiableQuote.Manage.updateQuantitiesModal.cancelButton",modalUpdateButton:"NegotiableQuote.Manage.updateQuantitiesModal.updateButton",successHeading:"NegotiableQuote.Manage.updateQuantitiesModal.successHeading",successMessage:"NegotiableQuote.Manage.updateQuantitiesModal.successMessage",errorHeading:"NegotiableQuote.Manage.updateQuantitiesModal.errorHeading",errorMessage:"NegotiableQuote.Manage.updateQuantitiesModal.errorMessage",removeModalTitle:"NegotiableQuote.Manage.removeItemsModal.title",removeModalDescription:"NegotiableQuote.Manage.removeItemsModal.description",removeModalCancelButton:"NegotiableQuote.Manage.removeItemsModal.cancelButton",removeModalConfirmButton:"NegotiableQuote.Manage.removeItemsModal.confirmButton",removeModalConfirmButtonRemoving:"NegotiableQuote.Manage.removeItemsModal.confirmButtonRemoving",removeSuccessHeading:"NegotiableQuote.Manage.removeItemsModal.successHeading",removeSuccessMessage:"NegotiableQuote.Manage.removeItemsModal.successMessage",removeErrorHeading:"NegotiableQuote.Manage.removeItemsModal.errorHeading",removeErrorMessage:"NegotiableQuote.Manage.removeItemsModal.errorMessage"});w(()=>{const a=Y.on("quote-management/quote-data",s=>{v(s.quote),Q({}),l({type:null,message:""}),x({})},{eager:!0});return()=>a==null?void 0:a.off()},[]),w(()=>{const a=Y.on("quote-management/quantities-updated",s=>{v(s.quote),Q({}),l({type:"success",message:i.successMessage}),setTimeout(()=>{_(!1),l({type:null,message:""})},3e3)});return()=>a==null?void 0:a.off()},[i.successMessage]),w(()=>{const a=Y.on("quote-management/quote-items-removed",s=>{v(s.quote),$([]),C(!1),M({type:"success",message:i.removeSuccessMessage}),setTimeout(()=>{E(!1),M({type:null,message:""}),u==null||u(!1)},xe)});return()=>a==null?void 0:a.off()},[i.removeSuccessMessage,u]);const U=me(a=>{!a||a.length===0||($(a),M({type:null,message:""}),E(!0))},[]);w(()=>{o==null||o(U)},[U,o]);const t=()=>{M({type:null,message:""})},c=(a,s)=>{if(s==="remove"){x(d=>({...d,[a.uid]:s})),U([a]),r==null||r(a,s);return}r==null||r(a,s),x(d=>{if(!(a.uid in d))return d;const j={...d};return delete j[a.uid],j})},g=async()=>{if(!n||T.length===0)return;const a=T.map(s=>s.uid);C(!0),M({type:null,message:""});try{await Qe({quoteUid:n.uid,quoteItemUids:a})}catch(s){const d=s instanceof Error?s.message:i.removeErrorMessage;if(M({type:"error",message:d}),T.length===1){const j=T[0];x(V=>{if(!(j.uid in V))return V;const R={...V};return delete R[j.uid],R})}C(!1)}},y=()=>{if(E(!1),M({type:null,message:""}),u==null||u(!1),T.length===1){const a=T[0];x(s=>{if(!(a.uid in s))return s;const d={...s};return delete d[a.uid],d})}$([])};if(!n)return e(ne,{loading:!0});const A=!!n.canUpdateQuote,q=(a,s)=>{Q(d=>({...d,[a.uid]:s}))},H=a=>{a.preventDefault(),l({type:null,message:""}),_(!0)},le=async()=>{if(!n)return;if(Object.keys(B).length===0){_(!1);return}l({type:null,message:""});const a=Object.entries(B).map(([s,d])=>({quoteItemUid:s,quantity:d}));try{await he({quoteUid:n.uid,items:a})}catch(s){const d=s instanceof Error?s.message:i.errorMessage;l({type:"error",message:d}),console.error("Failed to update quantities:",s)}},ue=()=>{_(!1),l({type:null,message:""})},Z=()=>{l({type:null,message:""})},G=[];n.prices.subtotalExcludingTax&&G.push({label:i.subtotal,id:"subtotal",value:e(O,{amount:n.prices.subtotalExcludingTax.value,currency:n.prices.subtotalExcludingTax.currency,weight:"normal"})}),n.prices.grandTotal&&G.push({label:i.grandTotal,id:"total",value:e(O,{amount:n.prices.grandTotal.value,currency:n.prices.grandTotal.currency}),strong:!0});const ce=L.type==="success"?e(W,{type:"success",variant:"primary",icon:e(se,{}),heading:i.successHeading,description:L.message,onDismiss:Z,"data-testid":"update-quantities-success-banner"}):L.type==="error"?e(W,{type:"error",variant:"primary",icon:e(oe,{}),heading:i.errorHeading,description:L.message,onDismiss:Z,"data-testid":"update-quantities-error-banner"}):null,de=P.type==="success"?e(W,{type:"success",variant:"primary",icon:e(se,{}),heading:i.removeSuccessHeading,description:P.message,onDismiss:t,"data-testid":"remove-items-success-banner"}):P.type==="error"?e(W,{type:"error",variant:"primary",icon:e(oe,{}),heading:i.removeErrorHeading,description:P.message,onDismiss:t,"data-testid":"remove-items-error-banner"}):null;return b(re,{children:[e(ne,{"data-testid":"items-quoted-container",...k,loading:!1,table:e(ee,{name:"ProductListTable",slot:p==null?void 0:p.ProductListTable,context:{items:n.items,canEdit:A,readOnly:n.readOnly,onItemCheckboxChange:m,onItemDropdownChange:c,onQuantityChange:q,onUpdate:f,dropdownSelections:F},children:e(ke,{items:n.items,canEdit:A,readOnly:n.readOnly,onItemCheckboxChange:m,onItemDropdownChange:c,onQuantityChange:q,onUpdate:H,dropdownSelections:F})}),pricesSummary:e(ee,{name:"QuotePricesSummary",slot:p==null?void 0:p.QuotePricesSummary,context:{items:n.items,prices:n.prices},children:e(Se,{entries:G})})}),e(ie,{open:S,title:i.modalTitle,message:i.modalDescription,cancelLabel:i.modalCancelButton,confirmLabel:i.modalUpdateButton,onCancel:ue,onConfirm:le,confirmationBanner:ce,"data-testid":"update-quantities-modal"}),e(ie,{open:D,title:i.removeModalTitle,message:i.removeModalDescription,cancelLabel:i.removeModalCancelButton,confirmLabel:z?i.removeModalConfirmButtonRemoving:i.removeModalConfirmButton,onCancel:y,onConfirm:g,confirmationBanner:de,"data-testid":"remove-items-modal"})]})};export{ie as C,Ae as I};
|
|
3
|
+
import{jsx as a,jsxs as U,Fragment as ce}from"@dropins/tools/preact-jsx-runtime.js";import{useState as c,useEffect as q,useCallback as le}from"@dropins/tools/preact-compat.js";import{Slot as Y}from"@dropins/tools/lib.js";import{events as E}from"@dropins/tools/event-bus.js";import{Modal as ue,Button as $,Price as G,InLineAlert as B}from"@dropins/tools/components.js";/* empty css */import{I as J,Q as me,P as de}from"./QuotePricesSummary.js";import{useText as Z}from"@dropins/tools/i18n.js";/* empty css *//* empty css *//* empty css */import{u as ge,r as pe}from"./removeNegotiableQuoteItems.js";import{S as K,a as V}from"./WarningFilled.js";const X=({open:x=!1,title:g,message:r,cancelLabel:I,confirmLabel:p,onCancel:n,onConfirm:l,onClose:S,showCloseButton:o,confirmationBanner:f,...N})=>{const M=Z({cancel:"ConfirmationModal.cancel",confirm:"ConfirmationModal.confirm"});if(!x)return null;const{className:C,...y}=N;return a(ue,{...y,size:"medium",onClose:S||n,clickToDismiss:!0,escapeToDismiss:!0,showCloseButton:o,"data-testid":"confirmation-modal",className:C,children:U("div",{className:"confirmation-modal__content",children:[f&&a("div",{className:"confirmation-modal__banner","data-testid":"confirmation-modal-banner",children:f}),g&&a("div",{className:"confirmation-modal__title","data-testid":"confirmation-modal-title",children:g}),r&&a("div",{className:"confirmation-modal__message","data-testid":"confirmation-modal-message",children:r}),U("div",{className:"confirmation-modal__actions","data-testid":"confirmation-modal-actions",children:[n&&a($,{variant:"secondary",onClick:n,"data-testid":"confirmation-modal-cancel",children:I??M.cancel}),a($,{variant:"primary",onClick:l,"data-testid":"confirmation-modal-confirm",children:p??M.confirm})]})]})})},fe=3e3,Ce=({quoteData:x,onItemCheckboxChange:g,onItemDropdownChange:r,onUpdate:I,onRemoveItemsRef:p,onRemoveModalStateChange:n,slots:l,...S})=>{const[o,f]=c(x),[N,M]=c({}),[C,y]=c(!1),[T,u]=c({type:null,message:""}),[w,O]=c(!1),[b,P]=c([]),[R,_]=c(!1),[h,d]=c({type:null,message:""}),[L,Q]=c({}),s=Z({subtotal:"NegotiableQuote.Manage.quotePricesSummary.subtotal.excludingTax",grandTotal:"NegotiableQuote.Manage.quotePricesSummary.grandTotal.includingTax",appliedTaxes:"NegotiableQuote.Manage.quotePricesSummary.appliedTaxes",modalTitle:"NegotiableQuote.Manage.updateQuantitiesModal.title",modalDescription:"NegotiableQuote.Manage.updateQuantitiesModal.description",modalCancelButton:"NegotiableQuote.Manage.updateQuantitiesModal.cancelButton",modalUpdateButton:"NegotiableQuote.Manage.updateQuantitiesModal.updateButton",successHeading:"NegotiableQuote.Manage.updateQuantitiesModal.successHeading",successMessage:"NegotiableQuote.Manage.updateQuantitiesModal.successMessage",errorHeading:"NegotiableQuote.Manage.updateQuantitiesModal.errorHeading",errorMessage:"NegotiableQuote.Manage.updateQuantitiesModal.errorMessage",removeModalTitle:"NegotiableQuote.Manage.removeItemsModal.title",removeModalDescription:"NegotiableQuote.Manage.removeItemsModal.description",removeModalCancelButton:"NegotiableQuote.Manage.removeItemsModal.cancelButton",removeModalConfirmButton:"NegotiableQuote.Manage.removeItemsModal.confirmButton",removeModalConfirmButtonRemoving:"NegotiableQuote.Manage.removeItemsModal.confirmButtonRemoving",removeSuccessHeading:"NegotiableQuote.Manage.removeItemsModal.successHeading",removeSuccessMessage:"NegotiableQuote.Manage.removeItemsModal.successMessage",removeErrorHeading:"NegotiableQuote.Manage.removeItemsModal.errorHeading",removeErrorMessage:"NegotiableQuote.Manage.removeItemsModal.errorMessage"});q(()=>{const e=E.on("quote-management/quote-data",t=>{f(t.quote),M({}),u({type:null,message:""}),Q({})},{eager:!0});return()=>e==null?void 0:e.off()},[]),q(()=>{const e=E.on("quote-management/quantities-updated",t=>{f(t.quote),M({}),u({type:"success",message:s.successMessage}),setTimeout(()=>{y(!1),u({type:null,message:""})},3e3)});return()=>e==null?void 0:e.off()},[s.successMessage]),q(()=>{const e=E.on("quote-management/quote-items-removed",t=>{f(t.quote),P([]),_(!1),d({type:"success",message:s.removeSuccessMessage}),setTimeout(()=>{O(!1),d({type:null,message:""}),n==null||n(!1)},fe)});return()=>e==null?void 0:e.off()},[s.removeSuccessMessage,n]);const D=le(e=>{!e||e.length===0||(P(e),d({type:null,message:""}),O(!0))},[]);q(()=>{p==null||p(D)},[D,p]);const k=()=>{d({type:null,message:""})},j=(e,t)=>{const i=e;if(t==="remove"){Q(m=>({...m,[i.uid]:t})),D([i]),r==null||r(i,t);return}r==null||r(i,t),Q(m=>{if(!(i.uid in m))return m;const v={...m};return delete v[i.uid],v})},ee=async()=>{if(!o||b.length===0)return;const e=b.map(t=>t.uid);_(!0),d({type:null,message:""});try{await pe({quoteUid:o.uid,quoteItemUids:e})}catch(t){const i=t instanceof Error?t.message:s.removeErrorMessage;if(d({type:"error",message:i}),b.length===1){const m=b[0];Q(v=>{if(!(m.uid in v))return v;const z={...v};return delete z[m.uid],z})}_(!1)}},te=()=>{if(O(!1),d({type:null,message:""}),n==null||n(!1),b.length===1){const e=b[0];Q(t=>{if(!(e.uid in t))return t;const i={...t};return delete i[e.uid],i})}P([])};if(!o)return a(J,{loading:!0});const A=!!o.canUpdateQuote,F=(e,t)=>{M(i=>({...i,[e.uid]:t}))},ae=e=>{e.preventDefault(),u({type:null,message:""}),y(!0)},se=async()=>{if(!o)return;if(Object.keys(N).length===0){y(!1);return}u({type:null,message:""});const e=Object.entries(N).map(([t,i])=>({quoteItemUid:t,quantity:i}));try{await ge({quoteUid:o.uid,items:e})}catch(t){const i=t instanceof Error?t.message:s.errorMessage;u({type:"error",message:i}),console.error("Failed to update quantities:",t)}},oe=()=>{y(!1),u({type:null,message:""})},W=()=>{u({type:null,message:""})},H=[];o.prices.subtotalExcludingTax&&H.push({label:s.subtotal,id:"subtotal",value:a(G,{amount:o.prices.subtotalExcludingTax.value,currency:o.prices.subtotalExcludingTax.currency,weight:"normal"})}),o.prices.grandTotal&&H.push({label:s.grandTotal,id:"total",value:a(G,{amount:o.prices.grandTotal.value,currency:o.prices.grandTotal.currency}),strong:!0});const ie=T.type==="success"?a(B,{type:"success",variant:"primary",icon:a(K,{}),heading:s.successHeading,description:T.message,onDismiss:W,"data-testid":"update-quantities-success-banner"}):T.type==="error"?a(B,{type:"error",variant:"primary",icon:a(V,{}),heading:s.errorHeading,description:T.message,onDismiss:W,"data-testid":"update-quantities-error-banner"}):null,ne=g?(e,t)=>{g(e,t)}:void 0,re=h.type==="success"?a(B,{type:"success",variant:"primary",icon:a(K,{}),heading:s.removeSuccessHeading,description:h.message,onDismiss:k,"data-testid":"remove-items-success-banner"}):h.type==="error"?a(B,{type:"error",variant:"primary",icon:a(V,{}),heading:s.removeErrorHeading,description:h.message,onDismiss:k,"data-testid":"remove-items-error-banner"}):null;return U(ce,{children:[a(J,{"data-testid":"items-quoted-container",...S,loading:!1,table:a(Y,{name:"ProductListTable",slot:l==null?void 0:l.ProductListTable,context:{items:o.items,canEdit:A,readOnly:o.readOnly,onItemCheckboxChange:g,onItemDropdownChange:j,onQuantityChange:F,onUpdate:I,dropdownSelections:L},children:a(de,{items:o.items,canEdit:A,onItemCheckboxChange:ne,readOnly:o.readOnly,onItemDropdownChange:j,onQuantityChange:F,onUpdate:ae,dropdownSelections:L})}),pricesSummary:a(Y,{name:"QuotePricesSummary",slot:l==null?void 0:l.QuotePricesSummary,context:{items:o.items,prices:o.prices},children:a(me,{entries:H})})}),a(X,{open:C,title:s.modalTitle,message:s.modalDescription,cancelLabel:s.modalCancelButton,confirmLabel:s.modalUpdateButton,onCancel:oe,onConfirm:se,confirmationBanner:ie,"data-testid":"update-quantities-modal"}),a(X,{open:w,title:s.removeModalTitle,message:s.removeModalDescription,cancelLabel:s.removeModalCancelButton,confirmLabel:R?s.removeModalConfirmButtonRemoving:s.removeModalConfirmButton,onCancel:te,onConfirm:ee,confirmationBanner:re,"data-testid":"remove-items-modal"})]})};export{X as C,Ce as I};
|
|
4
4
|
//# sourceMappingURL=ItemsQuoted.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ItemsQuoted.js","sources":["/@dropins/storefront-quote-management/src/components/ItemsQuoted/ItemsQuoted.tsx","/@dropins/storefront-quote-management/src/components/ProductListTable/ProductListTable.tsx","/@dropins/storefront-quote-management/src/components/QuotePricesSummary/QuotePricesSummary.tsx","/@dropins/storefront-quote-management/src/components/ConfirmationModal/ConfirmationModal.tsx","/@dropins/storefront-quote-management/src/containers/ItemsQuoted/ItemsQuoted.tsx"],"sourcesContent":["/********************************************************************\n * Copyright 2025 Adobe\n * All Rights Reserved.\n *\n * NOTICE: Adobe permits you to use, modify, and distribute this \n * file in accordance with the terms of the Adobe license agreement \n * accompanying it. \n *******************************************************************/\n\nimport { FunctionComponent, VNode } from 'preact';\nimport { HTMLAttributes } from 'preact/compat';\nimport { classes, VComponent } from '@adobe-commerce/elsie/lib';\nimport '@/quote-management/components/ItemsQuoted/ItemsQuoted.css';\nimport { Skeleton, SkeletonRow } from '@adobe-commerce/elsie/components';\n\nexport interface ItemsQuotedProps extends Omit<HTMLAttributes<HTMLDivElement>, 'loading'> {\n loading?: boolean;\n table?: VNode;\n pricesSummary?: VNode;\n}\n\nexport const ItemsQuoted: FunctionComponent<ItemsQuotedProps> = ({\n className,\n loading,\n table,\n pricesSummary,\n ...props\n}) => {\n if (loading) {\n return <ItemsQuotedSkeleton />;\n }\n\n return (\n <div className={classes(['quote-management-items-quoted', className])} {...props}>\n {table && (\n <VComponent\n node={table}\n className={classes(['quote-management-items-quoted__table'])}\n data-testid=\"quote-management-items-quoted__table\"\n />\n )}\n {pricesSummary && (\n <VComponent\n node={pricesSummary}\n className={classes(['quote-management-items-quoted__prices-summary'])}\n data-testid=\"quote-management-items-quoted__prices-summary\"\n />\n )}\n </div>\n );\n};\n\nexport const ItemsQuotedSkeleton: FunctionComponent = () => {\n return (\n <Skeleton data-testid=\"items-quoted-skeleton\">\n <SkeletonRow variant=\"row\" fullWidth={true} size=\"medium\" lines={4} multilineGap='xsmall' />\n </Skeleton>\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, h } from 'preact';\nimport { HTMLAttributes } from 'preact/compat';\nimport { useState, useEffect } from 'preact/hooks';\nimport { classes, VComponent } from '@adobe-commerce/elsie/lib';\nimport {\n Table,\n Checkbox,\n Picker,\n Price,\n Button,\n Input,\n} from '@adobe-commerce/elsie/components';\nimport '@/quote-management/components/ProductListTable/ProductListTable.css';\nimport { NegotiableQuoteCartItem } from '@/quote-management/data/models/negotiable-quote-model';\nimport { useText } from '@adobe-commerce/elsie/i18n';\n\nexport interface ProductListTableProps\n extends HTMLAttributes<HTMLDivElement | HTMLFormElement> {\n items: NegotiableQuoteCartItem[];\n canEdit: boolean;\n readOnly?: boolean;\n onItemCheckboxChange?: (\n item: NegotiableQuoteCartItem,\n isSelected: boolean\n ) => void;\n onItemDropdownChange?: (\n item: NegotiableQuoteCartItem,\n action: string\n ) => void;\n onQuantityChange?: (\n item: NegotiableQuoteCartItem,\n newQuantity: number\n ) => void;\n onUpdate?: (e: SubmitEvent) => void;\n dropdownSelections?: Record<string, string | undefined>;\n}\n\nexport const ProductListTable: FunctionComponent<ProductListTableProps> = ({\n className,\n items,\n canEdit,\n readOnly = false,\n onItemCheckboxChange,\n onItemDropdownChange,\n onQuantityChange,\n onUpdate,\n dropdownSelections,\n ...props\n}) => {\n // Track original quantities to detect changes\n const [originalQuantities, setOriginalQuantities] = useState<\n Record<string, number>\n >({});\n const [currentQuantities, setCurrentQuantities] = useState<\n Record<string, number>\n >({});\n\n // Initialize quantities when items change\n useEffect(() => {\n const quantities: Record<string, number> = {};\n items.forEach((item) => {\n quantities[item.uid] = item.quantity;\n });\n setOriginalQuantities(quantities);\n setCurrentQuantities(quantities);\n }, [items]);\n\n // Check if any quantities have changed\n const hasQuantityChanges = Object.keys(currentQuantities).some(\n (uid) => currentQuantities[uid] !== originalQuantities[uid]\n );\n\n const dictionary = useText({\n updateButton: 'NegotiableQuote.Manage.productListTable.submitButton',\n productNameHeader:\n 'NegotiableQuote.Manage.productListTable.headers.productName',\n skuHeader: 'NegotiableQuote.Manage.productListTable.headers.sku',\n priceHeader: 'NegotiableQuote.Manage.productListTable.headers.price',\n quantityHeader: 'NegotiableQuote.Manage.productListTable.headers.quantity',\n discountHeader: 'NegotiableQuote.Manage.productListTable.headers.discount',\n subtotalHeader: 'NegotiableQuote.Manage.productListTable.headers.subtotal',\n actionsHeader: 'NegotiableQuote.Manage.productListTable.headers.actions',\n editNoteToSeller:\n 'NegotiableQuote.Manage.productListTable.actions.editNoteToSeller',\n remove: 'NegotiableQuote.Manage.productListTable.actions.remove',\n });\n\n const columns = [\n {\n label: dictionary.productNameHeader,\n key: 'productName',\n },\n {\n label: dictionary.skuHeader,\n key: 'sku',\n },\n {\n label: dictionary.priceHeader,\n key: 'price',\n },\n {\n label: dictionary.quantityHeader,\n key: 'quantity',\n },\n {\n label: dictionary.discountHeader,\n key: 'discount',\n },\n {\n label: dictionary.subtotalHeader,\n key: 'subtotal',\n },\n ];\n\n if (canEdit && !readOnly) {\n columns.unshift({\n label: '',\n key: 'checkbox',\n });\n columns.push({\n label: dictionary.actionsHeader,\n key: 'actions',\n });\n }\n\n const handleItemCheckboxChange = (\n event: Event,\n item: NegotiableQuoteCartItem\n ) => {\n const isSelected = (event.target as HTMLInputElement).checked;\n onItemCheckboxChange?.(item, isSelected);\n };\n\n const handleItemDropdownChange = (\n event: Event,\n item: NegotiableQuoteCartItem\n ) => {\n const action = (event.target as HTMLSelectElement).value;\n onItemDropdownChange?.(item, action);\n };\n\n const handleQuantityChange = (\n event: Event,\n item: NegotiableQuoteCartItem\n ) => {\n const newQuantity = parseInt((event.target as HTMLInputElement).value, 10);\n if (!isNaN(newQuantity) && newQuantity > 0) {\n setCurrentQuantities((prev) => ({\n ...prev,\n [item.uid]: newQuantity,\n }));\n onQuantityChange?.(item, newQuantity);\n }\n };\n\n const handleUpdate = (event: SubmitEvent) => {\n event.preventDefault();\n onUpdate?.(event);\n };\n\n const discountElement = (amountOff: number, percentOff: number) => {\n return amountOff > 0 ? (\n <div className=\"quote-management-product-list-table__discount-container\">\n <span className=\"quote-management-product-list-table__discount-percent\">\n {percentOff}%\n </span>\n <span className=\"quote-management-product-list-table__discount-price\">\n (<Price amount={amountOff} />)\n </span>\n </div>\n ) : undefined;\n };\n\n const getProductNameContent = (item: NegotiableQuoteCartItem) => {\n const configurableOptions = item.configurableOptions?.map((option) => (\n <div\n key={option.optionLabel}\n className=\"quote-management-product-list-table__configurable-option\"\n >\n <span className=\"quote-management-product-list-table__configurable-option-label\">\n {option.optionLabel}:\n </span>\n <span className=\"quote-management-product-list-table__configurable-option-value\">\n {option.valueLabel}\n </span>\n </div>\n ));\n\n const bundleOptions = item.bundleOptions?.map((option) => (\n <div\n key={option.label}\n className=\"quote-management-product-list-table__bundle-option\"\n >\n <span className=\"quote-management-product-list-table__bundle-option-label\">\n {option.label}\n </span>\n <div className=\"quote-management-product-list-table__bundle-option-values\">\n {option.values.map((value) => (\n <span\n key={value.label}\n className=\"quote-management-product-list-table__bundle-option-value\"\n >\n <span className=\"quote-management-product-list-table__bundle-option-value-quantity\">\n {value.quantity} x\n </span>\n <span className=\"quote-management-product-list-table__bundle-option-value-label\">\n {value.label}\n </span>\n <Price\n className=\"quote-management-product-list-table__bundle-option-value-original-price\"\n amount={value.originalPrice.value}\n currency={value.originalPrice.currency}\n weight=\"normal\"\n />\n </span>\n ))}\n </div>\n </div>\n ));\n\n return (\n <div className=\"quote-management-product-list-table__product-name-container\">\n <span className=\"quote-management-product-list-table__product-name\">\n {item.product.name}\n </span>\n {configurableOptions}\n {bundleOptions}\n </div>\n );\n };\n\n const rowData = items.map((item) => {\n const quantityElement = canEdit ? (\n <Input\n className=\"quote-management-product-list-table__quantity-input\"\n type=\"number\"\n min=\"1\"\n value={\n currentQuantities[item.uid]?.toString() || item.quantity.toString()\n }\n onChange={(e) => handleQuantityChange(e, item)}\n disabled={readOnly || !canEdit}\n data-testid={`quantity-input-${item.product.sku}`}\n />\n ) : (\n <span className=\"quote-management-product-list-table__quantity\">\n {item.quantity}\n </span>\n );\n\n return {\n checkbox: (\n <Checkbox\n className=\"quote-management-product-list-table__checkbox\"\n name=\"itemSelected\"\n data-testid={`item-checkbox-${item.product.sku}`}\n onChange={(e) => handleItemCheckboxChange(e, item)}\n value={item.product.sku}\n />\n ),\n productName: getProductNameContent(item),\n sku: (\n <span className=\"quote-management-product-list-table__sku\">\n {item.product.sku}\n </span>\n ),\n price: (\n <Price\n className=\"quote-management-product-list-table__price\"\n amount={item.prices.originalItemPrice.value}\n currency={item.prices.originalItemPrice.currency}\n />\n ),\n quantity: quantityElement,\n discount: discountElement(\n item.catalogDiscount.amountOff,\n item.catalogDiscount.percentOff\n ),\n subtotal: (\n <Price\n className=\"quote-management-product-list-table__subtotal\"\n amount={item.prices.rowTotal.value}\n currency={item.prices.rowTotal.currency}\n />\n ),\n actions: (\n <Picker\n className=\"quote-management-product-list-table__actions\"\n data-testid={`item-dropdown-${item.product.sku}`}\n name={`item-dropdown-${item.product.sku}`}\n handleSelect={(e) => handleItemDropdownChange(e, item)}\n placeholder=\"Select\"\n value={dropdownSelections?.[item.uid] ?? ''}\n options={[\n { text: dictionary.editNoteToSeller, value: 'edit' },\n { text: dictionary.remove, value: 'remove' },\n ]}\n />\n ),\n };\n });\n\n const table = (\n <Table\n columns={columns}\n rowData={rowData}\n data-testid=\"product-list-table\"\n mobileLayout=\"stacked\"\n />\n );\n\n // if can edit, the wrapper node should use the form element, else use the div element\n const wrapperNode = canEdit ? h('form', {}) : h('div', {});\n const wrapperProps = canEdit\n ? {\n onSubmit: handleUpdate,\n ...props,\n }\n : props;\n\n const submitButton = (\n <Button\n type=\"submit\"\n disabled={readOnly || !canEdit || !hasQuantityChanges}\n data-testid=\"product-list-table-submit-button\"\n >\n {dictionary.updateButton}\n </Button>\n );\n\n return (\n <VComponent\n node={wrapperNode}\n className={classes([\n 'quote-management-product-list-table-container',\n className,\n ])}\n data-testid=\"product-list-table-container\"\n {...wrapperProps}\n >\n {table}\n <div className=\"quote-management-product-list-table-container__submit-container\">\n {submitButton}\n </div>\n </VComponent>\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, VNode } from 'preact';\nimport { HTMLAttributes } from 'preact/compat';\nimport { classes } from '@adobe-commerce/elsie/lib';\nimport '@/quote-management/components/QuotePricesSummary/QuotePricesSummary.css';\nimport { Accordion, AccordionSection } from '@adobe-commerce/elsie/components';\n\ninterface Entry {\n label: string;\n id: string;\n value: VNode;\n strong?: boolean;\n children?: Entry[];\n}\n\nexport interface QuotePricesSummaryProps extends HTMLAttributes<HTMLDivElement> {\n entries?: Entry[];\n}\n\nexport const QuotePricesSummary: FunctionComponent<QuotePricesSummaryProps> = ({\n className,\n entries,\n ...props\n}) => {\n const createEntry = (entry: Entry) => {\n const children = entry.children?.map(createEntry);\n return (\n <div key={entry.id} className=\"quote-management-quote-prices-summary__entry\" data-testid={`quote-prices-summary-entry-${entry.id}`}>\n {children ? <Accordion\n className=\"quote-management-quote-prices-summary__accordion\"\n data-testid={`quote-prices-summary-entry-accordion-${entry.id}`}\n >\n <AccordionSection className=\"quote-management-quote-prices-summary__accordion-section\" title={entry.label} ariaLabelTitle={entry.label} secondaryText={entry.value}>\n {children}\n </AccordionSection>\n </Accordion>\n :\n <>\n <span className={classes(['quote-management-quote-prices-summary__label', ['quote-management-quote-prices-summary__label--strong', entry.strong]])} data-testid={`quote-prices-summary-entry-label-${entry.id}`}>{entry.label}</span>\n <span className=\"quote-management-quote-prices-summary__value\" data-testid={`quote-prices-summary-entry-value-${entry.id}`}>{entry.value}</span>\n </>\n }\n </div>\n );\n };\n\n return (\n <div className={classes(['quote-management-quote-prices-summary', className])} data-testid=\"quote-prices-summary\" {...props}>\n {entries?.map(createEntry)}\n </div>\n );\n};\n","/********************************************************************\n * Copyright 2025 Adobe\n * All Rights Reserved.\n *\n * NOTICE: Adobe permits you to use, modify, and distribute this\n * file in accordance with the terms of the Adobe license agreement\n * accompanying it.\n *******************************************************************/\n\nimport { FunctionComponent, VNode } from 'preact';\nimport { HTMLAttributes } from 'preact/compat';\nimport { Button, Modal } from '@adobe-commerce/elsie/components';\nimport { useText } from '@adobe-commerce/elsie/i18n';\nimport '@/quote-management/components/ConfirmationModal/ConfirmationModal.css';\n\nexport interface ConfirmationModalProps\n extends Omit<HTMLAttributes<HTMLDivElement>, 'title'> {\n open?: boolean;\n title?: VNode | string;\n message?: VNode | string;\n cancelLabel?: VNode | string;\n confirmLabel?: VNode | string;\n onCancel?: () => void;\n onConfirm?: () => void;\n onClose?: () => void;\n showCloseButton?: boolean;\n confirmationBanner?: VNode | null;\n}\n\nexport const ConfirmationModal: FunctionComponent<ConfirmationModalProps> = ({\n open = false,\n title,\n message,\n cancelLabel,\n confirmLabel,\n onCancel,\n onConfirm,\n onClose,\n showCloseButton,\n confirmationBanner,\n ...props\n}) => {\n const dictionary = useText({\n cancel: 'ConfirmationModal.cancel',\n confirm: 'ConfirmationModal.confirm',\n });\n\n if (!open) {\n return null;\n }\n\n const { className, ...restProps } = props;\n\n return (\n <Modal\n {...restProps}\n size={'medium'}\n onClose={onClose || onCancel}\n clickToDismiss={true}\n escapeToDismiss={true}\n showCloseButton={showCloseButton}\n data-testid=\"confirmation-modal\"\n className={className}\n >\n <div className=\"confirmation-modal__content\">\n {confirmationBanner && (\n <div\n className=\"confirmation-modal__banner\"\n data-testid=\"confirmation-modal-banner\"\n >\n {confirmationBanner}\n </div>\n )}\n {title && (\n <div\n className=\"confirmation-modal__title\"\n data-testid=\"confirmation-modal-title\"\n >\n {title}\n </div>\n )}\n {message && (\n <div\n className=\"confirmation-modal__message\"\n data-testid=\"confirmation-modal-message\"\n >\n {message}\n </div>\n )}\n <div\n className=\"confirmation-modal__actions\"\n data-testid=\"confirmation-modal-actions\"\n >\n {onCancel && (\n <Button\n variant=\"secondary\"\n onClick={onCancel}\n data-testid=\"confirmation-modal-cancel\"\n >\n {cancelLabel ?? dictionary.cancel}\n </Button>\n )}\n <Button\n variant=\"primary\"\n onClick={onConfirm}\n data-testid=\"confirmation-modal-confirm\"\n >\n {confirmLabel ?? dictionary.confirm}\n </Button>\n </div>\n </div>\n </Modal>\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 useState,\n} from 'preact/compat';\nimport { Container, Slot, SlotProps } from '@adobe-commerce/elsie/lib';\nimport { ProductListTable } from '@/quote-management/components/ProductListTable/ProductListTable';\nimport {\n NegotiableQuoteModel,\n NegotiableQuoteCartItem,\n} from '@/quote-management/data/models/negotiable-quote-model';\nimport { events } from '@adobe-commerce/event-bus';\nimport { QuotePricesSummary } from '@/quote-management/components/QuotePricesSummary';\nimport { ItemsQuoted as ItemsQuotedComponent } from '@/quote-management/components/ItemsQuoted';\nimport { Price, InLineAlert } from '@adobe-commerce/elsie/components';\nimport { useText } from '@adobe-commerce/elsie/i18n';\nimport { CheckWithCircle, WarningFilled } from '@adobe-commerce/elsie/icons';\nimport { ConfirmationModal } from '@/quote-management/components/ConfirmationModal';\nimport { updateQuantities } from '@/quote-management/api/updateQuantities';\nimport { removeNegotiableQuoteItems } from '@/quote-management/api/removeNegotiableQuoteItems';\n\nconst NOTIFICATION_AUTO_DISMISS_DELAY = 3000;\n\nexport interface ItemsQuotedProps extends HTMLAttributes<HTMLDivElement> {\n quoteData?: NegotiableQuoteModel;\n onItemCheckboxChange?: (\n item: NegotiableQuoteCartItem,\n isSelected: boolean\n ) => void;\n onItemDropdownChange?: (\n item: NegotiableQuoteCartItem,\n action: string\n ) => void;\n onUpdate?: (e: SubmitEvent) => void;\n onRemoveItemsRef?: (\n handler: (items: NegotiableQuoteCartItem[]) => void\n ) => void;\n onRemoveModalStateChange?: (isOpen: boolean) => void;\n slots?: {\n ProductListTable?: SlotProps<{\n items: NegotiableQuoteModel['items'];\n canEdit: boolean;\n readOnly?: boolean;\n onItemCheckboxChange?: (\n item: NegotiableQuoteCartItem,\n isSelected: boolean\n ) => void;\n onItemDropdownChange?: (\n item: NegotiableQuoteCartItem,\n action: string\n ) => void;\n onQuantityChange?: (\n item: NegotiableQuoteCartItem,\n newQuantity: number\n ) => void;\n onUpdate?: (e: SubmitEvent) => void;\n dropdownSelections?: Record<string, string>;\n }>;\n QuotePricesSummary?: SlotProps<{\n items: NegotiableQuoteModel['items'];\n prices: NegotiableQuoteModel['prices'];\n }>;\n };\n}\n\nexport const ItemsQuoted: Container<ItemsQuotedProps> = ({\n quoteData: initialData,\n onItemCheckboxChange,\n onItemDropdownChange,\n onUpdate,\n onRemoveItemsRef,\n onRemoveModalStateChange,\n slots,\n ...props\n}) => {\n const [quoteData, setQuoteData] = useState<NegotiableQuoteModel | undefined>(\n initialData\n );\n const [quantityChanges, setQuantityChanges] = useState<{\n [itemUid: string]: number;\n }>({});\n const [isModalOpen, setIsModalOpen] = useState(false);\n const [notificationState, setNotificationState] = useState<{\n type: 'success' | 'error' | null;\n message: string;\n }>({ type: null, message: '' });\n // State for remove items functionality\n const [isRemoveModalOpen, setIsRemoveModalOpen] = useState(false);\n const [itemsToRemove, setItemsToRemove] = useState<NegotiableQuoteCartItem[]>(\n []\n );\n const [isRemoving, setIsRemoving] = useState(false);\n const [removeNotificationState, setRemoveNotificationState] = useState<{\n type: 'success' | 'error' | null;\n message: string;\n }>({ type: null, message: '' });\n const [dropdownSelections, setDropdownSelections] = useState<\n Record<string, string>\n >({});\n\n const dictionary = useText({\n subtotal: 'NegotiableQuote.Manage.quotePricesSummary.subtotal.excludingTax',\n grandTotal:\n 'NegotiableQuote.Manage.quotePricesSummary.grandTotal.includingTax',\n appliedTaxes: 'NegotiableQuote.Manage.quotePricesSummary.appliedTaxes',\n modalTitle: 'NegotiableQuote.Manage.updateQuantitiesModal.title',\n modalDescription:\n 'NegotiableQuote.Manage.updateQuantitiesModal.description',\n modalCancelButton:\n 'NegotiableQuote.Manage.updateQuantitiesModal.cancelButton',\n modalUpdateButton:\n 'NegotiableQuote.Manage.updateQuantitiesModal.updateButton',\n successHeading:\n 'NegotiableQuote.Manage.updateQuantitiesModal.successHeading',\n successMessage:\n 'NegotiableQuote.Manage.updateQuantitiesModal.successMessage',\n errorHeading: 'NegotiableQuote.Manage.updateQuantitiesModal.errorHeading',\n errorMessage: 'NegotiableQuote.Manage.updateQuantitiesModal.errorMessage',\n removeModalTitle: 'NegotiableQuote.Manage.removeItemsModal.title',\n removeModalDescription:\n 'NegotiableQuote.Manage.removeItemsModal.description',\n removeModalCancelButton:\n 'NegotiableQuote.Manage.removeItemsModal.cancelButton',\n removeModalConfirmButton:\n 'NegotiableQuote.Manage.removeItemsModal.confirmButton',\n removeModalConfirmButtonRemoving:\n 'NegotiableQuote.Manage.removeItemsModal.confirmButtonRemoving',\n removeSuccessHeading:\n 'NegotiableQuote.Manage.removeItemsModal.successHeading',\n removeSuccessMessage:\n 'NegotiableQuote.Manage.removeItemsModal.successMessage',\n removeErrorHeading: 'NegotiableQuote.Manage.removeItemsModal.errorHeading',\n removeErrorMessage: 'NegotiableQuote.Manage.removeItemsModal.errorMessage',\n });\n\n useEffect(() => {\n const quoteDataEvent = events.on(\n 'quote-management/quote-data',\n\n (data: { quote: NegotiableQuoteModel }) => {\n setQuoteData(data.quote);\n setQuantityChanges({});\n setNotificationState({ type: null, message: '' });\n setDropdownSelections({});\n },\n\n {\n eager: true,\n }\n );\n return () => quoteDataEvent?.off();\n }, []);\n\n useEffect(() => {\n const quantitiesUpdatedEvent = events.on(\n 'quote-management/quantities-updated',\n (data: { quote: NegotiableQuoteModel }) => {\n setQuoteData(data.quote);\n setQuantityChanges({});\n setNotificationState({\n type: 'success',\n message: dictionary.successMessage,\n });\n // Auto-close success notification after 3 seconds\n setTimeout(() => {\n setIsModalOpen(false);\n setNotificationState({ type: null, message: '' });\n }, 3000);\n }\n );\n return () => quantitiesUpdatedEvent?.off();\n }, [dictionary.successMessage]);\n\n // Listen for quote items removed event\n useEffect(() => {\n const itemsRemovedEvent = events.on(\n 'quote-management/quote-items-removed',\n (data: { quote: NegotiableQuoteModel }) => {\n setQuoteData(data.quote);\n setItemsToRemove([]);\n setIsRemoving(false);\n setRemoveNotificationState({\n type: 'success',\n message: dictionary.removeSuccessMessage,\n });\n // Auto-close success notification after 3 seconds\n setTimeout(() => {\n setIsRemoveModalOpen(false);\n setRemoveNotificationState({ type: null, message: '' });\n onRemoveModalStateChange?.(false);\n }, NOTIFICATION_AUTO_DISMISS_DELAY);\n }\n );\n return () => itemsRemovedEvent?.off();\n }, [dictionary.removeSuccessMessage, onRemoveModalStateChange]);\n\n // Unified handler for removing items (single or multiple)\n const handleRemoveItems = useCallback((items: NegotiableQuoteCartItem[]) => {\n if (!items || items.length === 0) {\n return;\n }\n setItemsToRemove(items);\n setRemoveNotificationState({ type: null, message: '' });\n setIsRemoveModalOpen(true);\n }, []);\n\n // Expose handler to parent component\n useEffect(() => {\n onRemoveItemsRef?.(handleRemoveItems);\n }, [handleRemoveItems, onRemoveItemsRef]);\n\n const handleDismissRemoveBanner = () => {\n setRemoveNotificationState({ type: null, message: '' });\n };\n\n const handleItemDropdownChangeInternal = (\n item: NegotiableQuoteCartItem,\n action: string\n ) => {\n if (action === 'remove') {\n setDropdownSelections((prev) => ({\n ...prev,\n [item.uid]: action,\n }));\n handleRemoveItems([item]); // Use unified handler\n onItemDropdownChange?.(item, action);\n return;\n }\n\n onItemDropdownChange?.(item, action);\n\n setDropdownSelections((prev) => {\n if (!(item.uid in prev)) {\n return prev;\n }\n const next = { ...prev };\n delete next[item.uid];\n return next;\n });\n };\n\n const handleConfirmRemove = async () => {\n /* istanbul ignore next */\n if (!quoteData || itemsToRemove.length === 0) {\n return;\n }\n\n const uidsToRemove = itemsToRemove.map((item) => item.uid);\n\n setIsRemoving(true);\n setRemoveNotificationState({ type: null, message: '' });\n\n try {\n await removeNegotiableQuoteItems({\n quoteUid: quoteData.uid,\n quoteItemUids: uidsToRemove,\n });\n // Success is handled by the event listener\n } catch (err) {\n const errorMessage =\n /* istanbul ignore next */\n err instanceof Error ? err.message : dictionary.removeErrorMessage;\n setRemoveNotificationState({\n type: 'error',\n message: errorMessage,\n });\n // Clear dropdown selections for failed items (single item only)\n /* istanbul ignore next */ // UI-driven state; covered by tests but line sometimes mis-attributed in source maps\n if (itemsToRemove.length === 1) {\n const failedItem = itemsToRemove[0];\n setDropdownSelections((prev) => {\n if (!(failedItem.uid in prev)) {\n return prev;\n }\n const next = { ...prev };\n delete next[failedItem.uid];\n return next;\n });\n }\n setIsRemoving(false);\n }\n };\n\n const handleCancelRemove = () => {\n setIsRemoveModalOpen(false);\n setRemoveNotificationState({ type: null, message: '' });\n onRemoveModalStateChange?.(false);\n // Clear dropdown selections for single item cancellation\n /* istanbul ignore next */ // UI-driven state; covered by tests but line sometimes mis-attributed in source maps\n if (itemsToRemove.length === 1) {\n const cancelledItem = itemsToRemove[0];\n setDropdownSelections((prev) => {\n if (!(cancelledItem.uid in prev)) {\n return prev;\n }\n const next = { ...prev };\n delete next[cancelledItem.uid];\n return next;\n });\n }\n setItemsToRemove([]);\n };\n\n if (!quoteData) {\n return <ItemsQuotedComponent loading={true} />;\n }\n\n const canEdit = Boolean(quoteData.canUpdateQuote);\n\n const handleQuantityChange = (\n item: NegotiableQuoteCartItem,\n newQuantity: number\n ) => {\n setQuantityChanges((prev) => ({\n ...prev,\n [item.uid]: newQuantity,\n }));\n };\n\n const handleUpdate = (e: SubmitEvent) => {\n e.preventDefault();\n setNotificationState({ type: null, message: '' });\n setIsModalOpen(true);\n };\n\n const handleConfirmUpdate = async () => {\n /* istanbul ignore next */\n if (!quoteData) {\n return;\n }\n\n if (Object.keys(quantityChanges).length === 0) {\n setIsModalOpen(false);\n return;\n }\n\n // Clear any previous notifications\n setNotificationState({ type: null, message: '' });\n\n const items = Object.entries(quantityChanges).map(\n ([quoteItemUid, quantity]) => ({\n quoteItemUid,\n quantity,\n })\n );\n\n try {\n await updateQuantities({\n quoteUid: quoteData.uid,\n items,\n });\n // Success is handled by the event listener\n } catch (err) {\n const errorMessage =\n /* istanbul ignore next */\n err instanceof Error ? err.message : dictionary.errorMessage;\n setNotificationState({\n type: 'error',\n message: errorMessage,\n });\n console.error('Failed to update quantities:', err);\n }\n };\n\n const handleCancelUpdate = () => {\n setIsModalOpen(false);\n setNotificationState({ type: null, message: '' });\n };\n\n const handleDismissBanner = () => {\n setNotificationState({ type: null, message: '' });\n };\n\n const quotePricesSummaryEntries = [];\n\n quoteData.prices.subtotalExcludingTax &&\n quotePricesSummaryEntries.push({\n label: dictionary.subtotal,\n id: 'subtotal',\n value: (\n <Price\n amount={quoteData.prices.subtotalExcludingTax.value}\n currency={quoteData.prices.subtotalExcludingTax.currency}\n weight=\"normal\"\n />\n ),\n });\n\n quoteData.prices.grandTotal &&\n quotePricesSummaryEntries.push({\n label: dictionary.grandTotal,\n id: 'total',\n value: (\n <Price\n amount={quoteData.prices.grandTotal.value}\n currency={quoteData.prices.grandTotal.currency}\n />\n ),\n strong: true,\n });\n\n // Create confirmation banner based on notification state\n const confirmationBanner =\n notificationState.type === 'success' ? (\n <InLineAlert\n type=\"success\"\n variant=\"primary\"\n icon={<CheckWithCircle />}\n heading={dictionary.successHeading}\n description={notificationState.message}\n onDismiss={handleDismissBanner}\n data-testid=\"update-quantities-success-banner\"\n />\n ) : notificationState.type === 'error' ? (\n <InLineAlert\n type=\"error\"\n variant=\"primary\"\n icon={<WarningFilled />}\n heading={dictionary.errorHeading}\n description={notificationState.message}\n onDismiss={handleDismissBanner}\n data-testid=\"update-quantities-error-banner\"\n />\n ) : null;\n\n // Create remove confirmation banner based on notification state\n const removeConfirmationBanner =\n removeNotificationState.type === 'success' ? (\n <InLineAlert\n type=\"success\"\n variant=\"primary\"\n icon={<CheckWithCircle />}\n heading={dictionary.removeSuccessHeading}\n description={removeNotificationState.message}\n onDismiss={handleDismissRemoveBanner}\n data-testid=\"remove-items-success-banner\"\n />\n ) : removeNotificationState.type === 'error' ? (\n <InLineAlert\n type=\"error\"\n variant=\"primary\"\n icon={<WarningFilled />}\n heading={dictionary.removeErrorHeading}\n description={removeNotificationState.message}\n onDismiss={handleDismissRemoveBanner}\n data-testid=\"remove-items-error-banner\"\n />\n ) : null;\n\n return (\n <>\n <ItemsQuotedComponent\n data-testid=\"items-quoted-container\"\n {...props}\n loading={false}\n table={\n <Slot\n name=\"ProductListTable\"\n slot={slots?.ProductListTable}\n context={{\n items: quoteData.items,\n canEdit,\n readOnly: quoteData.readOnly,\n onItemCheckboxChange,\n onItemDropdownChange: handleItemDropdownChangeInternal,\n onQuantityChange: handleQuantityChange,\n onUpdate,\n dropdownSelections,\n }}\n >\n <ProductListTable\n items={quoteData.items}\n canEdit={canEdit}\n readOnly={quoteData.readOnly}\n onItemCheckboxChange={onItemCheckboxChange}\n onItemDropdownChange={handleItemDropdownChangeInternal}\n onQuantityChange={handleQuantityChange}\n onUpdate={handleUpdate}\n dropdownSelections={dropdownSelections}\n />\n </Slot>\n }\n pricesSummary={\n <Slot\n name=\"QuotePricesSummary\"\n slot={slots?.QuotePricesSummary}\n context={{\n items: quoteData.items,\n prices: quoteData.prices,\n }}\n >\n <QuotePricesSummary entries={quotePricesSummaryEntries} />\n </Slot>\n }\n />\n\n {/* Update Quantities Modal */}\n <ConfirmationModal\n open={isModalOpen}\n title={dictionary.modalTitle}\n message={dictionary.modalDescription}\n cancelLabel={dictionary.modalCancelButton}\n confirmLabel={dictionary.modalUpdateButton}\n onCancel={handleCancelUpdate}\n onConfirm={handleConfirmUpdate}\n confirmationBanner={confirmationBanner}\n data-testid=\"update-quantities-modal\"\n />\n\n {/* Remove Items Modal */}\n <ConfirmationModal\n open={isRemoveModalOpen}\n title={dictionary.removeModalTitle}\n message={dictionary.removeModalDescription}\n cancelLabel={dictionary.removeModalCancelButton}\n confirmLabel={\n isRemoving\n ? dictionary.removeModalConfirmButtonRemoving\n : dictionary.removeModalConfirmButton\n }\n onCancel={handleCancelRemove}\n onConfirm={handleConfirmRemove}\n confirmationBanner={removeConfirmationBanner}\n data-testid=\"remove-items-modal\"\n />\n </>\n );\n};\n"],"names":["ItemsQuoted","className","loading","table","pricesSummary","props","ItemsQuotedSkeleton","jsxs","classes","jsx","VComponent","Skeleton","SkeletonRow","ProductListTable","items","canEdit","readOnly","onItemCheckboxChange","onItemDropdownChange","onQuantityChange","onUpdate","dropdownSelections","originalQuantities","setOriginalQuantities","useState","currentQuantities","setCurrentQuantities","useEffect","quantities","item","hasQuantityChanges","uid","dictionary","useText","columns","handleItemCheckboxChange","event","isSelected","handleItemDropdownChange","action","handleQuantityChange","newQuantity","prev","handleUpdate","discountElement","amountOff","percentOff","Price","getProductNameContent","configurableOptions","_a","option","bundleOptions","_b","value","rowData","quantityElement","Input","e","Checkbox","Picker","Table","wrapperNode","h","wrapperProps","submitButton","Button","QuotePricesSummary","entries","createEntry","entry","children","Accordion","AccordionSection","Fragment","ConfirmationModal","open","title","message","cancelLabel","confirmLabel","onCancel","onConfirm","onClose","showCloseButton","confirmationBanner","restProps","Modal","NOTIFICATION_AUTO_DISMISS_DELAY","initialData","onRemoveItemsRef","onRemoveModalStateChange","slots","quoteData","setQuoteData","quantityChanges","setQuantityChanges","isModalOpen","setIsModalOpen","notificationState","setNotificationState","isRemoveModalOpen","setIsRemoveModalOpen","itemsToRemove","setItemsToRemove","isRemoving","setIsRemoving","removeNotificationState","setRemoveNotificationState","setDropdownSelections","quoteDataEvent","events","data","quantitiesUpdatedEvent","itemsRemovedEvent","handleRemoveItems","useCallback","handleDismissRemoveBanner","handleItemDropdownChangeInternal","next","handleConfirmRemove","uidsToRemove","removeNegotiableQuoteItems","err","errorMessage","failedItem","handleCancelRemove","cancelledItem","ItemsQuotedComponent","handleConfirmUpdate","quoteItemUid","quantity","updateQuantities","handleCancelUpdate","handleDismissBanner","quotePricesSummaryEntries","InLineAlert","CheckWithCircle","WarningFilled","removeConfirmationBanner","Slot"],"mappings":"g0BAqBO,MAAMA,GAAmD,CAAC,CAC/D,UAAAC,EACA,QAAAC,EACA,MAAAC,EACA,cAAAC,EACA,GAAGC,CACL,IACMH,IACMI,GAAA,EAAoB,EAI5BC,EAAC,MAAA,CAAI,UAAWC,EAAQ,CAAC,gCAAiCP,CAAS,CAAC,EAAI,GAAGI,EACxE,SAAA,CAAAF,GACCM,EAACC,EAAA,CACC,KAAMP,EACN,UAAWK,EA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B,iBAAkB9E,EAClB,SAAApB,EACA,mBAAAC,CAAA,EAGF,SAAAZ,EAACI,GAAA,CACC,MAAOgF,EAAU,MACjB,QAAA9E,EACA,SAAU8E,EAAU,SACpB,qBAAA5E,EACA,qBAAsBqG,EACtB,iBAAkB9E,EAClB,SAAUG,EACV,mBAAAtB,CAAA,CAAA,CACF,CAAA,EAGJ,cACEZ,EAACmI,GAAA,CACC,KAAK,qBACL,KAAMhD,GAAA,YAAAA,EAAO,mBACb,QAAS,CACP,MAAOC,EAAU,MACjB,OAAQA,EAAU,MAAA,EAGpB,SAAApF,EAAC0D,GAAA,CAAmB,QAASoE,CAAA,CAA2B,CAAA,CAAA,CAC1D,CAAA,EAKJ9H,EAACkE,GAAA,CACC,KAAMsB,EACN,MAAOjE,EAAW,WAClB,QAASA,EAAW,iBACpB,YAAaA,EAAW,kBACxB,aAAcA,EAAW,kBACzB,SAAUqG,GACV,UAAWJ,GACX,mBAAA5C,GACA,cAAY,yBAAA,CAAA,EAId5E,EAACkE,GAAA,CACC,KAAM0B,EACN,MAAOrE,EAAW,iBAClB,QAASA,EAAW,uBACpB,YAAaA,EAAW,wBACxB,aACEyE,EACIzE,EAAW,iCACXA,EAAW,yBAEjB,SAAU8F,EACV,UAAWN,EACX,mBAAoBmB,GACpB,cAAY,oBAAA,CAAA,CACd,EACF,CAEJ"}
|
|
1
|
+
{"version":3,"file":"ItemsQuoted.js","sources":["/@dropins/storefront-quote-management/src/components/ConfirmationModal/ConfirmationModal.tsx","/@dropins/storefront-quote-management/src/containers/ItemsQuoted/ItemsQuoted.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 { Button, Modal } from '@adobe-commerce/elsie/components';\nimport { useText } from '@adobe-commerce/elsie/i18n';\nimport '@/quote-management/components/ConfirmationModal/ConfirmationModal.css';\n\nexport interface ConfirmationModalProps\n extends Omit<HTMLAttributes<HTMLDivElement>, 'title'> {\n open?: boolean;\n title?: VNode | string;\n message?: VNode | string;\n cancelLabel?: VNode | string;\n confirmLabel?: VNode | string;\n onCancel?: () => void;\n onConfirm?: () => void;\n onClose?: () => void;\n showCloseButton?: boolean;\n confirmationBanner?: VNode | null;\n}\n\nexport const ConfirmationModal: FunctionComponent<ConfirmationModalProps> = ({\n open = false,\n title,\n message,\n cancelLabel,\n confirmLabel,\n onCancel,\n onConfirm,\n onClose,\n showCloseButton,\n confirmationBanner,\n ...props\n}) => {\n const dictionary = useText({\n cancel: 'ConfirmationModal.cancel',\n confirm: 'ConfirmationModal.confirm',\n });\n\n if (!open) {\n return null;\n }\n\n const { className, ...restProps } = props;\n\n return (\n <Modal\n {...restProps}\n size={'medium'}\n onClose={onClose || onCancel}\n clickToDismiss={true}\n escapeToDismiss={true}\n showCloseButton={showCloseButton}\n data-testid=\"confirmation-modal\"\n className={className}\n >\n <div className=\"confirmation-modal__content\">\n {confirmationBanner && (\n <div\n className=\"confirmation-modal__banner\"\n data-testid=\"confirmation-modal-banner\"\n >\n {confirmationBanner}\n </div>\n )}\n {title && (\n <div\n className=\"confirmation-modal__title\"\n data-testid=\"confirmation-modal-title\"\n >\n {title}\n </div>\n )}\n {message && (\n <div\n className=\"confirmation-modal__message\"\n data-testid=\"confirmation-modal-message\"\n >\n {message}\n </div>\n )}\n <div\n className=\"confirmation-modal__actions\"\n data-testid=\"confirmation-modal-actions\"\n >\n {onCancel && (\n <Button\n variant=\"secondary\"\n onClick={onCancel}\n data-testid=\"confirmation-modal-cancel\"\n >\n {cancelLabel ?? dictionary.cancel}\n </Button>\n )}\n <Button\n variant=\"primary\"\n onClick={onConfirm}\n data-testid=\"confirmation-modal-confirm\"\n >\n {confirmLabel ?? dictionary.confirm}\n </Button>\n </div>\n </div>\n </Modal>\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 useState,\n} from 'preact/compat';\nimport { Container, Slot, SlotProps } from '@adobe-commerce/elsie/lib';\nimport { events } from '@adobe-commerce/event-bus';\nimport { Price, InLineAlert } from '@adobe-commerce/elsie/components';\nimport { useText } from '@adobe-commerce/elsie/i18n';\nimport { NegotiableQuoteModel, NegotiableQuoteCartItem } from '@/quote-management/data/models/negotiable-quote-model';\nimport { ProductListTable, ProductListTableItem, QuotePricesSummary, ItemsQuoted as ItemsQuotedComponent } from '@/quote-management/components';\nimport { CheckWithCircle, WarningFilled } from '@adobe-commerce/elsie/icons';\nimport { ConfirmationModal } from '@/quote-management/components/ConfirmationModal';\nimport { updateQuantities } from '@/quote-management/api/updateQuantities';\nimport { removeNegotiableQuoteItems } from '@/quote-management/api/removeNegotiableQuoteItems';\n\nconst NOTIFICATION_AUTO_DISMISS_DELAY = 3000;\n\nexport interface ItemsQuotedProps extends HTMLAttributes<HTMLDivElement> {\n quoteData?: NegotiableQuoteModel;\n onItemCheckboxChange?: (\n item: NegotiableQuoteCartItem,\n isSelected: boolean\n ) => void;\n onItemDropdownChange?: (\n item: NegotiableQuoteCartItem,\n action: string\n ) => void;\n onUpdate?: (e: SubmitEvent) => void;\n onRemoveItemsRef?: (\n handler: (items: NegotiableQuoteCartItem[]) => void\n ) => void;\n onRemoveModalStateChange?: (isOpen: boolean) => void;\n slots?: {\n ProductListTable?: SlotProps<{\n items: NegotiableQuoteModel['items'];\n canEdit: boolean;\n readOnly?: boolean;\n onItemCheckboxChange?: (\n item: NegotiableQuoteCartItem,\n isSelected: boolean\n ) => void;\n onItemDropdownChange?: (\n item: NegotiableQuoteCartItem,\n action: string\n ) => void;\n onQuantityChange?: (\n item: NegotiableQuoteCartItem,\n newQuantity: number\n ) => void;\n onUpdate?: (e: SubmitEvent) => void;\n dropdownSelections?: Record<string, string>;\n }>;\n QuotePricesSummary?: SlotProps<{\n items: NegotiableQuoteModel['items'];\n prices: NegotiableQuoteModel['prices'];\n }>;\n };\n}\n\nexport const ItemsQuoted: Container<ItemsQuotedProps> = ({\n quoteData: initialData,\n onItemCheckboxChange,\n onItemDropdownChange,\n onUpdate,\n onRemoveItemsRef,\n onRemoveModalStateChange,\n slots,\n ...props\n}) => {\n const [quoteData, setQuoteData] = useState<NegotiableQuoteModel | undefined>(\n initialData\n );\n const [quantityChanges, setQuantityChanges] = useState<{\n [itemUid: string]: number;\n }>({});\n const [isModalOpen, setIsModalOpen] = useState(false);\n const [notificationState, setNotificationState] = useState<{\n type: 'success' | 'error' | null;\n message: string;\n }>({ type: null, message: '' });\n // State for remove items functionality\n const [isRemoveModalOpen, setIsRemoveModalOpen] = useState(false);\n const [itemsToRemove, setItemsToRemove] = useState<NegotiableQuoteCartItem[]>(\n []\n );\n const [isRemoving, setIsRemoving] = useState(false);\n const [removeNotificationState, setRemoveNotificationState] = useState<{\n type: 'success' | 'error' | null;\n message: string;\n }>({ type: null, message: '' });\n const [dropdownSelections, setDropdownSelections] = useState<\n Record<string, string>\n >({});\n\n const dictionary = useText({\n subtotal: 'NegotiableQuote.Manage.quotePricesSummary.subtotal.excludingTax',\n grandTotal:\n 'NegotiableQuote.Manage.quotePricesSummary.grandTotal.includingTax',\n appliedTaxes: 'NegotiableQuote.Manage.quotePricesSummary.appliedTaxes',\n modalTitle: 'NegotiableQuote.Manage.updateQuantitiesModal.title',\n modalDescription:\n 'NegotiableQuote.Manage.updateQuantitiesModal.description',\n modalCancelButton:\n 'NegotiableQuote.Manage.updateQuantitiesModal.cancelButton',\n modalUpdateButton:\n 'NegotiableQuote.Manage.updateQuantitiesModal.updateButton',\n successHeading:\n 'NegotiableQuote.Manage.updateQuantitiesModal.successHeading',\n successMessage:\n 'NegotiableQuote.Manage.updateQuantitiesModal.successMessage',\n errorHeading: 'NegotiableQuote.Manage.updateQuantitiesModal.errorHeading',\n errorMessage: 'NegotiableQuote.Manage.updateQuantitiesModal.errorMessage',\n removeModalTitle: 'NegotiableQuote.Manage.removeItemsModal.title',\n removeModalDescription:\n 'NegotiableQuote.Manage.removeItemsModal.description',\n removeModalCancelButton:\n 'NegotiableQuote.Manage.removeItemsModal.cancelButton',\n removeModalConfirmButton:\n 'NegotiableQuote.Manage.removeItemsModal.confirmButton',\n removeModalConfirmButtonRemoving:\n 'NegotiableQuote.Manage.removeItemsModal.confirmButtonRemoving',\n removeSuccessHeading:\n 'NegotiableQuote.Manage.removeItemsModal.successHeading',\n removeSuccessMessage:\n 'NegotiableQuote.Manage.removeItemsModal.successMessage',\n removeErrorHeading: 'NegotiableQuote.Manage.removeItemsModal.errorHeading',\n removeErrorMessage: 'NegotiableQuote.Manage.removeItemsModal.errorMessage',\n });\n\n useEffect(() => {\n const quoteDataEvent = events.on(\n 'quote-management/quote-data',\n\n (data: { quote: NegotiableQuoteModel }) => {\n setQuoteData(data.quote);\n setQuantityChanges({});\n setNotificationState({ type: null, message: '' });\n setDropdownSelections({});\n },\n\n {\n eager: true,\n }\n );\n return () => quoteDataEvent?.off();\n }, []);\n\n useEffect(() => {\n const quantitiesUpdatedEvent = events.on(\n 'quote-management/quantities-updated',\n (data: { quote: NegotiableQuoteModel }) => {\n setQuoteData(data.quote);\n setQuantityChanges({});\n setNotificationState({\n type: 'success',\n message: dictionary.successMessage,\n });\n // Auto-close success notification after 3 seconds\n setTimeout(() => {\n setIsModalOpen(false);\n setNotificationState({ type: null, message: '' });\n }, 3000);\n }\n );\n return () => quantitiesUpdatedEvent?.off();\n }, [dictionary.successMessage]);\n\n // Listen for quote items removed event\n useEffect(() => {\n const itemsRemovedEvent = events.on(\n 'quote-management/quote-items-removed',\n (data: { quote: NegotiableQuoteModel }) => {\n setQuoteData(data.quote);\n setItemsToRemove([]);\n setIsRemoving(false);\n setRemoveNotificationState({\n type: 'success',\n message: dictionary.removeSuccessMessage,\n });\n // Auto-close success notification after 3 seconds\n setTimeout(() => {\n setIsRemoveModalOpen(false);\n setRemoveNotificationState({ type: null, message: '' });\n onRemoveModalStateChange?.(false);\n }, NOTIFICATION_AUTO_DISMISS_DELAY);\n }\n );\n return () => itemsRemovedEvent?.off();\n }, [dictionary.removeSuccessMessage, onRemoveModalStateChange]);\n\n // Unified handler for removing items (single or multiple)\n const handleRemoveItems = useCallback((items: NegotiableQuoteCartItem[]) => {\n if (!items || items.length === 0) {\n return;\n }\n setItemsToRemove(items);\n setRemoveNotificationState({ type: null, message: '' });\n setIsRemoveModalOpen(true);\n }, []);\n\n // Expose handler to parent component\n useEffect(() => {\n onRemoveItemsRef?.(handleRemoveItems);\n }, [handleRemoveItems, onRemoveItemsRef]);\n\n const handleDismissRemoveBanner = () => {\n setRemoveNotificationState({ type: null, message: '' });\n };\n\n const handleItemDropdownChange = (\n item: ProductListTableItem,\n action: string\n ) => {\n const cartItem = item as NegotiableQuoteCartItem;\n if (action === 'remove') {\n setDropdownSelections((prev) => ({\n ...prev,\n [cartItem.uid]: action,\n }));\n handleRemoveItems([cartItem]); // Use unified handler\n onItemDropdownChange?.(cartItem, action);\n return;\n }\n\n onItemDropdownChange?.(cartItem, action);\n\n setDropdownSelections((prev) => {\n if (!(cartItem.uid in prev)) {\n return prev;\n }\n const next = { ...prev };\n delete next[cartItem.uid];\n return next;\n });\n };\n\n const handleConfirmRemove = async () => {\n /* istanbul ignore next */\n if (!quoteData || itemsToRemove.length === 0) {\n return;\n }\n\n const uidsToRemove = itemsToRemove.map((item) => item.uid);\n\n setIsRemoving(true);\n setRemoveNotificationState({ type: null, message: '' });\n\n try {\n await removeNegotiableQuoteItems({\n quoteUid: quoteData.uid,\n quoteItemUids: uidsToRemove,\n });\n // Success is handled by the event listener\n } catch (err) {\n const errorMessage =\n /* istanbul ignore next */\n err instanceof Error ? err.message : dictionary.removeErrorMessage;\n setRemoveNotificationState({\n type: 'error',\n message: errorMessage,\n });\n // Clear dropdown selections for failed items (single item only)\n /* istanbul ignore next */ // UI-driven state; covered by tests but line sometimes mis-attributed in source maps\n if (itemsToRemove.length === 1) {\n const failedItem = itemsToRemove[0];\n setDropdownSelections((prev) => {\n if (!(failedItem.uid in prev)) {\n return prev;\n }\n const next = { ...prev };\n delete next[failedItem.uid];\n return next;\n });\n }\n setIsRemoving(false);\n }\n };\n\n const handleCancelRemove = () => {\n setIsRemoveModalOpen(false);\n setRemoveNotificationState({ type: null, message: '' });\n onRemoveModalStateChange?.(false);\n // Clear dropdown selections for single item cancellation\n /* istanbul ignore next */ // UI-driven state; covered by tests but line sometimes mis-attributed in source maps\n if (itemsToRemove.length === 1) {\n const cancelledItem = itemsToRemove[0];\n setDropdownSelections((prev) => {\n if (!(cancelledItem.uid in prev)) {\n return prev;\n }\n const next = { ...prev };\n delete next[cancelledItem.uid];\n return next;\n });\n }\n setItemsToRemove([]);\n };\n\n if (!quoteData) {\n return <ItemsQuotedComponent loading={true} />;\n }\n\n const canEdit = Boolean(quoteData.canUpdateQuote);\n\n const handleQuantityChange = (\n item: ProductListTableItem,\n newQuantity: number\n ) => {\n setQuantityChanges((prev) => ({\n ...prev,\n [(item as NegotiableQuoteCartItem).uid]: newQuantity,\n }));\n };\n\n const handleUpdate = (e: SubmitEvent) => {\n e.preventDefault();\n setNotificationState({ type: null, message: '' });\n setIsModalOpen(true);\n };\n\n const handleConfirmUpdate = async () => {\n /* istanbul ignore next */\n if (!quoteData) {\n return;\n }\n\n if (Object.keys(quantityChanges).length === 0) {\n setIsModalOpen(false);\n return;\n }\n\n // Clear any previous notifications\n setNotificationState({ type: null, message: '' });\n\n const items = Object.entries(quantityChanges).map(\n ([quoteItemUid, quantity]) => ({\n quoteItemUid,\n quantity,\n })\n );\n\n try {\n await updateQuantities({\n quoteUid: quoteData.uid,\n items,\n });\n // Success is handled by the event listener\n } catch (err) {\n const errorMessage =\n /* istanbul ignore next */\n err instanceof Error ? err.message : dictionary.errorMessage;\n setNotificationState({\n type: 'error',\n message: errorMessage,\n });\n console.error('Failed to update quantities:', err);\n }\n };\n\n const handleCancelUpdate = () => {\n setIsModalOpen(false);\n setNotificationState({ type: null, message: '' });\n };\n\n const handleDismissBanner = () => {\n setNotificationState({ type: null, message: '' });\n };\n\n const quotePricesSummaryEntries = [];\n\n quoteData.prices.subtotalExcludingTax &&\n quotePricesSummaryEntries.push({\n label: dictionary.subtotal,\n id: 'subtotal',\n value: (\n <Price\n amount={quoteData.prices.subtotalExcludingTax.value}\n currency={quoteData.prices.subtotalExcludingTax.currency}\n weight=\"normal\"\n />\n ),\n });\n\n quoteData.prices.grandTotal &&\n quotePricesSummaryEntries.push({\n label: dictionary.grandTotal,\n id: 'total',\n value: (\n <Price\n amount={quoteData.prices.grandTotal.value}\n currency={quoteData.prices.grandTotal.currency}\n />\n ),\n strong: true,\n });\n\n // Create confirmation banner based on notification state\n const confirmationBanner =\n notificationState.type === 'success' ? (\n <InLineAlert\n type=\"success\"\n variant=\"primary\"\n icon={<CheckWithCircle />}\n heading={dictionary.successHeading}\n description={notificationState.message}\n onDismiss={handleDismissBanner}\n data-testid=\"update-quantities-success-banner\"\n />\n ) : notificationState.type === 'error' ? (\n <InLineAlert\n type=\"error\"\n variant=\"primary\"\n icon={<WarningFilled />}\n heading={dictionary.errorHeading}\n description={notificationState.message}\n onDismiss={handleDismissBanner}\n data-testid=\"update-quantities-error-banner\"\n />\n ) : null;\n\n // Create wrapper that converts ProductListTableItem back to NegotiableQuoteCartItem\n const handleItemCheckboxChange = onItemCheckboxChange\n ? (item: ProductListTableItem, isSelected: boolean) => {\n onItemCheckboxChange(item as NegotiableQuoteCartItem, isSelected);\n }\n : undefined;\n\n // Create remove confirmation banner based on notification state\n const removeConfirmationBanner =\n removeNotificationState.type === 'success' ? (\n <InLineAlert\n type=\"success\"\n variant=\"primary\"\n icon={<CheckWithCircle />}\n heading={dictionary.removeSuccessHeading}\n description={removeNotificationState.message}\n onDismiss={handleDismissRemoveBanner}\n data-testid=\"remove-items-success-banner\"\n />\n ) : removeNotificationState.type === 'error' ? (\n <InLineAlert\n type=\"error\"\n variant=\"primary\"\n icon={<WarningFilled />}\n heading={dictionary.removeErrorHeading}\n description={removeNotificationState.message}\n onDismiss={handleDismissRemoveBanner}\n data-testid=\"remove-items-error-banner\"\n />\n ) : null;\n\n return (\n <>\n <ItemsQuotedComponent\n data-testid=\"items-quoted-container\"\n {...props}\n loading={false}\n table={\n <Slot\n name=\"ProductListTable\"\n slot={slots?.ProductListTable}\n context={{\n items: quoteData.items,\n canEdit,\n readOnly: quoteData.readOnly,\n onItemCheckboxChange,\n onItemDropdownChange: handleItemDropdownChange,\n onQuantityChange: handleQuantityChange,\n onUpdate,\n dropdownSelections,\n }}\n >\n <ProductListTable\n items={quoteData.items}\n canEdit={canEdit}\n onItemCheckboxChange={handleItemCheckboxChange}\n readOnly={quoteData.readOnly}\n onItemDropdownChange={handleItemDropdownChange}\n onQuantityChange={handleQuantityChange}\n onUpdate={handleUpdate}\n dropdownSelections={dropdownSelections}\n />\n </Slot>\n }\n pricesSummary={\n <Slot\n name=\"QuotePricesSummary\"\n slot={slots?.QuotePricesSummary}\n context={{\n items: quoteData.items,\n prices: quoteData.prices,\n }}\n >\n <QuotePricesSummary entries={quotePricesSummaryEntries} />\n </Slot>\n }\n />\n\n {/* Update Quantities Modal */}\n <ConfirmationModal\n open={isModalOpen}\n title={dictionary.modalTitle}\n message={dictionary.modalDescription}\n cancelLabel={dictionary.modalCancelButton}\n confirmLabel={dictionary.modalUpdateButton}\n onCancel={handleCancelUpdate}\n onConfirm={handleConfirmUpdate}\n confirmationBanner={confirmationBanner}\n data-testid=\"update-quantities-modal\"\n />\n\n {/* Remove Items Modal */}\n <ConfirmationModal\n open={isRemoveModalOpen}\n title={dictionary.removeModalTitle}\n message={dictionary.removeModalDescription}\n cancelLabel={dictionary.removeModalCancelButton}\n confirmLabel={\n isRemoving\n ? dictionary.removeModalConfirmButtonRemoving\n : dictionary.removeModalConfirmButton\n }\n onCancel={handleCancelRemove}\n onConfirm={handleConfirmRemove}\n confirmationBanner={removeConfirmationBanner}\n data-testid=\"remove-items-modal\"\n />\n </>\n );\n};\n"],"names":["ConfirmationModal","open","title","message","cancelLabel","confirmLabel","onCancel","onConfirm","onClose","showCloseButton","confirmationBanner","props","dictionary","useText","className","restProps","jsx","Modal","jsxs","Button","NOTIFICATION_AUTO_DISMISS_DELAY","ItemsQuoted","initialData","onItemCheckboxChange","onItemDropdownChange","onUpdate","onRemoveItemsRef","onRemoveModalStateChange","slots","quoteData","setQuoteData","useState","quantityChanges","setQuantityChanges","isModalOpen","setIsModalOpen","notificationState","setNotificationState","isRemoveModalOpen","setIsRemoveModalOpen","itemsToRemove","setItemsToRemove","isRemoving","setIsRemoving","removeNotificationState","setRemoveNotificationState","dropdownSelections","setDropdownSelections","useEffect","quoteDataEvent","events","data","quantitiesUpdatedEvent","itemsRemovedEvent","handleRemoveItems","useCallback","items","handleDismissRemoveBanner","handleItemDropdownChange","item","action","cartItem","prev","next","handleConfirmRemove","uidsToRemove","removeNegotiableQuoteItems","err","errorMessage","failedItem","handleCancelRemove","cancelledItem","ItemsQuotedComponent","canEdit","handleQuantityChange","newQuantity","handleUpdate","handleConfirmUpdate","quoteItemUid","quantity","updateQuantities","handleCancelUpdate","handleDismissBanner","quotePricesSummaryEntries","Price","InLineAlert","CheckWithCircle","WarningFilled","handleItemCheckboxChange","isSelected","removeConfirmationBanner","Fragment","Slot","ProductListTable","QuotePricesSummary"],"mappings":"ytBA6BO,MAAMA,EAA+D,CAAC,CAC3E,KAAAC,EAAO,GACP,MAAAC,EACA,QAAAC,EACA,YAAAC,EACA,aAAAC,EACA,SAAAC,EACA,UAAAC,EACA,QAAAC,EACA,gBAAAC,EACA,mBAAAC,EACA,GAAGC,CACL,IAAM,CACJ,MAAMC,EAAaC,EAAQ,CACzB,OAAQ,2BACR,QAAS,2BAAA,CACV,EAED,GAAI,CAACZ,EACH,OAAO,KAGT,KAAM,CAAE,UAAAa,EAAW,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CACC,KAAK,qBACL,KAAMhE,GAAA,YAAAA,EAAO,mBACb,QAAS,CACP,MAAOC,EAAU,MACjB,OAAQA,EAAU,MAAA,EAGpB,SAAAb,EAAC8E,GAAA,CAAmB,QAASX,CAAA,CAA2B,CAAA,CAAA,CAC1D,CAAA,EAKJnE,EAAChB,EAAA,CACC,KAAMkC,EACN,MAAOtB,EAAW,WAClB,QAASA,EAAW,iBACpB,YAAaA,EAAW,kBACxB,aAAcA,EAAW,kBACzB,SAAUqE,GACV,UAAWJ,GACX,mBAAAnE,GACA,cAAY,yBAAA,CAAA,EAIdM,EAAChB,EAAA,CACC,KAAMsC,EACN,MAAO1B,EAAW,iBAClB,QAASA,EAAW,uBACpB,YAAaA,EAAW,wBACxB,aACE8B,EACI9B,EAAW,iCACXA,EAAW,yBAEjB,SAAU0D,GACV,UAAWN,GACX,mBAAoB0B,GACpB,cAAY,oBAAA,CAAA,CACd,EACF,CAEJ"}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
/*! Copyright 2025 Adobe
|
|
2
|
+
All Rights Reserved. */
|
|
3
|
+
import{jsx as t}from"@dropins/tools/preact-jsx-runtime.js";import{useState as d,useEffect as g}from"@dropins/tools/preact-compat.js";import{Slot as u}from"@dropins/tools/lib.js";import{events as T}from"@dropins/tools/event-bus.js";import{Price as m}from"@dropins/tools/components.js";/* empty css */import{I as n,Q as b,P as x}from"./QuotePricesSummary.js";/* empty css *//* empty css *//* empty css */import{useText as f}from"@dropins/tools/i18n.js";const N=({templateData:c,slots:a,...l})=>{const[e,s]=d(c),i=f({subtotal:"NegotiableQuoteTemplate.Manage.quotePricesSummary.subtotal.excludingTax",grandTotal:"NegotiableQuoteTemplate.Manage.quotePricesSummary.grandTotal.includingTax",appliedTaxes:"NegotiableQuoteTemplate.Manage.quotePricesSummary.appliedTaxes"});if(g(()=>{const o=T.on("quote-management/quote-template-data",p=>{s(p.quoteTemplate)},{eager:!0});return()=>o==null?void 0:o.off()},[]),!e)return t(n,{loading:!0});const r=[];return e.prices.subtotalExcludingTax&&r.push({label:i.subtotal,id:"subtotal",value:t(m,{amount:e.prices.subtotalExcludingTax.value,currency:e.prices.subtotalExcludingTax.currency,weight:"normal"})}),e.prices.grandTotal&&r.push({label:i.grandTotal,id:"total",value:t(m,{amount:e.prices.grandTotal.value,currency:e.prices.grandTotal.currency}),strong:!0}),t(n,{"data-testid":"items-quoted-template-container",...l,loading:!1,table:t(u,{name:"ProductListTable",slot:a==null?void 0:a.ProductListTable,context:{items:e.items,canEdit:!1},children:t(x,{items:e.items,canEdit:!1})}),pricesSummary:t(u,{name:"QuotePricesSummary",slot:a==null?void 0:a.QuotePricesSummary,context:{items:e.items,prices:e.prices},children:t(b,{entries:r})})})};export{N as I};
|
|
4
|
+
//# sourceMappingURL=ItemsQuotedTemplate.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ItemsQuotedTemplate.js","sources":["/@dropins/storefront-quote-management/src/containers/ItemsQuotedTemplate/ItemsQuotedTemplate.tsx"],"sourcesContent":["/********************************************************************\n * Copyright 2025 Adobe\n * All Rights Reserved.\n *\n * NOTICE: Adobe permits you to use, modify, and distribute this \n * file in accordance with the terms of the Adobe license agreement \n * accompanying it. \n *******************************************************************/\n\nimport { HTMLAttributes, useEffect, useState } from 'preact/compat';\nimport { Container, Slot, SlotProps } from '@adobe-commerce/elsie/lib';\nimport { events } from '@adobe-commerce/event-bus';\nimport { Price } from '@adobe-commerce/elsie/components';\nimport { useText } from '@adobe-commerce/elsie/i18n';\nimport { NegotiableQuoteTemplateModel } from '@/quote-management/data/models/negotiable-quote-template-model';\nimport { QuotePricesSummary, ProductListTable, ItemsQuoted as ItemsQuotedComponent } from '@/quote-management/components';\n\nexport interface ItemsQuotedTemplateProps extends HTMLAttributes<HTMLDivElement> {\n templateData?: NegotiableQuoteTemplateModel;\n slots?: {\n ProductListTable?: SlotProps<{\n items: NegotiableQuoteTemplateModel['items'];\n canEdit: boolean;\n }>;\n QuotePricesSummary?: SlotProps<{\n items: NegotiableQuoteTemplateModel['items'];\n prices: NegotiableQuoteTemplateModel['prices'];\n }>;\n }\n}\n\nexport const ItemsQuotedTemplate: Container<ItemsQuotedTemplateProps> = ({\n templateData: initialData,\n slots,\n ...props\n}) => {\n const [templateData, setTemplateData] = useState<NegotiableQuoteTemplateModel | undefined>(initialData);\n\n const dictionary = useText({\n subtotal: 'NegotiableQuoteTemplate.Manage.quotePricesSummary.subtotal.excludingTax',\n grandTotal: 'NegotiableQuoteTemplate.Manage.quotePricesSummary.grandTotal.includingTax',\n appliedTaxes: 'NegotiableQuoteTemplate.Manage.quotePricesSummary.appliedTaxes',\n });\n\n useEffect(() => {\n const templateDataEvent = events.on('quote-management/quote-template-data', (payload) => {\n setTemplateData(payload.quoteTemplate);\n }, { eager: true });\n\n return () => templateDataEvent?.off();\n }, []);\n\n if (!templateData) {\n return <ItemsQuotedComponent loading={true} />;\n }\n\n const quotePricesSummaryEntries = [];\n\n templateData.prices.subtotalExcludingTax && quotePricesSummaryEntries.push({\n label: dictionary.subtotal,\n id: 'subtotal',\n value: <Price amount={templateData.prices.subtotalExcludingTax.value} currency={templateData.prices.subtotalExcludingTax.currency} weight='normal' />,\n });\n\n templateData.prices.grandTotal && quotePricesSummaryEntries.push({\n label: dictionary.grandTotal,\n id: 'total',\n value: <Price amount={templateData.prices.grandTotal.value} currency={templateData.prices.grandTotal.currency} />,\n strong: true,\n })\n\n return (\n <ItemsQuotedComponent data-testid=\"items-quoted-template-container\" {...props} loading={false}\n table={\n <Slot name=\"ProductListTable\" slot={slots?.ProductListTable}\n context={{\n items: templateData.items,\n canEdit: false,\n }}>\n\n <ProductListTable items={templateData.items} canEdit={false} />\n </Slot>\n }\n pricesSummary={<Slot name=\"QuotePricesSummary\" slot={slots?.QuotePricesSummary} context={{\n items: templateData.items,\n prices: templateData.prices,\n }}>\n <QuotePricesSummary entries={quotePricesSummaryEntries} />\n </Slot>\n }\n />\n );\n};\n"],"names":["ItemsQuotedTemplate","initialData","slots","props","templateData","setTemplateData","useState","dictionary","useText","useEffect","templateDataEvent","events","payload","jsx","ItemsQuotedComponent","quotePricesSummaryEntries","Price","Slot","ProductListTable","QuotePricesSummary"],"mappings":"whBA+BO,MAAMA,EAA2D,CAAC,CACvE,aAAcC,EACd,MAAAC,EACA,GAAGC,CACL,IAAM,CACJ,KAAM,CAACC,EAAcC,CAAe,EAAIC,EAAmDL,CAAW,EAEhGM,EAAaC,EAAQ,CACzB,SAAU,0EACV,WAAY,4EACZ,aAAc,gEAAA,CACf,EAUD,GARAC,EAAU,IAAM,CACd,MAAMC,EAAoBC,EAAO,GAAG,uCAAyCC,GAAY,CACvFP,EAAgBO,EAAQ,aAAa,CACvC,EAAG,CAAE,MAAO,GAAM,EAElB,MAAO,IAAMF,GAAA,YAAAA,EAAmB,KAClC,EAAG,CAAA,CAAE,EAED,CAACN,EACH,OAAOS,EAACC,EAAA,CAAqB,QAAS,EAAA,CAAM,EAG9C,MAAMC,EAA4B,CAAA,EAElC,OAAAX,EAAa,OAAO,sBAAwBW,EAA0B,KAAK,CACzE,MAAOR,EAAW,SAClB,GAAI,WACJ,MAAOM,EAACG,EAAA,CAAM,OAAQZ,EAAa,OAAO,qBAAqB,MAAO,SAAUA,EAAa,OAAO,qBAAqB,SAAU,OAAO,QAAA,CAAS,CAAA,CACpJ,EAEDA,EAAa,OAAO,YAAcW,EAA0B,KAAK,CAC/D,MAAOR,EAAW,WAClB,GAAI,QACJ,MAAOM,EAACG,EAAA,CAAM,OAAQZ,EAAa,OAAO,WAAW,MAAO,SAAUA,EAAa,OAAO,WAAW,QAAA,CAAU,EAC/G,OAAQ,EAAA,CACT,EAGCS,EAACC,EAAA,CAAqB,cAAY,kCAAmC,GAAGX,EAAO,QAAS,GACtF,MACEU,EAACI,EAAA,CAAK,KAAK,mBAAmB,KAAMf,GAAA,YAAAA,EAAO,iBACzC,QAAS,CACP,MAAOE,EAAa,MACpB,QAAS,EAAA,EAGX,WAACc,EAAA,CAAiB,MAAOd,EAAa,MAAO,QAAS,EAAA,CAAO,CAAA,CAAA,EAGjE,gBAAgBa,EAAA,CAAK,KAAK,qBAAqB,KAAMf,GAAA,YAAAA,EAAO,mBAAoB,QAAS,CACvF,MAAOE,EAAa,MACpB,OAAQA,EAAa,MAAA,EAErB,SAAAS,EAACM,EAAA,CAAmB,QAASJ,EAA2B,CAAA,CAC1D,CAAA,CAAA,CAIN"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
/*! Copyright 2025 Adobe
|
|
2
2
|
All Rights Reserved. */
|
|
3
|
-
import{jsx as i,jsxs as u}from"@dropins/tools/preact-jsx-runtime.js";import{classes as
|
|
3
|
+
import{jsx as i,jsxs as u}from"@dropins/tools/preact-jsx-runtime.js";import{classes as p,VComponent as _}from"@dropins/tools/lib.js";/* empty css */import"@dropins/tools/components.js";import"@dropins/tools/preact-compat.js";import"@dropins/tools/preact.js";import"@dropins/tools/preact-hooks.js";/* empty css *//* empty css *//* empty css */const g=({label:o,price:e,classSuffixes:t=[],labelClassSuffix:r,testId:m,children:s,...a})=>i(y,{...a,label:o,price:e,classSuffixes:t,labelClassSuffix:r,testId:m,children:s}),y=({label:o,price:e,classSuffixes:t=[],labelClassSuffix:r,testId:m,children:s,...a})=>{const n="quote-order-summary__label",c="quote-order-summary__price";return u("div",{...a,...m?{"data-testid":m}:{},className:p(["quote-order-summary__entry",...t.map(d=>`quote-order-summary__${d}`)]),children:[i("span",{className:p([n,...r?[`${n}--${r}`]:[]]),children:o}),i(_,{node:e,className:p([c,...r?[`${c}--${r}`]:[]])}),s]})};export{g as O};
|
|
4
4
|
//# sourceMappingURL=OrderSummaryLine.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"OrderSummaryLine.js","sources":["/@dropins/storefront-quote-management/src/containers/OrderSummaryLine/OrderSummaryLine.tsx","/@dropins/storefront-quote-management/src/components/OrderSummaryLine/OrderSummaryLine.tsx"],"sourcesContent":["/********************************************************************\n * Copyright 2025 Adobe\n * All Rights Reserved.\n *\n * NOTICE: Adobe permits you to use, modify, and distribute this\n * file in accordance with the terms of the Adobe license agreement\n * accompanying it.\n *******************************************************************/\n\nimport { HTMLAttributes } from 'preact/compat';\nimport { Container } from '@adobe-commerce/elsie/lib';\nimport { VNode } from 'preact';\nimport { OrderSummaryLine as OrderSummaryLineComponent } from '@/quote-management/components';\n\nexport interface OrderSummaryLineProps\n extends Omit<HTMLAttributes<HTMLDivElement>, 'label'> {\n label: VNode | string;\n price: VNode<HTMLAttributes<HTMLSpanElement>>;\n classSuffixes?: Array<string>;\n labelClassSuffix?: string;\n testId?: string;\n children?: any;\n}\n\nexport const OrderSummaryLine: Container<OrderSummaryLineProps> = ({\n label,\n price,\n classSuffixes = [],\n labelClassSuffix,\n testId,\n children,\n ...props\n}) => {\n return (\n <OrderSummaryLineComponent\n {...props}\n label={label}\n price={price}\n classSuffixes={classSuffixes}\n labelClassSuffix={labelClassSuffix}\n testId={testId}\n >\n {children}\n </OrderSummaryLineComponent>\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 '@/quote-management/components/OrderSummaryLine/OrderSummaryLine.css';\nimport { classes, VComponent } from '@adobe-commerce/elsie/lib';\nimport { FunctionComponent, VNode } from 'preact';\nimport { HTMLAttributes } from 'preact/compat';\nexport interface OrderSummaryLineComponentProps\n extends Omit<HTMLAttributes<HTMLDivElement>, 'label'> {\n label: VNode | string;\n price: VNode<HTMLAttributes<HTMLSpanElement>>;\n classSuffixes?: Array<string>;\n labelClassSuffix?: string;\n testId?: string;\n children?: any;\n}\n\nexport const OrderSummaryLine: FunctionComponent<\n OrderSummaryLineComponentProps\n> = ({\n label,\n price,\n classSuffixes = [],\n labelClassSuffix,\n testId,\n children,\n ...props\n}) => {\n const labelClass = 'quote-order-summary__label';\n const priceClass = 'quote-order-summary__price';\n return (\n <div\n {...props}\n {...(testId ? { 'data-testid': testId } : {})}\n className={classes([\n 'quote-order-summary__entry',\n ...classSuffixes.map(\n (classSuffix) => `quote-order-summary__${classSuffix}`\n ),\n ])}\n >\n <span\n className={classes([\n labelClass,\n ...(labelClassSuffix ? [`${labelClass}--${labelClassSuffix}`] : []),\n ])}\n >\n {label}\n </span>\n\n <VComponent\n node={price}\n className={classes([\n priceClass,\n ...(labelClassSuffix ? [`${priceClass}--${labelClassSuffix}`] : []),\n ])}\n />\n\n {children}\n </div>\n );\n};\n"],"names":["OrderSummaryLine","label","price","classSuffixes","labelClassSuffix","testId","children","props","jsx","OrderSummaryLineComponent","labelClass","priceClass","jsxs","classes","classSuffix","VComponent"],"mappings":"
|
|
1
|
+
{"version":3,"file":"OrderSummaryLine.js","sources":["/@dropins/storefront-quote-management/src/containers/OrderSummaryLine/OrderSummaryLine.tsx","/@dropins/storefront-quote-management/src/components/OrderSummaryLine/OrderSummaryLine.tsx"],"sourcesContent":["/********************************************************************\n * Copyright 2025 Adobe\n * All Rights Reserved.\n *\n * NOTICE: Adobe permits you to use, modify, and distribute this\n * file in accordance with the terms of the Adobe license agreement\n * accompanying it.\n *******************************************************************/\n\nimport { HTMLAttributes } from 'preact/compat';\nimport { Container } from '@adobe-commerce/elsie/lib';\nimport { VNode } from 'preact';\nimport { OrderSummaryLine as OrderSummaryLineComponent } from '@/quote-management/components';\n\nexport interface OrderSummaryLineProps\n extends Omit<HTMLAttributes<HTMLDivElement>, 'label'> {\n label: VNode | string;\n price: VNode<HTMLAttributes<HTMLSpanElement>>;\n classSuffixes?: Array<string>;\n labelClassSuffix?: string;\n testId?: string;\n children?: any;\n}\n\nexport const OrderSummaryLine: Container<OrderSummaryLineProps> = ({\n label,\n price,\n classSuffixes = [],\n labelClassSuffix,\n testId,\n children,\n ...props\n}) => {\n return (\n <OrderSummaryLineComponent\n {...props}\n label={label}\n price={price}\n classSuffixes={classSuffixes}\n labelClassSuffix={labelClassSuffix}\n testId={testId}\n >\n {children}\n </OrderSummaryLineComponent>\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 '@/quote-management/components/OrderSummaryLine/OrderSummaryLine.css';\nimport { classes, VComponent } from '@adobe-commerce/elsie/lib';\nimport { FunctionComponent, VNode } from 'preact';\nimport { HTMLAttributes } from 'preact/compat';\nexport interface OrderSummaryLineComponentProps\n extends Omit<HTMLAttributes<HTMLDivElement>, 'label'> {\n label: VNode | string;\n price: VNode<HTMLAttributes<HTMLSpanElement>>;\n classSuffixes?: Array<string>;\n labelClassSuffix?: string;\n testId?: string;\n children?: any;\n}\n\nexport const OrderSummaryLine: FunctionComponent<\n OrderSummaryLineComponentProps\n> = ({\n label,\n price,\n classSuffixes = [],\n labelClassSuffix,\n testId,\n children,\n ...props\n}) => {\n const labelClass = 'quote-order-summary__label';\n const priceClass = 'quote-order-summary__price';\n return (\n <div\n {...props}\n {...(testId ? { 'data-testid': testId } : {})}\n className={classes([\n 'quote-order-summary__entry',\n ...classSuffixes.map(\n (classSuffix) => `quote-order-summary__${classSuffix}`\n ),\n ])}\n >\n <span\n className={classes([\n labelClass,\n ...(labelClassSuffix ? [`${labelClass}--${labelClassSuffix}`] : []),\n ])}\n >\n {label}\n </span>\n\n <VComponent\n node={price}\n className={classes([\n priceClass,\n ...(labelClassSuffix ? [`${priceClass}--${labelClassSuffix}`] : []),\n ])}\n />\n\n {children}\n </div>\n );\n};\n"],"names":["OrderSummaryLine","label","price","classSuffixes","labelClassSuffix","testId","children","props","jsx","OrderSummaryLineComponent","labelClass","priceClass","jsxs","classes","classSuffix","VComponent"],"mappings":"2aAwBO,MAAMA,EAAqD,CAAC,CACjE,MAAAC,EACA,MAAAC,EACA,cAAAC,EAAgB,CAAA,EAChB,iBAAAC,EACA,OAAAC,EACA,SAAAC,EACA,GAAGC,CACL,IAEIC,EAACC,EAAA,CACE,GAAGF,EACJ,MAAAN,EACA,MAAAC,EACA,cAAAC,EACA,iBAAAC,EACA,OAAAC,EAEC,SAAAC,CAAA,CAAA,ECnBMN,EAET,CAAC,CACH,MAAAC,EACA,MAAAC,EACA,cAAAC,EAAgB,CAAA,EAChB,iBAAAC,EACA,OAAAC,EACA,SAAAC,EACA,GAAGC,CACL,IAAM,CACJ,MAAMG,EAAa,6BACbC,EAAa,6BACnB,OACEC,EAAC,MAAA,CACE,GAAGL,EACH,GAAIF,EAAS,CAAE,cAAeA,CAAA,EAAW,CAAA,EAC1C,UAAWQ,EAAQ,CACjB,6BACA,GAAGV,EAAc,IACdW,GAAgB,wBAAwBA,CAAW,EAAA,CACtD,CACD,EAED,SAAA,CAAAN,EAAC,OAAA,CACC,UAAWK,EAAQ,CACjBH,EACA,GAAIN,EAAmB,CAAC,GAAGM,CAAU,KAAKN,CAAgB,EAAE,EAAI,CAAA,CAAC,CAClE,EAEA,SAAAH,CAAA,CAAA,EAGHO,EAACO,EAAA,CACC,KAAMb,EACN,UAAWW,EAAQ,CACjBF,EACA,GAAIP,EAAmB,CAAC,GAAGO,CAAU,KAAKP,CAAgB,EAAE,EAAI,CAAA,CAAC,CAClE,CAAA,CAAA,EAGFE,CAAA,CAAA,CAAA,CAGP"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
/*! Copyright 2025 Adobe
|
|
2
2
|
All Rights Reserved. */
|
|
3
|
-
import{jsx as e,jsxs as
|
|
3
|
+
import{jsx as e,jsxs as u}from"@dropins/tools/preact-jsx-runtime.js";import{classes as i,VComponent as m}from"@dropins/tools/lib.js";/* empty css */import{useText as d}from"@dropins/tools/i18n.js";const g=({className:o,comments:a,...s})=>{const n=d({emptyState:"NegotiableQuote.Manage.quoteComments.emptyState",by:"NegotiableQuote.Manage.quoteComments.by"});return!a||a.length===0?e("ul",{...s,className:i(["quote-management-quote-comments-list","quote-management-quote-comments-list--empty",o]),"data-testid":"quote-comments-list",children:e("li",{className:"quote-management-quote-comments-list__empty-state","data-testid":"quote-comments-empty-state",children:n.emptyState})}):e("ul",{...s,className:i(["quote-management-quote-comments-list",o]),"data-testid":"quote-comments-list",children:a.map(t=>u("li",{className:"quote-management-quote-comments-list__item","data-testid":`quote-comment-${t.uid}`,children:[u("div",{className:"quote-management-quote-comments-list__header",children:[e(m,{className:"quote-management-quote-comments-list__date",node:t.createdAt,"data-testid":`quote-comment-date-${t.uid}`}),e("span",{className:"quote-management-quote-comments-list__by",children:n.by}),e(m,{className:"quote-management-quote-comments-list__author",node:t.author,"data-testid":`quote-comment-author-${t.uid}`})]}),e(m,{className:"quote-management-quote-comments-list__text",node:t.text,"data-testid":`quote-comment-text-${t.uid}`})]},t.uid))})};export{g as Q};
|
|
4
4
|
//# sourceMappingURL=QuoteCommentsList.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"QuoteCommentsList.js","sources":["/@dropins/storefront-quote-management/src/components/QuoteCommentsList/QuoteCommentsList.tsx"
|
|
1
|
+
{"version":3,"file":"QuoteCommentsList.js","sources":["/@dropins/storefront-quote-management/src/components/QuoteCommentsList/QuoteCommentsList.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 { useText } from '@adobe-commerce/elsie/i18n';\nimport '@/quote-management/components/QuoteCommentsList/QuoteCommentsList.css';\n\nexport interface QuoteCommentsListProps\n extends HTMLAttributes<HTMLUListElement> {\n comments: Array<{\n uid: string;\n createdAt: VNode;\n author: VNode;\n text: VNode;\n }>;\n}\n\nexport const QuoteCommentsList: FunctionComponent<QuoteCommentsListProps> = ({\n className,\n comments,\n ...props\n}) => {\n const dictionary = useText({\n emptyState: 'NegotiableQuote.Manage.quoteComments.emptyState',\n by: 'NegotiableQuote.Manage.quoteComments.by',\n });\n\n if (!comments || comments.length === 0) {\n return (\n <ul\n {...props}\n className={classes([\n 'quote-management-quote-comments-list',\n 'quote-management-quote-comments-list--empty',\n className,\n ])}\n data-testid=\"quote-comments-list\"\n >\n <li\n className=\"quote-management-quote-comments-list__empty-state\"\n data-testid=\"quote-comments-empty-state\"\n >\n {dictionary.emptyState}\n </li>\n </ul>\n );\n }\n\n return (\n <ul\n {...props}\n className={classes(['quote-management-quote-comments-list', className])}\n data-testid=\"quote-comments-list\"\n >\n {comments.map((comment) => (\n <li\n key={comment.uid}\n className=\"quote-management-quote-comments-list__item\"\n data-testid={`quote-comment-${comment.uid}`}\n >\n <div className=\"quote-management-quote-comments-list__header\">\n <VComponent\n className=\"quote-management-quote-comments-list__date\"\n node={comment.createdAt}\n data-testid={`quote-comment-date-${comment.uid}`}\n />\n <span className=\"quote-management-quote-comments-list__by\">\n {dictionary.by}\n </span>\n <VComponent\n className=\"quote-management-quote-comments-list__author\"\n node={comment.author}\n data-testid={`quote-comment-author-${comment.uid}`}\n />\n </div>\n <VComponent\n className=\"quote-management-quote-comments-list__text\"\n node={comment.text}\n data-testid={`quote-comment-text-${comment.uid}`}\n />\n </li>\n ))}\n </ul>\n );\n};\n"],"names":["QuoteCommentsList","className","comments","props","dictionary","useText","jsx","classes","comment","jsxs","VComponent"],"mappings":"sNAyBO,MAAMA,EAA+D,CAAC,CAC3E,UAAAC,EACA,SAAAC,EACA,GAAGC,CACL,IAAM,CACJ,MAAMC,EAAaC,EAAQ,CACzB,WAAY,kDACZ,GAAI,yCAAA,CACL,EAED,MAAI,CAACH,GAAYA,EAAS,SAAW,EAEjCI,EAAC,KAAA,CACE,GAAGH,EACJ,UAAWI,EAAQ,CACjB,uCACA,8CACAN,CAAA,CACD,EACD,cAAY,sBAEZ,SAAAK,EAAC,KAAA,CACC,UAAU,oDACV,cAAY,6BAEX,SAAAF,EAAW,UAAA,CAAA,CACd,CAAA,EAMJE,EAAC,KAAA,CACE,GAAGH,EACJ,UAAWI,EAAQ,CAAC,uCAAwCN,CAAS,CAAC,EACtE,cAAY,sBAEX,SAAAC,EAAS,IAAKM,GACbC,EAAC,KAAA,CAEC,UAAU,6CACV,cAAa,iBAAiBD,EAAQ,GAAG,GAEzC,SAAA,CAAAC,EAAC,MAAA,CAAI,UAAU,+CACb,SAAA,CAAAH,EAACI,EAAA,CACC,UAAU,6CACV,KAAMF,EAAQ,UACd,cAAa,sBAAsBA,EAAQ,GAAG,EAAA,CAAA,EAEhDF,EAAC,OAAA,CAAK,UAAU,2CACb,WAAW,GACd,EACAA,EAACI,EAAA,CACC,UAAU,+CACV,KAAMF,EAAQ,OACd,cAAa,wBAAwBA,EAAQ,GAAG,EAAA,CAAA,CAClD,EACF,EACAF,EAACI,EAAA,CACC,UAAU,6CACV,KAAMF,EAAQ,KACd,cAAa,sBAAsBA,EAAQ,GAAG,EAAA,CAAA,CAChD,CAAA,EAvBKA,EAAQ,GAAA,CAyBhB,CAAA,CAAA,CAGP"}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
/*! Copyright 2025 Adobe
|
|
2
|
+
All Rights Reserved. */
|
|
3
|
+
import{jsx as o,jsxs as i}from"@dropins/tools/preact-jsx-runtime.js";import{useState as f,useEffect as d}from"@dropins/tools/preact-compat.js";import{Q as c}from"./QuoteCommentsList.js";import{events as p}from"@dropins/tools/event-bus.js";import{f as l}from"./dateUtils.js";const C=({quoteData:s,...a})=>{var r;const[e,n]=f(s);if(d(()=>{const t=p.on("quote-management/quote-data",u=>{n(u.quote)},{eager:!0});return()=>t==null?void 0:t.off()},[]),!e)return null;const m=(r=e==null?void 0:e.comments)==null?void 0:r.map(t=>({uid:t.uid,createdAt:o("span",{children:l(t.createdAt,"long")}),author:i("span",{children:[t.author.firstname," ",t.author.lastname]}),text:o("p",{children:t.text})}));return o(c,{"data-testid":"quote-comments-list-container",...a,comments:m||[]})};export{C as Q};
|
|
4
|
+
//# sourceMappingURL=QuoteCommentsList3.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"QuoteCommentsList3.js","sources":["/@dropins/storefront-quote-management/src/containers/QuoteCommentsList/QuoteCommentsList.tsx"],"sourcesContent":["/********************************************************************\n * Copyright 2025 Adobe\n * All Rights Reserved.\n *\n * NOTICE: Adobe permits you to use, modify, and distribute this\n * file in accordance with the terms of the Adobe license agreement\n * accompanying it.\n *******************************************************************/\n\nimport { HTMLAttributes, useEffect, useState } from 'preact/compat';\nimport { Container } from '@adobe-commerce/elsie/lib';\nimport { QuoteCommentsList as QuoteCommentsListComponent } from '@/quote-management/components/QuoteCommentsList';\nimport { NegotiableQuoteModel } from '@/quote-management/data/models/negotiable-quote-model';\nimport { events } from '@adobe-commerce/event-bus';\nimport { formattedDate } from '@/quote-management/utils/dateUtils';\n\nexport interface QuoteCommentsListProps\n extends HTMLAttributes<HTMLUListElement> {\n quoteData?: NegotiableQuoteModel;\n}\n\nexport const QuoteCommentsList: Container<QuoteCommentsListProps> = ({\n quoteData: initialData,\n ...props\n}) => {\n const [quoteData, setQuoteData] = useState<NegotiableQuoteModel | undefined>(\n initialData\n );\n\n useEffect(() => {\n const quoteDataEvent = events.on(\n 'quote-management/quote-data',\n (data: { quote: NegotiableQuoteModel }) => {\n setQuoteData(data.quote);\n },\n {\n eager: true,\n }\n );\n return () => quoteDataEvent?.off();\n }, []);\n\n if (!quoteData) {\n return null;\n }\n\n // Format comments data\n const formattedComments = quoteData?.comments?.map((comment) => ({\n uid: comment.uid,\n createdAt: <span>{formattedDate(comment.createdAt, 'long')}</span>,\n author: (\n <span>\n {comment.author.firstname} {comment.author.lastname}\n </span>\n ),\n text: <p>{comment.text}</p>,\n }));\n\n return (\n <QuoteCommentsListComponent\n data-testid=\"quote-comments-list-container\"\n {...props}\n comments={formattedComments || []}\n />\n );\n};\n"],"names":["QuoteCommentsList","initialData","props","quoteData","setQuoteData","useState","useEffect","quoteDataEvent","events","data","formattedComments","_a","comment","jsx","QuoteCommentsListComponent"],"mappings":"kRAqBO,MAAMA,EAAuD,CAAC,CACnE,UAAWC,EACX,GAAGC,CACL,IAAM,OACJ,KAAM,CAACC,EAAWC,CAAY,EAAIC,EAChCJ,CAAA,EAgBF,GAbAK,EAAU,IAAM,CACd,MAAMC,EAAiBC,EAAO,GAC5B,8BACCC,GAA0C,CACzCL,EAAaK,EAAK,KAAK,CACzB,EACA,CACE,MAAO,EAAA,CACT,EAEF,MAAO,IAAMF,GAAA,YAAAA,EAAgB,KAC/B,EAAG,CAAA,CAAE,EAED,CAACJ,EACH,OAAO,KAIT,MAAMO,GAAoBC,EAAAR,GAAA,YAAAA,EAAW,WAAX,YAAAQ,EAAqB,IAAKC,IAAa,CAC/D,IAAKA,EAAQ,IACb,UAAWC,EAAC,OAAA,CAAM,WAAcD,EAAQ,UAAW,MAAM,EAAE,EAC3D,SACG,OAAA,CACE,SAAA,CAAAA,EAAQ,OAAO,UAAU,IAAEA,EAAQ,OAAO,QAAA,EAC7C,EAEF,KAAMC,EAAC,IAAA,CAAG,SAAAD,EAAQ,IAAA,CAAK,CAAA,IAGzB,OACEC,EAACC,EAAA,CACC,cAAY,gCACX,GAAGZ,EACJ,SAAUQ,GAAqB,CAAA,CAAC,CAAA,CAGtC"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
/*! Copyright 2025 Adobe
|
|
2
2
|
All Rights Reserved. */
|
|
3
|
-
import{jsxs as d,jsx as
|
|
3
|
+
import{jsxs as d,jsx as s}from"@dropins/tools/preact-jsx-runtime.js";import{classes as R}from"@dropins/tools/lib.js";import{f as c}from"./dateUtils.js";/* empty css */import{useText as $}from"@dropins/tools/i18n.js";const H=({className:g,children:q,history:x,items:y,buyer:n,salesRepName:D,...F})=>{const t=$({quoteCreated:"historyLog.changeTypes.created",quoteUpdated:"historyLog.changeTypes.updated",statusChanged:"historyLog.changeTypes.statusChanged",commentAdded:"historyLog.changeTypes.commentAdded",expirationChanged:"historyLog.changeTypes.expirationChanged",buyerNoteAdded:"historyLog.noteTypes.buyerNoteAdded",sellerNoteAdded:"historyLog.noteTypes.sellerNoteAdded",buyerLabel:"historyLog.authorLabels.buyer",sellerLabel:"historyLog.authorLabels.seller",commentDetail:"historyLog.changeDetails.comment",statusChangedFromTo:"historyLog.changeDetails.statusChangedFromTo",statusSetTo:"historyLog.changeDetails.statusSetTo",expirationChangedFromTo:"historyLog.changeDetails.expirationChangedFromTo",expirationSetTo:"historyLog.changeDetails.expirationSetTo",totalChangedFromTo:"historyLog.changeDetails.totalChangedFromTo",customChange:"historyLog.changeDetails.customChange",productsRemovedFromCatalog:"historyLog.changeDetails.productsRemovedFromCatalog",productsRemovedFromQuote:"historyLog.changeDetails.productsRemovedFromQuote",noDetailsAvailable:"historyLog.changeDetails.noDetailsAvailable",emptyState:"historyLog.emptyState",never:"dateUtils.never"}),w=e=>{switch(e){case"CREATED":return t.quoteCreated;case"UPDATED":return t.quoteUpdated;case"STATUS_CHANGED":return t.statusChanged;case"COMMENT_ADDED":return t.commentAdded;case"EXPIRATION_CHANGED":return t.expirationChanged;default:return e.replace(/_/g," ").toLowerCase().replace(/\b\w/g,o=>o.toUpperCase())}},E=e=>{var a,m,p,u,i,v,T,C,L,N,_,f;const o=[];if((a=e==null?void 0:e.commentAdded)!=null&&a.comment&&o.push(t.commentDetail.replace("{comment}",e.commentAdded.comment)),(m=e==null?void 0:e.statuses)!=null&&m.changes&&e.statuses.changes.forEach(r=>{r.oldStatus&&r.newStatus?o.push(t.statusChangedFromTo.replace("{oldStatus}",r.oldStatus).replace("{newStatus}",r.newStatus)):r.newStatus&&o.push(t.statusSetTo.replace("{newStatus}",r.newStatus))}),(p=e==null?void 0:e.expiration)!=null&&p.newExpiration&&((u=e==null?void 0:e.expiration)!=null&&u.oldExpiration)){const r=c(e.expiration.newExpiration),l=c(e.expiration.oldExpiration);o.push(t.expirationChangedFromTo.replace("{oldExpiration}",l).replace("{newExpiration}",r))}else if((i=e==null?void 0:e.expiration)!=null&&i.newExpiration){const r=c(e.expiration.newExpiration);o.push(t.expirationSetTo.replace("{newExpiration}",r))}if((v=e==null?void 0:e.total)!=null&&v.newPrice&&((T=e==null?void 0:e.total)!=null&&T.oldPrice)){const r=`${e.total.newPrice.currency} ${e.total.newPrice.value}`,l=`${e.total.oldPrice.currency} ${e.total.oldPrice.value}`;o.push(t.totalChangedFromTo.replace("{oldTotal}",l).replace("{newTotal}",r))}if((C=e==null?void 0:e.customChanges)!=null&&C.title&&((L=e==null?void 0:e.customChanges)!=null&&L.old_value)&&((N=e==null?void 0:e.customChanges)!=null&&N.new_value)&&o.push(t.customChange.replace("{title}",e.customChanges.title).replace("{oldValue}",e.customChanges.old_value).replace("{newValue}",e.customChanges.new_value)),(_=e==null?void 0:e.productsRemoved)!=null&&_.productsRemovedFromCatalog&&e.productsRemoved.productsRemovedFromCatalog.length>0&&o.push(t.productsRemovedFromCatalog.replace("{products}",e.productsRemoved.productsRemovedFromCatalog.join(", "))),(f=e==null?void 0:e.productsRemoved)!=null&&f.productsRemovedFromQuote&&e.productsRemoved.productsRemovedFromQuote.length>0){const r=e.productsRemoved.productsRemovedFromQuote.map(l=>l.name||l.sku||l.uid).join(", ");o.push(t.productsRemovedFromQuote.replace("{products}",r))}return o.length>0?o:[t.noDetailsAvailable]},S=(()=>{const e=[],o=(a,m,p,u)=>{a&&Array.isArray(a)&&a.forEach(i=>{i&&i.note&&i.note.trim()&&e.push({...i,type:m,productName:u.product.name,productSku:u.product.sku,authorName:p})})};return y&&y.forEach(a=>{o(a.noteFromBuyer,"buyer",`${n.firstname} ${n.lastname} ${t.buyerLabel}`,a),o(a.noteFromSeller,"seller",`${D} ${t.sellerLabel}`,a)}),e})(),A=(x||[]).map(e=>({...e,entryType:"history"})),b=S.map(e=>({...e,entryType:"note"})),h=[...A,...b];return d("div",{...F,className:R(["quote-management-quote-history-log",g]),children:[h.length>0?s("div",{className:"quote-management-quote-history-log__entries",children:h.map((e,o)=>d("div",{className:"quote-management-quote-history-log__entry",children:[d("div",{className:"quote-management-quote-history-log__entry-header",children:[d("div",{className:"quote-management-quote-history-log__entry-meta",children:[s("span",{className:"quote-management-quote-history-log__entry-date",children:c(e.createdAt,"long")}),s("span",{className:"quote-management-quote-history-log__entry-author",children:e.entryType==="history"?`by ${e.author.firstname} ${e.author.lastname} ${e.author.firstname===n.firstname&&e.author.lastname===n.lastname?t.buyerLabel:t.sellerLabel}`:`by ${e.authorName}`})]}),s("div",{className:"quote-management-quote-history-log__entry-type",children:e.entryType==="history"?w(e.changeType):e.type==="buyer"?t.buyerNoteAdded:t.sellerNoteAdded})]}),s("div",{className:"quote-management-quote-history-log__entry-changes",children:e.entryType==="history"?E(e.changes).map((a,m)=>s("div",{className:"quote-management-quote-history-log__entry-change",children:a},m)):d("div",{className:"quote-management-quote-history-log__entry-change",children:[d("div",{children:[e.productName,"(",e.productSku,")"]}),d("div",{children:['"',e.note,'"']})]})})]},e.entryType==="history"?e.uid:`${e.noteUid}-${o}`))}):s("div",{className:"quote-management-quote-history-log__empty",children:t.emptyState}),q]})};export{H as Q};
|
|
4
4
|
//# sourceMappingURL=QuoteHistoryLog.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"QuoteHistoryLog.js","sources":["/@dropins/storefront-quote-management/src/components/QuoteHistoryLog/QuoteHistoryLog.tsx","/@dropins/storefront-quote-management/src/containers/QuoteHistoryLog/QuoteHistoryLog.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 } from 'preact';\nimport { HTMLAttributes } from 'preact/compat';\nimport { classes, getGlobalLocale } from '@adobe-commerce/elsie/lib';\nimport { useText } from '@adobe-commerce/elsie/i18n';\nimport { NegotiableQuoteModel } from '@/quote-management/data/models/negotiable-quote-model';\nimport {\n formatExpirationDate,\n getUserTimezone,\n} from '@/quote-management/utils/dateUtils';\nimport '@/quote-management/components/QuoteHistoryLog/QuoteHistoryLog.css';\n\nexport interface QuoteHistoryLogProps extends HTMLAttributes<HTMLDivElement> {\n quoteData?: NegotiableQuoteModel;\n}\n\nexport const QuoteHistoryLog: FunctionComponent<QuoteHistoryLogProps> = ({\n className,\n children,\n quoteData,\n ...props\n}) => {\n // Fallback to en-US if no locale is set\n const calculatedLocale = getGlobalLocale() || 'en-US';\n\n const dictionary = useText({\n quoteCreated: 'historyLog.changeTypes.created',\n quoteUpdated: 'historyLog.changeTypes.updated',\n statusChanged: 'historyLog.changeTypes.statusChanged',\n commentAdded: 'historyLog.changeTypes.commentAdded',\n expirationChanged: 'historyLog.changeTypes.expirationChanged',\n buyerNoteAdded: 'historyLog.noteTypes.buyerNoteAdded',\n sellerNoteAdded: 'historyLog.noteTypes.sellerNoteAdded',\n buyerLabel: 'historyLog.authorLabels.buyer',\n sellerLabel: 'historyLog.authorLabels.seller',\n commentDetail: 'historyLog.changeDetails.comment',\n statusChangedFromTo: 'historyLog.changeDetails.statusChangedFromTo',\n statusSetTo: 'historyLog.changeDetails.statusSetTo',\n expirationChangedFromTo: 'historyLog.changeDetails.expirationChangedFromTo',\n expirationSetTo: 'historyLog.changeDetails.expirationSetTo',\n totalChangedFromTo: 'historyLog.changeDetails.totalChangedFromTo',\n customChange: 'historyLog.changeDetails.customChange',\n productsRemovedFromCatalog: 'historyLog.changeDetails.productsRemovedFromCatalog',\n productsRemovedFromQuote: 'historyLog.changeDetails.productsRemovedFromQuote',\n noDetailsAvailable: 'historyLog.changeDetails.noDetailsAvailable',\n emptyState: 'historyLog.emptyState',\n never: 'dateUtils.never',\n });\n\n const dateFormatter = new Intl.DateTimeFormat(calculatedLocale, {\n year: 'numeric',\n month: 'long',\n day: 'numeric',\n hour: '2-digit',\n minute: '2-digit',\n second: '2-digit',\n timeZone: getUserTimezone(),\n });\n\n const formatChangeType = (changeType: string) => {\n switch (changeType) {\n case 'CREATED':\n return dictionary.quoteCreated;\n case 'UPDATED':\n return dictionary.quoteUpdated;\n case 'STATUS_CHANGED':\n return dictionary.statusChanged;\n case 'COMMENT_ADDED':\n return dictionary.commentAdded;\n case 'EXPIRATION_CHANGED':\n return dictionary.expirationChanged;\n default:\n return changeType\n .replace(/_/g, ' ')\n .toLowerCase()\n .replace(/\\b\\w/g, (l) => l.toUpperCase());\n }\n };\n\n // Handle status or expiration changes\n const formatChanges = (changes: any) => {\n const changeDetails = [];\n\n if (changes?.commentAdded?.comment) {\n changeDetails.push(\n dictionary.commentDetail.replace(\n '{comment}',\n changes.commentAdded.comment\n )\n );\n }\n\n if (changes?.statuses?.changes) {\n changes.statuses.changes.forEach((statusChange: any) => {\n if (statusChange.oldStatus && statusChange.newStatus) {\n changeDetails.push(\n dictionary.statusChangedFromTo\n .replace('{oldStatus}', statusChange.oldStatus)\n .replace('{newStatus}', statusChange.newStatus)\n );\n } else if (statusChange.newStatus) {\n changeDetails.push(\n dictionary.statusSetTo.replace(\n '{newStatus}',\n statusChange.newStatus\n )\n );\n }\n });\n }\n\n if (\n changes?.expiration?.newExpiration &&\n changes?.expiration?.oldExpiration\n ) {\n const newDateFormatted = formatExpirationDate(\n changes.expiration.newExpiration,\n dateFormatter\n );\n const oldDateFormatted = formatExpirationDate(\n changes.expiration.oldExpiration,\n dateFormatter\n );\n changeDetails.push(\n dictionary.expirationChangedFromTo\n .replace('{oldExpiration}', oldDateFormatted)\n .replace('{newExpiration}', newDateFormatted)\n );\n } else if (changes?.expiration?.newExpiration) {\n const newDateFormatted = formatExpirationDate(\n changes.expiration.newExpiration,\n dateFormatter\n );\n changeDetails.push(\n dictionary.expirationSetTo.replace('{newExpiration}', newDateFormatted)\n );\n }\n\n if (changes?.total?.newPrice && changes?.total?.oldPrice) {\n const newTotal = `${changes.total.newPrice.currency} ${changes.total.newPrice.value}`;\n const oldTotal = `${changes.total.oldPrice.currency} ${changes.total.oldPrice.value}`;\n changeDetails.push(\n dictionary.totalChangedFromTo\n .replace('{oldTotal}', oldTotal)\n .replace('{newTotal}', newTotal)\n );\n }\n\n if (changes?.customChanges?.title && changes?.customChanges?.old_value && changes?.customChanges?.new_value) {\n changeDetails.push(\n dictionary.customChange\n .replace('{title}', changes.customChanges.title)\n .replace('{oldValue}', changes.customChanges.old_value)\n .replace('{newValue}', changes.customChanges.new_value)\n );\n }\n\n if (changes?.productsRemoved?.productsRemovedFromCatalog && changes.productsRemoved.productsRemovedFromCatalog.length > 0) {\n changeDetails.push(\n dictionary.productsRemovedFromCatalog.replace(\n '{products}',\n changes.productsRemoved.productsRemovedFromCatalog.join(', ')\n )\n );\n }\n\n if (changes?.productsRemoved?.productsRemovedFromQuote && changes.productsRemoved.productsRemovedFromQuote.length > 0) {\n const productNames = changes.productsRemoved.productsRemovedFromQuote.map((product: any) => \n product.name || product.sku || product.uid\n ).join(', ');\n changeDetails.push(\n dictionary.productsRemovedFromQuote.replace('{products}', productNames)\n );\n }\n\n return changeDetails.length > 0\n ? changeDetails\n : [dictionary.noDetailsAvailable];\n };\n\n // Get item notes outside of history entries\n const getItemNotes = () => {\n const notes: Array<{\n createdAt: string;\n creatorId: string;\n creatorType: string;\n negotiableQuoteItemUid: string;\n note: string;\n noteUid: string;\n type: 'buyer' | 'seller';\n productName: string;\n productSku: string;\n authorName: string;\n }> = [];\n\n const processNotes = (\n noteArray: any | undefined,\n type: 'buyer' | 'seller',\n authorName: string,\n item: any\n ) => {\n if (noteArray && Array.isArray(noteArray)) {\n noteArray.forEach((note) => {\n if (note && note.note && note.note.trim()) {\n notes.push({\n ...note,\n type,\n productName: item.product.name,\n productSku: item.product.sku,\n authorName,\n });\n }\n });\n }\n };\n\n if (quoteData?.items) {\n quoteData.items.forEach((item) => {\n processNotes(\n item.noteFromBuyer,\n 'buyer',\n `${quoteData.buyer.firstname} ${quoteData.buyer.lastname} ${dictionary.buyerLabel}`,\n item\n );\n\n processNotes(\n item.noteFromSeller,\n 'seller',\n `${quoteData.salesRepName} ${dictionary.sellerLabel}`,\n item\n );\n });\n }\n\n return notes;\n };\n\n const itemNotes = getItemNotes();\n\n // Get history entries\n const historyEntries = (quoteData?.history || []).map((entry) => ({\n ...entry,\n entryType: 'history' as const,\n }));\n const noteEntries = itemNotes.map((note) => ({\n ...note,\n entryType: 'note' as const,\n }));\n\n // Combine history and item notes without sorting\n const allEntries = [...historyEntries, ...noteEntries];\n\n return (\n <div\n {...props}\n className={classes(['quote-management-quote-history-log', className])}\n >\n {allEntries.length > 0 ? (\n <div className=\"quote-management-quote-history-log__entries\">\n {allEntries.map((entry, index) => (\n <div\n key={\n entry.entryType === 'history'\n ? entry.uid\n : `${entry.noteUid}-${index}`\n }\n className=\"quote-management-quote-history-log__entry\"\n >\n <div className=\"quote-management-quote-history-log__entry-header\">\n <div className=\"quote-management-quote-history-log__entry-meta\">\n <span className=\"quote-management-quote-history-log__entry-date\">\n {dateFormatter.format(new Date(entry.createdAt))}\n </span>\n <span className=\"quote-management-quote-history-log__entry-author\">\n {entry.entryType === 'history'\n ? `by ${entry.author.firstname} ${\n entry.author.lastname\n } ${\n entry.author.firstname ===\n quoteData?.buyer.firstname &&\n entry.author.lastname === quoteData?.buyer.lastname\n ? dictionary.buyerLabel\n : dictionary.sellerLabel\n }`\n : `by ${entry.authorName}`}\n </span>\n </div>\n <div className=\"quote-management-quote-history-log__entry-type\">\n {entry.entryType === 'history'\n ? formatChangeType(entry.changeType)\n : entry.type === 'buyer'\n ? dictionary.buyerNoteAdded\n : dictionary.sellerNoteAdded}\n </div>\n </div>\n <div className=\"quote-management-quote-history-log__entry-changes\">\n {entry.entryType === 'history' ? (\n formatChanges(entry.changes).map((change, changeIndex) => (\n <div\n key={changeIndex}\n className=\"quote-management-quote-history-log__entry-change\"\n >\n {change}\n </div>\n ))\n ) : (\n <div className=\"quote-management-quote-history-log__entry-change\">\n <div>\n {entry.productName}({entry.productSku})\n </div>\n <div>\"{entry.note}\"</div>\n </div>\n )}\n </div>\n </div>\n ))}\n </div>\n ) : (\n <div className=\"quote-management-quote-history-log__empty\">\n {dictionary.emptyState}\n </div>\n )}\n {children}\n </div>\n );\n};\n","/********************************************************************\n * Copyright 2025 Adobe\n * All Rights Reserved.\n *\n * NOTICE: Adobe permits you to use, modify, and distribute this \n * file in accordance with the terms of the Adobe license agreement \n * accompanying it. \n *******************************************************************/\n \nimport { HTMLAttributes, useEffect, useState } from 'preact/compat';\nimport { Container } from '@adobe-commerce/elsie/lib';\nimport { NegotiableQuoteModel } from '@/quote-management/data/models/negotiable-quote-model';\nimport { events } from '@adobe-commerce/event-bus';\nimport { QuoteHistoryLog as QuoteHistoryLogComponent } from '@/quote-management/components/QuoteHistoryLog';\n\nexport interface QuoteHistoryLogProps extends HTMLAttributes<HTMLDivElement> {\n quoteData?: NegotiableQuoteModel;\n}\n \nexport const QuoteHistoryLog: Container<QuoteHistoryLogProps> = ({ quoteData: initialData, ...props }) => {\n\n const [quoteData, setQuoteData] = useState<NegotiableQuoteModel | undefined>(\n initialData\n );\n\n useEffect(() => {\n const quoteDataEvent = events.on(\n 'quote-management/quote-data',\n (data: { quote: NegotiableQuoteModel }) => {\n setQuoteData(data.quote);\n },\n {\n eager: true,\n }\n );\n return () => quoteDataEvent?.off();\n }, []);\n\n if (!quoteData) {\n return null;\n }\n\n return (\n <div {...props}>\n <QuoteHistoryLogComponent quoteData={quoteData} />\n </div>\n );\n};\n"],"names":["QuoteHistoryLog","className","children","quoteData","props","calculatedLocale","getGlobalLocale","dictionary","useText","dateFormatter","getUserTimezone","formatChangeType","changeType","l","formatChanges","changes","changeDetails","_a","_b","statusChange","_c","_d","newDateFormatted","formatExpirationDate","oldDateFormatted","_e","_f","_g","newTotal","oldTotal","_h","_i","_j","_k","_l","productNames","product","itemNotes","notes","processNotes","noteArray","type","authorName","item","note","historyEntries","entry","noteEntries","allEntries","jsxs","classes","jsx","index","change","changeIndex","initialData","setQuoteData","useState","useEffect","quoteDataEvent","events","data","QuoteHistoryL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,UACnBrC,EAAcgC,EAAM,OAAO,EAAE,IAAI,CAACO,EAAQC,IACxCH,EAAC,MAAA,CAEC,UAAU,mDAET,SAAAE,CAAA,EAHIC,CAAA,CAKR,EAEDL,EAAC,MAAA,CAAI,UAAU,mDACb,SAAA,CAAAA,EAAC,MAAA,CACE,SAAA,CAAAH,EAAM,YAAY,IAAEA,EAAM,WAAW,GAAA,EACxC,IACC,MAAA,CAAI,SAAA,CAAA,IAAEA,EAAM,KAAK,GAAA,CAAA,CAAC,CAAA,CAAA,CACrB,CAAA,CAEJ,CAAA,CAAA,EAnDEA,EAAM,YAAc,UAChBA,EAAM,IACN,GAAGA,EAAM,OAAO,IAAIM,CAAK,EAAA,CAmDlC,EACH,EAEAD,EAAC,OAAI,UAAU,4CACZ,WAAW,WACd,EAEDjD,CAAA,CAAA,CAAA,CAGP,EC1TaF,EAAmD,CAAC,CAAE,UAAWuD,EAAa,GAAGnD,KAAY,CAExG,KAAM,CAACD,EAAWqD,CAAY,EAAIC,EAChCF,CAAA,EAgBF,OAbAG,EAAU,IAAM,CACd,MAAMC,EAAiBC,EAAO,GAC5B,8BACCC,GAA0C,CACzCL,EAAaK,EAAK,KAAK,CACzB,EACA,CACE,MAAO,EAAA,CACT,EAEF,MAAO,IAAMF,GAAA,YAAAA,EAAgB,KAC/B,EAAG,CAAA,CAAE,EAEAxD,IAKF,MAAA,CAAK,GAAGC,EACP,SAAA+C,EAACW,EAAA,CAAyB,UAAA3D,EAAsB,EAClD,EANO,IAQX"}
|
|
1
|
+
{"version":3,"file":"QuoteHistoryLog.js","sources":["/@dropins/storefront-quote-management/src/components/QuoteHistoryLog/QuoteHistoryLog.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 } from 'preact';\nimport { HTMLAttributes } from 'preact/compat';\nimport { classes } from '@adobe-commerce/elsie/lib';\nimport { useText } from '@adobe-commerce/elsie/i18n';\nimport { formattedDate } from '@/quote-management/utils/dateUtils';\nimport '@/quote-management/components/QuoteHistoryLog/QuoteHistoryLog.css';\n\nexport interface HistoryEntry {\n uid: string;\n createdAt: string;\n author: {\n firstname: string;\n lastname: string;\n };\n changeType: string;\n changes: {\n commentAdded?: { comment: string };\n statuses?: { changes: Array<{ oldStatus?: string; newStatus?: string }> };\n expiration?: { oldExpiration?: string; newExpiration?: string };\n total?: {\n oldPrice?: { value: number; currency: string };\n newPrice?: { value: number; currency: string };\n };\n customChanges?: { title: string; old_value: string; new_value: string };\n productsRemoved?: {\n productsRemovedFromCatalog?: string[];\n productsRemovedFromQuote?: Array<{ name?: string; sku?: string; uid: string }>;\n };\n };\n}\n\nexport interface ItemNote {\n createdAt: string;\n creatorId: number;\n creatorType: number;\n negotiableQuoteItemUid: string;\n note: string;\n noteUid: string;\n}\n\nexport interface QuoteItem {\n product: {\n name: string;\n sku: string;\n };\n noteFromBuyer?: ItemNote[];\n noteFromSeller?: ItemNote[];\n}\n\nexport interface QuoteHistoryLogProps extends HTMLAttributes<HTMLDivElement> {\n history?: HistoryEntry[];\n items?: QuoteItem[];\n buyer: {\n firstname: string;\n lastname: string;\n };\n salesRepName: string;\n}\n\nexport const QuoteHistoryLog: FunctionComponent<QuoteHistoryLogProps> = ({\n className,\n children,\n history,\n items,\n buyer,\n salesRepName,\n ...props\n}) => {\n const dictionary = useText({\n quoteCreated: 'historyLog.changeTypes.created',\n quoteUpdated: 'historyLog.changeTypes.updated',\n statusChanged: 'historyLog.changeTypes.statusChanged',\n commentAdded: 'historyLog.changeTypes.commentAdded',\n expirationChanged: 'historyLog.changeTypes.expirationChanged',\n buyerNoteAdded: 'historyLog.noteTypes.buyerNoteAdded',\n sellerNoteAdded: 'historyLog.noteTypes.sellerNoteAdded',\n buyerLabel: 'historyLog.authorLabels.buyer',\n sellerLabel: 'historyLog.authorLabels.seller',\n commentDetail: 'historyLog.changeDetails.comment',\n statusChangedFromTo: 'historyLog.changeDetails.statusChangedFromTo',\n statusSetTo: 'historyLog.changeDetails.statusSetTo',\n expirationChangedFromTo: 'historyLog.changeDetails.expirationChangedFromTo',\n expirationSetTo: 'historyLog.changeDetails.expirationSetTo',\n totalChangedFromTo: 'historyLog.changeDetails.totalChangedFromTo',\n customChange: 'historyLog.changeDetails.customChange',\n productsRemovedFromCatalog: 'historyLog.changeDetails.productsRemovedFromCatalog',\n productsRemovedFromQuote: 'historyLog.changeDetails.productsRemovedFromQuote',\n noDetailsAvailable: 'historyLog.changeDetails.noDetailsAvailable',\n emptyState: 'historyLog.emptyState',\n never: 'dateUtils.never',\n });\n\n\n const formatChangeType = (changeType: string) => {\n switch (changeType) {\n case 'CREATED':\n return dictionary.quoteCreated;\n case 'UPDATED':\n return dictionary.quoteUpdated;\n case 'STATUS_CHANGED':\n return dictionary.statusChanged;\n case 'COMMENT_ADDED':\n return dictionary.commentAdded;\n case 'EXPIRATION_CHANGED':\n return dictionary.expirationChanged;\n default:\n return changeType\n .replace(/_/g, ' ')\n .toLowerCase()\n .replace(/\\b\\w/g, (l) => l.toUpperCase());\n }\n };\n\n // Handle status or expiration changes\n const formatChanges = (changes: any) => {\n const changeDetails = [];\n\n if (changes?.commentAdded?.comment) {\n changeDetails.push(\n dictionary.commentDetail.replace(\n '{comment}',\n changes.commentAdded.comment\n )\n );\n }\n\n if (changes?.statuses?.changes) {\n changes.statuses.changes.forEach((statusChange: any) => {\n if (statusChange.oldStatus && statusChange.newStatus) {\n changeDetails.push(\n dictionary.statusChangedFromTo\n .replace('{oldStatus}', statusChange.oldStatus)\n .replace('{newStatus}', statusChange.newStatus)\n );\n } else if (statusChange.newStatus) {\n changeDetails.push(\n dictionary.statusSetTo.replace(\n '{newStatus}',\n statusChange.newStatus\n )\n );\n }\n });\n }\n\n if (\n changes?.expiration?.newExpiration &&\n changes?.expiration?.oldExpiration\n ) {\n const newDateFormatted = formattedDate(changes.expiration.newExpiration);\n const oldDateFormatted = formattedDate(changes.expiration.oldExpiration);\n changeDetails.push(\n dictionary.expirationChangedFromTo\n .replace('{oldExpiration}', oldDateFormatted)\n .replace('{newExpiration}', newDateFormatted)\n );\n } else if (changes?.expiration?.newExpiration) {\n const newDateFormatted = formattedDate(changes.expiration.newExpiration);\n changeDetails.push(\n dictionary.expirationSetTo.replace('{newExpiration}', newDateFormatted)\n );\n }\n\n if (changes?.total?.newPrice && changes?.total?.oldPrice) {\n const newTotal = `${changes.total.newPrice.currency} ${changes.total.newPrice.value}`;\n const oldTotal = `${changes.total.oldPrice.currency} ${changes.total.oldPrice.value}`;\n changeDetails.push(\n dictionary.totalChangedFromTo\n .replace('{oldTotal}', oldTotal)\n .replace('{newTotal}', newTotal)\n );\n }\n\n if (changes?.customChanges?.title && changes?.customChanges?.old_value && changes?.customChanges?.new_value) {\n changeDetails.push(\n dictionary.customChange\n .replace('{title}', changes.customChanges.title)\n .replace('{oldValue}', changes.customChanges.old_value)\n .replace('{newValue}', changes.customChanges.new_value)\n );\n }\n\n if (changes?.productsRemoved?.productsRemovedFromCatalog && changes.productsRemoved.productsRemovedFromCatalog.length > 0) {\n changeDetails.push(\n dictionary.productsRemovedFromCatalog.replace(\n '{products}',\n changes.productsRemoved.productsRemovedFromCatalog.join(', ')\n )\n );\n }\n\n if (changes?.productsRemoved?.productsRemovedFromQuote && changes.productsRemoved.productsRemovedFromQuote.length > 0) {\n const productNames = changes.productsRemoved.productsRemovedFromQuote.map((product: any) =>\n product.name || product.sku || product.uid\n ).join(', ');\n changeDetails.push(\n dictionary.productsRemovedFromQuote.replace('{products}', productNames)\n );\n }\n\n return changeDetails.length > 0\n ? changeDetails\n : [dictionary.noDetailsAvailable];\n };\n\n // Get item notes outside of history entries\n const getItemNotes = () => {\n const notes: Array<{\n createdAt: string;\n creatorId: number;\n creatorType: number;\n negotiableQuoteItemUid: string;\n note: string;\n noteUid: string;\n type: 'buyer' | 'seller';\n productName: string;\n productSku: string;\n authorName: string;\n }> = [];\n\n const processNotes = (\n noteArray: ItemNote[] | undefined,\n type: 'buyer' | 'seller',\n authorName: string,\n item: QuoteItem\n ) => {\n if (noteArray && Array.isArray(noteArray)) {\n noteArray.forEach((note) => {\n if (note && note.note && note.note.trim()) {\n notes.push({\n ...note,\n type,\n productName: item.product.name,\n productSku: item.product.sku,\n authorName,\n });\n }\n });\n }\n };\n\n if (items) {\n items.forEach((item) => {\n processNotes(\n item.noteFromBuyer,\n 'buyer',\n `${buyer.firstname} ${buyer.lastname} ${dictionary.buyerLabel}`,\n item\n );\n\n processNotes(\n item.noteFromSeller,\n 'seller',\n `${salesRepName} ${dictionary.sellerLabel}`,\n item\n );\n });\n }\n\n return notes;\n };\n\n const itemNotes = getItemNotes();\n\n // Get history entries\n const historyEntries = (history || []).map((entry) => ({\n ...entry,\n entryType: 'history' as const,\n }));\n const noteEntries = itemNotes.map((note) => ({\n ...note,\n entryType: 'note' as const,\n }));\n\n // Combine history and item notes without sorting\n const allEntries = [...historyEntries, ...noteEntries];\n\n return (\n <div\n {...props}\n className={classes(['quote-management-quote-history-log', className])}\n >\n {allEntries.length > 0 ? (\n <div className=\"quote-management-quote-history-log__entries\">\n {allEntries.map((entry, index) => (\n <div\n key={\n entry.entryType === 'history'\n ? entry.uid\n : `${entry.noteUid}-${index}`\n }\n className=\"quote-management-quote-history-log__entry\"\n >\n <div className=\"quote-management-quote-history-log__entry-header\">\n <div className=\"quote-management-quote-history-log__entry-meta\">\n <span className=\"quote-management-quote-history-log__entry-date\">\n {formattedDate(entry.createdAt, 'long')}\n </span>\n <span className=\"quote-management-quote-history-log__entry-author\">\n {entry.entryType === 'history'\n ? `by ${entry.author.firstname} ${entry.author.lastname\n } ${entry.author.firstname === buyer.firstname &&\n entry.author.lastname === buyer.lastname\n ? dictionary.buyerLabel\n : dictionary.sellerLabel\n }`\n : `by ${entry.authorName}`}\n </span>\n </div>\n <div className=\"quote-management-quote-history-log__entry-type\">\n {entry.entryType === 'history'\n ? formatChangeType(entry.changeType)\n : entry.type === 'buyer'\n ? dictionary.buyerNoteAdded\n : dictionary.sellerNoteAdded}\n </div>\n </div>\n <div className=\"quote-management-quote-history-log__entry-changes\">\n {entry.entryType === 'history' ? (\n formatChanges(entry.changes).map((change, changeIndex) => (\n <div\n key={changeIndex}\n className=\"quote-management-quote-history-log__entry-change\"\n >\n {change}\n </div>\n ))\n ) : (\n <div className=\"quote-management-quote-history-log__entry-change\">\n <div>\n {entry.productName}({entry.productSku})\n </div>\n <div>\"{entry.note}\"</div>\n </div>\n )}\n </div>\n </div>\n ))}\n </div>\n ) : (\n <div className=\"quote-management-quote-history-log__empty\">\n {dictionary.emptyState}\n </div>\n )}\n {children}\n </div>\n );\n};\n"],"names":["QuoteHistoryLog","className","children","history","items","buyer","salesRepName","props","dictionary","useText","formatChangeType","changeType","l","formatChanges","changes","changeDetails","_a","_b","statusChange","_c","_d","newDateFormatted","formattedDate","oldDateFormatted","_e","_f","_g","newTotal","oldTotal","_h","_i","_j","_k","_l","productNames","product","itemNotes","notes","processNotes","noteArray","type","authorName","item","note","historyEntries","entry","noteEntries","allEntries","jsxs","classes","jsx","index","change","changeIndex"],"mappings":"uOAoEO,MAAMA,EAA2D,CAAC,CACvE,UAAAC,EACA,SAAAC,EACA,QAAAC,EACA,MAAAC,EACA,MAAAC,EACA,aAAAC,EACA,GAAGC,CACL,IAAM,CACJ,MAAMC,EAAaC,EAAQ,CACzB,aAAc,iCACd,aAAc,iCACd,cAAe,uCACf,aAAc,sCACd,kBAAmB,2CACnB,eAAgB,sCAChB,gBAAiB,uCACjB,WAAY,gCACZ,YAAa,iCACb,cAAe,mCACf,oBAAqB,+CACrB,YAAa,uCACb,wBAAyB,mDACzB,gBAAiB,2CACjB,mBAAoB,8CACpB,aAAc,wCACd,2BAA4B,sDAC5B,yBAA0B,oDAC1B,mBAAoB,8CACpB,WAAY,wBACZ,MAAO,iBAAA,CACR,EAGKC,EAAoBC,GAAuB,CAC/C,OAAQA,EAAA,CACN,I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,WAAM,YAAc,UACjB,MAAML,EAAM,OAAO,SAAS,IAAIA,EAAM,OAAO,QAC/C,IAAIA,EAAM,OAAO,YAAcxC,EAAM,WACnCwC,EAAM,OAAO,WAAaxC,EAAM,SAC9BG,EAAW,WACXA,EAAW,WACf,GACE,MAAMqC,EAAM,UAAU,EAAA,CAC5B,CAAA,EACF,IACC,MAAA,CAAI,UAAU,iDACZ,SAAAA,EAAM,YAAc,UACjBnC,EAAiBmC,EAAM,UAAU,EACjCA,EAAM,OAAS,QACbrC,EAAW,eACXA,EAAW,eAAA,CACnB,CAAA,EACF,EACA0C,EAAC,MAAA,CAAI,UAAU,oDACZ,WAAM,YAAc,UACnBrC,EAAcgC,EAAM,OAAO,EAAE,IAAI,CAACO,EAAQC,IACxCH,EAAC,MAAA,CAEC,UAAU,mDAET,SAAAE,CAAA,EAHIC,CAAA,CAKR,EAEDL,EAAC,MAAA,CAAI,UAAU,mDACb,SAAA,CAAAA,EAAC,MAAA,CACE,SAAA,CAAAH,EAAM,YAAY,IAAEA,EAAM,WAAW,GAAA,EACxC,IACC,MAAA,CAAI,SAAA,CAAA,IAAEA,EAAM,KAAK,GAAA,CAAA,CAAC,CAAA,CAAA,CACrB,CAAA,CAEJ,CAAA,CAAA,EAhDEA,EAAM,YAAc,UAChBA,EAAM,IACN,GAAGA,EAAM,OAAO,IAAIM,CAAK,EAAA,CAgDlC,EACH,EAEAD,EAAC,OAAI,UAAU,4CACZ,WAAW,WACd,EAEDhD,CAAA,CAAA,CAAA,CAGP"}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
/*! Copyright 2025 Adobe
|
|
2
|
+
All Rights Reserved. */
|
|
3
|
+
import{jsx as o}from"@dropins/tools/preact-jsx-runtime.js";import{useState as m,useEffect as i}from"@dropins/tools/preact-compat.js";import{events as n}from"@dropins/tools/event-bus.js";import{Q as f}from"./QuoteHistoryLog.js";const Q=({quoteData:r,...s})=>{const[e,a]=m(r);return i(()=>{const t=n.on("quote-management/quote-data",u=>{a(u.quote)},{eager:!0});return()=>t==null?void 0:t.off()},[]),e?o("div",{...s,children:o(f,{history:e.history,items:e.items,buyer:e.buyer,salesRepName:e.salesRepName})}):null};export{Q};
|
|
4
|
+
//# sourceMappingURL=QuoteHistoryLog3.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"QuoteHistoryLog3.js","sources":["/@dropins/storefront-quote-management/src/containers/QuoteHistoryLog/QuoteHistoryLog.tsx"],"sourcesContent":["/********************************************************************\n * Copyright 2025 Adobe\n * All Rights Reserved.\n *\n * NOTICE: Adobe permits you to use, modify, and distribute this \n * file in accordance with the terms of the Adobe license agreement \n * accompanying it. \n *******************************************************************/\n \nimport { HTMLAttributes, useEffect, useState } from 'preact/compat';\nimport { Container } from '@adobe-commerce/elsie/lib';\nimport { NegotiableQuoteModel } from '@/quote-management/data/models/negotiable-quote-model';\nimport { events } from '@adobe-commerce/event-bus';\nimport { QuoteHistoryLog as QuoteHistoryLogComponent } from '@/quote-management/components/QuoteHistoryLog';\n\nexport interface QuoteHistoryLogProps extends HTMLAttributes<HTMLDivElement> {\n quoteData?: NegotiableQuoteModel;\n}\n \nexport const QuoteHistoryLog: Container<QuoteHistoryLogProps> = ({ quoteData: initialData, ...props }) => {\n\n const [quoteData, setQuoteData] = useState<NegotiableQuoteModel | undefined>(\n initialData\n );\n\n useEffect(() => {\n const quoteDataEvent = events.on(\n 'quote-management/quote-data',\n (data: { quote: NegotiableQuoteModel }) => {\n setQuoteData(data.quote);\n },\n {\n eager: true,\n }\n );\n return () => quoteDataEvent?.off();\n }, []);\n\n if (!quoteData) {\n return null;\n }\n\n return (\n <div {...props}>\n <QuoteHistoryLogComponent \n history={quoteData.history}\n items={quoteData.items}\n buyer={quoteData.buyer}\n salesRepName={quoteData.salesRepName}\n />\n </div>\n );\n};\n"],"names":["QuoteHistoryLog","initialData","props","quoteData","setQuoteData","useState","useEffect","quoteDataEvent","events","data","jsx","QuoteHistoryLogComponent"],"mappings":"mOAmBO,MAAMA,EAAmD,CAAC,CAAE,UAAWC,EAAa,GAAGC,KAAY,CAExG,KAAM,CAACC,EAAWC,CAAY,EAAIC,EAChCJ,CAAA,EAgBF,OAbAK,EAAU,IAAM,CACd,MAAMC,EAAiBC,EAAO,GAC5B,8BACCC,GAA0C,CACzCL,EAAaK,EAAK,KAAK,CACzB,EACA,CACE,MAAO,EAAA,CACT,EAEF,MAAO,IAAMF,GAAA,YAAAA,EAAgB,KAC/B,EAAG,CAAA,CAAE,EAEAJ,EAKHO,EAAC,MAAA,CAAK,GAAGR,EACP,SAAAQ,EAACC,EAAA,CACC,QAASR,EAAU,QACnB,MAAOA,EAAU,MACjB,MAAOA,EAAU,MACjB,aAAcA,EAAU,YAAA,CAAA,EAE5B,EAXO,IAaX"}
|