@dropins/storefront-quote-management 0.0.1-alpha3 → 0.0.1-alpha5
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/getQuoteData/getQuoteData.d.ts +10 -0
- package/api/getQuoteData/graphql/QuoteDataQuery.d.ts +2 -0
- package/api/getQuoteData/index.d.ts +10 -0
- package/api/graphql/NegotiableQuoteFragment.d.ts +1 -1
- package/api/index.d.ts +1 -0
- package/api/initialize/initialize.d.ts +1 -0
- package/api.js +16 -4
- package/api.js.map +1 -1
- package/chunks/RequestNegotiableQuoteForm.js +4 -0
- package/chunks/RequestNegotiableQuoteForm.js.map +1 -0
- package/chunks/requestNegotiableQuote.js +98 -37
- package/chunks/requestNegotiableQuote.js.map +1 -1
- package/components/ActionsBar/ActionsBar.d.ts +14 -0
- package/components/ActionsBar/index.d.ts +11 -0
- package/components/ItemsQuoted/ItemsQuoted.d.ts +9 -0
- package/components/ItemsQuoted/index.d.ts +11 -0
- package/components/ManageNegotiableQuote/ManageNegotiableQuote.d.ts +18 -0
- package/components/ManageNegotiableQuote/__fixtures__/ManageNegotiableQuoteProps.d.ts +4 -0
- package/components/ManageNegotiableQuote/index.d.ts +11 -0
- package/components/ProductListTable/ProductListTable.d.ts +13 -0
- package/components/ProductListTable/index.d.ts +11 -0
- package/components/QuotePricesSummary/QuotePricesSummary.d.ts +16 -0
- package/components/QuotePricesSummary/index.d.ts +11 -0
- package/components/TabbedContent/TabbedContent.d.ts +10 -0
- package/components/TabbedContent/index.d.ts +11 -0
- package/components/index.d.ts +6 -0
- package/containers/ItemsQuoted/ItemsQuoted.d.ts +25 -0
- package/containers/ItemsQuoted/index.d.ts +11 -0
- package/containers/ItemsQuoted.d.ts +3 -0
- package/containers/ItemsQuoted.js +4 -0
- package/containers/ItemsQuoted.js.map +1 -0
- package/containers/ManageNegotiableQuote/ManageNegotiableQuote.d.ts +48 -0
- package/containers/ManageNegotiableQuote/index.d.ts +11 -0
- package/containers/ManageNegotiableQuote.d.ts +3 -0
- package/containers/ManageNegotiableQuote.js +4 -0
- package/containers/ManageNegotiableQuote.js.map +1 -0
- package/containers/RequestNegotiableQuoteForm.js +1 -1
- package/containers/RequestNegotiableQuoteForm.js.map +1 -1
- package/containers/index.d.ts +2 -0
- package/data/models/__fixtures__/negotiableQuoteModel.d.ts +4 -0
- package/data/models/customer-model.d.ts +1 -0
- package/data/models/negotiable-quote-model.d.ts +28 -20
- package/data/transforms/__fixtures__/negotiableQuoteData.d.ts +100 -48
- package/data/transforms/transform-quote.d.ts +1 -1
- package/i18n/en_US.json.d.ts +54 -0
- package/lib/state.d.ts +1 -0
- package/package.json +1 -1
- package/render.js +4 -2
- package/render.js.map +1 -1
- package/types/state.types.d.ts +1 -0
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/********************************************************************
|
|
2
|
+
* Copyright 2025 Adobe
|
|
3
|
+
* All Rights Reserved.
|
|
4
|
+
*
|
|
5
|
+
* NOTICE: Adobe permits you to use, modify, and distribute this
|
|
6
|
+
* file in accordance with the terms of the Adobe license agreement
|
|
7
|
+
* accompanying it.
|
|
8
|
+
*******************************************************************/
|
|
9
|
+
export declare const getQuoteData: (quoteId: string) => Promise<import('../../data/models/negotiable-quote-model').NegotiableQuoteModel>;
|
|
10
|
+
//# sourceMappingURL=getQuoteData.d.ts.map
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/********************************************************************
|
|
2
|
+
* Copyright 2025 Adobe
|
|
3
|
+
* All Rights Reserved.
|
|
4
|
+
*
|
|
5
|
+
* NOTICE: Adobe permits you to use, modify, and distribute this
|
|
6
|
+
* file in accordance with the terms of the Adobe license agreement
|
|
7
|
+
* accompanying it.
|
|
8
|
+
*******************************************************************/
|
|
9
|
+
export * from './getQuoteData';
|
|
10
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -14,5 +14,5 @@
|
|
|
14
14
|
* is strictly forbidden unless prior written permission is obtained
|
|
15
15
|
* from Adobe.
|
|
16
16
|
*******************************************************************/
|
|
17
|
-
export declare const NEGOTIABLE_QUOTE_FRAGMENT = "\n fragment NegotiableQuoteFragment on
|
|
17
|
+
export declare const NEGOTIABLE_QUOTE_FRAGMENT = "\n fragment NegotiableQuoteFragment on NegotiableQuote {\n uid\n\t\tname\n\t\tcreated_at\n status\n\t\tbuyer {\n\t\t\tfirstname\n\t\t\tlastname\n\t\t}\n\t\tcomments {\n uid\n created_at\n author {\n firstname\n lastname\n }\n text\n }\n\t\titems {\n product {\n name\n sku\n uid\n\t\t\t\tstock_status\n\t\t\t\tquantity\n price_range {\n maximum_price {\n regular_price {\n value\n }\n }\n }\n }\n\t\t\tprices {\n\t\t\t\tprice {\n\t\t\t\t\tcurrency\n\t\t\t\t\tvalue\n\t\t\t\t}\n\t\t\t\toriginal_item_price {\n\t\t\t\t\tcurrency\n\t\t\t\t\tvalue\n\t\t\t\t}\n\t\t\t\toriginal_row_total {\n\t\t\t\t\tcurrency\n\t\t\t\t\tvalue\n\t\t\t\t}\n\t\t\t\trow_total {\n\t\t\t\t\tcurrency\n\t\t\t\t\tvalue\n\t\t\t\t}\n catalog_discount {\n\t\t\t\t\tamount_off\n\t\t\t\t\tpercent_off\n\t\t\t\t}\n\t\t\t\tdiscounts {\n\t\t\t\t\tlabel\n\t\t\t\t\tvalue\n\t\t\t\t\tamount {\n\t\t\t\t\t\tcurrency\n\t\t\t\t\t\tvalue\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n quantity\n }\n history {\n uid\n created_at\n author {\n firstname\n lastname\n }\n change_type\n changes {\n comment_added {\n comment\n }\n statuses {\n changes {\n new_status\n old_status\n }\n }\n expiration {\n new_expiration\n old_expiration\n }\n }\n\t }\n prices {\n subtotal_excluding_tax {\n\t\t\t\tcurrency\n\t\t\t\tvalue\n\t\t\t}\n\t\t\tapplied_taxes {\n\t\t\t\tamount {\n\t\t\t\t\tcurrency\n\t\t\t\t\tvalue\n\t\t\t\t}\n\t\t\t\tlabel\n\t\t\t}\n\t\t\tgrand_total {\n\t\t\t\tcurrency\n\t\t\t\tvalue\n\t\t\t}\n }\n }\n";
|
|
18
18
|
//# sourceMappingURL=NegotiableQuoteFragment.d.ts.map
|
package/api/index.d.ts
CHANGED
|
@@ -3,6 +3,7 @@ import { Lang } from '@dropins/tools/types/elsie/src/i18n';
|
|
|
3
3
|
|
|
4
4
|
type ConfigProps = {
|
|
5
5
|
langDefinitions?: Lang;
|
|
6
|
+
quoteId?: string;
|
|
6
7
|
};
|
|
7
8
|
export declare const initialize: Initializer<ConfigProps>;
|
|
8
9
|
export declare const config: import('@dropins/tools/types/elsie/src/lib').Config<ConfigProps>;
|
package/api.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/*! Copyright 2025 Adobe
|
|
2
2
|
All Rights Reserved. */
|
|
3
|
-
import{s as
|
|
3
|
+
import{D as i,s as r,N as l,t as Q}from"./chunks/requestNegotiableQuote.js";import{r as z}from"./chunks/requestNegotiableQuote.js";import{FetchGraphQL as E}from"@dropins/tools/fetch-graphql.js";import{events as s}from"@dropins/tools/event-bus.js";import{Initializer as h}from"@dropins/tools/lib.js";const f=`
|
|
4
4
|
fragment CUSTOMER_FRAGMENT on Customer {
|
|
5
5
|
role {
|
|
6
6
|
permissions {
|
|
@@ -17,13 +17,25 @@ import{s as n,D as r}from"./chunks/requestNegotiableQuote.js";import{r as F}from
|
|
|
17
17
|
}
|
|
18
18
|
}
|
|
19
19
|
}
|
|
20
|
-
`,
|
|
20
|
+
`,p=`
|
|
21
21
|
query CUSTOMER_QUERY {
|
|
22
22
|
customer {
|
|
23
23
|
...CUSTOMER_FRAGMENT
|
|
24
24
|
}
|
|
25
25
|
}
|
|
26
26
|
|
|
27
|
-
${
|
|
28
|
-
`,
|
|
27
|
+
${f}
|
|
28
|
+
`,g="All/Quotes/View/Request, Edit, Delete",q="All/Quotes/View/Request, Edit, Delete",R="All/Quotes/View/Request, Edit, Delete",T="All/Quotes/View/Checkout with quote",_=t=>{const e=[],o=(n,d=[])=>{for(const a of n){const c=[...d,a.text];a.children&&a.children.length>0?o(a.children,c):e.push(c.join("/"))}};return o(t),e};function U(t){const{role:e}=t;if(!e)return{permissions:{canRequestQuote:i.requestQuote,canEditQuote:i.editQuote,canDeleteQuote:i.deleteQuote}};const{permissions:o}=e,n=_(o);return{permissions:{canRequestQuote:n.includes(g),canEditQuote:n.includes(q),canDeleteQuote:n.includes(R),canCheckoutQuote:n.includes(T)}}}const C=async()=>{var t;if(!r.authenticated)return Promise.reject(new Error("Unauthorized"));try{const e=await m(p);if(!((t=e==null?void 0:e.data)!=null&&t.customer))throw new Error("No customer data received");return U(e.data.customer)}catch(e){return Promise.reject(e)}},O=`
|
|
29
|
+
query QUOTE_DATA_QUERY(
|
|
30
|
+
$quoteId: ID!
|
|
31
|
+
) {
|
|
32
|
+
negotiableQuote(
|
|
33
|
+
uid: $quoteId
|
|
34
|
+
) {
|
|
35
|
+
...NegotiableQuoteFragment
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
${l}
|
|
40
|
+
`,A=async t=>{var e;if(!r.authenticated)return Promise.reject(new Error("Unauthorized"));if(!r.permissions.editQuote)return Promise.reject(new Error("Unauthorized"));try{const o=await m(O,{variables:{quoteId:t}}),n=Q((e=o==null?void 0:o.data)==null?void 0:e.negotiableQuote);if(!n)throw new Error("Failed to transform quote data");return s.emit("quote-management/quote-data",{quote:n,permissions:r.permissions}),n}catch(o){return Promise.reject(o)}},u=new h({init:async t=>{const e={};u.config.setConfig({...e,...t})},listeners:()=>[s.on("authenticated",async t=>{r.authenticated=!!t,t?C().then(e=>{r.permissions={requestQuote:e.permissions.canRequestQuote,editQuote:e.permissions.canEditQuote,deleteQuote:e.permissions.canDeleteQuote,checkoutQuote:e.permissions.canCheckoutQuote},s.emit("quote-management/permissions",r.permissions)}).catch(e=>{console.error(e),r.permissions=i,s.emit("quote-management/permissions",i)}):(r.permissions=i,s.emit("quote-management/permissions",i))},{eager:!0}),s.on("quote-management/permissions",async t=>{const e=u.config.getConfig().quoteId;e&&t.editQuote&&A(e).then(o=>{s.emit("quote-management/quote-data/initialized",{quote:o,permissions:t},{})}).catch(o=>{console.error(o)})},{eager:!0})]}),M=u.config,{setEndpoint:P,setFetchGraphQlHeader:D,removeFetchGraphQlHeader:F,setFetchGraphQlHeaders:G,fetchGraphQl:m,getConfig:y}=new E().getMethods();export{M as config,m as fetchGraphQl,y as getConfig,C as getCustomerData,A as getQuoteData,u as initialize,F as removeFetchGraphQlHeader,z as requestNegotiableQuote,P as setEndpoint,D as setFetchGraphQlHeader,G as setFetchGraphQlHeaders};
|
|
29
41
|
//# sourceMappingURL=api.js.map
|
package/api.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"api.js","sources":["/@dropins/storefront-quote-management/src/api/graphql/CustomerFragment.ts","/@dropins/storefront-quote-management/src/api/getCustomerData/graphql/CustomerQuery.ts","/@dropins/storefront-quote-management/src/data/transforms/transform-customer.ts","/@dropins/storefront-quote-management/src/api/getCustomerData/getCustomerData.ts","/@dropins/storefront-quote-management/src/api/initialize/initialize.ts","/@dropins/storefront-quote-management/src/api/fetch-graphql/fetch-graphql.ts"],"sourcesContent":["export const CUSTOMER_FRAGMENT = /* GraphQL */ `\n fragment CUSTOMER_FRAGMENT on Customer {\n role {\n permissions {\n text\n children {\n text\n children {\n text\n children {\n text\n }\n }\n }\n }\n }\n }\n`","import { CUSTOMER_FRAGMENT } from '@/quote-management/api/graphql/CustomerFragment';\n\nexport const CUSTOMER_QUERY = `\n query CUSTOMER_QUERY {\n customer {\n ...CUSTOMER_FRAGMENT\n }\n }\n\n ${CUSTOMER_FRAGMENT}\n`","/********************************************************************\n * Copyright 2025 Adobe\n * All Rights Reserved.\n *\n * NOTICE: Adobe permits you to use, modify, and distribute this \n * file in accordance with the terms of the Adobe license agreement \n * accompanying it. \n *******************************************************************/\n\nimport { 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: { permissions } } = customerData;\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","flattenedPermissions","getCustomerData","state","results","fetchGraphQl","_a","error","initialize","Initializer","config","defaultConfig","events","authenticated","DEFAULT_PERMISSIONS","setEndpoint","setFetchGraphQlHeader","removeFetchGraphQlHe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,OAAOA,CAAK,CAC/B,CACJ,ECpBaC,EAAa,IAAIC,EAAyB,CACrD,KAAM,MAAOC,GAAW,CACtB,MAAMC,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,KAAMF,GAAiB,CACvCG,EAAM,YAAc,CAClB,aAAcH,EAAa,YAAY,gBACvC,UAAWA,EAAa,YAAY,aACpC,YAAaA,EAAa,YAAY,cAAA,EAExCY,EAAO,KAAK,+BAAgCT,EAAM,WAAW,CAC/D,CAAC,EACE,MAAOI,GAAU,CAChB,QAAQ,MAAMA,CAAK,EACnBJ,EAAM,YAAcW,EACpBF,EAAO,KAAK,+BAAgCE,CAAmB,CACjE,CAAC,GAEHX,EAAM,YAAcW,EACpBF,EAAO,KAAK,+BAAgCE,CAAmB,EAEnE,EAAG,CACD,MAAO,EAAA,CACR,CAAA,CAEL,CAAC,EAEYJ,EAASF,EAAW,OC3CpB,CACX,YAAAO,EACA,sBAAAC,EACA,yBAAAC,EACA,uBAAAC,EACA,aAAAb,EACA,UAAAc,CACF,EAAI,IAAIC,EAAA,EAAe,WAAA"}
|
|
1
|
+
{"version":3,"file":"api.js","sources":["/@dropins/storefront-quote-management/src/api/graphql/CustomerFragment.ts","/@dropins/storefront-quote-management/src/api/getCustomerData/graphql/CustomerQuery.ts","/@dropins/storefront-quote-management/src/data/transforms/transform-customer.ts","/@dropins/storefront-quote-management/src/api/getCustomerData/getCustomerData.ts","/@dropins/storefront-quote-management/src/api/getQuoteData/graphql/QuoteDataQuery.ts","/@dropins/storefront-quote-management/src/api/getQuoteData/getQuoteData.ts","/@dropins/storefront-quote-management/src/api/initialize/initialize.ts","/@dropins/storefront-quote-management/src/api/fetch-graphql/fetch-graphql.ts"],"sourcesContent":["export const CUSTOMER_FRAGMENT = /* GraphQL */ `\n fragment CUSTOMER_FRAGMENT on Customer {\n role {\n permissions {\n text\n children {\n text\n children {\n text\n children {\n text\n }\n }\n }\n }\n }\n }\n`","import { CUSTOMER_FRAGMENT } from '@/quote-management/api/graphql/CustomerFragment';\n\nexport const CUSTOMER_QUERY = `\n query CUSTOMER_QUERY {\n customer {\n ...CUSTOMER_FRAGMENT\n }\n }\n\n ${CUSTOMER_FRAGMENT}\n`","/********************************************************************\n * Copyright 2025 Adobe\n * All Rights Reserved.\n *\n * NOTICE: Adobe permits you to use, modify, and distribute this \n * file in accordance with the terms of the Adobe license agreement \n * accompanying it. \n *******************************************************************/\n\nimport { DEFAULT_PERMISSIONS } from \"@/quote-management/lib/state\";\nimport { CustomerModel } from \"../models\";\n\ntype PermissionsSchema = {\n text: string;\n children: PermissionsSchema[];\n}\n\nconst CAN_REQUEST_QUOTE_PERMISSION = 'All/Quotes/View/Request, Edit, Delete';\nconst CAN_EDIT_QUOTE_PERMISSION = 'All/Quotes/View/Request, Edit, Delete';\nconst CAN_DELETE_QUOTE_PERMISSION = 'All/Quotes/View/Request, Edit, Delete';\nconst CAN_CHECKOUT_QUOTE_PERMISSION = 'All/Quotes/View/Checkout with quote';\n\n/**\n * Flatten the permissions into a list of strings\n * @param permissions - The permissions to flatten\n * @returns A list of strings representing the flattened permissions\n */\nexport const flattenPermissions = (permissions: PermissionsSchema[]): string[] => {\n const result: string[] = [];\n \n // Recursively traverse the permissions and build the path\n const traverse = (nodes: PermissionsSchema[], path: string[] = []) => {\n for (const node of nodes) {\n const currentPath = [...path, node.text];\n \n if (node.children && node.children.length > 0) {\n traverse(node.children, currentPath);\n } else {\n result.push(currentPath.join('/'));\n }\n }\n };\n \n traverse(permissions);\n return result;\n}\n\nexport function transformCustomer(customerData: any): CustomerModel {\n const { role } = customerData;\n\n if (!role) {\n return {\n permissions: {\n canRequestQuote: DEFAULT_PERMISSIONS.requestQuote,\n canEditQuote: DEFAULT_PERMISSIONS.editQuote,\n canDeleteQuote: DEFAULT_PERMISSIONS.deleteQuote,\n },\n };\n }\n\n const { permissions } = role;\n\n const flattenedPermissions = flattenPermissions(permissions);\n return {\n permissions: {\n canRequestQuote: flattenedPermissions.includes(CAN_REQUEST_QUOTE_PERMISSION),\n canEditQuote: flattenedPermissions.includes(CAN_EDIT_QUOTE_PERMISSION),\n canDeleteQuote: flattenedPermissions.includes(CAN_DELETE_QUOTE_PERMISSION),\n canCheckoutQuote: flattenedPermissions.includes(CAN_CHECKOUT_QUOTE_PERMISSION),\n }\n }\n}","/********************************************************************\n * Copyright 2025 Adobe\n * All Rights Reserved.\n *\n * NOTICE: Adobe permits you to use, modify, and distribute this \n * file in accordance with the terms of the Adobe license agreement \n * accompanying it. \n *******************************************************************/\n\nimport { fetchGraphQl } from '@/quote-management/api/';\nimport { CUSTOMER_QUERY } from './graphql/CustomerQuery';\nimport { transformCustomer } from '@/quote-management/data/transforms';\nimport { state } from '@/quote-management/lib/state';\n\nexport const getCustomerData = async () => { \n if (!state.authenticated) {\n return Promise.reject(new Error('Unauthorized'));\n }\n\n try {\n const results: any = await fetchGraphQl(CUSTOMER_QUERY);\n \n if (!results?.data?.customer) {\n throw new Error('No customer data received');\n }\n \n return transformCustomer(results.data.customer);\n } catch (error) {\n return Promise.reject(error);\n }\n}\n","import { NEGOTIABLE_QUOTE_FRAGMENT } from '@/quote-management/api/graphql/NegotiableQuoteFragment';\n\nexport const QUOTE_DATA_QUERY = `\n query QUOTE_DATA_QUERY(\n $quoteId: ID!\n ) {\n negotiableQuote(\n uid: $quoteId\n ) {\n ...NegotiableQuoteFragment\n }\n }\n\n ${NEGOTIABLE_QUOTE_FRAGMENT}\n`","/********************************************************************\n * Copyright 2025 Adobe\n * All Rights Reserved.\n *\n * NOTICE: Adobe permits you to use, modify, and distribute this \n * file in accordance with the terms of the Adobe license agreement \n * accompanying it. \n *******************************************************************/\n\nimport { fetchGraphQl } from '@/quote-management/api/';\nimport { QUOTE_DATA_QUERY } from './graphql/QuoteDataQuery';\nimport { transformQuote } from '@/quote-management/data/transforms';\nimport { state } from '@/quote-management/lib/state';\nimport { events } from '@adobe-commerce/event-bus';\n\nexport const getQuoteData = async (quoteId: string) => { \n if (!state.authenticated) {\n return Promise.reject(new Error('Unauthorized'));\n }\n\n if (!state.permissions.editQuote) {\n return Promise.reject(new Error('Unauthorized'));\n }\n\n try {\n const results: any = await fetchGraphQl(QUOTE_DATA_QUERY, {\n variables: {\n quoteId\n }\n });\n\n const transformedQuote = transformQuote(results?.data?.negotiableQuote);\n\n if (!transformedQuote) {\n throw new Error('Failed to transform quote data');\n }\n\n events.emit('quote-management/quote-data', {\n quote: transformedQuote,\n permissions: state.permissions,\n });\n \n return transformedQuote;\n } catch (error) {\n return Promise.reject(error);\n }\n}\n","import { Initializer } from '@adobe-commerce/elsie/lib';\nimport { Lang } from '@adobe-commerce/elsie/i18n';\nimport { events } from '@adobe-commerce/event-bus';\nimport { state, DEFAULT_PERMISSIONS } from '@/quote-management/lib/state';\nimport { getCustomerData } from '@/quote-management/api/getCustomerData';\nimport { getQuoteData } from '@/quote-management/api/getQuoteData';\n\ntype ConfigProps = {\n langDefinitions?: Lang;\n quoteId?: string;\n};\n\nexport const initialize = new Initializer<ConfigProps>({\n init: async (config) => {\n const defaultConfig = {};\n\n initialize.config.setConfig({ ...defaultConfig, ...config });\n },\n\n listeners: () => [\n events.on('authenticated', async (authenticated) => {\n state.authenticated = !!authenticated;\n\n if (authenticated) {\n getCustomerData().then((customerData) => {\n state.permissions = {\n requestQuote: customerData.permissions.canRequestQuote,\n editQuote: customerData.permissions.canEditQuote,\n deleteQuote: customerData.permissions.canDeleteQuote,\n checkoutQuote: customerData.permissions.canCheckoutQuote,\n };\n events.emit('quote-management/permissions', state.permissions);\n })\n .catch((error) => {\n console.error(error);\n state.permissions = DEFAULT_PERMISSIONS;\n events.emit('quote-management/permissions', DEFAULT_PERMISSIONS);\n });\n } else {\n state.permissions = DEFAULT_PERMISSIONS;\n events.emit('quote-management/permissions', DEFAULT_PERMISSIONS);\n }\n }, {\n eager: true,\n }),\n events.on('quote-management/permissions', async (permissions) => {\n const quoteId = initialize.config.getConfig().quoteId;\n if (!quoteId) {\n return;\n }\n\n if (permissions.editQuote) {\n getQuoteData(quoteId).then((quoteData) => {\n events.emit('quote-management/quote-data/initialized', {\n quote: quoteData,\n permissions,\n }, {});\n }).catch((error) => {\n console.error(error);\n });\n }\n }, {\n eager: true,\n }),\n ],\n});\n\nexport const config = initialize.config;\n","import { FetchGraphQL } from '@adobe-commerce/fetch-graphql';\n\nexport const {\n setEndpoint,\n setFetchGraphQlHeader,\n removeFetchGraphQlHeader,\n setFetchGraphQlHeaders,\n fetchGraphQl,\n getConfig,\n} = new FetchGraphQL().getMethods();\n"],"names":["CUSTOMER_FRAGMENT","CUSTOMER_QUERY","CAN_REQUEST_QUOTE_PERMISSION","CAN_EDIT_QUOTE_PERMISSION","CAN_DELETE_QUOTE_PERMISSION","CAN_CHECKOUT_QUOTE_PERMISSION","flattenPermissions","permissions","result","traverse","nodes","path","node","currentPath","transformCustomer","customerData","role","DEFAULT_PERMISSIONS","flattenedPermissions","getCustomerData","state","results","fetchGraphQl","_a","error","QUOTE_DATA_QUERY","NEGOTIABLE_QUOTE_FRAGMENT","getQuoteData","quoteId","transformedQuote","transformQuote","events","initialize","Initializer","config","defaultConfig","authenticated","quoteData","setEndpoint","setFetchGraphQlHeader","removeFetchGraphQlHeader","setFetchGraphQlHeaders","getConfig","FetchGraphQL"],"mappings":"2SAAO,MAAMA,EAAkC;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,ECElCC,EAAiB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,MAOxBD,CAAiB;AAAA,ECQjBE,EAA+B,wCAC/BC,EAA4B,wCAC5BC,EAA8B,wCAC9BC,EAAgC,sCAOzBC,EAAsBC,GAA+C,CAC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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,CAClB,QAAQ,MAAMA,CAAK,CACrB,CAAC,CAEL,EAAG,CACD,MAAO,EAAA,CACR,CAAA,CAEL,CAAC,EAEYU,EAASF,EAAW,OCjEpB,CACX,YAAAM,EACA,sBAAAC,EACA,yBAAAC,EACA,uBAAAC,EACA,aAAAnB,EACA,UAAAoB,CACF,EAAI,IAAIC,EAAA,EAAe,WAAA"}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
/*! Copyright 2025 Adobe
|
|
2
|
+
All Rights Reserved. */
|
|
3
|
+
import*as e from"@dropins/tools/preact-compat.js";const l=t=>e.createElement("svg",{width:24,height:24,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",...t},e.createElement("path",{vectorEffect:"non-scaling-stroke",fillRule:"evenodd",clipRule:"evenodd",d:"M1 20.8953L12.1922 1.5L23.395 20.8953H1ZM13.0278 13.9638L13.25 10.0377V9H11.25V10.0377L11.4722 13.9638H13.0278ZM11.2994 16V17.7509H13.2253V16H11.2994Z",fill:"currentColor"}));export{l as S};
|
|
4
|
+
//# sourceMappingURL=RequestNegotiableQuoteForm.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"RequestNegotiableQuoteForm.js","sources":["../../node_modules/@adobe-commerce/elsie/src/icons/WarningFilled.svg"],"sourcesContent":["import * as React from \"react\";\nconst SvgWarningFilled = (props) => /* @__PURE__ */ React.createElement(\"svg\", { width: 24, height: 24, viewBox: \"0 0 24 24\", fill: \"none\", xmlns: \"http://www.w3.org/2000/svg\", ...props }, /* @__PURE__ */ React.createElement(\"path\", { vectorEffect: \"non-scaling-stroke\", fillRule: \"evenodd\", clipRule: \"evenodd\", d: \"M1 20.8953L12.1922 1.5L23.395 20.8953H1ZM13.0278 13.9638L13.25 10.0377V9H11.25V10.0377L11.4722 13.9638H13.0278ZM11.2994 16V17.7509H13.2253V16H11.2994Z\", fill: \"currentColor\" }));\nexport default SvgWarningFilled;\n"],"names":["SvgWarningFilled","props","React"],"mappings":"kDACK,MAACA,EAAoBC,GAA0BC,EAAM,cAAc,MAAO,CAAE,MAAO,GAAI,OAAQ,GAAI,QAAS,YAAa,KAAM,OAAQ,MAAO,6BAA8B,GAAGD,CAAK,EAAoBC,EAAM,cAAc,OAAQ,CAAE,aAAc,qBAAsB,SAAU,UAAW,SAAU,UAAW,EAAG,yJAA0J,KAAM,eAAgB,CAAC","x_google_ignoreList":[0]}
|
|
@@ -1,55 +1,114 @@
|
|
|
1
1
|
/*! Copyright 2025 Adobe
|
|
2
2
|
All Rights Reserved. */
|
|
3
|
-
import{fetchGraphQl as
|
|
4
|
-
fragment NegotiableQuoteFragment on
|
|
5
|
-
|
|
3
|
+
import{fetchGraphQl as _}from"@dropins/tools/fetch-graphql.js";import{events as p}from"@dropins/tools/event-bus.js";const g={requestQuote:!1,editQuote:!1,deleteQuote:!1,checkoutQuote:!1},f={authenticated:!1,permissions:g},l=new Proxy(f,{get:(t,e)=>t[e],set:(t,e,r)=>(t[e]=r,!0)});function y(t){return t?{uid:t.uid,name:t.name,createdAt:t.created_at,status:t.status,buyer:t.buyer,comments:t.comments.map(e=>({uid:e.uid,createdAt:e.created_at,author:e.author})),items:t.items.map(e=>{var r,u;return{product:{uid:e.product.uid,sku:e.product.sku,name:e.product.name},catalogDiscount:{amountOff:e.prices.catalog_discount.amount_off,percentOff:e.prices.catalog_discount.percent_off},discounts:((u=(r=e.prices)==null?void 0:r.discounts)==null?void 0:u.map(a=>({label:a.label,value:a.value,amount:{value:a.amount.value,currency:a.amount.currency}})))??[],stockStatus:e.product.stock_status,quantity:e.quantity,prices:{originalItemPrice:{value:e.prices.original_item_price.value,currency:e.prices.original_item_price.currency},rowTotal:{value:e.prices.row_total.value,currency:e.prices.row_total.currency}}}}),prices:{grandTotal:{value:t.prices.grand_total.value,currency:t.prices.grand_total.currency},subtotalExcludingTax:{value:t.prices.subtotal_excluding_tax.value,currency:t.prices.subtotal_excluding_tax.currency},appliedTaxes:t.prices.applied_taxes.map(e=>({amount:{value:e.amount.value,currency:e.amount.currency},label:e.label}))},canCheckout:["UPDATED","DECLINED"].includes(t.status)&&l.permissions.checkoutQuote,canSendForReview:["SUBMITTED","DRAFT","UPDATED","DECLINED","EXPIRED"].includes(t.status)&&l.permissions.editQuote}:null}const E=`
|
|
4
|
+
fragment NegotiableQuoteFragment on NegotiableQuote {
|
|
5
|
+
uid
|
|
6
|
+
name
|
|
7
|
+
created_at
|
|
8
|
+
status
|
|
9
|
+
buyer {
|
|
10
|
+
firstname
|
|
11
|
+
lastname
|
|
12
|
+
}
|
|
13
|
+
comments {
|
|
6
14
|
uid
|
|
7
15
|
created_at
|
|
8
|
-
|
|
9
|
-
buyer {
|
|
16
|
+
author {
|
|
10
17
|
firstname
|
|
11
18
|
lastname
|
|
12
19
|
}
|
|
13
|
-
|
|
20
|
+
text
|
|
21
|
+
}
|
|
22
|
+
items {
|
|
23
|
+
product {
|
|
24
|
+
name
|
|
25
|
+
sku
|
|
14
26
|
uid
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
items {
|
|
22
|
-
product {
|
|
23
|
-
uid
|
|
24
|
-
sku
|
|
25
|
-
name
|
|
26
|
-
price_range {
|
|
27
|
-
maximum_price {
|
|
28
|
-
regular_price {
|
|
29
|
-
value
|
|
30
|
-
}
|
|
27
|
+
stock_status
|
|
28
|
+
quantity
|
|
29
|
+
price_range {
|
|
30
|
+
maximum_price {
|
|
31
|
+
regular_price {
|
|
32
|
+
value
|
|
31
33
|
}
|
|
32
34
|
}
|
|
33
35
|
}
|
|
34
|
-
quantity
|
|
35
36
|
}
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
37
|
+
prices {
|
|
38
|
+
price {
|
|
39
|
+
currency
|
|
40
|
+
value
|
|
41
|
+
}
|
|
42
|
+
original_item_price {
|
|
43
|
+
currency
|
|
44
|
+
value
|
|
45
|
+
}
|
|
46
|
+
original_row_total {
|
|
47
|
+
currency
|
|
48
|
+
value
|
|
49
|
+
}
|
|
50
|
+
row_total {
|
|
51
|
+
currency
|
|
52
|
+
value
|
|
53
|
+
}
|
|
54
|
+
catalog_discount {
|
|
55
|
+
amount_off
|
|
56
|
+
percent_off
|
|
57
|
+
}
|
|
58
|
+
discounts {
|
|
59
|
+
label
|
|
60
|
+
value
|
|
61
|
+
amount {
|
|
62
|
+
currency
|
|
63
|
+
value
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
quantity
|
|
68
|
+
}
|
|
69
|
+
history {
|
|
70
|
+
uid
|
|
71
|
+
created_at
|
|
72
|
+
author {
|
|
73
|
+
firstname
|
|
74
|
+
lastname
|
|
75
|
+
}
|
|
76
|
+
change_type
|
|
77
|
+
changes {
|
|
78
|
+
comment_added {
|
|
79
|
+
comment
|
|
42
80
|
}
|
|
43
|
-
|
|
44
|
-
|
|
81
|
+
statuses {
|
|
82
|
+
changes {
|
|
83
|
+
new_status
|
|
84
|
+
old_status
|
|
85
|
+
}
|
|
45
86
|
}
|
|
46
|
-
|
|
47
|
-
|
|
87
|
+
expiration {
|
|
88
|
+
new_expiration
|
|
89
|
+
old_expiration
|
|
48
90
|
}
|
|
49
91
|
}
|
|
92
|
+
}
|
|
93
|
+
prices {
|
|
94
|
+
subtotal_excluding_tax {
|
|
95
|
+
currency
|
|
96
|
+
value
|
|
97
|
+
}
|
|
98
|
+
applied_taxes {
|
|
99
|
+
amount {
|
|
100
|
+
currency
|
|
101
|
+
value
|
|
102
|
+
}
|
|
103
|
+
label
|
|
104
|
+
}
|
|
105
|
+
grand_total {
|
|
106
|
+
currency
|
|
107
|
+
value
|
|
108
|
+
}
|
|
50
109
|
}
|
|
51
110
|
}
|
|
52
|
-
`,
|
|
111
|
+
`,v=`
|
|
53
112
|
mutation REQUEST_NEGOTIABLE_QUOTE_MUTATION(
|
|
54
113
|
$cartId: ID!
|
|
55
114
|
$quoteName: String!
|
|
@@ -64,9 +123,11 @@ import{fetchGraphQl as l}from"@dropins/tools/fetch-graphql.js";import{events as
|
|
|
64
123
|
is_draft: $isDraft
|
|
65
124
|
}
|
|
66
125
|
) {
|
|
67
|
-
|
|
126
|
+
quote {
|
|
127
|
+
...NegotiableQuoteFragment
|
|
128
|
+
}
|
|
68
129
|
}
|
|
69
130
|
}
|
|
70
|
-
${
|
|
71
|
-
`,
|
|
131
|
+
${E}
|
|
132
|
+
`,Q=async t=>{const{cartId:e,quoteName:r,comment:u,isDraft:a}=t;if(!e)throw new Error("Cart ID is required");if(!r)throw new Error("Quote name is required");if(!u)throw new Error("Comment is required");return _(v,{variables:{cartId:e,quoteName:r,comment:{comment:u},isDraft:a}}).then(o=>{var s,i;const{errors:c}=o;if(c){const m=c.map(d=>d.message).join("; ");throw new Error(`Failed to request negotiable quote: ${m}`)}const n=y((i=(s=o.data)==null?void 0:s.requestNegotiableQuote)==null?void 0:i.quote);if(!n)throw new Error("Failed to transform quote data: Invalid response structure");return p.emit("quote-management/negotiable-quote-requested",{quote:n,input:{cartId:e,quoteName:r,comment:u,isDraft:a}}),n})};export{g as D,E as N,Q as r,l as s,y as t};
|
|
72
133
|
//# sourceMappingURL=requestNegotiableQuote.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"requestNegotiableQuote.js","sources":["/@dropins/storefront-quote-management/src/lib/state.ts","/@dropins/storefront-quote-management/src/data/transforms/transform-quote.ts","/@dropins/storefront-quote-management/src/api/graphql/NegotiableQuoteFragment.ts","/@dropins/storefront-quote-management/src/api/requestNegotiableQuote/graphql/RequestNegotiableQuoteMutation.ts","/@dropins/storefront-quote-management/src/api/requestNegotiableQuote/requestNegotiableQuote.ts"],"sourcesContent":["/********************************************************************\n * Copyright 2025 Adobe\n * All Rights Reserved.\n *\n * NOTICE: Adobe permits you to use, modify, and distribute this \n * file in accordance with the terms of the Adobe license agreement \n * accompanying it. \n *******************************************************************/\n\nimport { State } from '../types/state.types';\n\nexport const DEFAULT_PERMISSIONS = {\n requestQuote: false,\n editQuote: false,\n deleteQuote: false,\n};\n\nconst _state: State = {\n authenticated: false,\n permissions: DEFAULT_PERMISSIONS,\n}\n\n// Proxy state to make it reactive\nexport const state = new Proxy(_state, {\n get: (target, key) => {\n return target[key as keyof State];\n },\n set: (target, key, value) => {\n target[key as keyof State] = value;\n return true;\n }\n})","/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2024 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\nimport { NegotiableQuoteModel } from '@/quote-management/data/models/negotiable-quote-model';\n\nexport function transformQuote(response: any): NegotiableQuoteModel | null {\n if (!response || !response.data || !response.data.requestNegotiableQuote) {\n return null;\n }\n\n const quote = response.data.requestNegotiableQuote.quote;\n\n return {\n uid: quote.uid,\n createdAt: quote.created_at,\n status: quote.status,\n buyer: quote.buyer,\n comments: quote.comments.map((comment: any) => ({\n uid: comment.uid,\n createdAt: comment.created_at,\n author: comment.author,\n })),\n items: quote.items.map((item: any) => ({\n product: {\n uid: item.product.uid,\n sku: item.product.sku,\n name: item.product.name,\n priceRange: {\n maximumPrice: {\n regularPrice: {\n value: item.product.price_range.maximum_price.regular_price.value,\n },\n },\n },\n },\n quantity: item.quantity,\n prices: {\n subtotalExcludingTax: {\n value: quote.prices.subtotal_excluding_tax.value,\n },\n subtotalIncludingTax: {\n value: quote.prices.subtotal_including_tax.value,\n },\n subtotalWithDiscountExcludingTax: {\n value: quote.prices.subtotal_with_discount_excluding_tax.value,\n },\n grandTotal: {\n value: quote.prices.grand_total.value,\n },\n },\n })),\n };\n}\n","/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2024 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\n\nexport const NEGOTIABLE_QUOTE_FRAGMENT = /* GraphQL */ `\n fragment NegotiableQuoteFragment on RequestNegotiableQuoteOutput {\n quote {\n uid\n created_at\n status\n buyer {\n firstname\n lastname\n }\n comments {\n uid\n created_at\n author {\n firstname\n lastname\n }\n }\n items {\n product {\n uid\n sku\n name\n price_range {\n maximum_price {\n regular_price {\n value\n }\n }\n }\n }\n quantity\n }\n prices {\n subtotal_excluding_tax {\n value\n }\n subtotal_including_tax {\n value\n }\n subtotal_with_discount_excluding_tax {\n value\n }\n grand_total {\n value\n }\n }\n }\n }\n`;\n","/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2024 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\n\nimport { NEGOTIABLE_QUOTE_FRAGMENT } from '@/quote-management/api/graphql/NegotiableQuoteFragment';\n\nexport const REQUEST_NEGOTIABLE_QUOTE_MUTATION = `\n mutation REQUEST_NEGOTIABLE_QUOTE_MUTATION(\n $cartId: ID!\n $quoteName: String!\n $comment: NegotiableQuoteCommentInput!\n $isDraft: Boolean\n ) {\n requestNegotiableQuote(\n input: {\n cart_id: $cartId\n quote_name: $quoteName\n comment: $comment\n is_draft: $isDraft\n }\n ) {\n ...NegotiableQuoteFragment\n }\n }\n ${NEGOTIABLE_QUOTE_FRAGMENT}\n`;\n","/********************************************************************\n * Copyright 2025 Adobe\n * All Rights Reserved.\n *\n * NOTICE: Adobe permits you to use, modify, and distribute this\n * file in accordance with the terms of the Adobe license agreement\n * accompanying it.\n *******************************************************************/\n\nimport { fetchGraphQl } from '@adobe-commerce/fetch-graphql';\nimport { events } from '@adobe-commerce/event-bus';\nimport { REQUEST_NEGOTIABLE_QUOTE_MUTATION } from './graphql/RequestNegotiableQuoteMutation';\nimport { NegotiableQuoteModel } from '@/quote-management/data/models/negotiable-quote-model';\nimport { transformQuote } from '@/quote-management/data/transforms';\n\nexport interface RequestNegotiableQuoteInput {\n cartId: string;\n quoteName: string;\n comment: string;\n isDraft?: boolean;\n}\n\nexport const requestNegotiableQuote = async (\n input: RequestNegotiableQuoteInput\n): Promise<NegotiableQuoteModel | null> => {\n const { cartId, quoteName, comment, isDraft } = input;\n\n if (!cartId) {\n throw new Error('Cart ID is required');\n }\n\n if (!quoteName) {\n throw new Error('Quote name is required');\n }\n\n if (!comment) {\n throw new Error('Comment is required');\n }\n\n return fetchGraphQl(REQUEST_NEGOTIABLE_QUOTE_MUTATION, {\n variables: {\n cartId,\n quoteName,\n comment: {\n comment\n },\n isDraft,\n },\n }).then((response) => {\n const { errors } = response;\n\n if (errors) {\n // Provide more detailed error information\n const errorMessages = errors.map((error) => error.message).join('; ');\n throw new Error(`Failed to request negotiable quote: ${errorMessages}`);\n }\n\n // Transform the quote data\n const quoteData = transformQuote(response);\n\n if (!quoteData) {\n throw new Error(\n 'Failed to transform quote data: Invalid response structure'\n );\n }\n\n // Emit event with transformed quote data on success\n events.emit('quote-management/negotiable-quote-requested', {\n quote: quoteData,\n input: { cartId, quoteName, comment, isDraft },\n });\n\n return quoteData;\n });\n};\n"],"names":["DEFAULT_PERMISSIONS","_state","state","target","key","value","transformQuote","response","quote","comment","item","NEGOTIABLE_QUOTE_FRAGMENT","REQUEST_NEGOTIABLE_QUOTE_MUTATION","requestNegotiableQuote","input","cartId","quoteName","isDraft","fetchGraphQl","errors","errorMessages","error","quoteData","events"],"mappings":"oHAWO,MAAMA,EAAsB,CAC/B,aAAc,GACd,UAAW,GACX,YAAa,EACjB,EAEMC,EAAgB,CAClB,cAAe,GACf,YAAaD,CACjB,EAGaE,EAAQ,IAAI,MAAMD,EAAQ,CACnC,IAAK,CAACE,EAAQC,IACHD,EAAOC,CAAkB,EAEpC,IAAK,CAACD,EAAQC,EAAKC,KACfF,EAAOC,CAAkB,EAAIC,EACtB,GAEf,CAAC,ECbM,SAASC,EAAeC,EAA4C,CACzE,GAAI,CAACA,GAAY,CAACA,EAAS,MAAQ,CAACA,EAAS,KAAK,uBAChD,OAAO,KAGT,MAAMC,EAAQD,EAAS,KAAK,uBAAuB,MAEnD,MAAO,CACL,IAAKC,EAAM,IACX,UAAWA,EAAM,WACjB,OAAQA,EAAM,OACd,MAAOA,EAAM,MACb,SAAUA,EAAM,SAAS,IAAKC,IAAkB,CAC9C,IAAKA,EAAQ,IACb,UAAWA,EAAQ,WACnB,OAAQA,EAAQ,MAAA,EAChB,EACF,MAAOD,EAAM,MAAM,IAAKE,IAAe,CACrC,QAAS,CACP,IAAKA,EAAK,QAAQ,IAClB,IAAKA,EAAK,QAAQ,IAClB,KAAMA,EAAK,QAAQ,KACnB,WAAY,CACV,aAAc,CACZ,aAAc,CACZ,MAAOA,EAAK,QAAQ,YAAY,cAAc,cAAc,KAAA,CAC9D,CACF,CACF,EAEF,SAAUA,EAAK,SACf,OAAQ,CACN,qBAAsB,CACpB,MAAOF,EAAM,OAAO,uBAAuB,KAAA,EAE7C,qBAAsB,CACpB,MAAO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Q,EAEzC,GAAI,CAACe,EACH,MAAM,IAAI,MACR,4DAAA,EAKJ,OAAAC,EAAO,KAAK,8CAA+C,CACzD,MAAOD,EACP,MAAO,CAAE,OAAAP,EAAQ,UAAAC,EAAW,QAAAP,EAAS,QAAAQ,CAAA,CAAQ,CAC9C,EAEMK,CACT,CAAC,CACH"}
|
|
1
|
+
{"version":3,"file":"requestNegotiableQuote.js","sources":["/@dropins/storefront-quote-management/src/lib/state.ts","/@dropins/storefront-quote-management/src/data/transforms/transform-quote.ts","/@dropins/storefront-quote-management/src/api/graphql/NegotiableQuoteFragment.ts","/@dropins/storefront-quote-management/src/api/requestNegotiableQuote/graphql/RequestNegotiableQuoteMutation.ts","/@dropins/storefront-quote-management/src/api/requestNegotiableQuote/requestNegotiableQuote.ts"],"sourcesContent":["/********************************************************************\n * Copyright 2025 Adobe\n * All Rights Reserved.\n *\n * NOTICE: Adobe permits you to use, modify, and distribute this \n * file in accordance with the terms of the Adobe license agreement \n * accompanying it. \n *******************************************************************/\n\nimport { State } from '../types/state.types';\n\nexport const DEFAULT_PERMISSIONS = {\n requestQuote: false,\n editQuote: false,\n deleteQuote: false,\n checkoutQuote: false,\n};\n\nconst _state: State = {\n authenticated: false,\n permissions: DEFAULT_PERMISSIONS,\n}\n\n// Proxy state to make it reactive\nexport const state = new Proxy(_state, {\n get: (target, key) => {\n return target[key as keyof State];\n },\n set: (target, key, value) => {\n target[key as keyof State] = value;\n return true;\n }\n})","/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2024 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\nimport { NegotiableQuoteModel } from '@/quote-management/data/models/negotiable-quote-model';\nimport { state } from '@/quote-management/lib/state';\n\nexport function transformQuote(quoteData: any): NegotiableQuoteModel | null {\n if (!quoteData) return null;\n\n return {\n uid: quoteData.uid,\n name: quoteData.name,\n createdAt: quoteData.created_at,\n status: quoteData.status,\n 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\t\tbuyer {\n\t\t\tfirstname\n\t\t\tlastname\n\t\t}\n\t\tcomments {\n uid\n created_at\n author {\n firstname\n lastname\n }\n text\n }\n\t\titems {\n product {\n name\n sku\n uid\n\t\t\t\tstock_status\n\t\t\t\tquantity\n price_range {\n maximum_price {\n regular_price {\n value\n }\n }\n }\n }\n\t\t\tprices {\n\t\t\t\tprice {\n\t\t\t\t\tcurrency\n\t\t\t\t\tvalue\n\t\t\t\t}\n\t\t\t\toriginal_item_price {\n\t\t\t\t\tcurrency\n\t\t\t\t\tvalue\n\t\t\t\t}\n\t\t\t\toriginal_row_total {\n\t\t\t\t\tcurrency\n\t\t\t\t\tvalue\n\t\t\t\t}\n\t\t\t\trow_total {\n\t\t\t\t\tcurrency\n\t\t\t\t\tvalue\n\t\t\t\t}\n catalog_discount {\n\t\t\t\t\tamount_off\n\t\t\t\t\tpercent_off\n\t\t\t\t}\n\t\t\t\tdiscounts {\n\t\t\t\t\tlabel\n\t\t\t\t\tvalue\n\t\t\t\t\tamount {\n\t\t\t\t\t\tcurrency\n\t\t\t\t\t\tvalue\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n quantity\n }\n history {\n uid\n created_at\n author {\n firstname\n lastname\n }\n change_type\n changes {\n comment_added {\n comment\n }\n statuses {\n changes {\n new_status\n old_status\n }\n }\n expiration {\n new_expiration\n old_expiration\n }\n }\n\t }\n prices {\n subtotal_excluding_tax {\n\t\t\t\tcurrency\n\t\t\t\tvalue\n\t\t\t}\n\t\t\tapplied_taxes {\n\t\t\t\tamount {\n\t\t\t\t\tcurrency\n\t\t\t\t\tvalue\n\t\t\t\t}\n\t\t\t\tlabel\n\t\t\t}\n\t\t\tgrand_total {\n\t\t\t\tcurrency\n\t\t\t\tvalue\n\t\t\t}\n }\n }\n`;\n","/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2024 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\n\nimport { NEGOTIABLE_QUOTE_FRAGMENT } from '@/quote-management/api/graphql/NegotiableQuoteFragment';\n\nexport const REQUEST_NEGOTIABLE_QUOTE_MUTATION = `\n mutation REQUEST_NEGOTIABLE_QUOTE_MUTATION(\n $cartId: ID!\n $quoteName: String!\n $comment: NegotiableQuoteCommentInput!\n $isDraft: Boolean\n ) {\n requestNegotiableQuote(\n input: {\n cart_id: $cartId\n quote_name: $quoteName\n comment: $comment\n is_draft: $isDraft\n }\n ) {\n quote {\n ...NegotiableQuoteFragment\n }\n }\n }\n ${NEGOTIABLE_QUOTE_FRAGMENT}\n`;\n","/********************************************************************\n * Copyright 2025 Adobe\n * All Rights Reserved.\n *\n * NOTICE: Adobe permits you to use, modify, and distribute this\n * file in accordance with the terms of the Adobe license agreement\n * accompanying it.\n *******************************************************************/\n\nimport { fetchGraphQl } from '@adobe-commerce/fetch-graphql';\nimport { events } from '@adobe-commerce/event-bus';\nimport { REQUEST_NEGOTIABLE_QUOTE_MUTATION } from './graphql/RequestNegotiableQuoteMutation';\nimport { NegotiableQuoteModel } from '@/quote-management/data/models/negotiable-quote-model';\nimport { transformQuote } from '@/quote-management/data/transforms';\n\nexport interface RequestNegotiableQuoteInput {\n cartId: string;\n quoteName: string;\n comment: string;\n isDraft?: boolean;\n}\n\nexport const requestNegotiableQuote = async (\n input: RequestNegotiableQuoteInput\n): Promise<NegotiableQuoteModel | null> => {\n const { cartId, quoteName, comment, isDraft } = input;\n\n if (!cartId) {\n throw new Error('Cart ID is required');\n }\n\n if (!quoteName) {\n throw new Error('Quote name is required');\n }\n\n if (!comment) {\n throw new Error('Comment is required');\n }\n\n return fetchGraphQl(REQUEST_NEGOTIABLE_QUOTE_MUTATION, {\n variables: {\n cartId,\n quoteName,\n comment: {\n comment\n },\n isDraft,\n },\n }).then((response) => {\n const { errors } = response;\n\n if (errors) {\n // Provide more detailed error information\n const errorMessages = errors.map((error) => error.message).join('; ');\n throw new Error(`Failed to request negotiable quote: ${errorMessages}`);\n }\n\n // Transform the quote data\n const quoteData = transformQuote(response.data?.requestNegotiableQuote?.quote);\n\n if (!quoteData) {\n throw new Error(\n 'Failed to transform quote data: Invalid response structure'\n );\n }\n\n // Emit event with transformed quote data on success\n events.emit('quote-management/negotiable-quote-requested', {\n quote: quoteData,\n input: { cartId, quoteName, comment, isDraft },\n });\n\n return quoteData;\n });\n};\n"],"names":["DEFAULT_PERMISSIONS","_state","state","target","key","value","transformQuote","quoteData","comment","item","_b","_a","discount","tax","NEGOTIABLE_QUOTE_FRAGMENT","REQUEST_NEGOTIABLE_QUOTE_MUTATION","requestNegotiableQuote","input","cartId","quoteName","isDraft","fetchGraphQl","response","errors","errorMessages","error","events"],"mappings":"oHAWO,MAAMA,EAAsB,CAC/B,aAAc,GACd,UAAW,GACX,YAAa,GACb,cAAe,EACnB,EAEMC,EAAgB,CAClB,cAAe,GACf,YAAaD,CACjB,EAGaE,EAAQ,IAAI,MAAMD,EAAQ,CACnC,IAAK,CAACE,EAAQC,IACHD,EAAOC,CAAkB,EAEpC,IAAK,CAACD,EAAQC,EAAKC,KACfF,EAAOC,CAAkB,EAAIC,EACtB,GAEf,CAAC,ECbM,SAASC,EAAeC,EAA6C,CAC1E,OAAKA,EAEE,CACL,IAAKA,EAAU,IACf,KAAMA,EAAU,KAChB,UAAWA,EAAU,WACrB,OAAQA,EAAU,OAClB,MAA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AG,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"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { FunctionComponent, VNode } from 'preact';
|
|
2
|
+
import { HTMLAttributes } from 'preact/compat';
|
|
3
|
+
|
|
4
|
+
export interface ActionsBarProps extends HTMLAttributes<HTMLDivElement> {
|
|
5
|
+
dropdownPlaceholder?: string;
|
|
6
|
+
dropdownOptions?: {
|
|
7
|
+
label: string;
|
|
8
|
+
value: string;
|
|
9
|
+
}[];
|
|
10
|
+
handleDropdownChange?: (event: Event) => void;
|
|
11
|
+
buttons?: VNode[];
|
|
12
|
+
}
|
|
13
|
+
export declare const ActionsBar: FunctionComponent<ActionsBarProps>;
|
|
14
|
+
//# sourceMappingURL=ActionsBar.d.ts.map
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/********************************************************************
|
|
2
|
+
* Copyright 2025 Adobe
|
|
3
|
+
* All Rights Reserved.
|
|
4
|
+
*
|
|
5
|
+
* NOTICE: Adobe permits you to use, modify, and distribute this
|
|
6
|
+
* file in accordance with the terms of the Adobe license agreement
|
|
7
|
+
* accompanying it.
|
|
8
|
+
*******************************************************************/
|
|
9
|
+
export * from './ActionsBar';
|
|
10
|
+
export { ActionsBar as default } from './ActionsBar';
|
|
11
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { FunctionComponent, VNode } from 'preact';
|
|
2
|
+
import { HTMLAttributes } from 'preact/compat';
|
|
3
|
+
|
|
4
|
+
export interface ItemsQuotedProps extends HTMLAttributes<HTMLDivElement> {
|
|
5
|
+
table?: VNode;
|
|
6
|
+
pricesSummary?: VNode;
|
|
7
|
+
}
|
|
8
|
+
export declare const ItemsQuoted: FunctionComponent<ItemsQuotedProps>;
|
|
9
|
+
//# sourceMappingURL=ItemsQuoted.d.ts.map
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/********************************************************************
|
|
2
|
+
* Copyright 2025 Adobe
|
|
3
|
+
* All Rights Reserved.
|
|
4
|
+
*
|
|
5
|
+
* NOTICE: Adobe permits you to use, modify, and distribute this
|
|
6
|
+
* file in accordance with the terms of the Adobe license agreement
|
|
7
|
+
* accompanying it.
|
|
8
|
+
*******************************************************************/
|
|
9
|
+
export * from './ItemsQuoted';
|
|
10
|
+
export { ItemsQuoted as default } from './ItemsQuoted';
|
|
11
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { FunctionComponent, VNode } from 'preact';
|
|
2
|
+
import { HTMLAttributes } from 'preact/compat';
|
|
3
|
+
|
|
4
|
+
export interface ManageNegotiableQuoteProps extends HTMLAttributes<HTMLDivElement> {
|
|
5
|
+
quoteName: VNode;
|
|
6
|
+
quoteStatus: VNode;
|
|
7
|
+
banner?: VNode;
|
|
8
|
+
details: VNode;
|
|
9
|
+
actionBar?: VNode;
|
|
10
|
+
quoteContent: VNode;
|
|
11
|
+
shippingInformationTitle: VNode;
|
|
12
|
+
shippingInformation: VNode;
|
|
13
|
+
quoteCommentsTitle: VNode;
|
|
14
|
+
quoteComments: VNode;
|
|
15
|
+
footer: VNode;
|
|
16
|
+
}
|
|
17
|
+
export declare const ManageNegotiableQuote: FunctionComponent<ManageNegotiableQuoteProps>;
|
|
18
|
+
//# sourceMappingURL=ManageNegotiableQuote.d.ts.map
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/********************************************************************
|
|
2
|
+
* Copyright 2025 Adobe
|
|
3
|
+
* All Rights Reserved.
|
|
4
|
+
*
|
|
5
|
+
* NOTICE: Adobe permits you to use, modify, and distribute this
|
|
6
|
+
* file in accordance with the terms of the Adobe license agreement
|
|
7
|
+
* accompanying it.
|
|
8
|
+
*******************************************************************/
|
|
9
|
+
export * from './ManageNegotiableQuote';
|
|
10
|
+
export { ManageNegotiableQuote as default } from './ManageNegotiableQuote';
|
|
11
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { FunctionComponent } from 'preact';
|
|
2
|
+
import { HTMLAttributes } from 'preact/compat';
|
|
3
|
+
import { NegotiableQuoteModel } from '../../data/models/negotiable-quote-model';
|
|
4
|
+
|
|
5
|
+
export interface ProductListTableProps extends HTMLAttributes<HTMLDivElement | HTMLFormElement> {
|
|
6
|
+
items: NegotiableQuoteModel['items'];
|
|
7
|
+
canEdit: boolean;
|
|
8
|
+
onItemCheckboxChange?: (item: NegotiableQuoteModel['items'][number], isSelected: boolean) => void;
|
|
9
|
+
onItemDropdownChange?: (item: NegotiableQuoteModel['items'][number], action: string) => void;
|
|
10
|
+
onUpdate?: (e: SubmitEvent) => void;
|
|
11
|
+
}
|
|
12
|
+
export declare const ProductListTable: FunctionComponent<ProductListTableProps>;
|
|
13
|
+
//# sourceMappingURL=ProductListTable.d.ts.map
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/********************************************************************
|
|
2
|
+
* Copyright 2025 Adobe
|
|
3
|
+
* All Rights Reserved.
|
|
4
|
+
*
|
|
5
|
+
* NOTICE: Adobe permits you to use, modify, and distribute this
|
|
6
|
+
* file in accordance with the terms of the Adobe license agreement
|
|
7
|
+
* accompanying it.
|
|
8
|
+
*******************************************************************/
|
|
9
|
+
export * from './ProductListTable';
|
|
10
|
+
export { ProductListTable as default } from './ProductListTable';
|
|
11
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { FunctionComponent, VNode } from 'preact';
|
|
2
|
+
import { HTMLAttributes } from 'preact/compat';
|
|
3
|
+
|
|
4
|
+
interface Entry {
|
|
5
|
+
label: string;
|
|
6
|
+
id: string;
|
|
7
|
+
value: VNode;
|
|
8
|
+
strong?: boolean;
|
|
9
|
+
children?: Entry[];
|
|
10
|
+
}
|
|
11
|
+
export interface QuotePricesSummaryProps extends HTMLAttributes<HTMLDivElement> {
|
|
12
|
+
entries?: Entry[];
|
|
13
|
+
}
|
|
14
|
+
export declare const QuotePricesSummary: FunctionComponent<QuotePricesSummaryProps>;
|
|
15
|
+
export {};
|
|
16
|
+
//# sourceMappingURL=QuotePricesSummary.d.ts.map
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/********************************************************************
|
|
2
|
+
* Copyright 2025 Adobe
|
|
3
|
+
* All Rights Reserved.
|
|
4
|
+
*
|
|
5
|
+
* NOTICE: Adobe permits you to use, modify, and distribute this
|
|
6
|
+
* file in accordance with the terms of the Adobe license agreement
|
|
7
|
+
* accompanying it.
|
|
8
|
+
*******************************************************************/
|
|
9
|
+
export * from './QuotePricesSummary';
|
|
10
|
+
export { QuotePricesSummary as default } from './QuotePricesSummary';
|
|
11
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { FunctionComponent, VNode } from 'preact';
|
|
2
|
+
import { HTMLAttributes } from 'preact/compat';
|
|
3
|
+
|
|
4
|
+
export interface TabbedContentProps extends HTMLAttributes<HTMLDivElement> {
|
|
5
|
+
tabs: Map<string, string>;
|
|
6
|
+
tabsContent: Map<string, VNode>;
|
|
7
|
+
defaultActiveTab?: string;
|
|
8
|
+
}
|
|
9
|
+
export declare const TabbedContent: FunctionComponent<TabbedContentProps>;
|
|
10
|
+
//# sourceMappingURL=TabbedContent.d.ts.map
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/********************************************************************
|
|
2
|
+
* Copyright 2025 Adobe
|
|
3
|
+
* All Rights Reserved.
|
|
4
|
+
*
|
|
5
|
+
* NOTICE: Adobe permits you to use, modify, and distribute this
|
|
6
|
+
* file in accordance with the terms of the Adobe license agreement
|
|
7
|
+
* accompanying it.
|
|
8
|
+
*******************************************************************/
|
|
9
|
+
export * from './TabbedContent';
|
|
10
|
+
export { TabbedContent as default } from './TabbedContent';
|
|
11
|
+
//# sourceMappingURL=index.d.ts.map
|
package/components/index.d.ts
CHANGED
|
@@ -1,2 +1,8 @@
|
|
|
1
1
|
export * from './RequestNegotiableQuoteForm';
|
|
2
|
+
export * from './ManageNegotiableQuote';
|
|
3
|
+
export * from './TabbedContent';
|
|
4
|
+
export * from './ActionsBar';
|
|
5
|
+
export * from './ProductListTable';
|
|
6
|
+
export * from './QuotePricesSummary';
|
|
7
|
+
export * from './ItemsQuoted';
|
|
2
8
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { HTMLAttributes } from 'preact/compat';
|
|
2
|
+
import { Container, SlotProps } from '@dropins/tools/types/elsie/src/lib';
|
|
3
|
+
import { NegotiableQuoteModel } from '../../data/models/negotiable-quote-model';
|
|
4
|
+
|
|
5
|
+
export interface ItemsQuotedProps extends HTMLAttributes<HTMLDivElement> {
|
|
6
|
+
quoteData?: NegotiableQuoteModel;
|
|
7
|
+
onItemCheckboxChange?: (item: NegotiableQuoteModel['items'][number], isSelected: boolean) => void;
|
|
8
|
+
onItemDropdownChange?: (item: NegotiableQuoteModel['items'][number], action: string) => void;
|
|
9
|
+
onUpdate?: (e: SubmitEvent) => void;
|
|
10
|
+
slots?: {
|
|
11
|
+
ProductListTable?: SlotProps<{
|
|
12
|
+
items: NegotiableQuoteModel['items'];
|
|
13
|
+
canEdit: boolean;
|
|
14
|
+
onItemCheckboxChange?: (item: NegotiableQuoteModel['items'][number], isSelected: boolean) => void;
|
|
15
|
+
onItemDropdownChange?: (item: NegotiableQuoteModel['items'][number], action: string) => void;
|
|
16
|
+
onUpdate?: (e: SubmitEvent) => void;
|
|
17
|
+
}>;
|
|
18
|
+
QuotePricesSummary?: SlotProps<{
|
|
19
|
+
items: NegotiableQuoteModel['items'];
|
|
20
|
+
prices: NegotiableQuoteModel['prices'];
|
|
21
|
+
}>;
|
|
22
|
+
};
|
|
23
|
+
}
|
|
24
|
+
export declare const ItemsQuoted: Container<ItemsQuotedProps>;
|
|
25
|
+
//# sourceMappingURL=ItemsQuoted.d.ts.map
|