@onairosofficial/onairos-capacitor 0.1.0 → 0.1.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/LICENSE +194 -10
- package/README.md +182 -25
- package/dist/onairos.capacitor.esm.js +1 -0
- package/dist/onairos.capacitor.esm.turbopack.js +1 -0
- package/onairos.d.ts +656 -0
- package/package.json +186 -38
- package/src/OnairosReconnectButton.jsx +272 -0
- package/src/RSA.jsx +57 -0
- package/src/assets/NewLogo.png +0 -0
- package/src/assets/OnairosNewLogo.png +0 -0
- package/src/assets/chatgpt-icon.png +0 -0
- package/src/assets/fire-horse.png +0 -0
- package/src/assets/fire-horse.transparent.png +0 -0
- package/src/assets/latest-firehorse.png +0 -0
- package/src/assets/perplexity.png +0 -0
- package/src/assets/persona.png +0 -0
- package/src/assets/persona1.png +0 -0
- package/src/assets/persona2.png +0 -0
- package/src/assets/persona3.png +0 -0
- package/src/assets/persona4.png +0 -0
- package/src/assets/persona5.png +0 -0
- package/src/capacitorConnectorCatalog.js +38 -0
- package/src/capacitorOAuthConfig.js +52 -0
- package/src/chatgptHostedImport/index.js +303 -0
- package/src/components/AuthButtons.jsx +48 -0
- package/src/components/ConnectChatGPTModal.jsx +666 -0
- package/src/components/ConnectClaudeModal.jsx +610 -0
- package/src/components/ConnectGeminiModal.jsx +639 -0
- package/src/components/ConnectGrokModal.jsx +701 -0
- package/src/components/ConnectPerplexityModal.jsx +726 -0
- package/src/components/DataExplainerScreen.jsx +349 -0
- package/src/components/DataRequest.js +885 -0
- package/src/components/DataRequest.jsx +1055 -0
- package/src/components/EmailAuth.js +1871 -0
- package/src/components/EmailAuth.jsx +2062 -0
- package/src/components/ExtensionInstallPrompt.jsx +142 -0
- package/src/components/GoogleButton.js +133 -0
- package/src/components/LLMConnectorManager.jsx +201 -0
- package/src/components/LoadingPage.jsx +19 -0
- package/src/components/LoadingScreen.jsx +81 -0
- package/src/components/LunarBirthdate.jsx +96 -0
- package/src/components/LunarLoadingPage.jsx +251 -0
- package/src/components/Notification.jsx +21 -0
- package/src/components/OnairosAppButton.jsx +85 -0
- package/src/components/OnairosSSO.jsx +645 -0
- package/src/components/OnairosTrigger.jsx +61 -0
- package/src/components/PerplexityLogo.jsx +43 -0
- package/src/components/PinSetup.js +200 -0
- package/src/components/PinSetup.jsx +228 -0
- package/src/components/SDK_PIN_INTEGRATION_REQUIRED_CHANGES.md +526 -0
- package/src/components/SdkErrorBoundary.jsx +36 -0
- package/src/components/SecuritySetup.js +81 -0
- package/src/components/SessionUserBar.jsx +83 -0
- package/src/components/SignUp.js +123 -0
- package/src/components/TestTelegramButton.js +53 -0
- package/src/components/TrainingComponent.jsx +200 -0
- package/src/components/TrainingScreen.jsx +897 -0
- package/src/components/UniversalOnboarding.js +306 -0
- package/src/components/UniversalOnboarding.jsx +4837 -0
- package/src/components/ValentineLoadingPage.jsx +502 -0
- package/src/components/ValentineModeSelector.jsx +162 -0
- package/src/components/WelcomeScreen.jsx +435 -0
- package/src/components/WrappedLoadingPage.jsx +205 -0
- package/src/components/connectors/ChatGPTConnector.js +348 -0
- package/src/components/connectors/ChatGPTConnector.jsx +348 -0
- package/src/components/connectors/ClaudeConnector.js +44 -0
- package/src/components/connectors/ClaudeConnector.jsx +44 -0
- package/src/components/connectors/GeminiConnector.js +170 -0
- package/src/components/connectors/GeminiConnector.jsx +170 -0
- package/src/components/connectors/GmailConnector.js +148 -0
- package/src/components/connectors/GmailConnector.jsx +148 -0
- package/src/components/connectors/GrokConnector.js +16 -0
- package/src/components/connectors/GrokConnector.jsx +16 -0
- package/src/components/connectors/HingeConnector.js +419 -0
- package/src/components/connectors/HingeConnector.jsx +419 -0
- package/src/components/connectors/InstagramDataConnector.js +726 -0
- package/src/components/connectors/InstagramDataConnector.jsx +726 -0
- package/src/components/connectors/LinkedInConnector.js +4 -0
- package/src/components/connectors/LinkedInConnector.jsx +296 -0
- package/src/components/connectors/PerplexityConnector.jsx +16 -0
- package/src/components/connectors/PinterestConnector.js +208 -0
- package/src/components/connectors/PinterestConnector.jsx +208 -0
- package/src/components/connectors/README.md +292 -0
- package/src/components/connectors/RedditConnector.js +229 -0
- package/src/components/connectors/RedditConnector.jsx +229 -0
- package/src/components/connectors/SephoraConnector.js +482 -0
- package/src/components/connectors/SephoraConnector.jsx +482 -0
- package/src/components/connectors/TikTokConnector.jsx +430 -0
- package/src/components/connectors/YoutubeConnector.js +361 -0
- package/src/components/connectors/YoutubeConnector.jsx +361 -0
- package/src/components/connectors/index.js +50 -0
- package/src/components/icons.jsx +46 -0
- package/src/components/icons.tsx +21 -0
- package/src/components/ui/PageLayout.jsx +1255 -0
- package/src/components/ui/PrimaryButton.jsx +162 -0
- package/src/components/ui/button.jsx +49 -0
- package/src/components/ui/card.jsx +61 -0
- package/src/components/ui/checkbox.jsx +33 -0
- package/src/components/ui/label.jsx +29 -0
- package/src/components/utils/UpdateConnections.js +45 -0
- package/src/components/utils/oauthHelper.js +97 -0
- package/src/config/api-config.js +138 -0
- package/src/deepLink.jsx +38 -0
- package/src/getPin.js +26 -0
- package/src/icons/Avatar.png +0 -0
- package/src/icons/Sentiment.png +0 -0
- package/src/icons/Trait.png +0 -0
- package/src/iframe/DataRequestPage.jsx +285 -0
- package/src/iframe/OnairosButtonIntegration.md +148 -0
- package/src/iframe/components/Box.jsx +56 -0
- package/src/iframe/components/IndividualConnection.jsx +88 -0
- package/src/iframe/dataRequestHandler.js +714 -0
- package/src/iframe/data_request_iframe.html +27 -0
- package/src/iframe/data_request_page.js +47 -0
- package/src/iframe/icons/Avatar.png +1 -0
- package/src/iframe/icons/Avatar2.png +1 -0
- package/src/iframe/icons/Sentiment.png +1 -0
- package/src/iframe/icons/Trait.png +1 -0
- package/src/iframe/icons/onairos_logo.png +0 -0
- package/src/iframe/utils/api.js +57 -0
- package/src/index.js +274 -0
- package/src/laravel/OnairosVue.vue +410 -0
- package/src/laravel/blade-helpers.js +320 -0
- package/src/laravel/vite-plugin.js +179 -0
- package/src/mobile/MobileDataRequestPage.jsx +233 -0
- package/src/mobile/components/MobileBox.jsx +71 -0
- package/src/mobile/components/MobileIndividualConnection.jsx +51 -0
- package/src/mobile/shims/browser-apis.js +78 -0
- package/src/mobile/shims/lucide-shim.js +85 -0
- package/src/newUI/EMAIL_VERIFICATION_API_SCHEMA.md +268 -0
- package/src/newUI/PlatformConnectorsStep.tsx +435 -0
- package/src/newUI/PrimaryButton.tsx +213 -0
- package/src/newUI/SignInStep.tsx +194 -0
- package/src/newUI/VerificationStep.tsx +133 -0
- package/src/newUI/WelcomeScreen.tsx +311 -0
- package/src/newUI/services/connectedAccountsService.js +129 -0
- package/src/onairos.capacitor.jsx +16 -0
- package/src/onairos.core.jsx +133 -0
- package/src/onairos.jsx +14 -0
- package/src/onairos.native.jsx +15 -0
- package/src/onairosButton.jsx +9000 -0
- package/src/overlay/CheckBox.jsx +114 -0
- package/src/overlay/IndividualConnection copy.js +86 -0
- package/src/overlay/IndividualConnection.js +191 -0
- package/src/overlay/IndividualConnectionNew.jsx +157 -0
- package/src/overlay/box.js +84 -0
- package/src/overlay/overlay.js +437 -0
- package/src/styles/onairos-scoped-preflight.css +97 -0
- package/src/styles/sdkCssRegistry.js +20 -0
- package/src/styles/styleLoaderInsertShadow.js +69 -0
- package/src/styles/tailwind.capacitor.css +395 -0
- package/src/styles/tailwind.css +395 -0
- package/src/theme/colors.js +40 -0
- package/src/utils/apiKeyValidation.js +341 -0
- package/src/utils/apiResponseLogger.js +316 -0
- package/src/utils/authHeaders.js +275 -0
- package/src/utils/biometrics.js +26 -0
- package/src/utils/bookmarkletUtils.js +28 -0
- package/src/utils/capacitorDetection.js +278 -0
- package/src/utils/capacitorLLMHelper.js +352 -0
- package/src/utils/capacitorPlugins.js +366 -0
- package/src/utils/crossDomainSSO.js +587 -0
- package/src/utils/deepLinking.js +27 -0
- package/src/utils/devLogger.js +46 -0
- package/src/utils/extensionDetection.js +418 -0
- package/src/utils/extractMemory.js +277 -0
- package/src/utils/framerBrandingOverrides.js +40 -0
- package/src/utils/googleWebClientId.js +55 -0
- package/src/utils/overlayHandler.js +224 -0
- package/src/utils/platformDisconnect.js +309 -0
- package/src/utils/pollTrainingStatus.js +200 -0
- package/src/utils/rawMemoriesAccess.js +211 -0
- package/src/utils/resolveBackendAppId.js +47 -0
- package/src/utils/responseFormatter.js +140 -0
- package/src/utils/sdkDebugStorage.js +113 -0
- package/src/utils/sdkInitialization.js +645 -0
- package/src/utils/sessionManager.js +1258 -0
- package/src/utils/startBackgroundTraining.js +100 -0
- package/src/utils/userDataFormatter.js +222 -0
- package/index.d.ts +0 -1
- package/index.js +0 -1
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
import React, { useState, useEffect } from 'react';
|
|
2
|
+
import PropTypes from 'prop-types';
|
|
3
|
+
|
|
4
|
+
function Box({
|
|
5
|
+
active,
|
|
6
|
+
onSelectionChange,
|
|
7
|
+
changeGranted,
|
|
8
|
+
setSelected,
|
|
9
|
+
number,
|
|
10
|
+
type,
|
|
11
|
+
title
|
|
12
|
+
}) {
|
|
13
|
+
const [isChecked, setIsChecked] = useState(false);
|
|
14
|
+
|
|
15
|
+
const handleCheckboxChange = (newState) => {
|
|
16
|
+
setIsChecked(newState);
|
|
17
|
+
console.log("This data request is active:", active);
|
|
18
|
+
console.log("With new Checked state now being:", newState);
|
|
19
|
+
|
|
20
|
+
// Update the counter
|
|
21
|
+
if (newState) {
|
|
22
|
+
changeGranted(1);
|
|
23
|
+
} else {
|
|
24
|
+
changeGranted(-1);
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
// Call parent callback if provided
|
|
28
|
+
if (onSelectionChange) {
|
|
29
|
+
onSelectionChange(newState);
|
|
30
|
+
}
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
return (
|
|
34
|
+
<div className="group">
|
|
35
|
+
<div className="relative">
|
|
36
|
+
{/* Custom styled checkbox with clear visual feedback */}
|
|
37
|
+
<label className="flex items-center cursor-pointer">
|
|
38
|
+
<div className="relative">
|
|
39
|
+
<input
|
|
40
|
+
type="checkbox"
|
|
41
|
+
checked={isChecked}
|
|
42
|
+
disabled={!active}
|
|
43
|
+
onChange={(e) => handleCheckboxChange(e.target.checked)}
|
|
44
|
+
className="sr-only" // Hide default checkbox
|
|
45
|
+
/>
|
|
46
|
+
|
|
47
|
+
{/* Custom checkbox appearance */}
|
|
48
|
+
<div className={`
|
|
49
|
+
w-6 h-6 border-2 rounded-md flex items-center justify-center transition-all duration-200
|
|
50
|
+
${!active
|
|
51
|
+
? 'border-gray-300 bg-gray-100 cursor-not-allowed opacity-50'
|
|
52
|
+
: isChecked
|
|
53
|
+
? 'border-green-500 bg-green-500 shadow-md transform scale-105'
|
|
54
|
+
: 'border-gray-400 bg-white hover:border-green-400 hover:bg-green-50'
|
|
55
|
+
}
|
|
56
|
+
`}>
|
|
57
|
+
{/* Checkmark icon */}
|
|
58
|
+
{isChecked && (
|
|
59
|
+
<svg
|
|
60
|
+
className="w-4 h-4 text-white animate-pulse"
|
|
61
|
+
fill="currentColor"
|
|
62
|
+
viewBox="0 0 20 20"
|
|
63
|
+
>
|
|
64
|
+
<path
|
|
65
|
+
fillRule="evenodd"
|
|
66
|
+
d="M16.707 5.293a1 1 0 010 1.414l-8 8a1 1 0 01-1.414 0l-4-4a1 1 0 011.414-1.414L8 12.586l7.293-7.293a1 1 0 011.414 0z"
|
|
67
|
+
clipRule="evenodd"
|
|
68
|
+
/>
|
|
69
|
+
</svg>
|
|
70
|
+
)}
|
|
71
|
+
</div>
|
|
72
|
+
</div>
|
|
73
|
+
|
|
74
|
+
{/* Selection status text */}
|
|
75
|
+
<span className={`ml-3 text-sm font-medium transition-colors duration-200 ${
|
|
76
|
+
!active
|
|
77
|
+
? 'text-gray-400'
|
|
78
|
+
: isChecked
|
|
79
|
+
? 'text-green-600 font-semibold'
|
|
80
|
+
: 'text-gray-700'
|
|
81
|
+
}`}>
|
|
82
|
+
{!active
|
|
83
|
+
? 'Not available'
|
|
84
|
+
: isChecked
|
|
85
|
+
? '✓ Selected'
|
|
86
|
+
: 'Click to select'
|
|
87
|
+
}
|
|
88
|
+
</span>
|
|
89
|
+
</label>
|
|
90
|
+
|
|
91
|
+
{/* Selection indicator badge */}
|
|
92
|
+
{isChecked && active && (
|
|
93
|
+
<div className="absolute -top-2 -right-2 w-4 h-4 bg-green-500 rounded-full flex items-center justify-center animate-bounce">
|
|
94
|
+
<svg className="w-2 h-2 text-white" fill="currentColor" viewBox="0 0 20 20">
|
|
95
|
+
<path fillRule="evenodd" d="M16.707 5.293a1 1 0 010 1.414l-8 8a1 1 0 01-1.414 0l-4-4a1 1 0 011.414-1.414L8 12.586l7.293-7.293a1 1 0 011.414 0z" clipRule="evenodd" />
|
|
96
|
+
</svg>
|
|
97
|
+
</div>
|
|
98
|
+
)}
|
|
99
|
+
</div>
|
|
100
|
+
</div>
|
|
101
|
+
);
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
Box.propTypes = {
|
|
105
|
+
active: PropTypes.bool.isRequired,
|
|
106
|
+
onSelectionChange: PropTypes.func,
|
|
107
|
+
changeGranted: PropTypes.func.isRequired,
|
|
108
|
+
setSelected: PropTypes.func,
|
|
109
|
+
number: PropTypes.number,
|
|
110
|
+
type: PropTypes.string,
|
|
111
|
+
title: PropTypes.string.isRequired
|
|
112
|
+
};
|
|
113
|
+
|
|
114
|
+
export default Box;
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
import React, { useState, useRef, useEffect } from 'react';
|
|
2
|
+
// import Box from './CheckBox';
|
|
3
|
+
// import traitsIcon;
|
|
4
|
+
// import interestIcon;
|
|
5
|
+
// import Sentiment from '../icons/Sentiment.png';
|
|
6
|
+
// import Avatar from '../icons/Avatar.png';
|
|
7
|
+
// import Avatar2 from '../icons/Avatar2.png';
|
|
8
|
+
// import Trait from '../icons/Trait.png';
|
|
9
|
+
import PropTypes from 'prop-types';
|
|
10
|
+
|
|
11
|
+
export default function IndividualConnection(props) {
|
|
12
|
+
const [isChecked, setIsChecked] = useState(false);
|
|
13
|
+
useEffect(() => {
|
|
14
|
+
if (isChecked) {
|
|
15
|
+
props.changeGranted(1);
|
|
16
|
+
} else {
|
|
17
|
+
props.changeGranted(-1);
|
|
18
|
+
}
|
|
19
|
+
}, [isChecked]);
|
|
20
|
+
const handleCheckboxChange = (newState) => {
|
|
21
|
+
setIsChecked(newState);
|
|
22
|
+
console.log("Following has been clicked :", props.title)
|
|
23
|
+
console.log("With new Checked state now being: ", newState)
|
|
24
|
+
console.log("Current number of selection: ", (props.number + 1))
|
|
25
|
+
// onSelectionChange(type);
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
return (
|
|
29
|
+
<div className="bg-white rounded-lg p-4 shadow border border-gray-200">
|
|
30
|
+
<div className="flex items-center justify-between">
|
|
31
|
+
<div className="flex items-center space-x-4">
|
|
32
|
+
<div className="group">
|
|
33
|
+
<div>
|
|
34
|
+
<input
|
|
35
|
+
disabled={!props.active}
|
|
36
|
+
type="checkbox"
|
|
37
|
+
checked={isChecked}
|
|
38
|
+
onChange={(e) => {
|
|
39
|
+
// setIsChecked(e.target.checked);
|
|
40
|
+
|
|
41
|
+
handleCheckboxChange(e.target.checked);
|
|
42
|
+
}}
|
|
43
|
+
/>
|
|
44
|
+
</div>
|
|
45
|
+
</div>
|
|
46
|
+
</div>
|
|
47
|
+
|
|
48
|
+
<div className="flex items-center">
|
|
49
|
+
{/* {props.title === "Traits" ? (
|
|
50
|
+
// Image to represent Traits
|
|
51
|
+
<img src={Trait} alt="Traits Icon" className="w-6 h-6 mr-2" />
|
|
52
|
+
) :
|
|
53
|
+
props.title === "Avatar" ? (
|
|
54
|
+
// Image to represent Traits
|
|
55
|
+
<img src={Avatar2} alt="Avatar Icon" className="w-8 h-8 mr-2" />
|
|
56
|
+
) :
|
|
57
|
+
(
|
|
58
|
+
// Image to represent Interest
|
|
59
|
+
<img src={Sentiment} alt="Interest Icon" className="w-6 h-6 mr-2" />
|
|
60
|
+
)} */}
|
|
61
|
+
{/* <p className="text-sm font-medium text-gray-900 dark:text-gray-300">
|
|
62
|
+
Access your Onairos {Insight}
|
|
63
|
+
</p> */}
|
|
64
|
+
</div>
|
|
65
|
+
{props.descriptions && (props.title !== "Avatar") && (
|
|
66
|
+
<p className="text-sm font-medium text-gray-900 dark:text-gray-300">Intent: {props.descriptions}</p>
|
|
67
|
+
)}
|
|
68
|
+
{props.rewards && (
|
|
69
|
+
<p className="text-sm font-medium text-gray-900 dark:text-gray-300">Rewards: {props.rewards}</p>
|
|
70
|
+
)}
|
|
71
|
+
</div>
|
|
72
|
+
</div>
|
|
73
|
+
);
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
IndividualConnection.propTypes = {
|
|
77
|
+
active: PropTypes.bool.isRequired,
|
|
78
|
+
title: PropTypes.string.isRequired,
|
|
79
|
+
id: PropTypes.any.isRequired,
|
|
80
|
+
number: PropTypes.number.isRequired,
|
|
81
|
+
descriptions: PropTypes.string,
|
|
82
|
+
rewards: PropTypes.string,
|
|
83
|
+
size: PropTypes.string.isRequired,
|
|
84
|
+
changeGranted: PropTypes.func.isRequired,
|
|
85
|
+
onSelectionChange: PropTypes.func.isRequired
|
|
86
|
+
};
|
|
@@ -0,0 +1,191 @@
|
|
|
1
|
+
import React, { useState } from 'react';
|
|
2
|
+
import PropTypes from 'prop-types';
|
|
3
|
+
|
|
4
|
+
export default function IndividualConnection({
|
|
5
|
+
active,
|
|
6
|
+
title,
|
|
7
|
+
id,
|
|
8
|
+
number,
|
|
9
|
+
descriptions,
|
|
10
|
+
rewards,
|
|
11
|
+
size,
|
|
12
|
+
isChecked,
|
|
13
|
+
onCheckboxChange,
|
|
14
|
+
}) {
|
|
15
|
+
return (
|
|
16
|
+
<div className={`relative p-4 sm:p-6 rounded-lg overflow-hidden mb-4 transition-all duration-300 border-2 ${
|
|
17
|
+
!active
|
|
18
|
+
? 'bg-gray-50 border-gray-200 opacity-60'
|
|
19
|
+
: isChecked
|
|
20
|
+
? 'bg-green-50 border-green-400 shadow-lg transform scale-[1.02] ring-2 ring-green-200'
|
|
21
|
+
: 'bg-white border-gray-300 hover:border-blue-300 hover:shadow-md'
|
|
22
|
+
}`}>
|
|
23
|
+
|
|
24
|
+
{/* Selection Status Indicator */}
|
|
25
|
+
{isChecked && active && (
|
|
26
|
+
<div className="absolute top-2 right-2 w-8 h-8 bg-green-500 rounded-full flex items-center justify-center animate-pulse shadow-lg">
|
|
27
|
+
<svg className="w-5 h-5 text-white" fill="currentColor" viewBox="0 0 20 20">
|
|
28
|
+
<path fillRule="evenodd" d="M16.707 5.293a1 1 0 010 1.414l-8 8a1 1 0 01-1.414 0l-4-4a1 1 0 011.414-1.414L8 12.586l7.293-7.293a1 1 0 011.414 0z" clipRule="evenodd" />
|
|
29
|
+
</svg>
|
|
30
|
+
</div>
|
|
31
|
+
)}
|
|
32
|
+
|
|
33
|
+
<div className="relative">
|
|
34
|
+
{/* Header with title and status */}
|
|
35
|
+
<div className="flex items-center justify-between mb-4">
|
|
36
|
+
<div className="flex items-center space-x-4">
|
|
37
|
+
{/* Data type icon */}
|
|
38
|
+
<div className={`w-12 h-12 rounded-full flex items-center justify-center text-2xl transition-all duration-300 ${
|
|
39
|
+
!active
|
|
40
|
+
? 'bg-gray-200 text-gray-400'
|
|
41
|
+
: isChecked
|
|
42
|
+
? 'bg-green-500 text-white shadow-lg'
|
|
43
|
+
: 'bg-blue-500 text-white'
|
|
44
|
+
}`}>
|
|
45
|
+
{title === "Avatar" ? "👤" :
|
|
46
|
+
title === "Traits" ? "🧠" :
|
|
47
|
+
title === "Personality" ? "🎭" : "📊"}
|
|
48
|
+
</div>
|
|
49
|
+
|
|
50
|
+
<div>
|
|
51
|
+
<h3 className={`text-xl font-bold ${
|
|
52
|
+
!active ? 'text-gray-400' : isChecked ? 'text-green-700' : 'text-gray-800'
|
|
53
|
+
}`}>
|
|
54
|
+
{title === "Avatar" ? 'Avatar' :
|
|
55
|
+
title === "Traits" ? 'Personality Traits' :
|
|
56
|
+
title === "Personality" ? 'Personality Model' :
|
|
57
|
+
title}
|
|
58
|
+
</h3>
|
|
59
|
+
|
|
60
|
+
{/* Status badge */}
|
|
61
|
+
<div className={`inline-flex items-center px-3 py-1 rounded-full text-sm font-semibold ${
|
|
62
|
+
!active
|
|
63
|
+
? 'bg-red-100 text-red-700'
|
|
64
|
+
: isChecked
|
|
65
|
+
? 'bg-green-100 text-green-700'
|
|
66
|
+
: 'bg-blue-100 text-blue-700'
|
|
67
|
+
}`}>
|
|
68
|
+
{!active ? '❌ Not Available' : isChecked ? '✅ SELECTED' : '⏳ Available'}
|
|
69
|
+
</div>
|
|
70
|
+
</div>
|
|
71
|
+
</div>
|
|
72
|
+
</div>
|
|
73
|
+
|
|
74
|
+
{/* Enhanced Checkbox */}
|
|
75
|
+
<div className="flex items-center justify-center mb-4">
|
|
76
|
+
<label className="flex items-center cursor-pointer">
|
|
77
|
+
<div className="relative">
|
|
78
|
+
<input
|
|
79
|
+
type="checkbox"
|
|
80
|
+
checked={isChecked}
|
|
81
|
+
disabled={!active}
|
|
82
|
+
onChange={(e) => onCheckboxChange(e.target.checked)}
|
|
83
|
+
className="sr-only" // Hide default checkbox
|
|
84
|
+
/>
|
|
85
|
+
|
|
86
|
+
{/* Custom checkbox appearance */}
|
|
87
|
+
<div className={`
|
|
88
|
+
w-8 h-8 border-3 rounded-lg flex items-center justify-center transition-all duration-200
|
|
89
|
+
${!active
|
|
90
|
+
? 'border-gray-300 bg-gray-100 cursor-not-allowed opacity-50'
|
|
91
|
+
: isChecked
|
|
92
|
+
? 'border-green-500 bg-green-500 shadow-xl transform scale-110'
|
|
93
|
+
: 'border-gray-400 bg-white hover:border-green-400 hover:bg-green-50 hover:scale-105'
|
|
94
|
+
}
|
|
95
|
+
`}>
|
|
96
|
+
{/* Checkmark icon */}
|
|
97
|
+
{isChecked && (
|
|
98
|
+
<svg
|
|
99
|
+
className="w-6 h-6 text-white animate-bounce"
|
|
100
|
+
fill="currentColor"
|
|
101
|
+
viewBox="0 0 20 20"
|
|
102
|
+
>
|
|
103
|
+
<path
|
|
104
|
+
fillRule="evenodd"
|
|
105
|
+
d="M16.707 5.293a1 1 0 010 1.414l-8 8a1 1 0 01-1.414 0l-4-4a1 1 0 011.414-1.414L8 12.586l7.293-7.293a1 1 0 011.414 0z"
|
|
106
|
+
clipRule="evenodd"
|
|
107
|
+
/>
|
|
108
|
+
</svg>
|
|
109
|
+
)}
|
|
110
|
+
</div>
|
|
111
|
+
</div>
|
|
112
|
+
|
|
113
|
+
{/* Selection status text */}
|
|
114
|
+
<span className={`ml-4 text-lg font-bold transition-colors duration-200 ${
|
|
115
|
+
!active
|
|
116
|
+
? 'text-gray-400'
|
|
117
|
+
: isChecked
|
|
118
|
+
? 'text-green-600'
|
|
119
|
+
: 'text-gray-700'
|
|
120
|
+
}`}>
|
|
121
|
+
{!active
|
|
122
|
+
? 'Not available'
|
|
123
|
+
: isChecked
|
|
124
|
+
? '✓ SELECTED FOR SHARING'
|
|
125
|
+
: 'Click to select'
|
|
126
|
+
}
|
|
127
|
+
</span>
|
|
128
|
+
</label>
|
|
129
|
+
</div>
|
|
130
|
+
|
|
131
|
+
{/* Status message for disabled items */}
|
|
132
|
+
<div className="flex items-center justify-center mb-4">
|
|
133
|
+
{!active && (
|
|
134
|
+
<div className="flex items-center space-x-2 text-sm text-red-700 bg-red-100 px-4 py-3 rounded-lg border-2 border-red-300">
|
|
135
|
+
<svg className="w-5 h-5" fill="currentColor" viewBox="0 0 20 20">
|
|
136
|
+
<path fillRule="evenodd" d="M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-7 4a1 1 0 11-2 0 1 1 0 012 0zm-1-9a1 1 0 00-1 1v4a1 1 0 102 0V6a1 1 0 00-1-1z" clipRule="evenodd" />
|
|
137
|
+
</svg>
|
|
138
|
+
<span className="font-bold">
|
|
139
|
+
{`No ${title} data available to share`}
|
|
140
|
+
</span>
|
|
141
|
+
</div>
|
|
142
|
+
)}
|
|
143
|
+
|
|
144
|
+
{isChecked && active && (
|
|
145
|
+
<div className="flex items-center space-x-2 text-sm text-green-700 bg-green-100 px-4 py-3 rounded-lg border-2 border-green-300 animate-pulse">
|
|
146
|
+
<svg className="w-5 h-5" fill="currentColor" viewBox="0 0 20 20">
|
|
147
|
+
<path fillRule="evenodd" d="M10 18a8 8 0 100-16 8 8 0 000 16zm3.707-9.293a1 1 0 00-1.414-1.414L9 10.586 7.707 9.293a1 1 0 00-1.414 1.414l2 2a1 1 0 001.414 0l4-4z" clipRule="evenodd" />
|
|
148
|
+
</svg>
|
|
149
|
+
<span className="font-bold">
|
|
150
|
+
THIS DATA WILL BE SHARED
|
|
151
|
+
</span>
|
|
152
|
+
</div>
|
|
153
|
+
)}
|
|
154
|
+
</div>
|
|
155
|
+
|
|
156
|
+
{/* Description and rewards with enhanced styling */}
|
|
157
|
+
{descriptions && title !== "Avatar" && (
|
|
158
|
+
<div className="mb-3 p-3 bg-blue-50 rounded-lg border border-blue-200">
|
|
159
|
+
<p className={`text-sm font-semibold ${
|
|
160
|
+
!active ? 'text-gray-400' : 'text-blue-800'
|
|
161
|
+
}`}>
|
|
162
|
+
<span className="text-blue-600">🎯 Intent:</span> {descriptions}
|
|
163
|
+
</p>
|
|
164
|
+
</div>
|
|
165
|
+
)}
|
|
166
|
+
|
|
167
|
+
{rewards && (
|
|
168
|
+
<div className="mb-3 p-3 bg-yellow-50 rounded-lg border border-yellow-200">
|
|
169
|
+
<p className={`text-sm font-semibold ${
|
|
170
|
+
!active ? 'text-gray-400' : 'text-yellow-800'
|
|
171
|
+
}`}>
|
|
172
|
+
<span className="text-yellow-600">🎁 Rewards:</span> {rewards}
|
|
173
|
+
</p>
|
|
174
|
+
</div>
|
|
175
|
+
)}
|
|
176
|
+
</div>
|
|
177
|
+
</div>
|
|
178
|
+
);
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
IndividualConnection.propTypes = {
|
|
182
|
+
active: PropTypes.bool.isRequired,
|
|
183
|
+
title: PropTypes.string.isRequired,
|
|
184
|
+
id: PropTypes.any.isRequired,
|
|
185
|
+
number: PropTypes.number.isRequired,
|
|
186
|
+
descriptions: PropTypes.string,
|
|
187
|
+
rewards: PropTypes.string,
|
|
188
|
+
size: PropTypes.string.isRequired,
|
|
189
|
+
isChecked: PropTypes.bool.isRequired,
|
|
190
|
+
onCheckboxChange: PropTypes.func.isRequired,
|
|
191
|
+
};
|
|
@@ -0,0 +1,157 @@
|
|
|
1
|
+
import React, { useState } from 'react';
|
|
2
|
+
import Box from './CheckBox';
|
|
3
|
+
import PropTypes from 'prop-types';
|
|
4
|
+
|
|
5
|
+
function IndividualConnection(props) {
|
|
6
|
+
const [selected, setSelected] = useState(false);
|
|
7
|
+
const isDisabled = !props.active;
|
|
8
|
+
|
|
9
|
+
const Insight = props.title === "Avatar" ? 'Avatar' :
|
|
10
|
+
props.title === "Traits" ? 'Personality Traits' :
|
|
11
|
+
'Persona';
|
|
12
|
+
|
|
13
|
+
return (
|
|
14
|
+
<div className={`relative p-4 sm:p-6 rounded-lg overflow-hidden mb-4 transition-all duration-300 border-2 ${
|
|
15
|
+
isDisabled
|
|
16
|
+
? 'bg-gray-50 border-gray-200 opacity-60'
|
|
17
|
+
: selected
|
|
18
|
+
? 'bg-green-50 border-green-400 shadow-lg transform scale-[1.02]'
|
|
19
|
+
: 'bg-white border-gray-300 hover:border-blue-300 hover:shadow-md'
|
|
20
|
+
}`}>
|
|
21
|
+
|
|
22
|
+
{/* Selection Status Indicator */}
|
|
23
|
+
{selected && !isDisabled && (
|
|
24
|
+
<div className="absolute top-2 right-2 w-6 h-6 bg-green-500 rounded-full flex items-center justify-center animate-pulse">
|
|
25
|
+
<svg className="w-4 h-4 text-white" fill="currentColor" viewBox="0 0 20 20">
|
|
26
|
+
<path fillRule="evenodd" d="M16.707 5.293a1 1 0 010 1.414l-8 8a1 1 0 01-1.414 0l-4-4a1 1 0 011.414-1.414L8 12.586l7.293-7.293a1 1 0 011.414 0z" clipRule="evenodd" />
|
|
27
|
+
</svg>
|
|
28
|
+
</div>
|
|
29
|
+
)}
|
|
30
|
+
|
|
31
|
+
<div className="relative">
|
|
32
|
+
{/* Header with title and status */}
|
|
33
|
+
<div className="flex items-center justify-between mb-4">
|
|
34
|
+
<div className="flex items-center space-x-3">
|
|
35
|
+
{/* Data type icon */}
|
|
36
|
+
<div className={`w-10 h-10 rounded-full flex items-center justify-center text-xl ${
|
|
37
|
+
isDisabled
|
|
38
|
+
? 'bg-gray-200 text-gray-400'
|
|
39
|
+
: selected
|
|
40
|
+
? 'bg-green-500 text-white'
|
|
41
|
+
: 'bg-blue-500 text-white'
|
|
42
|
+
}`}>
|
|
43
|
+
{props.title === "Avatar" ? "👤" :
|
|
44
|
+
props.title === "Traits" ? "🧠" :
|
|
45
|
+
props.title === "Personality" ? "🎭" : "📊"}
|
|
46
|
+
</div>
|
|
47
|
+
|
|
48
|
+
<div>
|
|
49
|
+
<h3 className={`text-lg font-semibold ${
|
|
50
|
+
isDisabled ? 'text-gray-400' : selected ? 'text-green-700' : 'text-gray-800'
|
|
51
|
+
}`}>
|
|
52
|
+
{Insight}
|
|
53
|
+
</h3>
|
|
54
|
+
|
|
55
|
+
{/* Status badge */}
|
|
56
|
+
<div className={`inline-flex items-center px-2 py-1 rounded-full text-xs font-medium ${
|
|
57
|
+
isDisabled
|
|
58
|
+
? 'bg-red-100 text-red-600'
|
|
59
|
+
: selected
|
|
60
|
+
? 'bg-green-100 text-green-700'
|
|
61
|
+
: 'bg-blue-100 text-blue-700'
|
|
62
|
+
}`}>
|
|
63
|
+
{isDisabled ? '❌ Not Available' : selected ? '✅ Selected' : '⏳ Available'}
|
|
64
|
+
</div>
|
|
65
|
+
</div>
|
|
66
|
+
</div>
|
|
67
|
+
</div>
|
|
68
|
+
|
|
69
|
+
{/* Checkbox with enhanced styling */}
|
|
70
|
+
<div className="flex items-center justify-center mb-4">
|
|
71
|
+
<Box
|
|
72
|
+
active={props.active}
|
|
73
|
+
onSelectionChange={(isSelected) => {
|
|
74
|
+
setSelected(isSelected);
|
|
75
|
+
if (props.onSelectionChange) {
|
|
76
|
+
props.onSelectionChange(isSelected);
|
|
77
|
+
}
|
|
78
|
+
if (props.changeGranted) {
|
|
79
|
+
if (isSelected) {
|
|
80
|
+
props.changeGranted(1);
|
|
81
|
+
} else {
|
|
82
|
+
props.changeGranted(-1);
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
}}
|
|
86
|
+
disabled={isDisabled}
|
|
87
|
+
setSelected={setSelected}
|
|
88
|
+
number={props.number + 1}
|
|
89
|
+
type="Test"
|
|
90
|
+
title={props.title}
|
|
91
|
+
changeGranted={props.changeGranted}
|
|
92
|
+
/>
|
|
93
|
+
</div>
|
|
94
|
+
|
|
95
|
+
{/* Status message for disabled items */}
|
|
96
|
+
<div className="flex items-center justify-center mb-3">
|
|
97
|
+
{isDisabled && (
|
|
98
|
+
<div className="flex items-center space-x-2 text-sm text-red-600 bg-red-50 px-3 py-2 rounded-lg border border-red-200">
|
|
99
|
+
<svg className="w-4 h-4" fill="currentColor" viewBox="0 0 20 20">
|
|
100
|
+
<path fillRule="evenodd" d="M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-7 4a1 1 0 11-2 0 1 1 0 012 0zm-1-9a1 1 0 00-1 1v4a1 1 0 102 0V6a1 1 0 00-1-1z" clipRule="evenodd" />
|
|
101
|
+
</svg>
|
|
102
|
+
<span className="font-medium">
|
|
103
|
+
{`No ${props.title} data available to share`}
|
|
104
|
+
</span>
|
|
105
|
+
</div>
|
|
106
|
+
)}
|
|
107
|
+
|
|
108
|
+
{selected && !isDisabled && (
|
|
109
|
+
<div className="flex items-center space-x-2 text-sm text-green-600 bg-green-50 px-3 py-2 rounded-lg border border-green-200">
|
|
110
|
+
<svg className="w-4 h-4" fill="currentColor" viewBox="0 0 20 20">
|
|
111
|
+
<path fillRule="evenodd" d="M10 18a8 8 0 100-16 8 8 0 000 16zm3.707-9.293a1 1 0 00-1.414-1.414L9 10.586 7.707 9.293a1 1 0 00-1.414 1.414l2 2a1 1 0 001.414 0l4-4z" clipRule="evenodd" />
|
|
112
|
+
</svg>
|
|
113
|
+
<span className="font-medium">
|
|
114
|
+
This data will be shared
|
|
115
|
+
</span>
|
|
116
|
+
</div>
|
|
117
|
+
)}
|
|
118
|
+
</div>
|
|
119
|
+
|
|
120
|
+
{/* Description and rewards */}
|
|
121
|
+
{props.descriptions && props.title !== "Avatar" && (
|
|
122
|
+
<div className="mb-2">
|
|
123
|
+
<p className={`text-sm font-medium ${
|
|
124
|
+
isDisabled ? 'text-gray-400' : 'text-gray-700'
|
|
125
|
+
}`}>
|
|
126
|
+
<span className="text-blue-600 font-semibold">Intent:</span> {props.descriptions}
|
|
127
|
+
</p>
|
|
128
|
+
</div>
|
|
129
|
+
)}
|
|
130
|
+
|
|
131
|
+
{props.rewards && (
|
|
132
|
+
<div className="mb-2">
|
|
133
|
+
<p className={`text-sm font-medium ${
|
|
134
|
+
isDisabled ? 'text-gray-400' : 'text-gray-700'
|
|
135
|
+
}`}>
|
|
136
|
+
<span className="text-green-600 font-semibold">Rewards:</span> {props.rewards}
|
|
137
|
+
</p>
|
|
138
|
+
</div>
|
|
139
|
+
)}
|
|
140
|
+
</div>
|
|
141
|
+
</div>
|
|
142
|
+
);
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
IndividualConnection.propTypes = {
|
|
146
|
+
active: PropTypes.bool.isRequired,
|
|
147
|
+
title: PropTypes.string.isRequired,
|
|
148
|
+
id: PropTypes.any.isRequired,
|
|
149
|
+
number: PropTypes.number.isRequired,
|
|
150
|
+
descriptions: PropTypes.string,
|
|
151
|
+
rewards: PropTypes.string,
|
|
152
|
+
size: PropTypes.string.isRequired,
|
|
153
|
+
changeGranted: PropTypes.func.isRequired,
|
|
154
|
+
onSelectionChange: PropTypes.func.isRequired
|
|
155
|
+
};
|
|
156
|
+
|
|
157
|
+
export default IndividualConnection;
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
import React, { useState, useEffect } from 'react';
|
|
2
|
+
|
|
3
|
+
export default function Box({
|
|
4
|
+
active,
|
|
5
|
+
onSelectionChange,
|
|
6
|
+
changeGranted,
|
|
7
|
+
number,
|
|
8
|
+
title,
|
|
9
|
+
type
|
|
10
|
+
}) {
|
|
11
|
+
const [isChecked, setIsChecked] = useState(false);
|
|
12
|
+
|
|
13
|
+
const handleCheckboxChange = (e) => {
|
|
14
|
+
console.log("Active: ", active, "Checked box : ", isChecked)
|
|
15
|
+
// Use the event's checked value directly
|
|
16
|
+
const newCheckedState = e.target.checked;
|
|
17
|
+
// setIsChecked(newCheckedState);
|
|
18
|
+
setIsChecked(newCheckedState);
|
|
19
|
+
|
|
20
|
+
console.log("With new Checked state now being: ", newCheckedState)
|
|
21
|
+
|
|
22
|
+
// // Update the counter
|
|
23
|
+
// if (newCheckedState) {
|
|
24
|
+
// changeGranted(1);
|
|
25
|
+
// } else {
|
|
26
|
+
// changeGranted(-1);
|
|
27
|
+
// }
|
|
28
|
+
|
|
29
|
+
// onSelectionChange(type);
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
// Reset checkbox when overlay closes or becomes inactive
|
|
33
|
+
useEffect(() => {
|
|
34
|
+
if (!active) {
|
|
35
|
+
setIsChecked(false);
|
|
36
|
+
}
|
|
37
|
+
}, [active]);
|
|
38
|
+
|
|
39
|
+
return (
|
|
40
|
+
<div className="group">
|
|
41
|
+
<div
|
|
42
|
+
className={`flex items-center mb-4 transition-all duration-200 ${
|
|
43
|
+
!active ? 'opacity-50' : 'hover:opacity-90'
|
|
44
|
+
}`}
|
|
45
|
+
>
|
|
46
|
+
<input
|
|
47
|
+
id={`checkbox-${number}`}
|
|
48
|
+
type="checkbox"
|
|
49
|
+
value=""
|
|
50
|
+
checked={isChecked} // Controlled component
|
|
51
|
+
onChange={handleCheckboxChange}
|
|
52
|
+
disabled={!active}
|
|
53
|
+
className={`
|
|
54
|
+
w-5 h-5
|
|
55
|
+
rounded
|
|
56
|
+
transition-all duration-200
|
|
57
|
+
focus:ring-2 focus:ring-offset-2
|
|
58
|
+
${active
|
|
59
|
+
? 'text-blue-600 border-gray-300 bg-gray-100 focus:ring-blue-500 cursor-pointer hover:bg-blue-50'
|
|
60
|
+
: 'text-gray-400 border-gray-200 bg-gray-50 cursor-not-allowed'
|
|
61
|
+
}
|
|
62
|
+
${isChecked && active ? 'bg-blue-500 border-blue-500' : ''}
|
|
63
|
+
`}
|
|
64
|
+
/>
|
|
65
|
+
<label
|
|
66
|
+
htmlFor={`checkbox-${number}`}
|
|
67
|
+
className={`ml-3 flex items-center select-none transition-colors duration-200 ${
|
|
68
|
+
active ? 'text-gray-900 cursor-pointer' : 'text-gray-400 cursor-not-allowed'
|
|
69
|
+
}`}
|
|
70
|
+
>
|
|
71
|
+
<span className="text-sm font-medium">
|
|
72
|
+
{title || `Request ${number}`}
|
|
73
|
+
</span>
|
|
74
|
+
</label>
|
|
75
|
+
</div>
|
|
76
|
+
|
|
77
|
+
{!active && (
|
|
78
|
+
<div className="ml-9 text-sm text-red-600 animate-fade-in">
|
|
79
|
+
Please create your Personality model to access this Grant Request
|
|
80
|
+
</div>
|
|
81
|
+
)}
|
|
82
|
+
</div>
|
|
83
|
+
);
|
|
84
|
+
}
|