@billgangcom/theme-lib 1.115.0 → 1.116.1
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-CVbCKY8a.js → builder-DUFJOYbB.js} +5 -5
- package/dist/{builder-Iu70o8Zi.cjs → builder-DqDtctC5.cjs} +2 -2
- package/dist/{builder-components-3ULrMVTv.cjs → builder-components-D3Bb10J8.cjs} +1 -1
- package/dist/{builder-components-BuaB_nik.js → builder-components-DzvQc6D4.js} +4 -4
- package/dist/builder.cjs.js +1 -1
- package/dist/builder.es.js +34 -34
- package/dist/{charge-pzp63q8N.cjs → charge-I1l9O9oW.cjs} +41 -41
- package/dist/{charge-CqeINukp.js → charge-JAW-QeMZ.js} +8233 -7844
- package/dist/{checkout-YVutPZ7f.js → checkout-BvcF30gE.js} +5 -5
- package/dist/{checkout-B98fqO6J.cjs → checkout-CwhyZ4zD.cjs} +1 -1
- package/dist/exports.cjs.js +1 -1
- package/dist/exports.es.js +7 -7
- package/dist/{index-CiY9zOlN.js → index-BGpMbUmG.js} +1 -1
- package/dist/{index-BV4ZiotJ.cjs → index-Bfh9GkFs.cjs} +1 -1
- package/dist/{index-D50xf07C.cjs → index-BsM2kPyQ.cjs} +1 -1
- package/dist/{index-D0izKDtJ.cjs → index-Cdm3FwGu.cjs} +1 -1
- package/dist/{index-C32vke_m.js → index-CyaRCiT9.js} +5 -5
- package/dist/{index-BUlydTOo.js → index-DcWpxbHI.js} +5 -5
- package/dist/{index-Ck3jvxGA.cjs → index-DjnhbFh9.cjs} +1 -1
- package/dist/{index-dHSb9Tg9.js → index-EjVO3qce.js} +5 -5
- package/dist/{index-B3WK0Wpu.js → index-bsPNagUY.js} +8 -8
- package/dist/{index-Lf_IZiQr.cjs → index-dp4B_uob.cjs} +1 -1
- package/dist/index.cjs.js +1 -1
- package/dist/index.es.js +14 -14
- package/dist/order-BLPHbRzn.js +355 -0
- package/dist/order-DN9oIA9o.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 +1 -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-D9tguRYG.js → subscription-D0TYbXFf.js} +5 -5
- package/dist/{subscription-4CHOOBkd.cjs → subscription-r7qA65EX.cjs} +1 -1
- package/dist/{ticket-BODLy8iD.js → ticket--uOANXoZ.js} +5 -5
- package/dist/{ticket-BKgdPBSh.cjs → ticket-BivnxhDp.cjs} +1 -1
- package/dist/{top-up-DR4KDupr.cjs → top-up-C13wralR.cjs} +1 -1
- package/dist/{top-up-BxIXamXN.js → top-up-u1oUf64a.js} +8 -8
- package/dist/ui-components-CC9DRvrZ.cjs +1 -0
- package/dist/{ui-components-B2XdfTmJ.js → ui-components-CqwUR9GH.js} +978 -968
- package/dist/ui.cjs.js +1 -1
- package/dist/ui.es.js +1 -1
- package/dist/{validation-B_jzusSg.cjs → validation-BtrRWzoi.cjs} +1 -1
- package/dist/{validation-BusGxggf.js → validation-ekksqWOd.js} +9 -9
- package/package.json +1 -1
- package/dist/order-C0KsOrOK.cjs +0 -1
- package/dist/order-D4daxyzU.js +0 -325
- package/dist/ui-components-DnGzB9kA.cjs +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";const t=require("react/jsx-runtime"),i=require("react"),k=require("./builder-DqDtctC5.cjs"),o=require("./charge-I1l9O9oW.cjs"),_=require("./ui-components-CC9DRvrZ.cjs");require("./builder-components-D3Bb10J8.cjs");require("./ticket-BivnxhDp.cjs");require("react-dom");const J=async(n=1)=>await o.fetchOrders({PageNumber:n}),Y=()=>{const[n,r]=i.useState(null),[d,e]=i.useState(null),[g,v]=i.useState(0),{page:y}=k.usePaginationPagesStore(),[C,l]=i.useState(!0);async function j(){l(!0);const{list:S,totalCount:w}=await J(y);r(S),v(w),e(null),l(!1)}async function m(){const S=(n==null?void 0:n.map(N=>N.gatewayName))||[],w=await o.getGatewaysDetail(S);e(w)}return i.useEffect(()=>{!d&&n&&m()},[n,d]),i.useEffect(()=>{j()},[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:C})]})})},K="_orderPage_gc87l_1",Q="_leftSection_gc87l_15",X="_content_gc87l_35",Z="_main_gc87l_42",ee="_mainAntistock_gc87l_56",te="_orderMainDataAntistock_gc87l_69",se="_timelineBlockAntistock_gc87l_81",ne="_footerAntistock_gc87l_92",oe="_statusBlock_gc87l_104",ae="_timelineBlock_gc87l_81",ce="_footer_gc87l_92",ie="_rightSection_gc87l_121",re="_header_gc87l_142",le="_productList_gc87l_150",ue="_mobileFooter_gc87l_157",de="_loaderContainer_gc87l_166",me="_orderMainData_gc87l_69",he="_prices_gc87l_181",pe="_headerTitle_gc87l_185",fe="_headerDescription_gc87l_189",a={orderPage:K,leftSection:Q,content:X,main:Z,mainAntistock:ee,orderMainDataAntistock:te,timelineBlockAntistock:se,footerAntistock:ne,statusBlock:oe,timelineBlock:ae,footer:ce,rightSection:ie,header:re,productList:le,mobileFooter:ue,loaderContainer:de,orderMainData:me,prices:he,headerTitle:pe,headerDescription:fe},_e="_modalContent_1a05n_1",ge="_iconContainer_1a05n_16",ye="_warningIcon_1a05n_20",Se="_title_1a05n_25",we="_description_1a05n_33",xe="_buttonContainer_1a05n_40",ke="_button_1a05n_40",h={modalContent:_e,iconContainer:ge,warningIcon:ye,title:Se,description:we,buttonContainer:xe,button:ke},Ce=({isOpen:n,onClose:r,refundedAmount:d,currency:e})=>{var O,D;const g=k.useNavigate(),{token:v,shopDomain:y}=k.useStorefrontStore(),{isAntistock:C,general:l}=k.useGeneralStore(),j=!!((O=l==null?void 0:l.info)!=null&&O.disableSupport),m=(D=l==null?void 0:l.info)==null?void 0:D.thirdPartySupportUrl,S=!(j&&!m),w=new Intl.NumberFormat("en-US",{style:"currency",currency:e}),N=()=>{g(C?"/account":"/customer-dash")},u=async()=>{if(j&&m){window.open(m);return}C?window.open(`https://${y}/support`):g("/contact")},c=()=>{r()};return n?t.jsx(_.Modal,{close:r,children:t.jsxs("div",{className:h.modalContent,onClick:P=>P.stopPropagation(),children:[t.jsx("div",{className:h.iconContainer,children:t.jsx(_.Icon,{name:"WarningDiamond",fill:"var(--text-warning)",className:h.warningIcon})}),t.jsx("h2",{className:h.title,children:"Partial Delivery Failure Refund"}),t.jsxs("p",{className:h.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:h.buttonContainer,children:[!v&&t.jsx(_.Button,{type:"Secondary",onClick:N,className:h.button,children:"Login"}),S&&t.jsx(_.Button,{type:"Secondary",onClick:u,className:h.button,children:"Contact Support"}),t.jsx(_.Button,{type:"Primary",onClick:c,className:h.button,children:"Continue"})]})]})}):null},je=()=>{var I,B,F,V,$,T,q,L,E;const{id:n,accessToken:r}=k.useParams(),d=k.useNavigate(),[e,g]=i.useState(),[v,y]=i.useState(!1),[C,l]=i.useState(!1),[j,m]=i.useState(!1),[S,w]=i.useState(!1),N=o.useCopy(),{isAntistock:u,general:c}=k.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 b,R,x;return{id:Number((b=s.productWithVariant)==null?void 0:b.id)||0,image:s.productWithVariant.image,name:(()=>{var W,U;const p=((W=s.productWithVariant)==null?void 0:W.name)||"",f=((U=s.productWithVariant)==null?void 0:U.variantName)||"";return!p&&!f?"":!f||p===f?p:p?`${p} (${f})`:f})(),description:"",price:{quantity:s.quantity,amount:((R=s.productWithVariant)==null?void 0:R.price.amount)||0,currency:(x=s.productWithVariant)==null?void 0:x.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,b,R=!1)=>{var p,f;R||y(!0);const{data:x}=await(b?o.fetchAuthorizedOrder(`${s}/${b}`):o.fetchOrder(s));y(!1),x.status!==o.OrderStatus.Completed&&((p=x.charge)==null?void 0:p.status)===o.ChargeStatus.NotPaid&&d(`/charges/${(f=x.charge)==null?void 0:f.id}`,{replace:!0}),g(x)},[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 G=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]),z=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]),H=i.useMemo(()=>{var s;return((s=c==null?void 0:c.info)==null?void 0:s.domain)||window.location.hostname},[(V=c==null?void 0:c.info)==null?void 0:V.domain]);return v?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:()=>m(!0),isSubmitted:S}),t.jsx(o.CheckoutOrderMainData,{lastUpdate:e.createdAt,paymentType:($=e.charge)==null?void 0:$.gateway,email:e.customer?e.customer.email:((T=e.charge)==null?void 0:T.customerForCharge.email)||"",orderId:e.id}),z&&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:()=>N((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:G,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(Ce,{isOpen:C,onClose:()=>l(!1),refundedAmount:e.refundedPrice.amount,currency:e.refundedPrice.currency}),M&&t.jsx(o.VouchModal,{isOpen:j,onClose:()=>m(!1),products:P,orderId:n,accessToken:r,shopDomain:H,onSuccess:()=>{w(!0),m(!1),n&&A(n,r,!0)}})]})},ve=Object.freeze(Object.defineProperty({__proto__:null,OrderPage:je},Symbol.toStringTag,{value:"Module"}));exports.Orders=Y;exports.index=ve;
|
|
@@ -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 {};
|