@dropins/storefront-quote-management 0.0.1-alpha4 → 0.0.1-alpha6

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 (50) hide show
  1. package/api/getQuoteData/getQuoteData.d.ts +10 -0
  2. package/api/getQuoteData/graphql/QuoteDataQuery.d.ts +2 -0
  3. package/api/getQuoteData/index.d.ts +10 -0
  4. package/api/graphql/NegotiableQuoteFragment.d.ts +1 -1
  5. package/api/index.d.ts +1 -0
  6. package/api/initialize/initialize.d.ts +1 -0
  7. package/api.js +16 -4
  8. package/api.js.map +1 -1
  9. package/chunks/RequestNegotiableQuoteForm.js +4 -0
  10. package/chunks/RequestNegotiableQuoteForm.js.map +1 -0
  11. package/chunks/requestNegotiableQuote.js +100 -37
  12. package/chunks/requestNegotiableQuote.js.map +1 -1
  13. package/components/ActionsBar/ActionsBar.d.ts +14 -0
  14. package/components/ActionsBar/index.d.ts +11 -0
  15. package/components/ItemsQuoted/ItemsQuoted.d.ts +11 -0
  16. package/components/ItemsQuoted/index.d.ts +11 -0
  17. package/components/ManageNegotiableQuote/ManageNegotiableQuote.d.ts +20 -0
  18. package/components/ManageNegotiableQuote/__fixtures__/ManageNegotiableQuoteProps.d.ts +4 -0
  19. package/components/ManageNegotiableQuote/index.d.ts +11 -0
  20. package/components/ProductListTable/ProductListTable.d.ts +13 -0
  21. package/components/ProductListTable/index.d.ts +11 -0
  22. package/components/QuotePricesSummary/QuotePricesSummary.d.ts +16 -0
  23. package/components/QuotePricesSummary/index.d.ts +11 -0
  24. package/components/TabbedContent/TabbedContent.d.ts +10 -0
  25. package/components/TabbedContent/index.d.ts +11 -0
  26. package/components/index.d.ts +6 -0
  27. package/containers/ItemsQuoted/ItemsQuoted.d.ts +25 -0
  28. package/containers/ItemsQuoted/index.d.ts +11 -0
  29. package/containers/ItemsQuoted.d.ts +3 -0
  30. package/containers/ItemsQuoted.js +4 -0
  31. package/containers/ItemsQuoted.js.map +1 -0
  32. package/containers/ManageNegotiableQuote/ManageNegotiableQuote.d.ts +48 -0
  33. package/containers/ManageNegotiableQuote/index.d.ts +11 -0
  34. package/containers/ManageNegotiableQuote.d.ts +3 -0
  35. package/containers/ManageNegotiableQuote.js +4 -0
  36. package/containers/ManageNegotiableQuote.js.map +1 -0
  37. package/containers/RequestNegotiableQuoteForm.js +1 -1
  38. package/containers/RequestNegotiableQuoteForm.js.map +1 -1
  39. package/containers/index.d.ts +2 -0
  40. package/data/models/__fixtures__/negotiableQuoteModel.d.ts +4 -0
  41. package/data/models/customer-model.d.ts +1 -0
  42. package/data/models/negotiable-quote-model.d.ts +30 -20
  43. package/data/transforms/__fixtures__/negotiableQuoteData.d.ts +102 -48
  44. package/data/transforms/transform-quote.d.ts +1 -1
  45. package/i18n/en_US.json.d.ts +54 -0
  46. package/lib/state.d.ts +1 -0
  47. package/package.json +1 -1
  48. package/render.js +4 -2
  49. package/render.js.map +1 -1
  50. package/types/state.types.d.ts +1 -0
@@ -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 getQuoteData: (quoteId: string) => Promise<import('../../data/models/negotiable-quote-model').NegotiableQuoteModel>;
10
+ //# sourceMappingURL=getQuoteData.d.ts.map
@@ -0,0 +1,2 @@
1
+ export declare const QUOTE_DATA_QUERY: string;
2
+ //# sourceMappingURL=QuoteDataQuery.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 './getQuoteData';
10
+ //# sourceMappingURL=index.d.ts.map
@@ -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 RequestNegotiableQuoteOutput {\n quote {\n uid\n created_at\n status\n buyer {\n firstname\n lastname\n }\n comments {\n uid\n created_at\n author {\n firstname\n lastname\n }\n }\n items {\n product {\n uid\n sku\n name\n price_range {\n maximum_price {\n regular_price {\n value\n }\n }\n }\n }\n quantity\n }\n prices {\n subtotal_excluding_tax {\n value\n }\n subtotal_including_tax {\n value\n }\n subtotal_with_discount_excluding_tax {\n value\n }\n grand_total {\n value\n }\n }\n }\n }\n";
17
+ export declare const NEGOTIABLE_QUOTE_FRAGMENT = "\n fragment NegotiableQuoteFragment on NegotiableQuote {\n uid\n\t\tname\n\t\tcreated_at\n status\n sales_rep_name\n expiration_date\n\t\tbuyer {\n\t\t\tfirstname\n\t\t\tlastname\n\t\t}\n\t\tcomments {\n uid\n created_at\n author {\n firstname\n lastname\n }\n text\n }\n\t\titems {\n product {\n name\n sku\n uid\n\t\t\t\tstock_status\n\t\t\t\tquantity\n price_range {\n maximum_price {\n regular_price {\n value\n }\n }\n }\n }\n\t\t\tprices {\n\t\t\t\tprice {\n\t\t\t\t\tcurrency\n\t\t\t\t\tvalue\n\t\t\t\t}\n\t\t\t\toriginal_item_price {\n\t\t\t\t\tcurrency\n\t\t\t\t\tvalue\n\t\t\t\t}\n\t\t\t\toriginal_row_total {\n\t\t\t\t\tcurrency\n\t\t\t\t\tvalue\n\t\t\t\t}\n\t\t\t\trow_total {\n\t\t\t\t\tcurrency\n\t\t\t\t\tvalue\n\t\t\t\t}\n catalog_discount {\n\t\t\t\t\tamount_off\n\t\t\t\t\tpercent_off\n\t\t\t\t}\n\t\t\t\tdiscounts {\n\t\t\t\t\tlabel\n\t\t\t\t\tvalue\n\t\t\t\t\tamount {\n\t\t\t\t\t\tcurrency\n\t\t\t\t\t\tvalue\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n quantity\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\t }\n prices {\n subtotal_excluding_tax {\n\t\t\t\tcurrency\n\t\t\t\tvalue\n\t\t\t}\n\t\t\tapplied_taxes {\n\t\t\t\tamount {\n\t\t\t\t\tcurrency\n\t\t\t\t\tvalue\n\t\t\t\t}\n\t\t\t\tlabel\n\t\t\t}\n\t\t\tgrand_total {\n\t\t\t\tcurrency\n\t\t\t\tvalue\n\t\t\t}\n }\n }\n";
18
18
  //# sourceMappingURL=NegotiableQuoteFragment.d.ts.map
package/api/index.d.ts CHANGED
@@ -2,4 +2,5 @@ export * from './initialize';
2
2
  export * from './fetch-graphql';
3
3
  export * from './getCustomerData';
4
4
  export * from './requestNegotiableQuote';
5
+ export * from './getQuoteData';
5
6
  //# sourceMappingURL=index.d.ts.map
@@ -3,6 +3,7 @@ import { Lang } from '@dropins/tools/types/elsie/src/i18n';
3
3
 
4
4
  type ConfigProps = {
5
5
  langDefinitions?: Lang;
6
+ quoteId?: string;
6
7
  };
7
8
  export declare const initialize: Initializer<ConfigProps>;
8
9
  export declare const config: import('@dropins/tools/types/elsie/src/lib').Config<ConfigProps>;
package/api.js CHANGED
@@ -1,6 +1,6 @@
1
1
  /*! Copyright 2025 Adobe
2
2
  All Rights Reserved. */
3
- import{D as s,s as o}from"./chunks/requestNegotiableQuote.js";import{r as F}from"./chunks/requestNegotiableQuote.js";import{FetchGraphQL as l}from"@dropins/tools/fetch-graphql.js";import{events as c}from"@dropins/tools/event-bus.js";import{Initializer as d}from"@dropins/tools/lib.js";const E=`
3
+ import{D as i,s as r,N as l,t as Q}from"./chunks/requestNegotiableQuote.js";import{r as z}from"./chunks/requestNegotiableQuote.js";import{FetchGraphQL as E}from"@dropins/tools/fetch-graphql.js";import{events as s}from"@dropins/tools/event-bus.js";import{Initializer as h}from"@dropins/tools/lib.js";const f=`
4
4
  fragment CUSTOMER_FRAGMENT on Customer {
5
5
  role {
6
6
  permissions {
@@ -17,13 +17,25 @@ import{D as s,s as o}from"./chunks/requestNegotiableQuote.js";import{r as F}from
17
17
  }
18
18
  }
19
19
  }
20
- `,Q=`
20
+ `,p=`
21
21
  query CUSTOMER_QUERY {
22
22
  customer {
23
23
  ...CUSTOMER_FRAGMENT
24
24
  }
25
25
  }
26
26
 
27
- ${E}
28
- `,h="All/Quotes/View/Request, Edit, Delete",p="All/Quotes/View/Request, Edit, Delete",f="All/Quotes/View/Request, Edit, Delete",R=t=>{const e=[],r=(n,m=[])=>{for(const i of n){const a=[...m,i.text];i.children&&i.children.length>0?r(i.children,a):e.push(a.join("/"))}};return r(t),e};function g(t){const{role:e}=t;if(!e)return{permissions:{canRequestQuote:s.requestQuote,canEditQuote:s.editQuote,canDeleteQuote:s.deleteQuote}};const{permissions:r}=e,n=R(r);return{permissions:{canRequestQuote:n.includes(h),canEditQuote:n.includes(p),canDeleteQuote:n.includes(f)}}}const S=async()=>{var t;if(!o.authenticated)return Promise.reject(new Error("Unauthorized"));try{const e=await T(Q);if(!((t=e==null?void 0:e.data)!=null&&t.customer))throw new Error("No customer data received");return g(e.data.customer)}catch(e){return Promise.reject(e)}},u=new d({init:async t=>{const e={};u.config.setConfig({...e,...t})},listeners:()=>[c.on("authenticated",async t=>{o.authenticated=!!t,t?S().then(e=>{o.permissions={requestQuote:e.permissions.canRequestQuote,editQuote:e.permissions.canEditQuote,deleteQuote:e.permissions.canDeleteQuote},c.emit("quote-management/permissions",o.permissions)}).catch(e=>{console.error(e),o.permissions=s,c.emit("quote-management/permissions",s)}):(o.permissions=s,c.emit("quote-management/permissions",s))},{eager:!0})]}),U=u.config,{setEndpoint:N,setFetchGraphQlHeader:O,removeFetchGraphQlHeader:A,setFetchGraphQlHeaders:I,fetchGraphQl:T,getConfig:w}=new l().getMethods();export{U as config,T as fetchGraphQl,w as getConfig,S as getCustomerData,u as initialize,A as removeFetchGraphQlHeader,F as requestNegotiableQuote,N as setEndpoint,O as setFetchGraphQlHeader,I as setFetchGraphQlHeaders};
27
+ ${f}
28
+ `,g="All/Quotes/View/Request, Edit, Delete",q="All/Quotes/View/Request, Edit, Delete",R="All/Quotes/View/Request, Edit, Delete",T="All/Quotes/View/Checkout with quote",_=t=>{const e=[],o=(n,d=[])=>{for(const a of n){const c=[...d,a.text];a.children&&a.children.length>0?o(a.children,c):e.push(c.join("/"))}};return o(t),e};function U(t){const{role:e}=t;if(!e)return{permissions:{canRequestQuote:i.requestQuote,canEditQuote:i.editQuote,canDeleteQuote:i.deleteQuote}};const{permissions:o}=e,n=_(o);return{permissions:{canRequestQuote:n.includes(g),canEditQuote:n.includes(q),canDeleteQuote:n.includes(R),canCheckoutQuote:n.includes(T)}}}const C=async()=>{var t;if(!r.authenticated)return Promise.reject(new Error("Unauthorized"));try{const e=await m(p);if(!((t=e==null?void 0:e.data)!=null&&t.customer))throw new Error("No customer data received");return U(e.data.customer)}catch(e){return Promise.reject(e)}},O=`
29
+ query QUOTE_DATA_QUERY(
30
+ $quoteId: ID!
31
+ ) {
32
+ negotiableQuote(
33
+ uid: $quoteId
34
+ ) {
35
+ ...NegotiableQuoteFragment
36
+ }
37
+ }
38
+
39
+ ${l}
40
+ `,A=async t=>{var e;if(!r.authenticated)return Promise.reject(new Error("Unauthorized"));if(!r.permissions.editQuote)return Promise.reject(new Error("Unauthorized"));try{const o=await m(O,{variables:{quoteId:t}}),n=Q((e=o==null?void 0:o.data)==null?void 0:e.negotiableQuote);if(!n)throw new Error("Failed to transform quote data");return s.emit("quote-management/quote-data",{quote:n,permissions:r.permissions}),n}catch(o){return Promise.reject(o)}},u=new h({init:async t=>{const e={};u.config.setConfig({...e,...t})},listeners:()=>[s.on("authenticated",async t=>{r.authenticated=!!t,t?C().then(e=>{r.permissions={requestQuote:e.permissions.canRequestQuote,editQuote:e.permissions.canEditQuote,deleteQuote:e.permissions.canDeleteQuote,checkoutQuote:e.permissions.canCheckoutQuote},s.emit("quote-management/permissions",r.permissions)}).catch(e=>{console.error(e),r.permissions=i,s.emit("quote-management/permissions",i)}):(r.permissions=i,s.emit("quote-management/permissions",i))},{eager:!0}),s.on("quote-management/permissions",async t=>{const e=u.config.getConfig().quoteId;e&&t.editQuote&&A(e).then(o=>{s.emit("quote-management/quote-data/initialized",{quote:o,permissions:t},{})}).catch(o=>{s.emit("quote-management/quote-data/error",{error:o})})},{eager:!0})]}),M=u.config,{setEndpoint:P,setFetchGraphQlHeader:D,removeFetchGraphQlHeader:F,setFetchGraphQlHeaders:G,fetchGraphQl:m,getConfig:y}=new E().getMethods();export{M as config,m as fetchGraphQl,y as getConfig,C as getCustomerData,A as getQuoteData,u as initialize,F as removeFetchGraphQlHeader,z as requestNegotiableQuote,P as setEndpoint,D as setFetchGraphQlHeader,G as setFetchGraphQlHeaders};
29
41
  //# 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/initialize/initialize.ts","/@dropins/storefront-quote-management/src/api/fetch-graphql/fetch-graphql.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';\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 },\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 }\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 { 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';\n\ntype ConfigProps = {\n langDefinitions?: Lang;\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 };\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 ],\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"],"names":["CUSTOMER_FRAGMENT","CUSTOMER_QUERY","CAN_REQUEST_QUOTE_PERMISSION","CAN_EDIT_QUOTE_PERMISSION","CAN_DELETE_QUOTE_PERMISSION","flattenPermissions","permissions","result","traverse","nodes","path","node","currentPath","transformCustomer","customerData","role","DEFAULT_PERMISSIONS","flattenedPermissions","getCustomerData","state","results","fetchGraphQl","_a","error","initialize","Initializer","config","defaultConfig","events","authenticated","setEndpoint","setFetchGraphQlHeader","removeFetchGraphQlHeader","setFetchGraphQlHeaders","getConfig","FetchGraphQL"],"mappings":"6RAAO,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,wCAOvBC,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,GAAI,CAACC,EACD,MAAO,CACH,YAAa,CACT,gBAAiBC,EAAoB,aACrC,aAAcA,EAAoB,UAClC,eAAgBA,EAAoB,WAAA,CACxC,EAIR,KAAM,CAAE,YAAAV,GAAgBS,EAElBE,EAAuBZ,EAAmBC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,yBAAAC,EACA,uBAAAC,EACA,aAAAZ,EACA,UAAAa,CACF,EAAI,IAAIC,EAAA,EAAe,WAAA"}
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"],"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 },\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"],"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"],"mappings":"2SAAO,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,GAAI,CAACC,EACD,MAAO,CACH,YAAa,CACT,gBAAiBC,EAAoB,aACrC,aAAcA,EAAoB,UAClC,eAAgBA,EAAoB,WAAA,CACxC,EAIR,KAAM,CAAE,YAAAV,GAAgBS,EAElBE,EAAuBZ,EAAmBC,CAAW,EAC3D,MAAO,CACH,YAAa,CACT,gBAAiBW,EAAqB,SAAShB,CAA4B,EAC3E,aAAcgB,EAAqB,SAASf,CAAyB,EACrE,eAAgBe,EAAqB,SAASd,CAA2B,EACzE,iBAAkBc,EAAqB,SAASb,CAA6B,CAA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DhB,EAAM,cAAgB,CAAC,CAACgB,EAEpBA,EACFjB,EAAA,EAAkB,KAAMJ,GAAiB,CACvCK,EAAM,YAAc,CAClB,aAAcL,EAAa,YAAY,gBACvC,UAAWA,EAAa,YAAY,aACpC,YAAaA,EAAa,YAAY,eACtC,cAAeA,EAAa,YAAY,gBAAA,EAE1CgB,EAAO,KAAK,+BAAgCX,EAAM,WAAW,CAC/D,CAAC,EACE,MAAOI,GAAU,CAChB,QAAQ,MAAMA,CAAK,EACnBJ,EAAM,YAAcH,EACpBc,EAAO,KAAK,+BAAgCd,CAAmB,CACjE,CAAC,GAEHG,EAAM,YAAcH,EACpBc,EAAO,KAAK,+BAAgCd,CAAmB,EAEnE,EAAG,CACD,MAAO,EAAA,CACR,EACDc,EAAO,GAAG,+BAAgC,MAAOxB,GAAgB,CAC/D,MAAMqB,EAAUI,EAAW,OAAO,UAAA,EAAY,QACzCJ,GAIDrB,EAAY,WACdoB,EAAaC,CAAO,EAAE,KAAMS,GAAc,CACxCN,EAAO,KAAK,0CAA2C,CACrD,MAAOM,EACP,YAAA9B,CAAA,EACC,EAAE,CACP,CAAC,EAAE,MAAOiB,GAAU,CAClBO,EAAO,KAAK,oCAAqC,CAC/C,MAAAP,CAAA,CACD,CACH,CAAC,CAEL,EAAG,CACD,MAAO,EAAA,CACR,CAAA,CAEL,CAAC,EAEYU,EAASF,EAAW,OCnEpB,CACX,YAAAM,EACA,sBAAAC,EACA,yBAAAC,EACA,uBAAAC,EACA,aAAAnB,EACA,UAAAoB,CACF,EAAI,IAAIC,EAAA,EAAe,WAAA"}
@@ -0,0 +1,4 @@
1
+ /*! Copyright 2025 Adobe
2
+ All Rights Reserved. */
3
+ import*as e from"@dropins/tools/preact-compat.js";const l=t=>e.createElement("svg",{width:24,height:24,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",...t},e.createElement("path",{vectorEffect:"non-scaling-stroke",fillRule:"evenodd",clipRule:"evenodd",d:"M1 20.8953L12.1922 1.5L23.395 20.8953H1ZM13.0278 13.9638L13.25 10.0377V9H11.25V10.0377L11.4722 13.9638H13.0278ZM11.2994 16V17.7509H13.2253V16H11.2994Z",fill:"currentColor"}));export{l as S};
4
+ //# sourceMappingURL=RequestNegotiableQuoteForm.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"RequestNegotiableQuoteForm.js","sources":["../../node_modules/@adobe-commerce/elsie/src/icons/WarningFilled.svg"],"sourcesContent":["import * as React from \"react\";\nconst SvgWarningFilled = (props) => /* @__PURE__ */ React.createElement(\"svg\", { width: 24, height: 24, viewBox: \"0 0 24 24\", fill: \"none\", xmlns: \"http://www.w3.org/2000/svg\", ...props }, /* @__PURE__ */ React.createElement(\"path\", { vectorEffect: \"non-scaling-stroke\", fillRule: \"evenodd\", clipRule: \"evenodd\", d: \"M1 20.8953L12.1922 1.5L23.395 20.8953H1ZM13.0278 13.9638L13.25 10.0377V9H11.25V10.0377L11.4722 13.9638H13.0278ZM11.2994 16V17.7509H13.2253V16H11.2994Z\", fill: \"currentColor\" }));\nexport default SvgWarningFilled;\n"],"names":["SvgWarningFilled","props","React"],"mappings":"kDACK,MAACA,EAAoBC,GAA0BC,EAAM,cAAc,MAAO,CAAE,MAAO,GAAI,OAAQ,GAAI,QAAS,YAAa,KAAM,OAAQ,MAAO,6BAA8B,GAAGD,CAAK,EAAoBC,EAAM,cAAc,OAAQ,CAAE,aAAc,qBAAsB,SAAU,UAAW,SAAU,UAAW,EAAG,yJAA0J,KAAM,eAAgB,CAAC","x_google_ignoreList":[0]}
@@ -1,55 +1,116 @@
1
1
  /*! Copyright 2025 Adobe
2
2
  All Rights Reserved. */
3
- import{fetchGraphQl as l}from"@dropins/tools/fetch-graphql.js";import{events as d}from"@dropins/tools/event-bus.js";const m={requestQuote:!1,editQuote:!1,deleteQuote:!1},_={authenticated:!1,permissions:m},E=new Proxy(_,{get:(a,t)=>a[t],set:(a,t,e)=>(a[t]=e,!0)});function g(a){if(!a||!a.data||!a.data.requestNegotiableQuote)return null;const t=a.data.requestNegotiableQuote.quote;return{uid:t.uid,createdAt:t.created_at,status:t.status,buyer:t.buyer,comments:t.comments.map(e=>({uid:e.uid,createdAt:e.created_at,author:e.author})),items:t.items.map(e=>({product:{uid:e.product.uid,sku:e.product.sku,name:e.product.name,priceRange:{maximumPrice:{regularPrice:{value:e.product.price_range.maximum_price.regular_price.value}}}},quantity:e.quantity,prices:{subtotalExcludingTax:{value:t.prices.subtotal_excluding_tax.value},subtotalIncludingTax:{value:t.prices.subtotal_including_tax.value},subtotalWithDiscountExcludingTax:{value:t.prices.subtotal_with_discount_excluding_tax.value},grandTotal:{value:t.prices.grand_total.value}}}))}}const p=`
4
- fragment NegotiableQuoteFragment on RequestNegotiableQuoteOutput {
5
- quote {
3
+ import{fetchGraphQl as _}from"@dropins/tools/fetch-graphql.js";import{events as p}from"@dropins/tools/event-bus.js";const g={requestQuote:!1,editQuote:!1,deleteQuote:!1,checkoutQuote:!1},f={authenticated:!1,permissions:g},l=new Proxy(f,{get:(t,e)=>t[e],set:(t,e,r)=>(t[e]=r,!0)});function y(t){return t?{uid:t.uid,name:t.name,createdAt:t.created_at,status:t.status,salesRepName:t.sales_rep_name,expirationDate:t.expiration_date,buyer:t.buyer,comments:t.comments.map(e=>({uid:e.uid,createdAt:e.created_at,author:e.author})),items:t.items.map(e=>{var r,u;return{product:{uid:e.product.uid,sku:e.product.sku,name:e.product.name},catalogDiscount:{amountOff:e.prices.catalog_discount.amount_off,percentOff:e.prices.catalog_discount.percent_off},discounts:((u=(r=e.prices)==null?void 0:r.discounts)==null?void 0:u.map(a=>({label:a.label,value:a.value,amount:{value:a.amount.value,currency:a.amount.currency}})))??[],stockStatus:e.product.stock_status,quantity:e.quantity,prices:{originalItemPrice:{value:e.prices.original_item_price.value,currency:e.prices.original_item_price.currency},rowTotal:{value:e.prices.row_total.value,currency:e.prices.row_total.currency}}}}),prices:{grandTotal:{value:t.prices.grand_total.value,currency:t.prices.grand_total.currency},subtotalExcludingTax:{value:t.prices.subtotal_excluding_tax.value,currency:t.prices.subtotal_excluding_tax.currency},appliedTaxes:t.prices.applied_taxes.map(e=>({amount:{value:e.amount.value,currency:e.amount.currency},label:e.label}))},canCheckout:["UPDATED","DECLINED"].includes(t.status)&&l.permissions.checkoutQuote,canSendForReview:["SUBMITTED","DRAFT","UPDATED","DECLINED","EXPIRED"].includes(t.status)&&l.permissions.editQuote}:null}const E=`
4
+ fragment NegotiableQuoteFragment on NegotiableQuote {
5
+ uid
6
+ name
7
+ created_at
8
+ status
9
+ sales_rep_name
10
+ expiration_date
11
+ buyer {
12
+ firstname
13
+ lastname
14
+ }
15
+ comments {
6
16
  uid
7
17
  created_at
8
- status
9
- buyer {
18
+ author {
10
19
  firstname
11
20
  lastname
12
21
  }
13
- comments {
22
+ text
23
+ }
24
+ items {
25
+ product {
26
+ name
27
+ sku
14
28
  uid
15
- created_at
16
- author {
17
- firstname
18
- lastname
19
- }
20
- }
21
- items {
22
- product {
23
- uid
24
- sku
25
- name
26
- price_range {
27
- maximum_price {
28
- regular_price {
29
- value
30
- }
29
+ stock_status
30
+ quantity
31
+ price_range {
32
+ maximum_price {
33
+ regular_price {
34
+ value
31
35
  }
32
36
  }
33
37
  }
34
- quantity
35
38
  }
36
- prices {
37
- subtotal_excluding_tax {
38
- value
39
- }
40
- subtotal_including_tax {
41
- value
39
+ prices {
40
+ price {
41
+ currency
42
+ value
43
+ }
44
+ original_item_price {
45
+ currency
46
+ value
47
+ }
48
+ original_row_total {
49
+ currency
50
+ value
51
+ }
52
+ row_total {
53
+ currency
54
+ value
55
+ }
56
+ catalog_discount {
57
+ amount_off
58
+ percent_off
59
+ }
60
+ discounts {
61
+ label
62
+ value
63
+ amount {
64
+ currency
65
+ value
66
+ }
67
+ }
68
+ }
69
+ quantity
70
+ }
71
+ history {
72
+ uid
73
+ created_at
74
+ author {
75
+ firstname
76
+ lastname
77
+ }
78
+ change_type
79
+ changes {
80
+ comment_added {
81
+ comment
42
82
  }
43
- subtotal_with_discount_excluding_tax {
44
- value
83
+ statuses {
84
+ changes {
85
+ new_status
86
+ old_status
87
+ }
45
88
  }
46
- grand_total {
47
- value
89
+ expiration {
90
+ new_expiration
91
+ old_expiration
48
92
  }
49
93
  }
94
+ }
95
+ prices {
96
+ subtotal_excluding_tax {
97
+ currency
98
+ value
99
+ }
100
+ applied_taxes {
101
+ amount {
102
+ currency
103
+ value
104
+ }
105
+ label
106
+ }
107
+ grand_total {
108
+ currency
109
+ value
110
+ }
50
111
  }
51
112
  }
52
- `,q=`
113
+ `,v=`
53
114
  mutation REQUEST_NEGOTIABLE_QUOTE_MUTATION(
54
115
  $cartId: ID!
55
116
  $quoteName: String!
@@ -64,9 +125,11 @@ import{fetchGraphQl as l}from"@dropins/tools/fetch-graphql.js";import{events as
64
125
  is_draft: $isDraft
65
126
  }
66
127
  ) {
67
- ...NegotiableQuoteFragment
128
+ quote {
129
+ ...NegotiableQuoteFragment
130
+ }
68
131
  }
69
132
  }
70
- ${p}
71
- `,x=async a=>{const{cartId:t,quoteName:e,comment:u,isDraft:o}=a;if(!t)throw new Error("Cart ID is required");if(!e)throw new Error("Quote name is required");if(!u)throw new Error("Comment is required");return l(q,{variables:{cartId:t,quoteName:e,comment:{comment:u},isDraft:o}}).then(i=>{const{errors:n}=i;if(n){const s=n.map(c=>c.message).join("; ");throw new Error(`Failed to request negotiable quote: ${s}`)}const r=g(i);if(!r)throw new Error("Failed to transform quote data: Invalid response structure");return d.emit("quote-management/negotiable-quote-requested",{quote:r,input:{cartId:t,quoteName:e,comment:u,isDraft:o}}),r})};export{m as D,x as r,E as s};
133
+ ${E}
134
+ `,N=async t=>{const{cartId:e,quoteName:r,comment:u,isDraft:a}=t;if(!e)throw new Error("Cart ID is required");if(!r)throw new Error("Quote name is required");if(!u)throw new Error("Comment is required");return _(v,{variables:{cartId:e,quoteName:r,comment:{comment:u},isDraft:a}}).then(o=>{var c,i;const{errors:s}=o;if(s){const m=s.map(d=>d.message).join("; ");throw new Error(`Failed to request negotiable quote: ${m}`)}const n=y((i=(c=o.data)==null?void 0:c.requestNegotiableQuote)==null?void 0:i.quote);if(!n)throw new Error("Failed to transform quote data: Invalid response structure");return p.emit("quote-management/negotiable-quote-requested",{quote:n,input:{cartId:e,quoteName:r,comment:u,isDraft:a}}),n})};export{g as D,E as N,N as r,l as s,y as t};
72
135
  //# sourceMappingURL=requestNegotiableQuote.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"requestNegotiableQuote.js","sources":["/@dropins/storefront-quote-management/src/lib/state.ts","/@dropins/storefront-quote-management/src/data/transforms/transform-quote.ts","/@dropins/storefront-quote-management/src/api/graphql/NegotiableQuoteFragment.ts","/@dropins/storefront-quote-management/src/api/requestNegotiableQuote/graphql/RequestNegotiableQuoteMutation.ts","/@dropins/storefront-quote-management/src/api/requestNegotiableQuote/requestNegotiableQuote.ts"],"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 { State } from '../types/state.types';\n\nexport const DEFAULT_PERMISSIONS = {\n requestQuote: false,\n editQuote: false,\n deleteQuote: false,\n};\n\nconst _state: State = {\n authenticated: false,\n permissions: DEFAULT_PERMISSIONS,\n}\n\n// Proxy state to make it reactive\nexport const state = new Proxy(_state, {\n get: (target, key) => {\n return target[key as keyof State];\n },\n set: (target, key, value) => {\n target[key as keyof State] = value;\n return true;\n }\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 *******************************************************************/\nimport { NegotiableQuoteModel } from '@/quote-management/data/models/negotiable-quote-model';\n\nexport function transformQuote(response: any): NegotiableQuoteModel | null {\n if (!response || !response.data || !response.data.requestNegotiableQuote) {\n return null;\n }\n\n const quote = response.data.requestNegotiableQuote.quote;\n\n return {\n uid: quote.uid,\n createdAt: quote.created_at,\n status: quote.status,\n buyer: quote.buyer,\n comments: quote.comments.map((comment: any) => ({\n uid: comment.uid,\n createdAt: comment.created_at,\n author: comment.author,\n })),\n items: quote.items.map((item: any) => ({\n product: {\n uid: item.product.uid,\n sku: item.product.sku,\n name: item.product.name,\n priceRange: {\n maximumPrice: {\n regularPrice: {\n value: item.product.price_range.maximum_price.regular_price.value,\n },\n },\n },\n },\n quantity: item.quantity,\n prices: {\n subtotalExcludingTax: {\n value: quote.prices.subtotal_excluding_tax.value,\n },\n subtotalIncludingTax: {\n value: quote.prices.subtotal_including_tax.value,\n },\n subtotalWithDiscountExcludingTax: {\n value: quote.prices.subtotal_with_discount_excluding_tax.value,\n },\n grandTotal: {\n value: quote.prices.grand_total.value,\n },\n },\n })),\n };\n}\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\nexport const NEGOTIABLE_QUOTE_FRAGMENT = /* GraphQL */ `\n fragment NegotiableQuoteFragment on RequestNegotiableQuoteOutput {\n quote {\n uid\n created_at\n status\n buyer {\n firstname\n lastname\n }\n comments {\n uid\n created_at\n author {\n firstname\n lastname\n }\n }\n items {\n product {\n uid\n sku\n name\n price_range {\n maximum_price {\n regular_price {\n value\n }\n }\n }\n }\n quantity\n }\n prices {\n subtotal_excluding_tax {\n value\n }\n subtotal_including_tax {\n value\n }\n subtotal_with_discount_excluding_tax {\n value\n }\n grand_total {\n value\n }\n }\n }\n }\n`;\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 REQUEST_NEGOTIABLE_QUOTE_MUTATION = `\n mutation REQUEST_NEGOTIABLE_QUOTE_MUTATION(\n $cartId: ID!\n $quoteName: String!\n $comment: NegotiableQuoteCommentInput!\n $isDraft: Boolean\n ) {\n requestNegotiableQuote(\n input: {\n cart_id: $cartId\n quote_name: $quoteName\n comment: $comment\n is_draft: $isDraft\n }\n ) {\n ...NegotiableQuoteFragment\n }\n }\n ${NEGOTIABLE_QUOTE_FRAGMENT}\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 { REQUEST_NEGOTIABLE_QUOTE_MUTATION } from './graphql/RequestNegotiableQuoteMutation';\nimport { NegotiableQuoteModel } from '@/quote-management/data/models/negotiable-quote-model';\nimport { transformQuote } from '@/quote-management/data/transforms';\n\nexport interface RequestNegotiableQuoteInput {\n cartId: string;\n quoteName: string;\n comment: string;\n isDraft?: boolean;\n}\n\nexport const requestNegotiableQuote = async (\n input: RequestNegotiableQuoteInput\n): Promise<NegotiableQuoteModel | null> => {\n const { cartId, quoteName, comment, isDraft } = input;\n\n if (!cartId) {\n throw new Error('Cart ID is required');\n }\n\n if (!quoteName) {\n throw new Error('Quote name is required');\n }\n\n if (!comment) {\n throw new Error('Comment is required');\n }\n\n return fetchGraphQl(REQUEST_NEGOTIABLE_QUOTE_MUTATION, {\n variables: {\n cartId,\n quoteName,\n comment: {\n comment\n },\n isDraft,\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 request negotiable quote: ${errorMessages}`);\n }\n\n // Transform the quote data\n const quoteData = transformQuote(response);\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/negotiable-quote-requested', {\n quote: quoteData,\n input: { cartId, quoteName, comment, isDraft },\n });\n\n return quoteData;\n });\n};\n"],"names":["DEFAULT_PERMISSIONS","_state","state","target","key","value","transformQuote","response","quote","comment","item","NEGOTIABLE_QUOTE_FRAGMENT","REQUEST_NEGOTIABLE_QUOTE_MUTATION","requestNegotiableQuote","input","cartId","quoteName","isDraft","fetchGraphQl","errors","errorMessages","error","quoteData","events"],"mappings":"oHAWO,MAAMA,EAAsB,CAC/B,aAAc,GACd,UAAW,GACX,YAAa,EACjB,EAEMC,EAAgB,CAClB,cAAe,GACf,YAAaD,CACjB,EAGaE,EAAQ,IAAI,MAAMD,EAAQ,CACnC,IAAK,CAACE,EAAQC,IACHD,EAAOC,CAAkB,EAEpC,IAAK,CAACD,EAAQC,EAAKC,KACfF,EAAOC,CAAkB,EAAIC,EACtB,GAEf,CAAC,ECbM,SAASC,EAAeC,EAA4C,CACzE,GAAI,CAACA,GAAY,CAACA,EAAS,MAAQ,CAACA,EAAS,KAAK,uBAChD,OAAO,KAGT,MAAMC,EAAQD,EAAS,KAAK,uBAAuB,MAEnD,MAAO,CACL,IAAKC,EAAM,IACX,UAAWA,EAAM,WACjB,OAAQA,EAAM,O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MAAM,qBAAqB,EAGvC,GAAI,CAACC,EACH,MAAM,IAAI,MAAM,wBAAwB,EAG1C,GAAI,CAACP,EACH,MAAM,IAAI,MAAM,qBAAqB,EAGvC,OAAOS,EAAaN,EAAmC,CACrD,UAAW,CACT,OAAAG,EACA,UAAAC,EACA,QAAS,CACP,QAAAP,CAAA,EAEF,QAAAQ,CAAA,CACF,CACD,EAAE,KAAMV,GAAa,CACpB,KAAM,CAAE,OAAAY,GAAWZ,EAEnB,GAAIY,EAAQ,CAEV,MAAMC,EAAgBD,EAAO,IAAKE,GAAUA,EAAM,OAAO,EAAE,KAAK,IAAI,EACpE,MAAM,IAAI,MAAM,uCAAuCD,CAAa,EAAE,CACxE,CAGA,MAAME,EAAYhB,EAAeC,CAAQ,EAEzC,GAAI,CAACe,EACH,MAAM,IAAI,MACR,4DAAA,EAKJ,OAAAC,EAAO,KAAK,8CAA+C,CACzD,MAAOD,EACP,MAAO,CAAE,OAAAP,EAAQ,UAAAC,EAAW,QAAAP,EAAS,QAAAQ,CAAA,CAAQ,CAC9C,EAEMK,CACT,CAAC,CACH"}
1
+ {"version":3,"file":"requestNegotiableQuote.js","sources":["/@dropins/storefront-quote-management/src/lib/state.ts","/@dropins/storefront-quote-management/src/data/transforms/transform-quote.ts","/@dropins/storefront-quote-management/src/api/graphql/NegotiableQuoteFragment.ts","/@dropins/storefront-quote-management/src/api/requestNegotiableQuote/graphql/RequestNegotiableQuoteMutation.ts","/@dropins/storefront-quote-management/src/api/requestNegotiableQuote/requestNegotiableQuote.ts"],"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 { State } from '../types/state.types';\n\nexport const DEFAULT_PERMISSIONS = {\n requestQuote: false,\n editQuote: false,\n deleteQuote: false,\n checkoutQuote: false,\n};\n\nconst _state: State = {\n authenticated: false,\n permissions: DEFAULT_PERMISSIONS,\n}\n\n// Proxy state to make it reactive\nexport const state = new Proxy(_state, {\n get: (target, key) => {\n return target[key as keyof State];\n },\n set: (target, key, value) => {\n target[key as keyof State] = value;\n return true;\n }\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 *******************************************************************/\nimport { NegotiableQuoteModel } from '@/quote-management/data/models/negotiable-quote-model';\nimport { state } from '@/quote-management/lib/state';\n\nexport function transformQuote(quoteData: any): NegotiableQuoteModel | null {\n if (!quoteData) return null;\n\n return {\n uid: quoteData.uid,\n name: quoteData.name,\n createdAt: quoteData.created_at,\n status: quoteData.status,\n salesRepName: quoteData.sales_rep_name,\n expirationDate: quoteData.expiration_date,\n buyer: quoteData.buyer,\n comments: quoteData.comments.map((comment: any) => ({\n uid: comment.uid,\n createdAt: comment.created_at,\n author: comment.author,\n })),\n items: quoteData.items.map((item: any) => ({\n product: {\n uid: item.product.uid,\n sku: item.product.sku,\n name: item.product.name,\n },\n catalogDiscount: {\n amountOff: item.prices.catalog_discount.amount_off,\n percentOff: item.prices.catalog_discount.percent_off,\n },\n discounts: item.prices?.discounts?.map((discount: any) => ({\n label: discount.label,\n value: discount.value,\n amount: { value: discount.amount.value, currency: discount.amount.currency },\n })) ?? [],\n stockStatus: item.product.stock_status,\n quantity: item.quantity,\n prices: {\n originalItemPrice: {\n value: item.prices.original_item_price.value,\n currency: item.prices.original_item_price.currency,\n },\n rowTotal: {\n value: item.prices.row_total.value,\n currency: item.prices.row_total.currency,\n },\n },\n })),\n prices: {\n grandTotal: {\n value: quoteData.prices.grand_total.value,\n currency: quoteData.prices.grand_total.currency,\n },\n subtotalExcludingTax: {\n value: quoteData.prices.subtotal_excluding_tax.value,\n currency: quoteData.prices.subtotal_excluding_tax.currency,\n },\n appliedTaxes: quoteData.prices.applied_taxes.map((tax: any) => ({\n amount: { value: tax.amount.value, currency: tax.amount.currency },\n label: tax.label,\n })),\n },\n canCheckout: ['UPDATED', 'DECLINED'].includes(quoteData.status) && state.permissions.checkoutQuote,\n canSendForReview: ['SUBMITTED', 'DRAFT', 'UPDATED', 'DECLINED','EXPIRED'].includes(quoteData.status) && state.permissions.editQuote,\n };\n}\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\nexport const NEGOTIABLE_QUOTE_FRAGMENT = /* GraphQL */ `\n fragment NegotiableQuoteFragment on NegotiableQuote {\n uid\n\t\tname\n\t\tcreated_at\n status\n sales_rep_name\n expiration_date\n\t\tbuyer {\n\t\t\tfirstname\n\t\t\tlastname\n\t\t}\n\t\tcomments {\n uid\n created_at\n author {\n firstname\n lastname\n }\n text\n }\n\t\titems {\n product {\n name\n sku\n uid\n\t\t\t\tstock_status\n\t\t\t\tquantity\n price_range {\n maximum_price {\n regular_price {\n value\n }\n }\n }\n }\n\t\t\tprices {\n\t\t\t\tprice {\n\t\t\t\t\tcurrency\n\t\t\t\t\tvalue\n\t\t\t\t}\n\t\t\t\toriginal_item_price {\n\t\t\t\t\tcurrency\n\t\t\t\t\tvalue\n\t\t\t\t}\n\t\t\t\toriginal_row_total {\n\t\t\t\t\tcurrency\n\t\t\t\t\tvalue\n\t\t\t\t}\n\t\t\t\trow_total {\n\t\t\t\t\tcurrency\n\t\t\t\t\tvalue\n\t\t\t\t}\n catalog_discount {\n\t\t\t\t\tamount_off\n\t\t\t\t\tpercent_off\n\t\t\t\t}\n\t\t\t\tdiscounts {\n\t\t\t\t\tlabel\n\t\t\t\t\tvalue\n\t\t\t\t\tamount {\n\t\t\t\t\t\tcurrency\n\t\t\t\t\t\tvalue\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n quantity\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\t }\n prices {\n subtotal_excluding_tax {\n\t\t\t\tcurrency\n\t\t\t\tvalue\n\t\t\t}\n\t\t\tapplied_taxes {\n\t\t\t\tamount {\n\t\t\t\t\tcurrency\n\t\t\t\t\tvalue\n\t\t\t\t}\n\t\t\t\tlabel\n\t\t\t}\n\t\t\tgrand_total {\n\t\t\t\tcurrency\n\t\t\t\tvalue\n\t\t\t}\n }\n }\n`;\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 REQUEST_NEGOTIABLE_QUOTE_MUTATION = `\n mutation REQUEST_NEGOTIABLE_QUOTE_MUTATION(\n $cartId: ID!\n $quoteName: String!\n $comment: NegotiableQuoteCommentInput!\n $isDraft: Boolean\n ) {\n requestNegotiableQuote(\n input: {\n cart_id: $cartId\n quote_name: $quoteName\n comment: $comment\n is_draft: $isDraft\n }\n ) {\n quote {\n ...NegotiableQuoteFragment\n }\n }\n }\n ${NEGOTIABLE_QUOTE_FRAGMENT}\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 { REQUEST_NEGOTIABLE_QUOTE_MUTATION } from './graphql/RequestNegotiableQuoteMutation';\nimport { NegotiableQuoteModel } from '@/quote-management/data/models/negotiable-quote-model';\nimport { transformQuote } from '@/quote-management/data/transforms';\n\nexport interface RequestNegotiableQuoteInput {\n cartId: string;\n quoteName: string;\n comment: string;\n isDraft?: boolean;\n}\n\nexport const requestNegotiableQuote = async (\n input: RequestNegotiableQuoteInput\n): Promise<NegotiableQuoteModel | null> => {\n const { cartId, quoteName, comment, isDraft } = input;\n\n if (!cartId) {\n throw new Error('Cart ID is required');\n }\n\n if (!quoteName) {\n throw new Error('Quote name is required');\n }\n\n if (!comment) {\n throw new Error('Comment is required');\n }\n\n return fetchGraphQl(REQUEST_NEGOTIABLE_QUOTE_MUTATION, {\n variables: {\n cartId,\n quoteName,\n comment: {\n comment\n },\n isDraft,\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 request negotiable quote: ${errorMessages}`);\n }\n\n // Transform the quote data\n const quoteData = transformQuote(response.data?.requestNegotiableQuote?.quote);\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/negotiable-quote-requested', {\n quote: quoteData,\n input: { cartId, quoteName, comment, isDraft },\n });\n\n return quoteData;\n });\n};\n"],"names":["DEFAULT_PERMISSIONS","_state","state","target","key","value","transformQuote","quoteData","comment","item","_b","_a","discount","tax","NEGOTIABLE_QUOTE_FRAGMENT","REQUEST_NEGOTIABLE_QUOTE_MUTATION","requestNegotiableQuote","input","cartId","quoteName","isDraft","fetchGraphQl","response","errors","errorMessages","error","events"],"mappings":"oHAWO,MAAMA,EAAsB,CAC/B,aAAc,GACd,UAAW,GACX,YAAa,GACb,cAAe,EACnB,EAEMC,EAAgB,CAClB,cAAe,GACf,YAAaD,CACjB,EAGaE,EAAQ,IAAI,MAAMD,EAAQ,CACnC,IAAK,CAACE,EAAQC,IACHD,EAAOC,CAAkB,EAEpC,IAAK,CAACD,EAAQC,EAAKC,KACfF,EAAOC,CAAkB,EAAIC,EACtB,GAEf,CAAC,ECbM,SAASC,EAAeC,EAA6C,CAC1E,OAAKA,EAEE,CACL,IAAKA,EAAU,IACf,KAAMA,EAAU,KAChB,UAAWA,EAAU,WACrB,OAAQA,EAAU,OAClB,aAAcA,EAAU,eACxB,eAAgBA,EAAU,gBAC1B,MAAOA,EAAU,MACjB,SAAUA,EAAU,SAAS,IAAKC,IAAkB,CAClD,IAAKA,EAAQ,IACb,UAAWA,EAAQ,WACnB,OAAQA,EAAQ,MAAA,EAChB,EACF,MAAOD,EAAU,MAAM,IAAKE,GAAA,SAAe,OACzC,QAAS,CACP,IAAKA,EAAK,QAAQ,IAClB,IAAKA,EAAK,QAAQ,IAClB,KAAMA,EAAK,QAAQ,IAAA,EAErB,gBAAiB,CACf,UAAWA,EAAK,OAAO,iBAAiB,WACxC,WAAYA,EAAK,OAAO,iBAAiB,WAAA,EAE3C,YAAWC,GAAAC,EAAAF,EAAK,SAAL,YAAAE,EAAa,YAAb,YAAAD,EAAwB,IAAKE,IAAmB,CACzD,MAAOA,EAAS,MAChB,MAAOA,EAAS,MAChB,OAAQ,CAAE,MAAOA,EAAS,OAAO,MAAO,SAAUA,EAAS,OAAO,QAAA,CAAS,MACtE,CAAA,EACP,YAAaH,EAAK,QAAQ,aAC1B,SAAUA,EAAK,SACf,OAAQ,CACN,kBAAmB,CACjB,MAAOA,EAAK,OAAO,o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/compat';
3
+
4
+ export interface ActionsBarProps extends HTMLAttributes<HTMLDivElement> {
5
+ dropdownPlaceholder?: string;
6
+ dropdownOptions?: {
7
+ label: string;
8
+ value: string;
9
+ }[];
10
+ handleDropdownChange?: (event: Event) => void;
11
+ buttons?: VNode[];
12
+ }
13
+ export declare const ActionsBar: FunctionComponent<ActionsBarProps>;
14
+ //# sourceMappingURL=ActionsBar.d.ts.map
@@ -0,0 +1,11 @@
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 './ActionsBar';
10
+ export { ActionsBar as default } from './ActionsBar';
11
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1,11 @@
1
+ import { FunctionComponent, VNode } from 'preact';
2
+ import { HTMLAttributes } from 'preact/compat';
3
+
4
+ export interface ItemsQuotedProps extends Omit<HTMLAttributes<HTMLDivElement>, 'loading'> {
5
+ loading?: boolean;
6
+ table?: VNode;
7
+ pricesSummary?: VNode;
8
+ }
9
+ export declare const ItemsQuoted: FunctionComponent<ItemsQuotedProps>;
10
+ export declare const ItemsQuotedSkeleton: FunctionComponent;
11
+ //# sourceMappingURL=ItemsQuoted.d.ts.map
@@ -0,0 +1,11 @@
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 './ItemsQuoted';
10
+ export { ItemsQuoted as default } from './ItemsQuoted';
11
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1,20 @@
1
+ import { FunctionComponent, VNode } from 'preact';
2
+ import { HTMLAttributes } from 'preact/compat';
3
+
4
+ export interface ManageNegotiableQuoteProps extends Omit<HTMLAttributes<HTMLDivElement>, 'loading'> {
5
+ loading?: boolean;
6
+ quoteName: VNode;
7
+ quoteStatus: VNode;
8
+ banner?: VNode;
9
+ details: VNode;
10
+ actionBar?: VNode;
11
+ quoteContent: VNode;
12
+ shippingInformationTitle: VNode;
13
+ shippingInformation: VNode;
14
+ quoteCommentsTitle: VNode;
15
+ quoteComments: VNode;
16
+ footer: VNode;
17
+ }
18
+ export declare const ManageNegotiableQuote: FunctionComponent<ManageNegotiableQuoteProps>;
19
+ export declare const ManageNegotiableQuoteSkeleton: FunctionComponent;
20
+ //# sourceMappingURL=ManageNegotiableQuote.d.ts.map
@@ -0,0 +1,4 @@
1
+ import { ManageNegotiableQuoteProps } from '../ManageNegotiableQuote';
2
+
3
+ export declare const baseProps: ManageNegotiableQuoteProps;
4
+ //# sourceMappingURL=ManageNegotiableQuoteProps.d.ts.map
@@ -0,0 +1,11 @@
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 './ManageNegotiableQuote';
10
+ export { ManageNegotiableQuote as default } from './ManageNegotiableQuote';
11
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1,13 @@
1
+ import { FunctionComponent } from 'preact';
2
+ import { HTMLAttributes } from 'preact/compat';
3
+ import { NegotiableQuoteModel } from '../../data/models/negotiable-quote-model';
4
+
5
+ export interface ProductListTableProps extends HTMLAttributes<HTMLDivElement | HTMLFormElement> {
6
+ items: NegotiableQuoteModel['items'];
7
+ canEdit: boolean;
8
+ onItemCheckboxChange?: (item: NegotiableQuoteModel['items'][number], isSelected: boolean) => void;
9
+ onItemDropdownChange?: (item: NegotiableQuoteModel['items'][number], action: string) => void;
10
+ onUpdate?: (e: SubmitEvent) => void;
11
+ }
12
+ export declare const ProductListTable: FunctionComponent<ProductListTableProps>;
13
+ //# sourceMappingURL=ProductListTable.d.ts.map
@@ -0,0 +1,11 @@
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 './ProductListTable';
10
+ export { ProductListTable as default } from './ProductListTable';
11
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1,16 @@
1
+ import { FunctionComponent, VNode } from 'preact';
2
+ import { HTMLAttributes } from 'preact/compat';
3
+
4
+ interface Entry {
5
+ label: string;
6
+ id: string;
7
+ value: VNode;
8
+ strong?: boolean;
9
+ children?: Entry[];
10
+ }
11
+ export interface QuotePricesSummaryProps extends HTMLAttributes<HTMLDivElement> {
12
+ entries?: Entry[];
13
+ }
14
+ export declare const QuotePricesSummary: FunctionComponent<QuotePricesSummaryProps>;
15
+ export {};
16
+ //# sourceMappingURL=QuotePricesSummary.d.ts.map
@@ -0,0 +1,11 @@
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 './QuotePricesSummary';
10
+ export { QuotePricesSummary as default } from './QuotePricesSummary';
11
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1,10 @@
1
+ import { FunctionComponent, VNode } from 'preact';
2
+ import { HTMLAttributes } from 'preact/compat';
3
+
4
+ export interface TabbedContentProps extends HTMLAttributes<HTMLDivElement> {
5
+ tabs: Map<string, string>;
6
+ tabsContent: Map<string, VNode>;
7
+ defaultActiveTab?: string;
8
+ }
9
+ export declare const TabbedContent: FunctionComponent<TabbedContentProps>;
10
+ //# sourceMappingURL=TabbedContent.d.ts.map
@@ -0,0 +1,11 @@
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 './TabbedContent';
10
+ export { TabbedContent as default } from './TabbedContent';
11
+ //# sourceMappingURL=index.d.ts.map
@@ -1,2 +1,8 @@
1
1
  export * from './RequestNegotiableQuoteForm';
2
+ export * from './ManageNegotiableQuote';
3
+ export * from './TabbedContent';
4
+ export * from './ActionsBar';
5
+ export * from './ProductListTable';
6
+ export * from './QuotePricesSummary';
7
+ export * from './ItemsQuoted';
2
8
  //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1,25 @@
1
+ import { HTMLAttributes } from 'preact/compat';
2
+ import { Container, SlotProps } from '@dropins/tools/types/elsie/src/lib';
3
+ import { NegotiableQuoteModel } from '../../data/models/negotiable-quote-model';
4
+
5
+ export interface ItemsQuotedProps extends HTMLAttributes<HTMLDivElement> {
6
+ quoteData?: NegotiableQuoteModel;
7
+ onItemCheckboxChange?: (item: NegotiableQuoteModel['items'][number], isSelected: boolean) => void;
8
+ onItemDropdownChange?: (item: NegotiableQuoteModel['items'][number], action: string) => void;
9
+ onUpdate?: (e: SubmitEvent) => void;
10
+ slots?: {
11
+ ProductListTable?: SlotProps<{
12
+ items: NegotiableQuoteModel['items'];
13
+ canEdit: boolean;
14
+ onItemCheckboxChange?: (item: NegotiableQuoteModel['items'][number], isSelected: boolean) => void;
15
+ onItemDropdownChange?: (item: NegotiableQuoteModel['items'][number], action: string) => void;
16
+ onUpdate?: (e: SubmitEvent) => void;
17
+ }>;
18
+ QuotePricesSummary?: SlotProps<{
19
+ items: NegotiableQuoteModel['items'];
20
+ prices: NegotiableQuoteModel['prices'];
21
+ }>;
22
+ };
23
+ }
24
+ export declare const ItemsQuoted: Container<ItemsQuotedProps>;
25
+ //# sourceMappingURL=ItemsQuoted.d.ts.map