@wordrhyme/plugin 0.1.0-alpha.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/dist/admin/index.d.ts +19 -0
- package/dist/admin/index.js +42 -0
- package/dist/admin/index.js.map +1 -0
- package/dist/artifact.d.ts +17 -0
- package/dist/artifact.js +96 -0
- package/dist/artifact.js.map +1 -0
- package/dist/chunk-46KUIGB6.js +230 -0
- package/dist/chunk-46KUIGB6.js.map +1 -0
- package/dist/chunk-6GDCFR67.js +218 -0
- package/dist/chunk-6GDCFR67.js.map +1 -0
- package/dist/chunk-DY44Q4CK.js +188 -0
- package/dist/chunk-DY44Q4CK.js.map +1 -0
- package/dist/chunk-MZOLSLJ7.js +65 -0
- package/dist/chunk-MZOLSLJ7.js.map +1 -0
- package/dist/chunk-QNCOGISF.js +694 -0
- package/dist/chunk-QNCOGISF.js.map +1 -0
- package/dist/chunk-UGMYO6AU.js +37 -0
- package/dist/chunk-UGMYO6AU.js.map +1 -0
- package/dist/chunk-YQDKOEUI.js +242 -0
- package/dist/chunk-YQDKOEUI.js.map +1 -0
- package/dist/chunk-ZUBFLOKU.js +153 -0
- package/dist/chunk-ZUBFLOKU.js.map +1 -0
- package/dist/client-WXWbuuvd.d.ts +100 -0
- package/dist/client.d.ts +3 -0
- package/dist/client.js +29 -0
- package/dist/client.js.map +1 -0
- package/dist/dev-utils.d.ts +68 -0
- package/dist/dev-utils.js +21 -0
- package/dist/dev-utils.js.map +1 -0
- package/dist/entity-extensions-B5BbZH-m.d.ts +56 -0
- package/dist/globalization.d.ts +80 -0
- package/dist/globalization.js +43 -0
- package/dist/globalization.js.map +1 -0
- package/dist/index.d.ts +316 -0
- package/dist/index.js +354 -0
- package/dist/index.js.map +1 -0
- package/dist/manifest-CPSCN_Ft.d.ts +1471 -0
- package/dist/react.d.ts +145 -0
- package/dist/react.js +94 -0
- package/dist/react.js.map +1 -0
- package/dist/release-CyapqJ3z.d.ts +230 -0
- package/dist/server.d.ts +114 -0
- package/dist/server.js +194 -0
- package/dist/server.js.map +1 -0
- package/dist/time.d.ts +34 -0
- package/dist/time.js +31 -0
- package/dist/time.js.map +1 -0
- package/dist/trpc.d.ts +43 -0
- package/dist/trpc.js +11 -0
- package/dist/trpc.js.map +1 -0
- package/dist/types-8P7XyoyQ.d.ts +1599 -0
- package/package.json +83 -0
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
import './manifest-CPSCN_Ft.js';
|
|
2
|
+
|
|
3
|
+
type ComponentType = (props: any) => any;
|
|
4
|
+
type Target = NavTarget | NavGroupTarget | RouteTarget | SettingsTarget | DashboardTarget | GenericTarget;
|
|
5
|
+
interface NavTarget {
|
|
6
|
+
slot: 'nav.sidebar';
|
|
7
|
+
path: string;
|
|
8
|
+
icon?: string;
|
|
9
|
+
order?: number;
|
|
10
|
+
requiredPermission?: string;
|
|
11
|
+
parent?: string;
|
|
12
|
+
}
|
|
13
|
+
interface NavGroupTarget {
|
|
14
|
+
slot: 'nav.sidebar.group';
|
|
15
|
+
path?: string;
|
|
16
|
+
icon?: string;
|
|
17
|
+
order?: number;
|
|
18
|
+
}
|
|
19
|
+
interface RouteTarget {
|
|
20
|
+
slot: 'plugin.route';
|
|
21
|
+
path: string;
|
|
22
|
+
order?: number;
|
|
23
|
+
params?: Record<string, string>;
|
|
24
|
+
}
|
|
25
|
+
interface SettingsTarget {
|
|
26
|
+
slot: 'settings.plugin';
|
|
27
|
+
category?: string;
|
|
28
|
+
order?: number;
|
|
29
|
+
visibility?: 'platform' | 'all';
|
|
30
|
+
}
|
|
31
|
+
interface DashboardTarget {
|
|
32
|
+
slot: 'dashboard.widgets' | 'dashboard.overview';
|
|
33
|
+
order?: number;
|
|
34
|
+
colSpan?: 1 | 2 | 3 | 4;
|
|
35
|
+
}
|
|
36
|
+
interface GenericTarget {
|
|
37
|
+
slot: string;
|
|
38
|
+
order?: number;
|
|
39
|
+
}
|
|
40
|
+
interface SlotContext {
|
|
41
|
+
[key: string]: unknown;
|
|
42
|
+
}
|
|
43
|
+
interface UIExtensionDef {
|
|
44
|
+
id: string;
|
|
45
|
+
label: string;
|
|
46
|
+
icon?: string;
|
|
47
|
+
category?: string;
|
|
48
|
+
component?: ComponentType;
|
|
49
|
+
remoteComponent?: string;
|
|
50
|
+
targets: Target[];
|
|
51
|
+
/** If true, the extension is registered for component matching but hidden from sidebar */
|
|
52
|
+
hidden?: boolean;
|
|
53
|
+
}
|
|
54
|
+
type ExtensionComponentMap = Record<string, ComponentType>;
|
|
55
|
+
type ToolbarHandlerMap = Record<string, () => void>;
|
|
56
|
+
declare function defineExtension(ext: UIExtensionDef): UIExtensionDef;
|
|
57
|
+
declare function navExtension(ext: {
|
|
58
|
+
id: string;
|
|
59
|
+
label: string;
|
|
60
|
+
icon?: string;
|
|
61
|
+
component?: ComponentType;
|
|
62
|
+
remoteComponent?: string;
|
|
63
|
+
path: string;
|
|
64
|
+
order?: number;
|
|
65
|
+
requiredPermission?: string;
|
|
66
|
+
/** If true, registers component but hides from sidebar (menu managed by host) */
|
|
67
|
+
hidden?: boolean;
|
|
68
|
+
}): UIExtensionDef;
|
|
69
|
+
declare function routeExtension(ext: {
|
|
70
|
+
id: string;
|
|
71
|
+
label: string;
|
|
72
|
+
icon?: string;
|
|
73
|
+
component?: ComponentType;
|
|
74
|
+
remoteComponent?: string;
|
|
75
|
+
path: string;
|
|
76
|
+
order?: number;
|
|
77
|
+
params?: Record<string, string>;
|
|
78
|
+
}): UIExtensionDef;
|
|
79
|
+
declare function settingsExtension(ext: {
|
|
80
|
+
id: string;
|
|
81
|
+
label: string;
|
|
82
|
+
icon?: string;
|
|
83
|
+
component?: ComponentType;
|
|
84
|
+
remoteComponent?: string;
|
|
85
|
+
order?: number;
|
|
86
|
+
category?: string;
|
|
87
|
+
visibility?: 'platform' | 'all';
|
|
88
|
+
}): UIExtensionDef;
|
|
89
|
+
declare function dashboardExtension(ext: {
|
|
90
|
+
id: string;
|
|
91
|
+
label: string;
|
|
92
|
+
icon?: string;
|
|
93
|
+
component?: ComponentType;
|
|
94
|
+
remoteComponent?: string;
|
|
95
|
+
order?: number;
|
|
96
|
+
colSpan?: 1 | 2 | 3 | 4;
|
|
97
|
+
}): UIExtensionDef;
|
|
98
|
+
declare function multiSlotExtension(ext: UIExtensionDef): UIExtensionDef;
|
|
99
|
+
|
|
100
|
+
export { type DashboardTarget as D, type ExtensionComponentMap as E, type GenericTarget as G, type NavGroupTarget as N, type RouteTarget as R, type SettingsTarget as S, type Target as T, type UIExtensionDef as U, type NavTarget as a, type SlotContext as b, type ToolbarHandlerMap as c, dashboardExtension as d, defineExtension as e, multiSlotExtension as m, navExtension as n, routeExtension as r, settingsExtension as s };
|
package/dist/client.d.ts
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
export { D as DashboardTarget, G as GenericTarget, a as NavTarget, S as SettingsTarget, b as SlotContext, T as Target, U as UIExtensionDef, d as dashboardExtension, e as defineExtension, m as multiSlotExtension, n as navExtension, s as settingsExtension } from './client-WXWbuuvd.js';
|
|
2
|
+
export { d as AggregationStrategy, l as PluginCapabilities, P as PluginManifest, m as PluginNotificationType, n as PluginStatus, z as adminExtensionSchema, L as dashboardTargetSchema, T as navTargetSchema, V as pluginManifestSchema, Z as settingsTargetSchema, _ as targetSchema } from './manifest-CPSCN_Ft.js';
|
|
3
|
+
import 'zod';
|
package/dist/client.js
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import {
|
|
2
|
+
dashboardExtension,
|
|
3
|
+
defineExtension,
|
|
4
|
+
multiSlotExtension,
|
|
5
|
+
navExtension,
|
|
6
|
+
settingsExtension
|
|
7
|
+
} from "./chunk-MZOLSLJ7.js";
|
|
8
|
+
import {
|
|
9
|
+
adminExtensionSchema,
|
|
10
|
+
dashboardTargetSchema,
|
|
11
|
+
navTargetSchema,
|
|
12
|
+
pluginManifestSchema,
|
|
13
|
+
settingsTargetSchema,
|
|
14
|
+
targetSchema
|
|
15
|
+
} from "./chunk-QNCOGISF.js";
|
|
16
|
+
export {
|
|
17
|
+
adminExtensionSchema,
|
|
18
|
+
dashboardExtension,
|
|
19
|
+
dashboardTargetSchema,
|
|
20
|
+
defineExtension,
|
|
21
|
+
multiSlotExtension,
|
|
22
|
+
navExtension,
|
|
23
|
+
navTargetSchema,
|
|
24
|
+
pluginManifestSchema,
|
|
25
|
+
settingsExtension,
|
|
26
|
+
settingsTargetSchema,
|
|
27
|
+
targetSchema
|
|
28
|
+
};
|
|
29
|
+
//# sourceMappingURL=client.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Plugin Development Utilities
|
|
3
|
+
*
|
|
4
|
+
* Shared utilities for plugin development, including automatic port assignment.
|
|
5
|
+
*/
|
|
6
|
+
type PluginRemoteSurface = 'admin' | 'web';
|
|
7
|
+
interface ResolvedPluginRemoteEntry {
|
|
8
|
+
remoteEntry: string;
|
|
9
|
+
source: 'dev' | 'manifest';
|
|
10
|
+
}
|
|
11
|
+
interface ResolvePluginRemoteEntryOptions {
|
|
12
|
+
pluginId: string;
|
|
13
|
+
manifestRemoteEntry: string;
|
|
14
|
+
devRemoteEntry?: string | undefined;
|
|
15
|
+
surface?: PluginRemoteSurface | undefined;
|
|
16
|
+
isDev?: boolean | undefined;
|
|
17
|
+
probeTimeoutMs?: number | undefined;
|
|
18
|
+
entryChunkPaths?: readonly string[] | undefined;
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Calculate a deterministic dev port for a plugin based on its ID.
|
|
22
|
+
*
|
|
23
|
+
* This allows multiple plugins to run simultaneously without port conflicts,
|
|
24
|
+
* while keeping the port assignment automatic and predictable.
|
|
25
|
+
*
|
|
26
|
+
* Port range: 3010-3109 (100 possible ports)
|
|
27
|
+
*
|
|
28
|
+
* @param pluginId - Full plugin ID (e.g., "com.wordrhyme.hello-world")
|
|
29
|
+
* @returns Port number for the plugin's dev server
|
|
30
|
+
*
|
|
31
|
+
* @example
|
|
32
|
+
* getPluginDevPort('com.wordrhyme.hello-world') // e.g., 3042
|
|
33
|
+
* getPluginDevPort('com.wordrhyme.analytics') // e.g., 3015
|
|
34
|
+
*/
|
|
35
|
+
declare function getPluginDevPort(pluginId: string): number;
|
|
36
|
+
/**
|
|
37
|
+
* Get the dev remote entry URL for a plugin.
|
|
38
|
+
*
|
|
39
|
+
* @param pluginId - Full plugin ID
|
|
40
|
+
* @returns Full URL to the plugin's remoteEntry.js in dev mode
|
|
41
|
+
*/
|
|
42
|
+
declare function getPluginDevRemoteEntry(pluginId: string): string;
|
|
43
|
+
/**
|
|
44
|
+
* Calculate a deterministic public web dev port for a plugin.
|
|
45
|
+
*
|
|
46
|
+
* Public web remotes run beside admin remotes, so they use the same stable
|
|
47
|
+
* plugin hash with a +100 offset.
|
|
48
|
+
*/
|
|
49
|
+
declare function getPluginWebDevPort(pluginId: string): number;
|
|
50
|
+
/**
|
|
51
|
+
* Get the public web dev remote entry URL for a plugin.
|
|
52
|
+
*/
|
|
53
|
+
declare function getPluginWebDevRemoteEntry(pluginId: string): string;
|
|
54
|
+
/**
|
|
55
|
+
* Normalize plugin ID to a valid Module Federation name.
|
|
56
|
+
*
|
|
57
|
+
* MF names must be valid JavaScript identifiers.
|
|
58
|
+
* "com.wordrhyme.hello-world" → "plugin_hello_world"
|
|
59
|
+
*
|
|
60
|
+
* @param pluginId - Full plugin ID
|
|
61
|
+
* @returns Valid MF module name
|
|
62
|
+
*/
|
|
63
|
+
declare function getPluginMfName(pluginId: string): string;
|
|
64
|
+
declare function isPluginDevRemoteEnabled(pluginId: string): boolean;
|
|
65
|
+
declare function resolvePluginRemoteEntry({ pluginId, manifestRemoteEntry, devRemoteEntry, surface, isDev, probeTimeoutMs, entryChunkPaths, }: ResolvePluginRemoteEntryOptions): Promise<ResolvedPluginRemoteEntry>;
|
|
66
|
+
declare function appendRemoteEntryCacheBust(remoteEntry: string, value: string | number): string;
|
|
67
|
+
|
|
68
|
+
export { type PluginRemoteSurface, type ResolvePluginRemoteEntryOptions, type ResolvedPluginRemoteEntry, appendRemoteEntryCacheBust, getPluginDevPort, getPluginDevRemoteEntry, getPluginMfName, getPluginWebDevPort, getPluginWebDevRemoteEntry, isPluginDevRemoteEnabled, resolvePluginRemoteEntry };
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import {
|
|
2
|
+
appendRemoteEntryCacheBust,
|
|
3
|
+
getPluginDevPort,
|
|
4
|
+
getPluginDevRemoteEntry,
|
|
5
|
+
getPluginMfName,
|
|
6
|
+
getPluginWebDevPort,
|
|
7
|
+
getPluginWebDevRemoteEntry,
|
|
8
|
+
isPluginDevRemoteEnabled,
|
|
9
|
+
resolvePluginRemoteEntry
|
|
10
|
+
} from "./chunk-YQDKOEUI.js";
|
|
11
|
+
export {
|
|
12
|
+
appendRemoteEntryCacheBust,
|
|
13
|
+
getPluginDevPort,
|
|
14
|
+
getPluginDevRemoteEntry,
|
|
15
|
+
getPluginMfName,
|
|
16
|
+
getPluginWebDevPort,
|
|
17
|
+
getPluginWebDevRemoteEntry,
|
|
18
|
+
isPluginDevRemoteEnabled,
|
|
19
|
+
resolvePluginRemoteEntry
|
|
20
|
+
};
|
|
21
|
+
//# sourceMappingURL=dev-utils.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import { E as EntityExtensionFieldType, a as EntityExtensionField } from './manifest-CPSCN_Ft.js';
|
|
2
|
+
import { H as HookContext, a as PluginContext, b as HookHandlerOptions } from './types-8P7XyoyQ.js';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Projection customization hook for entity extension values.
|
|
6
|
+
*
|
|
7
|
+
* Advanced plugins can listen to this hook to customize the projection that the
|
|
8
|
+
* framework persists. Normal plugins do not need to listen to it.
|
|
9
|
+
*/
|
|
10
|
+
declare const EXTENSION_PROJECT_SAVE_HOOK_ID = "extension.project.save";
|
|
11
|
+
/** @deprecated Use EXTENSION_PROJECT_SAVE_HOOK_ID / "extension.project.save". */
|
|
12
|
+
declare const ENTITY_EXTENSION_VALUES_SAVE_HOOK_ID = "entity.extension.values.save";
|
|
13
|
+
interface EntityExtensionValueSavePayload {
|
|
14
|
+
ownerPluginId: string;
|
|
15
|
+
organizationId: string;
|
|
16
|
+
/** Global extension target id, e.g. "com.example.shop.stores". */
|
|
17
|
+
targetId: string;
|
|
18
|
+
entityId: string;
|
|
19
|
+
values: Record<string, unknown>;
|
|
20
|
+
fields: Record<string, EntityExtensionField & {
|
|
21
|
+
type: EntityExtensionFieldType;
|
|
22
|
+
}>;
|
|
23
|
+
projections?: EntityExtensionProjectionValue[];
|
|
24
|
+
storedByPluginId?: string;
|
|
25
|
+
}
|
|
26
|
+
interface EntityExtensionProjectionValue {
|
|
27
|
+
pluginId: string;
|
|
28
|
+
field: string;
|
|
29
|
+
type: EntityExtensionFieldType;
|
|
30
|
+
value: unknown;
|
|
31
|
+
display: string | null;
|
|
32
|
+
searchText?: string | null;
|
|
33
|
+
refEntity: string | null;
|
|
34
|
+
refId: string | null;
|
|
35
|
+
}
|
|
36
|
+
interface EntityExtensionValueSaveResult {
|
|
37
|
+
projections?: EntityExtensionProjectionValue[];
|
|
38
|
+
storedByPluginId?: string;
|
|
39
|
+
}
|
|
40
|
+
type EntityExtensionValueSaveHandler = (payload: EntityExtensionValueSavePayload, context: HookContext) => Promise<EntityExtensionValueSaveResult | undefined> | EntityExtensionValueSaveResult | undefined;
|
|
41
|
+
/**
|
|
42
|
+
* @deprecated Use `ctx.hooks.on("extension.project.save", handler)`.
|
|
43
|
+
*/
|
|
44
|
+
declare function registerSaver(ctx: Pick<PluginContext, 'pluginId' | 'hooks'>, handler: EntityExtensionValueSaveHandler, options?: HookHandlerOptions): () => void;
|
|
45
|
+
/**
|
|
46
|
+
* @deprecated Use `ctx.hooks.on("extension.project.save", handler)`.
|
|
47
|
+
*/
|
|
48
|
+
declare const entityExtensions: {
|
|
49
|
+
registerSaver: typeof registerSaver;
|
|
50
|
+
};
|
|
51
|
+
/**
|
|
52
|
+
* @deprecated Use `ctx.hooks.on("extension.project.save", handler)`.
|
|
53
|
+
*/
|
|
54
|
+
declare function registerEntityExtensionValueSaver(ctx: Pick<PluginContext, 'pluginId' | 'hooks'>, handler: EntityExtensionValueSaveHandler, options?: HookHandlerOptions): () => void;
|
|
55
|
+
|
|
56
|
+
export { ENTITY_EXTENSION_VALUES_SAVE_HOOK_ID as E, EXTENSION_PROJECT_SAVE_HOOK_ID as a, type EntityExtensionProjectionValue as b, type EntityExtensionValueSaveHandler as c, type EntityExtensionValueSavePayload as d, type EntityExtensionValueSaveResult as e, entityExtensions as f, registerEntityExtensionValueSaver as r };
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
export { default as Decimal } from 'decimal.js';
|
|
2
|
+
|
|
3
|
+
type TextDirection = 'ltr' | 'rtl';
|
|
4
|
+
type TranslationMessages = Record<string, string>;
|
|
5
|
+
type I18nTextField = string | Record<string, string | null | undefined> | null | undefined;
|
|
6
|
+
interface LanguageInfo {
|
|
7
|
+
locale: string;
|
|
8
|
+
name: string;
|
|
9
|
+
nativeName?: string | null | undefined;
|
|
10
|
+
isDefault?: boolean | undefined;
|
|
11
|
+
isEnabled?: boolean | undefined;
|
|
12
|
+
sortOrder?: number | null | undefined;
|
|
13
|
+
direction?: TextDirection | undefined;
|
|
14
|
+
}
|
|
15
|
+
interface CurrencyInfo {
|
|
16
|
+
code: string;
|
|
17
|
+
nameI18n: Record<string, string>;
|
|
18
|
+
symbol: string;
|
|
19
|
+
decimalDigits: number;
|
|
20
|
+
isBase: boolean;
|
|
21
|
+
currentRate: string | null;
|
|
22
|
+
}
|
|
23
|
+
type CurrencyInfoInput = {
|
|
24
|
+
code: string;
|
|
25
|
+
nameI18n?: Record<string, string> | null | undefined;
|
|
26
|
+
symbol?: string | null | undefined;
|
|
27
|
+
decimalDigits?: number | null | undefined;
|
|
28
|
+
isBase?: boolean | null | undefined;
|
|
29
|
+
currentRate?: string | null | undefined;
|
|
30
|
+
};
|
|
31
|
+
interface GlobalizationState {
|
|
32
|
+
locale: string;
|
|
33
|
+
direction: TextDirection;
|
|
34
|
+
availableLocales: string[];
|
|
35
|
+
languages?: LanguageInfo[] | undefined;
|
|
36
|
+
currency: string;
|
|
37
|
+
currencies: CurrencyInfo[];
|
|
38
|
+
baseCurrency: CurrencyInfo;
|
|
39
|
+
timezone?: string | undefined;
|
|
40
|
+
fallbackLocale?: string | undefined;
|
|
41
|
+
messages?: TranslationMessages | undefined;
|
|
42
|
+
t?: Translator | undefined;
|
|
43
|
+
p?: PriceFormatter | undefined;
|
|
44
|
+
changeLocale?: ((locale: string) => void | Promise<void>) | undefined;
|
|
45
|
+
changeCurrency?: ((currencyCode: string) => void | Promise<void>) | undefined;
|
|
46
|
+
}
|
|
47
|
+
interface FormatPriceOptions {
|
|
48
|
+
showSymbol?: boolean | undefined;
|
|
49
|
+
currencyDisplay?: 'symbol' | 'code' | 'name' | 'narrowSymbol' | undefined;
|
|
50
|
+
notation?: 'standard' | 'compact' | undefined;
|
|
51
|
+
signDisplay?: 'auto' | 'always' | 'exceptZero' | 'never' | undefined;
|
|
52
|
+
decimalDigits?: number | undefined;
|
|
53
|
+
locale?: string | undefined;
|
|
54
|
+
toCurrency?: string | CurrencyInfo | undefined;
|
|
55
|
+
}
|
|
56
|
+
type Translator = (key: string, paramsOrFallback?: Record<string, string | number> | string) => string;
|
|
57
|
+
type PriceFormatter = (cents: number, fromCurrencyOrOptions?: string | CurrencyInfo | FormatPriceOptions, options?: FormatPriceOptions) => string;
|
|
58
|
+
declare const DEFAULT_CURRENCY: CurrencyInfo;
|
|
59
|
+
declare function getTextDirection(locale: string): TextDirection;
|
|
60
|
+
declare function normalizeCurrencyInfo(currency: CurrencyInfoInput, fallback?: CurrencyInfo): CurrencyInfo;
|
|
61
|
+
declare function normalizeCurrencies(currencies: readonly CurrencyInfoInput[]): CurrencyInfo[];
|
|
62
|
+
declare function findCurrency(currencies: readonly CurrencyInfo[], currencyCode: string | undefined): CurrencyInfo | undefined;
|
|
63
|
+
declare function getBaseCurrency(currencies: readonly CurrencyInfo[]): CurrencyInfo;
|
|
64
|
+
declare function resolveCurrencyInfo(currency: string | CurrencyInfo | undefined, currencies: readonly CurrencyInfo[], fallback?: CurrencyInfo): CurrencyInfo;
|
|
65
|
+
declare function bankersRound(value: number, decimalDigits: number): number;
|
|
66
|
+
declare function toCents(displayAmount: number, decimalDigits: number): number;
|
|
67
|
+
declare function fromCents(cents: number, decimalDigits: number): number;
|
|
68
|
+
declare function convertCurrency(cents: number, fromCurrency: CurrencyInfo, toCurrency: CurrencyInfo, currenciesOrBaseCurrency: readonly CurrencyInfo[] | CurrencyInfo): number;
|
|
69
|
+
declare function formatCurrencyAmount(cents: number, currency: CurrencyInfo, locale: string, options?: FormatPriceOptions): string;
|
|
70
|
+
declare function formatPrice(cents: number, fromCurrency: string | CurrencyInfo, state: GlobalizationState, options?: FormatPriceOptions): string;
|
|
71
|
+
declare function getI18nText(field: I18nTextField, locale: string, fallbackLocale?: string): string;
|
|
72
|
+
declare function createTranslator(messages: TranslationMessages | undefined): Translator;
|
|
73
|
+
declare function createPriceFormatter(state: GlobalizationState, defaultFromCurrency?: string | CurrencyInfo): PriceFormatter;
|
|
74
|
+
declare function withGlobalizationHelpers(state: GlobalizationState, handlers?: Pick<GlobalizationState, 'changeLocale' | 'changeCurrency'>): GlobalizationState;
|
|
75
|
+
declare function buildGlobalizationUrl(url: string | URL, updates: {
|
|
76
|
+
locale?: string | null | undefined;
|
|
77
|
+
currency?: string | null | undefined;
|
|
78
|
+
}): string;
|
|
79
|
+
|
|
80
|
+
export { type CurrencyInfo, type CurrencyInfoInput, DEFAULT_CURRENCY, type FormatPriceOptions, type GlobalizationState, type I18nTextField, type LanguageInfo, type PriceFormatter, type TextDirection, type TranslationMessages, type Translator, bankersRound, buildGlobalizationUrl, convertCurrency, createPriceFormatter, createTranslator, findCurrency, formatCurrencyAmount, formatPrice, fromCents, getBaseCurrency, getI18nText, getTextDirection, normalizeCurrencies, normalizeCurrencyInfo, resolveCurrencyInfo, toCents, withGlobalizationHelpers };
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import {
|
|
2
|
+
DEFAULT_CURRENCY,
|
|
3
|
+
Decimal,
|
|
4
|
+
bankersRound,
|
|
5
|
+
buildGlobalizationUrl,
|
|
6
|
+
convertCurrency,
|
|
7
|
+
createPriceFormatter,
|
|
8
|
+
createTranslator,
|
|
9
|
+
findCurrency,
|
|
10
|
+
formatCurrencyAmount,
|
|
11
|
+
formatPrice,
|
|
12
|
+
fromCents,
|
|
13
|
+
getBaseCurrency,
|
|
14
|
+
getI18nText,
|
|
15
|
+
getTextDirection,
|
|
16
|
+
normalizeCurrencies,
|
|
17
|
+
normalizeCurrencyInfo,
|
|
18
|
+
resolveCurrencyInfo,
|
|
19
|
+
toCents,
|
|
20
|
+
withGlobalizationHelpers
|
|
21
|
+
} from "./chunk-46KUIGB6.js";
|
|
22
|
+
export {
|
|
23
|
+
DEFAULT_CURRENCY,
|
|
24
|
+
Decimal,
|
|
25
|
+
bankersRound,
|
|
26
|
+
buildGlobalizationUrl,
|
|
27
|
+
convertCurrency,
|
|
28
|
+
createPriceFormatter,
|
|
29
|
+
createTranslator,
|
|
30
|
+
findCurrency,
|
|
31
|
+
formatCurrencyAmount,
|
|
32
|
+
formatPrice,
|
|
33
|
+
fromCents,
|
|
34
|
+
getBaseCurrency,
|
|
35
|
+
getI18nText,
|
|
36
|
+
getTextDirection,
|
|
37
|
+
normalizeCurrencies,
|
|
38
|
+
normalizeCurrencyInfo,
|
|
39
|
+
resolveCurrencyInfo,
|
|
40
|
+
toCents,
|
|
41
|
+
withGlobalizationHelpers
|
|
42
|
+
};
|
|
43
|
+
//# sourceMappingURL=globalization.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|