@flipdish/events 1.25350.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 +34 -13
- package/rms/sales/sales.delivery.status.updated.v1.ts +35 -15
- package/rms/sales/{sales.status.updated.v1.js → sales.pos.status.updated.v1.js} +17 -13
- package/rms/sales/{sales.status.updated.v1.ts → sales.pos.status.updated.v1.ts} +18 -14
- package/webhooks/index.js +2 -2
- package/webhooks/index.ts +2 -2
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,52 +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({
|
|
6
7
|
orgId: z.string(),
|
|
7
8
|
brandId: z.string(),
|
|
8
9
|
propertyId: z.string(),
|
|
9
10
|
salesChannelId: z.string(),
|
|
11
|
+
salesChannelType: z.nativeEnum(SalesChannelTypes),
|
|
10
12
|
saleId: z.string(),
|
|
11
13
|
externalId: z.string().optional(),
|
|
12
14
|
});
|
|
13
|
-
const
|
|
15
|
+
const SalesDeliveryStatusUpdatedV1PropertiesSchema = z
|
|
14
16
|
.discriminatedUnion('status', [
|
|
15
|
-
|
|
17
|
+
SalesDeliveryStatusUpdatedV1CommonPropertiesSchema.extend({
|
|
16
18
|
status: z.literal(DeliveryStatus.SALE_DISPATCHED),
|
|
17
19
|
dispatchTime: z.string().datetime(),
|
|
18
20
|
}),
|
|
19
|
-
|
|
21
|
+
SalesDeliveryStatusUpdatedV1CommonPropertiesSchema.extend({
|
|
20
22
|
status: z.literal(DeliveryStatus.SALE_ON_THE_WAY),
|
|
21
23
|
dispatchTime: z.string().datetime(),
|
|
22
24
|
}),
|
|
23
|
-
|
|
25
|
+
SalesDeliveryStatusUpdatedV1CommonPropertiesSchema.extend({
|
|
24
26
|
status: z.literal(DeliveryStatus.SALE_DELIVERED),
|
|
25
27
|
deliveryTime: z.string().datetime(),
|
|
26
28
|
}),
|
|
27
29
|
])
|
|
28
30
|
.openapi({
|
|
29
|
-
description: 'Emitted when a
|
|
31
|
+
description: 'Emitted when a sales delivery status is updated',
|
|
30
32
|
example: {
|
|
31
33
|
orgId: 'org123',
|
|
32
34
|
brandId: 'br123',
|
|
33
35
|
propertyId: 'p123',
|
|
34
36
|
salesChannelId: 'sc123',
|
|
37
|
+
salesChannelType: SalesChannelTypes.UberEats,
|
|
35
38
|
saleId: 'sale-123',
|
|
36
39
|
externalId: 'sale-external-123',
|
|
37
40
|
status: DeliveryStatus.SALE_DISPATCHED,
|
|
38
41
|
dispatchTime: '2025-01-01T00:00:00Z',
|
|
39
42
|
},
|
|
40
43
|
});
|
|
41
|
-
const
|
|
44
|
+
const SALES_DELIVERY_STATUS_UPDATED_V1_WEBHOOK_EXAMPLE = {
|
|
42
45
|
source: 'rms',
|
|
43
46
|
'detail-type': eventType,
|
|
44
47
|
detail: {
|
|
45
|
-
properties:
|
|
46
|
-
|
|
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
|
+
},
|
|
47
67
|
},
|
|
48
68
|
};
|
|
49
|
-
export const
|
|
69
|
+
export const SalesDeliveryStatusUpdatedV1Schema = z
|
|
50
70
|
.object({
|
|
51
71
|
source: z.string().openapi({
|
|
52
72
|
description: 'Source of the event',
|
|
@@ -54,11 +74,12 @@ export const SaleDeliveryStatusUpdatedV1Schema = z
|
|
|
54
74
|
}),
|
|
55
75
|
'detail-type': z.literal(eventType),
|
|
56
76
|
detail: z.object({
|
|
57
|
-
properties:
|
|
77
|
+
properties: SalesDeliveryStatusUpdatedV1PropertiesSchema,
|
|
58
78
|
metadata: metadataSchema,
|
|
59
79
|
}),
|
|
60
80
|
})
|
|
61
81
|
.openapi({
|
|
62
|
-
description: 'Emitted when a
|
|
63
|
-
'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,
|
|
64
85
|
});
|
|
@@ -1,40 +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({
|
|
8
9
|
orgId: z.string(),
|
|
9
10
|
brandId: z.string(),
|
|
10
11
|
propertyId: z.string(),
|
|
11
12
|
salesChannelId: z.string(),
|
|
13
|
+
salesChannelType: z.nativeEnum(SalesChannelTypes),
|
|
12
14
|
saleId: z.string(),
|
|
13
15
|
externalId: z.string().optional(),
|
|
14
16
|
});
|
|
15
17
|
|
|
16
|
-
const
|
|
18
|
+
const SalesDeliveryStatusUpdatedV1PropertiesSchema = z
|
|
17
19
|
.discriminatedUnion('status', [
|
|
18
|
-
|
|
20
|
+
SalesDeliveryStatusUpdatedV1CommonPropertiesSchema.extend({
|
|
19
21
|
status: z.literal(DeliveryStatus.SALE_DISPATCHED),
|
|
20
22
|
dispatchTime: z.string().datetime(),
|
|
21
23
|
}),
|
|
22
|
-
|
|
24
|
+
SalesDeliveryStatusUpdatedV1CommonPropertiesSchema.extend({
|
|
23
25
|
status: z.literal(DeliveryStatus.SALE_ON_THE_WAY),
|
|
24
26
|
dispatchTime: z.string().datetime(),
|
|
25
27
|
}),
|
|
26
|
-
|
|
28
|
+
SalesDeliveryStatusUpdatedV1CommonPropertiesSchema.extend({
|
|
27
29
|
status: z.literal(DeliveryStatus.SALE_DELIVERED),
|
|
28
30
|
deliveryTime: z.string().datetime(),
|
|
29
31
|
}),
|
|
30
32
|
])
|
|
31
33
|
.openapi({
|
|
32
|
-
description: 'Emitted when a
|
|
34
|
+
description: 'Emitted when a sales delivery status is updated',
|
|
33
35
|
example: {
|
|
34
36
|
orgId: 'org123',
|
|
35
37
|
brandId: 'br123',
|
|
36
38
|
propertyId: 'p123',
|
|
37
39
|
salesChannelId: 'sc123',
|
|
40
|
+
salesChannelType: SalesChannelTypes.UberEats,
|
|
38
41
|
saleId: 'sale-123',
|
|
39
42
|
externalId: 'sale-external-123',
|
|
40
43
|
status: DeliveryStatus.SALE_DISPATCHED,
|
|
@@ -42,16 +45,32 @@ const SaleDeliveryStatusUpdatedV1PropertiesSchema = z
|
|
|
42
45
|
},
|
|
43
46
|
});
|
|
44
47
|
|
|
45
|
-
const
|
|
48
|
+
const SALES_DELIVERY_STATUS_UPDATED_V1_WEBHOOK_EXAMPLE = {
|
|
46
49
|
source: 'rms',
|
|
47
50
|
'detail-type': eventType,
|
|
48
51
|
detail: {
|
|
49
|
-
properties:
|
|
50
|
-
|
|
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
|
+
},
|
|
51
71
|
},
|
|
52
72
|
};
|
|
53
|
-
|
|
54
|
-
export const SaleDeliveryStatusUpdatedV1Schema = z
|
|
73
|
+
export const SalesDeliveryStatusUpdatedV1Schema = z
|
|
55
74
|
.object({
|
|
56
75
|
source: z.string().openapi({
|
|
57
76
|
description: 'Source of the event',
|
|
@@ -59,13 +78,14 @@ export const SaleDeliveryStatusUpdatedV1Schema = z
|
|
|
59
78
|
}),
|
|
60
79
|
'detail-type': z.literal(eventType),
|
|
61
80
|
detail: z.object({
|
|
62
|
-
properties:
|
|
81
|
+
properties: SalesDeliveryStatusUpdatedV1PropertiesSchema,
|
|
63
82
|
metadata: metadataSchema,
|
|
64
83
|
}),
|
|
65
84
|
})
|
|
66
85
|
.openapi({
|
|
67
|
-
description: 'Emitted when a
|
|
68
|
-
'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,
|
|
69
89
|
});
|
|
70
90
|
|
|
71
|
-
export type
|
|
91
|
+
export type SalesDeliveryStatusUpdatedV1 = z.infer<typeof SalesDeliveryStatusUpdatedV1Schema>;
|
|
@@ -1,47 +1,50 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
2
|
import { metadataSchema } from '../../metadata.js';
|
|
3
|
+
import { SalesChannelTypes } from '../../rms/constants.js';
|
|
3
4
|
import { SaleStatus } from './constants.js';
|
|
4
|
-
export const eventType = 'sales.status.updated.v1';
|
|
5
|
-
const
|
|
5
|
+
export const eventType = 'sales.pos.status.updated.v1';
|
|
6
|
+
const SalesPosStatusUpdatedV1CommonPropertiesSchema = z.object({
|
|
6
7
|
orgId: z.string(),
|
|
7
8
|
brandId: z.string(),
|
|
8
9
|
propertyId: z.string(),
|
|
9
10
|
salesChannelId: z.string(),
|
|
11
|
+
salesChannelType: z.nativeEnum(SalesChannelTypes),
|
|
10
12
|
saleId: z.string(),
|
|
11
13
|
externalId: z.string().optional(),
|
|
12
14
|
});
|
|
13
|
-
const
|
|
15
|
+
const SalesPosStatusUpdatedV1PropertiesSchema = z
|
|
14
16
|
.discriminatedUnion('status', [
|
|
15
|
-
|
|
17
|
+
SalesPosStatusUpdatedV1CommonPropertiesSchema.extend({
|
|
16
18
|
status: z.literal(SaleStatus.SALE_PREPARED_BY_KITCHEN),
|
|
17
19
|
}),
|
|
18
|
-
|
|
20
|
+
SalesPosStatusUpdatedV1CommonPropertiesSchema.extend({
|
|
19
21
|
status: z.literal(SaleStatus.SALE_PICKUP_TIME_CHANGED),
|
|
20
22
|
pickupTime: z.string().datetime(),
|
|
21
23
|
}),
|
|
22
|
-
|
|
24
|
+
SalesPosStatusUpdatedV1CommonPropertiesSchema.extend({
|
|
23
25
|
status: z.literal(SaleStatus.SALE_DELIVERY_TIME_CHANGED),
|
|
24
26
|
deliveryTime: z.string().datetime(),
|
|
25
27
|
}),
|
|
26
|
-
|
|
28
|
+
SalesPosStatusUpdatedV1CommonPropertiesSchema.extend({
|
|
27
29
|
status: z.literal(SaleStatus.SALE_CANCELLED),
|
|
28
30
|
cancellationReason: z.string(),
|
|
29
31
|
cancelledBy: z.string(),
|
|
30
32
|
}),
|
|
31
33
|
])
|
|
32
34
|
.openapi({
|
|
33
|
-
description: 'Emitted when a
|
|
35
|
+
description: 'Emitted when a sales POS status is updated',
|
|
34
36
|
example: {
|
|
35
37
|
orgId: 'org123',
|
|
36
38
|
brandId: 'br123',
|
|
37
39
|
propertyId: 'p123',
|
|
38
40
|
salesChannelId: 'sc123',
|
|
41
|
+
salesChannelType: SalesChannelTypes.UberEats,
|
|
39
42
|
saleId: 'sale-123',
|
|
40
43
|
externalId: 'sale-external-123',
|
|
41
44
|
status: SaleStatus.SALE_PREPARED_BY_KITCHEN,
|
|
42
45
|
},
|
|
43
46
|
});
|
|
44
|
-
const
|
|
47
|
+
const SALES_POS_STATUS_UPDATED_V1_WEBHOOK_EXAMPLE = {
|
|
45
48
|
source: 'rms',
|
|
46
49
|
'detail-type': eventType,
|
|
47
50
|
detail: {
|
|
@@ -50,6 +53,7 @@ const SALE_STATUS_UPDATED_V1_WEBHOOK_EXAMPLE = {
|
|
|
50
53
|
brandId: 'br123',
|
|
51
54
|
propertyId: 'p123',
|
|
52
55
|
salesChannelId: 'sc123',
|
|
56
|
+
salesChannelType: SalesChannelTypes.UberEats,
|
|
53
57
|
saleId: 'sale-123',
|
|
54
58
|
externalId: 'sale-external-123',
|
|
55
59
|
status: SaleStatus.SALE_PREPARED_BY_KITCHEN,
|
|
@@ -64,7 +68,7 @@ const SALE_STATUS_UPDATED_V1_WEBHOOK_EXAMPLE = {
|
|
|
64
68
|
},
|
|
65
69
|
},
|
|
66
70
|
};
|
|
67
|
-
export const
|
|
71
|
+
export const SalesPosStatusUpdatedV1Schema = z
|
|
68
72
|
.object({
|
|
69
73
|
source: z.string().openapi({
|
|
70
74
|
description: 'Source of the event',
|
|
@@ -72,12 +76,12 @@ export const SaleStatusUpdatedV1Schema = z
|
|
|
72
76
|
}),
|
|
73
77
|
'detail-type': z.literal(eventType),
|
|
74
78
|
detail: z.object({
|
|
75
|
-
properties:
|
|
79
|
+
properties: SalesPosStatusUpdatedV1PropertiesSchema,
|
|
76
80
|
metadata: metadataSchema,
|
|
77
81
|
}),
|
|
78
82
|
})
|
|
79
83
|
.openapi({
|
|
80
|
-
description: 'Emitted when a
|
|
84
|
+
description: 'Emitted when a sales POS status is updated',
|
|
81
85
|
'x-webhook-group': 'Sale Status Updated',
|
|
82
|
-
'x-example':
|
|
86
|
+
'x-example': SALES_POS_STATUS_UPDATED_V1_WEBHOOK_EXAMPLE,
|
|
83
87
|
});
|
|
@@ -1,51 +1,54 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
2
|
import { metadataSchema } from '../../metadata.js';
|
|
3
|
+
import { SalesChannelTypes } from '../../rms/constants.js';
|
|
3
4
|
import { SaleStatus } from './constants.js';
|
|
4
5
|
|
|
5
|
-
export const eventType = 'sales.status.updated.v1';
|
|
6
|
+
export const eventType = 'sales.pos.status.updated.v1';
|
|
6
7
|
|
|
7
|
-
const
|
|
8
|
+
const SalesPosStatusUpdatedV1CommonPropertiesSchema = z.object({
|
|
8
9
|
orgId: z.string(),
|
|
9
10
|
brandId: z.string(),
|
|
10
11
|
propertyId: z.string(),
|
|
11
12
|
salesChannelId: z.string(),
|
|
13
|
+
salesChannelType: z.nativeEnum(SalesChannelTypes),
|
|
12
14
|
saleId: z.string(),
|
|
13
15
|
externalId: z.string().optional(),
|
|
14
16
|
});
|
|
15
17
|
|
|
16
|
-
const
|
|
18
|
+
const SalesPosStatusUpdatedV1PropertiesSchema = z
|
|
17
19
|
.discriminatedUnion('status', [
|
|
18
|
-
|
|
20
|
+
SalesPosStatusUpdatedV1CommonPropertiesSchema.extend({
|
|
19
21
|
status: z.literal(SaleStatus.SALE_PREPARED_BY_KITCHEN),
|
|
20
22
|
}),
|
|
21
|
-
|
|
23
|
+
SalesPosStatusUpdatedV1CommonPropertiesSchema.extend({
|
|
22
24
|
status: z.literal(SaleStatus.SALE_PICKUP_TIME_CHANGED),
|
|
23
25
|
pickupTime: z.string().datetime(),
|
|
24
26
|
}),
|
|
25
|
-
|
|
27
|
+
SalesPosStatusUpdatedV1CommonPropertiesSchema.extend({
|
|
26
28
|
status: z.literal(SaleStatus.SALE_DELIVERY_TIME_CHANGED),
|
|
27
29
|
deliveryTime: z.string().datetime(),
|
|
28
30
|
}),
|
|
29
|
-
|
|
31
|
+
SalesPosStatusUpdatedV1CommonPropertiesSchema.extend({
|
|
30
32
|
status: z.literal(SaleStatus.SALE_CANCELLED),
|
|
31
33
|
cancellationReason: z.string(),
|
|
32
34
|
cancelledBy: z.string(),
|
|
33
35
|
}),
|
|
34
36
|
])
|
|
35
37
|
.openapi({
|
|
36
|
-
description: 'Emitted when a
|
|
38
|
+
description: 'Emitted when a sales POS status is updated',
|
|
37
39
|
example: {
|
|
38
40
|
orgId: 'org123',
|
|
39
41
|
brandId: 'br123',
|
|
40
42
|
propertyId: 'p123',
|
|
41
43
|
salesChannelId: 'sc123',
|
|
44
|
+
salesChannelType: SalesChannelTypes.UberEats,
|
|
42
45
|
saleId: 'sale-123',
|
|
43
46
|
externalId: 'sale-external-123',
|
|
44
47
|
status: SaleStatus.SALE_PREPARED_BY_KITCHEN,
|
|
45
48
|
},
|
|
46
49
|
});
|
|
47
50
|
|
|
48
|
-
const
|
|
51
|
+
const SALES_POS_STATUS_UPDATED_V1_WEBHOOK_EXAMPLE = {
|
|
49
52
|
source: 'rms',
|
|
50
53
|
'detail-type': eventType,
|
|
51
54
|
detail: {
|
|
@@ -54,6 +57,7 @@ const SALE_STATUS_UPDATED_V1_WEBHOOK_EXAMPLE = {
|
|
|
54
57
|
brandId: 'br123',
|
|
55
58
|
propertyId: 'p123',
|
|
56
59
|
salesChannelId: 'sc123',
|
|
60
|
+
salesChannelType: SalesChannelTypes.UberEats,
|
|
57
61
|
saleId: 'sale-123',
|
|
58
62
|
externalId: 'sale-external-123',
|
|
59
63
|
status: SaleStatus.SALE_PREPARED_BY_KITCHEN,
|
|
@@ -69,7 +73,7 @@ const SALE_STATUS_UPDATED_V1_WEBHOOK_EXAMPLE = {
|
|
|
69
73
|
},
|
|
70
74
|
};
|
|
71
75
|
|
|
72
|
-
export const
|
|
76
|
+
export const SalesPosStatusUpdatedV1Schema = z
|
|
73
77
|
.object({
|
|
74
78
|
source: z.string().openapi({
|
|
75
79
|
description: 'Source of the event',
|
|
@@ -77,14 +81,14 @@ export const SaleStatusUpdatedV1Schema = z
|
|
|
77
81
|
}),
|
|
78
82
|
'detail-type': z.literal(eventType),
|
|
79
83
|
detail: z.object({
|
|
80
|
-
properties:
|
|
84
|
+
properties: SalesPosStatusUpdatedV1PropertiesSchema,
|
|
81
85
|
metadata: metadataSchema,
|
|
82
86
|
}),
|
|
83
87
|
})
|
|
84
88
|
.openapi({
|
|
85
|
-
description: 'Emitted when a
|
|
89
|
+
description: 'Emitted when a sales POS status is updated',
|
|
86
90
|
'x-webhook-group': 'Sale Status Updated',
|
|
87
|
-
'x-example':
|
|
91
|
+
'x-example': SALES_POS_STATUS_UPDATED_V1_WEBHOOK_EXAMPLE,
|
|
88
92
|
});
|
|
89
93
|
|
|
90
|
-
export type
|
|
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
|