@dropins/storefront-quote-management 0.0.1-alpha14 → 0.0.1-alpha16

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 (62) hide show
  1. package/api/graphql/NegotiableQuoteFragment.d.ts +1 -1
  2. package/api/index.d.ts +1 -0
  3. package/api/requestNegotiableQuote/requestNegotiableQuote.d.ts +3 -0
  4. package/api/uploadFile/graphql/FinishUploadMutation.d.ts +10 -0
  5. package/api/uploadFile/graphql/InitiateUploadMutation.d.ts +10 -0
  6. package/api/uploadFile/index.d.ts +10 -0
  7. package/api/uploadFile/uploadFile.d.ts +12 -0
  8. package/api.js +8 -8
  9. package/api.js.map +1 -1
  10. package/chunks/ItemsQuoted.js +4 -0
  11. package/chunks/ItemsQuoted.js.map +1 -0
  12. package/chunks/NegotiableQuoteFragment.js +67 -21
  13. package/chunks/NegotiableQuoteFragment.js.map +1 -1
  14. package/chunks/QuoteCommentsList.js +4 -0
  15. package/chunks/QuoteCommentsList.js.map +1 -0
  16. package/chunks/QuoteHistoryLog.js +4 -0
  17. package/chunks/QuoteHistoryLog.js.map +1 -0
  18. package/chunks/ShippingAddressDisplay.js +4 -0
  19. package/chunks/ShippingAddressDisplay.js.map +1 -0
  20. package/chunks/transform-quote.js +1 -1
  21. package/chunks/transform-quote.js.map +1 -1
  22. package/chunks/uploadFile.js +41 -0
  23. package/chunks/uploadFile.js.map +1 -0
  24. package/components/QuoteCommentsList/QuoteCommentsList.d.ts +13 -0
  25. package/components/QuoteCommentsList/index.d.ts +11 -0
  26. package/components/QuoteHistoryLog/QuoteHistoryLog.d.ts +9 -0
  27. package/components/QuoteHistoryLog/index.d.ts +11 -0
  28. package/components/index.d.ts +2 -0
  29. package/containers/ItemsQuoted.js +1 -1
  30. package/containers/ItemsQuoted.js.map +1 -1
  31. package/containers/ManageNegotiableQuote/ManageNegotiableQuote.d.ts +10 -2
  32. package/containers/ManageNegotiableQuote.js +1 -1
  33. package/containers/ManageNegotiableQuote.js.map +1 -1
  34. package/containers/QuoteCommentsList/QuoteCommentsList.d.ts +9 -0
  35. package/containers/QuoteCommentsList/index.d.ts +11 -0
  36. package/containers/QuoteCommentsList.d.ts +3 -0
  37. package/containers/QuoteCommentsList.js +4 -0
  38. package/containers/QuoteCommentsList.js.map +1 -0
  39. package/containers/QuoteHistoryLog/QuoteHistoryLog.d.ts +9 -0
  40. package/containers/QuoteHistoryLog/index.d.ts +11 -0
  41. package/containers/QuoteHistoryLog.d.ts +3 -0
  42. package/containers/QuoteHistoryLog.js +4 -0
  43. package/containers/QuoteHistoryLog.js.map +1 -0
  44. package/containers/QuotesListTable.js +1 -1
  45. package/containers/QuotesListTable.js.map +1 -1
  46. package/containers/RequestNegotiableQuoteForm.js +1 -1
  47. package/containers/RequestNegotiableQuoteForm.js.map +1 -1
  48. package/containers/ShippingAddressDisplay/ShippingAddressDisplay.d.ts +10 -0
  49. package/containers/ShippingAddressDisplay/index.d.ts +11 -0
  50. package/containers/ShippingAddressDisplay.d.ts +1 -0
  51. package/containers/ShippingAddressDisplay.js +4 -0
  52. package/containers/ShippingAddressDisplay.js.map +1 -0
  53. package/containers/index.d.ts +3 -0
  54. package/data/models/negotiable-quote-model.d.ts +64 -0
  55. package/data/transforms/__fixtures__/negotiableQuoteData.d.ts +66 -0
  56. package/i18n/en_US.json.d.ts +41 -1
  57. package/package.json +1 -1
  58. package/render.js +7 -5
  59. package/render.js.map +1 -1
  60. package/utils/dateUtils.d.ts +15 -0
  61. package/chunks/requestNegotiableQuote.js +0 -25
  62. package/chunks/requestNegotiableQuote.js.map +0 -1
@@ -14,5 +14,5 @@
14
14
  * is strictly forbidden unless prior written permission is obtained
15
15
  * from Adobe.
16
16
  *******************************************************************/
17
- export declare const NEGOTIABLE_QUOTE_FRAGMENT = "\n fragment NegotiableQuoteFragment on NegotiableQuote {\n uid\n name\n created_at\n status\n sales_rep_name\n expiration_date\n updated_at\n buyer {\n firstname\n lastname\n }\n comments {\n uid\n created_at\n author {\n firstname\n lastname\n }\n text\n }\n template_id\n template_name\n items {\n product {\n name\n sku\n uid\n stock_status\n quantity\n price_range {\n maximum_price {\n regular_price {\n value\n }\n }\n }\n }\n prices {\n price {\n currency\n value\n }\n original_item_price {\n currency\n value\n }\n original_row_total {\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 ... on ConfigurableCartItem {\n\t\t\t\tconfigurable_options {\n\t\t\t\t\toption_label\n\t\t\t\t\tvalue_label\n\t\t\t\t}\n\t\t\t}\n\t\t\t... on BundleCartItem {\n\t\t\t\tbundle_options {\n\t\t\t\t\tlabel\n\t\t\t\t\tvalues {\n\t\t\t\t\t\tlabel\n\t\t\t\t\t\tquantity\n original_price {\n\t\t\t\t\t\t\tcurrency\n\t\t\t\t\t\t\tvalue\n\t\t\t\t\t\t}\n\t\t\t\t\t\tpriceV2 {\n\t\t\t\t\t\t\tcurrency\n\t\t\t\t\t\t\tvalue\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\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 statuses {\n changes {\n new_status\n old_status\n }\n }\n expiration {\n new_expiration\n old_expiration\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";
17
+ export declare const NEGOTIABLE_QUOTE_FRAGMENT = "\n fragment NegotiableQuoteFragment on NegotiableQuote {\n uid\n name\n created_at\n status\n sales_rep_name\n expiration_date\n updated_at\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 template_id\n template_name\n items {\n product {\n name\n sku\n uid\n stock_status\n quantity\n price_range {\n maximum_price {\n regular_price {\n value\n }\n }\n }\n }\n prices {\n price {\n currency\n value\n }\n original_item_price {\n currency\n value\n }\n original_row_total {\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_item_uid\n note\n note_uid\n __typename\n }\n note_from_seller {\n created_at\n creator_id\n creator_type\n negotiable_quote_item_uid\n note\n note_uid\n __typename\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 products_removed {\n products_removed_from_catalog\n products_removed_from_quote {\n uid\n name\n sku\n quantity\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";
18
18
  //# sourceMappingURL=NegotiableQuoteFragment.d.ts.map
package/api/index.d.ts CHANGED
@@ -6,4 +6,5 @@ export * from './getQuoteData';
6
6
  export * from './negotiableQuotes';
7
7
  export * from './setShippingAddress';
8
8
  export * from './sendForReview';
9
+ export * from './uploadFile';
9
10
  //# sourceMappingURL=index.d.ts.map
@@ -5,6 +5,9 @@ export interface RequestNegotiableQuoteInput {
5
5
  quoteName: string;
6
6
  comment: string;
7
7
  isDraft?: boolean;
8
+ attachments?: {
9
+ key: string;
10
+ }[];
8
11
  }
9
12
  export declare const requestNegotiableQuote: (input: RequestNegotiableQuoteInput) => Promise<NegotiableQuoteModel | null>;
10
13
  //# sourceMappingURL=requestNegotiableQuote.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 FINISH_UPLOAD_MUTATION = "\n mutation FINISH_UPLOAD_MUTATION($input: finishUploadInput!) {\n finishUpload(input: $input) {\n success\n key\n message\n }\n }\n";
10
+ //# sourceMappingURL=FinishUploadMutation.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 INITIATE_UPLOAD_MUTATION = "\n mutation INITIATE_UPLOAD_MUTATION($input: initiateUploadInput!) {\n initiateUpload(input: $input) {\n upload_url\n key\n expires_at\n }\n }\n";
10
+ //# sourceMappingURL=InitiateUploadMutation.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 './uploadFile';
10
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1,12 @@
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 uploadFile: (file: File) => Promise<{
10
+ key: string;
11
+ }>;
12
+ //# sourceMappingURL=uploadFile.d.ts.map
package/api.js CHANGED
@@ -1,6 +1,6 @@
1
1
  /*! Copyright 2025 Adobe
2
2
  All Rights Reserved. */
3
- import{D as i,s as n,t as h}from"./chunks/transform-quote.js";import{FetchGraphQL as _,fetchGraphQl as q}from"@dropins/tools/fetch-graphql.js";import{events as s}from"@dropins/tools/event-bus.js";import{r as K}from"./chunks/requestNegotiableQuote.js";import{N as p}from"./chunks/NegotiableQuoteFragment.js";import{F as W,N as X,S as Z,n as ee}from"./chunks/negotiableQuotes.js";import{s as oe}from"./chunks/sendForReview.js";import{Initializer as I}from"@dropins/tools/lib.js";const T=`
3
+ import{D as a,s as n,t as p}from"./chunks/transform-quote.js";import{fetchGraphQl as _}from"@dropins/tools/fetch-graphql.js";import{events as r}from"@dropins/tools/event-bus.js";import{f as Q}from"./chunks/uploadFile.js";import{g as H,b as L,r as B,s as V,a as Y,c as K,u as J}from"./chunks/uploadFile.js";import{N as h}from"./chunks/NegotiableQuoteFragment.js";import{F as X,N as Z,S as ee,n as te}from"./chunks/negotiableQuotes.js";import{s as se}from"./chunks/sendForReview.js";import{Initializer as q}from"@dropins/tools/lib.js";const I=`
4
4
  fragment CUSTOMER_FRAGMENT on Customer {
5
5
  role {
6
6
  permissions {
@@ -17,15 +17,15 @@ import{D as i,s as n,t as h}from"./chunks/transform-quote.js";import{FetchGraphQ
17
17
  }
18
18
  }
19
19
  }
20
- `,S=`
20
+ `,T=`
21
21
  query CUSTOMER_QUERY {
22
22
  customer {
23
23
  ...CUSTOMER_FRAGMENT
24
24
  }
25
25
  }
26
26
 
27
- ${T}
28
- `,A="All/Quotes/View/Request, Edit, Delete",N="All/Quotes/View/Request, Edit, Delete",U="All/Quotes/View/Request, Edit, Delete",R="All/Quotes/View/Checkout with quote",w=o=>{const e=[],t=(r,u=[])=>{for(const a of r){const d=[...u,a.text];a.children&&a.children.length>0?t(a.children,d):e.push(d.join("/"))}};return t(o),e};function D(o){const{role:e}=o;if(!e)return{permissions:{canRequestQuote:i.requestQuote,canEditQuote:i.editQuote,canDeleteQuote:i.deleteQuote,canCheckoutQuote:i.checkoutQuote}};const{permissions:t}=e,r=w(t);return{permissions:{canRequestQuote:r.includes(A),canEditQuote:r.includes(N),canDeleteQuote:r.includes(U),canCheckoutQuote:r.includes(R)}}}const C=async()=>{var o;if(!n.authenticated)return Promise.reject(new Error("Unauthorized"));try{const e=await Q(S);if(!((o=e==null?void 0:e.data)!=null&&o.customer))throw new Error("No customer data received");return D(e.data.customer)}catch(e){return Promise.reject(e)}},O=`
27
+ ${I}
28
+ `,S="All/Quotes/View/Request, Edit, Delete",A="All/Quotes/View/Request, Edit, Delete",N="All/Quotes/View/Request, Edit, Delete",U="All/Quotes/View/Checkout with quote",R=o=>{const e=[],t=(s,u=[])=>{for(const i of s){const d=[...u,i.text];i.children&&i.children.length>0?t(i.children,d):e.push(d.join("/"))}};return t(o),e};function D(o){const{role:e}=o;if(!e)return{permissions:{canRequestQuote:a.requestQuote,canEditQuote:a.editQuote,canDeleteQuote:a.deleteQuote,canCheckoutQuote:a.checkoutQuote}};const{permissions:t}=e,s=R(t);return{permissions:{canRequestQuote:s.includes(S),canEditQuote:s.includes(A),canDeleteQuote:s.includes(N),canCheckoutQuote:s.includes(U)}}}const w=async()=>{var o;if(!n.authenticated)return Promise.reject(new Error("Unauthorized"));try{const e=await Q(T);if(!((o=e==null?void 0:e.data)!=null&&o.customer))throw new Error("No customer data received");return D(e.data.customer)}catch(e){return Promise.reject(e)}},C=`
29
29
  query QUOTE_DATA_QUERY(
30
30
  $quoteId: ID!
31
31
  ) {
@@ -36,8 +36,8 @@ import{D as i,s as n,t as h}from"./chunks/transform-quote.js";import{FetchGraphQ
36
36
  }
37
37
  }
38
38
 
39
- ${p}
40
- `,F=async o=>{var e;if(!n.authenticated)return Promise.reject(new Error("Unauthorized"));if(!n.permissions.editQuote)return Promise.reject(new Error("Unauthorized"));try{const t=await Q(O,{variables:{quoteId:o}}),r=h((e=t==null?void 0:t.data)==null?void 0:e.negotiableQuote);if(!r)throw new Error("Failed to transform quote data");return s.emit("quote-management/quote-data",{quote:r,permissions:n.permissions}),r}catch(t){return Promise.reject(t)}},m=new I({init:async o=>{const e={};m.config.setConfig({...e,...o})},listeners:()=>[s.on("authenticated",async o=>{n.authenticated=!!o,o?C().then(e=>{n.permissions={requestQuote:e.permissions.canRequestQuote,editQuote:e.permissions.canEditQuote,deleteQuote:e.permissions.canDeleteQuote,checkoutQuote:e.permissions.canCheckoutQuote},s.emit("quote-management/permissions",n.permissions)}).catch(e=>{console.error(e),n.permissions=i,s.emit("quote-management/permissions",i)}):(n.permissions=i,s.emit("quote-management/permissions",i))},{eager:!0}),s.on("quote-management/permissions",async o=>{const e=m.config.getConfig().quoteId;e&&o.editQuote&&F(e).then(t=>{s.emit("quote-management/quote-data/initialized",{quote:t,permissions:o},{})}).catch(t=>{s.emit("quote-management/quote-data/error",{error:t})})},{eager:!0})]}),k=m.config,{setEndpoint:x,setFetchGraphQlHeader:j,removeFetchGraphQlHeader:z,setFetchGraphQlHeaders:H,fetchGraphQl:Q,getConfig:L}=new _().getMethods(),M=`
39
+ ${h}
40
+ `,O=async o=>{var e;if(!n.authenticated)return Promise.reject(new Error("Unauthorized"));if(!n.permissions.editQuote)return Promise.reject(new Error("Unauthorized"));try{const t=await Q(C,{variables:{quoteId:o}}),s=p((e=t==null?void 0:t.data)==null?void 0:e.negotiableQuote);if(!s)throw new Error("Failed to transform quote data");return r.emit("quote-management/quote-data",{quote:s,permissions:n.permissions}),s}catch(t){return Promise.reject(t)}},m=new q({init:async o=>{const e={};m.config.setConfig({...e,...o})},listeners:()=>[r.on("authenticated",async o=>{n.authenticated=!!o,o?w().then(e=>{n.permissions={requestQuote:e.permissions.canRequestQuote,editQuote:e.permissions.canEditQuote,deleteQuote:e.permissions.canDeleteQuote,checkoutQuote:e.permissions.canCheckoutQuote},r.emit("quote-management/permissions",n.permissions)}).catch(e=>{console.error(e),n.permissions=a,r.emit("quote-management/permissions",a)}):(n.permissions=a,r.emit("quote-management/permissions",a))},{eager:!0}),r.on("quote-management/permissions",async o=>{const e=m.config.getConfig().quoteId;e&&o.editQuote&&O(e).then(t=>{r.emit("quote-management/quote-data/initialized",{quote:t,permissions:o},{})}).catch(t=>{r.emit("quote-management/quote-data/error",{error:t})})},{eager:!0})]}),k=m.config,F=`
41
41
  mutation SET_NEGOTIABLE_QUOTE_SHIPPING_ADDRESS_MUTATION(
42
42
  $quoteUid: ID!
43
43
  $addressId: ID
@@ -57,6 +57,6 @@ import{D as i,s as n,t as h}from"./chunks/transform-quote.js";import{FetchGraphQ
57
57
  }
58
58
  }
59
59
  }
60
- ${p}
61
- `;function y(o){const{additionalInput:e,...t}=o,r={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{...e||{},...r}}const B=async o=>{const{quoteUid:e,addressId:t,addressData:r}=o;if(!e)throw new Error("Quote UID is required");if(!t&&!r)throw new Error("Either addressId or addressData must be provided");if(t&&r)throw new Error("Cannot provide both addressId and addressData");const u=r?y(r):null;return q(M,{variables:{quoteUid:e,addressId:t||null,addressData:u}}).then(a=>{var l,E;const{errors:d}=a;if(d){const f=d.map(g=>g.message).join("; ");throw new Error(`Failed to set shipping address: ${f}`)}const c=h((E=(l=a.data)==null?void 0:l.setNegotiableQuoteShippingAddress)==null?void 0:E.quote);if(!c)throw new Error("Failed to transform quote data: Invalid response structure");return s.emit("quote-management/shipping-address-set",{quote:c,input:{quoteUid:e,addressId:t,addressData:r}}),c})};export{W as FilterMatchTypeEnum,X as NegotiableQuoteSortableField,Z as SortEnum,k as config,Q as fetchGraphQl,L as getConfig,C as getCustomerData,F as getQuoteData,m as initialize,ee as negotiableQuotes,z as removeFetchGraphQlHeader,K as requestNegotiableQuote,oe as sendForReview,x as setEndpoint,j as setFetchGraphQlHeader,H as setFetchGraphQlHeaders,B as setShippingAddress};
60
+ ${h}
61
+ `;function M(o){const{additionalInput:e,...t}=o,s={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{...e||{},...s}}const x=async o=>{const{quoteUid:e,addressId:t,addressData:s}=o;if(!e)throw new Error("Quote UID is required");if(t===void 0&&!s)throw new Error("Either addressId or addressData must be provided");if(t!==void 0&&s)throw new Error("Cannot provide both addressId and addressData");const u=s?M(s):null;return _(F,{variables:{quoteUid:e,addressId:t||null,addressData:u}}).then(i=>{var l,E;const{errors:d}=i;if(d){const f=d.map(g=>g.message).join("; ");throw new Error(`Failed to set shipping address: ${f}`)}const c=p((E=(l=i.data)==null?void 0:l.setNegotiableQuoteShippingAddress)==null?void 0:E.quote);if(!c)throw new Error("Failed to transform quote data: Invalid response structure");return r.emit("quote-management/shipping-address-set",{quote:c,input:{quoteUid:e,addressId:t,addressData:s}}),c})};export{X as FilterMatchTypeEnum,Z as NegotiableQuoteSortableField,ee as SortEnum,k as config,Q as fetchGraphQl,H as getConfig,w as getCustomerData,O as getQuoteData,m as initialize,te as negotiableQuotes,L as removeFetchGraphQlHeader,B as requestNegotiableQuote,se as sendForReview,V as setEndpoint,Y as setFetchGraphQlHeader,K as setFetchGraphQlHeaders,x as setShippingAddress,J as uploadFile};
62
62
  //# sourceMappingURL=api.js.map
package/api.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"api.js","sources":["/@dropins/storefront-quote-management/src/api/graphql/CustomerFragment.ts","/@dropins/storefront-quote-management/src/api/getCustomerData/graphql/CustomerQuery.ts","/@dropins/storefront-quote-management/src/data/transforms/transform-customer.ts","/@dropins/storefront-quote-management/src/api/getCustomerData/getCustomerData.ts","/@dropins/storefront-quote-management/src/api/getQuoteData/graphql/QuoteDataQuery.ts","/@dropins/storefront-quote-management/src/api/getQuoteData/getQuoteData.ts","/@dropins/storefront-quote-management/src/api/initialize/initialize.ts","/@dropins/storefront-quote-management/src/api/fetch-graphql/fetch-graphql.ts","/@dropins/storefront-quote-management/src/api/setShippingAddress/graphql/SetNegotiableQuoteShippingAddressMutation.ts","/@dropins/storefront-quote-management/src/api/setShippingAddress/setShippingAddress.ts"],"sourcesContent":["export const CUSTOMER_FRAGMENT = /* GraphQL */ `\n fragment CUSTOMER_FRAGMENT on Customer {\n role {\n permissions {\n text\n children {\n text\n children {\n text\n children {\n text\n }\n }\n }\n }\n }\n }\n`","import { CUSTOMER_FRAGMENT } from '@/quote-management/api/graphql/CustomerFragment';\n\nexport const CUSTOMER_QUERY = `\n query CUSTOMER_QUERY {\n customer {\n ...CUSTOMER_FRAGMENT\n }\n }\n\n ${CUSTOMER_FRAGMENT}\n`","/********************************************************************\n * Copyright 2025 Adobe\n * All Rights Reserved.\n *\n * NOTICE: Adobe permits you to use, modify, and distribute this \n * file in accordance with the terms of the Adobe license agreement \n * accompanying it. \n *******************************************************************/\n\nimport { DEFAULT_PERMISSIONS } from \"@/quote-management/lib/state\";\nimport { CustomerModel } from \"../models\";\n\ntype PermissionsSchema = {\n text: string;\n children: PermissionsSchema[];\n}\n\nconst CAN_REQUEST_QUOTE_PERMISSION = 'All/Quotes/View/Request, Edit, Delete';\nconst CAN_EDIT_QUOTE_PERMISSION = 'All/Quotes/View/Request, Edit, Delete';\nconst CAN_DELETE_QUOTE_PERMISSION = 'All/Quotes/View/Request, Edit, Delete';\nconst CAN_CHECKOUT_QUOTE_PERMISSION = 'All/Quotes/View/Checkout with quote';\n\n/**\n * Flatten the permissions into a list of strings\n * @param permissions - The permissions to flatten\n * @returns A list of strings representing the flattened permissions\n */\nexport const flattenPermissions = (permissions: PermissionsSchema[]): string[] => {\n const result: string[] = [];\n \n // Recursively traverse the permissions and build the path\n const traverse = (nodes: PermissionsSchema[], path: string[] = []) => {\n for (const node of nodes) {\n const currentPath = [...path, node.text];\n \n if (node.children && node.children.length > 0) {\n traverse(node.children, currentPath);\n } else {\n result.push(currentPath.join('/'));\n }\n }\n };\n \n traverse(permissions);\n return result;\n}\n\nexport function transformCustomer(customerData: any): CustomerModel {\n const { role } = customerData;\n\n if (!role) {\n return {\n permissions: {\n canRequestQuote: DEFAULT_PERMISSIONS.requestQuote,\n canEditQuote: DEFAULT_PERMISSIONS.editQuote,\n canDeleteQuote: DEFAULT_PERMISSIONS.deleteQuote,\n canCheckoutQuote: DEFAULT_PERMISSIONS.checkoutQuote,\n },\n };\n }\n\n const { permissions } = role;\n\n const flattenedPermissions = flattenPermissions(permissions);\n return {\n permissions: {\n canRequestQuote: flattenedPermissions.includes(CAN_REQUEST_QUOTE_PERMISSION),\n canEditQuote: flattenedPermissions.includes(CAN_EDIT_QUOTE_PERMISSION),\n canDeleteQuote: flattenedPermissions.includes(CAN_DELETE_QUOTE_PERMISSION),\n canCheckoutQuote: flattenedPermissions.includes(CAN_CHECKOUT_QUOTE_PERMISSION),\n }\n }\n}","/********************************************************************\n * Copyright 2025 Adobe\n * All Rights Reserved.\n *\n * NOTICE: Adobe permits you to use, modify, and distribute this \n * file in accordance with the terms of the Adobe license agreement \n * accompanying it. \n *******************************************************************/\n\nimport { fetchGraphQl } from '@/quote-management/api/';\nimport { CUSTOMER_QUERY } from './graphql/CustomerQuery';\nimport { transformCustomer } from '@/quote-management/data/transforms';\nimport { state } from '@/quote-management/lib/state';\n\nexport const getCustomerData = async () => { \n if (!state.authenticated) {\n return Promise.reject(new Error('Unauthorized'));\n }\n\n try {\n const results: any = await fetchGraphQl(CUSTOMER_QUERY);\n \n if (!results?.data?.customer) {\n throw new Error('No customer data received');\n }\n \n return transformCustomer(results.data.customer);\n } catch (error) {\n return Promise.reject(error);\n }\n}\n","import { NEGOTIABLE_QUOTE_FRAGMENT } from '@/quote-management/api/graphql/NegotiableQuoteFragment';\n\nexport const QUOTE_DATA_QUERY = `\n query QUOTE_DATA_QUERY(\n $quoteId: ID!\n ) {\n negotiableQuote(\n uid: $quoteId\n ) {\n ...NegotiableQuoteFragment\n }\n }\n\n ${NEGOTIABLE_QUOTE_FRAGMENT}\n`","/********************************************************************\n * Copyright 2025 Adobe\n * All Rights Reserved.\n *\n * NOTICE: Adobe permits you to use, modify, and distribute this \n * file in accordance with the terms of the Adobe license agreement \n * accompanying it. \n *******************************************************************/\n\nimport { fetchGraphQl } from '@/quote-management/api/';\nimport { QUOTE_DATA_QUERY } from './graphql/QuoteDataQuery';\nimport { transformQuote } from '@/quote-management/data/transforms';\nimport { state } from '@/quote-management/lib/state';\nimport { events } from '@adobe-commerce/event-bus';\n\nexport const getQuoteData = async (quoteId: string) => { \n if (!state.authenticated) {\n return Promise.reject(new Error('Unauthorized'));\n }\n\n if (!state.permissions.editQuote) {\n return Promise.reject(new Error('Unauthorized'));\n }\n\n try {\n const results: any = await fetchGraphQl(QUOTE_DATA_QUERY, {\n variables: {\n quoteId\n }\n });\n\n const transformedQuote = transformQuote(results?.data?.negotiableQuote);\n\n if (!transformedQuote) {\n throw new Error('Failed to transform quote data');\n }\n\n events.emit('quote-management/quote-data', {\n quote: transformedQuote,\n permissions: state.permissions,\n });\n \n return transformedQuote;\n } catch (error) {\n return Promise.reject(error);\n }\n}\n","import { Initializer } from '@adobe-commerce/elsie/lib';\nimport { Lang } from '@adobe-commerce/elsie/i18n';\nimport { events } from '@adobe-commerce/event-bus';\nimport { state, DEFAULT_PERMISSIONS } from '@/quote-management/lib/state';\nimport { getCustomerData } from '@/quote-management/api/getCustomerData';\nimport { getQuoteData } from '@/quote-management/api/getQuoteData';\n\ntype ConfigProps = {\n langDefinitions?: Lang;\n quoteId?: string;\n};\n\nexport const initialize = new Initializer<ConfigProps>({\n init: async (config) => {\n const defaultConfig = {};\n\n initialize.config.setConfig({ ...defaultConfig, ...config });\n },\n\n listeners: () => [\n events.on('authenticated', async (authenticated) => {\n state.authenticated = !!authenticated;\n\n if (authenticated) {\n getCustomerData().then((customerData) => {\n state.permissions = {\n requestQuote: customerData.permissions.canRequestQuote,\n editQuote: customerData.permissions.canEditQuote,\n deleteQuote: customerData.permissions.canDeleteQuote,\n checkoutQuote: customerData.permissions.canCheckoutQuote,\n };\n events.emit('quote-management/permissions', state.permissions);\n })\n .catch((error) => {\n console.error(error);\n state.permissions = DEFAULT_PERMISSIONS;\n events.emit('quote-management/permissions', DEFAULT_PERMISSIONS);\n });\n } else {\n state.permissions = DEFAULT_PERMISSIONS;\n events.emit('quote-management/permissions', DEFAULT_PERMISSIONS);\n }\n }, {\n eager: true,\n }),\n events.on('quote-management/permissions', async (permissions) => {\n const quoteId = initialize.config.getConfig().quoteId;\n if (!quoteId) {\n return;\n }\n\n if (permissions.editQuote) {\n getQuoteData(quoteId).then((quoteData) => {\n events.emit('quote-management/quote-data/initialized', {\n quote: quoteData,\n permissions,\n }, {});\n }).catch((error) => {\n events.emit('quote-management/quote-data/error', {\n error,\n });\n });\n }\n }, {\n eager: true,\n }),\n ],\n});\n\nexport const config = initialize.config;\n","import { FetchGraphQL } from '@adobe-commerce/fetch-graphql';\n\nexport const {\n setEndpoint,\n setFetchGraphQlHeader,\n removeFetchGraphQlHeader,\n setFetchGraphQlHeaders,\n fetchGraphQl,\n getConfig,\n} = new FetchGraphQL().getMethods();\n","/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2024 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\n\nimport { NEGOTIABLE_QUOTE_FRAGMENT } from '@/quote-management/api/graphql/NegotiableQuoteFragment';\n\nexport const SET_NEGOTIABLE_QUOTE_SHIPPING_ADDRESS_MUTATION = `\n mutation SET_NEGOTIABLE_QUOTE_SHIPPING_ADDRESS_MUTATION(\n $quoteUid: ID!\n $addressId: ID\n $addressData: NegotiableQuoteAddressInput\n ) {\n setNegotiableQuoteShippingAddress(\n input: {\n quote_uid: $quoteUid\n shipping_addresses: {\n customer_address_uid: $addressId\n address: $addressData\n }\n }\n ) {\n quote {\n ...NegotiableQuoteFragment\n }\n }\n }\n ${NEGOTIABLE_QUOTE_FRAGMENT}\n`;\n\n","/********************************************************************\n * Copyright 2025 Adobe\n * All Rights Reserved.\n *\n * NOTICE: Adobe permits you to use, modify, and distribute this\n * file in accordance with the terms of the Adobe license agreement\n * accompanying it.\n *******************************************************************/\n\nimport { fetchGraphQl } from '@adobe-commerce/fetch-graphql';\nimport { events } from '@adobe-commerce/event-bus';\nimport { SET_NEGOTIABLE_QUOTE_SHIPPING_ADDRESS_MUTATION } from './graphql/SetNegotiableQuoteShippingAddressMutation';\nimport { NegotiableQuoteModel } from '@/quote-management/data/models/negotiable-quote-model';\nimport { transformQuote } from '@/quote-management/data/transforms';\n\nexport interface AddressInput {\n /** City name */\n city: string;\n /** Optional company name */\n company?: string;\n /** Two-letter country code (e.g., 'US') */\n countryCode: string;\n /** First name */\n firstname: string;\n /** Last name */\n lastname: string;\n /** Postal/ZIP code */\n postcode: string;\n /** Optional state/province name */\n region?: string;\n /** Optional state/province ID */\n regionId?: number;\n /** Whether to save this address to the customer's address book */\n saveInAddressBook?: boolean;\n /** Street address lines (array) */\n street: string[];\n /** Phone number */\n telephone: string;\n /** \n * Additional input (optional custom fields for the address).\n * These fields will be merged into the address data sent to GraphQL.\n * Standard fields take precedence over additional fields to prevent\n * accidental override of required address attributes.\n * \n * @example\n * ```ts\n * additionalInput: {\n * vat_id: 'GB123456789',\n * custom_attribute: 'value',\n * delivery_instructions: 'Leave at door'\n * }\n * ```\n */\n additionalInput?: Record<string, any>;\n}\n\nexport interface SetShippingAddressInput {\n /** The unique ID of the negotiable quote */\n quoteUid: string;\n /** The ID of a saved customer address (use this OR addressData, not both) */\n addressId?: number;\n /** New address data (use this OR addressId, not both) */\n addressData?: AddressInput;\n}\n\n/**\n * Transform camelCase address data to snake_case for GraphQL mutation.\n * Additional fields from additionalInput are spread into the result, with\n * standard fields taking precedence (defensive flexibility approach).\n */\nfunction transformAddressToSnakeCase(address: AddressInput) {\n const { additionalInput, ...standardFields } = address;\n \n // Build the standard transformed fields\n const transformedStandardFields = {\n city: standardFields.city,\n company: standardFields.company,\n country_code: standardFields.countryCode,\n firstname: standardFields.firstname,\n lastname: standardFields.lastname,\n postcode: standardFields.postcode,\n region: standardFields.region,\n region_id: standardFields.regionId,\n save_in_address_book: standardFields.saveInAddressBook,\n street: standardFields.street,\n telephone: standardFields.telephone,\n };\n \n // Spread additional input first, then standard fields take precedence\n // This provides defensive flexibility: allows custom fields while protecting core fields\n return {\n ...(additionalInput || {}),\n ...transformedStandardFields,\n };\n}\n\n/**\n * Sets or updates the shipping address for a negotiable quote.\n * \n * @param input - The input parameters for setting the shipping address\n * @param input.quoteUid - The unique ID of the negotiable quote\n * @param input.addressId - Optional ID of a saved customer address (use this OR addressData)\n * @param input.addressData - Optional new address data (use this OR addressId)\n * @param input.addressData.additionalInput - Optional additional address fields to pass through to GraphQL\n * @returns Promise that resolves to the updated quote model with shipping addresses including uid field\n * @throws Error if validation fails or GraphQL operation fails\n * \n * @example\n * ```ts\n * // Using a saved address\n * const quote = await setShippingAddress({\n * quoteUid: 'quote-123',\n * addressId: 5\n * });\n * \n * // Using new address data\n * const quote = await setShippingAddress({\n * quoteUid: 'quote-123',\n * addressData: {\n * firstname: 'John',\n * lastname: 'Doe',\n * street: ['123 Main St'],\n * city: 'San Francisco',\n * countryCode: 'US',\n * postcode: '94103',\n * telephone: '555-1234'\n * }\n * });\n * \n * // Using address data with additional custom fields\n * const quote = await setShippingAddress({\n * quoteUid: 'quote-123',\n * addressData: {\n * firstname: 'John',\n * lastname: 'Doe',\n * street: ['123 Main St'],\n * city: 'San Francisco',\n * countryCode: 'US',\n * postcode: '94103',\n * telephone: '555-1234',\n * additionalInput: {\n * vat_id: 'GB123456789',\n * custom_attribute_1: 'value1',\n * delivery_instructions: 'Leave at door'\n * }\n * }\n * });\n * \n * // Access address identifier\n * if (quote?.shippingAddresses?.[0]) {\n * console.log('Address UID:', quote.shippingAddresses[0].uid);\n * }\n * ```\n */\nexport const setShippingAddress = async (\n input: SetShippingAddressInput\n): Promise<NegotiableQuoteModel | null> => {\n const { quoteUid, addressId, addressData } = input;\n\n if (!quoteUid) {\n throw new Error('Quote UID is required');\n }\n\n // Validate that exactly one of addressId or addressData is provided\n if (!addressId && !addressData) {\n throw new Error('Either addressId or addressData must be provided');\n }\n\n if (addressId && addressData) {\n throw new Error('Cannot provide both addressId and addressData');\n }\n\n // Transform addressData to snake_case if provided\n const transformedAddressData = addressData\n ? transformAddressToSnakeCase(addressData)\n : null;\n\n return fetchGraphQl(SET_NEGOTIABLE_QUOTE_SHIPPING_ADDRESS_MUTATION, {\n variables: {\n quoteUid,\n addressId: addressId || null,\n addressData: transformedAddressData,\n },\n }).then((response) => {\n const { errors } = response;\n\n if (errors) {\n // Provide more detailed error information\n const errorMessages = errors.map((error) => error.message).join('; ');\n throw new Error(`Failed to set shipping address: ${errorMessages}`);\n }\n\n // Transform the quote data\n const quoteData = transformQuote(\n response.data?.setNegotiableQuoteShippingAddress?.quote\n );\n\n if (!quoteData) {\n throw new Error(\n 'Failed to transform quote data: Invalid response structure'\n );\n }\n\n // Emit event with transformed quote data on success\n events.emit('quote-management/shipping-address-set', {\n quote: quoteData,\n input: { quoteUid, addressId, addressData },\n });\n\n return quoteData;\n });\n};\n\n"],"names":["CUSTOMER_FRAGMENT","CUSTOMER_QUERY","CAN_REQUEST_QUOTE_PERMISSION","CAN_EDIT_QUOTE_PERMISSION","CAN_DELETE_QUOTE_PERMISSION","CAN_CHECKOUT_QUOTE_PERMISSION","flattenPermissions","permissions","result","traverse","nodes","path","node","currentPath","transformCustomer","customerData","role","DEFAULT_PERMISSIONS","flattenedPermissions","getCustomerData","state","results","fetchGraphQl","_a","error","QUOTE_DATA_QUERY","NEGOTIABLE_QUOTE_FRAGMENT","getQuoteData","quoteId","transformedQuote","transformQuote","events","initialize","Initializer","config","defaultConfig","authenticated","quoteData","setEndpoint","setFetchGraphQlHeader","removeFetchGraphQlHeader","setFetchGraphQlHeaders","getConfig","FetchGraphQL","SET_NEGOTIABLE_QUOTE_SHIPPING_ADDRESS_MUTATION","transformAddressToSnakeCase","address","additionalInput","standardFields","transformedStandardFields","setShippingAddress","input","quoteUid","addressId","addressData","transformedAddressData","response","errors","errorMessages","_b"],"mappings":"6dAAO,MAAMA,EAAkC;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,ECElCC,EAAiB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,MAOxBD,CAAiB;AAAA,ECQjBE,EAA+B,wCAC/BC,EAA4B,wCAC5BC,EAA8B,wCAC9BC,EAAgC,sCAOzBC,EAAsBC,GAA+C,CAC9E,MAAMC,EAAmB,CAAA,EAGnBC,EAAW,CAACC,EAA4BC,EAAiB,CAAA,IAAO,CAClE,UAAWC,KAAQF,EAAO,CACtB,MAAMG,EAAc,CAAC,GAAGF,EAAMC,EAAK,IAAI,EAEnCA,EAAK,UAAYA,EAAK,SAAS,OAAS,EACxCH,EAASG,EAAK,SAAUC,CAAW,EAEnCL,EAAO,KAAKK,EAAY,KAAK,GAAG,CAAC,CAEzC,CACJ,EAEA,OAAAJ,EAASF,CAAW,EACbC,CACX,EAEO,SAASM,EAAkBC,EAAkC,CAChE,KAAM,CAAE,KAAAC,GAASD,EAEjB,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EACpE,MAAM,IAAI,MAAM,mCAAmCkC,CAAa,EAAE,CACpE,CAGA,MAAMrB,EAAYP,GAChB6B,GAAApC,EAAAiC,EAAS,OAAT,YAAAjC,EAAe,oCAAf,YAAAoC,EAAkD,KAAA,EAGpD,GAAI,CAACtB,EACH,MAAM,IAAI,MACR,4DAAA,EAKJ,OAAAN,EAAO,KAAK,wCAAyC,CACnD,MAAOM,EACP,MAAO,CAAE,SAAAe,EAAU,UAAAC,EAAW,YAAAC,CAAA,CAAY,CAC3C,EAEMjB,CACT,CAAC,CACH"}
1
+ {"version":3,"file":"api.js","sources":["/@dropins/storefront-quote-management/src/api/graphql/CustomerFragment.ts","/@dropins/storefront-quote-management/src/api/getCustomerData/graphql/CustomerQuery.ts","/@dropins/storefront-quote-management/src/data/transforms/transform-customer.ts","/@dropins/storefront-quote-management/src/api/getCustomerData/getCustomerData.ts","/@dropins/storefront-quote-management/src/api/getQuoteData/graphql/QuoteDataQuery.ts","/@dropins/storefront-quote-management/src/api/getQuoteData/getQuoteData.ts","/@dropins/storefront-quote-management/src/api/initialize/initialize.ts","/@dropins/storefront-quote-management/src/api/setShippingAddress/graphql/SetNegotiableQuoteShippingAddressMutation.ts","/@dropins/storefront-quote-management/src/api/setShippingAddress/setShippingAddress.ts"],"sourcesContent":["export const CUSTOMER_FRAGMENT = /* GraphQL */ `\n fragment CUSTOMER_FRAGMENT on Customer {\n role {\n permissions {\n text\n children {\n text\n children {\n text\n children {\n text\n }\n }\n }\n }\n }\n }\n`","import { CUSTOMER_FRAGMENT } from '@/quote-management/api/graphql/CustomerFragment';\n\nexport const CUSTOMER_QUERY = `\n query CUSTOMER_QUERY {\n customer {\n ...CUSTOMER_FRAGMENT\n }\n }\n\n ${CUSTOMER_FRAGMENT}\n`","/********************************************************************\n * Copyright 2025 Adobe\n * All Rights Reserved.\n *\n * NOTICE: Adobe permits you to use, modify, and distribute this \n * file in accordance with the terms of the Adobe license agreement \n * accompanying it. \n *******************************************************************/\n\nimport { DEFAULT_PERMISSIONS } from \"@/quote-management/lib/state\";\nimport { CustomerModel } from \"../models\";\n\ntype PermissionsSchema = {\n text: string;\n children: PermissionsSchema[];\n}\n\nconst CAN_REQUEST_QUOTE_PERMISSION = 'All/Quotes/View/Request, Edit, Delete';\nconst CAN_EDIT_QUOTE_PERMISSION = 'All/Quotes/View/Request, Edit, Delete';\nconst CAN_DELETE_QUOTE_PERMISSION = 'All/Quotes/View/Request, Edit, Delete';\nconst CAN_CHECKOUT_QUOTE_PERMISSION = 'All/Quotes/View/Checkout with quote';\n\n/**\n * Flatten the permissions into a list of strings\n * @param permissions - The permissions to flatten\n * @returns A list of strings representing the flattened permissions\n */\nexport const flattenPermissions = (permissions: PermissionsSchema[]): string[] => {\n const result: string[] = [];\n \n // Recursively traverse the permissions and build the path\n const traverse = (nodes: PermissionsSchema[], path: string[] = []) => {\n for (const node of nodes) {\n const currentPath = [...path, node.text];\n \n if (node.children && node.children.length > 0) {\n traverse(node.children, currentPath);\n } else {\n result.push(currentPath.join('/'));\n }\n }\n };\n \n traverse(permissions);\n return result;\n}\n\nexport function transformCustomer(customerData: any): CustomerModel {\n const { role } = customerData;\n\n if (!role) {\n return {\n permissions: {\n canRequestQuote: DEFAULT_PERMISSIONS.requestQuote,\n canEditQuote: DEFAULT_PERMISSIONS.editQuote,\n canDeleteQuote: DEFAULT_PERMISSIONS.deleteQuote,\n canCheckoutQuote: DEFAULT_PERMISSIONS.checkoutQuote,\n },\n };\n }\n\n const { permissions } = role;\n\n const flattenedPermissions = flattenPermissions(permissions);\n return {\n permissions: {\n canRequestQuote: flattenedPermissions.includes(CAN_REQUEST_QUOTE_PERMISSION),\n canEditQuote: flattenedPermissions.includes(CAN_EDIT_QUOTE_PERMISSION),\n canDeleteQuote: flattenedPermissions.includes(CAN_DELETE_QUOTE_PERMISSION),\n canCheckoutQuote: flattenedPermissions.includes(CAN_CHECKOUT_QUOTE_PERMISSION),\n }\n }\n}","/********************************************************************\n * Copyright 2025 Adobe\n * All Rights Reserved.\n *\n * NOTICE: Adobe permits you to use, modify, and distribute this \n * file in accordance with the terms of the Adobe license agreement \n * accompanying it. \n *******************************************************************/\n\nimport { fetchGraphQl } from '@/quote-management/api/';\nimport { CUSTOMER_QUERY } from './graphql/CustomerQuery';\nimport { transformCustomer } from '@/quote-management/data/transforms';\nimport { state } from '@/quote-management/lib/state';\n\nexport const getCustomerData = async () => { \n if (!state.authenticated) {\n return Promise.reject(new Error('Unauthorized'));\n }\n\n try {\n const results: any = await fetchGraphQl(CUSTOMER_QUERY);\n \n if (!results?.data?.customer) {\n throw new Error('No customer data received');\n }\n \n return transformCustomer(results.data.customer);\n } catch (error) {\n return Promise.reject(error);\n }\n}\n","import { NEGOTIABLE_QUOTE_FRAGMENT } from '@/quote-management/api/graphql/NegotiableQuoteFragment';\n\nexport const QUOTE_DATA_QUERY = `\n query QUOTE_DATA_QUERY(\n $quoteId: ID!\n ) {\n negotiableQuote(\n uid: $quoteId\n ) {\n ...NegotiableQuoteFragment\n }\n }\n\n ${NEGOTIABLE_QUOTE_FRAGMENT}\n`","/********************************************************************\n * Copyright 2025 Adobe\n * All Rights Reserved.\n *\n * NOTICE: Adobe permits you to use, modify, and distribute this \n * file in accordance with the terms of the Adobe license agreement \n * accompanying it. \n *******************************************************************/\n\nimport { fetchGraphQl } from '@/quote-management/api/';\nimport { QUOTE_DATA_QUERY } from './graphql/QuoteDataQuery';\nimport { transformQuote } from '@/quote-management/data/transforms';\nimport { state } from '@/quote-management/lib/state';\nimport { events } from '@adobe-commerce/event-bus';\n\nexport const getQuoteData = async (quoteId: string) => { \n if (!state.authenticated) {\n return Promise.reject(new Error('Unauthorized'));\n }\n\n if (!state.permissions.editQuote) {\n return Promise.reject(new Error('Unauthorized'));\n }\n\n try {\n const results: any = await fetchGraphQl(QUOTE_DATA_QUERY, {\n variables: {\n quoteId\n }\n });\n\n const transformedQuote = transformQuote(results?.data?.negotiableQuote);\n\n if (!transformedQuote) {\n throw new Error('Failed to transform quote data');\n }\n\n events.emit('quote-management/quote-data', {\n quote: transformedQuote,\n permissions: state.permissions,\n });\n \n return transformedQuote;\n } catch (error) {\n return Promise.reject(error);\n }\n}\n","import { Initializer } from '@adobe-commerce/elsie/lib';\nimport { Lang } from '@adobe-commerce/elsie/i18n';\nimport { events } from '@adobe-commerce/event-bus';\nimport { state, DEFAULT_PERMISSIONS } from '@/quote-management/lib/state';\nimport { getCustomerData } from '@/quote-management/api/getCustomerData';\nimport { getQuoteData } from '@/quote-management/api/getQuoteData';\n\ntype ConfigProps = {\n langDefinitions?: Lang;\n quoteId?: string;\n};\n\nexport const initialize = new Initializer<ConfigProps>({\n init: async (config) => {\n const defaultConfig = {};\n\n initialize.config.setConfig({ ...defaultConfig, ...config });\n },\n\n listeners: () => [\n events.on('authenticated', async (authenticated) => {\n state.authenticated = !!authenticated;\n\n if (authenticated) {\n getCustomerData().then((customerData) => {\n state.permissions = {\n requestQuote: customerData.permissions.canRequestQuote,\n editQuote: customerData.permissions.canEditQuote,\n deleteQuote: customerData.permissions.canDeleteQuote,\n checkoutQuote: customerData.permissions.canCheckoutQuote,\n };\n events.emit('quote-management/permissions', state.permissions);\n })\n .catch((error) => {\n console.error(error);\n state.permissions = DEFAULT_PERMISSIONS;\n events.emit('quote-management/permissions', DEFAULT_PERMISSIONS);\n });\n } else {\n state.permissions = DEFAULT_PERMISSIONS;\n events.emit('quote-management/permissions', DEFAULT_PERMISSIONS);\n }\n }, {\n eager: true,\n }),\n events.on('quote-management/permissions', async (permissions) => {\n const quoteId = initialize.config.getConfig().quoteId;\n if (!quoteId) {\n return;\n }\n\n if (permissions.editQuote) {\n getQuoteData(quoteId).then((quoteData) => {\n events.emit('quote-management/quote-data/initialized', {\n quote: quoteData,\n permissions,\n }, {});\n }).catch((error) => {\n events.emit('quote-management/quote-data/error', {\n error,\n });\n });\n }\n }, {\n eager: true,\n }),\n ],\n});\n\nexport const config = initialize.config;\n","/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2024 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\n\nimport { NEGOTIABLE_QUOTE_FRAGMENT } from '@/quote-management/api/graphql/NegotiableQuoteFragment';\n\nexport const SET_NEGOTIABLE_QUOTE_SHIPPING_ADDRESS_MUTATION = `\n mutation SET_NEGOTIABLE_QUOTE_SHIPPING_ADDRESS_MUTATION(\n $quoteUid: ID!\n $addressId: ID\n $addressData: NegotiableQuoteAddressInput\n ) {\n setNegotiableQuoteShippingAddress(\n input: {\n quote_uid: $quoteUid\n shipping_addresses: {\n customer_address_uid: $addressId\n address: $addressData\n }\n }\n ) {\n quote {\n ...NegotiableQuoteFragment\n }\n }\n }\n ${NEGOTIABLE_QUOTE_FRAGMENT}\n`;\n\n","/********************************************************************\n * Copyright 2025 Adobe\n * All Rights Reserved.\n *\n * NOTICE: Adobe permits you to use, modify, and distribute this\n * file in accordance with the terms of the Adobe license agreement\n * accompanying it.\n *******************************************************************/\n\nimport { fetchGraphQl } from '@adobe-commerce/fetch-graphql';\nimport { events } from '@adobe-commerce/event-bus';\nimport { SET_NEGOTIABLE_QUOTE_SHIPPING_ADDRESS_MUTATION } from './graphql/SetNegotiableQuoteShippingAddressMutation';\nimport { NegotiableQuoteModel } from '@/quote-management/data/models/negotiable-quote-model';\nimport { transformQuote } from '@/quote-management/data/transforms';\n\nexport interface AddressInput {\n /** City name */\n city: string;\n /** Optional company name */\n company?: string;\n /** Two-letter country code (e.g., 'US') */\n countryCode: string;\n /** First name */\n firstname: string;\n /** Last name */\n lastname: string;\n /** Postal/ZIP code */\n postcode: string;\n /** Optional state/province name */\n region?: string;\n /** Optional state/province ID */\n regionId?: number;\n /** Whether to save this address to the customer's address book */\n saveInAddressBook?: boolean;\n /** Street address lines (array) */\n street: string[];\n /** Phone number */\n telephone: string;\n /** \n * Additional input (optional custom fields for the address).\n * These fields will be merged into the address data sent to GraphQL.\n * Standard fields take precedence over additional fields to prevent\n * accidental override of required address attributes.\n * \n * @example\n * ```ts\n * additionalInput: {\n * vat_id: 'GB123456789',\n * custom_attribute: 'value',\n * delivery_instructions: 'Leave at door'\n * }\n * ```\n */\n additionalInput?: Record<string, any>;\n}\n\nexport interface SetShippingAddressInput {\n /** The unique ID of the negotiable quote */\n quoteUid: string;\n /** The ID of a saved customer address (use this OR addressData, not both) */\n addressId?: number;\n /** New address data (use this OR addressId, not both) */\n addressData?: AddressInput;\n}\n\n/**\n * Transform camelCase address data to snake_case for GraphQL mutation.\n * Additional fields from additionalInput are spread into the result, with\n * standard fields taking precedence (defensive flexibility approach).\n */\nfunction transformAddressToSnakeCase(address: AddressInput) {\n const { additionalInput, ...standardFields } = address;\n \n // Build the standard transformed fields\n const transformedStandardFields = {\n city: standardFields.city,\n company: standardFields.company,\n country_code: standardFields.countryCode,\n firstname: standardFields.firstname,\n lastname: standardFields.lastname,\n postcode: standardFields.postcode,\n region: standardFields.region,\n region_id: standardFields.regionId,\n save_in_address_book: standardFields.saveInAddressBook,\n street: standardFields.street,\n telephone: standardFields.telephone,\n };\n \n // Spread additional input first, then standard fields take precedence\n // This provides defensive flexibility: allows custom fields while protecting core fields\n return {\n ...(additionalInput || {}),\n ...transformedStandardFields,\n };\n}\n\n/**\n * Sets or updates the shipping address for a negotiable quote.\n * \n * @param input - The input parameters for setting the shipping address\n * @param input.quoteUid - The unique ID of the negotiable quote\n * @param input.addressId - Optional ID of a saved customer address (use this OR addressData)\n * @param input.addressData - Optional new address data (use this OR addressId)\n * @param input.addressData.additionalInput - Optional additional address fields to pass through to GraphQL\n * @returns Promise that resolves to the updated quote model with shipping addresses including uid field\n * @throws Error if validation fails or GraphQL operation fails\n * \n * @example\n * ```ts\n * // Using a saved address\n * const quote = await setShippingAddress({\n * quoteUid: 'quote-123',\n * addressId: 5\n * });\n * \n * // Using new address data\n * const quote = await setShippingAddress({\n * quoteUid: 'quote-123',\n * addressData: {\n * firstname: 'John',\n * lastname: 'Doe',\n * street: ['123 Main St'],\n * city: 'San Francisco',\n * countryCode: 'US',\n * postcode: '94103',\n * telephone: '555-1234'\n * }\n * });\n * \n * // Using address data with additional custom fields\n * const quote = await setShippingAddress({\n * quoteUid: 'quote-123',\n * addressData: {\n * firstname: 'John',\n * lastname: 'Doe',\n * street: ['123 Main St'],\n * city: 'San Francisco',\n * countryCode: 'US',\n * postcode: '94103',\n * telephone: '555-1234',\n * additionalInput: {\n * vat_id: 'GB123456789',\n * custom_attribute_1: 'value1',\n * delivery_instructions: 'Leave at door'\n * }\n * }\n * });\n * \n * // Access address identifier\n * if (quote?.shippingAddresses?.[0]) {\n * console.log('Address UID:', quote.shippingAddresses[0].uid);\n * }\n * ```\n */\nexport const setShippingAddress = async (\n input: SetShippingAddressInput\n): Promise<NegotiableQuoteModel | null> => {\n const { quoteUid, addressId, addressData } = input;\n\n if (!quoteUid) {\n throw new Error('Quote UID is required');\n }\n\n // Validate that exactly one of addressId or addressData is provided\n if (addressId === undefined && !addressData) {\n throw new Error('Either addressId or addressData must be provided');\n }\n\n if (addressId !== undefined && addressData) {\n throw new Error('Cannot provide both addressId and addressData');\n }\n\n // Transform addressData to snake_case if provided\n const transformedAddressData = addressData\n ? transformAddressToSnakeCase(addressData)\n : null;\n\n return fetchGraphQl(SET_NEGOTIABLE_QUOTE_SHIPPING_ADDRESS_MUTATION, {\n variables: {\n quoteUid,\n addressId: addressId || null,\n addressData: transformedAddressData,\n },\n }).then((response) => {\n const { errors } = response;\n\n if (errors) {\n // Provide more detailed error information\n const errorMessages = errors.map((error) => error.message).join('; ');\n throw new Error(`Failed to set shipping address: ${errorMessages}`);\n }\n\n // Transform the quote data\n const quoteData = transformQuote(\n response.data?.setNegotiableQuoteShippingAddress?.quote\n );\n\n if (!quoteData) {\n throw new Error(\n 'Failed to transform quote data: Invalid response structure'\n );\n }\n\n // Emit event with transformed quote data on success\n events.emit('quote-management/shipping-address-set', {\n quote: quoteData,\n input: { quoteUid, addressId, addressData },\n });\n\n return quoteData;\n });\n};\n\n"],"names":["CUSTOMER_FRAGMENT","CUSTOMER_QUERY","CAN_REQUEST_QUOTE_PERMISSION","CAN_EDIT_QUOTE_PERMISSION","CAN_DELETE_QUOTE_PERMISSION","CAN_CHECKOUT_QUOTE_PERMISSION","flattenPermissions","permissions","result","traverse","nodes","path","node","currentPath","transformCustomer","customerData","role","DEFAULT_PERMISSIONS","flattenedPermissions","getCustomerData","state","results","fetchGraphQl","_a","error","QUOTE_DATA_QUERY","NEGOTIABLE_QUOTE_FRAGMENT","getQuoteData","quoteId","transformedQuote","transformQuote","events","initialize","Initializer","config","defaultConfig","authenticated","quoteData","SET_NEGOTIABLE_QUOTE_SHIPPING_ADDRESS_MUTATION","transformAddressToSnakeCase","address","additionalInput","standardFields","transformedStandardFields","setShippingAddress","input","quoteUid","addressId","addressData","transformedAddressData","response","errors","errorMessages","_b"],"mappings":"qhBAAO,MAAMA,EAAkC;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,ECElCC,EAAiB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,MAOxBD,CAAiB;AAAA,ECQjBE,EAA+B,wCAC/BC,EAA4B,wCAC5BC,EAA8B,wCAC9BC,EAAgC,sCAOzBC,EAAsBC,GAA+C,CAC9E,MAAMC,EAAmB,CAAA,EAGnBC,EAAW,CAACC,EAA4BC,EAAiB,CAAA,IAAO,CAClE,UAAWC,KAAQF,EAAO,CACtB,MAAMG,EAAc,CAAC,GAAGF,EAAMC,EAAK,IAAI,EAEnCA,EAAK,UAAYA,EAAK,SAAS,OAAS,EACxCH,EAASG,EAAK,SAAUC,CAAW,EAEnCL,EAAO,KAAKK,EAAY,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AAO,EAAE,KAAK,IAAI,EACpE,MAAM,IAAI,MAAM,mCAAmC4B,CAAa,EAAE,CACpE,CAGA,MAAMf,EAAYP,GAChBuB,GAAA9B,EAAA2B,EAAS,OAAT,YAAA3B,EAAe,oCAAf,YAAA8B,EAAkD,KAAA,EAGpD,GAAI,CAAChB,EACH,MAAM,IAAI,MACR,4DAAA,EAKJ,OAAAN,EAAO,KAAK,wCAAyC,CACnD,MAAOM,EACP,MAAO,CAAE,SAAAS,EAAU,UAAAC,EAAW,YAAAC,CAAA,CAAY,CAC3C,EAEMX,CACT,CAAC,CACH"}
@@ -0,0 +1,4 @@
1
+ /*! Copyright 2025 Adobe
2
+ All Rights Reserved. */
3
+ import{jsx as e,jsxs as s,Fragment as E}from"@dropins/tools/preact-jsx-runtime.js";import{useState as O,useEffect as j}from"@dropins/tools/preact-compat.js";import{classes as g,VComponent as v,Slot as f}from"@dropins/tools/lib.js";import{h as x}from"@dropins/tools/preact.js";import{Skeleton as A,SkeletonRow as D,Picker as z,Price as b,Checkbox as F,Button as G,Table as R,Accordion as V,AccordionSection as W}from"@dropins/tools/components.js";/* empty css */import{useText as S}from"@dropins/tools/i18n.js";import{events as J}from"@dropins/tools/event-bus.js";const Q=({className:d,loading:c,table:u,pricesSummary:n,...a})=>c?e(K,{}):s("div",{className:g(["quote-management-items-quoted",d]),...a,children:[u&&e(v,{node:u,className:g(["quote-management-items-quoted__table"]),"data-testid":"quote-management-items-quoted__table"}),n&&e(v,{node:n,className:g(["quote-management-items-quoted__prices-summary"]),"data-testid":"quote-management-items-quoted__prices-summary"})]}),K=()=>e(A,{"data-testid":"items-quoted-skeleton",children:e(D,{variant:"row",fullWidth:!0,size:"medium",lines:4,multilineGap:"xsmall"})}),X=({className:d,items:c,canEdit:u,onItemCheckboxChange:n,onItemDropdownChange:a,onUpdate:i,...o})=>{const l=S({updateButton:"NegotiableQuote.Manage.productListTable.submitButton",productNameHeader:"NegotiableQuote.Manage.productListTable.headers.productName",skuHeader:"NegotiableQuote.Manage.productListTable.headers.sku",priceHeader:"NegotiableQuote.Manage.productListTable.headers.price",quantityHeader:"NegotiableQuote.Manage.productListTable.headers.quantity",discountHeader:"NegotiableQuote.Manage.productListTable.headers.discount",subtotalHeader:"NegotiableQuote.Manage.productListTable.headers.subtotal",actionsHeader:"NegotiableQuote.Manage.productListTable.headers.actions",editNoteToSeller:"NegotiableQuote.Manage.productListTable.actions.editNoteToSeller",remove:"NegotiableQuote.Manage.productListTable.actions.remove"}),p=[{label:l.productNameHeader,key:"productName"},{label:l.skuHeader,key:"sku"},{label:l.priceHeader,key:"price"},{label:l.quantityHeader,key:"quantity"},{label:l.discountHeader,key:"discount"},{label:l.subtotalHeader,key:"subtotal"}];u&&(p.unshift({label:"",key:"checkbox"}),p.push({label:l.actionsHeader,key:"actions"}));const q=(t,r)=>{const N=t.target.checked;n==null||n(r,N)},_=(t,r)=>{const N=t.target.value;a==null||a(r,N)},h=t=>{t.preventDefault(),i==null||i(t)},L=(t,r)=>t>0?s("div",{className:"quote-management-product-list-table__discount-container",children:[s("span",{className:"quote-management-product-list-table__discount-percent",children:[r,"%"]}),s("span",{className:"quote-management-product-list-table__discount-price",children:["(",e(b,{amount:t}),")"]})]}):void 0,P=t=>{var T,k;const r=(T=t.configurableOptions)==null?void 0:T.map(m=>s("div",{className:"quote-management-product-list-table__configurable-option",children:[s("span",{className:"quote-management-product-list-table__configurable-option-label",children:[m.optionLabel,":"]}),e("span",{className:"quote-management-product-list-table__configurable-option-value",children:m.valueLabel})]},m.optionLabel)),N=(k=t.bundleOptions)==null?void 0:k.map(m=>s("div",{className:"quote-management-product-list-table__bundle-option",children:[e("span",{className:"quote-management-product-list-table__bundle-option-label",children:m.label}),e("div",{className:"quote-management-product-list-table__bundle-option-values",children:m.values.map(y=>s("span",{className:"quote-management-product-list-table__bundle-option-value",children:[s("span",{className:"quote-management-product-list-table__bundle-option-value-quantity",children:[y.quantity," x"]}),e("span",{className:"quote-management-product-list-table__bundle-option-value-label",children:y.label}),e(b,{className:"quote-management-product-list-table__bundle-option-value-original-price",amount:y.originalPrice.value,currency:y.originalPrice.currency,weight:"normal"})]},y.label))})]},m.label));return s("div",{className:"quote-management-product-list-table__product-name-container",children:[e("span",{className:"quote-management-product-list-table__product-name",children:t.product.name}),r,N]})},H=c.map(t=>({checkbox:e(F,{className:"quote-management-product-list-table__checkbox",name:"itemSelected","data-testid":`item-checkbox-${t.product.sku}`,onChange:r=>q(r,t),value:t.product.sku}),productName:P(t),sku:e("span",{className:"quote-management-product-list-table__sku",children:t.product.sku}),price:e(b,{className:"quote-management-product-list-table__price",amount:t.prices.originalItemPrice.value,currency:t.prices.originalItemPrice.currency}),quantity:e("span",{className:"quote-management-product-list-table__quantity",children:t.quantity}),discount:L(t.catalogDiscount.amountOff,t.catalogDiscount.percentOff),subtotal:e(b,{className:"quote-management-product-list-table__subtotal",amount:t.prices.rowTotal.value,currency:t.prices.rowTotal.currency}),actions:e(z,{className:"quote-management-product-list-table__actions","data-testid":`item-dropdown-${t.product.sku}`,name:`item-dropdown-${t.product.sku}`,onChange:r=>_(r,t),placeholder:"Select",options:[{text:l.editNoteToSeller,value:"edit"},{text:l.remove,value:"remove"}],value:t.product.sku})})),M=e(R,{columns:p,rowData:H,"data-testid":"product-list-table",mobileLayout:"stacked"}),$=u?x("form",{}):x("div",{}),w=u?{onSubmit:h,...o}:o,B=u?e(G,{type:"submit","data-testid":"product-list-table-submit-button",children:l.updateButton}):void 0;return s(v,{node:$,className:g(["quote-management-product-list-table-container",d]),"data-testid":"product-list-table-container",...w,children:[M,e("div",{className:"quote-management-product-list-table-container__submit-container",children:B})]})},Y=({className:d,entries:c,...u})=>{const n=a=>{var o;const i=(o=a.children)==null?void 0:o.map(n);return e("div",{className:"quote-management-quote-prices-summary__entry","data-testid":`quote-prices-summary-entry-${a.id}`,children:i?e(V,{className:"quote-management-quote-prices-summary__accordion","data-testid":`quote-prices-summary-entry-accordion-${a.id}`,children:e(W,{className:"quote-management-quote-prices-summary__accordion-section",title:a.label,ariaLabelTitle:a.label,secondaryText:a.value,children:i})}):s(E,{children:[e("span",{className:g(["quote-management-quote-prices-summary__label",["quote-management-quote-prices-summary__label--strong",a.strong]]),"data-testid":`quote-prices-summary-entry-label-${a.id}`,children:a.label}),e("span",{className:"quote-management-quote-prices-summary__value","data-testid":`quote-prices-summary-entry-value-${a.id}`,children:a.value})]})},a.id)};return e("div",{className:g(["quote-management-quote-prices-summary",d]),"data-testid":"quote-prices-summary",...u,children:c==null?void 0:c.map(n)})},ue=({quoteData:d,onItemCheckboxChange:c,onItemDropdownChange:u,onUpdate:n,slots:a,...i})=>{const[o,l]=O(d),p=S({subtotal:"NegotiableQuote.Manage.quotePricesSummary.subtotal.excludingTax",grandTotal:"NegotiableQuote.Manage.quotePricesSummary.grandTotal.includingTax",appliedTaxes:"NegotiableQuote.Manage.quotePricesSummary.appliedTaxes"});if(j(()=>{const _=J.on("quote-management/quote-data",h=>{l(h.quote)},{eager:!0});return()=>_==null?void 0:_.off()},[]),!o)return e(Q,{loading:!0});const q=[];return o.prices.subtotalExcludingTax&&q.push({label:p.subtotal,id:"subtotal",value:e(b,{amount:o.prices.subtotalExcludingTax.value,currency:o.prices.subtotalExcludingTax.currency,weight:"normal"})}),o.prices.grandTotal&&q.push({label:p.grandTotal,id:"total",value:e(b,{amount:o.prices.grandTotal.value,currency:o.prices.grandTotal.currency}),strong:!0}),e(Q,{"data-testid":"items-quoted-container",...i,loading:!1,table:e(f,{name:"ProductListTable",slot:a==null?void 0:a.ProductListTable,context:{items:o.items,canEdit:!0,onItemCheckboxChange:c,onItemDropdownChange:u,onUpdate:n},children:e(X,{items:o.items,canEdit:!0,onItemCheckboxChange:c,onItemDropdownChange:u,onUpdate:n})}),pricesSummary:e(f,{name:"QuotePricesSummary",slot:a==null?void 0:a.QuotePricesSummary,context:{items:o.items,prices:o.prices},children:e(Y,{entries:q})})})};export{ue as I};
4
+ //# sourceMappingURL=ItemsQuoted.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ItemsQuoted.js","sources":["/@dropins/storefront-quote-management/src/components/ItemsQuoted/ItemsQuoted.tsx","/@dropins/storefront-quote-management/src/components/ProductListTable/ProductListTable.tsx","/@dropins/storefront-quote-management/src/components/QuotePricesSummary/QuotePricesSummary.tsx","/@dropins/storefront-quote-management/src/containers/ItemsQuoted/ItemsQuoted.tsx"],"sourcesContent":["/********************************************************************\n * Copyright 2025 Adobe\n * All Rights Reserved.\n *\n * NOTICE: Adobe permits you to use, modify, and distribute this \n * file in accordance with the terms of the Adobe license agreement \n * accompanying it. \n *******************************************************************/\n\nimport { FunctionComponent, VNode } from 'preact';\nimport { HTMLAttributes } from 'preact/compat';\nimport { classes, VComponent } from '@adobe-commerce/elsie/lib';\nimport '@/quote-management/components/ItemsQuoted/ItemsQuoted.css';\nimport { Skeleton, SkeletonRow } from '@adobe-commerce/elsie/components';\n\nexport interface ItemsQuotedProps extends Omit<HTMLAttributes<HTMLDivElement>, 'loading'> {\n loading?: boolean;\n table?: VNode;\n pricesSummary?: VNode;\n}\n\nexport const ItemsQuoted: FunctionComponent<ItemsQuotedProps> = ({\n className,\n loading,\n table,\n pricesSummary,\n ...props\n}) => {\n if (loading) {\n return <ItemsQuotedSkeleton />;\n }\n\n return (\n <div className={classes(['quote-management-items-quoted', className])} {...props}>\n {table && (\n <VComponent\n node={table}\n className={classes(['quote-management-items-quoted__table'])}\n data-testid=\"quote-management-items-quoted__table\"\n />\n )}\n {pricesSummary && (\n <VComponent\n node={pricesSummary}\n className={classes(['quote-management-items-quoted__prices-summary'])}\n data-testid=\"quote-management-items-quoted__prices-summary\"\n />\n )}\n </div>\n );\n};\n\nexport const ItemsQuotedSkeleton: FunctionComponent = () => {\n return (\n <Skeleton data-testid=\"items-quoted-skeleton\">\n <SkeletonRow variant=\"row\" fullWidth={true} size=\"medium\" lines={4} multilineGap='xsmall' />\n </Skeleton>\n );\n};","/********************************************************************\n * Copyright 2025 Adobe\n * All Rights Reserved.\n *\n * NOTICE: Adobe permits you to use, modify, and distribute this \n * file in accordance with the terms of the Adobe license agreement \n * accompanying it. \n *******************************************************************/\n\nimport { FunctionComponent, h } from 'preact';\nimport { HTMLAttributes } from 'preact/compat';\nimport { classes, VComponent } from '@adobe-commerce/elsie/lib';\nimport { Table, Checkbox, Picker, Price, Button } from '@adobe-commerce/elsie/components';\nimport '@/quote-management/components/ProductListTable/ProductListTable.css';\nimport { NegotiableQuoteCartItem } from '@/quote-management/data/models/negotiable-quote-model';\nimport { useText } from '@adobe-commerce/elsie/i18n';\n\nexport interface ProductListTableProps extends HTMLAttributes<HTMLDivElement | HTMLFormElement> {\n items: NegotiableQuoteCartItem[];\n canEdit: boolean;\n onItemCheckboxChange?: (item: NegotiableQuoteCartItem, isSelected: boolean) => void;\n onItemDropdownChange?: (item: NegotiableQuoteCartItem, action: string) => void;\n onUpdate?: (e: SubmitEvent) => void;\n}\n\nexport const ProductListTable: FunctionComponent<ProductListTableProps> = ({\n className,\n items,\n canEdit,\n onItemCheckboxChange,\n onItemDropdownChange,\n onUpdate,\n ...props\n}) => {\n\n const dictionary = useText({\n updateButton: 'NegotiableQuote.Manage.productListTable.submitButton',\n productNameHeader: 'NegotiableQuote.Manage.productListTable.headers.productName',\n skuHeader: 'NegotiableQuote.Manage.productListTable.headers.sku',\n priceHeader: 'NegotiableQuote.Manage.productListTable.headers.price',\n quantityHeader: 'NegotiableQuote.Manage.productListTable.headers.quantity',\n discountHeader: 'NegotiableQuote.Manage.productListTable.headers.discount',\n subtotalHeader: 'NegotiableQuote.Manage.productListTable.headers.subtotal',\n actionsHeader: 'NegotiableQuote.Manage.productListTable.headers.actions',\n editNoteToSeller: 'NegotiableQuote.Manage.productListTable.actions.editNoteToSeller',\n remove: 'NegotiableQuote.Manage.productListTable.actions.remove',\n });\n\n const columns = [\n {\n label: dictionary.productNameHeader,\n key: 'productName',\n },\n {\n label: dictionary.skuHeader,\n key: 'sku',\n },\n {\n label: dictionary.priceHeader,\n key: 'price',\n },\n {\n label: dictionary.quantityHeader,\n key: 'quantity',\n },\n {\n label: dictionary.discountHeader,\n key: 'discount',\n },\n {\n label: dictionary.subtotalHeader,\n key: 'subtotal',\n },\n ];\n\n if (canEdit) {\n columns.unshift({\n label: '',\n key: 'checkbox',\n });\n columns.push({\n label: dictionary.actionsHeader,\n key: 'actions',\n });\n }\n\n const handleItemCheckboxChange = (event: Event, item: NegotiableQuoteCartItem) => {\n const isSelected = (event.target as HTMLInputElement).checked;\n onItemCheckboxChange?.(item, isSelected);\n };\n\n const handleItemDropdownChange = (event: Event, item: NegotiableQuoteCartItem) => {\n const action = (event.target as HTMLSelectElement).value;\n onItemDropdownChange?.(item, action);\n };\n\n const handleUpdate = (event: SubmitEvent) => {\n event.preventDefault();\n onUpdate?.(event);\n };\n\n const discountElement = (amountOff: number, percentOff: number) => {\n return amountOff > 0 ?\n <div className=\"quote-management-product-list-table__discount-container\">\n <span className=\"quote-management-product-list-table__discount-percent\">{percentOff}%</span>\n <span className=\"quote-management-product-list-table__discount-price\">(<Price amount={amountOff} />)</span>\n </div>\n : undefined;\n };\n\n const getProductNameContent = (item: NegotiableQuoteCartItem) => {\n const configurableOptions = item.configurableOptions?.map((option) =>\n <div key={option.optionLabel} className=\"quote-management-product-list-table__configurable-option\">\n <span className=\"quote-management-product-list-table__configurable-option-label\">{option.optionLabel}:</span>\n <span className=\"quote-management-product-list-table__configurable-option-value\">{option.valueLabel}</span>\n </div>);\n\n const bundleOptions = item.bundleOptions?.map((option) =>\n <div key={option.label} className=\"quote-management-product-list-table__bundle-option\">\n <span className=\"quote-management-product-list-table__bundle-option-label\">{option.label}</span>\n <div className=\"quote-management-product-list-table__bundle-option-values\">\n {option.values.map((value) =>\n <span key={value.label} className=\"quote-management-product-list-table__bundle-option-value\">\n <span className=\"quote-management-product-list-table__bundle-option-value-quantity\">{value.quantity} x</span>\n <span className=\"quote-management-product-list-table__bundle-option-value-label\">{value.label}</span>\n <Price className=\"quote-management-product-list-table__bundle-option-value-original-price\"\n amount={value.originalPrice.value}\n currency={value.originalPrice.currency}\n weight=\"normal\"\n />\n </span>\n )}\n </div>\n </div>);\n\n return (\n <div className=\"quote-management-product-list-table__product-name-container\">\n <span className=\"quote-management-product-list-table__product-name\">{item.product.name}</span>\n {configurableOptions}\n {bundleOptions}\n </div>\n )\n };\n\n const rowData = items.map((item) => {\n return {\n checkbox: <Checkbox className=\"quote-management-product-list-table__checkbox\" name=\"itemSelected\" data-testid={`item-checkbox-${item.product.sku}`} onChange={(e) => handleItemCheckboxChange(e, item)} value={item.product.sku} />,\n productName: getProductNameContent(item),\n sku: <span className=\"quote-management-product-list-table__sku\">{item.product.sku}</span>,\n price: <Price className=\"quote-management-product-list-table__price\" amount={item.prices.originalItemPrice.value} currency={item.prices.originalItemPrice.currency} />,\n quantity: <span className=\"quote-management-product-list-table__quantity\">{item.quantity}</span>,\n discount: discountElement(item.catalogDiscount.amountOff, item.catalogDiscount.percentOff),\n subtotal: <Price className=\"quote-management-product-list-table__subtotal\" amount={item.prices.rowTotal.value} currency={item.prices.rowTotal.currency} />,\n actions: <Picker\n className=\"quote-management-product-list-table__actions\"\n data-testid={`item-dropdown-${item.product.sku}`}\n name={`item-dropdown-${item.product.sku}`}\n onChange={(e) => handleItemDropdownChange(e, item)}\n placeholder=\"Select\"\n options={[{ text: dictionary.editNoteToSeller, value: 'edit' }, { text: dictionary.remove, value: 'remove' }]}\n value={item.product.sku}\n />,\n }\n });\n\n const table = <Table columns={columns} rowData={rowData} data-testid=\"product-list-table\" mobileLayout='stacked' />\n\n // if can edit, the wrapper node should use the form element, else use the div element\n const wrapperNode = canEdit ? h('form', {}) : h('div', {});\n const wrapperProps = canEdit ? {\n onSubmit: handleUpdate,\n ...props,\n } : props;\n\n const submitButton = canEdit ? <Button type=\"submit\" data-testid=\"product-list-table-submit-button\">{dictionary.updateButton}</Button> : undefined;\n\n return (\n <VComponent\n node={wrapperNode}\n className={classes(['quote-management-product-list-table-container', className])}\n data-testid=\"product-list-table-container\"\n {...wrapperProps}\n >\n {table}\n <div className=\"quote-management-product-list-table-container__submit-container\">\n {submitButton}\n </div>\n </VComponent>\n );\n};\n","/********************************************************************\n * Copyright 2025 Adobe\n * All Rights Reserved.\n *\n * NOTICE: Adobe permits you to use, modify, and distribute this \n * file in accordance with the terms of the Adobe license agreement \n * accompanying it. \n *******************************************************************/\n \nimport { FunctionComponent, VNode } from 'preact';\nimport { HTMLAttributes } from 'preact/compat';\nimport { classes } from '@adobe-commerce/elsie/lib';\nimport '@/quote-management/components/QuotePricesSummary/QuotePricesSummary.css';\nimport { Accordion, AccordionSection } from '@adobe-commerce/elsie/components';\n\ninterface Entry {\n label: string;\n id: string;\n value: VNode;\n strong?: boolean;\n children?: Entry[];\n}\n\nexport interface QuotePricesSummaryProps extends HTMLAttributes<HTMLDivElement> {\n entries?: Entry[];\n}\n\nexport const QuotePricesSummary: FunctionComponent<QuotePricesSummaryProps> = ({\n className,\n entries,\n ...props\n}) => {\n const createEntry = (entry: Entry) => {\n const children = entry.children?.map(createEntry);\n return (\n <div key={entry.id} className=\"quote-management-quote-prices-summary__entry\" data-testid={`quote-prices-summary-entry-${entry.id}`}>\n {children ? <Accordion\n className=\"quote-management-quote-prices-summary__accordion\"\n data-testid={`quote-prices-summary-entry-accordion-${entry.id}`}\n >\n <AccordionSection className=\"quote-management-quote-prices-summary__accordion-section\" title={entry.label} ariaLabelTitle={entry.label} secondaryText={entry.value}>\n {children}\n </AccordionSection>\n </Accordion>\n :\n <>\n <span className={classes(['quote-management-quote-prices-summary__label', ['quote-management-quote-prices-summary__label--strong', entry.strong]])} data-testid={`quote-prices-summary-entry-label-${entry.id}`}>{entry.label}</span>\n <span className=\"quote-management-quote-prices-summary__value\" data-testid={`quote-prices-summary-entry-value-${entry.id}`}>{entry.value}</span>\n </>\n }\n </div>\n );\n };\n\n return (\n <div className={classes(['quote-management-quote-prices-summary', className])} data-testid=\"quote-prices-summary\" {...props}>\n {entries?.map(createEntry)}\n </div>\n );\n};\n","/********************************************************************\n * Copyright 2025 Adobe\n * All Rights Reserved.\n *\n * NOTICE: Adobe permits you to use, modify, and distribute this \n * file in accordance with the terms of the Adobe license agreement \n * accompanying it. \n *******************************************************************/\n\nimport { HTMLAttributes, useEffect, useState } from 'preact/compat';\nimport { Container, Slot, SlotProps } from '@adobe-commerce/elsie/lib';\nimport { ProductListTable } from '@/quote-management/components/ProductListTable/ProductListTable';\nimport { NegotiableQuoteModel, NegotiableQuoteCartItem } from '@/quote-management/data/models/negotiable-quote-model';\nimport { events } from '@adobe-commerce/event-bus';\nimport { QuotePricesSummary } from '@/quote-management/components/QuotePricesSummary';\nimport { ItemsQuoted as ItemsQuotedComponent } from '@/quote-management/components/ItemsQuoted';\nimport { Price } from '@adobe-commerce/elsie/components';\nimport { useText } from '@adobe-commerce/elsie/i18n';\n\nexport interface ItemsQuotedProps extends HTMLAttributes<HTMLDivElement> {\n quoteData?: NegotiableQuoteModel;\n onItemCheckboxChange?: (item: NegotiableQuoteCartItem, isSelected: boolean) => void;\n onItemDropdownChange?: (item: NegotiableQuoteCartItem, action: string) => void;\n onUpdate?: (e: SubmitEvent) => void;\n slots?: {\n ProductListTable?: SlotProps<{\n items: NegotiableQuoteModel['items'];\n canEdit: boolean;\n onItemCheckboxChange?: (item: NegotiableQuoteCartItem, isSelected: boolean) => void;\n onItemDropdownChange?: (item: NegotiableQuoteCartItem, action: string) => void;\n onUpdate?: (e: SubmitEvent) => void;\n }>;\n QuotePricesSummary?: SlotProps<{\n items: NegotiableQuoteModel['items'];\n prices: NegotiableQuoteModel['prices'];\n }>;\n }\n}\n\nexport const ItemsQuoted: Container<ItemsQuotedProps> = ({\n quoteData: initialData,\n onItemCheckboxChange,\n onItemDropdownChange,\n onUpdate,\n slots,\n ...props\n}) => {\n const [quoteData, setQuoteData] = useState<NegotiableQuoteModel | undefined>(initialData);\n\n const dictionary = useText({\n subtotal: 'NegotiableQuote.Manage.quotePricesSummary.subtotal.excludingTax',\n grandTotal: 'NegotiableQuote.Manage.quotePricesSummary.grandTotal.includingTax',\n appliedTaxes: 'NegotiableQuote.Manage.quotePricesSummary.appliedTaxes',\n });\n\n useEffect(() => {\n const quoteDataEvent = events.on('quote-management/quote-data', (data: { quote: NegotiableQuoteModel }) => {\n setQuoteData(data.quote);\n }, {\n eager: true,\n });\n return () => quoteDataEvent?.off();\n }, []);\n\n if (!quoteData) {\n return <ItemsQuotedComponent loading={true} />;\n }\n\n const quotePricesSummaryEntries = [];\n\n quoteData.prices.subtotalExcludingTax && quotePricesSummaryEntries.push({\n label: dictionary.subtotal,\n id: 'subtotal',\n value: <Price amount={quoteData.prices.subtotalExcludingTax.value} currency={quoteData.prices.subtotalExcludingTax.currency} weight='normal' />,\n })\n\n quoteData.prices.grandTotal && quotePricesSummaryEntries.push({\n label: dictionary.grandTotal,\n id: 'total',\n value: <Price amount={quoteData.prices.grandTotal.value} currency={quoteData.prices.grandTotal.currency} />,\n strong: true,\n })\n\n return (\n <ItemsQuotedComponent data-testid=\"items-quoted-container\" {...props} loading={false}\n table={<Slot name=\"ProductListTable\" slot={slots?.ProductListTable}\n context={{\n items: quoteData.items,\n canEdit: true,\n onItemCheckboxChange,\n onItemDropdownChange,\n onUpdate\n }}>\n <ProductListTable\n items={quoteData.items}\n canEdit={true}\n onItemCheckboxChange={onItemCheckboxChange}\n onItemDropdownChange={onItemDropdownChange}\n onUpdate={onUpdate}\n />\n </Slot>}\n pricesSummary={<Slot name=\"QuotePricesSummary\" slot={slots?.QuotePricesSummary} context={{\n items: quoteData.items,\n prices: quoteData.prices,\n }}>\n <QuotePricesSummary entries={quotePricesSummaryEntries} />\n </Slot>\n }\n />\n );\n};"],"names":["ItemsQuoted","className","loading","table","pricesSummary","props","ItemsQuotedSkeleton","jsxs","classes","jsx","VComponent","Skeleton","SkeletonRow","ProductListTable","items","canEdit","onItemCheckboxChange","onItemDropdownChange","onUpdate","dictionary","useText","columns","handleItemCheckboxChange","event","item","isSelected","handleItemDropdownChange","action","handleUpdate","discountElement","amountOff","percentOff","Price","getProductNameContent","configurableOptions","_a","option","bundleOptions","_b","value","rowData","Checkbox","e","Picker","Table","wrapperNode","h","wrapperProps","submitButton","Button","QuotePricesSummary","entries","createEntry","entry","children","Accordion","AccordionSection","Fragment","initialData","slots","quoteData","setQuoteData","useState","useEffect","quoteDataEvent","events","data","ItemsQuotedComponent","quotePricesSummaryEntries","Slot"],"mappings":"okBAqBO,MAAMA,EAAmD,CAAC,CAC/D,UAAAC,EACA,QAAAC,EACA,MAAAC,EACA,cAAAC,EACA,GAAGC,CACL,IACMH,IACMI,EAAA,EAAoB,EAI5BC,EAAC,MAAA,CAAI,UAAWC,EAAQ,CAAC,gCAAiCP,CAAS,CAAC,EAAI,GAAGI,EACxE,SAAA,CAAAF,GACCM,EAACC,EAAA,CACC,KAAMP,EACN,UAAWK,EAAQ,CAAC,sCAAsC,CAAC,EAC3D,cAAY,sCAAA,CAAA,EAGfJ,GACCK,EAACC,EAAA,CACC,KAAMN,EACN,UAAWI,EAAQ,CAAC,+CAA+C,CAAC,EACpE,cAAY,+CAAA,CAAA,CACd,EAEJ,EAISF,EAAyC,MAEjDK,EAAA,CAAS,cAAY,wBACpB,SAAAF,EAACG,GAAY,QAAQ,MAAM,UAAW,GAAM,KAAK,SAAS,MAAO,EAAG,aAAa,SAAS,EAC5F,EC/BSC,EAA6D,CAAC,CACzE,UAAAZ,EACA,MAAAa,EACA,QAAAC,EACA,qBAAAC,EACA,qBAAAC,EACA,SAAAC,EACA,GAAGb,CACL,IAAM,CAEJ,MAAMc,EAAaC,EAAQ,CACzB,aAAc,uDACd,kBAAmB,8DACnB,UAAW,sDACX,YAAa,wDACb,eAAgB,2DAChB,eAAgB,2DAChB,eAAgB,2DAChB,cAAe,0DACf,iBAAkB,mEAClB,OAAQ,wDAAA,CACT,EAEKC,EAAU,CACd,CACE,MAAOF,EAAW,kBAClB,IAAK,aAAA,EAEP,CACE,MAAOA,EAAW,UAClB,IAAK,KAAA,EAEP,CACE,MAAOA,EAAW,YAClB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BQ,EAA0B,KAAK,CACtE,MAAOjD,EAAW,SAClB,GAAI,WACJ,MAAOV,EAACuB,EAAA,CAAM,OAAQ4B,EAAU,OAAO,qBAAqB,MAAO,SAAUA,EAAU,OAAO,qBAAqB,SAAU,OAAO,QAAA,CAAS,CAAA,CAC9I,EAEDA,EAAU,OAAO,YAAcQ,EAA0B,KAAK,CAC5D,MAAOjD,EAAW,WAClB,GAAI,QACJ,MAAOV,EAACuB,EAAA,CAAM,OAAQ4B,EAAU,OAAO,WAAW,MAAO,SAAUA,EAAU,OAAO,WAAW,QAAA,CAAU,EACzG,OAAQ,EAAA,CACT,EAGCnD,EAAC0D,EAAA,CAAqB,cAAY,yBAA0B,GAAG9D,EAAO,QAAS,GAC7E,MAAOI,EAAC4D,EAAA,CAAK,KAAK,mBAAmB,KAAMV,GAAA,YAAAA,EAAO,iBAChD,QAAS,CACP,MAAOC,EAAU,MACjB,QAAS,GACT,qBAAA5C,EACA,qBAAAC,EACA,SAAAC,CAAA,EAEF,SAAAT,EAACI,EAAA,CACC,MAAO+C,EAAU,MACjB,QAAS,GACT,qBAAA5C,EACA,qBAAAC,EACA,SAAAC,CAAA,CAAA,CACF,CAAA,EAEF,gBAAgBmD,EAAA,CAAK,KAAK,qBAAqB,KAAMV,GAAA,YAAAA,EAAO,mBAAoB,QAAS,CACvF,MAAOC,EAAU,MACjB,OAAQA,EAAU,MAAA,EAElB,SAAAnD,EAACyC,EAAA,CAAmB,QAASkB,EAA2B,CAAA,CAC1D,CAAA,CAAA,CAIN"}
@@ -21,6 +21,10 @@ const e=`
21
21
  lastname
22
22
  }
23
23
  text
24
+ attachments {
25
+ name
26
+ url
27
+ }
24
28
  }
25
29
  template_id
26
30
  template_name
@@ -70,29 +74,47 @@ const e=`
70
74
  }
71
75
  }
72
76
  quantity
77
+ note_from_buyer {
78
+ created_at
79
+ creator_id
80
+ creator_type
81
+ negotiable_quote_item_uid
82
+ note
83
+ note_uid
84
+ __typename
85
+ }
86
+ note_from_seller {
87
+ created_at
88
+ creator_id
89
+ creator_type
90
+ negotiable_quote_item_uid
91
+ note
92
+ note_uid
93
+ __typename
94
+ }
73
95
  ... on ConfigurableCartItem {
74
- configurable_options {
75
- option_label
76
- value_label
77
- }
78
- }
79
- ... on BundleCartItem {
80
- bundle_options {
81
- label
82
- values {
83
- label
84
- quantity
96
+ configurable_options {
97
+ option_label
98
+ value_label
99
+ }
100
+ }
101
+ ... on BundleCartItem {
102
+ bundle_options {
103
+ label
104
+ values {
105
+ label
106
+ quantity
85
107
  original_price {
86
- currency
87
- value
88
- }
89
- priceV2 {
90
- currency
91
- value
92
- }
93
- }
94
- }
95
- }
108
+ currency
109
+ value
110
+ }
111
+ priceV2 {
112
+ currency
113
+ value
114
+ }
115
+ }
116
+ }
117
+ }
96
118
  }
97
119
  history {
98
120
  uid
@@ -106,6 +128,11 @@ const e=`
106
128
  comment_added {
107
129
  comment
108
130
  }
131
+ custom_changes {
132
+ new_value
133
+ old_value
134
+ title
135
+ }
109
136
  statuses {
110
137
  changes {
111
138
  new_status
@@ -116,6 +143,25 @@ const e=`
116
143
  new_expiration
117
144
  old_expiration
118
145
  }
146
+ total {
147
+ new_price {
148
+ currency
149
+ value
150
+ }
151
+ old_price {
152
+ currency
153
+ value
154
+ }
155
+ }
156
+ products_removed {
157
+ products_removed_from_catalog
158
+ products_removed_from_quote {
159
+ uid
160
+ name
161
+ sku
162
+ quantity
163
+ }
164
+ }
119
165
  }
120
166
  }
121
167
  prices {
@@ -1 +1 @@
1
- {"version":3,"file":"NegotiableQuoteFragment.js","sources":["/@dropins/storefront-quote-management/src/api/graphql/NegotiableQuoteFragment.ts"],"sourcesContent":["/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2024 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\n\nexport const NEGOTIABLE_QUOTE_FRAGMENT = /* GraphQL */ `\n fragment NegotiableQuoteFragment on NegotiableQuote {\n uid\n name\n created_at\n status\n sales_rep_name\n expiration_date\n updated_at\n buyer {\n firstname\n lastname\n }\n comments {\n uid\n created_at\n author {\n firstname\n lastname\n }\n text\n }\n template_id\n template_name\n items {\n product {\n name\n sku\n uid\n stock_status\n quantity\n price_range {\n maximum_price {\n regular_price {\n value\n }\n }\n }\n }\n prices {\n price {\n currency\n value\n }\n original_item_price {\n currency\n value\n }\n original_row_total {\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 ... on ConfigurableCartItem {\n\t\t\t\tconfigurable_options {\n\t\t\t\t\toption_label\n\t\t\t\t\tvalue_label\n\t\t\t\t}\n\t\t\t}\n\t\t\t... on BundleCartItem {\n\t\t\t\tbundle_options {\n\t\t\t\t\tlabel\n\t\t\t\t\tvalues {\n\t\t\t\t\t\tlabel\n\t\t\t\t\t\tquantity\n original_price {\n\t\t\t\t\t\t\tcurrency\n\t\t\t\t\t\t\tvalue\n\t\t\t\t\t\t}\n\t\t\t\t\t\tpriceV2 {\n\t\t\t\t\t\t\tcurrency\n\t\t\t\t\t\t\tvalue\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\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 statuses {\n changes {\n new_status\n old_status\n }\n }\n expiration {\n new_expiration\n old_expiration\n }\n }\n }\n prices {\n subtotal_excluding_tax {\n currency\n value\n }\n subtotal_including_tax {\n currency\n value\n }\n subtotal_with_discount_excluding_tax {\n currency\n value\n }\n applied_taxes {\n amount {\n currency\n value\n }\n label\n }\n grand_total {\n currency\n value\n }\n }\n shipping_addresses {\n uid\n firstname\n lastname\n company\n street\n city\n region {\n code\n label\n region_id\n }\n postcode\n country {\n code\n label\n }\n telephone\n }\n }\n`;\n"],"names":["NEGOTIABLE_QUOTE_FRAGMENT"],"mappings":"AAiBO,MAAMA,EAA0C;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;"}
1
+ {"version":3,"file":"NegotiableQuoteFragment.js","sources":["/@dropins/storefront-quote-management/src/api/graphql/NegotiableQuoteFragment.ts"],"sourcesContent":["/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2024 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\n\nexport const NEGOTIABLE_QUOTE_FRAGMENT = /* GraphQL */ `\n fragment NegotiableQuoteFragment on NegotiableQuote {\n uid\n name\n created_at\n status\n sales_rep_name\n expiration_date\n updated_at\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 template_id\n template_name\n items {\n product {\n name\n sku\n uid\n stock_status\n quantity\n price_range {\n maximum_price {\n regular_price {\n value\n }\n }\n }\n }\n prices {\n price {\n currency\n value\n }\n original_item_price {\n currency\n value\n }\n original_row_total {\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_item_uid\n note\n note_uid\n __typename\n }\n note_from_seller {\n created_at\n creator_id\n creator_type\n negotiable_quote_item_uid\n note\n note_uid\n __typename\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 products_removed {\n products_removed_from_catalog\n products_removed_from_quote {\n uid\n name\n sku\n quantity\n }\n }\n }\n }\n prices {\n subtotal_excluding_tax {\n currency\n value\n }\n subtotal_including_tax {\n currency\n value\n }\n subtotal_with_discount_excluding_tax {\n currency\n value\n }\n applied_taxes {\n amount {\n currency\n value\n }\n label\n }\n grand_total {\n currency\n value\n }\n }\n shipping_addresses {\n uid\n firstname\n lastname\n company\n street\n city\n region {\n code\n label\n region_id\n }\n postcode\n country {\n code\n label\n }\n telephone\n }\n }\n`;\n"],"names":["NEGOTIABLE_QUOTE_FRAGMENT"],"mappings":"AAiBO,MAAMA,EAA0C;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;"}
@@ -0,0 +1,4 @@
1
+ /*! Copyright 2025 Adobe
2
+ All Rights Reserved. */
3
+ import{jsx as e,jsxs as i}from"@dropins/tools/preact-jsx-runtime.js";import{useState as g,useEffect as h}from"@dropins/tools/preact-compat.js";import{classes as d,VComponent as u,getGlobalLocale as p}from"@dropins/tools/lib.js";/* empty css */import{useText as f}from"@dropins/tools/i18n.js";import{events as _}from"@dropins/tools/event-bus.js";const y=({className:s,comments:m,...o})=>{const n=f({emptyState:"NegotiableQuote.Manage.quoteComments.emptyState",by:"NegotiableQuote.Manage.quoteComments.by"});return!m||m.length===0?e("ul",{...o,className:d(["quote-management-quote-comments-list","quote-management-quote-comments-list--empty",s]),"data-testid":"quote-comments-list",children:e("li",{className:"quote-management-quote-comments-list__empty-state","data-testid":"quote-comments-empty-state",children:n.emptyState})}):e("ul",{...o,className:d(["quote-management-quote-comments-list",s]),"data-testid":"quote-comments-list",children:m.map(t=>i("li",{className:"quote-management-quote-comments-list__item","data-testid":`quote-comment-${t.uid}`,children:[i("div",{className:"quote-management-quote-comments-list__header",children:[e(u,{className:"quote-management-quote-comments-list__date",node:t.createdAt,"data-testid":`quote-comment-date-${t.uid}`}),e("span",{className:"quote-management-quote-comments-list__by",children:n.by}),e(u,{className:"quote-management-quote-comments-list__author",node:t.author,"data-testid":`quote-comment-author-${t.uid}`})]}),e(u,{className:"quote-management-quote-comments-list__text",node:t.text,"data-testid":`quote-comment-text-${t.uid}`})]},t.uid))})},$=({quoteData:s,...m})=>{var r;const[o,n]=g(s);if(h(()=>{const a=_.on("quote-management/quote-data",q=>{n(q.quote)},{eager:!0});return()=>a==null?void 0:a.off()},[]),!o)return null;const t=p()||"en-US",l=new Intl.DateTimeFormat(t,{year:"numeric",month:"short",day:"numeric",hour:"2-digit",minute:"2-digit",second:"2-digit",hour12:!0}),c=(r=o==null?void 0:o.comments)==null?void 0:r.map(a=>({uid:a.uid,createdAt:e("span",{children:l.format(new Date(a.createdAt))}),author:i("span",{children:[a.author.firstname," ",a.author.lastname]}),text:e("p",{children:a.text})}));return e(y,{"data-testid":"quote-comments-list-container",...m,comments:c||[]})};export{$ as Q};
4
+ //# sourceMappingURL=QuoteCommentsList.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"QuoteCommentsList.js","sources":["/@dropins/storefront-quote-management/src/components/QuoteCommentsList/QuoteCommentsList.tsx","/@dropins/storefront-quote-management/src/containers/QuoteCommentsList/QuoteCommentsList.tsx"],"sourcesContent":["/********************************************************************\n * Copyright 2025 Adobe\n * All Rights Reserved.\n *\n * NOTICE: Adobe permits you to use, modify, and distribute this\n * file in accordance with the terms of the Adobe license agreement\n * accompanying it.\n *******************************************************************/\n\nimport { FunctionComponent, VNode } from 'preact';\nimport { HTMLAttributes } from 'preact/compat';\nimport { classes, VComponent } from '@adobe-commerce/elsie/lib';\nimport { useText } from '@adobe-commerce/elsie/i18n';\nimport '@/quote-management/components/QuoteCommentsList/QuoteCommentsList.css';\n\nexport interface QuoteCommentsListProps\n extends HTMLAttributes<HTMLUListElement> {\n comments: Array<{\n uid: string;\n createdAt: VNode;\n author: VNode;\n text: VNode;\n }>;\n}\n\nexport const QuoteCommentsList: FunctionComponent<QuoteCommentsListProps> = ({\n className,\n comments,\n ...props\n}) => {\n const dictionary = useText({\n emptyState: 'NegotiableQuote.Manage.quoteComments.emptyState',\n by: 'NegotiableQuote.Manage.quoteComments.by',\n });\n\n if (!comments || comments.length === 0) {\n return (\n <ul\n {...props}\n className={classes([\n 'quote-management-quote-comments-list',\n 'quote-management-quote-comments-list--empty',\n className,\n ])}\n data-testid=\"quote-comments-list\"\n >\n <li\n className=\"quote-management-quote-comments-list__empty-state\"\n data-testid=\"quote-comments-empty-state\"\n >\n {dictionary.emptyState}\n </li>\n </ul>\n );\n }\n\n return (\n <ul\n {...props}\n className={classes(['quote-management-quote-comments-list', className])}\n data-testid=\"quote-comments-list\"\n >\n {comments.map((comment) => (\n <li\n key={comment.uid}\n className=\"quote-management-quote-comments-list__item\"\n data-testid={`quote-comment-${comment.uid}`}\n >\n <div className=\"quote-management-quote-comments-list__header\">\n <VComponent\n className=\"quote-management-quote-comments-list__date\"\n node={comment.createdAt}\n data-testid={`quote-comment-date-${comment.uid}`}\n />\n <span className=\"quote-management-quote-comments-list__by\">\n {dictionary.by}\n </span>\n <VComponent\n className=\"quote-management-quote-comments-list__author\"\n node={comment.author}\n data-testid={`quote-comment-author-${comment.uid}`}\n />\n </div>\n <VComponent\n className=\"quote-management-quote-comments-list__text\"\n node={comment.text}\n data-testid={`quote-comment-text-${comment.uid}`}\n />\n </li>\n ))}\n </ul>\n );\n};\n","/********************************************************************\n * Copyright 2025 Adobe\n * All Rights Reserved.\n *\n * NOTICE: Adobe permits you to use, modify, and distribute this\n * file in accordance with the terms of the Adobe license agreement\n * accompanying it.\n *******************************************************************/\n\nimport { HTMLAttributes, useEffect, useState } from 'preact/compat';\nimport { Container, getGlobalLocale } from '@adobe-commerce/elsie/lib';\nimport { QuoteCommentsList as QuoteCommentsListComponent } from '@/quote-management/components/QuoteCommentsList';\nimport { NegotiableQuoteModel } from '@/quote-management/data/models/negotiable-quote-model';\nimport { events } from '@adobe-commerce/event-bus';\n\nexport interface QuoteCommentsListProps\n extends HTMLAttributes<HTMLUListElement> {\n quoteData?: NegotiableQuoteModel;\n}\n\nexport const QuoteCommentsList: Container<QuoteCommentsListProps> = ({\n quoteData: initialData,\n ...props\n}) => {\n const [quoteData, setQuoteData] = useState<NegotiableQuoteModel | undefined>(\n initialData\n );\n\n useEffect(() => {\n const quoteDataEvent = events.on(\n 'quote-management/quote-data',\n (data: { quote: NegotiableQuoteModel }) => {\n setQuoteData(data.quote);\n },\n {\n eager: true,\n }\n );\n return () => quoteDataEvent?.off();\n }, []);\n\n if (!quoteData) {\n return null;\n }\n\n // Format comments data\n const calculatedLocale = getGlobalLocale() || 'en-US';\n const dateFormatter = new Intl.DateTimeFormat(calculatedLocale, {\n year: 'numeric',\n month: 'short',\n day: 'numeric',\n hour: '2-digit',\n minute: '2-digit',\n second: '2-digit',\n hour12: true,\n });\n\n const formattedComments = quoteData?.comments?.map((comment) => ({\n uid: comment.uid,\n createdAt: <span>{dateFormatter.format(new Date(comment.createdAt))}</span>,\n author: (\n <span>\n {comment.author.firstname} {comment.author.lastname}\n </span>\n ),\n text: <p>{comment.text}</p>,\n }));\n\n return (\n <QuoteCommentsListComponent\n data-testid=\"quote-comments-list-container\"\n {...props}\n comments={formattedComments || []}\n />\n );\n};\n"],"names":["QuoteCommentsList","className","comments","props","dictionary","useText","jsx","classes","comment","jsxs","VComponent","initialData","quoteData","setQuoteData","useState","useEffect","quoteDataEvent","events","data","calculatedLocale","getGlobalLocale","dateFormatter","formattedComments","_a","QuoteCommentsListComponent"],"mappings":"0WAyBO,MAAMA,EAA+D,CAAC,CAC3E,UAAAC,EACA,SAAAC,EACA,GAAGC,CACL,IAAM,CACJ,MAAMC,EAAaC,EAAQ,CACzB,WAAY,kDACZ,GAAI,yCAAA,CACL,EAED,MAAI,CAACH,GAAYA,EAAS,SAAW,EAEjCI,EAAC,KAAA,CACE,GAAGH,EACJ,UAAWI,EAAQ,CACjB,uCACA,8CACAN,CAAA,CACD,EACD,cAAY,sBAEZ,SAAAK,EAAC,KAAA,CACC,UAAU,oDACV,cAAY,6BAEX,SAAAF,EAAW,U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IAAa,CAC/D,IAAKA,EAAQ,IACb,UAAWF,EAAC,OAAA,CAAM,SAAAe,EAAc,OAAO,IAAI,KAAKb,EAAQ,SAAS,CAAC,CAAA,CAAE,EACpE,SACG,OAAA,CACE,SAAA,CAAAA,EAAQ,OAAO,UAAU,IAAEA,EAAQ,OAAO,QAAA,EAC7C,EAEF,KAAMF,EAAC,IAAA,CAAG,SAAAE,EAAQ,IAAA,CAAK,CAAA,IAGzB,OACEF,EAACkB,EAAA,CACC,cAAY,gCACX,GAAGrB,EACJ,SAAUmB,GAAqB,CAAA,CAAC,CAAA,CAGtC"}
@@ -0,0 +1,4 @@
1
+ /*! Copyright 2025 Adobe
2
+ All Rights Reserved. */
3
+ import{jsxs as n,jsx as l}from"@dropins/tools/preact-jsx-runtime.js";import{useState as $,useEffect as D}from"@dropins/tools/preact-compat.js";import{events as U}from"@dropins/tools/event-bus.js";import{getGlobalLocale as Q,classes as q}from"@dropins/tools/lib.js";/* empty css */import{useText as P}from"@dropins/tools/i18n.js";function f(s,p){return p.format(new Date(s))}function I(){try{return Intl.DateTimeFormat().resolvedOptions().timeZone}catch(s){return console.warn("Failed to detect user timezone, falling back to UTC:",s),"UTC"}}const k=({className:s,children:p,quoteData:o,...v})=>{const c=Q()||"en-US",t=P({quoteCreated:"historyLog.changeTypes.created",quoteUpdated:"historyLog.changeTypes.updated",statusChanged:"historyLog.changeTypes.statusChanged",commentAdded:"historyLog.changeTypes.commentAdded",expirationChanged:"historyLog.changeTypes.expirationChanged",buyerNoteAdded:"historyLog.noteTypes.buyerNoteAdded",sellerNoteAdded:"historyLog.noteTypes.sellerNoteAdded",buyerLabel:"historyLog.authorLabels.buyer",sellerLabel:"historyLog.authorLabels.seller",commentDetail:"historyLog.changeDetails.comment",statusChangedFromTo:"historyLog.changeDetails.statusChangedFromTo",statusSetTo:"historyLog.changeDetails.statusSetTo",expirationChangedFromTo:"historyLog.changeDetails.expirationChangedFromTo",expirationSetTo:"historyLog.changeDetails.expirationSetTo",totalChangedFromTo:"historyLog.changeDetails.totalChangedFromTo",customChange:"historyLog.changeDetails.customChange",productsRemovedFromCatalog:"historyLog.changeDetails.productsRemovedFromCatalog",productsRemovedFromQuote:"historyLog.changeDetails.productsRemovedFromQuote",noDetailsAvailable:"historyLog.changeDetails.noDetailsAvailable",emptyState:"historyLog.emptyState",never:"dateUtils.never"}),h=new Intl.DateTimeFormat(c,{year:"numeric",month:"long",day:"numeric",hour:"2-digit",minute:"2-digit",second:"2-digit",timeZone:I()}),x=e=>{switch(e){case"CREATED":return t.quoteCreated;case"UPDATED":return t.quoteUpdated;case"STATUS_CHANGED":return t.statusChanged;case"COMMENT_ADDED":return t.commentAdded;case"EXPIRATION_CHANGED":return t.expirationChanged;default:return e.replace(/_/g," ").toLowerCase().replace(/\b\w/g,r=>r.toUpperCase())}},S=e=>{var a,u,T,y,m,C,L,N,F,_,b,w;const r=[];if((a=e==null?void 0:e.commentAdded)!=null&&a.comment&&r.push(t.commentDetail.replace("{comment}",e.commentAdded.comment)),(u=e==null?void 0:e.statuses)!=null&&u.changes&&e.statuses.changes.forEach(i=>{i.oldStatus&&i.newStatus?r.push(t.statusChangedFromTo.replace("{oldStatus}",i.oldStatus).replace("{newStatus}",i.newStatus)):i.newStatus&&r.push(t.statusSetTo.replace("{newStatus}",i.newStatus))}),(T=e==null?void 0:e.expiration)!=null&&T.newExpiration&&((y=e==null?void 0:e.expiration)!=null&&y.oldExpiration)){const i=f(e.expiration.newExpiration,h),d=f(e.expiration.oldExpiration,h);r.push(t.expirationChangedFromTo.replace("{oldExpiration}",d).replace("{newExpiration}",i))}else if((m=e==null?void 0:e.expiration)!=null&&m.newExpiration){const i=f(e.expiration.newExpiration,h);r.push(t.expirationSetTo.replace("{newExpiration}",i))}if((C=e==null?void 0:e.total)!=null&&C.newPrice&&((L=e==null?void 0:e.total)!=null&&L.oldPrice)){const i=`${e.total.newPrice.currency} ${e.total.newPrice.value}`,d=`${e.total.oldPrice.currency} ${e.total.oldPrice.value}`;r.push(t.totalChangedFromTo.replace("{oldTotal}",d).replace("{newTotal}",i))}if((N=e==null?void 0:e.customChanges)!=null&&N.title&&((F=e==null?void 0:e.customChanges)!=null&&F.old_value)&&((_=e==null?void 0:e.customChanges)!=null&&_.new_value)&&r.push(t.customChange.replace("{title}",e.customChanges.title).replace("{oldValue}",e.customChanges.old_value).replace("{newValue}",e.customChanges.new_value)),(b=e==null?void 0:e.productsRemoved)!=null&&b.productsRemovedFromCatalog&&e.productsRemoved.productsRemovedFromCatalog.length>0&&r.push(t.productsRemovedFromCatalog.replace("{products}",e.productsRemoved.productsRemovedFromCatalog.join(", "))),(w=e==null?void 0:e.productsRemoved)!=null&&w.productsRemovedFromQuote&&e.productsRemoved.productsRemovedFromQuote.length>0){const i=e.productsRemoved.productsRemovedFromQuote.map(d=>d.name||d.sku||d.uid).join(", ");r.push(t.productsRemovedFromQuote.replace("{products}",i))}return r.length>0?r:[t.noDetailsAvailable]},E=(()=>{const e=[],r=(a,u,T,y)=>{a&&Array.isArray(a)&&a.forEach(m=>{m&&m.note&&m.note.trim()&&e.push({...m,type:u,productName:y.product.name,productSku:y.product.sku,authorName:T})})};return o!=null&&o.items&&o.items.forEach(a=>{r(a.noteFromBuyer,"buyer",`${o.buyer.firstname} ${o.buyer.lastname} ${t.buyerLabel}`,a),r(a.noteFromSeller,"seller",`${o.salesRepName} ${t.sellerLabel}`,a)}),e})(),A=((o==null?void 0:o.history)||[]).map(e=>({...e,entryType:"history"})),R=E.map(e=>({...e,entryType:"note"})),g=[...A,...R];return n("div",{...v,className:q(["quote-management-quote-history-log",s]),children:[g.length>0?l("div",{className:"quote-management-quote-history-log__entries",children:g.map((e,r)=>n("div",{className:"quote-management-quote-history-log__entry",children:[n("div",{className:"quote-management-quote-history-log__entry-header",children:[n("div",{className:"quote-management-quote-history-log__entry-meta",children:[l("span",{className:"quote-management-quote-history-log__entry-date",children:h.format(new Date(e.createdAt))}),l("span",{className:"quote-management-quote-history-log__entry-author",children:e.entryType==="history"?`by ${e.author.firstname} ${e.author.lastname} ${e.author.firstname===(o==null?void 0:o.buyer.firstname)&&e.author.lastname===(o==null?void 0:o.buyer.lastname)?t.buyerLabel:t.sellerLabel}`:`by ${e.authorName}`})]}),l("div",{className:"quote-management-quote-history-log__entry-type",children:e.entryType==="history"?x(e.changeType):e.type==="buyer"?t.buyerNoteAdded:t.sellerNoteAdded})]}),l("div",{className:"quote-management-quote-history-log__entry-changes",children:e.entryType==="history"?S(e.changes).map((a,u)=>l("div",{className:"quote-management-quote-history-log__entry-change",children:a},u)):n("div",{className:"quote-management-quote-history-log__entry-change",children:[n("div",{children:[e.productName,"(",e.productSku,")"]}),n("div",{children:['"',e.note,'"']})]})})]},e.entryType==="history"?e.uid:`${e.noteUid}-${r}`))}):l("div",{className:"quote-management-quote-history-log__empty",children:t.emptyState}),p]})},Z=({quoteData:s,...p})=>{const[o,v]=$(s);return D(()=>{const c=U.on("quote-management/quote-data",t=>{v(t.quote)},{eager:!0});return()=>c==null?void 0:c.off()},[]),o?l("div",{...p,children:l(k,{quoteData:o})}):null};export{Z as Q};
4
+ //# sourceMappingURL=QuoteHistoryLog.js.map