Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions frontend/common/code-help/create-user/create-user-ios.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,9 @@ func application(_ application: UIApplication,
[UIApplication.LaunchOptionsKey: Any]?) -> Bool {

Flagsmith.shared.apiKey = "${envId}"${
Constants.isCustomFlagsmithUrl() &&
`\n Flagsmith.shared.baseURL = "${Constants.getFlagsmithSDKUrl()}"\n`
Constants.isCustomFlagsmithUrl()
Comment thread
kyle-ssg marked this conversation as resolved.
? `\n Flagsmith.shared.baseURL = "${Constants.getFlagsmithSDKUrl()}"\n`
: ''
}

// This will create a user in the dashboard if they don't already exist
Expand Down
5 changes: 3 additions & 2 deletions frontend/common/code-help/create-user/create-user-java.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,11 @@ export default (
) => `${LIB_NAME_JAVA} ${LIB_NAME} = ${LIB_NAME_JAVA}
.newBuilder()
.setApiKey("${envId}")${
Constants.isCustomFlagsmithUrl() &&
`\n .withConfiguration(FlagsmithConfig.builder()
Constants.isCustomFlagsmithUrl()
Comment thread
kyle-ssg marked this conversation as resolved.
? `\n .withConfiguration(FlagsmithConfig.builder()
.baseUri("${Constants.getFlagsmithSDKUrl()}")
.build())`
: ''
}
.build();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ export default (
USER_ID,
},
userId,
) => `import Flagsmith from "${NPM_NODE_CLIENT}"; // Add this line if you're using ${LIB_NAME} via npm
) => `import { Flagsmith } from "${NPM_NODE_CLIENT}"; // Add this line if you're using ${LIB_NAME} via npm

const ${LIB_NAME} = new Flagsmith({${
Constants.isCustomFlagsmithUrl()
Expand Down
5 changes: 3 additions & 2 deletions frontend/common/code-help/create-user/create-user-php.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,9 @@ export default (
) => `use Flagsmith\\Flagsmith;

$flagsmith = new Flagsmith('${envId}'${
Constants.isCustomFlagsmithUrl() &&
`,\n '${Constants.getFlagsmithSDKUrl()}'\n`
Constants.isCustomFlagsmithUrl()
? `,\n '${Constants.getFlagsmithSDKUrl()}'\n`
: ''
});

// Identify the user
Expand Down
5 changes: 3 additions & 2 deletions frontend/common/code-help/create-user/create-user-ruby.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,9 @@ export default (

$flagsmith = Flagsmith::Client.new(
environment_key="${envId}"${
Constants.isCustomFlagsmithUrl() &&
`,\n api_url="${Constants.getFlagsmithSDKUrl()}"\n`
Constants.isCustomFlagsmithUrl()
? `,\n api_url="${Constants.getFlagsmithSDKUrl()}"\n`
: ''
})

// Identify the user
Expand Down
11 changes: 4 additions & 7 deletions frontend/common/code-help/create-user/create-user-rust.js
Original file line number Diff line number Diff line change
@@ -1,15 +1,12 @@
import Constants from 'common/constants'

export default (
envId,
{ FEATURE_NAME, FEATURE_NAME_ALT, USER_ID },
userId,
) => `
export default (envId, { FEATURE_NAME, FEATURE_NAME_ALT, USER_ID }, userId) => `
use flagsmith::{Flag, Flagsmith, FlagsmithOptions};

let options = FlagsmithOptions {${
Constants.isCustomFlagsmithUrl() &&
`api_url: "${Constants.getFlagsmithSDKUrl()}".to_string(),\n`
Constants.isCustomFlagsmithUrl()
? `api_url: "${Constants.getFlagsmithSDKUrl()}".to_string(),\n`
: ''
}..Default::default()};
let flagsmith = Flagsmith::new(
"${envId}".to_string(),
Expand Down
5 changes: 3 additions & 2 deletions frontend/common/code-help/traits/traits-java.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,11 @@ export default (
) => `${LIB_NAME_JAVA} ${LIB_NAME} = ${LIB_NAME_JAVA}
.newBuilder()
.setApiKey("${envId}")${
Constants.isCustomFlagsmithUrl() &&
`\n .withConfiguration(FlagsmithConfig.builder()
Constants.isCustomFlagsmithUrl()
? `\n .withConfiguration(FlagsmithConfig.builder()
.baseUri("${Constants.getFlagsmithSDKUrl()}")
.build())`
: ''
}
.build();

Expand Down
7 changes: 4 additions & 3 deletions frontend/common/code-help/traits/traits-node.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,12 @@ export default (
envId,
{ FEATURE_NAME, LIB_NAME, NPM_NODE_CLIENT, TRAIT_NAME, USER_ID },
userId,
) => `import Flagsmith from "${NPM_NODE_CLIENT}"; // Add this line if you're using ${LIB_NAME} via npm
) => `import { Flagsmith } from "${NPM_NODE_CLIENT}"; // Add this line if you're using ${LIB_NAME} via npm

const ${LIB_NAME} = new Flagsmith({${
Constants.isCustomFlagsmithUrl() &&
Comment thread
kyle-ssg marked this conversation as resolved.
`\n apiUrl: '${Constants.getFlagsmithSDKUrl()}',`
Constants.isCustomFlagsmithUrl()
? `\n apiUrl: '${Constants.getFlagsmithSDKUrl()}',`
: ''
}
environmentKey: '${envId}'
});
Expand Down
5 changes: 3 additions & 2 deletions frontend/common/code-help/traits/traits-php.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,9 @@ import Constants from 'common/constants'
export default (envId, { TRAIT_NAME }, userId) => `use Flagsmith\\Flagsmith;

$flagsmith = new Flagsmith('${envId}'${
Constants.isCustomFlagsmithUrl() &&
`,\n '${Constants.getFlagsmithSDKUrl()}'\n`
Constants.isCustomFlagsmithUrl()
? `,\n '${Constants.getFlagsmithSDKUrl()}'\n`
: ''
});

$traits = (object) [ '${TRAIT_NAME}' => 42 ];
Expand Down
5 changes: 3 additions & 2 deletions frontend/common/code-help/traits/traits-ruby.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,9 @@ export default (envId, { TRAIT_NAME }, userId) => `require "flagsmith"

$flagsmith = Flagsmith::Client.new(
environment_key="${envId}"${
Constants.isCustomFlagsmithUrl() &&
`,\n api_url="${Constants.getFlagsmithSDKUrl()}"\n`
Constants.isCustomFlagsmithUrl()
? `,\n api_url="${Constants.getFlagsmithSDKUrl()}"\n`
: ''
})

traits = {"${TRAIT_NAME}": 42}
Expand Down
5 changes: 3 additions & 2 deletions frontend/common/code-help/traits/traits-rust.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,9 @@ use flagsmith_flag_engine::types::{FlagsmithValue, FlagsmithValueType};
use flagsmith_flag_engine::identities::Trait;

let options = FlagsmithOptions {${
Constants.isCustomFlagsmithUrl() &&
`api_url: "${Constants.getFlagsmithSDKUrl()}".to_string(),\n`
Constants.isCustomFlagsmithUrl()
? `api_url: "${Constants.getFlagsmithSDKUrl()}".to_string(),\n`
: ''
}..Default::default()};
let flagsmith = Flagsmith::new(
"${envId}".to_string(),
Expand Down
Loading