analytica.click 0.0.261 → 0.0.262
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.d.ts +0 -8
- package/dist/index.js +46 -42
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
@@ -216,14 +216,6 @@ declare module 'analytica.click/ui-npm/src/components/UserProvider/refreshToken'
|
|
216
216
|
logout: () => void;
|
217
217
|
}): Promise<User | undefined>;
|
218
218
|
|
219
|
-
}
|
220
|
-
declare module 'analytica.click/ui-npm/src/components/UserProvider/useGranularHook' {
|
221
|
-
import { DependencyList, EffectCallback } from 'react';
|
222
|
-
type HookWithDependencies<C, R> = (callback: C, deps: DependencyList) => R;
|
223
|
-
export const useGranularHook: <T extends HookWithDependencies<C, ReturnType<T>>, C>(hook: T, callback: C, primaryDeps: DependencyList, secondaryDeps: DependencyList) => ReturnType<T>;
|
224
|
-
export const useGranularEffect: (effect: EffectCallback, primaryDeps: DependencyList, secondaryDeps: DependencyList) => void;
|
225
|
-
export {};
|
226
|
-
|
227
219
|
}
|
228
220
|
declare module 'analytica.click/ui-npm/src/components/index' {
|
229
221
|
export * from 'analytica.click/ui-npm/src/components/AnalyticaConfig/index';
|
package/dist/index.js
CHANGED
@@ -936,6 +936,7 @@ var errorTrack = (_0) => __async(void 0, [_0], function* ({
|
|
936
936
|
|
937
937
|
// src/components/AnalyticaConfig/index.tsx
|
938
938
|
var import_react = __toESM(require("react"));
|
939
|
+
var import_jsx_runtime = require("react/jsx-runtime");
|
939
940
|
var stubState = {
|
940
941
|
analyticaToken: void 0,
|
941
942
|
overrideBaseUrl: void 0
|
@@ -975,9 +976,10 @@ var AnalyticaConfigProvider = ({
|
|
975
976
|
(0, import_react.useEffect)(() => {
|
976
977
|
overloadConsole(values);
|
977
978
|
}, []);
|
978
|
-
return /* @__PURE__ */
|
979
|
-
value: state
|
980
|
-
|
979
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(AnalyticaConfigContext.Provider, {
|
980
|
+
value: state,
|
981
|
+
children
|
982
|
+
});
|
981
983
|
};
|
982
984
|
|
983
985
|
// src/helpers/log.ts
|
@@ -1147,8 +1149,9 @@ var useTrack = () => {
|
|
1147
1149
|
|
1148
1150
|
// src/components/ErrorBoundary/index.tsx
|
1149
1151
|
var import_ErrorBoundary = __toESM(require_ErrorBoundary());
|
1150
|
-
var import_react4 =
|
1152
|
+
var import_react4 = require("react");
|
1151
1153
|
var import_log6 = require("ag-common/dist/common/helpers/log");
|
1154
|
+
var import_jsx_runtime = require("react/jsx-runtime");
|
1152
1155
|
function onBrowserError(_0) {
|
1153
1156
|
return __async(this, arguments, function* ({
|
1154
1157
|
ev,
|
@@ -1193,9 +1196,11 @@ var ErrorBoundary = ({
|
|
1193
1196
|
}, [analyticaToken, filterBrowserError]);
|
1194
1197
|
if (!analyticaToken) {
|
1195
1198
|
(0, import_log6.warn)(tokenMissing("ErrorBoundary"));
|
1196
|
-
return /* @__PURE__ */
|
1199
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_jsx_runtime.Fragment, {
|
1200
|
+
children
|
1201
|
+
});
|
1197
1202
|
}
|
1198
|
-
return /* @__PURE__ */
|
1203
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_ErrorBoundary.ErrorBoundary, {
|
1199
1204
|
notify: (data) => __async(void 0, null, function* () {
|
1200
1205
|
const { href } = window.location;
|
1201
1206
|
yield errorTrack({
|
@@ -1206,8 +1211,9 @@ var ErrorBoundary = ({
|
|
1206
1211
|
})
|
1207
1212
|
}
|
1208
1213
|
});
|
1209
|
-
})
|
1210
|
-
|
1214
|
+
}),
|
1215
|
+
children
|
1216
|
+
});
|
1211
1217
|
};
|
1212
1218
|
|
1213
1219
|
// src/components/ExternalComponent/index.tsx
|
@@ -1215,6 +1221,7 @@ var import_react5 = __toESM(require("react"));
|
|
1215
1221
|
var import_createRequires = require("@paciolan/remote-component/dist/createRequires");
|
1216
1222
|
var import_useRemoteComponent = require("@paciolan/remote-component/dist/hooks/useRemoteComponent");
|
1217
1223
|
var import_react_dom = __toESM(require("react-dom"));
|
1224
|
+
var import_jsx_runtime = require("react/jsx-runtime");
|
1218
1225
|
var styled = require("styled-components");
|
1219
1226
|
var cache = {};
|
1220
1227
|
var ExternalComponent = ({
|
@@ -1237,19 +1244,25 @@ var ExternalComponent = ({
|
|
1237
1244
|
if (!cache[url] && !loading && !error2 && Component) {
|
1238
1245
|
cache[url] = Component;
|
1239
1246
|
}
|
1240
|
-
return /* @__PURE__ */
|
1247
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, {
|
1248
|
+
children: [
|
1249
|
+
!loading && !error2 && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Component, __spreadValues({}, props)),
|
1250
|
+
error2 && error2
|
1251
|
+
]
|
1252
|
+
});
|
1241
1253
|
};
|
1242
1254
|
|
1243
1255
|
// src/components/Feedback/index.tsx
|
1244
|
-
var import_react6 =
|
1256
|
+
var import_react6 = require("react");
|
1245
1257
|
var import_log7 = require("ag-common/dist/common/helpers/log");
|
1258
|
+
var import_jsx_runtime = require("react/jsx-runtime");
|
1246
1259
|
var Feedback = (props) => {
|
1247
1260
|
const { analyticaToken, overrideBaseUrl, devMode } = (0, import_react6.useContext)(
|
1248
1261
|
AnalyticaConfigContext
|
1249
1262
|
);
|
1250
1263
|
if (!analyticaToken) {
|
1251
1264
|
(0, import_log7.warn)(tokenMissing("Feedback"));
|
1252
|
-
return /* @__PURE__ */
|
1265
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_jsx_runtime.Fragment, {});
|
1253
1266
|
}
|
1254
1267
|
const int = __spreadProps(__spreadValues({}, props), {
|
1255
1268
|
submitFeedback: feedback,
|
@@ -1260,7 +1273,7 @@ var Feedback = (props) => {
|
|
1260
1273
|
if (devMode) {
|
1261
1274
|
url = `/feedback.js`;
|
1262
1275
|
}
|
1263
|
-
return /* @__PURE__ */
|
1276
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ExternalComponent, {
|
1264
1277
|
url,
|
1265
1278
|
props: int
|
1266
1279
|
});
|
@@ -1410,26 +1423,15 @@ function getTokensFromCode(_0) {
|
|
1410
1423
|
});
|
1411
1424
|
}
|
1412
1425
|
|
1413
|
-
// src/components/UserProvider/useGranularHook.ts
|
1414
|
-
var import_react7 = require("react");
|
1415
|
-
var useGranularHook = (hook, callback, primaryDeps, secondaryDeps) => {
|
1416
|
-
const ref = (0, import_react7.useRef)();
|
1417
|
-
if (!ref.current || !primaryDeps.every((w, i) => {
|
1418
|
-
var _a2;
|
1419
|
-
return Object.is(w, (_a2 = ref.current) == null ? void 0 : _a2[i]);
|
1420
|
-
}))
|
1421
|
-
ref.current = [...primaryDeps, ...secondaryDeps];
|
1422
|
-
return hook(callback, ref.current);
|
1423
|
-
};
|
1424
|
-
var useGranularEffect = (effect, primaryDeps, secondaryDeps) => useGranularHook(import_react7.useEffect, effect, primaryDeps, secondaryDeps);
|
1425
|
-
|
1426
1426
|
// src/components/UserProvider/index.tsx
|
1427
1427
|
var import_log9 = require("ag-common/dist/common/helpers/log");
|
1428
|
-
var
|
1428
|
+
var import_react7 = __toESM(require("react"));
|
1429
1429
|
var import_useLocalStorage = require("ag-common/dist/ui/helpers/useLocalStorage");
|
1430
1430
|
var import_cookie = require("ag-common/dist/ui/helpers/cookie");
|
1431
1431
|
var import_dom3 = __toESM(require_dom());
|
1432
|
-
var
|
1432
|
+
var import_useGranularHook = require("ag-common/dist/ui/helpers/useGranularHook");
|
1433
|
+
var import_jsx_runtime = require("react/jsx-runtime");
|
1434
|
+
var CognitoAuthContext = import_react7.default.createContext(
|
1433
1435
|
void 0
|
1434
1436
|
);
|
1435
1437
|
var getStatefulUrl = ({
|
@@ -1461,7 +1463,7 @@ var CognitoAuthProvider = ({
|
|
1461
1463
|
cookieDocument
|
1462
1464
|
}) => {
|
1463
1465
|
var _a2, _b;
|
1464
|
-
const [error2, setError] = (0,
|
1466
|
+
const [error2, setError] = (0, import_react7.useState)();
|
1465
1467
|
const [idTokenRaw, setIdToken] = (0, import_cookie.useCookieString)({
|
1466
1468
|
name: "id_token",
|
1467
1469
|
cookieDocument: typeof window === "undefined" ? cookieDocument : void 0,
|
@@ -1482,7 +1484,7 @@ var CognitoAuthProvider = ({
|
|
1482
1484
|
setUserRaw(value2);
|
1483
1485
|
return;
|
1484
1486
|
};
|
1485
|
-
const [loading, setLoading] = (0,
|
1487
|
+
const [loading, setLoading] = (0, import_react7.useState)(false);
|
1486
1488
|
const qs = (0, import_dom3.extractQs)({
|
1487
1489
|
search: typeof window === "undefined" ? "" : window.location.search,
|
1488
1490
|
sanatise: false
|
@@ -1497,7 +1499,7 @@ var CognitoAuthProvider = ({
|
|
1497
1499
|
yield goToPageUrl({ url: location.origin, login: false });
|
1498
1500
|
setLoading(false);
|
1499
1501
|
});
|
1500
|
-
(0,
|
1502
|
+
(0, import_react7.useEffect)(() => {
|
1501
1503
|
var _a3;
|
1502
1504
|
const newT = (_a3 = user == null ? void 0 : user.jwt) == null ? void 0 : _a3.id_token;
|
1503
1505
|
if (!!newT && newT !== idToken) {
|
@@ -1523,7 +1525,7 @@ var CognitoAuthProvider = ({
|
|
1523
1525
|
login: true
|
1524
1526
|
});
|
1525
1527
|
});
|
1526
|
-
useGranularEffect(
|
1528
|
+
(0, import_useGranularHook.useGranularEffect)(
|
1527
1529
|
() => {
|
1528
1530
|
function run() {
|
1529
1531
|
return __async(this, null, function* () {
|
@@ -1609,7 +1611,7 @@ var CognitoAuthProvider = ({
|
|
1609
1611
|
user
|
1610
1612
|
]
|
1611
1613
|
);
|
1612
|
-
(0,
|
1614
|
+
(0, import_react7.useEffect)(() => {
|
1613
1615
|
var _a3;
|
1614
1616
|
if (error2) {
|
1615
1617
|
(0, import_log9.error)(JSON.stringify(error2));
|
@@ -1634,17 +1636,19 @@ var CognitoAuthProvider = ({
|
|
1634
1636
|
error: error2,
|
1635
1637
|
user
|
1636
1638
|
};
|
1637
|
-
return /* @__PURE__ */
|
1638
|
-
value
|
1639
|
-
|
1639
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(CognitoAuthContext.Provider, {
|
1640
|
+
value,
|
1641
|
+
children
|
1642
|
+
});
|
1640
1643
|
};
|
1641
1644
|
|
1642
1645
|
// src/components/UserProvider/DashboardAuthValidation.tsx
|
1643
1646
|
var import_log10 = require("ag-common/dist/common/helpers/log");
|
1644
1647
|
var import_string = require("ag-common/dist/common/helpers/string");
|
1645
1648
|
var import_Loader = require("ag-common/dist/ui/components/Loader");
|
1649
|
+
var import_useGranularHook2 = require("ag-common/dist/ui/helpers/useGranularHook");
|
1646
1650
|
var import_useQueryString = require("ag-common/dist/ui/helpers/useQueryString");
|
1647
|
-
var
|
1651
|
+
var import_jsx_runtime = require("react/jsx-runtime");
|
1648
1652
|
var DashboardAuthValidation = ({
|
1649
1653
|
rc: { request, pushPath },
|
1650
1654
|
cac: {
|
@@ -1658,7 +1662,7 @@ var DashboardAuthValidation = ({
|
|
1658
1662
|
getUnauthedPage,
|
1659
1663
|
addToast
|
1660
1664
|
}) => {
|
1661
|
-
useGranularEffect(
|
1665
|
+
(0, import_useGranularHook2.useGranularEffect)(
|
1662
1666
|
() => {
|
1663
1667
|
if (authError) {
|
1664
1668
|
const emailOption = authError.message.includes("email") ? ` We require the use of your email for the functionality of this app.
|
@@ -1680,24 +1684,24 @@ var DashboardAuthValidation = ({
|
|
1680
1684
|
if (forceLogin) {
|
1681
1685
|
if (!isAuthenticated) {
|
1682
1686
|
void loginWithRedirect(request.url.query.state);
|
1683
|
-
return { render: /* @__PURE__ */
|
1687
|
+
return { render: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_jsx_runtime.Fragment, {}), openApiDisabled: true };
|
1684
1688
|
}
|
1685
1689
|
if (isAuthenticated) {
|
1686
1690
|
void pushPath(getDashboardPath());
|
1687
|
-
return { render: /* @__PURE__ */
|
1691
|
+
return { render: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_jsx_runtime.Fragment, {}), openApiDisabled: true };
|
1688
1692
|
}
|
1689
1693
|
}
|
1690
1694
|
if (request.url.query.state && isAuthenticated) {
|
1691
1695
|
const decoded = JSON.parse((0, import_string.fromBase64)(request.url.query.state));
|
1692
1696
|
if (decoded.redirect) {
|
1693
1697
|
void pushPath(decoded.redirect);
|
1694
|
-
return { render: /* @__PURE__ */
|
1698
|
+
return { render: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_jsx_runtime.Fragment, {}), openApiDisabled: true };
|
1695
1699
|
}
|
1696
1700
|
}
|
1697
1701
|
const serverAuthLoading = import_useQueryString.isServer && !authError && !authLoading && !isAuthenticated && Object.keys(request.url.query || {}).includes("code");
|
1698
1702
|
if (authLoading || serverAuthLoading) {
|
1699
1703
|
return {
|
1700
|
-
render: /* @__PURE__ */
|
1704
|
+
render: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_Loader.Loader, {
|
1701
1705
|
name: "authload"
|
1702
1706
|
}),
|
1703
1707
|
openApiDisabled: true
|
@@ -1705,7 +1709,7 @@ var DashboardAuthValidation = ({
|
|
1705
1709
|
}
|
1706
1710
|
if (!isAuthenticated && !authLoading && !authError && getUnauthedPage) {
|
1707
1711
|
void pushPath(getUnauthedPage());
|
1708
|
-
return { render: /* @__PURE__ */
|
1712
|
+
return { render: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_jsx_runtime.Fragment, {}), openApiDisabled: true };
|
1709
1713
|
}
|
1710
1714
|
const openApiDisabled = !isAuthenticated || authLoading || !!authError;
|
1711
1715
|
return { openApiDisabled };
|