From 8caa77413ea372e5cbd2980a9922d701af359c04 Mon Sep 17 00:00:00 2001
From: Max Nanis
Date: Wed, 28 May 2025 04:41:37 +0100
Subject: initial commit

---
 src/Widget.tsx | 61 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 61 insertions(+)
 create mode 100644 src/Widget.tsx

(limited to 'src/Widget.tsx')

diff --git a/src/Widget.tsx b/src/Widget.tsx
new file mode 100644
index 0000000..99c2a33
--- /dev/null
+++ b/src/Widget.tsx
@@ -0,0 +1,61 @@
+import React, {useEffect} from 'react'
+import {AppSidebar} from "@/components/app-sidebar"
+import {SiteHeader} from "@/components/site-header"
+import {SidebarInset, SidebarProvider} from "@/components/ui/sidebar"
+import {Offerwall} from "@/pages/Offerwall.tsx"
+import {QuestionsPage} from "@/pages/Questions.tsx";
+
+import {useAppDispatch, useAppSelector} from "@/hooks.ts";
+import {OfferwallApi, ProfilingQuestionsApi} from "@/api";
+import {setBuckets} from "@/models/bucketSlice.ts";
+import {setQuestions} from "@/models/questionSlice.ts"
+import {CashoutMethodsPage} from "@/pages/CashoutMethods.tsx";
+
+import './index.css';
+
+
+const Widget = () => {
+
+    const dispatch = useAppDispatch()
+    const app = useAppSelector(state => state.app)
+
+    useEffect(() => {
+        // https://fsb.generalresearch.com/{product_id}/offerwall/37d1da64/?country
+        new OfferwallApi().offerwallSoftpairProductIdOfferwall37d1da64Get(app.bpid, app.bpuid, "104.9.125.144")
+            .then(res => {
+                dispatch(setBuckets(res.data.offerwall.buckets))
+            })
+            .catch(err => console.log(err));
+
+        new ProfilingQuestionsApi().getProfilingQuestionsProductIdProfilingQuestionsGet(app.bpid, app.bpuid, "104.9.125.144")
+            .then(res => {
+                dispatch(setQuestions(res.data.questions))
+            })
+            .catch(err => console.log(err));
+    }, []); // ← empty array means "run once"
+
+
+    return (
+        <SidebarProvider>
+            <AppSidebar variant="floating" />
+            <SidebarInset>
+                <SiteHeader/>
+
+                <div className="flex flex-1 flex-col">
+                    <div className="@container/main flex flex-1 flex-col gap-2">
+                        <div className="flex flex-col gap-4 py-4 md:gap-6 md:py-6">
+                            <div className="px-4 lg:px-6">
+                                {app.currentPage === 'offerwall' && <Offerwall/>}
+                                {app.currentPage === 'questions' && <QuestionsPage/>}
+                                {app.currentPage === 'cashouts' && <CashoutMethodsPage/>}
+                            </div>
+                        </div>
+                    </div>
+                </div>
+
+            </SidebarInset>
+        </SidebarProvider>
+    )
+}
+
+export {Widget}
-- 
cgit v1.2.3

