From 67a00fd44d87d220828c7410431e87c1ba8a30dc Mon Sep 17 00:00:00 2001 From: Jonas Alves Date: Wed, 28 Jan 2026 12:21:25 +0000 Subject: [PATCH 1/3] feat: update Dart/Flutter SDK initialization to simplified API MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Updated Flutter/Dart initialization example to use new ABSmartly.create() factory - Simplified from multi-step ClientConfig creation to single factory call - Added comprehensive SDK options table including retries, timeout, contextEventLogger - Added advanced configuration section showing manual Client creation for custom use cases - Improved code clarity and developer experience - Maintained backwards compatibility Example change: Before: ClientConfig → Client → ABSmartlyConfig → ABSmartly After: ABSmartly.create(endpoint, apiKey, application, environment) --- .../_import-and-initialize.mdx | 41 ++++++++++++++++--- .../import-and-initialize/flutter/import.dart | 18 ++++---- 2 files changed, 43 insertions(+), 16 deletions(-) diff --git a/docs/APIs-and-SDKs/SDK-Documentation/getting-started/import-and-initialize/_import-and-initialize.mdx b/docs/APIs-and-SDKs/SDK-Documentation/getting-started/import-and-initialize/_import-and-initialize.mdx index defb8f01..a9c64ded 100644 --- a/docs/APIs-and-SDKs/SDK-Documentation/getting-started/import-and-initialize/_import-and-initialize.mdx +++ b/docs/APIs-and-SDKs/SDK-Documentation/getting-started/import-and-initialize/_import-and-initialize.mdx @@ -373,12 +373,41 @@ custom event logger), it can be done as following: **SDK Options** -| Config | Type | Required? | Default | Description | -| :---------- | :-------------------------------- | :-------: | :---------: | :---------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| endpoint | `string` | ✅ | `undefined` | The URL to your API endpoint. Most commonly `"your-company.absmartly.io"` | -| apiKey | `string` | ✅ | `undefined` | Your API key which can be found on the Web Console. | -| environment | `"production"` or `"development"` | ✅ | `undefined` | The environment of the platform where the SDK is installed. Environments are created on the Web Console and should match the available environments in your infrastructure. | -| application | `string` | ✅ | `undefined` | The name of the application where the SDK is installed. Applications are created on the Web Console and should match the applications where your experiments will be running. | +| Config | Type | Required? | Default | Description | +| :---------------------- | :-------------------------------- | :-------: | :---------: | :---------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| endpoint | `String` | ✅ | `null` | The URL to your API endpoint. Most commonly `"your-company.absmartly.io"` | +| apiKey | `String` | ✅ | `null` | Your API key which can be found on the Web Console. | +| environment | `String` | ✅ | `null` | The environment of the platform where the SDK is installed. Environments are created on the Web Console and should match the available environments in your infrastructure. | +| application | `String` | ✅ | `null` | The name of the application where the SDK is installed. Applications are created on the Web Console and should match the applications where your experiments will be running. | +| retries | `int` | ❌ | `5` | The number of retries before the SDK stops trying to connect. | +| timeout | `int` | ❌ | `3000` | An amount of time, in milliseconds, before the SDK will stop trying to connect. | +| contextEventLogger | `ContextEventLogger` | ❌ | `null` | A callback interface which runs after SDK events. See [Using a Custom Event Logger](#using-a-custom-event-logger) below | + +**Advanced Configuration** + +For advanced use cases where you need custom HTTP clients or data providers, you can still use the manual configuration approach: + +```dart +final clientConfig = ClientConfig() + ..setEndpoint("https://your-company.absmartly.io/v1") + ..setAPIKey("YOUR-API-KEY") + ..setApplication("website") + ..setEnvironment("development"); + +final httpClientConfig = DefaultHTTPClientConfig() + ..setMaxRetries(3) + ..setConnectTimeout(5000); + +final client = Client.create( + clientConfig, + httpClient: DefaultHTTPClient.create(httpClientConfig), +); + +final sdkConfig = ABSmartlyConfig.create() + ..setClient(client); + +final sdk = ABSmartly(sdkConfig); +``` diff --git a/docs/APIs-and-SDKs/SDK-Documentation/getting-started/import-and-initialize/flutter/import.dart b/docs/APIs-and-SDKs/SDK-Documentation/getting-started/import-and-initialize/flutter/import.dart index c49890cb..cf0e4500 100644 --- a/docs/APIs-and-SDKs/SDK-Documentation/getting-started/import-and-initialize/flutter/import.dart +++ b/docs/APIs-and-SDKs/SDK-Documentation/getting-started/import-and-initialize/flutter/import.dart @@ -1,11 +1,9 @@ -void main() async{ - final ClientConfig clientConfig = ClientConfig() - ..setEndpoint("https://your-company.absmartly.io/v1") - ..setAPIKey("YOUR API KEY") - ..setApplication("website") - ..setEnvironment("development"); - - final ABSmartlyConfig sdkConfig = ABSmartlyConfig.create() - .setClient(Client.create(clientConfig)); - final ABSmartly sdk = ABSmartly(sdkConfig); +void main() async { + // Recommended: Simple API + final sdk = ABSmartly.create( + endpoint: 'https://your-company.absmartly.io/v1', + apiKey: 'YOUR-API-KEY', + application: 'website', + environment: 'development', + ); } From c0943ec03a0c6bd8a5996ac4cb3bb88b2ccd4299 Mon Sep 17 00:00:00 2001 From: Jonas Alves Date: Wed, 28 Jan 2026 13:06:40 +0000 Subject: [PATCH 2/3] feat: add Dart, Rust, and Liquid SDK documentation with updated naming Add missing SDK tabs to import-and-initialize documentation: - Dart SDK with Absmartly.create() factory method and advanced config - Rust SDK with SDKConfig builder pattern and async/await examples - Liquid SDK for Shopify integration with server-side rendering Update naming convention from ABSmartly to Absmartly: - Flutter SDK now uses Absmartly.create() instead of ABSmartly.create() - React provider examples updated to use component - Dart advanced config uses Absmartly/AbsmartlyConfig naming Separate Dart from Flutter documentation to clarify pure Dart usage versus Flutter-specific implementation. --- .../_import-and-initialize.mdx | 139 +++++++++++++++++- .../import-and-initialize/dart/import.dart | 10 ++ .../import-and-initialize/flutter/import.dart | 3 +- .../liquid/initialize.liquid | 29 ++++ .../import-and-initialize/rust/initialize.rs | 15 ++ 5 files changed, 189 insertions(+), 7 deletions(-) create mode 100644 docs/APIs-and-SDKs/SDK-Documentation/getting-started/import-and-initialize/dart/import.dart create mode 100644 docs/APIs-and-SDKs/SDK-Documentation/getting-started/import-and-initialize/liquid/initialize.liquid create mode 100644 docs/APIs-and-SDKs/SDK-Documentation/getting-started/import-and-initialize/rust/initialize.rs diff --git a/docs/APIs-and-SDKs/SDK-Documentation/getting-started/import-and-initialize/_import-and-initialize.mdx b/docs/APIs-and-SDKs/SDK-Documentation/getting-started/import-and-initialize/_import-and-initialize.mdx index a9c64ded..bf682bc8 100644 --- a/docs/APIs-and-SDKs/SDK-Documentation/getting-started/import-and-initialize/_import-and-initialize.mdx +++ b/docs/APIs-and-SDKs/SDK-Documentation/getting-started/import-and-initialize/_import-and-initialize.mdx @@ -31,6 +31,12 @@ import RubyImport from "!!raw-loader!./ruby/import.rb"; import FlutterImport from "!!raw-loader!./flutter/import.dart"; +import DartImport from "!!raw-loader!./dart/import.dart"; + +import RustImport from "!!raw-loader!./rust/initialize.rs"; + +import LiquidImport from "!!raw-loader!./liquid/initialize.liquid"; + Once the SDK is installed, it can be initialized in your project. :::info @@ -102,9 +108,9 @@ directly into the Provider component, like so: ```jsx ReactDOM.render( - + - , + , document.getElementById("root") ); ``` @@ -367,7 +373,51 @@ custom event logger), it can be done as following: - + + +{DartImport} + +**SDK Options** + +| Config | Type | Required? | Default | Description | +| :---------------------- | :-------------------------------- | :-------: | :---------: | :---------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| endpoint | `String` | ✅ | `null` | The URL to your API endpoint. Most commonly `"your-company.absmartly.io"` | +| apiKey | `String` | ✅ | `null` | Your API key which can be found on the Web Console. | +| environment | `String` | ✅ | `null` | The environment of the platform where the SDK is installed. Environments are created on the Web Console and should match the available environments in your infrastructure. | +| application | `String` | ✅ | `null` | The name of the application where the SDK is installed. Applications are created on the Web Console and should match the applications where your experiments will be running. | +| retries | `int` | ❌ | `5` | The number of retries before the SDK stops trying to connect. | +| timeout | `int` | ❌ | `3000` | An amount of time, in milliseconds, before the SDK will stop trying to connect. | +| contextEventLogger | `ContextEventLogger` | ❌ | `null` | A callback interface which runs after SDK events. See [Using a Custom Event Logger](#using-a-custom-event-logger) below | + +**Advanced Configuration** + +For advanced use cases where you need custom HTTP clients or data providers, you can still use the manual configuration approach: + +```dart +final clientConfig = ClientConfig() + ..setEndpoint("https://your-company.absmartly.io/v1") + ..setAPIKey("YOUR-API-KEY") + ..setApplication("website") + ..setEnvironment("development"); + +final httpClientConfig = DefaultHTTPClientConfig() + ..setMaxRetries(3) + ..setConnectTimeout(5000); + +final client = Client.create( + clientConfig, + httpClient: DefaultHTTPClient.create(httpClientConfig), +); + +final sdkConfig = AbsmartlyConfig.create() + ..setClient(client); + +final sdk = Absmartly(sdkConfig); +``` + + + + {FlutterImport} @@ -403,10 +453,89 @@ final client = Client.create( httpClient: DefaultHTTPClient.create(httpClientConfig), ); -final sdkConfig = ABSmartlyConfig.create() +final sdkConfig = AbsmartlyConfig.create() ..setClient(client); -final sdk = ABSmartly(sdkConfig); +final sdk = Absmartly(sdkConfig); +``` + + + + + +{RustImport} + +**SDK Options** + +| Config | Type | Required? | Default | Description | +| :---------- | :----------------------------------- | :-------: | :-------------------------------------------------------------------: | :---------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| endpoint | `&str` or `String` | ✅ | `undefined` | The URL to your API endpoint. Most commonly `"your-company.absmartly.io"` | +| api_key | `&str` or `String` | ✅ | `undefined` | Your API key which can be found on the Web Console. | +| environment | `&str` or `String` | ✅ | `undefined` | The environment of the platform where the SDK is installed. Environments are created on the Web Console and should match the available environments in your infrastructure. | +| application | `&str` or `String` | ✅ | `undefined` | The name of the application where the SDK is installed. Applications are created on the Web Console and should match the applications where your experiments will be running. | +| retries | `u32` | ❌ | `5` | The number of retries before the SDK stops trying to connect. | +| timeout_ms | `u64` | ❌ | `3000` | An amount of time, in milliseconds, before the SDK will stop trying to connect. | +| agent | `String` | ❌ | `None` | Custom user agent string for HTTP requests. | + +**Builder Pattern** + +The Rust SDK supports a fluent builder pattern for optional configuration: + +```rust +let config = SDKConfig::new( + "https://your-company.absmartly.io/v1", + "YOUR-API-KEY", + "website", + "development", +) +.with_timeout(5000) +.with_retries(3) +.with_agent("my-app/1.0"); + +let sdk = Absmartly::new(config)?; +``` + + + + + +{LiquidImport} + +**SDK Options** + +| Config | Type | Required? | Default | Description | +| :---------- | :----------------------------------- | :-------: | :-------------------------------------------------------------------: | :---------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| endpoint | `string` | ✅ | `undefined` | The URL to your API endpoint. Most commonly `"your-company.absmartly.io"` | +| apiKey | `string` | ✅ | `undefined` | Your API key which can be found on the Web Console. | +| environment | `"production"` or `"development"` | ✅ | `undefined` | The environment of the platform where the SDK is installed. Environments are created on the Web Console and should match the available environments in your infrastructure. | +| application | `string` | ✅ | `undefined` | The name of the application where the SDK is installed. Applications are created on the Web Console and should match the applications where your experiments will be running. | +| units | `object` | ✅ | `{}` | An object containing unit identifiers (e.g., session_id, customer_id) used for experiment assignment. | + +**Server-Side Rendering** + +For Shopify Liquid templates, ABsmartly can be integrated server-side to pre-fetch context data: + +```liquid +{% comment %} + Render the ABsmartly initialization snippet + This can be used to embed pre-fetched context data +{% endcomment %} +{% render 'absmartly-init', + session_id: request.cookie.session_id, + customer_id: customer.id +%} +``` + +**Using ABsmartly in Templates** + +Once initialized, you can use ABsmartly treatments in your Liquid templates: + +```liquid +{% if absmartly.treatment.banner_color == 1 %} + +{% else %} + +{% endif %} ``` diff --git a/docs/APIs-and-SDKs/SDK-Documentation/getting-started/import-and-initialize/dart/import.dart b/docs/APIs-and-SDKs/SDK-Documentation/getting-started/import-and-initialize/dart/import.dart new file mode 100644 index 00000000..bb8a65fb --- /dev/null +++ b/docs/APIs-and-SDKs/SDK-Documentation/getting-started/import-and-initialize/dart/import.dart @@ -0,0 +1,10 @@ +import 'package:absmartly_sdk/absmartly_sdk.dart'; + +void main() async { + final sdk = Absmartly.create( + endpoint: 'https://your-company.absmartly.io/v1', + apiKey: 'YOUR-API-KEY', + application: 'website', + environment: 'development', + ); +} diff --git a/docs/APIs-and-SDKs/SDK-Documentation/getting-started/import-and-initialize/flutter/import.dart b/docs/APIs-and-SDKs/SDK-Documentation/getting-started/import-and-initialize/flutter/import.dart index cf0e4500..f60c7b9b 100644 --- a/docs/APIs-and-SDKs/SDK-Documentation/getting-started/import-and-initialize/flutter/import.dart +++ b/docs/APIs-and-SDKs/SDK-Documentation/getting-started/import-and-initialize/flutter/import.dart @@ -1,6 +1,5 @@ void main() async { - // Recommended: Simple API - final sdk = ABSmartly.create( + final sdk = Absmartly.create( endpoint: 'https://your-company.absmartly.io/v1', apiKey: 'YOUR-API-KEY', application: 'website', diff --git a/docs/APIs-and-SDKs/SDK-Documentation/getting-started/import-and-initialize/liquid/initialize.liquid b/docs/APIs-and-SDKs/SDK-Documentation/getting-started/import-and-initialize/liquid/initialize.liquid new file mode 100644 index 00000000..e0cd0971 --- /dev/null +++ b/docs/APIs-and-SDKs/SDK-Documentation/getting-started/import-and-initialize/liquid/initialize.liquid @@ -0,0 +1,29 @@ +{% comment %} + Initialize the ABsmartly SDK in your Shopify theme + Add this to your theme.liquid layout file, typically in the section +{% endcomment %} + + + +{% comment %} + Include the ABsmartly client-side SDK + This should be loaded before any code that uses the ABsmartly context +{% endcomment %} + + + diff --git a/docs/APIs-and-SDKs/SDK-Documentation/getting-started/import-and-initialize/rust/initialize.rs b/docs/APIs-and-SDKs/SDK-Documentation/getting-started/import-and-initialize/rust/initialize.rs new file mode 100644 index 00000000..bd2d455d --- /dev/null +++ b/docs/APIs-and-SDKs/SDK-Documentation/getting-started/import-and-initialize/rust/initialize.rs @@ -0,0 +1,15 @@ +use absmartly_sdk::{Absmartly, SDKConfig}; + +#[tokio::main] +async fn main() -> Result<(), Box> { + let config = SDKConfig::new( + "https://your-company.absmartly.io/v1", + "YOUR-API-KEY", + "website", + "development", + ); + + let sdk = Absmartly::new(config)?; + + Ok(()) +} From a2c7befec3d1767faefdf10ec98865a451a126a4 Mon Sep 17 00:00:00 2001 From: Jonas Alves Date: Wed, 28 Jan 2026 13:15:40 +0000 Subject: [PATCH 3/3] fix: update Absmartly to ABsmartly in SDK documentation - Updated all code examples to use correct naming: ABsmartly (AB uppercase) - Fixed references in Rust, Dart, Flutter, and Ruby SDK examples - Updated React component references in MDX documentation - Ensured consistency across all import and initialize documentation --- .../_import-and-initialize.mdx | 14 +++++++------- .../import-and-initialize/dart/import.dart | 2 +- .../import-and-initialize/flutter/import.dart | 2 +- .../import-and-initialize/ruby/import.rb | 2 +- .../import-and-initialize/rust/initialize.rs | 4 ++-- 5 files changed, 12 insertions(+), 12 deletions(-) diff --git a/docs/APIs-and-SDKs/SDK-Documentation/getting-started/import-and-initialize/_import-and-initialize.mdx b/docs/APIs-and-SDKs/SDK-Documentation/getting-started/import-and-initialize/_import-and-initialize.mdx index bf682bc8..b69a5c38 100644 --- a/docs/APIs-and-SDKs/SDK-Documentation/getting-started/import-and-initialize/_import-and-initialize.mdx +++ b/docs/APIs-and-SDKs/SDK-Documentation/getting-started/import-and-initialize/_import-and-initialize.mdx @@ -108,9 +108,9 @@ directly into the Provider component, like so: ```jsx ReactDOM.render( - + - , + , document.getElementById("root") ); ``` @@ -409,10 +409,10 @@ final client = Client.create( httpClient: DefaultHTTPClient.create(httpClientConfig), ); -final sdkConfig = AbsmartlyConfig.create() +final sdkConfig = ABsmartlyConfig.create() ..setClient(client); -final sdk = Absmartly(sdkConfig); +final sdk = ABsmartly(sdkConfig); ``` @@ -453,10 +453,10 @@ final client = Client.create( httpClient: DefaultHTTPClient.create(httpClientConfig), ); -final sdkConfig = AbsmartlyConfig.create() +final sdkConfig = ABsmartlyConfig.create() ..setClient(client); -final sdk = Absmartly(sdkConfig); +final sdk = ABsmartly(sdkConfig); ``` @@ -492,7 +492,7 @@ let config = SDKConfig::new( .with_retries(3) .with_agent("my-app/1.0"); -let sdk = Absmartly::new(config)?; +let sdk = ABsmartly::new(config)?; ``` diff --git a/docs/APIs-and-SDKs/SDK-Documentation/getting-started/import-and-initialize/dart/import.dart b/docs/APIs-and-SDKs/SDK-Documentation/getting-started/import-and-initialize/dart/import.dart index bb8a65fb..3d617b38 100644 --- a/docs/APIs-and-SDKs/SDK-Documentation/getting-started/import-and-initialize/dart/import.dart +++ b/docs/APIs-and-SDKs/SDK-Documentation/getting-started/import-and-initialize/dart/import.dart @@ -1,7 +1,7 @@ import 'package:absmartly_sdk/absmartly_sdk.dart'; void main() async { - final sdk = Absmartly.create( + final sdk = ABsmartly.create( endpoint: 'https://your-company.absmartly.io/v1', apiKey: 'YOUR-API-KEY', application: 'website', diff --git a/docs/APIs-and-SDKs/SDK-Documentation/getting-started/import-and-initialize/flutter/import.dart b/docs/APIs-and-SDKs/SDK-Documentation/getting-started/import-and-initialize/flutter/import.dart index f60c7b9b..d4cada21 100644 --- a/docs/APIs-and-SDKs/SDK-Documentation/getting-started/import-and-initialize/flutter/import.dart +++ b/docs/APIs-and-SDKs/SDK-Documentation/getting-started/import-and-initialize/flutter/import.dart @@ -1,5 +1,5 @@ void main() async { - final sdk = Absmartly.create( + final sdk = ABsmartly.create( endpoint: 'https://your-company.absmartly.io/v1', apiKey: 'YOUR-API-KEY', application: 'website', diff --git a/docs/APIs-and-SDKs/SDK-Documentation/getting-started/import-and-initialize/ruby/import.rb b/docs/APIs-and-SDKs/SDK-Documentation/getting-started/import-and-initialize/ruby/import.rb index dd792c8c..cbf7260c 100644 --- a/docs/APIs-and-SDKs/SDK-Documentation/getting-started/import-and-initialize/ruby/import.rb +++ b/docs/APIs-and-SDKs/SDK-Documentation/getting-started/import-and-initialize/ruby/import.rb @@ -1,4 +1,4 @@ -Absmartly.configure_client do |config| +ABsmartly.configure_client do |config| config.endpoint = "https://your-company.absmartly.io/v1" config.api_key = "YOUR-API-KEY" config.application = "website" diff --git a/docs/APIs-and-SDKs/SDK-Documentation/getting-started/import-and-initialize/rust/initialize.rs b/docs/APIs-and-SDKs/SDK-Documentation/getting-started/import-and-initialize/rust/initialize.rs index bd2d455d..78e06cce 100644 --- a/docs/APIs-and-SDKs/SDK-Documentation/getting-started/import-and-initialize/rust/initialize.rs +++ b/docs/APIs-and-SDKs/SDK-Documentation/getting-started/import-and-initialize/rust/initialize.rs @@ -1,4 +1,4 @@ -use absmartly_sdk::{Absmartly, SDKConfig}; +use absmartly_sdk::{ABsmartly, SDKConfig}; #[tokio::main] async fn main() -> Result<(), Box> { @@ -9,7 +9,7 @@ async fn main() -> Result<(), Box> { "development", ); - let sdk = Absmartly::new(config)?; + let sdk = ABsmartly::new(config)?; Ok(()) }