@dropins/storefront-quote-management 1.0.0-beta1 → 1.0.0-beta3
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/duplicateNegotiableQuote/duplicateNegotiableQuote.d.ts +1 -0
- package/api/graphql/NegotiableQuoteTemplateFragment.d.ts +1 -1
- package/api/sendForReview/index.d.ts +1 -1
- package/api/sendQuoteTemplateForReview/sendQuoteTemplateForReview.d.ts +7 -0
- package/api.js +8 -47
- package/api.js.map +1 -1
- package/chunks/AttachedFilesList.js +1 -1
- package/chunks/AttachedFilesList.js.map +1 -1
- package/chunks/ConfirmationModal.js +1 -1
- package/chunks/ConfirmationModal.js.map +1 -1
- package/chunks/ItemsQuoted.js +1 -1
- package/chunks/ItemsQuoted.js.map +1 -1
- package/chunks/ItemsQuotedTemplate.js +1 -1
- package/chunks/ItemsQuotedTemplate.js.map +1 -1
- package/chunks/LineItemNoteModal.js +4 -0
- package/chunks/LineItemNoteModal.js.map +1 -0
- package/chunks/NegotiableQuoteTemplateFragment.js +6 -0
- package/chunks/NegotiableQuoteTemplateFragment.js.map +1 -1
- package/chunks/OrderSummaryLine.js +1 -1
- package/chunks/OrderSummaryLine.js.map +1 -1
- package/chunks/RenameQuoteModal.js +4 -0
- package/chunks/RenameQuoteModal.js.map +1 -0
- package/chunks/ShippingAddressDisplay.js +1 -1
- package/chunks/ShippingAddressDisplay.js.map +1 -1
- package/chunks/WarningFilled.js +1 -1
- package/chunks/WarningFilled.js.map +1 -1
- package/chunks/addQuoteTemplateLineItemNote.js +23 -3
- package/chunks/addQuoteTemplateLineItemNote.js.map +1 -1
- package/chunks/duplicateNegotiableQuote.js +5 -5
- package/chunks/duplicateNegotiableQuote.js.map +1 -1
- package/chunks/openQuoteTemplate.js +28 -8
- package/chunks/openQuoteTemplate.js.map +1 -1
- package/chunks/transform-quote-template.js +1 -1
- package/chunks/transform-quote-template.js.map +1 -1
- package/chunks/transform-quote.js +1 -1
- package/chunks/transform-quote.js.map +1 -1
- package/components/ManageNegotiableQuoteTemplate/ManageNegotiableQuoteTemplate.d.ts +3 -2
- package/components/ReferenceDocumentFormModal/ReferenceDocumentFormModal.d.ts +30 -0
- package/components/ReferenceDocumentFormModal/index.d.ts +11 -0
- package/components/ReferenceDocumentsList/ReferenceDocumentsList.d.ts +18 -0
- package/components/ReferenceDocumentsList/index.d.ts +11 -0
- package/components/index.d.ts +2 -0
- package/containers/ItemsQuoted.js +1 -1
- package/containers/ItemsQuotedTemplate/ItemsQuotedTemplate.d.ts +5 -1
- package/containers/ItemsQuotedTemplate.js +1 -1
- package/containers/ManageNegotiableQuote/ManageNegotiableQuote.d.ts +3 -0
- package/containers/ManageNegotiableQuote.js +1 -1
- package/containers/ManageNegotiableQuote.js.map +1 -1
- package/containers/ManageNegotiableQuoteTemplate/ManageNegotiableQuoteTemplate.d.ts +28 -5
- package/containers/ManageNegotiableQuoteTemplate.js +3 -1
- package/containers/ManageNegotiableQuoteTemplate.js.map +1 -1
- package/containers/OrderSummary.js +1 -1
- package/containers/OrderSummary.js.map +1 -1
- package/containers/OrderSummaryLine.js +1 -1
- package/containers/QuoteSummaryList.js +1 -1
- package/containers/QuoteSummaryList.js.map +1 -1
- package/containers/QuoteTemplatesListTable.js +1 -1
- package/containers/QuoteTemplatesListTable.js.map +1 -1
- 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/ShippingAddressDisplay/ShippingAddressDisplay.d.ts +2 -2
- package/data/models/negotiable-quote-template-model.d.ts +1 -0
- package/data/transforms/__fixtures__/negotiableQuoteData.d.ts +5 -0
- package/data/transforms/__fixtures__/negotiableQuoteTemplateData.d.ts +55 -0
- package/hooks/useItemsQuotedTemplate.d.ts +16 -0
- package/hooks/useReferenceDocumentLinks.d.ts +34 -0
- package/hooks/useRemoveTemplateItems.d.ts +25 -0
- package/hooks/useRenameTemplate.d.ts +71 -0
- package/hooks/useUpdateTemplateQuantities.d.ts +27 -0
- package/i18n/en_US.json.d.ts +85 -3
- package/package.json +1 -1
- package/render.js +3 -3
- package/render.js.map +1 -1
- package/chunks/CheckWithCircle.js +0 -4
- package/chunks/CheckWithCircle.js.map +0 -1
- package/chunks/LineItemNoteModal2.js +0 -4
- package/chunks/LineItemNoteModal2.js.map +0 -1
- package/chunks/TabbedContent.js +0 -4
- package/chunks/TabbedContent.js.map +0 -1
|
@@ -3,6 +3,7 @@ import { NegotiableQuoteModel } from '../../data/models/negotiable-quote-model';
|
|
|
3
3
|
export interface DuplicateQuoteInput {
|
|
4
4
|
quoteUid: string;
|
|
5
5
|
duplicatedQuoteUid: string;
|
|
6
|
+
hasOutOfStockItems?: boolean;
|
|
6
7
|
}
|
|
7
8
|
export declare const duplicateQuote: (input: DuplicateQuoteInput) => Promise<NegotiableQuoteModel | null>;
|
|
8
9
|
//# sourceMappingURL=duplicateNegotiableQuote.d.ts.map
|
|
@@ -6,5 +6,5 @@
|
|
|
6
6
|
* file in accordance with the terms of the Adobe license agreement
|
|
7
7
|
* accompanying it.
|
|
8
8
|
*******************************************************************/
|
|
9
|
-
export declare const NEGOTIABLE_QUOTE_TEMPLATE_FRAGMENT = "\n fragment NegotiableQuoteTemplateFragment on NegotiableQuoteTemplate {\n # uid\n template_id\n name\n # created_at\n # updated_at\n status\n # sales_rep_name\n expiration_date\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 items {\n uid\n product {\n name\n sku\n uid\n stock_status\n }\n prices {\n price {\n currency\n value\n }\n original_item_price {\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_template_item_uid\n note\n note_uid\n }\n note_from_seller {\n created_at\n creator_id\n creator_type\n # negotiable_quote_template_item_uid\n note\n note_uid\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 }\n }\n prices {\n subtotal_excluding_tax {\n currency\n value\n }\n subtotal_including_tax {\n currency\n value\n }\n subtotal_with_discount_excluding_tax {\n currency\n value\n }\n applied_taxes {\n amount {\n currency\n value\n }\n label\n }\n grand_total {\n currency\n value\n }\n }\n shipping_addresses {\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 }\n";
|
|
9
|
+
export declare const NEGOTIABLE_QUOTE_TEMPLATE_FRAGMENT = "\n fragment NegotiableQuoteTemplateFragment on NegotiableQuoteTemplate {\n # uid\n template_id\n name\n # created_at\n # updated_at\n status\n # sales_rep_name\n expiration_date\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 items {\n uid\n product {\n name\n sku\n uid\n stock_status\n }\n prices {\n price {\n currency\n value\n }\n original_item_price {\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_template_item_uid\n note\n note_uid\n }\n note_from_seller {\n created_at\n creator_id\n creator_type\n # negotiable_quote_template_item_uid\n note\n note_uid\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 }\n }\n prices {\n subtotal_excluding_tax {\n currency\n value\n }\n subtotal_including_tax {\n currency\n value\n }\n subtotal_with_discount_excluding_tax {\n currency\n value\n }\n applied_taxes {\n amount {\n currency\n value\n }\n label\n }\n grand_total {\n currency\n value\n }\n }\n shipping_addresses {\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 reference_document_links {\n link_id\n document_name\n document_identifier\n reference_document_url\n }\n }\n";
|
|
10
10
|
//# sourceMappingURL=NegotiableQuoteTemplateFragment.d.ts.map
|
|
@@ -6,5 +6,5 @@
|
|
|
6
6
|
* file in accordance with the terms of the Adobe license agreement
|
|
7
7
|
* accompanying it.
|
|
8
8
|
*******************************************************************/
|
|
9
|
-
export
|
|
9
|
+
export * from './sendForReview';
|
|
10
10
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -6,10 +6,17 @@
|
|
|
6
6
|
* file in accordance with the terms of the Adobe license agreement
|
|
7
7
|
* accompanying it.
|
|
8
8
|
*******************************************************************/
|
|
9
|
+
export interface ReferenceDocumentLinkInput {
|
|
10
|
+
uid?: string;
|
|
11
|
+
name: string;
|
|
12
|
+
identifier?: string;
|
|
13
|
+
url: string;
|
|
14
|
+
}
|
|
9
15
|
export interface SendQuoteTemplateForReviewParams {
|
|
10
16
|
templateId: string;
|
|
11
17
|
name?: string;
|
|
12
18
|
comment?: string;
|
|
19
|
+
referenceDocumentLinks?: ReferenceDocumentLinkInput[];
|
|
13
20
|
}
|
|
14
21
|
export declare const sendQuoteTemplateForReview: (params: SendQuoteTemplateForReviewParams) => Promise<import('../../data/models/negotiable-quote-template-model').NegotiableQuoteTemplateModel>;
|
|
15
22
|
//# sourceMappingURL=sendQuoteTemplateForReview.d.ts.map
|
package/api.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/*! Copyright 2025 Adobe
|
|
2
2
|
All Rights Reserved. */
|
|
3
|
-
import{r as
|
|
3
|
+
import{r as J}from"./chunks/requestNegotiableQuote.js";import{g as I}from"./chunks/duplicateNegotiableQuote.js";import{c as V,a as W,d as Z,b as ee,r as te,s as se}from"./chunks/duplicateNegotiableQuote.js";import{F as re,N as ae,S as ie,n as ne}from"./chunks/negotiableQuotes.js";import{events as a}from"@dropins/tools/event-bus.js";import{s as r,D as f,a as h,Q as n}from"./chunks/state.js";import{f as d,t as q}from"./chunks/transform-quote.js";import{e as ue,r as pe,s as me,c as le,d as ge}from"./chunks/transform-quote.js";import{N as D}from"./chunks/NegotiableQuoteFragment.js";import{u as _e}from"./chunks/uploadFile.js";import{a as T}from"./chunks/transform-quote-template.js";import{N as Q}from"./chunks/NegotiableQuoteTemplateFragment.js";import{Q as he,a as Te,S as Qe,g as Ee}from"./chunks/getQuoteTemplates.js";import{a as Ie,c as qe,d as De,o as Ne,s as ye}from"./chunks/openQuoteTemplate.js";import{a as Se,r as we,u as Fe}from"./chunks/addQuoteTemplateLineItemNote.js";import{g as ve}from"./chunks/generateQuoteFromTemplate.js";import{r as Me,s as Oe,u as xe}from"./chunks/setLineItemNote.js";import{Initializer as N}from"@dropins/tools/lib.js";import"@dropins/tools/fetch-graphql.js";function y(e){if(!e||typeof e!="object")return{requestQuote:!1,editQuote:!1,deleteQuote:!1,checkoutQuote:!1,viewQuoteTemplates:!1,manageQuoteTemplates:!1,generateQuoteFromTemplate:!1};if(e.all===!0)return{requestQuote:!0,editQuote:!0,deleteQuote:!0,checkoutQuote:!0,viewQuoteTemplates:!0,manageQuoteTemplates:!0,generateQuoteFromTemplate:!0};const s=e["Magento_NegotiableQuote::all"]===!0,t=e["Magento_NegotiableQuoteTemplate::all"]===!0,o=s||e["Magento_NegotiableQuote::manage"]===!0;return{requestQuote:o,editQuote:o,deleteQuote:o,checkoutQuote:s||e["Magento_NegotiableQuote::checkout"]===!0,viewQuoteTemplates:t||e["Magento_NegotiableQuoteTemplate::view_template"]===!0,manageQuoteTemplates:t||e["Magento_NegotiableQuoteTemplate::manage"]===!0,generateQuoteFromTemplate:t||e["Magento_NegotiableQuoteTemplate::generate_quote"]===!0}}function p(e){if(r.quoteDataLoaded)return;const s=m.config.getConfig(),{quoteId:t,quoteTemplateId:o}=s;!e.editQuote||!t&&!o||(r.quoteDataLoaded=!0,t&&I(t).then(i=>{r.quoteDataInitialized||a.emit("quote-management/quote-data/initialized",{quote:i,permissions:e}),r.quoteDataInitialized=!0}).catch(i=>{r.quoteDataLoaded=!1,a.emit("quote-management/quote-data/error",{error:i})}),o&&L(o).catch(i=>{r.quoteDataLoaded=!1,a.emit("quote-management/quote-template-data/error",{error:i})}))}const m=new N({init:async e=>{const s={};m.config.setConfig({...s,...e}),await w().then(t=>{r.config=t}).catch(t=>{console.error("Failed to fetch store config: ",t),r.config=h}),r.initialized=!0,a.emit("quote-management/initialized",{})},listeners:()=>[a.on("authenticated",async e=>{r.authenticated=!!e,e||(r.permissions=f,r.quoteDataLoaded=!1,a.emit("quote-management/permissions",f))},{eager:!0}),a.on("auth/permissions",async e=>{const s=y(e);r.permissions=s,r.quoteDataLoaded=!1,a.emit("quote-management/permissions",r.permissions)},{eager:!0}),a.on("quote-management/permissions",async e=>{r.initialized&&p(e)},{eager:!0}),a.on("quote-management/initialized",async()=>{p(r.permissions)},{eager:!0}),a.on("checkout/updated",async e=>{r.initialized&&(e==null?void 0:e.type)==="quote"&&(r.quoteDataLoaded=!1,p(r.permissions))},{eager:!0})]}),B=m.config;function b(e){if(!e)return h;const s=t=>[n.TAX_EXCLUDED,n.TAX_INCLUDED,n.TAX_INCLUDED_AND_EXCLUDED].includes(t)?t:n.TAX_EXCLUDED;return{quoteSummaryDisplayTotal:e.cart_summary_display_quantity,quoteSummaryMaxItems:e.max_items_in_order_summary,quoteDisplaySettings:{zeroTax:e.shopping_cart_display_zero_tax,subtotal:s(e.shopping_cart_display_subtotal),price:s(e.shopping_cart_display_price),shipping:s(e.shopping_cart_display_shipping),fullSummary:e.shopping_cart_display_full_summary,grandTotal:e.shopping_cart_display_grand_total},useConfigurableParentThumbnail:e.configurable_thumbnail_source==="parent"}}const S=`
|
|
4
4
|
query STORE_CONFIG_QUERY {
|
|
5
5
|
storeConfig {
|
|
6
6
|
cart_summary_display_quantity
|
|
@@ -14,7 +14,7 @@ import{r as ae}from"./chunks/requestNegotiableQuote.js";import{g as A}from"./chu
|
|
|
14
14
|
configurable_thumbnail_source
|
|
15
15
|
}
|
|
16
16
|
}
|
|
17
|
-
`,
|
|
17
|
+
`,w=async()=>d(S,{method:"GET",cache:"force-cache"}).then(({errors:e,data:s})=>{if(e){const t=e.map(o=>o.message).join(", ");throw new Error(`Failed to get store config: ${t}`)}return b(s.storeConfig)}),F=`
|
|
18
18
|
mutation SET_NEGOTIABLE_QUOTE_SHIPPING_ADDRESS_MUTATION(
|
|
19
19
|
$quoteUid: ID!
|
|
20
20
|
$addressId: ID
|
|
@@ -34,35 +34,16 @@ import{r as ae}from"./chunks/requestNegotiableQuote.js";import{g as A}from"./chu
|
|
|
34
34
|
}
|
|
35
35
|
}
|
|
36
36
|
}
|
|
37
|
-
${
|
|
38
|
-
`;function
|
|
37
|
+
${D}
|
|
38
|
+
`;function U(e){const{additionalInput:s,...t}=e,o={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{...s||{},...o}}const H=async e=>{const{quoteUid:s,addressId:t,addressData:o}=e;if(!s)throw new Error("Quote UID is required");if(t===void 0&&!o)throw new Error("Either addressId or addressData must be provided");if(t!==void 0&&o)throw new Error("Cannot provide both addressId and addressData");const i=o?U(o):null;return d(F,{variables:{quoteUid:s,addressId:t||null,addressData:i}}).then(l=>{var c,_;const{errors:g}=l;if(g){const E=g.map(A=>A.message).join("; ");throw new Error(`Failed to set shipping address: ${E}`)}const u=q((_=(c=l.data)==null?void 0:c.setNegotiableQuoteShippingAddress)==null?void 0:_.quote);if(!u)throw new Error("Failed to transform quote data: Invalid response structure");return a.emit("quote-management/shipping-address-set",{quote:u,input:{quoteUid:s,addressId:t,addressData:o}}),u})},v=`
|
|
39
39
|
query QUOTE_TEMPLATE_DATA_QUERY($templateId: ID!) {
|
|
40
40
|
negotiableQuoteTemplate(templateId: $templateId) {
|
|
41
41
|
...NegotiableQuoteTemplateFragment
|
|
42
42
|
}
|
|
43
43
|
}
|
|
44
44
|
|
|
45
|
-
${
|
|
46
|
-
`,L=async e=>{var
|
|
47
|
-
mutation CANCEL_QUOTE_TEMPLATE_MUTATION(
|
|
48
|
-
$templateId: ID!
|
|
49
|
-
$comment: String
|
|
50
|
-
) {
|
|
51
|
-
cancelNegotiableQuoteTemplate(
|
|
52
|
-
input: {
|
|
53
|
-
template_id: $templateId
|
|
54
|
-
cancellation_comment: $comment
|
|
55
|
-
}
|
|
56
|
-
) {
|
|
57
|
-
...NegotiableQuoteTemplateFragment
|
|
58
|
-
}
|
|
59
|
-
}
|
|
60
|
-
${m}
|
|
61
|
-
`,J=async e=>{var a;if(!e.templateId)throw new Error("Template ID is required");if(!r.authenticated)throw new Error("Unauthorized");try{const t=await d(F,{variables:{templateId:e.templateId,comment:e.comment}});if(!((a=t==null?void 0:t.data)!=null&&a.cancelNegotiableQuoteTemplate))throw new Error("No quote template data received");const o=u(t.data.cancelNegotiableQuoteTemplate);if(!o)throw new Error("Failed to transform quote template data");return i.emit("quote-management/quote-template-data",{quoteTemplate:o,permissions:r.permissions}),o}catch(t){return Promise.reject(t)}},v=`
|
|
62
|
-
mutation DELETE_QUOTE_TEMPLATE_MUTATION($templateId: ID!) {
|
|
63
|
-
deleteNegotiableQuoteTemplate(input: { template_id: $templateId })
|
|
64
|
-
}
|
|
65
|
-
`,K=async e=>{var a;if(!e.templateId)throw new Error("Template ID is required");if(!r.authenticated)throw new Error("Unauthorized");try{const t=await d(v,{variables:{templateId:e.templateId}});if(t!=null&&t.errors&&t.errors.length>0){const s=t.errors.map(n=>n==null?void 0:n.message).filter(Boolean).join("; ");throw new Error(s||"Failed to delete quote template")}if(!((a=t==null?void 0:t.data)==null?void 0:a.deleteNegotiableQuoteTemplate))throw new Error("Failed to delete quote template");return i.emit("quote-management/quote-template-deleted",{templateId:e.templateId}),{templateId:e.templateId}}catch(t){return Promise.reject(t)}},P=`
|
|
45
|
+
${Q}
|
|
46
|
+
`,L=async e=>{var s;if(!r.authenticated)throw new Error("Unauthorized");if(!e)throw new Error("Template ID is required");try{const t=await d(v,{variables:{templateId:e}});if(!((s=t==null?void 0:t.data)!=null&&s.negotiableQuoteTemplate))throw new Error("Quote template not found");const o=T(t.data.negotiableQuoteTemplate);if(!o)throw new Error("Failed to transform quote template data");return a.emit("quote-management/quote-template-data",{quoteTemplate:o,permissions:r.permissions}),o}catch(t){return Promise.reject(t)}},M=`
|
|
66
47
|
mutation SET_NEGOTIABLE_QUOTE_TEMPLATE_SHIPPING_ADDRESS_MUTATION(
|
|
67
48
|
$templateId: ID!
|
|
68
49
|
$shippingAddress: NegotiableQuoteTemplateShippingAddressInput!
|
|
@@ -77,26 +58,6 @@ import{r as ae}from"./chunks/requestNegotiableQuote.js";import{g as A}from"./chu
|
|
|
77
58
|
}
|
|
78
59
|
}
|
|
79
60
|
|
|
80
|
-
${
|
|
81
|
-
`,
|
|
82
|
-
mutation UPDATE_NEGOTIABLE_QUOTE_TEMPLATE_QUANTITIES_MUTATION(
|
|
83
|
-
$input: UpdateNegotiableQuoteTemplateQuantitiesInput!
|
|
84
|
-
) {
|
|
85
|
-
updateNegotiableQuoteTemplateQuantities(input: $input) {
|
|
86
|
-
quote_template {
|
|
87
|
-
...NegotiableQuoteTemplateFragment
|
|
88
|
-
}
|
|
89
|
-
}
|
|
90
|
-
}
|
|
91
|
-
${m}
|
|
92
|
-
`,Z=async e=>{var a,t;if(!e.templateId)throw new Error("Template ID is required");if(!e.items||e.items.length===0)throw new Error("Items array is required and must not be empty");if(!r.authenticated)throw new Error("Unauthorized");try{const o=await d($,{variables:{input:{template_id:e.templateId,items:e.items.map(n=>({item_id:n.itemId,quantity:n.quantity,min_qty:n.minQty,max_qty:n.maxQty}))}}});if(!((t=(a=o==null?void 0:o.data)==null?void 0:a.updateNegotiableQuoteTemplateQuantities)!=null&&t.quote_template))throw new Error("No quote template data received");const s=u(o.data.updateNegotiableQuoteTemplateQuantities.quote_template);if(!s)throw new Error("Failed to transform quote template data");return i.emit("quote-management/quote-template-data",{quoteTemplate:s,permissions:r.permissions}),s}catch(o){return Promise.reject(o)}},x=`
|
|
93
|
-
mutation REMOVE_NEGOTIABLE_QUOTE_TEMPLATE_ITEMS_MUTATION(
|
|
94
|
-
$input: RemoveNegotiableQuoteTemplateItemsInput!
|
|
95
|
-
) {
|
|
96
|
-
removeNegotiableQuoteTemplateItems(input: $input) {
|
|
97
|
-
...NegotiableQuoteTemplateFragment
|
|
98
|
-
}
|
|
99
|
-
}
|
|
100
|
-
${m}
|
|
101
|
-
`,ee=async e=>{var a;if(!e.templateId)throw new Error("Template ID is required");if(!e.itemUids||e.itemUids.length===0)throw new Error("Item UIDs array is required and must not be empty");if(!r.authenticated)throw new Error("Unauthorized");try{const t=await d(x,{variables:{input:{template_id:e.templateId,item_uids:e.itemUids}}});if(!((a=t==null?void 0:t.data)!=null&&a.removeNegotiableQuoteTemplateItems))throw new Error("No quote template data received");const o=u(t.data.removeNegotiableQuoteTemplateItems);if(!o)throw new Error("Failed to transform quote template data");return i.emit("quote-management/quote-template-data",{quoteTemplate:o,permissions:r.permissions}),o}catch(t){return Promise.reject(t)}};export{le as FilterMatchTypeEnum,ce as NegotiableQuoteSortableField,we as QuoteTemplateFilterStatus,De as QuoteTemplateSortField,be as SortDirection,ge as SortEnum,Se as acceptQuoteTemplate,Fe as addQuoteTemplateLineItemNote,W as addQuoteTemplateShippingAddress,J as cancelQuoteTemplate,ie as closeNegotiableQuote,Y as config,se as createQuoteTemplate,ne as deleteQuote,K as deleteQuoteTemplate,de as duplicateQuote,d as fetchGraphQl,Pe as generateQuoteFromTemplate,he as getConfig,A as getQuoteData,L as getQuoteTemplateData,ye as getQuoteTemplates,U as getStoreConfig,g as initialize,_e as negotiableQuotes,Oe as openQuoteTemplate,Ee as removeFetchGraphQlHeader,xe as removeNegotiableQuoteItems,ee as removeQuoteTemplateItems,ue as renameNegotiableQuote,ae as requestNegotiableQuote,me as sendForReview,Me as sendQuoteTemplateForReview,fe as setEndpoint,Qe as setFetchGraphQlHeader,Ie as setFetchGraphQlHeaders,Ce as setLineItemNote,V as setShippingAddress,Ge as updateQuantities,Z as updateQuoteTemplateItemQuantities,qe as uploadFile};
|
|
61
|
+
${Q}
|
|
62
|
+
`,X=async e=>{var s;if(!e.templateId)throw new Error("Template ID is required");if(!e.shippingAddress)throw new Error("Shipping address is required");if(!r.authenticated)throw new Error("Unauthorized");if(!e.shippingAddress.address&&!e.shippingAddress.customerAddressUid)throw new Error("Either address or customerAddressUid must be provided");try{const t=await d(M,{variables:{templateId:e.templateId,shippingAddress:{address:e.shippingAddress.address?{city:e.shippingAddress.address.city,company:e.shippingAddress.address.company,country_code:e.shippingAddress.address.countryCode,fax:e.shippingAddress.address.fax,firstname:e.shippingAddress.address.firstname,lastname:e.shippingAddress.address.lastname,middlename:e.shippingAddress.address.middlename,postcode:e.shippingAddress.address.postcode,prefix:e.shippingAddress.address.prefix,region:e.shippingAddress.address.region,region_id:e.shippingAddress.address.regionId,save_in_address_book:e.shippingAddress.address.saveInAddressBook,street:e.shippingAddress.address.street,suffix:e.shippingAddress.address.suffix,telephone:e.shippingAddress.address.telephone,vat_id:e.shippingAddress.address.vatId}:void 0,customer_address_uid:e.shippingAddress.customerAddressUid,customer_notes:e.shippingAddress.customerNotes}}});if(!((s=t==null?void 0:t.data)!=null&&s.setNegotiableQuoteTemplateShippingAddress))throw new Error("No quote template data received");const o=T(t.data.setNegotiableQuoteTemplateShippingAddress);if(!o)throw new Error("Failed to transform quote template data");return a.emit("quote-management/quote-template-data",{quoteTemplate:o,permissions:r.permissions}),o}catch(t){return Promise.reject(t)}};export{re as FilterMatchTypeEnum,ae as NegotiableQuoteSortableField,he as QuoteTemplateFilterStatus,Te as QuoteTemplateSortField,Qe as SortDirection,ie as SortEnum,Ie as acceptQuoteTemplate,Se as addQuoteTemplateLineItemNote,X as addQuoteTemplateShippingAddress,qe as cancelQuoteTemplate,V as closeNegotiableQuote,B as config,W as createQuoteTemplate,Z as deleteQuote,De as deleteQuoteTemplate,ee as duplicateQuote,d as fetchGraphQl,ve as generateQuoteFromTemplate,ue as getConfig,I as getQuoteData,L as getQuoteTemplateData,Ee as getQuoteTemplates,w as getStoreConfig,m as initialize,ne as negotiableQuotes,Ne as openQuoteTemplate,pe as removeFetchGraphQlHeader,Me as removeNegotiableQuoteItems,we as removeQuoteTemplateItems,te as renameNegotiableQuote,J as requestNegotiableQuote,se as sendForReview,ye as sendQuoteTemplateForReview,me as setEndpoint,le as setFetchGraphQlHeader,ge as setFetchGraphQlHeaders,Oe as setLineItemNote,H as setShippingAddress,xe as updateQuantities,Fe as updateQuoteTemplateItemQuantities,_e as uploadFile};
|
|
102
63
|
//# sourceMappingURL=api.js.map
|
package/api.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"api.js","sources":["/@dropins/storefront-quote-management/src/utils/mapAuthPermissions.ts","/@dropins/storefront-quote-management/src/api/initialize/initialize.ts","/@dropins/storefront-quote-management/src/data/transforms/transform-store-config.ts","/@dropins/storefront-quote-management/src/api/getStoreConfig/graphql/StoreConfigQuery.ts","/@dropins/storefront-quote-management/src/api/getStoreConfig/getStoreConfig.ts","/@dropins/storefront-quote-management/src/api/setShippingAddress/graphql/SetNegotiableQuoteShippingAddressMutation.ts","/@dropins/storefront-quote-management/src/api/setShippingAddress/setShippingAddress.ts","/@dropins/storefront-quote-management/src/api/getQuoteTemplateData/graphql/getQuoteTemplateData.ts","/@dropins/storefront-quote-management/src/api/getQuoteTemplateData/getQuoteTemplateData.ts","/@dropins/storefront-quote-management/src/api/cancelQuoteTemplate/graphql/cancelQuoteTemplate.ts","/@dropins/storefront-quote-management/src/api/cancelQuoteTemplate/cancelQuoteTemplate.ts","/@dropins/storefront-quote-management/src/api/deleteQuoteTemplate/graphql/deleteQuoteTemplate.ts","/@dropins/storefront-quote-management/src/api/deleteQuoteTemplate/deleteQuoteTemplate.ts","/@dropins/storefront-quote-management/src/api/addQuoteTemplateShippingAddress/graphql/setNegotiableQuoteTemplateShippingAddress.ts","/@dropins/storefront-quote-management/src/api/addQuoteTemplateShippingAddress/addQuoteTemplateShippingAddress.ts","/@dropins/storefront-quote-management/src/api/updateQuoteTemplateItemQuantities/graphql/updateNegotiableQuoteTemplateQuantities.ts","/@dropins/storefront-quote-management/src/api/updateQuoteTemplateItemQuantities/updateQuoteTemplateItemQuantities.ts","/@dropins/storefront-quote-management/src/api/removeQuoteTemplateItems/graphql/removeNegotiableQuoteTemplateItems.ts","/@dropins/storefront-quote-management/src/api/removeQuoteTemplateItems/removeQuoteTemplateItems.ts"],"sourcesContent":["/********************************************************************\n * Copyright 2025 Adobe\n * All Rights Reserved.\n *\n * NOTICE: Adobe permits you to use, modify, and distribute this\n * file in accordance with the terms of the Adobe license agreement\n * accompanying it.\n *******************************************************************/\n\nimport { State } from '@/quote-management/types/state.types';\n\n/**\n * Type definition for the auth/permissions event payload\n * Contains flat Adobe Commerce permission keys with boolean values\n */\nexport type AuthPermissionsPayload = {\n all?: boolean;\n 'Magento_NegotiableQuote::all'?: boolean;\n 'Magento_NegotiableQuote::manage'?: boolean;\n 'Magento_NegotiableQuote::checkout'?: boolean;\n 'Magento_NegotiableQuoteTemplate::all'?: boolean;\n 'Magento_NegotiableQuoteTemplate::view_template'?: boolean;\n 'Magento_NegotiableQuoteTemplate::manage'?: boolean;\n 'Magento_NegotiableQuoteTemplate::generate_quote'?: boolean;\n [key: string]: boolean | undefined;\n};\n\n/**\n * Maps the auth/permissions event payload to internal permissions structure.\n * \n * Implements hierarchical permission checking:\n * 1. Top-level \"all\": If true, grants all permissions\n * 2. Module-level \"::all\": Grants all permissions for that module\n * 3. Specific permissions: Maps individual keys to internal flags\n * \n * @param payload - The raw auth/permissions event payload\n * @returns Typed permissions object matching the state structure\n * \n * @example\n * ```typescript\n * const permissions = mapAuthPermissions({\n * \"Magento_NegotiableQuote::manage\": true,\n * \"Magento_NegotiableQuote::checkout\": true\n * });\n * // Returns: { requestQuote: true, editQuote: true, deleteQuote: true, checkoutQuote: true, ... }\n * ```\n */\nexport function mapAuthPermissions(\n payload: AuthPermissionsPayload | null | undefined\n): State['permissions'] {\n // Handle null/undefined payload - return all false\n if (!payload || typeof payload !== 'object') {\n return {\n requestQuote: false,\n editQuote: false,\n deleteQuote: false,\n checkoutQuote: false,\n viewQuoteTemplates: false,\n manageQuoteTemplates: false,\n generateQuoteFromTemplate: false,\n };\n }\n\n // If top-level \"all\" is true, grant all permissions\n if (payload.all === true) {\n return {\n requestQuote: true,\n editQuote: true,\n deleteQuote: true,\n checkoutQuote: true,\n viewQuoteTemplates: true,\n manageQuoteTemplates: true,\n generateQuoteFromTemplate: true,\n };\n }\n\n // Check module-level \"all\" permissions\n const hasAllQuotePermissions = payload['Magento_NegotiableQuote::all'] === true;\n const hasAllTemplatePermissions = payload['Magento_NegotiableQuoteTemplate::all'] === true;\n\n // Map specific permissions with fallback to module-level \"all\"\n const hasManagePermission = \n hasAllQuotePermissions || payload['Magento_NegotiableQuote::manage'] === true;\n\n return {\n // Magento_NegotiableQuote::manage maps to request, edit, and delete\n requestQuote: hasManagePermission,\n editQuote: hasManagePermission,\n deleteQuote: hasManagePermission,\n \n // Magento_NegotiableQuote::checkout maps to checkoutQuote\n checkoutQuote: \n hasAllQuotePermissions || payload['Magento_NegotiableQuote::checkout'] === true,\n \n // Template permissions\n viewQuoteTemplates: \n hasAllTemplatePermissions || payload['Magento_NegotiableQuoteTemplate::view_template'] === true,\n manageQuoteTemplates: \n hasAllTemplatePermissions || payload['Magento_NegotiableQuoteTemplate::manage'] === true,\n generateQuoteFromTemplate: \n hasAllTemplatePermissions || payload['Magento_NegotiableQuoteTemplate::generate_quote'] === true,\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 { Initializer } from '@adobe-commerce/elsie/lib';\nimport { Lang } from '@adobe-commerce/elsie/i18n';\nimport { events } from '@adobe-commerce/event-bus';\nimport {\n state,\n DEFAULT_CONFIG,\n DEFAULT_PERMISSIONS,\n} from '@/quote-management/lib/state';\nimport {\n getQuoteData,\n getStoreConfig,\n getQuoteTemplateData,\n} from '@/quote-management/api';\nimport { mapAuthPermissions, AuthPermissionsPayload } from '@/quote-management/utils/mapAuthPermissions';\n\ntype ConfigProps = {\n langDefinitions?: Lang;\n quoteId?: string;\n quoteTemplateId?: string;\n};\n\nfunction loadQuoteData(permissions: typeof DEFAULT_PERMISSIONS) {\n // Prevent loading quote data twice\n if (state.quoteDataLoaded) return;\n\n const config = initialize.config.getConfig();\n const { quoteId, quoteTemplateId } = config;\n\n\n // Only proceed if we have permissions and at least one ID to load\n if (!permissions.editQuote || (!quoteId && !quoteTemplateId)) {\n return;\n }\n\n // Mark as loaded before starting the async operations to prevent duplicate calls\n state.quoteDataLoaded = true;\n\n if (quoteId) {\n getQuoteData(quoteId)\n .then((quote) => {\n if (!state.quoteDataInitialized) {\n events.emit('quote-management/quote-data/initialized', { quote, permissions });\n }\n state.quoteDataInitialized = true;\n })\n .catch((error) => {\n state.quoteDataLoaded = false;\n events.emit('quote-management/quote-data/error', { error });\n });\n }\n\n if (quoteTemplateId) {\n getQuoteTemplateData(quoteTemplateId)\n .catch((error) => {\n state.quoteDataLoaded = false;\n events.emit('quote-management/quote-template-data/error', { error });\n });\n }\n}\n\nexport const initialize = new Initializer<ConfigProps>({\n init: async (config) => {\n const defaultConfig = {};\n\n // Set config\n initialize.config.setConfig({ ...defaultConfig, ...config });\n\n // Fetch store config\n await getStoreConfig()\n .then((config) => {\n state.config = config;\n })\n .catch((error) => {\n console.error('Failed to fetch store config: ', error);\n state.config = DEFAULT_CONFIG;\n });\n\n // Mark initialization as complete\n state.initialized = true;\n events.emit('quote-management/initialized', {});\n },\n\n listeners: () => [\n events.on('authenticated', async (authenticated) => {\n state.authenticated = !!authenticated;\n\n // Defensive: reset permissions if user logs out\n // This ensures permissions are cleared even if auth/permissions event doesn't fire\n if (!authenticated) {\n state.permissions = DEFAULT_PERMISSIONS;\n state.quoteDataLoaded = false;\n events.emit('quote-management/permissions', DEFAULT_PERMISSIONS);\n }\n },\n {\n eager: true,\n }\n ),\n\n events.on('auth/permissions', async (payload: AuthPermissionsPayload) => {\n // Map the auth permissions payload to internal permissions structure\n const permissions = mapAuthPermissions(payload);\n\n state.permissions = permissions;\n // Reset quote data loaded flag when permissions change to allow reloading\n state.quoteDataLoaded = false;\n events.emit('quote-management/permissions', state.permissions);\n }, {\n eager: true,\n }),\n\n events.on('quote-management/permissions', async (permissions) => {\n // Only process quote data loading after initialization is complete\n if (!state.initialized) {\n return;\n }\n\n loadQuoteData(permissions);\n }, { eager: true }),\n\n events.on('quote-management/initialized', async () => {\n loadQuoteData(state.permissions);\n }, { eager: true }),\n\n events.on('checkout/updated', async (data) => {\n // Only process after initialization is complete\n if (!state.initialized) {\n return;\n }\n\n if (data?.type !== 'quote') {\n return;\n }\n\n // Reset the flag to allow reloading of quote data\n state.quoteDataLoaded = false;\n loadQuoteData(state.permissions);\n }, { eager: true }),\n ],\n});\n\nexport const config = initialize.config;\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 {\n QuoteDisplayAmount,\n StoreConfigModel,\n} from '@/quote-management/data/models';\nimport { DEFAULT_CONFIG } from '@/quote-management/lib/state';\n\nexport function transformStoreConfig(data: any): StoreConfigModel {\n if (!data) return DEFAULT_CONFIG;\n\n const transformQuoteDisplayAmountSetting = (\n quoteDisplayAmountSetting: number\n ) => {\n if (\n [\n QuoteDisplayAmount.TAX_EXCLUDED,\n QuoteDisplayAmount.TAX_INCLUDED,\n QuoteDisplayAmount.TAX_INCLUDED_AND_EXCLUDED,\n ].includes(quoteDisplayAmountSetting)\n ) {\n return quoteDisplayAmountSetting;\n }\n\n return QuoteDisplayAmount.TAX_EXCLUDED;\n };\n\n return {\n quoteSummaryDisplayTotal: data.cart_summary_display_quantity,\n quoteSummaryMaxItems: data.max_items_in_order_summary,\n quoteDisplaySettings: {\n zeroTax: data.shopping_cart_display_zero_tax,\n subtotal: transformQuoteDisplayAmountSetting(\n data.shopping_cart_display_subtotal\n ),\n price: transformQuoteDisplayAmountSetting(\n data.shopping_cart_display_price\n ),\n shipping: transformQuoteDisplayAmountSetting(\n data.shopping_cart_display_shipping\n ),\n fullSummary: data.shopping_cart_display_full_summary,\n grandTotal: data.shopping_cart_display_grand_total,\n },\n useConfigurableParentThumbnail:\n data.configurable_thumbnail_source === 'parent',\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\nexport const STORE_CONFIG_QUERY = /* GraphQL */ `\n query STORE_CONFIG_QUERY {\n storeConfig {\n cart_summary_display_quantity\n max_items_in_order_summary\n shopping_cart_display_full_summary\n shopping_cart_display_grand_total\n shopping_cart_display_price\n shopping_cart_display_shipping\n shopping_cart_display_subtotal\n shopping_cart_display_zero_tax\n configurable_thumbnail_source\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 { fetchGraphQl } from '@/quote-management/api';\nimport { StoreConfigModel } from '@/quote-management/data/models';\nimport { transformStoreConfig } from '@/quote-management/data/transforms';\nimport { STORE_CONFIG_QUERY } from './graphql/StoreConfigQuery';\n\nexport const getStoreConfig = async (): Promise<StoreConfigModel> => {\n return fetchGraphQl(STORE_CONFIG_QUERY, {\n method: 'GET',\n cache: 'force-cache',\n }).then(({ errors, data }) => {\n if (errors) {\n const errorMessage = errors.map((e: any) => e.message).join(', ');\n throw new Error(`Failed to get store config: ${errorMessage}`);\n }\n\n return transformStoreConfig(data.storeConfig);\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 { 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 * 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","/********************************************************************\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 { NEGOTIABLE_QUOTE_TEMPLATE_FRAGMENT } from '@/quote-management/api/graphql/NegotiableQuoteTemplateFragment';\n\nexport const GET_QUOTE_TEMPLATE_DATA = /* GraphQL */ `\n query QUOTE_TEMPLATE_DATA_QUERY($templateId: ID!) {\n negotiableQuoteTemplate(templateId: $templateId) {\n ...NegotiableQuoteTemplateFragment\n }\n }\n\n ${NEGOTIABLE_QUOTE_TEMPLATE_FRAGMENT}\n`;\n","/********************************************************************\n * Copyright 2025 Adobe\n * All Rights Reserved.\n *\n * NOTICE: Adobe permits you to use, modify, and distribute this \n * file in accordance with the terms of the Adobe license agreement \n * accompanying it. \n *******************************************************************/\n\nimport { fetchGraphQl } from '@/quote-management/api';\nimport { GET_QUOTE_TEMPLATE_DATA } from './graphql/getQuoteTemplateData';\nimport { transformQuoteTemplate } from '@/quote-management/data/transforms';\nimport { NegotiableQuoteTemplateModel } from '@/quote-management/data/models/negotiable-quote-template-model';\nimport { state } from '@/quote-management/lib/state';\nimport { events } from '@adobe-commerce/event-bus';\n\nexport const getQuoteTemplateData = async (templateId: string): Promise<NegotiableQuoteTemplateModel | null> => {\n\n if (!state.authenticated) {\n throw new Error('Unauthorized');\n }\n\n if (!templateId) {\n throw new Error('Template ID is required');\n }\n\n try {\n const results: any = await fetchGraphQl(GET_QUOTE_TEMPLATE_DATA, {\n variables: { templateId },\n });\n\n\n if (!results?.data?.negotiableQuoteTemplate) {\n throw new Error('Quote template not found');\n }\n\n const transformedData = transformQuoteTemplate(results.data.negotiableQuoteTemplate);\n\n if (!transformedData) {\n throw new Error('Failed to transform quote template data');\n }\n\n events.emit('quote-management/quote-template-data', {\n quoteTemplate: transformedData,\n permissions: state.permissions,\n });\n\n return transformedData;\n } catch (error) {\n return Promise.reject(error);\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 { NEGOTIABLE_QUOTE_TEMPLATE_FRAGMENT } from '@/quote-management/api/graphql/NegotiableQuoteTemplateFragment';\n\nexport const CANCEL_QUOTE_TEMPLATE_MUTATION = /* GraphQL */ `\n mutation CANCEL_QUOTE_TEMPLATE_MUTATION(\n $templateId: ID!\n $comment: String\n ) {\n cancelNegotiableQuoteTemplate(\n input: {\n template_id: $templateId\n cancellation_comment: $comment\n }\n ) {\n ...NegotiableQuoteTemplateFragment\n }\n }\n ${NEGOTIABLE_QUOTE_TEMPLATE_FRAGMENT}\n`;\n","/********************************************************************\n * Copyright 2025 Adobe\n * All Rights Reserved.\n *\n * NOTICE: Adobe permits you to use, modify, and distribute this\n * file in accordance with the terms of the Adobe license agreement\n * accompanying it.\n *******************************************************************/\n\nimport { fetchGraphQl } from '@/quote-management/api';\nimport { CANCEL_QUOTE_TEMPLATE_MUTATION } from './graphql/cancelQuoteTemplate';\nimport { transformQuoteTemplate } from '@/quote-management/data/transforms';\nimport { state } from '@/quote-management/lib/state';\nimport { events } from '@adobe-commerce/event-bus';\n\nexport interface CancelQuoteTemplateParams {\n templateId: string;\n comment?: string;\n}\n\nexport const cancelQuoteTemplate = async (\n params: CancelQuoteTemplateParams\n) => {\n if (!params.templateId) {\n throw new Error('Template ID is required');\n }\n\n if (!state.authenticated) {\n throw new Error('Unauthorized');\n }\n\n try {\n const results: any = await fetchGraphQl(CANCEL_QUOTE_TEMPLATE_MUTATION, {\n variables: { templateId: params.templateId, comment: params.comment },\n });\n\n if (!results?.data?.cancelNegotiableQuoteTemplate) {\n throw new Error('No quote template data received');\n }\n\n const transformedData = transformQuoteTemplate(\n results.data.cancelNegotiableQuoteTemplate\n );\n\n if (!transformedData) {\n throw new Error('Failed to transform quote template data');\n }\n\n events.emit('quote-management/quote-template-data', {\n quoteTemplate: transformedData,\n permissions: state.permissions,\n });\n\n return transformedData;\n } catch (error) {\n return Promise.reject(error);\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\nexport const DELETE_QUOTE_TEMPLATE_MUTATION = /* GraphQL */ `\n mutation DELETE_QUOTE_TEMPLATE_MUTATION($templateId: ID!) {\n deleteNegotiableQuoteTemplate(input: { template_id: $templateId })\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 { fetchGraphQl } from '@/quote-management/api';\nimport { DELETE_QUOTE_TEMPLATE_MUTATION } from './graphql/deleteQuoteTemplate';\nimport { state } from '@/quote-management/lib/state';\nimport { events } from '@adobe-commerce/event-bus';\n\nexport interface DeleteQuoteTemplateParams {\n templateId: string;\n}\n\nexport const deleteQuoteTemplate = async (\n params: DeleteQuoteTemplateParams\n) => {\n if (!params.templateId) {\n throw new Error('Template ID is required');\n }\n\n if (!state.authenticated) {\n throw new Error('Unauthorized');\n }\n\n try {\n const results: any = await fetchGraphQl(DELETE_QUOTE_TEMPLATE_MUTATION, {\n variables: { templateId: params.templateId },\n });\n\n if (results?.errors && results.errors.length > 0) {\n const errorMessages = results.errors\n .map((e: any) => e?.message)\n .filter(Boolean)\n .join('; ');\n throw new Error(errorMessages || 'Failed to delete quote template');\n }\n\n const deleted = results?.data?.deleteNegotiableQuoteTemplate;\n\n if (!deleted) {\n throw new Error('Failed to delete quote template');\n }\n\n events.emit('quote-management/quote-template-deleted', {\n templateId: params.templateId,\n });\n\n return { templateId: params.templateId };\n } catch (error) {\n return Promise.reject(error);\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 { NEGOTIABLE_QUOTE_TEMPLATE_FRAGMENT } from '@/quote-management/api/graphql/NegotiableQuoteTemplateFragment';\n\nexport const SET_NEGOTIABLE_QUOTE_TEMPLATE_SHIPPING_ADDRESS_MUTATION = /* GraphQL */ `\n mutation SET_NEGOTIABLE_QUOTE_TEMPLATE_SHIPPING_ADDRESS_MUTATION(\n $templateId: ID!\n $shippingAddress: NegotiableQuoteTemplateShippingAddressInput!\n ) {\n setNegotiableQuoteTemplateShippingAddress(\n input: {\n template_id: $templateId\n shipping_address: $shippingAddress\n }\n ) {\n ...NegotiableQuoteTemplateFragment\n }\n }\n \n ${NEGOTIABLE_QUOTE_TEMPLATE_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 { SET_NEGOTIABLE_QUOTE_TEMPLATE_SHIPPING_ADDRESS_MUTATION } from './graphql/setNegotiableQuoteTemplateShippingAddress';\nimport { transformQuoteTemplate } from '@/quote-management/data/transforms';\nimport { state } from '@/quote-management/lib/state';\nimport { events } from '@adobe-commerce/event-bus';\n\nexport interface NegotiableQuoteAddressInput {\n city: string;\n company?: string;\n countryCode: string;\n fax?: string;\n firstname: string;\n lastname: string;\n middlename?: string;\n postcode?: string;\n prefix?: string;\n region?: string;\n regionId?: number;\n saveInAddressBook?: boolean;\n street: string[];\n suffix?: string;\n telephone?: string;\n vatId?: string;\n}\n\nexport interface NegotiableQuoteTemplateShippingAddressInput {\n address?: NegotiableQuoteAddressInput;\n customerAddressUid?: string;\n customerNotes?: string;\n}\n\nexport interface AddQuoteTemplateShippingAddressParams {\n templateId: string;\n shippingAddress: NegotiableQuoteTemplateShippingAddressInput;\n}\n\nexport const addQuoteTemplateShippingAddress = async (\n params: AddQuoteTemplateShippingAddressParams\n) => {\n if (!params.templateId) {\n throw new Error('Template ID is required');\n }\n\n if (!params.shippingAddress) {\n throw new Error('Shipping address is required');\n }\n\n if (!state.authenticated) {\n throw new Error('Unauthorized');\n }\n\n // Validate that at least one of address or customerAddressUid is provided\n if (\n !params.shippingAddress.address &&\n !params.shippingAddress.customerAddressUid\n ) {\n throw new Error('Either address or customerAddressUid must be provided');\n }\n\n try {\n const results: any = await fetchGraphQl(\n SET_NEGOTIABLE_QUOTE_TEMPLATE_SHIPPING_ADDRESS_MUTATION,\n {\n variables: {\n templateId: params.templateId,\n shippingAddress: {\n address: params.shippingAddress.address\n ? {\n city: params.shippingAddress.address.city,\n company: params.shippingAddress.address.company,\n country_code: params.shippingAddress.address.countryCode,\n fax: params.shippingAddress.address.fax,\n firstname: params.shippingAddress.address.firstname,\n lastname: params.shippingAddress.address.lastname,\n middlename: params.shippingAddress.address.middlename,\n postcode: params.shippingAddress.address.postcode,\n prefix: params.shippingAddress.address.prefix,\n region: params.shippingAddress.address.region,\n region_id: params.shippingAddress.address.regionId,\n save_in_address_book:\n params.shippingAddress.address.saveInAddressBook,\n street: params.shippingAddress.address.street,\n suffix: params.shippingAddress.address.suffix,\n telephone: params.shippingAddress.address.telephone,\n vat_id: params.shippingAddress.address.vatId,\n }\n : undefined,\n customer_address_uid: params.shippingAddress.customerAddressUid,\n customer_notes: params.shippingAddress.customerNotes,\n },\n },\n }\n );\n\n if (!results?.data?.setNegotiableQuoteTemplateShippingAddress) {\n throw new Error('No quote template data received');\n }\n\n const transformedData = transformQuoteTemplate(\n results.data.setNegotiableQuoteTemplateShippingAddress\n );\n\n if (!transformedData) {\n throw new Error('Failed to transform quote template data');\n }\n\n events.emit('quote-management/quote-template-data', {\n quoteTemplate: transformedData,\n permissions: state.permissions,\n });\n\n return transformedData;\n } catch (error) {\n return Promise.reject(error);\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 { NEGOTIABLE_QUOTE_TEMPLATE_FRAGMENT } from '@/quote-management/api/graphql/NegotiableQuoteTemplateFragment';\n\nexport const UPDATE_NEGOTIABLE_QUOTE_TEMPLATE_QUANTITIES_MUTATION = /* GraphQL */ `\n mutation UPDATE_NEGOTIABLE_QUOTE_TEMPLATE_QUANTITIES_MUTATION(\n $input: UpdateNegotiableQuoteTemplateQuantitiesInput!\n ) {\n updateNegotiableQuoteTemplateQuantities(input: $input) {\n quote_template {\n ...NegotiableQuoteTemplateFragment\n }\n }\n }\n ${NEGOTIABLE_QUOTE_TEMPLATE_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 { UPDATE_NEGOTIABLE_QUOTE_TEMPLATE_QUANTITIES_MUTATION } from './graphql/updateNegotiableQuoteTemplateQuantities';\nimport { transformQuoteTemplate } from '@/quote-management/data/transforms';\nimport { state } from '@/quote-management/lib/state';\nimport { events } from '@adobe-commerce/event-bus';\n\nexport interface NegotiableQuoteTemplateItemQuantityInput {\n itemId: string;\n quantity: number;\n minQty?: number;\n maxQty?: number;\n}\n\nexport interface UpdateQuoteTemplateItemQuantitiesParams {\n templateId: string;\n items: NegotiableQuoteTemplateItemQuantityInput[];\n}\n\nexport const updateQuoteTemplateItemQuantities = async (\n params: UpdateQuoteTemplateItemQuantitiesParams\n) => {\n if (!params.templateId) {\n throw new Error('Template ID is required');\n }\n\n if (!params.items || params.items.length === 0) {\n throw new Error('Items array is required and must not be empty');\n }\n\n if (!state.authenticated) {\n throw new Error('Unauthorized');\n }\n\n try {\n const results: any = await fetchGraphQl(\n UPDATE_NEGOTIABLE_QUOTE_TEMPLATE_QUANTITIES_MUTATION,\n {\n variables: {\n input: {\n template_id: params.templateId,\n items: params.items.map((item) => ({\n item_id: item.itemId,\n quantity: item.quantity,\n min_qty: item.minQty,\n max_qty: item.maxQty,\n })),\n },\n },\n }\n );\n\n if (\n !results?.data?.updateNegotiableQuoteTemplateQuantities?.quote_template\n ) {\n throw new Error('No quote template data received');\n }\n\n const transformedData = transformQuoteTemplate(\n results.data.updateNegotiableQuoteTemplateQuantities.quote_template\n );\n\n if (!transformedData) {\n throw new Error('Failed to transform quote template data');\n }\n\n events.emit('quote-management/quote-template-data', {\n quoteTemplate: transformedData,\n permissions: state.permissions,\n });\n\n return transformedData;\n } catch (error) {\n return Promise.reject(error);\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 { NEGOTIABLE_QUOTE_TEMPLATE_FRAGMENT } from '@/quote-management/api/graphql/NegotiableQuoteTemplateFragment';\n\nexport const REMOVE_NEGOTIABLE_QUOTE_TEMPLATE_ITEMS_MUTATION = /* GraphQL */ `\n mutation REMOVE_NEGOTIABLE_QUOTE_TEMPLATE_ITEMS_MUTATION(\n $input: RemoveNegotiableQuoteTemplateItemsInput!\n ) {\n removeNegotiableQuoteTemplateItems(input: $input) {\n ...NegotiableQuoteTemplateFragment\n }\n }\n ${NEGOTIABLE_QUOTE_TEMPLATE_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 { REMOVE_NEGOTIABLE_QUOTE_TEMPLATE_ITEMS_MUTATION } from './graphql/removeNegotiableQuoteTemplateItems';\nimport { transformQuoteTemplate } from '@/quote-management/data/transforms';\nimport { state } from '@/quote-management/lib/state';\nimport { events } from '@adobe-commerce/event-bus';\n\nexport interface RemoveQuoteTemplateItemsParams {\n templateId: string;\n itemUids: string[];\n}\n\nexport const removeQuoteTemplateItems = async (\n params: RemoveQuoteTemplateItemsParams\n) => {\n if (!params.templateId) {\n throw new Error('Template ID is required');\n }\n\n if (!params.itemUids || params.itemUids.length === 0) {\n throw new Error('Item UIDs array is required and must not be empty');\n }\n\n if (!state.authenticated) {\n throw new Error('Unauthorized');\n }\n\n try {\n const results: any = await fetchGraphQl(\n REMOVE_NEGOTIABLE_QUOTE_TEMPLATE_ITEMS_MUTATION,\n {\n variables: {\n input: {\n template_id: params.templateId,\n item_uids: params.itemUids,\n },\n },\n }\n );\n\n if (!results?.data?.removeNegotiableQuoteTemplateItems) {\n throw new Error('No quote template data received');\n }\n\n const transformedData = transformQuoteTemplate(\n results.data.removeNegotiableQuoteTemplateItems\n );\n\n if (!transformedData) {\n throw new Error('Failed to transform quote template data');\n }\n\n events.emit('quote-management/quote-template-data', {\n quoteTemplate: transformedData,\n permissions: state.permissions,\n });\n\n return transformedData;\n } catch (error) {\n return Promise.reject(error);\n }\n};\n"],"names":["mapAuthPermissions","payload","hasAllQuotePermissions","hasAllTemplatePermissions","hasManagePermission","loadQuoteData","permissions","state","config","initialize","quoteId","quoteTemplateId","getQuoteData","quote","events","error","getQuoteTemplateData","Initializer","defaultConfig","getStoreConfig","DEFAULT_CONFIG","authenticated","DEFAULT_PERMISSIONS","data","transformStoreConfig","transformQuoteDisplayAmountSetting","quoteDisplayAmountSetting","QuoteDisplayAmount","STORE_CONFIG_QUERY","fetchGraphQl","errors","errorMessage","e","SET_NEGOTIABLE_QUOTE_SHIPPING_ADDRESS_MUTATION","NEGOTIABLE_QUOTE_FRAGMENT","transformAddressToSnakeCase","address","additionalInput","standardFields","transformedStandardFields","setShippingAddress","input","quoteUid","addressId","addressData","transformedAddressData","response","errorMessages","quoteData","transformQuote","_b","_a","GET_QUOTE_TEMPLATE_DATA","NEGOTIABLE_QUOTE_TEMPLATE_FRAGMENT","templateId","results","transformedData","transformQuoteTemplate","CANCEL_QUOTE_TEMPLATE_MUTATION","cancelQuoteTemplate","params","DELETE_QUOTE_TEMPLATE_MUTATION","deleteQuoteTemplate","SET_NEGOTIABLE_QUOTE_TEMPLATE_SHIPPING_ADDRESS_MUTATION","addQuoteTemplateShippingAddress","UPDATE_NEGOTIABLE_QUOTE_TEMPLATE_QUANTITIES_MUTATION","updateQuoteTemplateItemQuantities","item","REMOVE_NEGOTIABLE_QUOTE_TEMPLATE_ITEMS_MUTATION","removeQuoteTemplateItems"],"mappings":"ipCA+CO,SAASA,EACdC,EACsB,CAEtB,GAAI,CAACA,GAAW,OAAOA,GAAY,SACjC,MAAO,CACL,aAAc,GACd,UAAW,GACX,YAAa,GACb,cAAe,GACf,mBAAoB,GACpB,qBAAsB,GACtB,0BAA2B,EAAA,EAK/B,GAAIA,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AkBC,EACtBF,EAAQ,KAAK,kCAAA,EAGf,GAAI,CAACC,EACH,MAAM,IAAI,MAAM,yCAAyC,EAG3D,OAAA1C,EAAO,KAAK,uCAAwC,CAClD,cAAe0C,EACf,YAAajD,EAAM,WAAA,CACpB,EAEMiD,CACT,OAASzC,EAAO,CACd,OAAO,QAAQ,OAAOA,CAAK,CAC7B,CACF"}
|
|
1
|
+
{"version":3,"file":"api.js","sources":["/@dropins/storefront-quote-management/src/utils/mapAuthPermissions.ts","/@dropins/storefront-quote-management/src/api/initialize/initialize.ts","/@dropins/storefront-quote-management/src/data/transforms/transform-store-config.ts","/@dropins/storefront-quote-management/src/api/getStoreConfig/graphql/StoreConfigQuery.ts","/@dropins/storefront-quote-management/src/api/getStoreConfig/getStoreConfig.ts","/@dropins/storefront-quote-management/src/api/setShippingAddress/graphql/SetNegotiableQuoteShippingAddressMutation.ts","/@dropins/storefront-quote-management/src/api/setShippingAddress/setShippingAddress.ts","/@dropins/storefront-quote-management/src/api/getQuoteTemplateData/graphql/getQuoteTemplateData.ts","/@dropins/storefront-quote-management/src/api/getQuoteTemplateData/getQuoteTemplateData.ts","/@dropins/storefront-quote-management/src/api/addQuoteTemplateShippingAddress/graphql/setNegotiableQuoteTemplateShippingAddress.ts","/@dropins/storefront-quote-management/src/api/addQuoteTemplateShippingAddress/addQuoteTemplateShippingAddress.ts"],"sourcesContent":["/********************************************************************\n * Copyright 2025 Adobe\n * All Rights Reserved.\n *\n * NOTICE: Adobe permits you to use, modify, and distribute this\n * file in accordance with the terms of the Adobe license agreement\n * accompanying it.\n *******************************************************************/\n\nimport { State } from '@/quote-management/types/state.types';\n\n/**\n * Type definition for the auth/permissions event payload\n * Contains flat Adobe Commerce permission keys with boolean values\n */\nexport type AuthPermissionsPayload = {\n all?: boolean;\n 'Magento_NegotiableQuote::all'?: boolean;\n 'Magento_NegotiableQuote::manage'?: boolean;\n 'Magento_NegotiableQuote::checkout'?: boolean;\n 'Magento_NegotiableQuoteTemplate::all'?: boolean;\n 'Magento_NegotiableQuoteTemplate::view_template'?: boolean;\n 'Magento_NegotiableQuoteTemplate::manage'?: boolean;\n 'Magento_NegotiableQuoteTemplate::generate_quote'?: boolean;\n [key: string]: boolean | undefined;\n};\n\n/**\n * Maps the auth/permissions event payload to internal permissions structure.\n * \n * Implements hierarchical permission checking:\n * 1. Top-level \"all\": If true, grants all permissions\n * 2. Module-level \"::all\": Grants all permissions for that module\n * 3. Specific permissions: Maps individual keys to internal flags\n * \n * @param payload - The raw auth/permissions event payload\n * @returns Typed permissions object matching the state structure\n * \n * @example\n * ```typescript\n * const permissions = mapAuthPermissions({\n * \"Magento_NegotiableQuote::manage\": true,\n * \"Magento_NegotiableQuote::checkout\": true\n * });\n * // Returns: { requestQuote: true, editQuote: true, deleteQuote: true, checkoutQuote: true, ... }\n * ```\n */\nexport function mapAuthPermissions(\n payload: AuthPermissionsPayload | null | undefined\n): State['permissions'] {\n // Handle null/undefined payload - return all false\n if (!payload || typeof payload !== 'object') {\n return {\n requestQuote: false,\n editQuote: false,\n deleteQuote: false,\n checkoutQuote: false,\n viewQuoteTemplates: false,\n manageQuoteTemplates: false,\n generateQuoteFromTemplate: false,\n };\n }\n\n // If top-level \"all\" is true, grant all permissions\n if (payload.all === true) {\n return {\n requestQuote: true,\n editQuote: true,\n deleteQuote: true,\n checkoutQuote: true,\n viewQuoteTemplates: true,\n manageQuoteTemplates: true,\n generateQuoteFromTemplate: true,\n };\n }\n\n // Check module-level \"all\" permissions\n const hasAllQuotePermissions = payload['Magento_NegotiableQuote::all'] === true;\n const hasAllTemplatePermissions = payload['Magento_NegotiableQuoteTemplate::all'] === true;\n\n // Map specific permissions with fallback to module-level \"all\"\n const hasManagePermission = \n hasAllQuotePermissions || payload['Magento_NegotiableQuote::manage'] === true;\n\n return {\n // Magento_NegotiableQuote::manage maps to request, edit, and delete\n requestQuote: hasManagePermission,\n editQuote: hasManagePermission,\n deleteQuote: hasManagePermission,\n \n // Magento_NegotiableQuote::checkout maps to checkoutQuote\n checkoutQuote: \n hasAllQuotePermissions || payload['Magento_NegotiableQuote::checkout'] === true,\n \n // Template permissions\n viewQuoteTemplates: \n hasAllTemplatePermissions || payload['Magento_NegotiableQuoteTemplate::view_template'] === true,\n manageQuoteTemplates: \n hasAllTemplatePermissions || payload['Magento_NegotiableQuoteTemplate::manage'] === true,\n generateQuoteFromTemplate: \n hasAllTemplatePermissions || payload['Magento_NegotiableQuoteTemplate::generate_quote'] === true,\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 { Initializer } from '@adobe-commerce/elsie/lib';\nimport { Lang } from '@adobe-commerce/elsie/i18n';\nimport { events } from '@adobe-commerce/event-bus';\nimport {\n state,\n DEFAULT_CONFIG,\n DEFAULT_PERMISSIONS,\n} from '@/quote-management/lib/state';\nimport {\n getQuoteData,\n getStoreConfig,\n getQuoteTemplateData,\n} from '@/quote-management/api';\nimport { mapAuthPermissions, AuthPermissionsPayload } from '@/quote-management/utils/mapAuthPermissions';\n\ntype ConfigProps = {\n langDefinitions?: Lang;\n quoteId?: string;\n quoteTemplateId?: string;\n};\n\nfunction loadQuoteData(permissions: typeof DEFAULT_PERMISSIONS) {\n // Prevent loading quote data twice\n if (state.quoteDataLoaded) return;\n\n const config = initialize.config.getConfig();\n const { quoteId, quoteTemplateId } = config;\n\n\n // Only proceed if we have permissions and at least one ID to load\n if (!permissions.editQuote || (!quoteId && !quoteTemplateId)) {\n return;\n }\n\n // Mark as loaded before starting the async operations to prevent duplicate calls\n state.quoteDataLoaded = true;\n\n if (quoteId) {\n getQuoteData(quoteId)\n .then((quote) => {\n if (!state.quoteDataInitialized) {\n events.emit('quote-management/quote-data/initialized', { quote, permissions });\n }\n state.quoteDataInitialized = true;\n })\n .catch((error) => {\n state.quoteDataLoaded = false;\n events.emit('quote-management/quote-data/error', { error });\n });\n }\n\n if (quoteTemplateId) {\n getQuoteTemplateData(quoteTemplateId)\n .catch((error) => {\n state.quoteDataLoaded = false;\n events.emit('quote-management/quote-template-data/error', { error });\n });\n }\n}\n\nexport const initialize = new Initializer<ConfigProps>({\n init: async (config) => {\n const defaultConfig = {};\n\n // Set config\n initialize.config.setConfig({ ...defaultConfig, ...config });\n\n // Fetch store config\n await getStoreConfig()\n .then((config) => {\n state.config = config;\n })\n .catch((error) => {\n console.error('Failed to fetch store config: ', error);\n state.config = DEFAULT_CONFIG;\n });\n\n // Mark initialization as complete\n state.initialized = true;\n events.emit('quote-management/initialized', {});\n },\n\n listeners: () => [\n events.on('authenticated', async (authenticated) => {\n state.authenticated = !!authenticated;\n\n // Defensive: reset permissions if user logs out\n // This ensures permissions are cleared even if auth/permissions event doesn't fire\n if (!authenticated) {\n state.permissions = DEFAULT_PERMISSIONS;\n state.quoteDataLoaded = false;\n events.emit('quote-management/permissions', DEFAULT_PERMISSIONS);\n }\n },\n {\n eager: true,\n }\n ),\n\n events.on('auth/permissions', async (payload: AuthPermissionsPayload) => {\n // Map the auth permissions payload to internal permissions structure\n const permissions = mapAuthPermissions(payload);\n\n state.permissions = permissions;\n // Reset quote data loaded flag when permissions change to allow reloading\n state.quoteDataLoaded = false;\n events.emit('quote-management/permissions', state.permissions);\n }, {\n eager: true,\n }),\n\n events.on('quote-management/permissions', async (permissions) => {\n // Only process quote data loading after initialization is complete\n if (!state.initialized) {\n return;\n }\n\n loadQuoteData(permissions);\n }, { eager: true }),\n\n events.on('quote-management/initialized', async () => {\n loadQuoteData(state.permissions);\n }, { eager: true }),\n\n events.on('checkout/updated', async (data) => {\n // Only process after initialization is complete\n if (!state.initialized) {\n return;\n }\n\n if (data?.type !== 'quote') {\n return;\n }\n\n // Reset the flag to allow reloading of quote data\n state.quoteDataLoaded = false;\n loadQuoteData(state.permissions);\n }, { eager: true }),\n ],\n});\n\nexport const config = initialize.config;\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 {\n QuoteDisplayAmount,\n StoreConfigModel,\n} from '@/quote-management/data/models';\nimport { DEFAULT_CONFIG } from '@/quote-management/lib/state';\n\nexport function transformStoreConfig(data: any): StoreConfigModel {\n if (!data) return DEFAULT_CONFIG;\n\n const transformQuoteDisplayAmountSetting = (\n quoteDisplayAmountSetting: number\n ) => {\n if (\n [\n QuoteDisplayAmount.TAX_EXCLUDED,\n QuoteDisplayAmount.TAX_INCLUDED,\n QuoteDisplayAmount.TAX_INCLUDED_AND_EXCLUDED,\n ].includes(quoteDisplayAmountSetting)\n ) {\n return quoteDisplayAmountSetting;\n }\n\n return QuoteDisplayAmount.TAX_EXCLUDED;\n };\n\n return {\n quoteSummaryDisplayTotal: data.cart_summary_display_quantity,\n quoteSummaryMaxItems: data.max_items_in_order_summary,\n quoteDisplaySettings: {\n zeroTax: data.shopping_cart_display_zero_tax,\n subtotal: transformQuoteDisplayAmountSetting(\n data.shopping_cart_display_subtotal\n ),\n price: transformQuoteDisplayAmountSetting(\n data.shopping_cart_display_price\n ),\n shipping: transformQuoteDisplayAmountSetting(\n data.shopping_cart_display_shipping\n ),\n fullSummary: data.shopping_cart_display_full_summary,\n grandTotal: data.shopping_cart_display_grand_total,\n },\n useConfigurableParentThumbnail:\n data.configurable_thumbnail_source === 'parent',\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\nexport const STORE_CONFIG_QUERY = /* GraphQL */ `\n query STORE_CONFIG_QUERY {\n storeConfig {\n cart_summary_display_quantity\n max_items_in_order_summary\n shopping_cart_display_full_summary\n shopping_cart_display_grand_total\n shopping_cart_display_price\n shopping_cart_display_shipping\n shopping_cart_display_subtotal\n shopping_cart_display_zero_tax\n configurable_thumbnail_source\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 { fetchGraphQl } from '@/quote-management/api';\nimport { StoreConfigModel } from '@/quote-management/data/models';\nimport { transformStoreConfig } from '@/quote-management/data/transforms';\nimport { STORE_CONFIG_QUERY } from './graphql/StoreConfigQuery';\n\nexport const getStoreConfig = async (): Promise<StoreConfigModel> => {\n return fetchGraphQl(STORE_CONFIG_QUERY, {\n method: 'GET',\n cache: 'force-cache',\n }).then(({ errors, data }) => {\n if (errors) {\n const errorMessage = errors.map((e: any) => e.message).join(', ');\n throw new Error(`Failed to get store config: ${errorMessage}`);\n }\n\n return transformStoreConfig(data.storeConfig);\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 { 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 * 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","/********************************************************************\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 { NEGOTIABLE_QUOTE_TEMPLATE_FRAGMENT } from '@/quote-management/api/graphql/NegotiableQuoteTemplateFragment';\n\nexport const GET_QUOTE_TEMPLATE_DATA = /* GraphQL */ `\n query QUOTE_TEMPLATE_DATA_QUERY($templateId: ID!) {\n negotiableQuoteTemplate(templateId: $templateId) {\n ...NegotiableQuoteTemplateFragment\n }\n }\n\n ${NEGOTIABLE_QUOTE_TEMPLATE_FRAGMENT}\n`;\n","/********************************************************************\n * Copyright 2025 Adobe\n * All Rights Reserved.\n *\n * NOTICE: Adobe permits you to use, modify, and distribute this \n * file in accordance with the terms of the Adobe license agreement \n * accompanying it. \n *******************************************************************/\n\nimport { fetchGraphQl } from '@/quote-management/api';\nimport { GET_QUOTE_TEMPLATE_DATA } from './graphql/getQuoteTemplateData';\nimport { transformQuoteTemplate } from '@/quote-management/data/transforms';\nimport { NegotiableQuoteTemplateModel } from '@/quote-management/data/models/negotiable-quote-template-model';\nimport { state } from '@/quote-management/lib/state';\nimport { events } from '@adobe-commerce/event-bus';\n\nexport const getQuoteTemplateData = async (templateId: string): Promise<NegotiableQuoteTemplateModel | null> => {\n\n if (!state.authenticated) {\n throw new Error('Unauthorized');\n }\n\n if (!templateId) {\n throw new Error('Template ID is required');\n }\n\n try {\n const results: any = await fetchGraphQl(GET_QUOTE_TEMPLATE_DATA, {\n variables: { templateId },\n });\n\n\n if (!results?.data?.negotiableQuoteTemplate) {\n throw new Error('Quote template not found');\n }\n\n const transformedData = transformQuoteTemplate(results.data.negotiableQuoteTemplate);\n\n if (!transformedData) {\n throw new Error('Failed to transform quote template data');\n }\n\n events.emit('quote-management/quote-template-data', {\n quoteTemplate: transformedData,\n permissions: state.permissions,\n });\n\n return transformedData;\n } catch (error) {\n return Promise.reject(error);\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 { NEGOTIABLE_QUOTE_TEMPLATE_FRAGMENT } from '@/quote-management/api/graphql/NegotiableQuoteTemplateFragment';\n\nexport const SET_NEGOTIABLE_QUOTE_TEMPLATE_SHIPPING_ADDRESS_MUTATION = /* GraphQL */ `\n mutation SET_NEGOTIABLE_QUOTE_TEMPLATE_SHIPPING_ADDRESS_MUTATION(\n $templateId: ID!\n $shippingAddress: NegotiableQuoteTemplateShippingAddressInput!\n ) {\n setNegotiableQuoteTemplateShippingAddress(\n input: {\n template_id: $templateId\n shipping_address: $shippingAddress\n }\n ) {\n ...NegotiableQuoteTemplateFragment\n }\n }\n \n ${NEGOTIABLE_QUOTE_TEMPLATE_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 { SET_NEGOTIABLE_QUOTE_TEMPLATE_SHIPPING_ADDRESS_MUTATION } from './graphql/setNegotiableQuoteTemplateShippingAddress';\nimport { transformQuoteTemplate } from '@/quote-management/data/transforms';\nimport { state } from '@/quote-management/lib/state';\nimport { events } from '@adobe-commerce/event-bus';\n\nexport interface NegotiableQuoteAddressInput {\n city: string;\n company?: string;\n countryCode: string;\n fax?: string;\n firstname: string;\n lastname: string;\n middlename?: string;\n postcode?: string;\n prefix?: string;\n region?: string;\n regionId?: number;\n saveInAddressBook?: boolean;\n street: string[];\n suffix?: string;\n telephone?: string;\n vatId?: string;\n}\n\nexport interface NegotiableQuoteTemplateShippingAddressInput {\n address?: NegotiableQuoteAddressInput;\n customerAddressUid?: string;\n customerNotes?: string;\n}\n\nexport interface AddQuoteTemplateShippingAddressParams {\n templateId: string;\n shippingAddress: NegotiableQuoteTemplateShippingAddressInput;\n}\n\nexport const addQuoteTemplateShippingAddress = async (\n params: AddQuoteTemplateShippingAddressParams\n) => {\n if (!params.templateId) {\n throw new Error('Template ID is required');\n }\n\n if (!params.shippingAddress) {\n throw new Error('Shipping address is required');\n }\n\n if (!state.authenticated) {\n throw new Error('Unauthorized');\n }\n\n // Validate that at least one of address or customerAddressUid is provided\n if (\n !params.shippingAddress.address &&\n !params.shippingAddress.customerAddressUid\n ) {\n throw new Error('Either address or customerAddressUid must be provided');\n }\n\n try {\n const results: any = await fetchGraphQl(\n SET_NEGOTIABLE_QUOTE_TEMPLATE_SHIPPING_ADDRESS_MUTATION,\n {\n variables: {\n templateId: params.templateId,\n shippingAddress: {\n address: params.shippingAddress.address\n ? {\n city: params.shippingAddress.address.city,\n company: params.shippingAddress.address.company,\n country_code: params.shippingAddress.address.countryCode,\n fax: params.shippingAddress.address.fax,\n firstname: params.shippingAddress.address.firstname,\n lastname: params.shippingAddress.address.lastname,\n middlename: params.shippingAddress.address.middlename,\n postcode: params.shippingAddress.address.postcode,\n prefix: params.shippingAddress.address.prefix,\n region: params.shippingAddress.address.region,\n region_id: params.shippingAddress.address.regionId,\n save_in_address_book:\n params.shippingAddress.address.saveInAddressBook,\n street: params.shippingAddress.address.street,\n suffix: params.shippingAddress.address.suffix,\n telephone: params.shippingAddress.address.telephone,\n vat_id: params.shippingAddress.address.vatId,\n }\n : undefined,\n customer_address_uid: params.shippingAddress.customerAddressUid,\n customer_notes: params.shippingAddress.customerNotes,\n },\n },\n }\n );\n\n if (!results?.data?.setNegotiableQuoteTemplateShippingAddress) {\n throw new Error('No quote template data received');\n }\n\n const transformedData = transformQuoteTemplate(\n results.data.setNegotiableQuoteTemplateShippingAddress\n );\n\n if (!transformedData) {\n throw new Error('Failed to transform quote template data');\n }\n\n events.emit('quote-management/quote-template-data', {\n quoteTemplate: transformedData,\n permissions: state.permissions,\n });\n\n return transformedData;\n } catch (error) {\n return Promise.reject(error);\n }\n};\n"],"names":["mapAuthPermissions","payload","hasAllQuotePermissions","hasAllTemplatePermissions","hasManagePermission","loadQuoteData","permissions","state","config","initialize","quoteId","quoteTemplateId","getQuoteData","quote","events","error","getQuoteTemplateData","Initializer","defaultConfig","getStoreConfig","DEFAULT_CONFIG","authenticated","DEFAULT_PERMISSIONS","data","transformStoreConfig","transformQuoteDisplayAmountSetting","quoteDisplayAmountSetting","QuoteDisplayAmount","STORE_CONFIG_QUERY","fetchGraphQl","errors","errorMessage","e","SET_NEGOTIABLE_QUOTE_SHIPPING_ADDRESS_MUTATION","NEGOTIABLE_QUOTE_FRAGMENT","transformAddressToSnakeCase","address","additionalInput","standardFields","transformedStandardFields","setShippingAddress","input","quoteUid","addressId","addressData","transformedAddressData","response","errorMessages","quoteData","transformQuote","_b","_a","GET_QUOTE_TEMPLATE_DATA","NEGOTIABLE_QUOTE_TEMPLATE_FRAGMENT","templateId","results","transformedData","transformQuoteTemplate","SET_NEGOTIABLE_QUOTE_TEMPLATE_SHIPPING_ADDR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,QAAQ,YAC7C,IAAKA,EAAO,gBAAgB,QAAQ,IACpC,UAAWA,EAAO,gBAAgB,QAAQ,UAC1C,SAAUA,EAAO,gBAAgB,QAAQ,SACzC,WAAYA,EAAO,gBAAgB,QAAQ,WAC3C,SAAUA,EAAO,gBAAgB,QAAQ,SACzC,OAAQA,EAAO,gBAAgB,QAAQ,OACvC,OAAQA,EAAO,gBAAgB,QAAQ,OACvC,UAAWA,EAAO,gBAAgB,QAAQ,SAC1C,qBACEA,EAAO,gBAAgB,QAAQ,kBACjC,OAAQA,EAAO,gBAAgB,QAAQ,OACvC,OAAQA,EAAO,gBAAgB,QAAQ,OACvC,UAAWA,EAAO,gBAAgB,QAAQ,UAC1C,OAAQA,EAAO,gBAAgB,QAAQ,KAAA,EAEzC,OACJ,qBAAsBA,EAAO,gBAAgB,mBAC7C,eAAgBA,EAAO,gBAAgB,aAAA,CACzC,CACF,CACF,EAGF,GAAI,GAACT,EAAAI,GAAA,YAAAA,EAAS,OAAT,MAAAJ,EAAe,2CAClB,MAAM,IAAI,MAAM,iCAAiC,EAGnD,MAAMK,EAAkBC,EACtBF,EAAQ,KAAK,yCAAA,EAGf,GAAI,CAACC,EACH,MAAM,IAAI,MAAM,yCAAyC,EAG3D,OAAA1C,EAAO,KAAK,uCAAwC,CAClD,cAAe0C,EACf,YAAajD,EAAM,WAAA,CACpB,EAEMiD,CACT,OAASzC,EAAO,CACd,OAAO,QAAQ,OAAOA,CAAK,CAC7B,CACF"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
/*! Copyright 2025 Adobe
|
|
2
2
|
All Rights Reserved. */
|
|
3
|
-
import*as s from"@dropins/tools/preact-compat.js";import{jsx as i,jsxs as
|
|
3
|
+
import*as s from"@dropins/tools/preact-compat.js";import{jsx as i,jsxs as o}from"@dropins/tools/preact-jsx-runtime.js";import{Button as u}from"@dropins/tools/components.js";import{S as h,a as g}from"./WarningFilled.js";import{useText as f}from"@dropins/tools/i18n.js";const w=t=>s.createElement("svg",{id:"Icon_Add_Base","data-name":"Icon \\u2013 Add \\u2013 Base",xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",...t},s.createElement("g",{id:"Large"},s.createElement("rect",{id:"Placement_area","data-name":"Placement area",width:24,height:24,fill:"#fff",opacity:0}),s.createElement("g",{id:"Add_icon","data-name":"Add icon",transform:"translate(9.734 9.737)"},s.createElement("line",{vectorEffect:"non-scaling-stroke",id:"Line_579","data-name":"Line 579",y2:12.7,transform:"translate(2.216 -4.087)",fill:"none",stroke:"currentColor"}),s.createElement("line",{vectorEffect:"non-scaling-stroke",id:"Line_580","data-name":"Line 580",x2:12.7,transform:"translate(-4.079 2.263)",fill:"none",stroke:"currentColor"})))),v=t=>s.createElement("svg",{width:24,height:24,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",...t},s.createElement("path",{vectorEffect:"non-scaling-stroke",d:"M18.3599 5.64001L5.62988 18.37",stroke:"currentColor"}),s.createElement("path",{vectorEffect:"non-scaling-stroke",d:"M18.3599 18.37L5.62988 5.64001",stroke:"currentColor"})),_=t=>{if(t===0)return"0 Bytes";const a=1024,l=["Bytes","KB","MB","GB"],r=Math.floor(Math.log(t)/Math.log(a)),e=Math.min(r,l.length-1),n=t/Math.pow(a,e);return`${Math.round(n*100)/100} ${l[e]}`},M=(t,a)=>!a||a.length===0?!0:a.includes(t),S=(t,a)=>a==null?!0:t<=a,B=({files:t,onRemove:a,disabled:l=!1})=>{const r=f({removeFile:"NegotiableQuote.Manage.removeFile",uploading:"NegotiableQuote.Manage.uploading",uploadSuccess:"NegotiableQuote.Manage.uploadSuccess",uploadError:"NegotiableQuote.Manage.uploadError"});return!t||t.length===0?null:i("div",{className:"attached-files-list","data-testid":"attached-files-list",children:t.map(e=>{const n=e.status==="uploading",c=e.status==="error",d=e.status==="success",m=!l&&!n;return o("div",{className:`attached-files-list__item attached-files-list__item--${e.status}`,"data-testid":`attached-file-${e.key}`,children:[o("div",{className:"attached-files-list__item-main",children:[o("div",{className:"attached-files-list__item-icon",children:[n&&i("div",{className:"attached-files-list__spinner","data-testid":"file-uploading-spinner","aria-label":r.uploading}),d&&i(h,{"data-testid":"file-success-icon","aria-label":r.uploadSuccess,className:"attached-files-list__success-icon"}),c&&i(g,{"data-testid":"file-error-icon","aria-label":r.uploadError,color:"var(--color-error)",className:"attached-files-list__error-icon"})]}),o("div",{className:"attached-files-list__item-info",children:[i("div",{className:"attached-files-list__item-name","data-testid":"file-name",children:e.name}),o("div",{className:"attached-files-list__item-size","data-testid":"file-size",children:[_(e.size),n&&` - ${r.uploading}`]})]}),i(u,{variant:"tertiary",onClick:()=>a(e.key),disabled:!m,type:"button","aria-label":`${r.removeFile}: ${e.name}`,"data-testid":`remove-file-${e.key}`,className:"attached-files-list__remove-button",children:i(v,{})})]}),c&&e.error&&i("div",{className:"attached-files-list__item-error","data-testid":"file-error-message",children:e.error})]},e.key)})})};export{B as A,w as S,M as a,_ as f,S as v};
|
|
4
4
|
//# sourceMappingURL=AttachedFilesList.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AttachedFilesList.js","sources":["../../node_modules/@adobe-commerce/elsie/src/icons/Add.svg","../../node_modules/@adobe-commerce/elsie/src/icons/Close.svg","/@dropins/storefront-quote-management/src/utils/fileUtils.ts","/@dropins/storefront-quote-management/src/components/AttachedFilesList/AttachedFilesList.tsx"],"sourcesContent":["import * as React from \"react\";\nconst SvgAdd = (props) => /* @__PURE__ */ React.createElement(\"svg\", { id: \"Icon_Add_Base\", \"data-name\": \"Icon \\\\u2013 Add \\\\u2013 Base\", xmlns: \"http://www.w3.org/2000/svg\", width: 24, height: 24, viewBox: \"0 0 24 24\", ...props }, /* @__PURE__ */ React.createElement(\"g\", { id: \"Large\" }, /* @__PURE__ */ React.createElement(\"rect\", { id: \"Placement_area\", \"data-name\": \"Placement area\", width: 24, height: 24, fill: \"#fff\", opacity: 0 }), /* @__PURE__ */ React.createElement(\"g\", { id: \"Add_icon\", \"data-name\": \"Add icon\", transform: \"translate(9.734 9.737)\" }, /* @__PURE__ */ React.createElement(\"line\", { vectorEffect: \"non-scaling-stroke\", id: \"Line_579\", \"data-name\": \"Line 579\", y2: 12.7, transform: \"translate(2.216 -4.087)\", fill: \"none\", stroke: \"currentColor\" }), /* @__PURE__ */ React.createElement(\"line\", { vectorEffect: \"non-scaling-stroke\", id: \"Line_580\", \"data-name\": \"Line 580\", x2: 12.7, transform: \"translate(-4.079 2.263)\", fill: \"none\", stroke: \"currentColor\" }))));\nexport default SvgAdd;\n","import * as React from \"react\";\nconst SvgClose = (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: \"M18.3599 5.64001L5.62988 18.37\", stroke: \"currentColor\" }), /* @__PURE__ */ React.createElement(\"path\", { vectorEffect: \"non-scaling-stroke\", d: \"M18.3599 18.37L5.62988 5.64001\", stroke: \"currentColor\" }));\nexport default SvgClose;\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\n/**\n * Formats a file size in bytes to a human-readable string\n * @param bytes - The file size in bytes\n * @returns A formatted string with the appropriate unit (Bytes, KB, MB, GB)\n * \n * @example\n * formatFileSize(0) // '0 Bytes'\n * formatFileSize(1024) // '1 KB'\n * formatFileSize(1536) // '1.5 KB'\n * formatFileSize(1048576) // '1 MB'\n * formatFileSize(5242880) // '5 MB'\n */\nexport const formatFileSize = (bytes: number): string => {\n if (bytes === 0) return '0 Bytes';\n \n const k = 1024;\n const sizes = ['Bytes', 'KB', 'MB', 'GB'];\n const i = Math.floor(Math.log(bytes) / Math.log(k));\n \n // Ensure we don't go beyond our sizes array\n const sizeIndex = Math.min(i, sizes.length - 1);\n \n const size = bytes / Math.pow(k, sizeIndex);\n \n // Round to 2 decimal places\n const roundedSize = Math.round(size * 100) / 100;\n \n return `${roundedSize} ${sizes[sizeIndex]}`;\n};\n\n/**\n * Validates if a file type is accepted\n * @param fileType - The MIME type of the file\n * @param acceptedTypes - Array of accepted MIME types (e.g., ['image/png', 'application/pdf'])\n * @returns true if the file type is accepted, false otherwise\n * \n * @example\n * validateFileType('image/png', ['image/png', 'image/jpeg']) // true\n * validateFileType('application/pdf', ['image/png']) // false\n * validateFileType('image/png', []) // true (empty array means all types accepted)\n */\nexport const validateFileType = (\n fileType: string,\n acceptedTypes?: string[]\n): boolean => {\n if (!acceptedTypes || acceptedTypes.length === 0) {\n return true;\n }\n \n return acceptedTypes.includes(fileType);\n};\n\n/**\n * Validates if a file size is within the maximum limit\n * @param fileSize - The file size in bytes\n * @param maxSize - Maximum allowed file size in bytes\n * @returns true if the file size is within the limit, false otherwise\n * \n * @example\n * validateFileSize(1024, 2048) // true\n * validateFileSize(3072, 2048) // false\n * validateFileSize(1024, undefined) // true (no limit)\n */\nexport const validateFileSize = (\n fileSize: number,\n maxSize?: number\n): boolean => {\n if (maxSize === undefined || maxSize === null) {\n return true;\n }\n \n return fileSize <= maxSize;\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 { FunctionComponent } from 'preact';\nimport { useText } from '@adobe-commerce/elsie/i18n';\nimport { Button } from '@adobe-commerce/elsie/components';\nimport { Close, CheckWithCircle, WarningFilled } from '@adobe-commerce/elsie/icons';\nimport { formatFileSize } from '@/quote-management/utils/fileUtils';\nimport './AttachedFilesList.css';\n\nexport interface AttachedFile {\n key: string;\n name: string;\n size: number;\n status: 'uploading' | 'success' | 'error';\n error?: string;\n}\n\nexport interface AttachedFilesListProps {\n files: AttachedFile[];\n onRemove: (key: string) => void;\n disabled?: boolean;\n}\n\nexport const AttachedFilesList: FunctionComponent<AttachedFilesListProps> = ({\n files,\n onRemove,\n disabled = false,\n}) => {\n const dictionary = useText({\n removeFile: 'NegotiableQuote.Manage.removeFile',\n uploading: 'NegotiableQuote.Manage.uploading',\n uploadSuccess: 'NegotiableQuote.Manage.uploadSuccess',\n uploadError: 'NegotiableQuote.Manage.uploadError',\n });\n\n if (!files || files.length === 0) {\n return null;\n }\n\n return (\n <div className=\"attached-files-list\" data-testid=\"attached-files-list\">\n {files.map((file) => {\n const isUploading = file.status === 'uploading';\n const isError = file.status === 'error';\n const isSuccess = file.status === 'success';\n const canRemove = !disabled && !isUploading;\n\n return (\n <div\n key={file.key}\n className={`attached-files-list__item attached-files-list__item--${file.status}`}\n data-testid={`attached-file-${file.key}`}\n >\n <div className=\"attached-files-list__item-main\">\n <div className=\"attached-files-list__item-icon\">\n {isUploading && (\n <div\n className=\"attached-files-list__spinner\"\n data-testid=\"file-uploading-spinner\"\n aria-label={dictionary.uploading}\n />\n )}\n {isSuccess && (\n <CheckWithCircle\n data-testid=\"file-success-icon\"\n aria-label={dictionary.uploadSuccess}\n className=\"attached-files-list__success-icon\"\n />\n )}\n {isError && (\n <WarningFilled\n data-testid=\"file-error-icon\"\n aria-label={dictionary.uploadError}\n color=\"var(--color-error)\"\n className=\"attached-files-list__error-icon\"\n />\n )}\n </div>\n\n <div className=\"attached-files-list__item-info\">\n <div className=\"attached-files-list__item-name\" data-testid=\"file-name\">\n {file.name}\n </div>\n <div className=\"attached-files-list__item-size\" data-testid=\"file-size\">\n {formatFileSize(file.size)}\n {isUploading && ` - ${dictionary.uploading}`}\n </div>\n </div>\n\n <Button\n variant=\"tertiary\"\n size=\"small\"\n onClick={() => onRemove(file.key)}\n disabled={!canRemove}\n aria-label={`${dictionary.removeFile}: ${file.name}`}\n data-testid={`remove-file-${file.key}`}\n className=\"attached-files-list__remove-button\"\n >\n <Close />\n </Button>\n </div>\n\n {isError && file.error && (\n <div\n className=\"attached-files-list__item-error\"\n data-testid=\"file-error-message\"\n >\n {file.error}\n </div>\n )}\n </div>\n );\n })}\n </div>\n );\n};\n\n"],"names":["SvgAdd","props","React","SvgClose","formatFileSize","bytes","k","sizes","i","sizeIndex","size","validateFileType","fileType","acceptedTypes","validateFileSize","fileSize","maxSize","AttachedFilesList","files","onRemove","disabled","dictionary","useText","jsx","file","isUploading","isError","isSuccess","canRemove","jsxs","CheckWithCircle","WarningFilled","Button","Close"],"mappings":"8SACK,MAACA,EAAUC,GAA0BC,EAAM,cAAc,MAAO,CAAE,GAAI,gBAAiB,YAAa,gCAAiC,MAAO,6BAA8B,MAAO,GAAI,OAAQ,GAAI,QAAS,YAAa,GAAGD,CAAK,EAAoBC,EAAM,cAAc,IAAK,CAAE,GAAI,OAAO,EAAoBA,EAAM,cAAc,OAAQ,CAAE,GAAI,iBAAkB,YAAa,iBAAkB,MAAO,GAAI,OAAQ,GAAI,KAAM,OAAQ,QAAS,CAAC,CAAE,EAAmBA,EAAM,cAAc,IAAK,CAAE,GAAI,WAAY,YAAa,WAAY,UAAW,0BAA4CA,EAAM,cAAc,OAAQ,CAAE,aAAc,qBAAsB,GAAI,WAAY,YAAa,WAAY,GAAI,KAAM,UAAW,0BAA2B,KAAM,OAAQ,OAAQ,cAAc,CAAE,EAAmBA,EAAM,cAAc,OAAQ,CAAE,aAAc,qBAAsB,GAAI,WAAY,YAAa,WAAY,GAAI,KAAM,UAAW,0BAA2B,KAAM,OAAQ,OAAQ,cAAc,CAAE,CAAC,CAAC,CAAC,ECAt9BC,EAAYF,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,iCAAkC,OAAQ,cAAc,CAAE,EAAmBA,EAAM,cAAc,OAAQ,CAAE,aAAc,qBAAsB,EAAG,iCAAkC,OA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SAAA,CAAA,EAG1BM,GACCJ,EAACO,EAAA,CACC,cAAY,oBACZ,aAAYT,EAAW,cACvB,UAAU,mCAAA,CAAA,EAGbK,GACCH,EAACQ,EAAA,CACC,cAAY,kBACZ,aAAYV,EAAW,YACvB,MAAM,qBACN,UAAU,iCAAA,CAAA,CACZ,EAEJ,EAEAQ,EAAC,MAAA,CAAI,UAAU,iCACb,SAAA,CAAAN,EAAC,OAAI,UAAU,iCAAiC,cAAY,YACzD,WAAK,KACR,EACAM,EAAC,MAAA,CAAI,UAAU,iCAAiC,cAAY,YACzD,SAAA,CAAAzB,EAAeoB,EAAK,IAAI,EACxBC,GAAe,MAAMJ,EAAW,SAAS,EAAA,CAAA,CAC5C,CAAA,EACF,EAEAE,EAACS,EAAA,CACC,QAAQ,WACR,KAAK,QACL,QAAS,IAAMb,EAASK,EAAK,GAAG,EAChC,SAAU,CAACI,EACX,aAAY,GAAGP,EAAW,UAAU,KAAKG,EAAK,IAAI,GAClD,cAAa,eAAeA,EAAK,GAAG,GACpC,UAAU,qCAEV,WAACS,EAAA,CAAA,CAAM,CAAA,CAAA,CACT,EACF,EAECP,GAAWF,EAAK,OACfD,EAAC,MAAA,CACC,UAAU,kCACV,cAAY,qBAEX,SAAAC,EAAK,KAAA,CAAA,CACR,CAAA,EA3DGA,EAAK,GAAA,CA+DhB,CAAC,CAAA,CACH,CAEJ","x_google_ignoreList":[0,1]}
|
|
1
|
+
{"version":3,"file":"AttachedFilesList.js","sources":["../../node_modules/@adobe-commerce/elsie/src/icons/Add.svg","../../node_modules/@adobe-commerce/elsie/src/icons/Close.svg","/@dropins/storefront-quote-management/src/utils/fileUtils.ts","/@dropins/storefront-quote-management/src/components/AttachedFilesList/AttachedFilesList.tsx"],"sourcesContent":["import * as React from \"react\";\nconst SvgAdd = (props) => /* @__PURE__ */ React.createElement(\"svg\", { id: \"Icon_Add_Base\", \"data-name\": \"Icon \\\\u2013 Add \\\\u2013 Base\", xmlns: \"http://www.w3.org/2000/svg\", width: 24, height: 24, viewBox: \"0 0 24 24\", ...props }, /* @__PURE__ */ React.createElement(\"g\", { id: \"Large\" }, /* @__PURE__ */ React.createElement(\"rect\", { id: \"Placement_area\", \"data-name\": \"Placement area\", width: 24, height: 24, fill: \"#fff\", opacity: 0 }), /* @__PURE__ */ React.createElement(\"g\", { id: \"Add_icon\", \"data-name\": \"Add icon\", transform: \"translate(9.734 9.737)\" }, /* @__PURE__ */ React.createElement(\"line\", { vectorEffect: \"non-scaling-stroke\", id: \"Line_579\", \"data-name\": \"Line 579\", y2: 12.7, transform: \"translate(2.216 -4.087)\", fill: \"none\", stroke: \"currentColor\" }), /* @__PURE__ */ React.createElement(\"line\", { vectorEffect: \"non-scaling-stroke\", id: \"Line_580\", \"data-name\": \"Line 580\", x2: 12.7, transform: \"translate(-4.079 2.263)\", fill: \"none\", stroke: \"currentColor\" }))));\nexport default SvgAdd;\n","import * as React from \"react\";\nconst SvgClose = (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: \"M18.3599 5.64001L5.62988 18.37\", stroke: \"currentColor\" }), /* @__PURE__ */ React.createElement(\"path\", { vectorEffect: \"non-scaling-stroke\", d: \"M18.3599 18.37L5.62988 5.64001\", stroke: \"currentColor\" }));\nexport default SvgClose;\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\n/**\n * Formats a file size in bytes to a human-readable string\n * @param bytes - The file size in bytes\n * @returns A formatted string with the appropriate unit (Bytes, KB, MB, GB)\n * \n * @example\n * formatFileSize(0) // '0 Bytes'\n * formatFileSize(1024) // '1 KB'\n * formatFileSize(1536) // '1.5 KB'\n * formatFileSize(1048576) // '1 MB'\n * formatFileSize(5242880) // '5 MB'\n */\nexport const formatFileSize = (bytes: number): string => {\n if (bytes === 0) return '0 Bytes';\n \n const k = 1024;\n const sizes = ['Bytes', 'KB', 'MB', 'GB'];\n const i = Math.floor(Math.log(bytes) / Math.log(k));\n \n // Ensure we don't go beyond our sizes array\n const sizeIndex = Math.min(i, sizes.length - 1);\n \n const size = bytes / Math.pow(k, sizeIndex);\n \n // Round to 2 decimal places\n const roundedSize = Math.round(size * 100) / 100;\n \n return `${roundedSize} ${sizes[sizeIndex]}`;\n};\n\n/**\n * Validates if a file type is accepted\n * @param fileType - The MIME type of the file\n * @param acceptedTypes - Array of accepted MIME types (e.g., ['image/png', 'application/pdf'])\n * @returns true if the file type is accepted, false otherwise\n * \n * @example\n * validateFileType('image/png', ['image/png', 'image/jpeg']) // true\n * validateFileType('application/pdf', ['image/png']) // false\n * validateFileType('image/png', []) // true (empty array means all types accepted)\n */\nexport const validateFileType = (\n fileType: string,\n acceptedTypes?: string[]\n): boolean => {\n if (!acceptedTypes || acceptedTypes.length === 0) {\n return true;\n }\n \n return acceptedTypes.includes(fileType);\n};\n\n/**\n * Validates if a file size is within the maximum limit\n * @param fileSize - The file size in bytes\n * @param maxSize - Maximum allowed file size in bytes\n * @returns true if the file size is within the limit, false otherwise\n * \n * @example\n * validateFileSize(1024, 2048) // true\n * validateFileSize(3072, 2048) // false\n * validateFileSize(1024, undefined) // true (no limit)\n */\nexport const validateFileSize = (\n fileSize: number,\n maxSize?: number\n): boolean => {\n if (maxSize === undefined || maxSize === null) {\n return true;\n }\n \n return fileSize <= maxSize;\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 { FunctionComponent } from 'preact';\nimport { useText } from '@adobe-commerce/elsie/i18n';\nimport { Button } from '@adobe-commerce/elsie/components';\nimport { Close, CheckWithCircle, WarningFilled } from '@adobe-commerce/elsie/icons';\nimport { formatFileSize } from '@/quote-management/utils/fileUtils';\nimport './AttachedFilesList.css';\n\nexport interface AttachedFile {\n key: string;\n name: string;\n size: number;\n status: 'uploading' | 'success' | 'error';\n error?: string;\n}\n\nexport interface AttachedFilesListProps {\n files: AttachedFile[];\n onRemove: (key: string) => void;\n disabled?: boolean;\n}\n\nexport const AttachedFilesList: FunctionComponent<AttachedFilesListProps> = ({\n files,\n onRemove,\n disabled = false,\n}) => {\n const dictionary = useText({\n removeFile: 'NegotiableQuote.Manage.removeFile',\n uploading: 'NegotiableQuote.Manage.uploading',\n uploadSuccess: 'NegotiableQuote.Manage.uploadSuccess',\n uploadError: 'NegotiableQuote.Manage.uploadError',\n });\n\n if (!files || files.length === 0) {\n return null;\n }\n\n return (\n <div className=\"attached-files-list\" data-testid=\"attached-files-list\">\n {files.map((file) => {\n const isUploading = file.status === 'uploading';\n const isError = file.status === 'error';\n const isSuccess = file.status === 'success';\n const canRemove = !disabled && !isUploading;\n\n return (\n <div\n key={file.key}\n className={`attached-files-list__item attached-files-list__item--${file.status}`}\n data-testid={`attached-file-${file.key}`}\n >\n <div className=\"attached-files-list__item-main\">\n <div className=\"attached-files-list__item-icon\">\n {isUploading && (\n <div\n className=\"attached-files-list__spinner\"\n data-testid=\"file-uploading-spinner\"\n aria-label={dictionary.uploading}\n />\n )}\n {isSuccess && (\n <CheckWithCircle\n data-testid=\"file-success-icon\"\n aria-label={dictionary.uploadSuccess}\n className=\"attached-files-list__success-icon\"\n />\n )}\n {isError && (\n <WarningFilled\n data-testid=\"file-error-icon\"\n aria-label={dictionary.uploadError}\n color=\"var(--color-error)\"\n className=\"attached-files-list__error-icon\"\n />\n )}\n </div>\n\n <div className=\"attached-files-list__item-info\">\n <div className=\"attached-files-list__item-name\" data-testid=\"file-name\">\n {file.name}\n </div>\n <div className=\"attached-files-list__item-size\" data-testid=\"file-size\">\n {formatFileSize(file.size)}\n {isUploading && ` - ${dictionary.uploading}`}\n </div>\n </div>\n\n <Button\n variant=\"tertiary\"\n onClick={() => onRemove(file.key)}\n disabled={!canRemove}\n type=\"button\"\n aria-label={`${dictionary.removeFile}: ${file.name}`}\n data-testid={`remove-file-${file.key}`}\n className=\"attached-files-list__remove-button\"\n >\n <Close />\n </Button>\n </div>\n\n {isError && file.error && (\n <div\n className=\"attached-files-list__item-error\"\n data-testid=\"file-error-message\"\n >\n {file.error}\n </div>\n )}\n </div>\n );\n })}\n </div>\n );\n};\n\n"],"names":["SvgAdd","props","React","SvgClose","formatFileSize","bytes","k","sizes","i","sizeIndex","size","validateFileType","fileType","acceptedTypes","validateFileSize","fileSize","maxSize","AttachedFilesList","files","onRemove","disabled","dictionary","useText","jsx","file","isUploading","isError","isSuccess","canRemove","jsxs","CheckWithCircle","WarningFilled","Button","Close"],"mappings":"4QACK,MAACA,EAAUC,GAA0BC,EAAM,cAAc,MAAO,CAAE,GAAI,gBAAiB,YAAa,gCAAiC,MAAO,6BAA8B,MAAO,GAAI,OAAQ,GAAI,QAAS,YAAa,GAAGD,CAAK,EAAoBC,EAAM,cAAc,IAAK,CAAE,GAAI,OAAO,EAAoBA,EAAM,cAAc,OAAQ,CAAE,GAAI,iBAAkB,YAAa,iBAAkB,MAAO,GAAI,OAAQ,GAAI,KAAM,OAAQ,QAAS,CAAC,CAAE,EAAmBA,EAAM,cAAc,IAAK,CAAE,GAAI,WAAY,YAAa,WAAY,UAAW,0BAA4CA,EAAM,cAAc,OAAQ,CAAE,aAAc,qBAAsB,GAAI,WAAY,YAAa,WAAY,GAAI,KAAM,UAAW,0BAA2B,KAAM,OAAQ,OAAQ,cAAc,CAAE,EAAmBA,EAAM,cAAc,OAAQ,CAAE,aAAc,qBAAsB,GAAI,WAAY,YAAa,WAAY,GAAI,KAAM,UAAW,0BAA2B,KAAM,OAAQ,OAAQ,cAAc,CAAE,CAAC,CAAC,CAAC,ECAt9BC,EAAYF,GAA0BC,EAAM,cAAc,MAAO,CAAE,MAAO,GAAI,OAAQ,GA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C9E,cAAa,iBAAiBA,EAAK,GAAG,GAEtC,SAAA,CAAAK,EAAC,MAAA,CAAI,UAAU,iCACb,SAAA,CAAAA,EAAC,MAAA,CAAI,UAAU,iCACZ,SAAA,CAAAJ,GACCF,EAAC,MAAA,CACC,UAAU,+BACV,cAAY,yBACZ,aAAYF,EAAW,SAAA,CAAA,EAG1BM,GACCJ,EAACO,EAAA,CACC,cAAY,oBACZ,aAAYT,EAAW,cACvB,UAAU,mCAAA,CAAA,EAGbK,GACCH,EAACQ,EAAA,CACC,cAAY,kBACZ,aAAYV,EAAW,YACvB,MAAM,qBACN,UAAU,iCAAA,CAAA,CACZ,EAEJ,EAEAQ,EAAC,MAAA,CAAI,UAAU,iCACb,SAAA,CAAAN,EAAC,OAAI,UAAU,iCAAiC,cAAY,YACzD,WAAK,KACR,EACAM,EAAC,MAAA,CAAI,UAAU,iCAAiC,cAAY,YACzD,SAAA,CAAAzB,EAAeoB,EAAK,IAAI,EACxBC,GAAe,MAAMJ,EAAW,SAAS,EAAA,CAAA,CAC5C,CAAA,EACF,EAEAE,EAACS,EAAA,CACC,QAAQ,WACR,QAAS,IAAMb,EAASK,EAAK,GAAG,EAChC,SAAU,CAACI,EACX,KAAK,SACL,aAAY,GAAGP,EAAW,UAAU,KAAKG,EAAK,IAAI,GAClD,cAAa,eAAeA,EAAK,GAAG,GACpC,UAAU,qCAEV,WAACS,EAAA,CAAA,CAAM,CAAA,CAAA,CACT,EACF,EAECP,GAAWF,EAAK,OACfD,EAAC,MAAA,CACC,UAAU,kCACV,cAAY,qBAEX,SAAAC,EAAK,KAAA,CAAA,CACR,CAAA,EA3DGA,EAAK,GAAA,CA+DhB,CAAC,CAAA,CACH,CAEJ","x_google_ignoreList":[0,1]}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
/*! Copyright 2025 Adobe
|
|
2
2
|
All Rights Reserved. */
|
|
3
|
-
import{jsx as i,jsxs as r}from"@dropins/tools/preact-jsx-runtime.js";import{Modal as v,Button as c}from"@dropins/tools/components.js";/* empty css
|
|
3
|
+
import{jsx as i,jsxs as r}from"@dropins/tools/preact-jsx-runtime.js";import{Modal as v,Button as c}from"@dropins/tools/components.js";/* empty css */import{useText as N}from"@dropins/tools/i18n.js";const y=({open:d=!1,title:o,message:n,cancelLabel:s,confirmLabel:e,onCancel:a,onConfirm:l,onClose:f,showCloseButton:_,confirmationBanner:t,...h})=>{const m=N({cancel:"ConfirmationModal.cancel",confirm:"ConfirmationModal.confirm"});if(!d)return null;const{className:p,...u}=h;return i(v,{...u,size:"medium",onClose:f||a,clickToDismiss:!0,escapeToDismiss:!0,showCloseButton:_,"data-testid":"confirmation-modal",className:p,children:r("div",{className:"confirmation-modal__content",children:[t&&i("div",{className:"confirmation-modal__banner","data-testid":"confirmation-modal-banner",children:t}),o&&i("div",{className:"confirmation-modal__title","data-testid":"confirmation-modal-title",children:o}),n&&i("div",{className:"confirmation-modal__message","data-testid":"confirmation-modal-message",children:n}),r("div",{className:"confirmation-modal__actions","data-testid":"confirmation-modal-actions",children:[a&&i(c,{variant:"secondary",onClick:a,"data-testid":"confirmation-modal-cancel",children:s??m.cancel}),i(c,{variant:"primary",onClick:l,"data-testid":"confirmation-modal-confirm",children:e??m.confirm})]})]})})};export{y as C};
|
|
4
4
|
//# sourceMappingURL=ConfirmationModal.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ConfirmationModal.js","sources":["/@dropins/storefront-quote-management/src/components/ConfirmationModal/ConfirmationModal.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 { FunctionComponent, VNode } from 'preact';\nimport { HTMLAttributes } from 'preact/compat';\nimport { Button, Modal } from '@adobe-commerce/elsie/components';\nimport { useText } from '@adobe-commerce/elsie/i18n';\nimport '@/quote-management/components/ConfirmationModal/ConfirmationModal.css';\n\nexport interface ConfirmationModalProps\n extends Omit<HTMLAttributes<HTMLDivElement>, 'title'> {\n open?: boolean;\n title?: VNode | string;\n message?: VNode | string;\n cancelLabel?: VNode | string;\n confirmLabel?: VNode | string;\n onCancel?: () => void;\n onConfirm?: () => void;\n onClose?: () => void;\n showCloseButton?: boolean;\n confirmationBanner?: VNode | null;\n}\n\nexport const ConfirmationModal: FunctionComponent<ConfirmationModalProps> = ({\n open = false,\n title,\n message,\n cancelLabel,\n confirmLabel,\n onCancel,\n onConfirm,\n onClose,\n showCloseButton,\n confirmationBanner,\n ...props\n}) => {\n const dictionary = useText({\n cancel: 'ConfirmationModal.cancel',\n confirm: 'ConfirmationModal.confirm',\n });\n\n if (!open) {\n return null;\n }\n\n const { className, ...restProps } = props;\n\n return (\n <Modal\n {...restProps}\n size={'medium'}\n onClose={onClose || onCancel}\n clickToDismiss={true}\n escapeToDismiss={true}\n showCloseButton={showCloseButton}\n data-testid=\"confirmation-modal\"\n className={className}\n >\n <div className=\"confirmation-modal__content\">\n {confirmationBanner && (\n <div\n className=\"confirmation-modal__banner\"\n data-testid=\"confirmation-modal-banner\"\n >\n {confirmationBanner}\n </div>\n )}\n {title && (\n <div\n className=\"confirmation-modal__title\"\n data-testid=\"confirmation-modal-title\"\n >\n {title}\n </div>\n )}\n {message && (\n <div\n className=\"confirmation-modal__message\"\n data-testid=\"confirmation-modal-message\"\n >\n {message}\n </div>\n )}\n <div\n className=\"confirmation-modal__actions\"\n data-testid=\"confirmation-modal-actions\"\n >\n {onCancel && (\n <Button\n variant=\"secondary\"\n onClick={onCancel}\n data-testid=\"confirmation-modal-cancel\"\n >\n {cancelLabel ?? dictionary.cancel}\n </Button>\n )}\n <Button\n variant=\"primary\"\n onClick={onConfirm}\n data-testid=\"confirmation-modal-confirm\"\n >\n {confirmLabel ?? dictionary.confirm}\n </Button>\n </div>\n </div>\n </Modal>\n );\n};\n"],"names":["ConfirmationModal","open","title","message","cancelLabel","confirmLabel","onCancel","onConfirm","onClose","showCloseButton","confirmationBanner","props","dictionary","useText","className","restProps","jsx","Modal","jsxs","Button"],"mappings":"
|
|
1
|
+
{"version":3,"file":"ConfirmationModal.js","sources":["/@dropins/storefront-quote-management/src/components/ConfirmationModal/ConfirmationModal.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 { FunctionComponent, VNode } from 'preact';\nimport { HTMLAttributes } from 'preact/compat';\nimport { Button, Modal } from '@adobe-commerce/elsie/components';\nimport { useText } from '@adobe-commerce/elsie/i18n';\nimport '@/quote-management/components/ConfirmationModal/ConfirmationModal.css';\n\nexport interface ConfirmationModalProps\n extends Omit<HTMLAttributes<HTMLDivElement>, 'title'> {\n open?: boolean;\n title?: VNode | string;\n message?: VNode | string;\n cancelLabel?: VNode | string;\n confirmLabel?: VNode | string;\n onCancel?: () => void;\n onConfirm?: () => void;\n onClose?: () => void;\n showCloseButton?: boolean;\n confirmationBanner?: VNode | null;\n}\n\nexport const ConfirmationModal: FunctionComponent<ConfirmationModalProps> = ({\n open = false,\n title,\n message,\n cancelLabel,\n confirmLabel,\n onCancel,\n onConfirm,\n onClose,\n showCloseButton,\n confirmationBanner,\n ...props\n}) => {\n const dictionary = useText({\n cancel: 'ConfirmationModal.cancel',\n confirm: 'ConfirmationModal.confirm',\n });\n\n if (!open) {\n return null;\n }\n\n const { className, ...restProps } = props;\n\n return (\n <Modal\n {...restProps}\n size={'medium'}\n onClose={onClose || onCancel}\n clickToDismiss={true}\n escapeToDismiss={true}\n showCloseButton={showCloseButton}\n data-testid=\"confirmation-modal\"\n className={className}\n >\n <div className=\"confirmation-modal__content\">\n {confirmationBanner && (\n <div\n className=\"confirmation-modal__banner\"\n data-testid=\"confirmation-modal-banner\"\n >\n {confirmationBanner}\n </div>\n )}\n {title && (\n <div\n className=\"confirmation-modal__title\"\n data-testid=\"confirmation-modal-title\"\n >\n {title}\n </div>\n )}\n {message && (\n <div\n className=\"confirmation-modal__message\"\n data-testid=\"confirmation-modal-message\"\n >\n {message}\n </div>\n )}\n <div\n className=\"confirmation-modal__actions\"\n data-testid=\"confirmation-modal-actions\"\n >\n {onCancel && (\n <Button\n variant=\"secondary\"\n onClick={onCancel}\n data-testid=\"confirmation-modal-cancel\"\n >\n {cancelLabel ?? dictionary.cancel}\n </Button>\n )}\n <Button\n variant=\"primary\"\n onClick={onConfirm}\n data-testid=\"confirmation-modal-confirm\"\n >\n {confirmLabel ?? dictionary.confirm}\n </Button>\n </div>\n </div>\n </Modal>\n );\n};\n"],"names":["ConfirmationModal","open","title","message","cancelLabel","confirmLabel","onCancel","onConfirm","onClose","showCloseButton","confirmationBanner","props","dictionary","useText","className","restProps","jsx","Modal","jsxs","Button"],"mappings":"2NA6BO,MAAMA,EAA+D,CAAC,CAC3E,KAAAC,EAAO,GACP,MAAAC,EACA,QAAAC,EACA,YAAAC,EACA,aAAAC,EACA,SAAAC,EACA,UAAAC,EACA,QAAAC,EACA,gBAAAC,EACA,mBAAAC,EACA,GAAGC,CACL,IAAM,CACJ,MAAMC,EAAaC,EAAQ,CACzB,OAAQ,2BACR,QAAS,2BAAA,CACV,EAED,GAAI,CAACZ,EACH,OAAO,KAGT,KAAM,CAAE,UAAAa,EAAW,GAAGC,CAAA,EAAcJ,EAEpC,OACEK,EAACC,EAAA,CACE,GAAGF,EACJ,KAAM,SACN,QAASP,GAAWF,EACpB,eAAgB,GAChB,gBAAiB,GACjB,gBAAAG,EACA,cAAY,qBACZ,UAAAK,EAEA,SAAAI,EAAC,MAAA,CAAI,UAAU,8BACZ,SAAA,CAAAR,GACCM,EAAC,MAAA,CACC,UAAU,6BACV,cAAY,4BAEX,SAAAN,CAAA,CAAA,EAGJR,GACCc,EAAC,MAAA,CACC,UAAU,4BACV,cAAY,2BAEX,SAAAd,CAAA,CAAA,EAGJC,GACCa,EAAC,MAAA,CACC,UAAU,8BACV,cAAY,6BAEX,SAAAb,CAAA,CAAA,EAGLe,EAAC,MAAA,CACC,UAAU,8BACV,cAAY,6BAEX,SAAA,CAAAZ,GACCU,EAACG,EAAA,CACC,QAAQ,YACR,QAASb,EACT,cAAY,4BAEX,YAAeM,EAAW,MAAA,CAAA,EAG/BI,EAACG,EAAA,CACC,QAAQ,UACR,QAASZ,EACT,cAAY,6BAEX,YAAgBK,EAAW,OAAA,CAAA,CAC9B,CAAA,CAAA,CACF,CAAA,CACF,CAAA,CAAA,CAGN"}
|