@swan-admin/swan-ai-measurements 1.1.85 → 1.1.86

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.
@@ -10,6 +10,7 @@ interface Callbacks {
10
10
  onSuccess?: (data: any) => void;
11
11
  onClose?: () => void;
12
12
  onOpen?: () => void;
13
+ onPreopen?: () => void;
13
14
  }
14
15
  interface MeasurementSocketOptions extends Callbacks {
15
16
  scanId: string;
@@ -117,10 +117,11 @@ _Measurement_socketRefs = new WeakMap(), _Measurement_waitingTimers = new WeakMa
117
117
  onError === null || onError === void 0 ? void 0 : onError(e);
118
118
  }
119
119
  });
120
- }, _Measurement_handleSocket = function _Measurement_handleSocket({ onOpen, isFallback, scanId, onSuccess, onError, onClose, paramsKey, faceScanId, delay }) {
120
+ }, _Measurement_handleSocket = function _Measurement_handleSocket({ onOpen, isFallback, scanId, onSuccess, onError, onClose, paramsKey, faceScanId, delay, onPreopen }) {
121
121
  const key = isFallback ? `measurement-${scanId}` : `faceScan-${faceScanId}`;
122
122
  setTimeout(() => {
123
123
  __classPrivateFieldGet(this, _Measurement_instances, "m", _Measurement_disconnectSocket).call(this, key);
124
+ onPreopen === null || onPreopen === void 0 ? void 0 : onPreopen();
124
125
  const url = `${getUrl({ urlName: APP_BASE_WEBSOCKET_URL, urlType: __classPrivateFieldGet(this, _Measurement_urlType, "f") })}${API_ENDPOINTS.SCANNING}?${paramsKey}=${scanId || faceScanId}`;
125
126
  const socket = new WebSocket(url);
126
127
  __classPrivateFieldGet(this, _Measurement_socketRefs, "f")[key] = socket;
@@ -10,6 +10,7 @@ interface Callbacks {
10
10
  onSuccess?: (data: any) => void;
11
11
  onClose?: () => void;
12
12
  onOpen?: () => void;
13
+ onPreopen?: () => void;
13
14
  }
14
15
  interface MeasurementSocketOptions extends Callbacks {
15
16
  scanId: string;
@@ -99,10 +99,11 @@ class Measurement {
99
99
  }
100
100
  this.#handleSocket({ onOpen, faceScanId, onSuccess, onError, onClose, paramsKey: "faceScanId", isFallback: false, delay: 1000 });
101
101
  }
102
- #handleSocket({ onOpen, isFallback, scanId, onSuccess, onError, onClose, paramsKey, faceScanId, delay }) {
102
+ #handleSocket({ onOpen, isFallback, scanId, onSuccess, onError, onClose, paramsKey, faceScanId, delay, onPreopen }) {
103
103
  const key = isFallback ? `measurement-${scanId}` : `faceScan-${faceScanId}`;
104
104
  setTimeout(() => {
105
105
  this.#disconnectSocket(key);
106
+ onPreopen?.();
106
107
  const url = `${(0, utils_js_1.getUrl)({ urlName: constants_js_1.APP_BASE_WEBSOCKET_URL, urlType: this.#urlType })}${constants_js_1.API_ENDPOINTS.SCANNING}?${paramsKey}=${scanId || faceScanId}`;
107
108
  const socket = new WebSocket(url);
108
109
  this.#socketRefs[key] = socket;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@swan-admin/swan-ai-measurements",
3
- "version": "1.1.85",
3
+ "version": "1.1.86",
4
4
  "description": "provides ai measurement suggestion",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/esm/index.js",
@@ -13,6 +13,7 @@ interface Callbacks {
13
13
  onSuccess?: (data: any) => void;
14
14
  onClose?: () => void;
15
15
  onOpen?: () => void;
16
+ onPreopen?: () => void;
16
17
  }
17
18
  interface MeasurementSocketOptions extends Callbacks {
18
19
  scanId: string;
@@ -144,10 +145,11 @@ class Measurement {
144
145
  this.#handleSocket({ onOpen, faceScanId, onSuccess, onError, onClose, paramsKey: "faceScanId", isFallback: false, delay: 1000 });
145
146
  }
146
147
 
147
- #handleSocket({ onOpen, isFallback, scanId, onSuccess, onError, onClose, paramsKey, faceScanId, delay }: HandleSocket) {
148
+ #handleSocket({ onOpen, isFallback, scanId, onSuccess, onError, onClose, paramsKey, faceScanId, delay, onPreopen }: HandleSocket) {
148
149
  const key = isFallback ? `measurement-${scanId}` : `faceScan-${faceScanId}`;
149
150
  setTimeout(() => {
150
151
  this.#disconnectSocket(key);
152
+ onPreopen?.()
151
153
  const url = `${getUrl({ urlName: APP_BASE_WEBSOCKET_URL, urlType: this.#urlType })}${API_ENDPOINTS.SCANNING}?${paramsKey}=${scanId || faceScanId}`;
152
154
  const socket = new WebSocket(url);
153
155
  this.#socketRefs[key] = socket;