Initialization

Here is how to initialize the Wepin React Native SDK.

Import SDK

import Wepin from '@wepin/react-native-sdk
const wepin = Wepin.getInstance()

Add the <Wepin.WidgetView> component to the main component and insert content inside it.

function App(): JSX.Element {
    ....
  return (
    <Wepin.WidgetView>
        ...
    </Wepin.WidgetView>
  )
}

init

await wepin.init(appId, appSdkKey[, attributes])

Initialize the Wepin instance.

Parameters

  • appId: String App ID assigned during registration

  • appKey: String App Key assigned during registration

  • attributes: IAttributes (optional) Properties of the Wepin Widget. It is defined in @wepin/types.

    • type: String It determines how the app widget window will be displayed on initial loading. The default value is hide. show: Show the widget window immediately after loading for the first time. hide: Hide the widget window initially when loading and show it later using openWindow().

    • defaultLanguage: String The language to be displayed on the widget. The default value is ko. The currently supported languages are en and ko.

    • defaultCurrency: String The currency to be displayed on the widget. The default value is KRW. The currently supported currencies are USD and KRW.

    • loginProviders: [String] Here is the list of login providers: google, apple, naver, and discord. Define and use only the necessary login providers. If you do not specify this value, all the four providers can be used by default.

      • The loginProviders parameter is supported from @wepin/types version v0.0.11 or higher.

Example

await wepin.init('APPID', 'APPKEY', {
  type: 'hide',
  defaultLanguage: 'en',
  defaultCurrency: 'USD',
  loginProviders: ['google', 'apple'],
})

isInitialized

wepin.isInitialized()

You can use the isInitialized method to check if the Wepin stance has been initialized successfully.

Returned value

  • <boolean>

    • init result; true if Wepin SDK is already initialized, otherwise false.

Last updated