@react-native-firebase/in-app-messaging 25.0.1 → 26.0.0
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.
- package/CHANGELOG.md +20 -0
- package/RNFBInAppMessaging.podspec +7 -6
- package/android/build.gradle +19 -0
- package/android/src/reactnative/java/io/invertase/firebase/fiam/{ReactNativeFirebaseFiamModule.java → NativeRNFBTurboFiam.java} +17 -18
- package/android/src/reactnative/java/io/invertase/firebase/fiam/ReactNativeFirebaseFiamPackage.java +1 -1
- package/android/src/reactnative/java/io/invertase/firebase/fiam/generated/java/com/facebook/fbreact/specs/NativeRNFBTurboFiamSpec.java +79 -0
- package/android/src/reactnative/java/io/invertase/firebase/fiam/generated/jni/CMakeLists.txt +36 -0
- package/android/src/reactnative/java/io/invertase/firebase/fiam/generated/jni/RNFBInAppMessagingTurboModules-generated.cpp +50 -0
- package/android/src/reactnative/java/io/invertase/firebase/fiam/generated/jni/RNFBInAppMessagingTurboModules.h +31 -0
- package/android/src/reactnative/java/io/invertase/firebase/fiam/generated/jni/react/renderer/components/RNFBInAppMessagingTurboModules/RNFBInAppMessagingTurboModulesJSI-generated.cpp +47 -0
- package/android/src/reactnative/java/io/invertase/firebase/fiam/generated/jni/react/renderer/components/RNFBInAppMessagingTurboModules/RNFBInAppMessagingTurboModulesJSI.h +98 -0
- package/dist/module/index.js +113 -3
- package/dist/module/index.js.map +1 -1
- package/dist/module/version.js +1 -1
- package/dist/module/web/RNFBFiamModule.js +34 -0
- package/dist/module/web/RNFBFiamModule.js.map +1 -0
- package/dist/typescript/lib/index.d.ts +46 -4
- package/dist/typescript/lib/index.d.ts.map +1 -1
- package/dist/typescript/lib/types/internal.d.ts +1 -8
- package/dist/typescript/lib/types/internal.d.ts.map +1 -1
- package/dist/typescript/lib/version.d.ts +1 -1
- package/dist/typescript/lib/web/RNFBFiamModule.d.ts +4 -0
- package/dist/typescript/lib/web/RNFBFiamModule.d.ts.map +1 -0
- package/ios/RNFBFiam/RNFBFiamModule.h +2 -3
- package/ios/RNFBFiam/{RNFBFiamModule.m → RNFBFiamModule.mm} +25 -21
- package/ios/RNFBFiam.xcodeproj/project.pbxproj +8 -8
- package/ios/generated/RCTAppDependencyProvider.h +25 -0
- package/ios/generated/RCTAppDependencyProvider.mm +55 -0
- package/ios/generated/RCTModulesConformingToProtocolsProvider.h +18 -0
- package/ios/generated/RCTModulesConformingToProtocolsProvider.mm +33 -0
- package/ios/generated/RCTThirdPartyComponentsProvider.h +16 -0
- package/ios/generated/RCTThirdPartyComponentsProvider.mm +23 -0
- package/ios/generated/RNFBInAppMessagingTurboModules/RNFBInAppMessagingTurboModules-generated.mm +60 -0
- package/ios/generated/RNFBInAppMessagingTurboModules/RNFBInAppMessagingTurboModules.h +112 -0
- package/ios/generated/RNFBInAppMessagingTurboModulesJSI-generated.cpp +47 -0
- package/ios/generated/RNFBInAppMessagingTurboModulesJSI.h +98 -0
- package/ios/generated/ReactAppDependencyProvider.podspec +34 -0
- package/lib/index.ts +141 -5
- package/lib/types/internal.ts +1 -16
- package/lib/version.ts +1 -1
- package/lib/web/RNFBFiamModule.ts +34 -0
- package/package.json +23 -5
- package/react-native.config.js +10 -0
- package/specs/NativeRNFBTurboFiam.ts +15 -0
- package/tsconfig.json +4 -0
- package/typedoc.json +1 -1
- package/dist/module/modular.js +0 -80
- package/dist/module/modular.js.map +0 -1
- package/dist/module/namespaced.js +0 -78
- package/dist/module/namespaced.js.map +0 -1
- package/dist/module/types/namespaced.js +0 -62
- package/dist/module/types/namespaced.js.map +0 -1
- package/dist/typescript/lib/modular.d.ts +0 -36
- package/dist/typescript/lib/modular.d.ts.map +0 -1
- package/dist/typescript/lib/namespaced.d.ts +0 -12
- package/dist/typescript/lib/namespaced.d.ts.map +0 -1
- package/dist/typescript/lib/types/namespaced.d.ts +0 -107
- package/dist/typescript/lib/types/namespaced.d.ts.map +0 -1
- package/lib/modular.ts +0 -101
- package/lib/namespaced.ts +0 -117
- package/lib/types/namespaced.ts +0 -137
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen).
|
|
3
|
+
*
|
|
4
|
+
* Do not edit this file as changes may cause incorrect behavior and will be lost
|
|
5
|
+
* once the code is regenerated.
|
|
6
|
+
*
|
|
7
|
+
* @generated by codegen project: GenerateModuleCpp.js
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
#include "RNFBInAppMessagingTurboModulesJSI.h"
|
|
11
|
+
|
|
12
|
+
namespace facebook::react {
|
|
13
|
+
|
|
14
|
+
static jsi::Value __hostFunction_NativeRNFBTurboFiamCxxSpecJSI_getConstants(jsi::Runtime &rt, TurboModule &turboModule, const jsi::Value* args, size_t count) {
|
|
15
|
+
return static_cast<NativeRNFBTurboFiamCxxSpecJSI *>(&turboModule)->getConstants(
|
|
16
|
+
rt
|
|
17
|
+
);
|
|
18
|
+
}
|
|
19
|
+
static jsi::Value __hostFunction_NativeRNFBTurboFiamCxxSpecJSI_setAutomaticDataCollectionEnabled(jsi::Runtime &rt, TurboModule &turboModule, const jsi::Value* args, size_t count) {
|
|
20
|
+
return static_cast<NativeRNFBTurboFiamCxxSpecJSI *>(&turboModule)->setAutomaticDataCollectionEnabled(
|
|
21
|
+
rt,
|
|
22
|
+
count <= 0 ? throw jsi::JSError(rt, "Expected argument in position 0 to be passed") : args[0].asBool()
|
|
23
|
+
);
|
|
24
|
+
}
|
|
25
|
+
static jsi::Value __hostFunction_NativeRNFBTurboFiamCxxSpecJSI_setMessagesDisplaySuppressed(jsi::Runtime &rt, TurboModule &turboModule, const jsi::Value* args, size_t count) {
|
|
26
|
+
return static_cast<NativeRNFBTurboFiamCxxSpecJSI *>(&turboModule)->setMessagesDisplaySuppressed(
|
|
27
|
+
rt,
|
|
28
|
+
count <= 0 ? throw jsi::JSError(rt, "Expected argument in position 0 to be passed") : args[0].asBool()
|
|
29
|
+
);
|
|
30
|
+
}
|
|
31
|
+
static jsi::Value __hostFunction_NativeRNFBTurboFiamCxxSpecJSI_triggerEvent(jsi::Runtime &rt, TurboModule &turboModule, const jsi::Value* args, size_t count) {
|
|
32
|
+
return static_cast<NativeRNFBTurboFiamCxxSpecJSI *>(&turboModule)->triggerEvent(
|
|
33
|
+
rt,
|
|
34
|
+
count <= 0 ? throw jsi::JSError(rt, "Expected argument in position 0 to be passed") : args[0].asString(rt)
|
|
35
|
+
);
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
NativeRNFBTurboFiamCxxSpecJSI::NativeRNFBTurboFiamCxxSpecJSI(std::shared_ptr<CallInvoker> jsInvoker)
|
|
39
|
+
: TurboModule("NativeRNFBTurboFiam", jsInvoker) {
|
|
40
|
+
methodMap_["getConstants"] = MethodMetadata {0, __hostFunction_NativeRNFBTurboFiamCxxSpecJSI_getConstants};
|
|
41
|
+
methodMap_["setAutomaticDataCollectionEnabled"] = MethodMetadata {1, __hostFunction_NativeRNFBTurboFiamCxxSpecJSI_setAutomaticDataCollectionEnabled};
|
|
42
|
+
methodMap_["setMessagesDisplaySuppressed"] = MethodMetadata {1, __hostFunction_NativeRNFBTurboFiamCxxSpecJSI_setMessagesDisplaySuppressed};
|
|
43
|
+
methodMap_["triggerEvent"] = MethodMetadata {1, __hostFunction_NativeRNFBTurboFiamCxxSpecJSI_triggerEvent};
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
|
|
47
|
+
} // namespace facebook::react
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen).
|
|
3
|
+
*
|
|
4
|
+
* Do not edit this file as changes may cause incorrect behavior and will be lost
|
|
5
|
+
* once the code is regenerated.
|
|
6
|
+
*
|
|
7
|
+
* @generated by codegen project: GenerateModuleH.js
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
#pragma once
|
|
11
|
+
|
|
12
|
+
#include <ReactCommon/TurboModule.h>
|
|
13
|
+
#include <react/bridging/Bridging.h>
|
|
14
|
+
|
|
15
|
+
namespace facebook::react {
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
class JSI_EXPORT NativeRNFBTurboFiamCxxSpecJSI : public TurboModule {
|
|
19
|
+
protected:
|
|
20
|
+
NativeRNFBTurboFiamCxxSpecJSI(std::shared_ptr<CallInvoker> jsInvoker);
|
|
21
|
+
|
|
22
|
+
public:
|
|
23
|
+
virtual jsi::Object getConstants(jsi::Runtime &rt) = 0;
|
|
24
|
+
virtual jsi::Value setAutomaticDataCollectionEnabled(jsi::Runtime &rt, bool enabled) = 0;
|
|
25
|
+
virtual jsi::Value setMessagesDisplaySuppressed(jsi::Runtime &rt, bool enabled) = 0;
|
|
26
|
+
virtual jsi::Value triggerEvent(jsi::Runtime &rt, jsi::String eventId) = 0;
|
|
27
|
+
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
template <typename T>
|
|
31
|
+
class JSI_EXPORT NativeRNFBTurboFiamCxxSpec : public TurboModule {
|
|
32
|
+
public:
|
|
33
|
+
jsi::Value create(jsi::Runtime &rt, const jsi::PropNameID &propName) override {
|
|
34
|
+
return delegate_.create(rt, propName);
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
std::vector<jsi::PropNameID> getPropertyNames(jsi::Runtime& runtime) override {
|
|
38
|
+
return delegate_.getPropertyNames(runtime);
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
static constexpr std::string_view kModuleName = "NativeRNFBTurboFiam";
|
|
42
|
+
|
|
43
|
+
protected:
|
|
44
|
+
NativeRNFBTurboFiamCxxSpec(std::shared_ptr<CallInvoker> jsInvoker)
|
|
45
|
+
: TurboModule(std::string{NativeRNFBTurboFiamCxxSpec::kModuleName}, jsInvoker),
|
|
46
|
+
delegate_(reinterpret_cast<T*>(this), jsInvoker) {}
|
|
47
|
+
|
|
48
|
+
|
|
49
|
+
private:
|
|
50
|
+
class Delegate : public NativeRNFBTurboFiamCxxSpecJSI {
|
|
51
|
+
public:
|
|
52
|
+
Delegate(T *instance, std::shared_ptr<CallInvoker> jsInvoker) :
|
|
53
|
+
NativeRNFBTurboFiamCxxSpecJSI(std::move(jsInvoker)), instance_(instance) {
|
|
54
|
+
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
jsi::Object getConstants(jsi::Runtime &rt) override {
|
|
58
|
+
static_assert(
|
|
59
|
+
bridging::getParameterCount(&T::getConstants) == 1,
|
|
60
|
+
"Expected getConstants(...) to have 1 parameters");
|
|
61
|
+
|
|
62
|
+
return bridging::callFromJs<jsi::Object>(
|
|
63
|
+
rt, &T::getConstants, jsInvoker_, instance_);
|
|
64
|
+
}
|
|
65
|
+
jsi::Value setAutomaticDataCollectionEnabled(jsi::Runtime &rt, bool enabled) override {
|
|
66
|
+
static_assert(
|
|
67
|
+
bridging::getParameterCount(&T::setAutomaticDataCollectionEnabled) == 2,
|
|
68
|
+
"Expected setAutomaticDataCollectionEnabled(...) to have 2 parameters");
|
|
69
|
+
|
|
70
|
+
return bridging::callFromJs<jsi::Value>(
|
|
71
|
+
rt, &T::setAutomaticDataCollectionEnabled, jsInvoker_, instance_, std::move(enabled));
|
|
72
|
+
}
|
|
73
|
+
jsi::Value setMessagesDisplaySuppressed(jsi::Runtime &rt, bool enabled) override {
|
|
74
|
+
static_assert(
|
|
75
|
+
bridging::getParameterCount(&T::setMessagesDisplaySuppressed) == 2,
|
|
76
|
+
"Expected setMessagesDisplaySuppressed(...) to have 2 parameters");
|
|
77
|
+
|
|
78
|
+
return bridging::callFromJs<jsi::Value>(
|
|
79
|
+
rt, &T::setMessagesDisplaySuppressed, jsInvoker_, instance_, std::move(enabled));
|
|
80
|
+
}
|
|
81
|
+
jsi::Value triggerEvent(jsi::Runtime &rt, jsi::String eventId) override {
|
|
82
|
+
static_assert(
|
|
83
|
+
bridging::getParameterCount(&T::triggerEvent) == 2,
|
|
84
|
+
"Expected triggerEvent(...) to have 2 parameters");
|
|
85
|
+
|
|
86
|
+
return bridging::callFromJs<jsi::Value>(
|
|
87
|
+
rt, &T::triggerEvent, jsInvoker_, instance_, std::move(eventId));
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
private:
|
|
91
|
+
friend class NativeRNFBTurboFiamCxxSpec;
|
|
92
|
+
T *instance_;
|
|
93
|
+
};
|
|
94
|
+
|
|
95
|
+
Delegate delegate_;
|
|
96
|
+
};
|
|
97
|
+
|
|
98
|
+
} // namespace facebook::react
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
# Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
2
|
+
#
|
|
3
|
+
# This source code is licensed under the MIT license found in the
|
|
4
|
+
# LICENSE file in the root directory of this source tree.
|
|
5
|
+
|
|
6
|
+
version = "0.78.3"
|
|
7
|
+
source = { :git => 'https://github.com/facebook/react-native.git' }
|
|
8
|
+
if version == '1000.0.0'
|
|
9
|
+
# This is an unpublished version, use the latest commit hash of the react-native repo, which we’re presumably in.
|
|
10
|
+
source[:commit] = `git rev-parse HEAD`.strip if system("git rev-parse --git-dir > /dev/null 2>&1")
|
|
11
|
+
else
|
|
12
|
+
source[:tag] = "v#{version}"
|
|
13
|
+
end
|
|
14
|
+
|
|
15
|
+
Pod::Spec.new do |s|
|
|
16
|
+
s.name = "ReactAppDependencyProvider"
|
|
17
|
+
s.version = version
|
|
18
|
+
s.summary = "The third party dependency provider for the app"
|
|
19
|
+
s.homepage = "https://reactnative.dev/"
|
|
20
|
+
s.documentation_url = "https://reactnative.dev/"
|
|
21
|
+
s.license = "MIT"
|
|
22
|
+
s.author = "Meta Platforms, Inc. and its affiliates"
|
|
23
|
+
s.platforms = min_supported_versions
|
|
24
|
+
s.source = source
|
|
25
|
+
s.source_files = "**/RCTAppDependencyProvider.{h,mm}"
|
|
26
|
+
|
|
27
|
+
# This guard prevent to install the dependencies when we run `pod install` in the old architecture.
|
|
28
|
+
s.pod_target_xcconfig = {
|
|
29
|
+
"CLANG_CXX_LANGUAGE_STANDARD" => rct_cxx_language_standard(),
|
|
30
|
+
"DEFINES_MODULE" => "YES"
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
s.dependency "ReactCodegen"
|
|
34
|
+
end
|
package/lib/index.ts
CHANGED
|
@@ -15,11 +15,147 @@
|
|
|
15
15
|
*
|
|
16
16
|
*/
|
|
17
17
|
|
|
18
|
-
|
|
18
|
+
import { isBoolean, isString } from '@react-native-firebase/app/dist/module/common';
|
|
19
|
+
import {
|
|
20
|
+
FirebaseModule,
|
|
21
|
+
getOrCreateModularInstance,
|
|
22
|
+
} from '@react-native-firebase/app/dist/module/internal';
|
|
23
|
+
import type { ModuleConfig } from '@react-native-firebase/app/dist/module/internal';
|
|
24
|
+
import { setReactNativeModule } from '@react-native-firebase/app/dist/module/internal/nativeModule';
|
|
25
|
+
import './types/internal';
|
|
26
|
+
import type { FirebaseApp } from '@react-native-firebase/app';
|
|
27
|
+
import type { InAppMessaging } from './types/in-app-messaging';
|
|
28
|
+
import fallBackModule from './web/RNFBFiamModule';
|
|
29
|
+
import { version } from './version';
|
|
30
|
+
|
|
31
|
+
const nativeModuleName = 'NativeRNFBTurboFiam';
|
|
32
|
+
|
|
33
|
+
class FirebaseFiamModule extends FirebaseModule<typeof nativeModuleName> {
|
|
34
|
+
private _isMessagesDisplaySuppressed: boolean;
|
|
35
|
+
private _isAutomaticDataCollectionEnabled: boolean;
|
|
36
|
+
|
|
37
|
+
constructor(...args: ConstructorParameters<typeof FirebaseModule>) {
|
|
38
|
+
super(...args);
|
|
39
|
+
this._isMessagesDisplaySuppressed = this.native.isMessagesDisplaySuppressed;
|
|
40
|
+
this._isAutomaticDataCollectionEnabled = this.native.isAutomaticDataCollectionEnabled;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
get isMessagesDisplaySuppressed(): boolean {
|
|
44
|
+
return this._isMessagesDisplaySuppressed;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
get isAutomaticDataCollectionEnabled(): boolean {
|
|
48
|
+
return this._isAutomaticDataCollectionEnabled;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
setMessagesDisplaySuppressed(enabled: boolean): Promise<null> {
|
|
52
|
+
if (!isBoolean(enabled)) {
|
|
53
|
+
throw new Error(
|
|
54
|
+
"getInAppMessaging().setMessagesDisplaySuppressed(*) 'enabled' must be a boolean.",
|
|
55
|
+
);
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
this._isMessagesDisplaySuppressed = enabled;
|
|
59
|
+
return this.native.setMessagesDisplaySuppressed(enabled);
|
|
60
|
+
}
|
|
19
61
|
|
|
20
|
-
|
|
62
|
+
setAutomaticDataCollectionEnabled(enabled: boolean): Promise<null> {
|
|
63
|
+
if (!isBoolean(enabled)) {
|
|
64
|
+
throw new Error(
|
|
65
|
+
"getInAppMessaging().setAutomaticDataCollectionEnabled(*) 'enabled' must be a boolean.",
|
|
66
|
+
);
|
|
67
|
+
}
|
|
21
68
|
|
|
22
|
-
|
|
69
|
+
this._isAutomaticDataCollectionEnabled = enabled;
|
|
70
|
+
return this.native.setAutomaticDataCollectionEnabled(enabled);
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
triggerEvent(eventId: string): Promise<null> {
|
|
74
|
+
if (!isString(eventId)) {
|
|
75
|
+
throw new Error("getInAppMessaging().triggerEvent(*) 'eventId' must be a string.");
|
|
76
|
+
}
|
|
77
|
+
return this.native.triggerEvent(eventId);
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
const config: ModuleConfig = {
|
|
82
|
+
namespace: 'inAppMessaging',
|
|
83
|
+
nativeModuleName,
|
|
84
|
+
nativeEvents: false,
|
|
85
|
+
hasMultiAppSupport: false,
|
|
86
|
+
hasCustomUrlOrRegionSupport: false,
|
|
87
|
+
turboModule: true,
|
|
88
|
+
};
|
|
89
|
+
|
|
90
|
+
/**
|
|
91
|
+
* RN Firebase package version string exported from the modular entry point.
|
|
92
|
+
*
|
|
93
|
+
* The firebase-js-sdk does not ship a modular In-App Messaging entry point or `SDK_VERSION` export.
|
|
94
|
+
*/
|
|
95
|
+
export const SDK_VERSION = version;
|
|
96
|
+
|
|
97
|
+
/**
|
|
98
|
+
* Returns the {@link InAppMessaging} instance for the default or given {@link FirebaseApp}.
|
|
99
|
+
*
|
|
100
|
+
* @param app - The Firebase `FirebaseApp` to use. When omitted, the default app is used.
|
|
101
|
+
* @returns The In-App Messaging service instance for that app.
|
|
102
|
+
*/
|
|
103
|
+
export function getInAppMessaging(app?: FirebaseApp): InAppMessaging {
|
|
104
|
+
return getOrCreateModularInstance(FirebaseFiamModule, config, app) as unknown as InAppMessaging;
|
|
105
|
+
}
|
|
23
106
|
|
|
24
|
-
|
|
25
|
-
|
|
107
|
+
/**
|
|
108
|
+
* Determines whether messages are suppressed or not.
|
|
109
|
+
*/
|
|
110
|
+
export function isMessagesDisplaySuppressed(inAppMessaging: InAppMessaging): boolean {
|
|
111
|
+
return inAppMessaging.isMessagesDisplaySuppressed;
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
/**
|
|
115
|
+
* Enable or disable suppression of Firebase In App Messaging messages.
|
|
116
|
+
*
|
|
117
|
+
* When enabled, no in app messages will be rendered until either you disable suppression, or the app
|
|
118
|
+
* restarts. This state is not persisted between app restarts.
|
|
119
|
+
*/
|
|
120
|
+
export function setMessagesDisplaySuppressed(
|
|
121
|
+
inAppMessaging: InAppMessaging,
|
|
122
|
+
enabled: boolean,
|
|
123
|
+
): Promise<null> {
|
|
124
|
+
return inAppMessaging.setMessagesDisplaySuppressed(enabled);
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
/**
|
|
128
|
+
* Determines whether automatic data collection is enabled or not.
|
|
129
|
+
*/
|
|
130
|
+
export function isAutomaticDataCollectionEnabled(inAppMessaging: InAppMessaging): boolean {
|
|
131
|
+
return inAppMessaging.isAutomaticDataCollectionEnabled;
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
/**
|
|
135
|
+
* Enable or disable automatic data collection for Firebase In-App Messaging.
|
|
136
|
+
*
|
|
137
|
+
* When enabled, generates a registration token on app startup if there is no valid one and
|
|
138
|
+
* generates a new token when it is deleted (which prevents `deleteInstanceId()` from stopping the
|
|
139
|
+
* periodic sending of data).
|
|
140
|
+
*
|
|
141
|
+
* This setting is persisted across app restarts and overrides the setting specified in your
|
|
142
|
+
* manifest/plist file.
|
|
143
|
+
*/
|
|
144
|
+
export function setAutomaticDataCollectionEnabled(
|
|
145
|
+
inAppMessaging: InAppMessaging,
|
|
146
|
+
enabled: boolean,
|
|
147
|
+
): Promise<null> {
|
|
148
|
+
return inAppMessaging.setAutomaticDataCollectionEnabled(enabled);
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
/**
|
|
152
|
+
* Trigger in-app messages programmatically.
|
|
153
|
+
*/
|
|
154
|
+
export function triggerEvent(inAppMessaging: InAppMessaging, eventId: string): Promise<null> {
|
|
155
|
+
return inAppMessaging.triggerEvent(eventId);
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
// Register the interop module for non-native platforms.
|
|
159
|
+
setReactNativeModule(nativeModuleName, fallBackModule as unknown as Record<string, unknown>);
|
|
160
|
+
|
|
161
|
+
export type { InAppMessaging } from './types/in-app-messaging';
|
package/lib/types/internal.ts
CHANGED
|
@@ -17,9 +17,6 @@
|
|
|
17
17
|
|
|
18
18
|
import type { InAppMessaging } from './in-app-messaging';
|
|
19
19
|
|
|
20
|
-
/** Optional final argument passed by modular API wrappers (MODULAR_DEPRECATION_ARG). */
|
|
21
|
-
export type InAppMessagingModularDeprecationArg = string;
|
|
22
|
-
|
|
23
20
|
/**
|
|
24
21
|
* Wrapped native module contract for `RNFBFiamModule`.
|
|
25
22
|
*/
|
|
@@ -33,22 +30,10 @@ export interface RNFBFiamModule {
|
|
|
33
30
|
|
|
34
31
|
declare module '@react-native-firebase/app/dist/module/internal/NativeModules' {
|
|
35
32
|
interface ReactNativeFirebaseNativeModules {
|
|
36
|
-
|
|
33
|
+
NativeRNFBTurboFiam: RNFBFiamModule;
|
|
37
34
|
}
|
|
38
35
|
}
|
|
39
36
|
|
|
40
37
|
export interface InAppMessagingInternal extends InAppMessaging {
|
|
41
38
|
readonly native: RNFBFiamModule;
|
|
42
39
|
}
|
|
43
|
-
|
|
44
|
-
export type InAppMessagingWithDeprecationArg = InAppMessagingInternal & {
|
|
45
|
-
setMessagesDisplaySuppressed(
|
|
46
|
-
enabled: boolean,
|
|
47
|
-
_depArg: InAppMessagingModularDeprecationArg,
|
|
48
|
-
): Promise<null>;
|
|
49
|
-
setAutomaticDataCollectionEnabled(
|
|
50
|
-
enabled: boolean,
|
|
51
|
-
_depArg: InAppMessagingModularDeprecationArg,
|
|
52
|
-
): Promise<null>;
|
|
53
|
-
triggerEvent(eventId: string, _depArg: InAppMessagingModularDeprecationArg): Promise<null>;
|
|
54
|
-
};
|
package/lib/version.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// Generated by genversion.
|
|
2
|
-
export const version = '
|
|
2
|
+
export const version = '26.0.0';
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright (c) 2016-present Invertase Limited & Contributors
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this library except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*
|
|
16
|
+
*/
|
|
17
|
+
|
|
18
|
+
import type { RNFBFiamModule } from '../types/internal';
|
|
19
|
+
|
|
20
|
+
const RNFBFiamModuleWeb: RNFBFiamModule = {
|
|
21
|
+
isMessagesDisplaySuppressed: false,
|
|
22
|
+
isAutomaticDataCollectionEnabled: false,
|
|
23
|
+
setMessagesDisplaySuppressed() {
|
|
24
|
+
return Promise.resolve(null);
|
|
25
|
+
},
|
|
26
|
+
setAutomaticDataCollectionEnabled() {
|
|
27
|
+
return Promise.resolve(null);
|
|
28
|
+
},
|
|
29
|
+
triggerEvent() {
|
|
30
|
+
return Promise.resolve(null);
|
|
31
|
+
},
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
export default RNFBFiamModuleWeb;
|
package/package.json
CHANGED
|
@@ -1,15 +1,32 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@react-native-firebase/in-app-messaging",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "26.0.0",
|
|
4
4
|
"author": "Invertase <oss@invertase.io> (http://invertase.io)",
|
|
5
5
|
"description": "React Native Firebase - Firebase In-App Messaging helps you engage your app's active users by sending them targeted, contextual messages that encourage them to use key app features. React Native Firebase provides support for both native Android & iOS integration with a simple JavaScript API.",
|
|
6
6
|
"main": "./dist/module/index.js",
|
|
7
7
|
"types": "./dist/typescript/lib/index.d.ts",
|
|
8
|
+
"codegenConfig": {
|
|
9
|
+
"name": "RNFBInAppMessagingTurboModules",
|
|
10
|
+
"type": "modules",
|
|
11
|
+
"jsSrcsDir": "specs",
|
|
12
|
+
"includesGeneratedCode": true,
|
|
13
|
+
"android": {
|
|
14
|
+
"javaPackageName": "io.invertase.firebase.fiam"
|
|
15
|
+
},
|
|
16
|
+
"ios": {
|
|
17
|
+
"modulesProvider": {
|
|
18
|
+
"NativeRNFBTurboFiam": "RNFBFiamModule"
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
},
|
|
8
22
|
"scripts": {
|
|
9
23
|
"build": "genversion --esm --semi lib/version.ts",
|
|
10
24
|
"build:clean": "rimraf android/build && rimraf ios/build",
|
|
11
25
|
"compile": "bob build",
|
|
12
|
-
"prepare": "yarn run build && yarn compile"
|
|
26
|
+
"prepare": "yarn run build && yarn compile",
|
|
27
|
+
"codegen": "yarn android:codegen && yarn ios:codegen",
|
|
28
|
+
"android:codegen": "npx @react-native-community/cli codegen --platform android --outputPath=./android/src/reactnative/java/io/invertase/firebase/fiam/generated",
|
|
29
|
+
"ios:codegen": "npx @react-native-community/cli codegen --platform ios --outputPath=./ios/generated"
|
|
13
30
|
},
|
|
14
31
|
"repository": {
|
|
15
32
|
"type": "git",
|
|
@@ -28,14 +45,15 @@
|
|
|
28
45
|
"inAppMessaging"
|
|
29
46
|
],
|
|
30
47
|
"peerDependencies": {
|
|
31
|
-
"@react-native-firebase/analytics": "
|
|
32
|
-
"@react-native-firebase/app": "
|
|
48
|
+
"@react-native-firebase/analytics": "26.0.0",
|
|
49
|
+
"@react-native-firebase/app": "26.0.0"
|
|
33
50
|
},
|
|
34
51
|
"publishConfig": {
|
|
35
52
|
"access": "public",
|
|
36
53
|
"provenance": true
|
|
37
54
|
},
|
|
38
55
|
"devDependencies": {
|
|
56
|
+
"@react-native-firebase/app": "26.0.0",
|
|
39
57
|
"react-native-builder-bob": "^0.41.0"
|
|
40
58
|
},
|
|
41
59
|
"exports": {
|
|
@@ -68,5 +86,5 @@
|
|
|
68
86
|
"node_modules/",
|
|
69
87
|
"dist/"
|
|
70
88
|
],
|
|
71
|
-
"gitHead": "
|
|
89
|
+
"gitHead": "2a360acb2aebdd39dd40e31be386b30697270626"
|
|
72
90
|
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { TurboModule } from 'react-native';
|
|
2
|
+
import { TurboModuleRegistry } from 'react-native';
|
|
3
|
+
|
|
4
|
+
export interface Spec extends TurboModule {
|
|
5
|
+
getConstants(): {
|
|
6
|
+
isMessagesDisplaySuppressed: boolean;
|
|
7
|
+
isAutomaticDataCollectionEnabled: boolean;
|
|
8
|
+
};
|
|
9
|
+
|
|
10
|
+
setAutomaticDataCollectionEnabled(enabled: boolean): Promise<void>;
|
|
11
|
+
setMessagesDisplaySuppressed(enabled: boolean): Promise<void>;
|
|
12
|
+
triggerEvent(eventId: string): Promise<void>;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export default TurboModuleRegistry.getEnforcing<Spec>('NativeRNFBTurboFiam');
|
package/tsconfig.json
CHANGED
|
@@ -3,7 +3,11 @@
|
|
|
3
3
|
"compilerOptions": {
|
|
4
4
|
"rootDir": ".",
|
|
5
5
|
"paths": {
|
|
6
|
+
"@react-native-firebase/app/dist/module/common/*": ["../app/dist/typescript/lib/common/*"],
|
|
6
7
|
"@react-native-firebase/app/dist/module/common": ["../app/dist/typescript/lib/common"],
|
|
8
|
+
"@react-native-firebase/app/dist/module/internal/*": [
|
|
9
|
+
"../app/dist/typescript/lib/internal/*"
|
|
10
|
+
],
|
|
7
11
|
"@react-native-firebase/app/dist/module/internal": ["../app/dist/typescript/lib/internal"],
|
|
8
12
|
"@react-native-firebase/app/dist/module/internal/NativeModules": [
|
|
9
13
|
"../app/dist/typescript/lib/internal/NativeModules"
|
package/typedoc.json
CHANGED
package/dist/module/modular.js
DELETED
|
@@ -1,80 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
/*
|
|
4
|
-
* Copyright (c) 2016-present Invertase Limited & Contributors
|
|
5
|
-
*
|
|
6
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
7
|
-
* you may not use this library except in compliance with the License.
|
|
8
|
-
* You may obtain a copy of the License at
|
|
9
|
-
*
|
|
10
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
11
|
-
*
|
|
12
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
13
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
14
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
15
|
-
* See the License for the specific language governing permissions and
|
|
16
|
-
* limitations under the License.
|
|
17
|
-
*
|
|
18
|
-
*/
|
|
19
|
-
|
|
20
|
-
import { getApp } from '@react-native-firebase/app';
|
|
21
|
-
import { MODULAR_DEPRECATION_ARG, withModularFlag } from '@react-native-firebase/app/dist/module/common';
|
|
22
|
-
function withModularDeprecationArg(inAppMessaging) {
|
|
23
|
-
return inAppMessaging;
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
/**
|
|
27
|
-
* Returns the {@link InAppMessaging} instance for the default app.
|
|
28
|
-
*/
|
|
29
|
-
export function getInAppMessaging() {
|
|
30
|
-
return getApp().inAppMessaging();
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
/**
|
|
34
|
-
* Determines whether messages are suppressed or not.
|
|
35
|
-
*/
|
|
36
|
-
export function isMessagesDisplaySuppressed(inAppMessaging) {
|
|
37
|
-
return withModularFlag(() => inAppMessaging.isMessagesDisplaySuppressed);
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
/**
|
|
41
|
-
* Enable or disable suppression of Firebase In App Messaging messages.
|
|
42
|
-
*
|
|
43
|
-
* When enabled, no in app messages will be rendered until either you disable suppression, or the app
|
|
44
|
-
* restarts. This state is not persisted between app restarts.
|
|
45
|
-
*/
|
|
46
|
-
export function setMessagesDisplaySuppressed(inAppMessaging, enabled) {
|
|
47
|
-
const internalInAppMessaging = withModularDeprecationArg(inAppMessaging);
|
|
48
|
-
return internalInAppMessaging.setMessagesDisplaySuppressed.call(internalInAppMessaging, enabled, MODULAR_DEPRECATION_ARG);
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
/**
|
|
52
|
-
* Determines whether automatic data collection is enabled or not.
|
|
53
|
-
*/
|
|
54
|
-
export function isAutomaticDataCollectionEnabled(inAppMessaging) {
|
|
55
|
-
return withModularFlag(() => inAppMessaging.isAutomaticDataCollectionEnabled);
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
/**
|
|
59
|
-
* Enable or disable automatic data collection for Firebase In-App Messaging.
|
|
60
|
-
*
|
|
61
|
-
* When enabled, generates a registration token on app startup if there is no valid one and
|
|
62
|
-
* generates a new token when it is deleted (which prevents `deleteInstanceId()` from stopping the
|
|
63
|
-
* periodic sending of data).
|
|
64
|
-
*
|
|
65
|
-
* This setting is persisted across app restarts and overrides the setting specified in your
|
|
66
|
-
* manifest/plist file.
|
|
67
|
-
*/
|
|
68
|
-
export function setAutomaticDataCollectionEnabled(inAppMessaging, enabled) {
|
|
69
|
-
const internalInAppMessaging = withModularDeprecationArg(inAppMessaging);
|
|
70
|
-
return internalInAppMessaging.setAutomaticDataCollectionEnabled.call(internalInAppMessaging, enabled, MODULAR_DEPRECATION_ARG);
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
/**
|
|
74
|
-
* Trigger in-app messages programmatically.
|
|
75
|
-
*/
|
|
76
|
-
export function triggerEvent(inAppMessaging, eventId) {
|
|
77
|
-
const internalInAppMessaging = withModularDeprecationArg(inAppMessaging);
|
|
78
|
-
return internalInAppMessaging.triggerEvent.call(internalInAppMessaging, eventId, MODULAR_DEPRECATION_ARG);
|
|
79
|
-
}
|
|
80
|
-
//# sourceMappingURL=modular.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["getApp","MODULAR_DEPRECATION_ARG","withModularFlag","withModularDeprecationArg","inAppMessaging","getInAppMessaging","isMessagesDisplaySuppressed","setMessagesDisplaySuppressed","enabled","internalInAppMessaging","call","isAutomaticDataCollectionEnabled","setAutomaticDataCollectionEnabled","triggerEvent","eventId"],"sourceRoot":"../../lib","sources":["modular.ts"],"mappings":";;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,SAASA,MAAM,QAAQ,4BAA4B;AACnD,SACEC,uBAAuB,EACvBC,eAAe,QACV,+CAA+C;AAItD,SAASC,yBAAyBA,CAACC,cAA8B,EAAoC;EACnG,OAAOA,cAAc;AACvB;;AAEA;AACA;AACA;AACA,OAAO,SAASC,iBAAiBA,CAAA,EAAmB;EAClD,OAAOL,MAAM,CAAC,CAAC,CAACI,cAAc,CAAC,CAAC;AAClC;;AAEA;AACA;AACA;AACA,OAAO,SAASE,2BAA2BA,CAACF,cAA8B,EAAW;EACnF,OAAOF,eAAe,CAAC,MAAME,cAAc,CAACE,2BAA2B,CAAC;AAC1E;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASC,4BAA4BA,CAC1CH,cAA8B,EAC9BI,OAAgB,EACD;EACf,MAAMC,sBAAsB,GAAGN,yBAAyB,CAACC,cAAc,CAAC;EACxE,OAAOK,sBAAsB,CAACF,4BAA4B,CAACG,IAAI,CAC7DD,sBAAsB,EACtBD,OAAO,EACPP,uBACF,CAAC;AACH;;AAEA;AACA;AACA;AACA,OAAO,SAASU,gCAAgCA,CAACP,cAA8B,EAAW;EACxF,OAAOF,eAAe,CAAC,MAAME,cAAc,CAACO,gCAAgC,CAAC;AAC/E;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASC,iCAAiCA,CAC/CR,cAA8B,EAC9BI,OAAgB,EACD;EACf,MAAMC,sBAAsB,GAAGN,yBAAyB,CAACC,cAAc,CAAC;EACxE,OAAOK,sBAAsB,CAACG,iCAAiC,CAACF,IAAI,CAClED,sBAAsB,EACtBD,OAAO,EACPP,uBACF,CAAC;AACH;;AAEA;AACA;AACA;AACA,OAAO,SAASY,YAAYA,CAACT,cAA8B,EAAEU,OAAe,EAAiB;EAC3F,MAAML,sBAAsB,GAAGN,yBAAyB,CAACC,cAAc,CAAC;EACxE,OAAOK,sBAAsB,CAACI,YAAY,CAACH,IAAI,CAC7CD,sBAAsB,EACtBK,OAAO,EACPb,uBACF,CAAC;AACH","ignoreList":[]}
|