@flipdish/events 1.25346.0 → 1.25350.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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@flipdish/events",
3
- "version": "1.25346.0",
3
+ "version": "1.25350.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",
@@ -15,9 +15,9 @@ extendZodWithOpenApi(z);
15
15
  export { SaleStatusUpdatedV1Schema };
16
16
  export { SaleDeliveryStatusUpdatedV1Schema };
17
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';
18
+ // Re-export specific types from each module with renamed exports to avoid conflicts.
19
+ export type { SaleStatusUpdatedV1 } from './sales.status.updated.v1.js';
20
+ export type { SaleDeliveryStatusUpdatedV1 } from './sales.delivery.status.updated.v1.js';
21
21
 
22
22
  // Export event types
23
23
  export const eventTypes = {
@@ -2,35 +2,25 @@ import { z } from 'zod';
2
2
  import { metadataSchema } from '../../metadata.js';
3
3
  import { DeliveryStatus } from './constants.js';
4
4
  export const eventType = 'sales.delivery.status.updated.v1';
5
+ const SaleDeliveryStatusUpdatedV1CommonPropertiesSchema = z.object({
6
+ orgId: z.string(),
7
+ brandId: z.string(),
8
+ propertyId: z.string(),
9
+ salesChannelId: z.string(),
10
+ saleId: z.string(),
11
+ externalId: z.string().optional(),
12
+ });
5
13
  const SaleDeliveryStatusUpdatedV1PropertiesSchema = z
6
14
  .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(),
15
+ SaleDeliveryStatusUpdatedV1CommonPropertiesSchema.extend({
14
16
  status: z.literal(DeliveryStatus.SALE_DISPATCHED),
15
17
  dispatchTime: z.string().datetime(),
16
18
  }),
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(),
19
+ SaleDeliveryStatusUpdatedV1CommonPropertiesSchema.extend({
24
20
  status: z.literal(DeliveryStatus.SALE_ON_THE_WAY),
25
21
  dispatchTime: z.string().datetime(),
26
22
  }),
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(),
23
+ SaleDeliveryStatusUpdatedV1CommonPropertiesSchema.extend({
34
24
  status: z.literal(DeliveryStatus.SALE_DELIVERED),
35
25
  deliveryTime: z.string().datetime(),
36
26
  }),
@@ -38,10 +28,10 @@ const SaleDeliveryStatusUpdatedV1PropertiesSchema = z
38
28
  .openapi({
39
29
  description: 'Emitted when a sale delivery status is updated',
40
30
  example: {
41
- orgId: 'org-123',
42
- brandId: 'brand-123',
43
- propertyId: 'property-123',
44
- storefrontId: 'storefront-123',
31
+ orgId: 'org123',
32
+ brandId: 'br123',
33
+ propertyId: 'p123',
34
+ salesChannelId: 'sc123',
45
35
  saleId: 'sale-123',
46
36
  externalId: 'sale-external-123',
47
37
  status: DeliveryStatus.SALE_DISPATCHED,
@@ -4,35 +4,26 @@ import { DeliveryStatus } from './constants.js';
4
4
 
5
5
  export const eventType = 'sales.delivery.status.updated.v1';
6
6
 
7
+ const SaleDeliveryStatusUpdatedV1CommonPropertiesSchema = z.object({
8
+ orgId: z.string(),
9
+ brandId: z.string(),
10
+ propertyId: z.string(),
11
+ salesChannelId: z.string(),
12
+ saleId: z.string(),
13
+ externalId: z.string().optional(),
14
+ });
15
+
7
16
  const SaleDeliveryStatusUpdatedV1PropertiesSchema = z
8
17
  .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(),
18
+ SaleDeliveryStatusUpdatedV1CommonPropertiesSchema.extend({
16
19
  status: z.literal(DeliveryStatus.SALE_DISPATCHED),
17
20
  dispatchTime: z.string().datetime(),
18
21
  }),
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(),
22
+ SaleDeliveryStatusUpdatedV1CommonPropertiesSchema.extend({
26
23
  status: z.literal(DeliveryStatus.SALE_ON_THE_WAY),
27
24
  dispatchTime: z.string().datetime(),
28
25
  }),
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(),
26
+ SaleDeliveryStatusUpdatedV1CommonPropertiesSchema.extend({
36
27
  status: z.literal(DeliveryStatus.SALE_DELIVERED),
37
28
  deliveryTime: z.string().datetime(),
38
29
  }),
@@ -40,10 +31,10 @@ const SaleDeliveryStatusUpdatedV1PropertiesSchema = z
40
31
  .openapi({
41
32
  description: 'Emitted when a sale delivery status is updated',
42
33
  example: {
43
- orgId: 'org-123',
44
- brandId: 'brand-123',
45
- propertyId: 'property-123',
46
- storefrontId: 'storefront-123',
34
+ orgId: 'org123',
35
+ brandId: 'br123',
36
+ propertyId: 'p123',
37
+ salesChannelId: 'sc123',
47
38
  saleId: 'sale-123',
48
39
  externalId: 'sale-external-123',
49
40
  status: DeliveryStatus.SALE_DISPATCHED,
@@ -2,44 +2,28 @@ import { z } from 'zod';
2
2
  import { metadataSchema } from '../../metadata.js';
3
3
  import { SaleStatus } from './constants.js';
4
4
  export const eventType = 'sales.status.updated.v1';
5
+ const SaleStatusUpdatedV1CommonPropertiesSchema = z.object({
6
+ orgId: z.string(),
7
+ brandId: z.string(),
8
+ propertyId: z.string(),
9
+ salesChannelId: z.string(),
10
+ saleId: z.string(),
11
+ externalId: z.string().optional(),
12
+ });
5
13
  const SaleStatusUpdatedV1PropertiesSchema = z
6
14
  .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(),
15
+ SaleStatusUpdatedV1CommonPropertiesSchema.extend({
14
16
  status: z.literal(SaleStatus.SALE_PREPARED_BY_KITCHEN),
15
17
  }),
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(),
18
+ SaleStatusUpdatedV1CommonPropertiesSchema.extend({
23
19
  status: z.literal(SaleStatus.SALE_PICKUP_TIME_CHANGED),
24
20
  pickupTime: z.string().datetime(),
25
21
  }),
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(),
22
+ SaleStatusUpdatedV1CommonPropertiesSchema.extend({
33
23
  status: z.literal(SaleStatus.SALE_DELIVERY_TIME_CHANGED),
34
24
  deliveryTime: z.string().datetime(),
35
25
  }),
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(),
26
+ SaleStatusUpdatedV1CommonPropertiesSchema.extend({
43
27
  status: z.literal(SaleStatus.SALE_CANCELLED),
44
28
  cancellationReason: z.string(),
45
29
  cancelledBy: z.string(),
@@ -48,10 +32,10 @@ const SaleStatusUpdatedV1PropertiesSchema = z
48
32
  .openapi({
49
33
  description: 'Emitted when a sale status is updated',
50
34
  example: {
51
- orgId: 'org-123',
52
- brandId: 'brand-123',
53
- propertyId: 'property-123',
54
- storefrontId: 'storefront-123',
35
+ orgId: 'org123',
36
+ brandId: 'br123',
37
+ propertyId: 'p123',
38
+ salesChannelId: 'sc123',
55
39
  saleId: 'sale-123',
56
40
  externalId: 'sale-external-123',
57
41
  status: SaleStatus.SALE_PREPARED_BY_KITCHEN,
@@ -62,10 +46,10 @@ const SALE_STATUS_UPDATED_V1_WEBHOOK_EXAMPLE = {
62
46
  'detail-type': eventType,
63
47
  detail: {
64
48
  properties: {
65
- orgId: 'org-123',
66
- brandId: 'brand-123',
67
- propertyId: 'property-123',
68
- storefrontId: 'storefront-123',
49
+ orgId: 'org123',
50
+ brandId: 'br123',
51
+ propertyId: 'p123',
52
+ salesChannelId: 'sc123',
69
53
  saleId: 'sale-123',
70
54
  externalId: 'sale-external-123',
71
55
  status: SaleStatus.SALE_PREPARED_BY_KITCHEN,
@@ -93,7 +77,7 @@ export const SaleStatusUpdatedV1Schema = z
93
77
  }),
94
78
  })
95
79
  .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',
80
+ description: 'Emitted when a sale status is updated',
81
+ 'x-webhook-group': 'Sale Status Updated',
98
82
  'x-example': SALE_STATUS_UPDATED_V1_WEBHOOK_EXAMPLE,
99
83
  });
@@ -4,44 +4,29 @@ import { SaleStatus } from './constants.js';
4
4
 
5
5
  export const eventType = 'sales.status.updated.v1';
6
6
 
7
+ const SaleStatusUpdatedV1CommonPropertiesSchema = z.object({
8
+ orgId: z.string(),
9
+ brandId: z.string(),
10
+ propertyId: z.string(),
11
+ salesChannelId: z.string(),
12
+ saleId: z.string(),
13
+ externalId: z.string().optional(),
14
+ });
15
+
7
16
  const SaleStatusUpdatedV1PropertiesSchema = z
8
17
  .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(),
18
+ SaleStatusUpdatedV1CommonPropertiesSchema.extend({
16
19
  status: z.literal(SaleStatus.SALE_PREPARED_BY_KITCHEN),
17
20
  }),
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(),
21
+ SaleStatusUpdatedV1CommonPropertiesSchema.extend({
25
22
  status: z.literal(SaleStatus.SALE_PICKUP_TIME_CHANGED),
26
23
  pickupTime: z.string().datetime(),
27
24
  }),
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(),
25
+ SaleStatusUpdatedV1CommonPropertiesSchema.extend({
35
26
  status: z.literal(SaleStatus.SALE_DELIVERY_TIME_CHANGED),
36
27
  deliveryTime: z.string().datetime(),
37
28
  }),
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(),
29
+ SaleStatusUpdatedV1CommonPropertiesSchema.extend({
45
30
  status: z.literal(SaleStatus.SALE_CANCELLED),
46
31
  cancellationReason: z.string(),
47
32
  cancelledBy: z.string(),
@@ -50,10 +35,10 @@ const SaleStatusUpdatedV1PropertiesSchema = z
50
35
  .openapi({
51
36
  description: 'Emitted when a sale status is updated',
52
37
  example: {
53
- orgId: 'org-123',
54
- brandId: 'brand-123',
55
- propertyId: 'property-123',
56
- storefrontId: 'storefront-123',
38
+ orgId: 'org123',
39
+ brandId: 'br123',
40
+ propertyId: 'p123',
41
+ salesChannelId: 'sc123',
57
42
  saleId: 'sale-123',
58
43
  externalId: 'sale-external-123',
59
44
  status: SaleStatus.SALE_PREPARED_BY_KITCHEN,
@@ -65,10 +50,10 @@ const SALE_STATUS_UPDATED_V1_WEBHOOK_EXAMPLE = {
65
50
  'detail-type': eventType,
66
51
  detail: {
67
52
  properties: {
68
- orgId: 'org-123',
69
- brandId: 'brand-123',
70
- propertyId: 'property-123',
71
- storefrontId: 'storefront-123',
53
+ orgId: 'org123',
54
+ brandId: 'br123',
55
+ propertyId: 'p123',
56
+ salesChannelId: 'sc123',
72
57
  saleId: 'sale-123',
73
58
  externalId: 'sale-external-123',
74
59
  status: SaleStatus.SALE_PREPARED_BY_KITCHEN,
@@ -97,9 +82,8 @@ export const SaleStatusUpdatedV1Schema = z
97
82
  }),
98
83
  })
99
84
  .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',
85
+ description: 'Emitted when a sale status is updated',
86
+ 'x-webhook-group': 'Sale Status Updated',
103
87
  'x-example': SALE_STATUS_UPDATED_V1_WEBHOOK_EXAMPLE,
104
88
  });
105
89