@zonos/amino 6.0.0-alpha.34 → 6.0.0-alpha.35

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.
@@ -24,10 +24,10 @@ declare const schemaCountry: z.ZodObject<{
24
24
  label: string;
25
25
  displayName: string;
26
26
  value: string;
27
+ languageCode: string | null;
27
28
  code3: string | null;
28
29
  currencyCode: string;
29
30
  fraudRisk: number;
30
- languageCode: string | null;
31
31
  numericCode: string | null;
32
32
  phoneCode: string[];
33
33
  upsCode: string | null;
@@ -39,10 +39,10 @@ declare const schemaCountry: z.ZodObject<{
39
39
  label: string;
40
40
  displayName: string;
41
41
  value: string;
42
+ languageCode: string | null;
42
43
  code3: string | null;
43
44
  currencyCode: string;
44
45
  fraudRisk: number;
45
- languageCode: string | null;
46
46
  numericCode: string | null;
47
47
  phoneCode: string[];
48
48
  upsCode: string | null;
@@ -9,10 +9,10 @@ export declare const prepCountryOptions: <CountryCode extends string = string>({
9
9
  active: boolean;
10
10
  code: CountryCode;
11
11
  displayName: string;
12
+ languageCode: string | null;
12
13
  code3: string | null;
13
14
  currencyCode: string;
14
15
  fraudRisk: number;
15
- languageCode: string | null;
16
16
  numericCode: string | null;
17
17
  upsCode: string | null;
18
18
  zipRegex: string | null;
@@ -78,5 +78,5 @@ export declare const supportedLanguages: readonly [{
78
78
  export type SupportedLanguageCode = (typeof supportedLanguages)[number]['code'];
79
79
  export declare const supportedLanguageOptions: {
80
80
  label: "dansk" | "Deutsche" | "English" | "Español" | "Français" | "bahasa Indonesia" | "Italiano" | "日本語" | "한국어" | "Nederlands" | "norsk" | "Polskie" | "Português" | "русский" | "svenska" | "ไทย" | "Türk" | "Tiếng Việt" | "中文";
81
- value: "DE" | "ES" | "FR" | "ID" | "IT" | "NL" | "NO" | "PL" | "PT" | "RU" | "SV" | "TH" | "TR" | "VI" | "DA" | "EN" | "JA" | "KO" | "ZH_CN";
81
+ value: "DA" | "DE" | "EN" | "ES" | "FR" | "ID" | "IT" | "JA" | "KO" | "NL" | "NO" | "PL" | "PT" | "RU" | "SV" | "TH" | "TR" | "VI" | "ZH_CN";
82
82
  }[];
@@ -1,75 +0,0 @@
1
- import type { BaseProps } from "../../types/BaseProps";
2
- import type { GeoJsonWorld } from "../../types/GeoJsonWorld";
3
- import type { CountryOption } from "../../utils/hooks/useCountryOptions";
4
- type Props = BaseProps & {
5
- /**
6
- * Array of country options to be used for mapping country names to ISO codes
7
- */
8
- countries: CountryOption[];
9
- /**
10
- * ISO country code for the origin country
11
- */
12
- from: string;
13
- /**
14
- * Height of the map in pixels
15
- * @default 400
16
- */
17
- height?: number;
18
- /**
19
- * ISO country code for the destination country
20
- */
21
- to: string;
22
- /**
23
- * GeoJSON data containing world map information
24
- */
25
- worldData: GeoJsonWorld | null;
26
- };
27
- /**
28
- * A geographic map component that visualizes connections between two countries.
29
- * Displays a world map with highlighted countries and a connecting line between them,
30
- * automatically centering and scaling the view for optimal visualization.
31
- *
32
- * @example Basic usage
33
- * ```tsx
34
- * const { countryOptions } = useCountryOptions();
35
- * const [worldData, setWorldData] = useState<GeoJsonWorld | null>(null);
36
- *
37
- * useEffect(() => {
38
- * fetch('/zonos-countries-geojson.json')
39
- * .then(response => response.json())
40
- * .then(data => setWorldData(data));
41
- * }, []);
42
- *
43
- * <ConnectionMap
44
- * countries={countryOptions}
45
- * from="US"
46
- * to="JP"
47
- * worldData={worldData}
48
- * />
49
- * ```
50
- *
51
- * @example With custom height
52
- * ```tsx
53
- * <ConnectionMap
54
- * countries={countryOptions}
55
- * from="GB"
56
- * to="AU"
57
- * height={600}
58
- * worldData={worldData}
59
- * />
60
- * ```
61
- *
62
- * @example With custom styling
63
- * ```tsx
64
- * <ConnectionMap
65
- * className="custom-map-container"
66
- * countries={countryOptions}
67
- * from="CA"
68
- * to="BR"
69
- * style={{ border: '1px solid var(--amino-gray-200)' }}
70
- * worldData={worldData}
71
- * />
72
- * ```
73
- */
74
- export declare const ConnectionMap: ({ className, countries, from, height, style, to, worldData, }: Props) => import("react").JSX.Element;
75
- export {};
@@ -1 +0,0 @@
1
- "use strict";var e=require("../../tslib.es6-cdc5f922.js"),r=require("react"),t=require("react-simple-maps"),i=require("d3-geo"),s=require("topojson-client"),a=require("../skeleton/Skeleton.js"),o=require("../../styles/constants/theme.js"),n=require("../../utils/cn.js"),l=require("../../utils/getCountryCodeByName.js"),u=require("react/jsx-runtime");require("clsx"),require("tailwind-merge");exports.ConnectionMap=function(c){var d=c.className,h=c.countries,m=c.from,g=c.height,f=void 0===g?400:g,j=c.style,x=c.to,b=c.worldData,p=e.__read(r.useState([0,0]),2),y=p[0],v=p[1],k=e.__read(r.useState(1),2),q=k[0],_=k[1],C=e.__read(r.useState([0,0,0]),2),M=C[0],w=C[1],N=r.useMemo(function(){return b?s.feature(b,b.objects.countries).features:null},[b]),S=r.useCallback(function(e){var r=null==N?void 0:N.find(function(r){var t;return l.getCountryCodeByName(null===(t=r.properties)||void 0===t?void 0:t.name,h)===e});return r?i.geoCentroid(r):[0,0]},[h,N]),D=!(N&&h.length&&m&&x);return r.useEffect(function(){if(!D){var r=e.__read(S(m),2),t=r[0],s=r[1],a=e.__read(S(x),2),o=a[0],n=a[1],l=i.geoDistance([t,s],[o,n]),u=i.geoDistance([t,0],[o,0]),c=i.geoDistance([0,s],[0,n]),d=function(e,r){return-19.46498024*e+-92.29376925*r+284.7+(e+r>4?80*(e+r-4):0)}(u,c);_(d);var h=e.__read([(t+o)/2,(s+n)/2],2),g=h[0],f=h[1];v([0,f]);var j=-g;Math.abs(t-o)>180&&(j+=180);var b=Math.abs(f)>55?l*-(Math.abs(f)-50):0,p=c>1&&u>c&&Math.max(s,n)>50?u/c*-5:0;w([j,b+p,0])}},[S,x,m,D]),D?u.jsx(a.Skeleton,{className:"rounded-amino-12 m-0 box-border w-full",height:f,style:{padding:"16.5%"}}):u.jsx("div",{className:n.cn("rounded-amino-12 dark:bg-night-gray-50 overflow-hidden bg-gray-50","[&_*]:outline-none",d),style:j,children:u.jsxs(t.ComposableMap,{height:f,projection:"geoEqualEarth",projectionConfig:{center:y,rotate:M,scale:q},children:[u.jsx(t.Geographies,{geography:N,children:function(e){return e.geographies.map(function(e){var r=[x,m].includes(l.getCountryCodeByName(e.properties.name,h));return u.jsx(t.Geography,{fill:r?o.theme.blue100:o.theme.gray0,geography:e,stroke:r?o.theme.blue400:o.theme.gray200,strokeWidth:2},e.rsmKey)})}}),u.jsxs(t.Marker,{coordinates:S(m),children:[u.jsx("circle",{fill:o.theme.blue300,r:10}),u.jsx("circle",{fill:o.theme.blue400,r:7})]}),u.jsxs(t.Marker,{coordinates:S(x),children:[u.jsx("circle",{fill:o.theme.blue300,r:10}),u.jsx("circle",{fill:o.theme.blue400,r:7})]}),u.jsx(t.Line,{from:S(m),stroke:o.theme.blue600,strokeWidth:4,to:S(x)}),u.jsxs(t.Marker,{coordinates:S(m),children:[u.jsx("circle",{fill:"white",r:4}),u.jsx("circle",{fill:o.theme.blue600,r:2})]}),u.jsxs(t.Marker,{coordinates:S(x),children:[u.jsx("circle",{fill:"white",r:4}),u.jsx("circle",{fill:o.theme.blue600,r:2})]})]})})};
@@ -1,21 +0,0 @@
1
- import type { BBox } from 'geojson';
2
- import type { Arc, MultiPolygon, Polygon, Transform } from 'topojson-specification';
3
- type Properties = {
4
- name: string;
5
- };
6
- type Geometry = (Polygon | MultiPolygon) & {
7
- properties: Properties;
8
- };
9
- export type GeoJsonWorld = {
10
- arcs: Arc[];
11
- bbox: BBox;
12
- objects: {
13
- countries: {
14
- geometries: Geometry[];
15
- type: 'GeometryCollection';
16
- };
17
- };
18
- transform: Transform;
19
- type: 'Topology';
20
- };
21
- export {};