@spteck/license-manager-react-components 1.0.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/LICENSE +21 -0
- package/README.md +3 -0
- package/dist/atoms/appGlobalState.d.ts +4 -0
- package/dist/components/RenderLabel/RenderLabel.d.ts +8 -0
- package/dist/components/RenderLabel/index.d.ts +2 -0
- package/dist/components/RenderLabel/useRenderLabelStylesStyles.d.ts +1 -0
- package/dist/components/customControlBar/CustomControlBar.d.ts +15 -0
- package/dist/components/customControlBar/index.d.ts +1 -0
- package/dist/components/dropDownField/DropDownField.d.ts +3 -0
- package/dist/components/dropDownField/IDropDownFieldProps.d.ts +15 -0
- package/dist/components/dropDownField/IOption.d.ts +8 -0
- package/dist/components/dropDownField/index.d.ts +3 -0
- package/dist/components/errorSVG/ErrorSVG.d.ts +2 -0
- package/dist/components/informationBar/InformationBar.d.ts +6 -0
- package/dist/components/licenseControl/LicenseControl.d.ts +10 -0
- package/dist/components/licenseControl/useLicenseControlStyles.d.ts +5 -0
- package/dist/components/licensePlaceHolder/LicensePlaceHolder.d.ts +8 -0
- package/dist/components/licensePlaceHolder/licensePlaceHolderStyles.d.ts +8 -0
- package/dist/components/licenseProvider/ILicenseProviderProps.d.ts +17 -0
- package/dist/components/licenseProvider/LicenseProvider.d.ts +3 -0
- package/dist/components/mailTo/Mailto.d.ts +12 -0
- package/dist/components/pricePlan/PricePlan.d.ts +9 -0
- package/dist/components/pricePlan/usePricePlansStyles.d.ts +12 -0
- package/dist/components/registerDialog/RegisterDialog.d.ts +10 -0
- package/dist/components/renderHeader/RenderHeader.d.ts +8 -0
- package/dist/components/renderHeader/index.d.ts +2 -0
- package/dist/components/renderHeader/useRenderHeaderStyles.d.ts +1 -0
- package/dist/components/showError/ShowError.d.ts +6 -0
- package/dist/components/trialLicense.ts/TrialLicense.d.ts +6 -0
- package/dist/components/trialLicense.ts/useTrialLicenseStyles.d.ts +5 -0
- package/dist/constants/constants.d.ts +3 -0
- package/dist/hooks/useUtils.d.ts +4 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +8 -0
- package/dist/license-manager-react-components.cjs.development.js +1433 -0
- package/dist/license-manager-react-components.cjs.development.js.map +1 -0
- package/dist/license-manager-react-components.cjs.production.min.js +2 -0
- package/dist/license-manager-react-components.cjs.production.min.js.map +1 -0
- package/dist/license-manager-react-components.esm.js +1406 -0
- package/dist/license-manager-react-components.esm.js.map +1 -0
- package/dist/loc/IStrings.d.ts +56 -0
- package/dist/loc/en.json +61 -0
- package/dist/models/EAppHostName.d.ts +7 -0
- package/dist/models/ETabsOptions.d.ts +5 -0
- package/dist/models/IGlobalState.d.ts +8 -0
- package/dist/zodSchemas/pricePlan.d.ts +47 -0
- package/package.json +79 -0
|
@@ -0,0 +1,1433 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
function _interopDefault (ex) { return (ex && (typeof ex === 'object') && 'default' in ex) ? ex['default'] : ex; }
|
|
6
|
+
|
|
7
|
+
function _interopNamespace(e) {
|
|
8
|
+
if (e && e.__esModule) { return e; } else {
|
|
9
|
+
var n = {};
|
|
10
|
+
if (e) {
|
|
11
|
+
Object.keys(e).forEach(function (k) {
|
|
12
|
+
var d = Object.getOwnPropertyDescriptor(e, k);
|
|
13
|
+
Object.defineProperty(n, k, d.get ? d : {
|
|
14
|
+
enumerable: true,
|
|
15
|
+
get: function () {
|
|
16
|
+
return e[k];
|
|
17
|
+
}
|
|
18
|
+
});
|
|
19
|
+
});
|
|
20
|
+
}
|
|
21
|
+
n['default'] = e;
|
|
22
|
+
return n;
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
var React = require('react');
|
|
27
|
+
var React__default = _interopDefault(React);
|
|
28
|
+
var reactComponents = require('@fluentui/react-components');
|
|
29
|
+
var reactHooksLibrary = require('@spteck/react-hooks-library');
|
|
30
|
+
var reactIcons = require('@fluentui/react-icons');
|
|
31
|
+
var jotai = require('jotai');
|
|
32
|
+
var css = require('@emotion/css');
|
|
33
|
+
var cryptoJs = require('crypto-js');
|
|
34
|
+
var react = require('@iconify/react');
|
|
35
|
+
var zod = require('zod');
|
|
36
|
+
var reactErrorBoundary = require('react-error-boundary');
|
|
37
|
+
var dateFns = require('date-fns');
|
|
38
|
+
|
|
39
|
+
function asyncGeneratorStep(n, t, e, r, o, a, c) {
|
|
40
|
+
try {
|
|
41
|
+
var i = n[a](c),
|
|
42
|
+
u = i.value;
|
|
43
|
+
} catch (n) {
|
|
44
|
+
return void e(n);
|
|
45
|
+
}
|
|
46
|
+
i.done ? t(u) : Promise.resolve(u).then(r, o);
|
|
47
|
+
}
|
|
48
|
+
function _asyncToGenerator(n) {
|
|
49
|
+
return function () {
|
|
50
|
+
var t = this,
|
|
51
|
+
e = arguments;
|
|
52
|
+
return new Promise(function (r, o) {
|
|
53
|
+
var a = n.apply(t, e);
|
|
54
|
+
function _next(n) {
|
|
55
|
+
asyncGeneratorStep(a, r, o, _next, _throw, "next", n);
|
|
56
|
+
}
|
|
57
|
+
function _throw(n) {
|
|
58
|
+
asyncGeneratorStep(a, r, o, _next, _throw, "throw", n);
|
|
59
|
+
}
|
|
60
|
+
_next(void 0);
|
|
61
|
+
});
|
|
62
|
+
};
|
|
63
|
+
}
|
|
64
|
+
function _extends() {
|
|
65
|
+
return _extends = Object.assign ? Object.assign.bind() : function (n) {
|
|
66
|
+
for (var e = 1; e < arguments.length; e++) {
|
|
67
|
+
var t = arguments[e];
|
|
68
|
+
for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]);
|
|
69
|
+
}
|
|
70
|
+
return n;
|
|
71
|
+
}, _extends.apply(null, arguments);
|
|
72
|
+
}
|
|
73
|
+
function _regeneratorRuntime() {
|
|
74
|
+
_regeneratorRuntime = function () {
|
|
75
|
+
return e;
|
|
76
|
+
};
|
|
77
|
+
var t,
|
|
78
|
+
e = {},
|
|
79
|
+
r = Object.prototype,
|
|
80
|
+
n = r.hasOwnProperty,
|
|
81
|
+
o = Object.defineProperty || function (t, e, r) {
|
|
82
|
+
t[e] = r.value;
|
|
83
|
+
},
|
|
84
|
+
i = "function" == typeof Symbol ? Symbol : {},
|
|
85
|
+
a = i.iterator || "@@iterator",
|
|
86
|
+
c = i.asyncIterator || "@@asyncIterator",
|
|
87
|
+
u = i.toStringTag || "@@toStringTag";
|
|
88
|
+
function define(t, e, r) {
|
|
89
|
+
return Object.defineProperty(t, e, {
|
|
90
|
+
value: r,
|
|
91
|
+
enumerable: !0,
|
|
92
|
+
configurable: !0,
|
|
93
|
+
writable: !0
|
|
94
|
+
}), t[e];
|
|
95
|
+
}
|
|
96
|
+
try {
|
|
97
|
+
define({}, "");
|
|
98
|
+
} catch (t) {
|
|
99
|
+
define = function (t, e, r) {
|
|
100
|
+
return t[e] = r;
|
|
101
|
+
};
|
|
102
|
+
}
|
|
103
|
+
function wrap(t, e, r, n) {
|
|
104
|
+
var i = e && e.prototype instanceof Generator ? e : Generator,
|
|
105
|
+
a = Object.create(i.prototype),
|
|
106
|
+
c = new Context(n || []);
|
|
107
|
+
return o(a, "_invoke", {
|
|
108
|
+
value: makeInvokeMethod(t, r, c)
|
|
109
|
+
}), a;
|
|
110
|
+
}
|
|
111
|
+
function tryCatch(t, e, r) {
|
|
112
|
+
try {
|
|
113
|
+
return {
|
|
114
|
+
type: "normal",
|
|
115
|
+
arg: t.call(e, r)
|
|
116
|
+
};
|
|
117
|
+
} catch (t) {
|
|
118
|
+
return {
|
|
119
|
+
type: "throw",
|
|
120
|
+
arg: t
|
|
121
|
+
};
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
e.wrap = wrap;
|
|
125
|
+
var h = "suspendedStart",
|
|
126
|
+
l = "suspendedYield",
|
|
127
|
+
f = "executing",
|
|
128
|
+
s = "completed",
|
|
129
|
+
y = {};
|
|
130
|
+
function Generator() {}
|
|
131
|
+
function GeneratorFunction() {}
|
|
132
|
+
function GeneratorFunctionPrototype() {}
|
|
133
|
+
var p = {};
|
|
134
|
+
define(p, a, function () {
|
|
135
|
+
return this;
|
|
136
|
+
});
|
|
137
|
+
var d = Object.getPrototypeOf,
|
|
138
|
+
v = d && d(d(values([])));
|
|
139
|
+
v && v !== r && n.call(v, a) && (p = v);
|
|
140
|
+
var g = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(p);
|
|
141
|
+
function defineIteratorMethods(t) {
|
|
142
|
+
["next", "throw", "return"].forEach(function (e) {
|
|
143
|
+
define(t, e, function (t) {
|
|
144
|
+
return this._invoke(e, t);
|
|
145
|
+
});
|
|
146
|
+
});
|
|
147
|
+
}
|
|
148
|
+
function AsyncIterator(t, e) {
|
|
149
|
+
function invoke(r, o, i, a) {
|
|
150
|
+
var c = tryCatch(t[r], t, o);
|
|
151
|
+
if ("throw" !== c.type) {
|
|
152
|
+
var u = c.arg,
|
|
153
|
+
h = u.value;
|
|
154
|
+
return h && "object" == typeof h && n.call(h, "__await") ? e.resolve(h.__await).then(function (t) {
|
|
155
|
+
invoke("next", t, i, a);
|
|
156
|
+
}, function (t) {
|
|
157
|
+
invoke("throw", t, i, a);
|
|
158
|
+
}) : e.resolve(h).then(function (t) {
|
|
159
|
+
u.value = t, i(u);
|
|
160
|
+
}, function (t) {
|
|
161
|
+
return invoke("throw", t, i, a);
|
|
162
|
+
});
|
|
163
|
+
}
|
|
164
|
+
a(c.arg);
|
|
165
|
+
}
|
|
166
|
+
var r;
|
|
167
|
+
o(this, "_invoke", {
|
|
168
|
+
value: function (t, n) {
|
|
169
|
+
function callInvokeWithMethodAndArg() {
|
|
170
|
+
return new e(function (e, r) {
|
|
171
|
+
invoke(t, n, e, r);
|
|
172
|
+
});
|
|
173
|
+
}
|
|
174
|
+
return r = r ? r.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg();
|
|
175
|
+
}
|
|
176
|
+
});
|
|
177
|
+
}
|
|
178
|
+
function makeInvokeMethod(e, r, n) {
|
|
179
|
+
var o = h;
|
|
180
|
+
return function (i, a) {
|
|
181
|
+
if (o === f) throw Error("Generator is already running");
|
|
182
|
+
if (o === s) {
|
|
183
|
+
if ("throw" === i) throw a;
|
|
184
|
+
return {
|
|
185
|
+
value: t,
|
|
186
|
+
done: !0
|
|
187
|
+
};
|
|
188
|
+
}
|
|
189
|
+
for (n.method = i, n.arg = a;;) {
|
|
190
|
+
var c = n.delegate;
|
|
191
|
+
if (c) {
|
|
192
|
+
var u = maybeInvokeDelegate(c, n);
|
|
193
|
+
if (u) {
|
|
194
|
+
if (u === y) continue;
|
|
195
|
+
return u;
|
|
196
|
+
}
|
|
197
|
+
}
|
|
198
|
+
if ("next" === n.method) n.sent = n._sent = n.arg;else if ("throw" === n.method) {
|
|
199
|
+
if (o === h) throw o = s, n.arg;
|
|
200
|
+
n.dispatchException(n.arg);
|
|
201
|
+
} else "return" === n.method && n.abrupt("return", n.arg);
|
|
202
|
+
o = f;
|
|
203
|
+
var p = tryCatch(e, r, n);
|
|
204
|
+
if ("normal" === p.type) {
|
|
205
|
+
if (o = n.done ? s : l, p.arg === y) continue;
|
|
206
|
+
return {
|
|
207
|
+
value: p.arg,
|
|
208
|
+
done: n.done
|
|
209
|
+
};
|
|
210
|
+
}
|
|
211
|
+
"throw" === p.type && (o = s, n.method = "throw", n.arg = p.arg);
|
|
212
|
+
}
|
|
213
|
+
};
|
|
214
|
+
}
|
|
215
|
+
function maybeInvokeDelegate(e, r) {
|
|
216
|
+
var n = r.method,
|
|
217
|
+
o = e.iterator[n];
|
|
218
|
+
if (o === t) return r.delegate = null, "throw" === n && e.iterator.return && (r.method = "return", r.arg = t, maybeInvokeDelegate(e, r), "throw" === r.method) || "return" !== n && (r.method = "throw", r.arg = new TypeError("The iterator does not provide a '" + n + "' method")), y;
|
|
219
|
+
var i = tryCatch(o, e.iterator, r.arg);
|
|
220
|
+
if ("throw" === i.type) return r.method = "throw", r.arg = i.arg, r.delegate = null, y;
|
|
221
|
+
var a = i.arg;
|
|
222
|
+
return a ? a.done ? (r[e.resultName] = a.value, r.next = e.nextLoc, "return" !== r.method && (r.method = "next", r.arg = t), r.delegate = null, y) : a : (r.method = "throw", r.arg = new TypeError("iterator result is not an object"), r.delegate = null, y);
|
|
223
|
+
}
|
|
224
|
+
function pushTryEntry(t) {
|
|
225
|
+
var e = {
|
|
226
|
+
tryLoc: t[0]
|
|
227
|
+
};
|
|
228
|
+
1 in t && (e.catchLoc = t[1]), 2 in t && (e.finallyLoc = t[2], e.afterLoc = t[3]), this.tryEntries.push(e);
|
|
229
|
+
}
|
|
230
|
+
function resetTryEntry(t) {
|
|
231
|
+
var e = t.completion || {};
|
|
232
|
+
e.type = "normal", delete e.arg, t.completion = e;
|
|
233
|
+
}
|
|
234
|
+
function Context(t) {
|
|
235
|
+
this.tryEntries = [{
|
|
236
|
+
tryLoc: "root"
|
|
237
|
+
}], t.forEach(pushTryEntry, this), this.reset(!0);
|
|
238
|
+
}
|
|
239
|
+
function values(e) {
|
|
240
|
+
if (e || "" === e) {
|
|
241
|
+
var r = e[a];
|
|
242
|
+
if (r) return r.call(e);
|
|
243
|
+
if ("function" == typeof e.next) return e;
|
|
244
|
+
if (!isNaN(e.length)) {
|
|
245
|
+
var o = -1,
|
|
246
|
+
i = function next() {
|
|
247
|
+
for (; ++o < e.length;) if (n.call(e, o)) return next.value = e[o], next.done = !1, next;
|
|
248
|
+
return next.value = t, next.done = !0, next;
|
|
249
|
+
};
|
|
250
|
+
return i.next = i;
|
|
251
|
+
}
|
|
252
|
+
}
|
|
253
|
+
throw new TypeError(typeof e + " is not iterable");
|
|
254
|
+
}
|
|
255
|
+
return GeneratorFunction.prototype = GeneratorFunctionPrototype, o(g, "constructor", {
|
|
256
|
+
value: GeneratorFunctionPrototype,
|
|
257
|
+
configurable: !0
|
|
258
|
+
}), o(GeneratorFunctionPrototype, "constructor", {
|
|
259
|
+
value: GeneratorFunction,
|
|
260
|
+
configurable: !0
|
|
261
|
+
}), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, u, "GeneratorFunction"), e.isGeneratorFunction = function (t) {
|
|
262
|
+
var e = "function" == typeof t && t.constructor;
|
|
263
|
+
return !!e && (e === GeneratorFunction || "GeneratorFunction" === (e.displayName || e.name));
|
|
264
|
+
}, e.mark = function (t) {
|
|
265
|
+
return Object.setPrototypeOf ? Object.setPrototypeOf(t, GeneratorFunctionPrototype) : (t.__proto__ = GeneratorFunctionPrototype, define(t, u, "GeneratorFunction")), t.prototype = Object.create(g), t;
|
|
266
|
+
}, e.awrap = function (t) {
|
|
267
|
+
return {
|
|
268
|
+
__await: t
|
|
269
|
+
};
|
|
270
|
+
}, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, c, function () {
|
|
271
|
+
return this;
|
|
272
|
+
}), e.AsyncIterator = AsyncIterator, e.async = function (t, r, n, o, i) {
|
|
273
|
+
void 0 === i && (i = Promise);
|
|
274
|
+
var a = new AsyncIterator(wrap(t, r, n, o), i);
|
|
275
|
+
return e.isGeneratorFunction(r) ? a : a.next().then(function (t) {
|
|
276
|
+
return t.done ? t.value : a.next();
|
|
277
|
+
});
|
|
278
|
+
}, defineIteratorMethods(g), define(g, u, "Generator"), define(g, a, function () {
|
|
279
|
+
return this;
|
|
280
|
+
}), define(g, "toString", function () {
|
|
281
|
+
return "[object Generator]";
|
|
282
|
+
}), e.keys = function (t) {
|
|
283
|
+
var e = Object(t),
|
|
284
|
+
r = [];
|
|
285
|
+
for (var n in e) r.push(n);
|
|
286
|
+
return r.reverse(), function next() {
|
|
287
|
+
for (; r.length;) {
|
|
288
|
+
var t = r.pop();
|
|
289
|
+
if (t in e) return next.value = t, next.done = !1, next;
|
|
290
|
+
}
|
|
291
|
+
return next.done = !0, next;
|
|
292
|
+
};
|
|
293
|
+
}, e.values = values, Context.prototype = {
|
|
294
|
+
constructor: Context,
|
|
295
|
+
reset: function (e) {
|
|
296
|
+
if (this.prev = 0, this.next = 0, this.sent = this._sent = t, this.done = !1, this.delegate = null, this.method = "next", this.arg = t, this.tryEntries.forEach(resetTryEntry), !e) for (var r in this) "t" === r.charAt(0) && n.call(this, r) && !isNaN(+r.slice(1)) && (this[r] = t);
|
|
297
|
+
},
|
|
298
|
+
stop: function () {
|
|
299
|
+
this.done = !0;
|
|
300
|
+
var t = this.tryEntries[0].completion;
|
|
301
|
+
if ("throw" === t.type) throw t.arg;
|
|
302
|
+
return this.rval;
|
|
303
|
+
},
|
|
304
|
+
dispatchException: function (e) {
|
|
305
|
+
if (this.done) throw e;
|
|
306
|
+
var r = this;
|
|
307
|
+
function handle(n, o) {
|
|
308
|
+
return a.type = "throw", a.arg = e, r.next = n, o && (r.method = "next", r.arg = t), !!o;
|
|
309
|
+
}
|
|
310
|
+
for (var o = this.tryEntries.length - 1; o >= 0; --o) {
|
|
311
|
+
var i = this.tryEntries[o],
|
|
312
|
+
a = i.completion;
|
|
313
|
+
if ("root" === i.tryLoc) return handle("end");
|
|
314
|
+
if (i.tryLoc <= this.prev) {
|
|
315
|
+
var c = n.call(i, "catchLoc"),
|
|
316
|
+
u = n.call(i, "finallyLoc");
|
|
317
|
+
if (c && u) {
|
|
318
|
+
if (this.prev < i.catchLoc) return handle(i.catchLoc, !0);
|
|
319
|
+
if (this.prev < i.finallyLoc) return handle(i.finallyLoc);
|
|
320
|
+
} else if (c) {
|
|
321
|
+
if (this.prev < i.catchLoc) return handle(i.catchLoc, !0);
|
|
322
|
+
} else {
|
|
323
|
+
if (!u) throw Error("try statement without catch or finally");
|
|
324
|
+
if (this.prev < i.finallyLoc) return handle(i.finallyLoc);
|
|
325
|
+
}
|
|
326
|
+
}
|
|
327
|
+
}
|
|
328
|
+
},
|
|
329
|
+
abrupt: function (t, e) {
|
|
330
|
+
for (var r = this.tryEntries.length - 1; r >= 0; --r) {
|
|
331
|
+
var o = this.tryEntries[r];
|
|
332
|
+
if (o.tryLoc <= this.prev && n.call(o, "finallyLoc") && this.prev < o.finallyLoc) {
|
|
333
|
+
var i = o;
|
|
334
|
+
break;
|
|
335
|
+
}
|
|
336
|
+
}
|
|
337
|
+
i && ("break" === t || "continue" === t) && i.tryLoc <= e && e <= i.finallyLoc && (i = null);
|
|
338
|
+
var a = i ? i.completion : {};
|
|
339
|
+
return a.type = t, a.arg = e, i ? (this.method = "next", this.next = i.finallyLoc, y) : this.complete(a);
|
|
340
|
+
},
|
|
341
|
+
complete: function (t, e) {
|
|
342
|
+
if ("throw" === t.type) throw t.arg;
|
|
343
|
+
return "break" === t.type || "continue" === t.type ? this.next = t.arg : "return" === t.type ? (this.rval = this.arg = t.arg, this.method = "return", this.next = "end") : "normal" === t.type && e && (this.next = e), y;
|
|
344
|
+
},
|
|
345
|
+
finish: function (t) {
|
|
346
|
+
for (var e = this.tryEntries.length - 1; e >= 0; --e) {
|
|
347
|
+
var r = this.tryEntries[e];
|
|
348
|
+
if (r.finallyLoc === t) return this.complete(r.completion, r.afterLoc), resetTryEntry(r), y;
|
|
349
|
+
}
|
|
350
|
+
},
|
|
351
|
+
catch: function (t) {
|
|
352
|
+
for (var e = this.tryEntries.length - 1; e >= 0; --e) {
|
|
353
|
+
var r = this.tryEntries[e];
|
|
354
|
+
if (r.tryLoc === t) {
|
|
355
|
+
var n = r.completion;
|
|
356
|
+
if ("throw" === n.type) {
|
|
357
|
+
var o = n.arg;
|
|
358
|
+
resetTryEntry(r);
|
|
359
|
+
}
|
|
360
|
+
return o;
|
|
361
|
+
}
|
|
362
|
+
}
|
|
363
|
+
throw Error("illegal catch attempt");
|
|
364
|
+
},
|
|
365
|
+
delegateYield: function (e, r, n) {
|
|
366
|
+
return this.delegate = {
|
|
367
|
+
iterator: values(e),
|
|
368
|
+
resultName: r,
|
|
369
|
+
nextLoc: n
|
|
370
|
+
}, "next" === this.method && (this.arg = t), y;
|
|
371
|
+
}
|
|
372
|
+
}, e;
|
|
373
|
+
}
|
|
374
|
+
function _taggedTemplateLiteralLoose(e, t) {
|
|
375
|
+
return t || (t = e.slice(0)), e.raw = t, e;
|
|
376
|
+
}
|
|
377
|
+
|
|
378
|
+
var ETabsOptions;
|
|
379
|
+
(function (ETabsOptions) {
|
|
380
|
+
ETabsOptions["Trial"] = "trial";
|
|
381
|
+
ETabsOptions["License"] = "license";
|
|
382
|
+
ETabsOptions["Apps"] = "apps";
|
|
383
|
+
})(ETabsOptions || (ETabsOptions = {}));
|
|
384
|
+
|
|
385
|
+
var SUPPORT_EMAIL = "geral@spteck.com";
|
|
386
|
+
var EMAIL_BODY_TEMPLATE = "Subject: Support Request from {0} {1}\n\nDear Support Team,\n\nI am reaching out to you because I am experiencing issues with my license. Here are my details:\n\n ** Tenant ID **: {2}\n ** Application ID **: {3} - {4}\n ** User First Name **: {5}\n ** User Last Name **: {6}\n ** Email**: {7}\n\n {8}\n\nBest regards,\n{9} {10}";
|
|
387
|
+
var EMAIL_BODY_TEMPLATE_REQUEST_LICENSE = "Subject: Request for New License {0} {1}\n\nDear Support Team,\n\nI am just contacting you to request a license for the following product. Here are my details:\n\n ** Tenant ID **: {2}\n ** Application ID **: {3} - {4}\n ** User First Name **: {5}\n ** User Last Name **: {6}\n ** Email **: {7}\n\nBest regards,\n{8} {9}";
|
|
388
|
+
|
|
389
|
+
var Mailto = function Mailto(props) {
|
|
390
|
+
var to = props.to,
|
|
391
|
+
from = props.from,
|
|
392
|
+
subject = props.subject,
|
|
393
|
+
body = props.body,
|
|
394
|
+
children = props.children,
|
|
395
|
+
Component = props.as,
|
|
396
|
+
_props$componentProps = props.componentProps,
|
|
397
|
+
componentProps = _props$componentProps === void 0 ? {} : _props$componentProps;
|
|
398
|
+
// Construct the mailto link
|
|
399
|
+
var mailtoLink = "mailto:" + to + "?" + (from ? "from=" + encodeURIComponent(from) + "&" : "") + (subject ? "subject=" + encodeURIComponent(subject) + "&" : "") + (body ? "body=" + encodeURIComponent(body) : "");
|
|
400
|
+
// Ensure the correct element type is rendered
|
|
401
|
+
var RenderedComponent = Component || "a";
|
|
402
|
+
// Handle the click event
|
|
403
|
+
var handleClick = function handleClick(e) {
|
|
404
|
+
e.preventDefault();
|
|
405
|
+
window.open(mailtoLink, "_blank");
|
|
406
|
+
};
|
|
407
|
+
return React__default.createElement(RenderedComponent, Object.assign({
|
|
408
|
+
href: mailtoLink,
|
|
409
|
+
"aria-label": "Send an email to " + to,
|
|
410
|
+
onClick: handleClick
|
|
411
|
+
}, componentProps), children);
|
|
412
|
+
};
|
|
413
|
+
|
|
414
|
+
var openDialog = "Open campaign dialog";
|
|
415
|
+
var deleteCampaign = "Delete this campaign?";
|
|
416
|
+
var tenantInformation = "Tenant Information";
|
|
417
|
+
var licensingType = "Licensing Type";
|
|
418
|
+
var startDate = "Start Date";
|
|
419
|
+
var endDate = "End Date";
|
|
420
|
+
var licenseKey = "License Key";
|
|
421
|
+
var generate = "Generate";
|
|
422
|
+
var cancel = "Cancel";
|
|
423
|
+
var tenantId = "Tenant Id";
|
|
424
|
+
var tenantUrl = "Tenant Url";
|
|
425
|
+
var applicationId = "Application Id";
|
|
426
|
+
var dateError = "End date must be after start date.";
|
|
427
|
+
var submit = "Generate";
|
|
428
|
+
var placeHolderTitle = "Try or Buy Application";
|
|
429
|
+
var placeHolderText = "To use this application, you need to buy a license. Please click on the button below to register and buy a license, or get 'Trial' license to try the application for free.";
|
|
430
|
+
var placeHolderTrialButton = "Try";
|
|
431
|
+
var placeHolderBuyButton = "Buy";
|
|
432
|
+
var placeHolderRegistryButton = "Buy";
|
|
433
|
+
var companyName = "Company Name";
|
|
434
|
+
var contactFirstName = "Contact First Name";
|
|
435
|
+
var contactLastName = "Contact Last Name";
|
|
436
|
+
var contactEmail = "Contact Email";
|
|
437
|
+
var register = "Register";
|
|
438
|
+
var messageLicenseWarning = "The License {0} will expire in {1} day(s) (expires on {2});";
|
|
439
|
+
var trial = "Trial";
|
|
440
|
+
var license = "License";
|
|
441
|
+
var apps = "Apps";
|
|
442
|
+
var contactFirstNameError = "First name is required";
|
|
443
|
+
var contactLastNameError = "Last name is required";
|
|
444
|
+
var contactEmailError = "format Email is invalid";
|
|
445
|
+
var companyNameError = "Company name is required";
|
|
446
|
+
var trialLicenseTitle = "Register for a trial license";
|
|
447
|
+
var trialLicenseText = "To use this application, you need to register for a trial license. Please fill in the form below to get a trial license.";
|
|
448
|
+
var firstName = "First Name";
|
|
449
|
+
var firstnamePlaceholder = "Enter your first name";
|
|
450
|
+
var lastName = "Last Name";
|
|
451
|
+
var lastnamePlaceholder = "Enter your last name";
|
|
452
|
+
var email = "Email";
|
|
453
|
+
var emailPlaceholder = "Enter your email";
|
|
454
|
+
var company = "Company";
|
|
455
|
+
var companyPlaceholder = "Enter your company";
|
|
456
|
+
var messageStatusBlocked = "Your {0} license has been blocked. Please contact support for assistance.";
|
|
457
|
+
var messageStatusExpired = "Your {0} license has expired at {1}. Please renew it to continue using the application.";
|
|
458
|
+
var messageStatusInvalid = "Your {0} license is invalid. This could be due to incorrect information or an issue with the license itself. Please contact support to request a new license.";
|
|
459
|
+
var messageStatusNotFound = "No valid license was found. This could be because you haven't yet requested. Please contact our support team to request a license and gain access to all features.";
|
|
460
|
+
var messageStatusGenericError = "An error occurred while validating your {0} license. Please contact support for assistance";
|
|
461
|
+
var messageStatusValid = "Your {0} license is valid until {1}. You have full access to the application.";
|
|
462
|
+
var messageStatusBlockedShort = "Your {0} license has been blocked.";
|
|
463
|
+
var messageStatusExpiredShort = "Your {0} license has expired at {1}";
|
|
464
|
+
var messageStatusInvalidShort = "Your {0} license is invalid.";
|
|
465
|
+
var messageStatusNotFoundShort = "No valid license was found, Start a trial or request a license for full access.";
|
|
466
|
+
var messageStatusGenericErrorShort = "An error occurred while validating your {0} license.";
|
|
467
|
+
var details = "Details";
|
|
468
|
+
var buyLicense = "Buy License";
|
|
469
|
+
var requestLicense = "Request License";
|
|
470
|
+
var stringsLocEn = {
|
|
471
|
+
openDialog: openDialog,
|
|
472
|
+
deleteCampaign: deleteCampaign,
|
|
473
|
+
tenantInformation: tenantInformation,
|
|
474
|
+
licensingType: licensingType,
|
|
475
|
+
startDate: startDate,
|
|
476
|
+
endDate: endDate,
|
|
477
|
+
licenseKey: licenseKey,
|
|
478
|
+
generate: generate,
|
|
479
|
+
cancel: cancel,
|
|
480
|
+
tenantId: tenantId,
|
|
481
|
+
tenantUrl: tenantUrl,
|
|
482
|
+
applicationId: applicationId,
|
|
483
|
+
dateError: dateError,
|
|
484
|
+
submit: submit,
|
|
485
|
+
placeHolderTitle: placeHolderTitle,
|
|
486
|
+
placeHolderText: placeHolderText,
|
|
487
|
+
placeHolderTrialButton: placeHolderTrialButton,
|
|
488
|
+
placeHolderBuyButton: placeHolderBuyButton,
|
|
489
|
+
placeHolderRegistryButton: placeHolderRegistryButton,
|
|
490
|
+
companyName: companyName,
|
|
491
|
+
contactFirstName: contactFirstName,
|
|
492
|
+
contactLastName: contactLastName,
|
|
493
|
+
contactEmail: contactEmail,
|
|
494
|
+
register: register,
|
|
495
|
+
messageLicenseWarning: messageLicenseWarning,
|
|
496
|
+
trial: trial,
|
|
497
|
+
license: license,
|
|
498
|
+
apps: apps,
|
|
499
|
+
contactFirstNameError: contactFirstNameError,
|
|
500
|
+
contactLastNameError: contactLastNameError,
|
|
501
|
+
contactEmailError: contactEmailError,
|
|
502
|
+
companyNameError: companyNameError,
|
|
503
|
+
trialLicenseTitle: trialLicenseTitle,
|
|
504
|
+
trialLicenseText: trialLicenseText,
|
|
505
|
+
firstName: firstName,
|
|
506
|
+
firstnamePlaceholder: firstnamePlaceholder,
|
|
507
|
+
lastName: lastName,
|
|
508
|
+
lastnamePlaceholder: lastnamePlaceholder,
|
|
509
|
+
email: email,
|
|
510
|
+
emailPlaceholder: emailPlaceholder,
|
|
511
|
+
company: company,
|
|
512
|
+
companyPlaceholder: companyPlaceholder,
|
|
513
|
+
messageStatusBlocked: messageStatusBlocked,
|
|
514
|
+
messageStatusExpired: messageStatusExpired,
|
|
515
|
+
messageStatusInvalid: messageStatusInvalid,
|
|
516
|
+
messageStatusNotFound: messageStatusNotFound,
|
|
517
|
+
messageStatusGenericError: messageStatusGenericError,
|
|
518
|
+
messageStatusValid: messageStatusValid,
|
|
519
|
+
messageStatusBlockedShort: messageStatusBlockedShort,
|
|
520
|
+
messageStatusExpiredShort: messageStatusExpiredShort,
|
|
521
|
+
messageStatusInvalidShort: messageStatusInvalidShort,
|
|
522
|
+
messageStatusNotFoundShort: messageStatusNotFoundShort,
|
|
523
|
+
messageStatusGenericErrorShort: messageStatusGenericErrorShort,
|
|
524
|
+
details: details,
|
|
525
|
+
buyLicense: buyLicense,
|
|
526
|
+
requestLicense: requestLicense
|
|
527
|
+
};
|
|
528
|
+
|
|
529
|
+
var appGlobalStateAtom = /*#__PURE__*/jotai.atom({
|
|
530
|
+
theme: reactComponents.webLightTheme,
|
|
531
|
+
language: "en",
|
|
532
|
+
strings: stringsLocEn,
|
|
533
|
+
refresh: false
|
|
534
|
+
});
|
|
535
|
+
|
|
536
|
+
var _templateObject, _templateObject2, _templateObject3;
|
|
537
|
+
var useLicenseControlStyles = function useLicenseControlStyles() {
|
|
538
|
+
return {
|
|
539
|
+
container: css.css(_templateObject || (_templateObject = _taggedTemplateLiteralLoose(["\n display: flex;\n flex-direction: column;\n row-gap: 10px;\n margin-top: 10px;\n padding: 7px;\n background-color: ", ";\n flex: 1;\n "])), reactComponents.tokens.colorNeutralBackground1),
|
|
540
|
+
title: css.css(_templateObject2 || (_templateObject2 = _taggedTemplateLiteralLoose(["\n display: flex;\n flex-direction: row;\n gap: 10px;\n align-items: center;\n justify-content: start;\n "]))),
|
|
541
|
+
footer: css.css(_templateObject3 || (_templateObject3 = _taggedTemplateLiteralLoose(["\n justify-content: end;\n position: absolute;\n bottom: 20px;\n right: 20px;\n "])))
|
|
542
|
+
};
|
|
543
|
+
};
|
|
544
|
+
|
|
545
|
+
var useUtils = function useUtils() {
|
|
546
|
+
var formatString = React__default.useCallback(function (template) {
|
|
547
|
+
for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
|
|
548
|
+
args[_key - 1] = arguments[_key];
|
|
549
|
+
}
|
|
550
|
+
return template.replace(/{(\d+)}/g, function (match, number) {
|
|
551
|
+
return typeof args[number] !== "undefined" ? args[number] : match;
|
|
552
|
+
});
|
|
553
|
+
}, []);
|
|
554
|
+
var generateSalt = React__default.useCallback(function (tenantId, appId) {
|
|
555
|
+
// Concatenate the inputs with a delimiter
|
|
556
|
+
var inputData = tenantId + ":" + appId;
|
|
557
|
+
// Create a SHA-256 hash
|
|
558
|
+
var hash = cryptoJs.SHA256(inputData).toString();
|
|
559
|
+
return hash;
|
|
560
|
+
}, []);
|
|
561
|
+
return {
|
|
562
|
+
formatString: formatString,
|
|
563
|
+
generateSalt: generateSalt
|
|
564
|
+
};
|
|
565
|
+
};
|
|
566
|
+
|
|
567
|
+
var LicenseControl = function LicenseControl(_ref) {
|
|
568
|
+
var licenseStatus = _ref.licenseStatus,
|
|
569
|
+
onDismiss = _ref.onDismiss,
|
|
570
|
+
licenseType = _ref.licenseType,
|
|
571
|
+
expiryDate = _ref.expiryDate;
|
|
572
|
+
var styles = useLicenseControlStyles();
|
|
573
|
+
var formatDate = new Date(expiryDate).toLocaleDateString();
|
|
574
|
+
var appglobalState = jotai.useAtomValue(appGlobalStateAtom);
|
|
575
|
+
var tenantId = appglobalState.tenantId,
|
|
576
|
+
applicationId = appglobalState.applicationId,
|
|
577
|
+
applicationName = appglobalState.applicationName,
|
|
578
|
+
userInformation = appglobalState.userInformation,
|
|
579
|
+
strings = appglobalState.strings;
|
|
580
|
+
var _useUtils = useUtils(),
|
|
581
|
+
formatString = _useUtils.formatString;
|
|
582
|
+
var getMessageAndAction = React__default.useCallback(function () {
|
|
583
|
+
switch (licenseStatus) {
|
|
584
|
+
case reactHooksLibrary.EStatus.blocked:
|
|
585
|
+
return {
|
|
586
|
+
message: formatString(strings.messageStatusBlocked, licenseType),
|
|
587
|
+
actionLabel: "Contact Support"
|
|
588
|
+
};
|
|
589
|
+
case reactHooksLibrary.EStatus.expired:
|
|
590
|
+
return {
|
|
591
|
+
message: formatString(strings.messageStatusExpired, licenseType, formatDate),
|
|
592
|
+
actionLabel: "Renew License"
|
|
593
|
+
};
|
|
594
|
+
case reactHooksLibrary.EStatus.invalid:
|
|
595
|
+
return {
|
|
596
|
+
message: formatString(strings.messageStatusInvalid, licenseType),
|
|
597
|
+
actionLabel: "Request New License"
|
|
598
|
+
};
|
|
599
|
+
case reactHooksLibrary.EStatus.notFound:
|
|
600
|
+
return {
|
|
601
|
+
message: strings.messageStatusNotFound,
|
|
602
|
+
actionLabel: "Request License"
|
|
603
|
+
};
|
|
604
|
+
case reactHooksLibrary.EStatus.genericError:
|
|
605
|
+
return {
|
|
606
|
+
message: formatString(strings.messageStatusGenericError, ""),
|
|
607
|
+
actionLabel: "Contact Support"
|
|
608
|
+
};
|
|
609
|
+
case reactHooksLibrary.EStatus.valid:
|
|
610
|
+
return {
|
|
611
|
+
message: formatString(strings.messageStatusValid, licenseType, formatDate),
|
|
612
|
+
actionLabel: undefined
|
|
613
|
+
};
|
|
614
|
+
default:
|
|
615
|
+
return undefined;
|
|
616
|
+
}
|
|
617
|
+
}, [licenseStatus]);
|
|
618
|
+
var content = React__default.useMemo(function () {
|
|
619
|
+
return getMessageAndAction();
|
|
620
|
+
}, [getMessageAndAction]);
|
|
621
|
+
// utils.ts
|
|
622
|
+
var generateBodyText = React__default.useCallback(function () {
|
|
623
|
+
var _content;
|
|
624
|
+
var mail = userInformation.mail,
|
|
625
|
+
givenName = userInformation.givenName,
|
|
626
|
+
surname = userInformation.surname;
|
|
627
|
+
var body = EMAIL_BODY_TEMPLATE;
|
|
628
|
+
if (licenseStatus === reactHooksLibrary.EStatus.notFound) {
|
|
629
|
+
body = EMAIL_BODY_TEMPLATE_REQUEST_LICENSE;
|
|
630
|
+
content = {
|
|
631
|
+
actionLabel: "Request License",
|
|
632
|
+
message: ""
|
|
633
|
+
};
|
|
634
|
+
}
|
|
635
|
+
var message = formatString(body, givenName, surname, tenantId, applicationId, applicationName, givenName, surname, mail, (_content = content) == null ? void 0 : _content.message, givenName, surname);
|
|
636
|
+
return message;
|
|
637
|
+
}, [tenantId, applicationId, userInformation, content]);
|
|
638
|
+
if (!content) return React__default.createElement(React__default.Fragment, null);
|
|
639
|
+
return React__default.createElement("div", {
|
|
640
|
+
className: styles.container
|
|
641
|
+
}, React__default.createElement(reactComponents.Text, null, content.message), React__default.createElement(reactComponents.CardFooter, {
|
|
642
|
+
className: styles.footer
|
|
643
|
+
}, content.actionLabel && React__default.createElement(Mailto, {
|
|
644
|
+
to: SUPPORT_EMAIL,
|
|
645
|
+
from: userInformation == null ? void 0 : userInformation.mail,
|
|
646
|
+
subject: "Support request - " + applicationName,
|
|
647
|
+
body: generateBodyText(),
|
|
648
|
+
as: reactComponents.Button,
|
|
649
|
+
componentProps: {
|
|
650
|
+
appearance: "primary",
|
|
651
|
+
target: "_blank"
|
|
652
|
+
}
|
|
653
|
+
}, content.actionLabel), React__default.createElement(reactComponents.Button, {
|
|
654
|
+
appearance: "secondary",
|
|
655
|
+
onClick: onDismiss
|
|
656
|
+
}, "Close")));
|
|
657
|
+
};
|
|
658
|
+
|
|
659
|
+
var useRenderHeaderStyles = /*#__PURE__*/reactComponents.makeStyles({
|
|
660
|
+
closeButton: {
|
|
661
|
+
marginLeft: "auto",
|
|
662
|
+
position: "absolute",
|
|
663
|
+
top: "10px",
|
|
664
|
+
right: "10px",
|
|
665
|
+
zIndex: 99999
|
|
666
|
+
},
|
|
667
|
+
divider: {
|
|
668
|
+
width: "100%",
|
|
669
|
+
height: "1px",
|
|
670
|
+
backgroundColor: reactComponents.tokens.colorNeutralStroke1,
|
|
671
|
+
marginTop: "6px"
|
|
672
|
+
},
|
|
673
|
+
renderHeaderContent: {
|
|
674
|
+
display: "flex",
|
|
675
|
+
flexDirection: "column",
|
|
676
|
+
justifyContent: "flex-start",
|
|
677
|
+
alignItems: "stretch",
|
|
678
|
+
width: "100%"
|
|
679
|
+
},
|
|
680
|
+
renderHeaderHeader: /*#__PURE__*/_extends({
|
|
681
|
+
display: "flex",
|
|
682
|
+
flexDirection: "column",
|
|
683
|
+
justifyContent: "flex-start"
|
|
684
|
+
}, /*#__PURE__*/reactComponents.shorthands.padding("10px"), {
|
|
685
|
+
gap: "20px"
|
|
686
|
+
}),
|
|
687
|
+
renderHeaderFooter: /*#__PURE__*/_extends({
|
|
688
|
+
display: "flex",
|
|
689
|
+
flexDirection: "row",
|
|
690
|
+
justifyContent: "flex-start"
|
|
691
|
+
}, /*#__PURE__*/reactComponents.shorthands.padding("20px"), {
|
|
692
|
+
gap: "20px"
|
|
693
|
+
}),
|
|
694
|
+
renderHeaderBody: /*#__PURE__*/_extends({
|
|
695
|
+
display: "flex",
|
|
696
|
+
flexDirection: "column",
|
|
697
|
+
justifyContent: "flex-start"
|
|
698
|
+
}, /*#__PURE__*/reactComponents.shorthands.padding("20px"), {
|
|
699
|
+
gap: "20px"
|
|
700
|
+
}),
|
|
701
|
+
renderHeaderTitleContainer: {
|
|
702
|
+
display: "flex",
|
|
703
|
+
flexDirection: "row",
|
|
704
|
+
justifyContent: "flex-start",
|
|
705
|
+
alignItems: "center"
|
|
706
|
+
},
|
|
707
|
+
renderHeaderTitle: {
|
|
708
|
+
display: "-webkit-box",
|
|
709
|
+
"-webkit-line-clamp": "1",
|
|
710
|
+
"-webkit-box-orient": "vertical",
|
|
711
|
+
textAlign: "start",
|
|
712
|
+
textOverflow: "ellipsis",
|
|
713
|
+
wordBreak: "break-word"
|
|
714
|
+
},
|
|
715
|
+
renderHeaderDescription: {
|
|
716
|
+
display: "-webkit-box",
|
|
717
|
+
"-webkit-line-clamp": "4",
|
|
718
|
+
"-webkit-box-orient": "vertical",
|
|
719
|
+
textAlign: "start",
|
|
720
|
+
textOverflow: "ellipsis",
|
|
721
|
+
wordBreak: "break-word"
|
|
722
|
+
},
|
|
723
|
+
dialogTitleAndDescriptionContainer: {
|
|
724
|
+
display: "flex",
|
|
725
|
+
flexDirection: "column",
|
|
726
|
+
justifyContent: "start",
|
|
727
|
+
alignItems: "start",
|
|
728
|
+
paddingLeft: "10px",
|
|
729
|
+
paddingRight: "20px"
|
|
730
|
+
}
|
|
731
|
+
});
|
|
732
|
+
|
|
733
|
+
var RenderHeader = function RenderHeader(props) {
|
|
734
|
+
var onDismiss = props.onDismiss,
|
|
735
|
+
title = props.title,
|
|
736
|
+
description = props.description,
|
|
737
|
+
icon = props.icon;
|
|
738
|
+
var styles = useRenderHeaderStyles();
|
|
739
|
+
return React.createElement(React.Fragment, null, React.createElement("div", {
|
|
740
|
+
className: styles.renderHeaderContent
|
|
741
|
+
}, React.createElement("div", {
|
|
742
|
+
className: styles.renderHeaderHeader
|
|
743
|
+
}, React.createElement(reactComponents.Button, {
|
|
744
|
+
appearance: "subtle",
|
|
745
|
+
className: styles.closeButton,
|
|
746
|
+
onClick: function onClick(ev) {
|
|
747
|
+
ev.stopPropagation();
|
|
748
|
+
ev.preventDefault();
|
|
749
|
+
onDismiss(false);
|
|
750
|
+
},
|
|
751
|
+
icon: React.createElement(reactIcons.Dismiss24Regular, null)
|
|
752
|
+
}), React.createElement("div", {
|
|
753
|
+
className: styles.renderHeaderTitleContainer
|
|
754
|
+
}, React.isValidElement(icon) ? icon : React.createElement(react.Icon, {
|
|
755
|
+
icon: icon
|
|
756
|
+
}), React.createElement("div", {
|
|
757
|
+
className: styles.dialogTitleAndDescriptionContainer
|
|
758
|
+
}, React.isValidElement(title) ? title : React.createElement(reactComponents.Subtitle1, {
|
|
759
|
+
className: styles.renderHeaderTitle
|
|
760
|
+
}, title), React.isValidElement(description) ? description : React.createElement(reactComponents.Caption1, {
|
|
761
|
+
className: styles.renderHeaderDescription
|
|
762
|
+
}, description)))), React.createElement("div", {
|
|
763
|
+
className: styles.divider
|
|
764
|
+
})));
|
|
765
|
+
};
|
|
766
|
+
|
|
767
|
+
var useRenderLabelStyles = /*#__PURE__*/reactComponents.makeStyles({
|
|
768
|
+
labelContainer: /*#__PURE__*/_extends({
|
|
769
|
+
display: "flex",
|
|
770
|
+
flexDirection: "row",
|
|
771
|
+
justifyContent: "flex-start",
|
|
772
|
+
alignItems: "center"
|
|
773
|
+
}, /*#__PURE__*/reactComponents.shorthands.gap("6px")),
|
|
774
|
+
iconStyles: {
|
|
775
|
+
width: "26px"
|
|
776
|
+
},
|
|
777
|
+
item: {
|
|
778
|
+
paddingLeft: "15px"
|
|
779
|
+
}
|
|
780
|
+
});
|
|
781
|
+
|
|
782
|
+
var RenderLabel = function RenderLabel(props) {
|
|
783
|
+
var label = props.label,
|
|
784
|
+
icon = props.icon,
|
|
785
|
+
isRequired = props.isRequired;
|
|
786
|
+
var styles = useRenderLabelStyles();
|
|
787
|
+
return React.createElement(React.Fragment, null, React.createElement("div", {
|
|
788
|
+
className: styles.labelContainer
|
|
789
|
+
}, icon && React.isValidElement(icon) ? icon : React.createElement(react.Icon, {
|
|
790
|
+
icon: icon,
|
|
791
|
+
className: styles.iconStyles,
|
|
792
|
+
width: "20px",
|
|
793
|
+
height: "20px",
|
|
794
|
+
color: reactComponents.tokens.colorBrandForeground1
|
|
795
|
+
}), React.createElement(reactComponents.Caption1, {
|
|
796
|
+
style: {
|
|
797
|
+
color: reactComponents.tokens.colorBrandForeground1
|
|
798
|
+
}
|
|
799
|
+
}, label), React.createElement(reactComponents.Caption1, {
|
|
800
|
+
style: {
|
|
801
|
+
color: reactComponents.tokens.colorPaletteRedForeground1
|
|
802
|
+
}
|
|
803
|
+
}, isRequired ? " *" : "")));
|
|
804
|
+
};
|
|
805
|
+
|
|
806
|
+
var _templateObject$1, _templateObject2$1, _templateObject3$1;
|
|
807
|
+
var useStyles = function useStyles() {
|
|
808
|
+
return {
|
|
809
|
+
container: css.css(_templateObject$1 || (_templateObject$1 = _taggedTemplateLiteralLoose(["\n display: flex;\n flex-direction: column;\n row-gap: 10px;\n margin-top: 10px;\n padding: 7px;\n background-color: ", ";\n "])), reactComponents.tokens.colorNeutralBackground1),
|
|
810
|
+
title: css.css(_templateObject2$1 || (_templateObject2$1 = _taggedTemplateLiteralLoose(["\n display: flex;\n flex-direction: row;\n gap: 10px;\n align-items: center;\n justify-content: start;\n "]))),
|
|
811
|
+
cardFooter: css.css(_templateObject3$1 || (_templateObject3$1 = _taggedTemplateLiteralLoose(["\n align-self: flex-end;\n margin-top: 15px;\n "])))
|
|
812
|
+
};
|
|
813
|
+
};
|
|
814
|
+
|
|
815
|
+
var TrialLicense = function TrialLicense(props) {
|
|
816
|
+
var _React$useState = React.useState({}),
|
|
817
|
+
errors = _React$useState[0],
|
|
818
|
+
setErrors = _React$useState[1];
|
|
819
|
+
var onTrialLicenseAdded = props.onTrialLicenseAdded,
|
|
820
|
+
onDismiss = props.onDismiss;
|
|
821
|
+
var appGlobalState = jotai.useAtomValue(appGlobalStateAtom);
|
|
822
|
+
var userInformation = appGlobalState.userInformation,
|
|
823
|
+
strings = appGlobalState.strings,
|
|
824
|
+
tenantId = appGlobalState.tenantId,
|
|
825
|
+
context = appGlobalState.context;
|
|
826
|
+
var _useUtils = useUtils(),
|
|
827
|
+
generateSalt = _useUtils.generateSalt;
|
|
828
|
+
var _React$useState2 = React.useState(undefined),
|
|
829
|
+
error = _React$useState2[0],
|
|
830
|
+
setError = _React$useState2[1];
|
|
831
|
+
var _useLicenseManager = reactHooksLibrary.useLicenseManager(tenantId, context == null ? void 0 : context.manifest.id, generateSalt(tenantId, context == null ? void 0 : context.manifest.id), context),
|
|
832
|
+
requestTrialLicense = _useLicenseManager.requestTrialLicense;
|
|
833
|
+
// Define Zod schema for validation
|
|
834
|
+
var trialLicenseSchema = zod.z.object({
|
|
835
|
+
contactFirstName: zod.z.string().min(1, strings.contactFirstNameError),
|
|
836
|
+
contactLastName: zod.z.string().min(1, strings.contactLastNameError),
|
|
837
|
+
contactEmail: zod.z.string().email(strings.contactEmailError),
|
|
838
|
+
contactCompany: zod.z.string().min(1, strings.contactCompanyError)
|
|
839
|
+
});
|
|
840
|
+
var _React$useState3 = React.useState({
|
|
841
|
+
contactFirstName: userInformation == null ? void 0 : userInformation.givenName,
|
|
842
|
+
contactLastName: userInformation == null ? void 0 : userInformation.surname,
|
|
843
|
+
contactEmail: userInformation == null ? void 0 : userInformation.mail,
|
|
844
|
+
contactCompany: ""
|
|
845
|
+
}),
|
|
846
|
+
formData = _React$useState3[0],
|
|
847
|
+
setFormData = _React$useState3[1];
|
|
848
|
+
var handleInputChange = React.useCallback(function (e) {
|
|
849
|
+
var _e$target = e.target,
|
|
850
|
+
name = _e$target.name,
|
|
851
|
+
value = _e$target.value;
|
|
852
|
+
setFormData(function (prev) {
|
|
853
|
+
var _extends2;
|
|
854
|
+
return _extends({}, prev, (_extends2 = {}, _extends2[name] = value, _extends2));
|
|
855
|
+
});
|
|
856
|
+
}, []);
|
|
857
|
+
var styles = useStyles();
|
|
858
|
+
var handleSubmit = React.useCallback(/*#__PURE__*/function () {
|
|
859
|
+
var _ref = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee(e) {
|
|
860
|
+
var validation, fieldErrors;
|
|
861
|
+
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
862
|
+
while (1) switch (_context.prev = _context.next) {
|
|
863
|
+
case 0:
|
|
864
|
+
e.preventDefault();
|
|
865
|
+
// Validate form data using Zod schema
|
|
866
|
+
validation = trialLicenseSchema.safeParse(formData);
|
|
867
|
+
if (validation.success) {
|
|
868
|
+
_context.next = 8;
|
|
869
|
+
break;
|
|
870
|
+
}
|
|
871
|
+
// Map errors for display
|
|
872
|
+
fieldErrors = {};
|
|
873
|
+
validation.error.errors.forEach(function (error) {
|
|
874
|
+
var fieldName = error.path[0];
|
|
875
|
+
fieldErrors[fieldName] = error.message;
|
|
876
|
+
});
|
|
877
|
+
setErrors(fieldErrors);
|
|
878
|
+
_context.next = 19;
|
|
879
|
+
break;
|
|
880
|
+
case 8:
|
|
881
|
+
// Clear errors and call the parent function
|
|
882
|
+
setErrors({});
|
|
883
|
+
_context.prev = 9;
|
|
884
|
+
_context.next = 12;
|
|
885
|
+
return requestTrialLicense(tenantId, context.manifest.id, formData.contactFirstName, formData.contactLastName, formData.contactEmail, formData.contactCompany);
|
|
886
|
+
case 12:
|
|
887
|
+
onTrialLicenseAdded();
|
|
888
|
+
_context.next = 19;
|
|
889
|
+
break;
|
|
890
|
+
case 15:
|
|
891
|
+
_context.prev = 15;
|
|
892
|
+
_context.t0 = _context["catch"](9);
|
|
893
|
+
console.error(_context.t0);
|
|
894
|
+
setError(_context.t0);
|
|
895
|
+
case 19:
|
|
896
|
+
case "end":
|
|
897
|
+
return _context.stop();
|
|
898
|
+
}
|
|
899
|
+
}, _callee, null, [[9, 15]]);
|
|
900
|
+
}));
|
|
901
|
+
return function (_x) {
|
|
902
|
+
return _ref.apply(this, arguments);
|
|
903
|
+
};
|
|
904
|
+
}(), [formData, onTrialLicenseAdded]);
|
|
905
|
+
return React.createElement("div", {
|
|
906
|
+
className: styles.container
|
|
907
|
+
}, React.createElement("div", null, React.createElement(reactComponents.Body1Strong, {
|
|
908
|
+
className: styles.title
|
|
909
|
+
}, strings.trialLicenseTitle), React.createElement(reactComponents.Body1, null, strings.trialLicenseText)), React.createElement(React.Fragment, null, React.createElement(reactComponents.Field, {
|
|
910
|
+
label: React.createElement(RenderLabel, {
|
|
911
|
+
label: strings.firstName,
|
|
912
|
+
isRequired: true
|
|
913
|
+
}),
|
|
914
|
+
validationState: errors.contactFirstName ? "error" : "none",
|
|
915
|
+
validationMessage: errors.contactFirstName || undefined
|
|
916
|
+
}, React.createElement(reactComponents.Input, {
|
|
917
|
+
name: "contactFirstName",
|
|
918
|
+
value: formData.contactFirstName,
|
|
919
|
+
onChange: handleInputChange,
|
|
920
|
+
placeholder: strings.firstNamePlaceholder
|
|
921
|
+
})), React.createElement(reactComponents.Field, {
|
|
922
|
+
label: React.createElement(RenderLabel, {
|
|
923
|
+
label: strings.lastName,
|
|
924
|
+
isRequired: true
|
|
925
|
+
}),
|
|
926
|
+
validationState: errors.contactLastName ? "error" : "none",
|
|
927
|
+
validationMessage: errors.contactLastName || undefined
|
|
928
|
+
}, React.createElement(reactComponents.Input, {
|
|
929
|
+
name: "contactLastName",
|
|
930
|
+
value: formData.contactLastName,
|
|
931
|
+
onChange: handleInputChange,
|
|
932
|
+
placeholder: strings.lastNamePlaceholder
|
|
933
|
+
})), React.createElement(reactComponents.Field, {
|
|
934
|
+
label: React.createElement(RenderLabel, {
|
|
935
|
+
label: strings.email,
|
|
936
|
+
isRequired: true
|
|
937
|
+
}),
|
|
938
|
+
validationState: errors.contactEmail ? "error" : "none",
|
|
939
|
+
validationMessage: errors.contactEmail || undefined
|
|
940
|
+
}, React.createElement(reactComponents.Input, {
|
|
941
|
+
name: "contactEmail",
|
|
942
|
+
value: formData.contactEmail,
|
|
943
|
+
onChange: handleInputChange,
|
|
944
|
+
placeholder: strings.emailPlaceholder
|
|
945
|
+
})), React.createElement(reactComponents.Field, {
|
|
946
|
+
label: React.createElement(RenderLabel, {
|
|
947
|
+
label: strings.company,
|
|
948
|
+
isRequired: true
|
|
949
|
+
}),
|
|
950
|
+
validationState: errors.contactCompany ? "error" : "none",
|
|
951
|
+
validationMessage: errors.contactCompany || undefined
|
|
952
|
+
}, React.createElement(reactComponents.Input, {
|
|
953
|
+
name: "contactCompany",
|
|
954
|
+
value: formData.contactCompany,
|
|
955
|
+
onChange: handleInputChange,
|
|
956
|
+
placeholder: strings.companyPlaceholder
|
|
957
|
+
})), error && React.createElement(reactComponents.MessageBar, {
|
|
958
|
+
style: {
|
|
959
|
+
marginTop: 10,
|
|
960
|
+
marginBottom: 10
|
|
961
|
+
},
|
|
962
|
+
intent: "error"
|
|
963
|
+
}, " ", error.message), React.createElement(reactComponents.CardFooter, {
|
|
964
|
+
className: styles.cardFooter
|
|
965
|
+
}, React.createElement(reactComponents.Button, {
|
|
966
|
+
appearance: "primary",
|
|
967
|
+
onClick: handleSubmit
|
|
968
|
+
}, strings.register), React.createElement(reactComponents.Button, {
|
|
969
|
+
appearance: "secondary",
|
|
970
|
+
onClick: onDismiss
|
|
971
|
+
}, strings.cancel))));
|
|
972
|
+
};
|
|
973
|
+
|
|
974
|
+
var RegisterDialog = function RegisterDialog(props) {
|
|
975
|
+
var licenseStatus = props.licenseStatus,
|
|
976
|
+
open = props.open,
|
|
977
|
+
onDismiss = props.onDismiss,
|
|
978
|
+
licenseType = props.licenseType,
|
|
979
|
+
expiryDate = props.expiryDate;
|
|
980
|
+
var _useAtom = jotai.useAtom(appGlobalStateAtom),
|
|
981
|
+
appGlobalState = _useAtom[0],
|
|
982
|
+
setAppGlobalState = _useAtom[1];
|
|
983
|
+
var theme = appGlobalState.theme,
|
|
984
|
+
applicationName = appGlobalState.applicationName,
|
|
985
|
+
applicationIcon = appGlobalState.applicationIcon,
|
|
986
|
+
strings = appGlobalState.strings,
|
|
987
|
+
_appGlobalState$showA = appGlobalState.showApps,
|
|
988
|
+
showApps = _appGlobalState$showA === void 0 ? false : _appGlobalState$showA;
|
|
989
|
+
var _React$useState = React__default.useState("trial"),
|
|
990
|
+
selectedValue = _React$useState[0],
|
|
991
|
+
setSelectedValue = _React$useState[1];
|
|
992
|
+
var tabs = React__default.useMemo(function () {
|
|
993
|
+
var defaultTabs = [{
|
|
994
|
+
id: "trial",
|
|
995
|
+
value: "trial",
|
|
996
|
+
label: strings.trial,
|
|
997
|
+
icon: React__default.createElement(reactIcons.Clock20Regular, null)
|
|
998
|
+
}, {
|
|
999
|
+
id: "license",
|
|
1000
|
+
value: "license",
|
|
1001
|
+
label: strings.license,
|
|
1002
|
+
icon: React__default.createElement(reactIcons.Key20Regular, null)
|
|
1003
|
+
}];
|
|
1004
|
+
if (showApps) {
|
|
1005
|
+
tabs.push({
|
|
1006
|
+
id: "apps",
|
|
1007
|
+
value: "apps",
|
|
1008
|
+
label: strings.apps,
|
|
1009
|
+
icon: React__default.createElement(reactIcons.Apps20Regular, null)
|
|
1010
|
+
});
|
|
1011
|
+
}
|
|
1012
|
+
return defaultTabs;
|
|
1013
|
+
}, [strings]);
|
|
1014
|
+
var onTabSelect = React__default.useCallback(function (_event, data) {
|
|
1015
|
+
setSelectedValue(data.value);
|
|
1016
|
+
}, []);
|
|
1017
|
+
React__default.useEffect(function () {
|
|
1018
|
+
var _statusToTab;
|
|
1019
|
+
var statusToTab = (_statusToTab = {}, _statusToTab[reactHooksLibrary.EStatus.notFound] = ETabsOptions.Trial, _statusToTab[reactHooksLibrary.EStatus.expired] = ETabsOptions.License, _statusToTab[reactHooksLibrary.EStatus.invalid] = ETabsOptions.License, _statusToTab[reactHooksLibrary.EStatus.blocked] = ETabsOptions.License, _statusToTab[reactHooksLibrary.EStatus.genericError] = ETabsOptions.License, _statusToTab[reactHooksLibrary.EStatus.valid] = ETabsOptions.License, _statusToTab);
|
|
1020
|
+
setSelectedValue(statusToTab[licenseStatus] || ETabsOptions.Trial);
|
|
1021
|
+
}, [licenseStatus]);
|
|
1022
|
+
var renderPanel = React__default.useMemo(function () {
|
|
1023
|
+
switch (selectedValue) {
|
|
1024
|
+
case "trial":
|
|
1025
|
+
return React__default.createElement(TrialLicense, {
|
|
1026
|
+
onTrialLicenseAdded: function onTrialLicenseAdded() {
|
|
1027
|
+
setAppGlobalState(_extends({}, appGlobalState, {
|
|
1028
|
+
refresh: true
|
|
1029
|
+
}));
|
|
1030
|
+
onDismiss();
|
|
1031
|
+
},
|
|
1032
|
+
onDismiss: onDismiss
|
|
1033
|
+
});
|
|
1034
|
+
case "license":
|
|
1035
|
+
return React__default.createElement(LicenseControl, {
|
|
1036
|
+
licenseStatus: licenseStatus,
|
|
1037
|
+
onDismiss: onDismiss,
|
|
1038
|
+
licenseType: licenseType,
|
|
1039
|
+
expiryDate: expiryDate
|
|
1040
|
+
});
|
|
1041
|
+
case "apps":
|
|
1042
|
+
return React__default.createElement("div", null, "Apps");
|
|
1043
|
+
default:
|
|
1044
|
+
return React__default.createElement(React__default.Fragment, null);
|
|
1045
|
+
}
|
|
1046
|
+
}, [selectedValue, licenseStatus, licenseType, expiryDate]);
|
|
1047
|
+
var filterTabs = React__default.useCallback(function (tab) {
|
|
1048
|
+
if ((licenseType == null ? void 0 : licenseType.toLocaleLowerCase()) === ETabsOptions.Trial.toLocaleLowerCase() || licenseStatus.toLocaleLowerCase() === reactHooksLibrary.EStatus.genericError.toLocaleLowerCase()) {
|
|
1049
|
+
return tab.id.toLocaleLowerCase() !== ETabsOptions.Trial.toLocaleLowerCase();
|
|
1050
|
+
}
|
|
1051
|
+
return true;
|
|
1052
|
+
}, [licenseType, licenseStatus]);
|
|
1053
|
+
return React__default.createElement(reactComponents.FluentProvider, {
|
|
1054
|
+
theme: theme
|
|
1055
|
+
}, React__default.createElement(reactComponents.Dialog, {
|
|
1056
|
+
open: open,
|
|
1057
|
+
modalType: "modal"
|
|
1058
|
+
}, React__default.createElement(reactComponents.DialogSurface, {
|
|
1059
|
+
style: {
|
|
1060
|
+
minHeight: 300
|
|
1061
|
+
}
|
|
1062
|
+
}, React__default.createElement(reactComponents.DialogTitle, null, React__default.createElement(RenderHeader, {
|
|
1063
|
+
icon: applicationIcon,
|
|
1064
|
+
title: applicationName,
|
|
1065
|
+
onDismiss: onDismiss
|
|
1066
|
+
})), React__default.createElement(reactComponents.TabList, {
|
|
1067
|
+
selectedValue: selectedValue,
|
|
1068
|
+
onTabSelect: onTabSelect,
|
|
1069
|
+
selectTabOnFocus: true,
|
|
1070
|
+
size: "medium"
|
|
1071
|
+
}, tabs.filter(filterTabs).map(function (tab) {
|
|
1072
|
+
return React__default.createElement(reactComponents.Tab, {
|
|
1073
|
+
key: tab.id,
|
|
1074
|
+
value: tab.value,
|
|
1075
|
+
icon: tab.icon
|
|
1076
|
+
}, tab.label);
|
|
1077
|
+
})), renderPanel, React__default.createElement(reactComponents.DialogActions, null))));
|
|
1078
|
+
};
|
|
1079
|
+
|
|
1080
|
+
var _templateObject$2, _templateObject2$2, _templateObject3$2, _templateObject4, _templateObject5, _templateObject6;
|
|
1081
|
+
var useStyles$1 = function useStyles() {
|
|
1082
|
+
return {
|
|
1083
|
+
container: css.css(_templateObject$2 || (_templateObject$2 = _taggedTemplateLiteralLoose(["\n display: flex;\n flex-direction: column;\n row-gap: 10px;\n margin-top: 10px;\n margin-bottom: 30px;\n "]))),
|
|
1084
|
+
titleContainer: css.css(_templateObject2$2 || (_templateObject2$2 = _taggedTemplateLiteralLoose(["\n display: flex;\n flex-direction: column;\n width: 100%;\n justify-content: center;\n align-items: center;\n gap: 10px;\n "]))),
|
|
1085
|
+
titleAndIcon: css.css(_templateObject3$2 || (_templateObject3$2 = _taggedTemplateLiteralLoose(["\n display: flex;\n flex-direction: row;\n gap: 10px;\n align-items: center;\n "]))),
|
|
1086
|
+
informationPanel: css.css(_templateObject4 || (_templateObject4 = _taggedTemplateLiteralLoose(["\n padding: 20px;\n display: flex;\n flex-direction: column;\n gap: 10px;\n background-color: ", ";\n "])), reactComponents.tokens.colorNeutralBackground3),
|
|
1087
|
+
infoRow: css.css(_templateObject5 || (_templateObject5 = _taggedTemplateLiteralLoose(["\n display: flex;\n gap: 10px;\n justify-content: center;\n align-items: center;\n width: 100%;\n "]))),
|
|
1088
|
+
title: css.css(_templateObject6 || (_templateObject6 = _taggedTemplateLiteralLoose(["\n display: flex;\n flex-direction: row;\n gap: 10px;\n align-items: center;\n "])))
|
|
1089
|
+
};
|
|
1090
|
+
};
|
|
1091
|
+
|
|
1092
|
+
var LicensePlaceHolder = function LicensePlaceHolder(props) {
|
|
1093
|
+
var appglobalState = jotai.useAtomValue(appGlobalStateAtom);
|
|
1094
|
+
var theme = appglobalState.theme,
|
|
1095
|
+
applicationName = appglobalState.applicationName,
|
|
1096
|
+
applicationIcon = appglobalState.applicationIcon,
|
|
1097
|
+
placeHolderText = appglobalState.placeHolderText,
|
|
1098
|
+
strings = appglobalState.strings;
|
|
1099
|
+
var styles = useStyles$1();
|
|
1100
|
+
var _React$useState = React.useState(false),
|
|
1101
|
+
isOpenLicenseForm = _React$useState[0],
|
|
1102
|
+
setIsOpenLicenseForm = _React$useState[1];
|
|
1103
|
+
var licenseStatus = props.licenseStatus,
|
|
1104
|
+
licenseType = props.licenseType,
|
|
1105
|
+
expiryDate = props.expiryDate;
|
|
1106
|
+
var _useUtils = useUtils(),
|
|
1107
|
+
formatString = _useUtils.formatString;
|
|
1108
|
+
var onDissmiss = React.useCallback(function () {
|
|
1109
|
+
setIsOpenLicenseForm(false);
|
|
1110
|
+
}, []);
|
|
1111
|
+
var formatDate = React.useMemo(function () {
|
|
1112
|
+
return new Date(expiryDate).toLocaleDateString();
|
|
1113
|
+
}, [expiryDate]);
|
|
1114
|
+
var getMessageAndAction = React.useCallback(function () {
|
|
1115
|
+
switch (licenseStatus) {
|
|
1116
|
+
case reactHooksLibrary.EStatus.blocked:
|
|
1117
|
+
return {
|
|
1118
|
+
message: formatString(strings.messageStatusBlockedShort, licenseType),
|
|
1119
|
+
actionLabel: strings.details
|
|
1120
|
+
};
|
|
1121
|
+
case reactHooksLibrary.EStatus.expired:
|
|
1122
|
+
return {
|
|
1123
|
+
message: formatString(strings.messageStatusExpiredShort, licenseType, formatDate),
|
|
1124
|
+
actionLabel: strings.buyLicense
|
|
1125
|
+
};
|
|
1126
|
+
case reactHooksLibrary.EStatus.invalid:
|
|
1127
|
+
return {
|
|
1128
|
+
message: formatString(strings.messageStatusInvalidShort, licenseType != null ? licenseType : ""),
|
|
1129
|
+
actionLabel: strings.details
|
|
1130
|
+
};
|
|
1131
|
+
case reactHooksLibrary.EStatus.notFound:
|
|
1132
|
+
return {
|
|
1133
|
+
message: formatString(strings.messageStatusNotFoundShort),
|
|
1134
|
+
actionLabel: strings.requestLicense
|
|
1135
|
+
};
|
|
1136
|
+
case reactHooksLibrary.EStatus.genericError:
|
|
1137
|
+
return {
|
|
1138
|
+
message: formatString(strings.messageStatusGenericErrorShort, licenseType != null ? licenseType : ""),
|
|
1139
|
+
actionLabel: strings.details
|
|
1140
|
+
};
|
|
1141
|
+
default:
|
|
1142
|
+
return undefined;
|
|
1143
|
+
}
|
|
1144
|
+
}, [licenseStatus]);
|
|
1145
|
+
var content = React.useMemo(function () {
|
|
1146
|
+
return getMessageAndAction();
|
|
1147
|
+
}, [getMessageAndAction]);
|
|
1148
|
+
return React.createElement(React.Fragment, null, React.createElement(reactComponents.FluentProvider, {
|
|
1149
|
+
theme: theme
|
|
1150
|
+
}, React.createElement("div", {
|
|
1151
|
+
className: styles.informationPanel
|
|
1152
|
+
}, React.createElement("div", {
|
|
1153
|
+
className: styles.infoRow
|
|
1154
|
+
}, React.createElement("div", {
|
|
1155
|
+
className: styles.title
|
|
1156
|
+
}, React.createElement("div", {
|
|
1157
|
+
className: styles.titleContainer
|
|
1158
|
+
}, React.createElement("div", {
|
|
1159
|
+
className: styles.titleAndIcon
|
|
1160
|
+
}, applicationIcon, " ", React.createElement(reactComponents.Subtitle1, null, " ", applicationName), " "), React.createElement(reactComponents.Body1, null, placeHolderText)))), React.createElement("div", {
|
|
1161
|
+
className: styles.infoRow
|
|
1162
|
+
}, React.createElement(reactComponents.Body1Strong, null, " ", content == null ? void 0 : content.message)), React.createElement("div", {
|
|
1163
|
+
className: styles.infoRow
|
|
1164
|
+
}, React.createElement(reactComponents.DialogActions, {
|
|
1165
|
+
style: {
|
|
1166
|
+
marginTop: 15
|
|
1167
|
+
}
|
|
1168
|
+
}, React.createElement(reactComponents.Button, {
|
|
1169
|
+
appearance: "primary",
|
|
1170
|
+
onClick: function onClick() {
|
|
1171
|
+
setIsOpenLicenseForm(true);
|
|
1172
|
+
}
|
|
1173
|
+
}, content == null ? void 0 : content.actionLabel)), isOpenLicenseForm && React.createElement(RegisterDialog, {
|
|
1174
|
+
licenseStatus: licenseStatus,
|
|
1175
|
+
licenseType: licenseType,
|
|
1176
|
+
expiryDate: expiryDate,
|
|
1177
|
+
open: isOpenLicenseForm,
|
|
1178
|
+
onDismiss: onDissmiss
|
|
1179
|
+
})))));
|
|
1180
|
+
};
|
|
1181
|
+
|
|
1182
|
+
var InformationBar = function InformationBar(props) {
|
|
1183
|
+
var message = props.message,
|
|
1184
|
+
onAction = props.onAction;
|
|
1185
|
+
return React.createElement(React.Fragment, null, React.createElement(reactComponents.MessageBar, {
|
|
1186
|
+
intent: "warning"
|
|
1187
|
+
}, React.createElement(reactComponents.MessageBarBody, null, React.createElement(reactComponents.MessageBarTitle, null, "License Manager"), message), React.createElement(reactComponents.MessageBarActions, null, React.createElement(reactComponents.Button, {
|
|
1188
|
+
onClick: onAction
|
|
1189
|
+
}, "Details"))));
|
|
1190
|
+
};
|
|
1191
|
+
|
|
1192
|
+
/* eslint-disable @typescript-eslint/explicit-function-return-type */
|
|
1193
|
+
function ErrorIcon(props) {
|
|
1194
|
+
return React__default.createElement("svg", Object.assign({
|
|
1195
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
1196
|
+
width: "1em",
|
|
1197
|
+
height: "1em",
|
|
1198
|
+
viewBox: "0 0 24 24"
|
|
1199
|
+
}, props), React__default.createElement("g", {
|
|
1200
|
+
fill: "none",
|
|
1201
|
+
stroke: "currentColor",
|
|
1202
|
+
strokeWidth: 1.5
|
|
1203
|
+
}, React__default.createElement("path", {
|
|
1204
|
+
d: "M2 6.95c0-.883 0-1.324.07-1.692A4 4 0 0 1 5.257 2.07C5.626 2 6.068 2 6.95 2c.386 0 .58 0 .766.017a4 4 0 0 1 2.18.904c.144.119.28.255.554.529L11 4c.816.816 1.224 1.224 1.712 1.495a4 4 0 0 0 .848.352C14.098 6 14.675 6 15.828 6h.374c2.632 0 3.949 0 4.804.77q.119.105.224.224c.77.855.77 2.172.77 4.804V14c0 3.771 0 5.657-1.172 6.828S17.771 22 14 22h-4c-3.771 0-5.657 0-6.828-1.172S2 17.771 2 14z"
|
|
1205
|
+
}), React__default.createElement("path", {
|
|
1206
|
+
strokeLinecap: "round",
|
|
1207
|
+
d: "m10.5 15l3-3m0 3l-3-3"
|
|
1208
|
+
})));
|
|
1209
|
+
}
|
|
1210
|
+
|
|
1211
|
+
var styles = {
|
|
1212
|
+
container: /*#__PURE__*/css.css(/*#__PURE__*/_extends({
|
|
1213
|
+
display: "flex",
|
|
1214
|
+
flexDirection: "column",
|
|
1215
|
+
alignItems: "center",
|
|
1216
|
+
justifyContent: "center",
|
|
1217
|
+
height: "100%",
|
|
1218
|
+
textAlign: "center",
|
|
1219
|
+
backgroundColor: reactComponents.tokens.colorNeutralBackground2,
|
|
1220
|
+
borderRadius: reactComponents.tokens.borderRadiusMedium
|
|
1221
|
+
}, /*#__PURE__*/reactComponents.shorthands.padding(reactComponents.tokens.spacingVerticalXL, reactComponents.tokens.spacingHorizontalXL), {
|
|
1222
|
+
color: reactComponents.tokens.colorNeutralForeground1
|
|
1223
|
+
})),
|
|
1224
|
+
icon: /*#__PURE__*/css.css({
|
|
1225
|
+
marginTop: reactComponents.tokens.spacingHorizontalXL,
|
|
1226
|
+
fontSize: "50px",
|
|
1227
|
+
marginBottom: reactComponents.tokens.spacingHorizontalXL,
|
|
1228
|
+
color: reactComponents.tokens.colorBrandBackground
|
|
1229
|
+
}),
|
|
1230
|
+
message: /*#__PURE__*/css.css({
|
|
1231
|
+
marginBottom: reactComponents.tokens.spacingHorizontalXL
|
|
1232
|
+
})
|
|
1233
|
+
};
|
|
1234
|
+
var ShowError = function ShowError(_ref) {
|
|
1235
|
+
var message = _ref.message;
|
|
1236
|
+
return React__default.createElement("div", {
|
|
1237
|
+
className: styles.container
|
|
1238
|
+
}, React__default.createElement(reactComponents.Subtitle1, null, "News Feed - Application"), React__default.createElement(ErrorIcon, {
|
|
1239
|
+
className: styles.icon
|
|
1240
|
+
}), React__default.createElement(reactComponents.Body1Strong, {
|
|
1241
|
+
className: styles.message
|
|
1242
|
+
}, message));
|
|
1243
|
+
};
|
|
1244
|
+
|
|
1245
|
+
var NUMBER_DAYS_WARNING = 30;
|
|
1246
|
+
var LicenseProvider = function LicenseProvider(props) {
|
|
1247
|
+
var _props$theme = props.theme,
|
|
1248
|
+
theme = _props$theme === void 0 ? reactComponents.teamsLightTheme : _props$theme,
|
|
1249
|
+
context = props.context,
|
|
1250
|
+
children = props.children,
|
|
1251
|
+
tenantId = props.tenantId,
|
|
1252
|
+
_props$language = props.language,
|
|
1253
|
+
language = _props$language === void 0 ? "en" : _props$language,
|
|
1254
|
+
applicationId = props.applicationId;
|
|
1255
|
+
/* const instanceId = context?.instanceId as string;
|
|
1256
|
+
const tenantId = context?.pageContext.legacyPageContext.aadTenantId; */
|
|
1257
|
+
var _React$useState = React.useState(undefined),
|
|
1258
|
+
error = _React$useState[0],
|
|
1259
|
+
setError = _React$useState[1];
|
|
1260
|
+
var _React$useState2 = React.useState(true),
|
|
1261
|
+
isLoading = _React$useState2[0],
|
|
1262
|
+
setIsLoading = _React$useState2[1];
|
|
1263
|
+
var _React$useState3 = React.useState(),
|
|
1264
|
+
licensingResponse = _React$useState3[0],
|
|
1265
|
+
setLicenseResponse = _React$useState3[1];
|
|
1266
|
+
var _useAtom = jotai.useAtom(appGlobalStateAtom),
|
|
1267
|
+
appglobalState = _useAtom[0],
|
|
1268
|
+
setAppGlobalState = _useAtom[1];
|
|
1269
|
+
var _useUser = reactHooksLibrary.useUser(context),
|
|
1270
|
+
userInformation = _useUser.userInformation;
|
|
1271
|
+
var _React$useState4 = React.useState(false),
|
|
1272
|
+
isOpenRegisterDialog = _React$useState4[0],
|
|
1273
|
+
setIsOpenRegisterDialog = _React$useState4[1];
|
|
1274
|
+
var _useUtils = useUtils(),
|
|
1275
|
+
formatString = _useUtils.formatString;
|
|
1276
|
+
var strings = appglobalState.strings,
|
|
1277
|
+
refresh = appglobalState.refresh;
|
|
1278
|
+
var _useUtils2 = useUtils(),
|
|
1279
|
+
generateSalt = _useUtils2.generateSalt;
|
|
1280
|
+
var _ref = licensingResponse || {},
|
|
1281
|
+
status = _ref.status,
|
|
1282
|
+
licenseType = _ref.licenseType,
|
|
1283
|
+
expiryDate = _ref.expiryDate;
|
|
1284
|
+
var _useLicenseManager = reactHooksLibrary.useLicenseManager(tenantId, applicationId, generateSalt(tenantId, applicationId), context),
|
|
1285
|
+
checkAndUpdateLicensing = _useLicenseManager.checkAndUpdateLicensing;
|
|
1286
|
+
var styles = React.useMemo(function () {
|
|
1287
|
+
return {
|
|
1288
|
+
root: css.css({
|
|
1289
|
+
backgroundColor: "transparent",
|
|
1290
|
+
padding: 20
|
|
1291
|
+
})
|
|
1292
|
+
};
|
|
1293
|
+
}, []);
|
|
1294
|
+
React.useEffect(function () {
|
|
1295
|
+
_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
|
|
1296
|
+
var stringsLoc, result;
|
|
1297
|
+
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
1298
|
+
while (1) switch (_context.prev = _context.next) {
|
|
1299
|
+
case 0:
|
|
1300
|
+
_context.prev = 0;
|
|
1301
|
+
_context.next = 3;
|
|
1302
|
+
return new Promise(function (resolve) { resolve(_interopNamespace(require("./loc/" + language + ".json"))); });
|
|
1303
|
+
case 3:
|
|
1304
|
+
stringsLoc = _context.sent;
|
|
1305
|
+
setAppGlobalState(function (prev) {
|
|
1306
|
+
return _extends({}, prev, props, {
|
|
1307
|
+
strings: stringsLoc,
|
|
1308
|
+
userInformation: userInformation
|
|
1309
|
+
});
|
|
1310
|
+
});
|
|
1311
|
+
_context.next = 7;
|
|
1312
|
+
return checkAndUpdateLicensing();
|
|
1313
|
+
case 7:
|
|
1314
|
+
result = _context.sent;
|
|
1315
|
+
setLicenseResponse(result);
|
|
1316
|
+
setIsLoading(false);
|
|
1317
|
+
_context.next = 16;
|
|
1318
|
+
break;
|
|
1319
|
+
case 12:
|
|
1320
|
+
_context.prev = 12;
|
|
1321
|
+
_context.t0 = _context["catch"](0);
|
|
1322
|
+
if (_context.t0 instanceof Error) setError(_context.t0);
|
|
1323
|
+
setIsLoading(false);
|
|
1324
|
+
case 16:
|
|
1325
|
+
case "end":
|
|
1326
|
+
return _context.stop();
|
|
1327
|
+
}
|
|
1328
|
+
}, _callee, null, [[0, 12]]);
|
|
1329
|
+
}))();
|
|
1330
|
+
}, [userInformation]);
|
|
1331
|
+
var fallbackRender = React.useCallback(function (_ref3) {
|
|
1332
|
+
var error = _ref3.error;
|
|
1333
|
+
console.error("[LicenseManager:Error: " + error.message);
|
|
1334
|
+
return React.createElement(ShowError, {
|
|
1335
|
+
message: error.message
|
|
1336
|
+
});
|
|
1337
|
+
}, []);
|
|
1338
|
+
var onMessageBarAction = React.useCallback(function () {
|
|
1339
|
+
setIsOpenRegisterDialog(true);
|
|
1340
|
+
}, []);
|
|
1341
|
+
// ipdate liecense status on refresh
|
|
1342
|
+
React.useEffect(function () {
|
|
1343
|
+
_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee2() {
|
|
1344
|
+
var result;
|
|
1345
|
+
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
|
1346
|
+
while (1) switch (_context2.prev = _context2.next) {
|
|
1347
|
+
case 0:
|
|
1348
|
+
_context2.prev = 0;
|
|
1349
|
+
setAppGlobalState(function (prev) {
|
|
1350
|
+
return _extends({}, prev, {
|
|
1351
|
+
refresh: false
|
|
1352
|
+
});
|
|
1353
|
+
});
|
|
1354
|
+
_context2.next = 4;
|
|
1355
|
+
return checkAndUpdateLicensing();
|
|
1356
|
+
case 4:
|
|
1357
|
+
result = _context2.sent;
|
|
1358
|
+
setLicenseResponse(result);
|
|
1359
|
+
setIsLoading(false);
|
|
1360
|
+
_context2.next = 13;
|
|
1361
|
+
break;
|
|
1362
|
+
case 9:
|
|
1363
|
+
_context2.prev = 9;
|
|
1364
|
+
_context2.t0 = _context2["catch"](0);
|
|
1365
|
+
if (_context2.t0 instanceof Error) setError(_context2.t0);
|
|
1366
|
+
setIsLoading(false);
|
|
1367
|
+
case 13:
|
|
1368
|
+
case "end":
|
|
1369
|
+
return _context2.stop();
|
|
1370
|
+
}
|
|
1371
|
+
}, _callee2, null, [[0, 9]]);
|
|
1372
|
+
}))();
|
|
1373
|
+
}, [refresh]);
|
|
1374
|
+
var onDissmiss = React.useCallback(function () {
|
|
1375
|
+
setIsOpenRegisterDialog(false);
|
|
1376
|
+
}, []);
|
|
1377
|
+
// renderMessagebar if the license is about to expire
|
|
1378
|
+
var renderMessagebar = React.useCallback(function (licenseType, expiryDate, warningDays) {
|
|
1379
|
+
var expirationDate = new Date(expiryDate);
|
|
1380
|
+
var today = new Date();
|
|
1381
|
+
var formatedExpiredDate = expirationDate.toLocaleDateString();
|
|
1382
|
+
var dayDiff = dateFns.differenceInDays(expirationDate, today);
|
|
1383
|
+
var message = "";
|
|
1384
|
+
if (dayDiff <= warningDays) {
|
|
1385
|
+
message = formatString(strings.messageLicenseWarning, licenseType, dayDiff, formatedExpiredDate);
|
|
1386
|
+
return React.createElement(InformationBar, {
|
|
1387
|
+
message: message,
|
|
1388
|
+
onAction: onMessageBarAction
|
|
1389
|
+
});
|
|
1390
|
+
}
|
|
1391
|
+
return React.createElement(React.Fragment, null);
|
|
1392
|
+
}, [expiryDate]);
|
|
1393
|
+
// render the control based on the license status
|
|
1394
|
+
var renderContent = React.useCallback(function () {
|
|
1395
|
+
switch (status) {
|
|
1396
|
+
case reactHooksLibrary.EStatus.valid:
|
|
1397
|
+
return React.createElement(React.Fragment, null, renderMessagebar(licenseType, expiryDate, NUMBER_DAYS_WARNING), children);
|
|
1398
|
+
case reactHooksLibrary.EStatus.genericError:
|
|
1399
|
+
case reactHooksLibrary.EStatus.notFound:
|
|
1400
|
+
case reactHooksLibrary.EStatus.blocked:
|
|
1401
|
+
case reactHooksLibrary.EStatus.expired:
|
|
1402
|
+
case reactHooksLibrary.EStatus.invalid:
|
|
1403
|
+
return React.createElement(LicensePlaceHolder, {
|
|
1404
|
+
licenseStatus: status,
|
|
1405
|
+
licenseType: licenseType,
|
|
1406
|
+
expiryDate: expiryDate
|
|
1407
|
+
});
|
|
1408
|
+
}
|
|
1409
|
+
return React.createElement(React.Fragment, null);
|
|
1410
|
+
}, [licensingResponse, refresh]);
|
|
1411
|
+
if (isLoading) return null;
|
|
1412
|
+
if (error) return React.createElement(ShowError, {
|
|
1413
|
+
message: error.message
|
|
1414
|
+
});
|
|
1415
|
+
return React.createElement(React.Fragment, null, React.createElement(reactComponents.IdPrefixProvider, {
|
|
1416
|
+
value: "news-feed-"
|
|
1417
|
+
}, React.createElement(reactComponents.FluentProvider, {
|
|
1418
|
+
theme: theme,
|
|
1419
|
+
className: styles.root
|
|
1420
|
+
}, React.createElement(reactErrorBoundary.ErrorBoundary, {
|
|
1421
|
+
fallbackRender: fallbackRender
|
|
1422
|
+
}, renderContent(), isOpenRegisterDialog && React.createElement(RegisterDialog, {
|
|
1423
|
+
licenseStatus: status,
|
|
1424
|
+
licenseType: licenseType,
|
|
1425
|
+
expiryDate: expiryDate,
|
|
1426
|
+
open: isOpenRegisterDialog,
|
|
1427
|
+
onDismiss: onDissmiss
|
|
1428
|
+
})))));
|
|
1429
|
+
};
|
|
1430
|
+
|
|
1431
|
+
exports.LicensePlaceHolder = LicensePlaceHolder;
|
|
1432
|
+
exports.LicenseProvider = LicenseProvider;
|
|
1433
|
+
//# sourceMappingURL=license-manager-react-components.cjs.development.js.map
|