woodsportal-client-sdk 4.0.4-dev.8 → 4.0.7-dev.0

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.
Files changed (65) hide show
  1. package/dist/adapters/angular/index.d.ts +1 -0
  2. package/dist/adapters/angular/index.js +6 -4
  3. package/dist/adapters/angular/index.js.map +1 -1
  4. package/dist/adapters/react/index.d.ts +1 -0
  5. package/dist/adapters/react/index.js +6 -4
  6. package/dist/adapters/react/index.js.map +1 -1
  7. package/dist/adapters/vue/index.d.ts +1 -0
  8. package/dist/adapters/vue/index.js +6 -4
  9. package/dist/adapters/vue/index.js.map +1 -1
  10. package/dist/auth-error-codes-D7CXVBEN.js +3 -0
  11. package/dist/auth-error-codes-D7CXVBEN.js.map +1 -0
  12. package/dist/auth-interceptor-policy-BSY5KIIA.js +5 -0
  13. package/dist/auth-interceptor-policy-BSY5KIIA.js.map +1 -0
  14. package/dist/auth-utils-XIHNYE63.js +5 -0
  15. package/dist/{auth-utils-MNMC2QGX.js.map → auth-utils-XIHNYE63.js.map} +1 -1
  16. package/dist/{chunk-6IRXCBBP.js → chunk-4IKGBHFJ.js} +454 -258
  17. package/dist/chunk-4IKGBHFJ.js.map +1 -0
  18. package/dist/chunk-55MIERLJ.js +3 -0
  19. package/dist/chunk-55MIERLJ.js.map +1 -0
  20. package/dist/chunk-6ROV3EE2.js +160 -0
  21. package/dist/chunk-6ROV3EE2.js.map +1 -0
  22. package/dist/{chunk-IBKBTIT6.js → chunk-7OGXVANB.js} +6 -6
  23. package/dist/{chunk-IBKBTIT6.js.map → chunk-7OGXVANB.js.map} +1 -1
  24. package/dist/chunk-ADOV2R3A.js +571 -0
  25. package/dist/chunk-ADOV2R3A.js.map +1 -0
  26. package/dist/chunk-COHBSTHF.js +82 -0
  27. package/dist/chunk-COHBSTHF.js.map +1 -0
  28. package/dist/chunk-DZC3DJUO.js +156 -0
  29. package/dist/chunk-DZC3DJUO.js.map +1 -0
  30. package/dist/{chunk-LCHJO5TU.js → chunk-GVXA7OKY.js} +14 -13
  31. package/dist/chunk-GVXA7OKY.js.map +1 -0
  32. package/dist/chunk-J33YFZCS.js +162 -0
  33. package/dist/chunk-J33YFZCS.js.map +1 -0
  34. package/dist/{chunk-7Q6HRCUA.js → chunk-OF5OLEE5.js} +3 -3
  35. package/dist/{chunk-7Q6HRCUA.js.map → chunk-OF5OLEE5.js.map} +1 -1
  36. package/dist/{chunk-ZEJGWZK3.js → chunk-U66LWTVC.js} +1242 -1269
  37. package/dist/chunk-U66LWTVC.js.map +1 -0
  38. package/dist/{chunk-EVRUWZUS.js → chunk-WNBF6FKG.js} +165 -13
  39. package/dist/chunk-WNBF6FKG.js.map +1 -0
  40. package/dist/chunk-YOT5RW3R.js +306 -0
  41. package/dist/chunk-YOT5RW3R.js.map +1 -0
  42. package/dist/cross-tab-session-OJKWJSNT.js +9 -0
  43. package/dist/cross-tab-session-OJKWJSNT.js.map +1 -0
  44. package/dist/entries/auth.d.ts +15 -3
  45. package/dist/entries/auth.js +9 -4
  46. package/dist/entries/auth.js.map +1 -1
  47. package/dist/entries/crm.d.ts +1 -0
  48. package/dist/entries/crm.js +10 -6
  49. package/dist/entries/crm.js.map +1 -1
  50. package/dist/{http-errors-DqdtoJ1y.d.ts → http-errors-_XPPqJ_a.d.ts} +190 -9
  51. package/dist/index.d.ts +138 -3
  52. package/dist/index.js +16 -9
  53. package/dist/index.js.map +1 -1
  54. package/dist/refresh-lock-UW5RRRTD.js +72 -0
  55. package/dist/refresh-lock-UW5RRRTD.js.map +1 -0
  56. package/dist/storage-migration-OCOML7VA.js +4 -0
  57. package/dist/storage-migration-OCOML7VA.js.map +1 -0
  58. package/package.json +11 -9
  59. package/dist/auth-utils-MNMC2QGX.js +0 -3
  60. package/dist/chunk-6IRXCBBP.js.map +0 -1
  61. package/dist/chunk-EVRUWZUS.js.map +0 -1
  62. package/dist/chunk-LCHJO5TU.js.map +0 -1
  63. package/dist/chunk-QPSCMK4W.js +0 -237
  64. package/dist/chunk-QPSCMK4W.js.map +0 -1
  65. package/dist/chunk-ZEJGWZK3.js.map +0 -1
@@ -0,0 +1,72 @@
1
+ import { WP_STORAGE_KEYS } from './chunk-6ROV3EE2.js';
2
+
3
+ // src/main/core/http/refresh-lock.ts
4
+ var LOCK_NAME = "wp.client.auth.refresh";
5
+ var STORAGE_LOCK_KEY = WP_STORAGE_KEYS.c.auth.refreshLock;
6
+ var LOCK_TTL_MS = 3e4;
7
+ async function withNavigatorLock(fn) {
8
+ if (typeof navigator !== "undefined" && navigator.locks?.request) {
9
+ return navigator.locks.request(LOCK_NAME, fn);
10
+ }
11
+ return fn();
12
+ }
13
+ function tryAcquireStorageLock() {
14
+ if (typeof window === "undefined" || !window.localStorage) {
15
+ return true;
16
+ }
17
+ try {
18
+ const raw = window.localStorage.getItem(STORAGE_LOCK_KEY);
19
+ const now = Date.now();
20
+ if (raw) {
21
+ const ts = Number(raw);
22
+ if (Number.isFinite(ts) && now - ts < LOCK_TTL_MS) {
23
+ return false;
24
+ }
25
+ }
26
+ window.localStorage.setItem(STORAGE_LOCK_KEY, String(now));
27
+ return true;
28
+ } catch {
29
+ return true;
30
+ }
31
+ }
32
+ function releaseStorageLock() {
33
+ if (typeof window === "undefined" || !window.localStorage) {
34
+ return;
35
+ }
36
+ try {
37
+ window.localStorage.removeItem(STORAGE_LOCK_KEY);
38
+ } catch {
39
+ }
40
+ }
41
+ async function waitForStorageLock(maxWaitMs = LOCK_TTL_MS) {
42
+ const start = Date.now();
43
+ while (Date.now() - start < maxWaitMs) {
44
+ if (tryAcquireStorageLock()) {
45
+ return;
46
+ }
47
+ await new Promise((r) => setTimeout(r, 200));
48
+ }
49
+ }
50
+ async function withRefreshLock(fn) {
51
+ return withNavigatorLock(async () => {
52
+ await waitForStorageLock();
53
+ try {
54
+ return await fn();
55
+ } finally {
56
+ releaseStorageLock();
57
+ }
58
+ });
59
+ }
60
+ function clearRefreshLockForTests() {
61
+ try {
62
+ if (typeof window === "undefined" || !window.localStorage) {
63
+ return;
64
+ }
65
+ window.localStorage.removeItem(STORAGE_LOCK_KEY);
66
+ } catch {
67
+ }
68
+ }
69
+
70
+ export { clearRefreshLockForTests, withRefreshLock };
71
+ //# sourceMappingURL=refresh-lock-UW5RRRTD.js.map
72
+ //# sourceMappingURL=refresh-lock-UW5RRRTD.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/main/core/http/refresh-lock.ts"],"names":[],"mappings":";;;AAEA,IAAM,SAAA,GAAY,wBAAA;AAClB,IAAM,gBAAA,GAAmB,eAAA,CAAgB,CAAA,CAAE,IAAA,CAAK,WAAA;AAChD,IAAM,WAAA,GAAc,GAAA;AAEpB,eAAe,kBAAqB,EAAA,EAAkC;AAClE,EAAA,IAAI,OAAO,SAAA,KAAc,WAAA,IAAe,SAAA,CAAU,OAAO,OAAA,EAAS;AAC9D,IAAA,OAAO,SAAA,CAAU,KAAA,CAAM,OAAA,CAAQ,SAAA,EAAW,EAAE,CAAA;AAAA,EAChD;AACA,EAAA,OAAO,EAAA,EAAG;AACd;AAEA,SAAS,qBAAA,GAAiC;AACtC,EAAA,IAAI,OAAO,MAAA,KAAW,WAAA,IAAe,CAAC,OAAO,YAAA,EAAc;AACvD,IAAA,OAAO,IAAA;AAAA,EACX;AACA,EAAA,IAAI;AACA,IAAA,MAAM,GAAA,GAAM,MAAA,CAAO,YAAA,CAAa,OAAA,CAAQ,gBAAgB,CAAA;AACxD,IAAA,MAAM,GAAA,GAAM,KAAK,GAAA,EAAI;AACrB,IAAA,IAAI,GAAA,EAAK;AACL,MAAA,MAAM,EAAA,GAAK,OAAO,GAAG,CAAA;AACrB,MAAA,IAAI,OAAO,QAAA,CAAS,EAAE,CAAA,IAAK,GAAA,GAAM,KAAK,WAAA,EAAa;AAC/C,QAAA,OAAO,KAAA;AAAA,MACX;AAAA,IACJ;AACA,IAAA,MAAA,CAAO,YAAA,CAAa,OAAA,CAAQ,gBAAA,EAAkB,MAAA,CAAO,GAAG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ils/wp-storage-keys'\n\nconst LOCK_NAME = 'wp.client.auth.refresh'\nconst STORAGE_LOCK_KEY = WP_STORAGE_KEYS.c.auth.refreshLock\nconst LOCK_TTL_MS = 30_000\n\nasync function withNavigatorLock<T>(fn: () => Promise<T>): Promise<T> {\n if (typeof navigator !== 'undefined' && navigator.locks?.request) {\n return navigator.locks.request(LOCK_NAME, fn)\n }\n return fn()\n}\n\nfunction tryAcquireStorageLock(): boolean {\n if (typeof window === 'undefined' || !window.localStorage) {\n return true\n }\n try {\n const raw = window.localStorage.getItem(STORAGE_LOCK_KEY)\n const now = Date.now()\n if (raw) {\n const ts = Number(raw)\n if (Number.isFinite(ts) && now - ts < LOCK_TTL_MS) {\n return false\n }\n }\n window.localStorage.setItem(STORAGE_LOCK_KEY, String(now))\n return true\n } catch {\n return true\n }\n}\n\nfunction releaseStorageLock(): void {\n if (typeof window === 'undefined' || !window.localStorage) {\n return\n }\n try {\n window.localStorage.removeItem(STORAGE_LOCK_KEY)\n } catch {\n // ignore\n }\n}\n\nasync function waitForStorageLock(maxWaitMs = LOCK_TTL_MS): Promise<void> {\n const start = Date.now()\n while (Date.now() - start < maxWaitMs) {\n if (tryAcquireStorageLock()) {\n return\n }\n await new Promise((r) => setTimeout(r, 200))\n }\n}\n\n/**\n * Cross-tab singleflight around refresh token rotation.\n */\nexport async function withRefreshLock<T>(fn: () => Promise<T>): Promise<T> {\n return withNavigatorLock(async () => {\n await waitForStorageLock()\n try {\n return await fn()\n } finally {\n releaseStorageLock()\n }\n })\n}\n\n/** Test-only: drop stale cross-tab refresh lock from localStorage. */\nexport function clearRefreshLockForTests(): void {\n try {\n if (typeof window === 'undefined' || !window.localStorage) {\n return\n }\n window.localStorage.removeItem(STORAGE_LOCK_KEY)\n } catch {\n // ignore — jsdom may be torn down between files\n }\n}\n"]}
@@ -0,0 +1,4 @@
1
+ export { clearClientIframeRefreshLocalKeys, clearClientSessionStorageKeys, clearStaleIframeRefreshForOtherHubs, getClientAuthCookieNamesToClear, migrateLegacyStorageKeys } from './chunk-YOT5RW3R.js';
2
+ import './chunk-6ROV3EE2.js';
3
+ //# sourceMappingURL=storage-migration-OCOML7VA.js.map
4
+ //# sourceMappingURL=storage-migration-OCOML7VA.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"names":[],"mappings":"","file":"storage-migration-OCOML7VA.js"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "woodsportal-client-sdk",
3
- "version": "4.0.4-dev.8",
3
+ "version": "4.0.7-dev.0",
4
4
  "description": "Official TypeScript/JavaScript SDK for WoodsPortal API - Authentication, user management, pipelines, and more",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -56,17 +56,18 @@
56
56
  "lint": "eslint .",
57
57
  "format:check": "prettier --check \"src/**/*.ts\" \"examples/smoke-consumer/*.{ts,mjs}\" \"docs/**/*.md\"",
58
58
  "audit:prod": "npm audit --omit=dev --audit-level=high",
59
- "test": "node --import tsx --test 'src/test/**/*.test.ts'",
60
- "test:watch": "node --import tsx --watch --test 'src/test/**/*.test.ts'",
59
+ "test": "node --import tsx --import ./src/test/register-test-hooks.ts --test 'src/test/**/*.test.ts'",
60
+ "test:watch": "node --import tsx --import ./src/test/register-test-hooks.ts --watch --test 'src/test/**/*.test.ts'",
61
61
  "test:coverage": "c8 node --import tsx --test 'src/test/**/*.test.ts'",
62
- "test:consumer": "npm run build && cd examples/smoke-consumer && npm install && npm run smoke",
63
- "test:consumer:live": "npm run build && cd examples/smoke-consumer && npm install && npm run smoke:live",
62
+ "test:consumer": "cd examples/smoke-consumer && (npm ci || npm install) && npm run smoke",
63
+ "test:consumer:live": "npm run build && cd examples/smoke-consumer && npm ci && npm run smoke:live",
64
64
  "check:publint": "publint run --pack npm",
65
65
  "check:types-pack": "node scripts/check-types-pack.mjs",
66
66
  "check:exports": "publint run --pack npm && npm run check:types-pack",
67
67
  "check:deps": "depcruise src/main --config .dependency-cruiser.cjs",
68
68
  "check:knip": "knip",
69
- "verify": "npm run type-check && npm run lint && npm run format:check && npm test && npm run build && npm run size:check && npm run check:exports && npm run check:deps && npm run test:consumer",
69
+ "verify": "npm run type-check && npm run lint && npm run format:check && npm test && npm run build && npm run size:check && npm run check:exports && npm run check:deps",
70
+ "verify:full": "npm run verify && npm run test:consumer",
70
71
  "prepare": "husky",
71
72
  "prepublishOnly": "npm run build && npm run type-check && npm run test:consumer"
72
73
  },
@@ -122,11 +123,11 @@
122
123
  "@types/node": "^25.0.6",
123
124
  "@types/pako": "^2.0.4",
124
125
  "@types/react": "^19.2.15",
125
- "eslint": "^9.18.0",
126
- "eslint-config-prettier": "^10.0.1",
127
126
  "@types/react-dom": "^19.2.3",
128
127
  "c8": "^10.1.3",
129
128
  "dependency-cruiser": "^16.10.0",
129
+ "eslint": "^9.18.0",
130
+ "eslint-config-prettier": "^10.0.1",
130
131
  "husky": "^9.1.7",
131
132
  "jsdom": "^26.0.0",
132
133
  "knip": "^5.46.0",
@@ -143,7 +144,8 @@
143
144
  "tsx": "^4.21.0",
144
145
  "typescript": "^5.9.3",
145
146
  "typescript-eslint": "^8.60.1",
146
- "vue": "^3.5.13"
147
+ "vue": "^3.5.13",
148
+ "zone.js": "^0.15.1"
147
149
  },
148
150
  "peerDependencies": {
149
151
  "@angular/core": "^16.0.0 || ^17.0.0 || ^18.0.0 || ^19.0.0",
@@ -1,3 +0,0 @@
1
- export { getPortal, getProfile, getRefreshToken, getSubscriptionType, setAccessToken, setLoggedInDetails, setPortal, setProfileDetails, setRefreshToken, setSubscriptionType } from './chunk-QPSCMK4W.js';
2
- //# sourceMappingURL=auth-utils-MNMC2QGX.js.map
3
- //# sourceMappingURL=auth-utils-MNMC2QGX.js.map