@ianua/ianus-dataverse-react-fluentui8 1.0.11 → 1.0.13
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.js +35 -33
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -516,7 +516,7 @@ var fetchOrganizationIdFromWebApi = (webApi) => __async(null, null, function* ()
|
|
|
516
516
|
return null;
|
|
517
517
|
}
|
|
518
518
|
const organization = results.entities[0];
|
|
519
|
-
return organization.organizationid;
|
|
519
|
+
return organization.organizationid.replace("{", "").replace("}", "").toLowerCase();
|
|
520
520
|
});
|
|
521
521
|
var IanusGuard = ({ publisherId, productId, publicKeys, environmentType, environmentIdentifier, dataProvider, offlineDataProvider, usagePermission, onLicenseValidated, children }) => {
|
|
522
522
|
var _a, _b, _c, _d, _e;
|
|
@@ -532,10 +532,24 @@ var IanusGuard = ({ publisherId, productId, publicKeys, environmentType, environ
|
|
|
532
532
|
}
|
|
533
533
|
}, [publicKeys]);
|
|
534
534
|
const resolvedEnvironmentIdentifierRef = React4.useRef(null);
|
|
535
|
+
const preventAutomaticReevaluation = React4.useRef(false);
|
|
536
|
+
const handleValidationResult = React4.useCallback((result) => {
|
|
537
|
+
var _a2;
|
|
538
|
+
preventAutomaticReevaluation.current = (_a2 = result == null ? void 0 : result.isValid) != null ? _a2 : false;
|
|
539
|
+
if (onLicenseValidatedRef.current) {
|
|
540
|
+
try {
|
|
541
|
+
onLicenseValidatedRef.current(result);
|
|
542
|
+
} catch (e) {
|
|
543
|
+
if (e && e instanceof Error) {
|
|
544
|
+
console.error(`Error while calling onLicenseValidated: '${e.message}'`);
|
|
545
|
+
}
|
|
546
|
+
}
|
|
547
|
+
}
|
|
548
|
+
}, []);
|
|
535
549
|
const runValidation = React4.useCallback(() => __async(null, null, function* () {
|
|
536
550
|
try {
|
|
537
551
|
if (resolvedEnvironmentIdentifierRef.current === null) {
|
|
538
|
-
resolvedEnvironmentIdentifierRef.current = isWebApi(environmentIdentifier) ? yield fetchOrganizationIdFromWebApi(environmentIdentifier) : environmentIdentifier;
|
|
552
|
+
resolvedEnvironmentIdentifierRef.current = isWebApi(environmentIdentifier) ? yield fetchOrganizationIdFromWebApi(environmentIdentifier) : environmentIdentifier == null ? void 0 : environmentIdentifier.replace("{", "").replace("}", "").toLowerCase();
|
|
539
553
|
}
|
|
540
554
|
if (!resolvedEnvironmentIdentifierRef.current) {
|
|
541
555
|
return {
|
|
@@ -592,17 +606,9 @@ var IanusGuard = ({ publisherId, productId, publicKeys, environmentType, environ
|
|
|
592
606
|
const initLicenseValidation = React4.useCallback(() => __async(null, null, function* () {
|
|
593
607
|
const result = yield runValidation();
|
|
594
608
|
licenseDispatch({ type: "setLicense", payload: result });
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
} catch (e) {
|
|
599
|
-
if (e && e instanceof Error) {
|
|
600
|
-
console.error(`Error while calling onLicenseValidated: '${e.message}'`);
|
|
601
|
-
}
|
|
602
|
-
}
|
|
603
|
-
}
|
|
604
|
-
}), [licenseDispatch, runValidation]);
|
|
605
|
-
const onSettingsFinally = React4.useCallback(() => {
|
|
609
|
+
handleValidationResult(result);
|
|
610
|
+
}), [licenseDispatch, runValidation, handleValidationResult]);
|
|
611
|
+
const onLicenseDialogFinally = React4.useCallback(() => {
|
|
606
612
|
licenseDispatch({ type: "setLicenseDialogVisible", payload: false });
|
|
607
613
|
initLicenseValidation();
|
|
608
614
|
}, [initLicenseValidation, licenseDispatch]);
|
|
@@ -641,7 +647,19 @@ var IanusGuard = ({ publisherId, productId, publicKeys, environmentType, environ
|
|
|
641
647
|
}
|
|
642
648
|
return "";
|
|
643
649
|
}, [offlineDataProvider]);
|
|
650
|
+
const canResetAutomaticReevaluation = React4.useMemo(() => {
|
|
651
|
+
return isDataset(dataProvider) || offlineDataProvider != null;
|
|
652
|
+
}, [dataProvider, offlineDataProvider]);
|
|
653
|
+
React4.useEffect(() => {
|
|
654
|
+
if (canResetAutomaticReevaluation) {
|
|
655
|
+
preventAutomaticReevaluation.current = false;
|
|
656
|
+
}
|
|
657
|
+
}, [canResetAutomaticReevaluation, dataProviderSignature, offlineDataProviderSignature]);
|
|
644
658
|
React4.useEffect(() => {
|
|
659
|
+
if (preventAutomaticReevaluation.current) {
|
|
660
|
+
console.log(`Skipping license evaluation as checks have already passed at ${(/* @__PURE__ */ new Date()).toISOString()}`);
|
|
661
|
+
return;
|
|
662
|
+
}
|
|
645
663
|
console.log(`Starting license evaluation at ${(/* @__PURE__ */ new Date()).toISOString()}`);
|
|
646
664
|
console.log(`DataProvider state: ${dataProviderState}`);
|
|
647
665
|
console.log(`DataProvider signature: ${dataProviderSignature}`);
|
|
@@ -654,15 +672,7 @@ var IanusGuard = ({ publisherId, productId, publicKeys, environmentType, environ
|
|
|
654
672
|
reason: "Your user is not enabled for using this product"
|
|
655
673
|
};
|
|
656
674
|
licenseDispatch({ type: "setLicense", payload: result });
|
|
657
|
-
|
|
658
|
-
try {
|
|
659
|
-
onLicenseValidatedRef.current(result);
|
|
660
|
-
} catch (e) {
|
|
661
|
-
if (e && e instanceof Error) {
|
|
662
|
-
console.error(`Error while calling onLicenseValidated: '${e.message}'`);
|
|
663
|
-
}
|
|
664
|
-
}
|
|
665
|
-
}
|
|
675
|
+
handleValidationResult(result);
|
|
666
676
|
} else if (!isDataset(dataProvider) || !dataProvider.error && !dataProvider.loading && dataProvider.paging.totalResultCount >= 0 || offlineDataProvider != null && !offlineDataProvider.error && !offlineDataProvider.loading && offlineDataProvider.paging.totalResultCount >= 0) {
|
|
667
677
|
initLicenseValidation();
|
|
668
678
|
} else if (dataProvider.error) {
|
|
@@ -672,18 +682,10 @@ var IanusGuard = ({ publisherId, productId, publicKeys, environmentType, environ
|
|
|
672
682
|
reason: `Dataset error: ${dataProvider.errorMessage}`
|
|
673
683
|
};
|
|
674
684
|
licenseDispatch({ type: "setLicense", payload: result });
|
|
675
|
-
|
|
676
|
-
try {
|
|
677
|
-
onLicenseValidatedRef.current(result);
|
|
678
|
-
} catch (e) {
|
|
679
|
-
if (e && e instanceof Error) {
|
|
680
|
-
console.error(`Error while calling onLicenseValidated: '${e.message}'`);
|
|
681
|
-
}
|
|
682
|
-
}
|
|
683
|
-
}
|
|
685
|
+
handleValidationResult(result);
|
|
684
686
|
}
|
|
685
|
-
}, [dataProvider, dataProviderState, dataProviderSignature, initLicenseValidation, licenseDispatch, usagePermission, offlineDataProvider, offlineDataProviderState, offlineDataProviderSignature]);
|
|
686
|
-
return ((_a = licenseState.license) == null ? void 0 : _a.isValid) ? /* @__PURE__ */ React4.createElement(React4.Fragment, null, licenseState.licenseDialogVisible && /* @__PURE__ */ React4.createElement(LicenseDialog, { publisherId, productId, dataProvider, offlineDataProvider, onSubmit:
|
|
687
|
+
}, [dataProvider, dataProviderState, dataProviderSignature, initLicenseValidation, licenseDispatch, usagePermission, offlineDataProvider, offlineDataProviderState, offlineDataProviderSignature, handleValidationResult]);
|
|
688
|
+
return ((_a = licenseState.license) == null ? void 0 : _a.isValid) ? /* @__PURE__ */ React4.createElement(React4.Fragment, null, licenseState.licenseDialogVisible && /* @__PURE__ */ React4.createElement(LicenseDialog, { publisherId, productId, dataProvider, offlineDataProvider, onSubmit: onLicenseDialogFinally, onCancel: onLicenseDialogFinally }), children) : /* @__PURE__ */ React4.createElement("div", { style: { display: "flex", width: "100%", height: "100%", flex: "1" } }, licenseState.licenseDialogVisible && /* @__PURE__ */ React4.createElement(LicenseDialog, { publisherId, productId, dataProvider, offlineDataProvider, onSubmit: onLicenseDialogFinally, onCancel: onLicenseDialogFinally }), licenseState.debugDialogVisible && /* @__PURE__ */ React4.createElement(DebugDialog, { publisherId, productId, environmentType, environmentIdentifier: resolvedEnvironmentIdentifierRef.current || "", dataProvider, offlineDataProvider, onDismiss: onDebugFinally }), /* @__PURE__ */ React4.createElement("div", { style: { display: "flex", flexDirection: "column", alignItems: "center", justifyContent: "center", flex: 1 } }, ((_b = licenseState.license) == null ? void 0 : _b.isValid) === false && /* @__PURE__ */ React4.createElement(
|
|
687
689
|
import_MessageBar.MessageBar,
|
|
688
690
|
{
|
|
689
691
|
messageBarType: import_MessageBar.MessageBarType.error,
|
package/package.json
CHANGED