central-auth-js-sdk 1.2.5 → 1.2.6
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/core/api.js +8 -4
- package/package.json +1 -1
- package/signup.js +14 -1
- package/ui/screens/email-verify.js +28 -1
- package/ui/screens/index.js +7 -1
package/core/api.js
CHANGED
|
@@ -53,14 +53,18 @@ export function createApi(baseUrl = DEFAULT_BASE, options = {}) {
|
|
|
53
53
|
return request('POST', '/signup/start', { email });
|
|
54
54
|
},
|
|
55
55
|
|
|
56
|
-
/** POST /signup/email/verify — Email verify: OTP + names (entity auto-detected from email in backend) */
|
|
57
|
-
async signupEmailVerify({ email, otp, first_name, last_name }) {
|
|
58
|
-
|
|
56
|
+
/** POST /signup/email/verify — Email verify: OTP + names + org details (entity auto-detected from email in backend) */
|
|
57
|
+
async signupEmailVerify({ email, otp, first_name, last_name, team, sub_team, designation }) {
|
|
58
|
+
const payload = {
|
|
59
59
|
email,
|
|
60
60
|
otp,
|
|
61
61
|
first_name,
|
|
62
62
|
last_name,
|
|
63
|
-
}
|
|
63
|
+
};
|
|
64
|
+
if (team) payload.team = team;
|
|
65
|
+
if (sub_team) payload.sub_team = sub_team;
|
|
66
|
+
if (designation) payload.designation = designation;
|
|
67
|
+
return request('POST', '/signup/email/verify', payload);
|
|
64
68
|
},
|
|
65
69
|
|
|
66
70
|
/** POST /signup/mobile/send_otp — Mobile entry: send mobile OTP */
|
package/package.json
CHANGED
package/signup.js
CHANGED
|
@@ -103,6 +103,9 @@ export function mount(container, options = {}) {
|
|
|
103
103
|
email: all.email,
|
|
104
104
|
mobile: all.mobile,
|
|
105
105
|
userId: all.userId,
|
|
106
|
+
team: all.team,
|
|
107
|
+
subTeam: all.subTeam,
|
|
108
|
+
designation: all.designation,
|
|
106
109
|
};
|
|
107
110
|
if (apiResult && typeof apiResult === 'object' && apiResult !== null) {
|
|
108
111
|
Object.assign(payload, apiResult);
|
|
@@ -141,13 +144,23 @@ export function mount(container, options = {}) {
|
|
|
141
144
|
|
|
142
145
|
async function handleEmailVerify(data) {
|
|
143
146
|
state.clearError();
|
|
144
|
-
state.setMultiple({
|
|
147
|
+
state.setMultiple({
|
|
148
|
+
emailOtp: data.otp,
|
|
149
|
+
firstName: data.firstName,
|
|
150
|
+
lastName: data.lastName,
|
|
151
|
+
team: data.team,
|
|
152
|
+
subTeam: data.subTeam,
|
|
153
|
+
designation: data.designation,
|
|
154
|
+
});
|
|
145
155
|
try {
|
|
146
156
|
const res = await api.signupEmailVerify({
|
|
147
157
|
email: state.get('email'),
|
|
148
158
|
otp: data.otp,
|
|
149
159
|
first_name: data.firstName,
|
|
150
160
|
last_name: data.lastName,
|
|
161
|
+
team: data.team,
|
|
162
|
+
sub_team: data.subTeam,
|
|
163
|
+
designation: data.designation,
|
|
151
164
|
});
|
|
152
165
|
const userId = res?.user_id ?? res?.data?.user_id;
|
|
153
166
|
if (userId) state.set('userId', userId);
|
|
@@ -38,6 +38,20 @@ export function createEmailVerifyScreen(email, onNext, onBack, prefill = {}) {
|
|
|
38
38
|
<input type="text" id="wf-last-name" placeholder="Doe" class="wf-input" required autocomplete="family-name" />
|
|
39
39
|
</div>
|
|
40
40
|
</div>
|
|
41
|
+
<div class="wf-row-2">
|
|
42
|
+
<div class="wf-field">
|
|
43
|
+
<label class="wf-label" for="wf-team">Team</label>
|
|
44
|
+
<input type="text" id="wf-team" placeholder="Engineering" class="wf-input" autocomplete="organization" />
|
|
45
|
+
</div>
|
|
46
|
+
<div class="wf-field">
|
|
47
|
+
<label class="wf-label" for="wf-sub-team">Sub-team</label>
|
|
48
|
+
<input type="text" id="wf-sub-team" placeholder="Backend" class="wf-input" />
|
|
49
|
+
</div>
|
|
50
|
+
</div>
|
|
51
|
+
<div class="wf-field">
|
|
52
|
+
<label class="wf-label" for="wf-designation">Designation</label>
|
|
53
|
+
<input type="text" id="wf-designation" placeholder="Software Engineer" class="wf-input" autocomplete="organization-title" />
|
|
54
|
+
</div>
|
|
41
55
|
<div class="wf-btn-row">
|
|
42
56
|
<button type="button" class="wf-btn wf-btn-outline wf-btn-lg" data-action="back" aria-label="Go back">
|
|
43
57
|
<svg class="wf-icon-sm" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="${ARROW_LEFT}"/></svg>
|
|
@@ -57,9 +71,15 @@ export function createEmailVerifyScreen(email, onNext, onBack, prefill = {}) {
|
|
|
57
71
|
const otpEls = wrap.querySelectorAll('.wf-otp-input');
|
|
58
72
|
const firstName = wrap.querySelector('#wf-first-name');
|
|
59
73
|
const lastName = wrap.querySelector('#wf-last-name');
|
|
74
|
+
const team = wrap.querySelector('#wf-team');
|
|
75
|
+
const subTeam = wrap.querySelector('#wf-sub-team');
|
|
76
|
+
const designation = wrap.querySelector('#wf-designation');
|
|
60
77
|
|
|
61
78
|
if (prefill.firstName) firstName.value = prefill.firstName;
|
|
62
79
|
if (prefill.lastName) lastName.value = prefill.lastName;
|
|
80
|
+
if (prefill.team && team) team.value = prefill.team;
|
|
81
|
+
if (prefill.subTeam && subTeam) subTeam.value = prefill.subTeam;
|
|
82
|
+
if (prefill.designation && designation) designation.value = prefill.designation;
|
|
63
83
|
|
|
64
84
|
function handleOtpPaste(e) {
|
|
65
85
|
e.preventDefault();
|
|
@@ -86,7 +106,14 @@ export function createEmailVerifyScreen(email, onNext, onBack, prefill = {}) {
|
|
|
86
106
|
e.preventDefault();
|
|
87
107
|
const code = [...otpEls].map((o) => o.value).join('');
|
|
88
108
|
if (code.length === 6 && firstName.value.trim() && lastName.value.trim()) {
|
|
89
|
-
onNext({
|
|
109
|
+
onNext({
|
|
110
|
+
otp: code,
|
|
111
|
+
firstName: firstName.value.trim(),
|
|
112
|
+
lastName: lastName.value.trim(),
|
|
113
|
+
team: team ? team.value.trim() : '',
|
|
114
|
+
subTeam: subTeam ? subTeam.value.trim() : '',
|
|
115
|
+
designation: designation ? designation.value.trim() : '',
|
|
116
|
+
});
|
|
90
117
|
}
|
|
91
118
|
});
|
|
92
119
|
|
package/ui/screens/index.js
CHANGED
|
@@ -38,7 +38,13 @@ export function createScreen(step, state, flow, callbacks) {
|
|
|
38
38
|
state.get('email'),
|
|
39
39
|
(data) => onEmailVerify(data),
|
|
40
40
|
onBack,
|
|
41
|
-
{
|
|
41
|
+
{
|
|
42
|
+
firstName: state.get('firstName') || '',
|
|
43
|
+
lastName: state.get('lastName') || '',
|
|
44
|
+
team: state.get('team') || '',
|
|
45
|
+
subTeam: state.get('subTeam') || '',
|
|
46
|
+
designation: state.get('designation') || '',
|
|
47
|
+
}
|
|
42
48
|
);
|
|
43
49
|
|
|
44
50
|
case STEPS.MOBILE:
|