@foxy.io/elements 1.13.0-beta.2 → 1.14.0-beta.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/dist/cdn/foxy-access-recovery-form.js +1 -1
- package/dist/cdn/foxy-address-card.js +1 -1
- package/dist/cdn/foxy-address-form.js +1 -1
- package/dist/cdn/foxy-applied-tax-card.js +1 -1
- package/dist/cdn/foxy-attribute-card.js +1 -1
- package/dist/cdn/foxy-attribute-form.js +1 -1
- package/dist/cdn/foxy-cancellation-form.js +1 -1
- package/dist/cdn/foxy-collection-page.js +1 -1
- package/dist/cdn/foxy-collection-pages.js +1 -1
- package/dist/cdn/foxy-custom-field-card.js +1 -1
- package/dist/cdn/foxy-custom-field-form.js +1 -1
- package/dist/cdn/foxy-customer-api.js +1 -1
- package/dist/cdn/foxy-customer-card.js +1 -1
- package/dist/cdn/foxy-customer-form.js +1 -1
- package/dist/cdn/foxy-customer-portal-settings.js +18 -18
- package/dist/cdn/foxy-customer-portal.js +1 -1
- package/dist/cdn/foxy-customer.js +4 -4
- package/dist/cdn/foxy-customers-table.js +1 -1
- package/dist/cdn/foxy-discount-card.js +1 -1
- package/dist/cdn/foxy-donation.js +1 -1
- package/dist/cdn/foxy-email-template-form.js +1 -0
- package/dist/cdn/foxy-error-entry-card.js +1 -1
- package/dist/cdn/foxy-form-dialog.js +1 -1
- package/dist/cdn/foxy-i18n.js +1 -1
- package/dist/cdn/foxy-items-form.js +1 -1
- package/dist/cdn/foxy-nucleon-element.js +1 -1
- package/dist/cdn/foxy-payment-card.js +1 -1
- package/dist/cdn/foxy-payment-method-card.js +1 -1
- package/dist/cdn/foxy-query-builder.js +1 -1
- package/dist/cdn/foxy-sign-in-form.js +1 -1
- package/dist/cdn/foxy-spinner.js +2 -2
- package/dist/cdn/foxy-subscription-card.js +1 -1
- package/dist/cdn/foxy-subscription-form.js +26 -9
- package/dist/cdn/foxy-subscriptions-table.js +1 -1
- package/dist/cdn/foxy-table.js +1 -1
- package/dist/cdn/foxy-tax-card.js +1 -1
- package/dist/cdn/foxy-tax-form.js +1 -1
- package/dist/cdn/foxy-template-config-form.js +1 -0
- package/dist/cdn/foxy-template-form.js +1 -0
- package/dist/cdn/foxy-transaction-card.js +1 -1
- package/dist/cdn/foxy-transactions-table.js +1 -1
- package/dist/cdn/foxy-user-form.js +1 -1
- package/dist/cdn/foxy-users-table.js +1 -1
- package/dist/cdn/{shared-145cc9eb.js → shared-00070cc4.js} +1 -1
- package/dist/cdn/{shared-d4dad105.js → shared-00563cb0.js} +1 -1
- package/dist/cdn/shared-007c4e34.js +1 -0
- package/dist/cdn/shared-07134f93.js +14 -0
- package/dist/cdn/shared-0ced76a0.js +358 -0
- package/dist/cdn/shared-0f9809ab.js +1 -0
- package/dist/cdn/{shared-f4119f12.js → shared-16f72e27.js} +1 -1
- package/dist/cdn/shared-1761daef.js +15 -0
- package/dist/cdn/{shared-5fedf5e4.js → shared-200f613b.js} +2 -2
- package/dist/cdn/{shared-4059f633.js → shared-218ba06e.js} +1 -1
- package/dist/cdn/shared-31d03530.js +264 -0
- package/dist/cdn/{shared-e9920617.js → shared-34b2c1e2.js} +1 -1
- package/dist/cdn/{shared-cf248335.js → shared-44cfc617.js} +1 -1
- package/dist/cdn/{shared-45d647e4.js → shared-46ee137f.js} +1 -1
- package/dist/cdn/{shared-b0b1d248.js → shared-4ba926ca.js} +1 -1
- package/dist/cdn/{shared-f0199313.js → shared-593f7e2c.js} +1 -1
- package/dist/cdn/shared-59e44f29.js +1 -0
- package/dist/cdn/{shared-f47647ac.js → shared-5d94bacb.js} +1 -1
- package/dist/cdn/{shared-cd700eac.js → shared-60126eee.js} +1 -1
- package/dist/cdn/{shared-17968c53.js → shared-63eaded9.js} +3 -3
- package/dist/cdn/shared-6b7602c7.js +1 -0
- package/dist/cdn/{shared-98ee7fad.js → shared-6d45a07b.js} +1 -1
- package/dist/cdn/{shared-91a9e922.js → shared-7007dedb.js} +4 -4
- package/dist/cdn/{shared-84fa75d9.js → shared-9221e6b2.js} +1 -1
- package/dist/cdn/{shared-2860a3d3.js → shared-94b0ae99.js} +2 -2
- package/dist/cdn/shared-a3d2c48e.js +314 -0
- package/dist/cdn/shared-a46edf4b.js +1 -0
- package/dist/cdn/{shared-54702b33.js → shared-b0f0e8b5.js} +1 -1
- package/dist/cdn/{shared-b77179fd.js → shared-b24377bf.js} +1 -1
- package/dist/cdn/{shared-ed4ed7a5.js → shared-b710881a.js} +2 -2
- package/dist/cdn/{shared-3ae39e52.js → shared-bb824ab4.js} +3 -3
- package/dist/cdn/{shared-d9159fe1.js → shared-c5ae5d33.js} +1 -1
- package/dist/cdn/{shared-f2cf6cfb.js → shared-ca7c3b9a.js} +1 -1
- package/dist/cdn/shared-d01035c5.js +1 -0
- package/dist/cdn/{shared-67157a25.js → shared-d05c93a5.js} +1 -1
- package/dist/cdn/{shared-a99dea97.js → shared-da787055.js} +1 -1
- package/dist/cdn/{shared-036a8b21.js → shared-daf6b763.js} +1 -1
- package/dist/cdn/shared-df573cea.js +12 -0
- package/dist/cdn/{shared-e5de8675.js → shared-e7f8ffe9.js} +1 -1
- package/dist/cdn/{shared-54c485d2.js → shared-ec861f31.js} +21 -21
- package/dist/cdn/{shared-e0248713.js → shared-f0a83bd6.js} +1 -1
- package/dist/cdn/shared-fe8a7aa2.js +1 -0
- package/dist/cdn/{shared-747b0842.js → shared-ff79f3f9.js} +1 -1
- package/dist/cdn/translations/shared/en.json +94 -1
- package/dist/elements/private/Checkbox/Checkbox.d.ts +3 -1
- package/dist/elements/private/Checkbox/Checkbox.js +45 -12
- package/dist/elements/private/Checkbox/Checkbox.js.map +1 -1
- package/dist/elements/private/Choice/Choice.js +9 -9
- package/dist/elements/private/Choice/Choice.js.map +1 -1
- package/dist/elements/private/Group/Group.js +1 -1
- package/dist/elements/private/Group/Group.js.map +1 -1
- package/dist/elements/private/I18N/I18N.js +1 -1
- package/dist/elements/private/I18N/I18N.js.map +1 -1
- package/dist/elements/public/AddressForm/AddressForm.js +8 -4
- package/dist/elements/public/AddressForm/AddressForm.js.map +1 -1
- package/dist/elements/public/AttributeForm/AttributeForm.js +8 -4
- package/dist/elements/public/AttributeForm/AttributeForm.js.map +1 -1
- package/dist/elements/public/CustomFieldForm/CustomFieldForm.js +8 -4
- package/dist/elements/public/CustomFieldForm/CustomFieldForm.js.map +1 -1
- package/dist/elements/public/CustomerForm/CustomerForm.js +8 -4
- package/dist/elements/public/CustomerForm/CustomerForm.js.map +1 -1
- package/dist/elements/public/EmailTemplateForm/EmailTemplateForm.d.ts +46 -0
- package/dist/elements/public/EmailTemplateForm/EmailTemplateForm.js +350 -0
- package/dist/elements/public/EmailTemplateForm/EmailTemplateForm.js.map +1 -0
- package/dist/elements/public/EmailTemplateForm/index.d.ts +9 -0
- package/dist/elements/public/EmailTemplateForm/index.js +11 -0
- package/dist/elements/public/EmailTemplateForm/index.js.map +1 -0
- package/dist/elements/public/EmailTemplateForm/types.d.ts +17 -0
- package/dist/elements/public/EmailTemplateForm/types.js +2 -0
- package/dist/elements/public/EmailTemplateForm/types.js.map +1 -0
- package/dist/elements/public/ItemsForm/ItemsForm.js +2 -2
- package/dist/elements/public/ItemsForm/ItemsForm.js.map +1 -1
- package/dist/elements/public/NucleonElement/serveFromCache.js +1 -0
- package/dist/elements/public/NucleonElement/serveFromCache.js.map +1 -1
- package/dist/elements/public/TaxForm/TaxForm.d.ts +2 -0
- package/dist/elements/public/TaxForm/TaxForm.js +45 -12
- package/dist/elements/public/TaxForm/TaxForm.js.map +1 -1
- package/dist/elements/public/TaxForm/index.d.ts +1 -0
- package/dist/elements/public/TaxForm/index.js +1 -0
- package/dist/elements/public/TaxForm/index.js.map +1 -1
- package/dist/elements/public/TemplateConfigForm/CountriesList.d.ts +23 -0
- package/dist/elements/public/TemplateConfigForm/CountriesList.js +138 -0
- package/dist/elements/public/TemplateConfigForm/CountriesList.js.map +1 -0
- package/dist/elements/public/TemplateConfigForm/CountryCard.d.ts +22 -0
- package/dist/elements/public/TemplateConfigForm/CountryCard.js +157 -0
- package/dist/elements/public/TemplateConfigForm/CountryCard.js.map +1 -0
- package/dist/elements/public/TemplateConfigForm/TemplateConfigForm.d.ts +88 -0
- package/dist/elements/public/TemplateConfigForm/TemplateConfigForm.js +1336 -0
- package/dist/elements/public/TemplateConfigForm/TemplateConfigForm.js.map +1 -0
- package/dist/elements/public/TemplateConfigForm/defaults.d.ts +2 -0
- package/dist/elements/public/TemplateConfigForm/defaults.js +95 -0
- package/dist/elements/public/TemplateConfigForm/defaults.js.map +1 -0
- package/dist/elements/public/TemplateConfigForm/index.d.ts +9 -0
- package/dist/elements/public/TemplateConfigForm/index.js +11 -0
- package/dist/elements/public/TemplateConfigForm/index.js.map +1 -0
- package/dist/elements/public/TemplateConfigForm/types.d.ts +150 -0
- package/dist/elements/public/TemplateConfigForm/types.js +2 -0
- package/dist/elements/public/TemplateConfigForm/types.js.map +1 -0
- package/dist/elements/public/TemplateForm/TemplateForm.d.ts +45 -0
- package/dist/elements/public/TemplateForm/TemplateForm.js +343 -0
- package/dist/elements/public/TemplateForm/TemplateForm.js.map +1 -0
- package/dist/elements/public/TemplateForm/index.d.ts +9 -0
- package/dist/elements/public/TemplateForm/index.js +11 -0
- package/dist/elements/public/TemplateForm/index.js.map +1 -0
- package/dist/elements/public/TemplateForm/types.d.ts +17 -0
- package/dist/elements/public/TemplateForm/types.js +2 -0
- package/dist/elements/public/TemplateForm/types.js.map +1 -0
- package/dist/elements/public/index.d.ts +3 -0
- package/dist/elements/public/index.defined.d.ts +3 -0
- package/dist/elements/public/index.defined.js +3 -0
- package/dist/elements/public/index.defined.js.map +1 -1
- package/dist/elements/public/index.js +3 -0
- package/dist/elements/public/index.js.map +1 -1
- package/dist/mixins/themeable.js +133 -16
- package/dist/mixins/themeable.js.map +1 -1
- package/package.json +2 -7
- package/dist/cdn/shared-296637c5.js +0 -1
- package/dist/cdn/shared-4a990126.js +0 -1
- package/dist/cdn/shared-50744508.js +0 -15
- package/dist/cdn/shared-b98f88c9.js +0 -369
- package/dist/cdn/shared-bf09e011.js +0 -572
- package/dist/cdn/shared-c0161e6a.js +0 -1
- package/dist/cdn/shared-c1e0e11f.js +0 -1
- package/dist/cdn/shared-dbcffd8e.js +0 -1
- package/dist/cdn/shared-e21a2aac.js +0 -1
- package/dist/cdn/shared-e55b6bb7.js +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ItemsForm.js","sourceRoot":"","sources":["../../../../src/elements/public/ItemsForm/ItemsForm.ts"],"names":[],"mappings":"AAAA,OAAO,uBAAuB,CAAC;AAC/B,OAAO,EAAE,IAAI,EAAwC,MAAM,aAAa,CAAC;AACzE,OAAO,EAAE,aAAa,EAAE,yCAAsC;AAC9D,OAAO,EAAE,QAAQ,EAAE,WAAW,EAAE,+BAA4B;AAC5D,OAAO,EAAE,oBAAoB,EAAE,oBAAoB,EAAE,oBAAiB;AACtE,OAAO,EAAE,IAAI,EAAE,0BAAuB;AAEtC,OAAO,EAAE,cAAc,EAAE,oCAAiC;AAE1D,OAAO,EAAE,IAAI,EAAE,CAAC;AAEhB;;;;;;;;;;;GAWG;AACH,MAAM,OAAO,SAAU,SAAQ,cAAc;IA8Q3C;QACE,KAAK,CAAC,YAAY,CAAC,CAAC;QApJtB;;WAEG;QACI,aAAQ,GAAG,KAAK,CAAC;QAExB;;;;WAIG;QACI,WAAM,GAAG,MAAM,CAAC;QAEvB;;;;;;;;;WASG;QACI,SAAI,GAAG,UAAU,CAAC;QA8BzB;;;;;;;;;;;;;;;WAeG;QACI,eAAU,GAAG,SAAS,CAAC;QAE9B;;;;WAIG;QACI,gBAAW,GAAG,MAAM,CAAC;QAe5B;;;;;;WAMG;QACI,gBAAW,GAAa,EAAE,CAAC;QAElC;;;;;;;WAOG;QACK,iBAAY,GAAG;YACrB,WAAW,EAAE,GAAG,EAAE;gBAChB,IAAI,IAAI,CAAC,MAAM,KAAK,IAAI,EAAE;oBACxB,IAAI,IAA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SAClB,CAAC,CAAC;IACL,CAAC;IAEO,YAAY;QAClB,IAAI,CAAC,MAAM,GAAG,IAAI,CAAC;QACnB,MAAM,IAAI,GAAG,IAAI,CAAC,UAAW,CAAC,aAAa,CAAC,MAAM,CAAC,CAAC;QACpD,IAAI,CAAC,IAAI;YAAE,OAAO;QAClB,MAAM,IAAI,GAAG,IAAI,QAAQ,EAAE,CAAC;QAC5B,MAAM,UAAU,GAAG,IAAI,CAAC,cAAc,CAAC,IAAI,CAAC,CAAC;QAC7C,IAAI,CAAC,eAAe,GAAG,CAAC,CAAC,UAAU,CAAC;QACpC,IAAI,CAAC,uBAAuB,CAAC,IAAI,CAAC,CAAC;QACnC,IAAI,CAAC,sBAAsB,CAAC,IAAI,CAAC,CAAC;QAClC,IAAI,CAAC,MAAM,GAAG,IAAI,CAAC;IACrB,CAAC;CACF","sourcesContent":["import '@vaadin/vaadin-button';\nimport { html, PropertyDeclarations, TemplateResult } from 'lit-element';\nimport { parseDuration } from '../../../utils/parse-duration';\nimport { Dropdown, ErrorScreen } from '../../private/index';\nimport { ItemsFormChangeEvent, ItemsFormSubmitEvent } from './events';\nimport { Item } from './private/Item';\nimport { ItemInterface } from './types';\nimport { SignableFields } from './private/SignableFields';\n\nexport { Item };\n\n/**\n * A custom element providing a customizable donation form.\n *\n * @fires ItemsForm#change - changed form data.\n * @fires ItemsForm#submit - submitted form data\n * @fires ItemsForm#load - ProgressEvent instance with server response\n *\n * @slot items - items to be added to the form.\n *\n * @element foxy-items-form\n *\n */\nexport class ItemsForm extends SignableFields {\n /** @readonly */\n public static get scopedElements(): Record<string, unknown> {\n return {\n 'x-error-screen': ErrorScreen,\n 'vaadin-button': customElements.get('vaadin-button'),\n 'x-dropdown': Dropdown,\n 'x-item': Item,\n };\n }\n\n /** @readonly */\n static get properties(): PropertyDeclarations {\n return {\n ...super.properties,\n currency: { type: String },\n readonly: { type: Boolean },\n cart: {\n type: String, // only accepts checkout or add\n converter: value => {\n if (value && !['checkout', 'add'].includes(value)) {\n return null;\n }\n return value;\n },\n },\n target: { type: String },\n store: { type: String, attribute: 'store' },\n sub_frequency: { type: String },\n sub_startdate: {\n type: String,\n converter: value => {\n if (!ItemsForm.__validDate(value)) {\n console.error('Invalid start date', value);\n return '';\n }\n return value;\n },\n },\n sub_enddate: {\n type: String,\n converter: value => {\n if (!ItemsForm.__validDateFuture(value)) {\n console.error('Invalid end date', value);\n return '';\n }\n return value;\n },\n },\n sub_token: { type: String },\n sub_modify: {\n type: String,\n converter: value => {\n if (value === '' || value === 'append') {\n return '';\n } else {\n return 'replace';\n }\n },\n },\n sub_restart: {\n type: String,\n converter: value => {\n if (value === 'true') {\n return value;\n } else {\n return 'auto';\n }\n },\n },\n frequencies: {\n converter: (value, type) => {\n if (!value) {\n return [];\n }\n const freqArray = JSON.parse(value);\n if (!Array.isArray(freqArray)) {\n console.error('Invalid frequency', `Frequency options must be an array.`);\n return [];\n }\n for (const f of freqArray) {\n if (!ItemsForm.__validFrequency(f)) {\n console.error(\n 'Invalid frequency',\n `Invalid frequency option.\n Please, check https://wiki.foxycart.com/v/2.0/products#subscription_product_options for possible values.\n Each frequency must be a in the format:\n - 1d (a number followed by d, for day)\n - 1w (a number followed by w, for week)\n - 1m (a number followed by m, for month)\n - 1y (a number followed by y, for year)\n or .5m (no other decimals are allowed, and this is only for months)\n `,\n f\n );\n return [];\n }\n }\n return freqArray.filter(ItemsForm.__validFrequency);\n },\n },\n items: { type: Array },\n __hasValidItems: { attribute: false },\n __total: { attribute: false },\n __data: { attribute: false },\n };\n }\n\n /**\n * **Required** store subdomain, It is similar to mystore.foxycart.com,\n * unless you use a custom subdomain.\n *\n * **Examples:** `\"mystore.foxycart.com\"` `\"custom.mycoolstore.com\"`\n */\n public store?: string;\n\n /**\n * **Required** 3-letter lowercase currency code.\n *\n * **Example:** `\"usd\"`\n */\n public currency?: string;\n\n /**\n * Makes the entire form readonly.\n */\n public readonly = false;\n\n /**\n * Defines target of the form\n *\n * This attribute controls the destination window of the form submission.\n */\n public target = '_top';\n\n /**\n * Defines the next cart step\n *\n * It can only be either add or checkout.\n * If \"add\" is chosen, this form will add items to the cart and the user will\n * be directed to the cart with these products added upon submission.\n *\n * If set to \"checkout\" (this is the default) the user will be directed to\n * checkout.\n */\n public cart = 'checkout';\n\n /**\n * Optional frequency string encoded as count (integer) + units (one of: `d`\n * for days, `w` for weeks, `m` for months, `y` for years). A special value\n * for twice a month is also supported: `.5m`. If set, the form will create a\n * subscription with the specified frequency in the cart.\n *\n * **Example:** `\"1m\"`\n */\n public sub_frequency?: string;\n\n /**\n * Optional subscription start date encoded as four integer for the year, two\n * for the month and two for the day. If only two or one digits are provided,\n * it is assumed to be next occurence of that day of the month, from the\n * current date.\n *\n * See [Products wiki for more details](https://wiki.foxycart.com/v/2.0/products#a_complete_list_of_product_parameters)\n *\n * ** Example:** `\"10\"`\n */\n public sub_startdate?: string;\n\n /**\n * Optional subscription token, unique URL of a subscription, retrieved from\n * the API, XML datafeeds or Admin interface.\n */\n public sub_token?: string;\n\n /**\n * Optional. Allows the “add to cart” link or form to completely replace the\n * existing subscription loaded\n *\n * Can be either \"replace\", \"append\" or \"\" (a blank string).\n * Using \"append\" or \"\" will result in adding these items to an existing\n * subscription in addition to the existing ones.\n *\n * The \"append\" value is set for convenience, as it describes the behaviour.\n * The submitted value, in this case, will be \"\". The submitted value, in\n * this case, will be \"\".\n *\n * Using \"replace\" results in replacing the existing subscription with the\n * current itmes.\n * See [Products subscription options](https://wiki.foxycart.com/v/2.0/products/subscriptions#subscription-related_product_options)\n */\n public sub_modify = 'replace';\n\n /**\n * Set to \"true\" to indicate that payment is collectable right now.\n * Set to \"auto\" to indicate that payment is collectable right now if the\n * subscription's past-due amount is greater than 0\n */\n public sub_restart = 'auto';\n\n /**\n * Optional subscription end date encoded as four integer for the year, two\n * for the month and two for the day.\n *\n * The absence of a sub_enddate, together with a sub_frequency, means a\n * subscription with indefinite and date.\n *\n * See [Products wiki for more details](https://wiki.foxycart.com/v/2.0/products#a_complete_list_of_product_parameters)\n *\n * ** Example:** `\"20221010\"`\n */\n public sub_enddate?: string;\n\n /**\n * Optional 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: string[] = [];\n\n /**\n * Handles the submission of the form\n *\n * - creates a FormData\n * - fill the FormData with item values\n * - add order wide fields to the FormData\n * - submits the form\n */\n private handleSubmit = {\n handleEvent: () => {\n if (this.__data !== null) {\n if (this.dispatchEvent(new ItemsFormSubmitEvent(this.__data!))) {\n this.shadowRoot!.querySelector('form')!.submit();\n }\n }\n },\n };\n\n private __childItemsObserver?: MutationObserver;\n\n private __hasValidItems = false;\n\n private __total = 0;\n\n /**\n * Handles the user input for frequenty field\n * - converts week, year, day and month into first letter only\n * - removes spaces\n * - removes leading zeroes\n * - validates input as propper frequency option\n **/\n private __handleFrequency = {\n handleEvent: (ev: CustomEvent) => {\n const newfrequency = (ev as CustomEvent).detail\n .replace(/([wydm])\\w*/, '$1')\n .replace(/ /g, '')\n .replace(/^0/, '');\n if (ItemsForm.__validFrequency(newfrequency)) {\n this.sub_frequency = newfrequency;\n } else {\n this.sub_frequency = '';\n }\n this.__updateData();\n },\n };\n\n private __data: FormData | null = new FormData();\n\n constructor() {\n super('items-form');\n this.__childItemsObserver = new MutationObserver(this.__observeChildren.bind(this));\n this.__childItemsObserver.observe(this, {\n childList: true,\n attributes: false,\n subtree: true,\n });\n this.updateComplete.then(() => {\n this.__acknowledgeItemElements();\n this.__computeTotalPrice();\n this.__updateData();\n });\n }\n\n public get items(): ItemInterface[] {\n const temp: ItemInterface[] = [];\n this.__itemElements.forEach(e => {\n const proxy = new Proxy(e, {\n set: function (target: Item, property: string | number | symbol, value) {\n const allowedAttributes = Object.keys(target.value);\n if (typeof property === 'string' && allowedAttributes.includes(property)) {\n (target as unknown as ItemInterface)[property] = value;\n return true;\n } else {\n return false;\n }\n },\n get: function (target: Item, property: string | number) {\n return target.value[property];\n },\n });\n temp.push(proxy as unknown as ItemInterface);\n });\n return temp;\n }\n\n /**\n * Optional an array of ItemInterface objects with at least the following properties:\n * - name: the name of the item\n * - price: the price of each of this item\n * The following optional properties will be used:\n * - quantity: (defaults to 1) how many of each item are added to the form\n * - image: an image url to be displayed in the form for this item\n * - items: an array of other items that are to be treated as bundled with this item\n * - signatures: an object containing a key value list of previously generated HMAC validation codes\n *\n * Other item properties are accepted and sent to foxy cart\n * See [Products wiki for more details](https://wiki.foxycart.com/v/2.0/products#a_complete_list_of_product_parameters)\n */\n public set items(value: ItemInterface[]) {\n this.__removeItems();\n this.__createItemsFromItemArray(value);\n }\n\n /**\n * The total value of the items to be submitted.\n */\n public get total(): number {\n return this.__total;\n }\n\n public render(): TemplateResult {\n if (!this.store || !this.currency) {\n return html`<x-error-screen type=\"setup_needed\" class=\"relative\"></x-error-screen>`;\n }\n\n return html`\n <div>\n <form\n class=\"overflow-hidden\"\n method=\"POST\"\n target=\"${this.target}\"\n action=\"https://${this.store}/cart\"\n data-testid=\"form\"\n class=\"hidden\"\n hidden\n >\n ${this.__data\n ? html` ${[...this.__data.entries()].map(\n ([name, value]) => html`<input type=\"hidden\" name=${name} value=${value} />`\n )}`\n : ''}\n </form>\n\n <section class=\"items\">\n <slot></slot>\n </section>\n\n ${!this.readonly\n ? html`\n <section class=\"actions flex flex-wrap justify-end m-m\">\n ${this.frequencies && this.frequencies.length\n ? html`\n <x-dropdown\n type=\"text\"\n name=\"frequency\"\n class=\"subscription m-s w-full sm-w-auto\"\n lang=${this.lang}\n .value=${this.sub_frequency ?? '0'}\n .items=${this.frequencies.concat(['0'])}\n .getText=${this.__translateFrequency.bind(this)}\n @change=${this.__handleFrequency}\n >\n </x-dropdown>\n `\n : ''}\n\n <vaadin-button\n class=\"m-s w-full sm-w-auto\"\n theme=\"primary\"\n data-testid=\"submit\"\n ?disabled=${!this.__hasValidItems}\n @click=${this.handleSubmit}\n >\n <span class=\"total\">\n ${this.__submitBtnText(this.__translateAmount(this.total))}\n </span>\n </vaadin-button>\n </section>\n `\n : ''}\n </div>\n `;\n }\n\n /** Add new items */\n public addItems(newItems: ItemInterface[]): void {\n for (const p of newItems) {\n const newItem = this.createItem(p);\n this.appendChild(newItem);\n this.__acknowledgeItemElement(newItem as Item);\n }\n }\n\n /** Remove items */\n public removeItems(itemIds: number[]): void {\n this.__removeItems((p: Item) => itemIds.includes(p.pid));\n }\n\n public updated(): void {\n this.dispatchEvent(new ItemsFormChangeEvent(this.__data!));\n }\n\n public createItem(p: ItemInterface): Element {\n const scopedItem = (this.constructor as any).getScopedTagName('x-item');\n const newItem = document.createElement(scopedItem);\n newItem.value = p;\n newItem.currency = this.currency;\n newItem.readonly = this.readonly;\n return newItem;\n }\n\n private __submitBtnText(value: string): string {\n if (!this.sub_frequency || this.sub_frequency == '0') {\n return this._t('checkout.buy', { value });\n } else {\n const duration = parseDuration(this.sub_frequency);\n if (duration.count === 1) {\n return this._t('checkout.subscribe_single_unit', {\n value,\n period: this._t(duration.units).toLowerCase(),\n });\n } else {\n return this._t('checkout.subscribe_muiltiple_units', {\n value,\n period: this.__translateFrequency(this.sub_frequency).toLowerCase(),\n });\n }\n }\n }\n\n /**\n * An array with both items created as elements and created parameter\n */\n private get __itemElements(): NodeListOf<Item> {\n return this.querySelectorAll('[data-item]');\n }\n\n /** Create child Items from items array\n */\n private __createItemsFromItemArray(itemsArray: ItemInterface[]) {\n this.addItems(itemsArray);\n }\n\n /** Removes item from the form based on a condition */\n private __removeItems(condition = (e: Item) => true) {\n this.__itemElements.forEach(p => {\n if (condition(p)) {\n p.remove();\n }\n });\n }\n\n /**\n * Adds a signature to a post field\n *\n * This method does not compute the signature. It must be provided.\n *\n * @argument string name The name of the field\n * @argument string signature The computed signature to add to the field\n * @argument string open Whether the field value is customized by the user\n * @return string signedName the name of the field with the signature\n */\n private __addSignature(name: string, signature: string, open?: string | boolean): string {\n return `${name}||${signature}${open ? '||open' : ''}`;\n }\n\n /**\n * Add all items from this.__itemElements to a FormData\n *\n * - Iterate of items in itemElements\n * - Add valid items to Form Data\n *\n * @argument FormData fd the FormData instance to fill\n * @return number the number of items added\n **/\n private __formDataFill(fd: FormData): number {\n let added = 0;\n this.__itemElements.forEach(e => {\n added += this.__formDataAddItem(fd, e);\n });\n this.__formDataAddCartWideSubscriptionFields(fd);\n return added;\n }\n\n /**\n * Add custom user provided fields\n */\n private __formDataCustomInputs(fd: FormData) {\n this.querySelectorAll(`[name]`).forEach(e => {\n const el = e as HTMLInputElement;\n if (el.tagName == 'INPUT' && ['checkbox', 'radio'].includes(el.type)) {\n if (!el.checked) return;\n }\n if (el.tagName == 'OPTION') {\n return;\n }\n if (el.value && ['number', 'string'].includes(typeof el.value)) {\n fd.set(el.name, el.value);\n }\n });\n }\n\n // Reserved attributes are not to be submitted\n // other attributes, included custom attributes added by the user, will be submitted\n private __isAttributeReserved(attribute: string): boolean {\n const reservedAttributes = [\n 'alt',\n 'currency',\n 'description',\n 'isChildren',\n 'isItem',\n 'items',\n 'open',\n 'pid',\n 'signatures',\n 'slot',\n 'total',\n ];\n return reservedAttributes.includes(attribute);\n }\n\n /**\n * Adds a item to a form data\n *\n * @argument {FormData} fd the FormData to which the item will be added\n * @argument {Item} the item to add\n **/\n private __formDataAddItem(fd: FormData, itemEl: Item, parent: Item | null = null): number {\n let added = 0;\n if (this.__validItem(itemEl)) {\n if (!itemEl.value['pid']) {\n throw new Error('Attempt to convert a item without a propper ID');\n }\n if (parent && parent.getAttribute('code')) {\n itemEl.setAttribute('parent_code', parent.getAttribute('code')!);\n }\n for (let i = 0; i < itemEl.attributes.length; i++) {\n const field = itemEl.attributes[i];\n if (!this.__isAttributeReserved(field.name) && !field.name.startsWith('data-')) {\n let fieldValue: unknown = (itemEl as any)[field.name];\n // Adds a signature if possible\n if (itemEl.code && ['string', 'number'].includes(typeof fieldValue)) {\n if (parent && field.name == 'quantity') {\n fieldValue = Number(field.value) * parent.quantity;\n }\n fd.set(itemEl.signedName(field.name), (fieldValue as string | number).toString());\n }\n }\n }\n added += 1;\n this.__formDataAddSubscriptionFields(fd, itemEl);\n }\n const childItems = itemEl.querySelectorAll('[data-bundled]');\n if (childItems && itemEl.quantity > 0) {\n for (const child of childItems) {\n added += this.__formDataAddItem(fd, child as Item, itemEl);\n }\n }\n return added;\n }\n\n /**\n * Adds subscription fields to a FormData\n *\n * @argument {FormData} fd the FormData to which subscription fields will be added\n **/\n private __formDataAddSubscriptionFields(fd: FormData, itemEl: Item): void {\n // added if sub_frequency is set\n if (this.sub_frequency) {\n for (const s of ['sub_frequency', 'sub_startdate', 'sub_enddate']) {\n if ((this as any)[s]) {\n fd.set(itemEl.signedName(s), (this as any)[s]);\n }\n }\n }\n }\n\n /**\n * Adds cart wide subscription fields to a FormData\n *\n * @argument {FormData} fd the FormData to which subscription fields will be added\n */\n private __formDataAddCartWideSubscriptionFields(fd: FormData): void {\n if (this.sub_frequency) {\n // added if itself is set\n if (this.sub_token) fd.set(this.signedName('sub_token'), this.sub_token);\n // added regardless\n fd.set(this.signedName('sub_modify'), this.sub_modify);\n fd.set(this.signedName('sub_restart'), this.sub_restart);\n }\n }\n\n /**\n * Adds cart related fields to a FormData\n *\n * @argument {FormData} fd the FormData to which the cart fields will be added.\n */\n private __formDataAddCartFields(fd: FormData): void {\n if (this.cart) {\n fd.set('cart', this.cart!);\n } else {\n fd.delete('cart');\n }\n }\n\n /**\n * Validates a string for subscription start date or end date according to\n *\n * @argument string strDate the date as a string to be used as start or end date.\n *\n * https://wiki.foxycart.com/v/2.0/products#subscription_product_options\n * See [Products subscription options for more details](https://wiki.foxycart.com/v/2.0/products#subscription_product_options)\n */\n private static __validDate(strDate: string | null | undefined): boolean {\n if (strDate === null || strDate === undefined) {\n return false;\n }\n if (strDate.match(/^(\\d{1,2}|\\d{8})$/)) {\n if (strDate.match(/^\\d{2}$/)) {\n if (Number(strDate) > 31) {\n return false;\n }\n }\n return true;\n }\n if (!strDate.match(/^\\.5m/) && ItemsForm.__validFrequency(strDate)) {\n return true;\n }\n return false;\n }\n\n /**\n * Checks if a string date is in the future.\n *\n * @argument string strdate the date, as a string, to be checked.\n * @returns boolean the date is a valid future date.\n */\n private static __validDateFuture(strDate: string | null | undefined): boolean {\n let valid = false;\n if (ItemsForm.__validDate(strDate)) {\n if (strDate!.match(/^\\d{8}/)) {\n const now = new Date();\n valid = now.toISOString().replace(/(-|T.*)/g, '') <= strDate!;\n } else {\n valid = true;\n }\n }\n return valid;\n }\n\n /**\n * Checks if a frequency complies with possible values\n *\n * @argument string strFrequency the frequency string to be validated.\n * @returns boolean the string is a foxy cart frequency string.\n */\n private static __validFrequency(strFrequency: string | null | undefined): boolean {\n if (!strFrequency) {\n return false;\n } else {\n return !!strFrequency.match(/^(\\.5m|\\d+[dwmy])$/);\n }\n }\n\n /** Subscribe to late inserted items.\n *\n * @argument MutationRecord[] the list of changes occurred.\n **/\n private __observeChildren(mutationList: MutationRecord[]): void {\n mutationList.forEach(m => {\n if (m.type == 'childList') {\n m.addedNodes.forEach(n => {\n const e = n as HTMLElement;\n e.addEventListener('change', this.__itemChange.bind(this));\n });\n }\n });\n this.__acknowledgeItemElements();\n this.__computeTotalPrice();\n this.__updateData();\n }\n\n /** Updates the form on item change */\n private __itemChange(): void {\n this.__computeTotalPrice();\n this.__updateData();\n }\n\n /** Compute the total price of all items in the form */\n private __computeTotalPrice(): void {\n let total = 0;\n this.__itemElements.forEach(e => {\n const item = e as Item;\n if (item.total) {\n total += Number(item.total);\n }\n });\n this.__total = Number(total.toFixed(2));\n }\n\n /** Go through all pcroduct elements and executes acknoledges each one */\n private __acknowledgeItemElements(): void {\n this.__itemElements.forEach((e: Element) => {\n const i = e as Item;\n this.__acknowledgeItemElement(i);\n });\n }\n\n /**\n * Treat this item item element as part of the form:\n *\n * - listen to its change events\n * - set its currency to be the forms currency\n */\n private __acknowledgeItemElement(item: Item) {\n item.addEventListener('change', this.__itemChange.bind(this));\n item.currency = this.currency!;\n }\n\n /**\n * Checks if item has quantity and price\n *\n * @argument Item the item to be validated\n * @returns boolean the item is valid\n **/\n private __validItem(item: Item): boolean {\n const pid = item.getAttribute('pid');\n const qty = Number(item.getAttribute('quantity'));\n const price = Number(item.getAttribute('price'));\n return !!(pid && qty > 0 && price >= 0);\n }\n\n /**\n * Translates a frequency string\n *\n * @argument string the frequency string to be translated\n * @returns string the translated string\n */\n private __translateFrequency(frequency: string) {\n if (frequency.startsWith('0')) return this._t('frequency_once');\n if (frequency === '.5m') return this._t('frequency_0_5m');\n const { count, units } = parseDuration(frequency);\n return this._t('frequency', {\n units: this._t(units, { count }),\n count,\n });\n }\n\n /**\n * Translate a given amount\n *\n * @argument number the amount to be translated\n * @returns string the translated amount\n */\n private __translateAmount(amount: number) {\n return amount.toLocaleString(this.lang, {\n minimumFractionDigits: 2,\n currency: this.currency!,\n style: 'currency',\n });\n }\n\n private __updateData() {\n this.__data = null;\n const form = this.shadowRoot!.querySelector('form');\n if (!form) return;\n const data = new FormData();\n const itemsAdded = this.__formDataFill(data);\n this.__hasValidItems = !!itemsAdded;\n this.__formDataAddCartFields(data);\n this.__formDataCustomInputs(data);\n this.__data = data;\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"ItemsForm.js","sourceRoot":"","sources":["../../../../src/elements/public/ItemsForm/ItemsForm.ts"],"names":[],"mappings":"AAAA,OAAO,uBAAuB,CAAC;AAC/B,OAAO,EAAE,IAAI,EAAwC,MAAM,aAAa,CAAC;AACzE,OAAO,EAAE,aAAa,EAAE,yCAAsC;AAC9D,OAAO,EAAE,QAAQ,EAAE,WAAW,EAAE,+BAA4B;AAC5D,OAAO,EAAE,oBAAoB,EAAE,oBAAoB,EAAE,oBAAiB;AACtE,OAAO,EAAE,IAAI,EAAE,0BAAuB;AAEtC,OAAO,EAAE,cAAc,EAAE,oCAAiC;AAE1D,OAAO,EAAE,IAAI,EAAE,CAAC;AAEhB;;;;;;;;;;;GAWG;AACH,MAAM,OAAO,SAAU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AC,gBAAgB,CAAC,CAAC;QAC1D,MAAM,EAAE,KAAK,EAAE,KAAK,EAAE,GAAG,aAAa,CAAC,SAAS,CAAC,CAAC;QAClD,OAAO,IAAI,CAAC,EAAE,CAAC,WAAW,EAAE;YAC1B,KAAK,EAAE,IAAI,CAAC,EAAE,CAAC,KAAK,EAAE,EAAE,KAAK,EAAE,CAAC;YAChC,KAAK;SACN,CAAC,CAAC;IACL,CAAC;IAED;;;;;OAKG;IACK,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;IAEO,YAAY;QAClB,IAAI,CAAC,MAAM,GAAG,IAAI,CAAC;QACnB,MAAM,IAAI,GAAG,IAAI,CAAC,UAAW,CAAC,aAAa,CAAC,MAAM,CAAC,CAAC;QACpD,IAAI,CAAC,IAAI;YAAE,OAAO;QAClB,MAAM,IAAI,GAAG,IAAI,QAAQ,EAAE,CAAC;QAC5B,MAAM,UAAU,GAAG,IAAI,CAAC,cAAc,CAAC,IAAI,CAAC,CAAC;QAC7C,IAAI,CAAC,eAAe,GAAG,CAAC,CAAC,UAAU,CAAC;QACpC,IAAI,CAAC,uBAAuB,CAAC,IAAI,CAAC,CAAC;QACnC,IAAI,CAAC,sBAAsB,CAAC,IAAI,CAAC,CAAC;QAClC,IAAI,CAAC,MAAM,GAAG,IAAI,CAAC;IACrB,CAAC;CACF","sourcesContent":["import '@vaadin/vaadin-button';\nimport { html, PropertyDeclarations, TemplateResult } from 'lit-element';\nimport { parseDuration } from '../../../utils/parse-duration';\nimport { Dropdown, ErrorScreen } from '../../private/index';\nimport { ItemsFormChangeEvent, ItemsFormSubmitEvent } from './events';\nimport { Item } from './private/Item';\nimport { ItemInterface } from './types';\nimport { SignableFields } from './private/SignableFields';\n\nexport { Item };\n\n/**\n * A custom element providing a customizable donation form.\n *\n * @fires ItemsForm#change - changed form data.\n * @fires ItemsForm#submit - submitted form data\n * @fires ItemsForm#load - ProgressEvent instance with server response\n *\n * @slot items - items to be added to the form.\n *\n * @element foxy-items-form\n *\n */\nexport class ItemsForm extends SignableFields {\n /** @readonly */\n public static get scopedElements(): Record<string, unknown> {\n return {\n 'x-error-screen': ErrorScreen,\n 'vaadin-button': customElements.get('vaadin-button'),\n 'x-dropdown': Dropdown,\n 'x-item': Item,\n };\n }\n\n /** @readonly */\n static get properties(): PropertyDeclarations {\n return {\n ...super.properties,\n currency: { type: String },\n readonly: { type: Boolean },\n cart: {\n type: String, // only accepts checkout or add\n converter: value => {\n if (value && !['checkout', 'add'].includes(value)) {\n return null;\n }\n return value;\n },\n },\n target: { type: String },\n store: { type: String, attribute: 'store' },\n sub_frequency: { type: String },\n sub_startdate: {\n type: String,\n converter: value => {\n if (!ItemsForm.__validDate(value)) {\n console.error('Invalid start date', value);\n return '';\n }\n return value;\n },\n },\n sub_enddate: {\n type: String,\n converter: value => {\n if (!ItemsForm.__validDateFuture(value)) {\n console.error('Invalid end date', value);\n return '';\n }\n return value;\n },\n },\n sub_token: { type: String },\n sub_modify: {\n type: String,\n converter: value => {\n if (value === '' || value === 'append') {\n return '';\n } else {\n return 'replace';\n }\n },\n },\n sub_restart: {\n type: String,\n converter: value => {\n if (value === 'true') {\n return value;\n } else {\n return 'auto';\n }\n },\n },\n frequencies: {\n converter: value => {\n if (!value) {\n return [];\n }\n const freqArray = JSON.parse(value);\n if (!Array.isArray(freqArray)) {\n console.error('Invalid frequency', `Frequency options must be an array.`);\n return [];\n }\n for (const f of freqArray) {\n if (!ItemsForm.__validFrequency(f)) {\n console.error(\n 'Invalid frequency',\n `Invalid frequency option.\n Please, check https://wiki.foxycart.com/v/2.0/products#subscription_product_options for possible values.\n Each frequency must be a in the format:\n - 1d (a number followed by d, for day)\n - 1w (a number followed by w, for week)\n - 1m (a number followed by m, for month)\n - 1y (a number followed by y, for year)\n or .5m (no other decimals are allowed, and this is only for months)\n `,\n f\n );\n return [];\n }\n }\n return freqArray.filter(ItemsForm.__validFrequency);\n },\n },\n items: { type: Array },\n __hasValidItems: { attribute: false },\n __total: { attribute: false },\n __data: { attribute: false },\n };\n }\n\n /**\n * **Required** store subdomain, It is similar to mystore.foxycart.com,\n * unless you use a custom subdomain.\n *\n * **Examples:** `\"mystore.foxycart.com\"` `\"custom.mycoolstore.com\"`\n */\n public store?: string;\n\n /**\n * **Required** 3-letter lowercase currency code.\n *\n * **Example:** `\"usd\"`\n */\n public currency?: string;\n\n /**\n * Makes the entire form readonly.\n */\n public readonly = false;\n\n /**\n * Defines target of the form\n *\n * This attribute controls the destination window of the form submission.\n */\n public target = '_top';\n\n /**\n * Defines the next cart step\n *\n * It can only be either add or checkout.\n * If \"add\" is chosen, this form will add items to the cart and the user will\n * be directed to the cart with these products added upon submission.\n *\n * If set to \"checkout\" (this is the default) the user will be directed to\n * checkout.\n */\n public cart = 'checkout';\n\n /**\n * Optional frequency string encoded as count (integer) + units (one of: `d`\n * for days, `w` for weeks, `m` for months, `y` for years). A special value\n * for twice a month is also supported: `.5m`. If set, the form will create a\n * subscription with the specified frequency in the cart.\n *\n * **Example:** `\"1m\"`\n */\n public sub_frequency?: string;\n\n /**\n * Optional subscription start date encoded as four integer for the year, two\n * for the month and two for the day. If only two or one digits are provided,\n * it is assumed to be next occurence of that day of the month, from the\n * current date.\n *\n * See [Products wiki for more details](https://wiki.foxycart.com/v/2.0/products#a_complete_list_of_product_parameters)\n *\n * ** Example:** `\"10\"`\n */\n public sub_startdate?: string;\n\n /**\n * Optional subscription token, unique URL of a subscription, retrieved from\n * the API, XML datafeeds or Admin interface.\n */\n public sub_token?: string;\n\n /**\n * Optional. Allows the “add to cart” link or form to completely replace the\n * existing subscription loaded\n *\n * Can be either \"replace\", \"append\" or \"\" (a blank string).\n * Using \"append\" or \"\" will result in adding these items to an existing\n * subscription in addition to the existing ones.\n *\n * The \"append\" value is set for convenience, as it describes the behaviour.\n * The submitted value, in this case, will be \"\". The submitted value, in\n * this case, will be \"\".\n *\n * Using \"replace\" results in replacing the existing subscription with the\n * current itmes.\n * See [Products subscription options](https://wiki.foxycart.com/v/2.0/products/subscriptions#subscription-related_product_options)\n */\n public sub_modify = 'replace';\n\n /**\n * Set to \"true\" to indicate that payment is collectable right now.\n * Set to \"auto\" to indicate that payment is collectable right now if the\n * subscription's past-due amount is greater than 0\n */\n public sub_restart = 'auto';\n\n /**\n * Optional subscription end date encoded as four integer for the year, two\n * for the month and two for the day.\n *\n * The absence of a sub_enddate, together with a sub_frequency, means a\n * subscription with indefinite and date.\n *\n * See [Products wiki for more details](https://wiki.foxycart.com/v/2.0/products#a_complete_list_of_product_parameters)\n *\n * ** Example:** `\"20221010\"`\n */\n public sub_enddate?: string;\n\n /**\n * Optional 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: string[] = [];\n\n /**\n * Handles the submission of the form\n *\n * - creates a FormData\n * - fill the FormData with item values\n * - add order wide fields to the FormData\n * - submits the form\n */\n private handleSubmit = {\n handleEvent: () => {\n if (this.__data !== null) {\n if (this.dispatchEvent(new ItemsFormSubmitEvent(this.__data!))) {\n this.shadowRoot!.querySelector('form')!.submit();\n }\n }\n },\n };\n\n private __childItemsObserver?: MutationObserver;\n\n private __hasValidItems = false;\n\n private __total = 0;\n\n /**\n * Handles the user input for frequenty field\n * - converts week, year, day and month into first letter only\n * - removes spaces\n * - removes leading zeroes\n * - validates input as propper frequency option\n **/\n private __handleFrequency = {\n handleEvent: (ev: CustomEvent) => {\n const newfrequency = (ev as CustomEvent).detail\n .replace(/([wydm])\\w*/, '$1')\n .replace(/ /g, '')\n .replace(/^0/, '');\n if (ItemsForm.__validFrequency(newfrequency)) {\n this.sub_frequency = newfrequency;\n } else {\n this.sub_frequency = '';\n }\n this.__updateData();\n },\n };\n\n private __data: FormData | null = new FormData();\n\n constructor() {\n super('items-form');\n this.__childItemsObserver = new MutationObserver(this.__observeChildren.bind(this));\n this.__childItemsObserver.observe(this, {\n childList: true,\n attributes: false,\n subtree: true,\n });\n this.updateComplete.then(() => {\n this.__acknowledgeItemElements();\n this.__computeTotalPrice();\n this.__updateData();\n });\n }\n\n public get items(): ItemInterface[] {\n const temp: ItemInterface[] = [];\n this.__itemElements.forEach(e => {\n const proxy = new Proxy(e, {\n set: function (target: Item, property: string | number | symbol, value) {\n const allowedAttributes = Object.keys(target.value);\n if (typeof property === 'string' && allowedAttributes.includes(property)) {\n (target as unknown as ItemInterface)[property] = value;\n return true;\n } else {\n return false;\n }\n },\n get: function (target: Item, property: string | number) {\n return target.value[property];\n },\n });\n temp.push(proxy as unknown as ItemInterface);\n });\n return temp;\n }\n\n /**\n * Optional an array of ItemInterface objects with at least the following properties:\n * - name: the name of the item\n * - price: the price of each of this item\n * The following optional properties will be used:\n * - quantity: (defaults to 1) how many of each item are added to the form\n * - image: an image url to be displayed in the form for this item\n * - items: an array of other items that are to be treated as bundled with this item\n * - signatures: an object containing a key value list of previously generated HMAC validation codes\n *\n * Other item properties are accepted and sent to foxy cart\n * See [Products wiki for more details](https://wiki.foxycart.com/v/2.0/products#a_complete_list_of_product_parameters)\n */\n public set items(value: ItemInterface[]) {\n this.__removeItems();\n this.__createItemsFromItemArray(value);\n }\n\n /**\n * The total value of the items to be submitted.\n */\n public get total(): number {\n return this.__total;\n }\n\n public render(): TemplateResult {\n if (!this.store || !this.currency) {\n return html`<x-error-screen type=\"setup_needed\" class=\"relative\"></x-error-screen>`;\n }\n\n return html`\n <div>\n <form\n class=\"overflow-hidden\"\n method=\"POST\"\n target=\"${this.target}\"\n action=\"https://${this.store}/cart\"\n data-testid=\"form\"\n class=\"hidden\"\n hidden\n >\n ${this.__data\n ? html` ${[...this.__data.entries()].map(\n ([name, value]) => html`<input type=\"hidden\" name=${name} value=${value} />`\n )}`\n : ''}\n </form>\n\n <section class=\"items\">\n <slot></slot>\n </section>\n\n ${!this.readonly\n ? html`\n <section class=\"actions flex flex-wrap justify-end m-m\">\n ${this.frequencies && this.frequencies.length\n ? html`\n <x-dropdown\n type=\"text\"\n name=\"frequency\"\n class=\"subscription m-s w-full sm-w-auto\"\n lang=${this.lang}\n .value=${this.sub_frequency ?? '0'}\n .items=${this.frequencies.concat(['0'])}\n .getText=${this.__translateFrequency.bind(this)}\n @change=${this.__handleFrequency}\n >\n </x-dropdown>\n `\n : ''}\n\n <vaadin-button\n class=\"m-s w-full sm-w-auto\"\n theme=\"primary\"\n data-testid=\"submit\"\n ?disabled=${!this.__hasValidItems}\n @click=${this.handleSubmit}\n >\n <span class=\"total\">\n ${this.__submitBtnText(this.__translateAmount(this.total))}\n </span>\n </vaadin-button>\n </section>\n `\n : ''}\n </div>\n `;\n }\n\n /** Add new items */\n public addItems(newItems: ItemInterface[]): void {\n for (const p of newItems) {\n const newItem = this.createItem(p);\n this.appendChild(newItem);\n this.__acknowledgeItemElement(newItem as Item);\n }\n }\n\n /** Remove items */\n public removeItems(itemIds: number[]): void {\n this.__removeItems((p: Item) => itemIds.includes(p.pid));\n }\n\n public updated(): void {\n this.dispatchEvent(new ItemsFormChangeEvent(this.__data!));\n }\n\n public createItem(p: ItemInterface): Element {\n const scopedItem = (this.constructor as any).getScopedTagName('x-item');\n const newItem = document.createElement(scopedItem);\n newItem.value = p;\n newItem.currency = this.currency;\n newItem.readonly = this.readonly;\n return newItem;\n }\n\n private __submitBtnText(value: string): string {\n if (!this.sub_frequency || this.sub_frequency == '0') {\n return this._t('checkout.buy', { value });\n } else {\n const duration = parseDuration(this.sub_frequency);\n if (duration.count === 1) {\n return this._t('checkout.subscribe_single_unit', {\n value,\n period: this._t(duration.units).toLowerCase(),\n });\n } else {\n return this._t('checkout.subscribe_muiltiple_units', {\n value,\n period: this.__translateFrequency(this.sub_frequency).toLowerCase(),\n });\n }\n }\n }\n\n /**\n * An array with both items created as elements and created parameter\n */\n private get __itemElements(): NodeListOf<Item> {\n return this.querySelectorAll('[data-item]');\n }\n\n /** Create child Items from items array\n */\n private __createItemsFromItemArray(itemsArray: ItemInterface[]) {\n this.addItems(itemsArray);\n }\n\n /** Removes item from the form based on a condition */\n private __removeItems(condition: (e: Item) => boolean = () => true) {\n this.__itemElements.forEach(p => {\n if (condition(p)) {\n p.remove();\n }\n });\n }\n\n /**\n * Adds a signature to a post field\n *\n * This method does not compute the signature. It must be provided.\n *\n * @argument string name The name of the field\n * @argument string signature The computed signature to add to the field\n * @argument string open Whether the field value is customized by the user\n * @return string signedName the name of the field with the signature\n */\n private __addSignature(name: string, signature: string, open?: string | boolean): string {\n return `${name}||${signature}${open ? '||open' : ''}`;\n }\n\n /**\n * Add all items from this.__itemElements to a FormData\n *\n * - Iterate of items in itemElements\n * - Add valid items to Form Data\n *\n * @argument FormData fd the FormData instance to fill\n * @return number the number of items added\n **/\n private __formDataFill(fd: FormData): number {\n let added = 0;\n this.__itemElements.forEach(e => {\n added += this.__formDataAddItem(fd, e);\n });\n this.__formDataAddCartWideSubscriptionFields(fd);\n return added;\n }\n\n /**\n * Add custom user provided fields\n */\n private __formDataCustomInputs(fd: FormData) {\n this.querySelectorAll(`[name]`).forEach(e => {\n const el = e as HTMLInputElement;\n if (el.tagName == 'INPUT' && ['checkbox', 'radio'].includes(el.type)) {\n if (!el.checked) return;\n }\n if (el.tagName == 'OPTION') {\n return;\n }\n if (el.value && ['number', 'string'].includes(typeof el.value)) {\n fd.set(el.name, el.value);\n }\n });\n }\n\n // Reserved attributes are not to be submitted\n // other attributes, included custom attributes added by the user, will be submitted\n private __isAttributeReserved(attribute: string): boolean {\n const reservedAttributes = [\n 'alt',\n 'currency',\n 'description',\n 'isChildren',\n 'isItem',\n 'items',\n 'open',\n 'pid',\n 'signatures',\n 'slot',\n 'total',\n ];\n return reservedAttributes.includes(attribute);\n }\n\n /**\n * Adds a item to a form data\n *\n * @argument {FormData} fd the FormData to which the item will be added\n * @argument {Item} the item to add\n **/\n private __formDataAddItem(fd: FormData, itemEl: Item, parent: Item | null = null): number {\n let added = 0;\n if (this.__validItem(itemEl)) {\n if (!itemEl.value['pid']) {\n throw new Error('Attempt to convert a item without a propper ID');\n }\n if (parent && parent.getAttribute('code')) {\n itemEl.setAttribute('parent_code', parent.getAttribute('code')!);\n }\n for (let i = 0; i < itemEl.attributes.length; i++) {\n const field = itemEl.attributes[i];\n if (!this.__isAttributeReserved(field.name) && !field.name.startsWith('data-')) {\n let fieldValue: unknown = (itemEl as any)[field.name];\n // Adds a signature if possible\n if (itemEl.code && ['string', 'number'].includes(typeof fieldValue)) {\n if (parent && field.name == 'quantity') {\n fieldValue = Number(field.value) * parent.quantity;\n }\n fd.set(itemEl.signedName(field.name), (fieldValue as string | number).toString());\n }\n }\n }\n added += 1;\n this.__formDataAddSubscriptionFields(fd, itemEl);\n }\n const childItems = itemEl.querySelectorAll('[data-bundled]');\n if (childItems && itemEl.quantity > 0) {\n for (const child of childItems) {\n added += this.__formDataAddItem(fd, child as Item, itemEl);\n }\n }\n return added;\n }\n\n /**\n * Adds subscription fields to a FormData\n *\n * @argument {FormData} fd the FormData to which subscription fields will be added\n **/\n private __formDataAddSubscriptionFields(fd: FormData, itemEl: Item): void {\n // added if sub_frequency is set\n if (this.sub_frequency) {\n for (const s of ['sub_frequency', 'sub_startdate', 'sub_enddate']) {\n if ((this as any)[s]) {\n fd.set(itemEl.signedName(s), (this as any)[s]);\n }\n }\n }\n }\n\n /**\n * Adds cart wide subscription fields to a FormData\n *\n * @argument {FormData} fd the FormData to which subscription fields will be added\n */\n private __formDataAddCartWideSubscriptionFields(fd: FormData): void {\n if (this.sub_frequency) {\n // added if itself is set\n if (this.sub_token) fd.set(this.signedName('sub_token'), this.sub_token);\n // added regardless\n fd.set(this.signedName('sub_modify'), this.sub_modify);\n fd.set(this.signedName('sub_restart'), this.sub_restart);\n }\n }\n\n /**\n * Adds cart related fields to a FormData\n *\n * @argument {FormData} fd the FormData to which the cart fields will be added.\n */\n private __formDataAddCartFields(fd: FormData): void {\n if (this.cart) {\n fd.set('cart', this.cart!);\n } else {\n fd.delete('cart');\n }\n }\n\n /**\n * Validates a string for subscription start date or end date according to\n *\n * @argument string strDate the date as a string to be used as start or end date.\n *\n * https://wiki.foxycart.com/v/2.0/products#subscription_product_options\n * See [Products subscription options for more details](https://wiki.foxycart.com/v/2.0/products#subscription_product_options)\n */\n private static __validDate(strDate: string | null | undefined): boolean {\n if (strDate === null || strDate === undefined) {\n return false;\n }\n if (strDate.match(/^(\\d{1,2}|\\d{8})$/)) {\n if (strDate.match(/^\\d{2}$/)) {\n if (Number(strDate) > 31) {\n return false;\n }\n }\n return true;\n }\n if (!strDate.match(/^\\.5m/) && ItemsForm.__validFrequency(strDate)) {\n return true;\n }\n return false;\n }\n\n /**\n * Checks if a string date is in the future.\n *\n * @argument string strdate the date, as a string, to be checked.\n * @returns boolean the date is a valid future date.\n */\n private static __validDateFuture(strDate: string | null | undefined): boolean {\n let valid = false;\n if (ItemsForm.__validDate(strDate)) {\n if (strDate!.match(/^\\d{8}/)) {\n const now = new Date();\n valid = now.toISOString().replace(/(-|T.*)/g, '') <= strDate!;\n } else {\n valid = true;\n }\n }\n return valid;\n }\n\n /**\n * Checks if a frequency complies with possible values\n *\n * @argument string strFrequency the frequency string to be validated.\n * @returns boolean the string is a foxy cart frequency string.\n */\n private static __validFrequency(strFrequency: string | null | undefined): boolean {\n if (!strFrequency) {\n return false;\n } else {\n return !!strFrequency.match(/^(\\.5m|\\d+[dwmy])$/);\n }\n }\n\n /** Subscribe to late inserted items.\n *\n * @argument MutationRecord[] the list of changes occurred.\n **/\n private __observeChildren(mutationList: MutationRecord[]): void {\n mutationList.forEach(m => {\n if (m.type == 'childList') {\n m.addedNodes.forEach(n => {\n const e = n as HTMLElement;\n e.addEventListener('change', this.__itemChange.bind(this));\n });\n }\n });\n this.__acknowledgeItemElements();\n this.__computeTotalPrice();\n this.__updateData();\n }\n\n /** Updates the form on item change */\n private __itemChange(): void {\n this.__computeTotalPrice();\n this.__updateData();\n }\n\n /** Compute the total price of all items in the form */\n private __computeTotalPrice(): void {\n let total = 0;\n this.__itemElements.forEach(e => {\n const item = e as Item;\n if (item.total) {\n total += Number(item.total);\n }\n });\n this.__total = Number(total.toFixed(2));\n }\n\n /** Go through all pcroduct elements and executes acknoledges each one */\n private __acknowledgeItemElements(): void {\n this.__itemElements.forEach((e: Element) => {\n const i = e as Item;\n this.__acknowledgeItemElement(i);\n });\n }\n\n /**\n * Treat this item item element as part of the form:\n *\n * - listen to its change events\n * - set its currency to be the forms currency\n */\n private __acknowledgeItemElement(item: Item) {\n item.addEventListener('change', this.__itemChange.bind(this));\n item.currency = this.currency!;\n }\n\n /**\n * Checks if item has quantity and price\n *\n * @argument Item the item to be validated\n * @returns boolean the item is valid\n **/\n private __validItem(item: Item): boolean {\n const pid = item.getAttribute('pid');\n const qty = Number(item.getAttribute('quantity'));\n const price = Number(item.getAttribute('price'));\n return !!(pid && qty > 0 && price >= 0);\n }\n\n /**\n * Translates a frequency string\n *\n * @argument string the frequency string to be translated\n * @returns string the translated string\n */\n private __translateFrequency(frequency: string) {\n if (frequency.startsWith('0')) return this._t('frequency_once');\n if (frequency === '.5m') return this._t('frequency_0_5m');\n const { count, units } = parseDuration(frequency);\n return this._t('frequency', {\n units: this._t(units, { count }),\n count,\n });\n }\n\n /**\n * Translate a given amount\n *\n * @argument number the amount to be translated\n * @returns string the translated amount\n */\n private __translateAmount(amount: number) {\n return amount.toLocaleString(this.lang, {\n minimumFractionDigits: 2,\n currency: this.currency!,\n style: 'currency',\n });\n }\n\n private __updateData() {\n this.__data = null;\n const form = this.shadowRoot!.querySelector('form');\n if (!form) return;\n const data = new FormData();\n const itemsAdded = this.__formDataFill(data);\n this.__hasValidItems = !!itemsAdded;\n this.__formDataAddCartFields(data);\n this.__formDataCustomInputs(data);\n this.__data = data;\n }\n}\n"]}
|
|
@@ -1 +1 @@
|
|
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H,OAAO,IAAI,QAAQ,CAAC,IAAI,EAAE,EAAE,MAAM,EAAE,IAAI,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG,EAAE,CAAC,CAAC;AAC1D,CAAC","sourcesContent":["import traverse from 'traverse';\n\nexport function serveFromCache(requestUrl: string, data: any): Response {\n let body: string | null = null;\n\n traverse(data).forEach(function () {\n // looking for a standalone resource in the data first\n if (this.node?._links?.self?.href) {\n const fullHref = this.node?._links?.self?.href;\n const noZoomURL = new URL(this.node?._links?.self?.href);\n noZoomURL.searchParams.delete('zoom');\n\n if (requestUrl === fullHref || requestUrl === noZoomURL.toString()) {\n body = JSON.stringify(this.node);\n this.stop();\n return;\n }\n }\n\n // alternatively, looking for an embedded collection in the data\n Object.entries(this.node?._links ?? {}).some(([curie, link]) => {\n if ((link as any).href !== requestUrl) return false;\n\n // one of the related collection's href matches requested url, let's see if it's embedded...\n const embed = this.node?._embedded?.[curie];\n if (!embed || !Array.isArray(embed)) return false;\n\n // we found an embed, now let's build a response body\n // assuming that there's more than 20 items in the collection if 20 was returned\n\n const totalItems = embed.length < 20 ? embed.length : 21;\n const next = new URL(requestUrl);\n const last = new URL(requestUrl);\n\n next.searchParams.set('offset', embed.length.toString());\n last.searchParams.set('offset', totalItems.toString());\n\n body = JSON.stringify({\n returned_items: embed.length,\n total_items: totalItems,\n offset: 0,\n limit: 20,\n _embedded: { [curie]: embed },\n _links: {\n curies: this.node._links.curies,\n first: { href: requestUrl },\n last: { href: last.toString() },\n prev: { href: requestUrl },\n next: { href: next.toString() },\n self: { href: requestUrl },\n },\n });\n\n this.stop();\n return true;\n });\n });\n\n return new Response(body, { status: body ? 200 : 404 });\n}\n"]}
|
|
1
|
+
{"version":3,"file":"serveFromCache.js","sourceRoot":"","sources":["../../../../src/elements/public/NucleonElement/serveFromCache.ts"],"names":[],"mappings":"AAAA,OAAO,QAAQ,MAAM,UAAU,CAAC;AAEhC,6EAA6E;AAC7E,MAAM,UAAU,cAAc,CA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traverse';\n\n// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types\nexport function serveFromCache(requestUrl: string, data: any): Response {\n let body: string | null = null;\n\n traverse(data).forEach(function () {\n // looking for a standalone resource in the data first\n if (this.node?._links?.self?.href) {\n const fullHref = this.node?._links?.self?.href;\n const noZoomURL = new URL(this.node?._links?.self?.href);\n noZoomURL.searchParams.delete('zoom');\n\n if (requestUrl === fullHref || requestUrl === noZoomURL.toString()) {\n body = JSON.stringify(this.node);\n this.stop();\n return;\n }\n }\n\n // alternatively, looking for an embedded collection in the data\n Object.entries(this.node?._links ?? {}).some(([curie, link]) => {\n if ((link as any).href !== requestUrl) return false;\n\n // one of the related collection's href matches requested url, let's see if it's embedded...\n const embed = this.node?._embedded?.[curie];\n if (!embed || !Array.isArray(embed)) return false;\n\n // we found an embed, now let's build a response body\n // assuming that there's more than 20 items in the collection if 20 was returned\n\n const totalItems = embed.length < 20 ? embed.length : 21;\n const next = new URL(requestUrl);\n const last = new URL(requestUrl);\n\n next.searchParams.set('offset', embed.length.toString());\n last.searchParams.set('offset', totalItems.toString());\n\n body = JSON.stringify({\n returned_items: embed.length,\n total_items: totalItems,\n offset: 0,\n limit: 20,\n _embedded: { [curie]: embed },\n _links: {\n curies: this.node._links.curies,\n first: { href: requestUrl },\n last: { href: last.toString() },\n prev: { href: requestUrl },\n next: { href: next.toString() },\n self: { href: requestUrl },\n },\n });\n\n this.stop();\n return true;\n });\n });\n\n return new Response(body, { status: body ? 200 : 404 });\n}\n"]}
|
|
@@ -59,6 +59,7 @@ export declare class TaxForm extends Base<Data> {
|
|
|
59
59
|
static get properties(): PropertyDeclarations;
|
|
60
60
|
static get v8n(): NucleonV8N<Data>;
|
|
61
61
|
templates: Templates;
|
|
62
|
+
private __previousCountry;
|
|
62
63
|
private __countries;
|
|
63
64
|
private __regions;
|
|
64
65
|
private __countriesService;
|
|
@@ -101,5 +102,6 @@ export declare class TaxForm extends Base<Data> {
|
|
|
101
102
|
private __renderTimestamps;
|
|
102
103
|
private __renderCreate;
|
|
103
104
|
private __renderDelete;
|
|
105
|
+
private __submitOnEnter;
|
|
104
106
|
}
|
|
105
107
|
export {};
|
|
@@ -63,6 +63,7 @@ export class TaxForm extends Base {
|
|
|
63
63
|
constructor() {
|
|
64
64
|
super(...arguments);
|
|
65
65
|
this.templates = {};
|
|
66
|
+
this.__previousCountry = undefined;
|
|
66
67
|
this.__countries = '';
|
|
67
68
|
this.__regions = '';
|
|
68
69
|
this.__countriesService = interpret(Nucleon.machine.withConfig({
|
|
@@ -96,6 +97,7 @@ export class TaxForm extends Base {
|
|
|
96
97
|
'vaadin-combo-box': customElements.get('vaadin-combo-box'),
|
|
97
98
|
'vaadin-button': customElements.get('vaadin-button'),
|
|
98
99
|
'foxy-internal-confirm-dialog': customElements.get('foxy-internal-confirm-dialog'),
|
|
100
|
+
'foxy-internal-sandbox': customElements.get('foxy-internal-sandbox'),
|
|
99
101
|
'foxy-spinner': customElements.get('foxy-spinner'),
|
|
100
102
|
'foxy-i18n': customElements.get('foxy-i18n'),
|
|
101
103
|
'x-property-table': PropertyTable,
|
|
@@ -179,6 +181,7 @@ export class TaxForm extends Base {
|
|
|
179
181
|
${this.__isDeleteHidden ? null : this.__renderDelete()}
|
|
180
182
|
|
|
181
183
|
<div
|
|
184
|
+
data-testid="spinner"
|
|
182
185
|
class=${classMap({
|
|
183
186
|
'transition duration-500 ease-in-out absolute inset-0 flex': true,
|
|
184
187
|
'opacity-0 pointer-events-none': !this.in('busy') && !this.in('fail'),
|
|
@@ -198,6 +201,10 @@ export class TaxForm extends Base {
|
|
|
198
201
|
}
|
|
199
202
|
updated(changes) {
|
|
200
203
|
super.updated(changes);
|
|
204
|
+
if (this.form.country !== this.__previousCountry) {
|
|
205
|
+
this.__previousCountry = this.form.country;
|
|
206
|
+
this.__regionsService.send({ type: 'FETCH' });
|
|
207
|
+
}
|
|
201
208
|
// vaadin's combo box doesn't seem to validate on its own
|
|
202
209
|
this.renderRoot.querySelectorAll('vaadin-combo-box').forEach(e => e.validate());
|
|
203
210
|
}
|
|
@@ -285,6 +292,7 @@ export class TaxForm extends Base {
|
|
|
285
292
|
${this.renderTemplateOrSlot('name:before')}
|
|
286
293
|
|
|
287
294
|
<vaadin-text-field
|
|
295
|
+
data-testid="name"
|
|
288
296
|
class="w-full"
|
|
289
297
|
label=${this.t('name')}
|
|
290
298
|
value=${ifDefined(this.form.name)}
|
|
@@ -293,6 +301,7 @@ export class TaxForm extends Base {
|
|
|
293
301
|
?disabled=${this.in('busy') || this.disabledSelector.matches('name', true)}
|
|
294
302
|
?readonly=${this.readonlySelector.matches('name', true)}
|
|
295
303
|
required
|
|
304
|
+
@keydown=${this.__submitOnEnter}
|
|
296
305
|
@input=${(evt) => {
|
|
297
306
|
const newName = evt.currentTarget.value;
|
|
298
307
|
this.edit({ name: newName });
|
|
@@ -312,6 +321,7 @@ export class TaxForm extends Base {
|
|
|
312
321
|
${this.renderTemplateOrSlot('type:before')}
|
|
313
322
|
|
|
314
323
|
<x-dropdown
|
|
324
|
+
data-testid="type"
|
|
315
325
|
label=${this.t('type')}
|
|
316
326
|
value=${ifDefined(this.form.type)}
|
|
317
327
|
class="w-full"
|
|
@@ -355,8 +365,9 @@ export class TaxForm extends Base {
|
|
|
355
365
|
item-value-path="cc2"
|
|
356
366
|
item-label-path="default"
|
|
357
367
|
item-id-path="cc2"
|
|
368
|
+
data-testid="country"
|
|
358
369
|
label="${this.t('country')}${isLoadingItems ? ` • ${this.t('loading_busy')}` : ''}"
|
|
359
|
-
value=${ifDefined(this.form.country)}
|
|
370
|
+
value=${ifDefined(isLoadingItems ? undefined : this.form.country)}
|
|
360
371
|
class="w-full"
|
|
361
372
|
.checkValidity=${this.__getValidator('country')}
|
|
362
373
|
.errorMessage=${this.__getErrorMessage('country')}
|
|
@@ -399,8 +410,9 @@ export class TaxForm extends Base {
|
|
|
399
410
|
item-value-path="code"
|
|
400
411
|
item-label-path="default"
|
|
401
412
|
item-id-path="code"
|
|
413
|
+
data-testid="region"
|
|
402
414
|
label="${this.t('region')}${isLoadingItems ? ` • ${this.t('loading_busy')}` : ''}"
|
|
403
|
-
value=${ifDefined(this.form.region)}
|
|
415
|
+
value=${ifDefined(isLoadingItems ? undefined : this.form.region)}
|
|
404
416
|
class="w-full"
|
|
405
417
|
.checkValidity=${this.__getValidator('region')}
|
|
406
418
|
.errorMessage=${this.__getErrorMessage('region')}
|
|
@@ -426,6 +438,7 @@ export class TaxForm extends Base {
|
|
|
426
438
|
${this.renderTemplateOrSlot('city:before')}
|
|
427
439
|
|
|
428
440
|
<vaadin-text-field
|
|
441
|
+
data-testid="city"
|
|
429
442
|
class="w-full"
|
|
430
443
|
label=${this.t('city')}
|
|
431
444
|
value=${ifDefined(this.form.city)}
|
|
@@ -434,6 +447,7 @@ export class TaxForm extends Base {
|
|
|
434
447
|
?disabled=${this.in('busy') || this.disabledSelector.matches('city', true)}
|
|
435
448
|
?readonly=${this.readonlySelector.matches('city', true)}
|
|
436
449
|
required
|
|
450
|
+
@keydown=${this.__submitOnEnter}
|
|
437
451
|
@input=${(evt) => {
|
|
438
452
|
const newCity = evt.currentTarget.value;
|
|
439
453
|
this.edit({ city: newCity });
|
|
@@ -462,6 +476,7 @@ export class TaxForm extends Base {
|
|
|
462
476
|
${this.renderTemplateOrSlot('provider:before')}
|
|
463
477
|
|
|
464
478
|
<x-dropdown
|
|
479
|
+
data-testid="provider"
|
|
465
480
|
label=${this.t('tax_rate_provider')}
|
|
466
481
|
value=${this.form.service_provider || (this.form.is_live ? 'default' : 'none')}
|
|
467
482
|
class="w-full"
|
|
@@ -497,6 +512,7 @@ export class TaxForm extends Base {
|
|
|
497
512
|
${this.renderTemplateOrSlot('rate:before')}
|
|
498
513
|
|
|
499
514
|
<vaadin-integer-field
|
|
515
|
+
data-testid="rate"
|
|
500
516
|
class="w-full"
|
|
501
517
|
label=${this.t('tax_rate')}
|
|
502
518
|
value=${ifDefined(this.form.rate)}
|
|
@@ -508,6 +524,7 @@ export class TaxForm extends Base {
|
|
|
508
524
|
?disabled=${this.in('busy') || this.disabledSelector.matches('rate', true)}
|
|
509
525
|
?readonly=${this.readonlySelector.matches('rate', true)}
|
|
510
526
|
required
|
|
527
|
+
@keydown=${this.__submitOnEnter}
|
|
511
528
|
@change=${(evt) => {
|
|
512
529
|
const newRate = parseInt(evt.currentTarget.value);
|
|
513
530
|
this.edit({ rate: newRate });
|
|
@@ -525,8 +542,9 @@ export class TaxForm extends Base {
|
|
|
525
542
|
${this.renderTemplateOrSlot('apply-to-shipping:before')}
|
|
526
543
|
|
|
527
544
|
<x-checkbox
|
|
545
|
+
data-testid="apply-to-shipping"
|
|
528
546
|
class="leading-s"
|
|
529
|
-
?disabled=${this.disabledSelector.matches('apply-to-shipping', true)}
|
|
547
|
+
?disabled=${this.in('busy') || this.disabledSelector.matches('apply-to-shipping', true)}
|
|
530
548
|
?readonly=${this.readonlySelector.matches('apply-to-shipping', true)}
|
|
531
549
|
?checked=${!!this.form.apply_to_shipping}
|
|
532
550
|
@change=${(evt) => this.edit({ apply_to_shipping: evt.detail })}
|
|
@@ -558,8 +576,9 @@ export class TaxForm extends Base {
|
|
|
558
576
|
${this.renderTemplateOrSlot('use-origin-rates:before')}
|
|
559
577
|
|
|
560
578
|
<x-checkbox
|
|
579
|
+
data-testid="use-origin-rates"
|
|
561
580
|
class="leading-s"
|
|
562
|
-
?disabled=${this.disabledSelector.matches('use-origin-rates', true)}
|
|
581
|
+
?disabled=${this.in('busy') || this.disabledSelector.matches('use-origin-rates', true)}
|
|
563
582
|
?readonly=${this.readonlySelector.matches('use-origin-rates', true)}
|
|
564
583
|
?checked=${!!this.form.use_origin_rates}
|
|
565
584
|
@change=${(evt) => this.edit({ use_origin_rates: evt.detail })}
|
|
@@ -586,14 +605,16 @@ export class TaxForm extends Base {
|
|
|
586
605
|
`;
|
|
587
606
|
}
|
|
588
607
|
__renderExemptAllCustomerTaxIds() {
|
|
608
|
+
const scope = 'exempt-all-customer-tax-ids';
|
|
589
609
|
return html `
|
|
590
610
|
<div>
|
|
591
|
-
${this.renderTemplateOrSlot(
|
|
611
|
+
${this.renderTemplateOrSlot(`${scope}:before`)}
|
|
592
612
|
|
|
593
613
|
<x-checkbox
|
|
614
|
+
data-testid="${scope}"
|
|
594
615
|
class="leading-s"
|
|
595
|
-
?disabled=${this.disabledSelector.matches(
|
|
596
|
-
?readonly=${this.readonlySelector.matches(
|
|
616
|
+
?disabled=${this.in('busy') || this.disabledSelector.matches(scope, true)}
|
|
617
|
+
?readonly=${this.readonlySelector.matches(scope, true)}
|
|
597
618
|
?checked=${!!this.form.exempt_all_customer_tax_ids}
|
|
598
619
|
@change=${(evt) => {
|
|
599
620
|
this.edit({ exempt_all_customer_tax_ids: evt.detail });
|
|
@@ -616,7 +637,7 @@ export class TaxForm extends Base {
|
|
|
616
637
|
</foxy-i18n>
|
|
617
638
|
</x-checkbox>
|
|
618
639
|
|
|
619
|
-
${this.renderTemplateOrSlot(
|
|
640
|
+
${this.renderTemplateOrSlot(`${scope}:after`)}
|
|
620
641
|
</div>
|
|
621
642
|
`;
|
|
622
643
|
}
|
|
@@ -626,10 +647,15 @@ export class TaxForm extends Base {
|
|
|
626
647
|
${this.renderTemplateOrSlot('timestamps:before')}
|
|
627
648
|
|
|
628
649
|
<x-property-table
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
650
|
+
data-testid="timestamps"
|
|
651
|
+
.items=${['date_modified', 'date_created'].map(field => {
|
|
652
|
+
var _a;
|
|
653
|
+
return ({
|
|
654
|
+
name: this.t(field),
|
|
655
|
+
value: ((_a = this.data) === null || _a === void 0 ? void 0 : _a[field]) ? this.t('date', { value: new Date(this.data[field]) })
|
|
656
|
+
: '',
|
|
657
|
+
});
|
|
658
|
+
})}
|
|
633
659
|
>
|
|
634
660
|
</x-property-table>
|
|
635
661
|
|
|
@@ -651,6 +677,7 @@ export class TaxForm extends Base {
|
|
|
651
677
|
${this.renderTemplateOrSlot('create:before')}
|
|
652
678
|
|
|
653
679
|
<vaadin-button
|
|
680
|
+
data-testid="create"
|
|
654
681
|
class="w-full"
|
|
655
682
|
theme="primary success"
|
|
656
683
|
?disabled=${isBusy || isInvalid || this.disabledSelector.matches('create', true)}
|
|
@@ -667,6 +694,7 @@ export class TaxForm extends Base {
|
|
|
667
694
|
return html `
|
|
668
695
|
<div>
|
|
669
696
|
<foxy-internal-confirm-dialog
|
|
697
|
+
data-testid="confirm"
|
|
670
698
|
message="delete_prompt"
|
|
671
699
|
confirm="delete"
|
|
672
700
|
cancel="cancel"
|
|
@@ -682,6 +710,7 @@ export class TaxForm extends Base {
|
|
|
682
710
|
${this.renderTemplateOrSlot('delete:before')}
|
|
683
711
|
|
|
684
712
|
<vaadin-button
|
|
713
|
+
data-testid="delete"
|
|
685
714
|
theme="primary error"
|
|
686
715
|
class="w-full"
|
|
687
716
|
?disabled=${this.in('busy') || this.disabledSelector.matches('delete', true)}
|
|
@@ -697,5 +726,9 @@ export class TaxForm extends Base {
|
|
|
697
726
|
</div>
|
|
698
727
|
`;
|
|
699
728
|
}
|
|
729
|
+
__submitOnEnter(evt) {
|
|
730
|
+
if (evt.key === 'Enter')
|
|
731
|
+
this.submit();
|
|
732
|
+
}
|
|
700
733
|
}
|
|
701
734
|
//# sourceMappingURL=TaxForm.js.map
|