@ianua/ianus-dataverse-react-fluentui8 1.0.15 → 1.1.0
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 +16 -16
- package/dist/index.js +9 -9
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -8,7 +8,7 @@ interface IEnvironmentIdentifier {
|
|
|
8
8
|
identifier: string;
|
|
9
9
|
name: string;
|
|
10
10
|
}
|
|
11
|
-
interface
|
|
11
|
+
interface ILicense {
|
|
12
12
|
jti: string;
|
|
13
13
|
iss: string;
|
|
14
14
|
aud: string;
|
|
@@ -38,23 +38,12 @@ type DataverseLicenseValidationError = {
|
|
|
38
38
|
};
|
|
39
39
|
type DataverseLicenseValidationSuccess = {
|
|
40
40
|
isValid: true;
|
|
41
|
-
|
|
41
|
+
license: ILicense;
|
|
42
42
|
licenseId: string;
|
|
43
43
|
licenseKey: string;
|
|
44
44
|
};
|
|
45
45
|
type DataverseLicenseValidationResult = DataverseLicenseValidationError | DataverseLicenseValidationSuccess;
|
|
46
46
|
|
|
47
|
-
type LicenseValidationError = {
|
|
48
|
-
isValid: false;
|
|
49
|
-
reason: string;
|
|
50
|
-
isTerminalError?: boolean;
|
|
51
|
-
};
|
|
52
|
-
type LicenseValidationSuccess = {
|
|
53
|
-
isValid: true;
|
|
54
|
-
claims: ILicenseClaims;
|
|
55
|
-
};
|
|
56
|
-
type LicenseValidationResult = LicenseValidationError | LicenseValidationSuccess;
|
|
57
|
-
|
|
58
47
|
type EnvironmentType = "entra" | "dataverse";
|
|
59
48
|
type EnvironmentEntry = {
|
|
60
49
|
type: EnvironmentType;
|
|
@@ -131,7 +120,7 @@ interface IIanusGuardProps {
|
|
|
131
120
|
* @param result The result of this validation run
|
|
132
121
|
* @returns Returned data will not be processed in any way
|
|
133
122
|
*/
|
|
134
|
-
onLicenseValidated?: (result:
|
|
123
|
+
onLicenseValidated?: (result: DataverseLicenseValidationResult) => unknown;
|
|
135
124
|
}
|
|
136
125
|
declare const isWebApi: (dataProvider: ComponentFramework.WebApi | ComponentFramework.PropertyTypes.DataSet | string) => dataProvider is ComponentFramework.WebApi;
|
|
137
126
|
declare const isDataset: (dataProvider: ComponentFramework.WebApi | ComponentFramework.PropertyTypes.DataSet | string) => dataProvider is ComponentFramework.PropertyTypes.DataSet;
|
|
@@ -140,7 +129,7 @@ declare const IanusGuard: React.FC<IIanusGuardProps>;
|
|
|
140
129
|
|
|
141
130
|
type AvailableDialogs = "debug" | "license_details" | "license_acquisition";
|
|
142
131
|
type IanusLicenseStateProps = {
|
|
143
|
-
|
|
132
|
+
licenseValidationResult?: DataverseLicenseValidationResult;
|
|
144
133
|
visibleDialog?: AvailableDialogs;
|
|
145
134
|
};
|
|
146
135
|
type Action = {
|
|
@@ -173,7 +162,18 @@ declare const LicenseDialog: React.FC<ILicenseDialogProps>;
|
|
|
173
162
|
|
|
174
163
|
declare const removeCurlyBrackets: (input: string | undefined | null) => string | undefined;
|
|
175
164
|
|
|
165
|
+
type LicenseValidationError = {
|
|
166
|
+
isValid: false;
|
|
167
|
+
reason: string;
|
|
168
|
+
isTerminalError?: boolean;
|
|
169
|
+
};
|
|
170
|
+
type LicenseValidationSuccess = {
|
|
171
|
+
isValid: true;
|
|
172
|
+
license: ILicense;
|
|
173
|
+
};
|
|
174
|
+
type LicenseValidationResult = LicenseValidationError | LicenseValidationSuccess;
|
|
175
|
+
|
|
176
176
|
declare const base64url_decode: (value: string) => ArrayBuffer;
|
|
177
177
|
declare const validateLicense: (publisherId: string, productId: string, environmentType: string, environmentIdentifier: string, publicKeys: string[], licenseKey: string | undefined) => Promise<LicenseValidationResult>;
|
|
178
178
|
|
|
179
|
-
export { type AvailableDialogs, type DataverseLicenseValidationError, type DataverseLicenseValidationResult, type DataverseLicenseValidationSuccess, type EnvironmentEntry, type EnvironmentType, type IEnvironmentIdentifier, type IIanusGuardProps, type IIanusProviderProps, type
|
|
179
|
+
export { type AvailableDialogs, type DataverseLicenseValidationError, type DataverseLicenseValidationResult, type DataverseLicenseValidationSuccess, type EnvironmentEntry, type EnvironmentType, type IEnvironmentIdentifier, type IIanusGuardProps, type IIanusProviderProps, type ILicense, 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
|
@@ -202,7 +202,7 @@ var validateLicense = (publisherId, productId, environmentType, environmentIdent
|
|
|
202
202
|
if (isLicenseSignatureValid === true) {
|
|
203
203
|
return {
|
|
204
204
|
isValid: true,
|
|
205
|
-
|
|
205
|
+
license: claimsJson
|
|
206
206
|
};
|
|
207
207
|
}
|
|
208
208
|
} catch (e) {
|
|
@@ -237,7 +237,7 @@ var React = __toESM(require("react"));
|
|
|
237
237
|
function stateReducer(state, action) {
|
|
238
238
|
switch (action.type) {
|
|
239
239
|
case "setLicense": {
|
|
240
|
-
return __spreadProps(__spreadValues({}, state), {
|
|
240
|
+
return __spreadProps(__spreadValues({}, state), { licenseValidationResult: action.payload });
|
|
241
241
|
}
|
|
242
242
|
case "setVisibleDialog": {
|
|
243
243
|
return __spreadProps(__spreadValues({}, state), { visibleDialog: action.payload });
|
|
@@ -281,8 +281,8 @@ var LicenseDialog = ({ publisherId, productId, dataProvider, offlineDataProvider
|
|
|
281
281
|
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x;
|
|
282
282
|
const [licenseState, licenseDispatch] = useLicenseContext();
|
|
283
283
|
const [submitBlocked, setSubmitBlocked] = React2.useState(true);
|
|
284
|
-
const [licenseKeyInput, setLicenseKeyInput] = React2.useState((_a = licenseState.
|
|
285
|
-
const [licenseId, setLicenseId] = React2.useState((_b = licenseState == null ? void 0 : licenseState.
|
|
284
|
+
const [licenseKeyInput, setLicenseKeyInput] = React2.useState((_a = licenseState.licenseValidationResult) == null ? void 0 : _a.licenseKey);
|
|
285
|
+
const [licenseId, setLicenseId] = React2.useState((_b = licenseState == null ? void 0 : licenseState.licenseValidationResult) == null ? void 0 : _b.licenseId);
|
|
286
286
|
const [error, setError] = React2.useState("");
|
|
287
287
|
React2.useEffect(() => {
|
|
288
288
|
(() => __async(null, null, function* () {
|
|
@@ -404,7 +404,7 @@ var LicenseDialog = ({ publisherId, productId, dataProvider, offlineDataProvider
|
|
|
404
404
|
setLicenseKeyInput(v != null ? v : "");
|
|
405
405
|
setSubmitBlocked(false);
|
|
406
406
|
}, required: true }),
|
|
407
|
-
!!((_c = licenseState.
|
|
407
|
+
!!((_c = licenseState.licenseValidationResult) == null ? void 0 : _c.isValid) && /* @__PURE__ */ React2.createElement(import_react.Text, null, /* @__PURE__ */ React2.createElement("br", null), /* @__PURE__ */ React2.createElement("h3", null, "License Information"), /* @__PURE__ */ React2.createElement("p", null, /* @__PURE__ */ React2.createElement("span", { style: { fontWeight: "bold" } }, "License Publisher: "), " ", /* @__PURE__ */ React2.createElement("span", { title: (_e = (_d = licenseState.licenseValidationResult) == null ? void 0 : _d.license) == null ? void 0 : _e.pub }, (_h = (_g = (_f = licenseState.licenseValidationResult) == null ? void 0 : _f.license) == null ? void 0 : _g.pub_meta) == null ? void 0 : _h.name)), /* @__PURE__ */ React2.createElement("p", null, /* @__PURE__ */ React2.createElement("span", { style: { fontWeight: "bold" } }, "Licensed Product: "), " ", /* @__PURE__ */ React2.createElement("span", { title: (_i = licenseState.licenseValidationResult) == null ? void 0 : _i.license.aud }, (_l = (_k = (_j = licenseState.licenseValidationResult) == null ? void 0 : _j.license) == null ? void 0 : _k.prd_meta) == null ? void 0 : _l.name)), /* @__PURE__ */ React2.createElement("p", null, /* @__PURE__ */ React2.createElement("span", { style: { fontWeight: "bold" } }, "Licensed Customer: "), " ", /* @__PURE__ */ React2.createElement("span", { title: (_m = licenseState.licenseValidationResult) == null ? void 0 : _m.license.sub }, (_p = (_o = (_n = licenseState.licenseValidationResult) == null ? void 0 : _n.license) == null ? void 0 : _o.sub_meta) == null ? void 0 : _p.name)), /* @__PURE__ */ React2.createElement("p", null, /* @__PURE__ */ React2.createElement("span", { style: { fontWeight: "bold" } }, "Licensed Dataverse Environment: "), " ", /* @__PURE__ */ React2.createElement("span", null, (_s = (_r = (_q = licenseState.licenseValidationResult) == null ? void 0 : _q.license) == null ? void 0 : _r.env) == null ? void 0 : _s.map((e) => `${e.identifier} (${e.name})`).join(", "))), /* @__PURE__ */ React2.createElement("p", null, /* @__PURE__ */ React2.createElement("span", { style: { fontWeight: "bold" } }, "License expires after: "), " ", /* @__PURE__ */ React2.createElement("span", null, !((_u = (_t = licenseState.licenseValidationResult) == null ? void 0 : _t.license) == null ? void 0 : _u.exp) ? "Never" : new Date(((_v = licenseState.licenseValidationResult) == null ? void 0 : _v.license.exp) * 1e3).toISOString())), ((_x = (_w = licenseState.licenseValidationResult) == null ? void 0 : _w.license) == null ? void 0 : _x.cus) && /* @__PURE__ */ React2.createElement("p", null, /* @__PURE__ */ React2.createElement("span", { style: { fontWeight: "bold" } }, "Custom claims: "), " ", /* @__PURE__ */ React2.createElement("span", null, JSON.stringify(licenseState.licenseValidationResult.license.cus)))),
|
|
408
408
|
/* @__PURE__ */ React2.createElement(import_react.DialogFooter, null, /* @__PURE__ */ React2.createElement(import_react.PrimaryButton, { onClick: onSubmitClick, text: "Submit", disabled: !licenseKeyInput || submitBlocked }), /* @__PURE__ */ React2.createElement(import_react.DefaultButton, { onClick: onCancel, text: "Cancel" }))
|
|
409
409
|
);
|
|
410
410
|
};
|
|
@@ -795,7 +795,7 @@ var IanusGuard = ({ publisherId, productId, publicKeys, environmentType, environ
|
|
|
795
795
|
handleValidationResult(result);
|
|
796
796
|
}
|
|
797
797
|
}, [dataProvider, dataProviderState, dataProviderSignature, initLicenseValidation, licenseDispatch, usagePermission, offlineDataProvider, offlineDataProviderState, offlineDataProviderSignature, handleValidationResult]);
|
|
798
|
-
return ((_a = licenseState.
|
|
798
|
+
return ((_a = licenseState.licenseValidationResult) == 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.licenseValidationResult) == null ? void 0 : _b.isValid) === false && /* @__PURE__ */ React5.createElement(
|
|
799
799
|
import_MessageBar.MessageBar,
|
|
800
800
|
{
|
|
801
801
|
messageBarType: import_MessageBar.MessageBarType.error,
|
|
@@ -805,11 +805,11 @@ var IanusGuard = ({ publisherId, productId, publicKeys, environmentType, environ
|
|
|
805
805
|
licenseDispatch({ type: "setLicense", payload: void 0 });
|
|
806
806
|
initLicenseValidation();
|
|
807
807
|
},
|
|
808
|
-
actions: /* @__PURE__ */ React5.createElement("div", null, !((_c = licenseState.
|
|
808
|
+
actions: /* @__PURE__ */ React5.createElement("div", null, !((_c = licenseState.licenseValidationResult) == null ? void 0 : _c.isTerminalError) && /* @__PURE__ */ React5.createElement(import_Button.MessageBarButton, { onClick: () => licenseDispatch({ type: "setVisibleDialog", payload: "license_details" }) }, "Set License"), !((_d = licenseState.licenseValidationResult) == null ? void 0 : _d.isTerminalError) && licenseAcquisitionConfigRef.current && /* @__PURE__ */ React5.createElement(import_Button.MessageBarButton, { onClick: () => licenseDispatch({ type: "setVisibleDialog", payload: "license_acquisition" }) }, "Acquire License"), !((_e = licenseState.licenseValidationResult) == null ? void 0 : _e.isTerminalError) && /* @__PURE__ */ React5.createElement(import_Button.MessageBarButton, { onClick: () => licenseDispatch({ type: "setVisibleDialog", payload: "debug" }) }, "Debug"))
|
|
809
809
|
},
|
|
810
810
|
"An error occured, please try again. Error information: ",
|
|
811
|
-
(_f = licenseState.
|
|
812
|
-
), !licenseState.
|
|
811
|
+
(_f = licenseState.licenseValidationResult) == null ? void 0 : _f.reason
|
|
812
|
+
), !licenseState.licenseValidationResult && /* @__PURE__ */ React5.createElement(import_Spinner.Spinner, { styles: { root: { width: "auto" } }, label: "Loading..." })));
|
|
813
813
|
};
|
|
814
814
|
|
|
815
815
|
// src/IanusProvider.tsx
|
package/package.json
CHANGED