@foxy.io/elements 1.21.3 → 1.21.5

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 (47) hide show
  1. package/dist/cdn/foxy-access-recovery-form.js +1 -1
  2. package/dist/cdn/foxy-attribute-form.js +1 -1
  3. package/dist/cdn/foxy-cancellation-form.js +1 -1
  4. package/dist/cdn/foxy-cart-form.js +1 -1
  5. package/dist/cdn/foxy-coupon-code-form.js +1 -1
  6. package/dist/cdn/foxy-coupon-form.js +1 -1
  7. package/dist/cdn/foxy-custom-field-form.js +1 -1
  8. package/dist/cdn/foxy-customer-form.js +1 -1
  9. package/dist/cdn/foxy-customer-portal-settings.js +1 -1
  10. package/dist/cdn/foxy-customer-portal.js +1 -1
  11. package/dist/cdn/foxy-customer.js +1 -1
  12. package/dist/cdn/foxy-donation.js +1 -1
  13. package/dist/cdn/foxy-email-template-form.js +1 -1
  14. package/dist/cdn/foxy-gift-card-code-form.js +1 -1
  15. package/dist/cdn/foxy-gift-card-form.js +1 -1
  16. package/dist/cdn/foxy-item-form.js +1 -1
  17. package/dist/cdn/foxy-items-form.js +1 -1
  18. package/dist/cdn/foxy-report-form.js +1 -1
  19. package/dist/cdn/foxy-shipment-card.js +1 -1
  20. package/dist/cdn/foxy-sign-in-form.js +1 -1
  21. package/dist/cdn/foxy-subscription-form.js +1 -1
  22. package/dist/cdn/foxy-tax-form.js +1 -1
  23. package/dist/cdn/foxy-template-config-form.js +1 -1
  24. package/dist/cdn/foxy-template-form.js +1 -1
  25. package/dist/cdn/foxy-transaction.js +1 -1
  26. package/dist/cdn/foxy-user-form.js +1 -1
  27. package/dist/cdn/foxy-users-table.js +1 -1
  28. package/dist/cdn/{shared-f621ccee.js → shared-2adb2ad2.js} +1 -1
  29. package/dist/cdn/shared-2d1ef71c.js +1 -0
  30. package/dist/cdn/{shared-ca87cf22.js → shared-31aeab75.js} +1 -1
  31. package/dist/cdn/{shared-c6a01446.js → shared-97d58f8b.js} +1 -1
  32. package/dist/cdn/{shared-454f172e.js → shared-d8bb42a2.js} +1 -1
  33. package/dist/elements/private/Choice/Choice.d.ts +3 -2
  34. package/dist/elements/private/Choice/Choice.js +5 -0
  35. package/dist/elements/private/Choice/Choice.js.map +1 -1
  36. package/dist/elements/private/Choice/machine.js +33 -0
  37. package/dist/elements/private/Choice/machine.js.map +1 -1
  38. package/dist/elements/public/AccessRecoveryForm/AccessRecoveryForm.d.ts +1 -0
  39. package/dist/elements/public/AccessRecoveryForm/AccessRecoveryForm.js +8 -0
  40. package/dist/elements/public/AccessRecoveryForm/AccessRecoveryForm.js.map +1 -1
  41. package/dist/elements/public/Donation/Donation.js +3 -3
  42. package/dist/elements/public/Donation/Donation.js.map +1 -1
  43. package/dist/elements/public/SignInForm/SignInForm.d.ts +1 -0
  44. package/dist/elements/public/SignInForm/SignInForm.js +8 -0
  45. package/dist/elements/public/SignInForm/SignInForm.js.map +1 -1
  46. package/package.json +1 -1
  47. package/dist/cdn/shared-be99323d.js +0 -1
@@ -236,16 +236,16 @@ export class Donation extends Translatable {
236
236
  <x-i18n ns=${this.ns} lang=${this.lang} key="amount" slot="header"></x-i18n>
237
237
  <x-choice
238
238
  ?custom=${!!((_a = this.custom) === null || _a === void 0 ? void 0 : _a.includes('amount'))}
239
- .getText=${(v) => this.__translateAmount(parseInt(v, 10))}
239
+ .getText=${(v) => this.__translateAmount(parseFloat(v))}
240
240
  .items=${this.amounts.map(String)}
241
241
  .value=${this.amount.toString()}
242
- type="integer"
242
+ type="number"
243
243
  lang=${this.lang}
244
244
  min="1"
245
245
  ns=${this.ns}
246
246
  data-testid="amount"
247
247
  @change=${(evt) => {
248
- const value = parseInt(evt.detail);
248
+ const value = parseFloat(evt.detail);
249
249
  this.amount = isNaN(value) ? /* istanbul ignore next */ 1 : value;
250
250
  }}
251
251
  >
@@ -1 +1 @@
1
- {"version":3,"file":"Donation.js","sourceRoot":"","sources":["../../../../src/elements/public/Donation/Donation.ts"],"names":[],"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AAI,CAAC,EAAE,CAAC,KAAK,EAAE,EAAE,KAAK,EAAE,CAAC;YAChC,KAAK;SACN,CAAC,CAAC;IACL,CAAC;IAEO,iBAAiB,CAAC,MAAc;QACtC,OAAO,MAAM,CAAC,cAAc,CAAC,IAAI,CAAC,IAAI,EAAE;YACtC,qBAAqB,EAAE,CAAC;YACxB,QAAQ,EAAE,IAAI,CAAC,QAAS;YACxB,KAAK,EAAE,UAAU;SAClB,CAAC,CAAC;IACL,CAAC;CACF","sourcesContent":["import { ScopedElementsMap } from '@open-wc/scoped-elements';\nimport '@vaadin/vaadin-button';\nimport '@vaadin/vaadin-text-field/vaadin-text-area';\nimport { PropertyDeclarations } from 'lit-element';\nimport { html, TemplateResult } from 'lit-html';\nimport { Translatable } from '../../../mixins/translatable';\nimport { parseDuration } from '../../../utils/parse-duration';\nimport { CheckboxChangeEvent, ChoiceChangeEvent, DropdownChangeEvent } from '../../private/events';\nimport { Checkbox, Choice, Dropdown, ErrorScreen, Group, I18N } from '../../private/index';\nimport { DonationChangeEvent } from './DonationChangeEvent';\nimport { DonationSubmitEvent } from './DonationSubmitEvent';\n\ninterface DonationEventsMap {\n change: typeof DonationChangeEvent;\n submit: typeof DonationSubmitEvent;\n}\n\n/**\n * A custom element providing customizable donation forms.\n *\n * @fires Donation#change - Instance of `Donation.events.change`. Emitted after user input triggers a change in the form data.\n * @fires Donation#submit - Instance of `Donation.events.submit`. Emitted when the form is submitted. Cancelling this event will stop the submission.\n *\n * @slot amount - Space below the amount selector, if it's visible.\n * @slot designation - Space below the designation selector, if it's visible.\n * @slot comment - Space below the comment field, if it's visible.\n *\n * @element foxy-donation\n * @since 0.3.0\n */\nexport class Donation extends Translatable {\n /** @readonly */\n public static get scopedElements(): ScopedElementsMap {\n return {\n 'vaadin-text-area': customElements.get('vaadin-text-area'),\n 'x-error-screen': ErrorScreen,\n 'vaadin-button': customElements.get('vaadin-button'),\n 'x-dropdown': Dropdown,\n 'x-checkbox': Checkbox,\n 'x-choice': Choice,\n 'x-group': Group,\n 'x-i18n': I18N,\n };\n }\n\n /** @readonly */\n public static get properties(): PropertyDeclarations {\n return {\n ...super.properties,\n currency: { type: String },\n custom: { type: Array },\n amount: { type: Number },\n amounts: { type: Array },\n frequency: { type: String },\n frequencies: { type: Array },\n designation: { type: Array },\n designations: { type: Array },\n comment: { type: String },\n anonymity: { reflect: true, type: Boolean },\n anonymous: { reflect: true, type: Boolean },\n image: { type: String },\n store: { type: String },\n name: { type: String },\n code: { type: String },\n url: { type: String },\n cart: { type: String },\n target: { type: String },\n empty: { type: String },\n };\n }\n\n /** @readonly */\n public static get events(): DonationEventsMap {\n return {\n change: DonationChangeEvent,\n submit: DonationSubmitEvent,\n };\n }\n\n /**\n * **Required** 3-letter lowercase currency code.\n *\n * **Example:** `\"usd\"`\n */\n public currency: null | string = null;\n\n /**\n * **Required** donation amount in specified currency. When more than one amount option\n * is available, this field will contain the selected amount. This value is deliberately not\n * limited to the predefined options: whatever you set it to will show up in the cart.\n *\n * **Example:** `25`\n */\n public amount: null | number = null;\n\n /**\n * **Required** store domain. This is usually the part after before `.foxycart.com`\n * and after `https://`, e.g. the `foxy-demo` bit of `https://foxy-demo.foxycart.com`.\n * Custom domains like `my.domain.example.com` are also supported since v1.6.1.\n *\n * **Example:** `\"foxy-demo\"`\n */\n public store: null | string = null;\n\n /**\n * **Required** product name for this donation. This will show up in the cart when this form is submitted.\n * See [Products](https://wiki.foxycart.com/v/2.0/products) wiki for more details.\n *\n * **Example:** `\"One-time donation\"`\n */\n public name: null | string = null;\n\n /**\n * Optional parts of the form including a custom (\"other\") option.\n * Adding `amount` to this array will enable custom amount.\n *\n * **Example:** `[\"amount\"]`\n */\n public custom: null | 'amount'[] = null;\n\n /**\n * Optional donation amount variants. If this property is set, the form will render\n * the amount selection interface. If this array includes the value of the `amount` property,\n * it will be pre-selected in the form.\n *\n * **Example:** `[25, 50, 75]`\n */\n public amounts: null | number[] = null;\n\n /**\n * Optional donation frequency string encoded as count (integer) + units (one\n * of: `d` for days, `w` for weeks, `m` for months, `y` for years). A special\n * value for twice a month is also supported: `.5m`. If set, the form will\n * create a subscription with the specified frequency in the cart. This value is deliberately not\n * limited to the predefined options: whatever you set it to will show up in the cart.\n *\n * **Example:** `\"1m\"`\n */\n public frequency: null | string = null;\n\n /**\n * Optional donation frequency variants in the same format as `frequency`. If this property is set,\n * the form will render the frequency selection interface. If this array includes\n * the value of the `frequency` property, it will be pre-selected in the form.\n *\n * **Example:** `[\"7d\", \".5m\", \"1y\"]`\n */\n public frequencies: null | string[] = null;\n\n /**\n * Optional donation designation(s). The form will serialize and pass this value to the cart\n * on submission. This value is deliberately not limited to the predefined options:\n * whatever you set it to will show up in the cart.\n *\n * **Example:** `\"Medical Care\"`\n * **Example:** `[\"Medical Care\", \"Daily Meals\"]`\n */\n public designation: null | string = null;\n\n /**\n * Optional donation designation(s) variants. If this property is set,\n * the form will render the designation selection interface: multiple choice\n * if `designation` is an array and a single choice otherwise. All values overlapping\n * with the `designation` property will be pre-selected in the form.\n *\n * **Example:** `[\"Medical Care\", \"Daily Meals\", \"Area of Greatest Need\"]`\n */\n public designations: null | string[] = null;\n\n /**\n * Optional comment accompanying the donation. If set (even to an empty string),\n * the form will render a comment field. The value of this property will be updated\n * as the customer enters their message and will be added to the order as a custom field in the end.\n *\n * **Example:** `\"\"`\n */\n public comment: null | string = null;\n\n /**\n * Optional switch controlling visibility of the anonymity checkbox. If set to `true`, the form\n * will render the checkbox. All changes in the value are reflected to the attribute.\n *\n * **Example:** `true`\n */\n public anonymity = false;\n\n /**\n * Optional switch marking this donation as anonymous via a custom field when set to `true`. When\n * the anonymity checkbox is rendered, also checks or unchecks it depending on the value.\n * All changes in the value are reflected to the attribute.\n *\n * **Example:** `true`\n */\n public anonymous = false;\n\n /**\n * Optional product image URL (absolute path). This property affects cart UI only.\n * See [Products](https://wiki.foxycart.com/v/2.0/products) wiki for more details.\n *\n * **Example:** `\"https://picsum.photos/320\"`\n */\n public image: null | string = null;\n\n /**\n * Optional product code for this donation. This property affects cart UI only.\n * See [Products](https://wiki.foxycart.com/v/2.0/products) wiki for more details.\n *\n * **Example:** `\"ISBN 978-0-12-345678-9\"`\n */\n public code: null | string = null;\n\n /**\n * Optional product URL for this donation. Accepts a full URL to the product page, starting\n * with `http://` or `https://`, or a relative path to the produt from the store's\n * domain (as configured in the store settings). This property affects cart UI only.\n * See [Products](https://wiki.foxycart.com/v/2.0/products) wiki for more details.\n *\n * **Example:** `\"https://example.com/my-product\"`\n */\n public url: null | string = null;\n\n /**\n * Optional cart\n * If set to 'add' will add items to the cart and, on submit, user is redirected to the cart.\n * If set to 'checkout', the default, on submit user is redirected to checkout directly\n */\n public cart = 'checkout';\n\n /**\n * Optional empty\n * If set to 'true' clears the contents of the cart prior to adding the donation to the cart\n * If set to 'reset' clears the contents of the cart and cookies prior to adding the donation to the cart\n */\n public empty?: string;\n\n /**\n * Optional target to display the form response.\n */\n public target = '_top';\n\n public constructor() {\n super('donation');\n }\n\n /** Submits the form, emitting a cancelable `submit` event. */\n public submit(): void {\n /* istanbul ignore if */\n if (this.dispatchEvent(new DonationSubmitEvent())) this.__form.submit();\n }\n\n public render(): TemplateResult {\n if (!this.currency || !this.amount || !this.store || !this.name) {\n return html`\n <x-error-screen data-testid=\"error\" type=\"setup_needed\" class=\"relative\"></x-error-screen>\n `;\n }\n\n const domain = this.store.includes('.') ? this.store : `${this.store}.foxycart.com`;\n\n return html`\n <form\n target=\"${this.target}\"\n class=\"sr-only\"\n method=\"POST\"\n action=\"https://${domain}/cart\"\n data-testid=\"form\"\n >\n ${[...this.__data.entries()].map(\n ([name, value]) => html`<input type=\"hidden\" name=${name} value=${value} />`\n )}\n </form>\n\n <section>\n ${this.amounts && this.amounts.length > 0\n ? html`\n <x-group frame>\n <x-i18n ns=${this.ns} lang=${this.lang} key=\"amount\" slot=\"header\"></x-i18n>\n <x-choice\n ?custom=${!!this.custom?.includes('amount')}\n .getText=${(v: string) => this.__translateAmount(parseInt(v, 10))}\n .items=${this.amounts.map(String)}\n .value=${this.amount.toString()}\n type=\"integer\"\n lang=${this.lang}\n min=\"1\"\n ns=${this.ns}\n data-testid=\"amount\"\n @change=${(evt: ChoiceChangeEvent) => {\n const value = parseInt(evt.detail as string);\n this.amount = isNaN(value) ? /* istanbul ignore next */ 1 : value;\n }}\n >\n </x-choice>\n </x-group>\n\n <slot name=\"amount\" class=\"block my-m\"></slot>\n `\n : ''}\n </section>\n\n <section>\n ${this.designations && this.designations.length > 0\n ? html`\n <x-dropdown\n .label=${this._t('designation').toString()}\n .items=${this.designations}\n .value=${Array.isArray(this.designation)\n ? '${this.designation[0]}: ${this.designation[1]}'\n : this.designation}\n data-testid=\"designation\"\n @change=${(evt: DropdownChangeEvent) => {\n this.designation = evt.detail as string;\n }}\n >\n </x-dropdown>\n\n <slot name=\"designation\" class=\"block my-m\"></slot>\n `\n : ''}\n </section>\n\n <section>\n ${typeof this.comment === 'string'\n ? html`\n <vaadin-text-area\n placeholder=${this._t('comment_placeholder').toString()}\n value=${this.comment!}\n label=${this._t('comment_label').toString()}\n class=\"w-full\"\n data-testid=\"comment\"\n @input=${(evt: InputEvent) => {\n evt.stopPropagation();\n this.comment = (evt.target as HTMLTextAreaElement).value;\n }}\n >\n </vaadin-text-area>\n\n <slot name=\"comment\" class=\"block my-m\"></slot>\n `\n : ''}\n </section>\n\n <section>\n ${this.anonymity\n ? html`\n <x-checkbox\n class=\"my-m\"\n data-testid=\"anonymity\"\n ?checked=${this.anonymous}\n @change=${(evt: CheckboxChangeEvent) => (this.anonymous = evt.detail)}\n >\n ${this._t('anonymous')}\n </x-checkbox>\n `\n : ''}\n\n <div class=\"flex flex-wrap -m-s\">\n ${this.frequencies && this.frequencies.length > 0\n ? html`\n <div class=\"flex-1 p-s\">\n <x-dropdown\n .value=${this.frequency}\n .items=${this.frequencies}\n .getText=${this.__translateFrequency.bind(this)}\n data-testid=\"frequency\"\n @change=${(evt: DropdownChangeEvent) => {\n this.frequency = evt.detail as string;\n }}\n >\n </x-dropdown>\n </div>\n `\n : ''}\n\n <div class=\"flex-1 p-s\">\n <vaadin-button\n class=\"w-full\"\n theme=\"primary\"\n data-testid=\"submit\"\n @click=${() => this.submit()}\n >\n <x-i18n\n .opts=${{\n amount: this.__translateAmount(this.amount),\n frequency: this.frequency ? this.__translateFrequency(this.frequency) : '',\n }}\n lang=${this.lang}\n key=${this.frequency && !this.frequencies?.length ? 'donate_recurrently' : 'donate'}\n ns=${this.ns}\n >\n </x-i18n>\n </vaadin-button>\n </div>\n </div>\n </section>\n `;\n }\n\n public updated(): void {\n this.dispatchEvent(new DonationChangeEvent(this.__data));\n }\n\n private get __data() {\n const data = new FormData();\n\n if (typeof this.designation === 'string') {\n data.set('Designation', this.designation.trim());\n }\n\n if (typeof this.amount === 'number' && typeof this.currency === 'string') {\n data.set('price', `${this.amount.toFixed(2)}${this.currency}`);\n }\n\n if (this.frequency) data.set('sub_frequency', this.frequency);\n if (typeof this.comment === 'string') data.set('Comment', this.comment.trim());\n if (typeof this.image === 'string') data.set('image', this.image);\n if (typeof this.code === 'string') data.set('code', this.code);\n if (typeof this.name === 'string') data.set('name', this.name.trim());\n if (typeof this.url === 'string') data.set('url', this.url);\n if (typeof this.cart === 'string') data.set('cart', this.cart);\n if (this.empty) data.set('empty', this.empty);\n if (this.anonymous) data.set('Anonymous', 'true');\n\n data.set('quantity', '1');\n\n return data;\n }\n\n private get __form(): HTMLFormElement {\n return this.shadowRoot!.querySelector('form')!;\n }\n\n private __translateFrequency(frequency: string) {\n if (!frequency || frequency.match(/^\\s*$/)) return this._t('frequency_once');\n if (frequency === '.5m') return this._t('frequency_0_5m');\n\n const { count, units } = parseDuration(frequency);\n return this._t('frequency', {\n units: this._t(units, { count }),\n count,\n });\n }\n\n private __translateAmount(amount: number) {\n return amount.toLocaleString(this.lang, {\n minimumFractionDigits: 0,\n currency: this.currency!,\n style: 'currency',\n });\n }\n}\n"]}
1
+ {"version":3,"file":"Donation.js","sourceRoot":"","sources":["../../../../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B,KAAK,EAAE,IAAI,CAAC,EAAE,CAAC,KAAK,EAAE,EAAE,KAAK,EAAE,CAAC;YAChC,KAAK;SACN,CAAC,CAAC;IACL,CAAC;IAEO,iBAAiB,CAAC,MAAc;QACtC,OAAO,MAAM,CAAC,cAAc,CAAC,IAAI,CAAC,IAAI,EAAE;YACtC,qBAAqB,EAAE,CAAC;YACxB,QAAQ,EAAE,IAAI,CAAC,QAAS;YACxB,KAAK,EAAE,UAAU;SAClB,CAAC,CAAC;IACL,CAAC;CACF","sourcesContent":["import { ScopedElementsMap } from '@open-wc/scoped-elements';\nimport '@vaadin/vaadin-button';\nimport '@vaadin/vaadin-text-field/vaadin-text-area';\nimport { PropertyDeclarations } from 'lit-element';\nimport { html, TemplateResult } from 'lit-html';\nimport { Translatable } from '../../../mixins/translatable';\nimport { parseDuration } from '../../../utils/parse-duration';\nimport { CheckboxChangeEvent, ChoiceChangeEvent, DropdownChangeEvent } from '../../private/events';\nimport { Checkbox, Choice, Dropdown, ErrorScreen, Group, I18N } from '../../private/index';\nimport { DonationChangeEvent } from './DonationChangeEvent';\nimport { DonationSubmitEvent } from './DonationSubmitEvent';\n\ninterface DonationEventsMap {\n change: typeof DonationChangeEvent;\n submit: typeof DonationSubmitEvent;\n}\n\n/**\n * A custom element providing customizable donation forms.\n *\n * @fires Donation#change - Instance of `Donation.events.change`. Emitted after user input triggers a change in the form data.\n * @fires Donation#submit - Instance of `Donation.events.submit`. Emitted when the form is submitted. Cancelling this event will stop the submission.\n *\n * @slot amount - Space below the amount selector, if it's visible.\n * @slot designation - Space below the designation selector, if it's visible.\n * @slot comment - Space below the comment field, if it's visible.\n *\n * @element foxy-donation\n * @since 0.3.0\n */\nexport class Donation extends Translatable {\n /** @readonly */\n public static get scopedElements(): ScopedElementsMap {\n return {\n 'vaadin-text-area': customElements.get('vaadin-text-area'),\n 'x-error-screen': ErrorScreen,\n 'vaadin-button': customElements.get('vaadin-button'),\n 'x-dropdown': Dropdown,\n 'x-checkbox': Checkbox,\n 'x-choice': Choice,\n 'x-group': Group,\n 'x-i18n': I18N,\n };\n }\n\n /** @readonly */\n public static get properties(): PropertyDeclarations {\n return {\n ...super.properties,\n currency: { type: String },\n custom: { type: Array },\n amount: { type: Number },\n amounts: { type: Array },\n frequency: { type: String },\n frequencies: { type: Array },\n designation: { type: Array },\n designations: { type: Array },\n comment: { type: String },\n anonymity: { reflect: true, type: Boolean },\n anonymous: { reflect: true, type: Boolean },\n image: { type: String },\n store: { type: String },\n name: { type: String },\n code: { type: String },\n url: { type: String },\n cart: { type: String },\n target: { type: String },\n empty: { type: String },\n };\n }\n\n /** @readonly */\n public static get events(): DonationEventsMap {\n return {\n change: DonationChangeEvent,\n submit: DonationSubmitEvent,\n };\n }\n\n /**\n * **Required** 3-letter lowercase currency code.\n *\n * **Example:** `\"usd\"`\n */\n public currency: null | string = null;\n\n /**\n * **Required** donation amount in specified currency. When more than one amount option\n * is available, this field will contain the selected amount. This value is deliberately not\n * limited to the predefined options: whatever you set it to will show up in the cart.\n *\n * **Example:** `25`\n */\n public amount: null | number = null;\n\n /**\n * **Required** store domain. This is usually the part after before `.foxycart.com`\n * and after `https://`, e.g. the `foxy-demo` bit of `https://foxy-demo.foxycart.com`.\n * Custom domains like `my.domain.example.com` are also supported since v1.6.1.\n *\n * **Example:** `\"foxy-demo\"`\n */\n public store: null | string = null;\n\n /**\n * **Required** product name for this donation. This will show up in the cart when this form is submitted.\n * See [Products](https://wiki.foxycart.com/v/2.0/products) wiki for more details.\n *\n * **Example:** `\"One-time donation\"`\n */\n public name: null | string = null;\n\n /**\n * Optional parts of the form including a custom (\"other\") option.\n * Adding `amount` to this array will enable custom amount.\n *\n * **Example:** `[\"amount\"]`\n */\n public custom: null | 'amount'[] = null;\n\n /**\n * Optional donation amount variants. If this property is set, the form will render\n * the amount selection interface. If this array includes the value of the `amount` property,\n * it will be pre-selected in the form.\n *\n * **Example:** `[25, 50, 75]`\n */\n public amounts: null | number[] = null;\n\n /**\n * Optional donation frequency string encoded as count (integer) + units (one\n * of: `d` for days, `w` for weeks, `m` for months, `y` for years). A special\n * value for twice a month is also supported: `.5m`. If set, the form will\n * create a subscription with the specified frequency in the cart. This value is deliberately not\n * limited to the predefined options: whatever you set it to will show up in the cart.\n *\n * **Example:** `\"1m\"`\n */\n public frequency: null | string = null;\n\n /**\n * Optional donation frequency variants in the same format as `frequency`. If this property is set,\n * the form will render the frequency selection interface. If this array includes\n * the value of the `frequency` property, it will be pre-selected in the form.\n *\n * **Example:** `[\"7d\", \".5m\", \"1y\"]`\n */\n public frequencies: null | string[] = null;\n\n /**\n * Optional donation designation(s). The form will serialize and pass this value to the cart\n * on submission. This value is deliberately not limited to the predefined options:\n * whatever you set it to will show up in the cart.\n *\n * **Example:** `\"Medical Care\"`\n * **Example:** `[\"Medical Care\", \"Daily Meals\"]`\n */\n public designation: null | string = null;\n\n /**\n * Optional donation designation(s) variants. If this property is set,\n * the form will render the designation selection interface: multiple choice\n * if `designation` is an array and a single choice otherwise. All values overlapping\n * with the `designation` property will be pre-selected in the form.\n *\n * **Example:** `[\"Medical Care\", \"Daily Meals\", \"Area of Greatest Need\"]`\n */\n public designations: null | string[] = null;\n\n /**\n * Optional comment accompanying the donation. If set (even to an empty string),\n * the form will render a comment field. The value of this property will be updated\n * as the customer enters their message and will be added to the order as a custom field in the end.\n *\n * **Example:** `\"\"`\n */\n public comment: null | string = null;\n\n /**\n * Optional switch controlling visibility of the anonymity checkbox. If set to `true`, the form\n * will render the checkbox. All changes in the value are reflected to the attribute.\n *\n * **Example:** `true`\n */\n public anonymity = false;\n\n /**\n * Optional switch marking this donation as anonymous via a custom field when set to `true`. When\n * the anonymity checkbox is rendered, also checks or unchecks it depending on the value.\n * All changes in the value are reflected to the attribute.\n *\n * **Example:** `true`\n */\n public anonymous = false;\n\n /**\n * Optional product image URL (absolute path). This property affects cart UI only.\n * See [Products](https://wiki.foxycart.com/v/2.0/products) wiki for more details.\n *\n * **Example:** `\"https://picsum.photos/320\"`\n */\n public image: null | string = null;\n\n /**\n * Optional product code for this donation. This property affects cart UI only.\n * See [Products](https://wiki.foxycart.com/v/2.0/products) wiki for more details.\n *\n * **Example:** `\"ISBN 978-0-12-345678-9\"`\n */\n public code: null | string = null;\n\n /**\n * Optional product URL for this donation. Accepts a full URL to the product page, starting\n * with `http://` or `https://`, or a relative path to the produt from the store's\n * domain (as configured in the store settings). This property affects cart UI only.\n * See [Products](https://wiki.foxycart.com/v/2.0/products) wiki for more details.\n *\n * **Example:** `\"https://example.com/my-product\"`\n */\n public url: null | string = null;\n\n /**\n * Optional cart\n * If set to 'add' will add items to the cart and, on submit, user is redirected to the cart.\n * If set to 'checkout', the default, on submit user is redirected to checkout directly\n */\n public cart = 'checkout';\n\n /**\n * Optional empty\n * If set to 'true' clears the contents of the cart prior to adding the donation to the cart\n * If set to 'reset' clears the contents of the cart and cookies prior to adding the donation to the cart\n */\n public empty?: string;\n\n /**\n * Optional target to display the form response.\n */\n public target = '_top';\n\n public constructor() {\n super('donation');\n }\n\n /** Submits the form, emitting a cancelable `submit` event. */\n public submit(): void {\n /* istanbul ignore if */\n if (this.dispatchEvent(new DonationSubmitEvent())) this.__form.submit();\n }\n\n public render(): TemplateResult {\n if (!this.currency || !this.amount || !this.store || !this.name) {\n return html`\n <x-error-screen data-testid=\"error\" type=\"setup_needed\" class=\"relative\"></x-error-screen>\n `;\n }\n\n const domain = this.store.includes('.') ? this.store : `${this.store}.foxycart.com`;\n\n return html`\n <form\n target=\"${this.target}\"\n class=\"sr-only\"\n method=\"POST\"\n action=\"https://${domain}/cart\"\n data-testid=\"form\"\n >\n ${[...this.__data.entries()].map(\n ([name, value]) => html`<input type=\"hidden\" name=${name} value=${value} />`\n )}\n </form>\n\n <section>\n ${this.amounts && this.amounts.length > 0\n ? html`\n <x-group frame>\n <x-i18n ns=${this.ns} lang=${this.lang} key=\"amount\" slot=\"header\"></x-i18n>\n <x-choice\n ?custom=${!!this.custom?.includes('amount')}\n .getText=${(v: string) => this.__translateAmount(parseFloat(v))}\n .items=${this.amounts.map(String)}\n .value=${this.amount.toString()}\n type=\"number\"\n lang=${this.lang}\n min=\"1\"\n ns=${this.ns}\n data-testid=\"amount\"\n @change=${(evt: ChoiceChangeEvent) => {\n const value = parseFloat(evt.detail as string);\n this.amount = isNaN(value) ? /* istanbul ignore next */ 1 : value;\n }}\n >\n </x-choice>\n </x-group>\n\n <slot name=\"amount\" class=\"block my-m\"></slot>\n `\n : ''}\n </section>\n\n <section>\n ${this.designations && this.designations.length > 0\n ? html`\n <x-dropdown\n .label=${this._t('designation').toString()}\n .items=${this.designations}\n .value=${Array.isArray(this.designation)\n ? '${this.designation[0]}: ${this.designation[1]}'\n : this.designation}\n data-testid=\"designation\"\n @change=${(evt: DropdownChangeEvent) => {\n this.designation = evt.detail as string;\n }}\n >\n </x-dropdown>\n\n <slot name=\"designation\" class=\"block my-m\"></slot>\n `\n : ''}\n </section>\n\n <section>\n ${typeof this.comment === 'string'\n ? html`\n <vaadin-text-area\n placeholder=${this._t('comment_placeholder').toString()}\n value=${this.comment!}\n label=${this._t('comment_label').toString()}\n class=\"w-full\"\n data-testid=\"comment\"\n @input=${(evt: InputEvent) => {\n evt.stopPropagation();\n this.comment = (evt.target as HTMLTextAreaElement).value;\n }}\n >\n </vaadin-text-area>\n\n <slot name=\"comment\" class=\"block my-m\"></slot>\n `\n : ''}\n </section>\n\n <section>\n ${this.anonymity\n ? html`\n <x-checkbox\n class=\"my-m\"\n data-testid=\"anonymity\"\n ?checked=${this.anonymous}\n @change=${(evt: CheckboxChangeEvent) => (this.anonymous = evt.detail)}\n >\n ${this._t('anonymous')}\n </x-checkbox>\n `\n : ''}\n\n <div class=\"flex flex-wrap -m-s\">\n ${this.frequencies && this.frequencies.length > 0\n ? html`\n <div class=\"flex-1 p-s\">\n <x-dropdown\n .value=${this.frequency}\n .items=${this.frequencies}\n .getText=${this.__translateFrequency.bind(this)}\n data-testid=\"frequency\"\n @change=${(evt: DropdownChangeEvent) => {\n this.frequency = evt.detail as string;\n }}\n >\n </x-dropdown>\n </div>\n `\n : ''}\n\n <div class=\"flex-1 p-s\">\n <vaadin-button\n class=\"w-full\"\n theme=\"primary\"\n data-testid=\"submit\"\n @click=${() => this.submit()}\n >\n <x-i18n\n .opts=${{\n amount: this.__translateAmount(this.amount),\n frequency: this.frequency ? this.__translateFrequency(this.frequency) : '',\n }}\n lang=${this.lang}\n key=${this.frequency && !this.frequencies?.length ? 'donate_recurrently' : 'donate'}\n ns=${this.ns}\n >\n </x-i18n>\n </vaadin-button>\n </div>\n </div>\n </section>\n `;\n }\n\n public updated(): void {\n this.dispatchEvent(new DonationChangeEvent(this.__data));\n }\n\n private get __data() {\n const data = new FormData();\n\n if (typeof this.designation === 'string') {\n data.set('Designation', this.designation.trim());\n }\n\n if (typeof this.amount === 'number' && typeof this.currency === 'string') {\n data.set('price', `${this.amount.toFixed(2)}${this.currency}`);\n }\n\n if (this.frequency) data.set('sub_frequency', this.frequency);\n if (typeof this.comment === 'string') data.set('Comment', this.comment.trim());\n if (typeof this.image === 'string') data.set('image', this.image);\n if (typeof this.code === 'string') data.set('code', this.code);\n if (typeof this.name === 'string') data.set('name', this.name.trim());\n if (typeof this.url === 'string') data.set('url', this.url);\n if (typeof this.cart === 'string') data.set('cart', this.cart);\n if (this.empty) data.set('empty', this.empty);\n if (this.anonymous) data.set('Anonymous', 'true');\n\n data.set('quantity', '1');\n\n return data;\n }\n\n private get __form(): HTMLFormElement {\n return this.shadowRoot!.querySelector('form')!;\n }\n\n private __translateFrequency(frequency: string) {\n if (!frequency || frequency.match(/^\\s*$/)) return this._t('frequency_once');\n if (frequency === '.5m') return this._t('frequency_0_5m');\n\n const { count, units } = parseDuration(frequency);\n return this._t('frequency', {\n units: this._t(units, { count }),\n count,\n });\n }\n\n private __translateAmount(amount: number) {\n return amount.toLocaleString(this.lang, {\n minimumFractionDigits: 0,\n currency: this.currency!,\n style: 'currency',\n });\n }\n}\n"]}
@@ -48,6 +48,7 @@ export declare class SignInForm extends Base<Data> {
48
48
  private readonly __renderError;
49
49
  private readonly __renderSubmit;
50
50
  render(): TemplateResult;
51
+ protected _sendPost(edits: Partial<Data>): Promise<Data>;
51
52
  protected _fetch<TResult = Data>(...args: Parameters<Window['fetch']>): Promise<TResult>;
52
53
  private get __mfaSecretCode();
53
54
  }
@@ -370,6 +370,14 @@ export class SignInForm extends Base {
370
370
  </main>
371
371
  `;
372
372
  }
373
+ async _sendPost(edits) {
374
+ const body = JSON.stringify(edits);
375
+ const data = await this._fetch(this.parent, { body, method: 'POST' });
376
+ const rumour = NucleonElement.Rumour(this.group);
377
+ const related = [...this.related, this.parent];
378
+ rumour.share({ data, related, source: data._links.self.href });
379
+ return data;
380
+ }
373
381
  async _fetch(...args) {
374
382
  try {
375
383
  return await super._fetch(...args);
@@ -1 +1 @@
1
- {"version":3,"file":"SignInForm.js","sourceRoot":"","sources":["../../../../src/elements/public/SignInForm/SignInForm.ts"],"names":[],"mappings":"AACA,OAAO,EAAwC,IAAI,EAAE,MAAM,aAAa,CAAC;AAGzE,OAAO,EAAE,iBAAiB,EAAE,wCAAqC;AAEjE,OAAO,EAAE,cAAc,EAAE,4CAAyC;AAGlE,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,QAAQ,IAAI,OAAO,EAAE,MAAM,iBAAiB,CAAC;AAEtD,MAAM,EAAE,GAAG,cAAc,CAAC;AAC1B,MAAM,IAAI,GAAG,cAAc,CAAC,iBAAiB,CAAC,iBAAiB,CAAC,cAAc,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC;AAEtF;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,MAAM,OAAO,UAAW,SAAQ,IAAU;IAA1C;;QAkBE,cAAS,GAAc,EAAE,CAAC;QAE1B,WAAM,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C;QACzE,IAAI;YACF,OAAO,MAAM,KAAK,CAAC,MAAM,CAAC,GAAG,IAAI,CAAC,CAAC;SACpC;QAAC,OAAO,GAAG,EAAE;YACZ,IAAI,QAAQ,GAAG,eAAe,CAAC;YAE/B,IAAI;gBACF,MAAM,IAAI,GAAG,CAAC,MAAO,GAAgB,CAAC,IAAI,EAAE,CAAC,CAAC,SAAS,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC;gBAC7E,IAAI,OAAO,IAAI,KAAK,QAAQ;oBAAE,QAAQ,GAAG,IAAI,CAAC;aAC/C;YAAC,WAAM;gBACN,kCAAkC;aACnC;YAED,MAAM,CAAC,QAAQ,CAAC,CAAC;SAClB;IACH,CAAC;IAED,IAAY,eAAe;;QACzB,MAAM,YAAY,SAAG,IAAI,CAAC,IAAI,CAAC,UAAU,0CAAE,eAAe,CAAC;QAC3D,IAAI,YAAY;YAAE,OAAO,YAAY,CAAC;QAEtC,MAAM,MAAM,GAAG,cAAc,CAAC;QAC9B,MAAM,aAAa,GAAG,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC,KAAK,CAAC,UAAU,CAAC,MAAM,CAAC,CAAC,CAAC;QAC1E,OAAO,aAAa,aAAb,aAAa,uBAAb,aAAa,CAAE,OAAO,CAAC,MAAM,EAAE,EAAE,EAAE,IAAI,GAAG;IACnD,CAAC;CACF","sourcesContent":["import { Data, Templates } from './types';\nimport { PropertyDeclarations, TemplateResult, html } from 'lit-element';\n\nimport { CheckboxElement } from '@vaadin/vaadin-checkbox';\nimport { ConfigurableMixin } from '../../../mixins/configurable';\nimport { EmailFieldElement } from '@vaadin/vaadin-text-field/vaadin-email-field';\nimport { NucleonElement } from '../NucleonElement/NucleonElement';\nimport { NucleonV8N } from '../NucleonElement/types';\nimport { PasswordFieldElement } from '@vaadin/vaadin-text-field/vaadin-password-field';\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 { validate as isEmail } from 'email-validator';\n\nconst NS = 'sign-in-form';\nconst Base = ThemeableMixin(ConfigurableMixin(TranslatableMixin(NucleonElement, NS)));\n\n/**\n * Form element for email/password sign in.\n *\n * @slot email:before\n * @slot email:after\n * @slot password:before\n * @slot password:after\n * @slot new-password:before\n * @slot new-password:after\n * @slot mfa-secret-code:before\n * @slot mfa-secret-code:after\n * @slot mfa-totp-code:before\n * @slot mfa-totp-code:after\n * @slot mfa-remember-device:before\n * @slot mfa-remember-device:after\n * @slot error:before\n * @slot error:after\n * @slot submit:before\n * @slot submit:after\n *\n * @element foxy-sign-in-form\n * @since 1.4.0\n */\nexport class SignInForm extends Base<Data> {\n static get properties(): PropertyDeclarations {\n return {\n ...super.properties,\n issuer: { type: String },\n };\n }\n\n static get v8n(): NucleonV8N<Data> {\n return [\n ({ credential: c }) => !!c?.email || 'email_required',\n ({ credential: c }) => isEmail(c?.email ?? '') || 'email_invalid_email',\n ({ credential: c }) => !!c?.password || 'password_required',\n ({ credential: c }) => (c?.new_password?.length === 0 ? 'new_password_required' : true),\n ({ credential: c }) => (c?.mfa_totp_code?.length === 0 ? 'mfa_totp_code_required' : true),\n ];\n }\n\n templates: Templates = {};\n\n issuer = 'Unknown';\n\n private readonly __emailValidator = () => !this.errors.some(err => err.startsWith('email'));\n\n private readonly __passwordValidator = () => !this.errors.some(err => err.startsWith('password'));\n\n private readonly __newPasswordValidator = () => {\n return !this.errors.some(err => err.startsWith('new_password') && !err.endsWith('_error'));\n };\n\n private readonly __mfaTotpCodeValidator = () => {\n return !this.errors.some(err => err.startsWith('mfa_totp_code') && !err.endsWith('_error'));\n };\n\n private readonly __renderEmail = () => {\n const { disabledSelector, readonlySelector, errors } = this;\n\n const emailError = errors.find(err => err.startsWith('email'));\n const emailErrorKey = emailError?.replace('email', 'v8n');\n const emailErrorMessage = emailErrorKey ? this.t(emailErrorKey).toString() : '';\n\n const isBusy = this.in('busy');\n\n return html`\n <div>\n ${this.renderTemplateOrSlot('email:before')}\n\n <vaadin-email-field\n error-message=${emailErrorMessage}\n data-testid=\"email\"\n class=\"w-full mb-m\"\n label=${this.t('email').toString()}\n value=${ifDefined(this.form.credential?.email)}\n ?disabled=${isBusy || disabledSelector.matches('email', true)}\n ?readonly=${readonlySelector.matches('email', true)}\n .checkValidity=${this.__emailValidator}\n @keydown=${(evt: KeyboardEvent) => evt.key === 'Enter' && this.submit()}\n @input=${(evt: InputEvent) => {\n const email = (evt.target as EmailFieldElement).value;\n const password = this.form.credential?.password ?? '';\n this.edit({ credential: { email, password }, type: 'password' });\n }}\n >\n </vaadin-email-field>\n\n ${this.renderTemplateOrSlot('email:after')}\n </div>\n `;\n };\n\n private readonly __renderPassword = () => {\n const { disabledSelector, readonlySelector, errors } = this;\n\n const passwordError = errors.find(err => err.startsWith('password'));\n const passwordErrorKey = passwordError?.replace('password', 'v8n');\n const passwordErrorMessage = passwordErrorKey ? this.t(passwordErrorKey).toString() : '';\n\n const isBusy = this.in('busy');\n\n return html`\n <div>\n ${this.renderTemplateOrSlot('password:before')}\n\n <vaadin-password-field\n error-message=${passwordErrorMessage}\n data-testid=\"password\"\n class=\"w-full mb-m\"\n label=${this.t('password').toString()}\n value=${ifDefined(this.form.credential?.password)}\n ?disabled=${isBusy || disabledSelector.matches('password', true)}\n ?readonly=${readonlySelector.matches('password', true)}\n .checkValidity=${this.__passwordValidator}\n @keydown=${(evt: KeyboardEvent) => evt.key === 'Enter' && this.submit()}\n @input=${(evt: InputEvent) => {\n const email = this.form.credential?.email ?? '';\n const password = (evt.target as PasswordFieldElement).value;\n this.edit({ credential: { email, password }, type: 'password' });\n }}\n >\n </vaadin-password-field>\n\n ${this.renderTemplateOrSlot('password:after')}\n </div>\n `;\n };\n\n private readonly __renderNewPassword = () => {\n const { disabledSelector, readonlySelector, errors } = this;\n\n const error = errors.find(err => err.startsWith('new_password') && !err.endsWith('_error'));\n const errorKey = error?.replace('new_password', 'v8n');\n const errorMessage = errorKey ? this.t(errorKey).toString() : '';\n\n const isBusy = this.in('busy');\n\n return html`\n <div>\n ${this.renderTemplateOrSlot('new-password:before')}\n\n <vaadin-password-field\n error-message=${errorMessage}\n data-testid=\"new-password\"\n class=\"w-full mb-m\"\n label=${this.t('new_password').toString()}\n value=${ifDefined(this.form.credential?.new_password)}\n ?disabled=${isBusy || disabledSelector.matches('new-password', true)}\n ?readonly=${readonlySelector.matches('new-password', true)}\n .checkValidity=${this.__newPasswordValidator}\n @keydown=${(evt: KeyboardEvent) => evt.key === 'Enter' && this.submit()}\n @input=${(evt: InputEvent) => {\n this.edit({\n type: 'password',\n credential: {\n email: this.form.credential?.email ?? '',\n password: this.form.credential?.password ?? '',\n new_password: (evt.target as PasswordFieldElement).value,\n },\n });\n }}\n >\n </vaadin-password-field>\n\n ${this.renderTemplateOrSlot('new-password:after')}\n </div>\n `;\n };\n\n private readonly __renderMfaTotpCode = () => {\n const { disabledSelector, readonlySelector, errors } = this;\n\n const mfaSecretCode = this.__mfaSecretCode;\n const prefix = 'mfa_totp_code';\n const scope = 'mfa-totp-code';\n const error = errors.find(err => err.startsWith(prefix) && !err.endsWith('_error'));\n const errorKey = error?.replace(prefix, 'v8n');\n const errorMessage = errorKey ? this.t(errorKey).toString() : '';\n\n const isBusy = this.in('busy');\n\n return html`\n <div>\n ${this.renderTemplateOrSlot(`${scope}:before`)}\n\n <vaadin-text-field\n error-message=${errorMessage}\n helper-text=${mfaSecretCode ? this.t('mfa_totp_code_hint') : ''}\n placeholder=\"123456\"\n data-testid=${scope}\n class=\"w-full mb-m\"\n label=${this.t(prefix).toString()}\n value=${ifDefined(this.form.credential?.mfa_totp_code)}\n ?disabled=${isBusy || disabledSelector.matches(scope, true)}\n ?readonly=${readonlySelector.matches(scope, true)}\n .checkValidity=${this.__mfaTotpCodeValidator}\n autofocus\n @keydown=${(evt: KeyboardEvent) => evt.key === 'Enter' && this.submit()}\n @input=${(evt: InputEvent) => {\n const mfaTotpCode = (evt.target as PasswordFieldElement).value;\n const credential = { ...this.form.credential!, mfa_totp_code: mfaTotpCode };\n if (mfaSecretCode) credential.mfa_secret_code = mfaSecretCode;\n this.edit({ type: 'password', credential });\n }}\n >\n </vaadin-text-field>\n\n ${this.renderTemplateOrSlot(`${scope}:after`)}\n </div>\n `;\n };\n\n private readonly __renderMfaSecretCode = () => {\n const scope = 'mfa-secret-code';\n const mfaSecretCode = this.__mfaSecretCode!;\n const issuer = encodeURIComponent(this.issuer);\n const email = encodeURIComponent(this.form.credential?.email ?? '');\n const otpauthUrl = new URL(`otpauth://totp/${issuer}:${email}`);\n\n otpauthUrl.searchParams.set('secret', mfaSecretCode);\n otpauthUrl.searchParams.set('issuer', this.issuer);\n\n return html`\n <div>\n ${this.renderTemplateOrSlot(`${scope}:before`)}\n\n <div\n data-testid=${scope}\n class=\"flex space-x-m overflow-hidden rounded border p-m mb-m border-contrast-10\"\n style=\"background: white; color: black;\"\n >\n <qr-code\n modulesize=\"2\"\n margin=\"0\"\n format=\"svg\"\n class=\"inline-flex\"\n data=${otpauthUrl.toString()}\n >\n </qr-code>\n\n <div class=\"break-all font-semibold leading-s text-xs tracking-widest\">\n ${mfaSecretCode}\n </div>\n </div>\n\n ${this.renderTemplateOrSlot(`${scope}:after`)}\n </div>\n `;\n };\n\n private readonly __renderMfaRememberDevice = () => {\n const { __mfaSecretCode: mfaSecretCode, form, lang, ns } = this;\n const scope = 'mfa-remember-device';\n const isBusy = this.in('busy');\n const isDisabled = isBusy || this.disabledSelector.matches(scope, true);\n\n return html`\n <div>\n ${this.renderTemplateOrSlot(`${scope}:before`)}\n\n <vaadin-checkbox\n data-testid=${scope}\n class=\"mb-m\"\n ?disabled=${isDisabled}\n ?checked=${!!form.credential?.mfa_remember_device}\n @change=${(evt: CustomEvent) => {\n const target = evt.currentTarget as CheckboxElement;\n const credential = {\n ...form.credential!,\n mfa_remember_device: target.checked,\n mfa_totp_code: form.credential?.mfa_totp_code ?? '',\n };\n\n if (mfaSecretCode) credential.mfa_secret_code = mfaSecretCode;\n this.edit({ credential });\n }}\n >\n <foxy-i18n class=\"block\" lang=${lang} key=\"mfa_remember_device\" ns=${ns}></foxy-i18n>\n <foxy-i18n\n class=\"block text-xs ${isDisabled ? 'text-disabled' : 'text-secondary'}\"\n lang=${lang}\n key=\"mfa_remember_device_hint\"\n ns=${ns}\n >\n </foxy-i18n>\n </vaadin-checkbox>\n\n ${this.renderTemplateOrSlot(`${scope}:after`)}\n </div>\n `;\n };\n\n private readonly __renderError = () => {\n return html`\n <div>\n ${this.renderTemplateOrSlot('error:before')}\n\n <p class=\"leading-s flex items-start text-s rounded p-s bg-error-10 text-error\">\n <iron-icon class=\"flex-shrink-0 mr-s icon-inline text-l\" icon=\"lumo:error\"></iron-icon>\n <foxy-i18n data-testid=\"error\" lang=${this.lang} key=${this.errors[0]} ns=${this.ns}>\n </foxy-i18n>\n </p>\n\n ${this.renderTemplateOrSlot('error:after')}\n </div>\n `;\n };\n\n private readonly __renderSubmit = () => {\n const isValid =\n this.in({ idle: { snapshot: { dirty: 'valid' } } }) ||\n this.in({ idle: { snapshot: { clean: 'valid' } } }) ||\n this.in({ idle: { template: { dirty: 'valid' } } }) ||\n this.in({ idle: { template: { clean: 'valid' } } });\n\n return html`\n <div>\n ${this.renderTemplateOrSlot('submit:before')}\n\n <vaadin-button\n data-testid=\"submit\"\n class=\"w-full mt-m\"\n theme=\"primary\"\n ?disabled=${!isValid || this.in('busy') || this.disabledSelector.matches('submit', true)}\n @click=${() => this.submit()}\n >\n <foxy-i18n ns=${this.ns} lang=${this.lang} key=\"sign_in\"></foxy-i18n>\n </vaadin-button>\n\n ${this.renderTemplateOrSlot('submit:after')}\n </div>\n `;\n };\n\n render(): TemplateResult {\n const { hiddenSelector, errors, lang, form, ns } = this;\n const mfaSecretCode = this.__mfaSecretCode;\n const mfaTotpCode = form.credential?.mfa_totp_code;\n\n const isMfaRequired =\n !!mfaSecretCode || !!mfaTotpCode || errors.some(err => err.startsWith('mfa'));\n\n const isNewPasswordRequired =\n typeof this.form.credential?.new_password === 'string' ||\n errors.some(error => error.startsWith('new_password_'));\n\n const isMfaTotpCodeHidden =\n (!isMfaRequired && !mfaTotpCode) || hiddenSelector.matches('mfa-totp-code', true);\n\n const isMfaRememberDeviceHidden =\n !isMfaRequired ||\n (isMfaRequired && mfaSecretCode) ||\n hiddenSelector.matches('mfa-remember-device', true);\n\n const isMfaSecretCodeHidden = !mfaSecretCode || hiddenSelector.matches('mfa-secret-code', true);\n const isNewPasswordHidden = isMfaRequired || hiddenSelector.matches('new-password', true);\n const isFailed = errors.some(error => error.endsWith('_error'));\n const isBusy = this.in('busy');\n\n return html`\n <main aria-live=\"polite\" aria-busy=${isBusy} class=\"relative font-lumo text-m leading-m\">\n ${hiddenSelector.matches('email', true) ? '' : this.__renderEmail()}\n ${isMfaRequired || hiddenSelector.matches('password', true) ? '' : this.__renderPassword()}\n ${isNewPasswordHidden || !isNewPasswordRequired ? '' : this.__renderNewPassword()}\n ${isMfaTotpCodeHidden ? '' : this.__renderMfaTotpCode()}\n ${isMfaSecretCodeHidden ? '' : this.__renderMfaSecretCode()}\n ${isMfaRememberDeviceHidden ? '' : this.__renderMfaRememberDevice()}\n ${hiddenSelector.matches('error', true) || !isFailed ? '' : this.__renderError()}\n ${hiddenSelector.matches('submit', true) ? '' : this.__renderSubmit()}\n\n <div\n data-testid=\"spinner\"\n class=${classMap({\n 'transition duration-500 ease-in-out absolute inset-0 flex': true,\n 'opacity-0 pointer-events-none': !isBusy,\n })}\n >\n <foxy-spinner\n layout=\"vertical\"\n class=\"m-auto p-m bg-base shadow-xs rounded-t-l rounded-b-l\"\n state=\"busy\"\n lang=${lang}\n ns=\"${ns} ${customElements.get('foxy-spinner')?.defaultNS ?? ''}\"\n >\n </foxy-spinner>\n </div>\n </main>\n `;\n }\n\n protected async _fetch<TResult = Data>(...args: Parameters<Window['fetch']>): Promise<TResult> {\n try {\n return await super._fetch(...args);\n } catch (err) {\n let v8nError = 'unknown_error';\n\n try {\n const code = (await (err as Response).json())._embedded['fx:errors'][0].code;\n if (typeof code === 'string') v8nError = code;\n } catch {\n // Unknown error format, ignoring.\n }\n\n throw [v8nError];\n }\n }\n\n private get __mfaSecretCode() {\n const storedSecret = this.form.credential?.mfa_secret_code;\n if (storedSecret) return storedSecret;\n\n const prefix = 'mfa_required';\n const mfaSetupError = this.errors.find(error => error.startsWith(prefix));\n return mfaSetupError?.replace(prefix, '').trim();\n }\n}\n"]}
1
+ {"version":3,"file":"SignInForm.js","sourceRoot":"","sources":["../../../../src/elements/public/SignInForm/SignInForm.ts"],"names":[],"mappings":"AACA,OAAO,EAAwC,IAAI,EAAE,MAAM,aAAa,CAAC;AAGzE,OAAO,EAAE,iBAAiB,EAAE,wCAAqC;AAEjE,OAAO,EAAE,cAAc,EAAE,4CAAyC;AAGlE,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,QAAQ,IAAI,OAAO,EAAE,MAAM,iBAAiB,CAAC;AAEtD,MAAM,EAAE,GAAG,cAAc,CAAC;AAC1B,MAAM,IAAI,GAAG,cAAc,CAAC,iBAAiB,CAAC,iBAAiB,CAAC,cAAc,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC;AAEtF;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,MAAM,OAAO,UAAW,SAAQ,IAAU;IAA1C;;QAkBE,cAAS,GAAc,EAAE,CAAC;QAE1B,WAAM,GAAG,SAAS,CAAC;QAEF,qBAAgB,GAAG,GAAG,EAAE,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,CAAC,UAAU,CAAC,OAAO,CAAC,CAAC,CAAC;QAE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,EAAE,EAAE,EAAE,IAAI,GAAG;IACnD,CAAC;CACF","sourcesContent":["import { Data, Templates } from './types';\nimport { PropertyDeclarations, TemplateResult, html } from 'lit-element';\n\nimport { CheckboxElement } from '@vaadin/vaadin-checkbox';\nimport { ConfigurableMixin } from '../../../mixins/configurable';\nimport { EmailFieldElement } from '@vaadin/vaadin-text-field/vaadin-email-field';\nimport { NucleonElement } from '../NucleonElement/NucleonElement';\nimport { NucleonV8N } from '../NucleonElement/types';\nimport { PasswordFieldElement } from '@vaadin/vaadin-text-field/vaadin-password-field';\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 { validate as isEmail } from 'email-validator';\n\nconst NS = 'sign-in-form';\nconst Base = ThemeableMixin(ConfigurableMixin(TranslatableMixin(NucleonElement, NS)));\n\n/**\n * Form element for email/password sign in.\n *\n * @slot email:before\n * @slot email:after\n * @slot password:before\n * @slot password:after\n * @slot new-password:before\n * @slot new-password:after\n * @slot mfa-secret-code:before\n * @slot mfa-secret-code:after\n * @slot mfa-totp-code:before\n * @slot mfa-totp-code:after\n * @slot mfa-remember-device:before\n * @slot mfa-remember-device:after\n * @slot error:before\n * @slot error:after\n * @slot submit:before\n * @slot submit:after\n *\n * @element foxy-sign-in-form\n * @since 1.4.0\n */\nexport class SignInForm extends Base<Data> {\n static get properties(): PropertyDeclarations {\n return {\n ...super.properties,\n issuer: { type: String },\n };\n }\n\n static get v8n(): NucleonV8N<Data> {\n return [\n ({ credential: c }) => !!c?.email || 'email_required',\n ({ credential: c }) => isEmail(c?.email ?? '') || 'email_invalid_email',\n ({ credential: c }) => !!c?.password || 'password_required',\n ({ credential: c }) => (c?.new_password?.length === 0 ? 'new_password_required' : true),\n ({ credential: c }) => (c?.mfa_totp_code?.length === 0 ? 'mfa_totp_code_required' : true),\n ];\n }\n\n templates: Templates = {};\n\n issuer = 'Unknown';\n\n private readonly __emailValidator = () => !this.errors.some(err => err.startsWith('email'));\n\n private readonly __passwordValidator = () => !this.errors.some(err => err.startsWith('password'));\n\n private readonly __newPasswordValidator = () => {\n return !this.errors.some(err => err.startsWith('new_password') && !err.endsWith('_error'));\n };\n\n private readonly __mfaTotpCodeValidator = () => {\n return !this.errors.some(err => err.startsWith('mfa_totp_code') && !err.endsWith('_error'));\n };\n\n private readonly __renderEmail = () => {\n const { disabledSelector, readonlySelector, errors } = this;\n\n const emailError = errors.find(err => err.startsWith('email'));\n const emailErrorKey = emailError?.replace('email', 'v8n');\n const emailErrorMessage = emailErrorKey ? this.t(emailErrorKey).toString() : '';\n\n const isBusy = this.in('busy');\n\n return html`\n <div>\n ${this.renderTemplateOrSlot('email:before')}\n\n <vaadin-email-field\n error-message=${emailErrorMessage}\n data-testid=\"email\"\n class=\"w-full mb-m\"\n label=${this.t('email').toString()}\n value=${ifDefined(this.form.credential?.email)}\n ?disabled=${isBusy || disabledSelector.matches('email', true)}\n ?readonly=${readonlySelector.matches('email', true)}\n .checkValidity=${this.__emailValidator}\n @keydown=${(evt: KeyboardEvent) => evt.key === 'Enter' && this.submit()}\n @input=${(evt: InputEvent) => {\n const email = (evt.target as EmailFieldElement).value;\n const password = this.form.credential?.password ?? '';\n this.edit({ credential: { email, password }, type: 'password' });\n }}\n >\n </vaadin-email-field>\n\n ${this.renderTemplateOrSlot('email:after')}\n </div>\n `;\n };\n\n private readonly __renderPassword = () => {\n const { disabledSelector, readonlySelector, errors } = this;\n\n const passwordError = errors.find(err => err.startsWith('password'));\n const passwordErrorKey = passwordError?.replace('password', 'v8n');\n const passwordErrorMessage = passwordErrorKey ? this.t(passwordErrorKey).toString() : '';\n\n const isBusy = this.in('busy');\n\n return html`\n <div>\n ${this.renderTemplateOrSlot('password:before')}\n\n <vaadin-password-field\n error-message=${passwordErrorMessage}\n data-testid=\"password\"\n class=\"w-full mb-m\"\n label=${this.t('password').toString()}\n value=${ifDefined(this.form.credential?.password)}\n ?disabled=${isBusy || disabledSelector.matches('password', true)}\n ?readonly=${readonlySelector.matches('password', true)}\n .checkValidity=${this.__passwordValidator}\n @keydown=${(evt: KeyboardEvent) => evt.key === 'Enter' && this.submit()}\n @input=${(evt: InputEvent) => {\n const email = this.form.credential?.email ?? '';\n const password = (evt.target as PasswordFieldElement).value;\n this.edit({ credential: { email, password }, type: 'password' });\n }}\n >\n </vaadin-password-field>\n\n ${this.renderTemplateOrSlot('password:after')}\n </div>\n `;\n };\n\n private readonly __renderNewPassword = () => {\n const { disabledSelector, readonlySelector, errors } = this;\n\n const error = errors.find(err => err.startsWith('new_password') && !err.endsWith('_error'));\n const errorKey = error?.replace('new_password', 'v8n');\n const errorMessage = errorKey ? this.t(errorKey).toString() : '';\n\n const isBusy = this.in('busy');\n\n return html`\n <div>\n ${this.renderTemplateOrSlot('new-password:before')}\n\n <vaadin-password-field\n error-message=${errorMessage}\n data-testid=\"new-password\"\n class=\"w-full mb-m\"\n label=${this.t('new_password').toString()}\n value=${ifDefined(this.form.credential?.new_password)}\n ?disabled=${isBusy || disabledSelector.matches('new-password', true)}\n ?readonly=${readonlySelector.matches('new-password', true)}\n .checkValidity=${this.__newPasswordValidator}\n @keydown=${(evt: KeyboardEvent) => evt.key === 'Enter' && this.submit()}\n @input=${(evt: InputEvent) => {\n this.edit({\n type: 'password',\n credential: {\n email: this.form.credential?.email ?? '',\n password: this.form.credential?.password ?? '',\n new_password: (evt.target as PasswordFieldElement).value,\n },\n });\n }}\n >\n </vaadin-password-field>\n\n ${this.renderTemplateOrSlot('new-password:after')}\n </div>\n `;\n };\n\n private readonly __renderMfaTotpCode = () => {\n const { disabledSelector, readonlySelector, errors } = this;\n\n const mfaSecretCode = this.__mfaSecretCode;\n const prefix = 'mfa_totp_code';\n const scope = 'mfa-totp-code';\n const error = errors.find(err => err.startsWith(prefix) && !err.endsWith('_error'));\n const errorKey = error?.replace(prefix, 'v8n');\n const errorMessage = errorKey ? this.t(errorKey).toString() : '';\n\n const isBusy = this.in('busy');\n\n return html`\n <div>\n ${this.renderTemplateOrSlot(`${scope}:before`)}\n\n <vaadin-text-field\n error-message=${errorMessage}\n helper-text=${mfaSecretCode ? this.t('mfa_totp_code_hint') : ''}\n placeholder=\"123456\"\n data-testid=${scope}\n class=\"w-full mb-m\"\n label=${this.t(prefix).toString()}\n value=${ifDefined(this.form.credential?.mfa_totp_code)}\n ?disabled=${isBusy || disabledSelector.matches(scope, true)}\n ?readonly=${readonlySelector.matches(scope, true)}\n .checkValidity=${this.__mfaTotpCodeValidator}\n autofocus\n @keydown=${(evt: KeyboardEvent) => evt.key === 'Enter' && this.submit()}\n @input=${(evt: InputEvent) => {\n const mfaTotpCode = (evt.target as PasswordFieldElement).value;\n const credential = { ...this.form.credential!, mfa_totp_code: mfaTotpCode };\n if (mfaSecretCode) credential.mfa_secret_code = mfaSecretCode;\n this.edit({ type: 'password', credential });\n }}\n >\n </vaadin-text-field>\n\n ${this.renderTemplateOrSlot(`${scope}:after`)}\n </div>\n `;\n };\n\n private readonly __renderMfaSecretCode = () => {\n const scope = 'mfa-secret-code';\n const mfaSecretCode = this.__mfaSecretCode!;\n const issuer = encodeURIComponent(this.issuer);\n const email = encodeURIComponent(this.form.credential?.email ?? '');\n const otpauthUrl = new URL(`otpauth://totp/${issuer}:${email}`);\n\n otpauthUrl.searchParams.set('secret', mfaSecretCode);\n otpauthUrl.searchParams.set('issuer', this.issuer);\n\n return html`\n <div>\n ${this.renderTemplateOrSlot(`${scope}:before`)}\n\n <div\n data-testid=${scope}\n class=\"flex space-x-m overflow-hidden rounded border p-m mb-m border-contrast-10\"\n style=\"background: white; color: black;\"\n >\n <qr-code\n modulesize=\"2\"\n margin=\"0\"\n format=\"svg\"\n class=\"inline-flex\"\n data=${otpauthUrl.toString()}\n >\n </qr-code>\n\n <div class=\"break-all font-semibold leading-s text-xs tracking-widest\">\n ${mfaSecretCode}\n </div>\n </div>\n\n ${this.renderTemplateOrSlot(`${scope}:after`)}\n </div>\n `;\n };\n\n private readonly __renderMfaRememberDevice = () => {\n const { __mfaSecretCode: mfaSecretCode, form, lang, ns } = this;\n const scope = 'mfa-remember-device';\n const isBusy = this.in('busy');\n const isDisabled = isBusy || this.disabledSelector.matches(scope, true);\n\n return html`\n <div>\n ${this.renderTemplateOrSlot(`${scope}:before`)}\n\n <vaadin-checkbox\n data-testid=${scope}\n class=\"mb-m\"\n ?disabled=${isDisabled}\n ?checked=${!!form.credential?.mfa_remember_device}\n @change=${(evt: CustomEvent) => {\n const target = evt.currentTarget as CheckboxElement;\n const credential = {\n ...form.credential!,\n mfa_remember_device: target.checked,\n mfa_totp_code: form.credential?.mfa_totp_code ?? '',\n };\n\n if (mfaSecretCode) credential.mfa_secret_code = mfaSecretCode;\n this.edit({ credential });\n }}\n >\n <foxy-i18n class=\"block\" lang=${lang} key=\"mfa_remember_device\" ns=${ns}></foxy-i18n>\n <foxy-i18n\n class=\"block text-xs ${isDisabled ? 'text-disabled' : 'text-secondary'}\"\n lang=${lang}\n key=\"mfa_remember_device_hint\"\n ns=${ns}\n >\n </foxy-i18n>\n </vaadin-checkbox>\n\n ${this.renderTemplateOrSlot(`${scope}:after`)}\n </div>\n `;\n };\n\n private readonly __renderError = () => {\n return html`\n <div>\n ${this.renderTemplateOrSlot('error:before')}\n\n <p class=\"leading-s flex items-start text-s rounded p-s bg-error-10 text-error\">\n <iron-icon class=\"flex-shrink-0 mr-s icon-inline text-l\" icon=\"lumo:error\"></iron-icon>\n <foxy-i18n data-testid=\"error\" lang=${this.lang} key=${this.errors[0]} ns=${this.ns}>\n </foxy-i18n>\n </p>\n\n ${this.renderTemplateOrSlot('error:after')}\n </div>\n `;\n };\n\n private readonly __renderSubmit = () => {\n const isValid =\n this.in({ idle: { snapshot: { dirty: 'valid' } } }) ||\n this.in({ idle: { snapshot: { clean: 'valid' } } }) ||\n this.in({ idle: { template: { dirty: 'valid' } } }) ||\n this.in({ idle: { template: { clean: 'valid' } } });\n\n return html`\n <div>\n ${this.renderTemplateOrSlot('submit:before')}\n\n <vaadin-button\n data-testid=\"submit\"\n class=\"w-full mt-m\"\n theme=\"primary\"\n ?disabled=${!isValid || this.in('busy') || this.disabledSelector.matches('submit', true)}\n @click=${() => this.submit()}\n >\n <foxy-i18n ns=${this.ns} lang=${this.lang} key=\"sign_in\"></foxy-i18n>\n </vaadin-button>\n\n ${this.renderTemplateOrSlot('submit:after')}\n </div>\n `;\n };\n\n render(): TemplateResult {\n const { hiddenSelector, errors, lang, form, ns } = this;\n const mfaSecretCode = this.__mfaSecretCode;\n const mfaTotpCode = form.credential?.mfa_totp_code;\n\n const isMfaRequired =\n !!mfaSecretCode || !!mfaTotpCode || errors.some(err => err.startsWith('mfa'));\n\n const isNewPasswordRequired =\n typeof this.form.credential?.new_password === 'string' ||\n errors.some(error => error.startsWith('new_password_'));\n\n const isMfaTotpCodeHidden =\n (!isMfaRequired && !mfaTotpCode) || hiddenSelector.matches('mfa-totp-code', true);\n\n const isMfaRememberDeviceHidden =\n !isMfaRequired ||\n (isMfaRequired && mfaSecretCode) ||\n hiddenSelector.matches('mfa-remember-device', true);\n\n const isMfaSecretCodeHidden = !mfaSecretCode || hiddenSelector.matches('mfa-secret-code', true);\n const isNewPasswordHidden = isMfaRequired || hiddenSelector.matches('new-password', true);\n const isFailed = errors.some(error => error.endsWith('_error'));\n const isBusy = this.in('busy');\n\n return html`\n <main aria-live=\"polite\" aria-busy=${isBusy} class=\"relative font-lumo text-m leading-m\">\n ${hiddenSelector.matches('email', true) ? '' : this.__renderEmail()}\n ${isMfaRequired || hiddenSelector.matches('password', true) ? '' : this.__renderPassword()}\n ${isNewPasswordHidden || !isNewPasswordRequired ? '' : this.__renderNewPassword()}\n ${isMfaTotpCodeHidden ? '' : this.__renderMfaTotpCode()}\n ${isMfaSecretCodeHidden ? '' : this.__renderMfaSecretCode()}\n ${isMfaRememberDeviceHidden ? '' : this.__renderMfaRememberDevice()}\n ${hiddenSelector.matches('error', true) || !isFailed ? '' : this.__renderError()}\n ${hiddenSelector.matches('submit', true) ? '' : this.__renderSubmit()}\n\n <div\n data-testid=\"spinner\"\n class=${classMap({\n 'transition duration-500 ease-in-out absolute inset-0 flex': true,\n 'opacity-0 pointer-events-none': !isBusy,\n })}\n >\n <foxy-spinner\n layout=\"vertical\"\n class=\"m-auto p-m bg-base shadow-xs rounded-t-l rounded-b-l\"\n state=\"busy\"\n lang=${lang}\n ns=\"${ns} ${customElements.get('foxy-spinner')?.defaultNS ?? ''}\"\n >\n </foxy-spinner>\n </div>\n </main>\n `;\n }\n\n protected async _sendPost(edits: Partial<Data>): Promise<Data> {\n const body = JSON.stringify(edits);\n const data = await this._fetch(this.parent, { body, method: 'POST' });\n\n const rumour = NucleonElement.Rumour(this.group);\n const related = [...this.related, this.parent];\n rumour.share({ data, related, source: data._links.self.href });\n\n return data;\n }\n\n protected async _fetch<TResult = Data>(...args: Parameters<Window['fetch']>): Promise<TResult> {\n try {\n return await super._fetch(...args);\n } catch (err) {\n let v8nError = 'unknown_error';\n\n try {\n const code = (await (err as Response).json())._embedded['fx:errors'][0].code;\n if (typeof code === 'string') v8nError = code;\n } catch {\n // Unknown error format, ignoring.\n }\n\n throw [v8nError];\n }\n }\n\n private get __mfaSecretCode() {\n const storedSecret = this.form.credential?.mfa_secret_code;\n if (storedSecret) return storedSecret;\n\n const prefix = 'mfa_required';\n const mfaSetupError = this.errors.find(error => error.startsWith(prefix));\n return mfaSetupError?.replace(prefix, '').trim();\n }\n}\n"]}
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@foxy.io/elements",
3
3
  "type": "module",
4
- "version": "1.21.3",
4
+ "version": "1.21.5",
5
5
  "description": "E-commerce web components by Foxy.",
6
6
  "repository": {
7
7
  "type": "git",
@@ -1 +0,0 @@
1
- import{_ as e}from"./shared-a8ced8bf.js";import"./shared-62c088b7.js";import"./shared-be66c2e7.js";import"./shared-5a4829e3.js";import"./shared-bd252323.js";import"./shared-08156595.js";import"./shared-7d4fb1a2.js";import"./shared-ed0dee03.js";import{d as t,P as a,A as s,L as i,c as n,h as r}from"./shared-7f33a83a.js";import"./shared-4849ef5b.js";import"./shared-6cb1015f.js";import{p as o}from"./shared-7097364f.js";import{a as l,x as d}from"./shared-2cc638ad.js";import{T as c,U as u,V as h,W as m,X as v,Y as g,Z as p,$ as y,b,a0 as f,a1 as x,a2 as _,a3 as w,a4 as $,a5 as E,a6 as T,m as k,a7 as S}from"./shared-dcdb6ea1.js";import{I as V}from"./shared-4f037e43.js";import{s as C}from"./shared-11c2efc8.js";import{i as A}from"./shared-e3ab56d1.js";var M={raise:c,send:u,sendParent:h,sendUpdate:m,log:v,cancel:g,start:p,stop:y,assign:b,after:f,done:x,respond:_,forwardTo:w,escalate:$,choose:E,pure:T};const j=t((e=>t=>{const{element:i,name:n,strings:r}=t.committer;if(2!==r.length||""!==r[0]||""!==r[1])throw new Error("live directive bindings must not contain any static values");if(t.committer.parts.length>1)throw new Error("live directive must be the only directive for an attribute or property");if(t instanceof a)i[n]!==e&&t.setValue(e);else{if(!(t instanceof s))throw new Error("live directive can only be used on attributes or properties");i.getAttribute(n)!==e&&t.setValue(e)}}));class I extends CustomEvent{constructor(e){super("change",{detail:e})}}class U extends CustomEvent{constructor(e){super("change",{detail:e})}}class D extends U{}let P,q,F=e=>e;class L extends(l(V(i))){constructor(){super(...arguments),this.label="",this.value="",this.disabled=!1,this.readonly=!1,this.errorMessage="",this.__i18n={formatValue:e=>e.join(""),parseValue:e=>{const{count:t,units:a}=o(e);return[t.toString(),a]}},this.__getItems=k((e=>{const t=o(e).count;return[{value:"d",label:this.t("day",{count:t})},{value:"w",label:this.t("week",{count:t})},{value:"m",label:this.t("month",{count:t})},{value:"y",label:this.t("year",{count:t})}]}))}static get properties(){return e(e({},super.properties),{},{checkValidity:{attribute:!1},errorMessage:{type:String,attribute:"error-message"},disabled:{type:Boolean,reflect:!0},readonly:{type:Boolean,reflect:!0},label:{type:String},value:{type:String}})}static get styles(){return n(P||(P=F`:host{display:block}vaadin-custom-field{width:100%;font-size:0;line-height:0;padding-top:0!important}vaadin-custom-field::part(label){padding-bottom:var(--lumo-space-s)}vaadin-custom-field::part(error-message)[aria-hidden=false]{padding-top:var(--lumo-space-xs)}vaadin-combo-box,vaadin-integer-field{width:calc(50% - (var(--lumo-space-s)/ 2))}vaadin-integer-field{margin-right:var(--lumo-space-s);padding:0}vaadin-combo-box::part(text-field){padding:0}`))}render(){return r(q||(q=F` <vaadin-custom-field data-testid="field" .i18n="${0}" .label="${0}" .value="${0}" ?disabled="${0}" ?readonly="${0}" .errorMessage="${0}" .checkValidity="${0}" @change="${0}"> <vaadin-integer-field data-testid="value" min="1" max="999" has-controls prevent-invalid-input ?invalid="${0}" ?disabled="${0}" ?readonly="${0}"> </vaadin-integer-field> <vaadin-combo-box data-testid="units" item-value-path="value" item-label-path="label" .items="${0}" ?invalid="${0}" ?disabled="${0}" ?readonly="${0}"> </vaadin-combo-box> </vaadin-custom-field> `),this.__i18n,this.label,j(this.value),this.disabled,this.readonly,this.errorMessage,this.checkValidity,this.__handleChange,!this.checkValidity(),this.disabled,this.readonly,this.__getItems(this.value),!this.checkValidity(),this.disabled,this.readonly)}updated(e){super.updated(e);const t=this.renderRoot.firstElementChild;t.value!==this.value&&(t.value=this.value)}checkValidity(){return!0}__handleChange(e){const t=e.target;this.value=t.value,this.dispatchEvent(new D(this.value))}}const B=S({id:"choice",type:"parallel",context:{defaultCustomValue:"",customValue:null,custom:!1,items:[],value:null,type:"text",min:null,max:null},states:{mutability:{initial:"editable",states:{editable:{},readonly:{}},on:{SET_READONLY:[{target:".editable",cond:"isPayloadFalsey"},{target:".readonly",cond:"isPayloadTruthy"}]}},interactivity:{initial:"enabled",states:{enabled:{},disabled:{}},on:{SET_DISABLED:[{target:".enabled",cond:"isPayloadFalsey"},{target:".disabled",cond:"isPayloadTruthy"}]}},selection:{initial:"unknown",states:{unknown:{always:[{target:"multiple",cond:"isValueArray"},{target:"single"}]},none:{},single:{},multiple:{}}},extension:{initial:"unknown",states:{unknown:{always:[{target:"present",cond:"hasCustom"},{target:"absent"}]},absent:{},present:{initial:"unknown",states:{unknown:{always:[{target:"selected",cond:"hasCustomValue"},{target:"available"}]},available:{on:{SET_TYPE:{actions:"setType"}}},selected:{initial:"unknown",states:{unknown:{always:[{target:"integer",cond:"showsIntegerField"},{target:"textarea",cond:"showsTextarea"},{target:"frequency",cond:"showsFrequency"},{target:"text"}]},text:{},frequency:{},textarea:{},integer:{type:"parallel",states:{min:{initial:"unknown",states:{unknown:{always:[{target:"custom",cond:"hasMinConstraint"},{target:"none"}]},none:{},custom:{}}},max:{initial:"unknown",states:{unknown:{always:[{target:"custom",cond:"hasMaxConstraint"},{target:"none"}]},none:{},custom:{}}}}}}}}}}}},on:{SET_DEFAULT_CUSTOM_VALUE:{actions:"setDefaultCustomValue"},SET_CUSTOM:{actions:"setCustom",target:[".selection.unknown",".extension.unknown"]},SET_VALUE:{actions:"setValue",target:[".selection.unknown",".extension.unknown"]},SET_ITEMS:{actions:"setItems",target:[".selection.unknown",".extension.unknown"]},SET_TYPE:{actions:"setType",target:".extension.unknown"},SET_MIN:{actions:"setMin",target:".extension.unknown"},SET_MAX:{actions:"setMax",target:".extension.unknown"}}},{guards:{isPayloadFalsey:(e,t)=>!t.data,isPayloadTruthy:(e,t)=>!!t.data,isValueArray:e=>Array.isArray(e.value),showsIntegerField:e=>"integer"===e.type,showsFrequency:e=>"frequency"===e.type,showsTextarea:e=>"textarea"===e.type,hasMinConstraint:e=>"number"==typeof e.min,hasMaxConstraint:e=>"number"==typeof e.max,hasCustomValue:e=>"string"==typeof e.customValue,hasCustom:e=>e.custom},actions:{setDefaultCustomValue:M.assign({defaultCustomValue:(e,t)=>t.data}),setValue:M.assign({value:(e,t)=>t.data,customValue:(e,t)=>Array.isArray(t.data)?t.data.find((t=>!e.items.includes(t))):e.items.includes(t.data)?null:t.data}),setCustom:M.assign({custom:(e,t)=>t.data}),setItems:M.assign({items:(e,t)=>t.data}),setType:M.assign({type:(e,t)=>t.data}),setMin:M.assign({min:(e,t)=>t.data}),setMax:M.assign({max:(e,t)=>t.data})}});let N,O,Y,R,X,z,W,Z,G,H,J,K,Q,ee=e=>e;const te=`@foxy.io/elements::other[${(Math.pow(10,10)*Math.random()).toFixed(0)}]`;class ae extends d{constructor(){super(...arguments),this.getText=e=>e,this.__service=A(B).onChange((()=>this.requestUpdate())).onTransition((({changed:e})=>e&&this.requestUpdate())).start()}static get scopedElements(){return{"vaadin-integer-field":customElements.get("vaadin-integer-field"),"vaadin-text-field":customElements.get("vaadin-text-field"),"x-frequency-input":L,"vaadin-text-area":customElements.get("vaadin-text-area"),"iron-icon":customElements.get("iron-icon")}}static get styles(){return[super.styles,n(Y||(Y=ee`:host{--item-width:calc((var(--lumo-space-m) * 2) + 1.25rem)}.ml-xxl{margin-left:var(--item-width)}.item{height:var(--lumo-size-l);width:var(--item-width)}.radio{height:1.25rem;width:1.25rem}.check{height:1.125rem;width:1.125rem}.dot{height:.5rem;width:.5rem}`))]}static get properties(){return e(e({},super.properties),{},{defaultCustomValue:{type:String,attribute:"default-custom-value"},disabled:{type:Boolean},readonly:{type:Boolean},custom:{type:Boolean},type:{type:String},min:{type:Number},max:{type:Number},value:{type:Array},items:{type:Array},getText:{attribute:!1}})}get defaultCustomValue(){return this.__service.state.context.defaultCustomValue}set defaultCustomValue(e){this.__service.send("SET_DEFAULT_CUSTOM_VALUE",{data:e})}get readonly(){return this.__service.state.matches("mutability.readonly")}set readonly(e){this.__service.send("SET_READONLY",{data:e})}get disabled(){return this.__service.state.matches("interactivity.disabled")}set disabled(e){this.__service.send("SET_DISABLED",{data:e})}get custom(){return this.__service.state.matches("extension.present")}set custom(e){this.__service.send("SET_CUSTOM",{data:e})}get type(){return this.__service.state.context.type}set type(e){this.__service.send("SET_TYPE",{data:e})}get min(){return this.__service.state.context.min}set min(e){this.__service.send("SET_MIN",{data:e})}get max(){return this.__service.state.context.max}set max(e){this.__service.send("SET_MAX",{data:e})}get value(){return this.__service.state.context.value}set value(e){this.__service.send("SET_VALUE",{data:e})}get items(){return this.__service.state.context.items}set items(e){this.__service.send("SET_ITEMS",{data:e})}render(){const e=this.custom?[...this.items,te]:this.items,t=Array.isArray(this.value),a=this.__service.state.matches("extension.present.selected"),s=r(R||(R=ee` ${0} `),e.map(((e,s,i)=>{var n;const o=this.custom&&s===i.length-1,l=o?a:t?!!(null===(n=this.value)||void 0===n?void 0:n.includes(e)):e===String(this.value),d=this.disabled||!this._isI18nReady,c=C({value:o?te:e,name:t?e:"choice","data-testid":`item-${e}`,"?disabled":d,"@change":t=>{if(this.readonly)return t.preventDefault();const a=t.target.checked,s=e===te?this.defaultCustomValue:e,i=this.value;Array.isArray(i)?this.value=e===te?a?[...i,s]:i.slice(0,i.length-1):a?[s,...i]:i.filter((e=>e!==s)):this.value=a?s:null,this.dispatchEvent(new I(this.value))}}),u=r(X||(X=ee` <div> ${0} </div> `),e===te?this._t("choice.other").toString():r(z||(z=ee`<slot name="${0}">${0}</slot>`),`${e}-label`,this.getText(e)));return r(W||(W=ee` <div class="ml-xxl border-t border-contrast-10 ${0}"></div> ${0} <div class="mr-m ml-xxl"> ${0} ${0} </div> `),s?"":"hidden",t?function(e,t,a,s,i){const n="transition ease-in-out duration-200",o=`${n} transform ${a?"scale-100":"scale-0"} ${e?"text-contrast-70":"text-tint"}`;return r(O||(O=ee` <label class="group flex items-center ${0}"> <div class="item flex items-center justify-center flex-shrink-0 text-primary-contrast"> <div class="check rounded-s ${0} ${0} ${0} focus-within-shadow-outline"> <iron-icon icon="lumo:checkmark" class="block w-full h-full ${0}"></iron-icon> <input type="checkbox" class="sr-only" .checked="${0}" ...="${0}"> </div> </div> <div class="font-lumo leading-m ${0}">${0}</div> </label> `),t||e?"":"cursor-pointer","border "+(e?"border-dashed border-contrast-30":"border-transparent"),n,e?"":t?a?"bg-primary-50":"bg-contrast-10":a?"bg-primary":"bg-contrast-20 group-hover-bg-contrast-30",o,a,s,t?"text-disabled":e?"text-secondary":"text-body",i)}(this.readonly,d,l,c,u):function(e,t,a,s,i){const n="transition ease-in-out duration-200",o=`${n} ${t||e?"":"shadow-xs"} transform ${a?"scale-100":"scale-0"} ${e?"bg-contrast-70":"bg-tint"}`;return r(N||(N=ee` <label class="group flex items-center ${0}"> <div class="item flex items-center justify-center flex-shrink-0"> <div class="flex radio rounded-full ${0} ${0} ${0} focus-within-shadow-outline"> <div class="dot m-auto rounded-full ${0}"></div> <input type="radio" class="sr-only" .checked="${0}" ...="${0}"> </div> </div> <div class="font-lumo leading-m ${0}">${0}</div> </label> `),t||e?"":"cursor-pointer","border "+(e?"border-dashed border-contrast-30":"border-transparent"),n,e?"":t?a?"bg-primary-50":"bg-contrast-10":a?"bg-primary":"bg-contrast-20 group-hover-bg-contrast-30",o,a,s,t?"text-disabled":e?"text-secondary":"text-body",i)}(this.readonly,d,l,c,u),e===te&&a?this.__field:"",e!==te?r(Z||(Z=ee`<slot name="${0}"></slot>`),e):"")})));return r(G||(G=ee`<form>${0}</form> `),s)}get __field(){const e=C({placeholder:this._t("choice.other").toString(),class:"w-full mb-m",value:this.__service.state.context.customValue,max:this.max,min:this.min,ns:this.ns,"?disabled":this.disabled,"?readonly":this.readonly,"data-testid":"field","@change":e=>{e.stopPropagation();const t=e.target.value;Array.isArray(this.value)?this.value=this.value.slice(0,this.value.length-1).concat(t):this.value=t,this.dispatchEvent(new I(this.value))}});return"frequency"===this.type?r(H||(H=ee`<x-frequency-input ...="${0}"></x-frequency-input>`),e):"integer"===this.type?r(J||(J=ee`<vaadin-integer-field ...="${0}" has-controls></vaadin-integer-field>`),e):"textarea"===this.type?r(K||(K=ee`<vaadin-text-area ...="${0}"></vaadin-text-area>`),e):r(Q||(Q=ee`<vaadin-text-field ...="${0}"></vaadin-text-field>`),e)}}export{ae as C,U as D,L as F,I as a,M as b};