@adyen/adyen-platform-experience-web 0.1.2 → 1.0.0-beta.1
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/README.md +13 -13
- package/dist/AmountSkeleton.css +23 -0
- package/dist/BalanceAccountSelector.css +4 -0
- package/dist/BaseButton.css +14 -0
- package/dist/BaseList.css +5 -0
- package/dist/Button.css +114 -0
- package/dist/ButtonActions-eb064f69.mjs +46 -0
- package/dist/ButtonActions.css +28 -0
- package/dist/CalendarGrid.css +113 -0
- package/dist/CopyText.css +18 -0
- package/dist/DatePicker.css +64 -0
- package/dist/ErrorMessageDisplay.css +20 -0
- package/dist/ErrorPanel.css +15 -0
- package/dist/ExpandableCard.css +71 -0
- package/dist/FilterBar.css +40 -0
- package/dist/FilterButton.css +48 -0
- package/dist/Img.css +7 -0
- package/dist/InputBase.css +175 -0
- package/dist/Modal.css +110 -0
- package/dist/Pagination.css +25 -0
- package/dist/Popover.css +127 -0
- package/dist/PopoverDismissButton.css +12 -0
- package/dist/RangeSelection.css +26 -0
- package/dist/Select.css +149 -0
- package/dist/SkeletonBody.css +154 -0
- package/dist/Spinner.css +50 -0
- package/dist/SummaryItem.css +37 -0
- package/dist/Tag-6d02fd64.mjs +32 -0
- package/dist/Tag.css +34 -0
- package/dist/Tooltip.css +7 -0
- package/dist/TotalsCard.css +14 -0
- package/dist/TransactionDetails.css +74 -0
- package/dist/TransactionsDisplay.css +4 -0
- package/dist/TransactionsOverview.css +29 -0
- package/dist/TransactionsOverviewContainer.css +3 -0
- package/dist/TransactionsTable.css +18 -0
- package/dist/Typography-11b95870.mjs +68 -0
- package/dist/Typography.css +57 -0
- package/dist/cjs/ModalContent-e142d135.js +10 -0
- package/dist/cjs/ModalContent-e142d135.js.map +1 -0
- package/dist/cjs/index-2231054e.js +10406 -0
- package/dist/cjs/index-2231054e.js.map +1 -0
- package/dist/cjs/index.css +1707 -0
- package/dist/cjs/index.js +35 -1
- package/dist/cjs/index.js.map +1 -1
- package/dist/compat.module-a4d537ff.mjs +237 -0
- package/dist/en-US-1daadfc1.mjs +371 -0
- package/dist/es/components/external/BaseElement.js +89 -49
- package/dist/es/components/external/EventEmitter.js +28 -17
- package/dist/es/components/external/FormElement.js +78 -0
- package/dist/es/components/external/TransactionDetails/TransactionDetails.js +20 -15
- package/dist/es/components/external/TransactionDetails/components/TransactionData.js +43 -42
- package/dist/es/components/external/TransactionDetails/components/TransactionDataSkeleton.js +13 -10
- package/dist/es/components/external/TransactionDetails/components/TransactionDetails.js +39 -28
- package/dist/es/components/external/TransactionDetails/index.js +4 -0
- package/dist/es/components/external/TransactionsOverview/TransactionsOverviewElement.js +35 -0
- package/dist/es/components/external/TransactionsOverview/components/AmountSkeleton/AmountSkeleton.js +12 -0
- package/dist/es/components/external/TransactionsOverview/components/AmountSkeleton/constants.js +8 -0
- package/dist/es/components/external/TransactionsOverview/components/BalanceAccountSelector/BalanceAccountSelector.js +31 -0
- package/dist/es/components/external/TransactionsOverview/components/BalanceAccountSelector/index.js +6 -0
- package/dist/es/components/external/TransactionsOverview/components/BalanceAccountSelector/useBalanceAccountSelection.js +25 -0
- package/dist/es/components/external/TransactionsOverview/components/BalanceItem/BalanceItem.js +41 -0
- package/dist/es/components/external/TransactionsOverview/components/Balances/Balances.js +56 -0
- package/dist/es/components/external/TransactionsOverview/components/Balances/constants.js +4 -0
- package/dist/es/components/external/TransactionsOverview/components/Category/Category.js +12 -0
- package/dist/es/components/external/TransactionsOverview/components/ModalContent.js +12 -0
- package/dist/es/components/external/TransactionsOverview/components/MultiSelectionFilter/MultiSelectionFilter.js +33 -0
- package/dist/es/components/external/TransactionsOverview/components/MultiSelectionFilter/index.js +15 -0
- package/dist/es/components/external/TransactionsOverview/components/MultiSelectionFilter/useMultiSelectionFilter/constants.js +27 -0
- package/dist/es/components/external/TransactionsOverview/components/MultiSelectionFilter/useMultiSelectionFilter/index.js +13 -0
- package/dist/es/components/external/TransactionsOverview/components/MultiSelectionFilter/useMultiSelectionFilter/useMultiSelectionFilter.js +31 -0
- package/dist/es/components/external/TransactionsOverview/components/MultiSelectionFilter/useMultiSelectionFilter/utils.js +11 -0
- package/dist/es/components/external/TransactionsOverview/components/SummaryItem/SummaryItem.js +60 -0
- package/dist/es/components/external/TransactionsOverview/components/SummaryItem/SummaryItemLabel.js +22 -0
- package/dist/es/components/external/TransactionsOverview/components/SummaryItem/constants.js +16 -0
- package/dist/es/components/external/TransactionsOverview/components/TransactionListError/TransactionListError.js +21 -0
- package/dist/es/components/external/TransactionsOverview/components/TransactionTotalItem/TransactionTotalItem.js +61 -0
- package/dist/es/components/external/TransactionsOverview/components/TransactionTotals/TotalsCard.js +50 -0
- package/dist/es/components/external/TransactionsOverview/components/TransactionTotals/TransactionTotals.js +66 -0
- package/dist/es/components/external/TransactionsOverview/components/TransactionTotals/constants.js +6 -0
- package/dist/es/components/external/TransactionsOverview/components/TransactionsDisplay/TransactionsDisplay.js +91 -0
- package/dist/es/components/external/TransactionsOverview/components/TransactionsDisplay/constants.js +6 -0
- package/dist/es/components/external/TransactionsOverview/components/TransactionsOverview/TransactionsOverview.js +182 -0
- package/dist/es/components/external/TransactionsOverview/components/TransactionsOverview/constants.js +8 -0
- package/dist/es/components/external/TransactionsOverview/components/TransactionsOverviewContainer/TransactionsOverviewContainer.js +52 -0
- package/dist/es/components/external/TransactionsOverview/components/TransactionsOverviewContainer/constants.js +6 -0
- package/dist/es/components/external/TransactionsOverview/components/TransactionsOverviewDateFilter.js +71 -0
- package/dist/es/components/external/TransactionsOverview/components/TransactionsTable/TransactionsTable.js +112 -0
- package/dist/es/components/external/TransactionsOverview/components/TransactionsTable/constants.js +12 -0
- package/dist/es/components/external/{Transactions → TransactionsOverview}/components/utils.js +13 -7
- package/dist/es/components/external/TransactionsOverview/hooks/useDefaultTransactionsOverviewFilterParams.js +42 -0
- package/dist/es/components/external/TransactionsOverview/hooks/useMaxWidths.js +16 -0
- package/dist/es/components/external/TransactionsOverview/hooks/useMediaQuery.js +37 -0
- package/dist/es/components/external/TransactionsOverview/hooks/useTransactionsOverviewMultiSelectionFilters.js +33 -0
- package/dist/es/components/external/TransactionsOverview/index.js +6 -0
- package/dist/es/components/external/UIElement.js +51 -39
- package/dist/es/components/external/index.js +8 -0
- package/dist/es/components/index.js +11 -0
- package/dist/es/components/internal/BaseButton/BaseButton.js +22 -13
- package/dist/es/components/internal/BaseButton/constants.js +2 -2
- package/dist/es/components/internal/BaseButton/index.js +4 -0
- package/dist/es/components/internal/BaseList/BaseList.js +8 -5
- package/dist/es/components/internal/BaseList/constants.js +2 -2
- package/dist/es/components/internal/Button/Button.js +41 -39
- package/dist/es/components/internal/Button/ButtonActions/ButtonActions.js +8 -27
- package/dist/es/components/internal/Button/constants.js +16 -9
- package/dist/es/components/internal/Button/hooks/useButton.js +16 -12
- package/dist/es/components/internal/Button/index.js +4 -0
- package/dist/es/components/internal/Calendar/Calendar.js +21 -20
- package/dist/es/components/internal/Calendar/calendar/constants.js +70 -35
- package/dist/es/components/internal/Calendar/calendar/facade/Calendar.js +554 -317
- package/dist/es/components/internal/Calendar/calendar/facade/index.js +46 -37
- package/dist/es/components/internal/Calendar/calendar/index.js +4 -0
- package/dist/es/components/internal/Calendar/calendar/shared/indexed/index.js +46 -34
- package/dist/es/components/internal/Calendar/calendar/timeframe/common/flags.js +5 -31
- package/dist/es/components/internal/Calendar/calendar/timeframe/common/utils.js +16 -14
- package/dist/es/components/internal/Calendar/calendar/timeframe/frames/MonthFrame.js +221 -122
- package/dist/es/components/internal/Calendar/calendar/timeframe/frames/TimeFrame.js +418 -238
- package/dist/es/components/internal/Calendar/calendar/timeframe/frames/YearFrame.js +197 -0
- package/dist/es/components/internal/Calendar/calendar/timeframe/index.js +8 -0
- package/dist/es/components/internal/Calendar/calendar/timerange/factory.js +63 -40
- package/dist/es/components/internal/Calendar/calendar/timerange/factory.test.js +139 -0
- package/dist/es/components/internal/Calendar/calendar/timerange/index.js +4 -0
- package/dist/es/components/internal/Calendar/calendar/timerange/presets/index.js +14 -0
- package/dist/es/components/internal/Calendar/calendar/timerange/presets/lastMonth.js +3 -3
- package/dist/es/components/internal/Calendar/calendar/timerange/presets/lastMonth.test.js +69 -0
- package/dist/es/components/internal/Calendar/calendar/timerange/presets/lastNDays.js +27 -16
- package/dist/es/components/internal/Calendar/calendar/timerange/presets/lastNDays.test.js +69 -0
- package/dist/es/components/internal/Calendar/calendar/timerange/presets/lastWeek.js +3 -3
- package/dist/es/components/internal/Calendar/calendar/timerange/presets/lastWeek.test.js +108 -0
- package/dist/es/components/internal/Calendar/calendar/timerange/presets/shared/offsetMonth.js +23 -14
- package/dist/es/components/internal/Calendar/calendar/timerange/presets/shared/offsetWeek.js +29 -21
- package/dist/es/components/internal/Calendar/calendar/timerange/presets/testing/fixtures.js +15 -0
- package/dist/es/components/internal/Calendar/calendar/timerange/presets/testing/helpers.js +19 -0
- package/dist/es/components/internal/Calendar/calendar/timerange/presets/thisMonth.js +3 -3
- package/dist/es/components/internal/Calendar/calendar/timerange/presets/thisMonth.test.js +46 -0
- package/dist/es/components/internal/Calendar/calendar/timerange/presets/thisWeek.js +3 -3
- package/dist/es/components/internal/Calendar/calendar/timerange/presets/thisWeek.test.js +85 -0
- package/dist/es/components/internal/Calendar/calendar/timerange/presets/yearToDate.js +13 -9
- package/dist/es/components/internal/Calendar/calendar/timerange/presets/yearToDate.test.js +49 -0
- package/dist/es/components/internal/Calendar/calendar/timerange/utils.js +83 -49
- package/dist/es/components/internal/Calendar/calendar/timeslice/TimeSlice.js +61 -38
- package/dist/es/components/internal/Calendar/calendar/timeslice/index.js +21 -17
- package/dist/es/components/internal/Calendar/calendar/utils.js +22 -15
- package/dist/es/components/internal/Calendar/clock/clock.js +41 -23
- package/dist/es/components/internal/Calendar/clock/clock.test.js +43 -0
- package/dist/es/components/internal/Calendar/clock/index.js +7 -0
- package/dist/es/components/internal/Calendar/clock/testing/fixtures.js +60 -0
- package/dist/es/components/internal/Calendar/clock/today.js +57 -37
- package/dist/es/components/internal/Calendar/clock/today.test.js +98 -0
- package/dist/es/components/internal/Calendar/components/CalendarControls/CalendarControls.js +12 -7
- package/dist/es/components/internal/Calendar/components/CalendarControls/index.js +4 -0
- package/dist/es/components/internal/Calendar/components/CalendarGrid/CalendarGrid.js +29 -27
- package/dist/es/components/internal/Calendar/components/CalendarGrid/CalendarGridDate.js +58 -33
- package/dist/es/components/internal/Calendar/components/CalendarGrid/CalendarGridDayOfWeek.js +40 -30
- package/dist/es/components/internal/Calendar/components/CalendarGrid/index.js +4 -0
- package/dist/es/components/internal/Calendar/components/CalendarGrid/utils.js +49 -44
- package/dist/es/components/internal/Calendar/hooks/useCalendar.js +115 -84
- package/dist/es/components/internal/Calendar/hooks/useCalendarControlsRendering.js +40 -35
- package/dist/es/components/internal/Calendar/hooks/useTimezone.js +45 -23
- package/dist/es/components/internal/Calendar/index.js +4 -0
- package/dist/es/components/internal/CopyText/CopyText.js +41 -0
- package/dist/es/components/internal/DataGrid/DataGrid.js +10 -84
- package/dist/es/components/internal/DataGrid/DataGridCell.js +4 -4
- package/dist/es/components/internal/DataGrid/components/InteractiveBody.js +8 -31
- package/dist/es/components/internal/DataGrid/components/SkeletonBody.js +16 -14
- package/dist/es/components/internal/DataGrid/components/TableBody.js +26 -9
- package/dist/es/components/internal/DataGrid/components/TableCells.js +25 -17
- package/dist/es/components/internal/DataGrid/hooks/useInteractiveDataGrid.js +5 -76
- package/dist/es/components/internal/DataGrid/index.js +4 -0
- package/dist/es/components/internal/DataGrid/tests/DataGrid.test.js +190 -0
- package/dist/es/components/internal/DatePicker/DatePicker.js +62 -45
- package/dist/es/components/internal/DatePicker/components/TimeRangeSelector/TimeRangeSelector.js +46 -19
- package/dist/es/components/internal/DatePicker/components/TimeRangeSelector/index.js +7 -0
- package/dist/es/components/internal/DatePicker/components/TimeRangeSelector/useTimeRangeSelection.js +85 -56
- package/dist/es/components/internal/DatePicker/index.js +4 -0
- package/dist/es/components/internal/ErrorMessageDisplay/ErrorMessageDisplay.js +53 -40
- package/dist/es/components/internal/ExpandableCard/ExpandableCard.js +74 -51
- package/dist/es/components/internal/ExpandableCard/ExpandableCard.test.js +45 -0
- package/dist/es/components/internal/ExpandableCard/constants.js +20 -11
- package/dist/es/components/internal/FilterBar/FilterBar.js +46 -11
- package/dist/es/components/internal/FilterBar/components/FilterButton/FilterButton.js +17 -15
- package/dist/es/components/internal/FilterBar/filters/AmountFilter/AmountFilter.js +68 -29
- package/dist/es/components/internal/FilterBar/filters/AmountFilter/RangeSelection.js +68 -60
- package/dist/es/components/internal/FilterBar/filters/AmountFilter/constants.js +4 -0
- package/dist/es/components/internal/FilterBar/filters/BaseFilter/BaseFilter.js +155 -99
- package/dist/es/components/internal/FilterBar/filters/BaseFilter/index.js +4 -0
- package/dist/es/components/internal/FilterBar/filters/DateFilter/DateFilter.js +10 -107
- package/dist/es/components/internal/FilterBar/filters/DateFilter/index.js +4 -0
- package/dist/es/components/internal/FilterBar/filters/TextFilter/TextFilter.js +8 -0
- package/dist/es/components/internal/FilterBar/filters/TextFilter/index.js +4 -0
- package/dist/es/components/internal/FilterBar/index.js +4 -0
- package/dist/es/components/internal/FormFields/InputBase.js +67 -54
- package/dist/es/components/internal/FormFields/InputText.js +6 -6
- package/dist/es/components/internal/FormFields/Select/Select.js +246 -182
- package/dist/es/components/internal/FormFields/Select/components/SelectButton.js +73 -69
- package/dist/es/components/internal/FormFields/Select/components/SelectList.js +71 -49
- package/dist/es/components/internal/FormFields/Select/components/SelectListItem.js +41 -37
- package/dist/es/components/internal/FormFields/Select/constants.js +49 -27
- package/dist/es/components/internal/FormFields/Select/hooks/useSelect.js +35 -27
- package/dist/es/components/internal/FormFields/Select/index.js +4 -0
- package/dist/es/components/internal/FormFields/index.js +18 -0
- package/dist/es/components/internal/FormFields/utils.js +4 -0
- package/dist/es/components/internal/Image/Image.js +10 -10
- package/dist/es/components/internal/Img/Img.js +33 -19
- package/dist/es/components/internal/Img/index.js +4 -0
- package/dist/es/components/internal/Modal/Modal.js +78 -66
- package/dist/es/components/internal/Modal/index.js +4 -0
- package/dist/es/components/internal/Pagination/Pagination.js +61 -45
- package/dist/es/components/internal/Pagination/components/LimitSelect.js +1 -0
- package/dist/es/components/internal/Pagination/constants.js +6 -4
- package/dist/es/components/internal/Pagination/hooks/index.js +6 -0
- package/dist/es/components/internal/Pagination/hooks/useCursorPaginatedRecords.js +8 -7
- package/dist/es/components/internal/Pagination/hooks/useCursorPagination.js +30 -18
- package/dist/es/components/internal/Pagination/hooks/useOffsetPaginatedRecords.js +10 -0
- package/dist/es/components/internal/Pagination/hooks/useOffsetPagination.js +21 -14
- package/dist/es/components/internal/Pagination/hooks/usePageLimit.js +60 -52
- package/dist/es/components/internal/Pagination/hooks/usePaginatedRecords.js +11 -78
- package/dist/es/components/internal/Pagination/hooks/usePaginatedRecordsFilters.js +13 -12
- package/dist/es/components/internal/Pagination/hooks/usePagination.js +87 -41
- package/dist/es/components/internal/Pagination/index.js +4 -0
- package/dist/es/components/internal/Pagination/utils.js +5 -5
- package/dist/es/components/internal/Popover/Popover.js +160 -102
- package/dist/es/components/internal/Popover/Popover.test.js +119 -0
- package/dist/es/components/internal/Popover/PopoverDismissButton/PopoverDismissButton.js +22 -18
- package/dist/es/components/internal/Popover/PopoverTitle/PopoverTitle.js +10 -8
- package/dist/es/components/internal/Popover/constants.js +16 -7
- package/dist/es/components/internal/Popover/utils/popoverUtil.js +51 -0
- package/dist/es/components/internal/Popover/utils/utils.js +28 -22
- package/dist/es/components/internal/SVGIcons/CheckedBox.js +5 -5
- package/dist/es/components/internal/SVGIcons/Checkmark.js +6 -6
- package/dist/es/components/internal/SVGIcons/ChevronDown.js +6 -6
- package/dist/es/components/internal/SVGIcons/ChevronLeft.js +8 -8
- package/dist/es/components/internal/SVGIcons/ChevronRight.js +8 -8
- package/dist/es/components/internal/SVGIcons/ChevronUp.js +7 -7
- package/dist/es/components/internal/SVGIcons/Close.js +13 -0
- package/dist/es/components/internal/SVGIcons/Copy.js +5 -0
- package/dist/es/components/internal/SVGIcons/Filter.js +11 -0
- package/dist/es/components/internal/SVGIcons/UncheckedBox.js +5 -5
- package/dist/es/components/internal/Spinner/Spinner.js +5 -4
- package/dist/es/components/internal/Spinner/index.js +4 -0
- package/dist/es/components/internal/Tag/Tag.js +5 -19
- package/dist/es/components/internal/Tooltip/Tooltip.js +48 -0
- package/dist/es/components/internal/Tooltip/useTooltipListeners.js +31 -0
- package/dist/es/components/internal/Typography/Typography.js +7 -33
- package/dist/es/components/internal/Typography/constants.js +2 -2
- package/dist/es/components/utils/transactionResourceErrorCodes.js +17 -13
- package/dist/es/components/utils/utils.js +34 -0
- package/dist/es/constants.js +8 -0
- package/dist/es/core/Analytics/Analytics.js +63 -0
- package/dist/es/core/Analytics/EventsQueue.js +22 -0
- package/dist/es/core/Analytics/index.js +4 -0
- package/dist/es/core/Auth/AuthContext.js +7 -5
- package/dist/es/core/Auth/AuthProvider.js +24 -5
- package/dist/es/core/Auth/useAuthContext.js +4 -4
- package/dist/es/core/Context/CoreContext.js +5 -5
- package/dist/es/core/Context/CoreProvider.js +23 -17
- package/dist/es/core/Context/useCoreContext.js +4 -4
- package/dist/es/core/Errors/AdyenPlatformExperienceError.js +21 -0
- package/dist/es/core/Errors/ErrorPanel.js +19 -0
- package/dist/es/core/Errors/constants.js +4 -2
- package/dist/es/core/Localization/Localization.js +12 -146
- package/dist/es/core/Localization/Localization.test.js +70 -0
- package/dist/es/core/Localization/amount/amount-util.js +42 -19
- package/dist/es/core/Localization/amount/amount-util.test.js +54 -0
- package/dist/es/core/Localization/constants/currency-codes.js +3 -3
- package/dist/es/core/Localization/constants/currency-decimals.js +3 -3
- package/dist/es/core/Localization/constants/locale.js +7 -5
- package/dist/es/core/Localization/constants/localization.js +9 -6
- package/dist/es/core/Localization/datetime/restamper/constants.js +29 -20
- package/dist/es/core/Localization/datetime/restamper/index.js +9 -0
- package/dist/es/core/Localization/datetime/restamper/restamper.js +44 -32
- package/dist/es/core/Localization/datetime/restamper/restamper.test.js +179 -0
- package/dist/es/core/Localization/datetime/restamper/testing/fixtures.js +21 -0
- package/dist/es/core/Localization/datetime/restamper/testing/helpers.js +27 -0
- package/dist/es/core/Localization/datetime/restamper/utils.js +44 -26
- package/dist/es/core/Localization/index.js +32 -0
- package/dist/es/core/Localization/localization-utils.js +7 -31
- package/dist/es/core/Localization/translations/index.js +356 -79
- package/dist/es/core/Localization/utils.js +72 -44
- package/dist/es/core/Localization/utils.test.js +215 -0
- package/dist/es/core/ProcessResponse/index.js +4 -0
- package/dist/es/core/ProcessResponse/process-response.js +40 -0
- package/dist/es/core/Services/analytics/collect-id.js +37 -0
- package/dist/es/core/Services/analytics/log-event.js +14 -0
- package/dist/es/core/Services/analytics/post-telemetry.js +22 -0
- package/dist/es/core/Services/data-set.js +1 -0
- package/dist/es/core/Services/get-dataset.js +13 -0
- package/dist/es/core/Services/requests/endpoints.js +9 -0
- package/dist/es/core/Services/requests/http.js +55 -28
- package/dist/es/core/Services/requests/utils.js +49 -34
- package/dist/es/core/Services/sessions/constants.js +2 -2
- package/dist/es/core/Services/sessions/setup-session.js +9 -9
- package/dist/es/core/Session/Session.js +38 -23
- package/dist/es/core/Session/index.js +4 -0
- package/dist/es/core/Session/utils.js +5 -5
- package/dist/es/core/config.js +6 -2
- package/dist/es/core/core.js +87 -45
- package/dist/es/core/index.js +36 -0
- package/dist/es/core/utils.js +10 -8
- package/dist/es/hooks/element/useClickOutside.js +75 -18
- package/dist/es/hooks/element/useDetachedRender.js +17 -15
- package/dist/es/hooks/element/useFocusCursor.js +18 -13
- package/dist/es/hooks/element/useFocusTrap.js +90 -47
- package/dist/es/hooks/element/useIdentifierString.js +61 -0
- package/dist/es/hooks/element/usePopoverPositioner.js +5 -69
- package/dist/es/hooks/element/useUniqueIdentifier.js +16 -12
- package/dist/es/hooks/useBooleanState/index.js +4 -0
- package/dist/es/hooks/useBooleanState/useBooleanState.js +8 -6
- package/dist/es/hooks/useCommitAction/index.js +6 -0
- package/dist/es/hooks/useCommitAction/useCommitAction.js +38 -27
- package/dist/es/hooks/useDefinedValue/index.js +4 -0
- package/dist/es/hooks/useDefinedValue/useDefinedValue.js +16 -0
- package/dist/es/hooks/useFetch/useFetch.js +37 -27
- package/dist/es/hooks/useImageUrl/useImageUrl.js +26 -22
- package/dist/es/hooks/useModalDetails/useModalDetails.js +37 -28
- package/dist/es/hooks/useMounted/index.js +4 -0
- package/dist/es/hooks/useMounted/useMounted.js +14 -8
- package/dist/es/hooks/useReactiveState/index.js +4 -0
- package/dist/es/hooks/useReactiveState/useReactiveState.js +53 -27
- package/dist/es/hooks/useReflex/constants.js +2 -2
- package/dist/es/hooks/useReflex/core/reflex.js +66 -47
- package/dist/es/hooks/useReflex/core/reflex.test.js +170 -0
- package/dist/es/hooks/useReflex/core/registry.js +68 -46
- package/dist/es/hooks/useReflex/core/registry.test.js +114 -0
- package/dist/es/hooks/useReflex/core/utils.js +18 -16
- package/dist/es/hooks/useReflex/core/utils.test.js +59 -0
- package/dist/es/hooks/useReflex/errors.js +6 -6
- package/dist/es/hooks/useReflex/hooks/useReflex.js +12 -7
- package/dist/es/hooks/useReflex/index.js +8 -0
- package/dist/es/hooks/useSessionAwareRequest/useSessionAwareRequest.js +37 -20
- package/dist/es/hooks/useSetupEndpoint/useSetupEndpoint.js +26 -20
- package/dist/es/index.js +45 -41
- package/dist/es/utils/Storage.js +21 -17
- package/dist/es/utils/Validator/ValidationRuleResult.js +28 -0
- package/dist/es/utils/Validator/Validator.js +67 -0
- package/dist/es/utils/Validator/Validator.test.js +27 -0
- package/dist/es/utils/Validator/defaultRules.js +12 -0
- package/dist/es/utils/Validator/index.js +4 -0
- package/dist/es/utils/class-name-utils.js +11 -5
- package/dist/es/utils/common/constants.js +10 -6
- package/dist/es/utils/common/index.js +59 -32
- package/dist/es/utils/fixedForwardRef.js +3 -3
- package/dist/es/utils/get-image.js +12 -11
- package/dist/es/utils/get-image.test.js +38 -0
- package/dist/es/utils/idGenerator.js +6 -3
- package/dist/es/utils/memoComparator/index.js +4 -0
- package/dist/es/utils/memoComparator/memoComparator.js +26 -17
- package/dist/es/utils/regex.js +6 -0
- package/dist/es/utils/tabbable.js +109 -70
- package/dist/es/utils/useForm/index.js +4 -0
- package/dist/es/utils/useForm/reducer.js +153 -0
- package/dist/es/utils/useForm/useForm.js +85 -0
- package/dist/es/utils/useForm/useForm.test.js +107 -0
- package/dist/es/utils/uuid.js +5 -5
- package/dist/es/utils/uuid.test.js +13 -0
- package/dist/es/utils/validator-utils.js +44 -3
- package/dist/es/utils/watchable/constants.js +2 -2
- package/dist/es/utils/watchable/core/Watchable.js +83 -45
- package/dist/es/utils/watchable/core/Watchable.test.js +103 -0
- package/dist/es/utils/watchable/core/helpers.js +26 -19
- package/dist/es/utils/watchable/core/helpers.test.js +106 -0
- package/dist/es/utils/watchable/core/syncEffect.js +19 -15
- package/dist/es/utils/watchable/core/syncEffect.test.js +103 -0
- package/dist/es/utils/watchable/index.js +17 -16
- package/dist/flags-41c36e13.mjs +83 -0
- package/dist/hooks.module-8565d716.mjs +161 -0
- package/dist/index-2c0f6175.mjs +12069 -0
- package/dist/index-6e47f755.mjs +231 -0
- package/dist/index-944be685.mjs +6609 -0
- package/dist/index-c88cd37e.mjs +243 -0
- package/dist/index-f5bc0382.mjs +155 -0
- package/dist/index.css +63 -0
- package/dist/index2.css +4 -0
- package/dist/jsxRuntime.module-69493d81.mjs +15 -0
- package/dist/magic-string.es-219c273f.mjs +1146 -0
- package/dist/preact.module-38e5a571.mjs +323 -0
- package/dist/types/components/external/TransactionDetails/components/TransactionDataSkeleton.d.ts.map +1 -1
- package/dist/types/components/external/TransactionsOverview/TransactionsOverviewElement.d.ts.map +1 -0
- package/dist/types/components/external/{Transactions → TransactionsOverview}/components/AmountSkeleton/AmountSkeleton.d.ts +1 -1
- package/dist/types/components/external/TransactionsOverview/components/AmountSkeleton/AmountSkeleton.d.ts.map +1 -0
- package/dist/types/components/external/TransactionsOverview/components/AmountSkeleton/constants.d.ts +4 -0
- package/dist/types/components/external/TransactionsOverview/components/AmountSkeleton/constants.d.ts.map +1 -0
- package/dist/types/components/external/TransactionsOverview/components/AmountSkeleton/types.d.ts.map +1 -0
- package/dist/types/components/external/{Transactions → TransactionsOverview}/components/BalanceAccountSelector/BalanceAccountSelector.d.ts +1 -0
- package/dist/types/components/external/TransactionsOverview/components/BalanceAccountSelector/BalanceAccountSelector.d.ts.map +1 -0
- package/dist/types/components/external/TransactionsOverview/components/BalanceAccountSelector/index.d.ts.map +1 -0
- package/dist/types/components/external/TransactionsOverview/components/BalanceAccountSelector/useBalanceAccountSelection.d.ts.map +1 -0
- package/dist/types/components/external/{Transactions → TransactionsOverview}/components/BalanceItem/BalanceItem.d.ts +1 -1
- package/dist/types/components/external/TransactionsOverview/components/BalanceItem/BalanceItem.d.ts.map +1 -0
- package/dist/types/components/external/TransactionsOverview/components/BalanceItem/types.d.ts.map +1 -0
- package/dist/types/components/external/{Transactions → TransactionsOverview}/components/Balances/Balances.d.ts +4 -4
- package/dist/types/components/external/TransactionsOverview/components/Balances/Balances.d.ts.map +1 -0
- package/dist/types/components/external/TransactionsOverview/components/Balances/constants.d.ts +2 -0
- package/dist/types/components/external/TransactionsOverview/components/Balances/constants.d.ts.map +1 -0
- package/dist/types/components/external/TransactionsOverview/components/Category/Category.d.ts +4 -0
- package/dist/types/components/external/TransactionsOverview/components/Category/Category.d.ts.map +1 -0
- package/dist/types/components/external/TransactionsOverview/components/Category/types.d.ts +7 -0
- package/dist/types/components/external/TransactionsOverview/components/Category/types.d.ts.map +1 -0
- package/dist/types/components/external/TransactionsOverview/components/ModalContent.d.ts.map +1 -0
- package/dist/types/components/external/TransactionsOverview/components/MultiSelectionFilter/MultiSelectionFilter.d.ts.map +1 -0
- package/dist/types/components/external/TransactionsOverview/components/MultiSelectionFilter/index.d.ts.map +1 -0
- package/dist/types/components/external/TransactionsOverview/components/MultiSelectionFilter/useMultiSelectionFilter/constants.d.ts.map +1 -0
- package/dist/types/components/external/TransactionsOverview/components/MultiSelectionFilter/useMultiSelectionFilter/index.d.ts.map +1 -0
- package/dist/types/components/external/TransactionsOverview/components/MultiSelectionFilter/useMultiSelectionFilter/types.d.ts.map +1 -0
- package/dist/types/components/external/TransactionsOverview/components/MultiSelectionFilter/useMultiSelectionFilter/useMultiSelectionFilter.d.ts.map +1 -0
- package/dist/types/components/external/TransactionsOverview/components/MultiSelectionFilter/useMultiSelectionFilter/utils.d.ts.map +1 -0
- package/dist/types/components/external/TransactionsOverview/components/SummaryItem/SummaryItem.d.ts +4 -0
- package/dist/types/components/external/TransactionsOverview/components/SummaryItem/SummaryItem.d.ts.map +1 -0
- package/dist/types/components/external/TransactionsOverview/components/SummaryItem/SummaryItemLabel.d.ts +14 -0
- package/dist/types/components/external/TransactionsOverview/components/SummaryItem/SummaryItemLabel.d.ts.map +1 -0
- package/dist/types/components/external/TransactionsOverview/components/SummaryItem/constants.d.ts +8 -0
- package/dist/types/components/external/TransactionsOverview/components/SummaryItem/constants.d.ts.map +1 -0
- package/dist/types/components/external/TransactionsOverview/components/SummaryItem/types.d.ts +36 -0
- package/dist/types/components/external/TransactionsOverview/components/SummaryItem/types.d.ts.map +1 -0
- package/dist/types/components/external/TransactionsOverview/components/TransactionListError/TransactionListError.d.ts +7 -0
- package/dist/types/components/external/TransactionsOverview/components/TransactionListError/TransactionListError.d.ts.map +1 -0
- package/dist/types/components/external/TransactionsOverview/components/TransactionTotalItem/TransactionTotalItem.d.ts +3 -0
- package/dist/types/components/external/TransactionsOverview/components/TransactionTotalItem/TransactionTotalItem.d.ts.map +1 -0
- package/dist/types/components/external/{Transactions → TransactionsOverview}/components/TransactionTotalItem/types.d.ts +2 -0
- package/dist/types/components/external/TransactionsOverview/components/TransactionTotalItem/types.d.ts.map +1 -0
- package/dist/types/components/external/TransactionsOverview/components/TransactionTotals/TotalsCard.d.ts +11 -0
- package/dist/types/components/external/TransactionsOverview/components/TransactionTotals/TotalsCard.d.ts.map +1 -0
- package/dist/types/components/external/{Transactions → TransactionsOverview}/components/TransactionTotals/TransactionTotals.d.ts +3 -1
- package/dist/types/components/external/TransactionsOverview/components/TransactionTotals/TransactionTotals.d.ts.map +1 -0
- package/dist/types/components/external/TransactionsOverview/components/TransactionTotals/constants.d.ts +3 -0
- package/dist/types/components/external/TransactionsOverview/components/TransactionTotals/constants.d.ts.map +1 -0
- package/dist/types/components/external/TransactionsOverview/components/TransactionsDisplay/TransactionsDisplay.d.ts +5 -0
- package/dist/types/components/external/TransactionsOverview/components/TransactionsDisplay/TransactionsDisplay.d.ts.map +1 -0
- package/dist/types/components/external/TransactionsOverview/components/TransactionsDisplay/constants.d.ts +3 -0
- package/dist/types/components/external/TransactionsOverview/components/TransactionsDisplay/constants.d.ts.map +1 -0
- package/dist/types/components/external/TransactionsOverview/components/TransactionsDisplay/types.d.ts +5 -0
- package/dist/types/components/external/TransactionsOverview/components/TransactionsDisplay/types.d.ts.map +1 -0
- package/dist/types/components/external/{Transactions/components → TransactionsOverview/components/TransactionsOverview}/TransactionsOverview.d.ts +2 -1
- package/dist/types/components/external/TransactionsOverview/components/TransactionsOverview/TransactionsOverview.d.ts.map +1 -0
- package/dist/types/components/external/TransactionsOverview/components/TransactionsOverview/constants.d.ts +4 -0
- package/dist/types/components/external/TransactionsOverview/components/TransactionsOverview/constants.d.ts.map +1 -0
- package/dist/types/components/external/TransactionsOverview/components/TransactionsOverviewContainer/TransactionsOverviewContainer.d.ts +6 -0
- package/dist/types/components/external/TransactionsOverview/components/TransactionsOverviewContainer/TransactionsOverviewContainer.d.ts.map +1 -0
- package/dist/types/components/external/TransactionsOverview/components/TransactionsOverviewContainer/constants.d.ts +3 -0
- package/dist/types/components/external/TransactionsOverview/components/TransactionsOverviewContainer/constants.d.ts.map +1 -0
- package/dist/types/components/external/TransactionsOverview/components/TransactionsOverviewDateFilter.d.ts.map +1 -0
- package/dist/types/components/external/TransactionsOverview/components/TransactionsTable/TransactionsTable.d.ts +5 -0
- package/dist/types/components/external/TransactionsOverview/components/TransactionsTable/TransactionsTable.d.ts.map +1 -0
- package/dist/types/components/external/TransactionsOverview/components/TransactionsTable/constants.d.ts +6 -0
- package/dist/types/components/external/TransactionsOverview/components/TransactionsTable/constants.d.ts.map +1 -0
- package/dist/types/components/external/TransactionsOverview/components/TransactionsTable/types.d.ts +18 -0
- package/dist/types/components/external/TransactionsOverview/components/TransactionsTable/types.d.ts.map +1 -0
- package/dist/types/components/external/{Transactions → TransactionsOverview}/components/utils.d.ts +2 -2
- package/dist/types/components/external/TransactionsOverview/components/utils.d.ts.map +1 -0
- package/dist/types/components/external/{Transactions → TransactionsOverview}/hooks/useDefaultTransactionsOverviewFilterParams.d.ts +1 -0
- package/dist/types/components/external/TransactionsOverview/hooks/useDefaultTransactionsOverviewFilterParams.d.ts.map +1 -0
- package/dist/types/components/external/TransactionsOverview/hooks/useMaxWidths.d.ts.map +1 -0
- package/dist/types/components/external/TransactionsOverview/hooks/useMediaQuery.d.ts +26 -0
- package/dist/types/components/external/TransactionsOverview/hooks/useMediaQuery.d.ts.map +1 -0
- package/dist/types/components/external/TransactionsOverview/hooks/useTransactionsOverviewMultiSelectionFilters.d.ts.map +1 -0
- package/dist/types/components/external/TransactionsOverview/index.d.ts +3 -0
- package/dist/types/components/external/TransactionsOverview/index.d.ts.map +1 -0
- package/dist/types/components/external/{Transactions → TransactionsOverview}/types.d.ts +3 -15
- package/dist/types/components/external/TransactionsOverview/types.d.ts.map +1 -0
- package/dist/types/components/external/index.d.ts +1 -1
- package/dist/types/components/external/index.d.ts.map +1 -1
- package/dist/types/components/internal/BaseButton/BaseButton.d.ts.map +1 -1
- package/dist/types/components/internal/BaseButton/constants.d.ts +1 -1
- package/dist/types/components/internal/BaseButton/types.d.ts +1 -0
- package/dist/types/components/internal/BaseButton/types.d.ts.map +1 -1
- package/dist/types/components/internal/BaseList/constants.d.ts +1 -1
- package/dist/types/components/internal/Button/constants.d.ts +1 -1
- package/dist/types/components/internal/Calendar/calendar/facade/Calendar.d.ts.map +1 -1
- package/dist/types/components/internal/CopyText/CopyText.d.ts +6 -0
- package/dist/types/components/internal/CopyText/CopyText.d.ts.map +1 -0
- package/dist/types/components/internal/DataGrid/DataGrid.d.ts +2 -0
- package/dist/types/components/internal/DataGrid/DataGrid.d.ts.map +1 -1
- package/dist/types/components/internal/DataGrid/components/InteractiveBody.d.ts +1 -1
- package/dist/types/components/internal/DataGrid/components/InteractiveBody.d.ts.map +1 -1
- package/dist/types/components/internal/DataGrid/components/TableBody.d.ts +1 -1
- package/dist/types/components/internal/DataGrid/components/TableBody.d.ts.map +1 -1
- package/dist/types/components/internal/DataGrid/components/TableCells.d.ts +2 -1
- package/dist/types/components/internal/DataGrid/components/TableCells.d.ts.map +1 -1
- package/dist/types/components/internal/DataGrid/types.d.ts +2 -0
- package/dist/types/components/internal/DataGrid/types.d.ts.map +1 -1
- package/dist/types/components/internal/DatePicker/components/TimeRangeSelector/TimeRangeSelector.d.ts.map +1 -1
- package/dist/types/components/internal/ErrorMessageDisplay/ErrorMessageDisplay.d.ts +5 -1
- package/dist/types/components/internal/ErrorMessageDisplay/ErrorMessageDisplay.d.ts.map +1 -1
- package/dist/types/components/internal/ExpandableCard/ExpandableCard.d.ts +1 -1
- package/dist/types/components/internal/ExpandableCard/ExpandableCard.d.ts.map +1 -1
- package/dist/types/components/internal/ExpandableCard/constants.d.ts +1 -1
- package/dist/types/components/internal/ExpandableCard/types.d.ts +5 -0
- package/dist/types/components/internal/ExpandableCard/types.d.ts.map +1 -1
- package/dist/types/components/internal/FilterBar/FilterBar.d.ts.map +1 -1
- package/dist/types/components/internal/FilterBar/filters/AmountFilter/AmountFilter.d.ts.map +1 -1
- package/dist/types/components/internal/FilterBar/filters/AmountFilter/RangeSelection.d.ts +1 -1
- package/dist/types/components/internal/FilterBar/filters/AmountFilter/RangeSelection.d.ts.map +1 -1
- package/dist/types/components/internal/FilterBar/filters/AmountFilter/constants.d.ts +2 -0
- package/dist/types/components/internal/FilterBar/filters/AmountFilter/constants.d.ts.map +1 -0
- package/dist/types/components/internal/FilterBar/filters/AmountFilter/types.d.ts +0 -2
- package/dist/types/components/internal/FilterBar/filters/AmountFilter/types.d.ts.map +1 -1
- package/dist/types/components/internal/FilterBar/filters/BaseFilter/BaseFilter.d.ts +0 -1
- package/dist/types/components/internal/FilterBar/filters/BaseFilter/BaseFilter.d.ts.map +1 -1
- package/dist/types/components/internal/FilterBar/filters/DateFilter/DateFilter.d.ts.map +1 -1
- package/dist/types/components/internal/FormFields/Select/Select.d.ts +1 -1
- package/dist/types/components/internal/FormFields/Select/Select.d.ts.map +1 -1
- package/dist/types/components/internal/FormFields/Select/components/SelectList.d.ts.map +1 -1
- package/dist/types/components/internal/FormFields/Select/constants.d.ts +1 -1
- package/dist/types/components/internal/FormFields/Select/types.d.ts +9 -0
- package/dist/types/components/internal/FormFields/Select/types.d.ts.map +1 -1
- package/dist/types/components/internal/FormFields/index.d.ts +3 -18
- package/dist/types/components/internal/FormFields/index.d.ts.map +1 -1
- package/dist/types/components/internal/Img/types.d.ts +1 -1
- package/dist/types/components/internal/Modal/Modal.d.ts.map +1 -1
- package/dist/types/components/internal/Pagination/Pagination.d.ts.map +1 -1
- package/dist/types/components/internal/Pagination/constants.d.ts.map +1 -1
- package/dist/types/components/internal/Pagination/hooks/types.d.ts +3 -3
- package/dist/types/components/internal/Pagination/hooks/types.d.ts.map +1 -1
- package/dist/types/components/internal/Pagination/hooks/usePaginatedRecords.d.ts.map +1 -1
- package/dist/types/components/internal/Pagination/hooks/usePagination.d.ts.map +1 -1
- package/dist/types/components/internal/Pagination/types.d.ts +2 -1
- package/dist/types/components/internal/Pagination/types.d.ts.map +1 -1
- package/dist/types/components/internal/Popover/Popover.d.ts +1 -2
- package/dist/types/components/internal/Popover/Popover.d.ts.map +1 -1
- package/dist/types/components/internal/Popover/constants.d.ts +3 -1
- package/dist/types/components/internal/Popover/constants.d.ts.map +1 -1
- package/dist/types/components/internal/Popover/types.d.ts +6 -0
- package/dist/types/components/internal/Popover/types.d.ts.map +1 -1
- package/dist/types/components/internal/Popover/utils/popoverUtil.d.ts +7 -0
- package/dist/types/components/internal/Popover/utils/popoverUtil.d.ts.map +1 -0
- package/dist/types/components/internal/SVGIcons/Close.d.ts +4 -0
- package/dist/types/components/internal/SVGIcons/Close.d.ts.map +1 -0
- package/dist/types/components/internal/SVGIcons/Copy.d.ts +4 -0
- package/dist/types/components/internal/SVGIcons/Copy.d.ts.map +1 -0
- package/dist/types/components/internal/SVGIcons/Filter.d.ts +4 -0
- package/dist/types/components/internal/SVGIcons/Filter.d.ts.map +1 -0
- package/dist/types/components/internal/Tooltip/Tooltip.d.ts +5 -0
- package/dist/types/components/internal/Tooltip/Tooltip.d.ts.map +1 -0
- package/dist/types/components/internal/Tooltip/types.d.ts +13 -0
- package/dist/types/components/internal/Tooltip/types.d.ts.map +1 -0
- package/dist/types/components/internal/Tooltip/useTooltipListeners.d.ts +12 -0
- package/dist/types/components/internal/Tooltip/useTooltipListeners.d.ts.map +1 -0
- package/dist/types/components/internal/Typography/constants.d.ts +1 -1
- package/dist/types/components/utils/transactionResourceErrorCodes.d.ts +6 -2
- package/dist/types/components/utils/transactionResourceErrorCodes.d.ts.map +1 -1
- package/dist/types/constants.d.ts +6 -0
- package/dist/types/constants.d.ts.map +1 -0
- package/dist/types/core/Auth/AuthContext.d.ts +2 -2
- package/dist/types/core/Auth/AuthContext.d.ts.map +1 -1
- package/dist/types/core/Auth/AuthProvider.d.ts.map +1 -1
- package/dist/types/core/Auth/types.d.ts +9 -2
- package/dist/types/core/Auth/types.d.ts.map +1 -1
- package/dist/types/core/Auth/useAuthContext.d.ts +1 -1
- package/dist/types/core/Auth/useAuthContext.d.ts.map +1 -1
- package/dist/types/core/Errors/AdyenPlatformExperienceError.d.ts +9 -0
- package/dist/types/core/Errors/AdyenPlatformExperienceError.d.ts.map +1 -0
- package/dist/types/core/Localization/Localization.d.ts +7 -0
- package/dist/types/core/Localization/Localization.d.ts.map +1 -1
- package/dist/types/core/Localization/constants/locale.d.ts +17 -7
- package/dist/types/core/Localization/constants/locale.d.ts.map +1 -1
- package/dist/types/core/Localization/localization-utils.d.ts +1 -0
- package/dist/types/core/Localization/localization-utils.d.ts.map +1 -1
- package/dist/types/core/Localization/translations/index.d.ts +17 -7
- package/dist/types/core/Localization/translations/index.d.ts.map +1 -1
- package/dist/types/core/Localization/utils.d.ts +17 -7
- package/dist/types/core/Localization/utils.d.ts.map +1 -1
- package/dist/types/core/Services/requests/http.d.ts.map +1 -1
- package/dist/types/core/Services/requests/types.d.ts +2 -0
- package/dist/types/core/Services/requests/types.d.ts.map +1 -1
- package/dist/types/core/Services/requests/utils.d.ts +2 -1
- package/dist/types/core/Services/requests/utils.d.ts.map +1 -1
- package/dist/types/core/core.d.ts +1 -0
- package/dist/types/core/core.d.ts.map +1 -1
- package/dist/types/core/types.d.ts +1 -0
- package/dist/types/core/types.d.ts.map +1 -1
- package/dist/types/hooks/element/useClickOutside.d.ts +5 -1
- package/dist/types/hooks/element/useClickOutside.d.ts.map +1 -1
- package/dist/types/hooks/element/usePopoverPositioner.d.ts +2 -2
- package/dist/types/hooks/element/usePopoverPositioner.d.ts.map +1 -1
- package/dist/types/hooks/useSessionAwareRequest/useSessionAwareRequest.d.ts.map +1 -1
- package/dist/types/index.d.ts +1 -1
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/utils/types.d.ts +1 -1
- package/dist/types/utils/types.d.ts.map +1 -1
- package/dist/types-0027b7c2.mjs +9 -0
- package/dist/types-0aaff3aa.mjs +19 -0
- package/dist/types-7ad6576a.mjs +10 -0
- package/dist/types-deec0d78.mjs +14 -0
- package/dist/types-e6a6a3ff.mjs +9 -0
- package/dist/usePaginatedRecords-63a69bf1.mjs +131 -0
- package/dist/usePopoverPositioner-882fea89.mjs +182 -0
- package/dist/vendor-vi.a3ff54b1-5e924357.mjs +22389 -0
- package/package.json +9 -8
- package/dist/ModalContent-e2777391.js +0 -2
- package/dist/ModalContent-e2777391.js.map +0 -1
- package/dist/es/components/external/TransactionDetails/components/TransactionDetails.scss.js +0 -4
- package/dist/es/components/external/Transactions/TransactionsOverviewElement.js +0 -28
- package/dist/es/components/external/Transactions/components/AmountSkeleton/AmountSkeleton.js +0 -9
- package/dist/es/components/external/Transactions/components/AmountSkeleton/AmountSkeleton.scss.js +0 -4
- package/dist/es/components/external/Transactions/components/AmountSkeleton/constants.js +0 -6
- package/dist/es/components/external/Transactions/components/BalanceAccountSelector/BalanceAccountSelector.js +0 -23
- package/dist/es/components/external/Transactions/components/BalanceAccountSelector/useBalanceAccountSelection.js +0 -17
- package/dist/es/components/external/Transactions/components/BalanceItem/BalanceItem.js +0 -35
- package/dist/es/components/external/Transactions/components/Balances/Balances.js +0 -49
- package/dist/es/components/external/Transactions/components/Balances/constants.js +0 -4
- package/dist/es/components/external/Transactions/components/ModalContent.js +0 -12
- package/dist/es/components/external/Transactions/components/MultiSelectionFilter/MultiSelectionFilter.js +0 -25
- package/dist/es/components/external/Transactions/components/MultiSelectionFilter/useMultiSelectionFilter/constants.js +0 -24
- package/dist/es/components/external/Transactions/components/MultiSelectionFilter/useMultiSelectionFilter/useMultiSelectionFilter.js +0 -21
- package/dist/es/components/external/Transactions/components/MultiSelectionFilter/useMultiSelectionFilter/utils.js +0 -9
- package/dist/es/components/external/Transactions/components/SummaryItem/SummaryItem.js +0 -42
- package/dist/es/components/external/Transactions/components/SummaryItem/SummaryItem.scss.js +0 -4
- package/dist/es/components/external/Transactions/components/SummaryItem/constants.js +0 -8
- package/dist/es/components/external/Transactions/components/TransactionList.js +0 -130
- package/dist/es/components/external/Transactions/components/TransactionList.scss.js +0 -4
- package/dist/es/components/external/Transactions/components/TransactionListError/TransactionListError.js +0 -20
- package/dist/es/components/external/Transactions/components/TransactionTotalItem/TransactionTotalItem.js +0 -48
- package/dist/es/components/external/Transactions/components/TransactionTotals/TransactionTotals.js +0 -66
- package/dist/es/components/external/Transactions/components/TransactionTotals/constants.js +0 -4
- package/dist/es/components/external/Transactions/components/TransactionsOverview.js +0 -151
- package/dist/es/components/external/Transactions/components/TransactionsOverviewContainer.js +0 -36
- package/dist/es/components/external/Transactions/components/TransactionsOverviewDateFilter.js +0 -61
- package/dist/es/components/external/Transactions/hooks/useDefaultTransactionsOverviewFilterParams.js +0 -22
- package/dist/es/components/external/Transactions/hooks/useMaxWidths.js +0 -15
- package/dist/es/components/external/Transactions/hooks/useTransactionsOverviewMultiSelectionFilters.js +0 -29
- package/dist/es/components/external/Transactions/types.js +0 -4
- package/dist/es/components/internal/BaseButton/BaseButton.scss.js +0 -4
- package/dist/es/components/internal/BaseList/BaseList.scss.js +0 -4
- package/dist/es/components/internal/Button/Button.scss.js +0 -4
- package/dist/es/components/internal/Button/ButtonActions/ButtonActions.scss.js +0 -4
- package/dist/es/components/internal/Button/ButtonActions/types.js +0 -7
- package/dist/es/components/internal/Button/types.js +0 -4
- package/dist/es/components/internal/Calendar/Calendar.scss.js +0 -4
- package/dist/es/components/internal/Calendar/calendar/types.js +0 -15
- package/dist/es/components/internal/Calendar/types.js +0 -4
- package/dist/es/components/internal/DataGrid/DataGrid.scss.js +0 -4
- package/dist/es/components/internal/DataGrid/types.js +0 -4
- package/dist/es/components/internal/DatePicker/DatePicker.scss.js +0 -4
- package/dist/es/components/internal/ErrorMessageDisplay/ErrorMessageDisplay.scss.js +0 -4
- package/dist/es/components/internal/ExpandableCard/ExpandableCard.scss.js +0 -4
- package/dist/es/components/internal/FilterBar/FilterBar.scss.js +0 -4
- package/dist/es/components/internal/FilterBar/components/FilterButton/FilterButton.scss.js +0 -4
- package/dist/es/components/internal/FilterBar/filters/AmountFilter/AmountFilter.scss.js +0 -4
- package/dist/es/components/internal/FilterBar/filters/BaseFilter/BaseFilter.scss.js +0 -4
- package/dist/es/components/internal/FilterBar/filters/DateFilter/DateFilter.scss.js +0 -4
- package/dist/es/components/internal/FilterBar/filters/DateFilter/types.js +0 -4
- package/dist/es/components/internal/FormFields/FormFields.scss.js +0 -4
- package/dist/es/components/internal/FormFields/Select/Select.scss.js +0 -4
- package/dist/es/components/internal/Img/Img.scss.js +0 -4
- package/dist/es/components/internal/Modal/Modal.scss.js +0 -4
- package/dist/es/components/internal/Pagination/Pagination.scss.js +0 -4
- package/dist/es/components/internal/Pagination/types.js +0 -5
- package/dist/es/components/internal/Popover/Popover.scss.js +0 -4
- package/dist/es/components/internal/Popover/PopoverContainer.scss.js +0 -4
- package/dist/es/components/internal/Popover/PopoverDismissButton/PopoverDismissButton.scss.js +0 -4
- package/dist/es/components/internal/Popover/types.js +0 -6
- package/dist/es/components/internal/Spinner/Spinner.scss.js +0 -4
- package/dist/es/components/internal/Tag/Tag.scss.js +0 -4
- package/dist/es/components/internal/Tag/types.js +0 -4
- package/dist/es/components/internal/Typography/Typography.scss.js +0 -4
- package/dist/es/components/internal/Typography/types.js +0 -6
- package/dist/es/components/shared.scss.js +0 -4
- package/dist/es/components/types.js +0 -4
- package/dist/es/core/Errors/AdyenFPError.js +0 -15
- package/dist/es/core/Localization/translations/ar.json.js +0 -4
- package/dist/es/core/Localization/translations/cs-CZ.json.js +0 -4
- package/dist/es/core/Localization/translations/da-DK.json.js +0 -4
- package/dist/es/core/Localization/translations/de-DE.json.js +0 -4
- package/dist/es/core/Localization/translations/el-GR.json.js +0 -4
- package/dist/es/core/Localization/translations/en-US.json.js +0 -358
- package/dist/es/core/Localization/translations/es-ES.json.js +0 -255
- package/dist/es/core/Localization/translations/fi-FI.json.js +0 -4
- package/dist/es/core/Localization/translations/fr-FR.json.js +0 -4
- package/dist/es/core/Localization/translations/hr-HR.json.js +0 -4
- package/dist/es/core/Localization/translations/hu-HU.json.js +0 -4
- package/dist/es/core/Localization/translations/it-IT.json.js +0 -4
- package/dist/es/core/Localization/translations/ja-JP.json.js +0 -4
- package/dist/es/core/Localization/translations/ko-KR.json.js +0 -4
- package/dist/es/core/Localization/translations/nl-NL.json.js +0 -4
- package/dist/es/core/Localization/translations/no-NO.json.js +0 -4
- package/dist/es/core/Localization/translations/pl-PL.json.js +0 -4
- package/dist/es/core/Localization/translations/pt-BR.json.js +0 -4
- package/dist/es/core/Localization/translations/pt-PT.json.js +0 -4
- package/dist/es/core/Localization/translations/ro-RO.json.js +0 -4
- package/dist/es/core/Localization/translations/ru-RU.json.js +0 -4
- package/dist/es/core/Localization/translations/sk-SK.json.js +0 -4
- package/dist/es/core/Localization/translations/sl-SI.json.js +0 -4
- package/dist/es/core/Localization/translations/sv-SE.json.js +0 -4
- package/dist/es/core/Localization/translations/zh-CN.json.js +0 -4
- package/dist/es/core/Localization/translations/zh-TW.json.js +0 -4
- package/dist/es/external/preact/compat/dist/compat.module.js +0 -253
- package/dist/es/external/preact/dist/preact.module.js +0 -309
- package/dist/es/external/preact/hooks/dist/hooks.module.js +0 -161
- package/dist/es/external/preact/jsx-runtime/dist/jsxRuntime.module.js +0 -19
- package/dist/es/hooks/useCommitAction/types.js +0 -4
- package/dist/es/hooks/useModalDetails/types.js +0 -6
- package/dist/es/images/no-data-female.svg.js +0 -4
- package/dist/es/images/no-results.svg.js +0 -4
- package/dist/es/style/index.scss.js +0 -4
- package/dist/index-0c9f4def.js +0 -12
- package/dist/index-0c9f4def.js.map +0 -1
- package/dist/style.css +0 -1
- package/dist/types/components/external/Transactions/TransactionsOverviewElement.d.ts.map +0 -1
- package/dist/types/components/external/Transactions/components/AmountSkeleton/AmountSkeleton.d.ts.map +0 -1
- package/dist/types/components/external/Transactions/components/AmountSkeleton/constants.d.ts +0 -4
- package/dist/types/components/external/Transactions/components/AmountSkeleton/constants.d.ts.map +0 -1
- package/dist/types/components/external/Transactions/components/AmountSkeleton/types.d.ts.map +0 -1
- package/dist/types/components/external/Transactions/components/BalanceAccountSelector/BalanceAccountSelector.d.ts.map +0 -1
- package/dist/types/components/external/Transactions/components/BalanceAccountSelector/index.d.ts.map +0 -1
- package/dist/types/components/external/Transactions/components/BalanceAccountSelector/useBalanceAccountSelection.d.ts.map +0 -1
- package/dist/types/components/external/Transactions/components/BalanceItem/BalanceItem.d.ts.map +0 -1
- package/dist/types/components/external/Transactions/components/BalanceItem/types.d.ts.map +0 -1
- package/dist/types/components/external/Transactions/components/Balances/Balances.d.ts.map +0 -1
- package/dist/types/components/external/Transactions/components/Balances/constants.d.ts +0 -2
- package/dist/types/components/external/Transactions/components/Balances/constants.d.ts.map +0 -1
- package/dist/types/components/external/Transactions/components/ModalContent.d.ts.map +0 -1
- package/dist/types/components/external/Transactions/components/MultiSelectionFilter/MultiSelectionFilter.d.ts.map +0 -1
- package/dist/types/components/external/Transactions/components/MultiSelectionFilter/index.d.ts.map +0 -1
- package/dist/types/components/external/Transactions/components/MultiSelectionFilter/useMultiSelectionFilter/constants.d.ts.map +0 -1
- package/dist/types/components/external/Transactions/components/MultiSelectionFilter/useMultiSelectionFilter/index.d.ts.map +0 -1
- package/dist/types/components/external/Transactions/components/MultiSelectionFilter/useMultiSelectionFilter/types.d.ts.map +0 -1
- package/dist/types/components/external/Transactions/components/MultiSelectionFilter/useMultiSelectionFilter/useMultiSelectionFilter.d.ts.map +0 -1
- package/dist/types/components/external/Transactions/components/MultiSelectionFilter/useMultiSelectionFilter/utils.d.ts.map +0 -1
- package/dist/types/components/external/Transactions/components/SummaryItem/SummaryItem.d.ts +0 -4
- package/dist/types/components/external/Transactions/components/SummaryItem/SummaryItem.d.ts.map +0 -1
- package/dist/types/components/external/Transactions/components/SummaryItem/constants.d.ts +0 -6
- package/dist/types/components/external/Transactions/components/SummaryItem/constants.d.ts.map +0 -1
- package/dist/types/components/external/Transactions/components/SummaryItem/types.d.ts +0 -20
- package/dist/types/components/external/Transactions/components/SummaryItem/types.d.ts.map +0 -1
- package/dist/types/components/external/Transactions/components/TransactionList.d.ts +0 -6
- package/dist/types/components/external/Transactions/components/TransactionList.d.ts.map +0 -1
- package/dist/types/components/external/Transactions/components/TransactionListError/TransactionListError.d.ts +0 -7
- package/dist/types/components/external/Transactions/components/TransactionListError/TransactionListError.d.ts.map +0 -1
- package/dist/types/components/external/Transactions/components/TransactionTotalItem/TransactionTotalItem.d.ts +0 -3
- package/dist/types/components/external/Transactions/components/TransactionTotalItem/TransactionTotalItem.d.ts.map +0 -1
- package/dist/types/components/external/Transactions/components/TransactionTotalItem/types.d.ts.map +0 -1
- package/dist/types/components/external/Transactions/components/TransactionTotals/TransactionTotals.d.ts.map +0 -1
- package/dist/types/components/external/Transactions/components/TransactionTotals/constants.d.ts +0 -2
- package/dist/types/components/external/Transactions/components/TransactionTotals/constants.d.ts.map +0 -1
- package/dist/types/components/external/Transactions/components/TransactionsOverview.d.ts.map +0 -1
- package/dist/types/components/external/Transactions/components/TransactionsOverviewContainer.d.ts +0 -6
- package/dist/types/components/external/Transactions/components/TransactionsOverviewContainer.d.ts.map +0 -1
- package/dist/types/components/external/Transactions/components/TransactionsOverviewDateFilter.d.ts.map +0 -1
- package/dist/types/components/external/Transactions/components/utils.d.ts.map +0 -1
- package/dist/types/components/external/Transactions/hooks/useDefaultTransactionsOverviewFilterParams.d.ts.map +0 -1
- package/dist/types/components/external/Transactions/hooks/useMaxWidths.d.ts.map +0 -1
- package/dist/types/components/external/Transactions/hooks/useTransactionsOverviewMultiSelectionFilters.d.ts.map +0 -1
- package/dist/types/components/external/Transactions/index.d.ts +0 -3
- package/dist/types/components/external/Transactions/index.d.ts.map +0 -1
- package/dist/types/components/external/Transactions/types.d.ts.map +0 -1
- package/dist/types/components/internal/FormFields/Checkbox/Checkbox.d.ts +0 -22
- package/dist/types/components/internal/FormFields/Checkbox/Checkbox.d.ts.map +0 -1
- package/dist/types/components/internal/FormFields/Checkbox/index.d.ts +0 -2
- package/dist/types/components/internal/FormFields/Checkbox/index.d.ts.map +0 -1
- package/dist/types/components/internal/FormFields/InputDate/InputDate.d.ts +0 -3
- package/dist/types/components/internal/FormFields/InputDate/InputDate.d.ts.map +0 -1
- package/dist/types/components/internal/FormFields/InputDate/index.d.ts +0 -2
- package/dist/types/components/internal/FormFields/InputDate/index.d.ts.map +0 -1
- package/dist/types/components/internal/FormFields/InputDate/utils.d.ts +0 -22
- package/dist/types/components/internal/FormFields/InputDate/utils.d.ts.map +0 -1
- package/dist/types/components/internal/FormFields/InputEmail.d.ts +0 -3
- package/dist/types/components/internal/FormFields/InputEmail.d.ts.map +0 -1
- package/dist/types/components/internal/FormFields/InputTelephone.d.ts +0 -3
- package/dist/types/components/internal/FormFields/InputTelephone.d.ts.map +0 -1
- package/dist/types/components/internal/FormFields/RadioGroup/RadioGroup.d.ts +0 -11
- package/dist/types/components/internal/FormFields/RadioGroup/RadioGroup.d.ts.map +0 -1
- package/dist/types/components/internal/FormFields/RadioGroup/index.d.ts +0 -2
- package/dist/types/components/internal/FormFields/RadioGroup/index.d.ts.map +0 -1
- package/dist/types/components/internal/FormFields/RadioGroup/types.d.ts +0 -19
- package/dist/types/components/internal/FormFields/RadioGroup/types.d.ts.map +0 -1
- package/dist/types/core/Errors/AdyenFPError.d.ts +0 -8
- package/dist/types/core/Errors/AdyenFPError.d.ts.map +0 -1
- /package/dist/types/components/external/{Transactions → TransactionsOverview}/TransactionsOverviewElement.d.ts +0 -0
- /package/dist/types/components/external/{Transactions → TransactionsOverview}/components/AmountSkeleton/types.d.ts +0 -0
- /package/dist/types/components/external/{Transactions → TransactionsOverview}/components/BalanceAccountSelector/index.d.ts +0 -0
- /package/dist/types/components/external/{Transactions → TransactionsOverview}/components/BalanceAccountSelector/useBalanceAccountSelection.d.ts +0 -0
- /package/dist/types/components/external/{Transactions → TransactionsOverview}/components/BalanceItem/types.d.ts +0 -0
- /package/dist/types/components/external/{Transactions → TransactionsOverview}/components/ModalContent.d.ts +0 -0
- /package/dist/types/components/external/{Transactions → TransactionsOverview}/components/MultiSelectionFilter/MultiSelectionFilter.d.ts +0 -0
- /package/dist/types/components/external/{Transactions → TransactionsOverview}/components/MultiSelectionFilter/index.d.ts +0 -0
- /package/dist/types/components/external/{Transactions → TransactionsOverview}/components/MultiSelectionFilter/useMultiSelectionFilter/constants.d.ts +0 -0
- /package/dist/types/components/external/{Transactions → TransactionsOverview}/components/MultiSelectionFilter/useMultiSelectionFilter/index.d.ts +0 -0
- /package/dist/types/components/external/{Transactions → TransactionsOverview}/components/MultiSelectionFilter/useMultiSelectionFilter/types.d.ts +0 -0
- /package/dist/types/components/external/{Transactions → TransactionsOverview}/components/MultiSelectionFilter/useMultiSelectionFilter/useMultiSelectionFilter.d.ts +0 -0
- /package/dist/types/components/external/{Transactions → TransactionsOverview}/components/MultiSelectionFilter/useMultiSelectionFilter/utils.d.ts +0 -0
- /package/dist/types/components/external/{Transactions → TransactionsOverview}/components/TransactionsOverviewDateFilter.d.ts +0 -0
- /package/dist/types/components/external/{Transactions → TransactionsOverview}/hooks/useMaxWidths.d.ts +0 -0
- /package/dist/types/components/external/{Transactions → TransactionsOverview}/hooks/useTransactionsOverviewMultiSelectionFilters.d.ts +0 -0
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import { getDateRangeContext, TIMEZONE_TESTS_TIMESTAMPS } from "./testing/fixtures.js";
|
|
2
|
+
import { asTimestamp } from "./testing/helpers.js";
|
|
3
|
+
import lastNDays, { DEFAULT_NUM_DAYS } from "./lastNDays.js";
|
|
4
|
+
import { d as describe, t as test, g as globalExpect, v as vi } from "../../../../../../../vendor-vi.a3ff54b1-5e924357.mjs";
|
|
5
|
+
describe("last {n} days", () => {
|
|
6
|
+
test("should use normalized (clamped) numberOfDays integer", () => {
|
|
7
|
+
const ABOVE_MAX_VALUES = [10240, 720, 366];
|
|
8
|
+
const BELOW_MIN_VALUES = [-5120, -256, -1, -0, 0];
|
|
9
|
+
const DECIMAL_VALUES = [-3564.456, -37.3671, -1.5, 0.4775, 23.5783, 38858.343];
|
|
10
|
+
const INVALID_VALUES = [NaN, Infinity, -Infinity, () => {
|
|
11
|
+
}, {}, [43]];
|
|
12
|
+
(/* @__PURE__ */ new Map([
|
|
13
|
+
[ABOVE_MAX_VALUES, DEFAULT_NUM_DAYS],
|
|
14
|
+
[BELOW_MIN_VALUES, DEFAULT_NUM_DAYS],
|
|
15
|
+
[DECIMAL_VALUES, DEFAULT_NUM_DAYS],
|
|
16
|
+
[INVALID_VALUES, DEFAULT_NUM_DAYS]
|
|
17
|
+
])).forEach((numberOfDays2, values) => {
|
|
18
|
+
values.forEach((N) => {
|
|
19
|
+
globalExpect(getDateRangeContext(() => lastNDays(N)).numberOfDays).toBe(numberOfDays2);
|
|
20
|
+
});
|
|
21
|
+
});
|
|
22
|
+
});
|
|
23
|
+
const lastNDaysTimestamps = getDateRangeContext(lastNDays);
|
|
24
|
+
const numberOfDays = [
|
|
25
|
+
/* default */
|
|
26
|
+
void 0,
|
|
27
|
+
3,
|
|
28
|
+
7,
|
|
29
|
+
10,
|
|
30
|
+
25,
|
|
31
|
+
100
|
|
32
|
+
];
|
|
33
|
+
test.each(numberOfDays)(`should be {N} days before now day (N => %i)`, (numberOfDaysParam) => {
|
|
34
|
+
lastNDaysTimestamps.numberOfDays = numberOfDaysParam;
|
|
35
|
+
const { numberOfDays: numberOfDays2, fromDate, now } = lastNDaysTimestamps;
|
|
36
|
+
const date = new Date(fromDate);
|
|
37
|
+
const withinLastNDays = vi.fn();
|
|
38
|
+
while (date.getTime() <= now) {
|
|
39
|
+
withinLastNDays();
|
|
40
|
+
date.setDate(date.getDate() + 1);
|
|
41
|
+
}
|
|
42
|
+
globalExpect(withinLastNDays).toHaveBeenCalledTimes(numberOfDays2);
|
|
43
|
+
});
|
|
44
|
+
test.each(numberOfDays)(`should have precise timestamps (N => %i)`, (numberOfDaysParam) => {
|
|
45
|
+
lastNDaysTimestamps.numberOfDays = numberOfDaysParam;
|
|
46
|
+
const { from, fromDate, now, to } = lastNDaysTimestamps;
|
|
47
|
+
const dateBefore = new Date(from - 1);
|
|
48
|
+
globalExpect(to).toBe(now);
|
|
49
|
+
globalExpect(dateBefore.getDay()).toBe((fromDate.getDay() + 6) % 7);
|
|
50
|
+
});
|
|
51
|
+
test("should have precise timestamps for timezone (N => 7)", () => {
|
|
52
|
+
const range = getDateRangeContext(() => lastNDays(7));
|
|
53
|
+
const { now: initialNow, timezone: initialTimezone } = range;
|
|
54
|
+
const TIMEZONES = /* @__PURE__ */ new Map([
|
|
55
|
+
["America/Toronto", asTimestamp(["Apr 9, 2022, 12:00 AM GMT-4", "Dec 25, 2023, 12:00 AM GMT-5", "Dec 25, 2023, 12:00 AM GMT-5"])],
|
|
56
|
+
["Asia/Tokyo", asTimestamp(["Apr 9, 2022, 12:00 AM GMT+9", "Dec 26, 2023, 12:00 AM GMT+9", "Dec 26, 2023, 12:00 AM GMT+9"])]
|
|
57
|
+
]);
|
|
58
|
+
TIMEZONES.forEach((timestamps, timezone) => {
|
|
59
|
+
range.timezone = timezone;
|
|
60
|
+
TIMEZONE_TESTS_TIMESTAMPS.forEach((timestamp, index) => {
|
|
61
|
+
range.now = timestamp;
|
|
62
|
+
globalExpect(range.from).toBe(timestamps[index]);
|
|
63
|
+
globalExpect(range.to).toBe(timestamp);
|
|
64
|
+
});
|
|
65
|
+
range.now = initialNow;
|
|
66
|
+
range.timezone = initialTimezone;
|
|
67
|
+
});
|
|
68
|
+
});
|
|
69
|
+
});
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
import { getDateRangeContext, TIMEZONE_TESTS_TIMESTAMPS } from "./testing/fixtures.js";
|
|
2
|
+
import { asTimestamp } from "./testing/helpers.js";
|
|
3
|
+
import lastWeek from "./lastWeek.js";
|
|
4
|
+
import { d as describe, t as test, g as globalExpect, v as vi } from "../../../../../../../vendor-vi.a3ff54b1-5e924357.mjs";
|
|
5
|
+
describe("last week", () => {
|
|
6
|
+
const lastWeekTimestamps = getDateRangeContext(lastWeek);
|
|
7
|
+
const firstWeekDays = [
|
|
8
|
+
/* default */
|
|
9
|
+
void 0,
|
|
10
|
+
0,
|
|
11
|
+
1,
|
|
12
|
+
2,
|
|
13
|
+
3,
|
|
14
|
+
4,
|
|
15
|
+
5,
|
|
16
|
+
6
|
|
17
|
+
];
|
|
18
|
+
test.each(firstWeekDays)(`should be previous week (firstWeekDay => %i)`, (firstWeekDayParam) => {
|
|
19
|
+
lastWeekTimestamps.firstWeekDay = firstWeekDayParam;
|
|
20
|
+
const { firstWeekDay, fromDate, nowDate, to, toDate } = lastWeekTimestamps;
|
|
21
|
+
const fromMonth = fromDate.getMonth();
|
|
22
|
+
const fromYear = fromDate.getFullYear();
|
|
23
|
+
const nowMonth = nowDate.getMonth();
|
|
24
|
+
const nowYear = nowDate.getFullYear();
|
|
25
|
+
const toMonth = toDate.getMonth();
|
|
26
|
+
const toYear = toDate.getFullYear();
|
|
27
|
+
const dateOfToday = nowDate.getDate();
|
|
28
|
+
const firstDayOfLastWeek = fromDate.getDate();
|
|
29
|
+
const lastDayOfLastWeek = toDate.getDate();
|
|
30
|
+
globalExpect(fromDate.getDay()).toBe(firstWeekDay);
|
|
31
|
+
globalExpect(toDate.getDay()).toBe((firstWeekDay + 6) % 7);
|
|
32
|
+
if (firstDayOfLastWeek < dateOfToday) {
|
|
33
|
+
globalExpect(fromMonth).toBe(toMonth);
|
|
34
|
+
globalExpect(fromYear).toBe(toYear);
|
|
35
|
+
globalExpect(fromMonth).toBe(nowMonth);
|
|
36
|
+
globalExpect(fromYear).toBe(nowYear);
|
|
37
|
+
} else {
|
|
38
|
+
if (nowMonth === 0) {
|
|
39
|
+
globalExpect(fromMonth).toBe(11);
|
|
40
|
+
globalExpect(fromYear).toBe(nowYear - 1);
|
|
41
|
+
} else {
|
|
42
|
+
globalExpect(fromMonth).toBe(nowMonth - 1);
|
|
43
|
+
globalExpect(fromYear).toBe(nowYear);
|
|
44
|
+
}
|
|
45
|
+
if (lastDayOfLastWeek < dateOfToday) {
|
|
46
|
+
globalExpect(nowMonth).toBe(toMonth);
|
|
47
|
+
globalExpect(nowYear).toBe(toYear);
|
|
48
|
+
} else {
|
|
49
|
+
globalExpect(fromMonth).toBe(toMonth);
|
|
50
|
+
globalExpect(fromYear).toBe(toYear);
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
const date = new Date(fromDate);
|
|
54
|
+
const nowDateStartTimestamp = new Date(nowDate).setHours(0, 0, 0, 0);
|
|
55
|
+
const dayInLastWeek = vi.fn();
|
|
56
|
+
const daySinceLastWeek = vi.fn();
|
|
57
|
+
let timestamp = date.getTime();
|
|
58
|
+
while (timestamp < nowDateStartTimestamp) {
|
|
59
|
+
daySinceLastWeek();
|
|
60
|
+
if (timestamp < to)
|
|
61
|
+
dayInLastWeek();
|
|
62
|
+
timestamp = date.setDate(date.getDate() + 1);
|
|
63
|
+
}
|
|
64
|
+
globalExpect(dayInLastWeek).toHaveBeenCalledTimes(7);
|
|
65
|
+
globalExpect(daySinceLastWeek.mock.calls.length).toBeGreaterThanOrEqual(7);
|
|
66
|
+
});
|
|
67
|
+
test.each(firstWeekDays)(`should have precise timestamps (firstWeekDay => %i)`, (firstWeekDayParam) => {
|
|
68
|
+
lastWeekTimestamps.firstWeekDay = firstWeekDayParam;
|
|
69
|
+
const { firstWeekDay, from, to } = lastWeekTimestamps;
|
|
70
|
+
const dateAfter = new Date(to + 1);
|
|
71
|
+
const dateBefore = new Date(from - 1);
|
|
72
|
+
globalExpect(dateAfter.getDay()).toBe(firstWeekDay);
|
|
73
|
+
globalExpect(dateBefore.getDay()).toBe((firstWeekDay + 6) % 7);
|
|
74
|
+
});
|
|
75
|
+
test("should have precise timestamps for timezone (firstWeekDay => 1)", () => {
|
|
76
|
+
const range = getDateRangeContext(() => lastWeek(1));
|
|
77
|
+
const { now: initialNow, timezone: initialTimezone } = range;
|
|
78
|
+
const TIMEZONES = /* @__PURE__ */ new Map([
|
|
79
|
+
[
|
|
80
|
+
"America/Toronto",
|
|
81
|
+
[
|
|
82
|
+
asTimestamp(["Apr 4, 2022, 12:00 AM GMT-4", "Apr 10, 2022, 23:59:59.999 GMT-4"]),
|
|
83
|
+
asTimestamp(["Dec 18, 2023, 12:00 AM GMT-5", "Dec 24, 2023, 23:59:59.999 GMT-5"]),
|
|
84
|
+
asTimestamp(["Dec 18, 2023, 12:00 AM GMT-5", "Dec 24, 2023, 23:59:59.999 GMT-5"])
|
|
85
|
+
]
|
|
86
|
+
],
|
|
87
|
+
[
|
|
88
|
+
"Asia/Tokyo",
|
|
89
|
+
[
|
|
90
|
+
asTimestamp(["Apr 4, 2022, 12:00 AM GMT+9", "Apr 10, 2022, 23:59:59.999 GMT+9"]),
|
|
91
|
+
asTimestamp(["Dec 25, 2023, 12:00 AM GMT+9", "Dec 31, 2023, 23:59:59.999 GMT+9"]),
|
|
92
|
+
asTimestamp(["Dec 25, 2023, 12:00 AM GMT+9", "Dec 31, 2023, 23:59:59.999 GMT+9"])
|
|
93
|
+
]
|
|
94
|
+
]
|
|
95
|
+
]);
|
|
96
|
+
TIMEZONES.forEach((timestamps, timezone) => {
|
|
97
|
+
range.timezone = timezone;
|
|
98
|
+
TIMEZONE_TESTS_TIMESTAMPS.forEach((timestamp, index) => {
|
|
99
|
+
const [fromTimestamp, toTimestamp] = timestamps[index];
|
|
100
|
+
range.now = timestamp;
|
|
101
|
+
globalExpect(range.from).toBe(fromTimestamp);
|
|
102
|
+
globalExpect(range.to).toBe(toTimestamp);
|
|
103
|
+
});
|
|
104
|
+
range.now = initialNow;
|
|
105
|
+
range.timezone = initialTimezone;
|
|
106
|
+
});
|
|
107
|
+
});
|
|
108
|
+
});
|
package/dist/es/components/internal/Calendar/calendar/timerange/presets/shared/offsetMonth.js
CHANGED
|
@@ -1,18 +1,27 @@
|
|
|
1
|
-
import { clamp
|
|
2
|
-
import
|
|
3
|
-
import { startOfMonth
|
|
4
|
-
const
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
1
|
+
import { clamp } from "../../../../../../../utils/common/index.js";
|
|
2
|
+
import createRangeTimestampsFactory from "../../factory.js";
|
|
3
|
+
import { startOfMonth, nowTimestamp } from "../../utils.js";
|
|
4
|
+
const ONE_MONTH_OFFSETS = Object.freeze([0, 1, 0, 0, 0, 0, -1]);
|
|
5
|
+
const offsetMonth = (monthCount = 0) => {
|
|
6
|
+
const months = ~~clamp(0, monthCount, Infinity) || 0;
|
|
7
|
+
const restConfig = months ? { offsets: ONE_MONTH_OFFSETS } : { to: nowTimestamp };
|
|
8
|
+
return createRangeTimestampsFactory({
|
|
9
|
+
from: ({ now, systemToTimezone, timezoneToSystem }) => {
|
|
10
|
+
const date = new Date(now);
|
|
11
|
+
const restampedDate = new Date(timezoneToSystem(now));
|
|
12
|
+
const monthDiff = date.getMonth() - restampedDate.getMonth();
|
|
13
|
+
let monthOffset = months;
|
|
14
|
+
if (monthDiff) {
|
|
15
|
+
monthOffset += monthDiff > 1 ? -1 : monthDiff < -1 ? 1 : monthDiff;
|
|
16
|
+
}
|
|
17
|
+
startOfMonth(date);
|
|
18
|
+
date.setMonth(date.getMonth() - monthOffset);
|
|
19
|
+
return systemToTimezone(date);
|
|
11
20
|
},
|
|
12
|
-
...
|
|
21
|
+
...restConfig
|
|
13
22
|
});
|
|
14
|
-
}
|
|
23
|
+
};
|
|
15
24
|
export {
|
|
16
|
-
|
|
17
|
-
|
|
25
|
+
ONE_MONTH_OFFSETS,
|
|
26
|
+
offsetMonth as default
|
|
18
27
|
};
|
package/dist/es/components/internal/Calendar/calendar/timerange/presets/shared/offsetWeek.js
CHANGED
|
@@ -1,29 +1,37 @@
|
|
|
1
|
-
import { clamp
|
|
2
|
-
import
|
|
3
|
-
import { offsetsForNDays
|
|
4
|
-
const
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
1
|
+
import { clamp } from "../../../../../../../utils/common/index.js";
|
|
2
|
+
import createRangeTimestampsFactory from "../../factory.js";
|
|
3
|
+
import { offsetsForNDays, startOfDay, startOfWeekOffset, getRangeTimestampsContextIntegerPropertyFactory, nowTimestamp } from "../../utils.js";
|
|
4
|
+
const DEFAULT_FIRST_WEEK_DAY = 1;
|
|
5
|
+
const ONE_WEEK_OFFSETS = offsetsForNDays(7);
|
|
6
|
+
const _getFirstWeekDayContext = getRangeTimestampsContextIntegerPropertyFactory(0, 6, DEFAULT_FIRST_WEEK_DAY);
|
|
7
|
+
const offsetWeek = (weekCount = 0) => {
|
|
8
|
+
const weeks = ~~clamp(0, weekCount, Infinity) || 0;
|
|
9
|
+
return (firstWeekDay = DEFAULT_FIRST_WEEK_DAY) => {
|
|
10
|
+
const restConfig = weeks ? { offsets: ONE_WEEK_OFFSETS } : { to: nowTimestamp };
|
|
11
|
+
const firstWeekDayContext = _getFirstWeekDayContext(firstWeekDay);
|
|
12
|
+
return createRangeTimestampsFactory(
|
|
9
13
|
{
|
|
10
|
-
from: ({ now
|
|
11
|
-
const
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
14
|
+
from: ({ now, systemToTimezone, timezoneToSystem }) => {
|
|
15
|
+
const date = new Date(now);
|
|
16
|
+
const restampedDate = new Date(timezoneToSystem(now));
|
|
17
|
+
const dayDiff = date.getDay() - restampedDate.getDay();
|
|
18
|
+
startOfDay(date);
|
|
19
|
+
if (dayDiff) {
|
|
20
|
+
const dateDiff = dayDiff > 1 ? -1 : dayDiff < -1 ? 1 : dayDiff;
|
|
21
|
+
date.setDate(date.getDate() - dateDiff);
|
|
15
22
|
}
|
|
16
|
-
const
|
|
17
|
-
|
|
23
|
+
const dateOffset = startOfWeekOffset(firstWeekDayContext.value, date.getDay()) - weeks * 7;
|
|
24
|
+
date.setDate(date.getDate() + dateOffset);
|
|
25
|
+
return systemToTimezone(date);
|
|
18
26
|
},
|
|
19
|
-
...
|
|
27
|
+
...restConfig
|
|
20
28
|
},
|
|
21
|
-
{ firstWeekDay:
|
|
29
|
+
{ firstWeekDay: firstWeekDayContext.descriptor }
|
|
22
30
|
)();
|
|
23
31
|
};
|
|
24
|
-
}
|
|
32
|
+
};
|
|
25
33
|
export {
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
34
|
+
DEFAULT_FIRST_WEEK_DAY,
|
|
35
|
+
ONE_WEEK_OFFSETS,
|
|
36
|
+
offsetWeek as default
|
|
29
37
|
};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { asTimestamp } from "./helpers.js";
|
|
2
|
+
import { getter } from "../../utils.js";
|
|
3
|
+
const getDateRangeContext = (factory) => {
|
|
4
|
+
const rangeContext = factory();
|
|
5
|
+
return Object.defineProperties(rangeContext, {
|
|
6
|
+
fromDate: getter(() => new Date(rangeContext.from)),
|
|
7
|
+
nowDate: getter(() => new Date(rangeContext.now)),
|
|
8
|
+
toDate: getter(() => new Date(rangeContext.to))
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
const TIMEZONE_TESTS_TIMESTAMPS = asTimestamp(["Apr 15, 2022, 1:30 PM GMT", "Dec 31, 2023, 5:30 PM GMT", "Jan 1, 2024, 3:30 AM GMT"]);
|
|
12
|
+
export {
|
|
13
|
+
TIMEZONE_TESTS_TIMESTAMPS,
|
|
14
|
+
getDateRangeContext
|
|
15
|
+
};
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
const asTimestamp = (dates) => dates.map((date) => new Date(date).getTime());
|
|
2
|
+
const isLeapYear = (year) => (year % 100 ? year % 4 : year % 400) === 0;
|
|
3
|
+
const getMonthDays = (month, year) => {
|
|
4
|
+
switch (month) {
|
|
5
|
+
case 3:
|
|
6
|
+
case 5:
|
|
7
|
+
case 8:
|
|
8
|
+
case 10:
|
|
9
|
+
return 30;
|
|
10
|
+
case 1:
|
|
11
|
+
return isLeapYear(year) ? 29 : 28;
|
|
12
|
+
default:
|
|
13
|
+
return 31;
|
|
14
|
+
}
|
|
15
|
+
};
|
|
16
|
+
export {
|
|
17
|
+
asTimestamp,
|
|
18
|
+
getMonthDays
|
|
19
|
+
};
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { getDateRangeContext, TIMEZONE_TESTS_TIMESTAMPS } from "./testing/fixtures.js";
|
|
2
|
+
import { asTimestamp } from "./testing/helpers.js";
|
|
3
|
+
import thisMonth from "./thisMonth.js";
|
|
4
|
+
import { d as describe, t as test, g as globalExpect } from "../../../../../../../vendor-vi.a3ff54b1-5e924357.mjs";
|
|
5
|
+
describe("this month", () => {
|
|
6
|
+
test("should be current month", () => {
|
|
7
|
+
const { fromDate, nowDate, toDate } = getDateRangeContext(thisMonth);
|
|
8
|
+
const fromMonth = fromDate.getMonth();
|
|
9
|
+
const fromYear = fromDate.getFullYear();
|
|
10
|
+
const nowMonth = nowDate.getMonth();
|
|
11
|
+
const nowYear = nowDate.getFullYear();
|
|
12
|
+
const toMonth = toDate.getMonth();
|
|
13
|
+
const toYear = toDate.getFullYear();
|
|
14
|
+
globalExpect(fromYear).toBe(nowYear);
|
|
15
|
+
globalExpect(fromMonth).toBe(nowMonth);
|
|
16
|
+
globalExpect(fromYear).toBe(toYear);
|
|
17
|
+
globalExpect(fromMonth).toBe(toMonth);
|
|
18
|
+
globalExpect(fromDate.getDate()).toBe(1);
|
|
19
|
+
globalExpect(toDate.getDate()).toBe(nowDate.getDate());
|
|
20
|
+
});
|
|
21
|
+
test("should have precise timestamps", () => {
|
|
22
|
+
const { nowDate, from, now, to } = getDateRangeContext(thisMonth);
|
|
23
|
+
const nowMonth = nowDate.getMonth();
|
|
24
|
+
const monthBefore = new Date(from - 1).getMonth();
|
|
25
|
+
globalExpect(to).toBe(now);
|
|
26
|
+
nowMonth === 0 ? globalExpect(monthBefore).toBe(11) : globalExpect(monthBefore).toBe(nowMonth - 1);
|
|
27
|
+
});
|
|
28
|
+
test("should have precise timestamps for timezone", () => {
|
|
29
|
+
const range = getDateRangeContext(thisMonth);
|
|
30
|
+
const { now: initialNow, timezone: initialTimezone } = range;
|
|
31
|
+
const TIMEZONES = /* @__PURE__ */ new Map([
|
|
32
|
+
["America/Toronto", asTimestamp(["Apr 1, 2022, 12:00 AM GMT-4", "Dec 1, 2023, 12:00 AM GMT-5", "Dec 1, 2023, 12:00 AM GMT-5"])],
|
|
33
|
+
["Asia/Tokyo", asTimestamp(["Apr 1, 2022, 12:00 AM GMT+9", "Jan 1, 2024, 12:00 AM GMT+9", "Jan 1, 2024, 12:00 AM GMT+9"])]
|
|
34
|
+
]);
|
|
35
|
+
TIMEZONES.forEach((fromTimestamps, timezone) => {
|
|
36
|
+
range.timezone = timezone;
|
|
37
|
+
TIMEZONE_TESTS_TIMESTAMPS.forEach((timestamp, index) => {
|
|
38
|
+
range.now = timestamp;
|
|
39
|
+
globalExpect(range.from).toBe(fromTimestamps[index]);
|
|
40
|
+
globalExpect(range.to).toBe(timestamp);
|
|
41
|
+
});
|
|
42
|
+
range.now = initialNow;
|
|
43
|
+
range.timezone = initialTimezone;
|
|
44
|
+
});
|
|
45
|
+
});
|
|
46
|
+
});
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
import { getDateRangeContext, TIMEZONE_TESTS_TIMESTAMPS } from "./testing/fixtures.js";
|
|
2
|
+
import { asTimestamp } from "./testing/helpers.js";
|
|
3
|
+
import thisWeek from "./thisWeek.js";
|
|
4
|
+
import { d as describe, t as test, g as globalExpect, v as vi } from "../../../../../../../vendor-vi.a3ff54b1-5e924357.mjs";
|
|
5
|
+
describe("this week", () => {
|
|
6
|
+
const thisWeekTimestamps = getDateRangeContext(thisWeek);
|
|
7
|
+
const firstWeekDays = [
|
|
8
|
+
/* default */
|
|
9
|
+
void 0,
|
|
10
|
+
0,
|
|
11
|
+
1,
|
|
12
|
+
2,
|
|
13
|
+
3,
|
|
14
|
+
4,
|
|
15
|
+
5,
|
|
16
|
+
6
|
|
17
|
+
];
|
|
18
|
+
test.each(firstWeekDays)(`should be this week (firstWeekDay => %i)`, (firstWeekDayParam) => {
|
|
19
|
+
thisWeekTimestamps.firstWeekDay = firstWeekDayParam;
|
|
20
|
+
const { firstWeekDay, fromDate, nowDate, to, toDate } = thisWeekTimestamps;
|
|
21
|
+
const fromMonth = fromDate.getMonth();
|
|
22
|
+
const fromYear = fromDate.getFullYear();
|
|
23
|
+
const nowMonth = nowDate.getMonth();
|
|
24
|
+
const nowYear = nowDate.getFullYear();
|
|
25
|
+
const toMonth = toDate.getMonth();
|
|
26
|
+
const toYear = toDate.getFullYear();
|
|
27
|
+
const dateOfToday = nowDate.getDate();
|
|
28
|
+
const firstDayOfThisWeek = fromDate.getDate();
|
|
29
|
+
globalExpect(fromDate.getDay()).toBe(firstWeekDay);
|
|
30
|
+
globalExpect(toDate.getDay()).toBe(nowDate.getDay());
|
|
31
|
+
if (firstDayOfThisWeek <= dateOfToday) {
|
|
32
|
+
globalExpect(fromMonth).toBe(toMonth);
|
|
33
|
+
globalExpect(fromYear).toBe(toYear);
|
|
34
|
+
globalExpect(fromMonth).toBe(nowMonth);
|
|
35
|
+
globalExpect(fromYear).toBe(nowYear);
|
|
36
|
+
} else {
|
|
37
|
+
if (nowMonth === 0) {
|
|
38
|
+
globalExpect(fromMonth).toBe(11);
|
|
39
|
+
globalExpect(fromYear).toBe(nowYear - 1);
|
|
40
|
+
} else {
|
|
41
|
+
globalExpect(fromMonth).toBe(nowMonth - 1);
|
|
42
|
+
globalExpect(fromYear).toBe(nowYear);
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
const date = new Date(fromDate);
|
|
46
|
+
const nowDateStartTimestamp = new Date(nowDate).setHours(0, 0, 0, 0);
|
|
47
|
+
const daysInWeek = (7 + (nowDate.getDay() - firstWeekDay) % 7) % 7;
|
|
48
|
+
const dayInThisWeek = vi.fn();
|
|
49
|
+
const daySinceThisWeek = vi.fn();
|
|
50
|
+
let timestamp = date.getTime();
|
|
51
|
+
while (timestamp < nowDateStartTimestamp) {
|
|
52
|
+
daySinceThisWeek();
|
|
53
|
+
if (timestamp < to)
|
|
54
|
+
dayInThisWeek();
|
|
55
|
+
timestamp = date.setDate(date.getDate() + 1);
|
|
56
|
+
}
|
|
57
|
+
globalExpect(dayInThisWeek).toHaveBeenCalledTimes(daysInWeek);
|
|
58
|
+
globalExpect(daySinceThisWeek.mock.calls.length).toBeGreaterThanOrEqual(daysInWeek);
|
|
59
|
+
});
|
|
60
|
+
test.each(firstWeekDays)(`should have precise timestamps (firstWeekDay => %i)`, (firstWeekDayParam) => {
|
|
61
|
+
thisWeekTimestamps.firstWeekDay = firstWeekDayParam;
|
|
62
|
+
const { firstWeekDay, from, now, to } = thisWeekTimestamps;
|
|
63
|
+
const dateBefore = new Date(from - 1);
|
|
64
|
+
globalExpect(to).toBe(now);
|
|
65
|
+
globalExpect(dateBefore.getDay()).toBe((firstWeekDay + 6) % 7);
|
|
66
|
+
});
|
|
67
|
+
test("should have precise timestamps for timezone (firstWeekDay => 1)", () => {
|
|
68
|
+
const range = getDateRangeContext(() => thisWeek(1));
|
|
69
|
+
const { now: initialNow, timezone: initialTimezone } = range;
|
|
70
|
+
const TIMEZONES = /* @__PURE__ */ new Map([
|
|
71
|
+
["America/Toronto", asTimestamp(["Apr 11, 2022, 12:00 AM GMT-4", "Dec 25, 2023, 12:00 AM GMT-5", "Dec 25, 2023, 12:00 AM GMT-5"])],
|
|
72
|
+
["Asia/Tokyo", asTimestamp(["Apr 11, 2022, 12:00 AM GMT+9", "Jan 1, 2024, 12:00 AM GMT+9", "Jan 1, 2024, 12:00 AM GMT+9"])]
|
|
73
|
+
]);
|
|
74
|
+
TIMEZONES.forEach((timestamps, timezone) => {
|
|
75
|
+
range.timezone = timezone;
|
|
76
|
+
TIMEZONE_TESTS_TIMESTAMPS.forEach((timestamp, index) => {
|
|
77
|
+
range.now = timestamp;
|
|
78
|
+
globalExpect(range.from).toBe(timestamps[index]);
|
|
79
|
+
globalExpect(range.to).toBe(timestamp);
|
|
80
|
+
});
|
|
81
|
+
range.now = initialNow;
|
|
82
|
+
range.timezone = initialTimezone;
|
|
83
|
+
});
|
|
84
|
+
});
|
|
85
|
+
});
|
|
@@ -1,12 +1,16 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { startOfYear
|
|
3
|
-
const
|
|
4
|
-
from: ({ now
|
|
5
|
-
const
|
|
6
|
-
|
|
1
|
+
import createRangeTimestampsFactory from "../factory.js";
|
|
2
|
+
import { startOfYear, nowTimestamp } from "../utils.js";
|
|
3
|
+
const yearToDate = createRangeTimestampsFactory({
|
|
4
|
+
from: ({ now, systemToTimezone, timezoneToSystem }) => {
|
|
5
|
+
const date = new Date(now);
|
|
6
|
+
const restampedDate = new Date(timezoneToSystem(now));
|
|
7
|
+
const yearOffset = date.getFullYear() - restampedDate.getFullYear();
|
|
8
|
+
startOfYear(date);
|
|
9
|
+
date.setFullYear(date.getFullYear() - yearOffset);
|
|
10
|
+
return systemToTimezone(date);
|
|
7
11
|
},
|
|
8
|
-
to:
|
|
9
|
-
})
|
|
12
|
+
to: nowTimestamp
|
|
13
|
+
});
|
|
10
14
|
export {
|
|
11
|
-
|
|
15
|
+
yearToDate as default
|
|
12
16
|
};
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { getDateRangeContext, TIMEZONE_TESTS_TIMESTAMPS } from "./testing/fixtures.js";
|
|
2
|
+
import { asTimestamp } from "./testing/helpers.js";
|
|
3
|
+
import yearToDate from "./yearToDate.js";
|
|
4
|
+
import { d as describe, t as test, g as globalExpect } from "../../../../../../../vendor-vi.a3ff54b1-5e924357.mjs";
|
|
5
|
+
describe("year to date", () => {
|
|
6
|
+
test("should be current year", () => {
|
|
7
|
+
const { fromDate, nowDate, toDate } = getDateRangeContext(yearToDate);
|
|
8
|
+
const fromMonth = fromDate.getMonth();
|
|
9
|
+
const fromYear = fromDate.getFullYear();
|
|
10
|
+
const nowMonth = nowDate.getMonth();
|
|
11
|
+
const nowYear = nowDate.getFullYear();
|
|
12
|
+
const toMonth = toDate.getMonth();
|
|
13
|
+
const toYear = toDate.getFullYear();
|
|
14
|
+
globalExpect(fromYear).toBe(nowYear);
|
|
15
|
+
globalExpect(fromMonth).toBe(0);
|
|
16
|
+
globalExpect(toYear).toBe(nowYear);
|
|
17
|
+
globalExpect(toMonth).toBe(nowMonth);
|
|
18
|
+
globalExpect(fromDate.getDate()).toBe(1);
|
|
19
|
+
globalExpect(toDate.getDate()).toBe(nowDate.getDate());
|
|
20
|
+
});
|
|
21
|
+
test("should have precise timestamps", () => {
|
|
22
|
+
const { from, fromDate, now, to } = getDateRangeContext(yearToDate);
|
|
23
|
+
const dateBefore = new Date(from - 1);
|
|
24
|
+
const fromYear = fromDate.getFullYear();
|
|
25
|
+
const monthBefore = dateBefore.getMonth();
|
|
26
|
+
const yearBefore = dateBefore.getFullYear();
|
|
27
|
+
globalExpect(to).toBe(now);
|
|
28
|
+
globalExpect(monthBefore).toBe(11);
|
|
29
|
+
globalExpect(yearBefore).toBe(fromYear - 1);
|
|
30
|
+
});
|
|
31
|
+
test("should have precise timestamps for timezone", () => {
|
|
32
|
+
const range = getDateRangeContext(yearToDate);
|
|
33
|
+
const { now: initialNow, timezone: initialTimezone } = range;
|
|
34
|
+
const TIMEZONES = /* @__PURE__ */ new Map([
|
|
35
|
+
["America/Toronto", asTimestamp(["Jan 1, 2022, 12:00 AM GMT-5", "Jan 1, 2023, 12:00 AM GMT-5", "Jan 1, 2023, 12:00 AM GMT-5"])],
|
|
36
|
+
["Asia/Tokyo", asTimestamp(["Jan 1, 2022, 12:00 AM GMT+9", "Jan 1, 2024, 12:00 AM GMT+9", "Jan 1, 2024, 12:00 AM GMT+9"])]
|
|
37
|
+
]);
|
|
38
|
+
TIMEZONES.forEach((fromTimestamps, timezone) => {
|
|
39
|
+
range.timezone = timezone;
|
|
40
|
+
TIMEZONE_TESTS_TIMESTAMPS.forEach((timestamp, index) => {
|
|
41
|
+
range.now = timestamp;
|
|
42
|
+
globalExpect(range.from).toBe(fromTimestamps[index]);
|
|
43
|
+
globalExpect(range.to).toBe(timestamp);
|
|
44
|
+
});
|
|
45
|
+
range.now = initialNow;
|
|
46
|
+
range.timezone = initialTimezone;
|
|
47
|
+
});
|
|
48
|
+
});
|
|
49
|
+
});
|