Skip to content

Commit

Permalink
Merge pull request #159 from shayan-deriv/shayan/fix-growthbook-incor…
Browse files Browse the repository at this point in the history
…rect-logged-in-status

fix: fix the condition check for undefined
  • Loading branch information
prince-deriv authored Jan 30, 2025
2 parents f4d14a1 + 2facf19 commit de7822e
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 32 deletions.
30 changes: 15 additions & 15 deletions src/analytics.ts
Original file line number Diff line number Diff line change
Expand Up @@ -171,21 +171,21 @@ export function createAnalyticsInstance(options?: Options) {

core_data = {
...core_data,
...(country && { country }),
...(geo_location && { geo_location }),
...(user_language && { user_language }),
...(account_type && { account_type }),
...(app_id && { app_id }),
...(residence_country && { residence_country }),
...(device_type && { device_type }),
...(url && { url }),
...(loggedIn && { loggedIn }),
...(network_downlink && { network_downlink }),
...(network_rtt && { network_rtt }),
...(network_type && { network_type }),
...(user_id && { user_id }),
...(anonymous_id && { anonymous_id }),
...(account_currency && { account_currency }),
...(country !== undefined && { country }),
...(geo_location !== undefined && { geo_location }),
...(user_language !== undefined && { user_language }),
...(account_type !== undefined && { account_type }),
...(app_id !== undefined && { app_id }),
...(residence_country !== undefined && { residence_country }),
...(device_type !== undefined && { device_type }),
...(url !== undefined && { url }),
...(loggedIn !== undefined && { loggedIn }),
...(network_downlink !== undefined && { network_downlink }),
...(network_rtt !== undefined && { network_rtt }),
...(network_type !== undefined && { network_type }),
...(user_id !== undefined && { user_id }),
...(anonymous_id !== undefined && { anonymous_id }),
...(account_currency !== undefined && { account_currency }),
}
}

Expand Down
34 changes: 17 additions & 17 deletions src/growthbook.ts
Original file line number Diff line number Diff line change
Expand Up @@ -103,23 +103,23 @@ export class Growthbook {
this.GrowthBook.setAttributes({
...CURRENT_ATTRIBUTES,
id,
...(user_id && { user_id }),
...(anonymous_id && { anonymous_id }),
...(country && { country }),
...(residence_country && { residence_country }),
...(user_language && { user_language }),
...(device_language && { device_language }),
...(device_type && { device_type }),
...(utm_source && { utm_source }),
...(utm_medium && { utm_medium }),
...(utm_campaign && { utm_campaign }),
...(is_authorised && { is_authorised }),
...(url && { url }),
...(domain && { domain }),
...(utm_content && { utm_content }),
...(loggedIn && { loggedIn }),
...(network_type && { network_type }),
...(network_downlink && { network_downlink }),
...(user_id !== undefined && { user_id }),
...(anonymous_id !== undefined && { anonymous_id }),
...(country !== undefined && { country }),
...(residence_country !== undefined && { residence_country }),
...(user_language !== undefined && { user_language }),
...(device_language !== undefined && { device_language }),
...(device_type !== undefined && { device_type }),
...(utm_source !== undefined && { utm_source }),
...(utm_medium !== undefined && { utm_medium }),
...(utm_campaign !== undefined && { utm_campaign }),
...(is_authorised !== undefined && { is_authorised }),
...(url !== undefined && { url }),
...(domain !== undefined && { domain }),
...(utm_content !== undefined && { utm_content }),
...(loggedIn !== undefined && { loggedIn }),
...(network_type !== undefined && { network_type }),
...(network_downlink !== undefined && { network_downlink }),
})
}
getFeatureValue = <K extends keyof GrowthbookConfigs, V extends GrowthbookConfigs[K]>(key: K, defaultValue: V) => {
Expand Down

0 comments on commit de7822e

Please sign in to comment.