central-auth-js-sdk 1.2.1 → 1.2.3

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/login.js CHANGED
@@ -353,7 +353,7 @@ export function mountLogin(container, options = {}) {
353
353
  }
354
354
 
355
355
  return {
356
- unmount() { cleanupTheme(); layout.root.remove(); },
356
+ unmount() { cleanupTheme(); layout.cleanup(); layout.root.remove(); },
357
357
  getState() { return state.getAll(); },
358
358
  getFlow() { return flow; },
359
359
  getCurrentStep() { return flow.getCurrentStep(); },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "central-auth-js-sdk",
3
- "version": "1.2.1",
3
+ "version": "1.2.3",
4
4
  "description": "Vanilla JS sign-up and login flow SDK — embeddable auth UI with configurable methods",
5
5
  "type": "module",
6
6
  "main": "index.js",
package/signup.js CHANGED
@@ -301,6 +301,7 @@ export function mount(container, options = {}) {
301
301
  return {
302
302
  unmount() {
303
303
  cleanupTheme();
304
+ layout.cleanup();
304
305
  layout.root.remove();
305
306
  },
306
307
  getState() {
package/styles.css CHANGED
@@ -917,7 +917,7 @@
917
917
  .wf-camera-icon svg { width: 1.25rem; height: 1.25rem; color: var(--wf-primary); }
918
918
  .wf-camera-placeholder p { font-size: 0.8125rem; color: var(--wf-muted); margin-bottom: 0.75rem; }
919
919
 
920
- .wf-video, .wf-captured { width: 100%; height: 100%; object-fit: cover; }
920
+ .wf-video, .wf-captured { width: 100%; height: 100%; object-fit: cover; transform: scaleX(-1); }
921
921
 
922
922
  .wf-face-overlay {
923
923
  position: absolute;
package/ui/layout.js CHANGED
@@ -67,6 +67,14 @@ export function createLayout(container) {
67
67
  const loadingStatus = root.querySelector('#wf-loading-status');
68
68
 
69
69
  function setContent(el) {
70
+ const oldEl = formInner.firstElementChild;
71
+ if (oldEl && typeof oldEl.cleanup === 'function') {
72
+ try {
73
+ oldEl.cleanup();
74
+ } catch (e) {
75
+ console.error('[Central Auth SDK] Error during screen cleanup:', e);
76
+ }
77
+ }
70
78
  formInner.innerHTML = '';
71
79
  if (el) formInner.appendChild(el);
72
80
  }
@@ -116,12 +124,24 @@ export function createLayout(container) {
116
124
  }
117
125
  }
118
126
 
127
+ function cleanup() {
128
+ const oldEl = formInner.firstElementChild;
129
+ if (oldEl && typeof oldEl.cleanup === 'function') {
130
+ try {
131
+ oldEl.cleanup();
132
+ } catch (e) {
133
+ console.error('[Central Auth SDK] Error during screen cleanup:', e);
134
+ }
135
+ }
136
+ }
137
+
119
138
  return {
120
139
  root,
121
140
  setContent,
122
141
  updateProgress,
123
142
  showError,
124
143
  setLoading,
144
+ cleanup,
125
145
  renderContent: setContent,
126
146
  };
127
147
  }
@@ -174,5 +174,13 @@ export function createFaceRegistrationScreen(onNext, onBack, api) {
174
174
  const usePhoneBtn = wrap.querySelector('[data-action="use-phone"]');
175
175
  if (usePhoneBtn) usePhoneBtn.addEventListener('click', () => showPhoneCapture(true));
176
176
 
177
+ wrap.cleanup = () => {
178
+ stopStream();
179
+ if (phoneCaptureRef) {
180
+ phoneCaptureRef.destroy();
181
+ phoneCaptureRef = null;
182
+ }
183
+ };
184
+
177
185
  return wrap;
178
186
  }
@@ -183,5 +183,13 @@ export function createLoginFrsScreen(onNext, onBack, opts = {}) {
183
183
  const usePhoneBtn = wrap.querySelector('[data-action="use-phone"]');
184
184
  if (usePhoneBtn) usePhoneBtn.addEventListener('click', () => showPhoneCapture(true));
185
185
 
186
+ wrap.cleanup = () => {
187
+ stopStream();
188
+ if (phoneCaptureRef) {
189
+ phoneCaptureRef.destroy();
190
+ phoneCaptureRef = null;
191
+ }
192
+ };
193
+
186
194
  return wrap;
187
195
  }