pxengine 0.1.64 → 0.1.66
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.cjs +63 -12
- package/dist/index.cjs.map +1 -1
- package/dist/index.mjs +63 -12
- package/dist/index.mjs.map +1 -1
- package/dist/registry.json +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -38873,25 +38873,48 @@ import ReactDOM2 from "react-dom";
|
|
|
38873
38873
|
import { AnimatePresence as AnimatePresence4, motion as motion5 } from "framer-motion";
|
|
38874
38874
|
|
|
38875
38875
|
// src/molecules/creator-discovery/CreatorWidget/defaultFetchers.ts
|
|
38876
|
+
function getBackendOrigin2() {
|
|
38877
|
+
if (typeof window === "undefined") return null;
|
|
38878
|
+
return window.__NEXT_DATA__?.runtimeConfig?.NEXT_PUBLIC_AGENT_BACKEND ?? (typeof process !== "undefined" ? process.env?.NEXT_PUBLIC_AGENT_BACKEND : void 0) ?? null;
|
|
38879
|
+
}
|
|
38880
|
+
function getAuthToken2() {
|
|
38881
|
+
if (typeof document === "undefined") return null;
|
|
38882
|
+
for (const name of ["adminTokenBuilder", "adminToken", "token"]) {
|
|
38883
|
+
const match2 = document.cookie.match(new RegExp(`(?:^|;\\s*)${name}=([^;]*)`));
|
|
38884
|
+
if (match2?.[1]) return match2[1];
|
|
38885
|
+
}
|
|
38886
|
+
return null;
|
|
38887
|
+
}
|
|
38888
|
+
function buildHeaders2(includeJson = false) {
|
|
38889
|
+
const headers = {};
|
|
38890
|
+
if (includeJson) headers["Content-Type"] = "application/json";
|
|
38891
|
+
if (getBackendOrigin2()) {
|
|
38892
|
+
const token = getAuthToken2();
|
|
38893
|
+
if (token) headers["Authorization"] = `Bearer ${token}`;
|
|
38894
|
+
}
|
|
38895
|
+
return headers;
|
|
38896
|
+
}
|
|
38876
38897
|
async function defaultFetchVersions(params) {
|
|
38898
|
+
const backend = getBackendOrigin2();
|
|
38877
38899
|
const versionParam = params.version ? `&version=${params.version}` : "";
|
|
38878
|
-
const
|
|
38879
|
-
|
|
38880
|
-
);
|
|
38900
|
+
const url = backend ? `${backend}/api/creators/versions?sessionId=${params.sessionId}${versionParam}&validated=${params.validated}` : `/api/get-creator-versions?sessionId=${params.sessionId}${versionParam}&validated=${params.validated}`;
|
|
38901
|
+
const res = await fetch(url, { headers: buildHeaders2() });
|
|
38881
38902
|
if (!res.ok) throw new Error(`HTTP ${res.status}`);
|
|
38882
38903
|
return res.json();
|
|
38883
38904
|
}
|
|
38884
38905
|
async function defaultFetchStatus(params) {
|
|
38885
|
-
const
|
|
38886
|
-
|
|
38887
|
-
);
|
|
38906
|
+
const backend = getBackendOrigin2();
|
|
38907
|
+
const url = backend ? `${backend}/api/creators/version-status?session_id=${params.sessionId}&version_no=${params.versionNo}` : `/api/get-creator-detail-status?session_id=${params.sessionId}&version_no=${params.versionNo}`;
|
|
38908
|
+
const res = await fetch(url, { headers: buildHeaders2() });
|
|
38888
38909
|
if (!res.ok) throw new Error(`HTTP ${res.status}`);
|
|
38889
38910
|
return res.json();
|
|
38890
38911
|
}
|
|
38891
38912
|
async function defaultFetchCreatorDetails(params) {
|
|
38892
|
-
const
|
|
38913
|
+
const backend = getBackendOrigin2();
|
|
38914
|
+
const url = backend ? `${backend}/api/creators/details-by-id` : `/api/get-creator-details-by-id`;
|
|
38915
|
+
const res = await fetch(url, {
|
|
38893
38916
|
method: "POST",
|
|
38894
|
-
headers:
|
|
38917
|
+
headers: buildHeaders2(true),
|
|
38895
38918
|
body: JSON.stringify({
|
|
38896
38919
|
creator_ids: params.creatorIds,
|
|
38897
38920
|
session_id: params.sessionId,
|
|
@@ -40458,6 +40481,37 @@ function CreatorDisplay({
|
|
|
40458
40481
|
] })
|
|
40459
40482
|
] });
|
|
40460
40483
|
}
|
|
40484
|
+
function CreatorCardSkeleton() {
|
|
40485
|
+
return /* @__PURE__ */ jsx148("div", { className: "bg-paperBackground rounded-[25px] py-5 pl-7 pr-7 border-2 border-gray300 shadow-sm", children: /* @__PURE__ */ jsxs106("div", { className: "flex flex-col gap-4 sm:grid sm:grid-cols-[1.3fr_1fr_2fr_120px] gap-8 items-start w-full", children: [
|
|
40486
|
+
/* @__PURE__ */ jsxs106("div", { className: "flex items-start gap-1 md:gap-6", children: [
|
|
40487
|
+
/* @__PURE__ */ jsx148("div", { className: "w-[5rem] h-[5rem] rounded-[10px] bg-gray200 animate-pulse" }),
|
|
40488
|
+
/* @__PURE__ */ jsxs106("div", { className: "flex flex-col gap-3", children: [
|
|
40489
|
+
/* @__PURE__ */ jsx148("div", { className: "h-5 w-36 rounded bg-gray200 animate-pulse" }),
|
|
40490
|
+
/* @__PURE__ */ jsx148("div", { className: "h-3 w-24 rounded bg-gray200 animate-pulse" }),
|
|
40491
|
+
/* @__PURE__ */ jsx148("div", { className: "h-3 w-32 rounded bg-gray200 animate-pulse" }),
|
|
40492
|
+
/* @__PURE__ */ jsx148("div", { className: "h-3 w-44 rounded bg-gray200 animate-pulse" })
|
|
40493
|
+
] })
|
|
40494
|
+
] }),
|
|
40495
|
+
/* @__PURE__ */ jsxs106("div", { className: "space-y-3 w-full", children: [
|
|
40496
|
+
/* @__PURE__ */ jsx148("div", { className: "h-4 w-32 rounded bg-gray200 animate-pulse" }),
|
|
40497
|
+
/* @__PURE__ */ jsx148("div", { className: "h-4 w-28 rounded bg-gray200 animate-pulse" }),
|
|
40498
|
+
/* @__PURE__ */ jsx148("div", { className: "h-4 w-24 rounded bg-gray200 animate-pulse" })
|
|
40499
|
+
] }),
|
|
40500
|
+
/* @__PURE__ */ jsxs106("div", { className: "space-y-3 w-full", children: [
|
|
40501
|
+
/* @__PURE__ */ jsx148("div", { className: "h-4 w-40 rounded bg-gray200 animate-pulse" }),
|
|
40502
|
+
/* @__PURE__ */ jsx148("div", { className: "h-3 w-full rounded bg-gray200 animate-pulse" }),
|
|
40503
|
+
/* @__PURE__ */ jsx148("div", { className: "h-3 w-[90%] rounded bg-gray200 animate-pulse" }),
|
|
40504
|
+
/* @__PURE__ */ jsx148("div", { className: "h-3 w-[75%] rounded bg-gray200 animate-pulse" })
|
|
40505
|
+
] }),
|
|
40506
|
+
/* @__PURE__ */ jsxs106("div", { className: "hidden md:flex flex-col items-center justify-center gap-3", children: [
|
|
40507
|
+
/* @__PURE__ */ jsx148("div", { className: "h-6 w-16 rounded bg-gray200 animate-pulse" }),
|
|
40508
|
+
/* @__PURE__ */ jsx148("div", { className: "h-4 w-20 rounded bg-gray200 animate-pulse" })
|
|
40509
|
+
] })
|
|
40510
|
+
] }) });
|
|
40511
|
+
}
|
|
40512
|
+
function CreatorDisplaySkeleton() {
|
|
40513
|
+
return /* @__PURE__ */ jsx148("div", { className: "px-4 py-4 space-y-4", children: Array.from({ length: 3 }).map((_, idx) => /* @__PURE__ */ jsx148(CreatorCardSkeleton, {}, idx)) });
|
|
40514
|
+
}
|
|
40461
40515
|
function CreatorExpandedPanel({
|
|
40462
40516
|
isOpen,
|
|
40463
40517
|
onClose,
|
|
@@ -40525,10 +40579,7 @@ function CreatorExpandedPanel({
|
|
|
40525
40579
|
] })
|
|
40526
40580
|
] }),
|
|
40527
40581
|
/* @__PURE__ */ jsx148("div", { className: "border-b border-gray300" }),
|
|
40528
|
-
loading ? /* @__PURE__ */
|
|
40529
|
-
/* @__PURE__ */ jsx148("div", { className: "w-8 h-8 border-3 border-purple100 border-t-transparent rounded-full animate-spin" }),
|
|
40530
|
-
/* @__PURE__ */ jsx148("p", { className: "text-sm text-gray600", children: "Fetching Creators" })
|
|
40531
|
-
] }) : /* @__PURE__ */ jsx148(CreatorDisplay, { creators, isValidationComplete: version !== void 0 })
|
|
40582
|
+
loading ? /* @__PURE__ */ jsx148(CreatorDisplaySkeleton, {}) : /* @__PURE__ */ jsx148(CreatorDisplay, { creators, isValidationComplete: version !== void 0 })
|
|
40532
40583
|
] })
|
|
40533
40584
|
},
|
|
40534
40585
|
"creator-panel"
|