@flipdish/events 1.25349.0 → 1.25351.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 +1 -1
- package/rms/sales/index.js +8 -8
- package/rms/sales/index.ts +13 -13
- package/rms/sales/sales.delivery.status.updated.v1.js +45 -34
- package/rms/sales/sales.delivery.status.updated.v1.ts +47 -36
- package/rms/sales/sales.pos.status.updated.v1.js +87 -0
- package/rms/sales/sales.pos.status.updated.v1.ts +94 -0
- package/webhooks/index.js +2 -2
- package/webhooks/index.ts +2 -2
- package/rms/sales/sales.status.updated.v1.js +0 -99
- package/rms/sales/sales.status.updated.v1.ts +0 -106
package/package.json
CHANGED
package/rms/sales/index.js
CHANGED
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
import { extendZodWithOpenApi } from '@asteasolutions/zod-to-openapi';
|
|
2
2
|
import { z } from 'zod';
|
|
3
|
-
import { eventType as
|
|
4
|
-
import { eventType as
|
|
3
|
+
import { eventType as SALES_DELIVERY_STATUS_UPDATED_V1, SalesDeliveryStatusUpdatedV1Schema, } from './sales.delivery.status.updated.v1.js';
|
|
4
|
+
import { eventType as SALES_POS_STATUS_UPDATED_V1, SalesPosStatusUpdatedV1Schema, } from './sales.pos.status.updated.v1.js';
|
|
5
5
|
// This must be called before defining any schemas
|
|
6
6
|
extendZodWithOpenApi(z);
|
|
7
|
-
export {
|
|
8
|
-
export {
|
|
7
|
+
export { SalesPosStatusUpdatedV1Schema };
|
|
8
|
+
export { SalesDeliveryStatusUpdatedV1Schema };
|
|
9
9
|
// Export event types
|
|
10
10
|
export const eventTypes = {
|
|
11
|
-
|
|
12
|
-
|
|
11
|
+
SALES_POS_STATUS_UPDATED_V1,
|
|
12
|
+
SALES_DELIVERY_STATUS_UPDATED_V1,
|
|
13
13
|
};
|
|
14
14
|
export const eventSchemaMap = Object.fromEntries([
|
|
15
|
-
[
|
|
16
|
-
[
|
|
15
|
+
[SALES_POS_STATUS_UPDATED_V1, SalesPosStatusUpdatedV1Schema],
|
|
16
|
+
[SALES_DELIVERY_STATUS_UPDATED_V1, SalesDeliveryStatusUpdatedV1Schema],
|
|
17
17
|
]);
|
package/rms/sales/index.ts
CHANGED
|
@@ -1,31 +1,31 @@
|
|
|
1
1
|
import { extendZodWithOpenApi } from '@asteasolutions/zod-to-openapi';
|
|
2
2
|
import { z } from 'zod';
|
|
3
3
|
import {
|
|
4
|
-
eventType as
|
|
5
|
-
|
|
4
|
+
eventType as SALES_DELIVERY_STATUS_UPDATED_V1,
|
|
5
|
+
SalesDeliveryStatusUpdatedV1Schema,
|
|
6
6
|
} from './sales.delivery.status.updated.v1.js';
|
|
7
7
|
import {
|
|
8
|
-
eventType as
|
|
9
|
-
|
|
10
|
-
} from './sales.status.updated.v1.js';
|
|
8
|
+
eventType as SALES_POS_STATUS_UPDATED_V1,
|
|
9
|
+
SalesPosStatusUpdatedV1Schema,
|
|
10
|
+
} from './sales.pos.status.updated.v1.js';
|
|
11
11
|
|
|
12
12
|
// This must be called before defining any schemas
|
|
13
13
|
extendZodWithOpenApi(z);
|
|
14
14
|
|
|
15
|
-
export {
|
|
16
|
-
export {
|
|
15
|
+
export { SalesPosStatusUpdatedV1Schema };
|
|
16
|
+
export { SalesDeliveryStatusUpdatedV1Schema };
|
|
17
17
|
|
|
18
18
|
// Re-export specific types from each module with renamed exports to avoid conflicts.
|
|
19
|
-
export type {
|
|
20
|
-
export type {
|
|
19
|
+
export type { SalesPosStatusUpdatedV1 } from './sales.pos.status.updated.v1.js';
|
|
20
|
+
export type { SalesDeliveryStatusUpdatedV1 } from './sales.delivery.status.updated.v1.js';
|
|
21
21
|
|
|
22
22
|
// Export event types
|
|
23
23
|
export const eventTypes = {
|
|
24
|
-
|
|
25
|
-
|
|
24
|
+
SALES_POS_STATUS_UPDATED_V1,
|
|
25
|
+
SALES_DELIVERY_STATUS_UPDATED_V1,
|
|
26
26
|
};
|
|
27
27
|
|
|
28
28
|
export const eventSchemaMap = Object.fromEntries([
|
|
29
|
-
[
|
|
30
|
-
[
|
|
29
|
+
[SALES_POS_STATUS_UPDATED_V1, SalesPosStatusUpdatedV1Schema],
|
|
30
|
+
[SALES_DELIVERY_STATUS_UPDATED_V1, SalesDeliveryStatusUpdatedV1Schema],
|
|
31
31
|
]);
|
|
@@ -1,62 +1,72 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
2
|
import { metadataSchema } from '../../metadata.js';
|
|
3
|
+
import { SalesChannelTypes } from '../../rms/constants.js';
|
|
3
4
|
import { DeliveryStatus } from './constants.js';
|
|
4
5
|
export const eventType = 'sales.delivery.status.updated.v1';
|
|
5
|
-
const
|
|
6
|
+
const SalesDeliveryStatusUpdatedV1CommonPropertiesSchema = z.object({
|
|
7
|
+
orgId: z.string(),
|
|
8
|
+
brandId: z.string(),
|
|
9
|
+
propertyId: z.string(),
|
|
10
|
+
salesChannelId: z.string(),
|
|
11
|
+
salesChannelType: z.nativeEnum(SalesChannelTypes),
|
|
12
|
+
saleId: z.string(),
|
|
13
|
+
externalId: z.string().optional(),
|
|
14
|
+
});
|
|
15
|
+
const SalesDeliveryStatusUpdatedV1PropertiesSchema = z
|
|
6
16
|
.discriminatedUnion('status', [
|
|
7
|
-
|
|
8
|
-
orgId: z.string(),
|
|
9
|
-
brandId: z.string(),
|
|
10
|
-
propertyId: z.string(),
|
|
11
|
-
storefrontId: z.string(),
|
|
12
|
-
saleId: z.string(),
|
|
13
|
-
externalId: z.string(),
|
|
17
|
+
SalesDeliveryStatusUpdatedV1CommonPropertiesSchema.extend({
|
|
14
18
|
status: z.literal(DeliveryStatus.SALE_DISPATCHED),
|
|
15
19
|
dispatchTime: z.string().datetime(),
|
|
16
20
|
}),
|
|
17
|
-
|
|
18
|
-
orgId: z.string(),
|
|
19
|
-
brandId: z.string(),
|
|
20
|
-
propertyId: z.string(),
|
|
21
|
-
storefrontId: z.string(),
|
|
22
|
-
saleId: z.string(),
|
|
23
|
-
externalId: z.string(),
|
|
21
|
+
SalesDeliveryStatusUpdatedV1CommonPropertiesSchema.extend({
|
|
24
22
|
status: z.literal(DeliveryStatus.SALE_ON_THE_WAY),
|
|
25
23
|
dispatchTime: z.string().datetime(),
|
|
26
24
|
}),
|
|
27
|
-
|
|
28
|
-
orgId: z.string(),
|
|
29
|
-
brandId: z.string(),
|
|
30
|
-
propertyId: z.string(),
|
|
31
|
-
storefrontId: z.string(),
|
|
32
|
-
saleId: z.string(),
|
|
33
|
-
externalId: z.string(),
|
|
25
|
+
SalesDeliveryStatusUpdatedV1CommonPropertiesSchema.extend({
|
|
34
26
|
status: z.literal(DeliveryStatus.SALE_DELIVERED),
|
|
35
27
|
deliveryTime: z.string().datetime(),
|
|
36
28
|
}),
|
|
37
29
|
])
|
|
38
30
|
.openapi({
|
|
39
|
-
description: 'Emitted when a
|
|
31
|
+
description: 'Emitted when a sales delivery status is updated',
|
|
40
32
|
example: {
|
|
41
|
-
orgId: '
|
|
42
|
-
brandId: '
|
|
43
|
-
propertyId: '
|
|
44
|
-
|
|
33
|
+
orgId: 'org123',
|
|
34
|
+
brandId: 'br123',
|
|
35
|
+
propertyId: 'p123',
|
|
36
|
+
salesChannelId: 'sc123',
|
|
37
|
+
salesChannelType: SalesChannelTypes.UberEats,
|
|
45
38
|
saleId: 'sale-123',
|
|
46
39
|
externalId: 'sale-external-123',
|
|
47
40
|
status: DeliveryStatus.SALE_DISPATCHED,
|
|
48
41
|
dispatchTime: '2025-01-01T00:00:00Z',
|
|
49
42
|
},
|
|
50
43
|
});
|
|
51
|
-
const
|
|
44
|
+
const SALES_DELIVERY_STATUS_UPDATED_V1_WEBHOOK_EXAMPLE = {
|
|
52
45
|
source: 'rms',
|
|
53
46
|
'detail-type': eventType,
|
|
54
47
|
detail: {
|
|
55
|
-
properties:
|
|
56
|
-
|
|
48
|
+
properties: {
|
|
49
|
+
orgId: 'org123',
|
|
50
|
+
brandId: 'br123',
|
|
51
|
+
propertyId: 'p123',
|
|
52
|
+
salesChannelId: 'sc123',
|
|
53
|
+
salesChannelType: SalesChannelTypes.UberEats,
|
|
54
|
+
saleId: 'sale-123',
|
|
55
|
+
externalId: 'sale-external-123',
|
|
56
|
+
status: DeliveryStatus.SALE_DISPATCHED,
|
|
57
|
+
dispatchTime: '2025-01-01T00:00:00Z',
|
|
58
|
+
},
|
|
59
|
+
metadata: {
|
|
60
|
+
actorUserId: 123,
|
|
61
|
+
actor: {
|
|
62
|
+
id: 'user-123',
|
|
63
|
+
email: 'user@example.com',
|
|
64
|
+
name: 'John Doe',
|
|
65
|
+
},
|
|
66
|
+
},
|
|
57
67
|
},
|
|
58
68
|
};
|
|
59
|
-
export const
|
|
69
|
+
export const SalesDeliveryStatusUpdatedV1Schema = z
|
|
60
70
|
.object({
|
|
61
71
|
source: z.string().openapi({
|
|
62
72
|
description: 'Source of the event',
|
|
@@ -64,11 +74,12 @@ export const SaleDeliveryStatusUpdatedV1Schema = z
|
|
|
64
74
|
}),
|
|
65
75
|
'detail-type': z.literal(eventType),
|
|
66
76
|
detail: z.object({
|
|
67
|
-
properties:
|
|
77
|
+
properties: SalesDeliveryStatusUpdatedV1PropertiesSchema,
|
|
68
78
|
metadata: metadataSchema,
|
|
69
79
|
}),
|
|
70
80
|
})
|
|
71
81
|
.openapi({
|
|
72
|
-
description: 'Emitted when a
|
|
73
|
-
'x-
|
|
82
|
+
description: 'Emitted when a sales delivery status is updated',
|
|
83
|
+
'x-webhook-group': 'Sales Delivery Status Updated',
|
|
84
|
+
'x-example': SALES_DELIVERY_STATUS_UPDATED_V1_WEBHOOK_EXAMPLE,
|
|
74
85
|
});
|
|
@@ -1,49 +1,43 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
2
|
import { metadataSchema } from '../../metadata.js';
|
|
3
|
+
import { SalesChannelTypes } from '../../rms/constants.js';
|
|
3
4
|
import { DeliveryStatus } from './constants.js';
|
|
4
5
|
|
|
5
6
|
export const eventType = 'sales.delivery.status.updated.v1';
|
|
6
7
|
|
|
7
|
-
const
|
|
8
|
+
const SalesDeliveryStatusUpdatedV1CommonPropertiesSchema = z.object({
|
|
9
|
+
orgId: z.string(),
|
|
10
|
+
brandId: z.string(),
|
|
11
|
+
propertyId: z.string(),
|
|
12
|
+
salesChannelId: z.string(),
|
|
13
|
+
salesChannelType: z.nativeEnum(SalesChannelTypes),
|
|
14
|
+
saleId: z.string(),
|
|
15
|
+
externalId: z.string().optional(),
|
|
16
|
+
});
|
|
17
|
+
|
|
18
|
+
const SalesDeliveryStatusUpdatedV1PropertiesSchema = z
|
|
8
19
|
.discriminatedUnion('status', [
|
|
9
|
-
|
|
10
|
-
orgId: z.string(),
|
|
11
|
-
brandId: z.string(),
|
|
12
|
-
propertyId: z.string(),
|
|
13
|
-
storefrontId: z.string(),
|
|
14
|
-
saleId: z.string(),
|
|
15
|
-
externalId: z.string(),
|
|
20
|
+
SalesDeliveryStatusUpdatedV1CommonPropertiesSchema.extend({
|
|
16
21
|
status: z.literal(DeliveryStatus.SALE_DISPATCHED),
|
|
17
22
|
dispatchTime: z.string().datetime(),
|
|
18
23
|
}),
|
|
19
|
-
|
|
20
|
-
orgId: z.string(),
|
|
21
|
-
brandId: z.string(),
|
|
22
|
-
propertyId: z.string(),
|
|
23
|
-
storefrontId: z.string(),
|
|
24
|
-
saleId: z.string(),
|
|
25
|
-
externalId: z.string(),
|
|
24
|
+
SalesDeliveryStatusUpdatedV1CommonPropertiesSchema.extend({
|
|
26
25
|
status: z.literal(DeliveryStatus.SALE_ON_THE_WAY),
|
|
27
26
|
dispatchTime: z.string().datetime(),
|
|
28
27
|
}),
|
|
29
|
-
|
|
30
|
-
orgId: z.string(),
|
|
31
|
-
brandId: z.string(),
|
|
32
|
-
propertyId: z.string(),
|
|
33
|
-
storefrontId: z.string(),
|
|
34
|
-
saleId: z.string(),
|
|
35
|
-
externalId: z.string(),
|
|
28
|
+
SalesDeliveryStatusUpdatedV1CommonPropertiesSchema.extend({
|
|
36
29
|
status: z.literal(DeliveryStatus.SALE_DELIVERED),
|
|
37
30
|
deliveryTime: z.string().datetime(),
|
|
38
31
|
}),
|
|
39
32
|
])
|
|
40
33
|
.openapi({
|
|
41
|
-
description: 'Emitted when a
|
|
34
|
+
description: 'Emitted when a sales delivery status is updated',
|
|
42
35
|
example: {
|
|
43
|
-
orgId: '
|
|
44
|
-
brandId: '
|
|
45
|
-
propertyId: '
|
|
46
|
-
|
|
36
|
+
orgId: 'org123',
|
|
37
|
+
brandId: 'br123',
|
|
38
|
+
propertyId: 'p123',
|
|
39
|
+
salesChannelId: 'sc123',
|
|
40
|
+
salesChannelType: SalesChannelTypes.UberEats,
|
|
47
41
|
saleId: 'sale-123',
|
|
48
42
|
externalId: 'sale-external-123',
|
|
49
43
|
status: DeliveryStatus.SALE_DISPATCHED,
|
|
@@ -51,16 +45,32 @@ const SaleDeliveryStatusUpdatedV1PropertiesSchema = z
|
|
|
51
45
|
},
|
|
52
46
|
});
|
|
53
47
|
|
|
54
|
-
const
|
|
48
|
+
const SALES_DELIVERY_STATUS_UPDATED_V1_WEBHOOK_EXAMPLE = {
|
|
55
49
|
source: 'rms',
|
|
56
50
|
'detail-type': eventType,
|
|
57
51
|
detail: {
|
|
58
|
-
properties:
|
|
59
|
-
|
|
52
|
+
properties: {
|
|
53
|
+
orgId: 'org123',
|
|
54
|
+
brandId: 'br123',
|
|
55
|
+
propertyId: 'p123',
|
|
56
|
+
salesChannelId: 'sc123',
|
|
57
|
+
salesChannelType: SalesChannelTypes.UberEats,
|
|
58
|
+
saleId: 'sale-123',
|
|
59
|
+
externalId: 'sale-external-123',
|
|
60
|
+
status: DeliveryStatus.SALE_DISPATCHED,
|
|
61
|
+
dispatchTime: '2025-01-01T00:00:00Z',
|
|
62
|
+
},
|
|
63
|
+
metadata: {
|
|
64
|
+
actorUserId: 123,
|
|
65
|
+
actor: {
|
|
66
|
+
id: 'user-123',
|
|
67
|
+
email: 'user@example.com',
|
|
68
|
+
name: 'John Doe',
|
|
69
|
+
},
|
|
70
|
+
},
|
|
60
71
|
},
|
|
61
72
|
};
|
|
62
|
-
|
|
63
|
-
export const SaleDeliveryStatusUpdatedV1Schema = z
|
|
73
|
+
export const SalesDeliveryStatusUpdatedV1Schema = z
|
|
64
74
|
.object({
|
|
65
75
|
source: z.string().openapi({
|
|
66
76
|
description: 'Source of the event',
|
|
@@ -68,13 +78,14 @@ export const SaleDeliveryStatusUpdatedV1Schema = z
|
|
|
68
78
|
}),
|
|
69
79
|
'detail-type': z.literal(eventType),
|
|
70
80
|
detail: z.object({
|
|
71
|
-
properties:
|
|
81
|
+
properties: SalesDeliveryStatusUpdatedV1PropertiesSchema,
|
|
72
82
|
metadata: metadataSchema,
|
|
73
83
|
}),
|
|
74
84
|
})
|
|
75
85
|
.openapi({
|
|
76
|
-
description: 'Emitted when a
|
|
77
|
-
'x-
|
|
86
|
+
description: 'Emitted when a sales delivery status is updated',
|
|
87
|
+
'x-webhook-group': 'Sales Delivery Status Updated',
|
|
88
|
+
'x-example': SALES_DELIVERY_STATUS_UPDATED_V1_WEBHOOK_EXAMPLE,
|
|
78
89
|
});
|
|
79
90
|
|
|
80
|
-
export type
|
|
91
|
+
export type SalesDeliveryStatusUpdatedV1 = z.infer<typeof SalesDeliveryStatusUpdatedV1Schema>;
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { metadataSchema } from '../../metadata.js';
|
|
3
|
+
import { SalesChannelTypes } from '../../rms/constants.js';
|
|
4
|
+
import { SaleStatus } from './constants.js';
|
|
5
|
+
export const eventType = 'sales.pos.status.updated.v1';
|
|
6
|
+
const SalesPosStatusUpdatedV1CommonPropertiesSchema = z.object({
|
|
7
|
+
orgId: z.string(),
|
|
8
|
+
brandId: z.string(),
|
|
9
|
+
propertyId: z.string(),
|
|
10
|
+
salesChannelId: z.string(),
|
|
11
|
+
salesChannelType: z.nativeEnum(SalesChannelTypes),
|
|
12
|
+
saleId: z.string(),
|
|
13
|
+
externalId: z.string().optional(),
|
|
14
|
+
});
|
|
15
|
+
const SalesPosStatusUpdatedV1PropertiesSchema = z
|
|
16
|
+
.discriminatedUnion('status', [
|
|
17
|
+
SalesPosStatusUpdatedV1CommonPropertiesSchema.extend({
|
|
18
|
+
status: z.literal(SaleStatus.SALE_PREPARED_BY_KITCHEN),
|
|
19
|
+
}),
|
|
20
|
+
SalesPosStatusUpdatedV1CommonPropertiesSchema.extend({
|
|
21
|
+
status: z.literal(SaleStatus.SALE_PICKUP_TIME_CHANGED),
|
|
22
|
+
pickupTime: z.string().datetime(),
|
|
23
|
+
}),
|
|
24
|
+
SalesPosStatusUpdatedV1CommonPropertiesSchema.extend({
|
|
25
|
+
status: z.literal(SaleStatus.SALE_DELIVERY_TIME_CHANGED),
|
|
26
|
+
deliveryTime: z.string().datetime(),
|
|
27
|
+
}),
|
|
28
|
+
SalesPosStatusUpdatedV1CommonPropertiesSchema.extend({
|
|
29
|
+
status: z.literal(SaleStatus.SALE_CANCELLED),
|
|
30
|
+
cancellationReason: z.string(),
|
|
31
|
+
cancelledBy: z.string(),
|
|
32
|
+
}),
|
|
33
|
+
])
|
|
34
|
+
.openapi({
|
|
35
|
+
description: 'Emitted when a sales POS status is updated',
|
|
36
|
+
example: {
|
|
37
|
+
orgId: 'org123',
|
|
38
|
+
brandId: 'br123',
|
|
39
|
+
propertyId: 'p123',
|
|
40
|
+
salesChannelId: 'sc123',
|
|
41
|
+
salesChannelType: SalesChannelTypes.UberEats,
|
|
42
|
+
saleId: 'sale-123',
|
|
43
|
+
externalId: 'sale-external-123',
|
|
44
|
+
status: SaleStatus.SALE_PREPARED_BY_KITCHEN,
|
|
45
|
+
},
|
|
46
|
+
});
|
|
47
|
+
const SALES_POS_STATUS_UPDATED_V1_WEBHOOK_EXAMPLE = {
|
|
48
|
+
source: 'rms',
|
|
49
|
+
'detail-type': eventType,
|
|
50
|
+
detail: {
|
|
51
|
+
properties: {
|
|
52
|
+
orgId: 'org123',
|
|
53
|
+
brandId: 'br123',
|
|
54
|
+
propertyId: 'p123',
|
|
55
|
+
salesChannelId: 'sc123',
|
|
56
|
+
salesChannelType: SalesChannelTypes.UberEats,
|
|
57
|
+
saleId: 'sale-123',
|
|
58
|
+
externalId: 'sale-external-123',
|
|
59
|
+
status: SaleStatus.SALE_PREPARED_BY_KITCHEN,
|
|
60
|
+
},
|
|
61
|
+
metadata: {
|
|
62
|
+
actorUserId: 123,
|
|
63
|
+
actor: {
|
|
64
|
+
id: 'user-123',
|
|
65
|
+
email: 'user@example.com',
|
|
66
|
+
name: 'John Doe',
|
|
67
|
+
},
|
|
68
|
+
},
|
|
69
|
+
},
|
|
70
|
+
};
|
|
71
|
+
export const SalesPosStatusUpdatedV1Schema = z
|
|
72
|
+
.object({
|
|
73
|
+
source: z.string().openapi({
|
|
74
|
+
description: 'Source of the event',
|
|
75
|
+
example: 'rms',
|
|
76
|
+
}),
|
|
77
|
+
'detail-type': z.literal(eventType),
|
|
78
|
+
detail: z.object({
|
|
79
|
+
properties: SalesPosStatusUpdatedV1PropertiesSchema,
|
|
80
|
+
metadata: metadataSchema,
|
|
81
|
+
}),
|
|
82
|
+
})
|
|
83
|
+
.openapi({
|
|
84
|
+
description: 'Emitted when a sales POS status is updated',
|
|
85
|
+
'x-webhook-group': 'Sale Status Updated',
|
|
86
|
+
'x-example': SALES_POS_STATUS_UPDATED_V1_WEBHOOK_EXAMPLE,
|
|
87
|
+
});
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { metadataSchema } from '../../metadata.js';
|
|
3
|
+
import { SalesChannelTypes } from '../../rms/constants.js';
|
|
4
|
+
import { SaleStatus } from './constants.js';
|
|
5
|
+
|
|
6
|
+
export const eventType = 'sales.pos.status.updated.v1';
|
|
7
|
+
|
|
8
|
+
const SalesPosStatusUpdatedV1CommonPropertiesSchema = z.object({
|
|
9
|
+
orgId: z.string(),
|
|
10
|
+
brandId: z.string(),
|
|
11
|
+
propertyId: z.string(),
|
|
12
|
+
salesChannelId: z.string(),
|
|
13
|
+
salesChannelType: z.nativeEnum(SalesChannelTypes),
|
|
14
|
+
saleId: z.string(),
|
|
15
|
+
externalId: z.string().optional(),
|
|
16
|
+
});
|
|
17
|
+
|
|
18
|
+
const SalesPosStatusUpdatedV1PropertiesSchema = z
|
|
19
|
+
.discriminatedUnion('status', [
|
|
20
|
+
SalesPosStatusUpdatedV1CommonPropertiesSchema.extend({
|
|
21
|
+
status: z.literal(SaleStatus.SALE_PREPARED_BY_KITCHEN),
|
|
22
|
+
}),
|
|
23
|
+
SalesPosStatusUpdatedV1CommonPropertiesSchema.extend({
|
|
24
|
+
status: z.literal(SaleStatus.SALE_PICKUP_TIME_CHANGED),
|
|
25
|
+
pickupTime: z.string().datetime(),
|
|
26
|
+
}),
|
|
27
|
+
SalesPosStatusUpdatedV1CommonPropertiesSchema.extend({
|
|
28
|
+
status: z.literal(SaleStatus.SALE_DELIVERY_TIME_CHANGED),
|
|
29
|
+
deliveryTime: z.string().datetime(),
|
|
30
|
+
}),
|
|
31
|
+
SalesPosStatusUpdatedV1CommonPropertiesSchema.extend({
|
|
32
|
+
status: z.literal(SaleStatus.SALE_CANCELLED),
|
|
33
|
+
cancellationReason: z.string(),
|
|
34
|
+
cancelledBy: z.string(),
|
|
35
|
+
}),
|
|
36
|
+
])
|
|
37
|
+
.openapi({
|
|
38
|
+
description: 'Emitted when a sales POS status is updated',
|
|
39
|
+
example: {
|
|
40
|
+
orgId: 'org123',
|
|
41
|
+
brandId: 'br123',
|
|
42
|
+
propertyId: 'p123',
|
|
43
|
+
salesChannelId: 'sc123',
|
|
44
|
+
salesChannelType: SalesChannelTypes.UberEats,
|
|
45
|
+
saleId: 'sale-123',
|
|
46
|
+
externalId: 'sale-external-123',
|
|
47
|
+
status: SaleStatus.SALE_PREPARED_BY_KITCHEN,
|
|
48
|
+
},
|
|
49
|
+
});
|
|
50
|
+
|
|
51
|
+
const SALES_POS_STATUS_UPDATED_V1_WEBHOOK_EXAMPLE = {
|
|
52
|
+
source: 'rms',
|
|
53
|
+
'detail-type': eventType,
|
|
54
|
+
detail: {
|
|
55
|
+
properties: {
|
|
56
|
+
orgId: 'org123',
|
|
57
|
+
brandId: 'br123',
|
|
58
|
+
propertyId: 'p123',
|
|
59
|
+
salesChannelId: 'sc123',
|
|
60
|
+
salesChannelType: SalesChannelTypes.UberEats,
|
|
61
|
+
saleId: 'sale-123',
|
|
62
|
+
externalId: 'sale-external-123',
|
|
63
|
+
status: SaleStatus.SALE_PREPARED_BY_KITCHEN,
|
|
64
|
+
},
|
|
65
|
+
metadata: {
|
|
66
|
+
actorUserId: 123,
|
|
67
|
+
actor: {
|
|
68
|
+
id: 'user-123',
|
|
69
|
+
email: 'user@example.com',
|
|
70
|
+
name: 'John Doe',
|
|
71
|
+
},
|
|
72
|
+
},
|
|
73
|
+
},
|
|
74
|
+
};
|
|
75
|
+
|
|
76
|
+
export const SalesPosStatusUpdatedV1Schema = z
|
|
77
|
+
.object({
|
|
78
|
+
source: z.string().openapi({
|
|
79
|
+
description: 'Source of the event',
|
|
80
|
+
example: 'rms',
|
|
81
|
+
}),
|
|
82
|
+
'detail-type': z.literal(eventType),
|
|
83
|
+
detail: z.object({
|
|
84
|
+
properties: SalesPosStatusUpdatedV1PropertiesSchema,
|
|
85
|
+
metadata: metadataSchema,
|
|
86
|
+
}),
|
|
87
|
+
})
|
|
88
|
+
.openapi({
|
|
89
|
+
description: 'Emitted when a sales POS status is updated',
|
|
90
|
+
'x-webhook-group': 'Sale Status Updated',
|
|
91
|
+
'x-example': SALES_POS_STATUS_UPDATED_V1_WEBHOOK_EXAMPLE,
|
|
92
|
+
});
|
|
93
|
+
|
|
94
|
+
export type SalesPosStatusUpdatedV1 = z.infer<typeof SalesPosStatusUpdatedV1Schema>;
|
package/webhooks/index.js
CHANGED
|
@@ -7,8 +7,8 @@ export const webhookEventTypes = [
|
|
|
7
7
|
rmsSnoozeEvents.MENU_ITEM_UNSNOOZED_V1,
|
|
8
8
|
rmsSnoozeEvents.SALES_CHANNEL_SNOOZED_V1,
|
|
9
9
|
rmsSnoozeEvents.SALES_CHANNEL_UNSNOOZED_V1,
|
|
10
|
-
rmsSalesEvents.
|
|
11
|
-
rmsSalesEvents.
|
|
10
|
+
rmsSalesEvents.SALES_POS_STATUS_UPDATED_V1,
|
|
11
|
+
rmsSalesEvents.SALES_DELIVERY_STATUS_UPDATED_V1,
|
|
12
12
|
];
|
|
13
13
|
// Export a consolidated schema map for all webhook event types we expose
|
|
14
14
|
export const eventSchemaMap = {
|
package/webhooks/index.ts
CHANGED
|
@@ -17,8 +17,8 @@ export const webhookEventTypes = [
|
|
|
17
17
|
rmsSnoozeEvents.MENU_ITEM_UNSNOOZED_V1,
|
|
18
18
|
rmsSnoozeEvents.SALES_CHANNEL_SNOOZED_V1,
|
|
19
19
|
rmsSnoozeEvents.SALES_CHANNEL_UNSNOOZED_V1,
|
|
20
|
-
rmsSalesEvents.
|
|
21
|
-
rmsSalesEvents.
|
|
20
|
+
rmsSalesEvents.SALES_POS_STATUS_UPDATED_V1,
|
|
21
|
+
rmsSalesEvents.SALES_DELIVERY_STATUS_UPDATED_V1,
|
|
22
22
|
] as const;
|
|
23
23
|
|
|
24
24
|
// Export a consolidated schema map for all webhook event types we expose
|
|
@@ -1,99 +0,0 @@
|
|
|
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
|
-
});
|
|
@@ -1,106 +0,0 @@
|
|
|
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>;
|