@dropins/storefront-quote-management 1.0.0-beta1 → 1.0.0-beta10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE.md +25 -26
- package/api/duplicateNegotiableQuote/duplicateNegotiableQuote.d.ts +1 -0
- package/api/getQuoteTemplates/graphql/getQuoteTemplates.d.ts +1 -1
- package/api/getStoreConfig/graphql/StoreConfigQuery.d.ts +1 -1
- package/api/graphql/NegotiableQuoteTemplateFragment.d.ts +1 -1
- package/api/sendForReview/index.d.ts +1 -1
- package/api/sendQuoteTemplateForReview/sendQuoteTemplateForReview.d.ts +10 -0
- package/api.js +10 -47
- package/api.js.map +1 -1
- package/chunks/AttachedFilesList.js +1 -1
- package/chunks/AttachedFilesList.js.map +1 -1
- package/chunks/ConfirmationModal.js +1 -1
- package/chunks/ConfirmationModal.js.map +1 -1
- package/chunks/ItemsQuoted.js +1 -1
- package/chunks/ItemsQuoted.js.map +1 -1
- package/chunks/ItemsQuotedTemplate.js +1 -1
- package/chunks/ItemsQuotedTemplate.js.map +1 -1
- package/chunks/LineItemNoteModal.js +4 -0
- package/chunks/LineItemNoteModal.js.map +1 -0
- package/chunks/NegotiableQuoteFragment.js +1 -0
- package/chunks/NegotiableQuoteFragment.js.map +1 -1
- package/chunks/NegotiableQuoteTemplateFragment.js +154 -6
- package/chunks/NegotiableQuoteTemplateFragment.js.map +1 -1
- package/chunks/OrderSummaryLine.js +1 -1
- package/chunks/OrderSummaryLine.js.map +1 -1
- package/chunks/QuoteTemplateCommentsList.js +1 -1
- package/chunks/QuoteTemplateCommentsList.js.map +1 -1
- package/chunks/RenameQuoteModal.js +4 -0
- package/chunks/RenameQuoteModal.js.map +1 -0
- package/chunks/ShippingAddressDisplay.js +1 -1
- package/chunks/ShippingAddressDisplay.js.map +1 -1
- package/chunks/addQuoteTemplateLineItemNote.js +23 -3
- package/chunks/addQuoteTemplateLineItemNote.js.map +1 -1
- package/chunks/duplicateNegotiableQuote.js +5 -5
- package/chunks/duplicateNegotiableQuote.js.map +1 -1
- package/chunks/getQuoteTemplates.js +13 -11
- package/chunks/getQuoteTemplates.js.map +1 -1
- package/chunks/negotiableQuotes.js +1 -1
- package/chunks/openQuoteTemplate.js +29 -8
- package/chunks/openQuoteTemplate.js.map +1 -1
- package/chunks/state.js +1 -1
- package/chunks/state.js.map +1 -1
- package/chunks/transform-quote-template.js +1 -1
- package/chunks/transform-quote-template.js.map +1 -1
- package/chunks/transform-quote.js +1 -1
- package/chunks/transform-quote.js.map +1 -1
- package/components/LineItemNoteModal/LineItemNoteModal.d.ts +2 -2
- package/components/ManageNegotiableQuoteTemplate/ManageNegotiableQuoteTemplate.d.ts +5 -2
- package/components/ProductListTable/ProductListTable.d.ts +5 -49
- package/components/ReferenceDocumentFormModal/ReferenceDocumentFormModal.d.ts +30 -0
- package/components/ReferenceDocumentFormModal/index.d.ts +11 -0
- package/components/ReferenceDocumentsList/ReferenceDocumentsList.d.ts +18 -0
- package/components/ReferenceDocumentsList/index.d.ts +11 -0
- package/components/index.d.ts +2 -0
- package/containers/ItemsQuoted/ItemsQuoted.d.ts +7 -7
- package/containers/ItemsQuoted.js +1 -1
- package/containers/ItemsQuotedTemplate/ItemsQuotedTemplate.d.ts +5 -1
- package/containers/ItemsQuotedTemplate.js +1 -1
- package/containers/ManageNegotiableQuote/ManageNegotiableQuote.d.ts +3 -0
- package/containers/ManageNegotiableQuote.js +1 -1
- package/containers/ManageNegotiableQuote.js.map +1 -1
- package/containers/ManageNegotiableQuoteTemplate/ManageNegotiableQuoteTemplate.d.ts +46 -5
- package/containers/ManageNegotiableQuoteTemplate.js +3 -1
- package/containers/ManageNegotiableQuoteTemplate.js.map +1 -1
- package/containers/OrderSummary.js +1 -1
- package/containers/OrderSummary.js.map +1 -1
- package/containers/OrderSummaryLine.js +1 -1
- package/containers/QuoteSummaryList/QuoteSummaryList.d.ts +1 -1
- package/containers/QuoteSummaryList.js +1 -1
- package/containers/QuoteSummaryList.js.map +1 -1
- package/containers/QuoteTemplatesListTable.js +1 -1
- package/containers/QuoteTemplatesListTable.js.map +1 -1
- package/containers/QuotesListTable.js +1 -1
- package/containers/QuotesListTable.js.map +1 -1
- package/containers/RequestNegotiableQuoteForm.js +1 -1
- package/containers/RequestNegotiableQuoteForm.js.map +1 -1
- package/containers/ShippingAddressDisplay/ShippingAddressDisplay.d.ts +2 -2
- package/containers/ShippingAddressDisplay.js +1 -1
- package/data/models/__fixtures__/negotiableQuoteModel.d.ts +5 -5
- package/data/models/negotiable-quote-model.d.ts +3 -2
- package/data/models/negotiable-quote-template-model.d.ts +4 -39
- package/data/models/store-config-model.d.ts +2 -0
- package/data/transforms/__fixtures__/negotiableQuoteData.d.ts +8 -0
- package/data/transforms/__fixtures__/negotiableQuoteTemplateData.d.ts +616 -75
- package/data/transforms/__fixtures__/storeConfigData.d.ts +4 -0
- package/data/transforms/transform-history.d.ts +15 -0
- package/data/transforms/transform-quote-items.d.ts +15 -0
- package/hooks/useItemsQuotedTemplate.d.ts +15 -0
- package/hooks/useReferenceDocumentLinks.d.ts +34 -0
- package/hooks/useRemoveTemplateItems.d.ts +25 -0
- package/hooks/useRenameTemplate.d.ts +71 -0
- package/hooks/useUpdateTemplateQuantities.d.ts +27 -0
- package/i18n/en_US.json.d.ts +93 -6
- package/lib/itemFormatters.d.ts +1 -1
- package/lib/priceCalculators.d.ts +1 -1
- package/package.json +1 -1
- package/render.js +3 -3
- package/render.js.map +1 -1
- package/chunks/LineItemNoteModal2.js +0 -4
- package/chunks/LineItemNoteModal2.js.map +0 -1
- package/chunks/TabbedContent.js +0 -4
- package/chunks/TabbedContent.js.map +0 -1
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/*! Copyright 2025 Adobe
|
|
2
2
|
All Rights Reserved. */
|
|
3
|
-
import{events as
|
|
3
|
+
import{events as s}from"@dropins/tools/event-bus.js";import{t as n}from"./transform-quote-template.js";import{s as o}from"./state.js";import{f as i}from"./transform-quote.js";const l=`
|
|
4
4
|
query QUOTE_TEMPLATES_QUERY(
|
|
5
5
|
$filter: NegotiableQuoteTemplateFilterInput
|
|
6
6
|
$pageSize: Int
|
|
@@ -14,22 +14,24 @@ import{events as n}from"@dropins/tools/event-bus.js";import{t as s}from"./transf
|
|
|
14
14
|
sort: $sort
|
|
15
15
|
) {
|
|
16
16
|
items {
|
|
17
|
-
|
|
17
|
+
uid
|
|
18
18
|
template_id
|
|
19
19
|
name
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
20
|
+
created_at
|
|
21
|
+
updated_at
|
|
22
|
+
last_ordered_at
|
|
23
23
|
status
|
|
24
24
|
state
|
|
25
25
|
min_negotiated_grand_total
|
|
26
26
|
last_shared_at
|
|
27
|
-
|
|
27
|
+
expiration_date
|
|
28
28
|
orders_placed
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
29
|
+
prices {
|
|
30
|
+
grand_total {
|
|
31
|
+
currency
|
|
32
|
+
value
|
|
33
|
+
}
|
|
34
|
+
}
|
|
33
35
|
}
|
|
34
36
|
page_info {
|
|
35
37
|
current_page
|
|
@@ -46,5 +48,5 @@ import{events as n}from"@dropins/tools/event-bus.js";import{t as s}from"./transf
|
|
|
46
48
|
}
|
|
47
49
|
}
|
|
48
50
|
}
|
|
49
|
-
`;var u=(e=>(e.ACTIVE="ACTIVE",e.IN_REVIEW="IN_REVIEW",e.INACTIVE="INACTIVE",e))(u||{}),
|
|
51
|
+
`;var u=(e=>(e.ACTIVE="ACTIVE",e.IN_REVIEW="IN_REVIEW",e.INACTIVE="INACTIVE",e))(u||{}),p=(e=>(e.NAME="NAME",e.CREATED_AT="CREATED_AT",e.UPDATED_AT="UPDATED_AT",e))(p||{}),E=(e=>(e.ASC="ASC",e.DESC="DESC",e))(E||{});const c=async(e={})=>{var r;if(!o.authenticated)throw new Error("Unauthorized");try{const t=await i(l,{variables:{filter:e.filter||null,pageSize:e.pageSize||20,currentPage:e.currentPage||1,sort:e.sort||null}});if(!((r=t==null?void 0:t.data)!=null&&r.negotiableQuoteTemplates))throw new Error("No quote templates data received");const a=n(t.data.negotiableQuoteTemplates);if(!a)throw new Error("Failed to transform quote templates data");return s.emit("quote-management/quote-templates-data",{quoteTemplates:a,permissions:o.permissions}),a}catch(t){return Promise.reject(t)}};export{u as Q,E as S,p as a,c as g};
|
|
50
52
|
//# sourceMappingURL=getQuoteTemplates.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getQuoteTemplates.js","sources":["/@dropins/storefront-quote-management/src/api/getQuoteTemplates/graphql/getQuoteTemplates.ts","/@dropins/storefront-quote-management/src/api/getQuoteTemplates/getQuoteTemplates.ts"],"sourcesContent":["/********************************************************************\n * Copyright 2025 Adobe\n * All Rights Reserved.\n *\n * NOTICE: Adobe permits you to use, modify, and distribute this\n * file in accordance with the terms of the Adobe license agreement\n * accompanying it.\n *******************************************************************/\n\nexport const QUOTE_TEMPLATES_QUERY = /* GraphQL */ `\n query QUOTE_TEMPLATES_QUERY(\n $filter: NegotiableQuoteTemplateFilterInput\n $pageSize: Int\n $currentPage: Int\n $sort: NegotiableQuoteTemplateSortInput\n ) {\n negotiableQuoteTemplates(\n filter: $filter\n pageSize: $pageSize\n currentPage: $currentPage\n sort: $sort\n ) {\n items {\n
|
|
1
|
+
{"version":3,"file":"getQuoteTemplates.js","sources":["/@dropins/storefront-quote-management/src/api/getQuoteTemplates/graphql/getQuoteTemplates.ts","/@dropins/storefront-quote-management/src/api/getQuoteTemplates/getQuoteTemplates.ts"],"sourcesContent":["/********************************************************************\n * Copyright 2025 Adobe\n * All Rights Reserved.\n *\n * NOTICE: Adobe permits you to use, modify, and distribute this\n * file in accordance with the terms of the Adobe license agreement\n * accompanying it.\n *******************************************************************/\n\nexport const QUOTE_TEMPLATES_QUERY = /* GraphQL */ `\n query QUOTE_TEMPLATES_QUERY(\n $filter: NegotiableQuoteTemplateFilterInput\n $pageSize: Int\n $currentPage: Int\n $sort: NegotiableQuoteTemplateSortInput\n ) {\n negotiableQuoteTemplates(\n filter: $filter\n pageSize: $pageSize\n currentPage: $currentPage\n sort: $sort\n ) {\n items {\n uid\n template_id\n name\n created_at\n updated_at\n last_ordered_at\n status\n state\n min_negotiated_grand_total\n last_shared_at\n expiration_date\n orders_placed\n prices {\n grand_total {\n currency\n value\n }\n }\n }\n page_info {\n current_page\n page_size\n total_pages\n }\n total_count\n sort_fields {\n default\n options {\n label\n value\n }\n }\n }\n }\n`;\n","/********************************************************************\n * Copyright 2025 Adobe\n * All Rights Reserved.\n *\n * NOTICE: Adobe permits you to use, modify, and distribute this \n * file in accordance with the terms of the Adobe license agreement \n * accompanying it. \n *******************************************************************/\n\nimport { fetchGraphQl } from '@/quote-management/api';\nimport { QUOTE_TEMPLATES_QUERY } from './graphql/getQuoteTemplates';\nimport { transformQuoteTemplatesList } from '@/quote-management/data/transforms';\nimport { NegotiableQuoteTemplatesListModel } from '@/quote-management/data/models/negotiable-quote-template-model';\nimport { state } from '@/quote-management/lib/state';\nimport { events } from '@adobe-commerce/event-bus';\n\nexport enum QuoteTemplateFilterStatus {\n ACTIVE = 'ACTIVE',\n IN_REVIEW = 'IN_REVIEW',\n INACTIVE = 'INACTIVE',\n}\n\nexport interface QuoteTemplateFilterInput {\n status?: QuoteTemplateFilterStatus[];\n name?: {\n match?: string;\n };\n}\n\nexport enum QuoteTemplateSortField {\n NAME = 'NAME',\n CREATED_AT = 'CREATED_AT',\n UPDATED_AT = 'UPDATED_AT',\n}\n\nexport enum SortDirection {\n ASC = 'ASC',\n DESC = 'DESC',\n}\n\nexport interface QuoteTemplateSortInput {\n sortField: QuoteTemplateSortField;\n sortDirection: SortDirection;\n}\n\nexport interface GetQuoteTemplatesParams {\n filter?: QuoteTemplateFilterInput;\n pageSize?: number;\n currentPage?: number;\n sort?: QuoteTemplateSortInput;\n}\n\nexport const getQuoteTemplates = async (\n params: GetQuoteTemplatesParams = {}\n): Promise<NegotiableQuoteTemplatesListModel> => {\n if (!state.authenticated) {\n throw new Error('Unauthorized');\n }\n\n try {\n const results: any = await fetchGraphQl(QUOTE_TEMPLATES_QUERY, {\n variables: {\n filter: params.filter || null,\n pageSize: params.pageSize || 20,\n currentPage: params.currentPage || 1,\n sort: params.sort || null,\n },\n });\n\n if (!results?.data?.negotiableQuoteTemplates) {\n throw new Error('No quote templates data received');\n }\n\n const transformedData = transformQuoteTemplatesList(results.data.negotiableQuoteTemplates);\n\n if (!transformedData) {\n throw new Error('Failed to transform quote templates data');\n }\n\n events.emit('quote-management/quote-templates-data', {\n quoteTemplates: transformedData,\n permissions: state.permissions,\n });\n\n return transformedData;\n } catch (error) {\n return Promise.reject(error);\n }\n};"],"names":["QUOTE_TEMPLATES_QUERY","QuoteTemplateFilterStatus","QuoteTemplateSortField","SortDirection","getQuoteTemplates","params","state","results","fetchGraphQl","_a","transformedData","transformQuoteTemplatesList","events","error"],"mappings":"+KASO,MAAMA,EAAsC;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,ECO5C,IAAKC,GAAAA,IACVA,EAAA,OAAS,SACTA,EAAA,UAAY,YACZA,EAAA,SAAW,WAHDA,IAAAA,GAAA,CAAA,CAAA,EAaAC,GAAAA,IACVA,EAAA,KAAO,OACPA,EAAA,WAAa,aACbA,EAAA,WAAa,aAHHA,IAAAA,GAAA,CAAA,CAAA,EAMAC,GAAAA,IACVA,EAAA,IAAM,MACNA,EAAA,KAAO,OAFGA,IAAAA,GAAA,CAAA,CAAA,EAiBL,MAAMC,EAAoB,MAC/BC,EAAkC,KACa,OAC/C,GAAI,CAACC,EAAM,cACT,MAAM,IAAI,MAAM,cAAc,EAGhC,GAAI,CACF,MAAMC,EAAe,MAAMC,EAAaR,EAAuB,CAC7D,UAAW,CACT,OAAQK,EAAO,QAAU,KACzB,SAAUA,EAAO,UAAY,GAC7B,YAAaA,EAAO,aAAe,EACnC,KAAMA,EAAO,MAAQ,IAAA,CACvB,CACD,EAED,GAAI,GAACI,EAAAF,GAAA,YAAAA,EAAS,OAAT,MAAAE,EAAe,0BAClB,MAAM,IAAI,MAAM,kCAAkC,EAGpD,MAAMC,EAAkBC,EAA4BJ,EAAQ,KAAK,wBAAwB,EAEzF,GAAI,CAACG,EACH,MAAM,IAAI,MAAM,0CAA0C,EAG5D,OAAAE,EAAO,KAAK,wCAAyC,CACnD,eAAgBF,EAChB,YAAaJ,EAAM,WAAA,CACpB,EAEMI,CACT,OAASG,EAAO,CACd,OAAO,QAAQ,OAAOA,CAAK,CAC7B,CACF"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/*! Copyright 2025 Adobe
|
|
2
2
|
All Rights Reserved. */
|
|
3
|
-
import"@dropins/tools/event-bus.js";import{f as n,
|
|
3
|
+
import"@dropins/tools/event-bus.js";import{f as n,d as s}from"./transform-quote.js";import{s as i}from"./state.js";const u=`
|
|
4
4
|
fragment NegotiableQuoteListFragment on NegotiableQuote {
|
|
5
5
|
uid
|
|
6
6
|
name
|
|
@@ -1,31 +1,52 @@
|
|
|
1
1
|
/*! Copyright 2025 Adobe
|
|
2
2
|
All Rights Reserved. */
|
|
3
|
-
import{events as
|
|
3
|
+
import{events as l}from"@dropins/tools/event-bus.js";import{a as p}from"./transform-quote-template.js";import{s as r}from"./state.js";import{N as u}from"./NegotiableQuoteTemplateFragment.js";import{f as d}from"./transform-quote.js";const s=`
|
|
4
4
|
mutation SEND_QUOTE_TEMPLATE_FOR_REVIEW_MUTATION(
|
|
5
5
|
$templateId: ID!
|
|
6
6
|
$comment: String
|
|
7
7
|
$name: String
|
|
8
|
+
$referenceDocumentLinks: [NegotiableQuoteTemplateReferenceDocumentLinkInput]
|
|
9
|
+
$attachments: [NegotiableQuoteCommentAttachmentInput]
|
|
8
10
|
) {
|
|
9
|
-
submitNegotiableQuoteTemplateForReview(input: { template_id: $templateId, name: $name, comment: $comment }) {
|
|
11
|
+
submitNegotiableQuoteTemplateForReview(input: { template_id: $templateId, name: $name, comment: $comment, reference_document_links: $referenceDocumentLinks, attachments: $attachments }) {
|
|
10
12
|
...NegotiableQuoteTemplateFragment
|
|
11
13
|
}
|
|
12
14
|
}
|
|
13
|
-
${
|
|
14
|
-
`,
|
|
15
|
+
${u}
|
|
16
|
+
`,q=async t=>{var o,e,a;if(!t.templateId)throw new Error("Template ID is required");if(!r.authenticated)throw new Error("Unauthorized");try{const n=(o=t.referenceDocumentLinks)==null?void 0:o.map(m=>({link_id:m.uid,document_name:m.name,document_identifier:m.identifier,reference_document_url:m.url})),i=(e=t.attachments)!=null&&e.length?t.attachments.map(m=>({key:m.key})):void 0,c=await d(s,{variables:{templateId:t.templateId,name:t.name,comment:t.comment||void 0,referenceDocumentLinks:n,attachments:i}});if(!((a=c==null?void 0:c.data)!=null&&a.submitNegotiableQuoteTemplateForReview))throw new Error("No quote template data received");const T=p(c.data.submitNegotiableQuoteTemplateForReview);if(!T)throw new Error("Failed to transform quote template data");return l.emit("quote-management/quote-template-data",{quoteTemplate:T,permissions:r.permissions}),T}catch(n){return Promise.reject(n)}},E=`
|
|
15
17
|
mutation ACCEPT_QUOTE_TEMPLATE_MUTATION($templateId: ID!) {
|
|
16
18
|
acceptNegotiableQuoteTemplate(input: { template_id: $templateId }) {
|
|
17
19
|
...NegotiableQuoteTemplateFragment
|
|
18
20
|
}
|
|
19
21
|
}
|
|
20
22
|
|
|
21
|
-
${
|
|
22
|
-
`,
|
|
23
|
+
${u}
|
|
24
|
+
`,b=async t=>{var o;if(!t.templateId)throw new Error("Template ID is required");if(!r.authenticated)throw new Error("Unauthorized");try{const e=await d(E,{variables:{templateId:t.templateId}});if(!((o=e==null?void 0:e.data)!=null&&o.acceptNegotiableQuoteTemplate))throw new Error("No quote template data received");const a=p(e.data.acceptNegotiableQuoteTemplate);if(!a)throw new Error("Failed to transform quote template data");return l.emit("quote-management/quote-template-data",{quoteTemplate:a,permissions:r.permissions}),a}catch(e){return Promise.reject(e)}},I=`
|
|
25
|
+
mutation CANCEL_QUOTE_TEMPLATE_MUTATION(
|
|
26
|
+
$templateId: ID!
|
|
27
|
+
$comment: String
|
|
28
|
+
) {
|
|
29
|
+
cancelNegotiableQuoteTemplate(
|
|
30
|
+
input: {
|
|
31
|
+
template_id: $templateId
|
|
32
|
+
cancellation_comment: $comment
|
|
33
|
+
}
|
|
34
|
+
) {
|
|
35
|
+
...NegotiableQuoteTemplateFragment
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
${u}
|
|
39
|
+
`,A=async t=>{var o;if(!t.templateId)throw new Error("Template ID is required");if(!r.authenticated)throw new Error("Unauthorized");try{const e=await d(I,{variables:{templateId:t.templateId,comment:t.comment}});if(!((o=e==null?void 0:e.data)!=null&&o.cancelNegotiableQuoteTemplate))throw new Error("No quote template data received");const a=p(e.data.cancelNegotiableQuoteTemplate);if(!a)throw new Error("Failed to transform quote template data");return l.emit("quote-management/quote-template-data",{quoteTemplate:a,permissions:r.permissions}),a}catch(e){return Promise.reject(e)}},_=`
|
|
40
|
+
mutation DELETE_QUOTE_TEMPLATE_MUTATION($templateId: ID!) {
|
|
41
|
+
deleteNegotiableQuoteTemplate(input: { template_id: $templateId })
|
|
42
|
+
}
|
|
43
|
+
`,O=async t=>{var o;if(!t.templateId)throw new Error("Template ID is required");if(!r.authenticated)throw new Error("Unauthorized");try{const e=await d(_,{variables:{templateId:t.templateId}});if(e!=null&&e.errors&&e.errors.length>0){const n=e.errors.map(i=>i==null?void 0:i.message).filter(Boolean).join("; ");throw new Error(n||"Failed to delete quote template")}if(!((o=e==null?void 0:e.data)==null?void 0:o.deleteNegotiableQuoteTemplate))throw new Error("Failed to delete quote template");return l.emit("quote-management/quote-template-deleted",{templateId:t.templateId}),{templateId:t.templateId}}catch(e){return Promise.reject(e)}},w=`
|
|
23
44
|
mutation OPEN_QUOTE_TEMPLATE_MUTATION($templateId: ID!) {
|
|
24
45
|
openNegotiableQuoteTemplate(input: { template_id: $templateId }) {
|
|
25
46
|
...NegotiableQuoteTemplateFragment
|
|
26
47
|
}
|
|
27
48
|
}
|
|
28
49
|
|
|
29
|
-
${
|
|
30
|
-
`,
|
|
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};
|
|
31
52
|
//# 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/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 ) {\n submitNegotiableQuoteTemplateForReview(input: { template_id: $templateId, name: $name, comment: $comment }) {\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 SendQuoteTemplateForReviewParams {\n templateId: string;\n name?: string;\n comment?: 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 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 },\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 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","results","fetchGraphQl","_a","transformedData","transformQuoteTemplate","events","error","ACCEPT_QUOTE_TEMPLATE_MUTATION","acceptQuoteTemplate","OPEN_QUOTE_TEMPLATE_MUTATION","openQuoteTemplate"],"mappings":"wOAWO,MAAMA,EAAwD;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,IAUjEC,CAAkC;AAAA,ECAzBC,EAA6B,MACxCC,GACG,OACH,GAAI,CAACA,EAAO,WACV,MAAM,IAAI,MAAM,yBAAyB,EAG3C,GAAI,CAACC,EAAM,cACT,MAAM,IAAI,MAAM,cAAc,EAGhC,GAAI,CACF,MAAMC,EAAe,MAAMC,EACzBN,EACA,CACE,UAAW,CACT,WAAYG,EAAO,WACnB,KAAMA,EAAO,KACb,QAASA,EAAO,OAAA,CAClB,CACF,EAGF,GAAI,GAACI,EAAAF,GAAA,YAAAA,EAAS,OAAT,MAAAE,EAAe,wCAClB,MAAM,IAAI,MAAM,iCAAiC,EAGnD,MAAMC,EAAkBC,EACtBJ,EAAQ,KAAK,sCAAA,EAGf,GAAI,CAACG,EACH,MAAM,IAAI,MAAM,yCAAyC,EAG3D,OAAAE,EAAO,KAAK,uCAAwC,CAClD,cAAeF,EACf,YAAaJ,EAAM,WAAA,CACpB,EAEMI,CACT,OAASG,EAAO,CACd,OAAO,QAAQ,OAAOA,CAAK,CAC7B,CACF,ECtDaC,EAA+C;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,IAOxDX,CAAkC;AAAA,ECCzBY,EAAsB,MACjCV,GACG,OACH,GAAI,CAACA,EAAO,WACV,MAAM,IAAI,MAAM,yBAAyB,EAG3C,GAAI,CAACC,EAAM,c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phql/sendQuoteTemplateForReview.ts","/@dropins/storefront-quote-management/src/api/sendQuoteTemplateForReview/sendQuoteTemplateForReview.ts","/@dropins/storefront-quote-management/src/api/acceptQuoteTemplate/graphql/acceptQuoteTemplate.ts","/@dropins/storefront-quote-management/src/api/acceptQuoteTemplate/acceptQuoteTemplate.ts","/@dropins/storefront-quote-management/src/api/cancelQuoteTemplate/graphql/cancelQuoteTemplate.ts","/@dropins/storefront-quote-management/src/api/cancelQuoteTemplate/cancelQuoteTemplate.ts","/@dropins/storefront-quote-management/src/api/deleteQuoteTemplate/graphql/deleteQuoteTemplate.ts","/@dropins/storefront-quote-management/src/api/deleteQuoteTemplate/deleteQuoteTemplate.ts","/@dropins/storefront-quote-management/src/api/openQuoteTemplate/graphql/openQuoteTemplate.ts","/@dropins/storefront-quote-management/src/api/openQuoteTemplate/openQuoteTemplate.ts"],"sourcesContent":["/********************************************************************\n * Copyright 2025 Adobe\n * All Rights Reserved.\n *\n * NOTICE: Adobe permits you to use, modify, and distribute this \n * file in accordance with the terms of the Adobe license agreement \n * accompanying it. \n *******************************************************************/\n\nimport { NEGOTIABLE_QUOTE_TEMPLATE_FRAGMENT } from '@/quote-management/api/graphql/NegotiableQuoteTemplateFragment';\n\nexport const SEND_QUOTE_TEMPLATE_FOR_REVIEW_MUTATION = /* GraphQL */ `\n mutation SEND_QUOTE_TEMPLATE_FOR_REVIEW_MUTATION(\n $templateId: ID!\n $comment: String\n $name: String\n $referenceDocumentLinks: [NegotiableQuoteTemplateReferenceDocumentLinkInput]\n $attachments: [NegotiableQuoteCommentAttachmentInput]\n ) {\n submitNegotiableQuoteTemplateForReview(input: { template_id: $templateId, name: $name, comment: $comment, reference_document_links: $referenceDocumentLinks, attachments: $attachments }) {\n ...NegotiableQuoteTemplateFragment\n }\n }\n ${NEGOTIABLE_QUOTE_TEMPLATE_FRAGMENT}\n`;\n","/********************************************************************\n * Copyright 2025 Adobe\n * All Rights Reserved.\n *\n * NOTICE: Adobe permits you to use, modify, and distribute this\n * file in accordance with the terms of the Adobe license agreement\n * accompanying it.\n *******************************************************************/\n\nimport { fetchGraphQl } from '@/quote-management/api';\nimport { SEND_QUOTE_TEMPLATE_FOR_REVIEW_MUTATION } from './graphql/sendQuoteTemplateForReview';\nimport { transformQuoteTemplate } from '@/quote-management/data/transforms';\nimport { state } from '@/quote-management/lib/state';\nimport { events } from '@adobe-commerce/event-bus';\n\nexport interface ReferenceDocumentLinkInput {\n uid?: string;\n name: string;\n identifier?: string;\n url: string;\n}\n\nexport interface SendQuoteTemplateForReviewParams {\n templateId: string;\n name?: string;\n comment?: string;\n referenceDocumentLinks?: ReferenceDocumentLinkInput[];\n attachments?: { key: string }[];\n}\n\nexport const sendQuoteTemplateForReview = async (\n params: SendQuoteTemplateForReviewParams\n) => {\n if (!params.templateId) {\n throw new Error('Template ID is required');\n }\n\n if (!state.authenticated) {\n throw new Error('Unauthorized');\n }\n\n try {\n // Transform reference document links from camelCase to snake_case for GraphQL\n const referenceDocumentLinks = params.referenceDocumentLinks?.map((link) => ({\n link_id: link.uid,\n document_name: link.name,\n document_identifier: link.identifier,\n reference_document_url: link.url,\n }));\n\n // Format attachments for GraphQL (separate field, not nested in comment)\n const attachments = params.attachments?.length \n ? params.attachments.map(att => ({ key: att.key }))\n : undefined;\n\n const results: any = await fetchGraphQl(\n SEND_QUOTE_TEMPLATE_FOR_REVIEW_MUTATION,\n {\n variables: {\n templateId: params.templateId,\n name: params.name,\n comment: params.comment || undefined,\n referenceDocumentLinks,\n attachments,\n },\n }\n );\n\n if (!results?.data?.submitNegotiableQuoteTemplateForReview) {\n throw new Error('No quote template data received');\n }\n\n const transformedData = transformQuoteTemplate(\n results.data.submitNegotiableQuoteTemplateForReview\n );\n\n if (!transformedData) {\n throw new Error('Failed to transform quote template data');\n }\n\n events.emit('quote-management/quote-template-data', {\n quoteTemplate: transformedData,\n permissions: state.permissions,\n });\n\n return transformedData;\n } catch (error) {\n return Promise.reject(error);\n }\n};\n","/********************************************************************\n * Copyright 2025 Adobe\n * All Rights Reserved.\n *\n * NOTICE: Adobe permits you to use, modify, and distribute this \n * file in accordance with the terms of the Adobe license agreement \n * accompanying it. \n *******************************************************************/\n\nimport { NEGOTIABLE_QUOTE_TEMPLATE_FRAGMENT } from '@/quote-management/api/graphql/NegotiableQuoteTemplateFragment';\n\nexport const ACCEPT_QUOTE_TEMPLATE_MUTATION = /* GraphQL */ `\n mutation ACCEPT_QUOTE_TEMPLATE_MUTATION($templateId: ID!) {\n acceptNegotiableQuoteTemplate(input: { template_id: $templateId }) {\n ...NegotiableQuoteTemplateFragment\n }\n }\n \n ${NEGOTIABLE_QUOTE_TEMPLATE_FRAGMENT}\n`;\n\n","/********************************************************************\n * Copyright 2025 Adobe\n * All Rights Reserved.\n *\n * NOTICE: Adobe permits you to use, modify, and distribute this\n * file in accordance with the terms of the Adobe license agreement\n * accompanying it.\n *******************************************************************/\n\nimport { fetchGraphQl } from '@/quote-management/api';\nimport { ACCEPT_QUOTE_TEMPLATE_MUTATION } from './graphql/acceptQuoteTemplate';\nimport { transformQuoteTemplate } from '@/quote-management/data/transforms';\nimport { state } from '@/quote-management/lib/state';\nimport { events } from '@adobe-commerce/event-bus';\n\nexport interface AcceptQuoteTemplateParams {\n templateId: string;\n}\n\nexport const acceptQuoteTemplate = async (\n params: AcceptQuoteTemplateParams\n) => {\n if (!params.templateId) {\n throw new Error('Template ID is required');\n }\n\n if (!state.authenticated) {\n throw new Error('Unauthorized');\n }\n\n try {\n const results: any = await fetchGraphQl(ACCEPT_QUOTE_TEMPLATE_MUTATION, {\n variables: { templateId: params.templateId },\n });\n\n if (!results?.data?.acceptNegotiableQuoteTemplate) {\n throw new Error('No quote template data received');\n }\n\n const transformedData = transformQuoteTemplate(\n results.data.acceptNegotiableQuoteTemplate\n );\n\n if (!transformedData) {\n throw new Error('Failed to transform quote template data');\n }\n\n events.emit('quote-management/quote-template-data', {\n quoteTemplate: transformedData,\n permissions: state.permissions,\n });\n\n return transformedData;\n } catch (error) {\n return Promise.reject(error);\n }\n};\n","/********************************************************************\n * Copyright 2025 Adobe\n * All Rights Reserved.\n *\n * NOTICE: Adobe permits you to use, modify, and distribute this\n * file in accordance with the terms of the Adobe license agreement\n * accompanying it.\n *******************************************************************/\n\nimport { NEGOTIABLE_QUOTE_TEMPLATE_FRAGMENT } from '@/quote-management/api/graphql/NegotiableQuoteTemplateFragment';\n\nexport const CANCEL_QUOTE_TEMPLATE_MUTATION = /* GraphQL */ `\n mutation CANCEL_QUOTE_TEMPLATE_MUTATION(\n $templateId: ID!\n $comment: String\n ) {\n cancelNegotiableQuoteTemplate(\n input: {\n template_id: $templateId\n cancellation_comment: $comment\n }\n ) {\n ...NegotiableQuoteTemplateFragment\n }\n }\n ${NEGOTIABLE_QUOTE_TEMPLATE_FRAGMENT}\n`;\n","/********************************************************************\n * Copyright 2025 Adobe\n * All Rights Reserved.\n *\n * NOTICE: Adobe permits you to use, modify, and distribute this\n * file in accordance with the terms of the Adobe license agreement\n * accompanying it.\n *******************************************************************/\n\nimport { fetchGraphQl } from '@/quote-management/api';\nimport { CANCEL_QUOTE_TEMPLATE_MUTATION } from './graphql/cancelQuoteTemplate';\nimport { transformQuoteTemplate } from '@/quote-management/data/transforms';\nimport { state } from '@/quote-management/lib/state';\nimport { events } from '@adobe-commerce/event-bus';\n\nexport interface CancelQuoteTemplateParams {\n templateId: string;\n comment?: string;\n}\n\nexport const cancelQuoteTemplate = async (\n params: CancelQuoteTemplateParams\n) => {\n if (!params.templateId) {\n throw new Error('Template ID is required');\n }\n\n if (!state.authenticated) {\n throw new Error('Unauthorized');\n }\n\n try {\n const results: any = await fetchGraphQl(CANCEL_QUOTE_TEMPLATE_MUTATION, {\n variables: { templateId: params.templateId, comment: params.comment },\n });\n\n if (!results?.data?.cancelNegotiableQuoteTemplate) {\n throw new Error('No quote template data received');\n }\n\n const transformedData = transformQuoteTemplate(\n results.data.cancelNegotiableQuoteTemplate\n );\n\n if (!transformedData) {\n throw new Error('Failed to transform quote template data');\n }\n\n events.emit('quote-management/quote-template-data', {\n quoteTemplate: transformedData,\n permissions: state.permissions,\n });\n\n return transformedData;\n } catch (error) {\n return Promise.reject(error);\n }\n};\n","/********************************************************************\n * Copyright 2025 Adobe\n * All Rights Reserved.\n *\n * NOTICE: Adobe permits you to use, modify, and distribute this\n * file in accordance with the terms of the Adobe license agreement\n * accompanying it.\n *******************************************************************/\n\nexport const DELETE_QUOTE_TEMPLATE_MUTATION = /* GraphQL */ `\n mutation DELETE_QUOTE_TEMPLATE_MUTATION($templateId: ID!) {\n deleteNegotiableQuoteTemplate(input: { template_id: $templateId })\n }\n`;\n\n","/********************************************************************\n * Copyright 2025 Adobe\n * All Rights Reserved.\n *\n * NOTICE: Adobe permits you to use, modify, and distribute this\n * file in accordance with the terms of the Adobe license agreement\n * accompanying it.\n *******************************************************************/\n\nimport { fetchGraphQl } from '@/quote-management/api';\nimport { DELETE_QUOTE_TEMPLATE_MUTATION } from './graphql/deleteQuoteTemplate';\nimport { state } from '@/quote-management/lib/state';\nimport { events } from '@adobe-commerce/event-bus';\n\nexport interface DeleteQuoteTemplateParams {\n templateId: string;\n}\n\nexport const deleteQuoteTemplate = async (\n params: DeleteQuoteTemplateParams\n) => {\n if (!params.templateId) {\n throw new Error('Template ID is required');\n }\n\n if (!state.authenticated) {\n throw new Error('Unauthorized');\n }\n\n try {\n const results: any = await fetchGraphQl(DELETE_QUOTE_TEMPLATE_MUTATION, {\n variables: { templateId: params.templateId },\n });\n\n if (results?.errors && results.errors.length > 0) {\n const errorMessages = results.errors\n .map((e: any) => e?.message)\n .filter(Boolean)\n .join('; ');\n throw new Error(errorMessages || 'Failed to delete quote template');\n }\n\n const deleted = results?.data?.deleteNegotiableQuoteTemplate;\n\n if (!deleted) {\n throw new Error('Failed to delete quote template');\n }\n\n events.emit('quote-management/quote-template-deleted', {\n templateId: params.templateId,\n });\n\n return { templateId: params.templateId };\n } catch (error) {\n return Promise.reject(error);\n }\n};\n","/********************************************************************\n * Copyright 2025 Adobe\n * All Rights Reserved.\n *\n * NOTICE: Adobe permits you to use, modify, and distribute this\n * file in accordance with the terms of the Adobe license agreement\n * accompanying it.\n *******************************************************************/\n\nimport { NEGOTIABLE_QUOTE_TEMPLATE_FRAGMENT } from '@/quote-management/api/graphql/NegotiableQuoteTemplateFragment';\n\nexport const OPEN_QUOTE_TEMPLATE_MUTATION = /* GraphQL */ `\n mutation OPEN_QUOTE_TEMPLATE_MUTATION($templateId: ID!) {\n openNegotiableQuoteTemplate(input: { template_id: $templateId }) {\n ...NegotiableQuoteTemplateFragment\n }\n }\n\n ${NEGOTIABLE_QUOTE_TEMPLATE_FRAGMENT}\n`;\n","/********************************************************************\n * Copyright 2025 Adobe\n * All Rights Reserved.\n *\n * NOTICE: Adobe permits you to use, modify, and distribute this\n * file in accordance with the terms of the Adobe license agreement\n * accompanying it.\n *******************************************************************/\n\nimport { fetchGraphQl } from '@/quote-management/api';\nimport { OPEN_QUOTE_TEMPLATE_MUTATION } from './graphql/openQuoteTemplate';\nimport { transformQuoteTemplate } from '@/quote-management/data/transforms';\nimport { state } from '@/quote-management/lib/state';\nimport { events } from '@adobe-commerce/event-bus';\n\nexport interface OpenQuoteTemplateParams {\n templateId: string;\n}\n\nexport const openQuoteTemplate = async (params: OpenQuoteTemplateParams) => {\n if (!params.templateId) {\n throw new Error('Template ID is required');\n }\n\n if (!state.authenticated) {\n throw new Error('Unauthorized');\n }\n\n try {\n const results: any = await fetchGraphQl(OPEN_QUOTE_TEMPLATE_MUTATION, {\n variables: { templateId: params.templateId },\n });\n\n if (!results?.data?.openNegotiableQuoteTemplate) {\n throw new Error('No quote template data received');\n }\n\n const transformedData = transformQuoteTemplate(\n results.data.openNegotiableQuoteTemplate\n );\n\n if (!transformedData) {\n throw new Error('Failed to transform quote template data');\n }\n\n events.emit('quote-management/quote-template-data', {\n quoteTemplate: transformedData,\n permissions: state.permissions,\n });\n\n return transformedData;\n } catch (error) {\n return Promise.reject(error);\n }\n};\n"],"names":["SEND_QUOTE_TEMPLATE_FOR_REVIEW_MUTATION","NEGOTIABLE_QUOTE_TEMPLATE_FRAGMENT","sendQuoteTemplateForReview","params","state","referenceDocumentLinks","_a","link","attachments","_b","att","results","fetchGraphQl","_c","transformedData","transformQuoteTemplate","events","error","ACCEPT_QUOTE_TEMPLATE_MUTATION","acceptQuoteTemplate","CANCEL_QUOTE_TEMPLATE_MUTATION","cancelQuoteTemplate","DELETE_QUOTE_TEMPLATE_MUTATION","deleteQuoteTemplate","errorMessages","e","OPEN_QUOTE_TEMPLATE_MUTATION","openQuoteTemplate"],"mappings":"wOAWO,MAAMA,EAAwD;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,IAYjEC,CAAkC;AAAA,ECOzBC,EAA6B,MACxCC,GACG,WACH,GAAI,CAACA,EAAO,WACV,MAAM,IAAI,MAAM,yBAAyB,EAG3C,GAAI,CAACC,EAAM,cACT,MAAM,IAAI,MAAM,cAAc,EAGhC,GAAI,CAEF,MAAMC,GAAyBC,EAAAH,EAAO,yBAAP,YAAAG,EAA+B,IAAKC,IAAU,CAC3E,QAASA,EAAK,IACd,cAAeA,EAAK,KACpB,oBAAqBA,EAAK,WAC1B,uBAAwBA,EAAK,GAAA,IAIzBC,GAAcC,EAAAN,EAAO,cAAP,MAAAM,EAAoB,OACpCN,EAAO,YAAY,IAAIO,IAAQ,CAAE,IAAKA,EAAI,GAAA,EAAM,EAChD,OAEEC,EAAe,MAAMC,EACzBZ,EACA,CACE,UAAW,CACT,WAAYG,EAAO,WACnB,KAAMA,EAAO,KACb,QAASA,EAAO,SAAW,OAC3B,uBAAAE,EACA,YAAAG,CAAA,CACF,CACF,EAGF,GAAI,GAACK,EAAAF,GAAA,YAAAA,EAAS,OAAT,MAAAE,EAAe,wCAClB,MAAM,IAAI,MAAM,iCAAiC,EAGnD,MAAMC,EAAkBC,EACtBJ,EAAQ,KAAK,sCAAA,EAGf,GAAI,CAACG,EACH,MAAM,I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V,MAAM,IAAI,MAAM,yBAAyB,EAG3C,GAAI,CAACC,EAAM,cACT,MAAM,IAAI,MAAM,cAAc,EAGhC,GAAI,CACF,MAAMO,EAAe,MAAMC,EAAac,EAA8B,CACpE,UAAW,CAAE,WAAYvB,EAAO,UAAA,CAAW,CAC5C,EAED,GAAI,GAACG,EAAAK,GAAA,YAAAA,EAAS,OAAT,MAAAL,EAAe,6BAClB,MAAM,IAAI,MAAM,iCAAiC,EAGnD,MAAMQ,EAAkBC,EACtBJ,EAAQ,KAAK,2BAAA,EAGf,GAAI,CAACG,EACH,MAAM,IAAI,MAAM,yCAAyC,EAG3D,OAAAE,EAAO,KAAK,uCAAwC,CAClD,cAAeF,EACf,YAAaV,EAAM,WAAA,CACpB,EAEMU,CACT,OAASG,EAAO,CACd,OAAO,QAAQ,OAAOA,CAAK,CAC7B,CACF"}
|
package/chunks/state.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
/*! Copyright 2025 Adobe
|
|
2
2
|
All Rights Reserved. */
|
|
3
|
-
var a=(e=>(e[e.TAX_EXCLUDED=1]="TAX_EXCLUDED",e[e.TAX_INCLUDED=2]="TAX_INCLUDED",e[e.TAX_INCLUDED_AND_EXCLUDED=3]="TAX_INCLUDED_AND_EXCLUDED",e))(a||{});const
|
|
3
|
+
var a=(e=>(e[e.TAX_EXCLUDED=1]="TAX_EXCLUDED",e[e.TAX_INCLUDED=2]="TAX_INCLUDED",e[e.TAX_INCLUDED_AND_EXCLUDED=3]="TAX_INCLUDED_AND_EXCLUDED",e))(a||{});const l={requestQuote:!1,editQuote:!1,deleteQuote:!1,checkoutQuote:!1,viewQuoteTemplates:!1,manageQuoteTemplates:!1,generateQuoteFromTemplate:!1},u={quoteSummaryDisplayTotal:1,quoteSummaryMaxItems:10,quoteDisplaySettings:{zeroTax:!1,subtotal:a.TAX_INCLUDED,price:a.TAX_INCLUDED,shipping:a.TAX_INCLUDED,fullSummary:!1,grandTotal:!0},useConfigurableParentThumbnail:!0,quoteMinimumAmount:null,quoteMinimumAmountMessage:null},D={authenticated:!1,permissions:l,config:u,initialized:!1,quoteDataLoaded:!1,quoteDataInitialized:!1},r=new Proxy(D,{get:(e,t)=>e[t],set:(e,t,s)=>(e[t]=s,!0)});export{l as D,a as Q,u as a,r as s};
|
|
4
4
|
//# sourceMappingURL=state.js.map
|
package/chunks/state.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"state.js","sources":["/@dropins/storefront-quote-management/src/data/models/store-config-model.ts","/@dropins/storefront-quote-management/src/lib/state.ts"],"sourcesContent":["/********************************************************************\n * Copyright 2025 Adobe\n * All Rights Reserved.\n *\n * NOTICE: Adobe permits you to use, modify, and distribute this\n * file in accordance with the terms of the Adobe license agreement\n * accompanying it.\n *******************************************************************/\n\nexport enum QuoteDisplayAmount {\n TAX_EXCLUDED = 1,\n TAX_INCLUDED = 2,\n TAX_INCLUDED_AND_EXCLUDED = 3,\n}\n\nexport interface StoreConfigModel {\n quoteSummaryDisplayTotal: number;\n quoteSummaryMaxItems: number;\n quoteDisplaySettings: {\n zeroTax: boolean;\n subtotal: QuoteDisplayAmount;\n price: QuoteDisplayAmount;\n shipping: QuoteDisplayAmount;\n fullSummary: boolean;\n grandTotal: boolean;\n };\n useConfigurableParentThumbnail: boolean;\n}\n","/********************************************************************\n * Copyright 2025 Adobe\n * All Rights Reserved.\n *\n * NOTICE: Adobe permits you to use, modify, and distribute this\n * file in accordance with the terms of the Adobe license agreement\n * accompanying it.\n *******************************************************************/\n\nimport {\n QuoteDisplayAmount,\n StoreConfigModel,\n} from '@/quote-management/data/models';\nimport { State } from '@/quote-management/types/state.types';\n\nexport const DEFAULT_PERMISSIONS = {\n requestQuote: false,\n editQuote: false,\n deleteQuote: false,\n checkoutQuote: false,\n viewQuoteTemplates: false,\n manageQuoteTemplates: false,\n generateQuoteFromTemplate: false,\n};\n\nexport const DEFAULT_CONFIG: StoreConfigModel = {\n quoteSummaryDisplayTotal: 1,\n quoteSummaryMaxItems: 10,\n quoteDisplaySettings: {\n zeroTax: false,\n subtotal: QuoteDisplayAmount.TAX_INCLUDED,\n price: QuoteDisplayAmount.TAX_INCLUDED,\n shipping: QuoteDisplayAmount.TAX_INCLUDED,\n fullSummary: false,\n grandTotal: true,\n },\n useConfigurableParentThumbnail: true,\n};\n\nconst _state: State = {\n authenticated: false,\n permissions: DEFAULT_PERMISSIONS,\n config: DEFAULT_CONFIG,\n initialized: false,\n quoteDataLoaded: false,\n quoteDataInitialized: false,\n};\n\n// Proxy state to make it reactive\nexport const state = new Proxy(_state, {\n get: (target, key) => {\n return target[key as keyof State];\n },\n set: (target, key, value) => {\n target[key as keyof State] = value;\n return true;\n },\n});\n"],"names":["QuoteDisplayAmount","DEFAULT_PERMISSIONS","DEFAULT_CONFIG","_state","state","target","key","value"],"mappings":"AASO,IAAKA,GAAAA,IACVA,EAAAA,EAAA,aAAe,CAAA,EAAf,eACAA,EAAAA,EAAA,aAAe,CAAA,EAAf,eACAA,EAAAA,EAAA,0BAA4B,CAAA,EAA5B,4BAHUA,IAAAA,GAAA,CAAA,CAAA,ECML,MAAMC,EAAsB,CACjC,aAAc,GACd,UAAW,GACX,YAAa,GACb,cAAe,GACf,mBAAoB,GACpB,qBAAsB,GACtB,0BAA2B,EAC7B,EAEaC,EAAmC,CAC9C,yBAA0B,EAC1B,qBAAsB,GACtB,qBAAsB,CACpB,QAAS,GACT,SAAUF,EAAmB,aAC7B,MAAOA,EAAmB,aAC1B,SAAUA,EAAmB,aAC7B,YAAa,GACb,WAAY,EAAA,EAEd,+BAAgC,
|
|
1
|
+
{"version":3,"file":"state.js","sources":["/@dropins/storefront-quote-management/src/data/models/store-config-model.ts","/@dropins/storefront-quote-management/src/lib/state.ts"],"sourcesContent":["/********************************************************************\n * Copyright 2025 Adobe\n * All Rights Reserved.\n *\n * NOTICE: Adobe permits you to use, modify, and distribute this\n * file in accordance with the terms of the Adobe license agreement\n * accompanying it.\n *******************************************************************/\n\nexport enum QuoteDisplayAmount {\n TAX_EXCLUDED = 1,\n TAX_INCLUDED = 2,\n TAX_INCLUDED_AND_EXCLUDED = 3,\n}\n\nexport interface StoreConfigModel {\n quoteSummaryDisplayTotal: number;\n quoteSummaryMaxItems: number;\n quoteDisplaySettings: {\n zeroTax: boolean;\n subtotal: QuoteDisplayAmount;\n price: QuoteDisplayAmount;\n shipping: QuoteDisplayAmount;\n fullSummary: boolean;\n grandTotal: boolean;\n };\n useConfigurableParentThumbnail: boolean;\n quoteMinimumAmount: number | null;\n quoteMinimumAmountMessage: string | null;\n}\n","/********************************************************************\n * Copyright 2025 Adobe\n * All Rights Reserved.\n *\n * NOTICE: Adobe permits you to use, modify, and distribute this\n * file in accordance with the terms of the Adobe license agreement\n * accompanying it.\n *******************************************************************/\n\nimport {\n QuoteDisplayAmount,\n StoreConfigModel,\n} from '@/quote-management/data/models';\nimport { State } from '@/quote-management/types/state.types';\n\nexport const DEFAULT_PERMISSIONS = {\n requestQuote: false,\n editQuote: false,\n deleteQuote: false,\n checkoutQuote: false,\n viewQuoteTemplates: false,\n manageQuoteTemplates: false,\n generateQuoteFromTemplate: false,\n};\n\nexport const DEFAULT_CONFIG: StoreConfigModel = {\n quoteSummaryDisplayTotal: 1,\n quoteSummaryMaxItems: 10,\n quoteDisplaySettings: {\n zeroTax: false,\n subtotal: QuoteDisplayAmount.TAX_INCLUDED,\n price: QuoteDisplayAmount.TAX_INCLUDED,\n shipping: QuoteDisplayAmount.TAX_INCLUDED,\n fullSummary: false,\n grandTotal: true,\n },\n useConfigurableParentThumbnail: true,\n quoteMinimumAmount: null,\n quoteMinimumAmountMessage: null,\n};\n\nconst _state: State = {\n authenticated: false,\n permissions: DEFAULT_PERMISSIONS,\n config: DEFAULT_CONFIG,\n initialized: false,\n quoteDataLoaded: false,\n quoteDataInitialized: false,\n};\n\n// Proxy state to make it reactive\nexport const state = new Proxy(_state, {\n get: (target, key) => {\n return target[key as keyof State];\n },\n set: (target, key, value) => {\n target[key as keyof State] = value;\n return true;\n },\n});\n"],"names":["QuoteDisplayAmount","DEFAULT_PERMISSIONS","DEFAULT_CONFIG","_state","state","target","key","value"],"mappings":"AASO,IAAKA,GAAAA,IACVA,EAAAA,EAAA,aAAe,CAAA,EAAf,eACAA,EAAAA,EAAA,aAAe,CAAA,EAAf,eACAA,EAAAA,EAAA,0BAA4B,CAAA,EAA5B,4BAHUA,IAAAA,GAAA,CAAA,CAAA,ECML,MAAMC,EAAsB,CACjC,aAAc,GACd,UAAW,GACX,YAAa,GACb,cAAe,GACf,mBAAoB,GACpB,qBAAsB,GACtB,0BAA2B,EAC7B,EAEaC,EAAmC,CAC9C,yBAA0B,EAC1B,qBAAsB,GACtB,qBAAsB,CACpB,QAAS,GACT,SAAUF,EAAmB,aAC7B,MAAOA,EAAmB,aAC1B,SAAUA,EAAmB,aAC7B,YAAa,GACb,WAAY,EAAA,EAEd,+BAAgC,GAChC,mBAAoB,KACpB,0BAA2B,IAC7B,EAEMG,EAAgB,CACpB,cAAe,GACf,YAAaF,EACb,OAAQC,EACR,YAAa,GACb,gBAAiB,GACjB,qBAAsB,EACxB,EAGaE,EAAQ,IAAI,MAAMD,EAAQ,CACrC,IAAK,CAACE,EAAQC,IACLD,EAAOC,CAAkB,EAElC,IAAK,CAACD,EAAQC,EAAKC,KACjBF,EAAOC,CAAkB,EAAIC,EACtB,GAEX,CAAC"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
/*! Copyright 2025 Adobe
|
|
2
2
|
All Rights Reserved. */
|
|
3
|
-
import{a as
|
|
3
|
+
import{a as _,b as E,c as f}from"./transform-quote.js";var i=(n=>(n.ACTIVE="Active",n.IN_REVIEW="In Review",n.INACTIVE="Inactive",n.SUBMITTED="Submitted",n.PENDING="Pending",n.CLOSED="Closed",n.OPEN="Open",n.UPDATED="Updated",n.EDITED="Edited",n.NEW="New",n.DRAFT="Draft",n.DECLINED="Declined",n.CANCELED="Canceled",n.EXPIRED="Expired",n))(i||{});function l(n){var u,e,s,c;return n?{id:n.template_id,uid:n.uid,name:n.name,createdAt:n.created_at,updatedAt:n.updated_at,expirationDate:n.expiration_date,status:n.status,salesRepName:n.sales_rep_name,buyer:{firstname:n.buyer.firstname,lastname:n.buyer.lastname},comments:(u=n.comments)==null?void 0:u.map(r=>{var o;return{uid:r.uid,createdAt:r.created_at,author:{firstname:r.author.firstname,lastname:r.author.lastname},text:r.text,attachments:(o=r.attachments)==null?void 0:o.map(d=>({name:d.name,url:d.url}))}}),prices:n.prices&&{subtotalExcludingTax:n.prices.subtotal_excluding_tax&&{value:n.prices.subtotal_excluding_tax.value,currency:n.prices.subtotal_excluding_tax.currency},subtotalIncludingTax:n.prices.subtotal_including_tax&&{value:n.prices.subtotal_including_tax.value,currency:n.prices.subtotal_including_tax.currency},subtotalWithDiscountExcludingTax:n.prices.subtotal_with_discount_excluding_tax&&{value:n.prices.subtotal_with_discount_excluding_tax.value,currency:n.prices.subtotal_with_discount_excluding_tax.currency},appliedTaxes:(e=n.prices.applied_taxes)==null?void 0:e.map(r=>({amount:{value:r.amount.value,currency:r.amount.currency},label:r.label})),grandTotal:n.prices.grand_total&&{value:n.prices.grand_total.value,currency:n.prices.grand_total.currency}},history:E(n.history),items:_(n.items),shippingAddresses:(s=n.shipping_addresses)==null?void 0:s.map(r=>({uid:r.uid,firstname:r.firstname,lastname:r.lastname,company:r.company,street:r.street,city:r.city,postcode:r.postcode,country:{code:r.country.code,label:r.country.label},telephone:r.telephone,region:r.region?{code:r.region.code,label:r.region.label,regionId:r.region.region_id}:void 0})),referenceDocuments:(c=n.reference_document_links)==null?void 0:c.map(r=>({uid:r.link_id,name:r.document_name,identifier:r.document_identifier,url:r.reference_document_url})),canAccept:[i.SUBMITTED,i.PENDING,i.OPEN].includes(n.status),canDelete:n.status===i.DRAFT,canReopen:[i.DECLINED,i.CANCELED,i.EXPIRED].includes(n.status),canCancel:[i.SUBMITTED,i.PENDING,i.OPEN,i.ACTIVE,i.EDITED].includes(n.status),canSendForReview:[i.OPEN,i.DRAFT,i.NEW,i.EDITED].includes(n.status),canGenerateQuoteFromTemplate:[i.ACTIVE].includes(n.status),canEditTemplateItems:[i.SUBMITTED,i.DRAFT,i.OPEN,i.EDITED].includes(n.status)}:null}function I(n){var s;if(!n)return null;const u={items:((s=n.items)==null?void 0:s.map(c=>{var r,o,d;return{id:c.template_id,uid:c.uid,name:c.name,createdAt:c.created_at,updatedAt:c.updated_at,status:c.status,state:c.state,prices:{grandTotal:(r=c.prices)!=null&&r.grand_total?{value:c.prices.grand_total.value,currency:c.prices.grand_total.currency}:{value:0,currency:"USD"},minNegotiatedGrandTotal:{value:c.min_negotiated_grand_total,currency:((d=(o=c.prices)==null?void 0:o.grand_total)==null?void 0:d.currency)||"USD"}},lastSharedAt:c.last_shared_at,lastOrderedAt:c.last_ordered_at,expirationDate:c.expiration_date,ordersPlaced:c.orders_placed,canGenerateQuoteFromTemplate:[i.ACTIVE].includes(c.status)}}))||[],pageInfo:{currentPage:n.page_info.current_page,pageSize:n.page_info.page_size,totalPages:n.page_info.total_pages},totalCount:n.total_count,sortFields:n.sort_fields?{default:n.sort_fields.default,options:n.sort_fields.options}:void 0},e=f(u);return{...u,paginationInfo:e||void 0}}export{i as N,l as a,I as t};
|
|
4
4
|
//# sourceMappingURL=transform-quote-template.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"transform-quote-template.js","sources":["/@dropins/storefront-quote-management/src/data/models/negotiable-quote-template-model.ts","/@dropins/storefront-quote-management/src/data/transforms/transform-quote-template.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 {\n Currency,\n ItemNote,\n PaginationInfo,\n ShippingAddress,\n ConfigurableOption,\n BundleOption,\n} from './negotiable-quote-model';\n\nexport interface NegotiableQuoteTemplateModel {\n id: string;\n uid: string;\n name: string;\n createdAt: string;\n updatedAt: string;\n expirationDate?: string;\n status: NegotiableQuoteTemplateStatus;\n salesRepName: string;\n buyer: {\n firstname: string;\n lastname: string;\n };\n comments?: QuoteTemplateComment[];\n history?: QuoteTemplateHistoryEntry[];\n prices: {\n subtotalExcludingTax?: Currency;\n subtotalIncludingTax?: Currency;\n subtotalWithDiscountExcludingTax?: Currency;\n grandTotal?: Currency;\n appliedTaxes?: {\n amount: Currency;\n label: string;\n }[];\n };\n items: QuoteTemplateCartItem[];\n shippingAddresses?: ShippingAddress[];\n referenceDocuments?: {\n uid: string;\n name: string;\n url: string;\n }[];\n // Template-specific fields\n quantityThresholds?: {\n min?: number;\n max?: number;\n };\n canAccept: boolean;\n canDelete: boolean;\n canReopen: boolean;\n canCancel: boolean;\n canSendForReview: boolean;\n canGenerateQuoteFromTemplate: boolean;\n canEditTemplateItems: boolean;\n}\n\nexport enum NegotiableQuoteTemplateStatus {\n ACTIVE = 'Active',\n IN_REVIEW = 'In Review',\n INACTIVE = 'Inactive',\n SUBMITTED = 'Submitted',\n PENDING = 'Pending',\n CLOSED = 'Closed',\n OPEN = 'Open',\n UPDATED = 'Updated',\n EDITED = 'Edited',\n NEW = 'New',\n DRAFT = 'Draft',\n DECLINED = 'Declined',\n CANCELED = 'Canceled',\n EXPIRED = 'Expired',\n}\n\nexport interface QuoteTemplateCartItem {\n uid?: string;\n product: {\n uid: string;\n sku: string;\n name: string;\n };\n quantity: number;\n prices: {\n originalItemPrice: Currency;\n rowTotal: Currency;\n };\n catalogDiscount?: {\n amountOff: number;\n percentOff: number;\n };\n discounts?: {\n label: string;\n value: string;\n amount: Currency;\n }[];\n noteFromBuyer?: ItemNote[];\n noteFromSeller?: ItemNote[];\n configurableOptions?: ConfigurableOption[];\n bundleOptions?: BundleOption[];\n}\n\nexport interface QuoteTemplateComment {\n uid: string;\n createdAt: string;\n author: {\n firstname: string;\n lastname: string;\n };\n text: string;\n attachments?: {\n name: string;\n url: string;\n }[];\n}\n\nexport interface QuoteTemplateHistoryEntry {\n uid: string;\n createdAt: string;\n author: {\n firstname: string;\n lastname: string;\n };\n changeType: string;\n changes: any; // Similar structure to NegotiableQuoteHistoryEntry\n}\n\n// List model for getQuoteTemplates\nexport interface NegotiableQuoteTemplatesListModel {\n items: NegotiableQuoteTemplateListEntry[];\n pageInfo: {\n currentPage: number;\n pageSize: number;\n totalPages: number;\n };\n totalCount: number;\n paginationInfo?: PaginationInfo;\n sortFields?: {\n default: string;\n options: Array<{\n label: string;\n value: string;\n }>;\n };\n}\n\nexport interface NegotiableQuoteTemplateListEntry {\n id: string;\n uid: string;\n name: string;\n createdAt: string;\n updatedAt: string;\n status: NegotiableQuoteTemplateStatus;\n state: 'active' | 'inactive' | 'in_review';\n lastSharedAt: string;\n lastOrderedAt: string;\n expirationDate: string;\n ordersPlaced: number;\n prices: {\n grandTotal: Currency;\n minNegotiatedGrandTotal: Currency;\n };\n canGenerateQuoteFromTemplate?: boolean;\n}\n","/********************************************************************\n * Copyright 2025 Adobe\n * All Rights Reserved.\n *\n * NOTICE: Adobe permits you to use, modify, and distribute this\n * file in accordance with the terms of the Adobe license agreement\n * accompanying it.\n *******************************************************************/\n\nimport {\n NegotiableQuoteTemplateModel,\n NegotiableQuoteTemplatesListModel,\n NegotiableQuoteTemplateStatus,\n} from '../models/negotiable-quote-template-model';\nimport { transformPaginationInfo } from './transform-quote';\n\nexport function transformQuoteTemplate(\n templateData: any\n): NegotiableQuoteTemplateModel | null {\n if (!templateData) {\n return null;\n }\n\n return {\n id: templateData.template_id,\n uid: templateData.uid,\n name: templateData.name,\n createdAt: templateData.created_at,\n updatedAt: templateData.updated_at,\n expirationDate: templateData.expiration_date,\n status: templateData.status,\n salesRepName: templateData.sales_rep_name,\n buyer: {\n firstname: templateData.buyer.firstname,\n lastname: templateData.buyer.lastname,\n },\n comments: templateData.comments?.map((comment: any) => ({\n uid: comment.uid,\n createdAt: comment.created_at,\n author: {\n firstname: comment.author.firstname,\n lastname: comment.author.lastname,\n },\n text: comment.text,\n attachments: comment.attachments?.map((a: any) => ({\n name: a.name,\n url: a.url,\n })),\n })),\n prices: templateData.prices && {\n subtotalExcludingTax: templateData.prices.subtotal_excluding_tax && {\n value: templateData.prices.subtotal_excluding_tax.value,\n currency: templateData.prices.subtotal_excluding_tax.currency,\n },\n subtotalIncludingTax: templateData.prices.subtotal_including_tax && {\n value: templateData.prices.subtotal_including_tax.value,\n currency: templateData.prices.subtotal_including_tax.currency,\n },\n subtotalWithDiscountExcludingTax: templateData.prices\n .subtotal_with_discount_excluding_tax && {\n value: templateData.prices.subtotal_with_discount_excluding_tax.value,\n currency:\n templateData.prices.subtotal_with_discount_excluding_tax.currency,\n },\n appliedTaxes: templateData.prices.applied_taxes?.map((tax: any) => ({\n amount: { value: tax.amount.value, currency: tax.amount.currency },\n label: tax.label,\n })),\n grandTotal: templateData.prices.grand_total && {\n value: templateData.prices.grand_total.value,\n currency: templateData.prices.grand_total.currency,\n },\n },\n history: templateData.history?.map((h: any) => ({\n uid: h.uid,\n createdAt: h.created_at,\n author: {\n firstname: h.author.firstname,\n lastname: h.author.lastname,\n },\n changeType: h.change_type,\n changes: h.changes,\n })),\n items:\n templateData.items?.map((item: any) => ({\n uid: item.uid,\n product: {\n uid: item.product.uid,\n sku: item.product.sku,\n name: item.product.name,\n },\n quantity: item.quantity,\n prices: {\n originalItemPrice: {\n value: item.prices.original_item_price.value,\n currency: item.prices.original_item_price.currency,\n },\n rowTotal: {\n value: item.prices.row_total.value,\n currency: item.prices.row_total.currency,\n },\n },\n catalogDiscount: item.prices.catalog_discount && {\n amountOff: item.prices.catalog_discount.amount_off,\n percentOff: item.prices.catalog_discount.percent_off,\n },\n discounts: item.prices?.discounts?.map((discount: any) => ({\n label: discount.label,\n value: discount.value,\n amount: {\n value: discount.amount.value,\n currency: discount.amount.currency,\n },\n })),\n noteFromBuyer: item.note_from_buyer?.map((note: any) => ({\n createdAt: note.created_at,\n creatorId: note.creator_id,\n creatorType: note.creator_type,\n negotiableQuoteItemUid: note.negotiable_quote_template_item_uid,\n note: note.note,\n noteUid: note.note_uid,\n })),\n noteFromSeller: item.note_from_seller?.map((note: any) => ({\n createdAt: note.created_at,\n creatorId: note.creator_id,\n creatorType: note.creator_type,\n negotiableQuoteItemUid: note.negotiable_quote_template_item_uid,\n note: note.note,\n noteUid: note.note_uid,\n })),\n configurableOptions: item.configurable_options?.map((option: any) => ({\n optionLabel: option.option_label,\n valueLabel: option.value_label,\n })),\n bundleOptions: item.bundle_options?.map((option: any) => ({\n label: option.label,\n values: option.values.map((value: any) => ({\n label: value.label,\n quantity: value.quantity,\n originalPrice: {\n value: value.original_price.value,\n currency: value.original_price.currency,\n },\n price: {\n value: value.priceV2.value,\n currency: value.priceV2.currency,\n },\n })),\n })),\n })) || [],\n shippingAddresses: templateData.shipping_addresses?.map((address: any) => ({\n uid: address.uid,\n firstname: address.firstname,\n lastname: address.lastname,\n company: address.company,\n street: address.street,\n city: address.city,\n postcode: address.postcode,\n country: {\n code: address.country.code,\n label: address.country.label,\n },\n telephone: address.telephone,\n region: address.region\n ? {\n code: address.region.code,\n label: address.region.label,\n regionId: address.region.region_id,\n }\n : undefined,\n })),\n // Calculate permissions based on status\n canAccept: [\n NegotiableQuoteTemplateStatus.SUBMITTED,\n NegotiableQuoteTemplateStatus.PENDING,\n NegotiableQuoteTemplateStatus.EDITED,\n NegotiableQuoteTemplateStatus.OPEN,\n ].includes(templateData.status),\n canDelete: [\n NegotiableQuoteTemplateStatus.DECLINED,\n NegotiableQuoteTemplateStatus.CANCELED,\n NegotiableQuoteTemplateStatus.EXPIRED,\n ].includes(templateData.status),\n canReopen: [\n NegotiableQuoteTemplateStatus.DECLINED,\n NegotiableQuoteTemplateStatus.CANCELED,\n NegotiableQuoteTemplateStatus.EXPIRED,\n ].includes(templateData.status),\n canCancel: [\n NegotiableQuoteTemplateStatus.ACTIVE,\n NegotiableQuoteTemplateStatus.SUBMITTED,\n NegotiableQuoteTemplateStatus.PENDING,\n NegotiableQuoteTemplateStatus.EDITED,\n NegotiableQuoteTemplateStatus.OPEN,\n NegotiableQuoteTemplateStatus.UPDATED,\n ].includes(templateData.status),\n canSendForReview: [\n NegotiableQuoteTemplateStatus.DRAFT,\n NegotiableQuoteTemplateStatus.NEW,\n ].includes(templateData.status),\n canGenerateQuoteFromTemplate: [\n NegotiableQuoteTemplateStatus.ACTIVE,\n ].includes(templateData.status),\n canEditTemplateItems: [\n NegotiableQuoteTemplateStatus.SUBMITTED,\n NegotiableQuoteTemplateStatus.DRAFT,\n NegotiableQuoteTemplateStatus.OPEN,\n ].includes(templateData.status),\n };\n}\n\nexport function transformQuoteTemplatesList(\n templatesData: any\n): NegotiableQuoteTemplatesListModel | null {\n if (!templatesData) {\n return null;\n }\n\n const transformedModel = {\n items:\n templatesData.items?.map((template: any) => ({\n id: template.template_id,\n uid: 'TBD',\n name: template.name,\n createdAt: '0000-00-00 00:00:00', // TODO: missing from GraphQL API\n updatedAt: '0000-00-00 00:00:00', // TODO: missing from GraphQL API\n status: template.status,\n state: template.state,\n prices: {\n grandTotal: {\n value: 0, // TODO: missing from GraphQL API\n currency: 'USD', // TODO: missing from GraphQL API\n },\n minNegotiatedGrandTotal: {\n value: template.min_negotiated_grand_total,\n currency: 'USD', // TODO: use the same from grand total when available\n },\n },\n lastSharedAt: template.last_shared_at,\n lastOrderedAt: '0000-00-00 00:00:00', // TODO: missing from GraphQL API\n expirationDate: '0000-00-00 00:00:00', // TODO: broken in GraphQL API\n ordersPlaced: template.orders_placed,\n canGenerateQuoteFromTemplate: [\n NegotiableQuoteTemplateStatus.ACTIVE,\n ].includes(template.status),\n })) || [],\n pageInfo: {\n currentPage: templatesData.page_info.current_page,\n pageSize: templatesData.page_info.page_size,\n totalPages: templatesData.page_info.total_pages,\n },\n totalCount: templatesData.total_count,\n sortFields: templatesData.sort_fields\n ? {\n default: templatesData.sort_fields.default,\n options: templatesData.sort_fields.options,\n }\n : undefined,\n };\n\n // Calculate pagination info\n const paginationInfo = transformPaginationInfo(transformedModel);\n\n return {\n ...transformedModel,\n paginationInfo: paginationInfo || undefined,\n };\n}\n"],"names":["NegotiableQuoteTemplateStatus","transformQuoteTemplate","templateData","_a","comment","a","_b","tax","_c","h","_d","item","discount","note","_e","option","_f","value","address","transformQuoteTemplatesList","templatesData","transformedModel","template","paginationInfo","transformPaginationInfo"],"mappings":"yCAgEO,IAAKA,GAAAA,IACVA,EAAA,OAAS,SACTA,EAAA,UAAY,YACZA,EAAA,SAAW,WACXA,EAAA,UAAY,YACZA,EAAA,QAAU,UACVA,EAAA,OAAS,SACTA,EAAA,KAAO,OACPA,EAAA,QAAU,UACVA,EAAA,OAAS,SACTA,EAAA,IAAM,MACNA,EAAA,MAAQ,QACRA,EAAA,SAAW,WACXA,EAAA,SAAW,WACXA,EAAA,QAAU,UAdAA,IAAAA,GAAA,CAAA,CAAA,EChDL,SAASC,EACdC,EACqC,eACrC,OAAKA,EAIE,CACL,GAAIA,EAAa,YACjB,IAAKA,EAAa,IAClB,KAAMA,EAAa,KACnB,UAAWA,EAAa,WACxB,UAAWA,EAAa,WACxB,eAAgBA,EAAa,gBAC7B,OAAQA,EAAa,OACrB,aAAcA,EAAa,eAC3B,MAAO,CACL,UAAWA,EAAa,MAAM,UAC9B,SAAUA,EAAa,MAAM,QAAA,EAE/B,UAAUC,EAAAD,EAAa,WAAb,YAAAC,EAAuB,IAAKC,GAAA,OAAkB,OACtD,IAAKA,EAAQ,IACb,UAAWA,EAAQ,WACnB,OAAQ,CACN,UAAWA,EAAQ,OAAO,UAC1B,SAAUA,EAAQ,OAAO,QAAA,EAE3B,KAAMA,EAAQ,KACd,aAAaD,EAAAC,EAAQ,cAAR,YAAAD,EAAqB,IAAKE,IAAY,CACjD,KAAMA,EAAE,KACR,IAAKA,EAAE,GAAA,GACP,IAEJ,OAAQH,EAAa,QAAU,CAC7B,qBAAsBA,EAAa,OAAO,wBAA0B,CAClE,MAAOA,EAAa,OAAO,uBAAuB,MAClD,SAAUA,EAAa,OAAO,uBAA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AAcA,EAAS,eACvB,cAAe,sBACf,eAAgB,sBAChB,aAAcA,EAAS,cACvB,6BAA8B,CAC5BtB,EAA8B,MAAA,EAC9B,SAASsB,EAAS,MAAM,CAAA,MACrB,CAAA,EACT,SAAU,CACR,YAAaF,EAAc,UAAU,aACrC,SAAUA,EAAc,UAAU,UAClC,WAAYA,EAAc,UAAU,WAAA,EAEtC,WAAYA,EAAc,YAC1B,WAAYA,EAAc,YACtB,CACE,QAASA,EAAc,YAAY,QACnC,QAASA,EAAc,YAAY,OAAA,EAErC,MAAA,EAIAG,EAAiBC,EAAwBH,CAAgB,EAE/D,MAAO,CACL,GAAGA,EACH,eAAgBE,GAAkB,MAAA,CAEtC"}
|
|
1
|
+
{"version":3,"file":"transform-quote-template.js","sources":["/@dropins/storefront-quote-management/src/data/models/negotiable-quote-template-model.ts","/@dropins/storefront-quote-management/src/data/transforms/transform-quote-template.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 {\n Currency,\n PaginationInfo,\n ShippingAddress,\n NegotiableQuoteHistoryEntry,\n CartItemModel,\n} from './negotiable-quote-model';\n\nexport interface NegotiableQuoteTemplateModel {\n id: string;\n uid: string;\n name: string;\n createdAt: string;\n updatedAt: string;\n expirationDate?: string;\n status: NegotiableQuoteTemplateStatus;\n salesRepName: string;\n buyer: {\n firstname: string;\n lastname: string;\n };\n comments?: QuoteTemplateComment[];\n history?: NegotiableQuoteHistoryEntry[];\n prices: {\n subtotalExcludingTax?: Currency;\n subtotalIncludingTax?: Currency;\n subtotalWithDiscountExcludingTax?: Currency;\n grandTotal?: Currency;\n appliedTaxes?: {\n amount: Currency;\n label: string;\n }[];\n };\n items: CartItemModel[];\n shippingAddresses?: ShippingAddress[];\n referenceDocuments?: {\n uid: string;\n name: string;\n identifier?: string;\n url: string;\n }[];\n // Template-specific fields\n quantityThresholds?: {\n min?: number;\n max?: number;\n };\n canAccept: boolean;\n canDelete: boolean;\n canReopen: boolean;\n canCancel: boolean;\n canSendForReview: boolean;\n canGenerateQuoteFromTemplate: boolean;\n canEditTemplateItems: boolean;\n}\n\nexport enum NegotiableQuoteTemplateStatus {\n ACTIVE = 'Active',\n IN_REVIEW = 'In Review',\n INACTIVE = 'Inactive',\n SUBMITTED = 'Submitted',\n PENDING = 'Pending',\n CLOSED = 'Closed',\n OPEN = 'Open',\n UPDATED = 'Updated',\n EDITED = 'Edited',\n NEW = 'New',\n DRAFT = 'Draft',\n DECLINED = 'Declined',\n CANCELED = 'Canceled',\n EXPIRED = 'Expired',\n}\n\n\nexport interface QuoteTemplateComment {\n uid: string;\n createdAt: string;\n author: {\n firstname: string;\n lastname: string;\n };\n text: string;\n attachments?: {\n name: string;\n url: string;\n }[];\n}\n\n// List model for getQuoteTemplates\nexport interface NegotiableQuoteTemplatesListModel {\n items: NegotiableQuoteTemplateListEntry[];\n pageInfo: {\n currentPage: number;\n pageSize: number;\n totalPages: number;\n };\n totalCount: number;\n paginationInfo?: PaginationInfo;\n sortFields?: {\n default: string;\n options: Array<{\n label: string;\n value: string;\n }>;\n };\n}\n\nexport interface NegotiableQuoteTemplateListEntry {\n id: string;\n uid: string;\n name: string;\n createdAt: string;\n updatedAt: string;\n status: NegotiableQuoteTemplateStatus;\n state: 'active' | 'inactive' | 'in_review';\n lastSharedAt: string;\n lastOrderedAt: string;\n expirationDate: string;\n ordersPlaced: number;\n prices: {\n grandTotal: Currency;\n minNegotiatedGrandTotal: Currency;\n };\n canGenerateQuoteFromTemplate?: boolean;\n}\n","/********************************************************************\n * Copyright 2025 Adobe\n * All Rights Reserved.\n *\n * NOTICE: Adobe permits you to use, modify, and distribute this\n * file in accordance with the terms of the Adobe license agreement\n * accompanying it.\n *******************************************************************/\n\nimport {\n NegotiableQuoteTemplateModel,\n NegotiableQuoteTemplatesListModel,\n NegotiableQuoteTemplateStatus,\n} from '../models/negotiable-quote-template-model';\nimport { transformPaginationInfo } from './transform-quote';\nimport { transformHistory } from './transform-history';\nimport { transformQuoteItems } from './transform-quote-items';\n\nexport function transformQuoteTemplate(\n templateData: any\n): NegotiableQuoteTemplateModel | null {\n if (!templateData) {\n return null;\n }\n\n return {\n id: templateData.template_id,\n uid: templateData.uid,\n name: templateData.name,\n createdAt: templateData.created_at,\n updatedAt: templateData.updated_at,\n expirationDate: templateData.expiration_date,\n status: templateData.status,\n salesRepName: templateData.sales_rep_name,\n buyer: {\n firstname: templateData.buyer.firstname,\n lastname: templateData.buyer.lastname,\n },\n comments: templateData.comments?.map((comment: any) => ({\n uid: comment.uid,\n createdAt: comment.created_at,\n author: {\n firstname: comment.author.firstname,\n lastname: comment.author.lastname,\n },\n text: comment.text,\n attachments: comment.attachments?.map((a: any) => ({\n name: a.name,\n url: a.url,\n })),\n })),\n prices: templateData.prices && {\n subtotalExcludingTax: templateData.prices.subtotal_excluding_tax && {\n value: templateData.prices.subtotal_excluding_tax.value,\n currency: templateData.prices.subtotal_excluding_tax.currency,\n },\n subtotalIncludingTax: templateData.prices.subtotal_including_tax && {\n value: templateData.prices.subtotal_including_tax.value,\n currency: templateData.prices.subtotal_including_tax.currency,\n },\n subtotalWithDiscountExcludingTax: templateData.prices\n .subtotal_with_discount_excluding_tax && {\n value: templateData.prices.subtotal_with_discount_excluding_tax.value,\n currency:\n templateData.prices.subtotal_with_discount_excluding_tax.currency,\n },\n appliedTaxes: templateData.prices.applied_taxes?.map((tax: any) => ({\n amount: { value: tax.amount.value, currency: tax.amount.currency },\n label: tax.label,\n })),\n grandTotal: templateData.prices.grand_total && {\n value: templateData.prices.grand_total.value,\n currency: templateData.prices.grand_total.currency,\n },\n },\n history: transformHistory(templateData.history),\n items: transformQuoteItems(templateData.items),\n shippingAddresses: templateData.shipping_addresses?.map((address: any) => ({\n uid: address.uid,\n firstname: address.firstname,\n lastname: address.lastname,\n company: address.company,\n street: address.street,\n city: address.city,\n postcode: address.postcode,\n country: {\n code: address.country.code,\n label: address.country.label,\n },\n telephone: address.telephone,\n region: address.region\n ? {\n code: address.region.code,\n label: address.region.label,\n regionId: address.region.region_id,\n }\n : undefined,\n })),\n referenceDocuments: templateData.reference_document_links?.map((doc: any) => ({\n uid: doc.link_id,\n name: doc.document_name,\n identifier: doc.document_identifier,\n url: doc.reference_document_url,\n })),\n // Calculate permissions based on status\n canAccept: [\n NegotiableQuoteTemplateStatus.SUBMITTED,\n NegotiableQuoteTemplateStatus.PENDING,\n NegotiableQuoteTemplateStatus.OPEN,\n ].includes(templateData.status),\n canDelete: templateData.status === NegotiableQuoteTemplateStatus.DRAFT,\n canReopen: [\n NegotiableQuoteTemplateStatus.DECLINED,\n NegotiableQuoteTemplateStatus.CANCELED,\n NegotiableQuoteTemplateStatus.EXPIRED,\n ].includes(templateData.status),\n canCancel: [\n NegotiableQuoteTemplateStatus.SUBMITTED,\n NegotiableQuoteTemplateStatus.PENDING,\n NegotiableQuoteTemplateStatus.OPEN,\n NegotiableQuoteTemplateStatus.ACTIVE,\n NegotiableQuoteTemplateStatus.EDITED,\n ].includes(templateData.status),\n canSendForReview: [\n NegotiableQuoteTemplateStatus.OPEN,\n NegotiableQuoteTemplateStatus.DRAFT,\n NegotiableQuoteTemplateStatus.NEW,\n NegotiableQuoteTemplateStatus.EDITED,\n ].includes(templateData.status),\n canGenerateQuoteFromTemplate: [\n NegotiableQuoteTemplateStatus.ACTIVE,\n ].includes(templateData.status),\n canEditTemplateItems: [\n NegotiableQuoteTemplateStatus.SUBMITTED,\n NegotiableQuoteTemplateStatus.DRAFT,\n NegotiableQuoteTemplateStatus.OPEN,\n NegotiableQuoteTemplateStatus.EDITED,\n ].includes(templateData.status),\n };\n}\n\nexport function transformQuoteTemplatesList(\n templatesData: any\n): NegotiableQuoteTemplatesListModel | null {\n if (!templatesData) {\n return null;\n }\n\n const transformedModel = {\n items:\n templatesData.items?.map((template: any) => ({\n id: template.template_id,\n uid: template.uid,\n name: template.name,\n createdAt: template.created_at,\n updatedAt: template.updated_at,\n status: template.status,\n state: template.state,\n prices: {\n grandTotal: template.prices?.grand_total\n ? {\n value: template.prices.grand_total.value,\n currency: template.prices.grand_total.currency,\n }\n : {\n value: 0,\n currency: 'USD',\n },\n minNegotiatedGrandTotal: {\n value: template.min_negotiated_grand_total,\n currency: template.prices?.grand_total?.currency || 'USD',\n },\n },\n lastSharedAt: template.last_shared_at,\n lastOrderedAt: template.last_ordered_at,\n expirationDate: template.expiration_date,\n ordersPlaced: template.orders_placed,\n canGenerateQuoteFromTemplate: [\n NegotiableQuoteTemplateStatus.ACTIVE,\n ].includes(template.status),\n })) || [],\n pageInfo: {\n currentPage: templatesData.page_info.current_page,\n pageSize: templatesData.page_info.page_size,\n totalPages: templatesData.page_info.total_pages,\n },\n totalCount: templatesData.total_count,\n sortFields: templatesData.sort_fields\n ? {\n default: templatesData.sort_fields.default,\n options: templatesData.sort_fields.options,\n }\n : undefined,\n };\n\n // Calculate pagination info\n const paginationInfo = transformPaginationInfo(transformedModel);\n\n return {\n ...transformedModel,\n paginationInfo: paginationInfo || undefined,\n };\n}\n"],"names":["NegotiableQuoteTemplateStatus","transformQuoteTemplate","templateData","_a","comment","a","_b","tax","transformHistory","transformQuoteItems","_c","address","_d","doc","transformQuoteTemplatesList","templatesData","transformedModel","template","paginationInfo","transformPaginationInfo"],"mappings":"uDAgEO,IAAKA,GAAAA,IACVA,EAAA,OAAS,SACTA,EAAA,UAAY,YACZA,EAAA,SAAW,WACXA,EAAA,UAAY,YACZA,EAAA,QAAU,UACVA,EAAA,OAAS,SACTA,EAAA,KAAO,OACPA,EAAA,QAAU,UACVA,EAAA,OAAS,SACTA,EAAA,IAAM,MACNA,EAAA,MAAQ,QACRA,EAAA,SAAW,WACXA,EAAA,SAAW,WACXA,EAAA,QAAU,UAdAA,IAAAA,GAAA,CAAA,CAAA,EC9CL,SAASC,EACdC,EACqC,aACrC,OAAKA,EAIE,CACL,GAAIA,EAAa,YACjB,IAAKA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O,KAGT,MAAMC,EAAmB,CACvB,QACEb,EAAAY,EAAc,QAAd,YAAAZ,EAAqB,IAAKc,GAAA,WAAmB,OAC3C,GAAIA,EAAS,YACb,IAAKA,EAAS,IACd,KAAMA,EAAS,KACf,UAAWA,EAAS,WACpB,UAAWA,EAAS,WACpB,OAAQA,EAAS,OACjB,MAAOA,EAAS,MAChB,OAAQ,CACN,YAAYd,EAAAc,EAAS,SAAT,MAAAd,EAAiB,YACzB,CACE,MAAOc,EAAS,OAAO,YAAY,MACnC,SAAUA,EAAS,OAAO,YAAY,QAAA,EAExC,CACE,MAAO,EACP,SAAU,KAAA,EAEhB,wBAAyB,CACvB,MAAOA,EAAS,2BAChB,WAAUP,GAAAJ,EAAAW,EAAS,SAAT,YAAAX,EAAiB,cAAjB,YAAAI,EAA8B,WAAY,KAAA,CACtD,EAEF,aAAcO,EAAS,eACvB,cAAeA,EAAS,gBACxB,eAAgBA,EAAS,gBACzB,aAAcA,EAAS,cACvB,6BAA8B,CAC5BjB,EAA8B,MAAA,EAC9B,SAASiB,EAAS,MAAM,CAAA,MACrB,CAAA,EACT,SAAU,CACR,YAAaF,EAAc,UAAU,aACrC,SAAUA,EAAc,UAAU,UAClC,WAAYA,EAAc,UAAU,WAAA,EAEtC,WAAYA,EAAc,YAC1B,WAAYA,EAAc,YACtB,CACE,QAASA,EAAc,YAAY,QACnC,QAASA,EAAc,YAAY,OAAA,EAErC,MAAA,EAIAG,EAAiBC,EAAwBH,CAAgB,EAE/D,MAAO,CACL,GAAGA,EACH,eAAgBE,GAAkB,MAAA,CAEtC"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
/*! Copyright 2025 Adobe
|
|
2
2
|
All Rights Reserved. */
|
|
3
|
-
import{FetchGraphQL as I}from"@dropins/tools/fetch-graphql.js";import{s as g}from"./state.js";var x=(e=>(e.NEW="NEW",e.SUBMITTED="SUBMITTED",e.PENDING="PENDING",e.UPDATED="UPDATED",e.OPEN="OPEN",e.ORDERED="ORDERED",e.CLOSED="CLOSED",e.DECLINED="DECLINED",e.EXPIRED="EXPIRED",e.DRAFT="DRAFT",e))(x||{});const{setEndpoint:M,setFetchGraphQlHeader:B,removeFetchGraphQlHeader:G,setFetchGraphQlHeaders:z,fetchGraphQl:W,getConfig:H}=new I().getMethods(),b=["DRAFT","UPDATED","DECLINED","EXPIRED","NEW","OPEN"];function P(e){if(!e.items)return 0;const r=g.config;return(r==null?void 0:r.quoteSummaryDisplayTotal)===0?e.items.length:(r==null?void 0:r.quoteSummaryDisplayTotal)===1?e.total_quantity:e.items.length}function w(e){var n,c,i,l;const r=g.config;return{src:r!=null&&r.useConfigurableParentThumbnail?e.product.thumbnail.url:((c=(n=e.configured_variant)==null?void 0:n.thumbnail)==null?void 0:c.url)||e.product.thumbnail.url,alt:r!=null&&r.useConfigurableParentThumbnail?e.product.thumbnail.label:((l=(i=e.configured_variant)==null?void 0:i.thumbnail)==null?void 0:l.label)||e.product.thumbnail.label}}function C(e){var r;return((r=e.links)==null?void 0:r.length)>0?{count:e.links.length,result:e.links.map(n=>n.title).join(", ")}:null}function T(e,r){return e!=null&&e.length&&[...e].sort((c,i)=>i.quantity-c.quantity).find(c=>r>=c.quantity)||null}function A(e){var s,o;const r=e.quantity,n=e.__typename==="ConfigurableCartItem",c=n?(s=e.configured_variant)==null?void 0:s.price_tiers:e.product.price_tiers,i=n?(o=e.configured_variant)==null?void 0:o.price_range:e.product.price_range,l=T(c,r);return l?l.discount.amount_off>0:(i==null?void 0:i.maximum_price.discount.amount_off)>0}function O(e){var i,l,s,o,d,a,u,p;const r=e.quantity,n=T(e.product.price_tiers,r);if(n)return Math.round(n.discount.percent_off);let c;if(e.__typename==="ConfigurableCartItem")c=(o=(s=(l=(i=e==null?void 0:e.configured_variant)==null?void 0:i.price_range)==null?void 0:l.maximum_price)==null?void 0:s.discount)==null?void 0:o.percent_off;else{if(e.__typename==="BundleCartItem")return;c=(p=(u=(a=(d=e==null?void 0:e.product)==null?void 0:d.price_range)==null?void 0:a.maximum_price)==null?void 0:u.discount)==null?void 0:p.percent_off}if(c!==0)return Math.round(c)}function R(e){var r,n,c,i;return e.__typename==="ConfigurableCartItem"?{value:(n=(r=e.configured_variant)==null?void 0:r.price_range)==null?void 0:n.maximum_price.regular_price.value,currency:(i=(c=e.configured_variant)==null?void 0:c.price_range)==null?void 0:i.maximum_price.regular_price.currency}:{value:e.prices.original_item_price.value,currency:e.prices.original_item_price.currency}}function N(e){var c,i,l,s,o,d;let r,n;if(r=((i=(c=e==null?void 0:e.prices)==null?void 0:c.original_row_total)==null?void 0:i.value)-((s=(l=e==null?void 0:e.prices)==null?void 0:l.row_total)==null?void 0:s.value),n=(d=(o=e==null?void 0:e.prices)==null?void 0:o.row_total)==null?void 0:d.currency,r!==0)return{value:r,currency:n}}function S(e){var n,c,i,l,s,o,d;const r=D(e);return{uid:e.uid,name:e.name,createdAt:e.created_at,updatedAt:e.updated_at,expirationDate:e.expiration_date,status:r?x.NEW:e.status,isVirtual:!!e.is_virtual,salesRepName:e.sales_rep_name,buyer:{firstname:e.buyer.firstname,lastname:e.buyer.lastname},templateName:e.template_name,totalQuantity:P(e),comments:(n=e.comments)==null?void 0:n.map(a=>{const u={uid:a.uid,createdAt:a.created_at,author:{firstname:a.author.firstname,lastname:a.author.lastname},text:a.text};return Array.isArray(a.attachments)&&a.attachments.length>0&&(u.attachments=a.attachments.map(p=>({name:p.name,url:p.url}))),u}),prices:e.prices&&{appliedDiscounts:(c=e.prices.discounts)==null?void 0:c.map(a=>({amount:{value:a.amount.value,currency:a.amount.currency},label:a.label,coupon:a.coupon})),appliedTaxes:(i=e.prices.applied_taxes)==null?void 0:i.map(a=>({amount:{value:a.amount.value,currency:a.amount.currency},label:a.label})),discount:e.prices.discounts&&e.prices.grand_total&&E(e.prices.discounts,e.prices.grand_total.currency),grandTotal:e.prices.grand_total&&{value:e.prices.grand_total.value,currency:e.prices.grand_total.currency},grandTotalExcludingTax:e.prices.grand_total_excluding_tax&&{value:e.prices.grand_total_excluding_tax.value,currency:e.prices.grand_total_excluding_tax.currency},subtotalExcludingTax:e.prices.subtotal_excluding_tax&&{value:e.prices.subtotal_excluding_tax.value,currency:e.prices.subtotal_excluding_tax.currency},subtotalIncludingTax:e.prices.subtotal_including_tax&&{value:e.prices.subtotal_including_tax.value,currency:e.prices.subtotal_including_tax.currency},subtotalWithDiscountExcludingTax:e.prices.subtotal_with_discount_excluding_tax&&{value:e.prices.subtotal_with_discount_excluding_tax.value,currency:e.prices.subtotal_with_discount_excluding_tax.currency},...F(e),totalTax:e.prices.applied_taxes&&e.prices.grand_total&&E(e.prices.applied_taxes,e.prices.grand_total.currency)},history:(l=e.history)==null?void 0:l.map(a=>{var u,p,f,m,v,y,h;return{uid:a.uid,createdAt:a.created_at,author:{firstname:a.author.firstname,lastname:a.author.lastname},changeType:a.change_type,changes:{commentAdded:((u=a.changes)==null?void 0:u.comment_added)&&{comment:a.changes.comment_added.comment},customChanges:((p=a.changes)==null?void 0:p.custom_changes)&&{new_value:a.changes.custom_changes.new_value,old_value:a.changes.custom_changes.old_value,title:a.changes.custom_changes.title},expiration:((f=a.changes)==null?void 0:f.expiration)&&{newExpiration:a.changes.expiration.new_expiration,oldExpiration:a.changes.expiration.old_expiration},productsRemoved:((m=a.changes)==null?void 0:m.products_removed)&&{productsRemovedFromCatalog:a.changes.products_removed.products_removed_from_catalog||[],productsRemovedFromQuote:a.changes.products_removed.products_removed_from_quote||[]},statuses:((v=a.changes)==null?void 0:v.statuses)&&{changes:((y=a.changes.statuses.changes)==null?void 0:y.map(t=>({newStatus:t.new_status,oldStatus:t.old_status})))||[]},total:((h=a.changes)==null?void 0:h.total)&&a.changes.total.new_price&&a.changes.total.old_price&&{newPrice:{value:a.changes.total.new_price.value,currency:a.changes.total.new_price.currency},oldPrice:{value:a.changes.total.old_price.value,currency:a.changes.total.old_price.currency}}}}}),items:((s=e.items)==null?void 0:s.map(a=>{var u,p,f,m,v,y,h;return{itemType:a.__typename,uid:a.uid,product:{uid:a.product.uid,sku:a.product.sku,name:a.product.name,priceRange:{maximumPrice:{regularPrice:{value:a.product.price_range.maximum_price.regular_price.value,currency:a.product.price_range.maximum_price.regular_price.currency}}}},image:w(a),links:C(a),discounted:A(a),discountedTotal:{value:a.prices.row_total.value,currency:a.prices.row_total.currency},catalogDiscount:{amountOff:a.prices.catalog_discount.amount_off,percentOff:a.prices.catalog_discount.percent_off},discounts:((p=(u=a.prices)==null?void 0:u.discounts)==null?void 0:p.map(t=>({label:t.label,value:t.value,amount:{value:t.amount.value,currency:t.amount.currency}})))??[],discountPercentage:O(a),insufficientQuantity:(a.__typename==="ConfigurableCartItem"?a.configured_variant:a.product).stock_status==="IN_STOCK"&&!a.is_available,outOfStock:a.product.stock_status==="OUT_OF_STOCK",stockStatus:a.product.stock_status,quantity:a.quantity,prices:{regularPrice:R(a),priceIncludingTax:{value:a.prices.price_including_tax.value,currency:a.prices.price_including_tax.currency},originalItemPrice:{value:a.prices.original_item_price.value,currency:a.prices.original_item_price.currency},originalRowTotal:{value:a.prices.original_row_total.value,currency:a.prices.original_row_total.currency},rowTotal:{value:a.prices.row_total.value,currency:a.prices.row_total.currency},rowTotalIncludingTax:{value:a.prices.row_total_including_tax.value,currency:a.prices.row_total_including_tax.currency}},savingsAmount:N(a),noteFromBuyer:(f=a.note_from_buyer)==null?void 0:f.map(t=>({createdAt:t.created_at,creatorId:t.creator_id,creatorType:t.creator_type,negotiableQuoteItemUid:t.negotiable_quote_item_uid,note:t.note,noteUid:t.note_uid})),noteFromSeller:(m=a.note_from_seller)==null?void 0:m.map(t=>({createdAt:t.created_at,creatorId:t.creator_id,creatorType:t.creator_type,negotiableQuoteItemUid:t.negotiable_quote_item_uid,note:t.note,noteUid:t.note_uid})),configurableOptions:(v=a.configurable_options)==null?void 0:v.map(t=>({optionLabel:t.option_label,valueLabel:t.value_label})),bundleOptions:(y=a.bundle_options)==null?void 0:y.map(t=>({label:t.label,values:t.values.map(_=>({label:_.label,quantity:_.quantity,originalPrice:{value:_.original_price.value,currency:_.original_price.currency},price:{value:_.priceV2.value,currency:_.priceV2.currency}}))})),customizableOptions:(h=a.customizable_options)==null?void 0:h.map(t=>({type:t.type,label:t.label,values:t.values.map(_=>({label:_.label,value:_.value}))}))}}))||[],shippingAddresses:(o=e.shipping_addresses)==null?void 0:o.map(a=>{const u={uid:a.uid,firstname:a.firstname,lastname:a.lastname,company:a.company,street:a.street,city:a.city,postcode:a.postcode,country:{code:a.country.code,label:a.country.label},telephone:a.telephone};return a.region&&(u.region={code:a.region.code,label:a.region.label,regionId:a.region.region_id}),u}),canCheckout:["UPDATED","DECLINED","OPEN"].includes(e.status)&&g.permissions.checkoutQuote&&((d=e.shipping_addresses)==null?void 0:d.length)>0,canSendForReview:(r||b.includes(e.status))&&g.permissions.editQuote,canUpdateQuote:(r||b.includes(e.status))&&g.permissions.editQuote,canDelete:!["PENDING","SUBMITTED","ORDERED"].includes(e.status)&&g.permissions.deleteQuote,canClose:e.status?!["DRAFT","CLOSED","ORDERED","OPEN"].includes(e.status):!1,readOnly:!r&&["ORDERED","SUBMITTED","CLOSED","PENDING"].includes(e.status)||!g.permissions.editQuote}}function V(e){return e?S(e):null}function D(e){return e.status==="SUBMITTED"&&!(e.history??[]).some(r=>{var n,c;return r.change_type==="UPDATED"&&(((c=(n=r.changes)==null?void 0:n.statuses)==null?void 0:c.changes)??[]).length>0})}function U(e){const r=D(e);return{uid:e.uid,name:e.name,createdAt:e.created_at,updatedAt:e.updated_at,status:r?x.NEW:e.status,buyer:{firstname:e.buyer.firstname,lastname:e.buyer.lastname},templateName:e.template_name,prices:{grandTotal:{value:e.prices.grand_total.value,currency:e.prices.grand_total.currency}}}}function X(e){var c;if(!e)return null;const r={items:((c=e.items)==null?void 0:c.filter(i=>i==null?void 0:i.uid).map(U))||[],pageInfo:{currentPage:e.page_info.current_page,pageSize:e.page_info.page_size,totalPages:e.page_info.total_pages},totalCount:e.total_count,sortFields:e.sort_fields?{default:e.sort_fields.default,options:e.sort_fields.options}:void 0},n=Q(r);return{...r,paginationInfo:n||void 0}}function Q(e){if(!(e!=null&&e.pageInfo)||!e.totalCount)return null;const{currentPage:r,pageSize:n,totalPages:c}=e.pageInfo,{totalCount:i}=e,l=i>0?(r-1)*n+1:0,s=Math.min(r*n,i);return{currentPage:r,totalCount:i,pageSize:n,startItem:l,endItem:s,totalPages:c,pageSizeOptions:[20,30,50,100,200]}}const K=()=>[20,30,50,100,200];function E(e,r){return e!=null&&e.length?e.reduce((n,c)=>({value:n.value+c.amount.value,currency:c.amount.currency}),{value:0,currency:r}):{value:0,currency:r}}function F(e){var c;if(!e||!((c=e.shipping_addresses)!=null&&c.length))return{};const n=e.shipping_addresses[0].selected_shipping_method;return n?{shippingIncludingTax:n.price_incl_tax&&{value:n.price_incl_tax.value,currency:n.price_incl_tax.currency},shippingExcludingTax:n.price_excl_tax&&{value:n.price_excl_tax.value,currency:n.price_excl_tax.currency}}:{}}export{Q as a,X as b,B as c,z as d,H as e,W as f,K as g,G as r,M as s,V as t};
|
|
3
|
+
import{FetchGraphQL as b}from"@dropins/tools/fetch-graphql.js";import{s as _}from"./state.js";var d=(e=>(e.NEW="NEW",e.SUBMITTED="SUBMITTED",e.PENDING="PENDING",e.UPDATED="UPDATED",e.OPEN="OPEN",e.ORDERED="ORDERED",e.CLOSED="CLOSED",e.DECLINED="DECLINED",e.EXPIRED="EXPIRED",e.DRAFT="DRAFT",e))(d||{});const{setEndpoint:L,setFetchGraphQlHeader:M,removeFetchGraphQlHeader:B,setFetchGraphQlHeaders:G,fetchGraphQl:z,getConfig:H}=new b().getMethods();function h(e){var a,r,c,i,u,s,o;return{uid:e.uid,createdAt:e.created_at,author:{firstname:e.author.firstname,lastname:e.author.lastname},changeType:e.change_type,changes:{commentAdded:((a=e.changes)==null?void 0:a.comment_added)&&{comment:e.changes.comment_added.comment},customChanges:((r=e.changes)==null?void 0:r.custom_changes)&&{new_value:e.changes.custom_changes.new_value,old_value:e.changes.custom_changes.old_value,title:e.changes.custom_changes.title},expiration:((c=e.changes)==null?void 0:c.expiration)&&{newExpiration:e.changes.expiration.new_expiration,oldExpiration:e.changes.expiration.old_expiration},productsRemoved:((i=e.changes)==null?void 0:i.products_removed)&&{productsRemovedFromCatalog:e.changes.products_removed.products_removed_from_catalog||[],productsRemovedFromQuote:e.changes.products_removed.products_removed_from_quote||[]},statuses:((u=e.changes)==null?void 0:u.statuses)&&{changes:((s=e.changes.statuses.changes)==null?void 0:s.map(l=>({newStatus:l==null?void 0:l.new_status,oldStatus:l==null?void 0:l.old_status})))||[]},total:((o=e.changes)==null?void 0:o.total)&&e.changes.total.new_price&&e.changes.total.old_price&&{newPrice:{value:e.changes.total.new_price.value,currency:e.changes.total.new_price.currency},oldPrice:{value:e.changes.total.old_price.value,currency:e.changes.total.old_price.currency}}}}}function y(e){if(e)return e.map(h)}function v(e,a){return e!=null&&e.length&&[...e].sort((c,i)=>i.quantity-c.quantity).find(c=>a>=c.quantity)||null}function T(e){var r,c,i,u;const a=_.config;return{src:a!=null&&a.useConfigurableParentThumbnail?e.product.thumbnail.url:((c=(r=e.configured_variant)==null?void 0:r.thumbnail)==null?void 0:c.url)||e.product.thumbnail.url,alt:a!=null&&a.useConfigurableParentThumbnail?e.product.thumbnail.label:((u=(i=e.configured_variant)==null?void 0:i.thumbnail)==null?void 0:u.label)||e.product.thumbnail.label}}function I(e){var a;return((a=e.links)==null?void 0:a.length)>0?{count:e.links.length,result:e.links.map(r=>r.title).join(", ")}:null}function D(e){var s,o,l,t;const a=e.quantity,r=e.__typename==="ConfigurableCartItem",c=r?(s=e.configured_variant)==null?void 0:s.price_tiers:e.product.price_tiers,i=r?(o=e.configured_variant)==null?void 0:o.price_range:e.product.price_range,u=v(c,a);return u?u.discount.amount_off>0:(((t=(l=i==null?void 0:i.maximum_price)==null?void 0:l.discount)==null?void 0:t.amount_off)??0)>0}function E(e){var i,u,s,o,l,t,n,p;const a=e.quantity,r=v(e.product.price_tiers,a);if(r)return Math.round(r.discount.percent_off);let c;if(e.__typename==="ConfigurableCartItem")c=(o=(s=(u=(i=e==null?void 0:e.configured_variant)==null?void 0:i.price_range)==null?void 0:u.maximum_price)==null?void 0:s.discount)==null?void 0:o.percent_off;else{if(e.__typename==="BundleCartItem")return;c=(p=(n=(t=(l=e==null?void 0:e.product)==null?void 0:l.price_range)==null?void 0:t.maximum_price)==null?void 0:n.discount)==null?void 0:p.percent_off}if(c!==0)return Math.round(c)}function P(e){var a,r,c,i;return e.__typename==="ConfigurableCartItem"?{value:(r=(a=e.configured_variant)==null?void 0:a.price_range)==null?void 0:r.maximum_price.regular_price.value,currency:(i=(c=e.configured_variant)==null?void 0:c.price_range)==null?void 0:i.maximum_price.regular_price.currency}:{value:e.prices.original_item_price.value,currency:e.prices.original_item_price.currency}}function w(e){var c,i,u,s,o,l;let a,r;if(a=((i=(c=e==null?void 0:e.prices)==null?void 0:c.original_row_total)==null?void 0:i.value)-((s=(u=e==null?void 0:e.prices)==null?void 0:u.row_total)==null?void 0:s.value),r=(l=(o=e==null?void 0:e.prices)==null?void 0:o.row_total)==null?void 0:l.currency,a!==0)return{value:a,currency:r}}function C(e){var a,r,c,i,u,s,o,l;return{itemType:e.__typename,uid:e.uid,product:{uid:e.product.uid,sku:e.product.sku,name:e.product.name,priceRange:{maximumPrice:{regularPrice:{value:e.product.price_range.maximum_price.regular_price.value,currency:e.product.price_range.maximum_price.regular_price.currency}}}},image:T(e),links:I(e),discounted:D(e),discountedTotal:{value:e.prices.row_total.value,currency:e.prices.row_total.currency},catalogDiscount:{amountOff:e.prices.catalog_discount.amount_off,percentOff:e.prices.catalog_discount.percent_off},discounts:((r=(a=e.prices)==null?void 0:a.discounts)==null?void 0:r.map(t=>({label:t.label,value:t.value,amount:{value:t.amount.value,currency:t.amount.currency}})))??[],discountPercentage:E(e),insufficientQuantity:(e.__typename==="ConfigurableCartItem"?((c=e.configured_variant)==null?void 0:c.stock_status)??e.product.stock_status:e.product.stock_status)==="IN_STOCK"&&!e.is_available,outOfStock:e.product.stock_status==="OUT_OF_STOCK",stockStatus:e.product.stock_status,quantity:e.quantity,prices:{regularPrice:P(e),priceIncludingTax:{value:e.prices.price_including_tax.value,currency:e.prices.price_including_tax.currency},originalItemPrice:{value:e.prices.original_item_price.value,currency:e.prices.original_item_price.currency},originalRowTotal:{value:e.prices.original_row_total.value,currency:e.prices.original_row_total.currency},rowTotal:{value:e.prices.row_total.value,currency:e.prices.row_total.currency},rowTotalIncludingTax:{value:e.prices.row_total_including_tax.value,currency:e.prices.row_total_including_tax.currency}},savingsAmount:w(e),noteFromBuyer:(i=e.note_from_buyer)==null?void 0:i.map(t=>({createdAt:t.created_at,creatorId:t.creator_id,creatorType:t.creator_type,negotiableQuoteItemUid:t.negotiable_quote_item_uid,note:t.note,noteUid:t.note_uid})),noteFromSeller:(u=e.note_from_seller)==null?void 0:u.map(t=>({createdAt:t.created_at,creatorId:t.creator_id,creatorType:t.creator_type,negotiableQuoteItemUid:t.negotiable_quote_item_uid,note:t.note,noteUid:t.note_uid})),configurableOptions:(s=e.configurable_options)==null?void 0:s.map(t=>({optionLabel:t.option_label,valueLabel:t.value_label})),bundleOptions:(o=e.bundle_options)==null?void 0:o.map(t=>({label:t.label,values:t.values.map(n=>({label:n.label,quantity:n.quantity,originalPrice:{value:n.original_price.value,currency:n.original_price.currency},price:{value:n.priceV2.value,currency:n.priceV2.currency}}))})),customizableOptions:(l=e.customizable_options)==null?void 0:l.map(t=>({type:t.type,label:t.label,values:t.values.map(n=>({label:n.label,value:n.value}))}))}}function A(e){return e?e.map(C):[]}const f=["DRAFT","UPDATED","DECLINED","EXPIRED","NEW","OPEN"];function O(e){if(!e.items)return 0;const a=_.config;return(a==null?void 0:a.quoteSummaryDisplayTotal)===0?e.items.length:(a==null?void 0:a.quoteSummaryDisplayTotal)===1?e.total_quantity:e.items.length}function R(e){return e.every(a=>!a.outOfStock&&!a.insufficientQuantity)}function S(e){var i,u,s,o,l,t;const a=x(e),r=!!((i=e.template_name)!=null&&i.trim()),c=A(e.items);return{uid:e.uid,name:e.name,createdAt:e.created_at,updatedAt:e.updated_at,expirationDate:e.expiration_date,status:a?d.NEW:e.status,isVirtual:!!e.is_virtual,salesRepName:e.sales_rep_name,buyer:{firstname:e.buyer.firstname,lastname:e.buyer.lastname},email:e.email,templateName:e.template_name,totalQuantity:O(e),comments:(u=e.comments)==null?void 0:u.map(n=>{const p={uid:n.uid,createdAt:n.created_at,author:{firstname:n.author.firstname,lastname:n.author.lastname},text:n.text};return Array.isArray(n.attachments)&&n.attachments.length>0&&(p.attachments=n.attachments.map(g=>({name:g.name,url:g.url}))),p}),prices:e.prices&&{appliedDiscounts:(s=e.prices.discounts)==null?void 0:s.map(n=>({amount:{value:n.amount.value,currency:n.amount.currency},label:n.label,coupon:n.coupon})),appliedTaxes:(o=e.prices.applied_taxes)==null?void 0:o.map(n=>({amount:{value:n.amount.value,currency:n.amount.currency},label:n.label})),discount:e.prices.discounts&&e.prices.grand_total&&m(e.prices.discounts,e.prices.grand_total.currency),grandTotal:e.prices.grand_total&&{value:e.prices.grand_total.value,currency:e.prices.grand_total.currency},grandTotalExcludingTax:e.prices.grand_total_excluding_tax&&{value:e.prices.grand_total_excluding_tax.value,currency:e.prices.grand_total_excluding_tax.currency},subtotalExcludingTax:e.prices.subtotal_excluding_tax&&{value:e.prices.subtotal_excluding_tax.value,currency:e.prices.subtotal_excluding_tax.currency},subtotalIncludingTax:e.prices.subtotal_including_tax&&{value:e.prices.subtotal_including_tax.value,currency:e.prices.subtotal_including_tax.currency},subtotalWithDiscountExcludingTax:e.prices.subtotal_with_discount_excluding_tax&&{value:e.prices.subtotal_with_discount_excluding_tax.value,currency:e.prices.subtotal_with_discount_excluding_tax.currency},...Q(e),totalTax:e.prices.applied_taxes&&e.prices.grand_total&&m(e.prices.applied_taxes,e.prices.grand_total.currency)},history:y(e.history),items:c,shippingAddresses:(l=e.shipping_addresses)==null?void 0:l.map(n=>{const p={uid:n.uid,firstname:n.firstname,lastname:n.lastname,company:n.company,street:n.street,city:n.city,postcode:n.postcode,country:{code:n.country.code,label:n.country.label},telephone:n.telephone};return n.region&&(p.region={code:n.region.code,label:n.region.label,regionId:n.region.region_id}),p}),canCheckout:["UPDATED","DECLINED"].includes(e.status)&&_.permissions.checkoutQuote&&((t=e.shipping_addresses)==null?void 0:t.length)>0&&R(c),canSendForReview:!r&&(a||f.includes(e.status))&&_.permissions.editQuote,canUpdateQuote:!r&&(a||f.includes(e.status))&&_.permissions.editQuote,canDelete:!r&&!["PENDING","SUBMITTED","ORDERED"].includes(e.status)&&_.permissions.deleteQuote,canClose:e.status?!r&&!["DRAFT","CLOSED","ORDERED","OPEN"].includes(e.status):!1,readOnly:r||!a&&["ORDERED","SUBMITTED","CLOSED","PENDING"].includes(e.status)||!_.permissions.editQuote}}function W(e){return e?S(e):null}function x(e){return e.status==="SUBMITTED"&&!(e.history??[]).some(a=>{var r,c;return a.change_type==="UPDATED"&&(((c=(r=a.changes)==null?void 0:r.statuses)==null?void 0:c.changes)??[]).length>0})}function N(e){const a=x(e);return{uid:e.uid,name:e.name,createdAt:e.created_at,updatedAt:e.updated_at,status:a?d.NEW:e.status,buyer:{firstname:e.buyer.firstname,lastname:e.buyer.lastname},templateName:e.template_name,prices:{grandTotal:{value:e.prices.grand_total.value,currency:e.prices.grand_total.currency}}}}function V(e){var c;if(!e)return null;const a={items:((c=e.items)==null?void 0:c.filter(i=>i==null?void 0:i.uid).map(N))||[],pageInfo:{currentPage:e.page_info.current_page,pageSize:e.page_info.page_size,totalPages:e.page_info.total_pages},totalCount:e.total_count,sortFields:e.sort_fields?{default:e.sort_fields.default,options:e.sort_fields.options}:void 0},r=k(a);return{...a,paginationInfo:r||void 0}}function k(e){if(!(e!=null&&e.pageInfo)||!e.totalCount)return null;const{currentPage:a,pageSize:r,totalPages:c}=e.pageInfo,{totalCount:i}=e,u=i>0?(a-1)*r+1:0,s=Math.min(a*r,i);return{currentPage:a,totalCount:i,pageSize:r,startItem:u,endItem:s,totalPages:c,pageSizeOptions:[20,30,50,100,200]}}const X=()=>[20,30,50,100,200];function m(e,a){return e!=null&&e.length?e.reduce((r,c)=>({value:r.value+c.amount.value,currency:c.amount.currency}),{value:0,currency:a}):{value:0,currency:a}}function Q(e){var c;if(!e||!((c=e.shipping_addresses)!=null&&c.length))return{};const r=e.shipping_addresses[0].selected_shipping_method;return r?{shippingIncludingTax:r.price_incl_tax&&{value:r.price_incl_tax.value,currency:r.price_incl_tax.currency},shippingExcludingTax:r.price_excl_tax&&{value:r.price_excl_tax.value,currency:r.price_excl_tax.currency}}:{}}export{A as a,y as b,k as c,V as d,M as e,z as f,X as g,G as h,H as i,B as r,L as s,W as t};
|
|
4
4
|
//# sourceMappingURL=transform-quote.js.map
|