@testerpaykit/expo 0.7.1 → 0.7.3

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.
package/CHANGELOG.md CHANGED
@@ -2,7 +2,59 @@
2
2
 
3
3
  All notable changes to `@testerpaykit/expo` are documented here.
4
4
 
5
- ## 0.7.1 — 2026-09-22
5
+ ## 0.7.3 — 2026-10-20
6
+
7
+ **An expired login no longer turns the SDK off for good.**
8
+
9
+ ### Fixed
10
+ - `TpkExpo.init()` reused the cached anonymous login (storage key `auth`)
11
+ without looking at its expiry. The JWT lives 720 h; once it had expired and
12
+ no session younger than 12 h was stored, `init()` started a server session
13
+ with it, got `401 Invalid or expired token`, and **rejected** — the provider
14
+ client stayed `null` and the report sheet said "SDK not ready — try again in
15
+ a moment." The dead login was never removed, so every later start failed
16
+ the same way. Found in umkreis (2026-10-20): no session had arrived from a
17
+ tester's iPhone since 2026-08-20.
18
+
19
+ Now a cached login with less than a day left is dropped before use, together
20
+ with its persisted session, and `init()` logs in fresh in the background like
21
+ on a first start. A 401 at session start with a cached login does the same.
22
+ Any other session-start failure (offline, 5xx) keeps the login and retries
23
+ the session in the background. `init()` no longer rejects on a network or
24
+ auth error.
25
+
26
+ Host apps that worked around this by hiding an expired `auth` from the SDK
27
+ (a custom `config.storage`) can drop the workaround.
28
+ - A bug report built before the server session existed went out with
29
+ `sessionId: ''`. The API answered 500, the offline queue keeps 5xx entries,
30
+ so the report failed again on every flush and never arrived. Found on
31
+ app.testerpaykit.com (2026-10-20): six such reports in one second.
32
+
33
+ Now `buildPayload()` gives a session that is still being created up to 3 s,
34
+ and `flushQueue()` fills an empty `sessionId` with the current session. While
35
+ there is no session yet, such an entry stays queued instead of being sent.
36
+ The API now rejects malformed ids with 400.
37
+ - **A host app missing any optional native module could not bundle** (since
38
+ 0.6.1). The dev-mode setup check probed every optional peer with
39
+ `import('<module>')` outside a `try`, so Metro treated the import as a hard
40
+ dependency and failed with `Unable to resolve module
41
+ react-native-record-screen` — although the README calls these modules
42
+ optional. Each probe now imports inside its own `try`, which is what makes
43
+ Metro treat it as optional. Found while re-vendoring the coordinator
44
+ console, which installs no screen-recording module.
45
+ - Sessions reported the wrong SDK version: `sdk_version` was a hard-coded
46
+ `@testerpaykit/expo/0.4.0` (the AI remote control even said `0.2.0`). The
47
+ version now comes from `package.json` at build time, so it can't drift.
48
+
49
+ ## 0.7.2 — 2026-09-22
50
+
51
+ Same content as 0.7.1, published correctly. **0.7.1 is unusable**: it was
52
+ pushed with `npm publish`, which leaves this workspace's `workspace:*`
53
+ dependency ranges untouched, so installing it fails with
54
+ `ERR_PNPM_WORKSPACE_PKG_NOT_FOUND`. `pnpm publish` rewrites those ranges to
55
+ real versions — that is the only correct way to publish from this monorepo.
56
+
57
+ ## 0.7.1 — 2026-09-22 (broken, do not use)
6
58
 
7
59
  **A backgrounded host app must never be asked for a bitmap.**
8
60
 
package/dist/index.d.mts CHANGED
@@ -2240,4 +2240,5 @@ declare function useTpkEarnings(tpk: TpkExpo | null, options?: {
2240
2240
  payoutLimit?: number;
2241
2241
  }): UseEarningsResult;
2242
2242
 
2243
- export { ANNOTATION_PALETTE, type AnnotatedElementInfo, type AnnotatedScreenshotResult, type AnnotationColor, type AnnotationEvent, type AnnotationEventType, type AnnotationInteraction, type AnnotationListener, type AnnotationShape, type AnnotationStyle, type AnnotationTool, type AppSnapshot, type ArrowShape, AttachmentQueue, type AttachmentQueueFlushOptions, type BlurShape, type Breadcrumb, Breadcrumbs, type BugFix, type BugReportDraft, BugReportSheet, type BugReportSheetProps, type BuildInfo, type CachedCrash, type CaptureViewOptions, type CircleShape, type CompletionTrigger, type CrashHandlerOptions, type CrashInfo, CrashQueue, type CreateBugReportDraftInput, DEFAULT_STYLE, DEFAULT_TPK_THEME, type DashboardData, type DeviceSnapshot, type DiscoverOptions, type EarningsData, type EngagedMinutesInput, ExpoStorage, type FeedbackCategory, FloatingFeedbackButton, type FloatingFeedbackButtonProps, type FlushTelemetryResult, type FocusArea, GeneralFeedbackDialog, type GeneralFeedbackDialogProps, INTERACTION_NAV_WEIGHT, type InstallNetworkCaptureOptions, type InteractionBounds, type InteractionType, InviteCodeScreen, type InviteCodeScreenProps, MIN_INTERACTIONS_PER_ACTIVE_MINUTE, MyBugsSheet, type MyBugsSheetProps, NotificationsSheet, type NotificationsSheetProps, ONBOARDING_DONE_STORAGE_KEY, type OnboardingStorage, type PathShape, type PeriodFilter, type Point, type QueueFlushOptions, type QueueFlushResult, type RecordInteractionDetails, type RecordingOptions, type RecordingResult, type RecordingState, type RectShape, type RegisterAnnotationInput, type ReleaseNote, SCREENSHOT_CONSENT_STORAGE_KEY, ScreenRecorder, ScreenshotAnnotationEditor, type ScreenshotAnnotationEditorProps, type ScreenshotResult, type SensitiveMaskingMode, SessionDetailsSheet, type SessionDetailsSheetProps, SessionEndDialog, type SessionEndDialogProps, type SessionEndStats, type SessionStatsSnapshot, type StatusStyle, type SubmitBugInput, SubmitQueue, type TaskAnnotation, TaskAnnotationRegistry, type TaskInteractionSummary, type TaskProgress, TesterDashboard, type TesterDashboardProps, type TesterPayKitContextValue, TesterPayKitProvider, type TesterPayKitProviderProps, TesterPayKitWrapper, type TesterPayKitWrapperProps, type TextShape, TpkAnnotated, type TpkAnnotatedProps, TpkAnnotationOverlay, type TpkAnnotationOverlayHandle, type TpkAnnotationOverlayProps, TpkExpo, type TpkExpoConfig, TpkIcon, type TpkIconName, type TpkIconOverrideMap, type TpkIconProps, TpkIconsProvider, type TpkLogEntry, type TpkLogLevel, TpkOnboarding, type TpkOnboardingProps, TpkSensitive, type TpkSensitiveProps, type TpkStorage, TpkTalker, type TpkTalkerListener, type TpkTalkerOptions, type TpkTheme, TpkThemeProvider, TpkWelcomeSheet, type TpkWelcomeSheetProps, type UseDashboardResult, type UseEarningsResult, type UseShakeOptions, type UseTaskAnnotationOptions, type UseTaskAnnotationResult, type VersionRange, VoiceBugInputSheet, type VoiceBugInputSheetProps, type VoiceBugStrings, type VoiceClassification, type VoiceExtractAudio, type VoiceExtractResult, type VoiceNoteFileReader, VoiceNoteRecorder, type VoiceNoteRecorderLike, type VoiceNoteRecorderOptions, type VoiceNoteResult, type VoiceNoteState, WELCOME_ACK_STORAGE_KEY, WIDGET_TOUR_SEEN_STORAGE_KEY, type WelcomeAckStorage, type WelcomeBrief, type WelcomeTask, WidgetDiscovery, type WidgetInfo, WidgetTour, type WidgetTourProps, annotations, applySensitiveRedaction, arrowHeadPoints, beginNativeCapture, bugSeverityLabel, bugStatusStyle, canSubmitBugReportDraft, captureView, classificationToBugType, createBugReportDraft, deriveTaskProgress, emptyAnnotationDoc, endNativeCapture, engagedMinutes, extractVoiceBug, findAssignmentForTask, getAppSnapshot, getDeviceSnapshot, getEventCounts, getNativeCaptureMode, getSessionStats, getUniqueScreens, hasCompletedOnboarding, hasScreenshotConsent, hasSeenWidgetTour, hasWelcomeBriefBeenSeen, installCrashHandler, installNetworkCapture, markOnboardingComplete, markWelcomeBriefAsSeen, markWidgetTourSeen, mockBugFixes, mockBuildInfo, mockFocusAreas, mockWelcomeBrief, mockWelcomeTasks, mockWidgets, parseVersionRange, pathToSvgD, resetOnboardingState, resetWelcomeBriefAck, resetWidgetTourSeen, simplifyPath, submitBugReportDraft, subscribeNativeCaptureMode, uploadScreenshotAttachment, useShake, useTaskAnnotation, useTesterPayKit, useTpkDashboard, useTpkEarnings, useTpkTheme, versionSatisfies, widgetDiscovery, withNativeCapture };
2243
+ export { ANNOTATION_PALETTE, AttachmentQueue, Breadcrumbs, BugReportSheet, CrashQueue, DEFAULT_STYLE, DEFAULT_TPK_THEME, ExpoStorage, FloatingFeedbackButton, GeneralFeedbackDialog, INTERACTION_NAV_WEIGHT, InviteCodeScreen, MIN_INTERACTIONS_PER_ACTIVE_MINUTE, MyBugsSheet, NotificationsSheet, ONBOARDING_DONE_STORAGE_KEY, SCREENSHOT_CONSENT_STORAGE_KEY, ScreenRecorder, ScreenshotAnnotationEditor, SessionDetailsSheet, SessionEndDialog, SubmitQueue, TaskAnnotationRegistry, TesterDashboard, TesterPayKitProvider, TesterPayKitWrapper, TpkAnnotated, TpkAnnotationOverlay, TpkExpo, TpkIcon, TpkIconsProvider, TpkOnboarding, TpkSensitive, TpkTalker, TpkThemeProvider, TpkWelcomeSheet, VoiceBugInputSheet, VoiceNoteRecorder, WELCOME_ACK_STORAGE_KEY, WIDGET_TOUR_SEEN_STORAGE_KEY, WidgetDiscovery, WidgetTour, annotations, applySensitiveRedaction, arrowHeadPoints, beginNativeCapture, bugSeverityLabel, bugStatusStyle, canSubmitBugReportDraft, captureView, classificationToBugType, createBugReportDraft, deriveTaskProgress, emptyAnnotationDoc, endNativeCapture, engagedMinutes, extractVoiceBug, findAssignmentForTask, getAppSnapshot, getDeviceSnapshot, getEventCounts, getNativeCaptureMode, getSessionStats, getUniqueScreens, hasCompletedOnboarding, hasScreenshotConsent, hasSeenWidgetTour, hasWelcomeBriefBeenSeen, installCrashHandler, installNetworkCapture, markOnboardingComplete, markWelcomeBriefAsSeen, markWidgetTourSeen, mockBugFixes, mockBuildInfo, mockFocusAreas, mockWelcomeBrief, mockWelcomeTasks, mockWidgets, parseVersionRange, pathToSvgD, resetOnboardingState, resetWelcomeBriefAck, resetWidgetTourSeen, simplifyPath, submitBugReportDraft, subscribeNativeCaptureMode, uploadScreenshotAttachment, useShake, useTaskAnnotation, useTesterPayKit, useTpkDashboard, useTpkEarnings, useTpkTheme, versionSatisfies, widgetDiscovery, withNativeCapture };
2244
+ export type { AnnotatedElementInfo, AnnotatedScreenshotResult, AnnotationColor, AnnotationEvent, AnnotationEventType, AnnotationInteraction, AnnotationListener, AnnotationShape, AnnotationStyle, AnnotationTool, AppSnapshot, ArrowShape, AttachmentQueueFlushOptions, BlurShape, Breadcrumb, BugFix, BugReportDraft, BugReportSheetProps, BuildInfo, CachedCrash, CaptureViewOptions, CircleShape, CompletionTrigger, CrashHandlerOptions, CrashInfo, CreateBugReportDraftInput, DashboardData, DeviceSnapshot, DiscoverOptions, EarningsData, EngagedMinutesInput, FeedbackCategory, FloatingFeedbackButtonProps, FlushTelemetryResult, FocusArea, GeneralFeedbackDialogProps, InstallNetworkCaptureOptions, InteractionBounds, InteractionType, InviteCodeScreenProps, MyBugsSheetProps, NotificationsSheetProps, OnboardingStorage, PathShape, PeriodFilter, Point, QueueFlushOptions, QueueFlushResult, RecordInteractionDetails, RecordingOptions, RecordingResult, RecordingState, RectShape, RegisterAnnotationInput, ReleaseNote, ScreenshotAnnotationEditorProps, ScreenshotResult, SensitiveMaskingMode, SessionDetailsSheetProps, SessionEndDialogProps, SessionEndStats, SessionStatsSnapshot, StatusStyle, SubmitBugInput, TaskAnnotation, TaskInteractionSummary, TaskProgress, TesterDashboardProps, TesterPayKitContextValue, TesterPayKitProviderProps, TesterPayKitWrapperProps, TextShape, TpkAnnotatedProps, TpkAnnotationOverlayHandle, TpkAnnotationOverlayProps, TpkExpoConfig, TpkIconName, TpkIconOverrideMap, TpkIconProps, TpkLogEntry, TpkLogLevel, TpkOnboardingProps, TpkSensitiveProps, TpkStorage, TpkTalkerListener, TpkTalkerOptions, TpkTheme, TpkWelcomeSheetProps, UseDashboardResult, UseEarningsResult, UseShakeOptions, UseTaskAnnotationOptions, UseTaskAnnotationResult, VersionRange, VoiceBugInputSheetProps, VoiceBugStrings, VoiceClassification, VoiceExtractAudio, VoiceExtractResult, VoiceNoteFileReader, VoiceNoteRecorderLike, VoiceNoteRecorderOptions, VoiceNoteResult, VoiceNoteState, WelcomeAckStorage, WelcomeBrief, WelcomeTask, WidgetInfo, WidgetTourProps };
package/dist/index.d.ts CHANGED
@@ -2240,4 +2240,5 @@ declare function useTpkEarnings(tpk: TpkExpo | null, options?: {
2240
2240
  payoutLimit?: number;
2241
2241
  }): UseEarningsResult;
2242
2242
 
2243
- export { ANNOTATION_PALETTE, type AnnotatedElementInfo, type AnnotatedScreenshotResult, type AnnotationColor, type AnnotationEvent, type AnnotationEventType, type AnnotationInteraction, type AnnotationListener, type AnnotationShape, type AnnotationStyle, type AnnotationTool, type AppSnapshot, type ArrowShape, AttachmentQueue, type AttachmentQueueFlushOptions, type BlurShape, type Breadcrumb, Breadcrumbs, type BugFix, type BugReportDraft, BugReportSheet, type BugReportSheetProps, type BuildInfo, type CachedCrash, type CaptureViewOptions, type CircleShape, type CompletionTrigger, type CrashHandlerOptions, type CrashInfo, CrashQueue, type CreateBugReportDraftInput, DEFAULT_STYLE, DEFAULT_TPK_THEME, type DashboardData, type DeviceSnapshot, type DiscoverOptions, type EarningsData, type EngagedMinutesInput, ExpoStorage, type FeedbackCategory, FloatingFeedbackButton, type FloatingFeedbackButtonProps, type FlushTelemetryResult, type FocusArea, GeneralFeedbackDialog, type GeneralFeedbackDialogProps, INTERACTION_NAV_WEIGHT, type InstallNetworkCaptureOptions, type InteractionBounds, type InteractionType, InviteCodeScreen, type InviteCodeScreenProps, MIN_INTERACTIONS_PER_ACTIVE_MINUTE, MyBugsSheet, type MyBugsSheetProps, NotificationsSheet, type NotificationsSheetProps, ONBOARDING_DONE_STORAGE_KEY, type OnboardingStorage, type PathShape, type PeriodFilter, type Point, type QueueFlushOptions, type QueueFlushResult, type RecordInteractionDetails, type RecordingOptions, type RecordingResult, type RecordingState, type RectShape, type RegisterAnnotationInput, type ReleaseNote, SCREENSHOT_CONSENT_STORAGE_KEY, ScreenRecorder, ScreenshotAnnotationEditor, type ScreenshotAnnotationEditorProps, type ScreenshotResult, type SensitiveMaskingMode, SessionDetailsSheet, type SessionDetailsSheetProps, SessionEndDialog, type SessionEndDialogProps, type SessionEndStats, type SessionStatsSnapshot, type StatusStyle, type SubmitBugInput, SubmitQueue, type TaskAnnotation, TaskAnnotationRegistry, type TaskInteractionSummary, type TaskProgress, TesterDashboard, type TesterDashboardProps, type TesterPayKitContextValue, TesterPayKitProvider, type TesterPayKitProviderProps, TesterPayKitWrapper, type TesterPayKitWrapperProps, type TextShape, TpkAnnotated, type TpkAnnotatedProps, TpkAnnotationOverlay, type TpkAnnotationOverlayHandle, type TpkAnnotationOverlayProps, TpkExpo, type TpkExpoConfig, TpkIcon, type TpkIconName, type TpkIconOverrideMap, type TpkIconProps, TpkIconsProvider, type TpkLogEntry, type TpkLogLevel, TpkOnboarding, type TpkOnboardingProps, TpkSensitive, type TpkSensitiveProps, type TpkStorage, TpkTalker, type TpkTalkerListener, type TpkTalkerOptions, type TpkTheme, TpkThemeProvider, TpkWelcomeSheet, type TpkWelcomeSheetProps, type UseDashboardResult, type UseEarningsResult, type UseShakeOptions, type UseTaskAnnotationOptions, type UseTaskAnnotationResult, type VersionRange, VoiceBugInputSheet, type VoiceBugInputSheetProps, type VoiceBugStrings, type VoiceClassification, type VoiceExtractAudio, type VoiceExtractResult, type VoiceNoteFileReader, VoiceNoteRecorder, type VoiceNoteRecorderLike, type VoiceNoteRecorderOptions, type VoiceNoteResult, type VoiceNoteState, WELCOME_ACK_STORAGE_KEY, WIDGET_TOUR_SEEN_STORAGE_KEY, type WelcomeAckStorage, type WelcomeBrief, type WelcomeTask, WidgetDiscovery, type WidgetInfo, WidgetTour, type WidgetTourProps, annotations, applySensitiveRedaction, arrowHeadPoints, beginNativeCapture, bugSeverityLabel, bugStatusStyle, canSubmitBugReportDraft, captureView, classificationToBugType, createBugReportDraft, deriveTaskProgress, emptyAnnotationDoc, endNativeCapture, engagedMinutes, extractVoiceBug, findAssignmentForTask, getAppSnapshot, getDeviceSnapshot, getEventCounts, getNativeCaptureMode, getSessionStats, getUniqueScreens, hasCompletedOnboarding, hasScreenshotConsent, hasSeenWidgetTour, hasWelcomeBriefBeenSeen, installCrashHandler, installNetworkCapture, markOnboardingComplete, markWelcomeBriefAsSeen, markWidgetTourSeen, mockBugFixes, mockBuildInfo, mockFocusAreas, mockWelcomeBrief, mockWelcomeTasks, mockWidgets, parseVersionRange, pathToSvgD, resetOnboardingState, resetWelcomeBriefAck, resetWidgetTourSeen, simplifyPath, submitBugReportDraft, subscribeNativeCaptureMode, uploadScreenshotAttachment, useShake, useTaskAnnotation, useTesterPayKit, useTpkDashboard, useTpkEarnings, useTpkTheme, versionSatisfies, widgetDiscovery, withNativeCapture };
2243
+ export { ANNOTATION_PALETTE, AttachmentQueue, Breadcrumbs, BugReportSheet, CrashQueue, DEFAULT_STYLE, DEFAULT_TPK_THEME, ExpoStorage, FloatingFeedbackButton, GeneralFeedbackDialog, INTERACTION_NAV_WEIGHT, InviteCodeScreen, MIN_INTERACTIONS_PER_ACTIVE_MINUTE, MyBugsSheet, NotificationsSheet, ONBOARDING_DONE_STORAGE_KEY, SCREENSHOT_CONSENT_STORAGE_KEY, ScreenRecorder, ScreenshotAnnotationEditor, SessionDetailsSheet, SessionEndDialog, SubmitQueue, TaskAnnotationRegistry, TesterDashboard, TesterPayKitProvider, TesterPayKitWrapper, TpkAnnotated, TpkAnnotationOverlay, TpkExpo, TpkIcon, TpkIconsProvider, TpkOnboarding, TpkSensitive, TpkTalker, TpkThemeProvider, TpkWelcomeSheet, VoiceBugInputSheet, VoiceNoteRecorder, WELCOME_ACK_STORAGE_KEY, WIDGET_TOUR_SEEN_STORAGE_KEY, WidgetDiscovery, WidgetTour, annotations, applySensitiveRedaction, arrowHeadPoints, beginNativeCapture, bugSeverityLabel, bugStatusStyle, canSubmitBugReportDraft, captureView, classificationToBugType, createBugReportDraft, deriveTaskProgress, emptyAnnotationDoc, endNativeCapture, engagedMinutes, extractVoiceBug, findAssignmentForTask, getAppSnapshot, getDeviceSnapshot, getEventCounts, getNativeCaptureMode, getSessionStats, getUniqueScreens, hasCompletedOnboarding, hasScreenshotConsent, hasSeenWidgetTour, hasWelcomeBriefBeenSeen, installCrashHandler, installNetworkCapture, markOnboardingComplete, markWelcomeBriefAsSeen, markWidgetTourSeen, mockBugFixes, mockBuildInfo, mockFocusAreas, mockWelcomeBrief, mockWelcomeTasks, mockWidgets, parseVersionRange, pathToSvgD, resetOnboardingState, resetWelcomeBriefAck, resetWidgetTourSeen, simplifyPath, submitBugReportDraft, subscribeNativeCaptureMode, uploadScreenshotAttachment, useShake, useTaskAnnotation, useTesterPayKit, useTpkDashboard, useTpkEarnings, useTpkTheme, versionSatisfies, widgetDiscovery, withNativeCapture };
2244
+ export type { AnnotatedElementInfo, AnnotatedScreenshotResult, AnnotationColor, AnnotationEvent, AnnotationEventType, AnnotationInteraction, AnnotationListener, AnnotationShape, AnnotationStyle, AnnotationTool, AppSnapshot, ArrowShape, AttachmentQueueFlushOptions, BlurShape, Breadcrumb, BugFix, BugReportDraft, BugReportSheetProps, BuildInfo, CachedCrash, CaptureViewOptions, CircleShape, CompletionTrigger, CrashHandlerOptions, CrashInfo, CreateBugReportDraftInput, DashboardData, DeviceSnapshot, DiscoverOptions, EarningsData, EngagedMinutesInput, FeedbackCategory, FloatingFeedbackButtonProps, FlushTelemetryResult, FocusArea, GeneralFeedbackDialogProps, InstallNetworkCaptureOptions, InteractionBounds, InteractionType, InviteCodeScreenProps, MyBugsSheetProps, NotificationsSheetProps, OnboardingStorage, PathShape, PeriodFilter, Point, QueueFlushOptions, QueueFlushResult, RecordInteractionDetails, RecordingOptions, RecordingResult, RecordingState, RectShape, RegisterAnnotationInput, ReleaseNote, ScreenshotAnnotationEditorProps, ScreenshotResult, SensitiveMaskingMode, SessionDetailsSheetProps, SessionEndDialogProps, SessionEndStats, SessionStatsSnapshot, StatusStyle, SubmitBugInput, TaskAnnotation, TaskInteractionSummary, TaskProgress, TesterDashboardProps, TesterPayKitContextValue, TesterPayKitProviderProps, TesterPayKitWrapperProps, TextShape, TpkAnnotatedProps, TpkAnnotationOverlayHandle, TpkAnnotationOverlayProps, TpkExpoConfig, TpkIconName, TpkIconOverrideMap, TpkIconProps, TpkLogEntry, TpkLogLevel, TpkOnboardingProps, TpkSensitiveProps, TpkStorage, TpkTalkerListener, TpkTalkerOptions, TpkTheme, TpkWelcomeSheetProps, UseDashboardResult, UseEarningsResult, UseShakeOptions, UseTaskAnnotationOptions, UseTaskAnnotationResult, VersionRange, VoiceBugInputSheetProps, VoiceBugStrings, VoiceClassification, VoiceExtractAudio, VoiceExtractResult, VoiceNoteFileReader, VoiceNoteRecorderLike, VoiceNoteRecorderOptions, VoiceNoteResult, VoiceNoteState, WelcomeAckStorage, WelcomeBrief, WelcomeTask, WidgetInfo, WidgetTourProps };
package/dist/index.js CHANGED
@@ -5,8 +5,13 @@ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
5
  var __getOwnPropNames = Object.getOwnPropertyNames;
6
6
  var __getProtoOf = Object.getPrototypeOf;
7
7
  var __hasOwnProp = Object.prototype.hasOwnProperty;
8
- var __esm = (fn, res) => function __init() {
9
- return fn && (res = (0, fn[__getOwnPropNames(fn)[0]])(fn = 0)), res;
8
+ var __esm = (fn, res, err) => function __init() {
9
+ if (err) throw err[0];
10
+ try {
11
+ return fn && (res = (0, fn[__getOwnPropNames(fn)[0]])(fn = 0)), res;
12
+ } catch (e) {
13
+ throw err = [e], e;
14
+ }
10
15
  };
11
16
  var __export = (target, all) => {
12
17
  for (var name in all)
@@ -205,44 +210,93 @@ __export(index_exports, {
205
210
  module.exports = __toCommonJS(index_exports);
206
211
 
207
212
  // src/setup-check.ts
213
+ var MISSING = /* @__PURE__ */ Symbol("missing");
208
214
  var PROBES = [
209
215
  {
210
- probe: () => import("react-native-view-shot"),
216
+ probe: async () => {
217
+ try {
218
+ return await import("react-native-view-shot");
219
+ } catch {
220
+ return MISSING;
221
+ }
222
+ },
211
223
  module: "react-native-view-shot",
212
224
  feature: "automatic screenshots on bug reports"
213
225
  },
214
226
  {
215
- probe: () => import("react-native-record-screen"),
227
+ probe: async () => {
228
+ try {
229
+ return await import("react-native-record-screen");
230
+ } catch {
231
+ return MISSING;
232
+ }
233
+ },
216
234
  module: "react-native-record-screen",
217
235
  feature: "screen recording attachments"
218
236
  },
219
237
  {
220
- probe: () => import("@shopify/react-native-skia"),
238
+ probe: async () => {
239
+ try {
240
+ return await import("@shopify/react-native-skia");
241
+ } catch {
242
+ return MISSING;
243
+ }
244
+ },
221
245
  module: "@shopify/react-native-skia",
222
246
  feature: "screenshot annotation editor"
223
247
  },
224
248
  {
225
- probe: () => import("react-native-draggable-flatlist"),
249
+ probe: async () => {
250
+ try {
251
+ return await import("react-native-draggable-flatlist");
252
+ } catch {
253
+ return MISSING;
254
+ }
255
+ },
226
256
  module: "react-native-draggable-flatlist",
227
257
  feature: "annotation layer reordering"
228
258
  },
229
259
  {
230
- probe: () => import("expo-audio"),
260
+ probe: async () => {
261
+ try {
262
+ return await import("expo-audio");
263
+ } catch {
264
+ return MISSING;
265
+ }
266
+ },
231
267
  module: "expo-audio",
232
268
  feature: "voice bug reports (recording)"
233
269
  },
234
270
  {
235
- probe: () => import("expo-file-system"),
271
+ probe: async () => {
272
+ try {
273
+ return await import("expo-file-system");
274
+ } catch {
275
+ return MISSING;
276
+ }
277
+ },
236
278
  module: "expo-file-system",
237
279
  feature: "voice note / recording upload"
238
280
  },
239
281
  {
240
- probe: () => import("expo-sensors"),
282
+ probe: async () => {
283
+ try {
284
+ return await import("expo-sensors");
285
+ } catch {
286
+ return MISSING;
287
+ }
288
+ },
241
289
  module: "expo-sensors",
242
290
  feature: "shake-to-report"
243
291
  },
244
292
  {
245
- probe: () => import("expo-device"),
293
+ probe: async () => {
294
+ try {
295
+ return await import("expo-device");
296
+ } catch {
297
+ return MISSING;
298
+ }
299
+ },
246
300
  module: "expo-device",
247
301
  feature: "device metadata on reports"
248
302
  }
@@ -255,11 +309,7 @@ function runSetupCheck() {
255
309
  void (async () => {
256
310
  const missing = [];
257
311
  for (const entry of PROBES) {
258
- try {
259
- await entry.probe();
260
- } catch {
261
- missing.push(entry);
262
- }
312
+ if (await entry.probe() === MISSING) missing.push(entry);
263
313
  }
264
314
  if (missing.length === 0) return;
265
315
  const lines = missing.map((m) => ` - ${m.module} \u2192 ${m.feature} is OFF`).join("\n");
@@ -1092,11 +1142,17 @@ function findAssignmentForTask(tasks, key) {
1092
1142
  return tasks.find((t) => t.taskPresetId === key || t.assignmentId === key) ?? null;
1093
1143
  }
1094
1144
 
1145
+ // package.json
1146
+ var version = "0.7.3";
1147
+
1148
+ // src/version.ts
1149
+ var SDK_VERSION = `@testerpaykit/expo/${version}`;
1150
+
1095
1151
  // src/client.ts
1096
1152
  var STORAGE_KEY_AUTH = "auth";
1097
1153
  var STORAGE_KEY_SESSION = "session";
1098
- var SDK_VERSION = "@testerpaykit/expo/0.4.0";
1099
1154
  var SESSION_TTL_MS = 12 * 60 * 60 * 1e3;
1155
+ var SESSION_WAIT_MS = 3e3;
1100
1156
  var TpkExpo = class _TpkExpo {
1101
1157
  constructor(config, api, storage, breadcrumbs, queue, attachmentQueue, crashQueue, ready, uninstallCrashHandler, uninstallNetworkCapture = null) {
1102
1158
  this.config = config;
@@ -1144,10 +1200,22 @@ var TpkExpo = class _TpkExpo {
1144
1200
  const queue = new SubmitQueue(storage);
1145
1201
  const attachmentQueue = new AttachmentQueue(storage);
1146
1202
  const crashQueue = new CrashQueue(storage);
1147
- const cached2 = await storage.get(STORAGE_KEY_AUTH);
1203
+ let cached2 = await storage.get(STORAGE_KEY_AUTH);
1204
+ if (cached2 && tokenExpiresSoon(cached2.accessToken)) {
1205
+ await discardAuth(storage);
1206
+ cached2 = null;
1207
+ }
1148
1208
  let tester;
1149
1209
  let authReady;
1150
1210
  let hasCachedAuth = false;
1211
+ const acquireFreshAuth = async () => {
1212
+ try {
1213
+ const fresh = await api.loginAnonymous(config.projectId, config.testerCode);
1214
+ await storage.set(STORAGE_KEY_AUTH, fresh);
1215
+ tester = fresh.tester;
1216
+ } catch {
1217
+ }
1218
+ };
1151
1219
  if (cached2 && cached2.tester.projectId === config.projectId && cached2.tester.code.toUpperCase() === config.testerCode.toUpperCase()) {
1152
1220
  api.setAccessToken(cached2.accessToken);
1153
1221
  tester = cached2.tester;
@@ -1155,35 +1223,37 @@ var TpkExpo = class _TpkExpo {
1155
1223
  authReady = Promise.resolve();
1156
1224
  } else {
1157
1225
  tester = { id: "", projectId: config.projectId, code: config.testerCode };
1158
- authReady = (async () => {
1159
- try {
1160
- const fresh = await api.loginAnonymous(config.projectId, config.testerCode);
1161
- await storage.set(STORAGE_KEY_AUTH, fresh);
1162
- tester = fresh.tester;
1163
- } catch {
1164
- }
1165
- })();
1226
+ authReady = acquireFreshAuth();
1166
1227
  }
1167
- let sessionId;
1228
+ let sessionId = "";
1168
1229
  let sessionReady;
1230
+ const startSessionLater = () => authReady.then(async () => {
1231
+ try {
1232
+ const sid = await startServerSession(api, tester.projectId);
1233
+ sessionId = sid;
1234
+ await persistSession(storage, sid, config.projectId, config.testerCode);
1235
+ } catch {
1236
+ }
1237
+ });
1169
1238
  const persisted = await loadPersistedSession(storage, config.projectId, config.testerCode);
1170
1239
  if (persisted) {
1171
1240
  sessionId = persisted;
1172
1241
  sessionReady = Promise.resolve();
1173
1242
  } else if (hasCachedAuth) {
1174
- sessionId = await startServerSession(api, tester.projectId);
1175
- await persistSession(storage, sessionId, config.projectId, config.testerCode);
1176
- sessionReady = Promise.resolve();
1177
- } else {
1178
- sessionId = "";
1179
- sessionReady = authReady.then(async () => {
1180
- try {
1181
- const sid = await startServerSession(api, tester.projectId);
1182
- sessionId = sid;
1183
- await persistSession(storage, sid, config.projectId, config.testerCode);
1184
- } catch {
1243
+ try {
1244
+ sessionId = await startServerSession(api, tester.projectId);
1245
+ await persistSession(storage, sessionId, config.projectId, config.testerCode);
1246
+ sessionReady = Promise.resolve();
1247
+ } catch (error) {
1248
+ if (isUnauthorized(error)) {
1249
+ await discardAuth(storage);
1250
+ tester = { id: "", projectId: config.projectId, code: config.testerCode };
1251
+ authReady = acquireFreshAuth();
1185
1252
  }
1186
- });
1253
+ sessionReady = startSessionLater();
1254
+ }
1255
+ } else {
1256
+ sessionReady = startSessionLater();
1187
1257
  }
1188
1258
  const ready = Promise.all([authReady, sessionReady]).then(() => {
1189
1259
  });
@@ -1433,7 +1503,13 @@ var TpkExpo = class _TpkExpo {
1433
1503
  /** Flush the offline retry queue immediately. */
1434
1504
  async flushQueue() {
1435
1505
  return this.queue.flush({
1436
- submit: (payload, options) => this.api.submitBugReport(payload, options)
1506
+ submit: (payload, options) => {
1507
+ if (!payload.sessionId) {
1508
+ if (!this.sessionId) return Promise.reject(new Error("no session yet"));
1509
+ payload = { ...payload, sessionId: this.sessionId };
1510
+ }
1511
+ return this.api.submitBugReport(payload, options);
1512
+ }
1437
1513
  });
1438
1514
  }
1439
1515
  /**
@@ -1608,6 +1684,12 @@ var TpkExpo = class _TpkExpo {
1608
1684
  }
1609
1685
  /** Build a bug-report payload — exposed so tests can introspect. */
1610
1686
  async buildPayload(input) {
1687
+ if (!this.sessionId) {
1688
+ await Promise.race([
1689
+ this._ready,
1690
+ new Promise((resolve) => setTimeout(resolve, SESSION_WAIT_MS))
1691
+ ]);
1692
+ }
1611
1693
  const [device, app] = await Promise.all([
1612
1694
  getDeviceSnapshot(),
1613
1695
  getAppSnapshot()
@@ -1692,6 +1774,25 @@ function toSessionBreadcrumb(crumb) {
1692
1774
  timestamp: crumb.t
1693
1775
  };
1694
1776
  }
1777
+ var TOKEN_EXPIRY_MARGIN_MS = 24 * 60 * 60 * 1e3;
1778
+ function tokenExpiresSoon(token) {
1779
+ const part = token?.split(".")[1];
1780
+ if (!part || typeof atob !== "function") return false;
1781
+ try {
1782
+ const b64 = part.replace(/-/g, "+").replace(/_/g, "/").padEnd(Math.ceil(part.length / 4) * 4, "=");
1783
+ const { exp } = JSON.parse(atob(b64));
1784
+ return typeof exp === "number" && exp * 1e3 < Date.now() + TOKEN_EXPIRY_MARGIN_MS;
1785
+ } catch {
1786
+ return false;
1787
+ }
1788
+ }
1789
+ function isUnauthorized(error) {
1790
+ return error?.response?.status === 401;
1791
+ }
1792
+ async function discardAuth(storage) {
1793
+ await storage.remove(STORAGE_KEY_AUTH);
1794
+ await storage.remove(STORAGE_KEY_SESSION);
1795
+ }
1695
1796
  async function startServerSession(api, projectId) {
1696
1797
  const [deviceSnapshot, appSnapshot] = await Promise.all([
1697
1798
  getDeviceSnapshot(),
@@ -5680,43 +5781,43 @@ function parseVersionRange(constraint) {
5680
5781
  }
5681
5782
  return { min, max, constraint };
5682
5783
  }
5683
- function versionSatisfies(range, version) {
5784
+ function versionSatisfies(range, version2) {
5684
5785
  try {
5685
5786
  if (range.exact !== void 0) {
5686
- return compareVersions(version, range.exact) === 0;
5787
+ return compareVersions(version2, range.exact) === 0;
5687
5788
  }
5688
- if (range.min !== void 0 && compareVersions(version, range.min) < 0) {
5789
+ if (range.min !== void 0 && compareVersions(version2, range.min) < 0) {
5689
5790
  return false;
5690
5791
  }
5691
- if (range.max !== void 0 && compareVersions(version, range.max) >= 0) {
5792
+ if (range.max !== void 0 && compareVersions(version2, range.max) >= 0) {
5692
5793
  return false;
5693
5794
  }
5694
5795
  if (range.constraint?.startsWith("^")) {
5695
5796
  const base = range.constraint.slice(1).trim();
5696
5797
  const baseParts = parseVersionParts(base);
5697
- const versionParts = parseVersionParts(version);
5798
+ const versionParts = parseVersionParts(version2);
5698
5799
  if (!baseParts.length || !versionParts.length) return false;
5699
5800
  if (versionParts[0] !== baseParts[0]) return false;
5700
- return compareVersions(version, base) >= 0;
5801
+ return compareVersions(version2, base) >= 0;
5701
5802
  }
5702
5803
  if (range.constraint?.startsWith("~")) {
5703
5804
  const base = range.constraint.slice(1).trim();
5704
5805
  const baseParts = parseVersionParts(base);
5705
- const versionParts = parseVersionParts(version);
5806
+ const versionParts = parseVersionParts(version2);
5706
5807
  if (baseParts.length < 2 || versionParts.length < 2) return false;
5707
5808
  if (versionParts[0] !== baseParts[0] || versionParts[1] !== baseParts[1]) {
5708
5809
  return false;
5709
5810
  }
5710
- return compareVersions(version, base) >= 0;
5811
+ return compareVersions(version2, base) >= 0;
5711
5812
  }
5712
5813
  return true;
5713
5814
  } catch {
5714
5815
  return false;
5715
5816
  }
5716
5817
  }
5717
- function parseVersionParts(version) {
5818
+ function parseVersionParts(version2) {
5718
5819
  try {
5719
- return version.split(".").map((seg) => {
5820
+ return version2.split(".").map((seg) => {
5720
5821
  const clean = seg.split("-")[0].split("+")[0];
5721
5822
  const n = Number.parseInt(clean, 10);
5722
5823
  return Number.isFinite(n) ? n : 0;
@@ -7683,7 +7784,7 @@ function VoiceBugInputSheet({
7683
7784
  }
7684
7785
  meterAnim.setValue(0);
7685
7786
  setPhase("uploading");
7686
- let audio = null;
7787
+ let audio;
7687
7788
  try {
7688
7789
  audio = await stopRecording(recorderRef.current);
7689
7790
  } catch (e) {
@@ -9653,7 +9754,6 @@ var import_react_native23 = require("react-native");
9653
9754
  var import_react22 = __toESM(require("react"));
9654
9755
  var import_react_native22 = require("react-native");
9655
9756
  var import_ai_tester = require("@testerpaykit/ai-tester");
9656
- var SDK_VERSION2 = "@testerpaykit/expo/0.2.0";
9657
9757
  var PLATFORM = typeof document !== "undefined" ? "expo-web" : "expo-native";
9658
9758
  function AiRemoteControl({
9659
9759
  visible,
@@ -9779,7 +9879,7 @@ function AiRemoteControl({
9779
9879
  JSON.stringify({
9780
9880
  type: "hello",
9781
9881
  platform: PLATFORM,
9782
- tpkVersion: SDK_VERSION2
9882
+ tpkVersion: SDK_VERSION
9783
9883
  })
9784
9884
  );
9785
9885
  setStatus("running");
package/dist/index.mjs CHANGED
@@ -3,44 +3,93 @@ import {
3
3
  } from "./chunk-AGHDTD54.mjs";
4
4
 
5
5
  // src/setup-check.ts
6
+ var MISSING = /* @__PURE__ */ Symbol("missing");
6
7
  var PROBES = [
7
8
  {
8
- probe: () => import("react-native-view-shot"),
9
+ probe: async () => {
10
+ try {
11
+ return await import("react-native-view-shot");
12
+ } catch {
13
+ return MISSING;
14
+ }
15
+ },
9
16
  module: "react-native-view-shot",
10
17
  feature: "automatic screenshots on bug reports"
11
18
  },
12
19
  {
13
- probe: () => import("react-native-record-screen"),
20
+ probe: async () => {
21
+ try {
22
+ return await import("react-native-record-screen");
23
+ } catch {
24
+ return MISSING;
25
+ }
26
+ },
14
27
  module: "react-native-record-screen",
15
28
  feature: "screen recording attachments"
16
29
  },
17
30
  {
18
- probe: () => import("@shopify/react-native-skia"),
31
+ probe: async () => {
32
+ try {
33
+ return await import("@shopify/react-native-skia");
34
+ } catch {
35
+ return MISSING;
36
+ }
37
+ },
19
38
  module: "@shopify/react-native-skia",
20
39
  feature: "screenshot annotation editor"
21
40
  },
22
41
  {
23
- probe: () => import("react-native-draggable-flatlist"),
42
+ probe: async () => {
43
+ try {
44
+ return await import("react-native-draggable-flatlist");
45
+ } catch {
46
+ return MISSING;
47
+ }
48
+ },
24
49
  module: "react-native-draggable-flatlist",
25
50
  feature: "annotation layer reordering"
26
51
  },
27
52
  {
28
- probe: () => import("expo-audio"),
53
+ probe: async () => {
54
+ try {
55
+ return await import("expo-audio");
56
+ } catch {
57
+ return MISSING;
58
+ }
59
+ },
29
60
  module: "expo-audio",
30
61
  feature: "voice bug reports (recording)"
31
62
  },
32
63
  {
33
- probe: () => import("expo-file-system"),
64
+ probe: async () => {
65
+ try {
66
+ return await import("expo-file-system");
67
+ } catch {
68
+ return MISSING;
69
+ }
70
+ },
34
71
  module: "expo-file-system",
35
72
  feature: "voice note / recording upload"
36
73
  },
37
74
  {
38
- probe: () => import("expo-sensors"),
75
+ probe: async () => {
76
+ try {
77
+ return await import("expo-sensors");
78
+ } catch {
79
+ return MISSING;
80
+ }
81
+ },
39
82
  module: "expo-sensors",
40
83
  feature: "shake-to-report"
41
84
  },
42
85
  {
43
- probe: () => import("expo-device"),
86
+ probe: async () => {
87
+ try {
88
+ return await import("expo-device");
89
+ } catch {
90
+ return MISSING;
91
+ }
92
+ },
44
93
  module: "expo-device",
45
94
  feature: "device metadata on reports"
46
95
  }
@@ -53,11 +102,7 @@ function runSetupCheck() {
53
102
  void (async () => {
54
103
  const missing = [];
55
104
  for (const entry of PROBES) {
56
- try {
57
- await entry.probe();
58
- } catch {
59
- missing.push(entry);
60
- }
105
+ if (await entry.probe() === MISSING) missing.push(entry);
61
106
  }
62
107
  if (missing.length === 0) return;
63
108
  const lines = missing.map((m) => ` - ${m.module} \u2192 ${m.feature} is OFF`).join("\n");
@@ -892,11 +937,17 @@ function findAssignmentForTask(tasks, key) {
892
937
  return tasks.find((t) => t.taskPresetId === key || t.assignmentId === key) ?? null;
893
938
  }
894
939
 
940
+ // package.json
941
+ var version = "0.7.3";
942
+
943
+ // src/version.ts
944
+ var SDK_VERSION = `@testerpaykit/expo/${version}`;
945
+
895
946
  // src/client.ts
896
947
  var STORAGE_KEY_AUTH = "auth";
897
948
  var STORAGE_KEY_SESSION = "session";
898
- var SDK_VERSION = "@testerpaykit/expo/0.4.0";
899
949
  var SESSION_TTL_MS = 12 * 60 * 60 * 1e3;
950
+ var SESSION_WAIT_MS = 3e3;
900
951
  var TpkExpo = class _TpkExpo {
901
952
  constructor(config, api, storage, breadcrumbs, queue, attachmentQueue, crashQueue, ready, uninstallCrashHandler, uninstallNetworkCapture = null) {
902
953
  this.config = config;
@@ -944,10 +995,22 @@ var TpkExpo = class _TpkExpo {
944
995
  const queue = new SubmitQueue(storage);
945
996
  const attachmentQueue = new AttachmentQueue(storage);
946
997
  const crashQueue = new CrashQueue(storage);
947
- const cached2 = await storage.get(STORAGE_KEY_AUTH);
998
+ let cached2 = await storage.get(STORAGE_KEY_AUTH);
999
+ if (cached2 && tokenExpiresSoon(cached2.accessToken)) {
1000
+ await discardAuth(storage);
1001
+ cached2 = null;
1002
+ }
948
1003
  let tester;
949
1004
  let authReady;
950
1005
  let hasCachedAuth = false;
1006
+ const acquireFreshAuth = async () => {
1007
+ try {
1008
+ const fresh = await api.loginAnonymous(config.projectId, config.testerCode);
1009
+ await storage.set(STORAGE_KEY_AUTH, fresh);
1010
+ tester = fresh.tester;
1011
+ } catch {
1012
+ }
1013
+ };
951
1014
  if (cached2 && cached2.tester.projectId === config.projectId && cached2.tester.code.toUpperCase() === config.testerCode.toUpperCase()) {
952
1015
  api.setAccessToken(cached2.accessToken);
953
1016
  tester = cached2.tester;
@@ -955,35 +1018,37 @@ var TpkExpo = class _TpkExpo {
955
1018
  authReady = Promise.resolve();
956
1019
  } else {
957
1020
  tester = { id: "", projectId: config.projectId, code: config.testerCode };
958
- authReady = (async () => {
959
- try {
960
- const fresh = await api.loginAnonymous(config.projectId, config.testerCode);
961
- await storage.set(STORAGE_KEY_AUTH, fresh);
962
- tester = fresh.tester;
963
- } catch {
964
- }
965
- })();
1021
+ authReady = acquireFreshAuth();
966
1022
  }
967
- let sessionId;
1023
+ let sessionId = "";
968
1024
  let sessionReady;
1025
+ const startSessionLater = () => authReady.then(async () => {
1026
+ try {
1027
+ const sid = await startServerSession(api, tester.projectId);
1028
+ sessionId = sid;
1029
+ await persistSession(storage, sid, config.projectId, config.testerCode);
1030
+ } catch {
1031
+ }
1032
+ });
969
1033
  const persisted = await loadPersistedSession(storage, config.projectId, config.testerCode);
970
1034
  if (persisted) {
971
1035
  sessionId = persisted;
972
1036
  sessionReady = Promise.resolve();
973
1037
  } else if (hasCachedAuth) {
974
- sessionId = await startServerSession(api, tester.projectId);
975
- await persistSession(storage, sessionId, config.projectId, config.testerCode);
976
- sessionReady = Promise.resolve();
977
- } else {
978
- sessionId = "";
979
- sessionReady = authReady.then(async () => {
980
- try {
981
- const sid = await startServerSession(api, tester.projectId);
982
- sessionId = sid;
983
- await persistSession(storage, sid, config.projectId, config.testerCode);
984
- } catch {
1038
+ try {
1039
+ sessionId = await startServerSession(api, tester.projectId);
1040
+ await persistSession(storage, sessionId, config.projectId, config.testerCode);
1041
+ sessionReady = Promise.resolve();
1042
+ } catch (error) {
1043
+ if (isUnauthorized(error)) {
1044
+ await discardAuth(storage);
1045
+ tester = { id: "", projectId: config.projectId, code: config.testerCode };
1046
+ authReady = acquireFreshAuth();
985
1047
  }
986
- });
1048
+ sessionReady = startSessionLater();
1049
+ }
1050
+ } else {
1051
+ sessionReady = startSessionLater();
987
1052
  }
988
1053
  const ready = Promise.all([authReady, sessionReady]).then(() => {
989
1054
  });
@@ -1233,7 +1298,13 @@ var TpkExpo = class _TpkExpo {
1233
1298
  /** Flush the offline retry queue immediately. */
1234
1299
  async flushQueue() {
1235
1300
  return this.queue.flush({
1236
- submit: (payload, options) => this.api.submitBugReport(payload, options)
1301
+ submit: (payload, options) => {
1302
+ if (!payload.sessionId) {
1303
+ if (!this.sessionId) return Promise.reject(new Error("no session yet"));
1304
+ payload = { ...payload, sessionId: this.sessionId };
1305
+ }
1306
+ return this.api.submitBugReport(payload, options);
1307
+ }
1237
1308
  });
1238
1309
  }
1239
1310
  /**
@@ -1408,6 +1479,12 @@ var TpkExpo = class _TpkExpo {
1408
1479
  }
1409
1480
  /** Build a bug-report payload — exposed so tests can introspect. */
1410
1481
  async buildPayload(input) {
1482
+ if (!this.sessionId) {
1483
+ await Promise.race([
1484
+ this._ready,
1485
+ new Promise((resolve) => setTimeout(resolve, SESSION_WAIT_MS))
1486
+ ]);
1487
+ }
1411
1488
  const [device, app] = await Promise.all([
1412
1489
  getDeviceSnapshot(),
1413
1490
  getAppSnapshot()
@@ -1492,6 +1569,25 @@ function toSessionBreadcrumb(crumb) {
1492
1569
  timestamp: crumb.t
1493
1570
  };
1494
1571
  }
1572
+ var TOKEN_EXPIRY_MARGIN_MS = 24 * 60 * 60 * 1e3;
1573
+ function tokenExpiresSoon(token) {
1574
+ const part = token?.split(".")[1];
1575
+ if (!part || typeof atob !== "function") return false;
1576
+ try {
1577
+ const b64 = part.replace(/-/g, "+").replace(/_/g, "/").padEnd(Math.ceil(part.length / 4) * 4, "=");
1578
+ const { exp } = JSON.parse(atob(b64));
1579
+ return typeof exp === "number" && exp * 1e3 < Date.now() + TOKEN_EXPIRY_MARGIN_MS;
1580
+ } catch {
1581
+ return false;
1582
+ }
1583
+ }
1584
+ function isUnauthorized(error) {
1585
+ return error?.response?.status === 401;
1586
+ }
1587
+ async function discardAuth(storage) {
1588
+ await storage.remove(STORAGE_KEY_AUTH);
1589
+ await storage.remove(STORAGE_KEY_SESSION);
1590
+ }
1495
1591
  async function startServerSession(api, projectId) {
1496
1592
  const [deviceSnapshot, appSnapshot] = await Promise.all([
1497
1593
  getDeviceSnapshot(),
@@ -5544,43 +5640,43 @@ function parseVersionRange(constraint) {
5544
5640
  }
5545
5641
  return { min, max, constraint };
5546
5642
  }
5547
- function versionSatisfies(range, version) {
5643
+ function versionSatisfies(range, version2) {
5548
5644
  try {
5549
5645
  if (range.exact !== void 0) {
5550
- return compareVersions(version, range.exact) === 0;
5646
+ return compareVersions(version2, range.exact) === 0;
5551
5647
  }
5552
- if (range.min !== void 0 && compareVersions(version, range.min) < 0) {
5648
+ if (range.min !== void 0 && compareVersions(version2, range.min) < 0) {
5553
5649
  return false;
5554
5650
  }
5555
- if (range.max !== void 0 && compareVersions(version, range.max) >= 0) {
5651
+ if (range.max !== void 0 && compareVersions(version2, range.max) >= 0) {
5556
5652
  return false;
5557
5653
  }
5558
5654
  if (range.constraint?.startsWith("^")) {
5559
5655
  const base = range.constraint.slice(1).trim();
5560
5656
  const baseParts = parseVersionParts(base);
5561
- const versionParts = parseVersionParts(version);
5657
+ const versionParts = parseVersionParts(version2);
5562
5658
  if (!baseParts.length || !versionParts.length) return false;
5563
5659
  if (versionParts[0] !== baseParts[0]) return false;
5564
- return compareVersions(version, base) >= 0;
5660
+ return compareVersions(version2, base) >= 0;
5565
5661
  }
5566
5662
  if (range.constraint?.startsWith("~")) {
5567
5663
  const base = range.constraint.slice(1).trim();
5568
5664
  const baseParts = parseVersionParts(base);
5569
- const versionParts = parseVersionParts(version);
5665
+ const versionParts = parseVersionParts(version2);
5570
5666
  if (baseParts.length < 2 || versionParts.length < 2) return false;
5571
5667
  if (versionParts[0] !== baseParts[0] || versionParts[1] !== baseParts[1]) {
5572
5668
  return false;
5573
5669
  }
5574
- return compareVersions(version, base) >= 0;
5670
+ return compareVersions(version2, base) >= 0;
5575
5671
  }
5576
5672
  return true;
5577
5673
  } catch {
5578
5674
  return false;
5579
5675
  }
5580
5676
  }
5581
- function parseVersionParts(version) {
5677
+ function parseVersionParts(version2) {
5582
5678
  try {
5583
- return version.split(".").map((seg) => {
5679
+ return version2.split(".").map((seg) => {
5584
5680
  const clean = seg.split("-")[0].split("+")[0];
5585
5681
  const n = Number.parseInt(clean, 10);
5586
5682
  return Number.isFinite(n) ? n : 0;
@@ -7594,7 +7690,7 @@ function VoiceBugInputSheet({
7594
7690
  }
7595
7691
  meterAnim.setValue(0);
7596
7692
  setPhase("uploading");
7597
- let audio = null;
7693
+ let audio;
7598
7694
  try {
7599
7695
  audio = await stopRecording(recorderRef.current);
7600
7696
  } catch (e) {
@@ -9627,7 +9723,6 @@ import {
9627
9723
  isSyntheticEvent,
9628
9724
  resetWidgetIds
9629
9725
  } from "@testerpaykit/ai-tester";
9630
- var SDK_VERSION2 = "@testerpaykit/expo/0.2.0";
9631
9726
  var PLATFORM = typeof document !== "undefined" ? "expo-web" : "expo-native";
9632
9727
  function AiRemoteControl({
9633
9728
  visible,
@@ -9753,7 +9848,7 @@ function AiRemoteControl({
9753
9848
  JSON.stringify({
9754
9849
  type: "hello",
9755
9850
  platform: PLATFORM,
9756
- tpkVersion: SDK_VERSION2
9851
+ tpkVersion: SDK_VERSION
9757
9852
  })
9758
9853
  );
9759
9854
  setStatus("running");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@testerpaykit/expo",
3
- "version": "0.7.1",
3
+ "version": "0.7.3",
4
4
  "description": "TesterPayKit Expo / React-Native bindings — shake-to-report, device info, bug-report hook",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.mjs",
@@ -19,16 +19,10 @@
19
19
  "README.md",
20
20
  "CHANGELOG.md"
21
21
  ],
22
- "scripts": {
23
- "build": "tsup src/index.ts --format cjs,esm --dts --external react --external react-native --external expo-sensors --external expo-device --external expo-application --external @react-native-async-storage/async-storage --external react-native-svg --external react-native-view-shot --external react-native-record-screen --external expo-file-system --external @expo/vector-icons --external react-native-draggable-flatlist --external @shopify/react-native-skia",
24
- "dev": "tsup src/index.ts --format cjs,esm --dts --watch",
25
- "test": "vitest",
26
- "lint": "eslint src --ext .ts,.tsx"
27
- },
28
22
  "dependencies": {
29
- "@testerpaykit/ai-tester": "workspace:*",
30
- "@testerpaykit/api-client": "workspace:*",
31
- "@testerpaykit/core": "workspace:*"
23
+ "@testerpaykit/ai-tester": "0.4.0",
24
+ "@testerpaykit/api-client": "1.2.0",
25
+ "@testerpaykit/core": "1.0.1"
32
26
  },
33
27
  "peerDependencies": {
34
28
  "@expo/vector-icons": ">=14.0.0",
@@ -83,11 +77,11 @@
83
77
  }
84
78
  },
85
79
  "devDependencies": {
86
- "@types/react": "^18.2.0",
87
- "jsdom": "^23.2.0",
88
- "tsup": "^8.0.1",
89
- "typescript": "^5.3.0",
90
- "vitest": "^1.0.4"
80
+ "@types/react": "^19.3.0",
81
+ "jsdom": "^30.1.3",
82
+ "tsup": "^9.0.0",
83
+ "typescript": "^6.0.3",
84
+ "vitest": "^5.0.5"
91
85
  },
92
86
  "keywords": [
93
87
  "testerpaykit",
@@ -99,5 +93,11 @@
99
93
  "license": "MIT",
100
94
  "publishConfig": {
101
95
  "access": "public"
96
+ },
97
+ "scripts": {
98
+ "build": "tsup src/index.ts --format cjs,esm --dts --external react --external react-native --external expo-sensors --external expo-device --external expo-application --external @react-native-async-storage/async-storage --external react-native-svg --external react-native-view-shot --external react-native-record-screen --external expo-file-system --external @expo/vector-icons --external react-native-draggable-flatlist --external @shopify/react-native-skia",
99
+ "dev": "tsup src/index.ts --format cjs,esm --dts --watch",
100
+ "test": "vitest",
101
+ "lint": "eslint src --ext .ts,.tsx"
102
102
  }
103
- }
103
+ }