vwo-fme-react-sdk 0.1.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.
Files changed (48) hide show
  1. package/CHANGELOG.md +80 -0
  2. package/LICENSE +202 -0
  3. package/NOTICE +18 -0
  4. package/README.md +352 -0
  5. package/dist/VWOContext.d.ts +24 -0
  6. package/dist/VWOProvider.d.ts +35 -0
  7. package/dist/index.d.ts +23 -0
  8. package/dist/index.js +8 -0
  9. package/dist/logger/LogMessageBuilder.d.ts +63 -0
  10. package/dist/logger/Logger.d.ts +46 -0
  11. package/dist/logger/core/LogManager.d.ts +100 -0
  12. package/dist/logger/core/TransportManager.d.ts +80 -0
  13. package/dist/logger/enums/LogLevelEnum.d.ts +22 -0
  14. package/dist/logger/index.d.ts +17 -0
  15. package/dist/logger/transports/ConsoleTransport.d.ts +60 -0
  16. package/dist/services/loggerService.d.ts +35 -0
  17. package/dist/types/Common.d.ts +36 -0
  18. package/dist/useGetFlag.d.ts +21 -0
  19. package/dist/useGetFlagVariable.d.ts +29 -0
  20. package/dist/useSetAttribute.d.ts +20 -0
  21. package/dist/useTrackEvent.d.ts +21 -0
  22. package/dist/useVWOClient.d.ts +20 -0
  23. package/dist/utils/DataTypeUtil.d.ts +38 -0
  24. package/dist/vwo-fme-react-sdk.cjs.development.js +904 -0
  25. package/dist/vwo-fme-react-sdk.cjs.development.js.map +1 -0
  26. package/dist/vwo-fme-react-sdk.cjs.production.min.js +904 -0
  27. package/dist/vwo-fme-react-sdk.cjs.production.min.js.map +1 -0
  28. package/dist/vwo-fme-react-sdk.esm.js +886 -0
  29. package/dist/vwo-fme-react-sdk.esm.js.map +1 -0
  30. package/lib/VWOContext.ts +47 -0
  31. package/lib/VWOProvider.tsx +103 -0
  32. package/lib/index.ts +29 -0
  33. package/lib/logger/LogMessageBuilder.ts +99 -0
  34. package/lib/logger/Logger.ts +51 -0
  35. package/lib/logger/core/LogManager.ts +164 -0
  36. package/lib/logger/core/TransportManager.ts +142 -0
  37. package/lib/logger/enums/LogLevelEnum.ts +23 -0
  38. package/lib/logger/index.ts +18 -0
  39. package/lib/logger/transports/ConsoleTransport.ts +85 -0
  40. package/lib/services/LoggerService.ts +49 -0
  41. package/lib/types/Common.ts +42 -0
  42. package/lib/useGetFlag.ts +81 -0
  43. package/lib/useGetFlagVariable.ts +65 -0
  44. package/lib/useSetAttribute.ts +48 -0
  45. package/lib/useTrackEvent.ts +52 -0
  46. package/lib/useVWOClient.ts +41 -0
  47. package/lib/utils/DataTypeUtil.ts +48 -0
  48. package/package.json +84 -0
@@ -0,0 +1,48 @@
1
+ /**
2
+ * Copyright 2025 Wingify Software Pvt. Ltd.
3
+ *
4
+ * Licensed under the Apache License, Version 2.0 (the "License");
5
+ * you may not use this file 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
+ import { dynamic } from '../types/Common';
18
+
19
+ type FunctionType = (val: dynamic) => void;
20
+
21
+ /**
22
+ * Checks if a value is a function.
23
+ * @param val The value to check.
24
+ * @returns True if the value is a function, false otherwise.
25
+ */
26
+ export function isFunction(val: dynamic): val is FunctionType {
27
+ return Object.prototype.toString.call(val) === '[object Function]';
28
+ }
29
+
30
+ /**
31
+ * Checks if a value is an object (excluding arrays, functions, regex, promises, and dates).
32
+ * @param val The value to check.
33
+ * @returns True if the value is a valid object, false otherwise.
34
+ */
35
+ export function isObject<T>(
36
+ val: T,
37
+ ): val is Record<any, dynamic> & Exclude<T, Array<dynamic> | FunctionType | RegExp | Promise<dynamic> | Date> {
38
+ return Object.prototype.toString.call(val) === '[object Object]';
39
+ }
40
+
41
+ /**
42
+ * Checks if a value is a string.
43
+ * @param val The value to check.
44
+ * @returns True if the value is a string, false otherwise.
45
+ */
46
+ export function isString(val: dynamic): val is string {
47
+ return typeof val === 'string' || Object.prototype.toString.call(val) === '[object String]';
48
+ }
package/package.json ADDED
@@ -0,0 +1,84 @@
1
+ {
2
+ "name": "vwo-fme-react-sdk",
3
+ "version": "0.1.0",
4
+ "description": "VWO React SDK for Feature Management and Experimentation",
5
+ "source": "lib/index.ts",
6
+ "main": "dist/index.js",
7
+ "module": "dist/vwo-fme-react-sdk.esm.js",
8
+ "types": "dist/index.d.ts",
9
+ "scripts": {
10
+ "build:watch": "tsdx watch",
11
+ "build": "tsdx build",
12
+ "check:license": "yarn check:versions && node -e 'require(\"./scripts/check-license\")'",
13
+ "check:versions": "node -e 'require(\"./scripts/check-versions\")'",
14
+ "demo": "nodemon --inspect=0.0.0.0:9229 --legacy-watch --ignore node_modules demo/index.js",
15
+ "demo:server": "nodemon --inspect=0.0.0.0:9229 --legacy-watch --ignore node_modules demo/server.js",
16
+ "lint": "node -e 'require(\"./scripts/check-versions\")([\"nodeLint\"])' && eslint lib/ --fix",
17
+ "lint:errors-only": "node -e 'require(\"./scripts/check-versions\")([\"nodeLint\"])' && eslint **/*.ts' --fix --quiet",
18
+ "prepare": "husky",
19
+ "prettier": "prettier -w lib/**/*.ts *.md",
20
+ "test:dev": "node --inspect-brk node_modules/jest/bin/jest.js --watch --runInBand --debug --colors --errorOnDeprecated",
21
+ "test:prod": "jest --runInBand --colors --errorOnDeprecated",
22
+ "test:coverage": "jest --coverage --coverageDirectory=coverage && cat ./coverage/lcov.info",
23
+ "tsc": "yarn check:versions && rm -rf dist/server-unpacked && cp package.json dist/ && tsc -w",
24
+ "tsc:prod": "yarn check:versions && rm -rf dist/server-unpacked && tsc && cp package.json dist/"
25
+ },
26
+ "repository": {
27
+ "type": "git",
28
+ "url": "https://github.com/wingify/vwo-fme-react-sdk"
29
+ },
30
+ "author": "VWO developers",
31
+ "license": "Apache-2.0",
32
+ "files": [
33
+ "dist/",
34
+ "package.json",
35
+ "yarn.lock",
36
+ "lib/**/*",
37
+ "LICENSE",
38
+ "README.md",
39
+ "CONTRIBUTING.md",
40
+ "CHANGELOG.md",
41
+ "NOTICE"
42
+ ],
43
+ "dependencies": {
44
+ "vwo-fme-node-sdk": "^1.12.0"
45
+ },
46
+ "peerDependencies": {
47
+ "react": ">=16.8.0"
48
+ },
49
+ "devDependencies": {
50
+ "@babel/core": "^7.24.5",
51
+ "@babel/preset-env": "^7.24.5",
52
+ "@babel/preset-typescript": "^7.24.1",
53
+ "@commitlint/cli": "^19.3.0",
54
+ "@commitlint/config-conventional": "^19.2.2",
55
+ "@eslint/js": "^9.2.0",
56
+ "@types/jest": "^29.5.12",
57
+ "babel-jest": "^29.7.0",
58
+ "babel-loader": "^9.1.3",
59
+ "eslint": "^9.2.0",
60
+ "husky": "^9.0.11",
61
+ "jest": "^29.7.0",
62
+ "lint-staged": "^15.2.2",
63
+ "prettier": "^3.2.5",
64
+ "semver": "^7.6.0",
65
+ "shelljs": "^0.8.5",
66
+ "tsdx": "^0.14.1",
67
+ "tslib": "^2.8.1",
68
+ "typescript": "^5.4.5",
69
+ "typescript-eslint": "^7.8.0"
70
+ },
71
+ "lint-staged": {
72
+ "**/*.{ts,json,md}": [
73
+ "prettier --write"
74
+ ]
75
+ },
76
+ "engineStrict": true,
77
+ "engines": {
78
+ "node": ">= 8.9.0",
79
+ "yarn": ">= 1.22.17"
80
+ },
81
+ "customEngines": {
82
+ "nodeLint": ">= 18.18.0"
83
+ }
84
+ }