@foxy.io/elements 1.41.0-beta.1 → 1.41.0-beta.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cdn/foxy-access-recovery-form.js +1 -1
- package/dist/cdn/foxy-address-card.js +5 -5
- package/dist/cdn/foxy-address-form.js +1 -1
- package/dist/cdn/foxy-admin-subscription-card.js +1 -1
- package/dist/cdn/foxy-admin-subscription-form.js +1 -1
- package/dist/cdn/foxy-api-browser.js +1 -1
- package/dist/cdn/foxy-applied-coupon-code-card.js +1 -1
- package/dist/cdn/foxy-applied-coupon-code-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-billing-address-card.js +1 -1
- package/dist/cdn/foxy-cancellation-form.js +1 -1
- package/dist/cdn/foxy-cart-card.js +1 -1
- package/dist/cdn/foxy-cart-form.js +1 -1
- package/dist/cdn/foxy-client-card.js +1 -1
- package/dist/cdn/foxy-client-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-copy-to-clipboard.js +1 -1
- package/dist/cdn/foxy-coupon-card.js +1 -1
- package/dist/cdn/foxy-coupon-code-card.js +1 -1
- package/dist/cdn/foxy-coupon-code-form.js +1 -1
- package/dist/cdn/foxy-coupon-codes-form.js +1 -1
- package/dist/cdn/foxy-coupon-detail-card.js +1 -1
- package/dist/cdn/foxy-coupon-form.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-card.js +1 -1
- package/dist/cdn/foxy-customer-form.js +1 -1
- package/dist/cdn/foxy-customer-portal-settings-form.js +1 -1
- package/dist/cdn/foxy-customer-portal-settings.js +1 -1
- package/dist/cdn/foxy-customer-portal.js +1 -1
- package/dist/cdn/foxy-customer.js +1 -1
- package/dist/cdn/foxy-customers-table.js +1 -1
- package/dist/cdn/foxy-discount-builder.js +1 -1
- package/dist/cdn/foxy-discount-card.js +1 -1
- package/dist/cdn/foxy-discount-detail-card.js +1 -1
- package/dist/cdn/foxy-donation.js +1 -1
- package/dist/cdn/foxy-downloadable-card.js +1 -1
- package/dist/cdn/foxy-downloadable-form.js +1 -1
- package/dist/cdn/foxy-email-template-card.js +1 -1
- package/dist/cdn/foxy-email-template-form.js +1 -1
- package/dist/cdn/foxy-error-entry-card.js +1 -1
- package/dist/cdn/foxy-experimental-add-to-cart-builder.js +1 -1
- package/dist/cdn/foxy-filter-attribute-card.js +1 -1
- package/dist/cdn/foxy-filter-attribute-form.js +1 -1
- package/dist/cdn/foxy-form-dialog.js +1 -1
- package/dist/cdn/foxy-generate-codes-form.js +1 -1
- package/dist/cdn/foxy-gift-card-card.js +1 -1
- package/dist/cdn/foxy-gift-card-code-card.js +1 -1
- package/dist/cdn/foxy-gift-card-code-form.js +1 -1
- package/dist/cdn/foxy-gift-card-code-log-card.js +1 -1
- package/dist/cdn/foxy-gift-card-codes-form.js +1 -1
- package/dist/cdn/foxy-gift-card-form.js +1 -1
- package/dist/cdn/foxy-i18n-editor.js +1 -1
- package/dist/cdn/foxy-i18n.js +1 -1
- package/dist/cdn/foxy-integration-card.js +1 -1
- package/dist/cdn/foxy-integration-form.js +1 -1
- package/dist/cdn/foxy-item-card.js +1 -1
- package/dist/cdn/foxy-item-category-card.js +1 -1
- package/dist/cdn/foxy-item-category-form.js +1 -1
- package/dist/cdn/foxy-item-form.js +1 -1
- package/dist/cdn/foxy-item-option-card.js +1 -1
- package/dist/cdn/foxy-item-option-form.js +1 -1
- package/dist/cdn/foxy-items-form.js +1 -1
- package/dist/cdn/foxy-native-integration-card.js +1 -1
- package/dist/cdn/foxy-native-integration-form.js +1 -1
- package/dist/cdn/foxy-pagination.js +1 -1
- package/dist/cdn/foxy-passkey-card.js +1 -1
- package/dist/cdn/foxy-passkey-form.js +1 -1
- package/dist/cdn/foxy-payment-card-embed.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-payments-api-fraud-protection-card.js +1 -1
- package/dist/cdn/foxy-payments-api-fraud-protection-form.js +1 -1
- package/dist/cdn/foxy-payments-api-payment-method-card.js +1 -1
- package/dist/cdn/foxy-payments-api-payment-method-form.js +1 -1
- package/dist/cdn/foxy-payments-api-payment-preset-card.js +1 -1
- package/dist/cdn/foxy-payments-api-payment-preset-form.js +1 -1
- package/dist/cdn/foxy-query-builder.js +1 -1
- package/dist/cdn/foxy-report-form.js +2 -2
- package/dist/cdn/foxy-reports-table.js +6 -6
- package/dist/cdn/foxy-shipment-card.js +1 -1
- package/dist/cdn/foxy-shipping-container-card.js +1 -1
- package/dist/cdn/foxy-shipping-drop-type-card.js +1 -1
- package/dist/cdn/foxy-shipping-method-card.js +1 -1
- package/dist/cdn/foxy-shipping-service-card.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-store-card.js +1 -1
- package/dist/cdn/foxy-store-form.js +1 -1
- package/dist/cdn/foxy-store-shipping-method-form.js +1 -1
- package/dist/cdn/foxy-subscription-card.js +1 -1
- package/dist/cdn/foxy-subscription-form.js +1 -1
- package/dist/cdn/foxy-subscription-settings-form.js +1 -1
- 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 -1
- package/dist/cdn/foxy-template-form.js +1 -1
- package/dist/cdn/foxy-template-set-card.js +1 -1
- package/dist/cdn/foxy-template-set-form.js +1 -1
- package/dist/cdn/foxy-transaction-card.js +1 -1
- package/dist/cdn/foxy-transaction.js +1 -1
- package/dist/cdn/foxy-transactions-table.js +7 -7
- package/dist/cdn/foxy-update-payment-method-form.js +1 -1
- package/dist/cdn/foxy-user-card.js +1 -1
- package/dist/cdn/foxy-user-form.js +1 -1
- package/dist/cdn/foxy-user-invitation-card.js +1 -1
- package/dist/cdn/foxy-user-invitation-form.js +1 -1
- package/dist/cdn/foxy-users-table.js +1 -1
- package/dist/cdn/foxy-webhook-card.js +1 -1
- package/dist/cdn/foxy-webhook-form.js +1 -1
- package/dist/cdn/foxy-webhook-log-card.js +1 -1
- package/dist/cdn/foxy-webhook-status-card.js +1 -1
- package/dist/cdn/{shared-097635e6.js → shared-0179fbaa.js} +1 -1
- package/dist/cdn/{shared-c1e86ea4.js → shared-12ea5def.js} +1 -1
- package/dist/cdn/{shared-f1033d78.js → shared-1522e7b0.js} +3 -3
- package/dist/cdn/{shared-6be00444.js → shared-15f46bcc.js} +1 -1
- package/dist/cdn/{shared-243456aa.js → shared-1cd9967e.js} +1 -1
- package/dist/cdn/{shared-8b0f00fa.js → shared-2931ccbe.js} +1 -1
- package/dist/cdn/{shared-d807cb20.js → shared-29b0ef56.js} +1 -1
- package/dist/cdn/{shared-3fcf4feb.js → shared-2be606c3.js} +1 -1
- package/dist/cdn/{shared-8ef0ca65.js → shared-2fe84d72.js} +1 -1
- package/dist/cdn/{shared-360d6a20.js → shared-30829c7f.js} +1 -1
- package/dist/cdn/{shared-697d44e6.js → shared-313956af.js} +1 -1
- package/dist/cdn/{shared-63eef674.js → shared-32f04dd0.js} +1 -1
- package/dist/cdn/{shared-a03facdf.js → shared-34cbd863.js} +1 -1
- package/dist/cdn/shared-35dbfac1.js +1 -0
- package/dist/cdn/{shared-f9ac8763.js → shared-3ad093b5.js} +1 -1
- package/dist/cdn/{shared-11351c00.js → shared-3c0dcb9e.js} +2 -2
- package/dist/cdn/{shared-2d596f72.js → shared-3f381f99.js} +1 -1
- package/dist/cdn/{shared-84eb85dd.js → shared-43c39c6f.js} +1 -1
- package/dist/cdn/{shared-e41fced3.js → shared-4507220f.js} +1 -1
- package/dist/cdn/{shared-57a179b3.js → shared-49fef994.js} +1 -1
- package/dist/cdn/{shared-495860b4.js → shared-504d2acb.js} +1 -1
- package/dist/cdn/{shared-3556f4b7.js → shared-5231970e.js} +1 -1
- package/dist/cdn/{shared-6957b8e6.js → shared-535d1ec6.js} +1 -1
- package/dist/cdn/{shared-1c355fac.js → shared-54031a26.js} +2 -2
- package/dist/cdn/{shared-29f60d2f.js → shared-58a50b35.js} +5 -5
- package/dist/cdn/{shared-37348820.js → shared-58c0c5cc.js} +1 -1
- package/dist/cdn/{shared-c25538f1.js → shared-58f1f368.js} +2 -2
- package/dist/cdn/{shared-6199cae2.js → shared-59657e70.js} +1 -1
- package/dist/cdn/{shared-cf12f33b.js → shared-5988dd30.js} +1 -1
- package/dist/cdn/{shared-83c5e004.js → shared-619235ab.js} +1 -1
- package/dist/cdn/{shared-be442f26.js → shared-62a913ef.js} +1 -1
- package/dist/cdn/{shared-315d7620.js → shared-65763e6f.js} +1 -1
- package/dist/cdn/{shared-88220d9e.js → shared-678878ae.js} +1 -1
- package/dist/cdn/{shared-f69aacbc.js → shared-69943b4f.js} +1 -1
- package/dist/cdn/{shared-c46affa4.js → shared-72536261.js} +1 -1
- package/dist/cdn/{shared-4d32d19e.js → shared-72ebbdcd.js} +1 -1
- package/dist/cdn/{shared-230dee11.js → shared-75f0b4ce.js} +1 -1
- package/dist/cdn/{shared-9a64bf35.js → shared-7f25f727.js} +1 -1
- package/dist/cdn/{shared-bd5285ff.js → shared-8697a27e.js} +1 -1
- package/dist/cdn/{shared-35a49192.js → shared-86d308bf.js} +1 -1
- package/dist/cdn/{shared-86e9c57a.js → shared-8a380d5b.js} +1 -1
- package/dist/cdn/{shared-a587fd4b.js → shared-8ae33bf4.js} +1 -1
- package/dist/cdn/{shared-7097e2e1.js → shared-90a27f17.js} +1 -1
- package/dist/cdn/{shared-109ec474.js → shared-92f7ee94.js} +1 -1
- package/dist/cdn/{shared-67f73b81.js → shared-968df92b.js} +1 -1
- package/dist/cdn/{shared-c18f681b.js → shared-a146c6a5.js} +1 -1
- package/dist/cdn/{shared-0df46275.js → shared-a477b90e.js} +1 -1
- package/dist/cdn/{shared-f989c70e.js → shared-a4a847e4.js} +1 -1
- package/dist/cdn/{shared-8eeddc22.js → shared-a510a176.js} +1 -1
- package/dist/cdn/{shared-edeeb089.js → shared-acbcad2e.js} +1 -1
- package/dist/cdn/{shared-888018de.js → shared-be50c355.js} +1 -1
- package/dist/cdn/{shared-048d5cae.js → shared-c003fbf3.js} +1 -1
- package/dist/cdn/{shared-7dc9c80b.js → shared-c19d73fe.js} +1 -1
- package/dist/cdn/{shared-47d95cdd.js → shared-c5025eca.js} +1 -1
- package/dist/cdn/{shared-8b25a098.js → shared-c71fb90f.js} +1 -1
- package/dist/cdn/{shared-21e68b72.js → shared-cfea6000.js} +1 -1
- package/dist/cdn/{shared-f1a70f51.js → shared-d298bb95.js} +1 -1
- package/dist/cdn/{shared-43637d69.js → shared-df97fdc7.js} +1 -1
- package/dist/cdn/{shared-b65d169b.js → shared-e69c94bd.js} +1 -1
- package/dist/cdn/{shared-864ff856.js → shared-ec013722.js} +1 -1
- package/dist/cdn/{shared-18e3b778.js → shared-ee4757df.js} +1 -1
- package/dist/cdn/{shared-e3421ca1.js → shared-ef4d09da.js} +1 -1
- package/dist/cdn/{shared-1100bca8.js → shared-f2f81cda.js} +1 -1
- package/dist/cdn/{shared-6683daed.js → shared-fe56bcdb.js} +1 -1
- package/dist/cdn/{shared-77132fe8.js → shared-ffa49371.js} +1 -1
- package/dist/cdn/translations/admin-subscription-form/en.json +1 -0
- package/dist/cdn/translations/coupon-form/en.json +15 -0
- package/dist/cdn/translations/transaction/en.json +60 -35
- package/dist/elements/public/AdminSubscriptionForm/AdminSubscriptionForm.js +28 -8
- package/dist/elements/public/AdminSubscriptionForm/AdminSubscriptionForm.js.map +1 -1
- package/dist/elements/public/CouponForm/CouponForm.js +16 -1
- package/dist/elements/public/CouponForm/CouponForm.js.map +1 -1
- package/dist/elements/public/FilterAttributeForm/FilterAttributeForm.d.ts +2 -0
- package/dist/elements/public/FilterAttributeForm/FilterAttributeForm.js +22 -4
- package/dist/elements/public/FilterAttributeForm/FilterAttributeForm.js.map +1 -1
- package/dist/elements/public/Transaction/Transaction.js +5 -3
- package/dist/elements/public/Transaction/Transaction.js.map +1 -1
- package/dist/elements/public/Transaction/index.d.ts +1 -1
- package/dist/elements/public/Transaction/index.js +1 -1
- package/dist/elements/public/Transaction/index.js.map +1 -1
- package/dist/elements/public/Transaction/internal/InternalTransactionActionsControl/InternalTransactionActionsControl.js +16 -14
- package/dist/elements/public/Transaction/internal/InternalTransactionActionsControl/InternalTransactionActionsControl.js.map +1 -1
- package/dist/elements/public/Transaction/internal/InternalTransactionActionsControl/index.d.ts +1 -1
- package/dist/elements/public/Transaction/internal/InternalTransactionActionsControl/index.js +1 -1
- package/dist/elements/public/Transaction/internal/InternalTransactionActionsControl/index.js.map +1 -1
- package/dist/mixins/themeable.js +12 -0
- package/dist/mixins/themeable.js.map +1 -1
- package/package.json +1 -1
- package/dist/cdn/shared-3661a086.js +0 -1
- package/dist/cdn/translations/country/zh-cn.json +0 -248
- package/dist/cdn/translations/country/zh-hk.json +0 -245
- package/dist/cdn/translations/customer-portal/zh-hk.json +0 -1182
- package/dist/elements/public/Transaction/internal/InternalTransactionPostActionControl/InternalTransactionPostActionControl.d.ts +0 -10
- package/dist/elements/public/Transaction/internal/InternalTransactionPostActionControl/InternalTransactionPostActionControl.js +0 -60
- package/dist/elements/public/Transaction/internal/InternalTransactionPostActionControl/InternalTransactionPostActionControl.js.map +0 -1
- package/dist/elements/public/Transaction/internal/InternalTransactionPostActionControl/index.d.ts +0 -6
- package/dist/elements/public/Transaction/internal/InternalTransactionPostActionControl/index.js +0 -8
- package/dist/elements/public/Transaction/internal/InternalTransactionPostActionControl/index.js.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
import{_ as e}from"./shared-cb58dfcd.js";import{h as t}from"./shared-ba5c42c7.js";import{C as l}from"./shared-5afb584d.js";import"./foxy-nucleon-element.js";import{R as s,T as a,a as i}from"./shared-
|
|
1
|
+
import{_ as e}from"./shared-cb58dfcd.js";import{h as t}from"./shared-ba5c42c7.js";import{C as l}from"./shared-5afb584d.js";import"./foxy-nucleon-element.js";import{R as s,T as a,a as i}from"./shared-3c0dcb9e.js";import{c as r}from"./shared-4e709717.js";import{N as d}from"./shared-f83207fb.js";let n,o,h,c,m,u=e=>e;const b=l(s(a(i(d))));class p extends b{constructor(){super(...arguments),this.columns=[]}static get properties(){return e(e({},super.properties),{},{columns:{attribute:!1}})}render(){var e,l;const s=this.columns.some((e=>!!e.header));return t(n||(n=u` <div data-testid="wrapper" aria-busy="${0}" aria-live="polite" class="relative font-lumo text-m"> <table class="table-fixed w-full" data-testid="table"> <thead class="${0}"> <tr> ${0} </tr> </thead> <tbody class="divide-y divide-contrast-10"> ${0} </tbody> </table> ${0} </div> ${0} `),this.in("busy"),s?"border-b border-contrast-10":"sr-only",this.columns.map(((e,l)=>{var s;return t(o||(o=u` <th class="${0}"> ${0} </th> `),r({"truncate h-l text-tertiary text-m text-left font-medium":!0,"text-right":l===this.columns.length-1,"hidden sm-table-cell":"sm"===e.hideBelow,"hidden md-table-cell":"md"===e.hideBelow,"hidden lg-table-cell":"lg"===e.hideBelow,"hidden xl-table-cell":"xl"===e.hideBelow}),null===(s=e.header)||void 0===s?void 0:s.call(e,{html:t,lang:this.lang,data:this.data,ns:this.ns}))})),this.__rows.map((e=>{var l;return t(h||(h=u` <tr class="h-l"> ${0} </tr> `),null===(l=this.columns)||void 0===l?void 0:l.map(((l,s)=>{var a;return t(c||(c=u` <td class="${0}"> ${0} </td> `),r({"text-right":s===this.columns.length-1,"hidden sm-table-cell":"sm"===l.hideBelow,"hidden md-table-cell":"md"===l.hideBelow,"hidden lg-table-cell":"lg"===l.hideBelow,"hidden xl-table-cell":"xl"===l.hideBelow,"truncate h-l text-body":!0}),e?null===(a=l.cell)||void 0===a?void 0:a.call(l,{html:t,lang:this.lang,data:e,ns:this.ns}):"")})))})),this.in({idle:"snapshot"})?"":t(m||(m=u` <div class="absolute inset-0 flex items-center justify-center"> <foxy-spinner data-testid="spinner" layout="vertical" state="${0}" class="p-m bg-base shadow-xs rounded-t-l rounded-b-l" lang="${0}" ns="${0} ${0}"> </foxy-spinner> </div> `),this.in("busy")?"busy":this.in("idle")?"empty":"error",this.lang,this.ns,null!==(l=null===(e=customElements.get("foxy-spinner"))||void 0===e?void 0:e.defaultNS)&&void 0!==l?l:""),this.renderTemplateOrSlot())}get __rows(){var e,t,l;const s=Object.values(null!==(t=null===(e=this.data)||void 0===e?void 0:e._embedded)&&void 0!==t?t:{}).reduce(((e,t)=>[...e,...t]),[]);let a;if(0===s.length)try{const e=new URL(null!==(l=this.href)&&void 0!==l?l:"").searchParams.get("limit"),t=parseInt(null!=e?e:"");a=isNaN(t)?20:t}catch(e){a=20}else a=s.length;return new Array(a).fill(null).map(((e,t)=>{var l;return null!==(l=s[t])&&void 0!==l?l:e}))}}export{p as T};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import"./shared-
|
|
1
|
+
import"./shared-2fe84d72.js";import"./shared-72ebbdcd.js";import{_ as t}from"./shared-cb58dfcd.js";import{h as e}from"./shared-ba5c42c7.js";import{D as s}from"./shared-c003fbf3.js";let i,n=t=>t;customElements.define("foxy-internal-confirm-dialog",class extends s{constructor(){super(...arguments),this.closable=!1,this.editable=!1,this.alert=!0,this.messageOptions={},this.confirm="confirm",this.message="message",this.cancel="cancel",this.theme="primary"}static get properties(){return t(t({},super.properties),{},{messageOptions:{type:Object,attribute:"message-options"},confirm:{type:String},message:{type:String},cancel:{type:String},theme:{type:String}})}render(){return super.render((()=>e(i||(i=n` <foxy-i18n class="block font-lumo text-m text-body text-center mb-m" lang="${0}" key="${0}" ns="${0}" .options="${0}"> </foxy-i18n> <div class="grid grid-cols-2 gap-m"> <vaadin-button data-testid="cancelButton" @click="${0}"> <foxy-i18n ns="${0}" lang="${0}" key="${0}"></foxy-i18n> </vaadin-button> <vaadin-button theme="${0}" data-testid="confirmButton" @click="${0}"> <foxy-i18n ns="${0}" lang="${0}" key="${0}"></foxy-i18n> </vaadin-button> </div> `),this.lang,this.message,this.ns,this.messageOptions,this.__handleCancel,this.ns,this.lang,this.cancel,this.theme,this.__handleConfirm,this.ns,this.lang,this.confirm)))}async __handleCancel(){await this.hide(!0)}async __handleConfirm(){await this.hide()}});
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import"./shared-
|
|
1
|
+
import"./shared-3ad093b5.js";import"./shared-a4a847e4.js";import{h as e,P as t}from"./shared-cfea6000.js";import{E as s,T as r}from"./shared-65763e6f.js";import{F as l}from"./shared-58c0c5cc.js";const i=e`<dom-module id="lumo-custom-field" theme-for="vaadin-custom-field">
|
|
2
2
|
<template>
|
|
3
3
|
<style include="lumo-required-field">
|
|
4
4
|
:host {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import"./shared-
|
|
1
|
+
import"./shared-e69c94bd.js";import"./shared-acbcad2e.js";import"./shared-619235ab.js";import"./shared-fe56bcdb.js";import"./shared-1cd9967e.js";import{a as e}from"./shared-92f7ee94.js";import{_ as t}from"./shared-cb58dfcd.js";import{c as i,h as a,s}from"./shared-ba5c42c7.js";import{i as l}from"./shared-53e42a77.js";import{c as o}from"./shared-4e709717.js";let n,r,d,h,u,c,p=e=>e;customElements.define("foxy-internal-frequency-control",class extends e{constructor(){super(...arguments),this.allowTwiceAMonth=!1,this.options=[{value:"d",label:"day"},{value:"w",label:"week"},{value:"m",label:"month"},{value:"y",label:"year"}],this.layout=null,this.max=999,this.__i18n={formatValue:e=>e.join(""),parseValue:e=>{var t;const i=e.startsWith(".")?`0${e}`:e,a=parseFloat(e.substring(0,Math.max(i.length-1,0))),s=null!==(t=i[i.length-1])&&void 0!==t?t:"";return isNaN(a)?["0",""]:[a.toString(),s]}}}static get properties(){return t(t({},super.properties),{},{allowTwiceAMonth:{type:Boolean,attribute:"allow-twice-a-month"},options:{attribute:!1},layout:{},max:{type:Number}})}static get styles(){return[super.styles,i(n||(n=p`: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}input::-webkit-inner-spin-button,input::-webkit-outer-spin-button{-webkit-appearance:none;margin:0}input{-moz-appearance:textfield}`))]}renderControl(){var e,t;if("summary-item"===this.layout)return this.__renderSummaryItemLayout();const i=null!==(e=this._value)&&void 0!==e?e:"",s=parseFloat(this.__i18n.parseValue(i)[0]),o=this.options.map((({value:e,label:t})=>({label:this.t(t,{count:s}),value:e})));return a(r||(r=p` <vaadin-custom-field ?disabled="${0}" ?readonly="${0}" .checkValidity="${0}" .errorMessage="${0}" .helperText="${0}" .label="${0}" .value="${0}" .i18n="${0}" @change="${0}"> <vaadin-integer-field max="${0}" min="1" prevent-invalid-input has-controls ?disabled="${0}" ?readonly="${0}" ?invalid="${0}" @keydown="${0}"> </vaadin-integer-field> <vaadin-combo-box item-value-path="value" item-label-path="label" ?disabled="${0}" ?readonly="${0}" ?invalid="${0}" .items="${0}" @keydown="${0}"> </vaadin-combo-box> </vaadin-custom-field> `),this.disabled,this.readonly,this._checkValidity,null!==(t=this._errorMessage)&&void 0!==t?t:"",this.helperText,this.label,i,this.__i18n,(e=>{const t=e.currentTarget;this._value=t.value}),l(this.max||void 0),this.disabled,this.readonly,!this._checkValidity(),(e=>{var t;return"Enter"===e.key&&(null===(t=this.nucleon)||void 0===t?void 0:t.submit())}),this.disabled,this.readonly,!this._checkValidity(),o,(e=>{var t;return"Enter"===e.key&&(null===(t=this.nucleon)||void 0===t?void 0:t.submit())}))}updated(e){var t;super.updated(e);const i=this.renderRoot.querySelector("vaadin-custom-field");i&&i.value!==this._value&&(i.value=null!==(t=this._value)&&void 0!==t?t:"")}__renderSummaryItemLayout(){var e,t;const i=null!==(e=this._value)&&void 0!==e?e:"",[n,r]=this.__i18n.parseValue(i),m=parseFloat(n),v=".5m"!==this._value||this.allowTwiceAMonth?this.options.find((e=>e.value===r)):void 0;return a(d||(d=p` <div class="leading-xs"> <div class="flex items-center gap-xs"> <label class="text-m text-body flex-1 whitespace-nowrap" for="input">${0}</label> <input placeholder="${0}" inputmode="numeric" style="min-width:10ch" class="${0}" type="number" step="1" min="1" max="${0}" id="input" .value="${0}" ?disabled="${0}" ?readonly="${0}" @keydown="${0}" @input="${0}"> <div class="${0}"> <div class="flex items-center gap-xs"> <div class="whitespace-nowrap"> ${0} </div> ${0} </div> <select class="${0}" id="select" ?disabled="${0}" ?hidden="${0}" @change="${0}"> <option value="" ?selected="${0}" disabled="disabled" hidden>${0}</option> ${0} ${0} </select> </div> </div> <div style="max-width:32rem"> <p class="text-xs text-secondary">${0}</p> <p class="text-xs text-error" ?hidden="${0}"> ${0} </p> </div> </div> `),this.label,this.placeholder,o({"w-full appearance-none text-right bg-transparent transition-colors":!0,"text-m rounded-s focus-outline-none":!0,"text-secondary":this.readonly,"text-disabled":this.disabled,"font-medium":!this.readonly}),l(null!==(t=this.max)&&void 0!==t?t:void 0),".5m"===i?this.allowTwiceAMonth?2:"":m,this.disabled,this.readonly,(e=>{var t;return"Enter"===e.key&&(null===(t=this.nucleon)||void 0===t?void 0:t.submit())}),(e=>{e.stopPropagation();const t=e.currentTarget;this._value=this.__i18n.formatValue([t.value,r])}),o({"relative rounded-s transition-colors transition-opacity":!0,"focus-within-ring-2 focus-within-ring-primary-50":!this.disabled&&!this.readonly,"text-body hover-opacity-80 cursor-pointer":!this.disabled&&!this.readonly,"text-secondary":this.readonly,"text-disabled":this.disabled,"font-medium":!this.readonly}),".5m"===i?this.t("times_a_month"):v?this.t(v.label,{count:m}):this.t("select"),this.readonly?"":s(h||(h=p`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20" fill="currentColor" style="width: 1em; height: 1em; transform: scale(1.25)"><path fill-rule="evenodd" d="M10.53 3.47a.75.75 0 0 0-1.06 0L6.22 6.72a.75.75 0 0 0 1.06 1.06L10 5.06l2.72 2.72a.75.75 0 1 0 1.06-1.06l-3.25-3.25Zm-4.31 9.81 3.25 3.25a.75.75 0 0 0 1.06 0l3.25-3.25a.75.75 0 1 0-1.06-1.06L10 14.94l-2.72-2.72a.75.75 0 0 0-1.06 1.06Z" clip-rule="evenodd" /></svg>`)),o({"absolute inset-0 opacity-0":!0,"cursor-pointer":!this.disabled&&!this.readonly}),this.disabled,this.readonly,(e=>{e.stopPropagation();const t=e.currentTarget.value;this._value="times_a_month"===t?".5m":this.__i18n.formatValue([m,t])}),!v,this.t("select"),!this.allowTwiceAMonth||2!==m&&".5m"!==i?"":a(u||(u=p` <option value="times_a_month" ?selected="${0}"> ${0} </option> `),".5m"===i,this.t("times_a_month")),this.options.map((e=>a(c||(c=p` <option value="${0}" ?selected="${0}"> ${0} </option> `),e.value,".5m"!==i&&e.value===(null==v?void 0:v.value),this.t(e.label,{count:m})))),this.helperText,this.disabled||this.readonly,this._errorMessage)}});
|
|
@@ -88,6 +88,7 @@
|
|
|
88
88
|
"overdue": {
|
|
89
89
|
"label": "",
|
|
90
90
|
"helper_text": "",
|
|
91
|
+
"error_with_zero_past_due_hint": "A past due amount has been successfully captured. Click to see the details.",
|
|
91
92
|
"past-due-amount": {
|
|
92
93
|
"label": "Past due amount",
|
|
93
94
|
"helper_text": "Missing payments increase this amount. Depending on your store settings, we may charge it automatically on the next billing cycle.",
|
|
@@ -171,6 +171,11 @@
|
|
|
171
171
|
"description": "Description",
|
|
172
172
|
"url_parameter": "URL parameter"
|
|
173
173
|
},
|
|
174
|
+
"coupon-codes-stub": {
|
|
175
|
+
"label": "Codes",
|
|
176
|
+
"helper_text": "",
|
|
177
|
+
"text": "Coupon codes can be added after creating the coupon."
|
|
178
|
+
},
|
|
174
179
|
"coupon-codes": {
|
|
175
180
|
"label": "Codes",
|
|
176
181
|
"delete_header": "Remove code?",
|
|
@@ -349,6 +354,11 @@
|
|
|
349
354
|
"value": "Value"
|
|
350
355
|
}
|
|
351
356
|
},
|
|
357
|
+
"attributes-stub": {
|
|
358
|
+
"label": "Attributes",
|
|
359
|
+
"helper_text": "",
|
|
360
|
+
"text": "Attributes can be added after creating the coupon."
|
|
361
|
+
},
|
|
352
362
|
"attributes": {
|
|
353
363
|
"label": "Attributes",
|
|
354
364
|
"delete_header": "Remove attribute?",
|
|
@@ -546,6 +556,11 @@
|
|
|
546
556
|
"option_name": "Option name",
|
|
547
557
|
"rule": "Rule"
|
|
548
558
|
},
|
|
559
|
+
"category-restrictions-stub": {
|
|
560
|
+
"label": "Item category restrictions",
|
|
561
|
+
"helper_text": "",
|
|
562
|
+
"text": "Item category restrictions can be added after creating the coupon."
|
|
563
|
+
},
|
|
549
564
|
"category-restrictions": {
|
|
550
565
|
"label": "Item category restrictions",
|
|
551
566
|
"status_saving": "Saving...",
|
|
@@ -869,14 +869,19 @@
|
|
|
869
869
|
"unchecked": "Not sent"
|
|
870
870
|
},
|
|
871
871
|
"process-webhook": {
|
|
872
|
-
"
|
|
873
|
-
|
|
874
|
-
|
|
875
|
-
|
|
876
|
-
|
|
877
|
-
"
|
|
872
|
+
"button": {
|
|
873
|
+
"idle": "Resend datafeed",
|
|
874
|
+
"busy": "Processing..."
|
|
875
|
+
},
|
|
876
|
+
"notification": {
|
|
877
|
+
"success": "XML datafeed resent successfully",
|
|
878
|
+
"error": "Failed to resend datafeed"
|
|
879
|
+
},
|
|
880
|
+
"confirm-dialog": {
|
|
881
|
+
"message": "This will attempt to resend the XML datafeed. Would you like to proceed?",
|
|
878
882
|
"confirm": "Yes",
|
|
879
|
-
"cancel": "No"
|
|
883
|
+
"cancel": "No",
|
|
884
|
+
"header": "Resend datafeed"
|
|
880
885
|
}
|
|
881
886
|
}
|
|
882
887
|
},
|
|
@@ -1674,47 +1679,67 @@
|
|
|
1674
1679
|
},
|
|
1675
1680
|
"actions": {
|
|
1676
1681
|
"capture": {
|
|
1677
|
-
"
|
|
1678
|
-
|
|
1679
|
-
|
|
1680
|
-
|
|
1681
|
-
|
|
1682
|
-
"
|
|
1682
|
+
"button": {
|
|
1683
|
+
"idle": "Capture",
|
|
1684
|
+
"busy": "Processing..."
|
|
1685
|
+
},
|
|
1686
|
+
"notification": {
|
|
1687
|
+
"success": "Captured successfully",
|
|
1688
|
+
"error": "Failed to capture"
|
|
1689
|
+
},
|
|
1690
|
+
"confirm-dialog": {
|
|
1691
|
+
"message": "This will attempt to capture this transaction. Would you like to proceed?",
|
|
1683
1692
|
"confirm": "Yes",
|
|
1684
|
-
"cancel": "No"
|
|
1693
|
+
"cancel": "No",
|
|
1694
|
+
"header": "Capture"
|
|
1685
1695
|
}
|
|
1686
1696
|
},
|
|
1687
1697
|
"void": {
|
|
1688
|
-
"
|
|
1689
|
-
|
|
1690
|
-
|
|
1691
|
-
|
|
1692
|
-
|
|
1693
|
-
"
|
|
1698
|
+
"button": {
|
|
1699
|
+
"idle": "Void",
|
|
1700
|
+
"busy": "Processing..."
|
|
1701
|
+
},
|
|
1702
|
+
"notification": {
|
|
1703
|
+
"success": "Voided successfully",
|
|
1704
|
+
"error": "Failed to void"
|
|
1705
|
+
},
|
|
1706
|
+
"confirm-dialog": {
|
|
1707
|
+
"message": "This will attempt to void this transaction. Would you like to proceed?",
|
|
1694
1708
|
"confirm": "Yes",
|
|
1695
|
-
"cancel": "No"
|
|
1709
|
+
"cancel": "No",
|
|
1710
|
+
"header": "Void"
|
|
1696
1711
|
}
|
|
1697
1712
|
},
|
|
1698
1713
|
"refund": {
|
|
1699
|
-
"
|
|
1700
|
-
|
|
1701
|
-
|
|
1702
|
-
|
|
1703
|
-
|
|
1704
|
-
"
|
|
1714
|
+
"button": {
|
|
1715
|
+
"idle": "Refund",
|
|
1716
|
+
"busy": "Processing..."
|
|
1717
|
+
},
|
|
1718
|
+
"notification": {
|
|
1719
|
+
"success": "Refunded successfully",
|
|
1720
|
+
"error": "Failed to refund"
|
|
1721
|
+
},
|
|
1722
|
+
"confirm-dialog": {
|
|
1723
|
+
"message": "This will attempt to refund this transaction. Would you like to proceed?",
|
|
1705
1724
|
"confirm": "Yes",
|
|
1706
|
-
"cancel": "No"
|
|
1725
|
+
"cancel": "No",
|
|
1726
|
+
"header": "Refund"
|
|
1707
1727
|
}
|
|
1708
1728
|
},
|
|
1709
1729
|
"send-emails": {
|
|
1710
|
-
"
|
|
1711
|
-
|
|
1712
|
-
|
|
1713
|
-
|
|
1714
|
-
|
|
1715
|
-
"
|
|
1730
|
+
"button": {
|
|
1731
|
+
"idle": "Resend emails",
|
|
1732
|
+
"busy": "Sending..."
|
|
1733
|
+
},
|
|
1734
|
+
"notification": {
|
|
1735
|
+
"success": "Emails resent successfully",
|
|
1736
|
+
"error": "Failed to resend emails"
|
|
1737
|
+
},
|
|
1738
|
+
"confirm-dialog": {
|
|
1739
|
+
"message": "This will attempt to resend emails for this transaction. Would you like to proceed?",
|
|
1716
1740
|
"confirm": "Yes",
|
|
1717
|
-
"cancel": "No"
|
|
1741
|
+
"cancel": "No",
|
|
1742
|
+
"header": "Resend emails"
|
|
1718
1743
|
}
|
|
1719
1744
|
},
|
|
1720
1745
|
"subscription": {
|
|
@@ -19,11 +19,11 @@ export class AdminSubscriptionForm extends Base {
|
|
|
19
19
|
};
|
|
20
20
|
}
|
|
21
21
|
get hiddenSelector() {
|
|
22
|
-
var _a, _b;
|
|
23
22
|
const alwaysMatch = ['delete', super.hiddenSelector.toString()];
|
|
24
|
-
|
|
23
|
+
const data = this.data;
|
|
24
|
+
if (!(data === null || data === void 0 ? void 0 : data.error_message) || !data.past_due_amount)
|
|
25
25
|
alwaysMatch.unshift('error-message');
|
|
26
|
-
if (!(
|
|
26
|
+
if (!(data === null || data === void 0 ? void 0 : data.is_active))
|
|
27
27
|
alwaysMatch.unshift('view-action', 'cancel-action');
|
|
28
28
|
return new BooleanSelector(alwaysMatch.join(' ').trim());
|
|
29
29
|
}
|
|
@@ -32,20 +32,21 @@ export class AdminSubscriptionForm extends Base {
|
|
|
32
32
|
return status ? `subtitle_${status}` : super.headerSubtitleKey;
|
|
33
33
|
}
|
|
34
34
|
renderBody() {
|
|
35
|
-
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
35
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
36
36
|
let transactionsHref;
|
|
37
37
|
try {
|
|
38
38
|
const url = new URL((_b = (_a = this.data) === null || _a === void 0 ? void 0 : _a._links['fx:transactions'].href) !== null && _b !== void 0 ? _b : '');
|
|
39
39
|
url.searchParams.set('zoom', 'items');
|
|
40
40
|
transactionsHref = url.toString();
|
|
41
41
|
}
|
|
42
|
-
catch (
|
|
42
|
+
catch (_k) {
|
|
43
43
|
transactionsHref = undefined;
|
|
44
44
|
}
|
|
45
45
|
// @ts-expect-error - SDK doesn't know yet about the `fx:charge_past_due` link.
|
|
46
46
|
const chargePastDueHref = (_d = (_c = this.data) === null || _c === void 0 ? void 0 : _c._links['fx:charge_past_due']) === null || _d === void 0 ? void 0 : _d.href;
|
|
47
47
|
const pastDueAmount = (_e = this.data) === null || _e === void 0 ? void 0 : _e.past_due_amount;
|
|
48
|
-
const
|
|
48
|
+
const errorMessage = (_f = this.data) === null || _f === void 0 ? void 0 : _f.error_message;
|
|
49
|
+
const currencyCode = (_g = this.data) === null || _g === void 0 ? void 0 : _g._embedded['fx:transaction_template'].currency_code;
|
|
49
50
|
return html `
|
|
50
51
|
${this.renderHeader()}
|
|
51
52
|
|
|
@@ -87,7 +88,26 @@ export class AdminSubscriptionForm extends Base {
|
|
|
87
88
|
>
|
|
88
89
|
</foxy-internal-post-action-control>
|
|
89
90
|
`
|
|
90
|
-
:
|
|
91
|
+
: errorMessage && !pastDueAmount
|
|
92
|
+
? html `
|
|
93
|
+
<details
|
|
94
|
+
class="leading-xs text-xs text-secondary rounded-b focus-within-ring-2 focus-within-ring-inset focus-within-ring-primary-50"
|
|
95
|
+
style="--gap: calc(0.625em + (var(--lumo-border-radius) / 4) - 1px)"
|
|
96
|
+
>
|
|
97
|
+
<summary
|
|
98
|
+
class="cursor-pointer transition-colors hover-text-body focus-outline-none"
|
|
99
|
+
>
|
|
100
|
+
<span class="flex items-start" style="gap: var(--gap)">
|
|
101
|
+
${svg `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" fill="currentColor" aria-hidden="true" class="flex-shrink-0" style="width: 1.25em"><path fill-rule="evenodd" d="M15 8A7 7 0 1 1 1 8a7 7 0 0 1 14 0ZM9 5a1 1 0 1 1-2 0 1 1 0 0 1 2 0ZM6.75 8a.75.75 0 0 0 0 1.5h.75v1.75a.75.75 0 0 0 1.5 0v-2.5A.75.75 0 0 0 8.25 8h-1.5Z" clip-rule="evenodd" /></svg>`}
|
|
102
|
+
<foxy-i18n infer="" key="error_with_zero_past_due_hint"></foxy-i18n>
|
|
103
|
+
</span>
|
|
104
|
+
</summary>
|
|
105
|
+
<p style="padding-left: calc(1.25em + var(--gap))" class="pt-xs">
|
|
106
|
+
<span class="whitespace-pre-line">${errorMessage}</span>
|
|
107
|
+
</p>
|
|
108
|
+
</details>
|
|
109
|
+
`
|
|
110
|
+
: ''}
|
|
91
111
|
</foxy-internal-summary-control>
|
|
92
112
|
|
|
93
113
|
<foxy-internal-summary-control infer="self-service-links">
|
|
@@ -139,7 +159,7 @@ export class AdminSubscriptionForm extends Base {
|
|
|
139
159
|
<foxy-internal-async-list-control
|
|
140
160
|
infer="attributes"
|
|
141
161
|
class="min-w-0"
|
|
142
|
-
first=${ifDefined((
|
|
162
|
+
first=${ifDefined((_j = (_h = this.data) === null || _h === void 0 ? void 0 : _h._links) === null || _j === void 0 ? void 0 : _j['fx:attributes'].href)}
|
|
143
163
|
item="foxy-attribute-card"
|
|
144
164
|
form="foxy-attribute-form"
|
|
145
165
|
alert
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AdminSubscriptionForm.js","sourceRoot":"","sources":["../../../../src/elements/public/AdminSubscriptionForm/AdminSubscriptionForm.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,qBAAqB,EAAE,kDAA+C;AAC/E,OAAO,EAAE,iBAAiB,EAAE,wCAAqC;AACjE,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACpD,OAAO,EAAE,YAAY,EAAE,oDAAiD;AACxE,OAAO,EAAE,SAAS,EAAE,MAAM,gCAAgC,CAAC;AAC3D,OAAO,EAAE,IAAI,EAAE,GAAG,EAAE,MAAM,UAAU,CAAC;AAErC,MAAM,EAAE,GAAG,yBAAyB,CAAC;AACrC,MAAM,IAAI,GAAG,iBAAiB,CAAC,YAAY,EAAE,EAAE,CAAC,CAAC;AAEjD,MAAM,OAAO,qBAAsB,SAAQ,IAAU;IAArD;;QAQE,yHAAyH;QACzH,oBAAe,GAAkB,IAAI,CAAC;IAkJxC,CAAC;IA1JC,MAAM,KAAK,UAAU;QACnB,OAAO;YACL,GAAG,KAAK,CAAC,UAAU;YACnB,eAAe,EAAE,EAAE,SAAS,EAAE,mBAAmB,EAAE;SACpD,CAAC;IACJ,CAAC;IAKD,IAAI,cAAc;;QAChB,MAAM,WAAW,GAAG,CAAC,QAAQ,EAAE,KAAK,CAAC,cAAc,CAAC,QAAQ,EAAE,CAAC,CAAC;QAChE,IAAI,QAAC,IAAI,CAAC,IAAI,0CAAE,aAAa,CAAA;YAAE,WAAW,CAAC,OAAO,CAAC,eAAe,CAAC,CAAC;QACpE,IAAI,QAAC,IAAI,CAAC,IAAI,0CAAE,SAAS,CAAA;YAAE,WAAW,CAAC,OAAO,CAAC,aAAa,EAAE,eAAe,CAAC,CAAC;QAC/E,OAAO,IAAI,eAAe,CAAC,WAAW,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,CAAC,CAAC;IAC3D,CAAC;IAED,IAAI,iBAAiB;QACnB,MA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GtW,IAAI,CAAC,eAAe;YACpB,CAAC,CAAC,IAAI,CAAA;;;;2BAIO,IAAI,CAAC,eAAe;;;;iBAI9B;YACH,CAAC,CAAC,EAAE;;;;;QAKV,IAAI,CAAC,oBAAoB,EAAE;;;;;gBAKnB,SAAS,aAAC,IAAI,CAAC,IAAI,0CAAE,MAAM,0CAAG,eAAe,EAAE,IAAI,CAAC;;;;;;;;;;gBAUpD,SAAS,CAAC,gBAAgB,CAAC;;;;;;;;;;QAUnC,KAAK,CAAC,UAAU,EAAE;KACrB,CAAC;IACJ,CAAC;CACF","sourcesContent":["import type { PropertyDeclarations } from 'lit-element';\nimport type { TemplateResult } from 'lit-html';\nimport type { Data } from './types';\n\nimport { getSubscriptionStatus } from '../../../utils/get-subscription-status';\nimport { TranslatableMixin } from '../../../mixins/translatable';\nimport { BooleanSelector } from '@foxy.io/sdk/core';\nimport { InternalForm } from '../../internal/InternalForm/InternalForm';\nimport { ifDefined } from 'lit-html/directives/if-defined';\nimport { html, svg } from 'lit-html';\n\nconst NS = 'admin-subscription-form';\nconst Base = TranslatableMixin(InternalForm, NS);\n\nexport class AdminSubscriptionForm extends Base<Data> {\n static get properties(): PropertyDeclarations {\n return {\n ...super.properties,\n uoeSettingsPage: { attribute: 'uoe-settings-page' },\n };\n }\n\n /** URL of the UOE settings page in the admin. If set, displays a link to that page in the self-service links section. */\n uoeSettingsPage: string | null = null;\n\n get hiddenSelector(): BooleanSelector {\n const alwaysMatch = ['delete', super.hiddenSelector.toString()];\n if (!this.data?.error_message) alwaysMatch.unshift('error-message');\n if (!this.data?.is_active) alwaysMatch.unshift('view-action', 'cancel-action');\n return new BooleanSelector(alwaysMatch.join(' ').trim());\n }\n\n get headerSubtitleKey(): string {\n const status = getSubscriptionStatus(this.data);\n return status ? `subtitle_${status}` : super.headerSubtitleKey;\n }\n\n renderBody(): TemplateResult {\n let transactionsHref: string | undefined;\n\n try {\n const url = new URL(this.data?._links['fx:transactions'].href ?? '');\n url.searchParams.set('zoom', 'items');\n transactionsHref = url.toString();\n } catch {\n transactionsHref = undefined;\n }\n\n // @ts-expect-error - SDK doesn't know yet about the `fx:charge_past_due` link.\n const chargePastDueHref: string | undefined = this.data?._links['fx:charge_past_due']?.href;\n const pastDueAmount = this.data?.past_due_amount;\n const currencyCode = this.data?._embedded['fx:transaction_template'].currency_code;\n\n return html`\n ${this.renderHeader()}\n\n <foxy-internal-admin-subscription-form-error infer=\"error-message\">\n </foxy-internal-admin-subscription-form-error>\n\n <foxy-internal-summary-control infer=\"general\">\n <foxy-internal-date-control layout=\"summary-item\" infer=\"start-date\">\n </foxy-internal-date-control>\n <foxy-internal-frequency-control\n layout=\"summary-item\"\n infer=\"frequency\"\n allow-twice-a-month\n >\n </foxy-internal-frequency-control>\n <foxy-internal-date-control layout=\"summary-item\" infer=\"next-transaction-date\">\n </foxy-internal-date-control>\n <foxy-internal-date-control layout=\"summary-item\" infer=\"end-date\">\n </foxy-internal-date-control>\n </foxy-internal-summary-control>\n\n <foxy-internal-summary-control infer=\"overdue\">\n <foxy-internal-number-control\n layout=\"summary-item\"\n suffix=${ifDefined(currencyCode)}\n infer=\"past-due-amount\"\n min=\"0\"\n >\n </foxy-internal-number-control>\n\n ${chargePastDueHref && currencyCode && pastDueAmount\n ? html`\n <foxy-internal-post-action-control\n message-options=${JSON.stringify({ amount: `${pastDueAmount} ${currencyCode}` })}\n theme=\"tertiary-inline\"\n infer=\"charge-past-due\"\n href=${chargePastDueHref}\n @success=${() => this.refresh()}\n >\n </foxy-internal-post-action-control>\n `\n : ''}\n </foxy-internal-summary-control>\n\n <foxy-internal-summary-control infer=\"self-service-links\">\n <foxy-internal-admin-subscription-form-link-control infer=\"load-in-cart\">\n </foxy-internal-admin-subscription-form-link-control>\n\n <foxy-internal-admin-subscription-form-link-control\n search=\"cart=checkout\"\n infer=\"load-on-checkout\"\n >\n </foxy-internal-admin-subscription-form-link-control>\n\n <foxy-internal-admin-subscription-form-link-control\n search=\"sub_cancel=next_transaction_date\"\n infer=\"cancel-at-end-of-billing-period\"\n >\n </foxy-internal-admin-subscription-form-link-control>\n\n <foxy-internal-admin-subscription-form-link-control\n search=\"sub_cancel=true\"\n infer=\"cancel-next-day\"\n >\n </foxy-internal-admin-subscription-form-link-control>\n\n <div\n class=\"flex items-start leading-xs text-xs text-secondary\"\n style=\"gap: calc(0.625em + (var(--lumo-border-radius) / 4) - 1px)\"\n >\n ${svg`<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 16 16\" fill=\"currentColor\" aria-hidden=\"true\" class=\"flex-shrink-0\" style=\"width: 1.25em\"><path fill-rule=\"evenodd\" d=\"M15 8A7 7 0 1 1 1 8a7 7 0 0 1 14 0ZM9 5a1 1 0 1 1-2 0 1 1 0 0 1 2 0ZM6.75 8a.75.75 0 0 0 0 1.5h.75v1.75a.75.75 0 0 0 1.5 0v-2.5A.75.75 0 0 0 8.25 8h-1.5Z\" clip-rule=\"evenodd\" /></svg>`}\n <p>\n <foxy-i18n infer=\"\" key=\"uoe_hint_text\"></foxy-i18n>\n ${this.uoeSettingsPage\n ? html`\n <a\n target=\"_blank\"\n class=\"inline-block rounded font-medium text-body cursor-pointer hover-underline focus-outline-none focus-ring-2 focus-ring-primary-50\"\n href=${this.uoeSettingsPage}\n >\n <foxy-i18n infer=\"\" key=\"uoe_link_text\"></foxy-i18n>\n </a>\n `\n : ''}\n </p>\n </div>\n </foxy-internal-summary-control>\n\n ${this.renderTemplateOrSlot()}\n\n <foxy-internal-async-list-control\n infer=\"attributes\"\n class=\"min-w-0\"\n first=${ifDefined(this.data?._links?.['fx:attributes'].href)}\n item=\"foxy-attribute-card\"\n form=\"foxy-attribute-form\"\n alert\n >\n </foxy-internal-async-list-control>\n\n <foxy-internal-async-list-control\n infer=\"transactions\"\n class=\"min-w-0\"\n first=${ifDefined(transactionsHref)}\n item=\"foxy-transaction-card\"\n form=\"foxy-transaction\"\n hide-create-button\n hide-delete-button\n alert\n wide\n >\n </foxy-internal-async-list-control>\n\n ${super.renderBody()}\n `;\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"AdminSubscriptionForm.js","sourceRoot":"","sources":["../../../../src/elements/public/AdminSubscriptionForm/AdminSubscriptionForm.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,qBAAqB,EAAE,kDAA+C;AAC/E,OAAO,EAAE,iBAAiB,EAAE,wCAAqC;AACjE,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACpD,OAAO,EAAE,YAAY,EAAE,oDAAiD;AACxE,OAAO,EAAE,SAAS,EAAE,MAAM,gCAAgC,CAAC;AAC3D,OAAO,EAAE,IAAI,EAAE,GAAG,EAAE,MAAM,UAAU,CAAC;AAErC,MAAM,EAAE,GAAG,yBAAyB,CAAC;AACrC,MAAM,IAAI,GAAG,iBAAiB,CAAC,YAAY,EAAE,EAAE,CAAC,CAAC;AAEjD,MAAM,OAAO,qBAAsB,SAAQ,IAAU;IAArD;;QAQE,yHAAyH;QACzH,oBAAe,GAAkB,IAAI,CAAC;IAyKxC,CAAC;IAjLC,MAAM,KAAK,UAAU;QACnB,OAAO;YACL,GAAG,KAAK,CAAC,UAAU;YACnB,eAAe,EAAE,EAAE,SAAS,EAAE,mBAAmB,EAAE;SACpD,CAAC;IACJ,CAAC;IAKD,IAAI,cAAc;QAChB,MAAM,WAAW,GAAG,CAAC,QAAQ,EAAE,KAAK,CAAC,cAAc,CAAC,QAAQ,EAAE,CAAC,CAAC;QAChE,MAAM,IAAI,GAAG,IAAI,CAAC,IAAI,CAAC;QAEvB,IAAI,EAAC,IAAI,aAAJ,IAAI,uBAAJ,IAAI,CAAE,aAAa,CAAA,IAAI,CAAC,IAAI,CAAC,eAAe;YAAE,WAAW,CAAC,OAAO,CAAC,eAAe,CAAC,CAAC;QACxF,IAAI,EAAC,IAAI,aAAJ,IAAI,uBAAJ,IAAI,CAAE,SAAS,CAAA;YAAE,WAAW,CAAC,OAAO,CAAC,aAAa,EAAE,eAAe,CAAC,CAAC;QAE1E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AAI,YAAY,EAAE,EAAE,CAAC;;;uBAGzE,iBAAiB;2BACb,GAAG,EAAE,CAAC,IAAI,CAAC,OAAO,EAAE;;;aAGlC;YACH,CAAC,CAAC,YAAY,IAAI,CAAC,aAAa;gBAChC,CAAC,CAAC,IAAI,CAAA;;;;;;;;;sBASM,GAAG,CAAA,qWAAqW;;;;;sDAKxU,YAAY;;;aAGrD;gBACH,CAAC,CAAC,EAAE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;YA6BF,GAAG,CAAA,qWAAqW;;;cAGtW,IAAI,CAAC,eAAe;YACpB,CAAC,CAAC,IAAI,CAAA;;;;2BAIO,IAAI,CAAC,eAAe;;;;iBAI9B;YACH,CAAC,CAAC,EAAE;;;;;QAKV,IAAI,CAAC,oBAAoB,EAAE;;;;;gBAKnB,SAAS,aAAC,IAAI,CAAC,IAAI,0CAAE,MAAM,0CAAG,eAAe,EAAE,IAAI,CAAC;;;;;;;;;;gBAUpD,SAAS,CAAC,gBAAgB,CAAC;;;;;;;;;;QAUnC,KAAK,CAAC,UAAU,EAAE;KACrB,CAAC;IACJ,CAAC;CACF","sourcesContent":["import type { PropertyDeclarations } from 'lit-element';\nimport type { TemplateResult } from 'lit-html';\nimport type { Data } from './types';\n\nimport { getSubscriptionStatus } from '../../../utils/get-subscription-status';\nimport { TranslatableMixin } from '../../../mixins/translatable';\nimport { BooleanSelector } from '@foxy.io/sdk/core';\nimport { InternalForm } from '../../internal/InternalForm/InternalForm';\nimport { ifDefined } from 'lit-html/directives/if-defined';\nimport { html, svg } from 'lit-html';\n\nconst NS = 'admin-subscription-form';\nconst Base = TranslatableMixin(InternalForm, NS);\n\nexport class AdminSubscriptionForm extends Base<Data> {\n static get properties(): PropertyDeclarations {\n return {\n ...super.properties,\n uoeSettingsPage: { attribute: 'uoe-settings-page' },\n };\n }\n\n /** URL of the UOE settings page in the admin. If set, displays a link to that page in the self-service links section. */\n uoeSettingsPage: string | null = null;\n\n get hiddenSelector(): BooleanSelector {\n const alwaysMatch = ['delete', super.hiddenSelector.toString()];\n const data = this.data;\n\n if (!data?.error_message || !data.past_due_amount) alwaysMatch.unshift('error-message');\n if (!data?.is_active) alwaysMatch.unshift('view-action', 'cancel-action');\n\n return new BooleanSelector(alwaysMatch.join(' ').trim());\n }\n\n get headerSubtitleKey(): string {\n const status = getSubscriptionStatus(this.data);\n return status ? `subtitle_${status}` : super.headerSubtitleKey;\n }\n\n renderBody(): TemplateResult {\n let transactionsHref: string | undefined;\n\n try {\n const url = new URL(this.data?._links['fx:transactions'].href ?? '');\n url.searchParams.set('zoom', 'items');\n transactionsHref = url.toString();\n } catch {\n transactionsHref = undefined;\n }\n\n // @ts-expect-error - SDK doesn't know yet about the `fx:charge_past_due` link.\n const chargePastDueHref: string | undefined = this.data?._links['fx:charge_past_due']?.href;\n const pastDueAmount = this.data?.past_due_amount;\n const errorMessage = this.data?.error_message;\n const currencyCode = this.data?._embedded['fx:transaction_template'].currency_code;\n\n return html`\n ${this.renderHeader()}\n\n <foxy-internal-admin-subscription-form-error infer=\"error-message\">\n </foxy-internal-admin-subscription-form-error>\n\n <foxy-internal-summary-control infer=\"general\">\n <foxy-internal-date-control layout=\"summary-item\" infer=\"start-date\">\n </foxy-internal-date-control>\n <foxy-internal-frequency-control\n layout=\"summary-item\"\n infer=\"frequency\"\n allow-twice-a-month\n >\n </foxy-internal-frequency-control>\n <foxy-internal-date-control layout=\"summary-item\" infer=\"next-transaction-date\">\n </foxy-internal-date-control>\n <foxy-internal-date-control layout=\"summary-item\" infer=\"end-date\">\n </foxy-internal-date-control>\n </foxy-internal-summary-control>\n\n <foxy-internal-summary-control infer=\"overdue\">\n <foxy-internal-number-control\n layout=\"summary-item\"\n suffix=${ifDefined(currencyCode)}\n infer=\"past-due-amount\"\n min=\"0\"\n >\n </foxy-internal-number-control>\n\n ${chargePastDueHref && currencyCode && pastDueAmount\n ? html`\n <foxy-internal-post-action-control\n message-options=${JSON.stringify({ amount: `${pastDueAmount} ${currencyCode}` })}\n theme=\"tertiary-inline\"\n infer=\"charge-past-due\"\n href=${chargePastDueHref}\n @success=${() => this.refresh()}\n >\n </foxy-internal-post-action-control>\n `\n : errorMessage && !pastDueAmount\n ? html`\n <details\n class=\"leading-xs text-xs text-secondary rounded-b focus-within-ring-2 focus-within-ring-inset focus-within-ring-primary-50\"\n style=\"--gap: calc(0.625em + (var(--lumo-border-radius) / 4) - 1px)\"\n >\n <summary\n class=\"cursor-pointer transition-colors hover-text-body focus-outline-none\"\n >\n <span class=\"flex items-start\" style=\"gap: var(--gap)\">\n ${svg`<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 16 16\" fill=\"currentColor\" aria-hidden=\"true\" class=\"flex-shrink-0\" style=\"width: 1.25em\"><path fill-rule=\"evenodd\" d=\"M15 8A7 7 0 1 1 1 8a7 7 0 0 1 14 0ZM9 5a1 1 0 1 1-2 0 1 1 0 0 1 2 0ZM6.75 8a.75.75 0 0 0 0 1.5h.75v1.75a.75.75 0 0 0 1.5 0v-2.5A.75.75 0 0 0 8.25 8h-1.5Z\" clip-rule=\"evenodd\" /></svg>`}\n <foxy-i18n infer=\"\" key=\"error_with_zero_past_due_hint\"></foxy-i18n>\n </span>\n </summary>\n <p style=\"padding-left: calc(1.25em + var(--gap))\" class=\"pt-xs\">\n <span class=\"whitespace-pre-line\">${errorMessage}</span>\n </p>\n </details>\n `\n : ''}\n </foxy-internal-summary-control>\n\n <foxy-internal-summary-control infer=\"self-service-links\">\n <foxy-internal-admin-subscription-form-link-control infer=\"load-in-cart\">\n </foxy-internal-admin-subscription-form-link-control>\n\n <foxy-internal-admin-subscription-form-link-control\n search=\"cart=checkout\"\n infer=\"load-on-checkout\"\n >\n </foxy-internal-admin-subscription-form-link-control>\n\n <foxy-internal-admin-subscription-form-link-control\n search=\"sub_cancel=next_transaction_date\"\n infer=\"cancel-at-end-of-billing-period\"\n >\n </foxy-internal-admin-subscription-form-link-control>\n\n <foxy-internal-admin-subscription-form-link-control\n search=\"sub_cancel=true\"\n infer=\"cancel-next-day\"\n >\n </foxy-internal-admin-subscription-form-link-control>\n\n <div\n class=\"flex items-start leading-xs text-xs text-secondary\"\n style=\"gap: calc(0.625em + (var(--lumo-border-radius) / 4) - 1px)\"\n >\n ${svg`<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 16 16\" fill=\"currentColor\" aria-hidden=\"true\" class=\"flex-shrink-0\" style=\"width: 1.25em\"><path fill-rule=\"evenodd\" d=\"M15 8A7 7 0 1 1 1 8a7 7 0 0 1 14 0ZM9 5a1 1 0 1 1-2 0 1 1 0 0 1 2 0ZM6.75 8a.75.75 0 0 0 0 1.5h.75v1.75a.75.75 0 0 0 1.5 0v-2.5A.75.75 0 0 0 8.25 8h-1.5Z\" clip-rule=\"evenodd\" /></svg>`}\n <p>\n <foxy-i18n infer=\"\" key=\"uoe_hint_text\"></foxy-i18n>\n ${this.uoeSettingsPage\n ? html`\n <a\n target=\"_blank\"\n class=\"inline-block rounded font-medium text-body cursor-pointer hover-underline focus-outline-none focus-ring-2 focus-ring-primary-50\"\n href=${this.uoeSettingsPage}\n >\n <foxy-i18n infer=\"\" key=\"uoe_link_text\"></foxy-i18n>\n </a>\n `\n : ''}\n </p>\n </div>\n </foxy-internal-summary-control>\n\n ${this.renderTemplateOrSlot()}\n\n <foxy-internal-async-list-control\n infer=\"attributes\"\n class=\"min-w-0\"\n first=${ifDefined(this.data?._links?.['fx:attributes'].href)}\n item=\"foxy-attribute-card\"\n form=\"foxy-attribute-form\"\n alert\n >\n </foxy-internal-async-list-control>\n\n <foxy-internal-async-list-control\n infer=\"transactions\"\n class=\"min-w-0\"\n first=${ifDefined(transactionsHref)}\n item=\"foxy-transaction-card\"\n form=\"foxy-transaction\"\n hide-create-button\n hide-delete-button\n alert\n wide\n >\n </foxy-internal-async-list-control>\n\n ${super.renderBody()}\n `;\n }\n}\n"]}
|
|
@@ -170,7 +170,10 @@ export class CouponForm extends Base {
|
|
|
170
170
|
}
|
|
171
171
|
get hiddenSelector() {
|
|
172
172
|
const alwaysMatch = [super.hiddenSelector.toString()];
|
|
173
|
-
if (
|
|
173
|
+
if (this.data) {
|
|
174
|
+
alwaysMatch.push('coupon-codes-stub', 'category-restrictions-stub', 'attributes-stub');
|
|
175
|
+
}
|
|
176
|
+
else {
|
|
174
177
|
alwaysMatch.push('coupon-codes', 'category-restrictions', 'attributes');
|
|
175
178
|
}
|
|
176
179
|
return new BooleanSelector(alwaysMatch.join(' ').trim());
|
|
@@ -220,6 +223,10 @@ export class CouponForm extends Base {
|
|
|
220
223
|
<foxy-internal-coupon-form-rules-control infer="rules">
|
|
221
224
|
</foxy-internal-coupon-form-rules-control>
|
|
222
225
|
|
|
226
|
+
<foxy-internal-summary-control infer="coupon-codes-stub">
|
|
227
|
+
<p class="text-disabled"><foxy-i18n infer="" key="text"></foxy-i18n></p>
|
|
228
|
+
</foxy-internal-summary-control>
|
|
229
|
+
|
|
223
230
|
<foxy-internal-async-list-control
|
|
224
231
|
first=${codesUrl}
|
|
225
232
|
limit="5"
|
|
@@ -268,6 +275,10 @@ export class CouponForm extends Base {
|
|
|
268
275
|
<foxy-internal-switch-control infer="customer-auto-apply"></foxy-internal-switch-control>
|
|
269
276
|
</foxy-internal-summary-control>
|
|
270
277
|
|
|
278
|
+
<foxy-internal-summary-control infer="category-restrictions-stub">
|
|
279
|
+
<p class="text-disabled"><foxy-i18n infer="" key="text"></foxy-i18n></p>
|
|
280
|
+
</foxy-internal-summary-control>
|
|
281
|
+
|
|
271
282
|
<foxy-internal-async-resource-link-list-control
|
|
272
283
|
foreign-key-for-uri="item_category_uri"
|
|
273
284
|
foreign-key-for-id="item_category_id"
|
|
@@ -336,6 +347,10 @@ export class CouponForm extends Base {
|
|
|
336
347
|
<foxy-internal-switch-control infer="shared-codes-allowed"></foxy-internal-switch-control>
|
|
337
348
|
</foxy-internal-summary-control>
|
|
338
349
|
|
|
350
|
+
<foxy-internal-summary-control infer="attributes-stub">
|
|
351
|
+
<p class="text-disabled"><foxy-i18n infer="" key="text"></foxy-i18n></p>
|
|
352
|
+
</foxy-internal-summary-control>
|
|
353
|
+
|
|
339
354
|
<foxy-internal-async-list-control
|
|
340
355
|
first=${ifDefined((_g = this.data) === null || _g === void 0 ? void 0 : _g._links['fx:attributes'].href)}
|
|
341
356
|
limit="5"
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CouponForm.js","sourceRoot":"","sources":["../../../../src/elements/public/CouponForm/CouponForm.ts"],"names":[],"mappings":"AAUA,OAAO,EAAE,iBAAiB,EAAE,wCAAqC;AACjE,OAAO,EAAE,eAAe,EAAE,sCAAmC;AAC7D,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACpD,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,iCAA8B;AACvD,OAAO,EAAE,YAAY,EAAE,oDAAiD;AACxE,OAAO,EAAE,SAAS,EAAE,MAAM,gCAAgC,CAAC;AAC3D,OAAO,EAAE,IAAI,EAAE,MAAM,UAAU,CAAC;AAChC,OAAO,EAAE,KAAK,EAAE,uCAAoC;AACpD,OAAO,EAAE,SAAS,EAAE,2CAAwC;AAE5D,MAAM,EAAE,GAAG,aAAa,CAAC;AACzB,MAAM,IAAI,GAAG,eAAe,CAAC,iBAAiB,CAAC,YAAY,EAAE,EAAE,CAAC,CAAC,CAAC;AAElE;;;;;GAKG;AACH,MAAM,OAAO,UAAW,SAAQ,IAAU;IAA1C;;QAuCE,2BAAsB,GAAqC,IAAI,CAAC;QAE/C,6CAAwC,GAAe;YACtE,QAAQ,CAAC,GAAG;YACZ,QAAQ,CAAC,EAAE;SACZ,CAAC;QAEe,4CAAuC,GAAG,GAAG,EAAE;;YAC9D,MAAM,eAAe,GAAG,KAAK,OAAC,IAAI,CAAC,IAAI,CAAC,+BAA+B,mCAAI,EAAE,CAAC;iBAC3E,MAAM,CAAC,KAAK,CAAC,EAAE,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,IAAI,OAAO,KAA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SAC1E;;;;;;;;;;;qBAWY,IAAI,CAAC,wCAAwC;oBAC9C,IAAI,CAAC,uCAAuC;oBAC5C,IAAI,CAAC,uCAAuC;;;;;;oBAM5C,IAAI,CAAC,0CAA0C;oBAC/C,IAAI,CAAC,0CAA0C;;;;;;;;;;;;kBAYjD,SAAS,OAAC,IAAI,CAAC,IAAI,0CAAE,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC;;uBAEjC,SAAS,aAAC,IAAI,CAAC,aAAa,0CAAE,IAAI,0CAAE,MAAM,CAAC,oBAAoB,EAAE,IAAI,CAAC;qBACxE,SAAS,OAAC,IAAI,CAAC,IAAI,0CAAE,MAAM,CAAC,2BAA2B,EAAE,IAAI,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;gBA8DnE,SAAS,OAAC,IAAI,CAAC,IAAI,0CAAE,MAAM,CAAC,eAAe,EAAE,IAAI,CAAC;;;;;;;;;QAS1D,KAAK,CAAC,UAAU,EAAE;;;;;eAKX,SAAS,OAAC,IAAI,CAAC,IAAI,0CAAE,MAAM,CAAC,UAAU,EAAE,IAAI,CAAC;aAC/C,IAAI,CAAC,eAAe;kBACf,GAAG,EAAE,CAAC,IAAI,CAAC,aAAa,EAAE;;;KAGvC,CAAC;IACJ,CAAC;IAED,IAAY,aAAa;QAEvB,OAAO,IAAI,CAAC,UAAU,CAAC,aAAa,CAAS,IAAI,IAAI,CAAC,eAAe,EAAE,CAAC,CAAC;IAC3E,CAAC;CACF","sourcesContent":["import type { TemplateResult, PropertyDeclarations } from 'lit-element';\nimport type { Data, TransactionPageHrefGetter } from './types';\nimport type { Option, ParsedValue } from '../QueryBuilder/types';\nimport type { NucleonElement } from '../NucleonElement/NucleonElement';\nimport type { SwipeAction } from '../../internal/InternalAsyncListControl/types';\nimport type { NucleonV8N } from '../NucleonElement/types';\nimport type { Resource } from '@foxy.io/sdk/core';\nimport type { Item } from '../../internal/InternalEditableListControl/types';\nimport type { Rels } from '@foxy.io/sdk/backend';\n\nimport { TranslatableMixin } from '../../../mixins/translatable';\nimport { ResponsiveMixin } from '../../../mixins/responsive';\nimport { BooleanSelector } from '@foxy.io/sdk/core';\nimport { Type, Operator } from '../QueryBuilder/types';\nimport { InternalForm } from '../../internal/InternalForm/InternalForm';\nimport { ifDefined } from 'lit-html/directives/if-defined';\nimport { html } from 'lit-html';\nimport { parse } from '../QueryBuilder/utils/parse';\nimport { stringify } from '../QueryBuilder/utils/stringify';\n\nconst NS = 'coupon-form';\nconst Base = ResponsiveMixin(TranslatableMixin(InternalForm, NS));\n\n/**\n * Form element for creating or editing coupons (`fx:coupon`).\n *\n * @element foxy-coupon-form\n * @since 1.15.0\n */\nexport class CouponForm extends Base<Data> {\n static get properties(): PropertyDeclarations {\n return {\n ...super.properties,\n getTransactionPageHref: { attribute: false },\n __couponCodesActions: { type: Array },\n };\n }\n\n static get v8n(): NucleonV8N<Data> {\n return [\n ({ name: v }) => !!v || 'name:v8n_required',\n ({ name: v }) => !v || v.length <= 50 || 'name:v8n_too_long',\n ({ inclusive_tax_rate: v }) => !v || v >= 0 || 'inclusive-tax-rate:v8n_too_small',\n ({ inclusive_tax_rate: v }) => !v || v <= 1 || 'inclusive-tax-rate:v8n_too_big',\n ({ number_of_uses_allowed: v }) => !v || v >= 0 || 'number-of-uses-allowed:v8n_too_small',\n ({ coupon_discount_details: v }) => !!v || 'rules:v8n_required',\n ({ coupon_discount_details: v }) => !v || v.length <= 200 || 'rules:v8n_too_long',\n ({ item_option_restrictions: v }) => {\n return !v || JSON.stringify(v).length <= 6000 || 'item-option-restrictions:v8n_too_long';\n },\n ({ product_code_restrictions: v }) => {\n return !v || v.length <= 5000 || 'product-code-restrictions:v8n_too_long';\n },\n ({ customer_attribute_restrictions: v }) => {\n return !v || v.length <= 2000 || 'customer-attribute-restrictions:v8n_too_long';\n },\n ({ number_of_uses_allowed_per_code: v }) => {\n return !v || v >= 0 || 'number-of-uses-allowed-per-code:v8n_too_small';\n },\n ({ customer_subscription_restrictions: v }) => {\n return !v || v.length <= 200 || 'customer-subscription-restrictions:v8n_too_long';\n },\n ({ number_of_uses_allowed_per_customer: v }) => {\n return !v || v >= 0 || 'number-of-uses-allowed-per-customer:v8n_too_small';\n },\n ];\n }\n\n getTransactionPageHref: TransactionPageHrefGetter | null = null;\n\n private readonly __customerAttributeRestrictionsOperators: Operator[] = [\n Operator.Not,\n Operator.In,\n ];\n\n private readonly __customerAttributeRestrictionsGetValue = () => {\n const simplifiedValue = parse(this.form.customer_attribute_restrictions ?? '')\n .filter(value => Array.isArray(value) || typeof value.name === 'string')\n .map(value => {\n if (Array.isArray(value)) {\n return value\n .filter(({ name }) => typeof name === 'string')\n .map(({ name, operator, value }) => {\n const output: ParsedValue = { path: name as string, operator, value };\n return output;\n });\n }\n\n const output: ParsedValue = {\n operator: value.operator,\n value: value.value,\n path: value.name as string,\n };\n\n return output;\n });\n\n return stringify(simplifiedValue, true);\n };\n\n private readonly __customerAttributeRestrictionsSetValue = (newValue: string) => {\n const augmentedValue = parse(newValue).map(value => {\n if (Array.isArray(value)) {\n return value.map(({ path, operator, value }) => {\n const output: ParsedValue = { name: path, path: 'attributes', operator, value };\n return output;\n });\n } else {\n const output: ParsedValue = {\n operator: value.operator,\n value: value.value,\n path: 'attributes',\n name: value.path,\n };\n\n return output;\n }\n });\n\n this.edit({ customer_attribute_restrictions: stringify(augmentedValue, true) });\n };\n\n private readonly __customerSubscriptionRestrictionsGetValue = () => {\n const items = this.form.customer_subscription_restrictions\n ?.split(',')\n .map(value => value.trim())\n .filter((value, index, values) => !!value && values.indexOf(value) === index)\n .map(value => ({ value }));\n\n return items ?? [];\n };\n\n private readonly __customerSubscriptionRestrictionsSetValue = (newValue: Item[]) => {\n this.edit({\n customer_subscription_restrictions: newValue\n .map(({ value }) => value.trim())\n .filter((value, index, values) => !!value && values.indexOf(value) === index)\n .join(),\n });\n\n this.edit({\n customer_auto_apply:\n !!this.form.customer_subscription_restrictions ||\n !!this.form.customer_attribute_restrictions,\n });\n };\n\n private readonly __productCodeRestrictionsGetValue = () => {\n return this.form.product_code_restrictions\n ?.split(',')\n .filter(v => !!v.trim())\n .map(value => ({\n value,\n label: value.startsWith('-')\n ? this.t(`product-code-restrictions.label_block`, { value: value.substring(1) })\n : this.t(`product-code-restrictions.label_allow`, { value }),\n }));\n };\n\n private readonly __productCodeRestrictionsSetValue = (newValue: Item[]) => {\n this.edit({\n product_code_restrictions: newValue\n .map(({ value, unit }) => (unit === 'block' ? `-${value}` : value))\n .filter((v, i, a) => !!v && a.indexOf(v) === i)\n .join(','),\n });\n };\n\n private readonly __storeLoaderId = 'storeLoader';\n\n private readonly __codesFilters: Option[] = [\n { label: 'code', path: 'code', type: Type.String },\n { label: 'used_codes', path: 'number_of_uses_to_date', type: Type.Number },\n { label: 'date_created', path: 'date_created', type: Type.Date },\n { label: 'date_modified', path: 'date_modified', type: Type.Date },\n ];\n\n private __couponCodesActions: SwipeAction<Resource<Rels.CouponCode>>[] = [\n {\n theme: 'contrast',\n state: 'idle',\n text: 'copy_button_text',\n onClick: async data => {\n this.__couponCodesActions[0].state = 'busy';\n this.__couponCodesActions = [...this.__couponCodesActions];\n\n try {\n await navigator.clipboard.writeText(data.code);\n this.__couponCodesActions[0].state = 'end';\n } catch {\n this.__couponCodesActions[0].state = 'error';\n } finally {\n this.__couponCodesActions = [...this.__couponCodesActions];\n setTimeout(() => {\n this.__couponCodesActions[0].state = 'idle';\n this.__couponCodesActions = [...this.__couponCodesActions];\n }, 1000);\n }\n },\n },\n ];\n\n get hiddenSelector(): BooleanSelector {\n const alwaysMatch = [super.hiddenSelector.toString()];\n\n if (!this.data) {\n alwaysMatch.push('coupon-codes', 'category-restrictions', 'attributes');\n }\n\n return new BooleanSelector(alwaysMatch.join(' ').trim());\n }\n\n get headerSubtitleOptions(): Record<string, unknown> {\n return { ...super.headerSubtitleOptions, id: this.headerCopyIdValue };\n }\n\n renderHeaderActions(data: Data): TemplateResult {\n return html`\n <foxy-internal-bulk-add-action-control\n parent=${data._links['fx:generate_codes'].href}\n infer=\"generate\"\n form=\"foxy-generate-codes-form\"\n .related=${[data._links['fx:coupon_codes'].href]}\n >\n </foxy-internal-bulk-add-action-control>\n\n <foxy-internal-bulk-add-action-control\n parent=${data._links['fx:coupon_codes'].href}\n infer=\"import\"\n form=\"foxy-coupon-codes-form\"\n .related=${[data._links['fx:coupon_codes'].href]}\n >\n </foxy-internal-bulk-add-action-control>\n\n ${super.renderHeaderActions(data)}\n `;\n }\n\n renderBody(): TemplateResult {\n let codesUrl: string | undefined;\n\n try {\n const url = new URL(this.data?._links['fx:coupon_codes'].href ?? '');\n url.searchParams.set('order', 'date_created desc');\n\n codesUrl = url.toString();\n } catch {\n codesUrl = undefined;\n }\n\n return html`\n ${this.renderHeader()}\n\n <foxy-internal-summary-control infer=\"general\">\n <foxy-internal-text-control layout=\"summary-item\" infer=\"name\"></foxy-internal-text-control>\n </foxy-internal-summary-control>\n\n <foxy-internal-coupon-form-rules-control infer=\"rules\">\n </foxy-internal-coupon-form-rules-control>\n\n <foxy-internal-async-list-control\n first=${codesUrl}\n limit=\"5\"\n infer=\"coupon-codes\"\n item=\"foxy-coupon-code-card\"\n form=\"foxy-coupon-code-form\"\n alert\n .formProps=${{ '.getTransactionPageHref': this.getTransactionPageHref }}\n .actions=${this.__couponCodesActions}\n .filters=${this.__codesFilters}\n >\n </foxy-internal-async-list-control>\n\n <foxy-internal-editable-list-control\n infer=\"product-code-restrictions\"\n .getValue=${this.__productCodeRestrictionsGetValue}\n .setValue=${this.__productCodeRestrictionsSetValue}\n .units=${[\n { label: this.t('product-code-restrictions.unit_allow'), value: 'allow' },\n { label: this.t('product-code-restrictions.unit_block'), value: 'block' },\n ]}\n >\n </foxy-internal-editable-list-control>\n\n <foxy-internal-array-map-control infer=\"item-option-restrictions\">\n </foxy-internal-array-map-control>\n\n <foxy-internal-query-builder-control\n infer=\"customer-attribute-restrictions\"\n disable-zoom\n disable-or\n .operators=${this.__customerAttributeRestrictionsOperators}\n .getValue=${this.__customerAttributeRestrictionsGetValue}\n .setValue=${this.__customerAttributeRestrictionsSetValue}\n >\n </foxy-internal-query-builder-control>\n\n <foxy-internal-editable-list-control\n infer=\"customer-subscription-restrictions\"\n .getValue=${this.__customerSubscriptionRestrictionsGetValue}\n .setValue=${this.__customerSubscriptionRestrictionsSetValue}\n >\n </foxy-internal-editable-list-control>\n\n <foxy-internal-summary-control infer=\"auto-apply\">\n <foxy-internal-switch-control infer=\"customer-auto-apply\"></foxy-internal-switch-control>\n </foxy-internal-summary-control>\n\n <foxy-internal-async-resource-link-list-control\n foreign-key-for-uri=\"item_category_uri\"\n foreign-key-for-id=\"item_category_id\"\n own-key-for-uri=\"coupon_uri\"\n own-uri=${ifDefined(this.data?._links.self.href)}\n embed-key=\"fx:coupon_item_categories\"\n options-href=${ifDefined(this.__storeLoader?.data?._links['fx:item_categories'].href)}\n links-href=${ifDefined(this.data?._links['fx:coupon_item_categories'].href)}\n infer=\"category-restrictions\"\n limit=\"5\"\n item=\"foxy-item-category-card\"\n >\n </foxy-internal-async-resource-link-list-control>\n\n <foxy-internal-summary-control infer=\"uses\">\n <foxy-internal-number-control\n layout=\"summary-item\"\n infer=\"number-of-uses-allowed\"\n step=\"1\"\n min=\"0\"\n >\n </foxy-internal-number-control>\n\n <foxy-internal-number-control\n layout=\"summary-item\"\n infer=\"number-of-uses-allowed-per-customer\"\n step=\"1\"\n min=\"0\"\n >\n </foxy-internal-number-control>\n\n <foxy-internal-number-control\n layout=\"summary-item\"\n infer=\"number-of-uses-allowed-per-code\"\n step=\"1\"\n min=\"0\"\n >\n </foxy-internal-number-control>\n </foxy-internal-summary-control>\n\n <foxy-internal-summary-control infer=\"timeframe\">\n <foxy-internal-date-control layout=\"summary-item\" infer=\"start-date\">\n </foxy-internal-date-control>\n <foxy-internal-date-control layout=\"summary-item\" infer=\"end-date\">\n </foxy-internal-date-control>\n </foxy-internal-summary-control>\n\n <foxy-internal-summary-control infer=\"taxes\">\n <foxy-internal-number-control\n layout=\"summary-item\"\n infer=\"inclusive-tax-rate\"\n min=\"0\"\n max=\"1\"\n >\n </foxy-internal-number-control>\n </foxy-internal-summary-control>\n\n <foxy-internal-summary-control infer=\"options\">\n <foxy-internal-switch-control infer=\"multiple-codes-allowed\"></foxy-internal-switch-control>\n <foxy-internal-switch-control infer=\"combinable\"></foxy-internal-switch-control>\n <foxy-internal-switch-control infer=\"exclude-category-discounts\">\n </foxy-internal-switch-control>\n <foxy-internal-switch-control infer=\"exclude-line-item-discounts\">\n </foxy-internal-switch-control>\n <foxy-internal-switch-control infer=\"is-taxable\"></foxy-internal-switch-control>\n <foxy-internal-switch-control infer=\"shared-codes-allowed\"></foxy-internal-switch-control>\n </foxy-internal-summary-control>\n\n <foxy-internal-async-list-control\n first=${ifDefined(this.data?._links['fx:attributes'].href)}\n limit=\"5\"\n infer=\"attributes\"\n item=\"foxy-attribute-card\"\n form=\"foxy-attribute-form\"\n alert\n >\n </foxy-internal-async-list-control>\n\n ${super.renderBody()}\n\n <foxy-nucleon\n infer=\"\"\n class=\"hidden\"\n href=${ifDefined(this.data?._links['fx:store'].href)}\n id=${this.__storeLoaderId}\n @update=${() => this.requestUpdate()}\n >\n </foxy-nucleon>\n `;\n }\n\n private get __storeLoader() {\n type Loader = NucleonElement<Resource<Rels.Store>>;\n return this.renderRoot.querySelector<Loader>(`#${this.__storeLoaderId}`);\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"CouponForm.js","sourceRoot":"","sources":["../../../../src/elements/public/CouponForm/CouponForm.ts"],"names":[],"mappings":"AAUA,OAAO,EAAE,iBAAiB,EAAE,wCAAqC;AACjE,OAAO,EAAE,eAAe,EAAE,sCAAmC;AAC7D,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACpD,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,iCAA8B;AACvD,OAAO,EAAE,YAAY,EAAE,oDAAiD;AACxE,OAAO,EAAE,S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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;gBAkEnE,SAAS,OAAC,IAAI,CAAC,IAAI,0CAAE,MAAM,CAAC,eAAe,EAAE,IAAI,CAAC;;;;;;;;;QAS1D,KAAK,CAAC,UAAU,EAAE;;;;;eAKX,SAAS,OAAC,IAAI,CAAC,IAAI,0CAAE,MAAM,CAAC,UAAU,EAAE,IAAI,CAAC;aAC/C,IAAI,CAAC,eAAe;kBACf,GAAG,EAAE,CAAC,IAAI,CAAC,aAAa,EAAE;;;KAGvC,CAAC;IACJ,CAAC;IAED,IAAY,aAAa;QAEvB,OAAO,IAAI,CAAC,UAAU,CAAC,aAAa,CAAS,IAAI,IAAI,CAAC,eAAe,EAAE,CAAC,CAAC;IAC3E,CAAC;CACF","sourcesContent":["import type { TemplateResult, PropertyDeclarations } from 'lit-element';\nimport type { Data, TransactionPageHrefGetter } from './types';\nimport type { Option, ParsedValue } from '../QueryBuilder/types';\nimport type { NucleonElement } from '../NucleonElement/NucleonElement';\nimport type { SwipeAction } from '../../internal/InternalAsyncListControl/types';\nimport type { NucleonV8N } from '../NucleonElement/types';\nimport type { Resource } from '@foxy.io/sdk/core';\nimport type { Item } from '../../internal/InternalEditableListControl/types';\nimport type { Rels } from '@foxy.io/sdk/backend';\n\nimport { TranslatableMixin } from '../../../mixins/translatable';\nimport { ResponsiveMixin } from '../../../mixins/responsive';\nimport { BooleanSelector } from '@foxy.io/sdk/core';\nimport { Type, Operator } from '../QueryBuilder/types';\nimport { InternalForm } from '../../internal/InternalForm/InternalForm';\nimport { ifDefined } from 'lit-html/directives/if-defined';\nimport { html } from 'lit-html';\nimport { parse } from '../QueryBuilder/utils/parse';\nimport { stringify } from '../QueryBuilder/utils/stringify';\n\nconst NS = 'coupon-form';\nconst Base = ResponsiveMixin(TranslatableMixin(InternalForm, NS));\n\n/**\n * Form element for creating or editing coupons (`fx:coupon`).\n *\n * @element foxy-coupon-form\n * @since 1.15.0\n */\nexport class CouponForm extends Base<Data> {\n static get properties(): PropertyDeclarations {\n return {\n ...super.properties,\n getTransactionPageHref: { attribute: false },\n __couponCodesActions: { type: Array },\n };\n }\n\n static get v8n(): NucleonV8N<Data> {\n return [\n ({ name: v }) => !!v || 'name:v8n_required',\n ({ name: v }) => !v || v.length <= 50 || 'name:v8n_too_long',\n ({ inclusive_tax_rate: v }) => !v || v >= 0 || 'inclusive-tax-rate:v8n_too_small',\n ({ inclusive_tax_rate: v }) => !v || v <= 1 || 'inclusive-tax-rate:v8n_too_big',\n ({ number_of_uses_allowed: v }) => !v || v >= 0 || 'number-of-uses-allowed:v8n_too_small',\n ({ coupon_discount_details: v }) => !!v || 'rules:v8n_required',\n ({ coupon_discount_details: v }) => !v || v.length <= 200 || 'rules:v8n_too_long',\n ({ item_option_restrictions: v }) => {\n return !v || JSON.stringify(v).length <= 6000 || 'item-option-restrictions:v8n_too_long';\n },\n ({ product_code_restrictions: v }) => {\n return !v || v.length <= 5000 || 'product-code-restrictions:v8n_too_long';\n },\n ({ customer_attribute_restrictions: v }) => {\n return !v || v.length <= 2000 || 'customer-attribute-restrictions:v8n_too_long';\n },\n ({ number_of_uses_allowed_per_code: v }) => {\n return !v || v >= 0 || 'number-of-uses-allowed-per-code:v8n_too_small';\n },\n ({ customer_subscription_restrictions: v }) => {\n return !v || v.length <= 200 || 'customer-subscription-restrictions:v8n_too_long';\n },\n ({ number_of_uses_allowed_per_customer: v }) => {\n return !v || v >= 0 || 'number-of-uses-allowed-per-customer:v8n_too_small';\n },\n ];\n }\n\n getTransactionPageHref: TransactionPageHrefGetter | null = null;\n\n private readonly __customerAttributeRestrictionsOperators: Operator[] = [\n Operator.Not,\n Operator.In,\n ];\n\n private readonly __customerAttributeRestrictionsGetValue = () => {\n const simplifiedValue = parse(this.form.customer_attribute_restrictions ?? '')\n .filter(value => Array.isArray(value) || typeof value.name === 'string')\n .map(value => {\n if (Array.isArray(value)) {\n return value\n .filter(({ name }) => typeof name === 'string')\n .map(({ name, operator, value }) => {\n const output: ParsedValue = { path: name as string, operator, value };\n return output;\n });\n }\n\n const output: ParsedValue = {\n operator: value.operator,\n value: value.value,\n path: value.name as string,\n };\n\n return output;\n });\n\n return stringify(simplifiedValue, true);\n };\n\n private readonly __customerAttributeRestrictionsSetValue = (newValue: string) => {\n const augmentedValue = parse(newValue).map(value => {\n if (Array.isArray(value)) {\n return value.map(({ path, operator, value }) => {\n const output: ParsedValue = { name: path, path: 'attributes', operator, value };\n return output;\n });\n } else {\n const output: ParsedValue = {\n operator: value.operator,\n value: value.value,\n path: 'attributes',\n name: value.path,\n };\n\n return output;\n }\n });\n\n this.edit({ customer_attribute_restrictions: stringify(augmentedValue, true) });\n };\n\n private readonly __customerSubscriptionRestrictionsGetValue = () => {\n const items = this.form.customer_subscription_restrictions\n ?.split(',')\n .map(value => value.trim())\n .filter((value, index, values) => !!value && values.indexOf(value) === index)\n .map(value => ({ value }));\n\n return items ?? [];\n };\n\n private readonly __customerSubscriptionRestrictionsSetValue = (newValue: Item[]) => {\n this.edit({\n customer_subscription_restrictions: newValue\n .map(({ value }) => value.trim())\n .filter((value, index, values) => !!value && values.indexOf(value) === index)\n .join(),\n });\n\n this.edit({\n customer_auto_apply:\n !!this.form.customer_subscription_restrictions ||\n !!this.form.customer_attribute_restrictions,\n });\n };\n\n private readonly __productCodeRestrictionsGetValue = () => {\n return this.form.product_code_restrictions\n ?.split(',')\n .filter(v => !!v.trim())\n .map(value => ({\n value,\n label: value.startsWith('-')\n ? this.t(`product-code-restrictions.label_block`, { value: value.substring(1) })\n : this.t(`product-code-restrictions.label_allow`, { value }),\n }));\n };\n\n private readonly __productCodeRestrictionsSetValue = (newValue: Item[]) => {\n this.edit({\n product_code_restrictions: newValue\n .map(({ value, unit }) => (unit === 'block' ? `-${value}` : value))\n .filter((v, i, a) => !!v && a.indexOf(v) === i)\n .join(','),\n });\n };\n\n private readonly __storeLoaderId = 'storeLoader';\n\n private readonly __codesFilters: Option[] = [\n { label: 'code', path: 'code', type: Type.String },\n { label: 'used_codes', path: 'number_of_uses_to_date', type: Type.Number },\n { label: 'date_created', path: 'date_created', type: Type.Date },\n { label: 'date_modified', path: 'date_modified', type: Type.Date },\n ];\n\n private __couponCodesActions: SwipeAction<Resource<Rels.CouponCode>>[] = [\n {\n theme: 'contrast',\n state: 'idle',\n text: 'copy_button_text',\n onClick: async data => {\n this.__couponCodesActions[0].state = 'busy';\n this.__couponCodesActions = [...this.__couponCodesActions];\n\n try {\n await navigator.clipboard.writeText(data.code);\n this.__couponCodesActions[0].state = 'end';\n } catch {\n this.__couponCodesActions[0].state = 'error';\n } finally {\n this.__couponCodesActions = [...this.__couponCodesActions];\n setTimeout(() => {\n this.__couponCodesActions[0].state = 'idle';\n this.__couponCodesActions = [...this.__couponCodesActions];\n }, 1000);\n }\n },\n },\n ];\n\n get hiddenSelector(): BooleanSelector {\n const alwaysMatch = [super.hiddenSelector.toString()];\n\n if (this.data) {\n alwaysMatch.push('coupon-codes-stub', 'category-restrictions-stub', 'attributes-stub');\n } else {\n alwaysMatch.push('coupon-codes', 'category-restrictions', 'attributes');\n }\n\n return new BooleanSelector(alwaysMatch.join(' ').trim());\n }\n\n get headerSubtitleOptions(): Record<string, unknown> {\n return { ...super.headerSubtitleOptions, id: this.headerCopyIdValue };\n }\n\n renderHeaderActions(data: Data): TemplateResult {\n return html`\n <foxy-internal-bulk-add-action-control\n parent=${data._links['fx:generate_codes'].href}\n infer=\"generate\"\n form=\"foxy-generate-codes-form\"\n .related=${[data._links['fx:coupon_codes'].href]}\n >\n </foxy-internal-bulk-add-action-control>\n\n <foxy-internal-bulk-add-action-control\n parent=${data._links['fx:coupon_codes'].href}\n infer=\"import\"\n form=\"foxy-coupon-codes-form\"\n .related=${[data._links['fx:coupon_codes'].href]}\n >\n </foxy-internal-bulk-add-action-control>\n\n ${super.renderHeaderActions(data)}\n `;\n }\n\n renderBody(): TemplateResult {\n let codesUrl: string | undefined;\n\n try {\n const url = new URL(this.data?._links['fx:coupon_codes'].href ?? '');\n url.searchParams.set('order', 'date_created desc');\n\n codesUrl = url.toString();\n } catch {\n codesUrl = undefined;\n }\n\n return html`\n ${this.renderHeader()}\n\n <foxy-internal-summary-control infer=\"general\">\n <foxy-internal-text-control layout=\"summary-item\" infer=\"name\"></foxy-internal-text-control>\n </foxy-internal-summary-control>\n\n <foxy-internal-coupon-form-rules-control infer=\"rules\">\n </foxy-internal-coupon-form-rules-control>\n\n <foxy-internal-summary-control infer=\"coupon-codes-stub\">\n <p class=\"text-disabled\"><foxy-i18n infer=\"\" key=\"text\"></foxy-i18n></p>\n </foxy-internal-summary-control>\n\n <foxy-internal-async-list-control\n first=${codesUrl}\n limit=\"5\"\n infer=\"coupon-codes\"\n item=\"foxy-coupon-code-card\"\n form=\"foxy-coupon-code-form\"\n alert\n .formProps=${{ '.getTransactionPageHref': this.getTransactionPageHref }}\n .actions=${this.__couponCodesActions}\n .filters=${this.__codesFilters}\n >\n </foxy-internal-async-list-control>\n\n <foxy-internal-editable-list-control\n infer=\"product-code-restrictions\"\n .getValue=${this.__productCodeRestrictionsGetValue}\n .setValue=${this.__productCodeRestrictionsSetValue}\n .units=${[\n { label: this.t('product-code-restrictions.unit_allow'), value: 'allow' },\n { label: this.t('product-code-restrictions.unit_block'), value: 'block' },\n ]}\n >\n </foxy-internal-editable-list-control>\n\n <foxy-internal-array-map-control infer=\"item-option-restrictions\">\n </foxy-internal-array-map-control>\n\n <foxy-internal-query-builder-control\n infer=\"customer-attribute-restrictions\"\n disable-zoom\n disable-or\n .operators=${this.__customerAttributeRestrictionsOperators}\n .getValue=${this.__customerAttributeRestrictionsGetValue}\n .setValue=${this.__customerAttributeRestrictionsSetValue}\n >\n </foxy-internal-query-builder-control>\n\n <foxy-internal-editable-list-control\n infer=\"customer-subscription-restrictions\"\n .getValue=${this.__customerSubscriptionRestrictionsGetValue}\n .setValue=${this.__customerSubscriptionRestrictionsSetValue}\n >\n </foxy-internal-editable-list-control>\n\n <foxy-internal-summary-control infer=\"auto-apply\">\n <foxy-internal-switch-control infer=\"customer-auto-apply\"></foxy-internal-switch-control>\n </foxy-internal-summary-control>\n\n <foxy-internal-summary-control infer=\"category-restrictions-stub\">\n <p class=\"text-disabled\"><foxy-i18n infer=\"\" key=\"text\"></foxy-i18n></p>\n </foxy-internal-summary-control>\n\n <foxy-internal-async-resource-link-list-control\n foreign-key-for-uri=\"item_category_uri\"\n foreign-key-for-id=\"item_category_id\"\n own-key-for-uri=\"coupon_uri\"\n own-uri=${ifDefined(this.data?._links.self.href)}\n embed-key=\"fx:coupon_item_categories\"\n options-href=${ifDefined(this.__storeLoader?.data?._links['fx:item_categories'].href)}\n links-href=${ifDefined(this.data?._links['fx:coupon_item_categories'].href)}\n infer=\"category-restrictions\"\n limit=\"5\"\n item=\"foxy-item-category-card\"\n >\n </foxy-internal-async-resource-link-list-control>\n\n <foxy-internal-summary-control infer=\"uses\">\n <foxy-internal-number-control\n layout=\"summary-item\"\n infer=\"number-of-uses-allowed\"\n step=\"1\"\n min=\"0\"\n >\n </foxy-internal-number-control>\n\n <foxy-internal-number-control\n layout=\"summary-item\"\n infer=\"number-of-uses-allowed-per-customer\"\n step=\"1\"\n min=\"0\"\n >\n </foxy-internal-number-control>\n\n <foxy-internal-number-control\n layout=\"summary-item\"\n infer=\"number-of-uses-allowed-per-code\"\n step=\"1\"\n min=\"0\"\n >\n </foxy-internal-number-control>\n </foxy-internal-summary-control>\n\n <foxy-internal-summary-control infer=\"timeframe\">\n <foxy-internal-date-control layout=\"summary-item\" infer=\"start-date\">\n </foxy-internal-date-control>\n <foxy-internal-date-control layout=\"summary-item\" infer=\"end-date\">\n </foxy-internal-date-control>\n </foxy-internal-summary-control>\n\n <foxy-internal-summary-control infer=\"taxes\">\n <foxy-internal-number-control\n layout=\"summary-item\"\n infer=\"inclusive-tax-rate\"\n min=\"0\"\n max=\"1\"\n >\n </foxy-internal-number-control>\n </foxy-internal-summary-control>\n\n <foxy-internal-summary-control infer=\"options\">\n <foxy-internal-switch-control infer=\"multiple-codes-allowed\"></foxy-internal-switch-control>\n <foxy-internal-switch-control infer=\"combinable\"></foxy-internal-switch-control>\n <foxy-internal-switch-control infer=\"exclude-category-discounts\">\n </foxy-internal-switch-control>\n <foxy-internal-switch-control infer=\"exclude-line-item-discounts\">\n </foxy-internal-switch-control>\n <foxy-internal-switch-control infer=\"is-taxable\"></foxy-internal-switch-control>\n <foxy-internal-switch-control infer=\"shared-codes-allowed\"></foxy-internal-switch-control>\n </foxy-internal-summary-control>\n\n <foxy-internal-summary-control infer=\"attributes-stub\">\n <p class=\"text-disabled\"><foxy-i18n infer=\"\" key=\"text\"></foxy-i18n></p>\n </foxy-internal-summary-control>\n\n <foxy-internal-async-list-control\n first=${ifDefined(this.data?._links['fx:attributes'].href)}\n limit=\"5\"\n infer=\"attributes\"\n item=\"foxy-attribute-card\"\n form=\"foxy-attribute-form\"\n alert\n >\n </foxy-internal-async-list-control>\n\n ${super.renderBody()}\n\n <foxy-nucleon\n infer=\"\"\n class=\"hidden\"\n href=${ifDefined(this.data?._links['fx:store'].href)}\n id=${this.__storeLoaderId}\n @update=${() => this.requestUpdate()}\n >\n </foxy-nucleon>\n `;\n }\n\n private get __storeLoader() {\n type Loader = NucleonElement<Resource<Rels.Store>>;\n return this.renderRoot.querySelector<Loader>(`#${this.__storeLoaderId}`);\n }\n}\n"]}
|
|
@@ -22,6 +22,8 @@ export declare class FilterAttributeForm extends Base<Data> {
|
|
|
22
22
|
static readonly attributeName: string;
|
|
23
23
|
static readonly filterNameKey: string;
|
|
24
24
|
static get properties(): PropertyDeclarations;
|
|
25
|
+
/** Default filter query. */
|
|
26
|
+
defaults: string | null;
|
|
25
27
|
/** Admin page pathname. */
|
|
26
28
|
pathname: string | null;
|
|
27
29
|
/** Filter options passed down to `QueryBuilder.options.` */
|