andoncloud-sdk 1.7.32 → 1.7.34
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 +11 -7
- package/dist/index.js +25 -5
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
package/dist/index.d.ts
CHANGED
|
@@ -5,10 +5,6 @@ import { SxProps, Theme } from '@mui/material/styles';
|
|
|
5
5
|
import * as Sentry from '@sentry/react';
|
|
6
6
|
import { InitOptions } from 'i18next';
|
|
7
7
|
|
|
8
|
-
import { CheckboxProps } from './core/ui/Checkbox';
|
|
9
|
-
import { RadioProps } from './core/ui/Radio';
|
|
10
|
-
import { RadioGroupProps } from './core/ui/RadioGroup';
|
|
11
|
-
|
|
12
8
|
declare module '@mui/material/styles' {
|
|
13
9
|
interface Palette {
|
|
14
10
|
gray: Palette['primary'];
|
|
@@ -321,6 +317,7 @@ declare module 'andoncloud-sdk' {
|
|
|
321
317
|
features?: string[];
|
|
322
318
|
extraPermissions?: string[];
|
|
323
319
|
workplaceId?: string;
|
|
320
|
+
backgroundImage?: string;
|
|
324
321
|
onTrialRequest: (featureKey: string) => Promise<boolean>;
|
|
325
322
|
onFeatureRequest: (payload: FeatureRequestPayload) => Promise<boolean>;
|
|
326
323
|
children: React.ReactNode;
|
|
@@ -338,6 +335,7 @@ declare module 'andoncloud-sdk' {
|
|
|
338
335
|
featureKey: string;
|
|
339
336
|
daysSinceExpiry?: number;
|
|
340
337
|
workplaceId?: string;
|
|
338
|
+
backgroundImage?: string;
|
|
341
339
|
cooldownInfo?: CooldownInfo;
|
|
342
340
|
onTrialRequest: (featureKey: string) => Promise<boolean>;
|
|
343
341
|
onFeatureRequest: (payload: FeatureRequestPayload) => Promise<boolean>;
|
|
@@ -440,11 +438,17 @@ declare module 'andoncloud-sdk' {
|
|
|
440
438
|
|
|
441
439
|
export const captureException: typeof Sentry.captureException;
|
|
442
440
|
|
|
443
|
-
|
|
441
|
+
// NOTE: Checkbox/Radio/RadioGroup types loosened to `any` because their
|
|
442
|
+
// source declarations live in src/core/ui/* which is not bundled into
|
|
443
|
+
// published dist (only dist/index.js + dist/index.d.ts ship). Restoring
|
|
444
|
+
// proper types requires either bundling .d.ts (via tsdown --dts or
|
|
445
|
+
// rollup-plugin-dts) or migrating SDK to TypeScript (tech-debt #4).
|
|
446
|
+
// Downstream consumers will see these as React.FC<any> until then.
|
|
447
|
+
export const Checkbox: React.FC<any>;
|
|
444
448
|
|
|
445
|
-
export const Radio: React.FC<
|
|
449
|
+
export const Radio: React.FC<any>;
|
|
446
450
|
|
|
447
|
-
export const RadioGroup: React.FC<
|
|
451
|
+
export const RadioGroup: React.FC<any>;
|
|
448
452
|
|
|
449
453
|
export const sidePanelDefaultProps: SidePanelProps;
|
|
450
454
|
}
|
package/dist/index.js
CHANGED
|
@@ -52,10 +52,11 @@ const ACCESS_STATE_COLORS = {
|
|
|
52
52
|
expired: "error.main",
|
|
53
53
|
not_purchased: "primary.main"
|
|
54
54
|
};
|
|
55
|
-
const makeStyles$1 = (accessState) => {
|
|
55
|
+
const makeStyles$1 = (accessState, backgroundImage) => {
|
|
56
56
|
const accentColor = ACCESS_STATE_COLORS[accessState] || "primary.main";
|
|
57
57
|
return {
|
|
58
58
|
container: {
|
|
59
|
+
position: "relative",
|
|
59
60
|
display: "flex",
|
|
60
61
|
flexDirection: "column",
|
|
61
62
|
alignItems: "center",
|
|
@@ -65,7 +66,25 @@ const makeStyles$1 = (accessState) => {
|
|
|
65
66
|
height: "100%",
|
|
66
67
|
padding: 4,
|
|
67
68
|
textAlign: "center",
|
|
68
|
-
background: (theme) => theme.palette.gradient.dark.main
|
|
69
|
+
background: (theme) => theme.palette.gradient.dark.main,
|
|
70
|
+
...backgroundImage && {
|
|
71
|
+
"&::before": {
|
|
72
|
+
content: "\"\"",
|
|
73
|
+
position: "absolute",
|
|
74
|
+
inset: 0,
|
|
75
|
+
backgroundImage: `url(${backgroundImage})`,
|
|
76
|
+
backgroundSize: "cover",
|
|
77
|
+
backgroundPosition: "center",
|
|
78
|
+
backgroundRepeat: "no-repeat",
|
|
79
|
+
filter: "blur(12px) brightness(0.35) saturate(0.7)",
|
|
80
|
+
pointerEvents: "none",
|
|
81
|
+
zIndex: 0
|
|
82
|
+
},
|
|
83
|
+
"& > *": {
|
|
84
|
+
position: "relative",
|
|
85
|
+
zIndex: 1
|
|
86
|
+
}
|
|
87
|
+
}
|
|
69
88
|
},
|
|
70
89
|
icon: {
|
|
71
90
|
fontSize: 48,
|
|
@@ -244,13 +263,13 @@ const ICONS = {
|
|
|
244
263
|
expired: HourglassEmptyIcon,
|
|
245
264
|
not_purchased: ShoppingCartIcon
|
|
246
265
|
};
|
|
247
|
-
const AccessBlocker = ({ accessState, buttons = [], daysSinceExpiry, featureKey, workplaceId, cooldownInfo = {}, onTrialRequest, onFeatureRequest }) => {
|
|
266
|
+
const AccessBlocker = ({ accessState, buttons = [], daysSinceExpiry, featureKey, workplaceId, backgroundImage, cooldownInfo = {}, onTrialRequest, onFeatureRequest }) => {
|
|
248
267
|
const { t } = useTranslation();
|
|
249
268
|
const [modalOpen, setModalOpen] = useState(false);
|
|
250
269
|
const [cooldownModalOpen, setCooldownModalOpen] = useState(false);
|
|
251
270
|
const [cooldownDays, setCooldownDays] = useState(0);
|
|
252
271
|
const [pendingAction, setPendingAction] = useState(null);
|
|
253
|
-
const styles = makeStyles$1(accessState);
|
|
272
|
+
const styles = makeStyles$1(accessState, backgroundImage);
|
|
254
273
|
const Icon = ICONS[accessState] || LockIcon;
|
|
255
274
|
const handleOpenModal = (button) => {
|
|
256
275
|
if (button.requestType && cooldownInfo[button.requestType]?.isInCooldown) {
|
|
@@ -686,7 +705,7 @@ const useAccess = (features = [], options = {}) => {
|
|
|
686
705
|
};
|
|
687
706
|
//#endregion
|
|
688
707
|
//#region src/components/access/AccessGuard.js
|
|
689
|
-
const AccessGuard = ({ features: featuresProp = [], extraPermissions = [], workplaceId, onTrialRequest, onFeatureRequest, children }) => {
|
|
708
|
+
const AccessGuard = ({ features: featuresProp = [], extraPermissions = [], workplaceId, backgroundImage, onTrialRequest, onFeatureRequest, children }) => {
|
|
690
709
|
const { hasAccess, accessState, buttons, cooldownInfo, features } = useAccess(featuresProp, {
|
|
691
710
|
extraPermissions,
|
|
692
711
|
workplaceId
|
|
@@ -701,6 +720,7 @@ const AccessGuard = ({ features: featuresProp = [], extraPermissions = [], workp
|
|
|
701
720
|
daysSinceExpiry,
|
|
702
721
|
featureKey,
|
|
703
722
|
workplaceId,
|
|
723
|
+
backgroundImage,
|
|
704
724
|
cooldownInfo,
|
|
705
725
|
onTrialRequest,
|
|
706
726
|
onFeatureRequest
|