@billgangcom/theme-lib 1.114.3 → 1.116.0
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/{builder-C4IiRjp5.js → builder-Bj8ViroH.js} +5 -5
- package/dist/{builder-CZiRl_4b.cjs → builder-CUCCG2gi.cjs} +2 -2
- package/dist/{builder-components-Ds0B6KAh.cjs → builder-components-D2219YPy.cjs} +1 -1
- package/dist/{builder-components-DUtnQsMR.js → builder-components-R1dTBy7D.js} +4 -4
- package/dist/builder.cjs.js +1 -1
- package/dist/builder.es.js +34 -34
- package/dist/charge-BrY_-ls8.cjs +109 -0
- package/dist/{charge-BAjv22Uu.js → charge-Cti1lSP2.js} +8418 -8034
- package/dist/{checkout-BihRJw1G.cjs → checkout-C-7bV9sk.cjs} +1 -1
- package/dist/{checkout-CsTWd6tI.js → checkout-CTbZMuPC.js} +5 -5
- package/dist/exports.cjs.js +1 -1
- package/dist/exports.es.js +7 -7
- package/dist/{index-CGhg-CkV.js → index-B03fd16N.js} +8 -8
- package/dist/{index-D4BCHJ4l.js → index-BBcZT0G2.js} +5 -5
- package/dist/{index-eaTS3-Aj.cjs → index-CILywG47.cjs} +1 -1
- package/dist/{index-0itRmU2L.cjs → index-CQm0i92r.cjs} +1 -1
- package/dist/{index-BbTAMqA3.js → index-CUFJfAc6.js} +1 -1
- package/dist/{index-BXuENnlY.js → index-CUnfTwF8.js} +5 -5
- package/dist/{index-CJ8gac-X.cjs → index-HhcLQjbw.cjs} +1 -1
- package/dist/{index-BQKbOYps.cjs → index-O5YekXKo.cjs} +1 -1
- package/dist/{index-DcAv5U36.js → index-OTW9ycHk.js} +5 -5
- package/dist/{index-DEpz6kqr.cjs → index-xbQ-1j9f.cjs} +1 -1
- package/dist/index.cjs.js +1 -1
- package/dist/index.es.js +14 -14
- package/dist/order-1lHCRSUw.js +355 -0
- package/dist/order-DNaXADFJ.cjs +1 -0
- package/dist/src/storefront/api/index.d.ts +1 -0
- package/dist/src/storefront/api/vouches.d.ts +7 -0
- package/dist/src/storefront/components/VouchCard/index.d.ts +7 -0
- package/dist/src/storefront/components/VouchModal/index.d.ts +12 -0
- package/dist/src/storefront/components/index.d.ts +2 -0
- package/dist/src/storefront/models/shop.d.ts +3 -0
- package/dist/src/ui/Checkbox/index.d.ts +1 -0
- package/dist/src/ui/Textarea/index.d.ts +1 -0
- package/dist/style.css +1 -1
- package/dist/{subscription-BAy6WRcF.cjs → subscription-BS-hdxzD.cjs} +1 -1
- package/dist/{subscription-2rmlPxD5.js → subscription-DBjS-E8T.js} +5 -5
- package/dist/{ticket-D5JmN5l9.js → ticket-BtcmMwIl.js} +420 -414
- package/dist/{ticket-Buu-gWi7.cjs → ticket-myEl0GYr.cjs} +62 -62
- package/dist/{top-up-iDz6xeq5.js → top-up-DNSDJwN-.js} +8 -8
- package/dist/{top-up-Cj3r_l4u.cjs → top-up-DTVCb-zx.cjs} +1 -1
- package/dist/ui-components-BR9v0VH1.cjs +1 -0
- package/dist/{ui-components-CAvXxpG4.js → ui-components-PK209o-T.js} +978 -968
- package/dist/ui.cjs.js +1 -1
- package/dist/ui.es.js +1 -1
- package/dist/{validation-BzWFnVQz.cjs → validation-D3uB6IO3.cjs} +1 -1
- package/dist/{validation-CVlQrUBl.js → validation-DgaNU463.js} +9 -9
- package/package.json +1 -1
- package/dist/charge-Swo2yUda.cjs +0 -109
- package/dist/order-DepPRtns.cjs +0 -1
- package/dist/order-sMlMoj4y.js +0 -320
- package/dist/ui-components-DhvDTRiU.cjs +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";const t=require("react/jsx-runtime"),i=require("react"),x=require("./builder-CUCCG2gi.cjs"),o=require("./charge-BrY_-ls8.cjs"),_=require("./ui-components-BR9v0VH1.cjs");require("./builder-components-D2219YPy.cjs");require("./ticket-myEl0GYr.cjs");require("react-dom");const H=async(n=1)=>await o.fetchOrders({PageNumber:n}),J=()=>{const[n,r]=i.useState(null),[d,e]=i.useState(null),[g,j]=i.useState(0),{page:y}=x.usePaginationPagesStore(),[k,l]=i.useState(!0);async function C(){l(!0);const{list:S,totalCount:w}=await H(y);r(S),j(w),e(null),l(!1)}async function h(){const S=(n==null?void 0:n.map(v=>v.gatewayName))||[],w=await o.getGatewaysDetail(S);e(w)}return i.useEffect(()=>{!d&&n&&h()},[n,d]),i.useEffect(()=>{C()},[y]),t.jsx(t.Fragment,{children:n!=null&&n.length&&n.length===0?t.jsx(o.NoItemsBlock,{title:"No Orders",description:"When you purchase products from our website, you'll see a history of orders here."}):t.jsxs(t.Fragment,{children:[t.jsx(o.PageTitle,{title:"Orders"}),t.jsx(o.OrdersTable,{orders:n,gatewaysDetail:d,totalCount:g,isLoading:k})]})})},Y="_orderPage_gc87l_1",K="_leftSection_gc87l_15",Q="_content_gc87l_35",X="_main_gc87l_42",Z="_mainAntistock_gc87l_56",ee="_orderMainDataAntistock_gc87l_69",te="_timelineBlockAntistock_gc87l_81",se="_footerAntistock_gc87l_92",ne="_statusBlock_gc87l_104",oe="_timelineBlock_gc87l_81",ae="_footer_gc87l_92",ce="_rightSection_gc87l_121",ie="_header_gc87l_142",re="_productList_gc87l_150",le="_mobileFooter_gc87l_157",ue="_loaderContainer_gc87l_166",de="_orderMainData_gc87l_69",me="_prices_gc87l_181",he="_headerTitle_gc87l_185",fe="_headerDescription_gc87l_189",a={orderPage:Y,leftSection:K,content:Q,main:X,mainAntistock:Z,orderMainDataAntistock:ee,timelineBlockAntistock:te,footerAntistock:se,statusBlock:ne,timelineBlock:oe,footer:ae,rightSection:ce,header:ie,productList:re,mobileFooter:le,loaderContainer:ue,orderMainData:de,prices:me,headerTitle:he,headerDescription:fe},pe="_modalContent_1a05n_1",_e="_iconContainer_1a05n_16",ge="_warningIcon_1a05n_20",ye="_title_1a05n_25",Se="_description_1a05n_33",we="_buttonContainer_1a05n_40",xe="_button_1a05n_40",f={modalContent:pe,iconContainer:_e,warningIcon:ge,title:ye,description:Se,buttonContainer:we,button:xe},ke=({isOpen:n,onClose:r,refundedAmount:d,currency:e})=>{var O,D;const g=x.useNavigate(),{token:j,shopDomain:y}=x.useStorefrontStore(),{isAntistock:k,general:l}=x.useGeneralStore(),C=!!((O=l==null?void 0:l.info)!=null&&O.disableSupport),h=(D=l==null?void 0:l.info)==null?void 0:D.thirdPartySupportUrl,S=!(C&&!h),w=new Intl.NumberFormat("en-US",{style:"currency",currency:e}),v=()=>{g(k?"/account":"/customer-dash")},u=async()=>{if(C&&h){window.open(h);return}k?window.open(`https://${y}/support`):g("/contact")},c=()=>{r()};return n?t.jsx(_.Modal,{close:r,children:t.jsxs("div",{className:f.modalContent,onClick:P=>P.stopPropagation(),children:[t.jsx("div",{className:f.iconContainer,children:t.jsx(_.Icon,{name:"WarningDiamond",fill:"var(--text-warning)",className:f.warningIcon})}),t.jsx("h2",{className:f.title,children:"Partial Delivery Failure Refund"}),t.jsxs("p",{className:f.description,children:["Your payment was successful but a few products were out of stock. We've automatically refunded the products that were out of stock, with a total of"," ",w.format(d),", to your account balance."]}),t.jsxs("div",{className:f.buttonContainer,children:[!j&&t.jsx(_.Button,{type:"Secondary",onClick:v,className:f.button,children:"Login"}),S&&t.jsx(_.Button,{type:"Secondary",onClick:u,className:f.button,children:"Contact Support"}),t.jsx(_.Button,{type:"Primary",onClick:c,className:f.button,children:"Continue"})]})]})}):null},Ce=()=>{var I,B,F,$,V,T,q,L,E;const{id:n,accessToken:r}=x.useParams(),d=x.useNavigate(),[e,g]=i.useState(),[j,y]=i.useState(!1),[k,l]=i.useState(!1),[C,h]=i.useState(!1),[S,w]=i.useState(!1),v=o.useCopy(),{isAntistock:u,general:c}=x.useGeneralStore(),O=((I=e==null?void 0:e.rawPrice)==null?void 0:I.currency)||"USD",D=new Intl.NumberFormat("en-US",{style:"currency",currency:O}),P=i.useMemo(()=>(e==null?void 0:e.partOrders.map(s=>{var N,R;return{id:(s==null?void 0:s.id)||0,image:s.productWithVariant.image,name:(()=>{var b,W;const m=((b=s.productWithVariant)==null?void 0:b.name)||"",p=((W=s.productWithVariant)==null?void 0:W.variantName)||"";return!m&&!p?"":!p||m===p?m:m?`${m} (${p})`:p})(),description:"",price:{quantity:s.quantity,amount:((N=s.productWithVariant)==null?void 0:N.price.amount)||0,currency:(R=s.productWithVariant)==null?void 0:R.price.currency},deliveryCategories:"deliveryCategories"in s?s.deliveryCategories:void 0,customerNote:s.customerNote,chargeType:s.chargeType||"ONE_TIME",replacementRequests:"replacementRequests"in s?s.replacementRequests:void 0,allowedReplacementReasons:"allowedReplacementReasons"in s?s.allowedReplacementReasons:void 0}}))||[],[e]);i.useEffect(()=>{e&&(e.status===o.OrderStatus.FullDeliveryFailure||e.status===o.OrderStatus.PartiallyDelivered)&&e.refundedPrice&&e.refundedPrice.amount>0&&l(!0)},[e==null?void 0:e.status]);const A=i.useCallback(async(s,N,R=!1)=>{var p,b;R||y(!0);const{data:m}=await(N?o.fetchAuthorizedOrder(`${s}/${N}`):o.fetchOrder(s));y(!1),m.status!==o.OrderStatus.Completed&&((p=m.charge)==null?void 0:p.status)===o.ChargeStatus.NotPaid&&d(`/charges/${(b=m.charge)==null?void 0:b.id}`,{replace:!0}),g(m)},[d]);i.useLayoutEffect(()=>{if(n&&!r){const s=JSON.parse(localStorage.getItem("orders")||"{}");s[n]&&d(`/orders/${n}/${s[n].fullAccessToken}`)}},[n,r,d]),i.useEffect(()=>{n&&A(n,r,!0);const s=setInterval(()=>{n&&A(n,r,!0)},5e3);return()=>{clearInterval(s)}},[n,r,A]);const U=i.useMemo(()=>!!(e!=null&&e.isApplicableForReplacement&&(e.status===o.OrderStatus.Completed||e.status===o.OrderStatus.PartiallyDelivered||e.status===o.OrderStatus.FullDeliveryFailure)),[e]),M=i.useMemo(()=>{var s;return!!((s=c==null?void 0:c.info)!=null&&s.isVouchesEnabled&&r)},[(B=c==null?void 0:c.info)==null?void 0:B.isVouchesEnabled,r]),G=i.useMemo(()=>{var s;return!!(!((s=c==null?void 0:c.info)!=null&&s.isVouchesEnabled)&&(e!=null&&e.review)&&"accessToken"in e.review&&!u)},[(F=c==null?void 0:c.info)==null?void 0:F.isVouchesEnabled,e==null?void 0:e.review,u]),z=i.useMemo(()=>{var s;return((s=c==null?void 0:c.info)==null?void 0:s.domain)||window.location.hostname},[($=c==null?void 0:c.info)==null?void 0:$.domain]);return j?t.jsx("div",{className:a.loaderContainer,children:t.jsx(_.Loader,{})}):t.jsxs("div",{className:a.orderPage,children:[t.jsx("div",{className:a.leftSection,children:t.jsxs("div",{className:a.content,children:[t.jsx(o.CheckoutHeader,{}),e&&t.jsxs("div",{className:`${a.main} ${u?a.mainAntistock:""}`,children:[t.jsx(o.OrderStatusBlock,{className:a.statusBlock,orderStatus:e.status}),t.jsxs("div",{className:`${a.orderMainData} ${u?a.orderMainDataAntistock:""}`,children:[M&&t.jsx(o.VouchCard,{onAddMessage:()=>h(!0),isSubmitted:S}),t.jsx(o.CheckoutOrderMainData,{lastUpdate:e.createdAt,paymentType:(V=e.charge)==null?void 0:V.gateway,email:e.customer?e.customer.email:((T=e.charge)==null?void 0:T.customerForCharge.email)||"",orderId:e.id}),G&&e.review&&t.jsx(o.LeaveAReview,{orderId:e.id,review:e.review})]}),e.charge&&e.charge.timeline&&t.jsx(o.TrackPayment,{className:`${a.timelineBlock} ${u?a.timelineBlockAntistock:""}`,timeline:e.charge.timeline}),t.jsx(o.CheckoutFooter,{className:`${a.footer} ${u?a.footerAntistock:""}`})]})]})}),t.jsx("div",{className:a.rightSection,style:u?{borderLeft:"1px solid var(--border-secondary)"}:void 0,children:t.jsxs("div",{className:a.content,children:[((q=e==null?void 0:e.charge)==null?void 0:q.name)&&t.jsxs("header",{className:a.header,children:[t.jsxs("div",{children:[t.jsx("h1",{className:a.headerTitle,children:e.charge.name}),e.charge.description&&t.jsx("p",{className:a.headerDescription,children:e.charge.description})]}),u?null:t.jsxs(_.Button,{type:"Secondary",onClick:()=>v((e==null?void 0:e.id)||""),style:{whiteSpace:"nowrap",display:"flex",alignItems:"center",gap:"4px"},children:[t.jsx(_.Icon,{name:"Copy"}),t.jsx("span",{children:"Copy ID"})]})]}),t.jsxs("div",{children:[t.jsx("div",{className:a.productList,children:P.map(s=>t.jsx(o.CheckoutProduct,{product:s,isOrder:!0,isApplicableForReplacement:U,orderId:n,accessToken:r,allowedReplacementReasons:e==null?void 0:e.allowedReplacementReasons},s.id))}),u?null:t.jsx(o.CheckoutPrices,{formatter:D,coupon:null,total:((L=e==null?void 0:e.endPrice)==null?void 0:L.amount)||0,discount:0,totalWithDiscount:((E=e==null?void 0:e.endPrice)==null?void 0:E.amount)||0,className:a.prices,isShowSubtotal:!1}),t.jsx(o.CheckoutFooter,{className:a.mobileFooter})]})]})}),(e==null?void 0:e.refundedPrice)&&t.jsx(ke,{isOpen:k,onClose:()=>l(!1),refundedAmount:e.refundedPrice.amount,currency:e.refundedPrice.currency}),M&&t.jsx(o.VouchModal,{isOpen:C,onClose:()=>h(!1),products:P,orderId:n,accessToken:r,shopDomain:z,onSuccess:()=>{w(!0),h(!1),n&&A(n,r,!0)}})]})},je=Object.freeze(Object.defineProperty({__proto__:null,OrderPage:Ce},Symbol.toStringTag,{value:"Module"}));exports.Orders=J;exports.index=je;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export interface PostVouchRequest {
|
|
2
|
+
imageId: number;
|
|
3
|
+
productIds: number[];
|
|
4
|
+
comment: string;
|
|
5
|
+
tsId: string;
|
|
6
|
+
}
|
|
7
|
+
export declare const postVouch: (body: PostVouchRequest, shopDomain: string, orderId: string, accessToken: string) => Promise<import("@api").RequestResponse<any>>;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { CheckoutProductT } from '@storefront/models';
|
|
2
|
+
interface VouchModalProps {
|
|
3
|
+
isOpen: boolean;
|
|
4
|
+
onClose: () => void;
|
|
5
|
+
products: CheckoutProductT[];
|
|
6
|
+
orderId?: string;
|
|
7
|
+
accessToken?: string;
|
|
8
|
+
shopDomain?: string;
|
|
9
|
+
onSuccess?: () => void;
|
|
10
|
+
}
|
|
11
|
+
export declare const VouchModal: React.FC<VouchModalProps>;
|
|
12
|
+
export {};
|