@neuctra/authix 1.2.13 → 1.2.15
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/neuctra-authix.es.js +63 -30
- package/dist/neuctra-authix.umd.js +47 -47
- package/dist/react/SignedIn.d.ts.map +1 -1
- package/dist/react/SignedOut.d.ts.map +1 -1
- package/dist/react/UserLogin.d.ts.map +1 -1
- package/dist/sdk/index.d.ts +36 -10
- package/dist/sdk/index.d.ts.map +1 -1
- package/package.json +1 -1
|
@@ -2186,40 +2186,57 @@ class li {
|
|
|
2186
2186
|
}
|
|
2187
2187
|
// ================= APP DATA =================
|
|
2188
2188
|
/**
|
|
2189
|
-
* Get all app data items
|
|
2190
|
-
*
|
|
2189
|
+
* 📦 Get all app data items
|
|
2190
|
+
* Optional category filter
|
|
2191
|
+
*
|
|
2192
|
+
* Routes:
|
|
2193
|
+
* GET /api/app/:appId/app-data
|
|
2194
|
+
* GET /api/app/:appId/app-data/:category
|
|
2191
2195
|
*/
|
|
2192
2196
|
async getAppData(e) {
|
|
2193
2197
|
const n = this.appId;
|
|
2194
2198
|
if (!n) throw new Error("getAppData: 'appId' is required");
|
|
2195
|
-
const s = e ?
|
|
2196
|
-
return await this.request(
|
|
2197
|
-
"GET",
|
|
2198
|
-
`/app/${n}/data${s}`,
|
|
2199
|
-
void 0,
|
|
2200
|
-
{},
|
|
2201
|
-
!1
|
|
2202
|
-
// ✅ include credentials
|
|
2203
|
-
);
|
|
2199
|
+
const s = e ? `/app/${encodeURIComponent(n)}/app-data/${encodeURIComponent(e)}` : `/app/${encodeURIComponent(n)}/app-data`;
|
|
2200
|
+
return await this.request("GET", s, void 0, {}, !1);
|
|
2204
2201
|
}
|
|
2205
2202
|
/**
|
|
2206
|
-
* Get
|
|
2203
|
+
* 👥 Get all users data
|
|
2204
|
+
* Optional category filter
|
|
2205
|
+
*
|
|
2206
|
+
* Routes:
|
|
2207
|
+
* GET /api/app/:appId/users-data
|
|
2208
|
+
* GET /api/app/:appId/users-data/:category
|
|
2209
|
+
*/
|
|
2210
|
+
async getUsersData(e) {
|
|
2211
|
+
const n = this.appId;
|
|
2212
|
+
if (!n) throw new Error("getUsersData: 'appId' is required");
|
|
2213
|
+
const s = e ? `/app/${encodeURIComponent(n)}/users-data/${encodeURIComponent(e)}` : `/app/${encodeURIComponent(n)}/users-data`;
|
|
2214
|
+
return await this.request("GET", s, void 0, {}, !1);
|
|
2215
|
+
}
|
|
2216
|
+
/**
|
|
2217
|
+
* 🔍 Get single app data item by id
|
|
2218
|
+
*
|
|
2219
|
+
* Route:
|
|
2220
|
+
* GET /api/app/:appId/data/:itemId
|
|
2207
2221
|
*/
|
|
2208
2222
|
async getSingleAppData(e) {
|
|
2209
2223
|
const n = this.appId;
|
|
2210
2224
|
if (!n) throw new Error("getSingleAppData: 'appId' is required");
|
|
2211
|
-
if (!e
|
|
2225
|
+
if (!e?.dataId)
|
|
2212
2226
|
throw new Error("getSingleAppData: 'dataId' is required");
|
|
2213
2227
|
return await this.request(
|
|
2214
2228
|
"GET",
|
|
2215
|
-
`/app/${n}/data/${e.dataId}`,
|
|
2229
|
+
`/app/${encodeURIComponent(n)}/data/${encodeURIComponent(e.dataId)}`,
|
|
2216
2230
|
void 0,
|
|
2217
2231
|
{},
|
|
2218
2232
|
!1
|
|
2219
2233
|
);
|
|
2220
2234
|
}
|
|
2221
2235
|
/**
|
|
2222
|
-
* 🔍 Search app data
|
|
2236
|
+
* 🔍 Search app data by dynamic keys
|
|
2237
|
+
*
|
|
2238
|
+
* Route:
|
|
2239
|
+
* POST /api/app/:appId/data/searchByKeys
|
|
2223
2240
|
*/
|
|
2224
2241
|
async searchAppDataByKeys(e) {
|
|
2225
2242
|
const n = this.appId;
|
|
@@ -2228,14 +2245,17 @@ class li {
|
|
|
2228
2245
|
throw new Error("searchAppDataByKeys: params object is required");
|
|
2229
2246
|
return await this.request(
|
|
2230
2247
|
"POST",
|
|
2231
|
-
`/app/${encodeURIComponent(n)}/data/
|
|
2248
|
+
`/app/${encodeURIComponent(n)}/data/searchByKeys`,
|
|
2232
2249
|
e,
|
|
2233
2250
|
{},
|
|
2234
2251
|
!1
|
|
2235
2252
|
);
|
|
2236
2253
|
}
|
|
2237
2254
|
/**
|
|
2238
|
-
* Add
|
|
2255
|
+
* ➕ Add new app data item
|
|
2256
|
+
*
|
|
2257
|
+
* Route:
|
|
2258
|
+
* POST /api/app/:appId/data/:dataCategory
|
|
2239
2259
|
*/
|
|
2240
2260
|
async addAppData(e) {
|
|
2241
2261
|
const n = this.appId;
|
|
@@ -2247,38 +2267,47 @@ class li {
|
|
|
2247
2267
|
throw new Error("addAppData: 'data' is required");
|
|
2248
2268
|
return await this.request(
|
|
2249
2269
|
"POST",
|
|
2250
|
-
`/app/${n}/data/${encodeURIComponent(s)}`,
|
|
2270
|
+
`/app/${encodeURIComponent(n)}/data/${encodeURIComponent(s)}`,
|
|
2251
2271
|
{ item: i },
|
|
2252
2272
|
{},
|
|
2253
2273
|
!1
|
|
2254
2274
|
);
|
|
2255
2275
|
}
|
|
2256
2276
|
/**
|
|
2257
|
-
* Update
|
|
2277
|
+
* ✏️ Update app data item
|
|
2278
|
+
*
|
|
2279
|
+
* Route:
|
|
2280
|
+
* PATCH /api/app/:appId/data/:itemId
|
|
2258
2281
|
*/
|
|
2259
2282
|
async updateAppData(e) {
|
|
2260
2283
|
const n = this.appId;
|
|
2261
2284
|
if (!n) throw new Error("updateAppData: 'appId' is required");
|
|
2262
|
-
if (!e
|
|
2263
|
-
|
|
2285
|
+
if (!e?.dataId)
|
|
2286
|
+
throw new Error("updateAppData: 'dataId' is required");
|
|
2287
|
+
if (!e?.data || typeof e.data != "object")
|
|
2288
|
+
throw new Error("updateAppData: 'data' is required");
|
|
2264
2289
|
return await this.request(
|
|
2265
2290
|
"PATCH",
|
|
2266
|
-
`/app/${n}/data/${e.dataId}`,
|
|
2291
|
+
`/app/${encodeURIComponent(n)}/data/${encodeURIComponent(e.dataId)}`,
|
|
2267
2292
|
e.data,
|
|
2268
2293
|
{},
|
|
2269
2294
|
!1
|
|
2270
2295
|
);
|
|
2271
2296
|
}
|
|
2272
2297
|
/**
|
|
2273
|
-
* Delete
|
|
2298
|
+
* 🗑️ Delete app data item
|
|
2299
|
+
*
|
|
2300
|
+
* Route:
|
|
2301
|
+
* DELETE /api/app/:appId/data/:itemId
|
|
2274
2302
|
*/
|
|
2275
2303
|
async deleteAppData(e) {
|
|
2276
2304
|
const n = this.appId;
|
|
2277
2305
|
if (!n) throw new Error("deleteAppData: 'appId' is required");
|
|
2278
|
-
if (!e
|
|
2306
|
+
if (!e?.dataId)
|
|
2307
|
+
throw new Error("deleteAppData: 'dataId' is required");
|
|
2279
2308
|
return await this.request(
|
|
2280
2309
|
"DELETE",
|
|
2281
|
-
`/app/${n}/data/${e.dataId}`,
|
|
2310
|
+
`/app/${encodeURIComponent(n)}/data/${encodeURIComponent(e.dataId)}`,
|
|
2282
2311
|
void 0,
|
|
2283
2312
|
{},
|
|
2284
2313
|
!1
|
|
@@ -3742,7 +3771,7 @@ const Ns = [
|
|
|
3742
3771
|
const ne = "a_s_b", oe = "true", B = /* @__PURE__ */ new Date();
|
|
3743
3772
|
B.setTime(B.getTime() + 1440 * 60 * 1e3), document.cookie = `${ne}=${oe}; path=/; expires=${B.toUTCString()}; SameSite=Lax`;
|
|
3744
3773
|
}
|
|
3745
|
-
A({ type: "success", text: `Welcome ${$.name}` }), d?.($)
|
|
3774
|
+
A({ type: "success", text: `Welcome ${$.name}` }), d?.($);
|
|
3746
3775
|
} catch (S) {
|
|
3747
3776
|
const $ = S.message || "Login failed";
|
|
3748
3777
|
A({ type: "error", text: $ }), f?.(S);
|
|
@@ -4303,22 +4332,26 @@ const Ns = [
|
|
|
4303
4332
|
}) => {
|
|
4304
4333
|
const [n, s] = P("loading");
|
|
4305
4334
|
ee(() => {
|
|
4306
|
-
|
|
4335
|
+
if (typeof window > "u")
|
|
4336
|
+
return;
|
|
4337
|
+
const c = window.document.cookie.split(";").map((d) => d.trim()).find((d) => d.startsWith("a_s_b="))?.split("=")[1] === "true";
|
|
4307
4338
|
s(c ? "authenticated" : "unauthenticated");
|
|
4308
4339
|
}, []);
|
|
4309
4340
|
const i = (a) => typeof a == "function" ? a() : a;
|
|
4310
|
-
return n === "loading" ? null : n === "unauthenticated" ? i(e)
|
|
4341
|
+
return n === "loading" ? null : n === "unauthenticated" ? /* @__PURE__ */ r.jsx(r.Fragment, { children: i(e) }) : /* @__PURE__ */ r.jsx(r.Fragment, { children: t });
|
|
4311
4342
|
}, fi = ({
|
|
4312
4343
|
children: t,
|
|
4313
4344
|
fallback: e = null
|
|
4314
4345
|
}) => {
|
|
4315
4346
|
const [n, s] = P("loading");
|
|
4316
4347
|
ee(() => {
|
|
4317
|
-
|
|
4348
|
+
if (typeof window > "u")
|
|
4349
|
+
return;
|
|
4350
|
+
const c = window.document.cookie.split(";").map((d) => d.trim()).find((d) => d.startsWith("a_s_b="))?.split("=")[1] === "true";
|
|
4318
4351
|
s(c ? "authenticated" : "unauthenticated");
|
|
4319
4352
|
}, []);
|
|
4320
4353
|
const i = (a) => typeof a == "function" ? a() : a;
|
|
4321
|
-
return n === "loading" ? null : n === "authenticated" ? i(e)
|
|
4354
|
+
return n === "loading" ? null : n === "authenticated" ? /* @__PURE__ */ r.jsx(r.Fragment, { children: i(e) }) : /* @__PURE__ */ r.jsx(r.Fragment, { children: t });
|
|
4322
4355
|
}, Fs = ({
|
|
4323
4356
|
isOpen: t,
|
|
4324
4357
|
onClose: e,
|