@flipdish/events 1.80.4 → 1.25346.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.
@@ -1,5 +1,5 @@
1
- import { z } from 'zod';
2
1
  import { extendZodWithOpenApi } from '@asteasolutions/zod-to-openapi';
2
+ import { z } from 'zod';
3
3
  extendZodWithOpenApi(z);
4
4
  export const ExternalPayloadSchemaV1 = z
5
5
  .object({
@@ -1,5 +1,5 @@
1
- import { z } from 'zod';
2
1
  import { extendZodWithOpenApi } from '@asteasolutions/zod-to-openapi';
2
+ import { z } from 'zod';
3
3
 
4
4
  extendZodWithOpenApi(z);
5
5
 
package/package.json CHANGED
@@ -1,59 +1,59 @@
1
1
  {
2
- "name": "@flipdish/events",
3
- "version": "1.80.4",
4
- "type": "module",
5
- "scripts": {
6
- "test": "node --max-old-space-size=4096 --max-semi-space-size=512 ./node_modules/.bin/jest --config=jest.config.ts --verbose",
7
- "test:watch": "node --max-old-space-size=4096 --max-semi-space-size=512 ./node_modules/.bin/jest --config=jest.config.ts --verbose --watch",
8
- "typecheck": "node --max-old-space-size=4096 ./node_modules/.bin/tsc --noEmit",
9
- "build": "node --max-old-space-size=4096 ./node_modules/.bin/tsc",
10
- "format": "biome format --write .",
11
- "lint": "biome lint --write .",
12
- "check": "biome check --write .",
13
- "cursor:init": ".husky/cursor-rules-init.sh",
14
- "prepare": "husky && node --max-old-space-size=4096 ./scripts/generate-slack-zod-schemas.mjs && npm run cursor:init",
15
- "lint-staged": "lint-staged",
16
- "adr:new": "adr new",
17
- "adr:list": "adr list",
18
- "openapi:from-zod": "node --max-old-space-size=4096 ./node_modules/.bin/tsx scripts/generate-openapi-from-zod.ts",
19
- "links:check": "linkinator webhooks/README.md --retry --skip 'mailto:,^#,https://docs.readme.com/.*/(preview|edit)' --accept 200-399",
20
- "ci:memory-optimize": "node scripts/memory-optimize-ci.js",
21
- "ci:test": "npm run ci:memory-optimize && npm test",
22
- "ci:build": "npm run ci:memory-optimize && npm run build"
23
- },
24
- "dependencies": {
25
- "@asteasolutions/zod-to-openapi": "^7.3.0",
26
- "@aws-sdk/client-cloudwatch-logs": "^3.400.0",
27
- "@jest/types": "^29.6.3",
28
- "@types/node": "^22.13.9",
29
- "aws-sdk": "^2.1692.0",
30
- "dotenv": "^16.3.1",
31
- "zod": "^3.24.2"
32
- },
33
- "engines": {
34
- "node": ">=22.0.0"
35
- },
36
- "author": "Flipdish",
37
- "license": "MIT",
38
- "devDependencies": {
39
- "@biomejs/biome": "^1.9.4",
40
- "@jest/globals": "^29.7.0",
41
- "@slack/types": "^2.14.0",
42
- "adr": "^1.5.2",
43
- "husky": "^9.1.7",
44
- "jest": "^29.7.0",
45
- "linkinator": "^6.1.4",
46
- "lint-staged": "^15.4.3",
47
- "semver": "^7.5.4",
48
- "ts-jest": "^29.2.6",
49
- "ts-node": "^10.9.2",
50
- "ts-to-zod": "^3.15.0",
51
- "tsx": "^4.20.3",
52
- "typescript": "^5.8.2"
53
- },
54
- "lint-staged": {
55
- "*.{js,jsx,ts,tsx}": [
56
- "biome check --write"
57
- ]
58
- }
2
+ "name": "@flipdish/events",
3
+ "version": "1.25346.0",
4
+ "type": "module",
5
+ "scripts": {
6
+ "test": "node --max-old-space-size=4096 --max-semi-space-size=512 ./node_modules/.bin/jest --config=jest.config.ts --verbose",
7
+ "test:watch": "node --max-old-space-size=4096 --max-semi-space-size=512 ./node_modules/.bin/jest --config=jest.config.ts --verbose --watch",
8
+ "typecheck": "node --max-old-space-size=4096 ./node_modules/.bin/tsc --noEmit",
9
+ "build": "node --max-old-space-size=4096 ./node_modules/.bin/tsc",
10
+ "format": "biome format --write .",
11
+ "lint": "biome lint --write .",
12
+ "check": "biome check --write .",
13
+ "cursor:init": ".husky/cursor-rules-init.sh",
14
+ "prepare": "husky && node --max-old-space-size=4096 ./scripts/generate-slack-zod-schemas.mjs && npm run cursor:init",
15
+ "lint-staged": "lint-staged",
16
+ "adr:new": "adr new",
17
+ "adr:list": "adr list",
18
+ "openapi:from-zod": "node --max-old-space-size=4096 ./node_modules/.bin/tsx scripts/generate-openapi-from-zod.ts",
19
+ "links:check": "linkinator webhooks/README.md --retry --skip 'mailto:,^#,https://docs.readme.com/.*/(preview|edit)' --accept 200-399",
20
+ "ci:memory-optimize": "node scripts/memory-optimize-ci.js",
21
+ "ci:test": "npm run ci:memory-optimize && npm test",
22
+ "ci:build": "npm run ci:memory-optimize && npm run build"
23
+ },
24
+ "dependencies": {
25
+ "@asteasolutions/zod-to-openapi": "^7.3.0",
26
+ "@aws-sdk/client-cloudwatch-logs": "^3.400.0",
27
+ "@jest/types": "^29.6.3",
28
+ "@types/node": "^22.13.9",
29
+ "aws-sdk": "^2.1692.0",
30
+ "dotenv": "^16.3.1",
31
+ "zod": "^3.24.2"
32
+ },
33
+ "engines": {
34
+ "node": ">=22.0.0"
35
+ },
36
+ "author": "Flipdish",
37
+ "license": "MIT",
38
+ "devDependencies": {
39
+ "@biomejs/biome": "^1.9.4",
40
+ "@jest/globals": "^29.7.0",
41
+ "@slack/types": "^2.14.0",
42
+ "adr": "^1.5.2",
43
+ "husky": "^9.1.7",
44
+ "jest": "^29.7.0",
45
+ "linkinator": "^6.1.4",
46
+ "lint-staged": "^15.4.3",
47
+ "semver": "^7.5.4",
48
+ "ts-jest": "^29.2.6",
49
+ "ts-node": "^10.9.2",
50
+ "ts-to-zod": "^3.15.0",
51
+ "tsx": "^4.20.3",
52
+ "typescript": "^5.8.2"
53
+ },
54
+ "lint-staged": {
55
+ "*.{js,jsx,ts,tsx}": [
56
+ "biome check --write"
57
+ ]
58
+ }
59
59
  }
@@ -0,0 +1,13 @@
1
+ export var SaleStatus;
2
+ (function (SaleStatus) {
3
+ SaleStatus["SALE_PREPARED_BY_KITCHEN"] = "SALE_PREPARED_BY_KITCHEN";
4
+ SaleStatus["SALE_PICKUP_TIME_CHANGED"] = "SALE_PICKUP_TIME_CHANGED";
5
+ SaleStatus["SALE_DELIVERY_TIME_CHANGED"] = "SALE_DELIVERY_TIME_CHANGED";
6
+ SaleStatus["SALE_CANCELLED"] = "SALE_CANCELLED";
7
+ })(SaleStatus || (SaleStatus = {}));
8
+ export var DeliveryStatus;
9
+ (function (DeliveryStatus) {
10
+ DeliveryStatus["SALE_DISPATCHED"] = "SALE_DISPATCHED";
11
+ DeliveryStatus["SALE_ON_THE_WAY"] = "SALE_ON_THE_WAY";
12
+ DeliveryStatus["SALE_DELIVERED"] = "SALE_DELIVERED";
13
+ })(DeliveryStatus || (DeliveryStatus = {}));
@@ -0,0 +1,12 @@
1
+ export enum SaleStatus {
2
+ SALE_PREPARED_BY_KITCHEN = 'SALE_PREPARED_BY_KITCHEN',
3
+ SALE_PICKUP_TIME_CHANGED = 'SALE_PICKUP_TIME_CHANGED',
4
+ SALE_DELIVERY_TIME_CHANGED = 'SALE_DELIVERY_TIME_CHANGED',
5
+ SALE_CANCELLED = 'SALE_CANCELLED',
6
+ }
7
+
8
+ export enum DeliveryStatus {
9
+ SALE_DISPATCHED = 'SALE_DISPATCHED',
10
+ SALE_ON_THE_WAY = 'SALE_ON_THE_WAY',
11
+ SALE_DELIVERED = 'SALE_DELIVERED',
12
+ }
@@ -0,0 +1,17 @@
1
+ import { extendZodWithOpenApi } from '@asteasolutions/zod-to-openapi';
2
+ import { z } from 'zod';
3
+ import { eventType as SALE_DELIVERY_STATUS_UPDATED_V1, SaleDeliveryStatusUpdatedV1Schema, } from './sales.delivery.status.updated.v1.js';
4
+ import { eventType as SALE_STATUS_UPDATED_V1, SaleStatusUpdatedV1Schema, } from './sales.status.updated.v1.js';
5
+ // This must be called before defining any schemas
6
+ extendZodWithOpenApi(z);
7
+ export { SaleStatusUpdatedV1Schema };
8
+ export { SaleDeliveryStatusUpdatedV1Schema };
9
+ // Export event types
10
+ export const eventTypes = {
11
+ SALE_STATUS_UPDATED_V1,
12
+ SALE_DELIVERY_STATUS_UPDATED_V1,
13
+ };
14
+ export const eventSchemaMap = Object.fromEntries([
15
+ [SALE_STATUS_UPDATED_V1, SaleStatusUpdatedV1Schema],
16
+ [SALE_DELIVERY_STATUS_UPDATED_V1, SaleDeliveryStatusUpdatedV1Schema],
17
+ ]);
@@ -0,0 +1,31 @@
1
+ import { extendZodWithOpenApi } from '@asteasolutions/zod-to-openapi';
2
+ import { z } from 'zod';
3
+ import {
4
+ eventType as SALE_DELIVERY_STATUS_UPDATED_V1,
5
+ SaleDeliveryStatusUpdatedV1Schema,
6
+ } from './sales.delivery.status.updated.v1.js';
7
+ import {
8
+ eventType as SALE_STATUS_UPDATED_V1,
9
+ SaleStatusUpdatedV1Schema,
10
+ } from './sales.status.updated.v1.js';
11
+
12
+ // This must be called before defining any schemas
13
+ extendZodWithOpenApi(z);
14
+
15
+ export { SaleStatusUpdatedV1Schema };
16
+ export { SaleDeliveryStatusUpdatedV1Schema };
17
+
18
+ // Re-export specific types from each module with renamed exports to avoid conflicts
19
+ export { SaleStatusUpdatedV1 } from './sales.status.updated.v1.js';
20
+ export { SaleDeliveryStatusUpdatedV1 } from './sales.delivery.status.updated.v1.js';
21
+
22
+ // Export event types
23
+ export const eventTypes = {
24
+ SALE_STATUS_UPDATED_V1,
25
+ SALE_DELIVERY_STATUS_UPDATED_V1,
26
+ };
27
+
28
+ export const eventSchemaMap = Object.fromEntries([
29
+ [SALE_STATUS_UPDATED_V1, SaleStatusUpdatedV1Schema],
30
+ [SALE_DELIVERY_STATUS_UPDATED_V1, SaleDeliveryStatusUpdatedV1Schema],
31
+ ]);
@@ -0,0 +1,74 @@
1
+ import { z } from 'zod';
2
+ import { metadataSchema } from '../../metadata.js';
3
+ import { DeliveryStatus } from './constants.js';
4
+ export const eventType = 'sales.delivery.status.updated.v1';
5
+ const SaleDeliveryStatusUpdatedV1PropertiesSchema = z
6
+ .discriminatedUnion('status', [
7
+ z.object({
8
+ orgId: z.string(),
9
+ brandId: z.string(),
10
+ propertyId: z.string(),
11
+ storefrontId: z.string(),
12
+ saleId: z.string(),
13
+ externalId: z.string(),
14
+ status: z.literal(DeliveryStatus.SALE_DISPATCHED),
15
+ dispatchTime: z.string().datetime(),
16
+ }),
17
+ z.object({
18
+ orgId: z.string(),
19
+ brandId: z.string(),
20
+ propertyId: z.string(),
21
+ storefrontId: z.string(),
22
+ saleId: z.string(),
23
+ externalId: z.string(),
24
+ status: z.literal(DeliveryStatus.SALE_ON_THE_WAY),
25
+ dispatchTime: z.string().datetime(),
26
+ }),
27
+ z.object({
28
+ orgId: z.string(),
29
+ brandId: z.string(),
30
+ propertyId: z.string(),
31
+ storefrontId: z.string(),
32
+ saleId: z.string(),
33
+ externalId: z.string(),
34
+ status: z.literal(DeliveryStatus.SALE_DELIVERED),
35
+ deliveryTime: z.string().datetime(),
36
+ }),
37
+ ])
38
+ .openapi({
39
+ description: 'Emitted when a sale delivery status is updated',
40
+ example: {
41
+ orgId: 'org-123',
42
+ brandId: 'brand-123',
43
+ propertyId: 'property-123',
44
+ storefrontId: 'storefront-123',
45
+ saleId: 'sale-123',
46
+ externalId: 'sale-external-123',
47
+ status: DeliveryStatus.SALE_DISPATCHED,
48
+ dispatchTime: '2025-01-01T00:00:00Z',
49
+ },
50
+ });
51
+ const SALE_DELIVERY_STATUS_UPDATED_V1_WEBHOOK_EXAMPLE = {
52
+ source: 'rms',
53
+ 'detail-type': eventType,
54
+ detail: {
55
+ properties: SaleDeliveryStatusUpdatedV1PropertiesSchema,
56
+ metadata: metadataSchema,
57
+ },
58
+ };
59
+ export const SaleDeliveryStatusUpdatedV1Schema = z
60
+ .object({
61
+ source: z.string().openapi({
62
+ description: 'Source of the event',
63
+ example: 'rms',
64
+ }),
65
+ 'detail-type': z.literal(eventType),
66
+ detail: z.object({
67
+ properties: SaleDeliveryStatusUpdatedV1PropertiesSchema,
68
+ metadata: metadataSchema,
69
+ }),
70
+ })
71
+ .openapi({
72
+ description: 'Emitted when a sale delivery status is updated',
73
+ 'x-example': SALE_DELIVERY_STATUS_UPDATED_V1_WEBHOOK_EXAMPLE,
74
+ });
@@ -0,0 +1,80 @@
1
+ import { z } from 'zod';
2
+ import { metadataSchema } from '../../metadata.js';
3
+ import { DeliveryStatus } from './constants.js';
4
+
5
+ export const eventType = 'sales.delivery.status.updated.v1';
6
+
7
+ const SaleDeliveryStatusUpdatedV1PropertiesSchema = z
8
+ .discriminatedUnion('status', [
9
+ z.object({
10
+ orgId: z.string(),
11
+ brandId: z.string(),
12
+ propertyId: z.string(),
13
+ storefrontId: z.string(),
14
+ saleId: z.string(),
15
+ externalId: z.string(),
16
+ status: z.literal(DeliveryStatus.SALE_DISPATCHED),
17
+ dispatchTime: z.string().datetime(),
18
+ }),
19
+ z.object({
20
+ orgId: z.string(),
21
+ brandId: z.string(),
22
+ propertyId: z.string(),
23
+ storefrontId: z.string(),
24
+ saleId: z.string(),
25
+ externalId: z.string(),
26
+ status: z.literal(DeliveryStatus.SALE_ON_THE_WAY),
27
+ dispatchTime: z.string().datetime(),
28
+ }),
29
+ z.object({
30
+ orgId: z.string(),
31
+ brandId: z.string(),
32
+ propertyId: z.string(),
33
+ storefrontId: z.string(),
34
+ saleId: z.string(),
35
+ externalId: z.string(),
36
+ status: z.literal(DeliveryStatus.SALE_DELIVERED),
37
+ deliveryTime: z.string().datetime(),
38
+ }),
39
+ ])
40
+ .openapi({
41
+ description: 'Emitted when a sale delivery status is updated',
42
+ example: {
43
+ orgId: 'org-123',
44
+ brandId: 'brand-123',
45
+ propertyId: 'property-123',
46
+ storefrontId: 'storefront-123',
47
+ saleId: 'sale-123',
48
+ externalId: 'sale-external-123',
49
+ status: DeliveryStatus.SALE_DISPATCHED,
50
+ dispatchTime: '2025-01-01T00:00:00Z',
51
+ },
52
+ });
53
+
54
+ const SALE_DELIVERY_STATUS_UPDATED_V1_WEBHOOK_EXAMPLE = {
55
+ source: 'rms',
56
+ 'detail-type': eventType,
57
+ detail: {
58
+ properties: SaleDeliveryStatusUpdatedV1PropertiesSchema,
59
+ metadata: metadataSchema,
60
+ },
61
+ };
62
+
63
+ export const SaleDeliveryStatusUpdatedV1Schema = z
64
+ .object({
65
+ source: z.string().openapi({
66
+ description: 'Source of the event',
67
+ example: 'rms',
68
+ }),
69
+ 'detail-type': z.literal(eventType),
70
+ detail: z.object({
71
+ properties: SaleDeliveryStatusUpdatedV1PropertiesSchema,
72
+ metadata: metadataSchema,
73
+ }),
74
+ })
75
+ .openapi({
76
+ description: 'Emitted when a sale delivery status is updated',
77
+ 'x-example': SALE_DELIVERY_STATUS_UPDATED_V1_WEBHOOK_EXAMPLE,
78
+ });
79
+
80
+ export type SaleDeliveryStatusUpdatedV1 = z.infer<typeof SaleDeliveryStatusUpdatedV1Schema>;
@@ -0,0 +1,99 @@
1
+ import { z } from 'zod';
2
+ import { metadataSchema } from '../../metadata.js';
3
+ import { SaleStatus } from './constants.js';
4
+ export const eventType = 'sales.status.updated.v1';
5
+ const SaleStatusUpdatedV1PropertiesSchema = z
6
+ .discriminatedUnion('status', [
7
+ z.object({
8
+ orgId: z.string(),
9
+ brandId: z.string(),
10
+ propertyId: z.string(),
11
+ storefrontId: z.string(),
12
+ saleId: z.string(),
13
+ externalId: z.string(),
14
+ status: z.literal(SaleStatus.SALE_PREPARED_BY_KITCHEN),
15
+ }),
16
+ z.object({
17
+ orgId: z.string(),
18
+ brandId: z.string(),
19
+ propertyId: z.string(),
20
+ storefrontId: z.string(),
21
+ saleId: z.string(),
22
+ externalId: z.string(),
23
+ status: z.literal(SaleStatus.SALE_PICKUP_TIME_CHANGED),
24
+ pickupTime: z.string().datetime(),
25
+ }),
26
+ z.object({
27
+ orgId: z.string(),
28
+ brandId: z.string(),
29
+ propertyId: z.string(),
30
+ storefrontId: z.string(),
31
+ saleId: z.string(),
32
+ externalId: z.string(),
33
+ status: z.literal(SaleStatus.SALE_DELIVERY_TIME_CHANGED),
34
+ deliveryTime: z.string().datetime(),
35
+ }),
36
+ z.object({
37
+ orgId: z.string(),
38
+ brandId: z.string(),
39
+ propertyId: z.string(),
40
+ storefrontId: z.string(),
41
+ saleId: z.string(),
42
+ externalId: z.string(),
43
+ status: z.literal(SaleStatus.SALE_CANCELLED),
44
+ cancellationReason: z.string(),
45
+ cancelledBy: z.string(),
46
+ }),
47
+ ])
48
+ .openapi({
49
+ description: 'Emitted when a sale status is updated',
50
+ example: {
51
+ orgId: 'org-123',
52
+ brandId: 'brand-123',
53
+ propertyId: 'property-123',
54
+ storefrontId: 'storefront-123',
55
+ saleId: 'sale-123',
56
+ externalId: 'sale-external-123',
57
+ status: SaleStatus.SALE_PREPARED_BY_KITCHEN,
58
+ },
59
+ });
60
+ const SALE_STATUS_UPDATED_V1_WEBHOOK_EXAMPLE = {
61
+ source: 'rms',
62
+ 'detail-type': eventType,
63
+ detail: {
64
+ properties: {
65
+ orgId: 'org-123',
66
+ brandId: 'brand-123',
67
+ propertyId: 'property-123',
68
+ storefrontId: 'storefront-123',
69
+ saleId: 'sale-123',
70
+ externalId: 'sale-external-123',
71
+ status: SaleStatus.SALE_PREPARED_BY_KITCHEN,
72
+ },
73
+ metadata: {
74
+ actorUserId: 123,
75
+ actor: {
76
+ id: 'user-123',
77
+ email: 'user@example.com',
78
+ name: 'John Doe',
79
+ },
80
+ },
81
+ },
82
+ };
83
+ export const SaleStatusUpdatedV1Schema = z
84
+ .object({
85
+ source: z.string().openapi({
86
+ description: 'Source of the event',
87
+ example: 'rms',
88
+ }),
89
+ 'detail-type': z.literal(eventType),
90
+ detail: z.object({
91
+ properties: SaleStatusUpdatedV1PropertiesSchema,
92
+ metadata: metadataSchema,
93
+ }),
94
+ })
95
+ .openapi({
96
+ description: 'Emitted when an org publishes a menu (new or updated), making it available to sales channels and integrations.\n\nThis is currently in **Closed BETA** and available upon request only. Please [email us](mailto:integrations@flipdish.com) if you would like to use these new webhooks.',
97
+ 'x-webhook-group': 'Menu Publishing',
98
+ 'x-example': SALE_STATUS_UPDATED_V1_WEBHOOK_EXAMPLE,
99
+ });
@@ -0,0 +1,106 @@
1
+ import { z } from 'zod';
2
+ import { metadataSchema } from '../../metadata.js';
3
+ import { SaleStatus } from './constants.js';
4
+
5
+ export const eventType = 'sales.status.updated.v1';
6
+
7
+ const SaleStatusUpdatedV1PropertiesSchema = z
8
+ .discriminatedUnion('status', [
9
+ z.object({
10
+ orgId: z.string(),
11
+ brandId: z.string(),
12
+ propertyId: z.string(),
13
+ storefrontId: z.string(),
14
+ saleId: z.string(),
15
+ externalId: z.string(),
16
+ status: z.literal(SaleStatus.SALE_PREPARED_BY_KITCHEN),
17
+ }),
18
+ z.object({
19
+ orgId: z.string(),
20
+ brandId: z.string(),
21
+ propertyId: z.string(),
22
+ storefrontId: z.string(),
23
+ saleId: z.string(),
24
+ externalId: z.string(),
25
+ status: z.literal(SaleStatus.SALE_PICKUP_TIME_CHANGED),
26
+ pickupTime: z.string().datetime(),
27
+ }),
28
+ z.object({
29
+ orgId: z.string(),
30
+ brandId: z.string(),
31
+ propertyId: z.string(),
32
+ storefrontId: z.string(),
33
+ saleId: z.string(),
34
+ externalId: z.string(),
35
+ status: z.literal(SaleStatus.SALE_DELIVERY_TIME_CHANGED),
36
+ deliveryTime: z.string().datetime(),
37
+ }),
38
+ z.object({
39
+ orgId: z.string(),
40
+ brandId: z.string(),
41
+ propertyId: z.string(),
42
+ storefrontId: z.string(),
43
+ saleId: z.string(),
44
+ externalId: z.string(),
45
+ status: z.literal(SaleStatus.SALE_CANCELLED),
46
+ cancellationReason: z.string(),
47
+ cancelledBy: z.string(),
48
+ }),
49
+ ])
50
+ .openapi({
51
+ description: 'Emitted when a sale status is updated',
52
+ example: {
53
+ orgId: 'org-123',
54
+ brandId: 'brand-123',
55
+ propertyId: 'property-123',
56
+ storefrontId: 'storefront-123',
57
+ saleId: 'sale-123',
58
+ externalId: 'sale-external-123',
59
+ status: SaleStatus.SALE_PREPARED_BY_KITCHEN,
60
+ },
61
+ });
62
+
63
+ const SALE_STATUS_UPDATED_V1_WEBHOOK_EXAMPLE = {
64
+ source: 'rms',
65
+ 'detail-type': eventType,
66
+ detail: {
67
+ properties: {
68
+ orgId: 'org-123',
69
+ brandId: 'brand-123',
70
+ propertyId: 'property-123',
71
+ storefrontId: 'storefront-123',
72
+ saleId: 'sale-123',
73
+ externalId: 'sale-external-123',
74
+ status: SaleStatus.SALE_PREPARED_BY_KITCHEN,
75
+ },
76
+ metadata: {
77
+ actorUserId: 123,
78
+ actor: {
79
+ id: 'user-123',
80
+ email: 'user@example.com',
81
+ name: 'John Doe',
82
+ },
83
+ },
84
+ },
85
+ };
86
+
87
+ export const SaleStatusUpdatedV1Schema = z
88
+ .object({
89
+ source: z.string().openapi({
90
+ description: 'Source of the event',
91
+ example: 'rms',
92
+ }),
93
+ 'detail-type': z.literal(eventType),
94
+ detail: z.object({
95
+ properties: SaleStatusUpdatedV1PropertiesSchema,
96
+ metadata: metadataSchema,
97
+ }),
98
+ })
99
+ .openapi({
100
+ description:
101
+ 'Emitted when an org publishes a menu (new or updated), making it available to sales channels and integrations.\n\nThis is currently in **Closed BETA** and available upon request only. Please [email us](mailto:integrations@flipdish.com) if you would like to use these new webhooks.',
102
+ 'x-webhook-group': 'Menu Publishing',
103
+ 'x-example': SALE_STATUS_UPDATED_V1_WEBHOOK_EXAMPLE,
104
+ });
105
+
106
+ export type SaleStatusUpdatedV1 = z.infer<typeof SaleStatusUpdatedV1Schema>;
package/webhooks/index.js CHANGED
@@ -1,4 +1,5 @@
1
1
  import { eventSchemaMap as rmsMenuEventSchemaMap, eventTypes as rmsMenuEvents, } from '../rms/menus/index.js';
2
+ import { eventSchemaMap as rmsSalesEventSchemaMap, eventTypes as rmsSalesEvents, } from '../rms/sales/index.js';
2
3
  import { eventSchemaMap as rmsSnoozeEventSchemaMap, eventTypes as rmsSnoozeEvents, } from '../rms/snoozes/index.js';
3
4
  export const webhookEventTypes = [
4
5
  rmsMenuEvents.MENU_PUBLISHED_V1,
@@ -6,9 +7,12 @@ export const webhookEventTypes = [
6
7
  rmsSnoozeEvents.MENU_ITEM_UNSNOOZED_V1,
7
8
  rmsSnoozeEvents.SALES_CHANNEL_SNOOZED_V1,
8
9
  rmsSnoozeEvents.SALES_CHANNEL_UNSNOOZED_V1,
10
+ rmsSalesEvents.SALE_STATUS_UPDATED_V1,
11
+ rmsSalesEvents.SALE_DELIVERY_STATUS_UPDATED_V1,
9
12
  ];
10
13
  // Export a consolidated schema map for all webhook event types we expose
11
14
  export const eventSchemaMap = {
12
15
  ...rmsMenuEventSchemaMap,
13
16
  ...rmsSnoozeEventSchemaMap,
17
+ ...rmsSalesEventSchemaMap,
14
18
  };
package/webhooks/index.ts CHANGED
@@ -2,6 +2,10 @@ import {
2
2
  eventSchemaMap as rmsMenuEventSchemaMap,
3
3
  eventTypes as rmsMenuEvents,
4
4
  } from '../rms/menus/index.js';
5
+ import {
6
+ eventSchemaMap as rmsSalesEventSchemaMap,
7
+ eventTypes as rmsSalesEvents,
8
+ } from '../rms/sales/index.js';
5
9
  import {
6
10
  eventSchemaMap as rmsSnoozeEventSchemaMap,
7
11
  eventTypes as rmsSnoozeEvents,
@@ -13,10 +17,13 @@ export const webhookEventTypes = [
13
17
  rmsSnoozeEvents.MENU_ITEM_UNSNOOZED_V1,
14
18
  rmsSnoozeEvents.SALES_CHANNEL_SNOOZED_V1,
15
19
  rmsSnoozeEvents.SALES_CHANNEL_UNSNOOZED_V1,
20
+ rmsSalesEvents.SALE_STATUS_UPDATED_V1,
21
+ rmsSalesEvents.SALE_DELIVERY_STATUS_UPDATED_V1,
16
22
  ] as const;
17
23
 
18
24
  // Export a consolidated schema map for all webhook event types we expose
19
25
  export const eventSchemaMap = {
20
26
  ...rmsMenuEventSchemaMap,
21
27
  ...rmsSnoozeEventSchemaMap,
28
+ ...rmsSalesEventSchemaMap,
22
29
  } as const;