@dropins/storefront-quote-management 0.0.1-alpha22 → 0.0.1-alpha23
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/index.d.ts +0 -1
- package/api.js +16 -41
- package/api.js.map +1 -1
- package/chunks/fetch-graphql.js +4 -0
- package/chunks/fetch-graphql.js.map +1 -0
- package/chunks/getQuoteTemplates.js +1 -1
- package/chunks/getQuoteTemplates.js.map +1 -1
- package/chunks/negotiableQuotes.js +1 -1
- package/chunks/negotiableQuotes.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/state.js.map +1 -1
- package/chunks/updateQuantities.js +2 -2
- package/chunks/updateQuantities.js.map +1 -1
- package/chunks/uploadFile.js +3 -3
- package/chunks/uploadFile.js.map +1 -1
- package/containers/ItemsQuoted.js +1 -1
- package/containers/ManageNegotiableQuote.js +1 -1
- package/containers/ManageNegotiableQuote.js.map +1 -1
- package/containers/QuoteTemplatesListTable.js +1 -1
- package/containers/QuoteTemplatesListTable.js.map +1 -1
- package/containers/QuotesListTable.js +1 -1
- package/containers/QuotesListTable.js.map +1 -1
- package/containers/RequestNegotiableQuoteForm.js +1 -1
- package/containers/RequestNegotiableQuoteForm.js.map +1 -1
- package/data/models/index.d.ts +0 -1
- package/data/transforms/index.d.ts +0 -1
- package/lib/state.d.ts +3 -0
- package/package.json +1 -1
- package/types/state.types.d.ts +6 -0
- package/utils/mapAuthPermissions.d.ts +39 -0
- package/api/getCustomerData/getCustomerData.d.ts +0 -10
- package/api/getCustomerData/graphql/CustomerQuery.d.ts +0 -2
- package/api/getCustomerData/index.d.ts +0 -10
- package/api/graphql/CustomerFragment.d.ts +0 -2
- package/chunks/transform-quote.js +0 -4
- package/chunks/transform-quote.js.map +0 -1
- package/data/models/__fixtures__/customerModel.d.ts +0 -4
- package/data/models/customer-model.d.ts +0 -18
- package/data/transforms/__fixtures__/customerData.d.ts +0 -10
- package/data/transforms/transform-customer.d.ts +0 -15
package/api/index.d.ts
CHANGED
|
@@ -8,7 +8,6 @@
|
|
|
8
8
|
*******************************************************************/
|
|
9
9
|
export * from './initialize';
|
|
10
10
|
export * from './fetch-graphql';
|
|
11
|
-
export * from './getCustomerData';
|
|
12
11
|
export * from './requestNegotiableQuote';
|
|
13
12
|
export * from './getQuoteData';
|
|
14
13
|
export * from './negotiableQuotes';
|
package/api.js
CHANGED
|
@@ -1,31 +1,6 @@
|
|
|
1
1
|
/*! Copyright 2025 Adobe
|
|
2
2
|
All Rights Reserved. */
|
|
3
|
-
import{
|
|
4
|
-
fragment CUSTOMER_FRAGMENT on Customer {
|
|
5
|
-
role {
|
|
6
|
-
permissions {
|
|
7
|
-
text
|
|
8
|
-
children {
|
|
9
|
-
text
|
|
10
|
-
children {
|
|
11
|
-
text
|
|
12
|
-
children {
|
|
13
|
-
text
|
|
14
|
-
}
|
|
15
|
-
}
|
|
16
|
-
}
|
|
17
|
-
}
|
|
18
|
-
}
|
|
19
|
-
}
|
|
20
|
-
`,b=`
|
|
21
|
-
query CUSTOMER_QUERY {
|
|
22
|
-
customer {
|
|
23
|
-
...CUSTOMER_FRAGMENT
|
|
24
|
-
}
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
${q}
|
|
28
|
-
`;function y(t){if(!t)return h;const r=e=>[c.TAX_EXCLUDED,c.TAX_INCLUDED,c.TAX_INCLUDED_AND_EXCLUDED].includes(e)?e:c.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"}}const U="All/Quotes/View/Request, Edit, Delete",O="All/Quotes/View/Request, Edit, Delete",D="All/Quotes/View/Request, Edit, Delete",M="All/Quotes/View/Checkout with quote",S=t=>{const r=[],e=(o,d=[])=>{for(const n of o){const p=[...d,n.text];n.children&&n.children.length>0?e(n.children,p):r.push(p.join("/"))}};return e(t),r};function v(t){const{role:r}=t;if(!r)return{permissions:{canRequestQuote:l.requestQuote,canEditQuote:l.editQuote,canDeleteQuote:l.deleteQuote,canCheckoutQuote:l.checkoutQuote}};const{permissions:e}=r,o=S(e);return{permissions:{canRequestQuote:o.includes(U),canEditQuote:o.includes(O),canDeleteQuote:o.includes(D),canCheckoutQuote:o.includes(M)}}}const F=async()=>{var t;if(!a.authenticated)return Promise.reject(new Error("Unauthorized"));try{const r=await s(b);if(!((t=r==null?void 0:r.data)!=null&&t.customer))throw new Error("No customer data received");return v(r.data.customer)}catch(r){return Promise.reject(r)}},P=`
|
|
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 be,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{u as $e}from"./chunks/updateQuantities.js";import{Initializer as A}from"@dropins/tools/lib.js";import"@dropins/tools/fetch-graphql.js";function q(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 b(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=b(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=`
|
|
29
4
|
query STORE_CONFIG_QUERY {
|
|
30
5
|
storeConfig {
|
|
31
6
|
cart_summary_display_quantity
|
|
@@ -39,7 +14,7 @@ import{s as a,D as l,a as h,Q as c}from"./chunks/state.js";import{events as i}fr
|
|
|
39
14
|
configurable_thumbnail_source
|
|
40
15
|
}
|
|
41
16
|
}
|
|
42
|
-
`,
|
|
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 q(r.storeConfig)}),O=`
|
|
43
18
|
mutation SET_NEGOTIABLE_QUOTE_SHIPPING_ADDRESS_MUTATION(
|
|
44
19
|
$quoteUid: ID!
|
|
45
20
|
$addressId: ID
|
|
@@ -60,7 +35,7 @@ import{s as a,D as l,a as h,Q as c}from"./chunks/state.js";import{events as i}fr
|
|
|
60
35
|
}
|
|
61
36
|
}
|
|
62
37
|
${N}
|
|
63
|
-
`;function
|
|
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=`
|
|
64
39
|
fragment NegotiableQuoteTemplateFragment on NegotiableQuoteTemplate {
|
|
65
40
|
# uid
|
|
66
41
|
name
|
|
@@ -245,7 +220,7 @@ import{s as a,D as l,a as h,Q as c}from"./chunks/state.js";import{events as i}fr
|
|
|
245
220
|
telephone
|
|
246
221
|
}
|
|
247
222
|
}
|
|
248
|
-
`,
|
|
223
|
+
`,M=`
|
|
249
224
|
query QUOTE_TEMPLATE_DATA_QUERY($templateId: ID!) {
|
|
250
225
|
negotiableQuoteTemplate(templateId: $templateId) {
|
|
251
226
|
...NegotiableQuoteTemplateFragment
|
|
@@ -253,7 +228,7 @@ import{s as a,D as l,a as h,Q as c}from"./chunks/state.js";import{events as i}fr
|
|
|
253
228
|
}
|
|
254
229
|
|
|
255
230
|
${m}
|
|
256
|
-
`,
|
|
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=`
|
|
257
232
|
mutation CREATE_QUOTE_TEMPLATE_MUTATION($cartId: ID!) {
|
|
258
233
|
requestNegotiableQuoteTemplateFromQuote(input: { cart_id: $cartId }) {
|
|
259
234
|
...NegotiableQuoteTemplateFragment
|
|
@@ -261,7 +236,7 @@ import{s as a,D as l,a as h,Q as c}from"./chunks/state.js";import{events as i}fr
|
|
|
261
236
|
}
|
|
262
237
|
|
|
263
238
|
${m}
|
|
264
|
-
`,
|
|
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=`
|
|
265
240
|
mutation SEND_QUOTE_TEMPLATE_FOR_REVIEW_MUTATION(
|
|
266
241
|
$templateId: ID!
|
|
267
242
|
$comment: String
|
|
@@ -272,7 +247,7 @@ import{s as a,D as l,a as h,Q as c}from"./chunks/state.js";import{events as i}fr
|
|
|
272
247
|
}
|
|
273
248
|
}
|
|
274
249
|
${m}
|
|
275
|
-
`,
|
|
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=`
|
|
276
251
|
mutation ACCEPT_QUOTE_TEMPLATE_MUTATION($templateId: ID!) {
|
|
277
252
|
acceptNegotiableQuoteTemplate(input: { template_id: $templateId }) {
|
|
278
253
|
...NegotiableQuoteTemplateFragment
|
|
@@ -280,7 +255,7 @@ import{s as a,D as l,a as h,Q as c}from"./chunks/state.js";import{events as i}fr
|
|
|
280
255
|
}
|
|
281
256
|
|
|
282
257
|
${m}
|
|
283
|
-
`,
|
|
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=`
|
|
284
259
|
mutation CANCEL_QUOTE_TEMPLATE_MUTATION(
|
|
285
260
|
$templateId: ID!
|
|
286
261
|
$comment: String
|
|
@@ -295,11 +270,11 @@ import{s as a,D as l,a as h,Q as c}from"./chunks/state.js";import{events as i}fr
|
|
|
295
270
|
}
|
|
296
271
|
}
|
|
297
272
|
${m}
|
|
298
|
-
`,
|
|
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=`
|
|
299
274
|
mutation DELETE_QUOTE_TEMPLATE_MUTATION($templateId: ID!) {
|
|
300
275
|
deleteNegotiableQuoteTemplate(input: { template_id: $templateId })
|
|
301
276
|
}
|
|
302
|
-
`,
|
|
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)}},$=`
|
|
303
278
|
mutation OPEN_QUOTE_TEMPLATE_MUTATION($templateId: ID!) {
|
|
304
279
|
openNegotiableQuoteTemplate(input: { template_id: $templateId }) {
|
|
305
280
|
...NegotiableQuoteTemplateFragment
|
|
@@ -307,7 +282,7 @@ import{s as a,D as l,a as h,Q as c}from"./chunks/state.js";import{events as i}fr
|
|
|
307
282
|
}
|
|
308
283
|
|
|
309
284
|
${m}
|
|
310
|
-
`,
|
|
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=`
|
|
311
286
|
mutation SET_NEGOTIABLE_QUOTE_TEMPLATE_SHIPPING_ADDRESS_MUTATION(
|
|
312
287
|
$templateId: ID!
|
|
313
288
|
$shippingAddress: NegotiableQuoteTemplateShippingAddressInput!
|
|
@@ -323,7 +298,7 @@ import{s as a,D as l,a as h,Q as c}from"./chunks/state.js";import{events as i}fr
|
|
|
323
298
|
}
|
|
324
299
|
|
|
325
300
|
${m}
|
|
326
|
-
`,
|
|
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=`
|
|
327
302
|
mutation UPDATE_NEGOTIABLE_QUOTE_TEMPLATE_QUANTITIES_MUTATION(
|
|
328
303
|
$input: UpdateNegotiableQuoteTemplateQuantitiesInput!
|
|
329
304
|
) {
|
|
@@ -334,7 +309,7 @@ import{s as a,D as l,a as h,Q as c}from"./chunks/state.js";import{events as i}fr
|
|
|
334
309
|
}
|
|
335
310
|
}
|
|
336
311
|
${m}
|
|
337
|
-
`,
|
|
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=`
|
|
338
313
|
mutation REMOVE_NEGOTIABLE_QUOTE_TEMPLATE_ITEMS_MUTATION(
|
|
339
314
|
$input: RemoveNegotiableQuoteTemplateItemsInput!
|
|
340
315
|
) {
|
|
@@ -343,7 +318,7 @@ import{s as a,D as l,a as h,Q as c}from"./chunks/state.js";import{events as i}fr
|
|
|
343
318
|
}
|
|
344
319
|
}
|
|
345
320
|
${m}
|
|
346
|
-
`,
|
|
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=`
|
|
347
322
|
mutation SET_QUOTE_TEMPLATE_LINE_ITEM_NOTE_MUTATION(
|
|
348
323
|
$input: QuoteTemplateLineItemNoteInput!
|
|
349
324
|
) {
|
|
@@ -352,7 +327,7 @@ import{s as a,D as l,a as h,Q as c}from"./chunks/state.js";import{events as i}fr
|
|
|
352
327
|
}
|
|
353
328
|
}
|
|
354
329
|
${m}
|
|
355
|
-
`,
|
|
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=`
|
|
356
331
|
mutation GENERATE_NEGOTIABLE_QUOTE_FROM_TEMPLATE_MUTATION(
|
|
357
332
|
$input: GenerateNegotiableQuoteFromTemplateInput!
|
|
358
333
|
) {
|
|
@@ -360,5 +335,5 @@ import{s as a,D as l,a as h,Q as c}from"./chunks/state.js";import{events as i}fr
|
|
|
360
335
|
negotiable_quote_uid
|
|
361
336
|
}
|
|
362
337
|
}
|
|
363
|
-
`,
|
|
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,be 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,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,$e as updateQuantities,se as updateQuoteTemplateItemQuantities,_e as uploadFile};
|
|
364
339
|
//# sourceMappingURL=api.js.map
|