@swan-io/shared-business 10.0.0 → 11.0.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 +6 -6
- package/src/assets/3d-card/environment/nx.png +0 -0
- package/src/assets/3d-card/environment/ny.png +0 -0
- package/src/assets/3d-card/environment/nz.png +0 -0
- package/src/assets/3d-card/environment/px.png +0 -0
- package/src/assets/3d-card/environment/py.png +0 -0
- package/src/assets/3d-card/environment/pz.png +0 -0
- package/src/assets/3d-card/model/MaisonNeue-Book.woff +0 -0
- package/src/assets/3d-card/model/MarkPro-Regular.ttf +0 -0
- package/src/assets/3d-card/model/band_roughness.jpg +0 -0
- package/src/assets/3d-card/model/card.gltf +850 -0
- package/src/assets/3d-card/model/chip.jpg +0 -0
- package/src/assets/3d-card/model/color_black.jpg +0 -0
- package/src/assets/3d-card/model/color_silver.jpg +0 -0
- package/src/assets/images/flags.svg +1 -0
- package/src/components/ConfirmModal.js +1 -1
- package/src/components/CountryPicker.js +1 -1
- package/src/components/Filters.d.ts +59 -0
- package/src/components/Filters.js +208 -0
- package/src/components/Flag.d.ts +8 -0
- package/src/components/Flag.js +32 -0
- package/src/components/PlacekitAddressSearchInput.d.ts +1 -1
- package/src/components/PlacekitAddressSearchInput.js +1 -1
- package/src/components/ToastStack.d.ts +1 -0
- package/src/components/ToastStack.js +142 -0
- package/src/constants/countries.d.ts +7 -7
- package/src/constants/countries.js +0 -2
- package/src/state/toasts.d.ts +31 -0
- package/src/state/toasts.js +88 -0
|
@@ -3,9 +3,9 @@ import { Box } from "@swan-io/lake/src/components/Box";
|
|
|
3
3
|
import { LakeButton } from "@swan-io/lake/src/components/LakeButton";
|
|
4
4
|
import { LakeText } from "@swan-io/lake/src/components/LakeText";
|
|
5
5
|
import { Space } from "@swan-io/lake/src/components/Space";
|
|
6
|
-
import { LakeModal } from "@swan-io/shared-business/src/components/LakeModal";
|
|
7
6
|
import { StyleSheet } from "react-native";
|
|
8
7
|
import { t } from "../utils/i18n";
|
|
8
|
+
import { LakeModal } from "./LakeModal";
|
|
9
9
|
const styles = StyleSheet.create({
|
|
10
10
|
confirmButton: {
|
|
11
11
|
flex: 1,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
import { Flag } from "@swan-io/lake/src/components/Flag";
|
|
3
2
|
import { LakeSelect } from "@swan-io/lake/src/components/LakeSelect";
|
|
4
3
|
import { forwardRef, useMemo } from "react";
|
|
4
|
+
import { Flag } from "../components/Flag";
|
|
5
5
|
import { getCountryByCCA3 } from "../constants/countries";
|
|
6
6
|
const CountryPickerWithRef = ({ onValueChange, value, countries, readOnly, id, error, placeholder, disabled, hideErrors, }, forwardedRef) => {
|
|
7
7
|
const items = useMemo(() => {
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import { ValidatorResult } from "@swan-io/use-form";
|
|
2
|
+
import { Simplify } from "type-fest";
|
|
3
|
+
import { DateFormat } from "../utils/i18n";
|
|
4
|
+
import { DatePickerDate } from "./DatePicker";
|
|
5
|
+
type Item<T> = {
|
|
6
|
+
label: string;
|
|
7
|
+
value: T;
|
|
8
|
+
};
|
|
9
|
+
export type FilterCheckboxDef<T> = {
|
|
10
|
+
type: "checkbox";
|
|
11
|
+
label: string;
|
|
12
|
+
items: Item<T>[];
|
|
13
|
+
width?: number;
|
|
14
|
+
checkAllLabel?: string;
|
|
15
|
+
};
|
|
16
|
+
export type FilterRadioDef<T> = {
|
|
17
|
+
type: "radio";
|
|
18
|
+
label: string;
|
|
19
|
+
items: Item<T>[];
|
|
20
|
+
width?: number;
|
|
21
|
+
};
|
|
22
|
+
export type FilterDateDef<Values = unknown> = {
|
|
23
|
+
type: "date";
|
|
24
|
+
label: string;
|
|
25
|
+
cancelText: string;
|
|
26
|
+
submitText: string;
|
|
27
|
+
noValueText: string;
|
|
28
|
+
dateFormat: DateFormat;
|
|
29
|
+
isSelectable?: (date: DatePickerDate, filters: Values) => boolean;
|
|
30
|
+
validate?: (value: string, filters: Values) => ValidatorResult;
|
|
31
|
+
};
|
|
32
|
+
export type FilterInputDef = {
|
|
33
|
+
type: "input";
|
|
34
|
+
label: string;
|
|
35
|
+
noValueText: string;
|
|
36
|
+
placeholder?: string;
|
|
37
|
+
validate?: (value: string) => ValidatorResult;
|
|
38
|
+
};
|
|
39
|
+
type Filter<T> = FilterCheckboxDef<T> | FilterRadioDef<T> | FilterDateDef | FilterInputDef;
|
|
40
|
+
type ExtractFilterValue<T extends Filter<unknown>> = T extends {
|
|
41
|
+
type: "checkbox";
|
|
42
|
+
} ? T["items"][number]["value"][] | undefined : T extends {
|
|
43
|
+
type: "radio";
|
|
44
|
+
} ? T["items"][number]["value"] | undefined : T extends {
|
|
45
|
+
type: "boolean";
|
|
46
|
+
} ? boolean | undefined : string | undefined;
|
|
47
|
+
type FiltersDefinition = Record<string, Filter<unknown>>;
|
|
48
|
+
export type FiltersState<T extends FiltersDefinition> = Simplify<{
|
|
49
|
+
[K in keyof T]: Simplify<ExtractFilterValue<T[K]>>;
|
|
50
|
+
}>;
|
|
51
|
+
type FiltersStackProps<Definition extends FiltersDefinition, State extends FiltersState<Definition> = FiltersState<Definition>> = {
|
|
52
|
+
definition: Definition;
|
|
53
|
+
filters: State;
|
|
54
|
+
openedFilters: (keyof Definition)[];
|
|
55
|
+
onChangeOpened: (value: (keyof Definition)[]) => void;
|
|
56
|
+
onChangeFilters: (value: State) => void;
|
|
57
|
+
};
|
|
58
|
+
export declare const FiltersStack: <T extends FiltersDefinition>({ filters, openedFilters, definition, onChangeOpened, onChangeFilters, }: FiltersStackProps<T>) => import("react/jsx-runtime").JSX.Element | null;
|
|
59
|
+
export {};
|
|
@@ -0,0 +1,208 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
|
+
import { Box } from "@swan-io/lake/src/components/Box";
|
|
3
|
+
import { FlatList } from "@swan-io/lake/src/components/FlatList";
|
|
4
|
+
import { Icon } from "@swan-io/lake/src/components/Icon";
|
|
5
|
+
import { LakeCheckbox } from "@swan-io/lake/src/components/LakeCheckbox";
|
|
6
|
+
import { LakeLabel } from "@swan-io/lake/src/components/LakeLabel";
|
|
7
|
+
import { LakeRadio } from "@swan-io/lake/src/components/LakeRadio";
|
|
8
|
+
import { LakeTextInput } from "@swan-io/lake/src/components/LakeTextInput";
|
|
9
|
+
import { Popover } from "@swan-io/lake/src/components/Popover";
|
|
10
|
+
import { Space } from "@swan-io/lake/src/components/Space";
|
|
11
|
+
import { Stack } from "@swan-io/lake/src/components/Stack";
|
|
12
|
+
import { Tag } from "@swan-io/lake/src/components/Tag";
|
|
13
|
+
import { colors, shadows } from "@swan-io/lake/src/constants/design";
|
|
14
|
+
import { useDisclosure } from "@swan-io/lake/src/hooks/useDisclosure";
|
|
15
|
+
import { useMergeRefs } from "@swan-io/lake/src/hooks/useMergeRefs";
|
|
16
|
+
import { usePreviousValue } from "@swan-io/lake/src/hooks/usePreviousValue";
|
|
17
|
+
import { isNotNullish, isNullish } from "@swan-io/lake/src/utils/nullish";
|
|
18
|
+
import dayjs from "dayjs";
|
|
19
|
+
import { forwardRef, useCallback, useMemo, useRef, useState } from "react";
|
|
20
|
+
import { Pressable, StyleSheet, Text, View } from "react-native";
|
|
21
|
+
import { P, match } from "ts-pattern";
|
|
22
|
+
import { DatePickerModal } from "./DatePicker";
|
|
23
|
+
const styles = StyleSheet.create({
|
|
24
|
+
container: {
|
|
25
|
+
paddingRight: 12,
|
|
26
|
+
paddingBottom: 8,
|
|
27
|
+
},
|
|
28
|
+
shadowed: {
|
|
29
|
+
position: "absolute",
|
|
30
|
+
opacity: 0,
|
|
31
|
+
width: "100%",
|
|
32
|
+
height: "100%",
|
|
33
|
+
borderRadius: 4,
|
|
34
|
+
boxShadow: shadows.tile,
|
|
35
|
+
transitionDuration: "150ms",
|
|
36
|
+
transitionProperty: "opacity",
|
|
37
|
+
},
|
|
38
|
+
hovered: {
|
|
39
|
+
opacity: 1,
|
|
40
|
+
},
|
|
41
|
+
dropdown: {
|
|
42
|
+
maxHeight: 400,
|
|
43
|
+
minWidth: 200,
|
|
44
|
+
},
|
|
45
|
+
itemHovered: {
|
|
46
|
+
backgroundColor: colors.gray[50],
|
|
47
|
+
},
|
|
48
|
+
content: {
|
|
49
|
+
paddingVertical: 12,
|
|
50
|
+
},
|
|
51
|
+
inputContent: {
|
|
52
|
+
paddingHorizontal: 24,
|
|
53
|
+
paddingTop: 24,
|
|
54
|
+
paddingBottom: 16,
|
|
55
|
+
},
|
|
56
|
+
radio: {
|
|
57
|
+
display: "flex",
|
|
58
|
+
flexDirection: "row",
|
|
59
|
+
alignItems: "center",
|
|
60
|
+
height: 32,
|
|
61
|
+
paddingHorizontal: 24,
|
|
62
|
+
},
|
|
63
|
+
itemLabel: {
|
|
64
|
+
textOverflow: "ellipsis",
|
|
65
|
+
overflow: "hidden",
|
|
66
|
+
whiteSpace: "nowrap",
|
|
67
|
+
},
|
|
68
|
+
input: {
|
|
69
|
+
width: 250,
|
|
70
|
+
},
|
|
71
|
+
value: {
|
|
72
|
+
maxWidth: 130,
|
|
73
|
+
whiteSpace: "nowrap",
|
|
74
|
+
},
|
|
75
|
+
});
|
|
76
|
+
const FilterTag = forwardRef(({ onPress, onPressRemove, label, value = "", isActive }, forwardRef) => {
|
|
77
|
+
const ref = useRef(null);
|
|
78
|
+
const mergedRef = useMergeRefs(ref, forwardRef);
|
|
79
|
+
return (_jsx(Pressable, { ref: mergedRef, onPress: onPress, children: ({ hovered }) => (_jsxs(_Fragment, { children: [_jsx(View, { style: [styles.shadowed, hovered && styles.hovered] }), _jsx(Tag, { label: label, color: "current", onPressRemove: onPressRemove, children: _jsxs(Box, { direction: "row", alignItems: "center", children: [_jsx(Text, { numberOfLines: 1, style: styles.value, children: value }), _jsx(Space, { width: 4 }), _jsx(Icon, { color: colors.current.primary, name: isActive ? "chevron-up-filled" : "chevron-down-filled", size: 16 })] }) })] })) }));
|
|
80
|
+
});
|
|
81
|
+
function FilterRadio({ label, items, width, value, onValueChange, onPressRemove, autoOpen = false, }) {
|
|
82
|
+
const inputRef = useRef(null);
|
|
83
|
+
const [visible, { close, toggle }] = useDisclosure(autoOpen);
|
|
84
|
+
const currentValue = useMemo(() => items.find(i => i.value === value), [items, value]);
|
|
85
|
+
return (_jsxs(View, { style: styles.container, children: [_jsx(FilterTag, { label: label, onPress: toggle, ref: inputRef, onPressRemove: onPressRemove, isActive: visible, value: currentValue === null || currentValue === void 0 ? void 0 : currentValue.label }), _jsx(Popover, { role: "listbox", matchReferenceWidth: false, onDismiss: close, referenceRef: inputRef, returnFocus: false, visible: visible, children: _jsx(FlatList, { role: "list", data: items, style: [styles.dropdown, { width }], contentContainerStyle: styles.content, keyExtractor: (_, index) => `filter-item-${index}`, renderItem: ({ item }) => {
|
|
86
|
+
const isSelected = value === item.value;
|
|
87
|
+
return (_jsxs(Pressable, { role: "radio", "aria-checked": isSelected, style: ({ hovered }) => [styles.radio, hovered && styles.itemHovered], onPress: () => {
|
|
88
|
+
onValueChange(item.value);
|
|
89
|
+
close();
|
|
90
|
+
}, children: [_jsx(LakeRadio, { value: isSelected }), _jsx(Space, { width: 12 }), _jsx(Text, { style: styles.itemLabel, children: item.label })] }));
|
|
91
|
+
} }) })] }));
|
|
92
|
+
}
|
|
93
|
+
function FilterCheckbox({ label, items, width, checkAllLabel, value, onValueChange, onPressRemove, autoOpen = false, }) {
|
|
94
|
+
const inputRef = useRef(null);
|
|
95
|
+
const [visible, { close, toggle }] = useDisclosure(autoOpen);
|
|
96
|
+
const valueSet = useMemo(() => new Set(value), [value]);
|
|
97
|
+
const currentValue = useMemo(() => items.filter(item => valueSet.has(item.value)), [items, valueSet]);
|
|
98
|
+
const allChecked = checkAllLabel != null && valueSet.size === items.length;
|
|
99
|
+
const listItems = useMemo(() => {
|
|
100
|
+
if (checkAllLabel == null) {
|
|
101
|
+
return items;
|
|
102
|
+
}
|
|
103
|
+
const checked = valueSet.size === 0 ? false : valueSet.size === items.length ? true : "mixed";
|
|
104
|
+
const checkAllItem = {
|
|
105
|
+
label: checkAllLabel,
|
|
106
|
+
checked,
|
|
107
|
+
};
|
|
108
|
+
return [checkAllItem, ...items];
|
|
109
|
+
}, [items, checkAllLabel, valueSet]);
|
|
110
|
+
return (_jsxs(View, { style: styles.container, children: [_jsx(FilterTag, { label: label, onPress: toggle, ref: inputRef, onPressRemove: onPressRemove, isActive: visible, value: allChecked ? checkAllLabel : currentValue.map(item => item.label).join(", ") }), _jsx(Popover, { role: "listbox", matchReferenceWidth: false, onDismiss: close, referenceRef: inputRef, returnFocus: false, visible: visible, children: _jsx(FlatList, { role: "list", data: listItems, style: [styles.dropdown, { width }], contentContainerStyle: styles.content, keyExtractor: (_, index) => `filter-item-${index}`, renderItem: ({ item }) => {
|
|
111
|
+
const isSelected = match(item)
|
|
112
|
+
.with({ checked: P.any }, ({ checked }) => checked)
|
|
113
|
+
.with({ value: P.any }, ({ value }) => valueSet.has(value))
|
|
114
|
+
.exhaustive();
|
|
115
|
+
const onPress = match(item)
|
|
116
|
+
// Check all item
|
|
117
|
+
.with({ checked: P.any }, ({ checked }) => () => {
|
|
118
|
+
if (checked === true) {
|
|
119
|
+
onValueChange(undefined);
|
|
120
|
+
}
|
|
121
|
+
else {
|
|
122
|
+
onValueChange(items.map(item => item.value));
|
|
123
|
+
}
|
|
124
|
+
})
|
|
125
|
+
// Regular item
|
|
126
|
+
.with({ value: P.any }, ({ value }) => () => {
|
|
127
|
+
const nextValues = new Set([...valueSet]);
|
|
128
|
+
if (isSelected === true) {
|
|
129
|
+
nextValues.delete(value);
|
|
130
|
+
}
|
|
131
|
+
else {
|
|
132
|
+
nextValues.add(value);
|
|
133
|
+
}
|
|
134
|
+
if (nextValues.size === 0) {
|
|
135
|
+
onValueChange(undefined);
|
|
136
|
+
}
|
|
137
|
+
else {
|
|
138
|
+
onValueChange([...nextValues]);
|
|
139
|
+
}
|
|
140
|
+
})
|
|
141
|
+
.exhaustive();
|
|
142
|
+
return (_jsxs(Pressable, { role: "radio", "aria-checked": isSelected, style: ({ hovered }) => [styles.radio, hovered && styles.itemHovered], onPress: onPress, children: [_jsx(LakeCheckbox, { value: isSelected }), _jsx(Space, { width: 12 }), _jsx(Text, { style: styles.itemLabel, children: item.label })] }));
|
|
143
|
+
} }) })] }));
|
|
144
|
+
}
|
|
145
|
+
function FilterDate({ label, initialValue, noValueText, cancelText, submitText, dateFormat, isSelectable, validate, onValueChange, onPressRemove, autoOpen = false, }) {
|
|
146
|
+
const inputRef = useRef(null);
|
|
147
|
+
const [visible, { close, toggle }] = useDisclosure(autoOpen);
|
|
148
|
+
const value = useMemo(() => (isNotNullish(initialValue) ? dayjs(initialValue).format(dateFormat) : ""), [initialValue, dateFormat]);
|
|
149
|
+
return (_jsxs(View, { style: styles.container, children: [_jsx(FilterTag, { label: label, onPress: toggle, ref: inputRef, onPressRemove: onPressRemove, isActive: visible, value: isNotNullish(initialValue) ? dayjs(initialValue).format(dateFormat) : noValueText }), _jsx(DatePickerModal, { visible: visible, format: dateFormat, firstWeekDay: "monday", label: label, cancelLabel: cancelText, confirmLabel: submitText, value: value, isSelectable: isSelectable, validate: validate, onChange: value => {
|
|
150
|
+
const formattedValue = dayjs(value, dateFormat, true).toJSON();
|
|
151
|
+
onValueChange(formattedValue);
|
|
152
|
+
}, onDismiss: close })] }));
|
|
153
|
+
}
|
|
154
|
+
function FilterInput({ label, initialValue = "", noValueText, autoOpen = false, placeholder, validate, onValueChange, onPressRemove, }) {
|
|
155
|
+
const [visible, { close, toggle }] = useDisclosure(autoOpen);
|
|
156
|
+
const tagRef = useRef(null);
|
|
157
|
+
const getValueState = useCallback((inputValue, isInitialValue) => {
|
|
158
|
+
var _a;
|
|
159
|
+
const trimmed = inputValue.trim();
|
|
160
|
+
const error = (_a = validate === null || validate === void 0 ? void 0 : validate(trimmed)) !== null && _a !== void 0 ? _a : undefined;
|
|
161
|
+
const validValue = isNullish(error) ? trimmed : undefined;
|
|
162
|
+
if (!isInitialValue) {
|
|
163
|
+
onValueChange(validValue);
|
|
164
|
+
}
|
|
165
|
+
return {
|
|
166
|
+
inputValue,
|
|
167
|
+
validValue,
|
|
168
|
+
error: isInitialValue ? undefined : error,
|
|
169
|
+
};
|
|
170
|
+
}, [validate, onValueChange]);
|
|
171
|
+
const [{ inputValue, validValue, error }, setState] = useState(() => getValueState(initialValue, true));
|
|
172
|
+
const onChangeText = useCallback((value) => setState(getValueState(value, false)), [getValueState]);
|
|
173
|
+
return (_jsxs(View, { style: styles.container, children: [_jsx(FilterTag, { label: label, onPress: toggle, ref: tagRef, onPressRemove: onPressRemove, isActive: visible, value: validValue !== null && validValue !== void 0 ? validValue : noValueText }), _jsx(Popover, { role: "listbox", matchReferenceWidth: false, onDismiss: close, referenceRef: tagRef, returnFocus: false, visible: visible, children: _jsx(View, { style: [styles.dropdown, styles.inputContent], children: _jsx(LakeLabel, { label: label, render: id => (_jsx(LakeTextInput, { id: id, value: inputValue, error: error, style: styles.input, placeholder: placeholder, onChangeText: onChangeText })) }) }) })] }));
|
|
174
|
+
}
|
|
175
|
+
const getFilterValue = (_type, filters, name) => filters[name];
|
|
176
|
+
export const FiltersStack = ({ filters, openedFilters, definition, onChangeOpened, onChangeFilters, }) => {
|
|
177
|
+
const previousOpened = usePreviousValue(openedFilters);
|
|
178
|
+
const lastOpenedFilter = openedFilters.length > previousOpened.length
|
|
179
|
+
? openedFilters[openedFilters.length - 1]
|
|
180
|
+
: undefined;
|
|
181
|
+
if (openedFilters.length === 0) {
|
|
182
|
+
return null;
|
|
183
|
+
}
|
|
184
|
+
return (_jsx(Stack, { direction: "row", wrap: "wrap", children: openedFilters.map(filterName => {
|
|
185
|
+
const filterDefinition = definition[filterName];
|
|
186
|
+
if (typeof filterName !== "string" || filterDefinition == null) {
|
|
187
|
+
return null;
|
|
188
|
+
}
|
|
189
|
+
return (_jsx(View, { children: match(filterDefinition)
|
|
190
|
+
.with({ type: "radio" }, ({ type, label, items, width }) => (_jsx(FilterRadio, { label: label, items: items, width: width, autoOpen: lastOpenedFilter === filterName, onPressRemove: () => {
|
|
191
|
+
onChangeFilters({ ...filters, [filterName]: undefined });
|
|
192
|
+
onChangeOpened(openedFilters.filter(f => f !== filterName));
|
|
193
|
+
}, value: getFilterValue(type, filters, filterName), onValueChange: value => onChangeFilters({ ...filters, [filterName]: value }) })))
|
|
194
|
+
.with({ type: "checkbox" }, ({ type, label, items, width, checkAllLabel }) => (_jsx(FilterCheckbox, { label: label, items: items, width: width, checkAllLabel: checkAllLabel, autoOpen: lastOpenedFilter === filterName, value: getFilterValue(type, filters, filterName), onValueChange: value => onChangeFilters({ ...filters, [filterName]: value }), onPressRemove: () => {
|
|
195
|
+
onChangeFilters({ ...filters, [filterName]: undefined });
|
|
196
|
+
onChangeOpened(openedFilters.filter(f => f !== filterName));
|
|
197
|
+
} })))
|
|
198
|
+
.with({ type: "date" }, ({ type, label, noValueText, cancelText, submitText, dateFormat, isSelectable, validate, }) => (_jsx(FilterDate, { label: label, noValueText: noValueText, cancelText: cancelText, submitText: submitText, dateFormat: dateFormat, autoOpen: lastOpenedFilter === filterName, isSelectable: isSelectable ? date => isSelectable(date, filters) : undefined, validate: validate ? value => validate(value, filters) : undefined, initialValue: getFilterValue(type, filters, filterName), onValueChange: value => onChangeFilters({ ...filters, [filterName]: value }), onPressRemove: () => {
|
|
199
|
+
onChangeFilters({ ...filters, [filterName]: undefined });
|
|
200
|
+
onChangeOpened(openedFilters.filter(f => f !== filterName));
|
|
201
|
+
} })))
|
|
202
|
+
.with({ type: "input" }, ({ type, label, placeholder, noValueText, validate }) => (_jsx(FilterInput, { label: label, placeholder: placeholder, noValueText: noValueText, autoOpen: lastOpenedFilter === filterName, validate: validate, initialValue: getFilterValue(type, filters, filterName), onValueChange: value => onChangeFilters({ ...filters, [filterName]: value }), onPressRemove: () => {
|
|
203
|
+
onChangeFilters({ ...filters, [filterName]: undefined });
|
|
204
|
+
onChangeOpened(openedFilters.filter(f => f !== filterName));
|
|
205
|
+
} })))
|
|
206
|
+
.exhaustive() }, filterName));
|
|
207
|
+
}) }));
|
|
208
|
+
};
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { Lazy } from "@swan-io/boxed";
|
|
3
|
+
import { Svg, Use } from "@swan-io/lake/src/components/Svg";
|
|
4
|
+
import { getFlagGlyphName } from "@swan-io/lake/src/utils/string";
|
|
5
|
+
import { useEffect, useMemo, useState } from "react";
|
|
6
|
+
import { match } from "ts-pattern";
|
|
7
|
+
const UNICODE_OFFSET = 127462 - 65;
|
|
8
|
+
let svgUrl;
|
|
9
|
+
const svgUrlGetter = Lazy(async () => {
|
|
10
|
+
const { default: value } = await import("../assets/images/flags.svg");
|
|
11
|
+
svgUrl = value;
|
|
12
|
+
return value;
|
|
13
|
+
});
|
|
14
|
+
export const Flag = (props) => {
|
|
15
|
+
var _a;
|
|
16
|
+
const { code } = props;
|
|
17
|
+
const width = (_a = props.width) !== null && _a !== void 0 ? _a : 18;
|
|
18
|
+
const [url, setUrl] = useState(svgUrl);
|
|
19
|
+
useEffect(() => {
|
|
20
|
+
if (svgUrl == null) {
|
|
21
|
+
void svgUrlGetter.get().then(setUrl);
|
|
22
|
+
}
|
|
23
|
+
}, []);
|
|
24
|
+
const flag = useMemo(() => {
|
|
25
|
+
return match(code)
|
|
26
|
+
.with("EU", () => getFlagGlyphName("🇪🇺"))
|
|
27
|
+
.otherwise(() => {
|
|
28
|
+
return `${(UNICODE_OFFSET + code.charCodeAt(0)).toString(16)}-${(UNICODE_OFFSET + code.charCodeAt(1)).toString(16)}`;
|
|
29
|
+
});
|
|
30
|
+
}, [code]);
|
|
31
|
+
return (_jsx(Svg, { viewBox: "0 0 18 18", style: { height: width, width }, children: url != null && flag != null ? _jsx(Use, { xlinkHref: `${url}#${flag}` }) : null }));
|
|
32
|
+
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { PKOptions } from "@placekit/client-js";
|
|
2
|
-
import { CountryCCA3 } from "@swan-io/shared-business/src/constants/countries";
|
|
3
2
|
import { MutableRefObject } from "react";
|
|
4
3
|
import { StyleProp, ViewStyle } from "react-native";
|
|
4
|
+
import { CountryCCA3 } from "../constants/countries";
|
|
5
5
|
export type AddressDetail = {
|
|
6
6
|
completeAddress: string;
|
|
7
7
|
city: string;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
2
|
import { Array, Future, Option, Result } from "@swan-io/boxed";
|
|
3
3
|
import { AutocompleteSearchInput } from "@swan-io/lake/src/components/AutocompleteSearchInput";
|
|
4
|
-
import { countriesWithMultipleCCA3, getCCA2forCCA3, } from "@swan-io/shared-business/src/constants/countries";
|
|
5
4
|
import { useCallback } from "react";
|
|
5
|
+
import { countriesWithMultipleCCA3, getCCA2forCCA3 } from "../constants/countries";
|
|
6
6
|
import { usePlacekit } from "../hooks/usePlacekit";
|
|
7
7
|
export const PlacekitAddressSearchInput = ({ inputRef, id, country, disabled, error, value, types = ["street"], onValueChange, onSuggestion, language, placeholder, shouldDisplaySuggestions = true, emptyResultText, apiKey, }) => {
|
|
8
8
|
const placekit = usePlacekit({ apiKey });
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const ToastStack: () => import("react/jsx-runtime").JSX.Element | null;
|
|
@@ -0,0 +1,142 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
|
+
import { Array, Option } from "@swan-io/boxed";
|
|
3
|
+
import { Box } from "@swan-io/lake/src/components/Box";
|
|
4
|
+
import { Icon } from "@swan-io/lake/src/components/Icon";
|
|
5
|
+
import { LakeText } from "@swan-io/lake/src/components/LakeText";
|
|
6
|
+
import { LakeTooltip } from "@swan-io/lake/src/components/LakeTooltip";
|
|
7
|
+
import { Portal } from "@swan-io/lake/src/components/Portal";
|
|
8
|
+
import { Pressable } from "@swan-io/lake/src/components/Pressable";
|
|
9
|
+
import { Space } from "@swan-io/lake/src/components/Space";
|
|
10
|
+
import { TransitionGroupView } from "@swan-io/lake/src/components/TransitionGroupView";
|
|
11
|
+
import { animations, colors, shadows } from "@swan-io/lake/src/constants/design";
|
|
12
|
+
import { setClipboardText } from "@swan-io/lake/src/utils/clipboard";
|
|
13
|
+
import { isNotNullishOrEmpty, isNullish } from "@swan-io/lake/src/utils/nullish";
|
|
14
|
+
import { memo, useEffect, useRef, useState } from "react";
|
|
15
|
+
import { StyleSheet, View } from "react-native";
|
|
16
|
+
import { P, match } from "ts-pattern";
|
|
17
|
+
import { getErrorToRequestId, hideToast, useToasts, } from "../state/toasts";
|
|
18
|
+
import { t } from "../utils/i18n";
|
|
19
|
+
const styles = StyleSheet.create({
|
|
20
|
+
list: {
|
|
21
|
+
position: "fixed",
|
|
22
|
+
right: 0,
|
|
23
|
+
bottom: 0,
|
|
24
|
+
maxHeight: "100%",
|
|
25
|
+
maxWidth: 400,
|
|
26
|
+
paddingVertical: 8,
|
|
27
|
+
width: "100%",
|
|
28
|
+
zIndex: 10,
|
|
29
|
+
pointerEvents: "none",
|
|
30
|
+
},
|
|
31
|
+
toastWrapper: {
|
|
32
|
+
paddingHorizontal: 16,
|
|
33
|
+
paddingVertical: 8,
|
|
34
|
+
pointerEvents: "auto",
|
|
35
|
+
},
|
|
36
|
+
toast: {
|
|
37
|
+
padding: 24,
|
|
38
|
+
borderRadius: 4,
|
|
39
|
+
borderWidth: 1,
|
|
40
|
+
borderLeftWidth: 4,
|
|
41
|
+
overflow: "hidden",
|
|
42
|
+
boxShadow: shadows.modal,
|
|
43
|
+
},
|
|
44
|
+
contentContainer: {
|
|
45
|
+
paddingRight: 36, // 24 for close button + 12 for spacing
|
|
46
|
+
},
|
|
47
|
+
closeButton: {
|
|
48
|
+
zIndex: 1,
|
|
49
|
+
position: "absolute",
|
|
50
|
+
width: 24,
|
|
51
|
+
height: 24,
|
|
52
|
+
right: 24,
|
|
53
|
+
top: 0,
|
|
54
|
+
bottom: 0,
|
|
55
|
+
margin: "auto",
|
|
56
|
+
},
|
|
57
|
+
progressBar: {
|
|
58
|
+
height: 2,
|
|
59
|
+
transformOrigin: "left",
|
|
60
|
+
},
|
|
61
|
+
copyTooltip: {
|
|
62
|
+
alignSelf: "flex-start",
|
|
63
|
+
},
|
|
64
|
+
copyButton: {
|
|
65
|
+
alignItems: "center",
|
|
66
|
+
flexDirection: "row",
|
|
67
|
+
flexGrow: 1,
|
|
68
|
+
flexShrink: 1,
|
|
69
|
+
},
|
|
70
|
+
});
|
|
71
|
+
const errorsToArray = (errors) => {
|
|
72
|
+
const asArray = Array.isArray(errors) ? errors : [errors];
|
|
73
|
+
return Array.filterMap(asArray, error => error instanceof Error ? Option.Some(error) : Option.None());
|
|
74
|
+
};
|
|
75
|
+
const Toast = memo(({ variant, uid, title, description, error, progress, onClose }) => {
|
|
76
|
+
const progressBarRef = useRef(null);
|
|
77
|
+
const [visibleState, setVisibleState] = useState("copy");
|
|
78
|
+
const hasDescription = isNotNullishOrEmpty(description);
|
|
79
|
+
const [requestId] = useState(() => {
|
|
80
|
+
if (error == undefined) {
|
|
81
|
+
return Option.None();
|
|
82
|
+
}
|
|
83
|
+
return Array.findMap(errorsToArray(error), error => Option.fromNullable(getErrorToRequestId().get(error)));
|
|
84
|
+
});
|
|
85
|
+
const colorVariation = match(variant)
|
|
86
|
+
.returnType()
|
|
87
|
+
.with("success", () => "positive")
|
|
88
|
+
.with("error", () => "negative")
|
|
89
|
+
.with("info", () => "shakespear")
|
|
90
|
+
.with("warning", () => "warning")
|
|
91
|
+
.exhaustive();
|
|
92
|
+
useEffect(() => {
|
|
93
|
+
if (isNullish(progress)) {
|
|
94
|
+
return;
|
|
95
|
+
}
|
|
96
|
+
return progress.subscribe(value => {
|
|
97
|
+
if (progressBarRef.current instanceof HTMLElement) {
|
|
98
|
+
progressBarRef.current.style.transform = `scaleX(${value})`;
|
|
99
|
+
}
|
|
100
|
+
});
|
|
101
|
+
}, [progress]);
|
|
102
|
+
return (_jsx(View, { style: styles.toastWrapper, children: _jsxs(View, { style: [
|
|
103
|
+
styles.toast,
|
|
104
|
+
{
|
|
105
|
+
borderColor: colors[colorVariation][200],
|
|
106
|
+
borderLeftColor: colors[colorVariation][500],
|
|
107
|
+
backgroundColor: colors[colorVariation][0],
|
|
108
|
+
},
|
|
109
|
+
], children: [_jsxs(Box, { style: styles.contentContainer, children: [_jsxs(Box, { direction: "row", alignItems: "center", children: [match(variant)
|
|
110
|
+
.with("success", () => (_jsx(Icon, { name: "checkmark-circle-regular", size: 20, color: colors[colorVariation][700] })))
|
|
111
|
+
.with("error", () => (_jsx(Icon, { name: "dismiss-circle-regular", size: 20, color: colors[colorVariation][700] })))
|
|
112
|
+
.with("info", () => (_jsx(Icon, { name: "info-regular", size: 20, color: colors[colorVariation][700] })))
|
|
113
|
+
.with("warning", () => (_jsx(Icon, { name: "warning-regular", size: 20, color: colors[colorVariation][700] })))
|
|
114
|
+
.exhaustive(), _jsx(Space, { width: 12 }), _jsx(LakeText, { variant: "regular", color: colors[colorVariation][700], children: title })] }), hasDescription && (_jsxs(_Fragment, { children: [_jsx(Space, { height: 8 }), _jsx(LakeText, { variant: "smallRegular", color: colors.gray[700], children: description })] })), match(requestId)
|
|
115
|
+
.with(Option.P.None, () => null)
|
|
116
|
+
.with(Option.P.Some(P.select()), requestId => (_jsxs(_Fragment, { children: [_jsx(Space, { height: hasDescription ? 4 : 8 }), _jsx(LakeTooltip, { describedBy: "copy", onHide: () => setVisibleState("copy"), togglableOnFocus: true, placement: "center", containerStyle: styles.copyTooltip, content: visibleState === "copy"
|
|
117
|
+
? t("copyButton.copyTooltip")
|
|
118
|
+
: t("copyButton.copiedTooltip"), children: _jsxs(Pressable, { style: styles.copyButton, onPress: event => {
|
|
119
|
+
event.stopPropagation();
|
|
120
|
+
event.preventDefault();
|
|
121
|
+
setClipboardText(requestId !== null && requestId !== void 0 ? requestId : "");
|
|
122
|
+
setVisibleState("copied");
|
|
123
|
+
}, children: [_jsx(Icon, { color: colors.gray[700], size: 14, name: "copy-regular" }), _jsx(Space, { width: 4 }), _jsxs(LakeText, { numberOfLines: 1, variant: "smallRegular", color: colors.gray[700], children: ["ID: ", requestId] })] }) })] })))
|
|
124
|
+
.exhaustive()] }), _jsx(Pressable, { onPress: () => onClose(uid), style: styles.closeButton, children: _jsx(Icon, { name: "lake-close", size: 24, color: colors.gray[500] }) }), progress != null && (_jsxs(_Fragment, { children: [_jsx(Space, { height: 24 }), _jsx(View, { ref: progressBarRef, role: "progressbar", style: [styles.progressBar, { backgroundColor: colors[colorVariation][500] }] })] }))] }) }));
|
|
125
|
+
});
|
|
126
|
+
export const ToastStack = () => {
|
|
127
|
+
const toasts = useToasts();
|
|
128
|
+
const [rootElement, setRootElement] = useState(() => undefined);
|
|
129
|
+
useEffect(() => {
|
|
130
|
+
const rootElement = document.createElement("div");
|
|
131
|
+
document.body.append(rootElement);
|
|
132
|
+
setRootElement(rootElement);
|
|
133
|
+
return () => {
|
|
134
|
+
rootElement.remove();
|
|
135
|
+
setRootElement(undefined);
|
|
136
|
+
};
|
|
137
|
+
}, []);
|
|
138
|
+
if (rootElement == null) {
|
|
139
|
+
return null;
|
|
140
|
+
}
|
|
141
|
+
return (_jsx(Portal, { container: rootElement, children: _jsx(TransitionGroupView, { style: styles.list, enter: animations.fadeAndSlideInFromRight.enter, leave: animations.fadeAndSlideInFromRight.leave, children: toasts.map(toast => (_jsx(Toast, { uid: toast.uid, variant: toast.variant, title: toast.title, description: toast.description, error: toast.error, progress: toast.progress, onClose: hideToast }, toast.uid))) }) }));
|
|
142
|
+
};
|
|
@@ -1492,19 +1492,19 @@ export declare const getCCA2forCCA3: (cca3: CountryCCA3) => CountryCCA2;
|
|
|
1492
1492
|
export declare const getCCA3forCCA2: (cca2: CountryCCA2) => CountryCCA3;
|
|
1493
1493
|
export declare const companyWithUboCountries: readonly ["BEL", "DEU", "FRA", "ITA", "LTU", "LUX", "NLD"];
|
|
1494
1494
|
export type CompanyWithUboCountryCCA3 = (typeof companyWithUboCountries)[number];
|
|
1495
|
-
export declare const allCountries: ("ALA" | "ASM" | "AND" | "AGO" | "AIA" | "ATA" | "ATG" | "ARG" | "ABW" | "AUS" | "AZE" | "BHS" | "BGD" | "BRB" | "BEL" | "BLZ" | "BEN" | "BMU" | "BOL" | "BES" | "BIH" | "BWA" | "BVT" | "BRA" | "VGB" | "BFA" | "BDI" | "CPV" | "CMR" | "CAN" | "CYM" | "CZE" | "CHL" | "CXR" | "CCK" | "COL" | "COK" | "CRI" | "CIV" | "CUB" | "CUW" | "DNK" | "
|
|
1495
|
+
export declare const allCountries: ("DEU" | "ESP" | "FRA" | "NLD" | "ITA" | "ALA" | "ASM" | "AND" | "AGO" | "AIA" | "ATA" | "ATG" | "ARG" | "ABW" | "AUS" | "AZE" | "BHS" | "BGD" | "BRB" | "BEL" | "BLZ" | "BEN" | "BMU" | "BOL" | "BES" | "BIH" | "BWA" | "BVT" | "BRA" | "VGB" | "BFA" | "BDI" | "CPV" | "CMR" | "CAN" | "CYM" | "CZE" | "CHL" | "CXR" | "CCK" | "COL" | "COK" | "CRI" | "CIV" | "CUB" | "CUW" | "DNK" | "DJI" | "DMA" | "ECU" | "EST" | "IRL" | "SLV" | "FLK" | "FJI" | "FRO" | "GAB" | "GMB" | "GHA" | "GIB" | "GRD" | "GLP" | "GUM" | "GTM" | "GGY" | "GNB" | "GNQ" | "GIN" | "GUY" | "GUF" | "HTI" | "HMD" | "HND" | "HRV" | "IDN" | "ISL" | "IMN" | "JAM" | "JEY" | "GRL" | "KHM" | "KAZ" | "KEN" | "KIR" | "CAF" | "COM" | "REU" | "LVA" | "LSO" | "LBR" | "LIE" | "LTU" | "LUX" | "MDG" | "HUN" | "MHL" | "MWI" | "MYS" | "MDV" | "MLI" | "MLT" | "MTQ" | "MUS" | "MYT" | "MEX" | "FSM" | "MOZ" | "MDA" | "MCO" | "MSR" | "NAM" | "BRN" | "NZL" | "NIC" | "NER" | "NGA" | "NIU" | "NFK" | "NOR" | "MNP" | "NCL" | "AUT" | "UZB" | "PAK" | "PLW" | "PAN" | "PNG" | "PRY" | "PER" | "PHL" | "PCN" | "POL" | "PYF" | "PRT" | "PRI" | "DOM" | "XKX" | "COD" | "COG" | "ROU" | "RWA" | "KNA" | "LCA" | "VCT" | "BLM" | "MAF" | "SPM" | "WSM" | "SMR" | "STP" | "CHE" | "SEN" | "SYC" | "ALB" | "SLE" | "SGP" | "SVN" | "SVK" | "SLB" | "SOM" | "ZAF" | "SGS" | "SSD" | "LKA" | "FIN" | "SUR" | "SWE" | "SWZ" | "TZA" | "TCD" | "ATF" | "TLS" | "TGO" | "TON" | "TTO" | "TUR" | "TKM" | "TCA" | "TUV" | "UGA" | "GBR" | "USA" | "UMI" | "VIR" | "URY" | "VUT" | "VAT" | "VEN" | "VNM" | "WLF" | "ZMB" | "ZWE" | "BTN" | "GRC" | "CYP" | "BLR" | "BGR" | "KGZ" | "MKD" | "MNG" | "RUS" | "SRB" | "TJK" | "UKR" | "MNE" | "ARM" | "ISR" | "AFG" | "JOR" | "DZA" | "SDN" | "ESH" | "IRQ" | "SAU" | "KWT" | "MAR" | "YEM" | "IRN" | "TUN" | "ARE" | "SYR" | "OMN" | "PSE" | "QAT" | "LBN" | "EGY" | "MRT" | "NPL" | "IND" | "THA" | "LAO" | "MMR" | "GEO" | "ETH" | "ERI" | "BHR" | "LBY" | "CHN" | "JPN" | "MAC" | "TWN" | "HKG" | "KOR" | "PRK")[];
|
|
1496
1496
|
export declare const france: {
|
|
1497
|
-
readonly cca2: "AX" | "AS" | "AD" | "AO" | "AI" | "AQ" | "AG" | "AR" | "AW" | "AU" | "AZ" | "BS" | "BD" | "BB" | "BE" | "BZ" | "BJ" | "BM" | "BO" | "BQ" | "BA" | "BW" | "BV" | "BR" | "VG" | "BF" | "BI" | "CV" | "CM" | "CA" | "KY" | "CZ" | "CL" | "CX" | "CC" | "CO" | "CK" | "CR" | "CI" | "CU" | "CW" | "DK" | "DE" | "DJ" | "DM" | "EC" | "EE" | "IE" | "SV" | "ES" | "FK" | "FJ" | "FO" | "FR" | "GA" | "GM" | "GH" | "GI" | "GD" | "GP" | "GU" | "GT" | "GG" | "GW" | "GQ" | "GN" | "GY" | "GF" | "HT" | "HM" | "HN" | "HR" | "ID" | "IS" | "IM" | "IT" | "JM" | "JE" | "GL" | "KH" | "KZ" | "KE" | "KI" | "CF" | "KM" | "RE" | "LV" | "LS" | "LR" | "LI" | "LT" | "LU" | "MG" | "HU" | "MH" | "MW" | "MY" | "MV" | "ML" | "MT" | "MQ" | "MU" | "YT" | "MX" | "FM" | "MZ" | "MD" | "MC" | "MS" | "NA" | "NL" | "BN" | "NZ" | "NI" | "NE" | "NG" | "NU" | "NF" | "NO" | "MP" | "NC" | "AT" | "UZ" | "PK" | "PW" | "PA" | "PG" | "PY" | "PE" | "PH" | "PN" | "PL" | "PF" | "PT" | "PR" | "DO" | "XK" | "CD" | "CG" | "RO" | "RW" | "KN" | "LC" | "VC" | "BL" | "MF" | "PM" | "WS" | "SM" | "ST" | "CH" | "SN" | "SC" | "AL" | "SL" | "SG" | "SI" | "SK" | "SB" | "SO" | "ZA" | "GS" | "SS" | "LK" | "FI" | "SR" | "SE" | "SZ" | "TZ" | "TD" | "TF" | "TL" | "TG" | "TO" | "TT" | "TR" | "TM" | "TC" | "TV" | "UG" | "GB" | "US" | "UM" | "VI" | "UY" | "VU" | "VA" | "VE" | "VN" | "WF" | "ZM" | "ZW" | "BT" | "GR" | "CY" | "BY" | "BG" | "KG" | "MK" | "MN" | "RU" | "RS" | "TJ" | "UA" | "ME" | "AM" | "IL" | "AF" | "JO" | "DZ" | "SD" | "EH" | "IQ" | "SA" | "KW" | "MA" | "YE" | "IR" | "TN" | "AE" | "SY" | "OM" | "PS" | "QA" | "LB" | "EG" | "MR" | "NP" | "IN" | "TH" | "LA" | "
|
|
1498
|
-
readonly cca3: "ALA" | "ASM" | "AND" | "AGO" | "AIA" | "ATA" | "ATG" | "ARG" | "ABW" | "AUS" | "AZE" | "BHS" | "BGD" | "BRB" | "BEL" | "BLZ" | "BEN" | "BMU" | "BOL" | "BES" | "BIH" | "BWA" | "BVT" | "BRA" | "VGB" | "BFA" | "BDI" | "CPV" | "CMR" | "CAN" | "CYM" | "CZE" | "CHL" | "CXR" | "CCK" | "COL" | "COK" | "CRI" | "CIV" | "CUB" | "CUW" | "DNK" | "
|
|
1497
|
+
readonly cca2: "MM" | "AX" | "AS" | "AD" | "AO" | "AI" | "AQ" | "AG" | "AR" | "AW" | "AU" | "AZ" | "BS" | "BD" | "BB" | "BE" | "BZ" | "BJ" | "BM" | "BO" | "BQ" | "BA" | "BW" | "BV" | "BR" | "VG" | "BF" | "BI" | "CV" | "CM" | "CA" | "KY" | "CZ" | "CL" | "CX" | "CC" | "CO" | "CK" | "CR" | "CI" | "CU" | "CW" | "DK" | "DE" | "DJ" | "DM" | "EC" | "EE" | "IE" | "SV" | "ES" | "FK" | "FJ" | "FO" | "FR" | "GA" | "GM" | "GH" | "GI" | "GD" | "GP" | "GU" | "GT" | "GG" | "GW" | "GQ" | "GN" | "GY" | "GF" | "HT" | "HM" | "HN" | "HR" | "ID" | "IS" | "IM" | "IT" | "JM" | "JE" | "GL" | "KH" | "KZ" | "KE" | "KI" | "CF" | "KM" | "RE" | "LV" | "LS" | "LR" | "LI" | "LT" | "LU" | "MG" | "HU" | "MH" | "MW" | "MY" | "MV" | "ML" | "MT" | "MQ" | "MU" | "YT" | "MX" | "FM" | "MZ" | "MD" | "MC" | "MS" | "NA" | "NL" | "BN" | "NZ" | "NI" | "NE" | "NG" | "NU" | "NF" | "NO" | "MP" | "NC" | "AT" | "UZ" | "PK" | "PW" | "PA" | "PG" | "PY" | "PE" | "PH" | "PN" | "PL" | "PF" | "PT" | "PR" | "DO" | "XK" | "CD" | "CG" | "RO" | "RW" | "KN" | "LC" | "VC" | "BL" | "MF" | "PM" | "WS" | "SM" | "ST" | "CH" | "SN" | "SC" | "AL" | "SL" | "SG" | "SI" | "SK" | "SB" | "SO" | "ZA" | "GS" | "SS" | "LK" | "FI" | "SR" | "SE" | "SZ" | "TZ" | "TD" | "TF" | "TL" | "TG" | "TO" | "TT" | "TR" | "TM" | "TC" | "TV" | "UG" | "GB" | "US" | "UM" | "VI" | "UY" | "VU" | "VA" | "VE" | "VN" | "WF" | "ZM" | "ZW" | "BT" | "GR" | "CY" | "BY" | "BG" | "KG" | "MK" | "MN" | "RU" | "RS" | "TJ" | "UA" | "ME" | "AM" | "IL" | "AF" | "JO" | "DZ" | "SD" | "EH" | "IQ" | "SA" | "KW" | "MA" | "YE" | "IR" | "TN" | "AE" | "SY" | "OM" | "PS" | "QA" | "LB" | "EG" | "MR" | "NP" | "IN" | "TH" | "LA" | "GE" | "ET" | "ER" | "BH" | "LY" | "CN" | "JP" | "MO" | "TW" | "HK" | "KR" | "KP";
|
|
1498
|
+
readonly cca3: "DEU" | "ESP" | "FRA" | "NLD" | "ITA" | "ALA" | "ASM" | "AND" | "AGO" | "AIA" | "ATA" | "ATG" | "ARG" | "ABW" | "AUS" | "AZE" | "BHS" | "BGD" | "BRB" | "BEL" | "BLZ" | "BEN" | "BMU" | "BOL" | "BES" | "BIH" | "BWA" | "BVT" | "BRA" | "VGB" | "BFA" | "BDI" | "CPV" | "CMR" | "CAN" | "CYM" | "CZE" | "CHL" | "CXR" | "CCK" | "COL" | "COK" | "CRI" | "CIV" | "CUB" | "CUW" | "DNK" | "DJI" | "DMA" | "ECU" | "EST" | "IRL" | "SLV" | "FLK" | "FJI" | "FRO" | "GAB" | "GMB" | "GHA" | "GIB" | "GRD" | "GLP" | "GUM" | "GTM" | "GGY" | "GNB" | "GNQ" | "GIN" | "GUY" | "GUF" | "HTI" | "HMD" | "HND" | "HRV" | "IDN" | "ISL" | "IMN" | "JAM" | "JEY" | "GRL" | "KHM" | "KAZ" | "KEN" | "KIR" | "CAF" | "COM" | "REU" | "LVA" | "LSO" | "LBR" | "LIE" | "LTU" | "LUX" | "MDG" | "HUN" | "MHL" | "MWI" | "MYS" | "MDV" | "MLI" | "MLT" | "MTQ" | "MUS" | "MYT" | "MEX" | "FSM" | "MOZ" | "MDA" | "MCO" | "MSR" | "NAM" | "BRN" | "NZL" | "NIC" | "NER" | "NGA" | "NIU" | "NFK" | "NOR" | "MNP" | "NCL" | "AUT" | "UZB" | "PAK" | "PLW" | "PAN" | "PNG" | "PRY" | "PER" | "PHL" | "PCN" | "POL" | "PYF" | "PRT" | "PRI" | "DOM" | "XKX" | "COD" | "COG" | "ROU" | "RWA" | "KNA" | "LCA" | "VCT" | "BLM" | "MAF" | "SPM" | "WSM" | "SMR" | "STP" | "CHE" | "SEN" | "SYC" | "ALB" | "SLE" | "SGP" | "SVN" | "SVK" | "SLB" | "SOM" | "ZAF" | "SGS" | "SSD" | "LKA" | "FIN" | "SUR" | "SWE" | "SWZ" | "TZA" | "TCD" | "ATF" | "TLS" | "TGO" | "TON" | "TTO" | "TUR" | "TKM" | "TCA" | "TUV" | "UGA" | "GBR" | "USA" | "UMI" | "VIR" | "URY" | "VUT" | "VAT" | "VEN" | "VNM" | "WLF" | "ZMB" | "ZWE" | "BTN" | "GRC" | "CYP" | "BLR" | "BGR" | "KGZ" | "MKD" | "MNG" | "RUS" | "SRB" | "TJK" | "UKR" | "MNE" | "ARM" | "ISR" | "AFG" | "JOR" | "DZA" | "SDN" | "ESH" | "IRQ" | "SAU" | "KWT" | "MAR" | "YEM" | "IRN" | "TUN" | "ARE" | "SYR" | "OMN" | "PSE" | "QAT" | "LBN" | "EGY" | "MRT" | "NPL" | "IND" | "THA" | "LAO" | "MMR" | "GEO" | "ETH" | "ERI" | "BHR" | "LBY" | "CHN" | "JPN" | "MAC" | "TWN" | "HKG" | "KOR" | "PRK";
|
|
1499
1499
|
name: string;
|
|
1500
1500
|
deburr: string;
|
|
1501
1501
|
idd: string;
|
|
1502
1502
|
uid: string;
|
|
1503
1503
|
flag: string;
|
|
1504
1504
|
};
|
|
1505
|
-
export declare const individualCountries: ("
|
|
1505
|
+
export declare const individualCountries: ("DEU" | "ESP" | "FRA" | "NLD" | "ITA" | "BEL" | "CZE" | "DNK" | "EST" | "IRL" | "HRV" | "ISL" | "LVA" | "LIE" | "LTU" | "LUX" | "HUN" | "MLT" | "NOR" | "AUT" | "POL" | "PRT" | "ROU" | "SVN" | "SVK" | "FIN" | "SWE" | "GRC" | "CYP" | "BGR")[];
|
|
1506
1506
|
export type IndividualCountryCCA3 = (typeof individualCountries)[number];
|
|
1507
|
-
export declare const companyCountries: ("
|
|
1507
|
+
export declare const companyCountries: ("DEU" | "ESP" | "FRA" | "NLD" | "ITA" | "BEL" | "CZE" | "DNK" | "EST" | "IRL" | "HRV" | "ISL" | "LVA" | "LIE" | "LTU" | "LUX" | "HUN" | "MLT" | "NOR" | "AUT" | "POL" | "PRT" | "ROU" | "SVN" | "SVK" | "FIN" | "SWE" | "GRC" | "CYP" | "BGR")[];
|
|
1508
1508
|
export type CompanyCountryCCA3 = (typeof companyCountries)[number];
|
|
1509
1509
|
export declare const countriesWithMultipleCCA3: Partial<Record<CountryCCA3, CountryCCA3[]>>;
|
|
1510
1510
|
export declare const isCountryCCA3: (value: unknown) => value is CountryCCA3;
|
|
@@ -1512,7 +1512,7 @@ export declare const isCountryCCA2: (value: unknown) => value is CountryCCA2;
|
|
|
1512
1512
|
export declare const isIndividualCountryCCA3: (value: unknown) => value is IndividualCountryCCA3;
|
|
1513
1513
|
export declare const isCompanyCountryCCA3: (value: unknown) => value is CompanyCountryCCA3;
|
|
1514
1514
|
export declare const isCompanyWithUboCountryCCA3: (value: unknown) => value is CompanyWithUboCountryCCA3;
|
|
1515
|
-
export declare const companyFallbackCountry: "
|
|
1516
|
-
export declare const individualFallbackCountry: "
|
|
1515
|
+
export declare const companyFallbackCountry: "DEU" | "ESP" | "FRA" | "NLD" | "ITA" | "BEL" | "CZE" | "DNK" | "EST" | "IRL" | "HRV" | "ISL" | "LVA" | "LIE" | "LTU" | "LUX" | "HUN" | "MLT" | "NOR" | "AUT" | "POL" | "PRT" | "ROU" | "SVN" | "SVK" | "FIN" | "SWE" | "GRC" | "CYP" | "BGR";
|
|
1516
|
+
export declare const individualFallbackCountry: "DEU" | "ESP" | "FRA" | "NLD" | "ITA" | "BEL" | "CZE" | "DNK" | "EST" | "IRL" | "HRV" | "ISL" | "LVA" | "LIE" | "LTU" | "LUX" | "HUN" | "MLT" | "NOR" | "AUT" | "POL" | "PRT" | "ROU" | "SVN" | "SVK" | "FIN" | "SWE" | "GRC" | "CYP" | "BGR";
|
|
1517
1517
|
export declare const getCountryName: (cca3: CountryCCA3) => string;
|
|
1518
1518
|
export {};
|
|
@@ -1799,7 +1799,6 @@ export const individualCountries = [
|
|
|
1799
1799
|
"ROU",
|
|
1800
1800
|
"SWE",
|
|
1801
1801
|
"BGR",
|
|
1802
|
-
"MCO",
|
|
1803
1802
|
];
|
|
1804
1803
|
export const companyCountries = [
|
|
1805
1804
|
"BEL",
|
|
@@ -1832,7 +1831,6 @@ export const companyCountries = [
|
|
|
1832
1831
|
"BGR",
|
|
1833
1832
|
"CYP",
|
|
1834
1833
|
"NOR",
|
|
1835
|
-
"MCO",
|
|
1836
1834
|
];
|
|
1837
1835
|
// Google API accepts only 5 country codes
|
|
1838
1836
|
export const countriesWithMultipleCCA3 = {
|