@ianua/ianus-dataverse-react-fluentui8 1.0.13 → 1.0.14
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 +42 -11
- package/dist/index.js +128 -36
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -56,6 +56,36 @@ type LicenseValidationSuccess = {
|
|
|
56
56
|
type LicenseValidationResult = LicenseValidationError | LicenseValidationSuccess;
|
|
57
57
|
|
|
58
58
|
type EnvironmentType = "entra" | "dataverse";
|
|
59
|
+
type EnvironmentEntry = {
|
|
60
|
+
type: EnvironmentType;
|
|
61
|
+
identifier: string;
|
|
62
|
+
name: string;
|
|
63
|
+
};
|
|
64
|
+
type PrefillData = {
|
|
65
|
+
additionalEnvironments: Array<EnvironmentEntry>;
|
|
66
|
+
emailAddress: string;
|
|
67
|
+
};
|
|
68
|
+
type LicenseAcquisitionConfig = {
|
|
69
|
+
/**
|
|
70
|
+
* Pass 'url' to open the Ianus Guard self-service trial page or 'contact' to just pass an instruction
|
|
71
|
+
*/
|
|
72
|
+
type: "url" | "contact";
|
|
73
|
+
/**
|
|
74
|
+
* Title for the contact dialog
|
|
75
|
+
* @default "Request a Trial License"
|
|
76
|
+
*/
|
|
77
|
+
title?: string;
|
|
78
|
+
/**
|
|
79
|
+
* Instructions or message to show in the dialog, you can pass a string or any react element
|
|
80
|
+
* @example "To request a trial license, please send an email to trials@yourcompany.com with your organization details."
|
|
81
|
+
*/
|
|
82
|
+
instruction: React.ReactElement | React.ReactNode;
|
|
83
|
+
/**
|
|
84
|
+
* Additional data to pass to Ianus Guard when acquiring a trial to ease license acquisition.
|
|
85
|
+
* You can add additional environments (such as the entra environment) and the current user's email address for example.
|
|
86
|
+
*/
|
|
87
|
+
prefillData?: PrefillData;
|
|
88
|
+
};
|
|
59
89
|
interface IIanusGuardProps {
|
|
60
90
|
/**
|
|
61
91
|
* The external publisher Guid found on the publisher's Ianus Guard portal form
|
|
@@ -91,6 +121,10 @@ interface IIanusGuardProps {
|
|
|
91
121
|
* For canvas apps, use the DataSourceInfo PowerFX function, for PCFs use pcfContext.utils.getEntityMetadata for loading the metadata followed by pcfContext.utils.hasEntityPrivilege for getting the permission result.
|
|
92
122
|
*/
|
|
93
123
|
usagePermission?: boolean | null;
|
|
124
|
+
/**
|
|
125
|
+
* Pass this if you want to show instructions for the user on how to obtain a license
|
|
126
|
+
*/
|
|
127
|
+
licenseAcquisitionConfig?: LicenseAcquisitionConfig;
|
|
94
128
|
/**
|
|
95
129
|
* Optionally pass a callback which is called when a license validation result was generated
|
|
96
130
|
*
|
|
@@ -104,20 +138,17 @@ declare const isDataset: (dataProvider: ComponentFramework.WebApi | ComponentFra
|
|
|
104
138
|
declare const acquireLicenses: (publisherId: string, productId: string, dataProvider: ComponentFramework.WebApi | ComponentFramework.PropertyTypes.DataSet) => Promise<ComponentFramework.WebApi.Entity[]>;
|
|
105
139
|
declare const IanusGuard: React.FC<IIanusGuardProps>;
|
|
106
140
|
|
|
141
|
+
type AvailableDialogs = "debug" | "license_details" | "license_acquisition";
|
|
142
|
+
type IanusLicenseStateProps = {
|
|
143
|
+
license?: DataverseLicenseValidationResult;
|
|
144
|
+
visibleDialog?: AvailableDialogs;
|
|
145
|
+
};
|
|
107
146
|
type Action = {
|
|
108
147
|
type: "setLicense";
|
|
109
148
|
payload: DataverseLicenseValidationResult | undefined;
|
|
110
149
|
} | {
|
|
111
|
-
type: "
|
|
112
|
-
payload:
|
|
113
|
-
} | {
|
|
114
|
-
type: "setDebugDialogVisible";
|
|
115
|
-
payload: boolean;
|
|
116
|
-
};
|
|
117
|
-
type IanusLicenseStateProps = {
|
|
118
|
-
license?: DataverseLicenseValidationResult;
|
|
119
|
-
licenseDialogVisible?: boolean;
|
|
120
|
-
debugDialogVisible?: boolean;
|
|
150
|
+
type: "setVisibleDialog";
|
|
151
|
+
payload: AvailableDialogs | undefined;
|
|
121
152
|
};
|
|
122
153
|
type IanusLicenseDispatch = (action: Action) => void;
|
|
123
154
|
declare const IanusLicenseDispatch: React.Context<IanusLicenseDispatch | undefined>;
|
|
@@ -145,4 +176,4 @@ declare const removeCurlyBrackets: (input: string | undefined | null) => string
|
|
|
145
176
|
declare const base64url_decode: (value: string) => ArrayBuffer;
|
|
146
177
|
declare const validateLicense: (publisherId: string, productId: string, environmentType: string, environmentIdentifier: string, publicKeys: string[], licenseKey: string | undefined) => Promise<LicenseValidationResult>;
|
|
147
178
|
|
|
148
|
-
export { type DataverseLicenseValidationError, type DataverseLicenseValidationResult, type DataverseLicenseValidationSuccess, type EnvironmentType, type IEnvironmentIdentifier, type IIanusGuardProps, type IIanusProviderProps, type ILicenseClaims, type ILicenseDialogProps, type IMeta, IanusGuard, IanusLicenseDispatch, type IanusLicenseStateProps, IanusLicenseStateProvider, IanusProvider, LicenseDialog, type LicenseValidationError, type LicenseValidationResult, type LicenseValidationSuccess, acquireLicenses, base64url_decode, isDataset, isWebApi, removeCurlyBrackets, useLicenseContext, useLicenseDispatch, useLicenseState, validateLicense };
|
|
179
|
+
export { type AvailableDialogs, type DataverseLicenseValidationError, type DataverseLicenseValidationResult, type DataverseLicenseValidationSuccess, type EnvironmentEntry, type EnvironmentType, type IEnvironmentIdentifier, type IIanusGuardProps, type IIanusProviderProps, type ILicenseClaims, type ILicenseDialogProps, type IMeta, IanusGuard, IanusLicenseDispatch, type IanusLicenseStateProps, IanusLicenseStateProvider, IanusProvider, type LicenseAcquisitionConfig, LicenseDialog, type LicenseValidationError, type LicenseValidationResult, type LicenseValidationSuccess, type PrefillData, acquireLicenses, base64url_decode, isDataset, isWebApi, removeCurlyBrackets, useLicenseContext, useLicenseDispatch, useLicenseState, validateLicense };
|
package/dist/index.js
CHANGED
|
@@ -84,7 +84,7 @@ __export(index_exports, {
|
|
|
84
84
|
module.exports = __toCommonJS(index_exports);
|
|
85
85
|
|
|
86
86
|
// src/IanusGuard.tsx
|
|
87
|
-
var
|
|
87
|
+
var React5 = __toESM(require("react"));
|
|
88
88
|
var import_MessageBar = require("@fluentui/react/lib/MessageBar");
|
|
89
89
|
var import_Button = require("@fluentui/react/lib/Button");
|
|
90
90
|
var import_Spinner = require("@fluentui/react/lib/Spinner");
|
|
@@ -239,11 +239,8 @@ function stateReducer(state, action) {
|
|
|
239
239
|
case "setLicense": {
|
|
240
240
|
return __spreadProps(__spreadValues({}, state), { license: action.payload });
|
|
241
241
|
}
|
|
242
|
-
case "
|
|
243
|
-
return __spreadProps(__spreadValues({}, state), {
|
|
244
|
-
}
|
|
245
|
-
case "setDebugDialogVisible": {
|
|
246
|
-
return __spreadProps(__spreadValues({}, state), { debugDialogVisible: action.payload });
|
|
242
|
+
case "setVisibleDialog": {
|
|
243
|
+
return __spreadProps(__spreadValues({}, state), { visibleDialog: action.payload });
|
|
247
244
|
}
|
|
248
245
|
}
|
|
249
246
|
}
|
|
@@ -385,7 +382,7 @@ var LicenseDialog = ({ publisherId, productId, dataProvider, offlineDataProvider
|
|
|
385
382
|
return /* @__PURE__ */ React2.createElement(
|
|
386
383
|
import_react.Dialog,
|
|
387
384
|
{
|
|
388
|
-
hidden:
|
|
385
|
+
hidden: (licenseState == null ? void 0 : licenseState.visibleDialog) !== "license_details",
|
|
389
386
|
onDismiss: onCancel,
|
|
390
387
|
dialogContentProps,
|
|
391
388
|
modalProps
|
|
@@ -455,7 +452,7 @@ var DebugDialog = ({ publisherId, productId, environmentType, environmentIdentif
|
|
|
455
452
|
return /* @__PURE__ */ React3.createElement(
|
|
456
453
|
import_react2.Dialog,
|
|
457
454
|
{
|
|
458
|
-
hidden:
|
|
455
|
+
hidden: (licenseState == null ? void 0 : licenseState.visibleDialog) !== "debug",
|
|
459
456
|
onDismiss,
|
|
460
457
|
dialogContentProps: dialogContentProps2,
|
|
461
458
|
modalProps: modalProps2
|
|
@@ -483,6 +480,95 @@ var DebugDialog = ({ publisherId, productId, environmentType, environmentIdentif
|
|
|
483
480
|
);
|
|
484
481
|
};
|
|
485
482
|
|
|
483
|
+
// src/LicenseAcquisitionDialog.tsx
|
|
484
|
+
var React4 = __toESM(require("react"));
|
|
485
|
+
var import_react3 = require("@fluentui/react");
|
|
486
|
+
var modalProps3 = {
|
|
487
|
+
isBlocking: false,
|
|
488
|
+
styles: { main: { maxWidth: 600 } }
|
|
489
|
+
};
|
|
490
|
+
var LicenseAcquisitionDialog = ({
|
|
491
|
+
config,
|
|
492
|
+
publisherId,
|
|
493
|
+
productId,
|
|
494
|
+
environmentType,
|
|
495
|
+
environmentIdentifier
|
|
496
|
+
}) => {
|
|
497
|
+
var _a;
|
|
498
|
+
const [licenseState, licenseDispatch] = useLicenseContext();
|
|
499
|
+
const [error, setError] = React4.useState();
|
|
500
|
+
const onDismiss = React4.useCallback(() => {
|
|
501
|
+
setError(void 0);
|
|
502
|
+
licenseDispatch({ type: "setVisibleDialog", payload: void 0 });
|
|
503
|
+
}, [licenseDispatch]);
|
|
504
|
+
const onOpenTrialPage = React4.useCallback(() => {
|
|
505
|
+
var _a2, _b, _c;
|
|
506
|
+
setError(void 0);
|
|
507
|
+
if ((config == null ? void 0 : config.type) !== "url") {
|
|
508
|
+
setError("Configuration error: Trial page cannot be opened for this license acquisition type.");
|
|
509
|
+
return;
|
|
510
|
+
}
|
|
511
|
+
if (!environmentIdentifier) {
|
|
512
|
+
setError("Environment identifier is missing. Please try again or contact support.");
|
|
513
|
+
return;
|
|
514
|
+
}
|
|
515
|
+
try {
|
|
516
|
+
const currentEnvironment = {
|
|
517
|
+
type: environmentType,
|
|
518
|
+
identifier: environmentIdentifier,
|
|
519
|
+
name: environmentType === "entra" ? "Entra ID Tenant" : "Dataverse Environment"
|
|
520
|
+
};
|
|
521
|
+
const allEnvironments = [
|
|
522
|
+
currentEnvironment,
|
|
523
|
+
...(_b = (_a2 = config == null ? void 0 : config.prefillData) == null ? void 0 : _a2.additionalEnvironments) != null ? _b : []
|
|
524
|
+
];
|
|
525
|
+
const uniqueEnvironments = allEnvironments.filter(
|
|
526
|
+
(env, index, self) => index === self.findIndex((e) => e.identifier.toLowerCase() === env.identifier.toLowerCase())
|
|
527
|
+
);
|
|
528
|
+
const prefillData = {
|
|
529
|
+
emailAddress: (_c = config == null ? void 0 : config.prefillData) == null ? void 0 : _c.emailAddress,
|
|
530
|
+
environments: uniqueEnvironments
|
|
531
|
+
};
|
|
532
|
+
const portalUrl = "https://www.ianusguard.com";
|
|
533
|
+
const url = `${portalUrl}/public/publishers/${publisherId}/products/${productId}?prefill=${encodeURIComponent(JSON.stringify(prefillData))}`;
|
|
534
|
+
const newWindow = window.open(url, "_blank", "noopener,noreferrer");
|
|
535
|
+
if (!newWindow || newWindow.closed || typeof newWindow.closed === "undefined") {
|
|
536
|
+
setError("Failed to open trial page. Please check if popup blockers are enabled and allow popups for this site.");
|
|
537
|
+
return;
|
|
538
|
+
}
|
|
539
|
+
onDismiss();
|
|
540
|
+
} catch (err) {
|
|
541
|
+
console.error("Failed to open trial page:", err);
|
|
542
|
+
setError(`Failed to open trial page: ${err instanceof Error ? err.message : "Unknown error occurred"}`);
|
|
543
|
+
}
|
|
544
|
+
}, [config, environmentType, environmentIdentifier, publisherId, productId, onDismiss]);
|
|
545
|
+
if (!config) {
|
|
546
|
+
return null;
|
|
547
|
+
}
|
|
548
|
+
return /* @__PURE__ */ React4.createElement(
|
|
549
|
+
import_react3.Dialog,
|
|
550
|
+
{
|
|
551
|
+
hidden: (licenseState == null ? void 0 : licenseState.visibleDialog) !== "license_acquisition",
|
|
552
|
+
onDismiss,
|
|
553
|
+
dialogContentProps: {
|
|
554
|
+
type: import_react3.DialogType.largeHeader,
|
|
555
|
+
title: (_a = config.title) != null ? _a : "Acquire a License"
|
|
556
|
+
},
|
|
557
|
+
modalProps: modalProps3
|
|
558
|
+
},
|
|
559
|
+
/* @__PURE__ */ React4.createElement(import_react3.Stack, { tokens: { childrenGap: 16 } }, error && /* @__PURE__ */ React4.createElement(
|
|
560
|
+
import_react3.MessageBar,
|
|
561
|
+
{
|
|
562
|
+
messageBarType: import_react3.MessageBarType.error,
|
|
563
|
+
isMultiline: true,
|
|
564
|
+
onDismiss: () => setError(void 0)
|
|
565
|
+
},
|
|
566
|
+
error
|
|
567
|
+
), typeof config.instruction === "string" ? /* @__PURE__ */ React4.createElement(import_react3.Text, null, config.instruction) : config.instruction),
|
|
568
|
+
/* @__PURE__ */ React4.createElement(import_react3.DialogFooter, null, config.type === "url" ? /* @__PURE__ */ React4.createElement(React4.Fragment, null, /* @__PURE__ */ React4.createElement(import_react3.PrimaryButton, { onClick: onOpenTrialPage, text: "Open Trial Request Page" }), /* @__PURE__ */ React4.createElement(import_react3.DefaultButton, { onClick: onDismiss, text: "Close" })) : /* @__PURE__ */ React4.createElement(import_react3.PrimaryButton, { onClick: onDismiss, text: "Close" }))
|
|
569
|
+
);
|
|
570
|
+
};
|
|
571
|
+
|
|
486
572
|
// src/IanusGuard.tsx
|
|
487
573
|
var isWebApi = (dataProvider) => {
|
|
488
574
|
return (dataProvider == null ? void 0 : dataProvider.retrieveMultipleRecords) !== void 0;
|
|
@@ -518,22 +604,28 @@ var fetchOrganizationIdFromWebApi = (webApi) => __async(null, null, function* ()
|
|
|
518
604
|
const organization = results.entities[0];
|
|
519
605
|
return organization.organizationid.replace("{", "").replace("}", "").toLowerCase();
|
|
520
606
|
});
|
|
521
|
-
var IanusGuard = ({ publisherId, productId, publicKeys, environmentType, environmentIdentifier, dataProvider, offlineDataProvider, usagePermission, onLicenseValidated, children }) => {
|
|
522
|
-
var _a, _b, _c, _d, _e;
|
|
607
|
+
var IanusGuard = ({ publisherId, productId, publicKeys, environmentType, environmentIdentifier, dataProvider, offlineDataProvider, usagePermission, licenseAcquisitionConfig, onLicenseValidated, children }) => {
|
|
608
|
+
var _a, _b, _c, _d, _e, _f;
|
|
523
609
|
const [licenseState, licenseDispatch] = useLicenseContext();
|
|
524
|
-
const onLicenseValidatedRef =
|
|
525
|
-
|
|
610
|
+
const onLicenseValidatedRef = React5.useRef(onLicenseValidated);
|
|
611
|
+
React5.useEffect(() => {
|
|
526
612
|
onLicenseValidatedRef.current = onLicenseValidated;
|
|
527
613
|
}, [onLicenseValidated]);
|
|
528
|
-
const publicKeysRef =
|
|
529
|
-
|
|
614
|
+
const publicKeysRef = React5.useRef(publicKeys);
|
|
615
|
+
React5.useEffect(() => {
|
|
530
616
|
if (JSON.stringify(publicKeys) !== JSON.stringify(publicKeysRef.current)) {
|
|
531
617
|
publicKeysRef.current = publicKeys;
|
|
532
618
|
}
|
|
533
619
|
}, [publicKeys]);
|
|
534
|
-
const
|
|
535
|
-
|
|
536
|
-
|
|
620
|
+
const licenseAcquisitionConfigRef = React5.useRef(licenseAcquisitionConfig);
|
|
621
|
+
React5.useEffect(() => {
|
|
622
|
+
if (JSON.stringify(licenseAcquisitionConfig) !== JSON.stringify(licenseAcquisitionConfigRef.current)) {
|
|
623
|
+
licenseAcquisitionConfigRef.current = licenseAcquisitionConfig;
|
|
624
|
+
}
|
|
625
|
+
}, [licenseAcquisitionConfig]);
|
|
626
|
+
const resolvedEnvironmentIdentifierRef = React5.useRef(null);
|
|
627
|
+
const preventAutomaticReevaluation = React5.useRef(false);
|
|
628
|
+
const handleValidationResult = React5.useCallback((result) => {
|
|
537
629
|
var _a2;
|
|
538
630
|
preventAutomaticReevaluation.current = (_a2 = result == null ? void 0 : result.isValid) != null ? _a2 : false;
|
|
539
631
|
if (onLicenseValidatedRef.current) {
|
|
@@ -546,7 +638,7 @@ var IanusGuard = ({ publisherId, productId, publicKeys, environmentType, environ
|
|
|
546
638
|
}
|
|
547
639
|
}
|
|
548
640
|
}, []);
|
|
549
|
-
const runValidation =
|
|
641
|
+
const runValidation = React5.useCallback(() => __async(null, null, function* () {
|
|
550
642
|
try {
|
|
551
643
|
if (resolvedEnvironmentIdentifierRef.current === null) {
|
|
552
644
|
resolvedEnvironmentIdentifierRef.current = isWebApi(environmentIdentifier) ? yield fetchOrganizationIdFromWebApi(environmentIdentifier) : environmentIdentifier == null ? void 0 : environmentIdentifier.replace("{", "").replace("}", "").toLowerCase();
|
|
@@ -603,22 +695,22 @@ var IanusGuard = ({ publisherId, productId, publicKeys, environmentType, environ
|
|
|
603
695
|
};
|
|
604
696
|
}
|
|
605
697
|
}), [dataProvider, environmentIdentifier, environmentType, offlineDataProvider, productId, publisherId]);
|
|
606
|
-
const initLicenseValidation =
|
|
698
|
+
const initLicenseValidation = React5.useCallback(() => __async(null, null, function* () {
|
|
607
699
|
const result = yield runValidation();
|
|
608
700
|
licenseDispatch({ type: "setLicense", payload: result });
|
|
609
701
|
handleValidationResult(result);
|
|
610
702
|
}), [licenseDispatch, runValidation, handleValidationResult]);
|
|
611
|
-
const onLicenseDialogFinally =
|
|
612
|
-
licenseDispatch({ type: "
|
|
703
|
+
const onLicenseDialogFinally = React5.useCallback(() => {
|
|
704
|
+
licenseDispatch({ type: "setVisibleDialog", payload: void 0 });
|
|
613
705
|
initLicenseValidation();
|
|
614
706
|
}, [initLicenseValidation, licenseDispatch]);
|
|
615
|
-
const onDebugFinally =
|
|
616
|
-
licenseDispatch({ type: "
|
|
707
|
+
const onDebugFinally = React5.useCallback(() => {
|
|
708
|
+
licenseDispatch({ type: "setVisibleDialog", payload: void 0 });
|
|
617
709
|
}, [licenseDispatch]);
|
|
618
710
|
const dataTotalResultCount = isDataset(dataProvider) ? dataProvider.paging.totalResultCount : void 0;
|
|
619
711
|
const dataIsLoading = isDataset(dataProvider) ? dataProvider.loading : void 0;
|
|
620
712
|
const dataHasError = isDataset(dataProvider) ? dataProvider.error : void 0;
|
|
621
|
-
const dataProviderState =
|
|
713
|
+
const dataProviderState = React5.useMemo(() => {
|
|
622
714
|
if (!isDataset(dataProvider)) {
|
|
623
715
|
return "webapi";
|
|
624
716
|
} else {
|
|
@@ -628,34 +720,34 @@ var IanusGuard = ({ publisherId, productId, publicKeys, environmentType, environ
|
|
|
628
720
|
const offlineDataTotalResultCount = offlineDataProvider != null ? offlineDataProvider.paging.totalResultCount : void 0;
|
|
629
721
|
const offlineDataIsLoading = offlineDataProvider != null ? offlineDataProvider.loading : void 0;
|
|
630
722
|
const offlineDataHasError = offlineDataProvider != null ? offlineDataProvider.error : void 0;
|
|
631
|
-
const offlineDataProviderState =
|
|
723
|
+
const offlineDataProviderState = React5.useMemo(() => {
|
|
632
724
|
if (offlineDataProvider == null) {
|
|
633
725
|
return "unused";
|
|
634
726
|
} else {
|
|
635
727
|
return `dataset-${offlineDataTotalResultCount}-${offlineDataIsLoading}-${offlineDataHasError}`;
|
|
636
728
|
}
|
|
637
729
|
}, [offlineDataHasError, offlineDataIsLoading, offlineDataProvider, offlineDataTotalResultCount]);
|
|
638
|
-
const dataProviderSignature =
|
|
730
|
+
const dataProviderSignature = React5.useMemo(() => {
|
|
639
731
|
if (isDataset(dataProvider) && dataProvider.records) {
|
|
640
732
|
return Object.values(dataProvider.records).map((r) => `${r.getRecordId()}-${r.getValue("ian_identifier")}-${r.getValue("ian_key")}`).join("|");
|
|
641
733
|
}
|
|
642
734
|
return "";
|
|
643
735
|
}, [dataProvider]);
|
|
644
|
-
const offlineDataProviderSignature =
|
|
736
|
+
const offlineDataProviderSignature = React5.useMemo(() => {
|
|
645
737
|
if (offlineDataProvider && offlineDataProvider.records) {
|
|
646
738
|
return Object.values(offlineDataProvider.records).map((r) => `${r.getRecordId()}-${r.getValue("ian_identifier")}-${r.getValue("ian_key")}`).join("|");
|
|
647
739
|
}
|
|
648
740
|
return "";
|
|
649
741
|
}, [offlineDataProvider]);
|
|
650
|
-
const canResetAutomaticReevaluation =
|
|
742
|
+
const canResetAutomaticReevaluation = React5.useMemo(() => {
|
|
651
743
|
return isDataset(dataProvider) || offlineDataProvider != null;
|
|
652
744
|
}, [dataProvider, offlineDataProvider]);
|
|
653
|
-
|
|
745
|
+
React5.useEffect(() => {
|
|
654
746
|
if (canResetAutomaticReevaluation) {
|
|
655
747
|
preventAutomaticReevaluation.current = false;
|
|
656
748
|
}
|
|
657
749
|
}, [canResetAutomaticReevaluation, dataProviderSignature, offlineDataProviderSignature]);
|
|
658
|
-
|
|
750
|
+
React5.useEffect(() => {
|
|
659
751
|
if (preventAutomaticReevaluation.current) {
|
|
660
752
|
console.log(`Skipping license evaluation as checks have already passed at ${(/* @__PURE__ */ new Date()).toISOString()}`);
|
|
661
753
|
return;
|
|
@@ -685,7 +777,7 @@ var IanusGuard = ({ publisherId, productId, publicKeys, environmentType, environ
|
|
|
685
777
|
handleValidationResult(result);
|
|
686
778
|
}
|
|
687
779
|
}, [dataProvider, dataProviderState, dataProviderSignature, initLicenseValidation, licenseDispatch, usagePermission, offlineDataProvider, offlineDataProviderState, offlineDataProviderSignature, handleValidationResult]);
|
|
688
|
-
return ((_a = licenseState.license) == null ? void 0 : _a.isValid) ? /* @__PURE__ */
|
|
780
|
+
return ((_a = licenseState.license) == null ? void 0 : _a.isValid) ? /* @__PURE__ */ React5.createElement(React5.Fragment, null, licenseState.visibleDialog === "debug" && /* @__PURE__ */ React5.createElement(DebugDialog, { publisherId, productId, environmentType, environmentIdentifier: resolvedEnvironmentIdentifierRef.current || "", dataProvider, offlineDataProvider, onDismiss: onDebugFinally }), licenseState.visibleDialog === "license_details" && /* @__PURE__ */ React5.createElement(LicenseDialog, { publisherId, productId, dataProvider, offlineDataProvider, onSubmit: onLicenseDialogFinally, onCancel: onLicenseDialogFinally }), licenseState.visibleDialog === "license_acquisition" && /* @__PURE__ */ React5.createElement(LicenseAcquisitionDialog, { publisherId, productId, environmentType, environmentIdentifier: resolvedEnvironmentIdentifierRef.current || "", config: licenseAcquisitionConfigRef.current }), children) : /* @__PURE__ */ React5.createElement("div", { style: { display: "flex", width: "100%", height: "100%", flex: "1" } }, licenseState.visibleDialog === "debug" && /* @__PURE__ */ React5.createElement(DebugDialog, { publisherId, productId, environmentType, environmentIdentifier: resolvedEnvironmentIdentifierRef.current || "", dataProvider, offlineDataProvider, onDismiss: onDebugFinally }), licenseState.visibleDialog === "license_details" && /* @__PURE__ */ React5.createElement(LicenseDialog, { publisherId, productId, dataProvider, offlineDataProvider, onSubmit: onLicenseDialogFinally, onCancel: onLicenseDialogFinally }), licenseState.visibleDialog === "license_acquisition" && /* @__PURE__ */ React5.createElement(LicenseAcquisitionDialog, { publisherId, productId, environmentType, environmentIdentifier: resolvedEnvironmentIdentifierRef.current || "", config: licenseAcquisitionConfigRef.current }), /* @__PURE__ */ React5.createElement("div", { style: { display: "flex", flexDirection: "column", alignItems: "center", justifyContent: "center", flex: 1 } }, ((_b = licenseState.license) == null ? void 0 : _b.isValid) === false && /* @__PURE__ */ React5.createElement(
|
|
689
781
|
import_MessageBar.MessageBar,
|
|
690
782
|
{
|
|
691
783
|
messageBarType: import_MessageBar.MessageBarType.error,
|
|
@@ -695,17 +787,17 @@ var IanusGuard = ({ publisherId, productId, publicKeys, environmentType, environ
|
|
|
695
787
|
licenseDispatch({ type: "setLicense", payload: void 0 });
|
|
696
788
|
initLicenseValidation();
|
|
697
789
|
},
|
|
698
|
-
actions: /* @__PURE__ */
|
|
790
|
+
actions: /* @__PURE__ */ React5.createElement("div", null, !((_c = licenseState.license) == null ? void 0 : _c.isTerminalError) && /* @__PURE__ */ React5.createElement(import_Button.MessageBarButton, { onClick: () => licenseDispatch({ type: "setVisibleDialog", payload: "license_details" }) }, "Set License"), !((_d = licenseState.license) == null ? void 0 : _d.isTerminalError) && licenseAcquisitionConfigRef.current && /* @__PURE__ */ React5.createElement(import_Button.MessageBarButton, { onClick: () => licenseDispatch({ type: "setVisibleDialog", payload: "license_acquisition" }) }, "Acquire a license"), !((_e = licenseState.license) == null ? void 0 : _e.isTerminalError) && /* @__PURE__ */ React5.createElement(import_Button.MessageBarButton, { onClick: () => licenseDispatch({ type: "setVisibleDialog", payload: "debug" }) }, "Debug"))
|
|
699
791
|
},
|
|
700
792
|
"An error occured, please try again. Error information: ",
|
|
701
|
-
(
|
|
702
|
-
), !licenseState.license && /* @__PURE__ */
|
|
793
|
+
(_f = licenseState.license) == null ? void 0 : _f.reason
|
|
794
|
+
), !licenseState.license && /* @__PURE__ */ React5.createElement(import_Spinner.Spinner, { styles: { root: { width: "auto" } }, label: "Loading..." })));
|
|
703
795
|
};
|
|
704
796
|
|
|
705
797
|
// src/IanusProvider.tsx
|
|
706
|
-
var
|
|
798
|
+
var React6 = __toESM(require("react"));
|
|
707
799
|
var IanusProvider = (props) => {
|
|
708
|
-
return /* @__PURE__ */
|
|
800
|
+
return /* @__PURE__ */ React6.createElement(IanusLicenseStateProvider, null, /* @__PURE__ */ React6.createElement(IanusGuard, __spreadValues({}, props)));
|
|
709
801
|
};
|
|
710
802
|
|
|
711
803
|
// ../../../../ianus-core/GuidTools.ts
|
package/package.json
CHANGED