posthog-react-native 1.1.4 → 2.0.0-alpha8
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/README.md +9 -0
- package/lib/index.cjs.js +1761 -0
- package/lib/index.cjs.js.map +1 -0
- package/lib/index.d.ts +211 -0
- package/lib/index.esm.js +1725 -0
- package/lib/index.esm.js.map +1 -0
- package/lib/node_modules/tslib/tslib.es6.d.ts +35 -0
- package/lib/posthog-core/src/eventemitter.d.ts +8 -0
- package/lib/posthog-core/src/index.d.ts +84 -0
- package/lib/posthog-core/src/lz-string.d.ts +8 -0
- package/lib/posthog-core/src/types.d.ts +68 -0
- package/lib/posthog-core/src/utils.d.ts +13 -0
- package/lib/posthog-react-native/index.d.ts +10 -0
- package/lib/posthog-react-native/src/PostHogProvider.d.ts +13 -0
- package/lib/posthog-react-native/src/PosthogContext.d.ts +5 -0
- package/lib/posthog-react-native/src/autocapture.d.ts +3 -0
- package/lib/posthog-react-native/src/hooks/useFeatureFlag.d.ts +1 -0
- package/lib/posthog-react-native/src/hooks/useFeatureFlags.d.ts +3 -0
- package/lib/posthog-react-native/src/hooks/useLifecycleTracker.d.ts +2 -0
- package/lib/posthog-react-native/src/hooks/useNavigationTracker.d.ts +5 -0
- package/lib/posthog-react-native/src/hooks/usePostHog.d.ts +2 -0
- package/lib/posthog-react-native/src/legacy.d.ts +4 -0
- package/lib/posthog-react-native/src/optional-imports.d.ts +6 -0
- package/lib/posthog-react-native/src/posthog-rn.d.ts +14 -0
- package/lib/posthog-react-native/src/storage.d.ts +8 -0
- package/lib/posthog-react-native/src/types.d.ts +12 -0
- package/package.json +35 -51
- package/RNPostHog.podspec +0 -21
- package/android/build.gradle +0 -46
- package/android/src/main/AndroidManifest.xml +0 -1
- package/android/src/main/java/com/posthog/reactnative/core/RNPostHogModule.kt +0 -251
- package/android/src/main/java/com/posthog/reactnative/core/RNPostHogPackage.kt +0 -44
- package/build/cjs/__mocks__/bridge.d.ts +0 -14
- package/build/cjs/__mocks__/bridge.js +0 -15
- package/build/cjs/__mocks__/bridge.js.map +0 -1
- package/build/cjs/__tests__/bridge.spec.d.ts +0 -1
- package/build/cjs/__tests__/bridge.spec.js +0 -19
- package/build/cjs/__tests__/bridge.spec.js.map +0 -1
- package/build/cjs/__tests__/configuration.spec.d.ts +0 -1
- package/build/cjs/__tests__/configuration.spec.js +0 -131
- package/build/cjs/__tests__/configuration.spec.js.map +0 -1
- package/build/cjs/__tests__/index.spec.d.ts +0 -1
- package/build/cjs/__tests__/index.spec.js +0 -9
- package/build/cjs/__tests__/index.spec.js.map +0 -1
- package/build/cjs/__tests__/posthog.spec.d.ts +0 -1
- package/build/cjs/__tests__/posthog.spec.js +0 -193
- package/build/cjs/__tests__/posthog.spec.js.map +0 -1
- package/build/cjs/bridge.d.ts +0 -50
- package/build/cjs/bridge.js +0 -9
- package/build/cjs/bridge.js.map +0 -1
- package/build/cjs/configuration.d.ts +0 -3
- package/build/cjs/configuration.js +0 -94
- package/build/cjs/configuration.js.map +0 -1
- package/build/cjs/index.d.ts +0 -5
- package/build/cjs/index.js +0 -6
- package/build/cjs/index.js.map +0 -1
- package/build/cjs/make-pkg.d.ts +0 -1
- package/build/cjs/make-pkg.js +0 -5
- package/build/cjs/make-pkg.js.map +0 -1
- package/build/cjs/middleware.d.ts +0 -41
- package/build/cjs/middleware.js +0 -114
- package/build/cjs/middleware.js.map +0 -1
- package/build/cjs/posthog.d.ts +0 -228
- package/build/cjs/posthog.js +0 -309
- package/build/cjs/posthog.js.map +0 -1
- package/build/cjs/utils.d.ts +0 -1
- package/build/cjs/utils.js +0 -7
- package/build/cjs/utils.js.map +0 -1
- package/build/cjs/wrapper.d.ts +0 -22
- package/build/cjs/wrapper.js +0 -114
- package/build/cjs/wrapper.js.map +0 -1
- package/build/esm/__mocks__/bridge.d.ts +0 -14
- package/build/esm/__mocks__/bridge.js +0 -13
- package/build/esm/__mocks__/bridge.js.map +0 -1
- package/build/esm/__tests__/bridge.spec.d.ts +0 -1
- package/build/esm/__tests__/bridge.spec.js +0 -19
- package/build/esm/__tests__/bridge.spec.js.map +0 -1
- package/build/esm/__tests__/configuration.spec.d.ts +0 -1
- package/build/esm/__tests__/configuration.spec.js +0 -129
- package/build/esm/__tests__/configuration.spec.js.map +0 -1
- package/build/esm/__tests__/index.spec.d.ts +0 -1
- package/build/esm/__tests__/index.spec.js +0 -7
- package/build/esm/__tests__/index.spec.js.map +0 -1
- package/build/esm/__tests__/posthog.spec.d.ts +0 -1
- package/build/esm/__tests__/posthog.spec.js +0 -191
- package/build/esm/__tests__/posthog.spec.js.map +0 -1
- package/build/esm/bridge.d.ts +0 -50
- package/build/esm/bridge.js +0 -7
- package/build/esm/bridge.js.map +0 -1
- package/build/esm/configuration.d.ts +0 -3
- package/build/esm/configuration.js +0 -92
- package/build/esm/configuration.js.map +0 -1
- package/build/esm/index.d.ts +0 -5
- package/build/esm/index.js +0 -4
- package/build/esm/index.js.map +0 -1
- package/build/esm/make-pkg.d.ts +0 -1
- package/build/esm/make-pkg.js +0 -3
- package/build/esm/make-pkg.js.map +0 -1
- package/build/esm/middleware.d.ts +0 -41
- package/build/esm/middleware.js +0 -112
- package/build/esm/middleware.js.map +0 -1
- package/build/esm/posthog.d.ts +0 -228
- package/build/esm/posthog.js +0 -307
- package/build/esm/posthog.js.map +0 -1
- package/build/esm/utils.d.ts +0 -1
- package/build/esm/utils.js +0 -4
- package/build/esm/utils.js.map +0 -1
- package/build/esm/wrapper.d.ts +0 -22
- package/build/esm/wrapper.js +0 -112
- package/build/esm/wrapper.js.map +0 -1
- package/build/package.json +0 -3
- package/ios/RNPostHog/RNPostHog.h +0 -9
- package/ios/RNPostHog/RNPostHog.m +0 -128
- package/ios/RNPostHog.xcodeproj/project.pbxproj +0 -336
- package/ios/RNPostHog.xcodeproj/project.xcworkspace/contents.xcworkspacedata +0 -7
- package/src/__mocks__/bridge.ts +0 -12
- package/src/__tests__/bridge.spec.ts +0 -23
- package/src/__tests__/configuration.spec.ts +0 -79
- package/src/__tests__/index.spec.ts +0 -7
- package/src/__tests__/posthog.spec.ts +0 -108
- package/src/bridge.ts +0 -61
- package/src/configuration.ts +0 -61
- package/src/index.ts +0 -5
- package/src/make-pkg.ts +0 -3
- package/src/middleware.ts +0 -128
- package/src/modules.d.ts +0 -2
- package/src/posthog.ts +0 -305
- package/src/utils.ts +0 -3
- package/src/wrapper.ts +0 -61
|
@@ -1,336 +0,0 @@
|
|
|
1
|
-
// !$*UTF8*$!
|
|
2
|
-
{
|
|
3
|
-
archiveVersion = 1;
|
|
4
|
-
classes = {
|
|
5
|
-
};
|
|
6
|
-
objectVersion = 46;
|
|
7
|
-
objects = {
|
|
8
|
-
|
|
9
|
-
/* Begin PBXBuildFile section */
|
|
10
|
-
4B5DE17A21B9DF4B00BF8844 /* PostHog.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 4B5DE17421B9DF3900BF8844 /* PostHog.framework */; };
|
|
11
|
-
B3E7B58A1CC2AC0600A0062D /* RNPostHog/RNPostHog.m in Sources */ = {isa = PBXBuildFile; fileRef = B3E7B5891CC2AC0600A0062D /* RNPostHog/RNPostHog.m */; };
|
|
12
|
-
/* End PBXBuildFile section */
|
|
13
|
-
|
|
14
|
-
/* Begin PBXContainerItemProxy section */
|
|
15
|
-
4B5DE17321B9DF3900BF8844 /* PBXContainerItemProxy */ = {
|
|
16
|
-
isa = PBXContainerItemProxy;
|
|
17
|
-
containerPortal = 4B5DE16E21B9DF3900BF8844 /* PostHog.xcodeproj */;
|
|
18
|
-
proxyType = 2;
|
|
19
|
-
remoteGlobalIDString = EADEB85B1DECD080005322DA;
|
|
20
|
-
remoteInfo = PostHog;
|
|
21
|
-
};
|
|
22
|
-
4B5DE17521B9DF3900BF8844 /* PBXContainerItemProxy */ = {
|
|
23
|
-
isa = PBXContainerItemProxy;
|
|
24
|
-
containerPortal = 4B5DE16E21B9DF3900BF8844 /* PostHog.xcodeproj */;
|
|
25
|
-
proxyType = 2;
|
|
26
|
-
remoteGlobalIDString = EADEB86A1DECD0EF005322DA;
|
|
27
|
-
remoteInfo = PostHogTests;
|
|
28
|
-
};
|
|
29
|
-
4B5DE17721B9DF4700BF8844 /* PBXContainerItemProxy */ = {
|
|
30
|
-
isa = PBXContainerItemProxy;
|
|
31
|
-
containerPortal = 4B5DE16E21B9DF3900BF8844 /* PostHog.xcodeproj */;
|
|
32
|
-
proxyType = 1;
|
|
33
|
-
remoteGlobalIDString = EADEB85A1DECD080005322DA;
|
|
34
|
-
remoteInfo = PostHog;
|
|
35
|
-
};
|
|
36
|
-
/* End PBXContainerItemProxy section */
|
|
37
|
-
|
|
38
|
-
/* Begin PBXCopyFilesBuildPhase section */
|
|
39
|
-
58B511D91A9E6C8500147676 /* CopyFiles */ = {
|
|
40
|
-
isa = PBXCopyFilesBuildPhase;
|
|
41
|
-
buildActionMask = 2147483647;
|
|
42
|
-
dstPath = "include/$(PRODUCT_NAME)";
|
|
43
|
-
dstSubfolderSpec = 16;
|
|
44
|
-
files = (
|
|
45
|
-
);
|
|
46
|
-
runOnlyForDeploymentPostprocessing = 0;
|
|
47
|
-
};
|
|
48
|
-
/* End PBXCopyFilesBuildPhase section */
|
|
49
|
-
|
|
50
|
-
/* Begin PBXFileReference section */
|
|
51
|
-
134814201AA4EA6300B7C361 /* libRNPostHog.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libRNPostHog.a; sourceTree = BUILT_PRODUCTS_DIR; };
|
|
52
|
-
4B5DE16E21B9DF3900BF8844 /* PostHog.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = PostHog.xcodeproj; path = "../../posthog-ios/PostHog.xcodeproj"; sourceTree = "<group>"; };
|
|
53
|
-
B3E7B5881CC2AC0600A0062D /* RNPostHog/RNPostHog.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RNPostHog/RNPostHog.h; sourceTree = "<group>"; };
|
|
54
|
-
B3E7B5891CC2AC0600A0062D /* RNPostHog/RNPostHog.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RNPostHog/RNPostHog.m; sourceTree = "<group>"; };
|
|
55
|
-
/* End PBXFileReference section */
|
|
56
|
-
|
|
57
|
-
/* Begin PBXFrameworksBuildPhase section */
|
|
58
|
-
58B511D81A9E6C8500147676 /* Frameworks */ = {
|
|
59
|
-
isa = PBXFrameworksBuildPhase;
|
|
60
|
-
buildActionMask = 2147483647;
|
|
61
|
-
files = (
|
|
62
|
-
4B5DE17A21B9DF4B00BF8844 /* PostHog.framework in Frameworks */,
|
|
63
|
-
);
|
|
64
|
-
runOnlyForDeploymentPostprocessing = 0;
|
|
65
|
-
};
|
|
66
|
-
/* End PBXFrameworksBuildPhase section */
|
|
67
|
-
|
|
68
|
-
/* Begin PBXGroup section */
|
|
69
|
-
134814211AA4EA7D00B7C361 /* Products */ = {
|
|
70
|
-
isa = PBXGroup;
|
|
71
|
-
children = (
|
|
72
|
-
134814201AA4EA6300B7C361 /* libRNPostHog.a */,
|
|
73
|
-
);
|
|
74
|
-
name = Products;
|
|
75
|
-
sourceTree = "<group>";
|
|
76
|
-
};
|
|
77
|
-
4B5DE16F21B9DF3900BF8844 /* Products */ = {
|
|
78
|
-
isa = PBXGroup;
|
|
79
|
-
children = (
|
|
80
|
-
4B5DE17421B9DF3900BF8844 /* PostHog.framework */,
|
|
81
|
-
4B5DE17621B9DF3900BF8844 /* PostHogTests.xctest */,
|
|
82
|
-
);
|
|
83
|
-
name = Products;
|
|
84
|
-
sourceTree = "<group>";
|
|
85
|
-
};
|
|
86
|
-
4B5DE17921B9DF4B00BF8844 /* Frameworks */ = {
|
|
87
|
-
isa = PBXGroup;
|
|
88
|
-
children = (
|
|
89
|
-
);
|
|
90
|
-
name = Frameworks;
|
|
91
|
-
sourceTree = "<group>";
|
|
92
|
-
};
|
|
93
|
-
58B511D21A9E6C8500147676 = {
|
|
94
|
-
isa = PBXGroup;
|
|
95
|
-
children = (
|
|
96
|
-
4B5DE16E21B9DF3900BF8844 /* PostHog.xcodeproj */,
|
|
97
|
-
B3E7B5881CC2AC0600A0062D /* RNPostHog/RNPostHog.h */,
|
|
98
|
-
B3E7B5891CC2AC0600A0062D /* RNPostHog/RNPostHog.m */,
|
|
99
|
-
134814211AA4EA7D00B7C361 /* Products */,
|
|
100
|
-
4B5DE17921B9DF4B00BF8844 /* Frameworks */,
|
|
101
|
-
);
|
|
102
|
-
sourceTree = "<group>";
|
|
103
|
-
};
|
|
104
|
-
/* End PBXGroup section */
|
|
105
|
-
|
|
106
|
-
/* Begin PBXNativeTarget section */
|
|
107
|
-
58B511DA1A9E6C8500147676 /* RNPostHog */ = {
|
|
108
|
-
isa = PBXNativeTarget;
|
|
109
|
-
buildConfigurationList = 58B511EF1A9E6C8500147676 /* Build configuration list for PBXNativeTarget "RNPostHog" */;
|
|
110
|
-
buildPhases = (
|
|
111
|
-
58B511D71A9E6C8500147676 /* Sources */,
|
|
112
|
-
58B511D81A9E6C8500147676 /* Frameworks */,
|
|
113
|
-
58B511D91A9E6C8500147676 /* CopyFiles */,
|
|
114
|
-
);
|
|
115
|
-
buildRules = (
|
|
116
|
-
);
|
|
117
|
-
dependencies = (
|
|
118
|
-
4B5DE17821B9DF4700BF8844 /* PBXTargetDependency */,
|
|
119
|
-
);
|
|
120
|
-
name = RNPostHog;
|
|
121
|
-
productName = RCTDataManager;
|
|
122
|
-
productReference = 134814201AA4EA6300B7C361 /* libRNPostHog.a */;
|
|
123
|
-
productType = "com.apple.product-type.library.static";
|
|
124
|
-
};
|
|
125
|
-
/* End PBXNativeTarget section */
|
|
126
|
-
|
|
127
|
-
/* Begin PBXProject section */
|
|
128
|
-
58B511D31A9E6C8500147676 /* Project object */ = {
|
|
129
|
-
isa = PBXProject;
|
|
130
|
-
attributes = {
|
|
131
|
-
LastUpgradeCheck = 0830;
|
|
132
|
-
ORGANIZATIONNAME = Facebook;
|
|
133
|
-
TargetAttributes = {
|
|
134
|
-
58B511DA1A9E6C8500147676 = {
|
|
135
|
-
CreatedOnToolsVersion = 6.1.1;
|
|
136
|
-
};
|
|
137
|
-
};
|
|
138
|
-
};
|
|
139
|
-
buildConfigurationList = 58B511D61A9E6C8500147676 /* Build configuration list for PBXProject "RNPostHog" */;
|
|
140
|
-
compatibilityVersion = "Xcode 3.2";
|
|
141
|
-
developmentRegion = English;
|
|
142
|
-
hasScannedForEncodings = 0;
|
|
143
|
-
knownRegions = (
|
|
144
|
-
en,
|
|
145
|
-
);
|
|
146
|
-
mainGroup = 58B511D21A9E6C8500147676;
|
|
147
|
-
productRefGroup = 58B511D21A9E6C8500147676;
|
|
148
|
-
projectDirPath = "";
|
|
149
|
-
projectReferences = (
|
|
150
|
-
{
|
|
151
|
-
ProductGroup = 4B5DE16F21B9DF3900BF8844 /* Products */;
|
|
152
|
-
ProjectRef = 4B5DE16E21B9DF3900BF8844 /* PostHog.xcodeproj */;
|
|
153
|
-
},
|
|
154
|
-
);
|
|
155
|
-
projectRoot = "";
|
|
156
|
-
targets = (
|
|
157
|
-
58B511DA1A9E6C8500147676 /* RNPostHog */,
|
|
158
|
-
);
|
|
159
|
-
};
|
|
160
|
-
/* End PBXProject section */
|
|
161
|
-
|
|
162
|
-
/* Begin PBXReferenceProxy section */
|
|
163
|
-
4B5DE17421B9DF3900BF8844 /* PostHog.framework */ = {
|
|
164
|
-
isa = PBXReferenceProxy;
|
|
165
|
-
fileType = wrapper.framework;
|
|
166
|
-
path = PostHog.framework;
|
|
167
|
-
remoteRef = 4B5DE17321B9DF3900BF8844 /* PBXContainerItemProxy */;
|
|
168
|
-
sourceTree = BUILT_PRODUCTS_DIR;
|
|
169
|
-
};
|
|
170
|
-
4B5DE17621B9DF3900BF8844 /* PostHogTests.xctest */ = {
|
|
171
|
-
isa = PBXReferenceProxy;
|
|
172
|
-
fileType = wrapper.cfbundle;
|
|
173
|
-
path = PostHogTests.xctest;
|
|
174
|
-
remoteRef = 4B5DE17521B9DF3900BF8844 /* PBXContainerItemProxy */;
|
|
175
|
-
sourceTree = BUILT_PRODUCTS_DIR;
|
|
176
|
-
};
|
|
177
|
-
/* End PBXReferenceProxy section */
|
|
178
|
-
|
|
179
|
-
/* Begin PBXSourcesBuildPhase section */
|
|
180
|
-
58B511D71A9E6C8500147676 /* Sources */ = {
|
|
181
|
-
isa = PBXSourcesBuildPhase;
|
|
182
|
-
buildActionMask = 2147483647;
|
|
183
|
-
files = (
|
|
184
|
-
B3E7B58A1CC2AC0600A0062D /* RNPostHog/RNPostHog.m in Sources */,
|
|
185
|
-
);
|
|
186
|
-
runOnlyForDeploymentPostprocessing = 0;
|
|
187
|
-
};
|
|
188
|
-
/* End PBXSourcesBuildPhase section */
|
|
189
|
-
|
|
190
|
-
/* Begin PBXTargetDependency section */
|
|
191
|
-
4B5DE17821B9DF4700BF8844 /* PBXTargetDependency */ = {
|
|
192
|
-
isa = PBXTargetDependency;
|
|
193
|
-
name = PostHog;
|
|
194
|
-
targetProxy = 4B5DE17721B9DF4700BF8844 /* PBXContainerItemProxy */;
|
|
195
|
-
};
|
|
196
|
-
/* End PBXTargetDependency section */
|
|
197
|
-
|
|
198
|
-
/* Begin XCBuildConfiguration section */
|
|
199
|
-
58B511ED1A9E6C8500147676 /* Debug */ = {
|
|
200
|
-
isa = XCBuildConfiguration;
|
|
201
|
-
buildSettings = {
|
|
202
|
-
ALWAYS_SEARCH_USER_PATHS = NO;
|
|
203
|
-
CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
|
|
204
|
-
CLANG_CXX_LIBRARY = "libc++";
|
|
205
|
-
CLANG_ENABLE_MODULES = YES;
|
|
206
|
-
CLANG_ENABLE_OBJC_ARC = YES;
|
|
207
|
-
CLANG_WARN_BOOL_CONVERSION = YES;
|
|
208
|
-
CLANG_WARN_CONSTANT_CONVERSION = YES;
|
|
209
|
-
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
|
|
210
|
-
CLANG_WARN_EMPTY_BODY = YES;
|
|
211
|
-
CLANG_WARN_ENUM_CONVERSION = YES;
|
|
212
|
-
CLANG_WARN_INFINITE_RECURSION = YES;
|
|
213
|
-
CLANG_WARN_INT_CONVERSION = YES;
|
|
214
|
-
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
|
|
215
|
-
CLANG_WARN_SUSPICIOUS_MOVE = YES;
|
|
216
|
-
CLANG_WARN_UNREACHABLE_CODE = YES;
|
|
217
|
-
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
|
|
218
|
-
COPY_PHASE_STRIP = NO;
|
|
219
|
-
ENABLE_STRICT_OBJC_MSGSEND = YES;
|
|
220
|
-
ENABLE_TESTABILITY = YES;
|
|
221
|
-
GCC_C_LANGUAGE_STANDARD = gnu99;
|
|
222
|
-
GCC_DYNAMIC_NO_PIC = NO;
|
|
223
|
-
GCC_NO_COMMON_BLOCKS = YES;
|
|
224
|
-
GCC_OPTIMIZATION_LEVEL = 0;
|
|
225
|
-
GCC_PREPROCESSOR_DEFINITIONS = (
|
|
226
|
-
"DEBUG=1",
|
|
227
|
-
"$(inherited)",
|
|
228
|
-
);
|
|
229
|
-
GCC_SYMBOLS_PRIVATE_EXTERN = NO;
|
|
230
|
-
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
|
|
231
|
-
GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
|
|
232
|
-
GCC_WARN_UNDECLARED_SELECTOR = YES;
|
|
233
|
-
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
|
|
234
|
-
GCC_WARN_UNUSED_FUNCTION = YES;
|
|
235
|
-
GCC_WARN_UNUSED_VARIABLE = YES;
|
|
236
|
-
IPHONEOS_DEPLOYMENT_TARGET = 8.0;
|
|
237
|
-
MTL_ENABLE_DEBUG_INFO = YES;
|
|
238
|
-
ONLY_ACTIVE_ARCH = YES;
|
|
239
|
-
SDKROOT = iphoneos;
|
|
240
|
-
};
|
|
241
|
-
name = Debug;
|
|
242
|
-
};
|
|
243
|
-
58B511EE1A9E6C8500147676 /* Release */ = {
|
|
244
|
-
isa = XCBuildConfiguration;
|
|
245
|
-
buildSettings = {
|
|
246
|
-
ALWAYS_SEARCH_USER_PATHS = NO;
|
|
247
|
-
CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
|
|
248
|
-
CLANG_CXX_LIBRARY = "libc++";
|
|
249
|
-
CLANG_ENABLE_MODULES = YES;
|
|
250
|
-
CLANG_ENABLE_OBJC_ARC = YES;
|
|
251
|
-
CLANG_WARN_BOOL_CONVERSION = YES;
|
|
252
|
-
CLANG_WARN_CONSTANT_CONVERSION = YES;
|
|
253
|
-
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
|
|
254
|
-
CLANG_WARN_EMPTY_BODY = YES;
|
|
255
|
-
CLANG_WARN_ENUM_CONVERSION = YES;
|
|
256
|
-
CLANG_WARN_INFINITE_RECURSION = YES;
|
|
257
|
-
CLANG_WARN_INT_CONVERSION = YES;
|
|
258
|
-
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
|
|
259
|
-
CLANG_WARN_SUSPICIOUS_MOVE = YES;
|
|
260
|
-
CLANG_WARN_UNREACHABLE_CODE = YES;
|
|
261
|
-
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
|
|
262
|
-
COPY_PHASE_STRIP = YES;
|
|
263
|
-
ENABLE_NS_ASSERTIONS = NO;
|
|
264
|
-
ENABLE_STRICT_OBJC_MSGSEND = YES;
|
|
265
|
-
GCC_C_LANGUAGE_STANDARD = gnu99;
|
|
266
|
-
GCC_NO_COMMON_BLOCKS = YES;
|
|
267
|
-
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
|
|
268
|
-
GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
|
|
269
|
-
GCC_WARN_UNDECLARED_SELECTOR = YES;
|
|
270
|
-
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
|
|
271
|
-
GCC_WARN_UNUSED_FUNCTION = YES;
|
|
272
|
-
GCC_WARN_UNUSED_VARIABLE = YES;
|
|
273
|
-
IPHONEOS_DEPLOYMENT_TARGET = 8.0;
|
|
274
|
-
MTL_ENABLE_DEBUG_INFO = NO;
|
|
275
|
-
SDKROOT = iphoneos;
|
|
276
|
-
VALIDATE_PRODUCT = YES;
|
|
277
|
-
};
|
|
278
|
-
name = Release;
|
|
279
|
-
};
|
|
280
|
-
58B511F01A9E6C8500147676 /* Debug */ = {
|
|
281
|
-
isa = XCBuildConfiguration;
|
|
282
|
-
buildSettings = {
|
|
283
|
-
HEADER_SEARCH_PATHS = (
|
|
284
|
-
"$(inherited)",
|
|
285
|
-
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include,
|
|
286
|
-
"$(SRCROOT)/../../../React/**",
|
|
287
|
-
"$(SRCROOT)/../../react-native/React/**",
|
|
288
|
-
);
|
|
289
|
-
LIBRARY_SEARCH_PATHS = "$(inherited)";
|
|
290
|
-
OTHER_LDFLAGS = "-ObjC";
|
|
291
|
-
PRODUCT_NAME = RNPostHog;
|
|
292
|
-
SKIP_INSTALL = YES;
|
|
293
|
-
};
|
|
294
|
-
name = Debug;
|
|
295
|
-
};
|
|
296
|
-
58B511F11A9E6C8500147676 /* Release */ = {
|
|
297
|
-
isa = XCBuildConfiguration;
|
|
298
|
-
buildSettings = {
|
|
299
|
-
HEADER_SEARCH_PATHS = (
|
|
300
|
-
"$(inherited)",
|
|
301
|
-
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include,
|
|
302
|
-
"$(SRCROOT)/../../../React/**",
|
|
303
|
-
"$(SRCROOT)/../../react-native/React/**",
|
|
304
|
-
);
|
|
305
|
-
LIBRARY_SEARCH_PATHS = "$(inherited)";
|
|
306
|
-
OTHER_LDFLAGS = "-ObjC";
|
|
307
|
-
PRODUCT_NAME = RNPostHog;
|
|
308
|
-
SKIP_INSTALL = YES;
|
|
309
|
-
};
|
|
310
|
-
name = Release;
|
|
311
|
-
};
|
|
312
|
-
/* End XCBuildConfiguration section */
|
|
313
|
-
|
|
314
|
-
/* Begin XCConfigurationList section */
|
|
315
|
-
58B511D61A9E6C8500147676 /* Build configuration list for PBXProject "RNPostHog" */ = {
|
|
316
|
-
isa = XCConfigurationList;
|
|
317
|
-
buildConfigurations = (
|
|
318
|
-
58B511ED1A9E6C8500147676 /* Debug */,
|
|
319
|
-
58B511EE1A9E6C8500147676 /* Release */,
|
|
320
|
-
);
|
|
321
|
-
defaultConfigurationIsVisible = 0;
|
|
322
|
-
defaultConfigurationName = Release;
|
|
323
|
-
};
|
|
324
|
-
58B511EF1A9E6C8500147676 /* Build configuration list for PBXNativeTarget "RNPostHog" */ = {
|
|
325
|
-
isa = XCConfigurationList;
|
|
326
|
-
buildConfigurations = (
|
|
327
|
-
58B511F01A9E6C8500147676 /* Debug */,
|
|
328
|
-
58B511F11A9E6C8500147676 /* Release */,
|
|
329
|
-
);
|
|
330
|
-
defaultConfigurationIsVisible = 0;
|
|
331
|
-
defaultConfigurationName = Release;
|
|
332
|
-
};
|
|
333
|
-
/* End XCConfigurationList section */
|
|
334
|
-
};
|
|
335
|
-
rootObject = 58B511D31A9E6C8500147676 /* Project object */;
|
|
336
|
-
}
|
package/src/__mocks__/bridge.ts
DELETED
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
const forceRequire = (): typeof import('../bridge') => {
|
|
2
|
-
jest.resetModules()
|
|
3
|
-
|
|
4
|
-
return require.requireActual('../bridge')
|
|
5
|
-
}
|
|
6
|
-
|
|
7
|
-
it('should throw an error if the core native module is not linked', () => {
|
|
8
|
-
jest.setMock('react-native', {
|
|
9
|
-
NativeModules: {}
|
|
10
|
-
})
|
|
11
|
-
|
|
12
|
-
expect(forceRequire).toThrow(/Failed to load PostHog native module./)
|
|
13
|
-
})
|
|
14
|
-
|
|
15
|
-
it('should export the core native module', () => {
|
|
16
|
-
const RNPostHog = {}
|
|
17
|
-
|
|
18
|
-
jest.setMock('react-native', {
|
|
19
|
-
NativeModules: { RNPostHog }
|
|
20
|
-
})
|
|
21
|
-
|
|
22
|
-
expect(forceRequire().default).toBe(RNPostHog)
|
|
23
|
-
})
|
|
@@ -1,79 +0,0 @@
|
|
|
1
|
-
import { configure } from '../configuration'
|
|
2
|
-
|
|
3
|
-
const apiKey = 'test-api-key'
|
|
4
|
-
|
|
5
|
-
function withIntegrity<T extends {}>(config: T): T & { json: string } {
|
|
6
|
-
const json = JSON.stringify(config)
|
|
7
|
-
|
|
8
|
-
return {
|
|
9
|
-
...(config as any),
|
|
10
|
-
json
|
|
11
|
-
}
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
it('uses the default configuration', async () => {
|
|
15
|
-
expect(await configure(apiKey, {})).toEqual(
|
|
16
|
-
withIntegrity({
|
|
17
|
-
apiKey,
|
|
18
|
-
captureApplicationLifecycleEvents: false,
|
|
19
|
-
captureDeepLinks: false,
|
|
20
|
-
debug: false,
|
|
21
|
-
flushAt: 20,
|
|
22
|
-
flushInterval: 30,
|
|
23
|
-
host: 'https://app.posthog.com',
|
|
24
|
-
recordScreenViews: false,
|
|
25
|
-
|
|
26
|
-
android: {
|
|
27
|
-
collectDeviceId: true
|
|
28
|
-
},
|
|
29
|
-
ios: {
|
|
30
|
-
captureInAppPurchases: false,
|
|
31
|
-
capturePushNotifications: false,
|
|
32
|
-
maxQueueSize: 1000,
|
|
33
|
-
shouldUseBluetooth: false,
|
|
34
|
-
shouldUseLocationServices: false
|
|
35
|
-
}
|
|
36
|
-
})
|
|
37
|
-
)
|
|
38
|
-
})
|
|
39
|
-
|
|
40
|
-
it('produces a valid configuration', async () => {
|
|
41
|
-
const config = await configure(apiKey, {
|
|
42
|
-
captureApplicationLifecycleEvents: true,
|
|
43
|
-
debug: true,
|
|
44
|
-
flushAt: 42,
|
|
45
|
-
flushInterval: 72,
|
|
46
|
-
recordScreenViews: true,
|
|
47
|
-
|
|
48
|
-
android: {
|
|
49
|
-
collectDeviceId: false
|
|
50
|
-
},
|
|
51
|
-
ios: {
|
|
52
|
-
capturePushNotifications: true
|
|
53
|
-
}
|
|
54
|
-
})
|
|
55
|
-
|
|
56
|
-
expect(config).toEqual(
|
|
57
|
-
withIntegrity({
|
|
58
|
-
apiKey,
|
|
59
|
-
captureApplicationLifecycleEvents: true,
|
|
60
|
-
captureDeepLinks: false,
|
|
61
|
-
debug: true,
|
|
62
|
-
flushAt: 42,
|
|
63
|
-
flushInterval: 72,
|
|
64
|
-
host: 'https://app.posthog.com',
|
|
65
|
-
recordScreenViews: true,
|
|
66
|
-
|
|
67
|
-
android: {
|
|
68
|
-
collectDeviceId: false
|
|
69
|
-
},
|
|
70
|
-
ios: {
|
|
71
|
-
captureInAppPurchases: false,
|
|
72
|
-
capturePushNotifications: true,
|
|
73
|
-
maxQueueSize: 1000,
|
|
74
|
-
shouldUseBluetooth: false,
|
|
75
|
-
shouldUseLocationServices: false
|
|
76
|
-
}
|
|
77
|
-
})
|
|
78
|
-
)
|
|
79
|
-
})
|
|
@@ -1,108 +0,0 @@
|
|
|
1
|
-
import mockConsole, { RestoreConsole } from 'jest-mock-console'
|
|
2
|
-
|
|
3
|
-
import { PostHog } from '../posthog'
|
|
4
|
-
import Bridge from '../bridge'
|
|
5
|
-
|
|
6
|
-
jest.mock('../bridge')
|
|
7
|
-
|
|
8
|
-
const nextTick = () => new Promise(resolve => setImmediate(resolve))
|
|
9
|
-
const getBridgeStub = <K extends keyof typeof Bridge>(name: K): jest.Mock<(typeof Bridge)[K]> => (Bridge as any)[name]
|
|
10
|
-
let posthog: PostHog.Client = null!
|
|
11
|
-
let restoreConsole: RestoreConsole = null!
|
|
12
|
-
|
|
13
|
-
beforeEach(async () => {
|
|
14
|
-
restoreConsole = mockConsole()
|
|
15
|
-
posthog = new PostHog.Client()
|
|
16
|
-
Object.keys(Bridge).forEach(key => getBridgeStub(key as any).mockClear())
|
|
17
|
-
|
|
18
|
-
await posthog.setup('api key')
|
|
19
|
-
})
|
|
20
|
-
|
|
21
|
-
afterEach(() => {
|
|
22
|
-
restoreConsole()
|
|
23
|
-
})
|
|
24
|
-
|
|
25
|
-
it('is ready', () => expect(posthog.ready).toBe(true))
|
|
26
|
-
|
|
27
|
-
it('catches bridge errors', async () => {
|
|
28
|
-
const error = new Error('test-error')
|
|
29
|
-
const onError = jest.fn()
|
|
30
|
-
|
|
31
|
-
getBridgeStub('capture').mockImplementationOnce(() => Promise.reject(error) as any)
|
|
32
|
-
posthog.catch(onError)
|
|
33
|
-
posthog.capture('test')
|
|
34
|
-
|
|
35
|
-
expect(onError).not.toHaveBeenCalled()
|
|
36
|
-
await new Promise(resolve => setImmediate(resolve))
|
|
37
|
-
expect(onError).toHaveBeenCalledWith(error)
|
|
38
|
-
})
|
|
39
|
-
|
|
40
|
-
it('waits for .setup()', async () => {
|
|
41
|
-
const client = new PostHog.Client()
|
|
42
|
-
|
|
43
|
-
client.capture('test 1')
|
|
44
|
-
client.capture('test 2')
|
|
45
|
-
|
|
46
|
-
expect(Bridge.capture).not.toHaveBeenCalled()
|
|
47
|
-
await client.setup('key')
|
|
48
|
-
|
|
49
|
-
expect(Bridge.capture).toHaveBeenNthCalledWith(1, 'test 1')
|
|
50
|
-
expect(Bridge.capture).toHaveBeenNthCalledWith(2, 'test 2')
|
|
51
|
-
})
|
|
52
|
-
|
|
53
|
-
it('does .capture()', () => testCall('capture')('Added to cart', { productId: 'azertyuiop' }))
|
|
54
|
-
|
|
55
|
-
it('does .screen()', () => testCall('screen')('Shopping cart', { from: 'Product page' }))
|
|
56
|
-
|
|
57
|
-
it('does .identify()', () => testCall('identify')('sloth', { eats: 'leaves' }))
|
|
58
|
-
|
|
59
|
-
it('does .identify() with null', () => testCall('identify')(null, { eats: 'leaves' }))
|
|
60
|
-
|
|
61
|
-
it('does .alias()', () => testCall('alias')('new alias'))
|
|
62
|
-
|
|
63
|
-
it('does .reset()', testCall('reset'))
|
|
64
|
-
it('does .flush()', testCall('flush'))
|
|
65
|
-
it('does .enable()', testCall('enable'))
|
|
66
|
-
it('does .disable()', testCall('disable'))
|
|
67
|
-
|
|
68
|
-
it('does .getAnonymousId()', testCall('getAnonymousId'))
|
|
69
|
-
|
|
70
|
-
it('logs uncaught bridge errors', async () => {
|
|
71
|
-
const error = {
|
|
72
|
-
message: 'test-error'
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
getBridgeStub('capture').mockImplementationOnce(() => Promise.reject(error) as any)
|
|
76
|
-
|
|
77
|
-
expect(posthog.capture('test')).rejects.toBe(error)
|
|
78
|
-
expect(console.error).not.toHaveBeenCalled()
|
|
79
|
-
await nextTick()
|
|
80
|
-
expect(console.error).toHaveBeenCalledWith('Uncaught PostHog error', error)
|
|
81
|
-
})
|
|
82
|
-
|
|
83
|
-
function testCall<K extends keyof typeof Bridge>(name: K) {
|
|
84
|
-
return (async (...args: any[]) => {
|
|
85
|
-
posthog.constructor.prototype[name].call(posthog, ...args)
|
|
86
|
-
await nextTick()
|
|
87
|
-
expect(Bridge[name]).toHaveBeenNthCalledWith(1, ...args)
|
|
88
|
-
}) as (typeof Bridge)[K]
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
it('enables setting integrations from the middleware', async () => {
|
|
92
|
-
const integrations = {
|
|
93
|
-
'Google PostHog': false,
|
|
94
|
-
Mixpanel: { foo: 'bar' }
|
|
95
|
-
}
|
|
96
|
-
|
|
97
|
-
posthog.middleware(async ({ next, context, data }) =>
|
|
98
|
-
// @ts-ignore ts is expecting newId for some reasons
|
|
99
|
-
next(context, { ...data, integrations })
|
|
100
|
-
)
|
|
101
|
-
|
|
102
|
-
const captureSpy = jest.fn()
|
|
103
|
-
getBridgeStub('capture').mockImplementationOnce(captureSpy)
|
|
104
|
-
posthog.capture('test')
|
|
105
|
-
await nextTick()
|
|
106
|
-
|
|
107
|
-
expect(captureSpy).toBeCalledWith('test')
|
|
108
|
-
})
|
package/src/bridge.ts
DELETED
|
@@ -1,61 +0,0 @@
|
|
|
1
|
-
import { NativeModules } from 'react-native'
|
|
2
|
-
|
|
3
|
-
export interface Context extends JsonMap {
|
|
4
|
-
$lib: string
|
|
5
|
-
$lib_version: string
|
|
6
|
-
}
|
|
7
|
-
|
|
8
|
-
export interface Configuration {
|
|
9
|
-
apiKey: string
|
|
10
|
-
host: string
|
|
11
|
-
recordScreenViews: boolean
|
|
12
|
-
captureApplicationLifecycleEvents: boolean
|
|
13
|
-
captureDeepLinks?: boolean
|
|
14
|
-
flushAt?: number
|
|
15
|
-
flushInterval?: number
|
|
16
|
-
debug: boolean
|
|
17
|
-
json: string
|
|
18
|
-
context: Context
|
|
19
|
-
android: {
|
|
20
|
-
collectDeviceId?: boolean
|
|
21
|
-
}
|
|
22
|
-
ios: {
|
|
23
|
-
capturePushNotifications?: boolean
|
|
24
|
-
captureInAppPurchases?: boolean
|
|
25
|
-
maxQueueSize?: number
|
|
26
|
-
shouldUseBluetooth?: boolean
|
|
27
|
-
shouldUseLocationServices?: boolean
|
|
28
|
-
}
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
export type JsonValue = boolean | number | string | null | JsonList | JsonMap
|
|
32
|
-
export interface JsonMap {
|
|
33
|
-
[key: string]: JsonValue
|
|
34
|
-
[index: number]: JsonValue
|
|
35
|
-
}
|
|
36
|
-
export interface JsonList extends Array<JsonValue> {}
|
|
37
|
-
|
|
38
|
-
export interface Options {
|
|
39
|
-
context?: Context
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
export interface Bridge {
|
|
43
|
-
setup(configuration: Configuration): Promise<void>
|
|
44
|
-
capture(event: string, properties: JsonMap): Promise<void>
|
|
45
|
-
identify(distinctId: string | null, properties: JsonMap): Promise<void>
|
|
46
|
-
screen(screen: string, properties: JsonMap): Promise<void>
|
|
47
|
-
alias(alias: string): Promise<void>
|
|
48
|
-
reset(): Promise<void>
|
|
49
|
-
flush(): Promise<void>
|
|
50
|
-
enable(): Promise<void>
|
|
51
|
-
disable(): Promise<void>
|
|
52
|
-
getAnonymousId(): Promise<string>
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
const bridge: Bridge = NativeModules.RNPostHog
|
|
56
|
-
|
|
57
|
-
if (!bridge) {
|
|
58
|
-
throw new Error('Failed to load PostHog native module.')
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
export default bridge
|
package/src/configuration.ts
DELETED
|
@@ -1,61 +0,0 @@
|
|
|
1
|
-
import { Configuration } from './bridge'
|
|
2
|
-
import { PostHog } from './posthog'
|
|
3
|
-
|
|
4
|
-
const defaults = {
|
|
5
|
-
android: ({ collectDeviceId = true }: Partial<Configuration['android']>) => ({
|
|
6
|
-
collectDeviceId
|
|
7
|
-
}),
|
|
8
|
-
ios: ({
|
|
9
|
-
capturePushNotifications = false,
|
|
10
|
-
captureInAppPurchases = false,
|
|
11
|
-
shouldUseBluetooth = false,
|
|
12
|
-
shouldUseLocationServices = false,
|
|
13
|
-
maxQueueSize = 1000
|
|
14
|
-
}: Partial<Configuration['ios']>) => ({
|
|
15
|
-
captureInAppPurchases,
|
|
16
|
-
capturePushNotifications,
|
|
17
|
-
maxQueueSize,
|
|
18
|
-
shouldUseBluetooth,
|
|
19
|
-
shouldUseLocationServices
|
|
20
|
-
})
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
export const configure = async (
|
|
24
|
-
apiKey: string,
|
|
25
|
-
{
|
|
26
|
-
flushAt = 20,
|
|
27
|
-
flushInterval = 30,
|
|
28
|
-
debug = false,
|
|
29
|
-
recordScreenViews = false,
|
|
30
|
-
captureApplicationLifecycleEvents = false,
|
|
31
|
-
captureDeepLinks = false,
|
|
32
|
-
host = 'https://app.posthog.com',
|
|
33
|
-
ios = {},
|
|
34
|
-
android = {}
|
|
35
|
-
}: PostHog.Configuration
|
|
36
|
-
): Promise<Configuration> => {
|
|
37
|
-
const config = {
|
|
38
|
-
apiKey,
|
|
39
|
-
captureApplicationLifecycleEvents,
|
|
40
|
-
captureDeepLinks,
|
|
41
|
-
debug,
|
|
42
|
-
flushAt,
|
|
43
|
-
flushInterval,
|
|
44
|
-
host,
|
|
45
|
-
recordScreenViews,
|
|
46
|
-
|
|
47
|
-
context: {
|
|
48
|
-
$lib: 'posthog-react-native',
|
|
49
|
-
$lib_version: require('../package.json').version
|
|
50
|
-
},
|
|
51
|
-
|
|
52
|
-
android: defaults.android(android),
|
|
53
|
-
ios: defaults.ios(ios)
|
|
54
|
-
}
|
|
55
|
-
const json = JSON.stringify(config)
|
|
56
|
-
|
|
57
|
-
return {
|
|
58
|
-
...config,
|
|
59
|
-
json
|
|
60
|
-
}
|
|
61
|
-
}
|