@teamvortexsoftware/vortex-react-native 0.0.8 → 0.0.9
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/dist/components/ShareButtons.js +170 -0
- package/dist/hooks/useThemeStyles.js +39 -0
- package/dist/hooks/useVortexInvite.js +281 -0
- package/dist/index.js +5 -0
- package/dist/shared/InvitationResult.js +2 -0
- package/dist/shared/api.js +90 -0
- package/dist/tests/TestVortexInvite.js +134 -0
- package/dist/types/components/ShareButtons.d.ts +27 -0
- package/dist/types/components/ShareButtons.d.ts.map +1 -0
- package/dist/types/hooks/useThemeStyles.d.ts +34 -0
- package/dist/types/hooks/useThemeStyles.d.ts.map +1 -0
- package/dist/types/hooks/useVortexInvite.d.ts +41 -0
- package/dist/types/hooks/useVortexInvite.d.ts.map +1 -0
- package/dist/types/index.d.ts +2 -0
- package/dist/types/index.d.ts.map +1 -0
- package/dist/types/shared/InvitationResult.d.ts +24 -0
- package/dist/types/shared/InvitationResult.d.ts.map +1 -0
- package/dist/types/shared/api.d.ts +14 -0
- package/dist/types/shared/api.d.ts.map +1 -0
- package/dist/types/tests/TestVortexInvite.d.ts +4 -0
- package/dist/types/tests/TestVortexInvite.d.ts.map +1 -0
- package/dist/types/utils/formUtils.d.ts +85 -0
- package/dist/types/utils/formUtils.d.ts.map +1 -0
- package/dist/types/utils/themeUtils.d.ts +35 -0
- package/dist/types/utils/themeUtils.d.ts.map +1 -0
- package/dist/types/vortexInvite.d.ts +25 -0
- package/dist/types/vortexInvite.d.ts.map +1 -0
- package/dist/utils/formUtils.js +174 -0
- package/dist/utils/themeUtils.js +55 -0
- package/dist/vortexInvite.js +172 -0
- package/package.json +9 -3
- package/plugin/withVortexReactNative.js +59 -26
- package/eslint.config.mjs +0 -4
- package/src/components/ShareButtons.tsx +0 -172
- package/src/hooks/useThemeStyles.ts +0 -42
- package/src/hooks/useVortexInvite.ts +0 -278
- package/src/index.tsx +0 -2
- package/src/shared/api.ts +0 -67
- package/src/utils/themeUtils.ts +0 -85
- package/src/vortexInvite.tsx +0 -188
- package/tsconfig.json +0 -16
|
@@ -0,0 +1,134 @@
|
|
|
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
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
+
const react_1 = __importStar(require("react"));
|
|
37
|
+
const react_native_1 = require("react-native");
|
|
38
|
+
const vortexInvite_1 = require("../vortexInvite");
|
|
39
|
+
const TestVortexInvite = () => {
|
|
40
|
+
const [isLoading, setIsLoading] = (0, react_1.useState)(false);
|
|
41
|
+
const [lastResult, setLastResult] = (0, react_1.useState)(null);
|
|
42
|
+
const [lastError, setLastError] = (0, react_1.useState)(null);
|
|
43
|
+
// Mock JWT - this would typically come from your auth system
|
|
44
|
+
const mockJwt = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c';
|
|
45
|
+
const handleSuccess = (result) => {
|
|
46
|
+
setLastResult({ type: result.type, data: result.data });
|
|
47
|
+
setLastError(null);
|
|
48
|
+
};
|
|
49
|
+
const handleError = (error, type) => {
|
|
50
|
+
setLastError({ message: error.message, type });
|
|
51
|
+
setLastResult(null);
|
|
52
|
+
};
|
|
53
|
+
// Example content tokens
|
|
54
|
+
const contentTokens = {
|
|
55
|
+
'user.first_name': { value: 'John', type: 'string' },
|
|
56
|
+
'user.last_name': { value: 'Doe', type: 'string' },
|
|
57
|
+
'company.name': { value: 'Acme Inc', type: 'string' },
|
|
58
|
+
};
|
|
59
|
+
return (<react_native_1.SafeAreaView style={styles.container}>
|
|
60
|
+
<react_native_1.ScrollView contentContainerStyle={styles.scrollContainer}>
|
|
61
|
+
<react_native_1.Text style={styles.header}>Test VortexInvite Component</react_native_1.Text>
|
|
62
|
+
|
|
63
|
+
<react_native_1.View style={styles.controls}>
|
|
64
|
+
<react_native_1.Button title={isLoading ? 'Set Loading: False' : 'Set Loading: True'} onPress={() => setIsLoading(!isLoading)}/>
|
|
65
|
+
<react_native_1.Text style={styles.statusText}>Loading state: {isLoading ? 'true' : 'false'}</react_native_1.Text>
|
|
66
|
+
</react_native_1.View>
|
|
67
|
+
|
|
68
|
+
<react_native_1.View style={styles.inviteContainer}>
|
|
69
|
+
<vortexInvite_1.VortexInvite environmentId="env_123456789" widgetId="widget_123456789" vortexApiHost="https://api.vortex.com" isLoading={isLoading} jwt={mockJwt} onSuccess={handleSuccess} onError={handleError} contentTokens={contentTokens}/>
|
|
70
|
+
</react_native_1.View>
|
|
71
|
+
|
|
72
|
+
{lastResult && (<react_native_1.View style={styles.resultContainer}>
|
|
73
|
+
<react_native_1.Text style={styles.resultTitle}>Last Success:</react_native_1.Text>
|
|
74
|
+
<react_native_1.Text>Type: {lastResult.type}</react_native_1.Text>
|
|
75
|
+
<react_native_1.Text>Data: {lastResult.data}</react_native_1.Text>
|
|
76
|
+
</react_native_1.View>)}
|
|
77
|
+
|
|
78
|
+
{lastError && (<react_native_1.View style={styles.errorContainer}>
|
|
79
|
+
<react_native_1.Text style={styles.errorTitle}>Last Error:</react_native_1.Text>
|
|
80
|
+
<react_native_1.Text>Type: {lastError.type}</react_native_1.Text>
|
|
81
|
+
<react_native_1.Text>Message: {lastError.message}</react_native_1.Text>
|
|
82
|
+
</react_native_1.View>)}
|
|
83
|
+
</react_native_1.ScrollView>
|
|
84
|
+
</react_native_1.SafeAreaView>);
|
|
85
|
+
};
|
|
86
|
+
const styles = react_native_1.StyleSheet.create({
|
|
87
|
+
container: {
|
|
88
|
+
flex: 1,
|
|
89
|
+
backgroundColor: 'whitesmoke',
|
|
90
|
+
},
|
|
91
|
+
scrollContainer: {
|
|
92
|
+
padding: 16,
|
|
93
|
+
},
|
|
94
|
+
header: {
|
|
95
|
+
fontSize: 24,
|
|
96
|
+
fontWeight: 'bold',
|
|
97
|
+
marginBottom: 20,
|
|
98
|
+
textAlign: 'center',
|
|
99
|
+
},
|
|
100
|
+
controls: {
|
|
101
|
+
marginBottom: 20,
|
|
102
|
+
alignItems: 'center',
|
|
103
|
+
},
|
|
104
|
+
statusText: {
|
|
105
|
+
marginTop: 8,
|
|
106
|
+
fontSize: 16,
|
|
107
|
+
},
|
|
108
|
+
inviteContainer: {
|
|
109
|
+
marginBottom: 20,
|
|
110
|
+
},
|
|
111
|
+
resultContainer: {
|
|
112
|
+
padding: 12,
|
|
113
|
+
backgroundColor: 'honeydew',
|
|
114
|
+
borderRadius: 8,
|
|
115
|
+
marginTop: 16,
|
|
116
|
+
},
|
|
117
|
+
resultTitle: {
|
|
118
|
+
fontWeight: 'bold',
|
|
119
|
+
marginBottom: 8,
|
|
120
|
+
fontSize: 16,
|
|
121
|
+
},
|
|
122
|
+
errorContainer: {
|
|
123
|
+
padding: 12,
|
|
124
|
+
backgroundColor: 'mistyrose',
|
|
125
|
+
borderRadius: 8,
|
|
126
|
+
marginTop: 16,
|
|
127
|
+
},
|
|
128
|
+
errorTitle: {
|
|
129
|
+
fontWeight: 'bold',
|
|
130
|
+
marginBottom: 8,
|
|
131
|
+
fontSize: 16,
|
|
132
|
+
},
|
|
133
|
+
});
|
|
134
|
+
exports.default = TestVortexInvite;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { ThemeColors } from '../utils/themeUtils';
|
|
3
|
+
/**
|
|
4
|
+
* ShareButton component for rendering a single share option button
|
|
5
|
+
*/
|
|
6
|
+
interface ShareButtonProps {
|
|
7
|
+
iconName: string;
|
|
8
|
+
label: string;
|
|
9
|
+
onPress: () => void;
|
|
10
|
+
themeColors: ThemeColors;
|
|
11
|
+
themeStyles: any;
|
|
12
|
+
}
|
|
13
|
+
export declare function ShareButton({ iconName, label, onPress, themeColors, themeStyles }: ShareButtonProps): React.JSX.Element;
|
|
14
|
+
/**
|
|
15
|
+
* ShareButtons component for rendering all available share options
|
|
16
|
+
*/
|
|
17
|
+
export interface ShareButtonsProps {
|
|
18
|
+
has: any;
|
|
19
|
+
themeColors: ThemeColors;
|
|
20
|
+
themeStyles: any;
|
|
21
|
+
handleShareLink: () => void;
|
|
22
|
+
handleCopyLink: () => void;
|
|
23
|
+
shareableLink?: string;
|
|
24
|
+
}
|
|
25
|
+
export declare function ShareButtons({ has, themeColors, themeStyles, handleShareLink, handleCopyLink, shareableLink, }: ShareButtonsProps): React.JSX.Element;
|
|
26
|
+
export {};
|
|
27
|
+
//# sourceMappingURL=ShareButtons.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ShareButtons.d.ts","sourceRoot":"","sources":["../../../src/components/ShareButtons.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAmB,MAAM,OAAO,CAAC;AAGxC,OAAO,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAGlD;;GAEG;AACH,UAAU,gBAAgB;IACxB,QAAQ,EAAE,MAAM,CAAC;IACjB,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,MAAM,IAAI,CAAC;IACpB,WAAW,EAAE,WAAW,CAAC;IACzB,WAAW,EAAE,GAAG,CAAC;CAClB;AAED,wBAAgB,WAAW,CAAC,EAAE,QAAQ,EAAE,KAAK,EAAE,OAAO,EAAE,WAAW,EAAE,WAAW,EAAE,EAAE,gBAAgB,qBAWnG;AAED;;GAEG;AACH,MAAM,WAAW,iBAAiB;IAChC,GAAG,EAAE,GAAG,CAAC;IACT,WAAW,EAAE,WAAW,CAAC;IACzB,WAAW,EAAE,GAAG,CAAC;IACjB,eAAe,EAAE,MAAM,IAAI,CAAC;IAC5B,cAAc,EAAE,MAAM,IAAI,CAAC;IAC3B,aAAa,CAAC,EAAE,MAAM,CAAC;CACxB;AAED,wBAAgB,YAAY,CAAC,EAC3B,GAAG,EACH,WAAW,EACX,WAAW,EACX,eAAe,EACf,cAAc,EACd,aAAa,GACd,EAAE,iBAAiB,qBA6FnB"}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { ThemeColors } from "../utils/themeUtils";
|
|
2
|
+
/**
|
|
3
|
+
* Hook to generate dynamic styles based on theme colors
|
|
4
|
+
* @param themeColors The theme colors object
|
|
5
|
+
* @returns Object containing styled components based on the theme
|
|
6
|
+
*/
|
|
7
|
+
export declare function useThemeStyles(themeColors: ThemeColors): {
|
|
8
|
+
primaryButton: {
|
|
9
|
+
backgroundColor: string;
|
|
10
|
+
borderColor: string;
|
|
11
|
+
};
|
|
12
|
+
primaryButtonText: {
|
|
13
|
+
color: string;
|
|
14
|
+
};
|
|
15
|
+
secondaryButton: {
|
|
16
|
+
backgroundColor: string;
|
|
17
|
+
borderColor: string;
|
|
18
|
+
};
|
|
19
|
+
secondaryButtonText: {
|
|
20
|
+
color: string;
|
|
21
|
+
};
|
|
22
|
+
containerStyles: {
|
|
23
|
+
backgroundColor: string;
|
|
24
|
+
};
|
|
25
|
+
textStyles: {
|
|
26
|
+
color: string;
|
|
27
|
+
};
|
|
28
|
+
inputStyles: {
|
|
29
|
+
borderColor: string;
|
|
30
|
+
color: string;
|
|
31
|
+
backgroundColor: string;
|
|
32
|
+
};
|
|
33
|
+
};
|
|
34
|
+
//# sourceMappingURL=useThemeStyles.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useThemeStyles.d.ts","sourceRoot":"","sources":["../../../src/hooks/useThemeStyles.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAElD;;;;GAIG;AACH,wBAAgB,cAAc,CAAC,WAAW,EAAE,WAAW;;;;;;;;;;;;;;;;;;;;;;;;;;EAiCtD"}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { WidgetConfiguration } from '@teamvortexsoftware/vortex-core';
|
|
2
|
+
import { Animated } from 'react-native';
|
|
3
|
+
import { Attributes, VortexActionResult, VortexActionType } from '../vortexInvite';
|
|
4
|
+
export interface UseVortexInviteOptions {
|
|
5
|
+
widgetId: string;
|
|
6
|
+
environmentId: string;
|
|
7
|
+
vortexApiHost: string;
|
|
8
|
+
isLoading?: boolean;
|
|
9
|
+
jwt?: string;
|
|
10
|
+
onSuccess?: (result: VortexActionResult) => void;
|
|
11
|
+
onError?: (error: Error, type: VortexActionType) => void;
|
|
12
|
+
}
|
|
13
|
+
export declare function useVortexInvite({ widgetId, environmentId, vortexApiHost, isLoading, jwt, onSuccess, onError, }: UseVortexInviteOptions): {
|
|
14
|
+
widgetConfiguration: WidgetConfiguration | undefined;
|
|
15
|
+
error: {
|
|
16
|
+
message: string;
|
|
17
|
+
} | null;
|
|
18
|
+
fetching: boolean;
|
|
19
|
+
loading: boolean;
|
|
20
|
+
email: string;
|
|
21
|
+
setEmail: import("react").Dispatch<import("react").SetStateAction<string>>;
|
|
22
|
+
opacity: Animated.Value;
|
|
23
|
+
themeColors: import("../utils/themeUtils").ThemeColors;
|
|
24
|
+
themeStyles: Record<string, Record<string, string | number>>;
|
|
25
|
+
has: import("../utils/themeUtils").FeatureFlags;
|
|
26
|
+
options: import("@teamvortexsoftware/vortex-core").WidgetConfigurationConfigurationProps;
|
|
27
|
+
inviteLoading: boolean;
|
|
28
|
+
showSuccessMessage: boolean;
|
|
29
|
+
handleInviteClick: (contentTokens?: Attributes) => Promise<void>;
|
|
30
|
+
handleShareLink: () => Promise<void>;
|
|
31
|
+
handleCopyLink: () => Promise<void>;
|
|
32
|
+
getShareableLink: () => string;
|
|
33
|
+
formLayout: {
|
|
34
|
+
emailPlaceholder: string;
|
|
35
|
+
submitButtonLabel: string;
|
|
36
|
+
isGridLayout: boolean;
|
|
37
|
+
hasSeparateColumns: boolean;
|
|
38
|
+
formConfig: import("../utils/formUtils").FormComponent[] | null;
|
|
39
|
+
};
|
|
40
|
+
};
|
|
41
|
+
//# sourceMappingURL=useVortexInvite.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useVortexInvite.d.ts","sourceRoot":"","sources":["../../../src/hooks/useVortexInvite.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,iCAAiC,CAAC;AAEtE,OAAO,EAAE,QAAQ,EAAoB,MAAM,cAAc,CAAC;AAI1D,OAAO,EAAE,UAAU,EAAE,kBAAkB,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAC;AAgBnF,MAAM,WAAW,sBAAsB;IACrC,QAAQ,EAAE,MAAM,CAAC;IACjB,aAAa,EAAE,MAAM,CAAC;IACtB,aAAa,EAAE,MAAM,CAAC;IACtB,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,SAAS,CAAC,EAAE,CAAC,MAAM,EAAE,kBAAkB,KAAK,IAAI,CAAC;IACjD,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,KAAK,EAAE,IAAI,EAAE,gBAAgB,KAAK,IAAI,CAAC;CAC1D;AAED,wBAAgB,eAAe,CAAC,EAC9B,QAAQ,EACR,aAAa,EACb,aAAa,EACb,SAAiB,EACjB,GAAG,EACH,SAAS,EACT,OAAO,GACR,EAAE,sBAAsB;;;iBAIuB,MAAM;;;;;;;;;;;;;wCAqIH,UAAU,KAAG,OAAO,CAAC,IAAI,CAAC;;;;;;;;;;;EAqJ5E"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,KAAK,iBAAiB,EAAE,KAAK,UAAU,EAAE,KAAK,kBAAkB,EAAE,KAAK,gBAAgB,EAAE,MAAM,gBAAgB,CAAC"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { UUID } from '@teamvortexsoftware/vortex-core';
|
|
2
|
+
export interface InvitationResultDto {
|
|
3
|
+
invitation: {
|
|
4
|
+
id: UUID;
|
|
5
|
+
accountId: UUID;
|
|
6
|
+
attributes: any;
|
|
7
|
+
clickThroughs: number | null;
|
|
8
|
+
configurationAttributes: any;
|
|
9
|
+
createdAt: Date;
|
|
10
|
+
deactivated: boolean;
|
|
11
|
+
deliveryCount: number;
|
|
12
|
+
deliveryTypes: string[];
|
|
13
|
+
foreignCreatorId: UUID | null;
|
|
14
|
+
invitationType: string;
|
|
15
|
+
modifiedAt: Date | null;
|
|
16
|
+
passThrough: string | null;
|
|
17
|
+
status: string;
|
|
18
|
+
target: any;
|
|
19
|
+
views: number | null;
|
|
20
|
+
widgetConfigurationId: UUID | null;
|
|
21
|
+
projectId: UUID | null;
|
|
22
|
+
};
|
|
23
|
+
}
|
|
24
|
+
//# sourceMappingURL=InvitationResult.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"InvitationResult.d.ts","sourceRoot":"","sources":["../../../src/shared/InvitationResult.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,iCAAiC,CAAC;AAEvD,MAAM,WAAW,mBAAmB;IAClC,UAAU,EAAE;QACV,EAAE,EAAE,IAAI,CAAC;QACT,SAAS,EAAE,IAAI,CAAC;QAChB,UAAU,EAAE,GAAG,CAAC;QAChB,aAAa,EAAE,MAAM,GAAG,IAAI,CAAC;QAC7B,uBAAuB,EAAE,GAAG,CAAC;QAC7B,SAAS,EAAE,IAAI,CAAC;QAChB,WAAW,EAAE,OAAO,CAAC;QACrB,aAAa,EAAE,MAAM,CAAC;QACtB,aAAa,EAAE,MAAM,EAAE,CAAC;QACxB,gBAAgB,EAAE,IAAI,GAAG,IAAI,CAAC;QAC9B,cAAc,EAAE,MAAM,CAAC;QACvB,UAAU,EAAE,IAAI,GAAG,IAAI,CAAC;QACxB,WAAW,EAAE,MAAM,GAAG,IAAI,CAAC;QAC3B,MAAM,EAAE,MAAM,CAAC;QACf,MAAM,EAAE,GAAG,CAAC;QACZ,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;QACrB,qBAAqB,EAAE,IAAI,GAAG,IAAI,CAAC;QACnC,SAAS,EAAE,IAAI,GAAG,IAAI,CAAC;KACxB,CAAC;CACH"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { InvitationResultDto } from './InvitationResult';
|
|
2
|
+
declare class VortexClient {
|
|
3
|
+
private sessionId;
|
|
4
|
+
private baseUrl;
|
|
5
|
+
constructor(baseUrl: string, sessionId: string);
|
|
6
|
+
getWidgetConfiguration(widgetId: string, jwt: string, environmentId: string): Promise<any>;
|
|
7
|
+
createInvite(jwt: string, widgetConfigurationId: string, environmentId: string, payload: any): Promise<any>;
|
|
8
|
+
getShareableLinkFormatted(): string;
|
|
9
|
+
createShareableInvite(jwt: string, widgetConfigurationId: string, environmentId: string): Promise<{
|
|
10
|
+
data: InvitationResultDto;
|
|
11
|
+
}>;
|
|
12
|
+
}
|
|
13
|
+
export default VortexClient;
|
|
14
|
+
//# sourceMappingURL=api.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"api.d.ts","sourceRoot":"","sources":["../../../src/shared/api.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,oBAAoB,CAAC;AAEzD,cAAM,YAAY;IAKd,OAAO,CAAC,SAAS;IAJnB,OAAO,CAAC,OAAO,CAAS;gBAGtB,OAAO,EAAE,MAAM,EACP,SAAS,EAAE,MAAM;IAMrB,sBAAsB,CAAC,QAAQ,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,EAAE,aAAa,EAAE,MAAM;IAsB3E,YAAY,CAAC,GAAG,EAAE,MAAM,EAAE,qBAAqB,EAAE,MAAM,EAAE,aAAa,EAAE,MAAM,EAAE,OAAO,EAAE,GAAG;IA4BlG,yBAAyB;IAInB,qBAAqB,CACzB,GAAG,EAAE,MAAM,EACX,qBAAqB,EAAE,MAAM,EAC7B,aAAa,EAAE,MAAM,GACpB,OAAO,CAAC;QAAE,IAAI,EAAE,mBAAmB,CAAA;KAAE,CAAC;CA0B1C;AAED,eAAe,YAAY,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TestVortexInvite.d.ts","sourceRoot":"","sources":["../../../src/tests/TestVortexInvite.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAmB,MAAM,OAAO,CAAC;AAKxC,QAAA,MAAM,gBAAgB,yBAqErB,CAAC;AAmDF,eAAe,gBAAgB,CAAC"}
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
import { WidgetConfiguration } from "@teamvortexsoftware/vortex-core";
|
|
2
|
+
import { ThemeColors } from "./themeUtils";
|
|
3
|
+
export interface FormComponentStyle {
|
|
4
|
+
[key: string]: {
|
|
5
|
+
label?: string;
|
|
6
|
+
value?: string | number;
|
|
7
|
+
computedValue?: string;
|
|
8
|
+
unit?: string;
|
|
9
|
+
};
|
|
10
|
+
}
|
|
11
|
+
export interface FormComponentSettings {
|
|
12
|
+
action?: {
|
|
13
|
+
type: string;
|
|
14
|
+
value: string;
|
|
15
|
+
target?: string;
|
|
16
|
+
};
|
|
17
|
+
size?: number;
|
|
18
|
+
}
|
|
19
|
+
export interface FormComponent {
|
|
20
|
+
id: string;
|
|
21
|
+
type: string;
|
|
22
|
+
subtype?: string;
|
|
23
|
+
label?: string;
|
|
24
|
+
hint?: string;
|
|
25
|
+
name?: string;
|
|
26
|
+
required?: boolean;
|
|
27
|
+
placeholder?: string;
|
|
28
|
+
style?: FormComponentStyle;
|
|
29
|
+
settings?: FormComponentSettings;
|
|
30
|
+
vortex?: {
|
|
31
|
+
role?: string;
|
|
32
|
+
canRemove?: boolean;
|
|
33
|
+
};
|
|
34
|
+
children?: FormComponent[];
|
|
35
|
+
multiValue?: boolean;
|
|
36
|
+
validation?: Array<{
|
|
37
|
+
type: string;
|
|
38
|
+
value: string;
|
|
39
|
+
operator: string;
|
|
40
|
+
canRemove: boolean;
|
|
41
|
+
errorMessage: string;
|
|
42
|
+
}>;
|
|
43
|
+
tagName?: string;
|
|
44
|
+
textContent?: string;
|
|
45
|
+
attributes?: {
|
|
46
|
+
[key: string]: string;
|
|
47
|
+
};
|
|
48
|
+
}
|
|
49
|
+
export interface FormConfiguration {
|
|
50
|
+
value: FormComponent[];
|
|
51
|
+
valueType: string;
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* Extracts the form configuration from the widget configuration
|
|
55
|
+
*/
|
|
56
|
+
export declare function extractFormConfiguration(widgetConfiguration?: WidgetConfiguration): FormComponent[] | null;
|
|
57
|
+
/**
|
|
58
|
+
* Converts form component style object to React Native styles
|
|
59
|
+
*/
|
|
60
|
+
export declare function convertFormStyleToRNStyle(style?: FormComponentStyle): Record<string, string | number>;
|
|
61
|
+
/**
|
|
62
|
+
* Find a specific component by role in the form configuration
|
|
63
|
+
*/
|
|
64
|
+
export declare function findComponentByRole(formConfig: FormComponent[] | null, role: string): FormComponent | null;
|
|
65
|
+
/**
|
|
66
|
+
* Merges theme styles with component-specific styles from form configuration
|
|
67
|
+
*/
|
|
68
|
+
export declare function mergeThemeAndComponentStyles(themeStyles: Record<string, Record<string, string | number>>, themeColors: ThemeColors, formConfig: FormComponent[] | null): Record<string, Record<string, string | number>>;
|
|
69
|
+
/**
|
|
70
|
+
* Get email input placeholder from form configuration
|
|
71
|
+
*/
|
|
72
|
+
export declare function getEmailPlaceholder(formConfig: FormComponent[] | null): string;
|
|
73
|
+
/**
|
|
74
|
+
* Get submit button label from form configuration
|
|
75
|
+
*/
|
|
76
|
+
export declare function getSubmitButtonLabel(formConfig: FormComponent[] | null): string;
|
|
77
|
+
/**
|
|
78
|
+
* Determines if the form layout uses a grid structure
|
|
79
|
+
*/
|
|
80
|
+
export declare function hasGridLayout(formConfig: FormComponent[] | null): boolean;
|
|
81
|
+
/**
|
|
82
|
+
* Determines if email and share components are in separate grid items
|
|
83
|
+
*/
|
|
84
|
+
export declare function hasEmailAndShareInSeparateColumns(formConfig: FormComponent[] | null): boolean;
|
|
85
|
+
//# sourceMappingURL=formUtils.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"formUtils.d.ts","sourceRoot":"","sources":["../../../src/utils/formUtils.ts"],"names":[],"mappings":"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"}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { WidgetConfiguration } from '@teamvortexsoftware/vortex-core';
|
|
2
|
+
export interface ThemeColors {
|
|
3
|
+
containerBackground: string;
|
|
4
|
+
containerForeground: string;
|
|
5
|
+
containerBorder: string;
|
|
6
|
+
primaryButtonBackground: string;
|
|
7
|
+
primaryButtonForeground: string;
|
|
8
|
+
primaryButtonBorder: string;
|
|
9
|
+
secondaryButtonBackground: string;
|
|
10
|
+
secondaryButtonForeground: string;
|
|
11
|
+
secondaryButtonBorder: string;
|
|
12
|
+
}
|
|
13
|
+
export interface FeatureFlags {
|
|
14
|
+
shareableLinks: boolean;
|
|
15
|
+
emailInvitations: boolean;
|
|
16
|
+
shareOptionsCopyLink: boolean;
|
|
17
|
+
shareOptionsSms: boolean;
|
|
18
|
+
shareOptionsFacebookMessenger: boolean;
|
|
19
|
+
shareOptionsInstagramDms: boolean;
|
|
20
|
+
shareOptionsLinkedInMessaging: boolean;
|
|
21
|
+
shareOptionsTwitterDms: boolean;
|
|
22
|
+
shareOptionsWhatsApp: boolean;
|
|
23
|
+
shareOptionsNativeShareSheet: boolean;
|
|
24
|
+
shareOptionsQrCode: boolean;
|
|
25
|
+
shareEnabled: boolean;
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* Extracts theme colors from widget configuration
|
|
29
|
+
*/
|
|
30
|
+
export declare function extractThemeColors(widgetConfiguration?: WidgetConfiguration): ThemeColors;
|
|
31
|
+
/**
|
|
32
|
+
* Extracts feature flags from widget configuration
|
|
33
|
+
*/
|
|
34
|
+
export declare function extractFeatureFlags(widgetConfiguration?: WidgetConfiguration): FeatureFlags;
|
|
35
|
+
//# sourceMappingURL=themeUtils.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"themeUtils.d.ts","sourceRoot":"","sources":["../../../src/utils/themeUtils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,iCAAiC,CAAC;AAEtE,MAAM,WAAW,WAAW;IAC1B,mBAAmB,EAAE,MAAM,CAAC;IAC5B,mBAAmB,EAAE,MAAM,CAAC;IAC5B,eAAe,EAAE,MAAM,CAAC;IACxB,uBAAuB,EAAE,MAAM,CAAC;IAChC,uBAAuB,EAAE,MAAM,CAAC;IAChC,mBAAmB,EAAE,MAAM,CAAC;IAC5B,yBAAyB,EAAE,MAAM,CAAC;IAClC,yBAAyB,EAAE,MAAM,CAAC;IAClC,qBAAqB,EAAE,MAAM,CAAC;CAC/B;AAED,MAAM,WAAW,YAAY;IAC3B,cAAc,EAAE,OAAO,CAAC;IACxB,gBAAgB,EAAE,OAAO,CAAC;IAC1B,oBAAoB,EAAE,OAAO,CAAC;IAC9B,eAAe,EAAE,OAAO,CAAC;IACzB,6BAA6B,EAAE,OAAO,CAAC;IACvC,wBAAwB,EAAE,OAAO,CAAC;IAClC,6BAA6B,EAAE,OAAO,CAAC;IACvC,sBAAsB,EAAE,OAAO,CAAC;IAChC,oBAAoB,EAAE,OAAO,CAAC;IAC9B,4BAA4B,EAAE,OAAO,CAAC;IACtC,kBAAkB,EAAE,OAAO,CAAC;IAC5B,YAAY,EAAE,OAAO,CAAC;CACvB;AAED;;GAEG;AACH,wBAAgB,kBAAkB,CAAC,mBAAmB,CAAC,EAAE,mBAAmB,GAAG,WAAW,CAsBzF;AAED;;GAEG;AACH,wBAAgB,mBAAmB,CAAC,mBAAmB,CAAC,EAAE,mBAAmB,GAAG,YAAY,CAyB3F"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
export type VortexActionType = 'invite' | 'share';
|
|
3
|
+
export interface VortexActionResult {
|
|
4
|
+
type: VortexActionType;
|
|
5
|
+
data: string;
|
|
6
|
+
}
|
|
7
|
+
export interface Attributes {
|
|
8
|
+
[key: string]: {
|
|
9
|
+
value: string | string[];
|
|
10
|
+
type: string;
|
|
11
|
+
role?: string;
|
|
12
|
+
};
|
|
13
|
+
}
|
|
14
|
+
export interface VortexInviteProps {
|
|
15
|
+
environmentId: string;
|
|
16
|
+
widgetId: string;
|
|
17
|
+
vortexApiHost: string;
|
|
18
|
+
isLoading: boolean;
|
|
19
|
+
jwt?: string;
|
|
20
|
+
onSuccess?: (result: VortexActionResult) => void;
|
|
21
|
+
onError?: (error: Error, type: VortexActionType) => void;
|
|
22
|
+
contentTokens?: Attributes;
|
|
23
|
+
}
|
|
24
|
+
export declare function VortexInvite({ widgetId, environmentId, vortexApiHost, isLoading, jwt, onSuccess, onError, contentTokens, }: VortexInviteProps): React.JSX.Element;
|
|
25
|
+
//# sourceMappingURL=vortexInvite.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"vortexInvite.d.ts","sourceRoot":"","sources":["../../src/vortexInvite.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAK1B,MAAM,MAAM,gBAAgB,GAAG,QAAQ,GAAG,OAAO,CAAC;AAElD,MAAM,WAAW,kBAAkB;IACjC,IAAI,EAAE,gBAAgB,CAAC;IACvB,IAAI,EAAE,MAAM,CAAC;CACd;AAGD,MAAM,WAAW,UAAU;IACzB,CAAC,GAAG,EAAE,MAAM,GAAG;QAAE,KAAK,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC;QAAC,IAAI,EAAE,MAAM,CAAC;QAAC,IAAI,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC;CAC1E;AAED,MAAM,WAAW,iBAAiB;IAChC,aAAa,EAAE,MAAM,CAAC;IACtB,QAAQ,EAAE,MAAM,CAAC;IACjB,aAAa,EAAE,MAAM,CAAC;IACtB,SAAS,EAAE,OAAO,CAAC;IACnB,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,SAAS,CAAC,EAAE,CAAC,MAAM,EAAE,kBAAkB,KAAK,IAAI,CAAC;IACjD,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,KAAK,EAAE,IAAI,EAAE,gBAAgB,KAAK,IAAI,CAAC;IACzD,aAAa,CAAC,EAAE,UAAU,CAAC;CAC5B;AAED,wBAAgB,YAAY,CAAC,EAC3B,QAAQ,EACR,aAAa,EACb,aAAa,EACb,SAAiB,EACjB,GAAG,EACH,SAAS,EACT,OAAO,EACP,aAAa,GACd,EAAE,iBAAiB,qBAyJnB"}
|
|
@@ -0,0 +1,174 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.extractFormConfiguration = extractFormConfiguration;
|
|
4
|
+
exports.convertFormStyleToRNStyle = convertFormStyleToRNStyle;
|
|
5
|
+
exports.findComponentByRole = findComponentByRole;
|
|
6
|
+
exports.mergeThemeAndComponentStyles = mergeThemeAndComponentStyles;
|
|
7
|
+
exports.getEmailPlaceholder = getEmailPlaceholder;
|
|
8
|
+
exports.getSubmitButtonLabel = getSubmitButtonLabel;
|
|
9
|
+
exports.hasGridLayout = hasGridLayout;
|
|
10
|
+
exports.hasEmailAndShareInSeparateColumns = hasEmailAndShareInSeparateColumns;
|
|
11
|
+
/**
|
|
12
|
+
* Extracts the form configuration from the widget configuration
|
|
13
|
+
*/
|
|
14
|
+
function extractFormConfiguration(widgetConfiguration) {
|
|
15
|
+
var _a, _b, _c;
|
|
16
|
+
if (!((_c = (_b = (_a = widgetConfiguration === null || widgetConfiguration === void 0 ? void 0 : widgetConfiguration.configuration) === null || _a === void 0 ? void 0 : _a.props) === null || _b === void 0 ? void 0 : _b["vortex.components.form"]) === null || _c === void 0 ? void 0 : _c.value)) {
|
|
17
|
+
return null;
|
|
18
|
+
}
|
|
19
|
+
return widgetConfiguration.configuration.props["vortex.components.form"].value;
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Converts form component style object to React Native styles
|
|
23
|
+
*/
|
|
24
|
+
function convertFormStyleToRNStyle(style) {
|
|
25
|
+
if (!style)
|
|
26
|
+
return {};
|
|
27
|
+
const rnStyle = {};
|
|
28
|
+
Object.keys(style).forEach((key) => {
|
|
29
|
+
const styleObj = style[key];
|
|
30
|
+
// Handle special cases like background-color to backgroundColor
|
|
31
|
+
const normalizedKey = key.replace(/-([a-z])/g, (g) => g[1].toUpperCase());
|
|
32
|
+
// Use computedValue if available, otherwise use value
|
|
33
|
+
if (styleObj.computedValue) {
|
|
34
|
+
rnStyle[normalizedKey] = styleObj.computedValue;
|
|
35
|
+
}
|
|
36
|
+
else if (styleObj.value !== undefined) {
|
|
37
|
+
// Handle numeric values
|
|
38
|
+
if (typeof styleObj.value === 'string' && !isNaN(Number(styleObj.value))) {
|
|
39
|
+
rnStyle[normalizedKey] = Number(styleObj.value);
|
|
40
|
+
}
|
|
41
|
+
else {
|
|
42
|
+
rnStyle[normalizedKey] = styleObj.value;
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
});
|
|
46
|
+
return rnStyle;
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* Find a specific component by role in the form configuration
|
|
50
|
+
*/
|
|
51
|
+
function findComponentByRole(formConfig, role) {
|
|
52
|
+
if (!formConfig)
|
|
53
|
+
return null;
|
|
54
|
+
const findComponent = (components) => {
|
|
55
|
+
var _a;
|
|
56
|
+
for (const component of components) {
|
|
57
|
+
if (((_a = component.vortex) === null || _a === void 0 ? void 0 : _a.role) === role) {
|
|
58
|
+
return component;
|
|
59
|
+
}
|
|
60
|
+
if (component.children) {
|
|
61
|
+
const found = findComponent(component.children);
|
|
62
|
+
if (found)
|
|
63
|
+
return found;
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
return null;
|
|
67
|
+
};
|
|
68
|
+
return findComponent(formConfig);
|
|
69
|
+
}
|
|
70
|
+
/**
|
|
71
|
+
* Merges theme styles with component-specific styles from form configuration
|
|
72
|
+
*/
|
|
73
|
+
function mergeThemeAndComponentStyles(themeStyles, themeColors, formConfig) {
|
|
74
|
+
// Start with the base theme styles
|
|
75
|
+
const mergedStyles = Object.assign({}, themeStyles);
|
|
76
|
+
// Find submit button and email input components
|
|
77
|
+
const submitButton = findComponentByRole(formConfig, 'submit');
|
|
78
|
+
const emailInput = findComponentByRole(formConfig, 'email');
|
|
79
|
+
// Merge submit button styles
|
|
80
|
+
if (submitButton === null || submitButton === void 0 ? void 0 : submitButton.style) {
|
|
81
|
+
const submitButtonStyle = convertFormStyleToRNStyle(submitButton.style);
|
|
82
|
+
mergedStyles.primaryButton = Object.assign(Object.assign(Object.assign({}, mergedStyles.primaryButton), (submitButtonStyle['backgroundColor'] && { backgroundColor: submitButtonStyle['backgroundColor'] })), (submitButtonStyle['borderColor'] && { borderColor: submitButtonStyle['borderColor'] }));
|
|
83
|
+
// Update button text if there's a color specified
|
|
84
|
+
if (submitButtonStyle['color']) {
|
|
85
|
+
mergedStyles.primaryButtonText = Object.assign(Object.assign({}, mergedStyles.primaryButtonText), { color: submitButtonStyle['color'] });
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
// Merge email input styles
|
|
89
|
+
if (emailInput === null || emailInput === void 0 ? void 0 : emailInput.style) {
|
|
90
|
+
const emailInputStyle = convertFormStyleToRNStyle(emailInput.style);
|
|
91
|
+
mergedStyles.inputStyles = Object.assign(Object.assign({}, mergedStyles.inputStyles), emailInputStyle);
|
|
92
|
+
}
|
|
93
|
+
return mergedStyles;
|
|
94
|
+
}
|
|
95
|
+
/**
|
|
96
|
+
* Get email input placeholder from form configuration
|
|
97
|
+
*/
|
|
98
|
+
function getEmailPlaceholder(formConfig) {
|
|
99
|
+
const emailInput = findComponentByRole(formConfig, 'email');
|
|
100
|
+
return (emailInput === null || emailInput === void 0 ? void 0 : emailInput.placeholder) || 'Enter email';
|
|
101
|
+
}
|
|
102
|
+
/**
|
|
103
|
+
* Get submit button label from form configuration
|
|
104
|
+
*/
|
|
105
|
+
function getSubmitButtonLabel(formConfig) {
|
|
106
|
+
const submitButton = findComponentByRole(formConfig, 'submit');
|
|
107
|
+
return (submitButton === null || submitButton === void 0 ? void 0 : submitButton.label) || 'Invite';
|
|
108
|
+
}
|
|
109
|
+
/**
|
|
110
|
+
* Determines if the form layout uses a grid structure
|
|
111
|
+
*/
|
|
112
|
+
function hasGridLayout(formConfig) {
|
|
113
|
+
if (!formConfig)
|
|
114
|
+
return false;
|
|
115
|
+
const findGrid = (components) => {
|
|
116
|
+
for (const component of components) {
|
|
117
|
+
if (component.type === 'grid') {
|
|
118
|
+
return true;
|
|
119
|
+
}
|
|
120
|
+
if (component.children) {
|
|
121
|
+
const found = findGrid(component.children);
|
|
122
|
+
if (found)
|
|
123
|
+
return true;
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
return false;
|
|
127
|
+
};
|
|
128
|
+
return findGrid(formConfig);
|
|
129
|
+
}
|
|
130
|
+
/**
|
|
131
|
+
* Determines if email and share components are in separate grid items
|
|
132
|
+
*/
|
|
133
|
+
function hasEmailAndShareInSeparateColumns(formConfig) {
|
|
134
|
+
if (!formConfig)
|
|
135
|
+
return false;
|
|
136
|
+
// Look for a grid with multiple grid-items
|
|
137
|
+
const findSeparateColumns = (components) => {
|
|
138
|
+
for (const component of components) {
|
|
139
|
+
if (component.type === 'grid' && component.children) {
|
|
140
|
+
// Check if there are at least 2 grid-items
|
|
141
|
+
const gridItems = component.children.filter(child => child.type === 'grid-item');
|
|
142
|
+
if (gridItems.length >= 2) {
|
|
143
|
+
// Check if one has email and one has share
|
|
144
|
+
let hasEmailItem = false;
|
|
145
|
+
let hasShareItem = false;
|
|
146
|
+
for (const item of gridItems) {
|
|
147
|
+
if (!item.children)
|
|
148
|
+
continue;
|
|
149
|
+
// Check for email component
|
|
150
|
+
if (!hasEmailItem) {
|
|
151
|
+
hasEmailItem = item.children.some(child => {
|
|
152
|
+
var _a;
|
|
153
|
+
return child.type === 'form' &&
|
|
154
|
+
((_a = child.children) === null || _a === void 0 ? void 0 : _a.some(formChild => { var _a; return ((_a = formChild.vortex) === null || _a === void 0 ? void 0 : _a.role) === 'email'; }));
|
|
155
|
+
});
|
|
156
|
+
}
|
|
157
|
+
// Check for share component
|
|
158
|
+
if (!hasShareItem) {
|
|
159
|
+
hasShareItem = item.children.some(child => child.type === 'vortex.components.share');
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
return hasEmailItem && hasShareItem;
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
if (component.children) {
|
|
166
|
+
const found = findSeparateColumns(component.children);
|
|
167
|
+
if (found)
|
|
168
|
+
return true;
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
return false;
|
|
172
|
+
};
|
|
173
|
+
return findSeparateColumns(formConfig);
|
|
174
|
+
}
|