@turtleclub/turtle-basic 0.1.0-beta.12 → 0.1.0-beta.14
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/index.js +1 -1
- package/package.json +5 -5
package/dist/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import {createContext,useState,useCallback,useEffect,useContext}from'react';import {jsx,jsxs
|
|
1
|
+
import {createContext,useState,useCallback,useEffect,useContext}from'react';import {jsx,Fragment,jsxs}from'react/jsx-runtime';var R=Object.defineProperty;var b=(e,t,o)=>t in e?R(e,t,{enumerable:true,configurable:true,writable:true,value:o}):e[t]=o;var l=(e,t,o)=>b(e,typeof t!="symbol"?t+"":t,o);var s=null,m="turtle-platform-detection";function D(){if(typeof window>"u"||typeof sessionStorage>"u")return null;try{let e=sessionStorage.getItem(m);if(e)return JSON.parse(e)}catch(e){console.warn("[Platform Detection] Failed to load cached detection:",e);}return null}function E(e){if(!(typeof window>"u"||typeof sessionStorage>"u"))try{sessionStorage.setItem(m,JSON.stringify(e));}catch(t){console.warn("[Platform Detection] Failed to save cached detection:",t);}}function N(){if(typeof window>"u")return null;let e=window.location.hostname;return e.includes("worldcoin.")?"worldcoin":e.includes("lemon.")?"lemon":null}function f(e=false){if(!e){if(s)return s;let r=D();if(r)return s=r,r}let t=r=>(s=r,E(r),r),o=N();return t(o?{platformId:o,detectionMethod:"subdomain",isValidated:true}:{platformId:"turtle-web",detectionMethod:"default",isValidated:true})}var i=class{constructor(){l(this,"platformId","turtle-web");l(this,"platformName","Turtle Web");l(this,"user",null);}isAvailable(){return typeof window<"u"}async authenticate(t){return console.log("[TurtleWebAdapter] authenticate() called - NOT IMPLEMENTED",{nonce:t}),{success:false,error:"Authentication not implemented yet"}}getUser(){return this.user}async depositToOpportunity(t){return console.log("[TurtleWebAdapter] depositToOpportunity() called - NOT IMPLEMENTED",t),{success:false,error:"Deposit not implemented yet"}}getCapabilities(){return {canChangeNetwork:true,canDisconnect:true,showNetworkSelector:true,showGasEstimate:true,showUsername:false,requiresGasPayment:true,supportsNotifications:false}}getOpportunities(){return console.log("[TurtleWebAdapter] getOpportunities() called - NOT IMPLEMENTED"),Promise.resolve([])}getOpportunity(t){return console.log("[TurtleWebAdapter] getOpportunity() called - NOT IMPLEMENTED",{opportunityId:t}),Promise.reject(new Error("getOpportunity not implemented yet"))}};function P(e){switch(e){case "turtle-web":return new i;case "lemon":return console.warn("[createAdapter] Lemon adapter not implemented yet, falling back to turtle-web"),new i;case "worldcoin":return console.warn("[createAdapter] WorldCoin adapter not implemented yet, falling back to turtle-web"),new i;default:return console.warn("[createAdapter] Unknown platform, falling back to turtle-web"),new i}}var g=createContext(null);function M({children:e,loadingComponent:t,errorComponent:o,forcePlatform:r}){let[d,x]=useState(null),[c,p]=useState(null),u=useCallback(()=>{try{p(null);let n;r?n={platformId:r,detectionMethod:"forced",isValidated:!1,warnings:["Platform was manually forced via forcePlatform prop"]}:n=f();let A=P(n.platformId);x({adapter:A,detection:n,isReady:!0});}catch(n){console.error("[PlatformProvider] Error during platform initialization:",n),p(n instanceof Error?n:new Error("Unknown error during platform initialization"));}},[r]);return useEffect(()=>{u();},[u]),c?o?jsx(Fragment,{children:o(c,u)}):jsxs("main",{className:"flex flex-col items-center justify-center h-screen",children:[jsx("div",{className:"text-lg font-bold",children:"There was an error initializing the platform"}),jsx("span",{className:"text-sm text-gray-500",children:c.message}),jsx("span",{className:"text-xs text-gray-500",children:"Please provide an Error component to the PlatformProvider."})]}):d?jsx(g.Provider,{value:d,children:e}):t?jsx(Fragment,{children:t}):jsxs("main",{className:"flex flex-col items-center justify-center h-screen",children:[jsx("span",{className:"text-lg font-bold",children:"Detecting platform..."}),jsx("span",{className:"text-xs text-gray-500",children:"Please provide a Loading component to the PlatformProvider."})]})}function O(){let e=useContext(g);if(!e)throw new Error("usePlatform must be used within a PlatformProvider");return e}export{M as PlatformProvider,O as usePlatform};//# sourceMappingURL=index.js.map
|
|
2
2
|
//# sourceMappingURL=index.js.map
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@turtleclub/turtle-basic",
|
|
3
|
-
"version": "0.1.0-beta.
|
|
3
|
+
"version": "0.1.0-beta.14",
|
|
4
4
|
"description": "Multi-platform mini-app adapter system for Turtle Basic",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|
|
@@ -32,9 +32,9 @@
|
|
|
32
32
|
"lint": "eslint . --max-warnings 0"
|
|
33
33
|
},
|
|
34
34
|
"dependencies": {
|
|
35
|
-
"@turtleclub/hooks": "0.5.0-beta.
|
|
36
|
-
"@turtleclub/opportunities": "0.1.0-beta.
|
|
37
|
-
"@turtleclub/ui": "0.7.0-beta.
|
|
35
|
+
"@turtleclub/hooks": "0.5.0-beta.42",
|
|
36
|
+
"@turtleclub/opportunities": "0.1.0-beta.58",
|
|
37
|
+
"@turtleclub/ui": "0.7.0-beta.22",
|
|
38
38
|
"@turtleclub/utils": "0.4.0-beta.0"
|
|
39
39
|
},
|
|
40
40
|
"peerDependencies": {
|
|
@@ -57,5 +57,5 @@
|
|
|
57
57
|
"publishConfig": {
|
|
58
58
|
"access": "public"
|
|
59
59
|
},
|
|
60
|
-
"gitHead": "
|
|
60
|
+
"gitHead": "dfb8123923c249371734e5168b024e81615ea12c"
|
|
61
61
|
}
|