@dropins/storefront-quote-management 0.0.1-alpha25 → 0.0.1-alpha26
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/api/initialize/initialize.d.ts +0 -1
- package/api.js +15 -15
- package/api.js.map +1 -1
- package/chunks/ItemsQuoted.js +1 -1
- package/chunks/ItemsQuoted.js.map +1 -1
- package/chunks/OrderSummaryLine.js +1 -1
- package/chunks/OrderSummaryLine.js.map +1 -1
- package/chunks/QuoteCommentsList.js +1 -1
- package/chunks/QuoteCommentsList.js.map +1 -1
- package/chunks/QuoteHistoryLog.js +1 -1
- package/chunks/QuoteHistoryLog.js.map +1 -1
- package/chunks/dateUtils.js +1 -1
- package/chunks/dateUtils.js.map +1 -1
- package/chunks/fetch-graphql.js +4 -0
- package/chunks/fetch-graphql.js.map +1 -0
- package/chunks/getQuoteTemplates.js +2 -2
- package/chunks/getQuoteTemplates.js.map +1 -1
- package/chunks/negotiableQuotes.js +1 -1
- package/chunks/negotiableQuotes.js.map +1 -1
- package/chunks/removeNegotiableQuoteItems.js +3 -3
- package/chunks/removeNegotiableQuoteItems.js.map +1 -1
- package/chunks/renameNegotiableQuote.js +1 -1
- package/chunks/renameNegotiableQuote.js.map +1 -1
- package/chunks/state.js +1 -1
- package/chunks/uploadFile.js +1 -1
- package/chunks/uploadFile.js.map +1 -1
- package/components/ManageNegotiableQuote/ManageNegotiableQuote.d.ts +1 -1
- package/components/ProductListTable/ProductListTable.d.ts +5 -41
- package/components/QuoteHistoryLog/QuoteHistoryLog.d.ts +2 -70
- package/components/index.d.ts +0 -1
- package/containers/ItemsQuoted.js +1 -1
- package/containers/ManageNegotiableQuote.js +1 -1
- package/containers/ManageNegotiableQuote.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/QuoteCommentsList.js +1 -1
- package/containers/QuoteHistoryLog.js +1 -1
- package/containers/QuoteSummaryList.js +1 -1
- package/containers/QuoteSummaryList.js.map +1 -1
- package/containers/QuoteTemplatesListTable/QuoteTemplatesListTable.d.ts +0 -2
- package/containers/QuoteTemplatesListTable.js +1 -1
- package/containers/QuoteTemplatesListTable.js.map +1 -1
- package/containers/QuotesListTable.js +1 -1
- package/containers/QuotesListTable.js.map +1 -1
- package/containers/RequestNegotiableQuoteForm.js +1 -1
- package/containers/RequestNegotiableQuoteForm.js.map +1 -1
- package/containers/index.d.ts +0 -4
- package/data/models/negotiable-quote-template-model.d.ts +1 -1
- package/i18n/en_US.json.d.ts +4 -32
- package/package.json +1 -1
- package/render.js +3 -2
- package/render.js.map +1 -1
- package/utils/dateUtils.d.ts +2 -7
- package/chunks/ItemsQuotedTemplate.js +0 -4
- package/chunks/ItemsQuotedTemplate.js.map +0 -1
- package/chunks/QuoteCommentsList3.js +0 -4
- package/chunks/QuoteCommentsList3.js.map +0 -1
- package/chunks/QuoteHistoryLog3.js +0 -4
- package/chunks/QuoteHistoryLog3.js.map +0 -1
- package/chunks/QuotePricesSummary.js +0 -4
- package/chunks/QuotePricesSummary.js.map +0 -1
- package/chunks/QuoteTemplateCommentsList.js +0 -4
- package/chunks/QuoteTemplateCommentsList.js.map +0 -1
- package/chunks/QuoteTemplateHistoryLog.js +0 -4
- package/chunks/QuoteTemplateHistoryLog.js.map +0 -1
- package/chunks/TabbedContent.js +0 -4
- package/chunks/TabbedContent.js.map +0 -1
- package/chunks/transform-quote.js +0 -4
- package/chunks/transform-quote.js.map +0 -1
- package/components/ManageNegotiableQuoteTemplate/ManageNegotiableQuoteTemplate.d.ts +0 -22
- package/components/ManageNegotiableQuoteTemplate/__fixtures__/ManageNegotiableQuoteTemplateProps.d.ts +0 -4
- package/components/ManageNegotiableQuoteTemplate/index.d.ts +0 -11
- package/containers/ItemsQuotedTemplate/ItemsQuotedTemplate.d.ts +0 -19
- package/containers/ItemsQuotedTemplate/index.d.ts +0 -11
- package/containers/ItemsQuotedTemplate.d.ts +0 -3
- package/containers/ItemsQuotedTemplate.js +0 -4
- package/containers/ItemsQuotedTemplate.js.map +0 -1
- package/containers/ManageNegotiableQuoteTemplate/ManageNegotiableQuoteTemplate.d.ts +0 -54
- package/containers/ManageNegotiableQuoteTemplate/index.d.ts +0 -11
- package/containers/ManageNegotiableQuoteTemplate.d.ts +0 -3
- package/containers/ManageNegotiableQuoteTemplate.js +0 -4
- package/containers/ManageNegotiableQuoteTemplate.js.map +0 -1
- package/containers/QuoteTemplateCommentsList/QuoteTemplateCommentsList.d.ts +0 -9
- package/containers/QuoteTemplateCommentsList/index.d.ts +0 -11
- package/containers/QuoteTemplateCommentsList.d.ts +0 -3
- package/containers/QuoteTemplateCommentsList.js +0 -4
- package/containers/QuoteTemplateCommentsList.js.map +0 -1
- package/containers/QuoteTemplateHistoryLog/QuoteTemplateHistoryLog.d.ts +0 -9
- package/containers/QuoteTemplateHistoryLog/index.d.ts +0 -11
- package/containers/QuoteTemplateHistoryLog.d.ts +0 -3
- package/containers/QuoteTemplateHistoryLog.js +0 -4
- package/containers/QuoteTemplateHistoryLog.js.map +0 -1
- package/data/models/__fixtures__/negotiableQuoteTemplateModel.d.ts +0 -4
|
@@ -4,7 +4,6 @@ import { Lang } from '@dropins/tools/types/elsie/src/i18n';
|
|
|
4
4
|
type ConfigProps = {
|
|
5
5
|
langDefinitions?: Lang;
|
|
6
6
|
quoteId?: string;
|
|
7
|
-
quoteTemplateId?: string;
|
|
8
7
|
};
|
|
9
8
|
export declare const initialize: Initializer<ConfigProps>;
|
|
10
9
|
export declare const config: import('@dropins/tools/types/elsie/src/lib').Config<ConfigProps>;
|
package/api.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/*! Copyright 2025 Adobe
|
|
2
2
|
All Rights Reserved. */
|
|
3
|
-
import{r as ce,u as _e}from"./chunks/uploadFile.js";import{g as Q}from"./chunks/renameNegotiableQuote.js";import{c as ge,d as Ee,r as he,s as Ie}from"./chunks/renameNegotiableQuote.js";import{F as Qe,N as we,S as Ne,n as Ae}from"./chunks/negotiableQuotes.js";import{events as i}from"@dropins/tools/event-bus.js";import{
|
|
3
|
+
import{r as ce,u as _e}from"./chunks/uploadFile.js";import{g as Q}from"./chunks/renameNegotiableQuote.js";import{c as ge,d as Ee,r as he,s as Ie}from"./chunks/renameNegotiableQuote.js";import{F as Qe,N as we,S as Ne,n as Ae}from"./chunks/negotiableQuotes.js";import{events as i}from"@dropins/tools/event-bus.js";import{D as h,Q as l,s as o,a as E}from"./chunks/state.js";import{f as n,t as w}from"./chunks/fetch-graphql.js";import{d as qe,r as ye,s as Ue,b as Oe,c as De}from"./chunks/fetch-graphql.js";import{N}from"./chunks/NegotiableQuoteFragment.js";import{t as u}from"./chunks/getQuoteTemplates.js";import{Q as ve,a as Fe,S as Pe,g as Se}from"./chunks/getQuoteTemplates.js";import{r as $e,u as Ce}from"./chunks/removeNegotiableQuoteItems.js";import{Initializer as A}from"@dropins/tools/lib.js";import"@dropins/tools/fetch-graphql.js";function b(t){if(!t)return h;const r=e=>[l.TAX_EXCLUDED,l.TAX_INCLUDED,l.TAX_INCLUDED_AND_EXCLUDED].includes(e)?e:l.TAX_EXCLUDED;return{quoteSummaryDisplayTotal:t.cart_summary_display_quantity,quoteSummaryMaxItems:t.max_items_in_order_summary,quoteDisplaySettings:{zeroTax:t.shopping_cart_display_zero_tax,subtotal:r(t.shopping_cart_display_subtotal),price:r(t.shopping_cart_display_price),shipping:r(t.shopping_cart_display_shipping),fullSummary:t.shopping_cart_display_full_summary,grandTotal:t.shopping_cart_display_grand_total},useConfigurableParentThumbnail:t.configurable_thumbnail_source==="parent"}}function q(t){if(!t||typeof t!="object")return{requestQuote:!1,editQuote:!1,deleteQuote:!1,checkoutQuote:!1,viewQuoteTemplates:!1,manageQuoteTemplates:!1,generateQuoteFromTemplate:!1};if(t.all===!0)return{requestQuote:!0,editQuote:!0,deleteQuote:!0,checkoutQuote:!0,viewQuoteTemplates:!0,manageQuoteTemplates:!0,generateQuoteFromTemplate:!0};const r=t["Magento_NegotiableQuote::all"]===!0,e=t["Magento_NegotiableQuoteTemplate::all"]===!0,a=r||t["Magento_NegotiableQuote::manage"]===!0;return{requestQuote:a,editQuote:a,deleteQuote:a,checkoutQuote:r||t["Magento_NegotiableQuote::checkout"]===!0,viewQuoteTemplates:e||t["Magento_NegotiableQuoteTemplate::view_template"]===!0,manageQuoteTemplates:e||t["Magento_NegotiableQuoteTemplate::manage"]===!0,generateQuoteFromTemplate:e||t["Magento_NegotiableQuoteTemplate::generate_quote"]===!0}}const c=new A({init:async t=>{const r={};c.config.setConfig({...r,...t}),await U().then(e=>{o.config=e}).catch(e=>{console.error("Failed to fetch store config: ",e),o.config=h})},listeners:()=>[i.on("authenticated",async t=>{o.authenticated=!!t,t||(o.permissions=E,i.emit("quote-management/permissions",E))},{eager:!0}),i.on("auth/permissions",async t=>{const r=q(t);o.permissions=r,i.emit("quote-management/permissions",o.permissions)},{eager:!0}),i.on("quote-management/permissions",async t=>{const r=c.config.getConfig().quoteId;r&&t.editQuote&&Q(r).then(e=>{i.emit("quote-management/quote-data/initialized",{quote:e,permissions:t},{})}).catch(e=>{i.emit("quote-management/quote-data/error",{error:e})})},{eager:!0})]}),J=c.config,y=`
|
|
4
4
|
query STORE_CONFIG_QUERY {
|
|
5
5
|
storeConfig {
|
|
6
6
|
cart_summary_display_quantity
|
|
@@ -14,7 +14,7 @@ import{r as ce,u as _e}from"./chunks/uploadFile.js";import{g as Q}from"./chunks/
|
|
|
14
14
|
configurable_thumbnail_source
|
|
15
15
|
}
|
|
16
16
|
}
|
|
17
|
-
`,U=async()=>n(y,{method:"GET",cache:"force-cache"}).then(({errors:t,data:
|
|
17
|
+
`,U=async()=>n(y,{method:"GET",cache:"force-cache"}).then(({errors:t,data:r})=>{if(t){const e=t.map(a=>a.message).join(", ");throw new Error(`Failed to get store config: ${e}`)}return b(r.storeConfig)}),O=`
|
|
18
18
|
mutation SET_NEGOTIABLE_QUOTE_SHIPPING_ADDRESS_MUTATION(
|
|
19
19
|
$quoteUid: ID!
|
|
20
20
|
$addressId: ID
|
|
@@ -35,7 +35,7 @@ import{r as ce,u as _e}from"./chunks/uploadFile.js";import{g as Q}from"./chunks/
|
|
|
35
35
|
}
|
|
36
36
|
}
|
|
37
37
|
${N}
|
|
38
|
-
`;function D(t){const{additionalInput:
|
|
38
|
+
`;function D(t){const{additionalInput:r,...e}=t,a={city:e.city,company:e.company,country_code:e.countryCode,firstname:e.firstname,lastname:e.lastname,postcode:e.postcode,region:e.region,region_id:e.regionId,save_in_address_book:e.saveInAddressBook,street:e.street,telephone:e.telephone};return{...r||{},...a}}const K=async t=>{const{quoteUid:r,addressId:e,addressData:a}=t;if(!r)throw new Error("Quote UID is required");if(e===void 0&&!a)throw new Error("Either addressId or addressData must be provided");if(e!==void 0&&a)throw new Error("Cannot provide both addressId and addressData");const d=a?D(a):null;return n(O,{variables:{quoteUid:r,addressId:e||null,addressData:d}}).then(s=>{var T,g;const{errors:_}=s;if(_){const I=_.map(f=>f.message).join("; ");throw new Error(`Failed to set shipping address: ${I}`)}const p=w((g=(T=s.data)==null?void 0:T.setNegotiableQuoteShippingAddress)==null?void 0:g.quote);if(!p)throw new Error("Failed to transform quote data: Invalid response structure");return i.emit("quote-management/shipping-address-set",{quote:p,input:{quoteUid:r,addressId:e,addressData:a}}),p})},m=`
|
|
39
39
|
fragment NegotiableQuoteTemplateFragment on NegotiableQuoteTemplate {
|
|
40
40
|
# uid
|
|
41
41
|
name
|
|
@@ -228,7 +228,7 @@ import{r as ce,u as _e}from"./chunks/uploadFile.js";import{g as Q}from"./chunks/
|
|
|
228
228
|
}
|
|
229
229
|
|
|
230
230
|
${m}
|
|
231
|
-
`,
|
|
231
|
+
`,Z=async t=>{var r;if(!o.authenticated)throw new Error("Unauthorized");if(!t)throw new Error("Template ID is required");try{const e=await n(M,{variables:{templateId:t}});if(!((r=e==null?void 0:e.data)!=null&&r.negotiableQuoteTemplate))throw new Error("Quote template not found");const a=u(e.data.negotiableQuoteTemplate);if(!a)throw new Error("Failed to transform quote template data");return i.emit("quote-management/quote-template-data",{quoteTemplate:a,permissions:o.permissions}),a}catch(e){return Promise.reject(e)}},v=`
|
|
232
232
|
mutation CREATE_QUOTE_TEMPLATE_MUTATION($cartId: ID!) {
|
|
233
233
|
requestNegotiableQuoteTemplateFromQuote(input: { cart_id: $cartId }) {
|
|
234
234
|
...NegotiableQuoteTemplateFragment
|
|
@@ -236,7 +236,7 @@ import{r as ce,u as _e}from"./chunks/uploadFile.js";import{g as Q}from"./chunks/
|
|
|
236
236
|
}
|
|
237
237
|
|
|
238
238
|
${m}
|
|
239
|
-
`,ee=async t=>{var
|
|
239
|
+
`,ee=async t=>{var r;if(!o.authenticated)throw new Error("Unauthorized");if(!t)throw new Error("Cart ID is required");try{const e=await n(v,{variables:{cartId:t}});if(!((r=e==null?void 0:e.data)!=null&&r.requestNegotiableQuoteTemplateFromQuote))throw new Error("Failed to create quote template");const a=u(e.data.requestNegotiableQuoteTemplateFromQuote);if(!a)throw new Error("Failed to transform quote template data");return i.emit("quote-management/quote-template-data",{quoteTemplate:a,permissions:o.permissions}),a}catch(e){return Promise.reject(e)}},F=`
|
|
240
240
|
mutation SEND_QUOTE_TEMPLATE_FOR_REVIEW_MUTATION(
|
|
241
241
|
$templateId: ID!
|
|
242
242
|
$comment: String
|
|
@@ -247,7 +247,7 @@ import{r as ce,u as _e}from"./chunks/uploadFile.js";import{g as Q}from"./chunks/
|
|
|
247
247
|
}
|
|
248
248
|
}
|
|
249
249
|
${m}
|
|
250
|
-
`,te=async t=>{var
|
|
250
|
+
`,te=async t=>{var r;if(!t.templateId)throw new Error("Template ID is required");if(!o.authenticated)throw new Error("Unauthorized");try{const e=await n(F,{variables:{templateId:t.templateId,name:t.name,comment:t.comment}});if(!((r=e==null?void 0:e.data)!=null&&r.submitNegotiableQuoteTemplateForReview))throw new Error("No quote template data received");const a=u(e.data.submitNegotiableQuoteTemplateForReview);if(!a)throw new Error("Failed to transform quote template data");return i.emit("quote-management/quote-template-data",{quoteTemplate:a,permissions:o.permissions}),a}catch(e){return Promise.reject(e)}},P=`
|
|
251
251
|
mutation ACCEPT_QUOTE_TEMPLATE_MUTATION($templateId: ID!) {
|
|
252
252
|
acceptNegotiableQuoteTemplate(input: { template_id: $templateId }) {
|
|
253
253
|
...NegotiableQuoteTemplateFragment
|
|
@@ -255,7 +255,7 @@ import{r as ce,u as _e}from"./chunks/uploadFile.js";import{g as Q}from"./chunks/
|
|
|
255
255
|
}
|
|
256
256
|
|
|
257
257
|
${m}
|
|
258
|
-
`,ae=async t=>{var
|
|
258
|
+
`,ae=async t=>{var r;if(!t.templateId)throw new Error("Template ID is required");if(!o.authenticated)throw new Error("Unauthorized");try{const e=await n(P,{variables:{templateId:t.templateId}});if(!((r=e==null?void 0:e.data)!=null&&r.acceptNegotiableQuoteTemplate))throw new Error("No quote template data received");const a=u(e.data.acceptNegotiableQuoteTemplate);if(!a)throw new Error("Failed to transform quote template data");return i.emit("quote-management/quote-template-data",{quoteTemplate:a,permissions:o.permissions}),a}catch(e){return Promise.reject(e)}},S=`
|
|
259
259
|
mutation CANCEL_QUOTE_TEMPLATE_MUTATION(
|
|
260
260
|
$templateId: ID!
|
|
261
261
|
$comment: String
|
|
@@ -270,11 +270,11 @@ import{r as ce,u as _e}from"./chunks/uploadFile.js";import{g as Q}from"./chunks/
|
|
|
270
270
|
}
|
|
271
271
|
}
|
|
272
272
|
${m}
|
|
273
|
-
`,
|
|
273
|
+
`,re=async t=>{var r;if(!t.templateId)throw new Error("Template ID is required");if(!o.authenticated)throw new Error("Unauthorized");try{const e=await n(S,{variables:{templateId:t.templateId,comment:t.comment}});if(!((r=e==null?void 0:e.data)!=null&&r.cancelNegotiableQuoteTemplate))throw new Error("No quote template data received");const a=u(e.data.cancelNegotiableQuoteTemplate);if(!a)throw new Error("Failed to transform quote template data");return i.emit("quote-management/quote-template-data",{quoteTemplate:a,permissions:o.permissions}),a}catch(e){return Promise.reject(e)}},L=`
|
|
274
274
|
mutation DELETE_QUOTE_TEMPLATE_MUTATION($templateId: ID!) {
|
|
275
275
|
deleteNegotiableQuoteTemplate(input: { template_id: $templateId })
|
|
276
276
|
}
|
|
277
|
-
`,
|
|
277
|
+
`,oe=async t=>{var r;if(!t.templateId)throw new Error("Template ID is required");if(!o.authenticated)throw new Error("Unauthorized");try{const e=await n(L,{variables:{templateId:t.templateId}});if(e!=null&&e.errors&&e.errors.length>0){const d=e.errors.map(s=>s==null?void 0:s.message).filter(Boolean).join("; ");throw new Error(d||"Failed to delete quote template")}if(!((r=e==null?void 0:e.data)==null?void 0:r.deleteNegotiableQuoteTemplate))throw new Error("Failed to delete quote template");return i.emit("quote-management/quote-template-deleted",{templateId:t.templateId}),{templateId:t.templateId}}catch(e){return Promise.reject(e)}},$=`
|
|
278
278
|
mutation OPEN_QUOTE_TEMPLATE_MUTATION($templateId: ID!) {
|
|
279
279
|
openNegotiableQuoteTemplate(input: { template_id: $templateId }) {
|
|
280
280
|
...NegotiableQuoteTemplateFragment
|
|
@@ -282,7 +282,7 @@ import{r as ce,u as _e}from"./chunks/uploadFile.js";import{g as Q}from"./chunks/
|
|
|
282
282
|
}
|
|
283
283
|
|
|
284
284
|
${m}
|
|
285
|
-
`,ie=async t=>{var
|
|
285
|
+
`,ie=async t=>{var r;if(!t.templateId)throw new Error("Template ID is required");if(!o.authenticated)throw new Error("Unauthorized");try{const e=await n($,{variables:{templateId:t.templateId}});if(!((r=e==null?void 0:e.data)!=null&&r.openNegotiableQuoteTemplate))throw new Error("No quote template data received");const a=u(e.data.openNegotiableQuoteTemplate);if(!a)throw new Error("Failed to transform quote template data");return i.emit("quote-management/quote-template-data",{quoteTemplate:a,permissions:o.permissions}),a}catch(e){return Promise.reject(e)}},C=`
|
|
286
286
|
mutation SET_NEGOTIABLE_QUOTE_TEMPLATE_SHIPPING_ADDRESS_MUTATION(
|
|
287
287
|
$templateId: ID!
|
|
288
288
|
$shippingAddress: NegotiableQuoteTemplateShippingAddressInput!
|
|
@@ -298,7 +298,7 @@ import{r as ce,u as _e}from"./chunks/uploadFile.js";import{g as Q}from"./chunks/
|
|
|
298
298
|
}
|
|
299
299
|
|
|
300
300
|
${m}
|
|
301
|
-
`,ne=async t=>{var
|
|
301
|
+
`,ne=async t=>{var r;if(!t.templateId)throw new Error("Template ID is required");if(!t.shippingAddress)throw new Error("Shipping address is required");if(!o.authenticated)throw new Error("Unauthorized");if(!t.shippingAddress.address&&!t.shippingAddress.customerAddressUid)throw new Error("Either address or customerAddressUid must be provided");try{const e=await n(C,{variables:{templateId:t.templateId,shippingAddress:{address:t.shippingAddress.address?{city:t.shippingAddress.address.city,company:t.shippingAddress.address.company,country_code:t.shippingAddress.address.countryCode,fax:t.shippingAddress.address.fax,firstname:t.shippingAddress.address.firstname,lastname:t.shippingAddress.address.lastname,middlename:t.shippingAddress.address.middlename,postcode:t.shippingAddress.address.postcode,prefix:t.shippingAddress.address.prefix,region:t.shippingAddress.address.region,region_id:t.shippingAddress.address.regionId,save_in_address_book:t.shippingAddress.address.saveInAddressBook,street:t.shippingAddress.address.street,suffix:t.shippingAddress.address.suffix,telephone:t.shippingAddress.address.telephone,vat_id:t.shippingAddress.address.vatId}:void 0,customer_address_uid:t.shippingAddress.customerAddressUid,customer_notes:t.shippingAddress.customerNotes}}});if(!((r=e==null?void 0:e.data)!=null&&r.setNegotiableQuoteTemplateShippingAddress))throw new Error("No quote template data received");const a=u(e.data.setNegotiableQuoteTemplateShippingAddress);if(!a)throw new Error("Failed to transform quote template data");return i.emit("quote-management/quote-template-data",{quoteTemplate:a,permissions:o.permissions}),a}catch(e){return Promise.reject(e)}},x=`
|
|
302
302
|
mutation UPDATE_NEGOTIABLE_QUOTE_TEMPLATE_QUANTITIES_MUTATION(
|
|
303
303
|
$input: UpdateNegotiableQuoteTemplateQuantitiesInput!
|
|
304
304
|
) {
|
|
@@ -309,7 +309,7 @@ import{r as ce,u as _e}from"./chunks/uploadFile.js";import{g as Q}from"./chunks/
|
|
|
309
309
|
}
|
|
310
310
|
}
|
|
311
311
|
${m}
|
|
312
|
-
`,se=async t=>{var
|
|
312
|
+
`,se=async t=>{var r,e;if(!t.templateId)throw new Error("Template ID is required");if(!t.items||t.items.length===0)throw new Error("Items array is required and must not be empty");if(!o.authenticated)throw new Error("Unauthorized");try{const a=await n(x,{variables:{input:{template_id:t.templateId,items:t.items.map(s=>({item_id:s.itemId,quantity:s.quantity,min_qty:s.minQty,max_qty:s.maxQty}))}}});if(!((e=(r=a==null?void 0:a.data)==null?void 0:r.updateNegotiableQuoteTemplateQuantities)!=null&&e.quote_template))throw new Error("No quote template data received");const d=u(a.data.updateNegotiableQuoteTemplateQuantities.quote_template);if(!d)throw new Error("Failed to transform quote template data");return i.emit("quote-management/quote-template-data",{quoteTemplate:d,permissions:o.permissions}),d}catch(a){return Promise.reject(a)}},G=`
|
|
313
313
|
mutation REMOVE_NEGOTIABLE_QUOTE_TEMPLATE_ITEMS_MUTATION(
|
|
314
314
|
$input: RemoveNegotiableQuoteTemplateItemsInput!
|
|
315
315
|
) {
|
|
@@ -318,7 +318,7 @@ import{r as ce,u as _e}from"./chunks/uploadFile.js";import{g as Q}from"./chunks/
|
|
|
318
318
|
}
|
|
319
319
|
}
|
|
320
320
|
${m}
|
|
321
|
-
`,de=async t=>{var
|
|
321
|
+
`,de=async t=>{var r;if(!t.templateId)throw new Error("Template ID is required");if(!t.itemUids||t.itemUids.length===0)throw new Error("Item UIDs array is required and must not be empty");if(!o.authenticated)throw new Error("Unauthorized");try{const e=await n(G,{variables:{input:{template_id:t.templateId,item_uids:t.itemUids}}});if(!((r=e==null?void 0:e.data)!=null&&r.removeNegotiableQuoteTemplateItems))throw new Error("No quote template data received");const a=u(e.data.removeNegotiableQuoteTemplateItems);if(!a)throw new Error("Failed to transform quote template data");return i.emit("quote-management/quote-template-data",{quoteTemplate:a,permissions:o.permissions}),a}catch(e){return Promise.reject(e)}},R=`
|
|
322
322
|
mutation SET_QUOTE_TEMPLATE_LINE_ITEM_NOTE_MUTATION(
|
|
323
323
|
$input: QuoteTemplateLineItemNoteInput!
|
|
324
324
|
) {
|
|
@@ -327,7 +327,7 @@ import{r as ce,u as _e}from"./chunks/uploadFile.js";import{g as Q}from"./chunks/
|
|
|
327
327
|
}
|
|
328
328
|
}
|
|
329
329
|
${m}
|
|
330
|
-
`,ue=async t=>{var
|
|
330
|
+
`,ue=async t=>{var r;if(!t.templateId)throw new Error("Template ID is required");if(!t.itemId)throw new Error("Item ID is required");if(!o.authenticated)throw new Error("Unauthorized");try{const e=await n(R,{variables:{input:{templateId:t.templateId,item_id:t.itemId,note:t.note}}});if(!((r=e==null?void 0:e.data)!=null&&r.setQuoteTemplateLineItemNote))throw new Error("No quote template data received");const a=u(e.data.setQuoteTemplateLineItemNote);if(!a)throw new Error("Failed to transform quote template data");return i.emit("quote-management/quote-template-data",{quoteTemplate:a,permissions:o.permissions}),a}catch(e){return Promise.reject(e)}},z=`
|
|
331
331
|
mutation GENERATE_NEGOTIABLE_QUOTE_FROM_TEMPLATE_MUTATION(
|
|
332
332
|
$input: GenerateNegotiableQuoteFromTemplateInput!
|
|
333
333
|
) {
|
|
@@ -335,5 +335,5 @@ import{r as ce,u as _e}from"./chunks/uploadFile.js";import{g as Q}from"./chunks/
|
|
|
335
335
|
negotiable_quote_uid
|
|
336
336
|
}
|
|
337
337
|
}
|
|
338
|
-
`,me=async t=>{var
|
|
338
|
+
`,me=async t=>{var r,e;if(!t.templateId)throw new Error("Template ID is required");if(!o.authenticated)throw new Error("Unauthorized");try{const a=await n(z,{variables:{input:{template_id:t.templateId}}});if(!((e=(r=a==null?void 0:a.data)==null?void 0:r.generateNegotiableQuoteFromTemplate)!=null&&e.negotiable_quote_uid))throw new Error("No quote UID received");const d=a.data.generateNegotiableQuoteFromTemplate.negotiable_quote_uid;return i.emit("quote-management/quote-template-generated",{quoteId:d}),{quoteId:d}}catch(a){return Promise.reject(a)}};export{Qe as FilterMatchTypeEnum,we as NegotiableQuoteSortableField,ve as QuoteTemplateFilterStatus,Fe as QuoteTemplateSortField,Pe as SortDirection,Ne as SortEnum,ae as acceptQuoteTemplate,ue as addQuoteTemplateLineItemNote,ne as addQuoteTemplateShippingAddress,re as cancelQuoteTemplate,ge as closeNegotiableQuote,J as config,ee as createQuoteTemplate,Ee as deleteQuote,oe as deleteQuoteTemplate,n as fetchGraphQl,me as generateQuoteFromTemplate,qe as getConfig,Q as getQuoteData,Z as getQuoteTemplateData,Se as getQuoteTemplates,U as getStoreConfig,c as initialize,Ae as negotiableQuotes,ie as openQuoteTemplate,ye as removeFetchGraphQlHeader,$e as removeNegotiableQuoteItems,de as removeQuoteTemplateItems,he as renameNegotiableQuote,ce as requestNegotiableQuote,Ie as sendForReview,te as sendQuoteTemplateForReview,Ue as setEndpoint,Oe as setFetchGraphQlHeader,De as setFetchGraphQlHeaders,K as setShippingAddress,Ce as updateQuantities,se as updateQuoteTemplateItemQuantities,_e as uploadFile};
|
|
339
339
|
//# sourceMappingURL=api.js.map
|
package/api.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"api.js","sources":["/@dropins/storefront-quote-management/src/utils/mapAuthPermissions.ts","/@dropins/storefront-quote-management/src/api/initialize/initialize.ts","/@dropins/storefront-quote-management/src/data/transforms/transform-store-config.ts","/@dropins/storefront-quote-management/src/api/getStoreConfig/graphql/StoreConfigQuery.ts","/@dropins/storefront-quote-management/src/api/getStoreConfig/getStoreConfig.ts","/@dropins/storefront-quote-management/src/api/setShippingAddress/graphql/SetNegotiableQuoteShippingAddressMutation.ts","/@dropins/storefront-quote-management/src/api/setShippingAddress/setShippingAddress.ts","/@dropins/storefront-quote-management/src/api/graphql/NegotiableQuoteTemplateFragment.ts","/@dropins/storefront-quote-management/src/api/getQuoteTemplateData/graphql/getQuoteTemplateData.ts","/@dropins/storefront-quote-management/src/api/getQuoteTemplateData/getQuoteTemplateData.ts","/@dropins/storefront-quote-management/src/api/createQuoteTemplate/graphql/createQuoteTemplate.ts","/@dropins/storefront-quote-management/src/api/createQuoteTemplate/createQuoteTemplate.ts","/@dropins/storefront-quote-management/src/api/sendQuoteTemplateForReview/graphql/sendQuoteTemplateForReview.ts","/@dropins/storefront-quote-management/src/api/sendQuoteTemplateForReview/sendQuoteTemplateForReview.ts","/@dropins/storefront-quote-management/src/api/acceptQuoteTemplate/graphql/acceptQuoteTemplate.ts","/@dropins/storefront-quote-management/src/api/acceptQuoteTemplate/acceptQuoteTemplate.ts","/@dropins/storefront-quote-management/src/api/cancelQuoteTemplate/graphql/cancelQuoteTemplate.ts","/@dropins/storefront-quote-management/src/api/cancelQuoteTemplate/cancelQuoteTemplate.ts","/@dropins/storefront-quote-management/src/api/deleteQuoteTemplate/graphql/deleteQuoteTemplate.ts","/@dropins/storefront-quote-management/src/api/deleteQuoteTemplate/deleteQuoteTemplate.ts","/@dropins/storefront-quote-management/src/api/openQuoteTemplate/graphql/openQuoteTemplate.ts","/@dropins/storefront-quote-management/src/api/openQuoteTemplate/openQuoteTemplate.ts","/@dropins/storefront-quote-management/src/api/addQuoteTemplateShippingAddress/graphql/setNegotiableQuoteTemplateShippingAddress.ts","/@dropins/storefront-quote-management/src/api/addQuoteTemplateShippingAddress/addQuoteTemplateShippingAddress.ts","/@dropins/storefront-quote-management/src/api/updateQuoteTemplateItemQuantities/graphql/updateNegotiableQuoteTemplateQuantities.ts","/@dropins/storefront-quote-management/src/api/updateQuoteTemplateItemQuantities/updateQuoteTemplateItemQuantities.ts","/@dropins/storefront-quote-management/src/api/removeQuoteTemplateItems/graphql/removeNegotiableQuoteTemplateItems.ts","/@dropins/storefront-quote-management/src/api/removeQuoteTemplateItems/removeQuoteTemplateItems.ts","/@dropins/storefront-quote-management/src/api/addQuoteTemplateLineItemNote/graphql/setQuoteTemplateLineItemNote.ts","/@dropins/storefront-quote-management/src/api/addQuoteTemplateLineItemNote/addQuoteTemplateLineItemNote.ts","/@dropins/storefront-quote-management/src/api/generateQuoteFromTemplate/graphql/generateNegotiableQuoteFromTemplate.ts","/@dropins/storefront-quote-management/src/api/generateQuoteFromTemplate/generateQuoteFromTemplate.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 { State } from '@/quote-management/types/state.types';\n\n/**\n * Type definition for the auth/permissions event payload\n * Contains flat Adobe Commerce permission keys with boolean values\n */\nexport type AuthPermissionsPayload = {\n all?: boolean;\n 'Magento_NegotiableQuote::all'?: boolean;\n 'Magento_NegotiableQuote::manage'?: boolean;\n 'Magento_NegotiableQuote::checkout'?: boolean;\n 'Magento_NegotiableQuoteTemplate::all'?: boolean;\n 'Magento_NegotiableQuoteTemplate::view_template'?: boolean;\n 'Magento_NegotiableQuoteTemplate::manage'?: boolean;\n 'Magento_NegotiableQuoteTemplate::generate_quote'?: boolean;\n [key: string]: boolean | undefined;\n};\n\n/**\n * Maps the auth/permissions event payload to internal permissions structure.\n * \n * Implements hierarchical permission checking:\n * 1. Top-level \"all\": If true, grants all permissions\n * 2. Module-level \"::all\": Grants all permissions for that module\n * 3. Specific permissions: Maps individual keys to internal flags\n * \n * @param payload - The raw auth/permissions event payload\n * @returns Typed permissions object matching the state structure\n * \n * @example\n * ```typescript\n * const permissions = mapAuthPermissions({\n * \"Magento_NegotiableQuote::manage\": true,\n * \"Magento_NegotiableQuote::checkout\": true\n * });\n * // Returns: { requestQuote: true, editQuote: true, deleteQuote: true, checkoutQuote: true, ... }\n * ```\n */\nexport function mapAuthPermissions(\n payload: AuthPermissionsPayload | null | undefined\n): State['permissions'] {\n // Handle null/undefined payload - return all false\n if (!payload || typeof payload !== 'object') {\n return {\n requestQuote: false,\n editQuote: false,\n deleteQuote: false,\n checkoutQuote: false,\n viewQuoteTemplates: false,\n manageQuoteTemplates: false,\n generateQuoteFromTemplate: false,\n };\n }\n\n // If top-level \"all\" is true, grant all permissions\n if (payload.all === true) {\n return {\n requestQuote: true,\n editQuote: true,\n deleteQuote: true,\n checkoutQuote: true,\n viewQuoteTemplates: true,\n manageQuoteTemplates: true,\n generateQuoteFromTemplate: true,\n };\n }\n\n // Check module-level \"all\" permissions\n const hasAllQuotePermissions = payload['Magento_NegotiableQuote::all'] === true;\n const hasAllTemplatePermissions = payload['Magento_NegotiableQuoteTemplate::all'] === true;\n\n // Map specific permissions with fallback to module-level \"all\"\n const hasManagePermission = \n hasAllQuotePermissions || payload['Magento_NegotiableQuote::manage'] === true;\n\n return {\n // Magento_NegotiableQuote::manage maps to request, edit, and delete\n requestQuote: hasManagePermission,\n editQuote: hasManagePermission,\n deleteQuote: hasManagePermission,\n \n // Magento_NegotiableQuote::checkout maps to checkoutQuote\n checkoutQuote: \n hasAllQuotePermissions || payload['Magento_NegotiableQuote::checkout'] === true,\n \n // Template permissions\n viewQuoteTemplates: \n hasAllTemplatePermissions || payload['Magento_NegotiableQuoteTemplate::view_template'] === true,\n manageQuoteTemplates: \n hasAllTemplatePermissions || payload['Magento_NegotiableQuoteTemplate::manage'] === true,\n generateQuoteFromTemplate: \n hasAllTemplatePermissions || payload['Magento_NegotiableQuoteTemplate::generate_quote'] === true,\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 { Initializer } from '@adobe-commerce/elsie/lib';\nimport { Lang } from '@adobe-commerce/elsie/i18n';\nimport { events } from '@adobe-commerce/event-bus';\nimport {\n state,\n DEFAULT_CONFIG,\n DEFAULT_PERMISSIONS,\n} from '@/quote-management/lib/state';\nimport {\n getQuoteData,\n getStoreConfig,\n getQuoteTemplateData,\n} from '@/quote-management/api';\nimport { mapAuthPermissions, AuthPermissionsPayload } from '@/quote-management/utils/mapAuthPermissions';\n\ntype ConfigProps = {\n langDefinitions?: Lang;\n quoteId?: string;\n quoteTemplateId?: string;\n};\n\nexport const initialize = new Initializer<ConfigProps>({\n init: async (config) => {\n const defaultConfig = {};\n\n // Set config\n initialize.config.setConfig({ ...defaultConfig, ...config });\n\n // Fetch store config\n await getStoreConfig()\n .then((config) => {\n state.config = config;\n })\n .catch((error) => {\n console.error('Failed to fetch store config: ', error);\n state.config = DEFAULT_CONFIG;\n });\n },\n\n listeners: () => [\n events.on('authenticated', async (authenticated) => {\n state.authenticated = !!authenticated;\n\n // Defensive: reset permissions if user logs out\n // This ensures permissions are cleared even if auth/permissions event doesn't fire\n if (!authenticated) {\n state.permissions = DEFAULT_PERMISSIONS;\n events.emit('quote-management/permissions', DEFAULT_PERMISSIONS);\n }\n },\n {\n eager: true,\n }\n ),\n events.on('auth/permissions', async (payload: AuthPermissionsPayload) => {\n // Map the auth permissions payload to internal permissions structure\n const permissions = mapAuthPermissions(payload);\n \n state.permissions = permissions;\n events.emit('quote-management/permissions', state.permissions);\n }, {\n eager: true,\n }),\n\n events.on('quote-management/permissions', async (permissions) => {\n const quoteId = initialize.config.getConfig().quoteId;\n const quoteTemplateId = initialize.config.getConfig().quoteTemplateId;\n\n if (permissions.editQuote && quoteId) {\n getQuoteData(quoteId)\n .then((quote) => {\n events.emit('quote-management/quote-data/initialized', { quote, permissions });\n })\n .catch((error) => {\n events.emit('quote-management/quote-data/error', { error });\n });\n }\n\n if (permissions.editQuote && quoteTemplateId) {\n getQuoteTemplateData(quoteTemplateId)\n .catch((error) => {\n events.emit('quote-management/quote-template-data/error', { error });\n });\n }\n }, { eager: true }),\n ],\n});\n\nexport const config = initialize.config;\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 { DEFAULT_CONFIG } from '@/quote-management/lib/state';\n\nexport function transformStoreConfig(data: any): StoreConfigModel {\n if (!data) return DEFAULT_CONFIG;\n\n const transformQuoteDisplayAmountSetting = (\n quoteDisplayAmountSetting: number\n ) => {\n if (\n [\n QuoteDisplayAmount.TAX_EXCLUDED,\n QuoteDisplayAmount.TAX_INCLUDED,\n QuoteDisplayAmount.TAX_INCLUDED_AND_EXCLUDED,\n ].includes(quoteDisplayAmountSetting)\n ) {\n return quoteDisplayAmountSetting;\n }\n\n return QuoteDisplayAmount.TAX_EXCLUDED;\n };\n\n return {\n quoteSummaryDisplayTotal: data.cart_summary_display_quantity,\n quoteSummaryMaxItems: data.max_items_in_order_summary,\n quoteDisplaySettings: {\n zeroTax: data.shopping_cart_display_zero_tax,\n subtotal: transformQuoteDisplayAmountSetting(\n data.shopping_cart_display_subtotal\n ),\n price: transformQuoteDisplayAmountSetting(\n data.shopping_cart_display_price\n ),\n shipping: transformQuoteDisplayAmountSetting(\n data.shopping_cart_display_shipping\n ),\n fullSummary: data.shopping_cart_display_full_summary,\n grandTotal: data.shopping_cart_display_grand_total,\n },\n useConfigurableParentThumbnail:\n data.configurable_thumbnail_source === 'parent',\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 STORE_CONFIG_QUERY = /* GraphQL */ `\n query STORE_CONFIG_QUERY {\n storeConfig {\n cart_summary_display_quantity\n max_items_in_order_summary\n shopping_cart_display_full_summary\n shopping_cart_display_grand_total\n shopping_cart_display_price\n shopping_cart_display_shipping\n shopping_cart_display_subtotal\n shopping_cart_display_zero_tax\n configurable_thumbnail_source\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 { StoreConfigModel } from '@/quote-management/data/models';\nimport { transformStoreConfig } from '@/quote-management/data/transforms';\nimport { STORE_CONFIG_QUERY } from './graphql/StoreConfigQuery';\n\nexport const getStoreConfig = async (): Promise<StoreConfigModel> => {\n return fetchGraphQl(STORE_CONFIG_QUERY, {\n method: 'GET',\n cache: 'force-cache',\n }).then(({ errors, data }) => {\n if (errors) {\n const errorMessage = errors.map((e: any) => e.message).join(', ');\n throw new Error(`Failed to get store config: ${errorMessage}`);\n }\n\n return transformStoreConfig(data.storeConfig);\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_FRAGMENT } from '@/quote-management/api/graphql/NegotiableQuoteFragment';\n\nexport const SET_NEGOTIABLE_QUOTE_SHIPPING_ADDRESS_MUTATION = `\n mutation SET_NEGOTIABLE_QUOTE_SHIPPING_ADDRESS_MUTATION(\n $quoteUid: ID!\n $addressId: ID\n $addressData: NegotiableQuoteAddressInput\n ) {\n setNegotiableQuoteShippingAddress(\n input: {\n quote_uid: $quoteUid\n shipping_addresses: {\n customer_address_uid: $addressId\n address: $addressData\n }\n }\n ) {\n quote {\n ...NegotiableQuoteFragment\n }\n }\n }\n ${NEGOTIABLE_QUOTE_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 { events } from '@adobe-commerce/event-bus';\nimport { SET_NEGOTIABLE_QUOTE_SHIPPING_ADDRESS_MUTATION } from './graphql/SetNegotiableQuoteShippingAddressMutation';\nimport { NegotiableQuoteModel } from '@/quote-management/data/models/negotiable-quote-model';\nimport { transformQuote } from '@/quote-management/data/transforms';\n\nexport interface AddressInput {\n /** City name */\n city: string;\n /** Optional company name */\n company?: string;\n /** Two-letter country code (e.g., 'US') */\n countryCode: string;\n /** First name */\n firstname: string;\n /** Last name */\n lastname: string;\n /** Postal/ZIP code */\n postcode: string;\n /** Optional state/province name */\n region?: string;\n /** Optional state/province ID */\n regionId?: number;\n /** Whether to save this address to the customer's address book */\n saveInAddressBook?: boolean;\n /** Street address lines (array) */\n street: string[];\n /** Phone number */\n telephone: string;\n /** \n * Additional input (optional custom fields for the address).\n * These fields will be merged into the address data sent to GraphQL.\n * Standard fields take precedence over additional fields to prevent\n * accidental override of required address attributes.\n * \n * @example\n * ```ts\n * additionalInput: {\n * vat_id: 'GB123456789',\n * custom_attribute: 'value',\n * delivery_instructions: 'Leave at door'\n * }\n * ```\n */\n additionalInput?: Record<string, any>;\n}\n\nexport interface SetShippingAddressInput {\n /** The unique ID of the negotiable quote */\n quoteUid: string;\n /** The ID of a saved customer address (use this OR addressData, not both) */\n addressId?: number;\n /** New address data (use this OR addressId, not both) */\n addressData?: AddressInput;\n}\n\n/**\n * Transform camelCase address data to snake_case for GraphQL mutation.\n * Additional fields from additionalInput are spread into the result, with\n * standard fields taking precedence (defensive flexibility approach).\n */\nfunction transformAddressToSnakeCase(address: AddressInput) {\n const { additionalInput, ...standardFields } = address;\n \n // Build the standard transformed fields\n const transformedStandardFields = {\n city: standardFields.city,\n company: standardFields.company,\n country_code: standardFields.countryCode,\n firstname: standardFields.firstname,\n lastname: standardFields.lastname,\n postcode: standardFields.postcode,\n region: standardFields.region,\n region_id: standardFields.regionId,\n save_in_address_book: standardFields.saveInAddressBook,\n street: standardFields.street,\n telephone: standardFields.telephone,\n };\n \n // Spread additional input first, then standard fields take precedence\n // This provides defensive flexibility: allows custom fields while protecting core fields\n return {\n ...(additionalInput || {}),\n ...transformedStandardFields,\n };\n}\n\n/**\n * Sets or updates the shipping address for a negotiable quote.\n * \n * @param input - The input parameters for setting the shipping address\n * @param input.quoteUid - The unique ID of the negotiable quote\n * @param input.addressId - Optional ID of a saved customer address (use this OR addressData)\n * @param input.addressData - Optional new address data (use this OR addressId)\n * @param input.addressData.additionalInput - Optional additional address fields to pass through to GraphQL\n * @returns Promise that resolves to the updated quote model with shipping addresses including uid field\n * @throws Error if validation fails or GraphQL operation fails\n * \n * @example\n * ```ts\n * // Using a saved address\n * const quote = await setShippingAddress({\n * quoteUid: 'quote-123',\n * addressId: 5\n * });\n * \n * // Using new address data\n * const quote = await setShippingAddress({\n * quoteUid: 'quote-123',\n * addressData: {\n * firstname: 'John',\n * lastname: 'Doe',\n * street: ['123 Main St'],\n * city: 'San Francisco',\n * countryCode: 'US',\n * postcode: '94103',\n * telephone: '555-1234'\n * }\n * });\n * \n * // Using address data with additional custom fields\n * const quote = await setShippingAddress({\n * quoteUid: 'quote-123',\n * addressData: {\n * firstname: 'John',\n * lastname: 'Doe',\n * street: ['123 Main St'],\n * city: 'San Francisco',\n * countryCode: 'US',\n * postcode: '94103',\n * telephone: '555-1234',\n * additionalInput: {\n * vat_id: 'GB123456789',\n * custom_attribute_1: 'value1',\n * delivery_instructions: 'Leave at door'\n * }\n * }\n * });\n * \n * // Access address identifier\n * if (quote?.shippingAddresses?.[0]) {\n * console.log('Address UID:', quote.shippingAddresses[0].uid);\n * }\n * ```\n */\nexport const setShippingAddress = async (\n input: SetShippingAddressInput\n): Promise<NegotiableQuoteModel | null> => {\n const { quoteUid, addressId, addressData } = input;\n\n if (!quoteUid) {\n throw new Error('Quote UID is required');\n }\n\n // Validate that exactly one of addressId or addressData is provided\n if (addressId === undefined && !addressData) {\n throw new Error('Either addressId or addressData must be provided');\n }\n\n if (addressId !== undefined && addressData) {\n throw new Error('Cannot provide both addressId and addressData');\n }\n\n // Transform addressData to snake_case if provided\n const transformedAddressData = addressData\n ? transformAddressToSnakeCase(addressData)\n : null;\n\n return fetchGraphQl(SET_NEGOTIABLE_QUOTE_SHIPPING_ADDRESS_MUTATION, {\n variables: {\n quoteUid,\n addressId: addressId || null,\n addressData: transformedAddressData,\n },\n }).then((response) => {\n const { errors } = response;\n\n if (errors) {\n // Provide more detailed error information\n const errorMessages = errors.map((error) => error.message).join('; ');\n throw new Error(`Failed to set shipping address: ${errorMessages}`);\n }\n\n // Transform the quote data\n const quoteData = transformQuote(\n response.data?.setNegotiableQuoteShippingAddress?.quote\n );\n\n if (!quoteData) {\n throw new Error(\n 'Failed to transform quote data: Invalid response structure'\n );\n }\n\n // Emit event with transformed quote data on success\n events.emit('quote-management/shipping-address-set', {\n quote: quoteData,\n input: { quoteUid, addressId, addressData },\n });\n\n return quoteData;\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\nexport const NEGOTIABLE_QUOTE_TEMPLATE_FRAGMENT = /* GraphQL */ `\n fragment NegotiableQuoteTemplateFragment on NegotiableQuoteTemplate {\n # uid\n name\n # created_at\n # updated_at\n status\n # sales_rep_name\n expiration_date\n buyer {\n firstname\n lastname\n }\n comments {\n uid\n created_at\n author {\n firstname\n lastname\n }\n text\n attachments {\n name\n url\n }\n }\n items {\n uid\n product {\n name\n sku\n uid\n stock_status\n }\n prices {\n price {\n currency\n value\n }\n original_item_price {\n currency\n value\n }\n row_total {\n currency\n value\n }\n catalog_discount {\n amount_off\n percent_off\n }\n discounts {\n label\n value\n amount {\n currency\n value\n }\n }\n }\n quantity\n note_from_buyer {\n created_at\n creator_id\n creator_type\n # negotiable_quote_template_item_uid\n note\n note_uid\n }\n note_from_seller {\n created_at\n creator_id\n creator_type\n # negotiable_quote_template_item_uid\n note\n note_uid\n }\n ... on ConfigurableCartItem {\n configurable_options {\n option_label\n value_label\n }\n }\n ... on BundleCartItem {\n bundle_options {\n label\n values {\n label\n quantity\n original_price {\n currency\n value\n }\n priceV2 {\n currency\n value\n }\n }\n }\n }\n }\n history {\n uid\n created_at\n author {\n firstname\n lastname\n }\n change_type\n changes {\n comment_added {\n comment\n }\n custom_changes {\n new_value\n old_value\n title\n }\n statuses {\n changes {\n new_status\n old_status\n }\n }\n expiration {\n new_expiration\n old_expiration\n }\n total {\n new_price {\n currency\n value\n }\n old_price {\n currency\n value\n }\n }\n }\n }\n prices {\n subtotal_excluding_tax {\n currency\n value\n }\n subtotal_including_tax {\n currency\n value\n }\n subtotal_with_discount_excluding_tax {\n currency\n value\n }\n applied_taxes {\n amount {\n currency\n value\n }\n label\n }\n grand_total {\n currency\n value\n }\n }\n shipping_addresses {\n uid\n firstname\n lastname\n company\n street\n city\n region {\n code\n label\n region_id\n }\n postcode\n country {\n code\n label\n }\n telephone\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 { NEGOTIABLE_QUOTE_TEMPLATE_FRAGMENT } from '@/quote-management/api/graphql/NegotiableQuoteTemplateFragment';\n\nexport const GET_QUOTE_TEMPLATE_DATA = /* GraphQL */ `\n query QUOTE_TEMPLATE_DATA_QUERY($templateId: ID!) {\n negotiableQuoteTemplate(templateId: $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 { GET_QUOTE_TEMPLATE_DATA } from './graphql/getQuoteTemplateData';\nimport { transformQuoteTemplate } from '@/quote-management/data/transforms';\nimport { NegotiableQuoteTemplateModel } 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 const getQuoteTemplateData = async (templateId: string): Promise<NegotiableQuoteTemplateModel | null> => {\n\n if (!state.authenticated) {\n throw new Error('Unauthorized');\n }\n\n if (!templateId) {\n throw new Error('Template ID is required');\n }\n\n try {\n const results: any = await fetchGraphQl(GET_QUOTE_TEMPLATE_DATA, {\n variables: { templateId },\n });\n\n\n if (!results?.data?.negotiableQuoteTemplate) {\n throw new Error('Quote template not found');\n }\n\n const transformedData = transformQuoteTemplate(results.data.negotiableQuoteTemplate);\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 \"../../graphql/NegotiableQuoteTemplateFragment\";\n\nexport const CREATE_QUOTE_TEMPLATE_MUTATION = /* GraphQL */ `\n mutation CREATE_QUOTE_TEMPLATE_MUTATION($cartId: ID!) {\n requestNegotiableQuoteTemplateFromQuote(input: { cart_id: $cartId }) {\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 { events } from '@adobe-commerce/event-bus';\nimport { fetchGraphQl } from '@/quote-management/api/';\nimport { CREATE_QUOTE_TEMPLATE_MUTATION } from './graphql/createQuoteTemplate';\nimport { state } from '@/quote-management/lib/state';\nimport { transformQuoteTemplate } from '@/quote-management/data/transforms';\nimport { NegotiableQuoteTemplateModel } from '@/quote-management/data/models/negotiable-quote-template-model';\n\nexport const createQuoteTemplate = async (\n quoteId: string\n): Promise<NegotiableQuoteTemplateModel | null> => {\n if (!state.authenticated) {\n throw new Error('Unauthorized');\n }\n\n if (!quoteId) {\n throw new Error('Cart ID is required');\n }\n\n try {\n const results: any = await fetchGraphQl(CREATE_QUOTE_TEMPLATE_MUTATION, {\n variables: {\n cartId: quoteId,\n },\n });\n\n if (!results?.data?.requestNegotiableQuoteTemplateFromQuote) {\n throw new Error('Failed to create quote template');\n }\n\n const transformedQuoteTemplate = transformQuoteTemplate(\n results.data.requestNegotiableQuoteTemplateFromQuote\n );\n\n if (!transformedQuoteTemplate) {\n throw new Error('Failed to transform quote template data');\n }\n\n events.emit('quote-management/quote-template-data', {\n quoteTemplate: transformedQuoteTemplate,\n permissions: state.permissions,\n });\n\n return transformedQuoteTemplate;\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 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 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","/********************************************************************\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 SET_NEGOTIABLE_QUOTE_TEMPLATE_SHIPPING_ADDRESS_MUTATION = /* GraphQL */ `\n mutation SET_NEGOTIABLE_QUOTE_TEMPLATE_SHIPPING_ADDRESS_MUTATION(\n $templateId: ID!\n $shippingAddress: NegotiableQuoteTemplateShippingAddressInput!\n ) {\n setNegotiableQuoteTemplateShippingAddress(\n input: {\n template_id: $templateId\n shipping_address: $shippingAddress\n }\n ) {\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 { SET_NEGOTIABLE_QUOTE_TEMPLATE_SHIPPING_ADDRESS_MUTATION } from './graphql/setNegotiableQuoteTemplateShippingAddress';\nimport { transformQuoteTemplate } from '@/quote-management/data/transforms';\nimport { state } from '@/quote-management/lib/state';\nimport { events } from '@adobe-commerce/event-bus';\n\nexport interface NegotiableQuoteAddressInput {\n city: string;\n company?: string;\n countryCode: string;\n fax?: string;\n firstname: string;\n lastname: string;\n middlename?: string;\n postcode?: string;\n prefix?: string;\n region?: string;\n regionId?: number;\n saveInAddressBook?: boolean;\n street: string[];\n suffix?: string;\n telephone?: string;\n vatId?: string;\n}\n\nexport interface NegotiableQuoteTemplateShippingAddressInput {\n address?: NegotiableQuoteAddressInput;\n customerAddressUid?: string;\n customerNotes?: string;\n}\n\nexport interface AddQuoteTemplateShippingAddressParams {\n templateId: string;\n shippingAddress: NegotiableQuoteTemplateShippingAddressInput;\n}\n\nexport const addQuoteTemplateShippingAddress = async (\n params: AddQuoteTemplateShippingAddressParams\n) => {\n if (!params.templateId) {\n throw new Error('Template ID is required');\n }\n\n if (!params.shippingAddress) {\n throw new Error('Shipping address is required');\n }\n\n if (!state.authenticated) {\n throw new Error('Unauthorized');\n }\n\n // Validate that at least one of address or customerAddressUid is provided\n if (\n !params.shippingAddress.address &&\n !params.shippingAddress.customerAddressUid\n ) {\n throw new Error('Either address or customerAddressUid must be provided');\n }\n\n try {\n const results: any = await fetchGraphQl(\n SET_NEGOTIABLE_QUOTE_TEMPLATE_SHIPPING_ADDRESS_MUTATION,\n {\n variables: {\n templateId: params.templateId,\n shippingAddress: {\n address: params.shippingAddress.address\n ? {\n city: params.shippingAddress.address.city,\n company: params.shippingAddress.address.company,\n country_code: params.shippingAddress.address.countryCode,\n fax: params.shippingAddress.address.fax,\n firstname: params.shippingAddress.address.firstname,\n lastname: params.shippingAddress.address.lastname,\n middlename: params.shippingAddress.address.middlename,\n postcode: params.shippingAddress.address.postcode,\n prefix: params.shippingAddress.address.prefix,\n region: params.shippingAddress.address.region,\n region_id: params.shippingAddress.address.regionId,\n save_in_address_book:\n params.shippingAddress.address.saveInAddressBook,\n street: params.shippingAddress.address.street,\n suffix: params.shippingAddress.address.suffix,\n telephone: params.shippingAddress.address.telephone,\n vat_id: params.shippingAddress.address.vatId,\n }\n : undefined,\n customer_address_uid: params.shippingAddress.customerAddressUid,\n customer_notes: params.shippingAddress.customerNotes,\n },\n },\n }\n );\n\n if (!results?.data?.setNegotiableQuoteTemplateShippingAddress) {\n throw new Error('No quote template data received');\n }\n\n const transformedData = transformQuoteTemplate(\n results.data.setNegotiableQuoteTemplateShippingAddress\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 UPDATE_NEGOTIABLE_QUOTE_TEMPLATE_QUANTITIES_MUTATION = /* GraphQL */ `\n mutation UPDATE_NEGOTIABLE_QUOTE_TEMPLATE_QUANTITIES_MUTATION(\n $input: UpdateNegotiableQuoteTemplateQuantitiesInput!\n ) {\n updateNegotiableQuoteTemplateQuantities(input: $input) {\n quote_template {\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 { UPDATE_NEGOTIABLE_QUOTE_TEMPLATE_QUANTITIES_MUTATION } from './graphql/updateNegotiableQuoteTemplateQuantities';\nimport { transformQuoteTemplate } from '@/quote-management/data/transforms';\nimport { state } from '@/quote-management/lib/state';\nimport { events } from '@adobe-commerce/event-bus';\n\nexport interface NegotiableQuoteTemplateItemQuantityInput {\n itemId: string;\n quantity: number;\n minQty?: number;\n maxQty?: number;\n}\n\nexport interface UpdateQuoteTemplateItemQuantitiesParams {\n templateId: string;\n items: NegotiableQuoteTemplateItemQuantityInput[];\n}\n\nexport const updateQuoteTemplateItemQuantities = async (\n params: UpdateQuoteTemplateItemQuantitiesParams\n) => {\n if (!params.templateId) {\n throw new Error('Template ID is required');\n }\n\n if (!params.items || params.items.length === 0) {\n throw new Error('Items array is required and must not be empty');\n }\n\n if (!state.authenticated) {\n throw new Error('Unauthorized');\n }\n\n try {\n const results: any = await fetchGraphQl(\n UPDATE_NEGOTIABLE_QUOTE_TEMPLATE_QUANTITIES_MUTATION,\n {\n variables: {\n input: {\n template_id: params.templateId,\n items: params.items.map((item) => ({\n item_id: item.itemId,\n quantity: item.quantity,\n min_qty: item.minQty,\n max_qty: item.maxQty,\n })),\n },\n },\n }\n );\n\n if (\n !results?.data?.updateNegotiableQuoteTemplateQuantities?.quote_template\n ) {\n throw new Error('No quote template data received');\n }\n\n const transformedData = transformQuoteTemplate(\n results.data.updateNegotiableQuoteTemplateQuantities.quote_template\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 REMOVE_NEGOTIABLE_QUOTE_TEMPLATE_ITEMS_MUTATION = /* GraphQL */ `\n mutation REMOVE_NEGOTIABLE_QUOTE_TEMPLATE_ITEMS_MUTATION(\n $input: RemoveNegotiableQuoteTemplateItemsInput!\n ) {\n removeNegotiableQuoteTemplateItems(input: $input) {\n ...NegotiableQuoteTemplateFragment\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 { REMOVE_NEGOTIABLE_QUOTE_TEMPLATE_ITEMS_MUTATION } from './graphql/removeNegotiableQuoteTemplateItems';\nimport { transformQuoteTemplate } from '@/quote-management/data/transforms';\nimport { state } from '@/quote-management/lib/state';\nimport { events } from '@adobe-commerce/event-bus';\n\nexport interface RemoveQuoteTemplateItemsParams {\n templateId: string;\n itemUids: string[];\n}\n\nexport const removeQuoteTemplateItems = async (\n params: RemoveQuoteTemplateItemsParams\n) => {\n if (!params.templateId) {\n throw new Error('Template ID is required');\n }\n\n if (!params.itemUids || params.itemUids.length === 0) {\n throw new Error('Item UIDs array is required and must not be empty');\n }\n\n if (!state.authenticated) {\n throw new Error('Unauthorized');\n }\n\n try {\n const results: any = await fetchGraphQl(\n REMOVE_NEGOTIABLE_QUOTE_TEMPLATE_ITEMS_MUTATION,\n {\n variables: {\n input: {\n template_id: params.templateId,\n item_uids: params.itemUids,\n },\n },\n }\n );\n\n if (!results?.data?.removeNegotiableQuoteTemplateItems) {\n throw new Error('No quote template data received');\n }\n\n const transformedData = transformQuoteTemplate(\n results.data.removeNegotiableQuoteTemplateItems\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 SET_QUOTE_TEMPLATE_LINE_ITEM_NOTE_MUTATION = /* GraphQL */ `\n mutation SET_QUOTE_TEMPLATE_LINE_ITEM_NOTE_MUTATION(\n $input: QuoteTemplateLineItemNoteInput!\n ) {\n setQuoteTemplateLineItemNote(input: $input) {\n ...NegotiableQuoteTemplateFragment\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 { SET_QUOTE_TEMPLATE_LINE_ITEM_NOTE_MUTATION } from './graphql/setQuoteTemplateLineItemNote';\nimport { transformQuoteTemplate } from '@/quote-management/data/transforms';\nimport { state } from '@/quote-management/lib/state';\nimport { events } from '@adobe-commerce/event-bus';\n\nexport interface AddQuoteTemplateLineItemNoteParams {\n templateId: string;\n itemId: string;\n note?: string;\n}\n\nexport const addQuoteTemplateLineItemNote = async (\n params: AddQuoteTemplateLineItemNoteParams\n) => {\n if (!params.templateId) {\n throw new Error('Template ID is required');\n }\n\n if (!params.itemId) {\n throw new Error('Item 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 SET_QUOTE_TEMPLATE_LINE_ITEM_NOTE_MUTATION,\n {\n variables: {\n input: {\n templateId: params.templateId,\n item_id: params.itemId,\n note: params.note,\n },\n },\n }\n );\n\n if (!results?.data?.setQuoteTemplateLineItemNote) {\n throw new Error('No quote template data received');\n }\n\n const transformedData = transformQuoteTemplate(\n results.data.setQuoteTemplateLineItemNote\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 GENERATE_NEGOTIABLE_QUOTE_FROM_TEMPLATE_MUTATION = /* GraphQL */ `\n mutation GENERATE_NEGOTIABLE_QUOTE_FROM_TEMPLATE_MUTATION(\n $input: GenerateNegotiableQuoteFromTemplateInput!\n ) {\n generateNegotiableQuoteFromTemplate(input: $input) {\n negotiable_quote_uid\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 { GENERATE_NEGOTIABLE_QUOTE_FROM_TEMPLATE_MUTATION } from './graphql/generateNegotiableQuoteFromTemplate';\nimport { state } from '@/quote-management/lib/state';\nimport { events } from '@adobe-commerce/event-bus';\n\nexport interface GenerateQuoteFromTemplateParams {\n templateId: string;\n}\n\nexport const generateQuoteFromTemplate = async (\n params: GenerateQuoteFromTemplateParams\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 GENERATE_NEGOTIABLE_QUOTE_FROM_TEMPLATE_MUTATION,\n {\n variables: {\n input: {\n template_id: params.templateId,\n },\n },\n }\n );\n\n if (\n !results?.data?.generateNegotiableQuoteFromTemplate?.negotiable_quote_uid\n ) {\n throw new Error('No quote UID received');\n }\n\n const quoteId =\n results.data.generateNegotiableQuoteFromTemplate.negotiable_quote_uid;\n\n events.emit('quote-management/quote-template-generated', {\n quoteId,\n });\n\n return { quoteId };\n } catch (error) {\n return Promise.reject(error);\n }\n};\n"],"names":["mapAuthPermissions","payload","hasAllQuotePermissions","hasAllTemplatePermissions","hasManagePermission","initialize","Initializer","config","defaultConfig","getStoreConfig","state","error","DEFAULT_CONFIG","events","authenticated","DEFAULT_PERMISSIONS","permissions","quoteId","quoteTemplateId","getQuoteData","quote","getQuoteTemplateData","transformStoreConfig","data","transformQuoteDisplayAmountSetting","quoteDisplayAmountSetting","QuoteDisplayAmount","STORE_CONFIG_QUERY","fetchGraphQl","errors","errorMessage","e","SET_NEGOTIABLE_QUOTE_SHIPPING_ADDRESS_MUTATION","NEGOTIABLE_QUOTE_FRAGMENT","transformAddressToSnakeCase","address","additionalInput","standardFields","transformedStandardFields","setShippingAddress","input","quoteUid","addressId","addressData","transformedAddressData","response","errorMessages","quoteData","transformQuote","_b","_a","NEGOTIABLE_QUOTE_TEMPLATE_FRAGMENT","GET_QUOTE_TEMPLATE_DATA","templateId","results","transformedData","transformQuoteTemplate","CREATE_QUOTE_TEMPLATE_MUTATION","createQuoteTemplate","transformedQuoteTemplate","SEND_QUOTE_TEMPLATE_FOR_REVIEW_MUTATION","sendQuoteTemplateForReview","params","ACCEPT_QUOTE_TEMPLATE_MUTATION","acceptQuoteTemplate","CANCEL_QUOTE_TEMPLATE_MUTATION","cancelQuoteTemplate","DELETE_QUOTE_TEMPLATE_MUTATION","deleteQuoteTemplate","OPEN_QUOTE_TEMPLATE_MUTATION","openQuoteTemplate","SET_NEGOTIABLE_QUOTE_TEMPLATE_SHIPPING_ADDRESS_MUTATION","addQuoteTemplateShippingAddress","UPDATE_NEGOTIABLE_QUOTE_TEMPLATE_QUANTITIES_MUTATION","updateQuoteTemplateItemQuantities","item","REMOVE_NEGOTIABLE_QUOTE_TEMPLATE_ITEMS_MUTATION","removeQuoteTemplateItems","SET_QUOTE_TEMPLATE_LINE_ITEM_NOTE_MUTATION","addQuoteTemplateLineItemNote","GENERATE_NEGOTIABLE_QUOTE_FROM_TEMPLATE_MUTATION","generateQuoteFromTemplate"],"mappings":"20BA+CO,SAASA,EACdC,EACsB,CAEtB,GAAI,CAACA,GAAW,OAAOA,GAAY,SACjC,MAAO,CACL,aAAc,GACd,UAAW,GACX,YAAa,GACb,cAAe,GACf,mBAAoB,GACpB,qBAAsB,GACtB,0BAA2B,EAAA,EAK/B,GAAIA,EAAQ,MAAQ,GAClB,MAAO,CACL,aAAc,GACd,UAAW,GACX,YAAa,GACb,cAAe,GACf,mBAAoB,GACpB,qBAAsB,GACtB,0BAA2B,EAAA,EAK/B,MAAMC,EAAyBD,EAAQ,8BAA8B,IAAM,GACrEE,EAA4BF,EAAQ,sCAAsC,IAAM,GAGhFG,EACJF,GAA0BD,EAAQ,iCAAiC,IAAM,GAE3E,MAAO,CAEL,aAAcG,EACd,UAAWA,EACX,YAAaA,EAGb,cACEF,GAA0BD,EAAQ,mCAAmC,IAAM,GAG7E,mBACEE,GAA6BF,EAAQ,gDAAgD,IAAM,GAC7F,qBACEE,GAA6BF,EAAQ,yCAAyC,IAAM,GACtF,0BACEE,GAA6BF,EAAQ,iDAAiD,IAAM,EAAA,CAElG,CCxEO,MAAMI,EAAa,IAAIC,EAAyB,CACrD,KAAM,MAAOC,GAAW,CACtB,MAAMC,EAAgB,CAAA,EAGtBH,EAAW,OAAO,UAAU,CAAE,GAAGG,EAAe,GAAGD,EAAQ,EAG3D,MAAME,EAAA,EACH,KAAMF,G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,EAAiE;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,ECSjEC,GAA4B,MACvCnB,GACG,SACH,GAAI,CAACA,EAAO,WACV,MAAM,IAAI,MAAM,yBAAyB,EAG3C,GAAI,CAACpD,EAAM,cACT,MAAM,IAAI,MAAM,cAAc,EAGhC,GAAI,CACF,MAAM4C,EAAe,MAAM1B,EACzBoD,EACA,CACE,UAAW,CACT,MAAO,CACL,YAAalB,EAAO,UAAA,CACtB,CACF,CACF,EAGF,GACE,GAACb,GAAAC,EAAAI,GAAA,YAAAA,EAAS,OAAT,YAAAJ,EAAe,sCAAf,MAAAD,EAAoD,sBAErD,MAAM,IAAI,MAAM,uBAAuB,EAGzC,MAAMhC,EACJqC,EAAQ,KAAK,oCAAoC,qBAEnD,OAAAzC,EAAO,KAAK,4CAA6C,CACvD,QAAAI,CAAA,CACD,EAEM,CAAE,QAAAA,CAAA,CACX,OAASN,EAAO,CACd,OAAO,QAAQ,OAAOA,CAAK,CAC7B,CACF"}
|
|
1
|
+
{"version":3,"file":"api.js","sources":["/@dropins/storefront-quote-management/src/data/transforms/transform-store-config.ts","/@dropins/storefront-quote-management/src/utils/mapAuthPermissions.ts","/@dropins/storefront-quote-management/src/api/initialize/initialize.ts","/@dropins/storefront-quote-management/src/api/getStoreConfig/graphql/StoreConfigQuery.ts","/@dropins/storefront-quote-management/src/api/getStoreConfig/getStoreConfig.ts","/@dropins/storefront-quote-management/src/api/setShippingAddress/graphql/SetNegotiableQuoteShippingAddressMutation.ts","/@dropins/storefront-quote-management/src/api/setShippingAddress/setShippingAddress.ts","/@dropins/storefront-quote-management/src/api/graphql/NegotiableQuoteTemplateFragment.ts","/@dropins/storefront-quote-management/src/api/getQuoteTemplateData/graphql/getQuoteTemplateData.ts","/@dropins/storefront-quote-management/src/api/getQuoteTemplateData/getQuoteTemplateData.ts","/@dropins/storefront-quote-management/src/api/createQuoteTemplate/graphql/createQuoteTemplate.ts","/@dropins/storefront-quote-management/src/api/createQuoteTemplate/createQuoteTemplate.ts","/@dropins/storefront-quote-management/src/api/sendQuoteTemplateForReview/graphql/sendQuoteTemplateForReview.ts","/@dropins/storefront-quote-management/src/api/sendQuoteTemplateForReview/sendQuoteTemplateForReview.ts","/@dropins/storefront-quote-management/src/api/acceptQuoteTemplate/graphql/acceptQuoteTemplate.ts","/@dropins/storefront-quote-management/src/api/acceptQuoteTemplate/acceptQuoteTemplate.ts","/@dropins/storefront-quote-management/src/api/cancelQuoteTemplate/graphql/cancelQuoteTemplate.ts","/@dropins/storefront-quote-management/src/api/cancelQuoteTemplate/cancelQuoteTemplate.ts","/@dropins/storefront-quote-management/src/api/deleteQuoteTemplate/graphql/deleteQuoteTemplate.ts","/@dropins/storefront-quote-management/src/api/deleteQuoteTemplate/deleteQuoteTemplate.ts","/@dropins/storefront-quote-management/src/api/openQuoteTemplate/graphql/openQuoteTemplate.ts","/@dropins/storefront-quote-management/src/api/openQuoteTemplate/openQuoteTemplate.ts","/@dropins/storefront-quote-management/src/api/addQuoteTemplateShippingAddress/graphql/setNegotiableQuoteTemplateShippingAddress.ts","/@dropins/storefront-quote-management/src/api/addQuoteTemplateShippingAddress/addQuoteTemplateShippingAddress.ts","/@dropins/storefront-quote-management/src/api/updateQuoteTemplateItemQuantities/graphql/updateNegotiableQuoteTemplateQuantities.ts","/@dropins/storefront-quote-management/src/api/updateQuoteTemplateItemQuantities/updateQuoteTemplateItemQuantities.ts","/@dropins/storefront-quote-management/src/api/removeQuoteTemplateItems/graphql/removeNegotiableQuoteTemplateItems.ts","/@dropins/storefront-quote-management/src/api/removeQuoteTemplateItems/removeQuoteTemplateItems.ts","/@dropins/storefront-quote-management/src/api/addQuoteTemplateLineItemNote/graphql/setQuoteTemplateLineItemNote.ts","/@dropins/storefront-quote-management/src/api/addQuoteTemplateLineItemNote/addQuoteTemplateLineItemNote.ts","/@dropins/storefront-quote-management/src/api/generateQuoteFromTemplate/graphql/generateNegotiableQuoteFromTemplate.ts","/@dropins/storefront-quote-management/src/api/generateQuoteFromTemplate/generateQuoteFromTemplate.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 QuoteDisplayAmount,\n StoreConfigModel,\n} from '@/quote-management/data/models';\nimport { DEFAULT_CONFIG } from '@/quote-management/lib/state';\n\nexport function transformStoreConfig(data: any): StoreConfigModel {\n if (!data) return DEFAULT_CONFIG;\n\n const transformQuoteDisplayAmountSetting = (\n quoteDisplayAmountSetting: number\n ) => {\n if (\n [\n QuoteDisplayAmount.TAX_EXCLUDED,\n QuoteDisplayAmount.TAX_INCLUDED,\n QuoteDisplayAmount.TAX_INCLUDED_AND_EXCLUDED,\n ].includes(quoteDisplayAmountSetting)\n ) {\n return quoteDisplayAmountSetting;\n }\n\n return QuoteDisplayAmount.TAX_EXCLUDED;\n };\n\n return {\n quoteSummaryDisplayTotal: data.cart_summary_display_quantity,\n quoteSummaryMaxItems: data.max_items_in_order_summary,\n quoteDisplaySettings: {\n zeroTax: data.shopping_cart_display_zero_tax,\n subtotal: transformQuoteDisplayAmountSetting(\n data.shopping_cart_display_subtotal\n ),\n price: transformQuoteDisplayAmountSetting(\n data.shopping_cart_display_price\n ),\n shipping: transformQuoteDisplayAmountSetting(\n data.shopping_cart_display_shipping\n ),\n fullSummary: data.shopping_cart_display_full_summary,\n grandTotal: data.shopping_cart_display_grand_total,\n },\n useConfigurableParentThumbnail:\n data.configurable_thumbnail_source === 'parent',\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 { State } from '@/quote-management/types/state.types';\n\n/**\n * Type definition for the auth/permissions event payload\n * Contains flat Adobe Commerce permission keys with boolean values\n */\nexport type AuthPermissionsPayload = {\n all?: boolean;\n 'Magento_NegotiableQuote::all'?: boolean;\n 'Magento_NegotiableQuote::manage'?: boolean;\n 'Magento_NegotiableQuote::checkout'?: boolean;\n 'Magento_NegotiableQuoteTemplate::all'?: boolean;\n 'Magento_NegotiableQuoteTemplate::view_template'?: boolean;\n 'Magento_NegotiableQuoteTemplate::manage'?: boolean;\n 'Magento_NegotiableQuoteTemplate::generate_quote'?: boolean;\n [key: string]: boolean | undefined;\n};\n\n/**\n * Maps the auth/permissions event payload to internal permissions structure.\n * \n * Implements hierarchical permission checking:\n * 1. Top-level \"all\": If true, grants all permissions\n * 2. Module-level \"::all\": Grants all permissions for that module\n * 3. Specific permissions: Maps individual keys to internal flags\n * \n * @param payload - The raw auth/permissions event payload\n * @returns Typed permissions object matching the state structure\n * \n * @example\n * ```typescript\n * const permissions = mapAuthPermissions({\n * \"Magento_NegotiableQuote::manage\": true,\n * \"Magento_NegotiableQuote::checkout\": true\n * });\n * // Returns: { requestQuote: true, editQuote: true, deleteQuote: true, checkoutQuote: true, ... }\n * ```\n */\nexport function mapAuthPermissions(\n payload: AuthPermissionsPayload | null | undefined\n): State['permissions'] {\n // Handle null/undefined payload - return all false\n if (!payload || typeof payload !== 'object') {\n return {\n requestQuote: false,\n editQuote: false,\n deleteQuote: false,\n checkoutQuote: false,\n viewQuoteTemplates: false,\n manageQuoteTemplates: false,\n generateQuoteFromTemplate: false,\n };\n }\n\n // If top-level \"all\" is true, grant all permissions\n if (payload.all === true) {\n return {\n requestQuote: true,\n editQuote: true,\n deleteQuote: true,\n checkoutQuote: true,\n viewQuoteTemplates: true,\n manageQuoteTemplates: true,\n generateQuoteFromTemplate: true,\n };\n }\n\n // Check module-level \"all\" permissions\n const hasAllQuotePermissions = payload['Magento_NegotiableQuote::all'] === true;\n const hasAllTemplatePermissions = payload['Magento_NegotiableQuoteTemplate::all'] === true;\n\n // Map specific permissions with fallback to module-level \"all\"\n const hasManagePermission = \n hasAllQuotePermissions || payload['Magento_NegotiableQuote::manage'] === true;\n\n return {\n // Magento_NegotiableQuote::manage maps to request, edit, and delete\n requestQuote: hasManagePermission,\n editQuote: hasManagePermission,\n deleteQuote: hasManagePermission,\n \n // Magento_NegotiableQuote::checkout maps to checkoutQuote\n checkoutQuote: \n hasAllQuotePermissions || payload['Magento_NegotiableQuote::checkout'] === true,\n \n // Template permissions\n viewQuoteTemplates: \n hasAllTemplatePermissions || payload['Magento_NegotiableQuoteTemplate::view_template'] === true,\n manageQuoteTemplates: \n hasAllTemplatePermissions || payload['Magento_NegotiableQuoteTemplate::manage'] === true,\n generateQuoteFromTemplate: \n hasAllTemplatePermissions || payload['Magento_NegotiableQuoteTemplate::generate_quote'] === true,\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 { Initializer } from '@adobe-commerce/elsie/lib';\nimport { Lang } from '@adobe-commerce/elsie/i18n';\nimport { events } from '@adobe-commerce/event-bus';\nimport {\n state,\n DEFAULT_CONFIG,\n DEFAULT_PERMISSIONS,\n} from '@/quote-management/lib/state';\nimport { getQuoteData } from '@/quote-management/api/getQuoteData';\nimport { getStoreConfig } from '@/quote-management/api';\nimport { mapAuthPermissions, AuthPermissionsPayload } from '@/quote-management/utils/mapAuthPermissions';\n\ntype ConfigProps = {\n langDefinitions?: Lang;\n quoteId?: string;\n};\n\nexport const initialize = new Initializer<ConfigProps>({\n init: async (config) => {\n const defaultConfig = {};\n\n // Set config\n initialize.config.setConfig({ ...defaultConfig, ...config });\n\n // Fetch store config\n await getStoreConfig()\n .then((config) => {\n state.config = config;\n })\n .catch((error) => {\n console.error('Failed to fetch store config: ', error);\n state.config = DEFAULT_CONFIG;\n });\n },\n\n listeners: () => [\n events.on(\n 'authenticated',\n async (authenticated) => {\n state.authenticated = !!authenticated;\n\n // Defensive: reset permissions if user logs out\n // This ensures permissions are cleared even if auth/permissions event doesn't fire\n if (!authenticated) {\n state.permissions = DEFAULT_PERMISSIONS;\n events.emit('quote-management/permissions', DEFAULT_PERMISSIONS);\n }\n },\n {\n eager: true,\n }\n ),\n events.on('auth/permissions', async (payload: AuthPermissionsPayload) => {\n // Map the auth permissions payload to internal permissions structure\n const permissions = mapAuthPermissions(payload);\n \n state.permissions = permissions;\n events.emit('quote-management/permissions', state.permissions);\n }, {\n eager: true,\n }),\n\n events.on(\n 'quote-management/permissions',\n async (permissions) => {\n const quoteId = initialize.config.getConfig().quoteId;\n if (!quoteId) {\n return;\n }\n\n if (permissions.editQuote) {\n getQuoteData(quoteId)\n .then((quoteData) => {\n events.emit(\n 'quote-management/quote-data/initialized',\n {\n quote: quoteData,\n permissions,\n },\n {}\n );\n })\n .catch((error) => {\n events.emit('quote-management/quote-data/error', {\n error,\n });\n });\n }\n },\n {\n eager: true,\n }\n ),\n ],\n});\n\nexport const config = initialize.config;\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 STORE_CONFIG_QUERY = /* GraphQL */ `\n query STORE_CONFIG_QUERY {\n storeConfig {\n cart_summary_display_quantity\n max_items_in_order_summary\n shopping_cart_display_full_summary\n shopping_cart_display_grand_total\n shopping_cart_display_price\n shopping_cart_display_shipping\n shopping_cart_display_subtotal\n shopping_cart_display_zero_tax\n configurable_thumbnail_source\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 { StoreConfigModel } from '@/quote-management/data/models';\nimport { transformStoreConfig } from '@/quote-management/data/transforms';\nimport { STORE_CONFIG_QUERY } from './graphql/StoreConfigQuery';\n\nexport const getStoreConfig = async (): Promise<StoreConfigModel> => {\n return fetchGraphQl(STORE_CONFIG_QUERY, {\n method: 'GET',\n cache: 'force-cache',\n }).then(({ errors, data }) => {\n if (errors) {\n const errorMessage = errors.map((e: any) => e.message).join(', ');\n throw new Error(`Failed to get store config: ${errorMessage}`);\n }\n\n return transformStoreConfig(data.storeConfig);\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_FRAGMENT } from '@/quote-management/api/graphql/NegotiableQuoteFragment';\n\nexport const SET_NEGOTIABLE_QUOTE_SHIPPING_ADDRESS_MUTATION = `\n mutation SET_NEGOTIABLE_QUOTE_SHIPPING_ADDRESS_MUTATION(\n $quoteUid: ID!\n $addressId: ID\n $addressData: NegotiableQuoteAddressInput\n ) {\n setNegotiableQuoteShippingAddress(\n input: {\n quote_uid: $quoteUid\n shipping_addresses: {\n customer_address_uid: $addressId\n address: $addressData\n }\n }\n ) {\n quote {\n ...NegotiableQuoteFragment\n }\n }\n }\n ${NEGOTIABLE_QUOTE_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 { events } from '@adobe-commerce/event-bus';\nimport { SET_NEGOTIABLE_QUOTE_SHIPPING_ADDRESS_MUTATION } from './graphql/SetNegotiableQuoteShippingAddressMutation';\nimport { NegotiableQuoteModel } from '@/quote-management/data/models/negotiable-quote-model';\nimport { transformQuote } from '@/quote-management/data/transforms';\n\nexport interface AddressInput {\n /** City name */\n city: string;\n /** Optional company name */\n company?: string;\n /** Two-letter country code (e.g., 'US') */\n countryCode: string;\n /** First name */\n firstname: string;\n /** Last name */\n lastname: string;\n /** Postal/ZIP code */\n postcode: string;\n /** Optional state/province name */\n region?: string;\n /** Optional state/province ID */\n regionId?: number;\n /** Whether to save this address to the customer's address book */\n saveInAddressBook?: boolean;\n /** Street address lines (array) */\n street: string[];\n /** Phone number */\n telephone: string;\n /** \n * Additional input (optional custom fields for the address).\n * These fields will be merged into the address data sent to GraphQL.\n * Standard fields take precedence over additional fields to prevent\n * accidental override of required address attributes.\n * \n * @example\n * ```ts\n * additionalInput: {\n * vat_id: 'GB123456789',\n * custom_attribute: 'value',\n * delivery_instructions: 'Leave at door'\n * }\n * ```\n */\n additionalInput?: Record<string, any>;\n}\n\nexport interface SetShippingAddressInput {\n /** The unique ID of the negotiable quote */\n quoteUid: string;\n /** The ID of a saved customer address (use this OR addressData, not both) */\n addressId?: number;\n /** New address data (use this OR addressId, not both) */\n addressData?: AddressInput;\n}\n\n/**\n * Transform camelCase address data to snake_case for GraphQL mutation.\n * Additional fields from additionalInput are spread into the result, with\n * standard fields taking precedence (defensive flexibility approach).\n */\nfunction transformAddressToSnakeCase(address: AddressInput) {\n const { additionalInput, ...standardFields } = address;\n \n // Build the standard transformed fields\n const transformedStandardFields = {\n city: standardFields.city,\n company: standardFields.company,\n country_code: standardFields.countryCode,\n firstname: standardFields.firstname,\n lastname: standardFields.lastname,\n postcode: standardFields.postcode,\n region: standardFields.region,\n region_id: standardFields.regionId,\n save_in_address_book: standardFields.saveInAddressBook,\n street: standardFields.street,\n telephone: standardFields.telephone,\n };\n \n // Spread additional input first, then standard fields take precedence\n // This provides defensive flexibility: allows custom fields while protecting core fields\n return {\n ...(additionalInput || {}),\n ...transformedStandardFields,\n };\n}\n\n/**\n * Sets or updates the shipping address for a negotiable quote.\n * \n * @param input - The input parameters for setting the shipping address\n * @param input.quoteUid - The unique ID of the negotiable quote\n * @param input.addressId - Optional ID of a saved customer address (use this OR addressData)\n * @param input.addressData - Optional new address data (use this OR addressId)\n * @param input.addressData.additionalInput - Optional additional address fields to pass through to GraphQL\n * @returns Promise that resolves to the updated quote model with shipping addresses including uid field\n * @throws Error if validation fails or GraphQL operation fails\n * \n * @example\n * ```ts\n * // Using a saved address\n * const quote = await setShippingAddress({\n * quoteUid: 'quote-123',\n * addressId: 5\n * });\n * \n * // Using new address data\n * const quote = await setShippingAddress({\n * quoteUid: 'quote-123',\n * addressData: {\n * firstname: 'John',\n * lastname: 'Doe',\n * street: ['123 Main St'],\n * city: 'San Francisco',\n * countryCode: 'US',\n * postcode: '94103',\n * telephone: '555-1234'\n * }\n * });\n * \n * // Using address data with additional custom fields\n * const quote = await setShippingAddress({\n * quoteUid: 'quote-123',\n * addressData: {\n * firstname: 'John',\n * lastname: 'Doe',\n * street: ['123 Main St'],\n * city: 'San Francisco',\n * countryCode: 'US',\n * postcode: '94103',\n * telephone: '555-1234',\n * additionalInput: {\n * vat_id: 'GB123456789',\n * custom_attribute_1: 'value1',\n * delivery_instructions: 'Leave at door'\n * }\n * }\n * });\n * \n * // Access address identifier\n * if (quote?.shippingAddresses?.[0]) {\n * console.log('Address UID:', quote.shippingAddresses[0].uid);\n * }\n * ```\n */\nexport const setShippingAddress = async (\n input: SetShippingAddressInput\n): Promise<NegotiableQuoteModel | null> => {\n const { quoteUid, addressId, addressData } = input;\n\n if (!quoteUid) {\n throw new Error('Quote UID is required');\n }\n\n // Validate that exactly one of addressId or addressData is provided\n if (addressId === undefined && !addressData) {\n throw new Error('Either addressId or addressData must be provided');\n }\n\n if (addressId !== undefined && addressData) {\n throw new Error('Cannot provide both addressId and addressData');\n }\n\n // Transform addressData to snake_case if provided\n const transformedAddressData = addressData\n ? transformAddressToSnakeCase(addressData)\n : null;\n\n return fetchGraphQl(SET_NEGOTIABLE_QUOTE_SHIPPING_ADDRESS_MUTATION, {\n variables: {\n quoteUid,\n addressId: addressId || null,\n addressData: transformedAddressData,\n },\n }).then((response) => {\n const { errors } = response;\n\n if (errors) {\n // Provide more detailed error information\n const errorMessages = errors.map((error) => error.message).join('; ');\n throw new Error(`Failed to set shipping address: ${errorMessages}`);\n }\n\n // Transform the quote data\n const quoteData = transformQuote(\n response.data?.setNegotiableQuoteShippingAddress?.quote\n );\n\n if (!quoteData) {\n throw new Error(\n 'Failed to transform quote data: Invalid response structure'\n );\n }\n\n // Emit event with transformed quote data on success\n events.emit('quote-management/shipping-address-set', {\n quote: quoteData,\n input: { quoteUid, addressId, addressData },\n });\n\n return quoteData;\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\nexport const NEGOTIABLE_QUOTE_TEMPLATE_FRAGMENT = /* GraphQL */ `\n fragment NegotiableQuoteTemplateFragment on NegotiableQuoteTemplate {\n # uid\n name\n # created_at\n # updated_at\n status\n # sales_rep_name\n expiration_date\n buyer {\n firstname\n lastname\n }\n comments {\n uid\n created_at\n author {\n firstname\n lastname\n }\n text\n attachments {\n name\n url\n }\n }\n items {\n uid\n product {\n name\n sku\n uid\n stock_status\n }\n prices {\n price {\n currency\n value\n }\n original_item_price {\n currency\n value\n }\n row_total {\n currency\n value\n }\n catalog_discount {\n amount_off\n percent_off\n }\n discounts {\n label\n value\n amount {\n currency\n value\n }\n }\n }\n quantity\n note_from_buyer {\n created_at\n creator_id\n creator_type\n # negotiable_quote_template_item_uid\n note\n note_uid\n }\n note_from_seller {\n created_at\n creator_id\n creator_type\n # negotiable_quote_template_item_uid\n note\n note_uid\n }\n ... on ConfigurableCartItem {\n configurable_options {\n option_label\n value_label\n }\n }\n ... on BundleCartItem {\n bundle_options {\n label\n values {\n label\n quantity\n original_price {\n currency\n value\n }\n priceV2 {\n currency\n value\n }\n }\n }\n }\n }\n history {\n uid\n created_at\n author {\n firstname\n lastname\n }\n change_type\n changes {\n comment_added {\n comment\n }\n custom_changes {\n new_value\n old_value\n title\n }\n statuses {\n changes {\n new_status\n old_status\n }\n }\n expiration {\n new_expiration\n old_expiration\n }\n total {\n new_price {\n currency\n value\n }\n old_price {\n currency\n value\n }\n }\n }\n }\n prices {\n subtotal_excluding_tax {\n currency\n value\n }\n subtotal_including_tax {\n currency\n value\n }\n subtotal_with_discount_excluding_tax {\n currency\n value\n }\n applied_taxes {\n amount {\n currency\n value\n }\n label\n }\n grand_total {\n currency\n value\n }\n }\n shipping_addresses {\n uid\n firstname\n lastname\n company\n street\n city\n region {\n code\n label\n region_id\n }\n postcode\n country {\n code\n label\n }\n telephone\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 { NEGOTIABLE_QUOTE_TEMPLATE_FRAGMENT } from '@/quote-management/api/graphql/NegotiableQuoteTemplateFragment';\n\nexport const GET_QUOTE_TEMPLATE_DATA = /* GraphQL */ `\n query QUOTE_TEMPLATE_DATA_QUERY($templateId: ID!) {\n negotiableQuoteTemplate(templateId: $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 { GET_QUOTE_TEMPLATE_DATA } from './graphql/getQuoteTemplateData';\nimport { transformQuoteTemplate } from '@/quote-management/data/transforms';\nimport { NegotiableQuoteTemplateModel } 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 const getQuoteTemplateData = async (templateId: string): Promise<NegotiableQuoteTemplateModel | null> => {\n\n if (!state.authenticated) {\n throw new Error('Unauthorized');\n }\n\n if (!templateId) {\n throw new Error('Template ID is required');\n }\n\n try {\n const results: any = await fetchGraphQl(GET_QUOTE_TEMPLATE_DATA, {\n variables: { templateId },\n });\n\n\n if (!results?.data?.negotiableQuoteTemplate) {\n throw new Error('Quote template not found');\n }\n\n const transformedData = transformQuoteTemplate(results.data.negotiableQuoteTemplate);\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 \"../../graphql/NegotiableQuoteTemplateFragment\";\n\nexport const CREATE_QUOTE_TEMPLATE_MUTATION = /* GraphQL */ `\n mutation CREATE_QUOTE_TEMPLATE_MUTATION($cartId: ID!) {\n requestNegotiableQuoteTemplateFromQuote(input: { cart_id: $cartId }) {\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 { events } from '@adobe-commerce/event-bus';\nimport { fetchGraphQl } from '@/quote-management/api/';\nimport { CREATE_QUOTE_TEMPLATE_MUTATION } from './graphql/createQuoteTemplate';\nimport { state } from '@/quote-management/lib/state';\nimport { transformQuoteTemplate } from '@/quote-management/data/transforms';\nimport { NegotiableQuoteTemplateModel } from '@/quote-management/data/models/negotiable-quote-template-model';\n\nexport const createQuoteTemplate = async (\n quoteId: string\n): Promise<NegotiableQuoteTemplateModel | null> => {\n if (!state.authenticated) {\n throw new Error('Unauthorized');\n }\n\n if (!quoteId) {\n throw new Error('Cart ID is required');\n }\n\n try {\n const results: any = await fetchGraphQl(CREATE_QUOTE_TEMPLATE_MUTATION, {\n variables: {\n cartId: quoteId,\n },\n });\n\n if (!results?.data?.requestNegotiableQuoteTemplateFromQuote) {\n throw new Error('Failed to create quote template');\n }\n\n const transformedQuoteTemplate = transformQuoteTemplate(\n results.data.requestNegotiableQuoteTemplateFromQuote\n );\n\n if (!transformedQuoteTemplate) {\n throw new Error('Failed to transform quote template data');\n }\n\n events.emit('quote-management/quote-template-data', {\n quoteTemplate: transformedQuoteTemplate,\n permissions: state.permissions,\n });\n\n return transformedQuoteTemplate;\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 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 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","/********************************************************************\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 SET_NEGOTIABLE_QUOTE_TEMPLATE_SHIPPING_ADDRESS_MUTATION = /* GraphQL */ `\n mutation SET_NEGOTIABLE_QUOTE_TEMPLATE_SHIPPING_ADDRESS_MUTATION(\n $templateId: ID!\n $shippingAddress: NegotiableQuoteTemplateShippingAddressInput!\n ) {\n setNegotiableQuoteTemplateShippingAddress(\n input: {\n template_id: $templateId\n shipping_address: $shippingAddress\n }\n ) {\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 { SET_NEGOTIABLE_QUOTE_TEMPLATE_SHIPPING_ADDRESS_MUTATION } from './graphql/setNegotiableQuoteTemplateShippingAddress';\nimport { transformQuoteTemplate } from '@/quote-management/data/transforms';\nimport { state } from '@/quote-management/lib/state';\nimport { events } from '@adobe-commerce/event-bus';\n\nexport interface NegotiableQuoteAddressInput {\n city: string;\n company?: string;\n countryCode: string;\n fax?: string;\n firstname: string;\n lastname: string;\n middlename?: string;\n postcode?: string;\n prefix?: string;\n region?: string;\n regionId?: number;\n saveInAddressBook?: boolean;\n street: string[];\n suffix?: string;\n telephone?: string;\n vatId?: string;\n}\n\nexport interface NegotiableQuoteTemplateShippingAddressInput {\n address?: NegotiableQuoteAddressInput;\n customerAddressUid?: string;\n customerNotes?: string;\n}\n\nexport interface AddQuoteTemplateShippingAddressParams {\n templateId: string;\n shippingAddress: NegotiableQuoteTemplateShippingAddressInput;\n}\n\nexport const addQuoteTemplateShippingAddress = async (\n params: AddQuoteTemplateShippingAddressParams\n) => {\n if (!params.templateId) {\n throw new Error('Template ID is required');\n }\n\n if (!params.shippingAddress) {\n throw new Error('Shipping address is required');\n }\n\n if (!state.authenticated) {\n throw new Error('Unauthorized');\n }\n\n // Validate that at least one of address or customerAddressUid is provided\n if (\n !params.shippingAddress.address &&\n !params.shippingAddress.customerAddressUid\n ) {\n throw new Error('Either address or customerAddressUid must be provided');\n }\n\n try {\n const results: any = await fetchGraphQl(\n SET_NEGOTIABLE_QUOTE_TEMPLATE_SHIPPING_ADDRESS_MUTATION,\n {\n variables: {\n templateId: params.templateId,\n shippingAddress: {\n address: params.shippingAddress.address\n ? {\n city: params.shippingAddress.address.city,\n company: params.shippingAddress.address.company,\n country_code: params.shippingAddress.address.countryCode,\n fax: params.shippingAddress.address.fax,\n firstname: params.shippingAddress.address.firstname,\n lastname: params.shippingAddress.address.lastname,\n middlename: params.shippingAddress.address.middlename,\n postcode: params.shippingAddress.address.postcode,\n prefix: params.shippingAddress.address.prefix,\n region: params.shippingAddress.address.region,\n region_id: params.shippingAddress.address.regionId,\n save_in_address_book:\n params.shippingAddress.address.saveInAddressBook,\n street: params.shippingAddress.address.street,\n suffix: params.shippingAddress.address.suffix,\n telephone: params.shippingAddress.address.telephone,\n vat_id: params.shippingAddress.address.vatId,\n }\n : undefined,\n customer_address_uid: params.shippingAddress.customerAddressUid,\n customer_notes: params.shippingAddress.customerNotes,\n },\n },\n }\n );\n\n if (!results?.data?.setNegotiableQuoteTemplateShippingAddress) {\n throw new Error('No quote template data received');\n }\n\n const transformedData = transformQuoteTemplate(\n results.data.setNegotiableQuoteTemplateShippingAddress\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 UPDATE_NEGOTIABLE_QUOTE_TEMPLATE_QUANTITIES_MUTATION = /* GraphQL */ `\n mutation UPDATE_NEGOTIABLE_QUOTE_TEMPLATE_QUANTITIES_MUTATION(\n $input: UpdateNegotiableQuoteTemplateQuantitiesInput!\n ) {\n updateNegotiableQuoteTemplateQuantities(input: $input) {\n quote_template {\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 { UPDATE_NEGOTIABLE_QUOTE_TEMPLATE_QUANTITIES_MUTATION } from './graphql/updateNegotiableQuoteTemplateQuantities';\nimport { transformQuoteTemplate } from '@/quote-management/data/transforms';\nimport { state } from '@/quote-management/lib/state';\nimport { events } from '@adobe-commerce/event-bus';\n\nexport interface NegotiableQuoteTemplateItemQuantityInput {\n itemId: string;\n quantity: number;\n minQty?: number;\n maxQty?: number;\n}\n\nexport interface UpdateQuoteTemplateItemQuantitiesParams {\n templateId: string;\n items: NegotiableQuoteTemplateItemQuantityInput[];\n}\n\nexport const updateQuoteTemplateItemQuantities = async (\n params: UpdateQuoteTemplateItemQuantitiesParams\n) => {\n if (!params.templateId) {\n throw new Error('Template ID is required');\n }\n\n if (!params.items || params.items.length === 0) {\n throw new Error('Items array is required and must not be empty');\n }\n\n if (!state.authenticated) {\n throw new Error('Unauthorized');\n }\n\n try {\n const results: any = await fetchGraphQl(\n UPDATE_NEGOTIABLE_QUOTE_TEMPLATE_QUANTITIES_MUTATION,\n {\n variables: {\n input: {\n template_id: params.templateId,\n items: params.items.map((item) => ({\n item_id: item.itemId,\n quantity: item.quantity,\n min_qty: item.minQty,\n max_qty: item.maxQty,\n })),\n },\n },\n }\n );\n\n if (\n !results?.data?.updateNegotiableQuoteTemplateQuantities?.quote_template\n ) {\n throw new Error('No quote template data received');\n }\n\n const transformedData = transformQuoteTemplate(\n results.data.updateNegotiableQuoteTemplateQuantities.quote_template\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 REMOVE_NEGOTIABLE_QUOTE_TEMPLATE_ITEMS_MUTATION = /* GraphQL */ `\n mutation REMOVE_NEGOTIABLE_QUOTE_TEMPLATE_ITEMS_MUTATION(\n $input: RemoveNegotiableQuoteTemplateItemsInput!\n ) {\n removeNegotiableQuoteTemplateItems(input: $input) {\n ...NegotiableQuoteTemplateFragment\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 { REMOVE_NEGOTIABLE_QUOTE_TEMPLATE_ITEMS_MUTATION } from './graphql/removeNegotiableQuoteTemplateItems';\nimport { transformQuoteTemplate } from '@/quote-management/data/transforms';\nimport { state } from '@/quote-management/lib/state';\nimport { events } from '@adobe-commerce/event-bus';\n\nexport interface RemoveQuoteTemplateItemsParams {\n templateId: string;\n itemUids: string[];\n}\n\nexport const removeQuoteTemplateItems = async (\n params: RemoveQuoteTemplateItemsParams\n) => {\n if (!params.templateId) {\n throw new Error('Template ID is required');\n }\n\n if (!params.itemUids || params.itemUids.length === 0) {\n throw new Error('Item UIDs array is required and must not be empty');\n }\n\n if (!state.authenticated) {\n throw new Error('Unauthorized');\n }\n\n try {\n const results: any = await fetchGraphQl(\n REMOVE_NEGOTIABLE_QUOTE_TEMPLATE_ITEMS_MUTATION,\n {\n variables: {\n input: {\n template_id: params.templateId,\n item_uids: params.itemUids,\n },\n },\n }\n );\n\n if (!results?.data?.removeNegotiableQuoteTemplateItems) {\n throw new Error('No quote template data received');\n }\n\n const transformedData = transformQuoteTemplate(\n results.data.removeNegotiableQuoteTemplateItems\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 SET_QUOTE_TEMPLATE_LINE_ITEM_NOTE_MUTATION = /* GraphQL */ `\n mutation SET_QUOTE_TEMPLATE_LINE_ITEM_NOTE_MUTATION(\n $input: QuoteTemplateLineItemNoteInput!\n ) {\n setQuoteTemplateLineItemNote(input: $input) {\n ...NegotiableQuoteTemplateFragment\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 { SET_QUOTE_TEMPLATE_LINE_ITEM_NOTE_MUTATION } from './graphql/setQuoteTemplateLineItemNote';\nimport { transformQuoteTemplate } from '@/quote-management/data/transforms';\nimport { state } from '@/quote-management/lib/state';\nimport { events } from '@adobe-commerce/event-bus';\n\nexport interface AddQuoteTemplateLineItemNoteParams {\n templateId: string;\n itemId: string;\n note?: string;\n}\n\nexport const addQuoteTemplateLineItemNote = async (\n params: AddQuoteTemplateLineItemNoteParams\n) => {\n if (!params.templateId) {\n throw new Error('Template ID is required');\n }\n\n if (!params.itemId) {\n throw new Error('Item 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 SET_QUOTE_TEMPLATE_LINE_ITEM_NOTE_MUTATION,\n {\n variables: {\n input: {\n templateId: params.templateId,\n item_id: params.itemId,\n note: params.note,\n },\n },\n }\n );\n\n if (!results?.data?.setQuoteTemplateLineItemNote) {\n throw new Error('No quote template data received');\n }\n\n const transformedData = transformQuoteTemplate(\n results.data.setQuoteTemplateLineItemNote\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 GENERATE_NEGOTIABLE_QUOTE_FROM_TEMPLATE_MUTATION = /* GraphQL */ `\n mutation GENERATE_NEGOTIABLE_QUOTE_FROM_TEMPLATE_MUTATION(\n $input: GenerateNegotiableQuoteFromTemplateInput!\n ) {\n generateNegotiableQuoteFromTemplate(input: $input) {\n negotiable_quote_uid\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 { GENERATE_NEGOTIABLE_QUOTE_FROM_TEMPLATE_MUTATION } from './graphql/generateNegotiableQuoteFromTemplate';\nimport { state } from '@/quote-management/lib/state';\nimport { events } from '@adobe-commerce/event-bus';\n\nexport interface GenerateQuoteFromTemplateParams {\n templateId: string;\n}\n\nexport const generateQuoteFromTemplate = async (\n params: GenerateQuoteFromTemplateParams\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 GENERATE_NEGOTIABLE_QUOTE_FROM_TEMPLATE_MUTATION,\n {\n variables: {\n input: {\n template_id: params.templateId,\n },\n },\n }\n );\n\n if (\n !results?.data?.generateNegotiableQuoteFromTemplate?.negotiable_quote_uid\n ) {\n throw new Error('No quote UID received');\n }\n\n const quoteId =\n results.data.generateNegotiableQuoteFromTemplate.negotiable_quote_uid;\n\n events.emit('quote-management/quote-template-generated', {\n quoteId,\n });\n\n return { quoteId };\n } catch (error) {\n return Promise.reject(error);\n }\n};\n"],"names":["transformStoreConfig","data","DEFAULT_CONFIG","transformQuoteDisplayAmountSetting","quoteDisplayAmountSetting","QuoteDisplayAmount","mapAuthPermissions","payload","hasAllQuotePermissions","hasAllTemplatePermissions","hasManagePermission","initialize","Initializer","config","defaultConfig","getStoreConfig","state","error","events","authenticated","DEFAULT_PERMISSIONS","permissions","quoteId","getQuoteData","quoteData","STORE_CONFIG_QUERY","fetchGraphQl","errors","errorMessage","e","SET_NEGOTIABLE_QUOTE_SHIPPING_ADDRESS_MUTATION","NEGOTIABLE_QUOTE_FRAGMENT","transformAddressToSnakeCase","address","additionalInput","standardFields","transformedStandardFields","setShippingAddress","input","quoteUid","addressId","addressData","transformedAddressData","response","errorMessages","transformQuote","_b","_a","NEGOTIABLE_QUOTE_TEMPLATE_FRAGMENT","GET_QUOTE_TEMPLATE_DATA","getQuoteTemplateData","templateId","results","transformedData","transformQuoteTemplate","CREATE_QUOTE_TEMPLATE_MUTATION","createQuoteTemplate","transformedQuoteTemplate","SEND_QUOTE_TEMPLATE_FOR_REVIEW_MUTATION","sendQuoteTemplateForReview","params","ACCEPT_QUOTE_TEMPLATE_MUTATION","acceptQuoteTemplate","CANCEL_QUOTE_TEMPLATE_MUTATION","cancelQuoteTemplate","DELETE_QUOTE_TEMPLATE_MUTATION","deleteQuoteTemplate","OPEN_QUOTE_TEMPLATE_MUTATION","openQuoteTemplate","SET_NEGOTIABLE_QUOTE_TEMPLATE_SHIPPING_ADDRESS_MUTATION","addQuoteTemplateShippingAddress","UPDATE_NEGOTIABLE_QUOTE_TEMPLATE_QUANTITIES_MUTATION","updateQuoteTemplateItemQuantities","item","REMOVE_NEGOTIABLE_QUOTE_TEMPLATE_ITEMS_MUTATION","removeQuoteTemplateItems","SET_QUOTE_TEMPLATE_LINE_ITEM_NOTE_MUTATION","addQuoteTemplateLineItemNote","GENERATE_NEGOTIABLE_QUOTE_FROM_TEMPLATE_MUTATION","generateQuoteFromTemplate"],"mappings":"u0BAeO,SAASA,EAAqBC,EAA6B,CAChE,GAAI,CAACA,EAAM,OAAOC,EAElB,MAAMC,EACJC,GAGE,CACEC,EAAmB,aACnBA,EAAmB,aACnBA,EAAmB,yBAAA,EACnB,SAASD,CAAyB,EAE7BA,EAGFC,EAAmB,aAG5B,MAAO,CACL,yBAA0BJ,EAAK,8BAC/B,qBAAsBA,EAAK,2BAC3B,qBAAsB,CACpB,QAASA,EAAK,+BACd,SAAUE,EACRF,EAAK,8BAAA,EAEP,MAAOE,EACLF,EAAK,2BAAA,EAEP,SAAUE,EACRF,EAAK,8BAAA,EAEP,YAAaA,EAAK,mCAClB,WAAYA,EAAK,iCAAA,EAEnB,+BACEA,EAAK,gCAAkC,QAAA,CAE7C,CCPO,SAASK,EACdC,EACsB,CAEtB,GAAI,CAACA,GAAW,OAAOA,GAAY,SACjC,MAAO,CACL,aAAc,GACd,UAAW,GACX,YAAa,GACb,cAAe,GACf,mBAAoB,GACpB,qBAAsB,GACtB,0BAA2B,EAAA,EAK/B,GAAIA,EAAQ,MAAQ,GAClB,MAAO,CACL,aAAc,GACd,UAAW,GACX,YAAa,GACb,cAAe,GACf,mBAAoB,GACpB,qBAAsB,GACtB,0BAA2B,EAAA,EAK/B,MAAMC,EAAyBD,EAAQ,8BAA8B,IAAM,GACrEE,EAA4BF,EAAQ,sCAAsC,IAAM,GAGhFG,EACJF,GAA0BD,EAAQ,iCAAiC,IAAM,GAE3E,MAAO,CAEL,aAAcG,EACd,UAAWA,EACX,YAAaA,EAGb,cACEF,GAA0BD,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