@wix/auto_sdk_members_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.
- package/build/cjs/index.d.ts +1 -0
- package/build/cjs/index.js +18 -0
- package/build/cjs/index.js.map +1 -0
- package/build/cjs/index.typings.d.ts +1 -0
- package/build/cjs/index.typings.js +18 -0
- package/build/cjs/index.typings.js.map +1 -0
- package/build/cjs/meta.d.ts +1 -0
- package/build/cjs/meta.js +18 -0
- package/build/cjs/meta.js.map +1 -0
- package/build/cjs/src/members-v1-member-members.context.d.ts +46 -0
- package/build/cjs/src/members-v1-member-members.context.js +59 -0
- package/build/cjs/src/members-v1-member-members.context.js.map +1 -0
- package/build/cjs/src/members-v1-member-members.http.d.ts +227 -0
- package/build/cjs/src/members-v1-member-members.http.js +957 -0
- package/build/cjs/src/members-v1-member-members.http.js.map +1 -0
- package/build/cjs/src/members-v1-member-members.meta.d.ts +60 -0
- package/build/cjs/src/members-v1-member-members.meta.js +484 -0
- package/build/cjs/src/members-v1-member-members.meta.js.map +1 -0
- package/build/cjs/src/members-v1-member-members.public.d.ts +339 -0
- package/build/cjs/src/members-v1-member-members.public.js +198 -0
- package/build/cjs/src/members-v1-member-members.public.js.map +1 -0
- package/build/cjs/src/members-v1-member-members.types.d.ts +1283 -0
- package/build/cjs/src/members-v1-member-members.types.js +167 -0
- package/build/cjs/src/members-v1-member-members.types.js.map +1 -0
- package/build/cjs/src/members-v1-member-members.universal.d.ts +2071 -0
- package/build/cjs/src/members-v1-member-members.universal.js +1264 -0
- package/build/cjs/src/members-v1-member-members.universal.js.map +1 -0
- package/build/es/index.d.ts +1 -0
- package/build/es/index.js +2 -0
- package/build/es/index.js.map +1 -0
- package/build/es/index.typings.d.ts +1 -0
- package/build/es/index.typings.js +2 -0
- package/build/es/index.typings.js.map +1 -0
- package/build/es/meta.d.ts +1 -0
- package/build/es/meta.js +2 -0
- package/build/es/meta.js.map +1 -0
- package/build/es/package.json +3 -0
- package/build/es/src/members-v1-member-members.context.d.ts +46 -0
- package/build/es/src/members-v1-member-members.context.js +46 -0
- package/build/es/src/members-v1-member-members.context.js.map +1 -0
- package/build/es/src/members-v1-member-members.http.d.ts +227 -0
- package/build/es/src/members-v1-member-members.http.js +930 -0
- package/build/es/src/members-v1-member-members.http.js.map +1 -0
- package/build/es/src/members-v1-member-members.meta.d.ts +60 -0
- package/build/es/src/members-v1-member-members.meta.js +434 -0
- package/build/es/src/members-v1-member-members.meta.js.map +1 -0
- package/build/es/src/members-v1-member-members.public.d.ts +339 -0
- package/build/es/src/members-v1-member-members.public.js +161 -0
- package/build/es/src/members-v1-member-members.public.js.map +1 -0
- package/build/es/src/members-v1-member-members.types.d.ts +1283 -0
- package/build/es/src/members-v1-member-members.types.js +164 -0
- package/build/es/src/members-v1-member-members.types.js.map +1 -0
- package/build/es/src/members-v1-member-members.universal.d.ts +2071 -0
- package/build/es/src/members-v1-member-members.universal.js +1214 -0
- package/build/es/src/members-v1-member-members.universal.js.map +1 -0
- package/build/internal/cjs/index.d.ts +1 -0
- package/build/internal/cjs/index.js +18 -0
- package/build/internal/cjs/index.js.map +1 -0
- package/build/internal/cjs/index.typings.d.ts +1 -0
- package/build/internal/cjs/index.typings.js +18 -0
- package/build/internal/cjs/index.typings.js.map +1 -0
- package/build/internal/cjs/meta.d.ts +1 -0
- package/build/internal/cjs/meta.js +18 -0
- package/build/internal/cjs/meta.js.map +1 -0
- package/build/internal/cjs/src/members-v1-member-members.context.d.ts +46 -0
- package/build/internal/cjs/src/members-v1-member-members.context.js +59 -0
- package/build/internal/cjs/src/members-v1-member-members.context.js.map +1 -0
- package/build/internal/cjs/src/members-v1-member-members.http.d.ts +227 -0
- package/build/internal/cjs/src/members-v1-member-members.http.js +957 -0
- package/build/internal/cjs/src/members-v1-member-members.http.js.map +1 -0
- package/build/internal/cjs/src/members-v1-member-members.meta.d.ts +60 -0
- package/build/internal/cjs/src/members-v1-member-members.meta.js +484 -0
- package/build/internal/cjs/src/members-v1-member-members.meta.js.map +1 -0
- package/build/internal/cjs/src/members-v1-member-members.public.d.ts +339 -0
- package/build/internal/cjs/src/members-v1-member-members.public.js +198 -0
- package/build/internal/cjs/src/members-v1-member-members.public.js.map +1 -0
- package/build/internal/cjs/src/members-v1-member-members.types.d.ts +1283 -0
- package/build/internal/cjs/src/members-v1-member-members.types.js +167 -0
- package/build/internal/cjs/src/members-v1-member-members.types.js.map +1 -0
- package/build/internal/cjs/src/members-v1-member-members.universal.d.ts +2078 -0
- package/build/internal/cjs/src/members-v1-member-members.universal.js +1264 -0
- package/build/internal/cjs/src/members-v1-member-members.universal.js.map +1 -0
- package/build/internal/es/index.d.ts +1 -0
- package/build/internal/es/index.js +2 -0
- package/build/internal/es/index.js.map +1 -0
- package/build/internal/es/index.typings.d.ts +1 -0
- package/build/internal/es/index.typings.js +2 -0
- package/build/internal/es/index.typings.js.map +1 -0
- package/build/internal/es/meta.d.ts +1 -0
- package/build/internal/es/meta.js +2 -0
- package/build/internal/es/meta.js.map +1 -0
- package/build/internal/es/src/members-v1-member-members.context.d.ts +46 -0
- package/build/internal/es/src/members-v1-member-members.context.js +46 -0
- package/build/internal/es/src/members-v1-member-members.context.js.map +1 -0
- package/build/internal/es/src/members-v1-member-members.http.d.ts +227 -0
- package/build/internal/es/src/members-v1-member-members.http.js +930 -0
- package/build/internal/es/src/members-v1-member-members.http.js.map +1 -0
- package/build/internal/es/src/members-v1-member-members.meta.d.ts +60 -0
- package/build/internal/es/src/members-v1-member-members.meta.js +434 -0
- package/build/internal/es/src/members-v1-member-members.meta.js.map +1 -0
- package/build/internal/es/src/members-v1-member-members.public.d.ts +339 -0
- package/build/internal/es/src/members-v1-member-members.public.js +161 -0
- package/build/internal/es/src/members-v1-member-members.public.js.map +1 -0
- package/build/internal/es/src/members-v1-member-members.types.d.ts +1283 -0
- package/build/internal/es/src/members-v1-member-members.types.js +164 -0
- package/build/internal/es/src/members-v1-member-members.types.js.map +1 -0
- package/build/internal/es/src/members-v1-member-members.universal.d.ts +2078 -0
- package/build/internal/es/src/members-v1-member-members.universal.js +1214 -0
- package/build/internal/es/src/members-v1-member-members.universal.js.map +1 -0
- package/meta/package.json +3 -0
- package/package.json +52 -0
|
@@ -0,0 +1,1214 @@
|
|
|
1
|
+
import { transformError as sdkTransformError } from '@wix/sdk-runtime/transform-error';
|
|
2
|
+
import { queryBuilder } from '@wix/sdk-runtime/query-builder';
|
|
3
|
+
import { renameKeysFromSDKRequestToRESTRequest, renameKeysFromRESTResponseToSDKResponse, } from '@wix/sdk-runtime/rename-all-nested-keys';
|
|
4
|
+
import * as ambassadorWixMembersV1Member from './members-v1-member-members.http.js';
|
|
5
|
+
export var Status;
|
|
6
|
+
(function (Status) {
|
|
7
|
+
/** Insufficient permissions to get the status. */
|
|
8
|
+
Status["UNKNOWN"] = "UNKNOWN";
|
|
9
|
+
/** Member created and is waiting for approval by site owner. */
|
|
10
|
+
Status["PENDING"] = "PENDING";
|
|
11
|
+
/** Member can log in to the site. */
|
|
12
|
+
Status["APPROVED"] = "APPROVED";
|
|
13
|
+
/** Member is blocked and can't log in to the site. */
|
|
14
|
+
Status["BLOCKED"] = "BLOCKED";
|
|
15
|
+
/** Member is a [guest author](https://support.wix.com/en/article/wix-blog-adding-guest-authors-to-your-blog) for the site blog and can't log in to the site. */
|
|
16
|
+
Status["OFFLINE"] = "OFFLINE";
|
|
17
|
+
})(Status || (Status = {}));
|
|
18
|
+
export var PrivacyStatusStatus;
|
|
19
|
+
(function (PrivacyStatusStatus) {
|
|
20
|
+
/** Insufficient permissions to get the status. */
|
|
21
|
+
PrivacyStatusStatus["UNKNOWN"] = "UNKNOWN";
|
|
22
|
+
/** Member is hidden from site visitors and other site members. Member is returned only to site contributors and apps with the appropriate permissions. */
|
|
23
|
+
PrivacyStatusStatus["PRIVATE"] = "PRIVATE";
|
|
24
|
+
/** Member is visible to everyone. */
|
|
25
|
+
PrivacyStatusStatus["PUBLIC"] = "PUBLIC";
|
|
26
|
+
})(PrivacyStatusStatus || (PrivacyStatusStatus = {}));
|
|
27
|
+
export var ActivityStatusStatus;
|
|
28
|
+
(function (ActivityStatusStatus) {
|
|
29
|
+
/** Insufficient permissions to get the status. */
|
|
30
|
+
ActivityStatusStatus["UNKNOWN"] = "UNKNOWN";
|
|
31
|
+
/** Member can write forum posts and blog comments. */
|
|
32
|
+
ActivityStatusStatus["ACTIVE"] = "ACTIVE";
|
|
33
|
+
/** Member can't write forum posts or blog comments. */
|
|
34
|
+
ActivityStatusStatus["MUTED"] = "MUTED";
|
|
35
|
+
})(ActivityStatusStatus || (ActivityStatusStatus = {}));
|
|
36
|
+
export var Set;
|
|
37
|
+
(function (Set) {
|
|
38
|
+
/**
|
|
39
|
+
* Includes `id`, `contactId`, `createdDate`, `updatedDate` and the `profile` object.
|
|
40
|
+
* `status`, `privacyStatus`, and `activityStatus` are returned as `UNKNOWN`.
|
|
41
|
+
*/
|
|
42
|
+
Set["PUBLIC"] = "PUBLIC";
|
|
43
|
+
/** Includes `id`, `loginEmail`, `status`, `contactId`, `createdDate`, `updatedDate`, `privacyStatus`, `activityStatus` and the `profile` object. */
|
|
44
|
+
Set["EXTENDED"] = "EXTENDED";
|
|
45
|
+
/** Includes all fields. */
|
|
46
|
+
Set["FULL"] = "FULL";
|
|
47
|
+
})(Set || (Set = {}));
|
|
48
|
+
export var SortOrder;
|
|
49
|
+
(function (SortOrder) {
|
|
50
|
+
SortOrder["ASC"] = "ASC";
|
|
51
|
+
SortOrder["DESC"] = "DESC";
|
|
52
|
+
})(SortOrder || (SortOrder = {}));
|
|
53
|
+
export var State;
|
|
54
|
+
(function (State) {
|
|
55
|
+
State["UNKNOWN"] = "UNKNOWN";
|
|
56
|
+
State["ENABLED"] = "ENABLED";
|
|
57
|
+
State["DISABLED"] = "DISABLED";
|
|
58
|
+
State["PENDING"] = "PENDING";
|
|
59
|
+
State["DEMO"] = "DEMO";
|
|
60
|
+
})(State || (State = {}));
|
|
61
|
+
export var SiteCreatedContext;
|
|
62
|
+
(function (SiteCreatedContext) {
|
|
63
|
+
/** A valid option, we don't expose all reasons why site might be created. */
|
|
64
|
+
SiteCreatedContext["OTHER"] = "OTHER";
|
|
65
|
+
/** A meta site was created from template. */
|
|
66
|
+
SiteCreatedContext["FROM_TEMPLATE"] = "FROM_TEMPLATE";
|
|
67
|
+
/** A meta site was created by copying of the transfferred meta site. */
|
|
68
|
+
SiteCreatedContext["DUPLICATE_BY_SITE_TRANSFER"] = "DUPLICATE_BY_SITE_TRANSFER";
|
|
69
|
+
/** A copy of existing meta site. */
|
|
70
|
+
SiteCreatedContext["DUPLICATE"] = "DUPLICATE";
|
|
71
|
+
/** A meta site was created as a transfferred site (copy of the original), old flow, should die soon. */
|
|
72
|
+
SiteCreatedContext["OLD_SITE_TRANSFER"] = "OLD_SITE_TRANSFER";
|
|
73
|
+
/** deprecated A meta site was created for Flash editor. */
|
|
74
|
+
SiteCreatedContext["FLASH"] = "FLASH";
|
|
75
|
+
})(SiteCreatedContext || (SiteCreatedContext = {}));
|
|
76
|
+
export var Namespace;
|
|
77
|
+
(function (Namespace) {
|
|
78
|
+
Namespace["UNKNOWN_NAMESPACE"] = "UNKNOWN_NAMESPACE";
|
|
79
|
+
/** Default namespace for UGC sites. MetaSites with this namespace will be shown in a user's site list by default. */
|
|
80
|
+
Namespace["WIX"] = "WIX";
|
|
81
|
+
/** ShoutOut stand alone product. These are siteless (no actual Wix site, no HtmlWeb). MetaSites with this namespace will *not* be shown in a user's site list by default. */
|
|
82
|
+
Namespace["SHOUT_OUT"] = "SHOUT_OUT";
|
|
83
|
+
/** MetaSites created by the Albums product, they appear as part of the Albums app. MetaSites with this namespace will *not* be shown in a user's site list by default. */
|
|
84
|
+
Namespace["ALBUMS"] = "ALBUMS";
|
|
85
|
+
/** Part of the WixStores migration flow, a user tries to migrate and gets this site to view and if the user likes it then stores removes this namespace and deletes the old site with the old stores. MetaSites with this namespace will *not* be shown in a user's site list by default. */
|
|
86
|
+
Namespace["WIX_STORES_TEST_DRIVE"] = "WIX_STORES_TEST_DRIVE";
|
|
87
|
+
/** Hotels standalone (siteless). MetaSites with this namespace will *not* be shown in a user's site list by default. */
|
|
88
|
+
Namespace["HOTELS"] = "HOTELS";
|
|
89
|
+
/** Clubs siteless MetaSites, a club without a wix website. MetaSites with this namespace will *not* be shown in a user's site list by default. */
|
|
90
|
+
Namespace["CLUBS"] = "CLUBS";
|
|
91
|
+
/** A partially created ADI website. MetaSites with this namespace will *not* be shown in a user's site list by default. */
|
|
92
|
+
Namespace["ONBOARDING_DRAFT"] = "ONBOARDING_DRAFT";
|
|
93
|
+
/** AppBuilder for AppStudio / shmite (c). MetaSites with this namespace will *not* be shown in a user's site list by default. */
|
|
94
|
+
Namespace["DEV_SITE"] = "DEV_SITE";
|
|
95
|
+
/** LogoMaker websites offered to the user after logo purchase. MetaSites with this namespace will *not* be shown in a user's site list by default. */
|
|
96
|
+
Namespace["LOGOS"] = "LOGOS";
|
|
97
|
+
/** VideoMaker websites offered to the user after video purchase. MetaSites with this namespace will *not* be shown in a user's site list by default. */
|
|
98
|
+
Namespace["VIDEO_MAKER"] = "VIDEO_MAKER";
|
|
99
|
+
/** MetaSites with this namespace will *not* be shown in a user's site list by default. */
|
|
100
|
+
Namespace["PARTNER_DASHBOARD"] = "PARTNER_DASHBOARD";
|
|
101
|
+
/** MetaSites with this namespace will *not* be shown in a user's site list by default. */
|
|
102
|
+
Namespace["DEV_CENTER_COMPANY"] = "DEV_CENTER_COMPANY";
|
|
103
|
+
/**
|
|
104
|
+
* A draft created by HTML editor on open. Upon "first save" it will be moved to be of WIX domain.
|
|
105
|
+
*
|
|
106
|
+
* Meta site with this namespace will *not* be shown in a user's site list by default.
|
|
107
|
+
*/
|
|
108
|
+
Namespace["HTML_DRAFT"] = "HTML_DRAFT";
|
|
109
|
+
/**
|
|
110
|
+
* the user-journey for Fitness users who want to start from managing their business instead of designing their website.
|
|
111
|
+
* Will be accessible from Site List and will not have a website app.
|
|
112
|
+
* Once the user attaches a site, the site will become a regular wixsite.
|
|
113
|
+
*/
|
|
114
|
+
Namespace["SITELESS_BUSINESS"] = "SITELESS_BUSINESS";
|
|
115
|
+
/** Belongs to "strategic products" company. Supports new product in the creator's economy space. */
|
|
116
|
+
Namespace["CREATOR_ECONOMY"] = "CREATOR_ECONOMY";
|
|
117
|
+
/** It is to be used in the Business First efforts. */
|
|
118
|
+
Namespace["DASHBOARD_FIRST"] = "DASHBOARD_FIRST";
|
|
119
|
+
/** Bookings business flow with no site. */
|
|
120
|
+
Namespace["ANYWHERE"] = "ANYWHERE";
|
|
121
|
+
/** Namespace for Headless Backoffice with no editor */
|
|
122
|
+
Namespace["HEADLESS"] = "HEADLESS";
|
|
123
|
+
/**
|
|
124
|
+
* Namespace for master site that will exist in parent account that will be referenced by subaccounts
|
|
125
|
+
* The site will be used for account level CSM feature for enterprise
|
|
126
|
+
*/
|
|
127
|
+
Namespace["ACCOUNT_MASTER_CMS"] = "ACCOUNT_MASTER_CMS";
|
|
128
|
+
/** Rise.ai Siteless account management for Gift Cards and Store Credit. */
|
|
129
|
+
Namespace["RISE"] = "RISE";
|
|
130
|
+
/**
|
|
131
|
+
* As part of the branded app new funnel, users now can create a meta site that will be branded app first.
|
|
132
|
+
* There's a blank site behind the scene but it's blank).
|
|
133
|
+
* The Mobile company will be the owner of this namespace.
|
|
134
|
+
*/
|
|
135
|
+
Namespace["BRANDED_FIRST"] = "BRANDED_FIRST";
|
|
136
|
+
/** Nownia.com Siteless account management for Ai Scheduling Assistant. */
|
|
137
|
+
Namespace["NOWNIA"] = "NOWNIA";
|
|
138
|
+
/**
|
|
139
|
+
* UGC Templates are templates that are created by users for personal use and to sale to other users.
|
|
140
|
+
* The Partners company owns this namespace.
|
|
141
|
+
*/
|
|
142
|
+
Namespace["UGC_TEMPLATE"] = "UGC_TEMPLATE";
|
|
143
|
+
/** Codux Headless Sites */
|
|
144
|
+
Namespace["CODUX"] = "CODUX";
|
|
145
|
+
/** Bobb - AI Design Creator. */
|
|
146
|
+
Namespace["MEDIA_DESIGN_CREATOR"] = "MEDIA_DESIGN_CREATOR";
|
|
147
|
+
/**
|
|
148
|
+
* Shared Blog Site is a unique single site across Enterprise account,
|
|
149
|
+
* This site will hold all Blog posts related to the Marketing product.
|
|
150
|
+
*/
|
|
151
|
+
Namespace["SHARED_BLOG_ENTERPRISE"] = "SHARED_BLOG_ENTERPRISE";
|
|
152
|
+
})(Namespace || (Namespace = {}));
|
|
153
|
+
export var DeleteStatus;
|
|
154
|
+
(function (DeleteStatus) {
|
|
155
|
+
DeleteStatus["UNKNOWN"] = "UNKNOWN";
|
|
156
|
+
DeleteStatus["TRASH"] = "TRASH";
|
|
157
|
+
DeleteStatus["DELETED"] = "DELETED";
|
|
158
|
+
DeleteStatus["PENDING_PURGE"] = "PENDING_PURGE";
|
|
159
|
+
})(DeleteStatus || (DeleteStatus = {}));
|
|
160
|
+
export var WebhookIdentityType;
|
|
161
|
+
(function (WebhookIdentityType) {
|
|
162
|
+
WebhookIdentityType["UNKNOWN"] = "UNKNOWN";
|
|
163
|
+
WebhookIdentityType["ANONYMOUS_VISITOR"] = "ANONYMOUS_VISITOR";
|
|
164
|
+
WebhookIdentityType["MEMBER"] = "MEMBER";
|
|
165
|
+
WebhookIdentityType["WIX_USER"] = "WIX_USER";
|
|
166
|
+
WebhookIdentityType["APP"] = "APP";
|
|
167
|
+
})(WebhookIdentityType || (WebhookIdentityType = {}));
|
|
168
|
+
/**
|
|
169
|
+
* Updates the currently logged in member's slug.
|
|
170
|
+
*
|
|
171
|
+
* The `slug` is the end of a member's URL that refers to a specific logged-in member. For example, if a member's URL is `https://example.com/member/{my-member-slug}`, the slug is `my-member-slug`. The slug is case-sensitive and is generally derived from the member's `nickname`; otherwise, it's derived from the `loginEmail`.
|
|
172
|
+
*
|
|
173
|
+
* > **Note:**
|
|
174
|
+
* > Only logged-in members can call this function without elevated permissions.
|
|
175
|
+
* > To call this function as a different identity, [elevated permissions](https://www.wix.com/velo/reference/wix-auth/elevate) are required.
|
|
176
|
+
* @param slug - New slug.
|
|
177
|
+
* @public
|
|
178
|
+
* @requiredField slug
|
|
179
|
+
* @permissionId MEMBERS.MEMBER_UPDATE
|
|
180
|
+
* @permissionScope Manage Members
|
|
181
|
+
* @permissionScopeId SCOPE.DC-MEMBERS.MANAGE-MEMBERS
|
|
182
|
+
* @permissionScope Manage Bookings Services and Settings
|
|
183
|
+
* @permissionScopeId SCOPE.BOOKINGS.CONFIGURATION
|
|
184
|
+
* @permissionScope Manage Portfolio
|
|
185
|
+
* @permissionScopeId SCOPE.PORTFOLIO.MANAGE-PORTFOLIO
|
|
186
|
+
* @permissionScope Manage Restaurants - all permissions
|
|
187
|
+
* @permissionScopeId SCOPE.RESTAURANTS.MEGA-SCOPES
|
|
188
|
+
* @applicableIdentity APP
|
|
189
|
+
* @applicableIdentity MEMBER
|
|
190
|
+
* @fqn com.wixpress.members.api.Members.UpdateMySlug
|
|
191
|
+
*/
|
|
192
|
+
export async function updateCurrentMemberSlug(slug) {
|
|
193
|
+
// @ts-ignore
|
|
194
|
+
const { httpClient, sideEffects } = arguments[1];
|
|
195
|
+
const payload = renameKeysFromSDKRequestToRESTRequest({ slug: slug });
|
|
196
|
+
const reqOpts = ambassadorWixMembersV1Member.updateMySlug(payload);
|
|
197
|
+
sideEffects?.onSiteCall?.();
|
|
198
|
+
try {
|
|
199
|
+
const result = await httpClient.request(reqOpts);
|
|
200
|
+
sideEffects?.onSuccess?.(result);
|
|
201
|
+
return renameKeysFromRESTResponseToSDKResponse(result.data);
|
|
202
|
+
}
|
|
203
|
+
catch (err) {
|
|
204
|
+
const transformedError = sdkTransformError(err, {
|
|
205
|
+
spreadPathsToArguments: {},
|
|
206
|
+
explicitPathsToArguments: { slug: '$[0]' },
|
|
207
|
+
singleArgumentUnchanged: false,
|
|
208
|
+
}, ['slug']);
|
|
209
|
+
sideEffects?.onError?.(err);
|
|
210
|
+
throw transformedError;
|
|
211
|
+
}
|
|
212
|
+
}
|
|
213
|
+
/**
|
|
214
|
+
* Updates the member's slug.
|
|
215
|
+
* @param _id - Member ID.
|
|
216
|
+
* @param slug - New slug.
|
|
217
|
+
* @public
|
|
218
|
+
* @requiredField _id
|
|
219
|
+
* @requiredField slug
|
|
220
|
+
* @permissionId MEMBERS.MEMBER_UPDATE
|
|
221
|
+
* @permissionScope Manage Members
|
|
222
|
+
* @permissionScopeId SCOPE.DC-MEMBERS.MANAGE-MEMBERS
|
|
223
|
+
* @permissionScope Manage Bookings Services and Settings
|
|
224
|
+
* @permissionScopeId SCOPE.BOOKINGS.CONFIGURATION
|
|
225
|
+
* @permissionScope Manage Portfolio
|
|
226
|
+
* @permissionScopeId SCOPE.PORTFOLIO.MANAGE-PORTFOLIO
|
|
227
|
+
* @permissionScope Manage Restaurants - all permissions
|
|
228
|
+
* @permissionScopeId SCOPE.RESTAURANTS.MEGA-SCOPES
|
|
229
|
+
* @applicableIdentity APP
|
|
230
|
+
* @applicableIdentity MEMBER
|
|
231
|
+
* @fqn com.wixpress.members.api.Members.UpdateMemberSlug
|
|
232
|
+
*/
|
|
233
|
+
export async function updateMemberSlug(_id, slug) {
|
|
234
|
+
// @ts-ignore
|
|
235
|
+
const { httpClient, sideEffects } = arguments[2];
|
|
236
|
+
const payload = renameKeysFromSDKRequestToRESTRequest({
|
|
237
|
+
id: _id,
|
|
238
|
+
slug: slug,
|
|
239
|
+
});
|
|
240
|
+
const reqOpts = ambassadorWixMembersV1Member.updateMemberSlug(payload);
|
|
241
|
+
sideEffects?.onSiteCall?.();
|
|
242
|
+
try {
|
|
243
|
+
const result = await httpClient.request(reqOpts);
|
|
244
|
+
sideEffects?.onSuccess?.(result);
|
|
245
|
+
return renameKeysFromRESTResponseToSDKResponse(result.data);
|
|
246
|
+
}
|
|
247
|
+
catch (err) {
|
|
248
|
+
const transformedError = sdkTransformError(err, {
|
|
249
|
+
spreadPathsToArguments: {},
|
|
250
|
+
explicitPathsToArguments: { id: '$[0]', slug: '$[1]' },
|
|
251
|
+
singleArgumentUnchanged: false,
|
|
252
|
+
}, ['_id', 'slug']);
|
|
253
|
+
sideEffects?.onError?.(err);
|
|
254
|
+
throw transformedError;
|
|
255
|
+
}
|
|
256
|
+
}
|
|
257
|
+
/**
|
|
258
|
+
* Joins the currently logged-in member to the site community and sets their profile to public.
|
|
259
|
+
*
|
|
260
|
+
* When a member's profile is public, they have access to the site's
|
|
261
|
+
* [Members Area](https://support.wix.com/en/article/about-members-area)
|
|
262
|
+
* features — such as chat, forum, and followers —
|
|
263
|
+
* and their profile is visible to other members and site visitors.
|
|
264
|
+
*
|
|
265
|
+
* > **Note:**
|
|
266
|
+
* > Only logged-in members can call this function without elevated permissions.
|
|
267
|
+
* > To call this function as a different identity, [elevated permissions](https://www.wix.com/velo/reference/wix-auth/elevate) are required.
|
|
268
|
+
* @public
|
|
269
|
+
* @permissionId MEMBERS.MEMBER_JOIN_COMMUNITY
|
|
270
|
+
* @applicableIdentity MEMBER
|
|
271
|
+
* @returns Member profile.
|
|
272
|
+
* @fqn com.wixpress.members.api.Members.JoinCommunity
|
|
273
|
+
*/
|
|
274
|
+
export async function joinCommunity() {
|
|
275
|
+
// @ts-ignore
|
|
276
|
+
const { httpClient, sideEffects } = arguments[0];
|
|
277
|
+
const payload = renameKeysFromSDKRequestToRESTRequest({});
|
|
278
|
+
const reqOpts = ambassadorWixMembersV1Member.joinCommunity(payload);
|
|
279
|
+
sideEffects?.onSiteCall?.();
|
|
280
|
+
try {
|
|
281
|
+
const result = await httpClient.request(reqOpts);
|
|
282
|
+
sideEffects?.onSuccess?.(result);
|
|
283
|
+
return renameKeysFromRESTResponseToSDKResponse(result.data);
|
|
284
|
+
}
|
|
285
|
+
catch (err) {
|
|
286
|
+
const transformedError = sdkTransformError(err, {
|
|
287
|
+
spreadPathsToArguments: {},
|
|
288
|
+
explicitPathsToArguments: {},
|
|
289
|
+
singleArgumentUnchanged: false,
|
|
290
|
+
}, []);
|
|
291
|
+
sideEffects?.onError?.(err);
|
|
292
|
+
throw transformedError;
|
|
293
|
+
}
|
|
294
|
+
}
|
|
295
|
+
/**
|
|
296
|
+
* Removes the currently logged-in member from the site community and sets their profile to private.
|
|
297
|
+
*
|
|
298
|
+
* When a member's profile is private,
|
|
299
|
+
* they do not have access to the site's
|
|
300
|
+
* [Members Area](https://support.wix.com/en/article/about-members-area)
|
|
301
|
+
* features — such as chat, forum, and followers —
|
|
302
|
+
* and their profile is hidden from other members and site visitors.
|
|
303
|
+
*
|
|
304
|
+
* > **Notes:**
|
|
305
|
+
* > + If a member leaves the site's community, their content (such as forum posts and blog comments) remain publicly visible.
|
|
306
|
+
*
|
|
307
|
+
* > + Only logged-in members can call this function without elevated permissions.
|
|
308
|
+
* > + To call this function as a different identity, [elevated permissions](https://www.wix.com/velo/reference/wix-auth/elevate) are required.
|
|
309
|
+
* @public
|
|
310
|
+
* @permissionId MEMBERS.MEMBER_JOIN_COMMUNITY
|
|
311
|
+
* @applicableIdentity MEMBER
|
|
312
|
+
* @returns Member profile.
|
|
313
|
+
* @fqn com.wixpress.members.api.Members.LeaveCommunity
|
|
314
|
+
*/
|
|
315
|
+
export async function leaveCommunity() {
|
|
316
|
+
// @ts-ignore
|
|
317
|
+
const { httpClient, sideEffects } = arguments[0];
|
|
318
|
+
const payload = renameKeysFromSDKRequestToRESTRequest({});
|
|
319
|
+
const reqOpts = ambassadorWixMembersV1Member.leaveCommunity(payload);
|
|
320
|
+
sideEffects?.onSiteCall?.();
|
|
321
|
+
try {
|
|
322
|
+
const result = await httpClient.request(reqOpts);
|
|
323
|
+
sideEffects?.onSuccess?.(result);
|
|
324
|
+
return renameKeysFromRESTResponseToSDKResponse(result.data);
|
|
325
|
+
}
|
|
326
|
+
catch (err) {
|
|
327
|
+
const transformedError = sdkTransformError(err, {
|
|
328
|
+
spreadPathsToArguments: {},
|
|
329
|
+
explicitPathsToArguments: {},
|
|
330
|
+
singleArgumentUnchanged: false,
|
|
331
|
+
}, []);
|
|
332
|
+
sideEffects?.onError?.(err);
|
|
333
|
+
throw transformedError;
|
|
334
|
+
}
|
|
335
|
+
}
|
|
336
|
+
/**
|
|
337
|
+
* Retrieves the currently logged-in member.
|
|
338
|
+
* @public
|
|
339
|
+
* @permissionId MEMBERS.MEMBER_READ
|
|
340
|
+
* @permissionScope Manage Members
|
|
341
|
+
* @permissionScopeId SCOPE.DC-MEMBERS.MANAGE-MEMBERS
|
|
342
|
+
* @permissionScope Manage Bookings Services and Settings
|
|
343
|
+
* @permissionScopeId SCOPE.BOOKINGS.CONFIGURATION
|
|
344
|
+
* @permissionScope Manage Portfolio
|
|
345
|
+
* @permissionScopeId SCOPE.PORTFOLIO.MANAGE-PORTFOLIO
|
|
346
|
+
* @permissionScope Read Members and Contacts - all read permissions
|
|
347
|
+
* @permissionScopeId SCOPE.DC-CONTACTS-MEGA.READ-MEMBERS-CONTACTS
|
|
348
|
+
* @permissionScope Manage Restaurants - all permissions
|
|
349
|
+
* @permissionScopeId SCOPE.RESTAURANTS.MEGA-SCOPES
|
|
350
|
+
* @permissionScope Read Members
|
|
351
|
+
* @permissionScopeId SCOPE.DC-MEMBERS.READ-MEMBERS
|
|
352
|
+
* @permissionScope Manage Members and Contacts - all permissions
|
|
353
|
+
* @permissionScopeId SCOPE.DC-CONTACTS-MEGA.MANAGE-MEMBERS-CONTACTS
|
|
354
|
+
* @applicableIdentity APP
|
|
355
|
+
* @applicableIdentity VISITOR
|
|
356
|
+
* @returns Member profile.
|
|
357
|
+
* @fqn com.wixpress.members.api.Members.GetMyMember
|
|
358
|
+
*/
|
|
359
|
+
export async function getCurrentMember(options) {
|
|
360
|
+
// @ts-ignore
|
|
361
|
+
const { httpClient, sideEffects } = arguments[1];
|
|
362
|
+
const payload = renameKeysFromSDKRequestToRESTRequest({
|
|
363
|
+
fieldSet: options?.fieldSet,
|
|
364
|
+
fieldsets: options?.fieldsets,
|
|
365
|
+
});
|
|
366
|
+
const reqOpts = ambassadorWixMembersV1Member.getMyMember(payload);
|
|
367
|
+
sideEffects?.onSiteCall?.();
|
|
368
|
+
try {
|
|
369
|
+
const result = await httpClient.request(reqOpts);
|
|
370
|
+
sideEffects?.onSuccess?.(result);
|
|
371
|
+
return renameKeysFromRESTResponseToSDKResponse(result.data);
|
|
372
|
+
}
|
|
373
|
+
catch (err) {
|
|
374
|
+
const transformedError = sdkTransformError(err, {
|
|
375
|
+
spreadPathsToArguments: {},
|
|
376
|
+
explicitPathsToArguments: {
|
|
377
|
+
fieldSet: '$[0].fieldSet',
|
|
378
|
+
fieldsets: '$[0].fieldsets',
|
|
379
|
+
},
|
|
380
|
+
singleArgumentUnchanged: false,
|
|
381
|
+
}, ['options']);
|
|
382
|
+
sideEffects?.onError?.(err);
|
|
383
|
+
throw transformedError;
|
|
384
|
+
}
|
|
385
|
+
}
|
|
386
|
+
/**
|
|
387
|
+
* Retrieves a member by ID.
|
|
388
|
+
*
|
|
389
|
+
* >**Note:** The returned Member object contains only the fields that were explicitly added to the Member object. Custom Contact fields are **not** automatically added to the Member object. They must be [added to the Member object by the site owner](https://support.wix.com/en/article/site-members-customizing-your-member-profile-fields).
|
|
390
|
+
*
|
|
391
|
+
* @param _id - Member ID.
|
|
392
|
+
* @public
|
|
393
|
+
* @requiredField _id
|
|
394
|
+
* @param options - Fieldset options.
|
|
395
|
+
* @permissionId MEMBERS.MEMBER_READ
|
|
396
|
+
* @permissionScope Manage Members
|
|
397
|
+
* @permissionScopeId SCOPE.DC-MEMBERS.MANAGE-MEMBERS
|
|
398
|
+
* @permissionScope Manage Bookings Services and Settings
|
|
399
|
+
* @permissionScopeId SCOPE.BOOKINGS.CONFIGURATION
|
|
400
|
+
* @permissionScope Manage Portfolio
|
|
401
|
+
* @permissionScopeId SCOPE.PORTFOLIO.MANAGE-PORTFOLIO
|
|
402
|
+
* @permissionScope Read Members and Contacts - all read permissions
|
|
403
|
+
* @permissionScopeId SCOPE.DC-CONTACTS-MEGA.READ-MEMBERS-CONTACTS
|
|
404
|
+
* @permissionScope Manage Restaurants - all permissions
|
|
405
|
+
* @permissionScopeId SCOPE.RESTAURANTS.MEGA-SCOPES
|
|
406
|
+
* @permissionScope Read Members
|
|
407
|
+
* @permissionScopeId SCOPE.DC-MEMBERS.READ-MEMBERS
|
|
408
|
+
* @permissionScope Manage Members and Contacts - all permissions
|
|
409
|
+
* @permissionScopeId SCOPE.DC-CONTACTS-MEGA.MANAGE-MEMBERS-CONTACTS
|
|
410
|
+
* @applicableIdentity APP
|
|
411
|
+
* @applicableIdentity VISITOR
|
|
412
|
+
* @returns The requested member.
|
|
413
|
+
* @fqn com.wixpress.members.api.Members.GetMember
|
|
414
|
+
*/
|
|
415
|
+
export async function getMember(_id, options) {
|
|
416
|
+
// @ts-ignore
|
|
417
|
+
const { httpClient, sideEffects } = arguments[2];
|
|
418
|
+
const payload = renameKeysFromSDKRequestToRESTRequest({
|
|
419
|
+
id: _id,
|
|
420
|
+
fieldsets: options?.fieldsets,
|
|
421
|
+
});
|
|
422
|
+
const reqOpts = ambassadorWixMembersV1Member.getMember(payload);
|
|
423
|
+
sideEffects?.onSiteCall?.();
|
|
424
|
+
try {
|
|
425
|
+
const result = await httpClient.request(reqOpts);
|
|
426
|
+
sideEffects?.onSuccess?.(result);
|
|
427
|
+
return renameKeysFromRESTResponseToSDKResponse(result.data)?.member;
|
|
428
|
+
}
|
|
429
|
+
catch (err) {
|
|
430
|
+
const transformedError = sdkTransformError(err, {
|
|
431
|
+
spreadPathsToArguments: {},
|
|
432
|
+
explicitPathsToArguments: { id: '$[0]', fieldsets: '$[1].fieldsets' },
|
|
433
|
+
singleArgumentUnchanged: false,
|
|
434
|
+
}, ['_id', 'options']);
|
|
435
|
+
sideEffects?.onError?.(err);
|
|
436
|
+
throw transformedError;
|
|
437
|
+
}
|
|
438
|
+
}
|
|
439
|
+
/**
|
|
440
|
+
* Lists site members, given the provided paging and fieldsets.
|
|
441
|
+
*
|
|
442
|
+
* - `PUBLIC` fieldset returns `id` and `profile` object. `status`, `privacyStatus` and `activityStatus` are returned as `UNKNOWN`.
|
|
443
|
+
* - `FULL` fieldset returns all fields.
|
|
444
|
+
* @public
|
|
445
|
+
* @param options - Options for paging, sorting, and specifying fields to return.
|
|
446
|
+
* @permissionId MEMBERS.MEMBER_READ
|
|
447
|
+
* @permissionScope Manage Members
|
|
448
|
+
* @permissionScopeId SCOPE.DC-MEMBERS.MANAGE-MEMBERS
|
|
449
|
+
* @permissionScope Manage Bookings Services and Settings
|
|
450
|
+
* @permissionScopeId SCOPE.BOOKINGS.CONFIGURATION
|
|
451
|
+
* @permissionScope Manage Portfolio
|
|
452
|
+
* @permissionScopeId SCOPE.PORTFOLIO.MANAGE-PORTFOLIO
|
|
453
|
+
* @permissionScope Read Members and Contacts - all read permissions
|
|
454
|
+
* @permissionScopeId SCOPE.DC-CONTACTS-MEGA.READ-MEMBERS-CONTACTS
|
|
455
|
+
* @permissionScope Manage Restaurants - all permissions
|
|
456
|
+
* @permissionScopeId SCOPE.RESTAURANTS.MEGA-SCOPES
|
|
457
|
+
* @permissionScope Read Members
|
|
458
|
+
* @permissionScopeId SCOPE.DC-MEMBERS.READ-MEMBERS
|
|
459
|
+
* @permissionScope Manage Members and Contacts - all permissions
|
|
460
|
+
* @permissionScopeId SCOPE.DC-CONTACTS-MEGA.MANAGE-MEMBERS-CONTACTS
|
|
461
|
+
* @applicableIdentity APP
|
|
462
|
+
* @applicableIdentity VISITOR
|
|
463
|
+
* @fqn com.wixpress.members.api.Members.ListMembers
|
|
464
|
+
*/
|
|
465
|
+
export async function listMembers(options) {
|
|
466
|
+
// @ts-ignore
|
|
467
|
+
const { httpClient, sideEffects } = arguments[1];
|
|
468
|
+
const payload = renameKeysFromSDKRequestToRESTRequest({
|
|
469
|
+
paging: options?.paging,
|
|
470
|
+
fieldsets: options?.fieldsets,
|
|
471
|
+
sorting: options?.sorting,
|
|
472
|
+
});
|
|
473
|
+
const reqOpts = ambassadorWixMembersV1Member.listMembers(payload);
|
|
474
|
+
sideEffects?.onSiteCall?.();
|
|
475
|
+
try {
|
|
476
|
+
const result = await httpClient.request(reqOpts);
|
|
477
|
+
sideEffects?.onSuccess?.(result);
|
|
478
|
+
return renameKeysFromRESTResponseToSDKResponse(result.data);
|
|
479
|
+
}
|
|
480
|
+
catch (err) {
|
|
481
|
+
const transformedError = sdkTransformError(err, {
|
|
482
|
+
spreadPathsToArguments: {},
|
|
483
|
+
explicitPathsToArguments: {
|
|
484
|
+
paging: '$[0].paging',
|
|
485
|
+
fieldsets: '$[0].fieldsets',
|
|
486
|
+
sorting: '$[0].sorting',
|
|
487
|
+
},
|
|
488
|
+
singleArgumentUnchanged: false,
|
|
489
|
+
}, ['options']);
|
|
490
|
+
sideEffects?.onError?.(err);
|
|
491
|
+
throw transformedError;
|
|
492
|
+
}
|
|
493
|
+
}
|
|
494
|
+
/**
|
|
495
|
+
* Retrieves a list of up to 100 members, given the provided filters, fieldsets, sorting and paging, and returns a `MembersQueryBuilder` object.
|
|
496
|
+
*
|
|
497
|
+
* The returned object contains the query definition which is typically used to run the query using the `find()` function.
|
|
498
|
+
*
|
|
499
|
+
* You can refine the query by chaining `MembersQueryBuilder` functions onto the query. `MembersQueryBuilder` functions enable you to sort, filter, and control the results that `queryMembers()` returns. The functions that are chained to `queryMembers()` are applied in the order they are called.
|
|
500
|
+
*
|
|
501
|
+
* `queryMembers()` runs with the following `MembersQueryBuilder` defaults that you can override:
|
|
502
|
+
* - `skip`: `0`
|
|
503
|
+
* - `limit`: `50`
|
|
504
|
+
*
|
|
505
|
+
* Currently supported fields for sorting:
|
|
506
|
+
* - `profile.nickname`
|
|
507
|
+
* - `contact.firstName`
|
|
508
|
+
* - `contact.lastName`
|
|
509
|
+
* - `createdDate`
|
|
510
|
+
* - `lastLoginDate`
|
|
511
|
+
*
|
|
512
|
+
* The following `MembersQueryBuilder` functions are supported for the `queryMembers()` function. For a full description of the Locations object, see the returned for the `items` property in `MembersQueryResult`.
|
|
513
|
+
* @public
|
|
514
|
+
* @param options - Query options.
|
|
515
|
+
* @permissionScope Manage Members
|
|
516
|
+
* @permissionScopeId SCOPE.DC-MEMBERS.MANAGE-MEMBERS
|
|
517
|
+
* @permissionScope Manage Bookings Services and Settings
|
|
518
|
+
* @permissionScopeId SCOPE.BOOKINGS.CONFIGURATION
|
|
519
|
+
* @permissionScope Manage Portfolio
|
|
520
|
+
* @permissionScopeId SCOPE.PORTFOLIO.MANAGE-PORTFOLIO
|
|
521
|
+
* @permissionScope Read Members and Contacts - all read permissions
|
|
522
|
+
* @permissionScopeId SCOPE.DC-CONTACTS-MEGA.READ-MEMBERS-CONTACTS
|
|
523
|
+
* @permissionScope Manage Restaurants - all permissions
|
|
524
|
+
* @permissionScopeId SCOPE.RESTAURANTS.MEGA-SCOPES
|
|
525
|
+
* @permissionScope Read Members
|
|
526
|
+
* @permissionScopeId SCOPE.DC-MEMBERS.READ-MEMBERS
|
|
527
|
+
* @permissionScope Manage Members and Contacts - all permissions
|
|
528
|
+
* @permissionScopeId SCOPE.DC-CONTACTS-MEGA.MANAGE-MEMBERS-CONTACTS
|
|
529
|
+
* @permissionId MEMBERS.MEMBER_READ
|
|
530
|
+
* @applicableIdentity APP
|
|
531
|
+
* @applicableIdentity VISITOR
|
|
532
|
+
* @fqn com.wixpress.members.api.Members.QueryMembers
|
|
533
|
+
*/
|
|
534
|
+
export function queryMembers(options) {
|
|
535
|
+
// @ts-ignore
|
|
536
|
+
const { httpClient, sideEffects } = arguments[1];
|
|
537
|
+
return queryBuilder({
|
|
538
|
+
func: async (payload) => {
|
|
539
|
+
const reqOpts = ambassadorWixMembersV1Member.queryMembers({
|
|
540
|
+
...payload,
|
|
541
|
+
...(options ?? {}),
|
|
542
|
+
});
|
|
543
|
+
sideEffects?.onSiteCall?.();
|
|
544
|
+
try {
|
|
545
|
+
const result = await httpClient.request(reqOpts);
|
|
546
|
+
sideEffects?.onSuccess?.(result);
|
|
547
|
+
return result;
|
|
548
|
+
}
|
|
549
|
+
catch (err) {
|
|
550
|
+
sideEffects?.onError?.(err);
|
|
551
|
+
throw err;
|
|
552
|
+
}
|
|
553
|
+
},
|
|
554
|
+
requestTransformer: (query) => {
|
|
555
|
+
const args = [query, options];
|
|
556
|
+
return renameKeysFromSDKRequestToRESTRequest({
|
|
557
|
+
...args?.[1],
|
|
558
|
+
query: args?.[0],
|
|
559
|
+
});
|
|
560
|
+
},
|
|
561
|
+
responseTransformer: ({ data }) => {
|
|
562
|
+
const transformedData = renameKeysFromRESTResponseToSDKResponse(data);
|
|
563
|
+
return {
|
|
564
|
+
items: transformedData?.members,
|
|
565
|
+
pagingMetadata: transformedData?.metadata,
|
|
566
|
+
};
|
|
567
|
+
},
|
|
568
|
+
errorTransformer: (err) => {
|
|
569
|
+
const transformedError = sdkTransformError(err, {
|
|
570
|
+
spreadPathsToArguments: {},
|
|
571
|
+
explicitPathsToArguments: { query: '$[0]' },
|
|
572
|
+
singleArgumentUnchanged: false,
|
|
573
|
+
});
|
|
574
|
+
throw transformedError;
|
|
575
|
+
},
|
|
576
|
+
pagingMethod: 'OFFSET',
|
|
577
|
+
transformationPaths: {},
|
|
578
|
+
});
|
|
579
|
+
}
|
|
580
|
+
/**
|
|
581
|
+
* Mutes a member.
|
|
582
|
+
*
|
|
583
|
+
* Muted members can't engage with a community. For example, leave comments, like, and share posts or comments.
|
|
584
|
+
*
|
|
585
|
+
* You can mute members in [Wix Blog](https://dev.wix.com/docs/rest/business-solutions/blog/introduction) and [Wix Forum](https://dev.wix.com/docs/rest/business-solutions/forum/introduction).
|
|
586
|
+
* @param _id - ID of the member to mute.
|
|
587
|
+
* @public
|
|
588
|
+
* @requiredField _id
|
|
589
|
+
* @permissionId MEMBERS.MEMBER_MUTE
|
|
590
|
+
* @fqn com.wixpress.members.api.Members.MuteMember
|
|
591
|
+
*/
|
|
592
|
+
export async function muteMember(_id) {
|
|
593
|
+
// @ts-ignore
|
|
594
|
+
const { httpClient, sideEffects } = arguments[1];
|
|
595
|
+
const payload = renameKeysFromSDKRequestToRESTRequest({ id: _id });
|
|
596
|
+
const reqOpts = ambassadorWixMembersV1Member.muteMember(payload);
|
|
597
|
+
sideEffects?.onSiteCall?.();
|
|
598
|
+
try {
|
|
599
|
+
const result = await httpClient.request(reqOpts);
|
|
600
|
+
sideEffects?.onSuccess?.(result);
|
|
601
|
+
return renameKeysFromRESTResponseToSDKResponse(result.data);
|
|
602
|
+
}
|
|
603
|
+
catch (err) {
|
|
604
|
+
const transformedError = sdkTransformError(err, {
|
|
605
|
+
spreadPathsToArguments: {},
|
|
606
|
+
explicitPathsToArguments: { id: '$[0]' },
|
|
607
|
+
singleArgumentUnchanged: false,
|
|
608
|
+
}, ['_id']);
|
|
609
|
+
sideEffects?.onError?.(err);
|
|
610
|
+
throw transformedError;
|
|
611
|
+
}
|
|
612
|
+
}
|
|
613
|
+
/**
|
|
614
|
+
* Unmutes a member.
|
|
615
|
+
*
|
|
616
|
+
* Unmuted members can engage with the comunity. For example, leave comments, like, and share posts.
|
|
617
|
+
*
|
|
618
|
+
* You can unmute members in [Wix Blog](https://dev.wix.com/docs/rest/business-solutions/blog/introduction) and [Wix Forum](https://dev.wix.com/docs/rest/business-solutions/forum/introduction).
|
|
619
|
+
* @param _id - ID of the member to unmute.
|
|
620
|
+
* @public
|
|
621
|
+
* @requiredField _id
|
|
622
|
+
* @permissionId MEMBERS.MEMBER_MUTE
|
|
623
|
+
* @fqn com.wixpress.members.api.Members.UnmuteMember
|
|
624
|
+
*/
|
|
625
|
+
export async function unmuteMember(_id) {
|
|
626
|
+
// @ts-ignore
|
|
627
|
+
const { httpClient, sideEffects } = arguments[1];
|
|
628
|
+
const payload = renameKeysFromSDKRequestToRESTRequest({ id: _id });
|
|
629
|
+
const reqOpts = ambassadorWixMembersV1Member.unmuteMember(payload);
|
|
630
|
+
sideEffects?.onSiteCall?.();
|
|
631
|
+
try {
|
|
632
|
+
const result = await httpClient.request(reqOpts);
|
|
633
|
+
sideEffects?.onSuccess?.(result);
|
|
634
|
+
return renameKeysFromRESTResponseToSDKResponse(result.data);
|
|
635
|
+
}
|
|
636
|
+
catch (err) {
|
|
637
|
+
const transformedError = sdkTransformError(err, {
|
|
638
|
+
spreadPathsToArguments: {},
|
|
639
|
+
explicitPathsToArguments: { id: '$[0]' },
|
|
640
|
+
singleArgumentUnchanged: false,
|
|
641
|
+
}, ['_id']);
|
|
642
|
+
sideEffects?.onError?.(err);
|
|
643
|
+
throw transformedError;
|
|
644
|
+
}
|
|
645
|
+
}
|
|
646
|
+
/**
|
|
647
|
+
* Changes member status to `APPROVED` and gives access to members-only pages.
|
|
648
|
+
*
|
|
649
|
+
* Call this API to:
|
|
650
|
+
* - Approve a pending member.
|
|
651
|
+
* - Unblock a blocked member.
|
|
652
|
+
* @param _id - ID of the member to approve.
|
|
653
|
+
* @public
|
|
654
|
+
* @requiredField _id
|
|
655
|
+
* @permissionId MEMBERS.MEMBER_APPROVE
|
|
656
|
+
* @permissionScope Manage Members
|
|
657
|
+
* @permissionScopeId SCOPE.DC-MEMBERS.MANAGE-MEMBERS
|
|
658
|
+
* @applicableIdentity APP
|
|
659
|
+
* @fqn com.wixpress.members.api.Members.ApproveMember
|
|
660
|
+
*/
|
|
661
|
+
export async function approveMember(_id) {
|
|
662
|
+
// @ts-ignore
|
|
663
|
+
const { httpClient, sideEffects } = arguments[1];
|
|
664
|
+
const payload = renameKeysFromSDKRequestToRESTRequest({ id: _id });
|
|
665
|
+
const reqOpts = ambassadorWixMembersV1Member.approveMember(payload);
|
|
666
|
+
sideEffects?.onSiteCall?.();
|
|
667
|
+
try {
|
|
668
|
+
const result = await httpClient.request(reqOpts);
|
|
669
|
+
sideEffects?.onSuccess?.(result);
|
|
670
|
+
return renameKeysFromRESTResponseToSDKResponse(result.data);
|
|
671
|
+
}
|
|
672
|
+
catch (err) {
|
|
673
|
+
const transformedError = sdkTransformError(err, {
|
|
674
|
+
spreadPathsToArguments: {},
|
|
675
|
+
explicitPathsToArguments: { id: '$[0]' },
|
|
676
|
+
singleArgumentUnchanged: false,
|
|
677
|
+
}, ['_id']);
|
|
678
|
+
sideEffects?.onError?.(err);
|
|
679
|
+
throw transformedError;
|
|
680
|
+
}
|
|
681
|
+
}
|
|
682
|
+
/**
|
|
683
|
+
* Blocks a member.
|
|
684
|
+
*
|
|
685
|
+
* A blocked member can't log in to members-only pages.
|
|
686
|
+
*
|
|
687
|
+
* To unblock a member, call Approve Member.
|
|
688
|
+
* @param _id - ID of a member to block.
|
|
689
|
+
* @public
|
|
690
|
+
* @requiredField _id
|
|
691
|
+
* @permissionId MEMBERS.MEMBER_BLOCK
|
|
692
|
+
* @permissionScope Manage Members
|
|
693
|
+
* @permissionScopeId SCOPE.DC-MEMBERS.MANAGE-MEMBERS
|
|
694
|
+
* @applicableIdentity APP
|
|
695
|
+
* @fqn com.wixpress.members.api.Members.BlockMember
|
|
696
|
+
*/
|
|
697
|
+
export async function blockMember(_id) {
|
|
698
|
+
// @ts-ignore
|
|
699
|
+
const { httpClient, sideEffects } = arguments[1];
|
|
700
|
+
const payload = renameKeysFromSDKRequestToRESTRequest({ id: _id });
|
|
701
|
+
const reqOpts = ambassadorWixMembersV1Member.blockMember(payload);
|
|
702
|
+
sideEffects?.onSiteCall?.();
|
|
703
|
+
try {
|
|
704
|
+
const result = await httpClient.request(reqOpts);
|
|
705
|
+
sideEffects?.onSuccess?.(result);
|
|
706
|
+
return renameKeysFromRESTResponseToSDKResponse(result.data);
|
|
707
|
+
}
|
|
708
|
+
catch (err) {
|
|
709
|
+
const transformedError = sdkTransformError(err, {
|
|
710
|
+
spreadPathsToArguments: {},
|
|
711
|
+
explicitPathsToArguments: { id: '$[0]' },
|
|
712
|
+
singleArgumentUnchanged: false,
|
|
713
|
+
}, ['_id']);
|
|
714
|
+
sideEffects?.onError?.(err);
|
|
715
|
+
throw transformedError;
|
|
716
|
+
}
|
|
717
|
+
}
|
|
718
|
+
/**
|
|
719
|
+
* Disconnects a member.
|
|
720
|
+
*
|
|
721
|
+
* A disconnected member can't log in to members-only pages, and the member isn't visible in the dashboard.
|
|
722
|
+
*
|
|
723
|
+
* >**Note:** This action is irreversible. To connect the same member again, you have to create a member with a new slug.
|
|
724
|
+
* @param _id - ID of a member to disconnect.
|
|
725
|
+
* @public
|
|
726
|
+
* @requiredField _id
|
|
727
|
+
* @permissionId MEMBERS.MEMBER_DISCONNECT
|
|
728
|
+
* @permissionScope Manage Members
|
|
729
|
+
* @permissionScopeId SCOPE.DC-MEMBERS.MANAGE-MEMBERS
|
|
730
|
+
* @applicableIdentity APP
|
|
731
|
+
* @fqn com.wixpress.members.api.Members.DisconnectMember
|
|
732
|
+
*/
|
|
733
|
+
export async function disconnectMember(_id) {
|
|
734
|
+
// @ts-ignore
|
|
735
|
+
const { httpClient, sideEffects } = arguments[1];
|
|
736
|
+
const payload = renameKeysFromSDKRequestToRESTRequest({ id: _id });
|
|
737
|
+
const reqOpts = ambassadorWixMembersV1Member.disconnectMember(payload);
|
|
738
|
+
sideEffects?.onSiteCall?.();
|
|
739
|
+
try {
|
|
740
|
+
const result = await httpClient.request(reqOpts);
|
|
741
|
+
sideEffects?.onSuccess?.(result);
|
|
742
|
+
return renameKeysFromRESTResponseToSDKResponse(result.data);
|
|
743
|
+
}
|
|
744
|
+
catch (err) {
|
|
745
|
+
const transformedError = sdkTransformError(err, {
|
|
746
|
+
spreadPathsToArguments: {},
|
|
747
|
+
explicitPathsToArguments: { id: '$[0]' },
|
|
748
|
+
singleArgumentUnchanged: false,
|
|
749
|
+
}, ['_id']);
|
|
750
|
+
sideEffects?.onError?.(err);
|
|
751
|
+
throw transformedError;
|
|
752
|
+
}
|
|
753
|
+
}
|
|
754
|
+
/**
|
|
755
|
+
* Deletes a member.
|
|
756
|
+
*
|
|
757
|
+
* The `deleteMember()` function returns a Promise that resolves to a member object when the specified member is deleted.
|
|
758
|
+
*
|
|
759
|
+
* >**Note:** This function permanently deletes a member. Once deleted, a member cannot be restored.
|
|
760
|
+
* @param _id - ID of the member to delete.
|
|
761
|
+
* @public
|
|
762
|
+
* @requiredField _id
|
|
763
|
+
* @permissionId MEMBERS.MEMBER_DELETE
|
|
764
|
+
* @permissionScope Manage Members
|
|
765
|
+
* @permissionScopeId SCOPE.DC-MEMBERS.MANAGE-MEMBERS
|
|
766
|
+
* @applicableIdentity APP
|
|
767
|
+
* @fqn com.wixpress.members.api.Members.DeleteMember
|
|
768
|
+
*/
|
|
769
|
+
export async function deleteMember(_id) {
|
|
770
|
+
// @ts-ignore
|
|
771
|
+
const { httpClient, sideEffects } = arguments[1];
|
|
772
|
+
const payload = renameKeysFromSDKRequestToRESTRequest({ id: _id });
|
|
773
|
+
const reqOpts = ambassadorWixMembersV1Member.deleteMember(payload);
|
|
774
|
+
sideEffects?.onSiteCall?.();
|
|
775
|
+
try {
|
|
776
|
+
const result = await httpClient.request(reqOpts);
|
|
777
|
+
sideEffects?.onSuccess?.(result);
|
|
778
|
+
}
|
|
779
|
+
catch (err) {
|
|
780
|
+
const transformedError = sdkTransformError(err, {
|
|
781
|
+
spreadPathsToArguments: {},
|
|
782
|
+
explicitPathsToArguments: { id: '$[0]' },
|
|
783
|
+
singleArgumentUnchanged: false,
|
|
784
|
+
}, ['_id']);
|
|
785
|
+
sideEffects?.onError?.(err);
|
|
786
|
+
throw transformedError;
|
|
787
|
+
}
|
|
788
|
+
}
|
|
789
|
+
/**
|
|
790
|
+
* Deletes the currently logged in member.
|
|
791
|
+
*
|
|
792
|
+
* After calling this method, the member is logged out of the site.
|
|
793
|
+
*
|
|
794
|
+
* All content created by this member is transferred to another account. For example, if a Wix user had blog posts, those posts are transferred to the specified account, which then becomes the owner of those posts.
|
|
795
|
+
*
|
|
796
|
+
* >**Note:**
|
|
797
|
+
* >This method requires [visitor or member authentication](https://dev.wix.com/docs/build-apps/develop-your-app/access/about-identities).
|
|
798
|
+
* @public
|
|
799
|
+
* @permissionId MEMBERS.MEMBER_DELETE
|
|
800
|
+
* @permissionScope Manage Members
|
|
801
|
+
* @permissionScopeId SCOPE.DC-MEMBERS.MANAGE-MEMBERS
|
|
802
|
+
* @applicableIdentity APP
|
|
803
|
+
* @fqn com.wixpress.members.api.Members.DeleteMyMember
|
|
804
|
+
*/
|
|
805
|
+
export async function deleteMyMember(options) {
|
|
806
|
+
// @ts-ignore
|
|
807
|
+
const { httpClient, sideEffects } = arguments[1];
|
|
808
|
+
const payload = renameKeysFromSDKRequestToRESTRequest({
|
|
809
|
+
contentAssigneeId: options?.contentAssigneeId,
|
|
810
|
+
});
|
|
811
|
+
const reqOpts = ambassadorWixMembersV1Member.deleteMyMember(payload);
|
|
812
|
+
sideEffects?.onSiteCall?.();
|
|
813
|
+
try {
|
|
814
|
+
const result = await httpClient.request(reqOpts);
|
|
815
|
+
sideEffects?.onSuccess?.(result);
|
|
816
|
+
}
|
|
817
|
+
catch (err) {
|
|
818
|
+
const transformedError = sdkTransformError(err, {
|
|
819
|
+
spreadPathsToArguments: {},
|
|
820
|
+
explicitPathsToArguments: {
|
|
821
|
+
contentAssigneeId: '$[0].contentAssigneeId',
|
|
822
|
+
},
|
|
823
|
+
singleArgumentUnchanged: false,
|
|
824
|
+
}, ['options']);
|
|
825
|
+
sideEffects?.onError?.(err);
|
|
826
|
+
throw transformedError;
|
|
827
|
+
}
|
|
828
|
+
}
|
|
829
|
+
/**
|
|
830
|
+
* Deletes multiple members by `memberId`.
|
|
831
|
+
*
|
|
832
|
+
* All content created by these members is transferred to a site owner's account. For example, if Wix users had blog posts, those posts are transferred to the site owner's account, which then becomes the owner of those posts.
|
|
833
|
+
* @param memberIds - IDs of members to be deleted.
|
|
834
|
+
* @public
|
|
835
|
+
* @requiredField memberIds
|
|
836
|
+
* @permissionId MEMBERS.MEMBER_DELETE
|
|
837
|
+
* @permissionScope Manage Members
|
|
838
|
+
* @permissionScopeId SCOPE.DC-MEMBERS.MANAGE-MEMBERS
|
|
839
|
+
* @applicableIdentity APP
|
|
840
|
+
* @fqn com.wixpress.members.api.Members.BulkDeleteMembers
|
|
841
|
+
*/
|
|
842
|
+
export async function bulkDeleteMembers(memberIds) {
|
|
843
|
+
// @ts-ignore
|
|
844
|
+
const { httpClient, sideEffects } = arguments[1];
|
|
845
|
+
const payload = renameKeysFromSDKRequestToRESTRequest({
|
|
846
|
+
memberIds: memberIds,
|
|
847
|
+
});
|
|
848
|
+
const reqOpts = ambassadorWixMembersV1Member.bulkDeleteMembers(payload);
|
|
849
|
+
sideEffects?.onSiteCall?.();
|
|
850
|
+
try {
|
|
851
|
+
const result = await httpClient.request(reqOpts);
|
|
852
|
+
sideEffects?.onSuccess?.(result);
|
|
853
|
+
return renameKeysFromRESTResponseToSDKResponse(result.data);
|
|
854
|
+
}
|
|
855
|
+
catch (err) {
|
|
856
|
+
const transformedError = sdkTransformError(err, {
|
|
857
|
+
spreadPathsToArguments: {},
|
|
858
|
+
explicitPathsToArguments: { memberIds: '$[0]' },
|
|
859
|
+
singleArgumentUnchanged: false,
|
|
860
|
+
}, ['memberIds']);
|
|
861
|
+
sideEffects?.onError?.(err);
|
|
862
|
+
throw transformedError;
|
|
863
|
+
}
|
|
864
|
+
}
|
|
865
|
+
/**
|
|
866
|
+
* Deletes multiple members by the specified filter.
|
|
867
|
+
*
|
|
868
|
+
* All content created by these members is transferred to a site owner's account. For example, if Wix users had blog posts, those posts are transferred to the site owner's account, which then becomes the owner of those posts.
|
|
869
|
+
* @param filter - Query options. See [API Query Language](https://dev.wix.com/docs/rest/articles/getting-started/api-query-language) for more details.
|
|
870
|
+
* @public
|
|
871
|
+
* @requiredField filter
|
|
872
|
+
* @permissionId MEMBERS.MEMBER_DELETE
|
|
873
|
+
* @permissionScope Manage Members
|
|
874
|
+
* @permissionScopeId SCOPE.DC-MEMBERS.MANAGE-MEMBERS
|
|
875
|
+
* @applicableIdentity APP
|
|
876
|
+
* @fqn com.wixpress.members.api.Members.BulkDeleteMembersByFilter
|
|
877
|
+
*/
|
|
878
|
+
export async function bulkDeleteMembersByFilter(filter, options) {
|
|
879
|
+
// @ts-ignore
|
|
880
|
+
const { httpClient, sideEffects } = arguments[2];
|
|
881
|
+
const payload = renameKeysFromSDKRequestToRESTRequest({
|
|
882
|
+
filter: filter,
|
|
883
|
+
contentAssigneeId: options?.contentAssigneeId,
|
|
884
|
+
search: options?.search,
|
|
885
|
+
});
|
|
886
|
+
const reqOpts = ambassadorWixMembersV1Member.bulkDeleteMembersByFilter(payload);
|
|
887
|
+
sideEffects?.onSiteCall?.();
|
|
888
|
+
try {
|
|
889
|
+
const result = await httpClient.request(reqOpts);
|
|
890
|
+
sideEffects?.onSuccess?.(result);
|
|
891
|
+
return renameKeysFromRESTResponseToSDKResponse(result.data);
|
|
892
|
+
}
|
|
893
|
+
catch (err) {
|
|
894
|
+
const transformedError = sdkTransformError(err, {
|
|
895
|
+
spreadPathsToArguments: {},
|
|
896
|
+
explicitPathsToArguments: {
|
|
897
|
+
filter: '$[0]',
|
|
898
|
+
contentAssigneeId: '$[1].contentAssigneeId',
|
|
899
|
+
search: '$[1].search',
|
|
900
|
+
},
|
|
901
|
+
singleArgumentUnchanged: false,
|
|
902
|
+
}, ['filter', 'options']);
|
|
903
|
+
sideEffects?.onError?.(err);
|
|
904
|
+
throw transformedError;
|
|
905
|
+
}
|
|
906
|
+
}
|
|
907
|
+
/**
|
|
908
|
+
* Changes status of multiple members to `APPROVED`, and gives access to members-only pages.
|
|
909
|
+
*
|
|
910
|
+
* Call this API to:
|
|
911
|
+
* - Approve pending members.
|
|
912
|
+
* - Unblock blocked members.
|
|
913
|
+
* @param filter - Query options. See [API Query Language](https://dev.wix.com/docs/rest/articles/getting-started/api-query-language) for more details.
|
|
914
|
+
* @public
|
|
915
|
+
* @requiredField filter
|
|
916
|
+
* @permissionId MEMBERS.MEMBER_APPROVE
|
|
917
|
+
* @permissionScope Manage Members
|
|
918
|
+
* @permissionScopeId SCOPE.DC-MEMBERS.MANAGE-MEMBERS
|
|
919
|
+
* @applicableIdentity APP
|
|
920
|
+
* @fqn com.wixpress.members.api.Members.BulkApproveMembers
|
|
921
|
+
*/
|
|
922
|
+
export async function bulkApproveMembers(filter) {
|
|
923
|
+
// @ts-ignore
|
|
924
|
+
const { httpClient, sideEffects } = arguments[1];
|
|
925
|
+
const payload = renameKeysFromSDKRequestToRESTRequest({ filter: filter });
|
|
926
|
+
const reqOpts = ambassadorWixMembersV1Member.bulkApproveMembers(payload);
|
|
927
|
+
sideEffects?.onSiteCall?.();
|
|
928
|
+
try {
|
|
929
|
+
const result = await httpClient.request(reqOpts);
|
|
930
|
+
sideEffects?.onSuccess?.(result);
|
|
931
|
+
return renameKeysFromRESTResponseToSDKResponse(result.data);
|
|
932
|
+
}
|
|
933
|
+
catch (err) {
|
|
934
|
+
const transformedError = sdkTransformError(err, {
|
|
935
|
+
spreadPathsToArguments: {},
|
|
936
|
+
explicitPathsToArguments: { filter: '$[0]' },
|
|
937
|
+
singleArgumentUnchanged: false,
|
|
938
|
+
}, ['filter']);
|
|
939
|
+
sideEffects?.onError?.(err);
|
|
940
|
+
throw transformedError;
|
|
941
|
+
}
|
|
942
|
+
}
|
|
943
|
+
/**
|
|
944
|
+
* Blocks multiple members by a specified filter.
|
|
945
|
+
*
|
|
946
|
+
* Blocked members can't log in to members-only pages.
|
|
947
|
+
*
|
|
948
|
+
* To unblock multiple members, call Bulk Approve Members.
|
|
949
|
+
* @param filter - Query options. See [API Query Language](https://dev.wix.com/docs/rest/articles/getting-started/api-query-language) for more details.
|
|
950
|
+
* @public
|
|
951
|
+
* @requiredField filter
|
|
952
|
+
* @permissionId MEMBERS.MEMBER_BLOCK
|
|
953
|
+
* @permissionScope Manage Members
|
|
954
|
+
* @permissionScopeId SCOPE.DC-MEMBERS.MANAGE-MEMBERS
|
|
955
|
+
* @applicableIdentity APP
|
|
956
|
+
* @fqn com.wixpress.members.api.Members.BulkBlockMembers
|
|
957
|
+
*/
|
|
958
|
+
export async function bulkBlockMembers(filter) {
|
|
959
|
+
// @ts-ignore
|
|
960
|
+
const { httpClient, sideEffects } = arguments[1];
|
|
961
|
+
const payload = renameKeysFromSDKRequestToRESTRequest({ filter: filter });
|
|
962
|
+
const reqOpts = ambassadorWixMembersV1Member.bulkBlockMembers(payload);
|
|
963
|
+
sideEffects?.onSiteCall?.();
|
|
964
|
+
try {
|
|
965
|
+
const result = await httpClient.request(reqOpts);
|
|
966
|
+
sideEffects?.onSuccess?.(result);
|
|
967
|
+
return renameKeysFromRESTResponseToSDKResponse(result.data);
|
|
968
|
+
}
|
|
969
|
+
catch (err) {
|
|
970
|
+
const transformedError = sdkTransformError(err, {
|
|
971
|
+
spreadPathsToArguments: {},
|
|
972
|
+
explicitPathsToArguments: { filter: '$[0]' },
|
|
973
|
+
singleArgumentUnchanged: false,
|
|
974
|
+
}, ['filter']);
|
|
975
|
+
sideEffects?.onError?.(err);
|
|
976
|
+
throw transformedError;
|
|
977
|
+
}
|
|
978
|
+
}
|
|
979
|
+
/**
|
|
980
|
+
* Creates a site member.
|
|
981
|
+
*
|
|
982
|
+
* After creation, you can use the `sendSetPasswordEmail()` function in the Members Authentication API to email the member with a link to set their password.
|
|
983
|
+
* The member can log in to the site once they set their password for the first time.
|
|
984
|
+
*
|
|
985
|
+
* > **Note:**
|
|
986
|
+
* > When creating multiple members, set your requests at least 1 second apart to keep below rate limits.
|
|
987
|
+
* @public
|
|
988
|
+
* @permissionId MEMBERS.MEMBER_CREATE
|
|
989
|
+
* @permissionScope Manage Members
|
|
990
|
+
* @permissionScopeId SCOPE.DC-MEMBERS.MANAGE-MEMBERS
|
|
991
|
+
* @applicableIdentity APP
|
|
992
|
+
* @returns New member.
|
|
993
|
+
* @fqn com.wixpress.members.api.Members.CreateMember
|
|
994
|
+
*/
|
|
995
|
+
export async function createMember(options) {
|
|
996
|
+
// @ts-ignore
|
|
997
|
+
const { httpClient, sideEffects } = arguments[1];
|
|
998
|
+
const payload = renameKeysFromSDKRequestToRESTRequest({
|
|
999
|
+
member: options?.member,
|
|
1000
|
+
});
|
|
1001
|
+
const reqOpts = ambassadorWixMembersV1Member.createMember(payload);
|
|
1002
|
+
sideEffects?.onSiteCall?.();
|
|
1003
|
+
try {
|
|
1004
|
+
const result = await httpClient.request(reqOpts);
|
|
1005
|
+
sideEffects?.onSuccess?.(result);
|
|
1006
|
+
return renameKeysFromRESTResponseToSDKResponse(result.data)?.member;
|
|
1007
|
+
}
|
|
1008
|
+
catch (err) {
|
|
1009
|
+
const transformedError = sdkTransformError(err, {
|
|
1010
|
+
spreadPathsToArguments: {},
|
|
1011
|
+
explicitPathsToArguments: { member: '$[0].member' },
|
|
1012
|
+
singleArgumentUnchanged: false,
|
|
1013
|
+
}, ['options']);
|
|
1014
|
+
sideEffects?.onError?.(err);
|
|
1015
|
+
throw transformedError;
|
|
1016
|
+
}
|
|
1017
|
+
}
|
|
1018
|
+
/**
|
|
1019
|
+
* Updates a member's properties.
|
|
1020
|
+
*
|
|
1021
|
+
* Only the requested fields are updated.
|
|
1022
|
+
* To clear a field's value, set an empty value with an empty string `""`.
|
|
1023
|
+
*
|
|
1024
|
+
* > **Note:**
|
|
1025
|
+
* > Updating the `contact.addresses`, `contact.emails`, or `contact.phones` array overwrites the entire array, so any existing values you want to retain must be passed in the `updateMember()` call along with the new values to add.
|
|
1026
|
+
* > However, passing an empty array will have no effect, and these functions must be used to clear all data from the respective array:
|
|
1027
|
+
* >- To clear `contact.addresses`, use `deleteMemberAddresses()`.
|
|
1028
|
+
* >- To clear `contact.emails`, use `deleteMemberEmails()`.
|
|
1029
|
+
* >- To clear `contact.phones`, use `deleteMemberPhones()`.
|
|
1030
|
+
*
|
|
1031
|
+
* > **Note:**
|
|
1032
|
+
* > Only logged-in members can call this function without elevated permissions.
|
|
1033
|
+
* > To call this function as a different identity, [elevated permissions](https://www.wix.com/velo/reference/wix-auth/elevate) are required.
|
|
1034
|
+
* @param _id - Member ID.
|
|
1035
|
+
* @public
|
|
1036
|
+
* @requiredField _id
|
|
1037
|
+
* @requiredField member
|
|
1038
|
+
* @param options - Member to update.
|
|
1039
|
+
* @permissionId MEMBERS.MEMBER_UPDATE
|
|
1040
|
+
* @permissionScope Manage Members
|
|
1041
|
+
* @permissionScopeId SCOPE.DC-MEMBERS.MANAGE-MEMBERS
|
|
1042
|
+
* @permissionScope Manage Bookings Services and Settings
|
|
1043
|
+
* @permissionScopeId SCOPE.BOOKINGS.CONFIGURATION
|
|
1044
|
+
* @permissionScope Manage Portfolio
|
|
1045
|
+
* @permissionScopeId SCOPE.PORTFOLIO.MANAGE-PORTFOLIO
|
|
1046
|
+
* @permissionScope Manage Restaurants - all permissions
|
|
1047
|
+
* @permissionScopeId SCOPE.RESTAURANTS.MEGA-SCOPES
|
|
1048
|
+
* @applicableIdentity APP
|
|
1049
|
+
* @applicableIdentity MEMBER
|
|
1050
|
+
* @returns Updated member.
|
|
1051
|
+
* @fqn com.wixpress.members.api.Members.UpdateMember
|
|
1052
|
+
*/
|
|
1053
|
+
export async function updateMember(_id, member) {
|
|
1054
|
+
// @ts-ignore
|
|
1055
|
+
const { httpClient, sideEffects } = arguments[2];
|
|
1056
|
+
const payload = renameKeysFromSDKRequestToRESTRequest({
|
|
1057
|
+
member: { ...member, id: _id },
|
|
1058
|
+
});
|
|
1059
|
+
const reqOpts = ambassadorWixMembersV1Member.updateMember(payload);
|
|
1060
|
+
sideEffects?.onSiteCall?.();
|
|
1061
|
+
try {
|
|
1062
|
+
const result = await httpClient.request(reqOpts);
|
|
1063
|
+
sideEffects?.onSuccess?.(result);
|
|
1064
|
+
return renameKeysFromRESTResponseToSDKResponse(result.data)?.member;
|
|
1065
|
+
}
|
|
1066
|
+
catch (err) {
|
|
1067
|
+
const transformedError = sdkTransformError(err, {
|
|
1068
|
+
spreadPathsToArguments: { member: '$[1]' },
|
|
1069
|
+
explicitPathsToArguments: { 'member.id': '$[0]' },
|
|
1070
|
+
singleArgumentUnchanged: false,
|
|
1071
|
+
}, ['_id', 'member']);
|
|
1072
|
+
sideEffects?.onError?.(err);
|
|
1073
|
+
throw transformedError;
|
|
1074
|
+
}
|
|
1075
|
+
}
|
|
1076
|
+
/**
|
|
1077
|
+
* Clears a member's phone numbers.
|
|
1078
|
+
*
|
|
1079
|
+
* The `deleteMemberPhones()` function clears the `phones` array under the `contact` property.
|
|
1080
|
+
*
|
|
1081
|
+
* > **Note:**
|
|
1082
|
+
* > Only logged-in members can call this function without elevated permissions.
|
|
1083
|
+
* > To call this function as a different identity, [elevated permissions](https://www.wix.com/velo/reference/wix-auth/elevate) are required.
|
|
1084
|
+
* @param _id - ID of the member whose phone numbers will be deleted.
|
|
1085
|
+
* @public
|
|
1086
|
+
* @requiredField _id
|
|
1087
|
+
* @permissionId MEMBERS.MEMBER_UPDATE
|
|
1088
|
+
* @permissionScope Manage Members
|
|
1089
|
+
* @permissionScopeId SCOPE.DC-MEMBERS.MANAGE-MEMBERS
|
|
1090
|
+
* @permissionScope Manage Bookings Services and Settings
|
|
1091
|
+
* @permissionScopeId SCOPE.BOOKINGS.CONFIGURATION
|
|
1092
|
+
* @permissionScope Manage Portfolio
|
|
1093
|
+
* @permissionScopeId SCOPE.PORTFOLIO.MANAGE-PORTFOLIO
|
|
1094
|
+
* @permissionScope Manage Restaurants - all permissions
|
|
1095
|
+
* @permissionScopeId SCOPE.RESTAURANTS.MEGA-SCOPES
|
|
1096
|
+
* @applicableIdentity APP
|
|
1097
|
+
* @applicableIdentity MEMBER
|
|
1098
|
+
* @fqn com.wixpress.members.api.Members.DeleteMemberPhones
|
|
1099
|
+
*/
|
|
1100
|
+
export async function deleteMemberPhones(_id) {
|
|
1101
|
+
// @ts-ignore
|
|
1102
|
+
const { httpClient, sideEffects } = arguments[1];
|
|
1103
|
+
const payload = renameKeysFromSDKRequestToRESTRequest({ id: _id });
|
|
1104
|
+
const reqOpts = ambassadorWixMembersV1Member.deleteMemberPhones(payload);
|
|
1105
|
+
sideEffects?.onSiteCall?.();
|
|
1106
|
+
try {
|
|
1107
|
+
const result = await httpClient.request(reqOpts);
|
|
1108
|
+
sideEffects?.onSuccess?.(result);
|
|
1109
|
+
return renameKeysFromRESTResponseToSDKResponse(result.data);
|
|
1110
|
+
}
|
|
1111
|
+
catch (err) {
|
|
1112
|
+
const transformedError = sdkTransformError(err, {
|
|
1113
|
+
spreadPathsToArguments: {},
|
|
1114
|
+
explicitPathsToArguments: { id: '$[0]' },
|
|
1115
|
+
singleArgumentUnchanged: false,
|
|
1116
|
+
}, ['_id']);
|
|
1117
|
+
sideEffects?.onError?.(err);
|
|
1118
|
+
throw transformedError;
|
|
1119
|
+
}
|
|
1120
|
+
}
|
|
1121
|
+
/**
|
|
1122
|
+
* Clears a member's email addresses.
|
|
1123
|
+
*
|
|
1124
|
+
* The `deleteMemberEmails()` function clears the `emails` array under the `contact` property.
|
|
1125
|
+
*
|
|
1126
|
+
* > **Notes:**
|
|
1127
|
+
* > A member can still log in with their `loginEmail`,
|
|
1128
|
+
* > which is not cleared when this function is called.
|
|
1129
|
+
*
|
|
1130
|
+
* > Only logged-in members can call this function without elevated permissions.
|
|
1131
|
+
* > To call this function as a different identity, [elevated permissions](https://www.wix.com/velo/reference/wix-auth/elevate) are required.
|
|
1132
|
+
* @param _id - ID of the member whose email addresses will be deleted.
|
|
1133
|
+
* @public
|
|
1134
|
+
* @requiredField _id
|
|
1135
|
+
* @permissionId MEMBERS.MEMBER_UPDATE
|
|
1136
|
+
* @permissionScope Manage Members
|
|
1137
|
+
* @permissionScopeId SCOPE.DC-MEMBERS.MANAGE-MEMBERS
|
|
1138
|
+
* @permissionScope Manage Bookings Services and Settings
|
|
1139
|
+
* @permissionScopeId SCOPE.BOOKINGS.CONFIGURATION
|
|
1140
|
+
* @permissionScope Manage Portfolio
|
|
1141
|
+
* @permissionScopeId SCOPE.PORTFOLIO.MANAGE-PORTFOLIO
|
|
1142
|
+
* @permissionScope Manage Restaurants - all permissions
|
|
1143
|
+
* @permissionScopeId SCOPE.RESTAURANTS.MEGA-SCOPES
|
|
1144
|
+
* @applicableIdentity APP
|
|
1145
|
+
* @applicableIdentity MEMBER
|
|
1146
|
+
* @fqn com.wixpress.members.api.Members.DeleteMemberEmails
|
|
1147
|
+
*/
|
|
1148
|
+
export async function deleteMemberEmails(_id) {
|
|
1149
|
+
// @ts-ignore
|
|
1150
|
+
const { httpClient, sideEffects } = arguments[1];
|
|
1151
|
+
const payload = renameKeysFromSDKRequestToRESTRequest({ id: _id });
|
|
1152
|
+
const reqOpts = ambassadorWixMembersV1Member.deleteMemberEmails(payload);
|
|
1153
|
+
sideEffects?.onSiteCall?.();
|
|
1154
|
+
try {
|
|
1155
|
+
const result = await httpClient.request(reqOpts);
|
|
1156
|
+
sideEffects?.onSuccess?.(result);
|
|
1157
|
+
return renameKeysFromRESTResponseToSDKResponse(result.data);
|
|
1158
|
+
}
|
|
1159
|
+
catch (err) {
|
|
1160
|
+
const transformedError = sdkTransformError(err, {
|
|
1161
|
+
spreadPathsToArguments: {},
|
|
1162
|
+
explicitPathsToArguments: { id: '$[0]' },
|
|
1163
|
+
singleArgumentUnchanged: false,
|
|
1164
|
+
}, ['_id']);
|
|
1165
|
+
sideEffects?.onError?.(err);
|
|
1166
|
+
throw transformedError;
|
|
1167
|
+
}
|
|
1168
|
+
}
|
|
1169
|
+
/**
|
|
1170
|
+
* Deletes a member's street addresses.
|
|
1171
|
+
*
|
|
1172
|
+
* The `deleteMemberAddresses()` function clears the `addresses` array under the `contact` property.
|
|
1173
|
+
*
|
|
1174
|
+
* > **Note:**
|
|
1175
|
+
* > Only logged-in members can call this function without elevated permissions.
|
|
1176
|
+
* > To call this function as a different identity, [elevated permissions](https://www.wix.com/velo/reference/wix-auth/elevate) are required.
|
|
1177
|
+
* @param _id - ID of the member whose street addresses will be deleted.
|
|
1178
|
+
* @public
|
|
1179
|
+
* @requiredField _id
|
|
1180
|
+
* @permissionId MEMBERS.MEMBER_UPDATE
|
|
1181
|
+
* @permissionScope Manage Members
|
|
1182
|
+
* @permissionScopeId SCOPE.DC-MEMBERS.MANAGE-MEMBERS
|
|
1183
|
+
* @permissionScope Manage Bookings Services and Settings
|
|
1184
|
+
* @permissionScopeId SCOPE.BOOKINGS.CONFIGURATION
|
|
1185
|
+
* @permissionScope Manage Portfolio
|
|
1186
|
+
* @permissionScopeId SCOPE.PORTFOLIO.MANAGE-PORTFOLIO
|
|
1187
|
+
* @permissionScope Manage Restaurants - all permissions
|
|
1188
|
+
* @permissionScopeId SCOPE.RESTAURANTS.MEGA-SCOPES
|
|
1189
|
+
* @applicableIdentity APP
|
|
1190
|
+
* @applicableIdentity MEMBER
|
|
1191
|
+
* @fqn com.wixpress.members.api.Members.DeleteMemberAddresses
|
|
1192
|
+
*/
|
|
1193
|
+
export async function deleteMemberAddresses(_id) {
|
|
1194
|
+
// @ts-ignore
|
|
1195
|
+
const { httpClient, sideEffects } = arguments[1];
|
|
1196
|
+
const payload = renameKeysFromSDKRequestToRESTRequest({ id: _id });
|
|
1197
|
+
const reqOpts = ambassadorWixMembersV1Member.deleteMemberAddresses(payload);
|
|
1198
|
+
sideEffects?.onSiteCall?.();
|
|
1199
|
+
try {
|
|
1200
|
+
const result = await httpClient.request(reqOpts);
|
|
1201
|
+
sideEffects?.onSuccess?.(result);
|
|
1202
|
+
return renameKeysFromRESTResponseToSDKResponse(result.data);
|
|
1203
|
+
}
|
|
1204
|
+
catch (err) {
|
|
1205
|
+
const transformedError = sdkTransformError(err, {
|
|
1206
|
+
spreadPathsToArguments: {},
|
|
1207
|
+
explicitPathsToArguments: { id: '$[0]' },
|
|
1208
|
+
singleArgumentUnchanged: false,
|
|
1209
|
+
}, ['_id']);
|
|
1210
|
+
sideEffects?.onError?.(err);
|
|
1211
|
+
throw transformedError;
|
|
1212
|
+
}
|
|
1213
|
+
}
|
|
1214
|
+
//# sourceMappingURL=members-v1-member-members.universal.js.map
|