@swan-io/shared-business 18.4.0 → 18.6.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (101) hide show
  1. package/package.json +3 -3
  2. package/src/components/BirthdatePicker.d.ts +3 -1
  3. package/src/components/BirthdatePicker.js +2 -2
  4. package/src/components/FraudReport/CardDetailsStep.d.ts +7 -0
  5. package/src/components/FraudReport/CardDetailsStep.js +46 -0
  6. package/src/components/FraudReport/FraudReportLayout.d.ts +23 -0
  7. package/src/components/FraudReport/FraudReportLayout.js +35 -0
  8. package/src/components/FraudReport/FraudsterDetailsStep.d.ts +7 -0
  9. package/src/components/FraudReport/FraudsterDetailsStep.js +56 -0
  10. package/src/components/FraudReport/IncidentStep.d.ts +7 -0
  11. package/src/components/FraudReport/IncidentStep.js +55 -0
  12. package/src/components/FraudReport/IntroStep.d.ts +5 -0
  13. package/src/components/FraudReport/IntroStep.js +32 -0
  14. package/src/components/FraudReport/TransactionPicker.d.ts +13 -0
  15. package/src/components/FraudReport/TransactionPicker.js +213 -0
  16. package/src/components/FraudReport/TransactionPickerFilters.d.ts +8 -0
  17. package/src/components/FraudReport/TransactionPickerFilters.js +213 -0
  18. package/src/components/FraudReport/TransactionRows.d.ts +8 -0
  19. package/src/components/FraudReport/TransactionRows.js +32 -0
  20. package/src/components/FraudReport/TransactionsStep.d.ts +16 -0
  21. package/src/components/FraudReport/TransactionsStep.js +120 -0
  22. package/src/components/FraudReport/VictimStep.d.ts +11 -0
  23. package/src/components/FraudReport/VictimStep.js +88 -0
  24. package/src/components/InlineDatePicker.js +7 -6
  25. package/src/components/LakeModal.js +1 -1
  26. package/src/constants/__tests__/countries.test.js +32 -1
  27. package/src/constants/countries.d.ts +2 -1
  28. package/src/constants/countries.js +36 -2
  29. package/src/hooks/__tests__/useFraudReportFlow.test.d.ts +1 -0
  30. package/src/hooks/__tests__/useFraudReportFlow.test.js +1067 -0
  31. package/src/hooks/useFraudReportFlow.d.ts +32 -0
  32. package/src/hooks/useFraudReportFlow.js +265 -0
  33. package/src/locales/de.json +130 -0
  34. package/src/locales/en.json +130 -0
  35. package/src/locales/es.json +130 -0
  36. package/src/locales/fi.json +130 -0
  37. package/src/locales/fr.json +130 -0
  38. package/src/locales/it.json +130 -0
  39. package/src/locales/nl.json +130 -0
  40. package/src/locales/pt.json +130 -0
  41. package/src/utils/__tests__/fraudReport.card.test.d.ts +1 -0
  42. package/src/utils/__tests__/fraudReport.card.test.js +39 -0
  43. package/src/utils/__tests__/fraudReport.fakeApi.test.js +42 -13
  44. package/src/utils/__tests__/fraudReport.fraudster.test.d.ts +1 -0
  45. package/src/utils/__tests__/fraudReport.fraudster.test.js +35 -0
  46. package/src/utils/__tests__/fraudReport.messages.test.d.ts +1 -0
  47. package/src/utils/__tests__/fraudReport.messages.test.js +28 -0
  48. package/src/utils/__tests__/fraudReport.picker.test.d.ts +1 -0
  49. package/src/utils/__tests__/fraudReport.picker.test.js +171 -0
  50. package/src/utils/__tests__/fraudReport.pickerFilters.test.d.ts +1 -0
  51. package/src/utils/__tests__/fraudReport.pickerFilters.test.js +144 -0
  52. package/src/utils/__tests__/fraudReport.prefill.test.d.ts +1 -0
  53. package/src/utils/__tests__/fraudReport.prefill.test.js +151 -0
  54. package/src/utils/__tests__/fraudReport.rejections.test.d.ts +1 -0
  55. package/src/utils/__tests__/fraudReport.rejections.test.js +155 -0
  56. package/src/utils/__tests__/fraudReport.resume.test.d.ts +1 -0
  57. package/src/utils/__tests__/fraudReport.resume.test.js +81 -0
  58. package/src/utils/__tests__/fraudReport.stepper.test.d.ts +1 -0
  59. package/src/utils/__tests__/fraudReport.stepper.test.js +102 -0
  60. package/src/utils/__tests__/fraudReport.toInput.test.js +111 -37
  61. package/src/utils/__tests__/fraudReport.transactions.test.d.ts +1 -0
  62. package/src/utils/__tests__/fraudReport.transactions.test.js +38 -0
  63. package/src/utils/__tests__/fraudReport.types.test.d.ts +1 -0
  64. package/src/utils/__tests__/fraudReport.types.test.js +22 -0
  65. package/src/utils/__tests__/fraudReport.victim.test.d.ts +1 -0
  66. package/src/utils/__tests__/fraudReport.victim.test.js +168 -0
  67. package/src/utils/__tests__/phone.test.js +60 -5
  68. package/src/utils/__tests__/validation.test.js +69 -2
  69. package/src/utils/fraudReport/card.d.ts +11 -0
  70. package/src/utils/fraudReport/card.js +15 -0
  71. package/src/utils/fraudReport/fakeApi.d.ts +7 -4
  72. package/src/utils/fraudReport/fakeApi.js +19 -6
  73. package/src/utils/fraudReport/fraudster.d.ts +10 -0
  74. package/src/utils/fraudReport/fraudster.js +11 -0
  75. package/src/utils/fraudReport/messages.d.ts +4 -0
  76. package/src/utils/fraudReport/messages.js +7 -0
  77. package/src/utils/fraudReport/picker.d.ts +18 -0
  78. package/src/utils/fraudReport/picker.js +49 -0
  79. package/src/utils/fraudReport/pickerFilters.d.ts +26 -0
  80. package/src/utils/fraudReport/pickerFilters.js +62 -0
  81. package/src/utils/fraudReport/prefill.d.ts +3 -0
  82. package/src/utils/fraudReport/prefill.js +16 -0
  83. package/src/utils/fraudReport/rejections.d.ts +9 -0
  84. package/src/utils/fraudReport/rejections.js +49 -0
  85. package/src/utils/fraudReport/resume.d.ts +4 -0
  86. package/src/utils/fraudReport/resume.js +26 -0
  87. package/src/utils/fraudReport/stepper.d.ts +16 -0
  88. package/src/utils/fraudReport/stepper.js +21 -0
  89. package/src/utils/fraudReport/toInput.d.ts +14 -3
  90. package/src/utils/fraudReport/toInput.js +37 -31
  91. package/src/utils/fraudReport/transactions.d.ts +8 -0
  92. package/src/utils/fraudReport/transactions.js +11 -0
  93. package/src/utils/fraudReport/types.d.ts +8 -0
  94. package/src/utils/fraudReport/validation.d.ts +2 -1
  95. package/src/utils/fraudReport/validation.js +5 -0
  96. package/src/utils/fraudReport/victim.d.ts +41 -0
  97. package/src/utils/fraudReport/victim.js +37 -0
  98. package/src/utils/phone.d.ts +1 -0
  99. package/src/utils/phone.js +31 -4
  100. package/src/utils/validation.d.ts +2 -0
  101. package/src/utils/validation.js +14 -7
@@ -0,0 +1,213 @@
1
+ import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { Box } from "@swan-io/lake/src/components/Box";
3
+ import { Icon } from "@swan-io/lake/src/components/Icon";
4
+ import { LakeButton } from "@swan-io/lake/src/components/LakeButton";
5
+ import { LakeCheckbox } from "@swan-io/lake/src/components/LakeCheckbox";
6
+ import { LakeText } from "@swan-io/lake/src/components/LakeText";
7
+ import { LakeTextInput } from "@swan-io/lake/src/components/LakeTextInput";
8
+ import { Popover } from "@swan-io/lake/src/components/Popover";
9
+ import { Pressable } from "@swan-io/lake/src/components/Pressable";
10
+ import { Space } from "@swan-io/lake/src/components/Space";
11
+ import { colors, radii, spacings } from "@swan-io/lake/src/constants/design";
12
+ import { useDebounce } from "@swan-io/lake/src/hooks/useDebounce";
13
+ import dayjs from "dayjs";
14
+ import { useCallback, useEffect, useId, useRef, useState } from "react";
15
+ import { StyleSheet, View } from "react-native";
16
+ import { match } from "ts-pattern";
17
+ import { PICKER_DATE_FORMAT, parseAmountFilter, pickerFilterTypes, togglePickerFilterType, validateFromDate, validateToDate, } from "../../utils/fraudReport/pickerFilters";
18
+ import { locale, t } from "../../utils/i18n";
19
+ import { DatePickerModal } from "../DatePicker";
20
+ import { getPaymentMethodLabel } from "./TransactionRows";
21
+ const SEARCH_DEBOUNCE = 500;
22
+ const SEARCH_WIDTH = 350;
23
+ const SEARCH_MIN_WIDTH = 200;
24
+ const styles = StyleSheet.create({
25
+ largeBar: {
26
+ gap: 16,
27
+ },
28
+ smallBar: {
29
+ gap: 12,
30
+ },
31
+ chips: {
32
+ gap: 8,
33
+ },
34
+ chip: {
35
+ alignItems: "center",
36
+ borderColor: colors.gray[200],
37
+ borderRadius: radii[8],
38
+ borderStyle: "dashed",
39
+ borderWidth: 1,
40
+ flexDirection: "row",
41
+ height: 28,
42
+ overflow: "hidden",
43
+ },
44
+ chipWithValue: {
45
+ borderStyle: "solid",
46
+ },
47
+ chipClear: {
48
+ paddingLeft: spacings[8],
49
+ paddingRight: spacings[4],
50
+ paddingVertical: spacings[4],
51
+ },
52
+ chipButton: {
53
+ alignItems: "center",
54
+ alignSelf: "stretch",
55
+ flexDirection: "row",
56
+ gap: 2,
57
+ paddingHorizontal: spacings[8],
58
+ transitionDuration: "150ms",
59
+ transitionProperty: "background-color",
60
+ },
61
+ chipButtonWithValue: {
62
+ paddingLeft: 0,
63
+ },
64
+ chipButtonHovered: {
65
+ backgroundColor: colors.gray[50],
66
+ },
67
+ chipButtonPressed: {
68
+ backgroundColor: colors.gray[100],
69
+ },
70
+ chipSeparator: {
71
+ backgroundColor: colors.gray[100],
72
+ height: 16,
73
+ marginHorizontal: spacings[8],
74
+ width: 1,
75
+ },
76
+ chipValue: {
77
+ maxWidth: 150,
78
+ },
79
+ popover: {
80
+ padding: spacings[20],
81
+ },
82
+ list: {
83
+ minWidth: 200,
84
+ paddingVertical: spacings[12],
85
+ },
86
+ listItem: {
87
+ alignItems: "center",
88
+ flexDirection: "row",
89
+ height: spacings[32],
90
+ paddingHorizontal: spacings[20],
91
+ transitionDuration: "150ms",
92
+ transitionProperty: "background-color",
93
+ },
94
+ listItemHovered: {
95
+ backgroundColor: colors.gray[50],
96
+ },
97
+ search: {
98
+ // The search takes the room the chips leave, between its two widths: the chips wrap only
99
+ // once it is at its smallest.
100
+ flexBasis: SEARCH_MIN_WIDTH,
101
+ flexGrow: 1,
102
+ flexShrink: 0,
103
+ marginLeft: "auto",
104
+ maxWidth: SEARCH_WIDTH,
105
+ },
106
+ searchClear: {
107
+ borderRadius: radii[4],
108
+ padding: spacings[8],
109
+ },
110
+ });
111
+ const FilterChip = ({ ref, label, value, expanded, popoverId, onPress, onClear }) => {
112
+ const hasValue = value != null;
113
+ const buttonRef = useRef(null);
114
+ return (_jsxs(View, { ref: ref, style: [styles.chip, hasValue && styles.chipWithValue], children: [hasValue ? (_jsx(Pressable, { role: "button", "aria-label": t("fraudReport.picker.filters.clear", { filter: label }), style: styles.chipClear, onPress: () => {
115
+ var _a;
116
+ // The clear button goes away: the focus stays on the chip.
117
+ (_a = buttonRef.current) === null || _a === void 0 ? void 0 : _a.focus();
118
+ onClear();
119
+ }, children: _jsx(Icon, { name: "dismiss-circle-regular", size: 16, color: colors.gray[600] }) })) : null, _jsxs(Pressable, { ref: buttonRef, role: "button", "aria-haspopup": "dialog", "aria-expanded": expanded, "aria-controls": expanded ? popoverId : undefined, style: ({ hovered, pressed }) => [
120
+ styles.chipButton,
121
+ hasValue && styles.chipButtonWithValue,
122
+ hovered && styles.chipButtonHovered,
123
+ pressed && styles.chipButtonPressed,
124
+ ], onPress: onPress, children: [hasValue ? null : _jsx(Icon, { name: "add-circle-regular", size: 16, color: colors.gray[600] }), _jsx(LakeText, { variant: "smallMedium", color: colors.gray[700], userSelect: "none", children: label }), hasValue ? (_jsxs(_Fragment, { children: [_jsx(View, { style: styles.chipSeparator }), _jsx(LakeText, { variant: "smallMedium", color: colors.current[600], numberOfLines: 1, userSelect: "none", style: styles.chipValue, children: value })] })) : null] })] }));
125
+ };
126
+ const toDisplayDate = (date) => dayjs.utc(date, PICKER_DATE_FORMAT, true).format(locale.dateFormat);
127
+ // An invalid date stays invalid, so the validator rejects it.
128
+ const fromDisplayDate = (date) => {
129
+ const parsed = dayjs.utc(date, locale.dateFormat, true);
130
+ return parsed.isValid() ? parsed.format(PICKER_DATE_FORMAT) : "";
131
+ };
132
+ const fromPickerDate = ({ year, month, day }) => dayjs.utc().year(year).month(month).date(day).format(PICKER_DATE_FORMAT);
133
+ const getDateError = (error) => match(error)
134
+ .with("InvalidDate", () => t("validation.invalidDate"))
135
+ .with("StartAfterEnd", () => t("fraudReport.picker.filters.startAfterEnd"))
136
+ .with(undefined, () => undefined)
137
+ .exhaustive();
138
+ const DateFilter = ({ label, value, visible, validate, onChange, onOpen, onClose, }) => {
139
+ const displayed = value == null ? undefined : toDisplayDate(value);
140
+ return (_jsxs(_Fragment, { children: [_jsx(FilterChip, { label: label, value: displayed, expanded: visible, onPress: onOpen, onClear: () => onChange(undefined) }), _jsx(DatePickerModal
141
+ // Its input keeps the last date it was given: a cleared filter starts empty again.
142
+ , { visible: visible, format: locale.dateFormat, firstWeekDay: "monday", label: label, cancelLabel: t("common.cancel"), confirmLabel: t("fraudReport.picker.filters.apply"), value: displayed, isSelectable: date => validate(fromPickerDate(date)) == null,
143
+ // Applying an empty date changes nothing.
144
+ validate: date => (date === "" ? undefined : getDateError(validate(fromDisplayDate(date)))), onChange: date => onChange(fromDisplayDate(date)), onDismiss: onClose }, displayed !== null && displayed !== void 0 ? displayed : "")] }));
145
+ };
146
+ const AmountFilter = ({ label, value, visible, onChange, onOpen, onClose, }) => {
147
+ const ref = useRef(null);
148
+ const popoverId = useId();
149
+ const [text, setText] = useState(value !== null && value !== void 0 ? value : "");
150
+ const [invalid, setInvalid] = useState(false);
151
+ const open = () => {
152
+ setText(value !== null && value !== void 0 ? value : "");
153
+ setInvalid(false);
154
+ onOpen();
155
+ };
156
+ const submit = () => {
157
+ const parsed = parseAmountFilter(text);
158
+ if ("error" in parsed) {
159
+ return setInvalid(true);
160
+ }
161
+ onChange(parsed.amount);
162
+ onClose();
163
+ };
164
+ return (_jsxs(_Fragment, { children: [_jsx(FilterChip, { ref: ref, label: label, value: value, expanded: visible, popoverId: popoverId, onPress: open, onClear: () => onChange(undefined) }), _jsx(Popover, { id: popoverId, label: label, placement: "left", referenceRef: ref, visible: visible, onDismiss: onClose, children: _jsxs(View, { style: styles.popover, children: [_jsx(LakeTextInput, { "aria-label": label, placeholder: label, inputMode: "decimal", value: text, error: invalid ? t("fraudReport.picker.filters.invalidAmount") : undefined, onChangeText: value => {
165
+ setText(value);
166
+ setInvalid(false);
167
+ }, onSubmitEditing: submit }), _jsx(Space, { height: 8 }), _jsx(LakeButton, { color: "current", size: "small", onPress: submit, children: t("fraudReport.picker.filters.apply") })] }) })] }));
168
+ };
169
+ const TypesFilter = ({ label, value, visible, onChange, onOpen, onClose, }) => {
170
+ const ref = useRef(null);
171
+ const popoverId = useId();
172
+ const selected = value !== null && value !== void 0 ? value : [];
173
+ return (_jsxs(_Fragment, { children: [_jsx(FilterChip, { ref: ref, label: label, value: selected.length === 0 ? undefined : selected.map(getPaymentMethodLabel).join(", "), expanded: visible, popoverId: popoverId, onPress: onOpen, onClear: () => onChange(undefined) }), _jsx(Popover, { id: popoverId, label: label, placement: "left", referenceRef: ref, visible: visible, onDismiss: onClose, children: _jsx(View, { role: "group", "aria-label": label, style: styles.list, children: pickerFilterTypes.map(type => {
174
+ const checked = selected.includes(type);
175
+ return (_jsxs(Pressable, { role: "checkbox", "aria-checked": checked, style: ({ hovered }) => [styles.listItem, hovered && styles.listItemHovered], onPress: () => onChange(togglePickerFilterType(selected, type)), children: [_jsx(LakeCheckbox, { value: checked }), _jsx(Space, { width: 12 }), _jsx(LakeText, { variant: "smallRegular", color: colors.gray[900], userSelect: "none", children: getPaymentMethodLabel(type) })] }, type));
176
+ }) }) })] }));
177
+ };
178
+ const SearchFilter = ({ initialValue, large, onChange, }) => {
179
+ const [text, setText] = useState(initialValue);
180
+ const cancel = useRef(undefined);
181
+ // A search comes late: it has to reach the callback of the latest render, which holds the
182
+ // filters changed in the meantime.
183
+ const latestOnChange = useRef(onChange);
184
+ useEffect(() => {
185
+ latestOnChange.current = onChange;
186
+ });
187
+ const debounced = useDebounce(useCallback((value) => latestOnChange.current(value), []), SEARCH_DEBOUNCE);
188
+ // A search still waiting when the picker closes is dropped.
189
+ useEffect(() => () => { var _a; return (_a = cancel.current) === null || _a === void 0 ? void 0 : _a.call(cancel); }, []);
190
+ const change = (value) => {
191
+ setText(value);
192
+ cancel.current = debounced(value);
193
+ };
194
+ const clear = () => {
195
+ var _a;
196
+ (_a = cancel.current) === null || _a === void 0 ? void 0 : _a.call(cancel);
197
+ setText("");
198
+ onChange("");
199
+ };
200
+ return (_jsx(View, { style: large ? styles.search : undefined, children: _jsx(LakeTextInput, { "aria-label": t("fraudReport.picker.search"), placeholder: t("fraudReport.picker.search"), icon: "search-filled", inputMode: "search", hideErrors: true, value: text, onChangeText: change, renderEnd: () => text === "" ? null : (_jsx(Pressable, { role: "button", "aria-label": t("fraudReport.picker.clearSearch"), style: styles.searchClear, onPress: clear, children: _jsx(Icon, { name: "dismiss-filled", size: 12, color: colors.gray[600] }) })) }) }));
201
+ };
202
+ export const TransactionPickerFilters = ({ filters, large, onChange }) => {
203
+ var _a;
204
+ const [open, setOpen] = useState();
205
+ const close = () => setOpen(undefined);
206
+ const chips = (_jsxs(Box, { direction: "row", wrap: "wrap", alignItems: "center", shrink: 1, style: styles.chips, children: [_jsx(DateFilter, { label: t("fraudReport.picker.filters.startDate"), value: filters.fromDate, visible: open === "fromDate", validate: date => validateFromDate(date, filters.toDate), onChange: fromDate => onChange({ fromDate }), onOpen: () => setOpen("fromDate"), onClose: close }), _jsx(DateFilter, { label: t("fraudReport.picker.filters.endDate"), value: filters.toDate, visible: open === "toDate", validate: date => validateToDate(date, filters.fromDate), onChange: toDate => onChange({ toDate }), onOpen: () => setOpen("toDate"), onClose: close }), _jsx(AmountFilter, { label: t("fraudReport.transactions.amount"), value: filters.amount, visible: open === "amount", onChange: amount => onChange({ amount }), onOpen: () => setOpen("amount"), onClose: close }), _jsx(TypesFilter, { label: t("fraudReport.transactions.paymentMethod"), value: filters.types, visible: open === "types", onChange: types => onChange({ types }), onOpen: () => setOpen("types"), onClose: close })] }));
207
+ const search = (_jsx(SearchFilter, { initialValue: (_a = filters.search) !== null && _a !== void 0 ? _a : "", large: large, onChange: value => onChange({ search: value }) }));
208
+ // One tree and one order for both layouts, the search placed by the direction alone: the
209
+ // picker measures its width after its first render, and a search being typed must keep its
210
+ // text and its focus through the change of layout. The cost: on a small screen the search
211
+ // shows first but comes after the chips for the keyboard and screen readers.
212
+ return (_jsxs(Box, { direction: large ? "row" : "columnReverse", alignItems: large ? "center" : "stretch", style: large ? styles.largeBar : styles.smallBar, children: [chips, search] }));
213
+ };
@@ -0,0 +1,8 @@
1
+ import type { FraudReportTransaction, FraudReportTransactionType } from "../../utils/fraudReport/types";
2
+ export declare const getPaymentMethodLabel: (type: FraudReportTransactionType) => string;
3
+ export declare const formatTransactionDate: ({ executionDate }: FraudReportTransaction) => string;
4
+ export declare const formatTransactionAmount: ({ amount }: FraudReportTransaction) => string;
5
+ export declare const TransactionsTotals: ({ transactions, overLimit, }: {
6
+ transactions: FraudReportTransaction[];
7
+ overLimit?: boolean;
8
+ }) => import("react").JSX.Element;
@@ -0,0 +1,32 @@
1
+ import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { LakeText } from "@swan-io/lake/src/components/LakeText";
3
+ import { Space } from "@swan-io/lake/src/components/Space";
4
+ import { colors } from "@swan-io/lake/src/constants/design";
5
+ import dayjs from "dayjs";
6
+ import { match } from "ts-pattern";
7
+ import { getTransactionsTotal } from "../../utils/fraudReport/transactions";
8
+ import { formatCurrencySymbol, formatNestedMessage, locale, t } from "../../utils/i18n";
9
+ export const getPaymentMethodLabel = (type) => match(type)
10
+ .with("CardOutDebit", () => t("fraudReport.transactions.paymentMethod.card"))
11
+ .with("SepaCreditTransferOut", () => t("fraudReport.transactions.paymentMethod.sepaCreditTransfer"))
12
+ .with("SepaInstantCreditTransferOut", () => t("fraudReport.transactions.paymentMethod.sepaInstantCreditTransfer"))
13
+ .with("InternationalCreditTransferOut", () => t("fraudReport.transactions.paymentMethod.internationalCreditTransfer"))
14
+ .with("InternalCreditTransferOut", () => t("fraudReport.transactions.paymentMethod.internalCreditTransfer"))
15
+ .exhaustive();
16
+ export const formatTransactionDate = ({ executionDate }) => dayjs(executionDate).format(locale.dateFormat);
17
+ export const formatTransactionAmount = ({ amount }) => formatCurrencySymbol(Number(amount.value), amount.currency);
18
+ const highlightWith = (color) => (chunks) => (_jsx(LakeText, { variant: "medium", color: color, children: chunks }));
19
+ // Both dark enough for AAA contrast on a modal's background as well as on a tile.
20
+ const highlight = highlightWith(colors.current[600]);
21
+ const negativeHighlight = highlightWith(colors.negative[700]);
22
+ // The total and the count of a selection. The parent lays them out in a row or a column.
23
+ export const TransactionsTotals = ({ transactions, overLimit = false, }) => {
24
+ const total = getTransactionsTotal(transactions);
25
+ return (_jsxs(_Fragment, { children: [_jsx(LakeText, { color: colors.gray[700], children: formatNestedMessage("fraudReport.transactions.total", {
26
+ amount: formatCurrencySymbol(total.value, total.currency),
27
+ highlight,
28
+ }) }), _jsx(Space, { width: 32, height: 8 }), _jsx(LakeText, { color: colors.gray[700], children: formatNestedMessage("fraudReport.transactions.selectedCount", {
29
+ count: transactions.length,
30
+ highlight: overLimit ? negativeHighlight : highlight,
31
+ }) })] }));
32
+ };
@@ -0,0 +1,16 @@
1
+ import { ReactNode } from "react";
2
+ import type { FraudReportTransaction } from "../../utils/fraudReport/types";
3
+ import { FraudReportStepProps } from "./FraudReportLayout";
4
+ export type FraudReportTransactionPickerProps = {
5
+ visible: boolean;
6
+ selected: FraudReportTransaction[];
7
+ onConfirm: (transactions: FraudReportTransaction[]) => void;
8
+ onClose: () => void;
9
+ };
10
+ type Props = FraudReportStepProps<"transactions"> & {
11
+ onPrevious: () => void;
12
+ loading?: boolean;
13
+ renderPicker: (props: FraudReportTransactionPickerProps) => ReactNode;
14
+ };
15
+ export declare const TransactionsStep: ({ values, onNext, onPrevious, loading, renderPicker }: Props) => import("react").JSX.Element;
16
+ export {};
@@ -0,0 +1,120 @@
1
+ import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { Box } from "@swan-io/lake/src/components/Box";
3
+ import { Cell, CopyableTextCell, HeaderCell, TextCell } from "@swan-io/lake/src/components/Cells";
4
+ import { EmptyView } from "@swan-io/lake/src/components/EmptyView";
5
+ import { LakeButton } from "@swan-io/lake/src/components/LakeButton";
6
+ import { LakeText } from "@swan-io/lake/src/components/LakeText";
7
+ import { PlainListView } from "@swan-io/lake/src/components/PlainListView";
8
+ import { Space } from "@swan-io/lake/src/components/Space";
9
+ import { Tag } from "@swan-io/lake/src/components/Tag";
10
+ import { Tile, TileFullWidthContent } from "@swan-io/lake/src/components/Tile";
11
+ import { backgroundColor, colors } from "@swan-io/lake/src/constants/design";
12
+ import { useEffect, useRef, useState } from "react";
13
+ import { removeDuplicateTransactions } from "../../utils/fraudReport/transactions";
14
+ import { t } from "../../utils/i18n";
15
+ import { FraudReportFooter, useFraudReportSmallLayout, } from "./FraudReportLayout";
16
+ import { formatTransactionAmount, formatTransactionDate, getPaymentMethodLabel, TransactionsTotals, } from "./TransactionRows";
17
+ const removeColumn = {
18
+ id: "remove",
19
+ width: 56,
20
+ title: "",
21
+ renderTitle: () => null,
22
+ renderCell: ({ item, extraInfo: { disabled, onRemove, setRemoveButton } }) => (_jsx(Cell, { align: "right", children: _jsx(LakeButton, { ref: element => setRemoveButton(item.id, element), mode: "tertiary", size: "small", color: "negative", icon: "subtract-circle-regular", disabled: disabled, ariaLabel: t("fraudReport.transactions.remove", {
23
+ counterparty: item.counterparty,
24
+ amount: formatTransactionAmount(item),
25
+ date: formatTransactionDate(item),
26
+ }), onPress: () => onRemove(item.id) }) })),
27
+ };
28
+ const columns = [
29
+ {
30
+ id: "date",
31
+ width: 120,
32
+ title: t("fraudReport.transactions.date"),
33
+ renderTitle: ({ title }) => _jsx(HeaderCell, { text: title }),
34
+ renderCell: ({ item }) => _jsx(TextCell, { text: formatTransactionDate(item) }),
35
+ },
36
+ {
37
+ id: "counterparty",
38
+ width: "grow",
39
+ title: t("fraudReport.transactions.paidTo"),
40
+ renderTitle: ({ title }) => _jsx(HeaderCell, { text: title }),
41
+ renderCell: ({ item }) => _jsx(TextCell, { text: item.counterparty }),
42
+ },
43
+ {
44
+ id: "amount",
45
+ width: 130,
46
+ title: t("fraudReport.transactions.amount"),
47
+ renderTitle: ({ title }) => _jsx(HeaderCell, { text: title }),
48
+ renderCell: ({ item }) => _jsx(TextCell, { text: formatTransactionAmount(item) }),
49
+ },
50
+ {
51
+ id: "paymentMethod",
52
+ width: 240,
53
+ title: t("fraudReport.transactions.paymentMethod"),
54
+ renderTitle: ({ title }) => _jsx(HeaderCell, { text: title }),
55
+ renderCell: ({ item }) => (_jsx(Cell, { children: _jsx(Tag, { color: "gray", children: getPaymentMethodLabel(item.type) }) })),
56
+ },
57
+ {
58
+ id: "transactionId",
59
+ width: "grow",
60
+ title: t("fraudReport.transactions.transactionId"),
61
+ renderTitle: ({ title }) => _jsx(HeaderCell, { text: title }),
62
+ renderCell: ({ item }) => (_jsx(CopyableTextCell, { text: item.id, copyWording: t("copyButton.copyTooltip"), copiedWording: t("copyButton.copiedTooltip") })),
63
+ },
64
+ removeColumn,
65
+ ];
66
+ const smallColumns = [
67
+ {
68
+ id: "summary",
69
+ width: "grow",
70
+ title: "",
71
+ renderTitle: () => null,
72
+ renderCell: ({ item }) => (_jsxs(Cell, { direction: "column", children: [_jsx(LakeText, { numberOfLines: 1, color: colors.gray[700], children: item.counterparty }), _jsx(LakeText, { variant: "medium", color: colors.gray[900], children: formatTransactionAmount(item) })] })),
73
+ },
74
+ removeColumn,
75
+ ];
76
+ export const TransactionsStep = ({ values, onNext, onPrevious, loading, renderPicker }) => {
77
+ const small = useFraudReportSmallLayout();
78
+ const [transactions, setTransactions] = useState(values.transactions);
79
+ const [pickerVisible, setPickerVisible] = useState(false);
80
+ const removeButtons = useRef(new Map());
81
+ const selectButtonRef = useRef(null);
82
+ const [focusAfterRemove, setFocusAfterRemove] = useState();
83
+ useEffect(() => {
84
+ if (focusAfterRemove !== undefined) {
85
+ const element = focusAfterRemove.id === null
86
+ ? selectButtonRef.current
87
+ : removeButtons.current.get(focusAfterRemove.id);
88
+ element === null || element === void 0 ? void 0 : element.focus();
89
+ }
90
+ }, [focusAfterRemove]);
91
+ const removeTransaction = (id) => {
92
+ var _a, _b;
93
+ const index = transactions.findIndex(item => item.id === id);
94
+ const next = (_a = transactions[index + 1]) !== null && _a !== void 0 ? _a : transactions[index - 1];
95
+ setFocusAfterRemove({ id: (_b = next === null || next === void 0 ? void 0 : next.id) !== null && _b !== void 0 ? _b : null });
96
+ setTransactions(transactions.filter(item => item.id !== id));
97
+ };
98
+ const empty = transactions.length === 0;
99
+ const selectButton = (_jsx(LakeButton, { ref: selectButtonRef, size: small ? "large" : "small", grow: small, mode: "secondary", icon: "add-circle-regular", disabled: loading, onPress: () => setPickerVisible(true), children: t("fraudReport.transactions.select") }));
100
+ return (_jsxs(_Fragment, { children: [_jsx(Tile, { title: t("fraudReport.transactions.title"), description: t("fraudReport.transactions.description"), children: _jsx(Box, { direction: small ? "column" : "row", children: _jsx(TransactionsTotals, { transactions: transactions }) }) }), _jsx(Space, { height: 24 }), _jsxs(Tile, { title: _jsxs(_Fragment, { children: [t("fraudReport.transactions.listTitle"), _jsx(Space, { width: 8 }), _jsx(Tag, { color: empty ? "negative" : "gray", children: String(transactions.length) })] }), headerEnd: small ? undefined : selectButton, children: [empty ? (_jsx(EmptyView, { icon: "lake-inbox-empty", borderedIcon: true, title: t("fraudReport.transactions.emptyTitle"), subtitle: small ? undefined : t("fraudReport.transactions.emptySubtitle") })) : (_jsx(TileFullWidthContent, { children: _jsx(PlainListView, { data: transactions, keyExtractor: ({ id }) => id, extraInfo: {
101
+ disabled: loading === true,
102
+ onRemove: removeTransaction,
103
+ setRemoveButton: (id, element) => {
104
+ if (element === null) {
105
+ removeButtons.current.delete(id);
106
+ }
107
+ else {
108
+ removeButtons.current.set(id, element);
109
+ }
110
+ },
111
+ }, columns: columns, smallColumns: smallColumns, breakpoint: small ? Number.POSITIVE_INFINITY : 0, withoutScroll: true, headerHeight: 48, rowHeight: small ? 72 : 56, groupHeaderHeight: 48, headerBackgroundColor: backgroundColor.accented }) })), small ? (_jsxs(_Fragment, { children: [_jsx(Space, { height: 24 }), selectButton] })) : null] }), renderPicker({
112
+ visible: pickerVisible,
113
+ selected: transactions,
114
+ onConfirm: selected => {
115
+ setTransactions(removeDuplicateTransactions(selected));
116
+ setPickerVisible(false);
117
+ },
118
+ onClose: () => setPickerVisible(false),
119
+ }), _jsx(FraudReportFooter, { onPrevious: onPrevious, onNext: () => onNext({ transactions }), loading: loading, nextDisabled: empty })] }));
120
+ };
@@ -0,0 +1,11 @@
1
+ import { Option } from "@bloodyowl/boxed";
2
+ import type { FraudReportTransaction } from "../../utils/fraudReport/types";
3
+ import { FraudReportAccountMembership } from "../../utils/fraudReport/victim";
4
+ import { FraudReportStepProps } from "./FraudReportLayout";
5
+ type Props = FraudReportStepProps<"victimAccountMembershipId"> & {
6
+ transactions: FraudReportTransaction[];
7
+ currentAccountMembership: Option<FraudReportAccountMembership>;
8
+ accountMemberships: FraudReportAccountMembership[];
9
+ };
10
+ export declare const VictimStep: ({ currentAccountMembership, accountMemberships, transactions, values, onNext, }: Props) => import("react").JSX.Element;
11
+ export {};
@@ -0,0 +1,88 @@
1
+ import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { Option } from "@bloodyowl/boxed";
3
+ import { Box } from "@swan-io/lake/src/components/Box";
4
+ import { LakeLabel } from "@swan-io/lake/src/components/LakeLabel";
5
+ import { LakeSelect } from "@swan-io/lake/src/components/LakeSelect";
6
+ import { LakeText } from "@swan-io/lake/src/components/LakeText";
7
+ import { InformationTooltip } from "@swan-io/lake/src/components/LakeTooltip";
8
+ import { RadioGroup } from "@swan-io/lake/src/components/RadioGroup";
9
+ import { Space } from "@swan-io/lake/src/components/Space";
10
+ import { Tile } from "@swan-io/lake/src/components/Tile";
11
+ import { colors } from "@swan-io/lake/src/constants/design";
12
+ import { isNullishOrEmpty } from "@swan-io/lake/src/utils/nullish";
13
+ import { useState } from "react";
14
+ import { StyleSheet, View } from "react-native";
15
+ import { getInitialVictimChoice, getOtherAccountMemberships, getSelectedAccountMembershipId, getVictimAccountMembershipId, getVictimChange, } from "../../utils/fraudReport/victim";
16
+ import { formatNestedMessage, t } from "../../utils/i18n";
17
+ import { ConfirmModal } from "../ConfirmModal";
18
+ import { FraudReportFooter, useFraudReportSmallLayout, } from "./FraudReportLayout";
19
+ const styles = StyleSheet.create({
20
+ column: {
21
+ flexBasis: 0,
22
+ flexGrow: 1,
23
+ },
24
+ });
25
+ export const VictimStep = ({ currentAccountMembership, accountMemberships, transactions, values, onNext, }) => {
26
+ const small = useFraudReportSmallLayout();
27
+ const [confirmVisible, setConfirmVisible] = useState(false);
28
+ const [choice, setChoice] = useState(() => getInitialVictimChoice({
29
+ currentAccountMembership,
30
+ victimAccountMembershipId: values.victimAccountMembershipId,
31
+ }));
32
+ const selectedId = getSelectedAccountMembershipId({
33
+ currentAccountMembership,
34
+ accountMemberships,
35
+ choice,
36
+ });
37
+ const victim = getVictimAccountMembershipId({
38
+ currentAccountMembership,
39
+ accountMemberships,
40
+ choice,
41
+ });
42
+ const answerItems = [
43
+ { name: t("common.yes"), value: "Myself" },
44
+ { name: t("common.no"), value: "SomeoneElse" },
45
+ ];
46
+ const memberItems = getOtherAccountMemberships({
47
+ currentAccountMembership,
48
+ accountMemberships,
49
+ }).map(({ id, name, phoneNumber }) => ({
50
+ name,
51
+ value: id,
52
+ phoneNumber,
53
+ searchTerms: isNullishOrEmpty(phoneNumber)
54
+ ? undefined
55
+ : [phoneNumber, phoneNumber.replace(/\s/g, "")],
56
+ }));
57
+ const memberPicker = (_jsx(LakeLabel, { label: t("fraudReport.victim.memberLabel"), help: small || currentAccountMembership.isNone() ? undefined : (_jsx(InformationTooltip, { text: t("fraudReport.victim.memberHelp"), focusable: true })), render: id => (_jsx(LakeSelect, { id: id, items: memberItems, hasSearch: true, searchPlaceholder: t("fraudReport.victim.searchMember"), renderItem: (item, isSelected) => (_jsxs(Box, { direction: "column", children: [_jsx(LakeText, { color: isSelected ? colors.gray[800] : colors.gray[900], numberOfLines: 1, children: item.name }), isNullishOrEmpty(item.phoneNumber) ? null : (_jsx(LakeText, { variant: "smallRegular", color: colors.gray[600], children: item.phoneNumber }))] })), value: selectedId.toUndefined(), onValueChange: value => setChoice(previous => ({ ...previous, selectedId: Option.Some(value) })) })) }));
58
+ return (_jsxs(_Fragment, { children: [_jsx(Tile, { title: t("fraudReport.victim.title"), description: t("fraudReport.victim.description"), children: currentAccountMembership.match({
59
+ None: () => memberPicker,
60
+ Some: current => (_jsxs(Box, { direction: small ? "column" : "row", children: [_jsxs(View, { style: !small && styles.column, children: [_jsx(LakeLabel, { type: "radioGroup", label: t("fraudReport.victim.forYourself"), render: () => (_jsx(RadioGroup, { direction: small ? "column" : "row", hideErrors: true, items: answerItems, value: choice.answer.toUndefined(), onValueChange: answer => setChoice(previous => ({ ...previous, answer: Option.Some(answer) })) })) }), choice.answer.toUndefined() === "Myself" ? (_jsxs(_Fragment, { children: [_jsx(Space, { height: 40 }), _jsx(LakeText, { variant: "medium", color: colors.gray[700], children: formatNestedMessage("fraudReport.victim.reportingFor", {
61
+ name: current.name,
62
+ highlight: chunks => (_jsx(LakeText, { variant: "medium", color: colors.current[500], children: chunks })),
63
+ }) })] })) : null] }), choice.answer.toUndefined() === "SomeoneElse" ? (_jsxs(_Fragment, { children: [_jsx(Space, { width: 24, height: 24 }), _jsx(View, { style: !small && styles.column, children: memberPicker })] })) : null] })),
64
+ }) }), _jsx(FraudReportFooter, { nextDisabled: victim.isNone(), onNext: () => victim.tapSome(victimAccountMembershipId => {
65
+ const { removed } = getVictimChange({
66
+ transactions,
67
+ previousVictimAccountMembershipId: values.victimAccountMembershipId,
68
+ victimAccountMembershipId,
69
+ });
70
+ if (removed.length > 0) {
71
+ setConfirmVisible(true);
72
+ }
73
+ else {
74
+ onNext({ victimAccountMembershipId });
75
+ }
76
+ }) }), _jsx(ConfirmModal, { visible: confirmVisible, icon: "warning-regular", color: "warning", title: t("fraudReport.victim.changeTitle"), message: transactions.some(({ rail }) => rail === "Transfer")
77
+ ? t("fraudReport.victim.changeMessage")
78
+ : t("fraudReport.victim.changeMessageCardsOnly"), confirmText: t("fraudReport.victim.changeConfirm"), onCancel: () => {
79
+ setConfirmVisible(false);
80
+ setChoice(getInitialVictimChoice({
81
+ currentAccountMembership,
82
+ victimAccountMembershipId: values.victimAccountMembershipId,
83
+ }));
84
+ }, onConfirm: () => {
85
+ setConfirmVisible(false);
86
+ victim.tapSome(victimAccountMembershipId => onNext({ victimAccountMembershipId }));
87
+ } })] }));
88
+ };
@@ -71,13 +71,14 @@ export const InlineDatePicker = ({ value, label, optionalLabel, readOnly = false
71
71
  const { Field, validateField } = useForm({
72
72
  date: {
73
73
  initialValue: isNotNullish(value) ? extractDate(value) : undefined,
74
- sanitize: date => isNotNullish(date)
75
- ? {
76
- day: date.day.trim(),
77
- month: date.month.trim(),
78
- year: date.year.trim(),
74
+ sanitize: date => {
75
+ if (isNullish(date)) {
76
+ return undefined;
79
77
  }
80
- : undefined,
78
+ const day = date.day.trim();
79
+ const year = date.year.trim();
80
+ return day === "" && year === "" ? undefined : { day, month: date.month.trim(), year };
81
+ },
81
82
  strategy: "onSubmit",
82
83
  validate: date => {
83
84
  const errorMessage = validate(date);
@@ -137,5 +137,5 @@ export const LakeModal = ({ visible, icon, title, color = "current", children, m
137
137
  if (rootElement == null) {
138
138
  return null;
139
139
  }
140
- return (_jsx(Portal, { container: rootElement, children: _jsxs(View, { role: "dialog", "aria-modal": true, "aria-hidden": !visible, "aria-labelledby": visible && title != null ? titleId : undefined, style: [styles.container, !visible && styles.inert], children: [_jsx(TransitionView, { style: styles.fill, enter: styles.overlayEnter, leave: styles.overlayLeave, children: visible ? _jsx(View, { style: styles.overlay }) : null }), _jsx(Suspendable, { fallback: _jsx(LoadingView, { color: backgroundColor.accented, delay: 0 }), children: _jsx(TransitionView, { style: styles.fill, enter: styles.modalEnter, leave: styles.modalLeave, children: visible ? (_jsx(ResponsiveContainer, { style: styles.root, breakpoint: breakpoints.tiny, children: ({ large, small }) => (_jsx(FocusTrap, { autoFocus: true, focusLock: true, returnFocus: true, onEscapeKey: onPressClose, style: styles.trap, children: _jsxs(ScrollView, { style: styles.modalContainer, contentContainerStyle: large ? styles.modalContentContainer : styles.modalContentContainerSmall, children: [onPressClose != null ? (_jsx(Pressable, { onPress: onPressClose, style: styles.pressableOverlay })) : null, _jsxs(View, { role: "dialog", style: [large ? styles.modal : styles.modalSmall, { maxWidth }], children: [_jsxs(View, { style: styles.modalHeader, children: [_jsxs(View, { style: styles.modalIconTitle, children: [icon != null ? (_jsx(Icon, { name: icon, size: large ? 40 : 32, color: colors[color][500] })) : null, icon != null && title != null ? _jsx(Space, { height: 12 }) : null, title != null ? (_jsxs(_Fragment, { children: [_jsx(LakeHeading, { id: titleId, level: 2, variant: "h3", children: title }), _jsx(Space, { height: 12 })] })) : null] }), onPressClose != null ? (_jsx(LakeButton, { style: styles.closeButton, mode: "tertiary", onPress: onPressClose, icon: "lake-close", ariaLabel: t("common.close") })) : null] }), typeof children === "function" ? children({ large, small }) : children] })] }) })) })) : null }) })] }) }));
140
+ return (_jsx(Portal, { container: rootElement, children: _jsxs(View, { role: "dialog", "aria-modal": true, "aria-hidden": !visible, "aria-labelledby": visible && title != null ? titleId : undefined, style: [styles.container, !visible && styles.inert], children: [_jsx(TransitionView, { style: styles.fill, enter: styles.overlayEnter, leave: styles.overlayLeave, children: visible ? _jsx(View, { style: styles.overlay }) : null }), _jsx(Suspendable, { fallback: _jsx(LoadingView, { color: backgroundColor.accented, delay: 0 }), children: _jsx(TransitionView, { style: styles.fill, enter: styles.modalEnter, leave: styles.modalLeave, children: visible ? (_jsx(ResponsiveContainer, { style: styles.root, breakpoint: breakpoints.tiny, children: ({ large, small }) => (_jsx(FocusTrap, { autoFocus: true, focusLock: true, returnFocus: true, onEscapeKey: onPressClose, style: styles.trap, children: _jsxs(ScrollView, { style: styles.modalContainer, contentContainerStyle: large ? styles.modalContentContainer : styles.modalContentContainerSmall, children: [onPressClose != null ? (_jsx(Pressable, { onPress: onPressClose, style: styles.pressableOverlay })) : null, _jsxs(View, { style: [large ? styles.modal : styles.modalSmall, { maxWidth }], children: [_jsxs(View, { style: styles.modalHeader, children: [_jsxs(View, { style: styles.modalIconTitle, children: [icon != null ? (_jsx(Icon, { name: icon, size: large ? 40 : 32, color: colors[color][500] })) : null, icon != null && title != null ? _jsx(Space, { height: 12 }) : null, title != null ? (_jsxs(_Fragment, { children: [_jsx(LakeHeading, { id: titleId, level: 2, variant: "h3", children: title }), _jsx(Space, { height: 12 })] })) : null] }), onPressClose != null ? (_jsx(LakeButton, { style: styles.closeButton, mode: "tertiary", onPress: onPressClose, icon: "lake-close", ariaLabel: t("common.close") })) : null] }), typeof children === "function" ? children({ large, small }) : children] })] }) })) })) : null }) })] }) }));
141
141
  };
@@ -1,5 +1,5 @@
1
1
  import { describe, expect, test } from "vitest";
2
- import { allCountries, frenchTerritories, isFrenchTerritoryCCA3, isTerritoryCCA3, nationalities, sovereignCountries, } from "../countries";
2
+ import { allCountries, frenchTerritories, isFrenchTerritoryCCA3, isTerritoryCCA3, nationalities, phoneCountries, sovereignCountries, } from "../countries";
3
3
  describe("sovereignCountries", () => {
4
4
  test("excludes territories", () => {
5
5
  for (const cca3 of ["MTQ", "REU", "GLP", "GUF", "PRI", "GRL"]) {
@@ -35,3 +35,34 @@ describe("frenchTerritories", () => {
35
35
  expect(frenchTerritories.every(cca3 => allCountries.includes(cca3))).toBe(true);
36
36
  });
37
37
  });
38
+ describe("phoneCountries", () => {
39
+ const markets = ["FRA", "DEU", "ESP", "ITA", "NLD", "BEL", "PRT"];
40
+ const blockedCountries = [
41
+ "BDI",
42
+ "BLR",
43
+ "CUB",
44
+ "GNB",
45
+ "IRQ",
46
+ "IRN",
47
+ "PRK",
48
+ "LBN",
49
+ "LBY",
50
+ "MLI",
51
+ "MMR",
52
+ "NGA",
53
+ "RUS",
54
+ "SDN",
55
+ "SOM",
56
+ "SSD",
57
+ "SYR",
58
+ "TUR",
59
+ "VEN",
60
+ "YEM",
61
+ ];
62
+ test("lists our markets first", () => {
63
+ expect(phoneCountries.slice(0, markets.length)).toEqual(markets);
64
+ });
65
+ test("lists the other countries after our markets, in alphabetical order", () => {
66
+ expect(phoneCountries.slice(markets.length)).toEqual(allCountries.filter(cca3 => !markets.includes(cca3) && !blockedCountries.includes(cca3)));
67
+ });
68
+ });
@@ -1762,7 +1762,8 @@ export declare const isTerritoryCCA3: (cca3: CountryCCA3) => boolean;
1762
1762
  export declare const sovereignCountries: ("ABW" | "AFG" | "AGO" | "AIA" | "ALA" | "ALB" | "AND" | "ARE" | "ARG" | "ARM" | "ASM" | "ATA" | "ATF" | "ATG" | "AUS" | "AUT" | "AZE" | "BDI" | "BEL" | "BEN" | "BES" | "BFA" | "BGD" | "BGR" | "BHR" | "BHS" | "BIH" | "BLM" | "BLR" | "BLZ" | "BMU" | "BOL" | "BRA" | "BRB" | "BRN" | "BTN" | "BVT" | "BWA" | "CAF" | "CAN" | "CCK" | "CHE" | "CHL" | "CHN" | "CIV" | "CMR" | "COD" | "COG" | "COK" | "COL" | "COM" | "CPV" | "CRI" | "CUB" | "CUW" | "CXR" | "CYM" | "CYP" | "CZE" | "DEU" | "DJI" | "DMA" | "DNK" | "DOM" | "DZA" | "ECU" | "EGY" | "ERI" | "ESH" | "ESP" | "EST" | "ETH" | "FIN" | "FJI" | "FLK" | "FRA" | "FRO" | "FSM" | "GAB" | "GBR" | "GEO" | "GGY" | "GHA" | "GIB" | "GIN" | "GLP" | "GMB" | "GNB" | "GNQ" | "GRC" | "GRD" | "GRL" | "GTM" | "GUF" | "GUM" | "GUY" | "HKG" | "HMD" | "HND" | "HRV" | "HTI" | "HUN" | "IDN" | "IMN" | "IND" | "IRL" | "IRN" | "IRQ" | "ISL" | "ISR" | "ITA" | "JAM" | "JEY" | "JOR" | "JPN" | "KAZ" | "KEN" | "KGZ" | "KHM" | "KIR" | "KNA" | "KOR" | "KWT" | "LAO" | "LBN" | "LBR" | "LBY" | "LCA" | "LIE" | "LKA" | "LSO" | "LTU" | "LUX" | "LVA" | "MAC" | "MAF" | "MAR" | "MCO" | "MDA" | "MDG" | "MDV" | "MEX" | "MHL" | "MKD" | "MLI" | "MLT" | "MMR" | "MNE" | "MNG" | "MNP" | "MOZ" | "MRT" | "MSR" | "MTQ" | "MUS" | "MWI" | "MYS" | "MYT" | "NAM" | "NCL" | "NER" | "NFK" | "NGA" | "NIC" | "NIU" | "NLD" | "NOR" | "NPL" | "NRU" | "NZL" | "OMN" | "PAK" | "PAN" | "PCN" | "PER" | "PHL" | "PLW" | "PNG" | "POL" | "PRI" | "PRK" | "PRT" | "PRY" | "PSE" | "PYF" | "QAT" | "REU" | "ROU" | "RUS" | "RWA" | "SAU" | "SDN" | "SEN" | "SGP" | "SGS" | "SLB" | "SLE" | "SLV" | "SMR" | "SOM" | "SPM" | "SRB" | "SSD" | "STP" | "SUR" | "SVK" | "SVN" | "SWE" | "SWZ" | "SYC" | "SYR" | "TCA" | "TCD" | "TGO" | "THA" | "TJK" | "TKM" | "TLS" | "TON" | "TTO" | "TUN" | "TUR" | "TUV" | "TWN" | "TZA" | "UGA" | "UKR" | "UMI" | "URY" | "USA" | "UZB" | "VAT" | "VCT" | "VEN" | "VGB" | "VIR" | "VNM" | "VUT" | "WLF" | "WSM" | "XKX" | "YEM" | "ZAF" | "ZMB" | "ZWE")[];
1763
1763
  export declare const frenchTerritories: CountryCCA3[];
1764
1764
  export declare const isFrenchTerritoryCCA3: (value: unknown) => value is CountryCCA3;
1765
- export declare const phoneCountries: ("ABW" | "AFG" | "AGO" | "AIA" | "ALA" | "ALB" | "AND" | "ARE" | "ARG" | "ARM" | "ASM" | "ATA" | "ATF" | "ATG" | "AUS" | "AUT" | "AZE" | "BDI" | "BEL" | "BEN" | "BES" | "BFA" | "BGD" | "BGR" | "BHR" | "BHS" | "BIH" | "BLM" | "BLR" | "BLZ" | "BMU" | "BOL" | "BRA" | "BRB" | "BRN" | "BTN" | "BVT" | "BWA" | "CAF" | "CAN" | "CCK" | "CHE" | "CHL" | "CHN" | "CIV" | "CMR" | "COD" | "COG" | "COK" | "COL" | "COM" | "CPV" | "CRI" | "CUB" | "CUW" | "CXR" | "CYM" | "CYP" | "CZE" | "DEU" | "DJI" | "DMA" | "DNK" | "DOM" | "DZA" | "ECU" | "EGY" | "ERI" | "ESH" | "ESP" | "EST" | "ETH" | "FIN" | "FJI" | "FLK" | "FRA" | "FRO" | "FSM" | "GAB" | "GBR" | "GEO" | "GGY" | "GHA" | "GIB" | "GIN" | "GLP" | "GMB" | "GNB" | "GNQ" | "GRC" | "GRD" | "GRL" | "GTM" | "GUF" | "GUM" | "GUY" | "HKG" | "HMD" | "HND" | "HRV" | "HTI" | "HUN" | "IDN" | "IMN" | "IND" | "IRL" | "IRN" | "IRQ" | "ISL" | "ISR" | "ITA" | "JAM" | "JEY" | "JOR" | "JPN" | "KAZ" | "KEN" | "KGZ" | "KHM" | "KIR" | "KNA" | "KOR" | "KWT" | "LAO" | "LBN" | "LBR" | "LBY" | "LCA" | "LIE" | "LKA" | "LSO" | "LTU" | "LUX" | "LVA" | "MAC" | "MAF" | "MAR" | "MCO" | "MDA" | "MDG" | "MDV" | "MEX" | "MHL" | "MKD" | "MLI" | "MLT" | "MMR" | "MNE" | "MNG" | "MNP" | "MOZ" | "MRT" | "MSR" | "MTQ" | "MUS" | "MWI" | "MYS" | "MYT" | "NAM" | "NCL" | "NER" | "NFK" | "NGA" | "NIC" | "NIU" | "NLD" | "NOR" | "NPL" | "NRU" | "NZL" | "OMN" | "PAK" | "PAN" | "PCN" | "PER" | "PHL" | "PLW" | "PNG" | "POL" | "PRI" | "PRK" | "PRT" | "PRY" | "PSE" | "PYF" | "QAT" | "REU" | "ROU" | "RUS" | "RWA" | "SAU" | "SDN" | "SEN" | "SGP" | "SGS" | "SLB" | "SLE" | "SLV" | "SMR" | "SOM" | "SPM" | "SRB" | "SSD" | "STP" | "SUR" | "SVK" | "SVN" | "SWE" | "SWZ" | "SYC" | "SYR" | "TCA" | "TCD" | "TGO" | "THA" | "TJK" | "TKM" | "TLS" | "TON" | "TTO" | "TUN" | "TUR" | "TUV" | "TWN" | "TZA" | "UGA" | "UKR" | "UMI" | "URY" | "USA" | "UZB" | "VAT" | "VCT" | "VEN" | "VGB" | "VIR" | "VNM" | "VUT" | "WLF" | "WSM" | "XKX" | "YEM" | "ZAF" | "ZMB" | "ZWE")[];
1765
+ export declare const phoneMarketCountries: CountryCCA3[];
1766
+ export declare const phoneCountries: CountryCCA3[];
1766
1767
  export declare const individualCountries: ("AUT" | "BEL" | "BGR" | "CYP" | "CZE" | "DEU" | "DNK" | "ESP" | "EST" | "FIN" | "FRA" | "GRC" | "HRV" | "HUN" | "IRL" | "ISL" | "ITA" | "LIE" | "LTU" | "LUX" | "LVA" | "MLT" | "NLD" | "NOR" | "POL" | "PRT" | "ROU" | "SVK" | "SVN" | "SWE")[];
1767
1768
  export type IndividualCountryCCA3 = (typeof individualCountries)[number];
1768
1769
  export declare const companyCountries: ("AUT" | "BEL" | "BGR" | "CYP" | "CZE" | "DEU" | "DNK" | "ESP" | "EST" | "FIN" | "FRA" | "GRC" | "HRV" | "HUN" | "IRL" | "ISL" | "ITA" | "LIE" | "LTU" | "LUX" | "LVA" | "MLT" | "NLD" | "NOR" | "POL" | "PRT" | "ROU" | "SVK" | "SVN" | "SWE")[];