@dropins/storefront-quote-management 1.0.0 → 1.1.0-beta1

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 (35) hide show
  1. package/api/graphql/NegotiableQuoteTemplateFragment.d.ts +1 -1
  2. package/api/index.d.ts +1 -0
  3. package/api/setQuoteTemplateExpirationDate/graphql/setQuoteTemplateExpirationDate.d.ts +10 -0
  4. package/api/setQuoteTemplateExpirationDate/index.d.ts +10 -0
  5. package/api/setQuoteTemplateExpirationDate/setQuoteTemplateExpirationDate.d.ts +8 -0
  6. package/api.js +4 -4
  7. package/api.js.map +1 -1
  8. package/chunks/ItemsQuotedTemplate.js +1 -1
  9. package/chunks/ItemsQuotedTemplate.js.map +1 -1
  10. package/chunks/LineItemNoteModal.js +1 -1
  11. package/chunks/LineItemNoteModal.js.map +1 -1
  12. package/chunks/NegotiableQuoteFragment.js +4 -0
  13. package/chunks/NegotiableQuoteFragment.js.map +1 -1
  14. package/chunks/NegotiableQuoteTemplateFragment.js +4 -0
  15. package/chunks/NegotiableQuoteTemplateFragment.js.map +1 -1
  16. package/chunks/dateUtils.js +1 -1
  17. package/chunks/dateUtils.js.map +1 -1
  18. package/chunks/openQuoteTemplate.js +20 -10
  19. package/chunks/openQuoteTemplate.js.map +1 -1
  20. package/chunks/transform-quote.js +1 -1
  21. package/chunks/transform-quote.js.map +1 -1
  22. package/components/ExpirationDateModal/ExpirationDateModal.d.ts +16 -0
  23. package/components/ExpirationDateModal/index.d.ts +11 -0
  24. package/components/index.d.ts +1 -0
  25. package/containers/ManageNegotiableQuoteTemplate.js +2 -2
  26. package/containers/ManageNegotiableQuoteTemplate.js.map +1 -1
  27. package/data/models/negotiable-quote-model.d.ts +4 -0
  28. package/data/transforms/__fixtures__/negotiableQuoteData.d.ts +16 -0
  29. package/data/transforms/__fixtures__/negotiableQuoteTemplateData.d.ts +60 -0
  30. package/hooks/useExpirationDate.d.ts +64 -0
  31. package/hooks/useItemsQuotedTemplate.d.ts +1 -0
  32. package/i18n/en_US.json.d.ts +12 -0
  33. package/package.json +1 -1
  34. package/render.js +3 -2
  35. package/render.js.map +1 -1
@@ -1 +1 @@
1
- {"version":3,"file":"NegotiableQuoteTemplateFragment.js","sources":["/@dropins/storefront-quote-management/src/api/graphql/NegotiableQuoteTemplateFragment.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_TEMPLATE_FRAGMENT = /* GraphQL */ `\n fragment NegotiableQuoteTemplateFragment on NegotiableQuoteTemplate {\n uid\n template_id\n name\n created_at\n updated_at\n status\n sales_rep_name\n expiration_date\n buyer {\n firstname\n lastname\n }\n comments {\n uid\n created_at\n author {\n firstname\n lastname\n }\n text\n attachments {\n name\n url\n }\n }\n items {\n __typename\n uid\n product {\n name\n sku\n uid\n stock_status\n quantity\n thumbnail {\n label\n url\n }\n price_range {\n minimum_price {\n regular_price {\n value\n currency\n }\n final_price {\n value\n currency\n }\n discount {\n percent_off\n amount_off\n }\n }\n maximum_price {\n regular_price {\n value\n currency\n }\n final_price {\n value\n currency\n }\n discount {\n percent_off\n amount_off\n }\n }\n }\n price_tiers {\n quantity\n final_price {\n value\n }\n discount {\n amount_off\n percent_off\n }\n }\n }\n prices {\n price {\n currency\n value\n }\n price_including_tax {\n value\n currency\n }\n original_item_price {\n currency\n value\n }\n original_row_total {\n currency\n value\n }\n row_total {\n currency\n value\n }\n row_total_including_tax {\n value\n currency\n }\n catalog_discount {\n amount_off\n percent_off\n }\n discounts {\n label\n value\n amount {\n currency\n value\n }\n }\n }\n quantity\n is_available\n note_from_buyer {\n created_at\n creator_id\n creator_type\n negotiable_quote_item_uid\n note\n note_uid\n __typename\n }\n note_from_seller {\n created_at\n creator_id\n creator_type\n negotiable_quote_item_uid\n note\n note_uid\n __typename\n }\n ... on SimpleCartItem {\n customizable_options {\n type\n label\n values {\n label\n value\n }\n }\n }\n ... on ConfigurableCartItem {\n configurable_options {\n option_label\n value_label\n }\n configured_variant {\n uid\n sku\n stock_status\n thumbnail {\n label\n url\n }\n price_range {\n minimum_price {\n regular_price {\n value\n currency\n }\n final_price {\n value\n currency\n }\n discount {\n percent_off\n amount_off\n }\n }\n maximum_price {\n regular_price {\n value\n currency\n }\n final_price {\n value\n currency\n }\n discount {\n percent_off\n amount_off\n }\n }\n }\n price_tiers {\n quantity\n final_price {\n value\n }\n discount {\n amount_off\n percent_off\n }\n }\n }\n customizable_options {\n type\n label\n values {\n label\n value\n }\n }\n }\n ... on BundleCartItem {\n bundle_options {\n label\n values {\n label\n quantity\n original_price {\n currency\n value\n }\n priceV2 {\n currency\n value\n }\n }\n }\n }\n ... on DownloadableCartItem {\n links {\n sort_order\n title\n }\n customizable_options {\n type\n label\n values {\n label\n value\n }\n }\n }\n }\n history {\n uid\n created_at\n author {\n firstname\n lastname\n }\n change_type\n changes {\n comment_added {\n comment\n }\n custom_changes {\n new_value\n old_value\n title\n }\n statuses {\n changes {\n new_status\n old_status\n }\n }\n expiration {\n new_expiration\n old_expiration\n }\n total {\n new_price {\n currency\n value\n }\n old_price {\n currency\n value\n }\n }\n }\n }\n prices {\n subtotal_excluding_tax {\n currency\n value\n }\n subtotal_including_tax {\n currency\n value\n }\n subtotal_with_discount_excluding_tax {\n currency\n value\n }\n applied_taxes {\n amount {\n currency\n value\n }\n label\n }\n grand_total {\n currency\n value\n }\n }\n shipping_addresses {\n uid\n firstname\n lastname\n company\n street\n city\n region {\n code\n label\n region_id\n }\n postcode\n country {\n code\n label\n }\n telephone\n }\n reference_document_links {\n link_id\n document_name\n document_identifier\n reference_document_url\n }\n }\n`;\n"],"names":["NEGOTIABLE_QUOTE_TEMPLATE_FRAGMENT"],"mappings":"AASO,MAAMA,EAAmD;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AA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AAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;"}
1
+ {"version":3,"file":"NegotiableQuoteTemplateFragment.js","sources":["/@dropins/storefront-quote-management/src/api/graphql/NegotiableQuoteTemplateFragment.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_TEMPLATE_FRAGMENT = /* GraphQL */ `\n fragment NegotiableQuoteTemplateFragment on NegotiableQuoteTemplate {\n uid\n template_id\n name\n created_at\n updated_at\n status\n sales_rep_name\n expiration_date\n buyer {\n firstname\n lastname\n }\n comments {\n uid\n created_at\n author {\n firstname\n lastname\n }\n text\n attachments {\n name\n url\n }\n }\n items {\n __typename\n uid\n product {\n name\n sku\n uid\n stock_status\n quantity\n thumbnail {\n label\n url\n }\n price_range {\n minimum_price {\n regular_price {\n value\n currency\n }\n final_price {\n value\n currency\n }\n discount {\n percent_off\n amount_off\n }\n }\n maximum_price {\n regular_price {\n value\n currency\n }\n final_price {\n value\n currency\n }\n discount {\n percent_off\n amount_off\n }\n }\n }\n price_tiers {\n quantity\n final_price {\n value\n }\n discount {\n amount_off\n percent_off\n }\n }\n }\n prices {\n price {\n currency\n value\n }\n price_including_tax {\n value\n currency\n }\n original_item_price {\n currency\n value\n }\n original_row_total {\n currency\n value\n }\n row_total {\n currency\n value\n }\n row_total_including_tax {\n value\n currency\n }\n catalog_discount {\n amount_off\n percent_off\n }\n row_catalog_discount {\n amount_off\n percent_off\n }\n discounts {\n label\n value\n amount {\n currency\n value\n }\n }\n }\n quantity\n is_available\n note_from_buyer {\n created_at\n creator_id\n creator_type\n negotiable_quote_item_uid\n note\n note_uid\n __typename\n }\n note_from_seller {\n created_at\n creator_id\n creator_type\n negotiable_quote_item_uid\n note\n note_uid\n __typename\n }\n ... on SimpleCartItem {\n customizable_options {\n type\n label\n values {\n label\n value\n }\n }\n }\n ... on ConfigurableCartItem {\n configurable_options {\n option_label\n value_label\n }\n configured_variant {\n uid\n sku\n stock_status\n thumbnail {\n label\n url\n }\n price_range {\n minimum_price {\n regular_price {\n value\n currency\n }\n final_price {\n value\n currency\n }\n discount {\n percent_off\n amount_off\n }\n }\n maximum_price {\n regular_price {\n value\n currency\n }\n final_price {\n value\n currency\n }\n discount {\n percent_off\n amount_off\n }\n }\n }\n price_tiers {\n quantity\n final_price {\n value\n }\n discount {\n amount_off\n percent_off\n }\n }\n }\n customizable_options {\n type\n label\n values {\n label\n value\n }\n }\n }\n ... on BundleCartItem {\n bundle_options {\n label\n values {\n label\n quantity\n original_price {\n currency\n value\n }\n priceV2 {\n currency\n value\n }\n }\n }\n }\n ... on DownloadableCartItem {\n links {\n sort_order\n title\n }\n customizable_options {\n type\n label\n values {\n label\n value\n }\n }\n }\n }\n history {\n uid\n created_at\n author {\n firstname\n lastname\n }\n change_type\n changes {\n comment_added {\n comment\n }\n custom_changes {\n new_value\n old_value\n title\n }\n statuses {\n changes {\n new_status\n old_status\n }\n }\n expiration {\n new_expiration\n old_expiration\n }\n total {\n new_price {\n currency\n value\n }\n old_price {\n currency\n value\n }\n }\n }\n }\n prices {\n subtotal_excluding_tax {\n currency\n value\n }\n subtotal_including_tax {\n currency\n value\n }\n subtotal_with_discount_excluding_tax {\n currency\n value\n }\n applied_taxes {\n amount {\n currency\n value\n }\n label\n }\n grand_total {\n currency\n value\n }\n }\n shipping_addresses {\n uid\n firstname\n lastname\n company\n street\n city\n region {\n code\n label\n region_id\n }\n postcode\n country {\n code\n label\n }\n telephone\n }\n reference_document_links {\n link_id\n document_name\n document_identifier\n reference_document_url\n }\n }\n`;\n"],"names":["NEGOTIABLE_QUOTE_TEMPLATE_FRAGMENT"],"mappings":"AASO,MAAMA,EAAmD;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AA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AAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;"}
@@ -1,4 +1,4 @@
1
1
  /*! Copyright 2026 Adobe
2
2
  All Rights Reserved. */
3
- import{getGlobalLocale as n}from"@dropins/tools/lib.js";function a(){try{return Intl.DateTimeFormat().resolvedOptions().timeZone}catch(e){return console.warn("Failed to detect user timezone, falling back to UTC:",e),"UTC"}}function o(e){const t=new Date(e);return!isNaN(t.getTime())}function c(e,t="short"){if(!o(e))return"–";const r=n()||"en-US";return t==="short"?new Date(e).toLocaleDateString(r,{year:"numeric",month:"numeric",day:"numeric"}):new Date(e).toLocaleDateString(r,{year:"numeric",month:"long",day:"numeric",hour:"2-digit",minute:"2-digit",second:"2-digit",hour12:!0})}export{c as f,a as g};
3
+ import{getGlobalLocale as c}from"@dropins/tools/lib.js";function l(){try{return Intl.DateTimeFormat().resolvedOptions().timeZone}catch(e){return console.warn("Failed to detect user timezone, falling back to UTC:",e),"UTC"}}function m(e){const r=new Date(e);return!isNaN(r.getTime())}function s(e,r="short"){if(!m(e))return"–";const n=c()||"en-US";let t;if(/^\d{4}-\d{2}-\d{2}$/.test(e)){const[o,a,i]=e.split("-").map(Number);t=new Date(o,a-1,i)}else t=new Date(e);return r==="short"?t.toLocaleDateString(n,{year:"numeric",month:"numeric",day:"numeric"}):t.toLocaleDateString(n,{year:"numeric",month:"long",day:"numeric",hour:"2-digit",minute:"2-digit",second:"2-digit",hour12:!0})}export{s as f,l as g};
4
4
  //# sourceMappingURL=dateUtils.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"dateUtils.js","sources":["/@dropins/storefront-quote-management/src/utils/dateUtils.ts"],"sourcesContent":["/********************************************************************\n * Copyright 2025 Adobe\n * All Rights Reserved.\n *\n * NOTICE: Adobe permits you to use, modify, and distribute this\n * file in accordance with the terms of the Adobe license agreement\n * accompanying it.\n *******************************************************************/\n\nimport { getGlobalLocale } from \"@adobe-commerce/elsie/lib\";\n\n/**\n * Gets the user's timezone with fallback to UTC if detection fails\n * @returns The user's timezone string (e.g., 'America/New_York') or 'UTC' as fallback\n */\nexport function getUserTimezone(): string {\n try {\n return Intl.DateTimeFormat().resolvedOptions().timeZone;\n } catch (error) {\n console.warn('Failed to detect user timezone, falling back to UTC:', error);\n return 'UTC';\n }\n}\n\n/**\n * Checks if a date string is a valid date\n * @param dateString - The date string to check\n * @returns True if the date string is a valid date, false otherwise\n */\nexport function isValidDate(dateString: string): boolean {\n const date = new Date(dateString);\n return !isNaN(date.getTime());\n}\n\n/**\n * Formats a date string to locale date string, returning \"–\" for invalid dates\n * @param dateString - The date string to format\n * @returns Formatted date string or \"–\" for invalid dates\n */\nexport function formattedDate(dateString: string, type: 'short' | 'long' = 'short'): string {\n if (!isValidDate(dateString)) {\n return '–';\n }\n\n const locale = getGlobalLocale() || 'en-US';\n\n if (type === 'short') {\n return new Date(dateString).toLocaleDateString(locale, {\n year: 'numeric',\n month: 'numeric',\n day: 'numeric',\n });\n }\n\n return new Date(dateString).toLocaleDateString(locale, {\n year: 'numeric',\n month: 'long',\n day: 'numeric',\n hour: '2-digit',\n minute: '2-digit',\n second: '2-digit',\n hour12: true,\n });\n}\n"],"names":["getUserTimezone","error","isValidDate","dateString","date","formattedDate","type","locale","getGlobalLocale"],"mappings":"wDAeO,SAASA,GAA0B,CACxC,GAAI,CACF,OAAO,KAAK,iBAAiB,gBAAA,EAAkB,QACjD,OAASC,EAAO,CACd,eAAQ,KAAK,uDAAwDA,CAAK,EACnE,KACT,CACF,CAOO,SAASC,EAAYC,EAA6B,CACvD,MAAMC,EAAO,IAAI,KAAKD,CAAU,EAChC,MAAO,CAAC,MAAMC,EAAK,SAAS,CAC9B,CAOO,SAASC,EAAcF,EAAoBG,EAAyB,QAAiB,CAC1F,GAAI,CAACJ,EAAYC,CAAU,EACzB,MAAO,IAGT,MAAMI,EAASC,KAAqB,QAEpC,OAAIF,IAAS,QACJ,IAAI,KAAKH,CAAU,EAAE,mBAAmBI,EAAQ,CACrD,KAAM,UACN,MAAO,UACP,IAAK,SAAA,CACN,EAGI,IAAI,KAAKJ,CAAU,EAAE,mBAAmBI,EAAQ,CACrD,KAAM,UACN,MAAO,OACP,IAAK,UACL,KAAM,UACN,OAAQ,UACR,OAAQ,UACR,OAAQ,EAAA,CACT,CACH"}
1
+ {"version":3,"file":"dateUtils.js","sources":["/@dropins/storefront-quote-management/src/utils/dateUtils.ts"],"sourcesContent":["/********************************************************************\n * Copyright 2025 Adobe\n * All Rights Reserved.\n *\n * NOTICE: Adobe permits you to use, modify, and distribute this\n * file in accordance with the terms of the Adobe license agreement\n * accompanying it.\n *******************************************************************/\n\nimport { getGlobalLocale } from \"@adobe-commerce/elsie/lib\";\n\n/**\n * Gets the user's timezone with fallback to UTC if detection fails\n * @returns The user's timezone string (e.g., 'America/New_York') or 'UTC' as fallback\n */\nexport function getUserTimezone(): string {\n try {\n return Intl.DateTimeFormat().resolvedOptions().timeZone;\n } catch (error) {\n console.warn('Failed to detect user timezone, falling back to UTC:', error);\n return 'UTC';\n }\n}\n\n/**\n * Checks if a date string is a valid date\n * @param dateString - The date string to check\n * @returns True if the date string is a valid date, false otherwise\n */\nexport function isValidDate(dateString: string): boolean {\n const date = new Date(dateString);\n return !isNaN(date.getTime());\n}\n\n/**\n * Formats a date string to locale date string, returning \"–\" for invalid dates\n * @param dateString - The date string to format\n * @returns Formatted date string or \"–\" for invalid dates\n */\nexport function formattedDate(dateString: string, type: 'short' | 'long' = 'short'): string {\n if (!isValidDate(dateString)) {\n return '–';\n }\n\n const locale = getGlobalLocale() || 'en-US';\n \n // For dates in YYYY-MM-DD format (like expiration dates), parse as local date to avoid timezone issues\n // This prevents dates from shifting when displayed in different timezones\n let date: Date;\n if (/^\\d{4}-\\d{2}-\\d{2}$/.test(dateString)) {\n // Parse as local date (not UTC) to avoid timezone conversion\n const [year, month, day] = dateString.split('-').map(Number);\n date = new Date(year, month - 1, day);\n } else {\n // For ISO timestamps or other formats, parse normally\n date = new Date(dateString);\n }\n\n if (type === 'short') {\n return date.toLocaleDateString(locale, {\n year: 'numeric',\n month: 'numeric',\n day: 'numeric',\n });\n }\n\n return date.toLocaleDateString(locale, {\n year: 'numeric',\n month: 'long',\n day: 'numeric',\n hour: '2-digit',\n minute: '2-digit',\n second: '2-digit',\n hour12: true,\n });\n}\n"],"names":["getUserTimezone","error","isValidDate","dateString","date","formattedDate","type","locale","getGlobalLocale","year","month","day"],"mappings":"wDAeO,SAASA,GAA0B,CACxC,GAAI,CACF,OAAO,KAAK,iBAAiB,gBAAA,EAAkB,QACjD,OAASC,EAAO,CACd,eAAQ,KAAK,uDAAwDA,CAAK,EACnE,KACT,CACF,CAOO,SAASC,EAAYC,EAA6B,CACvD,MAAMC,EAAO,IAAI,KAAKD,CAAU,EAChC,MAAO,CAAC,MAAMC,EAAK,SAAS,CAC9B,CAOO,SAASC,EAAcF,EAAoBG,EAAyB,QAAiB,CAC1F,GAAI,CAACJ,EAAYC,CAAU,EACzB,MAAO,IAGT,MAAMI,EAASC,KAAqB,QAIpC,IAAIJ,EACJ,GAAI,sBAAsB,KAAKD,CAAU,EAAG,CAE1C,KAAM,CAACM,EAAMC,EAAOC,CAAG,EAAIR,EAAW,MAAM,GAAG,EAAE,IAAI,MAAM,EAC3DC,EAAO,IAAI,KAAKK,EAAMC,EAAQ,EAAGC,CAAG,CACtC,MAEEP,EAAO,IAAI,KAAKD,CAAU,EAG5B,OAAIG,IAAS,QACJF,EAAK,mBAAmBG,EAAQ,CACrC,KAAM,UACN,MAAO,UACP,IAAK,SAAA,CACN,EAGIH,EAAK,mBAAmBG,EAAQ,CACrC,KAAM,UACN,MAAO,OACP,IAAK,UACL,KAAM,UACN,OAAQ,UACR,OAAQ,UACR,OAAQ,EAAA,CACT,CACH"}
@@ -1,6 +1,6 @@
1
1
  /*! Copyright 2026 Adobe
2
2
  All Rights Reserved. */
3
- import{events as l}from"@dropins/tools/event-bus.js";import{a as p}from"./transform-quote-template.js";import{s as r}from"./state.js";import{N as u}from"./NegotiableQuoteTemplateFragment.js";import{f as d}from"./transform-quote.js";const s=`
3
+ import{events as i}from"@dropins/tools/event-bus.js";import{a as d}from"./transform-quote-template.js";import{s as r}from"./state.js";import{N as T}from"./NegotiableQuoteTemplateFragment.js";import{f as m}from"./transform-quote.js";const s=`
4
4
  mutation SEND_QUOTE_TEMPLATE_FOR_REVIEW_MUTATION(
5
5
  $templateId: ID!
6
6
  $comment: String
@@ -12,16 +12,26 @@ import{events as l}from"@dropins/tools/event-bus.js";import{a as p}from"./transf
12
12
  ...NegotiableQuoteTemplateFragment
13
13
  }
14
14
  }
15
- ${u}
16
- `,q=async t=>{var o,e,a;if(!t.templateId)throw new Error("Template ID is required");if(!r.authenticated)throw new Error("Unauthorized");try{const n=(o=t.referenceDocumentLinks)==null?void 0:o.map(m=>({link_id:m.uid,document_name:m.name,document_identifier:m.identifier,reference_document_url:m.url})),i=(e=t.attachments)!=null&&e.length?t.attachments.map(m=>({key:m.key})):void 0,c=await d(s,{variables:{templateId:t.templateId,name:t.name,comment:t.comment||void 0,referenceDocumentLinks:n,attachments:i}});if(!((a=c==null?void 0:c.data)!=null&&a.submitNegotiableQuoteTemplateForReview))throw new Error("No quote template data received");const T=p(c.data.submitNegotiableQuoteTemplateForReview);if(!T)throw new Error("Failed to transform quote template data");return l.emit("quote-management/quote-template-data",{quoteTemplate:T,permissions:r.permissions}),T}catch(n){return Promise.reject(n)}},E=`
15
+ ${T}
16
+ `,A=async t=>{var o,e,a;if(!t.templateId)throw new Error("Template ID is required");if(!r.authenticated)throw new Error("Unauthorized");try{const l=(o=t.referenceDocumentLinks)==null?void 0:o.map(n=>({link_id:n.uid,document_name:n.name,document_identifier:n.identifier,reference_document_url:n.url})),p=(e=t.attachments)!=null&&e.length?t.attachments.map(n=>({key:n.key})):void 0,c=await m(s,{variables:{templateId:t.templateId,name:t.name,comment:t.comment||void 0,referenceDocumentLinks:l,attachments:p}});if(!((a=c==null?void 0:c.data)!=null&&a.submitNegotiableQuoteTemplateForReview))throw new Error("No quote template data received");const u=d(c.data.submitNegotiableQuoteTemplateForReview);if(!u)throw new Error("Failed to transform quote template data");return i.emit("quote-management/quote-template-data",{quoteTemplate:u,permissions:r.permissions}),u}catch(l){return Promise.reject(l)}},E=`
17
+ mutation SET_QUOTE_TEMPLATE_EXPIRATION_DATE_MUTATION(
18
+ $templateId: ID!
19
+ $expirationDate: String!
20
+ ) {
21
+ setQuoteTemplateExpirationDate(input: { template_id: $templateId, expiration_date: $expirationDate }) {
22
+ ...NegotiableQuoteTemplateFragment
23
+ }
24
+ }
25
+ ${T}
26
+ `,q=async t=>{var o;if(!r.authenticated)throw new Error("Unauthorized");if(!t.templateId)throw new Error("Template ID is required");if(!t.expirationDate)throw new Error("Expiration date is required");try{const e=await m(E,{variables:{templateId:t.templateId,expirationDate:t.expirationDate}});if(!((o=e==null?void 0:e.data)!=null&&o.setQuoteTemplateExpirationDate))throw new Error("Failed to set expiration date");const a=d(e.data.setQuoteTemplateExpirationDate);if(!a)throw new Error("Failed to transform quote template data");return i.emit("quote-management/quote-template-data",{quoteTemplate:a,permissions:r.permissions}),a}catch(e){return Promise.reject(e)}},I=`
17
27
  mutation ACCEPT_QUOTE_TEMPLATE_MUTATION($templateId: ID!) {
18
28
  acceptNegotiableQuoteTemplate(input: { template_id: $templateId }) {
19
29
  ...NegotiableQuoteTemplateFragment
20
30
  }
21
31
  }
22
32
 
23
- ${u}
24
- `,b=async t=>{var o;if(!t.templateId)throw new Error("Template ID is required");if(!r.authenticated)throw new Error("Unauthorized");try{const e=await d(E,{variables:{templateId:t.templateId}});if(!((o=e==null?void 0:e.data)!=null&&o.acceptNegotiableQuoteTemplate))throw new Error("No quote template data received");const a=p(e.data.acceptNegotiableQuoteTemplate);if(!a)throw new Error("Failed to transform quote template data");return l.emit("quote-management/quote-template-data",{quoteTemplate:a,permissions:r.permissions}),a}catch(e){return Promise.reject(e)}},I=`
33
+ ${T}
34
+ `,O=async t=>{var o;if(!t.templateId)throw new Error("Template ID is required");if(!r.authenticated)throw new Error("Unauthorized");try{const e=await m(I,{variables:{templateId:t.templateId}});if(!((o=e==null?void 0:e.data)!=null&&o.acceptNegotiableQuoteTemplate))throw new Error("No quote template data received");const a=d(e.data.acceptNegotiableQuoteTemplate);if(!a)throw new Error("Failed to transform quote template data");return i.emit("quote-management/quote-template-data",{quoteTemplate:a,permissions:r.permissions}),a}catch(e){return Promise.reject(e)}},_=`
25
35
  mutation CANCEL_QUOTE_TEMPLATE_MUTATION(
26
36
  $templateId: ID!
27
37
  $comment: String
@@ -35,18 +45,18 @@ import{events as l}from"@dropins/tools/event-bus.js";import{a as p}from"./transf
35
45
  ...NegotiableQuoteTemplateFragment
36
46
  }
37
47
  }
38
- ${u}
39
- `,A=async t=>{var o;if(!t.templateId)throw new Error("Template ID is required");if(!r.authenticated)throw new Error("Unauthorized");try{const e=await d(I,{variables:{templateId:t.templateId,comment:t.comment}});if(!((o=e==null?void 0:e.data)!=null&&o.cancelNegotiableQuoteTemplate))throw new Error("No quote template data received");const a=p(e.data.cancelNegotiableQuoteTemplate);if(!a)throw new Error("Failed to transform quote template data");return l.emit("quote-management/quote-template-data",{quoteTemplate:a,permissions:r.permissions}),a}catch(e){return Promise.reject(e)}},_=`
48
+ ${T}
49
+ `,b=async t=>{var o;if(!t.templateId)throw new Error("Template ID is required");if(!r.authenticated)throw new Error("Unauthorized");try{const e=await m(_,{variables:{templateId:t.templateId,comment:t.comment}});if(!((o=e==null?void 0:e.data)!=null&&o.cancelNegotiableQuoteTemplate))throw new Error("No quote template data received");const a=d(e.data.cancelNegotiableQuoteTemplate);if(!a)throw new Error("Failed to transform quote template data");return i.emit("quote-management/quote-template-data",{quoteTemplate:a,permissions:r.permissions}),a}catch(e){return Promise.reject(e)}},w=`
40
50
  mutation DELETE_QUOTE_TEMPLATE_MUTATION($templateId: ID!) {
41
51
  deleteNegotiableQuoteTemplate(input: { template_id: $templateId })
42
52
  }
43
- `,O=async t=>{var o;if(!t.templateId)throw new Error("Template ID is required");if(!r.authenticated)throw new Error("Unauthorized");try{const e=await d(_,{variables:{templateId:t.templateId}});if(e!=null&&e.errors&&e.errors.length>0){const n=e.errors.map(i=>i==null?void 0:i.message).filter(Boolean).join("; ");throw new Error(n||"Failed to delete quote template")}if(!((o=e==null?void 0:e.data)==null?void 0:o.deleteNegotiableQuoteTemplate))throw new Error("Failed to delete quote template");return l.emit("quote-management/quote-template-deleted",{templateId:t.templateId}),{templateId:t.templateId}}catch(e){return Promise.reject(e)}},w=`
53
+ `,U=async t=>{var o;if(!t.templateId)throw new Error("Template ID is required");if(!r.authenticated)throw new Error("Unauthorized");try{const e=await m(w,{variables:{templateId:t.templateId}});if(e!=null&&e.errors&&e.errors.length>0){const l=e.errors.map(p=>p==null?void 0:p.message).filter(Boolean).join("; ");throw new Error(l||"Failed to delete quote template")}if(!((o=e==null?void 0:e.data)==null?void 0:o.deleteNegotiableQuoteTemplate))throw new Error("Failed to delete quote template");return i.emit("quote-management/quote-template-deleted",{templateId:t.templateId}),{templateId:t.templateId}}catch(e){return Promise.reject(e)}},h=`
44
54
  mutation OPEN_QUOTE_TEMPLATE_MUTATION($templateId: ID!) {
45
55
  openNegotiableQuoteTemplate(input: { template_id: $templateId }) {
46
56
  ...NegotiableQuoteTemplateFragment
47
57
  }
48
58
  }
49
59
 
50
- ${u}
51
- `,U=async t=>{var o;if(!t.templateId)throw new Error("Template ID is required");if(!r.authenticated)throw new Error("Unauthorized");try{const e=await d(w,{variables:{templateId:t.templateId}});if(!((o=e==null?void 0:e.data)!=null&&o.openNegotiableQuoteTemplate))throw new Error("No quote template data received");const a=p(e.data.openNegotiableQuoteTemplate);if(!a)throw new Error("Failed to transform quote template data");return l.emit("quote-management/quote-template-data",{quoteTemplate:a,permissions:r.permissions}),a}catch(e){return Promise.reject(e)}};export{b as a,A as c,O as d,U as o,q as s};
60
+ ${T}
61
+ `,$=async t=>{var o;if(!t.templateId)throw new Error("Template ID is required");if(!r.authenticated)throw new Error("Unauthorized");try{const e=await m(h,{variables:{templateId:t.templateId}});if(!((o=e==null?void 0:e.data)!=null&&o.openNegotiableQuoteTemplate))throw new Error("No quote template data received");const a=d(e.data.openNegotiableQuoteTemplate);if(!a)throw new Error("Failed to transform quote template data");return i.emit("quote-management/quote-template-data",{quoteTemplate:a,permissions:r.permissions}),a}catch(e){return Promise.reject(e)}};export{A as a,O as b,b as c,U as d,$ as o,q as s};
52
62
  //# sourceMappingURL=openQuoteTemplate.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"openQuoteTemplate.js","sources":["/@dropins/storefront-quote-management/src/api/sendQuoteTemplateForReview/graphql/sendQuoteTemplateForReview.ts","/@dropins/storefront-quote-management/src/api/sendQuoteTemplateForReview/sendQuoteTemplateForReview.ts","/@dropins/storefront-quote-management/src/api/acceptQuoteTemplate/graphql/acceptQuoteTemplate.ts","/@dropins/storefront-quote-management/src/api/acceptQuoteTemplate/acceptQuoteTemplate.ts","/@dropins/storefront-quote-management/src/api/cancelQuoteTemplate/graphql/cancelQuoteTemplate.ts","/@dropins/storefront-quote-management/src/api/cancelQuoteTemplate/cancelQuoteTemplate.ts","/@dropins/storefront-quote-management/src/api/deleteQuoteTemplate/graphql/deleteQuoteTemplate.ts","/@dropins/storefront-quote-management/src/api/deleteQuoteTemplate/deleteQuoteTemplate.ts","/@dropins/storefront-quote-management/src/api/openQuoteTemplate/graphql/openQuoteTemplate.ts","/@dropins/storefront-quote-management/src/api/openQuoteTemplate/openQuoteTemplate.ts"],"sourcesContent":["/********************************************************************\n * Copyright 2025 Adobe\n * All Rights Reserved.\n *\n * NOTICE: Adobe permits you to use, modify, and distribute this \n * file in accordance with the terms of the Adobe license agreement \n * accompanying it. \n *******************************************************************/\n\nimport { NEGOTIABLE_QUOTE_TEMPLATE_FRAGMENT } from '@/quote-management/api/graphql/NegotiableQuoteTemplateFragment';\n\nexport const SEND_QUOTE_TEMPLATE_FOR_REVIEW_MUTATION = /* GraphQL */ `\n mutation SEND_QUOTE_TEMPLATE_FOR_REVIEW_MUTATION(\n $templateId: ID!\n $comment: String\n $name: String\n $referenceDocumentLinks: [NegotiableQuoteTemplateReferenceDocumentLinkInput]\n $attachments: [NegotiableQuoteCommentAttachmentInput]\n ) {\n submitNegotiableQuoteTemplateForReview(input: { template_id: $templateId, name: $name, comment: $comment, reference_document_links: $referenceDocumentLinks, attachments: $attachments }) {\n ...NegotiableQuoteTemplateFragment\n }\n }\n ${NEGOTIABLE_QUOTE_TEMPLATE_FRAGMENT}\n`;\n","/********************************************************************\n * Copyright 2025 Adobe\n * All Rights Reserved.\n *\n * NOTICE: Adobe permits you to use, modify, and distribute this\n * file in accordance with the terms of the Adobe license agreement\n * accompanying it.\n *******************************************************************/\n\nimport { fetchGraphQl } from '@/quote-management/api';\nimport { SEND_QUOTE_TEMPLATE_FOR_REVIEW_MUTATION } from './graphql/sendQuoteTemplateForReview';\nimport { transformQuoteTemplate } from '@/quote-management/data/transforms';\nimport { state } from '@/quote-management/lib/state';\nimport { events } from '@adobe-commerce/event-bus';\n\nexport interface ReferenceDocumentLinkInput {\n uid?: string;\n name: string;\n identifier?: string;\n url: string;\n}\n\nexport interface SendQuoteTemplateForReviewParams {\n templateId: string;\n name?: string;\n comment?: string;\n referenceDocumentLinks?: ReferenceDocumentLinkInput[];\n attachments?: { key: string }[];\n}\n\nexport const sendQuoteTemplateForReview = async (\n params: SendQuoteTemplateForReviewParams\n) => {\n if (!params.templateId) {\n throw new Error('Template ID is required');\n }\n\n if (!state.authenticated) {\n throw new Error('Unauthorized');\n }\n\n try {\n // Transform reference document links from camelCase to snake_case for GraphQL\n const referenceDocumentLinks = params.referenceDocumentLinks?.map((link) => ({\n link_id: link.uid,\n document_name: link.name,\n document_identifier: link.identifier,\n reference_document_url: link.url,\n }));\n\n // Format attachments for GraphQL (separate field, not nested in comment)\n const attachments = params.attachments?.length \n ? params.attachments.map(att => ({ key: att.key }))\n : undefined;\n\n const results: any = await fetchGraphQl(\n SEND_QUOTE_TEMPLATE_FOR_REVIEW_MUTATION,\n {\n variables: {\n templateId: params.templateId,\n name: params.name,\n comment: params.comment || undefined,\n referenceDocumentLinks,\n attachments,\n },\n }\n );\n\n if (!results?.data?.submitNegotiableQuoteTemplateForReview) {\n throw new Error('No quote template data received');\n }\n\n const transformedData = transformQuoteTemplate(\n results.data.submitNegotiableQuoteTemplateForReview\n );\n\n if (!transformedData) {\n throw new Error('Failed to transform quote template data');\n }\n\n events.emit('quote-management/quote-template-data', {\n quoteTemplate: transformedData,\n permissions: state.permissions,\n });\n\n return transformedData;\n } catch (error) {\n return Promise.reject(error);\n }\n};\n","/********************************************************************\n * Copyright 2025 Adobe\n * All Rights Reserved.\n *\n * NOTICE: Adobe permits you to use, modify, and distribute this \n * file in accordance with the terms of the Adobe license agreement \n * accompanying it. \n *******************************************************************/\n\nimport { NEGOTIABLE_QUOTE_TEMPLATE_FRAGMENT } from '@/quote-management/api/graphql/NegotiableQuoteTemplateFragment';\n\nexport const ACCEPT_QUOTE_TEMPLATE_MUTATION = /* GraphQL */ `\n mutation ACCEPT_QUOTE_TEMPLATE_MUTATION($templateId: ID!) {\n acceptNegotiableQuoteTemplate(input: { template_id: $templateId }) {\n ...NegotiableQuoteTemplateFragment\n }\n }\n \n ${NEGOTIABLE_QUOTE_TEMPLATE_FRAGMENT}\n`;\n\n","/********************************************************************\n * Copyright 2025 Adobe\n * All Rights Reserved.\n *\n * NOTICE: Adobe permits you to use, modify, and distribute this\n * file in accordance with the terms of the Adobe license agreement\n * accompanying it.\n *******************************************************************/\n\nimport { fetchGraphQl } from '@/quote-management/api';\nimport { ACCEPT_QUOTE_TEMPLATE_MUTATION } from './graphql/acceptQuoteTemplate';\nimport { transformQuoteTemplate } from '@/quote-management/data/transforms';\nimport { state } from '@/quote-management/lib/state';\nimport { events } from '@adobe-commerce/event-bus';\n\nexport interface AcceptQuoteTemplateParams {\n templateId: string;\n}\n\nexport const acceptQuoteTemplate = async (\n params: AcceptQuoteTemplateParams\n) => {\n if (!params.templateId) {\n throw new Error('Template ID is required');\n }\n\n if (!state.authenticated) {\n throw new Error('Unauthorized');\n }\n\n try {\n const results: any = await fetchGraphQl(ACCEPT_QUOTE_TEMPLATE_MUTATION, {\n variables: { templateId: params.templateId },\n });\n\n if (!results?.data?.acceptNegotiableQuoteTemplate) {\n throw new Error('No quote template data received');\n }\n\n const transformedData = transformQuoteTemplate(\n results.data.acceptNegotiableQuoteTemplate\n );\n\n if (!transformedData) {\n throw new Error('Failed to transform quote template data');\n }\n\n events.emit('quote-management/quote-template-data', {\n quoteTemplate: transformedData,\n permissions: state.permissions,\n });\n\n return transformedData;\n } catch (error) {\n return Promise.reject(error);\n }\n};\n","/********************************************************************\n * Copyright 2025 Adobe\n * All Rights Reserved.\n *\n * NOTICE: Adobe permits you to use, modify, and distribute this\n * file in accordance with the terms of the Adobe license agreement\n * accompanying it.\n *******************************************************************/\n\nimport { NEGOTIABLE_QUOTE_TEMPLATE_FRAGMENT } from '@/quote-management/api/graphql/NegotiableQuoteTemplateFragment';\n\nexport const CANCEL_QUOTE_TEMPLATE_MUTATION = /* GraphQL */ `\n mutation CANCEL_QUOTE_TEMPLATE_MUTATION(\n $templateId: ID!\n $comment: String\n ) {\n cancelNegotiableQuoteTemplate(\n input: {\n template_id: $templateId\n cancellation_comment: $comment\n }\n ) {\n ...NegotiableQuoteTemplateFragment\n }\n }\n ${NEGOTIABLE_QUOTE_TEMPLATE_FRAGMENT}\n`;\n","/********************************************************************\n * Copyright 2025 Adobe\n * All Rights Reserved.\n *\n * NOTICE: Adobe permits you to use, modify, and distribute this\n * file in accordance with the terms of the Adobe license agreement\n * accompanying it.\n *******************************************************************/\n\nimport { fetchGraphQl } from '@/quote-management/api';\nimport { CANCEL_QUOTE_TEMPLATE_MUTATION } from './graphql/cancelQuoteTemplate';\nimport { transformQuoteTemplate } from '@/quote-management/data/transforms';\nimport { state } from '@/quote-management/lib/state';\nimport { events } from '@adobe-commerce/event-bus';\n\nexport interface CancelQuoteTemplateParams {\n templateId: string;\n comment?: string;\n}\n\nexport const cancelQuoteTemplate = async (\n params: CancelQuoteTemplateParams\n) => {\n if (!params.templateId) {\n throw new Error('Template ID is required');\n }\n\n if (!state.authenticated) {\n throw new Error('Unauthorized');\n }\n\n try {\n const results: any = await fetchGraphQl(CANCEL_QUOTE_TEMPLATE_MUTATION, {\n variables: { templateId: params.templateId, comment: params.comment },\n });\n\n if (!results?.data?.cancelNegotiableQuoteTemplate) {\n throw new Error('No quote template data received');\n }\n\n const transformedData = transformQuoteTemplate(\n results.data.cancelNegotiableQuoteTemplate\n );\n\n if (!transformedData) {\n throw new Error('Failed to transform quote template data');\n }\n\n events.emit('quote-management/quote-template-data', {\n quoteTemplate: transformedData,\n permissions: state.permissions,\n });\n\n return transformedData;\n } catch (error) {\n return Promise.reject(error);\n }\n};\n","/********************************************************************\n * Copyright 2025 Adobe\n * All Rights Reserved.\n *\n * NOTICE: Adobe permits you to use, modify, and distribute this\n * file in accordance with the terms of the Adobe license agreement\n * accompanying it.\n *******************************************************************/\n\nexport const DELETE_QUOTE_TEMPLATE_MUTATION = /* GraphQL */ `\n mutation DELETE_QUOTE_TEMPLATE_MUTATION($templateId: ID!) {\n deleteNegotiableQuoteTemplate(input: { template_id: $templateId })\n }\n`;\n\n","/********************************************************************\n * Copyright 2025 Adobe\n * All Rights Reserved.\n *\n * NOTICE: Adobe permits you to use, modify, and distribute this\n * file in accordance with the terms of the Adobe license agreement\n * accompanying it.\n *******************************************************************/\n\nimport { fetchGraphQl } from '@/quote-management/api';\nimport { DELETE_QUOTE_TEMPLATE_MUTATION } from './graphql/deleteQuoteTemplate';\nimport { state } from '@/quote-management/lib/state';\nimport { events } from '@adobe-commerce/event-bus';\n\nexport interface DeleteQuoteTemplateParams {\n templateId: string;\n}\n\nexport const deleteQuoteTemplate = async (\n params: DeleteQuoteTemplateParams\n) => {\n if (!params.templateId) {\n throw new Error('Template ID is required');\n }\n\n if (!state.authenticated) {\n throw new Error('Unauthorized');\n }\n\n try {\n const results: any = await fetchGraphQl(DELETE_QUOTE_TEMPLATE_MUTATION, {\n variables: { templateId: params.templateId },\n });\n\n if (results?.errors && results.errors.length > 0) {\n const errorMessages = results.errors\n .map((e: any) => e?.message)\n .filter(Boolean)\n .join('; ');\n throw new Error(errorMessages || 'Failed to delete quote template');\n }\n\n const deleted = results?.data?.deleteNegotiableQuoteTemplate;\n\n if (!deleted) {\n throw new Error('Failed to delete quote template');\n }\n\n events.emit('quote-management/quote-template-deleted', {\n templateId: params.templateId,\n });\n\n return { templateId: params.templateId };\n } catch (error) {\n return Promise.reject(error);\n }\n};\n","/********************************************************************\n * Copyright 2025 Adobe\n * All Rights Reserved.\n *\n * NOTICE: Adobe permits you to use, modify, and distribute this\n * file in accordance with the terms of the Adobe license agreement\n * accompanying it.\n *******************************************************************/\n\nimport { NEGOTIABLE_QUOTE_TEMPLATE_FRAGMENT } from '@/quote-management/api/graphql/NegotiableQuoteTemplateFragment';\n\nexport const OPEN_QUOTE_TEMPLATE_MUTATION = /* GraphQL */ `\n mutation OPEN_QUOTE_TEMPLATE_MUTATION($templateId: ID!) {\n openNegotiableQuoteTemplate(input: { template_id: $templateId }) {\n ...NegotiableQuoteTemplateFragment\n }\n }\n\n ${NEGOTIABLE_QUOTE_TEMPLATE_FRAGMENT}\n`;\n","/********************************************************************\n * Copyright 2025 Adobe\n * All Rights Reserved.\n *\n * NOTICE: Adobe permits you to use, modify, and distribute this\n * file in accordance with the terms of the Adobe license agreement\n * accompanying it.\n *******************************************************************/\n\nimport { fetchGraphQl } from '@/quote-management/api';\nimport { OPEN_QUOTE_TEMPLATE_MUTATION } from './graphql/openQuoteTemplate';\nimport { transformQuoteTemplate } from '@/quote-management/data/transforms';\nimport { state } from '@/quote-management/lib/state';\nimport { events } from '@adobe-commerce/event-bus';\n\nexport interface OpenQuoteTemplateParams {\n templateId: string;\n}\n\nexport const openQuoteTemplate = async (params: OpenQuoteTemplateParams) => {\n if (!params.templateId) {\n throw new Error('Template ID is required');\n }\n\n if (!state.authenticated) {\n throw new Error('Unauthorized');\n }\n\n try {\n const results: any = await fetchGraphQl(OPEN_QUOTE_TEMPLATE_MUTATION, {\n variables: { templateId: params.templateId },\n });\n\n if (!results?.data?.openNegotiableQuoteTemplate) {\n throw new Error('No quote template data received');\n }\n\n const transformedData = transformQuoteTemplate(\n results.data.openNegotiableQuoteTemplate\n );\n\n if (!transformedData) {\n throw new Error('Failed to transform quote template data');\n }\n\n events.emit('quote-management/quote-template-data', {\n quoteTemplate: transformedData,\n permissions: state.permissions,\n });\n\n return transformedData;\n } catch (error) {\n return Promise.reject(error);\n }\n};\n"],"names":["SEND_QUOTE_TEMPLATE_FOR_REVIEW_MUTATION","NEGOTIABLE_QUOTE_TEMPLATE_FRAGMENT","sendQuoteTemplateForReview","params","state","referenceDocumentLinks","_a","link","attachments","_b","att","results","fetchGraphQl","_c","transformedData","transformQuoteTemplate","events","error","ACCEPT_QUOTE_TEMPLATE_MUTATION","acceptQuoteTemplate","CANCEL_QUOTE_TEMPLATE_MUTATION","cancelQuoteTemplate","DELETE_QUOTE_TEMPLATE_MUTATION","deleteQuoteTemplate","errorMessages","e","OPEN_QUOTE_TEMPLATE_MUTATION","openQuoteTemplate"],"mappings":"wOAWO,MAAMA,EAAwD;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,IAYjEC,CAAkC;AAAA,ECOzBC,EAA6B,MACxCC,GACG,WACH,GAAI,CAACA,EAAO,WACV,MAAM,IAAI,MAAM,yBAAyB,EAG3C,GAAI,CAACC,EAAM,cACT,MAAM,IAAI,MAAM,cAAc,EAGhC,GAAI,CAEF,MAAMC,GAAyBC,EAAAH,EAAO,yBAAP,YAAAG,EAA+B,IAAKC,IAAU,CAC3E,QAASA,EAAK,IACd,cAAeA,EAAK,KACpB,oBAAqBA,EAAK,WAC1B,uBAAwBA,EAA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,IAAI,EACZ,MAAM,IAAI,MAAMD,GAAiB,iCAAiC,CACpE,CAIA,GAAI,GAFYlB,EAAAK,GAAA,YAAAA,EAAS,OAAT,YAAAL,EAAe,+BAG7B,MAAM,IAAI,MAAM,iCAAiC,EAGnD,OAAAU,EAAO,KAAK,0CAA2C,CACrD,WAAYb,EAAO,UAAA,CACpB,EAEM,CAAE,WAAYA,EAAO,UAAA,CAC9B,OAASc,EAAO,CACd,OAAO,QAAQ,OAAOA,CAAK,CAC7B,CACF,EC7CaS,EAA6C;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,IAOtDzB,CAAkC;AAAA,ECCzB0B,EAAoB,MAAOxB,GAAoC,OAC1E,GAAI,CAACA,EAAO,WACV,MAAM,IAAI,MAAM,yBAAyB,EAG3C,GAAI,CAACC,EAAM,cACT,MAAM,IAAI,MAAM,cAAc,EAGhC,GAAI,CACF,MAAMO,EAAe,MAAMC,EAAac,EAA8B,CACpE,UAAW,CAAE,WAAYvB,EAAO,UAAA,CAAW,CAC5C,EAED,GAAI,GAACG,EAAAK,GAAA,YAAAA,EAAS,OAAT,MAAAL,EAAe,6BAClB,MAAM,IAAI,MAAM,iCAAiC,EAGnD,MAAMQ,EAAkBC,EACtBJ,EAAQ,KAAK,2BAAA,EAGf,GAAI,CAACG,EACH,MAAM,IAAI,MAAM,yCAAyC,EAG3D,OAAAE,EAAO,KAAK,uCAAwC,CAClD,cAAeF,EACf,YAAaV,EAAM,WAAA,CACpB,EAEMU,CACT,OAASG,EAAO,CACd,OAAO,QAAQ,OAAOA,CAAK,CAC7B,CACF"}
1
+ {"version":3,"file":"openQuoteTemplate.js","sources":["/@dropins/storefront-quote-management/src/api/sendQuoteTemplateForReview/graphql/sendQuoteTemplateForReview.ts","/@dropins/storefront-quote-management/src/api/sendQuoteTemplateForReview/sendQuoteTemplateForReview.ts","/@dropins/storefront-quote-management/src/api/setQuoteTemplateExpirationDate/graphql/setQuoteTemplateExpirationDate.ts","/@dropins/storefront-quote-management/src/api/setQuoteTemplateExpirationDate/setQuoteTemplateExpirationDate.ts","/@dropins/storefront-quote-management/src/api/acceptQuoteTemplate/graphql/acceptQuoteTemplate.ts","/@dropins/storefront-quote-management/src/api/acceptQuoteTemplate/acceptQuoteTemplate.ts","/@dropins/storefront-quote-management/src/api/cancelQuoteTemplate/graphql/cancelQuoteTemplate.ts","/@dropins/storefront-quote-management/src/api/cancelQuoteTemplate/cancelQuoteTemplate.ts","/@dropins/storefront-quote-management/src/api/deleteQuoteTemplate/graphql/deleteQuoteTemplate.ts","/@dropins/storefront-quote-management/src/api/deleteQuoteTemplate/deleteQuoteTemplate.ts","/@dropins/storefront-quote-management/src/api/openQuoteTemplate/graphql/openQuoteTemplate.ts","/@dropins/storefront-quote-management/src/api/openQuoteTemplate/openQuoteTemplate.ts"],"sourcesContent":["/********************************************************************\n * Copyright 2025 Adobe\n * All Rights Reserved.\n *\n * NOTICE: Adobe permits you to use, modify, and distribute this \n * file in accordance with the terms of the Adobe license agreement \n * accompanying it. \n *******************************************************************/\n\nimport { NEGOTIABLE_QUOTE_TEMPLATE_FRAGMENT } from '@/quote-management/api/graphql/NegotiableQuoteTemplateFragment';\n\nexport const SEND_QUOTE_TEMPLATE_FOR_REVIEW_MUTATION = /* GraphQL */ `\n mutation SEND_QUOTE_TEMPLATE_FOR_REVIEW_MUTATION(\n $templateId: ID!\n $comment: String\n $name: String\n $referenceDocumentLinks: [NegotiableQuoteTemplateReferenceDocumentLinkInput]\n $attachments: [NegotiableQuoteCommentAttachmentInput]\n ) {\n submitNegotiableQuoteTemplateForReview(input: { template_id: $templateId, name: $name, comment: $comment, reference_document_links: $referenceDocumentLinks, attachments: $attachments }) {\n ...NegotiableQuoteTemplateFragment\n }\n }\n ${NEGOTIABLE_QUOTE_TEMPLATE_FRAGMENT}\n`;\n","/********************************************************************\n * Copyright 2025 Adobe\n * All Rights Reserved.\n *\n * NOTICE: Adobe permits you to use, modify, and distribute this\n * file in accordance with the terms of the Adobe license agreement\n * accompanying it.\n *******************************************************************/\n\nimport { fetchGraphQl } from '@/quote-management/api';\nimport { SEND_QUOTE_TEMPLATE_FOR_REVIEW_MUTATION } from './graphql/sendQuoteTemplateForReview';\nimport { transformQuoteTemplate } from '@/quote-management/data/transforms';\nimport { state } from '@/quote-management/lib/state';\nimport { events } from '@adobe-commerce/event-bus';\n\nexport interface ReferenceDocumentLinkInput {\n uid?: string;\n name: string;\n identifier?: string;\n url: string;\n}\n\nexport interface SendQuoteTemplateForReviewParams {\n templateId: string;\n name?: string;\n comment?: string;\n referenceDocumentLinks?: ReferenceDocumentLinkInput[];\n attachments?: { key: string }[];\n}\n\nexport const sendQuoteTemplateForReview = async (\n params: SendQuoteTemplateForReviewParams\n) => {\n if (!params.templateId) {\n throw new Error('Template ID is required');\n }\n\n if (!state.authenticated) {\n throw new Error('Unauthorized');\n }\n\n try {\n // Transform reference document links from camelCase to snake_case for GraphQL\n const referenceDocumentLinks = params.referenceDocumentLinks?.map((link) => ({\n link_id: link.uid,\n document_name: link.name,\n document_identifier: link.identifier,\n reference_document_url: link.url,\n }));\n\n // Format attachments for GraphQL (separate field, not nested in comment)\n const attachments = params.attachments?.length \n ? params.attachments.map(att => ({ key: att.key }))\n : undefined;\n\n const results: any = await fetchGraphQl(\n SEND_QUOTE_TEMPLATE_FOR_REVIEW_MUTATION,\n {\n variables: {\n templateId: params.templateId,\n name: params.name,\n comment: params.comment || undefined,\n referenceDocumentLinks,\n attachments,\n },\n }\n );\n\n if (!results?.data?.submitNegotiableQuoteTemplateForReview) {\n throw new Error('No quote template data received');\n }\n\n const transformedData = transformQuoteTemplate(\n results.data.submitNegotiableQuoteTemplateForReview\n );\n\n if (!transformedData) {\n throw new Error('Failed to transform quote template data');\n }\n\n events.emit('quote-management/quote-template-data', {\n quoteTemplate: transformedData,\n permissions: state.permissions,\n });\n\n return transformedData;\n } catch (error) {\n return Promise.reject(error);\n }\n};\n","/********************************************************************\n * Copyright 2025 Adobe\n * All Rights Reserved.\n *\n * NOTICE: Adobe permits you to use, modify, and distribute this\n * file in accordance with the terms of the Adobe license agreement\n * accompanying it.\n *******************************************************************/\n\nimport { NEGOTIABLE_QUOTE_TEMPLATE_FRAGMENT } from '@/quote-management/api/graphql/NegotiableQuoteTemplateFragment';\n\nexport const SET_QUOTE_TEMPLATE_EXPIRATION_DATE_MUTATION = /* GraphQL */ `\n mutation SET_QUOTE_TEMPLATE_EXPIRATION_DATE_MUTATION(\n $templateId: ID!\n $expirationDate: String!\n ) {\n setQuoteTemplateExpirationDate(input: { template_id: $templateId, expiration_date: $expirationDate }) {\n ...NegotiableQuoteTemplateFragment\n }\n }\n ${NEGOTIABLE_QUOTE_TEMPLATE_FRAGMENT}\n`;\n\n","/********************************************************************\n * Copyright 2025 Adobe\n * All Rights Reserved.\n *\n * NOTICE: Adobe permits you to use, modify, and distribute this\n * file in accordance with the terms of the Adobe license agreement\n * accompanying it.\n *******************************************************************/\n\nimport { fetchGraphQl } from '@/quote-management/api';\nimport { SET_QUOTE_TEMPLATE_EXPIRATION_DATE_MUTATION } from './graphql/setQuoteTemplateExpirationDate';\nimport { transformQuoteTemplate } from '@/quote-management/data/transforms';\nimport { NegotiableQuoteTemplateModel } from '@/quote-management/data/models/negotiable-quote-template-model';\nimport { state } from '@/quote-management/lib/state';\nimport { events } from '@adobe-commerce/event-bus';\n\nexport interface SetQuoteTemplateExpirationDateParams {\n templateId: string;\n expirationDate: string;\n}\n\nexport const setQuoteTemplateExpirationDate = async (\n params: SetQuoteTemplateExpirationDateParams\n): Promise<NegotiableQuoteTemplateModel | null> => {\n if (!state.authenticated) {\n throw new Error('Unauthorized');\n }\n\n if (!params.templateId) {\n throw new Error('Template ID is required');\n }\n\n if (!params.expirationDate) {\n throw new Error('Expiration date is required');\n }\n\n try {\n const results: any = await fetchGraphQl(\n SET_QUOTE_TEMPLATE_EXPIRATION_DATE_MUTATION,\n {\n variables: {\n templateId: params.templateId,\n expirationDate: params.expirationDate,\n },\n }\n );\n\n if (!results?.data?.setQuoteTemplateExpirationDate) {\n throw new Error('Failed to set expiration date');\n }\n\n const transformedData = transformQuoteTemplate(\n results.data.setQuoteTemplateExpirationDate\n );\n\n if (!transformedData) {\n throw new Error('Failed to transform quote template data');\n }\n\n // Emit event to update the UI\n events.emit('quote-management/quote-template-data', {\n quoteTemplate: transformedData,\n permissions: state.permissions,\n });\n\n return transformedData;\n } catch (error) {\n return Promise.reject(error);\n }\n};\n\n","/********************************************************************\n * Copyright 2025 Adobe\n * All Rights Reserved.\n *\n * NOTICE: Adobe permits you to use, modify, and distribute this \n * file in accordance with the terms of the Adobe license agreement \n * accompanying it. \n *******************************************************************/\n\nimport { NEGOTIABLE_QUOTE_TEMPLATE_FRAGMENT } from '@/quote-management/api/graphql/NegotiableQuoteTemplateFragment';\n\nexport const ACCEPT_QUOTE_TEMPLATE_MUTATION = /* GraphQL */ `\n mutation ACCEPT_QUOTE_TEMPLATE_MUTATION($templateId: ID!) {\n acceptNegotiableQuoteTemplate(input: { template_id: $templateId }) {\n ...NegotiableQuoteTemplateFragment\n }\n }\n \n ${NEGOTIABLE_QUOTE_TEMPLATE_FRAGMENT}\n`;\n\n","/********************************************************************\n * Copyright 2025 Adobe\n * All Rights Reserved.\n *\n * NOTICE: Adobe permits you to use, modify, and distribute this\n * file in accordance with the terms of the Adobe license agreement\n * accompanying it.\n *******************************************************************/\n\nimport { fetchGraphQl } from '@/quote-management/api';\nimport { ACCEPT_QUOTE_TEMPLATE_MUTATION } from './graphql/acceptQuoteTemplate';\nimport { transformQuoteTemplate } from '@/quote-management/data/transforms';\nimport { state } from '@/quote-management/lib/state';\nimport { events } from '@adobe-commerce/event-bus';\n\nexport interface AcceptQuoteTemplateParams {\n templateId: string;\n}\n\nexport const acceptQuoteTemplate = async (\n params: AcceptQuoteTemplateParams\n) => {\n if (!params.templateId) {\n throw new Error('Template ID is required');\n }\n\n if (!state.authenticated) {\n throw new Error('Unauthorized');\n }\n\n try {\n const results: any = await fetchGraphQl(ACCEPT_QUOTE_TEMPLATE_MUTATION, {\n variables: { templateId: params.templateId },\n });\n\n if (!results?.data?.acceptNegotiableQuoteTemplate) {\n throw new Error('No quote template data received');\n }\n\n const transformedData = transformQuoteTemplate(\n results.data.acceptNegotiableQuoteTemplate\n );\n\n if (!transformedData) {\n throw new Error('Failed to transform quote template data');\n }\n\n events.emit('quote-management/quote-template-data', {\n quoteTemplate: transformedData,\n permissions: state.permissions,\n });\n\n return transformedData;\n } catch (error) {\n return Promise.reject(error);\n }\n};\n","/********************************************************************\n * Copyright 2025 Adobe\n * All Rights Reserved.\n *\n * NOTICE: Adobe permits you to use, modify, and distribute this\n * file in accordance with the terms of the Adobe license agreement\n * accompanying it.\n *******************************************************************/\n\nimport { NEGOTIABLE_QUOTE_TEMPLATE_FRAGMENT } from '@/quote-management/api/graphql/NegotiableQuoteTemplateFragment';\n\nexport const CANCEL_QUOTE_TEMPLATE_MUTATION = /* GraphQL */ `\n mutation CANCEL_QUOTE_TEMPLATE_MUTATION(\n $templateId: ID!\n $comment: String\n ) {\n cancelNegotiableQuoteTemplate(\n input: {\n template_id: $templateId\n cancellation_comment: $comment\n }\n ) {\n ...NegotiableQuoteTemplateFragment\n }\n }\n ${NEGOTIABLE_QUOTE_TEMPLATE_FRAGMENT}\n`;\n","/********************************************************************\n * Copyright 2025 Adobe\n * All Rights Reserved.\n *\n * NOTICE: Adobe permits you to use, modify, and distribute this\n * file in accordance with the terms of the Adobe license agreement\n * accompanying it.\n *******************************************************************/\n\nimport { fetchGraphQl } from '@/quote-management/api';\nimport { CANCEL_QUOTE_TEMPLATE_MUTATION } from './graphql/cancelQuoteTemplate';\nimport { transformQuoteTemplate } from '@/quote-management/data/transforms';\nimport { state } from '@/quote-management/lib/state';\nimport { events } from '@adobe-commerce/event-bus';\n\nexport interface CancelQuoteTemplateParams {\n templateId: string;\n comment?: string;\n}\n\nexport const cancelQuoteTemplate = async (\n params: CancelQuoteTemplateParams\n) => {\n if (!params.templateId) {\n throw new Error('Template ID is required');\n }\n\n if (!state.authenticated) {\n throw new Error('Unauthorized');\n }\n\n try {\n const results: any = await fetchGraphQl(CANCEL_QUOTE_TEMPLATE_MUTATION, {\n variables: { templateId: params.templateId, comment: params.comment },\n });\n\n if (!results?.data?.cancelNegotiableQuoteTemplate) {\n throw new Error('No quote template data received');\n }\n\n const transformedData = transformQuoteTemplate(\n results.data.cancelNegotiableQuoteTemplate\n );\n\n if (!transformedData) {\n throw new Error('Failed to transform quote template data');\n }\n\n events.emit('quote-management/quote-template-data', {\n quoteTemplate: transformedData,\n permissions: state.permissions,\n });\n\n return transformedData;\n } catch (error) {\n return Promise.reject(error);\n }\n};\n","/********************************************************************\n * Copyright 2025 Adobe\n * All Rights Reserved.\n *\n * NOTICE: Adobe permits you to use, modify, and distribute this\n * file in accordance with the terms of the Adobe license agreement\n * accompanying it.\n *******************************************************************/\n\nexport const DELETE_QUOTE_TEMPLATE_MUTATION = /* GraphQL */ `\n mutation DELETE_QUOTE_TEMPLATE_MUTATION($templateId: ID!) {\n deleteNegotiableQuoteTemplate(input: { template_id: $templateId })\n }\n`;\n\n","/********************************************************************\n * Copyright 2025 Adobe\n * All Rights Reserved.\n *\n * NOTICE: Adobe permits you to use, modify, and distribute this\n * file in accordance with the terms of the Adobe license agreement\n * accompanying it.\n *******************************************************************/\n\nimport { fetchGraphQl } from '@/quote-management/api';\nimport { DELETE_QUOTE_TEMPLATE_MUTATION } from './graphql/deleteQuoteTemplate';\nimport { state } from '@/quote-management/lib/state';\nimport { events } from '@adobe-commerce/event-bus';\n\nexport interface DeleteQuoteTemplateParams {\n templateId: string;\n}\n\nexport const deleteQuoteTemplate = async (\n params: DeleteQuoteTemplateParams\n) => {\n if (!params.templateId) {\n throw new Error('Template ID is required');\n }\n\n if (!state.authenticated) {\n throw new Error('Unauthorized');\n }\n\n try {\n const results: any = await fetchGraphQl(DELETE_QUOTE_TEMPLATE_MUTATION, {\n variables: { templateId: params.templateId },\n });\n\n if (results?.errors && results.errors.length > 0) {\n const errorMessages = results.errors\n .map((e: any) => e?.message)\n .filter(Boolean)\n .join('; ');\n throw new Error(errorMessages || 'Failed to delete quote template');\n }\n\n const deleted = results?.data?.deleteNegotiableQuoteTemplate;\n\n if (!deleted) {\n throw new Error('Failed to delete quote template');\n }\n\n events.emit('quote-management/quote-template-deleted', {\n templateId: params.templateId,\n });\n\n return { templateId: params.templateId };\n } catch (error) {\n return Promise.reject(error);\n }\n};\n","/********************************************************************\n * Copyright 2025 Adobe\n * All Rights Reserved.\n *\n * NOTICE: Adobe permits you to use, modify, and distribute this\n * file in accordance with the terms of the Adobe license agreement\n * accompanying it.\n *******************************************************************/\n\nimport { NEGOTIABLE_QUOTE_TEMPLATE_FRAGMENT } from '@/quote-management/api/graphql/NegotiableQuoteTemplateFragment';\n\nexport const OPEN_QUOTE_TEMPLATE_MUTATION = /* GraphQL */ `\n mutation OPEN_QUOTE_TEMPLATE_MUTATION($templateId: ID!) {\n openNegotiableQuoteTemplate(input: { template_id: $templateId }) {\n ...NegotiableQuoteTemplateFragment\n }\n }\n\n ${NEGOTIABLE_QUOTE_TEMPLATE_FRAGMENT}\n`;\n","/********************************************************************\n * Copyright 2025 Adobe\n * All Rights Reserved.\n *\n * NOTICE: Adobe permits you to use, modify, and distribute this\n * file in accordance with the terms of the Adobe license agreement\n * accompanying it.\n *******************************************************************/\n\nimport { fetchGraphQl } from '@/quote-management/api';\nimport { OPEN_QUOTE_TEMPLATE_MUTATION } from './graphql/openQuoteTemplate';\nimport { transformQuoteTemplate } from '@/quote-management/data/transforms';\nimport { state } from '@/quote-management/lib/state';\nimport { events } from '@adobe-commerce/event-bus';\n\nexport interface OpenQuoteTemplateParams {\n templateId: string;\n}\n\nexport const openQuoteTemplate = async (params: OpenQuoteTemplateParams) => {\n if (!params.templateId) {\n throw new Error('Template ID is required');\n }\n\n if (!state.authenticated) {\n throw new Error('Unauthorized');\n }\n\n try {\n const results: any = await fetchGraphQl(OPEN_QUOTE_TEMPLATE_MUTATION, {\n variables: { templateId: params.templateId },\n });\n\n if (!results?.data?.openNegotiableQuoteTemplate) {\n throw new Error('No quote template data received');\n }\n\n const transformedData = transformQuoteTemplate(\n results.data.openNegotiableQuoteTemplate\n );\n\n if (!transformedData) {\n throw new Error('Failed to transform quote template data');\n }\n\n events.emit('quote-management/quote-template-data', {\n quoteTemplate: transformedData,\n permissions: state.permissions,\n });\n\n return transformedData;\n } catch (error) {\n return Promise.reject(error);\n }\n};\n"],"names":["SEND_QUOTE_TEMPLATE_FOR_REVIEW_MUTATION","NEGOTIABLE_QUOTE_TEMPLATE_FRAGMENT","sendQuoteTemplateForReview","params","state","referenceDocumentLinks","_a","link","attachments","_b","att","results","fetchGraphQl","_c","transformedData","transformQuoteTemplate","events","error","SET_QUOTE_TEMPLATE_EXPIRATION_DATE_MUTATION","setQuoteTemplateExpirationDate","ACCEPT_QUOTE_TEMPLATE_MUTATION","acceptQuoteTemplate","CANCEL_QUOTE_TEMPLATE_MUTATION","cancelQuoteTemplate","DELETE_QUOTE_TEMPLATE_MUTATION","deleteQuoteTemplate","errorMessages","e","OPEN_QUOTE_TEMPLATE_MUTATION","openQuoteTemplate"],"mappings":"wOAWO,MAAMA,EAAwD;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,IAYjEC,CAAkC;AAAA,ECOzBC,EAA6B,MACxCC,GACG,WACH,GAAI,CAACA,EAAO,WACV,MAAM,IAAI,MAAM,yBAAyB,EAG3C,GAAI,CAACC,EAAM,cACT,MAAM,IAAI,MAAM,cAAc,EAGhC,GAAI,CAEF,MAAMC,GAAyBC,EAAAH,EAAO,yBAAP,YAAAG,EAA+B,IAAKC,IAAU,CAC3E,QAASA,EAAK,IACd,cAAeA,EAAK,KACpB,oBAAqBA,EAAK,WAC1B,uBAAwBA,EAAK,GAAA,IAIzBC,GAAcC,EAAAN,EAAO,cAAP,MAAAM,EAAoB,OACpCN,EAAO,YAAY,IAAIO,IAAQ,CAAE,IAAKA,EAA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,EAA8B,CACpE,UAAW,CAAE,WAAYzB,EAAO,UAAA,CAAW,CAC5C,EAED,GAAI,GAACG,EAAAK,GAAA,YAAAA,EAAS,OAAT,MAAAL,EAAe,6BAClB,MAAM,IAAI,MAAM,iCAAiC,EAGnD,MAAMQ,EAAkBC,EACtBJ,EAAQ,KAAK,2BAAA,EAGf,GAAI,CAACG,EACH,MAAM,IAAI,MAAM,yCAAyC,EAG3D,OAAAE,EAAO,KAAK,uCAAwC,CAClD,cAAeF,EACf,YAAaV,EAAM,WAAA,CACpB,EAEMU,CACT,OAASG,EAAO,CACd,OAAO,QAAQ,OAAOA,CAAK,CAC7B,CACF"}
@@ -1,4 +1,4 @@
1
1
  /*! Copyright 2026 Adobe
2
2
  All Rights Reserved. */
3
- import{FetchGraphQL as b}from"@dropins/tools/fetch-graphql.js";import{s as _}from"./state.js";var d=(e=>(e.NEW="NEW",e.SUBMITTED="SUBMITTED",e.PENDING="PENDING",e.UPDATED="UPDATED",e.OPEN="OPEN",e.ORDERED="ORDERED",e.CLOSED="CLOSED",e.DECLINED="DECLINED",e.EXPIRED="EXPIRED",e.DRAFT="DRAFT",e))(d||{});const{setEndpoint:L,setFetchGraphQlHeader:M,removeFetchGraphQlHeader:B,setFetchGraphQlHeaders:G,fetchGraphQl:z,getConfig:H}=new b().getMethods();function h(e){var a,r,c,i,u,s,o;return{uid:e.uid,createdAt:e.created_at,author:{firstname:e.author.firstname,lastname:e.author.lastname},changeType:e.change_type,changes:{commentAdded:((a=e.changes)==null?void 0:a.comment_added)&&{comment:e.changes.comment_added.comment},customChanges:((r=e.changes)==null?void 0:r.custom_changes)&&{new_value:e.changes.custom_changes.new_value,old_value:e.changes.custom_changes.old_value,title:e.changes.custom_changes.title},expiration:((c=e.changes)==null?void 0:c.expiration)&&{newExpiration:e.changes.expiration.new_expiration,oldExpiration:e.changes.expiration.old_expiration},productsRemoved:((i=e.changes)==null?void 0:i.products_removed)&&{productsRemovedFromCatalog:e.changes.products_removed.products_removed_from_catalog||[],productsRemovedFromQuote:e.changes.products_removed.products_removed_from_quote||[]},statuses:((u=e.changes)==null?void 0:u.statuses)&&{changes:((s=e.changes.statuses.changes)==null?void 0:s.map(l=>({newStatus:l==null?void 0:l.new_status,oldStatus:l==null?void 0:l.old_status})))||[]},total:((o=e.changes)==null?void 0:o.total)&&e.changes.total.new_price&&e.changes.total.old_price&&{newPrice:{value:e.changes.total.new_price.value,currency:e.changes.total.new_price.currency},oldPrice:{value:e.changes.total.old_price.value,currency:e.changes.total.old_price.currency}}}}}function y(e){if(e)return e.map(h)}function v(e,a){return e!=null&&e.length&&[...e].sort((c,i)=>i.quantity-c.quantity).find(c=>a>=c.quantity)||null}function T(e){var r,c,i,u;const a=_.config;return{src:a!=null&&a.useConfigurableParentThumbnail?e.product.thumbnail.url:((c=(r=e.configured_variant)==null?void 0:r.thumbnail)==null?void 0:c.url)||e.product.thumbnail.url,alt:a!=null&&a.useConfigurableParentThumbnail?e.product.thumbnail.label:((u=(i=e.configured_variant)==null?void 0:i.thumbnail)==null?void 0:u.label)||e.product.thumbnail.label}}function I(e){var a;return((a=e.links)==null?void 0:a.length)>0?{count:e.links.length,result:e.links.map(r=>r.title).join(", ")}:null}function D(e){var s,o,l,t;const a=e.quantity,r=e.__typename==="ConfigurableCartItem",c=r?(s=e.configured_variant)==null?void 0:s.price_tiers:e.product.price_tiers,i=r?(o=e.configured_variant)==null?void 0:o.price_range:e.product.price_range,u=v(c,a);return u?u.discount.amount_off>0:(((t=(l=i==null?void 0:i.maximum_price)==null?void 0:l.discount)==null?void 0:t.amount_off)??0)>0}function E(e){var i,u,s,o,l,t,n,p;const a=e.quantity,r=v(e.product.price_tiers,a);if(r)return Math.round(r.discount.percent_off);let c;if(e.__typename==="ConfigurableCartItem")c=(o=(s=(u=(i=e==null?void 0:e.configured_variant)==null?void 0:i.price_range)==null?void 0:u.maximum_price)==null?void 0:s.discount)==null?void 0:o.percent_off;else{if(e.__typename==="BundleCartItem")return;c=(p=(n=(t=(l=e==null?void 0:e.product)==null?void 0:l.price_range)==null?void 0:t.maximum_price)==null?void 0:n.discount)==null?void 0:p.percent_off}if(c!==0)return Math.round(c)}function P(e){var a,r,c,i;return e.__typename==="ConfigurableCartItem"?{value:(r=(a=e.configured_variant)==null?void 0:a.price_range)==null?void 0:r.maximum_price.regular_price.value,currency:(i=(c=e.configured_variant)==null?void 0:c.price_range)==null?void 0:i.maximum_price.regular_price.currency}:{value:e.prices.original_item_price.value,currency:e.prices.original_item_price.currency}}function w(e){var c,i,u,s,o,l;let a,r;if(a=((i=(c=e==null?void 0:e.prices)==null?void 0:c.original_row_total)==null?void 0:i.value)-((s=(u=e==null?void 0:e.prices)==null?void 0:u.row_total)==null?void 0:s.value),r=(l=(o=e==null?void 0:e.prices)==null?void 0:o.row_total)==null?void 0:l.currency,a!==0)return{value:a,currency:r}}function C(e){var a,r,c,i,u,s,o,l;return{itemType:e.__typename,uid:e.uid,product:{uid:e.product.uid,sku:e.product.sku,name:e.product.name,priceRange:{maximumPrice:{regularPrice:{value:e.product.price_range.maximum_price.regular_price.value,currency:e.product.price_range.maximum_price.regular_price.currency}}}},image:T(e),links:I(e),discounted:D(e),discountedTotal:{value:e.prices.row_total.value,currency:e.prices.row_total.currency},catalogDiscount:{amountOff:e.prices.catalog_discount.amount_off,percentOff:e.prices.catalog_discount.percent_off},discounts:((r=(a=e.prices)==null?void 0:a.discounts)==null?void 0:r.map(t=>({label:t.label,value:t.value,amount:{value:t.amount.value,currency:t.amount.currency}})))??[],discountPercentage:E(e),insufficientQuantity:(e.__typename==="ConfigurableCartItem"?((c=e.configured_variant)==null?void 0:c.stock_status)??e.product.stock_status:e.product.stock_status)==="IN_STOCK"&&!e.is_available,outOfStock:e.product.stock_status==="OUT_OF_STOCK",stockStatus:e.product.stock_status,quantity:e.quantity,prices:{regularPrice:P(e),priceIncludingTax:{value:e.prices.price_including_tax.value,currency:e.prices.price_including_tax.currency},originalItemPrice:{value:e.prices.original_item_price.value,currency:e.prices.original_item_price.currency},originalRowTotal:{value:e.prices.original_row_total.value,currency:e.prices.original_row_total.currency},rowTotal:{value:e.prices.row_total.value,currency:e.prices.row_total.currency},rowTotalIncludingTax:{value:e.prices.row_total_including_tax.value,currency:e.prices.row_total_including_tax.currency}},savingsAmount:w(e),noteFromBuyer:(i=e.note_from_buyer)==null?void 0:i.map(t=>({createdAt:t.created_at,creatorId:t.creator_id,creatorType:t.creator_type,negotiableQuoteItemUid:t.negotiable_quote_item_uid,note:t.note,noteUid:t.note_uid})),noteFromSeller:(u=e.note_from_seller)==null?void 0:u.map(t=>({createdAt:t.created_at,creatorId:t.creator_id,creatorType:t.creator_type,negotiableQuoteItemUid:t.negotiable_quote_item_uid,note:t.note,noteUid:t.note_uid})),configurableOptions:(s=e.configurable_options)==null?void 0:s.map(t=>({optionLabel:t.option_label,valueLabel:t.value_label})),bundleOptions:(o=e.bundle_options)==null?void 0:o.map(t=>({label:t.label,values:t.values.map(n=>({label:n.label,quantity:n.quantity,originalPrice:{value:n.original_price.value,currency:n.original_price.currency},price:{value:n.priceV2.value,currency:n.priceV2.currency}}))})),customizableOptions:(l=e.customizable_options)==null?void 0:l.map(t=>({type:t.type,label:t.label,values:t.values.map(n=>({label:n.label,value:n.value}))}))}}function A(e){return e?e.map(C):[]}const f=["DRAFT","UPDATED","DECLINED","EXPIRED","NEW","OPEN"];function O(e){if(!e.items)return 0;const a=_.config;return(a==null?void 0:a.quoteSummaryDisplayTotal)===0?e.items.length:(a==null?void 0:a.quoteSummaryDisplayTotal)===1?e.total_quantity:e.items.length}function R(e){return e.every(a=>!a.outOfStock&&!a.insufficientQuantity)}function S(e){var i,u,s,o,l,t;const a=x(e),r=!!((i=e.template_name)!=null&&i.trim()),c=A(e.items);return{uid:e.uid,name:e.name,createdAt:e.created_at,updatedAt:e.updated_at,expirationDate:e.expiration_date,status:a?d.NEW:e.status,isVirtual:!!e.is_virtual,salesRepName:e.sales_rep_name,buyer:{firstname:e.buyer.firstname,lastname:e.buyer.lastname},email:e.email,templateName:e.template_name,totalQuantity:O(e),comments:(u=e.comments)==null?void 0:u.map(n=>{const p={uid:n.uid,createdAt:n.created_at,author:{firstname:n.author.firstname,lastname:n.author.lastname},text:n.text};return Array.isArray(n.attachments)&&n.attachments.length>0&&(p.attachments=n.attachments.map(g=>({name:g.name,url:g.url}))),p}),prices:e.prices&&{appliedDiscounts:(s=e.prices.discounts)==null?void 0:s.map(n=>({amount:{value:n.amount.value,currency:n.amount.currency},label:n.label,coupon:n.coupon})),appliedTaxes:(o=e.prices.applied_taxes)==null?void 0:o.map(n=>({amount:{value:n.amount.value,currency:n.amount.currency},label:n.label})),discount:e.prices.discounts&&e.prices.grand_total&&m(e.prices.discounts,e.prices.grand_total.currency),grandTotal:e.prices.grand_total&&{value:e.prices.grand_total.value,currency:e.prices.grand_total.currency},grandTotalExcludingTax:e.prices.grand_total_excluding_tax&&{value:e.prices.grand_total_excluding_tax.value,currency:e.prices.grand_total_excluding_tax.currency},subtotalExcludingTax:e.prices.subtotal_excluding_tax&&{value:e.prices.subtotal_excluding_tax.value,currency:e.prices.subtotal_excluding_tax.currency},subtotalIncludingTax:e.prices.subtotal_including_tax&&{value:e.prices.subtotal_including_tax.value,currency:e.prices.subtotal_including_tax.currency},subtotalWithDiscountExcludingTax:e.prices.subtotal_with_discount_excluding_tax&&{value:e.prices.subtotal_with_discount_excluding_tax.value,currency:e.prices.subtotal_with_discount_excluding_tax.currency},...Q(e),totalTax:e.prices.applied_taxes&&e.prices.grand_total&&m(e.prices.applied_taxes,e.prices.grand_total.currency)},history:y(e.history),items:c,shippingAddresses:(l=e.shipping_addresses)==null?void 0:l.map(n=>{const p={uid:n.uid,firstname:n.firstname,lastname:n.lastname,company:n.company,street:n.street,city:n.city,postcode:n.postcode,country:{code:n.country.code,label:n.country.label},telephone:n.telephone};return n.region&&(p.region={code:n.region.code,label:n.region.label,regionId:n.region.region_id}),p}),canCheckout:["UPDATED","DECLINED"].includes(e.status)&&_.permissions.checkoutQuote&&((t=e.shipping_addresses)==null?void 0:t.length)>0&&R(c),canSendForReview:!r&&(a||f.includes(e.status))&&_.permissions.editQuote,canUpdateQuote:!r&&(a||f.includes(e.status))&&_.permissions.editQuote,canDelete:!r&&!["PENDING","SUBMITTED","ORDERED"].includes(e.status)&&_.permissions.deleteQuote,canClose:e.status?!r&&!["DRAFT","CLOSED","ORDERED","OPEN"].includes(e.status):!1,readOnly:r||!a&&["ORDERED","SUBMITTED","CLOSED","PENDING"].includes(e.status)||!_.permissions.editQuote}}function W(e){return e?S(e):null}function x(e){return e.status==="SUBMITTED"&&!(e.history??[]).some(a=>{var r,c;return a.change_type==="UPDATED"&&(((c=(r=a.changes)==null?void 0:r.statuses)==null?void 0:c.changes)??[]).length>0})}function N(e){const a=x(e);return{uid:e.uid,name:e.name,createdAt:e.created_at,updatedAt:e.updated_at,status:a?d.NEW:e.status,buyer:{firstname:e.buyer.firstname,lastname:e.buyer.lastname},templateName:e.template_name,prices:{grandTotal:{value:e.prices.grand_total.value,currency:e.prices.grand_total.currency}}}}function V(e){var c;if(!e)return null;const a={items:((c=e.items)==null?void 0:c.filter(i=>i==null?void 0:i.uid).map(N))||[],pageInfo:{currentPage:e.page_info.current_page,pageSize:e.page_info.page_size,totalPages:e.page_info.total_pages},totalCount:e.total_count,sortFields:e.sort_fields?{default:e.sort_fields.default,options:e.sort_fields.options}:void 0},r=k(a);return{...a,paginationInfo:r||void 0}}function k(e){if(!(e!=null&&e.pageInfo)||!e.totalCount)return null;const{currentPage:a,pageSize:r,totalPages:c}=e.pageInfo,{totalCount:i}=e,u=i>0?(a-1)*r+1:0,s=Math.min(a*r,i);return{currentPage:a,totalCount:i,pageSize:r,startItem:u,endItem:s,totalPages:c,pageSizeOptions:[20,30,50,100,200]}}const X=()=>[20,30,50,100,200];function m(e,a){return e!=null&&e.length?e.reduce((r,c)=>({value:r.value+c.amount.value,currency:c.amount.currency}),{value:0,currency:a}):{value:0,currency:a}}function Q(e){var c;if(!e||!((c=e.shipping_addresses)!=null&&c.length))return{};const r=e.shipping_addresses[0].selected_shipping_method;return r?{shippingIncludingTax:r.price_incl_tax&&{value:r.price_incl_tax.value,currency:r.price_incl_tax.currency},shippingExcludingTax:r.price_excl_tax&&{value:r.price_excl_tax.value,currency:r.price_excl_tax.currency}}:{}}export{A as a,y as b,k as c,V as d,M as e,z as f,X as g,G as h,H as i,B as r,L as s,W as t};
3
+ import{FetchGraphQL as b}from"@dropins/tools/fetch-graphql.js";import{s as _}from"./state.js";var d=(e=>(e.NEW="NEW",e.SUBMITTED="SUBMITTED",e.PENDING="PENDING",e.UPDATED="UPDATED",e.OPEN="OPEN",e.ORDERED="ORDERED",e.CLOSED="CLOSED",e.DECLINED="DECLINED",e.EXPIRED="EXPIRED",e.DRAFT="DRAFT",e))(d||{});const{setEndpoint:L,setFetchGraphQlHeader:M,removeFetchGraphQlHeader:B,setFetchGraphQlHeaders:G,fetchGraphQl:z,getConfig:H}=new b().getMethods();function h(e){var a,r,c,i,u,s,o;return{uid:e.uid,createdAt:e.created_at,author:{firstname:e.author.firstname,lastname:e.author.lastname},changeType:e.change_type,changes:{commentAdded:((a=e.changes)==null?void 0:a.comment_added)&&{comment:e.changes.comment_added.comment},customChanges:((r=e.changes)==null?void 0:r.custom_changes)&&{new_value:e.changes.custom_changes.new_value,old_value:e.changes.custom_changes.old_value,title:e.changes.custom_changes.title},expiration:((c=e.changes)==null?void 0:c.expiration)&&{newExpiration:e.changes.expiration.new_expiration,oldExpiration:e.changes.expiration.old_expiration},productsRemoved:((i=e.changes)==null?void 0:i.products_removed)&&{productsRemovedFromCatalog:e.changes.products_removed.products_removed_from_catalog||[],productsRemovedFromQuote:e.changes.products_removed.products_removed_from_quote||[]},statuses:((u=e.changes)==null?void 0:u.statuses)&&{changes:((s=e.changes.statuses.changes)==null?void 0:s.map(l=>({newStatus:l==null?void 0:l.new_status,oldStatus:l==null?void 0:l.old_status})))||[]},total:((o=e.changes)==null?void 0:o.total)&&e.changes.total.new_price&&e.changes.total.old_price&&{newPrice:{value:e.changes.total.new_price.value,currency:e.changes.total.new_price.currency},oldPrice:{value:e.changes.total.old_price.value,currency:e.changes.total.old_price.currency}}}}}function y(e){if(e)return e.map(h)}function v(e,a){return e!=null&&e.length&&[...e].sort((c,i)=>i.quantity-c.quantity).find(c=>a>=c.quantity)||null}function T(e){var r,c,i,u;const a=_.config;return{src:a!=null&&a.useConfigurableParentThumbnail?e.product.thumbnail.url:((c=(r=e.configured_variant)==null?void 0:r.thumbnail)==null?void 0:c.url)||e.product.thumbnail.url,alt:a!=null&&a.useConfigurableParentThumbnail?e.product.thumbnail.label:((u=(i=e.configured_variant)==null?void 0:i.thumbnail)==null?void 0:u.label)||e.product.thumbnail.label}}function I(e){var a;return((a=e.links)==null?void 0:a.length)>0?{count:e.links.length,result:e.links.map(r=>r.title).join(", ")}:null}function D(e){var s,o,l,t;const a=e.quantity,r=e.__typename==="ConfigurableCartItem",c=r?(s=e.configured_variant)==null?void 0:s.price_tiers:e.product.price_tiers,i=r?(o=e.configured_variant)==null?void 0:o.price_range:e.product.price_range,u=v(c,a);return u?u.discount.amount_off>0:(((t=(l=i==null?void 0:i.maximum_price)==null?void 0:l.discount)==null?void 0:t.amount_off)??0)>0}function E(e){var i,u,s,o,l,t,n,p;const a=e.quantity,r=v(e.product.price_tiers,a);if(r)return Math.round(r.discount.percent_off);let c;if(e.__typename==="ConfigurableCartItem")c=(o=(s=(u=(i=e==null?void 0:e.configured_variant)==null?void 0:i.price_range)==null?void 0:u.maximum_price)==null?void 0:s.discount)==null?void 0:o.percent_off;else{if(e.__typename==="BundleCartItem")return;c=(p=(n=(t=(l=e==null?void 0:e.product)==null?void 0:l.price_range)==null?void 0:t.maximum_price)==null?void 0:n.discount)==null?void 0:p.percent_off}if(c!==0)return Math.round(c)}function P(e){var a,r,c,i;return e.__typename==="ConfigurableCartItem"?{value:(r=(a=e.configured_variant)==null?void 0:a.price_range)==null?void 0:r.maximum_price.regular_price.value,currency:(i=(c=e.configured_variant)==null?void 0:c.price_range)==null?void 0:i.maximum_price.regular_price.currency}:{value:e.prices.original_item_price.value,currency:e.prices.original_item_price.currency}}function w(e){var c,i,u,s,o,l;let a,r;if(a=((i=(c=e==null?void 0:e.prices)==null?void 0:c.original_row_total)==null?void 0:i.value)-((s=(u=e==null?void 0:e.prices)==null?void 0:u.row_total)==null?void 0:s.value),r=(l=(o=e==null?void 0:e.prices)==null?void 0:o.row_total)==null?void 0:l.currency,a!==0)return{value:a,currency:r}}function C(e){var a,r,c,i,u,s,o,l;return{itemType:e.__typename,uid:e.uid,product:{uid:e.product.uid,sku:e.product.sku,name:e.product.name,priceRange:{maximumPrice:{regularPrice:{value:e.product.price_range.maximum_price.regular_price.value,currency:e.product.price_range.maximum_price.regular_price.currency}}}},image:T(e),links:I(e),discounted:D(e),discountedTotal:{value:e.prices.row_total.value,currency:e.prices.row_total.currency},catalogDiscount:{amountOff:e.prices.catalog_discount.amount_off,percentOff:e.prices.catalog_discount.percent_off},rowCatalogDiscount:{amountOff:e.prices.row_catalog_discount.amount_off,percentOff:e.prices.row_catalog_discount.percent_off},discounts:((r=(a=e.prices)==null?void 0:a.discounts)==null?void 0:r.map(t=>({label:t.label,value:t.value,amount:{value:t.amount.value,currency:t.amount.currency}})))??[],discountPercentage:E(e),insufficientQuantity:(e.__typename==="ConfigurableCartItem"?((c=e.configured_variant)==null?void 0:c.stock_status)??e.product.stock_status:e.product.stock_status)==="IN_STOCK"&&!e.is_available,outOfStock:e.product.stock_status==="OUT_OF_STOCK",stockStatus:e.product.stock_status,quantity:e.quantity,prices:{regularPrice:P(e),priceIncludingTax:{value:e.prices.price_including_tax.value,currency:e.prices.price_including_tax.currency},originalItemPrice:{value:e.prices.original_item_price.value,currency:e.prices.original_item_price.currency},originalRowTotal:{value:e.prices.original_row_total.value,currency:e.prices.original_row_total.currency},rowTotal:{value:e.prices.row_total.value,currency:e.prices.row_total.currency},rowTotalIncludingTax:{value:e.prices.row_total_including_tax.value,currency:e.prices.row_total_including_tax.currency}},savingsAmount:w(e),noteFromBuyer:(i=e.note_from_buyer)==null?void 0:i.map(t=>({createdAt:t.created_at,creatorId:t.creator_id,creatorType:t.creator_type,negotiableQuoteItemUid:t.negotiable_quote_item_uid,note:t.note,noteUid:t.note_uid})),noteFromSeller:(u=e.note_from_seller)==null?void 0:u.map(t=>({createdAt:t.created_at,creatorId:t.creator_id,creatorType:t.creator_type,negotiableQuoteItemUid:t.negotiable_quote_item_uid,note:t.note,noteUid:t.note_uid})),configurableOptions:(s=e.configurable_options)==null?void 0:s.map(t=>({optionLabel:t.option_label,valueLabel:t.value_label})),bundleOptions:(o=e.bundle_options)==null?void 0:o.map(t=>({label:t.label,values:t.values.map(n=>({label:n.label,quantity:n.quantity,originalPrice:{value:n.original_price.value,currency:n.original_price.currency},price:{value:n.priceV2.value,currency:n.priceV2.currency}}))})),customizableOptions:(l=e.customizable_options)==null?void 0:l.map(t=>({type:t.type,label:t.label,values:t.values.map(n=>({label:n.label,value:n.value}))}))}}function O(e){return e?e.map(C):[]}const f=["DRAFT","UPDATED","DECLINED","EXPIRED","NEW","OPEN"];function A(e){if(!e.items)return 0;const a=_.config;return(a==null?void 0:a.quoteSummaryDisplayTotal)===0?e.items.length:(a==null?void 0:a.quoteSummaryDisplayTotal)===1?e.total_quantity:e.items.length}function R(e){return e.every(a=>!a.outOfStock&&!a.insufficientQuantity)}function S(e){var i,u,s,o,l,t;const a=x(e),r=!!((i=e.template_name)!=null&&i.trim()),c=O(e.items);return{uid:e.uid,name:e.name,createdAt:e.created_at,updatedAt:e.updated_at,expirationDate:e.expiration_date,status:a?d.NEW:e.status,isVirtual:!!e.is_virtual,salesRepName:e.sales_rep_name,buyer:{firstname:e.buyer.firstname,lastname:e.buyer.lastname},email:e.email,templateName:e.template_name,totalQuantity:A(e),comments:(u=e.comments)==null?void 0:u.map(n=>{const p={uid:n.uid,createdAt:n.created_at,author:{firstname:n.author.firstname,lastname:n.author.lastname},text:n.text};return Array.isArray(n.attachments)&&n.attachments.length>0&&(p.attachments=n.attachments.map(g=>({name:g.name,url:g.url}))),p}),prices:e.prices&&{appliedDiscounts:(s=e.prices.discounts)==null?void 0:s.map(n=>({amount:{value:n.amount.value,currency:n.amount.currency},label:n.label,coupon:n.coupon})),appliedTaxes:(o=e.prices.applied_taxes)==null?void 0:o.map(n=>({amount:{value:n.amount.value,currency:n.amount.currency},label:n.label})),discount:e.prices.discounts&&e.prices.grand_total&&m(e.prices.discounts,e.prices.grand_total.currency),grandTotal:e.prices.grand_total&&{value:e.prices.grand_total.value,currency:e.prices.grand_total.currency},grandTotalExcludingTax:e.prices.grand_total_excluding_tax&&{value:e.prices.grand_total_excluding_tax.value,currency:e.prices.grand_total_excluding_tax.currency},subtotalExcludingTax:e.prices.subtotal_excluding_tax&&{value:e.prices.subtotal_excluding_tax.value,currency:e.prices.subtotal_excluding_tax.currency},subtotalIncludingTax:e.prices.subtotal_including_tax&&{value:e.prices.subtotal_including_tax.value,currency:e.prices.subtotal_including_tax.currency},subtotalWithDiscountExcludingTax:e.prices.subtotal_with_discount_excluding_tax&&{value:e.prices.subtotal_with_discount_excluding_tax.value,currency:e.prices.subtotal_with_discount_excluding_tax.currency},...Q(e),totalTax:e.prices.applied_taxes&&e.prices.grand_total&&m(e.prices.applied_taxes,e.prices.grand_total.currency)},history:y(e.history),items:c,shippingAddresses:(l=e.shipping_addresses)==null?void 0:l.map(n=>{const p={uid:n.uid,firstname:n.firstname,lastname:n.lastname,company:n.company,street:n.street,city:n.city,postcode:n.postcode,country:{code:n.country.code,label:n.country.label},telephone:n.telephone};return n.region&&(p.region={code:n.region.code,label:n.region.label,regionId:n.region.region_id}),p}),canCheckout:["UPDATED","DECLINED"].includes(e.status)&&_.permissions.checkoutQuote&&((t=e.shipping_addresses)==null?void 0:t.length)>0&&R(c),canSendForReview:!r&&(a||f.includes(e.status))&&_.permissions.editQuote,canUpdateQuote:!r&&(a||f.includes(e.status))&&_.permissions.editQuote,canDelete:!r&&!["PENDING","SUBMITTED","ORDERED"].includes(e.status)&&_.permissions.deleteQuote,canClose:e.status?!r&&!["DRAFT","CLOSED","ORDERED","OPEN"].includes(e.status):!1,readOnly:r||!a&&["ORDERED","SUBMITTED","CLOSED","PENDING"].includes(e.status)||!_.permissions.editQuote}}function W(e){return e?S(e):null}function x(e){return e.status==="SUBMITTED"&&!(e.history??[]).some(a=>{var r,c;return a.change_type==="UPDATED"&&(((c=(r=a.changes)==null?void 0:r.statuses)==null?void 0:c.changes)??[]).length>0})}function N(e){const a=x(e);return{uid:e.uid,name:e.name,createdAt:e.created_at,updatedAt:e.updated_at,status:a?d.NEW:e.status,buyer:{firstname:e.buyer.firstname,lastname:e.buyer.lastname},templateName:e.template_name,prices:{grandTotal:{value:e.prices.grand_total.value,currency:e.prices.grand_total.currency}}}}function V(e){var c;if(!e)return null;const a={items:((c=e.items)==null?void 0:c.filter(i=>i==null?void 0:i.uid).map(N))||[],pageInfo:{currentPage:e.page_info.current_page,pageSize:e.page_info.page_size,totalPages:e.page_info.total_pages},totalCount:e.total_count,sortFields:e.sort_fields?{default:e.sort_fields.default,options:e.sort_fields.options}:void 0},r=k(a);return{...a,paginationInfo:r||void 0}}function k(e){if(!(e!=null&&e.pageInfo)||!e.totalCount)return null;const{currentPage:a,pageSize:r,totalPages:c}=e.pageInfo,{totalCount:i}=e,u=i>0?(a-1)*r+1:0,s=Math.min(a*r,i);return{currentPage:a,totalCount:i,pageSize:r,startItem:u,endItem:s,totalPages:c,pageSizeOptions:[20,30,50,100,200]}}const X=()=>[20,30,50,100,200];function m(e,a){return e!=null&&e.length?e.reduce((r,c)=>({value:r.value+c.amount.value,currency:c.amount.currency}),{value:0,currency:a}):{value:0,currency:a}}function Q(e){var c;if(!e||!((c=e.shipping_addresses)!=null&&c.length))return{};const r=e.shipping_addresses[0].selected_shipping_method;return r?{shippingIncludingTax:r.price_incl_tax&&{value:r.price_incl_tax.value,currency:r.price_incl_tax.currency},shippingExcludingTax:r.price_excl_tax&&{value:r.price_excl_tax.value,currency:r.price_excl_tax.currency}}:{}}export{O as a,y as b,k as c,V as d,M as e,z as f,X as g,G as h,H as i,B as r,L as s,W as t};
4
4
  //# sourceMappingURL=transform-quote.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"transform-quote.js","sources":["/@dropins/storefront-quote-management/src/data/models/negotiable-quote-model.ts","/@dropins/storefront-quote-management/src/api/fetch-graphql/fetch-graphql.ts","/@dropins/storefront-quote-management/src/data/transforms/transform-history.ts","/@dropins/storefront-quote-management/src/data/transforms/transform-quote-items.ts","/@dropins/storefront-quote-management/src/data/transforms/transform-quote.ts"],"sourcesContent":["/********************************************************************\n * Copyright 2025 Adobe\n * All Rights Reserved.\n *\n * NOTICE: Adobe permits you to use, modify, and distribute this\n * file in accordance with the terms of the Adobe license agreement\n * accompanying it.\n *******************************************************************/\n\nexport interface ShippingAddress {\n /**\n * The unique string identifier of the address\n */\n uid?: string;\n firstname: string;\n lastname: string;\n company?: string;\n street: string[];\n city: string;\n region?: {\n code: string;\n label: string;\n regionId: number;\n };\n postcode: string;\n country: {\n code: string;\n label: string;\n };\n telephone: string;\n}\n\nexport interface NegotiableQuoteModel {\n uid: string;\n name: string;\n createdAt: string;\n salesRepName: string;\n expirationDate: string;\n updatedAt: string;\n status: NegotiableQuoteStatus;\n isVirtual: boolean;\n buyer: {\n firstname: string;\n lastname: string;\n };\n email?: string;\n templateName?: string;\n totalQuantity: number;\n comments?: {\n uid: string;\n createdAt: string;\n author: {\n firstname: string;\n lastname: string;\n };\n text: string;\n attachments?: {\n name: string;\n url: string;\n }[];\n }[];\n history?: NegotiableQuoteHistoryEntry[];\n prices: {\n appliedDiscounts?: Discount[];\n appliedTaxes?: Tax[];\n discount?: Currency;\n grandTotal?: Currency;\n grandTotalExcludingTax?: Currency;\n shippingExcludingTax?: Currency;\n shippingIncludingTax?: Currency;\n subtotalExcludingTax?: Currency;\n subtotalIncludingTax?: Currency;\n subtotalWithDiscountExcludingTax?: Currency;\n totalTax?: Currency;\n };\n items: CartItemModel[];\n shippingAddresses?: ShippingAddress[];\n canCheckout: boolean;\n canSendForReview: boolean;\n lockedForEditing?: boolean;\n canDelete: boolean;\n canClose: boolean;\n canUpdateQuote: boolean;\n readOnly: boolean;\n}\n\nexport interface ConfigurableOption {\n optionLabel: string;\n valueLabel: string;\n}\n\nexport interface BundleOption {\n label: string;\n values: {\n label: string;\n quantity: number;\n originalPrice: Currency;\n price: Currency;\n }[];\n}\n\nexport interface CustomizableOption {\n type: string;\n label: string;\n values: {\n label: string;\n value: string;\n }[];\n}\n\nexport interface CartItemModel {\n itemType: string;\n uid: string;\n product: {\n uid: string;\n sku: string;\n name: string;\n templateId?: string;\n templateName?: string;\n priceRange: {\n maximumPrice: {\n regularPrice: Currency;\n };\n };\n };\n image: ItemImage;\n links?: ItemLinks;\n discounted: boolean;\n discountedTotal: Currency;\n catalogDiscount: {\n amountOff: number;\n percentOff: number;\n };\n discounts: {\n label: string;\n value: string;\n amount: Currency;\n }[];\n discountPercentage?: number;\n insufficientQuantity?: boolean;\n outOfStock?: boolean;\n stockStatus: string;\n quantity: number;\n prices: {\n regularPrice: Currency;\n priceIncludingTax: Currency;\n originalItemPrice: Currency;\n originalRowTotal: Currency;\n rowTotal: Currency;\n rowTotalIncludingTax: Currency;\n };\n savingsAmount?: Currency;\n configurableOptions?: ConfigurableOption[];\n bundleOptions?: BundleOption[];\n customizableOptions?: CustomizableOption[];\n noteFromBuyer?: ItemNote[];\n noteFromSeller?: ItemNote[];\n}\n\ninterface ItemImage {\n src: string;\n alt: string;\n}\n\ninterface ItemLinks {\n count: number;\n result: string;\n}\n\nexport interface ItemNote {\n createdAt: string;\n creatorId: number;\n creatorType: number;\n negotiableQuoteItemUid: string;\n note: string;\n noteUid: string;\n}\n\nexport interface Currency {\n value: number;\n currency: string;\n}\n\nexport interface Tax {\n amount: Currency;\n label: string;\n}\n\nexport interface Discount {\n amount: Currency;\n label: string;\n coupon?: Coupon;\n}\n\nexport interface Coupon {\n code: string;\n}\n\nexport interface NegotiableQuoteListEntry {\n uid: string;\n name: string;\n createdAt: string;\n updatedAt: string;\n status: NegotiableQuoteStatus;\n buyer: {\n firstname: string;\n lastname: string;\n };\n templateName: string;\n prices: {\n grandTotal: Currency;\n };\n}\nexport interface NegotiableQuotesListModel {\n items: NegotiableQuoteListEntry[];\n pageInfo: {\n currentPage: number;\n pageSize: number;\n totalPages: number;\n };\n totalCount: number;\n paginationInfo?: PaginationInfo;\n sortFields?: {\n default: string;\n options: Array<{\n label: string;\n value: string;\n }>;\n };\n}\n\nexport interface NegotiableQuoteHistoryEntry {\n author: {\n firstname: string;\n lastname: string;\n };\n changeType: NegotiableQuoteHistoryEntryChangeType;\n changes: {\n commentAdded?: {\n comment: string;\n };\n customChanges?: {\n new_value: string;\n old_value: string;\n title: string;\n };\n expiration?: {\n newExpiration: string;\n oldExpiration: string;\n };\n productsRemoved?: {\n productsRemovedFromCatalog: string[];\n productsRemovedFromQuote?: {\n uid: string;\n name: string;\n sku: string;\n quantity: number;\n }[];\n };\n statuses?: {\n changes: {\n newStatus: string;\n oldStatus: string;\n }[];\n };\n total?: {\n newPrice: Currency;\n oldPrice: Currency;\n };\n };\n createdAt: string;\n uid: string;\n}\n\nexport enum NegotiableQuoteHistoryEntryChangeType {\n CREATED = 'CREATED',\n UPDATED = 'UPDATED',\n CLOSED = 'CLOSED',\n UPDATED_BY_SYSTEM = 'UPDATED_BY_SYSTEM',\n}\n\n// See: https://experienceleague.adobe.com/en/docs/commerce-admin/b2b/quotes/quotes#quote-status\nexport enum NegotiableQuoteStatus {\n NEW = 'NEW', // Currently not returned by the API, but is used to indicate a new quote\n SUBMITTED = 'SUBMITTED',\n PENDING = 'PENDING',\n UPDATED = 'UPDATED',\n OPEN = 'OPEN',\n ORDERED = 'ORDERED',\n CLOSED = 'CLOSED',\n DECLINED = 'DECLINED',\n EXPIRED = 'EXPIRED',\n DRAFT = 'DRAFT',\n}\n\nexport interface PaginationInfo {\n currentPage: number;\n totalCount: number;\n pageSize: number;\n startItem: number;\n endItem: number;\n totalPages: number;\n pageSizeOptions?: number[];\n}\n","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 * 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 { NegotiableQuoteHistoryEntry, NegotiableQuoteHistoryEntryChangeType } from '../models/negotiable-quote-model';\n\n/**\n * Transforms a history entry from the API format to the model format\n * @param historyEntry - Raw history entry from API\n * @returns Transformed history entry\n */\nexport function transformHistoryEntry(\n historyEntry: any\n): NegotiableQuoteHistoryEntry {\n return {\n uid: historyEntry.uid,\n createdAt: historyEntry.created_at,\n author: {\n firstname: historyEntry.author.firstname,\n lastname: historyEntry.author.lastname,\n },\n changeType: historyEntry.change_type as NegotiableQuoteHistoryEntryChangeType,\n changes: {\n commentAdded: historyEntry.changes?.comment_added && {\n comment: historyEntry.changes.comment_added.comment,\n },\n customChanges: historyEntry.changes?.custom_changes && {\n new_value: historyEntry.changes.custom_changes.new_value,\n old_value: historyEntry.changes.custom_changes.old_value,\n title: historyEntry.changes.custom_changes.title,\n },\n expiration: historyEntry.changes?.expiration && {\n newExpiration: historyEntry.changes.expiration.new_expiration,\n oldExpiration: historyEntry.changes.expiration.old_expiration,\n },\n productsRemoved: historyEntry.changes?.products_removed && {\n productsRemovedFromCatalog:\n historyEntry.changes.products_removed.products_removed_from_catalog ||\n [],\n productsRemovedFromQuote:\n historyEntry.changes.products_removed.products_removed_from_quote ||\n [],\n },\n statuses: historyEntry.changes?.statuses && {\n changes:\n historyEntry.changes.statuses.changes?.map((change: any) => ({\n newStatus: change?.new_status,\n oldStatus: change?.old_status,\n })) || [],\n },\n total:\n historyEntry.changes?.total &&\n historyEntry.changes.total.new_price &&\n historyEntry.changes.total.old_price && {\n newPrice: {\n value: historyEntry.changes.total.new_price.value,\n currency: historyEntry.changes.total.new_price.currency,\n },\n oldPrice: {\n value: historyEntry.changes.total.old_price.value,\n currency: historyEntry.changes.total.old_price.currency,\n },\n },\n },\n };\n}\n\n/**\n * Transforms an array of history entries from the API format to the model format\n * @param historyEntries - Array of raw history entries from API\n * @returns Array of transformed history entries\n */\nexport function transformHistory(\n historyEntries: any[] | null | undefined\n): NegotiableQuoteHistoryEntry[] | undefined {\n if (!historyEntries) {\n return undefined;\n }\n\n return historyEntries.map(transformHistoryEntry);\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 { CartItemModel } from '../models/negotiable-quote-model';\nimport { state } from '@/quote-management/lib/state';\n\n/**\n * Finds the most applicable price tier for a given quantity\n * @param priceTiers - Array of price tier objects\n * @param quantity - Current item quantity\n * @returns The applicable tier or null if none found\n */\nfunction findApplicablePriceTier(priceTiers: any[], quantity: number) {\n if (!priceTiers?.length) return null;\n\n // Sort price tiers by quantity in descending order to find the highest applicable tier\n const sortedTiers = [...priceTiers].sort(\n (a: any, b: any) => b.quantity - a.quantity\n );\n\n // Find the highest tier where the current quantity meets or exceeds the tier's minimum quantity\n return sortedTiers.find((tier: any) => quantity >= tier.quantity) || null;\n}\n\n/**\n * Helper function to get the image for a cart item component\n * @param item - Cart item from API\n * @returns Image object with src and alt\n */\nfunction getImage(item: any) {\n const config = state.config;\n\n return {\n // Use parent thumbnail if configured, otherwise use own variant. Use the parent thumbnail as a fallback\n src: config?.useConfigurableParentThumbnail\n ? item.product.thumbnail.url\n : item.configured_variant?.thumbnail?.url || item.product.thumbnail.url,\n alt: config?.useConfigurableParentThumbnail\n ? item.product.thumbnail.label\n : item.configured_variant?.thumbnail?.label ||\n item.product.thumbnail.label,\n };\n}\n\n/**\n * Helper function to get downloadable links for a cart item component\n * @param item - Cart item from API\n * @returns Links object with count and result, or null if no links\n */\nfunction getLinks(item: any) {\n return item.links?.length > 0\n ? {\n count: item.links.length,\n result: item.links.map((link: any) => link.title).join(', '),\n }\n : null;\n}\n\n/**\n * Helper function to check if an item is discounted\n * @param item - Cart item from API\n * @returns True if the item has a discount\n */\nfunction getDiscounted(item: any) {\n const quantity = item.quantity;\n const isConfigurable = item.__typename === 'ConfigurableCartItem';\n\n // Get price tiers and price range based on item type\n const priceTiers = isConfigurable\n ? item.configured_variant?.price_tiers\n : item.product.price_tiers;\n const priceRange = isConfigurable\n ? item.configured_variant?.price_range\n : item.product.price_range;\n\n // Check price tiers first for discount eligibility\n const applicableTier = findApplicablePriceTier(priceTiers, quantity);\n if (applicableTier) {\n return applicableTier.discount.amount_off > 0;\n }\n\n // Fallback to regular price range discount\n return (priceRange?.maximum_price?.discount?.amount_off ?? 0) > 0;\n}\n\n/**\n * Helper function to get the discount percentage of an item\n * @param item - Cart item from API\n * @returns Discount percentage rounded to nearest integer, or undefined if no discount\n */\nfunction getDiscountPercentage(item: any) {\n const quantity = item.quantity;\n\n // Check price tiers first for discount percentage\n const applicableTier = findApplicablePriceTier(\n item.product.price_tiers,\n quantity\n );\n\n if (applicableTier) {\n return Math.round(applicableTier.discount.percent_off);\n }\n\n // Fallback to product-specific discount percentage\n let percent_off;\n\n if (item.__typename === 'ConfigurableCartItem') {\n percent_off =\n item?.configured_variant?.price_range?.maximum_price?.discount\n ?.percent_off;\n } else if (item.__typename === 'BundleCartItem') {\n return undefined;\n } else {\n percent_off =\n item?.product?.price_range?.maximum_price?.discount?.percent_off;\n }\n\n if (percent_off === 0) {\n return undefined;\n }\n\n return Math.round(percent_off);\n}\n\n/**\n * Helper function to get the regular price of an item\n * @param item - Cart item from API\n * @returns Regular price object with value and currency\n */\nfunction getRegularPrice(item: any) {\n if (item.__typename === 'ConfigurableCartItem') {\n return {\n value:\n item.configured_variant?.price_range?.maximum_price.regular_price.value,\n currency:\n item.configured_variant?.price_range?.maximum_price.regular_price\n .currency,\n };\n }\n return {\n value: item.prices.original_item_price.value,\n currency: item.prices.original_item_price.currency,\n };\n}\n\n/**\n * Helper function to get the savings amount of an item\n * @param item - Cart item from API\n * @returns Savings amount object with value and currency, or undefined if no savings\n */\nfunction getSavingsAmount(item: any) {\n let amount_off;\n let currency;\n\n amount_off =\n item?.prices?.original_row_total?.value - item?.prices?.row_total?.value;\n currency = item?.prices?.row_total?.currency;\n\n if (amount_off === 0) {\n return undefined;\n }\n return {\n value: amount_off,\n currency,\n };\n}\n\n/**\n * Transforms a single quote item from the API format to the model format\n * @param item - Raw quote item from API\n * @returns Transformed quote item\n */\nexport function transformQuoteItem(item: any): CartItemModel {\n return {\n itemType: item.__typename,\n uid: item.uid,\n product: {\n uid: item.product.uid,\n sku: item.product.sku,\n name: item.product.name,\n priceRange: {\n maximumPrice: {\n regularPrice: {\n value:\n item.product.price_range.maximum_price.regular_price.value,\n currency:\n item.product.price_range.maximum_price.regular_price.currency,\n },\n },\n },\n },\n image: getImage(item),\n links: getLinks(item),\n discounted: getDiscounted(item),\n discountedTotal: {\n value: item.prices.row_total.value,\n currency: item.prices.row_total.currency,\n },\n catalogDiscount: {\n amountOff: item.prices.catalog_discount.amount_off,\n percentOff: item.prices.catalog_discount.percent_off,\n },\n discounts:\n item.prices?.discounts?.map((discount: any) => ({\n label: discount.label,\n value: discount.value,\n amount: {\n value: discount.amount.value,\n currency: discount.amount.currency,\n },\n })) ?? [],\n discountPercentage: getDiscountPercentage(item),\n insufficientQuantity:\n (item.__typename === 'ConfigurableCartItem'\n ? item.configured_variant?.stock_status ?? item.product.stock_status\n : item.product.stock_status\n ) === 'IN_STOCK' && !item.is_available,\n outOfStock: item.product.stock_status === 'OUT_OF_STOCK',\n stockStatus: item.product.stock_status,\n quantity: item.quantity,\n prices: {\n regularPrice: getRegularPrice(item),\n priceIncludingTax: {\n value: item.prices.price_including_tax.value,\n currency: item.prices.price_including_tax.currency,\n },\n originalItemPrice: {\n value: item.prices.original_item_price.value,\n currency: item.prices.original_item_price.currency,\n },\n originalRowTotal: {\n value: item.prices.original_row_total.value,\n currency: item.prices.original_row_total.currency,\n },\n rowTotal: {\n value: item.prices.row_total.value,\n currency: item.prices.row_total.currency,\n },\n rowTotalIncludingTax: {\n value: item.prices.row_total_including_tax.value,\n currency: item.prices.row_total_including_tax.currency,\n },\n },\n savingsAmount: getSavingsAmount(item),\n noteFromBuyer: item.note_from_buyer?.map((note: any) => ({\n createdAt: note.created_at,\n creatorId: note.creator_id,\n creatorType: note.creator_type,\n negotiableQuoteItemUid: note.negotiable_quote_item_uid,\n note: note.note,\n noteUid: note.note_uid,\n })),\n noteFromSeller: item.note_from_seller?.map((note: any) => ({\n createdAt: note.created_at,\n creatorId: note.creator_id,\n creatorType: note.creator_type,\n negotiableQuoteItemUid: note.negotiable_quote_item_uid,\n note: note.note,\n noteUid: note.note_uid,\n })),\n configurableOptions: item.configurable_options?.map((option: any) => ({\n optionLabel: option.option_label,\n valueLabel: option.value_label,\n })),\n bundleOptions: item.bundle_options?.map((option: any) => ({\n label: option.label,\n values: option.values.map((value: any) => ({\n label: value.label,\n quantity: value.quantity,\n originalPrice: {\n value: value.original_price.value,\n currency: value.original_price.currency,\n },\n price: {\n value: value.priceV2.value,\n currency: value.priceV2.currency,\n },\n })),\n })),\n customizableOptions: item.customizable_options?.map((option: any) => ({\n type: option.type,\n label: option.label,\n values: option.values.map((value: any) => ({\n label: value.label,\n value: value.value,\n })),\n })),\n };\n}\n\n/**\n * Transforms an array of quote items from the API format to the model format\n * @param items - Array of raw quote items from API\n * @returns Array of transformed quote items\n */\nexport function transformQuoteItems(\n items: any[] | null | undefined\n): CartItemModel[] {\n if (!items) {\n return [];\n }\n\n return items.map(transformQuoteItem);\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 CartItemModel,\n NegotiableQuoteListEntry,\n NegotiableQuoteModel,\n NegotiableQuotesListModel,\n NegotiableQuoteStatus,\n PaginationInfo,\n ShippingAddress,\n} from '@/quote-management/data/models/negotiable-quote-model';\nimport { state } from '@/quote-management/lib/state';\nimport { transformHistory } from './transform-history';\nimport { transformQuoteItems } from './transform-quote-items';\n\n// Quote statuses that allow editing/sending for review\nconst EDITABLE_QUOTE_STATUSES = [\n 'DRAFT',\n 'UPDATED',\n 'DECLINED',\n 'EXPIRED',\n 'NEW',\n 'OPEN',\n] as const;\n\n// Helper function to get the total quantity of a quote (number of quote line items or total quantity)\nfunction getTotalQuantity(quote: any) {\n if (!quote.items) return 0;\n\n const config = state.config;\n\n if (config?.quoteSummaryDisplayTotal === 0) return quote.items.length;\n if (config?.quoteSummaryDisplayTotal === 1) return quote.total_quantity;\n // Default to items count if unexpected config value or error returned\n return quote.items.length;\n}\n\nfunction checkAllItemsHaveStock(items: CartItemModel[]): boolean {\n return items.every((item) => !item.outOfStock && !item.insufficientQuantity);\n}\n\n// Base helper that transforms a single quote object directly\nfunction transformSingleQuote(quote: any): NegotiableQuoteModel {\n const isQuoteNew = isNewQuote(quote);\n const isGeneratedFromTemplate = Boolean(quote.template_name?.trim());\n const quoteItems = transformQuoteItems(quote.items);\n return {\n uid: quote.uid,\n name: quote.name,\n createdAt: quote.created_at,\n updatedAt: quote.updated_at,\n expirationDate: quote.expiration_date,\n status: isQuoteNew ? NegotiableQuoteStatus.NEW : quote.status,\n isVirtual: Boolean(quote.is_virtual),\n salesRepName: quote.sales_rep_name,\n buyer: {\n firstname: quote.buyer.firstname,\n lastname: quote.buyer.lastname,\n },\n email: quote.email,\n templateName: quote.template_name,\n totalQuantity: getTotalQuantity(quote),\n comments: quote.comments?.map((comment: any) => {\n const baseComment: any = {\n uid: comment.uid,\n createdAt: comment.created_at,\n author: {\n firstname: comment.author.firstname,\n lastname: comment.author.lastname,\n },\n text: comment.text,\n };\n\n if (\n Array.isArray(comment.attachments) &&\n comment.attachments.length > 0\n ) {\n baseComment.attachments = comment.attachments.map((a: any) => ({\n name: a.name,\n url: a.url,\n }));\n }\n\n return baseComment;\n }),\n prices: quote.prices && {\n appliedDiscounts: quote.prices.discounts?.map((discount: any) => ({\n amount: {\n value: discount.amount.value,\n currency: discount.amount.currency,\n },\n label: discount.label,\n coupon: discount.coupon,\n })),\n appliedTaxes: quote.prices.applied_taxes?.map((tax: any) => ({\n amount: { value: tax.amount.value, currency: tax.amount.currency },\n label: tax.label,\n })),\n discount:\n quote.prices.discounts &&\n quote.prices.grand_total &&\n calculateTotal(\n quote.prices.discounts,\n quote.prices.grand_total.currency\n ),\n grandTotal: quote.prices.grand_total && {\n value: quote.prices.grand_total.value,\n currency: quote.prices.grand_total.currency,\n },\n grandTotalExcludingTax: quote.prices.grand_total_excluding_tax && {\n value: quote.prices.grand_total_excluding_tax.value,\n currency: quote.prices.grand_total_excluding_tax.currency,\n },\n subtotalExcludingTax: quote.prices.subtotal_excluding_tax && {\n value: quote.prices.subtotal_excluding_tax.value,\n currency: quote.prices.subtotal_excluding_tax.currency,\n },\n subtotalIncludingTax: quote.prices.subtotal_including_tax && {\n value: quote.prices.subtotal_including_tax.value,\n currency: quote.prices.subtotal_including_tax.currency,\n },\n subtotalWithDiscountExcludingTax: quote.prices\n .subtotal_with_discount_excluding_tax && {\n value: quote.prices.subtotal_with_discount_excluding_tax.value,\n currency: quote.prices.subtotal_with_discount_excluding_tax.currency,\n },\n ...transformShippingPrices(quote),\n totalTax:\n quote.prices.applied_taxes &&\n quote.prices.grand_total &&\n calculateTotal(\n quote.prices.applied_taxes,\n quote.prices.grand_total.currency\n ),\n },\n history: transformHistory(quote.history),\n items: quoteItems,\n shippingAddresses: quote.shipping_addresses?.map((address: any) => {\n const shippingAddress: ShippingAddress = {\n uid: address.uid,\n firstname: address.firstname,\n lastname: address.lastname,\n company: address.company,\n street: address.street,\n city: address.city,\n postcode: address.postcode,\n country: {\n code: address.country.code,\n label: address.country.label,\n },\n telephone: address.telephone,\n };\n\n if (address.region) {\n shippingAddress.region = {\n code: address.region.code,\n label: address.region.label,\n regionId: address.region.region_id,\n };\n }\n\n return shippingAddress;\n }),\n canCheckout:\n ['UPDATED', 'DECLINED'].includes(quote.status) &&\n state.permissions.checkoutQuote &&\n quote.shipping_addresses?.length > 0 &&\n checkAllItemsHaveStock(quoteItems),\n canSendForReview:\n !isGeneratedFromTemplate &&\n (isQuoteNew || EDITABLE_QUOTE_STATUSES.includes(quote.status)) &&\n state.permissions.editQuote,\n canUpdateQuote:\n !isGeneratedFromTemplate &&\n (isQuoteNew || EDITABLE_QUOTE_STATUSES.includes(quote.status)) &&\n state.permissions.editQuote,\n canDelete:\n !isGeneratedFromTemplate &&\n !['PENDING', 'SUBMITTED', 'ORDERED'].includes(quote.status) &&\n state.permissions.deleteQuote,\n canClose: quote.status\n ? !isGeneratedFromTemplate &&\n !['DRAFT', 'CLOSED', 'ORDERED', 'OPEN'].includes(quote.status)\n : false,\n readOnly:\n isGeneratedFromTemplate ||\n (!isQuoteNew &&\n ['ORDERED', 'SUBMITTED', 'CLOSED', 'PENDING'].includes(quote.status)) ||\n !state.permissions.editQuote,\n };\n}\n\nexport function transformQuote(quoteData: any): NegotiableQuoteModel | null {\n if (!quoteData) {\n return null;\n }\n\n return transformSingleQuote(quoteData);\n}\n\n// quote is new if it has a status of SUBMITTED and there is no history entry that\n// has a change_type of UPDATED with a non-empty array of status changes\nfunction isNewQuote(quote: any): boolean {\n return (\n quote.status === 'SUBMITTED' &&\n !(quote.history ?? []).some(\n (history: any) =>\n history.change_type === 'UPDATED' &&\n (history.changes?.statuses?.changes ?? []).length > 0\n )\n );\n}\n\nfunction transformNegotiableQuoteListEntry(\n quote: any\n): NegotiableQuoteListEntry {\n const isQuoteNew = isNewQuote(quote);\n return {\n uid: quote.uid,\n name: quote.name,\n createdAt: quote.created_at,\n updatedAt: quote.updated_at,\n status: isQuoteNew ? NegotiableQuoteStatus.NEW : quote.status,\n buyer: {\n firstname: quote.buyer.firstname,\n lastname: quote.buyer.lastname,\n },\n templateName: quote.template_name,\n prices: {\n grandTotal: {\n value: quote.prices.grand_total.value,\n currency: quote.prices.grand_total.currency,\n },\n },\n };\n}\n\nexport function transformNegotiableQuotesList(\n quotesData: any\n): NegotiableQuotesListModel | null {\n if (!quotesData) {\n return null;\n }\n\n const transformedModel = {\n items:\n quotesData.items\n ?.filter((quote: any) => quote?.uid)\n .map(transformNegotiableQuoteListEntry) || [],\n pageInfo: {\n currentPage: quotesData.page_info.current_page,\n pageSize: quotesData.page_info.page_size,\n totalPages: quotesData.page_info.total_pages,\n },\n totalCount: quotesData.total_count,\n sortFields: quotesData.sort_fields\n ? {\n default: quotesData.sort_fields.default,\n options: quotesData.sort_fields.options,\n }\n : undefined,\n };\n\n // Calculate pagination info\n const paginationInfo = transformPaginationInfo(transformedModel);\n\n return {\n ...transformedModel,\n paginationInfo: paginationInfo || undefined,\n };\n}\n\nexport function transformPaginationInfo(\n quotesData: NegotiableQuotesListModel | null\n): PaginationInfo | null {\n if (!quotesData?.pageInfo || !quotesData.totalCount) {\n return null;\n }\n\n const { currentPage, pageSize, totalPages } = quotesData.pageInfo;\n const { totalCount } = quotesData;\n\n const startItem = totalCount > 0 ? (currentPage - 1) * pageSize + 1 : 0;\n const endItem = Math.min(currentPage * pageSize, totalCount);\n\n const pageSizeOptions = [20, 30, 50, 100, 200]; // Default page size options\n\n return {\n currentPage,\n totalCount,\n pageSize,\n startItem,\n endItem,\n totalPages,\n pageSizeOptions,\n };\n}\n\n// TODO: Check if admin has this configuration\nexport const getDefaultPageSizeOptions = () => [20, 30, 50, 100, 200];\n\nexport function calculateTotal(data: any[], currency: string) {\n if (!data?.length)\n return {\n value: 0,\n currency,\n };\n\n return data.reduce(\n (acc: any, item: any) => {\n return {\n value: acc.value + item.amount.value,\n currency: item.amount.currency,\n };\n },\n { value: 0, currency }\n );\n}\n\nexport function transformShippingPrices(quote: any) {\n if (!quote || !quote.shipping_addresses?.length) {\n return {};\n }\n\n const shippingAddress = quote.shipping_addresses[0];\n const selectedShippingMethod = shippingAddress.selected_shipping_method;\n\n if (!selectedShippingMethod) {\n return {};\n }\n\n return {\n shippingIncludingTax: selectedShippingMethod.price_incl_tax && {\n value: selectedShippingMethod.price_incl_tax.value,\n currency: selectedShippingMethod.price_incl_tax.currency,\n },\n shippingExcludingTax: selectedShippingMethod.price_excl_tax && {\n value: selectedShippingMethod.price_excl_tax.value,\n currency: selectedShippingMethod.price_excl_tax.currency,\n },\n };\n}\n"],"names":["NegotiableQuoteStatus","setEndpoint","setFetchGraphQlHeader","removeFetchGraphQlHeader","setFetchGraphQlHeaders","fetchGraphQl","getConfig","FetchGraphQL","transformHistoryEntry","historyEntry","_a","_b","_c","_d","_e","_f","change","_g","transformHistory","historyEntries","findApplicablePriceTier","priceTiers","quantity","a","b","tier","getImage","item","config","state","getLinks","link","getDiscounted","isConfigurable","priceRange","applicableTier","getDiscountPercentage","percent_off","_h","getRegularPrice","getSavingsAmount","amount_off","currency","transformQuoteItem","discount","note","option","value","transformQuoteItems","items","EDITABLE_QUOTE_STATUSES","getTotalQuantity","quote","checkAllItemsHaveStock","transformSingleQuote","isQuoteNew","isNewQuote","isGeneratedFromTemplate","quoteItems","comment","baseComment","tax","calculateTotal","transformShippingPrices","address","shippingAddress","transformQuote","quoteData","history","transformNegotiableQuoteListEntry","transformNegotiableQuotesList","quotesData","transformedModel","paginationInfo","transformPaginationInfo","currentPage","pageSize","totalPages","totalCount","startItem","endItem","getDefaultPageSizeOptions","data","acc","selectedShippingMethod"],"mappings":"8FA0RO,IAAKA,GAAAA,IACVA,EAAA,IAAM,MACNA,EAAA,UAAY,YACZA,EAAA,QAAU,UACVA,EAAA,QAAU,UACVA,EAAA,KAAO,OACPA,EAAA,QAAU,UACVA,EAAA,OAAS,SACTA,EAAA,SAAW,WACXA,EAAA,QAAU,UACVA,EAAA,MAAQ,QAVEA,I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ACvC,MAAO,CAAA,EAIT,MAAM0E,EADkBhC,EAAM,mBAAmB,CAAC,EACH,yBAE/C,OAAKgC,EAIE,CACL,qBAAsBA,EAAuB,gBAAkB,CAC7D,MAAOA,EAAuB,eAAe,MAC7C,SAAUA,EAAuB,eAAe,QAAA,EAElD,qBAAsBA,EAAuB,gBAAkB,CAC7D,MAAOA,EAAuB,eAAe,MAC7C,SAAUA,EAAuB,eAAe,QAAA,CAClD,EAXO,CAAA,CAaX"}
1
+ {"version":3,"file":"transform-quote.js","sources":["/@dropins/storefront-quote-management/src/data/models/negotiable-quote-model.ts","/@dropins/storefront-quote-management/src/api/fetch-graphql/fetch-graphql.ts","/@dropins/storefront-quote-management/src/data/transforms/transform-history.ts","/@dropins/storefront-quote-management/src/data/transforms/transform-quote-items.ts","/@dropins/storefront-quote-management/src/data/transforms/transform-quote.ts"],"sourcesContent":["/********************************************************************\n * Copyright 2025 Adobe\n * All Rights Reserved.\n *\n * NOTICE: Adobe permits you to use, modify, and distribute this\n * file in accordance with the terms of the Adobe license agreement\n * accompanying it.\n *******************************************************************/\n\nexport interface ShippingAddress {\n /**\n * The unique string identifier of the address\n */\n uid?: string;\n firstname: string;\n lastname: string;\n company?: string;\n street: string[];\n city: string;\n region?: {\n code: string;\n label: string;\n regionId: number;\n };\n postcode: string;\n country: {\n code: string;\n label: string;\n };\n telephone: string;\n}\n\nexport interface NegotiableQuoteModel {\n uid: string;\n name: string;\n createdAt: string;\n salesRepName: string;\n expirationDate: string;\n updatedAt: string;\n status: NegotiableQuoteStatus;\n isVirtual: boolean;\n buyer: {\n firstname: string;\n lastname: string;\n };\n email?: string;\n templateName?: string;\n totalQuantity: number;\n comments?: {\n uid: string;\n createdAt: string;\n author: {\n firstname: string;\n lastname: string;\n };\n text: string;\n attachments?: {\n name: string;\n url: string;\n }[];\n }[];\n history?: NegotiableQuoteHistoryEntry[];\n prices: {\n appliedDiscounts?: Discount[];\n appliedTaxes?: Tax[];\n discount?: Currency;\n grandTotal?: Currency;\n grandTotalExcludingTax?: Currency;\n shippingExcludingTax?: Currency;\n shippingIncludingTax?: Currency;\n subtotalExcludingTax?: Currency;\n subtotalIncludingTax?: Currency;\n subtotalWithDiscountExcludingTax?: Currency;\n totalTax?: Currency;\n };\n items: CartItemModel[];\n shippingAddresses?: ShippingAddress[];\n canCheckout: boolean;\n canSendForReview: boolean;\n lockedForEditing?: boolean;\n canDelete: boolean;\n canClose: boolean;\n canUpdateQuote: boolean;\n readOnly: boolean;\n}\n\nexport interface ConfigurableOption {\n optionLabel: string;\n valueLabel: string;\n}\n\nexport interface BundleOption {\n label: string;\n values: {\n label: string;\n quantity: number;\n originalPrice: Currency;\n price: Currency;\n }[];\n}\n\nexport interface CustomizableOption {\n type: string;\n label: string;\n values: {\n label: string;\n value: string;\n }[];\n}\n\nexport interface CartItemModel {\n itemType: string;\n uid: string;\n product: {\n uid: string;\n sku: string;\n name: string;\n templateId?: string;\n templateName?: string;\n priceRange: {\n maximumPrice: {\n regularPrice: Currency;\n };\n };\n };\n image: ItemImage;\n links?: ItemLinks;\n discounted: boolean;\n discountedTotal: Currency;\n catalogDiscount: {\n amountOff: number;\n percentOff: number;\n };\n rowCatalogDiscount: {\n amountOff: number;\n percentOff: number;\n };\n discounts: {\n label: string;\n value: string;\n amount: Currency;\n }[];\n discountPercentage?: number;\n insufficientQuantity?: boolean;\n outOfStock?: boolean;\n stockStatus: string;\n quantity: number;\n prices: {\n regularPrice: Currency;\n priceIncludingTax: Currency;\n originalItemPrice: Currency;\n originalRowTotal: Currency;\n rowTotal: Currency;\n rowTotalIncludingTax: Currency;\n };\n savingsAmount?: Currency;\n configurableOptions?: ConfigurableOption[];\n bundleOptions?: BundleOption[];\n customizableOptions?: CustomizableOption[];\n noteFromBuyer?: ItemNote[];\n noteFromSeller?: ItemNote[];\n}\n\ninterface ItemImage {\n src: string;\n alt: string;\n}\n\ninterface ItemLinks {\n count: number;\n result: string;\n}\n\nexport interface ItemNote {\n createdAt: string;\n creatorId: number;\n creatorType: number;\n negotiableQuoteItemUid: string;\n note: string;\n noteUid: string;\n}\n\nexport interface Currency {\n value: number;\n currency: string;\n}\n\nexport interface Tax {\n amount: Currency;\n label: string;\n}\n\nexport interface Discount {\n amount: Currency;\n label: string;\n coupon?: Coupon;\n}\n\nexport interface Coupon {\n code: string;\n}\n\nexport interface NegotiableQuoteListEntry {\n uid: string;\n name: string;\n createdAt: string;\n updatedAt: string;\n status: NegotiableQuoteStatus;\n buyer: {\n firstname: string;\n lastname: string;\n };\n templateName: string;\n prices: {\n grandTotal: Currency;\n };\n}\nexport interface NegotiableQuotesListModel {\n items: NegotiableQuoteListEntry[];\n pageInfo: {\n currentPage: number;\n pageSize: number;\n totalPages: number;\n };\n totalCount: number;\n paginationInfo?: PaginationInfo;\n sortFields?: {\n default: string;\n options: Array<{\n label: string;\n value: string;\n }>;\n };\n}\n\nexport interface NegotiableQuoteHistoryEntry {\n author: {\n firstname: string;\n lastname: string;\n };\n changeType: NegotiableQuoteHistoryEntryChangeType;\n changes: {\n commentAdded?: {\n comment: string;\n };\n customChanges?: {\n new_value: string;\n old_value: string;\n title: string;\n };\n expiration?: {\n newExpiration: string;\n oldExpiration: string;\n };\n productsRemoved?: {\n productsRemovedFromCatalog: string[];\n productsRemovedFromQuote?: {\n uid: string;\n name: string;\n sku: string;\n quantity: number;\n }[];\n };\n statuses?: {\n changes: {\n newStatus: string;\n oldStatus: string;\n }[];\n };\n total?: {\n newPrice: Currency;\n oldPrice: Currency;\n };\n };\n createdAt: string;\n uid: string;\n}\n\nexport enum NegotiableQuoteHistoryEntryChangeType {\n CREATED = 'CREATED',\n UPDATED = 'UPDATED',\n CLOSED = 'CLOSED',\n UPDATED_BY_SYSTEM = 'UPDATED_BY_SYSTEM',\n}\n\n// See: https://experienceleague.adobe.com/en/docs/commerce-admin/b2b/quotes/quotes#quote-status\nexport enum NegotiableQuoteStatus {\n NEW = 'NEW', // Currently not returned by the API, but is used to indicate a new quote\n SUBMITTED = 'SUBMITTED',\n PENDING = 'PENDING',\n UPDATED = 'UPDATED',\n OPEN = 'OPEN',\n ORDERED = 'ORDERED',\n CLOSED = 'CLOSED',\n DECLINED = 'DECLINED',\n EXPIRED = 'EXPIRED',\n DRAFT = 'DRAFT',\n}\n\nexport interface PaginationInfo {\n currentPage: number;\n totalCount: number;\n pageSize: number;\n startItem: number;\n endItem: number;\n totalPages: number;\n pageSizeOptions?: number[];\n}\n","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 * 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 { NegotiableQuoteHistoryEntry, NegotiableQuoteHistoryEntryChangeType } from '../models/negotiable-quote-model';\n\n/**\n * Transforms a history entry from the API format to the model format\n * @param historyEntry - Raw history entry from API\n * @returns Transformed history entry\n */\nexport function transformHistoryEntry(\n historyEntry: any\n): NegotiableQuoteHistoryEntry {\n return {\n uid: historyEntry.uid,\n createdAt: historyEntry.created_at,\n author: {\n firstname: historyEntry.author.firstname,\n lastname: historyEntry.author.lastname,\n },\n changeType: historyEntry.change_type as NegotiableQuoteHistoryEntryChangeType,\n changes: {\n commentAdded: historyEntry.changes?.comment_added && {\n comment: historyEntry.changes.comment_added.comment,\n },\n customChanges: historyEntry.changes?.custom_changes && {\n new_value: historyEntry.changes.custom_changes.new_value,\n old_value: historyEntry.changes.custom_changes.old_value,\n title: historyEntry.changes.custom_changes.title,\n },\n expiration: historyEntry.changes?.expiration && {\n newExpiration: historyEntry.changes.expiration.new_expiration,\n oldExpiration: historyEntry.changes.expiration.old_expiration,\n },\n productsRemoved: historyEntry.changes?.products_removed && {\n productsRemovedFromCatalog:\n historyEntry.changes.products_removed.products_removed_from_catalog ||\n [],\n productsRemovedFromQuote:\n historyEntry.changes.products_removed.products_removed_from_quote ||\n [],\n },\n statuses: historyEntry.changes?.statuses && {\n changes:\n historyEntry.changes.statuses.changes?.map((change: any) => ({\n newStatus: change?.new_status,\n oldStatus: change?.old_status,\n })) || [],\n },\n total:\n historyEntry.changes?.total &&\n historyEntry.changes.total.new_price &&\n historyEntry.changes.total.old_price && {\n newPrice: {\n value: historyEntry.changes.total.new_price.value,\n currency: historyEntry.changes.total.new_price.currency,\n },\n oldPrice: {\n value: historyEntry.changes.total.old_price.value,\n currency: historyEntry.changes.total.old_price.currency,\n },\n },\n },\n };\n}\n\n/**\n * Transforms an array of history entries from the API format to the model format\n * @param historyEntries - Array of raw history entries from API\n * @returns Array of transformed history entries\n */\nexport function transformHistory(\n historyEntries: any[] | null | undefined\n): NegotiableQuoteHistoryEntry[] | undefined {\n if (!historyEntries) {\n return undefined;\n }\n\n return historyEntries.map(transformHistoryEntry);\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 { CartItemModel } from '../models/negotiable-quote-model';\nimport { state } from '@/quote-management/lib/state';\n\n/**\n * Finds the most applicable price tier for a given quantity\n * @param priceTiers - Array of price tier objects\n * @param quantity - Current item quantity\n * @returns The applicable tier or null if none found\n */\nfunction findApplicablePriceTier(priceTiers: any[], quantity: number) {\n if (!priceTiers?.length) return null;\n\n // Sort price tiers by quantity in descending order to find the highest applicable tier\n const sortedTiers = [...priceTiers].sort(\n (a: any, b: any) => b.quantity - a.quantity\n );\n\n // Find the highest tier where the current quantity meets or exceeds the tier's minimum quantity\n return sortedTiers.find((tier: any) => quantity >= tier.quantity) || null;\n}\n\n/**\n * Helper function to get the image for a cart item component\n * @param item - Cart item from API\n * @returns Image object with src and alt\n */\nfunction getImage(item: any) {\n const config = state.config;\n\n return {\n // Use parent thumbnail if configured, otherwise use own variant. Use the parent thumbnail as a fallback\n src: config?.useConfigurableParentThumbnail\n ? item.product.thumbnail.url\n : item.configured_variant?.thumbnail?.url || item.product.thumbnail.url,\n alt: config?.useConfigurableParentThumbnail\n ? item.product.thumbnail.label\n : item.configured_variant?.thumbnail?.label ||\n item.product.thumbnail.label,\n };\n}\n\n/**\n * Helper function to get downloadable links for a cart item component\n * @param item - Cart item from API\n * @returns Links object with count and result, or null if no links\n */\nfunction getLinks(item: any) {\n return item.links?.length > 0\n ? {\n count: item.links.length,\n result: item.links.map((link: any) => link.title).join(', '),\n }\n : null;\n}\n\n/**\n * Helper function to check if an item is discounted\n * @param item - Cart item from API\n * @returns True if the item has a discount\n */\nfunction getDiscounted(item: any) {\n const quantity = item.quantity;\n const isConfigurable = item.__typename === 'ConfigurableCartItem';\n\n // Get price tiers and price range based on item type\n const priceTiers = isConfigurable\n ? item.configured_variant?.price_tiers\n : item.product.price_tiers;\n const priceRange = isConfigurable\n ? item.configured_variant?.price_range\n : item.product.price_range;\n\n // Check price tiers first for discount eligibility\n const applicableTier = findApplicablePriceTier(priceTiers, quantity);\n if (applicableTier) {\n return applicableTier.discount.amount_off > 0;\n }\n\n // Fallback to regular price range discount\n return (priceRange?.maximum_price?.discount?.amount_off ?? 0) > 0;\n}\n\n/**\n * Helper function to get the discount percentage of an item\n * @param item - Cart item from API\n * @returns Discount percentage rounded to nearest integer, or undefined if no discount\n */\nfunction getDiscountPercentage(item: any) {\n const quantity = item.quantity;\n\n // Check price tiers first for discount percentage\n const applicableTier = findApplicablePriceTier(\n item.product.price_tiers,\n quantity\n );\n\n if (applicableTier) {\n return Math.round(applicableTier.discount.percent_off);\n }\n\n // Fallback to product-specific discount percentage\n let percent_off;\n\n if (item.__typename === 'ConfigurableCartItem') {\n percent_off =\n item?.configured_variant?.price_range?.maximum_price?.discount\n ?.percent_off;\n } else if (item.__typename === 'BundleCartItem') {\n return undefined;\n } else {\n percent_off =\n item?.product?.price_range?.maximum_price?.discount?.percent_off;\n }\n\n if (percent_off === 0) {\n return undefined;\n }\n\n return Math.round(percent_off);\n}\n\n/**\n * Helper function to get the regular price of an item\n * @param item - Cart item from API\n * @returns Regular price object with value and currency\n */\nfunction getRegularPrice(item: any) {\n if (item.__typename === 'ConfigurableCartItem') {\n return {\n value:\n item.configured_variant?.price_range?.maximum_price.regular_price.value,\n currency:\n item.configured_variant?.price_range?.maximum_price.regular_price\n .currency,\n };\n }\n return {\n value: item.prices.original_item_price.value,\n currency: item.prices.original_item_price.currency,\n };\n}\n\n/**\n * Helper function to get the savings amount of an item\n * @param item - Cart item from API\n * @returns Savings amount object with value and currency, or undefined if no savings\n */\nfunction getSavingsAmount(item: any) {\n let amount_off;\n let currency;\n\n amount_off =\n item?.prices?.original_row_total?.value - item?.prices?.row_total?.value;\n currency = item?.prices?.row_total?.currency;\n\n if (amount_off === 0) {\n return undefined;\n }\n return {\n value: amount_off,\n currency,\n };\n}\n\n/**\n * Transforms a single quote item from the API format to the model format\n * @param item - Raw quote item from API\n * @returns Transformed quote item\n */\nexport function transformQuoteItem(item: any): CartItemModel {\n return {\n itemType: item.__typename,\n uid: item.uid,\n product: {\n uid: item.product.uid,\n sku: item.product.sku,\n name: item.product.name,\n priceRange: {\n maximumPrice: {\n regularPrice: {\n value:\n item.product.price_range.maximum_price.regular_price.value,\n currency:\n item.product.price_range.maximum_price.regular_price.currency,\n },\n },\n },\n },\n image: getImage(item),\n links: getLinks(item),\n discounted: getDiscounted(item),\n discountedTotal: {\n value: item.prices.row_total.value,\n currency: item.prices.row_total.currency,\n },\n catalogDiscount: {\n amountOff: item.prices.catalog_discount.amount_off,\n percentOff: item.prices.catalog_discount.percent_off,\n },\n rowCatalogDiscount: {\n amountOff: item.prices.row_catalog_discount.amount_off,\n percentOff: item.prices.row_catalog_discount.percent_off,\n },\n discounts:\n item.prices?.discounts?.map((discount: any) => ({\n label: discount.label,\n value: discount.value,\n amount: {\n value: discount.amount.value,\n currency: discount.amount.currency,\n },\n })) ?? [],\n discountPercentage: getDiscountPercentage(item),\n insufficientQuantity:\n (item.__typename === 'ConfigurableCartItem'\n ? item.configured_variant?.stock_status ?? item.product.stock_status\n : item.product.stock_status\n ) === 'IN_STOCK' && !item.is_available,\n outOfStock: item.product.stock_status === 'OUT_OF_STOCK',\n stockStatus: item.product.stock_status,\n quantity: item.quantity,\n prices: {\n regularPrice: getRegularPrice(item),\n priceIncludingTax: {\n value: item.prices.price_including_tax.value,\n currency: item.prices.price_including_tax.currency,\n },\n originalItemPrice: {\n value: item.prices.original_item_price.value,\n currency: item.prices.original_item_price.currency,\n },\n originalRowTotal: {\n value: item.prices.original_row_total.value,\n currency: item.prices.original_row_total.currency,\n },\n rowTotal: {\n value: item.prices.row_total.value,\n currency: item.prices.row_total.currency,\n },\n rowTotalIncludingTax: {\n value: item.prices.row_total_including_tax.value,\n currency: item.prices.row_total_including_tax.currency,\n },\n },\n savingsAmount: getSavingsAmount(item),\n noteFromBuyer: item.note_from_buyer?.map((note: any) => ({\n createdAt: note.created_at,\n creatorId: note.creator_id,\n creatorType: note.creator_type,\n negotiableQuoteItemUid: note.negotiable_quote_item_uid,\n note: note.note,\n noteUid: note.note_uid,\n })),\n noteFromSeller: item.note_from_seller?.map((note: any) => ({\n createdAt: note.created_at,\n creatorId: note.creator_id,\n creatorType: note.creator_type,\n negotiableQuoteItemUid: note.negotiable_quote_item_uid,\n note: note.note,\n noteUid: note.note_uid,\n })),\n configurableOptions: item.configurable_options?.map((option: any) => ({\n optionLabel: option.option_label,\n valueLabel: option.value_label,\n })),\n bundleOptions: item.bundle_options?.map((option: any) => ({\n label: option.label,\n values: option.values.map((value: any) => ({\n label: value.label,\n quantity: value.quantity,\n originalPrice: {\n value: value.original_price.value,\n currency: value.original_price.currency,\n },\n price: {\n value: value.priceV2.value,\n currency: value.priceV2.currency,\n },\n })),\n })),\n customizableOptions: item.customizable_options?.map((option: any) => ({\n type: option.type,\n label: option.label,\n values: option.values.map((value: any) => ({\n label: value.label,\n value: value.value,\n })),\n })),\n };\n}\n\n/**\n * Transforms an array of quote items from the API format to the model format\n * @param items - Array of raw quote items from API\n * @returns Array of transformed quote items\n */\nexport function transformQuoteItems(\n items: any[] | null | undefined\n): CartItemModel[] {\n if (!items) {\n return [];\n }\n\n return items.map(transformQuoteItem);\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 CartItemModel,\n NegotiableQuoteListEntry,\n NegotiableQuoteModel,\n NegotiableQuotesListModel,\n NegotiableQuoteStatus,\n PaginationInfo,\n ShippingAddress,\n} from '@/quote-management/data/models/negotiable-quote-model';\nimport { state } from '@/quote-management/lib/state';\nimport { transformHistory } from './transform-history';\nimport { transformQuoteItems } from './transform-quote-items';\n\n// Quote statuses that allow editing/sending for review\nconst EDITABLE_QUOTE_STATUSES = [\n 'DRAFT',\n 'UPDATED',\n 'DECLINED',\n 'EXPIRED',\n 'NEW',\n 'OPEN',\n] as const;\n\n// Helper function to get the total quantity of a quote (number of quote line items or total quantity)\nfunction getTotalQuantity(quote: any) {\n if (!quote.items) return 0;\n\n const config = state.config;\n\n if (config?.quoteSummaryDisplayTotal === 0) return quote.items.length;\n if (config?.quoteSummaryDisplayTotal === 1) return quote.total_quantity;\n // Default to items count if unexpected config value or error returned\n return quote.items.length;\n}\n\nfunction checkAllItemsHaveStock(items: CartItemModel[]): boolean {\n return items.every((item) => !item.outOfStock && !item.insufficientQuantity);\n}\n\n// Base helper that transforms a single quote object directly\nfunction transformSingleQuote(quote: any): NegotiableQuoteModel {\n const isQuoteNew = isNewQuote(quote);\n const isGeneratedFromTemplate = Boolean(quote.template_name?.trim());\n const quoteItems = transformQuoteItems(quote.items);\n return {\n uid: quote.uid,\n name: quote.name,\n createdAt: quote.created_at,\n updatedAt: quote.updated_at,\n expirationDate: quote.expiration_date,\n status: isQuoteNew ? NegotiableQuoteStatus.NEW : quote.status,\n isVirtual: Boolean(quote.is_virtual),\n salesRepName: quote.sales_rep_name,\n buyer: {\n firstname: quote.buyer.firstname,\n lastname: quote.buyer.lastname,\n },\n email: quote.email,\n templateName: quote.template_name,\n totalQuantity: getTotalQuantity(quote),\n comments: quote.comments?.map((comment: any) => {\n const baseComment: any = {\n uid: comment.uid,\n createdAt: comment.created_at,\n author: {\n firstname: comment.author.firstname,\n lastname: comment.author.lastname,\n },\n text: comment.text,\n };\n\n if (\n Array.isArray(comment.attachments) &&\n comment.attachments.length > 0\n ) {\n baseComment.attachments = comment.attachments.map((a: any) => ({\n name: a.name,\n url: a.url,\n }));\n }\n\n return baseComment;\n }),\n prices: quote.prices && {\n appliedDiscounts: quote.prices.discounts?.map((discount: any) => ({\n amount: {\n value: discount.amount.value,\n currency: discount.amount.currency,\n },\n label: discount.label,\n coupon: discount.coupon,\n })),\n appliedTaxes: quote.prices.applied_taxes?.map((tax: any) => ({\n amount: { value: tax.amount.value, currency: tax.amount.currency },\n label: tax.label,\n })),\n discount:\n quote.prices.discounts &&\n quote.prices.grand_total &&\n calculateTotal(\n quote.prices.discounts,\n quote.prices.grand_total.currency\n ),\n grandTotal: quote.prices.grand_total && {\n value: quote.prices.grand_total.value,\n currency: quote.prices.grand_total.currency,\n },\n grandTotalExcludingTax: quote.prices.grand_total_excluding_tax && {\n value: quote.prices.grand_total_excluding_tax.value,\n currency: quote.prices.grand_total_excluding_tax.currency,\n },\n subtotalExcludingTax: quote.prices.subtotal_excluding_tax && {\n value: quote.prices.subtotal_excluding_tax.value,\n currency: quote.prices.subtotal_excluding_tax.currency,\n },\n subtotalIncludingTax: quote.prices.subtotal_including_tax && {\n value: quote.prices.subtotal_including_tax.value,\n currency: quote.prices.subtotal_including_tax.currency,\n },\n subtotalWithDiscountExcludingTax: quote.prices\n .subtotal_with_discount_excluding_tax && {\n value: quote.prices.subtotal_with_discount_excluding_tax.value,\n currency: quote.prices.subtotal_with_discount_excluding_tax.currency,\n },\n ...transformShippingPrices(quote),\n totalTax:\n quote.prices.applied_taxes &&\n quote.prices.grand_total &&\n calculateTotal(\n quote.prices.applied_taxes,\n quote.prices.grand_total.currency\n ),\n },\n history: transformHistory(quote.history),\n items: quoteItems,\n shippingAddresses: quote.shipping_addresses?.map((address: any) => {\n const shippingAddress: ShippingAddress = {\n uid: address.uid,\n firstname: address.firstname,\n lastname: address.lastname,\n company: address.company,\n street: address.street,\n city: address.city,\n postcode: address.postcode,\n country: {\n code: address.country.code,\n label: address.country.label,\n },\n telephone: address.telephone,\n };\n\n if (address.region) {\n shippingAddress.region = {\n code: address.region.code,\n label: address.region.label,\n regionId: address.region.region_id,\n };\n }\n\n return shippingAddress;\n }),\n canCheckout:\n ['UPDATED', 'DECLINED'].includes(quote.status) &&\n state.permissions.checkoutQuote &&\n quote.shipping_addresses?.length > 0 &&\n checkAllItemsHaveStock(quoteItems),\n canSendForReview:\n !isGeneratedFromTemplate &&\n (isQuoteNew || EDITABLE_QUOTE_STATUSES.includes(quote.status)) &&\n state.permissions.editQuote,\n canUpdateQuote:\n !isGeneratedFromTemplate &&\n (isQuoteNew || EDITABLE_QUOTE_STATUSES.includes(quote.status)) &&\n state.permissions.editQuote,\n canDelete:\n !isGeneratedFromTemplate &&\n !['PENDING', 'SUBMITTED', 'ORDERED'].includes(quote.status) &&\n state.permissions.deleteQuote,\n canClose: quote.status\n ? !isGeneratedFromTemplate &&\n !['DRAFT', 'CLOSED', 'ORDERED', 'OPEN'].includes(quote.status)\n : false,\n readOnly:\n isGeneratedFromTemplate ||\n (!isQuoteNew &&\n ['ORDERED', 'SUBMITTED', 'CLOSED', 'PENDING'].includes(quote.status)) ||\n !state.permissions.editQuote,\n };\n}\n\nexport function transformQuote(quoteData: any): NegotiableQuoteModel | null {\n if (!quoteData) {\n return null;\n }\n\n return transformSingleQuote(quoteData);\n}\n\n// quote is new if it has a status of SUBMITTED and there is no history entry that\n// has a change_type of UPDATED with a non-empty array of status changes\nfunction isNewQuote(quote: any): boolean {\n return (\n quote.status === 'SUBMITTED' &&\n !(quote.history ?? []).some(\n (history: any) =>\n history.change_type === 'UPDATED' &&\n (history.changes?.statuses?.changes ?? []).length > 0\n )\n );\n}\n\nfunction transformNegotiableQuoteListEntry(\n quote: any\n): NegotiableQuoteListEntry {\n const isQuoteNew = isNewQuote(quote);\n return {\n uid: quote.uid,\n name: quote.name,\n createdAt: quote.created_at,\n updatedAt: quote.updated_at,\n status: isQuoteNew ? NegotiableQuoteStatus.NEW : quote.status,\n buyer: {\n firstname: quote.buyer.firstname,\n lastname: quote.buyer.lastname,\n },\n templateName: quote.template_name,\n prices: {\n grandTotal: {\n value: quote.prices.grand_total.value,\n currency: quote.prices.grand_total.currency,\n },\n },\n };\n}\n\nexport function transformNegotiableQuotesList(\n quotesData: any\n): NegotiableQuotesListModel | null {\n if (!quotesData) {\n return null;\n }\n\n const transformedModel = {\n items:\n quotesData.items\n ?.filter((quote: any) => quote?.uid)\n .map(transformNegotiableQuoteListEntry) || [],\n pageInfo: {\n currentPage: quotesData.page_info.current_page,\n pageSize: quotesData.page_info.page_size,\n totalPages: quotesData.page_info.total_pages,\n },\n totalCount: quotesData.total_count,\n sortFields: quotesData.sort_fields\n ? {\n default: quotesData.sort_fields.default,\n options: quotesData.sort_fields.options,\n }\n : undefined,\n };\n\n // Calculate pagination info\n const paginationInfo = transformPaginationInfo(transformedModel);\n\n return {\n ...transformedModel,\n paginationInfo: paginationInfo || undefined,\n };\n}\n\nexport function transformPaginationInfo(\n quotesData: NegotiableQuotesListModel | null\n): PaginationInfo | null {\n if (!quotesData?.pageInfo || !quotesData.totalCount) {\n return null;\n }\n\n const { currentPage, pageSize, totalPages } = quotesData.pageInfo;\n const { totalCount } = quotesData;\n\n const startItem = totalCount > 0 ? (currentPage - 1) * pageSize + 1 : 0;\n const endItem = Math.min(currentPage * pageSize, totalCount);\n\n const pageSizeOptions = [20, 30, 50, 100, 200]; // Default page size options\n\n return {\n currentPage,\n totalCount,\n pageSize,\n startItem,\n endItem,\n totalPages,\n pageSizeOptions,\n };\n}\n\n// TODO: Check if admin has this configuration\nexport const getDefaultPageSizeOptions = () => [20, 30, 50, 100, 200];\n\nexport function calculateTotal(data: any[], currency: string) {\n if (!data?.length)\n return {\n value: 0,\n currency,\n };\n\n return data.reduce(\n (acc: any, item: any) => {\n return {\n value: acc.value + item.amount.value,\n currency: item.amount.currency,\n };\n },\n { value: 0, currency }\n );\n}\n\nexport function transformShippingPrices(quote: any) {\n if (!quote || !quote.shipping_addresses?.length) {\n return {};\n }\n\n const shippingAddress = quote.shipping_addresses[0];\n const selectedShippingMethod = shippingAddress.selected_shipping_method;\n\n if (!selectedShippingMethod) {\n return {};\n }\n\n return {\n shippingIncludingTax: selectedShippingMethod.price_incl_tax && {\n value: selectedShippingMethod.price_incl_tax.value,\n currency: selectedShippingMethod.price_incl_tax.currency,\n },\n shippingExcludingTax: selectedShippingMethod.price_excl_tax && {\n value: selectedShippingMethod.price_excl_tax.value,\n currency: selectedShippingMethod.price_excl_tax.currency,\n },\n };\n}\n"],"names":["NegotiableQuoteStatus","setEndpoint","setFetchGraphQlHeader","removeFetchGraphQlHeader","setFetchGraphQlHeaders","fetchGraphQl","getConfig","FetchGraphQL","transformHistoryEntry","historyEntry","_a","_b","_c","_d","_e","_f","change","_g","transformHistory","historyEntries","findApplicablePriceTier","priceTiers","quantity","a","b","tier","getImage","item","config","state","getLinks","link","getDiscounted","isConfigurable","priceRange","applicableTier","getDiscountPercentage","percent_off","_h","getRegularPrice","getSavingsAmount","amount_off","currency","transformQuoteItem","discount","note","option","value","transformQuoteItems","items","EDITABLE_QUOTE_STATUSES","getTotalQuantity","quote","checkAllItemsHaveStock","transformSingleQuote","isQuoteNew","isNewQuote","isGeneratedFromTemplate","quoteItems","comment","baseComment","tax","calculateTotal","transformShippingPrices","address","shippingAddress","transformQuote","quoteData","history","transformNegotiableQuoteListEntry","transformNegotiableQuotesList","quotesData","transformedModel","paginationInfo","transformPaginationInfo","currentPage","pageSize","totalPages","totalCount","startItem","endItem","getDefaultPageSizeOptions","data","acc","selectedShippingMethod"],"mappings":"8FA8RO,IAAKA,GAAAA,IACVA,EAAA,IAAM,MACNA,EAAA,UAAY,YACZA,EAAA,QAAU,UACVA,EAAA,QAAU,UACVA,EAAA,KAAO,OACPA,EAAA,QAAU,UACVA,EAAA,OAAS,SACTA,EAAA,SAAW,WACXA,EAAA,QAAU,UACVA,EAAA,MAAQ,QAVEA,IAAAA,GAAA,CAAA,CAAA,EC5RL,KAAM,CACX,YAAAC,EACA,sBAAAC,EACA,yBAAAC,EACA,uBAAAC,EACA,aAAAC,EACA,UAAAC,CACF,EAAI,IAAIC,EAAA,EAAe,WAAA,ECOhB,SAASC,EACdC,EAC6B,mBAC7B,MAAO,CACL,IAAKA,EAAa,IAClB,UAAWA,EAAa,WACxB,OAAQ,CACN,UAAWA,EAAa,OAAO,UAC/B,SAAUA,EAAa,OAAO,QAAA,EAEhC,WAAYA,EAAa,YACzB,QAAS,CACP,eAAcC,EAAAD,EAAa,UAAb,YAAAC,EAAsB,gBAAiB,CACnD,QAASD,EAAa,QAAQ,cAAc,OAAA,EAE9C,gBAAeE,EAAAF,EAAa,UAAb,YAAAE,EAAsB,iBAAkB,CACrD,UAAWF,EAAa,QAAQ,eAAe,UAC/C,UAAWA,EAAa,QAAQ,eAAe,UAC/C,MAAOA,EAAa,QAAQ,eAAe,KAAA,EAE7C,aAAYG,EAAAH,EAAa,UAAb,YAAAG,EAAsB,aAAc,CAC9C,cAAeH,EAAa,QAAQ,WAAW,eAC/C,cAAeA,EAAa,QAAQ,WAAW,cAAA,EAEjD,kBAAiBI,EAAAJ,EAAa,UAAb,YAAAI,EAAsB,mBAAoB,CACzD,2BACEJ,EAAa,QAAQ,iBAAiB,+BACtC,CAAA,EACF,yBACEA,EAAa,QAAQ,iBAAiB,6BACtC,CAAA,CAAC,EAEL,WAAUK,EAAAL,EAAa,UAAb,YAAAK,EAAsB,WAAY,CAC1C,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,GAAI,IAAK,GAAG,EAE7D,SAASnB,EAAeoB,EAAaxC,EAAkB,CAC5D,OAAKwC,GAAA,MAAAA,EAAM,OAMJA,EAAK,OACV,CAACC,EAAUxD,KACF,CACL,MAAOwD,EAAI,MAAQxD,EAAK,OAAO,MAC/B,SAAUA,EAAK,OAAO,QAAA,GAG1B,CAAE,MAAO,EAAG,SAAAe,CAAA,CAAS,EAZd,CACL,MAAO,EACP,SAAAA,CAAA,CAYN,CAEO,SAASqB,EAAwBX,EAAY,OAClD,GAAI,CAACA,GAAS,GAAC1C,EAAA0C,EAAM,qBAAN,MAAA1C,EAA0B,QACvC,MAAO,CAAA,EAIT,MAAM0E,EADkBhC,EAAM,mBAAmB,CAAC,EACH,yBAE/C,OAAKgC,EAIE,CACL,qBAAsBA,EAAuB,gBAAkB,CAC7D,MAAOA,EAAuB,eAAe,MAC7C,SAAUA,EAAuB,eAAe,QAAA,EAElD,qBAAsBA,EAAuB,gBAAkB,CAC7D,MAAOA,EAAuB,eAAe,MAC7C,SAAUA,EAAuB,eAAe,QAAA,CAClD,EAXO,CAAA,CAaX"}
@@ -0,0 +1,16 @@
1
+ import { FunctionComponent, VNode } from 'preact';
2
+ import { HTMLAttributes } from 'preact/compat';
3
+
4
+ export interface ExpirationDateModalProps extends Omit<HTMLAttributes<HTMLDivElement>, 'title'> {
5
+ open: boolean;
6
+ expirationDate: string;
7
+ expirationDateError?: string;
8
+ errorBanner?: VNode;
9
+ successBanner?: VNode;
10
+ showCloseButton?: boolean;
11
+ onExpirationDateChange: (value: string) => void;
12
+ onSave: () => void | Promise<void> | Promise<boolean>;
13
+ onClose?: () => void;
14
+ }
15
+ export declare const ExpirationDateModal: FunctionComponent<ExpirationDateModalProps>;
16
+ //# sourceMappingURL=ExpirationDateModal.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 { ExpirationDateModal } from './ExpirationDateModal';
10
+ export type { ExpirationDateModalProps } from './ExpirationDateModal';
11
+ //# sourceMappingURL=index.d.ts.map
@@ -25,6 +25,7 @@ export * from './TabbedContent';
25
25
  export * from './QuoteCommentsList';
26
26
  export * from './ConfirmationModal';
27
27
  export * from './RenameQuoteModal';
28
+ export * from './ExpirationDateModal';
28
29
  export * from './ManageNegotiableQuoteTemplate';
29
30
  export * from './LineItemNoteModal';
30
31
  export * from './ReferenceDocumentFormModal';