@teamvortexsoftware/vortex-react-native 0.0.13 → 1.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.
Files changed (36) hide show
  1. package/LICENSE +201 -0
  2. package/README.md +1227 -11
  3. package/package.json +93 -20
  4. package/dist/components/Clipboard.js +0 -64
  5. package/dist/components/ShareButtons.js +0 -180
  6. package/dist/hooks/useThemeStyles.js +0 -39
  7. package/dist/hooks/useVortexInvite.js +0 -321
  8. package/dist/index.js +0 -5
  9. package/dist/shared/InvitationResult.js +0 -2
  10. package/dist/shared/api.js +0 -90
  11. package/dist/tests/TestVortexInvite.js +0 -134
  12. package/dist/types/components/Clipboard.d.ts +0 -16
  13. package/dist/types/components/Clipboard.d.ts.map +0 -1
  14. package/dist/types/components/ShareButtons.d.ts +0 -29
  15. package/dist/types/components/ShareButtons.d.ts.map +0 -1
  16. package/dist/types/hooks/useThemeStyles.d.ts +0 -34
  17. package/dist/types/hooks/useThemeStyles.d.ts.map +0 -1
  18. package/dist/types/hooks/useVortexInvite.d.ts +0 -44
  19. package/dist/types/hooks/useVortexInvite.d.ts.map +0 -1
  20. package/dist/types/index.d.ts +0 -2
  21. package/dist/types/index.d.ts.map +0 -1
  22. package/dist/types/shared/InvitationResult.d.ts +0 -24
  23. package/dist/types/shared/InvitationResult.d.ts.map +0 -1
  24. package/dist/types/shared/api.d.ts +0 -14
  25. package/dist/types/shared/api.d.ts.map +0 -1
  26. package/dist/types/tests/TestVortexInvite.d.ts +0 -4
  27. package/dist/types/tests/TestVortexInvite.d.ts.map +0 -1
  28. package/dist/types/utils/formUtils.d.ts +0 -85
  29. package/dist/types/utils/formUtils.d.ts.map +0 -1
  30. package/dist/types/utils/themeUtils.d.ts +0 -36
  31. package/dist/types/utils/themeUtils.d.ts.map +0 -1
  32. package/dist/types/vortexInvite.d.ts +0 -25
  33. package/dist/types/vortexInvite.d.ts.map +0 -1
  34. package/dist/utils/formUtils.js +0 -174
  35. package/dist/utils/themeUtils.js +0 -56
  36. package/dist/vortexInvite.js +0 -172
package/package.json CHANGED
@@ -1,59 +1,132 @@
1
1
  {
2
2
  "name": "@teamvortexsoftware/vortex-react-native",
3
- "description": "",
3
+ "description": "Vortex React Native SDK",
4
4
  "author": "@teamvortexsoftware",
5
- "version": "0.0.13",
5
+ "license": "Apache-2.0",
6
+ "version": "1.0.0",
6
7
  "files": [
7
8
  "dist"
8
9
  ],
9
10
  "main": "./dist/index.js",
10
11
  "exports": {
11
12
  ".": {
13
+ "source": "./src/index.tsx",
14
+ "react-native": {
15
+ "development": "./src/index.tsx",
16
+ "default": "./dist/index.js"
17
+ },
12
18
  "import": "./dist/index.js",
13
19
  "require": "./dist/index.js",
14
20
  "types": "./dist/types/index.d.ts"
15
21
  },
16
- "./runtime": "./dist/index.js"
22
+ "./web": {
23
+ "source": "./src/index-web.tsx",
24
+ "import": "./dist/index-web.js",
25
+ "require": "./dist/index-web.js",
26
+ "types": "./dist/types/index-web.d.ts"
27
+ },
28
+ "./runtime": "./dist/index.js",
29
+ "./hooks/useInvitationFormLogic": {
30
+ "source": "./src/hooks/useInvitationFormLogic.ts",
31
+ "import": "./dist/hooks/useInvitationFormLogic.js",
32
+ "require": "./dist/hooks/useInvitationFormLogic.js",
33
+ "types": "./dist/types/hooks/useInvitationFormLogic.d.ts"
34
+ },
35
+ "./constants/mockData": {
36
+ "source": "./src/constants/mockData.ts",
37
+ "import": "./dist/constants/mockData.js",
38
+ "require": "./dist/constants/mockData.js",
39
+ "types": "./dist/types/constants/mockData.d.ts"
40
+ },
41
+ "./utils/contactUtils": {
42
+ "source": "./src/utils/contactUtils.ts",
43
+ "import": "./dist/utils/contactUtils.js",
44
+ "require": "./dist/utils/contactUtils.js",
45
+ "types": "./dist/types/utils/contactUtils.d.ts"
46
+ }
17
47
  },
18
48
  "types": "dist/types/index.d.ts",
19
49
  "react-native": "dist/index.js",
20
50
  "devDependencies": {
21
- "@eslint/js": "^9.24.0",
22
- "@types/react": "^19.0.10",
51
+ "@eslint/js": "9.39.2",
52
+ "@testing-library/jest-dom": "6.9.1",
53
+ "@testing-library/react": "16.3.1",
54
+ "@types/react": "19.2.7",
23
55
  "@types/react-native-vector-icons": "^6.4.18",
24
- "eslint": "^9.24.0",
56
+ "@vitest/coverage-v8": "4.0.18",
57
+ "eslint": "9.39.2",
25
58
  "eslint-plugin-react-native": "^4.1.0",
26
- "typescript": "5.8.3",
27
- "typescript-eslint": "^8.30.1",
28
- "@teamvortexsoftware/eslint-config": "0.0.0",
29
- "@teamvortexsoftware/typescript-config": "0.0.0"
59
+ "expo-haptics": "^15.0.7",
60
+ "jsdom": "^26.0.2",
61
+ "react": "19.2.3",
62
+ "react-dom": "19.2.3",
63
+ "react-native-web": "^0.19.13",
64
+ "rimraf": "6.1.2",
65
+ "typescript-eslint": "8.50.1",
66
+ "vite": "7.3.1",
67
+ "vitest": "4.0.18"
30
68
  },
31
69
  "dependencies": {
32
- "react-native-qrcode-svg": "^6.3.15",
33
- "react-native-svg": "^15.12.0",
34
70
  "react-native-uuid": "^2.0.3",
35
- "react-native-vector-icons": "^10.2.0",
36
- "@teamvortexsoftware/vortex-core": "0.0.1",
37
- "@teamvortexsoftware/vortex-shared-ui": "0.0.1"
71
+ "react-native-vector-icons": "^10.2.0"
38
72
  },
39
73
  "peerDependencies": {
40
- "react": ">=19.0.0",
41
- "react-native": ">=0.79.0",
42
74
  "@react-native-clipboard/clipboard": ">=1.16.2",
43
- "expo-clipboard": ">=7.1.4"
75
+ "@react-native-google-signin/google-signin": ">=16.0.0",
76
+ "expo-clipboard": ">=7.1.4",
77
+ "expo-haptics": ">=13.0.0",
78
+ "expo-linear-gradient": ">=12.0.0",
79
+ "expo-sharing": ">=13.0.0",
80
+ "react": "19.2.3",
81
+ "react-native": ">=0.79.0",
82
+ "react-native-linear-gradient": ">=2.6.0",
83
+ "react-native-qrcode-svg": ">=6.3.0",
84
+ "react-native-svg": ">=15.0.0",
85
+ "react-qr-code": ">=2.0.0"
44
86
  },
45
87
  "peerDependenciesMeta": {
46
88
  "@react-native-clipboard/clipboard": {
47
89
  "optional": true
48
90
  },
91
+ "@react-native-google-signin/google-signin": {
92
+ "optional": true
93
+ },
49
94
  "expo-clipboard": {
50
95
  "optional": true
96
+ },
97
+ "expo-haptics": {
98
+ "optional": true
99
+ },
100
+ "expo-linear-gradient": {
101
+ "optional": true
102
+ },
103
+ "expo-sharing": {
104
+ "optional": true
105
+ },
106
+ "react-native-linear-gradient": {
107
+ "optional": true
108
+ },
109
+ "react-native-qrcode-svg": {
110
+ "optional": true
111
+ },
112
+ "react-native-svg": {
113
+ "optional": true
114
+ },
115
+ "react-qr-code": {
116
+ "optional": true
51
117
  }
52
118
  },
53
119
  "scripts": {
54
- "build": "tsc",
120
+ "clean": "rimraf dist",
121
+ "build": "pnpm run clean && tsc",
122
+ "dev": "pnpm run clean && tsc -w --preserveWatchOutput",
55
123
  "prepublish": "pnpm run build",
124
+ "build:prod": "pnpm run clean && tsc",
125
+ "prepublish:prod": "mkdir -p dist.d/prod && cp -r dist dist.d/prod/ && cp ./LICENSE ./README.md dist.d/prod/ && jq 'del(.dependencies.\"@teamvortexsoftware/analytics-client\") | del(.dependencies.\"@teamvortexsoftware/vortex-shared-ui\") | del(.devDependencies.\"@teamvortexsoftware/vortex-types\") | del(.devDependencies.\"@teamvortexsoftware/eslint-config\") | del(.devDependencies.\"@teamvortexsoftware/typescript-config\") | del(.scripts.prepack)' ./package.json > ./dist.d/prod/package.json",
126
+ "publish:prod": "pnpm run prepublish:prod && pnpm publish --access public ./dist.d/prod",
56
127
  "lint": "eslint src/",
57
- "type-check": "tsc --noEmit"
128
+ "type-check": "tsc --noEmit",
129
+ "test": "vitest",
130
+ "test:ci": "vitest run --coverage"
58
131
  }
59
132
  }
@@ -1,64 +0,0 @@
1
- "use strict";
2
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
- return new (P || (P = Promise))(function (resolve, reject) {
5
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
- step((generator = generator.apply(thisArg, _arguments || [])).next());
9
- });
10
- };
11
- var _a, _b;
12
- Object.defineProperty(exports, "__esModule", { value: true });
13
- exports.Clipboard = void 0;
14
- console.log('[Vortex] Clipboard.ts: Starting initialization');
15
- // Initialize with a placeholder that will be replaced
16
- let Clipboard;
17
- // Try to load expo-clipboard first
18
- try {
19
- console.log('[Vortex] Clipboard.ts: Trying to load expo-clipboard');
20
- const expoClipboard = require('expo-clipboard');
21
- if ((expoClipboard === null || expoClipboard === void 0 ? void 0 : expoClipboard.setStringAsync) && (expoClipboard === null || expoClipboard === void 0 ? void 0 : expoClipboard.getStringAsync)) {
22
- exports.Clipboard = Clipboard = {
23
- setString: expoClipboard.setStringAsync,
24
- getString: expoClipboard.getStringAsync,
25
- };
26
- console.log('[Vortex] Clipboard.ts: Using expo-clipboard implementation');
27
- }
28
- else {
29
- console.error('[Vortex] Clipboard.ts: expo-clipboard is missing required methods');
30
- throw new Error('expo-clipboard is missing required methods');
31
- }
32
- }
33
- catch (error) {
34
- console.error('[Vortex] Clipboard.ts: Failed to use expo-clipboard:', error);
35
- // Fall back to @react-native-clipboard/clipboard
36
- try {
37
- console.log('[Vortex] Clipboard.ts: Trying to load @react-native-clipboard/clipboard');
38
- const rnClipboard = require('@react-native-clipboard/clipboard');
39
- if (((_a = rnClipboard === null || rnClipboard === void 0 ? void 0 : rnClipboard.default) === null || _a === void 0 ? void 0 : _a.setString) && ((_b = rnClipboard.default) === null || _b === void 0 ? void 0 : _b.getString)) {
40
- console.log('[Vortex] Clipboard.ts: Successfully found @react-native-clipboard/clipboard methods');
41
- exports.Clipboard = Clipboard = {
42
- setString: (content) => __awaiter(void 0, void 0, void 0, function* () {
43
- rnClipboard.default.setString(content);
44
- }),
45
- getString: () => __awaiter(void 0, void 0, void 0, function* () {
46
- // @react-native-clipboard/clipboard returns string or undefined
47
- return Promise.resolve(rnClipboard.default.getString() || '');
48
- }),
49
- };
50
- console.log('[Vortex] Clipboard.ts: Using @react-native-clipboard/clipboard implementation');
51
- }
52
- else {
53
- console.error('[Vortex] Clipboard.ts: @react-native-clipboard/clipboard is missing required methods');
54
- throw new Error('@react-native-clipboard/clipboard is missing required methods');
55
- }
56
- }
57
- catch (e) {
58
- console.error('[Vortex] Clipboard.ts: Failed to use @react-native-clipboard/clipboard:', e);
59
- // If we get here, neither clipboard implementation is available
60
- console.error('[Vortex] Clipboard.ts: No clipboard implementation found');
61
- throw new Error('No clipboard implementation found. Please install expo-clipboard or @react-native-clipboard/clipboard');
62
- }
63
- }
64
- exports.default = Clipboard;
@@ -1,180 +0,0 @@
1
- "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
- Object.defineProperty(o, "default", { enumerable: true, value: v });
15
- }) : function(o, v) {
16
- o["default"] = v;
17
- });
18
- var __importStar = (this && this.__importStar) || (function () {
19
- var ownKeys = function(o) {
20
- ownKeys = Object.getOwnPropertyNames || function (o) {
21
- var ar = [];
22
- for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
- return ar;
24
- };
25
- return ownKeys(o);
26
- };
27
- return function (mod) {
28
- if (mod && mod.__esModule) return mod;
29
- var result = {};
30
- if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
- __setModuleDefault(result, mod);
32
- return result;
33
- };
34
- })();
35
- var __importDefault = (this && this.__importDefault) || function (mod) {
36
- return (mod && mod.__esModule) ? mod : { "default": mod };
37
- };
38
- Object.defineProperty(exports, "__esModule", { value: true });
39
- exports.ShareButton = ShareButton;
40
- exports.ShareButtons = ShareButtons;
41
- const react_1 = __importStar(require("react"));
42
- const react_native_1 = require("react-native");
43
- const FontAwesome6_1 = __importDefault(require("react-native-vector-icons/FontAwesome6"));
44
- const react_native_qrcode_svg_1 = __importDefault(require("react-native-qrcode-svg"));
45
- function ShareButton({ iconName, label, onPress, themeColors, themeStyles, }) {
46
- return (<react_native_1.View style={styles.shareButtonWrapper}>
47
- <react_native_1.Pressable style={[styles.shareButton, themeStyles.secondaryButton]} onPress={onPress}>
48
- <react_native_1.View style={styles.buttonContentContainer}>
49
- <FontAwesome6_1.default name={iconName} size={24} color={themeColors.secondaryButtonForeground}/>
50
- <react_native_1.Text style={[styles.shareButtonText, themeStyles.secondaryButtonText]}>{label}</react_native_1.Text>
51
- </react_native_1.View>
52
- </react_native_1.Pressable>
53
- </react_native_1.View>);
54
- }
55
- function ShareButtons({ has, themeColors, themeStyles, handleShareLink, handleCopyLink, handleSmsShare, handleEmailShare, shareableLink, }) {
56
- const [showQRCode, setShowQRCode] = (0, react_1.useState)(false);
57
- // Define button configurations
58
- const buttonConfigs = [
59
- {
60
- key: 'shareOptionsCopyLink',
61
- iconName: 'copy',
62
- label: 'Copy',
63
- onPress: handleCopyLink,
64
- isAvailable: true, // Always available when share is enabled
65
- isWithShowUrl: has.shareOptionsCopyLink, // Special handling only if specifically enabled
66
- },
67
- {
68
- key: 'shareOptionsSms',
69
- iconName: 'message',
70
- label: 'SMS',
71
- onPress: handleSmsShare,
72
- isAvailable: has.shareOptionsSms,
73
- },
74
- {
75
- key: 'shareOptionsEmail',
76
- iconName: 'envelope',
77
- label: 'Email',
78
- onPress: handleEmailShare,
79
- isAvailable: has.shareOptionsEmail,
80
- },
81
- {
82
- key: 'shareOptionsNativeShareSheet',
83
- iconName: 'share-nodes',
84
- label: 'Share Link',
85
- onPress: handleShareLink,
86
- isAvailable: has.shareOptionsNativeShareSheet,
87
- },
88
- {
89
- key: 'shareOptionsQRCode',
90
- iconName: 'qrcode',
91
- label: 'QR Code',
92
- onPress: () => setShowQRCode(!showQRCode),
93
- isAvailable: has.shareOptionsQrCode,
94
- },
95
- {
96
- key: 'shareOptionsWhatsApp',
97
- iconName: 'whatsapp',
98
- label: 'WhatsApp',
99
- onPress: () => { },
100
- isAvailable: has.shareOptionsWhatsApp,
101
- },
102
- // Add more share options as needed
103
- // Example:
104
- // {
105
- // key: 'shareOptionsFacebookMessenger',
106
- // iconName: 'facebook-messenger',
107
- // label: 'Messenger',
108
- // onPress: () => {},
109
- // isAvailable: has.shareOptionsFacebookMessenger,
110
- // },
111
- ];
112
- return (<>
113
- {showQRCode && shareableLink && (<react_native_1.View style={styles.qrCodeContainer}>
114
- <react_native_qrcode_svg_1.default value={shareableLink} size={200} color={themeColors.containerForeground} backgroundColor={themeColors.containerBackground}/>
115
- </react_native_1.View>)}
116
- {buttonConfigs
117
- .filter((config) => config.isAvailable)
118
- .map((config) => config.isWithShowUrl && config.key === 'shareOptionsCopyLink' && shareableLink ? (<react_native_1.View key={config.key} style={styles.copyLinkContainer}>
119
- <react_native_1.TextInput style={[
120
- styles.linkInput,
121
- {
122
- color: themeColors.containerForeground,
123
- borderColor: themeColors.containerBorder,
124
- },
125
- ]} value={shareableLink} editable={false}/>
126
- <react_native_1.Pressable style={[styles.copyButton, themeStyles.secondaryButton]} onPress={handleCopyLink}>
127
- <FontAwesome6_1.default name="copy" size={20} color={themeColors.secondaryButtonForeground}/>
128
- </react_native_1.Pressable>
129
- </react_native_1.View>) : (<ShareButton key={config.key} iconName={config.iconName} label={config.label} onPress={config.onPress} themeColors={themeColors} themeStyles={themeStyles}/>))}
130
- </>);
131
- }
132
- const styles = react_native_1.StyleSheet.create({
133
- shareButtonWrapper: {
134
- width: '48%',
135
- margin: 5,
136
- },
137
- shareButton: {
138
- flexDirection: 'row',
139
- alignItems: 'center',
140
- padding: 10,
141
- borderWidth: 1,
142
- borderRadius: 5,
143
- justifyContent: 'center',
144
- },
145
- buttonContentContainer: {
146
- flexDirection: 'row',
147
- alignItems: 'center',
148
- },
149
- shareButtonText: {
150
- marginLeft: 10,
151
- },
152
- qrCodeContainer: {
153
- width: '100%',
154
- alignItems: 'center',
155
- justifyContent: 'center',
156
- marginBottom: 20,
157
- padding: 10,
158
- },
159
- copyLinkContainer: {
160
- width: '100%',
161
- flexDirection: 'row',
162
- marginVertical: 5,
163
- alignItems: 'center',
164
- },
165
- linkInput: {
166
- flex: 1,
167
- borderWidth: 1,
168
- borderRadius: 5,
169
- padding: 10,
170
- marginRight: 5,
171
- },
172
- copyButton: {
173
- width: 44,
174
- height: 44,
175
- alignItems: 'center',
176
- justifyContent: 'center',
177
- borderWidth: 1,
178
- borderRadius: 5,
179
- },
180
- });
@@ -1,39 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.useThemeStyles = useThemeStyles;
4
- const react_1 = require("react");
5
- /**
6
- * Hook to generate dynamic styles based on theme colors
7
- * @param themeColors The theme colors object
8
- * @returns Object containing styled components based on the theme
9
- */
10
- function useThemeStyles(themeColors) {
11
- const themeStyles = (0, react_1.useMemo)(() => ({
12
- primaryButton: {
13
- backgroundColor: themeColors.primaryButtonBackground,
14
- borderColor: themeColors.primaryButtonBorder,
15
- },
16
- primaryButtonText: {
17
- color: themeColors.primaryButtonForeground,
18
- },
19
- secondaryButton: {
20
- backgroundColor: themeColors.secondaryButtonBackground,
21
- borderColor: themeColors.secondaryButtonBorder,
22
- },
23
- secondaryButtonText: {
24
- color: themeColors.secondaryButtonForeground,
25
- },
26
- containerStyles: {
27
- backgroundColor: themeColors.containerBackground,
28
- },
29
- textStyles: {
30
- color: themeColors.containerForeground,
31
- },
32
- inputStyles: {
33
- borderColor: themeColors.containerBorder,
34
- color: themeColors.containerForeground,
35
- backgroundColor: themeColors.containerBackground,
36
- },
37
- }), [themeColors]);
38
- return themeStyles;
39
- }