Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 40 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,43 @@
## 3.1.1 (2025-08-22)


### Bug Fixes

* **gcm:** message variability (544eb08)
* **sdk:** sid logic (#43) (570c075)


### Features

* add array to track wish request (da7bc28)
* add autoSendPushToken argument (2826b68)
* add blank search method (#40) (ff10756)
* add cart method (7a0dd8b)
* add custom properties to track purchase request (d58f5af)
* add date check (a9b7069)
* add excluded_merchants property to search types (#46) (0912cee)
* add function to send token after app initialization (7a7bd29)
* add functions to get and push token sent date in storage (75e5ce0)
* add new action step to identify base commit in master (95930a9)
* add persona-synchronization.yaml (17ddf01)
* add types (ffec1d5)
* add types to functions (1cf1b75)
* BREAKING CHANGE use @notifee/react-native for requesting alarm permissions (0e23088)
* check application initialization (152e928)
* check image_url (#44) (0cfcfab)
* **common:** bump version (ce7e70d)
* connect sdk to dev app (48788fa)
* move to sdk (85a1e1e)
* **sdk:** bump device-info (1d1f10e)
* **sdk:** getToken to use correct token (d07df14)
* **sdk:** remove notifee (71e7e79)
* **sdk:** rm jest (d0cce5d)
* **sdk:** sid token generation (4a34846)
* **sdk:** track mobile pushes (eadf5f4)
* swap auto-changelog for standard-changelog (ec88b46)



## 3.0.1 (2025-08-20)


Expand Down
17 changes: 12 additions & 5 deletions MainSDK.js
Original file line number Diff line number Diff line change
Expand Up @@ -120,12 +120,12 @@ class MainSDK extends Performer {
response.sid = response.seance = generateSid()
}
} else {
const did = Platform.OS === 'android' ? await DeviceInfo.getAndroidId() : (await DeviceInfo.syncUniqueId()) || '';
if (DEBUG) console.log('Device ID: ', did)

response = await request('init', this.shop_id, {
params: {
did:
Platform.OS === 'android'
? await DeviceInfo.getAndroidId()
: (await DeviceInfo.syncUniqueId()) || '',
did,
shop_id: this.shop_id,
stream: this.stream,
},
Expand All @@ -152,9 +152,11 @@ class MainSDK extends Performer {
isInit = () => this.initialized

getToken = () => {
return getSavedPushToken(this.shop_id).then((token) => {
return this.initPushToken().then((token) => {
if (DEBUG) console.log(token)
return token
}).catch((error) => {
console.error(error)
})
}

Expand Down Expand Up @@ -508,17 +510,22 @@ class MainSDK extends Performer {
return savedToken
}

let pushToken;

if (this._push_type === null && Platform.OS === 'ios') {
getAPNSToken(this.messaging).then((token) => {
if (DEBUG) console.log('New APN token: ', token)
this.setPushTokenNotification(token)
pushToken = token;
})
} else {
getToken(this.messaging).then((token) => {
if (DEBUG) console.log('New FCM token: ', token)
this.setPushTokenNotification(token)
pushToken = token;
})
}
return pushToken;
}

async initPushChannel() {
Expand Down
10 changes: 6 additions & 4 deletions lib/client.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,12 @@

import axios from "axios";
import AsyncStorage from "@react-native-async-storage/async-storage";
import DeviceInfo from 'react-native-device-info';
import { Platform } from 'react-native';
import { version } from "../package.json";
import { SESSION_CODE_EXPIRE } from "../index";
import { SDK_API_URL } from "../index";
import { DEBUG } from "../MainSDK";
import DataEncoder from "./utils";
import { Buffer } from 'buffer';
import { getStorageKey } from '../utils';

const encoder = new DataEncoder();
Expand Down Expand Up @@ -167,8 +165,12 @@ export async function updSeance(shop_id, did = '', seance = '') {
* @returns {string} The generated SID.
*/
export function generateSid() {
const Buffer = require("buffer").Buffer;
return new Buffer(String(Math.random())).toString("base64").replaceAll('=').substring(0, 10);
const sid = Buffer.from(String(Math.random()))
.toString("base64")
.replace(/=/g, '')
.substring(0, 10);

return sid
}

/**
Expand Down
23 changes: 7 additions & 16 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
{
"name": "@personaclick/rn-sdk",
"version": "3.0.1",
"version": "3.1.1",
"description": "PersonaClick React Native SDK",
"type": "module",
"exports": {
".": "./index.js"
},
Expand All @@ -16,44 +17,34 @@
"@PersonaClick/rn-sdk"
],
"dependencies": {
"axios": "^0.21.1",
"react-native-device-info": "^8.0.7"
"axios": "^0.21.1"
},
"devDependencies": {
"@jest/create-cache-key-function": "^26.6.2",
"@notifee/react-native": "9.1.8",
"@react-native-async-storage/async-storage": "1.22.0",
"@react-native-firebase/app": "^23",
"@react-native-firebase/messaging": "^23",
"@testing-library/jest-native": "^4.0.4",
"jest": "26.4.0",
"react": "^19.1.0",
"react-native": "^0.81.0",
"react-native-device-info": "^14.0.4",
"react-test-renderer": "^17.0.2",
"standard-changelog": "5.0.0"
},
"peerDependencies": {
"@notifee/react-native": "^9.1.8",
"@react-native-async-storage/async-storage": "^1.23.1",
"@react-native-firebase/app": "^23",
"@react-native-firebase/messaging": "^23"
"@react-native-firebase/messaging": "^23",
"react-native-device-info": "^14.0.4"
},
"directories": {
"lib": "lib"
},
"scripts": {
"test": "jest",
"test": "node --test",
"changelog": "standard-changelog --commit-path ."
},
"jest": {
"preset": "react-native",
"transform": {
"^.+\\.js$": "<rootDir>/node_modules/react-native/jest/preprocessor.js"
},
"transformIgnorePatterns": [
"node_modules/(?!(jest-)?react-native|@react-native|@react-navigation)"
]
},
"publishConfig": {
"access": "public"
},
Expand Down