andoncloud-sdk 1.7.32 → 1.7.33
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 +2 -0
- package/dist/index.js +25 -5
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -321,6 +321,7 @@ declare module 'andoncloud-sdk' {
|
|
|
321
321
|
features?: string[];
|
|
322
322
|
extraPermissions?: string[];
|
|
323
323
|
workplaceId?: string;
|
|
324
|
+
backgroundImage?: string;
|
|
324
325
|
onTrialRequest: (featureKey: string) => Promise<boolean>;
|
|
325
326
|
onFeatureRequest: (payload: FeatureRequestPayload) => Promise<boolean>;
|
|
326
327
|
children: React.ReactNode;
|
|
@@ -338,6 +339,7 @@ declare module 'andoncloud-sdk' {
|
|
|
338
339
|
featureKey: string;
|
|
339
340
|
daysSinceExpiry?: number;
|
|
340
341
|
workplaceId?: string;
|
|
342
|
+
backgroundImage?: string;
|
|
341
343
|
cooldownInfo?: CooldownInfo;
|
|
342
344
|
onTrialRequest: (featureKey: string) => Promise<boolean>;
|
|
343
345
|
onFeatureRequest: (payload: FeatureRequestPayload) => Promise<boolean>;
|
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
|