@foxy.io/elements 1.36.0-beta.3 → 1.36.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (54) hide show
  1. package/dist/cdn/foxy-cart-form.js +1 -1
  2. package/dist/cdn/foxy-customer-api.js +1 -1
  3. package/dist/cdn/foxy-customer-form.js +1 -1
  4. package/dist/cdn/foxy-customer-portal.js +27 -13
  5. package/dist/cdn/foxy-customer.js +1 -1
  6. package/dist/cdn/foxy-payment-card-embed.js +1 -1
  7. package/dist/cdn/foxy-payment-method-card.js +1 -1
  8. package/dist/cdn/foxy-subscription-form.js +1 -1
  9. package/dist/cdn/foxy-transaction.js +1 -1
  10. package/dist/cdn/foxy-update-payment-method-form.js +1 -1
  11. package/dist/cdn/shared-231687fd.js +1 -0
  12. package/dist/cdn/{shared-5a9e9e89.js → shared-82e82908.js} +1 -1
  13. package/dist/cdn/shared-9ca85d1e.js +1 -0
  14. package/dist/cdn/translations/customer-portal/de.json +18 -0
  15. package/dist/cdn/translations/customer-portal/en.json +18 -0
  16. package/dist/cdn/translations/customer-portal/es.json +18 -0
  17. package/dist/cdn/translations/customer-portal/fr.json +18 -0
  18. package/dist/cdn/translations/customer-portal/nl.json +18 -0
  19. package/dist/cdn/translations/customer-portal/pl.json +18 -0
  20. package/dist/cdn/translations/customer-portal/sv.json +18 -0
  21. package/dist/cdn/translations/customer-portal/zh-hk.json +18 -0
  22. package/dist/cdn/translations/global/en.json +1 -1
  23. package/dist/elements/public/CartForm/types.d.ts +1 -9
  24. package/dist/elements/public/CartForm/types.js.map +1 -1
  25. package/dist/elements/public/CustomerPortal/CustomerPortal.d.ts +4 -0
  26. package/dist/elements/public/CustomerPortal/CustomerPortal.js +48 -13
  27. package/dist/elements/public/CustomerPortal/CustomerPortal.js.map +1 -1
  28. package/dist/elements/public/CustomerPortal/InternalCustomerPortalLoggedOutView.js +7 -1
  29. package/dist/elements/public/CustomerPortal/InternalCustomerPortalLoggedOutView.js.map +1 -1
  30. package/dist/elements/public/CustomerPortal/InternalCustomerPortalPasswordResetView.d.ts +25 -0
  31. package/dist/elements/public/CustomerPortal/InternalCustomerPortalPasswordResetView.js +72 -0
  32. package/dist/elements/public/CustomerPortal/InternalCustomerPortalPasswordResetView.js.map +1 -0
  33. package/dist/elements/public/CustomerPortal/InternalCustomerPortalSubscriptions.js +1 -1
  34. package/dist/elements/public/CustomerPortal/InternalCustomerPortalSubscriptions.js.map +1 -1
  35. package/dist/elements/public/CustomerPortal/index.d.ts +2 -0
  36. package/dist/elements/public/CustomerPortal/index.js +4 -0
  37. package/dist/elements/public/CustomerPortal/index.js.map +1 -1
  38. package/dist/elements/public/EmailTemplateForm/types.d.ts +1 -3
  39. package/dist/elements/public/EmailTemplateForm/types.js.map +1 -1
  40. package/dist/elements/public/StoreForm/types.d.ts +4 -38
  41. package/dist/elements/public/StoreForm/types.js.map +1 -1
  42. package/dist/elements/public/SubscriptionSettingsForm/types.d.ts +1 -3
  43. package/dist/elements/public/SubscriptionSettingsForm/types.js.map +1 -1
  44. package/dist/elements/public/Transaction/Transaction.js +13 -17
  45. package/dist/elements/public/Transaction/Transaction.js.map +1 -1
  46. package/dist/elements/public/UserCard/UserCard.js +0 -2
  47. package/dist/elements/public/UserCard/UserCard.js.map +1 -1
  48. package/dist/elements/public/UserInvitationCard/types.d.ts +3 -1
  49. package/dist/elements/public/UserInvitationCard/types.js +1 -1
  50. package/dist/elements/public/UserInvitationCard/types.js.map +1 -1
  51. package/dist/elements/public/UserInvitationForm/types.d.ts +2 -41
  52. package/dist/elements/public/UserInvitationForm/types.js.map +1 -1
  53. package/package.json +3 -3
  54. package/dist/cdn/shared-0e156ee7.js +0 -1
@@ -1,13 +1,5 @@
1
1
  import type { Resource } from '@foxy.io/sdk/core';
2
2
  import type { Rels } from '@foxy.io/sdk/backend';
3
- declare type OriginalData = Resource<Rels.Cart, {
3
+ export declare type Data = Resource<Rels.Cart, {
4
4
  zoom: ['discounts'];
5
5
  }>;
6
- declare type FixedData = Omit<OriginalData, 'billing_region' | 'shipping_region'> & {
7
- /** Corresponds to the `region` field in `fx:customer_address`. API quirk. */
8
- billing_state: string;
9
- /** Corresponds to the `region` field in `fx:customer_address`. API quirk. */
10
- shipping_state: string;
11
- };
12
- export declare type Data = FixedData;
13
- export {};
@@ -1 +1 @@
1
- {"version":3,"file":"types.js","sourceRoot":"","sources":["../../../../src/elements/public/CartForm/types.ts"],"names":[],"mappings":"","sourcesContent":["import type { Resource } from '@foxy.io/sdk/core';\nimport type { Rels } from '@foxy.io/sdk/backend';\n\n// TODO remove this once SDK is fixed\ntype OriginalData = Resource<Rels.Cart, { zoom: ['discounts'] }>;\ntype FixedData = Omit<OriginalData, 'billing_region' | 'shipping_region'> & {\n /** Corresponds to the `region` field in `fx:customer_address`. API quirk. */\n billing_state: string;\n /** Corresponds to the `region` field in `fx:customer_address`. API quirk. */\n shipping_state: string;\n};\n\nexport type Data = FixedData;\n"]}
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../../../src/elements/public/CartForm/types.ts"],"names":[],"mappings":"","sourcesContent":["import type { Resource } from '@foxy.io/sdk/core';\nimport type { Rels } from '@foxy.io/sdk/backend';\n\nexport type Data = Resource<Rels.Cart, { zoom: ['discounts'] }>;\n"]}
@@ -7,9 +7,12 @@ declare const CustomerPortal_base: typeof CustomerApi & {
7
7
  defaultNS: string;
8
8
  };
9
9
  export declare class CustomerPortal extends CustomerPortal_base {
10
+ #private;
10
11
  static get properties(): PropertyDeclarations;
11
12
  /** Same as `.columns` property on `foxy-transactions-table`. Sets columns of that table. */
12
13
  transactionsTableColumns: TransactionsTable['columns'];
14
+ /** When set to true, portal won't display Password Reset screen if customer logs in with a temporary password. */
15
+ skipPasswordReset: boolean;
13
16
  /**
14
17
  * URL of the Payment Card Embed for updating payment method.
15
18
  * When set, the payment method will be editable. Otherwise, the customers
@@ -27,5 +30,6 @@ export declare class CustomerPortal extends CustomerPortal_base {
27
30
  /** Rumour group. Elements in different groups will not share updates. Empty by default. */
28
31
  group: string;
29
32
  render(): TemplateResult;
33
+ updated(changedProperties: Map<keyof this, unknown>): void;
30
34
  }
31
35
  export {};
@@ -1,9 +1,12 @@
1
+ var _temporaryPassword;
2
+ import { __classPrivateFieldGet, __classPrivateFieldSet } from "tslib";
1
3
  import { html } from 'lit-element';
2
4
  import { API } from '@foxy.io/sdk/customer';
3
5
  import { CustomerApi } from "../CustomerApi/CustomerApi.js";
4
6
  import { ThemeableMixin } from "../../../mixins/themeable.js";
5
7
  import { TranslatableMixin } from "../../../mixins/translatable.js";
6
8
  import { TransactionsTable } from "../TransactionsTable/TransactionsTable.js";
9
+ import { UpdateEvent } from "../NucleonElement/UpdateEvent.js";
7
10
  import { ifDefined } from 'lit-html/directives/if-defined';
8
11
  export class CustomerPortal extends TranslatableMixin(ThemeableMixin(CustomerApi), 'customer-portal') {
9
12
  constructor() {
@@ -17,6 +20,9 @@ export class CustomerPortal extends TranslatableMixin(ThemeableMixin(CustomerApi
17
20
  TransactionsTable.dateColumn,
18
21
  TransactionsTable.receiptColumn,
19
22
  ];
23
+ _temporaryPassword.set(this, null);
24
+ /** When set to true, portal won't display Password Reset screen if customer logs in with a temporary password. */
25
+ this.skipPasswordReset = false;
20
26
  /**
21
27
  * URL of the Payment Card Embed for updating payment method.
22
28
  * When set, the payment method will be editable. Otherwise, the customers
@@ -38,39 +44,68 @@ export class CustomerPortal extends TranslatableMixin(ThemeableMixin(CustomerApi
38
44
  return {
39
45
  ...super.properties,
40
46
  transactionsTableColumns: { attribute: false },
47
+ skipPasswordReset: { type: Boolean, attribute: 'skip-password-reset' },
41
48
  embedUrl: { attribute: 'embed-url' },
42
49
  group: { type: String },
43
50
  };
44
51
  }
45
52
  render() {
46
- var _a;
53
+ var _a, _b;
47
54
  let settingsHref;
48
55
  try {
49
56
  settingsHref = new URL('./customer_portal_settings', this.base);
50
57
  }
51
- catch (_b) {
58
+ catch (_c) {
52
59
  settingsHref = undefined;
53
60
  }
54
61
  return this.api.storage.getItem(API.SESSION)
55
- ? html `
56
- <foxy-internal-customer-portal-logged-in-view
57
- embed-url=${ifDefined((_a = this.embedUrl) !== null && _a !== void 0 ? _a : void 0)}
58
- customer=${this.base}
59
- class="h-full"
60
- infer=""
61
- href=${ifDefined(settingsHref === null || settingsHref === void 0 ? void 0 : settingsHref.toString())}
62
- .transactionsTableColumns=${this.transactionsTableColumns}
63
- >
64
- </foxy-internal-customer-portal-logged-in-view>
65
- `
62
+ ? !this.skipPasswordReset && this.api.usesTemporaryPassword
63
+ ? html `
64
+ <foxy-internal-customer-portal-password-reset-view
65
+ password-old=${ifDefined((_a = __classPrivateFieldGet(this, _temporaryPassword)) !== null && _a !== void 0 ? _a : void 0)}
66
+ infer="password-reset"
67
+ href=${this.base}
68
+ @update=${(evt) => {
69
+ var _a;
70
+ if (((_a = evt.detail) === null || _a === void 0 ? void 0 : _a.result) === UpdateEvent.UpdateResult.ResourceUpdated) {
71
+ this.api.usesTemporaryPassword = false;
72
+ __classPrivateFieldSet(this, _temporaryPassword, null);
73
+ this.requestUpdate();
74
+ }
75
+ }}
76
+ >
77
+ </foxy-internal-customer-portal-password-reset-view>
78
+ `
79
+ : html `
80
+ <foxy-internal-customer-portal-logged-in-view
81
+ embed-url=${ifDefined((_b = this.embedUrl) !== null && _b !== void 0 ? _b : void 0)}
82
+ customer=${this.base}
83
+ class="h-full"
84
+ infer=""
85
+ href=${ifDefined(settingsHref === null || settingsHref === void 0 ? void 0 : settingsHref.toString())}
86
+ .transactionsTableColumns=${this.transactionsTableColumns}
87
+ >
88
+ </foxy-internal-customer-portal-logged-in-view>
89
+ `
66
90
  : html `
67
91
  <foxy-internal-customer-portal-logged-out-view
68
92
  class="h-full"
69
93
  infer=""
70
94
  href=${ifDefined(settingsHref === null || settingsHref === void 0 ? void 0 : settingsHref.toString())}
95
+ @password=${(evt) => {
96
+ __classPrivateFieldSet(this, _temporaryPassword, evt.detail);
97
+ }}
71
98
  >
72
99
  </foxy-internal-customer-portal-logged-out-view>
73
100
  `;
74
101
  }
102
+ updated(changedProperties) {
103
+ super.updated(changedProperties);
104
+ const isLoggedIn = this.api.storage.getItem(API.SESSION) !== null;
105
+ if (isLoggedIn && (this.skipPasswordReset || !this.api.usesTemporaryPassword)) {
106
+ __classPrivateFieldSet(this, _temporaryPassword, null);
107
+ }
108
+ }
75
109
  }
110
+ _temporaryPassword = new WeakMap();
76
111
  //# sourceMappingURL=CustomerPortal.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"CustomerPortal.js","sourceRoot":"","sources":["../../../../src/elements/public/CustomerPortal/CustomerPortal.ts"],"names":[],"mappings":"AAAA,OAAO,EAAwC,IAAI,EAAE,MAAM,aAAa,CAAC;AAEzE,OAAO,EAAE,GAAG,EAAE,MAAM,uBAAuB,CAAC;AAC5C,OAAO,EAAE,WAAW,EAAE,sCAAmC;AACzD,OAAO,EAAE,cAAc,EAAE,qCAAkC;AAC3D,OAAO,EAAE,iBAAiB,EAAE,wCAAqC;AACjE,OAAO,EAAE,iBAAiB,EAAE,kDAA+C;AAC3E,OAAO,EAAE,SAAS,EAAE,MAAM,gCAAgC,CAAC;AAE3D,MAAM,OAAO,cAAe,SAAQ,iBAAiB,CACnD,cAAc,CAAC,WAAW,CAAC,EAC3B,iBAAiB,CAClB;IAHD;;QAaE,4FAA4F;QAC5F,6BAAwB,GAAiC;YACvD,iBAAiB,CAAC,WAAW;YAC7B,iBAAiB,CAAC,aAAa;YAC/B,iBAAiB,CAAC,YAAY;YAC9B,iBAAiB,CAAC,QAAQ;YAC1B,iBAAiB,CAAC,UAAU;YAC5B,iBAAiB,CAAC,aAAa;SAChC,CAAC;QAEF;;;;;;;;;;;;WAYG;QACH,aAAQ,GAAkB,IAAI,CAAC;QAE/B,2FAA2F;QAC3F,UAAK,GAAG,EAAE,CAAC;IAgCb,CAAC;IAnEC,MAAM,KAAK,UAAU;QACnB,OAAO;YACL,GAAG,KAAK,CAAC,UAAU;YACnB,wBAAwB,EAAE,EAAE,SAAS,EAAE,KAAK,EAAE;YAC9C,QAAQ,EAAE,EAAE,SAAS,EAAE,WAAW,EAAE;YACpC,KAAK,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE;SACxB,CAAC;IACJ,CAAC;IA8BD,MAAM;;QACJ,IAAI,YAA6B,CAAC;QAElC,IAAI;YACF,YAAY,GAAG,IAAI,GAAG,CAAC,4BAA4B,EAAE,IAAI,CAAC,IAAI,CAAC,CAAC;SACjE;QAAC,WAAM;YACN,YAAY,GAAG,SAAS,CAAC;SAC1B;QAED,OAAO,IAAI,CAAC,GAAG,CAAC,OAAO,CAAC,OAAO,CAAC,GAAG,CAAC,OAAO,CAAC;YAC1C,CAAC,CAAC,IAAI,CAAA;;wBAEY,SAAS,OAAC,IAAI,CAAC,QAAQ,mCAAI,KAAK,CAAC,CAAC;uBACnC,IAAI,CAAC,IAAI;;;mBAGb,SAAS,CAAC,YAAY,aAAZ,YAAY,uBAAZ,YAAY,CAAE,QAAQ,GAAG;wCACd,IAAI,CAAC,wBAAwB;;;SAG5D;YACH,CAAC,CAAC,IAAI,CAAA;;;;mBAIO,SAAS,CAAC,YAAY,aAAZ,YAAY,uBAAZ,YAAY,CAAE,QAAQ,GAAG;;;SAG7C,CAAC;IACR,CAAC;CACF","sourcesContent":["import { PropertyDeclarations, TemplateResult, html } from 'lit-element';\n\nimport { API } from '@foxy.io/sdk/customer';\nimport { CustomerApi } from '../CustomerApi/CustomerApi';\nimport { ThemeableMixin } from '../../../mixins/themeable';\nimport { TranslatableMixin } from '../../../mixins/translatable';\nimport { TransactionsTable } from '../TransactionsTable/TransactionsTable';\nimport { ifDefined } from 'lit-html/directives/if-defined';\n\nexport class CustomerPortal extends TranslatableMixin(\n ThemeableMixin(CustomerApi),\n 'customer-portal'\n) {\n static get properties(): PropertyDeclarations {\n return {\n ...super.properties,\n transactionsTableColumns: { attribute: false },\n embedUrl: { attribute: 'embed-url' },\n group: { type: String },\n };\n }\n\n /** Same as `.columns` property on `foxy-transactions-table`. Sets columns of that table. */\n transactionsTableColumns: TransactionsTable['columns'] = [\n TransactionsTable.priceColumn,\n TransactionsTable.summaryColumn,\n TransactionsTable.statusColumn,\n TransactionsTable.idColumn,\n TransactionsTable.dateColumn,\n TransactionsTable.receiptColumn,\n ];\n\n /**\n * URL of the Payment Card Embed for updating payment method.\n * When set, the payment method will be editable. Otherwise, the customers\n * will only be able to view and delete it.\n *\n * ```html\n * <foxy-customer-portal\n * embed-url=\"https://embed.foxy.io/v1.html?template_set_id=123\"\n * base=\"https://demo.foxycart.com/s/customer/\"\n * >\n * </foxy-customer-portal>\n * ```\n */\n embedUrl: string | null = null;\n\n /** Rumour group. Elements in different groups will not share updates. Empty by default. */\n group = '';\n\n render(): TemplateResult {\n let settingsHref: URL | undefined;\n\n try {\n settingsHref = new URL('./customer_portal_settings', this.base);\n } catch {\n settingsHref = undefined;\n }\n\n return this.api.storage.getItem(API.SESSION)\n ? html`\n <foxy-internal-customer-portal-logged-in-view\n embed-url=${ifDefined(this.embedUrl ?? void 0)}\n customer=${this.base}\n class=\"h-full\"\n infer=\"\"\n href=${ifDefined(settingsHref?.toString())}\n .transactionsTableColumns=${this.transactionsTableColumns}\n >\n </foxy-internal-customer-portal-logged-in-view>\n `\n : html`\n <foxy-internal-customer-portal-logged-out-view\n class=\"h-full\"\n infer=\"\"\n href=${ifDefined(settingsHref?.toString())}\n >\n </foxy-internal-customer-portal-logged-out-view>\n `;\n }\n}\n"]}
1
+ {"version":3,"file":"CustomerPortal.js","sourceRoot":"","sources":["../../../../src/elements/public/CustomerPortal/CustomerPortal.ts"],"names":[],"mappings":";;AAAA,OAAO,EAAwC,IAAI,EAAE,MAAM,aAAa,CAAC;AAEzE,OAAO,EAAE,GAAG,EAAE,MAAM,uBAAuB,CAAC;AAC5C,OAAO,EAAE,WAAW,EAAE,sCAAmC;AACzD,OAAO,EAAE,cAAc,EAAE,qCAAkC;AAC3D,OAAO,EAAE,iBAAiB,EAAE,wCAAqC;AACjE,OAAO,EAA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sBAAsB,IAAI,EAAC;SAChC;IACH,CAAC;CACF","sourcesContent":["import { PropertyDeclarations, TemplateResult, html } from 'lit-element';\n\nimport { API } from '@foxy.io/sdk/customer';\nimport { CustomerApi } from '../CustomerApi/CustomerApi';\nimport { ThemeableMixin } from '../../../mixins/themeable';\nimport { TranslatableMixin } from '../../../mixins/translatable';\nimport { TransactionsTable } from '../TransactionsTable/TransactionsTable';\nimport { UpdateEvent } from '../NucleonElement/UpdateEvent';\nimport { ifDefined } from 'lit-html/directives/if-defined';\n\nexport class CustomerPortal extends TranslatableMixin(\n ThemeableMixin(CustomerApi),\n 'customer-portal'\n) {\n static get properties(): PropertyDeclarations {\n return {\n ...super.properties,\n transactionsTableColumns: { attribute: false },\n skipPasswordReset: { type: Boolean, attribute: 'skip-password-reset' },\n embedUrl: { attribute: 'embed-url' },\n group: { type: String },\n };\n }\n\n /** Same as `.columns` property on `foxy-transactions-table`. Sets columns of that table. */\n transactionsTableColumns: TransactionsTable['columns'] = [\n TransactionsTable.priceColumn,\n TransactionsTable.summaryColumn,\n TransactionsTable.statusColumn,\n TransactionsTable.idColumn,\n TransactionsTable.dateColumn,\n TransactionsTable.receiptColumn,\n ];\n\n #temporaryPassword: string | null = null;\n\n /** When set to true, portal won't display Password Reset screen if customer logs in with a temporary password. */\n skipPasswordReset = false;\n\n /**\n * URL of the Payment Card Embed for updating payment method.\n * When set, the payment method will be editable. Otherwise, the customers\n * will only be able to view and delete it.\n *\n * ```html\n * <foxy-customer-portal\n * embed-url=\"https://embed.foxy.io/v1.html?template_set_id=123\"\n * base=\"https://demo.foxycart.com/s/customer/\"\n * >\n * </foxy-customer-portal>\n * ```\n */\n embedUrl: string | null = null;\n\n /** Rumour group. Elements in different groups will not share updates. Empty by default. */\n group = '';\n\n render(): TemplateResult {\n let settingsHref: URL | undefined;\n\n try {\n settingsHref = new URL('./customer_portal_settings', this.base);\n } catch {\n settingsHref = undefined;\n }\n\n return this.api.storage.getItem(API.SESSION)\n ? !this.skipPasswordReset && this.api.usesTemporaryPassword\n ? html`\n <foxy-internal-customer-portal-password-reset-view\n password-old=${ifDefined(this.#temporaryPassword ?? void 0)}\n infer=\"password-reset\"\n href=${this.base}\n @update=${(evt: UpdateEvent) => {\n if (evt.detail?.result === UpdateEvent.UpdateResult.ResourceUpdated) {\n this.api.usesTemporaryPassword = false;\n this.#temporaryPassword = null;\n this.requestUpdate();\n }\n }}\n >\n </foxy-internal-customer-portal-password-reset-view>\n `\n : html`\n <foxy-internal-customer-portal-logged-in-view\n embed-url=${ifDefined(this.embedUrl ?? void 0)}\n customer=${this.base}\n class=\"h-full\"\n infer=\"\"\n href=${ifDefined(settingsHref?.toString())}\n .transactionsTableColumns=${this.transactionsTableColumns}\n >\n </foxy-internal-customer-portal-logged-in-view>\n `\n : html`\n <foxy-internal-customer-portal-logged-out-view\n class=\"h-full\"\n infer=\"\"\n href=${ifDefined(settingsHref?.toString())}\n @password=${(evt: CustomEvent<string | null>) => {\n this.#temporaryPassword = evt.detail;\n }}\n >\n </foxy-internal-customer-portal-logged-out-view>\n `;\n }\n\n updated(changedProperties: Map<keyof this, unknown>): void {\n super.updated(changedProperties);\n const isLoggedIn = this.api.storage.getItem(API.SESSION) !== null;\n if (isLoggedIn && (this.skipPasswordReset || !this.api.usesTemporaryPassword)) {\n this.#temporaryPassword = null;\n }\n }\n}\n"]}
@@ -210,7 +210,13 @@ export class InternalCustomerPortalLoggedOutView extends Base {
210
210
  id="sign-in-form"
211
211
  ns="${this.ns} ${(_b = (_a = customElements.get('foxy-sign-in-form')) === null || _a === void 0 ? void 0 : _a.defaultNS) !== null && _b !== void 0 ? _b : ''}"
212
212
  .templates=${this.getNestedTemplates('sign-in:form')}
213
- @update=${() => this.requestUpdate()}
213
+ @update=${(evt) => {
214
+ var _a, _b;
215
+ const target = evt.currentTarget;
216
+ const password = (_b = (_a = target.form.credential) === null || _a === void 0 ? void 0 : _a.password) !== null && _b !== void 0 ? _b : null;
217
+ this.dispatchEvent(new CustomEvent('password', { detail: password }));
218
+ this.requestUpdate();
219
+ }}
214
220
  >
215
221
  </foxy-sign-in-form>
216
222
 
@@ -1 +1 @@
1
- {"version":3,"file":"InternalCustomerPortalLoggedOutView.js","sourceRoot":"","sources":["../../../../src/elements/public/CustomerPortal/InternalCustomerPortalLoggedOutView.ts"],"names":[],"mappings":"AAOA,OAAO,EAAE,iBAAiB,EAAE,wCAAqC;AACjE,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACpD,OAAO,EAAE,YAAY,EAAE,oDAAiD;AACxE,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,MAAM,aAAa,CAAC;AAGxC,MAAM,IAAI,GAAG,iBAAiB,CAAC,YAAY,CAAC,CAAC;AAE7C,MAAM,OAAO,mCAAoC,SAAQ,IAAU;IAAnE;;QAoBE,SAAI,GAA8C,SAAS,CAAC;QAE3C,iCAA4B,GAAG,GAAG,EAAE;;YACnD,MAAM,EAAE,IAAI,EAAE,EAAE,EAAE,GAAG,IAAI,CAAC;YAC1B,MAAM,MAAM,GAAG,uBAAuB,CAAC;YACvC,MAAM,IAAI,GAAG,IAAI,CAAC,UAAU,CAAC,aAAa,CAAC,MAAM,CAA8B,CAAC;YAChF,MAAM,MAAM,GAAG,CAAC,EAAC,IAAI,aAAJ,IAAI,uBAAJ,IAAI,CAAE,EAAE,CAAC,MAAM,EAAC,CAAC;YAElC,OAAO,IAAI,CAAA;;UAEL,IAAI,CAAC,oBAAoB,CAAC,+BAA+B,CAAC;;;wCAG5B,MAAM,CAAC,CAAC,CAAC,eAAe,CAAC,CAAC,CAAC,WAAW;iBAC7D,IAAI;;gBAEL,EAAE,IAAI,YAAA,cAAc,CAAC,GAAG,CAAC,2BAA2B,CAAC,0CAAE,SAAS,mCAAI,EAAE;;;;;0BAK5D,MAAM,CAAC,CAAC,CAAC,eAAe,CAAC,CAAC,CAAC,gBAAgB;iBACpD,IAAI;;gBAEL,EAAE,IAAI,YAAA,cAAc,CAAC,GAAG,CAAC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C,OAAO,CAAC,SAAS,EAAE,IAAI,CAAC,EAAE;YAClE,OAAO,IAAI,CAAC,cAAc,EAAE,CAAC;SAC9B;QAED,OAAO,IAAI,CAAA,EAAE,CAAC;IAChB,CAAC;CACF","sourcesContent":["import type { CSSResultArray, PropertyDeclarations, TemplateResult } from 'lit-element';\nimport type { AccessRecoveryForm } from '../AccessRecoveryForm/AccessRecoveryForm';\nimport type { CustomerForm } from '../CustomerForm/CustomerForm';\nimport type { SignInForm } from '../SignInForm/SignInForm';\nimport type { Resource } from '@foxy.io/sdk/core';\nimport type { Rels } from '@foxy.io/sdk/customer';\n\nimport { TranslatableMixin } from '../../../mixins/translatable';\nimport { BooleanSelector } from '@foxy.io/sdk/core';\nimport { InternalForm } from '../../internal/InternalForm/InternalForm';\nimport { css, html } from 'lit-element';\n\ntype Data = Resource<Rels.CustomerPortalSettings>;\nconst Base = TranslatableMixin(InternalForm);\n\nexport class InternalCustomerPortalLoggedOutView extends Base<Data> {\n static get properties(): PropertyDeclarations {\n return {\n ...super.properties,\n group: { type: String },\n page: { type: String },\n };\n }\n\n static get styles(): CSSResultArray {\n return [\n super.styles,\n css`\n .max-w-25rem {\n max-width: 25rem;\n }\n `,\n ];\n }\n\n page: 'sign-up' | 'sign-in' | 'access-recovery' = 'sign-in';\n\n private readonly __renderAccessRecoveryHeader = () => {\n const { lang, ns } = this;\n const formId = '#access-recovery-form';\n const form = this.renderRoot.querySelector(formId) as AccessRecoveryForm | null;\n const isBusy = !!form?.in('busy');\n\n return html`\n <div class=\"flex flex-col leading-s font-lumo\" data-testid=\"access-recovery:header\">\n ${this.renderTemplateOrSlot('access-recovery:header:before')}\n\n <foxy-i18n\n class=\"text-xxl font-medium ${isBusy ? 'text-disabled' : 'text-body'}\"\n lang=${lang}\n key=\"recover_access\"\n ns=\"${ns} ${customElements.get('foxy-access-recovery-form')?.defaultNS ?? ''}\"\n >\n </foxy-i18n>\n\n <foxy-i18n\n class=\"text-l ${isBusy ? 'text-disabled' : 'text-secondary'}\"\n lang=${lang}\n key=\"recover_access_hint\"\n ns=\"${ns} ${customElements.get('foxy-access-recovery-form')?.defaultNS ?? ''}\"\n >\n </foxy-i18n>\n\n ${this.renderTemplateOrSlot('access-recovery:header:after')}\n </div>\n `;\n };\n\n private readonly __renderAccessRecoveryBack = () => {\n const formId = '#access-recovery-form';\n const form = this.renderRoot.querySelector(formId) as AccessRecoveryForm | null;\n const disabledSelector = this.disabledSelector.zoom('access-recovery');\n\n return html`\n <div>\n ${this.renderTemplateOrSlot('access-recovery:back:before')}\n\n <vaadin-button\n data-testid=\"access-recovery:back\"\n class=\"w-full\"\n theme=\"tertiary\"\n ?disabled=${!!form?.in('busy') || disabledSelector.matches('back', true)}\n @click=${() => (this.page = 'sign-in')}\n >\n <foxy-i18n\n lang=${this.lang}\n key=\"back\"\n ns=\"${this.ns} ${customElements.get('foxy-access-recovery-form')?.defaultNS ?? ''}\"\n >\n </foxy-i18n>\n </vaadin-button>\n\n ${this.renderTemplateOrSlot('access-recovery:back:after')}\n </div>\n `;\n };\n\n private readonly __renderAccessRecoveryForm = () => {\n const scope = 'access-recovery:form';\n const hiddenSelector = this.hiddenSelector.zoom(scope);\n\n return html`\n <div>\n ${this.renderTemplateOrSlot(`${scope}:before`)}\n\n <foxy-access-recovery-form\n readonlycontrols=${this.readonlySelector.zoom(scope).toString()}\n disabledcontrols=${this.disabledSelector.zoom(scope).toString()}\n hiddencontrols=${hiddenSelector.toString()}\n data-testid=\"access-recovery:form\"\n parent=\"foxy://customer-api/recover\"\n group=${this.group}\n lang=${this.lang}\n ns=\"${this.ns} ${customElements.get('foxy-access-recovery-form')?.defaultNS ?? ''}\"\n id=\"access-recovery-form\"\n .templates=${this.getNestedTemplates(scope)}\n @update=${() => this.requestUpdate()}\n >\n </foxy-access-recovery-form>\n\n ${this.renderTemplateOrSlot(`${scope}:after`)}\n </div>\n `;\n };\n\n private readonly __renderAccessRecovery = () => {\n const scope = 'access-recovery';\n const hiddenSelector = this.hiddenSelector.zoom(scope);\n\n return html`\n <div class=\"h-full flex\" data-testid=\"access-recovery\">\n <div class=\"m-auto max-w-25rem flex-1\">\n ${this.renderTemplateOrSlot(`${scope}:before`)}\n\n <div class=\"space-y-m\">\n ${hiddenSelector.matches('header', true) ? '' : this.__renderAccessRecoveryHeader()}\n <div class=\"space-y-s\">\n ${hiddenSelector.matches('form', true) ? '' : this.__renderAccessRecoveryForm()}\n ${hiddenSelector.matches('back', true) ? '' : this.__renderAccessRecoveryBack()}\n </div>\n </div>\n\n ${this.renderTemplateOrSlot(`${scope}:after`)}\n </div>\n </div>\n `;\n };\n\n private readonly __renderSignInHeader = () => {\n const { lang, ns } = this;\n const formId = '#sign-in-form';\n const form = this.renderRoot.querySelector(formId) as SignInForm | null;\n const isBusy = !!form?.in('busy');\n\n return html`\n <div class=\"flex flex-col leading-s font-lumo\" data-testid=\"sign-in:header\">\n ${this.renderTemplateOrSlot('sign-in:header:before')}\n\n <foxy-i18n\n class=\"text-xxl font-medium ${isBusy ? 'text-disabled' : 'text-body'}\"\n lang=${lang}\n key=\"sign_in\"\n ns=\"${ns} ${customElements.get('foxy-sign-in-form')?.defaultNS ?? ''}\"\n >\n </foxy-i18n>\n\n <foxy-i18n\n class=\"text-l ${isBusy ? 'text-disabled' : 'text-secondary'}\"\n lang=${lang}\n key=\"sign_in_hint\"\n ns=\"${ns} ${customElements.get('foxy-sign-in-form')?.defaultNS ?? ''}\"\n >\n </foxy-i18n>\n\n ${this.renderTemplateOrSlot('sign-in:header:after')}\n </div>\n `;\n };\n\n private readonly __renderSignInRecover = () => {\n const form = this.renderRoot.querySelector<AccessRecoveryForm>('#sign-in-form');\n const disabledSelector = this.disabledSelector.zoom('sign-in');\n\n return html`\n <div>\n ${this.renderTemplateOrSlot('sign-in:recover:before')}\n\n <vaadin-button\n data-testid=\"sign-in:recover\"\n class=\"w-full\"\n theme=\"tertiary\"\n ?disabled=${!!form?.in('busy') || disabledSelector.matches('recover', true)}\n @click=${() => (this.page = 'access-recovery')}\n >\n <foxy-i18n\n lang=${this.lang}\n key=\"recover_access\"\n ns=\"${this.ns} ${customElements.get('foxy-sign-in-form')?.defaultNS ?? ''}\"\n >\n </foxy-i18n>\n </vaadin-button>\n\n ${this.renderTemplateOrSlot('sign-in:recover:after')}\n </div>\n `;\n };\n\n private readonly __renderSignInSignUp = () => {\n const form = this.renderRoot.querySelector<AccessRecoveryForm>('#sign-in-form');\n const disabledSelector = this.disabledSelector.zoom('sign-in');\n\n return html`\n <div>\n ${this.renderTemplateOrSlot('sign-in:signup:before')}\n\n <vaadin-button\n data-testid=\"sign-in:signup\"\n class=\"w-full\"\n theme=\"tertiary\"\n ?disabled=${!!form?.in('busy') || disabledSelector.matches('signup', true)}\n @click=${() => (this.page = 'sign-up')}\n >\n <foxy-i18n lang=${this.lang} key=\"sign_up\" ns=\"${this.ns} sign-in-form\"> </foxy-i18n>\n </vaadin-button>\n\n ${this.renderTemplateOrSlot('sign-in:signup:after')}\n </div>\n `;\n };\n\n private readonly __renderSignInForm = () => {\n const scope = 'sign-in:form';\n const hiddenSelector = this.hiddenSelector.zoom(scope);\n\n return html`\n <div>\n ${this.renderTemplateOrSlot(`${scope}:before`)}\n\n <foxy-sign-in-form\n readonlycontrols=${this.readonlySelector.zoom(scope).toString()}\n disabledcontrols=${this.disabledSelector.zoom(scope).toString()}\n hiddencontrols=${hiddenSelector.toString()}\n data-testid=\"sign-in:form\"\n parent=\"foxy://customer-api/session\"\n group=${this.group}\n lang=${this.lang}\n id=\"sign-in-form\"\n ns=\"${this.ns} ${customElements.get('foxy-sign-in-form')?.defaultNS ?? ''}\"\n .templates=${this.getNestedTemplates('sign-in:form')}\n @update=${() => this.requestUpdate()}\n >\n </foxy-sign-in-form>\n\n ${this.renderTemplateOrSlot(`${scope}:after`)}\n </div>\n `;\n };\n\n private readonly __renderSignIn = () => {\n const scope = 'sign-in';\n const hiddenSelector = this.hiddenSelector.zoom(scope);\n const isSignUpEnabled = this.data?.sign_up?.enabled === true;\n const isSignUpButtonHidden = hiddenSelector.matches('signup', true) || !isSignUpEnabled;\n\n return html`\n <div class=\"h-full flex\" data-testid=\"sign-in\">\n <div class=\"m-auto max-w-25rem flex-1\">\n ${this.renderTemplateOrSlot(`${scope}:before`)}\n\n <div class=\"space-y-m\">\n ${hiddenSelector.matches('header', true) ? '' : this.__renderSignInHeader()}\n <div class=\"space-y-s\">\n ${hiddenSelector.matches('form', true) ? '' : this.__renderSignInForm()}\n <div class=\"flex justify-center gap-s\">\n ${isSignUpButtonHidden ? '' : this.__renderSignInSignUp()}\n ${hiddenSelector.matches('recover', true) ? '' : this.__renderSignInRecover()}\n </div>\n </div>\n </div>\n\n ${this.renderTemplateOrSlot(`${scope}:after`)}\n </div>\n </div>\n `;\n };\n\n private readonly __renderSignUpHeader = () => {\n const { lang, ns } = this;\n const formId = '#sign-up-form';\n const form = this.renderRoot.querySelector(formId) as CustomerForm | null;\n const isBusy = !!form?.in('busy');\n\n return html`\n <div class=\"flex flex-col leading-s font-lumo\" data-testid=\"sign-up:header\">\n ${this.renderTemplateOrSlot('sign-up:header:before')}\n\n <foxy-i18n\n class=\"text-xxl font-medium ${isBusy ? 'text-disabled' : 'text-body'}\"\n lang=${lang}\n key=\"sign_up\"\n ns=\"${ns} sign-up-form\"\n >\n </foxy-i18n>\n\n <foxy-i18n\n class=\"text-l ${isBusy ? 'text-disabled' : 'text-secondary'}\"\n lang=${lang}\n key=\"sign_up_hint\"\n ns=\"${ns} sign-up-form\"\n >\n </foxy-i18n>\n\n ${this.renderTemplateOrSlot('sign-up:header:after')}\n </div>\n `;\n };\n\n private readonly __renderSignUpGoBack = () => {\n const form = this.renderRoot.querySelector<CustomerForm>('#sign-up-form');\n const disabledSelector = this.disabledSelector.zoom('sign-up');\n\n return html`\n <div>\n ${this.renderTemplateOrSlot('sign-up:go-back:before')}\n\n <vaadin-button\n data-testid=\"sign-up:go-back\"\n class=\"w-full\"\n theme=\"tertiary-inline\"\n ?disabled=${!!form?.in('busy') || disabledSelector.matches('go-back', true)}\n @click=${() => (this.page = 'sign-in')}\n >\n <foxy-i18n lang=${this.lang} key=\"go_back\" ns=\"${this.ns} sign-up-form\"> </foxy-i18n>\n </vaadin-button>\n\n ${this.renderTemplateOrSlot('sign-up:go-back:after')}\n </div>\n `;\n };\n\n private readonly __renderSignUpForm = () => {\n const scope = 'sign-up:form';\n const hidden = [\n 'header',\n 'tax-id',\n 'is-anonymous',\n 'password-old',\n 'forgot-password',\n 'timestamps',\n 'delete',\n this.hiddenSelector.zoom(scope).toString(),\n ];\n\n return html`\n <div>\n ${this.renderTemplateOrSlot(`${scope}:before`)}\n\n <foxy-customer-form\n readonlycontrols=${this.readonlySelector.zoom(scope).toString()}\n disabledcontrols=${this.disabledSelector.zoom(scope).toString()}\n hiddencontrols=${new BooleanSelector(hidden.join(' ').trim())}\n data-testid=\"sign-up:form\"\n parent=\"foxy://customer-api/signup\"\n group=${this.group}\n lang=${this.lang}\n id=\"sign-up-form\"\n ns=\"${this.ns} sign-up-form\"\n .templates=${this.getNestedTemplates('sign-up:form')}\n .settings=${this.data}\n @update=${() => this.requestUpdate()}\n >\n </foxy-customer-form>\n\n ${this.renderTemplateOrSlot(`${scope}:after`)}\n </div>\n `;\n };\n\n private readonly __renderSignUp = () => {\n const scope = 'sign-up';\n const hiddenSelector = this.hiddenSelector.zoom(scope);\n\n return html`\n <div class=\"h-full flex\" data-testid=\"sign-up\">\n <div class=\"m-auto max-w-25rem flex-1\">\n ${this.renderTemplateOrSlot(`${scope}:before`)}\n\n <div class=\"space-y-m\">\n ${hiddenSelector.matches('header', true) ? '' : this.__renderSignUpHeader()}\n ${hiddenSelector.matches('form', true) ? '' : this.__renderSignUpForm()}\n ${hiddenSelector.matches('go-back', true) ? '' : this.__renderSignUpGoBack()}\n </div>\n\n ${this.renderTemplateOrSlot(`${scope}:after`)}\n </div>\n </div>\n `;\n };\n\n renderBody(): TemplateResult {\n const { page, hiddenSelector } = this;\n\n if (page === 'access-recovery' && !hiddenSelector.matches('access-recovery', true)) {\n return this.__renderAccessRecovery();\n }\n\n if (page === 'sign-in' && !hiddenSelector.matches('sign-in', true)) {\n return this.__renderSignIn();\n }\n\n if (page === 'sign-up' && !hiddenSelector.matches('sign-up', true)) {\n return this.__renderSignUp();\n }\n\n return html``;\n }\n}\n"]}
1
+ {"version":3,"file":"InternalCustomerPortalLoggedOutView.js","sourceRoot":"","sources":["../../../../src/elements/public/CustomerPortal/InternalCustomerPortalLoggedOutView.ts"],"names":[],"mappings":"AAOA,OAAO,EAAE,iBAAiB,EAAE,wCAAqC;AACjE,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACpD,OAAO,EAAE,YAAY,EAAE,oDAAiD;AACxE,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,MAAM,aAAa,CAAC;AAGxC,MAAM,IAAI,GAAG,iBAAiB,CAAC,YAAY,CAAC,CAAC;AAE7C,MAAM,OAAO,mCAAoC,SAAQ,IAAU;IAAnE;;QAoBE,SAAI,GAA8C,SAAS,CAAC;QAE3C,iCAA4B,GAAG,GAAG,EAAE;;YACnD,MAAM,EAAE,IAAI,EAAE,EAAE,EAAE,GAAG,IAAI,CAAC;YAC1B,MAAM,MAAM,GAAG,uBAAuB,CAAC;YACvC,MAAM,IAAI,GAAG,IAAI,CAAC,UAAU,CAAC,aAAa,CAAC,MAAM,CAA8B,CAAC;YAChF,MAAM,MAAM,GAAG,CAAC,EAAC,IAAI,aAAJ,IAAI,uBAAJ,IAAI,CAAE,EAAE,CAAC,MAAM,EAAC,CAAC;YAElC,OAAO,IAAI,CAAA;;UAEL,IAAI,CAAC,oBAAoB,CAAC,+BAA+B,CAAC;;;wCAG5B,MAAM,CAAC,CAAC,CAAC,eAAe,CAAC,CAAC,CAAC,WAAW;iBAC7D,IAAI;;gBAEL,EAAE,IAAI,YAAA,cAAc,CAAC,GAAG,CAAC,2BAA2B,CAAC,0CAAE,SAAS,mCAAI,EAAE;;;;;0BAK5D,MAAM,CAAC,CAA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AAI,EAAE,cAAc,EAAE,GAAG,IAAI,CAAC;QAEtC,IAAI,IAAI,KAAK,iBAAiB,IAAI,CAAC,cAAc,CAAC,OAAO,CAAC,iBAAiB,EAAE,IAAI,CAAC,EAAE;YAClF,OAAO,IAAI,CAAC,sBAAsB,EAAE,CAAC;SACtC;QAED,IAAI,IAAI,KAAK,SAAS,IAAI,CAAC,cAAc,CAAC,OAAO,CAAC,SAAS,EAAE,IAAI,CAAC,EAAE;YAClE,OAAO,IAAI,CAAC,cAAc,EAAE,CAAC;SAC9B;QAED,IAAI,IAAI,KAAK,SAAS,IAAI,CAAC,cAAc,CAAC,OAAO,CAAC,SAAS,EAAE,IAAI,CAAC,EAAE;YAClE,OAAO,IAAI,CAAC,cAAc,EAAE,CAAC;SAC9B;QAED,OAAO,IAAI,CAAA,EAAE,CAAC;IAChB,CAAC;CACF","sourcesContent":["import type { CSSResultArray, PropertyDeclarations, TemplateResult } from 'lit-element';\nimport type { AccessRecoveryForm } from '../AccessRecoveryForm/AccessRecoveryForm';\nimport type { CustomerForm } from '../CustomerForm/CustomerForm';\nimport type { SignInForm } from '../SignInForm/SignInForm';\nimport type { Resource } from '@foxy.io/sdk/core';\nimport type { Rels } from '@foxy.io/sdk/customer';\n\nimport { TranslatableMixin } from '../../../mixins/translatable';\nimport { BooleanSelector } from '@foxy.io/sdk/core';\nimport { InternalForm } from '../../internal/InternalForm/InternalForm';\nimport { css, html } from 'lit-element';\n\ntype Data = Resource<Rels.CustomerPortalSettings>;\nconst Base = TranslatableMixin(InternalForm);\n\nexport class InternalCustomerPortalLoggedOutView extends Base<Data> {\n static get properties(): PropertyDeclarations {\n return {\n ...super.properties,\n group: { type: String },\n page: { type: String },\n };\n }\n\n static get styles(): CSSResultArray {\n return [\n super.styles,\n css`\n .max-w-25rem {\n max-width: 25rem;\n }\n `,\n ];\n }\n\n page: 'sign-up' | 'sign-in' | 'access-recovery' = 'sign-in';\n\n private readonly __renderAccessRecoveryHeader = () => {\n const { lang, ns } = this;\n const formId = '#access-recovery-form';\n const form = this.renderRoot.querySelector(formId) as AccessRecoveryForm | null;\n const isBusy = !!form?.in('busy');\n\n return html`\n <div class=\"flex flex-col leading-s font-lumo\" data-testid=\"access-recovery:header\">\n ${this.renderTemplateOrSlot('access-recovery:header:before')}\n\n <foxy-i18n\n class=\"text-xxl font-medium ${isBusy ? 'text-disabled' : 'text-body'}\"\n lang=${lang}\n key=\"recover_access\"\n ns=\"${ns} ${customElements.get('foxy-access-recovery-form')?.defaultNS ?? ''}\"\n >\n </foxy-i18n>\n\n <foxy-i18n\n class=\"text-l ${isBusy ? 'text-disabled' : 'text-secondary'}\"\n lang=${lang}\n key=\"recover_access_hint\"\n ns=\"${ns} ${customElements.get('foxy-access-recovery-form')?.defaultNS ?? ''}\"\n >\n </foxy-i18n>\n\n ${this.renderTemplateOrSlot('access-recovery:header:after')}\n </div>\n `;\n };\n\n private readonly __renderAccessRecoveryBack = () => {\n const formId = '#access-recovery-form';\n const form = this.renderRoot.querySelector(formId) as AccessRecoveryForm | null;\n const disabledSelector = this.disabledSelector.zoom('access-recovery');\n\n return html`\n <div>\n ${this.renderTemplateOrSlot('access-recovery:back:before')}\n\n <vaadin-button\n data-testid=\"access-recovery:back\"\n class=\"w-full\"\n theme=\"tertiary\"\n ?disabled=${!!form?.in('busy') || disabledSelector.matches('back', true)}\n @click=${() => (this.page = 'sign-in')}\n >\n <foxy-i18n\n lang=${this.lang}\n key=\"back\"\n ns=\"${this.ns} ${customElements.get('foxy-access-recovery-form')?.defaultNS ?? ''}\"\n >\n </foxy-i18n>\n </vaadin-button>\n\n ${this.renderTemplateOrSlot('access-recovery:back:after')}\n </div>\n `;\n };\n\n private readonly __renderAccessRecoveryForm = () => {\n const scope = 'access-recovery:form';\n const hiddenSelector = this.hiddenSelector.zoom(scope);\n\n return html`\n <div>\n ${this.renderTemplateOrSlot(`${scope}:before`)}\n\n <foxy-access-recovery-form\n readonlycontrols=${this.readonlySelector.zoom(scope).toString()}\n disabledcontrols=${this.disabledSelector.zoom(scope).toString()}\n hiddencontrols=${hiddenSelector.toString()}\n data-testid=\"access-recovery:form\"\n parent=\"foxy://customer-api/recover\"\n group=${this.group}\n lang=${this.lang}\n ns=\"${this.ns} ${customElements.get('foxy-access-recovery-form')?.defaultNS ?? ''}\"\n id=\"access-recovery-form\"\n .templates=${this.getNestedTemplates(scope)}\n @update=${() => this.requestUpdate()}\n >\n </foxy-access-recovery-form>\n\n ${this.renderTemplateOrSlot(`${scope}:after`)}\n </div>\n `;\n };\n\n private readonly __renderAccessRecovery = () => {\n const scope = 'access-recovery';\n const hiddenSelector = this.hiddenSelector.zoom(scope);\n\n return html`\n <div class=\"h-full flex\" data-testid=\"access-recovery\">\n <div class=\"m-auto max-w-25rem flex-1\">\n ${this.renderTemplateOrSlot(`${scope}:before`)}\n\n <div class=\"space-y-m\">\n ${hiddenSelector.matches('header', true) ? '' : this.__renderAccessRecoveryHeader()}\n <div class=\"space-y-s\">\n ${hiddenSelector.matches('form', true) ? '' : this.__renderAccessRecoveryForm()}\n ${hiddenSelector.matches('back', true) ? '' : this.__renderAccessRecoveryBack()}\n </div>\n </div>\n\n ${this.renderTemplateOrSlot(`${scope}:after`)}\n </div>\n </div>\n `;\n };\n\n private readonly __renderSignInHeader = () => {\n const { lang, ns } = this;\n const formId = '#sign-in-form';\n const form = this.renderRoot.querySelector(formId) as SignInForm | null;\n const isBusy = !!form?.in('busy');\n\n return html`\n <div class=\"flex flex-col leading-s font-lumo\" data-testid=\"sign-in:header\">\n ${this.renderTemplateOrSlot('sign-in:header:before')}\n\n <foxy-i18n\n class=\"text-xxl font-medium ${isBusy ? 'text-disabled' : 'text-body'}\"\n lang=${lang}\n key=\"sign_in\"\n ns=\"${ns} ${customElements.get('foxy-sign-in-form')?.defaultNS ?? ''}\"\n >\n </foxy-i18n>\n\n <foxy-i18n\n class=\"text-l ${isBusy ? 'text-disabled' : 'text-secondary'}\"\n lang=${lang}\n key=\"sign_in_hint\"\n ns=\"${ns} ${customElements.get('foxy-sign-in-form')?.defaultNS ?? ''}\"\n >\n </foxy-i18n>\n\n ${this.renderTemplateOrSlot('sign-in:header:after')}\n </div>\n `;\n };\n\n private readonly __renderSignInRecover = () => {\n const form = this.renderRoot.querySelector<AccessRecoveryForm>('#sign-in-form');\n const disabledSelector = this.disabledSelector.zoom('sign-in');\n\n return html`\n <div>\n ${this.renderTemplateOrSlot('sign-in:recover:before')}\n\n <vaadin-button\n data-testid=\"sign-in:recover\"\n class=\"w-full\"\n theme=\"tertiary\"\n ?disabled=${!!form?.in('busy') || disabledSelector.matches('recover', true)}\n @click=${() => (this.page = 'access-recovery')}\n >\n <foxy-i18n\n lang=${this.lang}\n key=\"recover_access\"\n ns=\"${this.ns} ${customElements.get('foxy-sign-in-form')?.defaultNS ?? ''}\"\n >\n </foxy-i18n>\n </vaadin-button>\n\n ${this.renderTemplateOrSlot('sign-in:recover:after')}\n </div>\n `;\n };\n\n private readonly __renderSignInSignUp = () => {\n const form = this.renderRoot.querySelector<AccessRecoveryForm>('#sign-in-form');\n const disabledSelector = this.disabledSelector.zoom('sign-in');\n\n return html`\n <div>\n ${this.renderTemplateOrSlot('sign-in:signup:before')}\n\n <vaadin-button\n data-testid=\"sign-in:signup\"\n class=\"w-full\"\n theme=\"tertiary\"\n ?disabled=${!!form?.in('busy') || disabledSelector.matches('signup', true)}\n @click=${() => (this.page = 'sign-up')}\n >\n <foxy-i18n lang=${this.lang} key=\"sign_up\" ns=\"${this.ns} sign-in-form\"> </foxy-i18n>\n </vaadin-button>\n\n ${this.renderTemplateOrSlot('sign-in:signup:after')}\n </div>\n `;\n };\n\n private readonly __renderSignInForm = () => {\n const scope = 'sign-in:form';\n const hiddenSelector = this.hiddenSelector.zoom(scope);\n\n return html`\n <div>\n ${this.renderTemplateOrSlot(`${scope}:before`)}\n\n <foxy-sign-in-form\n readonlycontrols=${this.readonlySelector.zoom(scope).toString()}\n disabledcontrols=${this.disabledSelector.zoom(scope).toString()}\n hiddencontrols=${hiddenSelector.toString()}\n data-testid=\"sign-in:form\"\n parent=\"foxy://customer-api/session\"\n group=${this.group}\n lang=${this.lang}\n id=\"sign-in-form\"\n ns=\"${this.ns} ${customElements.get('foxy-sign-in-form')?.defaultNS ?? ''}\"\n .templates=${this.getNestedTemplates('sign-in:form')}\n @update=${(evt: CustomEvent) => {\n const target = evt.currentTarget as SignInForm;\n const password = target.form.credential?.password ?? null;\n this.dispatchEvent(new CustomEvent('password', { detail: password }));\n this.requestUpdate();\n }}\n >\n </foxy-sign-in-form>\n\n ${this.renderTemplateOrSlot(`${scope}:after`)}\n </div>\n `;\n };\n\n private readonly __renderSignIn = () => {\n const scope = 'sign-in';\n const hiddenSelector = this.hiddenSelector.zoom(scope);\n const isSignUpEnabled = this.data?.sign_up?.enabled === true;\n const isSignUpButtonHidden = hiddenSelector.matches('signup', true) || !isSignUpEnabled;\n\n return html`\n <div class=\"h-full flex\" data-testid=\"sign-in\">\n <div class=\"m-auto max-w-25rem flex-1\">\n ${this.renderTemplateOrSlot(`${scope}:before`)}\n\n <div class=\"space-y-m\">\n ${hiddenSelector.matches('header', true) ? '' : this.__renderSignInHeader()}\n <div class=\"space-y-s\">\n ${hiddenSelector.matches('form', true) ? '' : this.__renderSignInForm()}\n <div class=\"flex justify-center gap-s\">\n ${isSignUpButtonHidden ? '' : this.__renderSignInSignUp()}\n ${hiddenSelector.matches('recover', true) ? '' : this.__renderSignInRecover()}\n </div>\n </div>\n </div>\n\n ${this.renderTemplateOrSlot(`${scope}:after`)}\n </div>\n </div>\n `;\n };\n\n private readonly __renderSignUpHeader = () => {\n const { lang, ns } = this;\n const formId = '#sign-up-form';\n const form = this.renderRoot.querySelector(formId) as CustomerForm | null;\n const isBusy = !!form?.in('busy');\n\n return html`\n <div class=\"flex flex-col leading-s font-lumo\" data-testid=\"sign-up:header\">\n ${this.renderTemplateOrSlot('sign-up:header:before')}\n\n <foxy-i18n\n class=\"text-xxl font-medium ${isBusy ? 'text-disabled' : 'text-body'}\"\n lang=${lang}\n key=\"sign_up\"\n ns=\"${ns} sign-up-form\"\n >\n </foxy-i18n>\n\n <foxy-i18n\n class=\"text-l ${isBusy ? 'text-disabled' : 'text-secondary'}\"\n lang=${lang}\n key=\"sign_up_hint\"\n ns=\"${ns} sign-up-form\"\n >\n </foxy-i18n>\n\n ${this.renderTemplateOrSlot('sign-up:header:after')}\n </div>\n `;\n };\n\n private readonly __renderSignUpGoBack = () => {\n const form = this.renderRoot.querySelector<CustomerForm>('#sign-up-form');\n const disabledSelector = this.disabledSelector.zoom('sign-up');\n\n return html`\n <div>\n ${this.renderTemplateOrSlot('sign-up:go-back:before')}\n\n <vaadin-button\n data-testid=\"sign-up:go-back\"\n class=\"w-full\"\n theme=\"tertiary-inline\"\n ?disabled=${!!form?.in('busy') || disabledSelector.matches('go-back', true)}\n @click=${() => (this.page = 'sign-in')}\n >\n <foxy-i18n lang=${this.lang} key=\"go_back\" ns=\"${this.ns} sign-up-form\"> </foxy-i18n>\n </vaadin-button>\n\n ${this.renderTemplateOrSlot('sign-up:go-back:after')}\n </div>\n `;\n };\n\n private readonly __renderSignUpForm = () => {\n const scope = 'sign-up:form';\n const hidden = [\n 'header',\n 'tax-id',\n 'is-anonymous',\n 'password-old',\n 'forgot-password',\n 'timestamps',\n 'delete',\n this.hiddenSelector.zoom(scope).toString(),\n ];\n\n return html`\n <div>\n ${this.renderTemplateOrSlot(`${scope}:before`)}\n\n <foxy-customer-form\n readonlycontrols=${this.readonlySelector.zoom(scope).toString()}\n disabledcontrols=${this.disabledSelector.zoom(scope).toString()}\n hiddencontrols=${new BooleanSelector(hidden.join(' ').trim())}\n data-testid=\"sign-up:form\"\n parent=\"foxy://customer-api/signup\"\n group=${this.group}\n lang=${this.lang}\n id=\"sign-up-form\"\n ns=\"${this.ns} sign-up-form\"\n .templates=${this.getNestedTemplates('sign-up:form')}\n .settings=${this.data}\n @update=${() => this.requestUpdate()}\n >\n </foxy-customer-form>\n\n ${this.renderTemplateOrSlot(`${scope}:after`)}\n </div>\n `;\n };\n\n private readonly __renderSignUp = () => {\n const scope = 'sign-up';\n const hiddenSelector = this.hiddenSelector.zoom(scope);\n\n return html`\n <div class=\"h-full flex\" data-testid=\"sign-up\">\n <div class=\"m-auto max-w-25rem flex-1\">\n ${this.renderTemplateOrSlot(`${scope}:before`)}\n\n <div class=\"space-y-m\">\n ${hiddenSelector.matches('header', true) ? '' : this.__renderSignUpHeader()}\n ${hiddenSelector.matches('form', true) ? '' : this.__renderSignUpForm()}\n ${hiddenSelector.matches('go-back', true) ? '' : this.__renderSignUpGoBack()}\n </div>\n\n ${this.renderTemplateOrSlot(`${scope}:after`)}\n </div>\n </div>\n `;\n };\n\n renderBody(): TemplateResult {\n const { page, hiddenSelector } = this;\n\n if (page === 'access-recovery' && !hiddenSelector.matches('access-recovery', true)) {\n return this.__renderAccessRecovery();\n }\n\n if (page === 'sign-in' && !hiddenSelector.matches('sign-in', true)) {\n return this.__renderSignIn();\n }\n\n if (page === 'sign-up' && !hiddenSelector.matches('sign-up', true)) {\n return this.__renderSignUp();\n }\n\n return html``;\n }\n}\n"]}
@@ -0,0 +1,25 @@
1
+ import type { CSSResultArray, PropertyDeclarations, TemplateResult } from 'lit-element';
2
+ import type { NucleonV8N } from '../NucleonElement/types';
3
+ import type { Resource } from '@foxy.io/sdk/core';
4
+ import type { Graph } from '@foxy.io/sdk/customer';
5
+ import { InternalForm } from '../../internal/InternalForm/InternalForm';
6
+ declare type Data = Resource<Graph & {
7
+ props: {
8
+ /** When updating the password using Customer API, these values are required to complete the request. */
9
+ password_old?: string;
10
+ password?: string;
11
+ };
12
+ }>;
13
+ declare const InternalCustomerPortalPasswordResetView_base: typeof InternalForm & import("lit-element").Constructor<import("../../../mixins/translatable").TranslatableMixinHost> & {
14
+ defaultNS: string;
15
+ };
16
+ export declare class InternalCustomerPortalPasswordResetView extends InternalCustomerPortalPasswordResetView_base<Data> {
17
+ static get properties(): PropertyDeclarations;
18
+ static get styles(): CSSResultArray;
19
+ static get v8n(): NucleonV8N<Data>;
20
+ passwordOld: string | null;
21
+ private readonly __generatorOptions;
22
+ renderBody(): TemplateResult;
23
+ submit(): void;
24
+ }
25
+ export {};
@@ -0,0 +1,72 @@
1
+ import { TranslatableMixin } from "../../../mixins/translatable.js";
2
+ import { InternalForm } from "../../internal/InternalForm/InternalForm.js";
3
+ import { html, css } from 'lit-element';
4
+ import checkPasswordStrength from 'check-password-strength';
5
+ const passwordStrength = checkPasswordStrength.passwordStrength;
6
+ export class InternalCustomerPortalPasswordResetView extends TranslatableMixin(InternalForm) {
7
+ constructor() {
8
+ super(...arguments);
9
+ this.passwordOld = null;
10
+ this.__generatorOptions = {
11
+ checkStrength: value => passwordStrength(value).id >= 2,
12
+ };
13
+ }
14
+ static get properties() {
15
+ return {
16
+ ...super.properties,
17
+ passwordOld: { attribute: 'password-old' },
18
+ };
19
+ }
20
+ static get styles() {
21
+ return [
22
+ super.styles,
23
+ css `.max-w-25rem{
24
+ max-width:25rem;
25
+ }
26
+ `,
27
+ ];
28
+ }
29
+ static get v8n() {
30
+ return [
31
+ ({ password: v }) => !!v || 'password:v8n_required',
32
+ ({ password: v }) => !v || v.length <= 50 || 'password:v8n_too_long',
33
+ ({ password: v }) => !v || passwordStrength(v).id >= 2 || 'password:v8n_too_weak',
34
+ ];
35
+ }
36
+ renderBody() {
37
+ return html `
38
+ <div class="m-auto max-w-25rem leading-s">
39
+ <p class="text-xxl font-medium ${this.in('busy') ? 'text-disabled' : 'text-body'}">
40
+ <foxy-i18n infer="" key="title"></foxy-i18n>
41
+ </p>
42
+
43
+ <p class="text-l ${this.in('busy') ? 'text-disabled' : 'text-secondary'}">
44
+ <foxy-i18n infer="" key="subtitle"></foxy-i18n>
45
+ </p>
46
+
47
+ <foxy-internal-password-control
48
+ infer="password"
49
+ class="mt-m"
50
+ show-generator
51
+ .generatorOptions=${this.__generatorOptions}
52
+ >
53
+ </foxy-internal-password-control>
54
+
55
+ <vaadin-button
56
+ class="w-full mt-l"
57
+ theme="primary"
58
+ ?disabled=${this.disabled || !this.in('idle')}
59
+ @click=${() => this.submit()}
60
+ >
61
+ <foxy-i18n infer="" key="submit"></foxy-i18n>
62
+ </vaadin-button>
63
+ </div>
64
+ `;
65
+ }
66
+ submit() {
67
+ var _a;
68
+ this.edit({ password_old: (_a = this.passwordOld) !== null && _a !== void 0 ? _a : '' });
69
+ super.submit();
70
+ }
71
+ }
72
+ //# sourceMappingURL=InternalCustomerPortalPasswordResetView.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"InternalCustomerPortalPasswordResetView.js","sourceRoot":"","sources":["../../../../src/elements/public/CustomerPortal/InternalCustomerPortalPasswordResetView.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,iBAAiB,EAAE,wCAAqC;AACjE,OAAO,EAAE,YAAY,EAAE,oDAAiD;AACxE,OAAO,EAAE,IAAI,EAAE,GAAG,EAAE,MAAM,aAAa,CAAC;AAExC,OAAO,qBAAqB,MAAM,yBAAyB,CAAC;AAC5D,MAAM,gBAAgB,GAAG,qBAAqB,CAAC,gBAAgB,CAAC;AAYhE,MAAM,OAAO,uCAAwC,SAAQ,iBAAiB,CAAC,YAAY,CAAO;IAAlG;;QA2BE,gBAAW,GAAkB,IAAI,CAAC;QAEjB,uBAAkB,GAAqB;YACtD,aAAa,EAAE,KAAK,CAAC,EAAE,CAAC,gBAAgB,CAAC,KAAK,CAAC,CAAC,EAAE,IAAI,CAAC;SACxD,CAAC;IAqCJ,CAAC;IAnEC,MAAM,KAAK,UAAU;QACnB,OAAO;YACL,GAAG,KAAK,CAAC,UAAU;YACnB,WAAW,EAAE,EAAE,SAAS,EAAE,cAAc,EAAE;SAC3C,CAAC;IACJ,CAAC;IAED,MAAM,KAAK,MAAM;QACf,OAAO;YACL,KAAK,CAAC,MAAM;YACZ,GAAG;;;OAIF;SACF,CAAC;IACJ,CAAC;IAED,MAAM,KAAK,GAAG;QACZ,OAAO;YACL,CAAC,EAAE,QAAQ,EAAE,CAAC,EAAE,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,IAAI,uBAAuB;YACnD,CAAC,EAAE,QAAQ,EAAE,CAAC,EAAE,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,MAAM,IAAI,EAAE,IAAI,uBAAuB;YACpE,CAAC,EAAE,QAAQ,EAAE,CAAC,EAAE,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,gBAAgB,CAAC,CAAC,CAAC,CAAC,EAAE,IAAI,CAAC,IAAI,uBAAuB;SAClF,CAAC;IACJ,CAAC;IAQD,UAAU;QACR,OAAO,IAAI,CAAA;;yCAE0B,IAAI,CAAC,EAAE,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,eAAe,CAAC,CAAC,CAAC,WAAW;;;;2BAI7D,IAAI,CAAC,EAAE,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,eAAe,CAAC,CAAC,CAAC,gBAAgB;;;;;;;;8BAQjD,IAAI,CAAC,kBAAkB;;;;;;;sBAO/B,IAAI,CAAC,QAAQ,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,MAAM,CAAC;mBACpC,GAAG,EAAE,CAAC,IAAI,CAAC,MAAM,EAAE;;;;;KAKjC,CAAC;IACJ,CAAC;IAED,MAAM;;QACJ,IAAI,CAAC,IAAI,CAAC,EAAE,YAAY,QAAE,IAAI,CAAC,WAAW,mCAAI,EAAE,EAAE,CAAC,CAAC;QACpD,KAAK,CAAC,MAAM,EAAE,CAAC;IACjB,CAAC;CACF","sourcesContent":["import type { CSSResultArray, PropertyDeclarations, TemplateResult } from 'lit-element';\nimport type { GeneratorOptions } from '../../internal/InternalPasswordControl/generateRandomPassword';\nimport type { NucleonV8N } from '../NucleonElement/types';\nimport type { Resource } from '@foxy.io/sdk/core';\nimport type { Graph } from '@foxy.io/sdk/customer';\n\nimport { TranslatableMixin } from '../../../mixins/translatable';\nimport { InternalForm } from '../../internal/InternalForm/InternalForm';\nimport { html, css } from 'lit-element';\n\nimport checkPasswordStrength from 'check-password-strength';\nconst passwordStrength = checkPasswordStrength.passwordStrength;\n\ntype Data = Resource<\n Graph & {\n props: {\n /** When updating the password using Customer API, these values are required to complete the request. */\n password_old?: string;\n password?: string;\n };\n }\n>;\n\nexport class InternalCustomerPortalPasswordResetView extends TranslatableMixin(InternalForm)<Data> {\n static get properties(): PropertyDeclarations {\n return {\n ...super.properties,\n passwordOld: { attribute: 'password-old' },\n };\n }\n\n static get styles(): CSSResultArray {\n return [\n super.styles,\n css`\n .max-w-25rem {\n max-width: 25rem;\n }\n `,\n ];\n }\n\n static get v8n(): NucleonV8N<Data> {\n return [\n ({ password: v }) => !!v || 'password:v8n_required',\n ({ password: v }) => !v || v.length <= 50 || 'password:v8n_too_long',\n ({ password: v }) => !v || passwordStrength(v).id >= 2 || 'password:v8n_too_weak',\n ];\n }\n\n passwordOld: string | null = null;\n\n private readonly __generatorOptions: GeneratorOptions = {\n checkStrength: value => passwordStrength(value).id >= 2,\n };\n\n renderBody(): TemplateResult {\n return html`\n <div class=\"m-auto max-w-25rem leading-s\">\n <p class=\"text-xxl font-medium ${this.in('busy') ? 'text-disabled' : 'text-body'}\">\n <foxy-i18n infer=\"\" key=\"title\"></foxy-i18n>\n </p>\n\n <p class=\"text-l ${this.in('busy') ? 'text-disabled' : 'text-secondary'}\">\n <foxy-i18n infer=\"\" key=\"subtitle\"></foxy-i18n>\n </p>\n\n <foxy-internal-password-control\n infer=\"password\"\n class=\"mt-m\"\n show-generator\n .generatorOptions=${this.__generatorOptions}\n >\n </foxy-internal-password-control>\n\n <vaadin-button\n class=\"w-full mt-l\"\n theme=\"primary\"\n ?disabled=${this.disabled || !this.in('idle')}\n @click=${() => this.submit()}\n >\n <foxy-i18n infer=\"\" key=\"submit\"></foxy-i18n>\n </vaadin-button>\n </div>\n `;\n }\n\n submit(): void {\n this.edit({ password_old: this.passwordOld ?? '' });\n super.submit();\n }\n}\n"]}
@@ -41,7 +41,7 @@ export class InternalCustomerPortalSubscriptions extends Base {
41
41
  };
42
42
  this.__renderFormHeaderActionsEnd = (html, host) => {
43
43
  var _a;
44
- const hasEndDate = !!((_a = host.data) === null || _a === void 0 ? void 0 : _a.end_date);
44
+ const hasEndDate = !!((_a = host.data) === null || _a === void 0 ? void 0 : _a.end_date) && host.data.end_date !== '0000-00-00';
45
45
  let cancelLink = '';
46
46
  if (!hasEndDate && host.in({ idle: 'snapshot' })) {
47
47
  const cancelURL = new URL(host.data._links['fx:sub_token_url'].href);
@@ -1 +1 @@
1
- {"version":3,"file":"InternalCustomerPortalSubscriptions.js","sourceRoot":"","sources":["../../../../src/elements/public/CustomerPortal/InternalCustomerPortalSubscriptions.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAY,wCAAqC;AAE3E,OAAO,EAAE,UAAU,EAAwC,IAAI,EAAE,MAAM,aAAa,CAAC;AAMrF,OAAO,EAAE,eAAe,EAAY,MAAM,mBAAmB,CAAC;AAE9D,OAAO,EAAE,cAAc,EAAE,qCAAkC;AAC3D,OAAO,EAAE,iBAAiB,EAAE,wCAAqC;AACjE,OAAO,EAAE,QAAQ,EAAE,oCAAiC;AACpD,OAAO,EAAE,SAAS,EAAE,MAAM,gCAAgC,CAAC;AAC3D,OAAO,EAAE,eAAe,EAAE,sCAAmC;AAE7D,MAAM,IAAI,GAAG,iBAAiB,CAAC,iBAAiB,CAAC,cAAc,CAAC,eAAe,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,CAAC;AAE/F,MAAM,OAAO,mCAAoC,SAAQ,IAAI;IAA7D;;QAUE,aAAQ,GAAiD,IAAI,CAAC;QAE9D,aAAQ,GAA2B,IAAI,CAAC;QAExC,UAAK,GAAG,EAAE,CAAC;QAEM,oCAA+B,GAA+B,CAAC,IAAI,EAAE,IAAI,EAAE,EAAE;;YAC5F,MAAM,QAAQ,GAAG,CAAC,QAAC,IAAI,CAAC,IAAI,0CAAE,QAAQ,CAAA,IAAI,IAAI,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,QA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U;YACnB,QAAQ,EAAE,EAAE,SAAS,EAAE,KAAK,EAAE;YAC9B,QAAQ,EAAE,EAAE,SAAS,EAAE,KAAK,EAAE;YAC9B,KAAK,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE;SACxB,CAAC;IACJ,CAAC;IAkQD,MAAM;QACJ,OAAO,IAAI,CAAA;;UAEL,IAAI,CAAC,cAAc,CAAC,OAAO,CAAC,QAAQ,EAAE,IAAI,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,cAAc,EAAE;UACxE,IAAI,CAAC,cAAc,CAAC,OAAO,CAAC,MAAM,EAAE,IAAI,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,YAAY,EAAE;;KAEzE,CAAC;IACJ,CAAC;IAED,IAAY,oBAAoB;QAC9B,OAAO,IAAI,CAAC,UAAU,CAAC,aAAa,CAAC,sBAAsB,CAAe,CAAC;IAC7E,CAAC;IAED,IAAY,yBAAyB;QACnC,IAAI;YACF,MAAM,GAAG,GAAG,IAAI,GAAG,CAAC,IAAI,CAAC,QAAS,CAAC,MAAM,CAAC,kBAAkB,CAAC,CAAC,IAAI,CAAC,CAAC;YACpE,GAAG,CAAC,YAAY,CAAC,GAAG,CAAC,MAAM,EAAE,4BAA4B,CAAC,CAAC;YAC3D,OAAO,GAAG,CAAC,QAAQ,EAAE,CAAC;SACvB;QAAC,WAAM;YACN,OAAO,EAAE,CAAC;SACX;IACH,CAAC;CACF","sourcesContent":["import { ConfigurableMixin, Renderer } from '../../../mixins/configurable';\nimport { Graph, Rels } from '@foxy.io/sdk/customer';\nimport { LitElement, PropertyDeclarations, TemplateResult, html } from 'lit-element';\n\nimport { FormDialog } from '../FormDialog/FormDialog';\nimport { FormRendererContext } from '../FormDialog/types';\nimport { ItemRenderer } from '../CollectionPage/types';\nimport { PageRenderer } from '../CollectionPages/types';\nimport { BooleanSelector, Resource } from '@foxy.io/sdk/core';\nimport { SubscriptionForm } from '../SubscriptionForm/SubscriptionForm';\nimport { ThemeableMixin } from '../../../mixins/themeable';\nimport { TranslatableMixin } from '../../../mixins/translatable';\nimport { classMap } from '../../../utils/class-map';\nimport { ifDefined } from 'lit-html/directives/if-defined';\nimport { InferrableMixin } from '../../../mixins/inferrable';\n\nconst Base = TranslatableMixin(ConfigurableMixin(ThemeableMixin(InferrableMixin(LitElement))));\n\nexport class InternalCustomerPortalSubscriptions extends Base {\n static get properties(): PropertyDeclarations {\n return {\n ...super.properties,\n settings: { attribute: false },\n customer: { attribute: false },\n group: { type: String },\n };\n }\n\n settings: Resource<Rels.CustomerPortalSettings> | null = null;\n\n customer: Resource<Graph> | null = null;\n\n group = '';\n\n private readonly __renderFormHeaderActionsUpdate: Renderer<SubscriptionForm> = (html, host) => {\n const hasEnded = !!host.data?.end_date && new Date(host.data.end_date).getTime() <= Date.now();\n let billingLink = '';\n\n if (!hasEnded && host.in({ idle: 'snapshot' })) {\n const link = host.data._links['fx:sub_token_url'].href;\n const updateBillingURL = new URL(link);\n\n updateBillingURL.searchParams.set('cart', 'checkout');\n updateBillingURL.searchParams.set('sub_restart', 'auto');\n billingLink = updateBillingURL.toString();\n }\n\n return html`\n ${host.renderTemplateOrSlot('header:actions:update:before')}\n\n <foxy-internal-customer-portal-link\n data-testid=\"header:actions:update\"\n href=${billingLink}\n icon=\"icons:credit-card\"\n ?disabled=${hasEnded || !host.in('idle')}\n >\n <foxy-i18n lang=${host.lang} key=\"update_billing\" ns=${host.ns}></foxy-i18n>\n </foxy-internal-customer-portal-link>\n\n ${host.renderTemplateOrSlot('header:actions:update:after')}\n `;\n };\n\n private readonly __renderFormHeaderActionsEnd: Renderer<SubscriptionForm> = (html, host) => {\n const hasEndDate = !!host.data?.end_date;\n let cancelLink = '';\n\n if (!hasEndDate && host.in({ idle: 'snapshot' })) {\n const cancelURL = new URL(host.data._links['fx:sub_token_url'].href);\n\n cancelURL.searchParams.set('sub_cancel', 'true');\n cancelLink = cancelURL.toString();\n }\n\n return html`\n ${host.renderTemplateOrSlot('header:actions:end:before')}\n\n <foxy-internal-customer-portal-link\n data-testid=\"header:actions:end\"\n href=${cancelLink}\n icon=\"icons:block\"\n ?disabled=${hasEndDate || !host.in('idle')}\n >\n <foxy-i18n lang=${host.lang} key=\"end_subscription\" ns=${host.ns}></foxy-i18n>\n </foxy-internal-customer-portal-link>\n\n ${host.renderTemplateOrSlot('header:actions:end:after')}\n `;\n };\n\n private readonly __renderFormHeaderActions: Renderer<SubscriptionForm> = (html, host) => {\n const isUpdateActionHidden = host.hiddenSelector.matches('header:actions:update');\n const isEndActionHidden = host.hiddenSelector.matches('header:actions:end');\n\n return html`\n <style>\n main {\n display: flex;\n justify-content: space-between;\n padding-top: var(--lumo-space-xs);\n margin-top: var(--lumo-space-s);\n border-top: 1px solid var(--lumo-contrast-10pct);\n color: var(--lumo-secondary-color);\n }\n </style>\n\n ${host.renderTemplateOrSlot('header:actions:before')}\n\n <main data-testid=\"header:actions\">\n ${isUpdateActionHidden ? '' : this.__renderFormHeaderActionsUpdate(html, host)}\n ${isEndActionHidden ? '' : this.__renderFormHeaderActionsEnd(html, host)}\n </main>\n\n ${host.renderTemplateOrSlot('header:actions:after')}\n `;\n };\n\n private readonly __renderFormItemsActionsUpdate: Renderer<SubscriptionForm> = (html, host) => {\n const itemsLink = host.data?._links['fx:sub_modification_url']?.href ?? '';\n const hasEnded = !!host.data?.end_date && new Date(host.data.end_date).getTime() <= Date.now();\n\n return html`\n ${host.renderTemplateOrSlot('items:actions:update:before')}\n\n <foxy-internal-customer-portal-link\n data-testid=\"items:actions:update\"\n class=\"text-primary\"\n href=${itemsLink}\n ?disabled=${hasEnded || !host.in('idle')}\n >\n <foxy-i18n lang=${host.lang} key=\"update_items\" ns=${host.ns}></foxy-i18n>\n </foxy-internal-customer-portal-link>\n\n ${host.renderTemplateOrSlot('items:actions:update:after')}\n `;\n };\n\n private readonly __renderForm = (ctx: FormRendererContext) => {\n const templates = { ...ctx.dialog.templates };\n const originalHeaderAfterRenderer = templates['header:after'];\n const originalItemsActionsAfterRenderer = templates['items:actions:after'];\n\n templates['header:after'] = (html, host) => {\n const actionsHidden = host.hiddenSelector.matches('header:actions', true);\n return html`\n ${actionsHidden ? '' : this.__renderFormHeaderActions(html, host)}\n ${originalHeaderAfterRenderer?.(html, host)}\n `;\n };\n\n templates['items:actions:after'] = (html, host) => {\n const hasUpdateLink = !!host.data?._links['fx:sub_modification_url'];\n const isUpdateHidden = host.hiddenSelector.matches('items:actions:update', true);\n const isUpdateRendered = hasUpdateLink && !isUpdateHidden;\n\n return html`\n ${isUpdateRendered ? this.__renderFormItemsActionsUpdate(html, host) : ''}\n ${originalItemsActionsAfterRenderer?.(html, host)}\n `;\n };\n\n return html`\n <foxy-subscription-form\n disabledcontrols=${ctx.dialog.disabledControls.toString()}\n readonlycontrols=${ctx.dialog.readonlyControls.toString()}\n hiddencontrols=${new BooleanSelector(\n `attributes timestamps start-date past-due-amount customer ${ctx.dialog.hiddenSelector}`\n )}\n settings=${JSON.stringify(this.settings)}\n parent=${ctx.dialog.parent}\n group=${ctx.dialog.group}\n lang=${ctx.dialog.lang}\n href=${ctx.dialog.href}\n ns=\"${ctx.dialog.ns} ${customElements.get('foxy-subscription-form')?.defaultNS ?? ''}\"\n id=\"form\"\n .templates=${templates}\n @update=${ctx.handleUpdate}\n @fetch=${ctx.handleFetch}\n >\n </foxy-subscription-form>\n `;\n };\n\n private readonly __renderPageItem: ItemRenderer = ({ html, ...ctx }) => {\n return html`\n <button\n class=${classMap({\n 'block w-full border border-contrast-10 p-m rounded-t-l rounded-b-l': true,\n 'focus-outline-none focus-border-primary': true,\n 'hover-border-contrast-30': ctx.data !== null,\n })}\n ?disabled=${ctx.data === null}\n @click=${(evt: Event) => {\n const url = new URL(ctx.href);\n url.searchParams.set('zoom', 'transaction_template:items');\n this.__subscriptionDialog.href = url.toString();\n this.__subscriptionDialog.show(evt.currentTarget as HTMLButtonElement);\n }}\n >\n <foxy-subscription-card\n hiddencontrols=\"email\"\n parent=${ctx.parent}\n group=${ctx.group}\n lang=${ctx.lang}\n href=${ctx.href}\n ns=\"${ctx.ns} ${customElements.get('foxy-subscription-card')?.defaultNS ?? ''}\"\n .templates=${ctx.templates}\n >\n </foxy-subscription-card>\n </button>\n `;\n };\n\n private readonly __renderPage: PageRenderer<any> = ({ html, ...ctx }) => {\n return html`\n <foxy-collection-page\n ns=${ctx.ns}\n href=${ctx.href}\n lang=${ctx.lang}\n group=${ctx.group}\n class=\"space-y-m\"\n .item=${this.__renderPageItem}\n .templates=${ctx.templates}\n >\n </foxy-collection-page>\n `;\n };\n\n private readonly __renderHeader = () => {\n return html`\n ${this.renderTemplateOrSlot('header:before')}\n\n <foxy-i18n\n class=\"block text-l font-medium\"\n lang=${this.lang}\n key=\"subscription_plural\"\n ns=${this.ns}\n >\n </foxy-i18n>\n\n ${this.renderTemplateOrSlot('header:after')}\n `;\n };\n\n private readonly __renderList = () => {\n const disabledSelector = this.disabledSelector.zoom('list');\n const readonlySelector = this.readonlySelector.zoom('list');\n const hiddenSelector = this.hiddenSelector.zoom('list');\n const extendedHiddenControlsArray = [hiddenSelector.zoom('form').toString(), 'end-date'];\n\n return html`\n ${this.renderTemplateOrSlot('list:before')}\n\n <foxy-form-dialog\n readonlycontrols=${readonlySelector.zoom('form').toString()}\n disabledcontrols=${disabledSelector.zoom('form').toString()}\n hiddencontrols=${extendedHiddenControlsArray.join(' ').trim()}\n header=\"update\"\n parent=${ifDefined(this.customer?._links['fx:subscriptions'].href)}\n group=${this.group}\n lang=${this.lang}\n ns=${this.ns}\n id=\"subscription-dialog\"\n .form=${this.__renderForm}\n .templates=${this.getNestedTemplates('list:form')}\n >\n </foxy-form-dialog>\n\n <foxy-collection-pages\n class=\"block space-y-m\"\n first=${this.__activeSubscriptionsLink}\n group=${this.group}\n lang=${this.lang}\n ns=${this.ns}\n manual\n .page=${this.__renderPage}\n .templates=${this.getNestedTemplates('list:card')}\n >\n </foxy-collection-pages>\n\n ${this.renderTemplateOrSlot('list:after')}\n `;\n };\n\n render(): TemplateResult {\n return html`\n <div class=\"space-y-s\" data-testid=\"subscriptions\">\n ${this.hiddenSelector.matches('header', true) ? '' : this.__renderHeader()}\n ${this.hiddenSelector.matches('list', true) ? '' : this.__renderList()}\n </div>\n `;\n }\n\n private get __subscriptionDialog() {\n return this.renderRoot.querySelector('#subscription-dialog') as FormDialog;\n }\n\n private get __activeSubscriptionsLink() {\n try {\n const url = new URL(this.customer!._links['fx:subscriptions'].href);\n url.searchParams.set('zoom', 'transaction_template:items');\n return url.toString();\n } catch {\n return '';\n }\n }\n}\n"]}
1
+ {"version":3,"file":"InternalCustomerPortalSubscriptions.js","sourceRoot":"","sources":["../../../../src/elements/public/CustomerPortal/InternalCustomerPortalSubscriptions.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAY,wCAAqC;AAE3E,OAAO,EAAE,UAAU,EAAwC,IAAI,EAAE,MAAM,aAAa,CAAC;AAMrF,OAAO,EAAE,eAAe,EAAY,MAAM,mBAAmB,CAAC;AAE9D,OAAO,EAAE,cAAc,EAAE,qCAAkC;AAC3D,OAAO,EAAE,iBAAiB,EAAE,wCAAqC;AACjE,OAAO,EAAE,QAAQ,EAAE,oCAAiC;AACpD,OAAO,EAAE,SAAS,EAAE,MAAM,gCAAgC,CAAC;AAC3D,OAAO,EAAE,eAAe,EAAE,sCAAmC;AAE7D,MAAM,IAAI,GAAG,iBAAiB,CAAC,iBAAiB,CAAC,cAAc,CAAC,eAAe,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,CAAC;AAE/F,MAAM,OAAO,mCAAoC,SAAQ,IAAI;IAA7D;;QAUE,aAAQ,GAAiD,IAAI,CAAC;QAE9D,aAAQ,GAA2B,IAAI,CAAC;QAExC,UAAK,GAAG,EAAE,CAAC;QAEM,oCAA+B,GAA+B,CAAC,IAAI,EAAE,IAAI,EAAE,EAAE;;YAC5F,MAAM,QAAQ,GAAG,CAAC,QAAC,IAA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BAAoB,CAAC,YAAY,CAAC;KAC1C,CAAC;QACJ,CAAC,CAAC;IAwBJ,CAAC;IA/RC,MAAM,KAAK,UAAU;QACnB,OAAO;YACL,GAAG,KAAK,CAAC,UAAU;YACnB,QAAQ,EAAE,EAAE,SAAS,EAAE,KAAK,EAAE;YAC9B,QAAQ,EAAE,EAAE,SAAS,EAAE,KAAK,EAAE;YAC9B,KAAK,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE;SACxB,CAAC;IACJ,CAAC;IAkQD,MAAM;QACJ,OAAO,IAAI,CAAA;;UAEL,IAAI,CAAC,cAAc,CAAC,OAAO,CAAC,QAAQ,EAAE,IAAI,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,cAAc,EAAE;UACxE,IAAI,CAAC,cAAc,CAAC,OAAO,CAAC,MAAM,EAAE,IAAI,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,YAAY,EAAE;;KAEzE,CAAC;IACJ,CAAC;IAED,IAAY,oBAAoB;QAC9B,OAAO,IAAI,CAAC,UAAU,CAAC,aAAa,CAAC,sBAAsB,CAAe,CAAC;IAC7E,CAAC;IAED,IAAY,yBAAyB;QACnC,IAAI;YACF,MAAM,GAAG,GAAG,IAAI,GAAG,CAAC,IAAI,CAAC,QAAS,CAAC,MAAM,CAAC,kBAAkB,CAAC,CAAC,IAAI,CAAC,CAAC;YACpE,GAAG,CAAC,YAAY,CAAC,GAAG,CAAC,MAAM,EAAE,4BAA4B,CAAC,CAAC;YAC3D,OAAO,GAAG,CAAC,QAAQ,EAAE,CAAC;SACvB;QAAC,WAAM;YACN,OAAO,EAAE,CAAC;SACX;IACH,CAAC;CACF","sourcesContent":["import { ConfigurableMixin, Renderer } from '../../../mixins/configurable';\nimport { Graph, Rels } from '@foxy.io/sdk/customer';\nimport { LitElement, PropertyDeclarations, TemplateResult, html } from 'lit-element';\n\nimport { FormDialog } from '../FormDialog/FormDialog';\nimport { FormRendererContext } from '../FormDialog/types';\nimport { ItemRenderer } from '../CollectionPage/types';\nimport { PageRenderer } from '../CollectionPages/types';\nimport { BooleanSelector, Resource } from '@foxy.io/sdk/core';\nimport { SubscriptionForm } from '../SubscriptionForm/SubscriptionForm';\nimport { ThemeableMixin } from '../../../mixins/themeable';\nimport { TranslatableMixin } from '../../../mixins/translatable';\nimport { classMap } from '../../../utils/class-map';\nimport { ifDefined } from 'lit-html/directives/if-defined';\nimport { InferrableMixin } from '../../../mixins/inferrable';\n\nconst Base = TranslatableMixin(ConfigurableMixin(ThemeableMixin(InferrableMixin(LitElement))));\n\nexport class InternalCustomerPortalSubscriptions extends Base {\n static get properties(): PropertyDeclarations {\n return {\n ...super.properties,\n settings: { attribute: false },\n customer: { attribute: false },\n group: { type: String },\n };\n }\n\n settings: Resource<Rels.CustomerPortalSettings> | null = null;\n\n customer: Resource<Graph> | null = null;\n\n group = '';\n\n private readonly __renderFormHeaderActionsUpdate: Renderer<SubscriptionForm> = (html, host) => {\n const hasEnded = !!host.data?.end_date && new Date(host.data.end_date).getTime() <= Date.now();\n let billingLink = '';\n\n if (!hasEnded && host.in({ idle: 'snapshot' })) {\n const link = host.data._links['fx:sub_token_url'].href;\n const updateBillingURL = new URL(link);\n\n updateBillingURL.searchParams.set('cart', 'checkout');\n updateBillingURL.searchParams.set('sub_restart', 'auto');\n billingLink = updateBillingURL.toString();\n }\n\n return html`\n ${host.renderTemplateOrSlot('header:actions:update:before')}\n\n <foxy-internal-customer-portal-link\n data-testid=\"header:actions:update\"\n href=${billingLink}\n icon=\"icons:credit-card\"\n ?disabled=${hasEnded || !host.in('idle')}\n >\n <foxy-i18n lang=${host.lang} key=\"update_billing\" ns=${host.ns}></foxy-i18n>\n </foxy-internal-customer-portal-link>\n\n ${host.renderTemplateOrSlot('header:actions:update:after')}\n `;\n };\n\n private readonly __renderFormHeaderActionsEnd: Renderer<SubscriptionForm> = (html, host) => {\n const hasEndDate = !!host.data?.end_date && host.data.end_date !== '0000-00-00';\n let cancelLink = '';\n\n if (!hasEndDate && host.in({ idle: 'snapshot' })) {\n const cancelURL = new URL(host.data._links['fx:sub_token_url'].href);\n\n cancelURL.searchParams.set('sub_cancel', 'true');\n cancelLink = cancelURL.toString();\n }\n\n return html`\n ${host.renderTemplateOrSlot('header:actions:end:before')}\n\n <foxy-internal-customer-portal-link\n data-testid=\"header:actions:end\"\n href=${cancelLink}\n icon=\"icons:block\"\n ?disabled=${hasEndDate || !host.in('idle')}\n >\n <foxy-i18n lang=${host.lang} key=\"end_subscription\" ns=${host.ns}></foxy-i18n>\n </foxy-internal-customer-portal-link>\n\n ${host.renderTemplateOrSlot('header:actions:end:after')}\n `;\n };\n\n private readonly __renderFormHeaderActions: Renderer<SubscriptionForm> = (html, host) => {\n const isUpdateActionHidden = host.hiddenSelector.matches('header:actions:update');\n const isEndActionHidden = host.hiddenSelector.matches('header:actions:end');\n\n return html`\n <style>\n main {\n display: flex;\n justify-content: space-between;\n padding-top: var(--lumo-space-xs);\n margin-top: var(--lumo-space-s);\n border-top: 1px solid var(--lumo-contrast-10pct);\n color: var(--lumo-secondary-color);\n }\n </style>\n\n ${host.renderTemplateOrSlot('header:actions:before')}\n\n <main data-testid=\"header:actions\">\n ${isUpdateActionHidden ? '' : this.__renderFormHeaderActionsUpdate(html, host)}\n ${isEndActionHidden ? '' : this.__renderFormHeaderActionsEnd(html, host)}\n </main>\n\n ${host.renderTemplateOrSlot('header:actions:after')}\n `;\n };\n\n private readonly __renderFormItemsActionsUpdate: Renderer<SubscriptionForm> = (html, host) => {\n const itemsLink = host.data?._links['fx:sub_modification_url']?.href ?? '';\n const hasEnded = !!host.data?.end_date && new Date(host.data.end_date).getTime() <= Date.now();\n\n return html`\n ${host.renderTemplateOrSlot('items:actions:update:before')}\n\n <foxy-internal-customer-portal-link\n data-testid=\"items:actions:update\"\n class=\"text-primary\"\n href=${itemsLink}\n ?disabled=${hasEnded || !host.in('idle')}\n >\n <foxy-i18n lang=${host.lang} key=\"update_items\" ns=${host.ns}></foxy-i18n>\n </foxy-internal-customer-portal-link>\n\n ${host.renderTemplateOrSlot('items:actions:update:after')}\n `;\n };\n\n private readonly __renderForm = (ctx: FormRendererContext) => {\n const templates = { ...ctx.dialog.templates };\n const originalHeaderAfterRenderer = templates['header:after'];\n const originalItemsActionsAfterRenderer = templates['items:actions:after'];\n\n templates['header:after'] = (html, host) => {\n const actionsHidden = host.hiddenSelector.matches('header:actions', true);\n return html`\n ${actionsHidden ? '' : this.__renderFormHeaderActions(html, host)}\n ${originalHeaderAfterRenderer?.(html, host)}\n `;\n };\n\n templates['items:actions:after'] = (html, host) => {\n const hasUpdateLink = !!host.data?._links['fx:sub_modification_url'];\n const isUpdateHidden = host.hiddenSelector.matches('items:actions:update', true);\n const isUpdateRendered = hasUpdateLink && !isUpdateHidden;\n\n return html`\n ${isUpdateRendered ? this.__renderFormItemsActionsUpdate(html, host) : ''}\n ${originalItemsActionsAfterRenderer?.(html, host)}\n `;\n };\n\n return html`\n <foxy-subscription-form\n disabledcontrols=${ctx.dialog.disabledControls.toString()}\n readonlycontrols=${ctx.dialog.readonlyControls.toString()}\n hiddencontrols=${new BooleanSelector(\n `attributes timestamps start-date past-due-amount customer ${ctx.dialog.hiddenSelector}`\n )}\n settings=${JSON.stringify(this.settings)}\n parent=${ctx.dialog.parent}\n group=${ctx.dialog.group}\n lang=${ctx.dialog.lang}\n href=${ctx.dialog.href}\n ns=\"${ctx.dialog.ns} ${customElements.get('foxy-subscription-form')?.defaultNS ?? ''}\"\n id=\"form\"\n .templates=${templates}\n @update=${ctx.handleUpdate}\n @fetch=${ctx.handleFetch}\n >\n </foxy-subscription-form>\n `;\n };\n\n private readonly __renderPageItem: ItemRenderer = ({ html, ...ctx }) => {\n return html`\n <button\n class=${classMap({\n 'block w-full border border-contrast-10 p-m rounded-t-l rounded-b-l': true,\n 'focus-outline-none focus-border-primary': true,\n 'hover-border-contrast-30': ctx.data !== null,\n })}\n ?disabled=${ctx.data === null}\n @click=${(evt: Event) => {\n const url = new URL(ctx.href);\n url.searchParams.set('zoom', 'transaction_template:items');\n this.__subscriptionDialog.href = url.toString();\n this.__subscriptionDialog.show(evt.currentTarget as HTMLButtonElement);\n }}\n >\n <foxy-subscription-card\n hiddencontrols=\"email\"\n parent=${ctx.parent}\n group=${ctx.group}\n lang=${ctx.lang}\n href=${ctx.href}\n ns=\"${ctx.ns} ${customElements.get('foxy-subscription-card')?.defaultNS ?? ''}\"\n .templates=${ctx.templates}\n >\n </foxy-subscription-card>\n </button>\n `;\n };\n\n private readonly __renderPage: PageRenderer<any> = ({ html, ...ctx }) => {\n return html`\n <foxy-collection-page\n ns=${ctx.ns}\n href=${ctx.href}\n lang=${ctx.lang}\n group=${ctx.group}\n class=\"space-y-m\"\n .item=${this.__renderPageItem}\n .templates=${ctx.templates}\n >\n </foxy-collection-page>\n `;\n };\n\n private readonly __renderHeader = () => {\n return html`\n ${this.renderTemplateOrSlot('header:before')}\n\n <foxy-i18n\n class=\"block text-l font-medium\"\n lang=${this.lang}\n key=\"subscription_plural\"\n ns=${this.ns}\n >\n </foxy-i18n>\n\n ${this.renderTemplateOrSlot('header:after')}\n `;\n };\n\n private readonly __renderList = () => {\n const disabledSelector = this.disabledSelector.zoom('list');\n const readonlySelector = this.readonlySelector.zoom('list');\n const hiddenSelector = this.hiddenSelector.zoom('list');\n const extendedHiddenControlsArray = [hiddenSelector.zoom('form').toString(), 'end-date'];\n\n return html`\n ${this.renderTemplateOrSlot('list:before')}\n\n <foxy-form-dialog\n readonlycontrols=${readonlySelector.zoom('form').toString()}\n disabledcontrols=${disabledSelector.zoom('form').toString()}\n hiddencontrols=${extendedHiddenControlsArray.join(' ').trim()}\n header=\"update\"\n parent=${ifDefined(this.customer?._links['fx:subscriptions'].href)}\n group=${this.group}\n lang=${this.lang}\n ns=${this.ns}\n id=\"subscription-dialog\"\n .form=${this.__renderForm}\n .templates=${this.getNestedTemplates('list:form')}\n >\n </foxy-form-dialog>\n\n <foxy-collection-pages\n class=\"block space-y-m\"\n first=${this.__activeSubscriptionsLink}\n group=${this.group}\n lang=${this.lang}\n ns=${this.ns}\n manual\n .page=${this.__renderPage}\n .templates=${this.getNestedTemplates('list:card')}\n >\n </foxy-collection-pages>\n\n ${this.renderTemplateOrSlot('list:after')}\n `;\n };\n\n render(): TemplateResult {\n return html`\n <div class=\"space-y-s\" data-testid=\"subscriptions\">\n ${this.hiddenSelector.matches('header', true) ? '' : this.__renderHeader()}\n ${this.hiddenSelector.matches('list', true) ? '' : this.__renderList()}\n </div>\n `;\n }\n\n private get __subscriptionDialog() {\n return this.renderRoot.querySelector('#subscription-dialog') as FormDialog;\n }\n\n private get __activeSubscriptionsLink() {\n try {\n const url = new URL(this.customer!._links['fx:subscriptions'].href);\n url.searchParams.set('zoom', 'transaction_template:items');\n return url.toString();\n } catch {\n return '';\n }\n }\n}\n"]}
@@ -2,6 +2,7 @@ import '@polymer/iron-icons/editor-icons';
2
2
  import '@vaadin/vaadin-button';
3
3
  import '@polymer/iron-icons';
4
4
  import '@polymer/iron-icon';
5
+ import '../../internal/InternalPasswordControl/index';
5
6
  import '../../internal/InternalSandbox/index';
6
7
  import '../../internal/InternalForm/index';
7
8
  import '../AccessRecoveryForm/index';
@@ -15,6 +16,7 @@ import '../CustomerForm/index';
15
16
  import '../SignInForm/index';
16
17
  import '../FormDialog/index';
17
18
  import '../Spinner/index';
19
+ import '../I18n/index';
18
20
  import '../Customer/index';
19
21
  import { CustomerPortal } from './CustomerPortal';
20
22
  export { CustomerPortal };
@@ -2,6 +2,7 @@ import '@polymer/iron-icons/editor-icons';
2
2
  import '@vaadin/vaadin-button';
3
3
  import '@polymer/iron-icons';
4
4
  import '@polymer/iron-icon';
5
+ import "../../internal/InternalPasswordControl/index.js";
5
6
  import "../../internal/InternalSandbox/index.js";
6
7
  import "../../internal/InternalForm/index.js";
7
8
  import "../AccessRecoveryForm/index.js";
@@ -15,6 +16,7 @@ import "../CustomerForm/index.js";
15
16
  import "../SignInForm/index.js";
16
17
  import "../FormDialog/index.js";
17
18
  import "../Spinner/index.js";
19
+ import "../I18n/index.js";
18
20
  import "../Customer/index.js";
19
21
  import { CustomerPortal } from "./CustomerPortal.js";
20
22
  import { InternalCustomerPortalLink } from "./InternalCustomerPortalLink.js";
@@ -22,8 +24,10 @@ import { InternalCustomerPortalLoggedInView } from "./InternalCustomerPortalLogg
22
24
  import { InternalCustomerPortalLoggedOutView } from "./InternalCustomerPortalLoggedOutView.js";
23
25
  import { InternalCustomerPortalSubscriptions } from "./InternalCustomerPortalSubscriptions.js";
24
26
  import { InternalCustomerPortalTransactions } from "./InternalCustomerPortalTransactions.js";
27
+ import { InternalCustomerPortalPasswordResetView } from "./InternalCustomerPortalPasswordResetView.js";
25
28
  customElements.define('foxy-internal-customer-portal-logged-in-view', InternalCustomerPortalLoggedInView);
26
29
  customElements.define('foxy-internal-customer-portal-logged-out-view', InternalCustomerPortalLoggedOutView);
30
+ customElements.define('foxy-internal-customer-portal-password-reset-view', InternalCustomerPortalPasswordResetView);
27
31
  customElements.define('foxy-internal-customer-portal-subscriptions', InternalCustomerPortalSubscriptions);
28
32
  customElements.define('foxy-internal-customer-portal-transactions', InternalCustomerPortalTransactions);
29
33
  customElements.define('foxy-internal-customer-portal-link', InternalCustomerPortalLink);
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/elements/public/CustomerPortal/index.ts"],"names":[],"mappings":"AAAA,OAAO,kCAAkC,CAAC;AAC1C,OAAO,uBAAuB,CAAC;AAC/B,OAAO,qBAAqB,CAAC;AAC7B,OAAO,oBAAoB,CAAC;AAC5B,iDAA8C;AAC9C,8CAA2C;AAC3C,wCAAqC;AACrC,uCAAoC;AACpC,uCAAoC;AACpC,sCAAmC;AACnC,sCAAmC;AACnC,qCAAkC;AAClC,oCAAiC;AACjC,kCAA+B;AAC/B,gCAA6B;AAC7B,gCAA6B;AAC7B,6BAA0B;AAC1B,8BAA2B;AAE3B,OAAO,EAAE,cAAc,EAAE,4BAAyB;AAClD,OAAO,EAAE,0BAA0B,EAAE,wCAAqC;AAC1E,OAAO,EAAE,kCAAkC,EAAE,gDAA6C;AAC1F,OAAO,EAAE,mCAAmC,EAAE,iDAA8C;AAC5F,OAAO,EAAE,mCAAmC,EAAE,iDAA8C;AAC5F,OAAO,EAAE,kCAAkC,EAAE,gDAA6C;AAE1F,cAAc,CAAC,MAAM,CACnB,8CAA8C,EAC9C,kCAAkC,CACnC,CAAC;AAEF,cAAc,CAAC,MAAM,CACnB,+CAA+C,EAC/C,mCAAmC,CACpC,CAAC;AAEF,cAAc,CAAC,MAAM,CACnB,6CAA6C,EAC7C,mCAAmC,CACpC,CAAC;AAEF,cAAc,CAAC,MAAM,CACnB,4CAA4C,EAC5C,kCAAkC,CACnC,CAAC;AAEF,cAAc,CAAC,MAAM,CAAC,oCAAoC,EAAE,0BAA0B,CAAC,CAAC;AAExF,cAAc,CAAC,MAAM,CAAC,sBAAsB,EAAE,cAAc,CAAC,CAAC;AAE9D,OAAO,EAAE,cAAc,EAAE,CAAC","sourcesContent":["import '@polymer/iron-icons/editor-icons';\nimport '@vaadin/vaadin-button';\nimport '@polymer/iron-icons';\nimport '@polymer/iron-icon';\nimport '../../internal/InternalSandbox/index';\nimport '../../internal/InternalForm/index';\nimport '../AccessRecoveryForm/index';\nimport '../PaymentMethodCard/index';\nimport '../TransactionsTable/index';\nimport '../SubscriptionCard/index';\nimport '../SubscriptionForm/index';\nimport '../CollectionPages/index';\nimport '../CollectionPage/index';\nimport '../CustomerForm/index';\nimport '../SignInForm/index';\nimport '../FormDialog/index';\nimport '../Spinner/index';\nimport '../Customer/index';\n\nimport { CustomerPortal } from './CustomerPortal';\nimport { InternalCustomerPortalLink } from './InternalCustomerPortalLink';\nimport { InternalCustomerPortalLoggedInView } from './InternalCustomerPortalLoggedInView';\nimport { InternalCustomerPortalLoggedOutView } from './InternalCustomerPortalLoggedOutView';\nimport { InternalCustomerPortalSubscriptions } from './InternalCustomerPortalSubscriptions';\nimport { InternalCustomerPortalTransactions } from './InternalCustomerPortalTransactions';\n\ncustomElements.define(\n 'foxy-internal-customer-portal-logged-in-view',\n InternalCustomerPortalLoggedInView\n);\n\ncustomElements.define(\n 'foxy-internal-customer-portal-logged-out-view',\n InternalCustomerPortalLoggedOutView\n);\n\ncustomElements.define(\n 'foxy-internal-customer-portal-subscriptions',\n InternalCustomerPortalSubscriptions\n);\n\ncustomElements.define(\n 'foxy-internal-customer-portal-transactions',\n InternalCustomerPortalTransactions\n);\n\ncustomElements.define('foxy-internal-customer-portal-link', InternalCustomerPortalLink);\n\ncustomElements.define('foxy-customer-portal', CustomerPortal);\n\nexport { CustomerPortal };\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/elements/public/CustomerPortal/index.ts"],"names":[],"mappings":"AAAA,OAAO,kCAAkC,CAAC;AAC1C,OAAO,uBAAuB,CAAC;AAC/B,OAAO,qBAAqB,CAAC;AAC7B,OAAO,oBAAoB,CAAC;AAC5B,yDAAsD;AACtD,iDAA8C;AAC9C,8CAA2C;AAC3C,wCAAqC;AACrC,uCAAoC;AACpC,uCAAoC;AACpC,sCAAmC;AACnC,sCAAmC;AACnC,qCAAkC;AAClC,oCAAiC;AACjC,kCAA+B;AAC/B,gCAA6B;AAC7B,gCAA6B;AAC7B,6BAA0B;AAC1B,0BAAuB;AACvB,8BAA2B;AAE3B,OAAO,EAAE,cAAc,EAAE,4BAAyB;AAClD,OAAO,EAAE,0BAA0B,EAAE,wCAAqC;AAC1E,OAAO,EAAE,kCAAkC,EAAE,gDAA6C;AAC1F,OAAO,EAAE,mCAAmC,EAAE,iDAA8C;AAC5F,OAAO,EAAE,mCAAmC,EAAE,iDAA8C;AAC5F,OAAO,EAAE,kCAAkC,EAAE,gDAA6C;AAC1F,OAAO,EAAE,uCAAuC,EAAE,qDAAkD;AAEpG,cAAc,CAAC,MAAM,CACnB,8CAA8C,EAC9C,kCAAkC,CACnC,CAAC;AAEF,cAAc,CAAC,MAAM,CACnB,+CAA+C,EAC/C,mCAAmC,CACpC,CAAC;AAEF,cAAc,CAAC,MAAM,CACnB,mDAAmD,EACnD,uCAAuC,CACxC,CAAC;AAEF,cAAc,CAAC,MAAM,CACnB,6CAA6C,EAC7C,mCAAmC,CACpC,CAAC;AAEF,cAAc,CAAC,MAAM,CACnB,4CAA4C,EAC5C,kCAAkC,CACnC,CAAC;AAEF,cAAc,CAAC,MAAM,CAAC,oCAAoC,EAAE,0BAA0B,CAAC,CAAC;AAExF,cAAc,CAAC,MAAM,CAAC,sBAAsB,EAAE,cAAc,CAAC,CAAC;AAE9D,OAAO,EAAE,cAAc,EAAE,CAAC","sourcesContent":["import '@polymer/iron-icons/editor-icons';\nimport '@vaadin/vaadin-button';\nimport '@polymer/iron-icons';\nimport '@polymer/iron-icon';\nimport '../../internal/InternalPasswordControl/index';\nimport '../../internal/InternalSandbox/index';\nimport '../../internal/InternalForm/index';\nimport '../AccessRecoveryForm/index';\nimport '../PaymentMethodCard/index';\nimport '../TransactionsTable/index';\nimport '../SubscriptionCard/index';\nimport '../SubscriptionForm/index';\nimport '../CollectionPages/index';\nimport '../CollectionPage/index';\nimport '../CustomerForm/index';\nimport '../SignInForm/index';\nimport '../FormDialog/index';\nimport '../Spinner/index';\nimport '../I18n/index';\nimport '../Customer/index';\n\nimport { CustomerPortal } from './CustomerPortal';\nimport { InternalCustomerPortalLink } from './InternalCustomerPortalLink';\nimport { InternalCustomerPortalLoggedInView } from './InternalCustomerPortalLoggedInView';\nimport { InternalCustomerPortalLoggedOutView } from './InternalCustomerPortalLoggedOutView';\nimport { InternalCustomerPortalSubscriptions } from './InternalCustomerPortalSubscriptions';\nimport { InternalCustomerPortalTransactions } from './InternalCustomerPortalTransactions';\nimport { InternalCustomerPortalPasswordResetView } from './InternalCustomerPortalPasswordResetView';\n\ncustomElements.define(\n 'foxy-internal-customer-portal-logged-in-view',\n InternalCustomerPortalLoggedInView\n);\n\ncustomElements.define(\n 'foxy-internal-customer-portal-logged-out-view',\n InternalCustomerPortalLoggedOutView\n);\n\ncustomElements.define(\n 'foxy-internal-customer-portal-password-reset-view',\n InternalCustomerPortalPasswordResetView\n);\n\ncustomElements.define(\n 'foxy-internal-customer-portal-subscriptions',\n InternalCustomerPortalSubscriptions\n);\n\ncustomElements.define(\n 'foxy-internal-customer-portal-transactions',\n InternalCustomerPortalTransactions\n);\n\ncustomElements.define('foxy-internal-customer-portal-link', InternalCustomerPortalLink);\n\ncustomElements.define('foxy-customer-portal', CustomerPortal);\n\nexport { CustomerPortal };\n"]}