From a2a9d1199b56b9cc8e2c45c1535c05538a65410d Mon Sep 17 00:00:00 2001 From: davidbielik Date: Wed, 29 Mar 2023 20:31:32 -0400 Subject: [PATCH 1/8] Update create.md --- .../platform_wide/feature_flags/create.md | 20 +++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/_docs/_developer_guide/platform_wide/feature_flags/create.md b/_docs/_developer_guide/platform_wide/feature_flags/create.md index 0bd3b32915b..787a1c85fb3 100644 --- a/_docs/_developer_guide/platform_wide/feature_flags/create.md +++ b/_docs/_developer_guide/platform_wide/feature_flags/create.md @@ -138,6 +138,16 @@ if (featureFlag.enabled) { } ``` {% endtab %} +{% tab React Native %} +```javascript +const featureFlag = await braze.getFeatureFlag("expanded_user_profile"); +if (featureFlag.enabled) { + console.log(`expanded_user_profile is enabled`); +} else { + console.log(`expanded_user_profile is not enabled`); +} +``` +{% endtab %} {% endtabs %} ### Accessing properties {#accessing-properties} @@ -195,6 +205,16 @@ val booleanProperty = featureFlag.getBooleanProperty("expanded") val numberProperty = featureFlag.getNumberProperty("height") ``` {% endtab %} +{% tab React Native %} +```javascript +// string properties +const stringProperty = await braze.getFeatureFlagStringProperty("color"); +// boolean properties +const booleanProperty = await featureFlag.getFeatureFlagBooleanProperty("expanded"); +// number properties +const numberProperty = await featureFlag.getFeatureFlagNumberProperty("height"); +``` +{% endtab %} {% endtabs %} You can also get a list of all enabled feature flags: From 64a8ca98d690562e74026352ae63b9be5f9ac3b5 Mon Sep 17 00:00:00 2001 From: davidbielik Date: Wed, 29 Mar 2023 20:35:20 -0400 Subject: [PATCH 2/8] Update create.md --- .../platform_wide/feature_flags/create.md | 34 ++++++++++++++++--- 1 file changed, 30 insertions(+), 4 deletions(-) diff --git a/_docs/_developer_guide/platform_wide/feature_flags/create.md b/_docs/_developer_guide/platform_wide/feature_flags/create.md index 787a1c85fb3..0d5e2adede1 100644 --- a/_docs/_developer_guide/platform_wide/feature_flags/create.md +++ b/_docs/_developer_guide/platform_wide/feature_flags/create.md @@ -140,7 +140,7 @@ if (featureFlag.enabled) { {% endtab %} {% tab React Native %} ```javascript -const featureFlag = await braze.getFeatureFlag("expanded_user_profile"); +const featureFlag = await Braze.getFeatureFlag("expanded_user_profile"); if (featureFlag.enabled) { console.log(`expanded_user_profile is enabled`); } else { @@ -208,11 +208,11 @@ val numberProperty = featureFlag.getNumberProperty("height") {% tab React Native %} ```javascript // string properties -const stringProperty = await braze.getFeatureFlagStringProperty("color"); +const stringProperty = await Braze.getFeatureFlagStringProperty("color"); // boolean properties -const booleanProperty = await featureFlag.getFeatureFlagBooleanProperty("expanded"); +const booleanProperty = await Braze.getFeatureFlagBooleanProperty("expanded"); // number properties -const numberProperty = await featureFlag.getFeatureFlagNumberProperty("height"); +const numberProperty = await Braze.getFeatureFlagNumberProperty("height"); ``` {% endtab %} {% endtabs %} @@ -252,6 +252,14 @@ featureFlags.forEach { feature -> } ``` {% endtab %} +{% tab React Native %} +```javascript +const features = await Braze.getAllFeatureFlags(); +for(const feature of features) { + console.log(`Feature: ${feature.id}`, feature.enabled); +} +``` +{% endtab %} {% endtabs %} ### Refresh feature flags {#refreshing} @@ -293,6 +301,16 @@ braze.refreshFeatureFlags(); braze.refreshFeatureFlags() ``` {% endtab %} +{% tab React Native %} +```javascript +try { + await Braze.refreshFeatureFlags(); + console.log(`Feature flags have been refreshed.`); +} catch (e) { + console.log(`Failed to refresh feature flags.`, e); +} +``` +{% endtab %} {% endtabs %} @@ -343,6 +361,14 @@ braze.subscribeToFeatureFlagsUpdates() { event -> } ``` {% endtab %} +{% tab React Native %} +```javascript +// register an event listener +Braze.addListener(Braze.Events.FEATURE_FLAGS_UPDATED, (featureFlags) => { + console.log(`featureFlagUpdates`, JSON.stringify(featureFlags)); +}); +``` +{% endtab %} {% endtabs %} ## Best practices From 0a16765a1ee95d8ad322e6dc672d5d934d358bd6 Mon Sep 17 00:00:00 2001 From: davidbielik Date: Wed, 29 Mar 2023 20:45:32 -0400 Subject: [PATCH 3/8] Update create.md --- .../platform_wide/feature_flags/create.md | 19 +++++++------------ 1 file changed, 7 insertions(+), 12 deletions(-) diff --git a/_docs/_developer_guide/platform_wide/feature_flags/create.md b/_docs/_developer_guide/platform_wide/feature_flags/create.md index 0d5e2adede1..7728aa453ff 100644 --- a/_docs/_developer_guide/platform_wide/feature_flags/create.md +++ b/_docs/_developer_guide/platform_wide/feature_flags/create.md @@ -140,7 +140,7 @@ if (featureFlag.enabled) { {% endtab %} {% tab React Native %} ```javascript -const featureFlag = await Braze.getFeatureFlag("expanded_user_profile"); +const featureFlag = await braze.getFeatureFlag("expanded_user_profile"); if (featureFlag.enabled) { console.log(`expanded_user_profile is enabled`); } else { @@ -208,11 +208,11 @@ val numberProperty = featureFlag.getNumberProperty("height") {% tab React Native %} ```javascript // string properties -const stringProperty = await Braze.getFeatureFlagStringProperty("color"); +const stringProperty = await braze.getFeatureFlagStringProperty("color"); // boolean properties -const booleanProperty = await Braze.getFeatureFlagBooleanProperty("expanded"); +const booleanProperty = await braze.getFeatureFlagBooleanProperty("expanded"); // number properties -const numberProperty = await Braze.getFeatureFlagNumberProperty("height"); +const numberProperty = await braze.getFeatureFlagNumberProperty("height"); ``` {% endtab %} {% endtabs %} @@ -254,7 +254,7 @@ featureFlags.forEach { feature -> {% endtab %} {% tab React Native %} ```javascript -const features = await Braze.getAllFeatureFlags(); +const features = await braze.getAllFeatureFlags(); for(const feature of features) { console.log(`Feature: ${feature.id}`, feature.enabled); } @@ -303,12 +303,7 @@ braze.refreshFeatureFlags() {% endtab %} {% tab React Native %} ```javascript -try { - await Braze.refreshFeatureFlags(); - console.log(`Feature flags have been refreshed.`); -} catch (e) { - console.log(`Failed to refresh feature flags.`, e); -} +await braze.refreshFeatureFlags(); ``` {% endtab %} {% endtabs %} @@ -364,7 +359,7 @@ braze.subscribeToFeatureFlagsUpdates() { event -> {% tab React Native %} ```javascript // register an event listener -Braze.addListener(Braze.Events.FEATURE_FLAGS_UPDATED, (featureFlags) => { +braze.addListener(braze.Events.FEATURE_FLAGS_UPDATED, (featureFlags) => { console.log(`featureFlagUpdates`, JSON.stringify(featureFlags)); }); ``` From ad34a44b2450433401fad37f99e3305e52b69e1f Mon Sep 17 00:00:00 2001 From: davidbielik Date: Mon, 3 Apr 2023 10:06:02 -0400 Subject: [PATCH 4/8] Update _docs/_developer_guide/platform_wide/feature_flags/create.md Co-authored-by: Jeriel Ng --- _docs/_developer_guide/platform_wide/feature_flags/create.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/_docs/_developer_guide/platform_wide/feature_flags/create.md b/_docs/_developer_guide/platform_wide/feature_flags/create.md index 7728aa453ff..d077c622f92 100644 --- a/_docs/_developer_guide/platform_wide/feature_flags/create.md +++ b/_docs/_developer_guide/platform_wide/feature_flags/create.md @@ -208,7 +208,7 @@ val numberProperty = featureFlag.getNumberProperty("height") {% tab React Native %} ```javascript // string properties -const stringProperty = await braze.getFeatureFlagStringProperty("color"); +const stringProperty = await braze.getFeatureFlagStringProperty("my_flag", "color"); // boolean properties const booleanProperty = await braze.getFeatureFlagBooleanProperty("expanded"); // number properties From 6ed991deb2e8145478408381989ef9fd74b7d8dd Mon Sep 17 00:00:00 2001 From: davidbielik Date: Mon, 3 Apr 2023 10:09:14 -0400 Subject: [PATCH 5/8] Apply suggestions from code review Co-authored-by: Jeriel Ng --- _docs/_developer_guide/platform_wide/feature_flags/create.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/_docs/_developer_guide/platform_wide/feature_flags/create.md b/_docs/_developer_guide/platform_wide/feature_flags/create.md index d077c622f92..1e314961c47 100644 --- a/_docs/_developer_guide/platform_wide/feature_flags/create.md +++ b/_docs/_developer_guide/platform_wide/feature_flags/create.md @@ -210,9 +210,9 @@ val numberProperty = featureFlag.getNumberProperty("height") // string properties const stringProperty = await braze.getFeatureFlagStringProperty("my_flag", "color"); // boolean properties -const booleanProperty = await braze.getFeatureFlagBooleanProperty("expanded"); +const booleanProperty = await braze.getFeatureFlagBooleanProperty("my_flag', "expanded"); // number properties -const numberProperty = await braze.getFeatureFlagNumberProperty("height"); +const numberProperty = await braze.getFeatureFlagNumberProperty("my_flag", "height"); ``` {% endtab %} {% endtabs %} From 6e8dea377d4d3b7e25dd3861b0de76f741e61c9b Mon Sep 17 00:00:00 2001 From: davidbielik Date: Mon, 3 Apr 2023 10:10:17 -0400 Subject: [PATCH 6/8] Update _docs/_developer_guide/platform_wide/feature_flags/create.md Co-authored-by: Jeriel Ng --- _docs/_developer_guide/platform_wide/feature_flags/create.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/_docs/_developer_guide/platform_wide/feature_flags/create.md b/_docs/_developer_guide/platform_wide/feature_flags/create.md index 1e314961c47..c13de9fd857 100644 --- a/_docs/_developer_guide/platform_wide/feature_flags/create.md +++ b/_docs/_developer_guide/platform_wide/feature_flags/create.md @@ -210,7 +210,7 @@ val numberProperty = featureFlag.getNumberProperty("height") // string properties const stringProperty = await braze.getFeatureFlagStringProperty("my_flag", "color"); // boolean properties -const booleanProperty = await braze.getFeatureFlagBooleanProperty("my_flag', "expanded"); +const booleanProperty = await braze.getFeatureFlagBooleanProperty("my_flag", "expanded"); // number properties const numberProperty = await braze.getFeatureFlagNumberProperty("my_flag", "height"); ``` From 0e0a10e9b447cc58dd5391ef16fb33c08b5bf724 Mon Sep 17 00:00:00 2001 From: davidbielik Date: Mon, 3 Apr 2023 10:18:17 -0400 Subject: [PATCH 7/8] Update _docs/_developer_guide/platform_wide/feature_flags/create.md --- _docs/_developer_guide/platform_wide/feature_flags/create.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/_docs/_developer_guide/platform_wide/feature_flags/create.md b/_docs/_developer_guide/platform_wide/feature_flags/create.md index c13de9fd857..81033e57367 100644 --- a/_docs/_developer_guide/platform_wide/feature_flags/create.md +++ b/_docs/_developer_guide/platform_wide/feature_flags/create.md @@ -303,7 +303,7 @@ braze.refreshFeatureFlags() {% endtab %} {% tab React Native %} ```javascript -await braze.refreshFeatureFlags(); +braze.refreshFeatureFlags(); ``` {% endtab %} {% endtabs %} From 7e57297598c49f1cab7adc7ce5dc8920381a64ef Mon Sep 17 00:00:00 2001 From: davidbielik Date: Mon, 3 Apr 2023 10:50:53 -0400 Subject: [PATCH 8/8] Update create.md --- .../platform_wide/feature_flags/create.md | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/_docs/_developer_guide/platform_wide/feature_flags/create.md b/_docs/_developer_guide/platform_wide/feature_flags/create.md index 81033e57367..7783438bb4c 100644 --- a/_docs/_developer_guide/platform_wide/feature_flags/create.md +++ b/_docs/_developer_guide/platform_wide/feature_flags/create.md @@ -140,7 +140,7 @@ if (featureFlag.enabled) { {% endtab %} {% tab React Native %} ```javascript -const featureFlag = await braze.getFeatureFlag("expanded_user_profile"); +const featureFlag = await Braze.getFeatureFlag("expanded_user_profile"); if (featureFlag.enabled) { console.log(`expanded_user_profile is enabled`); } else { @@ -208,11 +208,11 @@ val numberProperty = featureFlag.getNumberProperty("height") {% tab React Native %} ```javascript // string properties -const stringProperty = await braze.getFeatureFlagStringProperty("my_flag", "color"); +const stringProperty = await Braze.getFeatureFlagStringProperty("my_flag", "color"); // boolean properties -const booleanProperty = await braze.getFeatureFlagBooleanProperty("my_flag", "expanded"); +const booleanProperty = await Braze.getFeatureFlagBooleanProperty("my_flag", "expanded"); // number properties -const numberProperty = await braze.getFeatureFlagNumberProperty("my_flag", "height"); +const numberProperty = await Braze.getFeatureFlagNumberProperty("my_flag", "height"); ``` {% endtab %} {% endtabs %} @@ -254,7 +254,7 @@ featureFlags.forEach { feature -> {% endtab %} {% tab React Native %} ```javascript -const features = await braze.getAllFeatureFlags(); +const features = await Braze.getAllFeatureFlags(); for(const feature of features) { console.log(`Feature: ${feature.id}`, feature.enabled); } @@ -303,7 +303,7 @@ braze.refreshFeatureFlags() {% endtab %} {% tab React Native %} ```javascript -braze.refreshFeatureFlags(); +Braze.refreshFeatureFlags(); ``` {% endtab %} {% endtabs %} @@ -359,7 +359,7 @@ braze.subscribeToFeatureFlagsUpdates() { event -> {% tab React Native %} ```javascript // register an event listener -braze.addListener(braze.Events.FEATURE_FLAGS_UPDATED, (featureFlags) => { +Braze.addListener(braze.Events.FEATURE_FLAGS_UPDATED, (featureFlags) => { console.log(`featureFlagUpdates`, JSON.stringify(featureFlags)); }); ```