whoami7 - Manager
:
/
home
/
dataiclx
/
vielorbe.com
/
wp-content
/
plugins
/
surecart
/
dist
/
components
/
components
/
Upload File:
files >> //home/dataiclx/vielorbe.com/wp-content/plugins/surecart/dist/components/components/sc-order.js
import{proxyCustomElement,HTMLElement,h,Fragment}from"@stencil/core/internal/client";import{a as apiFetch}from"./fetch.js";import{o as onFirstVisible}from"./lazy.js";import{i as intervalString}from"./price.js";import{f as formatTaxDisplay}from"./tax.js";import{d as defineCustomElement$s}from"./sc-alert2.js";import{d as defineCustomElement$r}from"./sc-block-ui2.js";import{d as defineCustomElement$q}from"./sc-button2.js";import{d as defineCustomElement$p}from"./sc-card2.js";import{d as defineCustomElement$o}from"./sc-cc-logo2.js";import{d as defineCustomElement$n}from"./sc-dashboard-module2.js";import{d as defineCustomElement$m}from"./sc-divider2.js";import{d as defineCustomElement$l}from"./sc-empty2.js";import{d as defineCustomElement$k}from"./sc-flex2.js";import{d as defineCustomElement$j}from"./sc-format-bytes2.js";import{d as defineCustomElement$i}from"./sc-format-number2.js";import{d as defineCustomElement$h}from"./sc-icon2.js";import{d as defineCustomElement$g}from"./sc-line-item2.js";import{d as defineCustomElement$f}from"./sc-order-manual-instructions2.js";import{d as defineCustomElement$e}from"./sc-order-status-badge2.js";import{d as defineCustomElement$d}from"./sc-payment-method2.js";import{d as defineCustomElement$c}from"./sc-product-line-item2.js";import{d as defineCustomElement$b}from"./sc-purchase-downloads-list2.js";import{d as defineCustomElement$a}from"./sc-quantity-select2.js";import{d as defineCustomElement$9}from"./sc-skeleton2.js";import{d as defineCustomElement$8}from"./sc-spacing2.js";import{d as defineCustomElement$7}from"./sc-spinner2.js";import{d as defineCustomElement$6}from"./sc-stacked-list2.js";import{d as defineCustomElement$5}from"./sc-stacked-list-row2.js";import{d as defineCustomElement$4}from"./sc-tag2.js";import{d as defineCustomElement$3}from"./sc-text2.js";import{d as defineCustomElement$2}from"./sc-tooltip2.js";import{a as addQueryArgs}from"./add-query-args.js";const scOrderCss=":host{display:block}.order__row{padding:var(--sc-spacing-large);display:grid;gap:var(--sc-spacing-small)}",ScOrderStyle0=scOrderCss,ScOrder$1=proxyCustomElement(class extends HTMLElement{constructor(){super(),this.__registerHost(),this.__attachShadow(),this.orderId=void 0,this.customerIds=void 0,this.heading=void 0,this.order=void 0,this.purchases=void 0,this.loading=void 0,this.busy=void 0,this.error=void 0}componentDidLoad(){onFirstVisible(this.el,(()=>{this.fetchOrder(),this.fetchDownloads()}))}async fetchOrder(){try{this.loading=!0,await this.getOrder()}catch(e){console.error(this.error),this.error=(null==e?void 0:e.message)||wp.i18n.__("Something went wrong","surecart")}finally{this.loading=!1}}async fetchDownloads(){try{this.busy=!0,this.purchases=await apiFetch({path:addQueryArgs("surecart/v1/purchases",{expand:["product","product.downloads","download.media"],order_ids:[this.orderId],customer_ids:this.customerIds,downloadable:!0})})}catch(e){console.error(this.error),this.error=(null==e?void 0:e.message)||wp.i18n.__("Something went wrong","surecart")}finally{this.busy=!1}}async getOrder(){this.order=await apiFetch({path:addQueryArgs(`surecart/v1/orders/${this.orderId}`,{expand:["checkout","checkout.line_items","line_item.price","line_item.fees","line_item.variant","variant.image","price.product","checkout.manual_payment_method","checkout.payment_method","checkout.selected_shipping_choice","shipping_choice.shipping_method","payment_method.card","payment_method.payment_instrument","payment_method.paypal_account","payment_method.bank_account","checkout.discount","discount.promotion","checkout.charge"]})})}renderLoading(){return h("sc-flex",{flexDirection:"column",style:{gap:"1em"}},h("sc-skeleton",{style:{width:"20%",display:"inline-block"}}),h("sc-skeleton",{style:{width:"60%",display:"inline-block"}}),h("sc-skeleton",{style:{width:"40%",display:"inline-block"}}))}renderEmpty(){return h("sc-empty",{icon:"shopping-bag"},wp.i18n.__("Order not found.","surecart"))}renderContent(){var e,t,s,o,i,n,l,r;if(this.loading)return this.renderLoading();if(!(null===(e=this.order)||void 0===e?void 0:e.id))return this.renderEmpty();const a=null===(t=this.order)||void 0===t?void 0:t.checkout,c=null===(s=null==a?void 0:a.selected_shipping_choice)||void 0===s?void 0:s.shipping_method,d=null==c?void 0:c.name;return h(Fragment,null,((null===(o=null==a?void 0:a.line_items)||void 0===o?void 0:o.data)||[]).map((e=>{var t,s,o,i,n,l,r;return h("sc-product-line-item",{key:e.id,image:null==e?void 0:e.image,name:null===(s=null===(t=null==e?void 0:e.price)||void 0===t?void 0:t.product)||void 0===s?void 0:s.name,priceName:null===(o=null==e?void 0:e.price)||void 0===o?void 0:o.name,variantLabel:((null==e?void 0:e.variant_options)||[]).filter(Boolean).join(" / ")||null,editable:!1,removable:!1,quantity:e.quantity,scratchDisplayAmount:null==e?void 0:e.scratch_display_amount,displayAmount:null==e?void 0:e.subtotal_display_amount,amount:e.subtotal_amount,currency:null===(i=null==e?void 0:e.price)||void 0===i?void 0:i.currency,trialDurationDays:null===(n=null==e?void 0:e.price)||void 0===n?void 0:n.trial_duration_days,interval:intervalString(null==e?void 0:e.price),scratchAmount:null==e?void 0:e.scratch_amount,setupFeeTrialEnabled:null===(l=null==e?void 0:e.price)||void 0===l?void 0:l.setup_fee_trial_enabled,fees:null===(r=null==e?void 0:e.fees)||void 0===r?void 0:r.data})})),(null==a?void 0:a.subtotal_amount)!==(null==a?void 0:a.total_amount)&&h("sc-line-item",null,h("span",{slot:"description"},wp.i18n.__("Subtotal","surecart")),h("span",{slot:"price",style:{"font-weight":"var(--sc-font-weight-semibold)",color:"var(--sc-color-gray-800)"}},null==a?void 0:a.subtotal_display_amount)),!!(null==a?void 0:a.trial_amount)&&h("sc-line-item",null,h("span",{slot:"description"},wp.i18n.__("Trial","surecart")),h("span",{slot:"price",style:{"font-weight":"var(--sc-font-weight-semibold)",color:"var(--sc-color-gray-800)"}},null==a?void 0:a.trial_display_amount)),!!(null==a?void 0:a.discounts)&&h("sc-line-item",null,h("span",{slot:"description"},wp.i18n.__("Discounts","surecart")),h("span",{slot:"price",style:{"font-weight":"var(--sc-font-weight-semibold)",color:"var(--sc-color-gray-800)"}},null==a?void 0:a.discounts_display)),!!(null===(n=null===(i=null==a?void 0:a.discount)||void 0===i?void 0:i.promotion)||void 0===n?void 0:n.code)&&h("sc-line-item",null,h("span",{slot:"description"},wp.i18n.__("Discount","surecart"),h("br",null),h("sc-tag",{type:"success"},wp.i18n.__("Coupon:","surecart")," ",null===(r=null===(l=null==a?void 0:a.discount)||void 0===l?void 0:l.promotion)||void 0===r?void 0:r.code)),h("span",{slot:"price",style:{"font-weight":"var(--sc-font-weight-semibold)",color:"var(--sc-color-gray-800)"}},null==a?void 0:a.discounts_display_amount)),!!(null==a?void 0:a.shipping_amount)&&h("sc-line-item",null,h("span",{slot:"description"},`${wp.i18n.__("Shipping","surecart")} ${d?`(${d})`:""}`),h("span",{slot:"price",style:{"font-weight":"var(--sc-font-weight-semibold)",color:"var(--sc-color-gray-800)"}},null==a?void 0:a.shipping_display_amount)),!!(null==a?void 0:a.tax_amount)&&h("sc-line-item",null,h("span",{slot:"description"},`${formatTaxDisplay(null==a?void 0:a.tax_label,"estimated"===(null==a?void 0:a.tax_status))} (${null==a?void 0:a.tax_percent}%)`),h("span",{slot:"price"},null==a?void 0:a.tax_display_amount),!!(null==a?void 0:a.tax_inclusive_amount)&&h("span",{slot:"price-description"},`(${wp.i18n.__("included","surecart")})`)),h("sc-divider",{style:{"--spacing":"var(--sc-spacing-x-small)"}}),h("sc-line-item",{style:{width:"100%","--price-size":"var(--sc-font-size-x-large)"}},h("span",{slot:"title"},wp.i18n.__("Total","surecart")),h("span",{slot:"price"},null==a?void 0:a.total_display_amount),h("span",{slot:"currency"},null==a?void 0:a.currency)),!!(null==a?void 0:a.proration_amount)&&h("sc-line-item",null,h("span",{slot:"description"},wp.i18n.__("Proration","surecart")),h("span",{slot:"price",style:{"font-weight":"var(--sc-font-weight-semibold)",color:"var(--sc-color-gray-800)"}},null==a?void 0:a.proration_display_amount)),!!(null==a?void 0:a.applied_balance_amount)&&h("sc-line-item",null,h("span",{slot:"description"},wp.i18n.__("Applied Balance","surecart")),h("span",{style:{"font-weight":"var(--sc-font-weight-semibold)",color:"var(--sc-color-gray-800)"},slot:"price"},null==a?void 0:a.applied_balance_display_amount)),!!(null==a?void 0:a.credited_balance_amount)&&h("sc-line-item",null,h("span",{slot:"description"},wp.i18n.__("Credited Balance","surecart")),h("span",{slot:"price",style:{"font-weight":"var(--sc-font-weight-semibold)",color:"var(--sc-color-gray-800)"}},null==a?void 0:a.credited_balance_display_amount)),(null==a?void 0:a.amount_due)!==(null==a?void 0:a.total_amount)&&h("sc-line-item",{style:{width:"100%","--price-size":"var(--sc-font-size-x-large)"}},h("span",{slot:"title"},wp.i18n.__("Amount Due","surecart")),h("span",{slot:"price"},null==a?void 0:a.amount_due_display_amount),h("span",{slot:"currency"},null==a?void 0:a.currency)),h("sc-divider",{style:{"--spacing":"var(--sc-spacing-x-small)"}}),!!(null==a?void 0:a.paid_amount)&&h("sc-line-item",{style:{width:"100%","--price-size":"var(--sc-font-size-x-large)"}},h("span",{slot:"title"},wp.i18n.__("Paid","surecart")),h("span",{slot:"price"},null==a?void 0:a.paid_display_amount),h("span",{slot:"currency"},null==a?void 0:a.currency)),!!(null==a?void 0:a.refunded_amount)&&h(Fragment,null,h("sc-line-item",{style:{width:"100%","--price-size":"var(--sc-font-size-x-large)"}},h("span",{slot:"description"},wp.i18n.__("Refunded","surecart")),h("span",{slot:"price"},null==a?void 0:a.refunded_display_amount)),h("sc-line-item",{style:{width:"100%","--price-size":"var(--sc-font-size-x-large)"}},h("span",{slot:"title"},wp.i18n.__("Net Payment","surecart")),h("span",{slot:"price"},null==a?void 0:a.net_paid_display_amount))),(null==a?void 0:a.tax_reverse_charged_amount)>0&&h("sc-line-item",null,h("span",{slot:"description"},wp.i18n.__("*Tax to be paid on reverse charge basis","surecart"))))}render(){var e,t,s,o,i,n,l;const r=null===(e=null==this?void 0:this.order)||void 0===e?void 0:e.checkout,a=null==r?void 0:r.manual_payment_method;return h("sc-spacing",{key:"94711abcc3d0c0a73390820286122a3b74de8412",style:{"--spacing":"var(--sc-spacing-large)"}},h("sc-dashboard-module",{key:"8312f13af42b46cb590ad0e0de1d9f8d92a5a2b2",error:this.error},h("span",{key:"a71fd21c6fcfd43b12d19581b457557b72f2c6c9",slot:"heading"},this.loading?h("sc-skeleton",{style:{width:"120px"}}):`#${null===(t=null==this?void 0:this.order)||void 0===t?void 0:t.number}`),!this.loading&&!(null==r?void 0:r.live_mode)&&h("sc-tag",{key:"bc1f3bf64b7d08fe38e1d87ec497fe7e44a5e6bd",type:"warning",slot:"end"},wp.i18n.__("Test Mode","surecart")),!!(null==a?void 0:a.name)&&!!(null==a?void 0:a.instructions)&&h("sc-order-manual-instructions",{key:"1c42d93fd8467ba954934744a45da6e50149d397",manualPaymentTitle:null==a?void 0:a.name,manualPaymentInstructions:null==a?void 0:a.instructions}),h("sc-card",{key:"1844e0fc66fa66e09d063234dc593b60f40f3c33","no-padding":!this.loading},this.loading?this.renderLoading():h(Fragment,null,h("sc-stacked-list",null,h("sc-stacked-list-row",{style:{"--columns":"2"}},h("div",null,wp.i18n.__("Order Status","surecart")),h("sc-order-status-badge",{status:null===(s=null==this?void 0:this.order)||void 0===s?void 0:s.status})),h("sc-stacked-list-row",{style:{"--columns":"2"}},h("div",null,wp.i18n.__("Date","surecart")),h("span",null,null===(o=this.order)||void 0===o?void 0:o.created_at_date)),h("sc-stacked-list-row",{style:{"--columns":"2"}},h("div",null,wp.i18n.__("Payment Method","surecart")),h("sc-payment-method",{paymentMethod:null==r?void 0:r.payment_method})),h("div",{class:"order__row"},this.renderContent()))))),(null===(i=this.order)||void 0===i?void 0:i.statement_url)&&h("sc-button",{key:"00303f51120687ac96045804601e0d4e273a93db",type:"primary",href:null===(n=this.order)||void 0===n?void 0:n.statement_url,target:"_blank"},h("sc-icon",{key:"5780b3a01015dec54dafc45476b3ac457493b70a",name:"inbox",slot:"prefix"}),wp.i18n.__("Download Receipt/Invoice","surecart")),!!(null===(l=this.purchases)||void 0===l?void 0:l.length)&&h("sc-purchase-downloads-list",{key:"55a6ec1232aec5433f2482dc2788c11f321732f6",heading:wp.i18n.__("Downloads","surecart"),purchases:this.purchases}))}get el(){return this}static get style(){return ScOrderStyle0}},[1,"sc-order",{orderId:[1,"order-id"],customerIds:[16],heading:[1],order:[32],purchases:[32],loading:[32],busy:[32],error:[32]}]);function defineCustomElement$1(){"undefined"!=typeof customElements&&["sc-order","sc-alert","sc-block-ui","sc-button","sc-card","sc-cc-logo","sc-dashboard-module","sc-divider","sc-empty","sc-flex","sc-format-bytes","sc-format-number","sc-icon","sc-line-item","sc-order-manual-instructions","sc-order-status-badge","sc-payment-method","sc-product-line-item","sc-purchase-downloads-list","sc-quantity-select","sc-skeleton","sc-spacing","sc-spinner","sc-stacked-list","sc-stacked-list-row","sc-tag","sc-text","sc-tooltip"].forEach((e=>{switch(e){case"sc-order":customElements.get(e)||customElements.define(e,ScOrder$1);break;case"sc-alert":customElements.get(e)||defineCustomElement$s();break;case"sc-block-ui":customElements.get(e)||defineCustomElement$r();break;case"sc-button":customElements.get(e)||defineCustomElement$q();break;case"sc-card":customElements.get(e)||defineCustomElement$p();break;case"sc-cc-logo":customElements.get(e)||defineCustomElement$o();break;case"sc-dashboard-module":customElements.get(e)||defineCustomElement$n();break;case"sc-divider":customElements.get(e)||defineCustomElement$m();break;case"sc-empty":customElements.get(e)||defineCustomElement$l();break;case"sc-flex":customElements.get(e)||defineCustomElement$k();break;case"sc-format-bytes":customElements.get(e)||defineCustomElement$j();break;case"sc-format-number":customElements.get(e)||defineCustomElement$i();break;case"sc-icon":customElements.get(e)||defineCustomElement$h();break;case"sc-line-item":customElements.get(e)||defineCustomElement$g();break;case"sc-order-manual-instructions":customElements.get(e)||defineCustomElement$f();break;case"sc-order-status-badge":customElements.get(e)||defineCustomElement$e();break;case"sc-payment-method":customElements.get(e)||defineCustomElement$d();break;case"sc-product-line-item":customElements.get(e)||defineCustomElement$c();break;case"sc-purchase-downloads-list":customElements.get(e)||defineCustomElement$b();break;case"sc-quantity-select":customElements.get(e)||defineCustomElement$a();break;case"sc-skeleton":customElements.get(e)||defineCustomElement$9();break;case"sc-spacing":customElements.get(e)||defineCustomElement$8();break;case"sc-spinner":customElements.get(e)||defineCustomElement$7();break;case"sc-stacked-list":customElements.get(e)||defineCustomElement$6();break;case"sc-stacked-list-row":customElements.get(e)||defineCustomElement$5();break;case"sc-tag":customElements.get(e)||defineCustomElement$4();break;case"sc-text":customElements.get(e)||defineCustomElement$3();break;case"sc-tooltip":customElements.get(e)||defineCustomElement$2()}}))}const ScOrder=ScOrder$1,defineCustomElement=defineCustomElement$1;export{ScOrder,defineCustomElement};
Copyright ©2021 || Defacer Indonesia