@teamvortexsoftware/vortex-react-native 1.0.0 → 1.0.1
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/InviteFormCore-D4HkMMo0.d.mts +721 -0
- package/dist/InviteFormCore-D9oUCbu7.d.ts +721 -0
- package/dist/VortexClient.js +192 -0
- package/dist/VortexClient.js.map +1 -0
- package/dist/VortexDeferredLinks.js +127 -0
- package/dist/VortexDeferredLinks.js.map +1 -0
- package/dist/clientInfo.js +45 -0
- package/dist/clientInfo.js.map +1 -0
- package/dist/components/ContactsPickerModal.js +182 -0
- package/dist/components/ContactsPickerModal.js.map +1 -0
- package/dist/components/InviteFormCore.js +2141 -0
- package/dist/components/InviteFormCore.js.map +1 -0
- package/dist/components/InviteFormMobile.js +463 -0
- package/dist/components/InviteFormMobile.js.map +1 -0
- package/dist/components/InviteFormWeb.js +295 -0
- package/dist/components/InviteFormWeb.js.map +1 -0
- package/dist/components/PlacedItemToolbar.js +147 -0
- package/dist/components/PlacedItemToolbar.js.map +1 -0
- package/dist/components/ShareButtons.js +181 -0
- package/dist/components/ShareButtons.js.map +1 -0
- package/dist/components/VrtxContactsImport.js +234 -0
- package/dist/components/VrtxContactsImport.js.map +1 -0
- package/dist/components/VrtxEmailInvitations.js +341 -0
- package/dist/components/VrtxEmailInvitations.js.map +1 -0
- package/dist/components/VrtxFindFriends.js +400 -0
- package/dist/components/VrtxFindFriends.js.map +1 -0
- package/dist/components/VrtxHeading.js +58 -0
- package/dist/components/VrtxHeading.js.map +1 -0
- package/dist/components/VrtxIncomingInvitations.js +657 -0
- package/dist/components/VrtxIncomingInvitations.js.map +1 -0
- package/dist/components/VrtxInvitationSuggestions.js +506 -0
- package/dist/components/VrtxInvitationSuggestions.js.map +1 -0
- package/dist/components/VrtxInviteContacts.js +512 -0
- package/dist/components/VrtxInviteContacts.js.map +1 -0
- package/dist/components/VrtxOutgoingInvitations.js +572 -0
- package/dist/components/VrtxOutgoingInvitations.js.map +1 -0
- package/dist/components/VrtxSearchBox.js +487 -0
- package/dist/components/VrtxSearchBox.js.map +1 -0
- package/dist/components/VrtxSelect.js +27 -0
- package/dist/components/VrtxSelect.js.map +1 -0
- package/dist/components/VrtxShareOptions.js +435 -0
- package/dist/components/VrtxShareOptions.js.map +1 -0
- package/dist/components/VrtxSubmit.js +132 -0
- package/dist/components/VrtxSubmit.js.map +1 -0
- package/dist/components/VrtxText.js +146 -0
- package/dist/components/VrtxText.js.map +1 -0
- package/dist/constants/mockData.d.mts +7 -0
- package/dist/constants/mockData.d.ts +7 -0
- package/dist/constants/mockData.js +48 -0
- package/dist/constants/mockData.js.map +1 -0
- package/dist/constants/mockData.mjs +22 -0
- package/dist/constants/mockData.mjs.map +1 -0
- package/dist/context/VortexModulesContext.js +135 -0
- package/dist/context/VortexModulesContext.js.map +1 -0
- package/dist/hooks/useInvitationFormLogic.d.mts +2 -0
- package/dist/hooks/useInvitationFormLogic.d.ts +2 -0
- package/dist/hooks/useInvitationFormLogic.js +300 -0
- package/dist/hooks/useInvitationFormLogic.js.map +1 -0
- package/dist/hooks/useInvitationFormLogic.mjs +276 -0
- package/dist/hooks/useInvitationFormLogic.mjs.map +1 -0
- package/dist/hooks/usePrefetchWidgetConfiguration.js +117 -0
- package/dist/hooks/usePrefetchWidgetConfiguration.js.map +1 -0
- package/dist/hooks/useThemeStyles.js +41 -0
- package/dist/hooks/useThemeStyles.js.map +1 -0
- package/dist/hooks/useVortexInvite.js +732 -0
- package/dist/hooks/useVortexInvite.js.map +1 -0
- package/dist/index-web.d.mts +93 -0
- package/dist/index-web.d.ts +93 -0
- package/dist/index-web.js +7397 -0
- package/dist/index-web.js.map +1 -0
- package/dist/index-web.mjs +7445 -0
- package/dist/index-web.mjs.map +1 -0
- package/dist/index.d.mts +656 -0
- package/dist/index.d.ts +656 -0
- package/dist/index.js +10206 -0
- package/dist/index.js.map +1 -0
- package/dist/index.mjs +10244 -0
- package/dist/index.mjs.map +1 -0
- package/dist/types/VortexClient.d.ts +106 -0
- package/dist/types/VortexClient.d.ts.map +1 -0
- package/dist/types/VortexDeferredLinks.d.ts +73 -0
- package/dist/types/VortexDeferredLinks.d.ts.map +1 -0
- package/dist/types/clientInfo.d.ts +5 -0
- package/dist/types/clientInfo.d.ts.map +1 -0
- package/dist/types/components/ContactsPickerModal.d.ts +18 -0
- package/dist/types/components/ContactsPickerModal.d.ts.map +1 -0
- package/dist/types/components/InviteFormCore.d.ts +166 -0
- package/dist/types/components/InviteFormCore.d.ts.map +1 -0
- package/dist/types/components/InviteFormMobile.d.ts +42 -0
- package/dist/types/components/InviteFormMobile.d.ts.map +1 -0
- package/dist/types/components/InviteFormWeb.d.ts +87 -0
- package/dist/types/components/InviteFormWeb.d.ts.map +1 -0
- package/dist/types/components/PlacedItemToolbar.d.ts +16 -0
- package/dist/types/components/PlacedItemToolbar.d.ts.map +1 -0
- package/dist/types/components/ShareButtons.d.ts +29 -0
- package/dist/types/components/ShareButtons.d.ts.map +1 -0
- package/dist/types/components/VrtxContactsImport.d.ts +14 -0
- package/dist/types/components/VrtxContactsImport.d.ts.map +1 -0
- package/dist/types/components/VrtxEmailInvitations.d.ts +31 -0
- package/dist/types/components/VrtxEmailInvitations.d.ts.map +1 -0
- package/dist/types/components/VrtxFindFriends.d.ts +25 -0
- package/dist/types/components/VrtxFindFriends.d.ts.map +1 -0
- package/dist/types/components/VrtxHeading.d.ts +6 -0
- package/dist/types/components/VrtxHeading.d.ts.map +1 -0
- package/dist/types/components/VrtxIncomingInvitations.d.ts +27 -0
- package/dist/types/components/VrtxIncomingInvitations.d.ts.map +1 -0
- package/dist/types/components/VrtxInvitationSuggestions.d.ts +25 -0
- package/dist/types/components/VrtxInvitationSuggestions.d.ts.map +1 -0
- package/dist/types/components/VrtxInviteContacts.d.ts +24 -0
- package/dist/types/components/VrtxInviteContacts.d.ts.map +1 -0
- package/dist/types/components/VrtxOutgoingInvitations.d.ts +27 -0
- package/dist/types/components/VrtxOutgoingInvitations.d.ts.map +1 -0
- package/dist/types/components/VrtxSearchBox.d.ts +28 -0
- package/dist/types/components/VrtxSearchBox.d.ts.map +1 -0
- package/dist/types/components/VrtxSelect.d.ts +6 -0
- package/dist/types/components/VrtxSelect.d.ts.map +1 -0
- package/dist/types/components/VrtxShareOptions.d.ts +41 -0
- package/dist/types/components/VrtxShareOptions.d.ts.map +1 -0
- package/dist/types/components/VrtxSubmit.d.ts +18 -0
- package/dist/types/components/VrtxSubmit.d.ts.map +1 -0
- package/dist/types/components/VrtxText.d.ts +8 -0
- package/dist/types/components/VrtxText.d.ts.map +1 -0
- package/dist/types/constants/mockData.d.ts +4 -0
- package/dist/types/constants/mockData.d.ts.map +1 -0
- package/dist/types/context/VortexModulesContext.d.ts +238 -0
- package/dist/types/context/VortexModulesContext.d.ts.map +1 -0
- package/dist/types/findFriends.js +10 -0
- package/dist/types/findFriends.js.map +1 -0
- package/dist/types/hooks/useInvitationFormLogic.d.ts +55 -0
- package/dist/types/hooks/useInvitationFormLogic.d.ts.map +1 -0
- package/dist/types/hooks/usePrefetchWidgetConfiguration.d.ts +39 -0
- package/dist/types/hooks/usePrefetchWidgetConfiguration.d.ts.map +1 -0
- package/dist/types/hooks/useThemeStyles.d.ts +35 -0
- package/dist/types/hooks/useThemeStyles.d.ts.map +1 -0
- package/dist/types/hooks/useVortexInvite.d.ts +86 -0
- package/dist/types/hooks/useVortexInvite.d.ts.map +1 -0
- package/dist/types/index-web.d.ts +23 -0
- package/dist/types/index-web.d.ts.map +1 -0
- package/dist/types/index.d.ts +23 -0
- package/dist/types/index.d.ts.map +1 -0
- package/dist/types/invitations.js +13 -0
- package/dist/types/invitations.js.map +1 -0
- package/dist/types/inviteContacts.js +14 -0
- package/dist/types/inviteContacts.js.map +1 -0
- package/dist/types/platformOperations.js +3 -0
- package/dist/types/platformOperations.js.map +1 -0
- package/dist/types/searchBox.js +11 -0
- package/dist/types/searchBox.js.map +1 -0
- package/dist/types/types/findFriends.d.ts +101 -0
- package/dist/types/types/findFriends.d.ts.map +1 -0
- package/dist/types/types/invitations.d.ts +301 -0
- package/dist/types/types/invitations.d.ts.map +1 -0
- package/dist/types/types/inviteContacts.d.ts +86 -0
- package/dist/types/types/inviteContacts.d.ts.map +1 -0
- package/dist/types/types/platformOperations.d.ts +185 -0
- package/dist/types/types/platformOperations.d.ts.map +1 -0
- package/dist/types/types/searchBox.d.ts +69 -0
- package/dist/types/types/searchBox.d.ts.map +1 -0
- package/dist/types/types/unfurlConfig.d.ts +34 -0
- package/dist/types/types/unfurlConfig.d.ts.map +1 -0
- package/dist/types/unfurlConfig.js +21 -0
- package/dist/types/unfurlConfig.js.map +1 -0
- package/dist/types/utils/analytics.d.ts +54 -0
- package/dist/types/utils/analytics.d.ts.map +1 -0
- package/dist/types/utils/configCache.d.ts +34 -0
- package/dist/types/utils/configCache.d.ts.map +1 -0
- package/dist/types/utils/contactUtils.d.ts +9 -0
- package/dist/types/utils/contactUtils.d.ts.map +1 -0
- package/dist/types/utils/featureWarnings.d.ts +56 -0
- package/dist/types/utils/featureWarnings.d.ts.map +1 -0
- package/dist/types/utils/formUtils.d.ts +93 -0
- package/dist/types/utils/formUtils.d.ts.map +1 -0
- package/dist/types/utils/gradientUtils.d.ts +67 -0
- package/dist/types/utils/gradientUtils.d.ts.map +1 -0
- package/dist/types/utils/invitationEvents.d.ts +21 -0
- package/dist/types/utils/invitationEvents.d.ts.map +1 -0
- package/dist/types/utils/moduleLoaders.d.ts +115 -0
- package/dist/types/utils/moduleLoaders.d.ts.map +1 -0
- package/dist/types/utils/moduleLoaders.web.d.ts +73 -0
- package/dist/types/utils/moduleLoaders.web.d.ts.map +1 -0
- package/dist/types/utils/nameUtils.d.ts +15 -0
- package/dist/types/utils/nameUtils.d.ts.map +1 -0
- package/dist/types/utils/themeUtils.d.ts +38 -0
- package/dist/types/utils/themeUtils.d.ts.map +1 -0
- package/dist/types/vortexInvite.d.ts +165 -0
- package/dist/types/vortexInvite.d.ts.map +1 -0
- package/dist/useInvitationFormLogic-Ct73M19B.d.mts +242 -0
- package/dist/useInvitationFormLogic-Ct73M19B.d.ts +242 -0
- package/dist/utils/analytics.js +92 -0
- package/dist/utils/analytics.js.map +1 -0
- package/dist/utils/configCache.js +68 -0
- package/dist/utils/configCache.js.map +1 -0
- package/dist/utils/contactUtils.d.mts +12 -0
- package/dist/utils/contactUtils.d.ts +12 -0
- package/dist/utils/contactUtils.js +37 -0
- package/dist/utils/contactUtils.js.map +1 -0
- package/dist/utils/contactUtils.mjs +12 -0
- package/dist/utils/contactUtils.mjs.map +1 -0
- package/dist/utils/featureWarnings.js +214 -0
- package/dist/utils/featureWarnings.js.map +1 -0
- package/dist/utils/formUtils.js +284 -0
- package/dist/utils/formUtils.js.map +1 -0
- package/dist/utils/gradientUtils.js +120 -0
- package/dist/utils/gradientUtils.js.map +1 -0
- package/dist/utils/invitationEvents.js +45 -0
- package/dist/utils/invitationEvents.js.map +1 -0
- package/dist/utils/moduleLoaders.js +275 -0
- package/dist/utils/moduleLoaders.js.map +1 -0
- package/dist/utils/moduleLoaders.web.js +72 -0
- package/dist/utils/moduleLoaders.web.js.map +1 -0
- package/dist/utils/nameUtils.js +51 -0
- package/dist/utils/nameUtils.js.map +1 -0
- package/dist/utils/themeUtils.js +141 -0
- package/dist/utils/themeUtils.js.map +1 -0
- package/dist/vortexInvite.js +83 -0
- package/dist/vortexInvite.js.map +1 -0
- package/package.json +21 -56
|
@@ -0,0 +1,295 @@
|
|
|
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 __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
36
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
37
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
38
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
39
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
40
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
41
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
42
|
+
});
|
|
43
|
+
};
|
|
44
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
45
|
+
exports.InviteFormWeb = InviteFormWeb;
|
|
46
|
+
const react_1 = __importStar(require("react"));
|
|
47
|
+
const react_native_1 = require("react-native");
|
|
48
|
+
const InviteFormCore_1 = require("./InviteFormCore");
|
|
49
|
+
const mockData_1 = require("../constants/mockData");
|
|
50
|
+
const VortexModulesContext_1 = require("../context/VortexModulesContext");
|
|
51
|
+
// Import web-safe loaders that don't contain native require() statements
|
|
52
|
+
const webLoaders = __importStar(require("../utils/moduleLoaders.web"));
|
|
53
|
+
function InviteFormWeb({ renderIcon, fontFamily = '-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", sans-serif', widgetConfiguration, isEditMode = false, isDragging = false, onComponentSelect, onDrop, onSetDropTarget, onClearDropTarget, }) {
|
|
54
|
+
// Web QR code renderer - always points to vortexsoftware.com for preview
|
|
55
|
+
const renderQRCode = ({ value, size }) => {
|
|
56
|
+
try {
|
|
57
|
+
// Dynamic import to avoid hard dependency
|
|
58
|
+
const QRCodeWeb = require('react-qr-code').default;
|
|
59
|
+
return (<react_native_1.View style={{ padding: 10, backgroundColor: '#fff' }}>
|
|
60
|
+
<QRCodeWeb value="https://vortexsoftware.com" size={size} style={{ height: "auto", maxWidth: "100%", width: "100%" }}/>
|
|
61
|
+
</react_native_1.View>);
|
|
62
|
+
}
|
|
63
|
+
catch (error) {
|
|
64
|
+
console.warn('[Vortex Preview] react-qr-code not available:', error);
|
|
65
|
+
return (<react_native_1.View style={{ padding: 20, alignItems: 'center' }}>
|
|
66
|
+
<react_native_1.Text style={{ fontSize: 14, color: '#666', textAlign: 'center' }}>
|
|
67
|
+
QR Code preview not available
|
|
68
|
+
</react_native_1.Text>
|
|
69
|
+
</react_native_1.View>);
|
|
70
|
+
}
|
|
71
|
+
};
|
|
72
|
+
// Web-compatible platform operations - NO native dependencies
|
|
73
|
+
// Memoized to prevent re-fetching contacts on every render (e.g., hover events in edit mode)
|
|
74
|
+
const platformOperations = (0, react_1.useMemo)(() => ({
|
|
75
|
+
copyToClipboard: () => __awaiter(this, void 0, void 0, function* () {
|
|
76
|
+
var _a;
|
|
77
|
+
// Mock invitation link for preview
|
|
78
|
+
const mockInvitationLink = 'https://app.vortexsoftware.com/invite/preview-abc123';
|
|
79
|
+
if (typeof navigator !== 'undefined' && ((_a = navigator.clipboard) === null || _a === void 0 ? void 0 : _a.writeText)) {
|
|
80
|
+
yield navigator.clipboard.writeText(mockInvitationLink);
|
|
81
|
+
console.log('[Preview] Copied invitation link to clipboard:', mockInvitationLink);
|
|
82
|
+
}
|
|
83
|
+
else {
|
|
84
|
+
console.warn('[Preview] Clipboard not available, would copy:', mockInvitationLink);
|
|
85
|
+
}
|
|
86
|
+
}),
|
|
87
|
+
share: () => __awaiter(this, void 0, void 0, function* () {
|
|
88
|
+
// Mock invitation link and message for preview
|
|
89
|
+
const mockInvitationLink = 'https://app.vortexsoftware.com/invite/preview-abc123';
|
|
90
|
+
const mockMessage = `You're invited to join our team! ${mockInvitationLink}`;
|
|
91
|
+
if (typeof navigator !== 'undefined' && navigator.share) {
|
|
92
|
+
yield navigator.share({
|
|
93
|
+
title: 'Join our team',
|
|
94
|
+
text: mockMessage,
|
|
95
|
+
url: mockInvitationLink,
|
|
96
|
+
});
|
|
97
|
+
}
|
|
98
|
+
else {
|
|
99
|
+
console.log('[Preview] Share not available, would share:', {
|
|
100
|
+
title: 'Join our team',
|
|
101
|
+
text: mockMessage,
|
|
102
|
+
url: mockInvitationLink,
|
|
103
|
+
});
|
|
104
|
+
}
|
|
105
|
+
}),
|
|
106
|
+
close: () => {
|
|
107
|
+
console.log('Close (preview mode - no-op)');
|
|
108
|
+
},
|
|
109
|
+
triggerHaptic: (style) => __awaiter(this, void 0, void 0, function* () {
|
|
110
|
+
// No-op for web preview - haptics don't make sense on web
|
|
111
|
+
console.debug(`[Preview] Haptic feedback (${style}) - no-op on web`);
|
|
112
|
+
}),
|
|
113
|
+
fetchContacts: () => __awaiter(this, void 0, void 0, function* () {
|
|
114
|
+
// Always return mock data for consistent preview behavior
|
|
115
|
+
return mockData_1.MOCK_CONTACTS;
|
|
116
|
+
}),
|
|
117
|
+
invite: (email, contactName) => __awaiter(this, void 0, void 0, function* () {
|
|
118
|
+
// Simulate API delay for realistic preview behavior
|
|
119
|
+
yield new Promise((resolve) => setTimeout(resolve, 500));
|
|
120
|
+
console.log('[Preview] Would send invite to:', email, contactName ? `(${contactName})` : '');
|
|
121
|
+
}),
|
|
122
|
+
fetchGoogleContacts: () => __awaiter(this, void 0, void 0, function* () {
|
|
123
|
+
// Simulate API delay for realistic preview behavior
|
|
124
|
+
yield new Promise((resolve) => setTimeout(resolve, 800));
|
|
125
|
+
// Return mock Google contacts for consistent preview behavior
|
|
126
|
+
return [
|
|
127
|
+
{ id: 'google-1', name: 'Alice Johnson', email: 'alice.johnson@gmail.com' },
|
|
128
|
+
{ id: 'google-2', name: 'Bob Smith', email: 'bob.smith@gmail.com' },
|
|
129
|
+
{ id: 'google-3', name: 'Carol Davis', email: 'carol.davis@gmail.com' },
|
|
130
|
+
];
|
|
131
|
+
}),
|
|
132
|
+
shareViaEmail: () => __awaiter(this, void 0, void 0, function* () {
|
|
133
|
+
console.log('[Preview] Would open email composer');
|
|
134
|
+
}),
|
|
135
|
+
shareViaSms: () => __awaiter(this, void 0, void 0, function* () {
|
|
136
|
+
console.log('[Preview] Would open SMS composer');
|
|
137
|
+
}),
|
|
138
|
+
shareViaTwitter: () => __awaiter(this, void 0, void 0, function* () {
|
|
139
|
+
console.log('[Preview] Would share via X/Twitter');
|
|
140
|
+
}),
|
|
141
|
+
shareViaInstagram: () => __awaiter(this, void 0, void 0, function* () {
|
|
142
|
+
console.log('[Preview] Would share via Instagram');
|
|
143
|
+
}),
|
|
144
|
+
shareViaWhatsApp: () => __awaiter(this, void 0, void 0, function* () {
|
|
145
|
+
console.log('[Preview] Would share via WhatsApp');
|
|
146
|
+
}),
|
|
147
|
+
shareViaLine: () => __awaiter(this, void 0, void 0, function* () {
|
|
148
|
+
console.log('[Preview] Would share via Line');
|
|
149
|
+
}),
|
|
150
|
+
shareViaFacebookMessenger: () => __awaiter(this, void 0, void 0, function* () {
|
|
151
|
+
console.log('[Preview] Would share via Facebook Messenger');
|
|
152
|
+
}),
|
|
153
|
+
shareViaTelegram: () => __awaiter(this, void 0, void 0, function* () {
|
|
154
|
+
console.log('[Preview] Would share via Telegram');
|
|
155
|
+
}),
|
|
156
|
+
shareViaDiscord: () => __awaiter(this, void 0, void 0, function* () {
|
|
157
|
+
console.log('[Preview] Would share via Discord');
|
|
158
|
+
}),
|
|
159
|
+
showQrCode: () => __awaiter(this, void 0, void 0, function* () {
|
|
160
|
+
console.log('[Preview] Navigating to QR Code view');
|
|
161
|
+
// Navigation handled by InviteFormCore
|
|
162
|
+
}),
|
|
163
|
+
}), []);
|
|
164
|
+
// Container styles for web preview (no absolute positioning, flex layout)
|
|
165
|
+
const containerStyle = react_native_1.StyleSheet.create({
|
|
166
|
+
container: {
|
|
167
|
+
flex: 1,
|
|
168
|
+
backgroundColor: '#fff',
|
|
169
|
+
paddingTop: 8,
|
|
170
|
+
},
|
|
171
|
+
}).container;
|
|
172
|
+
// Mock contacts for preview
|
|
173
|
+
const mockContacts = (0, react_1.useMemo)(() => [
|
|
174
|
+
{
|
|
175
|
+
userId: 'user-2',
|
|
176
|
+
name: 'Bob Smith',
|
|
177
|
+
subtitle: '@bobsmith',
|
|
178
|
+
},
|
|
179
|
+
{
|
|
180
|
+
userId: 'user-4',
|
|
181
|
+
name: 'David Wilson',
|
|
182
|
+
subtitle: '@dwilson',
|
|
183
|
+
},
|
|
184
|
+
], []);
|
|
185
|
+
// Mock Find Friends configuration for preview
|
|
186
|
+
const mockFindFriendsConfig = (0, react_1.useMemo)(() => ({
|
|
187
|
+
contacts: mockContacts,
|
|
188
|
+
onConnect: (contact) => {
|
|
189
|
+
console.log('[Preview] Would connect with:', contact.name, contact.userId);
|
|
190
|
+
return true; // Allow invitation to be created
|
|
191
|
+
},
|
|
192
|
+
connectButtonText: 'Connect',
|
|
193
|
+
emptyStateMessage: 'No contacts found',
|
|
194
|
+
}), [mockContacts]);
|
|
195
|
+
// Mock incoming invitations for preview
|
|
196
|
+
const mockIncomingInvitations = (0, react_1.useMemo)(() => [
|
|
197
|
+
{ id: 'incoming-1', name: 'Sarah Connor', subtitle: '@sarahconnor', avatarUrl: undefined },
|
|
198
|
+
], []);
|
|
199
|
+
// Mock Incoming Invitations configuration for preview
|
|
200
|
+
const mockIncomingInvitationsConfig = (0, react_1.useMemo)(() => ({
|
|
201
|
+
invitations: mockIncomingInvitations,
|
|
202
|
+
onAccept: (invitation) => {
|
|
203
|
+
console.log('[Preview] Would accept invitation from:', invitation.name);
|
|
204
|
+
},
|
|
205
|
+
onDelete: (invitation) => {
|
|
206
|
+
console.log('[Preview] Would delete invitation from:', invitation.name);
|
|
207
|
+
},
|
|
208
|
+
acceptButtonText: 'Accept',
|
|
209
|
+
deleteButtonText: 'Delete',
|
|
210
|
+
emptyStateMessage: 'No incoming invitations',
|
|
211
|
+
}), [mockIncomingInvitations]);
|
|
212
|
+
// Mock outgoing invitations for preview
|
|
213
|
+
const mockOutgoingInvitations = (0, react_1.useMemo)(() => [
|
|
214
|
+
{ id: 'outgoing-1', name: 'Mike Johnson', subtitle: '@mikejohnson', avatarUrl: undefined },
|
|
215
|
+
], []);
|
|
216
|
+
// Mock Outgoing Invitations configuration for preview
|
|
217
|
+
const mockOutgoingInvitationsConfig = (0, react_1.useMemo)(() => ({
|
|
218
|
+
onCancel: (invitation) => {
|
|
219
|
+
console.log('[Preview] Would cancel invitation to:', invitation.name);
|
|
220
|
+
},
|
|
221
|
+
_mockInvitations: mockOutgoingInvitations,
|
|
222
|
+
}), [mockOutgoingInvitations]);
|
|
223
|
+
// Mock invitation suggestions for preview
|
|
224
|
+
const mockInvitationSuggestions = (0, react_1.useMemo)(() => [
|
|
225
|
+
{ id: 'suggestion-1', name: 'Alex Turner', subtitle: '@alexturner', avatarUrl: undefined },
|
|
226
|
+
], []);
|
|
227
|
+
// Mock Invitation Suggestions configuration for preview
|
|
228
|
+
const mockInvitationSuggestionsConfig = (0, react_1.useMemo)(() => ({
|
|
229
|
+
suggestions: mockInvitationSuggestions,
|
|
230
|
+
onInvite: (suggestion) => {
|
|
231
|
+
console.log('[Preview] Would invite:', suggestion.name);
|
|
232
|
+
},
|
|
233
|
+
onDismiss: (suggestion) => {
|
|
234
|
+
console.log('[Preview] Would dismiss suggestion:', suggestion.name);
|
|
235
|
+
},
|
|
236
|
+
inviteButtonText: 'Invite',
|
|
237
|
+
emptyStateMessage: 'No suggestions',
|
|
238
|
+
}), [mockInvitationSuggestions]);
|
|
239
|
+
// Mock contacts for Invite Contacts preview
|
|
240
|
+
const mockInviteContacts = (0, react_1.useMemo)(() => [
|
|
241
|
+
{ id: 'contact-1', name: 'Alice Johnson', phoneNumber: '+1 (555) 123-4567' },
|
|
242
|
+
{ id: 'contact-2', name: 'Bob Smith', phoneNumber: '+1 (555) 234-5678' },
|
|
243
|
+
{ id: 'contact-3', name: 'Carol Davis', phoneNumber: '+1 (555) 345-6789' },
|
|
244
|
+
], []);
|
|
245
|
+
// Mock Invite Contacts configuration for preview
|
|
246
|
+
const mockInviteContactsConfig = (0, react_1.useMemo)(() => ({
|
|
247
|
+
contacts: mockInviteContacts,
|
|
248
|
+
onInvite: (contact, shortLink) => {
|
|
249
|
+
console.log('[Preview] Would invite via SMS:', contact.name, contact.phoneNumber, 'with link:', shortLink);
|
|
250
|
+
},
|
|
251
|
+
onInvitationCreated: (contact, shortLink) => {
|
|
252
|
+
console.log('[Preview] Invitation created for:', contact.name, 'link:', shortLink);
|
|
253
|
+
},
|
|
254
|
+
inviteYourContactsText: 'Invite your contacts',
|
|
255
|
+
inviteButtonText: 'Invite',
|
|
256
|
+
emptyStateMessage: 'No contacts to invite',
|
|
257
|
+
}), [mockInviteContacts]);
|
|
258
|
+
// Hard-coded contacts for search box partial text matching
|
|
259
|
+
const searchBoxContacts = (0, react_1.useMemo)(() => [
|
|
260
|
+
{ userId: 'search-1', name: 'Bob Smith', subtitle: '@bobsmith' },
|
|
261
|
+
{ userId: 'search-2', name: 'David Wilson', subtitle: '@dwilson' },
|
|
262
|
+
{ userId: 'search-3', name: 'Alice Johnson', subtitle: '@alicej' },
|
|
263
|
+
{ userId: 'search-4', name: 'Sarah Connor', subtitle: '@sarahconnor' },
|
|
264
|
+
{ userId: 'search-5', name: 'Mike Davis', subtitle: '@mikedavis' },
|
|
265
|
+
], []);
|
|
266
|
+
// Mock Search Box configuration for preview
|
|
267
|
+
const mockSearchBoxConfig = (0, react_1.useMemo)(() => ({
|
|
268
|
+
onSearch: (query) => __awaiter(this, void 0, void 0, function* () {
|
|
269
|
+
console.log('[Preview] Searching for:', query);
|
|
270
|
+
const q = query.toLowerCase();
|
|
271
|
+
return searchBoxContacts.filter((c) => c.name.toLowerCase().includes(q) ||
|
|
272
|
+
(c.subtitle && c.subtitle.toLowerCase().includes(q)));
|
|
273
|
+
}),
|
|
274
|
+
onConnect: (contact) => {
|
|
275
|
+
console.log('[Preview] Would connect with:', contact.name, contact.userId);
|
|
276
|
+
return true;
|
|
277
|
+
},
|
|
278
|
+
connectButtonText: 'Connect',
|
|
279
|
+
noResultsMessage: 'No results found',
|
|
280
|
+
}), []);
|
|
281
|
+
// Create modules config with web-safe loaders
|
|
282
|
+
const modulesConfig = (0, react_1.useMemo)(() => ({
|
|
283
|
+
// No module names needed for web - we use CSS gradients directly
|
|
284
|
+
loaders: {
|
|
285
|
+
loadGradientComponent: webLoaders.loadGradientComponent,
|
|
286
|
+
parseCSSLinearGradient: webLoaders.parseCSSLinearGradient,
|
|
287
|
+
angleToGradientPoints: webLoaders.angleToGradientPoints,
|
|
288
|
+
parseGradientFirstColor: webLoaders.parseGradientFirstColor,
|
|
289
|
+
},
|
|
290
|
+
}), []);
|
|
291
|
+
return (<VortexModulesContext_1.VortexModulesProvider config={modulesConfig}>
|
|
292
|
+
<InviteFormCore_1.InviteFormCore renderIcon={renderIcon} renderQRCode={renderQRCode} platformOperations={platformOperations} fontFamily={fontFamily} containerStyle={containerStyle} widgetConfiguration={widgetConfiguration} isEditMode={isEditMode} isDragging={isDragging} onComponentSelect={onComponentSelect} onDrop={onDrop} onSetDropTarget={onSetDropTarget} onClearDropTarget={onClearDropTarget} findFriendsConfig={mockFindFriendsConfig} incomingInvitationsConfig={mockIncomingInvitationsConfig} outgoingInvitationsConfig={mockOutgoingInvitationsConfig} invitationSuggestionsConfig={mockInvitationSuggestionsConfig} inviteContactsConfig={mockInviteContactsConfig} searchBoxConfig={mockSearchBoxConfig} apiUrl="https://client-api.vortexsoftware.com" jwt="preview-mock-jwt"/>
|
|
293
|
+
</VortexModulesContext_1.VortexModulesProvider>);
|
|
294
|
+
}
|
|
295
|
+
//# sourceMappingURL=InviteFormWeb.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"InviteFormWeb.js","sourceRoot":"","sources":["../../src/components/InviteFormWeb.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAoGA,sCAgTC;AApZD,+CAAuC;AACvC,+CAAsD;AACtD,qDAA0E;AAM1E,oDAAsD;AACtD,0EAA4F;AAC5F,yEAAyE;AACzE,uEAAyD;AAyFzD,SAAgB,aAAa,CAAC,EAC5B,UAAU,EACV,UAAU,GAAG,qFAAqF,EAClG,mBAAmB,EACnB,UAAU,GAAG,KAAK,EAClB,UAAU,GAAG,KAAK,EAClB,iBAAiB,EACjB,MAAM,EACN,eAAe,EACf,iBAAiB,GACU;IAC3B,yEAAyE;IACzE,MAAM,YAAY,GAAG,CAAC,EAAE,KAAK,EAAE,IAAI,EAAmC,EAAE,EAAE;QACxE,IAAI,CAAC;YACH,0CAA0C;YAC1C,MAAM,SAAS,GAAG,OAAO,CAAC,eAAe,CAAC,CAAC,OAAO,CAAC;YACnD,OAAO,CACL,CAAC,mBAAI,CAAC,KAAK,CAAC,CAAC,EAAE,OAAO,EAAE,EAAE,EAAE,eAAe,EAAE,MAAM,EAAE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MAAM,CAAC,CACf,eAAe,CAAC,CAAC,eAAe,CAAC,CACjC,iBAAiB,CAAC,CAAC,iBAAiB,CAAC,CACrC,iBAAiB,CAAC,CAAC,qBAAqB,CAAC,CACzC,yBAAyB,CAAC,CAAC,6BAA6B,CAAC,CACzD,yBAAyB,CAAC,CAAC,6BAA6B,CAAC,CACzD,2BAA2B,CAAC,CAAC,+BAA+B,CAAC,CAC7D,oBAAoB,CAAC,CAAC,wBAAwB,CAAC,CAC/C,eAAe,CAAC,CAAC,mBAAmB,CAAC,CACrC,MAAM,CAAC,uCAAuC,CAC9C,GAAG,CAAC,kBAAkB,EAE1B;IAAA,EAAE,4CAAqB,CAAC,CACzB,CAAC;AACJ,CAAC","sourcesContent":["import React, { useMemo } from 'react';\nimport { StyleSheet, View, Text } from 'react-native';\nimport { InviteFormCore, type IconRendererProps } from './InviteFormCore';\nimport { PlatformOperations } from '../types/platformOperations';\nimport { FindFriendsConfig, FindFriendsContact } from '../types/findFriends';\nimport { IncomingInvitationsConfig, OutgoingInvitationsConfig, InvitationSuggestionsConfig, InvitationItem } from '../types/invitations';\nimport { InviteContactsConfig, InviteContactsContact } from '../types/inviteContacts';\nimport { SearchBoxConfig } from '../types/searchBox';\nimport { MOCK_CONTACTS } from '../constants/mockData';\nimport { VortexModulesProvider, type ModuleLoaders } from '../context/VortexModulesContext';\n// Import web-safe loaders that don't contain native require() statements\nimport * as webLoaders from '../utils/moduleLoaders.web';\n\n/**\n * InviteFormWeb - Web-compatible version of InviteFormMobile\n *\n * This component is designed for web preview environments where native dependencies\n * like react-native-vector-icons are not available. It accepts a custom icon renderer\n * that should use FontAwesome5-compatible icon libraries to match the mobile experience.\n *\n * The mobile InviteFormMobile uses FontAwesome5 icons. To ensure consistency between\n * preview and mobile, use FontAwesome5 equivalents in your web icon library.\n *\n * @example\n * // Using with React Icons (FontAwesome5)\n * import { FaTimes, FaArrowLeft, FaLink, FaShareAlt, FaAddressBook, FaEnvelope, FaGoogle } from 'react-icons/fa';\n *\n * const iconComponents = {\n * 'close': FaTimes,\n * 'arrow-back': FaArrowLeft,\n * 'link': FaLink,\n * 'share': FaShareAlt,\n * 'import-contacts': FaAddressBook,\n * 'email': FaEnvelope,\n * 'google': FaGoogle,\n * };\n *\n * const renderIcon = ({ name, size, color }) => {\n * const IconComponent = iconComponents[name];\n * if (!IconComponent) return null;\n * return <IconComponent style={{ fontSize: size, color }} />;\n * };\n *\n * <InviteFormWeb renderIcon={renderIcon} />\n */\n\nexport interface ComponentInfo {\n id: string;\n type: string; // 'button', 'text', 'input', etc.\n element: HTMLElement | null;\n styles: React.CSSProperties;\n content?: string;\n}\n\nexport interface InvitationFormPreviewProps {\n /**\n * Function to render icons - allows web-compatible icon libraries to be used\n * Must handle all icon names and should use FontAwesome5 equivalents for consistency:\n * 'close' (times), 'arrow-back' (arrow-left), 'link', 'share' (share-alt),\n * 'import-contacts' (address-book), 'email' (envelope), 'google'\n */\n renderIcon: (props: IconRendererProps) => React.ReactNode;\n\n /**\n * Optional font family override\n */\n fontFamily?: string;\n\n /**\n * Widget configuration containing component settings\n */\n widgetConfiguration?: any;\n\n /**\n * Whether edit mode is enabled (for hover highlighting)\n */\n isEditMode?: boolean;\n\n /**\n * Whether a drag is currently active (to show drop zones)\n */\n isDragging?: boolean;\n\n /**\n * Callback when a component is selected in edit mode\n */\n onComponentSelect?: (componentInfo: ComponentInfo) => void;\n\n /**\n * Callback when a palette item is dropped onto a component\n */\n onDrop?: (componentInfo: ComponentInfo, droppedItem: any) => void;\n\n /**\n * Callbacks for setting/clearing drop targets (for Redux integration)\n */\n onSetDropTarget?: (target: { elementId: string; elementType: string; position: string; rowId?: string; insertionIndex?: number }) => void;\n onClearDropTarget?: () => void;\n}\n\nexport function InviteFormWeb({\n renderIcon,\n fontFamily = '-apple-system, BlinkMacSystemFont, \"Segoe UI\", Roboto, \"Helvetica Neue\", sans-serif',\n widgetConfiguration,\n isEditMode = false,\n isDragging = false,\n onComponentSelect,\n onDrop,\n onSetDropTarget,\n onClearDropTarget,\n}: InvitationFormPreviewProps) {\n // Web QR code renderer - always points to vortexsoftware.com for preview\n const renderQRCode = ({ value, size }: { value: string; size: number }) => {\n try {\n // Dynamic import to avoid hard dependency\n const QRCodeWeb = require('react-qr-code').default;\n return (\n <View style={{ padding: 10, backgroundColor: '#fff' }}>\n <QRCodeWeb\n value=\"https://vortexsoftware.com\"\n size={size}\n style={{ height: \"auto\", maxWidth: \"100%\", width: \"100%\" }}\n />\n </View>\n );\n } catch (error) {\n console.warn('[Vortex Preview] react-qr-code not available:', error);\n return (\n <View style={{ padding: 20, alignItems: 'center' }}>\n <Text style={{ fontSize: 14, color: '#666', textAlign: 'center' }}>\n QR Code preview not available\n </Text>\n </View>\n );\n }\n };\n\n // Web-compatible platform operations - NO native dependencies\n // Memoized to prevent re-fetching contacts on every render (e.g., hover events in edit mode)\n const platformOperations: PlatformOperations = useMemo(() => ({\n copyToClipboard: async () => {\n // Mock invitation link for preview\n const mockInvitationLink = 'https://app.vortexsoftware.com/invite/preview-abc123';\n if (typeof navigator !== 'undefined' && navigator.clipboard?.writeText) {\n await navigator.clipboard.writeText(mockInvitationLink);\n console.log('[Preview] Copied invitation link to clipboard:', mockInvitationLink);\n } else {\n console.warn('[Preview] Clipboard not available, would copy:', mockInvitationLink);\n }\n },\n share: async () => {\n // Mock invitation link and message for preview\n const mockInvitationLink = 'https://app.vortexsoftware.com/invite/preview-abc123';\n const mockMessage = `You're invited to join our team! ${mockInvitationLink}`;\n\n if (typeof navigator !== 'undefined' && (navigator as any).share) {\n await (navigator as any).share({\n title: 'Join our team',\n text: mockMessage,\n url: mockInvitationLink,\n });\n } else {\n console.log('[Preview] Share not available, would share:', {\n title: 'Join our team',\n text: mockMessage,\n url: mockInvitationLink,\n });\n }\n },\n close: () => {\n console.log('Close (preview mode - no-op)');\n },\n triggerHaptic: async (style: 'light' | 'medium' | 'heavy') => {\n // No-op for web preview - haptics don't make sense on web\n console.debug(`[Preview] Haptic feedback (${style}) - no-op on web`);\n },\n fetchContacts: async () => {\n // Always return mock data for consistent preview behavior\n return MOCK_CONTACTS;\n },\n invite: async (email: string, contactName?: string) => {\n // Simulate API delay for realistic preview behavior\n await new Promise((resolve) => setTimeout(resolve, 500));\n console.log('[Preview] Would send invite to:', email, contactName ? `(${contactName})` : '');\n },\n fetchGoogleContacts: async () => {\n // Simulate API delay for realistic preview behavior\n await new Promise((resolve) => setTimeout(resolve, 800));\n // Return mock Google contacts for consistent preview behavior\n return [\n { id: 'google-1', name: 'Alice Johnson', email: 'alice.johnson@gmail.com' },\n { id: 'google-2', name: 'Bob Smith', email: 'bob.smith@gmail.com' },\n { id: 'google-3', name: 'Carol Davis', email: 'carol.davis@gmail.com' },\n ];\n },\n shareViaEmail: async () => {\n console.log('[Preview] Would open email composer');\n },\n shareViaSms: async () => {\n console.log('[Preview] Would open SMS composer');\n },\n shareViaTwitter: async () => {\n console.log('[Preview] Would share via X/Twitter');\n },\n shareViaInstagram: async () => {\n console.log('[Preview] Would share via Instagram');\n },\n shareViaWhatsApp: async () => {\n console.log('[Preview] Would share via WhatsApp');\n },\n shareViaLine: async () => {\n console.log('[Preview] Would share via Line');\n },\n shareViaFacebookMessenger: async () => {\n console.log('[Preview] Would share via Facebook Messenger');\n },\n shareViaTelegram: async () => {\n console.log('[Preview] Would share via Telegram');\n },\n shareViaDiscord: async () => {\n console.log('[Preview] Would share via Discord');\n },\n showQrCode: async () => {\n console.log('[Preview] Navigating to QR Code view');\n // Navigation handled by InviteFormCore\n },\n }), []);\n\n // Container styles for web preview (no absolute positioning, flex layout)\n const containerStyle = StyleSheet.create({\n container: {\n flex: 1,\n backgroundColor: '#fff',\n paddingTop: 8,\n },\n }).container;\n\n // Mock contacts for preview\n const mockContacts: FindFriendsContact[] = useMemo(\n () => [\n {\n userId: 'user-2',\n name: 'Bob Smith',\n subtitle: '@bobsmith',\n },\n {\n userId: 'user-4',\n name: 'David Wilson',\n subtitle: '@dwilson',\n },\n ],\n []\n );\n\n // Mock Find Friends configuration for preview\n const mockFindFriendsConfig: FindFriendsConfig = useMemo(() => ({\n contacts: mockContacts,\n onConnect: (contact) => {\n console.log('[Preview] Would connect with:', contact.name, contact.userId);\n return true; // Allow invitation to be created\n },\n connectButtonText: 'Connect',\n emptyStateMessage: 'No contacts found',\n }), [mockContacts]);\n\n // Mock incoming invitations for preview\n const mockIncomingInvitations: InvitationItem[] = useMemo(() => [\n { id: 'incoming-1', name: 'Sarah Connor', subtitle: '@sarahconnor', avatarUrl: undefined },\n ], []);\n\n // Mock Incoming Invitations configuration for preview\n const mockIncomingInvitationsConfig: IncomingInvitationsConfig = useMemo(() => ({\n invitations: mockIncomingInvitations,\n onAccept: (invitation) => {\n console.log('[Preview] Would accept invitation from:', invitation.name);\n },\n onDelete: (invitation) => {\n console.log('[Preview] Would delete invitation from:', invitation.name);\n },\n acceptButtonText: 'Accept',\n deleteButtonText: 'Delete',\n emptyStateMessage: 'No incoming invitations',\n }), [mockIncomingInvitations]);\n\n // Mock outgoing invitations for preview\n const mockOutgoingInvitations: InvitationItem[] = useMemo(() => [\n { id: 'outgoing-1', name: 'Mike Johnson', subtitle: '@mikejohnson', avatarUrl: undefined },\n ], []);\n\n // Mock Outgoing Invitations configuration for preview\n const mockOutgoingInvitationsConfig: OutgoingInvitationsConfig = useMemo(() => ({\n onCancel: (invitation) => {\n console.log('[Preview] Would cancel invitation to:', invitation.name);\n },\n _mockInvitations: mockOutgoingInvitations,\n }), [mockOutgoingInvitations]);\n\n // Mock invitation suggestions for preview\n const mockInvitationSuggestions: InvitationItem[] = useMemo(() => [\n { id: 'suggestion-1', name: 'Alex Turner', subtitle: '@alexturner', avatarUrl: undefined },\n ], []);\n\n // Mock Invitation Suggestions configuration for preview\n const mockInvitationSuggestionsConfig: InvitationSuggestionsConfig = useMemo(() => ({\n suggestions: mockInvitationSuggestions,\n onInvite: (suggestion) => {\n console.log('[Preview] Would invite:', suggestion.name);\n },\n onDismiss: (suggestion) => {\n console.log('[Preview] Would dismiss suggestion:', suggestion.name);\n },\n inviteButtonText: 'Invite',\n emptyStateMessage: 'No suggestions',\n }), [mockInvitationSuggestions]);\n\n // Mock contacts for Invite Contacts preview\n const mockInviteContacts: InviteContactsContact[] = useMemo(() => [\n { id: 'contact-1', name: 'Alice Johnson', phoneNumber: '+1 (555) 123-4567' },\n { id: 'contact-2', name: 'Bob Smith', phoneNumber: '+1 (555) 234-5678' },\n { id: 'contact-3', name: 'Carol Davis', phoneNumber: '+1 (555) 345-6789' },\n ], []);\n\n // Mock Invite Contacts configuration for preview\n const mockInviteContactsConfig: InviteContactsConfig = useMemo(() => ({\n contacts: mockInviteContacts,\n onInvite: (contact, shortLink) => {\n console.log('[Preview] Would invite via SMS:', contact.name, contact.phoneNumber, 'with link:', shortLink);\n },\n onInvitationCreated: (contact, shortLink) => {\n console.log('[Preview] Invitation created for:', contact.name, 'link:', shortLink);\n },\n inviteYourContactsText: 'Invite your contacts',\n inviteButtonText: 'Invite',\n emptyStateMessage: 'No contacts to invite',\n }), [mockInviteContacts]);\n\n // Hard-coded contacts for search box partial text matching\n const searchBoxContacts: FindFriendsContact[] = useMemo(() => [\n { userId: 'search-1', name: 'Bob Smith', subtitle: '@bobsmith' },\n { userId: 'search-2', name: 'David Wilson', subtitle: '@dwilson' },\n { userId: 'search-3', name: 'Alice Johnson', subtitle: '@alicej' },\n { userId: 'search-4', name: 'Sarah Connor', subtitle: '@sarahconnor' },\n { userId: 'search-5', name: 'Mike Davis', subtitle: '@mikedavis' },\n ], []);\n\n // Mock Search Box configuration for preview\n const mockSearchBoxConfig: SearchBoxConfig = useMemo(() => ({\n onSearch: async (query) => {\n console.log('[Preview] Searching for:', query);\n const q = query.toLowerCase();\n return searchBoxContacts.filter(\n (c) =>\n c.name.toLowerCase().includes(q) ||\n (c.subtitle && c.subtitle.toLowerCase().includes(q))\n );\n },\n onConnect: (contact) => {\n console.log('[Preview] Would connect with:', contact.name, contact.userId);\n return true;\n },\n connectButtonText: 'Connect',\n noResultsMessage: 'No results found',\n }), []);\n\n // Create modules config with web-safe loaders\n const modulesConfig = useMemo(\n () => ({\n // No module names needed for web - we use CSS gradients directly\n loaders: {\n loadGradientComponent: webLoaders.loadGradientComponent,\n parseCSSLinearGradient: webLoaders.parseCSSLinearGradient,\n angleToGradientPoints: webLoaders.angleToGradientPoints,\n parseGradientFirstColor: webLoaders.parseGradientFirstColor,\n } as ModuleLoaders,\n }),\n []\n );\n\n return (\n <VortexModulesProvider config={modulesConfig}>\n <InviteFormCore\n renderIcon={renderIcon}\n renderQRCode={renderQRCode}\n platformOperations={platformOperations}\n fontFamily={fontFamily}\n containerStyle={containerStyle}\n widgetConfiguration={widgetConfiguration}\n isEditMode={isEditMode}\n isDragging={isDragging}\n onComponentSelect={onComponentSelect}\n onDrop={onDrop}\n onSetDropTarget={onSetDropTarget}\n onClearDropTarget={onClearDropTarget}\n findFriendsConfig={mockFindFriendsConfig}\n incomingInvitationsConfig={mockIncomingInvitationsConfig}\n outgoingInvitationsConfig={mockOutgoingInvitationsConfig}\n invitationSuggestionsConfig={mockInvitationSuggestionsConfig}\n inviteContactsConfig={mockInviteContactsConfig}\n searchBoxConfig={mockSearchBoxConfig}\n apiUrl=\"https://client-api.vortexsoftware.com\"\n jwt=\"preview-mock-jwt\"\n />\n </VortexModulesProvider>\n );\n}\n"]}
|
|
@@ -0,0 +1,147 @@
|
|
|
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.usePlacedItemToolbar = void 0;
|
|
7
|
+
const react_1 = __importDefault(require("react"));
|
|
8
|
+
const react_native_1 = require("react-native");
|
|
9
|
+
const isWeb = react_native_1.Platform.OS === 'web';
|
|
10
|
+
/**
|
|
11
|
+
* PlacedItemToolbar - A portal-based toolbar that appears on the right side of selected elements
|
|
12
|
+
* Displays a delete button for removing the element from the page builder
|
|
13
|
+
*/
|
|
14
|
+
const usePlacedItemToolbar = ({ wrapperRef, isSelected, componentId, componentType, isRow, nodeSubtype, }) => {
|
|
15
|
+
const toolbarRef = react_1.default.useRef(null);
|
|
16
|
+
react_1.default.useEffect(() => {
|
|
17
|
+
if (!isWeb || !isSelected) {
|
|
18
|
+
// Clean up toolbar if it exists
|
|
19
|
+
if (toolbarRef.current && toolbarRef.current.parentNode) {
|
|
20
|
+
toolbarRef.current.parentNode.removeChild(toolbarRef.current);
|
|
21
|
+
toolbarRef.current = null;
|
|
22
|
+
}
|
|
23
|
+
return;
|
|
24
|
+
}
|
|
25
|
+
if (!wrapperRef.current)
|
|
26
|
+
return;
|
|
27
|
+
// Find the container using the same logic as margin detectors
|
|
28
|
+
let scrollContainer = null;
|
|
29
|
+
if (isRow) {
|
|
30
|
+
// For rows, find the outermost container with padding
|
|
31
|
+
scrollContainer = wrapperRef.current.parentElement;
|
|
32
|
+
const rowWidth = wrapperRef.current.getBoundingClientRect().width;
|
|
33
|
+
let attempts = 0;
|
|
34
|
+
while (scrollContainer && attempts < 15) {
|
|
35
|
+
const containerWidth = scrollContainer.getBoundingClientRect().width;
|
|
36
|
+
if (containerWidth > rowWidth + 20) {
|
|
37
|
+
break;
|
|
38
|
+
}
|
|
39
|
+
scrollContainer = scrollContainer.parentElement;
|
|
40
|
+
attempts++;
|
|
41
|
+
}
|
|
42
|
+
if (!scrollContainer || scrollContainer.getBoundingClientRect().width <= rowWidth) {
|
|
43
|
+
scrollContainer = wrapperRef.current.parentElement;
|
|
44
|
+
while (scrollContainer === null || scrollContainer === void 0 ? void 0 : scrollContainer.parentElement) {
|
|
45
|
+
const parent = scrollContainer.parentElement;
|
|
46
|
+
if (parent.getBoundingClientRect().width > scrollContainer.getBoundingClientRect().width) {
|
|
47
|
+
scrollContainer = parent;
|
|
48
|
+
}
|
|
49
|
+
else {
|
|
50
|
+
break;
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
// Create toolbar element if it doesn't exist
|
|
56
|
+
if (!toolbarRef.current) {
|
|
57
|
+
toolbarRef.current = document.createElement('div');
|
|
58
|
+
document.body.appendChild(toolbarRef.current);
|
|
59
|
+
}
|
|
60
|
+
const handleDelete = (e) => {
|
|
61
|
+
e.stopPropagation();
|
|
62
|
+
e.preventDefault();
|
|
63
|
+
const deleteEvent = new CustomEvent('vortex-delete-component', {
|
|
64
|
+
detail: { id: componentId, type: componentType, subtype: nodeSubtype },
|
|
65
|
+
bubbles: true,
|
|
66
|
+
});
|
|
67
|
+
document.dispatchEvent(deleteEvent);
|
|
68
|
+
};
|
|
69
|
+
const updateToolbarPosition = () => {
|
|
70
|
+
if (!wrapperRef.current || !toolbarRef.current)
|
|
71
|
+
return;
|
|
72
|
+
const rect = wrapperRef.current.getBoundingClientRect();
|
|
73
|
+
const toolbar = toolbarRef.current;
|
|
74
|
+
// For rows on web, position at extreme right of container
|
|
75
|
+
let leftPos = rect.right + 3;
|
|
76
|
+
if (isRow && scrollContainer) {
|
|
77
|
+
const containerRect = scrollContainer.getBoundingClientRect();
|
|
78
|
+
// Rows...
|
|
79
|
+
leftPos = containerRect.right + 6;
|
|
80
|
+
}
|
|
81
|
+
// Update styles
|
|
82
|
+
Object.assign(toolbar.style, {
|
|
83
|
+
position: 'fixed',
|
|
84
|
+
left: `${leftPos}px`,
|
|
85
|
+
top: `${rect.top + rect.height / 2}px`,
|
|
86
|
+
transform: 'translateY(-50%)',
|
|
87
|
+
backgroundColor: '#fff',
|
|
88
|
+
borderRadius: '4px',
|
|
89
|
+
border: '1px solid #1166c2',
|
|
90
|
+
boxShadow: '0px 3px 5px rgba(0, 0, 0, 0.2)',
|
|
91
|
+
display: 'flex',
|
|
92
|
+
flexDirection: 'column',
|
|
93
|
+
zIndex: '1200',
|
|
94
|
+
pointerEvents: 'auto',
|
|
95
|
+
});
|
|
96
|
+
// Create delete button if it doesn't exist
|
|
97
|
+
if (toolbar.children.length === 0) {
|
|
98
|
+
const button = document.createElement('button');
|
|
99
|
+
button.title = 'Delete';
|
|
100
|
+
button.innerHTML = `
|
|
101
|
+
<svg focusable="false" aria-hidden="true" viewBox="0 0 24 24" style="width: 24px; height: 24px; fill: currentColor;">
|
|
102
|
+
<path d="M6 19c0 1.1.9 2 2 2h8c1.1 0 2-.9 2-2V7H6zM8 9h8v10H8zm7.5-5-1-1h-5l-1 1H5v2h14V4z"></path>
|
|
103
|
+
</svg>
|
|
104
|
+
`;
|
|
105
|
+
Object.assign(button.style, {
|
|
106
|
+
display: 'flex',
|
|
107
|
+
alignItems: 'center',
|
|
108
|
+
justifyContent: 'center',
|
|
109
|
+
width: '40px',
|
|
110
|
+
height: '40px',
|
|
111
|
+
border: 'none',
|
|
112
|
+
background: 'transparent',
|
|
113
|
+
cursor: 'pointer',
|
|
114
|
+
color: '#c20a0a',
|
|
115
|
+
fontSize: '20px',
|
|
116
|
+
transition: 'background-color 0.2s',
|
|
117
|
+
});
|
|
118
|
+
button.addEventListener('mouseenter', () => {
|
|
119
|
+
button.style.backgroundColor = 'rgba(194, 10, 10, 0.1)';
|
|
120
|
+
});
|
|
121
|
+
button.addEventListener('mouseleave', () => {
|
|
122
|
+
button.style.backgroundColor = 'transparent';
|
|
123
|
+
});
|
|
124
|
+
button.addEventListener('mousedown', (e) => {
|
|
125
|
+
e.stopPropagation();
|
|
126
|
+
e.preventDefault();
|
|
127
|
+
});
|
|
128
|
+
button.addEventListener('click', handleDelete);
|
|
129
|
+
toolbar.appendChild(button);
|
|
130
|
+
}
|
|
131
|
+
};
|
|
132
|
+
updateToolbarPosition();
|
|
133
|
+
window.addEventListener('scroll', updateToolbarPosition, true);
|
|
134
|
+
window.addEventListener('resize', updateToolbarPosition);
|
|
135
|
+
return () => {
|
|
136
|
+
window.removeEventListener('scroll', updateToolbarPosition, true);
|
|
137
|
+
window.removeEventListener('resize', updateToolbarPosition);
|
|
138
|
+
if (toolbarRef.current && toolbarRef.current.parentNode) {
|
|
139
|
+
toolbarRef.current.parentNode.removeChild(toolbarRef.current);
|
|
140
|
+
toolbarRef.current = null;
|
|
141
|
+
}
|
|
142
|
+
};
|
|
143
|
+
}, [isSelected, componentId, componentType, isRow, nodeSubtype, wrapperRef]);
|
|
144
|
+
return null;
|
|
145
|
+
};
|
|
146
|
+
exports.usePlacedItemToolbar = usePlacedItemToolbar;
|
|
147
|
+
//# sourceMappingURL=PlacedItemToolbar.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"PlacedItemToolbar.js","sourceRoot":"","sources":["../../src/components/PlacedItemToolbar.tsx"],"names":[],"mappings":";;;;;;AAAA,kDAA0B;AAC1B,+CAAwC;AAExC,MAAM,KAAK,GAAG,uBAAQ,CAAC,EAAE,KAAK,KAAK,CAAC;AAWpC;;;GAGG;AACI,MAAM,oBAAoB,GAAG,CAAC,EACnC,UAAU,EACV,UAAU,EACV,WAAW,EACX,aAAa,EACb,KAAK,EACL,WAAW,GACY,EAAE,EAAE;IAC3B,MAAM,UAAU,GAAG,eAAK,CAAC,MAAM,CAAwB,IAAI,CAAC,CAAC;IAE7D,eAAK,CAAC,SAAS,CAAC,GAAG,EAAE;QACnB,IAAI,CAAC,KAAK,IAAI,CAAC,UAAU,EAAE,CAAC;YAC1B,gCAAgC;YAChC,IAAI,UAAU,CAAC,OAAO,IAAI,UAAU,CAAC,OAAO,CAAC,UAAU,EAAE,CAAC;gBACxD,UAAU,CAAC,OAAO,CAAC,UAAU,CAAC,WAAW,CAAC,UAAU,CAAC,OAAO,CAAC,CAAC;gBAC9D,UAAU,CAAC,OAAO,GAAG,IAAI,CAAC;YAC5B,CAAC;YACD,OAAO;QACT,CAAC;QAED,IAAI,CAAC,UAAU,CAAC,OAAO;YAAE,OAAO;QAEhC,8DAA8D;QAC9D,IAAI,eAAe,GAAuB,IAAI,CAAC;QAC/C,IAAI,KAAK,EAAE,CAAC;YACV,sDAAsD;YACtD,eAAe,GAAG,UAAU,CAAC,OAA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AAE,CAAC;QAExB,MAAM,CAAC,gBAAgB,CAAC,QAAQ,EAAE,qBAAqB,EAAE,IAAI,CAAC,CAAC;QAC/D,MAAM,CAAC,gBAAgB,CAAC,QAAQ,EAAE,qBAAqB,CAAC,CAAC;QAEzD,OAAO,GAAG,EAAE;YACV,MAAM,CAAC,mBAAmB,CAAC,QAAQ,EAAE,qBAAqB,EAAE,IAAI,CAAC,CAAC;YAClE,MAAM,CAAC,mBAAmB,CAAC,QAAQ,EAAE,qBAAqB,CAAC,CAAC;YAC5D,IAAI,UAAU,CAAC,OAAO,IAAI,UAAU,CAAC,OAAO,CAAC,UAAU,EAAE,CAAC;gBACxD,UAAU,CAAC,OAAO,CAAC,UAAU,CAAC,WAAW,CAAC,UAAU,CAAC,OAAO,CAAC,CAAC;gBAC9D,UAAU,CAAC,OAAO,GAAG,IAAI,CAAC;YAC5B,CAAC;QACH,CAAC,CAAC;IACJ,CAAC,EAAE,CAAC,UAAU,EAAE,WAAW,EAAE,aAAa,EAAE,KAAK,EAAE,WAAW,EAAE,UAAU,CAAC,CAAC,CAAC;IAE7E,OAAO,IAAI,CAAC;AACd,CAAC,CAAC;AA1JW,QAAA,oBAAoB,wBA0J/B","sourcesContent":["import React from 'react';\nimport { Platform } from 'react-native';\n\nconst isWeb = Platform.OS === 'web';\n\ninterface PlacedItemToolbarProps {\n wrapperRef: React.RefObject<HTMLDivElement | null>;\n isSelected: boolean;\n componentId: string;\n componentType: string;\n isRow: boolean;\n nodeSubtype?: string;\n}\n\n/**\n * PlacedItemToolbar - A portal-based toolbar that appears on the right side of selected elements\n * Displays a delete button for removing the element from the page builder\n */\nexport const usePlacedItemToolbar = ({\n wrapperRef,\n isSelected,\n componentId,\n componentType,\n isRow,\n nodeSubtype,\n}: PlacedItemToolbarProps) => {\n const toolbarRef = React.useRef<HTMLDivElement | null>(null);\n\n React.useEffect(() => {\n if (!isWeb || !isSelected) {\n // Clean up toolbar if it exists\n if (toolbarRef.current && toolbarRef.current.parentNode) {\n toolbarRef.current.parentNode.removeChild(toolbarRef.current);\n toolbarRef.current = null;\n }\n return;\n }\n\n if (!wrapperRef.current) return;\n\n // Find the container using the same logic as margin detectors\n let scrollContainer: HTMLElement | null = null;\n if (isRow) {\n // For rows, find the outermost container with padding\n scrollContainer = wrapperRef.current.parentElement;\n const rowWidth = wrapperRef.current.getBoundingClientRect().width;\n let attempts = 0;\n while (scrollContainer && attempts < 15) {\n const containerWidth = scrollContainer.getBoundingClientRect().width;\n if (containerWidth > rowWidth + 20) {\n break;\n }\n scrollContainer = scrollContainer.parentElement;\n attempts++;\n }\n if (!scrollContainer || scrollContainer.getBoundingClientRect().width <= rowWidth) {\n scrollContainer = wrapperRef.current.parentElement;\n while (scrollContainer?.parentElement) {\n const parent = scrollContainer.parentElement;\n if (\n parent.getBoundingClientRect().width > scrollContainer.getBoundingClientRect().width\n ) {\n scrollContainer = parent;\n } else {\n break;\n }\n }\n }\n }\n\n // Create toolbar element if it doesn't exist\n if (!toolbarRef.current) {\n toolbarRef.current = document.createElement('div');\n document.body.appendChild(toolbarRef.current);\n }\n\n const handleDelete = (e: MouseEvent) => {\n e.stopPropagation();\n e.preventDefault();\n\n const deleteEvent = new CustomEvent('vortex-delete-component', {\n detail: { id: componentId, type: componentType, subtype: nodeSubtype },\n bubbles: true,\n });\n document.dispatchEvent(deleteEvent);\n };\n\n const updateToolbarPosition = () => {\n if (!wrapperRef.current || !toolbarRef.current) return;\n\n const rect = wrapperRef.current.getBoundingClientRect();\n const toolbar = toolbarRef.current;\n\n // For rows on web, position at extreme right of container\n let leftPos = rect.right + 3;\n if (isRow && scrollContainer) {\n const containerRect = scrollContainer.getBoundingClientRect();\n // Rows...\n leftPos = containerRect.right + 6;\n }\n\n // Update styles\n Object.assign(toolbar.style, {\n position: 'fixed',\n left: `${leftPos}px`,\n top: `${rect.top + rect.height / 2}px`,\n transform: 'translateY(-50%)',\n backgroundColor: '#fff',\n borderRadius: '4px',\n border: '1px solid #1166c2',\n boxShadow: '0px 3px 5px rgba(0, 0, 0, 0.2)',\n display: 'flex',\n flexDirection: 'column',\n zIndex: '1200',\n pointerEvents: 'auto',\n });\n\n // Create delete button if it doesn't exist\n if (toolbar.children.length === 0) {\n const button = document.createElement('button');\n button.title = 'Delete';\n button.innerHTML = `\n <svg focusable=\"false\" aria-hidden=\"true\" viewBox=\"0 0 24 24\" style=\"width: 24px; height: 24px; fill: currentColor;\">\n <path d=\"M6 19c0 1.1.9 2 2 2h8c1.1 0 2-.9 2-2V7H6zM8 9h8v10H8zm7.5-5-1-1h-5l-1 1H5v2h14V4z\"></path>\n </svg>\n `;\n Object.assign(button.style, {\n display: 'flex',\n alignItems: 'center',\n justifyContent: 'center',\n width: '40px',\n height: '40px',\n border: 'none',\n background: 'transparent',\n cursor: 'pointer',\n color: '#c20a0a',\n fontSize: '20px',\n transition: 'background-color 0.2s',\n });\n\n button.addEventListener('mouseenter', () => {\n button.style.backgroundColor = 'rgba(194, 10, 10, 0.1)';\n });\n button.addEventListener('mouseleave', () => {\n button.style.backgroundColor = 'transparent';\n });\n button.addEventListener('mousedown', (e) => {\n e.stopPropagation();\n e.preventDefault();\n });\n button.addEventListener('click', handleDelete);\n\n toolbar.appendChild(button);\n }\n };\n\n updateToolbarPosition();\n\n window.addEventListener('scroll', updateToolbarPosition, true);\n window.addEventListener('resize', updateToolbarPosition);\n\n return () => {\n window.removeEventListener('scroll', updateToolbarPosition, true);\n window.removeEventListener('resize', updateToolbarPosition);\n if (toolbarRef.current && toolbarRef.current.parentNode) {\n toolbarRef.current.parentNode.removeChild(toolbarRef.current);\n toolbarRef.current = null;\n }\n };\n }, [isSelected, componentId, componentType, isRow, nodeSubtype, wrapperRef]);\n\n return null;\n};\n"]}
|