@open-loyalty/mcp-server 1.0.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.
Files changed (99) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +654 -0
  3. package/dist/client/http.d.ts +8 -0
  4. package/dist/client/http.js +69 -0
  5. package/dist/config.d.ts +17 -0
  6. package/dist/config.js +40 -0
  7. package/dist/index.d.ts +2 -0
  8. package/dist/index.js +20 -0
  9. package/dist/server.d.ts +4 -0
  10. package/dist/server.js +334 -0
  11. package/dist/tools/achievement.d.ts +983 -0
  12. package/dist/tools/achievement.js +311 -0
  13. package/dist/tools/admin.d.ts +153 -0
  14. package/dist/tools/admin.js +193 -0
  15. package/dist/tools/analytics.d.ts +162 -0
  16. package/dist/tools/analytics.js +245 -0
  17. package/dist/tools/apikey.d.ts +72 -0
  18. package/dist/tools/apikey.js +78 -0
  19. package/dist/tools/audit.d.ts +107 -0
  20. package/dist/tools/audit.js +90 -0
  21. package/dist/tools/badge.d.ts +135 -0
  22. package/dist/tools/badge.js +165 -0
  23. package/dist/tools/campaign.d.ts +1775 -0
  24. package/dist/tools/campaign.js +724 -0
  25. package/dist/tools/export.d.ts +110 -0
  26. package/dist/tools/export.js +147 -0
  27. package/dist/tools/import.d.ts +110 -0
  28. package/dist/tools/import.js +126 -0
  29. package/dist/tools/index.d.ts +22 -0
  30. package/dist/tools/index.js +527 -0
  31. package/dist/tools/member.d.ts +345 -0
  32. package/dist/tools/member.js +358 -0
  33. package/dist/tools/member.test.d.ts +1 -0
  34. package/dist/tools/member.test.js +213 -0
  35. package/dist/tools/points.d.ts +188 -0
  36. package/dist/tools/points.js +306 -0
  37. package/dist/tools/points.test.d.ts +1 -0
  38. package/dist/tools/points.test.js +292 -0
  39. package/dist/tools/reward.d.ts +261 -0
  40. package/dist/tools/reward.js +371 -0
  41. package/dist/tools/reward.test.d.ts +1 -0
  42. package/dist/tools/reward.test.js +240 -0
  43. package/dist/tools/role.d.ts +161 -0
  44. package/dist/tools/role.js +160 -0
  45. package/dist/tools/segment.d.ts +797 -0
  46. package/dist/tools/segment.js +299 -0
  47. package/dist/tools/store.d.ts +101 -0
  48. package/dist/tools/store.js +117 -0
  49. package/dist/tools/tierset.d.ts +288 -0
  50. package/dist/tools/tierset.js +244 -0
  51. package/dist/tools/transaction.d.ts +357 -0
  52. package/dist/tools/transaction.js +242 -0
  53. package/dist/tools/transaction.test.d.ts +1 -0
  54. package/dist/tools/transaction.test.js +235 -0
  55. package/dist/tools/wallet-type.d.ts +32 -0
  56. package/dist/tools/wallet-type.js +58 -0
  57. package/dist/tools/webhook.d.ts +179 -0
  58. package/dist/tools/webhook.js +171 -0
  59. package/dist/types/schemas/achievement.d.ts +1116 -0
  60. package/dist/types/schemas/achievement.js +172 -0
  61. package/dist/types/schemas/admin.d.ts +263 -0
  62. package/dist/types/schemas/admin.js +99 -0
  63. package/dist/types/schemas/analytics.d.ts +542 -0
  64. package/dist/types/schemas/analytics.js +130 -0
  65. package/dist/types/schemas/badge.d.ts +131 -0
  66. package/dist/types/schemas/badge.js +48 -0
  67. package/dist/types/schemas/campaign.d.ts +2005 -0
  68. package/dist/types/schemas/campaign.js +189 -0
  69. package/dist/types/schemas/common.d.ts +52 -0
  70. package/dist/types/schemas/common.js +26 -0
  71. package/dist/types/schemas/export.d.ts +127 -0
  72. package/dist/types/schemas/export.js +43 -0
  73. package/dist/types/schemas/import.d.ts +344 -0
  74. package/dist/types/schemas/import.js +68 -0
  75. package/dist/types/schemas/member.d.ts +443 -0
  76. package/dist/types/schemas/member.js +92 -0
  77. package/dist/types/schemas/points.d.ts +188 -0
  78. package/dist/types/schemas/points.js +54 -0
  79. package/dist/types/schemas/reward.d.ts +278 -0
  80. package/dist/types/schemas/reward.js +69 -0
  81. package/dist/types/schemas/role.d.ts +260 -0
  82. package/dist/types/schemas/role.js +75 -0
  83. package/dist/types/schemas/segment.d.ts +592 -0
  84. package/dist/types/schemas/segment.js +114 -0
  85. package/dist/types/schemas/tierset.d.ts +552 -0
  86. package/dist/types/schemas/tierset.js +87 -0
  87. package/dist/types/schemas/transaction.d.ts +1022 -0
  88. package/dist/types/schemas/transaction.js +63 -0
  89. package/dist/types/schemas/wallet-type.d.ts +99 -0
  90. package/dist/types/schemas/wallet-type.js +17 -0
  91. package/dist/types/schemas/webhook.d.ts +195 -0
  92. package/dist/types/schemas/webhook.js +39 -0
  93. package/dist/utils/cursor.d.ts +84 -0
  94. package/dist/utils/cursor.js +117 -0
  95. package/dist/utils/errors.d.ts +12 -0
  96. package/dist/utils/errors.js +69 -0
  97. package/dist/utils/pagination.d.ts +39 -0
  98. package/dist/utils/pagination.js +77 -0
  99. package/package.json +65 -0
@@ -0,0 +1,188 @@
1
+ import { z } from "zod";
2
+ export declare const PointsTransferTypeEnum: z.ZodEnum<["adding", "spending", "p2p_spending", "p2p_adding", "blocked", "expired"]>;
3
+ export declare const PointsTransferSchema: z.ZodObject<{
4
+ transferId: z.ZodString;
5
+ type: z.ZodEnum<["adding", "spending", "p2p_spending", "p2p_adding", "blocked", "expired"]>;
6
+ points: z.ZodNumber;
7
+ comment: z.ZodOptional<z.ZodString>;
8
+ createdAt: z.ZodString;
9
+ expiresAt: z.ZodOptional<z.ZodString>;
10
+ }, "strip", z.ZodTypeAny, {
11
+ type: "adding" | "spending" | "p2p_spending" | "p2p_adding" | "blocked" | "expired";
12
+ createdAt: string;
13
+ points: number;
14
+ transferId: string;
15
+ comment?: string | undefined;
16
+ expiresAt?: string | undefined;
17
+ }, {
18
+ type: "adding" | "spending" | "p2p_spending" | "p2p_adding" | "blocked" | "expired";
19
+ createdAt: string;
20
+ points: number;
21
+ transferId: string;
22
+ comment?: string | undefined;
23
+ expiresAt?: string | undefined;
24
+ }>;
25
+ export declare const PointsBalanceSchema: z.ZodObject<{
26
+ walletId: z.ZodOptional<z.ZodString>;
27
+ activeUnits: z.ZodNumber;
28
+ earnedUnits: z.ZodNumber;
29
+ spentUnits: z.ZodNumber;
30
+ lockedUnits: z.ZodNumber;
31
+ expiredUnits: z.ZodNumber;
32
+ transferredUnits: z.ZodOptional<z.ZodNumber>;
33
+ blockedUnits: z.ZodOptional<z.ZodNumber>;
34
+ }, "strip", z.ZodTypeAny, {
35
+ activeUnits: number;
36
+ earnedUnits: number;
37
+ spentUnits: number;
38
+ lockedUnits: number;
39
+ expiredUnits: number;
40
+ walletId?: string | undefined;
41
+ transferredUnits?: number | undefined;
42
+ blockedUnits?: number | undefined;
43
+ }, {
44
+ activeUnits: number;
45
+ earnedUnits: number;
46
+ spentUnits: number;
47
+ lockedUnits: number;
48
+ expiredUnits: number;
49
+ walletId?: string | undefined;
50
+ transferredUnits?: number | undefined;
51
+ blockedUnits?: number | undefined;
52
+ }>;
53
+ export declare const PointsAddInputSchema: z.ZodObject<{
54
+ storeCode: z.ZodOptional<z.ZodString>;
55
+ memberId: z.ZodString;
56
+ points: z.ZodNumber;
57
+ walletCode: z.ZodOptional<z.ZodString>;
58
+ comment: z.ZodOptional<z.ZodString>;
59
+ expiresInDays: z.ZodOptional<z.ZodNumber>;
60
+ lockedUntilDays: z.ZodOptional<z.ZodNumber>;
61
+ }, "strip", z.ZodTypeAny, {
62
+ memberId: string;
63
+ points: number;
64
+ storeCode?: string | undefined;
65
+ comment?: string | undefined;
66
+ walletCode?: string | undefined;
67
+ expiresInDays?: number | undefined;
68
+ lockedUntilDays?: number | undefined;
69
+ }, {
70
+ memberId: string;
71
+ points: number;
72
+ storeCode?: string | undefined;
73
+ comment?: string | undefined;
74
+ walletCode?: string | undefined;
75
+ expiresInDays?: number | undefined;
76
+ lockedUntilDays?: number | undefined;
77
+ }>;
78
+ export declare const PointsSpendInputSchema: z.ZodObject<{
79
+ storeCode: z.ZodOptional<z.ZodString>;
80
+ memberId: z.ZodString;
81
+ points: z.ZodNumber;
82
+ walletCode: z.ZodOptional<z.ZodString>;
83
+ comment: z.ZodOptional<z.ZodString>;
84
+ }, "strip", z.ZodTypeAny, {
85
+ memberId: string;
86
+ points: number;
87
+ storeCode?: string | undefined;
88
+ comment?: string | undefined;
89
+ walletCode?: string | undefined;
90
+ }, {
91
+ memberId: string;
92
+ points: number;
93
+ storeCode?: string | undefined;
94
+ comment?: string | undefined;
95
+ walletCode?: string | undefined;
96
+ }>;
97
+ export declare const PointsTransferInputSchema: z.ZodObject<{
98
+ storeCode: z.ZodOptional<z.ZodString>;
99
+ senderId: z.ZodString;
100
+ receiverId: z.ZodString;
101
+ points: z.ZodNumber;
102
+ }, "strip", z.ZodTypeAny, {
103
+ points: number;
104
+ senderId: string;
105
+ receiverId: string;
106
+ storeCode?: string | undefined;
107
+ }, {
108
+ points: number;
109
+ senderId: string;
110
+ receiverId: string;
111
+ storeCode?: string | undefined;
112
+ }>;
113
+ export declare const PointsHistoryResponseSchema: z.ZodObject<{
114
+ items: z.ZodArray<z.ZodObject<{
115
+ transferId: z.ZodString;
116
+ type: z.ZodEnum<["adding", "spending", "p2p_spending", "p2p_adding", "blocked", "expired"]>;
117
+ points: z.ZodNumber;
118
+ comment: z.ZodOptional<z.ZodString>;
119
+ createdAt: z.ZodString;
120
+ expiresAt: z.ZodOptional<z.ZodString>;
121
+ }, "strip", z.ZodTypeAny, {
122
+ type: "adding" | "spending" | "p2p_spending" | "p2p_adding" | "blocked" | "expired";
123
+ createdAt: string;
124
+ points: number;
125
+ transferId: string;
126
+ comment?: string | undefined;
127
+ expiresAt?: string | undefined;
128
+ }, {
129
+ type: "adding" | "spending" | "p2p_spending" | "p2p_adding" | "blocked" | "expired";
130
+ createdAt: string;
131
+ points: number;
132
+ transferId: string;
133
+ comment?: string | undefined;
134
+ expiresAt?: string | undefined;
135
+ }>, "many">;
136
+ total: z.ZodObject<{
137
+ all: z.ZodOptional<z.ZodUnion<[z.ZodNumber, z.ZodBoolean]>>;
138
+ filtered: z.ZodOptional<z.ZodUnion<[z.ZodNumber, z.ZodBoolean, z.ZodString]>>;
139
+ estimated: z.ZodOptional<z.ZodUnion<[z.ZodBoolean, z.ZodString, z.ZodNumber]>>;
140
+ }, "passthrough", z.ZodTypeAny, z.objectOutputType<{
141
+ all: z.ZodOptional<z.ZodUnion<[z.ZodNumber, z.ZodBoolean]>>;
142
+ filtered: z.ZodOptional<z.ZodUnion<[z.ZodNumber, z.ZodBoolean, z.ZodString]>>;
143
+ estimated: z.ZodOptional<z.ZodUnion<[z.ZodBoolean, z.ZodString, z.ZodNumber]>>;
144
+ }, z.ZodTypeAny, "passthrough">, z.objectInputType<{
145
+ all: z.ZodOptional<z.ZodUnion<[z.ZodNumber, z.ZodBoolean]>>;
146
+ filtered: z.ZodOptional<z.ZodUnion<[z.ZodNumber, z.ZodBoolean, z.ZodString]>>;
147
+ estimated: z.ZodOptional<z.ZodUnion<[z.ZodBoolean, z.ZodString, z.ZodNumber]>>;
148
+ }, z.ZodTypeAny, "passthrough">>;
149
+ }, "strip", z.ZodTypeAny, {
150
+ items: {
151
+ type: "adding" | "spending" | "p2p_spending" | "p2p_adding" | "blocked" | "expired";
152
+ createdAt: string;
153
+ points: number;
154
+ transferId: string;
155
+ comment?: string | undefined;
156
+ expiresAt?: string | undefined;
157
+ }[];
158
+ total: {
159
+ all?: number | boolean | undefined;
160
+ filtered?: string | number | boolean | undefined;
161
+ estimated?: string | number | boolean | undefined;
162
+ } & {
163
+ [k: string]: unknown;
164
+ };
165
+ }, {
166
+ items: {
167
+ type: "adding" | "spending" | "p2p_spending" | "p2p_adding" | "blocked" | "expired";
168
+ createdAt: string;
169
+ points: number;
170
+ transferId: string;
171
+ comment?: string | undefined;
172
+ expiresAt?: string | undefined;
173
+ }[];
174
+ total: {
175
+ all?: number | boolean | undefined;
176
+ filtered?: string | number | boolean | undefined;
177
+ estimated?: string | number | boolean | undefined;
178
+ } & {
179
+ [k: string]: unknown;
180
+ };
181
+ }>;
182
+ export type PointsTransferType = z.infer<typeof PointsTransferTypeEnum>;
183
+ export type PointsTransfer = z.infer<typeof PointsTransferSchema>;
184
+ export type PointsBalance = z.infer<typeof PointsBalanceSchema>;
185
+ export type PointsAddInput = z.infer<typeof PointsAddInputSchema>;
186
+ export type PointsSpendInput = z.infer<typeof PointsSpendInputSchema>;
187
+ export type PointsTransferInput = z.infer<typeof PointsTransferInputSchema>;
188
+ export type PointsHistoryResponse = z.infer<typeof PointsHistoryResponseSchema>;
@@ -0,0 +1,54 @@
1
+ import { z } from "zod";
2
+ import { TotalSchema } from "./common.js";
3
+ export const PointsTransferTypeEnum = z.enum([
4
+ "adding",
5
+ "spending",
6
+ "p2p_spending",
7
+ "p2p_adding",
8
+ "blocked",
9
+ "expired",
10
+ ]);
11
+ export const PointsTransferSchema = z.object({
12
+ transferId: z.string(),
13
+ type: PointsTransferTypeEnum,
14
+ points: z.number(),
15
+ comment: z.string().optional(),
16
+ createdAt: z.string(),
17
+ expiresAt: z.string().optional(),
18
+ });
19
+ export const PointsBalanceSchema = z.object({
20
+ walletId: z.string().optional(),
21
+ activeUnits: z.number(),
22
+ earnedUnits: z.number(),
23
+ spentUnits: z.number(),
24
+ lockedUnits: z.number(),
25
+ expiredUnits: z.number(),
26
+ transferredUnits: z.number().optional(),
27
+ blockedUnits: z.number().optional(),
28
+ });
29
+ export const PointsAddInputSchema = z.object({
30
+ storeCode: z.string().optional(),
31
+ memberId: z.string(),
32
+ points: z.number(),
33
+ walletCode: z.string().optional(),
34
+ comment: z.string().optional(),
35
+ expiresInDays: z.number().optional(),
36
+ lockedUntilDays: z.number().optional(),
37
+ });
38
+ export const PointsSpendInputSchema = z.object({
39
+ storeCode: z.string().optional(),
40
+ memberId: z.string(),
41
+ points: z.number(),
42
+ walletCode: z.string().optional(),
43
+ comment: z.string().optional(),
44
+ });
45
+ export const PointsTransferInputSchema = z.object({
46
+ storeCode: z.string().optional(),
47
+ senderId: z.string(),
48
+ receiverId: z.string(),
49
+ points: z.number(),
50
+ });
51
+ export const PointsHistoryResponseSchema = z.object({
52
+ items: z.array(PointsTransferSchema),
53
+ total: TotalSchema,
54
+ });
@@ -0,0 +1,278 @@
1
+ import { z } from "zod";
2
+ export declare const RewardTypeEnum: z.ZodEnum<["static_coupon", "dynamic_coupon", "conversion_coupon", "material", "fortune_wheel"]>;
3
+ export declare const RewardCategorySchema: z.ZodObject<{
4
+ categoryId: z.ZodString;
5
+ name: z.ZodString;
6
+ active: z.ZodBoolean;
7
+ }, "strip", z.ZodTypeAny, {
8
+ name: string;
9
+ active: boolean;
10
+ categoryId: string;
11
+ }, {
12
+ name: string;
13
+ active: boolean;
14
+ categoryId: string;
15
+ }>;
16
+ export declare const RewardSchema: z.ZodObject<{
17
+ rewardId: z.ZodString;
18
+ name: z.ZodString;
19
+ type: z.ZodEnum<["static_coupon", "dynamic_coupon", "conversion_coupon", "material", "fortune_wheel"]>;
20
+ costInPoints: z.ZodOptional<z.ZodNumber>;
21
+ active: z.ZodBoolean;
22
+ description: z.ZodOptional<z.ZodString>;
23
+ usageInstruction: z.ZodOptional<z.ZodString>;
24
+ categories: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
25
+ levels: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
26
+ segments: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
27
+ target: z.ZodOptional<z.ZodNullable<z.ZodEnum<["level", "segment"]>>>;
28
+ couponValue: z.ZodOptional<z.ZodNumber>;
29
+ couponValueType: z.ZodOptional<z.ZodEnum<["Money", "Percentage"]>>;
30
+ daysValid: z.ZodOptional<z.ZodNumber>;
31
+ stock: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
32
+ }, "strip", z.ZodTypeAny, {
33
+ type: "static_coupon" | "dynamic_coupon" | "conversion_coupon" | "material" | "fortune_wheel";
34
+ name: string;
35
+ active: boolean;
36
+ rewardId: string;
37
+ description?: string | undefined;
38
+ costInPoints?: number | undefined;
39
+ usageInstruction?: string | undefined;
40
+ categories?: string[] | undefined;
41
+ levels?: string[] | undefined;
42
+ segments?: string[] | undefined;
43
+ target?: "level" | "segment" | null | undefined;
44
+ couponValue?: number | undefined;
45
+ couponValueType?: "Money" | "Percentage" | undefined;
46
+ daysValid?: number | undefined;
47
+ stock?: number | null | undefined;
48
+ }, {
49
+ type: "static_coupon" | "dynamic_coupon" | "conversion_coupon" | "material" | "fortune_wheel";
50
+ name: string;
51
+ active: boolean;
52
+ rewardId: string;
53
+ description?: string | undefined;
54
+ costInPoints?: number | undefined;
55
+ usageInstruction?: string | undefined;
56
+ categories?: string[] | undefined;
57
+ levels?: string[] | undefined;
58
+ segments?: string[] | undefined;
59
+ target?: "level" | "segment" | null | undefined;
60
+ couponValue?: number | undefined;
61
+ couponValueType?: "Money" | "Percentage" | undefined;
62
+ daysValid?: number | undefined;
63
+ stock?: number | null | undefined;
64
+ }>;
65
+ export declare const RewardCreateInputSchema: z.ZodObject<{
66
+ storeCode: z.ZodOptional<z.ZodString>;
67
+ name: z.ZodString;
68
+ type: z.ZodEnum<["static_coupon", "dynamic_coupon", "conversion_coupon", "material", "fortune_wheel"]>;
69
+ costInPoints: z.ZodOptional<z.ZodNumber>;
70
+ description: z.ZodOptional<z.ZodString>;
71
+ usageInstruction: z.ZodOptional<z.ZodString>;
72
+ active: z.ZodOptional<z.ZodBoolean>;
73
+ categories: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
74
+ levels: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
75
+ segments: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
76
+ target: z.ZodOptional<z.ZodNullable<z.ZodEnum<["level", "segment"]>>>;
77
+ couponValue: z.ZodOptional<z.ZodNumber>;
78
+ couponValueType: z.ZodOptional<z.ZodEnum<["Money", "Percentage"]>>;
79
+ daysValid: z.ZodOptional<z.ZodNumber>;
80
+ stock: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
81
+ }, "strip", z.ZodTypeAny, {
82
+ type: "static_coupon" | "dynamic_coupon" | "conversion_coupon" | "material" | "fortune_wheel";
83
+ name: string;
84
+ active?: boolean | undefined;
85
+ description?: string | undefined;
86
+ storeCode?: string | undefined;
87
+ costInPoints?: number | undefined;
88
+ usageInstruction?: string | undefined;
89
+ categories?: string[] | undefined;
90
+ levels?: string[] | undefined;
91
+ segments?: string[] | undefined;
92
+ target?: "level" | "segment" | null | undefined;
93
+ couponValue?: number | undefined;
94
+ couponValueType?: "Money" | "Percentage" | undefined;
95
+ daysValid?: number | undefined;
96
+ stock?: number | null | undefined;
97
+ }, {
98
+ type: "static_coupon" | "dynamic_coupon" | "conversion_coupon" | "material" | "fortune_wheel";
99
+ name: string;
100
+ active?: boolean | undefined;
101
+ description?: string | undefined;
102
+ storeCode?: string | undefined;
103
+ costInPoints?: number | undefined;
104
+ usageInstruction?: string | undefined;
105
+ categories?: string[] | undefined;
106
+ levels?: string[] | undefined;
107
+ segments?: string[] | undefined;
108
+ target?: "level" | "segment" | null | undefined;
109
+ couponValue?: number | undefined;
110
+ couponValueType?: "Money" | "Percentage" | undefined;
111
+ daysValid?: number | undefined;
112
+ stock?: number | null | undefined;
113
+ }>;
114
+ export declare const RewardBuyInputSchema: z.ZodObject<{
115
+ storeCode: z.ZodOptional<z.ZodString>;
116
+ rewardId: z.ZodString;
117
+ memberId: z.ZodString;
118
+ quantity: z.ZodOptional<z.ZodNumber>;
119
+ couponValue: z.ZodOptional<z.ZodNumber>;
120
+ withoutPoints: z.ZodOptional<z.ZodBoolean>;
121
+ }, "strip", z.ZodTypeAny, {
122
+ memberId: string;
123
+ rewardId: string;
124
+ storeCode?: string | undefined;
125
+ couponValue?: number | undefined;
126
+ quantity?: number | undefined;
127
+ withoutPoints?: boolean | undefined;
128
+ }, {
129
+ memberId: string;
130
+ rewardId: string;
131
+ storeCode?: string | undefined;
132
+ couponValue?: number | undefined;
133
+ quantity?: number | undefined;
134
+ withoutPoints?: boolean | undefined;
135
+ }>;
136
+ export declare const IssuedRewardSchema: z.ZodObject<{
137
+ issuedRewardId: z.ZodString;
138
+ rewardId: z.ZodString;
139
+ memberId: z.ZodString;
140
+ couponCode: z.ZodOptional<z.ZodString>;
141
+ status: z.ZodOptional<z.ZodString>;
142
+ issuedAt: z.ZodOptional<z.ZodString>;
143
+ }, "strip", z.ZodTypeAny, {
144
+ memberId: string;
145
+ rewardId: string;
146
+ issuedRewardId: string;
147
+ status?: string | undefined;
148
+ couponCode?: string | undefined;
149
+ issuedAt?: string | undefined;
150
+ }, {
151
+ memberId: string;
152
+ rewardId: string;
153
+ issuedRewardId: string;
154
+ status?: string | undefined;
155
+ couponCode?: string | undefined;
156
+ issuedAt?: string | undefined;
157
+ }>;
158
+ export declare const RewardListResponseSchema: z.ZodObject<{
159
+ items: z.ZodArray<z.ZodObject<{
160
+ rewardId: z.ZodString;
161
+ name: z.ZodString;
162
+ type: z.ZodEnum<["static_coupon", "dynamic_coupon", "conversion_coupon", "material", "fortune_wheel"]>;
163
+ costInPoints: z.ZodOptional<z.ZodNumber>;
164
+ active: z.ZodBoolean;
165
+ description: z.ZodOptional<z.ZodString>;
166
+ usageInstruction: z.ZodOptional<z.ZodString>;
167
+ categories: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
168
+ levels: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
169
+ segments: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
170
+ target: z.ZodOptional<z.ZodNullable<z.ZodEnum<["level", "segment"]>>>;
171
+ couponValue: z.ZodOptional<z.ZodNumber>;
172
+ couponValueType: z.ZodOptional<z.ZodEnum<["Money", "Percentage"]>>;
173
+ daysValid: z.ZodOptional<z.ZodNumber>;
174
+ stock: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
175
+ }, "strip", z.ZodTypeAny, {
176
+ type: "static_coupon" | "dynamic_coupon" | "conversion_coupon" | "material" | "fortune_wheel";
177
+ name: string;
178
+ active: boolean;
179
+ rewardId: string;
180
+ description?: string | undefined;
181
+ costInPoints?: number | undefined;
182
+ usageInstruction?: string | undefined;
183
+ categories?: string[] | undefined;
184
+ levels?: string[] | undefined;
185
+ segments?: string[] | undefined;
186
+ target?: "level" | "segment" | null | undefined;
187
+ couponValue?: number | undefined;
188
+ couponValueType?: "Money" | "Percentage" | undefined;
189
+ daysValid?: number | undefined;
190
+ stock?: number | null | undefined;
191
+ }, {
192
+ type: "static_coupon" | "dynamic_coupon" | "conversion_coupon" | "material" | "fortune_wheel";
193
+ name: string;
194
+ active: boolean;
195
+ rewardId: string;
196
+ description?: string | undefined;
197
+ costInPoints?: number | undefined;
198
+ usageInstruction?: string | undefined;
199
+ categories?: string[] | undefined;
200
+ levels?: string[] | undefined;
201
+ segments?: string[] | undefined;
202
+ target?: "level" | "segment" | null | undefined;
203
+ couponValue?: number | undefined;
204
+ couponValueType?: "Money" | "Percentage" | undefined;
205
+ daysValid?: number | undefined;
206
+ stock?: number | null | undefined;
207
+ }>, "many">;
208
+ total: z.ZodObject<{
209
+ all: z.ZodOptional<z.ZodUnion<[z.ZodNumber, z.ZodBoolean]>>;
210
+ filtered: z.ZodOptional<z.ZodUnion<[z.ZodNumber, z.ZodBoolean, z.ZodString]>>;
211
+ estimated: z.ZodOptional<z.ZodUnion<[z.ZodBoolean, z.ZodString, z.ZodNumber]>>;
212
+ }, "passthrough", z.ZodTypeAny, z.objectOutputType<{
213
+ all: z.ZodOptional<z.ZodUnion<[z.ZodNumber, z.ZodBoolean]>>;
214
+ filtered: z.ZodOptional<z.ZodUnion<[z.ZodNumber, z.ZodBoolean, z.ZodString]>>;
215
+ estimated: z.ZodOptional<z.ZodUnion<[z.ZodBoolean, z.ZodString, z.ZodNumber]>>;
216
+ }, z.ZodTypeAny, "passthrough">, z.objectInputType<{
217
+ all: z.ZodOptional<z.ZodUnion<[z.ZodNumber, z.ZodBoolean]>>;
218
+ filtered: z.ZodOptional<z.ZodUnion<[z.ZodNumber, z.ZodBoolean, z.ZodString]>>;
219
+ estimated: z.ZodOptional<z.ZodUnion<[z.ZodBoolean, z.ZodString, z.ZodNumber]>>;
220
+ }, z.ZodTypeAny, "passthrough">>;
221
+ }, "strip", z.ZodTypeAny, {
222
+ items: {
223
+ type: "static_coupon" | "dynamic_coupon" | "conversion_coupon" | "material" | "fortune_wheel";
224
+ name: string;
225
+ active: boolean;
226
+ rewardId: string;
227
+ description?: string | undefined;
228
+ costInPoints?: number | undefined;
229
+ usageInstruction?: string | undefined;
230
+ categories?: string[] | undefined;
231
+ levels?: string[] | undefined;
232
+ segments?: string[] | undefined;
233
+ target?: "level" | "segment" | null | undefined;
234
+ couponValue?: number | undefined;
235
+ couponValueType?: "Money" | "Percentage" | undefined;
236
+ daysValid?: number | undefined;
237
+ stock?: number | null | undefined;
238
+ }[];
239
+ total: {
240
+ all?: number | boolean | undefined;
241
+ filtered?: string | number | boolean | undefined;
242
+ estimated?: string | number | boolean | undefined;
243
+ } & {
244
+ [k: string]: unknown;
245
+ };
246
+ }, {
247
+ items: {
248
+ type: "static_coupon" | "dynamic_coupon" | "conversion_coupon" | "material" | "fortune_wheel";
249
+ name: string;
250
+ active: boolean;
251
+ rewardId: string;
252
+ description?: string | undefined;
253
+ costInPoints?: number | undefined;
254
+ usageInstruction?: string | undefined;
255
+ categories?: string[] | undefined;
256
+ levels?: string[] | undefined;
257
+ segments?: string[] | undefined;
258
+ target?: "level" | "segment" | null | undefined;
259
+ couponValue?: number | undefined;
260
+ couponValueType?: "Money" | "Percentage" | undefined;
261
+ daysValid?: number | undefined;
262
+ stock?: number | null | undefined;
263
+ }[];
264
+ total: {
265
+ all?: number | boolean | undefined;
266
+ filtered?: string | number | boolean | undefined;
267
+ estimated?: string | number | boolean | undefined;
268
+ } & {
269
+ [k: string]: unknown;
270
+ };
271
+ }>;
272
+ export type RewardType = z.infer<typeof RewardTypeEnum>;
273
+ export type RewardCategory = z.infer<typeof RewardCategorySchema>;
274
+ export type Reward = z.infer<typeof RewardSchema>;
275
+ export type RewardCreateInput = z.infer<typeof RewardCreateInputSchema>;
276
+ export type RewardBuyInput = z.infer<typeof RewardBuyInputSchema>;
277
+ export type IssuedReward = z.infer<typeof IssuedRewardSchema>;
278
+ export type RewardListResponse = z.infer<typeof RewardListResponseSchema>;
@@ -0,0 +1,69 @@
1
+ import { z } from "zod";
2
+ import { TotalSchema } from "./common.js";
3
+ export const RewardTypeEnum = z.enum([
4
+ "static_coupon",
5
+ "dynamic_coupon",
6
+ "conversion_coupon",
7
+ "material",
8
+ "fortune_wheel",
9
+ ]);
10
+ export const RewardCategorySchema = z.object({
11
+ categoryId: z.string(),
12
+ name: z.string(),
13
+ active: z.boolean(),
14
+ });
15
+ export const RewardSchema = z.object({
16
+ rewardId: z.string(),
17
+ name: z.string(),
18
+ type: RewardTypeEnum,
19
+ costInPoints: z.number().optional(),
20
+ active: z.boolean(),
21
+ description: z.string().optional(),
22
+ usageInstruction: z.string().optional(),
23
+ categories: z.array(z.string()).optional(),
24
+ levels: z.array(z.string()).optional(),
25
+ segments: z.array(z.string()).optional(),
26
+ target: z.enum(["level", "segment"]).nullable().optional(),
27
+ couponValue: z.number().optional(),
28
+ couponValueType: z.enum(["Money", "Percentage"]).optional(),
29
+ daysValid: z.number().optional(),
30
+ stock: z.number().nullable().optional(),
31
+ });
32
+ export const RewardCreateInputSchema = z.object({
33
+ storeCode: z.string().optional(),
34
+ name: z.string(),
35
+ type: RewardTypeEnum,
36
+ costInPoints: z.number().optional(),
37
+ description: z.string().optional(),
38
+ usageInstruction: z.string().optional(),
39
+ active: z.boolean().optional(),
40
+ categories: z.array(z.string()).optional(),
41
+ levels: z.array(z.string()).optional(),
42
+ segments: z.array(z.string()).optional(),
43
+ target: z.enum(["level", "segment"]).nullable().optional(),
44
+ couponValue: z.number().optional(),
45
+ couponValueType: z.enum(["Money", "Percentage"]).optional(),
46
+ daysValid: z.number().optional(),
47
+ stock: z.number().nullable().optional(),
48
+ });
49
+ export const RewardBuyInputSchema = z.object({
50
+ storeCode: z.string().optional(),
51
+ rewardId: z.string(),
52
+ memberId: z.string(),
53
+ quantity: z.number().optional(),
54
+ couponValue: z.number().optional(),
55
+ withoutPoints: z.boolean().optional(),
56
+ });
57
+ export const IssuedRewardSchema = z.object({
58
+ issuedRewardId: z.string(),
59
+ rewardId: z.string(),
60
+ memberId: z.string(),
61
+ couponCode: z.string().optional(),
62
+ status: z.string().optional(),
63
+ issuedAt: z.string().optional(),
64
+ });
65
+ // API returns { items: [...], total: {...} }
66
+ export const RewardListResponseSchema = z.object({
67
+ items: z.array(RewardSchema),
68
+ total: TotalSchema,
69
+ });