diff --git a/packages/core/src/analytics.ts b/packages/core/src/analytics.ts index 401c2ac24..ab1a744bd 100644 --- a/packages/core/src/analytics.ts +++ b/packages/core/src/analytics.ts @@ -22,10 +22,10 @@ import { Context, DeepPartial, GroupTraits, + IntegrationSettings, JsonMap, PluginType, SegmentAPIIntegrations, - SegmentAPISettings, SegmentEvent, UpdateType, UserInfoState, @@ -351,20 +351,23 @@ export class SegmentClient { /** * Adds a new plugin to the currently loaded set. - * @param {{ plugin: Plugin, settings?: SegmentAPISettings }} Plugin to be added. Settings are optional if you want to force a configuration instead of the Segment Cloud received one + * @param {{ plugin: Plugin, settings?: IntegrationSettings }} Plugin to be added. Settings are optional if you want to force a configuration instead of the Segment Cloud received one */ - add({ + add
({ plugin, settings, }: { - plugin: Plugin; - settings?: Plugin extends DestinationPlugin ? SegmentAPISettings : never; + plugin: P; + settings?: P extends DestinationPlugin ? IntegrationSettings : never; }) { // plugins can either be added immediately or // can be cached and added later during the next state update // this is to avoid adding plugins before network requests made as part of setup have resolved if (settings !== undefined && plugin.type === PluginType.destination) { - this.store.settings.add((plugin as DestinationPlugin).key, settings); + this.store.settings.add( + (plugin as unknown as DestinationPlugin).key, + settings + ); } if (!this.store.isReady.get()) { diff --git a/packages/plugins/plugin-appsflyer/src/AppsflyerPlugin.tsx b/packages/plugins/plugin-appsflyer/src/AppsflyerPlugin.tsx index ac905f77b..c64fa354c 100644 --- a/packages/plugins/plugin-appsflyer/src/AppsflyerPlugin.tsx +++ b/packages/plugins/plugin-appsflyer/src/AppsflyerPlugin.tsx @@ -85,7 +85,7 @@ export class AppsflyerPlugin extends DestinationPlugin { }, }; - if (is_first_launch === 'true') { + if (JSON.parse(is_first_launch) === true) { if (af_status === 'Non-organic') { this.analytics?.track('Install Attributed', properties); } else {