From e4161b309b8c9e7e20d9bd4fe25c949a2f54146b Mon Sep 17 00:00:00 2001 From: Jade Date: Fri, 22 Aug 2025 12:10:24 +0000 Subject: [PATCH] feat: release --- CHANGELOG.md | 40 ++++++++++++++++++++++++++++++++++++++++ MainSDK.js | 17 ++++++++++++----- lib/client.js | 10 ++++++---- package.json | 23 +++++++---------------- 4 files changed, 65 insertions(+), 25 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index d5a70e5..05671e2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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) diff --git a/MainSDK.js b/MainSDK.js index 79a6d6c..6e5a0ce 100644 --- a/MainSDK.js +++ b/MainSDK.js @@ -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, }, @@ -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) }) } @@ -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() { diff --git a/lib/client.js b/lib/client.js index 8c8afe1..516a5b9 100644 --- a/lib/client.js +++ b/lib/client.js @@ -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(); @@ -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 } /** diff --git a/package.json b/package.json index 648e056..67311bc 100644 --- a/package.json +++ b/package.json @@ -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" }, @@ -16,8 +17,7 @@ "@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", @@ -25,10 +25,9 @@ "@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" }, @@ -36,24 +35,16 @@ "@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$": "/node_modules/react-native/jest/preprocessor.js" - }, - "transformIgnorePatterns": [ - "node_modules/(?!(jest-)?react-native|@react-native|@react-navigation)" - ] - }, "publishConfig": { "access": "public" },