@swan-io/shared-business 18.4.0 → 18.5.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.
- package/package.json +3 -3
- package/src/components/FraudReport/FraudReportLayout.d.ts +23 -0
- package/src/components/FraudReport/FraudReportLayout.js +35 -0
- package/src/components/FraudReport/IncidentStep.d.ts +7 -0
- package/src/components/FraudReport/IncidentStep.js +55 -0
- package/src/components/FraudReport/IntroStep.d.ts +5 -0
- package/src/components/FraudReport/IntroStep.js +28 -0
- package/src/components/FraudReport/TransactionsStep.d.ts +16 -0
- package/src/components/FraudReport/TransactionsStep.js +138 -0
- package/src/components/FraudReport/VictimStep.d.ts +9 -0
- package/src/components/FraudReport/VictimStep.js +55 -0
- package/src/components/InlineDatePicker.js +7 -6
- package/src/constants/__tests__/countries.test.js +32 -1
- package/src/constants/countries.d.ts +2 -1
- package/src/constants/countries.js +36 -2
- package/src/hooks/__tests__/useFraudReportFlow.test.d.ts +1 -0
- package/src/hooks/__tests__/useFraudReportFlow.test.js +979 -0
- package/src/hooks/useFraudReportFlow.d.ts +32 -0
- package/src/hooks/useFraudReportFlow.js +260 -0
- package/src/locales/de.json +76 -0
- package/src/locales/en.json +76 -0
- package/src/locales/es.json +76 -0
- package/src/locales/fi.json +76 -0
- package/src/locales/fr.json +76 -0
- package/src/locales/it.json +76 -0
- package/src/locales/nl.json +76 -0
- package/src/locales/pt.json +76 -0
- package/src/utils/__tests__/fraudReport.fakeApi.test.js +42 -13
- package/src/utils/__tests__/fraudReport.prefill.test.d.ts +1 -0
- package/src/utils/__tests__/fraudReport.prefill.test.js +149 -0
- package/src/utils/__tests__/fraudReport.rejections.test.d.ts +1 -0
- package/src/utils/__tests__/fraudReport.rejections.test.js +163 -0
- package/src/utils/__tests__/fraudReport.resume.test.d.ts +1 -0
- package/src/utils/__tests__/fraudReport.resume.test.js +67 -0
- package/src/utils/__tests__/fraudReport.stepper.test.d.ts +1 -0
- package/src/utils/__tests__/fraudReport.stepper.test.js +102 -0
- package/src/utils/__tests__/fraudReport.toInput.test.js +28 -8
- package/src/utils/__tests__/fraudReport.transactions.test.d.ts +1 -0
- package/src/utils/__tests__/fraudReport.transactions.test.js +28 -0
- package/src/utils/__tests__/fraudReport.types.test.d.ts +1 -0
- package/src/utils/__tests__/fraudReport.types.test.js +22 -0
- package/src/utils/__tests__/fraudReport.victim.test.d.ts +1 -0
- package/src/utils/__tests__/fraudReport.victim.test.js +142 -0
- package/src/utils/__tests__/phone.test.js +60 -5
- package/src/utils/fraudReport/fakeApi.d.ts +7 -4
- package/src/utils/fraudReport/fakeApi.js +18 -5
- package/src/utils/fraudReport/prefill.d.ts +3 -0
- package/src/utils/fraudReport/prefill.js +14 -0
- package/src/utils/fraudReport/rejections.d.ts +10 -0
- package/src/utils/fraudReport/rejections.js +53 -0
- package/src/utils/fraudReport/resume.d.ts +4 -0
- package/src/utils/fraudReport/resume.js +26 -0
- package/src/utils/fraudReport/stepper.d.ts +16 -0
- package/src/utils/fraudReport/stepper.js +21 -0
- package/src/utils/fraudReport/toInput.d.ts +9 -0
- package/src/utils/fraudReport/toInput.js +20 -12
- package/src/utils/fraudReport/transactions.d.ts +6 -0
- package/src/utils/fraudReport/transactions.js +7 -0
- package/src/utils/fraudReport/types.d.ts +8 -0
- package/src/utils/fraudReport/validation.d.ts +1 -0
- package/src/utils/fraudReport/validation.js +1 -0
- package/src/utils/fraudReport/victim.d.ts +30 -0
- package/src/utils/fraudReport/victim.js +28 -0
- package/src/utils/phone.d.ts +1 -0
- package/src/utils/phone.js +31 -4
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@swan-io/shared-business",
|
|
3
|
-
"version": "18.
|
|
3
|
+
"version": "18.5.0",
|
|
4
4
|
"engines": {
|
|
5
5
|
"node": ">22.12.0"
|
|
6
6
|
},
|
|
@@ -28,7 +28,7 @@
|
|
|
28
28
|
"react": ">=19.0.0",
|
|
29
29
|
"react-dom": ">=19.0.0",
|
|
30
30
|
"react-native-web": ">=0.21.2",
|
|
31
|
-
"@swan-io/lake": "18.
|
|
31
|
+
"@swan-io/lake": "18.5.0"
|
|
32
32
|
},
|
|
33
33
|
"dependencies": {
|
|
34
34
|
"@formatjs/intl": "^4.1.16",
|
|
@@ -54,6 +54,6 @@
|
|
|
54
54
|
"react-dom": "^19.2.7",
|
|
55
55
|
"react-native-web": "^0.21.2",
|
|
56
56
|
"type-fest": "^5.8.0",
|
|
57
|
-
"@swan-io/lake": "18.
|
|
57
|
+
"@swan-io/lake": "18.5.0"
|
|
58
58
|
}
|
|
59
59
|
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { ReactNode } from "react";
|
|
2
|
+
import { FraudReportLayoutStep } from "../../utils/fraudReport/stepper";
|
|
3
|
+
import type { FraudReportFormValues } from "../../utils/fraudReport/toInput";
|
|
4
|
+
import { FraudReportDetailsStep } from "../../utils/fraudReport/types";
|
|
5
|
+
export type FraudReportStepProps<K extends keyof FraudReportFormValues> = {
|
|
6
|
+
values: Pick<FraudReportFormValues, K>;
|
|
7
|
+
onNext: (values: Pick<FraudReportFormValues, K>) => void;
|
|
8
|
+
};
|
|
9
|
+
export declare const useFraudReportSmallLayout: () => boolean;
|
|
10
|
+
type Props = {
|
|
11
|
+
activeStep: FraudReportLayoutStep;
|
|
12
|
+
detailsSteps: readonly FraudReportDetailsStep[];
|
|
13
|
+
children: ReactNode;
|
|
14
|
+
};
|
|
15
|
+
export declare const FraudReportLayout: ({ activeStep, detailsSteps, children }: Props) => import("react").JSX.Element;
|
|
16
|
+
type FooterProps = {
|
|
17
|
+
onPrevious?: () => void;
|
|
18
|
+
onNext: () => void;
|
|
19
|
+
loading?: boolean;
|
|
20
|
+
nextDisabled?: boolean;
|
|
21
|
+
};
|
|
22
|
+
export declare const FraudReportFooter: ({ onPrevious, onNext, loading, nextDisabled }: FooterProps) => import("react").JSX.Element;
|
|
23
|
+
export {};
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { LakeButton, LakeButtonGroup } from "@swan-io/lake/src/components/LakeButton";
|
|
3
|
+
import { LakeStepper, MobileStepper } from "@swan-io/lake/src/components/LakeStepper";
|
|
4
|
+
import { ResponsiveContainer } from "@swan-io/lake/src/components/ResponsiveContainer";
|
|
5
|
+
import { Space } from "@swan-io/lake/src/components/Space";
|
|
6
|
+
import { breakpoints } from "@swan-io/lake/src/constants/design";
|
|
7
|
+
import { isNotNullish } from "@swan-io/lake/src/utils/nullish";
|
|
8
|
+
import { createContext, useContext } from "react";
|
|
9
|
+
import { StyleSheet } from "react-native";
|
|
10
|
+
import { match } from "ts-pattern";
|
|
11
|
+
import { getFraudReportStepper, } from "../../utils/fraudReport/stepper";
|
|
12
|
+
import { t } from "../../utils/i18n";
|
|
13
|
+
const styles = StyleSheet.create({
|
|
14
|
+
root: {
|
|
15
|
+
alignSelf: "stretch",
|
|
16
|
+
},
|
|
17
|
+
});
|
|
18
|
+
const SmallLayoutContext = createContext(false);
|
|
19
|
+
export const useFraudReportSmallLayout = () => useContext(SmallLayoutContext);
|
|
20
|
+
const getStepLabel = (step) => match(step)
|
|
21
|
+
.with("Victim", () => t("fraudReport.step.victim"))
|
|
22
|
+
.with("Transactions", () => t("fraudReport.step.transactions"))
|
|
23
|
+
.with("Incident", () => t("fraudReport.step.incident"))
|
|
24
|
+
.with("Details", () => t("fraudReport.step.details"))
|
|
25
|
+
.with("Documents", () => t("fraudReport.step.documents"))
|
|
26
|
+
.with("Submitted", () => t("fraudReport.step.confirmation"))
|
|
27
|
+
.exhaustive();
|
|
28
|
+
export const FraudReportLayout = ({ activeStep, detailsSteps, children }) => {
|
|
29
|
+
const stepper = getFraudReportStepper({ activeStep, detailsSteps, getLabel: getStepLabel });
|
|
30
|
+
return (_jsx(ResponsiveContainer, { breakpoint: breakpoints.medium, style: styles.root, children: ({ small }) => (_jsxs(SmallLayoutContext.Provider, { value: small, children: [small ? (_jsx(MobileStepper, { steps: stepper.steps, activeStepId: stepper.activeStepId })) : (_jsx(LakeStepper, { steps: stepper.steps, activeStepId: stepper.activeStepId })), _jsx(Space, { height: small ? 24 : 48 }), children] })) }));
|
|
31
|
+
};
|
|
32
|
+
export const FraudReportFooter = ({ onPrevious, onNext, loading, nextDisabled }) => {
|
|
33
|
+
const small = useFraudReportSmallLayout();
|
|
34
|
+
return (_jsxs(_Fragment, { children: [_jsx(Space, { height: small ? 8 : 16 }), _jsxs(LakeButtonGroup, { paddingBottom: 0, children: [isNotNullish(onPrevious) ? (_jsx(LakeButton, { mode: "secondary", color: "gray", disabled: loading, onPress: onPrevious, children: t("common.previous") })) : null, _jsx(LakeButton, { color: "current", ariaLabel: loading === true ? t("fraudReport.continue") : undefined, loading: loading, disabled: nextDisabled, onPress: onNext, children: t("fraudReport.continue") })] })] }));
|
|
35
|
+
};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { FraudReportStepProps } from "./FraudReportLayout";
|
|
2
|
+
type Props = FraudReportStepProps<"reportedReason" | "reportedTypology" | "description" | "discoveredAt"> & {
|
|
3
|
+
onPrevious: () => void;
|
|
4
|
+
loading?: boolean;
|
|
5
|
+
};
|
|
6
|
+
export declare const IncidentStep: ({ values, onNext, onPrevious, loading }: Props) => import("react").JSX.Element;
|
|
7
|
+
export {};
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { Dict } from "@bloodyowl/boxed";
|
|
3
|
+
import { Grid } from "@swan-io/lake/src/components/Grid";
|
|
4
|
+
import { LakeLabel } from "@swan-io/lake/src/components/LakeLabel";
|
|
5
|
+
import { LakeSelect } from "@swan-io/lake/src/components/LakeSelect";
|
|
6
|
+
import { LakeTextInput } from "@swan-io/lake/src/components/LakeTextInput";
|
|
7
|
+
import { RadioGroup } from "@swan-io/lake/src/components/RadioGroup";
|
|
8
|
+
import { Tile } from "@swan-io/lake/src/components/Tile";
|
|
9
|
+
import { useForm } from "@swan-io/use-form";
|
|
10
|
+
import { match } from "ts-pattern";
|
|
11
|
+
import { DESCRIPTION_MAX_LENGTH, validateDescription, validateNotInFuture, validateSelected, } from "../../utils/fraudReport/validation";
|
|
12
|
+
import { t } from "../../utils/i18n";
|
|
13
|
+
import { InlineDatePicker } from "../InlineDatePicker";
|
|
14
|
+
import { FraudReportFooter, useFraudReportSmallLayout, } from "./FraudReportLayout";
|
|
15
|
+
export const IncidentStep = ({ values, onNext, onPrevious, loading }) => {
|
|
16
|
+
var _a;
|
|
17
|
+
const small = useFraudReportSmallLayout();
|
|
18
|
+
const { Field, submitForm } = useForm({
|
|
19
|
+
reportedReason: { initialValue: values.reportedReason, validate: validateSelected },
|
|
20
|
+
description: { initialValue: (_a = values.description) !== null && _a !== void 0 ? _a : "", validate: validateDescription },
|
|
21
|
+
reportedTypology: { initialValue: values.reportedTypology, validate: validateSelected },
|
|
22
|
+
discoveredAt: { initialValue: values.discoveredAt, validate: validateNotInFuture },
|
|
23
|
+
});
|
|
24
|
+
const reasonItems = [
|
|
25
|
+
{ name: t("common.yes"), value: "Manipulated" },
|
|
26
|
+
{ name: t("common.no"), value: "Unauthorized" },
|
|
27
|
+
];
|
|
28
|
+
const typologyLabels = {
|
|
29
|
+
FakeAdvisor: t("fraudReport.incident.typology.FakeAdvisor"),
|
|
30
|
+
ImpersonationOrPhishing: t("fraudReport.incident.typology.ImpersonationOrPhishing"),
|
|
31
|
+
FakeWebsite: t("fraudReport.incident.typology.FakeWebsite"),
|
|
32
|
+
FakeSupplierOrInvoice: t("fraudReport.incident.typology.FakeSupplierOrInvoice"),
|
|
33
|
+
InvestmentScam: t("fraudReport.incident.typology.InvestmentScam"),
|
|
34
|
+
RomanceScam: t("fraudReport.incident.typology.RomanceScam"),
|
|
35
|
+
Other: t("fraudReport.incident.typology.Other"),
|
|
36
|
+
};
|
|
37
|
+
const typologyItems = Dict.entries(typologyLabels).map(([value, name]) => ({ name, value }));
|
|
38
|
+
const onPressNext = () => submitForm({
|
|
39
|
+
onSuccess: ({ reportedReason, reportedTypology, description, discoveredAt }) => onNext({
|
|
40
|
+
reportedReason: reportedReason.toUndefined(),
|
|
41
|
+
reportedTypology: reportedTypology.toUndefined(),
|
|
42
|
+
description: description.toUndefined(),
|
|
43
|
+
discoveredAt: discoveredAt.toUndefined(),
|
|
44
|
+
}),
|
|
45
|
+
});
|
|
46
|
+
return (_jsxs(_Fragment, { children: [_jsxs(Tile, { title: t("fraudReport.incident.title"), description: t("fraudReport.incident.description"), children: [_jsx(Field, { name: "reportedReason", children: ({ value, error, onChange }) => (_jsx(LakeLabel, { type: "radioGroup", label: t("fraudReport.incident.reasonLabel"), render: () => (_jsx(RadioGroup, { direction: small ? "column" : "row", items: reasonItems, value: value, error: error === "Required" ? t("fraudReport.incident.reasonRequired") : undefined, onValueChange: onChange })) })) }), _jsx(Field, { name: "description", children: ({ ref, value, error, onChange, onBlur }) => (_jsx(LakeLabel, { label: t("fraudReport.incident.whatHappenedLabel"), render: id => (_jsx(LakeTextInput, { id: id, ref: ref, multiline: true, placeholder: t("fraudReport.incident.whatHappenedPlaceholder"), value: value, error: match(error)
|
|
47
|
+
.with("Required", () => t("fraudReport.incident.whatHappenedRequired"))
|
|
48
|
+
.with("TooLong", () => t("fraudReport.incident.whatHappenedTooLong", {
|
|
49
|
+
max: DESCRIPTION_MAX_LENGTH,
|
|
50
|
+
}))
|
|
51
|
+
.otherwise(() => undefined), onChangeText: onChange, onBlur: onBlur })) })) }), _jsxs(Grid, { numColumns: small ? 1 : 2, horizontalSpace: 24, children: [_jsx(Field, { name: "reportedTypology", children: ({ ref, value, error, onChange }) => (_jsx(LakeLabel, { label: t("fraudReport.incident.typologyLabel"), render: id => (_jsx(LakeSelect, { id: id, ref: ref, items: typologyItems, value: value, error: error === "Required" ? t("fraudReport.incident.typologyRequired") : undefined, onValueChange: onChange })) })) }), _jsx(Field, { name: "discoveredAt", children: ({ value, error, onChange }) => (_jsx(InlineDatePicker, { label: t("fraudReport.incident.noticedAtLabel"), optionalLabel: t("common.optional"), responsive: !small, value: value, error: match(error)
|
|
52
|
+
.with("InvalidDate", () => t("fraudReport.incident.noticedAtInvalid"))
|
|
53
|
+
.with("DateInFuture", () => t("fraudReport.incident.noticedAtInFuture"))
|
|
54
|
+
.otherwise(() => undefined), validate: () => undefined, onValueChange: onChange })) })] })] }), _jsx(FraudReportFooter, { onPrevious: onPrevious, onNext: onPressNext, loading: loading })] }));
|
|
55
|
+
};
|
|
@@ -0,0 +1,28 @@
|
|
|
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 { BulletList } from "@swan-io/lake/src/components/BulletList";
|
|
4
|
+
import { LakeButton } from "@swan-io/lake/src/components/LakeButton";
|
|
5
|
+
import { LakeText } from "@swan-io/lake/src/components/LakeText";
|
|
6
|
+
import { ResponsiveContainer } from "@swan-io/lake/src/components/ResponsiveContainer";
|
|
7
|
+
import { Space } from "@swan-io/lake/src/components/Space";
|
|
8
|
+
import { Tile } from "@swan-io/lake/src/components/Tile";
|
|
9
|
+
import { breakpoints, colors } from "@swan-io/lake/src/constants/design";
|
|
10
|
+
import { StyleSheet } from "react-native";
|
|
11
|
+
import { formatNestedMessage, t } from "../../utils/i18n";
|
|
12
|
+
const styles = StyleSheet.create({
|
|
13
|
+
root: {
|
|
14
|
+
alignSelf: "stretch",
|
|
15
|
+
},
|
|
16
|
+
});
|
|
17
|
+
const bold = (chunks) => (_jsx(LakeText, { variant: "smallMedium", color: colors.gray[500], children: chunks }));
|
|
18
|
+
export const IntroStep = ({ onStart }) => (_jsx(ResponsiveContainer, { breakpoint: breakpoints.medium, style: styles.root, children: ({ small }) => {
|
|
19
|
+
const padding = small ? 24 : 32;
|
|
20
|
+
return (_jsxs(_Fragment, { children: [_jsx(Tile, { title: t("fraudReport.intro.title"), description: t("fraudReport.intro.description"), paddingVertical: padding, paddingHorizontal: padding }), _jsx(Space, { height: small ? 24 : 48 }), _jsxs(Tile, { title: t("fraudReport.intro.rulesTitle"), paddingVertical: padding, paddingHorizontal: padding, children: [_jsx(BulletList, { variant: "smallRegular", color: colors.gray[500], items: [
|
|
21
|
+
formatNestedMessage("fraudReport.intro.rule.oneVictim", { bold }),
|
|
22
|
+
formatNestedMessage("fraudReport.intro.rule.transactions", { bold }),
|
|
23
|
+
formatNestedMessage("fraudReport.intro.rule.refund", { bold }),
|
|
24
|
+
formatNestedMessage("fraudReport.intro.rule.deadline", { bold }),
|
|
25
|
+
formatNestedMessage("fraudReport.intro.rule.saved", { bold }),
|
|
26
|
+
formatNestedMessage("fraudReport.intro.rule.policeReport", { bold }),
|
|
27
|
+
] }), _jsx(Space, { height: small ? 24 : 32 }), _jsx(LakeText, { variant: "medium", color: colors.gray[500], children: t("fraudReport.intro.falseInformation") })] }), _jsx(Space, { height: small ? 24 : 48 }), _jsx(Box, { direction: "row", children: _jsx(LakeButton, { color: "current", onPress: onStart, children: t("fraudReport.intro.start") }) })] }));
|
|
28
|
+
} }));
|
|
@@ -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,138 @@
|
|
|
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 dayjs from "dayjs";
|
|
13
|
+
import { useEffect, useRef, useState } from "react";
|
|
14
|
+
import { match } from "ts-pattern";
|
|
15
|
+
import { getTransactionsTotal, removeDuplicateTransactions, } from "../../utils/fraudReport/transactions";
|
|
16
|
+
import { formatCurrencySymbol, formatNestedMessage, locale, t } from "../../utils/i18n";
|
|
17
|
+
import { FraudReportFooter, useFraudReportSmallLayout, } from "./FraudReportLayout";
|
|
18
|
+
const getPaymentMethodLabel = (type) => match(type)
|
|
19
|
+
.with("CardOutDebit", () => t("fraudReport.transactions.paymentMethod.card"))
|
|
20
|
+
.with("SepaCreditTransferOut", () => t("fraudReport.transactions.paymentMethod.sepaCreditTransfer"))
|
|
21
|
+
.with("SepaInstantCreditTransferOut", () => t("fraudReport.transactions.paymentMethod.sepaInstantCreditTransfer"))
|
|
22
|
+
.with("InternationalCreditTransferOut", () => t("fraudReport.transactions.paymentMethod.internationalCreditTransfer"))
|
|
23
|
+
.with("InternalCreditTransferOut", () => t("fraudReport.transactions.paymentMethod.internalCreditTransfer"))
|
|
24
|
+
.exhaustive();
|
|
25
|
+
const highlight = (chunks) => (_jsx(LakeText, { variant: "medium", color: colors.current[500], children: chunks }));
|
|
26
|
+
const formatDate = ({ executionDate }) => dayjs(executionDate).format(locale.dateFormat);
|
|
27
|
+
const formatAmount = ({ amount }) => formatCurrencySymbol(Number(amount.value), amount.currency);
|
|
28
|
+
const removeColumn = {
|
|
29
|
+
id: "remove",
|
|
30
|
+
width: 56,
|
|
31
|
+
title: "",
|
|
32
|
+
renderTitle: () => null,
|
|
33
|
+
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", {
|
|
34
|
+
counterparty: item.counterparty,
|
|
35
|
+
amount: formatAmount(item),
|
|
36
|
+
date: formatDate(item),
|
|
37
|
+
}), onPress: () => onRemove(item.id) }) })),
|
|
38
|
+
};
|
|
39
|
+
const columns = [
|
|
40
|
+
{
|
|
41
|
+
id: "date",
|
|
42
|
+
width: 120,
|
|
43
|
+
title: t("fraudReport.transactions.date"),
|
|
44
|
+
renderTitle: ({ title }) => _jsx(HeaderCell, { text: title }),
|
|
45
|
+
renderCell: ({ item }) => _jsx(TextCell, { text: formatDate(item) }),
|
|
46
|
+
},
|
|
47
|
+
{
|
|
48
|
+
id: "counterparty",
|
|
49
|
+
width: "grow",
|
|
50
|
+
title: t("fraudReport.transactions.paidTo"),
|
|
51
|
+
renderTitle: ({ title }) => _jsx(HeaderCell, { text: title }),
|
|
52
|
+
renderCell: ({ item }) => _jsx(TextCell, { text: item.counterparty }),
|
|
53
|
+
},
|
|
54
|
+
{
|
|
55
|
+
id: "amount",
|
|
56
|
+
width: 130,
|
|
57
|
+
title: t("fraudReport.transactions.amount"),
|
|
58
|
+
renderTitle: ({ title }) => _jsx(HeaderCell, { text: title }),
|
|
59
|
+
renderCell: ({ item }) => _jsx(TextCell, { text: formatAmount(item) }),
|
|
60
|
+
},
|
|
61
|
+
{
|
|
62
|
+
id: "paymentMethod",
|
|
63
|
+
width: 240,
|
|
64
|
+
title: t("fraudReport.transactions.paymentMethod"),
|
|
65
|
+
renderTitle: ({ title }) => _jsx(HeaderCell, { text: title }),
|
|
66
|
+
renderCell: ({ item }) => (_jsx(Cell, { children: _jsx(Tag, { color: "gray", children: getPaymentMethodLabel(item.type) }) })),
|
|
67
|
+
},
|
|
68
|
+
{
|
|
69
|
+
id: "transactionId",
|
|
70
|
+
width: "grow",
|
|
71
|
+
title: t("fraudReport.transactions.transactionId"),
|
|
72
|
+
renderTitle: ({ title }) => _jsx(HeaderCell, { text: title }),
|
|
73
|
+
renderCell: ({ item }) => (_jsx(CopyableTextCell, { text: item.id, copyWording: t("copyButton.copyTooltip"), copiedWording: t("copyButton.copiedTooltip") })),
|
|
74
|
+
},
|
|
75
|
+
removeColumn,
|
|
76
|
+
];
|
|
77
|
+
const smallColumns = [
|
|
78
|
+
{
|
|
79
|
+
id: "summary",
|
|
80
|
+
width: "grow",
|
|
81
|
+
title: "",
|
|
82
|
+
renderTitle: () => null,
|
|
83
|
+
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: formatAmount(item) })] })),
|
|
84
|
+
},
|
|
85
|
+
removeColumn,
|
|
86
|
+
];
|
|
87
|
+
export const TransactionsStep = ({ values, onNext, onPrevious, loading, renderPicker }) => {
|
|
88
|
+
const small = useFraudReportSmallLayout();
|
|
89
|
+
const [transactions, setTransactions] = useState(values.transactions);
|
|
90
|
+
const [pickerVisible, setPickerVisible] = useState(false);
|
|
91
|
+
const removeButtons = useRef(new Map());
|
|
92
|
+
const selectButtonRef = useRef(null);
|
|
93
|
+
const [focusAfterRemove, setFocusAfterRemove] = useState();
|
|
94
|
+
useEffect(() => {
|
|
95
|
+
if (focusAfterRemove !== undefined) {
|
|
96
|
+
const element = focusAfterRemove.id === null
|
|
97
|
+
? selectButtonRef.current
|
|
98
|
+
: removeButtons.current.get(focusAfterRemove.id);
|
|
99
|
+
element === null || element === void 0 ? void 0 : element.focus();
|
|
100
|
+
}
|
|
101
|
+
}, [focusAfterRemove]);
|
|
102
|
+
const removeTransaction = (id) => {
|
|
103
|
+
var _a, _b;
|
|
104
|
+
const index = transactions.findIndex(item => item.id === id);
|
|
105
|
+
const next = (_a = transactions[index + 1]) !== null && _a !== void 0 ? _a : transactions[index - 1];
|
|
106
|
+
setFocusAfterRemove({ id: (_b = next === null || next === void 0 ? void 0 : next.id) !== null && _b !== void 0 ? _b : null });
|
|
107
|
+
setTransactions(transactions.filter(item => item.id !== id));
|
|
108
|
+
};
|
|
109
|
+
const total = getTransactionsTotal(transactions);
|
|
110
|
+
const empty = transactions.length === 0;
|
|
111
|
+
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") }));
|
|
112
|
+
return (_jsxs(_Fragment, { children: [_jsx(Tile, { title: t("fraudReport.transactions.title"), description: t("fraudReport.transactions.description"), children: _jsxs(Box, { direction: small ? "column" : "row", children: [_jsx(LakeText, { color: colors.gray[700], children: formatNestedMessage("fraudReport.transactions.total", {
|
|
113
|
+
amount: formatCurrencySymbol(total.value, total.currency),
|
|
114
|
+
highlight,
|
|
115
|
+
}) }), _jsx(Space, { width: 32, height: 8 }), _jsx(LakeText, { color: colors.gray[700], children: formatNestedMessage("fraudReport.transactions.selectedCount", {
|
|
116
|
+
count: transactions.length,
|
|
117
|
+
highlight,
|
|
118
|
+
}) })] }) }), _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: {
|
|
119
|
+
disabled: loading === true,
|
|
120
|
+
onRemove: removeTransaction,
|
|
121
|
+
setRemoveButton: (id, element) => {
|
|
122
|
+
if (element === null) {
|
|
123
|
+
removeButtons.current.delete(id);
|
|
124
|
+
}
|
|
125
|
+
else {
|
|
126
|
+
removeButtons.current.set(id, element);
|
|
127
|
+
}
|
|
128
|
+
},
|
|
129
|
+
}, 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({
|
|
130
|
+
visible: pickerVisible,
|
|
131
|
+
selected: transactions,
|
|
132
|
+
onConfirm: selected => {
|
|
133
|
+
setTransactions(removeDuplicateTransactions(selected));
|
|
134
|
+
setPickerVisible(false);
|
|
135
|
+
},
|
|
136
|
+
onClose: () => setPickerVisible(false),
|
|
137
|
+
}), _jsx(FraudReportFooter, { onPrevious: onPrevious, onNext: () => onNext({ transactions }), loading: loading, nextDisabled: empty })] }));
|
|
138
|
+
};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { Option } from "@bloodyowl/boxed";
|
|
2
|
+
import { FraudReportAccountMembership } from "../../utils/fraudReport/victim";
|
|
3
|
+
import { FraudReportStepProps } from "./FraudReportLayout";
|
|
4
|
+
type Props = FraudReportStepProps<"victimAccountMembershipId"> & {
|
|
5
|
+
currentAccountMembership: Option<FraudReportAccountMembership>;
|
|
6
|
+
accountMemberships: FraudReportAccountMembership[];
|
|
7
|
+
};
|
|
8
|
+
export declare const VictimStep: ({ currentAccountMembership, accountMemberships, values, onNext, }: Props) => import("react").JSX.Element;
|
|
9
|
+
export {};
|
|
@@ -0,0 +1,55 @@
|
|
|
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 { useState } from "react";
|
|
13
|
+
import { StyleSheet, View } from "react-native";
|
|
14
|
+
import { getInitialVictimChoice, getOtherAccountMemberships, getSelectedAccountMembershipId, getVictimAccountMembershipId, } from "../../utils/fraudReport/victim";
|
|
15
|
+
import { formatNestedMessage, t } from "../../utils/i18n";
|
|
16
|
+
import { FraudReportFooter, useFraudReportSmallLayout, } from "./FraudReportLayout";
|
|
17
|
+
const styles = StyleSheet.create({
|
|
18
|
+
column: {
|
|
19
|
+
flexBasis: 0,
|
|
20
|
+
flexGrow: 1,
|
|
21
|
+
},
|
|
22
|
+
});
|
|
23
|
+
export const VictimStep = ({ currentAccountMembership, accountMemberships, values, onNext, }) => {
|
|
24
|
+
const small = useFraudReportSmallLayout();
|
|
25
|
+
const [choice, setChoice] = useState(() => getInitialVictimChoice({
|
|
26
|
+
currentAccountMembership,
|
|
27
|
+
victimAccountMembershipId: values.victimAccountMembershipId,
|
|
28
|
+
}));
|
|
29
|
+
const selectedId = getSelectedAccountMembershipId({
|
|
30
|
+
currentAccountMembership,
|
|
31
|
+
accountMemberships,
|
|
32
|
+
choice,
|
|
33
|
+
});
|
|
34
|
+
const victim = getVictimAccountMembershipId({
|
|
35
|
+
currentAccountMembership,
|
|
36
|
+
accountMemberships,
|
|
37
|
+
choice,
|
|
38
|
+
});
|
|
39
|
+
const answerItems = [
|
|
40
|
+
{ name: t("common.yes"), value: "Myself" },
|
|
41
|
+
{ name: t("common.no"), value: "SomeoneElse" },
|
|
42
|
+
];
|
|
43
|
+
const memberItems = getOtherAccountMemberships({
|
|
44
|
+
currentAccountMembership,
|
|
45
|
+
accountMemberships,
|
|
46
|
+
}).map(({ id, name }) => ({ name, value: id }));
|
|
47
|
+
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, value: selectedId.toUndefined(), onValueChange: value => setChoice(previous => ({ ...previous, selectedId: Option.Some(value) })) })) }));
|
|
48
|
+
return (_jsxs(_Fragment, { children: [_jsx(Tile, { title: t("fraudReport.victim.title"), description: t("fraudReport.victim.description"), children: currentAccountMembership.match({
|
|
49
|
+
None: () => memberPicker,
|
|
50
|
+
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", {
|
|
51
|
+
name: current.name,
|
|
52
|
+
highlight: chunks => (_jsx(LakeText, { variant: "medium", color: colors.current[500], children: chunks })),
|
|
53
|
+
}) })] })) : null] }), choice.answer.toUndefined() === "SomeoneElse" ? (_jsxs(_Fragment, { children: [_jsx(Space, { width: 24, height: 24 }), _jsx(View, { style: !small && styles.column, children: memberPicker })] })) : null] })),
|
|
54
|
+
}) }), _jsx(FraudReportFooter, { nextDisabled: victim.isNone(), onNext: () => victim.tapSome(victimAccountMembershipId => onNext({ victimAccountMembershipId })) })] }));
|
|
55
|
+
};
|
|
@@ -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 =>
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
month: date.month.trim(),
|
|
78
|
-
year: date.year.trim(),
|
|
74
|
+
sanitize: date => {
|
|
75
|
+
if (isNullish(date)) {
|
|
76
|
+
return undefined;
|
|
79
77
|
}
|
|
80
|
-
|
|
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);
|
|
@@ -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
|
|
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")[];
|
|
@@ -2048,8 +2048,42 @@ export const frenchTerritories = [
|
|
|
2048
2048
|
"WLF",
|
|
2049
2049
|
];
|
|
2050
2050
|
export const isFrenchTerritoryCCA3 = (value) => frenchTerritories.includes(value);
|
|
2051
|
-
|
|
2052
|
-
export const
|
|
2051
|
+
// Swan's markets: listed first in the phone country picker
|
|
2052
|
+
export const phoneMarketCountries = [
|
|
2053
|
+
"FRA",
|
|
2054
|
+
"DEU",
|
|
2055
|
+
"ESP",
|
|
2056
|
+
"ITA",
|
|
2057
|
+
"NLD",
|
|
2058
|
+
"BEL",
|
|
2059
|
+
"PRT",
|
|
2060
|
+
];
|
|
2061
|
+
const blockedPhoneCountries = [
|
|
2062
|
+
"BDI",
|
|
2063
|
+
"BLR",
|
|
2064
|
+
"CUB",
|
|
2065
|
+
"GNB",
|
|
2066
|
+
"IRN",
|
|
2067
|
+
"IRQ",
|
|
2068
|
+
"LBN",
|
|
2069
|
+
"LBY",
|
|
2070
|
+
"MLI",
|
|
2071
|
+
"MMR",
|
|
2072
|
+
"NGA",
|
|
2073
|
+
"PRK",
|
|
2074
|
+
"RUS",
|
|
2075
|
+
"SDN",
|
|
2076
|
+
"SOM",
|
|
2077
|
+
"SSD",
|
|
2078
|
+
"SYR",
|
|
2079
|
+
"TUR",
|
|
2080
|
+
"VEN",
|
|
2081
|
+
"YEM",
|
|
2082
|
+
];
|
|
2083
|
+
export const phoneCountries = [
|
|
2084
|
+
...phoneMarketCountries,
|
|
2085
|
+
...allCountries.filter(cca3 => !phoneMarketCountries.includes(cca3) && !blockedPhoneCountries.includes(cca3)),
|
|
2086
|
+
];
|
|
2053
2087
|
export const individualCountries = [
|
|
2054
2088
|
"AUT",
|
|
2055
2089
|
"BEL",
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|