@magicfeedback/popup-sdk 1.17.2 → 1.19.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/MagicfeedbackPopupSdk.podspec +18 -0
- package/README.md +33 -1
- package/dist/2.2.38-CCK7SF4A.mjs +2343 -0
- package/dist/2.2.38-CCK7SF4A.mjs.map +1 -0
- package/dist/2.2.38-LGZRM7GX.mjs +2343 -0
- package/dist/2.2.38-LGZRM7GX.mjs.map +1 -0
- package/dist/2.2.39-BJJ3YRJ4.mjs +2344 -0
- package/dist/2.2.39-BJJ3YRJ4.mjs.map +1 -0
- package/dist/2.2.39-HPNDYUPP.mjs +2344 -0
- package/dist/2.2.39-HPNDYUPP.mjs.map +1 -0
- package/dist/assets/assets/style.css +165 -1
- package/dist/assets/assets/survey-css/2.2.38.css +2335 -0
- package/dist/assets/assets/survey-css/2.2.39.css +2336 -0
- package/dist/chunk-3QS3WKRC.mjs +31 -0
- package/dist/chunk-3QS3WKRC.mjs.map +1 -0
- package/dist/chunk-7ZQOAKXR.mjs +3335 -0
- package/dist/chunk-7ZQOAKXR.mjs.map +1 -0
- package/dist/chunk-BJTO5JO5.mjs +11 -0
- package/dist/chunk-BJTO5JO5.mjs.map +1 -0
- package/dist/{chunk-AFRHPS3K.mjs → chunk-EW2ARDEY.mjs} +591 -51
- package/dist/chunk-EW2ARDEY.mjs.map +1 -0
- package/dist/{chunk-VHTN5UXD.mjs → chunk-XOEEBDBJ.mjs} +630 -10
- package/dist/chunk-XOEEBDBJ.mjs.map +1 -0
- package/dist/index.d.mts +159 -10
- package/dist/index.d.ts +159 -10
- package/dist/index.js +7275 -1466
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +318 -41
- package/dist/index.mjs.map +1 -1
- package/dist/index.native.d.mts +1616 -0
- package/dist/index.native.d.ts +1616 -0
- package/dist/index.native.js +15853 -0
- package/dist/index.native.js.map +1 -0
- package/dist/index.native.mjs +3914 -0
- package/dist/index.native.mjs.map +1 -0
- package/dist/react-native.d.mts +105 -8
- package/dist/react-native.d.ts +105 -8
- package/dist/react-native.js +5827 -132
- package/dist/react-native.js.map +1 -1
- package/dist/react-native.mjs +313 -43
- package/dist/react-native.mjs.map +1 -1
- package/dist/renderPopup-2Y4QMWR7.mjs +3847 -0
- package/dist/renderPopup-2Y4QMWR7.mjs.map +1 -0
- package/dist/renderPopup-YDJUON42.mjs +3847 -0
- package/dist/renderPopup-YDJUON42.mjs.map +1 -0
- package/dist/{renderPopup-L2Q3KJAZ.mjs → renderPopup-ZHTRMFO2.mjs} +142 -9
- package/dist/renderPopup-ZHTRMFO2.mjs.map +1 -0
- package/ios/DeepdotsBackgroundTask.m +71 -0
- package/package.json +14 -5
- package/react-native.config.js +9 -0
- package/dist/chunk-AFRHPS3K.mjs.map +0 -1
- package/dist/chunk-VHTN5UXD.mjs.map +0 -1
- package/dist/renderPopup-L2Q3KJAZ.mjs.map +0 -1
- package/dist/renderPopup-PQWJSBOY.mjs +0 -3622
- package/dist/renderPopup-PQWJSBOY.mjs.map +0 -1
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
require "json"
|
|
2
|
+
|
|
3
|
+
package = JSON.parse(File.read(File.join(__dir__, "package.json")))
|
|
4
|
+
|
|
5
|
+
# Módulo nativo mínimo del popup-sdk en React Native (iOS): background task para que el cierre
|
|
6
|
+
# de la sesión salga al pasar a background (DD-55). Lo enlaza el autolinking; en web no existe.
|
|
7
|
+
Pod::Spec.new do |s|
|
|
8
|
+
s.name = "MagicfeedbackPopupSdk"
|
|
9
|
+
s.version = package["version"]
|
|
10
|
+
s.summary = "Deepdots popup SDK: iOS background task for analytics requests (React Native)."
|
|
11
|
+
s.homepage = "https://github.com/MagicFeedback/deepdots-popup-sdk"
|
|
12
|
+
s.license = package["license"] || "UNLICENSED"
|
|
13
|
+
s.author = "Deepdots"
|
|
14
|
+
s.platforms = { :ios => "13.0" }
|
|
15
|
+
s.source = { :git => "https://github.com/MagicFeedback/deepdots-popup-sdk.git", :tag => "v#{s.version}" }
|
|
16
|
+
s.source_files = "ios/**/*.{h,m}"
|
|
17
|
+
s.dependency "React-Core"
|
|
18
|
+
end
|
package/README.md
CHANGED
|
@@ -137,6 +137,18 @@ Config fields:
|
|
|
137
137
|
defaults to `localStorage`)
|
|
138
138
|
- `platform?: 'web' | 'android' | 'ios'` — defaults to `'web'`
|
|
139
139
|
- `device?: DeviceInfo` — device context override, for hosts where the SDK cannot detect it
|
|
140
|
+
- `autoTrack?: { lifecycle?: boolean }` — what the SDK detects on its own; all on by default.
|
|
141
|
+
`lifecycle` (React Native): the SDK listens to `AppState` itself (`active` → session start,
|
|
142
|
+
`inactive` → send pending data with the current screen, `background` → session end). Calling
|
|
143
|
+
`onForeground` / `onInactive` / `onBackground` yourself as well is harmless: nothing is sent
|
|
144
|
+
twice.
|
|
145
|
+
- `backgroundTask?: (name) => () => void` — React Native on iOS, **usually not needed**: the
|
|
146
|
+
package ships a tiny native module (`ios/DeepdotsBackgroundTask.m`, linked by autolinking on
|
|
147
|
+
`pod install`) that asks iOS for background time while each analytics request is in flight,
|
|
148
|
+
so the request that closes the session finishes when the app goes to background instead of
|
|
149
|
+
when the user opens it again. Pass your own function only to replace it (for example
|
|
150
|
+
`backgroundTimerTask(BackgroundTimer)` with `react-native-background-timer`). Without either
|
|
151
|
+
(Expo Go, or an app not rebuilt yet), the closing batch is stored and sent on the next launch.
|
|
140
152
|
- `contactAttributes?: Record<string, string | number | boolean>`
|
|
141
153
|
- `renderChrome?: boolean` — React Native only. Defaults to `true`. When `false`, the survey
|
|
142
154
|
WebView HTML is delivered transparent and edge-to-edge, without the SDK's own card, backdrop,
|
|
@@ -220,6 +232,16 @@ const renderer = new ReactNativePopupRenderer({
|
|
|
220
232
|
`onReady` is optional: a host that opens its container on `onShow` still never shows the spinner,
|
|
221
233
|
because the HTML reveals itself; the container just appears a few hundred ms before the card.
|
|
222
234
|
|
|
235
|
+
### Survey version (latest or pinned in the Admin)
|
|
236
|
+
|
|
237
|
+
Each popup draws its survey with the survey version assigned to it in the Admin (*Survey frontend version*: latest or pinned), like the survey page does. The API sends it per popup as `surveyFrontend.sdkVersion`, the `@magicfeedback/native` version that survey release was built with.
|
|
238
|
+
|
|
239
|
+
- Supported versions: `SUPPORTED_SURVEY_SDK_VERSIONS` (now 2.2.38, 2.2.39), the ones whose survey CSS this SDK vendors (`src/assets/survey-css/<v>.css`, scoped to `.deepdots-popup` like `style.css`). JS and CSS follow the version together.
|
|
240
|
+
- DOM popup: the browser bundle of that exact version comes from jsDelivr (then unpkg); its CSS ships inside this SDK as a lazy chunk. React Native's WebView loads both from the CDN (the CSS from this package's `dist/assets/assets/survey-css`).
|
|
241
|
+
- Missing (older API, survey release without `sdkVersion`), unsupported, or failing to load (no network, a CSP without `cdn.jsdelivr.net`/`unpkg.com` in `script-src`): the bundled JS and CSS (`BUNDLED_SURVEY_SDK_VERSION`), as before. Never one version's JS with another's CSS.
|
|
242
|
+
- With `debug: true` the choice is logged (`[Deepdots] survey SDK 2.2.38 (assigned)`); an invalid version or a load failure is always logged as a warning (unsupported is debug-only: it is normal for older survey versions). The popup element carries it in `data-survey-sdk`.
|
|
243
|
+
- Adding a version: `node scripts/vendor-survey-css.mjs --src <readable magicfeedback-default.css> --version <v> --out src/assets/survey-css/<v>.css`, then add it to `SUPPORTED_SURVEY_SDK_VERSIONS` and `src/ui/surveyCss.ts` (a test checks the three match). The release gate then tests it: `apps/test-app/e2e/survey-sdk.spec.ts` opens a popup with each listed version (`?surveySdk=<v>`) and checks its JS, its CSS and that the survey draws and answers.
|
|
244
|
+
|
|
223
245
|
### Focus on text questions
|
|
224
246
|
|
|
225
247
|
When the first question of a page is a text field (text, long text, email or number), the cursor
|
|
@@ -309,6 +331,7 @@ session start/end and unhandled errors are automatic. The rest is instrumented b
|
|
|
309
331
|
| `setUserAttributes(map)` / `setMetric(key, value)` | Breakdown dimensions / measurable values |
|
|
310
332
|
| `setUserId(userId?)` | Login, logout or account switch |
|
|
311
333
|
| `endSession()` | Closes the session explicitly |
|
|
334
|
+
| `onForeground()` / `onInactive()` / `onBackground()` | React Native lifecycle. Not needed: the SDK listens to `AppState` itself (`autoTrack.lifecycle`). Calling them as well does not send anything twice |
|
|
312
335
|
| `setTrackingEnabled(enabled)` | Kill switch (consent) |
|
|
313
336
|
| `reportError(error, options?)` | A handled error |
|
|
314
337
|
| `previewAnalytics()` / `flushAnalytics()` | Inspect the pending payload / send it now |
|
|
@@ -509,12 +532,13 @@ The SDK emits:
|
|
|
509
532
|
- `popup_shown`
|
|
510
533
|
- `popup_clicked`
|
|
511
534
|
- `survey_completed`
|
|
535
|
+
- `survey_error`
|
|
512
536
|
|
|
513
537
|
Payload:
|
|
514
538
|
|
|
515
539
|
```ts
|
|
516
540
|
interface DeepdotsEvent {
|
|
517
|
-
type: 'popup_shown' | 'popup_clicked' | 'survey_completed';
|
|
541
|
+
type: 'popup_shown' | 'popup_clicked' | 'survey_completed' | 'survey_error';
|
|
518
542
|
surveyId: string;
|
|
519
543
|
timestamp: number;
|
|
520
544
|
data?: Record<string, unknown>;
|
|
@@ -529,6 +553,14 @@ interface DeepdotsEvent {
|
|
|
529
553
|
|
|
530
554
|
`popup_clicked` means the user did something in the popup. On the web, `data.action` is one of `start_survey`, `manual_send`, `back`, `complete`, `close_icon`, or `partial` (the user answered a page and moved on; this one also marks the popup as `PARTIAL` in the backend). Loading the survey, the start of a submit, and validation or submit errors are not interactions and do not emit it. In React Native the bridge emits it once per popup, with `action: 'partial'`, on the first real interaction (sending an answer or going back).
|
|
531
555
|
|
|
556
|
+
`survey_error` means a page of the survey could not be sent and the popup is showing its generic error message. `data` is `{reason, message}`:
|
|
557
|
+
|
|
558
|
+
- `reason: 'send_failed'`: the API did not save the answers (HTTP error or network).
|
|
559
|
+
- `reason: 'no_page'`: the survey lost track of its current page.
|
|
560
|
+
- `reason: 'unknown'`: any other error from the survey renderer. `message` has its text, cut to 300 characters.
|
|
561
|
+
|
|
562
|
+
An empty required question is not an error and does not emit it. `survey_error` is not an interaction, so it does not mark the popup as `PARTIAL`. With tracking enabled it is also sent to analytics as `deepdots_survey_error` (`survey_id`, `popup_id`, `reason`, `message`). The texts shown in the popup do not change.
|
|
563
|
+
|
|
532
564
|
## Important Behavior Notes
|
|
533
565
|
|
|
534
566
|
- `segments.path`, `segments.excludedPaths`, and `segments.lang` are the segments currently evaluated by the SDK runtime. If no language can be resolved, popups with `segments.lang` are shown rather than filtered out.
|