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
201 changes: 111 additions & 90 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,36 +8,43 @@ orbs:
jobs:
unit-test:
docker:
- image: cimg/node:18.20
- image: cimg/node:18.20

steps:
- checkout
- checkout

- restore_cache:
keys:
- yarn-cache-{{ checksum "yarn.lock" }}
- restore_cache:
keys:
- yarn-cache-{{ checksum "yarn.lock" }}

- run:
name: Install Node.js and Yarn Dependencies
command: yarn install
- run:
name: Enable Corepack
command: corepack enable

- run:
name: Build the Project
command: yarn run build
- run:
name: Install Node.js and Yarn Dependencies
command: yarn install --network-timeout 300000
no_output_timeout: 20m
environment:
NODE_OPTIONS: "--max-old-space-size=4096"

- run:
name: Expo Prebuild
command: cd apps/AEPSampleAppNewArchEnabled && npx expo prebuild
- run:
name: Build the Project
command: yarn run build

- save_cache:
key: yarn-cache-{{ checksum "yarn.lock" }}
paths:
- ./node_modules
- ./apps/AEPSampleAppNewArchEnabled/node_modules
- run:
name: Expo Prebuild
command: cd apps/AEPSampleAppNewArchEnabled && npx expo prebuild

- run:
name: Unit Tests
command: yarn test --watchAll=false --runInBand
- save_cache:
key: yarn-cache-{{ checksum "yarn.lock" }}
paths:
- ./node_modules
- ./apps/AEPSampleAppNewArchEnabled/node_modules

- run:
name: Unit Tests
command: yarn test --watchAll=false --runInBand

build-sample-app-android:
executor:
Expand All @@ -46,86 +53,100 @@ jobs:
resource_class: large

steps:
- checkout
- checkout

- run:
name: Enable Corepack
command: corepack enable

- run:
name: Install Node.js and Yarn Dependencies
command: yarn install
- run:
name: Install Node.js and Yarn Dependencies
command: yarn install --network-timeout 300000
no_output_timeout: 20m
environment:
NODE_OPTIONS: "--max-old-space-size=4096"

- run:
name: Build the Project
command: yarn run build
- run:
name: Build the Project
command: yarn run build

- run:
name: Expo Prebuild
command: cd apps/AEPSampleAppNewArchEnabled && npx expo prebuild
- run:
name: Expo Prebuild
command: cd apps/AEPSampleAppNewArchEnabled && npx expo prebuild

- run:
name: Building Android Sample App
command: yarn sampleappnewarchenabled:android:build
environment:
_JAVA_OPTIONS: "-Xmx4096M -XX:MaxMetaspaceSize=512m"
- run:
name: Building Android Sample App
command: yarn sampleappnewarchenabled:android:build
environment:
_JAVA_OPTIONS: "-Xmx4096M -XX:MaxMetaspaceSize=512m"

build-sample-app-ios:
macos:
xcode: 15.2

steps:
- checkout

- restore_cache:
keys:
- ios-yarn-cache-{{ checksum "yarn.lock" }}

- run:
name: Set Xcode Path
command: sudo xcode-select -s /Applications/Xcode.app

- run:
name: Install Node.js and Yarn Dependencies
command: yarn install

- run:
name: Build the Project
command: yarn run build

- run:
name: Expo Prebuild
command: cd apps/AEPSampleAppNewArchEnabled && npx expo prebuild

- save_cache:
key: ios-yarn-cache-{{ checksum "yarn.lock" }}
paths:
- ./node_modules
- ./apps/AEPSampleAppNewArchEnabled/node_modules

- run:
name: Install Cocoapods
command: sudo gem install cocoapods

- run:
name: Install Pods
command: yarn sampleappnewarchenabled:ios:pod:install

- run:
name: Building iOS Sample App
command: |
cd apps/AEPSampleAppNewArchEnabled/ios
xcodebuild \
-workspace AEPSampleAppNewArchEnabled.xcworkspace \
-scheme AEPSampleAppNewArchEnabled \
-sdk iphonesimulator \
-destination "generic/platform=iOS Simulator" \
clean build
- checkout

- restore_cache:
keys:
- ios-yarn-cache-{{ checksum "yarn.lock" }}

- run:
name: Set Xcode Path
command: sudo xcode-select -s /Applications/Xcode.app

- run:
name: Enable Corepack
command: corepack enable

- run:
name: Install Node.js and Yarn Dependencies
command: yarn install --network-timeout 300000
no_output_timeout: 20m
environment:
NODE_OPTIONS: "--max-old-space-size=4096"

- run:
name: Build the Project
command: yarn run build

- run:
name: Expo Prebuild
command: cd apps/AEPSampleAppNewArchEnabled && npx expo prebuild

- save_cache:
key: ios-yarn-cache-{{ checksum "yarn.lock" }}
paths:
- ./node_modules
- ./apps/AEPSampleAppNewArchEnabled/node_modules

- run:
name: Install Cocoapods
command: sudo gem install cocoapods

- run:
name: Install Pods
command: yarn sampleappnewarchenabled:ios:pod:install

- run:
name: Building iOS Sample App
command: |
cd apps/AEPSampleAppNewArchEnabled/ios
xcodebuild \
-workspace AEPSampleAppNewArchEnabled.xcworkspace \
-scheme AEPSampleAppNewArchEnabled \
-sdk iphonesimulator \
-destination "generic/platform=iOS Simulator" \
clean build

workflows:
version: 2.1
ci-workflow:
jobs:
- unit-test
- build-sample-app-ios
# - build-sample-app-android
# Disable the Android build job because of the error below:
# Execution failed for task ':react-native-reanimated:configureCMakeDebug[arm64-v8a]'.
# > [CXX1210] /root/project/apps/AEPSampleApp/node_modules/react-native-reanimated/android/CMakeLists.txt debug|arm64-v8a : No compatible library found
# The Android build job will be enabled once the issue is resolved.
- unit-test
- build-sample-app-ios
# - build-sample-app-android
# Disable the Android build job because of the error below:
# Execution failed for task ':react-native-reanimated:configureCMakeDebug[arm64-v8a]'.
# > [CXX1210] /root/project/apps/AEPSampleApp/node_modules/react-native-reanimated/android/CMakeLists.txt debug|arm64-v8a : No compatible library found
# The Android build job will be enabled once the issue is resolved.
16 changes: 12 additions & 4 deletions apps/AEPSampleAppNewArchEnabled/app/ContentCardsView.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -67,12 +67,15 @@ const StyledText = ({ text }: { text: string }) => {

const Header = ({
isLoading,
onTrackAction
onTrackAction,
selectedView,
setSelectedView
}: {
isLoading: boolean;
onTrackAction: () => void;
selectedView: ViewOption;
setSelectedView: (view: ViewOption) => void;
}) => {
const [selectedView, setSelectedView] = useState<ViewOption>('Remote');
const [showPicker, setShowPicker] = useState<boolean>(false);
const [selectedTheme, setSelectedTheme] = useState<string>('System');
const [trackInput, setTrackInput] = useState('');
Expand Down Expand Up @@ -250,7 +253,7 @@ const Header = ({
const MemoHeader = memo(Header);

const ContentCardsView = () => {
const [selectedView] = useState<ViewOption>('Remote');
const [selectedView, setSelectedView] = useState<ViewOption>('Remote');
const [trackInput, setTrackInput] = useState('');
const colorScheme = useColorScheme();

Expand Down Expand Up @@ -299,7 +302,12 @@ const ContentCardsView = () => {
return <ContentCardView template={item} />;
}}
ListHeaderComponent={
<MemoHeader isLoading={isLoading} onTrackAction={refetch} />
<MemoHeader
isLoading={isLoading}
onTrackAction={refetch}
selectedView={selectedView}
setSelectedView={setSelectedView}
/>
}
ListEmptyComponent={() =>
selectedView === 'Remote' && (
Expand Down
10 changes: 2 additions & 8 deletions apps/AEPSampleAppNewArchEnabled/app/MessagingView.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -132,15 +132,9 @@ const unifiedTrackingExample = async () => {
const propositions = messages[surface] || [];

for (const proposition of propositions) {
const propositionWrapper = new MessagingProposition(proposition);
if (propositionWrapper.items.length > 0) {
const propositionItem = propositionWrapper.items[0];
for (const propositionItem of proposition.items) {
propositionItem.track(MessagingEdgeEventType.DISPLAY);
propositionItem.track(
'content_card_clicked',
MessagingEdgeEventType.INTERACT,
null
);
propositionItem.track('content_card_clicked', MessagingEdgeEventType.INTERACT, null);
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion apps/AEPSampleAppNewArchEnabled/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
"@react-navigation/bottom-tabs": "7.3.12",
"@react-navigation/core": "7.9.1",
"@react-navigation/drawer": "7.3.11",
"@react-navigation/native": "7.1.8",
"@react-navigation/native": "7.1.17",
"@react-navigation/native-stack": "^7.3.1",
"@react-navigation/routers": "7.3.7",
"@react-navigation/stack": "7.3.1",
Expand Down
6 changes: 6 additions & 0 deletions jest.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,10 @@ module.exports = {
testPathIgnorePatterns: ['./packages/template'],
moduleDirectories: ['node_modules', './apps/AEPSampleAppNewArchEnabled/node_modules'],
moduleFileExtensions: ['ts', 'tsx', 'js'],
moduleNameMapper: {
'^react-native$': '<rootDir>/apps/AEPSampleAppNewArchEnabled/node_modules/react-native'
},
transformIgnorePatterns: [
'node_modules/(?!(react-native|@react-native|@react-navigation)/)'
]
};
15 changes: 5 additions & 10 deletions packages/messaging/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,7 @@ propositionItem.track(
);
```

When using `getPropositionsForSurfaces`, the returned objects can be wrapped with `MessagingProposition` to get typed items and convenient tracking via `PropositionItem.track(...)`.
When using `getPropositionsForSurfaces`, the returned objects are already `MessagingProposition` instances with typed items and convenient tracking via `PropositionItem.track(...)`.

```javascript
import { Messaging, MessagingProposition, MessagingEdgeEventType } from '@adobe/react-native-aepmessaging';
Expand All @@ -233,17 +233,12 @@ const messages = await Messaging.getPropositionsForSurfaces(SURFACES);

for (const surface of SURFACES) {
const propositions = messages[surface] || [];

for (const proposition of propositions) {
const msgProp = new MessagingProposition(proposition);

if (msgProp.items.length > 0) {
const propositionItem = msgProp.items[0];

for (const propositionItem of proposition.items) {
// Track interaction with custom data
propositionItem.track('content_card_clicked', MessagingEdgeEventType.INTERACT, null);
// Track with tokens for sub-item tracking
propositionItem.track('button_click', MessagingEdgeEventType.INTERACT, ['token-1', 'token-2']);
propositionItem.track('content_card_clicked', MessagingEdgeEventType.INTERACT, null);
// Track with tokens for sub-item tracking
propositionItem.track('button_click', MessagingEdgeEventType.INTERACT, ['token-1', 'token-2']);
}
}
}
Expand Down
10 changes: 8 additions & 2 deletions packages/messaging/dist/module/Messaging.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading