@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.
Files changed (181) hide show
  1. package/LICENSE +194 -10
  2. package/README.md +182 -25
  3. package/dist/onairos.capacitor.esm.js +1 -0
  4. package/dist/onairos.capacitor.esm.turbopack.js +1 -0
  5. package/onairos.d.ts +656 -0
  6. package/package.json +186 -38
  7. package/src/OnairosReconnectButton.jsx +272 -0
  8. package/src/RSA.jsx +57 -0
  9. package/src/assets/NewLogo.png +0 -0
  10. package/src/assets/OnairosNewLogo.png +0 -0
  11. package/src/assets/chatgpt-icon.png +0 -0
  12. package/src/assets/fire-horse.png +0 -0
  13. package/src/assets/fire-horse.transparent.png +0 -0
  14. package/src/assets/latest-firehorse.png +0 -0
  15. package/src/assets/perplexity.png +0 -0
  16. package/src/assets/persona.png +0 -0
  17. package/src/assets/persona1.png +0 -0
  18. package/src/assets/persona2.png +0 -0
  19. package/src/assets/persona3.png +0 -0
  20. package/src/assets/persona4.png +0 -0
  21. package/src/assets/persona5.png +0 -0
  22. package/src/capacitorConnectorCatalog.js +38 -0
  23. package/src/capacitorOAuthConfig.js +52 -0
  24. package/src/chatgptHostedImport/index.js +303 -0
  25. package/src/components/AuthButtons.jsx +48 -0
  26. package/src/components/ConnectChatGPTModal.jsx +666 -0
  27. package/src/components/ConnectClaudeModal.jsx +610 -0
  28. package/src/components/ConnectGeminiModal.jsx +639 -0
  29. package/src/components/ConnectGrokModal.jsx +701 -0
  30. package/src/components/ConnectPerplexityModal.jsx +726 -0
  31. package/src/components/DataExplainerScreen.jsx +349 -0
  32. package/src/components/DataRequest.js +885 -0
  33. package/src/components/DataRequest.jsx +1055 -0
  34. package/src/components/EmailAuth.js +1871 -0
  35. package/src/components/EmailAuth.jsx +2062 -0
  36. package/src/components/ExtensionInstallPrompt.jsx +142 -0
  37. package/src/components/GoogleButton.js +133 -0
  38. package/src/components/LLMConnectorManager.jsx +201 -0
  39. package/src/components/LoadingPage.jsx +19 -0
  40. package/src/components/LoadingScreen.jsx +81 -0
  41. package/src/components/LunarBirthdate.jsx +96 -0
  42. package/src/components/LunarLoadingPage.jsx +251 -0
  43. package/src/components/Notification.jsx +21 -0
  44. package/src/components/OnairosAppButton.jsx +85 -0
  45. package/src/components/OnairosSSO.jsx +645 -0
  46. package/src/components/OnairosTrigger.jsx +61 -0
  47. package/src/components/PerplexityLogo.jsx +43 -0
  48. package/src/components/PinSetup.js +200 -0
  49. package/src/components/PinSetup.jsx +228 -0
  50. package/src/components/SDK_PIN_INTEGRATION_REQUIRED_CHANGES.md +526 -0
  51. package/src/components/SdkErrorBoundary.jsx +36 -0
  52. package/src/components/SecuritySetup.js +81 -0
  53. package/src/components/SessionUserBar.jsx +83 -0
  54. package/src/components/SignUp.js +123 -0
  55. package/src/components/TestTelegramButton.js +53 -0
  56. package/src/components/TrainingComponent.jsx +200 -0
  57. package/src/components/TrainingScreen.jsx +897 -0
  58. package/src/components/UniversalOnboarding.js +306 -0
  59. package/src/components/UniversalOnboarding.jsx +4837 -0
  60. package/src/components/ValentineLoadingPage.jsx +502 -0
  61. package/src/components/ValentineModeSelector.jsx +162 -0
  62. package/src/components/WelcomeScreen.jsx +435 -0
  63. package/src/components/WrappedLoadingPage.jsx +205 -0
  64. package/src/components/connectors/ChatGPTConnector.js +348 -0
  65. package/src/components/connectors/ChatGPTConnector.jsx +348 -0
  66. package/src/components/connectors/ClaudeConnector.js +44 -0
  67. package/src/components/connectors/ClaudeConnector.jsx +44 -0
  68. package/src/components/connectors/GeminiConnector.js +170 -0
  69. package/src/components/connectors/GeminiConnector.jsx +170 -0
  70. package/src/components/connectors/GmailConnector.js +148 -0
  71. package/src/components/connectors/GmailConnector.jsx +148 -0
  72. package/src/components/connectors/GrokConnector.js +16 -0
  73. package/src/components/connectors/GrokConnector.jsx +16 -0
  74. package/src/components/connectors/HingeConnector.js +419 -0
  75. package/src/components/connectors/HingeConnector.jsx +419 -0
  76. package/src/components/connectors/InstagramDataConnector.js +726 -0
  77. package/src/components/connectors/InstagramDataConnector.jsx +726 -0
  78. package/src/components/connectors/LinkedInConnector.js +4 -0
  79. package/src/components/connectors/LinkedInConnector.jsx +296 -0
  80. package/src/components/connectors/PerplexityConnector.jsx +16 -0
  81. package/src/components/connectors/PinterestConnector.js +208 -0
  82. package/src/components/connectors/PinterestConnector.jsx +208 -0
  83. package/src/components/connectors/README.md +292 -0
  84. package/src/components/connectors/RedditConnector.js +229 -0
  85. package/src/components/connectors/RedditConnector.jsx +229 -0
  86. package/src/components/connectors/SephoraConnector.js +482 -0
  87. package/src/components/connectors/SephoraConnector.jsx +482 -0
  88. package/src/components/connectors/TikTokConnector.jsx +430 -0
  89. package/src/components/connectors/YoutubeConnector.js +361 -0
  90. package/src/components/connectors/YoutubeConnector.jsx +361 -0
  91. package/src/components/connectors/index.js +50 -0
  92. package/src/components/icons.jsx +46 -0
  93. package/src/components/icons.tsx +21 -0
  94. package/src/components/ui/PageLayout.jsx +1255 -0
  95. package/src/components/ui/PrimaryButton.jsx +162 -0
  96. package/src/components/ui/button.jsx +49 -0
  97. package/src/components/ui/card.jsx +61 -0
  98. package/src/components/ui/checkbox.jsx +33 -0
  99. package/src/components/ui/label.jsx +29 -0
  100. package/src/components/utils/UpdateConnections.js +45 -0
  101. package/src/components/utils/oauthHelper.js +97 -0
  102. package/src/config/api-config.js +138 -0
  103. package/src/deepLink.jsx +38 -0
  104. package/src/getPin.js +26 -0
  105. package/src/icons/Avatar.png +0 -0
  106. package/src/icons/Sentiment.png +0 -0
  107. package/src/icons/Trait.png +0 -0
  108. package/src/iframe/DataRequestPage.jsx +285 -0
  109. package/src/iframe/OnairosButtonIntegration.md +148 -0
  110. package/src/iframe/components/Box.jsx +56 -0
  111. package/src/iframe/components/IndividualConnection.jsx +88 -0
  112. package/src/iframe/dataRequestHandler.js +714 -0
  113. package/src/iframe/data_request_iframe.html +27 -0
  114. package/src/iframe/data_request_page.js +47 -0
  115. package/src/iframe/icons/Avatar.png +1 -0
  116. package/src/iframe/icons/Avatar2.png +1 -0
  117. package/src/iframe/icons/Sentiment.png +1 -0
  118. package/src/iframe/icons/Trait.png +1 -0
  119. package/src/iframe/icons/onairos_logo.png +0 -0
  120. package/src/iframe/utils/api.js +57 -0
  121. package/src/index.js +274 -0
  122. package/src/laravel/OnairosVue.vue +410 -0
  123. package/src/laravel/blade-helpers.js +320 -0
  124. package/src/laravel/vite-plugin.js +179 -0
  125. package/src/mobile/MobileDataRequestPage.jsx +233 -0
  126. package/src/mobile/components/MobileBox.jsx +71 -0
  127. package/src/mobile/components/MobileIndividualConnection.jsx +51 -0
  128. package/src/mobile/shims/browser-apis.js +78 -0
  129. package/src/mobile/shims/lucide-shim.js +85 -0
  130. package/src/newUI/EMAIL_VERIFICATION_API_SCHEMA.md +268 -0
  131. package/src/newUI/PlatformConnectorsStep.tsx +435 -0
  132. package/src/newUI/PrimaryButton.tsx +213 -0
  133. package/src/newUI/SignInStep.tsx +194 -0
  134. package/src/newUI/VerificationStep.tsx +133 -0
  135. package/src/newUI/WelcomeScreen.tsx +311 -0
  136. package/src/newUI/services/connectedAccountsService.js +129 -0
  137. package/src/onairos.capacitor.jsx +16 -0
  138. package/src/onairos.core.jsx +133 -0
  139. package/src/onairos.jsx +14 -0
  140. package/src/onairos.native.jsx +15 -0
  141. package/src/onairosButton.jsx +9000 -0
  142. package/src/overlay/CheckBox.jsx +114 -0
  143. package/src/overlay/IndividualConnection copy.js +86 -0
  144. package/src/overlay/IndividualConnection.js +191 -0
  145. package/src/overlay/IndividualConnectionNew.jsx +157 -0
  146. package/src/overlay/box.js +84 -0
  147. package/src/overlay/overlay.js +437 -0
  148. package/src/styles/onairos-scoped-preflight.css +97 -0
  149. package/src/styles/sdkCssRegistry.js +20 -0
  150. package/src/styles/styleLoaderInsertShadow.js +69 -0
  151. package/src/styles/tailwind.capacitor.css +395 -0
  152. package/src/styles/tailwind.css +395 -0
  153. package/src/theme/colors.js +40 -0
  154. package/src/utils/apiKeyValidation.js +341 -0
  155. package/src/utils/apiResponseLogger.js +316 -0
  156. package/src/utils/authHeaders.js +275 -0
  157. package/src/utils/biometrics.js +26 -0
  158. package/src/utils/bookmarkletUtils.js +28 -0
  159. package/src/utils/capacitorDetection.js +278 -0
  160. package/src/utils/capacitorLLMHelper.js +352 -0
  161. package/src/utils/capacitorPlugins.js +366 -0
  162. package/src/utils/crossDomainSSO.js +587 -0
  163. package/src/utils/deepLinking.js +27 -0
  164. package/src/utils/devLogger.js +46 -0
  165. package/src/utils/extensionDetection.js +418 -0
  166. package/src/utils/extractMemory.js +277 -0
  167. package/src/utils/framerBrandingOverrides.js +40 -0
  168. package/src/utils/googleWebClientId.js +55 -0
  169. package/src/utils/overlayHandler.js +224 -0
  170. package/src/utils/platformDisconnect.js +309 -0
  171. package/src/utils/pollTrainingStatus.js +200 -0
  172. package/src/utils/rawMemoriesAccess.js +211 -0
  173. package/src/utils/resolveBackendAppId.js +47 -0
  174. package/src/utils/responseFormatter.js +140 -0
  175. package/src/utils/sdkDebugStorage.js +113 -0
  176. package/src/utils/sdkInitialization.js +645 -0
  177. package/src/utils/sessionManager.js +1258 -0
  178. package/src/utils/startBackgroundTraining.js +100 -0
  179. package/src/utils/userDataFormatter.js +222 -0
  180. package/index.d.ts +0 -1
  181. 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
+ }