@dropins/storefront-quote-management 0.0.1-alpha16 → 0.0.1-alpha18
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/deleteQuote/deleteQuote.d.ts +28 -0
- package/api/deleteQuote/graphql/DeleteQuoteMutation.d.ts +10 -0
- package/api/deleteQuote/index.d.ts +10 -0
- package/api/graphql/NegotiableQuoteAddressFragment.d.ts +10 -0
- package/api/graphql/NegotiableQuoteFragment.d.ts +1 -1
- package/api/graphql/ShippingMethodFragment.d.ts +10 -0
- package/api/index.d.ts +1 -0
- package/api.js +6 -6
- package/api.js.map +1 -1
- package/chunks/NegotiableQuoteFragment.js +74 -26
- package/chunks/NegotiableQuoteFragment.js.map +1 -1
- package/chunks/OrderSummaryLine.js +4 -0
- package/chunks/OrderSummaryLine.js.map +1 -0
- package/chunks/WarningFilled.js +1 -1
- package/chunks/WarningFilled.js.map +1 -1
- package/chunks/fetch-graphql.js +4 -0
- package/chunks/fetch-graphql.js.map +1 -0
- package/chunks/negotiableQuotes.js +2 -2
- package/chunks/negotiableQuotes.js.map +1 -1
- package/chunks/sendForReview.js +35 -3
- package/chunks/sendForReview.js.map +1 -1
- package/chunks/state.js +4 -0
- package/chunks/state.js.map +1 -0
- package/chunks/uploadFile.js +5 -5
- package/chunks/uploadFile.js.map +1 -1
- package/components/ConfirmationModal/ConfirmationModal.d.ts +16 -0
- package/components/ConfirmationModal/index.d.ts +11 -0
- package/components/OrderSummary/OrderSummary.d.ts +7 -26
- package/components/index.d.ts +1 -0
- package/containers/ManageNegotiableQuote.js +1 -1
- package/containers/ManageNegotiableQuote.js.map +1 -1
- package/containers/OrderSummary/OrderSummary.d.ts +11 -0
- package/containers/OrderSummary/index.d.ts +11 -0
- package/containers/OrderSummary.d.ts +3 -0
- package/containers/OrderSummary.js +4 -0
- package/containers/OrderSummary.js.map +1 -0
- package/containers/OrderSummaryLine/OrderSummaryLine.d.ts +14 -0
- package/containers/OrderSummaryLine/index.d.ts +11 -0
- package/containers/OrderSummaryLine.d.ts +3 -0
- package/containers/OrderSummaryLine.js +4 -0
- package/containers/OrderSummaryLine.js.map +1 -0
- package/containers/QuotesListTable.js +1 -1
- package/containers/QuotesListTable.js.map +1 -1
- package/containers/RequestNegotiableQuoteForm.js +1 -1
- package/containers/RequestNegotiableQuoteForm.js.map +1 -1
- package/containers/index.d.ts +14 -4
- package/data/models/index.d.ts +9 -0
- package/data/models/negotiable-quote-model.d.ts +30 -5
- package/data/models/store-config-model.d.ts +24 -0
- package/data/transforms/__fixtures__/negotiableQuoteData.d.ts +55 -0
- package/data/transforms/transform-quote.d.ts +8 -0
- package/i18n/en_US.json.d.ts +28 -0
- package/lib/state.d.ts +2 -0
- package/package.json +1 -1
- package/render.js +2 -2
- package/render.js.map +1 -1
- package/types/state.types.d.ts +3 -0
- package/chunks/transform-quote.js +0 -4
- package/chunks/transform-quote.js.map +0 -1
|
@@ -0,0 +1,28 @@
|
|
|
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 interface DeleteQuoteSuccessResult {
|
|
10
|
+
__typename: 'NegotiableQuoteUidOperationSuccess';
|
|
11
|
+
quoteUid: string;
|
|
12
|
+
}
|
|
13
|
+
export interface DeleteQuoteFailureError {
|
|
14
|
+
__typename: string;
|
|
15
|
+
message?: string;
|
|
16
|
+
uid?: string;
|
|
17
|
+
}
|
|
18
|
+
export interface DeleteQuoteFailureResult {
|
|
19
|
+
__typename: 'DeleteNegotiableQuoteOperationFailure';
|
|
20
|
+
quoteUid: string;
|
|
21
|
+
errors: DeleteQuoteFailureError[];
|
|
22
|
+
}
|
|
23
|
+
export interface DeleteQuoteOutput {
|
|
24
|
+
resultStatus: string;
|
|
25
|
+
operationResults: Array<DeleteQuoteSuccessResult | DeleteQuoteFailureResult>;
|
|
26
|
+
}
|
|
27
|
+
export declare const deleteQuote: (quoteUids: string[] | string) => Promise<DeleteQuoteOutput>;
|
|
28
|
+
//# sourceMappingURL=deleteQuote.d.ts.map
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/********************************************************************
|
|
2
|
+
* Copyright 2025 Adobe
|
|
3
|
+
* All Rights Reserved.
|
|
4
|
+
*
|
|
5
|
+
* NOTICE: Adobe permits you to use, modify, and distribute this
|
|
6
|
+
* file in accordance with the terms of the Adobe license agreement
|
|
7
|
+
* accompanying it.
|
|
8
|
+
*******************************************************************/
|
|
9
|
+
export declare const DELETE_QUOTE_MUTATION = "\n mutation DELETE_QUOTE_MUTATION($quoteUids: [ID!]!) {\n deleteNegotiableQuotes(\n input: {\n quote_uids: $quoteUids\n }\n ) {\n result_status\n operation_results {\n __typename\n ... on NegotiableQuoteUidOperationSuccess {\n quote_uid\n }\n ... on DeleteNegotiableQuoteOperationFailure {\n quote_uid\n errors {\n __typename\n ... on ErrorInterface {\n message\n }\n ... on NoSuchEntityUidError {\n uid\n message\n }\n ... on NegotiableQuoteInvalidStateError {\n message\n }\n }\n }\n }\n }\n }\n";
|
|
10
|
+
//# sourceMappingURL=DeleteQuoteMutation.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 './deleteQuote';
|
|
10
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/********************************************************************
|
|
2
|
+
* Copyright 2025 Adobe
|
|
3
|
+
* All Rights Reserved.
|
|
4
|
+
*
|
|
5
|
+
* NOTICE: Adobe permits you to use, modify, and distribute this
|
|
6
|
+
* file in accordance with the terms of the Adobe license agreement
|
|
7
|
+
* accompanying it.
|
|
8
|
+
*******************************************************************/
|
|
9
|
+
export declare const NEGOTIABLE_QUOTE_SHIPPING_ADDRESS_FRAGMENT: string;
|
|
10
|
+
//# sourceMappingURL=NegotiableQuoteAddressFragment.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
|
|
17
|
+
export declare const NEGOTIABLE_QUOTE_FRAGMENT: string;
|
|
18
18
|
//# sourceMappingURL=NegotiableQuoteFragment.d.ts.map
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/********************************************************************
|
|
2
|
+
* Copyright 2025 Adobe
|
|
3
|
+
* All Rights Reserved.
|
|
4
|
+
*
|
|
5
|
+
* NOTICE: Adobe permits you to use, modify, and distribute this
|
|
6
|
+
* file in accordance with the terms of the Adobe license agreement
|
|
7
|
+
* accompanying it.
|
|
8
|
+
*******************************************************************/
|
|
9
|
+
export declare const SELECTED_SHIPPING_METHOD_FRAGMENT = "\n fragment SELECTED_SHIPPING_METHOD_FRAGMENT on SelectedShippingMethod {\n amount {\n currency\n value\n }\n carrier_code\n carrier_title\n method_code\n method_title\n price_excl_tax {\n value\n currency\n }\n price_incl_tax {\n value\n currency\n }\n }\n";
|
|
10
|
+
//# sourceMappingURL=ShippingMethodFragment.d.ts.map
|
package/api/index.d.ts
CHANGED
|
@@ -4,6 +4,7 @@ export * from './getCustomerData';
|
|
|
4
4
|
export * from './requestNegotiableQuote';
|
|
5
5
|
export * from './getQuoteData';
|
|
6
6
|
export * from './negotiableQuotes';
|
|
7
|
+
export * from './deleteQuote';
|
|
7
8
|
export * from './setShippingAddress';
|
|
8
9
|
export * from './sendForReview';
|
|
9
10
|
export * from './uploadFile';
|
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 i,s as n}from"./chunks/state.js";import{events as r}from"@dropins/tools/event-bus.js";import{f as l,t as Q}from"./chunks/fetch-graphql.js";import{d as z,r as H,s as L,b as B,c as V}from"./chunks/fetch-graphql.js";import{r as K,u as J}from"./chunks/uploadFile.js";import{N as h}from"./chunks/NegotiableQuoteFragment.js";import{F as X,N as Z,S as ee,n as te}from"./chunks/negotiableQuotes.js";import{d as se,s as re}from"./chunks/sendForReview.js";import{Initializer as _}from"@dropins/tools/lib.js";import"@dropins/tools/fetch-graphql.js";const q=`
|
|
4
4
|
fragment CUSTOMER_FRAGMENT on Customer {
|
|
5
5
|
role {
|
|
6
6
|
permissions {
|
|
@@ -17,15 +17,15 @@ import{D as a,s as n,t as p}from"./chunks/transform-quote.js";import{fetchGraphQ
|
|
|
17
17
|
}
|
|
18
18
|
}
|
|
19
19
|
}
|
|
20
|
-
`,
|
|
20
|
+
`,I=`
|
|
21
21
|
query CUSTOMER_QUERY {
|
|
22
22
|
customer {
|
|
23
23
|
...CUSTOMER_FRAGMENT
|
|
24
24
|
}
|
|
25
25
|
}
|
|
26
26
|
|
|
27
|
-
${
|
|
28
|
-
`,
|
|
27
|
+
${q}
|
|
28
|
+
`,T="All/Quotes/View/Request, Edit, Delete",S="All/Quotes/View/Request, Edit, Delete",A="All/Quotes/View/Request, Edit, Delete",N="All/Quotes/View/Checkout with quote",U=o=>{const e=[],t=(s,u=[])=>{for(const a of s){const d=[...u,a.text];a.children&&a.children.length>0?t(a.children,d):e.push(d.join("/"))}};return t(o),e};function R(o){const{role:e}=o;if(!e)return{permissions:{canRequestQuote:i.requestQuote,canEditQuote:i.editQuote,canDeleteQuote:i.deleteQuote,canCheckoutQuote:i.checkoutQuote}};const{permissions:t}=e,s=U(t);return{permissions:{canRequestQuote:s.includes(T),canEditQuote:s.includes(S),canDeleteQuote:s.includes(A),canCheckoutQuote:s.includes(N)}}}const D=async()=>{var o;if(!n.authenticated)return Promise.reject(new Error("Unauthorized"));try{const e=await l(I);if(!((o=e==null?void 0:e.data)!=null&&o.customer))throw new Error("No customer data received");return R(e.data.customer)}catch(e){return Promise.reject(e)}},w=`
|
|
29
29
|
query QUOTE_DATA_QUERY(
|
|
30
30
|
$quoteId: ID!
|
|
31
31
|
) {
|
|
@@ -37,7 +37,7 @@ import{D as a,s as n,t as p}from"./chunks/transform-quote.js";import{fetchGraphQ
|
|
|
37
37
|
}
|
|
38
38
|
|
|
39
39
|
${h}
|
|
40
|
-
`,
|
|
40
|
+
`,C=async o=>{var e;if(!n.authenticated)return Promise.reject(new Error("Unauthorized"));if(!n.permissions.editQuote)return Promise.reject(new Error("Unauthorized"));try{const t=await l(w,{variables:{quoteId:o}}),s=Q((e=t==null?void 0:t.data)==null?void 0:e.negotiableQuote);if(!s)throw new Error("Failed to transform quote data");return r.emit("quote-management/quote-data",{quote:s,permissions:n.permissions}),s}catch(t){return Promise.reject(t)}},m=new _({init:async o=>{const e={};m.config.setConfig({...e,...o})},listeners:()=>[r.on("authenticated",async o=>{n.authenticated=!!o,o?D().then(e=>{n.permissions={requestQuote:e.permissions.canRequestQuote,editQuote:e.permissions.canEditQuote,deleteQuote:e.permissions.canDeleteQuote,checkoutQuote:e.permissions.canCheckoutQuote},r.emit("quote-management/permissions",n.permissions)}).catch(e=>{console.error(e),n.permissions=i,r.emit("quote-management/permissions",i)}):(n.permissions=i,r.emit("quote-management/permissions",i))},{eager:!0}),r.on("quote-management/permissions",async o=>{const e=m.config.getConfig().quoteId;e&&o.editQuote&&C(e).then(t=>{r.emit("quote-management/quote-data/initialized",{quote:t,permissions:o},{})}).catch(t=>{r.emit("quote-management/quote-data/error",{error:t})})},{eager:!0})]}),$=m.config,O=`
|
|
41
41
|
mutation SET_NEGOTIABLE_QUOTE_SHIPPING_ADDRESS_MUTATION(
|
|
42
42
|
$quoteUid: ID!
|
|
43
43
|
$addressId: ID
|
|
@@ -58,5 +58,5 @@ import{D as a,s as n,t as p}from"./chunks/transform-quote.js";import{fetchGraphQ
|
|
|
58
58
|
}
|
|
59
59
|
}
|
|
60
60
|
${h}
|
|
61
|
-
`;function
|
|
61
|
+
`;function F(o){const{additionalInput:e,...t}=o,s={city:t.city,company:t.company,country_code:t.countryCode,firstname:t.firstname,lastname:t.lastname,postcode:t.postcode,region:t.region,region_id:t.regionId,save_in_address_book:t.saveInAddressBook,street:t.street,telephone:t.telephone};return{...e||{},...s}}const x=async o=>{const{quoteUid:e,addressId:t,addressData:s}=o;if(!e)throw new Error("Quote UID is required");if(t===void 0&&!s)throw new Error("Either addressId or addressData must be provided");if(t!==void 0&&s)throw new Error("Cannot provide both addressId and addressData");const u=s?F(s):null;return l(O,{variables:{quoteUid:e,addressId:t||null,addressData:u}}).then(a=>{var E,p;const{errors:d}=a;if(d){const f=d.map(g=>g.message).join("; ");throw new Error(`Failed to set shipping address: ${f}`)}const c=Q((p=(E=a.data)==null?void 0:E.setNegotiableQuoteShippingAddress)==null?void 0:p.quote);if(!c)throw new Error("Failed to transform quote data: Invalid response structure");return r.emit("quote-management/shipping-address-set",{quote:c,input:{quoteUid:e,addressId:t,addressData:s}}),c})};export{X as FilterMatchTypeEnum,Z as NegotiableQuoteSortableField,ee as SortEnum,$ as config,se as deleteQuote,l as fetchGraphQl,z as getConfig,D as getCustomerData,C as getQuoteData,m as initialize,te as negotiableQuotes,H as removeFetchGraphQlHeader,K as requestNegotiableQuote,re as sendForReview,L as setEndpoint,B as setFetchGraphQlHeader,V as setFetchGraphQlHeaders,x as setShippingAddress,J as uploadFile};
|
|
62
62
|
//# sourceMappingURL=api.js.map
|
package/api.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"api.js","sources":["/@dropins/storefront-quote-management/src/api/graphql/CustomerFragment.ts","/@dropins/storefront-quote-management/src/api/getCustomerData/graphql/CustomerQuery.ts","/@dropins/storefront-quote-management/src/data/transforms/transform-customer.ts","/@dropins/storefront-quote-management/src/api/getCustomerData/getCustomerData.ts","/@dropins/storefront-quote-management/src/api/getQuoteData/graphql/QuoteDataQuery.ts","/@dropins/storefront-quote-management/src/api/getQuoteData/getQuoteData.ts","/@dropins/storefront-quote-management/src/api/initialize/initialize.ts","/@dropins/storefront-quote-management/src/api/setShippingAddress/graphql/SetNegotiableQuoteShippingAddressMutation.ts","/@dropins/storefront-quote-management/src/api/setShippingAddress/setShippingAddress.ts"],"sourcesContent":["export const CUSTOMER_FRAGMENT = /* GraphQL */ `\n fragment CUSTOMER_FRAGMENT on Customer {\n role {\n permissions {\n text\n children {\n text\n children {\n text\n children {\n text\n }\n }\n }\n }\n }\n }\n`","import { CUSTOMER_FRAGMENT } from '@/quote-management/api/graphql/CustomerFragment';\n\nexport const CUSTOMER_QUERY = `\n query CUSTOMER_QUERY {\n customer {\n ...CUSTOMER_FRAGMENT\n }\n }\n\n ${CUSTOMER_FRAGMENT}\n`","/********************************************************************\n * Copyright 2025 Adobe\n * All Rights Reserved.\n *\n * NOTICE: Adobe permits you to use, modify, and distribute this \n * file in accordance with the terms of the Adobe license agreement \n * accompanying it. \n *******************************************************************/\n\nimport { DEFAULT_PERMISSIONS } from \"@/quote-management/lib/state\";\nimport { CustomerModel } from \"../models\";\n\ntype PermissionsSchema = {\n text: string;\n children: PermissionsSchema[];\n}\n\nconst CAN_REQUEST_QUOTE_PERMISSION = 'All/Quotes/View/Request, Edit, Delete';\nconst CAN_EDIT_QUOTE_PERMISSION = 'All/Quotes/View/Request, Edit, Delete';\nconst CAN_DELETE_QUOTE_PERMISSION = 'All/Quotes/View/Request, Edit, Delete';\nconst CAN_CHECKOUT_QUOTE_PERMISSION = 'All/Quotes/View/Checkout with quote';\n\n/**\n * Flatten the permissions into a list of strings\n * @param permissions - The permissions to flatten\n * @returns A list of strings representing the flattened permissions\n */\nexport const flattenPermissions = (permissions: PermissionsSchema[]): string[] => {\n const result: string[] = [];\n \n // Recursively traverse the permissions and build the path\n const traverse = (nodes: PermissionsSchema[], path: string[] = []) => {\n for (const node of nodes) {\n const currentPath = [...path, node.text];\n \n if (node.children && node.children.length > 0) {\n traverse(node.children, currentPath);\n } else {\n result.push(currentPath.join('/'));\n }\n }\n };\n \n traverse(permissions);\n return result;\n}\n\nexport function transformCustomer(customerData: any): CustomerModel {\n const { role } = customerData;\n\n if (!role) {\n return {\n permissions: {\n canRequestQuote: DEFAULT_PERMISSIONS.requestQuote,\n canEditQuote: DEFAULT_PERMISSIONS.editQuote,\n canDeleteQuote: DEFAULT_PERMISSIONS.deleteQuote,\n canCheckoutQuote: DEFAULT_PERMISSIONS.checkoutQuote,\n },\n };\n }\n\n const { permissions } = role;\n\n const flattenedPermissions = flattenPermissions(permissions);\n return {\n permissions: {\n canRequestQuote: flattenedPermissions.includes(CAN_REQUEST_QUOTE_PERMISSION),\n canEditQuote: flattenedPermissions.includes(CAN_EDIT_QUOTE_PERMISSION),\n canDeleteQuote: flattenedPermissions.includes(CAN_DELETE_QUOTE_PERMISSION),\n canCheckoutQuote: flattenedPermissions.includes(CAN_CHECKOUT_QUOTE_PERMISSION),\n }\n }\n}","/********************************************************************\n * Copyright 2025 Adobe\n * All Rights Reserved.\n *\n * NOTICE: Adobe permits you to use, modify, and distribute this \n * file in accordance with the terms of the Adobe license agreement \n * accompanying it. \n *******************************************************************/\n\nimport { fetchGraphQl } from '@/quote-management/api/';\nimport { CUSTOMER_QUERY } from './graphql/CustomerQuery';\nimport { transformCustomer } from '@/quote-management/data/transforms';\nimport { state } from '@/quote-management/lib/state';\n\nexport const getCustomerData = async () => { \n if (!state.authenticated) {\n return Promise.reject(new Error('Unauthorized'));\n }\n\n try {\n const results: any = await fetchGraphQl(CUSTOMER_QUERY);\n \n if (!results?.data?.customer) {\n throw new Error('No customer data received');\n }\n \n return transformCustomer(results.data.customer);\n } catch (error) {\n return Promise.reject(error);\n }\n}\n","import { NEGOTIABLE_QUOTE_FRAGMENT } from '@/quote-management/api/graphql/NegotiableQuoteFragment';\n\nexport const QUOTE_DATA_QUERY = `\n query QUOTE_DATA_QUERY(\n $quoteId: ID!\n ) {\n negotiableQuote(\n uid: $quoteId\n ) {\n ...NegotiableQuoteFragment\n }\n }\n\n ${NEGOTIABLE_QUOTE_FRAGMENT}\n`","/********************************************************************\n * Copyright 2025 Adobe\n * All Rights Reserved.\n *\n * NOTICE: Adobe permits you to use, modify, and distribute this \n * file in accordance with the terms of the Adobe license agreement \n * accompanying it. \n *******************************************************************/\n\nimport { fetchGraphQl } from '@/quote-management/api/';\nimport { QUOTE_DATA_QUERY } from './graphql/QuoteDataQuery';\nimport { transformQuote } from '@/quote-management/data/transforms';\nimport { state } from '@/quote-management/lib/state';\nimport { events } from '@adobe-commerce/event-bus';\n\nexport const getQuoteData = async (quoteId: string) => { \n if (!state.authenticated) {\n return Promise.reject(new Error('Unauthorized'));\n }\n\n if (!state.permissions.editQuote) {\n return Promise.reject(new Error('Unauthorized'));\n }\n\n try {\n const results: any = await fetchGraphQl(QUOTE_DATA_QUERY, {\n variables: {\n quoteId\n }\n });\n\n const transformedQuote = transformQuote(results?.data?.negotiableQuote);\n\n if (!transformedQuote) {\n throw new Error('Failed to transform quote data');\n }\n\n events.emit('quote-management/quote-data', {\n quote: transformedQuote,\n permissions: state.permissions,\n });\n \n return transformedQuote;\n } catch (error) {\n return Promise.reject(error);\n }\n}\n","import { Initializer } from '@adobe-commerce/elsie/lib';\nimport { Lang } from '@adobe-commerce/elsie/i18n';\nimport { events } from '@adobe-commerce/event-bus';\nimport { state, DEFAULT_PERMISSIONS } from '@/quote-management/lib/state';\nimport { getCustomerData } from '@/quote-management/api/getCustomerData';\nimport { getQuoteData } from '@/quote-management/api/getQuoteData';\n\ntype ConfigProps = {\n langDefinitions?: Lang;\n quoteId?: string;\n};\n\nexport const initialize = new Initializer<ConfigProps>({\n init: async (config) => {\n const defaultConfig = {};\n\n initialize.config.setConfig({ ...defaultConfig, ...config });\n },\n\n listeners: () => [\n events.on('authenticated', async (authenticated) => {\n state.authenticated = !!authenticated;\n\n if (authenticated) {\n getCustomerData().then((customerData) => {\n state.permissions = {\n requestQuote: customerData.permissions.canRequestQuote,\n editQuote: customerData.permissions.canEditQuote,\n deleteQuote: customerData.permissions.canDeleteQuote,\n checkoutQuote: customerData.permissions.canCheckoutQuote,\n };\n events.emit('quote-management/permissions', state.permissions);\n })\n .catch((error) => {\n console.error(error);\n state.permissions = DEFAULT_PERMISSIONS;\n events.emit('quote-management/permissions', DEFAULT_PERMISSIONS);\n });\n } else {\n state.permissions = DEFAULT_PERMISSIONS;\n events.emit('quote-management/permissions', DEFAULT_PERMISSIONS);\n }\n }, {\n eager: true,\n }),\n events.on('quote-management/permissions', async (permissions) => {\n const quoteId = initialize.config.getConfig().quoteId;\n if (!quoteId) {\n return;\n }\n\n if (permissions.editQuote) {\n getQuoteData(quoteId).then((quoteData) => {\n events.emit('quote-management/quote-data/initialized', {\n quote: quoteData,\n permissions,\n }, {});\n }).catch((error) => {\n events.emit('quote-management/quote-data/error', {\n error,\n });\n });\n }\n }, {\n eager: true,\n }),\n ],\n});\n\nexport const config = initialize.config;\n","/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2024 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\n\nimport { NEGOTIABLE_QUOTE_FRAGMENT } from '@/quote-management/api/graphql/NegotiableQuoteFragment';\n\nexport const SET_NEGOTIABLE_QUOTE_SHIPPING_ADDRESS_MUTATION = `\n mutation SET_NEGOTIABLE_QUOTE_SHIPPING_ADDRESS_MUTATION(\n $quoteUid: ID!\n $addressId: ID\n $addressData: NegotiableQuoteAddressInput\n ) {\n setNegotiableQuoteShippingAddress(\n input: {\n quote_uid: $quoteUid\n shipping_addresses: {\n customer_address_uid: $addressId\n address: $addressData\n }\n }\n ) {\n quote {\n ...NegotiableQuoteFragment\n }\n }\n }\n ${NEGOTIABLE_QUOTE_FRAGMENT}\n`;\n\n","/********************************************************************\n * Copyright 2025 Adobe\n * All Rights Reserved.\n *\n * NOTICE: Adobe permits you to use, modify, and distribute this\n * file in accordance with the terms of the Adobe license agreement\n * accompanying it.\n *******************************************************************/\n\nimport { fetchGraphQl } from '@adobe-commerce/fetch-graphql';\nimport { events } from '@adobe-commerce/event-bus';\nimport { SET_NEGOTIABLE_QUOTE_SHIPPING_ADDRESS_MUTATION } from './graphql/SetNegotiableQuoteShippingAddressMutation';\nimport { NegotiableQuoteModel } from '@/quote-management/data/models/negotiable-quote-model';\nimport { transformQuote } from '@/quote-management/data/transforms';\n\nexport interface AddressInput {\n /** City name */\n city: string;\n /** Optional company name */\n company?: string;\n /** Two-letter country code (e.g., 'US') */\n countryCode: string;\n /** First name */\n firstname: string;\n /** Last name */\n lastname: string;\n /** Postal/ZIP code */\n postcode: string;\n /** Optional state/province name */\n region?: string;\n /** Optional state/province ID */\n regionId?: number;\n /** Whether to save this address to the customer's address book */\n saveInAddressBook?: boolean;\n /** Street address lines (array) */\n street: string[];\n /** Phone number */\n telephone: string;\n /** \n * Additional input (optional custom fields for the address).\n * These fields will be merged into the address data sent to GraphQL.\n * Standard fields take precedence over additional fields to prevent\n * accidental override of required address attributes.\n * \n * @example\n * ```ts\n * additionalInput: {\n * vat_id: 'GB123456789',\n * custom_attribute: 'value',\n * delivery_instructions: 'Leave at door'\n * }\n * ```\n */\n additionalInput?: Record<string, any>;\n}\n\nexport interface SetShippingAddressInput {\n /** The unique ID of the negotiable quote */\n quoteUid: string;\n /** The ID of a saved customer address (use this OR addressData, not both) */\n addressId?: number;\n /** New address data (use this OR addressId, not both) */\n addressData?: AddressInput;\n}\n\n/**\n * Transform camelCase address data to snake_case for GraphQL mutation.\n * Additional fields from additionalInput are spread into the result, with\n * standard fields taking precedence (defensive flexibility approach).\n */\nfunction transformAddressToSnakeCase(address: AddressInput) {\n const { additionalInput, ...standardFields } = address;\n \n // Build the standard transformed fields\n const transformedStandardFields = {\n city: standardFields.city,\n company: standardFields.company,\n country_code: standardFields.countryCode,\n firstname: standardFields.firstname,\n lastname: standardFields.lastname,\n postcode: standardFields.postcode,\n region: standardFields.region,\n region_id: standardFields.regionId,\n save_in_address_book: standardFields.saveInAddressBook,\n street: standardFields.street,\n telephone: standardFields.telephone,\n };\n \n // Spread additional input first, then standard fields take precedence\n // This provides defensive flexibility: allows custom fields while protecting core fields\n return {\n ...(additionalInput || {}),\n ...transformedStandardFields,\n };\n}\n\n/**\n * Sets or updates the shipping address for a negotiable quote.\n * \n * @param input - The input parameters for setting the shipping address\n * @param input.quoteUid - The unique ID of the negotiable quote\n * @param input.addressId - Optional ID of a saved customer address (use this OR addressData)\n * @param input.addressData - Optional new address data (use this OR addressId)\n * @param input.addressData.additionalInput - Optional additional address fields to pass through to GraphQL\n * @returns Promise that resolves to the updated quote model with shipping addresses including uid field\n * @throws Error if validation fails or GraphQL operation fails\n * \n * @example\n * ```ts\n * // Using a saved address\n * const quote = await setShippingAddress({\n * quoteUid: 'quote-123',\n * addressId: 5\n * });\n * \n * // Using new address data\n * const quote = await setShippingAddress({\n * quoteUid: 'quote-123',\n * addressData: {\n * firstname: 'John',\n * lastname: 'Doe',\n * street: ['123 Main St'],\n * city: 'San Francisco',\n * countryCode: 'US',\n * postcode: '94103',\n * telephone: '555-1234'\n * }\n * });\n * \n * // Using address data with additional custom fields\n * const quote = await setShippingAddress({\n * quoteUid: 'quote-123',\n * addressData: {\n * firstname: 'John',\n * lastname: 'Doe',\n * street: ['123 Main St'],\n * city: 'San Francisco',\n * countryCode: 'US',\n * postcode: '94103',\n * telephone: '555-1234',\n * additionalInput: {\n * vat_id: 'GB123456789',\n * custom_attribute_1: 'value1',\n * delivery_instructions: 'Leave at door'\n * }\n * }\n * });\n * \n * // Access address identifier\n * if (quote?.shippingAddresses?.[0]) {\n * console.log('Address UID:', quote.shippingAddresses[0].uid);\n * }\n * ```\n */\nexport const setShippingAddress = async (\n input: SetShippingAddressInput\n): Promise<NegotiableQuoteModel | null> => {\n const { quoteUid, addressId, addressData } = input;\n\n if (!quoteUid) {\n throw new Error('Quote UID is required');\n }\n\n // Validate that exactly one of addressId or addressData is provided\n if (addressId === undefined && !addressData) {\n throw new Error('Either addressId or addressData must be provided');\n }\n\n if (addressId !== undefined && addressData) {\n throw new Error('Cannot provide both addressId and addressData');\n }\n\n // Transform addressData to snake_case if provided\n const transformedAddressData = addressData\n ? transformAddressToSnakeCase(addressData)\n : null;\n\n return fetchGraphQl(SET_NEGOTIABLE_QUOTE_SHIPPING_ADDRESS_MUTATION, {\n variables: {\n quoteUid,\n addressId: addressId || null,\n addressData: transformedAddressData,\n },\n }).then((response) => {\n const { errors } = response;\n\n if (errors) {\n // Provide more detailed error information\n const errorMessages = errors.map((error) => error.message).join('; ');\n throw new Error(`Failed to set shipping address: ${errorMessages}`);\n }\n\n // Transform the quote data\n const quoteData = transformQuote(\n response.data?.setNegotiableQuoteShippingAddress?.quote\n );\n\n if (!quoteData) {\n throw new Error(\n 'Failed to transform quote data: Invalid response structure'\n );\n }\n\n // Emit event with transformed quote data on success\n events.emit('quote-management/shipping-address-set', {\n quote: quoteData,\n input: { quoteUid, addressId, addressData },\n });\n\n return quoteData;\n });\n};\n\n"],"names":["CUSTOMER_FRAGMENT","CUSTOMER_QUERY","CAN_REQUEST_QUOTE_PERMISSION","CAN_EDIT_QUOTE_PERMISSION","CAN_DELETE_QUOTE_PERMISSION","CAN_CHECKOUT_QUOTE_PERMISSION","flattenPermissions","permissions","result","traverse","nodes","path","node","currentPath","transformCustomer","customerData","role","DEFAULT_PERMISSIONS","flattenedPermissions","getCustomerData","state","results","fetchGraphQl","_a","error","QUOTE_DATA_QUERY","NEGOTIABLE_QUOTE_FRAGMENT","getQuoteData","quoteId","transformedQuote","transformQuote","events","initialize","Initializer","config","defaultConfig","authenticated","quoteData","SET_NEGOTIABLE_QUOTE_SHIPPING_ADDRESS_MUTATION","transformAddressToSnakeCase","address","additionalInput","standardFields","transformedStandardFields","setShippingAddress","input","quoteUid","addressId","addressData","transformedAddressData","response","errors","errorMessages","_b"],"mappings":"qhBAAO,MAAMA,EAAkC;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,ECElCC,EAAiB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,MAOxBD,CAAiB;AAAA,ECQjBE,EAA+B,wCAC/BC,EAA4B,wCAC5BC,EAA8B,wCAC9BC,EAAgC,sCAOzBC,EAAsBC,GAA+C,CAC9E,MAAMC,EAAmB,CAAA,EAGnBC,EAAW,CAACC,EAA4BC,EAAiB,CAAA,IAAO,CAClE,UAAWC,KAAQF,EAAO,CACtB,MAAMG,EAAc,CAAC,GAAGF,EAAMC,EAAK,IAAI,EAEnCA,EAAK,UAAYA,EAAK,SAAS,OAAS,EACxCH,EAASG,EAAK,SAAUC,CAAW,EAEnCL,EAAO,KAAKK,EAAY,KAAK,GAAG,CAAC,CAEzC,CACJ,EAEA,OAAAJ,EAASF,CAAW,EACbC,CACX,EAEO,SAASM,EAAkBC,EAAkC,CAChE,KAAM,CAAE,KAAAC,GAASD,EAEjB,GAAI,CAACC,EACD,MAAO,CACH,YAAa,CACT,gBAAiBC,EAAoB,aACrC,aAAcA,EAAoB,UAClC,eAAgBA,EAAoB,YACpC,iBAAkBA,EAAoB,aAAA,CAC1C,EAIR,KAAM,CAAE,YAAAV,GAAgBS,EAElBE,EAAuBZ,EAAmBC,CAAW,EAC3D,MAAO,CACH,YAAa,CACT,gBAAiBW,EAAqB,SAAShB,CAA4B,EAC3E,aAAcgB,EAAqB,SAASf,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/api/graphql/CustomerFragment.ts","/@dropins/storefront-quote-management/src/api/getCustomerData/graphql/CustomerQuery.ts","/@dropins/storefront-quote-management/src/data/transforms/transform-customer.ts","/@dropins/storefront-quote-management/src/api/getCustomerData/getCustomerData.ts","/@dropins/storefront-quote-management/src/api/getQuoteData/graphql/QuoteDataQuery.ts","/@dropins/storefront-quote-management/src/api/getQuoteData/getQuoteData.ts","/@dropins/storefront-quote-management/src/api/initialize/initialize.ts","/@dropins/storefront-quote-management/src/api/setShippingAddress/graphql/SetNegotiableQuoteShippingAddressMutation.ts","/@dropins/storefront-quote-management/src/api/setShippingAddress/setShippingAddress.ts"],"sourcesContent":["export const CUSTOMER_FRAGMENT = /* GraphQL */ `\n fragment CUSTOMER_FRAGMENT on Customer {\n role {\n permissions {\n text\n children {\n text\n children {\n text\n children {\n text\n }\n }\n }\n }\n }\n }\n`","import { CUSTOMER_FRAGMENT } from '@/quote-management/api/graphql/CustomerFragment';\n\nexport const CUSTOMER_QUERY = `\n query CUSTOMER_QUERY {\n customer {\n ...CUSTOMER_FRAGMENT\n }\n }\n\n ${CUSTOMER_FRAGMENT}\n`","/********************************************************************\n * Copyright 2025 Adobe\n * All Rights Reserved.\n *\n * NOTICE: Adobe permits you to use, modify, and distribute this \n * file in accordance with the terms of the Adobe license agreement \n * accompanying it. \n *******************************************************************/\n\nimport { DEFAULT_PERMISSIONS } from \"@/quote-management/lib/state\";\nimport { CustomerModel } from \"../models\";\n\ntype PermissionsSchema = {\n text: string;\n children: PermissionsSchema[];\n}\n\nconst CAN_REQUEST_QUOTE_PERMISSION = 'All/Quotes/View/Request, Edit, Delete';\nconst CAN_EDIT_QUOTE_PERMISSION = 'All/Quotes/View/Request, Edit, Delete';\nconst CAN_DELETE_QUOTE_PERMISSION = 'All/Quotes/View/Request, Edit, Delete';\nconst CAN_CHECKOUT_QUOTE_PERMISSION = 'All/Quotes/View/Checkout with quote';\n\n/**\n * Flatten the permissions into a list of strings\n * @param permissions - The permissions to flatten\n * @returns A list of strings representing the flattened permissions\n */\nexport const flattenPermissions = (permissions: PermissionsSchema[]): string[] => {\n const result: string[] = [];\n \n // Recursively traverse the permissions and build the path\n const traverse = (nodes: PermissionsSchema[], path: string[] = []) => {\n for (const node of nodes) {\n const currentPath = [...path, node.text];\n \n if (node.children && node.children.length > 0) {\n traverse(node.children, currentPath);\n } else {\n result.push(currentPath.join('/'));\n }\n }\n };\n \n traverse(permissions);\n return result;\n}\n\nexport function transformCustomer(customerData: any): CustomerModel {\n const { role } = customerData;\n\n if (!role) {\n return {\n permissions: {\n canRequestQuote: DEFAULT_PERMISSIONS.requestQuote,\n canEditQuote: DEFAULT_PERMISSIONS.editQuote,\n canDeleteQuote: DEFAULT_PERMISSIONS.deleteQuote,\n canCheckoutQuote: DEFAULT_PERMISSIONS.checkoutQuote,\n },\n };\n }\n\n const { permissions } = role;\n\n const flattenedPermissions = flattenPermissions(permissions);\n return {\n permissions: {\n canRequestQuote: flattenedPermissions.includes(CAN_REQUEST_QUOTE_PERMISSION),\n canEditQuote: flattenedPermissions.includes(CAN_EDIT_QUOTE_PERMISSION),\n canDeleteQuote: flattenedPermissions.includes(CAN_DELETE_QUOTE_PERMISSION),\n canCheckoutQuote: flattenedPermissions.includes(CAN_CHECKOUT_QUOTE_PERMISSION),\n }\n }\n}","/********************************************************************\n * Copyright 2025 Adobe\n * All Rights Reserved.\n *\n * NOTICE: Adobe permits you to use, modify, and distribute this \n * file in accordance with the terms of the Adobe license agreement \n * accompanying it. \n *******************************************************************/\n\nimport { fetchGraphQl } from '@/quote-management/api/';\nimport { CUSTOMER_QUERY } from './graphql/CustomerQuery';\nimport { transformCustomer } from '@/quote-management/data/transforms';\nimport { state } from '@/quote-management/lib/state';\n\nexport const getCustomerData = async () => { \n if (!state.authenticated) {\n return Promise.reject(new Error('Unauthorized'));\n }\n\n try {\n const results: any = await fetchGraphQl(CUSTOMER_QUERY);\n \n if (!results?.data?.customer) {\n throw new Error('No customer data received');\n }\n \n return transformCustomer(results.data.customer);\n } catch (error) {\n return Promise.reject(error);\n }\n}\n","import { NEGOTIABLE_QUOTE_FRAGMENT } from '@/quote-management/api/graphql/NegotiableQuoteFragment';\n\nexport const QUOTE_DATA_QUERY = `\n query QUOTE_DATA_QUERY(\n $quoteId: ID!\n ) {\n negotiableQuote(\n uid: $quoteId\n ) {\n ...NegotiableQuoteFragment\n }\n }\n\n ${NEGOTIABLE_QUOTE_FRAGMENT}\n`","/********************************************************************\n * Copyright 2025 Adobe\n * All Rights Reserved.\n *\n * NOTICE: Adobe permits you to use, modify, and distribute this \n * file in accordance with the terms of the Adobe license agreement \n * accompanying it. \n *******************************************************************/\n\nimport { fetchGraphQl } from '@/quote-management/api/';\nimport { QUOTE_DATA_QUERY } from './graphql/QuoteDataQuery';\nimport { transformQuote } from '@/quote-management/data/transforms';\nimport { state } from '@/quote-management/lib/state';\nimport { events } from '@adobe-commerce/event-bus';\n\nexport const getQuoteData = async (quoteId: string) => { \n if (!state.authenticated) {\n return Promise.reject(new Error('Unauthorized'));\n }\n\n if (!state.permissions.editQuote) {\n return Promise.reject(new Error('Unauthorized'));\n }\n\n try {\n const results: any = await fetchGraphQl(QUOTE_DATA_QUERY, {\n variables: {\n quoteId\n }\n });\n\n const transformedQuote = transformQuote(results?.data?.negotiableQuote);\n\n if (!transformedQuote) {\n throw new Error('Failed to transform quote data');\n }\n\n events.emit('quote-management/quote-data', {\n quote: transformedQuote,\n permissions: state.permissions,\n });\n \n return transformedQuote;\n } catch (error) {\n return Promise.reject(error);\n }\n}\n","import { Initializer } from '@adobe-commerce/elsie/lib';\nimport { Lang } from '@adobe-commerce/elsie/i18n';\nimport { events } from '@adobe-commerce/event-bus';\nimport { state, DEFAULT_PERMISSIONS } from '@/quote-management/lib/state';\nimport { getCustomerData } from '@/quote-management/api/getCustomerData';\nimport { getQuoteData } from '@/quote-management/api/getQuoteData';\n\ntype ConfigProps = {\n langDefinitions?: Lang;\n quoteId?: string;\n};\n\nexport const initialize = new Initializer<ConfigProps>({\n init: async (config) => {\n const defaultConfig = {};\n\n initialize.config.setConfig({ ...defaultConfig, ...config });\n },\n\n listeners: () => [\n events.on('authenticated', async (authenticated) => {\n state.authenticated = !!authenticated;\n\n if (authenticated) {\n getCustomerData().then((customerData) => {\n state.permissions = {\n requestQuote: customerData.permissions.canRequestQuote,\n editQuote: customerData.permissions.canEditQuote,\n deleteQuote: customerData.permissions.canDeleteQuote,\n checkoutQuote: customerData.permissions.canCheckoutQuote,\n };\n events.emit('quote-management/permissions', state.permissions);\n })\n .catch((error) => {\n console.error(error);\n state.permissions = DEFAULT_PERMISSIONS;\n events.emit('quote-management/permissions', DEFAULT_PERMISSIONS);\n });\n } else {\n state.permissions = DEFAULT_PERMISSIONS;\n events.emit('quote-management/permissions', DEFAULT_PERMISSIONS);\n }\n }, {\n eager: true,\n }),\n events.on('quote-management/permissions', async (permissions) => {\n const quoteId = initialize.config.getConfig().quoteId;\n if (!quoteId) {\n return;\n }\n\n if (permissions.editQuote) {\n getQuoteData(quoteId).then((quoteData) => {\n events.emit('quote-management/quote-data/initialized', {\n quote: quoteData,\n permissions,\n }, {});\n }).catch((error) => {\n events.emit('quote-management/quote-data/error', {\n error,\n });\n });\n }\n }, {\n eager: true,\n }),\n ],\n});\n\nexport const config = initialize.config;\n","/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2024 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\n\nimport { NEGOTIABLE_QUOTE_FRAGMENT } from '@/quote-management/api/graphql/NegotiableQuoteFragment';\n\nexport const SET_NEGOTIABLE_QUOTE_SHIPPING_ADDRESS_MUTATION = `\n mutation SET_NEGOTIABLE_QUOTE_SHIPPING_ADDRESS_MUTATION(\n $quoteUid: ID!\n $addressId: ID\n $addressData: NegotiableQuoteAddressInput\n ) {\n setNegotiableQuoteShippingAddress(\n input: {\n quote_uid: $quoteUid\n shipping_addresses: {\n customer_address_uid: $addressId\n address: $addressData\n }\n }\n ) {\n quote {\n ...NegotiableQuoteFragment\n }\n }\n }\n ${NEGOTIABLE_QUOTE_FRAGMENT}\n`;\n\n","/********************************************************************\n * Copyright 2025 Adobe\n * All Rights Reserved.\n *\n * NOTICE: Adobe permits you to use, modify, and distribute this\n * file in accordance with the terms of the Adobe license agreement\n * accompanying it.\n *******************************************************************/\n\nimport { fetchGraphQl } from '@/quote-management/api';\nimport { events } from '@adobe-commerce/event-bus';\nimport { SET_NEGOTIABLE_QUOTE_SHIPPING_ADDRESS_MUTATION } from './graphql/SetNegotiableQuoteShippingAddressMutation';\nimport { NegotiableQuoteModel } from '@/quote-management/data/models/negotiable-quote-model';\nimport { transformQuote } from '@/quote-management/data/transforms';\n\nexport interface AddressInput {\n /** City name */\n city: string;\n /** Optional company name */\n company?: string;\n /** Two-letter country code (e.g., 'US') */\n countryCode: string;\n /** First name */\n firstname: string;\n /** Last name */\n lastname: string;\n /** Postal/ZIP code */\n postcode: string;\n /** Optional state/province name */\n region?: string;\n /** Optional state/province ID */\n regionId?: number;\n /** Whether to save this address to the customer's address book */\n saveInAddressBook?: boolean;\n /** Street address lines (array) */\n street: string[];\n /** Phone number */\n telephone: string;\n /** \n * Additional input (optional custom fields for the address).\n * These fields will be merged into the address data sent to GraphQL.\n * Standard fields take precedence over additional fields to prevent\n * accidental override of required address attributes.\n * \n * @example\n * ```ts\n * additionalInput: {\n * vat_id: 'GB123456789',\n * custom_attribute: 'value',\n * delivery_instructions: 'Leave at door'\n * }\n * ```\n */\n additionalInput?: Record<string, any>;\n}\n\nexport interface SetShippingAddressInput {\n /** The unique ID of the negotiable quote */\n quoteUid: string;\n /** The ID of a saved customer address (use this OR addressData, not both) */\n addressId?: number;\n /** New address data (use this OR addressId, not both) */\n addressData?: AddressInput;\n}\n\n/**\n * Transform camelCase address data to snake_case for GraphQL mutation.\n * Additional fields from additionalInput are spread into the result, with\n * standard fields taking precedence (defensive flexibility approach).\n */\nfunction transformAddressToSnakeCase(address: AddressInput) {\n const { additionalInput, ...standardFields } = address;\n \n // Build the standard transformed fields\n const transformedStandardFields = {\n city: standardFields.city,\n company: standardFields.company,\n country_code: standardFields.countryCode,\n firstname: standardFields.firstname,\n lastname: standardFields.lastname,\n postcode: standardFields.postcode,\n region: standardFields.region,\n region_id: standardFields.regionId,\n save_in_address_book: standardFields.saveInAddressBook,\n street: standardFields.street,\n telephone: standardFields.telephone,\n };\n \n // Spread additional input first, then standard fields take precedence\n // This provides defensive flexibility: allows custom fields while protecting core fields\n return {\n ...(additionalInput || {}),\n ...transformedStandardFields,\n };\n}\n\n/**\n * Sets or updates the shipping address for a negotiable quote.\n * \n * @param input - The input parameters for setting the shipping address\n * @param input.quoteUid - The unique ID of the negotiable quote\n * @param input.addressId - Optional ID of a saved customer address (use this OR addressData)\n * @param input.addressData - Optional new address data (use this OR addressId)\n * @param input.addressData.additionalInput - Optional additional address fields to pass through to GraphQL\n * @returns Promise that resolves to the updated quote model with shipping addresses including uid field\n * @throws Error if validation fails or GraphQL operation fails\n * \n * @example\n * ```ts\n * // Using a saved address\n * const quote = await setShippingAddress({\n * quoteUid: 'quote-123',\n * addressId: 5\n * });\n * \n * // Using new address data\n * const quote = await setShippingAddress({\n * quoteUid: 'quote-123',\n * addressData: {\n * firstname: 'John',\n * lastname: 'Doe',\n * street: ['123 Main St'],\n * city: 'San Francisco',\n * countryCode: 'US',\n * postcode: '94103',\n * telephone: '555-1234'\n * }\n * });\n * \n * // Using address data with additional custom fields\n * const quote = await setShippingAddress({\n * quoteUid: 'quote-123',\n * addressData: {\n * firstname: 'John',\n * lastname: 'Doe',\n * street: ['123 Main St'],\n * city: 'San Francisco',\n * countryCode: 'US',\n * postcode: '94103',\n * telephone: '555-1234',\n * additionalInput: {\n * vat_id: 'GB123456789',\n * custom_attribute_1: 'value1',\n * delivery_instructions: 'Leave at door'\n * }\n * }\n * });\n * \n * // Access address identifier\n * if (quote?.shippingAddresses?.[0]) {\n * console.log('Address UID:', quote.shippingAddresses[0].uid);\n * }\n * ```\n */\nexport const setShippingAddress = async (\n input: SetShippingAddressInput\n): Promise<NegotiableQuoteModel | null> => {\n const { quoteUid, addressId, addressData } = input;\n\n if (!quoteUid) {\n throw new Error('Quote UID is required');\n }\n\n // Validate that exactly one of addressId or addressData is provided\n if (addressId === undefined && !addressData) {\n throw new Error('Either addressId or addressData must be provided');\n }\n\n if (addressId !== undefined && addressData) {\n throw new Error('Cannot provide both addressId and addressData');\n }\n\n // Transform addressData to snake_case if provided\n const transformedAddressData = addressData\n ? transformAddressToSnakeCase(addressData)\n : null;\n\n return fetchGraphQl(SET_NEGOTIABLE_QUOTE_SHIPPING_ADDRESS_MUTATION, {\n variables: {\n quoteUid,\n addressId: addressId || null,\n addressData: transformedAddressData,\n },\n }).then((response) => {\n const { errors } = response;\n\n if (errors) {\n // Provide more detailed error information\n const errorMessages = errors.map((error) => error.message).join('; ');\n throw new Error(`Failed to set shipping address: ${errorMessages}`);\n }\n\n // Transform the quote data\n const quoteData = transformQuote(\n response.data?.setNegotiableQuoteShippingAddress?.quote\n );\n\n if (!quoteData) {\n throw new Error(\n 'Failed to transform quote data: Invalid response structure'\n );\n }\n\n // Emit event with transformed quote data on success\n events.emit('quote-management/shipping-address-set', {\n quote: quoteData,\n input: { quoteUid, addressId, addressData },\n });\n\n return quoteData;\n });\n};\n\n"],"names":["CUSTOMER_FRAGMENT","CUSTOMER_QUERY","CAN_REQUEST_QUOTE_PERMISSION","CAN_EDIT_QUOTE_PERMISSION","CAN_DELETE_QUOTE_PERMISSION","CAN_CHECKOUT_QUOTE_PERMISSION","flattenPermissions","permissions","result","traverse","nodes","path","node","currentPath","transformCustomer","customerData","role","DEFAULT_PERMISSIONS","flattenedPermissions","getCustomerData","state","results","fetchGraphQl","_a","error","QUOTE_DATA_QUERY","NEGOTIABLE_QUOTE_FRAGMENT","getQuoteData","quoteId","transformedQuote","transformQuote","events","initialize","Initializer","config","defaultConfig","authenticated","quoteData","SET_NEGOTIABLE_QUOTE_SHIPPING_ADDRESS_MUTATION","transformAddressToSnakeCase","address","additionalInput","standardFields","transformedStandardFields","setShippingAddress","input","quoteUid","addressId","addressData","transformedAddressData","response","errors","errorMessages","_b"],"mappings":"siBAAO,MAAMA,EAAkC;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,ECElCC,EAAiB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,MAOxBD,CAAiB;AAAA,ECQjBE,EAA+B,wCAC/BC,EAA4B,wCAC5BC,EAA8B,wCAC9BC,EAAgC,sCAOzBC,EAAsBC,GAA+C,CAC9E,MAAMC,EAAmB,CAAA,EAGnBC,EAAW,CAACC,EAA4BC,EAAiB,CAAA,IAAO,CAClE,UAAWC,KAAQF,EAAO,CACtB,MAAMG,EAAc,CAAC,GAAGF,EAAMC,EAAK,IAAI,EAEnCA,EAAK,UAAYA,EAAK,SAAS,OAAS,EACxCH,EAASG,EAAK,SAAUC,CAAW,EAEnCL,EAAO,KAAKK,EAAY,KAAK,GAAG,CAAC,CAEzC,CACJ,EAEA,OAAAJ,EAASF,CAAW,EACbC,CACX,EAEO,SAASM,EAAkBC,EAAkC,CAChE,KAAM,CAAE,KAAAC,GAASD,EAEjB,GAAI,CAACC,EACD,MAAO,CACH,YAAa,CACT,gBAAiBC,EAAoB,aACrC,aAAcA,EAAoB,UAClC,eAAgBA,EAAoB,YACpC,iBAAkBA,EAAoB,aAAA,CAC1C,EAIR,KAAM,CAAE,YAAAV,GAAgBS,EAElBE,EAAuBZ,EAAmBC,CAAW,EAC3D,MAAO,CACH,YAAa,CACT,gBAAiBW,EAAqB,SAAShB,CAA4B,EAC3E,aAA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
|
/*! Copyright 2025 Adobe
|
|
2
2
|
All Rights Reserved. */
|
|
3
3
|
const e=`
|
|
4
|
+
fragment SELECTED_SHIPPING_METHOD_FRAGMENT on SelectedShippingMethod {
|
|
5
|
+
amount {
|
|
6
|
+
currency
|
|
7
|
+
value
|
|
8
|
+
}
|
|
9
|
+
carrier_code
|
|
10
|
+
carrier_title
|
|
11
|
+
method_code
|
|
12
|
+
method_title
|
|
13
|
+
price_excl_tax {
|
|
14
|
+
value
|
|
15
|
+
currency
|
|
16
|
+
}
|
|
17
|
+
price_incl_tax {
|
|
18
|
+
value
|
|
19
|
+
currency
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
`,t=`
|
|
23
|
+
fragment NEGOTIABLE_QUOTE_SHIPPING_ADDRESS_FRAGMENT on NegotiableQuoteShippingAddress {
|
|
24
|
+
uid
|
|
25
|
+
firstname
|
|
26
|
+
lastname
|
|
27
|
+
company
|
|
28
|
+
street
|
|
29
|
+
city
|
|
30
|
+
region {
|
|
31
|
+
code
|
|
32
|
+
label
|
|
33
|
+
region_id
|
|
34
|
+
}
|
|
35
|
+
postcode
|
|
36
|
+
country {
|
|
37
|
+
code
|
|
38
|
+
label
|
|
39
|
+
}
|
|
40
|
+
telephone
|
|
41
|
+
|
|
42
|
+
selected_shipping_method {
|
|
43
|
+
...SELECTED_SHIPPING_METHOD_FRAGMENT
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
${e}
|
|
48
|
+
`,a=`
|
|
4
49
|
fragment NegotiableQuoteFragment on NegotiableQuote {
|
|
5
50
|
uid
|
|
6
51
|
name
|
|
7
52
|
created_at
|
|
53
|
+
is_virtual
|
|
8
54
|
status
|
|
9
55
|
sales_rep_name
|
|
10
56
|
expiration_date
|
|
@@ -22,8 +68,8 @@ const e=`
|
|
|
22
68
|
}
|
|
23
69
|
text
|
|
24
70
|
attachments {
|
|
25
|
-
|
|
26
|
-
|
|
71
|
+
name
|
|
72
|
+
url
|
|
27
73
|
}
|
|
28
74
|
}
|
|
29
75
|
template_id
|
|
@@ -165,7 +211,7 @@ const e=`
|
|
|
165
211
|
}
|
|
166
212
|
}
|
|
167
213
|
prices {
|
|
168
|
-
|
|
214
|
+
subtotal_with_discount_excluding_tax {
|
|
169
215
|
currency
|
|
170
216
|
value
|
|
171
217
|
}
|
|
@@ -173,41 +219,43 @@ const e=`
|
|
|
173
219
|
currency
|
|
174
220
|
value
|
|
175
221
|
}
|
|
176
|
-
|
|
222
|
+
subtotal_excluding_tax {
|
|
223
|
+
currency
|
|
224
|
+
value
|
|
225
|
+
}
|
|
226
|
+
grand_total {
|
|
227
|
+
currency
|
|
228
|
+
value
|
|
229
|
+
}
|
|
230
|
+
grand_total_excluding_tax {
|
|
177
231
|
currency
|
|
178
232
|
value
|
|
179
233
|
}
|
|
180
234
|
applied_taxes {
|
|
235
|
+
label
|
|
181
236
|
amount {
|
|
237
|
+
value
|
|
182
238
|
currency
|
|
239
|
+
}
|
|
240
|
+
}
|
|
241
|
+
discounts {
|
|
242
|
+
amount {
|
|
183
243
|
value
|
|
244
|
+
currency
|
|
184
245
|
}
|
|
185
246
|
label
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
247
|
+
coupon {
|
|
248
|
+
code
|
|
249
|
+
}
|
|
250
|
+
applied_to
|
|
190
251
|
}
|
|
191
252
|
}
|
|
253
|
+
|
|
192
254
|
shipping_addresses {
|
|
193
|
-
|
|
194
|
-
firstname
|
|
195
|
-
lastname
|
|
196
|
-
company
|
|
197
|
-
street
|
|
198
|
-
city
|
|
199
|
-
region {
|
|
200
|
-
code
|
|
201
|
-
label
|
|
202
|
-
region_id
|
|
203
|
-
}
|
|
204
|
-
postcode
|
|
205
|
-
country {
|
|
206
|
-
code
|
|
207
|
-
label
|
|
208
|
-
}
|
|
209
|
-
telephone
|
|
255
|
+
...NEGOTIABLE_QUOTE_SHIPPING_ADDRESS_FRAGMENT
|
|
210
256
|
}
|
|
211
257
|
}
|
|
212
|
-
|
|
258
|
+
|
|
259
|
+
${t}
|
|
260
|
+
`;export{a as N};
|
|
213
261
|
//# sourceMappingURL=NegotiableQuoteFragment.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"NegotiableQuoteFragment.js","sources":["/@dropins/storefront-quote-management/src/api/graphql/NegotiableQuoteFragment.ts"],"sourcesContent":["/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2024 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\n\nexport const NEGOTIABLE_QUOTE_FRAGMENT = /* GraphQL */ `\n fragment NegotiableQuoteFragment on NegotiableQuote {\n uid\n name\n created_at\n status\n sales_rep_name\n expiration_date\n updated_at\n buyer {\n firstname\n lastname\n }\n comments {\n uid\n created_at\n author {\n firstname\n lastname\n }\n text\n attachments {\n
|
|
1
|
+
{"version":3,"file":"NegotiableQuoteFragment.js","sources":["/@dropins/storefront-quote-management/src/api/graphql/ShippingMethodFragment.ts","/@dropins/storefront-quote-management/src/api/graphql/NegotiableQuoteAddressFragment.ts","/@dropins/storefront-quote-management/src/api/graphql/NegotiableQuoteFragment.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\nexport const SELECTED_SHIPPING_METHOD_FRAGMENT = /* GraphQL */ `\n fragment SELECTED_SHIPPING_METHOD_FRAGMENT on SelectedShippingMethod {\n amount {\n currency\n value\n }\n carrier_code\n carrier_title\n method_code\n method_title\n price_excl_tax {\n value\n currency\n }\n price_incl_tax {\n value\n currency\n }\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 { SELECTED_SHIPPING_METHOD_FRAGMENT } from './ShippingMethodFragment';\n\nexport const NEGOTIABLE_QUOTE_SHIPPING_ADDRESS_FRAGMENT = /* GraphQL */ `\n fragment NEGOTIABLE_QUOTE_SHIPPING_ADDRESS_FRAGMENT on NegotiableQuoteShippingAddress {\n uid\n firstname\n lastname\n company\n street\n city\n region {\n code\n label\n region_id\n }\n postcode\n country {\n code\n label\n }\n telephone\n\n selected_shipping_method {\n ...SELECTED_SHIPPING_METHOD_FRAGMENT\n }\n }\n\n ${SELECTED_SHIPPING_METHOD_FRAGMENT}\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_SHIPPING_ADDRESS_FRAGMENT } from './NegotiableQuoteAddressFragment';\n\nexport const NEGOTIABLE_QUOTE_FRAGMENT = /* GraphQL */ `\n fragment NegotiableQuoteFragment on NegotiableQuote {\n uid\n name\n created_at\n is_virtual\n status\n sales_rep_name\n expiration_date\n updated_at\n buyer {\n firstname\n lastname\n }\n comments {\n uid\n created_at\n author {\n firstname\n lastname\n }\n text\n attachments {\n name\n url\n }\n }\n template_id\n template_name\n items {\n product {\n name\n sku\n uid\n stock_status\n quantity\n price_range {\n maximum_price {\n regular_price {\n value\n }\n }\n }\n }\n prices {\n price {\n currency\n value\n }\n original_item_price {\n currency\n value\n }\n original_row_total {\n currency\n value\n }\n row_total {\n currency\n value\n }\n catalog_discount {\n amount_off\n percent_off\n }\n discounts {\n label\n value\n amount {\n currency\n value\n }\n }\n }\n quantity\n note_from_buyer {\n created_at\n creator_id\n creator_type\n negotiable_quote_item_uid\n note\n note_uid\n __typename\n }\n note_from_seller {\n created_at\n creator_id\n creator_type\n negotiable_quote_item_uid\n note\n note_uid\n __typename\n }\n ... on ConfigurableCartItem {\n configurable_options {\n option_label\n value_label\n }\n }\n ... on BundleCartItem {\n bundle_options {\n label\n values {\n label\n quantity\n original_price {\n currency\n value\n }\n priceV2 {\n currency\n value\n }\n }\n }\n }\n }\n history {\n uid\n created_at\n author {\n firstname\n lastname\n }\n change_type\n changes {\n comment_added {\n comment\n }\n custom_changes {\n new_value\n old_value\n title\n }\n statuses {\n changes {\n new_status\n old_status\n }\n }\n expiration {\n new_expiration\n old_expiration\n }\n total {\n new_price {\n currency\n value\n }\n old_price {\n currency\n value\n }\n }\n products_removed {\n products_removed_from_catalog\n products_removed_from_quote {\n uid\n name\n sku\n quantity\n }\n }\n }\n }\n prices {\n subtotal_with_discount_excluding_tax {\n currency\n value\n }\n subtotal_including_tax {\n currency\n value\n }\n subtotal_excluding_tax {\n currency\n value\n }\n grand_total {\n currency\n value\n }\n grand_total_excluding_tax {\n currency\n value\n }\n applied_taxes {\n label\n amount {\n value\n currency\n }\n }\n discounts {\n amount {\n value\n currency\n }\n label\n coupon {\n code\n }\n applied_to\n }\n }\n\n shipping_addresses {\n ...NEGOTIABLE_QUOTE_SHIPPING_ADDRESS_FRAGMENT\n }\n }\n\n ${NEGOTIABLE_QUOTE_SHIPPING_ADDRESS_FRAGMENT}\n`;\n"],"names":["SELECTED_SHIPPING_METHOD_FRAGMENT","NEGOTIABLE_QUOTE_SHIPPING_ADDRESS_FRAGMENT","NEGOTIABLE_QUOTE_FRAGMENT"],"mappings":"AASO,MAAMA,EAAkD;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;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AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,IAmNnDD,CAA0C;"}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
/*! Copyright 2025 Adobe
|
|
2
|
+
All Rights Reserved. */
|
|
3
|
+
import{jsx as i,jsxs as u}from"@dropins/tools/preact-jsx-runtime.js";import{classes as p,VComponent as _}from"@dropins/tools/lib.js";/* empty css */import"@dropins/tools/components.js";/* empty css */import"@dropins/tools/preact-compat.js";import"@dropins/tools/preact.js";/* empty css *//* empty css *//* empty css */const g=({label:o,price:e,classSuffixes:t=[],labelClassSuffix:r,testId:m,children:s,...a})=>i(y,{...a,label:o,price:e,classSuffixes:t,labelClassSuffix:r,testId:m,children:s}),y=({label:o,price:e,classSuffixes:t=[],labelClassSuffix:r,testId:m,children:s,...a})=>{const n="quote-order-summary__label",c="quote-order-summary__price";return u("div",{...a,...m?{"data-testid":m}:{},className:p(["quote-order-summary__entry",...t.map(d=>`quote-order-summary__${d}`)]),children:[i("span",{className:p([n,...r?[`${n}--${r}`]:[]]),children:o}),i(_,{node:e,className:p([c,...r?[`${c}--${r}`]:[]])}),s]})};export{g as O};
|
|
4
|
+
//# sourceMappingURL=OrderSummaryLine.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"OrderSummaryLine.js","sources":["/@dropins/storefront-quote-management/src/containers/OrderSummaryLine/OrderSummaryLine.tsx","/@dropins/storefront-quote-management/src/components/OrderSummaryLine/OrderSummaryLine.tsx"],"sourcesContent":["/********************************************************************\n * Copyright 2025 Adobe\n * All Rights Reserved.\n *\n * NOTICE: Adobe permits you to use, modify, and distribute this\n * file in accordance with the terms of the Adobe license agreement\n * accompanying it.\n *******************************************************************/\n\nimport { HTMLAttributes } from 'preact/compat';\nimport { Container } from '@adobe-commerce/elsie/lib';\nimport { VNode } from 'preact';\nimport { OrderSummaryLine as OrderSummaryLineComponent } from '@/quote-management/components';\n\nexport interface OrderSummaryLineProps\n extends Omit<HTMLAttributes<HTMLDivElement>, 'label'> {\n label: VNode | string;\n price: VNode<HTMLAttributes<HTMLSpanElement>>;\n classSuffixes?: Array<string>;\n labelClassSuffix?: string;\n testId?: string;\n children?: any;\n}\n\nexport const OrderSummaryLine: Container<OrderSummaryLineProps> = ({\n label,\n price,\n classSuffixes = [],\n labelClassSuffix,\n testId,\n children,\n ...props\n}) => {\n return (\n <OrderSummaryLineComponent\n {...props}\n label={label}\n price={price}\n classSuffixes={classSuffixes}\n labelClassSuffix={labelClassSuffix}\n testId={testId}\n >\n {children}\n </OrderSummaryLineComponent>\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 '@/quote-management/components/OrderSummaryLine/OrderSummaryLine.css';\nimport { classes, VComponent } from '@adobe-commerce/elsie/lib';\nimport { FunctionComponent, VNode } from 'preact';\nimport { HTMLAttributes } from 'preact/compat';\nexport interface OrderSummaryLineComponentProps\n extends Omit<HTMLAttributes<HTMLDivElement>, 'label'> {\n label: VNode | string;\n price: VNode<HTMLAttributes<HTMLSpanElement>>;\n classSuffixes?: Array<string>;\n labelClassSuffix?: string;\n testId?: string;\n children?: any;\n}\n\nexport const OrderSummaryLine: FunctionComponent<\n OrderSummaryLineComponentProps\n> = ({\n label,\n price,\n classSuffixes = [],\n labelClassSuffix,\n testId,\n children,\n ...props\n}) => {\n const labelClass = 'quote-order-summary__label';\n const priceClass = 'quote-order-summary__price';\n return (\n <div\n {...props}\n {...(testId ? { 'data-testid': testId } : {})}\n className={classes([\n 'quote-order-summary__entry',\n ...classSuffixes.map(\n (classSuffix) => `quote-order-summary__${classSuffix}`\n ),\n ])}\n >\n <span\n className={classes([\n labelClass,\n ...(labelClassSuffix ? [`${labelClass}--${labelClassSuffix}`] : []),\n ])}\n >\n {label}\n </span>\n\n <VComponent\n node={price}\n className={classes([\n priceClass,\n ...(labelClassSuffix ? [`${priceClass}--${labelClassSuffix}`] : []),\n ])}\n />\n\n {children}\n </div>\n );\n};\n"],"names":["OrderSummaryLine","label","price","classSuffixes","labelClassSuffix","testId","children","props","jsx","OrderSummaryLineComponent","labelClass","priceClass","jsxs","classes","classSuffix","VComponent"],"mappings":"oZAwBO,MAAMA,EAAqD,CAAC,CACjE,MAAAC,EACA,MAAAC,EACA,cAAAC,EAAgB,CAAA,EAChB,iBAAAC,EACA,OAAAC,EACA,SAAAC,EACA,GAAGC,CACL,IAEIC,EAACC,EAAA,CACE,GAAGF,EACJ,MAAAN,EACA,MAAAC,EACA,cAAAC,EACA,iBAAAC,EACA,OAAAC,EAEC,SAAAC,CAAA,CAAA,ECnBMN,EAET,CAAC,CACH,MAAAC,EACA,MAAAC,EACA,cAAAC,EAAgB,CAAA,EAChB,iBAAAC,EACA,OAAAC,EACA,SAAAC,EACA,GAAGC,CACL,IAAM,CACJ,MAAMG,EAAa,6BACbC,EAAa,6BACnB,OACEC,EAAC,MAAA,CACE,GAAGL,EACH,GAAIF,EAAS,CAAE,cAAeA,CAAA,EAAW,CAAA,EAC1C,UAAWQ,EAAQ,CACjB,6BACA,GAAGV,EAAc,IACdW,GAAgB,wBAAwBA,CAAW,EAAA,CACtD,CACD,EAED,SAAA,CAAAN,EAAC,OAAA,CACC,UAAWK,EAAQ,CACjBH,EACA,GAAIN,EAAmB,CAAC,GAAGM,CAAU,KAAKN,CAAgB,EAAE,EAAI,CAAA,CAAC,CAClE,EAEA,SAAAH,CAAA,CAAA,EAGHO,EAACO,EAAA,CACC,KAAMb,EACN,UAAWW,EAAQ,CACjBF,EACA,GAAIP,EAAmB,CAAC,GAAGO,CAAU,KAAKP,CAAgB,EAAE,EAAI,CAAA,CAAC,CAClE,CAAA,CAAA,EAGFE,CAAA,CAAA,CAAA,CAGP"}
|
package/chunks/WarningFilled.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
/*! Copyright 2025 Adobe
|
|
2
2
|
All Rights Reserved. */
|
|
3
|
-
import*as e from"@dropins/tools/preact-compat.js";const
|
|
3
|
+
import*as e from"@dropins/tools/preact-compat.js";const o=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",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"}),e.createElement("path",{vectorEffect:"non-scaling-stroke",d:"M6.75 12.762L10.2385 15.75L17.25 9",stroke:"currentColor"})),n=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{o as S,n as a};
|
|
4
4
|
//# sourceMappingURL=WarningFilled.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"WarningFilled.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":["
|
|
1
|
+
{"version":3,"file":"WarningFilled.js","sources":["../../node_modules/@adobe-commerce/elsie/src/icons/CheckWithCircle.svg","../../node_modules/@adobe-commerce/elsie/src/icons/WarningFilled.svg"],"sourcesContent":["import * as React from \"react\";\nconst SvgCheckWithCircle = (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\", 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\" }), /* @__PURE__ */ React.createElement(\"path\", { vectorEffect: \"non-scaling-stroke\", d: \"M6.75 12.762L10.2385 15.75L17.25 9\", stroke: \"currentColor\" }));\nexport default SvgCheckWithCircle;\n","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":["SvgCheckWithCircle","props","React","SvgWarningFilled"],"mappings":"kDACK,MAACA,EAAsBC,GAA0BC,EAAM,cAAc,MAAO,CAAE,MAAO,GAAI,OAAQ,GAAI,QAAS,YAAa,KAAM,OAAQ,MAAO,6BAA8B,GAAGD,CAAK,EAAoBC,EAAM,cAAc,OAAQ,CAAE,aAAc,qBAAsB,EAAG,0JAA2J,OAAQ,cAAc,CAAE,EAAmBA,EAAM,cAAc,OAAQ,CAAE,aAAc,qBAAsB,EAAG,qCAAsC,OAAQ,eAAgB,CAAC,ECAxlBC,EAAoBF,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]}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
/*! Copyright 2025 Adobe
|
|
2
|
+
All Rights Reserved. */
|
|
3
|
+
import{s as h}from"./state.js";import{FetchGraphQL as b}from"@dropins/tools/fetch-graphql.js";var v=(e=>(e.NEW="NEW",e.SUBMITTED="SUBMITTED",e.PENDING="PENDING",e.UPDATED="UPDATED",e.OPEN="OPEN",e.ORDERED="ORDERED",e.CLOSED="CLOSED",e.DECLINED="DECLINED",e.EXPIRED="EXPIRED",e.DRAFT="DRAFT",e))(v||{});function T(e){var r,t,s,g,m,f,x;const c=y(e);return{uid:e.uid,name:e.name,createdAt:e.created_at,updatedAt:e.updated_at,expirationDate:e.expiration_date,status:c?v.NEW:e.status,isVirtual:!!e.is_virtual,salesRepName:e.sales_rep_name,buyer:{firstname:e.buyer.firstname,lastname:e.buyer.lastname},templateName:e.template_name,comments:(r=e.comments)==null?void 0:r.map(a=>{const i={uid:a.uid,createdAt:a.created_at,author:{firstname:a.author.firstname,lastname:a.author.lastname},text:a.text};return Array.isArray(a.attachments)&&a.attachments.length>0&&(i.attachments=a.attachments.map(p=>({name:p.name,url:p.url}))),i}),prices:e.prices&&{appliedDiscounts:(t=e.prices.discounts)==null?void 0:t.map(a=>({amount:{value:a.amount.value,currency:a.amount.currency},label:a.label,coupon:a.coupon})),appliedTaxes:(s=e.prices.applied_taxes)==null?void 0:s.map(a=>({amount:{value:a.amount.value,currency:a.amount.currency},label:a.label})),discount:e.prices.discounts&&e.prices.grand_total&&E(e.prices.discounts,e.prices.grand_total.currency),grandTotal:e.prices.grand_total&&{value:e.prices.grand_total.value,currency:e.prices.grand_total.currency},grandTotalExcludingTax:e.prices.grand_total_excluding_tax&&{value:e.prices.grand_total_excluding_tax.value,currency:e.prices.grand_total_excluding_tax.currency},subtotalExcludingTax:e.prices.subtotal_excluding_tax&&{value:e.prices.subtotal_excluding_tax.value,currency:e.prices.subtotal_excluding_tax.currency},subtotalIncludingTax:e.prices.subtotal_including_tax&&{value:e.prices.subtotal_including_tax.value,currency:e.prices.subtotal_including_tax.currency},subtotalWithDiscountExcludingTax:e.prices.subtotal_with_discount_excluding_tax&&{value:e.prices.subtotal_with_discount_excluding_tax.value,currency:e.prices.subtotal_with_discount_excluding_tax.currency},...P(e),totalTax:e.prices.applied_taxes&&e.prices.grand_total&&E(e.prices.applied_taxes,e.prices.grand_total.currency)},history:(g=e.history)==null?void 0:g.map(a=>{var i,p,u,o,d,_,n;return{uid:a.uid,createdAt:a.created_at,author:{firstname:a.author.firstname,lastname:a.author.lastname},changeType:a.change_type,changes:{commentAdded:((i=a.changes)==null?void 0:i.comment_added)&&{comment:a.changes.comment_added.comment},customChanges:((p=a.changes)==null?void 0:p.custom_changes)&&{new_value:a.changes.custom_changes.new_value,old_value:a.changes.custom_changes.old_value,title:a.changes.custom_changes.title},expiration:((u=a.changes)==null?void 0:u.expiration)&&{newExpiration:a.changes.expiration.new_expiration,oldExpiration:a.changes.expiration.old_expiration},productsRemoved:((o=a.changes)==null?void 0:o.products_removed)&&{productsRemovedFromCatalog:a.changes.products_removed.products_removed_from_catalog||[],productsRemovedFromQuote:a.changes.products_removed.products_removed_from_quote||[]},statuses:((d=a.changes)==null?void 0:d.statuses)&&{changes:((_=a.changes.statuses.changes)==null?void 0:_.map(l=>({newStatus:l.new_status,oldStatus:l.old_status})))||[]},total:((n=a.changes)==null?void 0:n.total)&&a.changes.total.new_price&&a.changes.total.old_price&&{newPrice:{value:a.changes.total.new_price.value,currency:a.changes.total.new_price.currency},oldPrice:{value:a.changes.total.old_price.value,currency:a.changes.total.old_price.currency}}}}}),items:((m=e.items)==null?void 0:m.map(a=>{var i,p,u,o,d,_;return{product:{uid:a.product.uid,sku:a.product.sku,name:a.product.name},catalogDiscount:{amountOff:a.prices.catalog_discount.amount_off,percentOff:a.prices.catalog_discount.percent_off},discounts:((p=(i=a.prices)==null?void 0:i.discounts)==null?void 0:p.map(n=>({label:n.label,value:n.value,amount:{value:n.amount.value,currency:n.amount.currency}})))??[],stockStatus:a.product.stock_status,quantity:a.quantity,prices:{originalItemPrice:{value:a.prices.original_item_price.value,currency:a.prices.original_item_price.currency},rowTotal:{value:a.prices.row_total.value,currency:a.prices.row_total.currency}},noteFromBuyer:(u=a.note_from_buyer)==null?void 0:u.map(n=>({createdAt:n.created_at,creatorId:n.creator_id,creatorType:n.creator_type,negotiableQuoteItemUid:n.negotiable_quote_item_uid,note:n.note,noteUid:n.note_uid})),noteFromSeller:(o=a.note_from_seller)==null?void 0:o.map(n=>({createdAt:n.created_at,creatorId:n.creator_id,creatorType:n.creator_type,negotiableQuoteItemUid:n.negotiable_quote_item_uid,note:n.note,noteUid:n.note_uid})),configurableOptions:(d=a.configurable_options)==null?void 0:d.map(n=>({optionLabel:n.option_label,valueLabel:n.value_label})),bundleOptions:(_=a.bundle_options)==null?void 0:_.map(n=>({label:n.label,values:n.values.map(l=>({label:l.label,quantity:l.quantity,originalPrice:{value:l.original_price.value,currency:l.original_price.currency},price:{value:l.priceV2.value,currency:l.priceV2.currency}}))}))}}))||[],shippingAddresses:(f=e.shipping_addresses)==null?void 0:f.map(a=>{const i={uid:a.uid,firstname:a.firstname,lastname:a.lastname,company:a.company,street:a.street,city:a.city,postcode:a.postcode,country:{code:a.country.code,label:a.country.label},telephone:a.telephone};return a.region&&(i.region={code:a.region.code,label:a.region.label,regionId:a.region.region_id}),i}),canCheckout:["UPDATED","DECLINED"].includes(e.status)&&h.permissions.checkoutQuote&&((x=e.shipping_addresses)==null?void 0:x.length)>0,canSendForReview:(c||["DRAFT","UPDATED","DECLINED","EXPIRED","NEW"].includes(e.status))&&h.permissions.editQuote,canDelete:!["PENDING","SUBMITTED","ORDERED"].includes(e.status)&&h.permissions.deleteQuote}}function R(e){return e?T(e):null}function y(e){return e.status==="SUBMITTED"&&!(e.history??[]).some(c=>{var r,t;return c.change_type==="UPDATED"&&(((t=(r=c.changes)==null?void 0:r.statuses)==null?void 0:t.changes)??[]).length>0})}function I(e){const c=y(e);return{uid:e.uid,name:e.name,createdAt:e.created_at,updatedAt:e.updated_at,status:c?v.NEW:e.status,buyer:{firstname:e.buyer.firstname,lastname:e.buyer.lastname},templateName:e.template_name,prices:{grandTotal:{value:e.prices.grand_total.value,currency:e.prices.grand_total.currency}}}}function N(e){var t;if(!e)return null;const c={items:((t=e.items)==null?void 0:t.filter(s=>s==null?void 0:s.uid).map(I))||[],pageInfo:{currentPage:e.page_info.current_page,pageSize:e.page_info.page_size,totalPages:e.page_info.total_pages},totalCount:e.total_count,sortFields:e.sort_fields?{default:e.sort_fields.default,options:e.sort_fields.options}:void 0},r=D(c);return{...c,paginationInfo:r||void 0}}function D(e){if(!(e!=null&&e.pageInfo)||!e.totalCount)return null;const{currentPage:c,pageSize:r,totalPages:t}=e.pageInfo,{totalCount:s}=e,g=s>0?(c-1)*r+1:0,m=Math.min(c*r,s);return{currentPage:c,totalCount:s,pageSize:r,startItem:g,endItem:m,totalPages:t,pageSizeOptions:[20,30,50,100,200]}}const C=()=>[20,30,50,100,200];function E(e,c){return e!=null&&e.length?e.reduce((r,t)=>({value:r.value+t.amount.value,currency:t.amount.currency}),{value:0,currency:c}):{value:0,currency:c}}function P(e){var t;if(!e||!((t=e.shipping_addresses)!=null&&t.length))return{};const r=e.shipping_addresses[0].selected_shipping_method;return r?{shippingIncludingTax:r.price_incl_tax&&{value:r.price_incl_tax.value,currency:r.price_incl_tax.currency},shippingExcludingTax:r.price_excl_tax&&{value:r.price_excl_tax.value,currency:r.price_excl_tax.currency}}:{}}const{setEndpoint:O,setFetchGraphQlHeader:F,removeFetchGraphQlHeader:U,setFetchGraphQlHeaders:L,fetchGraphQl:S,getConfig:Q}=new b().getMethods();export{N as a,F as b,L as c,Q as d,S as f,C as g,U as r,O as s,R as t};
|
|
4
|
+
//# sourceMappingURL=fetch-graphql.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fetch-graphql.js","sources":["/@dropins/storefront-quote-management/src/data/models/negotiable-quote-model.ts","/@dropins/storefront-quote-management/src/data/transforms/transform-quote.ts","/@dropins/storefront-quote-management/src/api/fetch-graphql/fetch-graphql.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\nexport interface ShippingAddress {\n /**\n * The unique string identifier of the address\n */\n uid?: string;\n firstname: string;\n lastname: string;\n company?: string;\n street: string[];\n city: string;\n region?: {\n code: string;\n label: string;\n regionId: number;\n };\n postcode: string;\n country: {\n code: string;\n label: string;\n };\n telephone: string;\n}\n\nexport interface NegotiableQuoteModel {\n uid: string;\n name: string;\n createdAt: string;\n salesRepName: string;\n expirationDate: string;\n updatedAt: string;\n status: NegotiableQuoteStatus;\n isVirtual: boolean;\n buyer: {\n firstname: string;\n lastname: string;\n };\n templateName?: string;\n comments?: {\n uid: string;\n createdAt: string;\n author: {\n firstname: string;\n lastname: string;\n };\n text: string;\n attachments?: {\n name: string;\n url: string;\n }[];\n }[];\n history?: NegotiableQuoteHistoryEntry[];\n prices: {\n appliedDiscounts?: Discount[];\n appliedTaxes?: Tax[];\n discount?: Currency;\n grandTotal?: Currency;\n grandTotalExcludingTax?: Currency;\n shippingExcludingTax?: Currency;\n shippingIncludingTax?: Currency;\n subtotalExcludingTax?: Currency;\n subtotalIncludingTax?: Currency;\n subtotalWithDiscountExcludingTax?: Currency;\n totalTax?: Currency;\n };\n items: NegotiableQuoteCartItem[];\n shippingAddresses?: ShippingAddress[];\n canCheckout: boolean;\n canSendForReview: boolean;\n canDelete: boolean;\n}\n\nexport interface NegotiableQuoteCartItem {\n product: {\n uid: string;\n sku: string;\n name: string;\n templateId?: string;\n templateName?: string;\n priceRange: {\n maximumPrice: {\n regularPrice: {\n value: number;\n };\n };\n };\n };\n catalogDiscount: {\n amountOff: number;\n percentOff: number;\n };\n discounts: {\n label: string;\n value: string;\n amount: Currency;\n }[];\n stockStatus: string;\n quantity: number;\n prices: {\n originalItemPrice: Currency;\n rowTotal: Currency;\n };\n configurableOptions?: {\n optionLabel: string;\n valueLabel: string;\n }[];\n bundleOptions?: {\n label: string;\n values: {\n label: string;\n quantity: number;\n originalPrice: Currency;\n price: Currency;\n }[];\n }[];\n noteFromBuyer?: ItemNote[];\n noteFromSeller?: ItemNote[];\n}\n\nexport interface ItemNote {\n createdAt: string;\n creatorId: number;\n creatorType: number;\n negotiableQuoteItemUid: string;\n note: string;\n noteUid: string;\n}\n\nexport interface Currency {\n value: number;\n currency: string;\n}\n\nexport interface Tax {\n amount: Currency;\n label: string;\n}\n\nexport interface Discount {\n amount: Currency;\n label: string;\n coupon?: Coupon;\n}\n\nexport interface Coupon {\n code: string;\n}\n\nexport interface NegotiableQuoteListEntry {\n uid: string;\n name: string;\n createdAt: string;\n updatedAt: string;\n status: NegotiableQuoteStatus;\n buyer: {\n firstname: string;\n lastname: string;\n };\n templateName: string;\n prices: {\n grandTotal: Currency;\n };\n}\nexport interface NegotiableQuotesListModel {\n items: NegotiableQuoteListEntry[];\n pageInfo: {\n currentPage: number;\n pageSize: number;\n totalPages: number;\n };\n totalCount: number;\n paginationInfo?: PaginationInfo;\n sortFields?: {\n default: string;\n options: Array<{\n label: string;\n value: string;\n }>;\n };\n}\n\nexport interface NegotiableQuoteHistoryEntry {\n author: {\n firstname: string;\n lastname: string;\n };\n changeType: NegotiableQuoteHistoryEntryChangeType;\n changes: {\n commentAdded?: {\n comment: string;\n };\n customChanges?: {\n new_value: string;\n old_value: string;\n title: string;\n };\n expiration?: {\n newExpiration: string;\n oldExpiration: string;\n };\n productsRemoved?: {\n productsRemovedFromCatalog: string[];\n productsRemovedFromQuote?: {\n uid: string;\n name: string;\n sku: string;\n quantity: number;\n }[];\n };\n statuses?: {\n changes: {\n newStatus: string;\n oldStatus: string;\n }[];\n };\n total?: {\n newPrice: Currency;\n oldPrice: Currency;\n };\n };\n createdAt: string;\n uid: string;\n}\n\nexport enum NegotiableQuoteHistoryEntryChangeType {\n CREATED = 'CREATED',\n UPDATED = 'UPDATED',\n CLOSED = 'CLOSED',\n UPDATED_BY_SYSTEM = 'UPDATED_BY_SYSTEM',\n}\n\n// See: https://experienceleague.adobe.com/en/docs/commerce-admin/b2b/quotes/quotes#quote-status\nexport enum NegotiableQuoteStatus {\n NEW = 'NEW', // Currently not returned by the API, but is used to indicate a new quote\n SUBMITTED = 'SUBMITTED',\n PENDING = 'PENDING',\n UPDATED = 'UPDATED',\n OPEN = 'OPEN',\n ORDERED = 'ORDERED',\n CLOSED = 'CLOSED',\n DECLINED = 'DECLINED',\n EXPIRED = 'EXPIRED',\n DRAFT = 'DRAFT',\n}\n\nexport interface PaginationInfo {\n currentPage: number;\n totalCount: number;\n pageSize: number;\n startItem: number;\n endItem: number;\n totalPages: number;\n pageSizeOptions?: number[];\n}\n","/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2024 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\nimport {\n NegotiableQuoteListEntry,\n NegotiableQuoteModel,\n NegotiableQuotesListModel,\n NegotiableQuoteStatus,\n PaginationInfo,\n ShippingAddress,\n} from '@/quote-management/data/models/negotiable-quote-model';\nimport { state } from '@/quote-management/lib/state';\n\n// Base helper that transforms a single quote object directly\nfunction transformSingleQuote(quote: any): NegotiableQuoteModel {\n const isQuoteNew = isNewQuote(quote);\n return {\n uid: quote.uid,\n name: quote.name,\n createdAt: quote.created_at,\n updatedAt: quote.updated_at,\n expirationDate: quote.expiration_date,\n status: isQuoteNew ? NegotiableQuoteStatus.NEW : quote.status,\n isVirtual: Boolean(quote.is_virtual),\n salesRepName: quote.sales_rep_name,\n buyer: {\n firstname: quote.buyer.firstname,\n lastname: quote.buyer.lastname,\n },\n templateName: quote.template_name,\n comments: quote.comments?.map((comment: any) => {\n const baseComment: any = {\n uid: comment.uid,\n createdAt: comment.created_at,\n author: {\n firstname: comment.author.firstname,\n lastname: comment.author.lastname,\n },\n text: comment.text,\n };\n\n if (\n Array.isArray(comment.attachments) &&\n comment.attachments.length > 0\n ) {\n baseComment.attachments = comment.attachments.map((a: any) => ({\n name: a.name,\n url: a.url,\n }));\n }\n\n return baseComment;\n }),\n prices: quote.prices && {\n appliedDiscounts: quote.prices.discounts?.map((discount: any) => ({\n amount: {\n value: discount.amount.value,\n currency: discount.amount.currency,\n },\n label: discount.label,\n coupon: discount.coupon,\n })),\n appliedTaxes: quote.prices.applied_taxes?.map((tax: any) => ({\n amount: { value: tax.amount.value, currency: tax.amount.currency },\n label: tax.label,\n })),\n discount:\n quote.prices.discounts &&\n quote.prices.grand_total &&\n calculateTotal(\n quote.prices.discounts,\n quote.prices.grand_total.currency\n ),\n grandTotal: quote.prices.grand_total && {\n value: quote.prices.grand_total.value,\n currency: quote.prices.grand_total.currency,\n },\n grandTotalExcludingTax: quote.prices.grand_total_excluding_tax && {\n value: quote.prices.grand_total_excluding_tax.value,\n currency: quote.prices.grand_total_excluding_tax.currency,\n },\n subtotalExcludingTax: quote.prices.subtotal_excluding_tax && {\n value: quote.prices.subtotal_excluding_tax.value,\n currency: quote.prices.subtotal_excluding_tax.currency,\n },\n subtotalIncludingTax: quote.prices.subtotal_including_tax && {\n value: quote.prices.subtotal_including_tax.value,\n currency: quote.prices.subtotal_including_tax.currency,\n },\n subtotalWithDiscountExcludingTax: quote.prices\n .subtotal_with_discount_excluding_tax && {\n value: quote.prices.subtotal_with_discount_excluding_tax.value,\n currency: quote.prices.subtotal_with_discount_excluding_tax.currency,\n },\n ...transformShippingPrices(quote),\n totalTax:\n quote.prices.applied_taxes &&\n quote.prices.grand_total &&\n calculateTotal(\n quote.prices.applied_taxes,\n quote.prices.grand_total.currency\n ),\n },\n history: quote.history?.map((history: any) => ({\n uid: history.uid,\n createdAt: history.created_at,\n author: {\n firstname: history.author.firstname,\n lastname: history.author.lastname,\n },\n changeType: history.change_type,\n changes: {\n commentAdded: history.changes?.comment_added && {\n comment: history.changes.comment_added.comment,\n },\n customChanges: history.changes?.custom_changes && {\n new_value: history.changes.custom_changes.new_value,\n old_value: history.changes.custom_changes.old_value,\n title: history.changes.custom_changes.title,\n },\n expiration: history.changes?.expiration && {\n newExpiration: history.changes.expiration.new_expiration,\n oldExpiration: history.changes.expiration.old_expiration,\n },\n productsRemoved: history.changes?.products_removed && {\n productsRemovedFromCatalog:\n history.changes.products_removed.products_removed_from_catalog ||\n [],\n productsRemovedFromQuote:\n history.changes.products_removed.products_removed_from_quote || [],\n },\n statuses: history.changes?.statuses && {\n changes:\n history.changes.statuses.changes?.map((change: any) => ({\n newStatus: change.new_status,\n oldStatus: change.old_status,\n })) || [],\n },\n total: history.changes?.total &&\n history.changes.total.new_price &&\n history.changes.total.old_price && {\n newPrice: {\n value: history.changes.total.new_price.value,\n currency: history.changes.total.new_price.currency,\n },\n oldPrice: {\n value: history.changes.total.old_price.value,\n currency: history.changes.total.old_price.currency,\n },\n },\n },\n })),\n items:\n quote.items?.map((item: any) => ({\n product: {\n uid: item.product.uid,\n sku: item.product.sku,\n name: item.product.name,\n },\n catalogDiscount: {\n amountOff: item.prices.catalog_discount.amount_off,\n percentOff: item.prices.catalog_discount.percent_off,\n },\n discounts:\n item.prices?.discounts?.map((discount: any) => ({\n label: discount.label,\n value: discount.value,\n amount: {\n value: discount.amount.value,\n currency: discount.amount.currency,\n },\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 noteFromBuyer: item.note_from_buyer?.map((note: any) => ({\n createdAt: note.created_at,\n creatorId: note.creator_id,\n creatorType: note.creator_type,\n negotiableQuoteItemUid: note.negotiable_quote_item_uid,\n note: note.note,\n noteUid: note.note_uid,\n })),\n noteFromSeller: item.note_from_seller?.map((note: any) => ({\n createdAt: note.created_at,\n creatorId: note.creator_id,\n creatorType: note.creator_type,\n negotiableQuoteItemUid: note.negotiable_quote_item_uid,\n note: note.note,\n noteUid: note.note_uid,\n })),\n configurableOptions: item.configurable_options?.map((option: any) => ({\n optionLabel: option.option_label,\n valueLabel: option.value_label,\n })),\n bundleOptions: item.bundle_options?.map((option: any) => ({\n label: option.label,\n values: option.values.map((value: any) => ({\n label: value.label,\n quantity: value.quantity,\n originalPrice: {\n value: value.original_price.value,\n currency: value.original_price.currency,\n },\n price: {\n value: value.priceV2.value,\n currency: value.priceV2.currency,\n },\n })),\n })),\n })) || [],\n shippingAddresses: quote.shipping_addresses?.map((address: any) => {\n const shippingAddress: ShippingAddress = {\n uid: address.uid,\n firstname: address.firstname,\n lastname: address.lastname,\n company: address.company,\n street: address.street,\n city: address.city,\n postcode: address.postcode,\n country: {\n code: address.country.code,\n label: address.country.label,\n },\n telephone: address.telephone,\n };\n\n if (address.region) {\n shippingAddress.region = {\n code: address.region.code,\n label: address.region.label,\n regionId: address.region.region_id,\n };\n }\n\n return shippingAddress;\n }),\n canCheckout:\n ['UPDATED', 'DECLINED'].includes(quote.status) &&\n state.permissions.checkoutQuote &&\n quote.shipping_addresses?.length > 0,\n canSendForReview:\n (isQuoteNew ||\n ['DRAFT', 'UPDATED', 'DECLINED', 'EXPIRED', 'NEW'].includes(\n quote.status\n )) &&\n state.permissions.editQuote,\n canDelete:\n !['PENDING', 'SUBMITTED', 'ORDERED'].includes(quote.status) &&\n state.permissions.deleteQuote,\n };\n}\n\nexport function transformQuote(quoteData: any): NegotiableQuoteModel | null {\n if (!quoteData) {\n return null;\n }\n\n return transformSingleQuote(quoteData);\n}\n\n// quote is new if it has a status of SUBMITTED and there is no history entry that\n// has a change_type of UPDATED with a non-empty array of status changes\nfunction isNewQuote(quote: any): boolean {\n return (\n quote.status === 'SUBMITTED' &&\n !(quote.history ?? []).some(\n (history: any) =>\n history.change_type === 'UPDATED' &&\n (history.changes?.statuses?.changes ?? []).length > 0\n )\n );\n}\n\nfunction transformNegotiableQuoteListEntry(\n quote: any\n): NegotiableQuoteListEntry {\n const isQuoteNew = isNewQuote(quote);\n return {\n uid: quote.uid,\n name: quote.name,\n createdAt: quote.created_at,\n updatedAt: quote.updated_at,\n status: isQuoteNew ? NegotiableQuoteStatus.NEW : quote.status,\n buyer: {\n firstname: quote.buyer.firstname,\n lastname: quote.buyer.lastname,\n },\n templateName: quote.template_name,\n prices: {\n grandTotal: {\n value: quote.prices.grand_total.value,\n currency: quote.prices.grand_total.currency,\n },\n },\n };\n}\n\nexport function transformNegotiableQuotesList(\n quotesData: any\n): NegotiableQuotesListModel | null {\n if (!quotesData) {\n return null;\n }\n\n const transformedModel = {\n items:\n quotesData.items\n ?.filter((quote: any) => quote?.uid)\n .map(transformNegotiableQuoteListEntry) || [],\n pageInfo: {\n currentPage: quotesData.page_info.current_page,\n pageSize: quotesData.page_info.page_size,\n totalPages: quotesData.page_info.total_pages,\n },\n totalCount: quotesData.total_count,\n sortFields: quotesData.sort_fields\n ? {\n default: quotesData.sort_fields.default,\n options: quotesData.sort_fields.options,\n }\n : undefined,\n };\n\n // Calculate pagination info\n const paginationInfo = transformPaginationInfo(transformedModel);\n\n return {\n ...transformedModel,\n paginationInfo: paginationInfo || undefined,\n };\n}\n\nexport function transformPaginationInfo(\n quotesData: NegotiableQuotesListModel | null\n): PaginationInfo | null {\n if (!quotesData?.pageInfo || !quotesData.totalCount) {\n return null;\n }\n\n const { currentPage, pageSize, totalPages } = quotesData.pageInfo;\n const { totalCount } = quotesData;\n\n const startItem = totalCount > 0 ? (currentPage - 1) * pageSize + 1 : 0;\n const endItem = Math.min(currentPage * pageSize, totalCount);\n\n const pageSizeOptions = [20, 30, 50, 100, 200]; // Default page size options\n\n return {\n currentPage,\n totalCount,\n pageSize,\n startItem,\n endItem,\n totalPages,\n pageSizeOptions,\n };\n}\n\n// TODO: Check if admin has this configuration\nexport const getDefaultPageSizeOptions = () => [20, 30, 50, 100, 200];\n\nexport function calculateTotal(data: any[], currency: string) {\n if (!data?.length)\n return {\n value: 0,\n currency,\n };\n\n return data.reduce(\n (acc: any, item: any) => {\n return {\n value: acc.value + item.amount.value,\n currency: item.amount.currency,\n };\n },\n { value: 0, currency }\n );\n}\n\nexport function transformShippingPrices(quote: any) {\n if (!quote || !quote.shipping_addresses?.length) {\n return {};\n }\n\n const shippingAddress = quote.shipping_addresses[0];\n const selectedShippingMethod = shippingAddress.selected_shipping_method;\n\n if (!selectedShippingMethod) {\n return {};\n }\n\n return {\n shippingIncludingTax: selectedShippingMethod.price_incl_tax && {\n value: selectedShippingMethod.price_incl_tax.value,\n currency: selectedShippingMethod.price_incl_tax.currency,\n },\n shippingExcludingTax: selectedShippingMethod.price_excl_tax && {\n value: selectedShippingMethod.price_excl_tax.value,\n currency: selectedShippingMethod.price_excl_tax.currency,\n },\n };\n}\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":["NegotiableQuoteStatus","transformSingleQuote","quote","isQuoteNew","isNewQuote","_a","comment","baseComment","a","_b","discount","_c","tax","calculateTotal","transformShippingPrices","_d","history","_e","_f","change","_g","item","note","option","value","address","shippingAddress","state","transformQuote","quoteData","transformNegotiableQuoteListEntry","transformNegotiableQuotesList","quotesData","transformedModel","paginationInfo","transformPaginationInfo","currentPage","pageSize","totalPages","totalCount","startItem","endItem","getDefaultPageSizeOptions","data","currency","acc","selectedShippingMethod","setEndpoint","setFetchGraphQlHeader","removeFetchGraphQlHeader","setFetchGraphQlHeaders","fetchGraphQl","getConfig","FetchGraphQL"],"mappings":"8FAgPO,IAAKA,GAAAA,IACVA,EAAA,IAAM,MACNA,EAAA,UAAY,YACZA,EAAA,QAAU,UACVA,EAAA,QAAU,UACVA,EAAA,KAAO,OACPA,EAAA,QAAU,UACVA,EAAA,OAAS,SACTA,EAAA,SAAW,WACXA,EAAA,QAAU,UACVA,EAAA,MAAQ,QAVEA,IAAAA,GAAA,CAAA,CAAA,ECrNZ,SAASC,EAAqBC,EAAkC,mBAC9D,MAAMC,EAAaC,EAAWF,CAAK,EACnC,MAAO,CACL,IAAKA,EAAM,IACX,KAAMA,EAAM,KACZ,UAAWA,EAAM,WACjB,UAAWA,EAAM,WACjB,eAAgBA,EAAM,gBACtB,OAAQC,EAAaH,EAAsB,IAAME,EAAM,OACvD,UAAW,EAAQA,EAAM,WACzB,aAAcA,EAAM,eACpB,MAAO,CACL,UAAWA,EAAM,MAAM,UACvB,SAAUA,EAAM,MAAM,QAAA,EAExB,aAAc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