Skip to content

[MOB-11175] make-rn-sdk-compatible-with-expo #629

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 15 commits into from
Apr 10, 2025
Merged
Show file tree
Hide file tree
Changes from 12 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
2 changes: 1 addition & 1 deletion .nvmrc
Original file line number Diff line number Diff line change
@@ -1 +1 @@
v18
v20.19.0
4 changes: 1 addition & 3 deletions babel.config.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
module.exports = {
presets: [
['module:react-native-builder-bob/babel-preset', { modules: 'commonjs' }],
],
presets: ['module:react-native-builder-bob/babel-preset'],
};
1 change: 1 addition & 0 deletions example/Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,4 @@ ruby ">= 2.6.10"
# Exclude problematic versions of cocoapods and activesupport that causes build failures.
gem 'cocoapods', '>= 1.13', '!= 1.15.0', '!= 1.15.1'
gem 'activesupport', '>= 6.1.7.5', '!= 7.1.0'
gem 'concurrent-ruby', '< 1.3.4'
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Expected a newline at the end of the file.

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Final newline missing. [rubocop:Layout/TrailingEmptyLines]

30 changes: 12 additions & 18 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,19 +3,14 @@
"version": "2.0.0-beta",
"description": "Iterable SDK for React Native.",
"source": "./src/index.tsx",
"main": "./lib/commonjs/index.js",
"module": "./lib/module/index.js",
"main": "./lib/module/index.js",
"types": "./lib/typescript/src/index.d.ts",
"exports": {
".": {
"import": {
"types": "./lib/typescript/module/src/index.d.ts",
"types": "./lib/typescript/src/index.d.ts",
"default": "./lib/module/index.js"
},
"require": {
"types": "./lib/typescript/commonjs/src/index.d.ts",
"default": "./lib/commonjs/index.js"
}
}
"./package.json": "./package.json"
},
"files": [
"src",
Expand Down Expand Up @@ -93,7 +88,7 @@
"prettier": "^3.0.3",
"react": "18.3.1",
"react-native": "0.75.3",
"react-native-builder-bob": "^0.30.2",
"react-native-builder-bob": "^0.40.4",
"react-native-safe-area-context": "^4.11.1",
"react-native-vector-icons": "^10.2.0",
"react-native-webview": "^13.12.3",
Expand All @@ -115,6 +110,12 @@
"react-native-vector-icons": "*",
"react-native-webview": "*"
},
"peerDependenciesMeta": {
"expo": {
"optional": true
}
},
"sideEffects": false,
"workspaces": [
"example"
],
Expand Down Expand Up @@ -145,12 +146,6 @@
"source": "src",
"output": "lib",
"targets": [
[
"commonjs",
{
"esm": true
}
],
[
"module",
{
Expand All @@ -160,8 +155,7 @@
[
"typescript",
{
"project": "tsconfig.build.json",
"esm": true
"project": "tsconfig.build.json"
}
]
]
Expand Down
30 changes: 16 additions & 14 deletions src/__tests__/IterableInApp.test.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
import { NativeEventEmitter } from 'react-native';

import { IterableLogger } from '../core';
import { IterableInAppManager } from '../inApp';

import { MockRNIterableAPI } from '../__mocks__/MockRNIterableAPI';

import {
Expand Down Expand Up @@ -200,13 +202,12 @@ describe('Iterable In App', () => {

// WHEN the simulated local queue is set to the in-app messages
MockRNIterableAPI.setMessages(messages);
const inAppManager = new IterableInAppManager();

// THEN Iterable,inAppManager.getMessages returns the list of in-app messages
return await Iterable.inAppManager
.getMessages()
.then((messagesObtained) => {
expect(messagesObtained).toEqual(messages);
});
return await inAppManager.getMessages().then((messagesObtained) => {
expect(messagesObtained).toEqual(messages);
});
});

test('showMessage_messageAndConsume_returnsClickedUrl', async () => {
Expand All @@ -223,13 +224,11 @@ describe('Iterable In App', () => {

// WHEN the simulated clicked url is set to the clicked url
MockRNIterableAPI.setClickedUrl(clickedUrl);

const inAppManager = new IterableInAppManager();
// THEN Iterable,inAppManager.showMessage returns the simulated clicked url
return await Iterable.inAppManager
.showMessage(message, consume)
.then((url) => {
expect(url).toEqual(clickedUrl);
});
return await inAppManager.showMessage(message, consume).then((url) => {
expect(url).toEqual(clickedUrl);
});
});

test('removeMessage_params_methodCalledWithParams', () => {
Expand All @@ -243,9 +242,10 @@ describe('Iterable In App', () => {
const location: IterableInAppLocation = IterableInAppLocation.inApp;
const source: IterableInAppDeleteSource =
IterableInAppDeleteSource.deleteButton;
const inAppManager = new IterableInAppManager();

// WHEN Iterable.inAppManager.removeMessage is called
Iterable.inAppManager.removeMessage(message, location, source);
inAppManager.removeMessage(message, location, source);

// THEN corresponding method is called on MockIterableAPI with appropriate parameters
expect(MockRNIterableAPI.removeMessage).toBeCalledWith(
Expand All @@ -266,7 +266,8 @@ describe('Iterable In App', () => {
const read: boolean = true;

// WHEN Iterable.inAppManager.setReadForMessage is called
Iterable.inAppManager.setReadForMessage(message, read);
const inAppManager = new IterableInAppManager();
inAppManager.setReadForMessage(message, read);

// THEN corresponding method is called on MockRNIterableAPI with appropriate parameters
expect(MockRNIterableAPI.setReadForMessage).toBeCalledWith(
Expand All @@ -280,7 +281,8 @@ describe('Iterable In App', () => {
const paused: boolean = true;

// WHEN Iterable.inAppManager.setAutoDisplayPaused is called
Iterable.inAppManager.setAutoDisplayPaused(paused);
const inAppManager = new IterableInAppManager();
inAppManager.setAutoDisplayPaused(paused);

// THEN corresponding method is called on MockRNIterableAPI with appropriate parameters
expect(MockRNIterableAPI.setAutoDisplayPaused).toBeCalledWith(paused);
Expand Down
Empty file removed src/constants/index.ts
Empty file.
Loading