@dropins/storefront-quote-management 1.0.0-beta2 → 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/sendForReview/index.d.ts +1 -1
- package/chunks/AttachedFilesList.js +1 -1
- package/chunks/AttachedFilesList.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/duplicateNegotiableQuote.js +5 -5
- package/chunks/duplicateNegotiableQuote.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 -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 +19 -2
- package/containers/ManageNegotiableQuoteTemplate.js +3 -1
- package/containers/ManageNegotiableQuoteTemplate.js.map +1 -1
- package/containers/QuoteSummaryList.js +1 -1
- package/containers/QuoteSummaryList.js.map +1 -1
- package/containers/ShippingAddressDisplay/ShippingAddressDisplay.d.ts +2 -2
- package/data/transforms/__fixtures__/negotiableQuoteData.d.ts +5 -0
- package/hooks/useReferenceDocumentLinks.d.ts +2 -2
- package/hooks/useRenameTemplate.d.ts +71 -0
- package/i18n/en_US.json.d.ts +25 -2
- package/package.json +1 -1
- package/render.js +2 -2
- package/render.js.map +1 -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
|
|
9
|
+
export * from './sendForReview';
|
|
10
10
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -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":"4QACK,MAACA,EAAUC,GAA0BC,EAAM,cAAc,MAAO,CAAE,GAAI,gBAAiB,YAAa,gCAAiC,MAAO,6BAA8B,MAAO,GAAI,OAAQ,GAAI,QAAS,YAAa,GAAGD,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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","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b,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]}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
/*! Copyright 2025 Adobe
|
|
2
|
+
All Rights Reserved. */
|
|
3
|
+
import*as v from"@dropins/tools/preact-compat.js";import{useState as p,useMemo as f}from"@dropins/tools/preact-compat.js";import{jsx as e,jsxs as d,Fragment as k}from"@dropins/tools/preact-jsx-runtime.js";import{classes as a,VComponent as N}from"@dropins/tools/lib.js";/* empty css */import{Picker as x,Modal as L,Input as T,TextArea as M,Button as _}from"@dropins/tools/components.js";import{useText as y}from"@dropins/tools/i18n.js";const S=i=>v.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:1,strokeLinecap:"round",strokeLinejoin:"round",className:"feather feather-edit-2",...i},v.createElement("path",{d:"M17 3a2.828 2.828 0 1 1 4 4L7.5 20.5 2 22l1.5-5.5L17 3z"})),j=({className:i,dropdownPlaceholder:m,dropdownOptions:n,dropdownValue:c,handleDropdownChange:s,buttons:t,...l})=>{const b=n&&n.length>0,u=t&&t.length>0,o=(n==null?void 0:n.map(r=>({text:r.label,value:r.value})))||[];return o.unshift({text:m||"",value:""}),e("div",{className:"quote-management-actions-bar__container","data-testid":"actions-bar-container",children:d("div",{className:a(["quote-management-actions-bar",i]),"data-testid":"actions-bar",...l,children:[b&&e(x,{name:"dropdown",id:"dropdown",handleSelect:s,className:"quote-management-actions-bar__dropdown","data-testid":"dropdown",options:o,value:c||""},`actions-bar-picker-${c||"empty"}`),u&&e("div",{className:"quote-management-actions-bar__buttons","data-testid":"buttons-container",children:t==null?void 0:t.map((r,q)=>e(N,{node:r,className:a(["quote-management-actions-bar__button"])},q))})]})})},D=({className:i,tabs:m,tabsContent:n,defaultActiveTab:c,...s})=>{const[t,l]=p(c||Array.from(m.keys())[0]),b=o=>{l(o)},u=f(()=>n.get(t),[t,n]);return d("div",{...s,className:a(["quote-management-tabbed-content",i]),children:[m&&e("div",{"data-testid":"tabbed-content-tabs",className:a(["quote-management-tabbed-content__tabs"]),children:Array.from(m.entries()).map(([o,r])=>e("button",{className:a(["quote-management-tabbed-content__tab",["quote-management-tabbed-content__tab--active",o===t]]),onClick:()=>b(o),children:r},o))}),u&&e("div",{className:a(["quote-management-tabbed-content__active-tab-content"]),children:e(N,{node:u})})]})},I=({className:i,open:m,quoteName:n,renameReason:c,quoteNameError:s,errorBanner:t,successBanner:l,showCloseButton:b=!0,onQuoteNameChange:u,onRenameReasonChange:o,onSave:r,onClose:q})=>{const g=y({title:"NegotiableQuote.Manage.rename.title",quoteNameLabel:"NegotiableQuote.Manage.rename.quoteNameLabel",reasonLabel:"NegotiableQuote.Manage.rename.reasonLabel",renameButton:"NegotiableQuote.Manage.rename.renameButton",cancelButton:"NegotiableQuote.Manage.rename.cancelButton"});return m?d(L,{open:m,size:"medium",title:e(k,{children:g.title}),onClose:q,clickToDismiss:!0,escapeToDismiss:!0,showCloseButton:b,className:a(["quote-management-rename-quote-modal",i]),"data-testid":"rename-quote-modal",children:[t&&e("div",{className:a(["quote-management-rename-quote-modal__error-banner"]),"data-testid":"rename-quote-modal-error-banner",children:t}),l&&e("div",{className:a(["quote-management-rename-quote-modal__success-banner"]),"data-testid":"rename-quote-modal-success-banner",children:l}),d("div",{className:a(["quote-management-rename-quote-modal__content"]),children:[d("div",{children:[e(T,{name:"quoteName",type:"text",value:n,onInput:h=>u(h.target.value),floatingLabel:g.quoteNameLabel,required:!0,error:!!s}),s&&e("span",{className:a(["quote-management-rename-quote-modal__error-text"]),children:s})]}),e(M,{name:"quoteComment",value:c,onInput:h=>o(h.target.value),label:g.reasonLabel,rows:3})]}),d("div",{className:a(["quote-management-rename-quote-modal__actions"]),children:[e(_,{variant:"secondary",size:"medium",onClick:q,className:a(["quote-management-rename-quote-modal__cancel-button"]),children:g.cancelButton}),e(_,{variant:"primary",size:"medium",onClick:r,className:a(["quote-management-rename-quote-modal__save-button"]),children:g.renameButton})]})]}):null};export{j as A,I as R,S,D as T};
|
|
4
|
+
//# sourceMappingURL=RenameQuoteModal.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"RenameQuoteModal.js","sources":["../../node_modules/@adobe-commerce/elsie/src/icons/Edit.svg","/@dropins/storefront-quote-management/src/components/ActionsBar/ActionsBar.tsx","/@dropins/storefront-quote-management/src/components/TabbedContent/TabbedContent.tsx","/@dropins/storefront-quote-management/src/components/RenameQuoteModal/RenameQuoteModal.tsx"],"sourcesContent":["import * as React from \"react\";\nconst SvgEdit = (props) => /* @__PURE__ */ React.createElement(\"svg\", { xmlns: \"http://www.w3.org/2000/svg\", width: 24, height: 24, viewBox: \"0 0 24 24\", fill: \"none\", stroke: \"currentColor\", strokeWidth: 1, strokeLinecap: \"round\", strokeLinejoin: \"round\", className: \"feather feather-edit-2\", ...props }, /* @__PURE__ */ React.createElement(\"path\", { d: \"M17 3a2.828 2.828 0 1 1 4 4L7.5 20.5 2 22l1.5-5.5L17 3z\" }));\nexport default SvgEdit;\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, VNode } from 'preact';\nimport { HTMLAttributes } from 'preact/compat';\nimport { classes, VComponent } from '@adobe-commerce/elsie/lib';\nimport '@/quote-management/components/ActionsBar/ActionsBar.css';\nimport { Picker } from '@adobe-commerce/elsie/components';\n\nexport interface ActionsBarProps extends HTMLAttributes<HTMLDivElement> {\n dropdownPlaceholder?: string;\n dropdownOptions?: {\n label: string;\n value: string;\n }[];\n dropdownValue?: string;\n handleDropdownChange?: (event: Event) => void;\n buttons?: VNode[];\n}\n\nexport const ActionsBar: FunctionComponent<ActionsBarProps> = ({\n className,\n dropdownPlaceholder,\n dropdownOptions,\n dropdownValue,\n handleDropdownChange,\n buttons,\n ...props\n}) => {\n const hasDropdown = dropdownOptions && dropdownOptions.length > 0;\n const hasButtons = buttons && buttons.length > 0;\n\n const pickerOptions =\n dropdownOptions?.map((option) => ({\n text: option.label,\n value: option.value,\n })) || [];\n pickerOptions.unshift({\n text: dropdownPlaceholder || '',\n value: '',\n });\n\n return (\n <div\n className=\"quote-management-actions-bar__container\"\n data-testid=\"actions-bar-container\"\n >\n <div\n className={classes(['quote-management-actions-bar', className])}\n data-testid=\"actions-bar\"\n {...props}\n >\n {hasDropdown && (\n <Picker\n key={`actions-bar-picker-${dropdownValue || 'empty'}`}\n name=\"dropdown\"\n id=\"dropdown\"\n handleSelect={handleDropdownChange}\n className=\"quote-management-actions-bar__dropdown\"\n data-testid=\"dropdown\"\n options={pickerOptions}\n value={dropdownValue || ''}\n />\n )}\n {hasButtons && (\n <div\n className=\"quote-management-actions-bar__buttons\"\n data-testid=\"buttons-container\"\n >\n {buttons?.map((button, index) => (\n <VComponent\n node={button}\n className={classes(['quote-management-actions-bar__button'])}\n key={index}\n />\n ))}\n </div>\n )}\n </div>\n </div>\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, VNode } from 'preact';\nimport { HTMLAttributes, useMemo, useState } from 'preact/compat';\nimport { classes, VComponent } from '@adobe-commerce/elsie/lib';\nimport '@/quote-management/components/TabbedContent/TabbedContent.css';\n\nexport interface TabbedContentProps extends HTMLAttributes<HTMLDivElement> {\n tabs: Map<string, string>;\n tabsContent: Map<string, VNode>;\n defaultActiveTab?: string;\n}\n\nexport const TabbedContent: FunctionComponent<TabbedContentProps> = ({\n className,\n tabs,\n tabsContent,\n defaultActiveTab,\n ...props\n}) => {\n const [activeTabId, setActiveTabId] = useState<string>(\n defaultActiveTab || Array.from(tabs.keys())[0]\n );\n\n const handleTabClick = (tabId: string) => {\n setActiveTabId(tabId);\n };\n\n const activeTabContent = useMemo(() => {\n return tabsContent.get(activeTabId);\n }, [activeTabId, tabsContent]);\n\n return (\n <div {...props} className={classes(['quote-management-tabbed-content', className])}>\n {tabs &&\n <div data-testid=\"tabbed-content-tabs\" className={classes(['quote-management-tabbed-content__tabs'])}>\n {Array.from(tabs.entries()).map(([tabId, tabLabel]) => (\n <button\n className={\n classes([\n 'quote-management-tabbed-content__tab',\n ['quote-management-tabbed-content__tab--active', tabId === activeTabId]\n ])}\n key={tabId}\n onClick={() => handleTabClick(tabId)}\n >\n {tabLabel}\n </button>\n ))}\n </div>\n }\n {\n activeTabContent &&\n <div className={classes(['quote-management-tabbed-content__active-tab-content'])}>\n <VComponent\n node={activeTabContent as VNode}\n />\n </div>\n }\n </div>\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, VNode } from 'preact';\nimport { HTMLAttributes } from 'preact/compat';\nimport { classes } from '@adobe-commerce/elsie/lib';\nimport { useText } from '@adobe-commerce/elsie/i18n';\nimport { Button, Input, TextArea, Modal } from '@adobe-commerce/elsie/components';\nimport '@/quote-management/components/RenameQuoteModal/RenameQuoteModal.css';\n\nexport interface RenameQuoteModalProps\n extends Omit<HTMLAttributes<HTMLDivElement>, 'title'> {\n open: boolean;\n quoteName: string;\n renameReason: string;\n quoteNameError?: string;\n errorBanner?: VNode;\n successBanner?: VNode;\n showCloseButton?: boolean;\n onQuoteNameChange: (value: string) => void;\n onRenameReasonChange: (value: string) => void;\n onSave: () => void;\n onClose?: () => void;\n}\n\nexport const RenameQuoteModal: FunctionComponent<RenameQuoteModalProps> = ({\n className,\n open,\n quoteName,\n renameReason,\n quoteNameError,\n errorBanner,\n successBanner,\n showCloseButton = true,\n onQuoteNameChange,\n onRenameReasonChange,\n onSave,\n onClose,\n}) => {\n const dictionary = useText({\n title: 'NegotiableQuote.Manage.rename.title',\n quoteNameLabel: 'NegotiableQuote.Manage.rename.quoteNameLabel',\n reasonLabel: 'NegotiableQuote.Manage.rename.reasonLabel',\n renameButton: 'NegotiableQuote.Manage.rename.renameButton',\n cancelButton: 'NegotiableQuote.Manage.rename.cancelButton',\n });\n\n if (!open) {\n return null;\n }\n\n return (\n <Modal\n open={open}\n size=\"medium\"\n title={<>{dictionary.title}</>}\n onClose={onClose}\n clickToDismiss={true}\n escapeToDismiss={true}\n showCloseButton={showCloseButton}\n className={classes(['quote-management-rename-quote-modal', className])}\n data-testid=\"rename-quote-modal\"\n >\n {errorBanner && (\n <div className={classes(['quote-management-rename-quote-modal__error-banner'])} data-testid=\"rename-quote-modal-error-banner\">\n {errorBanner}\n </div>\n )}\n\n {successBanner && (\n <div className={classes(['quote-management-rename-quote-modal__success-banner'])} data-testid=\"rename-quote-modal-success-banner\">\n {successBanner}\n </div>\n )}\n\n <div className={classes(['quote-management-rename-quote-modal__content'])}>\n <div>\n <Input\n name=\"quoteName\"\n type=\"text\"\n value={quoteName}\n onInput={(e: any) => onQuoteNameChange(e.target.value)}\n floatingLabel={dictionary.quoteNameLabel}\n required\n error={!!quoteNameError}\n />\n {quoteNameError && (\n <span className={classes(['quote-management-rename-quote-modal__error-text'])}>\n {quoteNameError}\n </span>\n )}\n </div>\n\n <TextArea\n name=\"quoteComment\"\n value={renameReason}\n onInput={(e: any) => onRenameReasonChange(e.target.value)}\n label={dictionary.reasonLabel}\n rows={3}\n />\n </div>\n\n <div className={classes(['quote-management-rename-quote-modal__actions'])}>\n <Button \n variant=\"secondary\"\n size=\"medium\"\n onClick={onClose}\n className={classes(['quote-management-rename-quote-modal__cancel-button'])}\n >\n {dictionary.cancelButton}\n </Button>\n <Button \n variant=\"primary\"\n size=\"medium\"\n onClick={onSave}\n className={classes(['quote-management-rename-quote-modal__save-button'])}\n >\n {dictionary.renameButton}\n </Button>\n </div>\n </Modal>\n );\n};\n"],"names":["SvgEdit","props","React","ActionsBar","className","dropdownPlaceholder","dropdownOptions","dropdownValue","handleDropdownChange","buttons","hasDropdown","hasButtons","pickerOptions","option","jsx","jsxs","classes","Picker","button","index","VComponent","TabbedContent","tabs","tabsContent","defaultActiveTab","activeTabId","setActiveTabId","useState","handleTabClick","tabId","activeTabContent","useMemo","tabLabel","RenameQuoteModal","open","quoteName","renameReason","quoteNameError","errorBanner","successBanner","showCloseButton","onQuoteNameChange","onRenameReasonChange","onSave","onClose","dictionary","useText","Modal","Fragment","Input","e","TextArea","Button"],"mappings":"wcACK,MAACA,EAAWC,GAA0BC,EAAM,cAAc,MAAO,CAAE,MAAO,6BAA8B,MAAO,GAAI,OAAQ,GAAI,QAAS,YAAa,KAAM,OAAQ,OAAQ,eAAgB,YAAa,EAAG,cAAe,QAAS,eAAgB,QAAS,UAAW,yBAA0B,GAAGD,CAAK,EAAoBC,EAAM,cAAc,OAAQ,CAAE,EAAG,0DAA2D,CAAC,ECyBlZC,EAAiD,CAAC,CAC7D,UAAAC,EACA,oBAAAC,EACA,gBAAAC,EACA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AAY,oCAC3F,SAAAuB,CAAA,CACH,IAGD,MAAA,CAAI,UAAWvB,EAAQ,CAAC,8CAA8C,CAAC,EACtE,SAAA,CAAAD,EAAC,MAAA,CACC,SAAA,CAAAD,EAACmC,EAAA,CACC,KAAK,YACL,KAAK,OACL,MAAOd,EACP,QAAUe,GAAWT,EAAkBS,EAAE,OAAO,KAAK,EACrD,cAAeL,EAAW,eAC1B,SAAQ,GACR,MAAO,CAAC,CAACR,CAAA,CAAA,EAEVA,KACE,OAAA,CAAK,UAAWrB,EAAQ,CAAC,iDAAiD,CAAC,EACzE,SAAAqB,CAAA,CACH,CAAA,EAEJ,EAEAvB,EAACqC,EAAA,CACC,KAAK,eACL,MAAOf,EACP,QAAUc,GAAWR,EAAqBQ,EAAE,OAAO,KAAK,EACxD,MAAOL,EAAW,YAClB,KAAM,CAAA,CAAA,CACR,EACF,IAEC,MAAA,CAAI,UAAW7B,EAAQ,CAAC,8CAA8C,CAAC,EACtE,SAAA,CAAAF,EAACsC,EAAA,CACC,QAAQ,YACR,KAAK,SACL,QAASR,EACT,UAAW5B,EAAQ,CAAC,oDAAoD,CAAC,EAExE,SAAA6B,EAAW,YAAA,CAAA,EAEd/B,EAACsC,EAAA,CACC,QAAQ,UACR,KAAK,SACL,QAAST,EACT,UAAW3B,EAAQ,CAAC,kDAAkD,CAAC,EAEtE,SAAA6B,EAAW,YAAA,CAAA,CACd,CAAA,CACF,CAAA,CAAA,CAAA,EAvEK,IA0EX","x_google_ignoreList":[0]}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
/*! Copyright 2025 Adobe
|
|
2
2
|
All Rights Reserved. */
|
|
3
|
-
import{jsx as
|
|
3
|
+
import{jsx as a,jsxs as c}from"@dropins/tools/preact-jsx-runtime.js";import{useState as y,useEffect as l}from"@dropins/tools/preact-compat.js";import{classes as g}from"@dropins/tools/lib.js";import{Skeleton as f,SkeletonRow as h}from"@dropins/tools/components.js";import{useText as q}from"@dropins/tools/i18n.js";import{events as u}from"@dropins/tools/event-bus.js";const _=({className:i,shippingAddress:e,loading:m,noAddressMessage:p,...r})=>{const s=q({noAddress:"NegotiableQuote.Manage.shippingAddress.noAddress"});return m?a(N,{}):e?c("div",{className:g(["quote-management-shipping-address-display",i]),"data-testid":"shipping-address-display",...r,children:[a("div",{className:"quote-management-shipping-address-display__field","data-testid":"address-name",children:c("span",{className:"quote-management-shipping-address-display__name",children:[e.firstname," ",e.lastname]})}),e.company&&a("div",{className:"quote-management-shipping-address-display__field","data-testid":"address-company",children:e.company}),e.street.map((o,t)=>a("div",{className:"quote-management-shipping-address-display__field","data-testid":`address-street-${t}`,children:o},t)),c("div",{className:"quote-management-shipping-address-display__field","data-testid":"address-city-region",children:[e.city,e.region&&`, ${e.region.label}`," ",e.postcode]}),a("div",{className:"quote-management-shipping-address-display__field","data-testid":"address-country",children:e.country.label}),a("div",{className:"quote-management-shipping-address-display__field","data-testid":"address-telephone",children:e.telephone})]}):a("div",{className:g(["quote-management-shipping-address-display","quote-management-shipping-address-display--empty",i]),"data-testid":"shipping-address-display-empty",...r,children:a("p",{className:"quote-management-shipping-address-display__no-address",children:p||s.noAddress})})},N=()=>a(f,{"data-testid":"shipping-address-display-skeleton",children:a(h,{variant:"row",fullWidth:!0,size:"small",lines:5,multilineGap:"xsmall"})}),j=({shippingAddress:i,loading:e,...m})=>{const[p,r]=y(i);return l(()=>{i!==void 0&&r(i)},[i]),l(()=>{const s=u.on("quote-management/quote-data",o=>{var d,n;const t=(n=(d=o.quote)==null?void 0:d.shippingAddresses)==null?void 0:n[0];r(t)},{eager:!0});return()=>s==null?void 0:s.off()},[]),l(()=>{const s=u.on("quote-management/shipping-address-set",o=>{var d,n;const t=(n=(d=o.quote)==null?void 0:d.shippingAddresses)==null?void 0:n[0];r(t)},{eager:!0});return()=>s==null?void 0:s.off()},[]),l(()=>{const s=u.on("quote-management/quote-template-data",o=>{var d,n;const t=(n=(d=o.quoteTemplate)==null?void 0:d.shippingAddresses)==null?void 0:n[0];r(t)},{eager:!0});return()=>s==null?void 0:s.off()},[]),a(_,{shippingAddress:p,loading:e,...m})};export{j as S};
|
|
4
4
|
//# sourceMappingURL=ShippingAddressDisplay.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ShippingAddressDisplay.js","sources":["/@dropins/storefront-quote-management/src/components/ShippingAddressDisplay/ShippingAddressDisplay.tsx","/@dropins/storefront-quote-management/src/containers/ShippingAddressDisplay/ShippingAddressDisplay.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 } from 'preact';\nimport { HTMLAttributes } from 'preact/compat';\nimport { classes } from '@adobe-commerce/elsie/lib';\nimport { useText } from '@adobe-commerce/elsie/i18n';\nimport { Skeleton, SkeletonRow } from '@adobe-commerce/elsie/components';\nimport { ShippingAddress } from '@/quote-management/data/models/negotiable-quote-model';\nimport '@/quote-management/components/ShippingAddressDisplay/ShippingAddressDisplay.css';\n\nexport interface ShippingAddressDisplayProps extends Omit<HTMLAttributes<HTMLDivElement>, 'loading'> {\n shippingAddress?: ShippingAddress;\n loading?: boolean;\n noAddressMessage?: string;\n}\n\nexport const ShippingAddressDisplay: FunctionComponent<ShippingAddressDisplayProps> = ({\n className,\n shippingAddress,\n loading,\n noAddressMessage,\n ...props\n}) => {\n const dictionary = useText({\n noAddress: 'NegotiableQuote.Manage.shippingAddress.noAddress',\n });\n\n if (loading) {\n return <ShippingAddressDisplaySkeleton />;\n }\n\n if (!shippingAddress) {\n return (\n <div \n className={classes(['quote-management-shipping-address-display', 'quote-management-shipping-address-display--empty', className])}\n data-testid=\"shipping-address-display-empty\"\n {...props}\n >\n <p className=\"quote-management-shipping-address-display__no-address\">\n {noAddressMessage || dictionary.noAddress}\n </p>\n </div>\n );\n }\n\n return (\n <div \n className={classes(['quote-management-shipping-address-display', className])}\n data-testid=\"shipping-address-display\"\n {...props}\n >\n <div className=\"quote-management-shipping-address-display__field\" data-testid=\"address-name\">\n <span className=\"quote-management-shipping-address-display__name\">\n {shippingAddress.firstname} {shippingAddress.lastname}\n </span>\n </div>\n \n {shippingAddress.company && (\n <div className=\"quote-management-shipping-address-display__field\" data-testid=\"address-company\">\n {shippingAddress.company}\n </div>\n )}\n \n {shippingAddress.street.map((line, index) => (\n <div \n key={index} \n className=\"quote-management-shipping-address-display__field\" \n data-testid={`address-street-${index}`}\n >\n {line}\n </div>\n ))}\n \n <div className=\"quote-management-shipping-address-display__field\" data-testid=\"address-city-region\">\n {shippingAddress.city}\n {shippingAddress.region && `, ${shippingAddress.region.label}`}\n {' '}\n {shippingAddress.postcode}\n </div>\n \n <div className=\"quote-management-shipping-address-display__field\" data-testid=\"address-country\">\n {shippingAddress.country.label}\n </div>\n \n <div className=\"quote-management-shipping-address-display__field\" data-testid=\"address-telephone\">\n {shippingAddress.telephone}\n </div>\n </div>\n );\n};\n\nexport const ShippingAddressDisplaySkeleton: FunctionComponent = () => {\n return (\n <Skeleton data-testid=\"shipping-address-display-skeleton\">\n <SkeletonRow variant=\"row\" fullWidth={true} size=\"small\" lines={5} multilineGap='xsmall' />\n </Skeleton>\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 { HTMLAttributes, useEffect, useState } from 'preact/compat';\nimport { Container } from '@adobe-commerce/elsie/lib';\nimport {
|
|
1
|
+
{"version":3,"file":"ShippingAddressDisplay.js","sources":["/@dropins/storefront-quote-management/src/components/ShippingAddressDisplay/ShippingAddressDisplay.tsx","/@dropins/storefront-quote-management/src/containers/ShippingAddressDisplay/ShippingAddressDisplay.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 } from 'preact';\nimport { HTMLAttributes } from 'preact/compat';\nimport { classes } from '@adobe-commerce/elsie/lib';\nimport { useText } from '@adobe-commerce/elsie/i18n';\nimport { Skeleton, SkeletonRow } from '@adobe-commerce/elsie/components';\nimport { ShippingAddress } from '@/quote-management/data/models/negotiable-quote-model';\nimport '@/quote-management/components/ShippingAddressDisplay/ShippingAddressDisplay.css';\n\nexport interface ShippingAddressDisplayProps extends Omit<HTMLAttributes<HTMLDivElement>, 'loading'> {\n shippingAddress?: ShippingAddress;\n loading?: boolean;\n noAddressMessage?: string;\n}\n\nexport const ShippingAddressDisplay: FunctionComponent<ShippingAddressDisplayProps> = ({\n className,\n shippingAddress,\n loading,\n noAddressMessage,\n ...props\n}) => {\n const dictionary = useText({\n noAddress: 'NegotiableQuote.Manage.shippingAddress.noAddress',\n });\n\n if (loading) {\n return <ShippingAddressDisplaySkeleton />;\n }\n\n if (!shippingAddress) {\n return (\n <div \n className={classes(['quote-management-shipping-address-display', 'quote-management-shipping-address-display--empty', className])}\n data-testid=\"shipping-address-display-empty\"\n {...props}\n >\n <p className=\"quote-management-shipping-address-display__no-address\">\n {noAddressMessage || dictionary.noAddress}\n </p>\n </div>\n );\n }\n\n return (\n <div \n className={classes(['quote-management-shipping-address-display', className])}\n data-testid=\"shipping-address-display\"\n {...props}\n >\n <div className=\"quote-management-shipping-address-display__field\" data-testid=\"address-name\">\n <span className=\"quote-management-shipping-address-display__name\">\n {shippingAddress.firstname} {shippingAddress.lastname}\n </span>\n </div>\n \n {shippingAddress.company && (\n <div className=\"quote-management-shipping-address-display__field\" data-testid=\"address-company\">\n {shippingAddress.company}\n </div>\n )}\n \n {shippingAddress.street.map((line, index) => (\n <div \n key={index} \n className=\"quote-management-shipping-address-display__field\" \n data-testid={`address-street-${index}`}\n >\n {line}\n </div>\n ))}\n \n <div className=\"quote-management-shipping-address-display__field\" data-testid=\"address-city-region\">\n {shippingAddress.city}\n {shippingAddress.region && `, ${shippingAddress.region.label}`}\n {' '}\n {shippingAddress.postcode}\n </div>\n \n <div className=\"quote-management-shipping-address-display__field\" data-testid=\"address-country\">\n {shippingAddress.country.label}\n </div>\n \n <div className=\"quote-management-shipping-address-display__field\" data-testid=\"address-telephone\">\n {shippingAddress.telephone}\n </div>\n </div>\n );\n};\n\nexport const ShippingAddressDisplaySkeleton: FunctionComponent = () => {\n return (\n <Skeleton data-testid=\"shipping-address-display-skeleton\">\n <SkeletonRow variant=\"row\" fullWidth={true} size=\"small\" lines={5} multilineGap='xsmall' />\n </Skeleton>\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 { HTMLAttributes, useEffect, useState } from 'preact/compat';\nimport { Container } from '@adobe-commerce/elsie/lib';\nimport { ShippingAddress } from '@/quote-management/data/models/negotiable-quote-model';\nimport { NegotiableQuoteTemplateModel } from '@/quote-management/data/models/negotiable-quote-template-model';\nimport { ShippingAddressDisplay as ShippingAddressDisplayComponent } from '@/quote-management/components/ShippingAddressDisplay';\nimport { events } from '@adobe-commerce/event-bus';\n\nexport interface ShippingAddressDisplayProps extends Omit<HTMLAttributes<HTMLDivElement>, 'loading'> {\n shippingAddress?: ShippingAddress;\n loading?: boolean;\n}\n\nexport const ShippingAddressDisplay: Container<ShippingAddressDisplayProps> = ({\n shippingAddress: initialShippingAddress,\n loading,\n ...props\n}) => {\n const [shippingAddress, setShippingAddress] = useState<ShippingAddress | undefined>(initialShippingAddress);\n\n // Sync prop changes to internal state\n useEffect(() => {\n if (initialShippingAddress !== undefined) {\n setShippingAddress(initialShippingAddress);\n }\n }, [initialShippingAddress]);\n\n // Listen for quote-data events\n useEffect(() => {\n const quoteDataEvent = events.on('quote-management/quote-data', (data: { quote?: { shippingAddresses?: ShippingAddress[] } | null }) => {\n const address = data.quote?.shippingAddresses?.[0];\n setShippingAddress(address);\n }, {\n eager: true,\n });\n return () => quoteDataEvent?.off();\n }, []);\n\n // Listen for shipping-address-set events\n useEffect(() => {\n const shippingAddressSetEvent = events.on('quote-management/shipping-address-set', (data: { quote?: { shippingAddresses?: ShippingAddress[] } | null }) => {\n const address = data.quote?.shippingAddresses?.[0];\n setShippingAddress(address);\n }, {\n eager: true,\n });\n return () => shippingAddressSetEvent?.off();\n }, []);\n\n // Listen for quote-template-data events\n useEffect(() => {\n const quoteTemplateDataEvent = events.on('quote-management/quote-template-data', (data: { quoteTemplate?: NegotiableQuoteTemplateModel | null }) => {\n const address = data.quoteTemplate?.shippingAddresses?.[0];\n setShippingAddress(address);\n }, {\n eager: true,\n });\n return () => quoteTemplateDataEvent?.off();\n }, []);\n\n return (\n <ShippingAddressDisplayComponent\n shippingAddress={shippingAddress}\n loading={loading}\n {...props}\n />\n );\n};\n\n"],"names":["ShippingAddressDisplay","className","shippingAddress","loading","noAddressMessage","props","dictionary","useText","ShippingAddressDisplaySkeleton","jsxs","classes","jsx","line","index","Skeleton","SkeletonRow","initialShippingAddress","setShippingAddress","useState","useEffect","quoteDataEvent","events","data","address","_b","_a","shippingAddressSetEvent","quoteTemplateDataEvent","ShippingAddressDisplayComponent"],"mappings":"8WAuBO,MAAMA,EAAyE,CAAC,CACrF,UAAAC,EACA,gBAAAC,EACA,QAAAC,EACA,iBAAAC,EACA,GAAGC,CACL,IAAM,CACJ,MAAMC,EAAaC,EAAQ,CACzB,UAAW,kDAAA,CACZ,EAED,OAAIJ,IACMK,EAAA,EAA+B,EAGpCN,EAeHO,EAAC,MAAA,CACC,UAAWC,EAAQ,CAAC,4CAA6CT,CAAS,CAAC,EAC3E,cAAY,2BACX,GAAGI,EAEJ,SAAA,CAAAM,EAAC,MAAA,CAAI,UAAU,mDAAmD,cAAY,eAC5E,SAAAF,EAAC,OAAA,CAAK,UAAU,kDACb,SAAA,CAAAP,E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AuE,SACtI,MAAMC,GAAUC,GAAAC,EAAAH,EAAK,QAAL,YAAAG,EAAY,oBAAZ,YAAAD,EAAgC,GAChDP,EAAmBM,CAAO,CAC5B,EAAG,CACD,MAAO,EAAA,CACR,EACD,MAAO,IAAMH,GAAA,YAAAA,EAAgB,KAC/B,EAAG,CAAA,CAAE,EAGLD,EAAU,IAAM,CACd,MAAMO,EAA0BL,EAAO,GAAG,wCAA0CC,GAAuE,SACzJ,MAAMC,GAAUC,GAAAC,EAAAH,EAAK,QAAL,YAAAG,EAAY,oBAAZ,YAAAD,EAAgC,GAChDP,EAAmBM,CAAO,CAC5B,EAAG,CACD,MAAO,EAAA,CACR,EACD,MAAO,IAAMG,GAAA,YAAAA,EAAyB,KACxC,EAAG,CAAA,CAAE,EAGLP,EAAU,IAAM,CACd,MAAMQ,EAAyBN,EAAO,GAAG,uCAAyCC,GAAkE,SAClJ,MAAMC,GAAUC,GAAAC,EAAAH,EAAK,gBAAL,YAAAG,EAAoB,oBAApB,YAAAD,EAAwC,GACxDP,EAAmBM,CAAO,CAC5B,EAAG,CACD,MAAO,EAAA,CACR,EACD,MAAO,IAAMI,GAAA,YAAAA,EAAwB,KACvC,EAAG,CAAA,CAAE,EAGHhB,EAACiB,EAAA,CACC,gBAAA1B,EACA,QAAAC,EACC,GAAGE,CAAA,CAAA,CAGV"}
|
|
@@ -44,7 +44,7 @@ import{events as p}from"@dropins/tools/event-bus.js";import{f as E,t as q}from".
|
|
|
44
44
|
}
|
|
45
45
|
}
|
|
46
46
|
}
|
|
47
|
-
`,M=async s=>{var o;if(!_.authenticated)return Promise.reject(new Error("Unauthorized"));const a=Array.isArray(s)?s:[s];try{const e=await E(T,{variables:{quoteUids:a}}),{errors:c}=e||{};if(c&&c.length){const r=c.map(t=>t==null?void 0:t.message).filter(Boolean).join("; ");throw new Error(r||"Failed to delete negotiable quotes")}const
|
|
47
|
+
`,M=async s=>{var o;if(!_.authenticated)return Promise.reject(new Error("Unauthorized"));const a=Array.isArray(s)?s:[s];try{const e=await E(T,{variables:{quoteUids:a}}),{errors:c}=e||{};if(c&&c.length){const r=c.map(t=>t==null?void 0:t.message).filter(Boolean).join("; ");throw new Error(r||"Failed to delete negotiable quotes")}const m=(o=e==null?void 0:e.data)==null?void 0:o.deleteNegotiableQuotes;if(!m)throw new Error("No delete result returned");const i={resultStatus:m.result_status,operationResults:(m.operation_results||[]).map(r=>(r==null?void 0:r.__typename)==="NegotiableQuoteUidOperationSuccess"?{__typename:"NegotiableQuoteUidOperationSuccess",quoteUid:r==null?void 0:r.quote_uid}:{__typename:"DeleteNegotiableQuoteOperationFailure",quoteUid:r==null?void 0:r.quote_uid,errors:((r==null?void 0:r.errors)||[]).map(u=>({__typename:u==null?void 0:u.__typename,message:u==null?void 0:u.message,uid:u==null?void 0:u.uid}))})},d=i.operationResults.filter(r=>r.__typename==="NegotiableQuoteUidOperationSuccess").map(r=>r.quoteUid);return d.length>0&&p.emit("quote-management/negotiable-quote-deleted",{deletedQuoteUids:d,resultStatus:i.resultStatus}),i}catch(e){return p.emit("quote-management/negotiable-quote-delete-error",{error:e instanceof Error?e:new Error(String(e)),attemptedQuoteUids:a}),Promise.reject(e)}},f=`
|
|
48
48
|
mutation SEND_NEGOTIABLE_QUOTE_FOR_REVIEW_MUTATION(
|
|
49
49
|
$quoteUid: ID!
|
|
50
50
|
$comment: NegotiableQuoteCommentInput
|
|
@@ -61,7 +61,7 @@ import{events as p}from"@dropins/tools/event-bus.js";import{f as E,t as q}from".
|
|
|
61
61
|
}
|
|
62
62
|
}
|
|
63
63
|
${g}
|
|
64
|
-
`,R=async s=>{const{quoteUid:a,comment:o,attachments:e}=s;if(!a)throw new Error("Quote UID is required");const c=e!=null&&e.length?{comment:o||"",attachments:e}:o?{comment:o}:null;return E(f,{variables:{quoteUid:a,comment:c}}).then(
|
|
64
|
+
`,R=async s=>{const{quoteUid:a,comment:o,attachments:e}=s;if(!a)throw new Error("Quote UID is required");const c=e!=null&&e.length?{comment:o||"",attachments:e}:o?{comment:o}:null;return E(f,{variables:{quoteUid:a,comment:c}}).then(m=>{var r,t;const{errors:i}=m;if(i){const n=i.map(u=>u.message).join("; ");throw new Error(`Failed to send quote for review: ${n}`)}const d=q((t=(r=m.data)==null?void 0:r.sendNegotiableQuoteForReview)==null?void 0:t.quote);if(!d)throw new Error("Failed to transform quote data: Invalid response structure");return p.emit("quote-management/quote-sent-for-review",{quote:d,input:{quoteUid:a,comment:o,attachments:e}}),d})},w=`
|
|
65
65
|
mutation CLOSE_NEGOTIABLE_QUOTE_MUTATION(
|
|
66
66
|
$quoteUids: [ID!]!
|
|
67
67
|
) {
|
|
@@ -91,7 +91,7 @@ import{events as p}from"@dropins/tools/event-bus.js";import{f as E,t as q}from".
|
|
|
91
91
|
}
|
|
92
92
|
}
|
|
93
93
|
}
|
|
94
|
-
`,v=async s=>{var o;if(!_.authenticated)return Promise.reject(new Error("Unauthorized"));const{quoteUids:a}=s;if(!a||a.length===0)throw new Error("Quote UIDs are required");try{const e=await E(w,{variables:{quoteUids:a}}),{errors:c}=e||{};if(c&&c.length){const t=c.map(
|
|
94
|
+
`,v=async s=>{var o;if(!_.authenticated)return Promise.reject(new Error("Unauthorized"));const{quoteUids:a}=s;if(!a||a.length===0)throw new Error("Quote UIDs are required");try{const e=await E(w,{variables:{quoteUids:a}}),{errors:c}=e||{};if(c&&c.length){const t=c.map(n=>n==null?void 0:n.message).filter(Boolean).join("; ");throw new Error(t||"Failed to close negotiable quotes")}const m=(o=e==null?void 0:e.data)==null?void 0:o.closeNegotiableQuotes;if(!m)throw new Error("No close result returned");const i={resultStatus:m.result_status,operationResults:(m.operation_results||[]).map(t=>(t==null?void 0:t.__typename)==="NegotiableQuoteUidOperationSuccess"?{__typename:"NegotiableQuoteUidOperationSuccess",quoteUid:t==null?void 0:t.quote_uid}:{__typename:"CloseNegotiableQuoteOperationFailure",quoteUid:t==null?void 0:t.quote_uid,errors:((t==null?void 0:t.errors)||[]).map(l=>({__typename:l==null?void 0:l.__typename,message:l==null?void 0:l.message,uid:l==null?void 0:l.uid}))})},d=i.operationResults.filter(t=>t.__typename==="CloseNegotiableQuoteOperationFailure").map(t=>t);if(d.length>0){const t=d.map(n=>n.errors&&n.errors.length>0?n.errors.map(u=>u.message||`Failed to close quote ${n.quoteUid}`).join(", "):`Failed to close quote ${n.quoteUid}`).join("; ");throw new Error(t)}const r=i.operationResults.filter(t=>t.__typename==="NegotiableQuoteUidOperationSuccess").map(t=>t.quoteUid);return r.length>0&&p.emit("quote-management/negotiable-quote-closed",{closedQuoteUids:r,resultStatus:i.resultStatus}),i}catch(e){return p.emit("quote-management/negotiable-quote-close-error",{error:e instanceof Error?e:new Error(String(e)),attemptedQuoteUids:a}),Promise.reject(e)}},b=`
|
|
95
95
|
mutation CREATE_QUOTE_TEMPLATE_MUTATION($cartId: ID!) {
|
|
96
96
|
requestNegotiableQuoteTemplateFromQuote(input: { cart_id: $cartId }) {
|
|
97
97
|
...NegotiableQuoteTemplateFragment
|
|
@@ -108,7 +108,7 @@ import{events as p}from"@dropins/tools/event-bus.js";import{f as E,t as q}from".
|
|
|
108
108
|
}
|
|
109
109
|
}
|
|
110
110
|
${g}
|
|
111
|
-
`,j=async s=>{const{quoteUid:a,quoteName:o,quoteComment:e}=s;if(!a)throw new Error("Quote UID is required");if(!o)throw new Error("Quote name is required");return E(I,{variables:{input:{quote_uid:a,quote_name:o,quote_comment:e||""}}}).then(
|
|
111
|
+
`,j=async s=>{const{quoteUid:a,quoteName:o,quoteComment:e}=s;if(!a)throw new Error("Quote UID is required");if(!o)throw new Error("Quote name is required");return E(I,{variables:{input:{quote_uid:a,quote_name:o,quote_comment:e||""}}}).then(m=>{var r,t;const{errors:i}=m;if(i){const n=i.map(u=>u.message).join("; ");throw new Error(`Failed to rename quote: ${n}`)}const d=q((t=(r=m.data)==null?void 0:r.renameNegotiableQuote)==null?void 0:t.quote);if(!d)throw new Error("Failed to transform quote data: Invalid response structure");return p.emit("quote-management/quote-renamed",{quote:d,input:{quoteUid:a,quoteName:o,quoteComment:e}}),d})},O=`
|
|
112
112
|
mutation DUPLICATE_NEGOTIABLE_QUOTE_MUTATION($quoteUid: ID!, $duplicatedQuoteUid: ID!) {
|
|
113
113
|
duplicateNegotiableQuote(input: { quote_uid: $quoteUid, duplicated_quote_uid: $duplicatedQuoteUid }) {
|
|
114
114
|
quote {
|
|
@@ -117,5 +117,5 @@ import{events as p}from"@dropins/tools/event-bus.js";import{f as E,t as q}from".
|
|
|
117
117
|
}
|
|
118
118
|
}
|
|
119
119
|
${g}
|
|
120
|
-
`,P=async s=>{if(!_.authenticated)throw new Error("Unauthorized");const{quoteUid:a,duplicatedQuoteUid:o}=s;if(!a||!a.trim())throw new Error("Quote UID is required");if(!o||!o.trim())throw new Error("Duplicated Quote UID is required");return E(
|
|
120
|
+
`,P=async s=>{if(!_.authenticated)throw new Error("Unauthorized");const{quoteUid:a,duplicatedQuoteUid:o,hasOutOfStockItems:e}=s;if(!a||!a.trim())throw new Error("Quote UID is required");if(!o||!o.trim())throw new Error("Duplicated Quote UID is required");return E(O,{variables:{quoteUid:a,duplicatedQuoteUid:o}}).then(c=>{var d,r;const{errors:m}=c;if(m){const t=m.map(n=>n.message).join("; ");throw new Error(`Failed to duplicate quote: ${t}`)}const i=q((r=(d=c.data)==null?void 0:d.duplicateNegotiableQuote)==null?void 0:r.quote);if(!i)throw new Error("Failed to transform quote data: Invalid response structure");return p.emit("quote-management/quote-duplicated",{quote:i,input:{quoteUid:a,duplicatedQuoteUid:o},hasOutOfStockItems:e}),i})};export{L as a,P as b,v as c,M as d,S as g,j as r,R as s};
|
|
121
121
|
//# sourceMappingURL=duplicateNegotiableQuote.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"duplicateNegotiableQuote.js","sources":["/@dropins/storefront-quote-management/src/api/getQuoteData/graphql/QuoteDataQuery.ts","/@dropins/storefront-quote-management/src/api/getQuoteData/getQuoteData.ts","/@dropins/storefront-quote-management/src/api/deleteQuote/graphql/DeleteQuoteMutation.ts","/@dropins/storefront-quote-management/src/api/deleteQuote/deleteQuote.ts","/@dropins/storefront-quote-management/src/api/sendForReview/graphql/SendNegotiableQuoteForReviewMutation.ts","/@dropins/storefront-quote-management/src/api/sendForReview/sendForReview.ts","/@dropins/storefront-quote-management/src/api/closeNegotiableQuote/graphql/CloseNegotiableQuoteMutation.ts","/@dropins/storefront-quote-management/src/api/closeNegotiableQuote/closeNegotiableQuote.ts","/@dropins/storefront-quote-management/src/api/createQuoteTemplate/graphql/createQuoteTemplate.ts","/@dropins/storefront-quote-management/src/api/createQuoteTemplate/createQuoteTemplate.ts","/@dropins/storefront-quote-management/src/api/renameNegotiableQuote/graphql/RenameNegotiableQuoteMutation.ts","/@dropins/storefront-quote-management/src/api/renameNegotiableQuote/renameNegotiableQuote.ts","/@dropins/storefront-quote-management/src/api/duplicateNegotiableQuote/graphql/duplicateNegotiableQuoteMutation.ts","/@dropins/storefront-quote-management/src/api/duplicateNegotiableQuote/duplicateNegotiableQuote.ts"],"sourcesContent":["import { NEGOTIABLE_QUOTE_FRAGMENT } from '@/quote-management/api/graphql/NegotiableQuoteFragment';\n\nexport const QUOTE_DATA_QUERY = `\n query QUOTE_DATA_QUERY(\n $quoteId: ID!\n ) {\n negotiableQuote(\n uid: $quoteId\n ) {\n ...NegotiableQuoteFragment\n }\n }\n\n ${NEGOTIABLE_QUOTE_FRAGMENT}\n`","/********************************************************************\n * Copyright 2025 Adobe\n * All Rights Reserved.\n *\n * NOTICE: Adobe permits you to use, modify, and distribute this \n * file in accordance with the terms of the Adobe license agreement \n * accompanying it. \n *******************************************************************/\n\nimport { fetchGraphQl } from '@/quote-management/api/';\nimport { QUOTE_DATA_QUERY } from './graphql/QuoteDataQuery';\nimport { transformQuote } from '@/quote-management/data/transforms';\nimport { state } from '@/quote-management/lib/state';\nimport { events } from '@adobe-commerce/event-bus';\n\nexport const getQuoteData = async (quoteId: string) => { \n if (!state.authenticated) {\n return Promise.reject(new Error('Unauthorized'));\n }\n\n if (!state.permissions.editQuote) {\n return Promise.reject(new Error('Unauthorized'));\n }\n\n try {\n const results: any = await fetchGraphQl(QUOTE_DATA_QUERY, {\n variables: {\n quoteId\n }\n });\n\n const transformedQuote = transformQuote(results?.data?.negotiableQuote);\n\n if (!transformedQuote) {\n throw new Error('Failed to transform quote data');\n }\n\n events.emit('quote-management/quote-data', {\n quote: transformedQuote,\n permissions: state.permissions,\n });\n \n return transformedQuote;\n } catch (error) {\n return Promise.reject(error);\n }\n}\n","/********************************************************************\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_MUTATION = `\n mutation DELETE_QUOTE_MUTATION($quoteUids: [ID!]!) {\n deleteNegotiableQuotes(\n input: {\n quote_uids: $quoteUids\n }\n ) {\n result_status\n operation_results {\n __typename\n ... on NegotiableQuoteUidOperationSuccess {\n quote_uid\n }\n ... on DeleteNegotiableQuoteOperationFailure {\n quote_uid\n errors {\n __typename\n ... on ErrorInterface {\n message\n }\n ... on NoSuchEntityUidError {\n uid\n message\n }\n ... on NegotiableQuoteInvalidStateError {\n message\n }\n }\n }\n }\n }\n }\n`;\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 { state } from '@/quote-management/lib/state';\nimport { DELETE_QUOTE_MUTATION } from '@/quote-management/api/deleteQuote/graphql/DeleteQuoteMutation';\nimport { events } from '@adobe-commerce/event-bus';\n\nexport interface DeleteQuoteSuccessResult {\n __typename: 'NegotiableQuoteUidOperationSuccess';\n quoteUid: string;\n}\n\nexport interface DeleteQuoteFailureError {\n __typename: string;\n message?: string;\n uid?: string;\n}\n\nexport interface DeleteQuoteFailureResult {\n __typename: 'DeleteNegotiableQuoteOperationFailure';\n quoteUid: string;\n errors: DeleteQuoteFailureError[];\n}\n\nexport interface DeleteQuoteOutput {\n resultStatus: string;\n operationResults: Array<DeleteQuoteSuccessResult | DeleteQuoteFailureResult>;\n}\n\nexport const deleteQuote = async ( quoteUids: string[] | string ): Promise<DeleteQuoteOutput> => {\n if (!state.authenticated) {\n return Promise.reject(new Error('Unauthorized'));\n }\n\n const quoteUidsArray = Array.isArray(quoteUids) ? quoteUids : [quoteUids];\n\n try {\n const response: any = await fetchGraphQl(DELETE_QUOTE_MUTATION, {\n variables: {\n quoteUids: quoteUidsArray,\n },\n });\n\n const { errors } = response || {};\n if (errors && errors.length) {\n const errorMessages = errors.map((e: any) => e?.message).filter(Boolean).join('; ');\n throw new Error(errorMessages || 'Failed to delete negotiable quotes');\n }\n\n const raw = response?.data?.deleteNegotiableQuotes;\n if (!raw) {\n throw new Error('No delete result returned');\n }\n\n const transformed: DeleteQuoteOutput = {\n resultStatus: raw.result_status,\n operationResults: (raw.operation_results || []).map((result: any) => {\n const typename = result?.__typename;\n if (typename === 'NegotiableQuoteUidOperationSuccess') {\n const success: DeleteQuoteSuccessResult = {\n __typename: 'NegotiableQuoteUidOperationSuccess',\n quoteUid: result?.quote_uid,\n };\n return success;\n }\n const failure: DeleteQuoteFailureResult = {\n __typename: 'DeleteNegotiableQuoteOperationFailure',\n quoteUid: result?.quote_uid,\n errors: (result?.errors || []).map((err: any) => ({\n __typename: err?.__typename,\n message: err?.message,\n uid: err?.uid,\n })),\n };\n return failure;\n }),\n };\n\n // Emit event with successfully deleted quote UIDs\n const deletedUids = transformed.operationResults\n .filter((res) => res.__typename === 'NegotiableQuoteUidOperationSuccess')\n .map((res) => (res as DeleteQuoteSuccessResult).quoteUid);\n\n if (deletedUids.length > 0) {\n events.emit('quote-management/negotiable-quote-deleted', {\n deletedQuoteUids: deletedUids,\n resultStatus: transformed.resultStatus,\n });\n }\n\n return transformed;\n } catch (error) {\n // Emit error event for integration layer\n events.emit('quote-management/negotiable-quote-delete-error', {\n error: error instanceof Error ? error : new Error(String(error)),\n attemptedQuoteUids: quoteUidsArray,\n });\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_FRAGMENT } from '@/quote-management/api/graphql/NegotiableQuoteFragment';\n\nexport const SEND_NEGOTIABLE_QUOTE_FOR_REVIEW_MUTATION = `\n mutation SEND_NEGOTIABLE_QUOTE_FOR_REVIEW_MUTATION(\n $quoteUid: ID!\n $comment: NegotiableQuoteCommentInput\n ) {\n sendNegotiableQuoteForReview(\n input: {\n quote_uid: $quoteUid\n comment: $comment\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 { SEND_NEGOTIABLE_QUOTE_FOR_REVIEW_MUTATION } from './graphql/SendNegotiableQuoteForReviewMutation';\nimport { NegotiableQuoteModel } from '@/quote-management/data/models/negotiable-quote-model';\nimport { transformQuote } from '@/quote-management/data/transforms';\n\nexport interface SendForReviewInput {\n quoteUid: string;\n comment?: string;\n attachments?: { key: string }[];\n}\n\nexport const sendForReview = async (\n input: SendForReviewInput\n): Promise<NegotiableQuoteModel | null> => {\n const { quoteUid, comment, attachments } = input;\n\n if (!quoteUid) {\n throw new Error('Quote UID is required');\n }\n\n // Build the comment object with attachments if provided\n const commentInput = attachments?.length \n ? { comment: comment || '', attachments } \n : comment \n ? { comment } \n : null;\n\n return fetchGraphQl(SEND_NEGOTIABLE_QUOTE_FOR_REVIEW_MUTATION, {\n variables: {\n quoteUid,\n comment: commentInput,\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 send quote for review: ${errorMessages}`);\n }\n\n // Transform the quote data\n const quoteData = transformQuote(\n response.data?.sendNegotiableQuoteForReview?.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/quote-sent-for-review', {\n quote: quoteData,\n input: { quoteUid, comment, attachments },\n });\n\n return quoteData;\n });\n};\n\n","export const CLOSE_NEGOTIABLE_QUOTE_MUTATION = `\n mutation CLOSE_NEGOTIABLE_QUOTE_MUTATION(\n $quoteUids: [ID!]!\n ) {\n closeNegotiableQuotes(input: { quote_uids: $quoteUids }) {\n result_status\n operation_results {\n ... on NegotiableQuoteUidOperationSuccess {\n __typename\n quote_uid\n }\n ... on CloseNegotiableQuoteOperationFailure {\n __typename\n quote_uid\n errors {\n __typename\n ... on ErrorInterface {\n message\n }\n ... on NoSuchEntityUidError {\n uid\n }\n ... on NegotiableQuoteInvalidStateError {\n message\n }\n }\n }\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 { state } from '@/quote-management/lib/state';\nimport { events } from '@adobe-commerce/event-bus';\nimport { CLOSE_NEGOTIABLE_QUOTE_MUTATION } from './graphql/CloseNegotiableQuoteMutation';\n\nexport interface CloseNegotiableQuoteInput {\n quoteUids: string[];\n}\n\nexport interface CloseNegotiableQuoteSuccessResult {\n __typename: 'NegotiableQuoteUidOperationSuccess';\n quoteUid: string;\n}\n\nexport interface CloseNegotiableQuoteFailureError {\n __typename: string;\n message?: string;\n uid?: string;\n}\n\nexport interface CloseNegotiableQuoteFailureResult {\n __typename: 'CloseNegotiableQuoteOperationFailure';\n quoteUid: string;\n errors: CloseNegotiableQuoteFailureError[];\n}\n\nexport interface CloseNegotiableQuoteResult {\n resultStatus: string;\n operationResults: Array<CloseNegotiableQuoteSuccessResult | CloseNegotiableQuoteFailureResult>;\n}\n\nexport const closeNegotiableQuote = async (input: CloseNegotiableQuoteInput): Promise<CloseNegotiableQuoteResult> => { \n if (!state.authenticated) {\n return Promise.reject(new Error('Unauthorized'));\n }\n\n const { quoteUids } = input;\n\n if (!quoteUids || quoteUids.length === 0) {\n throw new Error('Quote UIDs are required');\n }\n\n try {\n const response: any = await fetchGraphQl(CLOSE_NEGOTIABLE_QUOTE_MUTATION, {\n variables: {\n quoteUids,\n },\n });\n\n const { errors } = response || {};\n if (errors && errors.length) {\n const errorMessages = errors\n .map((e: any) => e?.message)\n .filter(Boolean)\n .join('; ');\n throw new Error(errorMessages || 'Failed to close negotiable quotes');\n }\n\n const raw = response?.data?.closeNegotiableQuotes;\n if (!raw) {\n throw new Error('No close result returned');\n }\n\n const transformed: CloseNegotiableQuoteResult = {\n resultStatus: raw.result_status,\n operationResults: (raw.operation_results || []).map((result: any) => {\n const typename = result?.__typename;\n if (typename === 'NegotiableQuoteUidOperationSuccess') {\n const success: CloseNegotiableQuoteSuccessResult = {\n __typename: 'NegotiableQuoteUidOperationSuccess',\n quoteUid: result?.quote_uid,\n };\n return success;\n }\n const failure: CloseNegotiableQuoteFailureResult = {\n __typename: 'CloseNegotiableQuoteOperationFailure',\n quoteUid: result?.quote_uid,\n errors: (result?.errors || []).map((err: any) => ({\n __typename: err?.__typename,\n message: err?.message,\n uid: err?.uid,\n })),\n };\n return failure;\n }),\n };\n\n // Check for operation failures\n const failures = transformed.operationResults\n .filter(\n (res) => res.__typename === 'CloseNegotiableQuoteOperationFailure'\n )\n .map((res) => res as CloseNegotiableQuoteFailureResult);\n\n if (failures.length > 0) {\n // Create error message from failures\n const failureMessages = failures\n .map((failure) => {\n if (failure.errors && failure.errors.length > 0) {\n return failure.errors\n .map(\n (err) =>\n err.message || `Failed to close quote ${failure.quoteUid}`\n )\n .join(', ');\n }\n return `Failed to close quote ${failure.quoteUid}`;\n })\n .join('; ');\n\n throw new Error(failureMessages);\n }\n\n // Emit success event with closed quote UIDs\n const closedUids = transformed.operationResults\n .filter((res) => res.__typename === 'NegotiableQuoteUidOperationSuccess')\n .map((res) => (res as CloseNegotiableQuoteSuccessResult).quoteUid);\n\n if (closedUids.length > 0) {\n events.emit('quote-management/negotiable-quote-closed', {\n closedQuoteUids: closedUids,\n resultStatus: transformed.resultStatus,\n });\n }\n\n return transformed;\n } catch (error) {\n // Emit error event for integration layer\n events.emit('quote-management/negotiable-quote-close-error', {\n error: error instanceof Error ? error : new Error(String(error)),\n attemptedQuoteUids: quoteUids,\n });\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 \"../../graphql/NegotiableQuoteTemplateFragment\";\n\nexport const CREATE_QUOTE_TEMPLATE_MUTATION = /* GraphQL */ `\n mutation CREATE_QUOTE_TEMPLATE_MUTATION($cartId: ID!) {\n requestNegotiableQuoteTemplateFromQuote(input: { cart_id: $cartId }) {\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 { events } from '@adobe-commerce/event-bus';\nimport { fetchGraphQl } from '@/quote-management/api/';\nimport { CREATE_QUOTE_TEMPLATE_MUTATION } from './graphql/createQuoteTemplate';\nimport { state } from '@/quote-management/lib/state';\nimport { transformQuoteTemplate } from '@/quote-management/data/transforms';\nimport { NegotiableQuoteTemplateModel } from '@/quote-management/data/models/negotiable-quote-template-model';\n\nexport const createQuoteTemplate = async (\n quoteId: string\n): Promise<NegotiableQuoteTemplateModel | null> => {\n if (!state.authenticated) {\n throw new Error('Unauthorized');\n }\n\n if (!quoteId) {\n throw new Error('Cart ID is required');\n }\n\n try {\n const results: any = await fetchGraphQl(CREATE_QUOTE_TEMPLATE_MUTATION, {\n variables: {\n cartId: quoteId,\n },\n });\n\n if (!results?.data?.requestNegotiableQuoteTemplateFromQuote) {\n throw new Error('Failed to create quote template');\n }\n\n const transformedQuoteTemplate = transformQuoteTemplate(\n results.data.requestNegotiableQuoteTemplateFromQuote\n );\n\n if (!transformedQuoteTemplate) {\n throw new Error('Failed to transform quote template data');\n }\n\n events.emit('quote-management/quote-template-data', {\n quoteTemplate: transformedQuoteTemplate,\n permissions: state.permissions,\n });\n\n return transformedQuoteTemplate;\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_FRAGMENT } from '@/quote-management/api/graphql/NegotiableQuoteFragment';\n\nexport const RENAME_NEGOTIABLE_QUOTE_MUTATION = `\n mutation renameNegotiableQuote($input: RenameNegotiableQuoteInput!) {\n renameNegotiableQuote(input: $input) {\n quote {\n ...NegotiableQuoteFragment\n }\n }\n }\n ${NEGOTIABLE_QUOTE_FRAGMENT}\n`;\n\n","/********************************************************************\n * Copyright 2025 Adobe\n * All Rights Reserved.\n *\n * NOTICE: Adobe permits you to use, modify, and distribute this\n * file in accordance with the terms of the Adobe license agreement\n * accompanying it.\n *******************************************************************/\n\nimport { fetchGraphQl } from '@/quote-management/api';\nimport { events } from '@adobe-commerce/event-bus';\nimport { RENAME_NEGOTIABLE_QUOTE_MUTATION } from './graphql/RenameNegotiableQuoteMutation';\nimport { NegotiableQuoteModel } from '@/quote-management/data/models/negotiable-quote-model';\nimport { transformQuote } from '@/quote-management/data/transforms';\n\nexport interface RenameNegotiableQuoteInput {\n quoteUid: string;\n quoteName: string;\n quoteComment?: string;\n}\n\nexport const renameNegotiableQuote = async (\n input: RenameNegotiableQuoteInput\n): Promise<NegotiableQuoteModel | null> => {\n const { quoteUid, quoteName, quoteComment } = input;\n\n if (!quoteUid) {\n throw new Error('Quote UID is required');\n }\n\n if (!quoteName) {\n throw new Error('Quote name is required');\n }\n\n // Backend requires quote_comment to be present (even if empty string)\n const mutationInput = {\n quote_uid: quoteUid,\n quote_name: quoteName,\n quote_comment: quoteComment || '', // Always include, use empty string if not provided\n };\n\n return fetchGraphQl(RENAME_NEGOTIABLE_QUOTE_MUTATION, {\n variables: {\n input: mutationInput,\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 rename quote: ${errorMessages}`);\n }\n\n // Transform the quote data\n const quoteData = transformQuote(\n response.data?.renameNegotiableQuote?.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/quote-renamed', {\n quote: quoteData,\n input: { quoteUid, quoteName, quoteComment },\n });\n\n return quoteData;\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 DUPLICATE_NEGOTIABLE_QUOTE_MUTATION = `\n mutation DUPLICATE_NEGOTIABLE_QUOTE_MUTATION($quoteUid: ID!, $duplicatedQuoteUid: ID!) {\n duplicateNegotiableQuote(input: { quote_uid: $quoteUid, duplicated_quote_uid: $duplicatedQuoteUid }) {\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 { DUPLICATE_NEGOTIABLE_QUOTE_MUTATION } from './graphql/duplicateNegotiableQuoteMutation';\nimport { NegotiableQuoteModel } from '@/quote-management/data/models/negotiable-quote-model';\nimport { transformQuote } from '@/quote-management/data/transforms';\nimport { state } from '@/quote-management/lib/state';\n\nexport interface DuplicateQuoteInput {\n quoteUid: string;\n duplicatedQuoteUid: string;\n}\n\nexport const duplicateQuote = async (\n input: DuplicateQuoteInput\n): Promise<NegotiableQuoteModel | null> => {\n\n if (!state.authenticated) {\n throw new Error('Unauthorized');\n }\n\n const { quoteUid, duplicatedQuoteUid } = input;\n\n if (!quoteUid || !quoteUid.trim()) {\n throw new Error('Quote UID is required');\n }\n\n if (!duplicatedQuoteUid || !duplicatedQuoteUid.trim()) {\n throw new Error('Duplicated Quote UID is required');\n }\n\n return fetchGraphQl(DUPLICATE_NEGOTIABLE_QUOTE_MUTATION, {\n variables: { quoteUid, duplicatedQuoteUid },\n }).then((response) => {\n const { errors } = response;\n\n if (errors) {\n const errorMessages = errors.map((error) => error.message).join('; ');\n throw new Error(`Failed to duplicate quote: ${errorMessages}`);\n }\n\n const quoteData = transformQuote(\n response.data?.duplicateNegotiableQuote?.quote\n );\n\n if (!quoteData) {\n throw new Error(\n 'Failed to transform quote data: Invalid response structure'\n );\n }\n\n events.emit('quote-management/quote-duplicated', {\n quote: quoteData,\n input: { quoteUid, duplicatedQuoteUid },\n });\n\n return quoteData;\n });\n};\n"],"names":["QUOTE_DATA_QUERY","NEGOTIABLE_QUOTE_FRAGMENT","getQuoteData","quoteId","state","results","fetchGraphQl","transformedQuote","transformQuote","_a","events","error","DELETE_QUOTE_MUTATION","deleteQuote","quoteUids","quoteUidsArray","response","errors","errorMessages","e","raw","transformed","result","err","deletedUids","res","SEND_NEGOTIABLE_QUOTE_FOR_REVIEW_MUTATION","sendForReview","input","quoteUid","comment","attachments","commentInput","quoteData","_b","CLOSE_NEGOTIABLE_QUOTE_MUTATION","closeNegotiableQuote","failures","failureMessages","failure","closedUids","CREATE_QUOTE_TEMPLATE_MUTATION","NEGOTIABLE_QUOTE_TEMPLATE_FRAGMENT","createQuoteTemplate","transformedQuoteTemplate","transformQuoteTemplate","RENAME_NEGOTIABLE_QUOTE_MUTATION","renameNegotiableQuote","quoteName","quoteComment","DUPLICATE_NEGOTIABLE_QUOTE_MUTATION","duplicateQuote","duplicatedQuoteUid"],"mappings":"gSAEO,MAAMA,EAAmB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,MAW1BC,CAAyB;AAAA,ECElBC,EAAe,MAAOC,GAAoB,OACnD,GAAI,CAACC,EAAM,cACP,OAAO,QAAQ,OAAO,IAAI,MAAM,cAAc,CAAC,EAGnD,GAAI,CAACA,EAAM,YAAY,UACnB,OAAO,QAAQ,OAAO,IAAI,MAAM,cAAc,CAAC,EAGnD,GAAI,CACA,MAAMC,EAAe,MAAMC,EAAaN,EAAkB,CACtD,UAAW,CACP,QAAAG,CAAA,CACJ,CACH,EAEKI,EAAmBC,GAAeC,EAAAJ,GAAA,YAAAA,EAAS,OAAT,YAAAI,EAAe,eAAe,EAEtE,GAAI,CAACF,EACD,MAAM,IAAI,MAAM,gCAAgC,EAGpD,OAAAG,EAAO,KAAK,8BAA+B,CACvC,MAAOH,EACP,YAAaH,EAAM,WAAA,CACtB,EAEMG,CACX,OAASI,EAAO,CACZ,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C5C,MAAOuB,EACP,MAAO,CAAE,SAAAJ,EAAU,UAAAmB,EAAW,aAAAC,CAAA,CAAa,CAC5C,EAEMhB,CACT,CAAC,CACH,EC9DaiB,EAAsC;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,IAQ/CjD,CAAyB;AAAA,ECEhBkD,EAAiB,MAC5BvB,GACyC,CAEzC,GAAI,CAACxB,EAAM,cACT,MAAM,IAAI,MAAM,cAAc,EAGhC,KAAM,CAAE,SAAAyB,EAAU,mBAAAuB,CAAA,EAAuBxB,EAEzC,GAAI,CAACC,GAAY,CAACA,EAAS,OACzB,MAAM,IAAI,MAAM,uBAAuB,EAGzC,GAAI,CAACuB,GAAsB,CAACA,EAAmB,OAC7C,MAAM,IAAI,MAAM,kCAAkC,EAGpD,OAAO9C,EAAa4C,EAAqC,CACvD,UAAW,CAAE,SAAArB,EAAU,mBAAAuB,CAAA,CAAmB,CAC3C,EAAE,KAAMpC,GAAa,SACpB,KAAM,CAAE,OAAAC,GAAWD,EAEnB,GAAIC,EAAQ,CACV,MAAMC,EAAgBD,EAAO,IAAKN,GAAUA,EAAM,OAAO,EAAE,KAAK,IAAI,EACpE,MAAM,IAAI,MAAM,8BAA8BO,CAAa,EAAE,CAC/D,CAEA,MAAMe,EAAYzB,GAChB0B,GAAAzB,EAAAO,EAAS,OAAT,YAAAP,EAAe,2BAAf,YAAAyB,EAAyC,KAAA,EAG3C,GAAI,CAACD,EACH,MAAM,IAAI,MACR,4DAAA,EAIJ,OAAAvB,EAAO,KAAK,oCAAqC,CAC/C,MAAOuB,EACP,MAAO,CAAE,SAAAJ,EAAU,mBAAAuB,CAAA,CAAmB,CACvC,EAEMnB,CACT,CAAC,CACH"}
|
|
1
|
+
{"version":3,"file":"duplicateNegotiableQuote.js","sources":["/@dropins/storefront-quote-management/src/api/getQuoteData/graphql/QuoteDataQuery.ts","/@dropins/storefront-quote-management/src/api/getQuoteData/getQuoteData.ts","/@dropins/storefront-quote-management/src/api/deleteQuote/graphql/DeleteQuoteMutation.ts","/@dropins/storefront-quote-management/src/api/deleteQuote/deleteQuote.ts","/@dropins/storefront-quote-management/src/api/sendForReview/graphql/SendNegotiableQuoteForReviewMutation.ts","/@dropins/storefront-quote-management/src/api/sendForReview/sendForReview.ts","/@dropins/storefront-quote-management/src/api/closeNegotiableQuote/graphql/CloseNegotiableQuoteMutation.ts","/@dropins/storefront-quote-management/src/api/closeNegotiableQuote/closeNegotiableQuote.ts","/@dropins/storefront-quote-management/src/api/createQuoteTemplate/graphql/createQuoteTemplate.ts","/@dropins/storefront-quote-management/src/api/createQuoteTemplate/createQuoteTemplate.ts","/@dropins/storefront-quote-management/src/api/renameNegotiableQuote/graphql/RenameNegotiableQuoteMutation.ts","/@dropins/storefront-quote-management/src/api/renameNegotiableQuote/renameNegotiableQuote.ts","/@dropins/storefront-quote-management/src/api/duplicateNegotiableQuote/graphql/duplicateNegotiableQuoteMutation.ts","/@dropins/storefront-quote-management/src/api/duplicateNegotiableQuote/duplicateNegotiableQuote.ts"],"sourcesContent":["import { NEGOTIABLE_QUOTE_FRAGMENT } from '@/quote-management/api/graphql/NegotiableQuoteFragment';\n\nexport const QUOTE_DATA_QUERY = `\n query QUOTE_DATA_QUERY(\n $quoteId: ID!\n ) {\n negotiableQuote(\n uid: $quoteId\n ) {\n ...NegotiableQuoteFragment\n }\n }\n\n ${NEGOTIABLE_QUOTE_FRAGMENT}\n`","/********************************************************************\n * Copyright 2025 Adobe\n * All Rights Reserved.\n *\n * NOTICE: Adobe permits you to use, modify, and distribute this \n * file in accordance with the terms of the Adobe license agreement \n * accompanying it. \n *******************************************************************/\n\nimport { fetchGraphQl } from '@/quote-management/api/';\nimport { QUOTE_DATA_QUERY } from './graphql/QuoteDataQuery';\nimport { transformQuote } from '@/quote-management/data/transforms';\nimport { state } from '@/quote-management/lib/state';\nimport { events } from '@adobe-commerce/event-bus';\n\nexport const getQuoteData = async (quoteId: string) => { \n if (!state.authenticated) {\n return Promise.reject(new Error('Unauthorized'));\n }\n\n if (!state.permissions.editQuote) {\n return Promise.reject(new Error('Unauthorized'));\n }\n\n try {\n const results: any = await fetchGraphQl(QUOTE_DATA_QUERY, {\n variables: {\n quoteId\n }\n });\n\n const transformedQuote = transformQuote(results?.data?.negotiableQuote);\n\n if (!transformedQuote) {\n throw new Error('Failed to transform quote data');\n }\n\n events.emit('quote-management/quote-data', {\n quote: transformedQuote,\n permissions: state.permissions,\n });\n \n return transformedQuote;\n } catch (error) {\n return Promise.reject(error);\n }\n}\n","/********************************************************************\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_MUTATION = `\n mutation DELETE_QUOTE_MUTATION($quoteUids: [ID!]!) {\n deleteNegotiableQuotes(\n input: {\n quote_uids: $quoteUids\n }\n ) {\n result_status\n operation_results {\n __typename\n ... on NegotiableQuoteUidOperationSuccess {\n quote_uid\n }\n ... on DeleteNegotiableQuoteOperationFailure {\n quote_uid\n errors {\n __typename\n ... on ErrorInterface {\n message\n }\n ... on NoSuchEntityUidError {\n uid\n message\n }\n ... on NegotiableQuoteInvalidStateError {\n message\n }\n }\n }\n }\n }\n }\n`;\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 { state } from '@/quote-management/lib/state';\nimport { DELETE_QUOTE_MUTATION } from '@/quote-management/api/deleteQuote/graphql/DeleteQuoteMutation';\nimport { events } from '@adobe-commerce/event-bus';\n\nexport interface DeleteQuoteSuccessResult {\n __typename: 'NegotiableQuoteUidOperationSuccess';\n quoteUid: string;\n}\n\nexport interface DeleteQuoteFailureError {\n __typename: string;\n message?: string;\n uid?: string;\n}\n\nexport interface DeleteQuoteFailureResult {\n __typename: 'DeleteNegotiableQuoteOperationFailure';\n quoteUid: string;\n errors: DeleteQuoteFailureError[];\n}\n\nexport interface DeleteQuoteOutput {\n resultStatus: string;\n operationResults: Array<DeleteQuoteSuccessResult | DeleteQuoteFailureResult>;\n}\n\nexport const deleteQuote = async ( quoteUids: string[] | string ): Promise<DeleteQuoteOutput> => {\n if (!state.authenticated) {\n return Promise.reject(new Error('Unauthorized'));\n }\n\n const quoteUidsArray = Array.isArray(quoteUids) ? quoteUids : [quoteUids];\n\n try {\n const response: any = await fetchGraphQl(DELETE_QUOTE_MUTATION, {\n variables: {\n quoteUids: quoteUidsArray,\n },\n });\n\n const { errors } = response || {};\n if (errors && errors.length) {\n const errorMessages = errors.map((e: any) => e?.message).filter(Boolean).join('; ');\n throw new Error(errorMessages || 'Failed to delete negotiable quotes');\n }\n\n const raw = response?.data?.deleteNegotiableQuotes;\n if (!raw) {\n throw new Error('No delete result returned');\n }\n\n const transformed: DeleteQuoteOutput = {\n resultStatus: raw.result_status,\n operationResults: (raw.operation_results || []).map((result: any) => {\n const typename = result?.__typename;\n if (typename === 'NegotiableQuoteUidOperationSuccess') {\n const success: DeleteQuoteSuccessResult = {\n __typename: 'NegotiableQuoteUidOperationSuccess',\n quoteUid: result?.quote_uid,\n };\n return success;\n }\n const failure: DeleteQuoteFailureResult = {\n __typename: 'DeleteNegotiableQuoteOperationFailure',\n quoteUid: result?.quote_uid,\n errors: (result?.errors || []).map((err: any) => ({\n __typename: err?.__typename,\n message: err?.message,\n uid: err?.uid,\n })),\n };\n return failure;\n }),\n };\n\n // Emit event with successfully deleted quote UIDs\n const deletedUids = transformed.operationResults\n .filter((res) => res.__typename === 'NegotiableQuoteUidOperationSuccess')\n .map((res) => (res as DeleteQuoteSuccessResult).quoteUid);\n\n if (deletedUids.length > 0) {\n events.emit('quote-management/negotiable-quote-deleted', {\n deletedQuoteUids: deletedUids,\n resultStatus: transformed.resultStatus,\n });\n }\n\n return transformed;\n } catch (error) {\n // Emit error event for integration layer\n events.emit('quote-management/negotiable-quote-delete-error', {\n error: error instanceof Error ? error : new Error(String(error)),\n attemptedQuoteUids: quoteUidsArray,\n });\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_FRAGMENT } from '@/quote-management/api/graphql/NegotiableQuoteFragment';\n\nexport const SEND_NEGOTIABLE_QUOTE_FOR_REVIEW_MUTATION = `\n mutation SEND_NEGOTIABLE_QUOTE_FOR_REVIEW_MUTATION(\n $quoteUid: ID!\n $comment: NegotiableQuoteCommentInput\n ) {\n sendNegotiableQuoteForReview(\n input: {\n quote_uid: $quoteUid\n comment: $comment\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 { SEND_NEGOTIABLE_QUOTE_FOR_REVIEW_MUTATION } from './graphql/SendNegotiableQuoteForReviewMutation';\nimport { NegotiableQuoteModel } from '@/quote-management/data/models/negotiable-quote-model';\nimport { transformQuote } from '@/quote-management/data/transforms';\n\nexport interface SendForReviewInput {\n quoteUid: string;\n comment?: string;\n attachments?: { key: string }[];\n}\n\nexport const sendForReview = async (\n input: SendForReviewInput\n): Promise<NegotiableQuoteModel | null> => {\n const { quoteUid, comment, attachments } = input;\n\n if (!quoteUid) {\n throw new Error('Quote UID is required');\n }\n\n // Build the comment object with attachments if provided\n const commentInput = attachments?.length \n ? { comment: comment || '', attachments } \n : comment \n ? { comment } \n : null;\n\n return fetchGraphQl(SEND_NEGOTIABLE_QUOTE_FOR_REVIEW_MUTATION, {\n variables: {\n quoteUid,\n comment: commentInput,\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 send quote for review: ${errorMessages}`);\n }\n\n // Transform the quote data\n const quoteData = transformQuote(\n response.data?.sendNegotiableQuoteForReview?.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/quote-sent-for-review', {\n quote: quoteData,\n input: { quoteUid, comment, attachments },\n });\n\n return quoteData;\n });\n};\n\n","export const CLOSE_NEGOTIABLE_QUOTE_MUTATION = `\n mutation CLOSE_NEGOTIABLE_QUOTE_MUTATION(\n $quoteUids: [ID!]!\n ) {\n closeNegotiableQuotes(input: { quote_uids: $quoteUids }) {\n result_status\n operation_results {\n ... on NegotiableQuoteUidOperationSuccess {\n __typename\n quote_uid\n }\n ... on CloseNegotiableQuoteOperationFailure {\n __typename\n quote_uid\n errors {\n __typename\n ... on ErrorInterface {\n message\n }\n ... on NoSuchEntityUidError {\n uid\n }\n ... on NegotiableQuoteInvalidStateError {\n message\n }\n }\n }\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 { state } from '@/quote-management/lib/state';\nimport { events } from '@adobe-commerce/event-bus';\nimport { CLOSE_NEGOTIABLE_QUOTE_MUTATION } from './graphql/CloseNegotiableQuoteMutation';\n\nexport interface CloseNegotiableQuoteInput {\n quoteUids: string[];\n}\n\nexport interface CloseNegotiableQuoteSuccessResult {\n __typename: 'NegotiableQuoteUidOperationSuccess';\n quoteUid: string;\n}\n\nexport interface CloseNegotiableQuoteFailureError {\n __typename: string;\n message?: string;\n uid?: string;\n}\n\nexport interface CloseNegotiableQuoteFailureResult {\n __typename: 'CloseNegotiableQuoteOperationFailure';\n quoteUid: string;\n errors: CloseNegotiableQuoteFailureError[];\n}\n\nexport interface CloseNegotiableQuoteResult {\n resultStatus: string;\n operationResults: Array<CloseNegotiableQuoteSuccessResult | CloseNegotiableQuoteFailureResult>;\n}\n\nexport const closeNegotiableQuote = async (input: CloseNegotiableQuoteInput): Promise<CloseNegotiableQuoteResult> => { \n if (!state.authenticated) {\n return Promise.reject(new Error('Unauthorized'));\n }\n\n const { quoteUids } = input;\n\n if (!quoteUids || quoteUids.length === 0) {\n throw new Error('Quote UIDs are required');\n }\n\n try {\n const response: any = await fetchGraphQl(CLOSE_NEGOTIABLE_QUOTE_MUTATION, {\n variables: {\n quoteUids,\n },\n });\n\n const { errors } = response || {};\n if (errors && errors.length) {\n const errorMessages = errors\n .map((e: any) => e?.message)\n .filter(Boolean)\n .join('; ');\n throw new Error(errorMessages || 'Failed to close negotiable quotes');\n }\n\n const raw = response?.data?.closeNegotiableQuotes;\n if (!raw) {\n throw new Error('No close result returned');\n }\n\n const transformed: CloseNegotiableQuoteResult = {\n resultStatus: raw.result_status,\n operationResults: (raw.operation_results || []).map((result: any) => {\n const typename = result?.__typename;\n if (typename === 'NegotiableQuoteUidOperationSuccess') {\n const success: CloseNegotiableQuoteSuccessResult = {\n __typename: 'NegotiableQuoteUidOperationSuccess',\n quoteUid: result?.quote_uid,\n };\n return success;\n }\n const failure: CloseNegotiableQuoteFailureResult = {\n __typename: 'CloseNegotiableQuoteOperationFailure',\n quoteUid: result?.quote_uid,\n errors: (result?.errors || []).map((err: any) => ({\n __typename: err?.__typename,\n message: err?.message,\n uid: err?.uid,\n })),\n };\n return failure;\n }),\n };\n\n // Check for operation failures\n const failures = transformed.operationResults\n .filter(\n (res) => res.__typename === 'CloseNegotiableQuoteOperationFailure'\n )\n .map((res) => res as CloseNegotiableQuoteFailureResult);\n\n if (failures.length > 0) {\n // Create error message from failures\n const failureMessages = failures\n .map((failure) => {\n if (failure.errors && failure.errors.length > 0) {\n return failure.errors\n .map(\n (err) =>\n err.message || `Failed to close quote ${failure.quoteUid}`\n )\n .join(', ');\n }\n return `Failed to close quote ${failure.quoteUid}`;\n })\n .join('; ');\n\n throw new Error(failureMessages);\n }\n\n // Emit success event with closed quote UIDs\n const closedUids = transformed.operationResults\n .filter((res) => res.__typename === 'NegotiableQuoteUidOperationSuccess')\n .map((res) => (res as CloseNegotiableQuoteSuccessResult).quoteUid);\n\n if (closedUids.length > 0) {\n events.emit('quote-management/negotiable-quote-closed', {\n closedQuoteUids: closedUids,\n resultStatus: transformed.resultStatus,\n });\n }\n\n return transformed;\n } catch (error) {\n // Emit error event for integration layer\n events.emit('quote-management/negotiable-quote-close-error', {\n error: error instanceof Error ? error : new Error(String(error)),\n attemptedQuoteUids: quoteUids,\n });\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 \"../../graphql/NegotiableQuoteTemplateFragment\";\n\nexport const CREATE_QUOTE_TEMPLATE_MUTATION = /* GraphQL */ `\n mutation CREATE_QUOTE_TEMPLATE_MUTATION($cartId: ID!) {\n requestNegotiableQuoteTemplateFromQuote(input: { cart_id: $cartId }) {\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 { events } from '@adobe-commerce/event-bus';\nimport { fetchGraphQl } from '@/quote-management/api/';\nimport { CREATE_QUOTE_TEMPLATE_MUTATION } from './graphql/createQuoteTemplate';\nimport { state } from '@/quote-management/lib/state';\nimport { transformQuoteTemplate } from '@/quote-management/data/transforms';\nimport { NegotiableQuoteTemplateModel } from '@/quote-management/data/models/negotiable-quote-template-model';\n\nexport const createQuoteTemplate = async (\n quoteId: string\n): Promise<NegotiableQuoteTemplateModel | null> => {\n if (!state.authenticated) {\n throw new Error('Unauthorized');\n }\n\n if (!quoteId) {\n throw new Error('Cart ID is required');\n }\n\n try {\n const results: any = await fetchGraphQl(CREATE_QUOTE_TEMPLATE_MUTATION, {\n variables: {\n cartId: quoteId,\n },\n });\n\n if (!results?.data?.requestNegotiableQuoteTemplateFromQuote) {\n throw new Error('Failed to create quote template');\n }\n\n const transformedQuoteTemplate = transformQuoteTemplate(\n results.data.requestNegotiableQuoteTemplateFromQuote\n );\n\n if (!transformedQuoteTemplate) {\n throw new Error('Failed to transform quote template data');\n }\n\n events.emit('quote-management/quote-template-data', {\n quoteTemplate: transformedQuoteTemplate,\n permissions: state.permissions,\n });\n\n return transformedQuoteTemplate;\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_FRAGMENT } from '@/quote-management/api/graphql/NegotiableQuoteFragment';\n\nexport const RENAME_NEGOTIABLE_QUOTE_MUTATION = `\n mutation renameNegotiableQuote($input: RenameNegotiableQuoteInput!) {\n renameNegotiableQuote(input: $input) {\n quote {\n ...NegotiableQuoteFragment\n }\n }\n }\n ${NEGOTIABLE_QUOTE_FRAGMENT}\n`;\n\n","/********************************************************************\n * Copyright 2025 Adobe\n * All Rights Reserved.\n *\n * NOTICE: Adobe permits you to use, modify, and distribute this\n * file in accordance with the terms of the Adobe license agreement\n * accompanying it.\n *******************************************************************/\n\nimport { fetchGraphQl } from '@/quote-management/api';\nimport { events } from '@adobe-commerce/event-bus';\nimport { RENAME_NEGOTIABLE_QUOTE_MUTATION } from './graphql/RenameNegotiableQuoteMutation';\nimport { NegotiableQuoteModel } from '@/quote-management/data/models/negotiable-quote-model';\nimport { transformQuote } from '@/quote-management/data/transforms';\n\nexport interface RenameNegotiableQuoteInput {\n quoteUid: string;\n quoteName: string;\n quoteComment?: string;\n}\n\nexport const renameNegotiableQuote = async (\n input: RenameNegotiableQuoteInput\n): Promise<NegotiableQuoteModel | null> => {\n const { quoteUid, quoteName, quoteComment } = input;\n\n if (!quoteUid) {\n throw new Error('Quote UID is required');\n }\n\n if (!quoteName) {\n throw new Error('Quote name is required');\n }\n\n // Backend requires quote_comment to be present (even if empty string)\n const mutationInput = {\n quote_uid: quoteUid,\n quote_name: quoteName,\n quote_comment: quoteComment || '', // Always include, use empty string if not provided\n };\n\n return fetchGraphQl(RENAME_NEGOTIABLE_QUOTE_MUTATION, {\n variables: {\n input: mutationInput,\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 rename quote: ${errorMessages}`);\n }\n\n // Transform the quote data\n const quoteData = transformQuote(\n response.data?.renameNegotiableQuote?.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/quote-renamed', {\n quote: quoteData,\n input: { quoteUid, quoteName, quoteComment },\n });\n\n return quoteData;\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 DUPLICATE_NEGOTIABLE_QUOTE_MUTATION = `\n mutation DUPLICATE_NEGOTIABLE_QUOTE_MUTATION($quoteUid: ID!, $duplicatedQuoteUid: ID!) {\n duplicateNegotiableQuote(input: { quote_uid: $quoteUid, duplicated_quote_uid: $duplicatedQuoteUid }) {\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 { DUPLICATE_NEGOTIABLE_QUOTE_MUTATION } from './graphql/duplicateNegotiableQuoteMutation';\nimport { NegotiableQuoteModel } from '@/quote-management/data/models/negotiable-quote-model';\nimport { transformQuote } from '@/quote-management/data/transforms';\nimport { state } from '@/quote-management/lib/state';\n\nexport interface DuplicateQuoteInput {\n quoteUid: string;\n duplicatedQuoteUid: string;\n hasOutOfStockItems?: boolean;\n}\n\nexport const duplicateQuote = async (\n input: DuplicateQuoteInput\n): Promise<NegotiableQuoteModel | null> => {\n\n if (!state.authenticated) {\n throw new Error('Unauthorized');\n }\n\n const { quoteUid, duplicatedQuoteUid, hasOutOfStockItems } = input;\n\n if (!quoteUid || !quoteUid.trim()) {\n throw new Error('Quote UID is required');\n }\n\n if (!duplicatedQuoteUid || !duplicatedQuoteUid.trim()) {\n throw new Error('Duplicated Quote UID is required');\n }\n\n return fetchGraphQl(DUPLICATE_NEGOTIABLE_QUOTE_MUTATION, {\n variables: { quoteUid, duplicatedQuoteUid },\n }).then((response) => {\n const { errors } = response;\n\n if (errors) {\n const errorMessages = errors.map((error) => error.message).join('; ');\n throw new Error(`Failed to duplicate quote: ${errorMessages}`);\n }\n\n const quoteData = transformQuote(\n response.data?.duplicateNegotiableQuote?.quote\n );\n\n if (!quoteData) {\n throw new Error(\n 'Failed to transform quote data: Invalid response structure'\n );\n }\n\n events.emit('quote-management/quote-duplicated', {\n quote: quoteData,\n input: { quoteUid, duplicatedQuoteUid },\n hasOutOfStockItems,\n });\n\n return quoteData;\n });\n};\n"],"names":["QUOTE_DATA_QUERY","NEGOTIABLE_QUOTE_FRAGMENT","getQuoteData","quoteId","state","results","fetchGraphQl","transformedQuote","transformQuote","_a","events","error","DELETE_QUOTE_MUTATION","deleteQuote","quoteUids","quoteUidsArray","response","errors","errorMessages","e","raw","transformed","result","err","deletedUids","res","SEND_NEGOTIABLE_QUOTE_FOR_REVIEW_MUTATION","sendForReview","input","quoteUid","comment","attachments","commentInput","quoteData","_b","CLOSE_NEGOTIABLE_QUOTE_MUTATION","closeNegotiableQuote","failures","failureMessages","failure","closedUids","CREATE_QUOTE_TEMPLATE_MUTATION","NEGOTIABLE_QUOTE_TEMPLATE_FRAGMENT","createQuoteTemplate","transformedQuoteTemplate","transformQuoteTemplate","RENAME_NEGOTIABLE_QUOTE_MUTATION","renameNegotiableQuote","quoteName","quoteComment","DUPLICATE_NEGOTIABLE_QUOTE_MUTATION","duplicateQuote","duplicatedQuoteUid","hasOutOfStockItems"],"mappings":"gSAEO,MAAMA,EAAmB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,MAW1BC,CAAyB;AAAA,ECElBC,EAAe,MAAOC,GAAoB,OACnD,GAAI,CAACC,EAAM,cACP,OAAO,QAAQ,OAAO,IAAI,MAAM,cAAc,CAAC,EAGnD,GAAI,CAACA,EAAM,YAAY,UACnB,OAAO,QAAQ,OAAO,IAAI,MAAM,cAAc,CAAC,EAGnD,GAAI,CACA,MAAMC,EAAe,MAAMC,EAAaN,EAAkB,CACtD,UAAW,CACP,QAAAG,CAAA,CACJ,CACH,EAEKI,EAAmBC,GAAeC,EAAAJ,GAAA,YAAAA,EAAS,OAAT,YAAAI,EAAe,eAAe,EAEtE,GAAI,CAACF,EACD,MAAM,IAAI,MAAM,gCAAgC,EAGpD,OAAAG,EAAO,KAAK,8BAA+B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2
2
|
All Rights Reserved. */
|
|
3
|
-
import{a as
|
|
3
|
+
import{a as y}from"./transform-quote.js";var i=(r=>(r.ACTIVE="Active",r.IN_REVIEW="In Review",r.INACTIVE="Inactive",r.SUBMITTED="Submitted",r.PENDING="Pending",r.CLOSED="Closed",r.OPEN="Open",r.UPDATED="Updated",r.EDITED="Edited",r.NEW="New",r.DRAFT="Draft",r.DECLINED="Declined",r.CANCELED="Canceled",r.EXPIRED="Expired",r))(i||{});function v(r){var o,_,s,c,l,t;return r?{id:r.template_id,uid:r.uid,name:r.name,createdAt:r.created_at,updatedAt:r.updated_at,expirationDate:r.expiration_date,status:r.status,salesRepName:r.sales_rep_name,buyer:{firstname:r.buyer.firstname,lastname:r.buyer.lastname},comments:(o=r.comments)==null?void 0:o.map(n=>{var d;return{uid:n.uid,createdAt:n.created_at,author:{firstname:n.author.firstname,lastname:n.author.lastname},text:n.text,attachments:(d=n.attachments)==null?void 0:d.map(a=>({name:a.name,url:a.url}))}}),prices:r.prices&&{subtotalExcludingTax:r.prices.subtotal_excluding_tax&&{value:r.prices.subtotal_excluding_tax.value,currency:r.prices.subtotal_excluding_tax.currency},subtotalIncludingTax:r.prices.subtotal_including_tax&&{value:r.prices.subtotal_including_tax.value,currency:r.prices.subtotal_including_tax.currency},subtotalWithDiscountExcludingTax:r.prices.subtotal_with_discount_excluding_tax&&{value:r.prices.subtotal_with_discount_excluding_tax.value,currency:r.prices.subtotal_with_discount_excluding_tax.currency},appliedTaxes:(_=r.prices.applied_taxes)==null?void 0:_.map(n=>({amount:{value:n.amount.value,currency:n.amount.currency},label:n.label})),grandTotal:r.prices.grand_total&&{value:r.prices.grand_total.value,currency:r.prices.grand_total.currency}},history:(s=r.history)==null?void 0:s.map(n=>({uid:n.uid,createdAt:n.created_at,author:{firstname:n.author.firstname,lastname:n.author.lastname},changeType:n.change_type,changes:n.changes})),items:((c=r.items)==null?void 0:c.map(n=>{var d,a,g,p,E,f;return{uid:n.uid,product:{uid:n.product.uid,sku:n.product.sku,name:n.product.name},quantity:n.quantity,prices:{originalItemPrice:{value:n.prices.original_item_price.value,currency:n.prices.original_item_price.currency},rowTotal:{value:n.prices.row_total.value,currency:n.prices.row_total.currency}},catalogDiscount:n.prices.catalog_discount&&{amountOff:n.prices.catalog_discount.amount_off,percentOff:n.prices.catalog_discount.percent_off},discounts:(a=(d=n.prices)==null?void 0:d.discounts)==null?void 0:a.map(e=>({label:e.label,value:e.value,amount:{value:e.amount.value,currency:e.amount.currency}})),noteFromBuyer:(g=n.note_from_buyer)==null?void 0:g.map(e=>({createdAt:e.created_at,creatorId:e.creator_id,creatorType:e.creator_type,negotiableQuoteItemUid:e.negotiable_quote_template_item_uid,note:e.note,noteUid:e.note_uid})),noteFromSeller:(p=n.note_from_seller)==null?void 0:p.map(e=>({createdAt:e.created_at,creatorId:e.creator_id,creatorType:e.creator_type,negotiableQuoteItemUid:e.negotiable_quote_template_item_uid,note:e.note,noteUid:e.note_uid})),configurableOptions:(E=n.configurable_options)==null?void 0:E.map(e=>({optionLabel:e.option_label,valueLabel:e.value_label})),bundleOptions:(f=n.bundle_options)==null?void 0:f.map(e=>({label:e.label,values:e.values.map(u=>({label:u.label,quantity:u.quantity,originalPrice:{value:u.original_price.value,currency:u.original_price.currency},price:{value:u.priceV2.value,currency:u.priceV2.currency}}))}))}}))||[],shippingAddresses:(l=r.shipping_addresses)==null?void 0:l.map(n=>({uid:n.uid,firstname:n.firstname,lastname:n.lastname,company:n.company,street:n.street,city:n.city,postcode:n.postcode,country:{code:n.country.code,label:n.country.label},telephone:n.telephone,region:n.region?{code:n.region.code,label:n.region.label,regionId:n.region.region_id}:void 0})),referenceDocuments:(t=r.reference_document_links)==null?void 0:t.map(n=>({uid:n.link_id,name:n.document_name,identifier:n.document_identifier,url:n.reference_document_url})),canAccept:[i.SUBMITTED,i.PENDING,i.OPEN].includes(r.status),canDelete:r.status===i.DRAFT,canReopen:[i.DECLINED,i.CANCELED,i.EXPIRED].includes(r.status),canCancel:[i.SUBMITTED,i.PENDING,i.OPEN,i.ACTIVE,i.EDITED].includes(r.status),canSendForReview:[i.OPEN,i.DRAFT,i.NEW,i.EDITED].includes(r.status),canGenerateQuoteFromTemplate:[i.ACTIVE].includes(r.status),canEditTemplateItems:[i.SUBMITTED,i.DRAFT,i.OPEN,i.EDITED].includes(r.status)}:null}function b(r){var s;if(!r)return null;const o={items:((s=r.items)==null?void 0:s.map(c=>({id:c.template_id,uid:"TBD",name:c.name,createdAt:"0000-00-00 00:00:00",updatedAt:"0000-00-00 00:00:00",status:c.status,state:c.state,prices:{grandTotal:{value:0,currency:"USD"},minNegotiatedGrandTotal:{value:c.min_negotiated_grand_total,currency:"USD"}},lastSharedAt:c.last_shared_at,lastOrderedAt:"0000-00-00 00:00:00",expirationDate:"0000-00-00 00:00:00",ordersPlaced:c.orders_placed,canGenerateQuoteFromTemplate:[i.ACTIVE].includes(c.status)})))||[],pageInfo:{currentPage:r.page_info.current_page,pageSize:r.page_info.page_size,totalPages:r.page_info.total_pages},totalCount:r.total_count,sortFields:r.sort_fields?{default:r.sort_fields.default,options:r.sort_fields.options}:void 0},_=y(o);return{...o,paginationInfo:_||void 0}}export{i as N,v as a,b as t};
|
|
4
4
|
//# sourceMappingURL=transform-quote-template.js.map
|