@86d-store/multi-currency 0.1.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.
Files changed (94) hide show
  1. package/README.md +234 -0
  2. package/dist/admin/components/_shared.d.ts +28 -0
  3. package/dist/admin/components/_shared.d.ts.map +1 -0
  4. package/dist/admin/components/_shared.js +15 -0
  5. package/dist/admin/components/currency-detail.d.ts +6 -0
  6. package/dist/admin/components/currency-detail.d.ts.map +1 -0
  7. package/dist/admin/components/currency-detail.js +26 -0
  8. package/dist/admin/components/currency-form.d.ts +6 -0
  9. package/dist/admin/components/currency-form.d.ts.map +1 -0
  10. package/dist/admin/components/currency-form.js +95 -0
  11. package/dist/admin/components/currency-list.d.ts +2 -0
  12. package/dist/admin/components/currency-list.d.ts.map +1 -0
  13. package/dist/admin/components/currency-list.js +35 -0
  14. package/dist/admin/endpoints/bulk-update-rates.d.ts +15 -0
  15. package/dist/admin/endpoints/bulk-update-rates.d.ts.map +1 -0
  16. package/dist/admin/endpoints/bulk-update-rates.js +17 -0
  17. package/dist/admin/endpoints/create-currency.d.ts +34 -0
  18. package/dist/admin/endpoints/create-currency.d.ts.map +1 -0
  19. package/dist/admin/endpoints/create-currency.js +34 -0
  20. package/dist/admin/endpoints/delete-currency.d.ts +16 -0
  21. package/dist/admin/endpoints/delete-currency.d.ts.map +1 -0
  22. package/dist/admin/endpoints/delete-currency.js +17 -0
  23. package/dist/admin/endpoints/delete-price-override.d.ts +10 -0
  24. package/dist/admin/endpoints/delete-price-override.d.ts.map +1 -0
  25. package/dist/admin/endpoints/delete-price-override.js +11 -0
  26. package/dist/admin/endpoints/get-currency.d.ts +16 -0
  27. package/dist/admin/endpoints/get-currency.d.ts.map +1 -0
  28. package/dist/admin/endpoints/get-currency.js +14 -0
  29. package/dist/admin/endpoints/list-currencies.d.ts +6 -0
  30. package/dist/admin/endpoints/list-currencies.d.ts.map +1 -0
  31. package/dist/admin/endpoints/list-currencies.js +7 -0
  32. package/dist/admin/endpoints/list-price-overrides.d.ts +10 -0
  33. package/dist/admin/endpoints/list-price-overrides.d.ts.map +1 -0
  34. package/dist/admin/endpoints/list-price-overrides.js +11 -0
  35. package/dist/admin/endpoints/rate-history.d.ts +11 -0
  36. package/dist/admin/endpoints/rate-history.d.ts.map +1 -0
  37. package/dist/admin/endpoints/rate-history.js +17 -0
  38. package/dist/admin/endpoints/routes.d.ts +180 -0
  39. package/dist/admin/endpoints/routes.d.ts.map +1 -0
  40. package/dist/admin/endpoints/routes.js +26 -0
  41. package/dist/admin/endpoints/set-base-currency.d.ts +16 -0
  42. package/dist/admin/endpoints/set-base-currency.d.ts.map +1 -0
  43. package/dist/admin/endpoints/set-base-currency.js +14 -0
  44. package/dist/admin/endpoints/set-price-override.d.ts +13 -0
  45. package/dist/admin/endpoints/set-price-override.d.ts.map +1 -0
  46. package/dist/admin/endpoints/set-price-override.js +16 -0
  47. package/dist/admin/endpoints/update-currency.d.ts +35 -0
  48. package/dist/admin/endpoints/update-currency.d.ts.map +1 -0
  49. package/dist/admin/endpoints/update-currency.js +27 -0
  50. package/dist/admin/endpoints/update-rate.d.ts +18 -0
  51. package/dist/admin/endpoints/update-rate.d.ts.map +1 -0
  52. package/dist/admin/endpoints/update-rate.js +22 -0
  53. package/dist/capabilities.d.ts +56 -0
  54. package/dist/capabilities.d.ts.map +1 -0
  55. package/dist/capabilities.js +16 -0
  56. package/dist/index.d.ts +16 -0
  57. package/dist/index.d.ts.map +1 -0
  58. package/dist/index.js +69 -0
  59. package/dist/schema.d.ts +94 -0
  60. package/dist/schema.d.ts.map +1 -0
  61. package/dist/schema.js +50 -0
  62. package/dist/service-impl.d.ts +5 -0
  63. package/dist/service-impl.d.ts.map +1 -0
  64. package/dist/service-impl.js +369 -0
  65. package/dist/service.d.ts +139 -0
  66. package/dist/service.d.ts.map +1 -0
  67. package/dist/service.js +1 -0
  68. package/dist/store/components/_hooks.d.ts +6 -0
  69. package/dist/store/components/_hooks.d.ts.map +1 -0
  70. package/dist/store/components/_hooks.js +10 -0
  71. package/dist/store/components/currency-selector.d.ts +10 -0
  72. package/dist/store/components/currency-selector.d.ts.map +1 -0
  73. package/dist/store/components/currency-selector.js +22 -0
  74. package/dist/store/components/currency-selector.mdx +55 -0
  75. package/dist/store/components/mdx.d.ts +8 -0
  76. package/dist/store/components/mdx.d.ts.map +1 -0
  77. package/dist/store/components/mdx.js +7 -0
  78. package/dist/store/components/price-display.d.ts +14 -0
  79. package/dist/store/components/price-display.d.ts.map +1 -0
  80. package/dist/store/components/price-display.js +30 -0
  81. package/dist/store/components/price-display.mdx +12 -0
  82. package/dist/store/endpoints/convert-price.d.ts +22 -0
  83. package/dist/store/endpoints/convert-price.d.ts.map +1 -0
  84. package/dist/store/endpoints/convert-price.js +26 -0
  85. package/dist/store/endpoints/get-product-price.d.ts +22 -0
  86. package/dist/store/endpoints/get-product-price.d.ts.map +1 -0
  87. package/dist/store/endpoints/get-product-price.js +26 -0
  88. package/dist/store/endpoints/list-currencies.d.ts +6 -0
  89. package/dist/store/endpoints/list-currencies.d.ts.map +1 -0
  90. package/dist/store/endpoints/list-currencies.js +7 -0
  91. package/dist/store/endpoints/routes.d.ts +48 -0
  92. package/dist/store/endpoints/routes.d.ts.map +1 -0
  93. package/dist/store/endpoints/routes.js +8 -0
  94. package/package.json +108 -0
@@ -0,0 +1,10 @@
1
+ import { z } from "zod";
2
+ export declare const adminDeletePriceOverride: import("better-call").StrictEndpoint<"/admin/currencies/price-overrides/:id/delete", {
3
+ method: "POST";
4
+ params: z.ZodObject<{
5
+ id: z.ZodString;
6
+ }, z.core.$strip>;
7
+ }, {
8
+ success: boolean;
9
+ }>;
10
+ //# sourceMappingURL=delete-price-override.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"delete-price-override.d.ts","sourceRoot":"","sources":["../../../src/admin/endpoints/delete-price-override.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAGxB,eAAO,MAAM,wBAAwB;;;;;;;EAYpC,CAAC"}
@@ -0,0 +1,11 @@
1
+ import { createAdminEndpoint } from "@86d-store/core/api";
2
+ import { z } from "zod";
3
+ export const adminDeletePriceOverride = createAdminEndpoint("/admin/currencies/price-overrides/:id/delete", {
4
+ method: "POST",
5
+ params: z.object({ id: z.string() }),
6
+ }, async (ctx) => {
7
+ const controller = ctx.context.controllers
8
+ .multiCurrency;
9
+ await controller.deletePriceOverride(ctx.params.id);
10
+ return { success: true };
11
+ });
@@ -0,0 +1,16 @@
1
+ import { z } from "zod";
2
+ export declare const adminGetCurrency: import("better-call").StrictEndpoint<"/admin/currencies/:id", {
3
+ method: "GET";
4
+ params: z.ZodObject<{
5
+ id: z.ZodString;
6
+ }, z.core.$strip>;
7
+ }, {
8
+ error: string;
9
+ status: number;
10
+ currency?: never;
11
+ } | {
12
+ currency: import("../..").Currency;
13
+ error?: never;
14
+ status?: never;
15
+ }>;
16
+ //# sourceMappingURL=get-currency.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"get-currency.d.ts","sourceRoot":"","sources":["../../../src/admin/endpoints/get-currency.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAGxB,eAAO,MAAM,gBAAgB;;;;;;;;;;;;;EAe5B,CAAC"}
@@ -0,0 +1,14 @@
1
+ import { createAdminEndpoint } from "@86d-store/core/api";
2
+ import { z } from "zod";
3
+ export const adminGetCurrency = createAdminEndpoint("/admin/currencies/:id", {
4
+ method: "GET",
5
+ params: z.object({ id: z.string() }),
6
+ }, async (ctx) => {
7
+ const controller = ctx.context.controllers
8
+ .multiCurrency;
9
+ const currency = await controller.getById(ctx.params.id);
10
+ if (!currency) {
11
+ return { error: "Currency not found", status: 404 };
12
+ }
13
+ return { currency };
14
+ });
@@ -0,0 +1,6 @@
1
+ export declare const adminListCurrencies: import("better-call").StrictEndpoint<"/admin/currencies", {
2
+ method: "GET";
3
+ }, {
4
+ currencies: import("../..").Currency[];
5
+ }>;
6
+ //# sourceMappingURL=list-currencies.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"list-currencies.d.ts","sourceRoot":"","sources":["../../../src/admin/endpoints/list-currencies.ts"],"names":[],"mappings":"AAGA,eAAO,MAAM,mBAAmB;;;;EAS/B,CAAC"}
@@ -0,0 +1,7 @@
1
+ import { createAdminEndpoint } from "@86d-store/core/api";
2
+ export const adminListCurrencies = createAdminEndpoint("/admin/currencies", { method: "GET" }, async (ctx) => {
3
+ const controller = ctx.context.controllers
4
+ .multiCurrency;
5
+ const currencies = await controller.list();
6
+ return { currencies };
7
+ });
@@ -0,0 +1,10 @@
1
+ import { z } from "zod";
2
+ export declare const adminListPriceOverrides: import("better-call").StrictEndpoint<"/admin/currencies/price-overrides/:productId", {
3
+ method: "GET";
4
+ params: z.ZodObject<{
5
+ productId: z.ZodString;
6
+ }, z.core.$strip>;
7
+ }, {
8
+ overrides: import("../..").PriceOverride[];
9
+ }>;
10
+ //# sourceMappingURL=list-price-overrides.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"list-price-overrides.d.ts","sourceRoot":"","sources":["../../../src/admin/endpoints/list-price-overrides.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAGxB,eAAO,MAAM,uBAAuB;;;;;;;EAYnC,CAAC"}
@@ -0,0 +1,11 @@
1
+ import { createAdminEndpoint } from "@86d-store/core/api";
2
+ import { z } from "zod";
3
+ export const adminListPriceOverrides = createAdminEndpoint("/admin/currencies/price-overrides/:productId", {
4
+ method: "GET",
5
+ params: z.object({ productId: z.string() }),
6
+ }, async (ctx) => {
7
+ const controller = ctx.context.controllers
8
+ .multiCurrency;
9
+ const overrides = await controller.listPriceOverrides(ctx.params.productId);
10
+ return { overrides };
11
+ });
@@ -0,0 +1,11 @@
1
+ import { z } from "zod";
2
+ export declare const adminRateHistory: import("better-call").StrictEndpoint<"/admin/currencies/rate-history", {
3
+ method: "POST";
4
+ body: z.ZodObject<{
5
+ currencyCode: z.ZodString;
6
+ limit: z.ZodOptional<z.ZodNumber>;
7
+ }, z.core.$strip>;
8
+ }, {
9
+ history: import("../..").ExchangeRateHistory[];
10
+ }>;
11
+ //# sourceMappingURL=rate-history.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"rate-history.d.ts","sourceRoot":"","sources":["../../../src/admin/endpoints/rate-history.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAGxB,eAAO,MAAM,gBAAgB;;;;;;;;EAkB5B,CAAC"}
@@ -0,0 +1,17 @@
1
+ import { createAdminEndpoint } from "@86d-store/core/api";
2
+ import { z } from "zod";
3
+ export const adminRateHistory = createAdminEndpoint("/admin/currencies/rate-history", {
4
+ method: "POST",
5
+ body: z.object({
6
+ currencyCode: z.string().min(3).max(3),
7
+ limit: z.number().int().positive().max(200).optional(),
8
+ }),
9
+ }, async (ctx) => {
10
+ const controller = ctx.context.controllers
11
+ .multiCurrency;
12
+ const history = await controller.getRateHistory({
13
+ currencyCode: ctx.body.currencyCode,
14
+ ...(ctx.body.limit ? { limit: ctx.body.limit } : {}),
15
+ });
16
+ return { history };
17
+ });
@@ -0,0 +1,180 @@
1
+ export declare const adminEndpoints: {
2
+ "/admin/currencies": import("better-call").StrictEndpoint<"/admin/currencies", {
3
+ method: "GET";
4
+ }, {
5
+ currencies: import("../..").Currency[];
6
+ }>;
7
+ "/admin/currencies/create": import("better-call").StrictEndpoint<"/admin/currencies/create", {
8
+ method: "POST";
9
+ body: import("zod").ZodObject<{
10
+ code: import("zod").ZodPipe<import("zod").ZodString, import("zod").ZodTransform<string, string>>;
11
+ name: import("zod").ZodPipe<import("zod").ZodString, import("zod").ZodTransform<string, string>>;
12
+ symbol: import("zod").ZodString;
13
+ decimalPlaces: import("zod").ZodOptional<import("zod").ZodNumber>;
14
+ exchangeRate: import("zod").ZodOptional<import("zod").ZodNumber>;
15
+ isBase: import("zod").ZodOptional<import("zod").ZodBoolean>;
16
+ isActive: import("zod").ZodOptional<import("zod").ZodBoolean>;
17
+ symbolPosition: import("zod").ZodOptional<import("zod").ZodEnum<{
18
+ before: "before";
19
+ after: "after";
20
+ }>>;
21
+ thousandsSeparator: import("zod").ZodOptional<import("zod").ZodString>;
22
+ decimalSeparator: import("zod").ZodOptional<import("zod").ZodString>;
23
+ roundingMode: import("zod").ZodOptional<import("zod").ZodEnum<{
24
+ round: "round";
25
+ ceil: "ceil";
26
+ floor: "floor";
27
+ }>>;
28
+ sortOrder: import("zod").ZodOptional<import("zod").ZodNumber>;
29
+ }, import("zod/v4/core").$strip>;
30
+ }, {
31
+ error: string;
32
+ status: number;
33
+ currency?: never;
34
+ } | {
35
+ currency: import("../..").Currency;
36
+ error?: never;
37
+ status?: never;
38
+ }>;
39
+ "/admin/currencies/update-rate": import("better-call").StrictEndpoint<"/admin/currencies/update-rate", {
40
+ method: "POST";
41
+ body: import("zod").ZodObject<{
42
+ currencyCode: import("zod").ZodString;
43
+ rate: import("zod").ZodNumber;
44
+ source: import("zod").ZodOptional<import("zod").ZodString>;
45
+ }, import("zod/v4/core").$strip>;
46
+ }, {
47
+ error: string;
48
+ status: number;
49
+ currency?: never;
50
+ } | {
51
+ currency: import("../..").Currency;
52
+ error?: never;
53
+ status?: never;
54
+ }>;
55
+ "/admin/currencies/bulk-update-rates": import("better-call").StrictEndpoint<"/admin/currencies/bulk-update-rates", {
56
+ method: "POST";
57
+ body: import("zod").ZodObject<{
58
+ rates: import("zod").ZodArray<import("zod").ZodObject<{
59
+ currencyCode: import("zod").ZodString;
60
+ rate: import("zod").ZodNumber;
61
+ source: import("zod").ZodOptional<import("zod").ZodString>;
62
+ }, import("zod/v4/core").$strip>>;
63
+ }, import("zod/v4/core").$strip>;
64
+ }, {
65
+ updated: number;
66
+ errors: string[];
67
+ }>;
68
+ "/admin/currencies/rate-history": import("better-call").StrictEndpoint<"/admin/currencies/rate-history", {
69
+ method: "POST";
70
+ body: import("zod").ZodObject<{
71
+ currencyCode: import("zod").ZodString;
72
+ limit: import("zod").ZodOptional<import("zod").ZodNumber>;
73
+ }, import("zod/v4/core").$strip>;
74
+ }, {
75
+ history: import("../..").ExchangeRateHistory[];
76
+ }>;
77
+ "/admin/currencies/price-override": import("better-call").StrictEndpoint<"/admin/currencies/price-override", {
78
+ method: "POST";
79
+ body: import("zod").ZodObject<{
80
+ productId: import("zod").ZodString;
81
+ currencyCode: import("zod").ZodString;
82
+ price: import("zod").ZodNumber;
83
+ compareAtPrice: import("zod").ZodOptional<import("zod").ZodNumber>;
84
+ }, import("zod/v4/core").$strip>;
85
+ }, {
86
+ override: import("../..").PriceOverride;
87
+ }>;
88
+ "/admin/currencies/price-overrides/:productId": import("better-call").StrictEndpoint<"/admin/currencies/price-overrides/:productId", {
89
+ method: "GET";
90
+ params: import("zod").ZodObject<{
91
+ productId: import("zod").ZodString;
92
+ }, import("zod/v4/core").$strip>;
93
+ }, {
94
+ overrides: import("../..").PriceOverride[];
95
+ }>;
96
+ "/admin/currencies/price-overrides/:id/delete": import("better-call").StrictEndpoint<"/admin/currencies/price-overrides/:id/delete", {
97
+ method: "POST";
98
+ params: import("zod").ZodObject<{
99
+ id: import("zod").ZodString;
100
+ }, import("zod/v4/core").$strip>;
101
+ }, {
102
+ success: boolean;
103
+ }>;
104
+ "/admin/currencies/:id": import("better-call").StrictEndpoint<"/admin/currencies/:id", {
105
+ method: "GET";
106
+ params: import("zod").ZodObject<{
107
+ id: import("zod").ZodString;
108
+ }, import("zod/v4/core").$strip>;
109
+ }, {
110
+ error: string;
111
+ status: number;
112
+ currency?: never;
113
+ } | {
114
+ currency: import("../..").Currency;
115
+ error?: never;
116
+ status?: never;
117
+ }>;
118
+ "/admin/currencies/:id/update": import("better-call").StrictEndpoint<"/admin/currencies/:id/update", {
119
+ method: "POST";
120
+ params: import("zod").ZodObject<{
121
+ id: import("zod").ZodString;
122
+ }, import("zod/v4/core").$strip>;
123
+ body: import("zod").ZodObject<{
124
+ name: import("zod").ZodOptional<import("zod").ZodPipe<import("zod").ZodString, import("zod").ZodTransform<string, string>>>;
125
+ symbol: import("zod").ZodOptional<import("zod").ZodString>;
126
+ decimalPlaces: import("zod").ZodOptional<import("zod").ZodNumber>;
127
+ exchangeRate: import("zod").ZodOptional<import("zod").ZodNumber>;
128
+ isActive: import("zod").ZodOptional<import("zod").ZodBoolean>;
129
+ symbolPosition: import("zod").ZodOptional<import("zod").ZodEnum<{
130
+ before: "before";
131
+ after: "after";
132
+ }>>;
133
+ thousandsSeparator: import("zod").ZodOptional<import("zod").ZodString>;
134
+ decimalSeparator: import("zod").ZodOptional<import("zod").ZodString>;
135
+ roundingMode: import("zod").ZodOptional<import("zod").ZodEnum<{
136
+ round: "round";
137
+ ceil: "ceil";
138
+ floor: "floor";
139
+ }>>;
140
+ sortOrder: import("zod").ZodOptional<import("zod").ZodNumber>;
141
+ }, import("zod/v4/core").$strip>;
142
+ }, {
143
+ error: string;
144
+ status: number;
145
+ currency?: never;
146
+ } | {
147
+ currency: import("../..").Currency;
148
+ error?: never;
149
+ status?: never;
150
+ }>;
151
+ "/admin/currencies/:id/delete": import("better-call").StrictEndpoint<"/admin/currencies/:id/delete", {
152
+ method: "POST";
153
+ params: import("zod").ZodObject<{
154
+ id: import("zod").ZodString;
155
+ }, import("zod/v4/core").$strip>;
156
+ }, {
157
+ error: string;
158
+ status: number;
159
+ success?: never;
160
+ } | {
161
+ success: boolean;
162
+ error?: never;
163
+ status?: never;
164
+ }>;
165
+ "/admin/currencies/:id/set-base": import("better-call").StrictEndpoint<"/admin/currencies/:id/set-base", {
166
+ method: "POST";
167
+ params: import("zod").ZodObject<{
168
+ id: import("zod").ZodString;
169
+ }, import("zod/v4/core").$strip>;
170
+ }, {
171
+ error: string;
172
+ status: number;
173
+ currency?: never;
174
+ } | {
175
+ currency: import("../..").Currency;
176
+ error?: never;
177
+ status?: never;
178
+ }>;
179
+ };
180
+ //# sourceMappingURL=routes.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"routes.d.ts","sourceRoot":"","sources":["../../../src/admin/endpoints/routes.ts"],"names":[],"mappings":"AAaA,eAAO,MAAM,cAAc;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAa1B,CAAC"}
@@ -0,0 +1,26 @@
1
+ import { adminBulkUpdateRates } from "./bulk-update-rates";
2
+ import { adminCreateCurrency } from "./create-currency";
3
+ import { adminDeleteCurrency } from "./delete-currency";
4
+ import { adminDeletePriceOverride } from "./delete-price-override";
5
+ import { adminGetCurrency } from "./get-currency";
6
+ import { adminListCurrencies } from "./list-currencies";
7
+ import { adminListPriceOverrides } from "./list-price-overrides";
8
+ import { adminRateHistory } from "./rate-history";
9
+ import { adminSetBaseCurrency } from "./set-base-currency";
10
+ import { adminSetPriceOverride } from "./set-price-override";
11
+ import { adminUpdateCurrency } from "./update-currency";
12
+ import { adminUpdateRate } from "./update-rate";
13
+ export const adminEndpoints = {
14
+ "/admin/currencies": adminListCurrencies,
15
+ "/admin/currencies/create": adminCreateCurrency,
16
+ "/admin/currencies/update-rate": adminUpdateRate,
17
+ "/admin/currencies/bulk-update-rates": adminBulkUpdateRates,
18
+ "/admin/currencies/rate-history": adminRateHistory,
19
+ "/admin/currencies/price-override": adminSetPriceOverride,
20
+ "/admin/currencies/price-overrides/:productId": adminListPriceOverrides,
21
+ "/admin/currencies/price-overrides/:id/delete": adminDeletePriceOverride,
22
+ "/admin/currencies/:id": adminGetCurrency,
23
+ "/admin/currencies/:id/update": adminUpdateCurrency,
24
+ "/admin/currencies/:id/delete": adminDeleteCurrency,
25
+ "/admin/currencies/:id/set-base": adminSetBaseCurrency,
26
+ };
@@ -0,0 +1,16 @@
1
+ import { z } from "zod";
2
+ export declare const adminSetBaseCurrency: import("better-call").StrictEndpoint<"/admin/currencies/:id/set-base", {
3
+ method: "POST";
4
+ params: z.ZodObject<{
5
+ id: z.ZodString;
6
+ }, z.core.$strip>;
7
+ }, {
8
+ error: string;
9
+ status: number;
10
+ currency?: never;
11
+ } | {
12
+ currency: import("../..").Currency;
13
+ error?: never;
14
+ status?: never;
15
+ }>;
16
+ //# sourceMappingURL=set-base-currency.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"set-base-currency.d.ts","sourceRoot":"","sources":["../../../src/admin/endpoints/set-base-currency.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAGxB,eAAO,MAAM,oBAAoB;;;;;;;;;;;;;EAehC,CAAC"}
@@ -0,0 +1,14 @@
1
+ import { createAdminEndpoint } from "@86d-store/core/api";
2
+ import { z } from "zod";
3
+ export const adminSetBaseCurrency = createAdminEndpoint("/admin/currencies/:id/set-base", {
4
+ method: "POST",
5
+ params: z.object({ id: z.string() }),
6
+ }, async (ctx) => {
7
+ const controller = ctx.context.controllers
8
+ .multiCurrency;
9
+ const currency = await controller.setBaseCurrency(ctx.params.id);
10
+ if (!currency) {
11
+ return { error: "Currency not found", status: 404 };
12
+ }
13
+ return { currency };
14
+ });
@@ -0,0 +1,13 @@
1
+ import { z } from "zod";
2
+ export declare const adminSetPriceOverride: import("better-call").StrictEndpoint<"/admin/currencies/price-override", {
3
+ method: "POST";
4
+ body: z.ZodObject<{
5
+ productId: z.ZodString;
6
+ currencyCode: z.ZodString;
7
+ price: z.ZodNumber;
8
+ compareAtPrice: z.ZodOptional<z.ZodNumber>;
9
+ }, z.core.$strip>;
10
+ }, {
11
+ override: import("../..").PriceOverride;
12
+ }>;
13
+ //# sourceMappingURL=set-price-override.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"set-price-override.d.ts","sourceRoot":"","sources":["../../../src/admin/endpoints/set-price-override.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAGxB,eAAO,MAAM,qBAAqB;;;;;;;;;;EAiBjC,CAAC"}
@@ -0,0 +1,16 @@
1
+ import { createAdminEndpoint } from "@86d-store/core/api";
2
+ import { z } from "zod";
3
+ export const adminSetPriceOverride = createAdminEndpoint("/admin/currencies/price-override", {
4
+ method: "POST",
5
+ body: z.object({
6
+ productId: z.string().min(1),
7
+ currencyCode: z.string().min(3).max(3),
8
+ price: z.number().int().nonnegative(),
9
+ compareAtPrice: z.number().int().nonnegative().optional(),
10
+ }),
11
+ }, async (ctx) => {
12
+ const controller = ctx.context.controllers
13
+ .multiCurrency;
14
+ const override = await controller.setPriceOverride(ctx.body);
15
+ return { override };
16
+ });
@@ -0,0 +1,35 @@
1
+ import { z } from "zod";
2
+ export declare const adminUpdateCurrency: import("better-call").StrictEndpoint<"/admin/currencies/:id/update", {
3
+ method: "POST";
4
+ params: z.ZodObject<{
5
+ id: z.ZodString;
6
+ }, z.core.$strip>;
7
+ body: z.ZodObject<{
8
+ name: z.ZodOptional<z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>>;
9
+ symbol: z.ZodOptional<z.ZodString>;
10
+ decimalPlaces: z.ZodOptional<z.ZodNumber>;
11
+ exchangeRate: z.ZodOptional<z.ZodNumber>;
12
+ isActive: z.ZodOptional<z.ZodBoolean>;
13
+ symbolPosition: z.ZodOptional<z.ZodEnum<{
14
+ before: "before";
15
+ after: "after";
16
+ }>>;
17
+ thousandsSeparator: z.ZodOptional<z.ZodString>;
18
+ decimalSeparator: z.ZodOptional<z.ZodString>;
19
+ roundingMode: z.ZodOptional<z.ZodEnum<{
20
+ round: "round";
21
+ ceil: "ceil";
22
+ floor: "floor";
23
+ }>>;
24
+ sortOrder: z.ZodOptional<z.ZodNumber>;
25
+ }, z.core.$strip>;
26
+ }, {
27
+ error: string;
28
+ status: number;
29
+ currency?: never;
30
+ } | {
31
+ currency: import("../..").Currency;
32
+ error?: never;
33
+ status?: never;
34
+ }>;
35
+ //# sourceMappingURL=update-currency.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"update-currency.d.ts","sourceRoot":"","sources":["../../../src/admin/endpoints/update-currency.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAGxB,eAAO,MAAM,mBAAmB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA2B/B,CAAC"}
@@ -0,0 +1,27 @@
1
+ import { createAdminEndpoint } from "@86d-store/core/api";
2
+ import { sanitizeText } from "@86d-store/core/sanitize";
3
+ import { z } from "zod";
4
+ export const adminUpdateCurrency = createAdminEndpoint("/admin/currencies/:id/update", {
5
+ method: "POST",
6
+ params: z.object({ id: z.string() }),
7
+ body: z.object({
8
+ name: z.string().min(1).max(100).transform(sanitizeText).optional(),
9
+ symbol: z.string().min(1).max(10).optional(),
10
+ decimalPlaces: z.number().int().min(0).max(8).optional(),
11
+ exchangeRate: z.number().positive().optional(),
12
+ isActive: z.boolean().optional(),
13
+ symbolPosition: z.enum(["before", "after"]).optional(),
14
+ thousandsSeparator: z.string().max(5).optional(),
15
+ decimalSeparator: z.string().max(5).optional(),
16
+ roundingMode: z.enum(["round", "ceil", "floor"]).optional(),
17
+ sortOrder: z.number().int().optional(),
18
+ }),
19
+ }, async (ctx) => {
20
+ const controller = ctx.context.controllers
21
+ .multiCurrency;
22
+ const currency = await controller.update(ctx.params.id, ctx.body);
23
+ if (!currency) {
24
+ return { error: "Currency not found", status: 404 };
25
+ }
26
+ return { currency };
27
+ });
@@ -0,0 +1,18 @@
1
+ import { z } from "zod";
2
+ export declare const adminUpdateRate: import("better-call").StrictEndpoint<"/admin/currencies/update-rate", {
3
+ method: "POST";
4
+ body: z.ZodObject<{
5
+ currencyCode: z.ZodString;
6
+ rate: z.ZodNumber;
7
+ source: z.ZodOptional<z.ZodString>;
8
+ }, z.core.$strip>;
9
+ }, {
10
+ error: string;
11
+ status: number;
12
+ currency?: never;
13
+ } | {
14
+ currency: import("../..").Currency;
15
+ error?: never;
16
+ status?: never;
17
+ }>;
18
+ //# sourceMappingURL=update-rate.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"update-rate.d.ts","sourceRoot":"","sources":["../../../src/admin/endpoints/update-rate.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAGxB,eAAO,MAAM,eAAe;;;;;;;;;;;;;;;EAuB3B,CAAC"}
@@ -0,0 +1,22 @@
1
+ import { createAdminEndpoint } from "@86d-store/core/api";
2
+ import { z } from "zod";
3
+ export const adminUpdateRate = createAdminEndpoint("/admin/currencies/update-rate", {
4
+ method: "POST",
5
+ body: z.object({
6
+ currencyCode: z.string().min(3).max(3),
7
+ rate: z.number().positive(),
8
+ source: z.string().max(100).optional(),
9
+ }),
10
+ }, async (ctx) => {
11
+ const controller = ctx.context.controllers
12
+ .multiCurrency;
13
+ const currency = await controller.updateRate({
14
+ currencyCode: ctx.body.currencyCode,
15
+ rate: ctx.body.rate,
16
+ ...(ctx.body.source ? { source: ctx.body.source } : {}),
17
+ });
18
+ if (!currency) {
19
+ return { error: "Currency not found", status: 404 };
20
+ }
21
+ return { currency };
22
+ });
@@ -0,0 +1,56 @@
1
+ import { productPriceConversionCapability } from "@86d-store/core/commerce-capabilities";
2
+ import type { z } from "zod";
3
+ import type { MultiCurrencyController } from "./service";
4
+ type ProductPriceConversionRequest = z.infer<typeof productPriceConversionCapability.request>;
5
+ export declare function handleProductPriceConversion(controller: MultiCurrencyController, request: ProductPriceConversionRequest): Promise<{
6
+ ok: true;
7
+ decision: {
8
+ amount: number;
9
+ };
10
+ failure?: never;
11
+ } | {
12
+ ok: false;
13
+ failure: {
14
+ code: "CURRENCY_UNAVAILABLE";
15
+ message: string;
16
+ };
17
+ decision?: never;
18
+ }>;
19
+ export declare const productPriceConversionProvider: Readonly<{
20
+ definition: Readonly<{
21
+ name: "multi-currency.product-price";
22
+ version: "1.0.0";
23
+ owner: "multi-currency";
24
+ request: z.ZodObject<{
25
+ productId: z.ZodString;
26
+ basePriceInCents: z.ZodNumber;
27
+ currencyCode: z.ZodString;
28
+ }, z.core.$strict>;
29
+ decision: z.ZodObject<{
30
+ amount: z.ZodNumber;
31
+ }, z.core.$strict>;
32
+ failure: z.ZodObject<{
33
+ code: z.ZodLiteral<"CURRENCY_UNAVAILABLE">;
34
+ message: z.ZodString;
35
+ }, z.core.$strict>;
36
+ }>;
37
+ handle: import("@86d-store/core/capabilities").CapabilityHandler<Readonly<{
38
+ name: "multi-currency.product-price";
39
+ version: "1.0.0";
40
+ owner: "multi-currency";
41
+ request: z.ZodObject<{
42
+ productId: z.ZodString;
43
+ basePriceInCents: z.ZodNumber;
44
+ currencyCode: z.ZodString;
45
+ }, z.core.$strict>;
46
+ decision: z.ZodObject<{
47
+ amount: z.ZodNumber;
48
+ }, z.core.$strict>;
49
+ failure: z.ZodObject<{
50
+ code: z.ZodLiteral<"CURRENCY_UNAVAILABLE">;
51
+ message: z.ZodString;
52
+ }, z.core.$strict>;
53
+ }>>;
54
+ }>;
55
+ export {};
56
+ //# sourceMappingURL=capabilities.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"capabilities.d.ts","sourceRoot":"","sources":["../src/capabilities.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,gCAAgC,EAAE,MAAM,uCAAuC,CAAC;AACzF,OAAO,KAAK,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAC7B,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,WAAW,CAAC;AAGzD,KAAK,6BAA6B,GAAG,CAAC,CAAC,KAAK,CAC3C,OAAO,gCAAgC,CAAC,OAAO,CAC/C,CAAC;AAEF,wBAAsB,4BAA4B,CACjD,UAAU,EAAE,uBAAuB,EACnC,OAAO,EAAE,6BAA6B;;;;;;;;;;;;;GAYtC;AAED,eAAO,MAAM,8BAA8B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAO1C,CAAC"}
@@ -0,0 +1,16 @@
1
+ import { provideCapability } from "@86d-store/core/capabilities";
2
+ import { productPriceConversionCapability } from "@86d-store/core/commerce-capabilities";
3
+ import { createMultiCurrencyController } from "./service-impl";
4
+ export async function handleProductPriceConversion(controller, request) {
5
+ const result = await controller.getProductPrice(request);
6
+ return result
7
+ ? { ok: true, decision: { amount: result.amount } }
8
+ : {
9
+ ok: false,
10
+ failure: {
11
+ code: "CURRENCY_UNAVAILABLE",
12
+ message: "Authoritative currency conversion is unavailable.",
13
+ },
14
+ };
15
+ }
16
+ export const productPriceConversionProvider = provideCapability(productPriceConversionCapability, async (ctx, request) => handleProductPriceConversion(createMultiCurrencyController(ctx.data, ctx.events), request));
@@ -0,0 +1,16 @@
1
+ import type { Module, ModuleConfig } from "@86d-store/core/types/module";
2
+ export type { ConvertedPrice, Currency, ExchangeRateHistory, MultiCurrencyController, PriceOverride, RoundingMode, SymbolPosition, } from "./service";
3
+ export interface MultiCurrencyOptions extends ModuleConfig {
4
+ /**
5
+ * Default base currency code (ISO 4217).
6
+ * @default "USD"
7
+ */
8
+ baseCurrency?: string;
9
+ }
10
+ /**
11
+ * Multi-currency module factory.
12
+ * Provides currency management, exchange rate tracking, price conversion,
13
+ * and per-product price overrides for international commerce.
14
+ */
15
+ export default function multiCurrency(options?: MultiCurrencyOptions): Module;
16
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACX,MAAM,EACN,YAAY,EAEZ,MAAM,8BAA8B,CAAC;AAOtC,YAAY,EACX,cAAc,EACd,QAAQ,EACR,mBAAmB,EACnB,uBAAuB,EACvB,aAAa,EACb,YAAY,EACZ,cAAc,GACd,MAAM,WAAW,CAAC;AAEnB,MAAM,WAAW,oBAAqB,SAAQ,YAAY;IACzD;;;OAGG;IACH,YAAY,CAAC,EAAE,MAAM,CAAC;CACtB;AAED;;;;GAIG;AACH,MAAM,CAAC,OAAO,UAAU,aAAa,CAAC,OAAO,CAAC,EAAE,oBAAoB,GAAG,MAAM,CA8D5E"}