@dropins/storefront-quote-management 0.0.1-alpha35 → 0.0.1-alpha37

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.
@@ -17,9 +17,6 @@ export interface SendQuoteTemplateForReviewParams {
17
17
  name?: string;
18
18
  comment?: string;
19
19
  referenceDocumentLinks?: ReferenceDocumentLinkInput[];
20
- attachments?: {
21
- key: string;
22
- }[];
23
20
  }
24
21
  export declare const sendQuoteTemplateForReview: (params: SendQuoteTemplateForReviewParams) => Promise<import('../../data/models/negotiable-quote-template-model').NegotiableQuoteTemplateModel>;
25
22
  //# sourceMappingURL=sendQuoteTemplateForReview.d.ts.map
@@ -1,4 +1,4 @@
1
1
  /*! Copyright 2025 Adobe
2
2
  All Rights Reserved. */
3
- import{jsx as a,jsxs as i}from"@dropins/tools/preact-jsx-runtime.js";import{useState as f,useEffect as p}from"@dropins/tools/preact-compat.js";import{Q as d}from"./QuoteCommentsList.js";import{events as l}from"@dropins/tools/event-bus.js";import{f as c}from"./dateUtils.js";const C=({templateData:r,...s})=>{var o;const[e,m]=f(r);if(p(()=>{const t=l.on("quote-management/quote-template-data",u=>{m(u.quoteTemplate)},{eager:!0});return()=>t==null?void 0:t.off()},[]),!e)return null;const n=(o=e==null?void 0:e.comments)==null?void 0:o.map(t=>({uid:t.uid,createdAt:a("span",{children:c(t.createdAt,"long")}),author:i("span",{children:[t.author.firstname," ",t.author.lastname]}),text:a("p",{children:t.text}),attachments:t.attachments}));return a(d,{"data-testid":"quote-template-comments-list-container",...s,comments:n||[]})};export{C as Q};
3
+ import{jsx as o,jsxs as i}from"@dropins/tools/preact-jsx-runtime.js";import{useState as f,useEffect as p}from"@dropins/tools/preact-compat.js";import{Q as d}from"./QuoteCommentsList.js";import{events as l}from"@dropins/tools/event-bus.js";import{f as c}from"./dateUtils.js";const C=({templateData:a,...s})=>{var r;const[e,m]=f(a);if(p(()=>{const t=l.on("quote-management/quote-template-data",u=>{m(u.quoteTemplate)},{eager:!0});return()=>t==null?void 0:t.off()},[]),!e)return null;const n=(r=e==null?void 0:e.comments)==null?void 0:r.map(t=>({uid:t.uid,createdAt:o("span",{children:c(t.createdAt,"long")}),author:i("span",{children:[t.author.firstname," ",t.author.lastname]}),text:o("p",{children:t.text})}));return o(d,{"data-testid":"quote-template-comments-list-container",...s,comments:n||[]})};export{C as Q};
4
4
  //# sourceMappingURL=QuoteTemplateCommentsList.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"QuoteTemplateCommentsList.js","sources":["/@dropins/storefront-quote-management/src/containers/QuoteTemplateCommentsList/QuoteTemplateCommentsList.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 { NegotiableQuoteTemplateModel } from '@/quote-management/data/models/negotiable-quote-template-model';\nimport { events } from '@adobe-commerce/event-bus';\nimport { formattedDate } from '@/quote-management/utils/dateUtils';\n\nexport interface QuoteTemplateCommentsListProps extends HTMLAttributes<HTMLUListElement> {\n templateData?: NegotiableQuoteTemplateModel;\n}\n\nexport const QuoteTemplateCommentsList: Container<QuoteTemplateCommentsListProps> = ({\n templateData: initialData,\n ...props\n}) => {\n const [templateData, setTemplateData] = useState<NegotiableQuoteTemplateModel | undefined>(initialData);\n\n useEffect(() => {\n const templateDataEvent = events.on('quote-management/quote-template-data', (data: { quoteTemplate: NegotiableQuoteTemplateModel }) => {\n setTemplateData(data.quoteTemplate);\n }, { eager: true });\n return () => templateDataEvent?.off();\n }, []);\n\n if (!templateData) {\n return null;\n }\n\n // Format comments data\n const formattedComments = templateData?.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 attachments: comment.attachments,\n }));\n\n return (\n <QuoteCommentsListComponent\n data-testid=\"quote-template-comments-list-container\"\n {...props}\n comments={formattedComments || []}\n />\n );\n};\n"],"names":["QuoteTemplateCommentsList","initialData","props","templateData","setTemplateData","useState","useEffect","templateDataEvent","events","data","formattedComments","_a","comment","jsx","QuoteCommentsListComponent"],"mappings":"kRAoBO,MAAMA,EAAuE,CAAC,CACnF,aAAcC,EACd,GAAGC,CACL,IAAM,OACJ,KAAM,CAACC,EAAcC,CAAe,EAAIC,EAAmDJ,CAAW,EAStG,GAPAK,EAAU,IAAM,CACd,MAAMC,EAAoBC,EAAO,GAAG,uCAAyCC,GAA0D,CACrIL,EAAgBK,EAAK,aAAa,CACpC,EAAG,CAAE,MAAO,GAAM,EAClB,MAAO,IAAMF,GAAA,YAAAA,EAAmB,KAClC,EAAG,CAAA,CAAE,EAED,CAACJ,EACH,OAAO,KAIT,MAAMO,GAAoBC,EAAAR,GAAA,YAAAA,EAAc,WAAd,YAAAQ,EAAwB,IAAKC,IAAa,CAClE,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,KAAK,EACvB,YAAaA,EAAQ,WAAA,IAGvB,OACEC,EAACC,EAAA,CACC,cAAY,yCACX,GAAGZ,EACJ,SAAUQ,GAAqB,CAAA,CAAC,CAAA,CAGtC"}
1
+ {"version":3,"file":"QuoteTemplateCommentsList.js","sources":["/@dropins/storefront-quote-management/src/containers/QuoteTemplateCommentsList/QuoteTemplateCommentsList.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 { NegotiableQuoteTemplateModel } from '@/quote-management/data/models/negotiable-quote-template-model';\nimport { events } from '@adobe-commerce/event-bus';\nimport { formattedDate } from '@/quote-management/utils/dateUtils';\n\nexport interface QuoteTemplateCommentsListProps extends HTMLAttributes<HTMLUListElement> {\n templateData?: NegotiableQuoteTemplateModel;\n}\n\nexport const QuoteTemplateCommentsList: Container<QuoteTemplateCommentsListProps> = ({\n templateData: initialData,\n ...props\n}) => {\n const [templateData, setTemplateData] = useState<NegotiableQuoteTemplateModel | undefined>(initialData);\n\n useEffect(() => {\n const templateDataEvent = events.on('quote-management/quote-template-data', (data: { quoteTemplate: NegotiableQuoteTemplateModel }) => {\n setTemplateData(data.quoteTemplate);\n }, { eager: true });\n return () => templateDataEvent?.off();\n }, []);\n\n if (!templateData) {\n return null;\n }\n\n // Format comments data\n const formattedComments = templateData?.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-template-comments-list-container\"\n {...props}\n comments={formattedComments || []}\n />\n );\n};\n"],"names":["QuoteTemplateCommentsList","initialData","props","templateData","setTemplateData","useState","useEffect","templateDataEvent","events","data","formattedComments","_a","comment","jsx","QuoteCommentsListComponent"],"mappings":"kRAoBO,MAAMA,EAAuE,CAAC,CACnF,aAAcC,EACd,GAAGC,CACL,IAAM,OACJ,KAAM,CAACC,EAAcC,CAAe,EAAIC,EAAmDJ,CAAW,EAStG,GAPAK,EAAU,IAAM,CACd,MAAMC,EAAoBC,EAAO,GAAG,uCAAyCC,GAA0D,CACrIL,EAAgBK,EAAK,aAAa,CACpC,EAAG,CAAE,MAAO,GAAM,EAClB,MAAO,IAAMF,GAAA,YAAAA,EAAmB,KAClC,EAAG,CAAA,CAAE,EAED,CAACJ,EACH,OAAO,KAIT,MAAMO,GAAoBC,EAAAR,GAAA,YAAAA,EAAc,WAAd,YAAAQ,EAAwB,IAAKC,IAAa,CAClE,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,yCACX,GAAGZ,EACJ,SAAUQ,GAAqB,CAAA,CAAC,CAAA,CAGtC"}
@@ -1,27 +1,26 @@
1
1
  /*! Copyright 2025 Adobe
2
2
  All Rights Reserved. */
3
- import{events as l}from"@dropins/tools/event-bus.js";import{a as p}from"./transform-quote-template.js";import{s as r}from"./state.js";import{N as u}from"./NegotiableQuoteTemplateFragment.js";import{f as d}from"./transform-quote.js";const s=`
3
+ import{events as i}from"@dropins/tools/event-bus.js";import{a as p}from"./transform-quote-template.js";import{s as r}from"./state.js";import{N as c}from"./NegotiableQuoteTemplateFragment.js";import{f as l}from"./transform-quote.js";const u=`
4
4
  mutation SEND_QUOTE_TEMPLATE_FOR_REVIEW_MUTATION(
5
5
  $templateId: ID!
6
6
  $comment: String
7
7
  $name: String
8
8
  $referenceDocumentLinks: [NegotiableQuoteTemplateReferenceDocumentLinkInput]
9
- $attachments: [NegotiableQuoteCommentAttachmentInput]
10
9
  ) {
11
- submitNegotiableQuoteTemplateForReview(input: { template_id: $templateId, name: $name, comment: $comment, reference_document_links: $referenceDocumentLinks, attachments: $attachments }) {
10
+ submitNegotiableQuoteTemplateForReview(input: { template_id: $templateId, name: $name, comment: $comment, reference_document_links: $referenceDocumentLinks }) {
12
11
  ...NegotiableQuoteTemplateFragment
13
12
  }
14
13
  }
15
- ${u}
16
- `,q=async t=>{var o,e,a;if(!t.templateId)throw new Error("Template ID is required");if(!r.authenticated)throw new Error("Unauthorized");try{const n=(o=t.referenceDocumentLinks)==null?void 0:o.map(m=>({link_id:m.uid,document_name:m.name,document_identifier:m.identifier,reference_document_url:m.url})),i=(e=t.attachments)!=null&&e.length?t.attachments.map(m=>({key:m.key})):void 0,c=await d(s,{variables:{templateId:t.templateId,name:t.name,comment:t.comment||void 0,referenceDocumentLinks:n,attachments:i}});if(!((a=c==null?void 0:c.data)!=null&&a.submitNegotiableQuoteTemplateForReview))throw new Error("No quote template data received");const T=p(c.data.submitNegotiableQuoteTemplateForReview);if(!T)throw new Error("Failed to transform quote template data");return l.emit("quote-management/quote-template-data",{quoteTemplate:T,permissions:r.permissions}),T}catch(n){return Promise.reject(n)}},E=`
14
+ ${c}
15
+ `,Q=async t=>{var o,e;if(!t.templateId)throw new Error("Template ID is required");if(!r.authenticated)throw new Error("Unauthorized");try{const a=(o=t.referenceDocumentLinks)==null?void 0:o.map(d=>({link_id:d.uid,document_name:d.name,document_identifier:d.identifier,reference_document_url:d.url})),n=await l(u,{variables:{templateId:t.templateId,name:t.name,comment:t.comment,referenceDocumentLinks:a}});if(!((e=n==null?void 0:n.data)!=null&&e.submitNegotiableQuoteTemplateForReview))throw new Error("No quote template data received");const m=p(n.data.submitNegotiableQuoteTemplateForReview);if(!m)throw new Error("Failed to transform quote template data");return i.emit("quote-management/quote-template-data",{quoteTemplate:m,permissions:r.permissions}),m}catch(a){return Promise.reject(a)}},T=`
17
16
  mutation ACCEPT_QUOTE_TEMPLATE_MUTATION($templateId: ID!) {
18
17
  acceptNegotiableQuoteTemplate(input: { template_id: $templateId }) {
19
18
  ...NegotiableQuoteTemplateFragment
20
19
  }
21
20
  }
22
21
 
23
- ${u}
24
- `,b=async t=>{var o;if(!t.templateId)throw new Error("Template ID is required");if(!r.authenticated)throw new Error("Unauthorized");try{const e=await d(E,{variables:{templateId:t.templateId}});if(!((o=e==null?void 0:e.data)!=null&&o.acceptNegotiableQuoteTemplate))throw new Error("No quote template data received");const a=p(e.data.acceptNegotiableQuoteTemplate);if(!a)throw new Error("Failed to transform quote template data");return l.emit("quote-management/quote-template-data",{quoteTemplate:a,permissions:r.permissions}),a}catch(e){return Promise.reject(e)}},I=`
22
+ ${c}
23
+ `,g=async t=>{var o;if(!t.templateId)throw new Error("Template ID is required");if(!r.authenticated)throw new Error("Unauthorized");try{const e=await l(T,{variables:{templateId:t.templateId}});if(!((o=e==null?void 0:e.data)!=null&&o.acceptNegotiableQuoteTemplate))throw new Error("No quote template data received");const a=p(e.data.acceptNegotiableQuoteTemplate);if(!a)throw new Error("Failed to transform quote template data");return i.emit("quote-management/quote-template-data",{quoteTemplate:a,permissions:r.permissions}),a}catch(e){return Promise.reject(e)}},s=`
25
24
  mutation CANCEL_QUOTE_TEMPLATE_MUTATION(
26
25
  $templateId: ID!
27
26
  $comment: String
@@ -35,18 +34,18 @@ import{events as l}from"@dropins/tools/event-bus.js";import{a as p}from"./transf
35
34
  ...NegotiableQuoteTemplateFragment
36
35
  }
37
36
  }
38
- ${u}
39
- `,A=async t=>{var o;if(!t.templateId)throw new Error("Template ID is required");if(!r.authenticated)throw new Error("Unauthorized");try{const e=await d(I,{variables:{templateId:t.templateId,comment:t.comment}});if(!((o=e==null?void 0:e.data)!=null&&o.cancelNegotiableQuoteTemplate))throw new Error("No quote template data received");const a=p(e.data.cancelNegotiableQuoteTemplate);if(!a)throw new Error("Failed to transform quote template data");return l.emit("quote-management/quote-template-data",{quoteTemplate:a,permissions:r.permissions}),a}catch(e){return Promise.reject(e)}},_=`
37
+ ${c}
38
+ `,q=async t=>{var o;if(!t.templateId)throw new Error("Template ID is required");if(!r.authenticated)throw new Error("Unauthorized");try{const e=await l(s,{variables:{templateId:t.templateId,comment:t.comment}});if(!((o=e==null?void 0:e.data)!=null&&o.cancelNegotiableQuoteTemplate))throw new Error("No quote template data received");const a=p(e.data.cancelNegotiableQuoteTemplate);if(!a)throw new Error("Failed to transform quote template data");return i.emit("quote-management/quote-template-data",{quoteTemplate:a,permissions:r.permissions}),a}catch(e){return Promise.reject(e)}},E=`
40
39
  mutation DELETE_QUOTE_TEMPLATE_MUTATION($templateId: ID!) {
41
40
  deleteNegotiableQuoteTemplate(input: { template_id: $templateId })
42
41
  }
43
- `,O=async t=>{var o;if(!t.templateId)throw new Error("Template ID is required");if(!r.authenticated)throw new Error("Unauthorized");try{const e=await d(_,{variables:{templateId:t.templateId}});if(e!=null&&e.errors&&e.errors.length>0){const n=e.errors.map(i=>i==null?void 0:i.message).filter(Boolean).join("; ");throw new Error(n||"Failed to delete quote template")}if(!((o=e==null?void 0:e.data)==null?void 0:o.deleteNegotiableQuoteTemplate))throw new Error("Failed to delete quote template");return l.emit("quote-management/quote-template-deleted",{templateId:t.templateId}),{templateId:t.templateId}}catch(e){return Promise.reject(e)}},w=`
42
+ `,b=async t=>{var o;if(!t.templateId)throw new Error("Template ID is required");if(!r.authenticated)throw new Error("Unauthorized");try{const e=await l(E,{variables:{templateId:t.templateId}});if(e!=null&&e.errors&&e.errors.length>0){const n=e.errors.map(m=>m==null?void 0:m.message).filter(Boolean).join("; ");throw new Error(n||"Failed to delete quote template")}if(!((o=e==null?void 0:e.data)==null?void 0:o.deleteNegotiableQuoteTemplate))throw new Error("Failed to delete quote template");return i.emit("quote-management/quote-template-deleted",{templateId:t.templateId}),{templateId:t.templateId}}catch(e){return Promise.reject(e)}},I=`
44
43
  mutation OPEN_QUOTE_TEMPLATE_MUTATION($templateId: ID!) {
45
44
  openNegotiableQuoteTemplate(input: { template_id: $templateId }) {
46
45
  ...NegotiableQuoteTemplateFragment
47
46
  }
48
47
  }
49
48
 
50
- ${u}
51
- `,U=async t=>{var o;if(!t.templateId)throw new Error("Template ID is required");if(!r.authenticated)throw new Error("Unauthorized");try{const e=await d(w,{variables:{templateId:t.templateId}});if(!((o=e==null?void 0:e.data)!=null&&o.openNegotiableQuoteTemplate))throw new Error("No quote template data received");const a=p(e.data.openNegotiableQuoteTemplate);if(!a)throw new Error("Failed to transform quote template data");return l.emit("quote-management/quote-template-data",{quoteTemplate:a,permissions:r.permissions}),a}catch(e){return Promise.reject(e)}};export{b as a,A as c,O as d,U as o,q as s};
49
+ ${c}
50
+ `,A=async t=>{var o;if(!t.templateId)throw new Error("Template ID is required");if(!r.authenticated)throw new Error("Unauthorized");try{const e=await l(I,{variables:{templateId:t.templateId}});if(!((o=e==null?void 0:e.data)!=null&&o.openNegotiableQuoteTemplate))throw new Error("No quote template data received");const a=p(e.data.openNegotiableQuoteTemplate);if(!a)throw new Error("Failed to transform quote template data");return i.emit("quote-management/quote-template-data",{quoteTemplate:a,permissions:r.permissions}),a}catch(e){return Promise.reject(e)}};export{g as a,q as c,b as d,A as o,Q as s};
52
51
  //# sourceMappingURL=openQuoteTemplate.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"openQuoteTemplate.js","sources":["/@dropins/storefront-quote-management/src/api/sendQuoteTemplateForReview/graphql/sendQuoteTemplateForReview.ts","/@dropins/storefront-quote-management/src/api/sendQuoteTemplateForReview/sendQuoteTemplateForReview.ts","/@dropins/storefront-quote-management/src/api/acceptQuoteTemplate/graphql/acceptQuoteTemplate.ts","/@dropins/storefront-quote-management/src/api/acceptQuoteTemplate/acceptQuoteTemplate.ts","/@dropins/storefront-quote-management/src/api/cancelQuoteTemplate/graphql/cancelQuoteTemplate.ts","/@dropins/storefront-quote-management/src/api/cancelQuoteTemplate/cancelQuoteTemplate.ts","/@dropins/storefront-quote-management/src/api/deleteQuoteTemplate/graphql/deleteQuoteTemplate.ts","/@dropins/storefront-quote-management/src/api/deleteQuoteTemplate/deleteQuoteTemplate.ts","/@dropins/storefront-quote-management/src/api/openQuoteTemplate/graphql/openQuoteTemplate.ts","/@dropins/storefront-quote-management/src/api/openQuoteTemplate/openQuoteTemplate.ts"],"sourcesContent":["/********************************************************************\n * Copyright 2025 Adobe\n * All Rights Reserved.\n *\n * NOTICE: Adobe permits you to use, modify, and distribute this \n * file in accordance with the terms of the Adobe license agreement \n * accompanying it. \n *******************************************************************/\n\nimport { NEGOTIABLE_QUOTE_TEMPLATE_FRAGMENT } from '@/quote-management/api/graphql/NegotiableQuoteTemplateFragment';\n\nexport const SEND_QUOTE_TEMPLATE_FOR_REVIEW_MUTATION = /* GraphQL */ `\n mutation SEND_QUOTE_TEMPLATE_FOR_REVIEW_MUTATION(\n $templateId: ID!\n $comment: String\n $name: String\n $referenceDocumentLinks: [NegotiableQuoteTemplateReferenceDocumentLinkInput]\n $attachments: [NegotiableQuoteCommentAttachmentInput]\n ) {\n submitNegotiableQuoteTemplateForReview(input: { template_id: $templateId, name: $name, comment: $comment, reference_document_links: $referenceDocumentLinks, attachments: $attachments }) {\n ...NegotiableQuoteTemplateFragment\n }\n }\n ${NEGOTIABLE_QUOTE_TEMPLATE_FRAGMENT}\n`;\n","/********************************************************************\n * Copyright 2025 Adobe\n * All Rights Reserved.\n *\n * NOTICE: Adobe permits you to use, modify, and distribute this\n * file in accordance with the terms of the Adobe license agreement\n * accompanying it.\n *******************************************************************/\n\nimport { fetchGraphQl } from '@/quote-management/api';\nimport { SEND_QUOTE_TEMPLATE_FOR_REVIEW_MUTATION } from './graphql/sendQuoteTemplateForReview';\nimport { transformQuoteTemplate } from '@/quote-management/data/transforms';\nimport { state } from '@/quote-management/lib/state';\nimport { events } from '@adobe-commerce/event-bus';\n\nexport interface ReferenceDocumentLinkInput {\n uid?: string;\n name: string;\n identifier?: string;\n url: string;\n}\n\nexport interface SendQuoteTemplateForReviewParams {\n templateId: string;\n name?: string;\n comment?: string;\n referenceDocumentLinks?: ReferenceDocumentLinkInput[];\n attachments?: { key: string }[];\n}\n\nexport const sendQuoteTemplateForReview = async (\n params: SendQuoteTemplateForReviewParams\n) => {\n if (!params.templateId) {\n throw new Error('Template ID is required');\n }\n\n if (!state.authenticated) {\n throw new Error('Unauthorized');\n }\n\n try {\n // Transform reference document links from camelCase to snake_case for GraphQL\n const referenceDocumentLinks = params.referenceDocumentLinks?.map((link) => ({\n link_id: link.uid,\n document_name: link.name,\n document_identifier: link.identifier,\n reference_document_url: link.url,\n }));\n\n // Format attachments for GraphQL (separate field, not nested in comment)\n const attachments = params.attachments?.length \n ? params.attachments.map(att => ({ key: att.key }))\n : undefined;\n\n const results: any = await fetchGraphQl(\n SEND_QUOTE_TEMPLATE_FOR_REVIEW_MUTATION,\n {\n variables: {\n templateId: params.templateId,\n name: params.name,\n comment: params.comment || undefined,\n referenceDocumentLinks,\n attachments,\n },\n }\n );\n\n if (!results?.data?.submitNegotiableQuoteTemplateForReview) {\n throw new Error('No quote template data received');\n }\n\n const transformedData = transformQuoteTemplate(\n results.data.submitNegotiableQuoteTemplateForReview\n );\n\n if (!transformedData) {\n throw new Error('Failed to transform quote template data');\n }\n\n events.emit('quote-management/quote-template-data', {\n quoteTemplate: transformedData,\n permissions: state.permissions,\n });\n\n return transformedData;\n } catch (error) {\n return Promise.reject(error);\n }\n};\n","/********************************************************************\n * Copyright 2025 Adobe\n * All Rights Reserved.\n *\n * NOTICE: Adobe permits you to use, modify, and distribute this \n * file in accordance with the terms of the Adobe license agreement \n * accompanying it. \n *******************************************************************/\n\nimport { NEGOTIABLE_QUOTE_TEMPLATE_FRAGMENT } from '@/quote-management/api/graphql/NegotiableQuoteTemplateFragment';\n\nexport const ACCEPT_QUOTE_TEMPLATE_MUTATION = /* GraphQL */ `\n mutation ACCEPT_QUOTE_TEMPLATE_MUTATION($templateId: ID!) {\n acceptNegotiableQuoteTemplate(input: { template_id: $templateId }) {\n ...NegotiableQuoteTemplateFragment\n }\n }\n \n ${NEGOTIABLE_QUOTE_TEMPLATE_FRAGMENT}\n`;\n\n","/********************************************************************\n * Copyright 2025 Adobe\n * All Rights Reserved.\n *\n * NOTICE: Adobe permits you to use, modify, and distribute this\n * file in accordance with the terms of the Adobe license agreement\n * accompanying it.\n *******************************************************************/\n\nimport { fetchGraphQl } from '@/quote-management/api';\nimport { ACCEPT_QUOTE_TEMPLATE_MUTATION } from './graphql/acceptQuoteTemplate';\nimport { transformQuoteTemplate } from '@/quote-management/data/transforms';\nimport { state } from '@/quote-management/lib/state';\nimport { events } from '@adobe-commerce/event-bus';\n\nexport interface AcceptQuoteTemplateParams {\n templateId: string;\n}\n\nexport const acceptQuoteTemplate = async (\n params: AcceptQuoteTemplateParams\n) => {\n if (!params.templateId) {\n throw new Error('Template ID is required');\n }\n\n if (!state.authenticated) {\n throw new Error('Unauthorized');\n }\n\n try {\n const results: any = await fetchGraphQl(ACCEPT_QUOTE_TEMPLATE_MUTATION, {\n variables: { templateId: params.templateId },\n });\n\n if (!results?.data?.acceptNegotiableQuoteTemplate) {\n throw new Error('No quote template data received');\n }\n\n const transformedData = transformQuoteTemplate(\n results.data.acceptNegotiableQuoteTemplate\n );\n\n if (!transformedData) {\n throw new Error('Failed to transform quote template data');\n }\n\n events.emit('quote-management/quote-template-data', {\n quoteTemplate: transformedData,\n permissions: state.permissions,\n });\n\n return transformedData;\n } catch (error) {\n return Promise.reject(error);\n }\n};\n","/********************************************************************\n * Copyright 2025 Adobe\n * All Rights Reserved.\n *\n * NOTICE: Adobe permits you to use, modify, and distribute this\n * file in accordance with the terms of the Adobe license agreement\n * accompanying it.\n *******************************************************************/\n\nimport { NEGOTIABLE_QUOTE_TEMPLATE_FRAGMENT } from '@/quote-management/api/graphql/NegotiableQuoteTemplateFragment';\n\nexport const CANCEL_QUOTE_TEMPLATE_MUTATION = /* GraphQL */ `\n mutation CANCEL_QUOTE_TEMPLATE_MUTATION(\n $templateId: ID!\n $comment: String\n ) {\n cancelNegotiableQuoteTemplate(\n input: {\n template_id: $templateId\n cancellation_comment: $comment\n }\n ) {\n ...NegotiableQuoteTemplateFragment\n }\n }\n ${NEGOTIABLE_QUOTE_TEMPLATE_FRAGMENT}\n`;\n","/********************************************************************\n * Copyright 2025 Adobe\n * All Rights Reserved.\n *\n * NOTICE: Adobe permits you to use, modify, and distribute this\n * file in accordance with the terms of the Adobe license agreement\n * accompanying it.\n *******************************************************************/\n\nimport { fetchGraphQl } from '@/quote-management/api';\nimport { CANCEL_QUOTE_TEMPLATE_MUTATION } from './graphql/cancelQuoteTemplate';\nimport { transformQuoteTemplate } from '@/quote-management/data/transforms';\nimport { state } from '@/quote-management/lib/state';\nimport { events } from '@adobe-commerce/event-bus';\n\nexport interface CancelQuoteTemplateParams {\n templateId: string;\n comment?: string;\n}\n\nexport const cancelQuoteTemplate = async (\n params: CancelQuoteTemplateParams\n) => {\n if (!params.templateId) {\n throw new Error('Template ID is required');\n }\n\n if (!state.authenticated) {\n throw new Error('Unauthorized');\n }\n\n try {\n const results: any = await fetchGraphQl(CANCEL_QUOTE_TEMPLATE_MUTATION, {\n variables: { templateId: params.templateId, comment: params.comment },\n });\n\n if (!results?.data?.cancelNegotiableQuoteTemplate) {\n throw new Error('No quote template data received');\n }\n\n const transformedData = transformQuoteTemplate(\n results.data.cancelNegotiableQuoteTemplate\n );\n\n if (!transformedData) {\n throw new Error('Failed to transform quote template data');\n }\n\n events.emit('quote-management/quote-template-data', {\n quoteTemplate: transformedData,\n permissions: state.permissions,\n });\n\n return transformedData;\n } catch (error) {\n return Promise.reject(error);\n }\n};\n","/********************************************************************\n * Copyright 2025 Adobe\n * All Rights Reserved.\n *\n * NOTICE: Adobe permits you to use, modify, and distribute this\n * file in accordance with the terms of the Adobe license agreement\n * accompanying it.\n *******************************************************************/\n\nexport const DELETE_QUOTE_TEMPLATE_MUTATION = /* GraphQL */ `\n mutation DELETE_QUOTE_TEMPLATE_MUTATION($templateId: ID!) {\n deleteNegotiableQuoteTemplate(input: { template_id: $templateId })\n }\n`;\n\n","/********************************************************************\n * Copyright 2025 Adobe\n * All Rights Reserved.\n *\n * NOTICE: Adobe permits you to use, modify, and distribute this\n * file in accordance with the terms of the Adobe license agreement\n * accompanying it.\n *******************************************************************/\n\nimport { fetchGraphQl } from '@/quote-management/api';\nimport { DELETE_QUOTE_TEMPLATE_MUTATION } from './graphql/deleteQuoteTemplate';\nimport { state } from '@/quote-management/lib/state';\nimport { events } from '@adobe-commerce/event-bus';\n\nexport interface DeleteQuoteTemplateParams {\n templateId: string;\n}\n\nexport const deleteQuoteTemplate = async (\n params: DeleteQuoteTemplateParams\n) => {\n if (!params.templateId) {\n throw new Error('Template ID is required');\n }\n\n if (!state.authenticated) {\n throw new Error('Unauthorized');\n }\n\n try {\n const results: any = await fetchGraphQl(DELETE_QUOTE_TEMPLATE_MUTATION, {\n variables: { templateId: params.templateId },\n });\n\n if (results?.errors && results.errors.length > 0) {\n const errorMessages = results.errors\n .map((e: any) => e?.message)\n .filter(Boolean)\n .join('; ');\n throw new Error(errorMessages || 'Failed to delete quote template');\n }\n\n const deleted = results?.data?.deleteNegotiableQuoteTemplate;\n\n if (!deleted) {\n throw new Error('Failed to delete quote template');\n }\n\n events.emit('quote-management/quote-template-deleted', {\n templateId: params.templateId,\n });\n\n return { templateId: params.templateId };\n } catch (error) {\n return Promise.reject(error);\n }\n};\n","/********************************************************************\n * Copyright 2025 Adobe\n * All Rights Reserved.\n *\n * NOTICE: Adobe permits you to use, modify, and distribute this\n * file in accordance with the terms of the Adobe license agreement\n * accompanying it.\n *******************************************************************/\n\nimport { NEGOTIABLE_QUOTE_TEMPLATE_FRAGMENT } from '@/quote-management/api/graphql/NegotiableQuoteTemplateFragment';\n\nexport const OPEN_QUOTE_TEMPLATE_MUTATION = /* GraphQL */ `\n mutation OPEN_QUOTE_TEMPLATE_MUTATION($templateId: ID!) {\n openNegotiableQuoteTemplate(input: { template_id: $templateId }) {\n ...NegotiableQuoteTemplateFragment\n }\n }\n\n ${NEGOTIABLE_QUOTE_TEMPLATE_FRAGMENT}\n`;\n","/********************************************************************\n * Copyright 2025 Adobe\n * All Rights Reserved.\n *\n * NOTICE: Adobe permits you to use, modify, and distribute this\n * file in accordance with the terms of the Adobe license agreement\n * accompanying it.\n *******************************************************************/\n\nimport { fetchGraphQl } from '@/quote-management/api';\nimport { OPEN_QUOTE_TEMPLATE_MUTATION } from './graphql/openQuoteTemplate';\nimport { transformQuoteTemplate } from '@/quote-management/data/transforms';\nimport { state } from '@/quote-management/lib/state';\nimport { events } from '@adobe-commerce/event-bus';\n\nexport interface OpenQuoteTemplateParams {\n templateId: string;\n}\n\nexport const openQuoteTemplate = async (params: OpenQuoteTemplateParams) => {\n if (!params.templateId) {\n throw new Error('Template ID is required');\n }\n\n if (!state.authenticated) {\n throw new Error('Unauthorized');\n }\n\n try {\n const results: any = await fetchGraphQl(OPEN_QUOTE_TEMPLATE_MUTATION, {\n variables: { templateId: params.templateId },\n });\n\n if (!results?.data?.openNegotiableQuoteTemplate) {\n throw new Error('No quote template data received');\n }\n\n const transformedData = transformQuoteTemplate(\n results.data.openNegotiableQuoteTemplate\n );\n\n if (!transformedData) {\n throw new Error('Failed to transform quote template data');\n }\n\n events.emit('quote-management/quote-template-data', {\n quoteTemplate: transformedData,\n permissions: state.permissions,\n });\n\n return transformedData;\n } catch (error) {\n return Promise.reject(error);\n }\n};\n"],"names":["SEND_QUOTE_TEMPLATE_FOR_REVIEW_MUTATION","NEGOTIABLE_QUOTE_TEMPLATE_FRAGMENT","sendQuoteTemplateForReview","params","state","referenceDocumentLinks","_a","link","attachments","_b","att","results","fetchGraphQl","_c","transformedData","transformQuoteTemplate","events","error","ACCEPT_QUOTE_TEMPLATE_MUTATION","acceptQuoteTemplate","CANCEL_QUOTE_TEMPLATE_MUTATION","cancelQuoteTemplate","DELETE_QUOTE_TEMPLATE_MUTATION","deleteQuoteTemplate","errorMessages","e","OPEN_QUOTE_TEMPLATE_MUTATION","openQuoteTemplate"],"mappings":"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"}
1
+ {"version":3,"file":"openQuoteTemplate.js","sources":["/@dropins/storefront-quote-management/src/api/sendQuoteTemplateForReview/graphql/sendQuoteTemplateForReview.ts","/@dropins/storefront-quote-management/src/api/sendQuoteTemplateForReview/sendQuoteTemplateForReview.ts","/@dropins/storefront-quote-management/src/api/acceptQuoteTemplate/graphql/acceptQuoteTemplate.ts","/@dropins/storefront-quote-management/src/api/acceptQuoteTemplate/acceptQuoteTemplate.ts","/@dropins/storefront-quote-management/src/api/cancelQuoteTemplate/graphql/cancelQuoteTemplate.ts","/@dropins/storefront-quote-management/src/api/cancelQuoteTemplate/cancelQuoteTemplate.ts","/@dropins/storefront-quote-management/src/api/deleteQuoteTemplate/graphql/deleteQuoteTemplate.ts","/@dropins/storefront-quote-management/src/api/deleteQuoteTemplate/deleteQuoteTemplate.ts","/@dropins/storefront-quote-management/src/api/openQuoteTemplate/graphql/openQuoteTemplate.ts","/@dropins/storefront-quote-management/src/api/openQuoteTemplate/openQuoteTemplate.ts"],"sourcesContent":["/********************************************************************\n * Copyright 2025 Adobe\n * All Rights Reserved.\n *\n * NOTICE: Adobe permits you to use, modify, and distribute this \n * file in accordance with the terms of the Adobe license agreement \n * accompanying it. \n *******************************************************************/\n\nimport { NEGOTIABLE_QUOTE_TEMPLATE_FRAGMENT } from '@/quote-management/api/graphql/NegotiableQuoteTemplateFragment';\n\nexport const SEND_QUOTE_TEMPLATE_FOR_REVIEW_MUTATION = /* GraphQL */ `\n mutation SEND_QUOTE_TEMPLATE_FOR_REVIEW_MUTATION(\n $templateId: ID!\n $comment: String\n $name: String\n $referenceDocumentLinks: [NegotiableQuoteTemplateReferenceDocumentLinkInput]\n ) {\n submitNegotiableQuoteTemplateForReview(input: { template_id: $templateId, name: $name, comment: $comment, reference_document_links: $referenceDocumentLinks }) {\n ...NegotiableQuoteTemplateFragment\n }\n }\n ${NEGOTIABLE_QUOTE_TEMPLATE_FRAGMENT}\n`;\n","/********************************************************************\n * Copyright 2025 Adobe\n * All Rights Reserved.\n *\n * NOTICE: Adobe permits you to use, modify, and distribute this\n * file in accordance with the terms of the Adobe license agreement\n * accompanying it.\n *******************************************************************/\n\nimport { fetchGraphQl } from '@/quote-management/api';\nimport { SEND_QUOTE_TEMPLATE_FOR_REVIEW_MUTATION } from './graphql/sendQuoteTemplateForReview';\nimport { transformQuoteTemplate } from '@/quote-management/data/transforms';\nimport { state } from '@/quote-management/lib/state';\nimport { events } from '@adobe-commerce/event-bus';\n\nexport interface ReferenceDocumentLinkInput {\n uid?: string;\n name: string;\n identifier?: string;\n url: string;\n}\n\nexport interface SendQuoteTemplateForReviewParams {\n templateId: string;\n name?: string;\n comment?: string;\n referenceDocumentLinks?: ReferenceDocumentLinkInput[];\n}\n\nexport const sendQuoteTemplateForReview = async (\n params: SendQuoteTemplateForReviewParams\n) => {\n if (!params.templateId) {\n throw new Error('Template ID is required');\n }\n\n if (!state.authenticated) {\n throw new Error('Unauthorized');\n }\n\n try {\n // Transform reference document links from camelCase to snake_case for GraphQL\n const referenceDocumentLinks = params.referenceDocumentLinks?.map((link) => ({\n link_id: link.uid,\n document_name: link.name,\n document_identifier: link.identifier,\n reference_document_url: link.url,\n }));\n\n const results: any = await fetchGraphQl(\n SEND_QUOTE_TEMPLATE_FOR_REVIEW_MUTATION,\n {\n variables: {\n templateId: params.templateId,\n name: params.name,\n comment: params.comment,\n referenceDocumentLinks,\n },\n }\n );\n\n if (!results?.data?.submitNegotiableQuoteTemplateForReview) {\n throw new Error('No quote template data received');\n }\n\n const transformedData = transformQuoteTemplate(\n results.data.submitNegotiableQuoteTemplateForReview\n );\n\n if (!transformedData) {\n throw new Error('Failed to transform quote template data');\n }\n\n events.emit('quote-management/quote-template-data', {\n quoteTemplate: transformedData,\n permissions: state.permissions,\n });\n\n return transformedData;\n } catch (error) {\n return Promise.reject(error);\n }\n};\n","/********************************************************************\n * Copyright 2025 Adobe\n * All Rights Reserved.\n *\n * NOTICE: Adobe permits you to use, modify, and distribute this \n * file in accordance with the terms of the Adobe license agreement \n * accompanying it. \n *******************************************************************/\n\nimport { NEGOTIABLE_QUOTE_TEMPLATE_FRAGMENT } from '@/quote-management/api/graphql/NegotiableQuoteTemplateFragment';\n\nexport const ACCEPT_QUOTE_TEMPLATE_MUTATION = /* GraphQL */ `\n mutation ACCEPT_QUOTE_TEMPLATE_MUTATION($templateId: ID!) {\n acceptNegotiableQuoteTemplate(input: { template_id: $templateId }) {\n ...NegotiableQuoteTemplateFragment\n }\n }\n \n ${NEGOTIABLE_QUOTE_TEMPLATE_FRAGMENT}\n`;\n\n","/********************************************************************\n * Copyright 2025 Adobe\n * All Rights Reserved.\n *\n * NOTICE: Adobe permits you to use, modify, and distribute this\n * file in accordance with the terms of the Adobe license agreement\n * accompanying it.\n *******************************************************************/\n\nimport { fetchGraphQl } from '@/quote-management/api';\nimport { ACCEPT_QUOTE_TEMPLATE_MUTATION } from './graphql/acceptQuoteTemplate';\nimport { transformQuoteTemplate } from '@/quote-management/data/transforms';\nimport { state } from '@/quote-management/lib/state';\nimport { events } from '@adobe-commerce/event-bus';\n\nexport interface AcceptQuoteTemplateParams {\n templateId: string;\n}\n\nexport const acceptQuoteTemplate = async (\n params: AcceptQuoteTemplateParams\n) => {\n if (!params.templateId) {\n throw new Error('Template ID is required');\n }\n\n if (!state.authenticated) {\n throw new Error('Unauthorized');\n }\n\n try {\n const results: any = await fetchGraphQl(ACCEPT_QUOTE_TEMPLATE_MUTATION, {\n variables: { templateId: params.templateId },\n });\n\n if (!results?.data?.acceptNegotiableQuoteTemplate) {\n throw new Error('No quote template data received');\n }\n\n const transformedData = transformQuoteTemplate(\n results.data.acceptNegotiableQuoteTemplate\n );\n\n if (!transformedData) {\n throw new Error('Failed to transform quote template data');\n }\n\n events.emit('quote-management/quote-template-data', {\n quoteTemplate: transformedData,\n permissions: state.permissions,\n });\n\n return transformedData;\n } catch (error) {\n return Promise.reject(error);\n }\n};\n","/********************************************************************\n * Copyright 2025 Adobe\n * All Rights Reserved.\n *\n * NOTICE: Adobe permits you to use, modify, and distribute this\n * file in accordance with the terms of the Adobe license agreement\n * accompanying it.\n *******************************************************************/\n\nimport { NEGOTIABLE_QUOTE_TEMPLATE_FRAGMENT } from '@/quote-management/api/graphql/NegotiableQuoteTemplateFragment';\n\nexport const CANCEL_QUOTE_TEMPLATE_MUTATION = /* GraphQL */ `\n mutation CANCEL_QUOTE_TEMPLATE_MUTATION(\n $templateId: ID!\n $comment: String\n ) {\n cancelNegotiableQuoteTemplate(\n input: {\n template_id: $templateId\n cancellation_comment: $comment\n }\n ) {\n ...NegotiableQuoteTemplateFragment\n }\n }\n ${NEGOTIABLE_QUOTE_TEMPLATE_FRAGMENT}\n`;\n","/********************************************************************\n * Copyright 2025 Adobe\n * All Rights Reserved.\n *\n * NOTICE: Adobe permits you to use, modify, and distribute this\n * file in accordance with the terms of the Adobe license agreement\n * accompanying it.\n *******************************************************************/\n\nimport { fetchGraphQl } from '@/quote-management/api';\nimport { CANCEL_QUOTE_TEMPLATE_MUTATION } from './graphql/cancelQuoteTemplate';\nimport { transformQuoteTemplate } from '@/quote-management/data/transforms';\nimport { state } from '@/quote-management/lib/state';\nimport { events } from '@adobe-commerce/event-bus';\n\nexport interface CancelQuoteTemplateParams {\n templateId: string;\n comment?: string;\n}\n\nexport const cancelQuoteTemplate = async (\n params: CancelQuoteTemplateParams\n) => {\n if (!params.templateId) {\n throw new Error('Template ID is required');\n }\n\n if (!state.authenticated) {\n throw new Error('Unauthorized');\n }\n\n try {\n const results: any = await fetchGraphQl(CANCEL_QUOTE_TEMPLATE_MUTATION, {\n variables: { templateId: params.templateId, comment: params.comment },\n });\n\n if (!results?.data?.cancelNegotiableQuoteTemplate) {\n throw new Error('No quote template data received');\n }\n\n const transformedData = transformQuoteTemplate(\n results.data.cancelNegotiableQuoteTemplate\n );\n\n if (!transformedData) {\n throw new Error('Failed to transform quote template data');\n }\n\n events.emit('quote-management/quote-template-data', {\n quoteTemplate: transformedData,\n permissions: state.permissions,\n });\n\n return transformedData;\n } catch (error) {\n return Promise.reject(error);\n }\n};\n","/********************************************************************\n * Copyright 2025 Adobe\n * All Rights Reserved.\n *\n * NOTICE: Adobe permits you to use, modify, and distribute this\n * file in accordance with the terms of the Adobe license agreement\n * accompanying it.\n *******************************************************************/\n\nexport const DELETE_QUOTE_TEMPLATE_MUTATION = /* GraphQL */ `\n mutation DELETE_QUOTE_TEMPLATE_MUTATION($templateId: ID!) {\n deleteNegotiableQuoteTemplate(input: { template_id: $templateId })\n }\n`;\n\n","/********************************************************************\n * Copyright 2025 Adobe\n * All Rights Reserved.\n *\n * NOTICE: Adobe permits you to use, modify, and distribute this\n * file in accordance with the terms of the Adobe license agreement\n * accompanying it.\n *******************************************************************/\n\nimport { fetchGraphQl } from '@/quote-management/api';\nimport { DELETE_QUOTE_TEMPLATE_MUTATION } from './graphql/deleteQuoteTemplate';\nimport { state } from '@/quote-management/lib/state';\nimport { events } from '@adobe-commerce/event-bus';\n\nexport interface DeleteQuoteTemplateParams {\n templateId: string;\n}\n\nexport const deleteQuoteTemplate = async (\n params: DeleteQuoteTemplateParams\n) => {\n if (!params.templateId) {\n throw new Error('Template ID is required');\n }\n\n if (!state.authenticated) {\n throw new Error('Unauthorized');\n }\n\n try {\n const results: any = await fetchGraphQl(DELETE_QUOTE_TEMPLATE_MUTATION, {\n variables: { templateId: params.templateId },\n });\n\n if (results?.errors && results.errors.length > 0) {\n const errorMessages = results.errors\n .map((e: any) => e?.message)\n .filter(Boolean)\n .join('; ');\n throw new Error(errorMessages || 'Failed to delete quote template');\n }\n\n const deleted = results?.data?.deleteNegotiableQuoteTemplate;\n\n if (!deleted) {\n throw new Error('Failed to delete quote template');\n }\n\n events.emit('quote-management/quote-template-deleted', {\n templateId: params.templateId,\n });\n\n return { templateId: params.templateId };\n } catch (error) {\n return Promise.reject(error);\n }\n};\n","/********************************************************************\n * Copyright 2025 Adobe\n * All Rights Reserved.\n *\n * NOTICE: Adobe permits you to use, modify, and distribute this\n * file in accordance with the terms of the Adobe license agreement\n * accompanying it.\n *******************************************************************/\n\nimport { NEGOTIABLE_QUOTE_TEMPLATE_FRAGMENT } from '@/quote-management/api/graphql/NegotiableQuoteTemplateFragment';\n\nexport const OPEN_QUOTE_TEMPLATE_MUTATION = /* GraphQL */ `\n mutation OPEN_QUOTE_TEMPLATE_MUTATION($templateId: ID!) {\n openNegotiableQuoteTemplate(input: { template_id: $templateId }) {\n ...NegotiableQuoteTemplateFragment\n }\n }\n\n ${NEGOTIABLE_QUOTE_TEMPLATE_FRAGMENT}\n`;\n","/********************************************************************\n * Copyright 2025 Adobe\n * All Rights Reserved.\n *\n * NOTICE: Adobe permits you to use, modify, and distribute this\n * file in accordance with the terms of the Adobe license agreement\n * accompanying it.\n *******************************************************************/\n\nimport { fetchGraphQl } from '@/quote-management/api';\nimport { OPEN_QUOTE_TEMPLATE_MUTATION } from './graphql/openQuoteTemplate';\nimport { transformQuoteTemplate } from '@/quote-management/data/transforms';\nimport { state } from '@/quote-management/lib/state';\nimport { events } from '@adobe-commerce/event-bus';\n\nexport interface OpenQuoteTemplateParams {\n templateId: string;\n}\n\nexport const openQuoteTemplate = async (params: OpenQuoteTemplateParams) => {\n if (!params.templateId) {\n throw new Error('Template ID is required');\n }\n\n if (!state.authenticated) {\n throw new Error('Unauthorized');\n }\n\n try {\n const results: any = await fetchGraphQl(OPEN_QUOTE_TEMPLATE_MUTATION, {\n variables: { templateId: params.templateId },\n });\n\n if (!results?.data?.openNegotiableQuoteTemplate) {\n throw new Error('No quote template data received');\n }\n\n const transformedData = transformQuoteTemplate(\n results.data.openNegotiableQuoteTemplate\n );\n\n if (!transformedData) {\n throw new Error('Failed to transform quote template data');\n }\n\n events.emit('quote-management/quote-template-data', {\n quoteTemplate: transformedData,\n permissions: state.permissions,\n });\n\n return transformedData;\n } catch (error) {\n return Promise.reject(error);\n }\n};\n"],"names":["SEND_QUOTE_TEMPLATE_FOR_REVIEW_MUTATION","NEGOTIABLE_QUOTE_TEMPLATE_FRAGMENT","sendQuoteTemplateForReview","params","state","referenceDocumentLinks","_a","link","results","fetchGraphQl","_b","transformedData","transformQuoteTemplate","events","error","ACCEPT_QUOTE_TEMPLATE_MUTATION","acceptQuoteTemplate","CANCEL_QUOTE_TEMPLATE_MUTATION","cancelQuoteTemplate","DELETE_QUOTE_TEMPLATE_MUTATION","deleteQuoteTemplate","errorMessages","e","OPEN_QUOTE_TEMPLATE_MUTATION","openQuoteTemplate"],"mappings":"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"}
@@ -14,8 +14,6 @@ export interface ManageNegotiableQuoteTemplateProps extends Omit<HTMLAttributes<
14
14
  shippingInformation?: VNode;
15
15
  commentsTitle: VNode;
16
16
  comments: VNode;
17
- attachFilesField?: VNode;
18
- attachedFilesList?: VNode;
19
17
  footer?: VNode;
20
18
  }
21
19
  export declare const ManageNegotiableQuoteTemplate: FunctionComponent<ManageNegotiableQuoteTemplateProps>;
@@ -1,7 +1,7 @@
1
1
  import { HTMLAttributes } from 'preact/compat';
2
2
  import { Container, SlotProps } from '@dropins/tools/types/elsie/src/lib';
3
3
  import { NegotiableQuoteTemplateModel } from '../../data/models/negotiable-quote-template-model';
4
- import { ReferenceDocument, AttachedFile } from '../../components';
4
+ import { ReferenceDocument } from '../../components';
5
5
  import { ReferenceDocumentLinkInput } from '../../api';
6
6
 
7
7
  export interface ManageNegotiableQuoteTemplateProps extends HTMLAttributes<HTMLDivElement> {
@@ -11,11 +11,7 @@ export interface ManageNegotiableQuoteTemplateProps extends HTMLAttributes<HTMLD
11
11
  name?: string;
12
12
  comment?: string;
13
13
  referenceDocumentLinks?: ReferenceDocumentLinkInput[];
14
- attachments?: AttachedFile[];
15
14
  }) => void;
16
- maxFiles?: number;
17
- maxFileSize?: number;
18
- acceptedFileTypes?: string[];
19
15
  slots?: {
20
16
  TemplateName?: SlotProps<{
21
17
  templateName?: string;
@@ -63,19 +59,6 @@ export interface ManageNegotiableQuoteTemplateProps extends HTMLAttributes<HTMLD
63
59
  Comments?: SlotProps<{
64
60
  templateData?: NegotiableQuoteTemplateModel;
65
61
  }>;
66
- AttachFilesField?: SlotProps<{
67
- templateData?: NegotiableQuoteTemplateModel;
68
- onFileChange: (files: File[]) => void;
69
- attachedFiles: AttachedFile[];
70
- fileUploadError: string | undefined;
71
- disabled: boolean;
72
- }>;
73
- AttachedFilesList?: SlotProps<{
74
- templateData?: NegotiableQuoteTemplateModel;
75
- files: AttachedFile[];
76
- onRemove: (key: string) => void;
77
- disabled: boolean;
78
- }>;
79
62
  HistoryLogTitle?: SlotProps<{
80
63
  templateData?: NegotiableQuoteTemplateModel;
81
64
  }>;
@@ -86,7 +69,6 @@ export interface ManageNegotiableQuoteTemplateProps extends HTMLAttributes<HTMLD
86
69
  templateData?: NegotiableQuoteTemplateModel;
87
70
  comment?: string;
88
71
  isSubmitting?: boolean;
89
- attachedFiles?: AttachedFile[];
90
72
  referenceDocuments?: ReferenceDocument[];
91
73
  hasUnsavedChanges?: boolean;
92
74
  handleSendForReview: () => void;
@@ -1,6 +1,6 @@
1
1
  /*! Copyright 2025 Adobe
2
2
  All Rights Reserved. */
3
- import{jsx as a,jsxs as p,Fragment as Re}from"@dropins/tools/preact-jsx-runtime.js";import{useState as m,useEffect as ue,useCallback as s,useMemo as M,useRef as $a,createPortal as O}from"@dropins/tools/preact-compat.js";import{classes as u,VComponent as D,Slot as R}from"@dropins/tools/lib.js";import{f as na}from"../chunks/dateUtils.js";import{events as Ga}from"@dropins/tools/event-bus.js";import{Skeleton as Pa,SkeletonRow as $,InLineAlert as L,Modal as ja,Input as _e,Button as A,TextArea as Ka,InputFile as Va,Icon as se}from"@dropins/tools/components.js";import{N as ta}from"../chunks/transform-quote-template.js";import{S as Ja,A as Xa,T as Ya,R as Za}from"../chunks/RenameQuoteModal.js";import{v as en,f as an,a as nn,S as tn,A as rn}from"../chunks/AttachedFilesList.js";/* empty css */import"@dropins/tools/preact.js";import"@dropins/tools/preact-hooks.js";import{C as de}from"../chunks/ConfirmationModal.js";/* empty css *//* empty css */import{S as G}from"../chunks/WarningFilled.js";import{useText as Se}from"@dropins/tools/i18n.js";import"../chunks/state.js";import{u as on}from"../chunks/uploadFile.js";import{d as cn,c as ln,s as mn,a as sn,o as dn}from"../chunks/openQuoteTemplate.js";import{g as un}from"../chunks/generateQuoteFromTemplate.js";import{S as gn}from"../chunks/ShippingAddressDisplay.js";import{I as fn}from"../chunks/ItemsQuotedTemplate.js";import{Q as pn}from"../chunks/QuoteTemplateCommentsList.js";import{Q as bn}from"../chunks/QuoteTemplateHistoryLog.js";import{S as ye}from"../chunks/CheckWithCircle.js";import"../chunks/transform-quote.js";import"@dropins/tools/fetch-graphql.js";import"../chunks/NegotiableQuoteTemplateFragment.js";import"../chunks/LineItemNoteModal.js";import"../chunks/addQuoteTemplateLineItemNote.js";import"../chunks/QuoteCommentsList.js";import"../chunks/QuoteHistoryLog.js";const hn=({className:n,loading:f,templateName:l,templateStatus:T,banner:C,details:h,actionBar:S,referenceDocuments:e,itemsTable:_,shippingInformationTitle:c,shippingInformation:o,commentsTitle:N,comments:b,attachFilesField:d,attachedFilesList:y,footer:E,...Q})=>f?a(Mn,{}):p("div",{...Q,className:u(["quote-management-manage-negotiable-quote-template",n]),children:[p("div",{className:u(["quote-management-manage-negotiable-quote-template__header"]),children:[l&&a(D,{node:l,className:u(["quote-management-manage-negotiable-quote-template__template-name"])}),T&&a(D,{node:T,className:u(["quote-management-manage-negotiable-quote-template__template-status"])})]}),C&&a(D,{node:C,className:u(["quote-management-manage-negotiable-quote-template__banner"])}),h&&a(D,{node:h,className:u(["quote-management-manage-negotiable-quote-template__details"])}),S&&a(D,{node:S,className:u(["quote-management-manage-negotiable-quote-template__action-bar"])}),e&&a("div",{"data-testid":"reference-documents-container",className:u(["quote-management-manage-negotiable-quote-template__reference-documents-container"]),children:a(D,{node:e,className:u(["quote-management-manage-negotiable-quote-template__reference-documents"])})}),_&&a(D,{node:_,className:u(["quote-management-manage-negotiable-quote-template__items-table"])}),p("div",{"data-testid":"template-shipping-information-container",className:u(["quote-management-manage-negotiable-quote-template__shipping-information-container"]),children:[c&&a(D,{node:c,className:u(["quote-management-manage-negotiable-quote-template__shipping-information-title"])}),o&&a(D,{node:o,className:u(["quote-management-manage-negotiable-quote-template__shipping-information"])})]}),p("div",{"data-testid":"comments-container",className:u(["quote-management-manage-negotiable-quote-template__comments-container"]),children:[N&&a(D,{node:N,className:u(["quote-management-manage-negotiable-quote-template__comments-title"])}),b&&a(D,{node:b,className:u(["quote-management-manage-negotiable-quote-template__comments"])}),d&&a(D,{node:d,className:u(["quote-management-manage-negotiable-quote-template__attach-files-field"])}),y&&a(D,{node:y,className:u(["quote-management-manage-negotiable-quote-template__attached-files-list"])})]}),E&&a(D,{node:E,className:u(["quote-management-manage-negotiable-quote-template__footer"])})]}),Mn=()=>p(Pa,{"data-testid":"manage-negotiable-quote-template-skeleton",children:[a($,{variant:"heading",fullWidth:!0,size:"large"}),a($,{variant:"row",fullWidth:!1,size:"small"}),a($,{variant:"row",fullWidth:!1,size:"small"}),a($,{variant:"row",fullWidth:!0}),a($,{variant:"row",fullWidth:!0,size:"xlarge",lines:2}),a($,{variant:"row",fullWidth:!1,size:"small"})]}),Nn=({className:n,open:f,document:l,errorMessage:T,errorBanner:C,successBanner:h,showCloseButton:S=!0,isSubmitting:e=!1,onSave:_,onClose:c})=>{const[o,N]=m(""),[b,d]=m(""),[y,E]=m(""),[Q,w]=m({}),v=Se({title:"NegotiableQuoteTemplate.Manage.referenceDocuments.form.title",documentNameLabel:"NegotiableQuoteTemplate.Manage.referenceDocuments.form.documentNameLabel",documentIdentifierLabel:"NegotiableQuoteTemplate.Manage.referenceDocuments.form.documentIdentifierLabel",referenceUrlLabel:"NegotiableQuoteTemplate.Manage.referenceDocuments.form.referenceUrlLabel",addButton:"NegotiableQuoteTemplate.Manage.referenceDocuments.form.addButton",updateButton:"NegotiableQuoteTemplate.Manage.referenceDocuments.form.updateButton",cancelButton:"NegotiableQuoteTemplate.Manage.referenceDocuments.form.cancelButton",documentNameRequired:"NegotiableQuoteTemplate.Manage.referenceDocuments.form.documentNameRequired",documentIdentifierRequired:"NegotiableQuoteTemplate.Manage.referenceDocuments.form.documentIdentifierRequired",referenceUrlRequired:"NegotiableQuoteTemplate.Manage.referenceDocuments.form.referenceUrlRequired",invalidUrl:"NegotiableQuoteTemplate.Manage.referenceDocuments.form.invalidUrl",errorHeading:"NegotiableQuoteTemplate.Manage.referenceDocuments.form.errorHeading"}),z=C||(T?a(L,{type:"error",variant:"primary",icon:a(G,{}),heading:v.errorHeading,description:T,"data-testid":"reference-document-form-modal-error-banner-inline"}):null),B=!!l;ue(()=>{f&&(l?(N(l.name||""),d(l.identifier||""),E(l.url||"")):(N(""),d(""),E("")),w({}))},[f,l]);const F=s(q=>{if(!q.trim())return!1;try{return new URL(q),!0}catch{return!1}},[]),P=s(()=>{const q={};if(o.trim()||(q.documentName=v.documentNameRequired),y.trim()?F(y.trim())||(q.referenceUrl=v.invalidUrl):q.referenceUrl=v.referenceUrlRequired,b.trim()||(q.documentIdentifier=v.documentIdentifierRequired),Object.keys(q).length>0){w(q);return}_({uid:l==null?void 0:l.uid,name:o.trim(),identifier:b.trim(),url:y.trim()})},[o,b,y,l,v,F,_]),j=s(()=>{N(""),d(""),E(""),w({}),c==null||c()},[c]);return f?p(ja,{open:f,size:"medium",title:a(Re,{children:v.title}),onClose:j,clickToDismiss:!0,escapeToDismiss:!0,showCloseButton:S,className:u(["quote-management-reference-document-form-modal",n]),"data-testid":"reference-document-form-modal",children:[z&&a("div",{className:u(["quote-management-reference-document-form-modal__error-banner"]),"data-testid":"reference-document-form-modal-error-banner",children:z}),h&&a("div",{className:u(["quote-management-reference-document-form-modal__success-banner"]),"data-testid":"reference-document-form-modal-success-banner",children:h}),p("div",{className:u(["quote-management-reference-document-form-modal__content"]),children:[p("div",{children:[a(_e,{name:"documentName",type:"text",value:o,onInput:q=>{N(q.target.value),w({...Q,documentName:void 0})},floatingLabel:v.documentNameLabel,required:!0,error:!!Q.documentName,disabled:e,"data-testid":"reference-document-name-input"}),Q.documentName&&a("span",{className:u(["quote-management-reference-document-form-modal__error-text"]),"data-testid":"reference-document-name-error",children:Q.documentName})]}),p("div",{children:[a(_e,{name:"documentIdentifier",type:"text",value:b,onInput:q=>{d(q.target.value),w({...Q,documentIdentifier:void 0})},floatingLabel:v.documentIdentifierLabel,error:!!Q.documentIdentifier,disabled:e,"data-testid":"reference-document-identifier-input"}),Q.documentIdentifier&&a("span",{className:u(["quote-management-reference-document-form-modal__error-text"]),"data-testid":"reference-document-identifier-error",children:Q.documentIdentifier})]}),p("div",{children:[a(_e,{name:"referenceUrl",type:"url",value:y,onInput:q=>{E(q.target.value),w({...Q,referenceUrl:void 0})},floatingLabel:v.referenceUrlLabel,required:!0,error:!!Q.referenceUrl,disabled:e,"data-testid":"reference-document-url-input"}),Q.referenceUrl&&a("span",{className:u(["quote-management-reference-document-form-modal__error-text"]),"data-testid":"reference-document-url-error",children:Q.referenceUrl})]})]}),p("div",{className:u(["quote-management-reference-document-form-modal__actions"]),children:[a(A,{variant:"secondary",size:"medium",onClick:j,disabled:e,className:u(["quote-management-reference-document-form-modal__cancel-button"]),"data-testid":"reference-document-form-cancel-button",children:v.cancelButton}),a(A,{variant:"primary",size:"medium",onClick:P,disabled:e,className:u(["quote-management-reference-document-form-modal__save-button"]),"data-testid":"reference-document-form-save-button",children:B?v.updateButton:v.addButton})]})]}):null},Tn=({className:n,documents:f,isEditable:l=!1,onAdd:T,onEdit:C,onRemove:h,...S})=>{const e=Se({add:"NegotiableQuoteTemplate.Manage.referenceDocuments.add",edit:"NegotiableQuoteTemplate.Manage.referenceDocuments.edit",remove:"NegotiableQuoteTemplate.Manage.referenceDocuments.remove",noReferenceDocuments:"NegotiableQuoteTemplate.Manage.referenceDocuments.noReferenceDocuments"}),_=o=>o.identifier?`${o.name}, ${o.identifier}`:`${o.name} ${o.url}`,c=(o,N)=>{o.preventDefault(),window.open(N,"_blank","noopener,noreferrer")};return a("div",{className:u(["quote-management-reference-documents-list",n]),"data-testid":"reference-documents-list",...S,children:p("div",{className:"quote-management-reference-documents-list__content",children:[f.map(o=>p("div",{className:"quote-management-reference-documents-list__document","data-testid":`reference-document-${o.uid||o.url}`,children:[a("a",{href:o.url,onClick:N=>c(N,o.url),className:"quote-management-reference-documents-list__document-link",target:"_blank",rel:"noopener noreferrer","data-testid":`reference-document-link-${o.uid||o.url}`,children:_(o)}),l&&p("div",{className:"quote-management-reference-documents-list__document-actions",children:[a(A,{variant:"tertiary",onClick:()=>C==null?void 0:C(o),className:"quote-management-reference-documents-list__edit-button","data-testid":`reference-document-edit-${o.uid||o.url}`,children:e.edit}),a("span",{className:"quote-management-reference-documents-list__separator",children:"|"}),a(A,{variant:"tertiary",onClick:()=>h==null?void 0:h(o),className:"quote-management-reference-documents-list__remove-button","data-testid":`reference-document-remove-${o.uid||o.url}`,children:e.remove})]})]},o.uid||o.url)),l&&p(A,{variant:"tertiary",onClick:T,className:"quote-management-reference-documents-list__add-button","data-testid":"reference-documents-add-button",children:["+ ",e.add]}),f.length===0&&!l&&a("div",{className:"quote-management-reference-documents-list__empty",children:e.noReferenceDocuments})]})})},Qn=n=>{const{templateReferenceDocuments:f,localReferenceDocuments:l}=n,T=s(c=>{if(f)return f.find(o=>c.uid&&o.uid?o.uid===c.uid:o.url===c.url)},[f]),C=s(c=>T(c)!==void 0,[T]),h=s((c,o)=>c.name!==o.name||c.identifier!==o.identifier||c.url!==o.url,[]),S=s(()=>f?l.filter(c=>!f.some(o=>c.uid&&o.uid?o.uid===c.uid:o.url===c.url)):l,[f,l]),e=s(()=>l.map(c=>({uid:c.uid,name:c.name,identifier:c.identifier,url:c.url})),[l]),_=M(()=>f?l.some(b=>T(b)===void 0)||f.some(b=>!l.some(d=>d.uid&&b.uid?d.uid===b.uid:d.url===b.url))?!0:l.some(b=>{const d=T(b);return d?h(b,d):!1}):l.length>0,[f,l,T,h]);return{isDocumentInTemplateData:C,getNewDocuments:S,getReferenceDocumentLinks:e,hasUnsavedChanges:_}},vn=(n={})=>{const{initialTemplateName:f,templateNameRequiredErrorMessage:l="Template name is required"}=n,[T,C]=m(!1),[h,S]=m(""),[e,_]=m(""),[c,o]=m(""),[N,b]=m(""),[d,y]=m(""),E=s(F=>{S(F||f||""),_(""),o(""),b(""),y(""),C(!0)},[f]),Q=s(()=>{C(!1),S(""),_(""),o(""),b(""),y("")},[]),w=s(F=>{S(F),F.trim()&&b("")},[]),v=s(F=>{_(F)},[]),z=s(()=>h.trim()?(o(""),b(""),C(!1),!0):(b(l),!1),[h,l]),B=s(()=>{S(""),_(""),o(""),b(""),y("")},[]);return{isRenameModalOpen:T,renameTemplateName:h,renameReason:e,renameError:c,renameTemplateNameError:N,renameSuccess:d,handleRenameClick:E,handleRenameClose:Q,handleRenameTemplateNameChange:w,handleRenameReasonChange:v,handleRenameSave:z,resetRenameState:B}},rt=({slots:n,onActionsButtonClick:f,onSendForReview:l,maxFiles:T,maxFileSize:C,acceptedFileTypes:h,...S})=>{var aa;const[e,_]=m(void 0),[c,o]=m(!0),[N,b]=m(""),[d,y]=m(!1),[E,Q]=m(!1),[w,v]=m(null),[z,B]=m(!1),[F,P]=m(!1),[j,q]=m(null),[ra,K]=m(!1),[x,V]=m([]),[De,Z]=m(!1),[ee,ae]=m(void 0),[oa,ne]=m(null),[Le,Ee]=m(!1),[Fe,ke]=m(!1),[Ie,te]=m(""),[we,re]=m(""),[He,Ae]=m(!1),[Be,xe]=m(!1),[Ue,oe]=m(""),[We,ie]=m(""),ze=$a(!1),[k,J]=m([]),[ce,le]=m(void 0),{getReferenceDocumentLinks:Oe,hasUnsavedChanges:$e}=Qn({templateReferenceDocuments:e==null?void 0:e.referenceDocuments,localReferenceDocuments:x}),t=Se({createdLabel:"NegotiableQuoteTemplate.Manage.createdLabel",salesRepLabel:"NegotiableQuoteTemplate.Manage.salesRepLabel",expiresLabel:"NegotiableQuoteTemplate.Manage.expiresLabel",templateIdLabel:"NegotiableQuoteTemplate.Manage.templateIdLabel",actionsLabel:"NegotiableQuoteTemplate.Manage.actionsLabel",referenceDocumentsTitle:"NegotiableQuoteTemplate.Manage.referenceDocuments.title",commentsTitle:"NegotiableQuoteTemplate.Manage.comments.title",historyLogTitle:"NegotiableQuoteTemplate.Manage.historyLog.title",itemsQuotedTab:"NegotiableQuoteTemplate.Manage.tabs.itemsQuoted",commentsTab:"NegotiableQuoteTemplate.Manage.tabs.comments",historyLogTab:"NegotiableQuoteTemplate.Manage.tabs.historyLog",templateCommentsPlaceholder:"NegotiableQuoteTemplate.Manage.templateComments.placeholder",sendForReview:"NegotiableQuoteTemplate.Manage.actionButtons.sendForReview",delete:"NegotiableQuoteTemplate.Manage.actionButtons.delete",cancel:"NegotiableQuoteTemplate.Manage.actionButtons.cancel",attachFiles:"NegotiableQuote.Manage.attachFiles",fileUploadError:"NegotiableQuote.Manage.fileUploadError",maxFilesExceeded:"NegotiableQuote.Manage.maxFilesExceeded",maxFileSizeExceeded:"NegotiableQuote.Manage.maxFileSizeExceeded",invalidFileType:"NegotiableQuote.Manage.invalidFileType",confirmationModalDeleteTitle:"NegotiableQuoteTemplate.Manage.confirmationModal.delete.title",confirmationModalDeleteMessage:"NegotiableQuoteTemplate.Manage.confirmationModal.delete.message",confirmationModalDeleteConfirm:"NegotiableQuoteTemplate.Manage.confirmationModal.delete.confirm",confirmationModalDeleteErrorHeading:"NegotiableQuoteTemplate.Manage.confirmationModal.delete.errorHeading",confirmationModalDeleteErrorFallback:"NegotiableQuoteTemplate.Manage.confirmationModal.delete.errorFallback",confirmationModalDeleteSuccessHeading:"NegotiableQuoteTemplate.Manage.confirmationModal.delete.successHeading",confirmationModalDeleteSuccessDescription:"NegotiableQuoteTemplate.Manage.confirmationModal.delete.successDescription",confirmationModalCancelTitle:"NegotiableQuoteTemplate.Manage.confirmationModal.cancelTemplate.title",confirmationModalCancelMessage:"NegotiableQuoteTemplate.Manage.confirmationModal.cancelTemplate.message",confirmationModalCancelConfirm:"NegotiableQuoteTemplate.Manage.confirmationModal.cancelTemplate.confirm",confirmationModalCancelErrorHeading:"NegotiableQuoteTemplate.Manage.confirmationModal.cancelTemplate.errorHeading",confirmationModalCancelErrorFallback:"NegotiableQuoteTemplate.Manage.confirmationModal.cancelTemplate.errorFallback",confirmationModalCancelSuccessHeading:"NegotiableQuoteTemplate.Manage.confirmationModal.cancelTemplate.successHeading",confirmationModalCancelSuccessDescription:"NegotiableQuoteTemplate.Manage.confirmationModal.cancelTemplate.successDescription",confirmationModalCancel:"NegotiableQuoteTemplate.Manage.confirmationModal.cancel",accept:"NegotiableQuoteTemplate.Manage.actionButtons.accept",generateQuote:"NegotiableQuoteTemplate.Manage.actionButtons.generateQuote",generateQuoteModalTitle:"NegotiableQuoteTemplate.Manage.actionButtons.generateQuote",generateQuoteModalMessage:"NegotiableQuoteTemplate.Manage.confirmationModal.generateQuote.message",generateQuoteModalCancel:"NegotiableQuoteTemplate.Manage.confirmationModal.cancel",generateQuoteModalConfirm:"NegotiableQuoteTemplate.Manage.confirmationModal.generateQuote.confirm",generateQuoteModalConfirmLoading:"NegotiableQuoteTemplate.Manage.confirmationModal.generateQuote.confirmLoading",generateQuoteModalSuccessHeading:"NegotiableQuoteTemplate.Manage.confirmationModal.generateQuote.successHeading",generateQuoteSuccessMessage:"NegotiableQuoteTemplate.Manage.confirmationModal.generateQuote.successDescription",generateQuoteModalErrorHeading:"NegotiableQuoteTemplate.Manage.confirmationModal.generateQuote.errorHeading",generateQuoteErrorFallback:"NegotiableQuoteTemplate.Manage.confirmationModal.generateQuote.errorFallback",acceptModalTitle:"NegotiableQuoteTemplate.Manage.confirmationModal.accept.title",acceptModalMessage:"NegotiableQuoteTemplate.Manage.confirmationModal.accept.message",acceptModalCancel:"NegotiableQuoteTemplate.Manage.confirmationModal.cancel",acceptModalConfirm:"NegotiableQuoteTemplate.Manage.confirmationModal.accept.confirm",acceptModalConfirmLoading:"NegotiableQuoteTemplate.Manage.confirmationModal.accept.confirmLoading",acceptModalSuccessHeading:"NegotiableQuoteTemplate.Manage.confirmationModal.accept.successHeading",acceptSuccessMessage:"NegotiableQuoteTemplate.Manage.confirmationModal.accept.successDescription",acceptModalErrorHeading:"NegotiableQuoteTemplate.Manage.confirmationModal.accept.errorHeading",acceptErrorFallback:"NegotiableQuoteTemplate.Manage.confirmationModal.accept.errorFallback",documentDuplicateUidError:"NegotiableQuoteTemplate.Manage.referenceDocuments.form.duplicateUidError",renameTitle:"NegotiableQuoteTemplate.Manage.rename.title",renameTemplateNameLabel:"NegotiableQuoteTemplate.Manage.rename.templateNameLabel",renameReasonLabel:"NegotiableQuoteTemplate.Manage.rename.reasonLabel",renameButton:"NegotiableQuoteTemplate.Manage.rename.renameButton",renameCancelButton:"NegotiableQuoteTemplate.Manage.rename.cancelButton",renameErrorHeading:"NegotiableQuoteTemplate.Manage.rename.errorHeading",renameTemplateNameRequired:"NegotiableQuoteTemplate.Manage.rename.templateNameRequired",renameErrorDefault:"NegotiableQuoteTemplate.Manage.rename.errorDefault",renameSuccessHeading:"NegotiableQuoteTemplate.Manage.rename.successHeading",renameSuccessMessage:"NegotiableQuoteTemplate.Manage.rename.successMessage",shippingInformationTitle:"NegotiableQuoteTemplate.Manage.shippingInformation.title",unsavedChangesWarningHeading:"NegotiableQuoteTemplate.Manage.unsavedChangesWarningHeading",unsavedChangesWarningMessage:"NegotiableQuoteTemplate.Manage.unsavedChangesWarningMessage",shippingAddressWarningHeading:"NegotiableQuoteTemplate.Manage.shippingAddressWarningHeading",shippingAddressWarningMessage:"NegotiableQuoteTemplate.Manage.shippingAddressWarningMessage"}),{isRenameModalOpen:Ge,renameTemplateName:I,renameReason:X,renameError:ge,renameTemplateNameError:ia,renameSuccess:fe,handleRenameClick:Pe,handleRenameClose:ca,handleRenameTemplateNameChange:la,handleRenameReasonChange:ma,handleRenameSave:sa,resetRenameState:je}=vn({initialTemplateName:e==null?void 0:e.name,templateNameRequiredErrorMessage:t.renameTemplateNameRequired}),Ke=M(()=>I!==""&&I!==(e==null?void 0:e.name),[I,e==null?void 0:e.name]),Y=M(()=>$e||Ke,[$e,Ke]),pe=s(async r=>{if(T&&k.length+r.length>T){le(t.maxFilesExceeded.replace("{maxFiles}",String(T)));return}for(const g of r){if(C&&!en(g.size,C)){le(t.maxFileSizeExceeded.replace("{maxSize}",an(C)));return}if(h&&!nn(g.type,h)){le(t.invalidFileType);return}}le(void 0);const i=r.map(g=>({key:`temp-${Date.now()}-${Math.random()}-${g.name}`,name:g.name,size:g.size,status:"uploading"}));J(g=>[...g,...i]);for(let g=0;g<r.length;g++){const U=r[g],H=i[g].key;try{const qe=await on(U);J(Ce=>Ce.map(W=>W.key===H?{...W,key:qe.key,status:"success"}:W))}catch(qe){J(Ce=>Ce.map(W=>W.key===H?{...W,status:"error",error:qe.message}:W))}}},[T,C,h,k,t]),be=s(r=>{J(i=>i.filter(g=>g.key!==r))},[]);ue(()=>{const r=Ga.on("quote-management/quote-template-data",i=>{i.quoteTemplate&&(_(i.quoteTemplate),o(!1),b(""),y(!1),J([]),V(i.quoteTemplate.referenceDocuments||[]),je())},{eager:!0});return()=>r==null?void 0:r.off()},[je]),ue(()=>{e!=null&&e.referenceDocuments&&V(e.referenceDocuments)},[e==null?void 0:e.referenceDocuments]),ue(()=>{e&&e.status===ta.UPDATED&&!ze.current&&(ze.current=!0,(async()=>{try{await dn({templateId:e.id})}catch(i){console.error("Failed to auto-open quote template:",i)}})())},[e]);const da=s(()=>{Q(!1),v(null),B(!1)},[]),ua=s(async()=>{if(e!=null&&e.id){v(null),B(!1);try{await cn({templateId:e.id}),B(!0),setTimeout(()=>{Q(!1),B(!1)},2e3)}catch(r){const i=r.message||t.confirmationModalDeleteErrorFallback;v(i)}}},[e,t.confirmationModalDeleteErrorFallback]),ga=s(()=>{v(null)},[]),fa=s(()=>{B(!1)},[]),pa=s(()=>{P(!1),q(null),K(!1)},[]),ba=s(async()=>{if(e!=null&&e.id){q(null),K(!1);try{await ln({templateId:e.id}),K(!0),setTimeout(()=>{P(!1),K(!1)},2e3)}catch(r){const i=r.message||t.confirmationModalCancelErrorFallback;q(i)}}},[e,t.confirmationModalCancelErrorFallback]),ha=s(()=>{q(null)},[]),Ma=s(()=>{K(!1)},[]),he=s(async()=>{const r=Oe(),i=k.filter(H=>H.status==="success"),g=[X.trim(),N.trim()].filter(Boolean).join(`
3
+ import{jsx as a,jsxs as p,Fragment as fe}from"@dropins/tools/preact-jsx-runtime.js";import{useState as l,useEffect as ne,useCallback as s,useMemo as h,useRef as Sa,createPortal as x}from"@dropins/tools/preact-compat.js";import{classes as d,VComponent as I,Slot as D}from"@dropins/tools/lib.js";import{f as Oe}from"../chunks/dateUtils.js";import{events as Da}from"@dropins/tools/event-bus.js";import{Skeleton as La,SkeletonRow as W,InLineAlert as L,Modal as Ea,Input as ge,Button as k,TextArea as Ia,Icon as ee}from"@dropins/tools/components.js";import{N as Ge}from"../chunks/transform-quote-template.js";import{S as wa,A as ka,T as Ha,R as Ba}from"../chunks/RenameQuoteModal.js";/* empty css */import"@dropins/tools/preact.js";import"@dropins/tools/preact-hooks.js";import{C as ae}from"../chunks/ConfirmationModal.js";/* empty css *//* empty css */import{S as U}from"../chunks/WarningFilled.js";import{useText as be}from"@dropins/tools/i18n.js";import"../chunks/state.js";import{d as Fa,c as Aa,s as xa,a as Wa,o as Ua}from"../chunks/openQuoteTemplate.js";import{g as Oa}from"../chunks/generateQuoteFromTemplate.js";import{S as Ga}from"../chunks/ShippingAddressDisplay.js";import{I as $a}from"../chunks/ItemsQuotedTemplate.js";import{Q as za}from"../chunks/QuoteTemplateCommentsList.js";import{Q as Pa}from"../chunks/QuoteTemplateHistoryLog.js";import{S as pe}from"../chunks/CheckWithCircle.js";import"../chunks/transform-quote.js";import"@dropins/tools/fetch-graphql.js";import"../chunks/NegotiableQuoteTemplateFragment.js";import"../chunks/LineItemNoteModal.js";import"../chunks/addQuoteTemplateLineItemNote.js";import"../chunks/QuoteCommentsList.js";import"../chunks/QuoteHistoryLog.js";const ja=({className:n,loading:u,templateName:c,templateStatus:q,banner:e,details:N,actionBar:Q,referenceDocuments:b,itemsTable:M,shippingInformationTitle:m,shippingInformation:r,commentsTitle:v,comments:g,footer:T,...y})=>u?a(Va,{}):p("div",{...y,className:d(["quote-management-manage-negotiable-quote-template",n]),children:[p("div",{className:d(["quote-management-manage-negotiable-quote-template__header"]),children:[c&&a(I,{node:c,className:d(["quote-management-manage-negotiable-quote-template__template-name"])}),q&&a(I,{node:q,className:d(["quote-management-manage-negotiable-quote-template__template-status"])})]}),e&&a(I,{node:e,className:d(["quote-management-manage-negotiable-quote-template__banner"])}),N&&a(I,{node:N,className:d(["quote-management-manage-negotiable-quote-template__details"])}),Q&&a(I,{node:Q,className:d(["quote-management-manage-negotiable-quote-template__action-bar"])}),b&&a("div",{"data-testid":"reference-documents-container",className:d(["quote-management-manage-negotiable-quote-template__reference-documents-container"]),children:a(I,{node:b,className:d(["quote-management-manage-negotiable-quote-template__reference-documents"])})}),M&&a(I,{node:M,className:d(["quote-management-manage-negotiable-quote-template__items-table"])}),p("div",{"data-testid":"template-shipping-information-container",className:d(["quote-management-manage-negotiable-quote-template__shipping-information-container"]),children:[m&&a(I,{node:m,className:d(["quote-management-manage-negotiable-quote-template__shipping-information-title"])}),r&&a(I,{node:r,className:d(["quote-management-manage-negotiable-quote-template__shipping-information"])})]}),p("div",{"data-testid":"comments-container",className:d(["quote-management-manage-negotiable-quote-template__comments-container"]),children:[v&&a(I,{node:v,className:d(["quote-management-manage-negotiable-quote-template__comments-title"])}),g&&a(I,{node:g,className:d(["quote-management-manage-negotiable-quote-template__comments"])})]}),T&&a(I,{node:T,className:d(["quote-management-manage-negotiable-quote-template__footer"])})]}),Va=()=>p(La,{"data-testid":"manage-negotiable-quote-template-skeleton",children:[a(W,{variant:"heading",fullWidth:!0,size:"large"}),a(W,{variant:"row",fullWidth:!1,size:"small"}),a(W,{variant:"row",fullWidth:!1,size:"small"}),a(W,{variant:"row",fullWidth:!0}),a(W,{variant:"row",fullWidth:!0,size:"xlarge",lines:2}),a(W,{variant:"row",fullWidth:!1,size:"small"})]}),Ja=({className:n,open:u,document:c,errorMessage:q,errorBanner:e,successBanner:N,showCloseButton:Q=!0,isSubmitting:b=!1,onSave:M,onClose:m})=>{const[r,v]=l(""),[g,T]=l(""),[y,w]=l(""),[_,R]=l({}),C=be({title:"NegotiableQuoteTemplate.Manage.referenceDocuments.form.title",documentNameLabel:"NegotiableQuoteTemplate.Manage.referenceDocuments.form.documentNameLabel",documentIdentifierLabel:"NegotiableQuoteTemplate.Manage.referenceDocuments.form.documentIdentifierLabel",referenceUrlLabel:"NegotiableQuoteTemplate.Manage.referenceDocuments.form.referenceUrlLabel",addButton:"NegotiableQuoteTemplate.Manage.referenceDocuments.form.addButton",updateButton:"NegotiableQuoteTemplate.Manage.referenceDocuments.form.updateButton",cancelButton:"NegotiableQuoteTemplate.Manage.referenceDocuments.form.cancelButton",documentNameRequired:"NegotiableQuoteTemplate.Manage.referenceDocuments.form.documentNameRequired",documentIdentifierRequired:"NegotiableQuoteTemplate.Manage.referenceDocuments.form.documentIdentifierRequired",referenceUrlRequired:"NegotiableQuoteTemplate.Manage.referenceDocuments.form.referenceUrlRequired",invalidUrl:"NegotiableQuoteTemplate.Manage.referenceDocuments.form.invalidUrl",errorHeading:"NegotiableQuoteTemplate.Manage.referenceDocuments.form.errorHeading"}),H=e||(q?a(L,{type:"error",variant:"primary",icon:a(U,{}),heading:C.errorHeading,description:q,"data-testid":"reference-document-form-modal-error-banner-inline"}):null),A=!!c;ne(()=>{u&&(c?(v(c.name||""),T(c.identifier||""),w(c.url||"")):(v(""),T(""),w("")),R({}))},[u,c]);const S=s(f=>{if(!f.trim())return!1;try{return new URL(f),!0}catch{return!1}},[]),te=s(()=>{const f={};if(r.trim()||(f.documentName=C.documentNameRequired),y.trim()?S(y.trim())||(f.referenceUrl=C.invalidUrl):f.referenceUrl=C.referenceUrlRequired,g.trim()||(f.documentIdentifier=C.documentIdentifierRequired),Object.keys(f).length>0){R(f);return}M({uid:c==null?void 0:c.uid,name:r.trim(),identifier:g.trim(),url:y.trim()})},[r,g,y,c,C,S,M]),B=s(()=>{v(""),T(""),w(""),R({}),m==null||m()},[m]);return u?p(Ea,{open:u,size:"medium",title:a(fe,{children:C.title}),onClose:B,clickToDismiss:!0,escapeToDismiss:!0,showCloseButton:Q,className:d(["quote-management-reference-document-form-modal",n]),"data-testid":"reference-document-form-modal",children:[H&&a("div",{className:d(["quote-management-reference-document-form-modal__error-banner"]),"data-testid":"reference-document-form-modal-error-banner",children:H}),N&&a("div",{className:d(["quote-management-reference-document-form-modal__success-banner"]),"data-testid":"reference-document-form-modal-success-banner",children:N}),p("div",{className:d(["quote-management-reference-document-form-modal__content"]),children:[p("div",{children:[a(ge,{name:"documentName",type:"text",value:r,onInput:f=>{v(f.target.value),R({..._,documentName:void 0})},floatingLabel:C.documentNameLabel,required:!0,error:!!_.documentName,disabled:b,"data-testid":"reference-document-name-input"}),_.documentName&&a("span",{className:d(["quote-management-reference-document-form-modal__error-text"]),"data-testid":"reference-document-name-error",children:_.documentName})]}),p("div",{children:[a(ge,{name:"documentIdentifier",type:"text",value:g,onInput:f=>{T(f.target.value),R({..._,documentIdentifier:void 0})},floatingLabel:C.documentIdentifierLabel,error:!!_.documentIdentifier,disabled:b,"data-testid":"reference-document-identifier-input"}),_.documentIdentifier&&a("span",{className:d(["quote-management-reference-document-form-modal__error-text"]),"data-testid":"reference-document-identifier-error",children:_.documentIdentifier})]}),p("div",{children:[a(ge,{name:"referenceUrl",type:"url",value:y,onInput:f=>{w(f.target.value),R({..._,referenceUrl:void 0})},floatingLabel:C.referenceUrlLabel,required:!0,error:!!_.referenceUrl,disabled:b,"data-testid":"reference-document-url-input"}),_.referenceUrl&&a("span",{className:d(["quote-management-reference-document-form-modal__error-text"]),"data-testid":"reference-document-url-error",children:_.referenceUrl})]})]}),p("div",{className:d(["quote-management-reference-document-form-modal__actions"]),children:[a(k,{variant:"secondary",size:"medium",onClick:B,disabled:b,className:d(["quote-management-reference-document-form-modal__cancel-button"]),"data-testid":"reference-document-form-cancel-button",children:C.cancelButton}),a(k,{variant:"primary",size:"medium",onClick:te,disabled:b,className:d(["quote-management-reference-document-form-modal__save-button"]),"data-testid":"reference-document-form-save-button",children:A?C.updateButton:C.addButton})]})]}):null},Ka=({className:n,documents:u,isEditable:c=!1,onAdd:q,onEdit:e,onRemove:N,...Q})=>{const b=be({add:"NegotiableQuoteTemplate.Manage.referenceDocuments.add",edit:"NegotiableQuoteTemplate.Manage.referenceDocuments.edit",remove:"NegotiableQuoteTemplate.Manage.referenceDocuments.remove",noReferenceDocuments:"NegotiableQuoteTemplate.Manage.referenceDocuments.noReferenceDocuments"}),M=r=>r.identifier?`${r.name}, ${r.identifier}`:`${r.name} ${r.url}`,m=(r,v)=>{r.preventDefault(),window.open(v,"_blank","noopener,noreferrer")};return a("div",{className:d(["quote-management-reference-documents-list",n]),"data-testid":"reference-documents-list",...Q,children:p("div",{className:"quote-management-reference-documents-list__content",children:[u.map(r=>p("div",{className:"quote-management-reference-documents-list__document","data-testid":`reference-document-${r.uid||r.url}`,children:[a("a",{href:r.url,onClick:v=>m(v,r.url),className:"quote-management-reference-documents-list__document-link",target:"_blank",rel:"noopener noreferrer","data-testid":`reference-document-link-${r.uid||r.url}`,children:M(r)}),c&&p("div",{className:"quote-management-reference-documents-list__document-actions",children:[a(k,{variant:"tertiary",onClick:()=>e==null?void 0:e(r),className:"quote-management-reference-documents-list__edit-button","data-testid":`reference-document-edit-${r.uid||r.url}`,children:b.edit}),a("span",{className:"quote-management-reference-documents-list__separator",children:"|"}),a(k,{variant:"tertiary",onClick:()=>N==null?void 0:N(r),className:"quote-management-reference-documents-list__remove-button","data-testid":`reference-document-remove-${r.uid||r.url}`,children:b.remove})]})]},r.uid||r.url)),c&&p(k,{variant:"tertiary",onClick:q,className:"quote-management-reference-documents-list__add-button","data-testid":"reference-documents-add-button",children:["+ ",b.add]}),u.length===0&&!c&&a("div",{className:"quote-management-reference-documents-list__empty",children:b.noReferenceDocuments})]})})},Xa=n=>{const{templateReferenceDocuments:u,localReferenceDocuments:c}=n,q=s(m=>{if(u)return u.find(r=>m.uid&&r.uid?r.uid===m.uid:r.url===m.url)},[u]),e=s(m=>q(m)!==void 0,[q]),N=s((m,r)=>m.name!==r.name||m.identifier!==r.identifier||m.url!==r.url,[]),Q=s(()=>u?c.filter(m=>!u.some(r=>m.uid&&r.uid?r.uid===m.uid:r.url===m.url)):c,[u,c]),b=s(()=>c.map(m=>({uid:m.uid,name:m.name,identifier:m.identifier,url:m.url})),[c]),M=h(()=>u?c.some(g=>q(g)===void 0)||u.some(g=>!c.some(T=>T.uid&&g.uid?T.uid===g.uid:T.url===g.url))?!0:c.some(g=>{const T=q(g);return T?N(g,T):!1}):c.length>0,[u,c,q,N]);return{isDocumentInTemplateData:e,getNewDocuments:Q,getReferenceDocumentLinks:b,hasUnsavedChanges:M}},Ya=(n={})=>{const{initialTemplateName:u,templateNameRequiredErrorMessage:c="Template name is required"}=n,[q,e]=l(!1),[N,Q]=l(""),[b,M]=l(""),[m,r]=l(""),[v,g]=l(""),[T,y]=l(""),w=s(S=>{Q(S||u||""),M(""),r(""),g(""),y(""),e(!0)},[u]),_=s(()=>{e(!1),Q(""),M(""),r(""),g(""),y("")},[]),R=s(S=>{Q(S),S.trim()&&g("")},[]),C=s(S=>{M(S)},[]),H=s(()=>N.trim()?(r(""),g(""),e(!1),!0):(g(c),!1),[N,c]),A=s(()=>{Q(""),M(""),r(""),g(""),y("")},[]);return{isRenameModalOpen:q,renameTemplateName:N,renameReason:b,renameError:m,renameTemplateNameError:v,renameSuccess:T,handleRenameClick:w,handleRenameClose:_,handleRenameTemplateNameChange:R,handleRenameReasonChange:C,handleRenameSave:H,resetRenameState:A}},wn=({slots:n,onActionsButtonClick:u,onSendForReview:c,...q})=>{var Ue;const[e,N]=l(void 0),[Q,b]=l(!0),[M,m]=l(""),[r,v]=l(!1),[g,T]=l(!1),[y,w]=l(null),[_,R]=l(!1),[C,H]=l(!1),[A,S]=l(null),[te,B]=l(!1),[f,O]=l([]),[Me,P]=l(!1),[j,V]=l(void 0),[$e,J]=l(null),[he,Te]=l(!1),[Ne,Qe]=l(!1),[ve,K]=l(""),[Ce,X]=l(""),[qe,re]=l(!1),[_e,ye]=l(!1),[Re,G]=l(""),[Se,Y]=l(""),De=Sa(!1),{getReferenceDocumentLinks:Le,hasUnsavedChanges:Ee}=Xa({templateReferenceDocuments:e==null?void 0:e.referenceDocuments,localReferenceDocuments:f}),t=be({createdLabel:"NegotiableQuoteTemplate.Manage.createdLabel",salesRepLabel:"NegotiableQuoteTemplate.Manage.salesRepLabel",expiresLabel:"NegotiableQuoteTemplate.Manage.expiresLabel",templateIdLabel:"NegotiableQuoteTemplate.Manage.templateIdLabel",actionsLabel:"NegotiableQuoteTemplate.Manage.actionsLabel",referenceDocumentsTitle:"NegotiableQuoteTemplate.Manage.referenceDocuments.title",commentsTitle:"NegotiableQuoteTemplate.Manage.comments.title",historyLogTitle:"NegotiableQuoteTemplate.Manage.historyLog.title",itemsQuotedTab:"NegotiableQuoteTemplate.Manage.tabs.itemsQuoted",commentsTab:"NegotiableQuoteTemplate.Manage.tabs.comments",historyLogTab:"NegotiableQuoteTemplate.Manage.tabs.historyLog",templateCommentsPlaceholder:"NegotiableQuoteTemplate.Manage.templateComments.placeholder",sendForReview:"NegotiableQuoteTemplate.Manage.actionButtons.sendForReview",delete:"NegotiableQuoteTemplate.Manage.actionButtons.delete",cancel:"NegotiableQuoteTemplate.Manage.actionButtons.cancel",confirmationModalDeleteTitle:"NegotiableQuoteTemplate.Manage.confirmationModal.delete.title",confirmationModalDeleteMessage:"NegotiableQuoteTemplate.Manage.confirmationModal.delete.message",confirmationModalDeleteConfirm:"NegotiableQuoteTemplate.Manage.confirmationModal.delete.confirm",confirmationModalDeleteErrorHeading:"NegotiableQuoteTemplate.Manage.confirmationModal.delete.errorHeading",confirmationModalDeleteErrorFallback:"NegotiableQuoteTemplate.Manage.confirmationModal.delete.errorFallback",confirmationModalDeleteSuccessHeading:"NegotiableQuoteTemplate.Manage.confirmationModal.delete.successHeading",confirmationModalDeleteSuccessDescription:"NegotiableQuoteTemplate.Manage.confirmationModal.delete.successDescription",confirmationModalCancelTitle:"NegotiableQuoteTemplate.Manage.confirmationModal.cancelTemplate.title",confirmationModalCancelMessage:"NegotiableQuoteTemplate.Manage.confirmationModal.cancelTemplate.message",confirmationModalCancelConfirm:"NegotiableQuoteTemplate.Manage.confirmationModal.cancelTemplate.confirm",confirmationModalCancelErrorHeading:"NegotiableQuoteTemplate.Manage.confirmationModal.cancelTemplate.errorHeading",confirmationModalCancelErrorFallback:"NegotiableQuoteTemplate.Manage.confirmationModal.cancelTemplate.errorFallback",confirmationModalCancelSuccessHeading:"NegotiableQuoteTemplate.Manage.confirmationModal.cancelTemplate.successHeading",confirmationModalCancelSuccessDescription:"NegotiableQuoteTemplate.Manage.confirmationModal.cancelTemplate.successDescription",confirmationModalCancel:"NegotiableQuoteTemplate.Manage.confirmationModal.cancel",accept:"NegotiableQuoteTemplate.Manage.actionButtons.accept",generateQuote:"NegotiableQuoteTemplate.Manage.actionButtons.generateQuote",generateQuoteModalTitle:"NegotiableQuoteTemplate.Manage.actionButtons.generateQuote",generateQuoteModalMessage:"NegotiableQuoteTemplate.Manage.confirmationModal.generateQuote.message",generateQuoteModalCancel:"NegotiableQuoteTemplate.Manage.confirmationModal.cancel",generateQuoteModalConfirm:"NegotiableQuoteTemplate.Manage.confirmationModal.generateQuote.confirm",generateQuoteModalConfirmLoading:"NegotiableQuoteTemplate.Manage.confirmationModal.generateQuote.confirmLoading",generateQuoteModalSuccessHeading:"NegotiableQuoteTemplate.Manage.confirmationModal.generateQuote.successHeading",generateQuoteSuccessMessage:"NegotiableQuoteTemplate.Manage.confirmationModal.generateQuote.successDescription",generateQuoteModalErrorHeading:"NegotiableQuoteTemplate.Manage.confirmationModal.generateQuote.errorHeading",generateQuoteErrorFallback:"NegotiableQuoteTemplate.Manage.confirmationModal.generateQuote.errorFallback",acceptModalTitle:"NegotiableQuoteTemplate.Manage.confirmationModal.accept.title",acceptModalMessage:"NegotiableQuoteTemplate.Manage.confirmationModal.accept.message",acceptModalCancel:"NegotiableQuoteTemplate.Manage.confirmationModal.cancel",acceptModalConfirm:"NegotiableQuoteTemplate.Manage.confirmationModal.accept.confirm",acceptModalConfirmLoading:"NegotiableQuoteTemplate.Manage.confirmationModal.accept.confirmLoading",acceptModalSuccessHeading:"NegotiableQuoteTemplate.Manage.confirmationModal.accept.successHeading",acceptSuccessMessage:"NegotiableQuoteTemplate.Manage.confirmationModal.accept.successDescription",acceptModalErrorHeading:"NegotiableQuoteTemplate.Manage.confirmationModal.accept.errorHeading",acceptErrorFallback:"NegotiableQuoteTemplate.Manage.confirmationModal.accept.errorFallback",documentDuplicateUidError:"NegotiableQuoteTemplate.Manage.referenceDocuments.form.duplicateUidError",renameTitle:"NegotiableQuoteTemplate.Manage.rename.title",renameTemplateNameLabel:"NegotiableQuoteTemplate.Manage.rename.templateNameLabel",renameReasonLabel:"NegotiableQuoteTemplate.Manage.rename.reasonLabel",renameButton:"NegotiableQuoteTemplate.Manage.rename.renameButton",renameCancelButton:"NegotiableQuoteTemplate.Manage.rename.cancelButton",renameErrorHeading:"NegotiableQuoteTemplate.Manage.rename.errorHeading",renameTemplateNameRequired:"NegotiableQuoteTemplate.Manage.rename.templateNameRequired",renameErrorDefault:"NegotiableQuoteTemplate.Manage.rename.errorDefault",renameSuccessHeading:"NegotiableQuoteTemplate.Manage.rename.successHeading",renameSuccessMessage:"NegotiableQuoteTemplate.Manage.rename.successMessage",shippingInformationTitle:"NegotiableQuoteTemplate.Manage.shippingInformation.title",unsavedChangesWarningHeading:"NegotiableQuoteTemplate.Manage.unsavedChangesWarningHeading",unsavedChangesWarningMessage:"NegotiableQuoteTemplate.Manage.unsavedChangesWarningMessage",shippingAddressWarningHeading:"NegotiableQuoteTemplate.Manage.shippingAddressWarningHeading",shippingAddressWarningMessage:"NegotiableQuoteTemplate.Manage.shippingAddressWarningMessage"}),{isRenameModalOpen:Ie,renameTemplateName:E,renameReason:$,renameError:oe,renameTemplateNameError:ze,renameSuccess:ie,handleRenameClick:we,handleRenameClose:Pe,handleRenameTemplateNameChange:je,handleRenameReasonChange:Ve,handleRenameSave:Je,resetRenameState:ke}=Ya({initialTemplateName:e==null?void 0:e.name,templateNameRequiredErrorMessage:t.renameTemplateNameRequired}),He=h(()=>E!==""&&E!==(e==null?void 0:e.name),[E,e==null?void 0:e.name]),z=h(()=>Ee||He,[Ee,He]);ne(()=>{const o=Da.on("quote-management/quote-template-data",i=>{i.quoteTemplate&&(N(i.quoteTemplate),b(!1),m(""),v(!1),O(i.quoteTemplate.referenceDocuments||[]),ke())},{eager:!0});return()=>o==null?void 0:o.off()},[ke]),ne(()=>{e!=null&&e.referenceDocuments&&O(e.referenceDocuments)},[e==null?void 0:e.referenceDocuments]),ne(()=>{e&&e.status===Ge.UPDATED&&!De.current&&(De.current=!0,(async()=>{try{await Ua({templateId:e.id})}catch(i){console.error("Failed to auto-open quote template:",i)}})())},[e]);const Ke=s(()=>{T(!1),w(null),R(!1)},[]),Xe=s(async()=>{if(e!=null&&e.id){w(null),R(!1);try{await Fa({templateId:e.id}),R(!0),setTimeout(()=>{T(!1),R(!1)},2e3)}catch(o){const i=o.message||t.confirmationModalDeleteErrorFallback;w(i)}}},[e,t.confirmationModalDeleteErrorFallback]),Ye=s(()=>{w(null)},[]),Ze=s(()=>{R(!1)},[]),ea=s(()=>{H(!1),S(null),B(!1)},[]),aa=s(async()=>{if(e!=null&&e.id){S(null),B(!1);try{await Aa({templateId:e.id}),B(!0),setTimeout(()=>{H(!1),B(!1)},2e3)}catch(o){const i=o.message||t.confirmationModalCancelErrorFallback;S(i)}}},[e,t.confirmationModalCancelErrorFallback]),na=s(()=>{S(null)},[]),ta=s(()=>{B(!1)},[]),ce=s(async()=>{const o=Le(),i=[$.trim(),M.trim()].filter(Boolean).join(`
4
4
 
5
- `).trim()||void 0,U=I&&I!==(e==null?void 0:e.name)?I:void 0;if(l){l({templateData:e,name:U,comment:g,referenceDocumentLinks:r,attachments:i.length?i:void 0});return}y(!0);try{await mn({templateId:e.id,name:U,comment:g,referenceDocumentLinks:r.length>0?r:void 0,attachments:i.length?i.map(H=>({key:H.key})):void 0})}catch(H){console.error("Failed to send quote template for review:",H),y(!1)}},[e,l,N,X,I,Oe,k]),Me=s(()=>{ae(void 0),ne(null),Z(!0)},[]),Ne=s(r=>{ae(r),ne(null),Z(!0)},[]),Te=s(r=>{V(i=>i.filter(g=>g.uid!==r.uid||g.url!==r.url))},[]),Na=s(r=>{ne(null),V(ee?i=>i.map(g=>g.identifier===ee.identifier?r:g):i=>[...i,r]),Z(!1),ae(void 0)},[ee]),Ta=s(()=>{Z(!1),ae(void 0),ne(null)},[]),Qa=s(async()=>{ke(!0),re(""),te("");try{await un({templateId:e.id}),te(t.generateQuoteSuccessMessage)}catch(r){console.error("Failed to generate quote from template:",r);const i=r instanceof Error?r.message:t.generateQuoteErrorFallback;re(i)}finally{ke(!1)}},[e,t.generateQuoteSuccessMessage,t.generateQuoteErrorFallback]),va=s(()=>{Ee(!1),re(""),te("")},[]),qa=s(async()=>{xe(!0),ie(""),oe("");try{await sn({templateId:e.id}),oe(t.acceptSuccessMessage)}catch(r){console.error("Failed to accept quote template:",r);const i=r instanceof Error?r.message:t.acceptErrorFallback;ie(i)}finally{xe(!1)}},[e,t.acceptSuccessMessage,t.acceptErrorFallback]),Ca=s(()=>{Ae(!1),ie(""),oe("")},[]),_a=M(()=>{const r=!(e!=null&&e.canSendForReview),i=I||(e==null?void 0:e.name);return a(R,{name:"TemplateName",slot:n==null?void 0:n.TemplateName,context:{templateName:e==null?void 0:e.name,templateData:e,templateDisplayName:i,isRenameDisabled:r},children:p("div",{className:"quote-management-manage-negotiable-quote-template__template-name-wrapper",children:[a("h1",{"data-testid":"template-name",className:"quote-management-manage-negotiable-quote-template__template-name-title",children:i}),a("button",{onClick:()=>Pe(i),disabled:r,"data-testid":"rename-template-button",className:"quote-management-manage-negotiable-quote-template__rename-button","aria-label":"Rename template",children:a(Ja,{})})]})})},[n==null?void 0:n.TemplateName,e,Pe,I]),ya=M(()=>a(R,{name:"TemplateStatus",slot:n==null?void 0:n.TemplateStatus,context:{templateStatus:e==null?void 0:e.status,templateData:e},children:a("div",{"data-testid":"template-status",children:e==null?void 0:e.status})}),[n==null?void 0:n.TemplateStatus,e]),Ra=M(()=>{if(!e)return;const r=e.expirationDate?na(e.expirationDate,"short"):void 0;return p(R,{name:"Details",slot:n==null?void 0:n.Details,context:{templateData:e},children:[p("div",{className:"quote-management-manage-negotiable-quote-template__detail",children:[a("span",{className:"quote-management-manage-negotiable-quote-template__detail-title","data-testid":"template-id-label",children:t.templateIdLabel}),a("span",{className:"quote-management-manage-negotiable-quote-template__detail-content","data-testid":"template-id-value",children:e.id})]}),p("div",{className:"quote-management-manage-negotiable-quote-template__detail",children:[a("span",{className:"quote-management-manage-negotiable-quote-template__detail-title","data-testid":"created-label",children:t.createdLabel}),p("span",{className:"quote-management-manage-negotiable-quote-template__detail-content","data-testid":"created-value",children:[na(e.createdAt,"short")," (",e.buyer.firstname," ",e.buyer.lastname,")"]})]}),p("div",{className:"quote-management-manage-negotiable-quote-template__detail",children:[a("span",{className:"quote-management-manage-negotiable-quote-template__detail-title","data-testid":"sales-rep-label",children:t.salesRepLabel}),a("span",{className:"quote-management-manage-negotiable-quote-template__detail-content","data-testid":"sales-rep-value",children:e.salesRepName})]}),r&&p("div",{className:"quote-management-manage-negotiable-quote-template__detail",children:[a("span",{className:"quote-management-manage-negotiable-quote-template__detail-title","data-testid":"expires-label",children:t.expiresLabel}),a("span",{className:"quote-management-manage-negotiable-quote-template__detail-content","data-testid":"expires-value",children:r})]})]})},[n==null?void 0:n.Details,t,e]),Ve=M(()=>[{label:t.generateQuote,value:"generateQuote",disabled:!(e!=null&&e.canGenerateQuoteFromTemplate)}],[t,e==null?void 0:e.canGenerateQuoteFromTemplate]),Sa=M(()=>{const r=i=>{switch(i){case"generateQuote":Ee(!0),re(""),te(""),f==null||f(i);break}};return a(R,{name:"ActionBar",slot:n==null?void 0:n.ActionBar,context:{templateData:e},children:a(Xa,{dropdownPlaceholder:t.actionsLabel,dropdownOptions:[],buttons:Ve.map(i=>a(A,{variant:"tertiary",onClick:()=>r(i.value),"data-testid":`actions-bar-${i.value}-button`,"data-action":i.value,disabled:i.disabled,children:i.label},i.value))})})},[Ve,t,n==null?void 0:n.ActionBar,e,f]),me=M(()=>{const r=e==null?void 0:e.status;return r==="Draft"||r==="Open"},[e==null?void 0:e.status]),Da=M(()=>{const r=x.length>0||me,i=r?t.referenceDocumentsTitle:void 0;return a(R,{name:"ReferenceDocuments",slot:n==null?void 0:n.ReferenceDocuments,context:{templateData:e,referenceDocuments:x,isEditable:me,onAddDocument:Me,onEditDocument:Ne,onRemoveDocument:Te,referenceDocumentsTitle:t.referenceDocumentsTitle},children:p("div",{"data-testid":"reference-documents",children:[r&&a("h2",{children:i}),a(Tn,{documents:x,isEditable:me,onAdd:Me,onEdit:Ne,onRemove:Te})]})})},[n==null?void 0:n.ReferenceDocuments,t,e,x,me,Me,Ne,Te]),La=M(()=>a(R,{name:"ShippingInformationTitle",slot:n==null?void 0:n.ShippingInformationTitle,context:{templateData:e},children:a("h2",{children:t.shippingInformationTitle})}),[n==null?void 0:n.ShippingInformationTitle,e,t]),Ea=M(()=>{var r;return a(R,{name:"ShippingInformation",slot:n==null?void 0:n.ShippingInformation,context:{templateData:e,loading:c,setLoading:o},children:a(gn,{shippingAddress:(r=e==null?void 0:e.shippingAddresses)==null?void 0:r[0],loading:c,"data-testid":"manage-template-shipping-address"})})},[n==null?void 0:n.ShippingInformation,e,c,o]),Fa=M(()=>a(R,{name:"ItemsTable",slot:n==null?void 0:n.ItemsTable,context:{templateData:e},children:a(Ya,{tabs:new Map([["items-quoted",t.itemsQuotedTab],["comments",t.commentsTab],["history-log",t.historyLogTab]]),tabsContent:new Map([["items-quoted",a(R,{name:"ItemsQuotedTab",slot:n==null?void 0:n.ItemsQuotedTab,context:{templateData:e},children:a(fn,{templateData:e})},"items-quoted")],["comments",a(R,{name:"CommentsTab",slot:n==null?void 0:n.CommentsTab,context:{templateData:e},children:a(pn,{templateData:e})},"comments")],["history-log",a(R,{name:"HistoryLogTab",slot:n==null?void 0:n.HistoryLogTab,context:{templateData:e},children:a(bn,{templateData:e})},"history-log")]])})}),[n==null?void 0:n.ItemsTable,n==null?void 0:n.ItemsQuotedTab,n==null?void 0:n.CommentsTab,n==null?void 0:n.HistoryLogTab,t,e]),ka=M(()=>a(R,{name:"CommentsTitle",slot:n==null?void 0:n.CommentsTitle,context:{templateData:e},children:a("h2",{children:t.commentsTitle})}),[n==null?void 0:n.CommentsTitle,t,e]),Ia=M(()=>a(R,{name:"Comments",slot:n==null?void 0:n.Comments,context:{templateData:e},children:a(Ka,{name:"templateComments",placeholder:t.templateCommentsPlaceholder,rows:3,value:N,onInput:r=>{b(r.target.value)},disabled:!(e!=null&&e.canSendForReview)||d})}),[n==null?void 0:n.Comments,t,e,N,d]),Je=M(()=>!(e!=null&&e.canSendForReview),[e]),wa=M(()=>{const r=d||Je;return a(R,{name:"AttachFilesField",slot:n==null?void 0:n.AttachFilesField,context:{templateData:e,onFileChange:pe,attachedFiles:k,fileUploadError:ce,disabled:r},children:p("div",{className:"quote-management-manage-negotiable-quote-template__attach-files",...r?{"data-disabled":!0}:{},"aria-disabled":r,children:[a(Va,{id:"manage-template-attach-files",multiple:!0,onChange:i=>{const g=i.target,U=g==null?void 0:g.files,H=U?Array.from(U):[];H.length>0&&pe(H)},icon:a(tn,{}),disabled:r,"data-testid":"manage-template-attach-files",accept:h==null?void 0:h.join(","),children:t.attachFiles}),ce&&a("div",{className:"quote-management-manage-negotiable-quote-template__file-error","data-testid":"file-upload-error",children:ce})]})})},[n==null?void 0:n.AttachFilesField,e,pe,d,Je,h,ce,t,k]),Ha=M(()=>{if(k.length)return a(R,{name:"AttachedFilesList",slot:n==null?void 0:n.AttachedFilesList,context:{templateData:e,files:k,onRemove:be,disabled:d},children:a(rn,{files:k,onRemove:be,disabled:d})})},[k,be,d,n==null?void 0:n.AttachedFilesList,e]),Xe=M(()=>Y?a(L,{type:"warning",variant:"primary",icon:a(G,{}),heading:t.unsavedChangesWarningHeading,description:t.unsavedChangesWarningMessage,"data-testid":"unsaved-changes-warning-alert"}):void 0,[Y,t.unsavedChangesWarningHeading,t.unsavedChangesWarningMessage]),Ye=M(()=>{var r;return(r=e==null?void 0:e.shippingAddresses)!=null&&r.length?void 0:a(L,{type:"warning",variant:"primary",icon:a(G,{}),heading:t.shippingAddressWarningHeading,description:t.shippingAddressWarningMessage,"data-testid":"shipping-address-warning-alert"})},[(aa=e==null?void 0:e.shippingAddresses)==null?void 0:aa.length,t.shippingAddressWarningHeading,t.shippingAddressWarningMessage]),Aa=M(()=>p(Re,{children:[Xe,Ye]}),[Xe,Ye]),Ba=M(()=>{const r=(e==null?void 0:e.status)===ta.OPEN&&(e==null?void 0:e.canAccept);return p(R,{name:"Footer",slot:n==null?void 0:n.Footer,context:{templateData:e,comment:N,isSubmitting:d,attachedFiles:k,referenceDocuments:x,hasUnsavedChanges:Y,handleSendForReview:he,showAcceptButton:r,renameTemplateName:I,renameReason:X},children:[r&&a(A,{variant:"primary",onClick:()=>{Ae(!0),ie(""),oe("")},"data-testid":"accept-button",disabled:d||Y,children:t.accept}),(e==null?void 0:e.canSendForReview)&&a(A,{variant:"primary",onClick:he,"data-testid":"send-for-review-button",disabled:!(e!=null&&e.canSendForReview)||d,children:t.sendForReview}),(e==null?void 0:e.canCancel)&&a(A,{variant:"tertiary",onClick:()=>P(!0),"data-testid":"cancel-template-button",disabled:d,children:t.cancel}),(e==null?void 0:e.canDelete)&&a(A,{variant:"tertiary",onClick:()=>Q(!0),"data-testid":"delete-template-button",disabled:d,children:t.delete})]})},[n==null?void 0:n.Footer,t,e,N,d,k,he,x,Y,I,X]),xa=w?a(L,{type:"error",variant:"primary",icon:a(G,{}),heading:t.confirmationModalDeleteErrorHeading,description:w,onDismiss:ga,"data-testid":"confirmation-modal-error-banner"}):null,Ze=(z?a(L,{type:"success",variant:"primary",icon:a(ye,{}),heading:t.confirmationModalDeleteSuccessHeading,description:t.confirmationModalDeleteSuccessDescription,onDismiss:fa,"data-testid":"confirmation-modal-success-banner"}):null)||xa,Ua=j?a(L,{type:"error",variant:"primary",icon:a(G,{}),heading:t.confirmationModalCancelErrorHeading,description:j,onDismiss:ha,"data-testid":"confirmation-modal-cancel-error-banner"}):null,ea=(ra?a(L,{type:"success",variant:"primary",icon:a(ye,{}),heading:t.confirmationModalCancelSuccessHeading,description:t.confirmationModalCancelSuccessDescription,onDismiss:Ma,"data-testid":"confirmation-modal-cancel-success-banner"}):null)||Ua,Wa=M(()=>ge?a(L,{type:"error",variant:"primary",icon:a(G,{color:"var(--color-error)"}),heading:t.renameErrorHeading,description:ge}):void 0,[ge,t.renameErrorHeading]),za=M(()=>fe?a(L,{type:"success",variant:"primary",icon:a(ye,{}),heading:t.renameSuccessHeading,description:fe}):void 0,[fe,t.renameSuccessHeading]),Oa={...S,loading:c,templateName:_a,templateStatus:ya,banner:Aa,details:Ra,actionBar:Sa,referenceDocuments:Da,itemsTable:Fa,shippingInformationTitle:La,shippingInformation:Ea,commentsTitle:ka,comments:Ia,attachFilesField:wa,attachedFilesList:Ha,footer:Ba};let Qe=null;Ie?Qe=a(L,{type:"success",variant:"primary",icon:a(se,{source:"CheckWithCircle"}),heading:t.generateQuoteModalSuccessHeading,description:Ie,"data-testid":"generate-quote-success-banner"}):we&&(Qe=a(L,{type:"error",variant:"primary",icon:a(se,{source:"WarningFilled"}),heading:t.generateQuoteModalErrorHeading,description:we,"data-testid":"generate-quote-error-banner"}));let ve=null;return Ue?ve=a(L,{type:"success",variant:"primary",icon:a(se,{source:"CheckWithCircle"}),heading:t.acceptModalSuccessHeading,description:Ue,"data-testid":"accept-success-banner"}):We&&(ve=a(L,{type:"error",variant:"primary",icon:a(se,{source:"WarningFilled"}),heading:t.acceptModalErrorHeading,description:We,"data-testid":"accept-error-banner"})),p(Re,{children:[a(hn,{...Oa}),E&&O(a(de,{open:E,title:t.confirmationModalDeleteTitle,message:t.confirmationModalDeleteMessage,cancelLabel:t.confirmationModalCancel,confirmLabel:t.confirmationModalDeleteConfirm,onCancel:da,onConfirm:ua,showCloseButton:!Ze,confirmationBanner:Ze}),document.body),F&&O(a(de,{open:F,title:t.confirmationModalCancelTitle,message:t.confirmationModalCancelMessage,cancelLabel:t.confirmationModalCancel,confirmLabel:t.confirmationModalCancelConfirm,onCancel:pa,onConfirm:ba,showCloseButton:!ea,confirmationBanner:ea}),document.body),De&&O(a(Nn,{open:De,document:ee,errorMessage:oa||void 0,onSave:Na,onClose:Ta,isSubmitting:d}),document.body),Le&&O(a(de,{open:Le,title:t.generateQuoteModalTitle,message:t.generateQuoteModalMessage,cancelLabel:t.generateQuoteModalCancel,confirmLabel:Fe?t.generateQuoteModalConfirmLoading:t.generateQuoteModalConfirm,onCancel:va,onConfirm:Fe?void 0:Qa,showCloseButton:!0,confirmationBanner:Qe,"data-testid":"generate-quote-confirmation-modal"}),document.body),He&&O(a(de,{open:He,title:t.acceptModalTitle,message:t.acceptModalMessage,cancelLabel:t.acceptModalCancel,confirmLabel:Be?t.acceptModalConfirmLoading:t.acceptModalConfirm,onCancel:Ca,onConfirm:Be?void 0:qa,showCloseButton:!0,confirmationBanner:ve,"data-testid":"accept-confirmation-modal"}),document.body),Ge&&O(a(Za,{open:Ge,quoteName:I,renameReason:X,quoteNameError:ia,errorBanner:Wa,successBanner:za,onQuoteNameChange:la,onRenameReasonChange:ma,onSave:sa,onClose:ca}),document.body)]})};export{rt as ManageNegotiableQuoteTemplate,rt as default};
5
+ `).trim()||void 0,F=E&&E!==(e==null?void 0:e.name)?E:void 0;if(c){c({templateData:e,name:F,comment:i,referenceDocumentLinks:o});return}v(!0);try{await xa({templateId:e.id,name:F,comment:i,referenceDocumentLinks:o.length>0?o:void 0})}catch(Ra){console.error("Failed to send quote template for review:",Ra),v(!1)}},[e,c,M,$,E,Le]),me=s(()=>{V(void 0),J(null),P(!0)},[]),le=s(o=>{V(o),J(null),P(!0)},[]),se=s(o=>{O(i=>i.filter(F=>F.uid!==o.uid||F.url!==o.url))},[]),ra=s(o=>{J(null),O(j?i=>i.map(F=>F.identifier===j.identifier?o:F):i=>[...i,o]),P(!1),V(void 0)},[j]),oa=s(()=>{P(!1),V(void 0),J(null)},[]),ia=s(async()=>{Qe(!0),X(""),K("");try{await Oa({templateId:e.id}),K(t.generateQuoteSuccessMessage)}catch(o){console.error("Failed to generate quote from template:",o);const i=o instanceof Error?o.message:t.generateQuoteErrorFallback;X(i)}finally{Qe(!1)}},[e,t.generateQuoteSuccessMessage,t.generateQuoteErrorFallback]),ca=s(()=>{Te(!1),X(""),K("")},[]),ma=s(async()=>{ye(!0),Y(""),G("");try{await Wa({templateId:e.id}),G(t.acceptSuccessMessage),setTimeout(()=>{re(!1),G("")},2e3)}catch(o){console.error("Failed to accept quote template:",o);const i=o instanceof Error?o.message:t.acceptErrorFallback;Y(i)}finally{ye(!1)}},[e,t.acceptSuccessMessage,t.acceptErrorFallback]),la=s(()=>{re(!1),Y(""),G("")},[]),sa=h(()=>{const o=!(e!=null&&e.canSendForReview),i=E||(e==null?void 0:e.name);return a(D,{name:"TemplateName",slot:n==null?void 0:n.TemplateName,context:{templateName:e==null?void 0:e.name,templateData:e,templateDisplayName:i,isRenameDisabled:o},children:p("div",{className:"quote-management-manage-negotiable-quote-template__template-name-wrapper",children:[a("h1",{"data-testid":"template-name",className:"quote-management-manage-negotiable-quote-template__template-name-title",children:i}),a("button",{onClick:()=>we(i),disabled:o,"data-testid":"rename-template-button",className:"quote-management-manage-negotiable-quote-template__rename-button","aria-label":"Rename template",children:a(wa,{})})]})})},[n==null?void 0:n.TemplateName,e,we,E]),da=h(()=>a(D,{name:"TemplateStatus",slot:n==null?void 0:n.TemplateStatus,context:{templateStatus:e==null?void 0:e.status,templateData:e},children:a("div",{"data-testid":"template-status",children:e==null?void 0:e.status})}),[n==null?void 0:n.TemplateStatus,e]),ua=h(()=>{if(!e)return;const o=e.expirationDate?Oe(e.expirationDate,"short"):void 0;return p(D,{name:"Details",slot:n==null?void 0:n.Details,context:{templateData:e},children:[p("div",{className:"quote-management-manage-negotiable-quote-template__detail",children:[a("span",{className:"quote-management-manage-negotiable-quote-template__detail-title","data-testid":"template-id-label",children:t.templateIdLabel}),a("span",{className:"quote-management-manage-negotiable-quote-template__detail-content","data-testid":"template-id-value",children:e.id})]}),p("div",{className:"quote-management-manage-negotiable-quote-template__detail",children:[a("span",{className:"quote-management-manage-negotiable-quote-template__detail-title","data-testid":"created-label",children:t.createdLabel}),p("span",{className:"quote-management-manage-negotiable-quote-template__detail-content","data-testid":"created-value",children:[Oe(e.createdAt,"short")," (",e.buyer.firstname," ",e.buyer.lastname,")"]})]}),p("div",{className:"quote-management-manage-negotiable-quote-template__detail",children:[a("span",{className:"quote-management-manage-negotiable-quote-template__detail-title","data-testid":"sales-rep-label",children:t.salesRepLabel}),a("span",{className:"quote-management-manage-negotiable-quote-template__detail-content","data-testid":"sales-rep-value",children:e.salesRepName})]}),o&&p("div",{className:"quote-management-manage-negotiable-quote-template__detail",children:[a("span",{className:"quote-management-manage-negotiable-quote-template__detail-title","data-testid":"expires-label",children:t.expiresLabel}),a("span",{className:"quote-management-manage-negotiable-quote-template__detail-content","data-testid":"expires-value",children:o})]})]})},[n==null?void 0:n.Details,t,e]),Be=h(()=>[{label:t.generateQuote,value:"generateQuote",disabled:!(e!=null&&e.canGenerateQuoteFromTemplate)}],[t,e==null?void 0:e.canGenerateQuoteFromTemplate]),ga=h(()=>{const o=i=>{switch(i){case"generateQuote":Te(!0),X(""),K(""),u==null||u(i);break}};return a(D,{name:"ActionBar",slot:n==null?void 0:n.ActionBar,context:{templateData:e},children:a(ka,{dropdownPlaceholder:t.actionsLabel,dropdownOptions:[],buttons:Be.map(i=>a(k,{variant:"tertiary",onClick:()=>o(i.value),"data-testid":`actions-bar-${i.value}-button`,"data-action":i.value,disabled:i.disabled,children:i.label},i.value))})})},[Be,t,n==null?void 0:n.ActionBar,e,u]),Z=h(()=>{const o=e==null?void 0:e.status;return o==="Draft"||o==="Open"},[e==null?void 0:e.status]),pa=h(()=>{const o=f.length>0||Z,i=o?t.referenceDocumentsTitle:void 0;return a(D,{name:"ReferenceDocuments",slot:n==null?void 0:n.ReferenceDocuments,context:{templateData:e,referenceDocuments:f,isEditable:Z,onAddDocument:me,onEditDocument:le,onRemoveDocument:se,referenceDocumentsTitle:t.referenceDocumentsTitle},children:p("div",{"data-testid":"reference-documents",children:[o&&a("h2",{children:i}),a(Ka,{documents:f,isEditable:Z,onAdd:me,onEdit:le,onRemove:se})]})})},[n==null?void 0:n.ReferenceDocuments,t,e,f,Z,me,le,se]),fa=h(()=>a(D,{name:"ShippingInformationTitle",slot:n==null?void 0:n.ShippingInformationTitle,context:{templateData:e},children:a("h2",{children:t.shippingInformationTitle})}),[n==null?void 0:n.ShippingInformationTitle,e,t]),ba=h(()=>{var o;return a(D,{name:"ShippingInformation",slot:n==null?void 0:n.ShippingInformation,context:{templateData:e,loading:Q,setLoading:b},children:a(Ga,{shippingAddress:(o=e==null?void 0:e.shippingAddresses)==null?void 0:o[0],loading:Q,"data-testid":"manage-template-shipping-address"})})},[n==null?void 0:n.ShippingInformation,e,Q,b]),Ma=h(()=>a(D,{name:"ItemsTable",slot:n==null?void 0:n.ItemsTable,context:{templateData:e},children:a(Ha,{tabs:new Map([["items-quoted",t.itemsQuotedTab],["comments",t.commentsTab],["history-log",t.historyLogTab]]),tabsContent:new Map([["items-quoted",a(D,{name:"ItemsQuotedTab",slot:n==null?void 0:n.ItemsQuotedTab,context:{templateData:e},children:a($a,{templateData:e})},"items-quoted")],["comments",a(D,{name:"CommentsTab",slot:n==null?void 0:n.CommentsTab,context:{templateData:e},children:a(za,{templateData:e})},"comments")],["history-log",a(D,{name:"HistoryLogTab",slot:n==null?void 0:n.HistoryLogTab,context:{templateData:e},children:a(Pa,{templateData:e})},"history-log")]])})}),[n==null?void 0:n.ItemsTable,n==null?void 0:n.ItemsQuotedTab,n==null?void 0:n.CommentsTab,n==null?void 0:n.HistoryLogTab,t,e]),ha=h(()=>a(D,{name:"CommentsTitle",slot:n==null?void 0:n.CommentsTitle,context:{templateData:e},children:a("h2",{children:t.commentsTitle})}),[n==null?void 0:n.CommentsTitle,t,e]),Ta=h(()=>a(D,{name:"Comments",slot:n==null?void 0:n.Comments,context:{templateData:e},children:a(Ia,{name:"templateComments",placeholder:t.templateCommentsPlaceholder,rows:3,value:M,onInput:o=>{m(o.target.value)},disabled:!(e!=null&&e.canSendForReview)||r})}),[n==null?void 0:n.Comments,t,e,M,r]),Fe=h(()=>z?a(L,{type:"warning",variant:"primary",icon:a(U,{}),heading:t.unsavedChangesWarningHeading,description:t.unsavedChangesWarningMessage,"data-testid":"unsaved-changes-warning-alert"}):void 0,[z,t.unsavedChangesWarningHeading,t.unsavedChangesWarningMessage]),Ae=h(()=>{var o;return(o=e==null?void 0:e.shippingAddresses)!=null&&o.length?void 0:a(L,{type:"warning",variant:"primary",icon:a(U,{}),heading:t.shippingAddressWarningHeading,description:t.shippingAddressWarningMessage,"data-testid":"shipping-address-warning-alert"})},[(Ue=e==null?void 0:e.shippingAddresses)==null?void 0:Ue.length,t.shippingAddressWarningHeading,t.shippingAddressWarningMessage]),Na=h(()=>p(fe,{children:[Fe,Ae]}),[Fe,Ae]),Qa=h(()=>{var i;const o=(e==null?void 0:e.status)===Ge.OPEN&&(e==null?void 0:e.canAccept);return p(D,{name:"Footer",slot:n==null?void 0:n.Footer,context:{templateData:e,comment:M,isSubmitting:r,referenceDocuments:f,hasUnsavedChanges:z,handleSendForReview:ce,showAcceptButton:o,renameTemplateName:E,renameReason:$},children:[o&&a(k,{variant:"primary",onClick:()=>{re(!0),Y(""),G("")},"data-testid":"accept-button",disabled:r||z,children:t.accept}),(e==null?void 0:e.canSendForReview)&&a(k,{variant:"primary",onClick:ce,"data-testid":"send-for-review-button",disabled:r||!((i=e==null?void 0:e.shippingAddresses)!=null&&i.length),children:t.sendForReview}),(e==null?void 0:e.canCancel)&&a(k,{variant:"tertiary",onClick:()=>H(!0),"data-testid":"cancel-template-button",disabled:r,children:t.cancel}),(e==null?void 0:e.canDelete)&&a(k,{variant:"tertiary",onClick:()=>T(!0),"data-testid":"delete-template-button",disabled:r,children:t.delete})]})},[n==null?void 0:n.Footer,t,e,M,r,ce,f,z,E,$]),va=y?a(L,{type:"error",variant:"primary",icon:a(U,{}),heading:t.confirmationModalDeleteErrorHeading,description:y,onDismiss:Ye,"data-testid":"confirmation-modal-error-banner"}):null,xe=(_?a(L,{type:"success",variant:"primary",icon:a(pe,{}),heading:t.confirmationModalDeleteSuccessHeading,description:t.confirmationModalDeleteSuccessDescription,onDismiss:Ze,"data-testid":"confirmation-modal-success-banner"}):null)||va,Ca=A?a(L,{type:"error",variant:"primary",icon:a(U,{}),heading:t.confirmationModalCancelErrorHeading,description:A,onDismiss:na,"data-testid":"confirmation-modal-cancel-error-banner"}):null,We=(te?a(L,{type:"success",variant:"primary",icon:a(pe,{}),heading:t.confirmationModalCancelSuccessHeading,description:t.confirmationModalCancelSuccessDescription,onDismiss:ta,"data-testid":"confirmation-modal-cancel-success-banner"}):null)||Ca,qa=h(()=>oe?a(L,{type:"error",variant:"primary",icon:a(U,{color:"var(--color-error)"}),heading:t.renameErrorHeading,description:oe}):void 0,[oe,t.renameErrorHeading]),_a=h(()=>ie?a(L,{type:"success",variant:"primary",icon:a(pe,{}),heading:t.renameSuccessHeading,description:ie}):void 0,[ie,t.renameSuccessHeading]),ya={...q,loading:Q,templateName:sa,templateStatus:da,banner:Na,details:ua,actionBar:ga,referenceDocuments:pa,itemsTable:Ma,shippingInformationTitle:fa,shippingInformation:ba,commentsTitle:ha,comments:Ta,footer:Qa};let de=null;ve?de=a(L,{type:"success",variant:"primary",icon:a(ee,{source:"CheckWithCircle"}),heading:t.generateQuoteModalSuccessHeading,description:ve,"data-testid":"generate-quote-success-banner"}):Ce&&(de=a(L,{type:"error",variant:"primary",icon:a(ee,{source:"WarningFilled"}),heading:t.generateQuoteModalErrorHeading,description:Ce,"data-testid":"generate-quote-error-banner"}));let ue=null;return Re?ue=a(L,{type:"success",variant:"primary",icon:a(ee,{source:"CheckWithCircle"}),heading:t.acceptModalSuccessHeading,description:Re,"data-testid":"accept-success-banner"}):Se&&(ue=a(L,{type:"error",variant:"primary",icon:a(ee,{source:"WarningFilled"}),heading:t.acceptModalErrorHeading,description:Se,"data-testid":"accept-error-banner"})),p(fe,{children:[a(ja,{...ya}),g&&x(a(ae,{open:g,title:t.confirmationModalDeleteTitle,message:t.confirmationModalDeleteMessage,cancelLabel:t.confirmationModalCancel,confirmLabel:t.confirmationModalDeleteConfirm,onCancel:Ke,onConfirm:Xe,showCloseButton:!xe,confirmationBanner:xe}),document.body),C&&x(a(ae,{open:C,title:t.confirmationModalCancelTitle,message:t.confirmationModalCancelMessage,cancelLabel:t.confirmationModalCancel,confirmLabel:t.confirmationModalCancelConfirm,onCancel:ea,onConfirm:aa,showCloseButton:!We,confirmationBanner:We}),document.body),Me&&x(a(Ja,{open:Me,document:j,errorMessage:$e||void 0,onSave:ra,onClose:oa,isSubmitting:r}),document.body),he&&x(a(ae,{open:he,title:t.generateQuoteModalTitle,message:t.generateQuoteModalMessage,cancelLabel:t.generateQuoteModalCancel,confirmLabel:Ne?t.generateQuoteModalConfirmLoading:t.generateQuoteModalConfirm,onCancel:ca,onConfirm:Ne?void 0:ia,showCloseButton:!0,confirmationBanner:de,"data-testid":"generate-quote-confirmation-modal"}),document.body),qe&&x(a(ae,{open:qe,title:t.acceptModalTitle,message:t.acceptModalMessage,cancelLabel:t.acceptModalCancel,confirmLabel:_e?t.acceptModalConfirmLoading:t.acceptModalConfirm,onCancel:la,onConfirm:_e?void 0:ma,showCloseButton:!0,confirmationBanner:ue,"data-testid":"accept-confirmation-modal"}),document.body),Ie&&x(a(Ba,{open:Ie,quoteName:E,renameReason:$,quoteNameError:ze,errorBanner:qa,successBanner:_a,onQuoteNameChange:je,onRenameReasonChange:Ve,onSave:Je,onClose:Pe}),document.body)]})};export{wn as ManageNegotiableQuoteTemplate,wn as default};
6
6
  //# sourceMappingURL=ManageNegotiableQuoteTemplate.js.map