notifly-sdk 2.2.6 → 2.3.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (45) hide show
  1. package/README.md +2 -8
  2. package/android/build.gradle +100 -0
  3. package/android/gradle.properties +5 -0
  4. package/android/src/main/AndroidManifest.xml +4 -0
  5. package/android/src/main/java/com/notiflysdk/NotiflySdkModule.kt +100 -0
  6. package/android/src/main/java/com/notiflysdk/NotiflySdkPackage.kt +35 -0
  7. package/android/src/newarch/NotiflySdkSpec.kt +7 -0
  8. package/android/src/oldarch/NotiflySdkSpec.kt +24 -0
  9. package/ios/NotiflySdk-Bridging-Header.h +2 -0
  10. package/ios/NotiflySdk.m +22 -0
  11. package/ios/NotiflySdk.swift +39 -0
  12. package/ios/NotiflySdk.xcodeproj/project.pbxproj +273 -0
  13. package/ios/NotiflySdk.xcodeproj/project.xcworkspace/contents.xcworkspacedata +4 -0
  14. package/lib/commonjs/NativeNotiflySdk.js +10 -0
  15. package/lib/commonjs/NativeNotiflySdk.js.map +1 -0
  16. package/lib/commonjs/index.js +85 -0
  17. package/lib/commonjs/index.js.map +1 -0
  18. package/lib/commonjs/types.js +2 -0
  19. package/lib/commonjs/types.js.map +1 -0
  20. package/lib/module/NativeNotiflySdk.js +3 -0
  21. package/lib/module/NativeNotiflySdk.js.map +1 -0
  22. package/lib/module/index.js +70 -0
  23. package/lib/module/index.js.map +1 -0
  24. package/lib/module/types.js +2 -0
  25. package/lib/module/types.js.map +1 -0
  26. package/lib/typescript/NativeNotiflySdk.d.ts +15 -0
  27. package/lib/typescript/NativeNotiflySdk.d.ts.map +1 -0
  28. package/lib/typescript/index.d.ts +26 -0
  29. package/lib/typescript/index.d.ts.map +1 -0
  30. package/lib/typescript/types.d.ts +7 -0
  31. package/lib/typescript/types.d.ts.map +1 -0
  32. package/notifly_react_native_sdk.podspec +36 -0
  33. package/package.json +158 -28
  34. package/src/NativeNotiflySdk.ts +25 -0
  35. package/src/index.tsx +105 -0
  36. package/src/types.ts +7 -0
  37. package/.eslintrc.cjs +0 -40
  38. package/.prettierrc.yml +0 -14
  39. package/index.js +0 -190
  40. package/src/auth.js +0 -42
  41. package/src/constant.js +0 -8
  42. package/src/in_app_message.js +0 -258
  43. package/src/log_event.js +0 -185
  44. package/src/user.js +0 -51
  45. package/src/utils.js +0 -145
@@ -0,0 +1,85 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = void 0;
7
+ exports.initialize = initialize;
8
+ exports.multiply = multiply;
9
+ exports.notiflyBackgroundHandler = notiflyBackgroundHandler;
10
+ exports.setLogLevel = setLogLevel;
11
+ exports.setNotiflyBackgroundMessageHandler = setNotiflyBackgroundMessageHandler;
12
+ exports.setUserId = setUserId;
13
+ exports.setUserProperties = setUserProperties;
14
+ exports.trackEvent = trackEvent;
15
+ var _reactNative = require("react-native");
16
+ const LINKING_ERROR = `The package 'notifly-sdk' doesn't seem to be linked. Make sure: \n\n` + _reactNative.Platform.select({
17
+ ios: "- You have run 'pod install'\n",
18
+ default: ''
19
+ }) + '- You rebuilt the app after installing the package\n' + '- You are not using Expo Go\n';
20
+
21
+ // @ts-expect-error
22
+ const isTurboModuleEnabled = global.__turboModuleProxy != null;
23
+ const NotiflySdkModule = isTurboModuleEnabled ? require('./NativeNotiflySdk').default : _reactNative.NativeModules.NotiflySdk;
24
+ const NotiflySdk = NotiflySdkModule ? NotiflySdkModule : new Proxy({}, {
25
+ get() {
26
+ throw new Error(LINKING_ERROR);
27
+ }
28
+ });
29
+ function multiply(a, b) {
30
+ return NotiflySdk.multiply(a, b);
31
+ }
32
+ function initialize(projectId, username, password) {
33
+ let useCustomClickHandler = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : undefined;
34
+ // @deprecated useCustomClickHandler is deprecated since version 2.3.0
35
+ if (typeof useCustomClickHandler !== 'undefined') {
36
+ console.warn('Warning: useCustomClickHandler of notifly.initialize is deprecated and will be removed in the next major release.');
37
+ }
38
+ return NotiflySdk.initialize(projectId, username, password);
39
+ }
40
+ function setUserId(userId) {
41
+ return NotiflySdk.setUserId(userId);
42
+ }
43
+ function setUserProperties(properties) {
44
+ return NotiflySdk.setUserProperties(properties);
45
+ }
46
+ function trackEvent(eventName) {
47
+ let eventParams = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : undefined;
48
+ let segmentationEventParamKeys = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : null;
49
+ return NotiflySdk.trackEvent(eventName, eventParams, segmentationEventParamKeys);
50
+ }
51
+ function setLogLevel(logLevel) {
52
+ // only implemented on Android
53
+ if (_reactNative.Platform.OS === 'android') {
54
+ return NotiflySdk.setLogLevel(logLevel);
55
+ }
56
+ return Promise.resolve();
57
+ }
58
+
59
+ /**
60
+ * @deprecated Since version 2.3.0.
61
+ */
62
+ function notiflyBackgroundHandler(_remoteMessage) {
63
+ console.warn('Warning: notifly.notiflyBackgroundHandler(remoteMessage) is deprecated and will be removed in the next major release. You do not need to call this method anymore. remoteMessage is now handled automatically.');
64
+ return Promise.resolve();
65
+ }
66
+
67
+ /**
68
+ * @deprecated Since version 2.3.0.
69
+ */
70
+ function setNotiflyBackgroundMessageHandler() {
71
+ console.warn('Warning: notifly.setNotiflyBackgroundMessageHandler() is deprecated and will be removed in the next major release. You do not need to call this method anymore. remoteMessage is now handled automatically.');
72
+ return Promise.resolve();
73
+ }
74
+ const notifly = {
75
+ initialize,
76
+ setUserId,
77
+ setUserProperties,
78
+ trackEvent,
79
+ setLogLevel,
80
+ notiflyBackgroundHandler,
81
+ setNotiflyBackgroundMessageHandler
82
+ };
83
+ var _default = notifly;
84
+ exports.default = _default;
85
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["_reactNative","require","LINKING_ERROR","Platform","select","ios","default","isTurboModuleEnabled","global","__turboModuleProxy","NotiflySdkModule","NativeModules","NotiflySdk","Proxy","get","Error","multiply","a","b","initialize","projectId","username","password","useCustomClickHandler","arguments","length","undefined","console","warn","setUserId","userId","setUserProperties","properties","trackEvent","eventName","eventParams","segmentationEventParamKeys","setLogLevel","logLevel","OS","Promise","resolve","notiflyBackgroundHandler","_remoteMessage","setNotiflyBackgroundMessageHandler","notifly","_default","exports"],"sourceRoot":"../../src","sources":["index.tsx"],"mappings":";;;;;;;;;;;;;;AAAA,IAAAA,YAAA,GAAAC,OAAA;AAGA,MAAMC,aAAa,GAChB,sEAAqE,GACtEC,qBAAQ,CAACC,MAAM,CAAC;EAAEC,GAAG,EAAE,gCAAgC;EAAEC,OAAO,EAAE;AAAG,CAAC,CAAC,GACvE,sDAAsD,GACtD,+BAA+B;;AAEjC;AACA,MAAMC,oBAAoB,GAAGC,MAAM,CAACC,kBAAkB,IAAI,IAAI;AAE9D,MAAMC,gBAAgB,GAAGH,oBAAoB,GACzCN,OAAO,CAAC,oBAAoB,CAAC,CAACK,OAAO,GACrCK,0BAAa,CAACC,UAAU;AAE5B,MAAMA,UAAU,GAAGF,gBAAgB,GAC/BA,gBAAgB,GAChB,IAAIG,KAAK,CACP,CAAC,CAAC,EACF;EACEC,GAAGA,CAAA,EAAG;IACJ,MAAM,IAAIC,KAAK,CAACb,aAAa,CAAC;EAChC;AACF,CACF,CAAC;AAEE,SAASc,QAAQA,CAACC,CAAS,EAAEC,CAAS,EAAmB;EAC9D,OAAON,UAAU,CAACI,QAAQ,CAACC,CAAC,EAAEC,CAAC,CAAC;AAClC;AAEO,SAASC,UAAUA,CACxBC,SAAiB,EACjBC,QAAgB,EAChBC,QAAgB,EAED;EAAA,IADfC,qBAA0C,GAAAC,SAAA,CAAAC,MAAA,QAAAD,SAAA,QAAAE,SAAA,GAAAF,SAAA,MAAGE,SAAS;EAEtD;EACA,IAAI,OAAOH,qBAAqB,KAAK,WAAW,EAAE;IAChDI,OAAO,CAACC,IAAI,CACV,mHACF,CAAC;EACH;EACA,OAAOhB,UAAU,CAACO,UAAU,CAACC,SAAS,EAAEC,QAAQ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C,OAAA,GAAAwC,QAAA"}
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":[],"sourceRoot":"../../src","sources":["types.ts"],"mappings":""}
@@ -0,0 +1,3 @@
1
+ import { TurboModuleRegistry } from 'react-native';
2
+ export default TurboModuleRegistry.getEnforcing('NotiflySdk');
3
+ //# sourceMappingURL=NativeNotiflySdk.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["TurboModuleRegistry","getEnforcing"],"sourceRoot":"../../src","sources":["NativeNotiflySdk.ts"],"mappings":"AACA,SAASA,mBAAmB,QAAQ,cAAc;AAuBlD,eAAeA,mBAAmB,CAACC,YAAY,CAAO,YAAY,CAAC"}
@@ -0,0 +1,70 @@
1
+ import { NativeModules, Platform } from 'react-native';
2
+ const LINKING_ERROR = `The package 'notifly-sdk' doesn't seem to be linked. Make sure: \n\n` + Platform.select({
3
+ ios: "- You have run 'pod install'\n",
4
+ default: ''
5
+ }) + '- You rebuilt the app after installing the package\n' + '- You are not using Expo Go\n';
6
+
7
+ // @ts-expect-error
8
+ const isTurboModuleEnabled = global.__turboModuleProxy != null;
9
+ const NotiflySdkModule = isTurboModuleEnabled ? require('./NativeNotiflySdk').default : NativeModules.NotiflySdk;
10
+ const NotiflySdk = NotiflySdkModule ? NotiflySdkModule : new Proxy({}, {
11
+ get() {
12
+ throw new Error(LINKING_ERROR);
13
+ }
14
+ });
15
+ export function multiply(a, b) {
16
+ return NotiflySdk.multiply(a, b);
17
+ }
18
+ export function initialize(projectId, username, password) {
19
+ let useCustomClickHandler = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : undefined;
20
+ // @deprecated useCustomClickHandler is deprecated since version 2.3.0
21
+ if (typeof useCustomClickHandler !== 'undefined') {
22
+ console.warn('Warning: useCustomClickHandler of notifly.initialize is deprecated and will be removed in the next major release.');
23
+ }
24
+ return NotiflySdk.initialize(projectId, username, password);
25
+ }
26
+ export function setUserId(userId) {
27
+ return NotiflySdk.setUserId(userId);
28
+ }
29
+ export function setUserProperties(properties) {
30
+ return NotiflySdk.setUserProperties(properties);
31
+ }
32
+ export function trackEvent(eventName) {
33
+ let eventParams = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : undefined;
34
+ let segmentationEventParamKeys = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : null;
35
+ return NotiflySdk.trackEvent(eventName, eventParams, segmentationEventParamKeys);
36
+ }
37
+ export function setLogLevel(logLevel) {
38
+ // only implemented on Android
39
+ if (Platform.OS === 'android') {
40
+ return NotiflySdk.setLogLevel(logLevel);
41
+ }
42
+ return Promise.resolve();
43
+ }
44
+
45
+ /**
46
+ * @deprecated Since version 2.3.0.
47
+ */
48
+ export function notiflyBackgroundHandler(_remoteMessage) {
49
+ console.warn('Warning: notifly.notiflyBackgroundHandler(remoteMessage) is deprecated and will be removed in the next major release. You do not need to call this method anymore. remoteMessage is now handled automatically.');
50
+ return Promise.resolve();
51
+ }
52
+
53
+ /**
54
+ * @deprecated Since version 2.3.0.
55
+ */
56
+ export function setNotiflyBackgroundMessageHandler() {
57
+ console.warn('Warning: notifly.setNotiflyBackgroundMessageHandler() is deprecated and will be removed in the next major release. You do not need to call this method anymore. remoteMessage is now handled automatically.');
58
+ return Promise.resolve();
59
+ }
60
+ const notifly = {
61
+ initialize,
62
+ setUserId,
63
+ setUserProperties,
64
+ trackEvent,
65
+ setLogLevel,
66
+ notiflyBackgroundHandler,
67
+ setNotiflyBackgroundMessageHandler
68
+ };
69
+ export default notifly;
70
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["NativeModules","Platform","LINKING_ERROR","select","ios","default","isTurboModuleEnabled","global","__turboModuleProxy","NotiflySdkModule","require","NotiflySdk","Proxy","get","Error","multiply","a","b","initialize","projectId","username","password","useCustomClickHandler","arguments","length","undefined","console","warn","setUserId","userId","setUserProperties","properties","trackEvent","eventName","eventParams","segmentationEventParamKeys","setLogLevel","logLevel","OS","Promise","resolve","notiflyBackgroundHandler","_remoteMessage","setNotiflyBackgroundMessageHandler","notifly"],"sourceRoot":"../../src","sources":["index.tsx"],"mappings":"AAAA,SAASA,aAAa,EAAEC,QAAQ,QAAQ,cAAc;AAGtD,MAAMC,aAAa,GAChB,sEAAqE,GACtED,QAAQ,CAACE,MAAM,CAAC;EAAEC,GAAG,EAAE,gCAAgC;EAAEC,OAAO,EAAE;AAAG,CAAC,CAAC,GACvE,sDAAsD,GACtD,+BAA+B;;AAEjC;AACA,MAAMC,oBAAoB,GAAGC,MAAM,CAACC,kBAAkB,IAAI,IAAI;AAE9D,MAAMC,gBAAgB,GAAGH,oBAAoB,GACzCI,OAAO,CAAC,oBAAoB,CAAC,CAACL,OAAO,GACrCL,aAAa,CAACW,UAAU;AAE5B,MAAMA,UAAU,GAAGF,gBAAgB,GAC/BA,gBAAgB,GAChB,IAAIG,KAAK,CACP,CAAC,CAAC,EACF;EACEC,GAAGA,CAAA,EAAG;IACJ,MAAM,IAAIC,KAAK,CAACZ,aAAa,CAAC;EAChC;AACF,CACF,CAAC;AAEL,OAAO,SAASa,QAAQA,CAACC,CAAS,EAAEC,CAAS,EAAmB;EAC9D,OAAON,UAAU,CAACI,QAAQ,CAACC,CAAC,EAAEC,CAAC,CAAC;AAClC;AAEA,OAAO,SAASC,UAAUA,CACxBC,SAAiB,EACjBC,QAAgB,EAChBC,QAAgB,EAED;EAAA,IADfC,qBAA0C,GAAAC,SAAA,CAAAC,MAAA,QAAAD,SAAA,QAAAE,SAAA,GAAAF,SAAA,MAAGE,SAAS;EAEtD;EACA,IAAI,OAAOH,qBAAqB,KAAK,WAAW,EAAE;IAChDI,OAAO,CAACC,IAAI,CACV,mHACF,CAAC;EACH;EACA,OAAOhB,UAAU,CAACO,UAAU,CAACC,SAAS,EAAEC,QAAQ,EAAEC,QAAQ,CAAC;AAC7D;AAEA,OAAO,SAASO,SAASA,CAACC,MAA0B,EAAiB;EACnE,OAAOlB,UAAU,C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oot":"../../src","sources":["types.ts"],"mappings":""}
@@ -0,0 +1,15 @@
1
+ import type { TurboModule } from 'react-native';
2
+ import { type UserProperties, type EventProperties } from './types';
3
+ export interface Spec extends TurboModule {
4
+ multiply(a: number, b: number): Promise<number>;
5
+ initialize(projectId: string, username: string, password: string, useCustomClickHandler: boolean | undefined): Promise<void>;
6
+ setUserId(userId: string | undefined): Promise<void>;
7
+ setUserProperties(userProperties: UserProperties): Promise<void>;
8
+ trackEvent(eventName: string, eventParams: EventProperties | null | undefined, segmentationEventParamKeys: string[] | undefined | null): Promise<void>;
9
+ setLogLevel(logLevel: number): Promise<void>;
10
+ notiflyBackgroundHandler(_remoteMessage: any): Promise<void>;
11
+ setNotificationOpenedHandler(): Promise<void>;
12
+ }
13
+ declare const _default: Spec;
14
+ export default _default;
15
+ //# sourceMappingURL=NativeNotiflySdk.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"NativeNotiflySdk.d.ts","sourceRoot":"","sources":["../../src/NativeNotiflySdk.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAEhD,OAAO,EAAE,KAAK,cAAc,EAAE,KAAK,eAAe,EAAE,MAAM,SAAS,CAAC;AAEpE,MAAM,WAAW,IAAK,SAAQ,WAAW;IACvC,QAAQ,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;IAChD,UAAU,CACR,SAAS,EAAE,MAAM,EACjB,QAAQ,EAAE,MAAM,EAChB,QAAQ,EAAE,MAAM,EAChB,qBAAqB,EAAE,OAAO,GAAG,SAAS,GACzC,OAAO,CAAC,IAAI,CAAC,CAAC;IACjB,SAAS,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IACrD,iBAAiB,CAAC,cAAc,EAAE,cAAc,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IACjE,UAAU,CACR,SAAS,EAAE,MAAM,EACjB,WAAW,EAAE,eAAe,GAAG,IAAI,GAAG,SAAS,EAC/C,0BAA0B,EAAE,MAAM,EAAE,GAAG,SAAS,GAAG,IAAI,GACtD,OAAO,CAAC,IAAI,CAAC,CAAC;IACjB,WAAW,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAC7C,wBAAwB,CAAC,cAAc,EAAE,GAAG,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAC7D,4BAA4B,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;CAC/C;;AAED,wBAAoE"}
@@ -0,0 +1,26 @@
1
+ import { type UserProperties, type EventProperties } from './types';
2
+ export declare function multiply(a: number, b: number): Promise<number>;
3
+ export declare function initialize(projectId: string, username: string, password: string, useCustomClickHandler?: boolean | undefined): Promise<void>;
4
+ export declare function setUserId(userId: string | undefined): Promise<void>;
5
+ export declare function setUserProperties(properties: UserProperties): Promise<void>;
6
+ export declare function trackEvent(eventName: string, eventParams?: EventProperties | null | undefined, segmentationEventParamKeys?: string[] | undefined | null): Promise<void>;
7
+ export declare function setLogLevel(logLevel: number): Promise<void>;
8
+ /**
9
+ * @deprecated Since version 2.3.0.
10
+ */
11
+ export declare function notiflyBackgroundHandler(_remoteMessage: any): Promise<void>;
12
+ /**
13
+ * @deprecated Since version 2.3.0.
14
+ */
15
+ export declare function setNotiflyBackgroundMessageHandler(): Promise<void>;
16
+ declare const notifly: {
17
+ initialize: typeof initialize;
18
+ setUserId: typeof setUserId;
19
+ setUserProperties: typeof setUserProperties;
20
+ trackEvent: typeof trackEvent;
21
+ setLogLevel: typeof setLogLevel;
22
+ notiflyBackgroundHandler: typeof notiflyBackgroundHandler;
23
+ setNotiflyBackgroundMessageHandler: typeof setNotiflyBackgroundMessageHandler;
24
+ };
25
+ export default notifly;
26
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,cAAc,EAAE,KAAK,eAAe,EAAE,MAAM,SAAS,CAAC;AA0BpE,wBAAgB,QAAQ,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAE9D;AAED,wBAAgB,UAAU,CACxB,SAAS,EAAE,MAAM,EACjB,QAAQ,EAAE,MAAM,EAChB,QAAQ,EAAE,MAAM,EAChB,qBAAqB,GAAE,OAAO,GAAG,SAAqB,GACrD,OAAO,CAAC,IAAI,CAAC,CAQf;AAED,wBAAgB,SAAS,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,GAAG,OAAO,CAAC,IAAI,CAAC,CAEnE;AAED,wBAAgB,iBAAiB,CAAC,UAAU,EAAE,cAAc,GAAG,OAAO,CAAC,IAAI,CAAC,CAE3E;AAED,wBAAgB,UAAU,CACxB,SAAS,EAAE,MAAM,EACjB,WAAW,GAAE,eAAe,GAAG,IAAI,GAAG,SAAqB,EAC3D,0BAA0B,GAAE,MAAM,EAAE,GAAG,SAAS,GAAG,IAAW,GAC7D,OAAO,CAAC,IAAI,CAAC,CAMf;AAED,wBAAgB,WAAW,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAM3D;AAED;;GAEG;AACH,wBAAgB,wBAAwB,CAAC,cAAc,EAAE,GAAG,GAAG,OAAO,CAAC,IAAI,CAAC,CAK3E;AAED;;GAEG;AACH,wBAAgB,kCAAkC,IAAI,OAAO,CAAC,IAAI,CAAC,CAKlE;AAED,QAAA,MAAM,OAAO;;;;;;;;CAQZ,CAAC;AAEF,eAAe,OAAO,CAAC"}
@@ -0,0 +1,7 @@
1
+ export interface UserProperties {
2
+ [key: string]: any;
3
+ }
4
+ export interface EventProperties {
5
+ [key: string]: any;
6
+ }
7
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/types.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,cAAc;IAC7B,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAC;CACpB;AAED,MAAM,WAAW,eAAe;IAC9B,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAC;CACpB"}
@@ -0,0 +1,36 @@
1
+ require "json"
2
+
3
+ package = JSON.parse(File.read(File.join(__dir__, "package.json")))
4
+ folly_compiler_flags = '-DFOLLY_NO_CONFIG -DFOLLY_MOBILE=1 -DFOLLY_USE_LIBCPP=1 -Wno-comma -Wno-shorten-64-to-32'
5
+
6
+ Pod::Spec.new do |s|
7
+ s.name = "notifly_react_native_sdk"
8
+ s.version = package["version"]
9
+ s.summary = package["description"]
10
+ s.homepage = package["homepage"]
11
+ s.license = package["license"]
12
+ s.authors = package["author"]
13
+
14
+ s.platforms = { :ios => "13.0" }
15
+ s.source = { :git => "https://github.com/team-michael/notifly-react-native-sdk.git", :tag => "#{s.version}" }
16
+
17
+ s.source_files = "ios/**/*.{h,m,mmm,swift}"
18
+
19
+ s.dependency "notifly_sdk", "1.0.2"
20
+ s.dependency "React-Core"
21
+
22
+ # Don't install the dependencies when we run `pod install` in the old architecture.
23
+ if ENV['RCT_NEW_ARCH_ENABLED'] == '1' then
24
+ s.compiler_flags = folly_compiler_flags + " -DRCT_NEW_ARCH_ENABLED=1"
25
+ s.pod_target_xcconfig = {
26
+ "HEADER_SEARCH_PATHS" => "\"$(PODS_ROOT)/boost\"",
27
+ "OTHER_CPLUSPLUSFLAGS" => "-DFOLLY_NO_CONFIG -DFOLLY_MOBILE=1 -DFOLLY_USE_LIBCPP=1",
28
+ "CLANG_CXX_LANGUAGE_STANDARD" => "c++17"
29
+ }
30
+ s.dependency "React-Codegen"
31
+ s.dependency "RCT-Folly"
32
+ s.dependency "RCTRequired"
33
+ s.dependency "RCTTypeSafety"
34
+ s.dependency "ReactCommon/turbomodule/core"
35
+ end
36
+ end
package/package.json CHANGED
@@ -1,35 +1,165 @@
1
1
  {
2
2
  "name": "notifly-sdk",
3
- "version": "2.2.6",
4
- "description": "",
5
- "main": "index.js",
3
+ "version": "2.3.1",
4
+ "description": "test",
5
+ "main": "lib/commonjs/index",
6
+ "module": "lib/module/index",
7
+ "types": "lib/typescript/index.d.ts",
8
+ "react-native": "src/index",
9
+ "source": "src/index",
10
+ "files": [
11
+ "src",
12
+ "lib",
13
+ "android",
14
+ "ios",
15
+ "cpp",
16
+ "*.podspec",
17
+ "!lib/typescript/example",
18
+ "!ios/build",
19
+ "!android/build",
20
+ "!android/gradle",
21
+ "!android/gradlew",
22
+ "!android/gradlew.bat",
23
+ "!android/local.properties",
24
+ "!**/__tests__",
25
+ "!**/__fixtures__",
26
+ "!**/__mocks__",
27
+ "!**/.*"
28
+ ],
6
29
  "scripts": {
7
- "test": "echo \"Error: no test specified\" && exit 1",
8
- "pretty": "prettier --write \"**/*.{js,jsx,json}\"",
9
- "lint": "eslint ."
30
+ "test": "jest",
31
+ "typecheck": "tsc --noEmit",
32
+ "lint": "eslint \"**/*.{js,ts,tsx}\"",
33
+ "prepack": "bob build",
34
+ "release": "release-it",
35
+ "example": "yarn --cwd example",
36
+ "bootstrap": "yarn example && yarn install && yarn example pods",
37
+ "clean": "del-cli android/build example/android/build example/android/app/build example/ios/build"
38
+ },
39
+ "keywords": [
40
+ "react-native",
41
+ "ios",
42
+ "android"
43
+ ],
44
+ "repository": "https://github.com/team-michael/notifly-react-native-sdk",
45
+ "author": "minyonglee <minyong@workmichael.com> (https://github.com/minyonglee)",
46
+ "license": "MIT",
47
+ "bugs": {
48
+ "url": "https://github.com/team-michael/notifly-react-native-sdk/issues"
49
+ },
50
+ "homepage": "https://github.com/team-michael/notifly-react-native-sdk#readme",
51
+ "publishConfig": {
52
+ "registry": "https://registry.npmjs.org/"
10
53
  },
11
- "peerDependencies": {
12
- "@react-native-async-storage/async-storage": "^1.17.11",
13
- "@react-native-firebase/app": "^16.4.3",
14
- "@react-native-firebase/messaging": "^16.4.3",
15
- "react-native-device-info": "^8.1.4",
16
- "react-native-modal": "^13.0.1",
17
- "react-native-root-siblings": "^4.1.1",
18
- "react-native-webview": "^11.26.1",
19
- "uuid": "^8.3.0"
20
- },
21
- "author": "daeseongKim",
22
- "license": "ISC",
23
- "type": "module",
24
54
  "devDependencies": {
25
- "@babel/core": "^7.21.4",
26
- "@babel/eslint-parser": "^7.21.3",
27
- "@babel/plugin-syntax-import-assertions": "^7.20.0",
28
- "@babel/preset-env": "^7.21.4",
29
- "@babel/preset-react": "^7.18.6",
30
- "eslint": "^8.38.0",
31
- "eslint-plugin-react": "^7.32.2",
32
- "eslint-plugin-react-native": "^4.0.0",
33
- "prettier": "^2.8.7"
55
+ "@commitlint/config-conventional": "^17.0.2",
56
+ "@evilmartians/lefthook": "^1.2.2",
57
+ "@react-native-community/eslint-config": "^3.0.2",
58
+ "@release-it/conventional-changelog": "^5.0.0",
59
+ "@types/jest": "^28.1.2",
60
+ "@types/react": "~17.0.21",
61
+ "@types/react-native": "0.70.0",
62
+ "commitlint": "^17.0.2",
63
+ "del-cli": "^5.0.0",
64
+ "eslint": "^8.4.1",
65
+ "eslint-config-prettier": "^8.5.0",
66
+ "eslint-plugin-prettier": "^4.0.0",
67
+ "jest": "^28.1.1",
68
+ "pod-install": "^0.1.0",
69
+ "prettier": "^2.0.5",
70
+ "react": "18.2.0",
71
+ "react-native": "0.71.8",
72
+ "react-native-builder-bob": "^0.20.4",
73
+ "release-it": "^15.0.0",
74
+ "typescript": "^5.0.2"
75
+ },
76
+ "resolutions": {
77
+ "@types/react": "17.0.21"
78
+ },
79
+ "peerDependencies": {
80
+ "react": "*",
81
+ "react-native": "*"
82
+ },
83
+ "engines": {
84
+ "node": ">= 16.0.0"
85
+ },
86
+ "packageManager": "^yarn@1.22.15",
87
+ "jest": {
88
+ "preset": "react-native",
89
+ "modulePathIgnorePatterns": [
90
+ "<rootDir>/example/node_modules",
91
+ "<rootDir>/lib/"
92
+ ]
93
+ },
94
+ "commitlint": {
95
+ "extends": [
96
+ "@commitlint/config-conventional"
97
+ ]
98
+ },
99
+ "release-it": {
100
+ "git": {
101
+ "commitMessage": "chore: release ${version}",
102
+ "tagName": "v${version}"
103
+ },
104
+ "npm": {
105
+ "publish": true
106
+ },
107
+ "github": {
108
+ "release": true
109
+ },
110
+ "plugins": {
111
+ "@release-it/conventional-changelog": {
112
+ "preset": "angular"
113
+ }
114
+ }
115
+ },
116
+ "eslintConfig": {
117
+ "root": true,
118
+ "extends": [
119
+ "@react-native-community",
120
+ "prettier"
121
+ ],
122
+ "rules": {
123
+ "prettier/prettier": [
124
+ "error",
125
+ {
126
+ "quoteProps": "consistent",
127
+ "singleQuote": true,
128
+ "tabWidth": 2,
129
+ "trailingComma": "es5",
130
+ "useTabs": false
131
+ }
132
+ ]
133
+ }
134
+ },
135
+ "eslintIgnore": [
136
+ "node_modules/",
137
+ "lib/"
138
+ ],
139
+ "prettier": {
140
+ "quoteProps": "consistent",
141
+ "singleQuote": true,
142
+ "tabWidth": 2,
143
+ "trailingComma": "es5",
144
+ "useTabs": false
145
+ },
146
+ "react-native-builder-bob": {
147
+ "source": "src",
148
+ "output": "lib",
149
+ "targets": [
150
+ "commonjs",
151
+ "module",
152
+ [
153
+ "typescript",
154
+ {
155
+ "project": "tsconfig.build.json"
156
+ }
157
+ ]
158
+ ]
159
+ },
160
+ "codegenConfig": {
161
+ "name": "RNNotiflySdkSpec",
162
+ "type": "modules",
163
+ "jsSrcsDir": "src"
34
164
  }
35
165
  }
@@ -0,0 +1,25 @@
1
+ import type { TurboModule } from 'react-native';
2
+ import { TurboModuleRegistry } from 'react-native';
3
+ import { type UserProperties, type EventProperties } from './types';
4
+
5
+ export interface Spec extends TurboModule {
6
+ multiply(a: number, b: number): Promise<number>;
7
+ initialize(
8
+ projectId: string,
9
+ username: string,
10
+ password: string,
11
+ useCustomClickHandler: boolean | undefined
12
+ ): Promise<void>;
13
+ setUserId(userId: string | undefined): Promise<void>;
14
+ setUserProperties(userProperties: UserProperties): Promise<void>;
15
+ trackEvent(
16
+ eventName: string,
17
+ eventParams: EventProperties | null | undefined,
18
+ segmentationEventParamKeys: string[] | undefined | null
19
+ ): Promise<void>;
20
+ setLogLevel(logLevel: number): Promise<void>;
21
+ notiflyBackgroundHandler(_remoteMessage: any): Promise<void>;
22
+ setNotificationOpenedHandler(): Promise<void>;
23
+ }
24
+
25
+ export default TurboModuleRegistry.getEnforcing<Spec>('NotiflySdk');
package/src/index.tsx ADDED
@@ -0,0 +1,105 @@
1
+ import { NativeModules, Platform } from 'react-native';
2
+ import { type UserProperties, type EventProperties } from './types';
3
+
4
+ const LINKING_ERROR =
5
+ `The package 'notifly-sdk' doesn't seem to be linked. Make sure: \n\n` +
6
+ Platform.select({ ios: "- You have run 'pod install'\n", default: '' }) +
7
+ '- You rebuilt the app after installing the package\n' +
8
+ '- You are not using Expo Go\n';
9
+
10
+ // @ts-expect-error
11
+ const isTurboModuleEnabled = global.__turboModuleProxy != null;
12
+
13
+ const NotiflySdkModule = isTurboModuleEnabled
14
+ ? require('./NativeNotiflySdk').default
15
+ : NativeModules.NotiflySdk;
16
+
17
+ const NotiflySdk = NotiflySdkModule
18
+ ? NotiflySdkModule
19
+ : new Proxy(
20
+ {},
21
+ {
22
+ get() {
23
+ throw new Error(LINKING_ERROR);
24
+ },
25
+ }
26
+ );
27
+
28
+ export function multiply(a: number, b: number): Promise<number> {
29
+ return NotiflySdk.multiply(a, b);
30
+ }
31
+
32
+ export function initialize(
33
+ projectId: string,
34
+ username: string,
35
+ password: string,
36
+ useCustomClickHandler: boolean | undefined = undefined
37
+ ): Promise<void> {
38
+ // @deprecated useCustomClickHandler is deprecated since version 2.3.0
39
+ if (typeof useCustomClickHandler !== 'undefined') {
40
+ console.warn(
41
+ 'Warning: useCustomClickHandler of notifly.initialize is deprecated and will be removed in the next major release.'
42
+ );
43
+ }
44
+ return NotiflySdk.initialize(projectId, username, password);
45
+ }
46
+
47
+ export function setUserId(userId: string | undefined): Promise<void> {
48
+ return NotiflySdk.setUserId(userId);
49
+ }
50
+
51
+ export function setUserProperties(properties: UserProperties): Promise<void> {
52
+ return NotiflySdk.setUserProperties(properties);
53
+ }
54
+
55
+ export function trackEvent(
56
+ eventName: string,
57
+ eventParams: EventProperties | null | undefined = undefined,
58
+ segmentationEventParamKeys: string[] | undefined | null = null
59
+ ): Promise<void> {
60
+ return NotiflySdk.trackEvent(
61
+ eventName,
62
+ eventParams,
63
+ segmentationEventParamKeys
64
+ );
65
+ }
66
+
67
+ export function setLogLevel(logLevel: number): Promise<void> {
68
+ // only implemented on Android
69
+ if (Platform.OS === 'android') {
70
+ return NotiflySdk.setLogLevel(logLevel);
71
+ }
72
+ return Promise.resolve();
73
+ }
74
+
75
+ /**
76
+ * @deprecated Since version 2.3.0.
77
+ */
78
+ export function notiflyBackgroundHandler(_remoteMessage: any): Promise<void> {
79
+ console.warn(
80
+ 'Warning: notifly.notiflyBackgroundHandler(remoteMessage) is deprecated and will be removed in the next major release. You do not need to call this method anymore. remoteMessage is now handled automatically.'
81
+ );
82
+ return Promise.resolve();
83
+ }
84
+
85
+ /**
86
+ * @deprecated Since version 2.3.0.
87
+ */
88
+ export function setNotiflyBackgroundMessageHandler(): Promise<void> {
89
+ console.warn(
90
+ 'Warning: notifly.setNotiflyBackgroundMessageHandler() is deprecated and will be removed in the next major release. You do not need to call this method anymore. remoteMessage is now handled automatically.'
91
+ );
92
+ return Promise.resolve();
93
+ }
94
+
95
+ const notifly = {
96
+ initialize,
97
+ setUserId,
98
+ setUserProperties,
99
+ trackEvent,
100
+ setLogLevel,
101
+ notiflyBackgroundHandler,
102
+ setNotiflyBackgroundMessageHandler,
103
+ };
104
+
105
+ export default notifly;
package/src/types.ts ADDED
@@ -0,0 +1,7 @@
1
+ export interface UserProperties {
2
+ [key: string]: any;
3
+ }
4
+
5
+ export interface EventProperties {
6
+ [key: string]: any;
7
+ }