@foxy.io/elements 1.41.0-beta.4 → 1.41.0-beta.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1 +1 @@
1
- import"./foxy-billing-address-card.js";import"./foxy-attribute-card.js";import"./foxy-attribute-form.js";import"./foxy-custom-field-form.js";import"./foxy-custom-field-card.js";import"./foxy-copy-to-clipboard.js";import"./foxy-nucleon-element.js";import"./foxy-shipment-card.js";import"./foxy-payment-card.js";import"./foxy-webhook-card.js";import"./foxy-webhook-form.js";import"./foxy-address-form.js";import"./foxy-item-card.js";import"./foxy-item-form.js";import"./shared-5c6a00e9.js";import"./shared-7f14ea13.js";import"./shared-2fe84d72.js";import"./shared-7eefc244.js";import{b as e,I as t}from"./shared-f00ebf92.js";import{_ as i,B as o}from"./shared-cb58dfcd.js";import{h as r,r as s,s as n}from"./shared-ba5c42c7.js";import{i as a}from"./shared-53e42a77.js";import{A as d}from"./shared-5592ec6e.js";import"./shared-70bcd6ae.js";import"./shared-6ce9d926.js";import"./foxy-customer-card.js";import"./foxy-swipe-actions.js";import"./foxy-spinner.js";import{g as l}from"./shared-bab2ea2c.js";import{c}from"./shared-4e709717.js";import{R as u,a as f}from"./shared-3c0dcb9e.js";import"./shared-14177287.js";import"./shared-d298bb95.js";import"./shared-f83207fb.js";import"./shared-343d1fd7.js";import"./shared-cd96ff03.js";import"./shared-2aa23b5f.js";import"./shared-5e4a03d1.js";import"./shared-7594e563.js";import"./shared-0aedd809.js";import"./shared-5ef40e86.js";import"./shared-a146c6a5.js";import"./shared-58c0c5cc.js";import"./shared-cfea6000.js";import"./shared-5212ef4f.js";import"./shared-5afb584d.js";import"./shared-174ae849.js";import"./shared-3ad093b5.js";import"./shared-65763e6f.js";import"./shared-a4a847e4.js";import"./shared-b82e43e5.js";import"./shared-5fd5805c.js";import"./shared-44209364.js";import"./shared-535d1ec6.js";import"./shared-a477b90e.js";import"./shared-29b0ef56.js";import"./shared-30829c7f.js";import"./shared-eb963ba3.js";import"./shared-cf613436.js";import"./shared-922db328.js";import"./shared-c71fb90f.js";import"./shared-2931ccbe.js";import"./shared-acbcad2e.js";import"./shared-62a913ef.js";import"./shared-379b6e13.js";import"./shared-1cd9967e.js";import"./shared-5231970e.js";import"./shared-c19d73fe.js";import"./shared-58f1f368.js";import"./shared-12ea5def.js";import"./shared-651c44fa.js";import"./shared-54031a26.js";import"./shared-5988dd30.js";import"./shared-2a941373.js";import"./shared-d0aed1c1.js";import"./foxy-webhook-status-card.js";import"./foxy-webhook-log-card.js";import"./shared-c003fbf3.js";import"./shared-a0570012.js";import"./shared-58bb3dda.js";import"./foxy-form-dialog.js";import"./shared-53e476fd.js";import"./shared-dc383217.js";import"./shared-e69c94bd.js";import"./shared-619235ab.js";import"./shared-fe56bcdb.js";import"./shared-3c7e55e4.js";import"./shared-14209e60.js";import"./shared-58a50b35.js";import"./shared-8ae33bf4.js";import"./shared-79d0699c.js";import"./shared-43e2c3f6.js";import"./foxy-discount-detail-card.js";import"./foxy-coupon-detail-card.js";import"./foxy-item-category-card.js";import"./foxy-discount-builder.js";import"./shared-63c32024.js";import"./foxy-item-option-card.js";import"./foxy-item-option-form.js";import"./foxy-collection-page.js";import"./foxy-pagination.js";let p,h,m=e=>e;customElements.define("foxy-internal-post-action-control",class extends e{constructor(){super(...arguments),this.messageOptions={},this.theme=null,this.href=null,this.__buttonState="idle",this.__api=new d(this)}static get properties(){return i(i({},super.properties),{},{messageOptions:{type:Object,attribute:"message-options"},theme:{},href:{},__buttonState:{}})}renderControl(){var e;return r(p||(p=m` <foxy-internal-confirm-dialog header="header" infer="confirm-dialog" id="confirm-dialog" .messageOptions="${0}" @hide="${0}"> </foxy-internal-confirm-dialog> <vaadin-notification position="bottom-end" duration="3000" theme="success" id="success-notification" .renderer="${0}"> </vaadin-notification> <vaadin-notification position="bottom-end" duration="3000" theme="error" id="error-notification" .renderer="${0}"> </vaadin-notification> <vaadin-button theme="${0}" ?disabled="${0}" @click="${0}"> <foxy-i18n infer="button" key="${0}"></foxy-i18n> </vaadin-button> `),this.messageOptions,(e=>{e.detail.cancelled||this.__sendPost()}),this.__getNotificationRenderer("success"),this.__getNotificationRenderer("error"),a(null!==(e=this.theme)&&void 0!==e?e:void 0),this.disabled||this.readonly||"idle"!==this.__buttonState,(e=>{const t=e.currentTarget,i=this.renderRoot.querySelector("#confirm-dialog");null==i||i.show(t)}),this.__buttonState)}async __sendPost(){if(this.href&&"idle"===this.__buttonState){this.__buttonState="busy";const e=(await this.__api.fetch(this.href,{method:"POST"})).ok?"success":"error",t=`#${e}-notification`,i=this.renderRoot.querySelector(t);null==i||i.open(),this.__buttonState="idle",this.dispatchEvent(new CustomEvent(e))}}__getNotificationRenderer(e){return t=>{t.firstElementChild||(t.innerHTML="<span></span>");const i=r(h||(h=m` <foxy-i18n style="color:var(--lumo-${0}-contrast-color)" lang="${0}" key="${0}" ns="${0} notification"> </foxy-i18n> `),e,this.lang,e,this.ns);s(i,t.firstElementChild)}}});let _,v,y,x,b=e=>e;customElements.define("foxy-internal-transaction-customer-control",class extends e{constructor(){super(...arguments),this.__copyEmailState="idle",this.__copyIdState="idle"}static get properties(){return i(i({},super.properties),{},{__copyEmailState:{attribute:!1},__copyIdState:{attribute:!1}})}renderControl(){var e,t,i,o;const s=this.nucleon,d=null===(e=null==s?void 0:s.data)||void 0===e?void 0:e._links["fx:customer"].href,u=d?null===(t=null==s?void 0:s.getCustomerPageHref)||void 0===t?void 0:t.call(s,d):void 0;return r(_||(_=b` <foxy-i18n infer="" class="block text-l font-medium leading-xs mb-s" key="label"> </foxy-i18n> <foxy-swipe-actions> <a class="${0}" style="padding:calc(.625em + (var(--lumo-border-radius)/ 4) - 1px)" href="${0}"> <foxy-customer-card infer="" href="${0}"></foxy-customer-card> </a> <div class="h-full grid grid-cols-2 gap-s ml-s" slot="action"> ${0} ${0} </div> </foxy-swipe-actions> `),c({"block ring-inset rounded transition-colors bg-contrast-5":!0,"cursor-pointer hover-bg-contrast-10":!!u,"focus-outline-none focus-ring-2 focus-ring-primary-50":!!u}),a(u),a(d),this.__renderCopyAction(n(v||(v=b`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20" fill="currentColor" style="width: 1.2rem; height: 1.2rem"><path fill-rule="evenodd" d="M9.493 2.852a.75.75 0 0 0-1.486-.204L7.545 6H4.198a.75.75 0 0 0 0 1.5h3.14l-.69 5H3.302a.75.75 0 0 0 0 1.5h3.14l-.435 3.148a.75.75 0 0 0 1.486.204L7.955 14h2.986l-.434 3.148a.75.75 0 0 0 1.486.204L12.456 14h3.346a.75.75 0 0 0 0-1.5h-3.14l.69-5h3.346a.75.75 0 0 0 0-1.5h-3.14l.435-3.148a.75.75 0 0 0-1.486-.204L12.045 6H9.059l.434-3.148ZM8.852 7.5l-.69 5h2.986l.69-5H8.852Z" clip-rule="evenodd" /></svg>`)),"copy_id_caption","__copyIdState",d?String(l(d)):""),this.__renderCopyAction(n(y||(y=b`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20" fill="currentColor" style="width: 1.2rem; height: 1.2rem"><path fill-rule="evenodd" d="M5.404 14.596A6.5 6.5 0 1 1 16.5 10a1.25 1.25 0 0 1-2.5 0 4 4 0 1 0-.571 2.06A2.75 2.75 0 0 0 18 10a8 8 0 1 0-2.343 5.657.75.75 0 0 0-1.06-1.06 6.5 6.5 0 0 1-9.193 0ZM10 7.5a2.5 2.5 0 1 0 0 5 2.5 2.5 0 0 0 0-5Z" clip-rule="evenodd" /></svg>`)),"copy_email_caption","__copyEmailState",null!==(o=null===(i=null==s?void 0:s.data)||void 0===i?void 0:i.customer_email)&&void 0!==o?o:""))}__renderCopyAction(e,t,i,o){const s=this[i],n="fail"===s?"error":"done"===s?"end":"busy";return r(x||(x=b` <button class="relative transition-colors bg-contrast-5 text-body hover-bg-contrast-10 rounded h-full py-0 px-m focus-outline-none focus-ring-2 focus-ring-inset focus-ring-primary-50" ?disabled="${0}" @click="${0}" @focusout="${0}" @mouseout="${0}"> <div class="${0}"> ${0} <foxy-i18n class="mt-xs text-s font-medium leading-none" infer="" key="${0}"> </foxy-i18n> </div> <div class="${0}"> <foxy-spinner layout="no-label" state="${0}" infer="spinner"> </foxy-spinner> </div> </button> `),"idle"!==s,(()=>"idle"===s&&this.__copy(o,i)),(e=>"idle"!==s&&e.stopPropagation()),(e=>"idle"!==s&&e.stopPropagation()),c({"relative flex flex-col items-center justify-center transition-opacity":!0,"opacity-0":"idle"!==s}),e,t,c({"absolute inset-0 flex items-center justify-center transition-opacity":!0,"opacity-0":"idle"===s}),n)}async __copy(e,t){this[t]="busy";try{await navigator.clipboard.writeText(e),this[t]="done"}catch(e){this[t]="fail"}setTimeout((()=>this[t]="idle"),3e3)}});let g,j,$,k,w,S,P,A=e=>e;customElements.define("foxy-internal-transaction-actions-control",class extends e{renderControl(){var e,t,i,o,s,n,a,d,l,c,u,f;const p=this.nucleon;return r(g||(g=A` <div class="flex flex-wrap gap-x-m gap-y-xs"> ${0} ${0} ${0} ${0} ${0} ${0} <vaadin-button theme="tertiary-inline" ?disabled="${0}" @click="${0}"> <foxy-i18n infer="archive" key="caption_${0}"> </foxy-i18n> </vaadin-button> </div> `),(null===(t=null===(e=this.nucleon)||void 0===e?void 0:e.data)||void 0===t?void 0:t._links["fx:capture"])?this.__renderCaptureAction():"",(null===(o=null===(i=this.nucleon)||void 0===i?void 0:i.data)||void 0===o?void 0:o._links["fx:void"])?this.__renderVoidAction():"",(null===(n=null===(s=this.nucleon)||void 0===s?void 0:s.data)||void 0===n?void 0:n._links["fx:refund"])?this.__renderRefundAction():"",(null===(d=null===(a=this.nucleon)||void 0===a?void 0:a.data)||void 0===d?void 0:d._links["fx:send_emails"])?this.__renderSendEmailsAction():"",(null===(c=null===(l=this.nucleon)||void 0===l?void 0:l.data)||void 0===c?void 0:c._links["fx:subscription"])?this.__renderSubscriptionAction():"",(null===(f=null===(u=this.nucleon)||void 0===u?void 0:u.data)||void 0===f?void 0:f._links["fx:receipt"])?this.__renderReceiptAction():"",this.disabledSelector.matches("archive",!0),(()=>{null==p||p.edit({hide_transaction:!(null==p?void 0:p.form.hide_transaction)}),null==p||p.submit()}),(null==p?void 0:p.form.hide_transaction)?"unarchive":"archive")}__renderSendEmailsAction(){var e,t;return r(j||(j=A` <foxy-internal-post-action-control infer="send-emails" theme="tertiary-inline" href="${0}" @success="${0}"> </foxy-internal-post-action-control> `),a(null===(t=null===(e=this.nucleon)||void 0===e?void 0:e.data)||void 0===t?void 0:t._links["fx:send_emails"].href),(()=>{var e;return null===(e=this.nucleon)||void 0===e?void 0:e.refresh()}))}__renderCaptureAction(){var e,t;return r($||($=A` <foxy-internal-post-action-control theme="tertiary-inline success" infer="capture" href="${0}" @success="${0}"> </foxy-internal-post-action-control> `),a(null===(t=null===(e=this.nucleon)||void 0===e?void 0:e.data)||void 0===t?void 0:t._links["fx:capture"].href),(()=>{var e;return null===(e=this.nucleon)||void 0===e?void 0:e.refresh()}))}__renderVoidAction(){var e,t,i;return r(k||(k=A` <foxy-internal-post-action-control theme="tertiary-inline error" infer="void" href="${0}" @success="${0}"> </foxy-internal-post-action-control> `),a(null===(i=null===(t=null===(e=this.nucleon)||void 0===e?void 0:e.data)||void 0===t?void 0:t._links["fx:void"])||void 0===i?void 0:i.href),(()=>{var e;return null===(e=this.nucleon)||void 0===e?void 0:e.refresh()}))}__renderRefundAction(){var e,t,i;return r(w||(w=A` <foxy-internal-post-action-control infer="refund" theme="tertiary-inline" href="${0}" @success="${0}"> </foxy-internal-post-action-control> `),a(null===(i=null===(t=null===(e=this.nucleon)||void 0===e?void 0:e.data)||void 0===t?void 0:t._links["fx:refund"])||void 0===i?void 0:i.href),(()=>{var e;return null===(e=this.nucleon)||void 0===e?void 0:e.refresh()}))}__renderSubscriptionAction(){var e,t,i;const o=this.nucleon,s=null===(t=null===(e=null==o?void 0:o.data)||void 0===e?void 0:e._links["fx:subscription"])||void 0===t?void 0:t.href,n=s?null===(i=null==o?void 0:o.getSubscriptionPageHref)||void 0===i?void 0:i.call(o,s):void 0;return r(S||(S=A` <a class="rounded text-m font-medium text-primary cursor-pointer transition-opacity hover-opacity-80 focus-outline-none focus-ring-2 focus-ring-primary-50" href="${0}"> <foxy-i18n infer="subscription" key="caption"></foxy-i18n> </a> `),a(n))}__renderReceiptAction(){var e,t;const i=this.nucleon;return r(P||(P=A` <a target="_blank" class="rounded text-m font-medium text-primary cursor-pointer transition-opacity hover-opacity-80 focus-outline-none focus-ring-2 focus-ring-primary-50" href="${0}"> <foxy-i18n infer="receipt" key="caption"></foxy-i18n> </a> `),a(null===(t=null===(e=null==i?void 0:i.data)||void 0===e?void 0:e._links["fx:receipt"])||void 0===t?void 0:t.href))}});let C,H,L,E,R,B,I,O,q,G,T,M=e=>e;customElements.define("foxy-internal-transaction-summary-control",class extends e{constructor(){super(...arguments),this.__storeLoaderId="storeLoader"}renderControl(){var e,t,i,o,s,n,d,l,c;const u=null===(e=this.nucleon)||void 0===e?void 0:e.data;if(!u)return r(C||(C=M``));const f=null!==(i=null===(t=null==u?void 0:u._embedded)||void 0===t?void 0:t["fx:applied_taxes"])&&void 0!==i?i:[],p=null!==(s=null===(o=u._embedded)||void 0===o?void 0:o["fx:shipments"])&&void 0!==s?s:[];return r(H||(H=M` <foxy-nucleon infer="" href="${0}" id="${0}" @update="${0}"> </foxy-nucleon> <p class="grid gap-x-s text-right text-s leading-m border-dashed border rounded border-contrast-20 whitespace-nowrap overflow-auto" style="padding:calc(.625em + (var(--lumo-border-radius)/ 4) - 2px);grid-template-columns:1fr min-content"> <span><foxy-i18n key="subtotal" infer=""></foxy-i18n>&colon;</span> <span>${0}</span> ${0} ${0} ${0} ${0} <span class="col-span-2 border-t border-dashed border-contrast-20 my-s"></span> <span class="col-span-2 flex gap-s justify-between items-center"> ${0} <span class="text-xl font-medium leading-xs"> <foxy-i18n infer="" key="total"></foxy-i18n>&colon; ${0} </span> </span> </p> `),a(this.__storeHref),this.__storeLoaderId,(()=>this.requestUpdate()),this.__renderPrice(u.total_item_price),0===p.length||0===u.total_shipping?r(L||(L=M` <span><foxy-i18n infer="" key="total_shipping"></foxy-i18n>&colon;</span> <span>${0} </span> `),this.__renderPrice(u.total_shipping,!0)):p.map((e=>r(E||(E=M` <span>${0}&colon;</span> <span>${0}</span> `),e.shipping_service_description,this.__renderPrice(e.total_shipping,!0)))),0===f.length||0===u.total_tax?r(R||(R=M` <span><foxy-i18n infer="" key="total_tax"></foxy-i18n>&colon;</span> <span>${0}</span> `),this.__renderPrice(u.total_tax,!0)):f.map((e=>r(B||(B=M` <span>${0}&colon;</span> <span>${0}</span> `),e.name,this.__renderPrice(e.amount,!0)))),null===(d=null===(n=null==u?void 0:u._embedded)||void 0===n?void 0:n["fx:gift_card_code_logs"])||void 0===d?void 0:d.map((e=>{var t,i,o,s,n;const a=null===(i=null===(t=e._embedded)||void 0===t?void 0:t["fx:gift_card"])||void 0===i?void 0:i.name,d=null===(s=null===(o=e._embedded)||void 0===o?void 0:o["fx:gift_card_code"])||void 0===s?void 0:s.code;if(a&&d)return r(I||(I=M` <span data-testclass="gift-card-code">${0} &bull; ${0}&colon;</span> <span>${0}</span> `),a,d,this.__renderPrice(null!==(n=e.balance_adjustment)&&void 0!==n?n:0,!0))})),null===(c=null===(l=null==u?void 0:u._embedded)||void 0===l?void 0:l["fx:discounts"])||void 0===c?void 0:c.map((({name:e,code:t,amount:i})=>r(O||(O=M` <span data-testclass="discount">${0}${0}&colon;</span> <span>${0}</span> `),e,t?r(q||(q=M` &bull; ${0}`),t):"",this.__renderPrice(i,!0)))),this.__renderStatus(),this.__renderPrice(u.total_order))}get __storeHref(){var e,t,i;return null===(i=null===(t=null===(e=this.nucleon)||void 0===e?void 0:e.data)||void 0===t?void 0:t._links["fx:store"])||void 0===i?void 0:i.href}get __store(){var e,t;const i=`#${this.__storeLoaderId}`;return null!==(t=null===(e=this.renderRoot.querySelector(i))||void 0===e?void 0:e.data)&&void 0!==t?t:null}__renderPrice(e,t=!1){var i,o,s;const n=(null===(i=this.__store)||void 0===i?void 0:i.use_international_currency_symbol)?"code":"symbol",a=null===(s=null===(o=this.nucleon)||void 0===o?void 0:o.data)||void 0===s?void 0:s.currency_code;return r(G||(G=M` <foxy-i18n class="${0}" infer="" key="price" .options="${0}"> </foxy-i18n> `),t&&0!==e?e>0?"text-success":"text-error":"",{currencyDisplay:n,signDisplay:t?"exceptZero":"auto",amount:`${e} ${a}`})}__renderStatus(){var e,t;const i=(null===(t=null===(e=this.nucleon)||void 0===e?void 0:e.data)||void 0===t?void 0:t.status)||"completed";let o="";return o=["capturing","captured","approved","authorized","pending"].includes(i)?"text-success bg-success-10":i&&"completed"!==i?["problem","pending_fraud_review","rejected","declined"].includes(i)?"text-error-contrast bg-error":"bg-contrast-5 text-body":"text-success-contrast bg-success",r(T||(T=M` <foxy-i18n infer="" class="${0} rounded-s py-xs px-s font-medium text-s leading-xs" key="status_${0}"></foxy-i18n> `),o,i)}});let U,Z,N,W=e=>e;const z=u(f(t,"transaction"));class V extends z{constructor(){var e;super(...arguments),e=this,this.hostedPaymentGatewaysHelper=null,this.paymentGatewaysHelper=null,this.localeCodes=null,this.getSubscriptionPageHref=null,this.getCustomerPageHref=null,this.__webhooksBulkActions=[{name:"refeed",onClick:async function(t){if(!e.data)return;const i=e.data._links["fx:send_webhooks"].href,o=new V.API(e),r=await o.fetch(i,{method:"POST",body:JSON.stringify({refeed_hooks:t.map((e=>l(e._links.self.href))),event:"refeed"})});if(t.forEach((e=>{V.Rumour("").share({related:[...t.map((e=>e._links["fx:logs"].href)),...t.map((e=>e._links["fx:statuses"].href))],source:e._links.self.href,data:e})})),!r.ok)throw new Error(await r.text())}}]}static get properties(){return i(i({},super.properties),{},{hostedPaymentGatewaysHelper:{attribute:"hosted-payment-gateways-helper"},paymentGatewaysHelper:{attribute:"payment-gateways-helper"},getSubscriptionPageHref:{attribute:!1},getCustomerPageHref:{attribute:!1},localeCodes:{attribute:"locale-codes"}})}get readonlySelector(){var e,t,i;const r=["billing-addresses","datafeed:data-is-fed","webhooks:dialog:url",super.readonlySelector];return Boolean(null!==(t=null===(e=this.data)||void 0===e?void 0:e._links["fx:void"])&&void 0!==t?t:null===(i=this.data)||void 0===i?void 0:i._links["fx:refund"])||r.push("items","attributes","custom-fields"),new o(r.join(" ").trim())}get hiddenSelector(){var e,t,i,r;const s=["billing-addresses:dialog:delete","billing-addresses:dialog:timestamps","webhooks:dialog:header:copy-json","webhooks:dialog:header:copy-id","webhooks:dialog:timestamps","webhooks:dialog:name","webhooks:dialog:query","webhooks:dialog:encryption-key","webhooks:dialog:delete",super.readonlySelector],n=null===(e=this.data)||void 0===e?void 0:e.type;return(null===(t=this.data)||void 0===t?void 0:t._links["fx:subscription"])||s.unshift("subscription"),"subscription_modification"===n&&s.unshift("actions"),"updateinfo"===n&&s.unshift("not=customer,subscription,payments,custom-fields,attributes"),"subscription_cancellation"===n&&s.unshift("not=customer,subscription,custom-fields,attributes"),(null===(r=null===(i=this.__storeLoader)||void 0===i?void 0:i.data)||void 0===r?void 0:r.use_webhook)||s.unshift("datafeed"),new o(s.join(" ").trim())}get headerSubtitleOptions(){var e,t,i,o,r;const s=null===(e=this.data)||void 0===e?void 0:e.source,n=null===(t=this.data)||void 0===t?void 0:t.type;let a="";return"updateinfo"===n?a=!s||(null==s?void 0:s.startsWith("cit_"))?"customer_changed_payment_method":"mit_uoe"===s?"admin_changed_payment_method_with_uoe":"mit_api"===s?"integration_changed_payment_method":"admin_changed_payment_method":"subscription_modification"===n?a=!s||(null==s?void 0:s.startsWith("cit_"))?"customer_changed_subscription":"mit_uoe"===s?"admin_changed_subscription_with_uoe":"mit_api"===s?"integration_changed_subscription":"admin_changed_subscription":"subscription_renewal"===n?"mit_recurring"===s?a="subscription_renewal_attempt":"mit_recurring_reattempt_automated"===s?a="subscription_renewal_automated_reattempt":"mit_recurring_reattempt_manual"===s&&(a="subscription_renewal_manual_reattempt"):"subscription_cancellation"===n?"cit_recurring_cancellation"===s?a="customer_canceled_subscription":"mit_recurring_cancellation"===s&&(a="admin_canceled_subscription"):(null===(i=this.data)||void 0===i?void 0:i._links["fx:subscription"])?(null==s?void 0:s.startsWith("cit_"))?a="customer_subscribed":"mit_uoe"===s?a="admin_subscribed_with_uoe":"mit_api"===s&&(a="integration_subscribed"):(null==s?void 0:s.startsWith("cit_"))?a="customer_placed_order":"mit_uoe"===s?a="admin_placed_order_with_uoe":"mit_api"===s&&(a="integration_placed_order"),{transaction_date:null===(o=this.data)||void 0===o?void 0:o.transaction_date,ip_country:null===(r=this.data)||void 0===r?void 0:r.ip_country,context:a}}get headerSubtitleBadges(){var e,t;const i=super.headerSubtitleBadges;return(null===(e=this.data)||void 0===e?void 0:e.is_test)&&i.push({key:"test"}),(null===(t=this.data)||void 0===t?void 0:t.hide_transaction)&&i.push({key:"archived"}),i}get headerCopyIdValue(){var e,t,i;return null!==(i=null===(t=null===(e=this.data)||void 0===e?void 0:e.display_id)||void 0===t?void 0:t.toString())&&void 0!==i?i:""}renderHeaderActions(){return r(U||(U=W` <foxy-internal-transaction-actions-control infer="actions"> </foxy-internal-transaction-actions-control> `))}renderBody(){var e,t,i,o,s,n,d,l,c,u,f,p,h,m,_,v;let y,x,b;const g=this.hiddenSelector;if(this.data)try{const o=new URL(this.data._links["fx:shipments"].href),r=new URL(null!==(i=null===(t=null===(e=this.__storeLoader)||void 0===e?void 0:e.data)||void 0===t?void 0:t._links["fx:webhooks"].href)&&void 0!==i?i:""),s=new URL(this.data._links["fx:items"].href);o.searchParams.set("zoom","items:item_category"),r.searchParams.set("event_resource","transaction"),s.searchParams.set("zoom","item_options"),y=o.toString(),x=r.toString(),b=s.toString()}catch(e){}return r(Z||(Z=W` ${0} ${0} <foxy-internal-transaction-customer-control infer="customer"> </foxy-internal-transaction-customer-control> <div class="grid gap-s" ?hidden="${0}"> <foxy-internal-async-list-control infer="items" class="min-w-0" first="${0}" limit="10" item="foxy-item-card" form="foxy-item-form" alert wide .related="${0}" .itemProps="${0}" .formProps="${0}"> </foxy-internal-async-list-control> <foxy-internal-transaction-summary-control infer="summary" class="min-w-0"> </foxy-internal-transaction-summary-control> </div> <foxy-internal-async-list-control infer="billing-addresses" first="${0}" item="foxy-billing-address-card" form="foxy-address-form" hide-create-button hide-delete-button alert> </foxy-internal-async-list-control> <foxy-internal-async-list-control infer="payments" first="${0}" item="foxy-payment-card" .itemProps="${0}"> </foxy-internal-async-list-control> <foxy-internal-async-list-control infer="custom-fields" class="min-w-0" first="${0}" limit="5" form="foxy-custom-field-form" item="foxy-custom-field-card" alert> </foxy-internal-async-list-control> <foxy-internal-async-list-control infer="attributes" class="min-w-0" first="${0}" limit="5" form="foxy-attribute-form" item="foxy-attribute-card" alert> </foxy-internal-async-list-control> <foxy-internal-async-list-control infer="shipments" first="${0}" item="foxy-shipment-card"> </foxy-internal-async-list-control> <foxy-internal-async-list-control infer="webhooks" first="${0}" item="foxy-webhook-card" form="foxy-webhook-form" hide-create-button hide-delete-button alert .bulkActions="${0}" .itemProps="${0}" .formProps="${0}"> </foxy-internal-async-list-control> <foxy-internal-summary-control infer="datafeed"> <foxy-internal-switch-control infer="data-is-fed"></foxy-internal-switch-control> <foxy-internal-post-action-control infer="process-webhook" theme="tertiary-inline" href="${0}" @success="${0}"> </foxy-internal-post-action-control> </foxy-internal-summary-control> <foxy-nucleon class="hidden" infer="" href="${0}" id="storeLoader" @update="${0}"> </foxy-nucleon> `),this.renderHeader(),["problem","pending_fraud_review","rejected","declined"].includes(null!==(s=null===(o=this.data)||void 0===o?void 0:o.status)&&void 0!==s?s:"")?r(N||(N=W` <p class="leading-xs text-body rounded bg-error-10 block" style="padding:calc(.625em + (var(--lumo-border-radius)/ 4) - 1px)"> <foxy-i18n infer="header" key="alert_status_${0}"></foxy-i18n> </p> `),null===(n=this.data)||void 0===n?void 0:n.status):"",g.matches("items",!0)&&g.matches("summary",!0),a(b),[this.href],{"locale-codes":this.localeCodes},{"item-categories":null===(l=null===(d=this.__storeLoader)||void 0===d?void 0:d.data)||void 0===l?void 0:l._links["fx:item_categories"].href,"locale-codes":this.localeCodes,store:null===(c=this.data)||void 0===c?void 0:c._links["fx:store"].href},a(null===(u=this.data)||void 0===u?void 0:u._links["fx:billing_addresses"].href),a(null===(f=this.data)||void 0===f?void 0:f._links["fx:payments"].href),{"hosted-payment-gateways-helper":this.hostedPaymentGatewaysHelper,"payment-gateways-helper":this.paymentGatewaysHelper},a(null===(p=this.data)||void 0===p?void 0:p._links["fx:custom_fields"].href),a(null===(h=this.data)||void 0===h?void 0:h._links["fx:attributes"].href),a(y),a(x),this.__webhooksBulkActions,{"resource-uri":this.href},{"resource-uri":this.href},a(null===(_=null===(m=this.data)||void 0===m?void 0:m._links["fx:process_webhook"])||void 0===_?void 0:_.href),(()=>this.refresh()),a(null===(v=this.data)||void 0===v?void 0:v._links["fx:store"].href),(()=>this.requestUpdate()))}get __storeLoader(){return this.renderRoot.querySelector("#storeLoader")}}customElements.define("foxy-transaction",V);export{V as Transaction};
1
+ import"./foxy-billing-address-card.js";import"./foxy-attribute-card.js";import"./foxy-attribute-form.js";import"./foxy-custom-field-form.js";import"./foxy-custom-field-card.js";import"./foxy-copy-to-clipboard.js";import"./foxy-nucleon-element.js";import"./foxy-shipment-card.js";import"./foxy-payment-card.js";import"./foxy-webhook-card.js";import"./foxy-webhook-form.js";import"./foxy-address-form.js";import"./foxy-item-card.js";import"./foxy-item-form.js";import"./shared-5c6a00e9.js";import"./shared-2fe84d72.js";import{b as e,I as t}from"./shared-f00ebf92.js";import"./foxy-spinner.js";import{_ as i,B as o}from"./shared-cb58dfcd.js";import{h as s,s as r}from"./shared-ba5c42c7.js";import{D as n}from"./shared-c003fbf3.js";import{A as a}from"./shared-5592ec6e.js";import{i as d}from"./shared-53e42a77.js";import"./shared-7f14ea13.js";import"./shared-70bcd6ae.js";import"./shared-6ce9d926.js";import"./foxy-customer-card.js";import"./foxy-swipe-actions.js";import{g as l}from"./shared-bab2ea2c.js";import{c}from"./shared-4e709717.js";import{R as u,a as f}from"./shared-3c0dcb9e.js";import"./shared-14177287.js";import"./shared-d298bb95.js";import"./shared-f83207fb.js";import"./shared-343d1fd7.js";import"./shared-cd96ff03.js";import"./shared-2aa23b5f.js";import"./shared-5e4a03d1.js";import"./shared-7594e563.js";import"./shared-0aedd809.js";import"./shared-5ef40e86.js";import"./shared-a146c6a5.js";import"./shared-58c0c5cc.js";import"./shared-cfea6000.js";import"./shared-5212ef4f.js";import"./shared-5afb584d.js";import"./shared-174ae849.js";import"./shared-3ad093b5.js";import"./shared-65763e6f.js";import"./shared-a4a847e4.js";import"./shared-b82e43e5.js";import"./shared-5fd5805c.js";import"./shared-44209364.js";import"./shared-535d1ec6.js";import"./shared-a477b90e.js";import"./shared-29b0ef56.js";import"./shared-30829c7f.js";import"./shared-eb963ba3.js";import"./shared-cf613436.js";import"./shared-922db328.js";import"./shared-c71fb90f.js";import"./shared-2931ccbe.js";import"./shared-acbcad2e.js";import"./shared-62a913ef.js";import"./shared-379b6e13.js";import"./shared-1cd9967e.js";import"./shared-5231970e.js";import"./shared-c19d73fe.js";import"./shared-58f1f368.js";import"./shared-12ea5def.js";import"./shared-651c44fa.js";import"./shared-54031a26.js";import"./shared-5988dd30.js";import"./shared-2a941373.js";import"./shared-d0aed1c1.js";import"./foxy-webhook-status-card.js";import"./foxy-webhook-log-card.js";import"./shared-7eefc244.js";import"./shared-a0570012.js";import"./shared-58bb3dda.js";import"./foxy-form-dialog.js";import"./shared-53e476fd.js";import"./shared-dc383217.js";import"./shared-e69c94bd.js";import"./shared-619235ab.js";import"./shared-fe56bcdb.js";import"./shared-3c7e55e4.js";import"./shared-14209e60.js";import"./shared-58a50b35.js";import"./shared-8ae33bf4.js";import"./shared-79d0699c.js";import"./shared-43e2c3f6.js";import"./foxy-discount-detail-card.js";import"./foxy-coupon-detail-card.js";import"./foxy-item-category-card.js";import"./foxy-discount-builder.js";import"./shared-63c32024.js";import"./foxy-item-option-card.js";import"./foxy-item-option-form.js";import"./foxy-collection-page.js";import"./foxy-pagination.js";let h,p,m,v,_,y,x,b=e=>e;let g,j=e=>e;customElements.define("foxy-internal-post-action-control",class extends e{constructor(){super(...arguments),this.messageOptions={},this.theme=null,this.href=null}static get properties(){return i(i({},super.properties),{},{messageOptions:{type:Object,attribute:"message-options"},theme:{},href:{}})}renderControl(){var e,t;return s(g||(g=j` <foxy-internal-post-action-control-dialog message-options="${0}" infer="" href="${0}" @hide="${0}"> </foxy-internal-post-action-control-dialog> <vaadin-button theme="${0}" ?disabled="${0}" @click="${0}"> <foxy-i18n infer="" key="button"></foxy-i18n> </vaadin-button> `),JSON.stringify(this.messageOptions),d(null!==(e=this.href)&&void 0!==e?e:void 0),(e=>{e.detail.cancelled||this.dispatchEvent(new CustomEvent("success"))}),d(null!==(t=this.theme)&&void 0!==t?t:void 0),this.disabled||this.readonly,(e=>{const t=e.currentTarget,i=this.renderRoot.querySelector("foxy-internal-post-action-control-dialog");null==i||i.show(t)}))}}),customElements.define("foxy-internal-post-action-control-dialog",class extends n{constructor(){super(...arguments),this.messageOptions={},this.closable=!0,this.header="header",this.alert=!0,this.href=null,this.__api=new a(this),this.__state="idle"}static get properties(){return i(i({},super.properties),{},{messageOptions:{type:Object,attribute:"message-options"},href:{},__state:{attribute:!1}})}get hiddenSelector(){const e=["close-button",super.hiddenSelector.toString()];return new o(e.join(" ").trim())}render(){var e=this;return super.render((()=>s(h||(h=b` <div class="relative"> <div class="mb-m mt-xs flex justify-center"> ${0} </div> <foxy-i18n class="block font-lumo text-m text-body text-center mb-l" infer="" key="message_${0}" .options="${0}"> </foxy-i18n> <div class="grid grid-cols-2 gap-m"> ${0} </div> ${0} </div> `),"done"===this.__state?r(p||(p=b`<svg class="text-success" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor" style="width: 2rem; height: 2rem;"><path stroke-linecap="round" stroke-linejoin="round" d="M9 12.75 11.25 15 15 9.75M21 12a9 9 0 1 1-18 0 9 9 0 0 1 18 0Z" /></svg>`)):"fail"===this.__state?r(m||(m=b`<svg class="text-error" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor" style="width: 2rem; height: 2rem;"><path stroke-linecap="round" stroke-linejoin="round" d="M12 9v3.75m9-.75a9 9 0 1 1-18 0 9 9 0 0 1 18 0Zm-9 3.75h.008v.008H12v-.008Z" /></svg>`)):r(v||(v=b`<svg class="text-primary" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor" style="width: 2rem; height: 2rem;"><path stroke-linecap="round" stroke-linejoin="round" d="M9.879 7.519c1.171-1.025 3.071-1.025 4.242 0 1.172 1.025 1.172 2.687 0 3.712-.203.179-.43.326-.67.442-.745.361-1.45.999-1.45 1.827v.75M21 12a9 9 0 1 1-18 0 9 9 0 0 1 18 0Zm-9 5.25h.008v.008H12v-.008Z" /></svg>`)),"busy"===this.__state?"idle":this.__state,this.messageOptions,"done"===this.__state||"fail"===this.__state?s(_||(_=b` <vaadin-button class="col-span-2" theme="contrast" @click="${0}"> <foxy-i18n infer="" key="button_close"></foxy-i18n> </vaadin-button> `),(()=>this.hide())):s(y||(y=b` <vaadin-button ?disabled="${0}" @click="${0}"> <foxy-i18n infer="" key="button_cancel"></foxy-i18n> </vaadin-button> <vaadin-button theme="primary" ?disabled="${0}" @click="${0}"> <foxy-i18n infer="" key="button_confirm"></foxy-i18n> </vaadin-button> `),this.disabled||this.readonly,(()=>this.hide()),this.disabled||this.readonly,(async function(){if(e.href&&"idle"===e.__state){e.__state="busy",e.closable=!1;const t=await e.__api.fetch(e.href,{method:"POST"});e.__state=t.ok?"done":"fail",e.closable=!0}})),"busy"===this.__state?s(x||(x=b` <div class="bg-base absolute inset-0 flex items-center justify-center"> <foxy-spinner layout="vertical" infer=""></foxy-spinner> </div> `)):"")))}async hide(){await super.hide("done"!==this.__state),this.__state="idle"}});let w,k,$,S,P=e=>e;customElements.define("foxy-internal-transaction-customer-control",class extends e{constructor(){super(...arguments),this.__copyEmailState="idle",this.__copyIdState="idle"}static get properties(){return i(i({},super.properties),{},{__copyEmailState:{attribute:!1},__copyIdState:{attribute:!1}})}renderControl(){var e,t,i,o;const n=this.nucleon,a=null===(e=null==n?void 0:n.data)||void 0===e?void 0:e._links["fx:customer"].href,u=a?null===(t=null==n?void 0:n.getCustomerPageHref)||void 0===t?void 0:t.call(n,a):void 0;return s(w||(w=P` <foxy-i18n infer="" class="block text-l font-medium leading-xs mb-s" key="label"> </foxy-i18n> <foxy-swipe-actions> <a class="${0}" style="padding:calc(.625em + (var(--lumo-border-radius)/ 4) - 1px)" href="${0}"> <foxy-customer-card infer="" href="${0}"></foxy-customer-card> </a> <div class="h-full grid grid-cols-2 gap-s ml-s" slot="action"> ${0} ${0} </div> </foxy-swipe-actions> `),c({"block ring-inset rounded transition-colors bg-contrast-5":!0,"cursor-pointer hover-bg-contrast-10":!!u,"focus-outline-none focus-ring-2 focus-ring-primary-50":!!u}),d(u),d(a),this.__renderCopyAction(r(k||(k=P`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20" fill="currentColor" style="width: 1.2rem; height: 1.2rem"><path fill-rule="evenodd" d="M9.493 2.852a.75.75 0 0 0-1.486-.204L7.545 6H4.198a.75.75 0 0 0 0 1.5h3.14l-.69 5H3.302a.75.75 0 0 0 0 1.5h3.14l-.435 3.148a.75.75 0 0 0 1.486.204L7.955 14h2.986l-.434 3.148a.75.75 0 0 0 1.486.204L12.456 14h3.346a.75.75 0 0 0 0-1.5h-3.14l.69-5h3.346a.75.75 0 0 0 0-1.5h-3.14l.435-3.148a.75.75 0 0 0-1.486-.204L12.045 6H9.059l.434-3.148ZM8.852 7.5l-.69 5h2.986l.69-5H8.852Z" clip-rule="evenodd" /></svg>`)),"copy_id_caption","__copyIdState",a?String(l(a)):""),this.__renderCopyAction(r($||($=P`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20" fill="currentColor" style="width: 1.2rem; height: 1.2rem"><path fill-rule="evenodd" d="M5.404 14.596A6.5 6.5 0 1 1 16.5 10a1.25 1.25 0 0 1-2.5 0 4 4 0 1 0-.571 2.06A2.75 2.75 0 0 0 18 10a8 8 0 1 0-2.343 5.657.75.75 0 0 0-1.06-1.06 6.5 6.5 0 0 1-9.193 0ZM10 7.5a2.5 2.5 0 1 0 0 5 2.5 2.5 0 0 0 0-5Z" clip-rule="evenodd" /></svg>`)),"copy_email_caption","__copyEmailState",null!==(o=null===(i=null==n?void 0:n.data)||void 0===i?void 0:i.customer_email)&&void 0!==o?o:""))}__renderCopyAction(e,t,i,o){const r=this[i],n="fail"===r?"error":"done"===r?"end":"busy";return s(S||(S=P` <button class="relative transition-colors bg-contrast-5 text-body hover-bg-contrast-10 rounded h-full py-0 px-m focus-outline-none focus-ring-2 focus-ring-inset focus-ring-primary-50" ?disabled="${0}" @click="${0}" @focusout="${0}" @mouseout="${0}"> <div class="${0}"> ${0} <foxy-i18n class="mt-xs text-s font-medium leading-none" infer="" key="${0}"> </foxy-i18n> </div> <div class="${0}"> <foxy-spinner layout="no-label" state="${0}" infer="spinner"> </foxy-spinner> </div> </button> `),"idle"!==r,(()=>"idle"===r&&this.__copy(o,i)),(e=>"idle"!==r&&e.stopPropagation()),(e=>"idle"!==r&&e.stopPropagation()),c({"relative flex flex-col items-center justify-center transition-opacity":!0,"opacity-0":"idle"!==r}),e,t,c({"absolute inset-0 flex items-center justify-center transition-opacity":!0,"opacity-0":"idle"===r}),n)}async __copy(e,t){this[t]="busy";try{await navigator.clipboard.writeText(e),this[t]="done"}catch(e){this[t]="fail"}setTimeout((()=>this[t]="idle"),3e3)}});let C,A,H,L,E,O,B,R=e=>e;customElements.define("foxy-internal-transaction-actions-control",class extends e{renderControl(){var e,t,i,o,r,n,a,d,l,c,u,f;const h=this.nucleon;return s(C||(C=R` <div class="flex flex-wrap gap-x-m gap-y-xs"> ${0} ${0} ${0} ${0} ${0} ${0} <vaadin-button theme="tertiary-inline" ?disabled="${0}" @click="${0}"> <foxy-i18n infer="archive" key="caption_${0}"> </foxy-i18n> </vaadin-button> </div> `),(null===(t=null===(e=this.nucleon)||void 0===e?void 0:e.data)||void 0===t?void 0:t._links["fx:capture"])?this.__renderCaptureAction():"",(null===(o=null===(i=this.nucleon)||void 0===i?void 0:i.data)||void 0===o?void 0:o._links["fx:void"])?this.__renderVoidAction():"",(null===(n=null===(r=this.nucleon)||void 0===r?void 0:r.data)||void 0===n?void 0:n._links["fx:refund"])?this.__renderRefundAction():"",(null===(d=null===(a=this.nucleon)||void 0===a?void 0:a.data)||void 0===d?void 0:d._links["fx:send_emails"])?this.__renderSendEmailsAction():"",(null===(c=null===(l=this.nucleon)||void 0===l?void 0:l.data)||void 0===c?void 0:c._links["fx:subscription"])?this.__renderSubscriptionAction():"",(null===(f=null===(u=this.nucleon)||void 0===u?void 0:u.data)||void 0===f?void 0:f._links["fx:receipt"])?this.__renderReceiptAction():"",this.disabledSelector.matches("archive",!0),(()=>{null==h||h.edit({hide_transaction:!(null==h?void 0:h.form.hide_transaction)}),null==h||h.submit()}),(null==h?void 0:h.form.hide_transaction)?"unarchive":"archive")}__renderSendEmailsAction(){var e,t;return s(A||(A=R` <foxy-internal-post-action-control infer="send-emails" theme="tertiary-inline" href="${0}" @success="${0}"> </foxy-internal-post-action-control> `),d(null===(t=null===(e=this.nucleon)||void 0===e?void 0:e.data)||void 0===t?void 0:t._links["fx:send_emails"].href),(()=>{var e;return null===(e=this.nucleon)||void 0===e?void 0:e.refresh()}))}__renderCaptureAction(){var e,t;return s(H||(H=R` <foxy-internal-post-action-control theme="tertiary-inline success" infer="capture" href="${0}" @success="${0}"> </foxy-internal-post-action-control> `),d(null===(t=null===(e=this.nucleon)||void 0===e?void 0:e.data)||void 0===t?void 0:t._links["fx:capture"].href),(()=>{var e;return null===(e=this.nucleon)||void 0===e?void 0:e.refresh()}))}__renderVoidAction(){var e,t,i;return s(L||(L=R` <foxy-internal-post-action-control theme="tertiary-inline error" infer="void" href="${0}" @success="${0}"> </foxy-internal-post-action-control> `),d(null===(i=null===(t=null===(e=this.nucleon)||void 0===e?void 0:e.data)||void 0===t?void 0:t._links["fx:void"])||void 0===i?void 0:i.href),(()=>{var e;return null===(e=this.nucleon)||void 0===e?void 0:e.refresh()}))}__renderRefundAction(){var e,t,i;return s(E||(E=R` <foxy-internal-post-action-control infer="refund" theme="tertiary-inline" href="${0}" @success="${0}"> </foxy-internal-post-action-control> `),d(null===(i=null===(t=null===(e=this.nucleon)||void 0===e?void 0:e.data)||void 0===t?void 0:t._links["fx:refund"])||void 0===i?void 0:i.href),(()=>{var e;return null===(e=this.nucleon)||void 0===e?void 0:e.refresh()}))}__renderSubscriptionAction(){var e,t,i;const o=this.nucleon,r=null===(t=null===(e=null==o?void 0:o.data)||void 0===e?void 0:e._links["fx:subscription"])||void 0===t?void 0:t.href,n=r?null===(i=null==o?void 0:o.getSubscriptionPageHref)||void 0===i?void 0:i.call(o,r):void 0;return s(O||(O=R` <a class="rounded text-m font-medium text-primary cursor-pointer transition-opacity hover-opacity-80 focus-outline-none focus-ring-2 focus-ring-primary-50" href="${0}"> <foxy-i18n infer="subscription" key="caption"></foxy-i18n> </a> `),d(n))}__renderReceiptAction(){var e,t;const i=this.nucleon;return s(B||(B=R` <a target="_blank" class="rounded text-m font-medium text-primary cursor-pointer transition-opacity hover-opacity-80 focus-outline-none focus-ring-2 focus-ring-primary-50" href="${0}"> <foxy-i18n infer="receipt" key="caption"></foxy-i18n> </a> `),d(null===(t=null===(e=null==i?void 0:i.data)||void 0===e?void 0:e._links["fx:receipt"])||void 0===t?void 0:t.href))}});let Z,I,M,q,G,T,U,W,z,D,V,J=e=>e;customElements.define("foxy-internal-transaction-summary-control",class extends e{constructor(){super(...arguments),this.__storeLoaderId="storeLoader"}renderControl(){var e,t,i,o,r,n,a,l,c;const u=null===(e=this.nucleon)||void 0===e?void 0:e.data;if(!u)return s(Z||(Z=J``));const f=null!==(i=null===(t=null==u?void 0:u._embedded)||void 0===t?void 0:t["fx:applied_taxes"])&&void 0!==i?i:[],h=null!==(r=null===(o=u._embedded)||void 0===o?void 0:o["fx:shipments"])&&void 0!==r?r:[];return s(I||(I=J` <foxy-nucleon infer="" href="${0}" id="${0}" @update="${0}"> </foxy-nucleon> <p class="grid gap-x-s text-right text-s leading-m border-dashed border rounded border-contrast-20 whitespace-nowrap overflow-auto" style="padding:calc(.625em + (var(--lumo-border-radius)/ 4) - 2px);grid-template-columns:1fr min-content"> <span><foxy-i18n key="subtotal" infer=""></foxy-i18n>&colon;</span> <span>${0}</span> ${0} ${0} ${0} ${0} <span class="col-span-2 border-t border-dashed border-contrast-20 my-s"></span> <span class="col-span-2 flex gap-s justify-between items-center"> ${0} <span class="text-xl font-medium leading-xs"> <foxy-i18n infer="" key="total"></foxy-i18n>&colon; ${0} </span> </span> </p> `),d(this.__storeHref),this.__storeLoaderId,(()=>this.requestUpdate()),this.__renderPrice(u.total_item_price),0===h.length||0===u.total_shipping?s(M||(M=J` <span><foxy-i18n infer="" key="total_shipping"></foxy-i18n>&colon;</span> <span>${0} </span> `),this.__renderPrice(u.total_shipping,!0)):h.map((e=>s(q||(q=J` <span>${0}&colon;</span> <span>${0}</span> `),e.shipping_service_description,this.__renderPrice(e.total_shipping,!0)))),0===f.length||0===u.total_tax?s(G||(G=J` <span><foxy-i18n infer="" key="total_tax"></foxy-i18n>&colon;</span> <span>${0}</span> `),this.__renderPrice(u.total_tax,!0)):f.map((e=>s(T||(T=J` <span>${0}&colon;</span> <span>${0}</span> `),e.name,this.__renderPrice(e.amount,!0)))),null===(a=null===(n=null==u?void 0:u._embedded)||void 0===n?void 0:n["fx:gift_card_code_logs"])||void 0===a?void 0:a.map((e=>{var t,i,o,r,n;const a=null===(i=null===(t=e._embedded)||void 0===t?void 0:t["fx:gift_card"])||void 0===i?void 0:i.name,d=null===(r=null===(o=e._embedded)||void 0===o?void 0:o["fx:gift_card_code"])||void 0===r?void 0:r.code;if(a&&d)return s(U||(U=J` <span data-testclass="gift-card-code">${0} &bull; ${0}&colon;</span> <span>${0}</span> `),a,d,this.__renderPrice(null!==(n=e.balance_adjustment)&&void 0!==n?n:0,!0))})),null===(c=null===(l=null==u?void 0:u._embedded)||void 0===l?void 0:l["fx:discounts"])||void 0===c?void 0:c.map((({name:e,code:t,amount:i})=>s(W||(W=J` <span data-testclass="discount">${0}${0}&colon;</span> <span>${0}</span> `),e,t?s(z||(z=J` &bull; ${0}`),t):"",this.__renderPrice(i,!0)))),this.__renderStatus(),this.__renderPrice(u.total_order))}get __storeHref(){var e,t,i;return null===(i=null===(t=null===(e=this.nucleon)||void 0===e?void 0:e.data)||void 0===t?void 0:t._links["fx:store"])||void 0===i?void 0:i.href}get __store(){var e,t;const i=`#${this.__storeLoaderId}`;return null!==(t=null===(e=this.renderRoot.querySelector(i))||void 0===e?void 0:e.data)&&void 0!==t?t:null}__renderPrice(e,t=!1){var i,o,r;const n=(null===(i=this.__store)||void 0===i?void 0:i.use_international_currency_symbol)?"code":"symbol",a=null===(r=null===(o=this.nucleon)||void 0===o?void 0:o.data)||void 0===r?void 0:r.currency_code;return s(D||(D=J` <foxy-i18n class="${0}" infer="" key="price" .options="${0}"> </foxy-i18n> `),t&&0!==e?e>0?"text-success":"text-error":"",{currencyDisplay:n,signDisplay:t?"exceptZero":"auto",amount:`${e} ${a}`})}__renderStatus(){var e,t;const i=(null===(t=null===(e=this.nucleon)||void 0===e?void 0:e.data)||void 0===t?void 0:t.status)||"completed";let o="";return o=["capturing","captured","approved","authorized","pending"].includes(i)?"text-success bg-success-10":i&&"completed"!==i?["problem","pending_fraud_review","rejected","declined"].includes(i)?"text-error-contrast bg-error":"bg-contrast-5 text-body":"text-success-contrast bg-success",s(V||(V=J` <foxy-i18n infer="" class="${0} rounded-s py-xs px-s font-medium text-s leading-xs" key="status_${0}"></foxy-i18n> `),o,i)}});let N,F,K,Q=e=>e;const X=u(f(t,"transaction"));class Y extends X{constructor(){var e;super(...arguments),e=this,this.hostedPaymentGatewaysHelper=null,this.paymentGatewaysHelper=null,this.localeCodes=null,this.getSubscriptionPageHref=null,this.getCustomerPageHref=null,this.__webhooksBulkActions=[{name:"refeed",onClick:async function(t){if(!e.data)return;const i=e.data._links["fx:send_webhooks"].href,o=new Y.API(e),s=await o.fetch(i,{method:"POST",body:JSON.stringify({refeed_hooks:t.map((e=>l(e._links.self.href))),event:"refeed"})});if(t.forEach((e=>{Y.Rumour("").share({related:[...t.map((e=>e._links["fx:logs"].href)),...t.map((e=>e._links["fx:statuses"].href))],source:e._links.self.href,data:e})})),!s.ok)throw new Error(await s.text())}}]}static get properties(){return i(i({},super.properties),{},{hostedPaymentGatewaysHelper:{attribute:"hosted-payment-gateways-helper"},paymentGatewaysHelper:{attribute:"payment-gateways-helper"},getSubscriptionPageHref:{attribute:!1},getCustomerPageHref:{attribute:!1},localeCodes:{attribute:"locale-codes"}})}get readonlySelector(){var e,t,i;const s=["billing-addresses","datafeed:data-is-fed","webhooks:dialog:url",super.readonlySelector];return Boolean(null!==(t=null===(e=this.data)||void 0===e?void 0:e._links["fx:void"])&&void 0!==t?t:null===(i=this.data)||void 0===i?void 0:i._links["fx:refund"])||s.push("items","attributes","custom-fields"),new o(s.join(" ").trim())}get hiddenSelector(){var e,t,i,s;const r=["billing-addresses:dialog:delete","billing-addresses:dialog:timestamps","webhooks:dialog:header:copy-json","webhooks:dialog:header:copy-id","webhooks:dialog:timestamps","webhooks:dialog:name","webhooks:dialog:query","webhooks:dialog:encryption-key","webhooks:dialog:delete",super.readonlySelector],n=null===(e=this.data)||void 0===e?void 0:e.type;return(null===(t=this.data)||void 0===t?void 0:t._links["fx:subscription"])||r.unshift("subscription"),"subscription_modification"===n&&r.unshift("actions"),"updateinfo"===n&&r.unshift("not=customer,subscription,payments,custom-fields,attributes"),"subscription_cancellation"===n&&r.unshift("not=customer,subscription,custom-fields,attributes"),(null===(s=null===(i=this.__storeLoader)||void 0===i?void 0:i.data)||void 0===s?void 0:s.use_webhook)||r.unshift("datafeed"),new o(r.join(" ").trim())}get headerSubtitleOptions(){var e,t,i,o,s;const r=null===(e=this.data)||void 0===e?void 0:e.source,n=null===(t=this.data)||void 0===t?void 0:t.type;let a="";return"updateinfo"===n?a=!r||(null==r?void 0:r.startsWith("cit_"))?"customer_changed_payment_method":"mit_uoe"===r?"admin_changed_payment_method_with_uoe":"mit_api"===r?"integration_changed_payment_method":"admin_changed_payment_method":"subscription_modification"===n?a=!r||(null==r?void 0:r.startsWith("cit_"))?"customer_changed_subscription":"mit_uoe"===r?"admin_changed_subscription_with_uoe":"mit_api"===r?"integration_changed_subscription":"admin_changed_subscription":"subscription_renewal"===n?"mit_recurring"===r?a="subscription_renewal_attempt":"mit_recurring_reattempt_automated"===r?a="subscription_renewal_automated_reattempt":"mit_recurring_reattempt_manual"===r&&(a="subscription_renewal_manual_reattempt"):"subscription_cancellation"===n?"cit_recurring_cancellation"===r?a="customer_canceled_subscription":"mit_recurring_cancellation"===r&&(a="admin_canceled_subscription"):(null===(i=this.data)||void 0===i?void 0:i._links["fx:subscription"])?(null==r?void 0:r.startsWith("cit_"))?a="customer_subscribed":"mit_uoe"===r?a="admin_subscribed_with_uoe":"mit_api"===r&&(a="integration_subscribed"):(null==r?void 0:r.startsWith("cit_"))?a="customer_placed_order":"mit_uoe"===r?a="admin_placed_order_with_uoe":"mit_api"===r&&(a="integration_placed_order"),{transaction_date:null===(o=this.data)||void 0===o?void 0:o.transaction_date,ip_country:null===(s=this.data)||void 0===s?void 0:s.ip_country,context:a}}get headerSubtitleBadges(){var e,t;const i=super.headerSubtitleBadges;return(null===(e=this.data)||void 0===e?void 0:e.is_test)&&i.push({key:"test"}),(null===(t=this.data)||void 0===t?void 0:t.hide_transaction)&&i.push({key:"archived"}),i}get headerCopyIdValue(){var e,t,i;return null!==(i=null===(t=null===(e=this.data)||void 0===e?void 0:e.display_id)||void 0===t?void 0:t.toString())&&void 0!==i?i:""}renderHeaderActions(){return s(N||(N=Q` <foxy-internal-transaction-actions-control infer="actions"> </foxy-internal-transaction-actions-control> `))}renderBody(){var e,t,i,o,r,n,a,l,c,u,f,h,p,m,v,_;let y,x,b;const g=this.hiddenSelector;if(this.data)try{const o=new URL(this.data._links["fx:shipments"].href),s=new URL(null!==(i=null===(t=null===(e=this.__storeLoader)||void 0===e?void 0:e.data)||void 0===t?void 0:t._links["fx:webhooks"].href)&&void 0!==i?i:""),r=new URL(this.data._links["fx:items"].href);o.searchParams.set("zoom","items:item_category"),s.searchParams.set("event_resource","transaction"),r.searchParams.set("zoom","item_options"),y=o.toString(),x=s.toString(),b=r.toString()}catch(e){}return s(F||(F=Q` ${0} ${0} <foxy-internal-transaction-customer-control infer="customer"> </foxy-internal-transaction-customer-control> <div class="grid gap-s" ?hidden="${0}"> <foxy-internal-async-list-control infer="items" class="min-w-0" first="${0}" limit="10" item="foxy-item-card" form="foxy-item-form" alert wide .related="${0}" .itemProps="${0}" .formProps="${0}"> </foxy-internal-async-list-control> <foxy-internal-transaction-summary-control infer="summary" class="min-w-0"> </foxy-internal-transaction-summary-control> </div> <foxy-internal-async-list-control infer="billing-addresses" first="${0}" item="foxy-billing-address-card" form="foxy-address-form" hide-create-button hide-delete-button alert> </foxy-internal-async-list-control> <foxy-internal-async-list-control infer="payments" first="${0}" item="foxy-payment-card" .itemProps="${0}"> </foxy-internal-async-list-control> <foxy-internal-async-list-control infer="custom-fields" class="min-w-0" first="${0}" limit="5" form="foxy-custom-field-form" item="foxy-custom-field-card" alert> </foxy-internal-async-list-control> <foxy-internal-async-list-control infer="attributes" class="min-w-0" first="${0}" limit="5" form="foxy-attribute-form" item="foxy-attribute-card" alert> </foxy-internal-async-list-control> <foxy-internal-async-list-control infer="shipments" first="${0}" item="foxy-shipment-card"> </foxy-internal-async-list-control> <foxy-internal-async-list-control infer="webhooks" first="${0}" item="foxy-webhook-card" form="foxy-webhook-form" hide-create-button hide-delete-button alert .bulkActions="${0}" .itemProps="${0}" .formProps="${0}"> </foxy-internal-async-list-control> <foxy-internal-summary-control infer="datafeed"> <foxy-internal-switch-control infer="data-is-fed"></foxy-internal-switch-control> <foxy-internal-post-action-control infer="process-webhook" theme="tertiary-inline" href="${0}" @success="${0}"> </foxy-internal-post-action-control> </foxy-internal-summary-control> <foxy-nucleon class="hidden" infer="" href="${0}" id="storeLoader" @update="${0}"> </foxy-nucleon> `),this.renderHeader(),["problem","pending_fraud_review","rejected","declined"].includes(null!==(r=null===(o=this.data)||void 0===o?void 0:o.status)&&void 0!==r?r:"")?s(K||(K=Q` <p class="leading-xs text-body rounded bg-error-10 block" style="padding:calc(.625em + (var(--lumo-border-radius)/ 4) - 1px)"> <foxy-i18n infer="header" key="alert_status_${0}"></foxy-i18n> </p> `),null===(n=this.data)||void 0===n?void 0:n.status):"",g.matches("items",!0)&&g.matches("summary",!0),d(b),[this.href],{"locale-codes":this.localeCodes},{"item-categories":null===(l=null===(a=this.__storeLoader)||void 0===a?void 0:a.data)||void 0===l?void 0:l._links["fx:item_categories"].href,"locale-codes":this.localeCodes,store:null===(c=this.data)||void 0===c?void 0:c._links["fx:store"].href},d(null===(u=this.data)||void 0===u?void 0:u._links["fx:billing_addresses"].href),d(null===(f=this.data)||void 0===f?void 0:f._links["fx:payments"].href),{"hosted-payment-gateways-helper":this.hostedPaymentGatewaysHelper,"payment-gateways-helper":this.paymentGatewaysHelper},d(null===(h=this.data)||void 0===h?void 0:h._links["fx:custom_fields"].href),d(null===(p=this.data)||void 0===p?void 0:p._links["fx:attributes"].href),d(y),d(x),this.__webhooksBulkActions,{"resource-uri":this.href},{"resource-uri":this.href},d(null===(v=null===(m=this.data)||void 0===m?void 0:m._links["fx:process_webhook"])||void 0===v?void 0:v.href),(()=>this.refresh()),d(null===(_=this.data)||void 0===_?void 0:_._links["fx:store"].href),(()=>this.requestUpdate()))}get __storeLoader(){return this.renderRoot.querySelector("#storeLoader")}}customElements.define("foxy-transaction",Y);export{Y as Transaction};
@@ -96,20 +96,15 @@
96
96
  "clear": "Clear"
97
97
  },
98
98
  "charge-past-due": {
99
- "button": {
100
- "idle": "Charge past due amount",
101
- "busy": "Processing..."
102
- },
103
- "notification": {
104
- "success": "Past due amount successfully charged.",
105
- "error": "Failed to charge past due amount."
106
- },
107
- "confirm-dialog": {
108
- "message": "This will attempt to charge the past due amount of {{ amount, price }}. Would you like to proceed?",
109
- "confirm": "Yes",
110
- "cancel": "No",
111
- "header": "Past due payment"
112
- }
99
+ "message_idle": "This will attempt to charge the past due amount of {{ amount, price }}. Would you like to proceed?",
100
+ "message_fail": "Failed to charge the past due amount of {{ amount, price }}. If you'd like to retry, close this dialog and click the charge past due amount button again.",
101
+ "message_done": "The past due amount of {{ amount, price }} has been charged successfully. You can close this dialog now.",
102
+ "button_close": "Close",
103
+ "button_confirm": "Charge now",
104
+ "button_cancel": "Go back",
105
+ "loading_busy": "Processing",
106
+ "header": "Past due payment",
107
+ "button": "Charge past due amount"
113
108
  }
114
109
  },
115
110
  "self-service-links": {
@@ -1162,8 +1157,8 @@
1162
1157
  "is_active_true": "Active",
1163
1158
  "spinner": {
1164
1159
  "loading_busy": "Loading",
1165
- "loading_empty": "No webhooks",
1166
- "loading_error": "Unknown error"
1160
+ "loading_error": "Unknown error",
1161
+ "loading_empty": "No webhooks"
1167
1162
  }
1168
1163
  }
1169
1164
  }
@@ -1178,14 +1173,19 @@
1178
1173
  "unchecked": "Not sent"
1179
1174
  },
1180
1175
  "process-webhook": {
1181
- "idle": "Resend datafeed",
1182
- "busy": "Resending datafeed...",
1183
- "fail": "Failed to resend datafeed",
1184
- "confirm": {
1185
- "header": "Resend datafeed",
1186
- "message": "Are you sure you'd like to resend XML datafeed for this transaction?",
1176
+ "button": {
1177
+ "idle": "Resend datafeed",
1178
+ "busy": "Processing..."
1179
+ },
1180
+ "notification": {
1181
+ "success": "XML datafeed resent successfully",
1182
+ "error": "Failed to resend datafeed"
1183
+ },
1184
+ "confirm-dialog": {
1185
+ "message": "This will attempt to resend the XML datafeed. Would you like to proceed?",
1187
1186
  "confirm": "Yes",
1188
- "cancel": "No"
1187
+ "cancel": "No",
1188
+ "header": "Resend datafeed"
1189
1189
  }
1190
1190
  }
1191
1191
  },
@@ -1983,48 +1983,48 @@
1983
1983
  },
1984
1984
  "actions": {
1985
1985
  "capture": {
1986
- "idle": "Capture",
1987
- "busy": "Capturing...",
1988
- "fail": "Failed to capture",
1989
- "confirm": {
1990
- "header": "Capture",
1991
- "message": "Are you sure you'd like to capture this transaction?",
1992
- "confirm": "Yes",
1993
- "cancel": "No"
1994
- }
1986
+ "message_idle": "This action will attempt to capture this transaction. Would you like to proceed?",
1987
+ "message_fail": "Failed to capture this transaction. If you'd like to retry, close this dialog and click the capture button again.",
1988
+ "message_done": "Transaction was captured successfully. You can close this dialog now.",
1989
+ "button_close": "Close",
1990
+ "button_confirm": "Capture",
1991
+ "button_cancel": "Go back",
1992
+ "loading_busy": "Processing",
1993
+ "header": "Capture",
1994
+ "button": "Capture"
1995
1995
  },
1996
1996
  "void": {
1997
- "idle": "Void",
1998
- "busy": "Voiding...",
1999
- "fail": "Failed to void",
2000
- "confirm": {
2001
- "header": "Void",
2002
- "message": "Are you sure you'd like to void this transaction?",
2003
- "confirm": "Yes",
2004
- "cancel": "No"
2005
- }
1997
+ "message_idle": "This action will attempt to void this transaction. Would you like to proceed?",
1998
+ "message_fail": "Failed to void this transaction. If you'd like to retry, close this dialog and click the void button again.",
1999
+ "message_done": "Transaction was voided successfully. You can close this dialog now.",
2000
+ "button_close": "Close",
2001
+ "button_confirm": "Void",
2002
+ "button_cancel": "Go back",
2003
+ "loading_busy": "Processing",
2004
+ "header": "Void",
2005
+ "button": "Void"
2006
2006
  },
2007
2007
  "refund": {
2008
- "idle": "Refund",
2009
- "busy": "Refunding...",
2010
- "fail": "Failed to refund",
2011
- "confirm": {
2012
- "header": "Refund",
2013
- "message": "Are you sure you'd like to refund this transaction?",
2014
- "confirm": "Yes",
2015
- "cancel": "No"
2016
- }
2008
+ "message_idle": "This action will attempt to refund the full amount of this transaction. Would you like to proceed?",
2009
+ "message_fail": "Failed to refund this transaction. If you'd like to retry, close this dialog and click the refund button again.",
2010
+ "message_done": "Transaction was refunded successfully. You can close this dialog now.",
2011
+ "button_close": "Close",
2012
+ "button_confirm": "Refund",
2013
+ "button_cancel": "Go back",
2014
+ "loading_busy": "Processing",
2015
+ "header": "Refund",
2016
+ "button": "Refund"
2017
2017
  },
2018
2018
  "send-emails": {
2019
- "idle": "Resend emails",
2020
- "busy": "Resending emails...",
2021
- "fail": "Failed to resend emails",
2022
- "confirm": {
2023
- "header": "Send emails",
2024
- "message": "Are you sure you'd like to send emails for this transaction?",
2025
- "confirm": "Yes",
2026
- "cancel": "No"
2027
- }
2019
+ "message_idle": "This action will attempt to resend emails for this transaction. Would you like to proceed?",
2020
+ "message_fail": "Failed to resend emails for this transaction. If you'd like to retry, close this dialog and click the resend emails button again.",
2021
+ "message_done": "Emails for this transaction were resent successfully. You can close this dialog now.",
2022
+ "button_close": "Close",
2023
+ "button_confirm": "Resend emails",
2024
+ "button_cancel": "Go back",
2025
+ "loading_busy": "Processing",
2026
+ "header": "Resend emails",
2027
+ "button": "Resend emails"
2028
2028
  },
2029
2029
  "subscription": {
2030
2030
  "caption": "Go to subscription"
@@ -1679,68 +1679,48 @@
1679
1679
  },
1680
1680
  "actions": {
1681
1681
  "capture": {
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?",
1692
- "confirm": "Yes",
1693
- "cancel": "No",
1694
- "header": "Capture"
1695
- }
1682
+ "message_idle": "This action will attempt to capture this transaction. Would you like to proceed?",
1683
+ "message_fail": "Failed to capture this transaction. If you'd like to retry, close this dialog and click the capture button again.",
1684
+ "message_done": "Transaction was captured successfully. You can close this dialog now.",
1685
+ "button_close": "Close",
1686
+ "button_confirm": "Capture",
1687
+ "button_cancel": "Go back",
1688
+ "loading_busy": "Processing",
1689
+ "header": "Capture",
1690
+ "button": "Capture"
1696
1691
  },
1697
1692
  "void": {
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?",
1708
- "confirm": "Yes",
1709
- "cancel": "No",
1710
- "header": "Void"
1711
- }
1693
+ "message_idle": "This action will attempt to void this transaction. Would you like to proceed?",
1694
+ "message_fail": "Failed to void this transaction. If you'd like to retry, close this dialog and click the void button again.",
1695
+ "message_done": "Transaction was voided successfully. You can close this dialog now.",
1696
+ "button_close": "Close",
1697
+ "button_confirm": "Void",
1698
+ "button_cancel": "Go back",
1699
+ "loading_busy": "Processing",
1700
+ "header": "Void",
1701
+ "button": "Void"
1712
1702
  },
1713
1703
  "refund": {
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?",
1724
- "confirm": "Yes",
1725
- "cancel": "No",
1726
- "header": "Refund"
1727
- }
1704
+ "message_idle": "This action will attempt to refund the full amount of this transaction. Would you like to proceed?",
1705
+ "message_fail": "Failed to refund this transaction. If you'd like to retry, close this dialog and click the refund button again.",
1706
+ "message_done": "Transaction was refunded successfully. You can close this dialog now.",
1707
+ "button_close": "Close",
1708
+ "button_confirm": "Refund",
1709
+ "button_cancel": "Go back",
1710
+ "loading_busy": "Processing",
1711
+ "header": "Refund",
1712
+ "button": "Refund"
1728
1713
  },
1729
1714
  "send-emails": {
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?",
1740
- "confirm": "Yes",
1741
- "cancel": "No",
1742
- "header": "Resend emails"
1743
- }
1715
+ "message_idle": "This action will attempt to resend emails for this transaction. Would you like to proceed?",
1716
+ "message_fail": "Failed to resend emails for this transaction. If you'd like to retry, close this dialog and click the resend emails button again.",
1717
+ "message_done": "Emails for this transaction were resent successfully. You can close this dialog now.",
1718
+ "button_close": "Close",
1719
+ "button_confirm": "Resend emails",
1720
+ "button_cancel": "Go back",
1721
+ "loading_busy": "Processing",
1722
+ "header": "Resend emails",
1723
+ "button": "Resend emails"
1744
1724
  },
1745
1725
  "subscription": {
1746
1726
  "caption": "Go to subscription"
@@ -5,9 +5,5 @@ export declare class InternalPostActionControl extends InternalControl {
5
5
  messageOptions: Record<string, string>;
6
6
  theme: string | null;
7
7
  href: string | null;
8
- private __buttonState;
9
- private readonly __api;
10
8
  renderControl(): TemplateResult;
11
- private __sendPost;
12
- private __getNotificationRenderer;
13
9
  }
@@ -1,15 +1,12 @@
1
1
  import { InternalControl } from "../InternalControl/InternalControl.js";
2
- import { html, render } from 'lit-html';
3
2
  import { ifDefined } from 'lit-html/directives/if-defined';
4
- import { API } from "../../public/NucleonElement/API.js";
3
+ import { html } from 'lit-html';
5
4
  export class InternalPostActionControl extends InternalControl {
6
5
  constructor() {
7
6
  super(...arguments);
8
7
  this.messageOptions = {};
9
8
  this.theme = null;
10
9
  this.href = null;
11
- this.__buttonState = 'idle';
12
- this.__api = new API(this);
13
10
  }
14
11
  static get properties() {
15
12
  return {
@@ -17,82 +14,34 @@ export class InternalPostActionControl extends InternalControl {
17
14
  messageOptions: { type: Object, attribute: 'message-options' },
18
15
  theme: {},
19
16
  href: {},
20
- __buttonState: {},
21
17
  };
22
18
  }
23
19
  renderControl() {
24
- var _a;
20
+ var _a, _b;
25
21
  return html `
26
- <foxy-internal-confirm-dialog
27
- header="header"
28
- infer="confirm-dialog"
29
- id="confirm-dialog"
30
- .messageOptions=${this.messageOptions}
22
+ <foxy-internal-post-action-control-dialog
23
+ message-options=${JSON.stringify(this.messageOptions)}
24
+ infer=""
25
+ href=${ifDefined((_a = this.href) !== null && _a !== void 0 ? _a : void 0)}
31
26
  @hide=${(evt) => {
32
27
  if (!evt.detail.cancelled)
33
- this.__sendPost();
28
+ this.dispatchEvent(new CustomEvent('success'));
34
29
  }}
35
30
  >
36
- </foxy-internal-confirm-dialog>
37
-
38
- <vaadin-notification
39
- position="bottom-end"
40
- duration="3000"
41
- theme="success"
42
- id="success-notification"
43
- .renderer=${this.__getNotificationRenderer('success')}
44
- >
45
- </vaadin-notification>
46
-
47
- <vaadin-notification
48
- position="bottom-end"
49
- duration="3000"
50
- theme="error"
51
- id="error-notification"
52
- .renderer=${this.__getNotificationRenderer('error')}
53
- >
54
- </vaadin-notification>
31
+ </foxy-internal-post-action-control-dialog>
55
32
 
56
33
  <vaadin-button
57
- theme=${ifDefined((_a = this.theme) !== null && _a !== void 0 ? _a : void 0)}
58
- ?disabled=${this.disabled || this.readonly || this.__buttonState !== 'idle'}
34
+ theme=${ifDefined((_b = this.theme) !== null && _b !== void 0 ? _b : void 0)}
35
+ ?disabled=${this.disabled || this.readonly}
59
36
  @click=${(evt) => {
60
37
  const button = evt.currentTarget;
61
- const dialog = this.renderRoot.querySelector('#confirm-dialog');
38
+ const dialog = this.renderRoot.querySelector('foxy-internal-post-action-control-dialog');
62
39
  dialog === null || dialog === void 0 ? void 0 : dialog.show(button);
63
40
  }}
64
41
  >
65
- <foxy-i18n infer="button" key=${this.__buttonState}></foxy-i18n>
42
+ <foxy-i18n infer="" key="button"></foxy-i18n>
66
43
  </vaadin-button>
67
44
  `;
68
45
  }
69
- async __sendPost() {
70
- if (this.href && this.__buttonState === 'idle') {
71
- this.__buttonState = 'busy';
72
- const response = await this.__api.fetch(this.href, { method: 'POST' });
73
- const result = response.ok ? 'success' : 'error';
74
- const selector = `#${result}-notification`;
75
- const notification = this.renderRoot.querySelector(selector);
76
- notification === null || notification === void 0 ? void 0 : notification.open();
77
- this.__buttonState = 'idle';
78
- this.dispatchEvent(new CustomEvent(result));
79
- }
80
- }
81
- __getNotificationRenderer(state) {
82
- return (root) => {
83
- if (!root.firstElementChild)
84
- root.innerHTML = '<span></span>';
85
- const layout = html `
86
- <foxy-i18n
87
- style="color: var(--lumo-${state}-contrast-color)"
88
- lang=${this.lang}
89
- key=${state}
90
- ns="${this.ns} notification"
91
- >
92
- </foxy-i18n>
93
- `;
94
- render(layout, root.firstElementChild);
95
- };
96
- }
97
46
  }
98
47
  //# sourceMappingURL=InternalPostActionControl.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"InternalPostActionControl.js","sourceRoot":"","sources":["../../../../src/elements/internal/InternalPostActionControl/InternalPostActionControl.ts"],"names":[],"mappings":"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","sourcesContent":["import type { PropertyDeclarations, TemplateResult } from 'lit-element';\nimport type { InternalConfirmDialog } from '../InternalConfirmDialog/InternalConfirmDialog';\nimport type { NotificationElement } from '@vaadin/vaadin-notification';\nimport type { DialogHideEvent } from '../../private/Dialog/DialogHideEvent';\nimport type { ButtonElement } from '@vaadin/vaadin-button';\n\nimport { InternalControl } from '../InternalControl/InternalControl';\nimport { html, render } from 'lit-html';\nimport { ifDefined } from 'lit-html/directives/if-defined';\nimport { API } from '../../public/NucleonElement/API';\n\nexport class InternalPostActionControl extends InternalControl {\n static get properties(): PropertyDeclarations {\n return {\n ...super.properties,\n messageOptions: { type: Object, attribute: 'message-options' },\n theme: {},\n href: {},\n __buttonState: {},\n };\n }\n\n messageOptions: Record<string, string> = {};\n\n theme: string | null = null;\n\n href: string | null = null;\n\n private __buttonState: 'idle' | 'busy' = 'idle';\n\n private readonly __api = new API(this);\n\n renderControl(): TemplateResult {\n return html`\n <foxy-internal-confirm-dialog\n header=\"header\"\n infer=\"confirm-dialog\"\n id=\"confirm-dialog\"\n .messageOptions=${this.messageOptions}\n @hide=${(evt: DialogHideEvent) => {\n if (!evt.detail.cancelled) this.__sendPost();\n }}\n >\n </foxy-internal-confirm-dialog>\n\n <vaadin-notification\n position=\"bottom-end\"\n duration=\"3000\"\n theme=\"success\"\n id=\"success-notification\"\n .renderer=${this.__getNotificationRenderer('success')}\n >\n </vaadin-notification>\n\n <vaadin-notification\n position=\"bottom-end\"\n duration=\"3000\"\n theme=\"error\"\n id=\"error-notification\"\n .renderer=${this.__getNotificationRenderer('error')}\n >\n </vaadin-notification>\n\n <vaadin-button\n theme=${ifDefined(this.theme ?? void 0)}\n ?disabled=${this.disabled || this.readonly || this.__buttonState !== 'idle'}\n @click=${(evt: CustomEvent) => {\n const button = evt.currentTarget as ButtonElement;\n const dialog = this.renderRoot.querySelector<InternalConfirmDialog>('#confirm-dialog');\n dialog?.show(button);\n }}\n >\n <foxy-i18n infer=\"button\" key=${this.__buttonState}></foxy-i18n>\n </vaadin-button>\n `;\n }\n\n private async __sendPost() {\n if (this.href && this.__buttonState === 'idle') {\n this.__buttonState = 'busy';\n\n const response = await this.__api.fetch(this.href, { method: 'POST' });\n const result = response.ok ? 'success' : 'error';\n const selector = `#${result}-notification`;\n const notification = this.renderRoot.querySelector<NotificationElement>(selector);\n\n notification?.open();\n this.__buttonState = 'idle';\n this.dispatchEvent(new CustomEvent(result));\n }\n }\n\n private __getNotificationRenderer(state: 'success' | 'error') {\n return (root: HTMLElement) => {\n if (!root.firstElementChild) root.innerHTML = '<span></span>';\n\n const layout = html`\n <foxy-i18n\n style=\"color: var(--lumo-${state}-contrast-color)\"\n lang=${this.lang}\n key=${state}\n ns=\"${this.ns} notification\"\n >\n </foxy-i18n>\n `;\n\n render(layout, root.firstElementChild!);\n };\n }\n}\n"]}
1
+ {"version":3,"file":"InternalPostActionControl.js","sourceRoot":"","sources":["../../../../src/elements/internal/InternalPostActionControl/InternalPostActionControl.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,eAAe,EAAE,8CAA2C;AACrE,OAAO,EAAE,SAAS,EAAE,MAAM,gCAAgC,CAAC;AAC3D,OAAO,EAAE,IAAI,EAAE,MAAM,UAAU,CAAC;AAEhC,MAAM,OAAO,yBAA0B,SAAQ,eAAe;IAA9D;;QAUE,mBAAc,GAA2B,EAAE,CAAC;QAE5C,UAAK,GAAkB,IAAI,CAAC;QAE5B,SAAI,GAAkB,IAAI,CAAC;IA8B7B,CAAC;IA3CC,MAAM,KAAK,UAAU;QACnB,OAAO;YACL,GAAG,KAAK,CAAC,UAAU;YACnB,cAAc,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE,SAAS,EAAE,iBAAiB,EAAE;YAC9D,KAAK,EAAE,EAAE;YACT,IAAI,EAAE,EAAE;SACT,CAAC;IACJ,CAAC;IAQD,aAAa;;QACX,OAAO,IAAI,CAAA;;0BAEW,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,cAAc,CAAC;;eAE9C,SAAS,OAAC,IAAI,CAAC,IAAI,mCAAI,KAAK,CAAC,CAAC;gBAC7B,CAAC,GAAoB,EAAE,EAAE;YAC/B,IAAI,CAAC,GAAG,CAAC,MAAM,CAAC,SAAS;gBAAE,IAAI,CAAC,aAAa,CAAC,IAAI,WAAW,CAAC,SAAS,CAAC,CAAC,CAAC;QAC5E,CAAC;;;;;gBAKO,SAAS,OAAC,IAAI,CAAC,KAAK,mCAAI,KAAK,CAAC,CAAC;oBAC3B,IAAI,CAAC,QAAQ,IAAI,IAAI,CAAC,QAAQ;iBACjC,CAAC,GAAgB,EAAE,EAAE;YAC5B,MAAM,MAAM,GAAG,GAAG,CAAC,aAA8B,CAAC;YAClD,MAAM,MAAM,GAAG,IAAI,CAAC,UAAU,CAAC,aAAa,CAC1C,0CAA0C,CAC3C,CAAC;YAEF,MAAM,aAAN,MAAM,uBAAN,MAAM,CAAE,IAAI,CAAC,MAAM,EAAE;QACvB,CAAC;;;;KAIJ,CAAC;IACJ,CAAC;CACF","sourcesContent":["import type { PropertyDeclarations, TemplateResult } from 'lit-element';\nimport type { InternalConfirmDialog } from '../InternalConfirmDialog/InternalConfirmDialog';\nimport type { DialogHideEvent } from '../../private/Dialog/DialogHideEvent';\nimport type { ButtonElement } from '@vaadin/vaadin-button';\n\nimport { InternalControl } from '../InternalControl/InternalControl';\nimport { ifDefined } from 'lit-html/directives/if-defined';\nimport { html } from 'lit-html';\n\nexport class InternalPostActionControl extends InternalControl {\n static get properties(): PropertyDeclarations {\n return {\n ...super.properties,\n messageOptions: { type: Object, attribute: 'message-options' },\n theme: {},\n href: {},\n };\n }\n\n messageOptions: Record<string, string> = {};\n\n theme: string | null = null;\n\n href: string | null = null;\n\n renderControl(): TemplateResult {\n return html`\n <foxy-internal-post-action-control-dialog\n message-options=${JSON.stringify(this.messageOptions)}\n infer=\"\"\n href=${ifDefined(this.href ?? void 0)}\n @hide=${(evt: DialogHideEvent) => {\n if (!evt.detail.cancelled) this.dispatchEvent(new CustomEvent('success'));\n }}\n >\n </foxy-internal-post-action-control-dialog>\n\n <vaadin-button\n theme=${ifDefined(this.theme ?? void 0)}\n ?disabled=${this.disabled || this.readonly}\n @click=${(evt: CustomEvent) => {\n const button = evt.currentTarget as ButtonElement;\n const dialog = this.renderRoot.querySelector<InternalConfirmDialog>(\n 'foxy-internal-post-action-control-dialog'\n );\n\n dialog?.show(button);\n }}\n >\n <foxy-i18n infer=\"\" key=\"button\"></foxy-i18n>\n </vaadin-button>\n `;\n }\n}\n"]}
@@ -0,0 +1,16 @@
1
+ import { PropertyDeclarations, TemplateResult } from 'lit-element';
2
+ import { BooleanSelector } from '@foxy.io/sdk/core';
3
+ import { Dialog } from '../../private/Dialog/Dialog';
4
+ export declare class InternalPostActionControlDialog extends Dialog {
5
+ static get properties(): PropertyDeclarations;
6
+ messageOptions: Record<string, string>;
7
+ closable: boolean;
8
+ header: string;
9
+ alert: boolean;
10
+ href: string | null;
11
+ private readonly __api;
12
+ private __state;
13
+ get hiddenSelector(): BooleanSelector;
14
+ render(): TemplateResult;
15
+ hide(): Promise<void>;
16
+ }
@@ -0,0 +1,95 @@
1
+ import { html, svg } from 'lit-element';
2
+ import { BooleanSelector } from '@foxy.io/sdk/core';
3
+ import { Dialog } from "../../private/Dialog/Dialog.js";
4
+ import { API } from "../../public/NucleonElement/API.js";
5
+ export class InternalPostActionControlDialog extends Dialog {
6
+ constructor() {
7
+ super(...arguments);
8
+ this.messageOptions = {};
9
+ this.closable = true;
10
+ this.header = 'header';
11
+ this.alert = true;
12
+ this.href = null;
13
+ this.__api = new API(this);
14
+ this.__state = 'idle';
15
+ }
16
+ static get properties() {
17
+ return {
18
+ ...super.properties,
19
+ messageOptions: { type: Object, attribute: 'message-options' },
20
+ href: {},
21
+ __state: { attribute: false },
22
+ };
23
+ }
24
+ get hiddenSelector() {
25
+ const alwaysMatch = ['close-button', super.hiddenSelector.toString()];
26
+ return new BooleanSelector(alwaysMatch.join(' ').trim());
27
+ }
28
+ render() {
29
+ return super.render(() => html `
30
+ <div class="relative">
31
+ <div class="mb-m mt-xs flex justify-center">
32
+ ${this.__state === 'done'
33
+ ? svg `<svg class="text-success" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor" style="width: 2rem; height: 2rem;"><path stroke-linecap="round" stroke-linejoin="round" d="M9 12.75 11.25 15 15 9.75M21 12a9 9 0 1 1-18 0 9 9 0 0 1 18 0Z" /></svg>`
34
+ : this.__state === 'fail'
35
+ ? svg `<svg class="text-error" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor" style="width: 2rem; height: 2rem;"><path stroke-linecap="round" stroke-linejoin="round" d="M12 9v3.75m9-.75a9 9 0 1 1-18 0 9 9 0 0 1 18 0Zm-9 3.75h.008v.008H12v-.008Z" /></svg>`
36
+ : svg `<svg class="text-primary" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor" style="width: 2rem; height: 2rem;"><path stroke-linecap="round" stroke-linejoin="round" d="M9.879 7.519c1.171-1.025 3.071-1.025 4.242 0 1.172 1.025 1.172 2.687 0 3.712-.203.179-.43.326-.67.442-.745.361-1.45.999-1.45 1.827v.75M21 12a9 9 0 1 1-18 0 9 9 0 0 1 18 0Zm-9 5.25h.008v.008H12v-.008Z" /></svg>`}
37
+ </div>
38
+
39
+ <foxy-i18n
40
+ class="block font-lumo text-m text-body text-center mb-l"
41
+ infer=""
42
+ key="message_${this.__state === 'busy' ? 'idle' : this.__state}"
43
+ .options=${this.messageOptions}
44
+ >
45
+ </foxy-i18n>
46
+
47
+ <div class="grid grid-cols-2 gap-m">
48
+ ${this.__state === 'done' || this.__state === 'fail'
49
+ ? html `
50
+ <vaadin-button class="col-span-2" theme="contrast" @click=${() => this.hide()}>
51
+ <foxy-i18n infer="" key="button_close"></foxy-i18n>
52
+ </vaadin-button>
53
+ `
54
+ : html `
55
+ <vaadin-button
56
+ ?disabled=${this.disabled || this.readonly}
57
+ @click=${() => this.hide()}
58
+ >
59
+ <foxy-i18n infer="" key="button_cancel"></foxy-i18n>
60
+ </vaadin-button>
61
+
62
+ <vaadin-button
63
+ theme="primary"
64
+ ?disabled=${this.disabled || this.readonly}
65
+ @click=${async () => {
66
+ if (this.href && this.__state === 'idle') {
67
+ this.__state = 'busy';
68
+ this.closable = false;
69
+ const response = await this.__api.fetch(this.href, { method: 'POST' });
70
+ this.__state = response.ok ? 'done' : 'fail';
71
+ this.closable = true;
72
+ }
73
+ }}
74
+ >
75
+ <foxy-i18n infer="" key="button_confirm"></foxy-i18n>
76
+ </vaadin-button>
77
+ `}
78
+ </div>
79
+
80
+ ${this.__state === 'busy'
81
+ ? html `
82
+ <div class="bg-base absolute inset-0 flex items-center justify-center">
83
+ <foxy-spinner layout="vertical" infer=""></foxy-spinner>
84
+ </div>
85
+ `
86
+ : ''}
87
+ </div>
88
+ `);
89
+ }
90
+ async hide() {
91
+ await super.hide(this.__state !== 'done');
92
+ this.__state = 'idle';
93
+ }
94
+ }
95
+ //# sourceMappingURL=InternalPostActionControlDialog.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"InternalPostActionControlDialog.js","sourceRoot":"","sources":["../../../../src/elements/internal/InternalPostActionControl/InternalPostActionControlDialog.ts"],"names":[],"mappings":"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","sourcesContent":["import { PropertyDeclarations, TemplateResult, html, svg } from 'lit-element';\n\nimport { BooleanSelector } from '@foxy.io/sdk/core';\nimport { Dialog } from '../../private/Dialog/Dialog';\nimport { API } from '../../public/NucleonElement/API';\n\nexport class InternalPostActionControlDialog extends Dialog {\n static get properties(): PropertyDeclarations {\n return {\n ...super.properties,\n messageOptions: { type: Object, attribute: 'message-options' },\n href: {},\n __state: { attribute: false },\n };\n }\n\n messageOptions: Record<string, string> = {};\n\n closable = true;\n\n header = 'header';\n\n alert = true;\n\n href: string | null = null;\n\n private readonly __api = new API(this);\n\n private __state: 'idle' | 'busy' | 'done' | 'fail' = 'idle';\n\n get hiddenSelector(): BooleanSelector {\n const alwaysMatch = ['close-button', super.hiddenSelector.toString()];\n return new BooleanSelector(alwaysMatch.join(' ').trim());\n }\n\n render(): TemplateResult {\n return super.render(\n () => html`\n <div class=\"relative\">\n <div class=\"mb-m mt-xs flex justify-center\">\n ${this.__state === 'done'\n ? svg`<svg class=\"text-success\" xmlns=\"http://www.w3.org/2000/svg\" fill=\"none\" viewBox=\"0 0 24 24\" stroke-width=\"1.5\" stroke=\"currentColor\" style=\"width: 2rem; height: 2rem;\"><path stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 12.75 11.25 15 15 9.75M21 12a9 9 0 1 1-18 0 9 9 0 0 1 18 0Z\" /></svg>`\n : this.__state === 'fail'\n ? svg`<svg class=\"text-error\" xmlns=\"http://www.w3.org/2000/svg\" fill=\"none\" viewBox=\"0 0 24 24\" stroke-width=\"1.5\" stroke=\"currentColor\" style=\"width: 2rem; height: 2rem;\"><path stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M12 9v3.75m9-.75a9 9 0 1 1-18 0 9 9 0 0 1 18 0Zm-9 3.75h.008v.008H12v-.008Z\" /></svg>`\n : svg`<svg class=\"text-primary\" xmlns=\"http://www.w3.org/2000/svg\" fill=\"none\" viewBox=\"0 0 24 24\" stroke-width=\"1.5\" stroke=\"currentColor\" style=\"width: 2rem; height: 2rem;\"><path stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9.879 7.519c1.171-1.025 3.071-1.025 4.242 0 1.172 1.025 1.172 2.687 0 3.712-.203.179-.43.326-.67.442-.745.361-1.45.999-1.45 1.827v.75M21 12a9 9 0 1 1-18 0 9 9 0 0 1 18 0Zm-9 5.25h.008v.008H12v-.008Z\" /></svg>`}\n </div>\n\n <foxy-i18n\n class=\"block font-lumo text-m text-body text-center mb-l\"\n infer=\"\"\n key=\"message_${this.__state === 'busy' ? 'idle' : this.__state}\"\n .options=${this.messageOptions}\n >\n </foxy-i18n>\n\n <div class=\"grid grid-cols-2 gap-m\">\n ${this.__state === 'done' || this.__state === 'fail'\n ? html`\n <vaadin-button class=\"col-span-2\" theme=\"contrast\" @click=${() => this.hide()}>\n <foxy-i18n infer=\"\" key=\"button_close\"></foxy-i18n>\n </vaadin-button>\n `\n : html`\n <vaadin-button\n ?disabled=${this.disabled || this.readonly}\n @click=${() => this.hide()}\n >\n <foxy-i18n infer=\"\" key=\"button_cancel\"></foxy-i18n>\n </vaadin-button>\n\n <vaadin-button\n theme=\"primary\"\n ?disabled=${this.disabled || this.readonly}\n @click=${async () => {\n if (this.href && this.__state === 'idle') {\n this.__state = 'busy';\n this.closable = false;\n const response = await this.__api.fetch(this.href, { method: 'POST' });\n this.__state = response.ok ? 'done' : 'fail';\n this.closable = true;\n }\n }}\n >\n <foxy-i18n infer=\"\" key=\"button_confirm\"></foxy-i18n>\n </vaadin-button>\n `}\n </div>\n\n ${this.__state === 'busy'\n ? html`\n <div class=\"bg-base absolute inset-0 flex items-center justify-center\">\n <foxy-spinner layout=\"vertical\" infer=\"\"></foxy-spinner>\n </div>\n `\n : ''}\n </div>\n `\n );\n }\n\n async hide(): Promise<void> {\n await super.hide(this.__state !== 'done');\n this.__state = 'idle';\n }\n}\n"]}
@@ -1,7 +1,6 @@
1
- import '@vaadin/vaadin-notification';
2
1
  import '@vaadin/vaadin-button';
3
- import '../InternalConfirmDialog/index';
4
2
  import '../InternalControl/index';
3
+ import '../../public/Spinner/index';
5
4
  import '../../public/I18n/index';
6
5
  import { InternalPostActionControl } from './InternalPostActionControl';
7
6
  export { InternalPostActionControl };
@@ -1,9 +1,10 @@
1
- import '@vaadin/vaadin-notification';
2
1
  import '@vaadin/vaadin-button';
3
- import "../InternalConfirmDialog/index.js";
4
2
  import "../InternalControl/index.js";
3
+ import "../../public/Spinner/index.js";
5
4
  import "../../public/I18n/index.js";
5
+ import { InternalPostActionControlDialog } from "./InternalPostActionControlDialog.js";
6
6
  import { InternalPostActionControl } from "./InternalPostActionControl.js";
7
7
  customElements.define('foxy-internal-post-action-control', InternalPostActionControl);
8
+ customElements.define('foxy-internal-post-action-control-dialog', InternalPostActionControlDialog);
8
9
  export { InternalPostActionControl };
9
10
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/elements/internal/InternalPostActionControl/index.ts"],"names":[],"mappings":"AAAA,OAAO,6BAA6B,CAAC;AACrC,OAAO,uBAAuB,CAAC;AAE/B,2CAAwC;AACxC,qCAAkC;AAElC,oCAAiC;AAEjC,OAAO,EAAE,yBAAyB,EAAE,uCAAoC;AAExE,cAAc,CAAC,MAAM,CAAC,mCAAmC,EAAE,yBAAyB,CAAC,CAAC;AAEtF,OAAO,EAAE,yBAAyB,EAAE,CAAC","sourcesContent":["import '@vaadin/vaadin-notification';\nimport '@vaadin/vaadin-button';\n\nimport '../InternalConfirmDialog/index';\nimport '../InternalControl/index';\n\nimport '../../public/I18n/index';\n\nimport { InternalPostActionControl } from './InternalPostActionControl';\n\ncustomElements.define('foxy-internal-post-action-control', InternalPostActionControl);\n\nexport { InternalPostActionControl };\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/elements/internal/InternalPostActionControl/index.ts"],"names":[],"mappings":"AAAA,OAAO,uBAAuB,CAAC;AAE/B,qCAAkC;AAElC,uCAAoC;AACpC,oCAAiC;AAEjC,OAAO,EAAE,+BAA+B,EAAE,6CAA0C;AACpF,OAAO,EAAE,yBAAyB,EAAE,uCAAoC;AAExE,cAAc,CAAC,MAAM,CAAC,mCAAmC,EAAE,yBAAyB,CAAC,CAAC;AACtF,cAAc,CAAC,MAAM,CAAC,0CAA0C,EAAE,+BAA+B,CAAC,CAAC;AAEnG,OAAO,EAAE,yBAAyB,EAAE,CAAC","sourcesContent":["import '@vaadin/vaadin-button';\n\nimport '../InternalControl/index';\n\nimport '../../public/Spinner/index';\nimport '../../public/I18n/index';\n\nimport { InternalPostActionControlDialog } from './InternalPostActionControlDialog';\nimport { InternalPostActionControl } from './InternalPostActionControl';\n\ncustomElements.define('foxy-internal-post-action-control', InternalPostActionControl);\ncustomElements.define('foxy-internal-post-action-control-dialog', InternalPostActionControlDialog);\n\nexport { InternalPostActionControl };\n"]}
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@foxy.io/elements",
3
3
  "type": "module",
4
- "version": "1.41.0-beta.4",
4
+ "version": "1.41.0-beta.5",
5
5
  "description": "E-commerce web components by Foxy.",
6
6
  "repository": {
7
7
  "type": "git",