@oneblink/apps-react 13.4.0-beta.4 → 13.4.0-beta.6

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.
@@ -159,7 +159,7 @@ function PaymentReceipt({ onDone, onCancel, }) {
159
159
  }, [submissionResult, transaction === null || transaction === void 0 ? void 0 : transaction.isSuccess]);
160
160
  return (_jsxs("div", { children: [isLoading && (_jsx("section", { children: _jsxs("div", { className: "cypress-loading has-text-centered", children: [_jsx(OnLoading, { className: "has-text-centered" }), _jsx("span", { children: "Retrieving transaction details..." })] }) })), transaction && (_jsxs(Receipt, { className: "ob-payment-receipt", containerClassName: "ob-payment-receipt__container", children: [_jsxs(ReceiptList, { successIconClassName: "ob-payment-receipt__success-icon", warningIconClassName: "ob-payment-receipt__warning-icon", warningMessageClassName: "ob-payment-receipt__warning-message cypress-payment-receipt-warning-message", warningMessage: transaction.isSuccess
161
161
  ? undefined
162
- : transaction.errorMessage || undefined, children: [postSubmissionSuccessHtml && (_jsx("div", { className: "ob-list__item ob-payment-receipt__success-message", children: _jsx("div", { className: "ob-list__content-wrapper", children: _jsx("div", { className: "ob-list__content", children: _jsx(QuillHTML, { html: postSubmissionSuccessHtml, className: "cypress-payment-receipt-success-message" }) }) }) })), receiptItems &&
162
+ : transaction.errorMessage || undefined, hideSuccessIcon: !!postSubmissionSuccessHtml, children: [postSubmissionSuccessHtml && (_jsx("div", { className: "ob-list__item ob-payment-receipt__success-message", children: _jsx("div", { className: "ob-list__content-wrapper", children: _jsx("div", { className: "ob-list__content", children: _jsx(QuillHTML, { html: postSubmissionSuccessHtml, className: "cypress-payment-receipt-success-message" }) }) }) })), receiptItems &&
163
163
  receiptItems.length &&
164
164
  receiptItems.map((receiptItem, i) => {
165
165
  var _a, _b;
@@ -1 +1 @@
1
- {"version":3,"file":"PaymentReceipt.js","sourceRoot":"","sources":["../src/PaymentReceipt.tsx"],"names":[],"mappings":";AAAA,OAAO,KAAK,KAAK,MAAM,OA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AAK,SAAS,EAAC,gFAAgF,YAC7F,KAAC,YAAY,IAAC,SAAS,EAAC,6DAA6D,sBAEtE,GACX,EACN,YAAG,SAAS,EAAC,yEAAyE,YACnF,SAAS,CAAC,OAAO,GAChB,IACI,CACX,EAEA,UAAU,IAAI,CACb,KAAC,KAAK,IACJ,MAAM,QACN,KAAK,EAAE,UAAU,CAAC,KAAK,IAAI,WAAW,EACtC,aAAa,EAAC,6CAA6C,EAC3D,OAAO,EACL,iBACE,IAAI,EAAC,QAAQ,EACb,SAAS,EAAC,6EAA6E,EACvF,OAAO,EAAE,eAAe,EACxB,SAAS,2BAGF,YAGV,UAAU,CAAC,OAAO,GACb,CACT,EAEA,mBAAmB,IAAI,CACtB,KAAC,KAAK,IACJ,MAAM,QACN,KAAK,EAAE,mBAAmB,CAAC,KAAK,IAAI,WAAW,EAC/C,aAAa,EAAC,6CAA6C,EAC3D,OAAO,EACL,iBACE,IAAI,EAAC,QAAQ,EACb,SAAS,EAAC,6EAA6E,EACvF,OAAO,EAAE,wBAAwB,EACjC,SAAS,2BAGF,YAGV,mBAAmB,CAAC,OAAO,GACtB,CACT,IACG,CACP,CAAA;AACH,CAAC;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgDG;AACH,eAAe,KAAK,CAAC,IAAI,CAAC,cAAc,CAAC,CAAA","sourcesContent":["import * as React from 'react'\nimport { useHistory } from 'react-router-dom'\nimport {\n paymentService,\n submissionService,\n OneBlinkAppsError,\n schedulingService,\n localisationService,\n} from './apps'\nimport useIsMounted from './hooks/useIsMounted'\n\nimport useQuery from './hooks/useQuery'\nimport Modal from './components/renderer/Modal'\nimport OnLoading from './components/renderer/OnLoading'\nimport {\n Receipt,\n ReceiptList,\n ReceiptListItem,\n ReceiptButton,\n} from './components/receipts'\nimport MaterialIcon from './components/MaterialIcon'\nimport QuillHTML from './components/QuillHTML'\nimport DownloadableFiles from './components/downloadable-files'\nimport replaceInjectablesWithSubmissionValues from './apps/services/replaceInjectablesWithSubmissionValues'\n\nconst { handlePaymentQuerystring, handlePaymentSubmissionEvent } =\n paymentService\n\nfunction PaymentReceipt({\n onDone,\n onCancel,\n}: {\n /**\n * The function to call when the user clicks 'Done'. See\n * [FormSubmissionResult](https://oneblink.github.io/apps/modules/submissionService.html#FormSubmissionResult)\n * for the structure of the argument.\n */\n onDone: (\n submissionResult: submissionService.FormSubmissionResult,\n ) => Promise<void>\n /**\n * The function to call when the user clicks 'Cancel'. See\n * [FormSubmissionResult](https://oneblink.github.io/apps/modules/submissionService.html#FormSubmissionResult)\n * for the structure of the argument.\n */\n onCancel: (\n submissionResult: submissionService.FormSubmissionResult,\n ) => Promise<void>\n}) {\n const isMounted = useIsMounted()\n const query = useQuery()\n const history = useHistory()\n\n const [\n {\n isLoading,\n loadError,\n transaction,\n submissionResult,\n receiptItems,\n schedulingBooking,\n },\n setLoadState,\n ] = React.useState<{\n isLoading: boolean\n loadError: Error | null\n transaction: paymentService.HandlePaymentResult['transaction'] | null\n submissionResult: submissionService.FormSubmissionResult | null\n receiptItems: paymentService.PaymentReceiptItem[] | null\n schedulingBooking: schedulingService.SchedulingBooking | null\n }>({\n isLoading: true,\n loadError: null,\n transaction: null,\n submissionResult: null,\n receiptItems: null,\n schedulingBooking: null,\n })\n const [\n { isRunningPostSubmissionAction, postSubmissionError },\n setPostSubmissionState,\n ] = React.useState<{\n isRunningPostSubmissionAction: boolean\n postSubmissionError: OneBlinkAppsError | null\n }>({\n isRunningPostSubmissionAction: false,\n postSubmissionError: null,\n })\n const clearPostSubmissionError = React.useCallback(() => {\n setPostSubmissionState((currentState) => ({\n ...currentState,\n postSubmissionError: null,\n }))\n }, [])\n const [{ isRetrying, retryError }, setRetryState] = React.useState<{\n isRetrying: boolean\n retryError: OneBlinkAppsError | null\n }>({\n isRetrying: false,\n retryError: null,\n })\n const clearRetryError = React.useCallback(() => {\n setRetryState((currentState) => ({\n ...currentState,\n retryError: null,\n }))\n }, [])\n\n React.useEffect(() => {\n let ignore = false\n\n const getTransaction = async () => {\n let newError = null\n let newTransaction = null\n let newSubmissionResult = null\n let newReceiptItems = null\n let newSchedulingBooking = null\n try {\n const result = await handlePaymentQuerystring(query)\n newTransaction = result.transaction\n newSubmissionResult = result.submissionResult\n newReceiptItems = result.receiptItems\n newSchedulingBooking = result.schedulingBooking ?? null\n } catch (error) {\n console.warn('Error while attempting to load transaction', error)\n newError = error as Error\n }\n\n if (!ignore) {\n setLoadState({\n isLoading: false,\n loadError: newError,\n transaction: newTransaction,\n submissionResult: newSubmissionResult,\n receiptItems: newReceiptItems,\n schedulingBooking: newSchedulingBooking,\n })\n }\n }\n getTransaction()\n\n return () => {\n ignore = true\n }\n }, [query])\n\n const executePostSubmissionAction = React.useCallback(\n async (\n action: (\n submissionRresult: submissionService.FormSubmissionResult,\n ) => Promise<void>,\n ) => {\n if (!submissionResult || !isMounted.current) {\n return\n }\n\n setPostSubmissionState({\n isRunningPostSubmissionAction: true,\n postSubmissionError: null,\n })\n\n let newError = null\n try {\n await action({ ...submissionResult, payment: null })\n } catch (error) {\n console.warn('Error while running post submission action', error)\n newError = error as OneBlinkAppsError\n }\n\n if (isMounted.current) {\n setPostSubmissionState({\n isRunningPostSubmissionAction: false,\n postSubmissionError: newError,\n })\n }\n },\n [isMounted, submissionResult],\n )\n\n const handleDone = React.useCallback(async () => {\n executePostSubmissionAction(onDone)\n }, [executePostSubmissionAction, onDone])\n\n const handleCancel = React.useCallback(() => {\n executePostSubmissionAction(onCancel)\n }, [executePostSubmissionAction, onCancel])\n\n const handleTryAgain = React.useCallback(async () => {\n if (!submissionResult || !submissionResult.payment) {\n return\n }\n\n if (isMounted.current) {\n setRetryState({\n isRetrying: true,\n retryError: null,\n })\n }\n\n let newError = null\n try {\n const payment = await handlePaymentSubmissionEvent({\n formSubmissionResult: submissionResult,\n paymentReceiptUrl: submissionResult.payment.paymentReceiptUrl,\n paymentFormUrl: submissionResult.payment.paymentFormUrl,\n })\n // The API has decided that no payment is required on try again\n if (!payment) {\n // Do the success path\n handleDone()\n } else {\n await submissionService.executePostSubmissionAction(\n { ...submissionResult, payment },\n {\n onRedirectToRelativeUrl: (url) => history.push(url),\n onRedirectToAbsoluteUrl: (url) => window.location.assign(url),\n },\n )\n }\n } catch (error) {\n console.warn('Error while attempting to retry transaction', error)\n newError = error as OneBlinkAppsError\n }\n\n if (isMounted.current) {\n setRetryState({\n isRetrying: false,\n retryError: newError,\n })\n }\n }, [history, isMounted, submissionResult, handleDone])\n\n const postSubmissionSuccessHtml = React.useMemo(() => {\n const html = submissionResult?.definition.postSubmissionReceipt?.html\n if (!transaction?.isSuccess || !submissionResult || !html) {\n return undefined\n }\n\n return replaceInjectablesWithSubmissionValues(html, submissionResult).text\n }, [submissionResult, transaction?.isSuccess])\n\n return (\n <div>\n {isLoading && (\n <section>\n <div className=\"cypress-loading has-text-centered\">\n <OnLoading className=\"has-text-centered\"></OnLoading>\n <span>Retrieving transaction details...</span>\n </div>\n </section>\n )}\n\n {transaction && (\n <Receipt\n className=\"ob-payment-receipt\"\n containerClassName=\"ob-payment-receipt__container\"\n >\n <ReceiptList\n successIconClassName=\"ob-payment-receipt__success-icon\"\n warningIconClassName=\"ob-payment-receipt__warning-icon\"\n warningMessageClassName=\"ob-payment-receipt__warning-message cypress-payment-receipt-warning-message\"\n warningMessage={\n transaction.isSuccess\n ? undefined\n : transaction.errorMessage || undefined\n }\n >\n {postSubmissionSuccessHtml && (\n <div className=\"ob-list__item ob-payment-receipt__success-message\">\n <div className=\"ob-list__content-wrapper\">\n <div className=\"ob-list__content\">\n <QuillHTML\n html={postSubmissionSuccessHtml}\n className=\"cypress-payment-receipt-success-message\"\n />\n </div>\n </div>\n </div>\n )}\n {receiptItems &&\n receiptItems.length &&\n receiptItems.map((receiptItem, i) => {\n return (\n <ReceiptListItem\n key={i}\n className={receiptItem.className ?? ''}\n valueClassName={receiptItem.valueClassName ?? ''}\n icon={receiptItem.icon}\n label={receiptItem.label}\n value={receiptItem.value}\n allowCopyToClipboard={receiptItem.allowCopyToClipboard}\n />\n )\n })}\n {schedulingBooking && transaction.isSuccess && (\n <>\n {schedulingBooking.location && (\n <ReceiptListItem\n className=\"ob-scheduling-receipt__location\"\n valueClassName=\"cypress-scheduling-receipt-location\"\n icon=\"location_on\"\n label=\"Location\"\n value={schedulingBooking.location}\n />\n )}\n\n <ReceiptListItem\n className=\"ob-scheduling-receipt__start-time\"\n valueClassName=\"cypress-scheduling-receipt-start-time\"\n icon=\"schedule\"\n label=\"Start Time\"\n value={localisationService.formatDatetimeLong(\n schedulingBooking.startTime,\n )}\n />\n\n <ReceiptListItem\n className=\"ob-scheduling-receipt__end-time\"\n valueClassName=\"cypress-scheduling-receipt-end-time\"\n icon=\"schedule\"\n label=\"End Time\"\n value={localisationService.formatDatetimeLong(\n schedulingBooking.endTime,\n )}\n />\n </>\n )}\n <ReceiptListItem\n className=\"ob-payment-receipt__warning\"\n valueClassName=\"cypress-payment-receipt-warning\"\n label=\"Warning\"\n value=\"Please do not click back in your browser, doing so will cause issues with your payment.\"\n />\n </ReceiptList>\n\n {submissionResult && transaction.isSuccess && (\n <DownloadableFiles\n formSubmissionResult={submissionResult}\n layout=\"LIST\"\n />\n )}\n\n <div className=\"buttons\">\n {transaction.isSuccess ? (\n <ReceiptButton\n className=\"is-primary ob-payment-receipt__button ob-payment-receipt__okay-button cypress-payment-receipt-okay-button\"\n label=\"Done\"\n isLoading={isRunningPostSubmissionAction}\n onClick={handleDone}\n />\n ) : (\n <>\n <ReceiptButton\n className=\"ob-payment-receipt__button ob-payment-receipt__cancel-button cypress-payment-receipt-cancel-button\"\n label=\"Cancel\"\n isDisabled={isRetrying}\n isLoading={isRunningPostSubmissionAction}\n onClick={handleCancel}\n />\n <ReceiptButton\n className=\"is-primary ob-payment-receipt__button ob-payment-receipt__try-again-button cypress-payment-receipt-try-again-button\"\n label=\"Try Again\"\n isDisabled={isRunningPostSubmissionAction}\n isLoading={isRetrying}\n onClick={handleTryAgain}\n />\n </>\n )}\n </div>\n </Receipt>\n )}\n\n {loadError && (\n <section className=\"cypress-payment-receipt-loading-error-message\">\n <div className=\"ob-payment-receipt__error-icon-container has-text-centered has-margin-bottom-8\">\n <MaterialIcon className=\"ob-payment-receipt__error-icon has-text-danger icon-x-large\">\n error\n </MaterialIcon>\n </div>\n <p className=\"ob-payment-receipt__error-message has-text-centered has-margin-bottom-4\">\n {loadError.message}\n </p>\n </section>\n )}\n\n {retryError && (\n <Modal\n isOpen\n title={retryError.title || 'Whoops...'}\n bodyClassName=\"cypress-payment-receipt-retry-error-message\"\n actions={\n <button\n type=\"button\"\n className=\"button ob-button is-primary cypress-payment-receipt-retry-error-okay-button\"\n onClick={clearRetryError}\n autoFocus\n >\n Okay\n </button>\n }\n >\n {retryError.message}\n </Modal>\n )}\n\n {postSubmissionError && (\n <Modal\n isOpen\n title={postSubmissionError.title || 'Whoops...'}\n bodyClassName=\"cypress-payment-receipt-retry-error-message\"\n actions={\n <button\n type=\"button\"\n className=\"button ob-button is-primary cypress-payment-receipt-retry-error-okay-button\"\n onClick={clearPostSubmissionError}\n autoFocus\n >\n Okay\n </button>\n }\n >\n {postSubmissionError.message}\n </Modal>\n )}\n </div>\n )\n}\n\n/**\n * Component for rendering a OneBlink Form Payment Receipt. This component will\n * payment receipt but it is up to the developer to implement what happens when\n * the user clicks 'Done'.\n *\n * It is also recommended to import the `css` from this library as well.\n *\n * ```js\n * import { PaymentReceipt } from '@oneblink/apps-react'\n * import '@oneblink/apps-react/dist/styles.css'\n * ```\n *\n * #### Example\n *\n * ```tsx\n * import React from 'react'\n * import ReactDOM from 'react-dom'\n * import { PaymentReceipt } from '@oneblink/apps-react'\n * import '@oneblink/apps-react/dist/styles.css'\n *\n * function ReceiptContainer() {\n * const handleDone = React.useCallback(async () => {\n * console.log('All done!')\n * }, [])\n * const handleCancel = React.useCallback(async () => {\n * console.log('Cancelled!')\n * }, [])\n *\n * return <PaymentReceipt onDone={handleDone} onCancel={handleCancel} />\n * }\n *\n * function App() {\n * return (\n * <IsOfflineContextProvider>\n * <ReceiptContainer />\n * </IsOfflineContextProvider>\n * )\n * }\n *\n * const root = document.getElementById('root')\n * if (root) {\n * ReactDOM.render(<App />, root)\n * }\n * ```\n *\n * @param props\n * @returns\n * @group Components\n */\nexport default React.memo(PaymentReceipt)\n"]}
1
+ {"version":3,"file":"PaymentReceipt.js","sourceRoot":"","sources":["../src/PaymentReceipt.tsx"],"names":[],"mappings":";AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAC9B,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAA;AAC7C,OAAO,EACL,cAAc,EACd,iBAAiB,EAGjB,mBAAmB,GACpB,MAAM,QAAQ,CAAA;AACf,OAAO,YAAY,MAAM,sBAAsB,CAAA;AAE/C,OAAO,QAAQ,MAAM,kBAAkB,CAAA;AACvC,OAAO,KAAK,MAAM,6BAA6B,CAAA;AAC/C,OAAO,SAAS,MAAM,iCAAiC,CAAA;AACvD,OAAO,EACL,OAAO,EACP,WAAW,EACX,eAAe,EACf,aAAa,GACd,MAAM,uBAAuB,CAAA;AAC9B,OAAO,YAAY,MAAM,2BAA2B,CAAA;AACpD,OAAO,SAAS,MAAM,wBAAwB,CAAA;AAC9C,OAAO,iBAAiB,MAAM,iCAAiC,CAAA;AAC/D,OAAO,sCAAsC,MAAM,wDAAwD,CAAA;AAE3G,MAAM,EAAE,wBAAwB,EAAE,4BAA4B,EAAE,GAC9D,cAAc,CAAA;AAEhB,SAAS,cAAc,CAAC,EACtB,MAAM,EACN,QAAQ,GAkBT;IACC,MAAM,SAAS,GAAG,YAAY,EAAE,CAAA;IAChC,MAAM,KAAK,GAAG,QAAQ,EAAE,CAAA;IACxB,MAAM,OAAO,GAAG,UAAU,EAAE,CAAA;IAE5B,MAAM,CACJ,EACE,SAAS,EACT,SAAS,EACT,WAAW,EACX,gBAAgB,EAChB,YAAY,EACZ,iBAAiB,GAClB,EACD,YAAY,EACb,GAAG,KAAK,CAAC,Q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 'react-router-dom'\nimport {\n paymentService,\n submissionService,\n OneBlinkAppsError,\n schedulingService,\n localisationService,\n} from './apps'\nimport useIsMounted from './hooks/useIsMounted'\n\nimport useQuery from './hooks/useQuery'\nimport Modal from './components/renderer/Modal'\nimport OnLoading from './components/renderer/OnLoading'\nimport {\n Receipt,\n ReceiptList,\n ReceiptListItem,\n ReceiptButton,\n} from './components/receipts'\nimport MaterialIcon from './components/MaterialIcon'\nimport QuillHTML from './components/QuillHTML'\nimport DownloadableFiles from './components/downloadable-files'\nimport replaceInjectablesWithSubmissionValues from './apps/services/replaceInjectablesWithSubmissionValues'\n\nconst { handlePaymentQuerystring, handlePaymentSubmissionEvent } =\n paymentService\n\nfunction PaymentReceipt({\n onDone,\n onCancel,\n}: {\n /**\n * The function to call when the user clicks 'Done'. See\n * [FormSubmissionResult](https://oneblink.github.io/apps/modules/submissionService.html#FormSubmissionResult)\n * for the structure of the argument.\n */\n onDone: (\n submissionResult: submissionService.FormSubmissionResult,\n ) => Promise<void>\n /**\n * The function to call when the user clicks 'Cancel'. See\n * [FormSubmissionResult](https://oneblink.github.io/apps/modules/submissionService.html#FormSubmissionResult)\n * for the structure of the argument.\n */\n onCancel: (\n submissionResult: submissionService.FormSubmissionResult,\n ) => Promise<void>\n}) {\n const isMounted = useIsMounted()\n const query = useQuery()\n const history = useHistory()\n\n const [\n {\n isLoading,\n loadError,\n transaction,\n submissionResult,\n receiptItems,\n schedulingBooking,\n },\n setLoadState,\n ] = React.useState<{\n isLoading: boolean\n loadError: Error | null\n transaction: paymentService.HandlePaymentResult['transaction'] | null\n submissionResult: submissionService.FormSubmissionResult | null\n receiptItems: paymentService.PaymentReceiptItem[] | null\n schedulingBooking: schedulingService.SchedulingBooking | null\n }>({\n isLoading: true,\n loadError: null,\n transaction: null,\n submissionResult: null,\n receiptItems: null,\n schedulingBooking: null,\n })\n const [\n { isRunningPostSubmissionAction, postSubmissionError },\n setPostSubmissionState,\n ] = React.useState<{\n isRunningPostSubmissionAction: boolean\n postSubmissionError: OneBlinkAppsError | null\n }>({\n isRunningPostSubmissionAction: false,\n postSubmissionError: null,\n })\n const clearPostSubmissionError = React.useCallback(() => {\n setPostSubmissionState((currentState) => ({\n ...currentState,\n postSubmissionError: null,\n }))\n }, [])\n const [{ isRetrying, retryError }, setRetryState] = React.useState<{\n isRetrying: boolean\n retryError: OneBlinkAppsError | null\n }>({\n isRetrying: false,\n retryError: null,\n })\n const clearRetryError = React.useCallback(() => {\n setRetryState((currentState) => ({\n ...currentState,\n retryError: null,\n }))\n }, [])\n\n React.useEffect(() => {\n let ignore = false\n\n const getTransaction = async () => {\n let newError = null\n let newTransaction = null\n let newSubmissionResult = null\n let newReceiptItems = null\n let newSchedulingBooking = null\n try {\n const result = await handlePaymentQuerystring(query)\n newTransaction = result.transaction\n newSubmissionResult = result.submissionResult\n newReceiptItems = result.receiptItems\n newSchedulingBooking = result.schedulingBooking ?? null\n } catch (error) {\n console.warn('Error while attempting to load transaction', error)\n newError = error as Error\n }\n\n if (!ignore) {\n setLoadState({\n isLoading: false,\n loadError: newError,\n transaction: newTransaction,\n submissionResult: newSubmissionResult,\n receiptItems: newReceiptItems,\n schedulingBooking: newSchedulingBooking,\n })\n }\n }\n getTransaction()\n\n return () => {\n ignore = true\n }\n }, [query])\n\n const executePostSubmissionAction = React.useCallback(\n async (\n action: (\n submissionRresult: submissionService.FormSubmissionResult,\n ) => Promise<void>,\n ) => {\n if (!submissionResult || !isMounted.current) {\n return\n }\n\n setPostSubmissionState({\n isRunningPostSubmissionAction: true,\n postSubmissionError: null,\n })\n\n let newError = null\n try {\n await action({ ...submissionResult, payment: null })\n } catch (error) {\n console.warn('Error while running post submission action', error)\n newError = error as OneBlinkAppsError\n }\n\n if (isMounted.current) {\n setPostSubmissionState({\n isRunningPostSubmissionAction: false,\n postSubmissionError: newError,\n })\n }\n },\n [isMounted, submissionResult],\n )\n\n const handleDone = React.useCallback(async () => {\n executePostSubmissionAction(onDone)\n }, [executePostSubmissionAction, onDone])\n\n const handleCancel = React.useCallback(() => {\n executePostSubmissionAction(onCancel)\n }, [executePostSubmissionAction, onCancel])\n\n const handleTryAgain = React.useCallback(async () => {\n if (!submissionResult || !submissionResult.payment) {\n return\n }\n\n if (isMounted.current) {\n setRetryState({\n isRetrying: true,\n retryError: null,\n })\n }\n\n let newError = null\n try {\n const payment = await handlePaymentSubmissionEvent({\n formSubmissionResult: submissionResult,\n paymentReceiptUrl: submissionResult.payment.paymentReceiptUrl,\n paymentFormUrl: submissionResult.payment.paymentFormUrl,\n })\n // The API has decided that no payment is required on try again\n if (!payment) {\n // Do the success path\n handleDone()\n } else {\n await submissionService.executePostSubmissionAction(\n { ...submissionResult, payment },\n {\n onRedirectToRelativeUrl: (url) => history.push(url),\n onRedirectToAbsoluteUrl: (url) => window.location.assign(url),\n },\n )\n }\n } catch (error) {\n console.warn('Error while attempting to retry transaction', error)\n newError = error as OneBlinkAppsError\n }\n\n if (isMounted.current) {\n setRetryState({\n isRetrying: false,\n retryError: newError,\n })\n }\n }, [history, isMounted, submissionResult, handleDone])\n\n const postSubmissionSuccessHtml = React.useMemo(() => {\n const html = submissionResult?.definition.postSubmissionReceipt?.html\n if (!transaction?.isSuccess || !submissionResult || !html) {\n return undefined\n }\n\n return replaceInjectablesWithSubmissionValues(html, submissionResult).text\n }, [submissionResult, transaction?.isSuccess])\n\n return (\n <div>\n {isLoading && (\n <section>\n <div className=\"cypress-loading has-text-centered\">\n <OnLoading className=\"has-text-centered\"></OnLoading>\n <span>Retrieving transaction details...</span>\n </div>\n </section>\n )}\n\n {transaction && (\n <Receipt\n className=\"ob-payment-receipt\"\n containerClassName=\"ob-payment-receipt__container\"\n >\n <ReceiptList\n successIconClassName=\"ob-payment-receipt__success-icon\"\n warningIconClassName=\"ob-payment-receipt__warning-icon\"\n warningMessageClassName=\"ob-payment-receipt__warning-message cypress-payment-receipt-warning-message\"\n warningMessage={\n transaction.isSuccess\n ? undefined\n : transaction.errorMessage || undefined\n }\n hideSuccessIcon={!!postSubmissionSuccessHtml}\n >\n {postSubmissionSuccessHtml && (\n <div className=\"ob-list__item ob-payment-receipt__success-message\">\n <div className=\"ob-list__content-wrapper\">\n <div className=\"ob-list__content\">\n <QuillHTML\n html={postSubmissionSuccessHtml}\n className=\"cypress-payment-receipt-success-message\"\n />\n </div>\n </div>\n </div>\n )}\n {receiptItems &&\n receiptItems.length &&\n receiptItems.map((receiptItem, i) => {\n return (\n <ReceiptListItem\n key={i}\n className={receiptItem.className ?? ''}\n valueClassName={receiptItem.valueClassName ?? ''}\n icon={receiptItem.icon}\n label={receiptItem.label}\n value={receiptItem.value}\n allowCopyToClipboard={receiptItem.allowCopyToClipboard}\n />\n )\n })}\n {schedulingBooking && transaction.isSuccess && (\n <>\n {schedulingBooking.location && (\n <ReceiptListItem\n className=\"ob-scheduling-receipt__location\"\n valueClassName=\"cypress-scheduling-receipt-location\"\n icon=\"location_on\"\n label=\"Location\"\n value={schedulingBooking.location}\n />\n )}\n\n <ReceiptListItem\n className=\"ob-scheduling-receipt__start-time\"\n valueClassName=\"cypress-scheduling-receipt-start-time\"\n icon=\"schedule\"\n label=\"Start Time\"\n value={localisationService.formatDatetimeLong(\n schedulingBooking.startTime,\n )}\n />\n\n <ReceiptListItem\n className=\"ob-scheduling-receipt__end-time\"\n valueClassName=\"cypress-scheduling-receipt-end-time\"\n icon=\"schedule\"\n label=\"End Time\"\n value={localisationService.formatDatetimeLong(\n schedulingBooking.endTime,\n )}\n />\n </>\n )}\n <ReceiptListItem\n className=\"ob-payment-receipt__warning\"\n valueClassName=\"cypress-payment-receipt-warning\"\n label=\"Warning\"\n value=\"Please do not click back in your browser, doing so will cause issues with your payment.\"\n />\n </ReceiptList>\n\n {submissionResult && transaction.isSuccess && (\n <DownloadableFiles\n formSubmissionResult={submissionResult}\n layout=\"LIST\"\n />\n )}\n\n <div className=\"buttons\">\n {transaction.isSuccess ? (\n <ReceiptButton\n className=\"is-primary ob-payment-receipt__button ob-payment-receipt__okay-button cypress-payment-receipt-okay-button\"\n label=\"Done\"\n isLoading={isRunningPostSubmissionAction}\n onClick={handleDone}\n />\n ) : (\n <>\n <ReceiptButton\n className=\"ob-payment-receipt__button ob-payment-receipt__cancel-button cypress-payment-receipt-cancel-button\"\n label=\"Cancel\"\n isDisabled={isRetrying}\n isLoading={isRunningPostSubmissionAction}\n onClick={handleCancel}\n />\n <ReceiptButton\n className=\"is-primary ob-payment-receipt__button ob-payment-receipt__try-again-button cypress-payment-receipt-try-again-button\"\n label=\"Try Again\"\n isDisabled={isRunningPostSubmissionAction}\n isLoading={isRetrying}\n onClick={handleTryAgain}\n />\n </>\n )}\n </div>\n </Receipt>\n )}\n\n {loadError && (\n <section className=\"cypress-payment-receipt-loading-error-message\">\n <div className=\"ob-payment-receipt__error-icon-container has-text-centered has-margin-bottom-8\">\n <MaterialIcon className=\"ob-payment-receipt__error-icon has-text-danger icon-x-large\">\n error\n </MaterialIcon>\n </div>\n <p className=\"ob-payment-receipt__error-message has-text-centered has-margin-bottom-4\">\n {loadError.message}\n </p>\n </section>\n )}\n\n {retryError && (\n <Modal\n isOpen\n title={retryError.title || 'Whoops...'}\n bodyClassName=\"cypress-payment-receipt-retry-error-message\"\n actions={\n <button\n type=\"button\"\n className=\"button ob-button is-primary cypress-payment-receipt-retry-error-okay-button\"\n onClick={clearRetryError}\n autoFocus\n >\n Okay\n </button>\n }\n >\n {retryError.message}\n </Modal>\n )}\n\n {postSubmissionError && (\n <Modal\n isOpen\n title={postSubmissionError.title || 'Whoops...'}\n bodyClassName=\"cypress-payment-receipt-retry-error-message\"\n actions={\n <button\n type=\"button\"\n className=\"button ob-button is-primary cypress-payment-receipt-retry-error-okay-button\"\n onClick={clearPostSubmissionError}\n autoFocus\n >\n Okay\n </button>\n }\n >\n {postSubmissionError.message}\n </Modal>\n )}\n </div>\n )\n}\n\n/**\n * Component for rendering a OneBlink Form Payment Receipt. This component will\n * payment receipt but it is up to the developer to implement what happens when\n * the user clicks 'Done'.\n *\n * It is also recommended to import the `css` from this library as well.\n *\n * ```js\n * import { PaymentReceipt } from '@oneblink/apps-react'\n * import '@oneblink/apps-react/dist/styles.css'\n * ```\n *\n * #### Example\n *\n * ```tsx\n * import React from 'react'\n * import ReactDOM from 'react-dom'\n * import { PaymentReceipt } from '@oneblink/apps-react'\n * import '@oneblink/apps-react/dist/styles.css'\n *\n * function ReceiptContainer() {\n * const handleDone = React.useCallback(async () => {\n * console.log('All done!')\n * }, [])\n * const handleCancel = React.useCallback(async () => {\n * console.log('Cancelled!')\n * }, [])\n *\n * return <PaymentReceipt onDone={handleDone} onCancel={handleCancel} />\n * }\n *\n * function App() {\n * return (\n * <IsOfflineContextProvider>\n * <ReceiptContainer />\n * </IsOfflineContextProvider>\n * )\n * }\n *\n * const root = document.getElementById('root')\n * if (root) {\n * ReactDOM.render(<App />, root)\n * }\n * ```\n *\n * @param props\n * @returns\n * @group Components\n */\nexport default React.memo(PaymentReceipt)\n"]}
@@ -0,0 +1,3 @@
1
+ export default function GoogleMapsLogo({ className }: {
2
+ className?: string;
3
+ }): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,8 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ // Official Google Maps attribution logo. Google requires it to be unmodified,
3
+ // 16-19px tall and labelled "Google Maps" for accessibility.
4
+ // https://developers.google.com/maps/documentation/places/web-service/policies#logo
5
+ export default function GoogleMapsLogo({ className }) {
6
+ return (_jsx("svg", { xmlns: "http://www.w3.org/2000/svg", role: "img", "aria-label": "Google Maps", width: "88", height: "16", viewBox: "0 0 98 18", className: className, children: _jsxs("g", { fill: "#5E5E5E", children: [_jsx("path", { d: "M7.08,13.96c-1.93,0-3.59-0.68-4.99-2.05C0.7,10.54,0,8.9,0,6.98c0-1.92,0.7-3.56,2.09-4.93C3.49,0.68,5.15,0,7.08,0c1.85,0,3.45,0.64,4.79,1.92l-1.35,1.35C9.56,2.36,8.41,1.91,7.08,1.91c-1.4,0-2.58,0.49-3.55,1.48C2.56,4.38,2.08,5.57,2.08,6.98c0,1.41,0.49,2.61,1.46,3.59c0.97,0.99,2.15,1.48,3.55,1.48c1.42,0,2.59-0.47,3.53-1.4c0.56-0.56,0.9-1.36,1.04-2.4H7.08V6.35h6.42c0.07,0.34,0.1,0.74,0.1,1.19c0,1.87-0.55,3.36-1.65,4.46C10.71,13.31,9.08,13.96,7.08,13.96zM22,12.68c-0.87,0.86-1.94,1.29-3.2,1.29c-1.26,0-2.33-0.43-3.2-1.29c-0.87-0.86-1.31-1.93-1.31-3.21c0-1.28,0.44-2.35,1.31-3.21c0.87-0.86,1.94-1.29,3.2-1.29c1.26,0,2.33,0.43,3.2,1.29c0.87,0.86,1.31,1.93,1.31,3.21C23.31,10.75,22.88,11.82,22,12.68zM17.01,11.42c0.5,0.52,1.1,0.77,1.79,0.77c0.69,0,1.29-0.26,1.79-0.77c0.5-0.52,0.75-1.17,0.75-1.95c0-0.79-0.25-1.45-0.74-1.96C20.1,7,19.5,6.74,18.8,6.74c-0.7,0-1.3,0.26-1.8,0.77c-0.49,0.51-0.74,1.16-0.74,1.96C16.26,10.25,16.51,10.9,17.01,11.42zM31.85,12.68c-0.87,0.86-1.94,1.29-3.2,1.29s-2.33-0.43-3.2-1.29c-0.87-0.86-1.31-1.93-1.31-3.21c0-1.28,0.44-2.35,1.31-3.21c0.87-0.86,1.94-1.29,3.2-1.29s2.33,0.43,3.2,1.29c0.87,0.86,1.31,1.93,1.31,3.21C33.16,10.75,32.72,11.82,31.85,12.68zM26.86,11.42c0.5,0.52,1.1,0.77,1.79,0.77c0.69,0,1.29-0.26,1.79-0.77c0.5-0.52,0.75-1.17,0.75-1.95c0-0.79-0.25-1.45-0.74-1.96s-1.09-0.77-1.8-0.77c-0.7,0-1.3,0.26-1.8,0.77c-0.49,0.51-0.74,1.16-0.74,1.96C26.11,10.25,26.36,10.9,26.86,11.42zM38.32,18c-1,0-1.84-0.27-2.52-0.8c-0.68-0.53-1.17-1.15-1.46-1.86l1.72-0.72c0.18,0.43,0.47,0.81,0.85,1.12c0.39,0.32,0.86,0.48,1.41,0.48c0.75,0,1.34-0.23,1.76-0.68c0.43-0.45,0.64-1.11,0.64-1.96v-0.65h-0.07c-0.56,0.68-1.35,1.02-2.37,1.02c-1.15,0-2.15-0.44-3.01-1.31c-0.86-0.87-1.29-1.93-1.29-3.17c0-1.25,0.43-2.31,1.29-3.19c0.86-0.88,1.87-1.32,3.01-1.32c0.51,0,0.97,0.1,1.39,0.29c0.41,0.19,0.74,0.43,0.98,0.72h0.07V5.25h1.87v8.07c0,1.57-0.4,2.74-1.2,3.52C40.59,17.61,39.57,18,38.32,18zM38.45,12.19c0.68,0,1.25-0.26,1.71-0.77c0.46-0.52,0.69-1.16,0.69-1.93c0-0.78-0.23-1.44-0.69-1.96C39.7,7,39.13,6.74,38.45,6.74c-0.69,0-1.28,0.26-1.77,0.78c-0.49,0.52-0.73,1.18-0.73,1.96c0,0.77,0.24,1.42,0.73,1.93C37.17,11.93,37.76,12.19,38.45,12.19zM45.93,0.48v13.21h-1.98V0.48H45.93zM51.34,13.96c-1.27,0-2.33-0.43-3.18-1.29c-0.85-0.86-1.28-1.93-1.28-3.2c0-1.32,0.41-2.4,1.23-3.24c0.82-0.84,1.82-1.26,3.01-1.26c0.55,0,1.05,0.1,1.52,0.3c0.47,0.2,0.85,0.45,1.16,0.77c0.31,0.31,0.55,0.62,0.73,0.91c0.18,0.3,0.33,0.59,0.44,0.89l0.2,0.51l-6.01,2.49c0.47,0.91,1.19,1.36,2.18,1.36c0.91,0,1.65-0.41,2.21-1.24l1.53,1.02c-0.34,0.51-0.82,0.97-1.45,1.38C53.02,13.76,52.25,13.96,51.34,13.96zM48.84,9.33l4.02-1.67c-0.11-0.28-0.32-0.51-0.63-0.69c-0.31-0.18-0.65-0.26-1.04-0.26c-0.58,0-1.12,0.24-1.63,0.72C49.06,7.9,48.82,8.54,48.84,9.33z" }), _jsx("path", { d: "M60.05,13.69V1.5h1.57l4.24,7.42h0.07l4.24-7.42h1.57v12.19h-1.57V6.45l0.07-2.04h-0.07l-3.81,6.69h-0.92l-3.81-6.69h-0.07l0.07,2.04v7.24H60.05zM76.36,13.96c-0.89,0-1.63-0.26-2.22-0.77c-0.6-0.51-0.89-1.19-0.89-2.03c0-0.91,0.35-1.62,1.06-2.14c0.7-0.52,1.57-0.77,2.61-0.77c0.92,0,1.67,0.17,2.26,0.51V8.53c0-0.61-0.21-1.1-0.63-1.47c-0.42-0.37-0.94-0.55-1.55-0.55c-0.45,0-0.87,0.11-1.23,0.32C75.39,7.04,75.13,7.34,75,7.71L73.57,7.1c0.19-0.5,0.57-0.96,1.14-1.39c0.57-0.43,1.32-0.64,2.25-0.64c1.07,0,1.95,0.31,2.66,0.94c0.7,0.62,1.06,1.5,1.06,2.64v5.04h-1.5v-1.16H79.1C78.48,13.49,77.56,13.96,76.36,13.96zM76.61,12.53c0.65,0,1.23-0.24,1.76-0.72c0.53-0.48,0.79-1.05,0.79-1.71c-0.44-0.36-1.11-0.54-1.99-0.54c-0.76,0-1.33,0.16-1.72,0.49c-0.39,0.33-0.58,0.72-0.58,1.16c0,0.41,0.18,0.73,0.53,0.97C75.76,12.41,76.16,12.53,76.61,12.53zM86.58,13.96c-0.64,0-1.21-0.14-1.71-0.41c-0.51-0.27-0.88-0.61-1.13-1.02h-0.07l0.07,1.16v3.68h-1.57V5.35h1.5v1.16h0.07c0.25-0.41,0.63-0.75,1.13-1.02c0.51-0.27,1.08-0.41,1.71-0.41c1.08,0,2.01,0.43,2.79,1.28c0.78,0.85,1.18,1.91,1.18,3.17c0,1.26-0.39,2.32-1.18,3.17C88.59,13.54,87.66,13.96,86.58,13.96zM86.32,12.53c0.73,0,1.35-0.28,1.87-0.83c0.52-0.55,0.78-1.28,0.78-2.19c0-0.91-0.26-1.64-0.78-2.19c-0.52-0.55-1.15-0.83-1.87-0.83c-0.74,0-1.37,0.27-1.88,0.82c-0.52,0.54-0.77,1.28-0.77,2.2s0.26,1.65,0.77,2.2C84.96,12.26,85.58,12.53,86.32,12.53zM94.71,13.96c-0.93,0-1.7-0.23-2.31-0.68c-0.61-0.45-1.05-1.02-1.34-1.7l1.4-0.58c0.44,1.04,1.2,1.57,2.26,1.57c0.49,0,0.89-0.11,1.2-0.32c0.31-0.22,0.47-0.5,0.47-0.85c0-0.54-0.38-0.91-1.14-1.11l-1.69-0.41c-0.53-0.14-1.04-0.39-1.52-0.77c-0.48-0.38-0.72-0.89-0.72-1.54c0-0.74,0.33-1.34,0.98-1.8c0.65-0.46,1.43-0.69,2.32-0.69c0.74,0,1.4,0.17,1.98,0.5c0.58,0.34,0.99,0.81,1.24,1.44L96.5,7.58c-0.31-0.74-0.94-1.11-1.91-1.11c-0.47,0-0.86,0.1-1.18,0.29c-0.32,0.19-0.48,0.45-0.48,0.78c0,0.48,0.37,0.8,1.11,0.97l1.65,0.39c0.78,0.18,1.36,0.49,1.74,0.94c0.37,0.44,0.56,0.94,0.56,1.5c0,0.75-0.31,1.37-0.92,1.87C96.47,13.71,95.68,13.96,94.71,13.96z" })] }) }));
7
+ }
8
+ //# sourceMappingURL=GoogleMapsLogo.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"GoogleMapsLogo.js","sourceRoot":"","sources":["../../src/components/GoogleMapsLogo.tsx"],"names":[],"mappings":";AAAA,8EAA8E;AAC9E,6DAA6D;AAC7D,oFAAoF;AACpF,MAAM,CAAC,OAAO,UAAU,cAAc,CAAC,EAAE,SAAS,EAA0B;IAC1E,OAAO,CACL,cACE,KAAK,EAAC,4BAA4B,EAClC,IAAI,EAAC,KAAK,gBACC,aAAa,EACxB,KAAK,EAAC,IAAI,EACV,MAAM,EAAC,IAAI,EACX,OAAO,EAAC,WAAW,EACnB,SAAS,EAAE,SAAS,YAEpB,aAAG,IAAI,EAAC,SAAS,aACf,eAAM,CAAC,EAAC,ypFAAypF,GAAG,EACpqF,eAAM,CAAC,EAAC,s8DAAs8D,GAAG,IAC/8D,GACA,CACP,CAAA;AACH,CAAC","sourcesContent":["// Official Google Maps attribution logo. Google requires it to be unmodified,\n// 16-19px tall and labelled \"Google Maps\" for accessibility.\n// https://developers.google.com/maps/documentation/places/web-service/policies#logo\nexport default function GoogleMapsLogo({ className }: { className?: string }) {\n return (\n <svg\n xmlns=\"http://www.w3.org/2000/svg\"\n role=\"img\"\n aria-label=\"Google Maps\"\n width=\"88\"\n height=\"16\"\n viewBox=\"0 0 98 18\"\n className={className}\n >\n <g fill=\"#5E5E5E\">\n <path d=\"M7.08,13.96c-1.93,0-3.59-0.68-4.99-2.05C0.7,10.54,0,8.9,0,6.98c0-1.92,0.7-3.56,2.09-4.93C3.49,0.68,5.15,0,7.08,0c1.85,0,3.45,0.64,4.79,1.92l-1.35,1.35C9.56,2.36,8.41,1.91,7.08,1.91c-1.4,0-2.58,0.49-3.55,1.48C2.56,4.38,2.08,5.57,2.08,6.98c0,1.41,0.49,2.61,1.46,3.59c0.97,0.99,2.15,1.48,3.55,1.48c1.42,0,2.59-0.47,3.53-1.4c0.56-0.56,0.9-1.36,1.04-2.4H7.08V6.35h6.42c0.07,0.34,0.1,0.74,0.1,1.19c0,1.87-0.55,3.36-1.65,4.46C10.71,13.31,9.08,13.96,7.08,13.96zM22,12.68c-0.87,0.86-1.94,1.29-3.2,1.29c-1.26,0-2.33-0.43-3.2-1.29c-0.87-0.86-1.31-1.93-1.31-3.21c0-1.28,0.44-2.35,1.31-3.21c0.87-0.86,1.94-1.29,3.2-1.29c1.26,0,2.33,0.43,3.2,1.29c0.87,0.86,1.31,1.93,1.31,3.21C23.31,10.75,22.88,11.82,22,12.68zM17.01,11.42c0.5,0.52,1.1,0.77,1.79,0.77c0.69,0,1.29-0.26,1.79-0.77c0.5-0.52,0.75-1.17,0.75-1.95c0-0.79-0.25-1.45-0.74-1.96C20.1,7,19.5,6.74,18.8,6.74c-0.7,0-1.3,0.26-1.8,0.77c-0.49,0.51-0.74,1.16-0.74,1.96C16.26,10.25,16.51,10.9,17.01,11.42zM31.85,12.68c-0.87,0.86-1.94,1.29-3.2,1.29s-2.33-0.43-3.2-1.29c-0.87-0.86-1.31-1.93-1.31-3.21c0-1.28,0.44-2.35,1.31-3.21c0.87-0.86,1.94-1.29,3.2-1.29s2.33,0.43,3.2,1.29c0.87,0.86,1.31,1.93,1.31,3.21C33.16,10.75,32.72,11.82,31.85,12.68zM26.86,11.42c0.5,0.52,1.1,0.77,1.79,0.77c0.69,0,1.29-0.26,1.79-0.77c0.5-0.52,0.75-1.17,0.75-1.95c0-0.79-0.25-1.45-0.74-1.96s-1.09-0.77-1.8-0.77c-0.7,0-1.3,0.26-1.8,0.77c-0.49,0.51-0.74,1.16-0.74,1.96C26.11,10.25,26.36,10.9,26.86,11.42zM38.32,18c-1,0-1.84-0.27-2.52-0.8c-0.68-0.53-1.17-1.15-1.46-1.86l1.72-0.72c0.18,0.43,0.47,0.81,0.85,1.12c0.39,0.32,0.86,0.48,1.41,0.48c0.75,0,1.34-0.23,1.76-0.68c0.43-0.45,0.64-1.11,0.64-1.96v-0.65h-0.07c-0.56,0.68-1.35,1.02-2.37,1.02c-1.15,0-2.15-0.44-3.01-1.31c-0.86-0.87-1.29-1.93-1.29-3.17c0-1.25,0.43-2.31,1.29-3.19c0.86-0.88,1.87-1.32,3.01-1.32c0.51,0,0.97,0.1,1.39,0.29c0.41,0.19,0.74,0.43,0.98,0.72h0.07V5.25h1.87v8.07c0,1.57-0.4,2.74-1.2,3.52C40.59,17.61,39.57,18,38.32,18zM38.45,12.19c0.68,0,1.25-0.26,1.71-0.77c0.46-0.52,0.69-1.16,0.69-1.93c0-0.78-0.23-1.44-0.69-1.96C39.7,7,39.13,6.74,38.45,6.74c-0.69,0-1.28,0.26-1.77,0.78c-0.49,0.52-0.73,1.18-0.73,1.96c0,0.77,0.24,1.42,0.73,1.93C37.17,11.93,37.76,12.19,38.45,12.19zM45.93,0.48v13.21h-1.98V0.48H45.93zM51.34,13.96c-1.27,0-2.33-0.43-3.18-1.29c-0.85-0.86-1.28-1.93-1.28-3.2c0-1.32,0.41-2.4,1.23-3.24c0.82-0.84,1.82-1.26,3.01-1.26c0.55,0,1.05,0.1,1.52,0.3c0.47,0.2,0.85,0.45,1.16,0.77c0.31,0.31,0.55,0.62,0.73,0.91c0.18,0.3,0.33,0.59,0.44,0.89l0.2,0.51l-6.01,2.49c0.47,0.91,1.19,1.36,2.18,1.36c0.91,0,1.65-0.41,2.21-1.24l1.53,1.02c-0.34,0.51-0.82,0.97-1.45,1.38C53.02,13.76,52.25,13.96,51.34,13.96zM48.84,9.33l4.02-1.67c-0.11-0.28-0.32-0.51-0.63-0.69c-0.31-0.18-0.65-0.26-1.04-0.26c-0.58,0-1.12,0.24-1.63,0.72C49.06,7.9,48.82,8.54,48.84,9.33z\" />\n <path d=\"M60.05,13.69V1.5h1.57l4.24,7.42h0.07l4.24-7.42h1.57v12.19h-1.57V6.45l0.07-2.04h-0.07l-3.81,6.69h-0.92l-3.81-6.69h-0.07l0.07,2.04v7.24H60.05zM76.36,13.96c-0.89,0-1.63-0.26-2.22-0.77c-0.6-0.51-0.89-1.19-0.89-2.03c0-0.91,0.35-1.62,1.06-2.14c0.7-0.52,1.57-0.77,2.61-0.77c0.92,0,1.67,0.17,2.26,0.51V8.53c0-0.61-0.21-1.1-0.63-1.47c-0.42-0.37-0.94-0.55-1.55-0.55c-0.45,0-0.87,0.11-1.23,0.32C75.39,7.04,75.13,7.34,75,7.71L73.57,7.1c0.19-0.5,0.57-0.96,1.14-1.39c0.57-0.43,1.32-0.64,2.25-0.64c1.07,0,1.95,0.31,2.66,0.94c0.7,0.62,1.06,1.5,1.06,2.64v5.04h-1.5v-1.16H79.1C78.48,13.49,77.56,13.96,76.36,13.96zM76.61,12.53c0.65,0,1.23-0.24,1.76-0.72c0.53-0.48,0.79-1.05,0.79-1.71c-0.44-0.36-1.11-0.54-1.99-0.54c-0.76,0-1.33,0.16-1.72,0.49c-0.39,0.33-0.58,0.72-0.58,1.16c0,0.41,0.18,0.73,0.53,0.97C75.76,12.41,76.16,12.53,76.61,12.53zM86.58,13.96c-0.64,0-1.21-0.14-1.71-0.41c-0.51-0.27-0.88-0.61-1.13-1.02h-0.07l0.07,1.16v3.68h-1.57V5.35h1.5v1.16h0.07c0.25-0.41,0.63-0.75,1.13-1.02c0.51-0.27,1.08-0.41,1.71-0.41c1.08,0,2.01,0.43,2.79,1.28c0.78,0.85,1.18,1.91,1.18,3.17c0,1.26-0.39,2.32-1.18,3.17C88.59,13.54,87.66,13.96,86.58,13.96zM86.32,12.53c0.73,0,1.35-0.28,1.87-0.83c0.52-0.55,0.78-1.28,0.78-2.19c0-0.91-0.26-1.64-0.78-2.19c-0.52-0.55-1.15-0.83-1.87-0.83c-0.74,0-1.37,0.27-1.88,0.82c-0.52,0.54-0.77,1.28-0.77,2.2s0.26,1.65,0.77,2.2C84.96,12.26,85.58,12.53,86.32,12.53zM94.71,13.96c-0.93,0-1.7-0.23-2.31-0.68c-0.61-0.45-1.05-1.02-1.34-1.7l1.4-0.58c0.44,1.04,1.2,1.57,2.26,1.57c0.49,0,0.89-0.11,1.2-0.32c0.31-0.22,0.47-0.5,0.47-0.85c0-0.54-0.38-0.91-1.14-1.11l-1.69-0.41c-0.53-0.14-1.04-0.39-1.52-0.77c-0.48-0.38-0.72-0.89-0.72-1.54c0-0.74,0.33-1.34,0.98-1.8c0.65-0.46,1.43-0.69,2.32-0.69c0.74,0,1.4,0.17,1.98,0.5c0.58,0.34,0.99,0.81,1.24,1.44L96.5,7.58c-0.31-0.74-0.94-1.11-1.91-1.11c-0.47,0-0.86,0.1-1.18,0.29c-0.32,0.19-0.48,0.45-0.48,0.78c0,0.48,0.37,0.8,1.11,0.97l1.65,0.39c0.78,0.18,1.36,0.49,1.74,0.94c0.37,0.44,0.56,0.94,0.56,1.5c0,0.75-0.31,1.37-0.92,1.87C96.47,13.71,95.68,13.96,94.71,13.96z\" />\n </g>\n </svg>\n )\n}\n"]}
@@ -4,8 +4,9 @@ type Props = {
4
4
  warningIconClassName?: string;
5
5
  warningMessageClassName?: string;
6
6
  warningMessage?: string;
7
+ hideSuccessIcon?: boolean;
7
8
  children: React.ReactNode;
8
9
  };
9
- declare function ReceiptList({ successIconClassName, warningIconClassName, warningMessageClassName, warningMessage, children, }: Props): import("react/jsx-runtime").JSX.Element;
10
+ declare function ReceiptList({ successIconClassName, warningIconClassName, warningMessageClassName, warningMessage, hideSuccessIcon, children, }: Props): import("react/jsx-runtime").JSX.Element;
10
11
  declare const _default: React.MemoExoticComponent<typeof ReceiptList>;
11
12
  export default _default;
@@ -2,8 +2,8 @@ import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-run
2
2
  import * as React from 'react';
3
3
  import clsx from 'clsx';
4
4
  import MaterialIcon from '../MaterialIcon';
5
- function ReceiptList({ successIconClassName, warningIconClassName, warningMessageClassName, warningMessage, children, }) {
6
- return (_jsxs("div", { className: "ob-list has-dividers has-shadow has-margin-bottom-4", children: [_jsx("div", { className: "ob-list__item", children: _jsx("div", { className: "ob-list__content-wrapper", children: _jsx("div", { className: "ob-list__content", children: !warningMessage ? (_jsx("p", { className: "has-text-centered", children: _jsx(MaterialIcon, { className: clsx('has-text-success icon-x-large', successIconClassName), children: "check_circle_outline" }) })) : (_jsxs(_Fragment, { children: [_jsx("p", { className: "has-text-centered", children: _jsx(MaterialIcon, { className: clsx('has-text-danger icon-x-large', warningIconClassName), children: "warning" }) }), _jsx("p", { className: clsx('has-text-centered', warningMessageClassName), children: warningMessage })] })) }) }) }), children] }));
5
+ function ReceiptList({ successIconClassName, warningIconClassName, warningMessageClassName, warningMessage, hideSuccessIcon, children, }) {
6
+ return (_jsxs("div", { className: "ob-list has-dividers has-shadow has-margin-bottom-4", children: [(!!warningMessage || !hideSuccessIcon) && (_jsx("div", { className: "ob-list__item", children: _jsx("div", { className: "ob-list__content-wrapper", children: _jsx("div", { className: "ob-list__content", children: !warningMessage ? (_jsx("p", { className: "has-text-centered", children: _jsx(MaterialIcon, { className: clsx('has-text-success icon-x-large', successIconClassName), children: "check_circle_outline" }) })) : (_jsxs(_Fragment, { children: [_jsx("p", { className: "has-text-centered", children: _jsx(MaterialIcon, { className: clsx('has-text-danger icon-x-large', warningIconClassName), children: "warning" }) }), _jsx("p", { className: clsx('has-text-centered', warningMessageClassName), children: warningMessage })] })) }) }) })), children] }));
7
7
  }
8
8
  export default React.memo(ReceiptList);
9
9
  //# sourceMappingURL=ReceiptList.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"ReceiptList.js","sourceRoot":"","sources":["../../../src/components/receipts/ReceiptList.tsx"],"names":[],"mappings":";AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAC9B,OAAO,IAAI,MAAM,MAAM,CAAA;AACvB,OAAO,YAAY,MAAM,iBAAiB,CAAA;AAU1C,SAAS,WAAW,CAAC,EACnB,oBAAoB,EACpB,oBAAoB,EACpB,uBAAuB,EACvB,cAAc,EACd,QAAQ,GACF;IACN,OAAO,CACL,eAAK,SAAS,EAAC,qDAAqD,aAClE,cAAK,SAAS,EAAC,eAAe,YAC5B,cAAK,SAAS,EAAC,0BAA0B,YACvC,cAAK,SAAS,EAAC,kBAAkB,YAC9B,CAAC,cAAc,CAAC,CAAC,CAAC,CACjB,YAAG,SAAS,EAAC,mBAAmB,YAC9B,KAAC,YAAY,IACX,SAAS,EAAE,IAAI,CACb,+BAA+B,EAC/B,oBAAoB,CACrB,qCAGY,GACb,CACL,CAAC,CAAC,CAAC,CACF,8BACE,YAAG,SAAS,EAAC,mBAAmB,YAC9B,KAAC,YAAY,IACX,SAAS,EAAE,IAAI,CACb,8BAA8B,EAC9B,oBAAoB,CACrB,wBAGY,GACb,EACJ,YACE,SAAS,EAAE,IAAI,CAAC,mBAAmB,EAAE,uBAAuB,CAAC,YAE5D,cAAc,GACb,IACH,CACJ,GACG,GACF,GACF,EACL,QAAQ,IACL,CACP,CAAA;AACH,CAAC;AAED,eAAe,KAAK,CAAC,IAAI,CAAC,WAAW,CAAC,CAAA","sourcesContent":["import * as React from 'react'\nimport clsx from 'clsx'\nimport MaterialIcon from '../MaterialIcon'\n\ntype Props = {\n successIconClassName: string\n warningIconClassName?: string\n warningMessageClassName?: string\n warningMessage?: string\n children: React.ReactNode\n}\n\nfunction ReceiptList({\n successIconClassName,\n warningIconClassName,\n warningMessageClassName,\n warningMessage,\n children,\n}: Props) {\n return (\n <div className=\"ob-list has-dividers has-shadow has-margin-bottom-4\">\n <div className=\"ob-list__item\">\n <div className=\"ob-list__content-wrapper\">\n <div className=\"ob-list__content\">\n {!warningMessage ? (\n <p className=\"has-text-centered\">\n <MaterialIcon\n className={clsx(\n 'has-text-success icon-x-large',\n successIconClassName,\n )}\n >\n check_circle_outline\n </MaterialIcon>\n </p>\n ) : (\n <>\n <p className=\"has-text-centered\">\n <MaterialIcon\n className={clsx(\n 'has-text-danger icon-x-large',\n warningIconClassName,\n )}\n >\n warning\n </MaterialIcon>\n </p>\n <p\n className={clsx('has-text-centered', warningMessageClassName)}\n >\n {warningMessage}\n </p>\n </>\n )}\n </div>\n </div>\n </div>\n {children}\n </div>\n )\n}\n\nexport default React.memo(ReceiptList)\n"]}
1
+ {"version":3,"file":"ReceiptList.js","sourceRoot":"","sources":["../../../src/components/receipts/ReceiptList.tsx"],"names":[],"mappings":";AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAC9B,OAAO,IAAI,MAAM,MAAM,CAAA;AACvB,OAAO,YAAY,MAAM,iBAAiB,CAAA;AAW1C,SAAS,WAAW,CAAC,EACnB,oBAAoB,EACpB,oBAAoB,EACpB,uBAAuB,EACvB,cAAc,EACd,eAAe,EACf,QAAQ,GACF;IACN,OAAO,CACL,eAAK,SAAS,EAAC,qDAAqD,aACjE,CAAC,CAAC,CAAC,cAAc,IAAI,CAAC,eAAe,CAAC,IAAI,CACzC,cAAK,SAAS,EAAC,eAAe,YAC5B,cAAK,SAAS,EAAC,0BAA0B,YACvC,cAAK,SAAS,EAAC,kBAAkB,YAC9B,CAAC,cAAc,CAAC,CAAC,CAAC,CACjB,YAAG,SAAS,EAAC,mBAAmB,YAC9B,KAAC,YAAY,IACX,SAAS,EAAE,IAAI,CACb,+BAA+B,EAC/B,oBAAoB,CACrB,qCAGY,GACb,CACL,CAAC,CAAC,CAAC,CACF,8BACE,YAAG,SAAS,EAAC,mBAAmB,YAC9B,KAAC,YAAY,IACX,SAAS,EAAE,IAAI,CACb,8BAA8B,EAC9B,oBAAoB,CACrB,wBAGY,GACb,EACJ,YACE,SAAS,EAAE,IAAI,CACb,mBAAmB,EACnB,uBAAuB,CACxB,YAEA,cAAc,GACb,IACH,CACJ,GACG,GACF,GACF,CACP,EACA,QAAQ,IACL,CACP,CAAA;AACH,CAAC;AAED,eAAe,KAAK,CAAC,IAAI,CAAC,WAAW,CAAC,CAAA","sourcesContent":["import * as React from 'react'\nimport clsx from 'clsx'\nimport MaterialIcon from '../MaterialIcon'\n\ntype Props = {\n successIconClassName: string\n warningIconClassName?: string\n warningMessageClassName?: string\n warningMessage?: string\n hideSuccessIcon?: boolean\n children: React.ReactNode\n}\n\nfunction ReceiptList({\n successIconClassName,\n warningIconClassName,\n warningMessageClassName,\n warningMessage,\n hideSuccessIcon,\n children,\n}: Props) {\n return (\n <div className=\"ob-list has-dividers has-shadow has-margin-bottom-4\">\n {(!!warningMessage || !hideSuccessIcon) && (\n <div className=\"ob-list__item\">\n <div className=\"ob-list__content-wrapper\">\n <div className=\"ob-list__content\">\n {!warningMessage ? (\n <p className=\"has-text-centered\">\n <MaterialIcon\n className={clsx(\n 'has-text-success icon-x-large',\n successIconClassName,\n )}\n >\n check_circle_outline\n </MaterialIcon>\n </p>\n ) : (\n <>\n <p className=\"has-text-centered\">\n <MaterialIcon\n className={clsx(\n 'has-text-danger icon-x-large',\n warningIconClassName,\n )}\n >\n warning\n </MaterialIcon>\n </p>\n <p\n className={clsx(\n 'has-text-centered',\n warningMessageClassName,\n )}\n >\n {warningMessage}\n </p>\n </>\n )}\n </div>\n </div>\n </div>\n )}\n {children}\n </div>\n )\n}\n\nexport default React.memo(ReceiptList)\n"]}
@@ -7,6 +7,7 @@ import useGoogle from '../hooks/useGoogle';
7
7
  import useIsMounted from '../hooks/useIsMounted';
8
8
  import useElementAriaDescribedby from '../hooks/useElementAriaDescribedby';
9
9
  import FormElementValidationMessage from '../components/renderer/FormElementValidationMessage';
10
+ import GoogleMapsLogo from '../components/GoogleMapsLogo';
10
11
  function FormElementGoogleAddress({ id, element, readOnly, value, displayValidationMessage, validationMessage, onChange, isDirty, setIsDirty, autocompleteAttributes, }) {
11
12
  const ariaDescribedby = useElementAriaDescribedby(id, element);
12
13
  const isMounted = useIsMounted();
@@ -135,7 +136,7 @@ function FormElementGoogleAddress({ id, element, readOnly, value, displayValidat
135
136
  setLabel(newLabel !== null && newLabel !== void 0 ? newLabel : '');
136
137
  }
137
138
  }, [value]);
138
- return (_jsxs("div", { className: "cypress-google-address-element", children: [_jsx(FormElementLabelContainer, { className: "ob-google-address ob-autocomplete", element: element, id: id, required: element.required, children: _jsx(AutocompleteDropdown, { id: id, label: label, disabled: readOnly || isLoadingAddressDetails, placeholder: element.placeholderValue, required: element.required, value: value, validationMessage: validationMessage, displayValidationMessage: displayValidationMessage, onChangeValue: handleChange, isLoading: isLoadingAddressDetails, hasError: !!error, onChangeLabel: setLabel, searchDebounceMs: 750, searchMinCharacters: 4, onSearch: handleSearch, isDirty: isDirty, setIsDirty: setIsDirty, "aria-describedby": ariaDescribedby, branding: _jsxs("a", { className: "dropdown-item cypress-powered-by-google ob-autocomplete__drop-down-item-powered-by-google", children: ["powered by", ' ', _jsx("img", { src: "https://developers.google.com/static/maps/documentation/images/google_on_white.png" })] }), autoComplete: autocompleteAttributes }) }), error && (_jsx(FormElementValidationMessage, { message: error.toString(), className: "cypress-google-address-details-error-message" }))] }));
139
+ return (_jsxs("div", { className: "cypress-google-address-element", children: [_jsx(FormElementLabelContainer, { className: "ob-google-address ob-autocomplete", element: element, id: id, required: element.required, children: _jsx(AutocompleteDropdown, { id: id, label: label, disabled: readOnly || isLoadingAddressDetails, placeholder: element.placeholderValue, required: element.required, value: value, validationMessage: validationMessage, displayValidationMessage: displayValidationMessage, onChangeValue: handleChange, isLoading: isLoadingAddressDetails, hasError: !!error, onChangeLabel: setLabel, searchDebounceMs: 750, searchMinCharacters: 4, onSearch: handleSearch, isDirty: isDirty, setIsDirty: setIsDirty, "aria-describedby": ariaDescribedby, branding: _jsx("a", { className: "dropdown-item cypress-powered-by-google ob-autocomplete__drop-down-item-powered-by-google", children: _jsx(GoogleMapsLogo, {}) }), autoComplete: autocompleteAttributes }) }), error && (_jsx(FormElementValidationMessage, { message: error.toString(), className: "cypress-google-address-details-error-message" }))] }));
139
140
  }
140
141
  export default React.memo(FormElementGoogleAddress);
141
142
  //# sourceMappingURL=FormElementGoogleAddress.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"FormElementGoogleAddress.js","sourceRoot":"","sources":["../../src/form-elements/FormElementGoogleAddress.tsx"],"names":[],"mappings":";AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAE9B,OAAO,EAAE,iBAAiB,EAAE,MAAM,EAAE,MAAM,SAAS,CAAA;AAEnD,OAAO,oBAAoB,MAAM,6CAA6C,CAAA;AAC9E,OAAO,yBAAyB,MAAM,kDAAkD,CAAA;AACxF,OAAO,SAAS,MAAM,oBAAoB,CAAA;AAC1C,OAAO,YAAY,MAAM,uBAAuB,CAAA;AAChD,OAAO,yBAAyB,MAAM,oCAAoC,CAAA;AAE1E,OAAO,4BAA4B,MAAM,qDAAqD,CAAA;AAc9F,SAAS,wBAAwB,CAAC,EAChC,EAAE,EACF,OAAO,EACP,QAAQ,EACR,KAAK,EACL,wBAAwB,EACxB,iBAAiB,EACjB,QAAQ,EACR,OAAO,EACP,UAAU,EACV,sBAAsB,GAChB;IACN,MAAM,eAAe,GAAG,yBAAyB,CAAC,EAAE,EAAE,OAAO,CAAC,CAAA;IAC9D,MAAM,SAAS,GAAG,YAAY,EAAE,CAAA;IAChC,MAAM,CAAC,KAAK,EAAE,Q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,KAAK,CAAC,CAAC,CAAA;IAEX,OAAO,CACL,eAAK,SAAS,EAAC,gCAAgC,aAC7C,KAAC,yBAAyB,IACxB,SAAS,EAAC,mCAAmC,EAC7C,OAAO,EAAE,OAAO,EAChB,EAAE,EAAE,EAAE,EACN,QAAQ,EAAE,OAAO,CAAC,QAAQ,YAE1B,KAAC,oBAAoB,IACnB,EAAE,EAAE,EAAE,EACN,KAAK,EAAE,KAAK,EACZ,QAAQ,EAAE,QAAQ,IAAI,uBAAuB,EAC7C,WAAW,EAAE,OAAO,CAAC,gBAAgB,EACrC,QAAQ,EAAE,OAAO,CAAC,QAAQ,EAC1B,KAAK,EAAE,KAAK,EACZ,iBAAiB,EAAE,iBAAiB,EACpC,wBAAwB,EAAE,wBAAwB,EAClD,aAAa,EAAE,YAAY,EAC3B,SAAS,EAAE,uBAAuB,EAClC,QAAQ,EAAE,CAAC,CAAC,KAAK,EACjB,aAAa,EAAE,QAAQ,EACvB,gBAAgB,EAAE,GAAG,EACrB,mBAAmB,EAAE,CAAC,EACtB,QAAQ,EAAE,YAAY,EACtB,OAAO,EAAE,OAAO,EAChB,UAAU,EAAE,UAAU,sBACJ,eAAe,EACjC,QAAQ,EACN,aAAG,SAAS,EAAC,2FAA2F,2BAC3F,GAAG,EACd,cAAK,GAAG,EAAC,oFAAoF,GAAG,IAC9F,EAEN,YAAY,EAAE,sBAAsB,GACpC,GACwB,EAE3B,KAAK,IAAI,CACR,KAAC,4BAA4B,IAC3B,OAAO,EAAE,KAAK,CAAC,QAAQ,EAAE,EACzB,SAAS,EAAC,8CAA8C,GACxD,CACH,IACG,CACP,CAAA;AACH,CAAC;AAED,eAAe,KAAK,CAAC,IAAI,CAAC,wBAAwB,CAAC,CAAA","sourcesContent":["import * as React from 'react'\nimport { FormTypes, GoogleTypes } from '@oneblink/types'\nimport { OneBlinkAppsError, Sentry } from '../apps'\n\nimport AutocompleteDropdown from '../components/renderer/AutocompleteDropdown'\nimport FormElementLabelContainer from '../components/renderer/FormElementLabelContainer'\nimport useGoogle from '../hooks/useGoogle'\nimport useIsMounted from '../hooks/useIsMounted'\nimport useElementAriaDescribedby from '../hooks/useElementAriaDescribedby'\nimport { FormElementValueChangeHandler, IsDirtyProps } from '../types/form'\nimport FormElementValidationMessage from '../components/renderer/FormElementValidationMessage'\n\ntype Props = {\n formId: number\n id: string\n element: FormTypes.GoogleAddressElement\n readOnly: boolean\n value: GoogleTypes.GoogleMapsAddress | undefined\n displayValidationMessage: boolean\n validationMessage: string | undefined\n onChange: FormElementValueChangeHandler<GoogleTypes.GoogleMapsAddress>\n autocompleteAttributes?: string\n} & IsDirtyProps\n\nfunction FormElementGoogleAddress({\n id,\n element,\n readOnly,\n value,\n displayValidationMessage,\n validationMessage,\n onChange,\n isDirty,\n setIsDirty,\n autocompleteAttributes,\n}: Props) {\n const ariaDescribedby = useElementAriaDescribedby(id, element)\n const isMounted = useIsMounted()\n const [label, setLabel] = React.useState('')\n const [error, setError] = React.useState<Error | undefined>()\n const [isLoadingAddressDetails, setIsLoadingAddressDetails] =\n React.useState(false)\n\n const { isLoaded } = useGoogle()\n\n const autocompleteService = React.useMemo(() => {\n if (isLoaded) {\n return new google.maps.places.AutocompleteService()\n }\n }, [isLoaded])\n\n const dummyMap = React.useMemo(() => {\n if (isLoaded) {\n return new google.maps.Map(document.createElement('div'))\n }\n }, [isLoaded])\n\n const handleSearch = React.useCallback(\n async (input: string, abortSignal: AbortSignal) => {\n setError(undefined)\n if (autocompleteService) {\n const predictions = await new Promise<\n google.maps.places.QueryAutocompletePrediction[]\n >((resolve, reject) => {\n autocompleteService.getQueryPredictions(\n {\n input,\n },\n (predictions, status) => {\n switch (status) {\n case google.maps.places.PlacesServiceStatus.OK:\n case google.maps.places.PlacesServiceStatus.ZERO_RESULTS: {\n resolve(predictions ?? [])\n break\n }\n case google.maps.places.PlacesServiceStatus.OVER_QUERY_LIMIT: {\n reject(\n new OneBlinkAppsError(\n 'This application has gone over its Google Address querying quota. Please contact an administrator to rectify the issue or try again later.',\n ),\n )\n break\n }\n case google.maps.places.PlacesServiceStatus.INVALID_REQUEST: {\n reject(\n new OneBlinkAppsError(\n 'Google Maps API key may not have been configured correctly, the request to retrieve address suggestions is invalid. Please contact an administrator to rectify the issue.',\n ),\n )\n break\n }\n case google.maps.places.PlacesServiceStatus.REQUEST_DENIED: {\n reject(\n new OneBlinkAppsError(\n 'Google Maps API key has not been configured correctly. Please contact an administrator to rectify the issue.',\n ),\n )\n break\n }\n default: {\n reject(\n new OneBlinkAppsError(\n 'An unknown error has occurred. Please try again and contact support if the problem persists.',\n ),\n )\n }\n }\n },\n )\n }).catch((e) => {\n if (!abortSignal.aborted) {\n Sentry.captureException(e)\n }\n throw e\n })\n\n if (!abortSignal.aborted) {\n return predictions.reduce<Array<{ value: string; label: string }>>(\n (results, prediction) => {\n if (prediction.place_id) {\n results.push({\n value: prediction.place_id,\n label: prediction.description,\n })\n }\n return results\n },\n [],\n )\n }\n }\n throw new OneBlinkAppsError(\n 'An unknown error has occurred. Please contact support if the problem persists.',\n )\n },\n [autocompleteService],\n )\n\n const handleChange = React.useCallback(\n async (placeId: string | undefined) => {\n if (!placeId) {\n onChange(element, { value: undefined })\n return\n }\n\n setIsLoadingAddressDetails(true)\n try {\n //this should not happen, we can't get a place Id without google being present\n if (!isLoaded || !dummyMap) {\n throw new OneBlinkAppsError(\n 'An unknown error has occurred. Please contact support if the problem persists.',\n {\n originalError: new Error(\n 'Google Places library has not be initialised',\n ),\n },\n )\n }\n\n const placeService = new google.maps.places.PlacesService(dummyMap)\n const place = await new Promise<google.maps.places.PlaceResult>(\n (resolve, reject) => {\n placeService.getDetails(\n {\n placeId,\n fields: [\n 'place_id',\n 'formatted_address',\n 'geometry',\n 'address_components',\n ],\n },\n (place, status) => {\n if (\n status !== google.maps.places.PlacesServiceStatus.OK ||\n !place\n ) {\n reject(\n new OneBlinkAppsError(\n `Could not find address details for place with id: ${placeId}`,\n ),\n )\n return\n }\n resolve(place)\n },\n )\n },\n )\n onChange(element, {\n value: {\n place_id: place.place_id,\n formatted_address: place.formatted_address,\n address_components: place.address_components,\n geometry: {\n location: place.geometry?.location?.toJSON(),\n viewport: place.geometry?.viewport?.toJSON(),\n },\n },\n })\n } catch (newError) {\n if (isMounted.current) {\n setError(newError as Error)\n }\n }\n if (isMounted.current) {\n setIsLoadingAddressDetails(false)\n }\n },\n [isMounted, onChange, element, isLoaded, dummyMap],\n )\n\n // Ensure the label is set if the value is set outside of this component\n React.useEffect(() => {\n if (value) {\n const newLabel = value.formatted_address || value.place_id\n setLabel(newLabel ?? '')\n }\n }, [value])\n\n return (\n <div className=\"cypress-google-address-element\">\n <FormElementLabelContainer\n className=\"ob-google-address ob-autocomplete\"\n element={element}\n id={id}\n required={element.required}\n >\n <AutocompleteDropdown\n id={id}\n label={label}\n disabled={readOnly || isLoadingAddressDetails}\n placeholder={element.placeholderValue}\n required={element.required}\n value={value}\n validationMessage={validationMessage}\n displayValidationMessage={displayValidationMessage}\n onChangeValue={handleChange}\n isLoading={isLoadingAddressDetails}\n hasError={!!error}\n onChangeLabel={setLabel}\n searchDebounceMs={750}\n searchMinCharacters={4}\n onSearch={handleSearch}\n isDirty={isDirty}\n setIsDirty={setIsDirty}\n aria-describedby={ariaDescribedby}\n branding={\n <a className=\"dropdown-item cypress-powered-by-google ob-autocomplete__drop-down-item-powered-by-google\">\n powered by{' '}\n <img src=\"https://developers.google.com/static/maps/documentation/images/google_on_white.png\" />\n </a>\n }\n autoComplete={autocompleteAttributes}\n />\n </FormElementLabelContainer>\n\n {error && (\n <FormElementValidationMessage\n message={error.toString()}\n className=\"cypress-google-address-details-error-message\"\n />\n )}\n </div>\n )\n}\n\nexport default React.memo(FormElementGoogleAddress)\n"]}
1
+ {"version":3,"file":"FormElementGoogleAddress.js","sourceRoot":"","sources":["../../src/form-elements/FormElementGoogleAddress.tsx"],"names":[],"mappings":";AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAE9B,OAAO,EAAE,iBAAiB,EA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rB,mBAAmB,EAAE,CAAC,EACtB,QAAQ,EAAE,YAAY,EACtB,OAAO,EAAE,OAAO,EAChB,UAAU,EAAE,UAAU,sBACJ,eAAe,EACjC,QAAQ,EACN,YAAG,SAAS,EAAC,2FAA2F,YACtG,KAAC,cAAc,KAAG,GAChB,EAEN,YAAY,EAAE,sBAAsB,GACpC,GACwB,EAE3B,KAAK,IAAI,CACR,KAAC,4BAA4B,IAC3B,OAAO,EAAE,KAAK,CAAC,QAAQ,EAAE,EACzB,SAAS,EAAC,8CAA8C,GACxD,CACH,IACG,CACP,CAAA;AACH,CAAC;AAED,eAAe,KAAK,CAAC,IAAI,CAAC,wBAAwB,CAAC,CAAA","sourcesContent":["import * as React from 'react'\nimport { FormTypes, GoogleTypes } from '@oneblink/types'\nimport { OneBlinkAppsError, Sentry } from '../apps'\n\nimport AutocompleteDropdown from '../components/renderer/AutocompleteDropdown'\nimport FormElementLabelContainer from '../components/renderer/FormElementLabelContainer'\nimport useGoogle from '../hooks/useGoogle'\nimport useIsMounted from '../hooks/useIsMounted'\nimport useElementAriaDescribedby from '../hooks/useElementAriaDescribedby'\nimport { FormElementValueChangeHandler, IsDirtyProps } from '../types/form'\nimport FormElementValidationMessage from '../components/renderer/FormElementValidationMessage'\nimport GoogleMapsLogo from '../components/GoogleMapsLogo'\n\ntype Props = {\n formId: number\n id: string\n element: FormTypes.GoogleAddressElement\n readOnly: boolean\n value: GoogleTypes.GoogleMapsAddress | undefined\n displayValidationMessage: boolean\n validationMessage: string | undefined\n onChange: FormElementValueChangeHandler<GoogleTypes.GoogleMapsAddress>\n autocompleteAttributes?: string\n} & IsDirtyProps\n\nfunction FormElementGoogleAddress({\n id,\n element,\n readOnly,\n value,\n displayValidationMessage,\n validationMessage,\n onChange,\n isDirty,\n setIsDirty,\n autocompleteAttributes,\n}: Props) {\n const ariaDescribedby = useElementAriaDescribedby(id, element)\n const isMounted = useIsMounted()\n const [label, setLabel] = React.useState('')\n const [error, setError] = React.useState<Error | undefined>()\n const [isLoadingAddressDetails, setIsLoadingAddressDetails] =\n React.useState(false)\n\n const { isLoaded } = useGoogle()\n\n const autocompleteService = React.useMemo(() => {\n if (isLoaded) {\n return new google.maps.places.AutocompleteService()\n }\n }, [isLoaded])\n\n const dummyMap = React.useMemo(() => {\n if (isLoaded) {\n return new google.maps.Map(document.createElement('div'))\n }\n }, [isLoaded])\n\n const handleSearch = React.useCallback(\n async (input: string, abortSignal: AbortSignal) => {\n setError(undefined)\n if (autocompleteService) {\n const predictions = await new Promise<\n google.maps.places.QueryAutocompletePrediction[]\n >((resolve, reject) => {\n autocompleteService.getQueryPredictions(\n {\n input,\n },\n (predictions, status) => {\n switch (status) {\n case google.maps.places.PlacesServiceStatus.OK:\n case google.maps.places.PlacesServiceStatus.ZERO_RESULTS: {\n resolve(predictions ?? [])\n break\n }\n case google.maps.places.PlacesServiceStatus.OVER_QUERY_LIMIT: {\n reject(\n new OneBlinkAppsError(\n 'This application has gone over its Google Address querying quota. Please contact an administrator to rectify the issue or try again later.',\n ),\n )\n break\n }\n case google.maps.places.PlacesServiceStatus.INVALID_REQUEST: {\n reject(\n new OneBlinkAppsError(\n 'Google Maps API key may not have been configured correctly, the request to retrieve address suggestions is invalid. Please contact an administrator to rectify the issue.',\n ),\n )\n break\n }\n case google.maps.places.PlacesServiceStatus.REQUEST_DENIED: {\n reject(\n new OneBlinkAppsError(\n 'Google Maps API key has not been configured correctly. Please contact an administrator to rectify the issue.',\n ),\n )\n break\n }\n default: {\n reject(\n new OneBlinkAppsError(\n 'An unknown error has occurred. Please try again and contact support if the problem persists.',\n ),\n )\n }\n }\n },\n )\n }).catch((e) => {\n if (!abortSignal.aborted) {\n Sentry.captureException(e)\n }\n throw e\n })\n\n if (!abortSignal.aborted) {\n return predictions.reduce<Array<{ value: string; label: string }>>(\n (results, prediction) => {\n if (prediction.place_id) {\n results.push({\n value: prediction.place_id,\n label: prediction.description,\n })\n }\n return results\n },\n [],\n )\n }\n }\n throw new OneBlinkAppsError(\n 'An unknown error has occurred. Please contact support if the problem persists.',\n )\n },\n [autocompleteService],\n )\n\n const handleChange = React.useCallback(\n async (placeId: string | undefined) => {\n if (!placeId) {\n onChange(element, { value: undefined })\n return\n }\n\n setIsLoadingAddressDetails(true)\n try {\n //this should not happen, we can't get a place Id without google being present\n if (!isLoaded || !dummyMap) {\n throw new OneBlinkAppsError(\n 'An unknown error has occurred. Please contact support if the problem persists.',\n {\n originalError: new Error(\n 'Google Places library has not be initialised',\n ),\n },\n )\n }\n\n const placeService = new google.maps.places.PlacesService(dummyMap)\n const place = await new Promise<google.maps.places.PlaceResult>(\n (resolve, reject) => {\n placeService.getDetails(\n {\n placeId,\n fields: [\n 'place_id',\n 'formatted_address',\n 'geometry',\n 'address_components',\n ],\n },\n (place, status) => {\n if (\n status !== google.maps.places.PlacesServiceStatus.OK ||\n !place\n ) {\n reject(\n new OneBlinkAppsError(\n `Could not find address details for place with id: ${placeId}`,\n ),\n )\n return\n }\n resolve(place)\n },\n )\n },\n )\n onChange(element, {\n value: {\n place_id: place.place_id,\n formatted_address: place.formatted_address,\n address_components: place.address_components,\n geometry: {\n location: place.geometry?.location?.toJSON(),\n viewport: place.geometry?.viewport?.toJSON(),\n },\n },\n })\n } catch (newError) {\n if (isMounted.current) {\n setError(newError as Error)\n }\n }\n if (isMounted.current) {\n setIsLoadingAddressDetails(false)\n }\n },\n [isMounted, onChange, element, isLoaded, dummyMap],\n )\n\n // Ensure the label is set if the value is set outside of this component\n React.useEffect(() => {\n if (value) {\n const newLabel = value.formatted_address || value.place_id\n setLabel(newLabel ?? '')\n }\n }, [value])\n\n return (\n <div className=\"cypress-google-address-element\">\n <FormElementLabelContainer\n className=\"ob-google-address ob-autocomplete\"\n element={element}\n id={id}\n required={element.required}\n >\n <AutocompleteDropdown\n id={id}\n label={label}\n disabled={readOnly || isLoadingAddressDetails}\n placeholder={element.placeholderValue}\n required={element.required}\n value={value}\n validationMessage={validationMessage}\n displayValidationMessage={displayValidationMessage}\n onChangeValue={handleChange}\n isLoading={isLoadingAddressDetails}\n hasError={!!error}\n onChangeLabel={setLabel}\n searchDebounceMs={750}\n searchMinCharacters={4}\n onSearch={handleSearch}\n isDirty={isDirty}\n setIsDirty={setIsDirty}\n aria-describedby={ariaDescribedby}\n branding={\n <a className=\"dropdown-item cypress-powered-by-google ob-autocomplete__drop-down-item-powered-by-google\">\n <GoogleMapsLogo />\n </a>\n }\n autoComplete={autocompleteAttributes}\n />\n </FormElementLabelContainer>\n\n {error && (\n <FormElementValidationMessage\n message={error.toString()}\n className=\"cypress-google-address-details-error-message\"\n />\n )}\n </div>\n )\n}\n\nexport default React.memo(FormElementGoogleAddress)\n"]}
@@ -22,7 +22,7 @@
22
22
  padding-right: 16px;
23
23
  color: #5f6368;
24
24
 
25
- img {
25
+ svg {
26
26
  vertical-align: middle;
27
27
  }
28
28
  }
package/dist/styles.css CHANGED
@@ -9077,7 +9077,7 @@ input[type=range]:focus-visible::-moz-range-thumb {
9077
9077
  padding-right: 16px;
9078
9078
  color: #5f6368;
9079
9079
  }
9080
- .ob-autocomplete .ob-autocomplete__drop-down-item-powered-by-google img {
9080
+ .ob-autocomplete .ob-autocomplete__drop-down-item-powered-by-google svg {
9081
9081
  vertical-align: middle;
9082
9082
  }
9083
9083
 
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@oneblink/apps-react",
3
3
  "description": "Helper functions for OneBlink apps in ReactJS.",
4
- "version": "13.4.0-beta.4",
4
+ "version": "13.4.0-beta.6",
5
5
  "author": "OneBlink <developers@oneblink.io> (https://oneblink.io)",
6
6
  "bugs": {
7
7
  "url": "https://github.com/oneblink/apps-react/issues"