@superlikers/microsites-api 0.1.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/.npmignore +3 -0
- package/CHANGELOG.md +14 -0
- package/README.md +222 -0
- package/fesm2022/superlikers-microsites-api-forms.mjs +48 -0
- package/fesm2022/superlikers-microsites-api-forms.mjs.map +1 -0
- package/fesm2022/superlikers-microsites-api-testing.mjs +47 -0
- package/fesm2022/superlikers-microsites-api-testing.mjs.map +1 -0
- package/fesm2022/superlikers-microsites-api.mjs +723 -0
- package/fesm2022/superlikers-microsites-api.mjs.map +1 -0
- package/package.json +56 -0
- package/types/superlikers-microsites-api-forms.d.ts +28 -0
- package/types/superlikers-microsites-api-testing.d.ts +39 -0
- package/types/superlikers-microsites-api.d.ts +1958 -0
|
@@ -0,0 +1,1958 @@
|
|
|
1
|
+
import { HttpErrorResponse } from '@angular/common/http';
|
|
2
|
+
import * as i0 from '@angular/core';
|
|
3
|
+
import { EnvironmentProviders } from '@angular/core';
|
|
4
|
+
import { Observable } from 'rxjs';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Error thrown by every `@superlikers/microsites-api` request.
|
|
8
|
+
*
|
|
9
|
+
* @example
|
|
10
|
+
* ```ts
|
|
11
|
+
* try {
|
|
12
|
+
* await firstValueFrom(sessionService.login(data))
|
|
13
|
+
* } catch (error) {
|
|
14
|
+
* if (isApiError(error)) this.message.set(error.message)
|
|
15
|
+
* }
|
|
16
|
+
* ```
|
|
17
|
+
*/
|
|
18
|
+
declare class ApiError extends Error {
|
|
19
|
+
readonly name = "ApiError";
|
|
20
|
+
/** HTTP status. `0` means the request never reached the server (network, CORS, offline). */
|
|
21
|
+
readonly status: number;
|
|
22
|
+
/** Backend error code (`code_error`), e.g. `140`. `null` when the backend did not send one. */
|
|
23
|
+
readonly code: number | null;
|
|
24
|
+
/** Validation errors by field name, e.g. `{ email: 'is invalid' }`. Empty when there are none. */
|
|
25
|
+
readonly fieldErrors: Readonly<Record<string, string>>;
|
|
26
|
+
/** URL of the failed request. */
|
|
27
|
+
readonly url: string | null;
|
|
28
|
+
/**
|
|
29
|
+
* `true` when the server answered with something that is not JSON (e.g. an HTML page).
|
|
30
|
+
* Happens when a module is disabled for the campaign: the backend redirects to the site instead of answering.
|
|
31
|
+
*/
|
|
32
|
+
readonly isInvalidResponse: boolean;
|
|
33
|
+
constructor(response: HttpErrorResponse);
|
|
34
|
+
get isNetworkError(): boolean;
|
|
35
|
+
get isUnauthorized(): boolean;
|
|
36
|
+
}
|
|
37
|
+
declare function isApiError(error: unknown): error is ApiError;
|
|
38
|
+
|
|
39
|
+
/**
|
|
40
|
+
* Configuration for `@superlikers/microsites-api`, passed to {@link provideMicrositesApi}.
|
|
41
|
+
*/
|
|
42
|
+
interface MicrositesApiConfig {
|
|
43
|
+
/**
|
|
44
|
+
* Absolute URL of the microsite backend, e.g. `https://4x.superlikerslabs.com`.
|
|
45
|
+
* A trailing slash is removed automatically.
|
|
46
|
+
*/
|
|
47
|
+
baseUrl: string;
|
|
48
|
+
/**
|
|
49
|
+
* Called when a request fails with `401 Unauthorized` (the error is still thrown to the caller).
|
|
50
|
+
* Runs in an injection context, so `inject()` can be used.
|
|
51
|
+
*
|
|
52
|
+
* @example
|
|
53
|
+
* ```ts
|
|
54
|
+
* provideMicrositesApi({
|
|
55
|
+
* baseUrl: environment.baseUrl,
|
|
56
|
+
* onUnauthorized: () => inject(Router).navigate(['/login'])
|
|
57
|
+
* })
|
|
58
|
+
* ```
|
|
59
|
+
*/
|
|
60
|
+
onUnauthorized?: (error: ApiError) => void;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
/**
|
|
64
|
+
* Configures `@superlikers/microsites-api` for the application.
|
|
65
|
+
*
|
|
66
|
+
* @example
|
|
67
|
+
* ```ts
|
|
68
|
+
* // app.config.ts
|
|
69
|
+
* export const appConfig: ApplicationConfig = {
|
|
70
|
+
* providers: [provideMicrositesApi({ baseUrl: environment.baseUrl })]
|
|
71
|
+
* }
|
|
72
|
+
* ```
|
|
73
|
+
*/
|
|
74
|
+
declare function provideMicrositesApi(config: MicrositesApiConfig): EnvironmentProviders;
|
|
75
|
+
|
|
76
|
+
/** Points of one point type (coin). */
|
|
77
|
+
interface Coin {
|
|
78
|
+
/** Point type id. */
|
|
79
|
+
pt_id: string;
|
|
80
|
+
name: string;
|
|
81
|
+
total: number;
|
|
82
|
+
}
|
|
83
|
+
/**
|
|
84
|
+
* Fields every participant has, in every campaign. Extend it with the campaign fields:
|
|
85
|
+
*
|
|
86
|
+
* @example
|
|
87
|
+
* ```ts
|
|
88
|
+
* interface Participant extends BaseParticipant {
|
|
89
|
+
* codigo_sap: string
|
|
90
|
+
* 'codigo-de-cliente': string // keys with hyphens must be quoted
|
|
91
|
+
* }
|
|
92
|
+
* ```
|
|
93
|
+
*/
|
|
94
|
+
interface BaseParticipant {
|
|
95
|
+
id: string;
|
|
96
|
+
uid: string;
|
|
97
|
+
uid_type: string | null;
|
|
98
|
+
/** e.g. `active`. */
|
|
99
|
+
state: string;
|
|
100
|
+
name: string;
|
|
101
|
+
first_name: string;
|
|
102
|
+
last_name: string;
|
|
103
|
+
email: string;
|
|
104
|
+
/** Empty when there is no email pending confirmation. */
|
|
105
|
+
unconfirmed_email: string;
|
|
106
|
+
email_verified: boolean;
|
|
107
|
+
cellphone_verified: boolean;
|
|
108
|
+
avatar: string;
|
|
109
|
+
picture_url: string;
|
|
110
|
+
large_picture_url: string;
|
|
111
|
+
points: number;
|
|
112
|
+
total_points: number;
|
|
113
|
+
coins: Coin[];
|
|
114
|
+
total_coins: Coin[];
|
|
115
|
+
level: Record<string, unknown>;
|
|
116
|
+
next_level: Record<string, unknown>;
|
|
117
|
+
tags: string[];
|
|
118
|
+
sector: string | null;
|
|
119
|
+
sector_b: string | null;
|
|
120
|
+
sector_c: string | null;
|
|
121
|
+
/** Empty when the participant has no team. */
|
|
122
|
+
team: string;
|
|
123
|
+
team_id: string;
|
|
124
|
+
/** Unix timestamp in seconds. */
|
|
125
|
+
created_at: number;
|
|
126
|
+
/** ISO date. */
|
|
127
|
+
last_activity_at: string;
|
|
128
|
+
}
|
|
129
|
+
/** The logged participant, as returned by `/sconfig`. */
|
|
130
|
+
interface BaseCurrentParticipant extends BaseParticipant {
|
|
131
|
+
authenticated: boolean;
|
|
132
|
+
}
|
|
133
|
+
interface Campaign {
|
|
134
|
+
id: string;
|
|
135
|
+
/** Microsite id, e.g. `4x`. */
|
|
136
|
+
unique_id: string;
|
|
137
|
+
domain: string;
|
|
138
|
+
has_custom_domain: boolean;
|
|
139
|
+
language: string;
|
|
140
|
+
login_for: string;
|
|
141
|
+
permissions: string;
|
|
142
|
+
/** Comma-separated enabled modules, e.g. `SignupModule,PhotosModule,BlogModule`. */
|
|
143
|
+
modules: string;
|
|
144
|
+
facebook_id: string | null;
|
|
145
|
+
}
|
|
146
|
+
/** `GET /sconfig` — site config and the logged participant. */
|
|
147
|
+
interface CurrentParticipantResponse<T = BaseCurrentParticipant> {
|
|
148
|
+
global: {
|
|
149
|
+
env: string;
|
|
150
|
+
ask_login: boolean;
|
|
151
|
+
};
|
|
152
|
+
campaign: Campaign;
|
|
153
|
+
participation: T;
|
|
154
|
+
}
|
|
155
|
+
/** `GET /participants/show` */
|
|
156
|
+
interface ParticipantResponse<T = BaseParticipant> {
|
|
157
|
+
state: string;
|
|
158
|
+
data: T;
|
|
159
|
+
}
|
|
160
|
+
/** Filters for `GET /participants/list`. */
|
|
161
|
+
interface ParticipantListParams {
|
|
162
|
+
page?: number;
|
|
163
|
+
limit?: number;
|
|
164
|
+
q?: string;
|
|
165
|
+
tags?: string[];
|
|
166
|
+
exact_tags?: boolean;
|
|
167
|
+
with_admins?: boolean;
|
|
168
|
+
}
|
|
169
|
+
/** `GET /participants/list` */
|
|
170
|
+
interface ParticipantListResponse<T = BaseParticipant> {
|
|
171
|
+
state: string;
|
|
172
|
+
data: T[];
|
|
173
|
+
}
|
|
174
|
+
/** Fields always present in {@link ParticipantRank.data}. Extend it with the campaign fields. */
|
|
175
|
+
interface BaseParticipantRankData {
|
|
176
|
+
email: string;
|
|
177
|
+
unconfirmed_email: string;
|
|
178
|
+
avatar: string;
|
|
179
|
+
tags: string[];
|
|
180
|
+
}
|
|
181
|
+
interface ParticipantRank<T = BaseParticipantRankData> {
|
|
182
|
+
name: string;
|
|
183
|
+
first_name: string;
|
|
184
|
+
last_name: string;
|
|
185
|
+
email: string;
|
|
186
|
+
avatar: string;
|
|
187
|
+
tags: string[];
|
|
188
|
+
points: number;
|
|
189
|
+
votes: number;
|
|
190
|
+
/** Level number (unlike `BaseParticipant.level`, which is an object). */
|
|
191
|
+
level: number;
|
|
192
|
+
/** Position in the ranking. */
|
|
193
|
+
ranking: number;
|
|
194
|
+
/** Points by point type id, e.g. `{ '6a2302881bf9ca74293ffa67': 358 }`. */
|
|
195
|
+
points_by_ptype: Record<string, number>;
|
|
196
|
+
colour: string | null;
|
|
197
|
+
/** Participant data: common fields plus the campaign ones. */
|
|
198
|
+
data: T;
|
|
199
|
+
}
|
|
200
|
+
/** `GET /participant_rank` */
|
|
201
|
+
interface ParticipantRankResponse<T = BaseParticipantRankData> {
|
|
202
|
+
state: string;
|
|
203
|
+
data: ParticipantRank<T>;
|
|
204
|
+
}
|
|
205
|
+
/** Web Push subscription as returned by the browser (`PushSubscription.toJSON()`). */
|
|
206
|
+
interface PushSubscriptionPayload {
|
|
207
|
+
endpoint: string;
|
|
208
|
+
expirationTime?: number | null;
|
|
209
|
+
keys: {
|
|
210
|
+
p256dh: string;
|
|
211
|
+
auth: string;
|
|
212
|
+
};
|
|
213
|
+
}
|
|
214
|
+
/** `POST /participants/save_push_subscription` */
|
|
215
|
+
interface SavePushSubscriptionResponse {
|
|
216
|
+
state?: string;
|
|
217
|
+
data: {
|
|
218
|
+
success: boolean;
|
|
219
|
+
};
|
|
220
|
+
}
|
|
221
|
+
/** `POST /participants/remove_push_subscriptions` */
|
|
222
|
+
interface RemovePushSubscriptionsResponse {
|
|
223
|
+
state: string;
|
|
224
|
+
data: {
|
|
225
|
+
success: boolean;
|
|
226
|
+
};
|
|
227
|
+
}
|
|
228
|
+
|
|
229
|
+
/**
|
|
230
|
+
* Participant embedded in activities (entries, blog posts, comments, achievements).
|
|
231
|
+
* Same shape in every campaign; it carries no campaign-specific fields.
|
|
232
|
+
*/
|
|
233
|
+
interface ActivityParticipant {
|
|
234
|
+
_id: string;
|
|
235
|
+
uid: string;
|
|
236
|
+
name: string;
|
|
237
|
+
email: string;
|
|
238
|
+
bad_email: boolean;
|
|
239
|
+
email_verified: boolean;
|
|
240
|
+
avatar: string;
|
|
241
|
+
state: string;
|
|
242
|
+
points: number;
|
|
243
|
+
total_points: number;
|
|
244
|
+
level: number;
|
|
245
|
+
coins: Coin[];
|
|
246
|
+
total_coins: Coin[];
|
|
247
|
+
badges: unknown[];
|
|
248
|
+
tags: string[];
|
|
249
|
+
total_activities: number;
|
|
250
|
+
form_id: string;
|
|
251
|
+
facebook_uid: string | null;
|
|
252
|
+
facebook_link: string;
|
|
253
|
+
connection: {
|
|
254
|
+
tw: boolean;
|
|
255
|
+
fb: boolean;
|
|
256
|
+
pw: boolean;
|
|
257
|
+
};
|
|
258
|
+
/** ISO date. */
|
|
259
|
+
last_activity_at: string;
|
|
260
|
+
/** Unix timestamp in seconds. */
|
|
261
|
+
created_at: number;
|
|
262
|
+
/** Unix timestamp in seconds. */
|
|
263
|
+
updated_at: number;
|
|
264
|
+
}
|
|
265
|
+
|
|
266
|
+
/** Date range filter. Dates as `yyyy-mm-dd`; send the same date twice for a single day. */
|
|
267
|
+
interface DateFilter {
|
|
268
|
+
sdate: string;
|
|
269
|
+
edate: string;
|
|
270
|
+
}
|
|
271
|
+
|
|
272
|
+
/** Backend type of a form field (`_type`). */
|
|
273
|
+
type FieldType = 'UserEmailField' | 'PasswordField' | 'SelectField' | 'TextField' | 'NumberField' | 'PhoneField' | 'HiddenField' | 'CheckBoxGroupField' | 'CheckBoxField';
|
|
274
|
+
interface FieldChoice {
|
|
275
|
+
label: string;
|
|
276
|
+
value: string;
|
|
277
|
+
}
|
|
278
|
+
/** A form field as described by the backend (login form, registration form, external forms…). */
|
|
279
|
+
interface Field {
|
|
280
|
+
_id: string;
|
|
281
|
+
_type: FieldType;
|
|
282
|
+
/** Key to send the value with, e.g. `codigo_sap`. */
|
|
283
|
+
name: string;
|
|
284
|
+
label: string;
|
|
285
|
+
/** HTML-like input type, e.g. `text`, `password`, `email`. */
|
|
286
|
+
field_type: string;
|
|
287
|
+
/** Value type, e.g. `String`. */
|
|
288
|
+
typeval: string;
|
|
289
|
+
placeholder: string | null;
|
|
290
|
+
default_value: string | null;
|
|
291
|
+
help_text: string | null;
|
|
292
|
+
/** Regular expression the value must match. Empty or `null` when there is none. */
|
|
293
|
+
pattern: string | null;
|
|
294
|
+
choices?: FieldChoice[];
|
|
295
|
+
required_field: boolean;
|
|
296
|
+
hidden_field: boolean | null;
|
|
297
|
+
is_public: boolean;
|
|
298
|
+
is_readonly: boolean;
|
|
299
|
+
unique_field: boolean;
|
|
300
|
+
/** Name of the confirmation field (e.g. `password_confirm`), when the field must be typed twice. */
|
|
301
|
+
confirm?: string;
|
|
302
|
+
confirm_label?: string;
|
|
303
|
+
minimum_length?: number;
|
|
304
|
+
must_have_number?: boolean | null;
|
|
305
|
+
must_have_special_characters?: boolean | null;
|
|
306
|
+
messages: {
|
|
307
|
+
blank?: string | null;
|
|
308
|
+
taken?: string | null;
|
|
309
|
+
};
|
|
310
|
+
}
|
|
311
|
+
|
|
312
|
+
type AchievementType = 'GoalAchievement' | 'BadgeAchievement';
|
|
313
|
+
/** Filters for `GET /achievements/index`. */
|
|
314
|
+
interface AchievementsParams {
|
|
315
|
+
date_filter?: DateFilter;
|
|
316
|
+
/** @default 'list' */
|
|
317
|
+
view?: 'list' | 'show';
|
|
318
|
+
_type?: AchievementType;
|
|
319
|
+
tags?: string[];
|
|
320
|
+
after?: string;
|
|
321
|
+
before?: string;
|
|
322
|
+
cursor_paginated?: boolean;
|
|
323
|
+
index_page?: string;
|
|
324
|
+
skip?: number;
|
|
325
|
+
limit?: number;
|
|
326
|
+
participant_uid?: string;
|
|
327
|
+
uid_type?: string;
|
|
328
|
+
goal_id?: string;
|
|
329
|
+
order?: 'asc' | 'desc';
|
|
330
|
+
}
|
|
331
|
+
interface BaseAchievement {
|
|
332
|
+
_id: string;
|
|
333
|
+
_type: string;
|
|
334
|
+
tags: string[];
|
|
335
|
+
name: string;
|
|
336
|
+
created_at: number;
|
|
337
|
+
participant_filter: string[];
|
|
338
|
+
}
|
|
339
|
+
interface GoalAchievement extends BaseAchievement {
|
|
340
|
+
state: string;
|
|
341
|
+
activity_filter: string[];
|
|
342
|
+
activity_target: string;
|
|
343
|
+
period: string | null;
|
|
344
|
+
primary_reward_id: string | null;
|
|
345
|
+
total_primary_reward: number | null;
|
|
346
|
+
conditions_snapshot: unknown[];
|
|
347
|
+
/** Participant who earned the achievement. */
|
|
348
|
+
participant: ActivityParticipant;
|
|
349
|
+
reward_name: string;
|
|
350
|
+
reward_type: string;
|
|
351
|
+
total_reward: number;
|
|
352
|
+
goal_start_period?: string | null;
|
|
353
|
+
goal_end_period?: string | null;
|
|
354
|
+
goal: {
|
|
355
|
+
_id: string;
|
|
356
|
+
activity_target: string;
|
|
357
|
+
name: string;
|
|
358
|
+
reward_id: string | null;
|
|
359
|
+
};
|
|
360
|
+
}
|
|
361
|
+
interface BadgeAchievement extends BaseAchievement {
|
|
362
|
+
badge_handler_id: string;
|
|
363
|
+
badge_handler_type: string;
|
|
364
|
+
badge_remover_id: string | null;
|
|
365
|
+
badge_remover_type: string | null;
|
|
366
|
+
campaign_id: string;
|
|
367
|
+
participation_id: string;
|
|
368
|
+
removed: boolean;
|
|
369
|
+
removed_date: string | null;
|
|
370
|
+
team_id: string | null;
|
|
371
|
+
badge_handler_name: string;
|
|
372
|
+
badge: {
|
|
373
|
+
_id: string;
|
|
374
|
+
name: string;
|
|
375
|
+
};
|
|
376
|
+
}
|
|
377
|
+
interface AchievementsMetadata {
|
|
378
|
+
view: string;
|
|
379
|
+
/** Pagination fields are only sent for some views (`view: 'list'` sends just `view`). */
|
|
380
|
+
total?: number;
|
|
381
|
+
partial?: boolean;
|
|
382
|
+
page?: number;
|
|
383
|
+
page_size?: number;
|
|
384
|
+
total_pages?: number;
|
|
385
|
+
}
|
|
386
|
+
/** `GET /achievements/index` */
|
|
387
|
+
interface AchievementsListResponse<T = GoalAchievement | BadgeAchievement> {
|
|
388
|
+
data: T[];
|
|
389
|
+
metadata: AchievementsMetadata;
|
|
390
|
+
}
|
|
391
|
+
|
|
392
|
+
/** Achievements earned by participants (goal and badge achievements). */
|
|
393
|
+
declare class AchievementsService {
|
|
394
|
+
#private;
|
|
395
|
+
list<T = GoalAchievement | BadgeAchievement>(params?: AchievementsParams): Observable<AchievementsListResponse<T>>;
|
|
396
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<AchievementsService, never>;
|
|
397
|
+
static ɵprov: i0.ɵɵInjectableDeclaration<any>;
|
|
398
|
+
}
|
|
399
|
+
|
|
400
|
+
interface UploadPhotoParams {
|
|
401
|
+
file: File | Blob;
|
|
402
|
+
filename?: string;
|
|
403
|
+
category?: string;
|
|
404
|
+
}
|
|
405
|
+
/** `POST /mod/photos` */
|
|
406
|
+
interface UploadPhotoResponse {
|
|
407
|
+
state: string;
|
|
408
|
+
message: string;
|
|
409
|
+
location?: string;
|
|
410
|
+
errors?: Record<string, unknown>;
|
|
411
|
+
}
|
|
412
|
+
interface UploadDocumentParams {
|
|
413
|
+
file: File;
|
|
414
|
+
category?: string;
|
|
415
|
+
}
|
|
416
|
+
/** `POST /mod/documents` */
|
|
417
|
+
interface UploadDocumentResponse {
|
|
418
|
+
state: string;
|
|
419
|
+
message: string;
|
|
420
|
+
location?: string;
|
|
421
|
+
errors?: Record<string, unknown>;
|
|
422
|
+
}
|
|
423
|
+
|
|
424
|
+
/** Photo and document uploads. */
|
|
425
|
+
declare class ActivitiesService {
|
|
426
|
+
#private;
|
|
427
|
+
uploadPhoto({ file, filename, category }: UploadPhotoParams): Observable<UploadPhotoResponse>;
|
|
428
|
+
uploadDocument({ file, category }: UploadDocumentParams): Observable<UploadDocumentResponse>;
|
|
429
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<ActivitiesService, never>;
|
|
430
|
+
static ɵprov: i0.ɵɵInjectableDeclaration<any>;
|
|
431
|
+
}
|
|
432
|
+
|
|
433
|
+
interface BadgesParams {
|
|
434
|
+
page?: number;
|
|
435
|
+
q?: string;
|
|
436
|
+
}
|
|
437
|
+
interface BadgeConditions {
|
|
438
|
+
points: number;
|
|
439
|
+
level: number;
|
|
440
|
+
actions: Record<string, unknown>;
|
|
441
|
+
other_badges_required: Record<string, unknown>;
|
|
442
|
+
}
|
|
443
|
+
interface Badge {
|
|
444
|
+
_id: string;
|
|
445
|
+
name: string;
|
|
446
|
+
slug: string;
|
|
447
|
+
description: string;
|
|
448
|
+
color: string;
|
|
449
|
+
conditions: BadgeConditions;
|
|
450
|
+
tags: string[];
|
|
451
|
+
enabled: boolean;
|
|
452
|
+
granted: number;
|
|
453
|
+
limit: number;
|
|
454
|
+
image: {
|
|
455
|
+
url: string | null;
|
|
456
|
+
};
|
|
457
|
+
image_url: string;
|
|
458
|
+
image_default: string;
|
|
459
|
+
can_be_removed: boolean;
|
|
460
|
+
allow_admin_handling: boolean;
|
|
461
|
+
participant_filter: string[];
|
|
462
|
+
campaign_id: string;
|
|
463
|
+
created_at: string;
|
|
464
|
+
updated_at: string;
|
|
465
|
+
}
|
|
466
|
+
/** `GET /badges/index` */
|
|
467
|
+
interface BadgesListResponse {
|
|
468
|
+
state: string;
|
|
469
|
+
data: Badge[];
|
|
470
|
+
}
|
|
471
|
+
/** `GET /badges/:id/show` */
|
|
472
|
+
interface BadgeResponse {
|
|
473
|
+
state: string;
|
|
474
|
+
data: Badge;
|
|
475
|
+
}
|
|
476
|
+
interface ParticipantBadge {
|
|
477
|
+
_id: string;
|
|
478
|
+
badge_id: string;
|
|
479
|
+
badge_name: string;
|
|
480
|
+
image_url: string;
|
|
481
|
+
tags: string[];
|
|
482
|
+
total: number;
|
|
483
|
+
}
|
|
484
|
+
/** `GET /badges/stats` */
|
|
485
|
+
interface ParticipantBadgesResponse {
|
|
486
|
+
state: string;
|
|
487
|
+
data: ParticipantBadge[];
|
|
488
|
+
}
|
|
489
|
+
|
|
490
|
+
/** Badges and the badges earned by a participant. */
|
|
491
|
+
declare class BadgesService {
|
|
492
|
+
#private;
|
|
493
|
+
list(params?: BadgesParams): Observable<BadgesListResponse>;
|
|
494
|
+
get(id: string): Observable<BadgeResponse>;
|
|
495
|
+
/** Badges earned by the logged participant, or by `uid` when given. */
|
|
496
|
+
getStats(uid?: string): Observable<ParticipantBadgesResponse>;
|
|
497
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<BadgesService, never>;
|
|
498
|
+
static ɵprov: i0.ɵɵInjectableDeclaration<any>;
|
|
499
|
+
}
|
|
500
|
+
|
|
501
|
+
/** Filters for `GET /mod/blog`. */
|
|
502
|
+
interface BlogPostsParams {
|
|
503
|
+
/** @default 1 */
|
|
504
|
+
page?: number;
|
|
505
|
+
limit?: number;
|
|
506
|
+
q?: string;
|
|
507
|
+
tags?: string[];
|
|
508
|
+
category?: string;
|
|
509
|
+
}
|
|
510
|
+
interface BlogPost<T = ActivityParticipant> {
|
|
511
|
+
_id: string;
|
|
512
|
+
title: string;
|
|
513
|
+
body: string;
|
|
514
|
+
format: string;
|
|
515
|
+
state: string;
|
|
516
|
+
moderation: string;
|
|
517
|
+
atype: string;
|
|
518
|
+
category: string | null;
|
|
519
|
+
admin: boolean;
|
|
520
|
+
archived: boolean;
|
|
521
|
+
points: number;
|
|
522
|
+
extra_points: number;
|
|
523
|
+
execute_date: string | null;
|
|
524
|
+
owner_name: string | null;
|
|
525
|
+
team: string | null;
|
|
526
|
+
permalink: string;
|
|
527
|
+
short_url: string | null;
|
|
528
|
+
facebook_tab_url: string | null;
|
|
529
|
+
cover_url?: string;
|
|
530
|
+
video_cover_url?: string;
|
|
531
|
+
tags: string[];
|
|
532
|
+
participants_tags: string[];
|
|
533
|
+
editable_by: string | null;
|
|
534
|
+
deleteable_by: string | null;
|
|
535
|
+
votes_count: number;
|
|
536
|
+
votes_average: number;
|
|
537
|
+
votes_up: number;
|
|
538
|
+
votes_down: number;
|
|
539
|
+
voted: boolean;
|
|
540
|
+
created_at: number;
|
|
541
|
+
participant: T;
|
|
542
|
+
}
|
|
543
|
+
interface BlogsMetadata {
|
|
544
|
+
data_method: string;
|
|
545
|
+
data_method_params?: string;
|
|
546
|
+
total: number;
|
|
547
|
+
partial: boolean;
|
|
548
|
+
page: number;
|
|
549
|
+
page_size: number;
|
|
550
|
+
total_pages: number;
|
|
551
|
+
}
|
|
552
|
+
/** `GET /mod/blog` */
|
|
553
|
+
interface BlogPostsResponse<T = ActivityParticipant> {
|
|
554
|
+
data: BlogPost<T>[];
|
|
555
|
+
metadata: BlogsMetadata;
|
|
556
|
+
}
|
|
557
|
+
/** `GET /mod/blog/:id/show` */
|
|
558
|
+
interface BlogPostResponse<T = ActivityParticipant> {
|
|
559
|
+
state: string;
|
|
560
|
+
data: BlogPost<T>;
|
|
561
|
+
}
|
|
562
|
+
interface CreateBlogPostParams {
|
|
563
|
+
title: string;
|
|
564
|
+
body: string;
|
|
565
|
+
/** @default 'text' */
|
|
566
|
+
format?: 'text' | 'markdown';
|
|
567
|
+
attached_file?: File;
|
|
568
|
+
category?: string;
|
|
569
|
+
tags?: string[];
|
|
570
|
+
push_redirect_url?: string;
|
|
571
|
+
}
|
|
572
|
+
interface CreatedBlogPost<T = ActivityParticipant> {
|
|
573
|
+
_id: string;
|
|
574
|
+
_type: string;
|
|
575
|
+
name: string;
|
|
576
|
+
title: string;
|
|
577
|
+
format: string;
|
|
578
|
+
state: string;
|
|
579
|
+
moderation: string;
|
|
580
|
+
atype: string;
|
|
581
|
+
category: string | null;
|
|
582
|
+
points: number;
|
|
583
|
+
activity_count: number;
|
|
584
|
+
execute_date: number;
|
|
585
|
+
module: string;
|
|
586
|
+
team: string | null;
|
|
587
|
+
point_type: string | null;
|
|
588
|
+
votes_count?: number;
|
|
589
|
+
created_at: number;
|
|
590
|
+
participant: T;
|
|
591
|
+
}
|
|
592
|
+
/** `POST /mod/blogs` */
|
|
593
|
+
interface CreateBlogPostResponse<T = ActivityParticipant> {
|
|
594
|
+
state: string;
|
|
595
|
+
activity_state: string;
|
|
596
|
+
activity_points: number;
|
|
597
|
+
message: string;
|
|
598
|
+
execution_error: string;
|
|
599
|
+
object: CreatedBlogPost<T>;
|
|
600
|
+
}
|
|
601
|
+
|
|
602
|
+
/** Blog posts (mod/blog activity). */
|
|
603
|
+
declare class BlogsService {
|
|
604
|
+
#private;
|
|
605
|
+
list<T = ActivityParticipant>(params?: BlogPostsParams): Observable<BlogPostsResponse<T>>;
|
|
606
|
+
get<T = ActivityParticipant>(id: string): Observable<BlogPostResponse<T>>;
|
|
607
|
+
create<T = ActivityParticipant>({ title, body, format, attached_file, category, tags, push_redirect_url }: CreateBlogPostParams): Observable<CreateBlogPostResponse<T>>;
|
|
608
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<BlogsService, never>;
|
|
609
|
+
static ɵprov: i0.ɵɵInjectableDeclaration<any>;
|
|
610
|
+
}
|
|
611
|
+
|
|
612
|
+
interface BoardsParams {
|
|
613
|
+
page?: number;
|
|
614
|
+
q?: string;
|
|
615
|
+
}
|
|
616
|
+
interface BoardsFilter {
|
|
617
|
+
_id: string;
|
|
618
|
+
field: string;
|
|
619
|
+
operator: string;
|
|
620
|
+
val: string;
|
|
621
|
+
}
|
|
622
|
+
interface Board {
|
|
623
|
+
_id: string;
|
|
624
|
+
campaign_id: string;
|
|
625
|
+
name: string;
|
|
626
|
+
desc: string;
|
|
627
|
+
is_private: boolean;
|
|
628
|
+
owner_id: string;
|
|
629
|
+
shared_with: string[];
|
|
630
|
+
}
|
|
631
|
+
interface BoardsMetadata {
|
|
632
|
+
total: number;
|
|
633
|
+
partial: boolean;
|
|
634
|
+
page: number;
|
|
635
|
+
page_size: number;
|
|
636
|
+
total_pages: number;
|
|
637
|
+
}
|
|
638
|
+
/** `GET /boards/index` */
|
|
639
|
+
interface BoardsListResponse {
|
|
640
|
+
data: Board[];
|
|
641
|
+
metadata: BoardsMetadata;
|
|
642
|
+
}
|
|
643
|
+
interface Report {
|
|
644
|
+
_id: string;
|
|
645
|
+
name: string;
|
|
646
|
+
coll: string;
|
|
647
|
+
target_property: string | null;
|
|
648
|
+
analysis_type: string;
|
|
649
|
+
desc: string | null;
|
|
650
|
+
filter: BoardsFilter[];
|
|
651
|
+
}
|
|
652
|
+
/** `GET /boards/:board/reports` */
|
|
653
|
+
interface BoardReportsResponse {
|
|
654
|
+
data: Report[];
|
|
655
|
+
metadata: BoardsMetadata;
|
|
656
|
+
}
|
|
657
|
+
interface ExecuteReportParams {
|
|
658
|
+
timeframe?: string;
|
|
659
|
+
start_date?: string;
|
|
660
|
+
end_date?: string;
|
|
661
|
+
}
|
|
662
|
+
/** `GET /boards/:board/reports/:report/exec` */
|
|
663
|
+
interface ExecuteReportResponse {
|
|
664
|
+
state: string;
|
|
665
|
+
message: string;
|
|
666
|
+
since: number;
|
|
667
|
+
/** `null` while the report is still being generated (see `report_state` and `message`). */
|
|
668
|
+
result: {
|
|
669
|
+
value: number;
|
|
670
|
+
}[] | null;
|
|
671
|
+
report_data: Report;
|
|
672
|
+
report_params: {
|
|
673
|
+
timeframe?: string;
|
|
674
|
+
};
|
|
675
|
+
report_state: string;
|
|
676
|
+
}
|
|
677
|
+
|
|
678
|
+
/** Dashboards (boards) and their reports. */
|
|
679
|
+
declare class BoardsService {
|
|
680
|
+
#private;
|
|
681
|
+
list(params?: BoardsParams): Observable<BoardsListResponse>;
|
|
682
|
+
listReports(board: string, page?: number): Observable<BoardReportsResponse>;
|
|
683
|
+
/** Either `timeframe` or `start_date`/`end_date` is used, never both. */
|
|
684
|
+
executeReport(board: string, report: string, params?: ExecuteReportParams): Observable<ExecuteReportResponse>;
|
|
685
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<BoardsService, never>;
|
|
686
|
+
static ɵprov: i0.ɵɵInjectableDeclaration<any>;
|
|
687
|
+
}
|
|
688
|
+
|
|
689
|
+
interface CommentsParams {
|
|
690
|
+
page?: number;
|
|
691
|
+
q?: string;
|
|
692
|
+
limit?: number;
|
|
693
|
+
category?: string;
|
|
694
|
+
}
|
|
695
|
+
interface Comment<T = ActivityParticipant> {
|
|
696
|
+
_id: string;
|
|
697
|
+
body: string;
|
|
698
|
+
state: string;
|
|
699
|
+
category: string | null;
|
|
700
|
+
moderation: string;
|
|
701
|
+
atype: string;
|
|
702
|
+
admin: boolean;
|
|
703
|
+
archived: boolean;
|
|
704
|
+
points: number;
|
|
705
|
+
extra_points: number;
|
|
706
|
+
execute_date: string;
|
|
707
|
+
owner_name: string;
|
|
708
|
+
team: string | null;
|
|
709
|
+
editable_by: string | null;
|
|
710
|
+
deleteable_by: string;
|
|
711
|
+
voted: boolean;
|
|
712
|
+
tags: string[];
|
|
713
|
+
participants_tags: string[];
|
|
714
|
+
push_redirect_url: string | null;
|
|
715
|
+
created_at: number;
|
|
716
|
+
participant: T;
|
|
717
|
+
}
|
|
718
|
+
interface CommentsMetadata {
|
|
719
|
+
data_method: string;
|
|
720
|
+
data_method_params?: unknown[];
|
|
721
|
+
total: number;
|
|
722
|
+
partial: boolean;
|
|
723
|
+
page: number;
|
|
724
|
+
page_size: number;
|
|
725
|
+
total_pages: number;
|
|
726
|
+
}
|
|
727
|
+
/** `GET /mod/comments/:targetId` */
|
|
728
|
+
interface CommentsListResponse<T = ActivityParticipant> {
|
|
729
|
+
data: Comment<T>[];
|
|
730
|
+
metadata: CommentsMetadata;
|
|
731
|
+
}
|
|
732
|
+
interface CreateCommentParams {
|
|
733
|
+
body: string;
|
|
734
|
+
category?: string;
|
|
735
|
+
}
|
|
736
|
+
interface CreatedComment<T = ActivityParticipant> {
|
|
737
|
+
_id: string;
|
|
738
|
+
_type: string;
|
|
739
|
+
name: string;
|
|
740
|
+
category: string | null;
|
|
741
|
+
point_type: string | null;
|
|
742
|
+
state: string;
|
|
743
|
+
moderation: string;
|
|
744
|
+
atype: string;
|
|
745
|
+
points: number;
|
|
746
|
+
activity_count: number;
|
|
747
|
+
execute_date: number;
|
|
748
|
+
module: string;
|
|
749
|
+
team: string | null;
|
|
750
|
+
votes_count?: number;
|
|
751
|
+
created_at: number;
|
|
752
|
+
participant: T;
|
|
753
|
+
}
|
|
754
|
+
/** `POST /mod/comments/:targetId` */
|
|
755
|
+
interface CreateCommentResponse<T = ActivityParticipant> {
|
|
756
|
+
state: string;
|
|
757
|
+
activity_state: string;
|
|
758
|
+
activity_points: number;
|
|
759
|
+
message: string;
|
|
760
|
+
execution_error: string;
|
|
761
|
+
object: CreatedComment<T>;
|
|
762
|
+
}
|
|
763
|
+
|
|
764
|
+
/** Comments on an activity (target). */
|
|
765
|
+
declare class CommentsService {
|
|
766
|
+
#private;
|
|
767
|
+
list<T = ActivityParticipant>(targetId: string, params?: CommentsParams): Observable<CommentsListResponse<T>>;
|
|
768
|
+
create<T = ActivityParticipant>(targetId: string, { body, category }: CreateCommentParams): Observable<CreateCommentResponse<T>>;
|
|
769
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<CommentsService, never>;
|
|
770
|
+
static ɵprov: i0.ɵɵInjectableDeclaration<any>;
|
|
771
|
+
}
|
|
772
|
+
|
|
773
|
+
type PrizeType = 'CouponPrize' | 'ExternalCouponPrize' | 'Prize';
|
|
774
|
+
/** Filters for `GET /prizes/index`. */
|
|
775
|
+
interface PrizesParams {
|
|
776
|
+
tags?: string[];
|
|
777
|
+
/** @default 1 */
|
|
778
|
+
page?: number;
|
|
779
|
+
redeemable?: boolean;
|
|
780
|
+
fits_points?: boolean;
|
|
781
|
+
sort?: {
|
|
782
|
+
active: string;
|
|
783
|
+
direction: 'asc' | 'desc';
|
|
784
|
+
};
|
|
785
|
+
limit?: number;
|
|
786
|
+
/** @default 'show' */
|
|
787
|
+
view?: 'show' | 'list';
|
|
788
|
+
}
|
|
789
|
+
interface PrizeDetails {
|
|
790
|
+
value: string;
|
|
791
|
+
description: string;
|
|
792
|
+
}
|
|
793
|
+
interface PrizeMetadata {
|
|
794
|
+
name?: string;
|
|
795
|
+
description?: string;
|
|
796
|
+
terms_and_conditions?: string;
|
|
797
|
+
buyer_conditions?: string;
|
|
798
|
+
image?: string;
|
|
799
|
+
localizable?: boolean;
|
|
800
|
+
cities?: string[];
|
|
801
|
+
exchange_type?: string;
|
|
802
|
+
processing_days?: string;
|
|
803
|
+
validity_time?: number;
|
|
804
|
+
prize_details?: PrizeDetails;
|
|
805
|
+
extra_fields?: unknown[];
|
|
806
|
+
}
|
|
807
|
+
interface Prize {
|
|
808
|
+
_id: string;
|
|
809
|
+
_type: PrizeType;
|
|
810
|
+
name: string;
|
|
811
|
+
description: string;
|
|
812
|
+
category: string;
|
|
813
|
+
points: number;
|
|
814
|
+
quantity: number | null;
|
|
815
|
+
quantity_available: number;
|
|
816
|
+
tags: string[];
|
|
817
|
+
filter: string[];
|
|
818
|
+
available: boolean;
|
|
819
|
+
redeemable: boolean;
|
|
820
|
+
unlimited: boolean;
|
|
821
|
+
use_point_type: boolean;
|
|
822
|
+
user_limit: number;
|
|
823
|
+
user_limit_timeframe: string | null;
|
|
824
|
+
point_type: string | null;
|
|
825
|
+
point_type_id: string | null;
|
|
826
|
+
allowed_point_type_ids: string[];
|
|
827
|
+
image_url: string | null;
|
|
828
|
+
prize_image_url: string;
|
|
829
|
+
prize_details?: PrizeDetails;
|
|
830
|
+
extra_fields?: unknown[];
|
|
831
|
+
require_redemption_token: boolean;
|
|
832
|
+
use_codes_vault?: boolean;
|
|
833
|
+
quantity_limit_timeframe: string | null;
|
|
834
|
+
shipping?: boolean;
|
|
835
|
+
is_custom_prize?: boolean;
|
|
836
|
+
custom_data?: unknown[];
|
|
837
|
+
tc: string | null;
|
|
838
|
+
eid?: string;
|
|
839
|
+
size?: number;
|
|
840
|
+
expiration_days: number;
|
|
841
|
+
can_redeem: boolean;
|
|
842
|
+
missing_points: number;
|
|
843
|
+
missing_level: string | null;
|
|
844
|
+
missing_badges: string | null;
|
|
845
|
+
missing_rule: string | null;
|
|
846
|
+
user_overlimit: boolean;
|
|
847
|
+
humanize_missing_conditions: string | null;
|
|
848
|
+
redeem_url: string;
|
|
849
|
+
is_coupon_prize?: boolean;
|
|
850
|
+
is_external_coupon_prize?: boolean;
|
|
851
|
+
is_prize?: boolean;
|
|
852
|
+
addon_id?: string;
|
|
853
|
+
metadata?: PrizeMetadata;
|
|
854
|
+
sponsor: string | null;
|
|
855
|
+
sponsor_id: string | null;
|
|
856
|
+
}
|
|
857
|
+
interface PrizesMetadata {
|
|
858
|
+
data_method: string;
|
|
859
|
+
data_method_params?: string[];
|
|
860
|
+
total: number;
|
|
861
|
+
partial: boolean;
|
|
862
|
+
page: number;
|
|
863
|
+
page_size: number;
|
|
864
|
+
total_pages: number;
|
|
865
|
+
}
|
|
866
|
+
/** `GET /prizes/index` */
|
|
867
|
+
interface PrizesListResponse {
|
|
868
|
+
data: Prize[];
|
|
869
|
+
metadata: PrizesMetadata;
|
|
870
|
+
}
|
|
871
|
+
/** `GET /prizes/:id/redeem/check` */
|
|
872
|
+
interface CheckRedeemResponse {
|
|
873
|
+
state: string;
|
|
874
|
+
success: boolean;
|
|
875
|
+
prize: Prize;
|
|
876
|
+
kind: PrizeType;
|
|
877
|
+
extra_form: string;
|
|
878
|
+
}
|
|
879
|
+
/** `POST /prizes/:id/redeem` */
|
|
880
|
+
interface RedeemedPrize {
|
|
881
|
+
_id: string;
|
|
882
|
+
redeem_id: string;
|
|
883
|
+
prize_name: string;
|
|
884
|
+
prize_description: string;
|
|
885
|
+
image_url: string;
|
|
886
|
+
points: number;
|
|
887
|
+
point_type: string | null;
|
|
888
|
+
state: string;
|
|
889
|
+
is_redemption_coupon: boolean;
|
|
890
|
+
success: boolean;
|
|
891
|
+
code: string;
|
|
892
|
+
barcode_url: string;
|
|
893
|
+
qrcode_url: string;
|
|
894
|
+
url: string;
|
|
895
|
+
link: string;
|
|
896
|
+
pdf: string;
|
|
897
|
+
created_at: number;
|
|
898
|
+
updated_at: number;
|
|
899
|
+
}
|
|
900
|
+
/** `GET /prizes/whislist` */
|
|
901
|
+
interface WishlistResponse {
|
|
902
|
+
data: Prize[];
|
|
903
|
+
metadata: PrizesMetadata;
|
|
904
|
+
}
|
|
905
|
+
/** `GET /prizes/:id/whislist_toggle` */
|
|
906
|
+
interface ToggleWishlistResponse {
|
|
907
|
+
state: string;
|
|
908
|
+
message?: string;
|
|
909
|
+
}
|
|
910
|
+
interface ExternalCouponData {
|
|
911
|
+
name: string;
|
|
912
|
+
value: string;
|
|
913
|
+
}
|
|
914
|
+
/** `GET /prizes/:id/redeem/external/:key` */
|
|
915
|
+
type ExternalCouponDataResponse = ExternalCouponData[];
|
|
916
|
+
|
|
917
|
+
/** Campaign-specific data of an `External` entry. Each microsite can pass its own interface. */
|
|
918
|
+
type EntryData = Record<string, unknown>;
|
|
919
|
+
/** Fields every entry has, whatever its `_type`. */
|
|
920
|
+
interface BaseEntry {
|
|
921
|
+
_id: string;
|
|
922
|
+
/** Kind of activity: `External`, `Redeem`, `UploadPhoto`… (see {@link EntryTypes}). */
|
|
923
|
+
_type: string;
|
|
924
|
+
/** External action slug for `External` entries; equal to `_type` for the others. */
|
|
925
|
+
atype: string;
|
|
926
|
+
name: string;
|
|
927
|
+
category: string | null;
|
|
928
|
+
points: number;
|
|
929
|
+
point_type: string | null;
|
|
930
|
+
state: string;
|
|
931
|
+
moderation: string;
|
|
932
|
+
team: string | null;
|
|
933
|
+
activity_count: number;
|
|
934
|
+
/** Unix timestamp in seconds. */
|
|
935
|
+
created_at: number;
|
|
936
|
+
participant: ActivityParticipant;
|
|
937
|
+
}
|
|
938
|
+
interface ExternalEntry<T = EntryData> extends BaseEntry {
|
|
939
|
+
_type: 'External';
|
|
940
|
+
/** Campaign-specific data (the external form / event values). */
|
|
941
|
+
data: T;
|
|
942
|
+
as_form: boolean | null;
|
|
943
|
+
module: string;
|
|
944
|
+
execute_date: number;
|
|
945
|
+
}
|
|
946
|
+
/** Prize as embedded in a redemption entry (a subset of `Prize`). */
|
|
947
|
+
interface EntryPrize {
|
|
948
|
+
_id: string;
|
|
949
|
+
_type: PrizeType;
|
|
950
|
+
name: string;
|
|
951
|
+
description: string;
|
|
952
|
+
category: string;
|
|
953
|
+
points: number;
|
|
954
|
+
image_url: string;
|
|
955
|
+
prize_image_url: string;
|
|
956
|
+
tags: string[];
|
|
957
|
+
tc: string;
|
|
958
|
+
filter: string[];
|
|
959
|
+
redeemable: boolean;
|
|
960
|
+
unlimited: boolean;
|
|
961
|
+
quantity: number | null;
|
|
962
|
+
quantity_available: number;
|
|
963
|
+
quantity_limit_timeframe: string | null;
|
|
964
|
+
user_limit: number;
|
|
965
|
+
user_limit_timeframe: string;
|
|
966
|
+
expiration_days: number;
|
|
967
|
+
use_point_type: boolean;
|
|
968
|
+
point_type: string | null;
|
|
969
|
+
point_type_id: string | null;
|
|
970
|
+
allowed_point_type_ids: string[];
|
|
971
|
+
require_redemption_token: boolean;
|
|
972
|
+
sponsor: string | null;
|
|
973
|
+
sponsor_id: string | null;
|
|
974
|
+
eid?: string;
|
|
975
|
+
addon_id?: string;
|
|
976
|
+
size?: number;
|
|
977
|
+
use_codes_vault?: boolean;
|
|
978
|
+
extra_fields?: unknown[];
|
|
979
|
+
prize_details?: PrizeDetails;
|
|
980
|
+
metadata?: PrizeMetadata;
|
|
981
|
+
}
|
|
982
|
+
interface Redemption {
|
|
983
|
+
_id: string;
|
|
984
|
+
redeem_id: string;
|
|
985
|
+
prize_name: string;
|
|
986
|
+
image_url: string;
|
|
987
|
+
points: number;
|
|
988
|
+
point_type: string | null;
|
|
989
|
+
state: string;
|
|
990
|
+
url?: string;
|
|
991
|
+
/** Unix timestamp in seconds. */
|
|
992
|
+
expires_at?: number;
|
|
993
|
+
created_at: number;
|
|
994
|
+
updated_at: number;
|
|
995
|
+
}
|
|
996
|
+
interface RedeemEntry extends BaseEntry {
|
|
997
|
+
_type: 'Redeem';
|
|
998
|
+
prize: EntryPrize;
|
|
999
|
+
redemption: Redemption;
|
|
1000
|
+
redemption_state: string;
|
|
1001
|
+
gift: boolean;
|
|
1002
|
+
source: string;
|
|
1003
|
+
}
|
|
1004
|
+
interface PhotoEntry extends BaseEntry {
|
|
1005
|
+
_type: 'UploadPhoto';
|
|
1006
|
+
photo_url: string;
|
|
1007
|
+
sha1: string;
|
|
1008
|
+
votes_count: number;
|
|
1009
|
+
module: string;
|
|
1010
|
+
execute_date?: number;
|
|
1011
|
+
}
|
|
1012
|
+
interface DocumentEntry extends BaseEntry {
|
|
1013
|
+
_type: 'UploadDocument';
|
|
1014
|
+
document_url: string;
|
|
1015
|
+
sha1: string;
|
|
1016
|
+
module: string;
|
|
1017
|
+
execute_date?: number;
|
|
1018
|
+
}
|
|
1019
|
+
interface InvoiceProduct {
|
|
1020
|
+
ref: string;
|
|
1021
|
+
price: string;
|
|
1022
|
+
quantity: string;
|
|
1023
|
+
points: number;
|
|
1024
|
+
provider: string | null;
|
|
1025
|
+
line: string | null;
|
|
1026
|
+
}
|
|
1027
|
+
interface Invoice {
|
|
1028
|
+
_id: string;
|
|
1029
|
+
ref: string;
|
|
1030
|
+
/** ISO date. */
|
|
1031
|
+
date: string;
|
|
1032
|
+
category: string | null;
|
|
1033
|
+
total: number;
|
|
1034
|
+
quantity: number;
|
|
1035
|
+
discount: number;
|
|
1036
|
+
points: number;
|
|
1037
|
+
products: InvoiceProduct[];
|
|
1038
|
+
promotions: Record<string, unknown>;
|
|
1039
|
+
promotions_points: number;
|
|
1040
|
+
refunds: Record<string, unknown>;
|
|
1041
|
+
data: Record<string, unknown>;
|
|
1042
|
+
}
|
|
1043
|
+
/** A purchase (retail module). */
|
|
1044
|
+
interface PurchaseEntry extends BaseEntry {
|
|
1045
|
+
_type: 'Retail::Buy';
|
|
1046
|
+
invoice: Invoice;
|
|
1047
|
+
module: string;
|
|
1048
|
+
execute_date: number;
|
|
1049
|
+
}
|
|
1050
|
+
interface EntryFile {
|
|
1051
|
+
_id: string;
|
|
1052
|
+
name: string;
|
|
1053
|
+
type: string;
|
|
1054
|
+
mime_type: string;
|
|
1055
|
+
size: number;
|
|
1056
|
+
url: string;
|
|
1057
|
+
}
|
|
1058
|
+
interface BlogPostEntry extends BaseEntry {
|
|
1059
|
+
_type: 'BlogPost';
|
|
1060
|
+
title: string;
|
|
1061
|
+
body: string;
|
|
1062
|
+
format: string;
|
|
1063
|
+
avatar: string;
|
|
1064
|
+
permalink: string;
|
|
1065
|
+
short_url: string | null;
|
|
1066
|
+
push_redirect_url: string | null;
|
|
1067
|
+
tags: string[];
|
|
1068
|
+
participants_tags: string[];
|
|
1069
|
+
files: EntryFile[];
|
|
1070
|
+
votes_count: number;
|
|
1071
|
+
module: string;
|
|
1072
|
+
execute_date: number;
|
|
1073
|
+
}
|
|
1074
|
+
interface CommentEntry extends BaseEntry {
|
|
1075
|
+
_type: 'Comment';
|
|
1076
|
+
body: string;
|
|
1077
|
+
push_redirect_url: string | null;
|
|
1078
|
+
tags: string[];
|
|
1079
|
+
participants_tags: string[];
|
|
1080
|
+
votes_count: number;
|
|
1081
|
+
module: string;
|
|
1082
|
+
execute_date: number;
|
|
1083
|
+
}
|
|
1084
|
+
/** Admin who assigned extra points. */
|
|
1085
|
+
interface EntryAdmin {
|
|
1086
|
+
_id: string;
|
|
1087
|
+
name: string;
|
|
1088
|
+
first_name: string;
|
|
1089
|
+
last_name: string;
|
|
1090
|
+
email: string;
|
|
1091
|
+
state: string;
|
|
1092
|
+
language: string;
|
|
1093
|
+
phone: string | null;
|
|
1094
|
+
city: string | null;
|
|
1095
|
+
country: string | null;
|
|
1096
|
+
unconfirmed_email: string | null;
|
|
1097
|
+
expired_password: boolean;
|
|
1098
|
+
created_at: number;
|
|
1099
|
+
}
|
|
1100
|
+
interface ExtraPointsEntry extends BaseEntry {
|
|
1101
|
+
_type: 'ExtraPoints';
|
|
1102
|
+
concept: string;
|
|
1103
|
+
assigned_by: EntryAdmin;
|
|
1104
|
+
execute_date: number;
|
|
1105
|
+
}
|
|
1106
|
+
/** Entries that only add the module and execution date. */
|
|
1107
|
+
interface ModuleEntry<K extends 'Vote' | 'Signup' | 'VerifyEmail' | 'CompleteProfile' = 'Vote' | 'Signup' | 'VerifyEmail' | 'CompleteProfile'> extends BaseEntry {
|
|
1108
|
+
_type: K;
|
|
1109
|
+
module: string;
|
|
1110
|
+
execute_date: number;
|
|
1111
|
+
}
|
|
1112
|
+
interface PreRegistrationEntry extends BaseEntry {
|
|
1113
|
+
_type: 'PreRegistration';
|
|
1114
|
+
execute_date: number;
|
|
1115
|
+
}
|
|
1116
|
+
/** Known entry types by `_type`. Campaigns can have others (see {@link UnknownEntry}). */
|
|
1117
|
+
interface EntryTypes {
|
|
1118
|
+
External: ExternalEntry;
|
|
1119
|
+
Redeem: RedeemEntry;
|
|
1120
|
+
UploadPhoto: PhotoEntry;
|
|
1121
|
+
UploadDocument: DocumentEntry;
|
|
1122
|
+
'Retail::Buy': PurchaseEntry;
|
|
1123
|
+
BlogPost: BlogPostEntry;
|
|
1124
|
+
Comment: CommentEntry;
|
|
1125
|
+
ExtraPoints: ExtraPointsEntry;
|
|
1126
|
+
Vote: ModuleEntry<'Vote'>;
|
|
1127
|
+
Signup: ModuleEntry<'Signup'>;
|
|
1128
|
+
VerifyEmail: ModuleEntry<'VerifyEmail'>;
|
|
1129
|
+
CompleteProfile: ModuleEntry<'CompleteProfile'>;
|
|
1130
|
+
PreRegistration: PreRegistrationEntry;
|
|
1131
|
+
}
|
|
1132
|
+
type KnownEntryType = keyof EntryTypes;
|
|
1133
|
+
/** An entry of a type the library doesn't model yet: only the common fields are typed. */
|
|
1134
|
+
type UnknownEntry = BaseEntry & Record<string, unknown>;
|
|
1135
|
+
/** Any entry. Narrow it with {@link isEntryType}. */
|
|
1136
|
+
type Entry = EntryTypes[KnownEntryType] | UnknownEntry;
|
|
1137
|
+
/** Filters shared by every entries method. */
|
|
1138
|
+
interface EntriesParams {
|
|
1139
|
+
category?: string;
|
|
1140
|
+
/** External action slug(s). Only for `External` entries. */
|
|
1141
|
+
atype?: string | string[];
|
|
1142
|
+
date_filter?: DateFilter;
|
|
1143
|
+
/** Another participant's entries (admins only); the logged participant's by default. */
|
|
1144
|
+
participant_uid?: string;
|
|
1145
|
+
/** Page to fetch (50 entries per page). */
|
|
1146
|
+
index_page?: number;
|
|
1147
|
+
/** Skips entries; disables pagination. */
|
|
1148
|
+
skip?: number;
|
|
1149
|
+
/** Max entries; disables pagination (and the pagination metadata). */
|
|
1150
|
+
limit?: number;
|
|
1151
|
+
/** Hides undone entries. @default true */
|
|
1152
|
+
hide_undo?: boolean;
|
|
1153
|
+
}
|
|
1154
|
+
/** Filters for {@link EntriesService.list}: any `_type`, including the ones without a method of their own. */
|
|
1155
|
+
interface EntriesListParams extends EntriesParams {
|
|
1156
|
+
_type?: string;
|
|
1157
|
+
}
|
|
1158
|
+
interface EntriesMetadata {
|
|
1159
|
+
view: 'show';
|
|
1160
|
+
/** Pagination fields are missing when `limit` or `skip` is sent. */
|
|
1161
|
+
total?: number;
|
|
1162
|
+
partial?: boolean;
|
|
1163
|
+
page?: number;
|
|
1164
|
+
page_size?: number;
|
|
1165
|
+
total_pages?: number;
|
|
1166
|
+
}
|
|
1167
|
+
/** `GET /participant_entries` and `GET /entries/search` */
|
|
1168
|
+
interface EntriesResponse<E = Entry> {
|
|
1169
|
+
data: E[];
|
|
1170
|
+
metadata: EntriesMetadata;
|
|
1171
|
+
}
|
|
1172
|
+
interface CreateExternalOptions {
|
|
1173
|
+
category?: string;
|
|
1174
|
+
points_type?: string;
|
|
1175
|
+
}
|
|
1176
|
+
/** `POST /mod/external` */
|
|
1177
|
+
interface CreateExternalResponse {
|
|
1178
|
+
state: string;
|
|
1179
|
+
activity_state: string;
|
|
1180
|
+
activity_points: number;
|
|
1181
|
+
message: string;
|
|
1182
|
+
execution_error: string;
|
|
1183
|
+
}
|
|
1184
|
+
|
|
1185
|
+
/**
|
|
1186
|
+
* Entries (activities) of the logged participant, or of another one with `participant_uid` (admins).
|
|
1187
|
+
* Every method uses the detailed `show` view. Types without a method of their own are listed with `list({ _type })`.
|
|
1188
|
+
*/
|
|
1189
|
+
declare class EntriesService {
|
|
1190
|
+
#private;
|
|
1191
|
+
/** `T`: shape of `data` (the campaign's external action fields). */
|
|
1192
|
+
listExternals<T = EntryData>(params?: EntriesParams): Observable<EntriesResponse<ExternalEntry<T>>>;
|
|
1193
|
+
listRedemptions(params?: EntriesParams): Observable<EntriesResponse<RedeemEntry>>;
|
|
1194
|
+
listPhotos(params?: EntriesParams): Observable<EntriesResponse<PhotoEntry>>;
|
|
1195
|
+
listDocuments(params?: EntriesParams): Observable<EntriesResponse<DocumentEntry>>;
|
|
1196
|
+
listPurchases(params?: EntriesParams): Observable<EntriesResponse<PurchaseEntry>>;
|
|
1197
|
+
/** Every entry, or one `_type` (including the ones without a method of their own). Narrow each item with `isEntryType`. */
|
|
1198
|
+
list(params?: EntriesListParams): Observable<EntriesResponse<Entry>>;
|
|
1199
|
+
/** Entries of several participants at once (admins only, 100 per page). `uids` is required by the backend. */
|
|
1200
|
+
search(uids: string[], params?: EntriesListParams): Observable<EntriesResponse<Entry>>;
|
|
1201
|
+
/**
|
|
1202
|
+
* Records an external action event.
|
|
1203
|
+
* @param event An external action configured in the campaign (otherwise `code_error: 30`).
|
|
1204
|
+
* @param properties Event data. Must not be empty (otherwise `code_error: 11`).
|
|
1205
|
+
*/
|
|
1206
|
+
createExternal(event: string, properties: Record<string, unknown>, { category, points_type }?: CreateExternalOptions): Observable<CreateExternalResponse>;
|
|
1207
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<EntriesService, never>;
|
|
1208
|
+
static ɵprov: i0.ɵɵInjectableDeclaration<any>;
|
|
1209
|
+
}
|
|
1210
|
+
|
|
1211
|
+
/**
|
|
1212
|
+
* Narrows an entry to its type.
|
|
1213
|
+
*
|
|
1214
|
+
* @example
|
|
1215
|
+
* ```ts
|
|
1216
|
+
* for (const entry of response.data) {
|
|
1217
|
+
* if (isEntryType(entry, 'Redeem')) console.log(entry.prize.name)
|
|
1218
|
+
* }
|
|
1219
|
+
* ```
|
|
1220
|
+
*/
|
|
1221
|
+
declare function isEntryType<K extends KnownEntryType>(entry: Entry, type: K): entry is EntryTypes[K];
|
|
1222
|
+
|
|
1223
|
+
/** Filters for `GET /external_forms/actions/list`. */
|
|
1224
|
+
interface ExternalFormsListParams {
|
|
1225
|
+
page?: number;
|
|
1226
|
+
category?: string;
|
|
1227
|
+
limit?: number;
|
|
1228
|
+
/** @default true */
|
|
1229
|
+
participant_match_rules?: boolean;
|
|
1230
|
+
}
|
|
1231
|
+
interface ExternalFormFilter {
|
|
1232
|
+
_id: string;
|
|
1233
|
+
field: string;
|
|
1234
|
+
operator: string;
|
|
1235
|
+
val: string;
|
|
1236
|
+
}
|
|
1237
|
+
interface ExternalForm {
|
|
1238
|
+
_id: string;
|
|
1239
|
+
name: string;
|
|
1240
|
+
slug: string;
|
|
1241
|
+
description: string | null;
|
|
1242
|
+
category: string;
|
|
1243
|
+
color: string;
|
|
1244
|
+
enabled: boolean;
|
|
1245
|
+
point_type: string | null;
|
|
1246
|
+
point_type_id: string | null;
|
|
1247
|
+
use_point_type: boolean | null;
|
|
1248
|
+
formula: string;
|
|
1249
|
+
filter: ExternalFormFilter[];
|
|
1250
|
+
auto_acceptation: boolean;
|
|
1251
|
+
moderation_update: boolean;
|
|
1252
|
+
use_as_form: boolean;
|
|
1253
|
+
use_prize_form: boolean;
|
|
1254
|
+
use_retail_form: boolean;
|
|
1255
|
+
use_signup_form: boolean;
|
|
1256
|
+
fast_import: boolean;
|
|
1257
|
+
codes_vault_loader: boolean;
|
|
1258
|
+
create_from_panel: boolean;
|
|
1259
|
+
campaign_limit: number;
|
|
1260
|
+
daily_limit: number;
|
|
1261
|
+
global_campaign_limit: number;
|
|
1262
|
+
global_daily_limit: number;
|
|
1263
|
+
icon_url: string | null;
|
|
1264
|
+
tracking_action: boolean;
|
|
1265
|
+
reevaluate_on_repeat: boolean;
|
|
1266
|
+
sponsor: string | null;
|
|
1267
|
+
sponsor_id: string | null;
|
|
1268
|
+
pocket: string | null;
|
|
1269
|
+
pocket_id: string | null;
|
|
1270
|
+
form_id: string;
|
|
1271
|
+
created_at: number;
|
|
1272
|
+
updated_at: number;
|
|
1273
|
+
}
|
|
1274
|
+
interface ExternalFormsMetadata {
|
|
1275
|
+
total: number;
|
|
1276
|
+
partial?: boolean;
|
|
1277
|
+
page: number;
|
|
1278
|
+
page_size: number;
|
|
1279
|
+
total_pages: number;
|
|
1280
|
+
}
|
|
1281
|
+
/** `GET /external_forms/actions/list` */
|
|
1282
|
+
interface ExternalFormsListResponse {
|
|
1283
|
+
state: string;
|
|
1284
|
+
data: ExternalForm[];
|
|
1285
|
+
metadata: ExternalFormsMetadata;
|
|
1286
|
+
}
|
|
1287
|
+
interface ExternalFormFieldChoice {
|
|
1288
|
+
label: string;
|
|
1289
|
+
value: string;
|
|
1290
|
+
}
|
|
1291
|
+
/** A field of an external form, as described by `fields_info`. */
|
|
1292
|
+
interface ExternalFormField {
|
|
1293
|
+
name: string;
|
|
1294
|
+
label: string;
|
|
1295
|
+
help_text: string | null;
|
|
1296
|
+
placeholder: string | null;
|
|
1297
|
+
default_value: string | null;
|
|
1298
|
+
field_type: string;
|
|
1299
|
+
type_value: string;
|
|
1300
|
+
required_field: boolean;
|
|
1301
|
+
unique_field: boolean;
|
|
1302
|
+
choices?: ExternalFormFieldChoice[];
|
|
1303
|
+
}
|
|
1304
|
+
/** `GET /external_forms/actions/:id/fields_info` */
|
|
1305
|
+
interface ExternalFormFieldsResponse {
|
|
1306
|
+
state: string;
|
|
1307
|
+
object: {
|
|
1308
|
+
id: string;
|
|
1309
|
+
external_action: string;
|
|
1310
|
+
total_fields: number;
|
|
1311
|
+
fields: ExternalFormField[];
|
|
1312
|
+
};
|
|
1313
|
+
}
|
|
1314
|
+
/** `POST /external_forms/actions/:id/fillup` and `PATCH /external_forms/:id` */
|
|
1315
|
+
interface ExternalFormSubmissionResponse {
|
|
1316
|
+
state: string;
|
|
1317
|
+
message: string;
|
|
1318
|
+
}
|
|
1319
|
+
/** Filters for `POST /external_forms/list` (submitted forms, i.e. `External` entries). */
|
|
1320
|
+
interface ExternalFormSubmissionsParams {
|
|
1321
|
+
category?: string;
|
|
1322
|
+
atype?: string[];
|
|
1323
|
+
date_filter?: DateFilter;
|
|
1324
|
+
/** Another participant's submissions (admins only). */
|
|
1325
|
+
participant_uid?: string;
|
|
1326
|
+
/** 30 submissions per page. */
|
|
1327
|
+
page?: number;
|
|
1328
|
+
skip?: number;
|
|
1329
|
+
limit?: number;
|
|
1330
|
+
/** @default true */
|
|
1331
|
+
hide_undo?: boolean;
|
|
1332
|
+
}
|
|
1333
|
+
/** `POST /external_forms/list` */
|
|
1334
|
+
interface ExternalFormSubmissionsResponse<T = EntryData> {
|
|
1335
|
+
data: ExternalEntry<T>[];
|
|
1336
|
+
metadata: EntriesMetadata;
|
|
1337
|
+
}
|
|
1338
|
+
|
|
1339
|
+
/** External forms (custom actions configured per campaign) and their submissions. */
|
|
1340
|
+
declare class ExternalFormsService {
|
|
1341
|
+
#private;
|
|
1342
|
+
listForms(params?: ExternalFormsListParams): Observable<ExternalFormsListResponse>;
|
|
1343
|
+
getFormFields(id: string): Observable<ExternalFormFieldsResponse>;
|
|
1344
|
+
submit(id: string, values: Record<string, unknown>, category?: string): Observable<ExternalFormSubmissionResponse>;
|
|
1345
|
+
/** Submitted forms (`External` entries), paginated. It is a read, but the backend only accepts POST. `T`: shape of `data`. */
|
|
1346
|
+
listSubmissions<T = EntryData>(params?: ExternalFormSubmissionsParams): Observable<ExternalFormSubmissionsResponse<T>>;
|
|
1347
|
+
/** @param id The submission (entry) `_id`. */
|
|
1348
|
+
getSubmission<T = EntryData>(id: string): Observable<ExternalEntry<T>>;
|
|
1349
|
+
updateSubmission(id: string, values: Record<string, unknown>): Observable<ExternalFormSubmissionResponse>;
|
|
1350
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<ExternalFormsService, never>;
|
|
1351
|
+
static ɵprov: i0.ɵɵInjectableDeclaration<any>;
|
|
1352
|
+
}
|
|
1353
|
+
|
|
1354
|
+
/** Campaign-specific data configured on each goal (e.g. `{ badge: 'gold', coins: 10 }`). */
|
|
1355
|
+
type GoalData = Record<string, unknown>;
|
|
1356
|
+
interface GoalCondition {
|
|
1357
|
+
metric_id: string;
|
|
1358
|
+
metric_name: string;
|
|
1359
|
+
operator: string;
|
|
1360
|
+
value: number | null;
|
|
1361
|
+
value_ref: string | null;
|
|
1362
|
+
timeframe: string;
|
|
1363
|
+
}
|
|
1364
|
+
interface GoalFilter {
|
|
1365
|
+
_id: string;
|
|
1366
|
+
field: string;
|
|
1367
|
+
operator: string;
|
|
1368
|
+
val: string | number | boolean | unknown[];
|
|
1369
|
+
}
|
|
1370
|
+
/** Fields every goal has, both in the campaign catalog and in the participant's goals. */
|
|
1371
|
+
interface BaseGoal {
|
|
1372
|
+
name: string;
|
|
1373
|
+
desc: string;
|
|
1374
|
+
tags: string[];
|
|
1375
|
+
enabled: boolean;
|
|
1376
|
+
deleted: boolean;
|
|
1377
|
+
image: {
|
|
1378
|
+
url: string | null;
|
|
1379
|
+
};
|
|
1380
|
+
/** ISO date, `null` when the goal has no start. */
|
|
1381
|
+
starts_at: string | null;
|
|
1382
|
+
/** ISO date, `null` when the goal has no end. */
|
|
1383
|
+
ends_at: string | null;
|
|
1384
|
+
ended_at: string | null;
|
|
1385
|
+
evaluate_since: string | null;
|
|
1386
|
+
period: string | null;
|
|
1387
|
+
interval: string | null;
|
|
1388
|
+
interval_samples: number;
|
|
1389
|
+
recurrent: boolean;
|
|
1390
|
+
requires_acceptance: boolean;
|
|
1391
|
+
acceptances_count: number;
|
|
1392
|
+
activity_target: string;
|
|
1393
|
+
activity_times: number;
|
|
1394
|
+
formula: string;
|
|
1395
|
+
conditions: GoalCondition[];
|
|
1396
|
+
conditions_failure: boolean;
|
|
1397
|
+
limit: number;
|
|
1398
|
+
global_limit: number;
|
|
1399
|
+
global_awarded_count: number;
|
|
1400
|
+
give_normal_points: boolean;
|
|
1401
|
+
reward_type: string | null;
|
|
1402
|
+
reward_name: string | null;
|
|
1403
|
+
consolation_reward_id: string | null;
|
|
1404
|
+
consolation_reward_type: string | null;
|
|
1405
|
+
consolation_reward_amount: number;
|
|
1406
|
+
always_award_consolation_reward: boolean;
|
|
1407
|
+
sponsor_id: string | null;
|
|
1408
|
+
sponsor_percentage: number;
|
|
1409
|
+
pocket_id: string | null;
|
|
1410
|
+
use_participant_metrics: boolean;
|
|
1411
|
+
participant_metric_id: string | null;
|
|
1412
|
+
participant_metric_timeframe: string | null;
|
|
1413
|
+
participant_metric_value: number | null;
|
|
1414
|
+
participant_metric_value_ref: string | null;
|
|
1415
|
+
secondary_metric_extra_percentage: number;
|
|
1416
|
+
secondary_participant_metric_id: string | null;
|
|
1417
|
+
secondary_participant_metric_timeframe: string | null;
|
|
1418
|
+
secondary_pocket_id: string | null;
|
|
1419
|
+
secondary_reward_id: string | null;
|
|
1420
|
+
secondary_reward_type: string | null;
|
|
1421
|
+
secondary_sponsor_id: string | null;
|
|
1422
|
+
secondary_sponsor_percentage: number;
|
|
1423
|
+
campaign_id: string | null;
|
|
1424
|
+
created_by_id: string | null;
|
|
1425
|
+
created_by_type: string | null;
|
|
1426
|
+
created_via_chat: boolean;
|
|
1427
|
+
created_via_chat_message_id: string | null;
|
|
1428
|
+
created_via_owner_id: string | null;
|
|
1429
|
+
created_via_owner_type: string | null;
|
|
1430
|
+
created_at: string;
|
|
1431
|
+
updated_at: string;
|
|
1432
|
+
}
|
|
1433
|
+
/** A goal as configured in the campaign (`POST /goals/index`). */
|
|
1434
|
+
interface Goal<T = GoalData> extends BaseGoal {
|
|
1435
|
+
/** Goal id. */
|
|
1436
|
+
_id: string;
|
|
1437
|
+
brand_id: string;
|
|
1438
|
+
reward_id: string | null;
|
|
1439
|
+
filter: GoalFilter[];
|
|
1440
|
+
participant_filter: GoalFilter[];
|
|
1441
|
+
/** Campaign-specific data. Not every catalog goal has it. */
|
|
1442
|
+
goal_data?: T;
|
|
1443
|
+
start_period?: string | null;
|
|
1444
|
+
end_period?: string | null;
|
|
1445
|
+
sponsor_name: string | null;
|
|
1446
|
+
pocket_name: string | null;
|
|
1447
|
+
consolation_reward_name: string | null;
|
|
1448
|
+
participant_metric_name: string | null;
|
|
1449
|
+
secondary_reward_name: string | null;
|
|
1450
|
+
secondary_sponsor_name: string | null;
|
|
1451
|
+
secondary_pocket_name: string | null;
|
|
1452
|
+
secondary_participant_metric_name: string | null;
|
|
1453
|
+
}
|
|
1454
|
+
interface GoalConditionProgress {
|
|
1455
|
+
metric_id: string;
|
|
1456
|
+
metric_slug: string;
|
|
1457
|
+
result: number;
|
|
1458
|
+
ratio: number;
|
|
1459
|
+
met: boolean;
|
|
1460
|
+
}
|
|
1461
|
+
/** A goal of the logged participant, with their progress (`GET /participants/goals`). */
|
|
1462
|
+
interface ParticipantGoal<T = GoalData> extends BaseGoal {
|
|
1463
|
+
/** Id of the participant ↔ goal record, **not** the goal id. */
|
|
1464
|
+
_id: string;
|
|
1465
|
+
/** Goal id. Use this one for `accept` / `decline`. */
|
|
1466
|
+
goal_id: string;
|
|
1467
|
+
/** Campaign-specific data. */
|
|
1468
|
+
goal_data: T;
|
|
1469
|
+
participation_id: string;
|
|
1470
|
+
/** Progress as a percentage, e.g. `'6%'`. */
|
|
1471
|
+
status: string;
|
|
1472
|
+
conditions_progress: GoalConditionProgress[];
|
|
1473
|
+
/** Times the goal was won. */
|
|
1474
|
+
winned: number;
|
|
1475
|
+
winning_dates: string[];
|
|
1476
|
+
/** Current period of a recurrent goal. Only sent by some campaigns. */
|
|
1477
|
+
period_begins?: string;
|
|
1478
|
+
period_ends?: string;
|
|
1479
|
+
}
|
|
1480
|
+
/** Filters for `GET /participants/goals`. 30 goals per page. */
|
|
1481
|
+
interface ParticipantGoalsParams {
|
|
1482
|
+
page?: number;
|
|
1483
|
+
tags?: string[];
|
|
1484
|
+
skip?: number;
|
|
1485
|
+
limit?: number;
|
|
1486
|
+
/** Another participant's goals (same shape, with their progress); the logged participant's by default. Unknown uids fail with `code_error: 20`. */
|
|
1487
|
+
participant_uid?: string;
|
|
1488
|
+
}
|
|
1489
|
+
/** `GET /participants/goals` */
|
|
1490
|
+
interface ParticipantGoalsResponse<T = GoalData> {
|
|
1491
|
+
state: string;
|
|
1492
|
+
data: ParticipantGoal<T>[];
|
|
1493
|
+
}
|
|
1494
|
+
/** Filters for `POST /goals/index`. */
|
|
1495
|
+
interface GoalsListParams {
|
|
1496
|
+
page?: number;
|
|
1497
|
+
limit?: number;
|
|
1498
|
+
/** `false` lists only the disabled goals; enabled ones are listed by default. */
|
|
1499
|
+
enabled?: boolean;
|
|
1500
|
+
tags?: string[];
|
|
1501
|
+
sponsor_id?: string;
|
|
1502
|
+
trending?: boolean;
|
|
1503
|
+
/** @default true */
|
|
1504
|
+
include_ended?: boolean;
|
|
1505
|
+
}
|
|
1506
|
+
/** `POST /goals/index` */
|
|
1507
|
+
interface GoalsListResponse<T = GoalData> {
|
|
1508
|
+
state: string;
|
|
1509
|
+
data: {
|
|
1510
|
+
page: number;
|
|
1511
|
+
page_size: number;
|
|
1512
|
+
total_pages: number;
|
|
1513
|
+
total_data: number;
|
|
1514
|
+
goals: Goal<T>[];
|
|
1515
|
+
};
|
|
1516
|
+
}
|
|
1517
|
+
/** `POST /participants/goals/accept` and `/unaccept` */
|
|
1518
|
+
interface GoalAcceptanceResponse {
|
|
1519
|
+
state: string;
|
|
1520
|
+
message: string;
|
|
1521
|
+
}
|
|
1522
|
+
|
|
1523
|
+
/** Campaign goals: the participant's goals with progress, the campaign catalog, and accepting goals. */
|
|
1524
|
+
declare class GoalsService {
|
|
1525
|
+
#private;
|
|
1526
|
+
/** Goals that apply to the logged participant (or `participant_uid`), with their progress. `T`: shape of `goal_data`. */
|
|
1527
|
+
listParticipantGoals<T = GoalData>(params?: ParticipantGoalsParams): Observable<ParticipantGoalsResponse<T>>;
|
|
1528
|
+
/** Every goal of the campaign (no progress), paginated. It is a read, but the backend only accepts POST. */
|
|
1529
|
+
list<T = GoalData>(params?: GoalsListParams): Observable<GoalsListResponse<T>>;
|
|
1530
|
+
/** @param goalId The goal id (`ParticipantGoal.goal_id`, not its `_id`). */
|
|
1531
|
+
accept(goalId: string): Observable<GoalAcceptanceResponse>;
|
|
1532
|
+
/** @param goalId The goal id (`ParticipantGoal.goal_id`, not its `_id`). */
|
|
1533
|
+
decline(goalId: string): Observable<GoalAcceptanceResponse>;
|
|
1534
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<GoalsService, never>;
|
|
1535
|
+
static ɵprov: i0.ɵɵInjectableDeclaration<any>;
|
|
1536
|
+
}
|
|
1537
|
+
|
|
1538
|
+
interface MetricsParams {
|
|
1539
|
+
page?: number;
|
|
1540
|
+
q?: string;
|
|
1541
|
+
}
|
|
1542
|
+
interface MetricFilter {
|
|
1543
|
+
_id: string;
|
|
1544
|
+
field: string;
|
|
1545
|
+
operator: string;
|
|
1546
|
+
val: string;
|
|
1547
|
+
}
|
|
1548
|
+
interface Metric {
|
|
1549
|
+
_id: string;
|
|
1550
|
+
name: string;
|
|
1551
|
+
slug: string;
|
|
1552
|
+
description: string;
|
|
1553
|
+
coll: string;
|
|
1554
|
+
target_property: string;
|
|
1555
|
+
analysis_type: string;
|
|
1556
|
+
category: string | null;
|
|
1557
|
+
filter: MetricFilter[];
|
|
1558
|
+
use_goals: boolean;
|
|
1559
|
+
goals_related_info: unknown[];
|
|
1560
|
+
}
|
|
1561
|
+
/** `GET /metrics/index` */
|
|
1562
|
+
interface MetricsListResponse {
|
|
1563
|
+
state: string;
|
|
1564
|
+
data: Metric[];
|
|
1565
|
+
}
|
|
1566
|
+
interface CalculateMetricParams {
|
|
1567
|
+
slug: string;
|
|
1568
|
+
timeframe: string;
|
|
1569
|
+
uid?: string;
|
|
1570
|
+
}
|
|
1571
|
+
/** `GET /metrics/exec` */
|
|
1572
|
+
interface CalculateMetricResponse {
|
|
1573
|
+
state: string;
|
|
1574
|
+
result: number;
|
|
1575
|
+
}
|
|
1576
|
+
|
|
1577
|
+
/** Campaign metrics (custom aggregations configured per campaign). */
|
|
1578
|
+
declare class MetricsService {
|
|
1579
|
+
#private;
|
|
1580
|
+
list(params?: MetricsParams): Observable<MetricsListResponse>;
|
|
1581
|
+
calculate(params: CalculateMetricParams): Observable<CalculateMetricResponse>;
|
|
1582
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<MetricsService, never>;
|
|
1583
|
+
static ɵprov: i0.ɵɵInjectableDeclaration<any>;
|
|
1584
|
+
}
|
|
1585
|
+
|
|
1586
|
+
/** Logged participant, participant lists and push notification subscriptions. */
|
|
1587
|
+
declare class ParticipantService {
|
|
1588
|
+
#private;
|
|
1589
|
+
/** Logged participant and site config. `T`: your participant interface (`extends BaseCurrentParticipant`). */
|
|
1590
|
+
getCurrent<T = BaseCurrentParticipant>(): Observable<CurrentParticipantResponse<T>>;
|
|
1591
|
+
/** Points, level and position of the logged participant. `T`: shape of `data.data` (`extends BaseParticipantRankData`). */
|
|
1592
|
+
getRank<T = BaseParticipantRankData>(): Observable<ParticipantRankResponse<T>>;
|
|
1593
|
+
/** `T`: your participant interface (`extends BaseParticipant`). */
|
|
1594
|
+
list<T = BaseParticipant>(params?: ParticipantListParams): Observable<ParticipantListResponse<T>>;
|
|
1595
|
+
/** `T`: your participant interface (`extends BaseParticipant`). */
|
|
1596
|
+
getByUid<T = BaseParticipant>(uid: string): Observable<ParticipantResponse<T>>;
|
|
1597
|
+
/** Sends the browser subscription as the request body, unwrapped. */
|
|
1598
|
+
savePushSubscription(subscription: PushSubscriptionPayload): Observable<SavePushSubscriptionResponse>;
|
|
1599
|
+
removePushSubscriptions(): Observable<RemovePushSubscriptionsResponse>;
|
|
1600
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<ParticipantService, never>;
|
|
1601
|
+
static ɵprov: i0.ɵɵInjectableDeclaration<any>;
|
|
1602
|
+
}
|
|
1603
|
+
|
|
1604
|
+
type NotificationChannel = 'email' | 'cellphone';
|
|
1605
|
+
interface ChangePasswordParams {
|
|
1606
|
+
current_password: string;
|
|
1607
|
+
password: string;
|
|
1608
|
+
password_confirmation: string;
|
|
1609
|
+
}
|
|
1610
|
+
/** `PUT /password/change` */
|
|
1611
|
+
interface ChangePasswordResponse {
|
|
1612
|
+
state: string;
|
|
1613
|
+
message: string;
|
|
1614
|
+
}
|
|
1615
|
+
/** `POST /password/validate_channel` */
|
|
1616
|
+
interface ValidateChannelResponse {
|
|
1617
|
+
state: string;
|
|
1618
|
+
message: string;
|
|
1619
|
+
}
|
|
1620
|
+
interface SendResetTokenParams {
|
|
1621
|
+
channel: NotificationChannel;
|
|
1622
|
+
/** Value of the channel keyed by the field name the backend expects, e.g. `{ email: 'ana@mail.com' }`. */
|
|
1623
|
+
data: Record<string, string>;
|
|
1624
|
+
edit_password_url: string;
|
|
1625
|
+
uid?: string;
|
|
1626
|
+
}
|
|
1627
|
+
/** `POST /password` */
|
|
1628
|
+
interface SendResetTokenResponse {
|
|
1629
|
+
state: string;
|
|
1630
|
+
message: string;
|
|
1631
|
+
}
|
|
1632
|
+
interface ResetPasswordParams {
|
|
1633
|
+
password: string;
|
|
1634
|
+
password_confirmation: string;
|
|
1635
|
+
token: string;
|
|
1636
|
+
channel: NotificationChannel;
|
|
1637
|
+
}
|
|
1638
|
+
/** `POST /password/update` */
|
|
1639
|
+
interface ResetPasswordResponse {
|
|
1640
|
+
state: string;
|
|
1641
|
+
message: string;
|
|
1642
|
+
}
|
|
1643
|
+
|
|
1644
|
+
/** Change password (logged participant) and the password recovery flow. */
|
|
1645
|
+
declare class PasswordService {
|
|
1646
|
+
#private;
|
|
1647
|
+
changePassword(params: ChangePasswordParams): Observable<ChangePasswordResponse>;
|
|
1648
|
+
/** Checks that a participant exists for the given channel value (e.g. an email or a phone number). */
|
|
1649
|
+
validateChannel(channel: NotificationChannel, value: string): Observable<ValidateChannelResponse>;
|
|
1650
|
+
sendResetToken({ channel, data, edit_password_url, uid }: SendResetTokenParams): Observable<SendResetTokenResponse>;
|
|
1651
|
+
resetPassword({ password, password_confirmation, token, channel }: ResetPasswordParams): Observable<ResetPasswordResponse>;
|
|
1652
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<PasswordService, never>;
|
|
1653
|
+
static ɵprov: i0.ɵɵInjectableDeclaration<any>;
|
|
1654
|
+
}
|
|
1655
|
+
|
|
1656
|
+
/** Prizes and redemptions. */
|
|
1657
|
+
declare class PrizesService {
|
|
1658
|
+
#private;
|
|
1659
|
+
list(params?: PrizesParams): Observable<PrizesListResponse>;
|
|
1660
|
+
checkRedeem(id: string): Observable<CheckRedeemResponse>;
|
|
1661
|
+
redeem(id: string, opts?: Record<string, unknown>): Observable<RedeemedPrize>;
|
|
1662
|
+
getWishlist(page?: number): Observable<WishlistResponse>;
|
|
1663
|
+
toggleWishlist(id: string): Observable<ToggleWishlistResponse>;
|
|
1664
|
+
getExternalCouponData(id: string, key: string, city?: string): Observable<ExternalCouponDataResponse>;
|
|
1665
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<PrizesService, never>;
|
|
1666
|
+
static ɵprov: i0.ɵɵInjectableDeclaration<any>;
|
|
1667
|
+
}
|
|
1668
|
+
|
|
1669
|
+
interface SegmentRankingParams {
|
|
1670
|
+
activity_type?: string;
|
|
1671
|
+
point_type?: string;
|
|
1672
|
+
page?: number;
|
|
1673
|
+
per_page?: number;
|
|
1674
|
+
}
|
|
1675
|
+
/** One segment of `GET /participants/ranks/segment`. */
|
|
1676
|
+
interface SegmentRanking {
|
|
1677
|
+
/** Segment values (e.g. `['norte']`). */
|
|
1678
|
+
segment: string[];
|
|
1679
|
+
participants: number;
|
|
1680
|
+
ranking: number;
|
|
1681
|
+
ranking_points: number;
|
|
1682
|
+
latest_created_at: string;
|
|
1683
|
+
oldest_last_points_received_at: string;
|
|
1684
|
+
last_activity_at: string | null;
|
|
1685
|
+
}
|
|
1686
|
+
/** `GET /participants/ranks/segment` */
|
|
1687
|
+
interface SegmentRankingResponse {
|
|
1688
|
+
state: string;
|
|
1689
|
+
data: SegmentRanking[];
|
|
1690
|
+
}
|
|
1691
|
+
interface AdvancedRankingParams {
|
|
1692
|
+
categories?: string[];
|
|
1693
|
+
exact_categories?: boolean;
|
|
1694
|
+
sector?: string;
|
|
1695
|
+
sector_b?: string;
|
|
1696
|
+
sector_c?: string;
|
|
1697
|
+
activity_type?: string;
|
|
1698
|
+
point_type?: string;
|
|
1699
|
+
starting_points?: number;
|
|
1700
|
+
limit_points?: number;
|
|
1701
|
+
ranking_size?: number;
|
|
1702
|
+
page?: number;
|
|
1703
|
+
per_page?: number;
|
|
1704
|
+
include_logged_participant?: boolean;
|
|
1705
|
+
}
|
|
1706
|
+
interface AdvancedRanking<T = Record<string, unknown>> {
|
|
1707
|
+
name: string;
|
|
1708
|
+
first_name: string;
|
|
1709
|
+
last_name: string;
|
|
1710
|
+
votes: number;
|
|
1711
|
+
points: number;
|
|
1712
|
+
ranking_points: number;
|
|
1713
|
+
level: number;
|
|
1714
|
+
ranking: number;
|
|
1715
|
+
points_by_ptype: Record<string, number>;
|
|
1716
|
+
colour: string | null;
|
|
1717
|
+
/** Participant data (fields depend on the query). */
|
|
1718
|
+
data: T;
|
|
1719
|
+
}
|
|
1720
|
+
/** `GET /participants/ranks/advanced` */
|
|
1721
|
+
interface AdvancedRankingResponse<T = Record<string, unknown>> {
|
|
1722
|
+
state: string;
|
|
1723
|
+
data: AdvancedRanking<T>[];
|
|
1724
|
+
}
|
|
1725
|
+
|
|
1726
|
+
/** Segment and advanced participant rankings. */
|
|
1727
|
+
declare class RankingService {
|
|
1728
|
+
#private;
|
|
1729
|
+
getSegment(params?: SegmentRankingParams): Observable<SegmentRankingResponse>;
|
|
1730
|
+
getAdvanced<T = Record<string, unknown>>(params?: AdvancedRankingParams): Observable<AdvancedRankingResponse<T>>;
|
|
1731
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<RankingService, never>;
|
|
1732
|
+
static ɵprov: i0.ɵɵInjectableDeclaration<any>;
|
|
1733
|
+
}
|
|
1734
|
+
|
|
1735
|
+
/**
|
|
1736
|
+
* `POST /mod/referrals`. Validation errors (e.g. the code must have 10 letters/numbers) come back with
|
|
1737
|
+
* HTTP 200 and `state: 'error'`; they are thrown as an `ApiError` like any other error.
|
|
1738
|
+
*/
|
|
1739
|
+
interface ChangeReferralCodeResponse {
|
|
1740
|
+
state: string;
|
|
1741
|
+
/** The new code. */
|
|
1742
|
+
code: string;
|
|
1743
|
+
}
|
|
1744
|
+
|
|
1745
|
+
/** The participant's referral code. */
|
|
1746
|
+
declare class ReferralsService {
|
|
1747
|
+
#private;
|
|
1748
|
+
changeCode(code: string): Observable<ChangeReferralCodeResponse>;
|
|
1749
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<ReferralsService, never>;
|
|
1750
|
+
static ɵprov: i0.ɵɵInjectableDeclaration<any>;
|
|
1751
|
+
}
|
|
1752
|
+
|
|
1753
|
+
/** `GET /registrations/signupform` */
|
|
1754
|
+
interface SignupFormResponse {
|
|
1755
|
+
_id: string;
|
|
1756
|
+
fields: Field[];
|
|
1757
|
+
}
|
|
1758
|
+
/** Values keyed by the signup form field names. */
|
|
1759
|
+
type SignupData = Record<string, unknown>;
|
|
1760
|
+
/** `POST /registrations/fillup` */
|
|
1761
|
+
interface SignupResponse {
|
|
1762
|
+
state: string;
|
|
1763
|
+
message: string;
|
|
1764
|
+
code_error?: number;
|
|
1765
|
+
errors?: Record<string, string>;
|
|
1766
|
+
}
|
|
1767
|
+
/** `POST /registrations/update` */
|
|
1768
|
+
interface UpdateParticipantResponse {
|
|
1769
|
+
state?: string;
|
|
1770
|
+
success?: boolean;
|
|
1771
|
+
message?: string;
|
|
1772
|
+
code_error?: number;
|
|
1773
|
+
errors?: Record<string, string>;
|
|
1774
|
+
}
|
|
1775
|
+
/** `POST /registrations/reset_email_verify_token` */
|
|
1776
|
+
interface SendEmailVerificationTokenResponse {
|
|
1777
|
+
state: string;
|
|
1778
|
+
message: string;
|
|
1779
|
+
}
|
|
1780
|
+
/** `POST /registrations/validate_email_token` */
|
|
1781
|
+
interface ValidateEmailTokenResponse {
|
|
1782
|
+
state: string;
|
|
1783
|
+
valid: boolean;
|
|
1784
|
+
}
|
|
1785
|
+
/** `POST /registrations/confirm_email` */
|
|
1786
|
+
interface ConfirmEmailResponse {
|
|
1787
|
+
state: string;
|
|
1788
|
+
message: string;
|
|
1789
|
+
}
|
|
1790
|
+
|
|
1791
|
+
/** Signup and email verification. */
|
|
1792
|
+
declare class RegistrationsService {
|
|
1793
|
+
#private;
|
|
1794
|
+
getSignupForm(): Observable<SignupFormResponse>;
|
|
1795
|
+
signup(data: SignupData): Observable<SignupResponse>;
|
|
1796
|
+
updateParticipant(data: SignupData): Observable<UpdateParticipantResponse>;
|
|
1797
|
+
/** Sends (or resends) the email verification token to the given address. */
|
|
1798
|
+
sendEmailVerificationToken(email: string): Observable<SendEmailVerificationTokenResponse>;
|
|
1799
|
+
validateEmailToken(token: string): Observable<ValidateEmailTokenResponse>;
|
|
1800
|
+
confirmEmail(token: string): Observable<ConfirmEmailResponse>;
|
|
1801
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<RegistrationsService, never>;
|
|
1802
|
+
static ɵprov: i0.ɵɵInjectableDeclaration<any>;
|
|
1803
|
+
}
|
|
1804
|
+
|
|
1805
|
+
/** `GET /sessions/loginform` */
|
|
1806
|
+
interface LoginFormResponse {
|
|
1807
|
+
fields: Field[];
|
|
1808
|
+
}
|
|
1809
|
+
/** Credentials keyed by the login form field names, e.g. `{ email: 'ana@mail.com', password: '…' }`. */
|
|
1810
|
+
type LoginCredentials = Record<string, string>;
|
|
1811
|
+
/** `POST /sessions/login` */
|
|
1812
|
+
interface LoginResponse {
|
|
1813
|
+
state: string;
|
|
1814
|
+
message: string;
|
|
1815
|
+
code_error?: number;
|
|
1816
|
+
}
|
|
1817
|
+
/** `GET /sessions/logout` */
|
|
1818
|
+
interface LogoutResponse {
|
|
1819
|
+
state: string;
|
|
1820
|
+
message: string;
|
|
1821
|
+
code_error?: number;
|
|
1822
|
+
}
|
|
1823
|
+
/** `GET /auth/sso_login` */
|
|
1824
|
+
interface SsoLoginResponse {
|
|
1825
|
+
state: string;
|
|
1826
|
+
data: {
|
|
1827
|
+
azure_login_url: string;
|
|
1828
|
+
};
|
|
1829
|
+
message?: string;
|
|
1830
|
+
code_error?: number;
|
|
1831
|
+
}
|
|
1832
|
+
/** `GET /participant_login_requirements` */
|
|
1833
|
+
interface LoginRequirementsResponse {
|
|
1834
|
+
state: string;
|
|
1835
|
+
allowed: boolean;
|
|
1836
|
+
redirect_page: string;
|
|
1837
|
+
message: string;
|
|
1838
|
+
}
|
|
1839
|
+
|
|
1840
|
+
/** Participant session: login form, login/logout, SSO and login requirements. */
|
|
1841
|
+
declare class SessionService {
|
|
1842
|
+
#private;
|
|
1843
|
+
/** Fields the microsite asks for on login (the login identifier varies: email, code, document…). */
|
|
1844
|
+
getLoginForm(): Observable<LoginFormResponse>;
|
|
1845
|
+
login(credentials: LoginCredentials): Observable<LoginResponse>;
|
|
1846
|
+
logout(): Observable<LogoutResponse>;
|
|
1847
|
+
/** URL to redirect the participant to the SSO provider. */
|
|
1848
|
+
getSsoLoginUrl(provider: string): Observable<SsoLoginResponse>;
|
|
1849
|
+
/** Whether the logged participant can use the site or must complete something first (`redirect_page`). */
|
|
1850
|
+
checkLoginRequirements(): Observable<LoginRequirementsResponse>;
|
|
1851
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<SessionService, never>;
|
|
1852
|
+
static ɵprov: i0.ɵɵInjectableDeclaration<any>;
|
|
1853
|
+
}
|
|
1854
|
+
|
|
1855
|
+
interface TeamsParams {
|
|
1856
|
+
page?: number;
|
|
1857
|
+
q?: string;
|
|
1858
|
+
}
|
|
1859
|
+
interface ParticipantFilter {
|
|
1860
|
+
_id?: string;
|
|
1861
|
+
field: string;
|
|
1862
|
+
operator: string;
|
|
1863
|
+
val: string;
|
|
1864
|
+
}
|
|
1865
|
+
interface Team {
|
|
1866
|
+
_id: string;
|
|
1867
|
+
name: string;
|
|
1868
|
+
desc: string;
|
|
1869
|
+
slug: string;
|
|
1870
|
+
color: string;
|
|
1871
|
+
open: boolean;
|
|
1872
|
+
admin_id: string | null;
|
|
1873
|
+
participant_filter: ParticipantFilter[];
|
|
1874
|
+
teams_module_id: string;
|
|
1875
|
+
total_points: number;
|
|
1876
|
+
total_coins: Coin[];
|
|
1877
|
+
image_url: string | null;
|
|
1878
|
+
created_at: number;
|
|
1879
|
+
updated_at: number;
|
|
1880
|
+
}
|
|
1881
|
+
/** `GET /mod/teams` */
|
|
1882
|
+
interface TeamsListResponse {
|
|
1883
|
+
state: string;
|
|
1884
|
+
data: Team[];
|
|
1885
|
+
}
|
|
1886
|
+
/** `GET /mod/teams/:id/show` */
|
|
1887
|
+
interface TeamResponse {
|
|
1888
|
+
state: string;
|
|
1889
|
+
data: Team;
|
|
1890
|
+
}
|
|
1891
|
+
interface CreateTeamParams {
|
|
1892
|
+
name: string;
|
|
1893
|
+
desc: string;
|
|
1894
|
+
open: boolean;
|
|
1895
|
+
participant_filter: ParticipantFilter[];
|
|
1896
|
+
}
|
|
1897
|
+
/** `POST /mod/teams` */
|
|
1898
|
+
interface CreateTeamResponse {
|
|
1899
|
+
state: string;
|
|
1900
|
+
message?: string;
|
|
1901
|
+
data: Team;
|
|
1902
|
+
}
|
|
1903
|
+
/** `POST /mod/teams/:id/remove_member` */
|
|
1904
|
+
interface RemoveMemberResponse {
|
|
1905
|
+
state: string;
|
|
1906
|
+
message: string;
|
|
1907
|
+
}
|
|
1908
|
+
|
|
1909
|
+
/** Teams. */
|
|
1910
|
+
declare class TeamsService {
|
|
1911
|
+
#private;
|
|
1912
|
+
list(params?: TeamsParams): Observable<TeamsListResponse>;
|
|
1913
|
+
get(id: string): Observable<TeamResponse>;
|
|
1914
|
+
create(params: CreateTeamParams): Observable<CreateTeamResponse>;
|
|
1915
|
+
/** Removes the logged participant, or `uid` when given, from the team. */
|
|
1916
|
+
removeMember(id: string, uid?: string): Observable<RemoveMemberResponse>;
|
|
1917
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<TeamsService, never>;
|
|
1918
|
+
static ɵprov: i0.ɵɵInjectableDeclaration<any>;
|
|
1919
|
+
}
|
|
1920
|
+
|
|
1921
|
+
type VoteCategory = 'like' | 'support' | 'interest' | 'curiosity';
|
|
1922
|
+
/** `GET /mod/votes/:targetId` — vote counts by category and the logged participant's vote. */
|
|
1923
|
+
interface VotesResponse {
|
|
1924
|
+
state: string;
|
|
1925
|
+
data: {
|
|
1926
|
+
likes: number;
|
|
1927
|
+
supports: number;
|
|
1928
|
+
interests: number;
|
|
1929
|
+
curiosities: number;
|
|
1930
|
+
current_participant_voted_category: VoteCategory | null;
|
|
1931
|
+
};
|
|
1932
|
+
}
|
|
1933
|
+
interface CreateVoteParams {
|
|
1934
|
+
category?: VoteCategory;
|
|
1935
|
+
toggle?: boolean;
|
|
1936
|
+
}
|
|
1937
|
+
interface UpdateVoteParams {
|
|
1938
|
+
category?: VoteCategory;
|
|
1939
|
+
}
|
|
1940
|
+
/** `POST` / `PATCH` / `DELETE` `/mod/votes/:targetId` */
|
|
1941
|
+
interface VoteResponse {
|
|
1942
|
+
state: string;
|
|
1943
|
+
message?: string;
|
|
1944
|
+
}
|
|
1945
|
+
|
|
1946
|
+
/** Votes on an activity (target): like, support, interest, curiosity. */
|
|
1947
|
+
declare class VotesService {
|
|
1948
|
+
#private;
|
|
1949
|
+
get(targetId: string): Observable<VotesResponse>;
|
|
1950
|
+
create(targetId: string, params?: CreateVoteParams): Observable<VoteResponse>;
|
|
1951
|
+
update(targetId: string, params?: UpdateVoteParams): Observable<VoteResponse>;
|
|
1952
|
+
delete(targetId: string): Observable<VoteResponse>;
|
|
1953
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<VotesService, never>;
|
|
1954
|
+
static ɵprov: i0.ɵɵInjectableDeclaration<any>;
|
|
1955
|
+
}
|
|
1956
|
+
|
|
1957
|
+
export { AchievementsService, ActivitiesService, ApiError, BadgesService, BlogsService, BoardsService, CommentsService, EntriesService, ExternalFormsService, GoalsService, MetricsService, ParticipantService, PasswordService, PrizesService, RankingService, ReferralsService, RegistrationsService, SessionService, TeamsService, VotesService, isApiError, isEntryType, provideMicrositesApi };
|
|
1958
|
+
export type { AchievementType, AchievementsListResponse, AchievementsMetadata, AchievementsParams, ActivityParticipant, AdvancedRanking, AdvancedRankingParams, AdvancedRankingResponse, Badge, BadgeAchievement, BadgeConditions, BadgeResponse, BadgesListResponse, BadgesParams, BaseAchievement, BaseCurrentParticipant, BaseEntry, BaseGoal, BaseParticipant, BaseParticipantRankData, BlogPost, BlogPostEntry, BlogPostResponse, BlogPostsParams, BlogPostsResponse, BlogsMetadata, Board, BoardReportsResponse, BoardsFilter, BoardsListResponse, BoardsMetadata, BoardsParams, CalculateMetricParams, CalculateMetricResponse, Campaign, ChangePasswordParams, ChangePasswordResponse, ChangeReferralCodeResponse, CheckRedeemResponse, Coin, Comment, CommentEntry, CommentsListResponse, CommentsMetadata, CommentsParams, ConfirmEmailResponse, CreateBlogPostParams, CreateBlogPostResponse, CreateCommentParams, CreateCommentResponse, CreateExternalOptions, CreateExternalResponse, CreateTeamParams, CreateTeamResponse, CreateVoteParams, CreatedBlogPost, CreatedComment, CurrentParticipantResponse, DateFilter, DocumentEntry, EntriesListParams, EntriesMetadata, EntriesParams, EntriesResponse, Entry, EntryAdmin, EntryData, EntryFile, EntryPrize, EntryTypes, ExecuteReportParams, ExecuteReportResponse, ExternalCouponData, ExternalCouponDataResponse, ExternalEntry, ExternalForm, ExternalFormField, ExternalFormFieldChoice, ExternalFormFieldsResponse, ExternalFormFilter, ExternalFormSubmissionResponse, ExternalFormSubmissionsParams, ExternalFormSubmissionsResponse, ExternalFormsListParams, ExternalFormsListResponse, ExternalFormsMetadata, ExtraPointsEntry, Field, FieldChoice, FieldType, Goal, GoalAcceptanceResponse, GoalAchievement, GoalCondition, GoalConditionProgress, GoalData, GoalFilter, GoalsListParams, GoalsListResponse, Invoice, InvoiceProduct, KnownEntryType, LoginCredentials, LoginFormResponse, LoginRequirementsResponse, LoginResponse, LogoutResponse, Metric, MetricFilter, MetricsListResponse, MetricsParams, MicrositesApiConfig, ModuleEntry, NotificationChannel, ParticipantBadge, ParticipantBadgesResponse, ParticipantFilter, ParticipantGoal, ParticipantGoalsParams, ParticipantGoalsResponse, ParticipantListParams, ParticipantListResponse, ParticipantRank, ParticipantRankResponse, ParticipantResponse, PhotoEntry, PreRegistrationEntry, Prize, PrizeDetails, PrizeMetadata, PrizeType, PrizesListResponse, PrizesMetadata, PrizesParams, PurchaseEntry, PushSubscriptionPayload, RedeemEntry, RedeemedPrize, Redemption, RemoveMemberResponse, RemovePushSubscriptionsResponse, Report, ResetPasswordParams, ResetPasswordResponse, SavePushSubscriptionResponse, SegmentRanking, SegmentRankingParams, SegmentRankingResponse, SendEmailVerificationTokenResponse, SendResetTokenParams, SendResetTokenResponse, SignupData, SignupFormResponse, SignupResponse, SsoLoginResponse, Team, TeamResponse, TeamsListResponse, TeamsParams, ToggleWishlistResponse, UnknownEntry, UpdateParticipantResponse, UpdateVoteParams, UploadDocumentParams, UploadDocumentResponse, UploadPhotoParams, UploadPhotoResponse, ValidateChannelResponse, ValidateEmailTokenResponse, VoteCategory, VoteResponse, VotesResponse, WishlistResponse };
|