@dropins/storefront-quote-management 0.0.1-alpha19 → 0.0.1-alpha20

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.
Files changed (122) hide show
  1. package/api/acceptQuoteTemplate/acceptQuoteTemplate.d.ts +13 -0
  2. package/api/acceptQuoteTemplate/graphql/acceptQuoteTemplate.d.ts +10 -0
  3. package/{containers/QuoteSummaryList → api/acceptQuoteTemplate}/index.d.ts +1 -2
  4. package/api/addQuoteTemplateLineItemNote/addQuoteTemplateLineItemNote.d.ts +15 -0
  5. package/api/addQuoteTemplateLineItemNote/graphql/setQuoteTemplateLineItemNote.d.ts +10 -0
  6. package/api/addQuoteTemplateLineItemNote/index.d.ts +10 -0
  7. package/api/addQuoteTemplateShippingAddress/addQuoteTemplateShippingAddress.d.ts +37 -0
  8. package/api/addQuoteTemplateShippingAddress/graphql/setNegotiableQuoteTemplateShippingAddress.d.ts +10 -0
  9. package/api/addQuoteTemplateShippingAddress/index.d.ts +10 -0
  10. package/api/cancelQuoteTemplate/cancelQuoteTemplate.d.ts +14 -0
  11. package/api/cancelQuoteTemplate/graphql/cancelQuoteTemplate.d.ts +10 -0
  12. package/api/cancelQuoteTemplate/index.d.ts +10 -0
  13. package/api/closeNegotiableQuote/closeNegotiableQuote.d.ts +31 -0
  14. package/api/closeNegotiableQuote/graphql/CloseNegotiableQuoteMutation.d.ts +2 -0
  15. package/api/closeNegotiableQuote/index.d.ts +10 -0
  16. package/api/createQuoteTemplate/createQuoteTemplate.d.ts +4 -0
  17. package/api/createQuoteTemplate/graphql/createQuoteTemplate.d.ts +10 -0
  18. package/api/createQuoteTemplate/index.d.ts +10 -0
  19. package/api/deleteQuoteTemplate/deleteQuoteTemplate.d.ts +15 -0
  20. package/api/deleteQuoteTemplate/graphql/deleteQuoteTemplate.d.ts +10 -0
  21. package/api/deleteQuoteTemplate/index.d.ts +10 -0
  22. package/api/generateQuoteFromTemplate/generateQuoteFromTemplate.d.ts +15 -0
  23. package/api/generateQuoteFromTemplate/graphql/generateNegotiableQuoteFromTemplate.d.ts +10 -0
  24. package/api/generateQuoteFromTemplate/index.d.ts +10 -0
  25. package/api/getQuoteTemplateData/getQuoteTemplateData.d.ts +4 -0
  26. package/api/getQuoteTemplateData/graphql/getQuoteTemplateData.d.ts +10 -0
  27. package/api/getQuoteTemplateData/index.d.ts +10 -0
  28. package/api/getQuoteTemplates/getQuoteTemplates.d.ts +34 -0
  29. package/api/getQuoteTemplates/graphql/getQuoteTemplates.d.ts +10 -0
  30. package/api/getQuoteTemplates/index.d.ts +10 -0
  31. package/api/graphql/NegotiableQuoteFragment.d.ts +4 -12
  32. package/api/graphql/NegotiableQuoteTemplateFragment.d.ts +10 -0
  33. package/api/index.d.ts +15 -1
  34. package/api/openQuoteTemplate/graphql/openQuoteTemplate.d.ts +10 -0
  35. package/api/openQuoteTemplate/index.d.ts +10 -0
  36. package/api/openQuoteTemplate/openQuoteTemplate.d.ts +13 -0
  37. package/api/removeQuoteTemplateItems/graphql/removeNegotiableQuoteTemplateItems.d.ts +10 -0
  38. package/api/removeQuoteTemplateItems/index.d.ts +10 -0
  39. package/api/removeQuoteTemplateItems/removeQuoteTemplateItems.d.ts +14 -0
  40. package/api/requestNegotiableQuote/graphql/RequestNegotiableQuoteMutation.d.ts +4 -12
  41. package/api/sendForReview/graphql/SendNegotiableQuoteForReviewMutation.d.ts +4 -12
  42. package/api/sendQuoteTemplateForReview/graphql/sendQuoteTemplateForReview.d.ts +10 -0
  43. package/api/sendQuoteTemplateForReview/index.d.ts +10 -0
  44. package/api/sendQuoteTemplateForReview/sendQuoteTemplateForReview.d.ts +15 -0
  45. package/api/setShippingAddress/graphql/SetNegotiableQuoteShippingAddressMutation.d.ts +4 -12
  46. package/api/updateQuantities/graphql/UpdateNegotiableQuoteQuantitiesMutation.d.ts +10 -0
  47. package/api/{getStoreConfig → updateQuantities}/index.d.ts +1 -1
  48. package/api/updateQuantities/updateQuantities.d.ts +36 -0
  49. package/api/updateQuoteTemplateItemQuantities/graphql/updateNegotiableQuoteTemplateQuantities.d.ts +10 -0
  50. package/api/updateQuoteTemplateItemQuantities/index.d.ts +10 -0
  51. package/api/updateQuoteTemplateItemQuantities/updateQuoteTemplateItemQuantities.d.ts +20 -0
  52. package/api.js +306 -32
  53. package/api.js.map +1 -1
  54. package/chunks/ItemsQuoted.js +1 -1
  55. package/chunks/ItemsQuoted.js.map +1 -1
  56. package/chunks/NegotiableQuoteFragment.js +0 -129
  57. package/chunks/NegotiableQuoteFragment.js.map +1 -1
  58. package/chunks/OrderSummaryLine.js +1 -1
  59. package/chunks/OrderSummaryLine.js.map +1 -1
  60. package/chunks/fetch-graphql.js +4 -0
  61. package/chunks/fetch-graphql.js.map +1 -0
  62. package/chunks/getQuoteTemplates.js +50 -0
  63. package/chunks/getQuoteTemplates.js.map +1 -0
  64. package/chunks/negotiableQuotes.js +1 -1
  65. package/chunks/negotiableQuotes.js.map +1 -1
  66. package/chunks/renameNegotiableQuote.js +46 -4
  67. package/chunks/renameNegotiableQuote.js.map +1 -1
  68. package/chunks/state.js +1 -1
  69. package/chunks/state.js.map +1 -1
  70. package/chunks/updateQuantities.js +21 -0
  71. package/chunks/updateQuantities.js.map +1 -0
  72. package/chunks/uploadFile.js +1 -1
  73. package/chunks/uploadFile.js.map +1 -1
  74. package/components/ProductListTable/ProductListTable.d.ts +1 -0
  75. package/components/QuoteTemplatesListTable/QuoteTemplatesListTable.d.ts +30 -0
  76. package/components/QuoteTemplatesListTable/index.d.ts +10 -0
  77. package/components/index.d.ts +2 -0
  78. package/containers/ItemsQuoted/ItemsQuoted.d.ts +1 -1
  79. package/containers/ItemsQuoted.js +1 -1
  80. package/containers/ManageNegotiableQuote.js +1 -1
  81. package/containers/ManageNegotiableQuote.js.map +1 -1
  82. package/containers/OrderSummary.js +1 -1
  83. package/containers/OrderSummary.js.map +1 -1
  84. package/containers/OrderSummaryLine.js +1 -1
  85. package/containers/QuoteTemplatesListTable/QuoteTemplatesListTable.d.ts +74 -0
  86. package/containers/QuoteTemplatesListTable/index.d.ts +11 -0
  87. package/containers/QuoteTemplatesListTable.d.ts +3 -0
  88. package/containers/QuoteTemplatesListTable.js +4 -0
  89. package/containers/QuoteTemplatesListTable.js.map +1 -0
  90. package/containers/QuotesListTable.js +1 -1
  91. package/containers/QuotesListTable.js.map +1 -1
  92. package/containers/RequestNegotiableQuoteForm.js +1 -1
  93. package/containers/RequestNegotiableQuoteForm.js.map +1 -1
  94. package/containers/index.d.ts +3 -3
  95. package/data/models/__fixtures__/negotiableQuoteModel.d.ts +0 -1
  96. package/data/models/__fixtures__/negotiableQuoteTemplatesListModel.d.ts +5 -0
  97. package/data/models/index.d.ts +1 -0
  98. package/data/models/negotiable-quote-model.d.ts +22 -45
  99. package/data/models/negotiable-quote-template-model.d.ts +136 -0
  100. package/data/models/store-config-model.d.ts +2 -5
  101. package/data/transforms/__fixtures__/negotiableQuoteData.d.ts +2 -216
  102. package/data/transforms/__fixtures__/negotiableQuoteTemplateData.d.ts +1604 -0
  103. package/data/transforms/index.d.ts +5 -13
  104. package/data/transforms/transform-quote-template.d.ts +5 -0
  105. package/i18n/en_US.json.d.ts +25 -12
  106. package/package.json +1 -1
  107. package/render.js +3 -3
  108. package/render.js.map +1 -1
  109. package/types/state.types.d.ts +1 -1
  110. package/api/getStoreConfig/getStoreConfig.d.ts +0 -4
  111. package/api/getStoreConfig/graphql/StoreConfigQuery.d.ts +0 -10
  112. package/chunks/ChevronDown.js +0 -4
  113. package/chunks/ChevronDown.js.map +0 -1
  114. package/chunks/transform-quote.js +0 -4
  115. package/chunks/transform-quote.js.map +0 -1
  116. package/containers/QuoteSummaryList/QuoteSummaryList.d.ts +0 -51
  117. package/containers/QuoteSummaryList.d.ts +0 -3
  118. package/containers/QuoteSummaryList.js +0 -4
  119. package/containers/QuoteSummaryList.js.map +0 -1
  120. package/data/models/__fixtures__/storeConfigModel.d.ts +0 -5
  121. package/data/transforms/__fixtures__/storeConfigData.d.ts +0 -31
  122. package/data/transforms/transform-store-config.d.ts +0 -4
@@ -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 * from './sendQuoteTemplateForReview';
10
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1,15 @@
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 interface SendQuoteTemplateForReviewParams {
10
+ templateId: string;
11
+ name?: string;
12
+ comment?: string;
13
+ }
14
+ export declare const sendQuoteTemplateForReview: (params: SendQuoteTemplateForReviewParams) => Promise<import('../../data/models/negotiable-quote-template-model').NegotiableQuoteTemplateModel>;
15
+ //# sourceMappingURL=sendQuoteTemplateForReview.d.ts.map
@@ -1,18 +1,10 @@
1
1
  /********************************************************************
2
- * ADOBE CONFIDENTIAL
3
- * __________________
4
- *
5
- * Copyright 2024 Adobe
2
+ * Copyright 2025 Adobe
6
3
  * All Rights Reserved.
7
4
  *
8
- * NOTICE: All information contained herein is, and remains
9
- * the property of Adobe and its suppliers, if any. The intellectual
10
- * and technical concepts contained herein are proprietary to Adobe
11
- * and its suppliers and are protected by all applicable intellectual
12
- * property laws, including trade secret and copyright laws.
13
- * Dissemination of this information or reproduction of this material
14
- * is strictly forbidden unless prior written permission is obtained
15
- * from Adobe.
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.
16
8
  *******************************************************************/
17
9
  export declare const SET_NEGOTIABLE_QUOTE_SHIPPING_ADDRESS_MUTATION: string;
18
10
  //# sourceMappingURL=SetNegotiableQuoteShippingAddressMutation.d.ts.map
@@ -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 UPDATE_NEGOTIABLE_QUOTE_QUANTITIES_MUTATION: string;
10
+ //# sourceMappingURL=UpdateNegotiableQuoteQuantitiesMutation.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 './getStoreConfig';
9
+ export * from './updateQuantities';
10
10
  //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1,36 @@
1
+ import { NegotiableQuoteModel } from '../../data/models/negotiable-quote-model';
2
+
3
+ export interface QuantityItem {
4
+ /** The unique ID of the quote item */
5
+ quoteItemUid: string;
6
+ /** The new quantity for the item (must be greater than 0) */
7
+ quantity: number;
8
+ }
9
+ export interface UpdateQuantitiesInput {
10
+ /** The unique ID of the negotiable quote */
11
+ quoteUid: string;
12
+ /** Array of items with their new quantities */
13
+ items: QuantityItem[];
14
+ }
15
+ /**
16
+ * Updates the quantities of items in a negotiable quote.
17
+ *
18
+ * @param input - The input parameters for updating quantities
19
+ * @param input.quoteUid - The unique ID of the negotiable quote
20
+ * @param input.items - Array of items with their new quantities
21
+ * @returns Promise that resolves to the updated quote model
22
+ * @throws Error if validation fails or GraphQL operation fails
23
+ *
24
+ * @example
25
+ * ```ts
26
+ * const quote = await updateQuantities({
27
+ * quoteUid: 'quote-123',
28
+ * items: [
29
+ * { quoteItemUid: 'item-1', quantity: 5 },
30
+ * { quoteItemUid: 'item-2', quantity: 3 }
31
+ * ]
32
+ * });
33
+ * ```
34
+ */
35
+ export declare const updateQuantities: (input: UpdateQuantitiesInput) => Promise<NegotiableQuoteModel | null>;
36
+ //# sourceMappingURL=updateQuantities.d.ts.map
@@ -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 UPDATE_NEGOTIABLE_QUOTE_TEMPLATE_QUANTITIES_MUTATION: string;
10
+ //# sourceMappingURL=updateNegotiableQuoteTemplateQuantities.d.ts.map
@@ -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 * from './updateQuoteTemplateItemQuantities';
10
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1,20 @@
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 interface NegotiableQuoteTemplateItemQuantityInput {
10
+ itemId: string;
11
+ quantity: number;
12
+ minQty?: number;
13
+ maxQty?: number;
14
+ }
15
+ export interface UpdateQuoteTemplateItemQuantitiesParams {
16
+ templateId: string;
17
+ items: NegotiableQuoteTemplateItemQuantityInput[];
18
+ }
19
+ export declare const updateQuoteTemplateItemQuantities: (params: UpdateQuoteTemplateItemQuantitiesParams) => Promise<import('../../data/models/negotiable-quote-template-model').NegotiableQuoteTemplateModel>;
20
+ //# sourceMappingURL=updateQuoteTemplateItemQuantities.d.ts.map
package/api.js CHANGED
@@ -1,6 +1,6 @@
1
1
  /*! Copyright 2025 Adobe
2
2
  All Rights Reserved. */
3
- import{s,D as i,Q as d}from"./chunks/state.js";import{events as n}from"@dropins/tools/event-bus.js";import{f as c,t as h}from"./chunks/transform-quote.js";import{d as Y,r as B,s as V,b as K,c as J}from"./chunks/transform-quote.js";import{r as Z,u as ee}from"./chunks/uploadFile.js";import{N as E}from"./chunks/NegotiableQuoteFragment.js";import{F as oe,N as re,S as se,n as ne}from"./chunks/negotiableQuotes.js";import{d as ae,r as ue,s as de}from"./chunks/renameNegotiableQuote.js";import{Initializer as y}from"@dropins/tools/lib.js";import"@dropins/tools/fetch-graphql.js";const p=new y({init:async t=>{const e={};p.config.setConfig({...e,...t}),s.config||(s.config=await F())},listeners:()=>[n.on("authenticated",async t=>{s.authenticated=!!t,t?R().then(e=>{s.permissions={requestQuote:e.permissions.canRequestQuote,editQuote:e.permissions.canEditQuote,deleteQuote:e.permissions.canDeleteQuote,checkoutQuote:e.permissions.canCheckoutQuote},n.emit("quote-management/permissions",s.permissions)}).catch(e=>{console.error(e),s.permissions=i,n.emit("quote-management/permissions",i)}):(s.permissions=i,n.emit("quote-management/permissions",i))},{eager:!0}),n.on("quote-management/permissions",async t=>{const e=p.config.getConfig().quoteId;e&&t.editQuote&&O(e).then(o=>{n.emit("quote-management/quote-data/initialized",{quote:o,permissions:t},{})}).catch(o=>{n.emit("quote-management/quote-data/error",{error:o})})},{eager:!0})]}),k=p.config,T=`
3
+ import{D as l,s as r}from"./chunks/state.js";import{events as i}from"@dropins/tools/event-bus.js";import{f as s,t as I}from"./chunks/fetch-graphql.js";import{d as _e,r as ge,s as he,b as Ie,c as Qe}from"./chunks/fetch-graphql.js";import{r as we,u as Ne}from"./chunks/uploadFile.js";import{g as Q}from"./chunks/renameNegotiableQuote.js";import{c as qe,d as be,r as Ue,s as Oe}from"./chunks/renameNegotiableQuote.js";import{F as Me,N as De,S as ve,n as Se}from"./chunks/negotiableQuotes.js";import{N as f}from"./chunks/NegotiableQuoteFragment.js";import{t as u}from"./chunks/getQuoteTemplates.js";import{Q as Pe,a as $e,S as Le,g as Re}from"./chunks/getQuoteTemplates.js";import{u as xe}from"./chunks/updateQuantities.js";import{Initializer as w}from"@dropins/tools/lib.js";import"@dropins/tools/fetch-graphql.js";const N=`
4
4
  fragment CUSTOMER_FRAGMENT on Customer {
5
5
  role {
6
6
  permissions {
@@ -17,41 +17,15 @@ import{s,D as i,Q as d}from"./chunks/state.js";import{events as n}from"@dropins/
17
17
  }
18
18
  }
19
19
  }
20
- `,q=`
20
+ `,A=`
21
21
  query CUSTOMER_QUERY {
22
22
  customer {
23
23
  ...CUSTOMER_FRAGMENT
24
24
  }
25
25
  }
26
26
 
27
- ${T}
28
- `,I="All/Quotes/View/Request, Edit, Delete",D="All/Quotes/View/Request, Edit, Delete",S="All/Quotes/View/Request, Edit, Delete",A="All/Quotes/View/Checkout with quote",C=t=>{const e=[],o=(r,m=[])=>{for(const a of r){const u=[...m,a.text];a.children&&a.children.length>0?o(a.children,u):e.push(u.join("/"))}};return o(t),e};function U(t){const{role:e}=t;if(!e)return{permissions:{canRequestQuote:i.requestQuote,canEditQuote:i.editQuote,canDeleteQuote:i.deleteQuote,canCheckoutQuote:i.checkoutQuote}};const{permissions:o}=e,r=C(o);return{permissions:{canRequestQuote:r.includes(I),canEditQuote:r.includes(D),canDeleteQuote:r.includes(S),canCheckoutQuote:r.includes(A)}}}function N(t){if(!t)return null;const e=o=>[d.TAX_EXCLUDED,d.TAX_INCLUDED,d.TAX_INCLUDED_AND_EXCLUDED].includes(o)?o:d.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:e(t.shopping_cart_display_subtotal),price:e(t.shopping_cart_display_price),shipping:e(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 R=async()=>{var t;if(!s.authenticated)return Promise.reject(new Error("Unauthorized"));try{const e=await c(q);if(!((t=e==null?void 0:e.data)!=null&&t.customer))throw new Error("No customer data received");return U(e.data.customer)}catch(e){return Promise.reject(e)}},w=`
29
- query QUOTE_DATA_QUERY(
30
- $quoteId: ID!
31
- ) {
32
- negotiableQuote(
33
- uid: $quoteId
34
- ) {
35
- ...NegotiableQuoteFragment
36
- }
37
- }
38
-
39
- ${E}
40
- `,O=async t=>{var e;if(!s.authenticated)return Promise.reject(new Error("Unauthorized"));if(!s.permissions.editQuote)return Promise.reject(new Error("Unauthorized"));try{const o=await c(w,{variables:{quoteId:t}}),r=h((e=o==null?void 0:o.data)==null?void 0:e.negotiableQuote);if(!r)throw new Error("Failed to transform quote data");return n.emit("quote-management/quote-data",{quote:r,permissions:s.permissions}),r}catch(o){return Promise.reject(o)}},b=`
41
- query STORE_CONFIG_QUERY {
42
- storeConfig {
43
- cart_summary_display_quantity
44
- max_items_in_order_summary
45
- shopping_cart_display_full_summary
46
- shopping_cart_display_grand_total
47
- shopping_cart_display_price
48
- shopping_cart_display_shipping
49
- shopping_cart_display_subtotal
50
- shopping_cart_display_zero_tax
51
- configurable_thumbnail_source
52
- }
53
- }
54
- `,F=async()=>c(b,{method:"GET",cache:"force-cache"}).then(({errors:t,data:e})=>{if(t){const o=t.map(r=>r.message).join(", ");throw new Error(`Failed to get store config: ${o}`)}return N(e.storeConfig)}).catch(t=>Promise.reject(t)),M=`
27
+ ${N}
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=`
55
29
  mutation SET_NEGOTIABLE_QUOTE_SHIPPING_ADDRESS_MUTATION(
56
30
  $quoteUid: ID!
57
31
  $addressId: ID
@@ -71,6 +45,306 @@ import{s,D as i,Q as d}from"./chunks/state.js";import{events as n}from"@dropins/
71
45
  }
72
46
  }
73
47
  }
74
- ${E}
75
- `;function P(t){const{additionalInput:e,...o}=t,r={city:o.city,company:o.company,country_code:o.countryCode,firstname:o.firstname,lastname:o.lastname,postcode:o.postcode,region:o.region,region_id:o.regionId,save_in_address_book:o.saveInAddressBook,street:o.street,telephone:o.telephone};return{...e||{},...r}}const z=async t=>{const{quoteUid:e,addressId:o,addressData:r}=t;if(!e)throw new Error("Quote UID is required");if(o===void 0&&!r)throw new Error("Either addressId or addressData must be provided");if(o!==void 0&&r)throw new Error("Cannot provide both addressId and addressData");const m=r?P(r):null;return c(M,{variables:{quoteUid:e,addressId:o||null,addressData:m}}).then(a=>{var _,g;const{errors:u}=a;if(u){const f=u.map(Q=>Q.message).join("; ");throw new Error(`Failed to set shipping address: ${f}`)}const l=h((g=(_=a.data)==null?void 0:_.setNegotiableQuoteShippingAddress)==null?void 0:g.quote);if(!l)throw new Error("Failed to transform quote data: Invalid response structure");return n.emit("quote-management/shipping-address-set",{quote:l,input:{quoteUid:e,addressId:o,addressData:r}}),l})};export{oe as FilterMatchTypeEnum,re as NegotiableQuoteSortableField,se as SortEnum,k as config,ae as deleteQuote,c as fetchGraphQl,Y as getConfig,R as getCustomerData,O as getQuoteData,F as getStoreConfig,p as initialize,ne as negotiableQuotes,B as removeFetchGraphQlHeader,ue as renameNegotiableQuote,Z as requestNegotiableQuote,de as sendForReview,V as setEndpoint,K as setFetchGraphQlHeader,J as setFetchGraphQlHeaders,z as setShippingAddress,ee as uploadFile};
48
+ ${f}
49
+ `;function S(t){const{additionalInput:o,...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{...o||{},...a}}const te=async t=>{const{quoteUid:o,addressId:e,addressData:a}=t;if(!o)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?S(a):null;return s(v,{variables:{quoteUid:o,addressId:e||null,addressData:d}}).then(n=>{var E,_;const{errors:p}=n;if(p){const g=p.map(h=>h.message).join("; ");throw new Error(`Failed to set shipping address: ${g}`)}const c=I((_=(E=n.data)==null?void 0:E.setNegotiableQuoteShippingAddress)==null?void 0:_.quote);if(!c)throw new Error("Failed to transform quote data: Invalid response structure");return i.emit("quote-management/shipping-address-set",{quote:c,input:{quoteUid:o,addressId:e,addressData:a}}),c})},m=`
50
+ fragment NegotiableQuoteTemplateFragment on NegotiableQuoteTemplate {
51
+ # uid
52
+ name
53
+ # created_at
54
+ # updated_at
55
+ status
56
+ # sales_rep_name
57
+ expiration_date
58
+ buyer {
59
+ firstname
60
+ lastname
61
+ }
62
+ comments {
63
+ uid
64
+ created_at
65
+ author {
66
+ firstname
67
+ lastname
68
+ }
69
+ text
70
+ attachments {
71
+ name
72
+ url
73
+ }
74
+ }
75
+ items {
76
+ uid
77
+ product {
78
+ name
79
+ sku
80
+ uid
81
+ stock_status
82
+ }
83
+ prices {
84
+ price {
85
+ currency
86
+ value
87
+ }
88
+ original_item_price {
89
+ currency
90
+ value
91
+ }
92
+ row_total {
93
+ currency
94
+ value
95
+ }
96
+ catalog_discount {
97
+ amount_off
98
+ percent_off
99
+ }
100
+ discounts {
101
+ label
102
+ value
103
+ amount {
104
+ currency
105
+ value
106
+ }
107
+ }
108
+ }
109
+ quantity
110
+ note_from_buyer {
111
+ created_at
112
+ creator_id
113
+ creator_type
114
+ # negotiable_quote_template_item_uid
115
+ note
116
+ note_uid
117
+ }
118
+ note_from_seller {
119
+ created_at
120
+ creator_id
121
+ creator_type
122
+ # negotiable_quote_template_item_uid
123
+ note
124
+ note_uid
125
+ }
126
+ ... on ConfigurableCartItem {
127
+ configurable_options {
128
+ option_label
129
+ value_label
130
+ }
131
+ }
132
+ ... on BundleCartItem {
133
+ bundle_options {
134
+ label
135
+ values {
136
+ label
137
+ quantity
138
+ original_price {
139
+ currency
140
+ value
141
+ }
142
+ priceV2 {
143
+ currency
144
+ value
145
+ }
146
+ }
147
+ }
148
+ }
149
+ }
150
+ history {
151
+ uid
152
+ created_at
153
+ author {
154
+ firstname
155
+ lastname
156
+ }
157
+ change_type
158
+ changes {
159
+ comment_added {
160
+ comment
161
+ }
162
+ custom_changes {
163
+ new_value
164
+ old_value
165
+ title
166
+ }
167
+ statuses {
168
+ changes {
169
+ new_status
170
+ old_status
171
+ }
172
+ }
173
+ expiration {
174
+ new_expiration
175
+ old_expiration
176
+ }
177
+ total {
178
+ new_price {
179
+ currency
180
+ value
181
+ }
182
+ old_price {
183
+ currency
184
+ value
185
+ }
186
+ }
187
+ }
188
+ }
189
+ prices {
190
+ subtotal_excluding_tax {
191
+ currency
192
+ value
193
+ }
194
+ subtotal_including_tax {
195
+ currency
196
+ value
197
+ }
198
+ subtotal_with_discount_excluding_tax {
199
+ currency
200
+ value
201
+ }
202
+ applied_taxes {
203
+ amount {
204
+ currency
205
+ value
206
+ }
207
+ label
208
+ }
209
+ grand_total {
210
+ currency
211
+ value
212
+ }
213
+ }
214
+ shipping_addresses {
215
+ uid
216
+ firstname
217
+ lastname
218
+ company
219
+ street
220
+ city
221
+ region {
222
+ code
223
+ label
224
+ region_id
225
+ }
226
+ postcode
227
+ country {
228
+ code
229
+ label
230
+ }
231
+ telephone
232
+ }
233
+ }
234
+ `,F=`
235
+ query QUOTE_TEMPLATE_DATA_QUERY($templateId: ID!) {
236
+ negotiableQuoteTemplate(templateId: $templateId) {
237
+ ...NegotiableQuoteTemplateFragment
238
+ }
239
+ }
240
+
241
+ ${m}
242
+ `,oe=async t=>{var o;if(!r.authenticated)throw new Error("Unauthorized");if(!t)throw new Error("Template ID is required");try{const e=await s(F,{variables:{templateId:t}});if(!((o=e==null?void 0:e.data)!=null&&o.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:r.permissions}),a}catch(e){return Promise.reject(e)}},P=`
243
+ mutation CREATE_QUOTE_TEMPLATE_MUTATION($cartId: ID!) {
244
+ requestNegotiableQuoteTemplateFromQuote(input: { cart_id: $cartId }) {
245
+ ...NegotiableQuoteTemplateFragment
246
+ }
247
+ }
248
+
249
+ ${m}
250
+ `,ae=async t=>{var o;if(!r.authenticated)throw new Error("Unauthorized");if(!t)throw new Error("Cart ID is required");try{const e=await s(P,{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)}},$=`
251
+ mutation SEND_QUOTE_TEMPLATE_FOR_REVIEW_MUTATION(
252
+ $templateId: ID!
253
+ $comment: String
254
+ $name: String
255
+ ) {
256
+ submitNegotiableQuoteTemplateForReview(input: { template_id: $templateId, name: $name, comment: $comment }) {
257
+ ...NegotiableQuoteTemplateFragment
258
+ }
259
+ }
260
+ ${m}
261
+ `,re=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 s($,{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)}},L=`
262
+ mutation ACCEPT_QUOTE_TEMPLATE_MUTATION($templateId: ID!) {
263
+ acceptNegotiableQuoteTemplate(input: { template_id: $templateId }) {
264
+ ...NegotiableQuoteTemplateFragment
265
+ }
266
+ }
267
+
268
+ ${m}
269
+ `,ie=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 s(L,{variables:{templateId:t.templateId}});if(!((o=e==null?void 0:e.data)!=null&&o.acceptNegotiableQuoteTemplate))throw new Error("No quote template data received");const a=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:r.permissions}),a}catch(e){return Promise.reject(e)}},R=`
270
+ mutation CANCEL_QUOTE_TEMPLATE_MUTATION(
271
+ $templateId: ID!
272
+ $comment: String
273
+ ) {
274
+ cancelNegotiableQuoteTemplate(
275
+ input: {
276
+ template_id: $templateId
277
+ cancellation_comment: $comment
278
+ }
279
+ ) {
280
+ ...NegotiableQuoteTemplateFragment
281
+ }
282
+ }
283
+ ${m}
284
+ `,ne=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 s(R,{variables:{templateId:t.templateId,comment:t.comment}});if(!((o=e==null?void 0:e.data)!=null&&o.cancelNegotiableQuoteTemplate))throw new Error("No quote template data received");const a=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:r.permissions}),a}catch(e){return Promise.reject(e)}},C=`
285
+ mutation DELETE_QUOTE_TEMPLATE_MUTATION($templateId: ID!) {
286
+ deleteNegotiableQuoteTemplate(input: { template_id: $templateId })
287
+ }
288
+ `,se=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 s(C,{variables:{templateId:t.templateId}});if(e!=null&&e.errors&&e.errors.length>0){const d=e.errors.map(n=>n==null?void 0:n.message).filter(Boolean).join("; ");throw new Error(d||"Failed to delete quote template")}if(!((o=e==null?void 0:e.data)==null?void 0:o.deleteNegotiableQuoteTemplate))throw new Error("Failed to delete quote template");return i.emit("quote-management/quote-template-deleted",{templateId:t.templateId}),{templateId:t.templateId}}catch(e){return Promise.reject(e)}},x=`
289
+ mutation OPEN_QUOTE_TEMPLATE_MUTATION($templateId: ID!) {
290
+ openNegotiableQuoteTemplate(input: { template_id: $templateId }) {
291
+ ...NegotiableQuoteTemplateFragment
292
+ }
293
+ }
294
+
295
+ ${m}
296
+ `,de=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 s(x,{variables:{templateId:t.templateId}});if(!((o=e==null?void 0:e.data)!=null&&o.openNegotiableQuoteTemplate))throw new Error("No quote template data received");const a=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:r.permissions}),a}catch(e){return Promise.reject(e)}},G=`
297
+ mutation SET_NEGOTIABLE_QUOTE_TEMPLATE_SHIPPING_ADDRESS_MUTATION(
298
+ $templateId: ID!
299
+ $shippingAddress: NegotiableQuoteTemplateShippingAddressInput!
300
+ ) {
301
+ setNegotiableQuoteTemplateShippingAddress(
302
+ input: {
303
+ template_id: $templateId
304
+ shipping_address: $shippingAddress
305
+ }
306
+ ) {
307
+ ...NegotiableQuoteTemplateFragment
308
+ }
309
+ }
310
+
311
+ ${m}
312
+ `,ue=async t=>{var o;if(!t.templateId)throw new Error("Template ID is required");if(!t.shippingAddress)throw new Error("Shipping address is required");if(!r.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 s(G,{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(!((o=e==null?void 0:e.data)!=null&&o.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:r.permissions}),a}catch(e){return Promise.reject(e)}},j=`
313
+ mutation UPDATE_NEGOTIABLE_QUOTE_TEMPLATE_QUANTITIES_MUTATION(
314
+ $input: UpdateNegotiableQuoteTemplateQuantitiesInput!
315
+ ) {
316
+ updateNegotiableQuoteTemplateQuantities(input: $input) {
317
+ quote_template {
318
+ ...NegotiableQuoteTemplateFragment
319
+ }
320
+ }
321
+ }
322
+ ${m}
323
+ `,me=async t=>{var o,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(!r.authenticated)throw new Error("Unauthorized");try{const a=await s(j,{variables:{input:{template_id:t.templateId,items:t.items.map(n=>({item_id:n.itemId,quantity:n.quantity,min_qty:n.minQty,max_qty:n.maxQty}))}}});if(!((e=(o=a==null?void 0:a.data)==null?void 0:o.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:r.permissions}),d}catch(a){return Promise.reject(a)}},z=`
324
+ mutation REMOVE_NEGOTIABLE_QUOTE_TEMPLATE_ITEMS_MUTATION(
325
+ $input: RemoveNegotiableQuoteTemplateItemsInput!
326
+ ) {
327
+ removeNegotiableQuoteTemplateItems(input: $input) {
328
+ ...NegotiableQuoteTemplateFragment
329
+ }
330
+ }
331
+ ${m}
332
+ `,le=async t=>{var o;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(!r.authenticated)throw new Error("Unauthorized");try{const e=await s(z,{variables:{input:{template_id:t.templateId,item_uids:t.itemUids}}});if(!((o=e==null?void 0:e.data)!=null&&o.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:r.permissions}),a}catch(e){return Promise.reject(e)}},B=`
333
+ mutation SET_QUOTE_TEMPLATE_LINE_ITEM_NOTE_MUTATION(
334
+ $input: QuoteTemplateLineItemNoteInput!
335
+ ) {
336
+ setQuoteTemplateLineItemNote(input: $input) {
337
+ ...NegotiableQuoteTemplateFragment
338
+ }
339
+ }
340
+ ${m}
341
+ `,pe=async t=>{var o;if(!t.templateId)throw new Error("Template ID is required");if(!t.itemId)throw new Error("Item ID is required");if(!r.authenticated)throw new Error("Unauthorized");try{const e=await s(B,{variables:{input:{templateId:t.templateId,item_id:t.itemId,note:t.note}}});if(!((o=e==null?void 0:e.data)!=null&&o.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:r.permissions}),a}catch(e){return Promise.reject(e)}},k=`
342
+ mutation GENERATE_NEGOTIABLE_QUOTE_FROM_TEMPLATE_MUTATION(
343
+ $input: GenerateNegotiableQuoteFromTemplateInput!
344
+ ) {
345
+ generateNegotiableQuoteFromTemplate(input: $input) {
346
+ negotiable_quote_uid
347
+ }
348
+ }
349
+ `,ce=async t=>{var o,e;if(!t.templateId)throw new Error("Template ID is required");if(!r.authenticated)throw new Error("Unauthorized");try{const a=await s(k,{variables:{input:{template_id:t.templateId}}});if(!((e=(o=a==null?void 0:a.data)==null?void 0:o.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{Me as FilterMatchTypeEnum,De as NegotiableQuoteSortableField,Pe as QuoteTemplateFilterStatus,$e as QuoteTemplateSortField,Le as SortDirection,ve as SortEnum,ie as acceptQuoteTemplate,pe as addQuoteTemplateLineItemNote,ue as addQuoteTemplateShippingAddress,ne as cancelQuoteTemplate,qe as closeNegotiableQuote,ee as config,ae as createQuoteTemplate,be as deleteQuote,se as deleteQuoteTemplate,s as fetchGraphQl,ce as generateQuoteFromTemplate,_e as getConfig,D as getCustomerData,Q as getQuoteData,oe as getQuoteTemplateData,Re as getQuoteTemplates,T as initialize,Se as negotiableQuotes,de as openQuoteTemplate,ge as removeFetchGraphQlHeader,le as removeQuoteTemplateItems,Ue as renameNegotiableQuote,we as requestNegotiableQuote,Oe as sendForReview,re as sendQuoteTemplateForReview,he as setEndpoint,Ie as setFetchGraphQlHeader,Qe as setFetchGraphQlHeaders,te as setShippingAddress,xe as updateQuantities,me as updateQuoteTemplateItemQuantities,Ne as uploadFile};
76
350
  //# sourceMappingURL=api.js.map