@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.
- package/LICENSE +201 -0
- package/README.md +1227 -11
- package/package.json +93 -20
- package/dist/components/Clipboard.js +0 -64
- package/dist/components/ShareButtons.js +0 -180
- package/dist/hooks/useThemeStyles.js +0 -39
- package/dist/hooks/useVortexInvite.js +0 -321
- package/dist/index.js +0 -5
- package/dist/shared/InvitationResult.js +0 -2
- package/dist/shared/api.js +0 -90
- package/dist/tests/TestVortexInvite.js +0 -134
- package/dist/types/components/Clipboard.d.ts +0 -16
- package/dist/types/components/Clipboard.d.ts.map +0 -1
- package/dist/types/components/ShareButtons.d.ts +0 -29
- package/dist/types/components/ShareButtons.d.ts.map +0 -1
- package/dist/types/hooks/useThemeStyles.d.ts +0 -34
- package/dist/types/hooks/useThemeStyles.d.ts.map +0 -1
- package/dist/types/hooks/useVortexInvite.d.ts +0 -44
- package/dist/types/hooks/useVortexInvite.d.ts.map +0 -1
- package/dist/types/index.d.ts +0 -2
- package/dist/types/index.d.ts.map +0 -1
- package/dist/types/shared/InvitationResult.d.ts +0 -24
- package/dist/types/shared/InvitationResult.d.ts.map +0 -1
- package/dist/types/shared/api.d.ts +0 -14
- package/dist/types/shared/api.d.ts.map +0 -1
- package/dist/types/tests/TestVortexInvite.d.ts +0 -4
- package/dist/types/tests/TestVortexInvite.d.ts.map +0 -1
- package/dist/types/utils/formUtils.d.ts +0 -85
- package/dist/types/utils/formUtils.d.ts.map +0 -1
- package/dist/types/utils/themeUtils.d.ts +0 -36
- package/dist/types/utils/themeUtils.d.ts.map +0 -1
- package/dist/types/vortexInvite.d.ts +0 -25
- package/dist/types/vortexInvite.d.ts.map +0 -1
- package/dist/utils/formUtils.js +0 -174
- package/dist/utils/themeUtils.js +0 -56
- package/dist/vortexInvite.js +0 -172
package/dist/vortexInvite.js
DELETED
|
@@ -1,172 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.VortexInvite = VortexInvite;
|
|
7
|
-
const react_1 = __importDefault(require("react"));
|
|
8
|
-
const react_native_1 = require("react-native");
|
|
9
|
-
const useVortexInvite_1 = require("./hooks/useVortexInvite");
|
|
10
|
-
const ShareButtons_1 = require("./components/ShareButtons");
|
|
11
|
-
function VortexInvite({ widgetId, environmentId, vortexApiHost, isLoading = false, jwt, onSuccess, onError, contentTokens, }) {
|
|
12
|
-
const { error, fetching, loading, email, setEmail, opacity, themeColors, themeStyles, has, inviteLoading, showSuccessMessage, handleInviteClick, handleShareLink, handleCopyLink, handleSmsShare, handleEmailShare, getShareableLink, formLayout, } = (0, useVortexInvite_1.useVortexInvite)({
|
|
13
|
-
widgetId,
|
|
14
|
-
environmentId,
|
|
15
|
-
vortexApiUrl: vortexApiHost,
|
|
16
|
-
isLoading,
|
|
17
|
-
jwt,
|
|
18
|
-
onSuccess,
|
|
19
|
-
onError,
|
|
20
|
-
});
|
|
21
|
-
if (error === null || error === void 0 ? void 0 : error.message) {
|
|
22
|
-
return <react_native_1.Text data-testid="error">{error.message}</react_native_1.Text>;
|
|
23
|
-
}
|
|
24
|
-
if (fetching || loading) {
|
|
25
|
-
return <react_native_1.Animated.View style={[styles.skeleton, { opacity }]}/>;
|
|
26
|
-
}
|
|
27
|
-
// Theme styles are now provided by the hook
|
|
28
|
-
// If we have a grid layout with separate columns for email and share, we'll use that layout
|
|
29
|
-
if ((formLayout === null || formLayout === void 0 ? void 0 : formLayout.isGridLayout) && (formLayout === null || formLayout === void 0 ? void 0 : formLayout.hasSeparateColumns)) {
|
|
30
|
-
return (<react_native_1.View style={[styles.container, themeStyles.containerStyles]}>
|
|
31
|
-
<react_native_1.View style={styles.gridContainer}>
|
|
32
|
-
{/* Email invitation column */}
|
|
33
|
-
{(has === null || has === void 0 ? void 0 : has.emailInvitations) && (<react_native_1.View style={styles.gridItem}>
|
|
34
|
-
<react_native_1.Text style={[styles.introText, themeStyles.textStyles]}>Invite People</react_native_1.Text>
|
|
35
|
-
<react_native_1.TextInput style={[styles.input, themeStyles.inputStyles]} placeholder={formLayout.emailPlaceholder} placeholderTextColor={themeColors.containerForeground} value={email} onChangeText={setEmail} autoCapitalize="none"/>
|
|
36
|
-
<react_native_1.View style={styles.buttonContainer}>
|
|
37
|
-
<react_native_1.Pressable style={[styles.submitButton, themeStyles.primaryButton, inviteLoading && styles.disabledButton]} onPress={() => handleInviteClick(contentTokens)} disabled={inviteLoading}>
|
|
38
|
-
{inviteLoading ? (<react_native_1.ActivityIndicator size="small" color={themeColors.containerBackground}/>) : (<react_native_1.Text style={[styles.submitButtonText, themeStyles.primaryButtonText]}>
|
|
39
|
-
{formLayout.submitButtonLabel}
|
|
40
|
-
</react_native_1.Text>)}
|
|
41
|
-
</react_native_1.Pressable>
|
|
42
|
-
{showSuccessMessage && (<react_native_1.View style={styles.successMessageContainer}>
|
|
43
|
-
<react_native_1.Text style={styles.successMessage}>Success!</react_native_1.Text>
|
|
44
|
-
</react_native_1.View>)}
|
|
45
|
-
</react_native_1.View>
|
|
46
|
-
</react_native_1.View>)}
|
|
47
|
-
|
|
48
|
-
{/* Share buttons column */}
|
|
49
|
-
{(has === null || has === void 0 ? void 0 : has.shareableLinks) && (<react_native_1.View style={styles.gridItem}>
|
|
50
|
-
<react_native_1.View style={styles.shareButtonsContainer}>
|
|
51
|
-
<ShareButtons_1.ShareButtons has={has} themeColors={themeColors} themeStyles={themeStyles} handleShareLink={handleShareLink} handleCopyLink={handleCopyLink} handleSmsShare={handleSmsShare} handleEmailShare={handleEmailShare} shareableLink={getShareableLink()}/>
|
|
52
|
-
</react_native_1.View>
|
|
53
|
-
</react_native_1.View>)}
|
|
54
|
-
</react_native_1.View>
|
|
55
|
-
</react_native_1.View>);
|
|
56
|
-
}
|
|
57
|
-
// Default stacked layout
|
|
58
|
-
return (<react_native_1.View style={[styles.container, themeStyles.containerStyles]}>
|
|
59
|
-
{(has === null || has === void 0 ? void 0 : has.emailInvitations) && (<react_native_1.View style={styles.inviteContainer}>
|
|
60
|
-
<react_native_1.Text style={[styles.introText, themeStyles.textStyles]}>Invite People</react_native_1.Text>
|
|
61
|
-
<react_native_1.TextInput style={[styles.input, themeStyles.inputStyles]} placeholder={(formLayout === null || formLayout === void 0 ? void 0 : formLayout.emailPlaceholder) || 'Enter email'} placeholderTextColor={themeColors.containerForeground} value={email} onChangeText={setEmail} autoCapitalize="none"/>
|
|
62
|
-
<react_native_1.View style={styles.buttonContainer}>
|
|
63
|
-
<react_native_1.Pressable style={[styles.submitButton, themeStyles.primaryButton, inviteLoading && styles.disabledButton]} onPress={() => handleInviteClick(contentTokens)} disabled={inviteLoading}>
|
|
64
|
-
{inviteLoading ? (<react_native_1.ActivityIndicator size="small" color={themeColors.containerBackground}/>) : (<react_native_1.Text style={[styles.submitButtonText, themeStyles.primaryButtonText]}>
|
|
65
|
-
{(formLayout === null || formLayout === void 0 ? void 0 : formLayout.submitButtonLabel) || 'Invite'}
|
|
66
|
-
</react_native_1.Text>)}
|
|
67
|
-
</react_native_1.Pressable>
|
|
68
|
-
{showSuccessMessage && (<react_native_1.View style={styles.successMessageContainer}>
|
|
69
|
-
<react_native_1.Text style={styles.successMessage}>Success!</react_native_1.Text>
|
|
70
|
-
</react_native_1.View>)}
|
|
71
|
-
</react_native_1.View>
|
|
72
|
-
</react_native_1.View>)}
|
|
73
|
-
|
|
74
|
-
{(has === null || has === void 0 ? void 0 : has.shareableLinks) && (<react_native_1.View style={styles.shareContainer}>
|
|
75
|
-
{(has === null || has === void 0 ? void 0 : has.emailInvitations) && <react_native_1.Text style={[styles.divider, themeStyles.textStyles]}>OR</react_native_1.Text>}
|
|
76
|
-
|
|
77
|
-
<react_native_1.View style={styles.shareButtonsContainer}>
|
|
78
|
-
<ShareButtons_1.ShareButtons has={has} themeColors={themeColors} themeStyles={themeStyles} handleShareLink={handleShareLink} handleCopyLink={handleCopyLink} handleSmsShare={handleSmsShare} handleEmailShare={handleEmailShare} shareableLink={getShareableLink()}/>
|
|
79
|
-
</react_native_1.View>
|
|
80
|
-
</react_native_1.View>)}
|
|
81
|
-
</react_native_1.View>);
|
|
82
|
-
}
|
|
83
|
-
const styles = react_native_1.StyleSheet.create({
|
|
84
|
-
container: {
|
|
85
|
-
padding: 15,
|
|
86
|
-
display: 'flex',
|
|
87
|
-
flexDirection: 'column',
|
|
88
|
-
borderRadius: 8,
|
|
89
|
-
borderWidth: 1,
|
|
90
|
-
},
|
|
91
|
-
gridContainer: {
|
|
92
|
-
flexDirection: 'row',
|
|
93
|
-
flexWrap: 'wrap',
|
|
94
|
-
justifyContent: 'space-between',
|
|
95
|
-
},
|
|
96
|
-
gridItem: {
|
|
97
|
-
flex: 1,
|
|
98
|
-
padding: 8,
|
|
99
|
-
minWidth: 250, // Ensure items have minimum width for smaller screens
|
|
100
|
-
},
|
|
101
|
-
disabledButton: {
|
|
102
|
-
opacity: 0.7,
|
|
103
|
-
},
|
|
104
|
-
successMessageContainer: {
|
|
105
|
-
marginTop: 8,
|
|
106
|
-
padding: 8,
|
|
107
|
-
alignItems: 'center',
|
|
108
|
-
width: '100%',
|
|
109
|
-
},
|
|
110
|
-
successMessage: {
|
|
111
|
-
color: 'green',
|
|
112
|
-
fontWeight: 'bold',
|
|
113
|
-
fontSize: 16,
|
|
114
|
-
},
|
|
115
|
-
inviteContainer: {
|
|
116
|
-
display: 'flex',
|
|
117
|
-
flexDirection: 'column',
|
|
118
|
-
justifyContent: 'center',
|
|
119
|
-
alignItems: 'center',
|
|
120
|
-
marginTop: 8,
|
|
121
|
-
},
|
|
122
|
-
introText: {
|
|
123
|
-
marginBottom: 8,
|
|
124
|
-
fontSize: 24,
|
|
125
|
-
fontWeight: 'bold',
|
|
126
|
-
textAlign: 'center',
|
|
127
|
-
},
|
|
128
|
-
input: {
|
|
129
|
-
width: '100%',
|
|
130
|
-
borderWidth: 1,
|
|
131
|
-
padding: 10,
|
|
132
|
-
borderRadius: 5,
|
|
133
|
-
marginBottom: 8,
|
|
134
|
-
},
|
|
135
|
-
buttonContainer: {
|
|
136
|
-
marginTop: 16,
|
|
137
|
-
marginBottom: 8,
|
|
138
|
-
width: '100%',
|
|
139
|
-
},
|
|
140
|
-
submitButton: {
|
|
141
|
-
padding: 12,
|
|
142
|
-
borderRadius: 5,
|
|
143
|
-
alignItems: 'center',
|
|
144
|
-
borderWidth: 1,
|
|
145
|
-
},
|
|
146
|
-
submitButtonText: {
|
|
147
|
-
fontWeight: '500',
|
|
148
|
-
textTransform: 'none',
|
|
149
|
-
},
|
|
150
|
-
skeleton: {
|
|
151
|
-
width: '100%',
|
|
152
|
-
height: 50,
|
|
153
|
-
backgroundColor: 'lightgray',
|
|
154
|
-
borderRadius: 5,
|
|
155
|
-
},
|
|
156
|
-
shareContainer: {
|
|
157
|
-
marginTop: 16,
|
|
158
|
-
alignItems: 'center',
|
|
159
|
-
},
|
|
160
|
-
divider: {
|
|
161
|
-
marginVertical: 10,
|
|
162
|
-
fontSize: 16,
|
|
163
|
-
fontWeight: 'bold',
|
|
164
|
-
textAlign: 'center',
|
|
165
|
-
},
|
|
166
|
-
shareButtonsContainer: {
|
|
167
|
-
flexDirection: 'row',
|
|
168
|
-
flexWrap: 'wrap',
|
|
169
|
-
justifyContent: 'center',
|
|
170
|
-
},
|
|
171
|
-
// Share button styles moved to ShareButtons.tsx
|
|
172
|
-
});
|