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.cjs
CHANGED
|
@@ -39164,25 +39164,48 @@ var import_react_dom2 = __toESM(require("react-dom"), 1);
|
|
|
39164
39164
|
var import_framer_motion5 = require("framer-motion");
|
|
39165
39165
|
|
|
39166
39166
|
// src/molecules/creator-discovery/CreatorWidget/defaultFetchers.ts
|
|
39167
|
+
function getBackendOrigin2() {
|
|
39168
|
+
if (typeof window === "undefined") return null;
|
|
39169
|
+
return window.__NEXT_DATA__?.runtimeConfig?.NEXT_PUBLIC_AGENT_BACKEND ?? (typeof process !== "undefined" ? process.env?.NEXT_PUBLIC_AGENT_BACKEND : void 0) ?? null;
|
|
39170
|
+
}
|
|
39171
|
+
function getAuthToken2() {
|
|
39172
|
+
if (typeof document === "undefined") return null;
|
|
39173
|
+
for (const name of ["adminTokenBuilder", "adminToken", "token"]) {
|
|
39174
|
+
const match2 = document.cookie.match(new RegExp(`(?:^|;\\s*)${name}=([^;]*)`));
|
|
39175
|
+
if (match2?.[1]) return match2[1];
|
|
39176
|
+
}
|
|
39177
|
+
return null;
|
|
39178
|
+
}
|
|
39179
|
+
function buildHeaders2(includeJson = false) {
|
|
39180
|
+
const headers = {};
|
|
39181
|
+
if (includeJson) headers["Content-Type"] = "application/json";
|
|
39182
|
+
if (getBackendOrigin2()) {
|
|
39183
|
+
const token = getAuthToken2();
|
|
39184
|
+
if (token) headers["Authorization"] = `Bearer ${token}`;
|
|
39185
|
+
}
|
|
39186
|
+
return headers;
|
|
39187
|
+
}
|
|
39167
39188
|
async function defaultFetchVersions(params) {
|
|
39189
|
+
const backend = getBackendOrigin2();
|
|
39168
39190
|
const versionParam = params.version ? `&version=${params.version}` : "";
|
|
39169
|
-
const
|
|
39170
|
-
|
|
39171
|
-
);
|
|
39191
|
+
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}`;
|
|
39192
|
+
const res = await fetch(url, { headers: buildHeaders2() });
|
|
39172
39193
|
if (!res.ok) throw new Error(`HTTP ${res.status}`);
|
|
39173
39194
|
return res.json();
|
|
39174
39195
|
}
|
|
39175
39196
|
async function defaultFetchStatus(params) {
|
|
39176
|
-
const
|
|
39177
|
-
|
|
39178
|
-
);
|
|
39197
|
+
const backend = getBackendOrigin2();
|
|
39198
|
+
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}`;
|
|
39199
|
+
const res = await fetch(url, { headers: buildHeaders2() });
|
|
39179
39200
|
if (!res.ok) throw new Error(`HTTP ${res.status}`);
|
|
39180
39201
|
return res.json();
|
|
39181
39202
|
}
|
|
39182
39203
|
async function defaultFetchCreatorDetails(params) {
|
|
39183
|
-
const
|
|
39204
|
+
const backend = getBackendOrigin2();
|
|
39205
|
+
const url = backend ? `${backend}/api/creators/details-by-id` : `/api/get-creator-details-by-id`;
|
|
39206
|
+
const res = await fetch(url, {
|
|
39184
39207
|
method: "POST",
|
|
39185
|
-
headers:
|
|
39208
|
+
headers: buildHeaders2(true),
|
|
39186
39209
|
body: JSON.stringify({
|
|
39187
39210
|
creator_ids: params.creatorIds,
|
|
39188
39211
|
session_id: params.sessionId,
|
|
@@ -40749,6 +40772,37 @@ function CreatorDisplay({
|
|
|
40749
40772
|
] })
|
|
40750
40773
|
] });
|
|
40751
40774
|
}
|
|
40775
|
+
function CreatorCardSkeleton() {
|
|
40776
|
+
return /* @__PURE__ */ (0, import_jsx_runtime148.jsx)("div", { className: "bg-paperBackground rounded-[25px] py-5 pl-7 pr-7 border-2 border-gray300 shadow-sm", children: /* @__PURE__ */ (0, import_jsx_runtime148.jsxs)("div", { className: "flex flex-col gap-4 sm:grid sm:grid-cols-[1.3fr_1fr_2fr_120px] gap-8 items-start w-full", children: [
|
|
40777
|
+
/* @__PURE__ */ (0, import_jsx_runtime148.jsxs)("div", { className: "flex items-start gap-1 md:gap-6", children: [
|
|
40778
|
+
/* @__PURE__ */ (0, import_jsx_runtime148.jsx)("div", { className: "w-[5rem] h-[5rem] rounded-[10px] bg-gray200 animate-pulse" }),
|
|
40779
|
+
/* @__PURE__ */ (0, import_jsx_runtime148.jsxs)("div", { className: "flex flex-col gap-3", children: [
|
|
40780
|
+
/* @__PURE__ */ (0, import_jsx_runtime148.jsx)("div", { className: "h-5 w-36 rounded bg-gray200 animate-pulse" }),
|
|
40781
|
+
/* @__PURE__ */ (0, import_jsx_runtime148.jsx)("div", { className: "h-3 w-24 rounded bg-gray200 animate-pulse" }),
|
|
40782
|
+
/* @__PURE__ */ (0, import_jsx_runtime148.jsx)("div", { className: "h-3 w-32 rounded bg-gray200 animate-pulse" }),
|
|
40783
|
+
/* @__PURE__ */ (0, import_jsx_runtime148.jsx)("div", { className: "h-3 w-44 rounded bg-gray200 animate-pulse" })
|
|
40784
|
+
] })
|
|
40785
|
+
] }),
|
|
40786
|
+
/* @__PURE__ */ (0, import_jsx_runtime148.jsxs)("div", { className: "space-y-3 w-full", children: [
|
|
40787
|
+
/* @__PURE__ */ (0, import_jsx_runtime148.jsx)("div", { className: "h-4 w-32 rounded bg-gray200 animate-pulse" }),
|
|
40788
|
+
/* @__PURE__ */ (0, import_jsx_runtime148.jsx)("div", { className: "h-4 w-28 rounded bg-gray200 animate-pulse" }),
|
|
40789
|
+
/* @__PURE__ */ (0, import_jsx_runtime148.jsx)("div", { className: "h-4 w-24 rounded bg-gray200 animate-pulse" })
|
|
40790
|
+
] }),
|
|
40791
|
+
/* @__PURE__ */ (0, import_jsx_runtime148.jsxs)("div", { className: "space-y-3 w-full", children: [
|
|
40792
|
+
/* @__PURE__ */ (0, import_jsx_runtime148.jsx)("div", { className: "h-4 w-40 rounded bg-gray200 animate-pulse" }),
|
|
40793
|
+
/* @__PURE__ */ (0, import_jsx_runtime148.jsx)("div", { className: "h-3 w-full rounded bg-gray200 animate-pulse" }),
|
|
40794
|
+
/* @__PURE__ */ (0, import_jsx_runtime148.jsx)("div", { className: "h-3 w-[90%] rounded bg-gray200 animate-pulse" }),
|
|
40795
|
+
/* @__PURE__ */ (0, import_jsx_runtime148.jsx)("div", { className: "h-3 w-[75%] rounded bg-gray200 animate-pulse" })
|
|
40796
|
+
] }),
|
|
40797
|
+
/* @__PURE__ */ (0, import_jsx_runtime148.jsxs)("div", { className: "hidden md:flex flex-col items-center justify-center gap-3", children: [
|
|
40798
|
+
/* @__PURE__ */ (0, import_jsx_runtime148.jsx)("div", { className: "h-6 w-16 rounded bg-gray200 animate-pulse" }),
|
|
40799
|
+
/* @__PURE__ */ (0, import_jsx_runtime148.jsx)("div", { className: "h-4 w-20 rounded bg-gray200 animate-pulse" })
|
|
40800
|
+
] })
|
|
40801
|
+
] }) });
|
|
40802
|
+
}
|
|
40803
|
+
function CreatorDisplaySkeleton() {
|
|
40804
|
+
return /* @__PURE__ */ (0, import_jsx_runtime148.jsx)("div", { className: "px-4 py-4 space-y-4", children: Array.from({ length: 3 }).map((_, idx) => /* @__PURE__ */ (0, import_jsx_runtime148.jsx)(CreatorCardSkeleton, {}, idx)) });
|
|
40805
|
+
}
|
|
40752
40806
|
function CreatorExpandedPanel({
|
|
40753
40807
|
isOpen,
|
|
40754
40808
|
onClose,
|
|
@@ -40816,10 +40870,7 @@ function CreatorExpandedPanel({
|
|
|
40816
40870
|
] })
|
|
40817
40871
|
] }),
|
|
40818
40872
|
/* @__PURE__ */ (0, import_jsx_runtime148.jsx)("div", { className: "border-b border-gray300" }),
|
|
40819
|
-
loading ? /* @__PURE__ */ (0, import_jsx_runtime148.
|
|
40820
|
-
/* @__PURE__ */ (0, import_jsx_runtime148.jsx)("div", { className: "w-8 h-8 border-3 border-purple100 border-t-transparent rounded-full animate-spin" }),
|
|
40821
|
-
/* @__PURE__ */ (0, import_jsx_runtime148.jsx)("p", { className: "text-sm text-gray600", children: "Fetching Creators" })
|
|
40822
|
-
] }) : /* @__PURE__ */ (0, import_jsx_runtime148.jsx)(CreatorDisplay, { creators, isValidationComplete: version !== void 0 })
|
|
40873
|
+
loading ? /* @__PURE__ */ (0, import_jsx_runtime148.jsx)(CreatorDisplaySkeleton, {}) : /* @__PURE__ */ (0, import_jsx_runtime148.jsx)(CreatorDisplay, { creators, isValidationComplete: version !== void 0 })
|
|
40823
40874
|
] })
|
|
40824
40875
|
},
|
|
40825
40876
|
"creator-panel"
|