@dropins/storefront-quote-management 0.0.1-alpha6 → 0.0.1-alpha9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/api/graphql/NegotiableQuoteFragment.d.ts +1 -1
- package/api/index.d.ts +0 -1
- package/api/initialize/initialize.d.ts +0 -1
- package/api/requestNegotiableQuote/requestNegotiableQuote.d.ts +6 -0
- package/api.js +4 -16
- package/api.js.map +1 -1
- package/chunks/requestNegotiableQuote.js +65 -100
- package/chunks/requestNegotiableQuote.js.map +1 -1
- package/components/index.d.ts +0 -6
- package/containers/RequestNegotiableQuoteForm/RequestNegotiableQuoteForm.d.ts +1 -0
- package/containers/RequestNegotiableQuoteForm.js +1 -1
- package/containers/RequestNegotiableQuoteForm.js.map +1 -1
- package/containers/index.d.ts +0 -2
- package/data/models/customer-model.d.ts +0 -1
- package/data/models/negotiable-quote-model.d.ts +24 -30
- package/data/transforms/__fixtures__/negotiableQuoteData.d.ts +48 -102
- package/data/transforms/transform-quote.d.ts +1 -1
- package/i18n/en_US.json.d.ts +0 -54
- package/lib/state.d.ts +0 -1
- package/package.json +1 -1
- package/render.js +2 -4
- package/render.js.map +1 -1
- package/types/state.types.d.ts +0 -1
- package/api/getQuoteData/getQuoteData.d.ts +0 -10
- package/api/getQuoteData/graphql/QuoteDataQuery.d.ts +0 -2
- package/api/getQuoteData/index.d.ts +0 -10
- package/chunks/RequestNegotiableQuoteForm.js +0 -4
- package/chunks/RequestNegotiableQuoteForm.js.map +0 -1
- package/components/ActionsBar/ActionsBar.d.ts +0 -14
- package/components/ActionsBar/index.d.ts +0 -11
- package/components/ItemsQuoted/ItemsQuoted.d.ts +0 -11
- package/components/ItemsQuoted/index.d.ts +0 -11
- package/components/ManageNegotiableQuote/ManageNegotiableQuote.d.ts +0 -20
- package/components/ManageNegotiableQuote/__fixtures__/ManageNegotiableQuoteProps.d.ts +0 -4
- package/components/ManageNegotiableQuote/index.d.ts +0 -11
- package/components/ProductListTable/ProductListTable.d.ts +0 -13
- package/components/ProductListTable/index.d.ts +0 -11
- package/components/QuotePricesSummary/QuotePricesSummary.d.ts +0 -16
- package/components/QuotePricesSummary/index.d.ts +0 -11
- package/components/TabbedContent/TabbedContent.d.ts +0 -10
- package/components/TabbedContent/index.d.ts +0 -11
- package/containers/ItemsQuoted/ItemsQuoted.d.ts +0 -25
- package/containers/ItemsQuoted/index.d.ts +0 -11
- package/containers/ItemsQuoted.d.ts +0 -3
- package/containers/ItemsQuoted.js +0 -4
- package/containers/ItemsQuoted.js.map +0 -1
- package/containers/ManageNegotiableQuote/ManageNegotiableQuote.d.ts +0 -48
- package/containers/ManageNegotiableQuote/index.d.ts +0 -11
- package/containers/ManageNegotiableQuote.d.ts +0 -3
- package/containers/ManageNegotiableQuote.js +0 -4
- package/containers/ManageNegotiableQuote.js.map +0 -1
- package/data/models/__fixtures__/negotiableQuoteModel.d.ts +0 -4
|
@@ -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
|
|
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 attachments {\n name\n url\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";
|
|
18
18
|
//# sourceMappingURL=NegotiableQuoteFragment.d.ts.map
|
package/api/index.d.ts
CHANGED
|
@@ -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>;
|
|
@@ -5,6 +5,12 @@ export interface RequestNegotiableQuoteInput {
|
|
|
5
5
|
quoteName: string;
|
|
6
6
|
comment: string;
|
|
7
7
|
isDraft?: boolean;
|
|
8
|
+
attachments?: {
|
|
9
|
+
key: string;
|
|
10
|
+
}[];
|
|
8
11
|
}
|
|
9
12
|
export declare const requestNegotiableQuote: (input: RequestNegotiableQuoteInput) => Promise<NegotiableQuoteModel | null>;
|
|
13
|
+
export declare const uploadFile: (file: File) => Promise<{
|
|
14
|
+
key: string;
|
|
15
|
+
}>;
|
|
10
16
|
//# sourceMappingURL=requestNegotiableQuote.d.ts.map
|
package/api.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/*! Copyright 2025 Adobe
|
|
2
2
|
All Rights Reserved. */
|
|
3
|
-
import{D as
|
|
3
|
+
import{D as s,s as o}from"./chunks/requestNegotiableQuote.js";import{r as P,u as G}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=`
|
|
4
4
|
fragment CUSTOMER_FRAGMENT on Customer {
|
|
5
5
|
role {
|
|
6
6
|
permissions {
|
|
@@ -17,25 +17,13 @@ import{D as i,s as r,N as l,t as Q}from"./chunks/requestNegotiableQuote.js";impo
|
|
|
17
17
|
}
|
|
18
18
|
}
|
|
19
19
|
}
|
|
20
|
-
`,
|
|
20
|
+
`,Q=`
|
|
21
21
|
query CUSTOMER_QUERY {
|
|
22
22
|
customer {
|
|
23
23
|
...CUSTOMER_FRAGMENT
|
|
24
24
|
}
|
|
25
25
|
}
|
|
26
26
|
|
|
27
|
-
${
|
|
28
|
-
`,
|
|
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};
|
|
27
|
+
${E}
|
|
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})]}),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,P as requestNegotiableQuote,N as setEndpoint,O as setFetchGraphQlHeader,I as setFetchGraphQlHeaders,G as uploadFile};
|
|
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 },\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","setFetchGra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Aa,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"}
|
|
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":"oSAAO,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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,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,116 +1,59 @@
|
|
|
1
1
|
/*! Copyright 2025 Adobe
|
|
2
2
|
All Rights Reserved. */
|
|
3
|
-
import{fetchGraphQl as
|
|
4
|
-
fragment NegotiableQuoteFragment on
|
|
5
|
-
|
|
6
|
-
name
|
|
7
|
-
created_at
|
|
8
|
-
status
|
|
9
|
-
sales_rep_name
|
|
10
|
-
expiration_date
|
|
11
|
-
buyer {
|
|
12
|
-
firstname
|
|
13
|
-
lastname
|
|
14
|
-
}
|
|
15
|
-
comments {
|
|
3
|
+
import{fetchGraphQl as g}from"@dropins/tools/fetch-graphql.js";import{events as h}from"@dropins/tools/event-bus.js";const f={requestQuote:!1,editQuote:!1,deleteQuote:!1},w={authenticated:!1,permissions:f},x=new Proxy(w,{get:(a,t)=>a[t],set:(a,t,e)=>(a[t]=e,!0)});function N(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=>{const o={uid:e.uid,createdAt:e.created_at,author:e.author};return Array.isArray(e.attachments)&&e.attachments.length>0&&(o.attachments=e.attachments.map(u=>({name:u.name,url:u.url}))),o}),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 q=`
|
|
4
|
+
fragment NegotiableQuoteFragment on RequestNegotiableQuoteOutput {
|
|
5
|
+
quote {
|
|
16
6
|
uid
|
|
17
7
|
created_at
|
|
18
|
-
|
|
8
|
+
status
|
|
9
|
+
buyer {
|
|
19
10
|
firstname
|
|
20
11
|
lastname
|
|
21
12
|
}
|
|
22
|
-
|
|
23
|
-
}
|
|
24
|
-
items {
|
|
25
|
-
product {
|
|
26
|
-
name
|
|
27
|
-
sku
|
|
13
|
+
comments {
|
|
28
14
|
uid
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
15
|
+
created_at
|
|
16
|
+
author {
|
|
17
|
+
firstname
|
|
18
|
+
lastname
|
|
19
|
+
}
|
|
20
|
+
attachments {
|
|
21
|
+
name
|
|
22
|
+
url
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
items {
|
|
26
|
+
product {
|
|
27
|
+
uid
|
|
28
|
+
sku
|
|
29
|
+
name
|
|
30
|
+
price_range {
|
|
31
|
+
maximum_price {
|
|
32
|
+
regular_price {
|
|
33
|
+
value
|
|
34
|
+
}
|
|
35
35
|
}
|
|
36
36
|
}
|
|
37
37
|
}
|
|
38
|
+
quantity
|
|
38
39
|
}
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
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
|
|
40
|
+
prices {
|
|
41
|
+
subtotal_excluding_tax {
|
|
42
|
+
value
|
|
82
43
|
}
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
44
|
+
subtotal_including_tax {
|
|
45
|
+
value
|
|
46
|
+
}
|
|
47
|
+
subtotal_with_discount_excluding_tax {
|
|
48
|
+
value
|
|
88
49
|
}
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
old_expiration
|
|
50
|
+
grand_total {
|
|
51
|
+
value
|
|
92
52
|
}
|
|
93
53
|
}
|
|
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
|
-
}
|
|
111
54
|
}
|
|
112
55
|
}
|
|
113
|
-
`,
|
|
56
|
+
`,b=`
|
|
114
57
|
mutation REQUEST_NEGOTIABLE_QUOTE_MUTATION(
|
|
115
58
|
$cartId: ID!
|
|
116
59
|
$quoteName: String!
|
|
@@ -125,11 +68,33 @@ import{fetchGraphQl as _}from"@dropins/tools/fetch-graphql.js";import{events as
|
|
|
125
68
|
is_draft: $isDraft
|
|
126
69
|
}
|
|
127
70
|
) {
|
|
128
|
-
|
|
129
|
-
...NegotiableQuoteFragment
|
|
130
|
-
}
|
|
71
|
+
...NegotiableQuoteFragment
|
|
131
72
|
}
|
|
132
73
|
}
|
|
133
|
-
${
|
|
134
|
-
`,
|
|
74
|
+
${q}
|
|
75
|
+
`,y=async a=>{const{cartId:t,quoteName:e,comment:o,attachments:u,isDraft:i}=a;if(!t)throw new Error("Cart ID is required");if(!e)throw new Error("Quote name is required");if(!o)throw new Error("Comment is required");return g(b,{variables:{cartId:t,quoteName:e,comment:u!=null&&u.length?{comment:o,attachments:u}:{comment:o},isDraft:i}}).then(l=>{const{errors:r}=l;if(r){const c=r.map(d=>d.message).join("; ");throw new Error(`Failed to request negotiable quote: ${c}`)}const n=N(l);if(!n)throw new Error("Failed to transform quote data: Invalid response structure");return h.emit("quote-management/negotiable-quote-requested",{quote:n,input:{cartId:t,quoteName:e,comment:o,attachments:u,isDraft:i}}),n})},v=async a=>{var i,l;const t=a==null?void 0:a.name;if(!a||!t)throw new Error("Invalid file");const e="NEGOTIABLE_QUOTE_ATTACHMENT",o=`
|
|
76
|
+
mutation INITIATE_UPLOAD_MUTATION(
|
|
77
|
+
$input: initiateUploadInput!
|
|
78
|
+
){
|
|
79
|
+
initiateUpload(
|
|
80
|
+
input: $input
|
|
81
|
+
){
|
|
82
|
+
upload_url
|
|
83
|
+
key
|
|
84
|
+
expires_at
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
`,u=`
|
|
88
|
+
mutation FINISH_UPLOAD_MUTATION(
|
|
89
|
+
$input: finishUploadInput!
|
|
90
|
+
){
|
|
91
|
+
finishUpload(
|
|
92
|
+
input: $input
|
|
93
|
+
){
|
|
94
|
+
success
|
|
95
|
+
key
|
|
96
|
+
message
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
`;try{const{data:r,errors:n}=await g(o,{variables:{input:{key:t,media_resource_type:e}}});if(n!=null&&n.length)throw new Error(n.map(s=>s==null?void 0:s.message).join("; "));const{upload_url:c,key:d}=(r==null?void 0:r.initiateUpload)||{};if(!c||!d)throw new Error("Failed to initiate upload");const p=await fetch(c,{method:"PUT",body:a});if(!p.ok)throw new Error(`Upload failed: ${p.status} ${p.statusText}`);const{data:_,errors:m}=await g(u,{variables:{input:{key:d,media_resource_type:e}}});if(m!=null&&m.length)throw new Error(m.map(s=>s==null?void 0:s.message).join("; "));const{success:E,key:T,message:I}=(_==null?void 0:_.finishUpload)||{};if(!E||!T)throw new Error(I||"Failed to finish upload");return{key:T}}catch(r){try{(l=(i=h)==null?void 0:i.emit)==null||l.call(i,"quote-management/file-upload-error",{error:(r==null?void 0:r.message)||"File upload failed",fileName:a==null?void 0:a.name})}catch{}throw r instanceof Error?r:new Error("File upload failed")}};export{f as D,y as r,x as s,v as u};
|
|
135
100
|
//# 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 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","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;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,QAAAX,EAAS,QAAAY,GAAYH,EAEhD,GAAI,CAACC,EACH,MAAM,IAAI,MAAM,qBAAqB,EAGvC,GAAI,CAACC,EACH,MAAM,IAAI,MAAM,wBAAwB,EAG1C,GAAI,CAACX,EACH,MAAM,IAAI,MAAM,qBAAqB,EAGvC,OAAOa,EAAaN,EAAmC,CACrD,UAAW,CACT,OAAAG,EACA,UAAAC,EACA,QAAS,CACP,QAAAX,CAAA,EAEF,QAAAY,CAAA,CACF,CACD,EAAE,KAAME,GAAa,SACpB,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,MAAMjB,EAAYD,GAAeI,GAAAC,EAAAW,EAAS,OAAT,YAAAX,EAAe,yBAAf,YAAAD,EAAuC,KAAK,EAE7E,GAAI,CAACH,EACH,MAAM,IAAI,MACR,4DAAA,EAKJ,OAAAmB,EAAO,KAAK,8CAA+C,CACzD,MAAOnB,EACP,MAAO,CAAE,OAAAW,EAAQ,UAAAC,EAAW,QAAAX,EAAS,QAAAY,CAAA,CAAQ,CAC9C,EAEMb,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};\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 const baseComment: any = {\n uid: comment.uid,\n createdAt: comment.created_at,\n author: comment.author,\n };\n\n if (Array.isArray(comment.attachments) && comment.attachments.length > 0) {\n baseComment.attachments = comment.attachments.map((a: any) => ({\n name: a.name,\n url: a.url,\n }));\n }\n\n return baseComment;\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 attachments {\n name\n url\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 attachments?: { key: string }[];\n}\n\nexport const requestNegotiableQuote = async (\n input: RequestNegotiableQuoteInput\n): Promise<NegotiableQuoteModel | null> => {\n const { cartId, quoteName, comment, attachments, 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: attachments?.length ? { comment, attachments } : { comment },\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, attachments, isDraft },\n });\n\n return quoteData;\n });\n};\n\nexport const uploadFile = async (file: File): Promise<{ key: string }> => {\n const filename = file?.name;\n if (!file || !filename) throw new Error('Invalid file');\n\n const media_resource_type = 'NEGOTIABLE_QUOTE_ATTACHMENT';\n\n const INITIATE_UPLOAD_MUTATION = `\n mutation INITIATE_UPLOAD_MUTATION(\n $input: initiateUploadInput!\n ){\n initiateUpload(\n input: $input\n ){\n upload_url\n key\n expires_at\n }\n }\n `;\n\n const FINISH_UPLOAD_MUTATION = `\n mutation FINISH_UPLOAD_MUTATION(\n $input: finishUploadInput!\n ){\n finishUpload(\n input: $input\n ){\n success\n key\n message\n }\n }\n `;\n\n try {\n const { data: initialData, errors: initialErrors }: any = await fetchGraphQl(INITIATE_UPLOAD_MUTATION, {\n variables: { input: { key: filename, media_resource_type } },\n });\n if (initialErrors?.length) throw new Error(initialErrors.map((e: any) => e?.message).join('; '));\n\n const { upload_url, key } = initialData?.initiateUpload || {};\n if (!upload_url || !key) throw new Error('Failed to initiate upload');\n\n const put = await fetch(upload_url, { method: 'PUT', body: file });\n if (!put.ok) throw new Error(`Upload failed: ${put.status} ${put.statusText}`);\n\n const { data: finishData, errors: finishErrors }: any = await fetchGraphQl(FINISH_UPLOAD_MUTATION, {\n variables: { input: { key, media_resource_type } },\n });\n if (finishErrors?.length) throw new Error(finishErrors.map((e: any) => e?.message).join('; '));\n\n const { success, key: finalizedKey, message } = finishData?.finishUpload || {};\n if (!success || !finalizedKey) throw new Error(message || 'Failed to finish upload');\n\n return { key: finalizedKey };\n } catch (err: any) {\n try {\n (events as any)?.emit?.('quote-management/file-upload-error', {\n error: err?.message || 'File upload failed',\n fileName: file?.name,\n });\n } catch {}\n throw err instanceof Error ? err : new Error('File upload failed');\n }\n};\n"],"names":["DEFAULT_PERMISSIONS","_state","state","target","key","value","transformQuote","response","quote","comment","baseComment","a","item","NEGOTIABLE_QUOTE_FRAGMENT","REQUEST_NEGOTIABLE_QUOTE_MUTATION","requestNegotiableQuote","input","cartId","quoteName","attachments","isDraft","fetchGraphQl","errors","errorMessages","error","quoteData","events","uploadFile","file","filename","media_resource_type","INITIATE_UPLOAD_MUTATION","FINISH_UPLOAD_MUTATION","initialData","initialErrors","e","upload_url","put","finishData","finishErrors","success","finalizedKey","message","err","_b","_a"],"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,OACd,MAAOA,EAAM,MACb,SAAUA,EAAM,SAAS,IAAKC,GAAiB,CAC7C,MAAMC,EAAmB,CACvB,IAAKD,EAAQ,IACb,UAAWA,EAAQ,WACnB,OAAQA,EAAQ,MAAA,EAGlB,OAAI,MAAM,QAAQA,EAAQ,WAAW,GAAKA,EAAQ,YAAY,OAAS,IACrEC,EAAY,YAAcD,EAAQ,YAAY,IAAKE,IAAY,C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
|
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
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -15,6 +15,7 @@ export type RequestNegotiableQuoteHandlers = {
|
|
|
15
15
|
};
|
|
16
16
|
export interface RequestNegotiableQuoteFormProps extends Omit<HTMLAttributes<HTMLDivElement>, 'onError'>, RequestNegotiableQuoteHandlers {
|
|
17
17
|
cartId: string;
|
|
18
|
+
enableFileUpload?: boolean;
|
|
18
19
|
slots?: {
|
|
19
20
|
ErrorBanner?: SlotProps<{
|
|
20
21
|
message: string;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
/*! Copyright 2025 Adobe
|
|
2
2
|
All Rights Reserved. */
|
|
3
|
-
import{jsxs as
|
|
3
|
+
import{jsxs as P,jsx as a}from"@dropins/tools/preact-jsx-runtime.js";import*as c from"@dropins/tools/preact-compat.js";import{useState as g,useEffect as R,useCallback as oe}from"@dropins/tools/preact-compat.js";import{classes as u,VComponent as h,Slot as q,getFormErrors as j,getFormValues as ne}from"@dropins/tools/lib.js";import{TextArea as ie,Field as ce,Input as se,InputFile as ue,Button as z,InLineAlert as me}from"@dropins/tools/components.js";import{events as I}from"@dropins/tools/event-bus.js";import{u as de,r as w}from"../chunks/requestNegotiableQuote.js";import{useText as le}from"@dropins/tools/i18n.js";import"@dropins/tools/fetch-graphql.js";const fe=i=>c.createElement("svg",{id:"Icon_Add_Base","data-name":"Icon \\u2013 Add \\u2013 Base",xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",...i},c.createElement("g",{id:"Large"},c.createElement("rect",{id:"Placement_area","data-name":"Placement area",width:24,height:24,fill:"#fff",opacity:0}),c.createElement("g",{id:"Add_icon","data-name":"Add icon",transform:"translate(9.734 9.737)"},c.createElement("line",{vectorEffect:"non-scaling-stroke",id:"Line_579","data-name":"Line 579",y2:12.7,transform:"translate(2.216 -4.087)",fill:"none",stroke:"currentColor"}),c.createElement("line",{vectorEffect:"non-scaling-stroke",id:"Line_580","data-name":"Line 580",x2:12.7,transform:"translate(-4.079 2.263)",fill:"none",stroke:"currentColor"})))),ge=i=>c.createElement("svg",{width:24,height:24,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",...i},c.createElement("path",{vectorEffect:"non-scaling-stroke",d:"M0.75 12C0.75 5.78421 5.78421 0.75 12 0.75C18.2158 0.75 23.25 5.78421 23.25 12C23.25 18.2158 18.2158 23.25 12 23.25C5.78421 23.25 0.75 18.2158 0.75 12Z",stroke:"currentColor"}),c.createElement("path",{vectorEffect:"non-scaling-stroke",d:"M6.75 12.762L10.2385 15.75L17.25 9",stroke:"currentColor"})),he=i=>c.createElement("svg",{width:24,height:24,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",...i},c.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"})),qe=({className:i,title:C,banner:e,commentField:_,quoteNameField:F,attachFile:N,requestButton:s,saveButton:d,onSubmit:E,...x})=>P("form",{...x,className:u(["request-negotiable-quote-form",i]),onSubmit:E,children:[e&&a(h,{node:e,className:u(["request-negotiable-quote-form__banner"])}),C&&a(h,{node:C,className:u(["request-negotiable-quote-form__title"])}),_&&a(h,{node:_,className:u(["request-negotiable-quote-form__comment-field"])}),F&&a(h,{node:F,className:u(["request-negotiable-quote-form__quote-name-field"])}),N&&a(h,{node:N,className:u(["request-negotiable-quote-form__attach-file-field"])}),P("div",{className:u(["request-negotiable-quote-form__actions"]),children:[s&&a(h,{node:s,className:u(["request-negotiable-quote-form__request-button"])}),d&&a(h,{node:d,className:u(["request-negotiable-quote-form__save-button"])})]})]}),Qe=({cartId:i,enableFileUpload:C=!0,slots:e,onRequestNegotiableQuote:_,onSaveNegotiableQuote:F,onAttachFiles:N,onSubmitErrors:s,onError:d,className:E})=>{const[x,Z]=g(void 0),[A,T]=g(void 0),[K,O]=g([]),[b,v]=g(void 0),[m,l]=g({}),[y,W]=g(void 0),[n,f]=g(!1),o=le({title:"NegotiableQuote.Request.title",comment:"NegotiableQuote.Request.comment",commentError:"NegotiableQuote.Request.commentError",quoteName:"NegotiableQuote.Request.quoteName",quoteNameError:"NegotiableQuote.Request.quoteNameError",attachmentsError:"NegotiableQuote.Request.attachmentsError",requestCta:"NegotiableQuote.Request.requestCta",saveDraftCta:"NegotiableQuote.Request.saveDraftCta",errorHeader:"NegotiableQuote.Request.error.header",unauthenticated:"NegotiableQuote.Request.error.unauthenticated",unauthorized:"NegotiableQuote.Request.error.unauthorized",missingCart:"NegotiableQuote.Request.error.missingCart",successHeader:"NegotiableQuote.Request.success.header",submitSuccess:"NegotiableQuote.Request.success.submitted",draftSuccess:"NegotiableQuote.Request.success.draftSaved"});R(()=>{const t=I.on("quote-management/permissions",r=>{v(void 0),r.requestQuote||(v(o.unauthorized),f(!0))},{eager:!0});return()=>t==null?void 0:t.off()},[o.unauthorized]),R(()=>{const t=I.on("authenticated",r=>{v(void 0),r||(v(o.unauthenticated),f(!0))},{eager:!0});return()=>t==null?void 0:t.off()},[o.unauthenticated]),R(()=>{i||(v(o.missingCart),f(!0))},[i,o.missingCart]),R(()=>{b&&(d==null||d({error:b,isFormDisabled:n,setIsFormDisabled:f}))},[b,d,n]);const H=oe(async t=>{if(t!=null&&t.length){if(l(r=>({...r,attachments:""})),N){try{await N(t)}catch{l(r=>({...r,attachments:o.attachmentsError}))}return}try{const r=await Promise.all(t.map(de));O(r.map(({key:p})=>({key:p})))}catch{l(r=>({...r,attachments:o.attachmentsError}))}}},[N,o]),$=()=>{let t,r;if(y?(r={name:"SuccessBanner",slot:e==null?void 0:e.SuccessBanner,context:{message:y},"data-testid":"form-success-banner"},t={type:"success",variant:"primary",icon:a(ge,{}),heading:o.successHeader,description:y,className:"request-negotiable-quote-form__success-banner"}):b&&(r={name:"ErrorBanner",slot:e==null?void 0:e.ErrorBanner,context:{message:b},"data-testid":"form-error-banner"},t={type:"error",variant:"primary",icon:a(he,{}),heading:o.errorHeader,description:b,className:"request-negotiable-quote-form__error-banner"}),r&&t)return a(q,{...r,children:a(me,{...t})})},D=t=>{l({});const r=t.target.closest("form"),p=j(r);Object.keys(p).length>0&&(l(p),s==null||s(p))},G=t=>{var V;t.preventDefault(),f(!0);const r=t.target,M={...j(r),...m};if(Object.keys(M).length>0){s==null||s(M);return}const B=t.submitter,Q=ne(r);Z(Q.comment),T(Q.quoteName);const S=((V=B==null?void 0:B.dataset)==null?void 0:V.draft)==="true"||!1,ae={cartId:i,quoteName:Q.quoteName,comment:Q.comment,attachments:C?K:void 0,isDraft:S};let k,L;S?(k=F??w,L=o.draftSuccess):(k=_??w,L=o.submitSuccess),k(ae).then(()=>{W(L)}).catch(re=>{v(re.message)})},J=a(q,{name:"Title",slot:e==null?void 0:e.Title,context:{text:o.title},children:a("span",{"data-testid":"form-title",children:o.title})}),X=a(q,{name:"CommentField",slot:e==null?void 0:e.CommentField,context:{value:x,required:!0,errorMessage:m.comment,setFormErrors:l,isFormDisabled:n},children:a(ie,{name:"comment",value:x,label:o.comment,required:!0,autoComplete:"off","data-testid":"form-comment-field",errorMessage:m.comment,disabled:n})}),Y=a(q,{name:"QuoteNameField",slot:e==null?void 0:e.QuoteNameField,context:{value:A,required:!0,errorMessage:m.quoteName,setFormErrors:l,isFormDisabled:n},children:a(ce,{error:m.quoteName,disabled:n,children:a(se,{value:A,name:"quoteName",floatingLabel:o.quoteName,required:!0,autoComplete:"off","data-testid":"form-quote-name-field"})})}),U=C?a(q,{name:"AttachFileField",slot:e==null?void 0:e.AttachFileField,context:{onChange:H,formErrors:m,isFormDisabled:n},children:a(ue,{onChange:t=>{const r=Array.from(t.target.files);r.length>0&&H(r)},icon:a(fe,{}),disabled:n,"data-testid":"form-attach-file-field"})}):void 0,ee=a(q,{name:"RequestButton",slot:e==null?void 0:e.RequestButton,context:{requestNegotiableQuote:w,formErrors:m,isFormDisabled:n,setIsFormDisabled:f},children:a(z,{type:"submit","data-testid":"form-request-button",onClick:D,disabled:n,children:o.requestCta})}),te=a(q,{name:"SaveDraftButton",slot:e==null?void 0:e.SaveDraftButton,context:{requestNegotiableQuote:w,formErrors:m,isFormDisabled:n,setIsFormDisabled:f},children:a(z,{type:"submit","data-draft":"true",variant:"secondary","data-testid":"form-save-draft-button",onClick:D,disabled:n,children:o.saveDraftCta})});return a(qe,{title:J,banner:$(),commentField:X,quoteNameField:Y,attachFile:U,requestButton:ee,saveButton:te,onSubmit:G,className:E,disabled:n,"data-testid":"form-container"})};export{Qe as RequestNegotiableQuoteForm,Qe as default};
|
|
4
4
|
//# sourceMappingURL=RequestNegotiableQuoteForm.js.map
|