@progressive-development/pd-order 1.0.1 → 1.1.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.
package/dist/index.d.ts CHANGED
@@ -1,6 +1,8 @@
1
1
  export { PdOrderContacts } from './pd-order-contacts/pd-order-contacts.js';
2
2
  export { PdOrderSummary } from './pd-order-summary/pd-order-summary.js';
3
+ export { PdOrderAgreement } from './pd-order-agreement/pd-order-agreement.js';
3
4
  export type { PdOrderContactData, PdOrderStep } from './types.js';
5
+ export type { PdOrderAgreementChangeDetail, PdOrderAgreementChangeEvent, } from './pd-order-agreement/types.js';
4
6
  export { templates as beTemplates } from './generated/locales/be.js';
5
7
  export { templates as deTemplates } from './generated/locales/de.js';
6
8
  export { templates as enTemplates } from './generated/locales/en.js';
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,0CAA0C,CAAC;AAC3E,OAAO,EAAE,cAAc,EAAE,MAAM,wCAAwC,CAAC;AAExE,YAAY,EAAE,kBAAkB,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAElE,OAAO,EAAE,SAAS,IAAI,WAAW,EAAE,MAAM,2BAA2B,CAAC;AACrE,OAAO,EAAE,SAAS,IAAI,WAAW,EAAE,MAAM,2BAA2B,CAAC;AACrE,OAAO,EAAE,SAAS,IAAI,WAAW,EAAE,MAAM,2BAA2B,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,0CAA0C,CAAC;AAC3E,OAAO,EAAE,cAAc,EAAE,MAAM,wCAAwC,CAAC;AACxE,OAAO,EAAE,gBAAgB,EAAE,MAAM,4CAA4C,CAAC;AAE9E,YAAY,EAAE,kBAAkB,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAClE,YAAY,EACV,4BAA4B,EAC5B,2BAA2B,GAC5B,MAAM,+BAA+B,CAAC;AAEvC,OAAO,EAAE,SAAS,IAAI,WAAW,EAAE,MAAM,2BAA2B,CAAC;AACrE,OAAO,EAAE,SAAS,IAAI,WAAW,EAAE,MAAM,2BAA2B,CAAC;AACrE,OAAO,EAAE,SAAS,IAAI,WAAW,EAAE,MAAM,2BAA2B,CAAC"}
package/dist/index.js CHANGED
@@ -1,7 +1,9 @@
1
1
  import './pd-order-contacts.js';
2
2
  import './pd-order-summary.js';
3
+ import './pd-order-agreement.js';
3
4
  export { templates as beTemplates } from './locales/be.js';
4
5
  export { templates as deTemplates } from './locales/de.js';
5
6
  export { templates as enTemplates } from './locales/en.js';
6
7
  export { PdOrderContacts } from './pd-order-contacts/PdOrderContacts.js';
7
8
  export { PdOrderSummary } from './pd-order-summary/PdOrderSummary.js';
9
+ export { PdOrderAgreement } from './pd-order-agreement/PdOrderAgreement.js';
@@ -0,0 +1,32 @@
1
+ import { LitElement, CSSResultGroup } from 'lit';
2
+ /**
3
+ * Agreement component for terms and conditions acceptance with validation.
4
+ *
5
+ * @tagname pd-order-agreement
6
+ * @summary Terms and conditions agreement checkbox with popup and validation.
7
+ *
8
+ * @event pd-agreement-change - Fired when checkbox status changes. Detail: `{ agreed: boolean }`.
9
+ *
10
+ * @slot legal - Terms and conditions content displayed in the popup.
11
+ *
12
+ * @cssprop --pd-order-agreement-link-col - Link color override. Default: `var(--pd-default-font-link-col)`.
13
+ */
14
+ export declare class PdOrderAgreement extends LitElement {
15
+ /** Whether agreement is required for form validation. */
16
+ required: boolean;
17
+ /** Current agreement state (readonly — controlled internally via checkbox). */
18
+ agreed: boolean;
19
+ /** @ignore */
20
+ private _agreeForm;
21
+ /** @ignore */
22
+ private _agreePopup;
23
+ static styles: CSSResultGroup;
24
+ render(): import('lit').TemplateResult<1>;
25
+ /** Whether the agreement is valid (not required, or checkbox is checked). */
26
+ get valid(): boolean;
27
+ /** Triggers form validation and returns validity state. */
28
+ triggerValidate(): Promise<boolean>;
29
+ private _onCheckboxChange;
30
+ private _openTermsAndConditions;
31
+ }
32
+ //# sourceMappingURL=PdOrderAgreement.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"PdOrderAgreement.d.ts","sourceRoot":"","sources":["../../src/pd-order-agreement/PdOrderAgreement.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAQ,cAAc,EAAE,MAAM,KAAK,CAAC;AAIvD,OAAO,qDAAqD,CAAC;AAC7D,OAAO,+CAA+C,CAAC;AACvD,OAAO,+CAA+C,CAAC;AACvD,OAAO,6CAA6C,CAAC;AAQrD;;;;;;;;;;;GAWG;AACH,qBACa,gBAAiB,SAAQ,UAAU;IAC9C,yDAAyD;IAEzD,QAAQ,UAAQ;IAEhB,+EAA+E;IAE/E,MAAM,UAAS;IAEf,cAAc;IAEd,OAAO,CAAC,UAAU,CAAmB;IAErC,cAAc;IAEd,OAAO,CAAC,WAAW,CAAW;IAE9B,OAAgB,MAAM,EAAE,cAAc,CAAY;IAEzC,MAAM;IAmCf,6EAA6E;IAC7E,IAAI,KAAK,IAAI,OAAO,CAEnB;IAED,2DAA2D;IAC9C,eAAe,IAAI,OAAO,CAAC,OAAO,CAAC;IAIhD,OAAO,CAAC,iBAAiB;IAazB,OAAO,CAAC,uBAAuB;CAIhC"}
@@ -0,0 +1,101 @@
1
+ import { LitElement, html } from 'lit';
2
+ import { property, query } from 'lit/decorators.js';
3
+ import { localized, msg } from '@lit/localize';
4
+ import '@progressive-development/pd-forms/pd-form-container';
5
+ import '@progressive-development/pd-forms/pd-form-row';
6
+ import '@progressive-development/pd-forms/pd-checkbox';
7
+ import '@progressive-development/pd-dialog/pd-popup';
8
+ import { styles } from './pd-order-agreement.styles.js';
9
+
10
+ var __defProp = Object.defineProperty;
11
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
12
+ var __decorateClass = (decorators, target, key, kind) => {
13
+ var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc(target, key) : target;
14
+ for (var i = decorators.length - 1, decorator; i >= 0; i--)
15
+ if (decorator = decorators[i])
16
+ result = (kind ? decorator(target, key, result) : decorator(result)) || result;
17
+ if (kind && result) __defProp(target, key, result);
18
+ return result;
19
+ };
20
+ let PdOrderAgreement = class extends LitElement {
21
+ constructor() {
22
+ super(...arguments);
23
+ this.required = true;
24
+ this.agreed = false;
25
+ }
26
+ render() {
27
+ return html`
28
+ <pd-form-container id="agreementFormId">
29
+ <pd-form-row>
30
+ <pd-checkbox
31
+ id="agreeConditionsId"
32
+ valueName="agreeId"
33
+ class="agree-box"
34
+ ?required="${this.required}"
35
+ requiredMsg="${msg(
36
+ "Bitte stimmen Sie den Allgemeinen Geschäftsbedingungen zu, um fortzufahren.",
37
+ { id: "pd.order.summary.agree.required" }
38
+ )}"
39
+ @pd-form-element-change="${this._onCheckboxChange}"
40
+ >
41
+ ${msg("Ich akzeptiere die", {
42
+ id: "pd.order.summary.agree.link1"
43
+ })}
44
+ <a
45
+ @click="${this._openTermsAndConditions}"
46
+ @keypress="${this._openTermsAndConditions}"
47
+ >${msg("Allgemeinen Geschäftsbedingungen", {
48
+ id: "pd.order.summary.agree.link2"
49
+ })}</a
50
+ >
51
+ </pd-checkbox>
52
+ </pd-form-row>
53
+ </pd-form-container>
54
+
55
+ <pd-popup id="agreePopupId">
56
+ <slot name="legal"></slot>
57
+ </pd-popup>
58
+ `;
59
+ }
60
+ /** Whether the agreement is valid (not required, or checkbox is checked). */
61
+ get valid() {
62
+ return !this.required || this._agreeForm?.valid === true;
63
+ }
64
+ /** Triggers form validation and returns validity state. */
65
+ async triggerValidate() {
66
+ return this._agreeForm?.triggerValidate();
67
+ }
68
+ _onCheckboxChange(e) {
69
+ const parsedValue = e.detail?.parsedValue;
70
+ this.agreed = parsedValue === true;
71
+ this.dispatchEvent(
72
+ new CustomEvent("pd-agreement-change", {
73
+ detail: { agreed: this.agreed },
74
+ bubbles: true,
75
+ composed: true
76
+ })
77
+ );
78
+ }
79
+ _openTermsAndConditions(e) {
80
+ e.stopPropagation();
81
+ this._agreePopup?.showPopup();
82
+ }
83
+ };
84
+ PdOrderAgreement.styles = [styles];
85
+ __decorateClass([
86
+ property({ type: Boolean })
87
+ ], PdOrderAgreement.prototype, "required", 2);
88
+ __decorateClass([
89
+ property({ type: Boolean, reflect: true })
90
+ ], PdOrderAgreement.prototype, "agreed", 2);
91
+ __decorateClass([
92
+ query("#agreementFormId")
93
+ ], PdOrderAgreement.prototype, "_agreeForm", 2);
94
+ __decorateClass([
95
+ query("#agreePopupId")
96
+ ], PdOrderAgreement.prototype, "_agreePopup", 2);
97
+ PdOrderAgreement = __decorateClass([
98
+ localized()
99
+ ], PdOrderAgreement);
100
+
101
+ export { PdOrderAgreement };
@@ -0,0 +1,3 @@
1
+ export { PdOrderAgreement } from './pd-order-agreement.js';
2
+ export type { PdOrderAgreementChangeDetail, PdOrderAgreementChangeEvent, } from './types.js';
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/pd-order-agreement/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAC3D,YAAY,EACV,4BAA4B,EAC5B,2BAA2B,GAC5B,MAAM,YAAY,CAAC"}
@@ -0,0 +1,3 @@
1
+ import { PdOrderAgreement } from './PdOrderAgreement.js';
2
+ export { PdOrderAgreement };
3
+ //# sourceMappingURL=pd-order-agreement.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"pd-order-agreement.d.ts","sourceRoot":"","sources":["../../src/pd-order-agreement/pd-order-agreement.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AAOzD,OAAO,EAAE,gBAAgB,EAAE,CAAC"}
@@ -0,0 +1,41 @@
1
+ import { Meta, StoryObj } from '@storybook/web-components-vite';
2
+ /**
3
+ * Story arguments interface for pd-order-agreement component.
4
+ * Maps to the component's public API for agreement acceptance.
5
+ */
6
+ interface PdOrderAgreementArgs {
7
+ /** Whether agreement is required for form validation */
8
+ required: boolean;
9
+ }
10
+ /**
11
+ * ## pd-order-agreement
12
+ *
13
+ * Terms and conditions agreement component with checkbox validation and popup display.
14
+ *
15
+ * ### Features
16
+ * - Required/optional agreement checkbox with validation
17
+ * - Terms and conditions popup via pd-popup
18
+ * - Fires `pd-agreement-change` event on state change
19
+ * - Integrates with pd-order-summary via the `agreement` slot
20
+ * - Full i18n support via @lit/localize
21
+ *
22
+ * ### Accessibility
23
+ * - Checkbox supports keyboard navigation (Tab, Space)
24
+ * - Terms link is activatable via Enter/Space
25
+ * - Popup dialog for accessible modal viewing of terms
26
+ * - Validation messages announced to screen readers
27
+ */
28
+ declare const meta: Meta<PdOrderAgreementArgs>;
29
+ export default meta;
30
+ type Story = StoryObj<PdOrderAgreementArgs>;
31
+ /** Default agreement with required checkbox and legal content. */
32
+ export declare const Default: Story;
33
+ /** Agreement with rich legal content in the popup slot. */
34
+ export declare const WithLegalContent: Story;
35
+ /** Overview of all agreement states for comparison. */
36
+ export declare const AllStates: Story;
37
+ /** Integration: pd-order-agreement inside pd-order-summary via the agreement slot. */
38
+ export declare const InOrderContext: Story;
39
+ /** CSS Custom Properties — customize link color. */
40
+ export declare const CustomStyling: Story;
41
+ //# sourceMappingURL=pd-order-agreement.stories.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"pd-order-agreement.stories.d.ts","sourceRoot":"","sources":["../../src/pd-order-agreement/pd-order-agreement.stories.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,gCAAgC,CAAC;AAIrE,OAAO,6CAA6C,CAAC;AAIrD,OAAO,yBAAyB,CAAC;AACjC,OAAO,yCAAyC,CAAC;AAEjD,OAAO,sCAAsC,CAAC;AAM9C;;;GAGG;AACH,UAAU,oBAAoB;IAC5B,wDAAwD;IACxD,QAAQ,EAAE,OAAO,CAAC;CACnB;AAqFD;;;;;;;;;;;;;;;;;GAiBG;AACH,QAAA,MAAM,IAAI,EAAE,IAAI,CAAC,oBAAoB,CAqEpC,CAAC;AAEF,eAAe,IAAI,CAAC;AACpB,KAAK,KAAK,GAAG,QAAQ,CAAC,oBAAoB,CAAC,CAAC;AAM5C,kEAAkE;AAClE,eAAO,MAAM,OAAO,EAAE,KAOrB,CAAC;AAMF,2DAA2D;AAC3D,eAAO,MAAM,gBAAgB,EAAE,KAqC9B,CAAC;AAMF,uDAAuD;AACvD,eAAO,MAAM,SAAS,EAAE,KAwCvB,CAAC;AAMF,sFAAsF;AACtF,eAAO,MAAM,cAAc,EAAE,KAsB5B,CAAC;AAMF,oDAAoD;AACpD,eAAO,MAAM,aAAa,EAAE,KA6D3B,CAAC"}
@@ -0,0 +1,2 @@
1
+ export declare const styles: import('lit').CSSResult;
2
+ //# sourceMappingURL=pd-order-agreement.styles.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"pd-order-agreement.styles.d.ts","sourceRoot":"","sources":["../../src/pd-order-agreement/pd-order-agreement.styles.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,MAAM,yBAmBlB,CAAC"}
@@ -0,0 +1,24 @@
1
+ import { css } from 'lit';
2
+
3
+ const styles = css`
4
+ :host {
5
+ display: block;
6
+ }
7
+
8
+ .agree-box {
9
+ padding-top: 20px;
10
+ }
11
+
12
+ a {
13
+ cursor: pointer;
14
+ font-family: var(--pd-default-font-link-family);
15
+ font-size: var(--pd-default-font-link-size);
16
+ color: var(--pd-order-agreement-link-col, var(--pd-default-font-link-col));
17
+ }
18
+
19
+ a:hover {
20
+ color: var(--pd-default-font-link-col-hover);
21
+ }
22
+ `;
23
+
24
+ export { styles };
@@ -0,0 +1,5 @@
1
+ export interface PdOrderAgreementChangeDetail {
2
+ agreed: boolean;
3
+ }
4
+ export type PdOrderAgreementChangeEvent = CustomEvent<PdOrderAgreementChangeDetail>;
5
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/pd-order-agreement/types.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,4BAA4B;IAC3C,MAAM,EAAE,OAAO,CAAC;CACjB;AAED,MAAM,MAAM,2BAA2B,GACrC,WAAW,CAAC,4BAA4B,CAAC,CAAC"}
@@ -0,0 +1,2 @@
1
+ export * from './pd-order-agreement/pd-order-agreement'
2
+ export {}
@@ -0,0 +1,8 @@
1
+ import { PdOrderAgreement } from './pd-order-agreement/PdOrderAgreement.js';
2
+
3
+ const tag = "pd-order-agreement";
4
+ if (!customElements.get(tag)) {
5
+ customElements.define(tag, PdOrderAgreement);
6
+ }
7
+
8
+ export { PdOrderAgreement };
@@ -1,14 +1,14 @@
1
1
  import { LitElement, CSSResultGroup, TemplateResult } from 'lit';
2
2
  import { PdOrderStep } from '../types.js';
3
3
  /**
4
- * Order summary component displaying steps, pricing, and agreement.
4
+ * Order summary component displaying steps and pricing.
5
5
  *
6
6
  * @tagname pd-order-summary
7
- * @summary Order summary with steps, pricing, and terms agreement.
7
+ * @summary Order summary with steps and pricing display.
8
8
  *
9
9
  * @event go-to - Fired when user clicks edit on a step. Detail: `{ step }`.
10
10
  *
11
- * @slot legal - Terms and conditions content.
11
+ * @slot agreement - Slot for pd-order-agreement or custom agreement component.
12
12
  * @slot [stepKey] - Named slots for custom step content.
13
13
  *
14
14
  * @cssprop --pd-order-summary-payment-bg-col - Payment section background. Default: `var(--pd-default-light-col)`.
@@ -18,22 +18,13 @@ export declare class PdOrderSummary extends LitElement {
18
18
  orderSteps: PdOrderStep[];
19
19
  /** Show payment/pricing section */
20
20
  withPayment: boolean;
21
- /** Show terms agreement checkbox with validation */
22
- withAgreement: boolean;
23
21
  /** Complete order data including zip, contacts, and pricing */
24
22
  order?: any;
25
- /** @ignore */
26
- private _agreeForm;
27
- /** @ignore */
28
- private _agreePopup;
29
23
  static styles: CSSResultGroup;
30
24
  firstUpdated(): void;
31
25
  render(): TemplateResult<1>;
32
- get valid(): boolean;
33
- triggerValidate(): Promise<boolean>;
34
26
  protected _mapOrderStepSummary(step: PdOrderStep, index: number): TemplateResult;
35
27
  protected _renderCustomOrderStepSummary(step: PdOrderStep, index: number): TemplateResult | null;
36
28
  protected _getContactsSummary(index: number, step: PdOrderStep): TemplateResult<1>;
37
- private _openTermsAndConditions;
38
29
  }
39
30
  //# sourceMappingURL=PdOrderSummary.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"PdOrderSummary.d.ts","sourceRoot":"","sources":["../../src/pd-order-summary/PdOrderSummary.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAa,cAAc,EAAE,cAAc,EAAE,MAAM,KAAK,CAAC;AAI5E,OAAO,qDAAqD,CAAC;AAC7D,OAAO,+CAA+C,CAAC;AACvD,OAAO,+CAA+C,CAAC;AAEvD,OAAO,iDAAiD,CAAC;AACzD,OAAO,6CAA6C,CAAC;AAErD,OAAO,qDAAqD,CAAC;AAE7D,OAAO,EAAsB,WAAW,EAAE,MAAM,aAAa,CAAC;AAE9D,OAAO,2CAA2C,CAAC;AAGnD;;;;;;;;;;;;GAYG;AACH,qBACa,cAAe,SAAQ,UAAU;IAC5C,kEAAkE;IAElE,UAAU,EAAE,WAAW,EAAE,CAAM;IAE/B,mCAAmC;IAEnC,WAAW,UAAS;IAEpB,oDAAoD;IAEpD,aAAa,UAAS;IAEtB,+DAA+D;IAE/D,KAAK,CAAC,EAAE,GAAG,CAAC;IAEZ,cAAc;IAEd,OAAO,CAAC,UAAU,CAAmB;IAErC,cAAc;IAEd,OAAO,CAAC,WAAW,CAAW;IAE9B,OAAgB,MAAM,EAAE,cAAc,CAmDpC;IAEO,YAAY,IAAI,IAAI;IAYpB,MAAM;IAyDf,IAAI,KAAK,YAER;IAEY,eAAe,IAAI,OAAO,CAAC,OAAO,CAAC;IA6BhD,SAAS,CAAC,oBAAoB,CAC5B,IAAI,EAAE,WAAW,EACjB,KAAK,EAAE,MAAM,GACZ,cAAc;IAkBjB,SAAS,CAAC,6BAA6B,CACrC,IAAI,EAAE,WAAW,EACjB,KAAK,EAAE,MAAM,GACZ,cAAc,GAAG,IAAI;IAUxB,SAAS,CAAC,mBAAmB,CAAC,KAAK,EAAE,MAAM,EAAE,IAAI,EAAE,WAAW;IAoB9D,OAAO,CAAC,uBAAuB;CAIhC"}
1
+ {"version":3,"file":"PdOrderSummary.d.ts","sourceRoot":"","sources":["../../src/pd-order-summary/PdOrderSummary.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAa,cAAc,EAAE,cAAc,EAAE,MAAM,KAAK,CAAC;AAI5E,OAAO,iDAAiD,CAAC;AACzD,OAAO,qDAAqD,CAAC;AAE7D,OAAO,EAAsB,WAAW,EAAE,MAAM,aAAa,CAAC;AAE9D,OAAO,2CAA2C,CAAC;AAEnD;;;;;;;;;;;;GAYG;AACH,qBACa,cAAe,SAAQ,UAAU;IAC5C,kEAAkE;IAElE,UAAU,EAAE,WAAW,EAAE,CAAM;IAE/B,mCAAmC;IAEnC,WAAW,UAAS;IAEpB,+DAA+D;IAE/D,KAAK,CAAC,EAAE,GAAG,CAAC;IAEZ,OAAgB,MAAM,EAAE,cAAc,CAuCpC;IAEO,YAAY,IAAI,IAAI;IAYpB,MAAM;IA0Bf,SAAS,CAAC,oBAAoB,CAC5B,IAAI,EAAE,WAAW,EACjB,KAAK,EAAE,MAAM,GACZ,cAAc;IAkBjB,SAAS,CAAC,6BAA6B,CACrC,IAAI,EAAE,WAAW,EACjB,KAAK,EAAE,MAAM,GACZ,cAAc,GAAG,IAAI;IAUxB,SAAS,CAAC,mBAAmB,CAAC,KAAK,EAAE,MAAM,EAAE,IAAI,EAAE,WAAW;CAmB/D"}
@@ -1,11 +1,7 @@
1
1
  import { css, LitElement, html } from 'lit';
2
- import { property, query } from 'lit/decorators.js';
2
+ import { property } from 'lit/decorators.js';
3
3
  import { localized, msg } from '@lit/localize';
4
- import '@progressive-development/pd-forms/pd-form-container';
5
- import '@progressive-development/pd-forms/pd-form-row';
6
- import '@progressive-development/pd-forms/pd-checkbox';
7
4
  import '@progressive-development/pd-price/pd-pricetable';
8
- import '@progressive-development/pd-dialog/pd-popup';
9
5
  import '@progressive-development/pd-content/pd-edit-content';
10
6
  import '../pd-order-contacts.js';
11
7
 
@@ -24,7 +20,6 @@ let PdOrderSummary = class extends LitElement {
24
20
  super(...arguments);
25
21
  this.orderSteps = [];
26
22
  this.withPayment = false;
27
- this.withAgreement = false;
28
23
  }
29
24
  firstUpdated() {
30
25
  this.addEventListener("edit-content", (e) => {
@@ -55,69 +50,10 @@ let PdOrderSummary = class extends LitElement {
55
50
  ></pd-pricetable>
56
51
  </div>
57
52
  ` : ""}
58
- ${this.withAgreement ? html`
59
- <pd-form-container id="submitSummaryFormId">
60
- <pd-form-row>
61
- <pd-checkbox
62
- id="agreeConditionsId"
63
- valueName="agreeId"
64
- class="agree-box"
65
- required
66
- requiredMsg="${msg(
67
- "Bitte stimmen Sie den Allgemeinen Geschäftsbedingungen zu, um fortzufahren.",
68
- { id: "pd.order.summary.agree.required" }
69
- )}"
70
- >
71
- ${msg("Ich akzeptiere die", {
72
- id: "pd.order.summary.agree.link1"
73
- })}
74
- <a
75
- @click="${this._openTermsAndConditions}"
76
- @keypress="${this._openTermsAndConditions}"
77
- >${msg("Allgemeinen Geschäftsbedingungen", {
78
- id: "pd.order.summary.agree.link2"
79
- })}</a
80
- >
81
- </pd-checkbox>
82
- </pd-form-row>
83
- </pd-form-container>
84
53
 
85
- <pd-popup id="agreePopupId">
86
- <div slot="content"><slot name="legal"></slot></div>
87
- </pd-popup>
88
- ` : ""}
54
+ <slot name="agreement"></slot>
89
55
  `;
90
56
  }
91
- get valid() {
92
- return !this.withAgreement || this._agreeForm?.valid === true;
93
- }
94
- async triggerValidate() {
95
- return this._agreeForm?.triggerValidate();
96
- }
97
- /*
98
- For Booking:
99
- case "zip":
100
- case "booking":
101
- return this._getBookingSummary(index + 1, step);
102
-
103
- private _getBookingSummary(index: number, step: PdOrderStep) {
104
- const date = this.order?.selectedDate
105
- ? format(this.order.selectedDate, "DD/MM/YYYY")
106
- : undefined;
107
- const bookingData = [{ name: "Postcode:", val: this.order?.zip }];
108
- if (date) {
109
- bookingData.push({ name: "Datum van herstelling:", val: date });
110
- }
111
-
112
- return html`
113
- <pd-edit-content
114
- contentTitle="${step.name}"
115
- stepNumber="${index}"
116
- .data="${bookingData}"
117
- ></pd-edit-content>
118
- `;
119
- }
120
- */
121
57
  _mapOrderStepSummary(step, index) {
122
58
  const custom = this._renderCustomOrderStepSummary(step, index);
123
59
  if (custom) {
@@ -159,10 +95,6 @@ let PdOrderSummary = class extends LitElement {
159
95
  </pd-edit-content>
160
96
  `;
161
97
  }
162
- _openTermsAndConditions(e) {
163
- e.stopPropagation();
164
- this._agreePopup?.showPopup();
165
- }
166
98
  };
167
99
  PdOrderSummary.styles = [
168
100
  css`
@@ -197,18 +129,6 @@ PdOrderSummary.styles = [
197
129
  .pricetable {
198
130
  padding-top: 20px;
199
131
  }
200
- a {
201
- cursor: pointer;
202
- font-family: var(--pd-default-font-link-family);
203
- font-size: var(--pd-default-font-link-size);
204
- color: var(--pd-default-font-link-col);
205
- }
206
- a:hover {
207
- color: var(--pd-default-font-link-col-hover);
208
- }
209
- .agree-box {
210
- padding-top: 20px;
211
- }
212
132
  @media (max-width: 380px) {
213
133
  .pay-logo {
214
134
  max-width: 5rem;
@@ -222,18 +142,9 @@ __decorateClass([
222
142
  __decorateClass([
223
143
  property({ type: Boolean })
224
144
  ], PdOrderSummary.prototype, "withPayment", 2);
225
- __decorateClass([
226
- property({ type: Boolean })
227
- ], PdOrderSummary.prototype, "withAgreement", 2);
228
145
  __decorateClass([
229
146
  property({ type: Object })
230
147
  ], PdOrderSummary.prototype, "order", 2);
231
- __decorateClass([
232
- query("#submitSummaryFormId")
233
- ], PdOrderSummary.prototype, "_agreeForm", 2);
234
- __decorateClass([
235
- query("#agreePopupId")
236
- ], PdOrderSummary.prototype, "_agreePopup", 2);
237
148
  PdOrderSummary = __decorateClass([
238
149
  localized()
239
150
  ], PdOrderSummary);
@@ -8,8 +8,6 @@ import { PdOrderStep } from '../types.js';
8
8
  interface PdOrderSummaryArgs {
9
9
  /** Show payment/pricing section */
10
10
  withPayment: boolean;
11
- /** Show terms agreement checkbox with validation */
12
- withAgreement: boolean;
13
11
  /** Order steps to display in summary */
14
12
  orderSteps: PdOrderStep[];
15
13
  /** Primary order contact data */
@@ -20,19 +18,18 @@ interface PdOrderSummaryArgs {
20
18
  /**
21
19
  * ## pd-order-summary
22
20
  *
23
- * Order summary component that displays configurable steps, pricing information,
24
- * and an optional terms-and-conditions agreement.
21
+ * Order summary component that displays configurable steps and pricing information.
25
22
  *
26
23
  * ### Features
27
24
  * - Configurable order steps with edit-content integration
28
25
  * - Automatic contact summary rendering for "contacts" step key
29
26
  * - Price table with tax calculation via pd-pricetable
30
- * - Terms and conditions agreement checkbox with popup
31
- * - Named slots for custom step content and legal text
27
+ * - Agreement slot for pd-order-agreement integration
28
+ * - Named slots for custom step content
32
29
  * - Fires `go-to` event when user clicks edit on a step
33
30
  *
34
31
  * ### Slots
35
- * - `legal` — Terms and conditions content (shown in popup)
32
+ * - `agreement` — Slot for pd-order-agreement component
36
33
  * - `[stepKey]` — Named slots for custom step content
37
34
  *
38
35
  * ### Usage Note
@@ -42,16 +39,14 @@ interface PdOrderSummaryArgs {
42
39
  declare const meta: Meta<PdOrderSummaryArgs>;
43
40
  export default meta;
44
41
  type Story = StoryObj<PdOrderSummaryArgs>;
45
- /** Default order summary with payment and agreement enabled. Interactive via Controls panel. */
42
+ /** Default order summary with payment enabled. Interactive via Controls panel. */
46
43
  export declare const Default: Story;
47
44
  /** Order summary showing separate billing contact alongside order contact. */
48
45
  export declare const WithBillingContact: Story;
49
46
  /** Order summary without the pricing/payment section — for non-billable orders. */
50
47
  export declare const WithoutPayment: Story;
51
- /** Order summary without the terms agreement checkbox when agreement is handled elsewhere. */
52
- export declare const WithoutAgreement: Story;
53
- /** Minimal order summary without payment and agreement — just the order steps and contacts. */
54
- export declare const Minimal: Story;
48
+ /** Order summary with pd-order-agreement in the agreement slot. */
49
+ export declare const WithAgreementSlot: Story;
55
50
  /** All summary configurations side by side for comparison. */
56
51
  export declare const AllConfigurations: Story;
57
52
  /** CSS Custom Properties — Branded and Redesigned payment section variants. */
@@ -1 +1 @@
1
- {"version":3,"file":"pd-order-summary.stories.d.ts","sourceRoot":"","sources":["../../src/pd-order-summary/pd-order-summary.stories.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,gCAAgC,CAAC;AAGrE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,qCAAqC,CAAC;AACzE,OAAO,6CAA6C,CAAC;AAErD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAG/C,OAAO,sCAAsC,CAAC;AAM9C;;;GAGG;AACH,UAAU,kBAAkB;IAC1B,mCAAmC;IACnC,WAAW,EAAE,OAAO,CAAC;IACrB,oDAAoD;IACpD,aAAa,EAAE,OAAO,CAAC;IACvB,wCAAwC;IACxC,UAAU,EAAE,WAAW,EAAE,CAAC;IAC1B,iCAAiC;IACjC,YAAY,EAAE,aAAa,CAAC;IAC5B,oCAAoC;IACpC,cAAc,CAAC,EAAE,aAAa,CAAC;CAChC;AA4FD;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,QAAA,MAAM,IAAI,EAAE,IAAI,CAAC,kBAAkB,CAiGlC,CAAC;AAEF,eAAe,IAAI,CAAC;AACpB,KAAK,KAAK,GAAG,QAAQ,CAAC,kBAAkB,CAAC,CAAC;AAM1C,gGAAgG;AAChG,eAAO,MAAM,OAAO,EAAE,KAAU,CAAC;AAMjC,8EAA8E;AAC9E,eAAO,MAAM,kBAAkB,EAAE,KAIhC,CAAC;AAMF,mFAAmF;AACnF,eAAO,MAAM,cAAc,EAAE,KAI5B,CAAC;AAMF,gGAAgG;AAChG,eAAO,MAAM,gBAAgB,EAAE,KAI9B,CAAC;AAMF,+FAA+F;AAC/F,eAAO,MAAM,OAAO,EAAE,KAYrB,CAAC;AAMF,8DAA8D;AAC9D,eAAO,MAAM,iBAAiB,EAAE,KAqD/B,CAAC;AAMF,+EAA+E;AAC/E,eAAO,MAAM,aAAa,EAAE,KAwE3B,CAAC"}
1
+ {"version":3,"file":"pd-order-summary.stories.d.ts","sourceRoot":"","sources":["../../src/pd-order-summary/pd-order-summary.stories.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,gCAAgC,CAAC;AAGrE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,qCAAqC,CAAC;AAEzE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAG/C,OAAO,sCAAsC,CAAC;AAC9C,OAAO,6CAA6C,CAAC;AAMrD;;;GAGG;AACH,UAAU,kBAAkB;IAC1B,mCAAmC;IACnC,WAAW,EAAE,OAAO,CAAC;IACrB,wCAAwC;IACxC,UAAU,EAAE,WAAW,EAAE,CAAC;IAC1B,iCAAiC;IACjC,YAAY,EAAE,aAAa,CAAC;IAC5B,oCAAoC;IACpC,cAAc,CAAC,EAAE,aAAa,CAAC;CAChC;AA8ED;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,QAAA,MAAM,IAAI,EAAE,IAAI,CAAC,kBAAkB,CAiFlC,CAAC;AAEF,eAAe,IAAI,CAAC;AACpB,KAAK,KAAK,GAAG,QAAQ,CAAC,kBAAkB,CAAC,CAAC;AAM1C,kFAAkF;AAClF,eAAO,MAAM,OAAO,EAAE,KAAU,CAAC;AAMjC,8EAA8E;AAC9E,eAAO,MAAM,kBAAkB,EAAE,KAIhC,CAAC;AAMF,mFAAmF;AACnF,eAAO,MAAM,cAAc,EAAE,KAI5B,CAAC;AAMF,mEAAmE;AACnE,eAAO,MAAM,iBAAiB,EAAE,KAqB/B,CAAC;AAMF,8DAA8D;AAC9D,eAAO,MAAM,iBAAiB,EAAE,KA0D/B,CAAC;AAMF,+EAA+E;AAC/E,eAAO,MAAM,aAAa,EAAE,KAwE3B,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@progressive-development/pd-order",
3
- "version": "1.0.1",
3
+ "version": "1.1.1",
4
4
  "description": "Progressive Development Order Component",
5
5
  "author": "PD Progressive Development",
6
6
  "license": "MIT",
@@ -15,6 +15,7 @@
15
15
  ".": "./dist/index.js",
16
16
  "./pd-order-contacts": "./dist/pd-order-contacts.js",
17
17
  "./pd-order-summary": "./dist/pd-order-summary.js",
18
+ "./pd-order-agreement": "./dist/pd-order-agreement.js",
18
19
  "./locales/be": "./dist/locales/be.js",
19
20
  "./locales/de": "./dist/locales/de.js",
20
21
  "./locales/en": "./dist/locales/en.js"
@@ -33,8 +34,8 @@
33
34
  "@progressive-development/pd-shared-styles": "0.3.2",
34
35
  "@progressive-development/pd-forms": "1.0.1",
35
36
  "@progressive-development/pd-price": "1.0.1",
36
- "@progressive-development/pd-contact": "1.0.1",
37
37
  "@progressive-development/pd-content": "1.0.1",
38
+ "@progressive-development/pd-contact": "1.0.2",
38
39
  "@progressive-development/pd-dialog": "1.0.1"
39
40
  },
40
41
  "customElements": "custom-elements.json",