@dropins/storefront-quote-management 0.0.1-alpha16 → 0.0.1-alpha18

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (59) hide show
  1. package/api/deleteQuote/deleteQuote.d.ts +28 -0
  2. package/api/deleteQuote/graphql/DeleteQuoteMutation.d.ts +10 -0
  3. package/api/deleteQuote/index.d.ts +10 -0
  4. package/api/graphql/NegotiableQuoteAddressFragment.d.ts +10 -0
  5. package/api/graphql/NegotiableQuoteFragment.d.ts +1 -1
  6. package/api/graphql/ShippingMethodFragment.d.ts +10 -0
  7. package/api/index.d.ts +1 -0
  8. package/api.js +6 -6
  9. package/api.js.map +1 -1
  10. package/chunks/NegotiableQuoteFragment.js +74 -26
  11. package/chunks/NegotiableQuoteFragment.js.map +1 -1
  12. package/chunks/OrderSummaryLine.js +4 -0
  13. package/chunks/OrderSummaryLine.js.map +1 -0
  14. package/chunks/WarningFilled.js +1 -1
  15. package/chunks/WarningFilled.js.map +1 -1
  16. package/chunks/fetch-graphql.js +4 -0
  17. package/chunks/fetch-graphql.js.map +1 -0
  18. package/chunks/negotiableQuotes.js +2 -2
  19. package/chunks/negotiableQuotes.js.map +1 -1
  20. package/chunks/sendForReview.js +35 -3
  21. package/chunks/sendForReview.js.map +1 -1
  22. package/chunks/state.js +4 -0
  23. package/chunks/state.js.map +1 -0
  24. package/chunks/uploadFile.js +5 -5
  25. package/chunks/uploadFile.js.map +1 -1
  26. package/components/ConfirmationModal/ConfirmationModal.d.ts +16 -0
  27. package/components/ConfirmationModal/index.d.ts +11 -0
  28. package/components/OrderSummary/OrderSummary.d.ts +7 -26
  29. package/components/index.d.ts +1 -0
  30. package/containers/ManageNegotiableQuote.js +1 -1
  31. package/containers/ManageNegotiableQuote.js.map +1 -1
  32. package/containers/OrderSummary/OrderSummary.d.ts +11 -0
  33. package/containers/OrderSummary/index.d.ts +11 -0
  34. package/containers/OrderSummary.d.ts +3 -0
  35. package/containers/OrderSummary.js +4 -0
  36. package/containers/OrderSummary.js.map +1 -0
  37. package/containers/OrderSummaryLine/OrderSummaryLine.d.ts +14 -0
  38. package/containers/OrderSummaryLine/index.d.ts +11 -0
  39. package/containers/OrderSummaryLine.d.ts +3 -0
  40. package/containers/OrderSummaryLine.js +4 -0
  41. package/containers/OrderSummaryLine.js.map +1 -0
  42. package/containers/QuotesListTable.js +1 -1
  43. package/containers/QuotesListTable.js.map +1 -1
  44. package/containers/RequestNegotiableQuoteForm.js +1 -1
  45. package/containers/RequestNegotiableQuoteForm.js.map +1 -1
  46. package/containers/index.d.ts +14 -4
  47. package/data/models/index.d.ts +9 -0
  48. package/data/models/negotiable-quote-model.d.ts +30 -5
  49. package/data/models/store-config-model.d.ts +24 -0
  50. package/data/transforms/__fixtures__/negotiableQuoteData.d.ts +55 -0
  51. package/data/transforms/transform-quote.d.ts +8 -0
  52. package/i18n/en_US.json.d.ts +28 -0
  53. package/lib/state.d.ts +2 -0
  54. package/package.json +1 -1
  55. package/render.js +2 -2
  56. package/render.js.map +1 -1
  57. package/types/state.types.d.ts +3 -0
  58. package/chunks/transform-quote.js +0 -4
  59. package/chunks/transform-quote.js.map +0 -1
@@ -1,6 +1,6 @@
1
1
  /*! Copyright 2025 Adobe
2
2
  All Rights Reserved. */
3
- import{fetchGraphQl as n}from"@dropins/tools/fetch-graphql.js";import{s,a as i}from"./transform-quote.js";const u=`
3
+ import{f as n,a as s}from"./fetch-graphql.js";import{s as i}from"./state.js";import"@dropins/tools/event-bus.js";const u=`
4
4
  fragment NegotiableQuoteListFragment on NegotiableQuote {
5
5
  uid
6
6
  name
@@ -73,5 +73,5 @@ import{fetchGraphQl as n}from"@dropins/tools/fetch-graphql.js";import{s,a as i}f
73
73
  ${u}
74
74
  ${g}
75
75
  ${l}
76
- `;var _=(e=>(e.FULL="FULL",e.PARTIAL="PARTIAL",e))(_||{}),E=(e=>(e.ASC="ASC",e.DESC="DESC",e))(E||{}),f=(e=>(e.QUOTE_NAME="QUOTE_NAME",e.CREATED_AT="CREATED_AT",e.UPDATED_AT="UPDATED_AT",e))(f||{});const S=async(e={})=>{var r;if(!s.authenticated)return Promise.reject(new Error("Unauthorized"));const o={filter:e.filter||null,pageSize:e.pageSize||20,currentPage:e.currentPage||1,sort:e.sort||null};try{const t=await n(c,{variables:o});if(!((r=t==null?void 0:t.data)!=null&&r.negotiableQuotes))throw new Error("No quotes data received");const a=i(t.data.negotiableQuotes);if(!a)throw new Error("Failed to transform quotes data");return a}catch(t){return Promise.reject(t)}};export{_ as F,f as N,E as S,S as n};
76
+ `;var _=(e=>(e.FULL="FULL",e.PARTIAL="PARTIAL",e))(_||{}),E=(e=>(e.ASC="ASC",e.DESC="DESC",e))(E||{}),f=(e=>(e.QUOTE_NAME="QUOTE_NAME",e.CREATED_AT="CREATED_AT",e.UPDATED_AT="UPDATED_AT",e))(f||{});const S=async(e={})=>{var r;if(!i.authenticated)return Promise.reject(new Error("Unauthorized"));const o={filter:e.filter||null,pageSize:e.pageSize||20,currentPage:e.currentPage||1,sort:e.sort||null};try{const t=await n(c,{variables:o});if(!((r=t==null?void 0:t.data)!=null&&r.negotiableQuotes))throw new Error("No quotes data received");const a=s(t.data.negotiableQuotes);if(!a)throw new Error("Failed to transform quotes data");return a}catch(t){return Promise.reject(t)}};export{_ as F,f as N,E as S,S as n};
77
77
  //# sourceMappingURL=negotiableQuotes.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"negotiableQuotes.js","sources":["/@dropins/storefront-quote-management/src/api/graphql/NegotiableQuoteListFragment.ts","/@dropins/storefront-quote-management/src/api/graphql/SearchResultPageInfoFragment.ts","/@dropins/storefront-quote-management/src/api/graphql/SortFieldsFragment.ts","/@dropins/storefront-quote-management/src/api/negotiableQuotes/graphql/NegotiableQuotesQuery.ts","/@dropins/storefront-quote-management/src/api/negotiableQuotes/negotiableQuotes.ts"],"sourcesContent":["/********************************************************************\n * Copyright 2025 Adobe\n * All Rights Reserved.\n *\n * NOTICE: Adobe permits you to use, modify, and distribute this\n * file in accordance with the terms of the Adobe license agreement\n * accompanying it.\n *******************************************************************/\n\nexport const NEGOTIABLE_QUOTE_LIST_FRAGMENT = /* GraphQL */ `\n fragment NegotiableQuoteListFragment on NegotiableQuote {\n uid\n name\n created_at\n updated_at\n status\n buyer {\n firstname\n lastname\n }\n template_name\n prices {\n grand_total {\n value\n currency\n }\n }\n history {\n change_type\n changes {\n statuses {\n changes {\n new_status\n old_status\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\nexport const SEARCH_RESULT_PAGE_INFO_FRAGMENT = /* GraphQL */ `\n fragment SearchResultPageInfoFragment on SearchResultPageInfo {\n current_page\n page_size\n total_pages\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 SORT_FIELDS_FRAGMENT = /* GraphQL */ `\n fragment SortFieldsFragment on SortFields {\n default\n options {\n label\n value\n }\n }\n`;\n","/********************************************************************\n * Copyright 2025 Adobe\n * All Rights Reserved.\n *\n * NOTICE: Adobe permits you to use, modify, and distribute this\n * file in accordance with the terms of the Adobe license agreement\n * accompanying it.\n *******************************************************************/\n\nimport { NEGOTIABLE_QUOTE_LIST_FRAGMENT } from '@/quote-management/api/graphql/NegotiableQuoteListFragment';\nimport { SEARCH_RESULT_PAGE_INFO_FRAGMENT } from '@/quote-management/api/graphql/SearchResultPageInfoFragment';\nimport { SORT_FIELDS_FRAGMENT } from '@/quote-management/api/graphql/SortFieldsFragment';\n\nexport const NEGOTIABLE_QUOTES_QUERY = /* GraphQL */ `\n query negotiableQuotes(\n $filter: NegotiableQuoteFilterInput\n $pageSize: Int\n $currentPage: Int\n $sort: NegotiableQuoteSortInput\n ) {\n negotiableQuotes(\n filter: $filter\n pageSize: $pageSize\n currentPage: $currentPage\n sort: $sort\n ) {\n items {\n ...NegotiableQuoteListFragment\n }\n page_info {\n ...SearchResultPageInfoFragment\n }\n sort_fields {\n ...SortFieldsFragment\n }\n total_count\n }\n }\n\n ${NEGOTIABLE_QUOTE_LIST_FRAGMENT}\n ${SEARCH_RESULT_PAGE_INFO_FRAGMENT}\n ${SORT_FIELDS_FRAGMENT}\n`;\n","/********************************************************************\n * Copyright 2025 Adobe\n * All Rights Reserved.\n *\n * NOTICE: Adobe permits you to use, modify, and distribute this\n * file in accordance with the terms of the Adobe license agreement\n * accompanying it.\n *******************************************************************/\n\nimport { fetchGraphQl } from '@adobe-commerce/fetch-graphql';\nimport { NEGOTIABLE_QUOTES_QUERY } from './graphql/NegotiableQuotesQuery';\nimport { transformNegotiableQuotesList } from '@/quote-management/data/transforms';\nimport { NegotiableQuotesListModel } from '@/quote-management/data/models/negotiable-quote-model';\nimport { state } from '@/quote-management/lib/state';\n\nexport enum FilterMatchTypeEnum {\n FULL = 'FULL',\n PARTIAL = 'PARTIAL',\n}\n\nexport interface FilterEqualTypeInput {\n eq?: string;\n in?: string[];\n}\n\nexport interface FilterMatchTypeInput {\n match?: string;\n match_type?: FilterMatchTypeEnum;\n}\n\nexport interface NegotiableQuoteFilterInput {\n ids?: FilterEqualTypeInput;\n name?: FilterMatchTypeInput;\n}\n\nexport enum SortEnum {\n ASC = 'ASC',\n DESC = 'DESC',\n}\n\nexport enum NegotiableQuoteSortableField {\n QUOTE_NAME = 'QUOTE_NAME',\n CREATED_AT = 'CREATED_AT',\n UPDATED_AT = 'UPDATED_AT',\n}\n\nexport interface NegotiableQuoteSortInput {\n sort_direction: SortEnum;\n sort_field: NegotiableQuoteSortableField;\n}\n\nexport interface NegotiableQuotesParams {\n filter?: NegotiableQuoteFilterInput;\n pageSize?: number;\n currentPage?: number;\n sort?: NegotiableQuoteSortInput;\n}\n\nexport const negotiableQuotes = async (\n params: NegotiableQuotesParams = {}\n): Promise<NegotiableQuotesListModel> => {\n if (!state.authenticated) {\n return Promise.reject(new Error('Unauthorized'));\n }\n\n const variables = {\n filter: params.filter || null,\n pageSize: params.pageSize || 20,\n currentPage: params.currentPage || 1,\n sort: params.sort || null,\n };\n\n try {\n const results: any = await fetchGraphQl(NEGOTIABLE_QUOTES_QUERY, {\n variables,\n });\n\n if (!results?.data?.negotiableQuotes) {\n throw new Error('No quotes data received');\n }\n\n const transformedData = transformNegotiableQuotesList(\n results.data.negotiableQuotes\n );\n\n if (!transformedData) {\n throw new Error('Failed to transform quotes data');\n }\n\n return transformedData;\n } catch (error) {\n return Promise.reject(error);\n }\n};\n"],"names":["NEGOTIABLE_QUOTE_LIST_FRAGMENT","SEARCH_RESULT_PAGE_INFO_FRAGMENT","SORT_FIELDS_FRAGMENT","NEGOTIABLE_QUOTES_QUERY","FilterMatchTypeEnum","SortEnum","NegotiableQuoteSortableField","negotiableQuotes","params","state","variables","results","fetchGraphQl","_a","transformedData","transformNegotiableQuotesList","error"],"mappings":"0GASO,MAAMA,EAA+C;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,ECA/CC,EAAiD;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,ECAjDC,EAAqC;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,ECIrCC,EAAwC;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,IA0BjDH,CAA8B;AAAA,IAC9BC,CAAgC;AAAA,IAChCC,CAAoB;AAAA,EC1BjB,IAAKE,GAAAA,IACVA,EAAA,KAAO,OACPA,EAAA,QAAU,UAFAA,IAAAA,GAAA,CAAA,CAAA,EAoBAC,GAAAA,IACVA,EAAA,IAAM,MACNA,EAAA,KAAO,OAFGA,IAAAA,GAAA,CAAA,CAAA,EAKAC,GAAAA,IACVA,EAAA,WAAa,aACbA,EAAA,WAAa,aACbA,EAAA,WAAa,aAHHA,IAAAA,GAAA,CAAA,CAAA,EAkBL,MAAMC,EAAmB,MAC9BC,EAAiC,KACM,OACvC,GAAI,CAACC,EAAM,cACT,OAAO,QAAQ,OAAO,IAAI,MAAM,cAAc,CAAC,EAGjD,MAAMC,EAAY,CAChB,OAAQF,EAAO,QAAU,KACzB,SAAUA,EAAO,UAAY,GAC7B,YAAaA,EAAO,aAAe,EACnC,KAAMA,EAAO,MAAQ,IAAA,EAGvB,GAAI,CACF,MAAMG,EAAe,MAAMC,EAAaT,EAAyB,CAC/D,UAAAO,CAAA,CACD,EAED,GAAI,GAACG,EAAAF,GAAA,YAAAA,EAAS,OAAT,MAAAE,EAAe,kBAClB,MAAM,IAAI,MAAM,yBAAyB,EAG3C,MAAMC,EAAkBC,EACtBJ,EAAQ,KAAK,gBAAA,EAGf,GAAI,CAACG,EACH,MAAM,IAAI,MAAM,iCAAiC,EAGnD,OAAOA,CACT,OAASE,EAAO,CACd,OAAO,QAAQ,OAAOA,CAAK,CAC7B,CACF"}
1
+ {"version":3,"file":"negotiableQuotes.js","sources":["/@dropins/storefront-quote-management/src/api/graphql/NegotiableQuoteListFragment.ts","/@dropins/storefront-quote-management/src/api/graphql/SearchResultPageInfoFragment.ts","/@dropins/storefront-quote-management/src/api/graphql/SortFieldsFragment.ts","/@dropins/storefront-quote-management/src/api/negotiableQuotes/graphql/NegotiableQuotesQuery.ts","/@dropins/storefront-quote-management/src/api/negotiableQuotes/negotiableQuotes.ts"],"sourcesContent":["/********************************************************************\n * Copyright 2025 Adobe\n * All Rights Reserved.\n *\n * NOTICE: Adobe permits you to use, modify, and distribute this\n * file in accordance with the terms of the Adobe license agreement\n * accompanying it.\n *******************************************************************/\n\nexport const NEGOTIABLE_QUOTE_LIST_FRAGMENT = /* GraphQL */ `\n fragment NegotiableQuoteListFragment on NegotiableQuote {\n uid\n name\n created_at\n updated_at\n status\n buyer {\n firstname\n lastname\n }\n template_name\n prices {\n grand_total {\n value\n currency\n }\n }\n history {\n change_type\n changes {\n statuses {\n changes {\n new_status\n old_status\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\nexport const SEARCH_RESULT_PAGE_INFO_FRAGMENT = /* GraphQL */ `\n fragment SearchResultPageInfoFragment on SearchResultPageInfo {\n current_page\n page_size\n total_pages\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 SORT_FIELDS_FRAGMENT = /* GraphQL */ `\n fragment SortFieldsFragment on SortFields {\n default\n options {\n label\n value\n }\n }\n`;\n","/********************************************************************\n * Copyright 2025 Adobe\n * All Rights Reserved.\n *\n * NOTICE: Adobe permits you to use, modify, and distribute this\n * file in accordance with the terms of the Adobe license agreement\n * accompanying it.\n *******************************************************************/\n\nimport { NEGOTIABLE_QUOTE_LIST_FRAGMENT } from '@/quote-management/api/graphql/NegotiableQuoteListFragment';\nimport { SEARCH_RESULT_PAGE_INFO_FRAGMENT } from '@/quote-management/api/graphql/SearchResultPageInfoFragment';\nimport { SORT_FIELDS_FRAGMENT } from '@/quote-management/api/graphql/SortFieldsFragment';\n\nexport const NEGOTIABLE_QUOTES_QUERY = /* GraphQL */ `\n query negotiableQuotes(\n $filter: NegotiableQuoteFilterInput\n $pageSize: Int\n $currentPage: Int\n $sort: NegotiableQuoteSortInput\n ) {\n negotiableQuotes(\n filter: $filter\n pageSize: $pageSize\n currentPage: $currentPage\n sort: $sort\n ) {\n items {\n ...NegotiableQuoteListFragment\n }\n page_info {\n ...SearchResultPageInfoFragment\n }\n sort_fields {\n ...SortFieldsFragment\n }\n total_count\n }\n }\n\n ${NEGOTIABLE_QUOTE_LIST_FRAGMENT}\n ${SEARCH_RESULT_PAGE_INFO_FRAGMENT}\n ${SORT_FIELDS_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 { NEGOTIABLE_QUOTES_QUERY } from './graphql/NegotiableQuotesQuery';\nimport { transformNegotiableQuotesList } from '@/quote-management/data/transforms';\nimport { NegotiableQuotesListModel } from '@/quote-management/data/models/negotiable-quote-model';\nimport { state } from '@/quote-management/lib/state';\n\nexport enum FilterMatchTypeEnum {\n FULL = 'FULL',\n PARTIAL = 'PARTIAL',\n}\n\nexport interface FilterEqualTypeInput {\n eq?: string;\n in?: string[];\n}\n\nexport interface FilterMatchTypeInput {\n match?: string;\n match_type?: FilterMatchTypeEnum;\n}\n\nexport interface NegotiableQuoteFilterInput {\n ids?: FilterEqualTypeInput;\n name?: FilterMatchTypeInput;\n}\n\nexport enum SortEnum {\n ASC = 'ASC',\n DESC = 'DESC',\n}\n\nexport enum NegotiableQuoteSortableField {\n QUOTE_NAME = 'QUOTE_NAME',\n CREATED_AT = 'CREATED_AT',\n UPDATED_AT = 'UPDATED_AT',\n}\n\nexport interface NegotiableQuoteSortInput {\n sort_direction: SortEnum;\n sort_field: NegotiableQuoteSortableField;\n}\n\nexport interface NegotiableQuotesParams {\n filter?: NegotiableQuoteFilterInput;\n pageSize?: number;\n currentPage?: number;\n sort?: NegotiableQuoteSortInput;\n}\n\nexport const negotiableQuotes = async (\n params: NegotiableQuotesParams = {}\n): Promise<NegotiableQuotesListModel> => {\n if (!state.authenticated) {\n return Promise.reject(new Error('Unauthorized'));\n }\n\n const variables = {\n filter: params.filter || null,\n pageSize: params.pageSize || 20,\n currentPage: params.currentPage || 1,\n sort: params.sort || null,\n };\n\n try {\n const results: any = await fetchGraphQl(NEGOTIABLE_QUOTES_QUERY, {\n variables,\n });\n\n if (!results?.data?.negotiableQuotes) {\n throw new Error('No quotes data received');\n }\n\n const transformedData = transformNegotiableQuotesList(\n results.data.negotiableQuotes\n );\n\n if (!transformedData) {\n throw new Error('Failed to transform quotes data');\n }\n\n return transformedData;\n } catch (error) {\n return Promise.reject(error);\n }\n};\n"],"names":["NEGOTIABLE_QUOTE_LIST_FRAGMENT","SEARCH_RESULT_PAGE_INFO_FRAGMENT","SORT_FIELDS_FRAGMENT","NEGOTIABLE_QUOTES_QUERY","FilterMatchTypeEnum","SortEnum","NegotiableQuoteSortableField","negotiableQuotes","params","state","variables","results","fetchGraphQl","_a","transformedData","transformNegotiableQuotesList","error"],"mappings":"iHASO,MAAMA,EAA+C;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,ECA/CC,EAAiD;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,ECAjDC,EAAqC;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,ECIrCC,EAAwC;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,IA0BjDH,CAA8B;AAAA,IAC9BC,CAAgC;AAAA,IAChCC,CAAoB;AAAA,EC1BjB,IAAKE,GAAAA,IACVA,EAAA,KAAO,OACPA,EAAA,QAAU,UAFAA,IAAAA,GAAA,CAAA,CAAA,EAoBAC,GAAAA,IACVA,EAAA,IAAM,MACNA,EAAA,KAAO,OAFGA,IAAAA,GAAA,CAAA,CAAA,EAKAC,GAAAA,IACVA,EAAA,WAAa,aACbA,EAAA,WAAa,aACbA,EAAA,WAAa,aAHHA,IAAAA,GAAA,CAAA,CAAA,EAkBL,MAAMC,EAAmB,MAC9BC,EAAiC,KACM,OACvC,GAAI,CAACC,EAAM,cACT,OAAO,QAAQ,OAAO,IAAI,MAAM,cAAc,CAAC,EAGjD,MAAMC,EAAY,CAChB,OAAQF,EAAO,QAAU,KACzB,SAAUA,EAAO,UAAY,GAC7B,YAAaA,EAAO,aAAe,EACnC,KAAMA,EAAO,MAAQ,IAAA,EAGvB,GAAI,CACF,MAAMG,EAAe,MAAMC,EAAaT,EAAyB,CAC/D,UAAAO,CAAA,CACD,EAED,GAAI,GAACG,EAAAF,GAAA,YAAAA,EAAS,OAAT,MAAAE,EAAe,kBAClB,MAAM,IAAI,MAAM,yBAAyB,EAG3C,MAAMC,EAAkBC,EACtBJ,EAAQ,KAAK,gBAAA,EAGf,GAAI,CAACG,EACH,MAAM,IAAI,MAAM,iCAAiC,EAGnD,OAAOA,CACT,OAASE,EAAO,CACd,OAAO,QAAQ,OAAOA,CAAK,CAC7B,CACF"}
@@ -1,6 +1,38 @@
1
1
  /*! Copyright 2025 Adobe
2
2
  All Rights Reserved. */
3
- import{fetchGraphQl as E}from"@dropins/tools/fetch-graphql.js";import{events as c}from"@dropins/tools/event-bus.js";import{N as d}from"./NegotiableQuoteFragment.js";import{t as q}from"./transform-quote.js";const I=`
3
+ import{s as p}from"./state.js";import{events as c}from"@dropins/tools/event-bus.js";import{f as l,t as E}from"./fetch-graphql.js";import{N as g}from"./NegotiableQuoteFragment.js";const q=`
4
+ mutation DELETE_QUOTE_MUTATION($quoteUids: [ID!]!) {
5
+ deleteNegotiableQuotes(
6
+ input: {
7
+ quote_uids: $quoteUids
8
+ }
9
+ ) {
10
+ result_status
11
+ operation_results {
12
+ __typename
13
+ ... on NegotiableQuoteUidOperationSuccess {
14
+ quote_uid
15
+ }
16
+ ... on DeleteNegotiableQuoteOperationFailure {
17
+ quote_uid
18
+ errors {
19
+ __typename
20
+ ... on ErrorInterface {
21
+ message
22
+ }
23
+ ... on NoSuchEntityUidError {
24
+ uid
25
+ message
26
+ }
27
+ ... on NegotiableQuoteInvalidStateError {
28
+ message
29
+ }
30
+ }
31
+ }
32
+ }
33
+ }
34
+ }
35
+ `,w=async m=>{var r;if(!p.authenticated)return Promise.reject(new Error("Unauthorized"));const n=Array.isArray(m)?m:[m];try{const t=await l(q,{variables:{quoteUids:n}}),{errors:i}=t||{};if(i&&i.length){const e=i.map(u=>u==null?void 0:u.message).filter(Boolean).join("; ");throw new Error(e||"Failed to delete negotiable quotes")}const s=(r=t==null?void 0:t.data)==null?void 0:r.deleteNegotiableQuotes;if(!s)throw new Error("No delete result returned");const a={resultStatus:s.result_status,operationResults:(s.operation_results||[]).map(e=>(e==null?void 0:e.__typename)==="NegotiableQuoteUidOperationSuccess"?{__typename:"NegotiableQuoteUidOperationSuccess",quoteUid:e==null?void 0:e.quote_uid}:{__typename:"DeleteNegotiableQuoteOperationFailure",quoteUid:e==null?void 0:e.quote_uid,errors:((e==null?void 0:e.errors)||[]).map(o=>({__typename:o==null?void 0:o.__typename,message:o==null?void 0:o.message,uid:o==null?void 0:o.uid}))})},d=a.operationResults.filter(e=>e.__typename==="NegotiableQuoteUidOperationSuccess").map(e=>e.quoteUid);return d.length>0&&c.emit("quote-management/negotiable-quote-deleted",{deletedQuoteUids:d,resultStatus:a.resultStatus}),a}catch(t){return c.emit("quote-management/negotiable-quote-delete-error",{error:t instanceof Error?t:new Error(String(t)),attemptedQuoteUids:n}),Promise.reject(t)}},U=`
4
36
  mutation SEND_NEGOTIABLE_QUOTE_FOR_REVIEW_MUTATION(
5
37
  $quoteUid: ID!
6
38
  $comment: NegotiableQuoteCommentInput
@@ -16,6 +48,6 @@ import{fetchGraphQl as E}from"@dropins/tools/fetch-graphql.js";import{events as
16
48
  }
17
49
  }
18
50
  }
19
- ${d}
20
- `,w=async u=>{const{quoteUid:e,comment:t}=u;if(!e)throw new Error("Quote UID is required");return E(I,{variables:{quoteUid:e,comment:t?{comment:t}:null}}).then(r=>{var m,i;const{errors:n}=r;if(n){const a=n.map(s=>s.message).join("; ");throw new Error(`Failed to send quote for review: ${a}`)}const o=q((i=(m=r.data)==null?void 0:m.sendNegotiableQuoteForReview)==null?void 0:i.quote);if(!o)throw new Error("Failed to transform quote data: Invalid response structure");return c.emit("quote-management/quote-sent-for-review",{quote:o,input:{quoteUid:e,comment:t}}),o})};export{w as s};
51
+ ${g}
52
+ `,T=async m=>{const{quoteUid:n,comment:r}=m;if(!n)throw new Error("Quote UID is required");return l(U,{variables:{quoteUid:n,comment:r?{comment:r}:null}}).then(i=>{var d,e;const{errors:s}=i;if(s){const u=s.map(_=>_.message).join("; ");throw new Error(`Failed to send quote for review: ${u}`)}const a=E((e=(d=i.data)==null?void 0:d.sendNegotiableQuoteForReview)==null?void 0:e.quote);if(!a)throw new Error("Failed to transform quote data: Invalid response structure");return c.emit("quote-management/quote-sent-for-review",{quote:a,input:{quoteUid:n,comment:r}}),a})};export{w as d,T as s};
21
53
  //# sourceMappingURL=sendForReview.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"sendForReview.js","sources":["/@dropins/storefront-quote-management/src/api/sendForReview/graphql/SendNegotiableQuoteForReviewMutation.ts","/@dropins/storefront-quote-management/src/api/sendForReview/sendForReview.ts"],"sourcesContent":["/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2024 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\n\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","/********************************************************************\n * Copyright 2025 Adobe\n * All Rights Reserved.\n *\n * NOTICE: Adobe permits you to use, modify, and distribute this\n * file in accordance with the terms of the Adobe license agreement\n * accompanying it.\n *******************************************************************/\n\nimport { fetchGraphQl } from '@adobe-commerce/fetch-graphql';\nimport { events } from '@adobe-commerce/event-bus';\nimport { 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}\n\nexport const sendForReview = async (\n input: SendForReviewInput\n): Promise<NegotiableQuoteModel | null> => {\n const { quoteUid, comment } = input;\n\n if (!quoteUid) {\n throw new Error('Quote UID is required');\n }\n\n // Build the comment object only if a comment is provided\n const commentInput = comment ? { comment } : 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 },\n });\n\n return quoteData;\n });\n};\n\n"],"names":["SEND_NEGOTIABLE_QUOTE_FOR_REVIEW_MUTATION","NEGOTIABLE_QUOTE_FRAGMENT","sendForReview","input","quoteUid","comment","fetchGraphQl","response","errors","errorMessages","error","quoteData","transformQuote","_b","_a","events"],"mappings":"8MAmBO,MAAMA,EAA4C;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,IAgBrDC,CAAyB;AAAA,ECfhBC,EAAgB,MAC3BC,GACyC,CACzC,KAAM,CAAE,SAAAC,EAAU,QAAAC,CAAA,EAAYF,EAE9B,GAAI,CAACC,EACH,MAAM,IAAI,MAAM,uBAAuB,EAMzC,OAAOE,EAAaN,EAA2C,CAC7D,UAAW,CACT,SAAAI,EACA,QALiBC,EAAU,CAAE,QAAAA,CAAA,EAAY,IAKhC,CACX,CACD,EAAE,KAAME,GAAa,SACpB,KAAM,CAAE,OAAAC,GAAWD,EAEnB,GAAIC,EAAQ,CAEV,MAAMC,EAAgBD,EAAO,IAAKE,GAAUA,EAAM,OAAO,EAAE,KAAK,IAAI,EACpE,MAAM,IAAI,MAAM,oCAAoCD,CAAa,EAAE,CACrE,CAGA,MAAME,EAAYC,GAChBC,GAAAC,EAAAP,EAAS,OAAT,YAAAO,EAAe,+BAAf,YAAAD,EAA6C,KAAA,EAG/C,GAAI,CAACF,EACH,MAAM,IAAI,MACR,4DAAA,EAKJ,OAAAI,EAAO,KAAK,yCAA0C,CACpD,MAAOJ,EACP,MAAO,CAAE,SAAAP,EAAU,QAAAC,CAAA,CAAQ,CAC5B,EAEMM,CACT,CAAC,CACH"}
1
+ {"version":3,"file":"sendForReview.js","sources":["/@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"],"sourcesContent":["/********************************************************************\n * Copyright 2025 Adobe\n * All Rights Reserved.\n *\n * NOTICE: Adobe permits you to use, modify, and distribute this \n * file in accordance with the terms of the Adobe license agreement \n * accompanying it. \n *******************************************************************/\n\nexport const 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 * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2024 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\n\nimport { NEGOTIABLE_QUOTE_FRAGMENT } from '@/quote-management/api/graphql/NegotiableQuoteFragment';\n\nexport const 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","/********************************************************************\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}\n\nexport const sendForReview = async (\n input: SendForReviewInput\n): Promise<NegotiableQuoteModel | null> => {\n const { quoteUid, comment } = input;\n\n if (!quoteUid) {\n throw new Error('Quote UID is required');\n }\n\n // Build the comment object only if a comment is provided\n const commentInput = comment ? { comment } : 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 },\n });\n\n return quoteData;\n });\n};\n\n"],"names":["DELETE_QUOTE_MUTATION","deleteQuote","quoteUids","state","quoteUidsArray","response","fetchGraphQl","errors","errorMessages","e","raw","_a","transformed","result","err","deletedUids","res","events","error","SEND_NEGOTIABLE_QUOTE_FOR_REVIEW_MUTATION","NEGOTIABLE_QUOTE_FRAGMENT","sendForReview","input","quoteUid","comment","quoteData","transformQuote","_b"],"mappings":"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"}
@@ -0,0 +1,4 @@
1
+ /*! Copyright 2025 Adobe
2
+ All Rights Reserved. */
3
+ var t=(e=>(e[e.TAX_INCLUDED=1]="TAX_INCLUDED",e[e.TAX_EXCLUDED=2]="TAX_EXCLUDED",e[e.TAX_INCLUDED_AND_EXCLUDED=3]="TAX_INCLUDED_AND_EXCLUDED",e))(t||{});const E={requestQuote:!1,editQuote:!1,deleteQuote:!1,checkoutQuote:!1},r={quoteDisplaySettings:{zeroTax:!1,subtotal:t.TAX_INCLUDED,price:t.TAX_INCLUDED,shipping:t.TAX_INCLUDED,fullSummary:!1,grandTotal:!0}},a={authenticated:!1,permissions:E,config:r},_=new Proxy(a,{get:(e,D)=>e[D],set:(e,D,s)=>(e[D]=s,!0)});export{E as D,t as Q,_ as s};
4
+ //# sourceMappingURL=state.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"state.js","sources":["/@dropins/storefront-quote-management/src/data/models/store-config-model.ts","/@dropins/storefront-quote-management/src/lib/state.ts"],"sourcesContent":["/********************************************************************\n * Copyright 2025 Adobe\n * All Rights Reserved.\n *\n * NOTICE: Adobe permits you to use, modify, and distribute this\n * file in accordance with the terms of the Adobe license agreement\n * accompanying it.\n *******************************************************************/\n\nexport enum QuoteDisplayAmount {\n TAX_INCLUDED = 1,\n TAX_EXCLUDED = 2,\n TAX_INCLUDED_AND_EXCLUDED = 3,\n}\n\nexport interface StoreConfigModel {\n quoteDisplaySettings: {\n zeroTax: boolean;\n subtotal: QuoteDisplayAmount;\n price: QuoteDisplayAmount;\n shipping: QuoteDisplayAmount;\n fullSummary: boolean;\n grandTotal: boolean;\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 {\n QuoteDisplayAmount,\n StoreConfigModel,\n} from '@/quote-management/data/models';\nimport { State } from '@/quote-management/types/state.types';\n\nexport const DEFAULT_PERMISSIONS = {\n requestQuote: false,\n editQuote: false,\n deleteQuote: false,\n checkoutQuote: false,\n};\n\nexport const DEFAULT_CONFIG: StoreConfigModel = {\n quoteDisplaySettings: {\n zeroTax: false,\n subtotal: QuoteDisplayAmount.TAX_INCLUDED,\n price: QuoteDisplayAmount.TAX_INCLUDED,\n shipping: QuoteDisplayAmount.TAX_INCLUDED,\n fullSummary: false,\n grandTotal: true,\n },\n};\n\nconst _state: State = {\n authenticated: false,\n permissions: DEFAULT_PERMISSIONS,\n config: DEFAULT_CONFIG,\n};\n\n// Proxy state to make it reactive\nexport const state = new Proxy(_state, {\n get: (target, key) => {\n return target[key as keyof State];\n },\n set: (target, key, value) => {\n target[key as keyof State] = value;\n return true;\n },\n});\n"],"names":["QuoteDisplayAmount","DEFAULT_PERMISSIONS","DEFAULT_CONFIG","_state","state","target","key","value"],"mappings":"AASO,IAAKA,GAAAA,IACVA,EAAAA,EAAA,aAAe,CAAA,EAAf,eACAA,EAAAA,EAAA,aAAe,CAAA,EAAf,eACAA,EAAAA,EAAA,0BAA4B,CAAA,EAA5B,4BAHUA,IAAAA,GAAA,CAAA,CAAA,ECML,MAAMC,EAAsB,CACjC,aAAc,GACd,UAAW,GACX,YAAa,GACb,cAAe,EACjB,EAEaC,EAAmC,CAC9C,qBAAsB,CACpB,QAAS,GACT,SAAUF,EAAmB,aAC7B,MAAOA,EAAmB,aAC1B,SAAUA,EAAmB,aAC7B,YAAa,GACb,WAAY,EAAA,CAEhB,EAEMG,EAAgB,CACpB,cAAe,GACf,YAAaF,EACb,OAAQC,CACV,EAGaE,EAAQ,IAAI,MAAMD,EAAQ,CACrC,IAAK,CAACE,EAAQC,IACLD,EAAOC,CAAkB,EAElC,IAAK,CAACD,EAAQC,EAAKC,KACjBF,EAAOC,CAAkB,EAAIC,EACtB,GAEX,CAAC"}
@@ -1,6 +1,6 @@
1
1
  /*! Copyright 2025 Adobe
2
2
  All Rights Reserved. */
3
- import{FetchGraphQL as I,fetchGraphQl as w}from"@dropins/tools/fetch-graphql.js";import{events as h}from"@dropins/tools/event-bus.js";import{N as _}from"./NegotiableQuoteFragment.js";import{t as N}from"./transform-quote.js";const{setEndpoint:F,setFetchGraphQlHeader:y,removeFetchGraphQlHeader:G,setFetchGraphQlHeaders:b,fetchGraphQl:l,getConfig:L}=new I().getMethods(),g=`
3
+ import{f as l,t as w}from"./fetch-graphql.js";import"./state.js";import{events as E}from"@dropins/tools/event-bus.js";import{N as f}from"./NegotiableQuoteFragment.js";const N=`
4
4
  mutation REQUEST_NEGOTIABLE_QUOTE_MUTATION(
5
5
  $cartId: ID!
6
6
  $quoteName: String!
@@ -20,8 +20,8 @@ import{FetchGraphQL as I,fetchGraphQl as w}from"@dropins/tools/fetch-graphql.js"
20
20
  }
21
21
  }
22
22
  }
23
- ${_}
24
- `,M=async t=>{const{cartId:n,quoteName:e,comment:o,attachments:r,isDraft:s}=t;if(!n)throw new Error("Cart ID is required");if(!e)throw new Error("Quote name is required");if(!o)throw new Error("Comment is required");return w(g,{variables:{cartId:n,quoteName:e,comment:r!=null&&r.length?{comment:o,attachments:r}:{comment:o},isDraft:s}}).then(m=>{var i,u;const{errors:p}=m;if(p){const d=p.map(c=>c.message).join("; ");throw new Error(`Failed to request negotiable quote: ${d}`)}const a=N((u=(i=m.data)==null?void 0:i.requestNegotiableQuote)==null?void 0:u.quote);if(!a)throw new Error("Failed to transform quote data: Invalid response structure");return h.emit("quote-management/negotiable-quote-requested",{quote:a,input:{cartId:n,quoteName:e,comment:o,attachments:r,isDraft:s}}),a})},U=`
23
+ ${f}
24
+ `,$=async t=>{const{cartId:n,quoteName:e,comment:o,attachments:r,isDraft:i}=t;if(!n)throw new Error("Cart ID is required");if(!e)throw new Error("Quote name is required");if(!o)throw new Error("Comment is required");return l(N,{variables:{cartId:n,quoteName:e,comment:r!=null&&r.length?{comment:o,attachments:r}:{comment:o},isDraft:i}}).then(m=>{var s,u;const{errors:d}=m;if(d){const c=d.map(p=>p.message).join("; ");throw new Error(`Failed to request negotiable quote: ${c}`)}const a=w((u=(s=m.data)==null?void 0:s.requestNegotiableQuote)==null?void 0:u.quote);if(!a)throw new Error("Failed to transform quote data: Invalid response structure");return E.emit("quote-management/negotiable-quote-requested",{quote:a,input:{cartId:n,quoteName:e,comment:o,attachments:r,isDraft:i}}),a})},h=`
25
25
  mutation INITIATE_UPLOAD_MUTATION($input: initiateUploadInput!) {
26
26
  initiateUpload(input: $input) {
27
27
  upload_url
@@ -29,7 +29,7 @@ import{FetchGraphQL as I,fetchGraphQl as w}from"@dropins/tools/fetch-graphql.js"
29
29
  expires_at
30
30
  }
31
31
  }
32
- `,q=`
32
+ `,U=`
33
33
  mutation FINISH_UPLOAD_MUTATION($input: finishUploadInput!) {
34
34
  finishUpload(input: $input) {
35
35
  success
@@ -37,5 +37,5 @@ import{FetchGraphQL as I,fetchGraphQl as w}from"@dropins/tools/fetch-graphql.js"
37
37
  message
38
38
  }
39
39
  }
40
- `,D=async t=>{const n="NEGOTIABLE_QUOTE_ATTACHMENT";try{const e=t==null?void 0:t.name;if(!t||!e)throw new Error("Invalid file");const o=T=>T.map(f=>f.message).join("; "),{data:r,errors:s}=await l(U,{variables:{input:{key:e,media_resource_type:n}}});if(s&&s.length)throw new Error(o(s));const{upload_url:m,key:p}=(r==null?void 0:r.initiateUpload)||{};if(!m||!p)throw new Error("Failed to initiate upload");const a=await fetch(m,{method:"PUT",body:t});if(!a.ok)throw new Error(`Upload failed: ${a.status} ${a.statusText}`);const{data:i,errors:u}=await l(q,{variables:{input:{key:p,media_resource_type:n}}});if(u&&u.length)throw new Error(o(u));const{success:d,key:c,message:E}=(i==null?void 0:i.finishUpload)||{};if(!d||!c)throw new Error(E||"Failed to finish upload");return{key:c}}catch(e){throw h.emit("quote-management/file-upload-error",{error:(e==null?void 0:e.message)||"File upload failed",fileName:t==null?void 0:t.name}),e instanceof Error?e:new Error("File upload failed")}};export{y as a,G as b,b as c,l as f,L as g,M as r,F as s,D as u};
40
+ `,Q=async t=>{const n="NEGOTIABLE_QUOTE_ATTACHMENT";try{const e=t==null?void 0:t.name;if(!t||!e)throw new Error("Invalid file");const o=I=>I.map(_=>_.message).join("; "),{data:r,errors:i}=await l(h,{variables:{input:{key:e,media_resource_type:n}}});if(i&&i.length)throw new Error(o(i));const{upload_url:m,key:d}=(r==null?void 0:r.initiateUpload)||{};if(!m||!d)throw new Error("Failed to initiate upload");const a=await fetch(m,{method:"PUT",body:t});if(!a.ok)throw new Error(`Upload failed: ${a.status} ${a.statusText}`);const{data:s,errors:u}=await l(U,{variables:{input:{key:d,media_resource_type:n}}});if(u&&u.length)throw new Error(o(u));const{success:c,key:p,message:T}=(s==null?void 0:s.finishUpload)||{};if(!c||!p)throw new Error(T||"Failed to finish upload");return{key:p}}catch(e){throw E.emit("quote-management/file-upload-error",{error:(e==null?void 0:e.message)||"File upload failed",fileName:t==null?void 0:t.name}),e instanceof Error?e:new Error("File upload failed")}};export{$ as r,Q as u};
41
41
  //# sourceMappingURL=uploadFile.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"uploadFile.js","sources":["/@dropins/storefront-quote-management/src/api/fetch-graphql/fetch-graphql.ts","/@dropins/storefront-quote-management/src/api/requestNegotiableQuote/graphql/RequestNegotiableQuoteMutation.ts","/@dropins/storefront-quote-management/src/api/requestNegotiableQuote/requestNegotiableQuote.ts","/@dropins/storefront-quote-management/src/api/uploadFile/graphql/InitiateUploadMutation.ts","/@dropins/storefront-quote-management/src/api/uploadFile/graphql/FinishUploadMutation.ts","/@dropins/storefront-quote-management/src/api/uploadFile/uploadFile.ts"],"sourcesContent":["import { FetchGraphQL } from '@adobe-commerce/fetch-graphql';\n\nexport const {\n setEndpoint,\n setFetchGraphQlHeader,\n removeFetchGraphQlHeader,\n setFetchGraphQlHeaders,\n fetchGraphQl,\n getConfig,\n} = new FetchGraphQL().getMethods();\n","/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2024 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\n\nimport { NEGOTIABLE_QUOTE_FRAGMENT } from '@/quote-management/api/graphql/NegotiableQuoteFragment';\n\nexport const REQUEST_NEGOTIABLE_QUOTE_MUTATION = `\n mutation REQUEST_NEGOTIABLE_QUOTE_MUTATION(\n $cartId: ID!\n $quoteName: String!\n $comment: NegotiableQuoteCommentInput!\n $isDraft: Boolean\n ) {\n requestNegotiableQuote(\n input: {\n cart_id: $cartId\n quote_name: $quoteName\n comment: $comment\n is_draft: $isDraft\n }\n ) {\n quote {\n ...NegotiableQuoteFragment\n }\n }\n }\n ${NEGOTIABLE_QUOTE_FRAGMENT}\n`;\n","/********************************************************************\n * Copyright 2025 Adobe\n * All Rights Reserved.\n *\n * NOTICE: Adobe permits you to use, modify, and distribute this\n * file in accordance with the terms of the Adobe license agreement\n * accompanying it.\n *******************************************************************/\n\nimport { fetchGraphQl } from '@adobe-commerce/fetch-graphql';\nimport { events } from '@adobe-commerce/event-bus';\nimport { REQUEST_NEGOTIABLE_QUOTE_MUTATION } from './graphql/RequestNegotiableQuoteMutation';\nimport { NegotiableQuoteModel } from '@/quote-management/data/models/negotiable-quote-model';\nimport { transformQuote } from '@/quote-management/data/transforms';\n\nexport interface RequestNegotiableQuoteInput {\n cartId: string;\n quoteName: string;\n comment: string;\n isDraft?: boolean;\n attachments?: { key: string }[];\n}\n\nexport const requestNegotiableQuote = async (\n input: RequestNegotiableQuoteInput\n): Promise<NegotiableQuoteModel | null> => {\n const { cartId, quoteName, comment, attachments, isDraft } = input;\n\n if (!cartId) {\n throw new Error('Cart ID is required');\n }\n\n if (!quoteName) {\n throw new Error('Quote name is required');\n }\n\n if (!comment) {\n throw new Error('Comment is required');\n }\n\n return fetchGraphQl(REQUEST_NEGOTIABLE_QUOTE_MUTATION, {\n variables: {\n cartId,\n quoteName,\n comment: attachments?.length ? { comment, attachments } : { comment },\n isDraft,\n },\n }).then((response) => {\n const { errors } = response;\n\n if (errors) {\n // Provide more detailed error information\n const errorMessages = errors.map((error) => error.message).join('; ');\n throw new Error(`Failed to request negotiable quote: ${errorMessages}`);\n }\n\n // Transform the quote data\n const quoteData = transformQuote(response.data?.requestNegotiableQuote?.quote);\n\n if (!quoteData) {\n throw new Error(\n 'Failed to transform quote data: Invalid response structure'\n );\n }\n\n // Emit event with transformed quote data on success\n events.emit('quote-management/negotiable-quote-requested', {\n quote: quoteData,\n input: { cartId, quoteName, comment, attachments, isDraft },\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\nexport const INITIATE_UPLOAD_MUTATION = `\n mutation INITIATE_UPLOAD_MUTATION($input: initiateUploadInput!) {\n initiateUpload(input: $input) {\n upload_url\n key\n expires_at\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 FINISH_UPLOAD_MUTATION = `\n mutation FINISH_UPLOAD_MUTATION($input: finishUploadInput!) {\n finishUpload(input: $input) {\n success\n key\n message\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 { INITIATE_UPLOAD_MUTATION } from '@/quote-management/api/uploadFile/graphql/InitiateUploadMutation';\nimport { FINISH_UPLOAD_MUTATION } from '@/quote-management/api/uploadFile/graphql/FinishUploadMutation';\n\ntype GraphQLError = { message: string };\ntype InitiateUploadData = {\n initiateUpload?: {\n upload_url: string;\n key: string;\n expires_at: string;\n };\n};\ntype FinishUploadData = {\n finishUpload?: {\n success: boolean;\n key: string;\n message?: string;\n };\n};\ntype GraphQLResponse<T> = {\n data?: T;\n errors?: GraphQLError[];\n};\n\nexport const uploadFile = async (file: File): Promise<{ key: string }> => {\n const mediaResourceType = 'NEGOTIABLE_QUOTE_ATTACHMENT';\n\n try {\n const filename = file?.name;\n if (!file || !filename) throw new Error('Invalid file');\n\n const formatGraphQLErrors = (errors: GraphQLError[]): string =>\n errors.map((e) => e.message).join('; ');\n\n const { data: initialData, errors: initialErrors } = (await fetchGraphQl(\n INITIATE_UPLOAD_MUTATION,\n { \n variables: { input: { key: filename, media_resource_type: mediaResourceType } } \n }\n )) as GraphQLResponse<InitiateUploadData>;\n if (initialErrors && initialErrors.length) throw new Error(formatGraphQLErrors(initialErrors));\n\n const { upload_url, key } = initialData?.initiateUpload || {};\n if (!upload_url || !key) throw new Error('Failed to initiate upload');\n\n const put = await fetch(upload_url, { method: 'PUT', body: file });\n if (!put.ok) throw new Error(`Upload failed: ${put.status} ${put.statusText}`);\n\n const { data: finishData, errors: finishErrors } = (await fetchGraphQl(\n FINISH_UPLOAD_MUTATION,\n { \n variables: { input: { key, media_resource_type: mediaResourceType } } \n }\n )) as GraphQLResponse<FinishUploadData>;\n if (finishErrors && finishErrors.length) throw new Error(formatGraphQLErrors(finishErrors));\n\n const { success, key: finalizedKey, message } = finishData?.finishUpload || {};\n if (!success || !finalizedKey) throw new Error(message || 'Failed to finish upload');\n\n return { key: finalizedKey };\n \n } catch (err: any) {\n events.emit('quote-management/file-upload-error', {\n error: err?.message || 'File upload failed',\n fileName: file?.name,\n });\n throw err instanceof Error ? err : new Error('File upload failed');\n }\n};\n"],"names":["setEndpoint","setFetchGraphQlHeader","removeFetchGraphQlHeader","setFetchGraphQlHeaders","fetchGraphQl","getConfig","FetchGraphQL","REQUEST_NEGOTIABLE_QUOTE_MUTATION","NEGOTIABLE_QUOTE_FRAGMENT","requestNegotiableQuote","input","cartId","quoteName","comment","attachments","isDraft","response","errors","errorMessages","error","quoteData","transformQuote","_b","_a","events","INITIATE_UPLOAD_MUTATION","FINISH_UPLOAD_MUTATION","uploadFile","file","mediaResourceType","filename","formatGraphQLErrors","e","initialData","initialErrors","upload_url","key","put","finishData","finishErrors","success","finalizedKey","message","err"],"mappings":"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"}
1
+ {"version":3,"file":"uploadFile.js","sources":["/@dropins/storefront-quote-management/src/api/requestNegotiableQuote/graphql/RequestNegotiableQuoteMutation.ts","/@dropins/storefront-quote-management/src/api/requestNegotiableQuote/requestNegotiableQuote.ts","/@dropins/storefront-quote-management/src/api/uploadFile/graphql/InitiateUploadMutation.ts","/@dropins/storefront-quote-management/src/api/uploadFile/graphql/FinishUploadMutation.ts","/@dropins/storefront-quote-management/src/api/uploadFile/uploadFile.ts"],"sourcesContent":["/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2024 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\n\nimport { NEGOTIABLE_QUOTE_FRAGMENT } from '@/quote-management/api/graphql/NegotiableQuoteFragment';\n\nexport const REQUEST_NEGOTIABLE_QUOTE_MUTATION = `\n mutation REQUEST_NEGOTIABLE_QUOTE_MUTATION(\n $cartId: ID!\n $quoteName: String!\n $comment: NegotiableQuoteCommentInput!\n $isDraft: Boolean\n ) {\n requestNegotiableQuote(\n input: {\n cart_id: $cartId\n quote_name: $quoteName\n comment: $comment\n is_draft: $isDraft\n }\n ) {\n quote {\n ...NegotiableQuoteFragment\n }\n }\n }\n ${NEGOTIABLE_QUOTE_FRAGMENT}\n`;\n","/********************************************************************\n * Copyright 2025 Adobe\n * All Rights Reserved.\n *\n * NOTICE: Adobe permits you to use, modify, and distribute this\n * file in accordance with the terms of the Adobe license agreement\n * accompanying it.\n *******************************************************************/\n\nimport { fetchGraphQl } from '@/quote-management/api';\nimport { events } from '@adobe-commerce/event-bus';\nimport { REQUEST_NEGOTIABLE_QUOTE_MUTATION } from './graphql/RequestNegotiableQuoteMutation';\nimport { NegotiableQuoteModel } from '@/quote-management/data/models/negotiable-quote-model';\nimport { transformQuote } from '@/quote-management/data/transforms';\n\nexport interface RequestNegotiableQuoteInput {\n cartId: string;\n quoteName: string;\n comment: string;\n isDraft?: boolean;\n attachments?: { key: string }[];\n}\n\nexport const requestNegotiableQuote = async (\n input: RequestNegotiableQuoteInput\n): Promise<NegotiableQuoteModel | null> => {\n const { cartId, quoteName, comment, attachments, isDraft } = input;\n\n if (!cartId) {\n throw new Error('Cart ID is required');\n }\n\n if (!quoteName) {\n throw new Error('Quote name is required');\n }\n\n if (!comment) {\n throw new Error('Comment is required');\n }\n\n return fetchGraphQl(REQUEST_NEGOTIABLE_QUOTE_MUTATION, {\n variables: {\n cartId,\n quoteName,\n comment: attachments?.length ? { comment, attachments } : { comment },\n isDraft,\n },\n }).then((response) => {\n const { errors } = response;\n\n if (errors) {\n // Provide more detailed error information\n const errorMessages = errors.map((error) => error.message).join('; ');\n throw new Error(`Failed to request negotiable quote: ${errorMessages}`);\n }\n\n // Transform the quote data\n const quoteData = transformQuote(response.data?.requestNegotiableQuote?.quote);\n\n if (!quoteData) {\n throw new Error(\n 'Failed to transform quote data: Invalid response structure'\n );\n }\n\n // Emit event with transformed quote data on success\n events.emit('quote-management/negotiable-quote-requested', {\n quote: quoteData,\n input: { cartId, quoteName, comment, attachments, isDraft },\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\nexport const INITIATE_UPLOAD_MUTATION = `\n mutation INITIATE_UPLOAD_MUTATION($input: initiateUploadInput!) {\n initiateUpload(input: $input) {\n upload_url\n key\n expires_at\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 FINISH_UPLOAD_MUTATION = `\n mutation FINISH_UPLOAD_MUTATION($input: finishUploadInput!) {\n finishUpload(input: $input) {\n success\n key\n message\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 { INITIATE_UPLOAD_MUTATION } from '@/quote-management/api/uploadFile/graphql/InitiateUploadMutation';\nimport { FINISH_UPLOAD_MUTATION } from '@/quote-management/api/uploadFile/graphql/FinishUploadMutation';\n\ntype GraphQLError = { message: string };\ntype InitiateUploadData = {\n initiateUpload?: {\n upload_url: string;\n key: string;\n expires_at: string;\n };\n};\ntype FinishUploadData = {\n finishUpload?: {\n success: boolean;\n key: string;\n message?: string;\n };\n};\ntype GraphQLResponse<T> = {\n data?: T;\n errors?: GraphQLError[];\n};\n\nexport const uploadFile = async (file: File): Promise<{ key: string }> => {\n const mediaResourceType = 'NEGOTIABLE_QUOTE_ATTACHMENT';\n\n try {\n const filename = file?.name;\n if (!file || !filename) throw new Error('Invalid file');\n\n const formatGraphQLErrors = (errors: GraphQLError[]): string =>\n errors.map((e) => e.message).join('; ');\n\n const { data: initialData, errors: initialErrors } = (await fetchGraphQl(\n INITIATE_UPLOAD_MUTATION,\n { \n variables: { input: { key: filename, media_resource_type: mediaResourceType } } \n }\n )) as GraphQLResponse<InitiateUploadData>;\n if (initialErrors && initialErrors.length) throw new Error(formatGraphQLErrors(initialErrors));\n\n const { upload_url, key } = initialData?.initiateUpload || {};\n if (!upload_url || !key) throw new Error('Failed to initiate upload');\n\n const put = await fetch(upload_url, { method: 'PUT', body: file });\n if (!put.ok) throw new Error(`Upload failed: ${put.status} ${put.statusText}`);\n\n const { data: finishData, errors: finishErrors } = (await fetchGraphQl(\n FINISH_UPLOAD_MUTATION,\n { \n variables: { input: { key, media_resource_type: mediaResourceType } } \n }\n )) as GraphQLResponse<FinishUploadData>;\n if (finishErrors && finishErrors.length) throw new Error(formatGraphQLErrors(finishErrors));\n\n const { success, key: finalizedKey, message } = finishData?.finishUpload || {};\n if (!success || !finalizedKey) throw new Error(message || 'Failed to finish upload');\n\n return { key: finalizedKey };\n \n } catch (err: any) {\n events.emit('quote-management/file-upload-error', {\n error: err?.message || 'File upload failed',\n fileName: file?.name,\n });\n throw err instanceof Error ? err : new Error('File upload failed');\n }\n};\n"],"names":["REQUEST_NEGOTIABLE_QUOTE_MUTATION","NEGOTIABLE_QUOTE_FRAGMENT","requestNegotiableQuote","input","cartId","quoteName","comment","attachments","isDraft","fetchGraphQl","response","errors","errorMessages","error","quoteData","transformQuote","_b","_a","events","INITIATE_UPLOAD_MUTATION","FINISH_UPLOAD_MUTATION","uploadFile","file","mediaResourceType","filename","formatGraphQLErrors","e","initialData","initialErrors","upload_url","key","put","finishData","finishErrors","success","finalizedKey","message","err"],"mappings":"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"}
@@ -0,0 +1,16 @@
1
+ import { FunctionComponent, VNode } from 'preact';
2
+ import { HTMLAttributes } from 'preact/compat';
3
+
4
+ export interface ConfirmationModalProps extends Omit<HTMLAttributes<HTMLDivElement>, 'title'> {
5
+ open?: boolean;
6
+ title?: VNode | string;
7
+ message?: VNode | string;
8
+ cancelLabel?: VNode | string;
9
+ confirmLabel?: VNode | string;
10
+ onCancel?: () => void;
11
+ onConfirm?: () => void;
12
+ showCloseButton?: boolean;
13
+ confirmationBanner?: VNode | null;
14
+ }
15
+ export declare const ConfirmationModal: FunctionComponent<ConfirmationModalProps>;
16
+ //# sourceMappingURL=ConfirmationModal.d.ts.map
@@ -0,0 +1,11 @@
1
+ /********************************************************************
2
+ * Copyright 2025 Adobe
3
+ * All Rights Reserved.
4
+ *
5
+ * NOTICE: Adobe permits you to use, modify, and distribute this
6
+ * file in accordance with the terms of the Adobe license agreement
7
+ * accompanying it.
8
+ *******************************************************************/
9
+ export * from './ConfirmationModal';
10
+ export { ConfirmationModal as default } from './ConfirmationModal';
11
+ //# sourceMappingURL=index.d.ts.map
@@ -9,18 +9,21 @@ export interface OrderSummaryLineItem {
9
9
  sortOrder: number;
10
10
  content: string | JSXInternal.Element | VNode<HTMLAttributes<HTMLDivElement>> | OrderSummaryLineItem[] | undefined;
11
11
  }
12
- export interface OrderSummaryProps extends Omit<HTMLAttributes<HTMLDivElement>, 'loading'> {
12
+ export interface OrderSummaryProps extends HTMLAttributes<HTMLDivElement> {
13
13
  variant?: 'primary' | 'secondary';
14
14
  heading?: VNode<HTMLAttributes<HTMLDivElement>>;
15
- loading?: boolean;
16
15
  subTotal?: {
17
16
  price: VNode<HTMLAttributes<HTMLSpanElement>>;
18
17
  priceExcludingTax?: VNode<HTMLAttributes<HTMLSpanElement>>;
19
18
  taxIncluded?: boolean;
20
19
  taxExcluded?: boolean;
21
- zeroTaxSubtotal?: boolean;
22
20
  };
23
- shipping?: VNode<HTMLAttributes<HTMLDivElement>>;
21
+ shipping?: {
22
+ price: VNode<HTMLAttributes<HTMLSpanElement>>;
23
+ priceExcludingTax?: VNode<HTMLAttributes<HTMLSpanElement>>;
24
+ taxIncluded?: boolean;
25
+ taxExcluded?: boolean;
26
+ };
24
27
  discounts?: {
25
28
  label: string;
26
29
  price: VNode<HTMLAttributes<HTMLSpanElement>>;
@@ -38,28 +41,6 @@ export interface OrderSummaryProps extends Omit<HTMLAttributes<HTMLDivElement>,
38
41
  price: VNode<HTMLAttributes<HTMLSpanElement>>;
39
42
  priceWithoutTax?: VNode<HTMLAttributes<HTMLSpanElement>>;
40
43
  };
41
- printedCard?: {
42
- renderContent: boolean;
43
- taxIncluded: boolean;
44
- taxInclAndExcl: boolean;
45
- priceExclTax: VNode<HTMLAttributes<HTMLSpanElement>>;
46
- priceInclTax: VNode<HTMLAttributes<HTMLSpanElement>>;
47
- };
48
- itemsGiftWrapping?: {
49
- renderContent: boolean;
50
- taxIncluded: boolean;
51
- taxInclAndExcl: boolean;
52
- priceExclTax: VNode<HTMLAttributes<HTMLSpanElement>>;
53
- priceInclTax: VNode<HTMLAttributes<HTMLSpanElement>>;
54
- };
55
- orderGiftWrapping?: {
56
- renderContent: boolean;
57
- taxIncluded: boolean;
58
- taxInclAndExcl: boolean;
59
- priceExclTax: VNode<HTMLAttributes<HTMLSpanElement>>;
60
- priceInclTax: VNode<HTMLAttributes<HTMLSpanElement>>;
61
- };
62
- primaryAction?: VNode<HTMLAttributes<HTMLButtonElement>>;
63
44
  totalSaved?: VNode<HTMLAttributes<HTMLSpanElement>>;
64
45
  updateLineItems?: (lineItems: Array<OrderSummaryLineItem>) => Array<OrderSummaryLineItem>;
65
46
  }
@@ -15,6 +15,7 @@ export * from './ProductListTable';
15
15
  export * from './QuotePricesSummary';
16
16
  export * from './QuoteSummaryList';
17
17
  export * from './QuotesListTable';
18
+ export * from './ConfirmationModal';
18
19
  export * from './QuoteHistoryLog';
19
20
  export * from './ShippingAddressDisplay';
20
21
  export * from './RequestNegotiableQuoteForm';
@@ -1,4 +1,4 @@
1
1
  /*! Copyright 2025 Adobe
2
2
  All Rights Reserved. */
3
- import{jsx as t,jsxs as p}from"@dropins/tools/preact-jsx-runtime.js";import{useState as x,useMemo as b,useEffect as M,useCallback as F}from"@dropins/tools/preact-compat.js";import{classes as d,VComponent as c,Slot as u,getGlobalLocale as D}from"@dropins/tools/lib.js";/* empty css */import{Picker as J,Skeleton as K,SkeletonRow as Q,InLineAlert as Y,Button as C,TextArea as Z}from"@dropins/tools/components.js";import{events as y}from"@dropins/tools/event-bus.js";/* empty css */import"@dropins/tools/preact.js";/* empty css *//* empty css *//* empty css */import{S as O}from"../chunks/ShippingAddressDisplay.js";import{Q as k}from"../chunks/QuoteHistoryLog.js";import"../chunks/transform-quote.js";import"@dropins/tools/fetch-graphql.js";import{s as B}from"../chunks/sendForReview.js";import{I as A}from"../chunks/ItemsQuoted.js";import{Q as ee}from"../chunks/QuoteCommentsList.js";import{S as ae}from"../chunks/WarningFilled.js";import{useText as te}from"@dropins/tools/i18n.js";import"../chunks/NegotiableQuoteFragment.js";const ne=({className:q,dropdownPlaceholder:e,dropdownOptions:n,handleDropdownChange:s,buttons:g,...a})=>{const f=n&&n.length>0,h=g&&g.length>0,l=(n==null?void 0:n.map(m=>({text:m.label,value:m.value})))||[];return l.unshift({text:e||"",value:""}),t("div",{className:"quote-management-actions-bar__container","data-testid":"actions-bar-container",children:p("div",{className:d(["quote-management-actions-bar",q]),"data-testid":"actions-bar",...a,children:[f&&t(J,{name:"dropdown",id:"dropdown",onInput:s,className:"quote-management-actions-bar__dropdown","data-testid":"dropdown",options:l}),h&&t("div",{className:"quote-management-actions-bar__buttons","data-testid":"buttons-container",children:g==null?void 0:g.map((m,_)=>t(c,{node:m,className:d(["quote-management-actions-bar__button"])},_))})]})})},re=({className:q,loading:e,quoteName:n,quoteStatus:s,banner:g,details:a,actionBar:f,quoteContent:h,shippingInformationTitle:l,shippingInformation:m,quoteCommentsTitle:_,quoteComments:v,footer:T,...r})=>e?t(ie,{}):p("div",{...r,className:d(["quote-management-manage-negotiable-quote",q]),children:[p("div",{className:d(["quote-management-manage-negotiable-quote__header"]),children:[n&&t(c,{node:n,className:d(["quote-management-manage-negotiable-quote__quote-name"])}),s&&t(c,{node:s,className:d(["quote-management-manage-negotiable-quote__quote-status"])})]}),g&&t(c,{node:g,className:d(["quote-management-manage-negotiable-quote__banner"])}),a&&t(c,{node:a,className:d(["quote-management-manage-negotiable-quote__details"])}),f&&t(c,{node:f,className:d(["quote-management-manage-negotiable-quote__action-bar"])}),h&&t(c,{node:h,className:d(["quote-management-manage-negotiable-quote__quote-content"])}),p("div",{"data-testid":"quote-shipping-information-container",className:d(["quote-management-manage-negotiable-quote__shipping-information-container"]),children:[l&&t(c,{node:l,className:d(["quote-management-manage-negotiable-quote__shipping-information-title"])}),m&&t(c,{node:m,className:d(["quote-management-manage-negotiable-quote__shipping-information"])})]}),p("div",{"data-testid":"quote-comments-container",className:d(["quote-management-manage-negotiable-quote__quote-comments-container"]),children:[_&&t(c,{node:_,className:d(["quote-management-manage-negotiable-quote__quote-comments-title"])}),v&&t(c,{node:v,className:d(["quote-management-manage-negotiable-quote__quote-comments"])})]}),t(c,{node:T,className:d(["quote-management-manage-negotiable-quote__footer"])})]}),ie=()=>p(K,{"data-testid":"manage-negotiable-quote-skeleton",children:[t(Q,{variant:"heading",fullWidth:!0,size:"large"}),t(Q,{variant:"row",fullWidth:!1,size:"small"}),t(Q,{variant:"row",fullWidth:!1,size:"small"}),t(Q,{variant:"row",fullWidth:!0}),t(Q,{variant:"row",fullWidth:!0,size:"xlarge",lines:2}),t(Q,{variant:"row",fullWidth:!1,size:"small"})]}),me=({className:q,tabs:e,tabsContent:n,defaultActiveTab:s,...g})=>{const[a,f]=x(s||Array.from(e.keys())[0]),h=m=>{f(m)},l=b(()=>n.get(a),[a,n]);return p("div",{...g,className:d(["quote-management-tabbed-content",q]),children:[e&&t("div",{"data-testid":"tabbed-content-tabs",className:d(["quote-management-tabbed-content__tabs"]),children:Array.from(e.entries()).map(([m,_])=>t("button",{className:d(["quote-management-tabbed-content__tab",["quote-management-tabbed-content__tab--active",m===a]]),onClick:()=>h(m),children:_},m))}),l&&t("div",{className:d(["quote-management-tabbed-content__active-tab-content"]),children:t(c,{node:l})})]})},we=({onActionsDropdownChange:q,slots:e,onActionsButtonClick:n,onSendForReview:s,...g})=>{const[a,f]=x(void 0),[h,l]=x(!0),[m,_]=x(""),[v,T]=x(!1),r=te({createdLabel:"NegotiableQuote.Manage.createdLabel",salesRepLabel:"NegotiableQuote.Manage.salesRepLabel",expiresLabel:"NegotiableQuote.Manage.expiresLabel",actionsLabel:"NegotiableQuote.Manage.actionsLabel",remove:"NegotiableQuote.Manage.actions.remove",close:"NegotiableQuote.Manage.actionButtons.close",delete:"NegotiableQuote.Manage.actionButtons.delete",print:"NegotiableQuote.Manage.actionButtons.print",createTemplate:"NegotiableQuote.Manage.actionButtons.createTemplate",createCopy:"NegotiableQuote.Manage.actionButtons.createCopy",shippingInformationTitle:"NegotiableQuote.Manage.shippingInformation.title",quoteCommentsTitle:"NegotiableQuote.Manage.quoteComments.title",quoteCommentsPlaceholder:"NegotiableQuote.Manage.quoteComments.placeholder",sendForReview:"NegotiableQuote.Manage.actionButtons.sendForReview",bannerTitle:"NegotiableQuote.Manage.bannerTitle",statusSubmitted:"NegotiableQuote.Manage.bannerStatusMessages.submitted",statusPending:"NegotiableQuote.Manage.bannerStatusMessages.pending",statusExpired:"NegotiableQuote.Manage.bannerStatusMessages.expired"});M(()=>{const o=y.on("quote-management/quote-data",N=>{const{quote:i}=N;i&&(f(i),l(!1))},{eager:!0});return()=>o==null?void 0:o.off()},[]),M(()=>{const o=y.on("quote-management/shipping-address-set",N=>{const{quote:i}=N;i&&f(i)},{eager:!0});return()=>o==null?void 0:o.off()},[]),M(()=>{const o=y.on("quote-management/quote-sent-for-review",N=>{const{quote:i}=N;f(i),_(""),T(!1)},{eager:!0});return()=>o==null?void 0:o.off()},[]);const P=b(()=>t(u,{name:"QuoteName",slot:e==null?void 0:e.QuoteName,context:{quoteName:a==null?void 0:a.name,quoteData:a},children:t("h1",{"data-testid":"quote-name",children:a==null?void 0:a.name})}),[e==null?void 0:e.QuoteName,a]),R=b(()=>t(u,{name:"QuoteStatus",slot:e==null?void 0:e.QuoteStatus,context:{quoteStatus:a==null?void 0:a.status,quoteData:a},children:t("div",{"data-testid":"quote-status",children:a==null?void 0:a.status})}),[e==null?void 0:e.QuoteStatus,a]),S=F(o=>{switch(o){case"SUBMITTED":return r.statusSubmitted;case"PENDING":return r.statusPending;case"EXPIRED":return r.statusExpired;default:return null}},[r])(a==null?void 0:a.status),I=S&&t(Y,{type:"warning",variant:"secondary",icon:t(ae,{}),heading:r.bannerTitle,description:S}),W=I&&t(u,{name:"Banner","data-testid":"banner",slot:e==null?void 0:e.Banner,context:{quoteData:a},children:I}),z=b(()=>{if(!a)return null;const o=D()||"en-US",N=new Intl.DateTimeFormat(o,{year:"numeric",month:"long",day:"numeric"});let i;try{i=N.format(new Date(a.expirationDate))}catch{i=a.expirationDate}return p(u,{name:"Details",slot:e==null?void 0:e.Details,context:{quoteData:a},children:[p("div",{className:"quote-management-manage-negotiable-quote__detail",children:[t("span",{className:"quote-management-manage-negotiable-quote__detail-title","data-testid":"created-label",children:r.createdLabel}),p("span",{className:"quote-management-manage-negotiable-quote__detail-content","data-testid":"created-value",children:[N.format(new Date(a.createdAt))," (",a.buyer.firstname," ",a.buyer.lastname,")"]})]}),p("div",{className:"quote-management-manage-negotiable-quote__detail",children:[t("span",{className:"quote-management-manage-negotiable-quote__detail-title","data-testid":"sales-rep-label",children:r.salesRepLabel}),t("span",{className:"quote-management-manage-negotiable-quote__detail-content","data-testid":"sales-rep-value",children:a.salesRepName})]}),p("div",{className:"quote-management-manage-negotiable-quote__detail",children:[t("span",{className:"quote-management-manage-negotiable-quote__detail-title","data-testid":"expires-label",children:r.expiresLabel}),t("span",{className:"quote-management-manage-negotiable-quote__detail-content","data-testid":"expires-value",children:i})]})]})},[e==null?void 0:e.Details,r,a]),L=b(()=>[{label:r.close,value:"close"},{label:r.delete,value:"delete"},{label:r.print,value:"print"},{label:r.createTemplate,value:"createTemplate"},{label:r.createCopy,value:"createCopy"}],[r]),H=b(()=>{const o=i=>{q==null||q(i)},N=i=>{switch(i){case"close":n==null||n(i);break;case"delete":n==null||n(i);break;case"print":n==null||n(i);break;case"createTemplate":n==null||n(i);break;case"createCopy":n==null||n(i);break}};return t(u,{name:"ActionBar",slot:e==null?void 0:e.ActionBar,context:{quoteData:a},children:t(ne,{dropdownPlaceholder:r.actionsLabel,dropdownOptions:[{label:r.remove,value:"remove"}],handleDropdownChange:o,buttons:L.map(i=>t(C,{variant:"tertiary",onClick:()=>N(i.value),"data-testid":`actions-bar-${i.value}-button`,"data-action":i.value,disabled:i.disabled,children:i.label},i.value))})})},[L,r,e==null?void 0:e.ActionBar,a,q,n]),E=b(()=>t(u,{name:"QuoteContent",slot:e==null?void 0:e.QuoteContent,context:{quoteData:a},children:t(me,{tabs:new Map([["items-quoted","Items Quoted"],["comments","Comments"],["history-log","History Log"]]),tabsContent:new Map([["items-quoted",t(u,{name:"ItemsQuotedTab",slot:e==null?void 0:e.ItemsQuotedTab,context:{quoteData:a},children:t(A,{quoteData:a})},"items-quoted")],["comments",t(u,{name:"CommentsTab",slot:e==null?void 0:e.CommentsTab,context:{quoteData:a},children:t(ee,{quoteData:a})},"comments")],["history-log",t(u,{name:"HistoryLogTab",slot:e==null?void 0:e.HistoryLogTab,context:{quoteData:a},children:t(k,{quoteData:a})},"history-log")]])})}),[e==null?void 0:e.QuoteContent,e==null?void 0:e.HistoryLogTab,e==null?void 0:e.CommentsTab,e==null?void 0:e.ItemsQuotedTab,a]),U=b(()=>t(u,{name:"ShippingInformationTitle",slot:e==null?void 0:e.ShippingInformationTitle,context:{quoteData:a},children:t("h2",{children:r.shippingInformationTitle})}),[e==null?void 0:e.ShippingInformationTitle,a,r]),j=b(()=>t(u,{name:"ShippingInformation",slot:e==null?void 0:e.ShippingInformation,context:{quoteData:a,loading:h,setLoading:l},children:t(O,{quoteData:a,loading:h,"data-testid":"manage-quote-shipping-address"})}),[e==null?void 0:e.ShippingInformation,a,h,l]),G=b(()=>t(u,{name:"QuoteCommentsTitle",slot:e==null?void 0:e.QuoteCommentsTitle,context:{quoteData:a},children:t("h2",{children:r.quoteCommentsTitle})}),[e==null?void 0:e.QuoteCommentsTitle,r,a]),$=b(()=>t(u,{name:"QuoteComments",slot:e==null?void 0:e.QuoteComments,context:{quoteData:a},children:t(Z,{name:"quoteComments",placeholder:r.quoteCommentsPlaceholder,rows:3,value:m,onInput:o=>{_(o.target.value)},disabled:v})}),[e==null?void 0:e.QuoteComments,r,a,m,v]),w=F(async()=>{if(s){s({quoteData:a,comment:m.trim()||void 0});return}T(!0);try{await B({quoteUid:a.uid,comment:m.trim()||void 0})}catch(o){console.error("Failed to send quote for review:",o),T(!1)}},[a,s,m]),V=b(()=>t(u,{name:"Footer",slot:e==null?void 0:e.Footer,context:{quoteData:a,comment:m,isSubmitting:v},children:t(C,{variant:"primary",onClick:w,"data-testid":"send-for-review-button",disabled:!(a!=null&&a.canSendForReview)||v||!a,children:r.sendForReview})}),[e==null?void 0:e.Footer,r,a,m,v,w]),X={...g,loading:h,quoteName:P,quoteStatus:R,banner:W||void 0,details:z,actionBar:H,quoteContent:E,shippingInformationTitle:U,shippingInformation:j,quoteCommentsTitle:G,quoteComments:$,footer:V};return t(re,{...X})};export{we as ManageNegotiableQuote,we as default};
3
+ import{jsx as t,jsxs as u,Fragment as me}from"@dropins/tools/preact-jsx-runtime.js";import{useState as v,useMemo as _,useEffect as F,useCallback as T,createPortal as ce}from"@dropins/tools/preact-compat.js";import{classes as m,VComponent as f,Slot as s,getGlobalLocale as le}from"@dropins/tools/lib.js";/* empty css */import{Picker as de,Skeleton as ue,SkeletonRow as S,Modal as ge,Button as C,InLineAlert as E,TextArea as se}from"@dropins/tools/components.js";import{events as H}from"@dropins/tools/event-bus.js";/* empty css */import"@dropins/tools/preact.js";import{useText as G}from"@dropins/tools/i18n.js";/* empty css *//* empty css *//* empty css */import{S as be}from"../chunks/ShippingAddressDisplay.js";import{Q as fe}from"../chunks/QuoteHistoryLog.js";import{I as pe}from"../chunks/ItemsQuoted.js";import"../chunks/state.js";import{s as he,d as Ne}from"../chunks/sendForReview.js";import{Q as Me}from"../chunks/QuoteCommentsList.js";import{a as k,S as _e}from"../chunks/WarningFilled.js";import"../chunks/fetch-graphql.js";import"@dropins/tools/fetch-graphql.js";import"../chunks/NegotiableQuoteFragment.js";const qe=({className:p,dropdownPlaceholder:e,dropdownOptions:o,handleDropdownChange:h,buttons:g,...a})=>{const N=o&&o.length>0,b=g&&g.length>0,l=(o==null?void 0:o.map(c=>({text:c.label,value:c.value})))||[];return l.unshift({text:e||"",value:""}),t("div",{className:"quote-management-actions-bar__container","data-testid":"actions-bar-container",children:u("div",{className:m(["quote-management-actions-bar",p]),"data-testid":"actions-bar",...a,children:[N&&t(de,{name:"dropdown",id:"dropdown",onInput:h,className:"quote-management-actions-bar__dropdown","data-testid":"dropdown",options:l}),b&&t("div",{className:"quote-management-actions-bar__buttons","data-testid":"buttons-container",children:g==null?void 0:g.map((c,M)=>t(f,{node:c,className:m(["quote-management-actions-bar__button"])},M))})]})})},ve=({className:p,loading:e,quoteName:o,quoteStatus:h,banner:g,details:a,actionBar:N,quoteContent:b,shippingInformationTitle:l,shippingInformation:c,quoteCommentsTitle:M,quoteComments:Q,footer:q,...I})=>e?t(Qe,{}):u("div",{...I,className:m(["quote-management-manage-negotiable-quote",p]),children:[u("div",{className:m(["quote-management-manage-negotiable-quote__header"]),children:[o&&t(f,{node:o,className:m(["quote-management-manage-negotiable-quote__quote-name"])}),h&&t(f,{node:h,className:m(["quote-management-manage-negotiable-quote__quote-status"])})]}),g&&t(f,{node:g,className:m(["quote-management-manage-negotiable-quote__banner"])}),a&&t(f,{node:a,className:m(["quote-management-manage-negotiable-quote__details"])}),N&&t(f,{node:N,className:m(["quote-management-manage-negotiable-quote__action-bar"])}),b&&t(f,{node:b,className:m(["quote-management-manage-negotiable-quote__quote-content"])}),u("div",{"data-testid":"quote-shipping-information-container",className:m(["quote-management-manage-negotiable-quote__shipping-information-container"]),children:[l&&t(f,{node:l,className:m(["quote-management-manage-negotiable-quote__shipping-information-title"])}),c&&t(f,{node:c,className:m(["quote-management-manage-negotiable-quote__shipping-information"])})]}),u("div",{"data-testid":"quote-comments-container",className:m(["quote-management-manage-negotiable-quote__quote-comments-container"]),children:[M&&t(f,{node:M,className:m(["quote-management-manage-negotiable-quote__quote-comments-title"])}),Q&&t(f,{node:Q,className:m(["quote-management-manage-negotiable-quote__quote-comments"])})]}),t(f,{node:q,className:m(["quote-management-manage-negotiable-quote__footer"])})]}),Qe=()=>u(ue,{"data-testid":"manage-negotiable-quote-skeleton",children:[t(S,{variant:"heading",fullWidth:!0,size:"large"}),t(S,{variant:"row",fullWidth:!1,size:"small"}),t(S,{variant:"row",fullWidth:!1,size:"small"}),t(S,{variant:"row",fullWidth:!0}),t(S,{variant:"row",fullWidth:!0,size:"xlarge",lines:2}),t(S,{variant:"row",fullWidth:!1,size:"small"})]}),ye=({open:p=!1,title:e,message:o,cancelLabel:h,confirmLabel:g,onCancel:a,onConfirm:N,showCloseButton:b,confirmationBanner:l,...c})=>{const M=G({cancel:"ConfirmationModal.cancel",confirm:"ConfirmationModal.confirm"});if(!p)return null;const{className:Q,...q}=c;return t(ge,{...q,size:"medium",onClose:a,clickToDismiss:!0,escapeToDismiss:!0,showCloseButton:b,"data-testid":"confirmation-modal",className:Q,children:u("div",{className:"confirmation-modal__content",children:[l&&t("div",{className:"confirmation-modal__banner","data-testid":"confirmation-modal-banner",children:l}),e&&t("div",{className:"confirmation-modal__title","data-testid":"confirmation-modal-title",children:e}),o&&t("div",{className:"confirmation-modal__message","data-testid":"confirmation-modal-message",children:o}),u("div",{className:"confirmation-modal__actions","data-testid":"confirmation-modal-actions",children:[t(C,{variant:"secondary",onClick:a,"data-testid":"confirmation-modal-cancel",children:h??M.cancel}),t(C,{variant:"primary",onClick:N,"data-testid":"confirmation-modal-confirm",children:g??M.confirm})]})]})})},Te=({className:p,tabs:e,tabsContent:o,defaultActiveTab:h,...g})=>{const[a,N]=v(h||Array.from(e.keys())[0]),b=c=>{N(c)},l=_(()=>o.get(a),[a,o]);return u("div",{...g,className:m(["quote-management-tabbed-content",p]),children:[e&&t("div",{"data-testid":"tabbed-content-tabs",className:m(["quote-management-tabbed-content__tabs"]),children:Array.from(e.entries()).map(([c,M])=>t("button",{className:m(["quote-management-tabbed-content__tab",["quote-management-tabbed-content__tab--active",c===a]]),onClick:()=>b(c),children:M},c))}),l&&t("div",{className:m(["quote-management-tabbed-content__active-tab-content"]),children:t(f,{node:l})})]})},Oe=({onActionsDropdownChange:p,slots:e,onActionsButtonClick:o,onSendForReview:h,...g})=>{const[a,N]=v(void 0),[b,l]=v(!0),[c,M]=v(!1),[Q,q]=v(null),[I,D]=v(!1),[y,P]=v(""),[x,L]=v(!1),n=G({createdLabel:"NegotiableQuote.Manage.createdLabel",salesRepLabel:"NegotiableQuote.Manage.salesRepLabel",expiresLabel:"NegotiableQuote.Manage.expiresLabel",actionsLabel:"NegotiableQuote.Manage.actionsLabel",remove:"NegotiableQuote.Manage.actions.remove",close:"NegotiableQuote.Manage.actionButtons.close",delete:"NegotiableQuote.Manage.actionButtons.delete",print:"NegotiableQuote.Manage.actionButtons.print",createTemplate:"NegotiableQuote.Manage.actionButtons.createTemplate",createCopy:"NegotiableQuote.Manage.actionButtons.createCopy",shippingInformationTitle:"NegotiableQuote.Manage.shippingInformation.title",quoteCommentsTitle:"NegotiableQuote.Manage.quoteComments.title",quoteCommentsPlaceholder:"NegotiableQuote.Manage.quoteComments.placeholder",sendForReview:"NegotiableQuote.Manage.actionButtons.sendForReview",bannerTitle:"NegotiableQuote.Manage.bannerTitle",statusSubmitted:"NegotiableQuote.Manage.bannerStatusMessages.submitted",statusPending:"NegotiableQuote.Manage.bannerStatusMessages.pending",statusExpired:"NegotiableQuote.Manage.bannerStatusMessages.expired",confirmationModalCancel:"NegotiableQuote.Manage.confirmationModal.cancel",confirmationModalDeleteTitle:"NegotiableQuote.Manage.confirmationModal.delete.title",confirmationModalDeleteMessage:"NegotiableQuote.Manage.confirmationModal.delete.message",confirmationModalDeleteConfirm:"NegotiableQuote.Manage.confirmationModal.delete.confirm",confirmationModalDeleteErrorHeading:"NegotiableQuote.Manage.confirmationModal.delete.errorHeading",confirmationModalDeleteErrorFallback:"NegotiableQuote.Manage.confirmationModal.delete.errorFallback",confirmationModalDeleteSuccessHeading:"NegotiableQuote.Manage.confirmationModal.delete.successHeading",confirmationModalDeleteSuccessDescription:"NegotiableQuote.Manage.confirmationModal.delete.successDescription"});F(()=>{const i=H.on("quote-management/quote-data",d=>{const{quote:r}=d;r&&(N(r),l(!1))},{eager:!0});return()=>i==null?void 0:i.off()},[]),F(()=>{const i=H.on("quote-management/shipping-address-set",d=>{const{quote:r}=d;r&&N(r)},{eager:!0});return()=>i==null?void 0:i.off()},[]),F(()=>{const i=H.on("quote-management/quote-sent-for-review",d=>{const{quote:r}=d;N(r),P(""),L(!1)},{eager:!0});return()=>i==null?void 0:i.off()},[]);const $=_(()=>t(s,{name:"QuoteName",slot:e==null?void 0:e.QuoteName,context:{quoteName:a==null?void 0:a.name,quoteData:a},children:t("h1",{"data-testid":"quote-name",children:a==null?void 0:a.name})}),[e==null?void 0:e.QuoteName,a]),V=_(()=>t(s,{name:"QuoteStatus",slot:e==null?void 0:e.QuoteStatus,context:{quoteStatus:a==null?void 0:a.status,quoteData:a},children:t("div",{"data-testid":"quote-status",children:a==null?void 0:a.status})}),[e==null?void 0:e.QuoteStatus,a]),R=T(i=>{switch(i){case"SUBMITTED":return n.statusSubmitted;case"PENDING":return n.statusPending;case"EXPIRED":return n.statusExpired;default:return null}},[n])(a==null?void 0:a.status),W=R&&t(E,{type:"warning",variant:"secondary",icon:t(k,{}),heading:n.bannerTitle,description:R}),X=W&&t(s,{name:"Banner","data-testid":"banner",slot:e==null?void 0:e.Banner,context:{quoteData:a},children:W}),J=_(()=>{if(!a)return null;const i=le()||"en-US",d=new Intl.DateTimeFormat(i,{year:"numeric",month:"long",day:"numeric"});let r;try{r=d.format(new Date(a.expirationDate))}catch{r=a.expirationDate}return u(s,{name:"Details",slot:e==null?void 0:e.Details,context:{quoteData:a},children:[u("div",{className:"quote-management-manage-negotiable-quote__detail",children:[t("span",{className:"quote-management-manage-negotiable-quote__detail-title","data-testid":"created-label",children:n.createdLabel}),u("span",{className:"quote-management-manage-negotiable-quote__detail-content","data-testid":"created-value",children:[d.format(new Date(a.createdAt))," (",a.buyer.firstname," ",a.buyer.lastname,")"]})]}),u("div",{className:"quote-management-manage-negotiable-quote__detail",children:[t("span",{className:"quote-management-manage-negotiable-quote__detail-title","data-testid":"sales-rep-label",children:n.salesRepLabel}),t("span",{className:"quote-management-manage-negotiable-quote__detail-content","data-testid":"sales-rep-value",children:a.salesRepName})]}),u("div",{className:"quote-management-manage-negotiable-quote__detail",children:[t("span",{className:"quote-management-manage-negotiable-quote__detail-title","data-testid":"expires-label",children:n.expiresLabel}),t("span",{className:"quote-management-manage-negotiable-quote__detail-content","data-testid":"expires-value",children:r})]})]})},[e==null?void 0:e.Details,n,a]),z=_(()=>[{label:n.close,value:"close"},{label:n.delete,value:"delete",disabled:!(a!=null&&a.canDelete)},{label:n.print,value:"print"},{label:n.createTemplate,value:"createTemplate"},{label:n.createCopy,value:"createCopy"}],[n,a==null?void 0:a.canDelete]),K=_(()=>{const i=r=>{p==null||p(r)},d=r=>{switch(r){case"close":o==null||o(r);break;case"delete":M(!0),o==null||o(r);break;case"print":o==null||o(r);break;case"createTemplate":o==null||o(r);break;case"createCopy":o==null||o(r);break}};return t(s,{name:"ActionBar",slot:e==null?void 0:e.ActionBar,context:{quoteData:a},children:t(qe,{dropdownPlaceholder:n.actionsLabel,dropdownOptions:[{label:n.remove,value:"remove"}],handleDropdownChange:i,buttons:z.map(r=>t(C,{variant:"tertiary",onClick:()=>d(r.value),"data-testid":`actions-bar-${r.value}-button`,"data-action":r.value,disabled:r.disabled,children:r.label},r.value))})})},[z,n,e==null?void 0:e.ActionBar,a,p,o]),Y=_(()=>t(s,{name:"QuoteContent",slot:e==null?void 0:e.QuoteContent,context:{quoteData:a},children:t(Te,{tabs:new Map([["items-quoted","Items Quoted"],["comments","Comments"],["history-log","History Log"]]),tabsContent:new Map([["items-quoted",t(s,{name:"ItemsQuotedTab",slot:e==null?void 0:e.ItemsQuotedTab,context:{quoteData:a},children:t(pe,{quoteData:a})},"items-quoted")],["comments",t(s,{name:"CommentsTab",slot:e==null?void 0:e.CommentsTab,context:{quoteData:a},children:t(Me,{quoteData:a})},"comments")],["history-log",t(s,{name:"HistoryLogTab",slot:e==null?void 0:e.HistoryLogTab,context:{quoteData:a},children:t(fe,{quoteData:a})},"history-log")]])})}),[e==null?void 0:e.QuoteContent,e==null?void 0:e.HistoryLogTab,e==null?void 0:e.CommentsTab,e==null?void 0:e.ItemsQuotedTab,a]),Z=_(()=>t(s,{name:"ShippingInformationTitle",slot:e==null?void 0:e.ShippingInformationTitle,context:{quoteData:a},children:t("h2",{children:n.shippingInformationTitle})}),[e==null?void 0:e.ShippingInformationTitle,a,n]),O=_(()=>t(s,{name:"ShippingInformation",slot:e==null?void 0:e.ShippingInformation,context:{quoteData:a,loading:b,setLoading:l},children:t(be,{quoteData:a,loading:b,"data-testid":"manage-quote-shipping-address"})}),[e==null?void 0:e.ShippingInformation,a,b,l]),B=_(()=>t(s,{name:"QuoteCommentsTitle",slot:e==null?void 0:e.QuoteCommentsTitle,context:{quoteData:a},children:t("h2",{children:n.quoteCommentsTitle})}),[e==null?void 0:e.QuoteCommentsTitle,n,a]),A=_(()=>t(s,{name:"QuoteComments",slot:e==null?void 0:e.QuoteComments,context:{quoteData:a},children:t(se,{name:"quoteComments",placeholder:n.quoteCommentsPlaceholder,rows:3,value:y,onInput:i=>{P(i.target.value)},disabled:x})}),[e==null?void 0:e.QuoteComments,n,a,y,x]),U=T(async()=>{if(h){h({quoteData:a,comment:y.trim()||void 0});return}L(!0);try{await he({quoteUid:a.uid,comment:y.trim()||void 0})}catch(i){console.error("Failed to send quote for review:",i),L(!1)}},[a,h,y]),ee=_(()=>t(s,{name:"Footer",slot:e==null?void 0:e.Footer,context:{quoteData:a,comment:y,isSubmitting:x},children:t(C,{variant:"primary",onClick:U,"data-testid":"send-for-review-button",disabled:!(a!=null&&a.canSendForReview)||x||!a,children:n.sendForReview})}),[e==null?void 0:e.Footer,n,a,y,x,U]),w=T(i=>i.errors&&Array.isArray(i.errors)&&i.errors.length>0?i.errors[0].message||n.confirmationModalDeleteErrorFallback:(i==null?void 0:i.message)||n.confirmationModalDeleteErrorFallback,[n.confirmationModalDeleteErrorFallback]),ae=T(()=>{M(!1),q(null),D(!1)},[]),te=T(async()=>{if(a!=null&&a.uid){q(null),D(!1);try{const{operationResults:i}=await Ne(a.uid),d=i.find(r=>r.__typename==="DeleteNegotiableQuoteOperationFailure");if(d){const r=w(d);q(r);return}D(!0)}catch(i){const d=w(i);q(d)}}},[a,w]),ne=T(()=>{q(null)},[]),ie=T(()=>{D(!1)},[]),oe=Q?t(E,{type:"error",variant:"primary",icon:t(k,{}),heading:n.confirmationModalDeleteErrorHeading,description:Q,onDismiss:ne,"data-testid":"confirmation-modal-error-banner"}):null,j=(I?t(E,{type:"success",variant:"primary",icon:t(_e,{}),heading:n.confirmationModalDeleteSuccessHeading,description:n.confirmationModalDeleteSuccessDescription,onDismiss:ie,"data-testid":"confirmation-modal-success-banner"}):null)||oe,re={...g,loading:b,quoteName:$,quoteStatus:V,banner:X||void 0,details:J,actionBar:K,quoteContent:Y,shippingInformationTitle:Z,shippingInformation:O,quoteCommentsTitle:B,quoteComments:A,footer:ee};return u(me,{children:[t(ve,{...re}),c&&ce(t(ye,{open:c,title:n.confirmationModalDeleteTitle,message:n.confirmationModalDeleteMessage,cancelLabel:n.confirmationModalCancel,confirmLabel:n.confirmationModalDeleteConfirm,onCancel:ae,onConfirm:te,showCloseButton:!j,confirmationBanner:j}),document.body)]})};export{Oe as ManageNegotiableQuote,Oe as default};
4
4
  //# sourceMappingURL=ManageNegotiableQuote.js.map