@busiverse/ui 0.2.3 → 0.2.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +41 -3
- package/dist/assets/index.d.ts +2 -0
- package/dist/assets/index.d.ts.map +1 -0
- package/dist/assets/index.js +49 -0
- package/dist/chunk-2TTXWTIT.js +66 -0
- package/dist/chunk-NZ65VTKR.js +0 -0
- package/dist/chunk-PTOKOI4Q.js +153 -0
- package/dist/chunk-PYZVP4NI.js +24 -0
- package/dist/chunk-UU2CXC3N.js +7886 -0
- package/dist/chunk-WDOMYE77.js +101 -0
- package/dist/components/billing/index.js +12 -0
- package/dist/components/brand/BusiverseBrandHead.d.ts.map +1 -1
- package/dist/components/brand/index.js +11 -0
- package/dist/components/index.d.ts +1 -0
- package/dist/components/index.d.ts.map +1 -1
- package/dist/components/social/SocialIcons.d.ts +17 -0
- package/dist/components/social/SocialIcons.d.ts.map +1 -0
- package/dist/components/social/index.d.ts +2 -0
- package/dist/components/social/index.d.ts.map +1 -0
- package/dist/components/social/index.js +15 -0
- package/dist/i18n/index.js +20 -0
- package/dist/index.d.ts +0 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +148 -8224
- package/dist/styles.css +0 -69
- package/package.json +28 -3
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
import {
|
|
2
|
+
cn
|
|
3
|
+
} from "./chunk-PYZVP4NI.js";
|
|
4
|
+
|
|
5
|
+
// src/i18n/format.ts
|
|
6
|
+
function formatCurrency(amount, region, options) {
|
|
7
|
+
return new Intl.NumberFormat(region.locale, { style: "currency", currency: region.currencyCode, ...options }).format(amount);
|
|
8
|
+
}
|
|
9
|
+
function formatNumber(value, locale = "en-NG", options) {
|
|
10
|
+
return new Intl.NumberFormat(locale, options).format(value);
|
|
11
|
+
}
|
|
12
|
+
function formatDate(value, region, options) {
|
|
13
|
+
return new Intl.DateTimeFormat(region.locale, { timeZone: region.timeZone, dateStyle: "medium", timeStyle: "short", ...options }).format(new Date(value));
|
|
14
|
+
}
|
|
15
|
+
function toRegionHeaders(region) {
|
|
16
|
+
return {
|
|
17
|
+
"Accept-Language": region.locale,
|
|
18
|
+
"X-Busiverse-Country": region.countryCode,
|
|
19
|
+
"X-Busiverse-Region": region.regionCode ?? region.countryCode,
|
|
20
|
+
"X-Busiverse-Currency": region.currencyCode,
|
|
21
|
+
"X-Busiverse-Timezone": region.timeZone
|
|
22
|
+
};
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
// src/pricing/regions.ts
|
|
26
|
+
var busiverseSupportedRegions = [
|
|
27
|
+
{ label: "Nigeria", locale: "en-NG", countryCode: "NG", regionCode: "NG-LA", currencyCode: "NGN", timeZone: "Africa/Lagos", exchangeRateFromUsd: 1500, pricingNote: "NGN display estimate; Account will apply Mint/Location live rules." },
|
|
28
|
+
{ label: "United States", locale: "en-US", countryCode: "US", regionCode: "US", currencyCode: "USD", timeZone: "America/New_York", exchangeRateFromUsd: 1 },
|
|
29
|
+
{ label: "United Kingdom", locale: "en-GB", countryCode: "GB", regionCode: "GB", currencyCode: "GBP", timeZone: "Europe/London", exchangeRateFromUsd: 0.79 },
|
|
30
|
+
{ label: "European Union", locale: "en-IE", countryCode: "IE", regionCode: "EU", currencyCode: "EUR", timeZone: "Europe/Dublin", exchangeRateFromUsd: 0.93 },
|
|
31
|
+
{ label: "Ghana", locale: "en-GH", countryCode: "GH", regionCode: "GH", currencyCode: "GHS", timeZone: "Africa/Accra", exchangeRateFromUsd: 15 },
|
|
32
|
+
{ label: "Kenya", locale: "en-KE", countryCode: "KE", regionCode: "KE", currencyCode: "KES", timeZone: "Africa/Nairobi", exchangeRateFromUsd: 130 },
|
|
33
|
+
{ label: "South Africa", locale: "en-ZA", countryCode: "ZA", regionCode: "ZA", currencyCode: "ZAR", timeZone: "Africa/Johannesburg", exchangeRateFromUsd: 18 },
|
|
34
|
+
{ label: "United Arab Emirates", locale: "en-AE", countryCode: "AE", regionCode: "AE", currencyCode: "AED", timeZone: "Asia/Dubai", exchangeRateFromUsd: 3.67 },
|
|
35
|
+
{ label: "India", locale: "en-IN", countryCode: "IN", regionCode: "IN", currencyCode: "INR", timeZone: "Asia/Kolkata", exchangeRateFromUsd: 83 }
|
|
36
|
+
];
|
|
37
|
+
function getSupportedRegion(countryCode) {
|
|
38
|
+
return busiverseSupportedRegions.find((region) => region.countryCode === countryCode) ?? busiverseSupportedRegions[0];
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
// src/i18n/BusiverseI18nProvider.tsx
|
|
42
|
+
import * as React from "react";
|
|
43
|
+
import { jsx } from "react/jsx-runtime";
|
|
44
|
+
var defaultRegion = {
|
|
45
|
+
locale: "en-NG",
|
|
46
|
+
countryCode: "NG",
|
|
47
|
+
regionCode: "NG-LA",
|
|
48
|
+
currencyCode: "NGN",
|
|
49
|
+
timeZone: "Africa/Lagos"
|
|
50
|
+
};
|
|
51
|
+
var I18nContext = React.createContext(null);
|
|
52
|
+
function BusiverseI18nProvider({ children, initialRegion, bundles = {} }) {
|
|
53
|
+
const [region, setRegion] = React.useState({ ...defaultRegion, ...initialRegion });
|
|
54
|
+
const t = React.useCallback((key, fallback, vars) => {
|
|
55
|
+
const value = bundles[region.locale]?.[key] ?? bundles[region.locale.split("-")[0]]?.[key] ?? fallback ?? key;
|
|
56
|
+
if (!vars) return value;
|
|
57
|
+
return Object.entries(vars).reduce((acc, [name, val]) => acc.replaceAll(`{${name}}`, String(val)), value);
|
|
58
|
+
}, [bundles, region.locale]);
|
|
59
|
+
return /* @__PURE__ */ jsx(I18nContext.Provider, { value: { region, bundles, setRegion, t }, children });
|
|
60
|
+
}
|
|
61
|
+
function useBusiverseI18n() {
|
|
62
|
+
const ctx = React.useContext(I18nContext);
|
|
63
|
+
if (!ctx) throw new Error("useBusiverseI18n must be used inside BusiverseI18nProvider");
|
|
64
|
+
return ctx;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
// src/i18n/RegionSelector.tsx
|
|
68
|
+
import { jsx as jsx2, jsxs } from "react/jsx-runtime";
|
|
69
|
+
function RegionSelector({ regions = busiverseSupportedRegions, label = "Pricing region", className }) {
|
|
70
|
+
const { region, setRegion } = useBusiverseI18n();
|
|
71
|
+
return /* @__PURE__ */ jsxs("label", { className: cn("busiverse-region-selector", className), children: [
|
|
72
|
+
/* @__PURE__ */ jsx2("span", { children: label }),
|
|
73
|
+
/* @__PURE__ */ jsx2(
|
|
74
|
+
"select",
|
|
75
|
+
{
|
|
76
|
+
value: region.countryCode,
|
|
77
|
+
onChange: (event) => {
|
|
78
|
+
const next = regions.find((item) => item.countryCode === event.target.value) ?? regions[0];
|
|
79
|
+
setRegion(next);
|
|
80
|
+
},
|
|
81
|
+
children: regions.map((item) => /* @__PURE__ */ jsxs("option", { value: item.countryCode, children: [
|
|
82
|
+
item.label,
|
|
83
|
+
" \xB7 ",
|
|
84
|
+
item.currencyCode
|
|
85
|
+
] }, item.countryCode))
|
|
86
|
+
}
|
|
87
|
+
)
|
|
88
|
+
] });
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
export {
|
|
92
|
+
formatCurrency,
|
|
93
|
+
formatNumber,
|
|
94
|
+
formatDate,
|
|
95
|
+
toRegionHeaders,
|
|
96
|
+
busiverseSupportedRegions,
|
|
97
|
+
getSupportedRegion,
|
|
98
|
+
BusiverseI18nProvider,
|
|
99
|
+
useBusiverseI18n,
|
|
100
|
+
RegionSelector
|
|
101
|
+
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BusiverseBrandHead.d.ts","sourceRoot":"","sources":["../../../src/components/brand/BusiverseBrandHead.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"BusiverseBrandHead.d.ts","sourceRoot":"","sources":["../../../src/components/brand/BusiverseBrandHead.tsx"],"names":[],"mappings":"AAaA,MAAM,WAAW,uBAAuB;IACtC,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,sBAAsB,CAAC,EAAE,MAAM,CAAC;IAChC,eAAe,CAAC,EAAE,MAAM,CAAC;CAC1B;AA6CD,wBAAgB,uBAAuB,CAAC,EACtC,KAAqB,EACrB,WAAiC,EACjC,QAAsB,EACtB,GAAG,EACH,KAA0B,EAC1B,WAA2B,EAC3B,QAA8H,EAC9H,MAAgB,EAChB,UAAgC,EAChC,sBAAoC,EACpC,eAA6B,GAC9B,GAAE,uBAA4B,QAgC9B;AAED,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,uBAAuB,QAkBhE"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/components/index.ts"],"names":[],"mappings":"AAAA,cAAc,SAAS,CAAC;AACxB,cAAc,cAAc,CAAC;AAC7B,cAAc,UAAU,CAAC;AACzB,cAAc,QAAQ,CAAC;AACvB,cAAc,SAAS,CAAC;AACxB,cAAc,YAAY,CAAC;AAC3B,cAAc,WAAW,CAAC;AAC1B,cAAc,aAAa,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/components/index.ts"],"names":[],"mappings":"AAAA,cAAc,SAAS,CAAC;AACxB,cAAc,cAAc,CAAC;AAC7B,cAAc,UAAU,CAAC;AACzB,cAAc,QAAQ,CAAC;AACvB,cAAc,SAAS,CAAC;AACxB,cAAc,YAAY,CAAC;AAC3B,cAAc,WAAW,CAAC;AAC1B,cAAc,aAAa,CAAC;AAC5B,cAAc,UAAU,CAAC"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
export type BusiverseSocialIconName = "github" | "x" | "linkedin" | "mail";
|
|
3
|
+
export interface BusiverseSocialIconProps extends Omit<React.SVGProps<SVGSVGElement>, "name"> {
|
|
4
|
+
name: BusiverseSocialIconName;
|
|
5
|
+
size?: number | string;
|
|
6
|
+
title?: string;
|
|
7
|
+
}
|
|
8
|
+
export interface BusiverseNamedSocialIconProps extends Omit<React.SVGProps<SVGSVGElement>, "name"> {
|
|
9
|
+
size?: number | string;
|
|
10
|
+
title?: string;
|
|
11
|
+
}
|
|
12
|
+
export declare function BusiverseSocialIcon({ name, size, title, className, ...props }: BusiverseSocialIconProps): React.JSX.Element;
|
|
13
|
+
export declare function BusiverseGithubIcon(props: BusiverseNamedSocialIconProps): React.JSX.Element;
|
|
14
|
+
export declare function BusiverseXIcon(props: BusiverseNamedSocialIconProps): React.JSX.Element;
|
|
15
|
+
export declare function BusiverseLinkedInIcon(props: BusiverseNamedSocialIconProps): React.JSX.Element;
|
|
16
|
+
export declare function BusiverseMailIcon(props: BusiverseNamedSocialIconProps): React.JSX.Element;
|
|
17
|
+
//# sourceMappingURL=SocialIcons.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SocialIcons.d.ts","sourceRoot":"","sources":["../../../src/components/social/SocialIcons.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAG/B,MAAM,MAAM,uBAAuB,GAAG,QAAQ,GAAG,GAAG,GAAG,UAAU,GAAG,MAAM,CAAC;AAE3E,MAAM,WAAW,wBAAyB,SAAQ,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC,aAAa,CAAC,EAAE,MAAM,CAAC;IAC3F,IAAI,EAAE,uBAAuB,CAAC;IAC9B,IAAI,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IACvB,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED,MAAM,WAAW,6BAA8B,SAAQ,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC,aAAa,CAAC,EAAE,MAAM,CAAC;IAChG,IAAI,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IACvB,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAqBD,wBAAgB,mBAAmB,CAAC,EAClC,IAAI,EACJ,IAAS,EACT,KAAK,EACL,SAAS,EACT,GAAG,KAAK,EACT,EAAE,wBAAwB,qBAkB1B;AAED,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,6BAA6B,qBAEvE;AAED,wBAAgB,cAAc,CAAC,KAAK,EAAE,6BAA6B,qBAElE;AAED,wBAAgB,qBAAqB,CAAC,KAAK,EAAE,6BAA6B,qBAEzE;AAED,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,6BAA6B,qBAErE"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/social/index.ts"],"names":[],"mappings":"AAAA,cAAc,eAAe,CAAC"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import {
|
|
2
|
+
BusiverseGithubIcon,
|
|
3
|
+
BusiverseLinkedInIcon,
|
|
4
|
+
BusiverseMailIcon,
|
|
5
|
+
BusiverseSocialIcon,
|
|
6
|
+
BusiverseXIcon
|
|
7
|
+
} from "../../chunk-2TTXWTIT.js";
|
|
8
|
+
import "../../chunk-PYZVP4NI.js";
|
|
9
|
+
export {
|
|
10
|
+
BusiverseGithubIcon,
|
|
11
|
+
BusiverseLinkedInIcon,
|
|
12
|
+
BusiverseMailIcon,
|
|
13
|
+
BusiverseSocialIcon,
|
|
14
|
+
BusiverseXIcon
|
|
15
|
+
};
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import "../chunk-NZ65VTKR.js";
|
|
2
|
+
import {
|
|
3
|
+
BusiverseI18nProvider,
|
|
4
|
+
RegionSelector,
|
|
5
|
+
formatCurrency,
|
|
6
|
+
formatDate,
|
|
7
|
+
formatNumber,
|
|
8
|
+
toRegionHeaders,
|
|
9
|
+
useBusiverseI18n
|
|
10
|
+
} from "../chunk-WDOMYE77.js";
|
|
11
|
+
import "../chunk-PYZVP4NI.js";
|
|
12
|
+
export {
|
|
13
|
+
BusiverseI18nProvider,
|
|
14
|
+
RegionSelector,
|
|
15
|
+
formatCurrency,
|
|
16
|
+
formatDate,
|
|
17
|
+
formatNumber,
|
|
18
|
+
toRegionHeaders,
|
|
19
|
+
useBusiverseI18n
|
|
20
|
+
};
|
package/dist/index.d.ts
CHANGED
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,UAAU,CAAC;AACzB,cAAc,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,UAAU,CAAC;AACzB,cAAc,cAAc,CAAC;AAC7B,cAAc,qBAAqB,CAAC;AACpC,cAAc,WAAW,CAAC;AAC1B,cAAc,OAAO,CAAC;AACtB,cAAc,QAAQ,CAAC;AACvB,cAAc,QAAQ,CAAC;AACvB,cAAc,YAAY,CAAC"}
|