Optional setup
Это содержимое пока не доступно на вашем языке.
After the basic configuration, you can customize initialization via chainable methods on AffiseSettingsApi or directly through the AffiseInitPropertiesType object.
Init properties
Section titled “Init properties”The AffiseInitPropertiesType type (src/AffiseInitProperties.ts:7-30) and the default values on AffiseInitProperties (src/AffiseInitProperties.ts:32-45):
| Field | Type | Default |
|---|---|---|
affiseAppId | string | required |
secretKey | string | required |
isProduction? | boolean | true (:35) |
partParamName? | string | null | null (:36) |
partParamNameToken? | string | null | null (:37) |
appToken? | string | null | null (:38) |
enabledMetrics? | boolean | false (:39) |
autoCatchingClickEvents? | AutoCatchingType[] | [] (:40) |
domain? | string | null | null (:41) |
onInitSuccessHandler? | OnInitSuccessHandler | null | null (:42) |
onInitErrorHandler? | OnInitErrorHandler | null | null (:43) |
configStrings | Record<AffiseConfig[keyof AffiseConfig & number], any> | null | {} (:44) |
disableModules | AffiseModules[] | null | [] (:45) |
Settings builder API
Section titled “Settings builder API”The full AffiseSettingsApi surface (src/settings/AffiseSettingsApi.ts):
setProduction(production: boolean): AffiseSettingsApi // :17setDomain(domain: string): AffiseSettingsApi // :25setPartParamName(partParamName: string): AffiseSettingsApi // :32setPartParamNameToken(partParamNameToken: string): AffiseSettingsApi // :39setAppToken(appToken: string): AffiseSettingsApi // :46setOnInitSuccess(onInitSuccessHandler: OnInitSuccessHandler): AffiseSettingsApi // :65setOnInitError(onInitErrorHandler: OnInitErrorHandler): AffiseSettingsApi // :70setConfigValue(key: AffiseConfig, value: any): AffiseSettingsApi // :74setConfigValues(values: Record<AffiseConfig, any>): AffiseSettingsApi // :79setDisableModules(disableModules: AffiseModules[]): AffiseSettingsApi // :84start(): void // :89Custom domain
Section titled “Custom domain”setDomain(domain: string) overrides the default Affise endpoint. Trailing slash is irrelevant (src/settings/AffiseSettings.ts:54, AffiseSettingsApi.ts:22). Example from:
Affise .settings({ affiseAppId: 'Your appId', secretKey: 'Your SDK secretKey', }) .setDomain("https://YoureCustomDomain/") // Set custom domain .start(); // Start Affise SDKInit callbacks
Section titled “Init callbacks”Callback type aliases (src/settings/OnInitSuccessHandler.ts:1, src/settings/OnInitErrorHandler.ts:1):
export type OnInitSuccessHandler = () => void;export type OnInitErrorHandler = (e: string) => void;Register handlers via setOnInitSuccess / setOnInitError (src/settings/AffiseSettingsApi.ts:65, :70; impl src/settings/AffiseSettings.ts:115-126). Internally the handlers are wired via AffiseApiMethod.ON_INIT_SUCCESS_HANDLER ("on_init_success_handler") and ON_INIT_ERROR_HANDLER ("on_init_error_handler") (src/native/AffiseApiMethod.ts:27-28, src/native/AffiseNative.ts:43-51).
Affise .settings({ affiseAppId: "Your appId", secretKey: "Your SDK secretKey", }) .setOnInitSuccess(() => { // Called if library initialization succeeded console.log(`Affise: init success`); }) .setOnInitError((error) => { // Called if library initialization failed console.log(`Affise: init error ${error}`); }) .start(); // Start Affise SDKConfig values
Section titled “Config values”The AffiseConfig enum currently declares one string key (src/settings/AffiseConfig.ts:1-3):
export enum AffiseConfig { FB_APP_ID = "fb_app_id",}Use setConfigValue(AffiseConfig.FB_APP_ID, '<id>') or setConfigValues({...}). Internally values land in configStrings: Record<string, any>, so other server-recognised keys may also work.
Disable modules
Section titled “Disable modules”Prevent specific modules from starting by listing them in setDisableModules([...]) (src/settings/AffiseSettingsApi.ts:84). Values come from the AffiseModules enum (src/module/AffiseModules.ts:1-18):
ADSERVICE,ADVERTISING,ANDROIDID,APPSFLYER,LINK,META,NETWORK,PERSISTENT,PHONE,STATUS,SUBSCRIPTION,RUSTORE,HUAWEI,GOOGLE,HARDWARE,TIKTOK(GOOGLEadded in 1.7.8,HARDWAREin 1.7.18).
See modules for what each module contributes.
Secret key rotation
Section titled “Secret key rotation”Affise.setSecretKey(secretKey: string) (src/index.ts:77-79) updates the secret at runtime; maps to AffiseApiMethod.SET_SECRET_KEY = "set_secret_id" (src/native/AffiseApiMethod.ts:10).