@dropins/storefront-quote-management 0.0.1-alpha21 → 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/getStoreConfig/getStoreConfig.d.ts +4 -0
- package/api/getStoreConfig/graphql/StoreConfigQuery.d.ts +10 -0
- package/api/{getCustomerData → getStoreConfig}/index.d.ts +1 -1
- package/api/index.d.ts +1 -1
- package/api.js +29 -40
- package/api.js.map +1 -1
- package/chunks/ChevronDown.js +4 -0
- package/chunks/ChevronDown.js.map +1 -0
- package/chunks/NegotiableQuoteFragment.js +129 -0
- package/chunks/NegotiableQuoteFragment.js.map +1 -1
- package/chunks/QuoteHistoryLog.js +1 -1
- package/chunks/QuoteHistoryLog.js.map +1 -1
- package/chunks/dateUtils.js +4 -0
- package/chunks/dateUtils.js.map +1 -0
- package/chunks/fetch-graphql.js +1 -1
- package/chunks/fetch-graphql.js.map +1 -1
- package/chunks/getQuoteTemplates.js +1 -1
- package/chunks/negotiableQuotes.js +1 -1
- package/chunks/renameNegotiableQuote.js +1 -1
- package/chunks/state.js +1 -1
- package/chunks/state.js.map +1 -1
- package/chunks/updateQuantities.js +2 -2
- package/chunks/uploadFile.js +3 -3
- 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/QuoteHistoryLog.js +1 -1
- package/containers/QuoteSummaryList/QuoteSummaryList.d.ts +51 -0
- package/{data/transforms/__fixtures__/customerData.d.ts → containers/QuoteSummaryList/index.d.ts} +3 -2
- package/containers/QuoteSummaryList.d.ts +3 -0
- package/containers/QuoteSummaryList.js +4 -0
- package/containers/QuoteSummaryList.js.map +1 -0
- package/containers/QuoteTemplatesListTable.js +1 -1
- package/containers/QuoteTemplatesListTable.js.map +1 -1
- package/containers/RequestNegotiableQuoteForm.js +1 -1
- package/containers/index.d.ts +1 -0
- package/data/models/__fixtures__/negotiableQuoteModel.d.ts +1 -0
- package/data/models/__fixtures__/storeConfigModel.d.ts +5 -0
- package/data/models/index.d.ts +0 -1
- package/data/models/negotiable-quote-model.d.ts +33 -5
- package/data/models/store-config-model.d.ts +5 -2
- package/data/transforms/__fixtures__/negotiableQuoteData.d.ts +216 -0
- package/data/transforms/__fixtures__/storeConfigData.d.ts +31 -0
- package/data/transforms/index.d.ts +1 -1
- package/data/transforms/transform-store-config.d.ts +4 -0
- package/hooks/useQuoteSummaryData.d.ts +10 -0
- package/i18n/en_US.json.d.ts +12 -0
- package/lib/configurationTransformers.d.ts +27 -0
- package/lib/itemFormatters.d.ts +47 -0
- package/lib/priceCalculators.d.ts +41 -0
- package/lib/state.d.ts +3 -0
- package/package.json +1 -1
- package/render.js +1 -1
- package/render.js.map +1 -1
- package/types/state.types.d.ts +6 -0
- package/utils/dateUtils.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/graphql/CustomerFragment.d.ts +0 -2
- package/data/models/__fixtures__/customerModel.d.ts +0 -4
- package/data/models/customer-model.d.ts +0 -18
- package/data/transforms/transform-customer.d.ts +0 -15
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/********************************************************************
|
|
2
|
+
* Copyright 2025 Adobe
|
|
3
|
+
* All Rights Reserved.
|
|
4
|
+
*
|
|
5
|
+
* NOTICE: Adobe permits you to use, modify, and distribute this
|
|
6
|
+
* file in accordance with the terms of the Adobe license agreement
|
|
7
|
+
* accompanying it.
|
|
8
|
+
*******************************************************************/
|
|
9
|
+
export declare const STORE_CONFIG_QUERY = "\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";
|
|
10
|
+
//# sourceMappingURL=StoreConfigQuery.d.ts.map
|
|
@@ -6,5 +6,5 @@
|
|
|
6
6
|
* file in accordance with the terms of the Adobe license agreement
|
|
7
7
|
* accompanying it.
|
|
8
8
|
*******************************************************************/
|
|
9
|
-
export * from './
|
|
9
|
+
export * from './getStoreConfig';
|
|
10
10
|
//# sourceMappingURL=index.d.ts.map
|
package/api/index.d.ts
CHANGED
|
@@ -8,10 +8,10 @@
|
|
|
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';
|
|
14
|
+
export * from './getStoreConfig';
|
|
15
15
|
export * from './deleteQuote';
|
|
16
16
|
export * from './setShippingAddress';
|
|
17
17
|
export * from './sendForReview';
|
package/api.js
CHANGED
|
@@ -1,31 +1,20 @@
|
|
|
1
1
|
/*! Copyright 2025 Adobe
|
|
2
2
|
All Rights Reserved. */
|
|
3
|
-
import{
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
}
|
|
16
|
-
}
|
|
17
|
-
}
|
|
18
|
-
}
|
|
19
|
-
}
|
|
20
|
-
`,A=`
|
|
21
|
-
query CUSTOMER_QUERY {
|
|
22
|
-
customer {
|
|
23
|
-
...CUSTOMER_FRAGMENT
|
|
24
|
-
}
|
|
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=`
|
|
4
|
+
query STORE_CONFIG_QUERY {
|
|
5
|
+
storeConfig {
|
|
6
|
+
cart_summary_display_quantity
|
|
7
|
+
max_items_in_order_summary
|
|
8
|
+
shopping_cart_display_full_summary
|
|
9
|
+
shopping_cart_display_grand_total
|
|
10
|
+
shopping_cart_display_price
|
|
11
|
+
shopping_cart_display_shipping
|
|
12
|
+
shopping_cart_display_subtotal
|
|
13
|
+
shopping_cart_display_zero_tax
|
|
14
|
+
configurable_thumbnail_source
|
|
25
15
|
}
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
`,q="All/Quotes/View/Request, Edit, Delete",b="All/Quotes/View/Request, Edit, Delete",U="All/Quotes/View/Request, Edit, Delete",O="All/Quotes/View/Checkout with quote",y=t=>{const o=[],e=(a,d=[])=>{for(const n of a){const p=[...d,n.text];n.children&&n.children.length>0?e(n.children,p):o.push(p.join("/"))}};return e(t),o};function M(t){const{role:o}=t;if(!o)return{permissions:{canRequestQuote:l.requestQuote,canEditQuote:l.editQuote,canDeleteQuote:l.deleteQuote,canCheckoutQuote:l.checkoutQuote}};const{permissions:e}=o,a=y(e);return{permissions:{canRequestQuote:a.includes(q),canEditQuote:a.includes(b),canDeleteQuote:a.includes(U),canCheckoutQuote:a.includes(O)}}}const D=async()=>{var t;if(!r.authenticated)return Promise.reject(new Error("Unauthorized"));try{const o=await s(A);if(!((t=o==null?void 0:o.data)!=null&&t.customer))throw new Error("No customer data received");return M(o.data.customer)}catch(o){return Promise.reject(o)}},T=new w({init:async t=>{const o={};T.config.setConfig({...o,...t})},listeners:()=>[i.on("authenticated",async t=>{r.authenticated=!!t,t?D().then(o=>{r.permissions={requestQuote:o.permissions.canRequestQuote,editQuote:o.permissions.canEditQuote,deleteQuote:o.permissions.canDeleteQuote,checkoutQuote:o.permissions.canCheckoutQuote},i.emit("quote-management/permissions",r.permissions)}).catch(o=>{console.error(o),r.permissions=l,i.emit("quote-management/permissions",l)}):(r.permissions=l,i.emit("quote-management/permissions",l))},{eager:!0}),i.on("quote-management/permissions",async t=>{const o=T.config.getConfig().quoteId;o&&t.editQuote&&Q(o).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})]}),ee=T.config,v=`
|
|
16
|
+
}
|
|
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=`
|
|
29
18
|
mutation SET_NEGOTIABLE_QUOTE_SHIPPING_ADDRESS_MUTATION(
|
|
30
19
|
$quoteUid: ID!
|
|
31
20
|
$addressId: ID
|
|
@@ -45,8 +34,8 @@ import{D as l,s as r}from"./chunks/state.js";import{events as i}from"@dropins/to
|
|
|
45
34
|
}
|
|
46
35
|
}
|
|
47
36
|
}
|
|
48
|
-
${
|
|
49
|
-
`;function
|
|
37
|
+
${N}
|
|
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=`
|
|
50
39
|
fragment NegotiableQuoteTemplateFragment on NegotiableQuoteTemplate {
|
|
51
40
|
# uid
|
|
52
41
|
name
|
|
@@ -231,7 +220,7 @@ import{D as l,s as r}from"./chunks/state.js";import{events as i}from"@dropins/to
|
|
|
231
220
|
telephone
|
|
232
221
|
}
|
|
233
222
|
}
|
|
234
|
-
`,
|
|
223
|
+
`,M=`
|
|
235
224
|
query QUOTE_TEMPLATE_DATA_QUERY($templateId: ID!) {
|
|
236
225
|
negotiableQuoteTemplate(templateId: $templateId) {
|
|
237
226
|
...NegotiableQuoteTemplateFragment
|
|
@@ -239,7 +228,7 @@ import{D as l,s as r}from"./chunks/state.js";import{events as i}from"@dropins/to
|
|
|
239
228
|
}
|
|
240
229
|
|
|
241
230
|
${m}
|
|
242
|
-
`,
|
|
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=`
|
|
243
232
|
mutation CREATE_QUOTE_TEMPLATE_MUTATION($cartId: ID!) {
|
|
244
233
|
requestNegotiableQuoteTemplateFromQuote(input: { cart_id: $cartId }) {
|
|
245
234
|
...NegotiableQuoteTemplateFragment
|
|
@@ -247,7 +236,7 @@ import{D as l,s as r}from"./chunks/state.js";import{events as i}from"@dropins/to
|
|
|
247
236
|
}
|
|
248
237
|
|
|
249
238
|
${m}
|
|
250
|
-
`,
|
|
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=`
|
|
251
240
|
mutation SEND_QUOTE_TEMPLATE_FOR_REVIEW_MUTATION(
|
|
252
241
|
$templateId: ID!
|
|
253
242
|
$comment: String
|
|
@@ -258,7 +247,7 @@ import{D as l,s as r}from"./chunks/state.js";import{events as i}from"@dropins/to
|
|
|
258
247
|
}
|
|
259
248
|
}
|
|
260
249
|
${m}
|
|
261
|
-
`,
|
|
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=`
|
|
262
251
|
mutation ACCEPT_QUOTE_TEMPLATE_MUTATION($templateId: ID!) {
|
|
263
252
|
acceptNegotiableQuoteTemplate(input: { template_id: $templateId }) {
|
|
264
253
|
...NegotiableQuoteTemplateFragment
|
|
@@ -266,7 +255,7 @@ import{D as l,s as r}from"./chunks/state.js";import{events as i}from"@dropins/to
|
|
|
266
255
|
}
|
|
267
256
|
|
|
268
257
|
${m}
|
|
269
|
-
`,
|
|
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=`
|
|
270
259
|
mutation CANCEL_QUOTE_TEMPLATE_MUTATION(
|
|
271
260
|
$templateId: ID!
|
|
272
261
|
$comment: String
|
|
@@ -281,11 +270,11 @@ import{D as l,s as r}from"./chunks/state.js";import{events as i}from"@dropins/to
|
|
|
281
270
|
}
|
|
282
271
|
}
|
|
283
272
|
${m}
|
|
284
|
-
`,
|
|
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=`
|
|
285
274
|
mutation DELETE_QUOTE_TEMPLATE_MUTATION($templateId: ID!) {
|
|
286
275
|
deleteNegotiableQuoteTemplate(input: { template_id: $templateId })
|
|
287
276
|
}
|
|
288
|
-
`,
|
|
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)}},$=`
|
|
289
278
|
mutation OPEN_QUOTE_TEMPLATE_MUTATION($templateId: ID!) {
|
|
290
279
|
openNegotiableQuoteTemplate(input: { template_id: $templateId }) {
|
|
291
280
|
...NegotiableQuoteTemplateFragment
|
|
@@ -293,7 +282,7 @@ import{D as l,s as r}from"./chunks/state.js";import{events as i}from"@dropins/to
|
|
|
293
282
|
}
|
|
294
283
|
|
|
295
284
|
${m}
|
|
296
|
-
`,
|
|
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=`
|
|
297
286
|
mutation SET_NEGOTIABLE_QUOTE_TEMPLATE_SHIPPING_ADDRESS_MUTATION(
|
|
298
287
|
$templateId: ID!
|
|
299
288
|
$shippingAddress: NegotiableQuoteTemplateShippingAddressInput!
|
|
@@ -309,7 +298,7 @@ import{D as l,s as r}from"./chunks/state.js";import{events as i}from"@dropins/to
|
|
|
309
298
|
}
|
|
310
299
|
|
|
311
300
|
${m}
|
|
312
|
-
`,
|
|
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=`
|
|
313
302
|
mutation UPDATE_NEGOTIABLE_QUOTE_TEMPLATE_QUANTITIES_MUTATION(
|
|
314
303
|
$input: UpdateNegotiableQuoteTemplateQuantitiesInput!
|
|
315
304
|
) {
|
|
@@ -320,7 +309,7 @@ import{D as l,s as r}from"./chunks/state.js";import{events as i}from"@dropins/to
|
|
|
320
309
|
}
|
|
321
310
|
}
|
|
322
311
|
${m}
|
|
323
|
-
`,
|
|
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=`
|
|
324
313
|
mutation REMOVE_NEGOTIABLE_QUOTE_TEMPLATE_ITEMS_MUTATION(
|
|
325
314
|
$input: RemoveNegotiableQuoteTemplateItemsInput!
|
|
326
315
|
) {
|
|
@@ -329,7 +318,7 @@ import{D as l,s as r}from"./chunks/state.js";import{events as i}from"@dropins/to
|
|
|
329
318
|
}
|
|
330
319
|
}
|
|
331
320
|
${m}
|
|
332
|
-
`,
|
|
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=`
|
|
333
322
|
mutation SET_QUOTE_TEMPLATE_LINE_ITEM_NOTE_MUTATION(
|
|
334
323
|
$input: QuoteTemplateLineItemNoteInput!
|
|
335
324
|
) {
|
|
@@ -338,7 +327,7 @@ import{D as l,s as r}from"./chunks/state.js";import{events as i}from"@dropins/to
|
|
|
338
327
|
}
|
|
339
328
|
}
|
|
340
329
|
${m}
|
|
341
|
-
`,
|
|
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=`
|
|
342
331
|
mutation GENERATE_NEGOTIABLE_QUOTE_FROM_TEMPLATE_MUTATION(
|
|
343
332
|
$input: GenerateNegotiableQuoteFromTemplateInput!
|
|
344
333
|
) {
|
|
@@ -346,5 +335,5 @@ import{D as l,s as r}from"./chunks/state.js";import{events as i}from"@dropins/to
|
|
|
346
335
|
negotiable_quote_uid
|
|
347
336
|
}
|
|
348
337
|
}
|
|
349
|
-
`,
|
|
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};
|
|
350
339
|
//# sourceMappingURL=api.js.map
|