@zanichelli/delta_share 1.0.8 → 2.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/dist/wc/cjs/delta_share.cjs.js +1 -1
- package/dist/wc/cjs/license-activation_16.cjs.entry.js +92 -51
- package/dist/wc/cjs/loader.cjs.js +1 -1
- package/dist/wc/collection/components/license-activation/license-activation.js +128 -52
- package/dist/wc/collection/components/license-activation-form/license-activation-form.js +34 -18
- package/dist/wc/custom-elements/index.js +94 -53
- package/dist/wc/delta_share/delta_share.esm.js +1 -1
- package/dist/wc/delta_share/p-067677ff.entry.js +3 -0
- package/dist/wc/esm/delta_share.js +1 -1
- package/dist/wc/esm/license-activation_16.entry.js +92 -51
- package/dist/wc/esm/loader.js +1 -1
- package/dist/wc/types/beans/index.d.ts +3 -0
- package/dist/wc/types/components/license-activation/license-activation.d.ts +12 -6
- package/dist/wc/types/components/license-activation-form/license-activation-form.d.ts +6 -4
- package/dist/wc/types/components.d.ts +28 -4
- package/package.json +1 -1
- package/dist/wc/delta_share/p-7d2ecacd.entry.js +0 -3
|
@@ -1,21 +1,23 @@
|
|
|
1
|
-
import { Component, Host, h, Prop, State, Element, Event, Listen } from
|
|
1
|
+
import { Component, Host, h, Prop, State, Element, Event, Listen, } from "@stencil/core";
|
|
2
2
|
import state from "../../store";
|
|
3
3
|
import { getCms } from "../../store/CMS";
|
|
4
|
-
import { Env } from
|
|
5
|
-
import { post } from
|
|
6
|
-
import { mobileBreakpoint, handleResponseError, licenseInitialState, getCookie, sampleCode } from
|
|
4
|
+
import { Env } from "../../utils/env";
|
|
5
|
+
import { post } from "../../utils/request";
|
|
6
|
+
import { mobileBreakpoint, handleResponseError, licenseInitialState, getCookie, sampleCode, } from "../../utils/utils";
|
|
7
7
|
export class LicenseActivation {
|
|
8
8
|
constructor() {
|
|
9
9
|
/** env: values: "local" | "devmy" | "testmy" | "demomy" | "prod" */
|
|
10
|
-
this.env =
|
|
10
|
+
this.env = "prod";
|
|
11
11
|
this.initialShowInfoBox = false;
|
|
12
12
|
this.licenseActivationState = licenseInitialState;
|
|
13
13
|
}
|
|
14
14
|
async componentWillLoad() {
|
|
15
15
|
await getCms(state);
|
|
16
16
|
this.cms = state.cms;
|
|
17
|
-
this.modalState = this.variant ===
|
|
18
|
-
this.isMobile =
|
|
17
|
+
this.modalState = this.variant === "modal" ? "open" : "closed";
|
|
18
|
+
this.isMobile =
|
|
19
|
+
window.screen.width <= mobileBreakpoint ||
|
|
20
|
+
window.innerWidth <= mobileBreakpoint;
|
|
19
21
|
this.enableFormSubmitButton = this.enableButton;
|
|
20
22
|
this.environment = new Env(this.env).buildEnvironment();
|
|
21
23
|
}
|
|
@@ -27,22 +29,22 @@ export class LicenseActivation {
|
|
|
27
29
|
}
|
|
28
30
|
handleLicenseModalClose() {
|
|
29
31
|
this.modalState = "closed";
|
|
30
|
-
this.licenseModalState.emit({ value:
|
|
32
|
+
this.licenseModalState.emit({ value: "closed" });
|
|
31
33
|
this.resetStore();
|
|
32
34
|
}
|
|
33
35
|
handleLicenseModalOpen(initialShowInfoBox) {
|
|
34
36
|
this.initialShowInfoBox = initialShowInfoBox;
|
|
35
37
|
this.submitClicked = true;
|
|
36
|
-
this.modalState =
|
|
37
|
-
this.licenseModalState.emit({ value:
|
|
38
|
+
this.modalState = "open";
|
|
39
|
+
this.licenseModalState.emit({ value: "open" });
|
|
38
40
|
}
|
|
39
41
|
emitStatusChange() {
|
|
40
|
-
const { licenseActivationState: { licenseActivationStatus, licenseActivationApiData, } } = this;
|
|
42
|
+
const { licenseActivationState: { licenseActivationStatus, licenseActivationApiData, }, } = this;
|
|
41
43
|
this.licenseStatusChange.emit({
|
|
42
44
|
status: licenseActivationStatus,
|
|
43
|
-
data: licenseActivationApiData
|
|
45
|
+
data: licenseActivationApiData,
|
|
44
46
|
});
|
|
45
|
-
if (this.licenseActivationState.licenseActivationStatus ===
|
|
47
|
+
if (this.licenseActivationState.licenseActivationStatus === "success") {
|
|
46
48
|
this.resetStore();
|
|
47
49
|
}
|
|
48
50
|
}
|
|
@@ -58,97 +60,120 @@ export class LicenseActivation {
|
|
|
58
60
|
async activateLicense() {
|
|
59
61
|
var _a;
|
|
60
62
|
const myzToken = this.environment.MYZ_TOKEN_KEY;
|
|
61
|
-
const MYZ_TOKEN = (_a = this.environment.MYZ_TOKEN_KEY) === null || _a === void 0 ? void 0 : _a.replace(/-/g,
|
|
63
|
+
const MYZ_TOKEN = (_a = this.environment.MYZ_TOKEN_KEY) === null || _a === void 0 ? void 0 : _a.replace(/-/g, "_");
|
|
62
64
|
const url = `${this.environment.API_V3_URL}/dashboard/code`;
|
|
63
65
|
this.licenseActivationState = Object.assign(Object.assign({}, this.licenseActivationState), { licenseActivationApiLoading: true });
|
|
64
66
|
const headers = {
|
|
65
|
-
[myzToken]: getCookie(MYZ_TOKEN)
|
|
67
|
+
[myzToken]: getCookie(MYZ_TOKEN),
|
|
66
68
|
};
|
|
67
|
-
const sampleCodeError = state.cms[
|
|
69
|
+
const sampleCodeError = state.cms["newdashboard.licenseActivation.error.sampleCodeMessage"];
|
|
68
70
|
// INFO: controllo che il codice inserito non sia quello di esempio
|
|
69
71
|
if (this.licenseActivationState.licenseActivationCode === sampleCode) {
|
|
70
|
-
this.licenseActivationState = Object.assign(Object.assign({}, this.licenseActivationState), { licenseActivationMessage: sampleCodeError, licenseActivationStatus:
|
|
72
|
+
this.licenseActivationState = Object.assign(Object.assign({}, this.licenseActivationState), { licenseActivationMessage: sampleCodeError, licenseActivationStatus: "fail", licenseActivationApiData: null });
|
|
71
73
|
this.emitStatusChange();
|
|
72
74
|
this.handleLicenseModalOpen(false);
|
|
73
75
|
}
|
|
74
76
|
try {
|
|
75
77
|
const response = await post(url, { code: this.licenseActivationState.licenseActivationCode }, headers);
|
|
76
78
|
const responseData = await response.json();
|
|
77
|
-
this.licenseActivationState = Object.assign(Object.assign({}, this.licenseActivationState), { licenseActivationApiData: Object.assign(Object.assign({}, responseData), { code: this.licenseActivationState.licenseActivationCode }), licenseActivationApiLoading: false, licenseActivationApiLoaded: true, licenseActivationStatus: response.ok ?
|
|
79
|
+
this.licenseActivationState = Object.assign(Object.assign({}, this.licenseActivationState), { licenseActivationApiData: Object.assign(Object.assign({}, responseData), { code: this.licenseActivationState.licenseActivationCode }), licenseActivationApiLoading: false, licenseActivationApiLoaded: true, licenseActivationStatus: response.ok ? "success" : "fail", licenseActivationMessage: response.ok
|
|
80
|
+
? responseData.message
|
|
81
|
+
: handleResponseError(responseData) });
|
|
78
82
|
this.emitStatusChange();
|
|
79
|
-
response.ok
|
|
83
|
+
response.ok
|
|
84
|
+
? this.handleLicenseModalClose()
|
|
85
|
+
: this.handleLicenseModalOpen(false);
|
|
80
86
|
}
|
|
81
87
|
catch (error) {
|
|
82
88
|
const { response } = error;
|
|
83
|
-
this.licenseActivationState = Object.assign(Object.assign({}, this.licenseActivationState), { licenseActivationApiLoading: false, licenseActivationApiLoaded: true, licenseActivationApiError: error, licenseActivationStatus:
|
|
89
|
+
this.licenseActivationState = Object.assign(Object.assign({}, this.licenseActivationState), { licenseActivationApiLoading: false, licenseActivationApiLoaded: true, licenseActivationApiError: error, licenseActivationStatus: "fail", licenseActivationMessage: handleResponseError(await response.json()), licenseActivationApiData: null });
|
|
84
90
|
this.emitStatusChange();
|
|
85
91
|
this.handleLicenseModalOpen(false);
|
|
86
92
|
}
|
|
87
93
|
}
|
|
88
94
|
async handleSubmitButtonClick(inputVal) {
|
|
89
|
-
const { licenseActivationState: { licenseActivationStatus
|
|
95
|
+
const { licenseActivationState: { licenseActivationStatus }, } = this;
|
|
90
96
|
this.licenseActivationState = Object.assign(Object.assign({}, this.licenseActivationState), { licenseActivationCode: inputVal });
|
|
91
97
|
if (!inputVal) {
|
|
92
98
|
this.handleLicenseModalOpen(false);
|
|
93
99
|
}
|
|
94
|
-
if ((this.variant ===
|
|
100
|
+
if ((this.variant === "modal" ||
|
|
101
|
+
this.modalState === "open" ||
|
|
102
|
+
licenseActivationStatus === "initial") &&
|
|
103
|
+
inputVal) {
|
|
95
104
|
this.activateLicense();
|
|
96
105
|
}
|
|
97
106
|
}
|
|
98
107
|
handleMobileButtonClick() {
|
|
99
|
-
this.modalState =
|
|
108
|
+
this.modalState = "open";
|
|
100
109
|
}
|
|
101
110
|
mapInputStatus(licenseActivationStatus) {
|
|
102
|
-
if (licenseActivationStatus ===
|
|
111
|
+
if (licenseActivationStatus === "initial")
|
|
103
112
|
return null;
|
|
104
|
-
if (licenseActivationStatus ===
|
|
105
|
-
return
|
|
106
|
-
if (licenseActivationStatus ===
|
|
107
|
-
return
|
|
113
|
+
if (licenseActivationStatus === "success")
|
|
114
|
+
return "success";
|
|
115
|
+
if (licenseActivationStatus === "fail")
|
|
116
|
+
return "error";
|
|
108
117
|
return null;
|
|
109
118
|
}
|
|
110
|
-
renderLicenseActivationBox() {
|
|
111
|
-
return (h("license-activation-box", { error: this.licenseActivationState.licenseActivationApiError, code: this.licenseActivationState.licenseActivationCode }, this.renderLicenseActivationForm(
|
|
119
|
+
renderLicenseActivationBox(variant) {
|
|
120
|
+
return (h("license-activation-box", { error: this.licenseActivationState.licenseActivationApiError, code: this.licenseActivationState.licenseActivationCode }, this.renderLicenseActivationForm(variant)));
|
|
112
121
|
}
|
|
113
122
|
renderLicenseActivationModal() {
|
|
114
|
-
return (h("license-activation-modal", { id: `${this.host.id}-modal`, "modal-title": this.cms["newdashboard.licenseActivation.modalTitle"], onActivationModalClose: () => this.handleLicenseModalClose(), resetStore: this.resetStore }, this.renderLicenseActivationForm(
|
|
123
|
+
return (h("license-activation-modal", { id: `${this.host.id}-modal`, "modal-title": this.cms["newdashboard.licenseActivation.modalTitle"], onActivationModalClose: () => this.handleLicenseModalClose(), resetStore: this.resetStore }, this.renderLicenseActivationForm("modal")));
|
|
115
124
|
}
|
|
116
125
|
retrieveTextsObject() {
|
|
117
|
-
const { inputMessage, inputLabel, inputPlaceholder, buttonLabel, isMobile, additionalDescription } = this;
|
|
126
|
+
const { inputMessage, inputLabel, inputPlaceholder, buttonLabel, isMobile, additionalDescription, buttonIcon, previewButtonLabel, previewButtonIcon, } = this;
|
|
118
127
|
const { licenseActivationStatus } = this.licenseActivationState;
|
|
119
128
|
return {
|
|
120
129
|
inputStatus: this.mapInputStatus(licenseActivationStatus),
|
|
121
|
-
inputMessage: inputMessage ||
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
130
|
+
inputMessage: inputMessage ||
|
|
131
|
+
this.cms["newdashboard.licenseActivation.inputHelperMessage"],
|
|
132
|
+
placeholder: inputPlaceholder ||
|
|
133
|
+
this.cms["newdashboard.licenseActivation.inputPlaceholder"],
|
|
134
|
+
inputLabel: inputLabel || this.cms["newdashboard.licenseActivation.inputLabel"],
|
|
135
|
+
buttonLabel: isMobile
|
|
136
|
+
? buttonLabel || this.cms["newdashboard.licenseActivation.submitLabel"]
|
|
137
|
+
: this.cms["newdashboard.onboarding.licenseActivation.submitLabel"],
|
|
138
|
+
buttonIcon,
|
|
139
|
+
previewButtonLabel,
|
|
140
|
+
previewButtonIcon,
|
|
141
|
+
linkLabel: this.cms["newdashboard.licenseActivation.helperLink"].toUpperCase(),
|
|
142
|
+
errorButtonLabel: this.cms["newdashboard.licenseActivation.contactUs.btnLabel"],
|
|
143
|
+
errorSectionMessage: this.cms["newdashboard.licenseActivation.contactUs.message"],
|
|
128
144
|
infoBoxIcon: `${this.environment.URL_S3_IMAGES_FOLDER}bollinoSIAE.svg`,
|
|
129
|
-
infoBoxContent: this.cms[
|
|
130
|
-
supportLink: this.cms[
|
|
131
|
-
additionalDescription: this.variant ===
|
|
145
|
+
infoBoxContent: this.cms["newdashboard.licenseActivation.infoBoxContent"],
|
|
146
|
+
supportLink: this.cms["newdashboard.licenseActivation.contactUs.url"],
|
|
147
|
+
additionalDescription: this.variant === "modal" && additionalDescription,
|
|
132
148
|
};
|
|
133
149
|
}
|
|
134
150
|
renderLicenseActivationForm(variant) {
|
|
135
151
|
const { componentid } = this;
|
|
136
|
-
const { licenseActivationState: { licenseActivationMessage, licenseActivationCode, licenseActivationApiLoading } } = this;
|
|
152
|
+
const { licenseActivationState: { licenseActivationMessage, licenseActivationCode, licenseActivationApiLoading, }, } = this;
|
|
137
153
|
const textObject = this.retrieveTextsObject();
|
|
138
|
-
return (h("license-activation-form", { direction:
|
|
154
|
+
return (h("license-activation-form", { direction: "column", error: licenseActivationMessage, initialCode: licenseActivationCode, formTexts: textObject, requestLoading: !!licenseActivationApiLoading, enableButton: this.enableFormSubmitButton, formid: componentid, initialShowInfoBox: this.initialShowInfoBox, onFormInputChange: (e) => this.handleFormInputChange(e.detail.value), onSubmitButtonClick: (e) => this.handleSubmitButtonClick(e.detail.value), variant: variant, handleModalOpen: () => this.handleLicenseModalOpen(true) }));
|
|
139
155
|
}
|
|
140
156
|
renderMobileButton() {
|
|
141
|
-
return (h("z-button", { onClick: () => this.handleMobileButtonClick() }, this.cms[
|
|
157
|
+
return (h("z-button", { onClick: () => this.handleMobileButtonClick() }, this.cms["newdashboard.onboarding.licenseActivation.mobileSubmitLabel"]));
|
|
142
158
|
}
|
|
143
159
|
render() {
|
|
144
160
|
if (this.isMobile) {
|
|
145
161
|
return (h(Host, null,
|
|
146
|
-
this.forceModal
|
|
147
|
-
|
|
162
|
+
this.forceModal
|
|
163
|
+
? this.renderLicenseActivationModal()
|
|
164
|
+
: this.renderMobileButton(),
|
|
165
|
+
(this.variant === "box" || this.variant === "button") &&
|
|
166
|
+
this.modalState === "open" &&
|
|
167
|
+
this.renderLicenseActivationModal()));
|
|
148
168
|
}
|
|
149
169
|
return (h(Host, null,
|
|
150
|
-
this.variant ===
|
|
151
|
-
|
|
170
|
+
this.variant === "box" || this.variant === "button"
|
|
171
|
+
? this.renderLicenseActivationBox(this.variant)
|
|
172
|
+
: this.modalState === "open" && this.renderLicenseActivationModal(),
|
|
173
|
+
(this.variant === "box" || this.variant === "button") &&
|
|
174
|
+
this.modalState === "open" &&
|
|
175
|
+
this.submitClicked &&
|
|
176
|
+
this.renderLicenseActivationModal()));
|
|
152
177
|
}
|
|
153
178
|
static get is() { return "license-activation"; }
|
|
154
179
|
static get encapsulation() { return "scoped"; }
|
|
@@ -163,8 +188,8 @@ export class LicenseActivation {
|
|
|
163
188
|
"type": "string",
|
|
164
189
|
"mutable": false,
|
|
165
190
|
"complexType": {
|
|
166
|
-
"original": "
|
|
167
|
-
"resolved": "\"box\" | \"modal\"",
|
|
191
|
+
"original": "\"box\" | \"modal\" | \"button\"",
|
|
192
|
+
"resolved": "\"box\" | \"button\" | \"modal\"",
|
|
168
193
|
"references": {}
|
|
169
194
|
},
|
|
170
195
|
"required": false,
|
|
@@ -295,6 +320,57 @@ export class LicenseActivation {
|
|
|
295
320
|
"attribute": "button-label",
|
|
296
321
|
"reflect": false
|
|
297
322
|
},
|
|
323
|
+
"buttonIcon": {
|
|
324
|
+
"type": "string",
|
|
325
|
+
"mutable": false,
|
|
326
|
+
"complexType": {
|
|
327
|
+
"original": "string",
|
|
328
|
+
"resolved": "string",
|
|
329
|
+
"references": {}
|
|
330
|
+
},
|
|
331
|
+
"required": false,
|
|
332
|
+
"optional": true,
|
|
333
|
+
"docs": {
|
|
334
|
+
"tags": [],
|
|
335
|
+
"text": "button-icon: custom submit button icon name [optional]"
|
|
336
|
+
},
|
|
337
|
+
"attribute": "button-icon",
|
|
338
|
+
"reflect": false
|
|
339
|
+
},
|
|
340
|
+
"previewButtonLabel": {
|
|
341
|
+
"type": "string",
|
|
342
|
+
"mutable": false,
|
|
343
|
+
"complexType": {
|
|
344
|
+
"original": "string",
|
|
345
|
+
"resolved": "string",
|
|
346
|
+
"references": {}
|
|
347
|
+
},
|
|
348
|
+
"required": false,
|
|
349
|
+
"optional": true,
|
|
350
|
+
"docs": {
|
|
351
|
+
"tags": [],
|
|
352
|
+
"text": "preview-button-label: custom preview button label string [optional]"
|
|
353
|
+
},
|
|
354
|
+
"attribute": "preview-button-label",
|
|
355
|
+
"reflect": false
|
|
356
|
+
},
|
|
357
|
+
"previewButtonIcon": {
|
|
358
|
+
"type": "string",
|
|
359
|
+
"mutable": false,
|
|
360
|
+
"complexType": {
|
|
361
|
+
"original": "string",
|
|
362
|
+
"resolved": "string",
|
|
363
|
+
"references": {}
|
|
364
|
+
},
|
|
365
|
+
"required": false,
|
|
366
|
+
"optional": true,
|
|
367
|
+
"docs": {
|
|
368
|
+
"tags": [],
|
|
369
|
+
"text": "preview-button-icon: custom preview button icon name [optional]"
|
|
370
|
+
},
|
|
371
|
+
"attribute": "preview-button-icon",
|
|
372
|
+
"reflect": false
|
|
373
|
+
},
|
|
298
374
|
"enableButton": {
|
|
299
375
|
"type": "boolean",
|
|
300
376
|
"mutable": false,
|
|
@@ -350,7 +426,7 @@ export class LicenseActivation {
|
|
|
350
426
|
},
|
|
351
427
|
"attribute": "env",
|
|
352
428
|
"reflect": false,
|
|
353
|
-
"defaultValue": "
|
|
429
|
+
"defaultValue": "\"prod\""
|
|
354
430
|
}
|
|
355
431
|
}; }
|
|
356
432
|
static get states() { return {
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import { Component, Host, h, Prop, State, Event } from
|
|
1
|
+
import { Component, Host, h, Prop, State, Event, } from "@stencil/core";
|
|
2
2
|
import { ButtonVariantEnum } from "@zanichelli/albe-web-components/dist/collection/beans/index";
|
|
3
|
-
import { manageMarkupContent } from
|
|
3
|
+
import { manageMarkupContent } from "../../utils/utils";
|
|
4
4
|
export class LicenseActivationForm {
|
|
5
5
|
constructor() {
|
|
6
6
|
this.redirectToSupport = this.redirectToSupport.bind(this);
|
|
7
7
|
}
|
|
8
8
|
componentWillLoad() {
|
|
9
9
|
this.showInfoBox = !!this.initialShowInfoBox;
|
|
10
|
-
this.inputVal = this.initialCode ? this.initialCode :
|
|
10
|
+
this.inputVal = this.initialCode ? this.initialCode : "";
|
|
11
11
|
}
|
|
12
12
|
handleFormInputChange(detail) {
|
|
13
13
|
this.inputVal = detail.value;
|
|
@@ -17,10 +17,10 @@ export class LicenseActivationForm {
|
|
|
17
17
|
this.submitButtonClick.emit({ value: inputVal });
|
|
18
18
|
}
|
|
19
19
|
handleInfoClick() {
|
|
20
|
-
if (this.variant ===
|
|
20
|
+
if (this.variant === "modal") {
|
|
21
21
|
this.showInfoBox = true;
|
|
22
22
|
}
|
|
23
|
-
if (this.variant ===
|
|
23
|
+
if (this.variant === "box" || this.variant === "button") {
|
|
24
24
|
this.handleModalOpen();
|
|
25
25
|
}
|
|
26
26
|
}
|
|
@@ -32,11 +32,11 @@ export class LicenseActivationForm {
|
|
|
32
32
|
h("div", { slot: "content" },
|
|
33
33
|
infoBoxIcon && (h("span", null,
|
|
34
34
|
h("img", { src: infoBoxIcon, "aria-hidden": true }))),
|
|
35
|
-
infoBoxContent && h("span", { innerHTML: manageMarkupContent(infoBoxContent) }))));
|
|
35
|
+
infoBoxContent && (h("span", { innerHTML: manageMarkupContent(infoBoxContent) })))));
|
|
36
36
|
}
|
|
37
37
|
handleInfoBoxClick(e) {
|
|
38
38
|
const cp = e.composedPath();
|
|
39
|
-
if (cp.find((elem) => elem.dataset && elem.dataset.action ===
|
|
39
|
+
if (cp.find((elem) => elem.dataset && elem.dataset.action === "infoBoxClose")) {
|
|
40
40
|
this.showInfoBox = false;
|
|
41
41
|
}
|
|
42
42
|
}
|
|
@@ -52,19 +52,35 @@ export class LicenseActivationForm {
|
|
|
52
52
|
h("span", { class: "heading-01" }, errorSectionMessage),
|
|
53
53
|
h("z-button", { variant: ButtonVariantEnum.secondary, onClick: this.redirectToSupport }, errorButtonLabel)));
|
|
54
54
|
}
|
|
55
|
+
getButtonIcon(variant) {
|
|
56
|
+
const { buttonIcon, previewButtonIcon } = this.formTexts;
|
|
57
|
+
if (variant === "button" && previewButtonIcon)
|
|
58
|
+
return previewButtonIcon;
|
|
59
|
+
if (variant !== "button" && buttonIcon)
|
|
60
|
+
return buttonIcon;
|
|
61
|
+
return undefined;
|
|
62
|
+
}
|
|
63
|
+
getButtonLabel(variant) {
|
|
64
|
+
const { buttonLabel, previewButtonLabel } = this.formTexts;
|
|
65
|
+
if (variant === "button" && previewButtonLabel)
|
|
66
|
+
return previewButtonLabel;
|
|
67
|
+
if (variant !== "button" && buttonLabel)
|
|
68
|
+
return buttonLabel;
|
|
69
|
+
return "";
|
|
70
|
+
}
|
|
55
71
|
render() {
|
|
56
72
|
const { error, requestLoading, formTexts, formid, variant } = this;
|
|
57
|
-
const { inputMessage, inputLabel,
|
|
58
|
-
const disabled = variant ===
|
|
59
|
-
return (h(Host, { variant: variant
|
|
73
|
+
const { inputMessage, inputLabel, linkLabel, placeholder, inputStatus, additionalDescription, } = formTexts;
|
|
74
|
+
const disabled = (variant === "modal" && !this.inputVal) || !!requestLoading;
|
|
75
|
+
return (h(Host, { variant: variant },
|
|
60
76
|
h("div", null,
|
|
61
|
-
additionalDescription && h("z-body", { level: 3 }, additionalDescription),
|
|
62
|
-
h("z-input", { value: this.inputVal, htmlid: `${formid}_input`, label: inputLabel, placeholder: placeholder, htmltitle: placeholder, message: variant ===
|
|
63
|
-
h("z-button", { variant: ButtonVariantEnum.primary, disabled: disabled || !this.enableButton || requestLoading ? true : false, onClick: () => this.handleSubmitButtonClick(this.inputVal) },
|
|
64
|
-
h("z-link", { icon: "question-mark", onClick: () => this.handleInfoClick() }, linkLabel),
|
|
77
|
+
additionalDescription && (h("z-body", { level: 3 }, additionalDescription)),
|
|
78
|
+
variant !== "button" && (h("z-input", { value: this.inputVal, htmlid: `${formid}_input`, label: inputLabel, placeholder: placeholder, htmltitle: placeholder, message: variant === "box" ? inputMessage : error ? error : inputMessage, status: variant === "box" ? null : inputStatus, disabled: !!requestLoading, onInputChange: (e) => this.handleFormInputChange(e.detail) })),
|
|
79
|
+
h("z-button", { variant: ButtonVariantEnum.primary, icon: this.getButtonIcon(variant), disabled: disabled || !this.enableButton || requestLoading ? true : false, onClick: () => this.handleSubmitButtonClick(this.inputVal) }, this.getButtonLabel(variant))),
|
|
80
|
+
variant !== "button" && (h("z-link", { icon: "question-mark", onClick: () => this.handleInfoClick() }, linkLabel)),
|
|
65
81
|
h("div", null,
|
|
66
82
|
this.renderInfoBox(),
|
|
67
|
-
variant ===
|
|
83
|
+
variant === "modal" && error && this.renderErrorSection())));
|
|
68
84
|
}
|
|
69
85
|
static get is() { return "license-activation-form"; }
|
|
70
86
|
static get encapsulation() { return "shadow"; }
|
|
@@ -114,7 +130,7 @@ export class LicenseActivationForm {
|
|
|
114
130
|
"mutable": false,
|
|
115
131
|
"complexType": {
|
|
116
132
|
"original": "LicenseActivationFormTexts",
|
|
117
|
-
"resolved": "{ inputStatus: \"success\" | \"error\" | \"warning\" | \"selecting\"; inputMessage: string; placeholder: string; inputLabel: string; buttonLabel: string; linkLabel: string; errorButtonLabel: string; errorSectionMessage: string; infoBoxIcon: string; infoBoxContent: string; supportLink: string; additionalDescription: string; }",
|
|
133
|
+
"resolved": "{ inputStatus: \"success\" | \"error\" | \"warning\" | \"selecting\"; inputMessage: string; placeholder: string; inputLabel: string; buttonLabel: string; buttonIcon: string; previewButtonLabel: string; previewButtonIcon: string; linkLabel: string; errorButtonLabel: string; errorSectionMessage: string; infoBoxIcon: string; infoBoxContent: string; supportLink: string; additionalDescription: string; }",
|
|
118
134
|
"references": {
|
|
119
135
|
"LicenseActivationFormTexts": {
|
|
120
136
|
"location": "import",
|
|
@@ -240,8 +256,8 @@ export class LicenseActivationForm {
|
|
|
240
256
|
"type": "string",
|
|
241
257
|
"mutable": false,
|
|
242
258
|
"complexType": {
|
|
243
|
-
"original": "
|
|
244
|
-
"resolved": "\"box\" | \"modal\"",
|
|
259
|
+
"original": "\"box\" | \"modal\" | \"button\"",
|
|
260
|
+
"resolved": "\"box\" | \"button\" | \"modal\"",
|
|
245
261
|
"references": {}
|
|
246
262
|
},
|
|
247
263
|
"required": false,
|