@progressive-development/pd-dialog 0.1.15 → 0.1.17

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/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "description": "Progressive Development dialog components.",
4
4
  "license": "SEE LICENSE IN LICENSE",
5
5
  "author": "PD Progressive Development",
6
- "version": "0.1.15",
6
+ "version": "0.1.17",
7
7
  "main": "index.js",
8
8
  "module": "index.js",
9
9
  "scripts": {
@@ -17,7 +17,7 @@
17
17
  "storybook:build": "npm run analyze -- --exclude dist && build-storybook"
18
18
  },
19
19
  "dependencies": {
20
- "@progressive-development/pd-forms": "^0.1.16",
20
+ "@progressive-development/pd-forms": "^0.1.17",
21
21
  "@progressive-development/pd-icon": "^0.1.13",
22
22
  "@progressive-development/pd-price": "^0.1.2",
23
23
  "@progressive-development/pd-shared-styles": "0.1.1",
@@ -93,6 +93,7 @@ export class PdSubmitDialog extends LitElement {
93
93
  status: { type: Number },
94
94
  statusMsg: { type: String },
95
95
  confirmMail: { type: String },
96
+ progressTxtMap: { type: Object },
96
97
  _buttons: { type: Array },
97
98
  };
98
99
  }
@@ -153,7 +154,7 @@ export class PdSubmitDialog extends LitElement {
153
154
  @submit-button-clicked="${this._goToStartpage}"
154
155
  >
155
156
  <div slot="content">
156
- ${this._renderContent()}
157
+ <slot name="submit-content"></slot>
157
158
  <div class="progress-container">
158
159
  <div class="progress-row">${this._renderProgressRow()}</div>
159
160
  </div>
@@ -167,38 +168,28 @@ export class PdSubmitDialog extends LitElement {
167
168
  let value;
168
169
  switch (this.status) {
169
170
  case STATUS_SEND:
170
- value = html` <div class="first-row-tmp">
171
+ value = html`
172
+ <div class="first-row-tmp">
171
173
  <div class="loader"></div>
172
174
  </div>
173
- <span class="progress-txt"
174
- >${this.type === 'mail'
175
- ? 'E-mail versturen, even geduld...'
176
- : 'Uw gegevens worden verzonden.'}</span
177
- >`;
175
+ <span class="progress-txt">${this.progressTxtMap.get(STATUS_SEND)}</span>`;
178
176
  break;
179
177
  case STATUS_SEND_SUCCESS:
180
- value = html` <div class="first-row-tmp">
178
+ value = html`
179
+ <div class="first-row-tmp">
181
180
  <pd-icon
182
181
  class="success-icon"
183
182
  icon="checkBox"
184
183
  activeIcon
185
184
  ></pd-icon>
186
185
  </div>
187
- <span class="progress-txt"
188
- >${this.type === 'mail'
189
- ? 'Mail is succesvol verzonden, we zullen spoedig reageren.'
190
- : 'Uw bestelling is succesvol verwerkt. Bekijk de bevestigingsmail voor meer informatie.'}</span
191
- >`;
186
+ <span class="progress-txt">${this.progressTxtMap.get(STATUS_SEND_SUCCESS)}</span>`;
192
187
  break;
193
188
  case STATUS_SEND_FAILED:
194
189
  value = html` <div class="first-row-tmp">
195
190
  <pd-icon class="error-icon" icon="checkBox"></pd-icon>
196
191
  </div>
197
- <span class="progress-txt"
198
- >${this.type === 'mail'
199
- ? 'Sending the mail failed.'
200
- : 'Er is een fout opgetreden bij het opmaken van uw bestelling.'}</span
201
- >`;
192
+ <span class="progress-txt">${this.progressTxtMap.get(STATUS_SEND_FAILED)}</span>`;
202
193
  break;
203
194
  default:
204
195
  console.warn('Unexpected value');
@@ -206,31 +197,6 @@ export class PdSubmitDialog extends LitElement {
206
197
  return value;
207
198
  }
208
199
 
209
- _renderContent() {
210
-
211
- switch (this.type) {
212
- case 'mail':
213
- return html`
214
- <p>
215
- Bedankt voor uw e-mail. Deze wordt nu verzonden. Je ontvangt
216
- reactie op uw mail per e-mail naar <em>${this.confirmMail}</em>.
217
- </p>`;
218
- case 'editDate':
219
- return html`
220
- <p>
221
- Uw afspraakwijziging wordt verwerkt.</em>.
222
- </p>`;
223
- default:
224
- return html`
225
- <p>
226
- Bedank voor uw bestelling. Momenteel verwerken we uw gegevens. U
227
- zal een e-mail ontvangen met de bevestiging van uw bestelling.
228
- Alvast bedankt voor het vertrouwen in Ticomi Technics als uw
229
- servicepartner voor uw verwarming.
230
- </p>`;
231
- }
232
- }
233
-
234
200
  _goToStartpage() {
235
201
  this.dispatchEvent(
236
202
  new CustomEvent('submit-button-clicked', {
@@ -1,5 +1,6 @@
1
1
  import { html } from 'lit';
2
2
  import {
3
+ PdSubmitDialog,
3
4
  STATUS_SEND,
4
5
  STATUS_SEND_FAILED,
5
6
  STATUS_SEND_SUCCESS,
@@ -11,30 +12,66 @@ export default {
11
12
  argTypes: {},
12
13
  };
13
14
 
14
- function PopupTemplate({ status, statusMsg }) {
15
- return html`
16
- <h1>Dialog Test</h1>
15
+ const STATUS_TXT_MAP = new Map();
16
+ STATUS_TXT_MAP.set(STATUS_SEND, "Text for status send");
17
+ STATUS_TXT_MAP.set(STATUS_SEND_SUCCESS, "Text for status send success");
18
+ STATUS_TXT_MAP.set(STATUS_SEND_FAILED, "Text for status send failed");
17
19
 
20
+ function PopupTemplate({ status, statusMsg, progressTxtMapParam }) {
21
+ return html`
18
22
  <pd-submit-dialog
19
23
  title="Service informatie"
20
24
  status="${status}"
21
25
  confirmMail="myemail@web.de"
22
26
  statusMsg="${statusMsg}"
27
+ .progressTxtMap="${progressTxtMapParam}"
23
28
  >
29
+ <p slot="submit-content">
30
+ Hier steht dann etwas spezifisches.
31
+ </p>
24
32
  </pd-submit-dialog>
25
33
  `;
26
34
  }
27
35
 
36
+ function PopupTemplatePr({ status, statusMsg, progressTxtMapParam }) {
37
+
38
+ const popupEl = new PdSubmitDialog();
39
+ popupEl.title = "Test Dialog Title"
40
+ popupEl.status = status;
41
+ popupEl.statusMsg = statusMsg;
42
+ popupEl.confirmMail = "test@progressive-development.com";
43
+ popupEl.progressTxtMap = progressTxtMapParam;
44
+
45
+ const slotElement = document.createElement("p");
46
+ slotElement.setAttribute("slot", "submit-content")
47
+ slotElement.innerHTML = `Bedankt voor uw e-mail. Deze wordt nu verzonden. Je ontvangt reactie op uw mail per e-mail naar <em>${popupEl.confirmMail}</em>.`;
48
+ popupEl.appendChild(slotElement);
49
+
50
+ // popupEl.type = 'mail';
51
+
52
+ popupEl.addEventListener('submit-button-clicked', () => {
53
+ this.shadowRoot.removeChild(popupEl);
54
+ this.shadowRoot.getElementById('contactUsId').clear();
55
+ });
56
+
57
+ return popupEl;
58
+ }
59
+
60
+
61
+
62
+
28
63
  export const SubmitDialogSend = PopupTemplate.bind({});
29
64
  SubmitDialogSend.args = {
30
65
  status: STATUS_SEND,
31
66
  statusMsg: '',
67
+ progressTxtMapParam: STATUS_TXT_MAP,
32
68
  };
33
69
 
34
70
  export const SubmitDialogSuccess = PopupTemplate.bind({});
35
71
  SubmitDialogSuccess.args = {
36
72
  status: STATUS_SEND_SUCCESS,
37
73
  statusMsg: '',
74
+ progressTxtMapParam: STATUS_TXT_MAP,
38
75
  };
39
76
 
40
77
  export const SubmitDialogFailed = PopupTemplate.bind({});
@@ -42,4 +79,12 @@ SubmitDialogFailed.args = {
42
79
  status: STATUS_SEND_FAILED,
43
80
  statusMsg:
44
81
  'Sorry, there was a technical failure during order post. The order was not submitted, please try again later or contact us directly.',
82
+ progressTxtMapParam: STATUS_TXT_MAP,
83
+ };
84
+
85
+ export const SubmitDialogSendPr = PopupTemplatePr.bind({});
86
+ SubmitDialogSendPr.args = {
87
+ status: STATUS_SEND,
88
+ statusMsg: '',
89
+ progressTxtMapParam: STATUS_TXT_MAP,
45
90
  };