@xuda.io/account_module 1.2.2252 → 1.2.2253
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/index.mjs +41 -9
- package/package.json +1 -1
package/index.mjs
CHANGED
|
@@ -29,6 +29,11 @@ const account_info_properties = [
|
|
|
29
29
|
'active_account_profile_id',
|
|
30
30
|
'profile_avatar',
|
|
31
31
|
'profile_avatar_obj',
|
|
32
|
+
'is_xuda_network_ambassador',
|
|
33
|
+
'network_profile_url',
|
|
34
|
+
'network_lang',
|
|
35
|
+
'network_country_code',
|
|
36
|
+
'network_city_slug',
|
|
32
37
|
];
|
|
33
38
|
|
|
34
39
|
global._conf = (
|
|
@@ -162,6 +167,29 @@ export const update_account_info = async function (req, job_id, headers) {
|
|
|
162
167
|
if (key === 'country' && !validate_input(val, 55, false, false)) {
|
|
163
168
|
error[key] = 'Invalid country';
|
|
164
169
|
}
|
|
170
|
+
if (key === 'is_xuda_network_ambassador' && typeof val !== 'boolean') {
|
|
171
|
+
error[key] = 'Invalid ambassador flag';
|
|
172
|
+
}
|
|
173
|
+
if (key === 'network_profile_url') {
|
|
174
|
+
let url_ok = false;
|
|
175
|
+
try {
|
|
176
|
+
url_ok = new URL(val).protocol === 'https:';
|
|
177
|
+
} catch (_) {
|
|
178
|
+
/* invalid */
|
|
179
|
+
}
|
|
180
|
+
if (!url_ok) {
|
|
181
|
+
error[key] = 'Invalid network profile url';
|
|
182
|
+
}
|
|
183
|
+
}
|
|
184
|
+
if (key === 'network_lang' && !/^[a-z]{2}$/.test(val)) {
|
|
185
|
+
error[key] = 'Invalid network lang';
|
|
186
|
+
}
|
|
187
|
+
if (key === 'network_country_code' && !/^[a-z]{2}$/.test(val)) {
|
|
188
|
+
error[key] = 'Invalid network country code';
|
|
189
|
+
}
|
|
190
|
+
if (key === 'network_city_slug' && !/^[a-z0-9-]{2,64}$/.test(val)) {
|
|
191
|
+
error[key] = 'Invalid network city slug';
|
|
192
|
+
}
|
|
165
193
|
}
|
|
166
194
|
}
|
|
167
195
|
|
|
@@ -1935,15 +1963,19 @@ export const onboarding_completed = async function (req, job_id, headers) {
|
|
|
1935
1963
|
account_doc.isBoarded = true;
|
|
1936
1964
|
const save_ret = await db_module.save_couch_doc('xuda_accounts', account_doc);
|
|
1937
1965
|
|
|
1938
|
-
|
|
1939
|
-
|
|
1940
|
-
|
|
1941
|
-
|
|
1942
|
-
|
|
1943
|
-
|
|
1944
|
-
|
|
1945
|
-
|
|
1946
|
-
|
|
1966
|
+
if (account_doc.account_info?.is_xuda_network_ambassador === true) {
|
|
1967
|
+
console.log('[onboarding_completed] suppressing welcome_aboard for xuda.network ambassador', uid, account_doc.account_info.email);
|
|
1968
|
+
} else {
|
|
1969
|
+
notification_msa.submit_notification({
|
|
1970
|
+
type: 'account',
|
|
1971
|
+
app_id: null,
|
|
1972
|
+
uid_arr: [uid],
|
|
1973
|
+
topic: 'welcome_aboard',
|
|
1974
|
+
params: { name: account_doc.account_info.first_name, email: account_doc.account_info.email, dashboard_url: 'https://xuda.ai/dashboard' },
|
|
1975
|
+
ref: null,
|
|
1976
|
+
email: null,
|
|
1977
|
+
});
|
|
1978
|
+
}
|
|
1947
1979
|
|
|
1948
1980
|
return save_ret;
|
|
1949
1981
|
} catch (err) {
|