@progressive-development/pd-order 0.5.17 → 0.6.1

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.
@@ -0,0 +1,30 @@
1
+ import { PdContactData } from '@progressive-development/pd-contact';
2
+ export interface PdOrderStep {
3
+ /** Der eindeutige Schlüssel des Schritts (z.B. "zip", "contacts") */
4
+ key: string;
5
+ /** Der übersetzte Name des Schritts für die Anzeige */
6
+ name: string;
7
+ /** Beliebige Zusatzdaten, z.B. für PdEditContent */
8
+ data?: {
9
+ name: string;
10
+ val: string;
11
+ }[];
12
+ }
13
+ export interface PdOrderData {
14
+ /** Die vom Nutzer ausgewählte Postleitzahl */
15
+ zip?: string;
16
+ /** Das vom Nutzer gewählte Datum, z.B. für einen Servicetermin */
17
+ selectedDate?: Date;
18
+ /** Gibt an, ob ein Benutzerlogin vorliegt (steuert z.B. Bearbeitbarkeit) */
19
+ withLogin?: boolean;
20
+ /** Optionale Kontaktinformationen für alle Kontaktrollen */
21
+ contacts?: {
22
+ orderContact?: PdContactData;
23
+ billingContact?: PdContactData;
24
+ adminContact?: PdContactData;
25
+ propertyContact?: PdContactData;
26
+ };
27
+ /** Preisstruktur für die Bestellung */
28
+ priceData?: unknown;
29
+ }
30
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,qCAAqC,CAAC;AAEpE,MAAM,WAAW,WAAW;IAC1B,qEAAqE;IACrE,GAAG,EAAE,MAAM,CAAC;IACZ,uDAAuD;IACvD,IAAI,EAAE,MAAM,CAAC;IACb,oDAAoD;IACpD,IAAI,CAAC,EAAE;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,GAAG,EAAE,MAAM,CAAA;KAAE,EAAE,CAAC;CACxC;AAED,MAAM,WAAW,WAAW;IAC1B,8CAA8C;IAC9C,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,kEAAkE;IAClE,YAAY,CAAC,EAAE,IAAI,CAAC;IACpB,4EAA4E;IAC5E,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,4DAA4D;IAC5D,QAAQ,CAAC,EAAE;QACT,YAAY,CAAC,EAAE,aAAa,CAAC;QAC7B,cAAc,CAAC,EAAE,aAAa,CAAC;QAC/B,YAAY,CAAC,EAAE,aAAa,CAAC;QAC7B,eAAe,CAAC,EAAE,aAAa,CAAC;KACjC,CAAC;IACF,uCAAuC;IACvC,SAAS,CAAC,EAAE,OAAO,CAAC;CACrB"}
package/package.json CHANGED
@@ -1,11 +1,12 @@
1
1
  {
2
2
  "name": "@progressive-development/pd-order",
3
+ "version": "0.6.1",
3
4
  "description": "Progressive Development Order Component",
4
5
  "author": "PD Progressive Development",
5
6
  "license": "SEE LICENSE IN LICENSE",
6
- "version": "0.5.17",
7
7
  "main": "./dist/index.js",
8
8
  "module": "./dist/index.js",
9
+ "types": "./dist/index.d.ts",
9
10
  "exports": {
10
11
  ".": "./dist/index.js",
11
12
  "./pd-order-contacts": "./dist/pd-order-contacts.js",
@@ -21,75 +22,58 @@
21
22
  "LICENSE"
22
23
  ],
23
24
  "scripts": {
24
- "analyze": "cem analyze --litelement",
25
+ "analyze": "cem analyze --litelement --exclude dist,demo",
25
26
  "start": "vite",
26
27
  "build": "vite build",
27
28
  "preview": "vite preview",
28
- "lint": "eslint --ext .js,.html . --ignore-path .gitignore && prettier \"**/*.{js,html}\" --check --ignore-path .gitignore",
29
- "format": "eslint --ext .js,.html . --fix --ignore-path .gitignore && prettier \"**/*.{js,html}\" --write --ignore-path .gitignore",
29
+ "clean": "rm -rf dist",
30
+ "lint": "eslint --ext .ts,.html src --ignore-path .gitignore && prettier \"**/*.ts\" --check --ignore-path .gitignore",
31
+ "format": "eslint --ext .ts,.html src --fix --ignore-path .gitignore && prettier \"**/*.ts\" --write --ignore-path .gitignore",
30
32
  "test": "vitest run --coverage",
31
33
  "test:watch": "vitest --watch",
34
+ "check": "npm run lint && npm run build",
35
+ "prepublishOnly": "npm run clean && npm run check",
32
36
  "localizeExtract": "lit-localize extract",
33
37
  "localizeBuild": "lit-localize build",
34
38
  "storybook": "storybook dev -p 6006",
35
39
  "build-storybook": "storybook build"
36
40
  },
37
41
  "dependencies": {
38
- "@lit/localize": "^0.11.4",
39
- "@progressive-development/pd-calendar": "^0.5.4",
40
- "@progressive-development/pd-contact": "^0.5.10",
41
- "@progressive-development/pd-content": "^0.5.9",
42
- "@progressive-development/pd-dialog": "^0.5.8",
43
- "@progressive-development/pd-forms": "^0.5.7",
44
- "@progressive-development/pd-price": "^0.5.1",
45
- "@progressive-development/pd-shared-styles": "^0.1.1",
42
+ "@lit/localize": "^0.12.2",
43
+ "@progressive-development/pd-calendar": "^0.6.0",
44
+ "@progressive-development/pd-contact": "^0.6.2",
45
+ "@progressive-development/pd-content": "^0.6.3",
46
+ "@progressive-development/pd-dialog": "^0.6.1",
47
+ "@progressive-development/pd-forms": "^0.6.3",
48
+ "@progressive-development/pd-price": "^0.6.0",
49
+ "@progressive-development/pd-shared-styles": "^0.2.1",
46
50
  "fecha": "^4.2.3",
47
- "lit": "^2.8.0"
51
+ "lit": "^3.3.0"
48
52
  },
49
53
  "devDependencies": {
50
- "@chromatic-com/storybook": "^1.3.4",
54
+ "@chromatic-com/storybook": "^1.9.0",
51
55
  "@custom-elements-manifest/analyzer": "^0.4.17",
52
56
  "@lit/localize-tools": "^0.6.10",
53
- "@storybook/addon-essentials": "^8.0.10",
54
- "@storybook/addon-links": "^8.0.10",
57
+ "@storybook/addon-essentials": "^8.6.14",
58
+ "@storybook/addon-links": "^8.6.14",
55
59
  "@storybook/blocks": "^8.0.10",
56
- "@storybook/test": "^8.0.10",
60
+ "@storybook/test": "^8.6.14",
57
61
  "@storybook/web-components": "^8.0.10",
58
- "@storybook/web-components-vite": "^8.0.10",
59
- "eslint": "^7.32.0",
60
- "eslint-config-prettier": "^8.10.0",
62
+ "@storybook/web-components-vite": "^8.6.14",
63
+ "@typescript-eslint/eslint-plugin": "^8.32.1",
64
+ "@typescript-eslint/parser": "^8.32.1",
65
+ "eslint": "^8.57.1",
66
+ "eslint-config-prettier": "^9.1.0",
61
67
  "eslint-plugin-storybook": "^0.8.0",
62
- "husky": "^4.3.8",
63
- "lint-staged": "^10.5.4",
64
- "prettier": "^2.8.8",
65
- "rollup-plugin-visualizer": "^5.13.1",
66
- "storybook": "^8.0.10",
67
- "vite": "^5.4.11",
68
- "vitest": "^2.1.8"
68
+ "prettier": "^3.5.3",
69
+ "rollup-plugin-visualizer": "^5.14.0",
70
+ "storybook": "^8.6.14",
71
+ "typescript": "^5.8.3",
72
+ "vite": "^5.4.19",
73
+ "vite-plugin-dts": "^4.5.4",
74
+ "vitest": "^2.1.9"
69
75
  },
70
76
  "customElements": "custom-elements.json",
71
- "eslintConfig": {
72
- "extends": [
73
- "@open-wc",
74
- "prettier",
75
- "plugin:storybook/recommended"
76
- ]
77
- },
78
- "prettier": {
79
- "singleQuote": true,
80
- "arrowParens": "avoid"
81
- },
82
- "husky": {
83
- "hooks": {
84
- "pre-commit": "lint-staged"
85
- }
86
- },
87
- "lint-staged": {
88
- "*.js": [
89
- "eslint --fix",
90
- "prettier --write"
91
- ]
92
- },
93
77
  "keywords": [
94
78
  "pd",
95
79
  "progressive",
@@ -1,316 +0,0 @@
1
- import { LitElement, css, html } from "lit";
2
- import { msg } from "@lit/localize";
3
- import "@progressive-development/pd-content/pd-collapse";
4
- import "@progressive-development/pd-contact/pd-contact";
5
- import "@progressive-development/pd-forms/pd-checkbox";
6
- import "@progressive-development/pd-forms/pd-form-row";
7
- import "@progressive-development/pd-forms/pd-radio-group";
8
- import { PDFontStyles } from "@progressive-development/pd-shared-styles";
9
- /**
10
- * @license
11
- * Copyright (c) 2021 PD Progressive Development UG. All rights reserved.
12
- */
13
- class PdOrderContacts extends LitElement {
14
- static get properties() {
15
- return {
16
- /**
17
- * List with required contact fields, if not set use default (previous existing values to be consitent during update)
18
- */
19
- summary: { type: Boolean },
20
- contactTitle: { type: Object },
21
- requiredFields: { type: Array },
22
- orderContact: { type: Object },
23
- billingContact: { type: Object },
24
- adminContact: { type: Object },
25
- propertyContact: { type: Object },
26
- withPayment: { type: Boolean },
27
- withPropertyOwner: { type: Boolean },
28
- withPropertyDate: { type: Boolean },
29
- match: { type: Object },
30
- _ownBillingContact: { type: Boolean, state: true },
31
- _ownAdminContact: { type: Boolean, state: true },
32
- _isPropertyOwner: { type: Boolean, state: true }
33
- };
34
- }
35
- static get styles() {
36
- return [
37
- PDFontStyles,
38
- css`
39
- :host {
40
- display: block;
41
- }
42
-
43
- p {
44
- color: var(--pd-default-font-content-col);
45
- font-size: var(--pd-default-font-content-size);
46
- font-family: var(--pd-default-font-content-family);
47
- max-width: 1000px;
48
- }
49
-
50
- a {
51
- cursor: pointer;
52
- font-family: var(--pd-default-font-link-family);
53
- font-size: var(--pd-default-font-link-size);
54
- color: var(--pd-default-font-link-col);
55
- }
56
-
57
- a:hover {
58
- color: var(--pd-default-font-link-col-hover);
59
- }
60
-
61
- .collapse-contact {
62
- padding: 10px;
63
- }
64
-
65
- .summary-box {
66
- display: flex;
67
- flex-wrap: wrap;
68
- gap: 10px;
69
- }
70
-
71
- .summary-box pd-contact {
72
- min-width: 150px;
73
- }
74
-
75
- .property-owner-box {
76
- border: 2px solid #007B8F; /* Dezenter, moderner Rahmen in einer angenehmen Farbe */
77
- border-radius: 8px; /* Abgerundete Ecken für eine weiche Optik */
78
- padding: 16px; /* Innenabstand, damit der Inhalt nicht direkt am Rahmen klebt */
79
- margin: 16px 0; /* Abstand nach oben und unten für bessere Trennung */
80
- background-color: #F8FAFB; /* Heller Hintergrund für visuelle Abgrenzung */
81
- box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1); /* Leichter Schatten für ein modernes Design */
82
- }
83
-
84
- `
85
- ];
86
- }
87
- constructor() {
88
- super();
89
- this._ownBillingContact = false;
90
- this._ownAdminContact = false;
91
- this._isPropertyOwner = false;
92
- this.requiredFields = [];
93
- this.contactTitle = {};
94
- this.match = {};
95
- }
96
- update(changedProperties) {
97
- if (changedProperties.has("billingContact")) {
98
- this._ownBillingContact = this.billingContact !== void 0 && this.billingContact !== null;
99
- }
100
- if (changedProperties.has("adminContact")) {
101
- this._ownAdminContact = this.adminContact !== void 0 && this.adminContact !== null;
102
- }
103
- if (changedProperties.has("propertyContact")) {
104
- this._isPropertyOwner = this.propertyContact !== void 0 && this.propertyContact !== null;
105
- }
106
- super.update(changedProperties);
107
- }
108
- connectedCallback() {
109
- super.connectedCallback();
110
- this.addEventListener("validate-form", this._validateForm);
111
- }
112
- disconnectedCallback() {
113
- super.connectedCallback();
114
- this.removeEventListener("validate-form", this._validateForm);
115
- }
116
- firstUpdated() {
117
- this.addEventListener("toggle-accordion", (e) => {
118
- const origin = e.composedPath()[0];
119
- const collapsiblePanels = this.shadowRoot.querySelectorAll(
120
- "pd-collapse"
121
- );
122
- collapsiblePanels.forEach((panel) => {
123
- if (panel !== origin) {
124
- panel.close();
125
- }
126
- });
127
- });
128
- }
129
- render() {
130
- if (this.summary) {
131
- return this._renderSummary();
132
- }
133
- return this._renderEditContacts();
134
- }
135
- _renderEditContacts() {
136
- return html`
137
-
138
- <pd-collapse id="orderContactCollapseId" active>
139
- <div slot="header" class="header">${this.contactTitle.orderInputContact || msg("Adresse", { id: "pd.order.contacts.orderContact.inputHeader" })}</div>
140
- <pd-contact
141
- id="orderContactId"
142
- class="collapse-contact"
143
- slot="content"
144
- .requiredFields="${this.requiredFields}"
145
- .contact="${this.orderContact}"
146
- .match="${this.match}"
147
- ?withPropertyDate="${!this._isPropertyOwner && this.withPropertyDate}"
148
- ></pd-contact>
149
- </pd-collapse>
150
-
151
- ${this.withPayment ? html`
152
- <pd-collapse id="billingContactCollapseId">
153
- <div slot="header" class="header">${this.contactTitle.billingInputContact || msg("Rechnungsadresse (optional)", { id: "pd.order.contacts.billingContact.inputHeader" })}</div>
154
- <div slot="content">
155
- ${this._ownBillingContact ? html`
156
- <p>
157
- <a @click="${() => {
158
- this._ownBillingContact = false;
159
- }}">
160
- ${msg("Kundenadresse als Rechnungsadresse verwenden", { id: "pd.order.contacts.billingContact.sameBillingLink" })}
161
- </a>
162
- </p>
163
- <pd-contact
164
- id="billingContactId"
165
- class="collapse-contact"
166
- .requiredFields="${this.requiredFields}"
167
- .contact="${this.billingContact}"
168
- ></pd-contact>
169
- ` : html`
170
- <p>${msg("Rechnungsadresse entspricht der Kundenadresse.", { id: "pd.order.contacts.billingContact.sameBillingText" })}</p>
171
- <p>
172
- <a @click="${() => {
173
- this._ownBillingContact = true;
174
- }}">
175
- ${msg("Neue Rechnungsadresse hinzufügen", { id: "pd.order.contacts.billingContact.otherBillingLink" })}
176
- </a>
177
- </p>
178
- `}
179
- </div>
180
- </pd-collapse>` : ""}
181
-
182
- ${this.withPropertyOwner ? html`
183
-
184
- <div class="property-owner-box">
185
-
186
- <pd-checkbox id="isPropertyOwnerId" value="${this._isPropertyOwner}"
187
- @field-change="${(e) => this._isPropertyOwner = e.detail.value === "true"}">${msg("Ist der Kunde Vermieter?", { id: "pd.order.contacts.propertyContact.checkBox" })}</pd-checkbox>
188
-
189
- ${this._isPropertyOwner ? html`
190
-
191
- <pd-collapse id="propertyContactCollapseId" style="padding-top: 20px;">
192
- <div slot="header" class="header">${this.contactTitle.propertyInputContact || msg("Adresse der Immobilie", { id: "pd.order.contacts.propertyContact.inputHeader" })}</div>
193
- <div slot="content">
194
- <pd-contact
195
- id="propertyContactId"
196
- class="collapse-contact"
197
- .requiredFields="${["street", "streetNr", "zip", "city"]}"
198
- .inputFields="${["street", "city", "additionalHint"]}"
199
- .contact="${this.propertyContact}"
200
- ?withPropertyDate="${this.withPropertyDate}"
201
- ></pd-contact>
202
- </div>
203
- </pd-collapse>
204
-
205
- <pd-collapse id="adminContactCollapseId">
206
- <div slot="header" class="header">${this.contactTitle.adminInputContact || msg("Adresse der Verwaltung (optional)", { id: "pd.order.contacts.adminContact.inputHeader" })}</div>
207
- <div slot="content">
208
- ${this._ownAdminContact ? html`
209
- <p>
210
- <a @click="${() => {
211
- this._ownAdminContact = false;
212
- }}">
213
- ${msg("Kundenadresse als Verwaltungsadresse verwenden", { id: "pd.order.contacts.adminContact.sameAdminLink" })}
214
- </a>
215
- </p>
216
- <pd-contact
217
- id="adminContactId"
218
- class="collapse-contact"
219
- .requiredFields="${this.requiredFields}"
220
- .contact="${this.adminContact}"
221
- ></pd-contact>
222
- ` : html`
223
- <p>${msg("Verwaltungsadresse entspricht der Kundenadresse.", { id: "pd.order.contacts.adminContact.sameAdminText" })}</p>
224
- <p>
225
- <a @click="${() => {
226
- this._ownAdminContact = true;
227
- }}">
228
- ${msg("Neue Verwaltungsadresse hinzufügen", { id: "pd.order.contacts.adminContact.otherAdminLink" })}
229
- </a>
230
- </p>
231
- `}
232
- </div>
233
- </pd-collapse>
234
- ` : ""}
235
-
236
- </div>` : ""}
237
- `;
238
- }
239
- _renderSummary() {
240
- return html`
241
- <div class="summary-box">
242
- ${this.orderContact ? html`
243
- <pd-contact
244
- addressTitle="${this.contactTitle.orderSummaryContact || msg("Adresse", { id: "pd.order.contacts.summary.orderContact.title" })}"
245
- .contact="${this.orderContact}"
246
- summary
247
- ></pd-contact>` : ""}
248
- ${this.billingContact ? html`
249
- <pd-contact
250
- addressTitle="${this.contactTitle.billingSummaryContact || msg("Rechnungsadresse", { id: "pd.order.contacts.summary.billingContact.title" })}"
251
- .contact="${this.billingContact}"
252
- summary
253
- ></pd-contact>` : ""}
254
- ${this.propertyContact ? html`
255
- <pd-contact
256
- addressTitle="${this.contactTitle.propertySummaryContact || msg("Immobilie", { id: "pd.order.contacts.summary.propertyContact.title" })}"
257
- .contact="${this.propertyContact}"
258
- summary
259
- ></pd-contact>` : ""}
260
- ${this.adminContact ? html`
261
- <pd-contact
262
- addressTitle="${this.contactTitle.adminSummaryContact || msg("Verwaltung", { id: "pd.order.contacts.summary.adminContact.title" })}"
263
- .contact="${this.adminContact}"
264
- summary
265
- ></pd-contact>` : ""}
266
-
267
- </div>
268
- `;
269
- }
270
- _validateForm(e) {
271
- if (e.detail && !e.detail.singleElement) {
272
- this.shadowRoot.getElementById("orderContactId").dispatchEvent(
273
- new CustomEvent("validate-form", {
274
- detail: e.detail
275
- })
276
- );
277
- const errorSize = e.detail.errorMap.size;
278
- if (errorSize > 0) {
279
- this.shadowRoot.getElementById("orderContactCollapseId").open();
280
- }
281
- if (this._ownBillingContact) {
282
- this.shadowRoot.getElementById("billingContactId").dispatchEvent(
283
- new CustomEvent("validate-form", {
284
- detail: e.detail
285
- })
286
- );
287
- if (e.detail.errorMap.size > errorSize) {
288
- this.shadowRoot.getElementById("billingContactCollapseId").open();
289
- }
290
- }
291
- if (this._isPropertyOwner) {
292
- this.shadowRoot.getElementById("propertyContactId").dispatchEvent(
293
- new CustomEvent("validate-form", {
294
- detail: e.detail
295
- })
296
- );
297
- if (e.detail.errorMap.size > errorSize) {
298
- this.shadowRoot.getElementById("propertyContactCollapseId").open();
299
- }
300
- }
301
- if (this._isPropertyOwner && this._ownAdminContact) {
302
- this.shadowRoot.getElementById("adminContactId").dispatchEvent(
303
- new CustomEvent("validate-form", {
304
- detail: e.detail
305
- })
306
- );
307
- if (e.detail.errorMap.size > errorSize) {
308
- this.shadowRoot.getElementById("adminContactCollapseId").open();
309
- }
310
- }
311
- }
312
- }
313
- }
314
- export {
315
- PdOrderContacts
316
- };