@btst/plugin-affiliate 0.0.0-stage → 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 (79) hide show
  1. package/LICENSE.md +17 -0
  2. package/dist/api/getters.cjs +182 -0
  3. package/dist/api/getters.mjs +166 -0
  4. package/dist/api/index.cjs +49 -0
  5. package/dist/api/index.d.cts +975 -0
  6. package/dist/api/index.d.mts +975 -0
  7. package/dist/api/index.d.ts +975 -0
  8. package/dist/api/index.mjs +7 -0
  9. package/dist/api/mutations.cjs +362 -0
  10. package/dist/api/mutations.mjs +352 -0
  11. package/dist/api/operations.cjs +328 -0
  12. package/dist/api/operations.mjs +326 -0
  13. package/dist/api/plugin.cjs +146 -0
  14. package/dist/api/plugin.mjs +144 -0
  15. package/dist/attribution.cjs +92 -0
  16. package/dist/attribution.d.cts +20 -0
  17. package/dist/attribution.d.mts +20 -0
  18. package/dist/attribution.d.ts +20 -0
  19. package/dist/attribution.mjs +82 -0
  20. package/dist/client/components/index.cjs +12 -0
  21. package/dist/client/components/index.d.cts +13 -0
  22. package/dist/client/components/index.d.mts +13 -0
  23. package/dist/client/components/index.d.ts +13 -0
  24. package/dist/client/components/index.mjs +1 -0
  25. package/dist/client/components/pages/affiliate-apply-page.internal.cjs +59 -0
  26. package/dist/client/components/pages/affiliate-apply-page.internal.mjs +57 -0
  27. package/dist/client/components/pages/affiliate-detail-page.internal.cjs +112 -0
  28. package/dist/client/components/pages/affiliate-detail-page.internal.mjs +110 -0
  29. package/dist/client/components/pages/affiliate-portal-page.internal.cjs +252 -0
  30. package/dist/client/components/pages/affiliate-portal-page.internal.mjs +250 -0
  31. package/dist/client/components/pages/affiliates-page.internal.cjs +160 -0
  32. package/dist/client/components/pages/affiliates-page.internal.mjs +158 -0
  33. package/dist/client/components/pages/commissions-page.internal.cjs +151 -0
  34. package/dist/client/components/pages/commissions-page.internal.mjs +149 -0
  35. package/dist/client/components/pages/payouts-page.internal.cjs +230 -0
  36. package/dist/client/components/pages/payouts-page.internal.mjs +228 -0
  37. package/dist/client/components/pages.cjs +145 -0
  38. package/dist/client/components/pages.mjs +138 -0
  39. package/dist/client/components/shared.cjs +331 -0
  40. package/dist/client/components/shared.mjs +316 -0
  41. package/dist/client/constants.cjs +5 -0
  42. package/dist/client/constants.mjs +3 -0
  43. package/dist/client/hooks/index.cjs +77 -0
  44. package/dist/client/hooks/index.d.cts +39 -0
  45. package/dist/client/hooks/index.d.mts +39 -0
  46. package/dist/client/hooks/index.d.ts +39 -0
  47. package/dist/client/hooks/index.mjs +61 -0
  48. package/dist/client/index.cjs +7 -0
  49. package/dist/client/index.d.cts +110 -0
  50. package/dist/client/index.d.mts +110 -0
  51. package/dist/client/index.d.ts +110 -0
  52. package/dist/client/index.mjs +1 -0
  53. package/dist/client/plugin.cjs +77 -0
  54. package/dist/client/plugin.mjs +75 -0
  55. package/dist/client.css +311 -0
  56. package/dist/commission.cjs +24 -0
  57. package/dist/commission.mjs +22 -0
  58. package/dist/db.cjs +74 -0
  59. package/dist/db.mjs +72 -0
  60. package/dist/permissions.cjs +53 -0
  61. package/dist/permissions.d.cts +78 -0
  62. package/dist/permissions.d.mts +78 -0
  63. package/dist/permissions.d.ts +78 -0
  64. package/dist/permissions.mjs +51 -0
  65. package/dist/query-keys.cjs +152 -0
  66. package/dist/query-keys.d.cts +394 -0
  67. package/dist/query-keys.d.mts +394 -0
  68. package/dist/query-keys.d.ts +394 -0
  69. package/dist/query-keys.mjs +149 -0
  70. package/dist/schemas.cjs +95 -0
  71. package/dist/schemas.mjs +77 -0
  72. package/dist/style.css +313 -0
  73. package/dist/types.cjs +2 -0
  74. package/dist/types.d.cts +176 -0
  75. package/dist/types.d.mts +176 -0
  76. package/dist/types.d.ts +176 -0
  77. package/dist/types.mjs +1 -0
  78. package/package.json +159 -3
  79. package/README.md +0 -3
@@ -0,0 +1,394 @@
1
+ import * as _btst_stack_plugins_client from '@btst/stack/plugins/client';
2
+ import { ResourceClient } from '@btst/stack/plugins/client';
3
+ import { CreateAffiliateInput, UpdateAffiliateInput, ListParams, ListResult, Affiliate, AffiliateStats, AffiliatePortal, Commission, Payout, CreatePayoutInput } from './types.cjs';
4
+
5
+ type AffiliateApplicationInput = Omit<CreateAffiliateInput, "userId">;
6
+ type AffiliatePortalInput = Pick<UpdateAffiliateInput, "name" | "email" | "code" | "payoutDetails">;
7
+ /** Shared declarations keep client hooks and server query consumers on the same keys. */
8
+ declare const affiliateResources: {
9
+ affiliates: {
10
+ queries: {
11
+ list: {
12
+ path: string;
13
+ query: (params?: ListParams, _partition?: unknown) => {
14
+ limit?: number;
15
+ offset?: number;
16
+ affiliateId?: string;
17
+ status?: string;
18
+ currency?: string;
19
+ };
20
+ select: (data: unknown) => ListResult<Affiliate>;
21
+ };
22
+ detail: {
23
+ path: string;
24
+ params: (id: string, _partition?: unknown) => {
25
+ id: string;
26
+ };
27
+ select: (data: unknown) => {
28
+ affiliate: Affiliate;
29
+ stats: AffiliateStats;
30
+ };
31
+ };
32
+ };
33
+ mutations: {
34
+ create: {
35
+ path: string;
36
+ method: "POST";
37
+ input: (body: CreateAffiliateInput) => {
38
+ body: CreateAffiliateInput;
39
+ };
40
+ select: (data: unknown) => Affiliate;
41
+ invalidates: string[];
42
+ refresh: false;
43
+ };
44
+ update: {
45
+ path: string;
46
+ method: "PUT";
47
+ input: ({ id, data }: {
48
+ id: string;
49
+ data: UpdateAffiliateInput;
50
+ }) => {
51
+ params: {
52
+ id: string;
53
+ };
54
+ body: UpdateAffiliateInput;
55
+ };
56
+ select: (data: unknown) => Affiliate;
57
+ invalidates: string[];
58
+ refresh: false;
59
+ };
60
+ delete: {
61
+ path: string;
62
+ method: "DELETE";
63
+ input: (id: string) => {
64
+ params: {
65
+ id: string;
66
+ };
67
+ };
68
+ invalidates: string[];
69
+ refresh: false;
70
+ };
71
+ };
72
+ };
73
+ affiliatePortal: {
74
+ queries: {
75
+ detail: {
76
+ path: string;
77
+ key: (partition?: unknown) => unknown[];
78
+ select: (data: unknown) => AffiliatePortal;
79
+ };
80
+ };
81
+ mutations: {
82
+ apply: {
83
+ path: string;
84
+ method: "POST";
85
+ input: (body: AffiliateApplicationInput) => {
86
+ body: AffiliateApplicationInput;
87
+ };
88
+ select: (data: unknown) => Affiliate;
89
+ invalidates: string[];
90
+ refresh: false;
91
+ };
92
+ update: {
93
+ path: string;
94
+ method: "PUT";
95
+ input: (body: AffiliatePortalInput) => {
96
+ body: AffiliatePortalInput;
97
+ };
98
+ select: (data: unknown) => Affiliate;
99
+ invalidates: string[];
100
+ refresh: false;
101
+ };
102
+ };
103
+ };
104
+ affiliateCommissions: {
105
+ queries: {
106
+ list: {
107
+ path: string;
108
+ query: (params?: ListParams, _partition?: unknown) => {
109
+ limit?: number;
110
+ offset?: number;
111
+ affiliateId?: string;
112
+ status?: string;
113
+ currency?: string;
114
+ };
115
+ select: (data: unknown) => ListResult<Commission>;
116
+ };
117
+ };
118
+ mutations: {
119
+ update: {
120
+ path: string;
121
+ method: "PUT";
122
+ input: ({ id, status, }: {
123
+ id: string;
124
+ status: "approved" | "voided";
125
+ }) => {
126
+ params: {
127
+ id: string;
128
+ };
129
+ body: {
130
+ status: "approved" | "voided";
131
+ };
132
+ };
133
+ select: (data: unknown) => Commission;
134
+ invalidates: string[];
135
+ refresh: false;
136
+ };
137
+ };
138
+ };
139
+ affiliatePayouts: {
140
+ queries: {
141
+ list: {
142
+ path: string;
143
+ query: (params?: ListParams, _partition?: unknown) => {
144
+ limit?: number;
145
+ offset?: number;
146
+ affiliateId?: string;
147
+ status?: string;
148
+ currency?: string;
149
+ };
150
+ select: (data: unknown) => ListResult<Payout>;
151
+ };
152
+ export: {
153
+ path: string;
154
+ query: (params?: ListParams, _partition?: unknown) => {
155
+ limit?: number;
156
+ offset?: number;
157
+ affiliateId?: string;
158
+ status?: string;
159
+ currency?: string;
160
+ };
161
+ select: (data: unknown) => {
162
+ csv: string;
163
+ };
164
+ };
165
+ };
166
+ mutations: {
167
+ create: {
168
+ path: string;
169
+ method: "POST";
170
+ input: (body: CreatePayoutInput) => {
171
+ body: CreatePayoutInput;
172
+ };
173
+ select: (data: unknown) => Payout;
174
+ invalidates: string[];
175
+ refresh: false;
176
+ };
177
+ update: {
178
+ path: string;
179
+ method: "PUT";
180
+ input: ({ id, ...body }: {
181
+ id: string;
182
+ status: "sent" | "failed";
183
+ reference?: string;
184
+ }) => {
185
+ params: {
186
+ id: string;
187
+ };
188
+ body: {
189
+ status: "sent" | "failed";
190
+ reference?: string;
191
+ };
192
+ };
193
+ select: (data: unknown) => Payout;
194
+ invalidates: string[];
195
+ refresh: false;
196
+ };
197
+ };
198
+ };
199
+ };
200
+ declare function createAffiliateQueryKeys(client: ResourceClient, headers?: HeadersInit): _btst_stack_plugins_client.ResourceQueryKeys<{
201
+ affiliates: {
202
+ queries: {
203
+ list: {
204
+ path: string;
205
+ query: (params?: ListParams, _partition?: unknown) => {
206
+ limit?: number;
207
+ offset?: number;
208
+ affiliateId?: string;
209
+ status?: string;
210
+ currency?: string;
211
+ };
212
+ select: (data: unknown) => ListResult<Affiliate>;
213
+ };
214
+ detail: {
215
+ path: string;
216
+ params: (id: string, _partition?: unknown) => {
217
+ id: string;
218
+ };
219
+ select: (data: unknown) => {
220
+ affiliate: Affiliate;
221
+ stats: AffiliateStats;
222
+ };
223
+ };
224
+ };
225
+ mutations: {
226
+ create: {
227
+ path: string;
228
+ method: "POST";
229
+ input: (body: CreateAffiliateInput) => {
230
+ body: CreateAffiliateInput;
231
+ };
232
+ select: (data: unknown) => Affiliate;
233
+ invalidates: string[];
234
+ refresh: false;
235
+ };
236
+ update: {
237
+ path: string;
238
+ method: "PUT";
239
+ input: ({ id, data }: {
240
+ id: string;
241
+ data: UpdateAffiliateInput;
242
+ }) => {
243
+ params: {
244
+ id: string;
245
+ };
246
+ body: UpdateAffiliateInput;
247
+ };
248
+ select: (data: unknown) => Affiliate;
249
+ invalidates: string[];
250
+ refresh: false;
251
+ };
252
+ delete: {
253
+ path: string;
254
+ method: "DELETE";
255
+ input: (id: string) => {
256
+ params: {
257
+ id: string;
258
+ };
259
+ };
260
+ invalidates: string[];
261
+ refresh: false;
262
+ };
263
+ };
264
+ };
265
+ affiliatePortal: {
266
+ queries: {
267
+ detail: {
268
+ path: string;
269
+ key: (partition?: unknown) => unknown[];
270
+ select: (data: unknown) => AffiliatePortal;
271
+ };
272
+ };
273
+ mutations: {
274
+ apply: {
275
+ path: string;
276
+ method: "POST";
277
+ input: (body: AffiliateApplicationInput) => {
278
+ body: AffiliateApplicationInput;
279
+ };
280
+ select: (data: unknown) => Affiliate;
281
+ invalidates: string[];
282
+ refresh: false;
283
+ };
284
+ update: {
285
+ path: string;
286
+ method: "PUT";
287
+ input: (body: AffiliatePortalInput) => {
288
+ body: AffiliatePortalInput;
289
+ };
290
+ select: (data: unknown) => Affiliate;
291
+ invalidates: string[];
292
+ refresh: false;
293
+ };
294
+ };
295
+ };
296
+ affiliateCommissions: {
297
+ queries: {
298
+ list: {
299
+ path: string;
300
+ query: (params?: ListParams, _partition?: unknown) => {
301
+ limit?: number;
302
+ offset?: number;
303
+ affiliateId?: string;
304
+ status?: string;
305
+ currency?: string;
306
+ };
307
+ select: (data: unknown) => ListResult<Commission>;
308
+ };
309
+ };
310
+ mutations: {
311
+ update: {
312
+ path: string;
313
+ method: "PUT";
314
+ input: ({ id, status, }: {
315
+ id: string;
316
+ status: "approved" | "voided";
317
+ }) => {
318
+ params: {
319
+ id: string;
320
+ };
321
+ body: {
322
+ status: "approved" | "voided";
323
+ };
324
+ };
325
+ select: (data: unknown) => Commission;
326
+ invalidates: string[];
327
+ refresh: false;
328
+ };
329
+ };
330
+ };
331
+ affiliatePayouts: {
332
+ queries: {
333
+ list: {
334
+ path: string;
335
+ query: (params?: ListParams, _partition?: unknown) => {
336
+ limit?: number;
337
+ offset?: number;
338
+ affiliateId?: string;
339
+ status?: string;
340
+ currency?: string;
341
+ };
342
+ select: (data: unknown) => ListResult<Payout>;
343
+ };
344
+ export: {
345
+ path: string;
346
+ query: (params?: ListParams, _partition?: unknown) => {
347
+ limit?: number;
348
+ offset?: number;
349
+ affiliateId?: string;
350
+ status?: string;
351
+ currency?: string;
352
+ };
353
+ select: (data: unknown) => {
354
+ csv: string;
355
+ };
356
+ };
357
+ };
358
+ mutations: {
359
+ create: {
360
+ path: string;
361
+ method: "POST";
362
+ input: (body: CreatePayoutInput) => {
363
+ body: CreatePayoutInput;
364
+ };
365
+ select: (data: unknown) => Payout;
366
+ invalidates: string[];
367
+ refresh: false;
368
+ };
369
+ update: {
370
+ path: string;
371
+ method: "PUT";
372
+ input: ({ id, ...body }: {
373
+ id: string;
374
+ status: "sent" | "failed";
375
+ reference?: string;
376
+ }) => {
377
+ params: {
378
+ id: string;
379
+ };
380
+ body: {
381
+ status: "sent" | "failed";
382
+ reference?: string;
383
+ };
384
+ };
385
+ select: (data: unknown) => Payout;
386
+ invalidates: string[];
387
+ refresh: false;
388
+ };
389
+ };
390
+ };
391
+ }>;
392
+
393
+ export { affiliateResources, createAffiliateQueryKeys };
394
+ export type { AffiliateApplicationInput, AffiliatePortalInput };