{"_id":"@appsflyer-sdk/js-core-plugin","_rev":"6-2f653d4fec0e2e59e550c14ac9c0ee42","name":"@appsflyer-sdk/js-core-plugin","dist-tags":{"latest":"7.1.0"},"versions":{"0.1.0":{"name":"@appsflyer-sdk/js-core-plugin","version":"0.1.0","license":"MIT","_id":"@appsflyer-sdk/js-core-plugin@0.1.0","maintainers":[{"name":"af-obodovskyi","email":"ivan.obodovskyi@appsflyer.com"},{"name":"al-af","email":"amit.levy@appsflyer.com"},{"name":"pazlavi","email":"paz.lavi@appsflyer.com"},{"name":"af-fess","email":"maxim@appsflyer.com"},{"name":"af-tlozovyi","email":"taras.lozovyi@appsflyer.com"}],"dist":{"shasum":"6411b16c86ccb115d33599c531eeabd905410faa","tarball":"https://registry.npmjs.org/@appsflyer-sdk/js-core-plugin/-/js-core-plugin-0.1.0.tgz","fileCount":16,"integrity":"sha512-wnnxjPTdXWNuvUGbe1/m3YAu9mILNq+ohCW0lOo7SfIZvJjomV5KK+BvjDNrBVFBFMwx/0T+BPk2w1FrIpwoLg==","signatures":[{"sig":"MEUCIQD7cQOzOg3KowIZd2NYNXE3Bf3nXS+LmWGf9jKTQUsogQIgQtfYjwiHIS2Z1N6b2POEnJ0BNxXlwWPuX6wVJbWFtnU=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":74163},"main":"dist/index.js","types":"dist/index.d.ts","gitHead":"43a0cbc481eb709c263997de4829837ce7f40887","scripts":{"test":"jest","build":"npm run generate:types && npm run generate:rpc-map && tsc","prepare":"npm run build","typecheck":"tsc --noEmit","sync:schema":"node scripts/sync-schema.js","generate:types":"node scripts/generate-types.js","prepublishOnly":"npm run build","generate:rpc-map":"node scripts/generate-rpc-map.js","generate:sdk-boilerplate":"node scripts/generate-sdk-boilerplate.js"},"_npmUser":{"name":"al-af","email":"amit.levy@appsflyer.com"},"_npmVersion":"11.17.0","description":"Shared JS/TS RPC client core for AppsFlyer SDK 7 plugins (Capacitor, React Native, Cordova)","directories":{},"_nodeVersion":"26.5.0","_hasShrinkwrap":false,"devDependencies":{"jest":"^29.7.0","ts-jest":"^29.2.5","typescript":"^5.5.4","@types/jest":"^29.5.14","@types/node":"^20.14.0"},"_npmOperationalInternal":{"tmp":"tmp/js-core-plugin_0.1.0_1786354682162_0.3310948830136884","host":"s3://npm-registry-packages-npm-production"}},"7.0.13":{"name":"@appsflyer-sdk/js-core-plugin","version":"7.0.13","license":"MIT","_id":"@appsflyer-sdk/js-core-plugin@7.0.13","maintainers":[{"name":"af-obodovskyi","email":"ivan.obodovskyi@appsflyer.com"},{"name":"al-af","email":"amit.levy@appsflyer.com"},{"name":"andrii.dudka","email":"andrii.dudka@appsflyer.com"},{"name":"pazlavi","email":"paz.lavi@appsflyer.com"},{"name":"af-fess","email":"maxim@appsflyer.com"},{"name":"af-tlozovyi","email":"taras.lozovyi@appsflyer.com"}],"dist":{"shasum":"9ea6f0ed89cdfc8a14363e4f7049273eeded634a","tarball":"https://registry.npmjs.org/@appsflyer-sdk/js-core-plugin/-/js-core-plugin-7.0.13.tgz","fileCount":16,"integrity":"sha512-aPhQeoSXT/03JuE7uwBrEQMg57AxTHkCJOG42QcY/vVrPfZ0wERGlh3b/tnQSBRsEHDAm82TsFN3cTyJLAiAgw==","signatures":[{"sig":"MEYCIQCDrjyZAi6gC8B1sXHaE2pe1ZW0QedqkW7iu7/QBOXNtwIhAI1T4E2axq73QoFegu6Q6s75rvQ2HMfy5/b0iGEtbue2","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":77668},"main":"dist/index.js","types":"dist/index.d.ts","gitHead":"8075f9a37f387b45758b2b7047f43d37772ca22b","scripts":{"test":"jest","build":"npm run generate:types && npm run generate:rpc-map && tsc","update":"echo '\\n▶ [1/5] Pulling latest RPC schema from GitLab -> schema/appsflyer-plugins-rpc-schema.json' && npm run sync:schema && echo '\\n▶ [2/5] Regenerating types -> src/generated/methods.ts' && npm run generate:types && echo '\\n▶ [3/5] Regenerating RPC map -> src/generated/rpc-map.ts' && npm run generate:rpc-map && echo '\\n▶ [4/5] Compiling -> dist/ (fails here if a method was REMOVED and appsflyer-sdk.ts still calls it)' && tsc && echo '\\n▶ [5/5] Checking every schema method is exposed in src/appsflyer-sdk.ts (catches methods ADDED to the schema but not wired into the SDK)' && npx jest test/sdk-coverage.test.ts test/schema.test.ts && echo '\\n✔ Update complete.'","prepare":"npm run build","typecheck":"tsc --noEmit","sync:schema":"node scripts/sync-schema.js","generate:types":"node scripts/generate-types.js","prepublishOnly":"npm run build","generate:rpc-map":"node scripts/generate-rpc-map.js","generate:sdk-boilerplate":"node scripts/generate-sdk-boilerplate.js"},"_npmUser":{"name":"GitHub Actions","email":"npm-oidc-no-reply@github.com","trustedPublisher":{"id":"github","oidcConfigId":"oidc:3fccec72-fb84-4efe-868c-f135cab0de92"}},"_npmVersion":"11.17.0","description":"Shared JS/TS RPC client core for AppsFlyer SDK 7 plugins (Capacitor, React Native, Cordova)","directories":{},"_nodeVersion":"24.19.0","_hasShrinkwrap":false,"devDependencies":{"jest":"^29.7.0","ts-jest":"^29.2.5","typescript":"^5.5.4","@types/jest":"^29.5.14","@types/node":"^20.14.0"},"_npmOperationalInternal":{"tmp":"tmp/js-core-plugin_7.0.13_1787486545557_0.31182506063032545","host":"s3://npm-registry-packages-npm-production"}},"7.0.14":{"name":"@appsflyer-sdk/js-core-plugin","version":"7.0.14","license":"MIT","_id":"@appsflyer-sdk/js-core-plugin@7.0.14","maintainers":[{"name":"af-obodovskyi","email":"ivan.obodovskyi@appsflyer.com"},{"name":"al-af","email":"amit.levy@appsflyer.com"},{"name":"andrii.dudka","email":"andrii.dudka@appsflyer.com"},{"name":"pazlavi","email":"paz.lavi@appsflyer.com"},{"name":"af-fess","email":"maxim@appsflyer.com"},{"name":"af-tlozovyi","email":"taras.lozovyi@appsflyer.com"}],"dist":{"shasum":"d961588507d218076d3c9e387fecc450d44cbd6f","tarball":"https://registry.npmjs.org/@appsflyer-sdk/js-core-plugin/-/js-core-plugin-7.0.14.tgz","fileCount":16,"integrity":"sha512-4iyj1j38/Wakr8La/tzMp/NWDV3QlTuw3eexU7q2ON78ED8ZQrunqcWc8FPCUHCWz1O7dz0rSJFm+0INlEi8nQ==","signatures":[{"sig":"MEYCIQDdMA9Lh/I3+vlhymmdlNWcFjYY9FiDxG3ZtJCjmQQB2gIhANN1KgoaCThVStGvE15gPl0zK/Y3lN2jiNvjTObwsSLp","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":78497},"main":"dist/index.js","types":"dist/index.d.ts","gitHead":"55694c76b073b936e090d0cd7656843a04637b01","scripts":{"test":"jest","build":"npm run generate:types && npm run generate:rpc-map && tsc","update":"echo '\\n▶ [1/5] Pulling latest RPC schema from GitLab -> schema/appsflyer-plugins-rpc-schema.json' && npm run sync:schema && echo '\\n▶ [2/5] Regenerating types -> src/generated/methods.ts' && npm run generate:types && echo '\\n▶ [3/5] Regenerating RPC map -> src/generated/rpc-map.ts' && npm run generate:rpc-map && echo '\\n▶ [4/5] Compiling -> dist/ (fails here if a method was REMOVED and appsflyer-sdk.ts still calls it)' && tsc && echo '\\n▶ [5/5] Checking every schema method is exposed in src/appsflyer-sdk.ts (catches methods ADDED to the schema but not wired into the SDK)' && npx jest test/sdk-coverage.test.ts test/schema.test.ts && echo '\\n✔ Update complete.'","prepare":"npm run build","typecheck":"tsc --noEmit","sync:schema":"node scripts/sync-schema.js","generate:types":"node scripts/generate-types.js","prepublishOnly":"npm run build","generate:rpc-map":"node scripts/generate-rpc-map.js","generate:sdk-boilerplate":"node scripts/generate-sdk-boilerplate.js"},"_npmUser":{"name":"GitHub Actions","email":"npm-oidc-no-reply@github.com","trustedPublisher":{"id":"github","oidcConfigId":"oidc:3fccec72-fb84-4efe-868c-f135cab0de92"}},"_npmVersion":"11.17.0","description":"Shared JS/TS RPC client core for AppsFlyer SDK 7 plugins (Capacitor, React Native, Cordova)","directories":{},"_nodeVersion":"24.19.0","_hasShrinkwrap":false,"devDependencies":{"jest":"^29.7.0","ts-jest":"^29.2.5","typescript":"^5.5.4","@types/jest":"^29.5.14","@types/node":"^20.14.0"},"_npmOperationalInternal":{"tmp":"tmp/js-core-plugin_7.0.14_1787565512506_0.16436427735516812","host":"s3://npm-registry-packages-npm-production"}},"7.0.15":{"name":"@appsflyer-sdk/js-core-plugin","version":"7.0.15","license":"MIT","_id":"@appsflyer-sdk/js-core-plugin@7.0.15","maintainers":[{"name":"af-obodovskyi","email":"ivan.obodovskyi@appsflyer.com"},{"name":"al-af","email":"amit.levy@appsflyer.com"},{"name":"andrii.dudka","email":"andrii.dudka@appsflyer.com"},{"name":"pazlavi","email":"paz.lavi@appsflyer.com"},{"name":"af-fess","email":"maxim@appsflyer.com"},{"name":"af-tlozovyi","email":"taras.lozovyi@appsflyer.com"}],"dist":{"shasum":"0341d11bbddc1b7a13d9cc25f4015b6cab38beb5","tarball":"https://registry.npmjs.org/@appsflyer-sdk/js-core-plugin/-/js-core-plugin-7.0.15.tgz","fileCount":16,"integrity":"sha512-YEp/GzYr+Ce4CF8x7U8prDgUVgcwHAcVsSYJh9vWX34nFrqzA7xI9sQ7mHU2zpabNmRmakzWlOxT7RqwnVqB/A==","signatures":[{"sig":"MEQCIFuaTvlBt0or3k6rPBtD1aDe38XA1XA3rEY0NuqDHgRmAiA+bzQyBjTdYkYhZfp0Ij4oRkRP2Y84oX5LHAHMaRJmfw==","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":78535},"main":"dist/index.js","types":"dist/index.d.ts","gitHead":"4f9e7d7b60cdab8344b69f33249f3bdfa8779417","scripts":{"test":"jest","build":"npm run generate:types && npm run generate:rpc-map && tsc","update":"echo '\\n▶ [1/5] Pulling latest RPC schema from GitLab -> schema/appsflyer-plugins-rpc-schema.json' && npm run sync:schema && echo '\\n▶ [2/5] Regenerating types -> src/generated/methods.ts' && npm run generate:types && echo '\\n▶ [3/5] Regenerating RPC map -> src/generated/rpc-map.ts' && npm run generate:rpc-map && echo '\\n▶ [4/5] Compiling -> dist/ (fails here if a method was REMOVED and appsflyer-sdk.ts still calls it)' && tsc && echo '\\n▶ [5/5] Checking every schema method is exposed in src/appsflyer-sdk.ts (catches methods ADDED to the schema but not wired into the SDK)' && npx jest test/sdk-coverage.test.ts test/schema.test.ts && echo '\\n✔ Update complete.'","prepare":"npm run build","typecheck":"tsc --noEmit","sync:schema":"node scripts/sync-schema.js","generate:types":"node scripts/generate-types.js","prepublishOnly":"npm run build","generate:rpc-map":"node scripts/generate-rpc-map.js","generate:sdk-boilerplate":"node scripts/generate-sdk-boilerplate.js"},"_npmUser":{"name":"GitHub Actions","email":"npm-oidc-no-reply@github.com","trustedPublisher":{"id":"github","oidcConfigId":"oidc:3fccec72-fb84-4efe-868c-f135cab0de92"}},"_npmVersion":"11.17.0","description":"Shared JS/TS RPC client core for AppsFlyer SDK 7 plugins (Capacitor, React Native, Cordova)","directories":{},"_nodeVersion":"24.19.0","_hasShrinkwrap":false,"devDependencies":{"jest":"^29.7.0","ts-jest":"^29.2.5","typescript":"^5.5.4","@types/jest":"^29.5.14","@types/node":"^20.14.0"},"_npmOperationalInternal":{"tmp":"tmp/js-core-plugin_7.0.15_1787727298921_0.3573413120400981","host":"s3://npm-registry-packages-npm-production"}},"7.1.0":{"_id":"@appsflyer-sdk/js-core-plugin@7.1.0","dist":{"shasum":"2c1c4990c7157f3e780b32b0528655b83c9c17f0","tarball":"https://registry.npmjs.org/@appsflyer-sdk/js-core-plugin/-/js-core-plugin-7.1.0.tgz","fileCount":16,"integrity":"sha512-Gjni1Z67nBx1fpmMEXeAD6hnUradpAW8+vqQ1L1Bd071HqrBB2l6aXJby4cUvfStuyy2tf0PUYLLm0kc9EGZ1A==","signatures":[{"sig":"MEUCIQCPLfFnkeI1RyBFEYgXdDdYt+UbQ9cuzz37FUM2HvdXtgIgG22yWLBbQButtjjGjETxKCxIADO9QwwwGomQS60oe7w=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"},{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEUCIDdRC/wxQ8mQTmm4/1YDcBfROxkEL9k69aIBLc/Pt5jeAiEAgXJDeY39zmWAoxBcxu0sOR6K5ayhl275TZUhByKJwaY="}],"unpackedSize":80601},"main":"dist/index.js","name":"@appsflyer-sdk/js-core-plugin","types":"dist/index.d.ts","gitHead":"ce82befbc844c760e1d50e63d396a5ec23b5b86f","license":"MIT","scripts":{"test":"jest","build":"npm run generate:types && npm run generate:rpc-map && tsc","update":"echo '\\n▶ [1/5] Pulling latest RPC schema from GitLab -> schema/appsflyer-plugins-rpc-schema.json' && npm run sync:schema && echo '\\n▶ [2/5] Regenerating types -> src/generated/methods.ts' && npm run generate:types && echo '\\n▶ [3/5] Regenerating RPC map -> src/generated/rpc-map.ts' && npm run generate:rpc-map && echo '\\n▶ [4/5] Compiling -> dist/ (fails here if a method was REMOVED and appsflyer-sdk.ts still calls it)' && tsc && echo '\\n▶ [5/5] Checking every schema method is exposed in src/appsflyer-sdk.ts (catches methods ADDED to the schema but not wired into the SDK)' && npx jest test/sdk-coverage.test.ts test/schema.test.ts && echo '\\n✔ Update complete.'","prepare":"npm run build","typecheck":"tsc --noEmit","sync:schema":"node scripts/sync-schema.js","generate:types":"node scripts/generate-types.js","prepublishOnly":"npm run build","generate:rpc-map":"node scripts/generate-rpc-map.js","generate:sdk-boilerplate":"node scripts/generate-sdk-boilerplate.js"},"version":"7.1.0","_npmUser":{"name":"GitHub Actions","email":"npm-oidc-no-reply@github.com","trustedPublisher":{"id":"github","oidcConfigId":"oidc:3fccec72-fb84-4efe-868c-f135cab0de92"}},"_npmVersion":"11.19.0","description":"Shared JS/TS RPC client core for AppsFlyer SDK 7 plugins (Capacitor, React Native, Cordova)","directories":{},"maintainers":[{"name":"af-obodovskyi","email":"ivan.obodovskyi@appsflyer.com"},{"name":"al-af","email":"amit.levy@appsflyer.com"},{"name":"andrii.dudka","email":"andrii.dudka@appsflyer.com"},{"name":"pazlavi","email":"paz.lavi@appsflyer.com"},{"name":"af-fess","email":"maxim@appsflyer.com"},{"name":"af-tlozovyi","email":"taras.lozovyi@appsflyer.com"}],"_nodeVersion":"24.20.0","_hasShrinkwrap":false,"devDependencies":{"jest":"^29.7.0","ts-jest":"^29.2.5","typescript":"^5.5.4","@types/jest":"^29.5.14","@types/node":"^20.14.0"},"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/js-core-plugin_7.1.0_1788863309043_0.9081313042003176"}}},"time":{"created":"2026-08-10T09:38:01.992Z","modified":"2026-09-08T10:28:29.325Z","0.1.0":"2026-08-10T09:38:02.327Z","7.0.13":"2026-08-23T12:02:25.697Z","7.0.14":"2026-08-24T09:58:32.642Z","7.0.15":"2026-08-26T06:54:59.037Z","7.1.0":"2026-09-08T10:28:29.124Z"},"license":"MIT","description":"Shared JS/TS RPC client core for AppsFlyer SDK 7 plugins (Capacitor, React Native, Cordova)","maintainers":[{"name":"af-obodovskyi","email":"ivan.obodovskyi@appsflyer.com"},{"name":"al-af","email":"amit.levy@appsflyer.com"},{"name":"andrii.dudka","email":"andrii.dudka@appsflyer.com"},{"name":"pazlavi","email":"paz.lavi@appsflyer.com"},{"name":"af-fess","email":"maxim@appsflyer.com"},{"name":"af-tlozovyi","email":"taras.lozovyi@appsflyer.com"}],"readme":"# @appsflyer/plugin-core\n\nShared JS/TS RPC client core for AppsFlyer SDK 7 plugins (Capacitor, React Native, Cordova).\n\nSee `AppsFlyerSDK` (constructed with an `RpcTransport` implementation) for the public API,\nand `RpcTransport` in `src/types.ts` for the seam each framework's plugin repo implements.\n\nEvery `AppsFlyerSDK` method takes a single params object typed directly from\n`src/generated/methods.ts` (e.g. `logEvent(params: LogEventParams)`), generated from\n`schema/appsflyer-plugins-rpc-schema.json` — the method's wire payload is always exactly\nthat schema's `publicApi.parameters` shape, with no hand-written reshaping in between.\n\nThis package has no native code and no framework dependencies — it does not replace or remove the\nneed for each consuming plugin (Capacitor, Cordova, React Native, NativeScript, Cocos Creator) to\nhave its own iOS (Swift) and Android (Kotlin) native RPC implementation. This package is the\nshared JS-side contract layer: it resolves a public API call to the correct per-platform wire\nmethod/params (`resolveRpc()`, driven by the schema's `rpc.android`/`rpc.ios`/`mappings` blocks),\nbut every consuming plugin still owns, ships, and maintains its own native code that actually\nreceives that RPC call and talks to the native AppsFlyer SDK. Within this monorepo,\n`nativescript` and `cocos-creator` already depend on it directly (`\"@appsflyer/plugin-core\":\n\"file:../core\"`) and re-export its types/instance. `capacitor`, `cordova`, and `react-native`\ndeclare a dependency on `@appsflyer/plugin-core` too, but on a legacy path\n(`file:../../appsflyer-js-plugin-core`) left over from when each was a standalone repo — that\npath doesn't resolve to this package or exist anywhere in this monorepo, so those three are not\nactually wired to this package yet. Migrating them onto this package is Phase 2+ of the\nshared-library migration (see `capacitor-appsflyer-plugin-rpc`'s\n`docs/hld/2026-08-01-shared-js-rpc-plugin-library-hld.md`).\n\n## Session-ready ordering\n\n`init() → registerSessionReadyListener() → start()` is a documented convention, not something\n`AppsFlyerSDK` mechanically enforces. Calling `start()` before the session-ready callback has\nfired will not throw and will not queue the call for later — it sends the `start` RPC call to\nnative immediately, same as any other method. It is the caller's responsibility to wait for the\n`onReady` callback passed to `registerSessionReadyListener()` before calling `start()`, per SDK 7's\nmanual startup model.\n\n## Implementing a new transport correctly\n\nFollow these steps in order when wiring a new framework (or fixing an existing one) onto this package:\n\n1. **Implement `RpcTransport`** (`src/types.ts`) — the only seam this package requires:\n   - `call<T>(method, params)`: forward `method` and `params` to your native bridge exactly as given, with no reshaping, unwrapping, or key renaming. Resolve with the native response, or reject with a normalized `new AppsFlyerError(code, message)`.\n   - `subscribe(listener)`: wire your native bridge's persistent event channel and invoke `listener({ event, data, ... })` for every native event push. Return a `ListenerHandle` whose `remove()` tears the subscription down.\n2. **Construct one `AppsFlyerSDK` instance**: `new AppsFlyerSDK(new YourTransport(), { plugin: '<your-framework>', pluginVersion: '<your-package-version>' })`. This identity is reported to AppsFlyer's attribution backend via `setPluginInfo` — it must be your framework's own name/version, never plugin-core's.\n3. **Call methods using the generated params types only.** Every method takes exactly one params object typed by `<Method>Params` in `src/generated/methods.ts` (re-exported from the package root). Import the generated type and use it as-is — never hand-write your own options interface, and never guess a shape from an older API version, memory, or another framework's plugin. If the schema changes a method's shape, the generated type changes with it; that's the only place the shape lives.\n4. **Do not add per-platform special-casing in JS/TS.** Dual keys, nested-vs-flat shapes, and key renames between Android/iOS are encoded in `schema/appsflyer-plugins-rpc-schema.json`'s per-method `rpc.android`/`rpc.ios`/`mappings` blocks and must be handled by the native bridge itself. If you're about to write a JS shim that translates one shape into another before calling `transport.call()`, stop — that logic belongs in native code, or the schema needs updating instead.\n5. **Respect startup ordering**: call `init(...)`, then `registerSessionReadyListener(onReady)`, then call `start()` only from inside `onReady`. This is a convention, not something `AppsFlyerSDK` enforces — `start()` called early fires immediately rather than throwing or queuing.\n6. **Push the right event names** through `subscribe()`'s listener, matching each method's `publicApi.events` in the schema: `onSessionReady`, `onConversionDataSuccess`, `onConversionDataFail`, `onDeepLinkReceived`. Also forward the legacy `onDeepLinking` name defensively if your native side ever emits it — not every native bridge normalizes to one name.\n7. **Verify before calling it done**: if you touched the schema, run `npm run generate:types`; then `npm run typecheck` and `npm test` in `packages/core`. If you're a consuming package, rebuild plugin-core's `dist/` (`npm run build`) and re-typecheck your own package against it — a stale `dist/` will hide breakage that looks like a pass.\n\n## For AI agents\n\nRules for any coding agent implementing a new transport, or modifying `AppsFlyerSDK` after a schema change:\n\n**The contract**\n- `RpcTransport.call<T>(method, params)` forwards verbatim to the native bridge; `RpcTransport.subscribe(listener)` wires the persistent event channel and returns a `ListenerHandle`.\n- `AppsFlyerSDK` is constructed with a transport and a `PluginIdentity` (`{ plugin, pluginVersion }`) — this must be the consuming framework's own identity, never `js-plugin-core`/plugin-core's own package name or version.\n\n**Params — read, don't guess**\n- Every method's argument type is the generated `<Method>Params` interface in `src/generated/methods.ts`, exported from the package root. Import and use it directly.\n- Never hand-write a params/options interface. Never infer a method's shape from an older version of this SDK, another AppsFlyer plugin's naming convention, or memory of a prior session — read `src/generated/methods.ts` or `schema/appsflyer-plugins-rpc-schema.json` directly, every time.\n- If the schema changes, the generated type changes with it. Regenerate (`npm run generate:types`) before writing code against it.\n\n**No reshaping in JS**\n- Per-platform divergence (dual keys, nested vs. flat shapes, renamed fields) lives in the schema's `rpc.android`/`rpc.ios`/`mappings` blocks per method and is the native bridge's responsibility, not this package's or a consuming framework's JS layer.\n- Writing a JS/TS shim to translate one param shape into another before calling `transport.call()` is a signal you're solving the wrong layer — stop and either fix the native bridge or flag that the schema needs updating.\n\n**Startup and events**\n- Ordering: `init()` → `registerSessionReadyListener(onReady)` → `start()` called only inside `onReady`. This is a convention `AppsFlyerSDK` does not enforce; calling `start()` early fires immediately.\n- Required event names pushed through `subscribe()`: `onSessionReady`, `onConversionDataSuccess`, `onConversionDataFail`, `onDeepLinkReceived` — plus the legacy `onDeepLinking` name defensively, since not every native bridge normalizes to one name.\n- Normalize every native-side error to `new AppsFlyerError(code, message)` before rejecting a `call()` promise.\n\n**Before declaring anything done**\n- Schema changed → `npm run generate:types`.\n- Always → `npm run typecheck` and `npm test` in `packages/core`.\n- Modified a consuming package (e.g. `nativescript`, `cocos-creator`) → rebuild plugin-core's `dist/` (`npm run build`) first, then typecheck the consuming package against it. A stale `dist/` will hide real breakage.\n\n## Usage example\n\n```ts\nimport { AppsFlyerSDK, RpcTransport, RpcEvent, ListenerHandle } from '@appsflyer/plugin-core';\n\nclass ExampleTransport implements RpcTransport {\n  async call<T = void>(method: string, params?: Record<string, unknown>): Promise<T> {\n    // Forward to your framework's native bridge (Capacitor/RN/Cordova) here.\n    return undefined as T;\n  }\n  subscribe(listener: (event: RpcEvent) => void): ListenerHandle {\n    // Wire up your framework's native event channel here.\n    return { remove: () => {} };\n  }\n}\n\n// Each consuming framework supplies its own identity here — this is what\n// gets reported to AppsFlyer's attribution backend via setPluginInfo, so it\n// must NOT be plugin-core's own name/version.\nconst sdk = new AppsFlyerSDK(new ExampleTransport(), {\n  plugin: 'capacitor',\n  pluginVersion: '1.0.0',\n});\n\nawait sdk.init({ devKey: 'DEV_KEY', appId: 'APP_ID' });\nawait sdk.registerSessionReadyListener(async () => {\n  await sdk.start();\n});\n```\n\n## Development\n\n- `npm run generate:types` — regenerate `src/generated/methods.ts` from `schema/appsflyer-plugins-rpc-schema.json`\n- `npm run generate:rpc-map` — regenerate `src/generated/rpc-map.ts` (the per-platform method/param\n  mapping table `resolveRpc()` reads) from the same schema\n- `node scripts/generate-sdk-boilerplate.js` — after changing the schema, prints a pass-through\n  stub for every method `src/appsflyer-sdk.ts` doesn't wrap yet; paste each stub in by hand\n  (methods with a non-`void` result or custom listener/init logic still need manual typing).\n  Not run by `build` — it only prints, never writes.\n- `npm test` — run the Jest suite (all tests run against an in-memory `FakeTransport`, no native code)\n- `npm run typecheck` — `tsc --noEmit`\n- `npm run build` — generate types, generate the RPC map, then compile to `dist/`\n\nSee `docs/KNOWLEDGE_BASE.md` for a full file-by-file breakdown and flow diagrams.\n","readmeFilename":"README.md"}