@wix/members 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 (31) hide show
  1. package/build/cjs/index.d.ts +1 -0
  2. package/build/cjs/index.js +24 -0
  3. package/build/cjs/index.js.map +1 -0
  4. package/build/cjs/src/badges-v3-badge.http.d.ts +49 -0
  5. package/build/cjs/src/badges-v3-badge.http.js +451 -0
  6. package/build/cjs/src/badges-v3-badge.http.js.map +1 -0
  7. package/build/cjs/src/badges-v3-badge.public.d.ts +16 -0
  8. package/build/cjs/src/badges-v3-badge.public.js +79 -0
  9. package/build/cjs/src/badges-v3-badge.public.js.map +1 -0
  10. package/build/cjs/src/badges-v3-badge.types.d.ts +250 -0
  11. package/build/cjs/src/badges-v3-badge.types.js +9 -0
  12. package/build/cjs/src/badges-v3-badge.types.js.map +1 -0
  13. package/build/cjs/src/badges-v3-badge.universal.d.ts +456 -0
  14. package/build/cjs/src/badges-v3-badge.universal.js +711 -0
  15. package/build/cjs/src/badges-v3-badge.universal.js.map +1 -0
  16. package/build/es/index.d.ts +1 -0
  17. package/build/es/index.js +2 -0
  18. package/build/es/index.js.map +1 -0
  19. package/build/es/src/badges-v3-badge.http.d.ts +49 -0
  20. package/build/es/src/badges-v3-badge.http.js +436 -0
  21. package/build/es/src/badges-v3-badge.http.js.map +1 -0
  22. package/build/es/src/badges-v3-badge.public.d.ts +16 -0
  23. package/build/es/src/badges-v3-badge.public.js +63 -0
  24. package/build/es/src/badges-v3-badge.public.js.map +1 -0
  25. package/build/es/src/badges-v3-badge.types.d.ts +250 -0
  26. package/build/es/src/badges-v3-badge.types.js +6 -0
  27. package/build/es/src/badges-v3-badge.types.js.map +1 -0
  28. package/build/es/src/badges-v3-badge.universal.d.ts +456 -0
  29. package/build/es/src/badges-v3-badge.universal.js +677 -0
  30. package/build/es/src/badges-v3-badge.universal.js.map +1 -0
  31. package/package.json +37 -0
@@ -0,0 +1,456 @@
1
+ export declare const __debug: {
2
+ verboseLogging: {
3
+ on: () => boolean;
4
+ off: () => boolean;
5
+ };
6
+ };
7
+ export interface Badge {
8
+ /**
9
+ * Badge ID.
10
+ * @readonly
11
+ */
12
+ _id?: string;
13
+ /** Text displayed on the badge in the Wix UI. */
14
+ title?: string | null;
15
+ /** Badge description. */
16
+ description?: string | null;
17
+ /**
18
+ * Badge background color in hexadecimal RGB format.
19
+ * Uppercase letters only.
20
+ * Example: `#FFFFFF`.
21
+ */
22
+ backgroundColor?: string | null;
23
+ /**
24
+ * Badge text color in hexadecimal RGB format.
25
+ * Uppercase letters only.
26
+ * Example: `#C81B53`.
27
+ */
28
+ textColor?: string | null;
29
+ /**
30
+ * URL of the badge icon image.
31
+ * _Recommended_ to use `SVG` image format as it is resolution independent and looks great at any scale.
32
+ */
33
+ icon?: string | null;
34
+ /**
35
+ * Whether the badge has special permissions
36
+ * to access specific members-only pages.
37
+ * When `true`, members with the badge receive special permissions,
38
+ * and site contributors can
39
+ * [manage badge permissions](https://support.wix.com/en/article/setting-permissions-for-a-member-badge)
40
+ * in the site dashboard.
41
+ * When `false`, members with the badge receive no special permissions.
42
+ */
43
+ permissionsEnabled?: boolean | null;
44
+ /**
45
+ * Slugified name. Used to represent the badge in a URL.
46
+ * @readonly
47
+ */
48
+ slug?: string | null;
49
+ /**
50
+ * Date the badge was created.
51
+ * @readonly
52
+ */
53
+ _createdDate?: Date;
54
+ /**
55
+ * Date the badge was updated.
56
+ * @readonly
57
+ */
58
+ _updatedDate?: Date;
59
+ }
60
+ export interface CreateBadgeRequest {
61
+ /** Badge to create. */
62
+ badge: Badge;
63
+ }
64
+ export interface CreateBadgeResponse {
65
+ /** Created badge. */
66
+ badge?: Badge;
67
+ }
68
+ export interface UpdateBadgeRequest {
69
+ /** Badge to update. */
70
+ badge: Badge;
71
+ }
72
+ export interface UpdateBadgeResponse {
73
+ /** Updated badge. */
74
+ badge?: Badge;
75
+ }
76
+ export interface ListBadgesRequest {
77
+ /**
78
+ * Pagination options. For more information, see
79
+ * [API Query Language: The Paging Section](https://dev.wix.com/api/rest/getting-started/api-query-language#getting-started_api-query-language_the-paging-section).
80
+ */
81
+ paging?: Paging;
82
+ }
83
+ export interface Paging {
84
+ /** Number of items to load. */
85
+ limit?: number | null;
86
+ /** Number of items to skip in the current sort order. */
87
+ offset?: number | null;
88
+ }
89
+ export interface ListBadgesResponse {
90
+ /** List of badges. */
91
+ badges?: Badge[];
92
+ /** Metadata for the paginated results. */
93
+ metadata?: PagingMetadata;
94
+ }
95
+ export interface PagingMetadata {
96
+ /** Number of items returned in the response. */
97
+ count?: number | null;
98
+ /** Offset that was requested. */
99
+ offset?: number | null;
100
+ /** Total number of items that match the query. */
101
+ total?: number | null;
102
+ /** Flag that indicates the server failed to calculate the `total` field. */
103
+ tooManyToCount?: boolean | null;
104
+ }
105
+ export interface QueryBadgesRequest {
106
+ /**
107
+ * Filter options.
108
+ * Currently supported fields for filtering:
109
+ * - id
110
+ * - title
111
+ * - slug
112
+ * For more details on how to use filter, see [API Query Language: The Filter Section](https://dev.wix.com/api/rest/getting-started/api-query-language#getting-started_api-query-language_the-filter-section).
113
+ */
114
+ filter?: Record<string, any> | null;
115
+ /**
116
+ * Sorting options.
117
+ * For more details on how to use sorting,
118
+ * see [API Query Language: The Sort Section](https://dev.wix.com/api/rest/getting-started/api-query-language#getting-started_api-query-language_the-sort-section)
119
+ */
120
+ sort?: Sorting[];
121
+ /**
122
+ * Pagination options. For more information, see
123
+ * [API Query Language: The Paging Section](https://dev.wix.com/api/rest/getting-started/api-query-language#getting-started_api-query-language_the-paging-section).
124
+ */
125
+ paging?: Paging;
126
+ }
127
+ export interface Sorting {
128
+ /** Name of the field to sort by. */
129
+ fieldName?: string;
130
+ /** Sort order. */
131
+ order?: SortOrder;
132
+ }
133
+ export declare enum SortOrder {
134
+ ASC = "ASC",
135
+ DESC = "DESC"
136
+ }
137
+ export interface QueryBadgesResponse {
138
+ /** List of badges. */
139
+ badges?: Badge[];
140
+ /** Metadata for the paginated results. */
141
+ metadata?: PagingMetadata;
142
+ }
143
+ export interface GetBadgeRequest {
144
+ /** Badge ID. */
145
+ _id: string;
146
+ }
147
+ export interface GetBadgeResponse {
148
+ /** Badge. */
149
+ badge?: Badge;
150
+ }
151
+ export interface DeleteBadgeRequest {
152
+ /** Badge ID. */
153
+ _id: string;
154
+ }
155
+ export interface DeleteBadgeResponse {
156
+ }
157
+ export interface CountBadgesRequest {
158
+ /**
159
+ * Filter options.
160
+ * Currently supported fields for filtering:
161
+ * - id
162
+ * - title
163
+ * - slug
164
+ * For more details on how to use filter, see [API Query Language: The Filter Section](https://dev.wix.com/api/rest/getting-started/api-query-language#getting-started_api-query-language_the-filter-section).
165
+ */
166
+ filter?: Record<string, any> | null;
167
+ }
168
+ export interface CountBadgesResponse {
169
+ /** Badge count. */
170
+ count?: string;
171
+ }
172
+ export interface AssignBadgeRequest {
173
+ /** Badge ID. */
174
+ _id: string;
175
+ /** List of member IDs to assign to the badge. */
176
+ memberIds: string[];
177
+ }
178
+ export interface AssignBadgeResponse {
179
+ /** List of member IDs assigned to the badge. */
180
+ memberIds?: string[];
181
+ }
182
+ export interface BadgeAssigned {
183
+ /** ID of the member who received the badge. */
184
+ memberId?: string;
185
+ }
186
+ export interface AssignBadgesRequest {
187
+ /** List of badge IDs to assign to the member. */
188
+ ids?: string[];
189
+ /** Member ID. */
190
+ memberId?: string;
191
+ }
192
+ export interface AssignBadgesResponse {
193
+ /** List of badge IDs newly assigned to the member. */
194
+ ids?: string[];
195
+ }
196
+ export interface UnassignBadgeRequest {
197
+ /** Badge ID. */
198
+ _id: string;
199
+ /** List of members to remove. */
200
+ memberIds: string[];
201
+ }
202
+ export interface UnassignBadgeResponse {
203
+ }
204
+ export interface BadgeUnassigned {
205
+ /** ID of the member who lost the badge. */
206
+ memberId?: string;
207
+ }
208
+ export interface ListMembersRequest {
209
+ /** Badge ID. */
210
+ _id: string;
211
+ /**
212
+ * Pagination options. For more information, see
213
+ * [API Query Language: The Paging Section](https://dev.wix.com/api/rest/getting-started/api-query-language#getting-started_api-query-language_the-paging-section).
214
+ */
215
+ paging?: Paging;
216
+ }
217
+ export interface ListMembersResponse {
218
+ /** Member IDs assigned to the badge. */
219
+ memberIds?: string[];
220
+ /** Metadata for the paginated results. */
221
+ metadata?: PagingMetadata;
222
+ }
223
+ export interface ListMembersBadgeIdsRequest {
224
+ /** List of members. */
225
+ memberIds: string[];
226
+ }
227
+ export interface ListMembersBadgeIdsResponse {
228
+ /** List of members and the badges they're assigned to. */
229
+ memberBadgeIds?: MemberBadgeIds[];
230
+ }
231
+ export interface MemberBadgeIds {
232
+ /** Member ID. */
233
+ memberId?: string;
234
+ /** List of badges the member is assigned to. */
235
+ badgeIds?: string[];
236
+ }
237
+ export interface GetMemberCountsPerBadgeRequest {
238
+ }
239
+ export interface GetMemberCountsPerBadgeResponse {
240
+ /** List of badges and counts of members who have each badge. */
241
+ badgeMemberCounts?: BadgeMemberCount[];
242
+ }
243
+ export interface BadgeMemberCount {
244
+ /** Badge ID. */
245
+ badgeId?: string;
246
+ /** Badge member count. */
247
+ memberCount?: number;
248
+ }
249
+ export interface UpdateBadgesDisplayOrderRequest {
250
+ /** Ordered badge IDs. */
251
+ badgeIds: string[];
252
+ }
253
+ export interface UpdateBadgesDisplayOrderResponse {
254
+ /** Reordered badges list. */
255
+ badges?: Badge[];
256
+ }
257
+ /**
258
+ * Creates a new badge.
259
+ * @param badge - Badge to create.
260
+ * @public
261
+ * @documentationMaturity preview
262
+ * @requiredField badge
263
+ * @requiredField badge.backgroundColor
264
+ * @requiredField badge.textColor
265
+ * @requiredField badge.title
266
+ */
267
+ export declare function createBadge(badge: Badge): Promise<CreateBadgeResponse>;
268
+ /**
269
+ * Updates a badge's specified properties.
270
+ * @param _id - Badge ID.
271
+ * @public
272
+ * @documentationMaturity preview
273
+ * @requiredField _id
274
+ * @requiredField badge
275
+ */
276
+ export declare function updateBadge(_id: string, badge: UpdateBadge): Promise<UpdateBadgeResponse>;
277
+ export interface UpdateBadge {
278
+ /**
279
+ * Badge ID.
280
+ * @readonly
281
+ */
282
+ _id?: string;
283
+ /** Text displayed on the badge in the Wix UI. */
284
+ title?: string | null;
285
+ /** Badge description. */
286
+ description?: string | null;
287
+ /**
288
+ * Badge background color in hexadecimal RGB format.
289
+ * Uppercase letters only.
290
+ * Example: `#FFFFFF`.
291
+ */
292
+ backgroundColor?: string | null;
293
+ /**
294
+ * Badge text color in hexadecimal RGB format.
295
+ * Uppercase letters only.
296
+ * Example: `#C81B53`.
297
+ */
298
+ textColor?: string | null;
299
+ /**
300
+ * URL of the badge icon image.
301
+ * _Recommended_ to use `SVG` image format as it is resolution independent and looks great at any scale.
302
+ */
303
+ icon?: string | null;
304
+ /**
305
+ * Whether the badge has special permissions
306
+ * to access specific members-only pages.
307
+ * When `true`, members with the badge receive special permissions,
308
+ * and site contributors can
309
+ * [manage badge permissions](https://support.wix.com/en/article/setting-permissions-for-a-member-badge)
310
+ * in the site dashboard.
311
+ * When `false`, members with the badge receive no special permissions.
312
+ */
313
+ permissionsEnabled?: boolean | null;
314
+ /**
315
+ * Slugified name. Used to represent the badge in a URL.
316
+ * @readonly
317
+ */
318
+ slug?: string | null;
319
+ /**
320
+ * Date the badge was created.
321
+ * @readonly
322
+ */
323
+ _createdDate?: Date;
324
+ /**
325
+ * Date the badge was updated.
326
+ * @readonly
327
+ */
328
+ _updatedDate?: Date;
329
+ }
330
+ /**
331
+ * Retrieves up to 1000 badges, given the requested paging.
332
+ * Default `paging.limit` is 100, `paging.offset` - 0.
333
+ * For more information, see
334
+ * [API Query Language: The Paging Section](https://dev.wix.com/api/rest/getting-started/api-query-language#getting-started_api-query-language_the-paging-section).
335
+ * @public
336
+ * @documentationMaturity preview
337
+ */
338
+ export declare function listBadges(options?: ListBadgesOptions): Promise<ListBadgesResponse>;
339
+ export interface ListBadgesOptions {
340
+ /**
341
+ * Pagination options. For more information, see
342
+ * [API Query Language: The Paging Section](https://dev.wix.com/api/rest/getting-started/api-query-language#getting-started_api-query-language_the-paging-section).
343
+ */
344
+ paging?: Paging;
345
+ }
346
+ /**
347
+ * Retrieves up to 1000 badges, given the requested query options, paging, and sorting.
348
+ * Default `paging.limit` is 100, `paging.offset` - 0.
349
+ * For more information, see
350
+ * [API Query Language: The Paging Section](https://dev.wix.com/api/rest/getting-started/api-query-language#getting-started_api-query-language_the-paging-section).
351
+ * @public
352
+ * @documentationMaturity preview
353
+ */
354
+ export declare function queryBadges(options?: QueryBadgesOptions): Promise<QueryBadgesResponse>;
355
+ export interface QueryBadgesOptions {
356
+ /**
357
+ * Filter options.
358
+ * Currently supported fields for filtering:
359
+ * - id
360
+ * - title
361
+ * - slug
362
+ * For more details on how to use filter, see [API Query Language: The Filter Section](https://dev.wix.com/api/rest/getting-started/api-query-language#getting-started_api-query-language_the-filter-section).
363
+ */
364
+ filter?: Record<string, any> | null;
365
+ /**
366
+ * Sorting options.
367
+ * For more details on how to use sorting,
368
+ * see [API Query Language: The Sort Section](https://dev.wix.com/api/rest/getting-started/api-query-language#getting-started_api-query-language_the-sort-section)
369
+ */
370
+ sort?: Sorting[];
371
+ /**
372
+ * Pagination options. For more information, see
373
+ * [API Query Language: The Paging Section](https://dev.wix.com/api/rest/getting-started/api-query-language#getting-started_api-query-language_the-paging-section).
374
+ */
375
+ paging?: Paging;
376
+ }
377
+ /**
378
+ * Retrieves a badge.
379
+ * @param _id - Badge ID.
380
+ * @public
381
+ * @documentationMaturity preview
382
+ * @requiredField _id
383
+ */
384
+ export declare function getBadge(_id: string): Promise<GetBadgeResponse>;
385
+ /**
386
+ * Deletes a badge.
387
+ * @param _id - Badge ID.
388
+ * @public
389
+ * @documentationMaturity preview
390
+ * @requiredField _id
391
+ */
392
+ export declare function deleteBadge(_id: string): Promise<void>;
393
+ /**
394
+ * Assigns a badge to the specified members.
395
+ * The members inherit the badge's permissions when they receive the badge, if applicable.
396
+ * Badge permissions are added to previous member permissions (they don't replace existing permissions).
397
+ * @param _id - Badge ID.
398
+ * @param memberIds - List of member IDs to assign to the badge.
399
+ * @public
400
+ * @documentationMaturity preview
401
+ * @requiredField _id
402
+ * @requiredField memberIds
403
+ */
404
+ export declare function assignBadge(_id: string, memberIds: string[]): Promise<AssignBadgeResponse>;
405
+ /**
406
+ * Removes the requested members from a badge.
407
+ * Members removed from a badge lose the badge's permissions, if applicable.
408
+ * @param _id - Badge ID.
409
+ * @param memberIds - List of members to remove.
410
+ * @public
411
+ * @documentationMaturity preview
412
+ * @requiredField _id
413
+ * @requiredField memberIds
414
+ */
415
+ export declare function unassignBadge(_id: string, memberIds: string[]): Promise<void>;
416
+ /**
417
+ * Retrieves up to 1000 site members
418
+ * who have a specified badge.
419
+ * Default `paging.limit` is 100, `paging.offset` - 0.
420
+ * For more details on how to use paging, see documentation
421
+ * [here](https://dev.wix.com/api/rest/getting-started/pagination).
422
+ * @param _id - Badge ID.
423
+ * @public
424
+ * @documentationMaturity preview
425
+ * @requiredField _id
426
+ */
427
+ export declare function listMembers(_id: string, options?: ListMembersOptions): Promise<ListMembersResponse>;
428
+ export interface ListMembersOptions {
429
+ /**
430
+ * Pagination options. For more information, see
431
+ * [API Query Language: The Paging Section](https://dev.wix.com/api/rest/getting-started/api-query-language#getting-started_api-query-language_the-paging-section).
432
+ */
433
+ paging?: Paging;
434
+ }
435
+ /**
436
+ * Retrieves badges assigned to the requested members.
437
+ * @param memberIds - List of members.
438
+ * @public
439
+ * @documentationMaturity preview
440
+ * @requiredField memberIds
441
+ */
442
+ export declare function listMembersBadgeIds(memberIds: string[]): Promise<ListMembersBadgeIdsResponse>;
443
+ /**
444
+ * Retrieves member count per badge.
445
+ * @public
446
+ * @documentationMaturity preview
447
+ */
448
+ export declare function getMemberCountsPerBadge(): Promise<GetMemberCountsPerBadgeResponse>;
449
+ /**
450
+ * Updates badges' display order.
451
+ * @param badgeIds - Ordered badge IDs.
452
+ * @public
453
+ * @documentationMaturity preview
454
+ * @requiredField badgeIds
455
+ */
456
+ export declare function updateBadgesDisplayOrder(badgeIds: string[]): Promise<UpdateBadgesDisplayOrderResponse>;