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