@foxy.io/elements 1.40.0 → 1.41.0-beta.2

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.
Files changed (109) hide show
  1. package/dist/cdn/foxy-address-form.js +1 -1
  2. package/dist/cdn/foxy-admin-subscription-form.js +1 -1
  3. package/dist/cdn/foxy-api-browser.js +1 -1
  4. package/dist/cdn/foxy-applied-coupon-code-form.js +1 -1
  5. package/dist/cdn/foxy-attribute-form.js +1 -1
  6. package/dist/cdn/foxy-cart-form.js +2 -2
  7. package/dist/cdn/foxy-client-form.js +1 -1
  8. package/dist/cdn/foxy-coupon-code-form.js +1 -1
  9. package/dist/cdn/foxy-coupon-codes-form.js +1 -1
  10. package/dist/cdn/foxy-coupon-form.js +1 -1
  11. package/dist/cdn/foxy-custom-field-form.js +1 -1
  12. package/dist/cdn/foxy-customer-form.js +1 -1
  13. package/dist/cdn/foxy-customer-portal-settings-form.js +1 -1
  14. package/dist/cdn/foxy-customer-portal.js +1 -1
  15. package/dist/cdn/foxy-customer.js +1 -1
  16. package/dist/cdn/foxy-downloadable-form.js +1 -1
  17. package/dist/cdn/foxy-email-template-form.js +1 -1
  18. package/dist/cdn/foxy-experimental-add-to-cart-builder.js +1 -1
  19. package/dist/cdn/foxy-filter-attribute-form.js +1 -1
  20. package/dist/cdn/foxy-form-dialog.js +1 -1
  21. package/dist/cdn/foxy-generate-codes-form.js +1 -1
  22. package/dist/cdn/foxy-gift-card-code-form.js +1 -1
  23. package/dist/cdn/foxy-gift-card-codes-form.js +1 -1
  24. package/dist/cdn/foxy-gift-card-form.js +1 -1
  25. package/dist/cdn/foxy-integration-form.js +1 -1
  26. package/dist/cdn/foxy-item-category-form.js +1 -1
  27. package/dist/cdn/foxy-item-form.js +1 -1
  28. package/dist/cdn/foxy-item-option-form.js +1 -1
  29. package/dist/cdn/foxy-native-integration-form.js +1 -1
  30. package/dist/cdn/foxy-passkey-form.js +1 -1
  31. package/dist/cdn/foxy-payment-method-card.js +1 -1
  32. package/dist/cdn/foxy-payments-api-fraud-protection-form.js +1 -1
  33. package/dist/cdn/foxy-payments-api-payment-method-form.js +1 -1
  34. package/dist/cdn/foxy-payments-api-payment-preset-form.js +1 -1
  35. package/dist/cdn/foxy-report-form.js +1 -1
  36. package/dist/cdn/foxy-store-form.js +1 -1
  37. package/dist/cdn/foxy-store-shipping-method-form.js +1 -1
  38. package/dist/cdn/foxy-subscription-form.js +1 -1
  39. package/dist/cdn/foxy-subscription-settings-form.js +1 -1
  40. package/dist/cdn/foxy-tax-form.js +1 -1
  41. package/dist/cdn/foxy-template-config-form.js +1 -1
  42. package/dist/cdn/foxy-template-form.js +1 -1
  43. package/dist/cdn/foxy-template-set-form.js +1 -1
  44. package/dist/cdn/foxy-transaction.js +1 -1
  45. package/dist/cdn/foxy-update-payment-method-form.js +1 -1
  46. package/dist/cdn/foxy-user-form.js +1 -1
  47. package/dist/cdn/foxy-user-invitation-form.js +1 -1
  48. package/dist/cdn/foxy-users-table.js +1 -1
  49. package/dist/cdn/foxy-webhook-form.js +1 -1
  50. package/dist/cdn/{shared-5b4e2567.js → shared-109ec474.js} +1 -1
  51. package/dist/cdn/shared-1100bca8.js +1 -0
  52. package/dist/cdn/{shared-eef73355.js → shared-18e3b778.js} +1 -1
  53. package/dist/cdn/{shared-9e8ed3af.js → shared-35a49192.js} +1 -1
  54. package/dist/cdn/{shared-00e02b35.js → shared-43637d69.js} +1 -1
  55. package/dist/cdn/{shared-cc7e1dc6.js → shared-47d95cdd.js} +1 -1
  56. package/dist/cdn/{shared-17f2f27a.js → shared-57a179b3.js} +1 -1
  57. package/dist/cdn/{shared-3a952968.js → shared-6199cae2.js} +1 -1
  58. package/dist/cdn/{shared-5cd33249.js → shared-63eef674.js} +1 -1
  59. package/dist/cdn/{shared-e4119ddc.js → shared-67f73b81.js} +1 -1
  60. package/dist/cdn/{shared-c73c69bf.js → shared-697d44e6.js} +1 -1
  61. package/dist/cdn/{shared-0c2879b9.js → shared-6be00444.js} +1 -1
  62. package/dist/cdn/{shared-0098edce.js → shared-7097e2e1.js} +1 -1
  63. package/dist/cdn/{shared-e21ddeae.js → shared-77132fe8.js} +1 -1
  64. package/dist/cdn/{shared-653368ea.js → shared-864ff856.js} +1 -1
  65. package/dist/cdn/{shared-33ecc7ee.js → shared-86e9c57a.js} +1 -1
  66. package/dist/cdn/{shared-e0da7113.js → shared-88220d9e.js} +1 -1
  67. package/dist/cdn/{shared-4a4f6eb9.js → shared-888018de.js} +1 -1
  68. package/dist/cdn/{shared-4a32f76a.js → shared-9a64bf35.js} +1 -1
  69. package/dist/cdn/{shared-511fcf8e.js → shared-e41fced3.js} +1 -1
  70. package/dist/cdn/translations/admin-subscription-form/en.json +16 -0
  71. package/dist/cdn/translations/coupon-form/en.json +15 -0
  72. package/dist/cdn/translations/transaction/en.json +60 -35
  73. package/dist/elements/internal/InternalConfirmDialog/InternalConfirmDialog.d.ts +1 -0
  74. package/dist/elements/internal/InternalConfirmDialog/InternalConfirmDialog.js +3 -0
  75. package/dist/elements/internal/InternalConfirmDialog/InternalConfirmDialog.js.map +1 -1
  76. package/dist/elements/internal/InternalPostActionControl/InternalPostActionControl.d.ts +13 -0
  77. package/dist/elements/internal/InternalPostActionControl/InternalPostActionControl.js +98 -0
  78. package/dist/elements/internal/InternalPostActionControl/InternalPostActionControl.js.map +1 -0
  79. package/dist/elements/internal/InternalPostActionControl/index.d.ts +7 -0
  80. package/dist/elements/internal/InternalPostActionControl/index.js +9 -0
  81. package/dist/elements/internal/InternalPostActionControl/index.js.map +1 -0
  82. package/dist/elements/public/AdminSubscriptionForm/AdminSubscriptionForm.js +21 -4
  83. package/dist/elements/public/AdminSubscriptionForm/AdminSubscriptionForm.js.map +1 -1
  84. package/dist/elements/public/AdminSubscriptionForm/index.d.ts +1 -0
  85. package/dist/elements/public/AdminSubscriptionForm/index.js +1 -0
  86. package/dist/elements/public/AdminSubscriptionForm/index.js.map +1 -1
  87. package/dist/elements/public/CouponForm/CouponForm.js +16 -1
  88. package/dist/elements/public/CouponForm/CouponForm.js.map +1 -1
  89. package/dist/elements/public/Transaction/Transaction.js +5 -3
  90. package/dist/elements/public/Transaction/Transaction.js.map +1 -1
  91. package/dist/elements/public/Transaction/index.d.ts +1 -1
  92. package/dist/elements/public/Transaction/index.js +1 -1
  93. package/dist/elements/public/Transaction/index.js.map +1 -1
  94. package/dist/elements/public/Transaction/internal/InternalTransactionActionsControl/InternalTransactionActionsControl.js +16 -14
  95. package/dist/elements/public/Transaction/internal/InternalTransactionActionsControl/InternalTransactionActionsControl.js.map +1 -1
  96. package/dist/elements/public/Transaction/internal/InternalTransactionActionsControl/index.d.ts +1 -1
  97. package/dist/elements/public/Transaction/internal/InternalTransactionActionsControl/index.js +1 -1
  98. package/dist/elements/public/Transaction/internal/InternalTransactionActionsControl/index.js.map +1 -1
  99. package/package.json +1 -1
  100. package/dist/cdn/shared-e5546d55.js +0 -1
  101. package/dist/cdn/translations/country/zh-cn.json +0 -248
  102. package/dist/cdn/translations/country/zh-hk.json +0 -245
  103. package/dist/cdn/translations/customer-portal/zh-hk.json +0 -1182
  104. package/dist/elements/public/Transaction/internal/InternalTransactionPostActionControl/InternalTransactionPostActionControl.d.ts +0 -10
  105. package/dist/elements/public/Transaction/internal/InternalTransactionPostActionControl/InternalTransactionPostActionControl.js +0 -60
  106. package/dist/elements/public/Transaction/internal/InternalTransactionPostActionControl/InternalTransactionPostActionControl.js.map +0 -1
  107. package/dist/elements/public/Transaction/internal/InternalTransactionPostActionControl/index.d.ts +0 -6
  108. package/dist/elements/public/Transaction/internal/InternalTransactionPostActionControl/index.js +0 -8
  109. package/dist/elements/public/Transaction/internal/InternalTransactionPostActionControl/index.js.map +0 -1
@@ -869,14 +869,19 @@
869
869
  "unchecked": "Not sent"
870
870
  },
871
871
  "process-webhook": {
872
- "idle": "Resend datafeed",
873
- "busy": "Resending datafeed...",
874
- "fail": "Failed to resend datafeed",
875
- "confirm": {
876
- "header": "Resend datafeed",
877
- "message": "Are you sure you'd like to resend XML datafeed for this transaction?",
872
+ "button": {
873
+ "idle": "Resend datafeed",
874
+ "busy": "Processing..."
875
+ },
876
+ "notification": {
877
+ "success": "XML datafeed resent successfully",
878
+ "error": "Failed to resend datafeed"
879
+ },
880
+ "confirm-dialog": {
881
+ "message": "This will attempt to resend the XML datafeed. Would you like to proceed?",
878
882
  "confirm": "Yes",
879
- "cancel": "No"
883
+ "cancel": "No",
884
+ "header": "Resend datafeed"
880
885
  }
881
886
  }
882
887
  },
@@ -1674,47 +1679,67 @@
1674
1679
  },
1675
1680
  "actions": {
1676
1681
  "capture": {
1677
- "idle": "Capture",
1678
- "busy": "Capturing...",
1679
- "fail": "Failed to capture",
1680
- "confirm": {
1681
- "header": "Capture",
1682
- "message": "Are you sure you'd like to capture this transaction?",
1682
+ "button": {
1683
+ "idle": "Capture",
1684
+ "busy": "Processing..."
1685
+ },
1686
+ "notification": {
1687
+ "success": "Captured successfully",
1688
+ "error": "Failed to capture"
1689
+ },
1690
+ "confirm-dialog": {
1691
+ "message": "This will attempt to capture this transaction. Would you like to proceed?",
1683
1692
  "confirm": "Yes",
1684
- "cancel": "No"
1693
+ "cancel": "No",
1694
+ "header": "Capture"
1685
1695
  }
1686
1696
  },
1687
1697
  "void": {
1688
- "idle": "Void",
1689
- "busy": "Voiding...",
1690
- "fail": "Failed to void",
1691
- "confirm": {
1692
- "header": "Void",
1693
- "message": "Are you sure you'd like to void this transaction?",
1698
+ "button": {
1699
+ "idle": "Void",
1700
+ "busy": "Processing..."
1701
+ },
1702
+ "notification": {
1703
+ "success": "Voided successfully",
1704
+ "error": "Failed to void"
1705
+ },
1706
+ "confirm-dialog": {
1707
+ "message": "This will attempt to void this transaction. Would you like to proceed?",
1694
1708
  "confirm": "Yes",
1695
- "cancel": "No"
1709
+ "cancel": "No",
1710
+ "header": "Void"
1696
1711
  }
1697
1712
  },
1698
1713
  "refund": {
1699
- "idle": "Refund",
1700
- "busy": "Refunding...",
1701
- "fail": "Failed to refund",
1702
- "confirm": {
1703
- "header": "Refund",
1704
- "message": "Are you sure you'd like to refund this transaction?",
1714
+ "button": {
1715
+ "idle": "Refund",
1716
+ "busy": "Processing..."
1717
+ },
1718
+ "notification": {
1719
+ "success": "Refunded successfully",
1720
+ "error": "Failed to refund"
1721
+ },
1722
+ "confirm-dialog": {
1723
+ "message": "This will attempt to refund this transaction. Would you like to proceed?",
1705
1724
  "confirm": "Yes",
1706
- "cancel": "No"
1725
+ "cancel": "No",
1726
+ "header": "Refund"
1707
1727
  }
1708
1728
  },
1709
1729
  "send-emails": {
1710
- "idle": "Resend emails",
1711
- "busy": "Resending emails...",
1712
- "fail": "Failed to resend emails",
1713
- "confirm": {
1714
- "header": "Send emails",
1715
- "message": "Are you sure you'd like to send emails for this transaction?",
1730
+ "button": {
1731
+ "idle": "Resend emails",
1732
+ "busy": "Sending..."
1733
+ },
1734
+ "notification": {
1735
+ "success": "Emails resent successfully",
1736
+ "error": "Failed to resend emails"
1737
+ },
1738
+ "confirm-dialog": {
1739
+ "message": "This will attempt to resend emails for this transaction. Would you like to proceed?",
1716
1740
  "confirm": "Yes",
1717
- "cancel": "No"
1741
+ "cancel": "No",
1742
+ "header": "Resend emails"
1718
1743
  }
1719
1744
  },
1720
1745
  "subscription": {
@@ -6,6 +6,7 @@ export declare class InternalConfirmDialog extends Dialog {
6
6
  readonly closable = false;
7
7
  readonly editable = false;
8
8
  readonly alert = true;
9
+ messageOptions: Record<string, string>;
9
10
  confirm: string;
10
11
  message: string;
11
12
  cancel: string;
@@ -6,6 +6,7 @@ export class InternalConfirmDialog extends Dialog {
6
6
  this.closable = false;
7
7
  this.editable = false;
8
8
  this.alert = true;
9
+ this.messageOptions = {};
9
10
  this.confirm = 'confirm';
10
11
  this.message = 'message';
11
12
  this.cancel = 'cancel';
@@ -14,6 +15,7 @@ export class InternalConfirmDialog extends Dialog {
14
15
  static get properties() {
15
16
  return {
16
17
  ...super.properties,
18
+ messageOptions: { type: Object, attribute: 'message-options' },
17
19
  confirm: { type: String },
18
20
  message: { type: String },
19
21
  cancel: { type: String },
@@ -27,6 +29,7 @@ export class InternalConfirmDialog extends Dialog {
27
29
  lang=${this.lang}
28
30
  key=${this.message}
29
31
  ns=${this.ns}
32
+ .options=${this.messageOptions}
30
33
  >
31
34
  </foxy-i18n>
32
35
 
@@ -1 +1 @@
1
- {"version":3,"file":"InternalConfirmDialog.js","sourceRoot":"","sources":["../../../../src/elements/internal/InternalConfirmDialog/InternalConfirmDialog.ts"],"names":[],"mappings":"AAAA,OAAO,EAAkB,IAAI,EAAE,MAAM,UAAU,CAAC;AAEhD,OAAO,EAAE,MAAM,EAAE,uCAAoC;AAGrD,MAAM,OAAO,qBAAsB,SAAQ,MAAM;IAAjD;;QAWW,aAAQ,GAAG,KAAK,CAAC;QAEjB,aAAQ,GAAG,KAAK,CAAC;QAEjB,UAAK,GAAG,IAAI,CAAC;QAEtB,YAAO,GAAG,SAAS,CAAC;QAEpB,YAAO,GAAG,SAAS,CAAC;QAEpB,WAAM,GAAG,QAAQ,CAAC;QAElB,UAAK,GAAG,SAAS,CAAC;IAqCpB,CAAC;IA3DC,MAAM,KAAK,UAAU;QACnB,OAAO;YACL,GAAG,KAAK,CAAC,UAAU;YACnB,OAAO,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE;YACzB,OAAO,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE;YACzB,MAAM,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE;YACxB,KAAK,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE;SACxB,CAAC;IACJ,CAAC;IAgBD,MAAM;QACJ,OAAO,KAAK,CAAC,MAAM,CACjB,GAAG,EAAE,CAAC,IAAI,CAAA;;;iBAGC,IAAI,CAAC,IAAI;gBACV,IAAI,CAAC,OAAO;eACb,IAAI,CAAC,EAAE;;;;;6DAKuC,IAAI,CAAC,cAAc;4BACpD,IAAI,CAAC,EAAE,SAAS,IAAI,CAAC,IAAI,QAAQ,IAAI,CAAC,MAAM;;;;oBAIpD,IAAI,CAAC,KAAK;;qBAET,IAAI,CAAC,eAAe;;4BAEb,IAAI,CAAC,EAAE,SAAS,IAAI,CAAC,IAAI,QAAQ,IAAI,CAAC,OAAO;;;OAGlE,CACF,CAAC;IACJ,CAAC;IAEO,KAAK,CAAC,cAAc;QAC1B,MAAM,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IACxB,CAAC;IAEO,KAAK,CAAC,eAAe;QAC3B,MAAM,IAAI,CAAC,IAAI,EAAE,CAAC;IACpB,CAAC;CACF","sourcesContent":["import { TemplateResult, html } from 'lit-html';\n\nimport { Dialog } from '../../private/Dialog/Dialog';\nimport { PropertyDeclarations } from 'lit-element';\n\nexport class InternalConfirmDialog extends Dialog {\n static get properties(): PropertyDeclarations {\n return {\n ...super.properties,\n confirm: { type: String },\n message: { type: String },\n cancel: { type: String },\n theme: { type: String },\n };\n }\n\n readonly closable = false;\n\n readonly editable = false;\n\n readonly alert = true;\n\n confirm = 'confirm';\n\n message = 'message';\n\n cancel = 'cancel';\n\n theme = 'primary';\n\n render(): TemplateResult {\n return super.render(\n () => html`\n <foxy-i18n\n class=\"block font-lumo text-m text-body text-center mb-m\"\n lang=${this.lang}\n key=${this.message}\n ns=${this.ns}\n >\n </foxy-i18n>\n\n <div class=\"grid grid-cols-2 gap-m\">\n <vaadin-button data-testid=\"cancelButton\" @click=${this.__handleCancel}>\n <foxy-i18n ns=${this.ns} lang=${this.lang} key=${this.cancel}></foxy-i18n>\n </vaadin-button>\n\n <vaadin-button\n theme=${this.theme}\n data-testid=\"confirmButton\"\n @click=${this.__handleConfirm}\n >\n <foxy-i18n ns=${this.ns} lang=${this.lang} key=${this.confirm}></foxy-i18n>\n </vaadin-button>\n </div>\n `\n );\n }\n\n private async __handleCancel() {\n await this.hide(true);\n }\n\n private async __handleConfirm() {\n await this.hide();\n }\n}\n"]}
1
+ {"version":3,"file":"InternalConfirmDialog.js","sourceRoot":"","sources":["../../../../src/elements/internal/Internal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ACF,CAAC;IACJ,CAAC;IAEO,KAAK,CAAC,cAAc;QAC1B,MAAM,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IACxB,CAAC;IAEO,KAAK,CAAC,eAAe;QAC3B,MAAM,IAAI,CAAC,IAAI,EAAE,CAAC;IACpB,CAAC;CACF","sourcesContent":["import { TemplateResult, html } from 'lit-html';\n\nimport { Dialog } from '../../private/Dialog/Dialog';\nimport { PropertyDeclarations } from 'lit-element';\n\nexport class InternalConfirmDialog extends Dialog {\n static get properties(): PropertyDeclarations {\n return {\n ...super.properties,\n messageOptions: { type: Object, attribute: 'message-options' },\n confirm: { type: String },\n message: { type: String },\n cancel: { type: String },\n theme: { type: String },\n };\n }\n\n readonly closable = false;\n\n readonly editable = false;\n\n readonly alert = true;\n\n messageOptions: Record<string, string> = {};\n\n confirm = 'confirm';\n\n message = 'message';\n\n cancel = 'cancel';\n\n theme = 'primary';\n\n render(): TemplateResult {\n return super.render(\n () => html`\n <foxy-i18n\n class=\"block font-lumo text-m text-body text-center mb-m\"\n lang=${this.lang}\n key=${this.message}\n ns=${this.ns}\n .options=${this.messageOptions}\n >\n </foxy-i18n>\n\n <div class=\"grid grid-cols-2 gap-m\">\n <vaadin-button data-testid=\"cancelButton\" @click=${this.__handleCancel}>\n <foxy-i18n ns=${this.ns} lang=${this.lang} key=${this.cancel}></foxy-i18n>\n </vaadin-button>\n\n <vaadin-button\n theme=${this.theme}\n data-testid=\"confirmButton\"\n @click=${this.__handleConfirm}\n >\n <foxy-i18n ns=${this.ns} lang=${this.lang} key=${this.confirm}></foxy-i18n>\n </vaadin-button>\n </div>\n `\n );\n }\n\n private async __handleCancel() {\n await this.hide(true);\n }\n\n private async __handleConfirm() {\n await this.hide();\n }\n}\n"]}
@@ -0,0 +1,13 @@
1
+ import type { PropertyDeclarations, TemplateResult } from 'lit-element';
2
+ import { InternalControl } from '../InternalControl/InternalControl';
3
+ export declare class InternalPostActionControl extends InternalControl {
4
+ static get properties(): PropertyDeclarations;
5
+ messageOptions: Record<string, string>;
6
+ theme: string | null;
7
+ href: string | null;
8
+ private __buttonState;
9
+ private readonly __api;
10
+ renderControl(): TemplateResult;
11
+ private __sendPost;
12
+ private __getNotificationRenderer;
13
+ }
@@ -0,0 +1,98 @@
1
+ import { InternalControl } from "../InternalControl/InternalControl.js";
2
+ import { html, render } from 'lit-html';
3
+ import { ifDefined } from 'lit-html/directives/if-defined';
4
+ import { API } from "../../public/NucleonElement/API.js";
5
+ export class InternalPostActionControl extends InternalControl {
6
+ constructor() {
7
+ super(...arguments);
8
+ this.messageOptions = {};
9
+ this.theme = null;
10
+ this.href = null;
11
+ this.__buttonState = 'idle';
12
+ this.__api = new API(this);
13
+ }
14
+ static get properties() {
15
+ return {
16
+ ...super.properties,
17
+ messageOptions: { type: Object, attribute: 'message-options' },
18
+ theme: {},
19
+ href: {},
20
+ __buttonState: {},
21
+ };
22
+ }
23
+ renderControl() {
24
+ var _a;
25
+ return html `
26
+ <foxy-internal-confirm-dialog
27
+ header="header"
28
+ infer="confirm-dialog"
29
+ id="confirm-dialog"
30
+ .messageOptions=${this.messageOptions}
31
+ @hide=${(evt) => {
32
+ if (!evt.detail.cancelled)
33
+ this.__sendPost();
34
+ }}
35
+ >
36
+ </foxy-internal-confirm-dialog>
37
+
38
+ <vaadin-notification
39
+ position="bottom-end"
40
+ duration="3000"
41
+ theme="success"
42
+ id="success-notification"
43
+ .renderer=${this.__getNotificationRenderer('success')}
44
+ >
45
+ </vaadin-notification>
46
+
47
+ <vaadin-notification
48
+ position="bottom-end"
49
+ duration="3000"
50
+ theme="error"
51
+ id="error-notification"
52
+ .renderer=${this.__getNotificationRenderer('error')}
53
+ >
54
+ </vaadin-notification>
55
+
56
+ <vaadin-button
57
+ theme=${ifDefined((_a = this.theme) !== null && _a !== void 0 ? _a : void 0)}
58
+ ?disabled=${this.disabled || this.readonly || this.__buttonState !== 'idle'}
59
+ @click=${(evt) => {
60
+ const button = evt.currentTarget;
61
+ const dialog = this.renderRoot.querySelector('#confirm-dialog');
62
+ dialog === null || dialog === void 0 ? void 0 : dialog.show(button);
63
+ }}
64
+ >
65
+ <foxy-i18n infer="button" key=${this.__buttonState}></foxy-i18n>
66
+ </vaadin-button>
67
+ `;
68
+ }
69
+ async __sendPost() {
70
+ if (this.href && this.__buttonState === 'idle') {
71
+ this.__buttonState = 'busy';
72
+ const response = await this.__api.fetch(this.href, { method: 'POST' });
73
+ const result = response.ok ? 'success' : 'error';
74
+ const selector = `#${result}-notification`;
75
+ const notification = this.renderRoot.querySelector(selector);
76
+ notification === null || notification === void 0 ? void 0 : notification.open();
77
+ this.__buttonState = 'idle';
78
+ this.dispatchEvent(new CustomEvent(result));
79
+ }
80
+ }
81
+ __getNotificationRenderer(state) {
82
+ return (root) => {
83
+ if (!root.firstElementChild)
84
+ root.innerHTML = '<span></span>';
85
+ const layout = html `
86
+ <foxy-i18n
87
+ style="color: var(--lumo-${state}-contrast-color)"
88
+ lang=${this.lang}
89
+ key=${state}
90
+ ns="${this.ns} notification"
91
+ >
92
+ </foxy-i18n>
93
+ `;
94
+ render(layout, root.firstElementChild);
95
+ };
96
+ }
97
+ }
98
+ //# sourceMappingURL=InternalPostActionControl.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"InternalPostActionControl.js","sourceRoot":"","sources":["../../../../src/elements/internal/InternalPostActionControl/InternalPostActionControl.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,eAAe,EAAE,8CAA2C;AACrE,OAAO,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AACxC,OAAO,EAAE,SAAS,EAAE,MAAM,gCAAgC,CAAC;AAC3D,OAAO,EAAE,GAAG,EAAE,2CAAwC;AAEtD,MAAM,OAAO,yBAA0B,SAAQ,eAAe;IAA9D;;QAWE,mBAAc,GAA2B,EAAE,CAAC;QAE5C,UAAK,GAAkB,IAAI,CAAC;QAE5B,SAAI,GAAkB,IAAI,CAAC;QAEnB,kBAAa,GAAoB,MAAM,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Q,GAAG,MAAM,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,IAAI,CAAC,IAAI,EAAE,EAAE,MAAM,EAAE,MAAM,EAAE,CAAC,CAAC;YACvE,MAAM,MAAM,GAAG,QAAQ,CAAC,EAAE,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,OAAO,CAAC;YACjD,MAAM,QAAQ,GAAG,IAAI,MAAM,eAAe,CAAC;YAC3C,MAAM,YAAY,GAAG,IAAI,CAAC,UAAU,CAAC,aAAa,CAAsB,QAAQ,CAAC,CAAC;YAElF,YAAY,aAAZ,YAAY,uBAAZ,YAAY,CAAE,IAAI,GAAG;YACrB,IAAI,CAAC,aAAa,GAAG,MAAM,CAAC;YAC5B,IAAI,CAAC,aAAa,CAAC,IAAI,WAAW,CAAC,MAAM,CAAC,CAAC,CAAC;SAC7C;IACH,CAAC;IAEO,yBAAyB,CAAC,KAA0B;QAC1D,OAAO,CAAC,IAAiB,EAAE,EAAE;YAC3B,IAAI,CAAC,IAAI,CAAC,iBAAiB;gBAAE,IAAI,CAAC,SAAS,GAAG,eAAe,CAAC;YAE9D,MAAM,MAAM,GAAG,IAAI,CAAA;;qCAEY,KAAK;iBACzB,IAAI,CAAC,IAAI;gBACV,KAAK;gBACL,IAAI,CAAC,EAAE;;;OAGhB,CAAC;YAEF,MAAM,CAAC,MAAM,EAAE,IAAI,CAAC,iBAAkB,CAAC,CAAC;QAC1C,CAAC,CAAC;IACJ,CAAC;CACF","sourcesContent":["import type { PropertyDeclarations, TemplateResult } from 'lit-element';\nimport type { InternalConfirmDialog } from '../InternalConfirmDialog/InternalConfirmDialog';\nimport type { NotificationElement } from '@vaadin/vaadin-notification';\nimport type { DialogHideEvent } from '../../private/Dialog/DialogHideEvent';\nimport type { ButtonElement } from '@vaadin/vaadin-button';\n\nimport { InternalControl } from '../InternalControl/InternalControl';\nimport { html, render } from 'lit-html';\nimport { ifDefined } from 'lit-html/directives/if-defined';\nimport { API } from '../../public/NucleonElement/API';\n\nexport class InternalPostActionControl extends InternalControl {\n static get properties(): PropertyDeclarations {\n return {\n ...super.properties,\n messageOptions: { type: Object, attribute: 'message-options' },\n theme: {},\n href: {},\n __buttonState: {},\n };\n }\n\n messageOptions: Record<string, string> = {};\n\n theme: string | null = null;\n\n href: string | null = null;\n\n private __buttonState: 'idle' | 'busy' = 'idle';\n\n private readonly __api = new API(this);\n\n renderControl(): TemplateResult {\n return html`\n <foxy-internal-confirm-dialog\n header=\"header\"\n infer=\"confirm-dialog\"\n id=\"confirm-dialog\"\n .messageOptions=${this.messageOptions}\n @hide=${(evt: DialogHideEvent) => {\n if (!evt.detail.cancelled) this.__sendPost();\n }}\n >\n </foxy-internal-confirm-dialog>\n\n <vaadin-notification\n position=\"bottom-end\"\n duration=\"3000\"\n theme=\"success\"\n id=\"success-notification\"\n .renderer=${this.__getNotificationRenderer('success')}\n >\n </vaadin-notification>\n\n <vaadin-notification\n position=\"bottom-end\"\n duration=\"3000\"\n theme=\"error\"\n id=\"error-notification\"\n .renderer=${this.__getNotificationRenderer('error')}\n >\n </vaadin-notification>\n\n <vaadin-button\n theme=${ifDefined(this.theme ?? void 0)}\n ?disabled=${this.disabled || this.readonly || this.__buttonState !== 'idle'}\n @click=${(evt: CustomEvent) => {\n const button = evt.currentTarget as ButtonElement;\n const dialog = this.renderRoot.querySelector<InternalConfirmDialog>('#confirm-dialog');\n dialog?.show(button);\n }}\n >\n <foxy-i18n infer=\"button\" key=${this.__buttonState}></foxy-i18n>\n </vaadin-button>\n `;\n }\n\n private async __sendPost() {\n if (this.href && this.__buttonState === 'idle') {\n this.__buttonState = 'busy';\n\n const response = await this.__api.fetch(this.href, { method: 'POST' });\n const result = response.ok ? 'success' : 'error';\n const selector = `#${result}-notification`;\n const notification = this.renderRoot.querySelector<NotificationElement>(selector);\n\n notification?.open();\n this.__buttonState = 'idle';\n this.dispatchEvent(new CustomEvent(result));\n }\n }\n\n private __getNotificationRenderer(state: 'success' | 'error') {\n return (root: HTMLElement) => {\n if (!root.firstElementChild) root.innerHTML = '<span></span>';\n\n const layout = html`\n <foxy-i18n\n style=\"color: var(--lumo-${state}-contrast-color)\"\n lang=${this.lang}\n key=${state}\n ns=\"${this.ns} notification\"\n >\n </foxy-i18n>\n `;\n\n render(layout, root.firstElementChild!);\n };\n }\n}\n"]}
@@ -0,0 +1,7 @@
1
+ import '@vaadin/vaadin-notification';
2
+ import '@vaadin/vaadin-button';
3
+ import '../InternalConfirmDialog/index';
4
+ import '../InternalControl/index';
5
+ import '../../public/I18n/index';
6
+ import { InternalPostActionControl } from './InternalPostActionControl';
7
+ export { InternalPostActionControl };
@@ -0,0 +1,9 @@
1
+ import '@vaadin/vaadin-notification';
2
+ import '@vaadin/vaadin-button';
3
+ import "../InternalConfirmDialog/index.js";
4
+ import "../InternalControl/index.js";
5
+ import "../../public/I18n/index.js";
6
+ import { InternalPostActionControl } from "./InternalPostActionControl.js";
7
+ customElements.define('foxy-internal-post-action-control', InternalPostActionControl);
8
+ export { InternalPostActionControl };
9
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/elements/internal/InternalPostActionControl/index.ts"],"names":[],"mappings":"AAAA,OAAO,6BAA6B,CAAC;AACrC,OAAO,uBAAuB,CAAC;AAE/B,2CAAwC;AACxC,qCAAkC;AAElC,oCAAiC;AAEjC,OAAO,EAAE,yBAAyB,EAAE,uCAAoC;AAExE,cAAc,CAAC,MAAM,CAAC,mCAAmC,EAAE,yBAAyB,CAAC,CAAC;AAEtF,OAAO,EAAE,yBAAyB,EAAE,CAAC","sourcesContent":["import '@vaadin/vaadin-notification';\nimport '@vaadin/vaadin-button';\n\nimport '../InternalConfirmDialog/index';\nimport '../InternalControl/index';\n\nimport '../../public/I18n/index';\n\nimport { InternalPostActionControl } from './InternalPostActionControl';\n\ncustomElements.define('foxy-internal-post-action-control', InternalPostActionControl);\n\nexport { InternalPostActionControl };\n"]}
@@ -32,16 +32,20 @@ export class AdminSubscriptionForm extends Base {
32
32
  return status ? `subtitle_${status}` : super.headerSubtitleKey;
33
33
  }
34
34
  renderBody() {
35
- var _a, _b, _c, _d, _e;
35
+ var _a, _b, _c, _d, _e, _f, _g, _h;
36
36
  let transactionsHref;
37
37
  try {
38
38
  const url = new URL((_b = (_a = this.data) === null || _a === void 0 ? void 0 : _a._links['fx:transactions'].href) !== null && _b !== void 0 ? _b : '');
39
39
  url.searchParams.set('zoom', 'items');
40
40
  transactionsHref = url.toString();
41
41
  }
42
- catch (_f) {
42
+ catch (_j) {
43
43
  transactionsHref = undefined;
44
44
  }
45
+ // @ts-expect-error - SDK doesn't know yet about the `fx:charge_past_due` link.
46
+ const chargePastDueHref = (_d = (_c = this.data) === null || _c === void 0 ? void 0 : _c._links['fx:charge_past_due']) === null || _d === void 0 ? void 0 : _d.href;
47
+ const pastDueAmount = (_e = this.data) === null || _e === void 0 ? void 0 : _e.past_due_amount;
48
+ const currencyCode = (_f = this.data) === null || _f === void 0 ? void 0 : _f._embedded['fx:transaction_template'].currency_code;
45
49
  return html `
46
50
  ${this.renderHeader()}
47
51
 
@@ -66,11 +70,24 @@ export class AdminSubscriptionForm extends Base {
66
70
  <foxy-internal-summary-control infer="overdue">
67
71
  <foxy-internal-number-control
68
72
  layout="summary-item"
69
- suffix=${ifDefined((_c = this.data) === null || _c === void 0 ? void 0 : _c._embedded['fx:transaction_template'].currency_code)}
73
+ suffix=${ifDefined(currencyCode)}
70
74
  infer="past-due-amount"
71
75
  min="0"
72
76
  >
73
77
  </foxy-internal-number-control>
78
+
79
+ ${chargePastDueHref && currencyCode && pastDueAmount
80
+ ? html `
81
+ <foxy-internal-post-action-control
82
+ message-options=${JSON.stringify({ amount: `${pastDueAmount} ${currencyCode}` })}
83
+ theme="tertiary-inline"
84
+ infer="charge-past-due"
85
+ href=${chargePastDueHref}
86
+ @success=${() => this.refresh()}
87
+ >
88
+ </foxy-internal-post-action-control>
89
+ `
90
+ : ''}
74
91
  </foxy-internal-summary-control>
75
92
 
76
93
  <foxy-internal-summary-control infer="self-service-links">
@@ -122,7 +139,7 @@ export class AdminSubscriptionForm extends Base {
122
139
  <foxy-internal-async-list-control
123
140
  infer="attributes"
124
141
  class="min-w-0"
125
- first=${ifDefined((_e = (_d = this.data) === null || _d === void 0 ? void 0 : _d._links) === null || _e === void 0 ? void 0 : _e['fx:attributes'].href)}
142
+ first=${ifDefined((_h = (_g = this.data) === null || _g === void 0 ? void 0 : _g._links) === null || _h === void 0 ? void 0 : _h['fx:attributes'].href)}
126
143
  item="foxy-attribute-card"
127
144
  form="foxy-attribute-form"
128
145
  alert
@@ -1 +1 @@
1
- {"version":3,"file":"AdminSubscriptionForm.js","sourceRoot":"","sources":["../../../../src/elements/public/AdminSubscriptionForm/AdminSubscriptionForm.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,qBAAqB,EAAE,kDAA+C;AAC/E,OAAO,EAAE,iBAAiB,EAAE,wCAAqC;AACjE,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACpD,OAAO,EAAE,YAAY,EAAE,oDAAiD;AACxE,OAAO,EAAE,SAAS,EAAE,MAAM,gCAAgC,CAAC;AAC3D,OAAO,EAAE,IAAI,EAAE,GAAG,EAAE,MAAM,UAAU,CAAC;AAErC,MAAM,EAAE,GAAG,yBAAyB,CAAC;AACrC,MAAM,IAAI,GAAG,iBAAiB,CAAC,YAAY,EAAE,EAAE,CAAC,CAAC;AAEjD,MAAM,OAAO,qBAAsB,SAAQ,IAAU;IAArD;;QAQE,yHAAyH;QACzH,oBAAe,GAAkB,IAAI,CAAC;IAgIxC,CAAC;IAxIC,MAAM,KAAK,UAAU;QACnB,OAAO;YACL,GAAG,KAAK,CAAC,UAAU;YACnB,eAAe,EAAE,EAAE,SAAS,EAAE,mBAAmB,EAAE;SACpD,CAAC;IACJ,CAAC;IAKD,IAAI,cAAc;;QAChB,MAAM,WAAW,GAAG,CAAC,QAAQ,EAAE,KAAK,CAAC,cAAc,C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;iBAI9B;YACH,CAAC,CAAC,EAAE;;;;;QAKV,IAAI,CAAC,oBAAoB,EAAE;;;;;gBAKnB,SAAS,aAAC,IAAI,CAAC,IAAI,0CAAE,MAAM,0CAAG,eAAe,EAAE,IAAI,CAAC;;;;;;;;;;gBAUpD,SAAS,CAAC,gBAAgB,CAAC;;;;;;;;;;QAUnC,KAAK,CAAC,UAAU,EAAE;KACrB,CAAC;IACJ,CAAC;CACF","sourcesContent":["import type { PropertyDeclarations } from 'lit-element';\nimport type { TemplateResult } from 'lit-html';\nimport type { Data } from './types';\n\nimport { getSubscriptionStatus } from '../../../utils/get-subscription-status';\nimport { TranslatableMixin } from '../../../mixins/translatable';\nimport { BooleanSelector } from '@foxy.io/sdk/core';\nimport { InternalForm } from '../../internal/InternalForm/InternalForm';\nimport { ifDefined } from 'lit-html/directives/if-defined';\nimport { html, svg } from 'lit-html';\n\nconst NS = 'admin-subscription-form';\nconst Base = TranslatableMixin(InternalForm, NS);\n\nexport class AdminSubscriptionForm extends Base<Data> {\n static get properties(): PropertyDeclarations {\n return {\n ...super.properties,\n uoeSettingsPage: { attribute: 'uoe-settings-page' },\n };\n }\n\n /** URL of the UOE settings page in the admin. If set, displays a link to that page in the self-service links section. */\n uoeSettingsPage: string | null = null;\n\n get hiddenSelector(): BooleanSelector {\n const alwaysMatch = ['delete', super.hiddenSelector.toString()];\n if (!this.data?.error_message) alwaysMatch.unshift('error-message');\n if (!this.data?.is_active) alwaysMatch.unshift('view-action', 'cancel-action');\n return new BooleanSelector(alwaysMatch.join(' ').trim());\n }\n\n get headerSubtitleKey(): string {\n const status = getSubscriptionStatus(this.data);\n return status ? `subtitle_${status}` : super.headerSubtitleKey;\n }\n\n renderBody(): TemplateResult {\n let transactionsHref: string | undefined;\n\n try {\n const url = new URL(this.data?._links['fx:transactions'].href ?? '');\n url.searchParams.set('zoom', 'items');\n transactionsHref = url.toString();\n } catch {\n transactionsHref = undefined;\n }\n\n return html`\n ${this.renderHeader()}\n\n <foxy-internal-admin-subscription-form-error infer=\"error-message\">\n </foxy-internal-admin-subscription-form-error>\n\n <foxy-internal-summary-control infer=\"general\">\n <foxy-internal-date-control layout=\"summary-item\" infer=\"start-date\">\n </foxy-internal-date-control>\n <foxy-internal-frequency-control\n layout=\"summary-item\"\n infer=\"frequency\"\n allow-twice-a-month\n >\n </foxy-internal-frequency-control>\n <foxy-internal-date-control layout=\"summary-item\" infer=\"next-transaction-date\">\n </foxy-internal-date-control>\n <foxy-internal-date-control layout=\"summary-item\" infer=\"end-date\">\n </foxy-internal-date-control>\n </foxy-internal-summary-control>\n\n <foxy-internal-summary-control infer=\"overdue\">\n <foxy-internal-number-control\n layout=\"summary-item\"\n suffix=${ifDefined(this.data?._embedded['fx:transaction_template'].currency_code)}\n infer=\"past-due-amount\"\n min=\"0\"\n >\n </foxy-internal-number-control>\n </foxy-internal-summary-control>\n\n <foxy-internal-summary-control infer=\"self-service-links\">\n <foxy-internal-admin-subscription-form-link-control infer=\"load-in-cart\">\n </foxy-internal-admin-subscription-form-link-control>\n\n <foxy-internal-admin-subscription-form-link-control\n search=\"cart=checkout\"\n infer=\"load-on-checkout\"\n >\n </foxy-internal-admin-subscription-form-link-control>\n\n <foxy-internal-admin-subscription-form-link-control\n search=\"sub_cancel=next_transaction_date\"\n infer=\"cancel-at-end-of-billing-period\"\n >\n </foxy-internal-admin-subscription-form-link-control>\n\n <foxy-internal-admin-subscription-form-link-control\n search=\"sub_cancel=true\"\n infer=\"cancel-next-day\"\n >\n </foxy-internal-admin-subscription-form-link-control>\n\n <div\n class=\"flex items-start leading-xs text-xs text-secondary\"\n style=\"gap: calc(0.625em + (var(--lumo-border-radius) / 4) - 1px)\"\n >\n ${svg`<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 16 16\" fill=\"currentColor\" aria-hidden=\"true\" class=\"flex-shrink-0\" style=\"width: 1.25em\"><path fill-rule=\"evenodd\" d=\"M15 8A7 7 0 1 1 1 8a7 7 0 0 1 14 0ZM9 5a1 1 0 1 1-2 0 1 1 0 0 1 2 0ZM6.75 8a.75.75 0 0 0 0 1.5h.75v1.75a.75.75 0 0 0 1.5 0v-2.5A.75.75 0 0 0 8.25 8h-1.5Z\" clip-rule=\"evenodd\" /></svg>`}\n <p>\n <foxy-i18n infer=\"\" key=\"uoe_hint_text\"></foxy-i18n>\n ${this.uoeSettingsPage\n ? html`\n <a\n target=\"_blank\"\n class=\"inline-block rounded font-medium text-body cursor-pointer hover-underline focus-outline-none focus-ring-2 focus-ring-primary-50\"\n href=${this.uoeSettingsPage}\n >\n <foxy-i18n infer=\"\" key=\"uoe_link_text\"></foxy-i18n>\n </a>\n `\n : ''}\n </p>\n </div>\n </foxy-internal-summary-control>\n\n ${this.renderTemplateOrSlot()}\n\n <foxy-internal-async-list-control\n infer=\"attributes\"\n class=\"min-w-0\"\n first=${ifDefined(this.data?._links?.['fx:attributes'].href)}\n item=\"foxy-attribute-card\"\n form=\"foxy-attribute-form\"\n alert\n >\n </foxy-internal-async-list-control>\n\n <foxy-internal-async-list-control\n infer=\"transactions\"\n class=\"min-w-0\"\n first=${ifDefined(transactionsHref)}\n item=\"foxy-transaction-card\"\n form=\"foxy-transaction\"\n hide-create-button\n hide-delete-button\n alert\n wide\n >\n </foxy-internal-async-list-control>\n\n ${super.renderBody()}\n `;\n }\n}\n"]}
1
+ {"version":3,"file":"AdminSubscriptionForm.js","sourceRoot":"","sources":["../../../../src/elements/public/AdminSubscriptionForm/AdminSubscriptionForm.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,qBAAqB,EAAE,kDAA+C;AAC/E,OAAO,EAAE,iBAAiB,EAAE,wCAAqC;AACjE,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACpD,OAAO,EAAE,YAAY,EAAE,oDAAiD;AACxE,OAAO,EAAE,SAAS,EAAE,MAAM,gCAAgC,CAAC;AAC3D,OAAO,EAAE,IAAI,EAAE,GAAG,EAAE,MAAM,UAAU,CAAC;AAErC,MAAM,E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\nimport type { Data } from './types';\n\nimport { getSubscriptionStatus } from '../../../utils/get-subscription-status';\nimport { TranslatableMixin } from '../../../mixins/translatable';\nimport { BooleanSelector } from '@foxy.io/sdk/core';\nimport { InternalForm } from '../../internal/InternalForm/InternalForm';\nimport { ifDefined } from 'lit-html/directives/if-defined';\nimport { html, svg } from 'lit-html';\n\nconst NS = 'admin-subscription-form';\nconst Base = TranslatableMixin(InternalForm, NS);\n\nexport class AdminSubscriptionForm extends Base<Data> {\n static get properties(): PropertyDeclarations {\n return {\n ...super.properties,\n uoeSettingsPage: { attribute: 'uoe-settings-page' },\n };\n }\n\n /** URL of the UOE settings page in the admin. If set, displays a link to that page in the self-service links section. */\n uoeSettingsPage: string | null = null;\n\n get hiddenSelector(): BooleanSelector {\n const alwaysMatch = ['delete', super.hiddenSelector.toString()];\n if (!this.data?.error_message) alwaysMatch.unshift('error-message');\n if (!this.data?.is_active) alwaysMatch.unshift('view-action', 'cancel-action');\n return new BooleanSelector(alwaysMatch.join(' ').trim());\n }\n\n get headerSubtitleKey(): string {\n const status = getSubscriptionStatus(this.data);\n return status ? `subtitle_${status}` : super.headerSubtitleKey;\n }\n\n renderBody(): TemplateResult {\n let transactionsHref: string | undefined;\n\n try {\n const url = new URL(this.data?._links['fx:transactions'].href ?? '');\n url.searchParams.set('zoom', 'items');\n transactionsHref = url.toString();\n } catch {\n transactionsHref = undefined;\n }\n\n // @ts-expect-error - SDK doesn't know yet about the `fx:charge_past_due` link.\n const chargePastDueHref: string | undefined = this.data?._links['fx:charge_past_due']?.href;\n const pastDueAmount = this.data?.past_due_amount;\n const currencyCode = this.data?._embedded['fx:transaction_template'].currency_code;\n\n return html`\n ${this.renderHeader()}\n\n <foxy-internal-admin-subscription-form-error infer=\"error-message\">\n </foxy-internal-admin-subscription-form-error>\n\n <foxy-internal-summary-control infer=\"general\">\n <foxy-internal-date-control layout=\"summary-item\" infer=\"start-date\">\n </foxy-internal-date-control>\n <foxy-internal-frequency-control\n layout=\"summary-item\"\n infer=\"frequency\"\n allow-twice-a-month\n >\n </foxy-internal-frequency-control>\n <foxy-internal-date-control layout=\"summary-item\" infer=\"next-transaction-date\">\n </foxy-internal-date-control>\n <foxy-internal-date-control layout=\"summary-item\" infer=\"end-date\">\n </foxy-internal-date-control>\n </foxy-internal-summary-control>\n\n <foxy-internal-summary-control infer=\"overdue\">\n <foxy-internal-number-control\n layout=\"summary-item\"\n suffix=${ifDefined(currencyCode)}\n infer=\"past-due-amount\"\n min=\"0\"\n >\n </foxy-internal-number-control>\n\n ${chargePastDueHref && currencyCode && pastDueAmount\n ? html`\n <foxy-internal-post-action-control\n message-options=${JSON.stringify({ amount: `${pastDueAmount} ${currencyCode}` })}\n theme=\"tertiary-inline\"\n infer=\"charge-past-due\"\n href=${chargePastDueHref}\n @success=${() => this.refresh()}\n >\n </foxy-internal-post-action-control>\n `\n : ''}\n </foxy-internal-summary-control>\n\n <foxy-internal-summary-control infer=\"self-service-links\">\n <foxy-internal-admin-subscription-form-link-control infer=\"load-in-cart\">\n </foxy-internal-admin-subscription-form-link-control>\n\n <foxy-internal-admin-subscription-form-link-control\n search=\"cart=checkout\"\n infer=\"load-on-checkout\"\n >\n </foxy-internal-admin-subscription-form-link-control>\n\n <foxy-internal-admin-subscription-form-link-control\n search=\"sub_cancel=next_transaction_date\"\n infer=\"cancel-at-end-of-billing-period\"\n >\n </foxy-internal-admin-subscription-form-link-control>\n\n <foxy-internal-admin-subscription-form-link-control\n search=\"sub_cancel=true\"\n infer=\"cancel-next-day\"\n >\n </foxy-internal-admin-subscription-form-link-control>\n\n <div\n class=\"flex items-start leading-xs text-xs text-secondary\"\n style=\"gap: calc(0.625em + (var(--lumo-border-radius) / 4) - 1px)\"\n >\n ${svg`<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 16 16\" fill=\"currentColor\" aria-hidden=\"true\" class=\"flex-shrink-0\" style=\"width: 1.25em\"><path fill-rule=\"evenodd\" d=\"M15 8A7 7 0 1 1 1 8a7 7 0 0 1 14 0ZM9 5a1 1 0 1 1-2 0 1 1 0 0 1 2 0ZM6.75 8a.75.75 0 0 0 0 1.5h.75v1.75a.75.75 0 0 0 1.5 0v-2.5A.75.75 0 0 0 8.25 8h-1.5Z\" clip-rule=\"evenodd\" /></svg>`}\n <p>\n <foxy-i18n infer=\"\" key=\"uoe_hint_text\"></foxy-i18n>\n ${this.uoeSettingsPage\n ? html`\n <a\n target=\"_blank\"\n class=\"inline-block rounded font-medium text-body cursor-pointer hover-underline focus-outline-none focus-ring-2 focus-ring-primary-50\"\n href=${this.uoeSettingsPage}\n >\n <foxy-i18n infer=\"\" key=\"uoe_link_text\"></foxy-i18n>\n </a>\n `\n : ''}\n </p>\n </div>\n </foxy-internal-summary-control>\n\n ${this.renderTemplateOrSlot()}\n\n <foxy-internal-async-list-control\n infer=\"attributes\"\n class=\"min-w-0\"\n first=${ifDefined(this.data?._links?.['fx:attributes'].href)}\n item=\"foxy-attribute-card\"\n form=\"foxy-attribute-form\"\n alert\n >\n </foxy-internal-async-list-control>\n\n <foxy-internal-async-list-control\n infer=\"transactions\"\n class=\"min-w-0\"\n first=${ifDefined(transactionsHref)}\n item=\"foxy-transaction-card\"\n form=\"foxy-transaction\"\n hide-create-button\n hide-delete-button\n alert\n wide\n >\n </foxy-internal-async-list-control>\n\n ${super.renderBody()}\n `;\n }\n}\n"]}
@@ -1,3 +1,4 @@
1
+ import '../../internal/InternalPostActionControl/index';
1
2
  import '../../internal/InternalAsyncListControl/index';
2
3
  import '../../internal/InternalFrequencyControl/index';
3
4
  import '../../internal/InternalNumberControl/index';
@@ -1,3 +1,4 @@
1
+ import "../../internal/InternalPostActionControl/index.js";
1
2
  import "../../internal/InternalAsyncListControl/index.js";
2
3
  import "../../internal/InternalFrequencyControl/index.js";
3
4
  import "../../internal/InternalNumberControl/index.js";
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/elements/public/AdminSubscriptionForm/index.ts"],"names":[],"mappings":"AAAA,0DAAuD;AACvD,0DAAuD;AACvD,uDAAoD;AACpD,qDAAkD;AAClD,8CAA2C;AAE3C,qCAAkC;AAClC,mCAAgC;AAChC,mCAAgC;AAChC,iCAA8B;AAE9B,sEAAmE;AACnE,gEAA6D;AAE7D,OAAO,EAAE,qBAAqB,EAAE,mCAAgC;AAEhE,cAAc,CAAC,MAAM,CAAC,8BAA8B,EAAE,qBAAqB,CAAC,CAAC;AAE7E,OAAO,EAAE,qBAAqB,EAAE,CAAC","sourcesContent":["import '../../internal/InternalAsyncListControl/index';\nimport '../../internal/InternalFrequencyControl/index';\nimport '../../internal/InternalNumberControl/index';\nimport '../../internal/InternalDateControl/index';\nimport '../../internal/InternalForm/index';\n\nimport '../TransactionCard/index';\nimport '../AttributeCard/index';\nimport '../AttributeForm/index';\nimport '../Transaction/index';\n\nimport './internal/InternalAdminSubscriptionFormLinkControl/index';\nimport './internal/InternalAdminSubscriptionFormError/index';\n\nimport { AdminSubscriptionForm } from './AdminSubscriptionForm';\n\ncustomElements.define('foxy-admin-subscription-form', AdminSubscriptionForm);\n\nexport { AdminSubscriptionForm };\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/elements/public/AdminSubscriptionForm/index.ts"],"names":[],"mappings":"AAAA,2DAAwD;AACxD,0DAAuD;AACvD,0DAAuD;AACvD,uDAAoD;AACpD,qDAAkD;AAClD,8CAA2C;AAE3C,qCAAkC;AAClC,mCAAgC;AAChC,mCAAgC;AAChC,iCAA8B;AAE9B,sEAAmE;AACnE,gEAA6D;AAE7D,OAAO,EAAE,qBAAqB,EAAE,mCAAgC;AAEhE,cAAc,CAAC,MAAM,CAAC,8BAA8B,EAAE,qBAAqB,CAAC,CAAC;AAE7E,OAAO,EAAE,qBAAqB,EAAE,CAAC","sourcesContent":["import '../../internal/InternalPostActionControl/index';\nimport '../../internal/InternalAsyncListControl/index';\nimport '../../internal/InternalFrequencyControl/index';\nimport '../../internal/InternalNumberControl/index';\nimport '../../internal/InternalDateControl/index';\nimport '../../internal/InternalForm/index';\n\nimport '../TransactionCard/index';\nimport '../AttributeCard/index';\nimport '../AttributeForm/index';\nimport '../Transaction/index';\n\nimport './internal/InternalAdminSubscriptionFormLinkControl/index';\nimport './internal/InternalAdminSubscriptionFormError/index';\n\nimport { AdminSubscriptionForm } from './AdminSubscriptionForm';\n\ncustomElements.define('foxy-admin-subscription-form', AdminSubscriptionForm);\n\nexport { AdminSubscriptionForm };\n"]}
@@ -170,7 +170,10 @@ export class CouponForm extends Base {
170
170
  }
171
171
  get hiddenSelector() {
172
172
  const alwaysMatch = [super.hiddenSelector.toString()];
173
- if (!this.data) {
173
+ if (this.data) {
174
+ alwaysMatch.push('coupon-codes-stub', 'category-restrictions-stub', 'attributes-stub');
175
+ }
176
+ else {
174
177
  alwaysMatch.push('coupon-codes', 'category-restrictions', 'attributes');
175
178
  }
176
179
  return new BooleanSelector(alwaysMatch.join(' ').trim());
@@ -220,6 +223,10 @@ export class CouponForm extends Base {
220
223
  <foxy-internal-coupon-form-rules-control infer="rules">
221
224
  </foxy-internal-coupon-form-rules-control>
222
225
 
226
+ <foxy-internal-summary-control infer="coupon-codes-stub">
227
+ <p class="text-disabled"><foxy-i18n infer="" key="text"></foxy-i18n></p>
228
+ </foxy-internal-summary-control>
229
+
223
230
  <foxy-internal-async-list-control
224
231
  first=${codesUrl}
225
232
  limit="5"
@@ -268,6 +275,10 @@ export class CouponForm extends Base {
268
275
  <foxy-internal-switch-control infer="customer-auto-apply"></foxy-internal-switch-control>
269
276
  </foxy-internal-summary-control>
270
277
 
278
+ <foxy-internal-summary-control infer="category-restrictions-stub">
279
+ <p class="text-disabled"><foxy-i18n infer="" key="text"></foxy-i18n></p>
280
+ </foxy-internal-summary-control>
281
+
271
282
  <foxy-internal-async-resource-link-list-control
272
283
  foreign-key-for-uri="item_category_uri"
273
284
  foreign-key-for-id="item_category_id"
@@ -336,6 +347,10 @@ export class CouponForm extends Base {
336
347
  <foxy-internal-switch-control infer="shared-codes-allowed"></foxy-internal-switch-control>
337
348
  </foxy-internal-summary-control>
338
349
 
350
+ <foxy-internal-summary-control infer="attributes-stub">
351
+ <p class="text-disabled"><foxy-i18n infer="" key="text"></foxy-i18n></p>
352
+ </foxy-internal-summary-control>
353
+
339
354
  <foxy-internal-async-list-control
340
355
  first=${ifDefined((_g = this.data) === null || _g === void 0 ? void 0 : _g._links['fx:attributes'].href)}
341
356
  limit="5"