insightdive_sdk 0.7.0
insightdive_sdk: ^0.7.0 copied to clipboard
Flutter SDK for Insightdive in-app surveys. Modal bottom-sheet or inline widget — embed anywhere, stream lifecycle events, zero user identifiers.
Changelog #
0.7.0 — 2026-05-26 #
New — Operator context fields, respondent token, and contact opt-in support.
-
context: Map<String, dynamic>?— new optional field onInsightdiveConfig. Pass arbitrary key/value metadata (plan tier, feature flags, active surface, A/B cohort…) to be stamped on every submission. Serialised to JSON and forwarded via thepostMessagebridge onready. Validated server-side: max 20 keys, keys[a-z0-9_]max 64 chars, valuesstring | number | boolean, total ≤ 4 KB. Invalid entries are silently dropped so the submission is never blocked. -
respondentToken: String?— new optional field onInsightdiveConfig. Set to an opaque hash the operator computes client-side (e.g.sha256(userId + workspaceSalt)). Stored as-is by Insightdive; enables the operator to cross-reference responses with their own user records without Insightdive knowing the identity. Max 128 chars,[a-zA-Z0-9-_]only. -
Contact opt-in question type — the survey page now supports a
contact_opt_inquestion type. When included in a survey, the respondent can voluntarily provide a contact field (email, phone, or ticket reference). No SDK changes required — the question renders inside the survey iframe and the opt-in is handled entirely server-side. The SDK's postMessage bridge already forwards all question answers including opt-in data.
0.6.0 — 2026-05-23 #
New — Screenshot capture. When an insight enables screenshot collection, the SDK captures your app screen (via a RepaintBoundary keyed with Insightdive.screenshotBoundaryKey) just before the sheet opens and attaches it to the response. Wrap your app root in RepaintBoundary(key: Insightdive.screenshotBoundaryKey, child: …) to opt in; capture is skipped silently if the boundary isn't mounted. isAvailable() / trigger() now read the collectScreenshot flag from the status endpoint.
0.5.3 — 2026-05-20 #
Chore — republish under tag-based CI trigger; no functional changes vs 0.5.2.
0.5.2 — 2026-05-19 #
New — productIdentifier targeting now enforced server-side.
- The Flutter SDK already sent
productIdentifierin the status URL since 0.3.0. The server now validates it against thetargetingIdentifierfield configured in Admin → Insight → Targeting. No SDK code changes required.
0.5.1 — 2026-05-19 #
Fix — compilation errors in trigger().
FeedbackResultearly-return values intrigger()now include the requiredsessionId: nullandsubmissionId: nullfields.- Added
context.mountedguard before callingshow(context)after the async HTTP call (use_build_context_synchronously).
0.5.0 — 2026-05-19 #
Security — embed token exchange before opening the survey WebView.
show()(andtrigger()viashow()) now callsPOST /api/v1/surveys/[slug]/embed-tokenwithAuthorization: Bearer <apiKey>before opening the bottom sheet. The WebView URL uses?t=<token>(5-min signed JWT) instead of?apiKey=. Falls back to?apiKey=silently if the exchange fails.InsightdiveSurveywidget gains an optionalembedTokenparameter. When constructing the widget directly (inline embed) you can pass a pre-fetched token; null falls back to the API key as before.
0.4.0 — 2026-05-19 #
Breaking — configure() parameter renamed, New — trigger() now routes by event name.
-
sdkTokenparameter removed fromconfigure()— replaced byapiKey(tenant-level key found in Admin → Settings → API). Update your call:// Before Insightdive.configure(tenant: 'acme', survey: 'onboarding', sdkToken: 'sdk_…'); // After Insightdive.configure(tenant: 'acme', survey: 'onboarding', apiKey: 'ik_…'); -
trigger(context, eventName)now calls the status endpoint with?event=<name>before deciding whether to open the sheet. If the insight's trigger-event list doesn't include the event, the call resolves silently asdismissed. When the list is empty every event matches. On network error the SDK falls through and opens the survey anyway (fail-open).
0.3.0 — 2026-05-15 #
New — inline widget embedding mode.
-
InsightdiveSurvey— a plain Flutter widget that renders the survey directly in your widget tree. Drop it inside a full-screen page, a card, a tab body, or any layout you control. The host decides when to mount and unmount it; react toFeedbackCompletedinonEventto remove it:if (_showSurvey) InsightdiveSurvey( options: Insightdive.options, onEvent: (event) { if (event is FeedbackCompleted) { setState(() => _showSurvey = false); } }, ), -
Insightdive.optionsgetter — returns the activeFeedbackOptionsset byconfigure(), throwsStateErrorif called beforeconfigure. -
Insightdive.addEvent(event)— manually pushes an event onto the globalInsightdive.eventsstream, useful when usingInsightdiveSurveydirectly and you still want global stream subscribers to receive events. -
Insightdive.isAvailable()— async check that hits the publicGET /api/v1/surveys/{survey}/statusendpoint. Returnstrueonly when the survey is live. Call before mountingInsightdiveSurvey(or beforeshow()) to avoid displaying a "not published" screen to end-users. Network errors returnfalse— entry point stays hidden, never crashes. -
Internal refactor:
FeedbackSheet(modal) now delegates all webview logic toInsightdiveSurvey, eliminating duplicated code. No behaviour change.
0.2.1 — 2026-05-15 #
- Replace product-specific example slugs in docs with generic
acme/onboardingexamples. - No API changes.
0.2.0 — 2026-05-13 #
Breaking — simplified configuration.
Insightdive.configurenow takestenant(workspace slug) +survey(project slug) instead ofhost(full URL) +deploymentId. The SDK buildshttps://<tenant>.insightdive.com/s/<survey>internally and resolves the active deployment server-side, so rotating a published survey no longer requires a SDK release.- New optional
baseUrlfor staging / self-hosted / local dev. When set it replaces the computed.insightdive.comhost. - The synthesized
FeedbackDismissedevent now reports thedeploymentIdcaptured from earlier server events instead of echoing the (now-removed) configured value.
Migration #
// Before
Insightdive.configure(
host: 'https://acme.insightdive.com',
deploymentId: 'cmd_abc123',
);
// After
Insightdive.configure(
tenant: 'acme',
survey: 'onboarding',
);
0.1.0 — 2026-05-12 #
Initial release.
Insightdive.configure()for one-shot setup with host + deploymentId.Insightdive.show(context)opens the survey as a modal bottom sheet.Insightdive.eventsbroadcastsready,viewed,started,completed,dismissedlifecycle events.Insightdive.trigger(context, eventName)alias ofshow— reserved for server-side event routing in a future release.Insightdive.hide(context)closes the sheet programmatically.- Anonymous by default: no user identifiers are passed to the server.
- iOS and Android supported via
webview_flutter. Desktop/web bindings resolve when the host app pulls them in but are not validated yet.