@mission_sciences/provider-sdk 0.2.0-dev.b8394a3 → 0.2.0-dev.dfda459

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 (44) hide show
  1. package/README.md +1 -40
  2. package/dist/adapters/react/index.d.ts +3 -0
  3. package/dist/adapters/react/index.d.ts.map +1 -0
  4. package/dist/adapters/react/index.js +75 -0
  5. package/dist/adapters/react/index.js.map +1 -0
  6. package/dist/adapters/react/useMarketplaceSession.d.ts +30 -0
  7. package/dist/adapters/react/useMarketplaceSession.d.ts.map +1 -0
  8. package/dist/adapters/vue/index.d.ts +3 -0
  9. package/dist/adapters/vue/index.d.ts.map +1 -0
  10. package/dist/adapters/vue/index.js +56 -0
  11. package/dist/adapters/vue/index.js.map +1 -0
  12. package/dist/adapters/vue/useMarketplaceSession.d.ts +74 -0
  13. package/dist/adapters/vue/useMarketplaceSession.d.ts.map +1 -0
  14. package/dist/core/HeartbeatManager.d.ts +43 -0
  15. package/dist/core/HeartbeatManager.d.ts.map +1 -0
  16. package/dist/core/JWKSValidator.d.ts +26 -0
  17. package/dist/core/JWKSValidator.d.ts.map +1 -0
  18. package/dist/core/JWTParser.d.ts +46 -0
  19. package/dist/core/JWTParser.d.ts.map +1 -0
  20. package/dist/core/MarketplaceSDK.d.ts +105 -0
  21. package/dist/core/MarketplaceSDK.d.ts.map +1 -0
  22. package/dist/core/TabSyncManager.d.ts +49 -0
  23. package/dist/core/TabSyncManager.d.ts.map +1 -0
  24. package/dist/core/TimerManager.d.ts +55 -0
  25. package/dist/core/TimerManager.d.ts.map +1 -0
  26. package/dist/index.d.ts +21 -769
  27. package/dist/index.d.ts.map +1 -0
  28. package/dist/marketplace-sdk.es.js +5 -4
  29. package/dist/marketplace-sdk.es.js.map +1 -1
  30. package/dist/marketplace-sdk.umd.js +1 -1
  31. package/dist/marketplace-sdk.umd.js.map +1 -1
  32. package/dist/styles/theme.d.ts +89 -0
  33. package/dist/styles/theme.d.ts.map +1 -0
  34. package/dist/types/index.d.ts +222 -0
  35. package/dist/types/index.d.ts.map +1 -0
  36. package/dist/ui/SessionHeader.d.ts +46 -0
  37. package/dist/ui/SessionHeader.d.ts.map +1 -0
  38. package/dist/ui/WarningModal.d.ts +39 -0
  39. package/dist/ui/WarningModal.d.ts.map +1 -0
  40. package/dist/utils/logger.d.ts +25 -0
  41. package/dist/utils/logger.d.ts.map +1 -0
  42. package/dist/utils/url.d.ts +12 -0
  43. package/dist/utils/url.d.ts.map +1 -0
  44. package/package.json +17 -3
package/README.md CHANGED
@@ -17,7 +17,6 @@ npm install @mission_sciences/provider-sdk
17
17
  import { MarketplaceSDK } from '@mission_sciences/provider-sdk';
18
18
 
19
19
  const sdk = new MarketplaceSDK({
20
- jwksUri: 'https://api.generalwisdom.com/.well-known/jwks.json',
21
20
  applicationId: 'your-app-id',
22
21
  autoStart: true,
23
22
  hooks: {
@@ -478,7 +477,6 @@ npm view @mission_sciences/provider-sdk --json | jq .dist
478
477
 
479
478
  ## Production Checklist
480
479
 
481
- - [ ] Set `jwksUri` to production JWKS endpoint
482
480
  - [ ] Set correct `applicationId`
483
481
  - [ ] Set `hookTimeoutMs` appropriately for your auth provider latency
484
482
  - [ ] Enable HTTPS on all endpoints
@@ -500,43 +498,6 @@ npm view @mission_sciences/provider-sdk --json | jq .dist
500
498
 
501
499
  **Multi-tab conflicts** -- Enable `enableTabSync: true` to elect a master tab and sync session state across tabs via BroadcastChannel.
502
500
 
503
- ## Migration from @marketplace/provider-sdk
504
-
505
- ```bash
506
- # 1. Update package
507
- npm uninstall @marketplace/provider-sdk
508
- npm install @mission_sciences/provider-sdk
509
-
510
- # 2. Update imports
511
- # Old: import MarketplaceSDK from '@marketplace/provider-sdk';
512
- # New: import { MarketplaceSDK } from '@mission_sciences/provider-sdk';
513
- ```
514
-
515
- The API is 100% compatible. No code changes required beyond the package name.
516
-
517
- **What changed:**
518
- - Repository: Bitbucket (private) -> [GitHub](https://github.com/Mission-Sciences/provider-sdk) (public)
519
- - Package: `@marketplace/provider-sdk` -> `@mission_sciences/provider-sdk`
520
- - Registry: CodeArtifact only -> npm (public) + CodeArtifact (private)
521
- - CI/CD: Bitbucket Pipelines -> GitHub Actions with OIDC
522
- - Security: Added cryptographic provenance attestation
523
-
524
- ## Changelog
525
-
526
- ### v0.1.2 (2025-01-11) -- Migration Release
527
- - Migrated from Bitbucket to GitHub
528
- - Package renamed: `@marketplace/provider-sdk` -> `@mission_sciences/provider-sdk`
529
- - Added cryptographic provenance attestation
530
- - Dual publishing: npm (public) + AWS CodeArtifact (private)
531
- - Zero-secret CI/CD with OIDC authentication
532
- - Added lifecycle hooks (`onSessionStart`, `onSessionEnd`, `onSessionWarning`, `onSessionExtend`)
533
- - Added heartbeat, multi-tab sync, session extension, early completion
534
- - Added auth integration demo with 5 identity providers
535
-
536
- ### v0.1.1 (2024) -- Pre-Migration
537
- - Initial Bitbucket release
538
- - CodeArtifact-only distribution
539
-
540
501
  ## License
541
502
 
542
503
  MIT -- see [LICENSE](./LICENSE)
@@ -544,4 +505,4 @@ MIT -- see [LICENSE](./LICENSE)
544
505
  ## Support
545
506
 
546
507
  - **Issues**: [GitHub Issues](https://github.com/Mission-Sciences/provider-sdk/issues)
547
- - **Email**: support@generalwisdom.com
508
+ - **Discord**: [Discord](https://discord.com/invite/RN5gFEzXhB)
@@ -0,0 +1,3 @@
1
+ export { useMarketplaceSession } from './useMarketplaceSession';
2
+ export type { UseMarketplaceSessionOptions, UseMarketplaceSessionReturn, } from './useMarketplaceSession';
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/adapters/react/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,qBAAqB,EAAE,MAAM,yBAAyB,CAAC;AAChE,YAAY,EACV,4BAA4B,EAC5B,2BAA2B,GAC5B,MAAM,yBAAyB,CAAC"}
@@ -0,0 +1,75 @@
1
+ import { useState as a, useRef as d, useEffect as K, useCallback as i } from "react";
2
+ import { MarketplaceSDK as W } from "../../../core/MarketplaceSDK";
3
+ function x(e) {
4
+ const [m, S] = a(null), [f, c] = a(!0), [T, l] = a(null), [g, w] = a(0), [h, b] = a("0:00"), [k, E] = a("0:00:00"), [y, s] = a(!1), n = d(null), u = d(null);
5
+ K(() => ((async () => {
6
+ try {
7
+ const r = new W({
8
+ jwksUri: e.jwksUri,
9
+ apiEndpoint: e.apiEndpoint,
10
+ debug: e.debug,
11
+ autoStart: e.autoStart,
12
+ warningThresholdSeconds: e.warningThresholdSeconds,
13
+ customStyles: e.customStyles,
14
+ applicationId: e.applicationId,
15
+ enableHeartbeat: e.enableHeartbeat ?? !1,
16
+ heartbeatIntervalSeconds: e.heartbeatIntervalSeconds ?? 30,
17
+ enableTabSync: e.enableTabSync ?? !1,
18
+ pauseOnHidden: e.pauseOnHidden ?? !1,
19
+ useBackendValidation: e.useBackendValidation ?? !1,
20
+ hooks: e.hooks
21
+ });
22
+ r.on("onSessionStart", (t) => {
23
+ S(t), c(!1), s(r.isTimerRunning()), e.onSessionStart?.(t);
24
+ }), r.on("onSessionWarning", (t) => {
25
+ e.onSessionWarning?.(t);
26
+ }), r.on("onSessionEnd", () => {
27
+ s(!1), e.onSessionEnd?.();
28
+ }), r.on("onError", (t) => {
29
+ l(t.message), c(!1), e.onError?.(t);
30
+ }), n.current = r, await r.initialize(), u.current = window.setInterval(() => {
31
+ n.current && (w(n.current.getRemainingTime()), b(n.current.getFormattedTime()), E(n.current.getFormattedTimeWithHours()), s(n.current.isTimerRunning()));
32
+ }, 1e3);
33
+ } catch (r) {
34
+ const t = r instanceof Error ? r.message : "Unknown error";
35
+ l(t), c(!1);
36
+ }
37
+ })(), () => {
38
+ u.current && clearInterval(u.current), n.current && n.current.destroy();
39
+ }), []);
40
+ const R = i(() => {
41
+ n.current?.startTimer(), s(!0);
42
+ }, []), H = i(() => {
43
+ n.current?.pauseTimer(), s(!1);
44
+ }, []), I = i(() => {
45
+ n.current?.resumeTimer(), s(!0);
46
+ }, []), v = i(() => {
47
+ n.current?.endSession(), s(!1);
48
+ }, []), z = i(async (o) => {
49
+ if (!n.current) throw new Error("SDK not initialized");
50
+ await n.current.extendSession(o);
51
+ }, []), D = i(async (o) => {
52
+ if (!n.current) throw new Error("SDK not initialized");
53
+ await n.current.completeSession(o);
54
+ }, []);
55
+ return {
56
+ session: m,
57
+ loading: f,
58
+ error: T,
59
+ remainingTime: g,
60
+ formattedTime: h,
61
+ formattedTimeWithHours: k,
62
+ isTimerRunning: y,
63
+ startTimer: R,
64
+ pauseTimer: H,
65
+ resumeTimer: I,
66
+ endSession: v,
67
+ extendSession: z,
68
+ completeSession: D,
69
+ sdk: n.current
70
+ };
71
+ }
72
+ export {
73
+ x as useMarketplaceSession
74
+ };
75
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sources":["../../../src/adapters/react/useMarketplaceSession.ts"],"sourcesContent":["import { useEffect, useState, useCallback, useRef } from 'react';\nimport { MarketplaceSDK } from '../../core/MarketplaceSDK';\nimport type { SDKConfig, SessionData } from '../../types';\n\nexport interface UseMarketplaceSessionOptions extends Omit<SDKConfig, 'hooks'> {\n onSessionStart?: (data: SessionData) => void;\n onSessionWarning?: (data: { remainingSeconds: number }) => void;\n onSessionEnd?: () => void;\n onError?: (error: Error) => void;\n hooks?: SDKConfig['hooks'];\n}\n\nexport interface UseMarketplaceSessionReturn {\n session: SessionData | null;\n loading: boolean;\n error: string | null;\n remainingTime: number;\n formattedTime: string;\n formattedTimeWithHours: string;\n isTimerRunning: boolean;\n startTimer: () => void;\n pauseTimer: () => void;\n resumeTimer: () => void;\n endSession: () => void;\n extendSession: (minutes: number) => Promise<void>;\n completeSession: (actualUsageMinutes?: number) => Promise<void>;\n sdk: MarketplaceSDK | null;\n}\n\nexport function useMarketplaceSession(\n options: UseMarketplaceSessionOptions\n): UseMarketplaceSessionReturn {\n const [session, setSession] = useState<SessionData | null>(null);\n const [loading, setLoading] = useState(true);\n const [error, setError] = useState<string | null>(null);\n const [remainingTime, setRemainingTime] = useState(0);\n const [formattedTime, setFormattedTime] = useState('0:00');\n const [formattedTimeWithHours, setFormattedTimeWithHours] = useState('0:00:00');\n const [isTimerRunning, setIsTimerRunning] = useState(false);\n\n const sdkRef = useRef<MarketplaceSDK | null>(null);\n const intervalRef = useRef<number | null>(null);\n\n useEffect(() => {\n const initializeSDK = async () => {\n try {\n const sdk = new MarketplaceSDK({\n jwksUri: options.jwksUri,\n apiEndpoint: options.apiEndpoint,\n debug: options.debug,\n autoStart: options.autoStart,\n warningThresholdSeconds: options.warningThresholdSeconds,\n customStyles: options.customStyles,\n applicationId: options.applicationId,\n enableHeartbeat: options.enableHeartbeat ?? false,\n heartbeatIntervalSeconds: options.heartbeatIntervalSeconds ?? 30,\n enableTabSync: options.enableTabSync ?? false,\n pauseOnHidden: options.pauseOnHidden ?? false,\n useBackendValidation: options.useBackendValidation ?? false,\n hooks: options.hooks,\n });\n\n sdk.on('onSessionStart', (data) => {\n setSession(data);\n setLoading(false);\n setIsTimerRunning(sdk.isTimerRunning());\n options.onSessionStart?.(data);\n });\n\n sdk.on('onSessionWarning', (data) => {\n options.onSessionWarning?.(data);\n });\n\n sdk.on('onSessionEnd', () => {\n setIsTimerRunning(false);\n options.onSessionEnd?.();\n });\n\n sdk.on('onError', (err) => {\n setError(err.message);\n setLoading(false);\n options.onError?.(err);\n });\n\n sdkRef.current = sdk;\n await sdk.initialize();\n\n intervalRef.current = window.setInterval(() => {\n if (sdkRef.current) {\n setRemainingTime(sdkRef.current.getRemainingTime());\n setFormattedTime(sdkRef.current.getFormattedTime());\n setFormattedTimeWithHours(sdkRef.current.getFormattedTimeWithHours());\n setIsTimerRunning(sdkRef.current.isTimerRunning());\n }\n }, 1000);\n } catch (err) {\n const errorMessage = err instanceof Error ? err.message : 'Unknown error';\n setError(errorMessage);\n setLoading(false);\n }\n };\n\n initializeSDK();\n\n return () => {\n if (intervalRef.current) {\n clearInterval(intervalRef.current);\n }\n if (sdkRef.current) {\n sdkRef.current.destroy();\n }\n };\n }, []);\n\n const startTimer = useCallback(() => {\n sdkRef.current?.startTimer();\n setIsTimerRunning(true);\n }, []);\n\n const pauseTimer = useCallback(() => {\n sdkRef.current?.pauseTimer();\n setIsTimerRunning(false);\n }, []);\n\n const resumeTimer = useCallback(() => {\n sdkRef.current?.resumeTimer();\n setIsTimerRunning(true);\n }, []);\n\n const endSession = useCallback(() => {\n sdkRef.current?.endSession();\n setIsTimerRunning(false);\n }, []);\n\n const extendSession = useCallback(async (minutes: number) => {\n if (!sdkRef.current) throw new Error('SDK not initialized');\n await sdkRef.current.extendSession(minutes);\n }, []);\n\n const completeSession = useCallback(async (actualUsageMinutes?: number) => {\n if (!sdkRef.current) throw new Error('SDK not initialized');\n await sdkRef.current.completeSession(actualUsageMinutes);\n }, []);\n\n return {\n session,\n loading,\n error,\n remainingTime,\n formattedTime,\n formattedTimeWithHours,\n isTimerRunning,\n startTimer,\n pauseTimer,\n resumeTimer,\n endSession,\n extendSession,\n completeSession,\n sdk: sdkRef.current,\n };\n}\n"],"names":["useMarketplaceSession","options","session","setSession","useState","loading","setLoading","error","setError","remainingTime","setRemainingTime","formattedTime","setFormattedTime","formattedTimeWithHours","setFormattedTimeWithHours","isTimerRunning","setIsTimerRunning","sdkRef","useRef","intervalRef","useEffect","sdk","MarketplaceSDK","data","err","errorMessage","startTimer","useCallback","pauseTimer","resumeTimer","endSession","extendSession","minutes","completeSession","actualUsageMinutes"],"mappings":";;AA6BO,SAASA,EACdC,GAC6B;AAC7B,QAAM,CAACC,GAASC,CAAU,IAAIC,EAA6B,IAAI,GACzD,CAACC,GAASC,CAAU,IAAIF,EAAS,EAAI,GACrC,CAACG,GAAOC,CAAQ,IAAIJ,EAAwB,IAAI,GAChD,CAACK,GAAeC,CAAgB,IAAIN,EAAS,CAAC,GAC9C,CAACO,GAAeC,CAAgB,IAAIR,EAAS,MAAM,GACnD,CAACS,G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;AAAA,IACL,SAAAhC;AAAA,IACA,SAAAG;AAAA,IACA,OAAAE;AAAA,IACA,eAAAE;AAAA,IACA,eAAAE;AAAA,IACA,wBAAAE;AAAA,IACA,gBAAAE;AAAA,IACA,YAAAW;AAAA,IACA,YAAAE;AAAA,IACA,aAAAC;AAAA,IACA,YAAAC;AAAA,IACA,eAAAC;AAAA,IACA,iBAAAE;AAAA,IACA,KAAKhB,EAAO;AAAA,EAAA;AAEhB;"}
@@ -0,0 +1,30 @@
1
+ import { MarketplaceSDK } from '../../core/MarketplaceSDK';
2
+ import { SDKConfig, SessionData } from '../../types';
3
+
4
+ export interface UseMarketplaceSessionOptions extends Omit<SDKConfig, 'hooks'> {
5
+ onSessionStart?: (data: SessionData) => void;
6
+ onSessionWarning?: (data: {
7
+ remainingSeconds: number;
8
+ }) => void;
9
+ onSessionEnd?: () => void;
10
+ onError?: (error: Error) => void;
11
+ hooks?: SDKConfig['hooks'];
12
+ }
13
+ export interface UseMarketplaceSessionReturn {
14
+ session: SessionData | null;
15
+ loading: boolean;
16
+ error: string | null;
17
+ remainingTime: number;
18
+ formattedTime: string;
19
+ formattedTimeWithHours: string;
20
+ isTimerRunning: boolean;
21
+ startTimer: () => void;
22
+ pauseTimer: () => void;
23
+ resumeTimer: () => void;
24
+ endSession: () => void;
25
+ extendSession: (minutes: number) => Promise<void>;
26
+ completeSession: (actualUsageMinutes?: number) => Promise<void>;
27
+ sdk: MarketplaceSDK | null;
28
+ }
29
+ export declare function useMarketplaceSession(options: UseMarketplaceSessionOptions): UseMarketplaceSessionReturn;
30
+ //# sourceMappingURL=useMarketplaceSession.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useMarketplaceSession.d.ts","sourceRoot":"","sources":["../../../src/adapters/react/useMarketplaceSession.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAC;AAC3D,OAAO,KAAK,EAAE,SAAS,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAE1D,MAAM,WAAW,4BAA6B,SAAQ,IAAI,CAAC,SAAS,EAAE,OAAO,CAAC;IAC5E,cAAc,CAAC,EAAE,CAAC,IAAI,EAAE,WAAW,KAAK,IAAI,CAAC;IAC7C,gBAAgB,CAAC,EAAE,CAAC,IAAI,EAAE;QAAE,gBAAgB,EAAE,MAAM,CAAA;KAAE,KAAK,IAAI,CAAC;IAChE,YAAY,CAAC,EAAE,MAAM,IAAI,CAAC;IAC1B,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,KAAK,KAAK,IAAI,CAAC;IACjC,KAAK,CAAC,EAAE,SAAS,CAAC,OAAO,CAAC,CAAC;CAC5B;AAED,MAAM,WAAW,2BAA2B;IAC1C,OAAO,EAAE,WAAW,GAAG,IAAI,CAAC;IAC5B,OAAO,EAAE,OAAO,CAAC;IACjB,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;IACrB,aAAa,EAAE,MAAM,CAAC;IACtB,aAAa,EAAE,MAAM,CAAC;IACtB,sBAAsB,EAAE,MAAM,CAAC;IAC/B,cAAc,EAAE,OAAO,CAAC;IACxB,UAAU,EAAE,MAAM,IAAI,CAAC;IACvB,UAAU,EAAE,MAAM,IAAI,CAAC;IACvB,WAAW,EAAE,MAAM,IAAI,CAAC;IACxB,UAAU,EAAE,MAAM,IAAI,CAAC;IACvB,aAAa,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;IAClD,eAAe,EAAE,CAAC,kBAAkB,CAAC,EAAE,MAAM,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;IAChE,GAAG,EAAE,cAAc,GAAG,IAAI,CAAC;CAC5B;AAED,wBAAgB,qBAAqB,CACnC,OAAO,EAAE,4BAA4B,GACpC,2BAA2B,CAiI7B"}
@@ -0,0 +1,3 @@
1
+ export { useMarketplaceSession } from './useMarketplaceSession';
2
+ export type { UseMarketplaceSessionOptions } from './useMarketplaceSession';
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/adapters/vue/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,qBAAqB,EAAE,MAAM,yBAAyB,CAAC;AAChE,YAAY,EAAE,4BAA4B,EAAE,MAAM,yBAAyB,CAAC"}
@@ -0,0 +1,56 @@
1
+ import { ref as l, onMounted as v, onUnmounted as d } from "vue";
2
+ import { MarketplaceSDK as f } from "../../../core/MarketplaceSDK";
3
+ function h(e = {}) {
4
+ const a = l(null), o = l(null), u = l(!0), i = l(null), m = l(0), c = l("0:00"), r = l(!1);
5
+ let t = null;
6
+ return v(async () => {
7
+ try {
8
+ const n = new f({
9
+ jwksUri: e.jwksUri,
10
+ apiEndpoint: e.apiEndpoint,
11
+ debug: e.debug,
12
+ autoStart: e.autoStart,
13
+ warningThresholdSeconds: e.warningThresholdSeconds,
14
+ applicationId: e.applicationId,
15
+ enableHeartbeat: e.enableHeartbeat ?? !1,
16
+ enableTabSync: e.enableTabSync ?? !1,
17
+ pauseOnHidden: e.pauseOnHidden ?? !1,
18
+ hooks: e.hooks
19
+ });
20
+ n.on("onSessionStart", (s) => {
21
+ o.value = s, u.value = !1, r.value = n.isTimerRunning(), e.onSessionStart?.(s);
22
+ }), n.on("onSessionEnd", () => {
23
+ r.value = !1, e.onSessionEnd?.({});
24
+ }), n.on("onError", (s) => {
25
+ i.value = s.message, u.value = !1, e.onError?.(s);
26
+ }), await n.initialize(), a.value = n, t = setInterval(() => {
27
+ a.value && (m.value = a.value.getRemainingTime(), c.value = a.value.getFormattedTime(), r.value = a.value.isTimerRunning());
28
+ }, 1e3);
29
+ } catch (n) {
30
+ i.value = n instanceof Error ? n.message : "Unknown error", u.value = !1;
31
+ }
32
+ }), d(() => {
33
+ t && clearInterval(t), a.value?.destroy();
34
+ }), {
35
+ sdk: a,
36
+ session: o,
37
+ loading: u,
38
+ error: i,
39
+ remainingTime: m,
40
+ formattedTime: c,
41
+ isTimerRunning: r,
42
+ pauseTimer: () => {
43
+ a.value?.pauseTimer(), r.value = !1;
44
+ },
45
+ resumeTimer: () => {
46
+ a.value?.resumeTimer(), r.value = !0;
47
+ },
48
+ endSession: () => {
49
+ a.value?.endSession(), r.value = !1;
50
+ }
51
+ };
52
+ }
53
+ export {
54
+ h as useMarketplaceSession
55
+ };
56
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sources":["../../../src/adapters/vue/useMarketplaceSession.ts"],"sourcesContent":["import { ref, onMounted, onUnmounted } from 'vue';\nimport { MarketplaceSDK } from '../../core/MarketplaceSDK';\nimport type { SDKConfig, SessionData, SessionStartContext, SessionEndContext } from '../../types';\n\nexport interface UseMarketplaceSessionOptions extends Omit<SDKConfig, 'hooks'> {\n onSessionStart?: (context: SessionStartContext) => void | Promise<void>;\n onSessionEnd?: (context: SessionEndContext) => void | Promise<void>;\n onError?: (error: Error) => void;\n hooks?: SDKConfig['hooks'];\n}\n\nexport function useMarketplaceSession(options: UseMarketplaceSessionOptions = {} as UseMarketplaceSessionOptions) {\n const sdk = ref<MarketplaceSDK | null>(null);\n const session = ref<SessionData | null>(null);\n const loading = ref(true);\n const error = ref<string | null>(null);\n const remainingTime = ref(0);\n const formattedTime = ref('0:00');\n const isTimerRunning = ref(false);\n\n let timerInterval: ReturnType<typeof setInterval> | null = null;\n\n onMounted(async () => {\n try {\n const marketplaceSDK = new MarketplaceSDK({\n jwksUri: options.jwksUri,\n apiEndpoint: options.apiEndpoint,\n debug: options.debug,\n autoStart: options.autoStart,\n warningThresholdSeconds: options.warningThresholdSeconds,\n applicationId: options.applicationId,\n enableHeartbeat: options.enableHeartbeat ?? false,\n enableTabSync: options.enableTabSync ?? false,\n pauseOnHidden: options.pauseOnHidden ?? false,\n hooks: options.hooks,\n });\n\n marketplaceSDK.on('onSessionStart', (data) => {\n session.value = data;\n loading.value = false;\n isTimerRunning.value = marketplaceSDK.isTimerRunning();\n options.onSessionStart?.(data as unknown as SessionStartContext);\n });\n\n marketplaceSDK.on('onSessionEnd', () => {\n isTimerRunning.value = false;\n options.onSessionEnd?.({} as SessionEndContext);\n });\n\n marketplaceSDK.on('onError', (err) => {\n error.value = err.message;\n loading.value = false;\n options.onError?.(err);\n });\n\n await marketplaceSDK.initialize();\n sdk.value = marketplaceSDK;\n\n timerInterval = setInterval(() => {\n if (sdk.value) {\n remainingTime.value = sdk.value.getRemainingTime();\n formattedTime.value = sdk.value.getFormattedTime();\n isTimerRunning.value = sdk.value.isTimerRunning();\n }\n }, 1000);\n } catch (err) {\n error.value = err instanceof Error ? err.message : 'Unknown error';\n loading.value = false;\n }\n });\n\n onUnmounted(() => {\n if (timerInterval) clearInterval(timerInterval);\n sdk.value?.destroy();\n });\n\n const pauseTimer = () => {\n sdk.value?.pauseTimer();\n isTimerRunning.value = false;\n };\n\n const resumeTimer = () => {\n sdk.value?.resumeTimer();\n isTimerRunning.value = true;\n };\n\n const endSession = () => {\n sdk.value?.endSession();\n isTimerRunning.value = false;\n };\n\n return {\n sdk,\n session,\n loading,\n error,\n remainingTime,\n formattedTime,\n isTimerRunning,\n pauseTimer,\n resumeTimer,\n endSession,\n };\n}\n"],"names":["useMarketplaceSession","options","sdk","ref","session","loading","error","remainingTime","formattedTime","isTimerRunning","timerInterval","onMounted","marketplaceSDK","MarketplaceSDK","data","err","onUnmounted"],"mappings":";;AAWO,SAASA,EAAsBC,IAAwC,IAAoC;AAChH,QAAMC,IAAMC,EAA2B,IAAI,GACrCC,IAAUD,EAAwB,IAAI,GACtCE,IAAUF,EAAI,EAAI,GAClBG,IAAQH,EAAmB,IAAI,GAC/BI,IAAgBJ,EAAI,CAAC,GACrBK,IAAgBL,EAAI,MAAM,GAC1BM,IAAiBN,EAAI,EAAK;AAEhC,MAAIO,IAAuD;AAE3D,SAAAC,EAAU,YAAY;AACpB,QAAI;AACF,YAAMC,IAAiB,IAAIC,EAAe;AAAA,QACxC,SAASZ,EAAQ;AAAA,QACjB,aAAaA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AAC;AAAA,IACA,eAAAC;AAAA,IACA,gBAAAC;AAAA,IACA,YAvBiB,MAAM;AACvB,MAAAP,EAAI,OAAO,WAAA,GACXO,EAAe,QAAQ;AAAA,IACzB;AAAA,IAqBE,aAnBkB,MAAM;AACxB,MAAAP,EAAI,OAAO,YAAA,GACXO,EAAe,QAAQ;AAAA,IACzB;AAAA,IAiBE,YAfiB,MAAM;AACvB,MAAAP,EAAI,OAAO,WAAA,GACXO,EAAe,QAAQ;AAAA,IACzB;AAAA,EAYE;AAEJ;"}
@@ -0,0 +1,74 @@
1
+ import { MarketplaceSDK } from '../../core/MarketplaceSDK';
2
+ import { SDKConfig, SessionData, SessionStartContext, SessionEndContext } from '../../types';
3
+
4
+ export interface UseMarketplaceSessionOptions extends Omit<SDKConfig, 'hooks'> {
5
+ onSessionStart?: (context: SessionStartContext) => void | Promise<void>;
6
+ onSessionEnd?: (context: SessionEndContext) => void | Promise<void>;
7
+ onError?: (error: Error) => void;
8
+ hooks?: SDKConfig['hooks'];
9
+ }
10
+ export declare function useMarketplaceSession(options?: UseMarketplaceSessionOptions): {
11
+ sdk: import('vue').Ref<{
12
+ on: <K extends keyof import('../../types').SDKEvents>(event: K, handler: import('../../types').SDKEvents[K]) => void;
13
+ initialize: () => Promise<SessionData>;
14
+ startTimer: () => void;
15
+ pauseTimer: () => void;
16
+ resumeTimer: () => void;
17
+ extendSession: (additionalMinutes: number) => Promise<void>;
18
+ completeSession: (actualUsageMinutes?: number) => Promise<void>;
19
+ endSession: () => Promise<void>;
20
+ getSessionData: () => SessionData | null;
21
+ getRemainingTime: () => number;
22
+ getFormattedTime: () => string;
23
+ getFormattedTimeWithHours: () => string;
24
+ isTimerRunning: () => boolean;
25
+ destroy: () => void;
26
+ } | null, MarketplaceSDK | {
27
+ on: <K extends keyof import('../../types').SDKEvents>(event: K, handler: import('../../types').SDKEvents[K]) => void;
28
+ initialize: () => Promise<SessionData>;
29
+ startTimer: () => void;
30
+ pauseTimer: () => void;
31
+ resumeTimer: () => void;
32
+ extendSession: (additionalMinutes: number) => Promise<void>;
33
+ completeSession: (actualUsageMinutes?: number) => Promise<void>;
34
+ endSession: () => Promise<void>;
35
+ getSessionData: () => SessionData | null;
36
+ getRemainingTime: () => number;
37
+ getFormattedTime: () => string;
38
+ getFormattedTimeWithHours: () => string;
39
+ isTimerRunning: () => boolean;
40
+ destroy: () => void;
41
+ } | null>;
42
+ session: import('vue').Ref<{
43
+ sessionId: string;
44
+ applicationId: string;
45
+ userId: string;
46
+ orgId: string;
47
+ startTime: number;
48
+ durationMinutes: number;
49
+ iat: number;
50
+ exp: number;
51
+ iss: string;
52
+ sub: string;
53
+ } | null, SessionData | {
54
+ sessionId: string;
55
+ applicationId: string;
56
+ userId: string;
57
+ orgId: string;
58
+ startTime: number;
59
+ durationMinutes: number;
60
+ iat: number;
61
+ exp: number;
62
+ iss: string;
63
+ sub: string;
64
+ } | null>;
65
+ loading: import('vue').Ref<boolean, boolean>;
66
+ error: import('vue').Ref<string | null, string | null>;
67
+ remainingTime: import('vue').Ref<number, number>;
68
+ formattedTime: import('vue').Ref<string, string>;
69
+ isTimerRunning: import('vue').Ref<boolean, boolean>;
70
+ pauseTimer: () => void;
71
+ resumeTimer: () => void;
72
+ endSession: () => void;
73
+ };
74
+ //# sourceMappingURL=useMarketplaceSession.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useMarketplaceSession.d.ts","sourceRoot":"","sources":["../../../src/adapters/vue/useMarketplaceSession.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAC;AAC3D,OAAO,KAAK,EAAE,SAAS,EAAE,WAAW,EAAE,mBAAmB,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAElG,MAAM,WAAW,4BAA6B,SAAQ,IAAI,CAAC,SAAS,EAAE,OAAO,CAAC;IAC5E,cAAc,CAAC,EAAE,CAAC,OAAO,EAAE,mBAAmB,KAAK,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IACxE,YAAY,CAAC,EAAE,CAAC,OAAO,EAAE,iBAAiB,KAAK,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IACpE,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,KAAK,KAAK,IAAI,CAAC;IACjC,KAAK,CAAC,EAAE,SAAS,CAAC,OAAO,CAAC,CAAC;CAC5B;AAED,wBAAgB,qBAAqB,CAAC,OAAO,GAAE,4BAAiE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA4F/G"}
@@ -0,0 +1,43 @@
1
+ /**
2
+ * Heartbeat Manager for active session tracking
3
+ * Phase 2 Feature - Sends periodic heartbeats to backend
4
+ */
5
+ export declare class HeartbeatManager {
6
+ private sessionId;
7
+ private apiEndpoint;
8
+ private token;
9
+ private onSync?;
10
+ private onError?;
11
+ private intervalId;
12
+ private heartbeatInterval;
13
+ private failureCount;
14
+ private maxFailures;
15
+ private isEnabled;
16
+ private logger;
17
+ constructor(sessionId: string, apiEndpoint: string, token: string, onSync?: ((remainingSeconds: number) => void) | undefined, onError?: ((error: Error) => void) | undefined, heartbeatIntervalSeconds?: number, debug?: boolean);
18
+ /**
19
+ * Start sending heartbeats
20
+ */
21
+ start(): void;
22
+ /**
23
+ * Stop sending heartbeats
24
+ */
25
+ stop(): void;
26
+ /**
27
+ * Send a single heartbeat to backend
28
+ */
29
+ private sendHeartbeat;
30
+ /**
31
+ * Check if heartbeat is running
32
+ */
33
+ isRunning(): boolean;
34
+ /**
35
+ * Get failure count
36
+ */
37
+ getFailureCount(): number;
38
+ /**
39
+ * Update heartbeat interval
40
+ */
41
+ updateInterval(seconds: number): void;
42
+ }
43
+ //# sourceMappingURL=HeartbeatManager.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"HeartbeatManager.d.ts","sourceRoot":"","sources":["../../src/core/HeartbeatManager.ts"],"names":[],"mappings":"AAGA;;;GAGG;AACH,qBAAa,gBAAgB;IASzB,OAAO,CAAC,SAAS;IACjB,OAAO,CAAC,WAAW;IACnB,OAAO,CAAC,KAAK;IACb,OAAO,CAAC,MAAM,CAAC;IACf,OAAO,CAAC,OAAO,CAAC;IAZlB,OAAO,CAAC,UAAU,CAAuB;IACzC,OAAO,CAAC,iBAAiB,CAAS;IAClC,OAAO,CAAC,YAAY,CAAa;IACjC,OAAO,CAAC,WAAW,CAAa;IAChC,OAAO,CAAC,SAAS,CAAkB;IACnC,OAAO,CAAC,MAAM,CAAS;gBAGb,SAAS,EAAE,MAAM,EACjB,WAAW,EAAE,MAAM,EACnB,KAAK,EAAE,MAAM,EACb,MAAM,CAAC,GAAE,CAAC,gBAAgB,EAAE,MAAM,KAAK,IAAI,aAAA,EAC3C,OAAO,CAAC,GAAE,CAAC,KAAK,EAAE,KAAK,KAAK,IAAI,aAAA,EACxC,wBAAwB,GAAE,MAAW,EACrC,KAAK,GAAE,OAAe;IAOxB;;OAEG;IACH,KAAK,IAAI,IAAI;IAkBb;;OAEG;IACH,IAAI,IAAI,IAAI;IASZ;;OAEG;YACW,aAAa;IA6D3B;;OAEG;IACH,SAAS,IAAI,OAAO;IAIpB;;OAEG;IACH,eAAe,IAAI,MAAM;IAIzB;;OAEG;IACH,cAAc,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI;CActC"}
@@ -0,0 +1,26 @@
1
+ import { JWTClaims } from '../types';
2
+
3
+ /**
4
+ * JWKS Validator for RS256 JWT signature verification
5
+ * Uses jose library for browser and Node.js compatibility
6
+ */
7
+ export declare class JWKSValidator {
8
+ private jwksUri;
9
+ private logger;
10
+ private jwks;
11
+ constructor(jwksUri: string, debug?: boolean);
12
+ /**
13
+ * Verify JWT signature using JWKS public key
14
+ * @param token - JWT token to verify
15
+ * @param expectedIssuer - Expected issuer (default: 'generalwisdom.com')
16
+ * @param expectedApplicationId - Optional application ID to validate
17
+ * @returns Decoded and verified JWT claims
18
+ */
19
+ verify(token: string, expectedIssuer?: string, expectedApplicationId?: string): Promise<JWTClaims>;
20
+ /**
21
+ * Update JWKS URI
22
+ * @param jwksUri - New JWKS URI
23
+ */
24
+ updateJwksUri(jwksUri: string): void;
25
+ }
26
+ //# sourceMappingURL=JWKSValidator.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"JWKSValidator.d.ts","sourceRoot":"","sources":["../../src/core/JWKSValidator.ts"],"names":[],"mappings":"AACA,OAAO,EAAY,SAAS,EAAE,MAAM,UAAU,CAAC;AAG/C;;;GAGG;AACH,qBAAa,aAAa;IACxB,OAAO,CAAC,OAAO,CAAS;IACxB,OAAO,CAAC,MAAM,CAAS;IACvB,OAAO,CAAC,IAAI,CAAwC;gBAExC,OAAO,EAAE,MAAM,EAAE,KAAK,GAAE,OAAe;IAcnD;;;;;;OAMG;IACG,MAAM,CACV,KAAK,EAAE,MAAM,EACb,cAAc,GAAE,MAA4B,EAC5C,qBAAqB,CAAC,EAAE,MAAM,GAC7B,OAAO,CAAC,SAAS,CAAC;IAwFrB;;;OAGG;IACH,aAAa,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI;CAQrC"}
@@ -0,0 +1,46 @@
1
+ import { JWTHeader, JWTClaims } from '../types';
2
+
3
+ /**
4
+ * JWT Parser for client-side token decoding
5
+ * Note: Does NOT verify signature - use JWKSValidator for verification
6
+ */
7
+ export declare class JWTParser {
8
+ /**
9
+ * Decode JWT payload without verification
10
+ * @param token - JWT token string
11
+ * @returns Decoded payload
12
+ */
13
+ static decode(token: string): JWTClaims;
14
+ /**
15
+ * Decode JWT header
16
+ * @param token - JWT token string
17
+ * @returns Decoded header
18
+ */
19
+ static decodeHeader(token: string): JWTHeader;
20
+ /**
21
+ * Extract specific claim from JWT
22
+ * @param token - JWT token string
23
+ * @param claim - Claim name to extract
24
+ * @returns Claim value
25
+ */
26
+ static extractClaim<T = any>(token: string, claim: string): T;
27
+ /**
28
+ * Check if JWT is expired (client-side only, not authoritative)
29
+ * @param token - JWT token string
30
+ * @returns True if token is expired
31
+ */
32
+ static isExpired(token: string): boolean;
33
+ /**
34
+ * Get time remaining until expiration
35
+ * @param token - JWT token string
36
+ * @returns Seconds remaining (0 if expired)
37
+ */
38
+ static getTimeRemaining(token: string): number;
39
+ /**
40
+ * Base64 URL decode
41
+ * @param str - Base64 URL encoded string
42
+ * @returns Decoded string
43
+ */
44
+ private static base64UrlDecode;
45
+ }
46
+ //# sourceMappingURL=JWTParser.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"JWTParser.d.ts","sourceRoot":"","sources":["../../src/core/JWTParser.ts"],"names":[],"mappings":"AAAA,OAAO,EAAY,SAAS,EAAE,SAAS,EAAE,MAAM,UAAU,CAAC;AAE1D;;;GAGG;AACH,qBAAa,SAAS;IACpB;;;;OAIG;IACH,MAAM,CAAC,MAAM,CAAC,KAAK,EAAE,MAAM,GAAG,SAAS;IAsBvC;;;;OAIG;IACH,MAAM,CAAC,YAAY,CAAC,KAAK,EAAE,MAAM,GAAG,SAAS;IAsB7C;;;;;OAKG;IACH,MAAM,CAAC,YAAY,CAAC,CAAC,GAAG,GAAG,EAAE,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,CAAC;IAK7D;;;;OAIG;IACH,MAAM,CAAC,SAAS,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO;IAYxC;;;;OAIG;IACH,MAAM,CAAC,gBAAgB,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM;IAY9C;;;;OAIG;IACH,OAAO,CAAC,MAAM,CAAC,eAAe;CA0B/B"}
@@ -0,0 +1,105 @@
1
+ import { SDKConfig, SDKEvents, SessionData } from '../types';
2
+
3
+ /**
4
+ * Marketplace SDK with Phase 2 Features
5
+ * - Heartbeat system
6
+ * - Multi-tab synchronization
7
+ * - Visibility API integration
8
+ * - Session extension/completion
9
+ * - Backend validation
10
+ */
11
+ export declare class MarketplaceSDK {
12
+ private config;
13
+ private validator;
14
+ private timer;
15
+ private heartbeat;
16
+ private tabSync;
17
+ private modal;
18
+ private logger;
19
+ private events;
20
+ private sessionData;
21
+ private jwtToken;
22
+ private endReason;
23
+ constructor(config: SDKConfig);
24
+ /**
25
+ * Register event handlers
26
+ */
27
+ on<K extends keyof SDKEvents>(event: K, handler: SDKEvents[K]): void;
28
+ /**
29
+ * Execute a lifecycle hook with timeout
30
+ */
31
+ private executeHook;
32
+ /**
33
+ * Calculate actual session duration in minutes
34
+ */
35
+ private calculateActualDuration;
36
+ /**
37
+ * Initialize SDK and validate session
38
+ */
39
+ initialize(): Promise<SessionData>;
40
+ /**
41
+ * Phase 2: Validate JWT with backend
42
+ */
43
+ private validateWithBackend;
44
+ /**
45
+ * Phase 2: Handle tab sync messages
46
+ */
47
+ private handleTabSyncMessage;
48
+ /**
49
+ * Phase 2: Initialize Visibility API handling
50
+ */
51
+ private initializeVisibilityHandling;
52
+ /**
53
+ * Start session timer manually
54
+ */
55
+ startTimer(): void;
56
+ /**
57
+ * Pause session timer
58
+ */
59
+ pauseTimer(): void;
60
+ /**
61
+ * Resume session timer
62
+ */
63
+ resumeTimer(): void;
64
+ /**
65
+ * Phase 2: Extend session
66
+ */
67
+ extendSession(additionalMinutes: number): Promise<void>;
68
+ /**
69
+ * Phase 2: Complete session
70
+ */
71
+ completeSession(actualUsageMinutes?: number): Promise<void>;
72
+ /**
73
+ * End session
74
+ */
75
+ endSession(): Promise<void>;
76
+ /**
77
+ * Show warning modal
78
+ */
79
+ private showWarningModal;
80
+ /**
81
+ * Get current session data
82
+ */
83
+ getSessionData(): SessionData | null;
84
+ /**
85
+ * Get remaining time
86
+ */
87
+ getRemainingTime(): number;
88
+ /**
89
+ * Get formatted time (MM:SS)
90
+ */
91
+ getFormattedTime(): string;
92
+ /**
93
+ * Get formatted time with hours (HH:MM:SS)
94
+ */
95
+ getFormattedTimeWithHours(): string;
96
+ /**
97
+ * Check if timer is running
98
+ */
99
+ isTimerRunning(): boolean;
100
+ /**
101
+ * Cleanup and destroy SDK instance
102
+ */
103
+ destroy(): void;
104
+ }
105
+ //# sourceMappingURL=MarketplaceSDK.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"MarketplaceSDK.d.ts","sourceRoot":"","sources":["../../src/core/MarketplaceSDK.ts"],"names":[],"mappings":"AAQA,OAAO,EAAE,SAAS,EAAE,SAAS,EAAE,WAAW,EAAiG,MAAM,UAAU,CAAC;AAE5J;;;;;;;GAOG;AACH,qBAAa,cAAc;IACzB,OAAO,CAAC,MAAM,CAAsB;IACpC,OAAO,CAAC,SAAS,CAAgB;IACjC,OAAO,CAAC,KAAK,CAA6B;IAC1C,OAAO,CAAC,SAAS,CAAiC;IAClD,OAAO,CAAC,OAAO,CAA+B;IAC9C,OAAO,CAAC,KAAK,CAA6B;IAC1C,OAAO,CAAC,MAAM,CAAS;IACvB,OAAO,CAAC,MAAM,CAA0B;IACxC,OAAO,CAAC,WAAW,CAA4B;IAC/C,OAAO,CAAC,QAAQ,CAAuB;IACvC,OAAO,CAAC,SAAS,CAA4C;gBAEjD,MAAM,EAAE,SAAS;IAqC7B;;OAEG;IACH,EAAE,CAAC,CAAC,SAAS,MAAM,SAAS,EAAE,KAAK,EAAE,CAAC,EAAE,OAAO,EAAE,SAAS,CAAC,CAAC,CAAC,GAAG,IAAI;IAKpE;;OAEG;YACW,WAAW;IAuCzB;;OAEG;IACH,OAAO,CAAC,uBAAuB;IAO/B;;OAEG;IACG,UAAU,IAAI,OAAO,CAAC,WAAW,CAAC;IA+LxC;;OAEG;YACW,mBAAmB;IAkCjC;;OAEG;IACH,OAAO,CAAC,oBAAoB;IAqB5B;;OAEG;IACH,OAAO,CAAC,4BAA4B;IAapC;;OAEG;IACH,UAAU,IAAI,IAAI;IAYlB;;OAEG;IACH,UAAU,IAAI,IAAI;IAMlB;;OAEG;IACH,WAAW,IAAI,IAAI;IAMnB;;OAEG;IACG,aAAa,CAAC,iBAAiB,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAoE7D;;OAEG;IACG,eAAe,CAAC,kBAAkB,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAgDjE;;OAEG;IACG,UAAU,IAAI,OAAO,CAAC,IAAI,CAAC;IA2DjC;;OAEG;IACH,OAAO,CAAC,gBAAgB;IA0CxB;;OAEG;IACH,cAAc,IAAI,WAAW,GAAG,IAAI;IAIpC;;OAEG;IACH,gBAAgB,IAAI,MAAM;IAI1B;;OAEG;IACH,gBAAgB,IAAI,MAAM;IAI1B;;OAEG;IACH,yBAAyB,IAAI,MAAM;IAInC;;OAEG;IACH,cAAc,IAAI,OAAO;IAIzB;;OAEG;IACH,OAAO,IAAI,IAAI;CAgBhB"}
@@ -0,0 +1,49 @@
1
+ export interface TabSyncMessage {
2
+ type: 'timer_update' | 'pause' | 'resume' | 'end';
3
+ sessionId: string;
4
+ remainingSeconds?: number;
5
+ timestamp: number;
6
+ }
7
+ /**
8
+ * Tab Synchronization Manager
9
+ * Phase 2 Feature - Syncs session state across multiple tabs
10
+ */
11
+ export declare class TabSyncManager {
12
+ private sessionId;
13
+ private onMessage;
14
+ private channel;
15
+ private storageKey;
16
+ private logger;
17
+ private isMaster;
18
+ constructor(sessionId: string, onMessage: (message: TabSyncMessage) => void, debug?: boolean);
19
+ /**
20
+ * Initialize sync mechanism
21
+ */
22
+ private initialize;
23
+ /**
24
+ * Broadcast message to other tabs
25
+ */
26
+ broadcast(type: TabSyncMessage['type'], data?: Partial<TabSyncMessage>): void;
27
+ /**
28
+ * Handle incoming message
29
+ */
30
+ private handleMessage;
31
+ /**
32
+ * Handle storage event (fallback mechanism)
33
+ */
34
+ private handleStorageEvent;
35
+ /**
36
+ * Elect this tab as master if appropriate
37
+ * Master tab is responsible for heartbeats
38
+ */
39
+ private electMaster;
40
+ /**
41
+ * Check if this tab is the master
42
+ */
43
+ isMasterTab(): boolean;
44
+ /**
45
+ * Cleanup and destroy
46
+ */
47
+ destroy(): void;
48
+ }
49
+ //# sourceMappingURL=TabSyncManager.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"TabSyncManager.d.ts","sourceRoot":"","sources":["../../src/core/TabSyncManager.ts"],"names":[],"mappings":"AAEA,MAAM,WAAW,cAAc;IAC7B,IAAI,EAAE,cAAc,GAAG,OAAO,GAAG,QAAQ,GAAG,KAAK,CAAC;IAClD,SAAS,EAAE,MAAM,CAAC;IAClB,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,SAAS,EAAE,MAAM,CAAC;CACnB;AAED;;;GAGG;AACH,qBAAa,cAAc;IAOvB,OAAO,CAAC,SAAS;IACjB,OAAO,CAAC,SAAS;IAPnB,OAAO,CAAC,OAAO,CAAiC;IAChD,OAAO,CAAC,UAAU,CAAS;IAC3B,OAAO,CAAC,MAAM,CAAS;IACvB,OAAO,CAAC,QAAQ,CAAkB;gBAGxB,SAAS,EAAE,MAAM,EACjB,SAAS,EAAE,CAAC,OAAO,EAAE,cAAc,KAAK,IAAI,EACpD,KAAK,GAAE,OAAe;IAQxB;;OAEG;IACH,OAAO,CAAC,UAAU;IAkBlB;;OAEG;IACH,SAAS,CAAC,IAAI,EAAE,cAAc,CAAC,MAAM,CAAC,EAAE,IAAI,CAAC,EAAE,OAAO,CAAC,cAAc,CAAC,GAAG,IAAI;IAkB7E;;OAEG;IACH,OAAO,CAAC,aAAa;IASrB;;OAEG;IACH,OAAO,CAAC,kBAAkB,CASxB;IAEF;;;OAGG;IACH,OAAO,CAAC,WAAW;IA2CnB;;OAEG;IACH,WAAW,IAAI,OAAO;IAItB;;OAEG;IACH,OAAO,IAAI,IAAI;CAiBhB"}