@flipdish/events 1.25351.0 → 1.25352.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.
@@ -0,0 +1,10 @@
1
+ import currencyCodes from 'currency-codes';
2
+ import { z } from 'zod';
3
+ // Currency Code Schema to validate ISO 4217 currency codes
4
+ export const CurrencyCodeSchema = z
5
+ .string()
6
+ .trim()
7
+ .toUpperCase()
8
+ .pipe(z.string().refine((code) => Boolean(currencyCodes.code(code)), {
9
+ message: 'Invalid ISO 4217 currency code',
10
+ }));
@@ -0,0 +1,15 @@
1
+ import currencyCodes from 'currency-codes';
2
+ import { z } from 'zod';
3
+
4
+ // Currency Code Schema to validate ISO 4217 currency codes
5
+ export const CurrencyCodeSchema = z
6
+ .string()
7
+ .trim()
8
+ .toUpperCase()
9
+ .pipe(
10
+ z.string().refine((code) => Boolean(currencyCodes.code(code)), {
11
+ message: 'Invalid ISO 4217 currency code',
12
+ })
13
+ );
14
+
15
+ export type Currency = z.infer<typeof CurrencyCodeSchema>;
@@ -1,4 +1,5 @@
1
1
  import { z } from 'zod';
2
+ import { CurrencyCodeSchema } from './currency.js';
2
3
  import { OnlineOrderingCommonPropertiesSchema, OnlineOrderingMenusSource, } from './online.ordering.common.js';
3
4
  // Event types defined locally to avoid circular imports
4
5
  export const PreProcessEventTypes = {
@@ -220,6 +221,7 @@ export const OnlineOrderingMenuPreprocessSuccessV1PublicMenuSchema = z.object({
220
221
  legacyId: z.number(),
221
222
  name: z.string().nullable(),
222
223
  type: z.string(),
224
+ currency: CurrencyCodeSchema,
223
225
  categories: z.array(MenuCategoriesSchema).nullable(),
224
226
  categoryGroups: z.array(MenuCategoryGroupSchema).nullable(),
225
227
  taxType: TaxTypeSchema,
@@ -1,4 +1,5 @@
1
1
  import { z } from 'zod';
2
+ import { CurrencyCodeSchema } from './currency.js';
2
3
  import {
3
4
  OnlineOrderingCommonPropertiesSchema,
4
5
  OnlineOrderingMenusSource,
@@ -287,6 +288,7 @@ export const OnlineOrderingMenuPreprocessSuccessV1PublicMenuSchema = z.object({
287
288
  legacyId: z.number(),
288
289
  name: z.string().nullable(),
289
290
  type: z.string(),
291
+ currency: CurrencyCodeSchema,
290
292
  categories: z.array(MenuCategoriesSchema).nullable(),
291
293
  categoryGroups: z.array(MenuCategoryGroupSchema).nullable(),
292
294
  taxType: TaxTypeSchema,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@flipdish/events",
3
- "version": "1.25351.0",
3
+ "version": "1.25352.0",
4
4
  "type": "module",
5
5
  "scripts": {
6
6
  "test": "node --max-old-space-size=4096 --max-semi-space-size=512 ./node_modules/.bin/jest --config=jest.config.ts --verbose",
@@ -27,6 +27,7 @@
27
27
  "@jest/types": "^29.6.3",
28
28
  "@types/node": "^22.13.9",
29
29
  "aws-sdk": "^2.1692.0",
30
+ "currency-codes": "^2.2.0",
30
31
  "dotenv": "^16.3.1",
31
32
  "zod": "^3.24.2"
32
33
  },