@dropins/storefront-quote-management 0.0.1-alpha10 → 0.0.1-alpha11

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 (54) hide show
  1. package/api/graphql/NegotiableQuoteFragment.d.ts +1 -1
  2. package/api/index.d.ts +0 -1
  3. package/api/initialize/initialize.d.ts +0 -1
  4. package/api.js +3 -15
  5. package/api.js.map +1 -1
  6. package/chunks/requestNegotiableQuote.js +8 -100
  7. package/chunks/requestNegotiableQuote.js.map +1 -1
  8. package/chunks/transform-quote.js +1 -1
  9. package/chunks/transform-quote.js.map +1 -1
  10. package/components/index.d.ts +0 -6
  11. package/containers/QuotesListTable/QuotesListTable.d.ts +9 -9
  12. package/containers/QuotesListTable.js +1 -1
  13. package/containers/QuotesListTable.js.map +1 -1
  14. package/containers/RequestNegotiableQuoteForm.js +1 -1
  15. package/containers/RequestNegotiableQuoteForm.js.map +1 -1
  16. package/containers/index.d.ts +0 -2
  17. package/data/models/customer-model.d.ts +0 -1
  18. package/data/models/negotiable-quote-model.d.ts +30 -76
  19. package/data/transforms/__fixtures__/negotiableQuoteData.d.ts +2 -229
  20. package/i18n/en_US.json.d.ts +0 -54
  21. package/lib/state.d.ts +0 -1
  22. package/package.json +1 -1
  23. package/render.js +3 -4
  24. package/render.js.map +1 -1
  25. package/types/state.types.d.ts +0 -1
  26. package/api/getQuoteData/getQuoteData.d.ts +0 -10
  27. package/api/getQuoteData/graphql/QuoteDataQuery.d.ts +0 -2
  28. package/api/getQuoteData/index.d.ts +0 -10
  29. package/chunks/WarningFilled.js +0 -4
  30. package/chunks/WarningFilled.js.map +0 -1
  31. package/components/ActionsBar/ActionsBar.d.ts +0 -14
  32. package/components/ActionsBar/index.d.ts +0 -11
  33. package/components/ItemsQuoted/ItemsQuoted.d.ts +0 -11
  34. package/components/ItemsQuoted/index.d.ts +0 -11
  35. package/components/ManageNegotiableQuote/ManageNegotiableQuote.d.ts +0 -20
  36. package/components/ManageNegotiableQuote/__fixtures__/ManageNegotiableQuoteProps.d.ts +0 -4
  37. package/components/ManageNegotiableQuote/index.d.ts +0 -11
  38. package/components/ProductListTable/ProductListTable.d.ts +0 -13
  39. package/components/ProductListTable/index.d.ts +0 -11
  40. package/components/QuotePricesSummary/QuotePricesSummary.d.ts +0 -16
  41. package/components/QuotePricesSummary/index.d.ts +0 -11
  42. package/components/TabbedContent/TabbedContent.d.ts +0 -10
  43. package/components/TabbedContent/index.d.ts +0 -11
  44. package/containers/ItemsQuoted/ItemsQuoted.d.ts +0 -25
  45. package/containers/ItemsQuoted/index.d.ts +0 -11
  46. package/containers/ItemsQuoted.d.ts +0 -3
  47. package/containers/ItemsQuoted.js +0 -4
  48. package/containers/ItemsQuoted.js.map +0 -1
  49. package/containers/ManageNegotiableQuote/ManageNegotiableQuote.d.ts +0 -48
  50. package/containers/ManageNegotiableQuote/index.d.ts +0 -11
  51. package/containers/ManageNegotiableQuote.d.ts +0 -3
  52. package/containers/ManageNegotiableQuote.js +0 -4
  53. package/containers/ManageNegotiableQuote.js.map +0 -1
  54. package/data/models/__fixtures__/negotiableQuoteModel.d.ts +0 -7
@@ -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 }\n";
17
+ export declare const NEGOTIABLE_QUOTE_FRAGMENT = "\n fragment NegotiableQuoteFragment on NegotiableQuote {\n uid\n name\n created_at\n updated_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 template_id\n template_name\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 currency\n }\n }\n }\n";
18
18
  //# sourceMappingURL=NegotiableQuoteFragment.d.ts.map
package/api/index.d.ts CHANGED
@@ -2,6 +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';
6
5
  export * from './negotiableQuotes';
7
6
  //# sourceMappingURL=index.d.ts.map
@@ -3,7 +3,6 @@ import { Lang } from '@dropins/tools/types/elsie/src/i18n';
3
3
 
4
4
  type ConfigProps = {
5
5
  langDefinitions?: Lang;
6
- quoteId?: string;
7
6
  };
8
7
  export declare const initialize: Initializer<ConfigProps>;
9
8
  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 i,s as n,t as l}from"./chunks/transform-quote.js";import{FetchGraphQL as Q}from"@dropins/tools/fetch-graphql.js";import{events as s}from"@dropins/tools/event-bus.js";import{N as E}from"./chunks/requestNegotiableQuote.js";import{r as k}from"./chunks/requestNegotiableQuote.js";import{F as v,N as H,S as L,n as V}from"./chunks/negotiableQuotes.js";import{Initializer as h}from"@dropins/tools/lib.js";const f=`
3
+ import{D as s,s as o}from"./chunks/transform-quote.js";import{FetchGraphQL as l}from"@dropins/tools/fetch-graphql.js";import{events as c}from"@dropins/tools/event-bus.js";import{r as P}from"./chunks/requestNegotiableQuote.js";import{F as G,N as y,S as b,n as v}from"./chunks/negotiableQuotes.js";import{Initializer as d}from"@dropins/tools/lib.js";const E=`
4
4
  fragment CUSTOMER_FRAGMENT on Customer {
5
5
  role {
6
6
  permissions {
@@ -17,25 +17,13 @@ import{D as i,s as n,t as l}from"./chunks/transform-quote.js";import{FetchGraphQ
17
17
  }
18
18
  }
19
19
  }
20
- `,p=`
20
+ `,Q=`
21
21
  query CUSTOMER_QUERY {
22
22
  customer {
23
23
  ...CUSTOMER_FRAGMENT
24
24
  }
25
25
  }
26
26
 
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=(r,d=[])=>{for(const a of r){const c=[...d,a.text];a.children&&a.children.length>0?o(a.children,c):e.push(c.join("/"))}};return o(t),e};function C(t){const{role:e}=t;if(!e)return{permissions:{canRequestQuote:i.requestQuote,canEditQuote:i.editQuote,canDeleteQuote:i.deleteQuote,canCheckoutQuote:i.checkoutQuote}};const{permissions:o}=e,r=_(o);return{permissions:{canRequestQuote:r.includes(g),canEditQuote:r.includes(q),canDeleteQuote:r.includes(R),canCheckoutQuote:r.includes(T)}}}const U=async()=>{var t;if(!n.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 C(e.data.customer)}catch(e){return Promise.reject(e)}},N=`
29
- query QUOTE_DATA_QUERY(
30
- $quoteId: ID!
31
- ) {
32
- negotiableQuote(
33
- uid: $quoteId
34
- ) {
35
- ...NegotiableQuoteFragment
36
- }
37
- }
38
-
39
27
  ${E}
40
- `,S=async t=>{var e;if(!n.authenticated)return Promise.reject(new Error("Unauthorized"));if(!n.permissions.editQuote)return Promise.reject(new Error("Unauthorized"));try{const o=await m(N,{variables:{quoteId:t}}),r=l((e=o==null?void 0:o.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(o){return Promise.reject(o)}},u=new h({init:async t=>{const e={};u.config.setConfig({...e,...t})},listeners:()=>[s.on("authenticated",async t=>{n.authenticated=!!t,t?U().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 t=>{const e=u.config.getConfig().quoteId;e&&t.editQuote&&S(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})]}),F=u.config,{setEndpoint:P,setFetchGraphQlHeader:D,removeFetchGraphQlHeader:y,setFetchGraphQlHeaders:G,fetchGraphQl:m,getConfig:b}=new Q().getMethods();export{v as FilterMatchTypeEnum,H as NegotiableQuoteSortableField,L as SortEnum,F as config,m as fetchGraphQl,b as getConfig,U as getCustomerData,S as getQuoteData,u as initialize,V as negotiableQuotes,y as removeFetchGraphQlHeader,k as requestNegotiableQuote,P as setEndpoint,D as setFetchGraphQlHeader,G as setFetchGraphQlHeaders};
28
+ `,p="All/Quotes/View/Request, Edit, Delete",h="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(p),canEditQuote:n.includes(h),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})]}),q=u.config,{setEndpoint:U,setFetchGraphQlHeader:O,removeFetchGraphQlHeader:F,setFetchGraphQlHeaders:A,fetchGraphQl:T,getConfig:I}=new l().getMethods();export{G as FilterMatchTypeEnum,y as NegotiableQuoteSortableField,b as SortEnum,q as config,T as fetchGraphQl,I as getConfig,S as getCustomerData,u as initialize,v as negotiableQuotes,F as removeFetchGraphQlHeader,P as requestNegotiableQuote,U as setEndpoint,O as setFetchGraphQlHeader,A as setFetchGraphQlHeaders};
41
29
  //# 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"],"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"],"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":"0ZAAO,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,eA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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/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":"4VAAO,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;AAA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EAAgB,CAAA,EAEtBH,EAAW,OAAO,UAAU,CAAE,GAAGG,EAAe,GAAGD,EAAQ,CAC7D,EAEA,UAAW,IAAM,CACfE,EAAO,GAAG,gBAAiB,MAAOC,GAAkB,CAClDV,EAAM,cAAgB,CAAC,CAACU,EAEpBA,EACFX,EAAA,EAAkB,KAAMJ,GAAiB,CACvCK,EAAM,YAAc,CAClB,aAAcL,EAAa,YAAY,gBACvC,UAAWA,EAAa,YAAY,aACpC,YAAaA,EAAa,YAAY,cAAA,EAExCc,EAAO,KAAK,+BAAgCT,EAAM,WAAW,CAC/D,CAAC,EACE,MAAOI,GAAU,CAChB,QAAQ,MAAMA,CAAK,EACnBJ,EAAM,YAAcH,EACpBY,EAAO,KAAK,+BAAgCZ,CAAmB,CACjE,CAAC,GAEHG,EAAM,YAAcH,EACpBY,EAAO,KAAK,+BAAgCZ,CAAmB,EAEnE,EAAG,CACD,MAAO,EAAA,CACR,CAAA,CAEL,CAAC,EAEYU,EAASF,EAAW,OC3CpB,CACX,YAAAM,EACA,sBAAAC,EACA,yBAAAC,EACA,uBAAAC,EACA,aAAAZ,EACA,UAAAa,CACF,EAAI,IAAIC,EAAA,EAAe,WAAA"}
@@ -1,14 +1,12 @@
1
1
  /*! Copyright 2025 Adobe
2
2
  All Rights Reserved. */
3
- import{fetchGraphQl as _}from"@dropins/tools/fetch-graphql.js";import{events as d}from"@dropins/tools/event-bus.js";import{t as p}from"./transform-quote.js";const g=`
3
+ import{fetchGraphQl as c}from"@dropins/tools/fetch-graphql.js";import{events as l}from"@dropins/tools/event-bus.js";import{t as _}from"./transform-quote.js";const d=`
4
4
  fragment NegotiableQuoteFragment on NegotiableQuote {
5
5
  uid
6
6
  name
7
7
  created_at
8
- status
9
- sales_rep_name
10
- expiration_date
11
8
  updated_at
9
+ status
12
10
  buyer {
13
11
  firstname
14
12
  lastname
@@ -20,17 +18,14 @@ import{fetchGraphQl as _}from"@dropins/tools/fetch-graphql.js";import{events as
20
18
  firstname
21
19
  lastname
22
20
  }
23
- text
24
21
  }
25
22
  template_id
26
23
  template_name
27
24
  items {
28
25
  product {
29
- name
30
- sku
31
26
  uid
32
- stock_status
33
- quantity
27
+ sku
28
+ name
34
29
  price_range {
35
30
  maximum_price {
36
31
  regular_price {
@@ -39,112 +34,25 @@ import{fetchGraphQl as _}from"@dropins/tools/fetch-graphql.js";import{events as
39
34
  }
40
35
  }
41
36
  }
42
- prices {
43
- price {
44
- currency
45
- value
46
- }
47
- original_item_price {
48
- currency
49
- value
50
- }
51
- original_row_total {
52
- currency
53
- value
54
- }
55
- row_total {
56
- currency
57
- value
58
- }
59
- catalog_discount {
60
- amount_off
61
- percent_off
62
- }
63
- discounts {
64
- label
65
- value
66
- amount {
67
- currency
68
- value
69
- }
70
- }
71
- }
72
37
  quantity
73
- ... 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
85
- original_price {
86
- currency
87
- value
88
- }
89
- priceV2 {
90
- currency
91
- value
92
- }
93
- }
94
- }
95
- }
96
- }
97
- history {
98
- uid
99
- created_at
100
- author {
101
- firstname
102
- lastname
103
- }
104
- change_type
105
- changes {
106
- comment_added {
107
- comment
108
- }
109
- statuses {
110
- changes {
111
- new_status
112
- old_status
113
- }
114
- }
115
- expiration {
116
- new_expiration
117
- old_expiration
118
- }
119
- }
120
38
  }
121
39
  prices {
122
40
  subtotal_excluding_tax {
123
- currency
124
41
  value
125
42
  }
126
43
  subtotal_including_tax {
127
- currency
128
44
  value
129
45
  }
130
46
  subtotal_with_discount_excluding_tax {
131
- currency
132
47
  value
133
48
  }
134
- applied_taxes {
135
- amount {
136
- currency
137
- value
138
- }
139
- label
140
- }
141
49
  grand_total {
142
- currency
143
50
  value
51
+ currency
144
52
  }
145
53
  }
146
54
  }
147
- `,f=`
55
+ `,g=`
148
56
  mutation REQUEST_NEGOTIABLE_QUOTE_MUTATION(
149
57
  $cartId: ID!
150
58
  $quoteName: String!
@@ -164,6 +72,6 @@ import{fetchGraphQl as _}from"@dropins/tools/fetch-graphql.js";import{events as
164
72
  }
165
73
  }
166
74
  }
167
- ${g}
168
- `,y=async c=>{const{cartId:e,quoteName:t,comment:a,isDraft:o}=c;if(!e)throw new Error("Cart ID is required");if(!t)throw new Error("Quote name is required");if(!a)throw new Error("Comment is required");return _(f,{variables:{cartId:e,quoteName:t,comment:{comment:a},isDraft:o}}).then(n=>{var i,s;const{errors:u}=n;if(u){const l=u.map(m=>m.message).join("; ");throw new Error(`Failed to request negotiable quote: ${l}`)}const r=p((s=(i=n.data)==null?void 0:i.requestNegotiableQuote)==null?void 0:s.quote);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:e,quoteName:t,comment:a,isDraft:o}}),r})};export{g as N,y as r};
75
+ ${d}
76
+ `,p=async i=>{const{cartId:e,quoteName:t,comment:r,isDraft:o}=i;if(!e)throw new Error("Cart ID is required");if(!t)throw new Error("Quote name is required");if(!r)throw new Error("Comment is required");return c(g,{variables:{cartId:e,quoteName:t,comment:{comment:r},isDraft:o}}).then(n=>{const{errors:u}=n;if(u){const m=u.map(s=>s.message).join("; ");throw new Error(`Failed to request negotiable quote: ${m}`)}const a=_(n);if(!a)throw new Error("Failed to transform quote data: Invalid response structure");return l.emit("quote-management/negotiable-quote-requested",{quote:a,input:{cartId:e,quoteName:t,comment:r,isDraft:o}}),a})};export{p as r};
169
77
  //# sourceMappingURL=requestNegotiableQuote.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"requestNegotiableQuote.js","sources":["/@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 * 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 }\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":["NEGOTIABLE_QUOTE_FRAGMENT","REQUEST_NEGOTIABLE_QUOTE_MUTATION","requestNegotiableQuote","input","cartId","quoteName","comment","isDraft","fetchGraphQl","response","errors","errorMessages","error","quoteData","transformQuote","_b","_a","events"],"mappings":"6JAiBO,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;AAA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CD,CAAa,EAAE,CACxE,CAGA,MAAME,EAAYC,GAAeC,GAAAC,EAAAP,EAAS,OAAT,YAAAO,EAAe,yBAAf,YAAAD,EAAuC,KAAK,EAE7E,GAAI,CAACF,EACH,MAAM,IAAI,MACR,4DAAA,EAKJ,OAAAI,EAAO,KAAK,8CAA+C,CACzD,MAAOJ,EACP,MAAO,CAAE,OAAAT,EAAQ,UAAAC,EAAW,QAAAC,EAAS,QAAAC,CAAA,CAAQ,CAC9C,EAEMM,CACT,CAAC,CACH"}
1
+ {"version":3,"file":"requestNegotiableQuote.js","sources":["/@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 * 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 updated_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 template_id\n template_name\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 currency\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 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);\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":["NEGOTIABLE_QUOTE_FRAGMENT","REQUEST_NEGOTIABLE_QUOTE_MUTATION","requestNegotiableQuote","input","cartId","quoteName","comment","isDraft","fetchGraphQl","response","errors","errorMessages","error","quoteData","transformQuote","events"],"mappings":"6JAiBO,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,ECE1CC,EAAoC;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,IAoB7CD,CAAyB;AAAA,ECjBhBE,EAAyB,MACpCC,GACyC,CACzC,KAAM,CAAE,OAAAC,EAAQ,UAAAC,EAAW,QAAAC,EAAS,QAAAC,GAAYJ,EAEhD,GAAI,CAACC,EACH,MAAM,IAAI,MAAM,qBAAqB,EAGvC,GAAI,CAACC,EACH,MAAM,IAAI,MAAM,wBAAwB,EAG1C,GAAI,CAACC,EACH,MAAM,IAAI,MAAM,qBAAqB,EAGvC,OAAOE,EAAaP,EAAmC,CACrD,UAAW,CACT,OAAAG,EACA,UAAAC,EACA,QAAS,CACP,QAAAC,CAAA,EAEF,QAAAC,CAAA,CACF,CACD,EAAE,KAAME,GAAa,CACpB,KAAM,CAAE,OAAAC,GAAWD,EAEnB,GAAIC,EAAQ,CAEV,MAAMC,EAAgBD,EAAO,IAAKE,GAAUA,EAAM,OAAO,EAAE,KAAK,IAAI,EACpE,MAAM,IAAI,MAAM,uCAAuCD,CAAa,EAAE,CACxE,CAGA,MAAME,EAAYC,EAAeL,CAAQ,EAEzC,GAAI,CAACI,EACH,MAAM,IAAI,MACR,4DAAA,EAKJ,OAAAE,EAAO,KAAK,8CAA+C,CACzD,MAAOF,EACP,MAAO,CAAE,OAAAT,EAAQ,UAAAC,EAAW,QAAAC,EAAS,QAAAC,CAAA,CAAQ,CAC9C,EAEMM,CACT,CAAC,CACH"}
@@ -1,4 +1,4 @@
1
1
  /*! Copyright 2025 Adobe
2
2
  All Rights Reserved. */
3
- const d={requestQuote:!1,editQuote:!1,deleteQuote:!1,checkoutQuote:!1},_={authenticated:!1,permissions:d},p=new Proxy(_,{get:(a,t)=>a[t],set:(a,t,n)=>(a[t]=n,!0)});function g(a){var t,n,i;return{uid:a.uid,name:a.name,createdAt:a.created_at,updatedAt:a.updated_at,expirationDate:a.expiration_date,status:a.status,salesRepName:a.sales_rep_name,buyer:{firstname:a.buyer.firstname,lastname:a.buyer.lastname},templateName:a.template_name,comments:(t=a.comments)==null?void 0:t.map(e=>({uid:e.uid,createdAt:e.created_at,author:{firstname:e.author.firstname,lastname:e.author.lastname}})),prices:a.prices&&{subtotalExcludingTax:a.prices.subtotal_excluding_tax&&{value:a.prices.subtotal_excluding_tax.value,currency:a.prices.subtotal_excluding_tax.currency},subtotalIncludingTax:a.prices.subtotal_including_tax&&{value:a.prices.subtotal_including_tax.value,currency:a.prices.subtotal_including_tax.currency},subtotalWithDiscountExcludingTax:a.prices.subtotal_with_discount_excluding_tax&&{value:a.prices.subtotal_with_discount_excluding_tax.value,currency:a.prices.subtotal_with_discount_excluding_tax.currency},appliedTaxes:(n=a.prices.applied_taxes)==null?void 0:n.map(e=>({amount:{value:e.amount.value,currency:e.amount.currency},label:e.label})),grandTotal:a.prices.grand_total&&{value:a.prices.grand_total.value,currency:a.prices.grand_total.currency}},items:((i=a.items)==null?void 0:i.map(e=>{var s,l,u,o;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:((l=(s=e.prices)==null?void 0:s.discounts)==null?void 0:l.map(r=>({label:r.label,value:r.value,amount:{value:r.amount.value,currency:r.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}},configurableOptions:(u=e.configurable_options)==null?void 0:u.map(r=>({optionLabel:r.option_label,valueLabel:r.value_label})),bundleOptions:(o=e.bundle_options)==null?void 0:o.map(r=>({label:r.label,values:r.values.map(c=>({label:c.label,quantity:c.quantity,originalPrice:{value:c.original_price.value,currency:c.original_price.currency},price:{value:c.priceV2.value,currency:c.priceV2.currency}}))}))}}))||[],canCheckout:["UPDATED","DECLINED"].includes(a.status)&&p.permissions.checkoutQuote,canSendForReview:["SUBMITTED","DRAFT","UPDATED","DECLINED","EXPIRED"].includes(a.status)&&p.permissions.editQuote}}function b(a){return a?g(a):null}function f(a){return{uid:a.uid,name:a.name,createdAt:a.created_at,updatedAt:a.updated_at,status:a.status,buyer:{firstname:a.buyer.firstname,lastname:a.buyer.lastname},templateName:a.template_name,prices:{grandTotal:{value:a.prices.grand_total.value,currency:a.prices.grand_total.currency}}}}function y(a){var i;if(!a)return null;const t={items:((i=a.items)==null?void 0:i.filter(e=>e==null?void 0:e.uid).map(f))||[],pageInfo:{currentPage:a.page_info.current_page,pageSize:a.page_info.page_size,totalPages:a.page_info.total_pages},totalCount:a.total_count,sortFields:a.sort_fields?{default:a.sort_fields.default,options:a.sort_fields.options}:void 0},n=m(t);return{...t,paginationInfo:n||void 0}}function m(a){if(!(a!=null&&a.pageInfo)||!a.totalCount)return null;const{currentPage:t,pageSize:n,totalPages:i}=a.pageInfo,{totalCount:e}=a,s=e>0?(t-1)*n+1:0,l=Math.min(t*n,e);return{currentPage:t,totalCount:e,pageSize:n,startItem:s,endItem:l,totalPages:i,pageSizeOptions:[20,30,50,100,200]}}const v=()=>[20,30,50,100,200];export{d as D,y as a,v as g,p as s,b as t};
3
+ const u={requestQuote:!1,editQuote:!1,deleteQuote:!1},c={authenticated:!1,permissions:u},p=new Proxy(c,{get:(t,a)=>t[a],set:(t,a,n)=>(t[a]=n,!0)});function i(t){var a,n;return{uid:t.uid,name:t.name,createdAt:t.created_at,updatedAt:t.updated_at,status:t.status,buyer:{firstname:t.buyer.firstname,lastname:t.buyer.lastname},templateName:t.template_name,comments:(a=t.comments)==null?void 0:a.map(e=>({uid:e.uid,createdAt:e.created_at,author:{firstname:e.author.firstname,lastname:e.author.lastname}})),prices:t.prices&&{subtotalExcludingTax:t.prices.subtotal_excluding_tax&&{value:t.prices.subtotal_excluding_tax.value},subtotalIncludingTax:t.prices.subtotal_including_tax&&{value:t.prices.subtotal_including_tax.value},subtotalWithDiscountExcludingTax:t.prices.subtotal_with_discount_excluding_tax&&{value:t.prices.subtotal_with_discount_excluding_tax.value},grandTotal:t.prices.grand_total&&{value:t.prices.grand_total.value,currency:t.prices.grand_total.currency}},items:(n=t.items)==null?void 0:n.map(e=>({product:{uid:e.product.uid,sku:e.product.sku,name:e.product.name,templateId:e.product.template_id,templateName:e.product.template_name,priceRange:{maximumPrice:{regularPrice:{value:e.product.price_range.maximum_price.regular_price.value}}}},quantity:e.quantity}))}}function g(t){if(!t||!t.data||!t.data.requestNegotiableQuote)return null;const a=t.data.requestNegotiableQuote.quote;return i(a)}function _(t){var e;if(!t)return null;const a={items:((e=t.items)==null?void 0:e.filter(r=>r==null?void 0:r.uid).map(i))||[],pageInfo:{currentPage:t.page_info.current_page,pageSize:t.page_info.page_size,totalPages:t.page_info.total_pages},totalCount:t.total_count,sortFields:t.sort_fields?{default:t.sort_fields.default,options:t.sort_fields.options}:void 0},n=o(a);return{...a,paginationInfo:n||void 0}}function o(t){if(!(t!=null&&t.pageInfo)||!t.totalCount)return null;const{currentPage:a,pageSize:n,totalPages:e}=t.pageInfo,{totalCount:r}=t,s=r>0?(a-1)*n+1:0,l=Math.min(a*n,r);return{currentPage:a,totalCount:r,pageSize:n,startItem:s,endItem:l,totalPages:e,pageSizeOptions:[20,30,50,100,200]}}const f=()=>[20,30,50,100,200];export{u as D,_ as a,f as g,p as s,g as t};
4
4
  //# sourceMappingURL=transform-quote.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"transform-quote.js","sources":["/@dropins/storefront-quote-management/src/lib/state.ts","/@dropins/storefront-quote-management/src/data/transforms/transform-quote.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 {\n NegotiableQuoteListEntry,\n NegotiableQuoteModel,\n NegotiableQuotesListModel,\n PaginationInfo,\n} from '@/quote-management/data/models/negotiable-quote-model';\nimport { state } from '@/quote-management/lib/state';\n\n// Base helper that transforms a single quote object directly\nfunction transformSingleQuote(quote: any): NegotiableQuoteModel {\n return {\n uid: quote.uid,\n name: quote.name,\n createdAt: quote.created_at,\n updatedAt: quote.updated_at,\n expirationDate: quote.expiration_date,\n status: quote.status,\n salesRepName: quote.sales_rep_name,\n buyer: {\n firstname: quote.buyer.firstname,\n lastname: quote.buyer.lastname,\n },\n templateName: quote.template_name,\n comments: quote.comments?.map((comment: any) => ({\n uid: comment.uid,\n createdAt: comment.created_at,\n author: {\n firstname: comment.author.firstname,\n lastname: comment.author.lastname,\n },\n })),\n prices: quote.prices && {\n subtotalExcludingTax: quote.prices.subtotal_excluding_tax && {\n value: quote.prices.subtotal_excluding_tax.value,\n currency: quote.prices.subtotal_excluding_tax.currency,\n },\n subtotalIncludingTax: quote.prices.subtotal_including_tax && {\n value: quote.prices.subtotal_including_tax.value,\n currency: quote.prices.subtotal_including_tax.currency,\n },\n subtotalWithDiscountExcludingTax: quote.prices\n .subtotal_with_discount_excluding_tax && {\n value: quote.prices.subtotal_with_discount_excluding_tax.value,\n currency: quote.prices.subtotal_with_discount_excluding_tax.currency,\n },\n appliedTaxes: quote.prices.applied_taxes?.map((tax: any) => ({\n amount: { value: tax.amount.value, currency: tax.amount.currency },\n label: tax.label,\n })),\n grandTotal: quote.prices.grand_total && {\n value: quote.prices.grand_total.value,\n currency: quote.prices.grand_total.currency,\n },\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 },\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 configurableOptions: item.configurable_options?.map((option: any) => ({\n optionLabel: option.option_label,\n valueLabel: option.value_label,\n })),\n bundleOptions: item.bundle_options?.map((option: any) => ({\n label: option.label,\n values: option.values.map((value: any) => ({\n label: value.label,\n quantity: value.quantity,\n originalPrice: {\n value: value.original_price.value,\n currency: value.original_price.currency,\n },\n price: {\n value: value.priceV2.value,\n currency: value.priceV2.currency,\n },\n })),\n })),\n })) || [],\n canCheckout: ['UPDATED', 'DECLINED'].includes(quote.status) && state.permissions.checkoutQuote,\n canSendForReview: ['SUBMITTED', 'DRAFT', 'UPDATED', 'DECLINED', 'EXPIRED'].includes(quote.status) && state.permissions.editQuote,\n };\n}\n\nexport function transformQuote(quoteData: any): NegotiableQuoteModel | null {\n if (!quoteData) {\n return null;\n }\n\n return transformSingleQuote(quoteData);\n}\n\nfunction transformNegotiableQuoteListEntry(quote: any): NegotiableQuoteListEntry {\n return {\n uid: quote.uid,\n name: quote.name,\n createdAt: quote.created_at,\n updatedAt: quote.updated_at,\n status: quote.status,\n buyer: {\n firstname: quote.buyer.firstname,\n lastname: quote.buyer.lastname,\n },\n templateName: quote.template_name,\n prices: {\n grandTotal: {\n value: quote.prices.grand_total.value,\n currency: quote.prices.grand_total.currency,\n },\n },\n };\n}\n\nexport function transformNegotiableQuotesList(\n quotesData: any\n): NegotiableQuotesListModel | null {\n if (!quotesData) {\n return null;\n }\n\n const transformedModel = {\n items:\n quotesData.items\n ?.filter((quote: any) => quote?.uid)\n .map(transformNegotiableQuoteListEntry) || [],\n pageInfo: {\n currentPage: quotesData.page_info.current_page,\n pageSize: quotesData.page_info.page_size,\n totalPages: quotesData.page_info.total_pages,\n },\n totalCount: quotesData.total_count,\n sortFields: quotesData.sort_fields\n ? {\n default: quotesData.sort_fields.default,\n options: quotesData.sort_fields.options,\n }\n : undefined,\n };\n\n // Calculate pagination info\n const paginationInfo = transformPaginationInfo(transformedModel);\n\n return {\n ...transformedModel,\n paginationInfo: paginationInfo || undefined,\n };\n}\n\nexport function transformPaginationInfo(\n quotesData: NegotiableQuotesListModel | null\n): PaginationInfo | null {\n if (!quotesData?.pageInfo || !quotesData.totalCount) {\n return null;\n }\n\n const { currentPage, pageSize, totalPages } = quotesData.pageInfo;\n const { totalCount } = quotesData;\n\n const startItem = totalCount > 0 ? (currentPage - 1) * pageSize + 1 : 0;\n const endItem = Math.min(currentPage * pageSize, totalCount);\n\n const pageSizeOptions = [20, 30, 50, 100, 200]; // Default page size options\n\n return {\n currentPage,\n totalCount,\n pageSize,\n startItem,\n endItem,\n totalPages,\n pageSizeOptions,\n };\n}\n\n// TODO: Check if admin has this configuration\nexport const getDefaultPageSizeOptions = () => [20, 30, 50, 100, 200];\n"],"names":["DEFAULT_PERMISSIONS","_state","state","target","key","value","transformSingleQuote","quote","_a","_b","_c","comment","tax","item","_d","discount","option","transformQuote","quoteData","transformNegotiableQuoteListEntry","transformNegotiableQuotesList","quotesData","transformedModel","paginationInfo","transformPaginationInfo","currentPage","pageSize","totalPages","totalCount","startItem","endItem","getDefaultPageSizeOptions"],"mappings":"AAWO,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,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AIL,EAAcC,EAAUE,CAAU,EAI3D,MAAO,CACL,YAAAH,EACA,WAAAG,EACA,SAAAF,EACA,UAAAG,EACA,QAAAC,EACA,WAAAH,EACA,gBATsB,CAAC,GAAI,GAAI,GAAI,IAAK,GAAG,CAS3C,CAEJ,CAGO,MAAMI,EAA4B,IAAM,CAAC,GAAI,GAAI,GAAI,IAAK,GAAG"}
1
+ {"version":3,"file":"transform-quote.js","sources":["/@dropins/storefront-quote-management/src/lib/state.ts","/@dropins/storefront-quote-management/src/data/transforms/transform-quote.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 {\n NegotiableQuoteModel,\n NegotiableQuotesListModel,\n PaginationInfo,\n} from '@/quote-management/data/models/negotiable-quote-model';\n\n// Base helper that transforms a single quote object directly\nfunction transformSingleQuote(quote: any): NegotiableQuoteModel {\n return {\n uid: quote.uid,\n name: quote.name,\n createdAt: quote.created_at,\n updatedAt: quote.updated_at,\n status: quote.status,\n buyer: {\n firstname: quote.buyer.firstname,\n lastname: quote.buyer.lastname,\n },\n templateName: quote.template_name,\n comments: quote.comments?.map((comment: any) => ({\n uid: comment.uid,\n createdAt: comment.created_at,\n author: {\n firstname: comment.author.firstname,\n lastname: comment.author.lastname,\n },\n })),\n prices: quote.prices && {\n subtotalExcludingTax: quote.prices.subtotal_excluding_tax && {\n value: quote.prices.subtotal_excluding_tax.value,\n },\n subtotalIncludingTax: quote.prices.subtotal_including_tax && {\n value: quote.prices.subtotal_including_tax.value,\n },\n subtotalWithDiscountExcludingTax: quote.prices\n .subtotal_with_discount_excluding_tax && {\n value: quote.prices.subtotal_with_discount_excluding_tax.value,\n },\n grandTotal: quote.prices.grand_total && {\n value: quote.prices.grand_total.value,\n currency: quote.prices.grand_total.currency,\n },\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 templateId: item.product.template_id,\n templateName: item.product.template_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 })),\n };\n}\n\nexport function transformQuote(quoteData: any): NegotiableQuoteModel | null {\n if (!quoteData || !quoteData.data || !quoteData.data.requestNegotiableQuote) {\n return null;\n }\n\n const quote = quoteData.data.requestNegotiableQuote.quote;\n return transformSingleQuote(quote);\n}\n\nexport function transformNegotiableQuotesList(\n quotesData: any\n): NegotiableQuotesListModel | null {\n if (!quotesData) {\n return null;\n }\n\n const transformedModel = {\n items:\n quotesData.items\n ?.filter((quote: any) => quote?.uid)\n .map(transformSingleQuote) || [],\n pageInfo: {\n currentPage: quotesData.page_info.current_page,\n pageSize: quotesData.page_info.page_size,\n totalPages: quotesData.page_info.total_pages,\n },\n totalCount: quotesData.total_count,\n sortFields: quotesData.sort_fields\n ? {\n default: quotesData.sort_fields.default,\n options: quotesData.sort_fields.options,\n }\n : undefined,\n };\n\n // Calculate pagination info\n const paginationInfo = transformPaginationInfo(transformedModel);\n\n return {\n ...transformedModel,\n paginationInfo: paginationInfo || undefined,\n };\n}\n\nexport function transformPaginationInfo(\n quotesData: NegotiableQuotesListModel | null\n): PaginationInfo | null {\n if (!quotesData?.pageInfo || !quotesData.totalCount) {\n return null;\n }\n\n const { currentPage, pageSize, totalPages } = quotesData.pageInfo;\n const { totalCount } = quotesData;\n\n const startItem = totalCount > 0 ? (currentPage - 1) * pageSize + 1 : 0;\n const endItem = Math.min(currentPage * pageSize, totalCount);\n\n const pageSizeOptions = [20, 30, 50, 100, 200]; // Default page size options\n\n return {\n currentPage,\n totalCount,\n pageSize,\n startItem,\n endItem,\n totalPages,\n pageSizeOptions,\n };\n}\n\n// TODO: Check if admin has this configuration\nexport const getDefaultPageSizeOptions = () => [20, 30, 50, 100, 200];\n"],"names":["DEFAULT_PERMISSIONS","_state","state","target","key","value","transformSingleQuote","quote","_a","_b","comment","item","transformQuote","quoteData","transformNegotiableQuotesList","quotesData","transformedModel","paginationInfo","transformPaginationInfo","currentPage","pageSize","totalPages","totalCount","startItem","endItem","getDefaultPageSizeOptions"],"mappings":"AAWO,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,ECRD,SAASC,EAAqBC,EAAkC,CDZzD,IAAAC,EAAAC,ECaL,MAAO,CACL,IAAKF,EAAM,IACX,KAAMA,EAAM,KACZ,UAAWA,EAAM,WACjB,UAAWA,EAAM,WACjB,OAAQA,EAAM,OACd,MAAO,CACL,UAAWA,EAAM,MAAM,UACvB,SAAUA,EAAM,MAAM,QAAA,EAExB,aAAcA,EAAM,cACpB,UAAUC,EAAAD,EAAM,WAAN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SAAU,CACR,YAAaS,EAAW,UAAU,aAClC,SAAUA,EAAW,UAAU,UAC/B,WAAYA,EAAW,UAAU,WAAA,EAEnC,WAAYA,EAAW,YACvB,WAAYA,EAAW,YACnB,CACE,QAASA,EAAW,YAAY,QAChC,QAASA,EAAW,YAAY,OAAA,EAElC,MAAA,EAIAE,EAAiBC,EAAwBF,CAAgB,EAE/D,MAAO,CACL,GAAGA,EACH,eAAgBC,GAAkB,MAAA,CAEtC,CAEO,SAASC,EACdH,EACuB,CACvB,GAAI,EAACA,GAAA,MAAAA,EAAY,WAAY,CAACA,EAAW,WACvC,OAAO,KAGT,KAAM,CAAE,YAAAI,EAAa,SAAAC,EAAU,WAAAC,CAAA,EAAeN,EAAW,SACnD,CAAE,WAAAO,GAAeP,EAEjBQ,EAAYD,EAAa,GAAKH,EAAc,GAAKC,EAAW,EAAI,EAChEI,EAAU,KAAK,IAAIL,EAAcC,EAAUE,CAAU,EAI3D,MAAO,CACL,YAAAH,EACA,WAAAG,EACA,SAAAF,EACA,UAAAG,EACA,QAAAC,EACA,WAAAH,EACA,gBATsB,CAAC,GAAI,GAAI,GAAI,IAAK,GAAG,CAS3C,CAEJ,CAGO,MAAMI,EAA4B,IAAM,CAAC,GAAI,GAAI,GAAI,IAAK,GAAG"}
@@ -1,9 +1,3 @@
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';
8
2
  export * from './QuotesListTable';
9
3
  //# sourceMappingURL=index.d.ts.map
@@ -1,6 +1,6 @@
1
1
  import { HTMLAttributes } from 'preact/compat';
2
2
  import { Container, SlotProps } from '@dropins/tools/types/elsie/src/lib';
3
- import { NegotiableQuoteListEntry } from '../../data/models';
3
+ import { NegotiableQuoteModel } from '../../data/models';
4
4
 
5
5
  export interface QuotesListTableProps extends HTMLAttributes<HTMLDivElement> {
6
6
  pageSize?: number;
@@ -13,35 +13,35 @@ export interface QuotesListTableProps extends HTMLAttributes<HTMLDivElement> {
13
13
  slots?: {
14
14
  /** Slot for customizing the quote name cell content */
15
15
  QuoteName?: SlotProps<{
16
- quote: NegotiableQuoteListEntry;
16
+ quote: NegotiableQuoteModel;
17
17
  }>;
18
18
  /** Slot for customizing the created date cell content */
19
19
  Created?: SlotProps<{
20
- quote: NegotiableQuoteListEntry;
20
+ quote: NegotiableQuoteModel;
21
21
  }>;
22
22
  /** Slot for customizing the created by cell content */
23
23
  CreatedBy?: SlotProps<{
24
- quote: NegotiableQuoteListEntry;
24
+ quote: NegotiableQuoteModel;
25
25
  }>;
26
26
  /** Slot for customizing the status cell content */
27
27
  Status?: SlotProps<{
28
- quote: NegotiableQuoteListEntry;
28
+ quote: NegotiableQuoteModel;
29
29
  }>;
30
30
  /** Slot for customizing the last updated cell content */
31
31
  LastUpdated?: SlotProps<{
32
- quote: NegotiableQuoteListEntry;
32
+ quote: NegotiableQuoteModel;
33
33
  }>;
34
34
  /** Slot for customizing the quote template cell content */
35
35
  QuoteTemplate?: SlotProps<{
36
- quote: NegotiableQuoteListEntry;
36
+ quote: NegotiableQuoteModel;
37
37
  }>;
38
38
  /** Slot for customizing the quote total cell content */
39
39
  QuoteTotal?: SlotProps<{
40
- quote: NegotiableQuoteListEntry;
40
+ quote: NegotiableQuoteModel;
41
41
  }>;
42
42
  /** Slot for customizing the actions cell content */
43
43
  Actions?: SlotProps<{
44
- quote: NegotiableQuoteListEntry;
44
+ quote: NegotiableQuoteModel;
45
45
  onViewQuote?: (id: string, name: string, status: string) => void;
46
46
  }>;
47
47
  /** Slot for customizing the empty quotes message */
@@ -1,4 +1,4 @@
1
1
  /*! Copyright 2025 Adobe
2
2
  All Rights Reserved. */
3
- import{jsxs as P,jsx as t}from"@dropins/tools/preact-jsx-runtime.js";import{useState as Q,useEffect as $}from"@dropins/tools/preact-compat.js";import{classes as j,Slot as o}from"@dropins/tools/lib.js";import{Table as G,IllustratedMessage as H,Picker as J,Pagination as K,Button as W,Price as X}from"@dropins/tools/components.js";import{events as Y}from"@dropins/tools/event-bus.js";/* empty css *//* empty css */import"@dropins/tools/preact.js";/* empty css */import{useText as Z}from"@dropins/tools/i18n.js";import{g as V}from"../chunks/transform-quote.js";import"@dropins/tools/fetch-graphql.js";import{n as q}from"../chunks/negotiableQuotes.js";const ee=({rowData:h=[],loading:S=!1,className:N,emptyStateMessage:y,showItemRange:v=!0,itemRangeMessage:m,showPageSizePicker:u=!0,pageSizePickerMessage:i,showPagination:x=!0,paginationMessage:l,...b})=>{const d=Z({quoteName:"QuoteManagement.QuotesListTable.quoteName",created:"QuoteManagement.QuotesListTable.created",createdBy:"QuoteManagement.QuotesListTable.createdBy",status:"QuoteManagement.QuotesListTable.status",lastUpdated:"QuoteManagement.QuotesListTable.lastUpdated",quoteTemplate:"QuoteManagement.QuotesListTable.quoteTemplate",quoteTotal:"QuoteManagement.QuotesListTable.quoteTotal",actions:"QuoteManagement.QuotesListTable.actions"}),s=[{key:"quoteName",label:d.quoteName},{key:"created",label:d.created},{key:"createdBy",label:d.createdBy},{key:"status",label:d.status},{key:"lastUpdated",label:d.lastUpdated},{key:"quoteTemplate",label:d.quoteTemplate},{key:"quoteTotal",label:d.quoteTotal},{key:"actions",label:d.actions}],z=!S&&h.length===0&&y,p=v&&m,f=u&&i,g=x&&l,T=p||f||g;return P("div",{...b,className:j(["quote-management-quotes-list-table",N]),children:[t(G,{columns:s,rowData:h,loading:S,mobileLayout:"none",className:"quote-management-quotes-list-table__table"}),z&&t("div",{className:"quotes-list-table__empty-state",children:y}),T&&P("div",{className:"quotes-list-table__footer",children:[t("div",{className:"quotes-list-table__item-range",children:p&&m}),t("div",{className:"quotes-list-table__pagination",children:g&&l}),t("div",{className:"quotes-list-table__page-size-picker",children:f&&i})]})]})},ge=({pageSize:h,showItemRange:S=!0,showPageSizePicker:N=!0,showPagination:y=!0,onViewQuote:v,onPageSizeChange:m,onPageChange:u,slots:i,...x})=>{const[l,b]=Q(null),[d,s]=Q(!0),z=V()[0],[p,f]=Q(h||z),[g,T]=Q(1);$(()=>{const r=async()=>{try{s(!0);const c=await q({pageSize:p,currentPage:g});b(c)}catch(c){console.error("Failed to fetch quotes:",c)}finally{s(!1)}},e=Y.on("authenticated",c=>{c?r():(b(null),s(!1))},{eager:!0});return()=>{e==null||e.off()}},[p,g]);const k=r=>{f(r),T(1),m==null||m(r)},_=r=>{T(r),u==null||u(r)},A=r=>{const e=r.target,c=e==null?void 0:e.value;c&&k(Number(c))},U=(r,e,c)=>r.filter(a=>a==null?void 0:a.uid).map(a=>{var I,w,B,M;const F=`${a.buyer.firstname} ${a.buyer.lastname}`;return{id:a.uid,quoteName:t(o,{name:"QuoteName",slot:e==null?void 0:e.QuoteName,context:{quote:a},children:t("span",{children:a.name})}),created:t(o,{name:"Created",slot:e==null?void 0:e.Created,context:{quote:a},children:t("span",{children:a.createdAt?new Date(a.createdAt).toLocaleDateString():"N/A"})}),createdBy:t(o,{name:"CreatedBy",slot:e==null?void 0:e.CreatedBy,context:{quote:a},children:t("span",{children:F})}),status:t(o,{name:"Status",slot:e==null?void 0:e.Status,context:{quote:a},children:t("span",{children:a.status})}),lastUpdated:t(o,{name:"LastUpdated",slot:e==null?void 0:e.LastUpdated,context:{quote:a},children:t("span",{children:a.updatedAt?new Date(a.updatedAt).toLocaleDateString():"N/A"})}),quoteTemplate:t(o,{name:"QuoteTemplate",slot:e==null?void 0:e.QuoteTemplate,context:{quote:a},children:t("span",{children:a.templateName})}),quoteTotal:t(o,{name:"QuoteTotal",slot:e==null?void 0:e.QuoteTotal,context:{quote:a},children:t(X,{amount:(w=(I=a.prices)==null?void 0:I.grandTotal)==null?void 0:w.value,currency:(M=(B=a.prices)==null?void 0:B.grandTotal)==null?void 0:M.currency})}),actions:t(o,{name:"Actions",slot:e==null?void 0:e.Actions,context:{quote:a,onViewQuote:c},children:t(W,{variant:"tertiary",size:"medium",onClick:()=>c==null?void 0:c(a.uid,a.name,a.status),children:"View"})})}}),C=l!=null&&l.items?U(l.items,i,v):[],n=l==null?void 0:l.paginationInfo,L=!!n,O=t(o,{name:"EmptyQuotes",slot:i==null?void 0:i.EmptyQuotes,context:{quotesData:l},children:t(H,{heading:"No Quotes Found"})}),R=n?t(o,{name:"ItemRange",slot:i==null?void 0:i.ItemRange,context:n,children:P("span",{children:["Items ",n.startItem," to ",n.endItem," of"," ",n.totalCount," total"]})}):void 0,D=n&&n.pageSizeOptions?P(o,{name:"PageSizePicker",slot:i==null?void 0:i.PageSizePicker,context:{pageSize:n.pageSize,pageSizeOptions:n.pageSizeOptions,onPageSizeChange:k},children:[t("span",{children:"Show "}),t(J,{variant:"primary",size:"medium",value:String(n.pageSize),options:n.pageSizeOptions.map(r=>({value:String(r),text:String(r)})),handleSelect:A}),t("span",{children:" per page"})]}):void 0,E=n?t(o,{name:"Pagination",slot:i==null?void 0:i.Pagination,context:{currentPage:n.currentPage,totalPages:n.totalPages,onChange:_},children:t(K,{currentPage:n.currentPage,totalPages:n.totalPages,onChange:_})}):void 0;return t(ee,{rowData:C,loading:d,className:x.className,emptyStateMessage:O,showItemRange:S&&L,itemRangeMessage:R,showPageSizePicker:N&&L,pageSizePickerMessage:D,showPagination:y&&L,paginationMessage:E})};export{ge as QuotesListTable,ge as default};
3
+ import{jsxs as P,jsx as t}from"@dropins/tools/preact-jsx-runtime.js";import{useState as Q,useEffect as $}from"@dropins/tools/preact-compat.js";import{classes as j,Slot as o}from"@dropins/tools/lib.js";import{Table as G,IllustratedMessage as H,Picker as J,Pagination as K,Button as W,Price as X}from"@dropins/tools/components.js";import{events as Y}from"@dropins/tools/event-bus.js";/* empty css */import{useText as Z}from"@dropins/tools/i18n.js";import{g as V}from"../chunks/transform-quote.js";import"@dropins/tools/fetch-graphql.js";import{n as q}from"../chunks/negotiableQuotes.js";const ee=({rowData:h=[],loading:S=!1,className:N,emptyStateMessage:y,showItemRange:v=!0,itemRangeMessage:m,showPageSizePicker:u=!0,pageSizePickerMessage:i,showPagination:x=!0,paginationMessage:l,...b})=>{const d=Z({quoteName:"QuoteManagement.QuotesListTable.quoteName",created:"QuoteManagement.QuotesListTable.created",createdBy:"QuoteManagement.QuotesListTable.createdBy",status:"QuoteManagement.QuotesListTable.status",lastUpdated:"QuoteManagement.QuotesListTable.lastUpdated",quoteTemplate:"QuoteManagement.QuotesListTable.quoteTemplate",quoteTotal:"QuoteManagement.QuotesListTable.quoteTotal",actions:"QuoteManagement.QuotesListTable.actions"}),s=[{key:"quoteName",label:d.quoteName},{key:"created",label:d.created},{key:"createdBy",label:d.createdBy},{key:"status",label:d.status},{key:"lastUpdated",label:d.lastUpdated},{key:"quoteTemplate",label:d.quoteTemplate},{key:"quoteTotal",label:d.quoteTotal},{key:"actions",label:d.actions}],z=!S&&h.length===0&&y,p=v&&m,f=u&&i,g=x&&l,T=p||f||g;return P("div",{...b,className:j(["quote-management-quotes-list-table",N]),children:[t(G,{columns:s,rowData:h,loading:S,mobileLayout:"none",className:"quote-management-quotes-list-table__table"}),z&&t("div",{className:"quotes-list-table__empty-state",children:y}),T&&P("div",{className:"quotes-list-table__footer",children:[t("div",{className:"quotes-list-table__item-range",children:p&&m}),t("div",{className:"quotes-list-table__pagination",children:g&&l}),t("div",{className:"quotes-list-table__page-size-picker",children:f&&i})]})]})},ue=({pageSize:h,showItemRange:S=!0,showPageSizePicker:N=!0,showPagination:y=!0,onViewQuote:v,onPageSizeChange:m,onPageChange:u,slots:i,...x})=>{const[l,b]=Q(null),[d,s]=Q(!0),z=V()[0],[p,f]=Q(h||z),[g,T]=Q(1);$(()=>{const r=async()=>{try{s(!0);const c=await q({pageSize:p,currentPage:g});b(c)}catch(c){console.error("Failed to fetch quotes:",c)}finally{s(!1)}},e=Y.on("authenticated",c=>{c?r():(b(null),s(!1))},{eager:!0});return()=>{e==null||e.off()}},[p,g]);const k=r=>{f(r),T(1),m==null||m(r)},_=r=>{T(r),u==null||u(r)},A=r=>{const e=r.target,c=e==null?void 0:e.value;c&&k(Number(c))},U=(r,e,c)=>r.filter(a=>a==null?void 0:a.uid).map(a=>{var I,w,B,M;const F=`${a.buyer.firstname} ${a.buyer.lastname}`;return{id:a.uid,quoteName:t(o,{name:"QuoteName",slot:e==null?void 0:e.QuoteName,context:{quote:a},children:t("span",{children:a.name})}),created:t(o,{name:"Created",slot:e==null?void 0:e.Created,context:{quote:a},children:t("span",{children:a.createdAt?new Date(a.createdAt).toLocaleDateString():"N/A"})}),createdBy:t(o,{name:"CreatedBy",slot:e==null?void 0:e.CreatedBy,context:{quote:a},children:t("span",{children:F})}),status:t(o,{name:"Status",slot:e==null?void 0:e.Status,context:{quote:a},children:t("span",{children:a.status})}),lastUpdated:t(o,{name:"LastUpdated",slot:e==null?void 0:e.LastUpdated,context:{quote:a},children:t("span",{children:a.updatedAt?new Date(a.updatedAt).toLocaleDateString():"N/A"})}),quoteTemplate:t(o,{name:"QuoteTemplate",slot:e==null?void 0:e.QuoteTemplate,context:{quote:a},children:t("span",{children:a.templateName})}),quoteTotal:t(o,{name:"QuoteTotal",slot:e==null?void 0:e.QuoteTotal,context:{quote:a},children:t(X,{amount:(w=(I=a.prices)==null?void 0:I.grandTotal)==null?void 0:w.value,currency:(M=(B=a.prices)==null?void 0:B.grandTotal)==null?void 0:M.currency})}),actions:t(o,{name:"Actions",slot:e==null?void 0:e.Actions,context:{quote:a,onViewQuote:c},children:t(W,{variant:"tertiary",size:"medium",onClick:()=>c==null?void 0:c(a.uid,a.name,a.status),children:"View"})})}}),C=l!=null&&l.items?U(l.items,i,v):[],n=l==null?void 0:l.paginationInfo,L=!!n,O=t(o,{name:"EmptyQuotes",slot:i==null?void 0:i.EmptyQuotes,context:{quotesData:l},children:t(H,{heading:"No Quotes Found"})}),R=n?t(o,{name:"ItemRange",slot:i==null?void 0:i.ItemRange,context:n,children:P("span",{children:["Items ",n.startItem," to ",n.endItem," of"," ",n.totalCount," total"]})}):void 0,D=n&&n.pageSizeOptions?P(o,{name:"PageSizePicker",slot:i==null?void 0:i.PageSizePicker,context:{pageSize:n.pageSize,pageSizeOptions:n.pageSizeOptions,onPageSizeChange:k},children:[t("span",{children:"Show "}),t(J,{variant:"primary",size:"medium",value:String(n.pageSize),options:n.pageSizeOptions.map(r=>({value:String(r),text:String(r)})),handleSelect:A}),t("span",{children:" per page"})]}):void 0,E=n?t(o,{name:"Pagination",slot:i==null?void 0:i.Pagination,context:{currentPage:n.currentPage,totalPages:n.totalPages,onChange:_},children:t(K,{currentPage:n.currentPage,totalPages:n.totalPages,onChange:_})}):void 0;return t(ee,{rowData:C,loading:d,className:x.className,emptyStateMessage:O,showItemRange:S&&L,itemRangeMessage:R,showPageSizePicker:N&&L,pageSizePickerMessage:D,showPagination:y&&L,paginationMessage:E})};export{ue as QuotesListTable,ue as default};
4
4
  //# sourceMappingURL=QuotesListTable.js.map