Skip to content

Commit 8a8cab7

Browse files
authored
fix: remove type module property (#1125)
1 parent 923d7ef commit 8a8cab7

File tree

8 files changed

+53
-15
lines changed

8 files changed

+53
-15
lines changed

example/IonicAngular/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@
44
"author": "Ionic Framework",
55
"homepage": "https://ionicframework.com/",
66
"scripts": {
7-
"ng": "ng",
87
"ionic:build": "../scripts/build.sh IonicAngular",
8+
"ng": "ng",
99
"start": "ng serve",
1010
"build": "ng build",
1111
"watch": "ng build --watch --configuration development",

example/IonicAngular/src/app/app.component.ts

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,25 @@ export class AppComponent {
1616
const APP_ID = '77e32082-ea27-42e3-a898-c72e141824ef'; // Use your app ID
1717
OneSignal.Debug.setLogLevel(LogLevel.Verbose);
1818
OneSignal.initialize(APP_ID);
19-
OneSignal.login('ionic-angular-8');
19+
20+
OneSignal.InAppMessages.addEventListener('click', (event) => {
21+
console.log('OneSignal IAM clicked:', event);
22+
});
23+
24+
OneSignal.InAppMessages.addEventListener('willDisplay', (event) => {
25+
console.log('OneSignal: will display IAM: ', event);
26+
});
27+
28+
OneSignal.InAppMessages.addEventListener('didDisplay', (event) => {
29+
console.log('OneSignal: did display IAM: ', event);
30+
});
31+
32+
OneSignal.InAppMessages.addEventListener('willDismiss', (event) => {
33+
console.log('OneSignal: will dismiss IAM: ', event);
34+
});
35+
36+
OneSignal.InAppMessages.addEventListener('didDismiss', (event) => {
37+
console.log('OneSignal: did dismiss IAM: ', event);
38+
});
2039
}
2140
}

example/IonicAngular/src/app/home/home.page.html

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,5 +17,17 @@ <h2>Welcome to OneSignal Ionic Angular Example</h2>
1717
This example demonstrates the OneSignal Cordova SDK integration with Ionic
1818
Angular.
1919
</p>
20+
21+
<ion-item>
22+
<ion-input
23+
label="External ID"
24+
labelPlacement="floating"
25+
placeholder="Enter external user ID"
26+
[(ngModel)]="externalId"
27+
></ion-input>
28+
</ion-item>
29+
<ion-button expand="block" (click)="login()" [disabled]="!externalId">
30+
Login
31+
</ion-button>
2032
</div>
2133
</ion-content>

example/IonicAngular/src/app/home/home.page.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import { Component } from '@angular/core';
2+
import OneSignal from 'onesignal-cordova-plugin';
23

34
@Component({
45
selector: 'app-home',
@@ -7,5 +8,14 @@ import { Component } from '@angular/core';
78
standalone: false,
89
})
910
export class HomePage {
11+
externalId = '';
12+
1013
constructor() {}
14+
15+
login() {
16+
if (this.externalId) {
17+
OneSignal.login(this.externalId);
18+
console.log('OneSignal login called with:', this.externalId);
19+
}
20+
}
1121
}

example/IonicCapOneSignal/android/app/capacitor.build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ dependencies {
1313
implementation "com.onesignal:OneSignal:5.1.38"
1414
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:1.7.10"
1515
}
16-
apply from: "../../../../build-extras-onesignal.gradle"
16+
apply from: "../../node_modules/onesignal-cordova-plugin/build-extras-onesignal.gradle"
1717

1818
if (hasProperty('postBuildExtras')) {
1919
postBuildExtras()

example/IonicCapOneSignal/vite.config.ts

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,4 @@ import { defineConfig } from 'vite';
44
// https://vitejs.dev/config/
55
export default defineConfig({
66
plugins: [react()],
7-
optimizeDeps: {
8-
include: ['dist'],
9-
},
10-
build: {
11-
commonjsOptions: {
12-
include: [/dist/, /node_modules/],
13-
},
14-
},
157
});

example/scripts/build.sh

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,14 @@
11
#!/bin/bash
2+
# Get example name from argument or environment variable
3+
EXAMPLE_NAME="${1:-${EXAMPLE}}"
4+
5+
echo "Preparing example: ${EXAMPLE_NAME}"
6+
27
# Get the directory where this script is located
38
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
49
# Go to the root directory (two levels up from example/scripts/)
510
cd "${SCRIPT_DIR}/../.."
611

7-
# Get example name from argument or environment variable
8-
EXAMPLE_NAME="${1:-${EXAMPLE}}"
9-
1012
bun run build
1113

1214
# Pack - remove old tarballs first to ensure fresh build
@@ -25,7 +27,11 @@ else
2527
fi
2628

2729
# Build example
30+
echo "Building example: ${EXAMPLE_NAME}"
2831
if [ "$EXAMPLE_NAME" = "IonicAngular" ]; then
32+
# Clear Angular cache to ensure fresh build
33+
rm -rf .angular/cache
34+
2935
ng build
3036
elif [ "$EXAMPLE_NAME" = "IonicCapOneSignal" ]; then
3137
tsc && vite build

package.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@
1212
"type": "git",
1313
"url": "git+https://github.com/OneSignal/OneSignal-Cordova-SDK.git"
1414
},
15-
"type": "module",
1615
"main": "dist/index.js",
1716
"types": "dist/index.d.ts",
1817
"scripts": {

0 commit comments

Comments
 (0)