@ianua/ianus-dataverse-react-fluentui8 1.0.10 → 1.0.12

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.
Files changed (2) hide show
  1. package/dist/index.js +44 -12
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -460,7 +460,7 @@ var DebugDialog = ({ publisherId, productId, environmentType, environmentIdentif
460
460
  dialogContentProps: dialogContentProps2,
461
461
  modalProps: modalProps2
462
462
  },
463
- /* @__PURE__ */ React3.createElement("p", null, /* @__PURE__ */ React3.createElement(import_react2.Text, null, /* @__PURE__ */ React3.createElement("b", null, "Current environment type:"), " ", environmentType), /* @__PURE__ */ React3.createElement(import_react2.Text, null, /* @__PURE__ */ React3.createElement("b", null, "Current environment identifier:"), " ", environmentIdentifier), /* @__PURE__ */ React3.createElement(import_react2.Text, null, /* @__PURE__ */ React3.createElement("b", null, "Target license identifier:"), " ", publisherId, "_", productId), /* @__PURE__ */ React3.createElement("br", null), /* @__PURE__ */ React3.createElement("br", null), isDataset(dataProvider) && /* @__PURE__ */ React3.createElement(React3.Fragment, null, /* @__PURE__ */ React3.createElement(import_react2.Text, null, /* @__PURE__ */ React3.createElement("b", null, "Licenses in data provider:"), " ", dataProvider.sortedRecordIds.length), /* @__PURE__ */ React3.createElement("br", null), /* @__PURE__ */ React3.createElement(
463
+ /* @__PURE__ */ React3.createElement("p", { style: { display: "flex", flexDirection: "column" } }, /* @__PURE__ */ React3.createElement(import_react2.Text, null, /* @__PURE__ */ React3.createElement("b", null, "Current environment type:"), " ", environmentType), /* @__PURE__ */ React3.createElement(import_react2.Text, null, /* @__PURE__ */ React3.createElement("b", null, "Current environment identifier:"), " ", environmentIdentifier), /* @__PURE__ */ React3.createElement(import_react2.Text, null, /* @__PURE__ */ React3.createElement("b", null, "Target license identifier:"), " ", publisherId, "_", productId), /* @__PURE__ */ React3.createElement("br", null), /* @__PURE__ */ React3.createElement("br", null), isDataset(dataProvider) && /* @__PURE__ */ React3.createElement(React3.Fragment, null, /* @__PURE__ */ React3.createElement(import_react2.Text, null, /* @__PURE__ */ React3.createElement("b", null, "Licenses in data provider:"), " ", dataProvider.sortedRecordIds.length), /* @__PURE__ */ React3.createElement("br", null), /* @__PURE__ */ React3.createElement(
464
464
  import_react2.DetailsList,
465
465
  {
466
466
  items: mapRecordsToItems(dataProvider),
@@ -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;
@@ -534,6 +534,16 @@ var IanusGuard = ({ publisherId, productId, publicKeys, environmentType, environ
534
534
  const resolvedEnvironmentIdentifierRef = React4.useRef(null);
535
535
  const runValidation = React4.useCallback(() => __async(null, null, function* () {
536
536
  try {
537
+ if (resolvedEnvironmentIdentifierRef.current === null) {
538
+ resolvedEnvironmentIdentifierRef.current = isWebApi(environmentIdentifier) ? yield fetchOrganizationIdFromWebApi(environmentIdentifier) : environmentIdentifier == null ? void 0 : environmentIdentifier.replace("{", "").replace("}", "").toLowerCase();
539
+ }
540
+ if (!resolvedEnvironmentIdentifierRef.current) {
541
+ return {
542
+ isValid: false,
543
+ isTerminalError: true,
544
+ reason: `Failed to determine current environment identifier!`
545
+ };
546
+ }
537
547
  if (!productId) {
538
548
  return {
539
549
  isValid: false,
@@ -566,16 +576,6 @@ var IanusGuard = ({ publisherId, productId, publicKeys, environmentType, environ
566
576
  };
567
577
  }
568
578
  const licenseRecord = licenses[0];
569
- if (resolvedEnvironmentIdentifierRef.current === null) {
570
- resolvedEnvironmentIdentifierRef.current = isWebApi(environmentIdentifier) ? yield fetchOrganizationIdFromWebApi(environmentIdentifier) : environmentIdentifier;
571
- }
572
- if (!resolvedEnvironmentIdentifierRef.current) {
573
- return {
574
- isValid: false,
575
- isTerminalError: true,
576
- reason: `Failed to determine current environment identifier!`
577
- };
578
- }
579
579
  const validationResult = yield validateLicense(publisherId, productId, environmentType, resolvedEnvironmentIdentifierRef.current, publicKeysRef.current, licenseRecord.ian_key);
580
580
  return __spreadProps(__spreadValues({}, validationResult), {
581
581
  licenseId: licenseRecord.ian_licenseid,
@@ -641,12 +641,44 @@ var IanusGuard = ({ publisherId, productId, publicKeys, environmentType, environ
641
641
  }
642
642
  return "";
643
643
  }, [offlineDataProvider]);
644
+ const prevDeps = React4.useRef({
645
+ dataProvider,
646
+ dataProviderState,
647
+ dataProviderSignature,
648
+ initLicenseValidation,
649
+ licenseDispatch,
650
+ usagePermission,
651
+ offlineDataProvider,
652
+ offlineDataProviderState,
653
+ offlineDataProviderSignature
654
+ });
644
655
  React4.useEffect(() => {
645
656
  console.log(`Starting license evaluation at ${(/* @__PURE__ */ new Date()).toISOString()}`);
646
657
  console.log(`DataProvider state: ${dataProviderState}`);
647
658
  console.log(`DataProvider signature: ${dataProviderSignature}`);
648
659
  console.log(`Offline DataProvider state: ${offlineDataProviderState}`);
649
660
  console.log(`Offline DataProvider signature: ${offlineDataProviderSignature}`);
661
+ const prev = prevDeps.current;
662
+ if (prev.dataProvider !== dataProvider) console.log("dataProvider changed");
663
+ if (prev.dataProviderState !== dataProviderState) console.log("dataProviderState changed");
664
+ if (prev.dataProviderSignature !== dataProviderSignature) console.log("dataProviderSignature changed");
665
+ if (prev.initLicenseValidation !== initLicenseValidation) console.log("initLicenseValidation changed");
666
+ if (prev.licenseDispatch !== licenseDispatch) console.log("licenseDispatch changed");
667
+ if (prev.usagePermission !== usagePermission) console.log("usagePermission changed");
668
+ if (prev.offlineDataProvider !== offlineDataProvider) console.log("offlineDataProvider changed");
669
+ if (prev.offlineDataProviderState !== offlineDataProviderState) console.log("offlineDataProviderState changed");
670
+ if (prev.offlineDataProviderSignature !== offlineDataProviderSignature) console.log("offlineDataProviderSignature changed");
671
+ prevDeps.current = {
672
+ dataProvider,
673
+ dataProviderState,
674
+ dataProviderSignature,
675
+ initLicenseValidation,
676
+ licenseDispatch,
677
+ usagePermission,
678
+ offlineDataProvider,
679
+ offlineDataProviderState,
680
+ offlineDataProviderSignature
681
+ };
650
682
  if (usagePermission != null && !usagePermission) {
651
683
  const result = {
652
684
  isValid: false,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ianua/ianus-dataverse-react-fluentui8",
3
- "version": "1.0.10",
3
+ "version": "1.0.12",
4
4
  "description": "Client-side validation for Ianus Guard licenses in Dataverse using react and FluentUi v8",
5
5
  "scripts": {
6
6
  "build": "tsup"