@foxy.io/elements 1.50.0-beta.1 → 1.50.0-beta.2
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-transaction.js +1 -1
- package/dist/cdn/translations/admin-subscription-form/en.json +4 -2
- package/dist/cdn/translations/coupon-form/en.json +1 -1
- package/dist/cdn/translations/customer/en.json +1 -1
- package/dist/cdn/translations/customer-portal/de.json +1 -1
- package/dist/cdn/translations/customer-portal/en.json +1 -1
- package/dist/cdn/translations/customer-portal/sv.json +1 -1
- package/dist/cdn/translations/subscription-form/en.json +1 -1
- package/dist/cdn/translations/transaction/en.json +4 -2
- package/dist/cdn/translations/transaction-card/en.json +1 -1
- package/dist/elements/public/Transaction/Transaction.js +8 -3
- package/dist/elements/public/Transaction/Transaction.js.map +1 -1
- package/dist/elements/public/Transaction/internal/InternalTransactionActionsControl/InternalTransactionActionsControl.d.ts +2 -0
- package/dist/elements/public/Transaction/internal/InternalTransactionActionsControl/InternalTransactionActionsControl.js +16 -2
- package/dist/elements/public/Transaction/internal/InternalTransactionActionsControl/InternalTransactionActionsControl.js.map +1 -1
- package/dist/elements/public/Transaction/internal/InternalTransactionSummaryControl/InternalTransactionSummaryControl.d.ts +1 -0
- package/dist/elements/public/Transaction/internal/InternalTransactionSummaryControl/InternalTransactionSummaryControl.js +30 -0
- package/dist/elements/public/Transaction/internal/InternalTransactionSummaryControl/InternalTransactionSummaryControl.js.map +1 -1
- package/package.json +1 -1
|
@@ -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-26b55da2.js";import"./shared-be071e3d.js";import{a as e}from"./shared-9a454e09.js";import"./foxy-spinner.js";import{_ as t,B as o}from"./shared-8f9014ff.js";import{h as i,s as r}from"./shared-ba5c42c7.js";import{D as s}from"./shared-67aeac0f.js";import{A as n}from"./shared-69c98b7b.js";import{i as a}from"./shared-53e42a77.js";import"./shared-1fa1abbd.js";import"./shared-591ee1bf.js";import"./shared-bc8a1435.js";import{I as l}from"./shared-084e1772.js";import"./foxy-customer-card.js";import"./foxy-swipe-actions.js";import{g as d}from"./shared-bab2ea2c.js";import{c}from"./shared-4e709717.js";import{R as u,a as f}from"./shared-328aa161.js";import"./shared-04277241.js";import"./shared-de4ec7bb.js";import"./shared-fd8b44e3.js";import"./shared-cd96ff03.js";import"./shared-930e68b7.js";import"./shared-da4f9115.js";import"./shared-9496e995.js";import"./shared-791b4510.js";import"./shared-0e19bda5.js";import"./shared-b0453b08.js";import"./shared-18e301f2.js";import"./shared-8dd6e5cc.js";import"./shared-021fbb51.js";import"./shared-5212ef4f.js";import"./shared-41c9c53f.js";import"./shared-7a5d645f.js";import"./shared-b0db52f7.js";import"./shared-9a291941.js";import"./shared-097487d0.js";import"./shared-0a7a4660.js";import"./shared-5fd5805c.js";import"./shared-8bf38c47.js";import"./shared-0ea24ca2.js";import"./shared-490dadf8.js";import"./shared-1da8110b.js";import"./shared-6880e1f6.js";import"./shared-c84333db.js";import"./shared-cf613436.js";import"./shared-462566b0.js";import"./shared-31e75a4a.js";import"./shared-d48e260f.js";import"./shared-910d49eb.js";import"./shared-ba43928a.js";import"./shared-1301af85.js";import"./shared-ad470adf.js";import"./shared-5fbbaea2.js";import"./shared-3c0e3876.js";import"./shared-a9a8eb7c.js";import"./shared-d0aed1c1.js";import"./foxy-webhook-status-card.js";import"./foxy-webhook-log-card.js";import"./shared-4cc1fb20.js";import"./shared-56a16e03.js";import"./shared-4dc0bd88.js";import"./foxy-form-dialog.js";import"./shared-53e476fd.js";import"./shared-f7965314.js";import"./shared-f9bb0924.js";import"./shared-aa258319.js";import"./shared-d74aac59.js";import"./shared-d01853e2.js";import"./shared-f05c924a.js";import"./shared-fc6e64a4.js";import"./shared-83613f15.js";import"./shared-2061be9a.js";import"./shared-200aa12d.js";import"./shared-e6c743bd.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,w=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 t(t({},super.properties),{},{messageOptions:{type:Object,attribute:"message-options"},theme:{},href:{}})}renderControl(){var e,t;return i(g||(g=w` <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),a(null!==(e=this.href)&&void 0!==e?e:void 0),(e=>{e.detail.cancelled||this.dispatchEvent(new CustomEvent("success"))}),a(null!==(t=this.theme)&&void 0!==t?t:void 0),this.disabled||this.readonly,(e=>{const t=e.currentTarget,o=this.renderRoot.querySelector("foxy-internal-post-action-control-dialog");null==o||o.show(t)}))}}),customElements.define("foxy-internal-post-action-control-dialog",class extends s{constructor(){super(...arguments),this.messageOptions={},this.closable=!0,this.header="header",this.alert=!0,this.href=null,this.__api=new n(this),this.__state="idle"}static get properties(){return t(t({},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((()=>i(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?i(_||(_=b` <vaadin-button class="col-span-2" theme="contrast" @click="${0}"> <foxy-i18n infer="" key="button_close"></foxy-i18n> </vaadin-button> `),(()=>this.hide())):i(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?i(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 $,j,k,S,A=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 t(t({},super.properties),{},{__copyEmailState:{attribute:!1},__copyIdState:{attribute:!1}})}renderControl(){var e,t,o,s;const n=this.nucleon,l=null===(e=null==n?void 0:n.data)||void 0===e?void 0:e._links["fx:customer"].href,u=l?null===(t=null==n?void 0:n.getCustomerPageHref)||void 0===t?void 0:t.call(n,l):void 0;return i($||($=A` <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(l),this.__renderCopyAction(r(j||(j=A`<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",l?String(d(l)):""),this.__renderCopyAction(r(k||(k=A`<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!==(s=null===(o=null==n?void 0:n.data)||void 0===o?void 0:o.customer_email)&&void 0!==s?s:""))}__renderCopyAction(e,t,o,r){const s=this[o],n="fail"===s?"error":"done"===s?"end":"busy";return i(S||(S=A` <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(r,o)),(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 P,C,H,L,E,B,Z,O,R,M,I,q=e=>e;customElements.define("foxy-internal-transaction-actions-control",class extends e{constructor(){super(...arguments),this.folders=null}static get properties(){return t(t({},super.properties),{},{folders:{}})}renderControl(){var e,t,o,r,s,n,a,l,d,c,u,f;return i(P||(P=q` <div class="flex flex-wrap gap-x-m gap-y-xs"> ${0} ${0} ${0} ${0} ${0} ${0} ${0} ${0} </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===(r=null===(o=this.nucleon)||void 0===o?void 0:o.data)||void 0===r?void 0:r._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===(l=null===(a=this.nucleon)||void 0===a?void 0:a.data)||void 0===l?void 0:l._links["fx:send_emails"])?this.__renderSendEmailsAction():"",(null===(c=null===(d=this.nucleon)||void 0===d?void 0:d.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.__renderArchiveAction(),this.folders?this.__renderFolderSelector(this.folders):"")}__renderSendEmailsAction(){var e,t;return i(C||(C=q` <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 i(H||(H=q` <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,o;return i(L||(L=q` <foxy-internal-post-action-control theme="tertiary-inline error" infer="void" href="${0}" @success="${0}"> </foxy-internal-post-action-control> `),a(null===(o=null===(t=null===(e=this.nucleon)||void 0===e?void 0:e.data)||void 0===t?void 0:t._links["fx:void"])||void 0===o?void 0:o.href),(()=>{var e;return null===(e=this.nucleon)||void 0===e?void 0:e.refresh()}))}__renderRefundAction(){var e,t,o;return i(E||(E=q` <foxy-internal-post-action-control infer="refund" theme="tertiary-inline" href="${0}" @success="${0}"> </foxy-internal-post-action-control> `),a(null===(o=null===(t=null===(e=this.nucleon)||void 0===e?void 0:e.data)||void 0===t?void 0:t._links["fx:refund"])||void 0===o?void 0:o.href),(()=>{var e;return null===(e=this.nucleon)||void 0===e?void 0:e.refresh()}))}__renderSubscriptionAction(){var e,t,o;const r=this.nucleon,s=null===(t=null===(e=null==r?void 0:r.data)||void 0===e?void 0:e._links["fx:subscription"])||void 0===t?void 0:t.href,n=s?null===(o=null==r?void 0:r.getSubscriptionPageHref)||void 0===o?void 0:o.call(r,s):void 0;return i(B||(B=q` <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 o=this.nucleon;return i(Z||(Z=q` <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==o?void 0:o.data)||void 0===e?void 0:e._links["fx:receipt"])||void 0===t?void 0:t.href))}__renderArchiveAction(){const e=this.nucleon;return i(O||(O=q` <vaadin-button theme="tertiary-inline" ?disabled="${0}" @click="${0}"> <foxy-i18n infer="archive" key="caption_${0}"> </foxy-i18n> </vaadin-button> `),this.disabledSelector.matches("archive",!0),(()=>{null==e||e.edit({hide_transaction:!(null==e?void 0:e.form.hide_transaction)}),null==e||e.submit()}),(null==e?void 0:e.form.hide_transaction)?"unarchive":"archive")}__renderFolderSelector(e){var t,o,s;const n=this.renderRoot.querySelector("#foldersLoader"),a=Array.from(null!==(s=null===(o=null===(t=null==n?void 0:n.data)||void 0===t?void 0:t._embedded)||void 0===o?void 0:o["fx:transaction_folders"])&&void 0!==s?s:[]),l=this.nucleon;return i(R||(R=q` <foxy-nucleon class="hidden" infer="" href="${0}" id="foldersLoader" @update="${0}"> </foxy-nucleon> <label class="group relative rounded focus-within-ring-2 focus-within-ring-primary-50" ?hidden="${0}"> <span class="inline-flex items-center gap-xs relative transition-opacity group-hover-opacity-80"> <foxy-i18n class="font-medium text-primary" infer="folder" key="caption"></foxy-i18n> ${0} </span> <select class="absolute inset-0 opacity-0 cursor-pointer" ?disabled="${0}" ?readonly="${0}" @change="${0}"> <option value="" ?selected="${0}" ?disabled="${0}"> ${0} </option> ${0} </select> </label> `),e,(()=>this.requestUpdate()),0===a.length,r(M||(M=q`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20" fill="currentColor" class="text-primary transform scale-125" style="width: 1em; height: 1em"><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>`)),this.disabled,this.readonly,(e=>{null==l||l.edit({folder_uri:e.currentTarget.value}),null==l||l.submit(!1)}),!(null==l?void 0:l.form.folder_uri),!(null==l?void 0:l.form.folder_uri),this.t("folder.option_none"),a.sort(((e,t)=>e.sort_order-t.sort_order)).map((e=>{const t=e._links.self.href,o=(null==l?void 0:l.form.folder_uri)===t;return i(I||(I=q` <option value="${0}" ?selected="${0}" ?disabled="${0}"> ${0} </option> `),t,o,o,e.name)})))}});let G,T,U,V,W,z,D,F,J,N,K,Q=e=>e;customElements.define("foxy-internal-transaction-summary-control",class extends e{constructor(){super(...arguments),this.__storeLoaderId="storeLoader"}renderControl(){var e,t,o,r,s,n,l,d,c;const u=null===(e=this.nucleon)||void 0===e?void 0:e.data;if(!u)return i(G||(G=Q``));const f=null!==(o=null===(t=null==u?void 0:u._embedded)||void 0===t?void 0:t["fx:applied_taxes"])&&void 0!==o?o:[],h=null!==(s=null===(r=u._embedded)||void 0===r?void 0:r["fx:shipments"])&&void 0!==s?s:[];return i(T||(T=Q` <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>:</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>: ${0} </span> </span> </p> `),a(this.__storeHref),this.__storeLoaderId,(()=>this.requestUpdate()),this.__renderPrice(u.total_item_price),0===h.length||0===u.total_shipping?i(U||(U=Q` <span><foxy-i18n infer="" key="total_shipping"></foxy-i18n>:</span> <span>${0} </span> `),this.__renderPrice(u.total_shipping,!0)):h.map((e=>i(V||(V=Q` <span>${0}:</span> <span>${0}</span> `),e.shipping_service_description,this.__renderPrice(e.total_shipping,!0)))),0===f.length||0===u.total_tax?i(W||(W=Q` <span><foxy-i18n infer="" key="total_tax"></foxy-i18n>:</span> <span>${0}</span> `),this.__renderPrice(u.total_tax,!0)):f.map((e=>i(z||(z=Q` <span>${0}:</span> <span>${0}</span> `),e.name,this.__renderPrice(e.amount,!0)))),null===(l=null===(n=null==u?void 0:u._embedded)||void 0===n?void 0:n["fx:gift_card_code_logs"])||void 0===l?void 0:l.map((e=>{var t,o,r,s,n;const a=null===(o=null===(t=e._embedded)||void 0===t?void 0:t["fx:gift_card"])||void 0===o?void 0:o.name,l=null===(s=null===(r=e._embedded)||void 0===r?void 0:r["fx:gift_card_code"])||void 0===s?void 0:s.code;if(a&&l)return i(D||(D=Q` <span data-testclass="gift-card-code">${0} • ${0}:</span> <span>${0}</span> `),a,l,this.__renderPrice(null!==(n=e.balance_adjustment)&&void 0!==n?n:0,!0))})),null===(c=null===(d=null==u?void 0:u._embedded)||void 0===d?void 0:d["fx:discounts"])||void 0===c?void 0:c.map((({name:e,code:t,amount:o})=>i(F||(F=Q` <span data-testclass="discount">${0}${0}:</span> <span>${0}</span> `),e,t?i(J||(J=Q` • ${0}`),t):"",this.__renderPrice(o,!0)))),this.__renderStatus(),this.__renderPrice(u.total_order))}get __storeHref(){var e,t,o;return null===(o=null===(t=null===(e=this.nucleon)||void 0===e?void 0:e.data)||void 0===t?void 0:t._links["fx:store"])||void 0===o?void 0:o.href}get __store(){var e,t;const o=`#${this.__storeLoaderId}`;return null!==(t=null===(e=this.renderRoot.querySelector(o))||void 0===e?void 0:e.data)&&void 0!==t?t:null}__renderPrice(e,t=!1){var o,r,s;const n=(null===(o=this.__store)||void 0===o?void 0:o.use_international_currency_symbol)?"code":"symbol",a=null===(s=null===(r=this.nucleon)||void 0===r?void 0:r.data)||void 0===s?void 0:s.currency_code;return i(N||(N=Q` <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 o=(null===(t=null===(e=this.nucleon)||void 0===e?void 0:e.data)||void 0===t?void 0:t.status)||"completed";let r="";return r=["capturing","captured","approved","authorized","pending"].includes(o)?"text-success bg-success-10":o&&"completed"!==o?["problem","pending_fraud_review","rejected","declined"].includes(o)?"text-error-contrast bg-error":"bg-contrast-5 text-body":"text-success-contrast bg-success",i(K||(K=Q` <foxy-i18n infer="" class="${0} rounded-s py-xs px-s font-medium text-s leading-xs" key="status_${0}"></foxy-i18n> `),r,o)}});let X,Y,ee,te,oe=e=>e;const ie=u(f(l,"transaction"));class re extends ie{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 o=e.data._links["fx:send_webhooks"].href,i=new re.API(e),r=await i.fetch(o,{method:"POST",body:JSON.stringify({refeed_hooks:t.map((e=>d(e._links.self.href))),event:"refeed"})});if(t.forEach((e=>{re.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 t(t({},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,o,i,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===(o=this.data)||void 0===o?void 0:o._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===(i=this.data)||void 0===i?void 0:i.transaction_date,ip_country:null===(r=this.data)||void 0===r?void 0:r.ip_country,context:a}}get headerSubtitleBadges(){var e,t,o,i,s;const n=super.headerSubtitleBadges,a=null===(t=null===(e=this.data)||void 0===e?void 0:e._embedded)||void 0===t?void 0:t["fx:folder"];if(null==a?void 0:a.name){const e=null!==(o=a.color)&&void 0!==o?o:"",t={red:"bg-folder-red text-white",red_pale:"bg-folder-red-pale text-black",green:"bg-folder-green text-white",green_pale:"bg-folder-green-pale text-black",blue:"bg-folder-blue text-white",blue_pale:"bg-folder-blue-pale text-black",orange:"bg-folder-orange text-white",orange_pale:"bg-folder-orange-pale text-black",violet:"bg-folder-violet text-white",violet_pale:"bg-folder-violet-pale text-black","":"bg-contrast-5 text-body"};n.push({class:t[e in t?e:""],icon:r(X||(X=oe`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20" fill="currentColor" style="width: 1em; height: 1em;"><path d="M3.75 3A1.75 1.75 0 0 0 2 4.75v3.26a3.235 3.235 0 0 1 1.75-.51h12.5c.644 0 1.245.188 1.75.51V6.75A1.75 1.75 0 0 0 16.25 5h-4.836a.25.25 0 0 1-.177-.073L9.823 3.513A1.75 1.75 0 0 0 8.586 3H3.75ZM3.75 9A1.75 1.75 0 0 0 2 10.75v4.5c0 .966.784 1.75 1.75 1.75h12.5A1.75 1.75 0 0 0 18 15.25v-4.5A1.75 1.75 0 0 0 16.25 9H3.75Z" /></svg>`)),text:a.name})}return(null===(i=this.data)||void 0===i?void 0:i.hide_transaction)&&n.push({key:"archived"}),(null===(s=this.data)||void 0===s?void 0:s.is_test)&&n.push({key:"test"}),n}get headerCopyIdValue(){var e,t,o;return null!==(o=null===(t=null===(e=this.data)||void 0===e?void 0:e.display_id)||void 0===t?void 0:t.toString())&&void 0!==o?o:""}renderHeaderActions(){var e,t;const o=null===(t=null===(e=this.__storeLoader)||void 0===e?void 0:e.data)||void 0===t?void 0:t._links["fx:transaction_folders"].href;return i(Y||(Y=oe` <foxy-internal-transaction-actions-control folders="${0}" infer="actions"> </foxy-internal-transaction-actions-control> `),a(o))}renderBody(){var e,t,o,r,s,n,l,d,c,u,f,h,p,m,v,_;let y,x,b;const g=this.hiddenSelector;if(this.data)try{const i=new URL(this.data._links["fx:shipments"].href),r=new URL(null!==(o=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!==o?o:""),s=new URL(this.data._links["fx:items"].href);i.searchParams.set("zoom","items:item_category"),r.searchParams.set("event_resource","transaction"),s.searchParams.set("zoom","item_options"),y=i.toString(),x=r.toString(),b=s.toString()}catch(e){}return i(ee||(ee=oe` ${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===(r=this.data)||void 0===r?void 0:r.status)&&void 0!==s?s:"")?i(te||(te=oe` <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===(d=null===(l=this.__storeLoader)||void 0===l?void 0:l.data)||void 0===d?void 0:d._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===(h=this.data)||void 0===h?void 0:h._links["fx:custom_fields"].href),a(null===(p=this.data)||void 0===p?void 0:p._links["fx:attributes"].href),a(y),a(x),this.__webhooksBulkActions,{"resource-uri":this.href},{"resource-uri":this.href},a(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()),a(null===(_=this.data)||void 0===_?void 0:_._links["fx:store"].href),(()=>this.requestUpdate()))}get __storeLoader(){return this.renderRoot.querySelector("#storeLoader")}}customElements.define("foxy-transaction",re);export{re 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-26b55da2.js";import"./shared-be071e3d.js";import{a as e}from"./shared-9a454e09.js";import"./foxy-spinner.js";import{_ as t,B as o}from"./shared-8f9014ff.js";import{h as i,s as r}from"./shared-ba5c42c7.js";import{D as s}from"./shared-67aeac0f.js";import{A as n}from"./shared-69c98b7b.js";import{i as a}from"./shared-53e42a77.js";import"./shared-1fa1abbd.js";import"./shared-591ee1bf.js";import"./shared-bc8a1435.js";import{I as l}from"./shared-084e1772.js";import"./foxy-customer-card.js";import"./foxy-swipe-actions.js";import{g as d}from"./shared-bab2ea2c.js";import{c}from"./shared-4e709717.js";import{R as u,a as f}from"./shared-328aa161.js";import"./shared-04277241.js";import"./shared-de4ec7bb.js";import"./shared-fd8b44e3.js";import"./shared-cd96ff03.js";import"./shared-930e68b7.js";import"./shared-da4f9115.js";import"./shared-9496e995.js";import"./shared-791b4510.js";import"./shared-0e19bda5.js";import"./shared-b0453b08.js";import"./shared-18e301f2.js";import"./shared-8dd6e5cc.js";import"./shared-021fbb51.js";import"./shared-5212ef4f.js";import"./shared-41c9c53f.js";import"./shared-7a5d645f.js";import"./shared-b0db52f7.js";import"./shared-9a291941.js";import"./shared-097487d0.js";import"./shared-0a7a4660.js";import"./shared-5fd5805c.js";import"./shared-8bf38c47.js";import"./shared-0ea24ca2.js";import"./shared-490dadf8.js";import"./shared-1da8110b.js";import"./shared-6880e1f6.js";import"./shared-c84333db.js";import"./shared-cf613436.js";import"./shared-462566b0.js";import"./shared-31e75a4a.js";import"./shared-d48e260f.js";import"./shared-910d49eb.js";import"./shared-ba43928a.js";import"./shared-1301af85.js";import"./shared-ad470adf.js";import"./shared-5fbbaea2.js";import"./shared-3c0e3876.js";import"./shared-a9a8eb7c.js";import"./shared-d0aed1c1.js";import"./foxy-webhook-status-card.js";import"./foxy-webhook-log-card.js";import"./shared-4cc1fb20.js";import"./shared-56a16e03.js";import"./shared-4dc0bd88.js";import"./foxy-form-dialog.js";import"./shared-53e476fd.js";import"./shared-f7965314.js";import"./shared-f9bb0924.js";import"./shared-aa258319.js";import"./shared-d74aac59.js";import"./shared-d01853e2.js";import"./shared-f05c924a.js";import"./shared-fc6e64a4.js";import"./shared-83613f15.js";import"./shared-2061be9a.js";import"./shared-200aa12d.js";import"./shared-e6c743bd.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,v,_,y,x,b=e=>e;let g,w=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 t(t({},super.properties),{},{messageOptions:{type:Object,attribute:"message-options"},theme:{},href:{}})}renderControl(){var e,t;return i(g||(g=w` <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),a(null!==(e=this.href)&&void 0!==e?e:void 0),(e=>{e.detail.cancelled||this.dispatchEvent(new CustomEvent("success"))}),a(null!==(t=this.theme)&&void 0!==t?t:void 0),this.disabled||this.readonly,(e=>{const t=e.currentTarget,o=this.renderRoot.querySelector("foxy-internal-post-action-control-dialog");null==o||o.show(t)}))}}),customElements.define("foxy-internal-post-action-control-dialog",class extends s{constructor(){super(...arguments),this.messageOptions={},this.closable=!0,this.header="header",this.alert=!0,this.href=null,this.__api=new n(this),this.__state="idle"}static get properties(){return t(t({},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((()=>i(p||(p=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(h||(h=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?i(_||(_=b` <vaadin-button class="col-span-2" theme="contrast" @click="${0}"> <foxy-i18n infer="" key="button_close"></foxy-i18n> </vaadin-button> `),(()=>this.hide())):i(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?i(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 $,k,j,S,A=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 t(t({},super.properties),{},{__copyEmailState:{attribute:!1},__copyIdState:{attribute:!1}})}renderControl(){var e,t,o,s;const n=this.nucleon,l=null===(e=null==n?void 0:n.data)||void 0===e?void 0:e._links["fx:customer"].href,u=l?null===(t=null==n?void 0:n.getCustomerPageHref)||void 0===t?void 0:t.call(n,l):void 0;return i($||($=A` <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(l),this.__renderCopyAction(r(k||(k=A`<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",l?String(d(l)):""),this.__renderCopyAction(r(j||(j=A`<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!==(s=null===(o=null==n?void 0:n.data)||void 0===o?void 0:o.customer_email)&&void 0!==s?s:""))}__renderCopyAction(e,t,o,r){const s=this[o],n="fail"===s?"error":"done"===s?"end":"busy";return i(S||(S=A` <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(r,o)),(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 P,C,H,L,E,B,O,Z,R,M,I,q=e=>e;customElements.define("foxy-internal-transaction-actions-control",class extends e{constructor(){super(...arguments),this.currencyDisplay=null,this.folders=null}static get properties(){return t(t({},super.properties),{},{currencyDisplay:{attribute:"currency-display"},folders:{}})}renderControl(){var e,t,o,r,s,n,a,l,d,c,u,f;return i(P||(P=q` <div class="flex flex-wrap gap-x-m gap-y-xs"> ${0} ${0} ${0} ${0} ${0} ${0} ${0} ${0} </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===(r=null===(o=this.nucleon)||void 0===o?void 0:o.data)||void 0===r?void 0:r._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===(l=null===(a=this.nucleon)||void 0===a?void 0:a.data)||void 0===l?void 0:l._links["fx:send_emails"])?this.__renderSendEmailsAction():"",(null===(c=null===(d=this.nucleon)||void 0===d?void 0:d.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.__renderArchiveAction(),this.folders?this.__renderFolderSelector(this.folders):"")}get __refundAmount(){var e,t,o,i;const r=null===(e=this.nucleon)||void 0===e?void 0:e.data,s=null!==(t=null==r?void 0:r.total_order)&&void 0!==t?t:0;return parseFloat(null!==(i=null===(o=null==r?void 0:r._links["fx:refund"])||void 0===o?void 0:o.amount)&&void 0!==i?i:s)}__renderSendEmailsAction(){var e,t;return i(C||(C=q` <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 i(H||(H=q` <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,o;return i(L||(L=q` <foxy-internal-post-action-control theme="tertiary-inline error" infer="void" href="${0}" @success="${0}"> </foxy-internal-post-action-control> `),a(null===(o=null===(t=null===(e=this.nucleon)||void 0===e?void 0:e.data)||void 0===t?void 0:t._links["fx:void"])||void 0===o?void 0:o.href),(()=>{var e;return null===(e=this.nucleon)||void 0===e?void 0:e.refresh()}))}__renderRefundAction(){var e,t,o,r,s;const n=null===(t=null===(e=this.nucleon)||void 0===e?void 0:e.data)||void 0===t?void 0:t.currency_code;return i(E||(E=q` <foxy-internal-post-action-control message-options="${0}" infer="refund" theme="tertiary-inline" href="${0}" @success="${0}"> </foxy-internal-post-action-control> `),JSON.stringify({currencyDisplay:this.currencyDisplay,amount:`${this.__refundAmount} ${n}`}),a(null===(s=null===(r=null===(o=this.nucleon)||void 0===o?void 0:o.data)||void 0===r?void 0:r._links["fx:refund"])||void 0===s?void 0:s.href),(()=>{var e;return null===(e=this.nucleon)||void 0===e?void 0:e.refresh()}))}__renderSubscriptionAction(){var e,t,o;const r=this.nucleon,s=null===(t=null===(e=null==r?void 0:r.data)||void 0===e?void 0:e._links["fx:subscription"])||void 0===t?void 0:t.href,n=s?null===(o=null==r?void 0:r.getSubscriptionPageHref)||void 0===o?void 0:o.call(r,s):void 0;return i(B||(B=q` <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 o=this.nucleon;return i(O||(O=q` <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==o?void 0:o.data)||void 0===e?void 0:e._links["fx:receipt"])||void 0===t?void 0:t.href))}__renderArchiveAction(){const e=this.nucleon;return i(Z||(Z=q` <vaadin-button theme="tertiary-inline" ?disabled="${0}" @click="${0}"> <foxy-i18n infer="archive" key="caption_${0}"> </foxy-i18n> </vaadin-button> `),this.disabledSelector.matches("archive",!0),(()=>{null==e||e.edit({hide_transaction:!(null==e?void 0:e.form.hide_transaction)}),null==e||e.submit()}),(null==e?void 0:e.form.hide_transaction)?"unarchive":"archive")}__renderFolderSelector(e){var t,o,s;const n=this.renderRoot.querySelector("#foldersLoader"),a=Array.from(null!==(s=null===(o=null===(t=null==n?void 0:n.data)||void 0===t?void 0:t._embedded)||void 0===o?void 0:o["fx:transaction_folders"])&&void 0!==s?s:[]),l=this.nucleon;return i(R||(R=q` <foxy-nucleon class="hidden" infer="" href="${0}" id="foldersLoader" @update="${0}"> </foxy-nucleon> <label class="group relative rounded focus-within-ring-2 focus-within-ring-primary-50" ?hidden="${0}"> <span class="inline-flex items-center gap-xs relative transition-opacity group-hover-opacity-80"> <foxy-i18n class="font-medium text-primary" infer="folder" key="caption"></foxy-i18n> ${0} </span> <select class="absolute inset-0 opacity-0 cursor-pointer" ?disabled="${0}" ?readonly="${0}" @change="${0}"> <option value="" ?selected="${0}" ?disabled="${0}"> ${0} </option> ${0} </select> </label> `),e,(()=>this.requestUpdate()),0===a.length,r(M||(M=q`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20" fill="currentColor" class="text-primary transform scale-125" style="width: 1em; height: 1em"><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>`)),this.disabled,this.readonly,(e=>{null==l||l.edit({folder_uri:e.currentTarget.value}),null==l||l.submit(!1)}),!(null==l?void 0:l.form.folder_uri),!(null==l?void 0:l.form.folder_uri),this.t("folder.option_none"),a.sort(((e,t)=>e.sort_order-t.sort_order)).map((e=>{const t=e._links.self.href,o=(null==l?void 0:l.form.folder_uri)===t;return i(I||(I=q` <option value="${0}" ?selected="${0}" ?disabled="${0}"> ${0} </option> `),t,o,o,e.name)})))}});let D,G,T,U,F,V,W,z,J,N,K,Q,X=e=>e;customElements.define("foxy-internal-transaction-summary-control",class extends e{constructor(){super(...arguments),this.__storeLoaderId="storeLoader"}renderControl(){var e,t,o,r,s,n,l,d,c;const u=null===(e=this.nucleon)||void 0===e?void 0:e.data;if(!u)return i(D||(D=X``));const f=null!==(o=null===(t=null==u?void 0:u._embedded)||void 0===t?void 0:t["fx:applied_taxes"])&&void 0!==o?o:[],p=null!==(s=null===(r=u._embedded)||void 0===r?void 0:r["fx:shipments"])&&void 0!==s?s:[],h=this.__refundableAmount;return i(G||(G=X` <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>:</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>: ${0} </span> </span> ${0} </p> `),a(this.__storeHref),this.__storeLoaderId,(()=>this.requestUpdate()),this.__renderPrice(u.total_item_price),0===p.length||0===u.total_shipping?i(T||(T=X` <span><foxy-i18n infer="" key="total_shipping"></foxy-i18n>:</span> <span>${0} </span> `),this.__renderPrice(u.total_shipping,!0)):p.map((e=>i(U||(U=X` <span>${0}:</span> <span>${0}</span> `),e.shipping_service_description,this.__renderPrice(e.total_shipping,!0)))),0===f.length||0===u.total_tax?i(F||(F=X` <span><foxy-i18n infer="" key="total_tax"></foxy-i18n>:</span> <span>${0}</span> `),this.__renderPrice(u.total_tax,!0)):f.map((e=>i(V||(V=X` <span>${0}:</span> <span>${0}</span> `),e.name,this.__renderPrice(e.amount,!0)))),null===(l=null===(n=null==u?void 0:u._embedded)||void 0===n?void 0:n["fx:gift_card_code_logs"])||void 0===l?void 0:l.map((e=>{var t,o,r,s,n;const a=null===(o=null===(t=e._embedded)||void 0===t?void 0:t["fx:gift_card"])||void 0===o?void 0:o.name,l=null===(s=null===(r=e._embedded)||void 0===r?void 0:r["fx:gift_card_code"])||void 0===s?void 0:s.code;if(a&&l)return i(W||(W=X` <span data-testclass="gift-card-code">${0} • ${0}:</span> <span>${0}</span> `),a,l,this.__renderPrice(null!==(n=e.balance_adjustment)&&void 0!==n?n:0,!0))})),null===(c=null===(d=null==u?void 0:u._embedded)||void 0===d?void 0:d["fx:discounts"])||void 0===c?void 0:c.map((({name:e,code:t,amount:o})=>i(z||(z=X` <span data-testclass="discount">${0}${0}:</span> <span>${0}</span> `),e,t?i(J||(J=X` • ${0}`),t):"",this.__renderPrice(o,!0)))),this.__renderStatus(),this.__renderPrice(u.total_order),h!==u.total_order?i(N||(N=X` <span class="col-span-2 border-t border-dashed border-contrast-20 my-s"></span> <span class="col-span-2 flex justify-end"> <span> <span class="text-xl font-medium leading-xs"> <foxy-i18n infer="" key="refundable_amount"></foxy-i18n>: ${0} </span> <br> <foxy-i18n class="inline-block whitespace-normal leading-s text-tertiary" style="max-width:48ch" infer="" key="refundable_amount_note"> </foxy-i18n> </span> </span> `),this.__renderPrice(h)):"")}get __refundableAmount(){var e,t,o,i;const r=null===(e=this.nucleon)||void 0===e?void 0:e.data,s=null!==(t=null==r?void 0:r.total_order)&&void 0!==t?t:0;return parseFloat(null!==(i=null===(o=null==r?void 0:r._links["fx:refund"])||void 0===o?void 0:o.amount)&&void 0!==i?i:s)}get __storeHref(){var e,t,o;return null===(o=null===(t=null===(e=this.nucleon)||void 0===e?void 0:e.data)||void 0===t?void 0:t._links["fx:store"])||void 0===o?void 0:o.href}get __store(){var e,t;const o=`#${this.__storeLoaderId}`;return null!==(t=null===(e=this.renderRoot.querySelector(o))||void 0===e?void 0:e.data)&&void 0!==t?t:null}__renderPrice(e,t=!1){var o,r,s;const n=(null===(o=this.__store)||void 0===o?void 0:o.use_international_currency_symbol)?"code":"symbol",a=null===(s=null===(r=this.nucleon)||void 0===r?void 0:r.data)||void 0===s?void 0:s.currency_code;return i(K||(K=X` <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 o=(null===(t=null===(e=this.nucleon)||void 0===e?void 0:e.data)||void 0===t?void 0:t.status)||"completed";let r="";return r=["capturing","captured","approved","authorized","pending"].includes(o)?"text-success bg-success-10":o&&"completed"!==o?["problem","pending_fraud_review","rejected","declined"].includes(o)?"text-error-contrast bg-error":"bg-contrast-5 text-body":"text-success-contrast bg-success",i(Q||(Q=X` <foxy-i18n infer="" class="${0} rounded-s py-xs px-s font-medium text-s leading-xs" key="status_${0}"></foxy-i18n> `),r,o)}});let Y,ee,te,oe,ie=e=>e;const re=u(f(l,"transaction"));class se extends re{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 o=e.data._links["fx:send_webhooks"].href,i=new se.API(e),r=await i.fetch(o,{method:"POST",body:JSON.stringify({refeed_hooks:t.map((e=>d(e._links.self.href))),event:"refeed"})});if(t.forEach((e=>{se.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 t(t({},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,o,i,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===(o=this.data)||void 0===o?void 0:o._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===(i=this.data)||void 0===i?void 0:i.transaction_date,ip_country:null===(r=this.data)||void 0===r?void 0:r.ip_country,context:a}}get headerSubtitleBadges(){var e,t,o,i,s;const n=super.headerSubtitleBadges,a=null===(t=null===(e=this.data)||void 0===e?void 0:e._embedded)||void 0===t?void 0:t["fx:folder"];if(null==a?void 0:a.name){const e=null!==(o=a.color)&&void 0!==o?o:"",t={red:"bg-folder-red text-white",red_pale:"bg-folder-red-pale text-black",green:"bg-folder-green text-white",green_pale:"bg-folder-green-pale text-black",blue:"bg-folder-blue text-white",blue_pale:"bg-folder-blue-pale text-black",orange:"bg-folder-orange text-white",orange_pale:"bg-folder-orange-pale text-black",violet:"bg-folder-violet text-white",violet_pale:"bg-folder-violet-pale text-black","":"bg-contrast-5 text-body"};n.push({class:t[e in t?e:""],icon:r(Y||(Y=ie`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20" fill="currentColor" style="width: 1em; height: 1em;"><path d="M3.75 3A1.75 1.75 0 0 0 2 4.75v3.26a3.235 3.235 0 0 1 1.75-.51h12.5c.644 0 1.245.188 1.75.51V6.75A1.75 1.75 0 0 0 16.25 5h-4.836a.25.25 0 0 1-.177-.073L9.823 3.513A1.75 1.75 0 0 0 8.586 3H3.75ZM3.75 9A1.75 1.75 0 0 0 2 10.75v4.5c0 .966.784 1.75 1.75 1.75h12.5A1.75 1.75 0 0 0 18 15.25v-4.5A1.75 1.75 0 0 0 16.25 9H3.75Z" /></svg>`)),text:a.name})}return(null===(i=this.data)||void 0===i?void 0:i.hide_transaction)&&n.push({key:"archived"}),(null===(s=this.data)||void 0===s?void 0:s.is_test)&&n.push({key:"test"}),n}get headerCopyIdValue(){var e,t,o;return null!==(o=null===(t=null===(e=this.data)||void 0===e?void 0:e.display_id)||void 0===t?void 0:t.toString())&&void 0!==o?o:""}renderHeaderActions(){var e;const t=null===(e=this.__storeLoader)||void 0===e?void 0:e.data,o=null==t?void 0:t._links["fx:transaction_folders"].href;return i(ee||(ee=ie` <foxy-internal-transaction-actions-control currency-display="${0}" folders="${0}" infer="actions"> </foxy-internal-transaction-actions-control> `),(null==t?void 0:t.use_international_currency_symbol)?"code":"symbol",a(o))}renderBody(){var e,t,o,r,s,n,l,d,c,u,f,p,h,m,v,_;let y,x,b;const g=this.hiddenSelector;if(this.data)try{const i=new URL(this.data._links["fx:shipments"].href),r=new URL(null!==(o=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!==o?o:""),s=new URL(this.data._links["fx:items"].href);i.searchParams.set("zoom","items:item_category"),r.searchParams.set("event_resource","transaction"),s.searchParams.set("zoom","item_options"),y=i.toString(),x=r.toString(),b=s.toString()}catch(e){}return i(te||(te=ie` ${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===(r=this.data)||void 0===r?void 0:r.status)&&void 0!==s?s:"")?i(oe||(oe=ie` <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===(d=null===(l=this.__storeLoader)||void 0===l?void 0:l.data)||void 0===d?void 0:d._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===(v=null===(m=this.data)||void 0===m?void 0:m._links["fx:process_webhook"])||void 0===v?void 0:v.href),(()=>this.refresh()),a(null===(_=this.data)||void 0===_?void 0:_._links["fx:store"].href),(()=>this.requestUpdate()))}get __storeLoader(){return this.renderRoot.querySelector("#storeLoader")}}customElements.define("foxy-transaction",se);export{se as Transaction};
|
|
@@ -1287,6 +1287,8 @@
|
|
|
1287
1287
|
"total_tax": "Tax",
|
|
1288
1288
|
"subtotal": "Subtotal",
|
|
1289
1289
|
"total": "Total",
|
|
1290
|
+
"refundable_amount": "Refundable",
|
|
1291
|
+
"refundable_amount_note": "The amount that can be refunded is different from the order total above because this transaction has been modified",
|
|
1290
1292
|
"price": "{{amount, price}}",
|
|
1291
1293
|
"status_capturing": "Capturing",
|
|
1292
1294
|
"status_captured": "Captured",
|
|
@@ -1295,7 +1297,7 @@
|
|
|
1295
1297
|
"status_pending": "Pending",
|
|
1296
1298
|
"status_completed": "Completed",
|
|
1297
1299
|
"status_problem": "Problem",
|
|
1298
|
-
"status_pending_fraud_review": "
|
|
1300
|
+
"status_pending_fraud_review": "Pending fraud review",
|
|
1299
1301
|
"status_rejected": "Rejected",
|
|
1300
1302
|
"status_declined": "Declined",
|
|
1301
1303
|
"status_refunding": "Refunding",
|
|
@@ -2107,7 +2109,7 @@
|
|
|
2107
2109
|
"button": "Void"
|
|
2108
2110
|
},
|
|
2109
2111
|
"refund": {
|
|
2110
|
-
"message_idle": "This action will attempt to refund the
|
|
2112
|
+
"message_idle": "This action will attempt to refund {{ amount, price }} to the payment method used in this transaction. Would you like to proceed?",
|
|
2111
2113
|
"message_fail": "Failed to refund this transaction. If you'd like to retry, close this dialog and click the refund button again.",
|
|
2112
2114
|
"message_done": "Transaction was refunded successfully. You can close this dialog now.",
|
|
2113
2115
|
"button_close": "Close",
|
|
@@ -252,7 +252,7 @@
|
|
|
252
252
|
"status_pending": "Pending",
|
|
253
253
|
"status_completed": "Completed",
|
|
254
254
|
"status_problem": "Problem",
|
|
255
|
-
"status_pending_fraud_review": "
|
|
255
|
+
"status_pending_fraud_review": "Pending fraud review",
|
|
256
256
|
"status_rejected": "Rejected",
|
|
257
257
|
"status_declined": "Declined",
|
|
258
258
|
"status_refunding": "Refunding",
|
|
@@ -1271,7 +1271,7 @@
|
|
|
1271
1271
|
"status_pending": "Pending",
|
|
1272
1272
|
"status_completed": "Completed",
|
|
1273
1273
|
"status_problem": "Problem",
|
|
1274
|
-
"status_pending_fraud_review": "
|
|
1274
|
+
"status_pending_fraud_review": "Pending fraud review",
|
|
1275
1275
|
"status_rejected": "Rejected",
|
|
1276
1276
|
"status_declined": "Declined",
|
|
1277
1277
|
"status_refunding": "Refunding",
|
|
@@ -1086,7 +1086,7 @@
|
|
|
1086
1086
|
"status_pending": "Ausstehend",
|
|
1087
1087
|
"status_completed": "Vollendet",
|
|
1088
1088
|
"status_problem": "Problem",
|
|
1089
|
-
"status_pending_fraud_review": "
|
|
1089
|
+
"status_pending_fraud_review": "Ausstehende Betrugsüberprüfung",
|
|
1090
1090
|
"status_rejected": "Abgelehnt",
|
|
1091
1091
|
"status_declined": "Abgelehnt",
|
|
1092
1092
|
"status_refunding": "Rückerstattung",
|
|
@@ -1086,7 +1086,7 @@
|
|
|
1086
1086
|
"status_pending": "Pending",
|
|
1087
1087
|
"status_completed": "Completed",
|
|
1088
1088
|
"status_problem": "Problem",
|
|
1089
|
-
"status_pending_fraud_review": "
|
|
1089
|
+
"status_pending_fraud_review": "Pending fraud review",
|
|
1090
1090
|
"status_rejected": "Rejected",
|
|
1091
1091
|
"status_declined": "Declined",
|
|
1092
1092
|
"status_refunding": "Refunding",
|
|
@@ -1086,7 +1086,7 @@
|
|
|
1086
1086
|
"status_pending": "I väntan på",
|
|
1087
1087
|
"status_completed": "Avslutad",
|
|
1088
1088
|
"status_problem": "Problem",
|
|
1089
|
-
"status_pending_fraud_review": "
|
|
1089
|
+
"status_pending_fraud_review": "Väntar på bedrägeriskontroll",
|
|
1090
1090
|
"status_rejected": "avvisade",
|
|
1091
1091
|
"status_declined": "Tackade nej",
|
|
1092
1092
|
"status_refunding": "Återbetalning",
|
|
@@ -195,7 +195,7 @@
|
|
|
195
195
|
"status_pending": "Pending",
|
|
196
196
|
"status_completed": "Completed",
|
|
197
197
|
"status_problem": "Problem",
|
|
198
|
-
"status_pending_fraud_review": "
|
|
198
|
+
"status_pending_fraud_review": "Pending fraud review",
|
|
199
199
|
"status_rejected": "Rejected",
|
|
200
200
|
"status_declined": "Declined",
|
|
201
201
|
"status_refunding": "Refunding",
|
|
@@ -920,6 +920,8 @@
|
|
|
920
920
|
"total_tax": "Tax",
|
|
921
921
|
"subtotal": "Subtotal",
|
|
922
922
|
"total": "Total",
|
|
923
|
+
"refundable_amount": "Refundable",
|
|
924
|
+
"refundable_amount_note": "The amount that can be refunded is different from the order total above because this transaction has been modified",
|
|
923
925
|
"price": "{{amount, price}}",
|
|
924
926
|
"status_capturing": "Capturing",
|
|
925
927
|
"status_captured": "Captured",
|
|
@@ -928,7 +930,7 @@
|
|
|
928
930
|
"status_pending": "Pending",
|
|
929
931
|
"status_completed": "Completed",
|
|
930
932
|
"status_problem": "Problem",
|
|
931
|
-
"status_pending_fraud_review": "
|
|
933
|
+
"status_pending_fraud_review": "Pending fraud review",
|
|
932
934
|
"status_rejected": "Rejected",
|
|
933
935
|
"status_declined": "Declined",
|
|
934
936
|
"status_refunding": "Refunding",
|
|
@@ -1740,7 +1742,7 @@
|
|
|
1740
1742
|
"button": "Void"
|
|
1741
1743
|
},
|
|
1742
1744
|
"refund": {
|
|
1743
|
-
"message_idle": "This action will attempt to refund the
|
|
1745
|
+
"message_idle": "This action will attempt to refund {{ amount, price }} to the payment method used in this transaction. Would you like to proceed?",
|
|
1744
1746
|
"message_fail": "Failed to refund this transaction. If you'd like to retry, close this dialog and click the refund button again.",
|
|
1745
1747
|
"message_done": "Transaction was refunded successfully. You can close this dialog now.",
|
|
1746
1748
|
"button_close": "Close",
|
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
"status_pending": "Pending",
|
|
14
14
|
"status_completed": "Completed",
|
|
15
15
|
"status_problem": "Problem",
|
|
16
|
-
"status_pending_fraud_review": "
|
|
16
|
+
"status_pending_fraud_review": "Pending fraud review",
|
|
17
17
|
"status_rejected": "Rejected",
|
|
18
18
|
"status_declined": "Declined",
|
|
19
19
|
"status_refunding": "Refunding",
|
|
@@ -224,10 +224,15 @@ export class Transaction extends Base {
|
|
|
224
224
|
return (_c = (_b = (_a = this.data) === null || _a === void 0 ? void 0 : _a.display_id) === null || _b === void 0 ? void 0 : _b.toString()) !== null && _c !== void 0 ? _c : '';
|
|
225
225
|
}
|
|
226
226
|
renderHeaderActions() {
|
|
227
|
-
var _a
|
|
228
|
-
const
|
|
227
|
+
var _a;
|
|
228
|
+
const store = (_a = this.__storeLoader) === null || _a === void 0 ? void 0 : _a.data;
|
|
229
|
+
const foldersHref = store === null || store === void 0 ? void 0 : store._links['fx:transaction_folders'].href;
|
|
229
230
|
return html `
|
|
230
|
-
<foxy-internal-transaction-actions-control
|
|
231
|
+
<foxy-internal-transaction-actions-control
|
|
232
|
+
currency-display=${(store === null || store === void 0 ? void 0 : store.use_international_currency_symbol) ? 'code' : 'symbol'}
|
|
233
|
+
folders=${ifDefined(foldersHref)}
|
|
234
|
+
infer="actions"
|
|
235
|
+
>
|
|
231
236
|
</foxy-internal-transaction-actions-control>
|
|
232
237
|
`;
|
|
233
238
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Transaction.js","sourceRoot":"","sources":["../../../../src/elements/public/Transaction/Transaction.ts"],"names":[],"mappings":"AAOA,OAAO,EAAE,eAAe,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AACnE,OAAO,EAAE,iBAAiB,EAAE,wCAAqC;AACjE,OAAO,EAAE,eAAe,EAAE,sCAAmC;AAC7D,OAAO,EAAE,YAAY,EAAE,oDAAiD;AACxE,OAAO,EAAE,SAAS,EAAE,MAAM,gCAAgC,CAAC;AAC3D,OAAO,EAAE,IAAI,EAAE,GAAG,EAAE,MAAM,aAAa,CAAC;AAExC,MAAM,EAAE,GAAG,aAAa,CAAC;AACzB,MAAM,IAAI,GAAG,eAAe,CAAC,iBAAiB,CAAC,YAAY,EAAE,EAAE,CAAC,CAAC,CAAC;AAElE;;;;;GAKG;AACH,MAAM,OAAO,WAAY,SAAQ,IAAU;IAA3C;;QAYE,wEAAwE;QACxE,gCAA2B,GAAkB,IAAI,CAAC;QAElD,iEAAiE;QACjE,0BAAqB,GAAkB,IAAI,C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;;;;;;;gBAUK,SAAS,OAAC,IAAI,CAAC,IAAI,0CAAE,MAAM,CAAC,sBAAsB,EAAE,IAAI,CAAC;;;;;;;;;;;gBAWzD,SAAS,OAAC,IAAI,CAAC,IAAI,0CAAE,MAAM,CAAC,aAAa,EAAE,IAAI,CAAC;;qBAE3C;YACX,gCAAgC,EAAE,IAAI,CAAC,2BAA2B;YAClE,yBAAyB,EAAE,IAAI,CAAC,qBAAqB;SACtD;;;;;;;gBAOO,SAAS,OAAC,IAAI,CAAC,IAAI,0CAAE,MAAM,CAAC,kBAAkB,EAAE,IAAI,CAAC;;;;;;;;;;;gBAWrD,SAAS,OAAC,IAAI,CAAC,IAAI,0CAAE,MAAM,CAAC,eAAe,EAAE,IAAI,CAAC;;;;;;;;;;gBAUlD,SAAS,CAAC,aAAa,CAAC;;;;;;;gBAOxB,SAAS,CAAC,YAAY,CAAC;;;;;;uBAMhB,IAAI,CAAC,qBAAqB;qBAC5B,EAAE,cAAc,EAAE,IAAI,CAAC,IAAI,EAAE;qBAC7B,EAAE,cAAc,EAAE,IAAI,CAAC,IAAI,EAAE;;;;;;;;;iBASjC,SAAS,aAAC,IAAI,CAAC,IAAI,0CAAE,MAAM,CAAC,oBAAoB,2CAAG,IAAI,CAAC;qBACpD,GAAG,EAAE,CAAC,IAAI,CAAC,OAAO,EAAE;;;;;;;;eAQ1B,SAAS,OAAC,IAAI,CAAC,IAAI,0CAAE,MAAM,CAAC,UAAU,EAAE,IAAI,CAAC;;kBAE1C,GAAG,EAAE,CAAC,IAAI,CAAC,aAAa,EAAE;;;KAGvC,CAAC;IACJ,CAAC;IAED,IAAY,aAAa;QAEvB,OAAO,IAAI,CAAC,UAAU,CAAC,aAAa,CAAS,cAAc,CAAC,CAAC;IAC/D,CAAC;CACF","sourcesContent":["import type { PropertyDeclarations, TemplateResult } from 'lit-element';\nimport type { NucleonElement } from '../NucleonElement/NucleonElement';\nimport type { Resource } from '@foxy.io/sdk/core';\nimport type { Badge } from '../../internal/InternalForm/types';\nimport type { Data } from './types';\nimport type { Rels } from '@foxy.io/sdk/backend';\n\nimport { BooleanSelector, getResourceId } from '@foxy.io/sdk/core';\nimport { TranslatableMixin } from '../../../mixins/translatable';\nimport { ResponsiveMixin } from '../../../mixins/responsive';\nimport { InternalForm } from '../../internal/InternalForm/InternalForm';\nimport { ifDefined } from 'lit-html/directives/if-defined';\nimport { html, svg } from 'lit-element';\n\nconst NS = 'transaction';\nconst Base = ResponsiveMixin(TranslatableMixin(InternalForm, NS));\n\n/**\n * Transaction summary page (`fx:transaction`).\n *\n * @element foxy-transaction\n * @since 1.17.0\n */\nexport class Transaction extends Base<Data> {\n static get properties(): PropertyDeclarations {\n return {\n ...super.properties,\n hostedPaymentGatewaysHelper: { attribute: 'hosted-payment-gateways-helper' },\n paymentGatewaysHelper: { attribute: 'payment-gateways-helper' },\n getSubscriptionPageHref: { attribute: false },\n getCustomerPageHref: { attribute: false },\n localeCodes: { attribute: 'locale-codes' },\n };\n }\n\n /** URL of the `fx:hosted_payment_gateways` property helper resource. */\n hostedPaymentGatewaysHelper: string | null = null;\n\n /** URL of the `fx:payment_gateways` property helper resource. */\n paymentGatewaysHelper: string | null = null;\n\n /** Link to the `fx:locale_codes` property helper for currency formatting. */\n localeCodes: string | null = null;\n\n getSubscriptionPageHref: ((href: string) => string) | null = null;\n\n getCustomerPageHref: ((href: string) => string) | null = null;\n\n private readonly __webhooksBulkActions = [\n {\n name: 'refeed',\n onClick: async (selection: Resource<Rels.Webhook>[]) => {\n if (!this.data) return;\n\n const url = this.data._links['fx:send_webhooks'].href;\n const api = new Transaction.API(this);\n const response = await api.fetch(url, {\n method: 'POST',\n body: JSON.stringify({\n refeed_hooks: selection.map(hook => getResourceId(hook._links['self'].href)),\n event: 'refeed',\n }),\n });\n\n selection.forEach(hook => {\n Transaction.Rumour('').share({\n related: [\n ...selection.map(hook => hook._links['fx:logs'].href),\n ...selection.map(hook => hook._links['fx:statuses'].href),\n ],\n source: hook._links.self.href,\n data: hook,\n });\n });\n\n if (!response.ok) throw new Error(await response.text());\n },\n },\n ];\n\n get readonlySelector(): BooleanSelector {\n const alwaysMatch = [\n 'billing-addresses',\n 'datafeed:data-is-fed',\n 'webhooks:dialog:url',\n super.readonlySelector,\n ];\n\n const isEditable = Boolean(this.data?._links['fx:void'] ?? this.data?._links['fx:refund']);\n if (!isEditable) alwaysMatch.push('items', 'attributes', 'custom-fields');\n return new BooleanSelector(alwaysMatch.join(' ').trim());\n }\n\n get hiddenSelector(): BooleanSelector {\n const alwaysMatch = [\n 'billing-addresses:dialog:delete',\n 'billing-addresses:dialog:timestamps',\n 'webhooks:dialog:header:copy-json',\n 'webhooks:dialog:header:copy-id',\n 'webhooks:dialog:timestamps',\n 'webhooks:dialog:name',\n 'webhooks:dialog:query',\n 'webhooks:dialog:encryption-key',\n 'webhooks:dialog:delete',\n super.readonlySelector,\n ];\n\n const type = this.data?.type;\n\n if (!this.data?._links['fx:subscription']) alwaysMatch.unshift('subscription');\n if (type === 'subscription_modification') alwaysMatch.unshift('actions');\n\n if (type === 'updateinfo') {\n alwaysMatch.unshift('not=customer,subscription,payments,custom-fields,attributes');\n }\n\n if (type === 'subscription_cancellation') {\n alwaysMatch.unshift('not=customer,subscription,custom-fields,attributes');\n }\n\n if (!this.__storeLoader?.data?.use_webhook) alwaysMatch.unshift('datafeed');\n\n return new BooleanSelector(alwaysMatch.join(' ').trim());\n }\n\n get headerSubtitleOptions(): Record<string, unknown> {\n const source = this.data?.source;\n const type = this.data?.type;\n\n let context = '';\n\n if (type === 'updateinfo') {\n if (!source || source?.startsWith('cit_')) {\n context = 'customer_changed_payment_method';\n } else if (source === 'mit_uoe') {\n context = 'admin_changed_payment_method_with_uoe';\n } else if (source === 'mit_api') {\n context = 'integration_changed_payment_method';\n } else {\n context = 'admin_changed_payment_method';\n }\n } else if (type === 'subscription_modification') {\n if (!source || source?.startsWith('cit_')) {\n context = 'customer_changed_subscription';\n } else if (source === 'mit_uoe') {\n context = 'admin_changed_subscription_with_uoe';\n } else if (source === 'mit_api') {\n context = 'integration_changed_subscription';\n } else {\n context = 'admin_changed_subscription';\n }\n } else if (type === 'subscription_renewal') {\n if (source === 'mit_recurring') {\n context = 'subscription_renewal_attempt';\n } else if (source === 'mit_recurring_reattempt_automated') {\n context = 'subscription_renewal_automated_reattempt';\n } else if (source === 'mit_recurring_reattempt_manual') {\n context = 'subscription_renewal_manual_reattempt';\n }\n } else if (type === 'subscription_cancellation') {\n if (source === 'cit_recurring_cancellation') {\n context = 'customer_canceled_subscription';\n } else if (source === 'mit_recurring_cancellation') {\n context = 'admin_canceled_subscription';\n }\n } else {\n if (this.data?._links['fx:subscription']) {\n if (source?.startsWith('cit_')) {\n context = 'customer_subscribed';\n } else if (source === 'mit_uoe') {\n context = 'admin_subscribed_with_uoe';\n } else if (source === 'mit_api') {\n context = 'integration_subscribed';\n }\n } else {\n if (source?.startsWith('cit_')) {\n context = 'customer_placed_order';\n } else if (source === 'mit_uoe') {\n context = 'admin_placed_order_with_uoe';\n } else if (source === 'mit_api') {\n context = 'integration_placed_order';\n }\n }\n }\n\n return {\n transaction_date: this.data?.transaction_date,\n ip_country: this.data?.ip_country,\n context,\n };\n }\n\n get headerSubtitleBadges(): Badge[] {\n const badges = super.headerSubtitleBadges;\n const folder = this.data?._embedded?.['fx:folder'];\n\n if (folder?.name) {\n const folderColor = folder.color ?? '';\n const colors: Record<string, string> = {\n 'red': 'bg-folder-red text-white',\n 'red_pale': 'bg-folder-red-pale text-black',\n 'green': 'bg-folder-green text-white',\n 'green_pale': 'bg-folder-green-pale text-black',\n 'blue': 'bg-folder-blue text-white',\n 'blue_pale': 'bg-folder-blue-pale text-black',\n 'orange': 'bg-folder-orange text-white',\n 'orange_pale': 'bg-folder-orange-pale text-black',\n 'violet': 'bg-folder-violet text-white',\n 'violet_pale': 'bg-folder-violet-pale text-black',\n '': 'bg-contrast-5 text-body',\n };\n\n badges.push({\n class: colors[folderColor in colors ? folderColor : ''],\n icon: svg`<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 20 20\" fill=\"currentColor\" style=\"width: 1em; height: 1em;\"><path d=\"M3.75 3A1.75 1.75 0 0 0 2 4.75v3.26a3.235 3.235 0 0 1 1.75-.51h12.5c.644 0 1.245.188 1.75.51V6.75A1.75 1.75 0 0 0 16.25 5h-4.836a.25.25 0 0 1-.177-.073L9.823 3.513A1.75 1.75 0 0 0 8.586 3H3.75ZM3.75 9A1.75 1.75 0 0 0 2 10.75v4.5c0 .966.784 1.75 1.75 1.75h12.5A1.75 1.75 0 0 0 18 15.25v-4.5A1.75 1.75 0 0 0 16.25 9H3.75Z\" /></svg>`,\n text: folder.name,\n });\n }\n\n if (this.data?.hide_transaction) badges.push({ key: 'archived' });\n if (this.data?.is_test) badges.push({ key: 'test' });\n\n return badges;\n }\n\n get headerCopyIdValue(): string {\n return this.data?.display_id?.toString() ?? '';\n }\n\n renderHeaderActions(): TemplateResult {\n const foldersHref = this.__storeLoader?.data?._links['fx:transaction_folders'].href;\n\n return html`\n <foxy-internal-transaction-actions-control folders=${ifDefined(foldersHref)} infer=\"actions\">\n </foxy-internal-transaction-actions-control>\n `;\n }\n\n renderBody(): TemplateResult {\n let shipmentsLink: string | undefined = undefined;\n let webhooksLink: string | undefined = undefined;\n let itemsLink: string | undefined = undefined;\n\n const alertStatuses = ['problem', 'pending_fraud_review', 'rejected', 'declined'];\n const hidden = this.hiddenSelector;\n\n if (this.data) {\n try {\n const shipmentsUrl = new URL(this.data._links['fx:shipments'].href);\n const webhooksUrl = new URL(this.__storeLoader?.data?._links['fx:webhooks'].href ?? '');\n const itemsUrl = new URL(this.data._links['fx:items'].href);\n\n shipmentsUrl.searchParams.set('zoom', 'items:item_category');\n webhooksUrl.searchParams.set('event_resource', 'transaction');\n itemsUrl.searchParams.set('zoom', 'item_options');\n\n shipmentsLink = shipmentsUrl.toString();\n webhooksLink = webhooksUrl.toString();\n itemsLink = itemsUrl.toString();\n } catch {\n //\n }\n }\n\n return html`\n ${this.renderHeader()}\n ${alertStatuses.includes(this.data?.status ?? '')\n ? html`\n <p\n class=\"leading-xs text-body rounded bg-error-10 block\"\n style=\"padding: calc(0.625em + (var(--lumo-border-radius) / 4) - 1px)\"\n >\n <foxy-i18n infer=\"header\" key=\"alert_status_${this.data?.status}\"></foxy-i18n>\n </p>\n `\n : ''}\n\n <foxy-internal-transaction-customer-control infer=\"customer\">\n </foxy-internal-transaction-customer-control>\n\n <div\n class=\"grid gap-s\"\n ?hidden=${hidden.matches('items', true) && hidden.matches('summary', true)}\n >\n <foxy-internal-async-list-control\n infer=\"items\"\n class=\"min-w-0\"\n first=${ifDefined(itemsLink)}\n limit=\"10\"\n item=\"foxy-item-card\"\n form=\"foxy-item-form\"\n alert\n wide\n .related=${[this.href]}\n .itemProps=${{ 'locale-codes': this.localeCodes }}\n .formProps=${{\n 'item-categories': this.__storeLoader?.data?._links['fx:item_categories'].href,\n 'locale-codes': this.localeCodes,\n 'store': this.data?._links['fx:store'].href,\n }}\n >\n </foxy-internal-async-list-control>\n\n <foxy-internal-transaction-summary-control infer=\"summary\" class=\"min-w-0\">\n </foxy-internal-transaction-summary-control>\n </div>\n\n <foxy-internal-async-list-control\n infer=\"billing-addresses\"\n first=${ifDefined(this.data?._links['fx:billing_addresses'].href)}\n item=\"foxy-billing-address-card\"\n form=\"foxy-address-form\"\n hide-create-button\n hide-delete-button\n alert\n >\n </foxy-internal-async-list-control>\n\n <foxy-internal-async-list-control\n infer=\"payments\"\n first=${ifDefined(this.data?._links['fx:payments'].href)}\n item=\"foxy-payment-card\"\n .itemProps=${{\n 'hosted-payment-gateways-helper': this.hostedPaymentGatewaysHelper,\n 'payment-gateways-helper': this.paymentGatewaysHelper,\n }}\n >\n </foxy-internal-async-list-control>\n\n <foxy-internal-async-list-control\n infer=\"custom-fields\"\n class=\"min-w-0\"\n first=${ifDefined(this.data?._links['fx:custom_fields'].href)}\n limit=\"5\"\n form=\"foxy-custom-field-form\"\n item=\"foxy-custom-field-card\"\n alert\n >\n </foxy-internal-async-list-control>\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 limit=\"5\"\n form=\"foxy-attribute-form\"\n item=\"foxy-attribute-card\"\n alert\n >\n </foxy-internal-async-list-control>\n\n <foxy-internal-async-list-control\n infer=\"shipments\"\n first=${ifDefined(shipmentsLink)}\n item=\"foxy-shipment-card\"\n >\n </foxy-internal-async-list-control>\n\n <foxy-internal-async-list-control\n infer=\"webhooks\"\n first=${ifDefined(webhooksLink)}\n item=\"foxy-webhook-card\"\n form=\"foxy-webhook-form\"\n hide-create-button\n hide-delete-button\n alert\n .bulkActions=${this.__webhooksBulkActions}\n .itemProps=${{ 'resource-uri': this.href }}\n .formProps=${{ 'resource-uri': this.href }}\n >\n </foxy-internal-async-list-control>\n\n <foxy-internal-summary-control infer=\"datafeed\">\n <foxy-internal-switch-control infer=\"data-is-fed\"></foxy-internal-switch-control>\n <foxy-internal-post-action-control\n infer=\"process-webhook\"\n theme=\"tertiary-inline\"\n href=${ifDefined(this.data?._links['fx:process_webhook']?.href)}\n @success=${() => this.refresh()}\n >\n </foxy-internal-post-action-control>\n </foxy-internal-summary-control>\n\n <foxy-nucleon\n class=\"hidden\"\n infer=\"\"\n href=${ifDefined(this.data?._links['fx:store'].href)}\n id=\"storeLoader\"\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>('#storeLoader');\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"Transaction.js","sourceRoot":"","sources":["../../../../src/elements/public/Transaction/Transaction.ts"],"names":[],"mappings":"AAOA,OAAO,EAAE,eAAe,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AACnE,OAAO,EAAE,iBAAiB,EAAE,wCAAqC;AACjE,OAAO,EAAE,eAAe,EAAE,sCAAmC;AAC7D,O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AAE,cAAc,EAAE,IAAI,CAAC,IAAI,EAAE;;;;;;;;;iBASjC,SAAS,aAAC,IAAI,CAAC,IAAI,0CAAE,MAAM,CAAC,oBAAoB,2CAAG,IAAI,CAAC;qBACpD,GAAG,EAAE,CAAC,IAAI,CAAC,OAAO,EAAE;;;;;;;;eAQ1B,SAAS,OAAC,IAAI,CAAC,IAAI,0CAAE,MAAM,CAAC,UAAU,EAAE,IAAI,CAAC;;kBAE1C,GAAG,EAAE,CAAC,IAAI,CAAC,aAAa,EAAE;;;KAGvC,CAAC;IACJ,CAAC;IAED,IAAY,aAAa;QAEvB,OAAO,IAAI,CAAC,UAAU,CAAC,aAAa,CAAS,cAAc,CAAC,CAAC;IAC/D,CAAC;CACF","sourcesContent":["import type { PropertyDeclarations, TemplateResult } from 'lit-element';\nimport type { NucleonElement } from '../NucleonElement/NucleonElement';\nimport type { Resource } from '@foxy.io/sdk/core';\nimport type { Badge } from '../../internal/InternalForm/types';\nimport type { Data } from './types';\nimport type { Rels } from '@foxy.io/sdk/backend';\n\nimport { BooleanSelector, getResourceId } from '@foxy.io/sdk/core';\nimport { TranslatableMixin } from '../../../mixins/translatable';\nimport { ResponsiveMixin } from '../../../mixins/responsive';\nimport { InternalForm } from '../../internal/InternalForm/InternalForm';\nimport { ifDefined } from 'lit-html/directives/if-defined';\nimport { html, svg } from 'lit-element';\n\nconst NS = 'transaction';\nconst Base = ResponsiveMixin(TranslatableMixin(InternalForm, NS));\n\n/**\n * Transaction summary page (`fx:transaction`).\n *\n * @element foxy-transaction\n * @since 1.17.0\n */\nexport class Transaction extends Base<Data> {\n static get properties(): PropertyDeclarations {\n return {\n ...super.properties,\n hostedPaymentGatewaysHelper: { attribute: 'hosted-payment-gateways-helper' },\n paymentGatewaysHelper: { attribute: 'payment-gateways-helper' },\n getSubscriptionPageHref: { attribute: false },\n getCustomerPageHref: { attribute: false },\n localeCodes: { attribute: 'locale-codes' },\n };\n }\n\n /** URL of the `fx:hosted_payment_gateways` property helper resource. */\n hostedPaymentGatewaysHelper: string | null = null;\n\n /** URL of the `fx:payment_gateways` property helper resource. */\n paymentGatewaysHelper: string | null = null;\n\n /** Link to the `fx:locale_codes` property helper for currency formatting. */\n localeCodes: string | null = null;\n\n getSubscriptionPageHref: ((href: string) => string) | null = null;\n\n getCustomerPageHref: ((href: string) => string) | null = null;\n\n private readonly __webhooksBulkActions = [\n {\n name: 'refeed',\n onClick: async (selection: Resource<Rels.Webhook>[]) => {\n if (!this.data) return;\n\n const url = this.data._links['fx:send_webhooks'].href;\n const api = new Transaction.API(this);\n const response = await api.fetch(url, {\n method: 'POST',\n body: JSON.stringify({\n refeed_hooks: selection.map(hook => getResourceId(hook._links['self'].href)),\n event: 'refeed',\n }),\n });\n\n selection.forEach(hook => {\n Transaction.Rumour('').share({\n related: [\n ...selection.map(hook => hook._links['fx:logs'].href),\n ...selection.map(hook => hook._links['fx:statuses'].href),\n ],\n source: hook._links.self.href,\n data: hook,\n });\n });\n\n if (!response.ok) throw new Error(await response.text());\n },\n },\n ];\n\n get readonlySelector(): BooleanSelector {\n const alwaysMatch = [\n 'billing-addresses',\n 'datafeed:data-is-fed',\n 'webhooks:dialog:url',\n super.readonlySelector,\n ];\n\n const isEditable = Boolean(this.data?._links['fx:void'] ?? this.data?._links['fx:refund']);\n if (!isEditable) alwaysMatch.push('items', 'attributes', 'custom-fields');\n return new BooleanSelector(alwaysMatch.join(' ').trim());\n }\n\n get hiddenSelector(): BooleanSelector {\n const alwaysMatch = [\n 'billing-addresses:dialog:delete',\n 'billing-addresses:dialog:timestamps',\n 'webhooks:dialog:header:copy-json',\n 'webhooks:dialog:header:copy-id',\n 'webhooks:dialog:timestamps',\n 'webhooks:dialog:name',\n 'webhooks:dialog:query',\n 'webhooks:dialog:encryption-key',\n 'webhooks:dialog:delete',\n super.readonlySelector,\n ];\n\n const type = this.data?.type;\n\n if (!this.data?._links['fx:subscription']) alwaysMatch.unshift('subscription');\n if (type === 'subscription_modification') alwaysMatch.unshift('actions');\n\n if (type === 'updateinfo') {\n alwaysMatch.unshift('not=customer,subscription,payments,custom-fields,attributes');\n }\n\n if (type === 'subscription_cancellation') {\n alwaysMatch.unshift('not=customer,subscription,custom-fields,attributes');\n }\n\n if (!this.__storeLoader?.data?.use_webhook) alwaysMatch.unshift('datafeed');\n\n return new BooleanSelector(alwaysMatch.join(' ').trim());\n }\n\n get headerSubtitleOptions(): Record<string, unknown> {\n const source = this.data?.source;\n const type = this.data?.type;\n\n let context = '';\n\n if (type === 'updateinfo') {\n if (!source || source?.startsWith('cit_')) {\n context = 'customer_changed_payment_method';\n } else if (source === 'mit_uoe') {\n context = 'admin_changed_payment_method_with_uoe';\n } else if (source === 'mit_api') {\n context = 'integration_changed_payment_method';\n } else {\n context = 'admin_changed_payment_method';\n }\n } else if (type === 'subscription_modification') {\n if (!source || source?.startsWith('cit_')) {\n context = 'customer_changed_subscription';\n } else if (source === 'mit_uoe') {\n context = 'admin_changed_subscription_with_uoe';\n } else if (source === 'mit_api') {\n context = 'integration_changed_subscription';\n } else {\n context = 'admin_changed_subscription';\n }\n } else if (type === 'subscription_renewal') {\n if (source === 'mit_recurring') {\n context = 'subscription_renewal_attempt';\n } else if (source === 'mit_recurring_reattempt_automated') {\n context = 'subscription_renewal_automated_reattempt';\n } else if (source === 'mit_recurring_reattempt_manual') {\n context = 'subscription_renewal_manual_reattempt';\n }\n } else if (type === 'subscription_cancellation') {\n if (source === 'cit_recurring_cancellation') {\n context = 'customer_canceled_subscription';\n } else if (source === 'mit_recurring_cancellation') {\n context = 'admin_canceled_subscription';\n }\n } else {\n if (this.data?._links['fx:subscription']) {\n if (source?.startsWith('cit_')) {\n context = 'customer_subscribed';\n } else if (source === 'mit_uoe') {\n context = 'admin_subscribed_with_uoe';\n } else if (source === 'mit_api') {\n context = 'integration_subscribed';\n }\n } else {\n if (source?.startsWith('cit_')) {\n context = 'customer_placed_order';\n } else if (source === 'mit_uoe') {\n context = 'admin_placed_order_with_uoe';\n } else if (source === 'mit_api') {\n context = 'integration_placed_order';\n }\n }\n }\n\n return {\n transaction_date: this.data?.transaction_date,\n ip_country: this.data?.ip_country,\n context,\n };\n }\n\n get headerSubtitleBadges(): Badge[] {\n const badges = super.headerSubtitleBadges;\n const folder = this.data?._embedded?.['fx:folder'];\n\n if (folder?.name) {\n const folderColor = folder.color ?? '';\n const colors: Record<string, string> = {\n 'red': 'bg-folder-red text-white',\n 'red_pale': 'bg-folder-red-pale text-black',\n 'green': 'bg-folder-green text-white',\n 'green_pale': 'bg-folder-green-pale text-black',\n 'blue': 'bg-folder-blue text-white',\n 'blue_pale': 'bg-folder-blue-pale text-black',\n 'orange': 'bg-folder-orange text-white',\n 'orange_pale': 'bg-folder-orange-pale text-black',\n 'violet': 'bg-folder-violet text-white',\n 'violet_pale': 'bg-folder-violet-pale text-black',\n '': 'bg-contrast-5 text-body',\n };\n\n badges.push({\n class: colors[folderColor in colors ? folderColor : ''],\n icon: svg`<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 20 20\" fill=\"currentColor\" style=\"width: 1em; height: 1em;\"><path d=\"M3.75 3A1.75 1.75 0 0 0 2 4.75v3.26a3.235 3.235 0 0 1 1.75-.51h12.5c.644 0 1.245.188 1.75.51V6.75A1.75 1.75 0 0 0 16.25 5h-4.836a.25.25 0 0 1-.177-.073L9.823 3.513A1.75 1.75 0 0 0 8.586 3H3.75ZM3.75 9A1.75 1.75 0 0 0 2 10.75v4.5c0 .966.784 1.75 1.75 1.75h12.5A1.75 1.75 0 0 0 18 15.25v-4.5A1.75 1.75 0 0 0 16.25 9H3.75Z\" /></svg>`,\n text: folder.name,\n });\n }\n\n if (this.data?.hide_transaction) badges.push({ key: 'archived' });\n if (this.data?.is_test) badges.push({ key: 'test' });\n\n return badges;\n }\n\n get headerCopyIdValue(): string {\n return this.data?.display_id?.toString() ?? '';\n }\n\n renderHeaderActions(): TemplateResult {\n const store = this.__storeLoader?.data;\n const foldersHref = store?._links['fx:transaction_folders'].href;\n\n return html`\n <foxy-internal-transaction-actions-control\n currency-display=${store?.use_international_currency_symbol ? 'code' : 'symbol'}\n folders=${ifDefined(foldersHref)}\n infer=\"actions\"\n >\n </foxy-internal-transaction-actions-control>\n `;\n }\n\n renderBody(): TemplateResult {\n let shipmentsLink: string | undefined = undefined;\n let webhooksLink: string | undefined = undefined;\n let itemsLink: string | undefined = undefined;\n\n const alertStatuses = ['problem', 'pending_fraud_review', 'rejected', 'declined'];\n const hidden = this.hiddenSelector;\n\n if (this.data) {\n try {\n const shipmentsUrl = new URL(this.data._links['fx:shipments'].href);\n const webhooksUrl = new URL(this.__storeLoader?.data?._links['fx:webhooks'].href ?? '');\n const itemsUrl = new URL(this.data._links['fx:items'].href);\n\n shipmentsUrl.searchParams.set('zoom', 'items:item_category');\n webhooksUrl.searchParams.set('event_resource', 'transaction');\n itemsUrl.searchParams.set('zoom', 'item_options');\n\n shipmentsLink = shipmentsUrl.toString();\n webhooksLink = webhooksUrl.toString();\n itemsLink = itemsUrl.toString();\n } catch {\n //\n }\n }\n\n return html`\n ${this.renderHeader()}\n ${alertStatuses.includes(this.data?.status ?? '')\n ? html`\n <p\n class=\"leading-xs text-body rounded bg-error-10 block\"\n style=\"padding: calc(0.625em + (var(--lumo-border-radius) / 4) - 1px)\"\n >\n <foxy-i18n infer=\"header\" key=\"alert_status_${this.data?.status}\"></foxy-i18n>\n </p>\n `\n : ''}\n\n <foxy-internal-transaction-customer-control infer=\"customer\">\n </foxy-internal-transaction-customer-control>\n\n <div\n class=\"grid gap-s\"\n ?hidden=${hidden.matches('items', true) && hidden.matches('summary', true)}\n >\n <foxy-internal-async-list-control\n infer=\"items\"\n class=\"min-w-0\"\n first=${ifDefined(itemsLink)}\n limit=\"10\"\n item=\"foxy-item-card\"\n form=\"foxy-item-form\"\n alert\n wide\n .related=${[this.href]}\n .itemProps=${{ 'locale-codes': this.localeCodes }}\n .formProps=${{\n 'item-categories': this.__storeLoader?.data?._links['fx:item_categories'].href,\n 'locale-codes': this.localeCodes,\n 'store': this.data?._links['fx:store'].href,\n }}\n >\n </foxy-internal-async-list-control>\n\n <foxy-internal-transaction-summary-control infer=\"summary\" class=\"min-w-0\">\n </foxy-internal-transaction-summary-control>\n </div>\n\n <foxy-internal-async-list-control\n infer=\"billing-addresses\"\n first=${ifDefined(this.data?._links['fx:billing_addresses'].href)}\n item=\"foxy-billing-address-card\"\n form=\"foxy-address-form\"\n hide-create-button\n hide-delete-button\n alert\n >\n </foxy-internal-async-list-control>\n\n <foxy-internal-async-list-control\n infer=\"payments\"\n first=${ifDefined(this.data?._links['fx:payments'].href)}\n item=\"foxy-payment-card\"\n .itemProps=${{\n 'hosted-payment-gateways-helper': this.hostedPaymentGatewaysHelper,\n 'payment-gateways-helper': this.paymentGatewaysHelper,\n }}\n >\n </foxy-internal-async-list-control>\n\n <foxy-internal-async-list-control\n infer=\"custom-fields\"\n class=\"min-w-0\"\n first=${ifDefined(this.data?._links['fx:custom_fields'].href)}\n limit=\"5\"\n form=\"foxy-custom-field-form\"\n item=\"foxy-custom-field-card\"\n alert\n >\n </foxy-internal-async-list-control>\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 limit=\"5\"\n form=\"foxy-attribute-form\"\n item=\"foxy-attribute-card\"\n alert\n >\n </foxy-internal-async-list-control>\n\n <foxy-internal-async-list-control\n infer=\"shipments\"\n first=${ifDefined(shipmentsLink)}\n item=\"foxy-shipment-card\"\n >\n </foxy-internal-async-list-control>\n\n <foxy-internal-async-list-control\n infer=\"webhooks\"\n first=${ifDefined(webhooksLink)}\n item=\"foxy-webhook-card\"\n form=\"foxy-webhook-form\"\n hide-create-button\n hide-delete-button\n alert\n .bulkActions=${this.__webhooksBulkActions}\n .itemProps=${{ 'resource-uri': this.href }}\n .formProps=${{ 'resource-uri': this.href }}\n >\n </foxy-internal-async-list-control>\n\n <foxy-internal-summary-control infer=\"datafeed\">\n <foxy-internal-switch-control infer=\"data-is-fed\"></foxy-internal-switch-control>\n <foxy-internal-post-action-control\n infer=\"process-webhook\"\n theme=\"tertiary-inline\"\n href=${ifDefined(this.data?._links['fx:process_webhook']?.href)}\n @success=${() => this.refresh()}\n >\n </foxy-internal-post-action-control>\n </foxy-internal-summary-control>\n\n <foxy-nucleon\n class=\"hidden\"\n infer=\"\"\n href=${ifDefined(this.data?._links['fx:store'].href)}\n id=\"storeLoader\"\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>('#storeLoader');\n }\n}\n"]}
|
|
@@ -2,8 +2,10 @@ import type { PropertyDeclarations, TemplateResult } from 'lit-element';
|
|
|
2
2
|
import { InternalControl } from '../../../../internal/InternalControl/InternalControl';
|
|
3
3
|
export declare class InternalTransactionActionsControl extends InternalControl {
|
|
4
4
|
static get properties(): PropertyDeclarations;
|
|
5
|
+
currencyDisplay: string | null;
|
|
5
6
|
folders: string | null;
|
|
6
7
|
renderControl(): TemplateResult;
|
|
8
|
+
private get __refundAmount();
|
|
7
9
|
private __renderSendEmailsAction;
|
|
8
10
|
private __renderCaptureAction;
|
|
9
11
|
private __renderVoidAction;
|
|
@@ -4,11 +4,13 @@ import { html, svg } from 'lit-html';
|
|
|
4
4
|
export class InternalTransactionActionsControl extends InternalControl {
|
|
5
5
|
constructor() {
|
|
6
6
|
super(...arguments);
|
|
7
|
+
this.currencyDisplay = null;
|
|
7
8
|
this.folders = null;
|
|
8
9
|
}
|
|
9
10
|
static get properties() {
|
|
10
11
|
return {
|
|
11
12
|
...super.properties,
|
|
13
|
+
currencyDisplay: { attribute: 'currency-display' },
|
|
12
14
|
folders: {},
|
|
13
15
|
};
|
|
14
16
|
}
|
|
@@ -27,6 +29,13 @@ export class InternalTransactionActionsControl extends InternalControl {
|
|
|
27
29
|
</div>
|
|
28
30
|
`;
|
|
29
31
|
}
|
|
32
|
+
get __refundAmount() {
|
|
33
|
+
var _a, _b, _c, _d;
|
|
34
|
+
const data = (_a = this.nucleon) === null || _a === void 0 ? void 0 : _a.data;
|
|
35
|
+
const originalTotal = (_b = data === null || data === void 0 ? void 0 : data.total_order) !== null && _b !== void 0 ? _b : 0;
|
|
36
|
+
// @ts-expect-error SDK types do not include amount on fx:refund
|
|
37
|
+
return parseFloat((_d = (_c = data === null || data === void 0 ? void 0 : data._links['fx:refund']) === null || _c === void 0 ? void 0 : _c.amount) !== null && _d !== void 0 ? _d : originalTotal);
|
|
38
|
+
}
|
|
30
39
|
__renderSendEmailsAction() {
|
|
31
40
|
var _a, _b;
|
|
32
41
|
return html `
|
|
@@ -64,12 +73,17 @@ export class InternalTransactionActionsControl extends InternalControl {
|
|
|
64
73
|
`;
|
|
65
74
|
}
|
|
66
75
|
__renderRefundAction() {
|
|
67
|
-
var _a, _b, _c;
|
|
76
|
+
var _a, _b, _c, _d, _e;
|
|
77
|
+
const currencyCode = (_b = (_a = this.nucleon) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.currency_code;
|
|
68
78
|
return html `
|
|
69
79
|
<foxy-internal-post-action-control
|
|
80
|
+
message-options=${JSON.stringify({
|
|
81
|
+
currencyDisplay: this.currencyDisplay,
|
|
82
|
+
amount: `${this.__refundAmount} ${currencyCode}`,
|
|
83
|
+
})}
|
|
70
84
|
infer="refund"
|
|
71
85
|
theme="tertiary-inline"
|
|
72
|
-
href=${ifDefined((
|
|
86
|
+
href=${ifDefined((_e = (_d = (_c = this.nucleon) === null || _c === void 0 ? void 0 : _c.data) === null || _d === void 0 ? void 0 : _d._links['fx:refund']) === null || _e === void 0 ? void 0 : _e.href)}
|
|
73
87
|
@success=${() => { var _a; return (_a = this.nucleon) === null || _a === void 0 ? void 0 : _a.refresh(); }}
|
|
74
88
|
>
|
|
75
89
|
</foxy-internal-post-action-control>
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"InternalTransactionActionsControl.js","sourceRoot":"","sources":["../../../../../../src/elements/public/Transaction/internal/InternalTransactionActionsControl/InternalTransactionActionsControl.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,eAAe,EAAE,gEAA6D;AACvF,OAAO,EAAE,SAAS,EAAE,MAAM,gCAAgC,CAAC;AAC3D,OAAO,EAAE,IAAI,EAAE,GAAG,EAAE,MAAM,UAAU,CAAC;AAGrC,MAAM,OAAO,iCAAkC,SAAQ,eAAe;IAAtE;;QAQE,YAAO,GAAkB,IAAI,CAAC;IA2KhC,CAAC;IAlLC,MAAM,KAAK,UAAU;QACnB,OAAO;YACL,GAAG,KAAK,CAAC,UAAU;YACnB,OAAO,EAAE,EAAE;SACZ,CAAC;IACJ,CAAC;IAID,aAAa;;QACX,OAAO,IAAI,CAAA;;UAEL,aAAA,IAAI,CAAC,OAAO,0CAAE,IAAI,0CAAE,MAAM,CAAC,YAAY,GAAE,CAAC,CAAC,IAAI,CAAC,qBAAqB,EAAE,CAAC,CAAC,CAAC,EAAE;UAC5E,aAAA,IAAI,CAAC,OAAO,0CAAE,IAAI,0CAAE,MAAM,CAAC,SAAS,GAAE,CAAC,CAAC,IAAI,CAAC,kBAAkB,EAAE,CAAC,CAAC,CAAC,EAAE;UACtE,aAAA,IAAI,CAAC,OAAO,0CAAE,IAAI,0CAAE,MAAM,CAAC,WAAW,GAAE,CAAC,CAAC,IAAI,CAAC,oBAAoB,EAAE,CAAC,CAAC,CAAC,EAAE;UAC1E,aAAA,IAAI,CAAC,OAAO,0CAAE,IAAI,0CAAE,MAAM,CAAC,gBAAgB,GAAE,CAAC,CAAC,IAAI,CAAC,wBAAwB,EAAE,CAAC,CAAC,CAAC,EAAE;UACnF,aAAA,IAAI,CAAC,OAAO,0CAAE,IAAI,0CAAE,MAAM,CAAC,iBAAiB,GAAE,CAAC,CAAC,IAAI,CAAC,0BAA0B,EAAE,CAAC,CAAC,CAAC,EAAE;UACtF,aAAA,IAAI,CAAC,OAAO,0CAAE,IAAI,0CAAE,MAAM,CAAC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,UAAU,CAAC;YACxD,OAAO,IAAI,CAAA;gCACO,UAAU,cAAc,UAAU,cAAc,UAAU;oBACtE,MAAM,CAAC,IAAI;;eAEhB,CAAC;QACJ,CAAC,CAAC;;;KAGT,CAAC;IACJ,CAAC;CACF","sourcesContent":["import type { PropertyDeclarations, TemplateResult } from 'lit-element';\nimport type { NucleonElement } from '../../../NucleonElement/NucleonElement';\nimport type { Transaction } from '../../Transaction';\nimport type { Resource } from '@foxy.io/sdk/core';\n\nimport { InternalControl } from '../../../../internal/InternalControl/InternalControl';\nimport { ifDefined } from 'lit-html/directives/if-defined';\nimport { html, svg } from 'lit-html';\nimport { Rels } from '@foxy.io/sdk/backend';\n\nexport class InternalTransactionActionsControl extends InternalControl {\n static get properties(): PropertyDeclarations {\n return {\n ...super.properties,\n folders: {},\n };\n }\n\n folders: string | null = null;\n\n renderControl(): TemplateResult {\n return html`\n <div class=\"flex flex-wrap gap-x-m gap-y-xs\">\n ${this.nucleon?.data?._links['fx:capture'] ? this.__renderCaptureAction() : ''}\n ${this.nucleon?.data?._links['fx:void'] ? this.__renderVoidAction() : ''}\n ${this.nucleon?.data?._links['fx:refund'] ? this.__renderRefundAction() : ''}\n ${this.nucleon?.data?._links['fx:send_emails'] ? this.__renderSendEmailsAction() : ''}\n ${this.nucleon?.data?._links['fx:subscription'] ? this.__renderSubscriptionAction() : ''}\n ${this.nucleon?.data?._links['fx:receipt'] ? this.__renderReceiptAction() : ''}\n ${this.__renderArchiveAction()}\n ${this.folders ? this.__renderFolderSelector(this.folders) : ''}\n </div>\n `;\n }\n\n private __renderSendEmailsAction() {\n return html`\n <foxy-internal-post-action-control\n infer=\"send-emails\"\n theme=\"tertiary-inline\"\n href=${ifDefined(this.nucleon?.data?._links['fx:send_emails'].href)}\n @success=${() => this.nucleon?.refresh()}\n >\n </foxy-internal-post-action-control>\n `;\n }\n\n private __renderCaptureAction() {\n return html`\n <foxy-internal-post-action-control\n theme=\"tertiary-inline success\"\n infer=\"capture\"\n href=${ifDefined(this.nucleon?.data?._links['fx:capture'].href)}\n @success=${() => this.nucleon?.refresh()}\n >\n </foxy-internal-post-action-control>\n `;\n }\n\n private __renderVoidAction() {\n return html`\n <foxy-internal-post-action-control\n theme=\"tertiary-inline error\"\n infer=\"void\"\n href=${ifDefined(this.nucleon?.data?._links['fx:void']?.href)}\n @success=${() => this.nucleon?.refresh()}\n >\n </foxy-internal-post-action-control>\n `;\n }\n\n private __renderRefundAction() {\n return html`\n <foxy-internal-post-action-control\n infer=\"refund\"\n theme=\"tertiary-inline\"\n href=${ifDefined(this.nucleon?.data?._links['fx:refund']?.href)}\n @success=${() => this.nucleon?.refresh()}\n >\n </foxy-internal-post-action-control>\n `;\n }\n\n private __renderSubscriptionAction() {\n const host = this.nucleon as Transaction | null;\n const subHref = host?.data?._links['fx:subscription']?.href;\n const subPageHref = subHref ? host?.getSubscriptionPageHref?.(subHref) : void 0;\n\n return html`\n <a\n 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\"\n href=${ifDefined(subPageHref)}\n >\n <foxy-i18n infer=\"subscription\" key=\"caption\"></foxy-i18n>\n </a>\n `;\n }\n\n private __renderReceiptAction() {\n const host = this.nucleon as Transaction | null;\n\n return html`\n <a\n target=\"_blank\"\n 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\"\n href=${ifDefined(host?.data?._links['fx:receipt']?.href)}\n >\n <foxy-i18n infer=\"receipt\" key=\"caption\"></foxy-i18n>\n </a>\n `;\n }\n\n private __renderArchiveAction() {\n const host = this.nucleon as Transaction | null;\n\n return html`\n <vaadin-button\n theme=\"tertiary-inline\"\n ?disabled=${this.disabledSelector.matches('archive', true)}\n @click=${() => {\n host?.edit({ hide_transaction: !host?.form.hide_transaction });\n host?.submit();\n }}\n >\n <foxy-i18n\n infer=\"archive\"\n key=\"caption_${host?.form.hide_transaction ? 'unarchive' : 'archive'}\"\n >\n </foxy-i18n>\n </vaadin-button>\n `;\n }\n\n private __renderFolderSelector(foldersHref: string) {\n type FoldersLoader = NucleonElement<Resource<Rels.StoreTransactionFolders>>;\n\n const foldersLoader = this.renderRoot.querySelector<FoldersLoader>('#foldersLoader');\n const folders = Array.from(foldersLoader?.data?._embedded?.['fx:transaction_folders'] ?? []);\n const host = this.nucleon as Transaction | null;\n\n return html`\n <foxy-nucleon\n class=\"hidden\"\n infer=\"\"\n href=${foldersHref}\n id=\"foldersLoader\"\n @update=${() => this.requestUpdate()}\n >\n </foxy-nucleon>\n\n <label\n class=\"group relative rounded focus-within-ring-2 focus-within-ring-primary-50\"\n ?hidden=${folders.length === 0}\n >\n <span\n class=\"inline-flex items-center gap-xs relative transition-opacity group-hover-opacity-80\"\n >\n <foxy-i18n class=\"font-medium text-primary\" infer=\"folder\" key=\"caption\"></foxy-i18n>\n ${svg`<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 20 20\" fill=\"currentColor\" class=\"text-primary transform scale-125\" style=\"width: 1em; height: 1em\"><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>`}\n </span>\n\n <select\n class=\"absolute inset-0 opacity-0 cursor-pointer\"\n ?disabled=${this.disabled}\n ?readonly=${this.readonly}\n @change=${(evt: Event) => {\n host?.edit({ folder_uri: (evt.currentTarget as HTMLSelectElement).value });\n host?.submit(false);\n }}\n >\n <option value=\"\" ?selected=${!host?.form.folder_uri} ?disabled=${!host?.form.folder_uri}>\n ${this.t('folder.option_none')}\n </option>\n\n ${folders\n .sort((a, b) => a.sort_order - b.sort_order)\n .map(folder => {\n const folderHref = folder._links.self.href;\n const isSelected = host?.form.folder_uri === folderHref;\n return html`\n <option value=${folderHref} ?selected=${isSelected} ?disabled=${isSelected}>\n ${folder.name}\n </option>\n `;\n })}\n </select>\n </label>\n `;\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"InternalTransactionActionsControl.js","sourceRoot":"","sources":["../../../../../../src/elements/public/Transaction/internal/InternalTransactionActionsControl/InternalTransactionActionsControl.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,eAAe,EAAE,gEAA6D;AACvF,OAAO,EAAE,SAAS,EAAE,MAAM,gCAAgC,CAAC;AAC3D,OAAO,EAAE,IAAI,EAAE,GAAG,EAAE,MAAM,UAAU,CAAC;AAGrC,MAAM,OAAO,iCAAkC,SAAQ,eAAe;IAAtE;;QASE,oBAAe,GAAkB,IAAI,CAAC;QAEtC,YAAO,GAAkB,IAAI,CAAC;IAwLhC,CAAC;IAlMC,MAAM,KAAK,UAAU;QACnB,OAAO;YACL,GAAG,KAAK,CAAC,UAAU;YACnB,eAAe,EAAE,EAAE,SAAS,EAAE,kBAAkB,EAAE;YAClD,OAAO,EAAE,EAAE;SACZ,CAAC;IACJ,CAAC;IAMD,aAAa;;QACX,OAAO,IAAI,CAAA;;UAEL,aAAA,IAAI,CAAC,OAAO,0CAAE,IAAI,0CAAE,MAAM,CAAC,YAAY,GAAE,CAAC,CAAC,IAAI,CAAC,qBAAqB,EAAE,CAAC,CAAC,CAAC,EAAE;UAC5E,aAAA,IAAI,CAAC,OAAO,0CAAE,IAAI,0CAAE,MAAM,CAAC,SAAS,GAAE,CAAC,CAAC,IAAI,CAAC,kBAAkB,EAAE,CAAC,CAAC,CAAC,EAAE;UACtE,aAAA,IAAI,CAAC,OAAO,0CAAE,IAAI,0CAAE,MAAM,CAAC,WAAW,GAAE,CAAC,CAAC,IAAI,CAAC,oBAAoB,EAAE,CAAC,CAAC,CAAC,EAAE;UAC1E,aAAA,IAAI,CAAC,OAAO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;;;;;YAM1B,GAAG,CAAA,icAAic;;;;;sBAK1b,IAAI,CAAC,QAAQ;sBACb,IAAI,CAAC,QAAQ;oBACf,CAAC,GAAU,EAAE,EAAE;YACvB,IAAI,aAAJ,IAAI,uBAAJ,IAAI,CAAE,IAAI,CAAC,EAAE,UAAU,EAAG,GAAG,CAAC,aAAmC,CAAC,KAAK,EAAE,EAAE;YAC3E,IAAI,aAAJ,IAAI,uBAAJ,IAAI,CAAE,MAAM,CAAC,KAAK,EAAE;QACtB,CAAC;;uCAE4B,EAAC,IAAI,aAAJ,IAAI,uBAAJ,IAAI,CAAE,IAAI,CAAC,UAAU,CAAA,cAAc,EAAC,IAAI,aAAJ,IAAI,uBAAJ,IAAI,CAAE,IAAI,CAAC,UAAU,CAAA;cACnF,IAAI,CAAC,CAAC,CAAC,oBAAoB,CAAC;;;YAG9B,OAAO;aACN,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,UAAU,GAAG,CAAC,CAAC,UAAU,CAAC;aAC3C,GAAG,CAAC,MAAM,CAAC,EAAE;YACZ,MAAM,UAAU,GAAG,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC;YAC3C,MAAM,UAAU,GAAG,CAAA,IAAI,aAAJ,IAAI,uBAAJ,IAAI,CAAE,IAAI,CAAC,UAAU,MAAK,UAAU,CAAC;YACxD,OAAO,IAAI,CAAA;gCACO,UAAU,cAAc,UAAU,cAAc,UAAU;oBACtE,MAAM,CAAC,IAAI;;eAEhB,CAAC;QACJ,CAAC,CAAC;;;KAGT,CAAC;IACJ,CAAC;CACF","sourcesContent":["import type { PropertyDeclarations, TemplateResult } from 'lit-element';\nimport type { NucleonElement } from '../../../NucleonElement/NucleonElement';\nimport type { Transaction } from '../../Transaction';\nimport type { Resource } from '@foxy.io/sdk/core';\n\nimport { InternalControl } from '../../../../internal/InternalControl/InternalControl';\nimport { ifDefined } from 'lit-html/directives/if-defined';\nimport { html, svg } from 'lit-html';\nimport { Rels } from '@foxy.io/sdk/backend';\n\nexport class InternalTransactionActionsControl extends InternalControl {\n static get properties(): PropertyDeclarations {\n return {\n ...super.properties,\n currencyDisplay: { attribute: 'currency-display' },\n folders: {},\n };\n }\n\n currencyDisplay: string | null = null;\n\n folders: string | null = null;\n\n renderControl(): TemplateResult {\n return html`\n <div class=\"flex flex-wrap gap-x-m gap-y-xs\">\n ${this.nucleon?.data?._links['fx:capture'] ? this.__renderCaptureAction() : ''}\n ${this.nucleon?.data?._links['fx:void'] ? this.__renderVoidAction() : ''}\n ${this.nucleon?.data?._links['fx:refund'] ? this.__renderRefundAction() : ''}\n ${this.nucleon?.data?._links['fx:send_emails'] ? this.__renderSendEmailsAction() : ''}\n ${this.nucleon?.data?._links['fx:subscription'] ? this.__renderSubscriptionAction() : ''}\n ${this.nucleon?.data?._links['fx:receipt'] ? this.__renderReceiptAction() : ''}\n ${this.__renderArchiveAction()}\n ${this.folders ? this.__renderFolderSelector(this.folders) : ''}\n </div>\n `;\n }\n\n private get __refundAmount(): number {\n const data = (this.nucleon as Transaction | null)?.data;\n const originalTotal = data?.total_order ?? 0;\n // @ts-expect-error SDK types do not include amount on fx:refund\n return parseFloat(data?._links['fx:refund']?.amount ?? originalTotal);\n }\n\n private __renderSendEmailsAction() {\n return html`\n <foxy-internal-post-action-control\n infer=\"send-emails\"\n theme=\"tertiary-inline\"\n href=${ifDefined(this.nucleon?.data?._links['fx:send_emails'].href)}\n @success=${() => this.nucleon?.refresh()}\n >\n </foxy-internal-post-action-control>\n `;\n }\n\n private __renderCaptureAction() {\n return html`\n <foxy-internal-post-action-control\n theme=\"tertiary-inline success\"\n infer=\"capture\"\n href=${ifDefined(this.nucleon?.data?._links['fx:capture'].href)}\n @success=${() => this.nucleon?.refresh()}\n >\n </foxy-internal-post-action-control>\n `;\n }\n\n private __renderVoidAction() {\n return html`\n <foxy-internal-post-action-control\n theme=\"tertiary-inline error\"\n infer=\"void\"\n href=${ifDefined(this.nucleon?.data?._links['fx:void']?.href)}\n @success=${() => this.nucleon?.refresh()}\n >\n </foxy-internal-post-action-control>\n `;\n }\n\n private __renderRefundAction() {\n const currencyCode = (this.nucleon as Transaction | null)?.data?.currency_code;\n\n return html`\n <foxy-internal-post-action-control\n message-options=${JSON.stringify({\n currencyDisplay: this.currencyDisplay,\n amount: `${this.__refundAmount} ${currencyCode}`,\n })}\n infer=\"refund\"\n theme=\"tertiary-inline\"\n href=${ifDefined(this.nucleon?.data?._links['fx:refund']?.href)}\n @success=${() => this.nucleon?.refresh()}\n >\n </foxy-internal-post-action-control>\n `;\n }\n\n private __renderSubscriptionAction() {\n const host = this.nucleon as Transaction | null;\n const subHref = host?.data?._links['fx:subscription']?.href;\n const subPageHref = subHref ? host?.getSubscriptionPageHref?.(subHref) : void 0;\n\n return html`\n <a\n 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\"\n href=${ifDefined(subPageHref)}\n >\n <foxy-i18n infer=\"subscription\" key=\"caption\"></foxy-i18n>\n </a>\n `;\n }\n\n private __renderReceiptAction() {\n const host = this.nucleon as Transaction | null;\n\n return html`\n <a\n target=\"_blank\"\n 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\"\n href=${ifDefined(host?.data?._links['fx:receipt']?.href)}\n >\n <foxy-i18n infer=\"receipt\" key=\"caption\"></foxy-i18n>\n </a>\n `;\n }\n\n private __renderArchiveAction() {\n const host = this.nucleon as Transaction | null;\n\n return html`\n <vaadin-button\n theme=\"tertiary-inline\"\n ?disabled=${this.disabledSelector.matches('archive', true)}\n @click=${() => {\n host?.edit({ hide_transaction: !host?.form.hide_transaction });\n host?.submit();\n }}\n >\n <foxy-i18n\n infer=\"archive\"\n key=\"caption_${host?.form.hide_transaction ? 'unarchive' : 'archive'}\"\n >\n </foxy-i18n>\n </vaadin-button>\n `;\n }\n\n private __renderFolderSelector(foldersHref: string) {\n type FoldersLoader = NucleonElement<Resource<Rels.StoreTransactionFolders>>;\n\n const foldersLoader = this.renderRoot.querySelector<FoldersLoader>('#foldersLoader');\n const folders = Array.from(foldersLoader?.data?._embedded?.['fx:transaction_folders'] ?? []);\n const host = this.nucleon as Transaction | null;\n\n return html`\n <foxy-nucleon\n class=\"hidden\"\n infer=\"\"\n href=${foldersHref}\n id=\"foldersLoader\"\n @update=${() => this.requestUpdate()}\n >\n </foxy-nucleon>\n\n <label\n class=\"group relative rounded focus-within-ring-2 focus-within-ring-primary-50\"\n ?hidden=${folders.length === 0}\n >\n <span\n class=\"inline-flex items-center gap-xs relative transition-opacity group-hover-opacity-80\"\n >\n <foxy-i18n class=\"font-medium text-primary\" infer=\"folder\" key=\"caption\"></foxy-i18n>\n ${svg`<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 20 20\" fill=\"currentColor\" class=\"text-primary transform scale-125\" style=\"width: 1em; height: 1em\"><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>`}\n </span>\n\n <select\n class=\"absolute inset-0 opacity-0 cursor-pointer\"\n ?disabled=${this.disabled}\n ?readonly=${this.readonly}\n @change=${(evt: Event) => {\n host?.edit({ folder_uri: (evt.currentTarget as HTMLSelectElement).value });\n host?.submit(false);\n }}\n >\n <option value=\"\" ?selected=${!host?.form.folder_uri} ?disabled=${!host?.form.folder_uri}>\n ${this.t('folder.option_none')}\n </option>\n\n ${folders\n .sort((a, b) => a.sort_order - b.sort_order)\n .map(folder => {\n const folderHref = folder._links.self.href;\n const isSelected = host?.form.folder_uri === folderHref;\n return html`\n <option value=${folderHref} ?selected=${isSelected} ?disabled=${isSelected}>\n ${folder.name}\n </option>\n `;\n })}\n </select>\n </label>\n `;\n }\n}\n"]}
|
|
@@ -3,6 +3,7 @@ import { InternalControl } from '../../../../internal/InternalControl/InternalCo
|
|
|
3
3
|
export declare class InternalTransactionSummaryControl extends InternalControl {
|
|
4
4
|
private readonly __storeLoaderId;
|
|
5
5
|
renderControl(): TemplateResult;
|
|
6
|
+
private get __refundableAmount();
|
|
6
7
|
private get __storeHref();
|
|
7
8
|
private get __store();
|
|
8
9
|
private __renderPrice;
|
|
@@ -13,6 +13,7 @@ export class InternalTransactionSummaryControl extends InternalControl {
|
|
|
13
13
|
return html ``;
|
|
14
14
|
const taxes = (_c = (_b = data === null || data === void 0 ? void 0 : data._embedded) === null || _b === void 0 ? void 0 : _b['fx:applied_taxes']) !== null && _c !== void 0 ? _c : [];
|
|
15
15
|
const shipments = (_e = (_d = data._embedded) === null || _d === void 0 ? void 0 : _d['fx:shipments']) !== null && _e !== void 0 ? _e : [];
|
|
16
|
+
const refundableAmount = this.__refundableAmount;
|
|
16
17
|
return html `
|
|
17
18
|
<foxy-nucleon
|
|
18
19
|
infer=""
|
|
@@ -80,9 +81,38 @@ export class InternalTransactionSummaryControl extends InternalControl {
|
|
|
80
81
|
${this.__renderPrice(data.total_order)}
|
|
81
82
|
</span>
|
|
82
83
|
</span>
|
|
84
|
+
|
|
85
|
+
${refundableAmount !== data.total_order
|
|
86
|
+
? html `
|
|
87
|
+
<span class="col-span-2 border-t border-dashed border-contrast-20 my-s"></span>
|
|
88
|
+
<span class="col-span-2 flex justify-end">
|
|
89
|
+
<span>
|
|
90
|
+
<span class="text-xl font-medium leading-xs">
|
|
91
|
+
<foxy-i18n infer="" key="refundable_amount"></foxy-i18n>:
|
|
92
|
+
${this.__renderPrice(refundableAmount)}
|
|
93
|
+
</span>
|
|
94
|
+
<br />
|
|
95
|
+
<foxy-i18n
|
|
96
|
+
class="inline-block whitespace-normal leading-s text-tertiary"
|
|
97
|
+
style="max-width: 48ch"
|
|
98
|
+
infer=""
|
|
99
|
+
key="refundable_amount_note"
|
|
100
|
+
>
|
|
101
|
+
</foxy-i18n>
|
|
102
|
+
</span>
|
|
103
|
+
</span>
|
|
104
|
+
`
|
|
105
|
+
: ''}
|
|
83
106
|
</p>
|
|
84
107
|
`;
|
|
85
108
|
}
|
|
109
|
+
get __refundableAmount() {
|
|
110
|
+
var _a, _b, _c, _d;
|
|
111
|
+
const data = (_a = this.nucleon) === null || _a === void 0 ? void 0 : _a.data;
|
|
112
|
+
const originalTotal = (_b = data === null || data === void 0 ? void 0 : data.total_order) !== null && _b !== void 0 ? _b : 0;
|
|
113
|
+
// @ts-expect-error SDK types do not include amount on fx:refund
|
|
114
|
+
return parseFloat((_d = (_c = data === null || data === void 0 ? void 0 : data._links['fx:refund']) === null || _c === void 0 ? void 0 : _c.amount) !== null && _d !== void 0 ? _d : originalTotal);
|
|
115
|
+
}
|
|
86
116
|
get __storeHref() {
|
|
87
117
|
var _a, _b, _c;
|
|
88
118
|
return (_c = (_b = (_a = this.nucleon) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b._links['fx:store']) === null || _c === void 0 ? void 0 : _c.href;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"InternalTransactionSummaryControl.js","sourceRoot":"","sources":["../../../../../../src/elements/public/Transaction/internal/InternalTransactionSummaryControl/InternalTransactionSummaryControl.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,eAAe,EAAE,gEAA6D;AACvF,OAAO,EAAE,SAAS,EAAE,MAAM,gCAAgC,CAAC;AAC3D,OAAO,EAAE,IAAI,EAAE,MAAM,UAAU,CAAC;AAEhC,MAAM,OAAO,iCAAkC,SAAQ,eAAe;IAAtE;;QACmB,oBAAe,GAAG,aAAa,CAAC;IAmInD,CAAC;IAjIC,aAAa;;QACX,MAAM,IAAI,GAAG,MAAA,IAAI,CAAC,OAAO,0CAAE,I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ACxC;aAAM;YACL,KAAK,GAAG,yBAAyB,CAAC;SACnC;QAED,OAAO,IAAI,CAAA;;;iBAGE,KAAK;sBACA,MAAM;;KAEvB,CAAC;IACJ,CAAC;CACF","sourcesContent":["import type { NucleonElement } from '../../../NucleonElement/NucleonElement';\nimport type { TemplateResult } from 'lit-html';\nimport type { Resource } from '@foxy.io/sdk/core';\nimport type { Data } from '../../types';\nimport type { Rels } from '@foxy.io/sdk/backend';\n\nimport { InternalControl } from '../../../../internal/InternalControl/InternalControl';\nimport { ifDefined } from 'lit-html/directives/if-defined';\nimport { html } from 'lit-html';\n\nexport class InternalTransactionSummaryControl extends InternalControl {\n private readonly __storeLoaderId = 'storeLoader';\n\n renderControl(): TemplateResult {\n const data = this.nucleon?.data as Data | undefined;\n if (!data) return html``;\n\n const taxes = data?._embedded?.['fx:applied_taxes'] ?? [];\n const shipments = data._embedded?.['fx:shipments'] ?? [];\n\n return html`\n <foxy-nucleon\n infer=\"\"\n href=${ifDefined(this.__storeHref)}\n id=${this.__storeLoaderId}\n @update=${() => this.requestUpdate()}\n >\n </foxy-nucleon>\n\n <p\n class=\"grid gap-x-s text-right text-s leading-m border-dashed border rounded border-contrast-20 whitespace-nowrap overflow-auto\"\n style=\"padding: calc(0.625em + (var(--lumo-border-radius) / 4) - 2px); grid-template-columns: 1fr min-content\"\n >\n <span><foxy-i18n key=\"subtotal\" infer=\"\"></foxy-i18n>:</span>\n <span>${this.__renderPrice(data.total_item_price as unknown as number)}</span>\n\n ${shipments.length === 0 || (data.total_shipping as unknown as number) === 0\n ? html`\n <span><foxy-i18n infer=\"\" key=\"total_shipping\"></foxy-i18n>:</span>\n <span>${this.__renderPrice(data.total_shipping as unknown as number, true)} </span>\n `\n : shipments.map(shipment => {\n return html`\n <span>${shipment.shipping_service_description}:</span>\n <span>${this.__renderPrice(shipment.total_shipping, true)}</span>\n `;\n })}\n ${taxes.length === 0 || (data.total_tax as unknown as number) === 0\n ? html`\n <span><foxy-i18n infer=\"\" key=\"total_tax\"></foxy-i18n>:</span>\n <span>${this.__renderPrice(data.total_tax as unknown as number, true)}</span>\n `\n : taxes.map(tax => {\n return html`\n <span>${tax.name}:</span>\n <span>${this.__renderPrice(tax.amount, true)}</span>\n `;\n })}\n ${data?._embedded?.['fx:gift_card_code_logs']?.map(log => {\n // @ts-expect-error deep zoom is not supported by the SDK types\n const name = log._embedded?.['fx:gift_card']?.name;\n // @ts-expect-error deep zoom is not supported by the SDK types\n const code = log._embedded?.['fx:gift_card_code']?.code;\n\n if (name && code) {\n return html`\n <span data-testclass=\"gift-card-code\">${name} • ${code}:</span>\n <span>${this.__renderPrice(log.balance_adjustment ?? 0, true)}</span>\n `;\n }\n })}\n ${data?._embedded?.['fx:discounts']?.map(({ name, code: c, amount }) => {\n return html`\n <span data-testclass=\"discount\">${name}${c ? html` • ${c}` : ''}:</span>\n <span>${this.__renderPrice(amount, true)}</span>\n `;\n })}\n\n <span class=\"col-span-2 border-t border-dashed border-contrast-20 my-s\"></span>\n\n <span class=\"col-span-2 flex gap-s justify-between items-center\">\n ${this.__renderStatus()}\n <span class=\"text-xl font-medium leading-xs\">\n <foxy-i18n infer=\"\" key=\"total\"></foxy-i18n>:\n ${this.__renderPrice(data.total_order)}\n </span>\n </span>\n </p>\n `;\n }\n\n private get __storeHref() {\n return this.nucleon?.data?._links['fx:store']?.href as string | undefined;\n }\n\n private get __store() {\n type Loader = NucleonElement<Resource<Rels.Store>>;\n const selector = `#${this.__storeLoaderId}`;\n return this.renderRoot.querySelector<Loader>(selector)?.data ?? null;\n }\n\n private __renderPrice(amount: number, isAdditive = false) {\n const currencyDisplay = this.__store?.use_international_currency_symbol ? 'code' : 'symbol';\n const currencyCode = this.nucleon?.data?.currency_code as string | undefined;\n\n return html`\n <foxy-i18n\n class=${isAdditive && amount !== 0 ? (amount > 0 ? 'text-success' : 'text-error') : ''}\n infer=\"\"\n key=\"price\"\n .options=${{\n currencyDisplay,\n signDisplay: isAdditive ? 'exceptZero' : 'auto',\n amount: `${amount} ${currencyCode}`,\n }}\n >\n </foxy-i18n>\n `;\n }\n\n private __renderStatus() {\n const status = this.nucleon?.data?.status || 'completed';\n let color = '';\n\n if (['capturing', 'captured', 'approved', 'authorized', 'pending'].includes(status)) {\n color = 'text-success bg-success-10';\n } else if (!status || status === 'completed') {\n color = 'text-success-contrast bg-success';\n } else if (['problem', 'pending_fraud_review', 'rejected', 'declined'].includes(status)) {\n color = 'text-error-contrast bg-error';\n } else {\n color = 'bg-contrast-5 text-body';\n }\n\n return html`\n <foxy-i18n\n infer=\"\"\n class=\"${color} rounded-s py-xs px-s font-medium text-s leading-xs\"\n key=\"status_${status}\"\n ></foxy-i18n>\n `;\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"InternalTransactionSummaryControl.js","sourceRoot":"","sources":["../../../../../../src/elements/public/Transaction/internal/InternalTransactionSummaryControl/InternalTransactionSummaryControl.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,eAAe,EAAE,gEAA6D;AACvF,OAAO,EAAE,SAAS,EAAE,MAAM,gCAAgC,CAAC;AAC3D,OAAO,EAAE,IAAI,EAAE,MAAM,UAAU,CAAC;AAEhC,MAAM,OAAO,iCAAkC,SAAQ,eAAe;IAAtE;;QACmB,oBAAe,GAAG,aAAa,CAAC;IAiKnD,CAAC;IA/JC,aAAa;;QACX,MAAM,IAAI,GAAG,MAAA,IAAI,CAAC,OAAO,0CAAE,IAAwB,CAAC;QACpD,IAAI,CAAC,IAAI;YAAE,OAAO,IAAI,CAAA,EAAE,CAAC;QAEzB,MAAM,KAAK,eAAG,IAAI,aAAJ,IAAI,uBAAJ,IAAI,CAAE,SAAS,0CAAG,kBAAkB,oCAAK,EAAE,CAAC;QAC1D,MAAM,SAAS,eAAG,IAAI,CAAC,SAAS,0CAAG,cAAc,oCAAK,EAAE,CAAC;QACzD,MAAM,gBAAgB,GAAG,IAAI,CAAC,kBAAkB,CAAC;QAEjD,OAAO,IAAI,CAAA;;;eAGA,SAAS,CAAC,IAA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,EAAE;YAC5C,KAAK,GAAG,kCAAkC,CAAC;SAC5C;aAAM,IAAI,CAAC,SAAS,EAAE,sBAAsB,EAAE,UAAU,EAAE,UAAU,CAAC,CAAC,QAAQ,CAAC,MAAM,CAAC,EAAE;YACvF,KAAK,GAAG,8BAA8B,CAAC;SACxC;aAAM;YACL,KAAK,GAAG,yBAAyB,CAAC;SACnC;QAED,OAAO,IAAI,CAAA;;;iBAGE,KAAK;sBACA,MAAM;;KAEvB,CAAC;IACJ,CAAC;CACF","sourcesContent":["import type { NucleonElement } from '../../../NucleonElement/NucleonElement';\nimport type { TemplateResult } from 'lit-html';\nimport type { Resource } from '@foxy.io/sdk/core';\nimport type { Data } from '../../types';\nimport type { Rels } from '@foxy.io/sdk/backend';\n\nimport { InternalControl } from '../../../../internal/InternalControl/InternalControl';\nimport { ifDefined } from 'lit-html/directives/if-defined';\nimport { html } from 'lit-html';\n\nexport class InternalTransactionSummaryControl extends InternalControl {\n private readonly __storeLoaderId = 'storeLoader';\n\n renderControl(): TemplateResult {\n const data = this.nucleon?.data as Data | undefined;\n if (!data) return html``;\n\n const taxes = data?._embedded?.['fx:applied_taxes'] ?? [];\n const shipments = data._embedded?.['fx:shipments'] ?? [];\n const refundableAmount = this.__refundableAmount;\n\n return html`\n <foxy-nucleon\n infer=\"\"\n href=${ifDefined(this.__storeHref)}\n id=${this.__storeLoaderId}\n @update=${() => this.requestUpdate()}\n >\n </foxy-nucleon>\n\n <p\n class=\"grid gap-x-s text-right text-s leading-m border-dashed border rounded border-contrast-20 whitespace-nowrap overflow-auto\"\n style=\"padding: calc(0.625em + (var(--lumo-border-radius) / 4) - 2px); grid-template-columns: 1fr min-content\"\n >\n <span><foxy-i18n key=\"subtotal\" infer=\"\"></foxy-i18n>:</span>\n <span>${this.__renderPrice(data.total_item_price as unknown as number)}</span>\n\n ${shipments.length === 0 || (data.total_shipping as unknown as number) === 0\n ? html`\n <span><foxy-i18n infer=\"\" key=\"total_shipping\"></foxy-i18n>:</span>\n <span>${this.__renderPrice(data.total_shipping as unknown as number, true)} </span>\n `\n : shipments.map(shipment => {\n return html`\n <span>${shipment.shipping_service_description}:</span>\n <span>${this.__renderPrice(shipment.total_shipping, true)}</span>\n `;\n })}\n ${taxes.length === 0 || (data.total_tax as unknown as number) === 0\n ? html`\n <span><foxy-i18n infer=\"\" key=\"total_tax\"></foxy-i18n>:</span>\n <span>${this.__renderPrice(data.total_tax as unknown as number, true)}</span>\n `\n : taxes.map(tax => {\n return html`\n <span>${tax.name}:</span>\n <span>${this.__renderPrice(tax.amount, true)}</span>\n `;\n })}\n ${data?._embedded?.['fx:gift_card_code_logs']?.map(log => {\n // @ts-expect-error deep zoom is not supported by the SDK types\n const name = log._embedded?.['fx:gift_card']?.name;\n // @ts-expect-error deep zoom is not supported by the SDK types\n const code = log._embedded?.['fx:gift_card_code']?.code;\n\n if (name && code) {\n return html`\n <span data-testclass=\"gift-card-code\">${name} • ${code}:</span>\n <span>${this.__renderPrice(log.balance_adjustment ?? 0, true)}</span>\n `;\n }\n })}\n ${data?._embedded?.['fx:discounts']?.map(({ name, code: c, amount }) => {\n return html`\n <span data-testclass=\"discount\">${name}${c ? html` • ${c}` : ''}:</span>\n <span>${this.__renderPrice(amount, true)}</span>\n `;\n })}\n\n <span class=\"col-span-2 border-t border-dashed border-contrast-20 my-s\"></span>\n\n <span class=\"col-span-2 flex gap-s justify-between items-center\">\n ${this.__renderStatus()}\n <span class=\"text-xl font-medium leading-xs\">\n <foxy-i18n infer=\"\" key=\"total\"></foxy-i18n>:\n ${this.__renderPrice(data.total_order)}\n </span>\n </span>\n\n ${refundableAmount !== data.total_order\n ? html`\n <span class=\"col-span-2 border-t border-dashed border-contrast-20 my-s\"></span>\n <span class=\"col-span-2 flex justify-end\">\n <span>\n <span class=\"text-xl font-medium leading-xs\">\n <foxy-i18n infer=\"\" key=\"refundable_amount\"></foxy-i18n>:\n ${this.__renderPrice(refundableAmount)}\n </span>\n <br />\n <foxy-i18n\n class=\"inline-block whitespace-normal leading-s text-tertiary\"\n style=\"max-width: 48ch\"\n infer=\"\"\n key=\"refundable_amount_note\"\n >\n </foxy-i18n>\n </span>\n </span>\n `\n : ''}\n </p>\n `;\n }\n\n private get __refundableAmount(): number {\n const data = this.nucleon?.data as Data | undefined;\n const originalTotal = data?.total_order ?? 0;\n // @ts-expect-error SDK types do not include amount on fx:refund\n return parseFloat(data?._links['fx:refund']?.amount ?? originalTotal);\n }\n\n private get __storeHref() {\n return this.nucleon?.data?._links['fx:store']?.href as string | undefined;\n }\n\n private get __store() {\n type Loader = NucleonElement<Resource<Rels.Store>>;\n const selector = `#${this.__storeLoaderId}`;\n return this.renderRoot.querySelector<Loader>(selector)?.data ?? null;\n }\n\n private __renderPrice(amount: number, isAdditive = false) {\n const currencyDisplay = this.__store?.use_international_currency_symbol ? 'code' : 'symbol';\n const currencyCode = this.nucleon?.data?.currency_code as string | undefined;\n\n return html`\n <foxy-i18n\n class=${isAdditive && amount !== 0 ? (amount > 0 ? 'text-success' : 'text-error') : ''}\n infer=\"\"\n key=\"price\"\n .options=${{\n currencyDisplay,\n signDisplay: isAdditive ? 'exceptZero' : 'auto',\n amount: `${amount} ${currencyCode}`,\n }}\n >\n </foxy-i18n>\n `;\n }\n\n private __renderStatus() {\n const status = this.nucleon?.data?.status || 'completed';\n let color = '';\n\n if (['capturing', 'captured', 'approved', 'authorized', 'pending'].includes(status)) {\n color = 'text-success bg-success-10';\n } else if (!status || status === 'completed') {\n color = 'text-success-contrast bg-success';\n } else if (['problem', 'pending_fraud_review', 'rejected', 'declined'].includes(status)) {\n color = 'text-error-contrast bg-error';\n } else {\n color = 'bg-contrast-5 text-body';\n }\n\n return html`\n <foxy-i18n\n infer=\"\"\n class=\"${color} rounded-s py-xs px-s font-medium text-s leading-xs\"\n key=\"status_${status}\"\n ></foxy-i18n>\n `;\n }\n}\n"]}
|