From 2dbc49b9152b222d23246e16ca08c5524a1ca805 Mon Sep 17 00:00:00 2001 From: sardhak addepalli <42747069+bazingga08@users.noreply.github.com> Date: Thu, 5 Nov 2026 19:32:24 +0530 Subject: [PATCH 1/2] init: Android 0.9.0 and iOS 0.10.0; events add names the SDK eventId needs strait init still wrote Android 0.8.4 / iOS 0.9.5 while JitPack has v0.9.0 and the Swift tag v0.10.0 (site.config.json packages since site 9e447fb). events add prints eventId for iOS/Android, which only those versions have, so it now reads the same VERSIONS and says so. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01JfkGWSV4ar1AEGgGnCbGzd --- CHANGELOG.md | 1 + src/events.mjs | 7 +++++-- src/install.mjs | 5 +++-- test/events.test.mjs | 4 ++-- test/install.test.mjs | 9 +++++---- 5 files changed, 16 insertions(+), 10 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index bfd6952..1709f3f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,7 @@ ## Unreleased +- `strait init` writes setup for today's SDKs: Android 0.9.0 (JitPack) and iOS 0.10.0 (SwiftPM), was 0.8.4 and 0.9.5; React Native 0.10.2 and Flutter 0.9.7 unchanged. `strait events add` reads the same versions and says the iOS/Android `eventId` needs them. - `strait test`: one pass/fail list that says you're set up right: the engine answers, the secret key is valid (which workspace, test or live), and the workspace's link domain serves apple-app-site-association and assetlinks.json. Exit 1 on any failure, `--json` for CI. - `strait events add `: prints ready-to-paste event tracking code for React Native, Flutter, iOS, Android or the web (detected from the project files, or `--platform`), using each SDK's real `trackEvent` call. - `strait events add --platform web` prints `@straitlink/web`'s new `trackEvent` instead of a hand-written `POST /v1/event` (needs the web SDK release that adds it). diff --git a/src/events.mjs b/src/events.mjs index e39ce58..f3acad8 100644 --- a/src/events.mjs +++ b/src/events.mjs @@ -9,6 +9,7 @@ import { existsSync, readdirSync } from 'node:fs'; import { join } from 'node:path'; import { detectProject } from './detect.mjs'; +import { PACKAGES, VERSIONS } from './install.mjs'; import { UsageError, normalizeHost } from './validate.mjs'; export const PLATFORMS = ['react-native', 'flutter', 'ios', 'android', 'web']; @@ -77,13 +78,15 @@ await links.trackEvent('${n}'); await links.trackEvent('${n}'); `, ios: (n) => `// strait: your StraitLinks instance (strait-sdk-swift README, "Use"). Never throws. -// For revenue add value: 49.99, currency: "USD", eventId: order.id (a retry is counted once). +// For revenue add value: 49.99, currency: "USD", eventId: order.id (a retry is counted once; +// eventId needs StraitSDK ${VERSIONS.version}+, what strait init installs). strait.trackEvent("${n}") { ok in // ok == false: not sent now; kept and sent later when it was the network } `, android: (n) => `// It sends on the calling thread: call it off the main thread. Never throws. -// For revenue add value = 49.99, currency = "USD", eventId = order.id (a retry is counted once). +// For revenue add value = 49.99, currency = "USD", eventId = order.id (a retry is counted once; +// eventId needs ${PACKAGES.android} ${VERSIONS.androidVersion}+, what strait init installs). val ok = StraitLinks.client.trackEvent("${n}") `, web: (n, { key, host }) => `import { reportWebOpen, trackEvent } from '@straitlink/web'; diff --git a/src/install.mjs b/src/install.mjs index 40612fe..84c5ae6 100644 --- a/src/install.mjs +++ b/src/install.mjs @@ -19,12 +19,13 @@ export const sourceFor = (src, registry) => (typeof src.source === 'string' ? sr /** * SDK versions the generated code is written for. Must equal site/site.config.json `packages` * (the one source of truth; test/install.test.mjs fails if they differ). Bump both together. + * `strait events add` reads them too: its iOS/Android eventId needs these SDKs. */ export const VERSIONS = { - version: '0.9.5', // Swift (Unity is not written by this CLI) + version: '0.10.0', // Swift (Unity is not written by this CLI) rnVersion: '0.10.2', flutterVersion: '0.9.7', - androidVersion: '0.8.4', + androidVersion: '0.9.0', }; export const PACKAGES = { diff --git a/test/events.test.mjs b/test/events.test.mjs index a375c9a..9045dab 100644 --- a/test/events.test.mjs +++ b/test/events.test.mjs @@ -26,8 +26,8 @@ test('each platform prints its SDK\'s real event call with the name', async () = const want = { 'react-native': [/import \{ links \} from '\.\/links'/, /await links\.trackEvent\('purchase'\);/, /value: 49\.99, currency: 'USD', eventId: order\.id/], flutter: [/import 'links\.dart';/, /await links\.trackEvent\('purchase'\);/, /value: 49\.99, currency: 'USD'/], - ios: [/strait\.trackEvent\("purchase"\) \{ ok in/, /eventId: order\.id/], - android: [/StraitLinks\.client\.trackEvent\("purchase"\)/, /off the main thread/], + ios: [/strait\.trackEvent\("purchase"\) \{ ok in/, /eventId: order\.id/, /StraitSDK 0\.10\.0\+/], + android: [/StraitLinks\.client\.trackEvent\("purchase"\)/, /off the main thread/, /eventId = order\.id/, /strait-sdk-android 0\.9\.0\+/], web: [/import \{ reportWebOpen, trackEvent \} from '@straitlink\/web'/, /await reportWebOpen\(strait\);/, /await trackEvent\(strait, 'purchase'\);/, /value: 49\.99, currency: 'USD', eventId: order\.id/], }; for (const [platform, patterns] of Object.entries(want)) { diff --git a/test/install.test.mjs b/test/install.test.mjs index e7ce87a..4afcf8e 100644 --- a/test/install.test.mjs +++ b/test/install.test.mjs @@ -10,21 +10,22 @@ const root = fileURLToPath(new URL('..', import.meta.url)); const walk = (d) => readdirSync(d).flatMap((n) => (n === 'node_modules' || n === '.git' ? [] : statSync(join(d, n)).isDirectory() ? walk(join(d, n)) : [join(d, n)])); test('github and registry sources', () => { - // Versions as of 3 Nov 2026 (site.config.json packages = npm / pub.dev / JitPack): RN 0.10.2, Flutter 0.9.7, Android 0.8.4. + // Versions as of 5 Nov 2026 (site.config.json packages = npm / pub.dev / JitPack): RN 0.10.2, Flutter 0.9.7, Android 0.9.0. const gh = installSpecs({ source: 'github', githubOwner: 'strait-sdks' }); assert.equal(gh.reactNative, 'github:strait-sdks/strait-sdk-react-native#v0.10.2'); - assert.equal(gh.android, 'com.github.strait-sdks:strait-sdk-android:v0.8.4'); + assert.equal(gh.android, 'com.github.strait-sdks:strait-sdk-android:v0.9.0'); assert.equal(gh.androidRepository, 'https://jitpack.io'); assert.match(gh.flutterPubspec, /url: https:\/\/github\.com\/strait-sdks\/strait-sdk-flutter\n {6}ref: v0\.9\.7/); const today = installSpecs(); assert.equal(today.reactNative, '@straitlink/react-native@0.10.2', 'npm in registry mode (16 Oct)'); assert.equal(today.flutterPubspec, ' strait_sdk: ^0.9.7', 'pub.dev in registry mode (16 Oct)'); - assert.equal(today.android, `com.github.${INSTALL.githubOwner}:strait-sdk-android:v0.8.4`, 'Android stays on JitPack'); + assert.equal(today.android, `com.github.${INSTALL.githubOwner}:strait-sdk-android:v0.9.0`, 'Android stays on JitPack'); const reg = installSpecs({ ...INSTALL, source: 'registry' }); assert.equal(reg.reactNative, '@straitlink/react-native@0.10.2'); - assert.equal(reg.android, 'in.straitlink:strait-sdk-android:0.8.4'); + assert.equal(reg.android, 'in.straitlink:strait-sdk-android:0.9.0'); assert.equal(reg.flutterPubspec, ' strait_sdk: ^0.9.7'); assert.equal(reg.androidRepository, null); + assert.equal(VERSIONS.version, '0.10.0', 'Swift tag v0.10.0 (SwiftPM)'); }); test('the owner is spelled out only in src/install.mjs', () => { From a3d114ccacda71784886960dd611c9a743569a3f Mon Sep 17 00:00:00 2001 From: sardhak addepalli <42747069+bazingga08@users.noreply.github.com> Date: Thu, 5 Nov 2026 19:32:47 +0530 Subject: [PATCH 2/2] events add (iOS): name the SwiftPM line, not strait init (init has no iOS target) Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01JfkGWSV4ar1AEGgGnCbGzd --- src/events.mjs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/events.mjs b/src/events.mjs index f3acad8..f06a1e4 100644 --- a/src/events.mjs +++ b/src/events.mjs @@ -79,7 +79,7 @@ await links.trackEvent('${n}'); `, ios: (n) => `// strait: your StraitLinks instance (strait-sdk-swift README, "Use"). Never throws. // For revenue add value: 49.99, currency: "USD", eventId: order.id (a retry is counted once; -// eventId needs StraitSDK ${VERSIONS.version}+, what strait init installs). +// eventId needs StraitSDK ${VERSIONS.version}+: SwiftPM from: "${VERSIONS.version}"). strait.trackEvent("${n}") { ok in // ok == false: not sent now; kept and sent later when it was the network }