@dropins/storefront-quote-management 0.0.1-alpha11 → 0.0.1-alpha13

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 (75) hide show
  1. package/api/getQuoteData/getQuoteData.d.ts +10 -0
  2. package/api/getQuoteData/graphql/QuoteDataQuery.d.ts +2 -0
  3. package/api/getQuoteData/index.d.ts +10 -0
  4. package/api/graphql/NegotiableQuoteFragment.d.ts +1 -1
  5. package/api/graphql/NegotiableQuoteListFragment.d.ts +1 -1
  6. package/api/index.d.ts +3 -0
  7. package/api/initialize/initialize.d.ts +1 -0
  8. package/api/sendForReview/graphql/SendNegotiableQuoteForReviewMutation.d.ts +18 -0
  9. package/api/sendForReview/index.d.ts +10 -0
  10. package/api/sendForReview/sendForReview.d.ts +8 -0
  11. package/api/setShippingAddress/graphql/SetNegotiableQuoteShippingAddressMutation.d.ts +18 -0
  12. package/api/setShippingAddress/index.d.ts +2 -0
  13. package/api/setShippingAddress/setShippingAddress.d.ts +22 -0
  14. package/api.js +37 -4
  15. package/api.js.map +1 -1
  16. package/chunks/NegotiableQuoteFragment.js +166 -0
  17. package/chunks/NegotiableQuoteFragment.js.map +1 -0
  18. package/chunks/WarningFilled.js +4 -0
  19. package/chunks/WarningFilled.js.map +1 -0
  20. package/chunks/negotiableQuotes.js +12 -1
  21. package/chunks/negotiableQuotes.js.map +1 -1
  22. package/chunks/requestNegotiableQuote.js +3 -55
  23. package/chunks/requestNegotiableQuote.js.map +1 -1
  24. package/chunks/sendForReview.js +21 -0
  25. package/chunks/sendForReview.js.map +1 -0
  26. package/chunks/transform-quote.js +1 -1
  27. package/chunks/transform-quote.js.map +1 -1
  28. package/components/ActionsBar/ActionsBar.d.ts +14 -0
  29. package/components/ActionsBar/index.d.ts +11 -0
  30. package/components/ItemsQuoted/ItemsQuoted.d.ts +11 -0
  31. package/components/ItemsQuoted/index.d.ts +11 -0
  32. package/components/ManageNegotiableQuote/ManageNegotiableQuote.d.ts +20 -0
  33. package/components/ManageNegotiableQuote/__fixtures__/ManageNegotiableQuoteProps.d.ts +4 -0
  34. package/components/ManageNegotiableQuote/index.d.ts +11 -0
  35. package/components/OrderSummary/OrderSummary.d.ts +67 -0
  36. package/components/OrderSummary/index.d.ts +11 -0
  37. package/components/OrderSummaryLine/OrderSummaryLine.d.ts +13 -0
  38. package/components/OrderSummaryLine/index.d.ts +11 -0
  39. package/components/ProductListTable/ProductListTable.d.ts +13 -0
  40. package/components/ProductListTable/index.d.ts +11 -0
  41. package/components/QuotePricesSummary/QuotePricesSummary.d.ts +16 -0
  42. package/components/QuotePricesSummary/index.d.ts +11 -0
  43. package/components/QuoteSummaryList/QuoteSummaryList.d.ts +13 -0
  44. package/components/QuoteSummaryList/index.d.ts +11 -0
  45. package/components/ShippingAddressDisplay/ShippingAddressDisplay.d.ts +12 -0
  46. package/components/ShippingAddressDisplay/index.d.ts +11 -0
  47. package/components/TabbedContent/TabbedContent.d.ts +10 -0
  48. package/components/TabbedContent/index.d.ts +11 -0
  49. package/components/index.d.ts +19 -1
  50. package/containers/ItemsQuoted/ItemsQuoted.d.ts +25 -0
  51. package/containers/ItemsQuoted/index.d.ts +11 -0
  52. package/containers/ItemsQuoted.d.ts +3 -0
  53. package/containers/ItemsQuoted.js +4 -0
  54. package/containers/ItemsQuoted.js.map +1 -0
  55. package/containers/ManageNegotiableQuote/ManageNegotiableQuote.d.ts +53 -0
  56. package/containers/ManageNegotiableQuote/index.d.ts +11 -0
  57. package/containers/ManageNegotiableQuote.d.ts +3 -0
  58. package/containers/ManageNegotiableQuote.js +4 -0
  59. package/containers/ManageNegotiableQuote.js.map +1 -0
  60. package/containers/QuotesListTable/QuotesListTable.d.ts +9 -9
  61. package/containers/QuotesListTable.js +1 -1
  62. package/containers/QuotesListTable.js.map +1 -1
  63. package/containers/RequestNegotiableQuoteForm.js +1 -1
  64. package/containers/RequestNegotiableQuoteForm.js.map +1 -1
  65. package/containers/index.d.ts +2 -0
  66. package/data/models/__fixtures__/negotiableQuoteModel.d.ts +7 -0
  67. package/data/models/customer-model.d.ts +1 -0
  68. package/data/models/negotiable-quote-model.d.ts +96 -30
  69. package/data/transforms/__fixtures__/negotiableQuoteData.d.ts +229 -2
  70. package/i18n/en_US.json.d.ts +94 -0
  71. package/lib/state.d.ts +1 -0
  72. package/package.json +1 -1
  73. package/render.js +5 -3
  74. package/render.js.map +1 -1
  75. package/types/state.types.d.ts +1 -0
@@ -1 +1 @@
1
- {"version":3,"file":"RequestNegotiableQuoteForm.js","sources":["../../node_modules/@adobe-commerce/elsie/src/icons/Add.svg","../../node_modules/@adobe-commerce/elsie/src/icons/CheckWithCircle.svg","../../node_modules/@adobe-commerce/elsie/src/icons/WarningFilled.svg","/@dropins/storefront-quote-management/src/components/RequestNegotiableQuoteForm/RequestNegotiableQuoteForm.tsx","/@dropins/storefront-quote-management/src/containers/RequestNegotiableQuoteForm/RequestNegotiableQuoteForm.tsx"],"sourcesContent":["import * as React from \"react\";\nconst SvgAdd = (props) => /* @__PURE__ */ React.createElement(\"svg\", { id: \"Icon_Add_Base\", \"data-name\": \"Icon \\\\u2013 Add \\\\u2013 Base\", xmlns: \"http://www.w3.org/2000/svg\", width: 24, height: 24, viewBox: \"0 0 24 24\", ...props }, /* @__PURE__ */ React.createElement(\"g\", { id: \"Large\" }, /* @__PURE__ */ React.createElement(\"rect\", { id: \"Placement_area\", \"data-name\": \"Placement area\", width: 24, height: 24, fill: \"#fff\", opacity: 0 }), /* @__PURE__ */ React.createElement(\"g\", { id: \"Add_icon\", \"data-name\": \"Add icon\", transform: \"translate(9.734 9.737)\" }, /* @__PURE__ */ React.createElement(\"line\", { vectorEffect: \"non-scaling-stroke\", id: \"Line_579\", \"data-name\": \"Line 579\", y2: 12.7, transform: \"translate(2.216 -4.087)\", fill: \"none\", stroke: \"currentColor\" }), /* @__PURE__ */ React.createElement(\"line\", { vectorEffect: \"non-scaling-stroke\", id: \"Line_580\", \"data-name\": \"Line 580\", x2: 12.7, transform: \"translate(-4.079 2.263)\", fill: \"none\", stroke: \"currentColor\" }))));\nexport default SvgAdd;\n","import * as React from \"react\";\nconst SvgCheckWithCircle = (props) => /* @__PURE__ */ React.createElement(\"svg\", { width: 24, height: 24, viewBox: \"0 0 24 24\", fill: \"none\", xmlns: \"http://www.w3.org/2000/svg\", ...props }, /* @__PURE__ */ React.createElement(\"path\", { vectorEffect: \"non-scaling-stroke\", d: \"M0.75 12C0.75 5.78421 5.78421 0.75 12 0.75C18.2158 0.75 23.25 5.78421 23.25 12C23.25 18.2158 18.2158 23.25 12 23.25C5.78421 23.25 0.75 18.2158 0.75 12Z\", stroke: \"currentColor\" }), /* @__PURE__ */ React.createElement(\"path\", { vectorEffect: \"non-scaling-stroke\", d: \"M6.75 12.762L10.2385 15.75L17.25 9\", stroke: \"currentColor\" }));\nexport default SvgCheckWithCircle;\n","import * as React from \"react\";\nconst SvgWarningFilled = (props) => /* @__PURE__ */ React.createElement(\"svg\", { width: 24, height: 24, viewBox: \"0 0 24 24\", fill: \"none\", xmlns: \"http://www.w3.org/2000/svg\", ...props }, /* @__PURE__ */ React.createElement(\"path\", { vectorEffect: \"non-scaling-stroke\", fillRule: \"evenodd\", clipRule: \"evenodd\", d: \"M1 20.8953L12.1922 1.5L23.395 20.8953H1ZM13.0278 13.9638L13.25 10.0377V9H11.25V10.0377L11.4722 13.9638H13.0278ZM11.2994 16V17.7509H13.2253V16H11.2994Z\", fill: \"currentColor\" }));\nexport default SvgWarningFilled;\n","/********************************************************************\n * Copyright 2025 Adobe\n * All Rights Reserved.\n *\n * NOTICE: Adobe permits you to use, modify, and distribute this \n * file in accordance with the terms of the Adobe license agreement \n * accompanying it. \n *******************************************************************/\n\nimport { FunctionComponent, VNode } from 'preact';\nimport { HTMLAttributes } from 'preact/compat';\nimport { classes, VComponent } from '@adobe-commerce/elsie/lib';\nimport '@/quote-management/components/RequestNegotiableQuoteForm/RequestNegotiableQuoteForm.css';\n\nexport interface RequestNegotiableQuoteFormProps extends Omit<HTMLAttributes<HTMLFormElement>, 'title'> {\n title: VNode;\n banner?: VNode;\n commentField?: VNode;\n quoteNameField?: VNode;\n attachFile?: VNode;\n requestButton?: VNode;\n saveButton?: VNode;\n onSubmit: (e: Event) => void;\n}\n\nexport const RequestNegotiableQuoteForm: FunctionComponent<RequestNegotiableQuoteFormProps> = ({\n className,\n title,\n banner,\n commentField,\n quoteNameField,\n attachFile,\n requestButton,\n saveButton,\n onSubmit,\n ...props\n}) => {\n return (\n <form {...props} className={classes(['request-negotiable-quote-form', className])} onSubmit={onSubmit}>\n {banner &&\n <VComponent\n node={banner}\n className={classes(['request-negotiable-quote-form__banner'])}\n />\n }\n {title &&\n <VComponent\n node={title}\n className={classes(['request-negotiable-quote-form__title'])}\n />\n }\n {commentField &&\n <VComponent\n node={commentField}\n className={classes(['request-negotiable-quote-form__comment-field'])}\n />\n }\n {quoteNameField &&\n <VComponent\n node={quoteNameField}\n className={classes(['request-negotiable-quote-form__quote-name-field'])}\n />\n }\n {attachFile &&\n <VComponent\n node={attachFile}\n className={classes(['request-negotiable-quote-form__attach-file-field'])}\n />\n }\n <div className={classes(['request-negotiable-quote-form__actions'])}>\n {requestButton &&\n <VComponent\n node={requestButton}\n className={classes(['request-negotiable-quote-form__request-button'])}\n />\n }\n {saveButton &&\n <VComponent\n node={saveButton}\n className={classes(['request-negotiable-quote-form__save-button'])}\n />\n }\n </div>\n </form>\n );\n};\n","/********************************************************************\n * Copyright 2025 Adobe\n * All Rights Reserved.\n *\n * NOTICE: Adobe permits you to use, modify, and distribute this \n * file in accordance with the terms of the Adobe license agreement \n * accompanying it. \n *******************************************************************/\n\nimport { HTMLAttributes, useCallback, useEffect, useState } from 'preact/compat';\nimport { Container, getFormErrors, getFormValues, Slot, SlotProps } from '@adobe-commerce/elsie/lib';\nimport { InLineAlert, Button, InputFile, TextArea, Input, Field, InLineAlertProps } from '@adobe-commerce/elsie/components';\nimport { WarningFilled, CheckWithCircle, Add } from '@adobe-commerce/elsie/icons';\nimport RequestNegotiableQuoteFormComponent from '@/quote-management/components/RequestNegotiableQuoteForm';\nimport { useText } from '@adobe-commerce/elsie/i18n';\nimport { events } from '@adobe-commerce/event-bus';\nimport { requestNegotiableQuote, RequestNegotiableQuoteInput } from '@/quote-management/api';\nimport { state } from '@/quote-management/lib/state';\n\nexport type RequestNegotiableQuoteHandlers = {\n onAttachFiles?: (files: File[]) => Promise<void>;\n onRequestNegotiableQuote?: typeof requestNegotiableQuote;\n onSaveNegotiableQuote?: typeof requestNegotiableQuote;\n onSubmitErrors?: (errors: Record<string, string>) => void;\n onError?: (props: {\n error: string,\n isFormDisabled: boolean,\n setIsFormDisabled: (isFormDisabled: boolean) => void,\n }) => void;\n};\n\nexport interface RequestNegotiableQuoteFormProps\n extends Omit<HTMLAttributes<HTMLDivElement>, 'onError'>,\n RequestNegotiableQuoteHandlers {\n cartId: string;\n slots?: {\n ErrorBanner?: SlotProps<{\n message: string,\n }>;\n SuccessBanner?: SlotProps<{\n message: string,\n }>;\n Title?: SlotProps<{\n text: string,\n }>;\n CommentField?: SlotProps<{\n formErrors: Record<string, string>;\n isFormDisabled: boolean;\n setFormErrors: (errors: Record<string, string>) => void;\n }>;\n QuoteNameField?: SlotProps<{\n formErrors: Record<string, string>;\n isFormDisabled: boolean;\n setFormErrors: (errors: Record<string, string>) => void;\n }>;\n AttachFileField?: SlotProps<{\n onChange: (files: File[]) => void, formErrors: Record<string, string>,\n isFormDisabled: boolean\n }>;\n RequestButton?: SlotProps<{\n requestNegotiableQuote: typeof requestNegotiableQuote;\n formErrors: Record<string, string>;\n isFormDisabled: boolean;\n setIsFormDisabled: (isFormDisabled: boolean) => void;\n }>;\n SaveDraftButton?: SlotProps<{\n requestNegotiableQuote: typeof requestNegotiableQuote;\n formErrors: Record<string, string>;\n isFormDisabled: boolean;\n setIsFormDisabled: (isFormDisabled: boolean) => void;\n }>;\n };\n}\n\nexport const RequestNegotiableQuoteForm: Container<RequestNegotiableQuoteFormProps> = ({\n cartId,\n slots,\n onRequestNegotiableQuote,\n onSaveNegotiableQuote,\n onAttachFiles,\n onSubmitErrors,\n onError,\n className,\n}) => {\n const [comment, setComment] = useState<string | undefined>(undefined);\n const [quoteName, setQuoteName] = useState<string | undefined>(undefined);\n const [, setAttachments] = useState<File[]>([]);\n const [error, setError] = useState<string | undefined>(undefined);\n const [formErrors, setFormErrors] = useState<Record<string, string>>({});\n const [success, setSuccess] = useState<string | undefined>(undefined);\n const [isFormDisabled, setIsFormDisabled] = useState<boolean>(false);\n\n const dictionary = useText({\n title: 'NegotiableQuote.Request.title',\n comment: 'NegotiableQuote.Request.comment',\n commentError: 'NegotiableQuote.Request.commentError',\n quoteName: 'NegotiableQuote.Request.quoteName',\n quoteNameError: 'NegotiableQuote.Request.quoteNameError',\n attachmentsError: 'NegotiableQuote.Request.attachmentsError',\n requestCta: 'NegotiableQuote.Request.requestCta',\n saveDraftCta: 'NegotiableQuote.Request.saveDraftCta',\n errorHeader: 'NegotiableQuote.Request.error.header',\n unauthenticated: 'NegotiableQuote.Request.error.unauthenticated',\n unauthorized: 'NegotiableQuote.Request.error.unauthorized',\n missingCart: 'NegotiableQuote.Request.error.missingCart',\n successHeader: 'NegotiableQuote.Request.success.header',\n submitSuccess: 'NegotiableQuote.Request.success.submitted',\n draftSuccess: 'NegotiableQuote.Request.success.draftSaved',\n });\n\n useEffect(() => {\n const permissionsEvent = events.on(\n 'quote-management/permissions',\n (permissions: typeof state.permissions) => {\n setError(undefined);\n if (!permissions.requestQuote) {\n setError(dictionary.unauthorized);\n setIsFormDisabled(true);\n }\n },\n { eager: true }\n );\n return () => permissionsEvent?.off();\n }, [dictionary.unauthorized]);\n\n useEffect(() => {\n const authenticatedEvent = events.on(\n 'authenticated',\n (authenticated: boolean) => {\n setError(undefined);\n if (!authenticated) {\n setError(dictionary.unauthenticated);\n setIsFormDisabled(true);\n }\n },\n { eager: true }\n );\n return () => authenticatedEvent?.off();\n }, [dictionary.unauthenticated]);\n\n useEffect(() => {\n if (!cartId) {\n setError(dictionary.missingCart);\n setIsFormDisabled(true);\n }\n }, [cartId, dictionary.missingCart]);\n\n useEffect(() => {\n if (error) {\n onError?.({ error, isFormDisabled, setIsFormDisabled });\n }\n }, [error, onError, isFormDisabled]);\n\n const handleAttachFiles = useCallback(async (files: File[]) => {\n setFormErrors(prev => ({ ...prev, attachments: '' }));\n setAttachments(files);\n onAttachFiles?.(files)?.catch(() => {\n setFormErrors(prev => ({ ...prev, attachments: dictionary.attachmentsError }));\n });\n }, [onAttachFiles, dictionary]);\n\n /*\n * This function is used to get the banner node.\n * It can be used to render a success or error banner depending on the success or error state.\n */\n const getBannerNode = () => {\n let inlineAlertProps: InLineAlertProps | undefined;\n let slotProps: any | undefined;\n\n if (success) {\n slotProps = {\n name: 'SuccessBanner',\n slot: slots?.SuccessBanner,\n context: {\n message: success,\n },\n 'data-testid': 'form-success-banner',\n };\n inlineAlertProps = {\n type: 'success',\n variant: 'primary',\n icon: <CheckWithCircle />,\n heading: dictionary.successHeader,\n description: success,\n className: 'request-negotiable-quote-form__success-banner',\n };\n }\n else if (error) {\n slotProps = {\n name: 'ErrorBanner',\n slot: slots?.ErrorBanner,\n context: {\n message: error,\n },\n 'data-testid': 'form-error-banner',\n };\n inlineAlertProps = {\n type: 'error',\n variant: 'primary',\n icon: <WarningFilled />,\n heading: dictionary.errorHeader,\n description: error,\n className: 'request-negotiable-quote-form__error-banner',\n };\n }\n\n if (slotProps && inlineAlertProps) {\n return <Slot {...slotProps}>\n <InLineAlert {...inlineAlertProps} />\n </Slot>;\n }\n\n return undefined;\n }\n\n /*\n * This function is used to validate the parent form of the button that was clicked.\n */\n const validateParentForm = (e: Event) => {\n setFormErrors({});\n const closestForm = (e.target as HTMLElement).closest('form') as HTMLFormElement;\n const formErrors = getFormErrors(closestForm);\n if (Object.keys(formErrors).length > 0) {\n setFormErrors(formErrors);\n onSubmitErrors?.(formErrors);\n }\n };\n\n const formSubmitHandler = (e: Event) => {\n e.preventDefault();\n setIsFormDisabled(true);\n\n const form = (e.target as HTMLFormElement);\n\n const currentFormErrors = getFormErrors(form);\n\n const mergedFormErrors = { ...currentFormErrors, ...formErrors };\n\n if (Object.keys(mergedFormErrors).length > 0) {\n onSubmitErrors?.(mergedFormErrors)\n return;\n }\n\n // Since we have multiple submit buttons, we need to determine which one was clicked.\n const buttonTarget = (e as SubmitEvent).submitter as HTMLButtonElement;\n\n const formValues = getFormValues(form);\n\n setComment(formValues.comment);\n setQuoteName(formValues.quoteName);\n\n const isDraft = buttonTarget?.dataset?.draft === 'true' || false;\n\n const contextData: RequestNegotiableQuoteInput = {\n cartId: cartId!,\n quoteName: formValues.quoteName,\n comment: formValues.comment,\n isDraft,\n }\n\n let submitHandler;\n let successMessage;\n\n if (isDraft) {\n submitHandler = onSaveNegotiableQuote ?? requestNegotiableQuote;\n successMessage = dictionary.draftSuccess;\n } else {\n submitHandler = onRequestNegotiableQuote ?? requestNegotiableQuote;\n successMessage = dictionary.submitSuccess;\n }\n\n submitHandler(contextData).then(() => {\n setSuccess(successMessage);\n })\n .catch(error => {\n setError(error.message);\n })\n };\n\n const titleNode = (\n <Slot name=\"Title\" slot={slots?.Title} context={{ text: dictionary.title }}>\n <span data-testid=\"form-title\">{dictionary.title}</span>\n </Slot>\n );\n\n const commentFieldNode = (\n <Slot\n name=\"CommentField\"\n slot={slots?.CommentField}\n context={{\n value: comment,\n required: true,\n errorMessage: formErrors.comment,\n setFormErrors,\n isFormDisabled\n } as any}\n >\n <TextArea\n name=\"comment\"\n value={comment}\n label={dictionary.comment}\n required\n autoComplete=\"off\"\n data-testid=\"form-comment-field\"\n errorMessage={formErrors.comment}\n disabled={isFormDisabled}\n />\n </Slot>\n );\n\n const quoteNameFieldNode = (\n <Slot\n name=\"QuoteNameField\"\n slot={slots?.QuoteNameField}\n context={{\n value: quoteName,\n required: true,\n errorMessage: formErrors.quoteName,\n setFormErrors,\n isFormDisabled\n } as any}\n >\n <Field\n error={formErrors.quoteName}\n disabled={isFormDisabled}\n >\n <Input\n value={quoteName}\n name=\"quoteName\"\n floatingLabel={dictionary.quoteName}\n required\n autoComplete=\"off\"\n data-testid=\"form-quote-name-field\"\n />\n </Field>\n </Slot>\n );\n\n const attachFileNode = (\n <Slot\n name=\"AttachFileField\"\n slot={slots?.AttachFileField}\n context={{ onChange: handleAttachFiles, formErrors, isFormDisabled }}\n >\n <InputFile\n onChange={(e: any) => {\n const files = Array.from(((e.target as HTMLInputElement).files!));\n\n if (files.length > 0) {\n handleAttachFiles(files)\n }\n }}\n icon={<Add />}\n disabled={isFormDisabled}\n data-testid=\"form-attach-file-field\"\n />\n </Slot>\n );\n\n const requestButtonNode = (\n <Slot\n name=\"RequestButton\"\n slot={slots?.RequestButton}\n context={\n {\n requestNegotiableQuote,\n formErrors,\n isFormDisabled,\n setIsFormDisabled\n }\n }\n >\n <Button\n type=\"submit\"\n data-testid=\"form-request-button\"\n onClick={validateParentForm}\n disabled={isFormDisabled}\n >\n {dictionary.requestCta}\n </Button>\n </Slot>\n );\n\n const saveButtonNode = (\n <Slot\n name=\"SaveDraftButton\"\n slot={slots?.SaveDraftButton}\n context={\n {\n requestNegotiableQuote,\n formErrors,\n isFormDisabled,\n setIsFormDisabled\n }\n }\n >\n <Button\n type=\"submit\"\n data-draft=\"true\"\n variant=\"secondary\"\n data-testid=\"form-save-draft-button\"\n onClick={validateParentForm}\n disabled={isFormDisabled}\n >\n {dictionary.saveDraftCta}\n </Button>\n </Slot>\n );\n\n return (\n <RequestNegotiableQuoteFormComponent\n title={titleNode}\n banner={getBannerNode()}\n commentField={commentFieldNode}\n quoteNameField={quoteNameFieldNode}\n attachFile={attachFileNode}\n requestButton={requestButtonNode}\n saveButton={saveButtonNode}\n onSubmit={formSubmitHandler}\n className={className}\n disabled={isFormDisabled}\n data-testid=\"form-container\"\n />\n );\n};"],"names":["SvgAdd","props","React","SvgCheckWithCircle","SvgWarningFilled","RequestNegotiableQuoteForm","className","title","banner","commentField","quoteNameField","attachFile","requestButton","saveButton","onSubmit","jsxs","classes","jsx","VComponent","cartId","slots","onRequestNegotiableQuote","onSaveNegotiableQuote","onAttachFiles","onSubmitErrors","onError","comment","setComment","useState","quoteName","setQuoteName","setAttachments","error","setError","formErrors","setFormErrors","success","setSuccess","isFormDisabled","setIsFormDisabled","dictionary","useText","useEffect","permissionsEvent","events","permissions","authenticatedEvent","authenticated","handleAttachFiles","useCallback","files","prev","_a","getBannerNode","inlineAlertProps","slotProps","CheckWithCircle","WarningFilled","Slot","InLineAlert","validateParentForm","e","closestForm","getFormErrors","formSubmitHandler","form","mergedFormErrors","buttonTarget","formValues","getFormValues","isDraft","contextData","submitHandler","successMessage","requestNegotiableQuote","titleNode","commentFieldNode","TextArea","quoteNameFieldNode","Field","Input","attachFileNode","InputFile","Add","requestButtonNode","Button","saveButtonNode","RequestNegotiableQuoteFormComponent"],"mappings":"+tBACA,MAAMA,GAAUC,GAA0BC,EAAM,cAAc,MAAO,CAAE,GAAI,gBAAiB,YAAa,gCAAiC,MAAO,6BAA8B,MAAO,GAAI,OAAQ,GAAI,QAAS,YAAa,GAAGD,GAAyBC,EAAM,cAAc,IAAK,CAAE,GAAI,OAAO,EAAoBA,EAAM,cAAc,OAAQ,CAAE,GAAI,iBAAkB,YAAa,iBAAkB,MAAO,GAAI,OAAQ,GAAI,KAAM,OAAQ,QAAS,CAAC,CAAE,EAAmBA,EAAM,cAAc,IAAK,CAAE,GAAI,WAAY,YAAa,WAAY,UAAW,wBAAwB,EAAoBA,EAAM,cAAc,OAAQ,CAAE,aAAc,qBAAsB,GAAI,WAAY,YAAa,WAAY,GAAI,KAAM,UAAW,0BAA2B,KAAM,OAAQ,OAAQ,cAAc,CAAE,EAAmBA,EAAM,cAAc,OAAQ,CAAE,aAAc,qBAAsB,GAAI,WAAY,YAAa,WAAY,GAAI,KAAM,UAAW,0BAA2B,KAAM,OAAQ,OAAQ,eAAgB,CAAC,CAAC,CAAC,ECAt9BC,GAAsBF,GAA0BC,EAAM,cAAc,MAAO,CAAE,M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AAAsD,EACA,WAAAxC,EACA,eAAAI,EACA,kBAAAC,CAAA,EAIJ,SAAAtB,EAACoE,EAAA,CACC,KAAK,SACL,cAAY,sBACZ,QAASzB,EACT,SAAUtB,EAET,SAAAE,EAAW,UAAA,CAAA,CACd,CAAA,EAIE8C,EACJrE,EAACyC,EAAA,CACC,KAAK,kBACL,KAAMtC,GAAA,YAAAA,EAAO,gBACb,QACE,CACE,uBAAAsD,EACA,WAAAxC,EACA,eAAAI,EACA,kBAAAC,CAAA,EAIJ,SAAAtB,EAACoE,EAAA,CACC,KAAK,SACL,aAAW,OACX,QAAQ,YACR,cAAY,yBACZ,QAASzB,EACT,SAAUtB,EAET,SAAAE,EAAW,YAAA,CAAA,CACd,CAAA,EAIJ,OACEvB,EAACsE,GAAA,CACC,MAAOZ,EACP,OAAQtB,EAAA,EACR,aAAcuB,EACd,eAAgBE,EAChB,WAAYG,EACZ,cAAeG,EACf,WAAYE,EACZ,SAAUtB,EACV,UAAA1D,EACA,SAAUgC,EACV,cAAY,gBAAA,CAAA,CAGlB","x_google_ignoreList":[0,1,2]}
1
+ {"version":3,"file":"RequestNegotiableQuoteForm.js","sources":["../../node_modules/@adobe-commerce/elsie/src/icons/Add.svg","../../node_modules/@adobe-commerce/elsie/src/icons/CheckWithCircle.svg","/@dropins/storefront-quote-management/src/components/RequestNegotiableQuoteForm/RequestNegotiableQuoteForm.tsx","/@dropins/storefront-quote-management/src/containers/RequestNegotiableQuoteForm/RequestNegotiableQuoteForm.tsx"],"sourcesContent":["import * as React from \"react\";\nconst SvgAdd = (props) => /* @__PURE__ */ React.createElement(\"svg\", { id: \"Icon_Add_Base\", \"data-name\": \"Icon \\\\u2013 Add \\\\u2013 Base\", xmlns: \"http://www.w3.org/2000/svg\", width: 24, height: 24, viewBox: \"0 0 24 24\", ...props }, /* @__PURE__ */ React.createElement(\"g\", { id: \"Large\" }, /* @__PURE__ */ React.createElement(\"rect\", { id: \"Placement_area\", \"data-name\": \"Placement area\", width: 24, height: 24, fill: \"#fff\", opacity: 0 }), /* @__PURE__ */ React.createElement(\"g\", { id: \"Add_icon\", \"data-name\": \"Add icon\", transform: \"translate(9.734 9.737)\" }, /* @__PURE__ */ React.createElement(\"line\", { vectorEffect: \"non-scaling-stroke\", id: \"Line_579\", \"data-name\": \"Line 579\", y2: 12.7, transform: \"translate(2.216 -4.087)\", fill: \"none\", stroke: \"currentColor\" }), /* @__PURE__ */ React.createElement(\"line\", { vectorEffect: \"non-scaling-stroke\", id: \"Line_580\", \"data-name\": \"Line 580\", x2: 12.7, transform: \"translate(-4.079 2.263)\", fill: \"none\", stroke: \"currentColor\" }))));\nexport default SvgAdd;\n","import * as React from \"react\";\nconst SvgCheckWithCircle = (props) => /* @__PURE__ */ React.createElement(\"svg\", { width: 24, height: 24, viewBox: \"0 0 24 24\", fill: \"none\", xmlns: \"http://www.w3.org/2000/svg\", ...props }, /* @__PURE__ */ React.createElement(\"path\", { vectorEffect: \"non-scaling-stroke\", d: \"M0.75 12C0.75 5.78421 5.78421 0.75 12 0.75C18.2158 0.75 23.25 5.78421 23.25 12C23.25 18.2158 18.2158 23.25 12 23.25C5.78421 23.25 0.75 18.2158 0.75 12Z\", stroke: \"currentColor\" }), /* @__PURE__ */ React.createElement(\"path\", { vectorEffect: \"non-scaling-stroke\", d: \"M6.75 12.762L10.2385 15.75L17.25 9\", stroke: \"currentColor\" }));\nexport default SvgCheckWithCircle;\n","/********************************************************************\n * Copyright 2025 Adobe\n * All Rights Reserved.\n *\n * NOTICE: Adobe permits you to use, modify, and distribute this \n * file in accordance with the terms of the Adobe license agreement \n * accompanying it. \n *******************************************************************/\n\nimport { FunctionComponent, VNode } from 'preact';\nimport { HTMLAttributes } from 'preact/compat';\nimport { classes, VComponent } from '@adobe-commerce/elsie/lib';\nimport '@/quote-management/components/RequestNegotiableQuoteForm/RequestNegotiableQuoteForm.css';\n\nexport interface RequestNegotiableQuoteFormProps extends Omit<HTMLAttributes<HTMLFormElement>, 'title'> {\n title: VNode;\n banner?: VNode;\n commentField?: VNode;\n quoteNameField?: VNode;\n attachFile?: VNode;\n requestButton?: VNode;\n saveButton?: VNode;\n onSubmit: (e: Event) => void;\n}\n\nexport const RequestNegotiableQuoteForm: FunctionComponent<RequestNegotiableQuoteFormProps> = ({\n className,\n title,\n banner,\n commentField,\n quoteNameField,\n attachFile,\n requestButton,\n saveButton,\n onSubmit,\n ...props\n}) => {\n return (\n <form {...props} className={classes(['request-negotiable-quote-form', className])} onSubmit={onSubmit}>\n {banner &&\n <VComponent\n node={banner}\n className={classes(['request-negotiable-quote-form__banner'])}\n />\n }\n {title &&\n <VComponent\n node={title}\n className={classes(['request-negotiable-quote-form__title'])}\n />\n }\n {commentField &&\n <VComponent\n node={commentField}\n className={classes(['request-negotiable-quote-form__comment-field'])}\n />\n }\n {quoteNameField &&\n <VComponent\n node={quoteNameField}\n className={classes(['request-negotiable-quote-form__quote-name-field'])}\n />\n }\n {attachFile &&\n <VComponent\n node={attachFile}\n className={classes(['request-negotiable-quote-form__attach-file-field'])}\n />\n }\n <div className={classes(['request-negotiable-quote-form__actions'])}>\n {requestButton &&\n <VComponent\n node={requestButton}\n className={classes(['request-negotiable-quote-form__request-button'])}\n />\n }\n {saveButton &&\n <VComponent\n node={saveButton}\n className={classes(['request-negotiable-quote-form__save-button'])}\n />\n }\n </div>\n </form>\n );\n};\n","/********************************************************************\n * Copyright 2025 Adobe\n * All Rights Reserved.\n *\n * NOTICE: Adobe permits you to use, modify, and distribute this \n * file in accordance with the terms of the Adobe license agreement \n * accompanying it. \n *******************************************************************/\n\nimport { HTMLAttributes, useCallback, useEffect, useState } from 'preact/compat';\nimport { Container, getFormErrors, getFormValues, Slot, SlotProps } from '@adobe-commerce/elsie/lib';\nimport { InLineAlert, Button, InputFile, TextArea, Input, Field, InLineAlertProps } from '@adobe-commerce/elsie/components';\nimport { WarningFilled, CheckWithCircle, Add } from '@adobe-commerce/elsie/icons';\nimport RequestNegotiableQuoteFormComponent from '@/quote-management/components/RequestNegotiableQuoteForm';\nimport { useText } from '@adobe-commerce/elsie/i18n';\nimport { events } from '@adobe-commerce/event-bus';\nimport { requestNegotiableQuote, RequestNegotiableQuoteInput } from '@/quote-management/api';\nimport { state } from '@/quote-management/lib/state';\n\nexport type RequestNegotiableQuoteHandlers = {\n onAttachFiles?: (files: File[]) => Promise<void>;\n onRequestNegotiableQuote?: typeof requestNegotiableQuote;\n onSaveNegotiableQuote?: typeof requestNegotiableQuote;\n onSubmitErrors?: (errors: Record<string, string>) => void;\n onError?: (props: {\n error: string,\n isFormDisabled: boolean,\n setIsFormDisabled: (isFormDisabled: boolean) => void,\n }) => void;\n};\n\nexport interface RequestNegotiableQuoteFormProps\n extends Omit<HTMLAttributes<HTMLDivElement>, 'onError'>,\n RequestNegotiableQuoteHandlers {\n cartId: string;\n slots?: {\n ErrorBanner?: SlotProps<{\n message: string,\n }>;\n SuccessBanner?: SlotProps<{\n message: string,\n }>;\n Title?: SlotProps<{\n text: string,\n }>;\n CommentField?: SlotProps<{\n formErrors: Record<string, string>;\n isFormDisabled: boolean;\n setFormErrors: (errors: Record<string, string>) => void;\n }>;\n QuoteNameField?: SlotProps<{\n formErrors: Record<string, string>;\n isFormDisabled: boolean;\n setFormErrors: (errors: Record<string, string>) => void;\n }>;\n AttachFileField?: SlotProps<{\n onChange: (files: File[]) => void, formErrors: Record<string, string>,\n isFormDisabled: boolean\n }>;\n RequestButton?: SlotProps<{\n requestNegotiableQuote: typeof requestNegotiableQuote;\n formErrors: Record<string, string>;\n isFormDisabled: boolean;\n setIsFormDisabled: (isFormDisabled: boolean) => void;\n }>;\n SaveDraftButton?: SlotProps<{\n requestNegotiableQuote: typeof requestNegotiableQuote;\n formErrors: Record<string, string>;\n isFormDisabled: boolean;\n setIsFormDisabled: (isFormDisabled: boolean) => void;\n }>;\n };\n}\n\nexport const RequestNegotiableQuoteForm: Container<RequestNegotiableQuoteFormProps> = ({\n cartId,\n slots,\n onRequestNegotiableQuote,\n onSaveNegotiableQuote,\n onAttachFiles,\n onSubmitErrors,\n onError,\n className,\n}) => {\n const [comment, setComment] = useState<string | undefined>(undefined);\n const [quoteName, setQuoteName] = useState<string | undefined>(undefined);\n const [, setAttachments] = useState<File[]>([]);\n const [error, setError] = useState<string | undefined>(undefined);\n const [formErrors, setFormErrors] = useState<Record<string, string>>({});\n const [success, setSuccess] = useState<string | undefined>(undefined);\n const [isFormDisabled, setIsFormDisabled] = useState<boolean>(false);\n\n const dictionary = useText({\n title: 'NegotiableQuote.Request.title',\n comment: 'NegotiableQuote.Request.comment',\n commentError: 'NegotiableQuote.Request.commentError',\n quoteName: 'NegotiableQuote.Request.quoteName',\n quoteNameError: 'NegotiableQuote.Request.quoteNameError',\n attachmentsError: 'NegotiableQuote.Request.attachmentsError',\n requestCta: 'NegotiableQuote.Request.requestCta',\n saveDraftCta: 'NegotiableQuote.Request.saveDraftCta',\n errorHeader: 'NegotiableQuote.Request.error.header',\n unauthenticated: 'NegotiableQuote.Request.error.unauthenticated',\n unauthorized: 'NegotiableQuote.Request.error.unauthorized',\n missingCart: 'NegotiableQuote.Request.error.missingCart',\n successHeader: 'NegotiableQuote.Request.success.header',\n submitSuccess: 'NegotiableQuote.Request.success.submitted',\n draftSuccess: 'NegotiableQuote.Request.success.draftSaved',\n });\n\n useEffect(() => {\n const permissionsEvent = events.on(\n 'quote-management/permissions',\n (permissions: typeof state.permissions) => {\n setError(undefined);\n if (!permissions.requestQuote) {\n setError(dictionary.unauthorized);\n setIsFormDisabled(true);\n }\n },\n { eager: true }\n );\n return () => permissionsEvent?.off();\n }, [dictionary.unauthorized]);\n\n useEffect(() => {\n const authenticatedEvent = events.on(\n 'authenticated',\n (authenticated: boolean) => {\n setError(undefined);\n if (!authenticated) {\n setError(dictionary.unauthenticated);\n setIsFormDisabled(true);\n }\n },\n { eager: true }\n );\n return () => authenticatedEvent?.off();\n }, [dictionary.unauthenticated]);\n\n useEffect(() => {\n if (!cartId) {\n setError(dictionary.missingCart);\n setIsFormDisabled(true);\n }\n }, [cartId, dictionary.missingCart]);\n\n useEffect(() => {\n if (error) {\n onError?.({ error, isFormDisabled, setIsFormDisabled });\n }\n }, [error, onError, isFormDisabled]);\n\n const handleAttachFiles = useCallback(async (files: File[]) => {\n setFormErrors(prev => ({ ...prev, attachments: '' }));\n setAttachments(files);\n onAttachFiles?.(files)?.catch(() => {\n setFormErrors(prev => ({ ...prev, attachments: dictionary.attachmentsError }));\n });\n }, [onAttachFiles, dictionary]);\n\n /*\n * This function is used to get the banner node.\n * It can be used to render a success or error banner depending on the success or error state.\n */\n const getBannerNode = () => {\n let inlineAlertProps: InLineAlertProps | undefined;\n let slotProps: any | undefined;\n\n if (success) {\n slotProps = {\n name: 'SuccessBanner',\n slot: slots?.SuccessBanner,\n context: {\n message: success,\n },\n 'data-testid': 'form-success-banner',\n };\n inlineAlertProps = {\n type: 'success',\n variant: 'primary',\n icon: <CheckWithCircle />,\n heading: dictionary.successHeader,\n description: success,\n className: 'request-negotiable-quote-form__success-banner',\n };\n }\n else if (error) {\n slotProps = {\n name: 'ErrorBanner',\n slot: slots?.ErrorBanner,\n context: {\n message: error,\n },\n 'data-testid': 'form-error-banner',\n };\n inlineAlertProps = {\n type: 'error',\n variant: 'primary',\n icon: <WarningFilled />,\n heading: dictionary.errorHeader,\n description: error,\n className: 'request-negotiable-quote-form__error-banner',\n };\n }\n\n if (slotProps && inlineAlertProps) {\n return <Slot {...slotProps}>\n <InLineAlert {...inlineAlertProps} />\n </Slot>;\n }\n\n return undefined;\n }\n\n /*\n * This function is used to validate the parent form of the button that was clicked.\n */\n const validateParentForm = (e: Event) => {\n setFormErrors({});\n const closestForm = (e.target as HTMLElement).closest('form') as HTMLFormElement;\n const formErrors = getFormErrors(closestForm);\n if (Object.keys(formErrors).length > 0) {\n setFormErrors(formErrors);\n onSubmitErrors?.(formErrors);\n }\n };\n\n const formSubmitHandler = (e: Event) => {\n e.preventDefault();\n setIsFormDisabled(true);\n\n const form = (e.target as HTMLFormElement);\n\n const currentFormErrors = getFormErrors(form);\n\n const mergedFormErrors = { ...currentFormErrors, ...formErrors };\n\n if (Object.keys(mergedFormErrors).length > 0) {\n onSubmitErrors?.(mergedFormErrors)\n return;\n }\n\n // Since we have multiple submit buttons, we need to determine which one was clicked.\n const buttonTarget = (e as SubmitEvent).submitter as HTMLButtonElement;\n\n const formValues = getFormValues(form);\n\n setComment(formValues.comment);\n setQuoteName(formValues.quoteName);\n\n const isDraft = buttonTarget?.dataset?.draft === 'true' || false;\n\n const contextData: RequestNegotiableQuoteInput = {\n cartId: cartId!,\n quoteName: formValues.quoteName,\n comment: formValues.comment,\n isDraft,\n }\n\n let submitHandler;\n let successMessage;\n\n if (isDraft) {\n submitHandler = onSaveNegotiableQuote ?? requestNegotiableQuote;\n successMessage = dictionary.draftSuccess;\n } else {\n submitHandler = onRequestNegotiableQuote ?? requestNegotiableQuote;\n successMessage = dictionary.submitSuccess;\n }\n\n submitHandler(contextData).then(() => {\n setSuccess(successMessage);\n })\n .catch(error => {\n setError(error.message);\n })\n };\n\n const titleNode = (\n <Slot name=\"Title\" slot={slots?.Title} context={{ text: dictionary.title }}>\n <span data-testid=\"form-title\">{dictionary.title}</span>\n </Slot>\n );\n\n const commentFieldNode = (\n <Slot\n name=\"CommentField\"\n slot={slots?.CommentField}\n context={{\n value: comment,\n required: true,\n errorMessage: formErrors.comment,\n setFormErrors,\n isFormDisabled\n } as any}\n >\n <TextArea\n name=\"comment\"\n value={comment}\n label={dictionary.comment}\n required\n autoComplete=\"off\"\n data-testid=\"form-comment-field\"\n errorMessage={formErrors.comment}\n disabled={isFormDisabled}\n />\n </Slot>\n );\n\n const quoteNameFieldNode = (\n <Slot\n name=\"QuoteNameField\"\n slot={slots?.QuoteNameField}\n context={{\n value: quoteName,\n required: true,\n errorMessage: formErrors.quoteName,\n setFormErrors,\n isFormDisabled\n } as any}\n >\n <Field\n error={formErrors.quoteName}\n disabled={isFormDisabled}\n >\n <Input\n value={quoteName}\n name=\"quoteName\"\n floatingLabel={dictionary.quoteName}\n required\n autoComplete=\"off\"\n data-testid=\"form-quote-name-field\"\n />\n </Field>\n </Slot>\n );\n\n const attachFileNode = (\n <Slot\n name=\"AttachFileField\"\n slot={slots?.AttachFileField}\n context={{ onChange: handleAttachFiles, formErrors, isFormDisabled }}\n >\n <InputFile\n onChange={(e: any) => {\n const files = Array.from(((e.target as HTMLInputElement).files!));\n\n if (files.length > 0) {\n handleAttachFiles(files)\n }\n }}\n icon={<Add />}\n disabled={isFormDisabled}\n data-testid=\"form-attach-file-field\"\n />\n </Slot>\n );\n\n const requestButtonNode = (\n <Slot\n name=\"RequestButton\"\n slot={slots?.RequestButton}\n context={\n {\n requestNegotiableQuote,\n formErrors,\n isFormDisabled,\n setIsFormDisabled\n }\n }\n >\n <Button\n type=\"submit\"\n data-testid=\"form-request-button\"\n onClick={validateParentForm}\n disabled={isFormDisabled}\n >\n {dictionary.requestCta}\n </Button>\n </Slot>\n );\n\n const saveButtonNode = (\n <Slot\n name=\"SaveDraftButton\"\n slot={slots?.SaveDraftButton}\n context={\n {\n requestNegotiableQuote,\n formErrors,\n isFormDisabled,\n setIsFormDisabled\n }\n }\n >\n <Button\n type=\"submit\"\n data-draft=\"true\"\n variant=\"secondary\"\n data-testid=\"form-save-draft-button\"\n onClick={validateParentForm}\n disabled={isFormDisabled}\n >\n {dictionary.saveDraftCta}\n </Button>\n </Slot>\n );\n\n return (\n <RequestNegotiableQuoteFormComponent\n title={titleNode}\n banner={getBannerNode()}\n commentField={commentFieldNode}\n quoteNameField={quoteNameFieldNode}\n attachFile={attachFileNode}\n requestButton={requestButtonNode}\n saveButton={saveButtonNode}\n onSubmit={formSubmitHandler}\n className={className}\n disabled={isFormDisabled}\n data-testid=\"form-container\"\n />\n );\n};\n"],"names":["SvgAdd","props","React","SvgCheckWithCircle","RequestNegotiableQuoteForm","className","title","banner","commentField","quoteNameField","attachFile","requestButton","saveButton","onSubmit","jsxs","classes","jsx","VComponent","cartId","slots","onRequestNegotiableQuote","onSaveNegotiableQuote","onAttachFiles","onSubmitErrors","onError","comment","setComment","useState","quoteName","setQuoteName","setAttachments","error","setError","formErrors","setFormErrors","success","setSuccess","isFormDisabled","setIsFormDisabled","dictionary","useText","useEffect","permissionsEvent","events","permissions","authenticatedEvent","authenticated","handleAttachFiles","useCallback","files","prev","_a","getBannerNode","inlineAlertProps","slotProps","CheckWithCircle","WarningFilled","Slot","InLineAlert","validateParentForm","e","closestForm","getFormErrors","formSubmitHandler","form","mergedFormErrors","buttonTarget","formValues","getFormValues","isDraft","contextData","submitHandler","successMessage","requestNegotiableQuote","titleNode","commentFieldNode","TextArea","quoteNameFieldNode","Field","Input","attachFileNode","InputFile","Add","requestButtonNode","Button","saveButtonNode","RequestNegotiableQuoteFormComponent"],"mappings":"4zBACA,MAAMA,GAAUC,GAA0BC,EAAM,cAAc,MAAO,CAAE,GAAI,gBAAiB,YAAa,gCAAiC,MAAO,6BAA8B,MAAO,GAAI,OAAQ,GAAI,QAAS,YAAa,GAAGD,GAAyBC,EAAM,cAAc,IAAK,CAAE,GAAI,OAAO,EAAoBA,EAAM,cAAc,OAAQ,CAAE,GAAI,iBAAkB,YAAa,iBAAkB,MAAO,GAAI,OAAQ,GAAI,KAAM,OAAQ,QAAS,CAAC,CAAE,EAAmBA,EAAM,cAAc,IAAK,CAAE,GAAI,WAAY,YAAa,WAAY,UAAW,wBAAwB,EAAoBA,EAAM,cAAc,OAAQ,CAAE,aAAc,qBAAsB,GAAI,WAAY,YAAa,WAAY,GAAI,KAAM,UAAW,0BAA2B,KAAM,OAAQ,OAAQ,cAAc,CAAE,EAAmBA,EAAM,cAAc,OAAQ,CAAE,aAAc,qBAAsB,GAAI,WAAY,YAAa,WAAY,GAAI,KAAM,UAAW,0BAA2B,KAAM,OAAQ,OAAQ,eAAgB,CAAC,CAAC,CAAC,ECAt9BC,GAAsBF,GAA0BC,EAAM,cAAc,MAAO,CAAE,MAAO,GAAI,OAAQ,GAAI,QAAS,YAAa,KAAM,OAAQ,MAAO,6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I,EACA,kBAAAC,CAAA,EAIJ,SAAAtB,EAACoE,EAAA,CACC,KAAK,SACL,aAAW,OACX,QAAQ,YACR,cAAY,yBACZ,QAASzB,EACT,SAAUtB,EAET,SAAAE,EAAW,YAAA,CAAA,CACd,CAAA,EAIJ,OACEvB,EAACsE,GAAA,CACC,MAAOZ,EACP,OAAQtB,EAAA,EACR,aAAcuB,EACd,eAAgBE,EAChB,WAAYG,EACZ,cAAeG,EACf,WAAYE,EACZ,SAAUtB,EACV,UAAA1D,EACA,SAAUgC,EACV,cAAY,gBAAA,CAAA,CAGlB","x_google_ignoreList":[0,1]}
@@ -1,3 +1,5 @@
1
1
  export * from './RequestNegotiableQuoteForm';
2
+ export * from './ManageNegotiableQuote';
3
+ export * from './ItemsQuoted';
2
4
  export * from './QuotesListTable';
3
5
  //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1,7 @@
1
+ import { NegotiableQuoteCartItem, NegotiableQuoteModel } from '../negotiable-quote-model';
2
+
3
+ export declare const baseCartItem: NegotiableQuoteCartItem;
4
+ export declare const configurableCartItem: NegotiableQuoteCartItem;
5
+ export declare const bundleCartItem: NegotiableQuoteCartItem;
6
+ export declare const base: NegotiableQuoteModel;
7
+ //# sourceMappingURL=negotiableQuoteModel.d.ts.map
@@ -13,5 +13,6 @@ export interface CustomerPermissions {
13
13
  canRequestQuote: boolean;
14
14
  canEditQuote: boolean;
15
15
  canDeleteQuote: boolean;
16
+ canCheckoutQuote: boolean;
16
17
  }
17
18
  //# sourceMappingURL=customer-model.d.ts.map
@@ -1,8 +1,28 @@
1
+ export interface ShippingAddress {
2
+ firstname: string;
3
+ lastname: string;
4
+ company?: string;
5
+ street: string[];
6
+ city: string;
7
+ region?: {
8
+ code: string;
9
+ label: string;
10
+ regionId: number;
11
+ };
12
+ postcode: string;
13
+ country: {
14
+ code: string;
15
+ label: string;
16
+ };
17
+ telephone: string;
18
+ }
1
19
  export interface NegotiableQuoteModel {
2
20
  uid: string;
3
21
  name: string;
4
- createdAt?: string;
5
- updatedAt?: string;
22
+ createdAt: string;
23
+ salesRepName: string;
24
+ expirationDate: string;
25
+ updatedAt: string;
6
26
  status: NegotiableQuoteStatus;
7
27
  buyer: {
8
28
  firstname: string;
@@ -17,41 +37,86 @@ export interface NegotiableQuoteModel {
17
37
  lastname: string;
18
38
  };
19
39
  }[];
20
- prices?: {
21
- subtotalExcludingTax?: {
22
- value: number;
23
- };
24
- subtotalIncludingTax?: {
25
- value: number;
26
- };
27
- subtotalWithDiscountExcludingTax?: {
28
- value: number;
29
- };
30
- grandTotal?: {
31
- value: number;
32
- currency: string;
33
- };
40
+ prices: {
41
+ subtotalExcludingTax?: Currency;
42
+ subtotalIncludingTax?: Currency;
43
+ subtotalWithDiscountExcludingTax?: Currency;
44
+ grandTotal?: Currency;
45
+ appliedTaxes?: {
46
+ amount: Currency;
47
+ label: string;
48
+ }[];
34
49
  };
35
- items?: {
36
- product: {
37
- uid: string;
38
- sku: string;
39
- name: string;
40
- templateId?: string;
41
- templateName?: string;
42
- priceRange: {
43
- maximumPrice: {
44
- regularPrice: {
45
- value: number;
46
- };
50
+ items: NegotiableQuoteCartItem[];
51
+ shippingAddresses?: ShippingAddress[];
52
+ canCheckout: boolean;
53
+ canSendForReview: boolean;
54
+ }
55
+ export interface NegotiableQuoteCartItem {
56
+ product: {
57
+ uid: string;
58
+ sku: string;
59
+ name: string;
60
+ templateId?: string;
61
+ templateName?: string;
62
+ priceRange: {
63
+ maximumPrice: {
64
+ regularPrice: {
65
+ value: number;
47
66
  };
48
67
  };
49
68
  };
50
- quantity: number;
69
+ };
70
+ catalogDiscount: {
71
+ amountOff: number;
72
+ percentOff: number;
73
+ };
74
+ discounts: {
75
+ label: string;
76
+ value: string;
77
+ amount: Currency;
78
+ }[];
79
+ stockStatus: string;
80
+ quantity: number;
81
+ prices: {
82
+ originalItemPrice: Currency;
83
+ rowTotal: Currency;
84
+ };
85
+ configurableOptions?: {
86
+ optionLabel: string;
87
+ valueLabel: string;
88
+ }[];
89
+ bundleOptions?: {
90
+ label: string;
91
+ values: {
92
+ label: string;
93
+ quantity: number;
94
+ originalPrice: Currency;
95
+ price: Currency;
96
+ }[];
51
97
  }[];
52
98
  }
99
+ export interface Currency {
100
+ value: number;
101
+ currency: string;
102
+ }
103
+ export interface NegotiableQuoteListEntry {
104
+ uid: string;
105
+ name: string;
106
+ createdAt: string;
107
+ updatedAt: string;
108
+ status: NegotiableQuoteStatus;
109
+ buyer: {
110
+ firstname: string;
111
+ lastname: string;
112
+ };
113
+ templateName: string;
114
+ prices: {
115
+ grandTotal: Currency;
116
+ };
117
+ }
53
118
  export interface NegotiableQuotesListModel {
54
- items: NegotiableQuoteModel[];
119
+ items: NegotiableQuoteListEntry[];
55
120
  pageInfo: {
56
121
  currentPage: number;
57
122
  pageSize: number;
@@ -68,6 +133,7 @@ export interface NegotiableQuotesListModel {
68
133
  };
69
134
  }
70
135
  export declare enum NegotiableQuoteStatus {
136
+ NEW = "NEW",
71
137
  SUBMITTED = "SUBMITTED",
72
138
  PENDING = "PENDING",
73
139
  UPDATED = "UPDATED",
@@ -1,4 +1,4 @@
1
- import { NegotiableQuoteModel, NegotiableQuoteStatus } from '../../models/negotiable-quote-model';
1
+ import { NegotiableQuoteStatus } from '../../models/negotiable-quote-model';
2
2
 
3
3
  export declare const mockGraphQLResponse: {
4
4
  data: {
@@ -55,7 +55,234 @@ export declare const mockGraphQLResponse: {
55
55
  };
56
56
  };
57
57
  };
58
- export declare const expectedTransformedQuote: NegotiableQuoteModel;
58
+ export declare const mockQuoteData: {
59
+ uid: string;
60
+ name: string;
61
+ created_at: string;
62
+ status: string;
63
+ sales_rep_name: string;
64
+ expiration_date: string;
65
+ updated_at: string;
66
+ buyer: {
67
+ firstname: string;
68
+ lastname: string;
69
+ };
70
+ comments: {
71
+ uid: string;
72
+ created_at: string;
73
+ author: {
74
+ firstname: string;
75
+ lastname: string;
76
+ };
77
+ text: string;
78
+ }[];
79
+ template_id: null;
80
+ template_name: null;
81
+ items: ({
82
+ product: {
83
+ name: string;
84
+ sku: string;
85
+ uid: string;
86
+ stock_status: string;
87
+ quantity: null;
88
+ price_range: {
89
+ maximum_price: {
90
+ regular_price: {
91
+ value: number;
92
+ };
93
+ };
94
+ };
95
+ };
96
+ prices: {
97
+ price: {
98
+ currency: string;
99
+ value: number;
100
+ };
101
+ original_item_price: {
102
+ currency: string;
103
+ value: number;
104
+ };
105
+ original_row_total: {
106
+ currency: string;
107
+ value: number;
108
+ };
109
+ row_total: {
110
+ currency: string;
111
+ value: number;
112
+ };
113
+ catalog_discount: {
114
+ amount_off: number;
115
+ percent_off: number;
116
+ };
117
+ discounts: {
118
+ label: string;
119
+ value: number;
120
+ amount: {
121
+ currency: string;
122
+ value: number;
123
+ };
124
+ }[];
125
+ };
126
+ quantity: number;
127
+ configurable_options?: undefined;
128
+ bundle_options?: undefined;
129
+ } | {
130
+ product: {
131
+ name: string;
132
+ sku: string;
133
+ uid: string;
134
+ stock_status: string;
135
+ quantity: null;
136
+ price_range: {
137
+ maximum_price: {
138
+ regular_price: {
139
+ value: number;
140
+ };
141
+ };
142
+ };
143
+ };
144
+ prices: {
145
+ price: {
146
+ currency: string;
147
+ value: number;
148
+ };
149
+ original_item_price: {
150
+ currency: string;
151
+ value: number;
152
+ };
153
+ original_row_total: {
154
+ currency: string;
155
+ value: number;
156
+ };
157
+ row_total: {
158
+ currency: string;
159
+ value: number;
160
+ };
161
+ catalog_discount: {
162
+ amount_off: number;
163
+ percent_off: number;
164
+ };
165
+ discounts: never[];
166
+ };
167
+ quantity: number;
168
+ configurable_options: {
169
+ option_label: string;
170
+ value_label: string;
171
+ }[];
172
+ bundle_options?: undefined;
173
+ } | {
174
+ product: {
175
+ name: string;
176
+ sku: string;
177
+ uid: string;
178
+ stock_status: string;
179
+ quantity: null;
180
+ price_range: {
181
+ maximum_price: {
182
+ regular_price: {
183
+ value: number;
184
+ };
185
+ };
186
+ };
187
+ };
188
+ prices: {
189
+ price: {
190
+ currency: string;
191
+ value: number;
192
+ };
193
+ original_item_price: {
194
+ currency: string;
195
+ value: number;
196
+ };
197
+ original_row_total: {
198
+ currency: string;
199
+ value: number;
200
+ };
201
+ row_total: {
202
+ currency: string;
203
+ value: number;
204
+ };
205
+ catalog_discount: {
206
+ amount_off: number;
207
+ percent_off: number;
208
+ };
209
+ discounts: {
210
+ label: string;
211
+ value: number;
212
+ amount: {
213
+ currency: string;
214
+ value: number;
215
+ };
216
+ }[];
217
+ };
218
+ quantity: number;
219
+ bundle_options: {
220
+ label: string;
221
+ values: {
222
+ label: string;
223
+ quantity: number;
224
+ original_price: {
225
+ currency: string;
226
+ value: number;
227
+ };
228
+ priceV2: {
229
+ currency: string;
230
+ value: number;
231
+ };
232
+ }[];
233
+ }[];
234
+ configurable_options?: undefined;
235
+ })[];
236
+ history: {
237
+ uid: string;
238
+ created_at: string;
239
+ author: {
240
+ firstname: string;
241
+ lastname: string;
242
+ };
243
+ change_type: string;
244
+ changes: {
245
+ comment_added: {
246
+ comment: string;
247
+ };
248
+ statuses: {
249
+ changes: {
250
+ new_status: string;
251
+ old_status: null;
252
+ }[];
253
+ };
254
+ expiration: {
255
+ new_expiration: null;
256
+ old_expiration: null;
257
+ };
258
+ };
259
+ }[];
260
+ prices: {
261
+ subtotal_excluding_tax: {
262
+ currency: string;
263
+ value: number;
264
+ };
265
+ subtotal_including_tax: {
266
+ currency: string;
267
+ value: number;
268
+ };
269
+ subtotal_with_discount_excluding_tax: {
270
+ currency: string;
271
+ value: number;
272
+ };
273
+ applied_taxes: {
274
+ label: string;
275
+ amount: {
276
+ currency: string;
277
+ value: number;
278
+ };
279
+ }[];
280
+ grand_total: {
281
+ currency: string;
282
+ value: number;
283
+ };
284
+ };
285
+ };
59
286
  export declare const mockNegotiableQuotesResponse: {
60
287
  data: {
61
288
  negotiableQuotes: {
@@ -20,6 +20,100 @@ declare const _default: {
20
20
  "submitted": "Quote request submitted successfully!",
21
21
  "draftSaved": "Quote saved as draft successfully!"
22
22
  }
23
+ },
24
+ "Manage": {
25
+ "createdLabel": "Created:",
26
+ "salesRepLabel": "Sales Rep:",
27
+ "expiresLabel": "Expires:",
28
+ "actionsLabel": "Actions",
29
+ "actions": {
30
+ "remove": "Remove"
31
+ },
32
+ "bannerTitle": "Alert",
33
+ "bannerStatusMessages": {
34
+ "submitted": "This quote is currently locked for editing. It will become available once released by the Merchant.",
35
+ "pending": "This quote is currently locked for editing. It will become available once released by the Merchant.",
36
+ "expired": "Your quote has expired and the product prices have been updated as per the latest prices in your catalog. You can either re-submit the quote to seller for further negotiation or go to checkout."
37
+ },
38
+ "actionButtons": {
39
+ "close": "Close quote",
40
+ "delete": "Delete quote",
41
+ "print": "Print quote",
42
+ "createTemplate": "Create quote template",
43
+ "createCopy": "Create copy",
44
+ "sendForReview": "Send for review"
45
+ },
46
+ "shippingInformation": {
47
+ "title": "Shipping Information"
48
+ },
49
+ "shippingAddress": {
50
+ "noAddress": "No shipping address has been set for this quote."
51
+ },
52
+ "quoteComments": {
53
+ "title": "Quote Comments",
54
+ "placeholder": "Add your comment"
55
+ },
56
+ "productListTable": {
57
+ "headers": {
58
+ "productName": "Product name",
59
+ "sku": "SKU",
60
+ "price": "Price",
61
+ "quantity": "Quantity",
62
+ "discount": "Discount",
63
+ "subtotal": "Subtotal",
64
+ "actions": "Actions"
65
+ },
66
+ "submitButton": "Update",
67
+ "actions": {
68
+ "editNoteToSeller": "Edit note to seller",
69
+ "remove": "Remove"
70
+ }
71
+ },
72
+ "quotePricesSummary": {
73
+ "subtotal": {
74
+ "excludingTax": "Quote Subtotal (excluding tax)"
75
+ },
76
+ "appliedTaxes": "Applied Taxes",
77
+ "grandTotal": {
78
+ "includingTax": "Quote Grand Total (including tax)"
79
+ }
80
+ }
81
+ },
82
+ "PriceSummary": {
83
+ "giftOptionsTax": {
84
+ "printedCard": {
85
+ "title": "Printed card",
86
+ "inclTax": "Including taxes",
87
+ "exclTax": "excluding taxes"
88
+ },
89
+ "itemGiftWrapping": {
90
+ "title": "Item gift wrapping",
91
+ "inclTax": "Including taxes",
92
+ "exclTax": "excluding taxes"
93
+ },
94
+ "orderGiftWrapping": {
95
+ "title": "Order gift wrapping",
96
+ "inclTax": "Including taxes",
97
+ "exclTax": "excluding taxes"
98
+ }
99
+ },
100
+ "subTotal": {
101
+ "label": "Subtotal",
102
+ "withTaxes": "Including taxes",
103
+ "withoutTaxes": "excluding taxes"
104
+ },
105
+ "taxes": {
106
+ "total": "Tax Total",
107
+ "totalOnly": "Tax",
108
+ "breakdown": "Taxes",
109
+ "showBreakdown": "Show Tax Breakdown",
110
+ "hideBreakdown": "Hide Tax Breakdown"
111
+ },
112
+ "total": {
113
+ "label": "Total",
114
+ "withoutTax": "Total excluding taxes",
115
+ "saved": "Total saved"
116
+ }
23
117
  }
24
118
  },
25
119
  "QuoteManagement": {
package/lib/state.d.ts CHANGED
@@ -4,6 +4,7 @@ export declare const DEFAULT_PERMISSIONS: {
4
4
  requestQuote: boolean;
5
5
  editQuote: boolean;
6
6
  deleteQuote: boolean;
7
+ checkoutQuote: boolean;
7
8
  };
8
9
  export declare const state: State;
9
10
  //# sourceMappingURL=state.d.ts.map
package/package.json CHANGED
@@ -1 +1 @@
1
- {"name": "@dropins/storefront-quote-management", "version": "0.0.1-alpha11", "@dropins/tools": "^1.5.0-beta4", "license": "SEE LICENSE IN LICENSE.md"}
1
+ {"name": "@dropins/storefront-quote-management", "version": "0.0.1-alpha13", "@dropins/tools": "^1.5.1", "license": "SEE LICENSE IN LICENSE.md"}