JezK
Edit File: sc-order-confirmation-totals2.js
import{proxyCustomElement,HTMLElement,h,Fragment}from"@stencil/core/internal/client";import{a as getHumanDiscount}from"./price.js";import{o as openWormhole}from"./consumer.js";import{f as formatTaxDisplay}from"./tax.js";import{d as defineCustomElement$3}from"./sc-divider2.js";import{d as defineCustomElement$2}from"./sc-line-item2.js";import{d as defineCustomElement$1}from"./sc-tag2.js";const scOrderConfirmationTotalsCss=":host{display:block}",ScOrderConfirmationTotalsStyle0=":host{display:block}",ScOrderConfirmationTotals=proxyCustomElement(class extends HTMLElement{constructor(){super(),this.__registerHost(),this.__attachShadow(),this.order=void 0}renderDiscountLine(){var e,i,o,d,t,a,s,c,n,l,r,u,f,p;if(!(null===(o=null===(i=null===(e=this.order)||void 0===e?void 0:e.discount)||void 0===i?void 0:i.promotion)||void 0===o?void 0:o.code))return null;let v="";return(null===(t=null===(d=this.order)||void 0===d?void 0:d.discount)||void 0===t?void 0:t.coupon)&&(v=getHumanDiscount(null===(s=null===(a=this.order)||void 0===a?void 0:a.discount)||void 0===s?void 0:s.coupon)),h("sc-line-item",{style:{marginTop:"var(--sc-spacing-small)"}},h("span",{slot:"description"},wp.i18n.__("Discount","surecart"),h("br",null),(null===(l=null===(n=null===(c=this.order)||void 0===c?void 0:c.discount)||void 0===n?void 0:n.promotion)||void 0===l?void 0:l.code)&&h("sc-tag",{type:"success",size:"small"},null===(f=null===(u=null===(r=this.order)||void 0===r?void 0:r.discount)||void 0===u?void 0:u.promotion)||void 0===f?void 0:f.code)),v&&h("span",{class:"coupon-human-discount",slot:"price-description"},"(",v,")"),h("span",{slot:"price"},null===(p=this.order)||void 0===p?void 0:p.discounts_display_amount))}renderCheckoutFees(e){var i,o,d,t;return(null===(o=null===(i=null==e?void 0:e.checkout_fees)||void 0===i?void 0:i.data)||void 0===o?void 0:o.length)?h(Fragment,null,null===(t=null===(d=null==e?void 0:e.checkout_fees)||void 0===d?void 0:d.data)||void 0===t?void 0:t.map((e=>h("sc-line-item",{key:null==e?void 0:e.id},h("span",{slot:"description"},null==e?void 0:e.description),h("span",{slot:"price"},null==e?void 0:e.display_amount))))):null}renderShippingFees(e){var i,o,d,t;return(null===(o=null===(i=null==e?void 0:e.shipping_fees)||void 0===i?void 0:i.data)||void 0===o?void 0:o.length)?h(Fragment,null,null===(t=null===(d=null==e?void 0:e.shipping_fees)||void 0===d?void 0:d.data)||void 0===t?void 0:t.map((e=>h("sc-line-item",{key:null==e?void 0:e.id},h("span",{slot:"description"},null==e?void 0:e.description),h("span",{slot:"price"},null==e?void 0:e.display_amount))))):null}render(){var e,i,o,d,t,a,s,c,n,l,r,u,f,p,v,b,m,y,_,g,k,_x,w,x,C,E,T,S,$,z,F,D,j,O,H,L,P,A,B,M,W,N,R;const q=null===(i=null===(e=this.order)||void 0===e?void 0:e.selected_shipping_choice)||void 0===i?void 0:i.shipping_method,G=null==q?void 0:q.name;return h("div",{key:"3d51dff5f50a0156d5cd3b718e184799ac4d6aea",class:{"line-item-totals":!0}},(null===(o=this.order)||void 0===o?void 0:o.subtotal_amount)!==(null===(d=this.order)||void 0===d?void 0:d.total_amount)&&h(Fragment,{key:"aa5aa12268fe52f0677a16bd276fe0365aa736c3"},h("sc-line-item",{key:"20c31d3288ac886ed8a1a86e617371b3625a5345"},h("span",{key:"6f4a95226349d648a5161dd8b413b9f0b94025b2",slot:"description"},wp.i18n.__("Subtotal","surecart")),h("span",{key:"7cba2aa13135c52ca27c5baecbd45886531dfd88",slot:"price",style:{"font-weight":"var(--sc-font-weight-semibold)",color:"var(--sc-color-gray-800)"}},null===(t=this.order)||void 0===t?void 0:t.subtotal_display_amount)),this.renderCheckoutFees(this.order)),!!(null===(a=this.order)||void 0===a?void 0:a.trial_amount)&&h("sc-line-item",{key:"60576f66cfcdbd78c8048761cc20da043fb45d0a"},h("span",{key:"e86e7d1320db8ed0635ebd7ba65dfbd35bb3a0f8",slot:"description"},wp.i18n.__("Trial","surecart")),h("span",{key:"53bb2bcf01e41684e29a0b1f9e685c98a6d4b675",slot:"price",style:{"font-weight":"var(--sc-font-weight-semibold)",color:"var(--sc-color-gray-800)"}},null===(s=this.order)||void 0===s?void 0:s.trial_display_amount)),!!(null===(c=this.order)||void 0===c?void 0:c.discounts)&&h("sc-line-item",{key:"5d401992646d257736444307576dcddb968ea48d"},h("span",{key:"f38f177547c3a8b6d86747fc0c62b6ef06ac3a27",slot:"description"},wp.i18n.__("Discounts","surecart")),h("span",{key:"48c58acd38a309fc877de67c94023235afab7a68",slot:"price",style:{"font-weight":"var(--sc-font-weight-semibold)",color:"var(--sc-color-gray-800)"}},null===(n=this.order)||void 0===n?void 0:n.discounts_display)),!!(null===(u=null===(r=null===(l=this.order)||void 0===l?void 0:l.discount)||void 0===r?void 0:r.promotion)||void 0===u?void 0:u.code)&&h("sc-line-item",{key:"3d74dc005bd4cef69659323a08615f61666c5554"},h("span",{key:"0bcb84c3a2de2a4834e7020967cd65d3d5e58441",slot:"description"},wp.i18n.__("Discount","surecart"),h("br",{key:"ba0255c726780c480bad908e353f3052a6723418"}),h("sc-tag",{key:"693895c38ad0e7a0daddc6a8db337f34a62de353",type:"success"},wp.i18n.__("Coupon:","surecart")," ",null===(v=null===(p=null===(f=this.order)||void 0===f?void 0:f.discount)||void 0===p?void 0:p.promotion)||void 0===v?void 0:v.code)),h("span",{key:"c47be1b86f340f5292c133da4d5e3b8ce00ab2c5",slot:"price",style:{"font-weight":"var(--sc-font-weight-semibold)",color:"var(--sc-color-gray-800)"}},null===(b=this.order)||void 0===b?void 0:b.discounts_display_amount)),!!(null===(m=this.order)||void 0===m?void 0:m.shipping_amount)&&h(Fragment,{key:"3cf7899a67612e08fc19d133210a0d944a1b4fde"},h("sc-line-item",{key:"c6249962d6fa1f47fc910e1dac9829a511388a17"},h("span",{key:"82fb6275abfb7c1f6f652c8d9482182c2dfb4be5",slot:"description"},`${wp.i18n.__("Shipping","surecart")} ${G?`(${G})`:""}`),h("span",{key:"f82a79978ccb568a28b7b21f8c9f80b5768f9c52",slot:"price",style:{"font-weight":"var(--sc-font-weight-semibold)",color:"var(--sc-color-gray-800)"}},null===(y=this.order)||void 0===y?void 0:y.shipping_display_amount)),this.renderShippingFees(this.order)),!!(null===(_=this.order)||void 0===_?void 0:_.tax_amount)&&h("sc-line-item",{key:"33966cb1cec28226824e8514ba9c2f7e3fc5927b"},h("span",{key:"6a6d918077f1b6d99fd03d611868d881d634e280",slot:"description"},`${formatTaxDisplay(null===(g=this.order)||void 0===g?void 0:g.tax_label,"estimated"===(null===(k=this.order)||void 0===k?void 0:k.tax_status))} (${null===(_x=this.order)||void 0===_x?void 0:_x.tax_percent}%)`),h("span",{key:"398d69ce69ab60446e55f9583a82f2ec79fe465e",slot:"price"},null===(w=this.order)||void 0===w?void 0:w.tax_display_amount),!!(null===(x=this.order)||void 0===x?void 0:x.tax_inclusive_amount)&&h("span",{key:"1e113bd159de07af7e97926dbed226b3f1f4dcee",slot:"price-description"},`(${wp.i18n.__("included","surecart")})`)),h("sc-divider",{key:"4a48337b33fd456fd9620aa2c6b5d15a3ae429ac",style:{"--spacing":"var(--sc-spacing-x-small)"}}),h("sc-line-item",{key:"e98dc0c688e9529389ff5052c56c53db79f37b4f",style:{width:"100%","--price-size":"var(--sc-font-size-x-large)"}},h("span",{key:"ebe7644ea216f080cbcd27a502c5d49acce965f2",slot:"title"},wp.i18n.__("Total","surecart")),h("span",{key:"6856d7dfe3c510a027556c3138d3dd9e49cacd5c",slot:"price"},null===(C=this.order)||void 0===C?void 0:C.total_display_amount),h("span",{key:"dd6241b9e2539e2d73d9c8948ebb9d0487affe5f",slot:"currency"},null===(E=this.order)||void 0===E?void 0:E.currency)),!!(null===(T=this.order)||void 0===T?void 0:T.proration_amount)&&h("sc-line-item",{key:"ec73eb49f952152ef4c00e40c3ac56d250c65124"},h("span",{key:"1540e6365c07b918cc8b698349f7d0b8e4c1a215",slot:"description"},wp.i18n.__("Proration","surecart")),h("span",{key:"4145ab74f11fc47b8f738ebdbba3b45a9f616045",slot:"price",style:{"font-weight":"var(--sc-font-weight-semibold)",color:"var(--sc-color-gray-800)"}},null===(S=this.order)||void 0===S?void 0:S.proration_display_amount)),!!(null===($=this.order)||void 0===$?void 0:$.applied_balance_amount)&&h("sc-line-item",{key:"ec30c49e9fc5d406b71a5b63a9d77253852406d4"},h("span",{key:"5e6de9421f25501efd1861657200e9b1bbb45157",slot:"description"},wp.i18n.__("Applied Balance","surecart")),h("span",{key:"4ce6d749ee86107a0a506c876cf556af5744c06c",style:{"font-weight":"var(--sc-font-weight-semibold)",color:"var(--sc-color-gray-800)"},slot:"price"},null===(z=this.order)||void 0===z?void 0:z.applied_balance_display_amount)),!!(null===(F=this.order)||void 0===F?void 0:F.credited_balance_amount)&&h("sc-line-item",{key:"1f602620bbae03992dfc72ff3b0e6c8ee9549775"},h("span",{key:"87d0cfa04a4c71a22e93a773007a335196bc3203",slot:"description"},wp.i18n.__("Credited Balance","surecart")),h("span",{key:"9cbf2e9072834158ef8ab40d383e10fc7c6ab840",slot:"price",style:{"font-weight":"var(--sc-font-weight-semibold)",color:"var(--sc-color-gray-800)"}},null===(D=this.order)||void 0===D?void 0:D.credited_balance_display_amount)),(null===(j=this.order)||void 0===j?void 0:j.amount_due)!==(null===(O=this.order)||void 0===O?void 0:O.total_amount)&&h("sc-line-item",{key:"22c16ffabf3bf021c9547367773311053753241c",style:{width:"100%","--price-size":"var(--sc-font-size-x-large)"}},h("span",{key:"dbf3f96253f5bdff9d070bfb92398798ddbc0723",slot:"title"},wp.i18n.__("Amount Due","surecart")),h("span",{key:"d5b09afb390a0b0c92c7e5f34f24f8d98c47c7d1",slot:"price"},null===(H=this.order)||void 0===H?void 0:H.amount_due_display_amount),h("span",{key:"d1a5e772da170608dab6d92b8cdbe0fd118dc067",slot:"currency"},null===(L=this.order)||void 0===L?void 0:L.currency)),h("sc-divider",{key:"d5a6c9e8b0dc1602ddeb06096d02a562c02d1617",style:{"--spacing":"var(--sc-spacing-x-small)"}}),!!(null===(P=this.order)||void 0===P?void 0:P.paid_amount)&&h("sc-line-item",{key:"3f77283d0336cc25bd0e22faa512a927fd378b90",style:{width:"100%","--price-size":"var(--sc-font-size-x-large)"}},h("span",{key:"51f735abe8a5219f0330c7dd7bfb66f51e517fcb",slot:"title"},wp.i18n.__("Paid","surecart")),h("span",{key:"2d667f17951cdcc1d4f0d6d3cc76f1b813c9a622",slot:"price"},null===(A=this.order)||void 0===A?void 0:A.paid_display_amount),h("span",{key:"c5c42cd4f4a1f95af2e1627332ba13cc856a2fc2",slot:"currency"},null===(B=this.order)||void 0===B?void 0:B.currency)),!!(null===(M=this.order)||void 0===M?void 0:M.refunded_amount)&&h(Fragment,{key:"982ed7afdd0ca75d9d60a48a668060576de3cff9"},h("sc-line-item",{key:"4ac1fc05e2acb32791acc9b72591b01c6b85a4cd",style:{width:"100%","--price-size":"var(--sc-font-size-x-large)"}},h("span",{key:"81d8c755b25042d1371374860886154faa32e04e",slot:"description"},wp.i18n.__("Refunded","surecart")),h("span",{key:"1e34dc493441e97bfcd1585aa40b26bf9369447f",slot:"price"},null===(W=this.order)||void 0===W?void 0:W.refunded_display_amount)),h("sc-line-item",{key:"9fea3f77a3d6f4631993b26bb1dbd8092e942440",style:{width:"100%","--price-size":"var(--sc-font-size-x-large)"}},h("span",{key:"15ce160d7b63585d012300abf8da3e8bda5ad946",slot:"title"},wp.i18n.__("Net Payment","surecart")),h("span",{key:"59487504e0def2acaaa7e4fcf9757af7dfa5757d",slot:"price"},null===(N=this.order)||void 0===N?void 0:N.net_paid_display_amount))),(null===(R=this.order)||void 0===R?void 0:R.tax_reverse_charged_amount)>0&&h("sc-line-item",{key:"094bcd469599fea1191945f354fb0d0e99dc5175"},h("span",{key:"d08faa20a9fb417fefe0e1755e2320f951bc3429",slot:"description"},wp.i18n.__("*Tax to be paid on reverse charge basis","surecart"))))}static get style(){return":host{display:block}"}},[1,"sc-order-confirmation-totals",{order:[16]}]);function defineCustomElement(){"undefined"!=typeof customElements&&["sc-order-confirmation-totals","sc-divider","sc-line-item","sc-tag"].forEach((e=>{switch(e){case"sc-order-confirmation-totals":customElements.get(e)||customElements.define(e,ScOrderConfirmationTotals);break;case"sc-divider":customElements.get(e)||defineCustomElement$3();break;case"sc-line-item":customElements.get(e)||defineCustomElement$2();break;case"sc-tag":customElements.get(e)||defineCustomElement$1()}}))}openWormhole(ScOrderConfirmationTotals,["order","busy","loading","empty"],!1);export{ScOrderConfirmationTotals as S,defineCustomElement as d};