@dropins/storefront-quote-management 0.0.1-alpha27 → 0.0.1-alpha28
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/graphql/NegotiableQuoteTemplateFragment.d.ts +1 -1
- package/api.js +22 -226
- package/api.js.map +1 -1
- package/chunks/NegotiableQuoteTemplateFragment.js +190 -0
- package/chunks/NegotiableQuoteTemplateFragment.js.map +1 -0
- package/chunks/getQuoteTemplates.js +2 -2
- package/chunks/getQuoteTemplates.js.map +1 -1
- package/chunks/renameNegotiableQuote.js +17 -9
- package/chunks/renameNegotiableQuote.js.map +1 -1
- package/chunks/sendQuoteTemplateForReview.js +15 -0
- package/chunks/sendQuoteTemplateForReview.js.map +1 -0
- package/chunks/state.js +1 -1
- package/chunks/state.js.map +1 -1
- package/chunks/transform-quote-template.js +4 -0
- package/chunks/transform-quote-template.js.map +1 -0
- package/containers/ManageNegotiableQuote.js +1 -1
- package/containers/ManageNegotiableQuote.js.map +1 -1
- package/containers/ManageNegotiableQuoteTemplate/ManageNegotiableQuoteTemplate.d.ts +9 -0
- package/containers/ManageNegotiableQuoteTemplate.js +1 -1
- package/containers/ManageNegotiableQuoteTemplate.js.map +1 -1
- package/containers/QuoteTemplatesListTable.js +1 -1
- package/containers/QuoteTemplatesListTable.js.map +1 -1
- package/containers/RequestNegotiableQuoteForm.js +1 -1
- package/containers/RequestNegotiableQuoteForm.js.map +1 -1
- package/data/models/negotiable-quote-template-model.d.ts +2 -1
- package/data/transforms/__fixtures__/negotiableQuoteTemplateData.d.ts +6 -0
- package/i18n/en_US.json.d.ts +16 -0
- package/package.json +1 -1
- package/render.js +1 -1
- package/render.js.map +1 -1
- package/types/state.types.d.ts +2 -0
|
@@ -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 declare const NEGOTIABLE_QUOTE_TEMPLATE_FRAGMENT = "\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";
|
|
9
|
+
export declare const NEGOTIABLE_QUOTE_TEMPLATE_FRAGMENT = "\n fragment NegotiableQuoteTemplateFragment on NegotiableQuoteTemplate {\n # uid\n template_id\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";
|
|
10
10
|
//# sourceMappingURL=NegotiableQuoteTemplateFragment.d.ts.map
|
package/api.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/*! Copyright 2025 Adobe
|
|
2
2
|
All Rights Reserved. */
|
|
3
|
-
import{r as
|
|
3
|
+
import{r as pe,u as le}from"./chunks/uploadFile.js";import{g as A}from"./chunks/renameNegotiableQuote.js";import{c as ce,a as _e,d as ge,r as Ee,s as he}from"./chunks/renameNegotiableQuote.js";import{F as fe,N as Qe,S as Ae,n as Ne}from"./chunks/negotiableQuotes.js";import{events as i}from"@dropins/tools/event-bus.js";import{s as r,D as E,a as I,Q as p}from"./chunks/state.js";import{f as n,a as N}from"./chunks/transform-quote.js";import{e as qe,r as be,s as Ue,c as De,d as ye}from"./chunks/transform-quote.js";import{N as w}from"./chunks/NegotiableQuoteFragment.js";import{a as m}from"./chunks/transform-quote-template.js";import{N as u}from"./chunks/NegotiableQuoteTemplateFragment.js";import{Q as Me,a as Le,S as Fe,g as Se}from"./chunks/getQuoteTemplates.js";import{s as ve}from"./chunks/sendQuoteTemplateForReview.js";import{r as Ge,u as Ce}from"./chunks/removeNegotiableQuoteItems.js";import{Initializer as q}from"@dropins/tools/lib.js";import"@dropins/tools/fetch-graphql.js";function b(e){if(!e||typeof e!="object")return{requestQuote:!1,editQuote:!1,deleteQuote:!1,checkoutQuote:!1,viewQuoteTemplates:!1,manageQuoteTemplates:!1,generateQuoteFromTemplate:!1};if(e.all===!0)return{requestQuote:!0,editQuote:!0,deleteQuote:!0,checkoutQuote:!0,viewQuoteTemplates:!0,manageQuoteTemplates:!0,generateQuoteFromTemplate:!0};const o=e["Magento_NegotiableQuote::all"]===!0,t=e["Magento_NegotiableQuoteTemplate::all"]===!0,a=o||e["Magento_NegotiableQuote::manage"]===!0;return{requestQuote:a,editQuote:a,deleteQuote:a,checkoutQuote:o||e["Magento_NegotiableQuote::checkout"]===!0,viewQuoteTemplates:t||e["Magento_NegotiableQuoteTemplate::view_template"]===!0,manageQuoteTemplates:t||e["Magento_NegotiableQuoteTemplate::manage"]===!0,generateQuoteFromTemplate:t||e["Magento_NegotiableQuoteTemplate::generate_quote"]===!0}}function h(e){if(r.quoteDataLoaded)return;const o=T.config.getConfig(),{quoteId:t,quoteTemplateId:a}=o;!e.editQuote||!t&&!a||(r.quoteDataLoaded=!0,t&&A(t).then(s=>{i.emit("quote-management/quote-data/initialized",{quote:s,permissions:e})}).catch(s=>{r.quoteDataLoaded=!1,i.emit("quote-management/quote-data/error",{error:s})}),a&&F(a).catch(s=>{r.quoteDataLoaded=!1,i.emit("quote-management/quote-template-data/error",{error:s})}))}const T=new q({init:async e=>{const o={};T.config.setConfig({...o,...e}),await y().then(t=>{r.config=t}).catch(t=>{console.error("Failed to fetch store config: ",t),r.config=I}),r.initialized=!0,i.emit("quote-management/initialized",{})},listeners:()=>[i.on("authenticated",async e=>{r.authenticated=!!e,e||(r.permissions=E,r.quoteDataLoaded=!1,i.emit("quote-management/permissions",E))},{eager:!0}),i.on("auth/permissions",async e=>{const o=b(e);r.permissions=o,r.quoteDataLoaded=!1,i.emit("quote-management/permissions",r.permissions)},{eager:!0}),i.on("quote-management/permissions",async e=>{r.initialized&&h(e)},{eager:!0}),i.on("quote-management/initialized",async()=>{h(r.permissions)},{eager:!0})]}),W=T.config;function U(e){if(!e)return I;const o=t=>[p.TAX_EXCLUDED,p.TAX_INCLUDED,p.TAX_INCLUDED_AND_EXCLUDED].includes(t)?t:p.TAX_EXCLUDED;return{quoteSummaryDisplayTotal:e.cart_summary_display_quantity,quoteSummaryMaxItems:e.max_items_in_order_summary,quoteDisplaySettings:{zeroTax:e.shopping_cart_display_zero_tax,subtotal:o(e.shopping_cart_display_subtotal),price:o(e.shopping_cart_display_price),shipping:o(e.shopping_cart_display_shipping),fullSummary:e.shopping_cart_display_full_summary,grandTotal:e.shopping_cart_display_grand_total},useConfigurableParentThumbnail:e.configurable_thumbnail_source==="parent"}}const D=`
|
|
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
|
-
`,
|
|
17
|
+
`,y=async()=>n(D,{method:"GET",cache:"force-cache"}).then(({errors:e,data:o})=>{if(e){const t=e.map(a=>a.message).join(", ");throw new Error(`Failed to get store config: ${t}`)}return U(o.storeConfig)}),O=`
|
|
18
18
|
mutation SET_NEGOTIABLE_QUOTE_SHIPPING_ADDRESS_MUTATION(
|
|
19
19
|
$quoteUid: ID!
|
|
20
20
|
$addressId: ID
|
|
@@ -34,228 +34,24 @@ import{r as ce,u as _e}from"./chunks/uploadFile.js";import{g as Q}from"./chunks/
|
|
|
34
34
|
}
|
|
35
35
|
}
|
|
36
36
|
}
|
|
37
|
-
${
|
|
38
|
-
`;function
|
|
39
|
-
fragment NegotiableQuoteTemplateFragment on NegotiableQuoteTemplate {
|
|
40
|
-
# uid
|
|
41
|
-
name
|
|
42
|
-
# created_at
|
|
43
|
-
# updated_at
|
|
44
|
-
status
|
|
45
|
-
# sales_rep_name
|
|
46
|
-
expiration_date
|
|
47
|
-
buyer {
|
|
48
|
-
firstname
|
|
49
|
-
lastname
|
|
50
|
-
}
|
|
51
|
-
comments {
|
|
52
|
-
uid
|
|
53
|
-
created_at
|
|
54
|
-
author {
|
|
55
|
-
firstname
|
|
56
|
-
lastname
|
|
57
|
-
}
|
|
58
|
-
text
|
|
59
|
-
attachments {
|
|
60
|
-
name
|
|
61
|
-
url
|
|
62
|
-
}
|
|
63
|
-
}
|
|
64
|
-
items {
|
|
65
|
-
uid
|
|
66
|
-
product {
|
|
67
|
-
name
|
|
68
|
-
sku
|
|
69
|
-
uid
|
|
70
|
-
stock_status
|
|
71
|
-
}
|
|
72
|
-
prices {
|
|
73
|
-
price {
|
|
74
|
-
currency
|
|
75
|
-
value
|
|
76
|
-
}
|
|
77
|
-
original_item_price {
|
|
78
|
-
currency
|
|
79
|
-
value
|
|
80
|
-
}
|
|
81
|
-
row_total {
|
|
82
|
-
currency
|
|
83
|
-
value
|
|
84
|
-
}
|
|
85
|
-
catalog_discount {
|
|
86
|
-
amount_off
|
|
87
|
-
percent_off
|
|
88
|
-
}
|
|
89
|
-
discounts {
|
|
90
|
-
label
|
|
91
|
-
value
|
|
92
|
-
amount {
|
|
93
|
-
currency
|
|
94
|
-
value
|
|
95
|
-
}
|
|
96
|
-
}
|
|
97
|
-
}
|
|
98
|
-
quantity
|
|
99
|
-
note_from_buyer {
|
|
100
|
-
created_at
|
|
101
|
-
creator_id
|
|
102
|
-
creator_type
|
|
103
|
-
# negotiable_quote_template_item_uid
|
|
104
|
-
note
|
|
105
|
-
note_uid
|
|
106
|
-
}
|
|
107
|
-
note_from_seller {
|
|
108
|
-
created_at
|
|
109
|
-
creator_id
|
|
110
|
-
creator_type
|
|
111
|
-
# negotiable_quote_template_item_uid
|
|
112
|
-
note
|
|
113
|
-
note_uid
|
|
114
|
-
}
|
|
115
|
-
... on ConfigurableCartItem {
|
|
116
|
-
configurable_options {
|
|
117
|
-
option_label
|
|
118
|
-
value_label
|
|
119
|
-
}
|
|
120
|
-
}
|
|
121
|
-
... on BundleCartItem {
|
|
122
|
-
bundle_options {
|
|
123
|
-
label
|
|
124
|
-
values {
|
|
125
|
-
label
|
|
126
|
-
quantity
|
|
127
|
-
original_price {
|
|
128
|
-
currency
|
|
129
|
-
value
|
|
130
|
-
}
|
|
131
|
-
priceV2 {
|
|
132
|
-
currency
|
|
133
|
-
value
|
|
134
|
-
}
|
|
135
|
-
}
|
|
136
|
-
}
|
|
137
|
-
}
|
|
138
|
-
}
|
|
139
|
-
history {
|
|
140
|
-
uid
|
|
141
|
-
created_at
|
|
142
|
-
author {
|
|
143
|
-
firstname
|
|
144
|
-
lastname
|
|
145
|
-
}
|
|
146
|
-
change_type
|
|
147
|
-
changes {
|
|
148
|
-
comment_added {
|
|
149
|
-
comment
|
|
150
|
-
}
|
|
151
|
-
custom_changes {
|
|
152
|
-
new_value
|
|
153
|
-
old_value
|
|
154
|
-
title
|
|
155
|
-
}
|
|
156
|
-
statuses {
|
|
157
|
-
changes {
|
|
158
|
-
new_status
|
|
159
|
-
old_status
|
|
160
|
-
}
|
|
161
|
-
}
|
|
162
|
-
expiration {
|
|
163
|
-
new_expiration
|
|
164
|
-
old_expiration
|
|
165
|
-
}
|
|
166
|
-
total {
|
|
167
|
-
new_price {
|
|
168
|
-
currency
|
|
169
|
-
value
|
|
170
|
-
}
|
|
171
|
-
old_price {
|
|
172
|
-
currency
|
|
173
|
-
value
|
|
174
|
-
}
|
|
175
|
-
}
|
|
176
|
-
}
|
|
177
|
-
}
|
|
178
|
-
prices {
|
|
179
|
-
subtotal_excluding_tax {
|
|
180
|
-
currency
|
|
181
|
-
value
|
|
182
|
-
}
|
|
183
|
-
subtotal_including_tax {
|
|
184
|
-
currency
|
|
185
|
-
value
|
|
186
|
-
}
|
|
187
|
-
subtotal_with_discount_excluding_tax {
|
|
188
|
-
currency
|
|
189
|
-
value
|
|
190
|
-
}
|
|
191
|
-
applied_taxes {
|
|
192
|
-
amount {
|
|
193
|
-
currency
|
|
194
|
-
value
|
|
195
|
-
}
|
|
196
|
-
label
|
|
197
|
-
}
|
|
198
|
-
grand_total {
|
|
199
|
-
currency
|
|
200
|
-
value
|
|
201
|
-
}
|
|
202
|
-
}
|
|
203
|
-
shipping_addresses {
|
|
204
|
-
uid
|
|
205
|
-
firstname
|
|
206
|
-
lastname
|
|
207
|
-
company
|
|
208
|
-
street
|
|
209
|
-
city
|
|
210
|
-
region {
|
|
211
|
-
code
|
|
212
|
-
label
|
|
213
|
-
region_id
|
|
214
|
-
}
|
|
215
|
-
postcode
|
|
216
|
-
country {
|
|
217
|
-
code
|
|
218
|
-
label
|
|
219
|
-
}
|
|
220
|
-
telephone
|
|
221
|
-
}
|
|
222
|
-
}
|
|
223
|
-
`,M=`
|
|
37
|
+
${w}
|
|
38
|
+
`;function M(e){const{additionalInput:o,...t}=e,a={city:t.city,company:t.company,country_code:t.countryCode,firstname:t.firstname,lastname:t.lastname,postcode:t.postcode,region:t.region,region_id:t.regionId,save_in_address_book:t.saveInAddressBook,street:t.street,telephone:t.telephone};return{...o||{},...a}}const Z=async e=>{const{quoteUid:o,addressId:t,addressData:a}=e;if(!o)throw new Error("Quote UID is required");if(t===void 0&&!a)throw new Error("Either addressId or addressData must be provided");if(t!==void 0&&a)throw new Error("Cannot provide both addressId and addressData");const s=a?M(a):null;return n(O,{variables:{quoteUid:o,addressId:t||null,addressData:s}}).then(d=>{var _,g;const{errors:c}=d;if(c){const f=c.map(Q=>Q.message).join("; ");throw new Error(`Failed to set shipping address: ${f}`)}const l=N((g=(_=d.data)==null?void 0:_.setNegotiableQuoteShippingAddress)==null?void 0:g.quote);if(!l)throw new Error("Failed to transform quote data: Invalid response structure");return i.emit("quote-management/shipping-address-set",{quote:l,input:{quoteUid:o,addressId:t,addressData:a}}),l})},L=`
|
|
224
39
|
query QUOTE_TEMPLATE_DATA_QUERY($templateId: ID!) {
|
|
225
40
|
negotiableQuoteTemplate(templateId: $templateId) {
|
|
226
41
|
...NegotiableQuoteTemplateFragment
|
|
227
42
|
}
|
|
228
43
|
}
|
|
229
44
|
|
|
230
|
-
${
|
|
231
|
-
`,
|
|
232
|
-
mutation CREATE_QUOTE_TEMPLATE_MUTATION($cartId: ID!) {
|
|
233
|
-
requestNegotiableQuoteTemplateFromQuote(input: { cart_id: $cartId }) {
|
|
234
|
-
...NegotiableQuoteTemplateFragment
|
|
235
|
-
}
|
|
236
|
-
}
|
|
237
|
-
|
|
238
|
-
${m}
|
|
239
|
-
`,ee=async t=>{var o;if(!r.authenticated)throw new Error("Unauthorized");if(!t)throw new Error("Cart ID is required");try{const e=await n(F,{variables:{cartId:t}});if(!((o=e==null?void 0:e.data)!=null&&o.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:r.permissions}),a}catch(e){return Promise.reject(e)}},P=`
|
|
240
|
-
mutation SEND_QUOTE_TEMPLATE_FOR_REVIEW_MUTATION(
|
|
241
|
-
$templateId: ID!
|
|
242
|
-
$comment: String
|
|
243
|
-
$name: String
|
|
244
|
-
) {
|
|
245
|
-
submitNegotiableQuoteTemplateForReview(input: { template_id: $templateId, name: $name, comment: $comment }) {
|
|
246
|
-
...NegotiableQuoteTemplateFragment
|
|
247
|
-
}
|
|
248
|
-
}
|
|
249
|
-
${m}
|
|
250
|
-
`,te=async t=>{var o;if(!t.templateId)throw new Error("Template ID is required");if(!r.authenticated)throw new Error("Unauthorized");try{const e=await n(P,{variables:{templateId:t.templateId,name:t.name,comment:t.comment}});if(!((o=e==null?void 0:e.data)!=null&&o.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:r.permissions}),a}catch(e){return Promise.reject(e)}},S=`
|
|
45
|
+
${u}
|
|
46
|
+
`,F=async e=>{var o;if(!r.authenticated)throw new Error("Unauthorized");if(!e)throw new Error("Template ID is required");try{const t=await n(L,{variables:{templateId:e}});if(!((o=t==null?void 0:t.data)!=null&&o.negotiableQuoteTemplate))throw new Error("Quote template not found");const a=m(t.data.negotiableQuoteTemplate);if(!a)throw new Error("Failed to transform quote template data");return i.emit("quote-management/quote-template-data",{quoteTemplate:a,permissions:r.permissions}),a}catch(t){return Promise.reject(t)}},S=`
|
|
251
47
|
mutation ACCEPT_QUOTE_TEMPLATE_MUTATION($templateId: ID!) {
|
|
252
48
|
acceptNegotiableQuoteTemplate(input: { template_id: $templateId }) {
|
|
253
49
|
...NegotiableQuoteTemplateFragment
|
|
254
50
|
}
|
|
255
51
|
}
|
|
256
52
|
|
|
257
|
-
${
|
|
258
|
-
`,
|
|
53
|
+
${u}
|
|
54
|
+
`,ee=async e=>{var o;if(!e.templateId)throw new Error("Template ID is required");if(!r.authenticated)throw new Error("Unauthorized");try{const t=await n(S,{variables:{templateId:e.templateId}});if(!((o=t==null?void 0:t.data)!=null&&o.acceptNegotiableQuoteTemplate))throw new Error("No quote template data received");const a=m(t.data.acceptNegotiableQuoteTemplate);if(!a)throw new Error("Failed to transform quote template data");return i.emit("quote-management/quote-template-data",{quoteTemplate:a,permissions:r.permissions}),a}catch(t){return Promise.reject(t)}},P=`
|
|
259
55
|
mutation CANCEL_QUOTE_TEMPLATE_MUTATION(
|
|
260
56
|
$templateId: ID!
|
|
261
57
|
$comment: String
|
|
@@ -269,20 +65,20 @@ import{r as ce,u as _e}from"./chunks/uploadFile.js";import{g as Q}from"./chunks/
|
|
|
269
65
|
...NegotiableQuoteTemplateFragment
|
|
270
66
|
}
|
|
271
67
|
}
|
|
272
|
-
${
|
|
273
|
-
`,
|
|
68
|
+
${u}
|
|
69
|
+
`,te=async e=>{var o;if(!e.templateId)throw new Error("Template ID is required");if(!r.authenticated)throw new Error("Unauthorized");try{const t=await n(P,{variables:{templateId:e.templateId,comment:e.comment}});if(!((o=t==null?void 0:t.data)!=null&&o.cancelNegotiableQuoteTemplate))throw new Error("No quote template data received");const a=m(t.data.cancelNegotiableQuoteTemplate);if(!a)throw new Error("Failed to transform quote template data");return i.emit("quote-management/quote-template-data",{quoteTemplate:a,permissions:r.permissions}),a}catch(t){return Promise.reject(t)}},v=`
|
|
274
70
|
mutation DELETE_QUOTE_TEMPLATE_MUTATION($templateId: ID!) {
|
|
275
71
|
deleteNegotiableQuoteTemplate(input: { template_id: $templateId })
|
|
276
72
|
}
|
|
277
|
-
`,
|
|
73
|
+
`,ae=async e=>{var o;if(!e.templateId)throw new Error("Template ID is required");if(!r.authenticated)throw new Error("Unauthorized");try{const t=await n(v,{variables:{templateId:e.templateId}});if(t!=null&&t.errors&&t.errors.length>0){const s=t.errors.map(d=>d==null?void 0:d.message).filter(Boolean).join("; ");throw new Error(s||"Failed to delete quote template")}if(!((o=t==null?void 0:t.data)==null?void 0:o.deleteNegotiableQuoteTemplate))throw new Error("Failed to delete quote template");return i.emit("quote-management/quote-template-deleted",{templateId:e.templateId}),{templateId:e.templateId}}catch(t){return Promise.reject(t)}},$=`
|
|
278
74
|
mutation OPEN_QUOTE_TEMPLATE_MUTATION($templateId: ID!) {
|
|
279
75
|
openNegotiableQuoteTemplate(input: { template_id: $templateId }) {
|
|
280
76
|
...NegotiableQuoteTemplateFragment
|
|
281
77
|
}
|
|
282
78
|
}
|
|
283
79
|
|
|
284
|
-
${
|
|
285
|
-
`,
|
|
80
|
+
${u}
|
|
81
|
+
`,oe=async e=>{var o;if(!e.templateId)throw new Error("Template ID is required");if(!r.authenticated)throw new Error("Unauthorized");try{const t=await n($,{variables:{templateId:e.templateId}});if(!((o=t==null?void 0:t.data)!=null&&o.openNegotiableQuoteTemplate))throw new Error("No quote template data received");const a=m(t.data.openNegotiableQuoteTemplate);if(!a)throw new Error("Failed to transform quote template data");return i.emit("quote-management/quote-template-data",{quoteTemplate:a,permissions:r.permissions}),a}catch(t){return Promise.reject(t)}},G=`
|
|
286
82
|
mutation SET_NEGOTIABLE_QUOTE_TEMPLATE_SHIPPING_ADDRESS_MUTATION(
|
|
287
83
|
$templateId: ID!
|
|
288
84
|
$shippingAddress: NegotiableQuoteTemplateShippingAddressInput!
|
|
@@ -297,8 +93,8 @@ import{r as ce,u as _e}from"./chunks/uploadFile.js";import{g as Q}from"./chunks/
|
|
|
297
93
|
}
|
|
298
94
|
}
|
|
299
95
|
|
|
300
|
-
${
|
|
301
|
-
`,
|
|
96
|
+
${u}
|
|
97
|
+
`,re=async e=>{var o;if(!e.templateId)throw new Error("Template ID is required");if(!e.shippingAddress)throw new Error("Shipping address is required");if(!r.authenticated)throw new Error("Unauthorized");if(!e.shippingAddress.address&&!e.shippingAddress.customerAddressUid)throw new Error("Either address or customerAddressUid must be provided");try{const t=await n(G,{variables:{templateId:e.templateId,shippingAddress:{address:e.shippingAddress.address?{city:e.shippingAddress.address.city,company:e.shippingAddress.address.company,country_code:e.shippingAddress.address.countryCode,fax:e.shippingAddress.address.fax,firstname:e.shippingAddress.address.firstname,lastname:e.shippingAddress.address.lastname,middlename:e.shippingAddress.address.middlename,postcode:e.shippingAddress.address.postcode,prefix:e.shippingAddress.address.prefix,region:e.shippingAddress.address.region,region_id:e.shippingAddress.address.regionId,save_in_address_book:e.shippingAddress.address.saveInAddressBook,street:e.shippingAddress.address.street,suffix:e.shippingAddress.address.suffix,telephone:e.shippingAddress.address.telephone,vat_id:e.shippingAddress.address.vatId}:void 0,customer_address_uid:e.shippingAddress.customerAddressUid,customer_notes:e.shippingAddress.customerNotes}}});if(!((o=t==null?void 0:t.data)!=null&&o.setNegotiableQuoteTemplateShippingAddress))throw new Error("No quote template data received");const a=m(t.data.setNegotiableQuoteTemplateShippingAddress);if(!a)throw new Error("Failed to transform quote template data");return i.emit("quote-management/quote-template-data",{quoteTemplate:a,permissions:r.permissions}),a}catch(t){return Promise.reject(t)}},C=`
|
|
302
98
|
mutation UPDATE_NEGOTIABLE_QUOTE_TEMPLATE_QUANTITIES_MUTATION(
|
|
303
99
|
$input: UpdateNegotiableQuoteTemplateQuantitiesInput!
|
|
304
100
|
) {
|
|
@@ -308,8 +104,8 @@ import{r as ce,u as _e}from"./chunks/uploadFile.js";import{g as Q}from"./chunks/
|
|
|
308
104
|
}
|
|
309
105
|
}
|
|
310
106
|
}
|
|
311
|
-
${
|
|
312
|
-
`,
|
|
107
|
+
${u}
|
|
108
|
+
`,ie=async e=>{var o,t;if(!e.templateId)throw new Error("Template ID is required");if(!e.items||e.items.length===0)throw new Error("Items array is required and must not be empty");if(!r.authenticated)throw new Error("Unauthorized");try{const a=await n(C,{variables:{input:{template_id:e.templateId,items:e.items.map(d=>({item_id:d.itemId,quantity:d.quantity,min_qty:d.minQty,max_qty:d.maxQty}))}}});if(!((t=(o=a==null?void 0:a.data)==null?void 0:o.updateNegotiableQuoteTemplateQuantities)!=null&&t.quote_template))throw new Error("No quote template data received");const s=m(a.data.updateNegotiableQuoteTemplateQuantities.quote_template);if(!s)throw new Error("Failed to transform quote template data");return i.emit("quote-management/quote-template-data",{quoteTemplate:s,permissions:r.permissions}),s}catch(a){return Promise.reject(a)}},x=`
|
|
313
109
|
mutation REMOVE_NEGOTIABLE_QUOTE_TEMPLATE_ITEMS_MUTATION(
|
|
314
110
|
$input: RemoveNegotiableQuoteTemplateItemsInput!
|
|
315
111
|
) {
|
|
@@ -317,8 +113,8 @@ import{r as ce,u as _e}from"./chunks/uploadFile.js";import{g as Q}from"./chunks/
|
|
|
317
113
|
...NegotiableQuoteTemplateFragment
|
|
318
114
|
}
|
|
319
115
|
}
|
|
320
|
-
${
|
|
321
|
-
`,
|
|
116
|
+
${u}
|
|
117
|
+
`,se=async e=>{var o;if(!e.templateId)throw new Error("Template ID is required");if(!e.itemUids||e.itemUids.length===0)throw new Error("Item UIDs array is required and must not be empty");if(!r.authenticated)throw new Error("Unauthorized");try{const t=await n(x,{variables:{input:{template_id:e.templateId,item_uids:e.itemUids}}});if(!((o=t==null?void 0:t.data)!=null&&o.removeNegotiableQuoteTemplateItems))throw new Error("No quote template data received");const a=m(t.data.removeNegotiableQuoteTemplateItems);if(!a)throw new Error("Failed to transform quote template data");return i.emit("quote-management/quote-template-data",{quoteTemplate:a,permissions:r.permissions}),a}catch(t){return Promise.reject(t)}},R=`
|
|
322
118
|
mutation SET_QUOTE_TEMPLATE_LINE_ITEM_NOTE_MUTATION(
|
|
323
119
|
$input: QuoteTemplateLineItemNoteInput!
|
|
324
120
|
) {
|
|
@@ -326,8 +122,8 @@ import{r as ce,u as _e}from"./chunks/uploadFile.js";import{g as Q}from"./chunks/
|
|
|
326
122
|
...NegotiableQuoteTemplateFragment
|
|
327
123
|
}
|
|
328
124
|
}
|
|
329
|
-
${
|
|
330
|
-
`,
|
|
125
|
+
${u}
|
|
126
|
+
`,ne=async e=>{var o;if(!e.templateId)throw new Error("Template ID is required");if(!e.itemId)throw new Error("Item ID is required");if(!r.authenticated)throw new Error("Unauthorized");try{const t=await n(R,{variables:{input:{templateId:e.templateId,item_id:e.itemId,note:e.note}}});if(!((o=t==null?void 0:t.data)!=null&&o.setQuoteTemplateLineItemNote))throw new Error("No quote template data received");const a=m(t.data.setQuoteTemplateLineItemNote);if(!a)throw new Error("Failed to transform quote template data");return i.emit("quote-management/quote-template-data",{quoteTemplate:a,permissions:r.permissions}),a}catch(t){return Promise.reject(t)}},z=`
|
|
331
127
|
mutation GENERATE_NEGOTIABLE_QUOTE_FROM_TEMPLATE_MUTATION(
|
|
332
128
|
$input: GenerateNegotiableQuoteFromTemplateInput!
|
|
333
129
|
) {
|
|
@@ -335,5 +131,5 @@ import{r as ce,u as _e}from"./chunks/uploadFile.js";import{g as Q}from"./chunks/
|
|
|
335
131
|
negotiable_quote_uid
|
|
336
132
|
}
|
|
337
133
|
}
|
|
338
|
-
`,
|
|
134
|
+
`,de=async e=>{var o,t;if(!e.templateId)throw new Error("Template ID is required");if(!r.authenticated)throw new Error("Unauthorized");try{const a=await n(z,{variables:{input:{template_id:e.templateId}}});if(!((t=(o=a==null?void 0:a.data)==null?void 0:o.generateNegotiableQuoteFromTemplate)!=null&&t.negotiable_quote_uid))throw new Error("No quote UID received");const s=a.data.generateNegotiableQuoteFromTemplate.negotiable_quote_uid;return i.emit("quote-management/quote-template-generated",{quoteId:s}),{quoteId:s}}catch(a){return Promise.reject(a)}};export{fe as FilterMatchTypeEnum,Qe as NegotiableQuoteSortableField,Me as QuoteTemplateFilterStatus,Le as QuoteTemplateSortField,Fe as SortDirection,Ae as SortEnum,ee as acceptQuoteTemplate,ne as addQuoteTemplateLineItemNote,re as addQuoteTemplateShippingAddress,te as cancelQuoteTemplate,ce as closeNegotiableQuote,W as config,_e as createQuoteTemplate,ge as deleteQuote,ae as deleteQuoteTemplate,n as fetchGraphQl,de as generateQuoteFromTemplate,qe as getConfig,A as getQuoteData,F as getQuoteTemplateData,Se as getQuoteTemplates,y as getStoreConfig,T as initialize,Ne as negotiableQuotes,oe as openQuoteTemplate,be as removeFetchGraphQlHeader,Ge as removeNegotiableQuoteItems,se as removeQuoteTemplateItems,Ee as renameNegotiableQuote,pe as requestNegotiableQuote,he as sendForReview,ve as sendQuoteTemplateForReview,Ue as setEndpoint,De as setFetchGraphQlHeader,ye as setFetchGraphQlHeaders,Z as setShippingAddress,Ce as updateQuantities,ie as updateQuoteTemplateItemQuantities,le as uploadFile};
|
|
339
135
|
//# sourceMappingURL=api.js.map
|