customerio / customerio-reactnative

MIT License
23 stars 11 forks source link

chore: initializing react native package #294

Closed ami-aman closed 1 month ago

ami-aman commented 1 month ago

Linear ticket https://linear.app/customerio/issue/MBL-444/initialize-react-native-package

Problem

As a react native CDP user I want to initialize the package using cdpApiKey and other config options as available. This should apply to both migrating users and new adopters. For migrating users, it is expected that they provide migrationSiteId. As this property is optional and is not added in configuration then native module will skip processing any unprocessed tasks in the queue and migration will not happen.

Exclusions

About this PR

This PR :

Solution

Use package configuration to initialize the package.

Use case

import {
  CioLogLevel, CioRegion, CustomerIO, CioConfig
} from 'customerio-reactnative';

const config: CioConfig = {
    cdpApiKey: 'cdp_api_key', // Mandatory
    migrationSiteId: 'site_id', // For migration
    region: CioRegion.US,
    logLevel: CioLogLevel.Debug,
    trackApplicationLifecycleEvents: true,
    inApp: {
        siteId: 'site_id', // this removes the use of enableInApp and simplifies in-app configuration
    }
 };
CustomerIO.initialize(config)

Testing

The current flow of the modules is broken, making testing of the changes not possible at this time. Testing will be carried out at the end of this milestone, consolidated into a single branch and PR.​

ami-aman commented 1 month ago

Closing this PR as rebasing to feature/cdp/milestone-one introduces several changes as the current feature branch is based on feature/cdp/project-setup. Will open new PR.