@ohos-ports/react-native-fbsdk-next 13.4.3-beta.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/LICENSE +21 -0
- package/README.md +943 -0
- package/android/build.gradle +57 -0
- package/android/src/main/AndroidManifest.xml +46 -0
- package/android/src/main/java/com/facebook/reactnative/androidsdk/FBAccessTokenModule.java +151 -0
- package/android/src/main/java/com/facebook/reactnative/androidsdk/FBActivityEventListener.java +40 -0
- package/android/src/main/java/com/facebook/reactnative/androidsdk/FBAppEventsLoggerModule.java +414 -0
- package/android/src/main/java/com/facebook/reactnative/androidsdk/FBAppLinkModule.java +86 -0
- package/android/src/main/java/com/facebook/reactnative/androidsdk/FBGameRequestDialogModule.java +94 -0
- package/android/src/main/java/com/facebook/reactnative/androidsdk/FBGraphRequestModule.java +283 -0
- package/android/src/main/java/com/facebook/reactnative/androidsdk/FBLoginButtonManager.java +83 -0
- package/android/src/main/java/com/facebook/reactnative/androidsdk/FBLoginManagerModule.java +171 -0
- package/android/src/main/java/com/facebook/reactnative/androidsdk/FBMessageDialogModule.java +111 -0
- package/android/src/main/java/com/facebook/reactnative/androidsdk/FBProfileModule.java +68 -0
- package/android/src/main/java/com/facebook/reactnative/androidsdk/FBSDKCallbackManagerBaseJavaModule.java +41 -0
- package/android/src/main/java/com/facebook/reactnative/androidsdk/FBSDKPackage.java +60 -0
- package/android/src/main/java/com/facebook/reactnative/androidsdk/FBSendButtonManager.java +51 -0
- package/android/src/main/java/com/facebook/reactnative/androidsdk/FBSettingsModule.java +95 -0
- package/android/src/main/java/com/facebook/reactnative/androidsdk/FBShareButtonManager.java +53 -0
- package/android/src/main/java/com/facebook/reactnative/androidsdk/FBShareDialogModule.java +107 -0
- package/android/src/main/java/com/facebook/reactnative/androidsdk/RCTLoginButton.java +126 -0
- package/android/src/main/java/com/facebook/reactnative/androidsdk/RCTLoginButtonEvent.java +27 -0
- package/android/src/main/java/com/facebook/reactnative/androidsdk/ReactNativeFacebookSDKCallback.java +58 -0
- package/android/src/main/java/com/facebook/reactnative/androidsdk/Utility.java +283 -0
- package/app.plugin.js +1 -0
- package/expo-module.config.json +10 -0
- package/ios/ExpoAdapterFBSDKNext/FacebookAppDelegate.swift +21 -0
- package/ios/ExpoAdapterFBSDKNext.podspec +33 -0
- package/ios/RCTFBSDK/core/RCTConvert+FBSDKAccessToken.h +27 -0
- package/ios/RCTFBSDK/core/RCTConvert+FBSDKAccessToken.m +41 -0
- package/ios/RCTFBSDK/core/RCTFBSDKAEMReporter.m +30 -0
- package/ios/RCTFBSDK/core/RCTFBSDKAccessToken.h +24 -0
- package/ios/RCTFBSDK/core/RCTFBSDKAccessToken.m +115 -0
- package/ios/RCTFBSDK/core/RCTFBSDKAppEvents.h +24 -0
- package/ios/RCTFBSDK/core/RCTFBSDKAppEvents.m +251 -0
- package/ios/RCTFBSDK/core/RCTFBSDKAppLink.h +24 -0
- package/ios/RCTFBSDK/core/RCTFBSDKAppLink.m +52 -0
- package/ios/RCTFBSDK/core/RCTFBSDKAuthenticationToken.h +6 -0
- package/ios/RCTFBSDK/core/RCTFBSDKAuthenticationToken.m +35 -0
- package/ios/RCTFBSDK/core/RCTFBSDKGraphRequestConnectionContainer.h +50 -0
- package/ios/RCTFBSDK/core/RCTFBSDKGraphRequestConnectionContainer.m +124 -0
- package/ios/RCTFBSDK/core/RCTFBSDKGraphRequestManager.h +25 -0
- package/ios/RCTFBSDK/core/RCTFBSDKGraphRequestManager.m +43 -0
- package/ios/RCTFBSDK/core/RCTFBSDKProfile.h +6 -0
- package/ios/RCTFBSDK/core/RCTFBSDKProfile.m +58 -0
- package/ios/RCTFBSDK/core/RCTFBSDKSettings.h +14 -0
- package/ios/RCTFBSDK/core/RCTFBSDKSettings.m +80 -0
- package/ios/RCTFBSDK/login/RCTConvert+FBSDKLogin.h +28 -0
- package/ios/RCTFBSDK/login/RCTConvert+FBSDKLogin.m +35 -0
- package/ios/RCTFBSDK/login/RCTFBSDKLoginButtonManager.h +25 -0
- package/ios/RCTFBSDK/login/RCTFBSDKLoginButtonManager.m +73 -0
- package/ios/RCTFBSDK/login/RCTFBSDKLoginButtonView.h +12 -0
- package/ios/RCTFBSDK/login/RCTFBSDKLoginButtonView.m +57 -0
- package/ios/RCTFBSDK/login/RCTFBSDKLoginManager.h +22 -0
- package/ios/RCTFBSDK/login/RCTFBSDKLoginManager.m +154 -0
- package/ios/RCTFBSDK/share/RCTConvert+FBSDKSharingContent.h +29 -0
- package/ios/RCTFBSDK/share/RCTConvert+FBSDKSharingContent.m +111 -0
- package/ios/RCTFBSDK/share/RCTFBSDKGameRequestDialog.h +24 -0
- package/ios/RCTFBSDK/share/RCTFBSDKGameRequestDialog.m +134 -0
- package/ios/RCTFBSDK/share/RCTFBSDKMessageDialog.h +24 -0
- package/ios/RCTFBSDK/share/RCTFBSDKMessageDialog.m +116 -0
- package/ios/RCTFBSDK/share/RCTFBSDKSendButtonManager.h +25 -0
- package/ios/RCTFBSDK/share/RCTFBSDKSendButtonManager.m +39 -0
- package/ios/RCTFBSDK/share/RCTFBSDKShareButtonManager.h +23 -0
- package/ios/RCTFBSDK/share/RCTFBSDKShareButtonManager.m +39 -0
- package/ios/RCTFBSDK/share/RCTFBSDKShareDialog.h +24 -0
- package/ios/RCTFBSDK/share/RCTFBSDKShareDialog.m +134 -0
- package/ios/RCTFBSDK/share/RCTFBSDKShareHelper.h +21 -0
- package/ios/RCTFBSDK/share/RCTFBSDKShareHelper.m +32 -0
- package/ios/RCTFBSDK.xcodeproj/project.pbxproj +446 -0
- package/ios/RCTFBSDK.xcodeproj/project.xcworkspace/contents.xcworkspacedata +7 -0
- package/ios/RCTFBSDK.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist +8 -0
- package/jest/mocks/index.js +81 -0
- package/jest/setup.js +3 -0
- package/lib/commonjs/FBAEMReporter.js +39 -0
- package/lib/commonjs/FBAEMReporter.js.map +1 -0
- package/lib/commonjs/FBAccessToken.js +198 -0
- package/lib/commonjs/FBAccessToken.js.map +1 -0
- package/lib/commonjs/FBAppEventsLogger.js +221 -0
- package/lib/commonjs/FBAppEventsLogger.js.map +1 -0
- package/lib/commonjs/FBAppLink.js +36 -0
- package/lib/commonjs/FBAppLink.js.map +1 -0
- package/lib/commonjs/FBAuthenticationToken.js +55 -0
- package/lib/commonjs/FBAuthenticationToken.js.map +1 -0
- package/lib/commonjs/FBGameRequestDialog.js +45 -0
- package/lib/commonjs/FBGameRequestDialog.js.map +1 -0
- package/lib/commonjs/FBGraphRequest.js +66 -0
- package/lib/commonjs/FBGraphRequest.js.map +1 -0
- package/lib/commonjs/FBGraphRequestManager.js +96 -0
- package/lib/commonjs/FBGraphRequestManager.js.map +1 -0
- package/lib/commonjs/FBLoginButton.js +67 -0
- package/lib/commonjs/FBLoginButton.js.map +1 -0
- package/lib/commonjs/FBLoginManager.js +102 -0
- package/lib/commonjs/FBLoginManager.js.map +1 -0
- package/lib/commonjs/FBMessageDialog.js +51 -0
- package/lib/commonjs/FBMessageDialog.js.map +1 -0
- package/lib/commonjs/FBProfile.js +134 -0
- package/lib/commonjs/FBProfile.js.map +1 -0
- package/lib/commonjs/FBSendButton.js +48 -0
- package/lib/commonjs/FBSendButton.js.map +1 -0
- package/lib/commonjs/FBSettings.js +115 -0
- package/lib/commonjs/FBSettings.js.map +1 -0
- package/lib/commonjs/FBShareButton.js +48 -0
- package/lib/commonjs/FBShareButton.js.map +1 -0
- package/lib/commonjs/FBShareDialog.js +57 -0
- package/lib/commonjs/FBShareDialog.js.map +1 -0
- package/lib/commonjs/index.js +323 -0
- package/lib/commonjs/index.js.map +1 -0
- package/lib/commonjs/models/FBAppGroupCreationContent.js +2 -0
- package/lib/commonjs/models/FBAppGroupCreationContent.js.map +1 -0
- package/lib/commonjs/models/FBGameRequestContent.js +2 -0
- package/lib/commonjs/models/FBGameRequestContent.js.map +1 -0
- package/lib/commonjs/models/FBSDKCallback.js +2 -0
- package/lib/commonjs/models/FBSDKCallback.js.map +1 -0
- package/lib/commonjs/models/FBShareContent.js +6 -0
- package/lib/commonjs/models/FBShareContent.js.map +1 -0
- package/lib/commonjs/models/FBShareLinkContent.js +6 -0
- package/lib/commonjs/models/FBShareLinkContent.js.map +1 -0
- package/lib/commonjs/models/FBSharePhoto.js +2 -0
- package/lib/commonjs/models/FBSharePhoto.js.map +1 -0
- package/lib/commonjs/models/FBSharePhotoContent.js +6 -0
- package/lib/commonjs/models/FBSharePhotoContent.js.map +1 -0
- package/lib/commonjs/models/FBShareVideo.js +2 -0
- package/lib/commonjs/models/FBShareVideo.js.map +1 -0
- package/lib/commonjs/models/FBShareVideoContent.js +6 -0
- package/lib/commonjs/models/FBShareVideoContent.js.map +1 -0
- package/lib/commonjs/util/validate.js +180 -0
- package/lib/commonjs/util/validate.js.map +1 -0
- package/lib/commonjs/utils/index.js +2 -0
- package/lib/commonjs/utils/index.js.map +1 -0
- package/lib/module/FBAEMReporter.js +34 -0
- package/lib/module/FBAEMReporter.js.map +1 -0
- package/lib/module/FBAccessToken.js +191 -0
- package/lib/module/FBAccessToken.js.map +1 -0
- package/lib/module/FBAppEventsLogger.js +215 -0
- package/lib/module/FBAppEventsLogger.js.map +1 -0
- package/lib/module/FBAppLink.js +29 -0
- package/lib/module/FBAppLink.js.map +1 -0
- package/lib/module/FBAuthenticationToken.js +48 -0
- package/lib/module/FBAuthenticationToken.js.map +1 -0
- package/lib/module/FBGameRequestDialog.js +39 -0
- package/lib/module/FBGameRequestDialog.js.map +1 -0
- package/lib/module/FBGraphRequest.js +60 -0
- package/lib/module/FBGraphRequest.js.map +1 -0
- package/lib/module/FBGraphRequestManager.js +90 -0
- package/lib/module/FBGraphRequestManager.js.map +1 -0
- package/lib/module/FBLoginButton.js +62 -0
- package/lib/module/FBLoginButton.js.map +1 -0
- package/lib/module/FBLoginManager.js +97 -0
- package/lib/module/FBLoginManager.js.map +1 -0
- package/lib/module/FBMessageDialog.js +45 -0
- package/lib/module/FBMessageDialog.js.map +1 -0
- package/lib/module/FBProfile.js +127 -0
- package/lib/module/FBProfile.js.map +1 -0
- package/lib/module/FBSendButton.js +41 -0
- package/lib/module/FBSendButton.js.map +1 -0
- package/lib/module/FBSettings.js +108 -0
- package/lib/module/FBSettings.js.map +1 -0
- package/lib/module/FBShareButton.js +41 -0
- package/lib/module/FBShareButton.js.map +1 -0
- package/lib/module/FBShareDialog.js +51 -0
- package/lib/module/FBShareDialog.js.map +1 -0
- package/lib/module/index.js +44 -0
- package/lib/module/index.js.map +1 -0
- package/lib/module/models/FBAppGroupCreationContent.js +2 -0
- package/lib/module/models/FBAppGroupCreationContent.js.map +1 -0
- package/lib/module/models/FBGameRequestContent.js +2 -0
- package/lib/module/models/FBGameRequestContent.js.map +1 -0
- package/lib/module/models/FBSDKCallback.js +2 -0
- package/lib/module/models/FBSDKCallback.js.map +1 -0
- package/lib/module/models/FBShareContent.js +2 -0
- package/lib/module/models/FBShareContent.js.map +1 -0
- package/lib/module/models/FBShareLinkContent.js +2 -0
- package/lib/module/models/FBShareLinkContent.js.map +1 -0
- package/lib/module/models/FBSharePhoto.js +2 -0
- package/lib/module/models/FBSharePhoto.js.map +1 -0
- package/lib/module/models/FBSharePhotoContent.js +2 -0
- package/lib/module/models/FBSharePhotoContent.js.map +1 -0
- package/lib/module/models/FBShareVideo.js +2 -0
- package/lib/module/models/FBShareVideo.js.map +1 -0
- package/lib/module/models/FBShareVideoContent.js +2 -0
- package/lib/module/models/FBShareVideoContent.js.map +1 -0
- package/lib/module/util/validate.js +157 -0
- package/lib/module/util/validate.js.map +1 -0
- package/lib/module/utils/index.js +2 -0
- package/lib/module/utils/index.js.map +1 -0
- package/lib/typescript/FBAEMReporter.d.ts +21 -0
- package/lib/typescript/FBAEMReporter.d.ts.map +1 -0
- package/lib/typescript/FBAccessToken.d.ts +118 -0
- package/lib/typescript/FBAccessToken.d.ts.map +1 -0
- package/lib/typescript/FBAppEventsLogger.d.ts +201 -0
- package/lib/typescript/FBAppEventsLogger.d.ts.map +1 -0
- package/lib/typescript/FBAppLink.d.ts +5 -0
- package/lib/typescript/FBAppLink.d.ts.map +1 -0
- package/lib/typescript/FBAuthenticationToken.d.ts +29 -0
- package/lib/typescript/FBAuthenticationToken.d.ts.map +1 -0
- package/lib/typescript/FBGameRequestDialog.d.ts +39 -0
- package/lib/typescript/FBGameRequestDialog.d.ts.map +1 -0
- package/lib/typescript/FBGraphRequest.d.ts +70 -0
- package/lib/typescript/FBGraphRequest.d.ts.map +1 -0
- package/lib/typescript/FBGraphRequestManager.d.ts +51 -0
- package/lib/typescript/FBGraphRequestManager.d.ts.map +1 -0
- package/lib/typescript/FBLoginButton.d.ts +92 -0
- package/lib/typescript/FBLoginButton.d.ts.map +1 -0
- package/lib/typescript/FBLoginManager.d.ts +77 -0
- package/lib/typescript/FBLoginManager.d.ts.map +1 -0
- package/lib/typescript/FBMessageDialog.d.ts +42 -0
- package/lib/typescript/FBMessageDialog.d.ts.map +1 -0
- package/lib/typescript/FBProfile.d.ts +127 -0
- package/lib/typescript/FBProfile.d.ts.map +1 -0
- package/lib/typescript/FBSendButton.d.ts +42 -0
- package/lib/typescript/FBSendButton.d.ts.map +1 -0
- package/lib/typescript/FBSettings.d.ts +49 -0
- package/lib/typescript/FBSettings.d.ts.map +1 -0
- package/lib/typescript/FBShareButton.d.ts +42 -0
- package/lib/typescript/FBShareButton.d.ts.map +1 -0
- package/lib/typescript/FBShareDialog.d.ts +69 -0
- package/lib/typescript/FBShareDialog.d.ts.map +1 -0
- package/lib/typescript/index.d.ts +43 -0
- package/lib/typescript/index.d.ts.map +1 -0
- package/lib/typescript/models/FBAppGroupCreationContent.d.ts +43 -0
- package/lib/typescript/models/FBAppGroupCreationContent.d.ts.map +1 -0
- package/lib/typescript/models/FBGameRequestContent.d.ts +63 -0
- package/lib/typescript/models/FBGameRequestContent.d.ts.map +1 -0
- package/lib/typescript/models/FBSDKCallback.d.ts +4 -0
- package/lib/typescript/models/FBSDKCallback.d.ts.map +1 -0
- package/lib/typescript/models/FBShareContent.d.ts +48 -0
- package/lib/typescript/models/FBShareContent.d.ts.map +1 -0
- package/lib/typescript/models/FBShareLinkContent.d.ts +65 -0
- package/lib/typescript/models/FBShareLinkContent.d.ts.map +1 -0
- package/lib/typescript/models/FBSharePhoto.d.ts +43 -0
- package/lib/typescript/models/FBSharePhoto.d.ts.map +1 -0
- package/lib/typescript/models/FBSharePhotoContent.d.ts +45 -0
- package/lib/typescript/models/FBSharePhotoContent.d.ts.map +1 -0
- package/lib/typescript/models/FBShareVideo.d.ts +31 -0
- package/lib/typescript/models/FBShareVideo.d.ts.map +1 -0
- package/lib/typescript/models/FBShareVideoContent.d.ts +58 -0
- package/lib/typescript/models/FBShareVideoContent.d.ts.map +1 -0
- package/lib/typescript/util/validate.d.ts +62 -0
- package/lib/typescript/util/validate.d.ts.map +1 -0
- package/lib/typescript/utils/index.d.ts +2 -0
- package/lib/typescript/utils/index.d.ts.map +1 -0
- package/package.json +155 -0
- package/plugin/build/config.d.ts +53 -0
- package/plugin/build/config.js +46 -0
- package/plugin/build/withFacebook.d.ts +4 -0
- package/plugin/build/withFacebook.js +59 -0
- package/plugin/build/withFacebookAndroid.d.ts +6 -0
- package/plugin/build/withFacebookAndroid.js +197 -0
- package/plugin/build/withFacebookIOS.d.ts +15 -0
- package/plugin/build/withFacebookIOS.js +163 -0
- package/plugin/build/withSKAdNetworkIdentifiers.d.ts +9 -0
- package/plugin/build/withSKAdNetworkIdentifiers.js +36 -0
- package/plugin/tsconfig.json +9 -0
- package/react-native-fbsdk-next.podspec +34 -0
- package/src/FBAEMReporter.ts +44 -0
- package/src/FBAccessToken.ts +222 -0
- package/src/FBAppEventsLogger.ts +375 -0
- package/src/FBAppLink.ts +30 -0
- package/src/FBAuthenticationToken.ts +61 -0
- package/src/FBGameRequestDialog.ts +49 -0
- package/src/FBGraphRequest.ts +89 -0
- package/src/FBGraphRequestManager.ts +117 -0
- package/src/FBLoginButton.tsx +152 -0
- package/src/FBLoginManager.ts +133 -0
- package/src/FBMessageDialog.ts +53 -0
- package/src/FBProfile.ts +166 -0
- package/src/FBSendButton.tsx +61 -0
- package/src/FBSettings.ts +122 -0
- package/src/FBShareButton.tsx +61 -0
- package/src/FBShareDialog.ts +96 -0
- package/src/index.ts +85 -0
- package/src/models/FBAppGroupCreationContent.ts +48 -0
- package/src/models/FBGameRequestContent.ts +81 -0
- package/src/models/FBSDKCallback.ts +3 -0
- package/src/models/FBShareContent.ts +54 -0
- package/src/models/FBShareLinkContent.ts +71 -0
- package/src/models/FBSharePhoto.ts +45 -0
- package/src/models/FBSharePhotoContent.ts +48 -0
- package/src/models/FBShareVideo.ts +31 -0
- package/src/models/FBShareVideoContent.ts +64 -0
- package/src/util/validate.ts +167 -0
- package/src/utils/index.ts +1 -0
- package/tsconfig.json +103 -0
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) 2014-present, Facebook, Inc. All rights reserved.
|
|
3
|
+
*
|
|
4
|
+
* You are hereby granted a non-exclusive, worldwide, royalty-free license to use,
|
|
5
|
+
* copy, modify, and distribute this software in source code or binary form for use
|
|
6
|
+
* in connection with the web services and APIs provided by Facebook.
|
|
7
|
+
*
|
|
8
|
+
* As with any software that integrates with the Facebook platform, your use of
|
|
9
|
+
* this software is subject to the Facebook Developer Principles and Policies
|
|
10
|
+
* [http://developers.facebook.com/policy/]. This copyright notice shall be
|
|
11
|
+
* included in all copies or substantial portions of the software.
|
|
12
|
+
*
|
|
13
|
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
14
|
+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
|
|
15
|
+
* FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
|
16
|
+
* COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
|
17
|
+
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
|
18
|
+
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
19
|
+
*
|
|
20
|
+
* @format
|
|
21
|
+
*/
|
|
22
|
+
|
|
23
|
+
export type ActionType =
|
|
24
|
+
// The user is sending an object to their friends.
|
|
25
|
+
| 'send'
|
|
26
|
+
// The user is asking for an object from friends.
|
|
27
|
+
| 'askfor'
|
|
28
|
+
// It is the turn of the friends to play against the user in a match.
|
|
29
|
+
| 'turn';
|
|
30
|
+
export type Filters =
|
|
31
|
+
// Friends using the app can be displayed.
|
|
32
|
+
| 'app_users'
|
|
33
|
+
// Friends not using the app can be displayed.
|
|
34
|
+
| 'app_non_users';
|
|
35
|
+
|
|
36
|
+
/**
|
|
37
|
+
* A model for a game request.
|
|
38
|
+
*/
|
|
39
|
+
export type GameRequestContent = {
|
|
40
|
+
/**
|
|
41
|
+
* A plain-text message to be sent as part of the request. Required.
|
|
42
|
+
*/
|
|
43
|
+
message: string;
|
|
44
|
+
|
|
45
|
+
/**
|
|
46
|
+
* Used when defining additional context about the nature of the request.
|
|
47
|
+
* The parameter 'objectID' is required if the action type is either 'send' or 'ask-for'.
|
|
48
|
+
*/
|
|
49
|
+
actionType?: ActionType;
|
|
50
|
+
|
|
51
|
+
/**
|
|
52
|
+
* Additional freeform data you may pass for tracking. The maximum length is 255 characters.
|
|
53
|
+
*/
|
|
54
|
+
data?: string;
|
|
55
|
+
|
|
56
|
+
/**
|
|
57
|
+
* Controls the set of friends someone sees if a multi-friend selector is shown.
|
|
58
|
+
*/
|
|
59
|
+
filters?: Filters;
|
|
60
|
+
|
|
61
|
+
/**
|
|
62
|
+
* The Open Graph object ID of the object being sent/asked for. This cannot be null for ActionType SEND and ASKFOR.
|
|
63
|
+
*/
|
|
64
|
+
objectId?: string;
|
|
65
|
+
|
|
66
|
+
/**
|
|
67
|
+
* An array of user IDs, usernames or invite tokens of people to send requests to.
|
|
68
|
+
*/
|
|
69
|
+
recipients?: Array<string>;
|
|
70
|
+
|
|
71
|
+
/**
|
|
72
|
+
* An array of user IDs that will be included in the dialog as the first suggested friends.
|
|
73
|
+
* Can't be used together with filters.
|
|
74
|
+
*/
|
|
75
|
+
suggestions?: Array<string>;
|
|
76
|
+
|
|
77
|
+
/**
|
|
78
|
+
* The title for the dialog.
|
|
79
|
+
*/
|
|
80
|
+
title?: string;
|
|
81
|
+
};
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) 2014-present, Facebook, Inc. All rights reserved.
|
|
3
|
+
*
|
|
4
|
+
* You are hereby granted a non-exclusive, worldwide, royalty-free license to use,
|
|
5
|
+
* copy, modify, and distribute this software in source code or binary form for use
|
|
6
|
+
* in connection with the web services and APIs provided by Facebook.
|
|
7
|
+
*
|
|
8
|
+
* As with any software that integrates with the Facebook platform, your use of
|
|
9
|
+
* this software is subject to the Facebook Developer Principles and Policies
|
|
10
|
+
* [http://developers.facebook.com/policy/]. This copyright notice shall be
|
|
11
|
+
* included in all copies or substantial portions of the software.
|
|
12
|
+
*
|
|
13
|
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
14
|
+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
|
|
15
|
+
* FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
|
16
|
+
* COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
|
17
|
+
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
|
18
|
+
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
19
|
+
*
|
|
20
|
+
* @format
|
|
21
|
+
*/
|
|
22
|
+
import {ShareLinkContent} from './FBShareLinkContent';
|
|
23
|
+
import {SharePhotoContent} from './FBSharePhotoContent';
|
|
24
|
+
import {ShareVideoContent} from './FBShareVideoContent';
|
|
25
|
+
|
|
26
|
+
export type ShareContent =
|
|
27
|
+
| ShareLinkContent
|
|
28
|
+
| SharePhotoContent
|
|
29
|
+
| ShareVideoContent;
|
|
30
|
+
/**
|
|
31
|
+
* A base interface for content to be shared.
|
|
32
|
+
*/
|
|
33
|
+
export type ShareContentCommonParameters = {
|
|
34
|
+
/**
|
|
35
|
+
* List of IDs for taggable people to tag with this content.
|
|
36
|
+
*/
|
|
37
|
+
peopleIds?: Array<string>;
|
|
38
|
+
|
|
39
|
+
/**
|
|
40
|
+
* The ID for a place to tag with this content.
|
|
41
|
+
*/
|
|
42
|
+
placeId?: string;
|
|
43
|
+
|
|
44
|
+
/**
|
|
45
|
+
* A value to be added to the referrer URL when a person follows a link from
|
|
46
|
+
* this shared content on feed.
|
|
47
|
+
*/
|
|
48
|
+
ref?: string;
|
|
49
|
+
|
|
50
|
+
/**
|
|
51
|
+
* A hashtag to be added to the share interface. The hashtag must be 32 characters or less.
|
|
52
|
+
*/
|
|
53
|
+
hashtag?: string;
|
|
54
|
+
};
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) 2014-present, Facebook, Inc. All rights reserved.
|
|
3
|
+
*
|
|
4
|
+
* You are hereby granted a non-exclusive, worldwide, royalty-free license to use,
|
|
5
|
+
* copy, modify, and distribute this software in source code or binary form for use
|
|
6
|
+
* in connection with the web services and APIs provided by Facebook.
|
|
7
|
+
*
|
|
8
|
+
* As with any software that integrates with the Facebook platform, your use of
|
|
9
|
+
* this software is subject to the Facebook Developer Principles and Policies
|
|
10
|
+
* [http://developers.facebook.com/policy/]. This copyright notice shall be
|
|
11
|
+
* included in all copies or substantial portions of the software.
|
|
12
|
+
*
|
|
13
|
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
14
|
+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
|
|
15
|
+
* FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
|
16
|
+
* COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
|
17
|
+
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
|
18
|
+
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
19
|
+
*
|
|
20
|
+
* @format
|
|
21
|
+
*/
|
|
22
|
+
import {ShareContentCommonParameters} from './FBShareContent';
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* A model for status and link content to be shared.
|
|
26
|
+
*/
|
|
27
|
+
export type ShareLinkContent = {
|
|
28
|
+
/**
|
|
29
|
+
* The type of content to be shared is link.
|
|
30
|
+
*/
|
|
31
|
+
contentType: 'link';
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
* Common parameters for share content;
|
|
35
|
+
*/
|
|
36
|
+
commonParameters?: ShareContentCommonParameters;
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* URL for the content being shared.
|
|
40
|
+
*/
|
|
41
|
+
contentUrl: string;
|
|
42
|
+
|
|
43
|
+
/**
|
|
44
|
+
* The Description of the link.
|
|
45
|
+
* If not specified, this field is automatically populated by information scraped
|
|
46
|
+
* from the contentURL, typically the title of the page.
|
|
47
|
+
* @deprecated `contentDescription` is deprecated from Graph API 2.9.
|
|
48
|
+
* For more information, see https://developers.facebook.com/docs/apps/changelog#v2_9_deprecations.
|
|
49
|
+
*/
|
|
50
|
+
contentDescription?: string;
|
|
51
|
+
|
|
52
|
+
/**
|
|
53
|
+
* The title to display for this link.
|
|
54
|
+
* @deprecated `contentTitle` is deprecated from Graph API 2.9.
|
|
55
|
+
* For more information, see https://developers.facebook.com/docs/apps/changelog#v2_9_deprecations.
|
|
56
|
+
*/
|
|
57
|
+
contentTitle?: string;
|
|
58
|
+
|
|
59
|
+
/**
|
|
60
|
+
* The URL of a picture to attach to this comment.
|
|
61
|
+
* @deprecated `imageUrl` is deprecated from Graph API 2.9.
|
|
62
|
+
* For more information, see https://developers.facebook.com/docs/apps/changelog#v2_9_deprecations.
|
|
63
|
+
*/
|
|
64
|
+
imageUrl?: string;
|
|
65
|
+
|
|
66
|
+
/**
|
|
67
|
+
* The predefine quote to attacth to this comment.
|
|
68
|
+
* If specified, the quote text will render with custom styling on top of the link.
|
|
69
|
+
*/
|
|
70
|
+
quote?: string;
|
|
71
|
+
};
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) 2014-present, Facebook, Inc. All rights reserved.
|
|
3
|
+
*
|
|
4
|
+
* You are hereby granted a non-exclusive, worldwide, royalty-free license to use,
|
|
5
|
+
* copy, modify, and distribute this software in source code or binary form for use
|
|
6
|
+
* in connection with the web services and APIs provided by Facebook.
|
|
7
|
+
*
|
|
8
|
+
* As with any software that integrates with the Facebook platform, your use of
|
|
9
|
+
* this software is subject to the Facebook Developer Principles and Policies
|
|
10
|
+
* [http://developers.facebook.com/policy/]. This copyright notice shall be
|
|
11
|
+
* included in all copies or substantial portions of the software.
|
|
12
|
+
*
|
|
13
|
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
14
|
+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
|
|
15
|
+
* FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
|
16
|
+
* COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
|
17
|
+
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
|
18
|
+
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
19
|
+
*
|
|
20
|
+
* @format
|
|
21
|
+
*/
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* A photo for sharing.
|
|
25
|
+
*/
|
|
26
|
+
export type SharePhoto = {
|
|
27
|
+
/**
|
|
28
|
+
* The URL to the photo.
|
|
29
|
+
* Note that when sharing SharePhotoContent with Share Button, the imageUrl
|
|
30
|
+
* of a SharePhoto cannot be the Uri of an image on the web.
|
|
31
|
+
*/
|
|
32
|
+
imageUrl: string;
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* Specifies whether the photo was generated by the user or the application.
|
|
36
|
+
*/
|
|
37
|
+
userGenerated?: boolean;
|
|
38
|
+
|
|
39
|
+
/**
|
|
40
|
+
* The user generated caption for the photo. Note that the 'caption' must
|
|
41
|
+
* come from the user, as pre-filled content is forbidden by the platform
|
|
42
|
+
* Policies (2.3).
|
|
43
|
+
*/
|
|
44
|
+
caption?: string;
|
|
45
|
+
};
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) 2014-present, Facebook, Inc. All rights reserved.
|
|
3
|
+
*
|
|
4
|
+
* You are hereby granted a non-exclusive, worldwide, royalty-free license to use,
|
|
5
|
+
* copy, modify, and distribute this software in source code or binary form for use
|
|
6
|
+
* in connection with the web services and APIs provided by Facebook.
|
|
7
|
+
*
|
|
8
|
+
* As with any software that integrates with the Facebook platform, your use of
|
|
9
|
+
* this software is subject to the Facebook Developer Principles and Policies
|
|
10
|
+
* [http://developers.facebook.com/policy/]. This copyright notice shall be
|
|
11
|
+
* included in all copies or substantial portions of the software.
|
|
12
|
+
*
|
|
13
|
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
14
|
+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
|
|
15
|
+
* FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
|
16
|
+
* COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
|
17
|
+
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
|
18
|
+
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
19
|
+
*
|
|
20
|
+
* @format
|
|
21
|
+
*/
|
|
22
|
+
import {ShareContentCommonParameters} from './FBShareContent';
|
|
23
|
+
import {SharePhoto} from './FBSharePhoto';
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* A model for photo content to be shared.
|
|
27
|
+
*/
|
|
28
|
+
export type SharePhotoContent = {
|
|
29
|
+
/**
|
|
30
|
+
* The type of content to be shared is photo.
|
|
31
|
+
*/
|
|
32
|
+
contentType: 'photo';
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* Common parameters for share content;
|
|
36
|
+
*/
|
|
37
|
+
commonParameters?: ShareContentCommonParameters;
|
|
38
|
+
|
|
39
|
+
/**
|
|
40
|
+
* URL for the content being shared.
|
|
41
|
+
*/
|
|
42
|
+
contentUrl?: string;
|
|
43
|
+
|
|
44
|
+
/**
|
|
45
|
+
* Photos to be shared.
|
|
46
|
+
*/
|
|
47
|
+
photos: Array<SharePhoto>;
|
|
48
|
+
};
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) 2014-present, Facebook, Inc. All rights reserved.
|
|
3
|
+
*
|
|
4
|
+
* You are hereby granted a non-exclusive, worldwide, royalty-free license to use,
|
|
5
|
+
* copy, modify, and distribute this software in source code or binary form for use
|
|
6
|
+
* in connection with the web services and APIs provided by Facebook.
|
|
7
|
+
*
|
|
8
|
+
* As with any software that integrates with the Facebook platform, your use of
|
|
9
|
+
* this software is subject to the Facebook Developer Principles and Policies
|
|
10
|
+
* [http://developers.facebook.com/policy/]. This copyright notice shall be
|
|
11
|
+
* included in all copies or substantial portions of the software.
|
|
12
|
+
*
|
|
13
|
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
14
|
+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
|
|
15
|
+
* FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
|
16
|
+
* COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
|
17
|
+
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
|
18
|
+
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
19
|
+
*
|
|
20
|
+
* @format
|
|
21
|
+
*/
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* A video for sharing.
|
|
25
|
+
*/
|
|
26
|
+
export type ShareVideo = {
|
|
27
|
+
/**
|
|
28
|
+
* The URL to the video. Must point to the location of the video on disk.
|
|
29
|
+
*/
|
|
30
|
+
localUrl: string;
|
|
31
|
+
};
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) 2014-present, Facebook, Inc. All rights reserved.
|
|
3
|
+
*
|
|
4
|
+
* You are hereby granted a non-exclusive, worldwide, royalty-free license to use,
|
|
5
|
+
* copy, modify, and distribute this software in source code or binary form for use
|
|
6
|
+
* in connection with the web services and APIs provided by Facebook.
|
|
7
|
+
*
|
|
8
|
+
* As with any software that integrates with the Facebook platform, your use of
|
|
9
|
+
* this software is subject to the Facebook Developer Principles and Policies
|
|
10
|
+
* [http://developers.facebook.com/policy/]. This copyright notice shall be
|
|
11
|
+
* included in all copies or substantial portions of the software.
|
|
12
|
+
*
|
|
13
|
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
14
|
+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
|
|
15
|
+
* FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
|
16
|
+
* COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
|
17
|
+
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
|
18
|
+
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
19
|
+
*
|
|
20
|
+
* @format
|
|
21
|
+
*/
|
|
22
|
+
import {ShareContentCommonParameters} from './FBShareContent';
|
|
23
|
+
import {SharePhoto} from './FBSharePhoto';
|
|
24
|
+
import {ShareVideo} from './FBShareVideo';
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* A model for video content to be shared.
|
|
28
|
+
*/
|
|
29
|
+
export type ShareVideoContent = {
|
|
30
|
+
/**
|
|
31
|
+
* The type of content to be shared is photo.
|
|
32
|
+
*/
|
|
33
|
+
contentType: 'video';
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* Common parameters for share content;
|
|
37
|
+
*/
|
|
38
|
+
commonParameters?: ShareContentCommonParameters;
|
|
39
|
+
|
|
40
|
+
/**
|
|
41
|
+
* URL for the content being shared.
|
|
42
|
+
*/
|
|
43
|
+
contentUrl?: string;
|
|
44
|
+
|
|
45
|
+
/**
|
|
46
|
+
* Video to be shared.
|
|
47
|
+
*/
|
|
48
|
+
video: ShareVideo;
|
|
49
|
+
|
|
50
|
+
/**
|
|
51
|
+
* Description of the video.
|
|
52
|
+
*/
|
|
53
|
+
contentDescription?: string;
|
|
54
|
+
|
|
55
|
+
/**
|
|
56
|
+
* Title of the video.
|
|
57
|
+
*/
|
|
58
|
+
contentTitle?: string;
|
|
59
|
+
|
|
60
|
+
/**
|
|
61
|
+
* The photo that represents the video.
|
|
62
|
+
*/
|
|
63
|
+
previewPhoto?: SharePhoto;
|
|
64
|
+
};
|
|
@@ -0,0 +1,167 @@
|
|
|
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
|
+
* Taken from react-native-firebase: https://github.com/invertase/react-native-firebase/blob/master/packages/app/lib/common/validate.js
|
|
17
|
+
*
|
|
18
|
+
* @format
|
|
19
|
+
*/
|
|
20
|
+
const AlphaNumericUnderscore = /^[a-zA-Z0-9_]+$/;
|
|
21
|
+
|
|
22
|
+
export function objectKeyValuesAreStrings(object: object) {
|
|
23
|
+
if (!isObject(object)) {
|
|
24
|
+
return false;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
const entries = Object.entries(object);
|
|
28
|
+
|
|
29
|
+
for (let i = 0; i < entries.length; i++) {
|
|
30
|
+
const [key, value] = entries[i];
|
|
31
|
+
if (!isString(key) || !isString(value)) {
|
|
32
|
+
return false;
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
return true;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
/**
|
|
40
|
+
* Simple is null check.
|
|
41
|
+
*/
|
|
42
|
+
export function isNull(value: unknown): value is null {
|
|
43
|
+
return value === null;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
/**
|
|
47
|
+
* Simple is object check.
|
|
48
|
+
*/
|
|
49
|
+
export function isObject(value: unknown): value is object {
|
|
50
|
+
return value
|
|
51
|
+
? typeof value === 'object' && !Array.isArray(value) && !isNull(value)
|
|
52
|
+
: false;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
/**
|
|
56
|
+
* Simple is date check
|
|
57
|
+
* https://stackoverflow.com/a/44198641
|
|
58
|
+
*/
|
|
59
|
+
export function isDate(value: unknown): value is Date {
|
|
60
|
+
// use the global isNaN() and not Number.isNaN() since it will validate an Invalid Date
|
|
61
|
+
return (
|
|
62
|
+
!!value &&
|
|
63
|
+
Object.prototype.toString.call(value) === '[object Date]' &&
|
|
64
|
+
!isNaN(Number(value))
|
|
65
|
+
);
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
/**
|
|
69
|
+
* Simple is function check
|
|
70
|
+
*/
|
|
71
|
+
// eslint-disable-next-line @typescript-eslint/ban-types
|
|
72
|
+
export function isFunction(value: unknown): value is Function {
|
|
73
|
+
return value ? typeof value === 'function' : false;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
/**
|
|
77
|
+
* Simple is string check
|
|
78
|
+
*/
|
|
79
|
+
export function isString(value: unknown): value is string {
|
|
80
|
+
return typeof value === 'string';
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
/**
|
|
84
|
+
* Simple is number check
|
|
85
|
+
*/
|
|
86
|
+
export function isNumber(value: unknown): value is number {
|
|
87
|
+
return typeof value === 'number';
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
/**
|
|
91
|
+
* Simple finite check
|
|
92
|
+
*/
|
|
93
|
+
export function isFinite(value: number): value is number {
|
|
94
|
+
return Number.isFinite(value);
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
/**
|
|
98
|
+
* Simple integer check
|
|
99
|
+
*/
|
|
100
|
+
export function isInteger(value: unknown): value is number {
|
|
101
|
+
return Number.isInteger(value);
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
/**
|
|
105
|
+
* Simple is boolean check
|
|
106
|
+
*/
|
|
107
|
+
export function isBoolean(value: unknown): value is boolean {
|
|
108
|
+
return typeof value === 'boolean';
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
/**
|
|
112
|
+
* Simple is array check
|
|
113
|
+
*/
|
|
114
|
+
export function isArray(value: unknown): value is unknown[] {
|
|
115
|
+
return Array.isArray(value);
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
/**
|
|
119
|
+
* Simple is undefined check
|
|
120
|
+
*/
|
|
121
|
+
export function isUndefined(value: unknown): value is undefined {
|
|
122
|
+
return typeof value === 'undefined';
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
/**
|
|
126
|
+
* Simple is not null nor undefined check
|
|
127
|
+
*/
|
|
128
|
+
export function isDefined<T>(value: T): value is Exclude<T, null | undefined> {
|
|
129
|
+
return !isNull(value) && !isUndefined(value);
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
/**
|
|
133
|
+
* /^[a-zA-Z0-9_]+$/
|
|
134
|
+
*/
|
|
135
|
+
export function isAlphaNumericUnderscore(value: string) {
|
|
136
|
+
return AlphaNumericUnderscore.test(value);
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
/**
|
|
140
|
+
* URL test
|
|
141
|
+
*/
|
|
142
|
+
const IS_VALID_URL_REGEX = /^(http|https):\/\/[^ "]+$/;
|
|
143
|
+
export function isValidUrl(url: string) {
|
|
144
|
+
return IS_VALID_URL_REGEX.test(url);
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
/**
|
|
148
|
+
* Matches Graph API versions of the form v2.7
|
|
149
|
+
*/
|
|
150
|
+
const IS_VALID_GRAPH_API_VERSION = /^(v([0-9]+).([0-9]+))/;
|
|
151
|
+
export function isValidGraphAPIVersion(version: string) {
|
|
152
|
+
return IS_VALID_GRAPH_API_VERSION.test(version);
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
/**
|
|
156
|
+
* Array includes
|
|
157
|
+
*/
|
|
158
|
+
export function isOneOf(value: unknown, oneOf: unknown[] = []) {
|
|
159
|
+
if (!isArray(oneOf)) {
|
|
160
|
+
return false;
|
|
161
|
+
}
|
|
162
|
+
return oneOf.includes(value);
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
export function noop() {
|
|
166
|
+
// noop-🐈
|
|
167
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export type PropsOf<T> = T extends React.Component<infer P> ? P : never;
|