@oneblink/apps-react 5.12.0-beta.10 → 5.12.0-beta.12
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/OneBlinkFormBase.js +9 -8
- package/dist/OneBlinkFormBase.js.map +1 -1
- package/dist/PaymentReceipt.js +2 -1
- package/dist/PaymentReceipt.js.map +1 -1
- package/dist/components/ArcGISWebMap.js +2 -1
- package/dist/components/ArcGISWebMap.js.map +1 -1
- package/dist/components/CopyToClipboardIconButton.js +2 -2
- package/dist/components/CopyToClipboardIconButton.js.map +1 -1
- package/dist/components/CustomAccordion.d.ts +1 -1
- package/dist/components/ErrorSnackbar.js +6 -8
- package/dist/components/ErrorSnackbar.js.map +1 -1
- package/dist/components/IconComponent.d.ts +7 -0
- package/dist/components/IconComponent.js +13 -0
- package/dist/components/IconComponent.js.map +1 -0
- package/dist/components/Lists.d.ts +1 -1
- package/dist/components/MaterialIcon.d.ts +2 -0
- package/dist/components/MaterialIcon.js +6 -0
- package/dist/components/MaterialIcon.js.map +1 -0
- package/dist/components/formStore/FormStoreTableProvider.js +4 -3
- package/dist/components/formStore/FormStoreTableProvider.js.map +1 -1
- package/dist/components/formStore/OneBlinkFormStoreClearFiltersButton.js +2 -2
- package/dist/components/formStore/OneBlinkFormStoreClearFiltersButton.js.map +1 -1
- package/dist/components/formStore/OneBlinkFormStoreColumnsButton.js +3 -3
- package/dist/components/formStore/OneBlinkFormStoreColumnsButton.js.map +1 -1
- package/dist/components/formStore/OneBlinkFormStoreDownloadButton.js +3 -3
- package/dist/components/formStore/OneBlinkFormStoreDownloadButton.js.map +1 -1
- package/dist/components/formStore/OneBlinkFormStoreRefreshButton.js +2 -2
- package/dist/components/formStore/OneBlinkFormStoreRefreshButton.js.map +1 -1
- package/dist/components/formStore/OneBlinkFormStoreTable.js +7 -8
- package/dist/components/formStore/OneBlinkFormStoreTable.js.map +1 -1
- package/dist/components/formStore/display/ElementDisplay.js +2 -2
- package/dist/components/formStore/display/ElementDisplay.js.map +1 -1
- package/dist/components/formStore/display/FormStoreIcon.d.ts +3 -2
- package/dist/components/formStore/display/FormStoreIcon.js +5 -2
- package/dist/components/formStore/display/FormStoreIcon.js.map +1 -1
- package/dist/components/formStore/table/ActionedByTableCell.js +4 -4
- package/dist/components/formStore/table/ActionedByTableCell.js.map +1 -1
- package/dist/components/formStore/table/HeaderCellMoreButton.js +9 -6
- package/dist/components/formStore/table/HeaderCellMoreButton.js.map +1 -1
- package/dist/components/formStore/table/RepeatableSetCellAccordion.js +2 -2
- package/dist/components/formStore/table/RepeatableSetCellAccordion.js.map +1 -1
- package/dist/components/messages/ErrorMessage.js +2 -1
- package/dist/components/messages/ErrorMessage.js.map +1 -1
- package/dist/components/messages/LargeIconMessage.d.ts +3 -3
- package/dist/components/messages/LargeIconMessage.js.map +1 -1
- package/dist/components/payments/PaymentForm.js +2 -1
- package/dist/components/payments/PaymentForm.js.map +1 -1
- package/dist/components/payments/WestpacQuickStreamPaymentForm.js +2 -1
- package/dist/components/payments/WestpacQuickStreamPaymentForm.js.map +1 -1
- package/dist/components/receipts/ReceiptList.js +3 -2
- package/dist/components/receipts/ReceiptList.js.map +1 -1
- package/dist/components/receipts/ReceiptListItem.js +3 -2
- package/dist/components/receipts/ReceiptListItem.js.map +1 -1
- package/dist/components/renderer/AutocompleteDropdown.js +3 -2
- package/dist/components/renderer/AutocompleteDropdown.js.map +1 -1
- package/dist/components/renderer/CopyToClipboardButton.js +2 -1
- package/dist/components/renderer/CopyToClipboardButton.js.map +1 -1
- package/dist/components/renderer/CustomisableButtonInner.js +2 -1
- package/dist/components/renderer/CustomisableButtonInner.js.map +1 -1
- package/dist/components/renderer/FormElementLabelContainer.js +2 -1
- package/dist/components/renderer/FormElementLabelContainer.js.map +1 -1
- package/dist/components/renderer/LookupButton.js +2 -1
- package/dist/components/renderer/LookupButton.js.map +1 -1
- package/dist/components/renderer/LookupNotification.js +4 -3
- package/dist/components/renderer/LookupNotification.js.map +1 -1
- package/dist/components/renderer/attachments/AttachmentStatus.js +5 -4
- package/dist/components/renderer/attachments/AttachmentStatus.js.map +1 -1
- package/dist/components/renderer/attachments/DropdownMenu.js +2 -1
- package/dist/components/renderer/attachments/DropdownMenu.js.map +1 -1
- package/dist/components/renderer/attachments/FileCardContent.js +2 -1
- package/dist/components/renderer/attachments/FileCardContent.js.map +1 -1
- package/dist/components/renderer/attachments/ImagePreviewUnavailable.js +3 -2
- package/dist/components/renderer/attachments/ImagePreviewUnavailable.js.map +1 -1
- package/dist/form-elements/ComplianceButton.js +2 -1
- package/dist/form-elements/ComplianceButton.js.map +1 -1
- package/dist/form-elements/FormElementBarcodeScanner.js +2 -1
- package/dist/form-elements/FormElementBarcodeScanner.js.map +1 -1
- package/dist/form-elements/FormElementCalculation.js +2 -1
- package/dist/form-elements/FormElementCalculation.js.map +1 -1
- package/dist/form-elements/FormElementCamera.js +3 -2
- package/dist/form-elements/FormElementCamera.js.map +1 -1
- package/dist/form-elements/FormElementDate.js +2 -1
- package/dist/form-elements/FormElementDate.js.map +1 -1
- package/dist/form-elements/FormElementDateTime.js +2 -1
- package/dist/form-elements/FormElementDateTime.js.map +1 -1
- package/dist/form-elements/FormElementEmail.js +2 -1
- package/dist/form-elements/FormElementEmail.js.map +1 -1
- package/dist/form-elements/FormElementFiles.js +2 -1
- package/dist/form-elements/FormElementFiles.js.map +1 -1
- package/dist/form-elements/FormElementFreshdeskDependentField.js.map +1 -1
- package/dist/form-elements/FormElementNumber.js +2 -1
- package/dist/form-elements/FormElementNumber.js.map +1 -1
- package/dist/form-elements/FormElementRepeatableSet.js +3 -2
- package/dist/form-elements/FormElementRepeatableSet.js.map +1 -1
- package/dist/form-elements/FormElementSection.js +3 -2
- package/dist/form-elements/FormElementSection.js.map +1 -1
- package/dist/form-elements/FormElementTelephone.js +2 -1
- package/dist/form-elements/FormElementTelephone.js.map +1 -1
- package/dist/form-elements/FormElementTime.js +2 -1
- package/dist/form-elements/FormElementTime.js.map +1 -1
- package/dist/hooks/useDynamicOptionsLoaderState.d.ts +1 -1
- package/dist/hooks/useDynamicOptionsLoaderState.js +2 -1
- package/dist/hooks/useDynamicOptionsLoaderState.js.map +1 -1
- package/dist/hooks/useFormSubmissionState.d.ts +1 -1
- package/dist/hooks/useFormSubmissionState.js.map +1 -1
- package/dist/types/mui-color.d.ts +4 -0
- package/dist/types/mui-color.js +2 -0
- package/dist/types/mui-color.js.map +1 -0
- package/package.json +1 -2
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"OneBlinkFormStoreTable.js","sourceRoot":"","sources":["../../../src/components/formStore/OneBlinkFormStoreTable.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAC9B,OAAO,IAAI,MAAM,MAAM,CAAA;AACvB,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,eAAe,CAAA;AAC/C,OAAO,EACL,UAAU,IAAI,cAAc,EAC5B,OAAO,IAAI,WAAW,EACtB,aAAa,GACd,MAAM,qBAAqB,CAAA;AAC5B,OAAO,EAAE,kBAAkB,EAAE,MAAM,2BAA2B,CAAA;AAC9D,OAAO,oBAAoB,MAAM,8BAA8B,CAAA;AAC/D,OAAO,wBAAwB,MAAM,4BAA4B,CAAA;AAEjE,MAAM,WAAW,GAAG,MAAM,CAAC,aAAa,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,EAAE,EAAE,CAAC,CAAC;IACxD,UAAU,EAAE,KAAK,CAAC,WAAW,CAAC,MAAM,CAAC,WAAW,CAAC;CAClD,CAAC,CAAC,CAAA;AAEH,MAAM,KAAK,GAAG,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,EAAE,EAAE,CAAC,CAAC;IAC1C,OAAO,EAAE,cAAc;IACvB,eAAe,EAAE,KAAK,CAAC,OAAO,CAAC,UAAU,CAAC,KAAK;IAC/C,QAAQ,EAAE,KAAK,CAAC,UAAU,CAAC,KAAK,CAAC,QAAQ;I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React from 'react'\nimport clsx from 'clsx'\nimport { styled, Tooltip } from '@mui/material'\nimport {\n FilterList as FilterListIcon,\n Warning as WarningIcon,\n ArrowDownward,\n} from '@mui/icons-material'\nimport { IsHoveringProvider } from '../../hooks/useIsHovering'\nimport HeaderCellMoreButton from './table/HeaderCellMoreButton'\nimport useFormStoreTableContext from './useFormStoreTableContext'\n\nconst SortingIcon = styled(ArrowDownward)(({ theme }) => ({\n transition: theme.transitions.create('transform'),\n}))\n\nconst Table = styled('div')(({ theme }) => ({\n display: 'inline-block',\n backgroundColor: theme.palette.background.paper,\n fontSize: theme.typography.body2.fontSize,\n '& .ob-form-store-table-row__alternate': {\n backgroundColor: theme.palette.action.hover,\n },\n '& .tc': {\n padding: theme.spacing(1),\n borderBottom: '1px solid',\n borderBottomColor: theme.palette.divider,\n display: 'flex',\n alignItems: 'center',\n '&.is-clickable': {\n cursor: 'pointer',\n transition: theme.transitions.create('transform'),\n '&:hover': {\n backgroundColor: theme.palette.action.hover,\n },\n },\n },\n '& .td': {\n position: 'relative',\n borderRight: '1px solid',\n borderRightColor: theme.palette.divider,\n overflowX: 'hidden',\n // minus 1 to cater for the border\n minHeight: `${parseInt(theme.spacing(5.5)) - 1}px`,\n '&.is-resizing': {\n borderRightStyle: 'dashed',\n },\n },\n '& .th': {\n position: 'relative',\n fontWeight: theme.typography.fontWeightBold,\n paddingRight: 0,\n borderBottomWidth: '2px',\n '& .th-content': {\n flex: 1,\n display: 'flex',\n alignItems: 'center',\n justifyContent: 'space-between',\n borderRight: '1px solid',\n borderRightColor: theme.palette.divider,\n paddingRight: theme.spacing(),\n '& .th-label': {\n display: 'inline-flex',\n alignItems: 'center',\n '& .th-icon': {\n marginLeft: theme.spacing(),\n },\n },\n },\n '& .resizer': {\n display: 'inline-flex',\n alignItems: 'center',\n justifyContent: 'center',\n borderWidth: 0,\n borderLeftStyle: 'solid',\n borderRightStyle: 'solid',\n borderColor: theme.palette.divider,\n paddingTop: theme.spacing(),\n paddingBottom: theme.spacing(),\n paddingRight: `calc(${theme.spacing(1)} + 1px)`,\n position: 'absolute',\n right: 0,\n top: theme.spacing(0.5),\n bottom: theme.spacing(0.5),\n transform: `translateX(calc(${theme.spacing(0.5)} + 1px))`,\n zIndex: 1,\n // prevents from scrolling while dragging on touch devices\n touchAction: 'none',\n '&:hover': {\n borderWidth: '1px',\n },\n '&.is-resizing': {\n borderWidth: '1px',\n borderColor: theme.palette.grey[700],\n },\n },\n },\n}))\n\nfunction OneBlinkFormStoreTable() {\n const {\n getTableProps,\n getTableBodyProps,\n headerGroups: [parentHeaderGroup],\n rows,\n prepareRow,\n onChangeParameters,\n } = useFormStoreTableContext()\n\n if (!parentHeaderGroup) {\n return null\n }\n\n let alternateBackground = false\n\n return (\n <>\n <Table {...getTableProps()} className=\"ob-form-store-table\">\n <div className=\"thead\">\n <div\n {...parentHeaderGroup.getHeaderGroupProps()}\n className=\"tr ob-form-store-table-header-row\"\n >\n {\n // Loop over the headers in each row\n parentHeaderGroup.headers.map((headerGroup) => {\n const sortingProperty = headerGroup.sorting?.property\n const sortingDirection = headerGroup.sorting?.direction\n\n return (\n <Tooltip\n title={headerGroup.tooltip || ''}\n arrow\n key={headerGroup.id}\n PopperProps={{\n sx: {\n zIndex: 'drawer',\n },\n }}\n >\n <div\n className={clsx('th tc ob-form-store-table-header-cell', {\n 'is-clickable': !!sortingProperty,\n })}\n onClick={\n sortingProperty\n ? () => {\n onChangeParameters((currentParameters) => {\n switch (sortingDirection) {\n case 'ascending': {\n return {\n ...currentParameters,\n sorting: [\n {\n property: sortingProperty,\n direction: 'descending',\n },\n ],\n }\n }\n case 'descending': {\n return {\n ...currentParameters,\n sorting: undefined,\n }\n }\n default: {\n return {\n ...currentParameters,\n sorting: [\n {\n property: sortingProperty,\n direction: 'ascending',\n },\n ],\n }\n }\n }\n }, false)\n }\n : undefined\n }\n // Apply the header cell props\n {...headerGroup.getHeaderProps()}\n >\n <IsHoveringProvider className=\"th-content\">\n <div className=\"th-label\">\n <span>{headerGroup.headerText}</span>\n {sortingDirection && (\n <SortingIcon\n fontSize=\"small\"\n color=\"primary\"\n sx={\n sortingDirection === 'ascending'\n ? {\n transform: 'rotate(180deg)',\n }\n : undefined\n }\n className=\"th-icon\"\n />\n )}\n {headerGroup.filter?.isInvalid ? (\n <Tooltip\n title={\n headerGroup.filter?.validationMessage || ''\n }\n >\n <WarningIcon\n fontSize=\"small\"\n color=\"error\"\n className=\"th-icon\"\n />\n </Tooltip>\n ) : headerGroup.filter?.value ? (\n <FilterListIcon\n fontSize=\"small\"\n color=\"primary\"\n className=\"th-icon\"\n />\n ) : null}\n </div>\n <HeaderCellMoreButton\n headerGroup={headerGroup}\n onHide={headerGroup.toggleHidden}\n />\n <div\n {...headerGroup.getResizerProps()}\n className={clsx('resizer', {\n 'is-resizing': headerGroup.isResizing,\n })}\n onClick={(event) => {\n event.stopPropagation()\n }}\n />\n </IsHoveringProvider>\n </div>\n </Tooltip>\n )\n })\n }\n </div>\n </div>\n <div {...getTableBodyProps()} className=\"tbody\">\n {\n // Loop over the table rows\n rows.map((row, index) => {\n if (\n rows[index - 1]?.original.submissionId !==\n row.original.submissionId\n ) {\n alternateBackground = !alternateBackground\n }\n // Prepare the row for display\n prepareRow(row)\n return (\n // Apply the row props\n <div\n {...row.getRowProps()}\n key={row.id}\n className={clsx('tr ob-form-store-table-row', {\n 'ob-form-store-table-row__alternate': alternateBackground,\n })}\n >\n {\n // Loop over the rows cells\n row.cells.map((cell) => {\n // Apply the cell props\n return (\n <IsHoveringProvider\n {...cell.getCellProps()}\n key={cell.column.id}\n className={clsx(\n 'td tc ob-form-store-table-row-cell',\n {\n 'is-resizing': cell.column.isResizing,\n },\n )}\n >\n {\n // Render the cell contents\n cell.render('Cell')\n }\n </IsHoveringProvider>\n )\n })\n }\n </div>\n )\n })\n }\n </div>\n </Table>\n </>\n )\n}\n\n/**\n * @returns\n * @group Components\n */\nexport default React.memo(OneBlinkFormStoreTable)\n"]}
|
1
|
+
{"version":3,"file":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A,CACF;YACN,gCAAS,iBAAiB,EAAE,EAAE,SAAS,EAAC,OAAO;YAE3C,2BAA2B;YAC3B,IAAI,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,KAAK,EAAE,EAAE;;gBACtB,IACE,CAAA,MAAA,IAAI,CAAC,KAAK,GAAG,CAAC,CAAC,0CAAE,QAAQ,CAAC,YAAY;oBACtC,GAAG,CAAC,QAAQ,CAAC,YAAY,EACzB;oBACA,mBAAmB,GAAG,CAAC,mBAAmB,CAAA;iBAC3C;gBACD,8BAA8B;gBAC9B,UAAU,CAAC,GAAG,CAAC,CAAA;gBACf,OAAO;gBACL,sBAAsB;gBACtB,gCACM,GAAG,CAAC,WAAW,EAAE,EACrB,GAAG,EAAE,GAAG,CAAC,EAAE,EACX,SAAS,EAAE,IAAI,CAAC,4BAA4B,EAAE;wBAC5C,oCAAoC,EAAE,mBAAmB;qBAC1D,CAAC;gBAGA,2BAA2B;gBAC3B,GAAG,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE;oBACrB,uBAAuB;oBACvB,OAAO,CACL,oBAAC,kBAAkB,OACb,IAAI,CAAC,YAAY,EAAE,EACvB,GAAG,EAAE,IAAI,CAAC,MAAM,CAAC,EAAE,EACnB,SAAS,EAAE,IAAI,CACb,oCAAoC,EACpC;4BACE,aAAa,EAAE,IAAI,CAAC,MAAM,CAAC,UAAU;yBACtC,CACF;oBAGC,2BAA2B;oBAC3B,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,CAEF,CACtB,CAAA;gBACH,CAAC,CAAC,CAEA,CACP,CAAA;YACH,CAAC,CAAC,CAEA,CACA,CACP,CACJ,CAAA;AACH,CAAC;AAED;;;GAGG;AACH,eAAe,KAAK,CAAC,IAAI,CAAC,sBAAsB,CAAC,CAAA","sourcesContent":["import * as React from 'react'\nimport clsx from 'clsx'\nimport { styled, Tooltip } from '@mui/material'\nimport { IsHoveringProvider } from '../../hooks/useIsHovering'\nimport HeaderCellMoreButton from './table/HeaderCellMoreButton'\nimport useFormStoreTableContext from './useFormStoreTableContext'\nimport { Color } from '../../types/mui-color'\nimport MaterialIcon from '../MaterialIcon'\n\nconst StyledIcon = styled(\n ({\n icon,\n ...props\n }: {\n icon: string\n } & React.ComponentProps<typeof MaterialIcon>) => (\n <MaterialIcon {...props}>{icon}</MaterialIcon>\n ),\n)<{\n color: Color\n icon: string\n sortingDirection?: 'ascending' | 'descending'\n}>(({ theme, color, sortingDirection }) => ({\n transition: theme.transitions.create('transform'),\n transform: sortingDirection === 'ascending' ? 'rotate(180deg)' : undefined,\n fontSize: theme.typography.h6.fontSize + '!important',\n color: theme.palette[color].main,\n}))\n\nconst Table = styled('div')(({ theme }) => ({\n display: 'inline-block',\n backgroundColor: theme.palette.background.paper,\n fontSize: theme.typography.body2.fontSize,\n '& .ob-form-store-table-row__alternate': {\n backgroundColor: theme.palette.action.hover,\n },\n '& .tc': {\n padding: theme.spacing(1),\n borderBottom: '1px solid',\n borderBottomColor: theme.palette.divider,\n display: 'flex',\n alignItems: 'center',\n '&.is-clickable': {\n cursor: 'pointer',\n transition: theme.transitions.create('transform'),\n '&:hover': {\n backgroundColor: theme.palette.action.hover,\n },\n },\n },\n '& .td': {\n position: 'relative',\n borderRight: '1px solid',\n borderRightColor: theme.palette.divider,\n overflowX: 'hidden',\n // minus 1 to cater for the border\n minHeight: `${parseInt(theme.spacing(5.5)) - 1}px`,\n '&.is-resizing': {\n borderRightStyle: 'dashed',\n },\n },\n '& .th': {\n position: 'relative',\n fontWeight: theme.typography.fontWeightBold,\n paddingRight: 0,\n borderBottomWidth: '2px',\n '& .th-content': {\n flex: 1,\n display: 'flex',\n alignItems: 'center',\n justifyContent: 'space-between',\n borderRight: '1px solid',\n borderRightColor: theme.palette.divider,\n paddingRight: theme.spacing(),\n '& .th-label': {\n display: 'inline-flex',\n alignItems: 'center',\n '& .th-icon': {\n marginLeft: theme.spacing(),\n },\n },\n },\n '& .resizer': {\n display: 'inline-flex',\n alignItems: 'center',\n justifyContent: 'center',\n borderWidth: 0,\n borderLeftStyle: 'solid',\n borderRightStyle: 'solid',\n borderColor: theme.palette.divider,\n paddingTop: theme.spacing(),\n paddingBottom: theme.spacing(),\n paddingRight: `calc(${theme.spacing(1)} + 1px)`,\n position: 'absolute',\n right: 0,\n top: theme.spacing(0.5),\n bottom: theme.spacing(0.5),\n transform: `translateX(calc(${theme.spacing(0.5)} + 1px))`,\n zIndex: 1,\n // prevents from scrolling while dragging on touch devices\n touchAction: 'none',\n '&:hover': {\n borderWidth: '1px',\n },\n '&.is-resizing': {\n borderWidth: '1px',\n borderColor: theme.palette.grey[700],\n },\n },\n },\n}))\n\nfunction OneBlinkFormStoreTable() {\n const {\n getTableProps,\n getTableBodyProps,\n headerGroups: [parentHeaderGroup],\n rows,\n prepareRow,\n onChangeParameters,\n } = useFormStoreTableContext()\n\n if (!parentHeaderGroup) {\n return null\n }\n\n let alternateBackground = false\n\n return (\n <>\n <Table {...getTableProps()} className=\"ob-form-store-table\">\n <div className=\"thead\">\n <div\n {...parentHeaderGroup.getHeaderGroupProps()}\n className=\"tr ob-form-store-table-header-row\"\n >\n {\n // Loop over the headers in each row\n parentHeaderGroup.headers.map((headerGroup) => {\n const sortingProperty = headerGroup.sorting?.property\n const sortingDirection = headerGroup.sorting?.direction\n\n return (\n <Tooltip\n title={headerGroup.tooltip || ''}\n arrow\n key={headerGroup.id}\n PopperProps={{\n sx: {\n zIndex: 'drawer',\n },\n }}\n >\n <div\n className={clsx('th tc ob-form-store-table-header-cell', {\n 'is-clickable': !!sortingProperty,\n })}\n onClick={\n sortingProperty\n ? () => {\n onChangeParameters((currentParameters) => {\n switch (sortingDirection) {\n case 'ascending': {\n return {\n ...currentParameters,\n sorting: [\n {\n property: sortingProperty,\n direction: 'descending',\n },\n ],\n }\n }\n case 'descending': {\n return {\n ...currentParameters,\n sorting: undefined,\n }\n }\n default: {\n return {\n ...currentParameters,\n sorting: [\n {\n property: sortingProperty,\n direction: 'ascending',\n },\n ],\n }\n }\n }\n }, false)\n }\n : undefined\n }\n // Apply the header cell props\n {...headerGroup.getHeaderProps()}\n >\n <IsHoveringProvider className=\"th-content\">\n <div className=\"th-label\">\n <span>{headerGroup.headerText}</span>\n {sortingDirection && (\n <StyledIcon\n className=\"th-icon\"\n sortingDirection={sortingDirection}\n color=\"primary\"\n icon=\"arrow_downward\"\n />\n )}\n {headerGroup.filter?.isInvalid ? (\n <Tooltip\n title={\n headerGroup.filter?.validationMessage || ''\n }\n >\n <StyledIcon\n color=\"error\"\n icon=\"warning\"\n className=\"th-icon\"\n />\n </Tooltip>\n ) : headerGroup.filter?.value ? (\n <StyledIcon\n color=\"primary\"\n icon=\"filter_list\"\n className=\"th-icon\"\n />\n ) : null}\n </div>\n <HeaderCellMoreButton\n headerGroup={headerGroup}\n onHide={headerGroup.toggleHidden}\n />\n <div\n {...headerGroup.getResizerProps()}\n className={clsx('resizer', {\n 'is-resizing': headerGroup.isResizing,\n })}\n onClick={(event) => {\n event.stopPropagation()\n }}\n />\n </IsHoveringProvider>\n </div>\n </Tooltip>\n )\n })\n }\n </div>\n </div>\n <div {...getTableBodyProps()} className=\"tbody\">\n {\n // Loop over the table rows\n rows.map((row, index) => {\n if (\n rows[index - 1]?.original.submissionId !==\n row.original.submissionId\n ) {\n alternateBackground = !alternateBackground\n }\n // Prepare the row for display\n prepareRow(row)\n return (\n // Apply the row props\n <div\n {...row.getRowProps()}\n key={row.id}\n className={clsx('tr ob-form-store-table-row', {\n 'ob-form-store-table-row__alternate': alternateBackground,\n })}\n >\n {\n // Loop over the rows cells\n row.cells.map((cell) => {\n // Apply the cell props\n return (\n <IsHoveringProvider\n {...cell.getCellProps()}\n key={cell.column.id}\n className={clsx(\n 'td tc ob-form-store-table-row-cell',\n {\n 'is-resizing': cell.column.isResizing,\n },\n )}\n >\n {\n // Render the cell contents\n cell.render('Cell')\n }\n </IsHoveringProvider>\n )\n })\n }\n </div>\n )\n })\n }\n </div>\n </Table>\n </>\n )\n}\n\n/**\n * @returns\n * @group Components\n */\nexport default React.memo(OneBlinkFormStoreTable)\n"]}
|
@@ -1,10 +1,10 @@
|
|
1
1
|
import * as React from 'react';
|
2
2
|
import { saveAs } from 'file-saver';
|
3
3
|
import { Chip, CircularProgress, Grid } from '@mui/material';
|
4
|
-
import { SaveAlt, AttachFile } from '@mui/icons-material';
|
5
4
|
import ErrorSnackbar from '../../ErrorSnackbar';
|
6
5
|
import { UnorderedList, ListItem } from '../../Lists';
|
7
6
|
import { getCognitoIdToken } from '@oneblink/apps/dist/services/cognito';
|
7
|
+
import MaterialIcon from '../../MaterialIcon';
|
8
8
|
async function fetchFile(url) {
|
9
9
|
const idToken = await getCognitoIdToken();
|
10
10
|
const response = await fetch(url, {
|
@@ -50,7 +50,7 @@ export function FileChip({ file: { fileName, url, data }, }) {
|
|
50
50
|
}
|
51
51
|
}, [data, fileName, url]);
|
52
52
|
return (React.createElement(React.Fragment, null,
|
53
|
-
React.createElement(Chip, { label: fileName, deleteIcon: React.createElement(
|
53
|
+
React.createElement(Chip, { label: fileName, deleteIcon: React.createElement(MaterialIcon, null, "save_alt"), onDelete: handleDownload, variant: "outlined", icon: isDownloading ? (React.createElement(CircularProgress, { size: 16 })) : (React.createElement(MaterialIcon, null, "attach_file")) }),
|
54
54
|
React.createElement(ErrorSnackbar, { open: !!error, onClose: clearError },
|
55
55
|
React.createElement("span", { "data-cypress": "download-legacy-file-error-message" }, error && error.message))));
|
56
56
|
}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"ElementDisplay.js","sourceRoot":"","sources":["../../../../src/components/formStore/display/ElementDisplay.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAC9B,OAAO,EAAE,MAAM,EAAE,MAAM,YAAY,CAAA;AACnC,OAAO,EAAE,IAAI,EAAE,gBAAgB,EAAE,IAAI,EAAE,MAAM,eAAe,CAAA;AAC5D,OAAO,
|
1
|
+
{"version":3,"file":"ElementDisplay.js","s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EAAE,KAAK,EAAE,EAAE;QACzB,OAAO,CACL,oBAAC,IAAI,IAAC,IAAI,QAAC,GAAG,EAAE,KAAK,EAAE,EAAE,EAAE,EAAE;YAC3B,oBAAC,QAAQ,IAAC,IAAI,EAAE,IAAI,GAAI,CACnB,CACR,CAAA;IACH,CAAC,CAAC,CACG,CACR,CAAA;AACH,CAAC;AAED,MAAM,UAAU,sCAAsC,CAAC,EACrD,KAAK,EACL,WAAW,GAIZ;IACC,OAAO,CACL,oBAAC,aAAa,IAAC,cAAc,UAC1B,KAAK,CAAC,GAAG,CAAC,CAAC,SAAS,EAAE,KAAK,EAAE,EAAE;QAC9B,MAAM,KAAK,GAAG,sBAAsB,CAAC,WAAW,EAAE,SAAS,CAAC,CAAA;QAC5D,OAAO,oBAAC,QAAQ,IAAC,GAAG,EAAE,KAAK,IAAG,KAAK,aAAL,KAAK,uBAAL,KAAK,CAAE,QAAQ,EAAE,CAAY,CAAA;IAC7D,CAAC,CAAC,CACY,CACjB,CAAA;AACH,CAAC;AAED,MAAM,UAAU,sBAAsB,CACpC,WAAmC,EACnC,KAAa;IAEb,MAAM,cAAc,GAAG,CAAC,WAAW,CAAC,OAAO,IAAI,EAAE,CAAC,CAAC,IAAI,CACrD,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,CAAC,KAAK,KAAK,KAAK,CAC7B,CAAA;IACD,OAAO,cAAc,CAAC,CAAC,CAAC,cAAc,CAAC,KAAK,CAAC,CAAC,CAAC,KAAK,CAAA;AACtD,CAAC","sourcesContent":["import * as React from 'react'\nimport { saveAs } from 'file-saver'\nimport { Chip, CircularProgress, Grid } from '@mui/material'\nimport ErrorSnackbar from '../../ErrorSnackbar'\nimport { UnorderedList, ListItem } from '../../Lists'\nimport { FormElementWithOptions } from '@oneblink/types/typescript/forms'\nimport { getCognitoIdToken } from '@oneblink/apps/dist/services/cognito'\nimport MaterialIcon from '../../MaterialIcon'\n\nasync function fetchFile(url: string) {\n const idToken = await getCognitoIdToken()\n const response = await fetch(url, {\n headers: {\n Authorization: `Bearer ${idToken}`,\n },\n })\n\n if (!response.ok) {\n throw new Error(\n `Unable to download file. HTTP Status Code: ${response.status}`,\n )\n }\n\n return await response.blob()\n}\n\nexport function FileChip({\n file: { fileName, url, data },\n}: {\n file: {\n fileName: string\n url?: string\n isPrivate?: boolean\n data?: string\n }\n}) {\n const [{ isDownloading, error }, setState] = React.useState<{\n error?: Error\n isDownloading: boolean\n }>({\n isDownloading: false,\n })\n const clearError = React.useCallback(() => {\n setState({\n isDownloading: false,\n })\n }, [])\n const handleDownload = React.useCallback(async () => {\n try {\n setState({\n isDownloading: true,\n })\n\n if (url) {\n const blob = await fetchFile(url)\n saveAs(blob, fileName)\n } else if (data) {\n saveAs(data, fileName)\n }\n\n setState({\n isDownloading: false,\n })\n } catch (error) {\n setState({\n isDownloading: false,\n error: error as Error,\n })\n }\n }, [data, fileName, url])\n return (\n <>\n <Chip\n label={fileName}\n deleteIcon={<MaterialIcon>save_alt</MaterialIcon>}\n onDelete={handleDownload}\n variant=\"outlined\"\n icon={\n isDownloading ? (\n <CircularProgress size={16} />\n ) : (\n <MaterialIcon>attach_file</MaterialIcon>\n )\n }\n />\n <ErrorSnackbar open={!!error} onClose={clearError}>\n <span data-cypress=\"download-legacy-file-error-message\">\n {error && error.message}\n </span>\n </ErrorSnackbar>\n </>\n )\n}\n\nexport function FilesElementDataTableCellContent({\n value,\n}: {\n value: Array<{\n fileName: string\n url?: string | undefined\n isPrivate?: boolean | undefined\n data?: string | undefined\n }>\n}) {\n return (\n <Grid container spacing={1}>\n {value.map((file, index) => {\n return (\n <Grid item key={index} xs={12}>\n <FileChip file={file} />\n </Grid>\n )\n })}\n </Grid>\n )\n}\n\nexport function MultiSelectFormElementTableCellContent({\n value,\n formElement,\n}: {\n value: string[]\n formElement: FormElementWithOptions\n}) {\n return (\n <UnorderedList disablePadding>\n {value.map((selection, index) => {\n const label = getSelectedOptionLabel(formElement, selection)\n return <ListItem key={index}>{label?.toString()}</ListItem>\n })}\n </UnorderedList>\n )\n}\n\nexport function getSelectedOptionLabel(\n formElement: FormElementWithOptions,\n value: string,\n) {\n const selectedOption = (formElement.options || []).find(\n (opt) => opt.value === value,\n )\n return selectedOption ? selectedOption.label : value\n}\n"]}
|
@@ -1,2 +1,3 @@
|
|
1
|
-
import
|
2
|
-
|
1
|
+
import * as React from 'react';
|
2
|
+
import IconComponent from '../../IconComponent';
|
3
|
+
export default function Work({ ...props }: Omit<React.ComponentProps<typeof IconComponent>, 'icon'>): React.JSX.Element;
|
@@ -1,3 +1,6 @@
|
|
1
|
-
import
|
2
|
-
|
1
|
+
import * as React from 'react';
|
2
|
+
import IconComponent from '../../IconComponent';
|
3
|
+
export default function Work({ ...props }) {
|
4
|
+
return React.createElement(IconComponent, { ...props, icon: "work" });
|
5
|
+
}
|
3
6
|
//# sourceMappingURL=FormStoreIcon.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"FormStoreIcon.js","sourceRoot":"","sources":["../../../../src/components/formStore/display/FormStoreIcon.tsx"],"names":[],"mappings":"AAAA,OAAO,
|
1
|
+
{"version":3,"file":"FormStoreIcon.js","sourceRoot":"","sources":["../../../../src/components/formStore/display/FormStoreIcon.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAC9B,OAAO,aAAa,MAAM,qBAAqB,CAAA;AAC/C,MAAM,CAAC,OAAO,UAAU,IAAI,CAAC,EAC3B,GAAG,KAAK,EACiD;IACzD,OAAO,oBAAC,aAAa,OAAK,KAAK,EAAE,IAAI,EAAC,MAAM,GAAG,CAAA;AACjD,CAAC","sourcesContent":["import * as React from 'react'\nimport IconComponent from '../../IconComponent'\nexport default function Work({\n ...props\n}: Omit<React.ComponentProps<typeof IconComponent>, 'icon'>) {\n return <IconComponent {...props} icon=\"work\" />\n}\n"]}
|
@@ -1,8 +1,8 @@
|
|
1
1
|
import * as React from 'react';
|
2
2
|
import { userService } from '@oneblink/sdk-core';
|
3
3
|
import { Chip, Avatar } from '@mui/material';
|
4
|
-
import { AccountCircle, VpnKey as KeyIcon, Help as HelpIcon, } from '@mui/icons-material';
|
5
4
|
import TableCellCopyButton from './TableCellCopyButton';
|
5
|
+
import MaterialIcon from '../../MaterialIcon';
|
6
6
|
function ActionedByTableCell({ userProfile, developerKey, ...rest }) {
|
7
7
|
const chipProps = useActionedByChipProps({
|
8
8
|
userProfile,
|
@@ -24,19 +24,19 @@ function useActionedByChipProps({ userProfile, developerKey, }) {
|
|
24
24
|
emptyChipProps.avatar = (React.createElement(Avatar, { alt: userProfile.fullName, src: userProfile.picture }));
|
25
25
|
}
|
26
26
|
else {
|
27
|
-
emptyChipProps.icon = React.createElement(
|
27
|
+
emptyChipProps.icon = React.createElement(MaterialIcon, null, "account_circle");
|
28
28
|
}
|
29
29
|
emptyChipProps.label = userService.getUserFriendlyName(userProfile);
|
30
30
|
return emptyChipProps;
|
31
31
|
}
|
32
32
|
if (developerKey) {
|
33
33
|
return {
|
34
|
-
icon: React.createElement(
|
34
|
+
icon: React.createElement(MaterialIcon, null, "vpn_key"),
|
35
35
|
label: developerKey.name,
|
36
36
|
};
|
37
37
|
}
|
38
38
|
return {
|
39
|
-
icon: React.createElement(
|
39
|
+
icon: React.createElement(MaterialIcon, null, "help"),
|
40
40
|
label: 'Anonymous',
|
41
41
|
};
|
42
42
|
}, [developerKey, userProfile]);
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"ActionedByTableCell.js","sourceRoot":"","sources":["../../../../src/components/formStore/table/ActionedByTableCell.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAC9B,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAA;AAEhD,OAAO,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,eAAe,CAAA;AAC5C,OAAO,
|
1
|
+
{"version":3,"file":"ActionedByTableCell.js","sourceRoot":"","sources":["../../../../src/components/formStore/table/ActionedByTableCell.ts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AE,oBAAC,YAAY,kBAAuB;gBAC1C,KAAK,EAAE,YAAY,CAAC,IAAI;aACzB,CAAA;SACF;QAED,OAAO;YACL,IAAI,EAAE,oBAAC,YAAY,eAAoB;YACvC,KAAK,EAAE,WAAW;SACnB,CAAA;IACH,CAAC,EAAE,CAAC,YAAY,EAAE,WAAW,CAAC,CAAC,CAAA;AACjC,CAAC","sourcesContent":["import * as React from 'react'\nimport { userService } from '@oneblink/sdk-core'\nimport { UserProfile } from '@oneblink/types/typescript/misc'\nimport { Chip, Avatar } from '@mui/material'\nimport TableCellCopyButton from './TableCellCopyButton'\nimport MaterialIcon from '../../MaterialIcon'\n\nfunction ActionedByTableCell({\n userProfile,\n developerKey,\n ...rest\n}: React.ComponentProps<typeof Chip> & {\n userProfile?: UserProfile\n developerKey?: { name: string }\n}) {\n const chipProps = useActionedByChipProps({\n userProfile,\n developerKey,\n ...rest,\n })\n\n return (\n <>\n <Chip {...chipProps} {...rest} />\n <TableCellCopyButton text={chipProps.label} />\n </>\n )\n}\n\nexport default React.memo(ActionedByTableCell)\n\nfunction useActionedByChipProps({\n userProfile,\n developerKey,\n}: React.ComponentProps<typeof Chip> & {\n userProfile?: UserProfile\n developerKey?: { name: string }\n}): {\n label: string\n icon?: React.ComponentProps<typeof Chip>['icon']\n avatar?: React.ComponentProps<typeof Chip>['avatar']\n} {\n return React.useMemo(() => {\n if (userProfile) {\n const emptyChipProps: {\n label: string\n icon?: React.ComponentProps<typeof Chip>['icon']\n avatar?: React.ComponentProps<typeof Chip>['avatar']\n } = {\n label: '',\n }\n\n if (userProfile.picture) {\n emptyChipProps.avatar = (\n <Avatar alt={userProfile.fullName} src={userProfile.picture} />\n )\n } else {\n emptyChipProps.icon = <MaterialIcon>account_circle</MaterialIcon>\n }\n\n emptyChipProps.label = userService.getUserFriendlyName(userProfile)\n return emptyChipProps\n }\n\n if (developerKey) {\n return {\n icon: <MaterialIcon>vpn_key</MaterialIcon>,\n label: developerKey.name,\n }\n }\n\n return {\n icon: <MaterialIcon>help</MaterialIcon>,\n label: 'Anonymous',\n }\n }, [developerKey, userProfile])\n}\n"]}
|
@@ -1,13 +1,16 @@
|
|
1
1
|
import * as React from 'react';
|
2
|
-
import { Box, Button, Divider, Grid, IconButton, Popover, } from '@mui/material';
|
3
|
-
import
|
4
|
-
import { FilterList as FilterListIcon, MoreVert as MoreVertIcon, VisibilityOff as VisibilityOffIcon, } from '@mui/icons-material';
|
2
|
+
import { Box, Button, Divider, Grid, IconButton, Popover, styled, } from '@mui/material';
|
3
|
+
import MaterialIcon from '../../MaterialIcon';
|
5
4
|
import { useIsHovering } from '../../../hooks/useIsHovering';
|
6
5
|
import useNullableState from '../../../hooks/useNullableState';
|
7
6
|
import ColumnFilters from './ColumnFilters';
|
8
7
|
const StyledIconButton = styled(IconButton)(({ theme }) => ({
|
9
8
|
margin: theme.spacing(-1, -1, -1, 1),
|
10
9
|
}));
|
10
|
+
const StyledMoreVert = styled(MaterialIcon)(({ theme, color }) => ({
|
11
|
+
fontSize: theme.typography.h6.fontSize + '!important',
|
12
|
+
color: theme.palette.action[color],
|
13
|
+
}));
|
11
14
|
const paperStyles = {
|
12
15
|
maxWidth: 500,
|
13
16
|
};
|
@@ -19,7 +22,7 @@ function HeaderCellMoreButton({ headerGroup, onHide, }) {
|
|
19
22
|
event.stopPropagation();
|
20
23
|
setAnchorEl(event.currentTarget);
|
21
24
|
} },
|
22
|
-
React.createElement(
|
25
|
+
React.createElement(StyledMoreVert, { color: isHovering ? 'active' : 'disabled' }, "more_vert")),
|
23
26
|
React.createElement(Popover, { open: !!anchorEl, anchorEl: anchorEl, onClose: (event) => {
|
24
27
|
event.stopPropagation();
|
25
28
|
clearAnchorEl();
|
@@ -41,9 +44,9 @@ function HeaderCellMoreButton({ headerGroup, onHide, }) {
|
|
41
44
|
React.createElement(Box, { paddingX: 2, paddingY: 1 },
|
42
45
|
React.createElement(Grid, { container: true, justifyContent: "flex-end", spacing: 1 },
|
43
46
|
headerGroup.filter && (React.createElement(Grid, { item: true },
|
44
|
-
React.createElement(Button, { variant: "outlined", disabled: headerGroup.filter.value === undefined, onClick: () => { var _a; return (_a = headerGroup.filter) === null || _a === void 0 ? void 0 : _a.onChange(undefined, false); }, size: "small", startIcon: React.createElement(
|
47
|
+
React.createElement(Button, { variant: "outlined", disabled: headerGroup.filter.value === undefined, onClick: () => { var _a; return (_a = headerGroup.filter) === null || _a === void 0 ? void 0 : _a.onChange(undefined, false); }, size: "small", startIcon: React.createElement(MaterialIcon, null, "filter_list") }, "Clear"))),
|
45
48
|
React.createElement(Grid, { item: true },
|
46
|
-
React.createElement(Button, { variant: "outlined", onClick: onHide, size: "small", startIcon: React.createElement(
|
49
|
+
React.createElement(Button, { variant: "outlined", onClick: onHide, size: "small", startIcon: React.createElement(MaterialIcon, null, "visibility_off") }, "Hide")))))));
|
47
50
|
}
|
48
51
|
export default React.memo(HeaderCellMoreButton);
|
49
52
|
//# sourceMappingURL=HeaderCellMoreButton.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"HeaderCellMoreButton.js","sourceRoot":"","sources":["../../../../src/components/formStore/table/HeaderCellMoreButton.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAE9B,OAAO,EACL,GAAG,EACH,MAAM,EACN,OAAO,EACP,IAAI,EACJ,UAAU,EACV,OAAO,
|
1
|
+
{"version":3,"file":"HeaderCellMoreButton.js","sourceRoot":"","sources":["../../../../src/components/formStore/table/HeaderCellMoreButton.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAE9B,OAAO,EACL,GAAG,EACH,MAAM,EACN,OAAO,EACP,IAAI,EACJ,UAAU,EACV,OAAO,EAEP,MAAM,GAEP,MAAM,eAAe,CAAA;AACtB,OAAO,YAAY,MAAM,oBAAoB,CAAA;AAC7C,OAAO,EAAE,aAAa,EAAE,MAAM,8BAA8B,CAAA;AAC5D,OAAO,gBAAgB,MAAM,i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,YAAY,yBAA8B,WAG/C,CACJ,CACF,CACH,CACE,CACL,CACR,CAAA;AACH,CAAC;AAED,eAAe,KAAK,CAAC,IAAI,CAAC,oBAAoB,CAAC,CAAA","sourcesContent":["import * as React from 'react'\nimport { HeaderGroup } from 'react-table'\nimport {\n Box,\n Button,\n Divider,\n Grid,\n IconButton,\n Popover,\n SxProps,\n styled,\n TypeAction,\n} from '@mui/material'\nimport MaterialIcon from '../../MaterialIcon'\nimport { useIsHovering } from '../../../hooks/useIsHovering'\nimport useNullableState from '../../../hooks/useNullableState'\nimport ColumnFilters from './ColumnFilters'\nimport { FormStoreRecord } from '@oneblink/types/typescript/submissions'\n\nconst StyledIconButton = styled(IconButton)(({ theme }) => ({\n margin: theme.spacing(-1, -1, -1, 1),\n}))\n\nconst StyledMoreVert = styled(MaterialIcon)<{\n color: Extract<keyof TypeAction, 'active' | 'disabled'>\n}>(({ theme, color }) => ({\n fontSize: theme.typography.h6.fontSize + '!important',\n color: theme.palette.action[color],\n}))\n\nconst paperStyles: SxProps = {\n maxWidth: 500,\n}\n\nfunction HeaderCellMoreButton({\n headerGroup,\n onHide,\n}: {\n headerGroup: HeaderGroup<FormStoreRecord>\n onHide: () => void\n}) {\n const isHovering = useIsHovering()\n const [anchorEl, setAnchorEl, clearAnchorEl] =\n useNullableState<HTMLButtonElement>(null)\n\n return (\n <span>\n <StyledIconButton\n color=\"inherit\"\n onClick={(event) => {\n event.stopPropagation()\n setAnchorEl(event.currentTarget)\n }}\n >\n <StyledMoreVert color={isHovering ? 'active' : 'disabled'}>\n more_vert\n </StyledMoreVert>\n </StyledIconButton>\n <Popover\n open={!!anchorEl}\n anchorEl={anchorEl}\n onClose={(event: React.MouseEvent) => {\n event.stopPropagation()\n clearAnchorEl()\n }}\n anchorOrigin={{\n vertical: 'bottom',\n horizontal: 'right',\n }}\n transformOrigin={{\n vertical: 'top',\n horizontal: 'right',\n }}\n PaperProps={{\n sx: paperStyles,\n }}\n onClick={(event) => {\n event.stopPropagation()\n }}\n >\n {headerGroup.filter && (\n <>\n <Box padding={2}>\n <ColumnFilters filter={headerGroup.filter} />\n </Box>\n <Divider />\n </>\n )}\n <Box paddingX={2} paddingY={1}>\n <Grid container justifyContent=\"flex-end\" spacing={1}>\n {headerGroup.filter && (\n <Grid item>\n <Button\n variant=\"outlined\"\n disabled={headerGroup.filter.value === undefined}\n onClick={() => headerGroup.filter?.onChange(undefined, false)}\n size=\"small\"\n startIcon={<MaterialIcon>filter_list</MaterialIcon>}\n >\n Clear\n </Button>\n </Grid>\n )}\n <Grid item>\n <Button\n variant=\"outlined\"\n onClick={onHide}\n size=\"small\"\n startIcon={<MaterialIcon>visibility_off</MaterialIcon>}\n >\n Hide\n </Button>\n </Grid>\n </Grid>\n </Box>\n </Popover>\n </span>\n )\n}\n\nexport default React.memo(HeaderCellMoreButton)\n"]}
|
@@ -1,10 +1,10 @@
|
|
1
1
|
import * as React from 'react';
|
2
2
|
import { CustomAccordion, CustomAccordionSummary, CustomAccordionDetails, } from '../../CustomAccordion';
|
3
3
|
import { Typography } from '@mui/material';
|
4
|
-
import
|
4
|
+
import MaterialIcon from '../../MaterialIcon';
|
5
5
|
const RepeatableSetCell = ({ isOpen, onChange, title, children }) => {
|
6
6
|
return (React.createElement(CustomAccordion, { expanded: isOpen, onChange: onChange, "data-cypress": "form-store-repeatable-set-cell-accordion" },
|
7
|
-
React.createElement(CustomAccordionSummary, { expandIcon: React.createElement(
|
7
|
+
React.createElement(CustomAccordionSummary, { expandIcon: React.createElement(MaterialIcon, null, "expand_more"), "data-cypress": "form-store-repeatable-set-cell-accordion-summary" },
|
8
8
|
React.createElement(Typography, null, title)),
|
9
9
|
React.createElement(CustomAccordionDetails, null, children)));
|
10
10
|
};
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"RepeatableSetCellAccordion.js","sourceRoot":"","sources":["../../../../src/components/formStore/table/RepeatableSetCellAccordion.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAC9B,OAAO,EACL,eAAe,EACf,sBAAsB,EACtB,sBAAsB,GACvB,MAAM,uBAAuB,CAAA;AAC9B,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAA;AAC1C,OAAO,
|
1
|
+
{"version":3,"file":"RepeatableSetCellAccordion.js","sourceRoot":"","sources":["../../../../src/components/formStore/table/RepeatableSetCellAccordion.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAC9B,OAAO,EACL,eAAe,EACf,sBAAsB,EACtB,sBAAsB,GACvB,MAAM,uBAAuB,CAAA;AAC9B,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAA;AAC1C,OAAO,YAAY,MAAM,oBAAoB,CAAA;AAS7C,MAAM,iBAAiB,GAAG,CAAC,EAAE,MAAM,EAAE,QAAQ,EAAE,KAAK,EAAE,QAAQ,EAAS,EAAE,EAAE;IACzE,OAAO,CACL,oBAAC,eAAe,IACd,QAAQ,EAAE,MAAM,EAChB,QAAQ,EAAE,QAAQ,kBACL,0CAA0C;QAEvD,oBAAC,sBAAsB,IACrB,UAAU,EAAE,oBAAC,YAAY,sBAA2B,kBACvC,kDAAkD;YAE/D,oBAAC,UAAU,QAAE,KAAK,CAAc,CACT;QACzB,oBAAC,sBAAsB,QAAE,QAAQ,CAA0B,CAC3C,CACnB,CAAA;AACH,CAAC,CAAA;AAED,eAAe,KAAK,CAAC,IAAI,CAAQ,iBAAiB,CAAC,CAAA","sourcesContent":["import * as React from 'react'\nimport {\n CustomAccordion,\n CustomAccordionSummary,\n CustomAccordionDetails,\n} from '../../CustomAccordion'\nimport { Typography } from '@mui/material'\nimport MaterialIcon from '../../MaterialIcon'\n\ntype Props = {\n isOpen: boolean\n onChange: () => void\n title: string\n children: React.ReactNode\n}\n\nconst RepeatableSetCell = ({ isOpen, onChange, title, children }: Props) => {\n return (\n <CustomAccordion\n expanded={isOpen}\n onChange={onChange}\n data-cypress=\"form-store-repeatable-set-cell-accordion\"\n >\n <CustomAccordionSummary\n expandIcon={<MaterialIcon>expand_more</MaterialIcon>}\n data-cypress=\"form-store-repeatable-set-cell-accordion-summary\"\n >\n <Typography>{title}</Typography>\n </CustomAccordionSummary>\n <CustomAccordionDetails>{children}</CustomAccordionDetails>\n </CustomAccordion>\n )\n}\n\nexport default React.memo<Props>(RepeatableSetCell)\n"]}
|
@@ -1,7 +1,8 @@
|
|
1
1
|
import * as React from 'react';
|
2
|
-
import ErrorIcon from '@mui/icons-material/Error';
|
3
2
|
import LargeIconMessage from './LargeIconMessage';
|
4
3
|
import { Button } from '@mui/material';
|
4
|
+
import IconComponent from '../IconComponent';
|
5
|
+
const ErrorIcon = (props) => React.createElement(IconComponent, { ...props, icon: "error" });
|
5
6
|
function ErrorMessage({ title, children, gutterTop, gutterBottom, IconComponent, onTryAgain, }) {
|
6
7
|
if (!IconComponent) {
|
7
8
|
IconComponent = ErrorIcon;
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"ErrorMessage.js","sourceRoot":"","sources":["../../../src/components/messages/ErrorMessage.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAC9B,OAAO,
|
1
|
+
{"version":3,"file":"ErrorMessage.js","sourceRoot":"","sources":["../../../src/components/messages/ErrorMessage.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAC9B,OAAO,gBAEN,MAAM,oBAAoB,CAAA;AAC3B,OAAO,EAAE,MAAM,EAAE,MAAM,eAAe,CAAA;AACtC,OAAO,aAAa,MAAM,kBAAkB,CAAA;AAU5C,MAAM,SAAS,GAAG,CAChB,KAA+D,EAC/D,EAAE,CAAC,oBAAC,aAAa,OAAK,KAAK,EAAE,IAAI,EAAC,OAAO,GAAG,CAAA;AAE9C,SAAS,YAAY,CAAC,EACpB,KAAK,EACL,QAAQ,EACR,SAAS,EACT,YAAY,EACZ,aAAa,EACb,UAAU,GACJ;IACN,IAAI,CAAC,aAAa,EAAE;QAClB,aAAa,GAAG,SAAS,CAAA;KAC1B;IAED,OAAO,CACL;QACE,oBAAC,gBAAgB,IACf,aAAa,EAAE,aAAa,EAC5B,KAAK,EAAE,KAAK,EACZ,OAAO,EAAC,OAAO,EACf,SAAS,EAAE,SAAS,EACpB,YAAY,EAAE,YAAY,EAC1B,MAAM,EACJ,UAAU,IAAI,CACZ,oBAAC,MAAM,IACL,OAAO,EAAC,UAAU,EAClB,KAAK,EAAC,SAAS,EACf,OAAO,EAAE,GAAG,EAAE,CAAC,UAAU,EAAE,kBACd,wBAAwB,gBAG9B,CACV,EAEH,SAAS,EAAC,mBAAmB,IAE5B,QAAQ,CACQ,CAClB,CACJ,CAAA;AACH,CAAC;AAED,eAAe,KAAK,CAAC,IAAI,CAAQ,YAAY,CAAC,CAAA","sourcesContent":["import * as React from 'react'\nimport LargeIconMessage, {\n Props as LargeIconMessageProps,\n} from './LargeIconMessage'\nimport { Button } from '@mui/material'\nimport IconComponent from '../IconComponent'\ntype Props = {\n IconComponent?: LargeIconMessageProps['IconComponent']\n title: string\n gutterTop?: boolean\n gutterBottom?: boolean\n children?: React.ReactNode\n onTryAgain?: () => void\n}\n\nconst ErrorIcon = (\n props: Omit<React.ComponentProps<typeof IconComponent>, 'icon'>,\n) => <IconComponent {...props} icon=\"error\" />\n\nfunction ErrorMessage({\n title,\n children,\n gutterTop,\n gutterBottom,\n IconComponent,\n onTryAgain,\n}: Props) {\n if (!IconComponent) {\n IconComponent = ErrorIcon\n }\n\n return (\n <>\n <LargeIconMessage\n IconComponent={IconComponent}\n title={title}\n variant=\"error\"\n gutterTop={gutterTop}\n gutterBottom={gutterBottom}\n action={\n onTryAgain && (\n <Button\n variant=\"outlined\"\n color=\"primary\"\n onClick={() => onTryAgain()}\n data-cypress=\"error-try-again-button\"\n >\n Try Again\n </Button>\n )\n }\n className=\"ob-error-snackbar\"\n >\n {children}\n </LargeIconMessage>\n </>\n )\n}\n\nexport default React.memo<Props>(ErrorMessage)\n"]}
|
@@ -1,13 +1,13 @@
|
|
1
1
|
import * as React from 'react';
|
2
2
|
import { CommonProps } from '@mui/material/OverridableComponent';
|
3
|
-
|
3
|
+
import { Color } from '../../types/mui-color';
|
4
4
|
export type Props = {
|
5
5
|
IconComponent: React.ComponentType<{
|
6
|
-
color:
|
6
|
+
color: Color;
|
7
7
|
style: React.CSSProperties;
|
8
8
|
}>;
|
9
9
|
title: string;
|
10
|
-
variant:
|
10
|
+
variant: Color;
|
11
11
|
gutterTop?: boolean;
|
12
12
|
gutterBottom?: boolean;
|
13
13
|
children?: React.ReactNode;
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"LargeIconMessage.js","sourceRoot":"","sources":["../../../src/components/messages/LargeIconMessage.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAC9B,OAAO,EAAE,UAAU,EAAE,IAAI,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,EAAE,MAAM,eAAe,CAAA;AAkB7E,SAAS,gBAAgB,CAAC,EACxB,aAAa,EACb,KAAK,EACL,OAAO,EACP,SAAS,EACT,YAAY,EACZ,QAAQ,EACR,MAAM,EACN,SAAS,GACH;IACN,MAAM,KAAK,GAAG,QAAQ,EAAE,CAAA;IAExB,MAAM,QAAQ,GAAG,KAAK,CAAC,OAAO,CAAC,GAAG,EAAE,CAAC,KAAK,CAAC,OAAO,CAAC,EAAE,CAAC,EAAE,CAAC,KAAK,CAAC,CAAC,CAAA;IAEhE,OAAO,CACL,oBAAC,SAAS,IAAC,QAAQ,EAAC,IAAI,EAAC,SAAS,EAAE,SAAS,IAAI,uBAAuB;QACtE,oBAAC,mBAAmB,IAAC,SAAS,EAAE,SAAS;YACvC,oBAAC,aAAa,IAAC,KAAK,EAAE,OAAO,EAAE,KAAK,EAAE,EAAE,QAAQ,EAAE,GAAI,CAClC;QACtB,oBAAC,UAAU,IACT,OAAO,EAAC,IAAI,EACZ,KAAK,EAAC,Q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AEH,MAAM,UAAU,GAAG,MAAM,CAAC,IAAI,EAAE;IAC9B,iBAAiB,EAAE,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,KAAK,cAAc;CACrD,CAAC,CAA6B,CAAC,EAAE,KAAK,EAAE,YAAY,EAAE,EAAE,EAAE,CAAC,CAAC;IAC3D,GAAG,CAAC,YAAY,CAAC,CAAC,CAAC,EAAE,YAAY,EAAE,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;CAC5D,CAAC,CAAC,CAAA","sourcesContent":["import * as React from 'react'\nimport { Typography, Grid, Container, useTheme, styled } from '@mui/material'\nimport { CommonProps } from '@mui/material/OverridableComponent'\
|
1
|
+
{"version":3,"file":"LargeIconMessage.js","sourceRoot":"","sources":["../../../src/components/messages/LargeIconMessage.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAC9B,OAAO,EAAE,UAAU,EAAE,IAAI,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,EAAE,MAAM,eAAe,CAAA;AAkB7E,SAAS,gBAAgB,CAAC,EACxB,aAAa,EACb,KAAK,EACL,OAAO,EACP,SAAS,EACT,YAAY,EACZ,QAAQ,EACR,MAAM,EACN,SAAS,GACH;IACN,MAAM,KAAK,GAAG,QAAQ,EAAE,CAAA;IAExB,MAAM,QAAQ,GAAG,KAAK,CAAC,OAAO,CAAC,GAAG,EAAE,CAAC,KAAK,CAAC,OAAO,CAAC,EAAE,CAAC,EAAE,CAAC,KAAK,CAAC,CAAC,CAAA;IAEhE,OAAO,CACL,oBAAC,SAAS,IAAC,QAAQ,EAAC,IAAI,EAAC,SAAS,EAAE,SAAS,IAAI,uBAAuB;QACtE,oBAAC,mBAAmB,IAAC,SAAS,EAAE,SAAS;YACvC,oBAAC,aAAa,IAAC,KAAK,EAAE,OAAO,EAAE,KAAK,EAAE,EAAE,QAAQ,EAAE,GAAI,CAClC;QACtB,oBAA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CAAC,CAAC,EAAE,CAAC;CAC5D,CAAC,CAAC,CAAA;AAEH,MAAM,UAAU,GAAG,MAAM,CAAC,IAAI,EAAE;IAC9B,iBAAiB,EAAE,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,KAAK,cAAc;CACrD,CAAC,CAA6B,CAAC,EAAE,KAAK,EAAE,YAAY,EAAE,EAAE,EAAE,CAAC,CAAC;IAC3D,GAAG,CAAC,YAAY,CAAC,CAAC,CAAC,EAAE,YAAY,EAAE,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;CAC5D,CAAC,CAAC,CAAA","sourcesContent":["import * as React from 'react'\nimport { Typography, Grid, Container, useTheme, styled } from '@mui/material'\nimport { CommonProps } from '@mui/material/OverridableComponent'\nimport { Color } from '../../types/mui-color'\n\nexport type Props = {\n IconComponent: React.ComponentType<{\n color: Color\n style: React.CSSProperties\n }>\n title: string\n variant: Color\n gutterTop?: boolean\n gutterBottom?: boolean\n children?: React.ReactNode\n action?: React.ReactNode\n className?: CommonProps['className']\n}\n\nfunction LargeIconMessage({\n IconComponent,\n title,\n variant,\n gutterTop,\n gutterBottom,\n children,\n action,\n className,\n}: Props) {\n const theme = useTheme()\n\n const fontSize = React.useMemo(() => theme.spacing(16), [theme])\n\n return (\n <Container maxWidth=\"sm\" className={className || 'ob-large-icon-message'}>\n <StyledIconContainer gutterTop={gutterTop}>\n <IconComponent color={variant} style={{ fontSize }} />\n </StyledIconContainer>\n <Typography\n variant=\"h5\"\n align=\"center\"\n gutterBottom\n color={`${variant}.main`}\n >\n {title}\n </Typography>\n {children ? (\n <StyledTypography\n align=\"center\"\n variant=\"body2\"\n paragraph={!!action}\n gutterBottom={!action && gutterBottom}\n >\n {children}\n </StyledTypography>\n ) : null}\n {action && (\n <StyledGrid\n container\n justifyContent=\"center\"\n gutterBottom={gutterBottom}\n >\n {action}\n </StyledGrid>\n )}\n </Container>\n )\n}\n\nexport default React.memo<Props>(LargeIconMessage)\n\nconst StyledIconContainer = styled('div', {\n shouldForwardProp: (prop) => prop !== 'gutterTop',\n})<{\n gutterTop?: boolean\n}>(({ theme, gutterTop }) => ({\n textAlign: 'center',\n ...(gutterTop\n ? {\n paddingTop: theme.spacing(4),\n }\n : {}),\n}))\n\nconst StyledTypography = styled(Typography, {\n shouldForwardProp: (prop) => prop !== 'gutterBottom',\n})<React.ComponentProps<typeof Typography>>(({ theme, gutterBottom }) => ({\n ...(gutterBottom ? { marginBottom: theme.spacing(4) } : {}),\n}))\n\nconst StyledGrid = styled(Grid, {\n shouldForwardProp: (prop) => prop !== 'gutterBottom',\n})<{ gutterBottom?: boolean }>(({ theme, gutterBottom }) => ({\n ...(gutterBottom ? { marginBottom: theme.spacing(4) } : {}),\n}))\n"]}
|
@@ -4,6 +4,7 @@ import WestpacQuickStreamPaymentForm from './WestpacQuickStreamPaymentForm';
|
|
4
4
|
import useQuery from '../../hooks/useQuery';
|
5
5
|
import useLoadDataState from '../../hooks/useLoadDataState';
|
6
6
|
import OnLoading from '../renderer/OnLoading';
|
7
|
+
import MaterialIcon from '../MaterialIcon';
|
7
8
|
function PaymentForm({ captchaSiteKey, onCompleted, onCancelled, appImageUrl, title, }) {
|
8
9
|
const query = useQuery();
|
9
10
|
const loadPaymentFormConfiguration = React.useCallback(async (abortSignal) => {
|
@@ -50,7 +51,7 @@ function PaymentForm({ captchaSiteKey, onCompleted, onCancelled, appImageUrl, ti
|
|
50
51
|
case 'ERROR': {
|
51
52
|
return (React.createElement("section", { className: "cypress-payment-form-loading-error-message" },
|
52
53
|
React.createElement("div", { className: "ob-payment-form__error-icon-container has-text-centered has-margin-bottom-8" },
|
53
|
-
React.createElement(
|
54
|
+
React.createElement(MaterialIcon, { className: "ob-payment-form__error-icon has-text-danger icon-x-large" }, "error")),
|
54
55
|
React.createElement("p", { className: "ob-payment-form__error-message has-text-centered has-margin-bottom-4" }, state.error.message)));
|
55
56
|
}
|
56
57
|
case 'SUCCESS': {
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"PaymentForm.js","sourceRoot":"","sources":["../../../src/components/payments/PaymentForm.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAA;AAE/C,OAAO,KAAK,MAAM,OAAO,CAAA;AACzB,OAAO,6BAA6B,MAAM,iCAAiC,CAAA;AAC3E,OAAO,QAAQ,MAAM,sBAAsB,CAAA;AAC3C,OAAO,gBAAgB,MAAM,8BAA8B,CAAA;AAC3D,OAAO,SAAS,MAAM,uBAAuB,CAAA;
|
1
|
+
{"version":3,"file":"PaymentForm.js","sourceRoot":"","sources":["../../../src/components/payments/PaymentForm.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAA;AAE/C,OAAO,KAAK,MAAM,OAAO,CAAA;AACzB,OAAO,6BAA6B,MAAM,iCAAiC,CAAA;AAC3E,OAAO,QAAQ,MAAM,sBAAsB,CAAA;AAC3C,OAAO,gBAAgB,MAAM,8BAA8B,CAAA;AAC3D,OAAO,SAAS,MAAM,uBAAuB,CAAA;AAC7C,OAAO,YAAY,MAAM,iBAAiB,CAAA;AAE1C,SAAS,WAAW,CAAC,EACnB,cAAc,EACd,WAAW,EACX,WAAW,EACX,WAAW,EACX,KAAK,GAUN;IACC,MAAM,KAAK,GAAG,QAAQ,EAAE,CAAA;IAExB,MAAM,4BAA4B,GAAG,KAAK,CAAC,WAAW,CACpD,KAAK,EAAE,WAAwB,EAAE,EAAE;QACjC,MAAM,uBAAuB,GAAG,KAAK,CAAC,uBAAuB,CAAA;QAC7D,IAAI,OAAO,uBAAuB,KAAK,QAAQ,EAAE;YAC/C,MAAM,IAAI,KAAK,CACb,8DAA8D,CAC/D,CAAA;SACF;QAED,MAAM,EAAE,oBAAoB,EAAE,sBAAsB,EAAE,GACpD,MAAM,cAAc,CAAC,8BAA8B,EAAE,CAAA;QACvD,QAAQ,sBAAsB,CAAC,IAAI,EAAE;Y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;YACZ,OAAO,CACL,iCAAS,SAAS,EAAC,4CAA4C;gBAC7D,6BAAK,SAAS,EAAC,6EAA6E;oBAC1F,oBAAC,YAAY,IAAC,SAAS,EAAC,0DAA0D,YAEnE,CACX;gBACN,2BAAG,SAAS,EAAC,sEAAsE,IAChF,KAAK,CAAC,KAAK,CAAC,OAAO,CAClB,CACI,CACX,CAAA;SACF;QACD,KAAK,SAAS,CAAC,CAAC;YACd,OAAO,KAAK,CAAC,MAAM,CAAC,iBAAiB,EAAE,CAAA;SACxC;KACF;AACH,CAAC;AAED,eAAe,KAAK,CAAC,IAAI,CAAC,WAAW,CAAC,CAAA","sourcesContent":["import { paymentService } from '@oneblink/apps'\nimport { SubmissionTypes } from '@oneblink/types'\nimport React from 'react'\nimport WestpacQuickStreamPaymentForm from './WestpacQuickStreamPaymentForm'\nimport useQuery from '../../hooks/useQuery'\nimport useLoadDataState from '../../hooks/useLoadDataState'\nimport OnLoading from '../renderer/OnLoading'\nimport MaterialIcon from '../MaterialIcon'\n\nfunction PaymentForm({\n captchaSiteKey,\n onCompleted,\n onCancelled,\n appImageUrl,\n title,\n}: {\n captchaSiteKey: string\n onCompleted: (result: {\n formSubmissionPayment: SubmissionTypes.FormSubmissionPayment\n paymentReceiptUrl: string\n }) => void\n onCancelled: (result: { paymentReceiptUrl: string }) => void\n appImageUrl?: string\n title?: string\n}) {\n const query = useQuery()\n\n const loadPaymentFormConfiguration = React.useCallback(\n async (abortSignal: AbortSignal) => {\n const formSubmissionPaymentId = query.formSubmissionPaymentId\n if (typeof formSubmissionPaymentId !== 'string') {\n throw new Error(\n 'It looks like you are attempting to make an unknown payment.',\n )\n }\n\n const { formSubmissionResult, paymentSubmissionEvent } =\n await paymentService.getFormSubmissionResultPayment()\n switch (paymentSubmissionEvent.type) {\n case 'BPOINT':\n case 'CP_PAY':\n case 'NSW_GOV_PAY':\n case 'WESTPAC_QUICK_WEB': {\n throw new Error(\n `\"${paymentSubmissionEvent.type}\" payment events do not support a custom payment form.`,\n )\n }\n case 'WESTPAC_QUICK_STREAM': {\n const { supplierBusinessCode, publishableApiKey, isTestMode } =\n await paymentService.westpacQuickStream.getPaymentFormConfiguration(\n {\n formSubmissionPaymentId,\n formSubmissionResult,\n paymentSubmissionEvent,\n abortSignal,\n },\n )\n return {\n renderPaymentForm: () => (\n <WestpacQuickStreamPaymentForm\n formSubmissionResult={formSubmissionResult}\n paymentSubmissionEvent={paymentSubmissionEvent}\n formSubmissionPaymentId={formSubmissionPaymentId}\n supplierBusinessCode={supplierBusinessCode}\n publishableApiKey={publishableApiKey}\n isTestMode={isTestMode}\n captchaSiteKey={captchaSiteKey}\n onCompleted={onCompleted}\n onCancelled={onCancelled}\n appImageUrl={appImageUrl}\n title={title}\n />\n ),\n }\n }\n }\n },\n [\n appImageUrl,\n captchaSiteKey,\n onCancelled,\n onCompleted,\n query.formSubmissionPaymentId,\n title,\n ],\n )\n\n const [state] = useLoadDataState(loadPaymentFormConfiguration)\n\n switch (state.status) {\n case 'LOADING': {\n return (\n <section>\n <div className=\"cypress-loading has-text-centered\">\n <OnLoading className=\"has-text-centered\"></OnLoading>\n <span>Loading payment configuration...</span>\n </div>\n </section>\n )\n }\n case 'ERROR': {\n return (\n <section className=\"cypress-payment-form-loading-error-message\">\n <div className=\"ob-payment-form__error-icon-container has-text-centered has-margin-bottom-8\">\n <MaterialIcon className=\"ob-payment-form__error-icon has-text-danger icon-x-large\">\n error\n </MaterialIcon>\n </div>\n <p className=\"ob-payment-form__error-message has-text-centered has-margin-bottom-4\">\n {state.error.message}\n </p>\n </section>\n )\n }\n case 'SUCCESS': {\n return state.result.renderPaymentForm()\n }\n }\n}\n\nexport default React.memo(PaymentForm)\n"]}
|
@@ -5,6 +5,7 @@ import ReCAPTCHA from 'react-google-recaptcha';
|
|
5
5
|
import OnLoading from '../renderer/OnLoading';
|
6
6
|
import OneBlinkAppsErrorOriginalMessage from '../renderer/OneBlinkAppsErrorOriginalMessage';
|
7
7
|
import Modal from '../renderer/Modal';
|
8
|
+
import MaterialIcon from '../MaterialIcon';
|
8
9
|
function WestpacQuickStreamPaymentForm({ formSubmissionResult, paymentSubmissionEvent, formSubmissionPaymentId, supplierBusinessCode, publishableApiKey, isTestMode, captchaSiteKey, onCompleted, onCancelled, appImageUrl, title, }) {
|
9
10
|
var _a, _b;
|
10
11
|
const [{ isCompletingTransaction, completeTransactionError, captchaToken, displayCaptchaRequired, }, setCompleteTransactionState,] = React.useState({
|
@@ -192,7 +193,7 @@ function WestpacQuickStreamPaymentForm({ formSubmissionResult, paymentSubmission
|
|
192
193
|
React.createElement("span", null, "Building payment form...")))),
|
193
194
|
loadError && (React.createElement("section", { className: "cypress-payment-form-loading-error-message" },
|
194
195
|
React.createElement("div", { className: "ob-payment-form__error-icon-container has-text-centered has-margin-bottom-8" },
|
195
|
-
React.createElement(
|
196
|
+
React.createElement(MaterialIcon, { className: "ob-payment-form__error-icon has-text-danger icon-x-large" }, "error")),
|
196
197
|
React.createElement("p", { className: "ob-payment-form__error-message has-text-centered has-margin-bottom-4" }, loadError.message))),
|
197
198
|
React.createElement("section", null,
|
198
199
|
React.createElement("form", { onSubmit: (event) => {
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"WestpacQuickStreamPaymentForm.js","sourceRoot":"","sources":["../../../src/components/payments/WestpacQuickStreamPaymentForm.tsx"],"names":[],"mappings":"AAAA,OAAO,EACL,iBAAiB,EACjB,cAAc,EAEd,mBAAmB,GACpB,MAAM,gBAAgB,CAAA;AAEvB,OAAO,IAAI,MAAM,MAAM,CAAA;AACvB,OAAO,KAAK,MAAM,OAAO,CAAA;AACzB,OAAO,SAAS,MAAM,wBAAwB,CAAA;AAC9C,OAAO,SAAS,MAAM,uBAAuB,CAAA;AAC7C,OAAO,gCAAgC,MAAM,8CAA8C,CAAA;AAC3F,OAAO,KAAK,MAAM,mBAAmB,CAAA;AA2CrC,SAAS,6BAA6B,CAAC,EACrC,oBAAoB,EACpB,sBAAsB,EACtB,uBAAuB,EACvB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AA6B,EAAE;4BAC7C,YAAY,EAAE,uBAAuB;yBACtC,CAAC,mBAGK,CACL,CACP,CACI,CACC;QAEV,oBAAC,KAAK,IACJ,MAAM,EAAE,CAAC,CAAC,wBAAwB,EAClC,KAAK,EAAC,eAAe,EACrB,SAAS,EAAC,oCAAoC,EAC9C,OAAO,EACL;gBACE,gCACE,IAAI,EAAC,QAAQ,EACb,SAAS,EAAC,gEAAgE,EAC1E,OAAO,EAAE,6BAA6B,EACtC,SAAS,iBAGF,CACR;YAGL;gBACE,iCACG,wBAAwB,YAAY,KAAK;oBACxC,CAAC,CAAC,wBAAwB,CAAC,OAAO;oBAClC,CAAC,CAAC,wBAAwB,CACxB;gBACL,wBAAwB,YAAY,iBAAiB,IAAI,CACxD,oBAAC,gCAAgC,IAC/B,KAAK,EAAE,wBAAwB,CAAC,aAAa,GAC7C,CACH,CACA,CACG;QAER,oBAAC,KAAK,IACJ,MAAM,EAAE,CAAC,CAAC,WAAW,EACrB,KAAK,EAAC,cAAc,EACpB,SAAS,EAAC,mCAAmC,EAC7C,OAAO,EACL;gBACE,gCACE,IAAI,EAAC,QAAQ,EACb,SAAS,EAAC,+DAA+D,EACzE,OAAO,EAAE,gBAAgB,EACzB,SAAS,iBAGF,CACR;YAGL;gBACE,iCACG,WAAW,YAAY,KAAK,CAAC,CAAC,CAAC,WAAW,CAAC,OAAO,CAAC,CAAC,CAAC,WAAW,CAC7D;gBACL,WAAW,YAAY,iBAAiB,IAAI,CAC3C,oBAAC,gCAAgC,IAC/B,KAAK,EAAE,WAAW,CAAC,aAAa,GAChC,CACH,CACA,CACG,CACP,CACJ,CAAA;AACH,CAAC;AAED,eAAe,KAAK,CAAC,IAAI,CAAC,6BAA6B,CAAC,CAAA","sourcesContent":["import {\n OneBlinkAppsError,\n paymentService,\n submissionService,\n localisationService,\n} from '@oneblink/apps'\nimport { SubmissionTypes, SubmissionEventTypes } from '@oneblink/types'\nimport clsx from 'clsx'\nimport React from 'react'\nimport ReCAPTCHA from 'react-google-recaptcha'\nimport OnLoading from '../renderer/OnLoading'\nimport OneBlinkAppsErrorOriginalMessage from '../renderer/OneBlinkAppsErrorOriginalMessage'\nimport Modal from '../renderer/Modal'\n\ninterface TrustedFrame {\n submitForm(\n callback: (\n errors:\n | Array<{\n fieldName: string\n messages: string[]\n }>\n | undefined,\n data: {\n singleUseToken: {\n singleUseTokenId: string\n }\n },\n ) => void,\n ): void\n}\n\ndeclare global {\n interface Window {\n QuickstreamAPI: {\n init(options: { publishableApiKey: string }): void\n creditCards: {\n createTrustedFrame(\n options: unknown,\n callback: (\n errors:\n | Array<{\n fieldName: string\n messages: string[]\n }>\n | undefined,\n data: {\n trustedFrame: TrustedFrame\n },\n ) => void,\n ): void\n }\n }\n }\n}\nfunction WestpacQuickStreamPaymentForm({\n formSubmissionResult,\n paymentSubmissionEvent,\n formSubmissionPaymentId,\n supplierBusinessCode,\n publishableApiKey,\n isTestMode,\n captchaSiteKey,\n onCompleted,\n onCancelled,\n appImageUrl,\n title,\n}: {\n formSubmissionResult: submissionService.FormSubmissionResult\n paymentSubmissionEvent: SubmissionEventTypes.WestpacQuickStreamSubmissionEvent\n formSubmissionPaymentId: string\n supplierBusinessCode: string\n publishableApiKey: string\n isTestMode: boolean\n captchaSiteKey: string\n onCompleted: (result: {\n formSubmissionPayment: SubmissionTypes.FormSubmissionPayment\n paymentReceiptUrl: string\n }) => void\n onCancelled: (result: { paymentReceiptUrl: string }) => void\n appImageUrl?: string\n title?: string\n}) {\n const [\n {\n isCompletingTransaction,\n completeTransactionError,\n captchaToken,\n displayCaptchaRequired,\n },\n setCompleteTransactionState,\n ] = React.useState<{\n captchaToken: string | null\n displayCaptchaRequired: boolean\n isCompletingTransaction: boolean\n completeTransactionError: Error | null\n }>({\n isCompletingTransaction: false,\n completeTransactionError: null,\n captchaToken: null,\n displayCaptchaRequired: false,\n })\n\n const clearCompleteTransactionError = React.useCallback(() => {\n setCompleteTransactionState((currentState) => ({\n ...currentState,\n isCompletingTransaction: false,\n completeTransactionError: null,\n }))\n }, [])\n\n const [{ trustedFrame, isLoading, loadError }, setLoadState] =\n React.useState<{\n trustedFrame: TrustedFrame | null\n isLoading: boolean\n loadError: Error | null\n }>({\n trustedFrame: null,\n isLoading: true,\n loadError: null,\n })\n\n React.useEffect(() => {\n const abortController = new AbortController()\n const scriptEle = document.createElement('script')\n scriptEle.type = 'text/javascript'\n scriptEle.async = true\n\n const run = async () => {\n try {\n scriptEle.src = isTestMode\n ? 'https://api.quickstream.support.qvalent.com/rest/v1/quickstream-api-1.0.min.js'\n : 'https://api.quickstream.westpac.com.au/rest/v1/quickstream-api-1.0.min.js'\n\n await new Promise((resolve, reject) => {\n try {\n scriptEle.addEventListener(\n 'load',\n () => {\n resolve(undefined)\n },\n {\n signal: abortController.signal,\n },\n )\n\n scriptEle.addEventListener(\n 'error',\n () => {\n reject(new Error(`Failed to load the script ${scriptEle.src}`))\n },\n {\n signal: abortController.signal,\n },\n )\n\n document.body.appendChild(scriptEle)\n } catch (error) {\n console.warn('Failed to load script', error)\n reject(error)\n }\n })\n\n window.QuickstreamAPI.init({\n publishableApiKey,\n })\n const newTrustedFrame = await new Promise<TrustedFrame>(\n (resolve, reject) => {\n window.QuickstreamAPI.creditCards.createTrustedFrame(\n {\n config: {\n supplierBusinessCode,\n threeDS2: true,\n },\n iframe: {\n style: {\n width: '100%',\n },\n },\n showAcceptedCards: true,\n showRequiredIndicators: true,\n },\n (errors, data) => {\n if (errors) {\n reject(errors)\n return\n }\n resolve(data.trustedFrame)\n },\n )\n },\n )\n\n if (!abortController.signal.aborted) {\n setLoadState({\n trustedFrame: newTrustedFrame,\n isLoading: false,\n loadError: null,\n })\n }\n } catch (error) {\n if (!abortController.signal.aborted) {\n setLoadState({\n trustedFrame: null,\n isLoading: false,\n loadError: error as Error,\n })\n }\n }\n }\n\n run()\n\n return () => {\n abortController.abort()\n document.body.removeChild(scriptEle)\n }\n }, [isTestMode, publishableApiKey, supplierBusinessCode])\n\n const handleSubmit = React.useCallback(async () => {\n if (!trustedFrame) {\n return\n }\n\n if (!captchaToken) {\n setCompleteTransactionState({\n captchaToken: null,\n displayCaptchaRequired: true,\n isCompletingTransaction: false,\n completeTransactionError: null,\n })\n return\n }\n\n setCompleteTransactionState((currentState) => ({\n ...currentState,\n isCompletingTransaction: true,\n completeTransactionError: null,\n }))\n\n trustedFrame.submitForm((errors, data) => {\n if (errors) {\n console.log('Invalid payment form submission', errors)\n setCompleteTransactionState((currentState) => ({\n ...currentState,\n isCompletingTransaction: false,\n completeTransactionError: null,\n }))\n return\n }\n\n paymentService.westpacQuickStream\n .completeTransaction({\n singleUseTokenId: data.singleUseToken.singleUseTokenId,\n formSubmissionResult,\n formSubmissionPaymentId,\n paymentSubmissionEvent,\n captchaToken,\n })\n .then(onCompleted)\n .catch((error) => {\n setCompleteTransactionState((currentState) => ({\n ...currentState,\n isCompletingTransaction: false,\n completeTransactionError: error,\n }))\n })\n })\n }, [\n captchaToken,\n formSubmissionPaymentId,\n formSubmissionResult,\n onCompleted,\n paymentSubmissionEvent,\n trustedFrame,\n ])\n\n const [{ isCancellingTransaction, cancelError }, setCancelState] =\n React.useState<{\n isCancellingTransaction: boolean\n cancelError: Error | null\n }>({\n isCancellingTransaction: false,\n cancelError: null,\n })\n\n const clearCancelError = React.useCallback(() => {\n setCancelState({\n isCancellingTransaction: false,\n cancelError: null,\n })\n }, [])\n\n const handleCancel = React.useCallback(async () => {\n setCancelState({\n isCancellingTransaction: true,\n cancelError: null,\n })\n try {\n const result = await paymentService.westpacQuickStream.cancelPayment({\n formSubmissionPaymentId,\n formSubmissionResult,\n })\n onCancelled(result)\n } catch (error) {\n console.warn('Failed to cancel payment', error)\n setCancelState({\n isCancellingTransaction: false,\n cancelError: error as Error,\n })\n }\n }, [formSubmissionPaymentId, formSubmissionResult, onCancelled])\n\n return (\n <>\n {isLoading && (\n <section>\n <div className=\"cypress-loading has-text-centered\">\n <OnLoading className=\"has-text-centered\"></OnLoading>\n <span>Building payment form...</span>\n </div>\n </section>\n )}\n\n {loadError && (\n <section className=\"cypress-payment-form-loading-error-message\">\n <div className=\"ob-payment-form__error-icon-container has-text-centered has-margin-bottom-8\">\n <i className=\"ob-payment-form__error-icon material-icons has-text-danger icon-x-large\">\n error\n </i>\n </div>\n <p className=\"ob-payment-form__error-message has-text-centered has-margin-bottom-4\">\n {loadError.message}\n </p>\n </section>\n )}\n\n <section>\n <form\n onSubmit={(event) => {\n event.preventDefault()\n handleSubmit()\n }}\n >\n <div className=\"ob-payment-form__westpac-quickstream-container\">\n {!!appImageUrl && (\n <figure className=\"image is-128x128 has-margin-bottom-6 ml-auto mr-auto\">\n <img\n alt=\"Application Icon\"\n className=\"is-rounded\"\n src={appImageUrl}\n />\n </figure>\n )}\n {!!title && (\n <h3 className=\"title is-3 is-size-3-mobile ob-header__heading has-text-centered\">\n {title}\n </h3>\n )}\n <label className=\"label ob-label has-text-centered\">\n Fill out the form below to complete your secure payment.\n </label>\n\n <div className=\"ob-payment-form__westpac-quickstream-amount\">\n <div>Amount</div>\n <div className=\"ob-payment-form__westpac-quickstream-amount-value\">\n {localisationService.formatCurrency(\n formSubmissionResult.payment?.amount ?? 0,\n )}\n </div>\n </div>\n <div\n data-quickstream-api=\"creditCardContainer\"\n className=\"quickstream-credit-card-container\"\n ></div>\n {!isLoading && !loadError && (\n <>\n <ReCAPTCHA\n sitekey={captchaSiteKey}\n onChange={(newValue) => {\n setCompleteTransactionState((currentState) => ({\n ...currentState,\n captchaToken: newValue,\n displayCaptchaRequired: newValue === null,\n }))\n }}\n className=\"ob-input cypress-captcha-control ob-payment-form__westpac-quickstream-captcha\"\n />\n {displayCaptchaRequired && (\n <div role=\"alert\" className=\"has-margin-top-8\">\n <div className=\"has-text-danger ob-error__text cypress-required cypress-validation-message\">\n Please complete the CAPTCHA successfully\n </div>\n </div>\n )}\n </>\n )}\n </div>\n {!isLoading && !loadError && (\n <div className=\"ob-payment-form__westpac-quickstream-form-actions\">\n <button\n type=\"button\"\n disabled={isCompletingTransaction || isCancellingTransaction}\n onClick={handleCancel}\n className={clsx('button ob-button is-outlined', {\n 'is-loading': isCancellingTransaction,\n })}\n >\n Cancel\n </button>\n <button\n type=\"submit\"\n disabled={isCompletingTransaction || isCancellingTransaction}\n className={clsx('button ob-button is-success', {\n 'is-loading': isCompletingTransaction,\n })}\n >\n Make Payment\n </button>\n </div>\n )}\n </form>\n </section>\n\n <Modal\n isOpen={!!completeTransactionError}\n title=\"Payment Issue\"\n className=\"cypress-payment-error-close-button\"\n actions={\n <>\n <button\n type=\"button\"\n className=\"button ob-button cypress-payment-error-close-button is-primary\"\n onClick={clearCompleteTransactionError}\n autoFocus\n >\n Okay\n </button>\n </>\n }\n >\n <>\n <div>\n {completeTransactionError instanceof Error\n ? completeTransactionError.message\n : completeTransactionError}\n </div>\n {completeTransactionError instanceof OneBlinkAppsError && (\n <OneBlinkAppsErrorOriginalMessage\n error={completeTransactionError.originalError}\n />\n )}\n </>\n </Modal>\n\n <Modal\n isOpen={!!cancelError}\n title=\"Cancel Issue\"\n className=\"cypress-cancel-error-close-button\"\n actions={\n <>\n <button\n type=\"button\"\n className=\"button ob-button cypress-cancel-error-close-button is-primary\"\n onClick={clearCancelError}\n autoFocus\n >\n Okay\n </button>\n </>\n }\n >\n <>\n <div>\n {cancelError instanceof Error ? cancelError.message : cancelError}\n </div>\n {cancelError instanceof OneBlinkAppsError && (\n <OneBlinkAppsErrorOriginalMessage\n error={cancelError.originalError}\n />\n )}\n </>\n </Modal>\n </>\n )\n}\n\nexport default React.memo(WestpacQuickStreamPaymentForm)\n"]}
|
1
|
+
{"version":3,"file":"WestpacQuickStreamPaymentForm.js","sourceRoot":"","sources":["../../../src/components/payments/WestpacQuickStreamPaymentForm.tsx"],"names":[],"mappings":"AAAA,OAAO,EACL,iBAAiB,EACjB,cAAc,EAEd,mBAAmB,GACpB,MAAM,gBAAgB,CAAA;AAEvB,OAAO,IAAI,MAAM,MAAM,CAAA;AACvB,OAAO,KAAK,MAAM,OAA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AC/B,KAAK,EAAE,WAAW,CAAC,aAAa,GAChC,CACH,CACA,CACG,CACP,CACJ,CAAA;AACH,CAAC;AAED,eAAe,KAAK,CAAC,IAAI,CAAC,6BAA6B,CAAC,CAAA","sourcesContent":["import {\n OneBlinkAppsError,\n paymentService,\n submissionService,\n localisationService,\n} from '@oneblink/apps'\nimport { SubmissionTypes, SubmissionEventTypes } from '@oneblink/types'\nimport clsx from 'clsx'\nimport React from 'react'\nimport ReCAPTCHA from 'react-google-recaptcha'\nimport OnLoading from '../renderer/OnLoading'\nimport OneBlinkAppsErrorOriginalMessage from '../renderer/OneBlinkAppsErrorOriginalMessage'\nimport Modal from '../renderer/Modal'\nimport MaterialIcon from '../MaterialIcon'\n\ninterface TrustedFrame {\n submitForm(\n callback: (\n errors:\n | Array<{\n fieldName: string\n messages: string[]\n }>\n | undefined,\n data: {\n singleUseToken: {\n singleUseTokenId: string\n }\n },\n ) => void,\n ): void\n}\n\ndeclare global {\n interface Window {\n QuickstreamAPI: {\n init(options: { publishableApiKey: string }): void\n creditCards: {\n createTrustedFrame(\n options: unknown,\n callback: (\n errors:\n | Array<{\n fieldName: string\n messages: string[]\n }>\n | undefined,\n data: {\n trustedFrame: TrustedFrame\n },\n ) => void,\n ): void\n }\n }\n }\n}\nfunction WestpacQuickStreamPaymentForm({\n formSubmissionResult,\n paymentSubmissionEvent,\n formSubmissionPaymentId,\n supplierBusinessCode,\n publishableApiKey,\n isTestMode,\n captchaSiteKey,\n onCompleted,\n onCancelled,\n appImageUrl,\n title,\n}: {\n formSubmissionResult: submissionService.FormSubmissionResult\n paymentSubmissionEvent: SubmissionEventTypes.WestpacQuickStreamSubmissionEvent\n formSubmissionPaymentId: string\n supplierBusinessCode: string\n publishableApiKey: string\n isTestMode: boolean\n captchaSiteKey: string\n onCompleted: (result: {\n formSubmissionPayment: SubmissionTypes.FormSubmissionPayment\n paymentReceiptUrl: string\n }) => void\n onCancelled: (result: { paymentReceiptUrl: string }) => void\n appImageUrl?: string\n title?: string\n}) {\n const [\n {\n isCompletingTransaction,\n completeTransactionError,\n captchaToken,\n displayCaptchaRequired,\n },\n setCompleteTransactionState,\n ] = React.useState<{\n captchaToken: string | null\n displayCaptchaRequired: boolean\n isCompletingTransaction: boolean\n completeTransactionError: Error | null\n }>({\n isCompletingTransaction: false,\n completeTransactionError: null,\n captchaToken: null,\n displayCaptchaRequired: false,\n })\n\n const clearCompleteTransactionError = React.useCallback(() => {\n setCompleteTransactionState((currentState) => ({\n ...currentState,\n isCompletingTransaction: false,\n completeTransactionError: null,\n }))\n }, [])\n\n const [{ trustedFrame, isLoading, loadError }, setLoadState] =\n React.useState<{\n trustedFrame: TrustedFrame | null\n isLoading: boolean\n loadError: Error | null\n }>({\n trustedFrame: null,\n isLoading: true,\n loadError: null,\n })\n\n React.useEffect(() => {\n const abortController = new AbortController()\n const scriptEle = document.createElement('script')\n scriptEle.type = 'text/javascript'\n scriptEle.async = true\n\n const run = async () => {\n try {\n scriptEle.src = isTestMode\n ? 'https://api.quickstream.support.qvalent.com/rest/v1/quickstream-api-1.0.min.js'\n : 'https://api.quickstream.westpac.com.au/rest/v1/quickstream-api-1.0.min.js'\n\n await new Promise((resolve, reject) => {\n try {\n scriptEle.addEventListener(\n 'load',\n () => {\n resolve(undefined)\n },\n {\n signal: abortController.signal,\n },\n )\n\n scriptEle.addEventListener(\n 'error',\n () => {\n reject(new Error(`Failed to load the script ${scriptEle.src}`))\n },\n {\n signal: abortController.signal,\n },\n )\n\n document.body.appendChild(scriptEle)\n } catch (error) {\n console.warn('Failed to load script', error)\n reject(error)\n }\n })\n\n window.QuickstreamAPI.init({\n publishableApiKey,\n })\n const newTrustedFrame = await new Promise<TrustedFrame>(\n (resolve, reject) => {\n window.QuickstreamAPI.creditCards.createTrustedFrame(\n {\n config: {\n supplierBusinessCode,\n threeDS2: true,\n },\n iframe: {\n style: {\n width: '100%',\n },\n },\n showAcceptedCards: true,\n showRequiredIndicators: true,\n },\n (errors, data) => {\n if (errors) {\n reject(errors)\n return\n }\n resolve(data.trustedFrame)\n },\n )\n },\n )\n\n if (!abortController.signal.aborted) {\n setLoadState({\n trustedFrame: newTrustedFrame,\n isLoading: false,\n loadError: null,\n })\n }\n } catch (error) {\n if (!abortController.signal.aborted) {\n setLoadState({\n trustedFrame: null,\n isLoading: false,\n loadError: error as Error,\n })\n }\n }\n }\n\n run()\n\n return () => {\n abortController.abort()\n document.body.removeChild(scriptEle)\n }\n }, [isTestMode, publishableApiKey, supplierBusinessCode])\n\n const handleSubmit = React.useCallback(async () => {\n if (!trustedFrame) {\n return\n }\n\n if (!captchaToken) {\n setCompleteTransactionState({\n captchaToken: null,\n displayCaptchaRequired: true,\n isCompletingTransaction: false,\n completeTransactionError: null,\n })\n return\n }\n\n setCompleteTransactionState((currentState) => ({\n ...currentState,\n isCompletingTransaction: true,\n completeTransactionError: null,\n }))\n\n trustedFrame.submitForm((errors, data) => {\n if (errors) {\n console.log('Invalid payment form submission', errors)\n setCompleteTransactionState((currentState) => ({\n ...currentState,\n isCompletingTransaction: false,\n completeTransactionError: null,\n }))\n return\n }\n\n paymentService.westpacQuickStream\n .completeTransaction({\n singleUseTokenId: data.singleUseToken.singleUseTokenId,\n formSubmissionResult,\n formSubmissionPaymentId,\n paymentSubmissionEvent,\n captchaToken,\n })\n .then(onCompleted)\n .catch((error) => {\n setCompleteTransactionState((currentState) => ({\n ...currentState,\n isCompletingTransaction: false,\n completeTransactionError: error,\n }))\n })\n })\n }, [\n captchaToken,\n formSubmissionPaymentId,\n formSubmissionResult,\n onCompleted,\n paymentSubmissionEvent,\n trustedFrame,\n ])\n\n const [{ isCancellingTransaction, cancelError }, setCancelState] =\n React.useState<{\n isCancellingTransaction: boolean\n cancelError: Error | null\n }>({\n isCancellingTransaction: false,\n cancelError: null,\n })\n\n const clearCancelError = React.useCallback(() => {\n setCancelState({\n isCancellingTransaction: false,\n cancelError: null,\n })\n }, [])\n\n const handleCancel = React.useCallback(async () => {\n setCancelState({\n isCancellingTransaction: true,\n cancelError: null,\n })\n try {\n const result = await paymentService.westpacQuickStream.cancelPayment({\n formSubmissionPaymentId,\n formSubmissionResult,\n })\n onCancelled(result)\n } catch (error) {\n console.warn('Failed to cancel payment', error)\n setCancelState({\n isCancellingTransaction: false,\n cancelError: error as Error,\n })\n }\n }, [formSubmissionPaymentId, formSubmissionResult, onCancelled])\n\n return (\n <>\n {isLoading && (\n <section>\n <div className=\"cypress-loading has-text-centered\">\n <OnLoading className=\"has-text-centered\"></OnLoading>\n <span>Building payment form...</span>\n </div>\n </section>\n )}\n\n {loadError && (\n <section className=\"cypress-payment-form-loading-error-message\">\n <div className=\"ob-payment-form__error-icon-container has-text-centered has-margin-bottom-8\">\n <MaterialIcon className=\"ob-payment-form__error-icon has-text-danger icon-x-large\">\n error\n </MaterialIcon>\n </div>\n <p className=\"ob-payment-form__error-message has-text-centered has-margin-bottom-4\">\n {loadError.message}\n </p>\n </section>\n )}\n\n <section>\n <form\n onSubmit={(event) => {\n event.preventDefault()\n handleSubmit()\n }}\n >\n <div className=\"ob-payment-form__westpac-quickstream-container\">\n {!!appImageUrl && (\n <figure className=\"image is-128x128 has-margin-bottom-6 ml-auto mr-auto\">\n <img\n alt=\"Application Icon\"\n className=\"is-rounded\"\n src={appImageUrl}\n />\n </figure>\n )}\n {!!title && (\n <h3 className=\"title is-3 is-size-3-mobile ob-header__heading has-text-centered\">\n {title}\n </h3>\n )}\n <label className=\"label ob-label has-text-centered\">\n Fill out the form below to complete your secure payment.\n </label>\n\n <div className=\"ob-payment-form__westpac-quickstream-amount\">\n <div>Amount</div>\n <div className=\"ob-payment-form__westpac-quickstream-amount-value\">\n {localisationService.formatCurrency(\n formSubmissionResult.payment?.amount ?? 0,\n )}\n </div>\n </div>\n <div\n data-quickstream-api=\"creditCardContainer\"\n className=\"quickstream-credit-card-container\"\n ></div>\n {!isLoading && !loadError && (\n <>\n <ReCAPTCHA\n sitekey={captchaSiteKey}\n onChange={(newValue) => {\n setCompleteTransactionState((currentState) => ({\n ...currentState,\n captchaToken: newValue,\n displayCaptchaRequired: newValue === null,\n }))\n }}\n className=\"ob-input cypress-captcha-control ob-payment-form__westpac-quickstream-captcha\"\n />\n {displayCaptchaRequired && (\n <div role=\"alert\" className=\"has-margin-top-8\">\n <div className=\"has-text-danger ob-error__text cypress-required cypress-validation-message\">\n Please complete the CAPTCHA successfully\n </div>\n </div>\n )}\n </>\n )}\n </div>\n {!isLoading && !loadError && (\n <div className=\"ob-payment-form__westpac-quickstream-form-actions\">\n <button\n type=\"button\"\n disabled={isCompletingTransaction || isCancellingTransaction}\n onClick={handleCancel}\n className={clsx('button ob-button is-outlined', {\n 'is-loading': isCancellingTransaction,\n })}\n >\n Cancel\n </button>\n <button\n type=\"submit\"\n disabled={isCompletingTransaction || isCancellingTransaction}\n className={clsx('button ob-button is-success', {\n 'is-loading': isCompletingTransaction,\n })}\n >\n Make Payment\n </button>\n </div>\n )}\n </form>\n </section>\n\n <Modal\n isOpen={!!completeTransactionError}\n title=\"Payment Issue\"\n className=\"cypress-payment-error-close-button\"\n actions={\n <>\n <button\n type=\"button\"\n className=\"button ob-button cypress-payment-error-close-button is-primary\"\n onClick={clearCompleteTransactionError}\n autoFocus\n >\n Okay\n </button>\n </>\n }\n >\n <>\n <div>\n {completeTransactionError instanceof Error\n ? completeTransactionError.message\n : completeTransactionError}\n </div>\n {completeTransactionError instanceof OneBlinkAppsError && (\n <OneBlinkAppsErrorOriginalMessage\n error={completeTransactionError.originalError}\n />\n )}\n </>\n </Modal>\n\n <Modal\n isOpen={!!cancelError}\n title=\"Cancel Issue\"\n className=\"cypress-cancel-error-close-button\"\n actions={\n <>\n <button\n type=\"button\"\n className=\"button ob-button cypress-cancel-error-close-button is-primary\"\n onClick={clearCancelError}\n autoFocus\n >\n Okay\n </button>\n </>\n }\n >\n <>\n <div>\n {cancelError instanceof Error ? cancelError.message : cancelError}\n </div>\n {cancelError instanceof OneBlinkAppsError && (\n <OneBlinkAppsErrorOriginalMessage\n error={cancelError.originalError}\n />\n )}\n </>\n </Modal>\n </>\n )\n}\n\nexport default React.memo(WestpacQuickStreamPaymentForm)\n"]}
|