@wireai/activation 0.14.0 → 0.14.2

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.
@@ -1384,12 +1384,20 @@ var readStr = (storage, key) => {
1384
1384
  var PROCESS_OPEN_ID_SLOT = /* @__PURE__ */ Symbol.for("@wireai/activation:processOpenId");
1385
1385
  var openIdGlobal = globalThis;
1386
1386
  var currentOpenId = () => {
1387
- var _a;
1388
- const existing = openIdGlobal[PROCESS_OPEN_ID_SLOT];
1389
- if (existing) return existing;
1390
- const resolved = (_a = getCurrentSessionId()) != null ? _a : makeSessionId();
1391
- openIdGlobal[PROCESS_OPEN_ID_SLOT] = resolved;
1392
- return resolved;
1387
+ const live = getCurrentSessionId();
1388
+ const pin = openIdGlobal[PROCESS_OPEN_ID_SLOT];
1389
+ if (!pin) {
1390
+ const openId = live != null ? live : makeSessionId();
1391
+ openIdGlobal[PROCESS_OPEN_ID_SLOT] = { openId, observed: live };
1392
+ return openId;
1393
+ }
1394
+ if (!live || live === pin.observed) return pin.openId;
1395
+ if (pin.observed === void 0) {
1396
+ openIdGlobal[PROCESS_OPEN_ID_SLOT] = { openId: pin.openId, observed: live };
1397
+ return pin.openId;
1398
+ }
1399
+ openIdGlobal[PROCESS_OPEN_ID_SLOT] = { openId: live, observed: live };
1400
+ return live;
1393
1401
  };
1394
1402
  var bumpSessionCount = (storage, sessionsKey, openKey, openId = currentOpenId()) => {
1395
1403
  const lastOpen = readStr(storage, openKey);