1.0.61 • Published 4 months ago

@aidc/account-rn v1.0.61

Weekly downloads
-
License
-
Repository
-
Last release
4 months ago

账户中心 React Native SDK

安装依赖

必须使用 expo install 安装。

# 安装 peerDependencies
$ npx expo install @react-native-async-storage/async-storage@~2.1.0 @react-native-firebase/analytics@~22.0.0 @react-native-firebase/app@~22.0.0 @react-native-firebase/auth@~22.0.0 @react-native-google-signin/google-signin@~13.2.0 expo-apple-authentication@~7.1.0 expo-build-properties@~0.13.0 expo-tracking-transparency@~5.1.0 react-native-adjust@~5.1.0

# 安装 SDK
$ npx expo install @aidc/account-rn

修改配置

在上一步安装依赖时,会自动添加一些插件,在这里可以都删掉。

然后在 app.json 里添加 SDK 插件。

{
  "expo": {
    "plugins": ["@aidc/account-rn"]
  }
}

重新预构建一下,再启动应用。

$ npx expo prebuild --clean
$ npx expo run:ios # 或 npx expo run:android

初始化

import { setAccountConfig } from '@aidc/account-rn';

setAccountConfig({
  env: 'prod', // 指定环境
  appId: 'your-app-id', // 由账户中心生成
  appVersion: 'your-app-version', // 当前 App 版本号
  adjustAppToken: 'your-adjust-app-token', // 可选,用于开启 Adjust 广告追踪
});

账户 API

判断邮箱是否注册

import { isEmailExist } from '@aidc/account-rn';

const isEmailExist = await isEmailExist(email);

邮箱密码注册

import { registerWithEmailAndPassword } from '@aidc/account-rn';

const { user, isAppNewUser } = await registerWithEmailAndPassword(
  email,
  password,
);

邮箱密码登录

import { loginWithEmailAndPassword } from '@aidc/account-rn';

const { user, isAppNewUser } = await loginWithEmailAndPassword(email, password);

Google 授权登录

import { loginWithGoogle, loginWithApple } from '@aidc/account-rn';

const { user, isAppNewUser } = await loginWithGoogle();

Apple 授权登录

import { loginWithApple } from '@aidc/account-rn';

const { user, isAppNewUser } = await loginWithApple();

获取当前用户

import { getCurrentUser } from '@aidc/account-rn';

const user = await getCurrentUser();

获取当前用户的 session token

import { getCurrentSessionToken } from '@aidc/account-rn';

const sessionToken = await getCurrentSessionToken();

退出当前用户

import { logoutCurrentUser } from '@aidc/account-rn';

await logoutCurrentUser();

注销当前用户

import { deleteCurrentUser } from '@aidc/account-rn';

await deleteCurrentUser();

埋点 API

记录页面 PV

import { logPV } from '@aidc/account-rn';

// 记录商品详情页 PV
logPV('product_detail', {
  product_id: '123',
  product_name: 'product_name',
});

记录事件

import { logEvent } from '@aidc/account-rn';

// 记录点击商品事件
logEvent('press', 'product_item', {
  product_id: '123',
  product_name: 'product_name',
});

广告 API

记录事件

import { logAdjustEvent } from '@aidc/account-rn';

await logAdjustEvent('adjust-event-token');

更新 SKAN 转化值

import { updateAdjustConversionValue } from '@aidc/account-rn';

await updateAdjustConversionValue(1);
1.0.61

4 months ago

1.0.60

4 months ago

1.0.59

4 months ago

1.0.58

4 months ago

1.0.57

4 months ago

1.0.56

4 months ago

1.0.55

4 months ago

1.0.54

5 months ago

1.0.53

5 months ago

1.0.52

5 months ago

1.0.51

5 months ago

1.0.50

5 months ago

1.0.49

5 months ago

1.0.47

5 months ago

1.0.46

5 months ago

1.0.45

6 months ago

1.0.44

6 months ago

1.0.42

6 months ago

1.0.41

6 months ago

1.0.40

6 months ago

1.0.39

6 months ago

1.0.38

6 months ago

1.0.37

6 months ago

1.0.36

6 months ago

1.0.35

6 months ago

1.0.34

6 months ago

1.0.33

6 months ago

1.0.32

6 months ago

1.0.31

6 months ago

1.0.28

6 months ago

1.0.27

6 months ago

1.0.26

7 months ago

1.0.25

7 months ago

1.0.24

7 months ago

1.0.23

7 months ago

1.0.22

7 months ago

1.0.21

7 months ago

1.0.20

7 months ago

1.0.19

7 months ago

1.0.18

7 months ago

1.0.17

7 months ago

1.0.16

7 months ago

1.0.15

7 months ago

1.0.14

7 months ago

1.0.13

7 months ago

1.0.12

7 months ago

1.0.11

7 months ago

1.0.10

7 months ago

1.0.9

7 months ago

1.0.8

7 months ago

1.0.6

7 months ago

1.0.5

7 months ago

1.0.4

7 months ago

1.0.2

7 months ago

1.0.1

7 months ago

0.1.80

7 months ago

0.1.79

7 months ago

0.1.78

7 months ago

0.1.77

7 months ago

0.1.76

7 months ago

0.1.75

7 months ago

0.1.74

7 months ago

0.1.73

7 months ago

0.1.72

7 months ago

0.1.71

7 months ago

0.1.70

7 months ago

0.1.69

7 months ago

0.1.68

8 months ago

0.1.67

8 months ago

0.1.66

8 months ago

0.1.65

8 months ago

0.1.64

8 months ago

0.1.63

8 months ago

0.1.62

8 months ago

0.1.61

8 months ago

0.1.60

8 months ago

0.1.59

8 months ago

0.1.58

8 months ago

0.1.57

8 months ago

0.1.56

8 months ago

0.1.55

8 months ago

0.1.54

8 months ago

0.1.53

8 months ago

0.1.52

8 months ago

0.1.51

8 months ago

0.1.50

8 months ago

0.1.49

8 months ago

0.1.48

8 months ago

0.1.47

8 months ago

0.1.46

8 months ago

0.1.45

8 months ago

0.1.44

8 months ago

0.1.43

8 months ago

0.1.42

8 months ago

0.1.41

8 months ago

0.1.40

8 months ago

0.1.39

8 months ago

0.1.38

8 months ago

0.1.37

8 months ago

0.1.36

8 months ago

0.1.35

8 months ago

0.1.34

8 months ago

0.1.33

8 months ago

0.1.32

8 months ago

0.1.31

8 months ago

0.1.30

8 months ago

0.1.29

8 months ago

0.1.28

8 months ago

0.1.27

8 months ago

0.1.26

8 months ago

0.1.25

8 months ago

0.1.24

8 months ago

0.1.23

8 months ago

0.1.22

8 months ago

0.1.21

8 months ago

0.1.20

8 months ago

0.1.19

8 months ago

0.1.18

8 months ago

0.1.16

8 months ago

0.1.15

8 months ago

0.1.14

8 months ago

0.1.13

8 months ago

0.1.12

8 months ago

0.1.11

8 months ago

0.1.10

8 months ago

0.1.9

8 months ago

0.1.8

8 months ago

0.1.7

8 months ago