PageSourceSearch

https://shop.gund.com/concierge-widgets/mf/assets/OrderHistory-Du4ZQ_aE.js

js gund.com collected 2026-09-24 21:02:00 UTC 20,301 bytes, 50 lines download raw bytes

1import{u as O,a as L,c as l,w as B}from"./useWidgetEditable-CrzJPLUD.js";import{a,_ as r,b as R}from"./_virtual_mf___mfe_internal__concierge_widgets__loadShare__react_mf_1_jsx_mf_2_runtime__loadShare__.js-BDofXZ65.js";import{k as p,g as D,l as $,j as A,h as j}from"./_virtual_mf___mfe_internal__concierge_widgets__loadShare__react__loadShare__.js-BGOp_18Y.js";import{f as T}from"./money-DcX7CTzx.js";const N=5,H=["checkout_success","checkout_in_progress","checkout_error"],U="UserRetailerCheckoutOrders",E=`
2  query getUserRetailerCheckoutOrders(
3    $statuses: [String!]
4    $page: PageFilter
5  ) {
6    UserRetailerCheckoutOrders(
7      statuses: $statuses
8      page: $page
9    ) {
10      items {
11        checkoutBatchId
12        orderId
13        retailerOrderId
14        userId
15        updatedTime
16        orderType
17        items
18        products
19        status
20        retailerId
21        shippingAddress {
22          address1
23          address2
24          city
25          state
26          zipCode
27          country
28          firstName
29          lastName
30        }
31        billingAddress {
32          address1
33          address2
34          city
35          state
36          zipCode
37          country
38          firstName
39          lastName
40        }
41        orderSummary
42        userInteractionRequirement
43      }
44      total
45      maxPages
46      nextPage
47      hasMore
48    }
49  }
50`;function W(e){return e.map(o=>({orderId:o.orderId,retailerOrderId:o.retailerOrderId,orderDate:o.updatedTime,status:o.status,items:(o.items||[]).map(i=>{const d=o.products?.[i.stacklineSku];return{title:d?.title||i.title||i.retailerSku||"Unknown item",imageUrl:d?.imageUrls?.[0],price:i.retailPrice||0,quantity:i.quantity||1}}),totalAmount:o.orderSummary?.total??(o.items||[]).reduce((i,d)=>i+(d.retailPrice||0)*(d.quantity||1),0)}))}function M(e){if(e.startsWith("http"))try{return`${new URL(e).origin}/api-checkout/graphql?id=getUserRetailerCheckoutOrdersV2`}catch{}return"/api-checkout/graphql?id=getUserRetailerCheckoutOrdersV2"}function q(e,o){const[i,d]=p(0),[c,n]=p(new Map),[m,y]=p(0),[S,k]=p(!1),[w,v]=p(null),h=D(c);h.current=c;const z=$(async t=>{if(e.token){if(h.current.has(t)){d(t);return}k(!0),v(null);try{const s=M(o),b=await fetch(s,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${e.token}`},body:JSON.stringify({query:E,variables:{statuses:H,page:{start:t*N,size:N}}})});if(!b.ok)throw new Error(`HTTP ${b.status}`);const g=(await b.json()).data?.[U],C=W(g?.items??[]);n(x=>new Map(x).set(t,C)),y(g?.total??0),d(t)}catch(s){v(s instanceof Error?s.message:"Failed to load orders")}finally{k(!1)}}},[e.token,o]);return{currentPage:i,orders:c.get(i)??[],total:m,totalPages:Math.ceil(m/N),isLoading:S,error:w,fetchPage:z,hasFetched:c.size>0}}const V="order-history",F=[{label:"400",value:"400"},{label:"500",value:"500"},{label:"600",value:"600"},{label:"700",value:"700"}],G={cardBgColor:l("#ffffff"),cardBorderColor:l("#dcdddc"),cardBorderRadius:12,cardPadding:14,cardGap:12,headingColor:l(""),headingFontSize:16,headingFontWeight:"700",orderIdColor:l("#1a1a2e"),orderIdFontSize:13,orderIdFontWeight:"600",mutedColor:l("#6b7280"),metaFontSize:12,itemTitleColor:l("#1a1a2e"),itemTitleFontSize:12,itemImageSize:64,itemImageRadius:6,footerBorderColor:l("#e5e7eb"),totalAmountColor:l("#1a1a2e"),totalFontSize:13,statusRadius:10,statusSuccessColor:l("#71C184"),statusPendingColor:l("#d97706"),statusFailedColor:l("#dc2626"),paginationColor:l("#3b82f6")},Y=[{key:"cardBgColor",label:"Card Background",type:"color",group:"Order Card"},{key:"cardBorderColor",label:"Card Border",type:"color",group:"Order Card"},{key:"cardBorderRadius",label:"Card Radius (px)",type:"number",min:0,max:24,step:2,group:"Order Card"},{key:"cardPadding",label:"Card Padding (px)",type:"number",min:8,max:28,step:2,group:"Order Card"},{key:"cardGap",label:"Gap Between Cards (px)",type:"number",min:4,max:28,step:2,group:"Order Card"},{key:"headingColor",label:"Heading Color",type:"color",group:"Header"},{key:"headingFontSize",label:"Heading Font Size (px)",type:"number",min:12,max:24,step:1,group:"Header"},{key:"headingFontWeight",label:"Heading Font Weight",type:"options",options:[...F],group:"Header"},{key:"orderIdColor",label:"Order ID Color",type:"color",group:"Order Details"},{key:"orderIdFontSize",label:"Order ID Size (px)",type:"number",min:10,max:20,step:1,group:"Order Details"},{key:"orderIdFontWeight",label:"Order ID Weight",type:"options",options:[...F],group:"Order Details"},{key:"mutedColor",label:"Secondary Text Color",type:"color",group:"Order Details"},{key:"metaFontSize",label:"Secondary Text Size (px)",type:"number",min:10,max:16,step:1,group:"Order Details"},{key:"itemTitleColor",label:"Item Title Color",type:"color",group:"Line Items"},{key:"itemTitleFontSize",label:"Item Title Size (px)",type:"number",min:10,max:18,step:1,group:"Line Items"},{key:"itemImageSize",label:"Item Image Size (px)",type:"number",min:40,max:96,step:4,group:"Line Items"},{key:"itemImageRadius",label:"Item Image Radius (px)",type:"number",min:0,max:20,step:2,group:"Line Items"},{key:"footerBorderColor",label:"Footer Divider",type:"color",group:"Total"},{key:"totalAmountColor",label:"Total Amount Color",type:"color",group:"Total"},{key:"totalFontSize",label:"Total Font Size (px)",type:"number",min:10,max:20,step:1,group:"Total"},{key:"statusRadius",label:"Status Pill Radius (px)",type:"number",min:0,max:20,step:2,group:"Status Pill"},{key:"statusSuccessColor",label:"Delivered / Success",type:"color",group:"Status Pill"},{key:"statusPendingColor",label:"Pending",type:"color",group:"Status Pill"},{key:"statusFailedColor",label:"Failed",type:"color",group:"Status Pill"},{key:"paginationColor",label:"Pagination Link Color",type:"color",group:"Pagination"}];function Q(e){const o=new Date(e);return isNaN(o.getTime())?e:o.toLocaleDateString("en-US",{year:"numeric",month:"short",day:"numeric"})}function Z(e){return e.replace(/_/g," ").replace(/checkout\s*/i,"").trim()||"Processing"}function J(e){return e==="checkout_success"?"concierge-order-history-status-success":e==="checkout_error"?"concierge-order-history-status-failed":"concierge-order-history-status-other"}function K(e){const o=e?.storeBrandingType==="CustomDTCStore";return`${window.location.origin}${o?"/purchase":"/dashboard/purchase"}`}function X(){const e=typeof window<"u"?window.__BC_BOOTSTRAP__:null;return e?e.servingSurface==="shopify_app_proxy"?!0:typeof e.routePath=="string"&&e.routePath.length>0:!1}function ee(e,o){return X()?window.__BC_BOOTSTRAP__?.customerAccountsVersion==="classic"?`${window.location.origin}/account`:`${window.location.origin}/account/orders`:`${K(o)}/${e.orderId}`}function re({size:e,color:o}){return a("svg",{width:e,height:e,viewBox:"0 0 24 24",fill:"none",stroke:o,strokeWidth:"2",children:[r("path",{d:"M16.5 9.4L7.5 4.21M21 16V8C20.9996 7.6481 20.9071 7.3024 20.7315 6.99847C20.556 6.69454 20.3037 6.44327 20 6.27L13 2.27C12.696 2.09674 12.3511 2.0053 12 2.0053C11.6489 2.0053 
5011.304 2.09674 11 2.27L4 6.27C3.69626 6.44327 3.44398 6.69454 3.26846 6.99847C3.09294 7.3024 3.00036 7.6481 3 8V16C3.00036 16.3519 3.09294 16.6976 3.26846 17.0015C3.44398 17.3055 3.69626 17.5567 4 17.73L11 21.73C11.304 21.9033 11.6489 21.9947 12 21.9947C12.3511 21.9947 12.696 21.9033 13 21.73L20 17.73C20.3037 17.5567 20.556 17.3055 20.7315 17.0015C20.9071 16.6976 20.9996 16.3519 21 16Z",strokeLinecap:"round",strokeLinejoin:"round"}),r("path",{d:"M3.27002 6.96L12 12.01L20.73 6.96",strokeLinecap:"round",strokeLinejoin:"round"}),r("path",{d:"M12 22.08V12",strokeLinecap:"round",strokeLinejoin:"round"})]})}function oe({size:e,color:o}){return a("svg",{width:e,height:e,viewBox:"0 0 24 24",fill:"none",stroke:o,strokeWidth:"2",children:[r("path",{d:"M6 2L3 6V20C3 20.5304 3.21071 21.0391 3.58579 21.4142C3.96086 21.7893 4.46957 22 5 22H19C19.5304 22 20.0391 21.7893 20.4142 21.4142C20.7893 21.0391 21 20.5304 21 20V6L18 2H6Z",strokeLinecap:"round",strokeLinejoin:"round"}),r("path",{d:"M3 6H21",strokeLinecap:"round",strokeLinejoin:"round"}),r("path",{d:"M16 10C16 11.0609 15.5786 12.0783 14.8284 12.8284C14.0783 13.5786 13.0609 14 12 14C10.9391 14 9.92172 13.5786 9.17157 12.8284C8.42143 12.0783 8 11.0609 8 10",strokeLinecap:"round",strokeLinejoin:"round"})]})}function te({src:e,fallbackSrc:o,alt:i}){const[d,c]=p(!1),[n,m]=p(!1),y=d?o:e;return!y||n?r(re,{size:20,color:"#9ca3af"}):r("img",{src:y,alt:i,onError:()=>{!d&&o?c(!0):m(!0)},style:{maxWidth:"100%",maxHeight:"100%",objectFit:"contain"}})}function ie(){return r("div",{className:"concierge-order-history-skeleton-list",children:[0,1,2].map(e=>a("div",{className:"concierge-order-history-skeleton-card",children:[r("div",{className:"concierge-order-history-skeleton-line",style:{width:"50%",marginBottom:8}}),r("div",{className:"concierge-order-history-skeleton-line",style:{width:"30%",marginBottom:14}}),a("div",{style:{display:"flex",gap:10,alignItems:"center",marginBottom:8},children:[r("div",{className:"concierge-order-history-skeleton-line",style:{width:40,height:40,borderRadius:6}}),a("div",{style:{flex:1},children:[r("div",{className:"concierge-order-history-skeleton-line",style:{width:"70%",marginBottom:6}}),r("div",{className:"concierge-order-history-skeleton-line",style:{width:"40%"}})]})]}),a("div",{style:{borderTop:"1px solid #e5e7eb",marginTop:12,paddingTop:10,display:"flex",justifyContent:"space-between"},children:[r("div",{className:"concierge-order-history-skeleton-line",style:{width:"20%"}}),r("div",{className:"concierge-order-history-skeleton-line",style:{width:"25%"}})]})]},e))})}function ae({order:e,orderDetailUrl:o}){const i=J(e.status),d=(e.retailerOrderId||e.orderId).replace(/^#/,"");return a("div",{className:"concierge-order-history-card",children:[a("div",{className:"concierge-order-history-card-header",children:[a("div",{children:[r("div",{className:"concierge-order-history-order-id",children:a("a",{href:o,target:"_blank",rel:"noopener noreferrer",children:["Order #",d.slice(-8).toUpperCase()]})}),r("div",{className:"concierge-order-history-order-date",children:Q(e.orderDate)})]}),r("span",{className:`concierge-order-history-order-status ${i}`,children:Z(e.status)})]}),a("div",{className:"concierge-order-history-items",children:[e.items.slice(0,2).map((c,n)=>
50a("div",{className:"concierge-order-history-item-row",children:[r("div",{className:"concierge-order-history-item-image",children:r(te,{src:c.imageUrl,fallbackSrc:c.imageUrl?.replace("media.brandclub.com","media-api.brandclub.com"),alt:c.title})}),a("div",{className:"concierge-order-history-item-details",children:[r("div",{className:"concierge-order-history-item-title",children:c.title}),r("div",{className:"concierge-order-history-item-meta",children:a("span",{children:["Quantity: ",c.quantity]})}),r("div",{className:"concierge-order-history-item-meta",children:a("span",{children:["Price: ",T(c.price)]})})]})]},n)),e.items.length>2&&a("div",{className:"concierge-order-history-more-items",children:["+",e.items.length-2," more item",e.items.length-2!==1?"s":""]})]}),a("div",{className:"concierge-order-history-card-footer",children:[r("span",{className:"concierge-order-history-total-label",children:"Total"}),r("span",{className:"concierge-order-history-total-amount",children:T(e.totalAmount)})]})]})}function ne(e){if(!e||!Array.isArray(e.orders))return null;const o=e.orders.map(i=>({orderId:String(i.orderId??""),retailerOrderId:i.retailerOrderId,orderDate:String(i.orderDate??""),status:String(i.status??""),items:Array.isArray(i.items)?i.items:[],totalAmount:Number(i.totalAmount??0)}));return{orders:o,total:Number(e.total??o.length),error:typeof e.error=="string"?e.error:void 0}}function se(){const{wasAuthenticated:e,auth:o,apiBaseUrl:i,ctx:d,toolOutput:c}=O(),n=A(()=>ne(c),[c]),{currentPage:m,orders:y,total:S,totalPages:k,isLoading:w,error:v,fetchPage:h,hasFetched:z}=q(o,i),{state:t,resolveColor:s}=L(V,G,Y),b={"--coh-card-bg":s(t.cardBgColor,"#ffffff"),"--coh-card-border":s(t.cardBorderColor,"#dcdddc"),"--coh-card-radius":`${t.cardBorderRadius}px`,"--coh-card-padding":`${t.cardPadding}px`,"--coh-card-gap":`${t.cardGap}px`,...s(t.headingColor,"")?{"--coh-heading-color":s(t.headingColor,"")}:{},"--coh-heading-font-size":`${t.headingFontSize}px`,"--coh-heading-font-weight":String(t.headingFontWeight),"--coh-order-id-color":s(t.orderIdColor,"#1a1a2e"),"--coh-order-id-font-size":`${t.orderIdFontSize}px`,"--coh-order-id-font-weight":String(t.orderIdFontWeight),"--coh-muted-color":s(t.mutedColor,"#6b7280"),"--coh-meta-font-size":`${t.metaFontSize}px`,"--coh-item-title-color":s(t.itemTitleColor,"#1a1a2e"),"--coh-item-title-font-size":`${t.itemTitleFontSize}px`,"--coh-item-image-size":`${t.itemImageSize}px`,"--coh-item-image-radius":`${t.itemImageRadius}px`,"--coh-footer-border":s(t.footerBorderColor,"#e5e7eb"),"--coh-total-amount-color":s(t.totalAmountColor,"#1a1a2e"),"--coh-total-font-size":`${t.totalFontSize}px`,"--coh-status-radius":`${t.statusRadius}px`,"--coh-status-success-color":s(t.statusSuccessColor,"#71C184"),"--coh-status-pending-color":s(t.statusPendingColor,"#d97706"),"--coh-status-failed-color":s(t.statusFailedColor,"#dc2626"),"--coh-pagination-color":s(t.paginationColor,"#3b82f6")};if(j(()=>{n||e&&o.token&&h(0)},[e,o.token,n]),!e)return null;const P=n?n.orders:y,g=n?n.total:S,C=n?n.error??null:v,x=n?!0:z,u=n?!1:w,I=n?1:k,f=n?0:m;return a("div",{className:"concierge-order-history-section",style:b,children:[u&&!x&&r("div",{style:{marginBottom:16},children:r(ie,{})}),C&&!u&&a("div",{className:"concierge-order-history-error",children:["Failed to load orders."," ",!n&&r("a",{onClick:()=>h(f),className:"concierge-order-history-retry-link",children:"Try again"})]}),!u&&!C&&x&&g===0&&a("div",{className:"concierge-order-history-empty",children:[r(oe,{size:40,color:"#9ca3af"}),r("p",{children:"No orders found"}),r("span",{children:"Your order history will appear here"})]}),x&&g>0&&a(R,{children:[a("div",{className:"concierge-order-history-header",children:[r("h3",{className:"concierge-order-history-title",children:"Your Orders"}),a("span",{className:"concierge-order-history-count",children:[g," order",g!==1?"s":""]})]}),r("div",{style:{opacity:u?.5:1,transition:"opacity 0.2s",pointerEvents:u?"none":"auto"},children:r("div",{className:"concierge-order-history-cards",children:P.map(_=>r(ae,{order:_,orderDetailUrl:ee(_,d.domainConfig)},_.orderId))})}),!n&&I>1&&a("div",{className:"concierge-order-history-pagination",children:[r("button",{className:"concierge-order-history-page-button",disabled:f===0||u,onClick:()=>h(f-1),children:"‹ Prev"}),a("span",{className:"concierge-order-history-page-info",children:["Page ",f+1," of ",I]}),r("button",{className:"concierge-order-history-page-button",disabled:f>=I-1||u,onClick:()=>h(f+1),children:"Next ›"})]})]})]})}const ce="@keyframes concierge-order-history-shimmer{0%{background-position:200% 0}to{background-position:-200% 0}}@keyframes concierge-order-history-fade-in{0%{opacity:0;transform:translateY(6px)}to{opacity:1;transform:translateY(0)}}.concierge-order-history-section{animation:concierge-order-history-fade-in .35s ease-out both}.concierge-order-history-header{display:flex;justify-content:space-between;align-items:center;margin-bottom:4px}.concierge-order-history-title{font-size:var(--coh-heading-font-size, 16px);
50font-weight:var(--coh-heading-font-weight, 700);color:var(--coh-heading-color, inherit);margin:0}.concierge-order-history-count{font-size:13px;color:var(--coh-muted-color, #6b7280)}.concierge-order-history-cards{display:flex;flex-direction:column;gap:var(--coh-card-gap, 12px);margin-bottom:20px}.concierge-order-history-card{border:1px solid var(--coh-card-border, #dcdddc);border-radius:var(--coh-card-radius, 12px);padding:var(--coh-card-padding, 14px);background:var(--coh-card-bg, #fff)}.concierge-order-history-card-header{display:flex;justify-content:space-between;align-items:flex-start;margin-bottom:12px}.concierge-order-history-order-id{font-size:var(--coh-order-id-font-size, 13px);font-weight:var(--coh-order-id-font-weight, 600);color:var(--coh-order-id-color, #1a1a2e)}.concierge-order-history-order-id a{color:var(--coh-order-id-color, #1a1a2e);text-decoration:none}.concierge-order-history-order-id a:hover{text-decoration:underline}.concierge-order-history-order-date{font-size:var(--coh-meta-font-size, 12px);color:var(--coh-muted-color, #6b7280);margin-top:2px}.concierge-order-history-order-status{font-size:11px;font-weight:500;text-transform:capitalize;padding:2px 8px;border-radius:var(--coh-status-radius, 10px);white-space:nowrap}.concierge-order-history-status-success{color:var(--coh-status-success-color, #71C184);background:#71c1840d;background:color-mix(in srgb,var(--coh-status-success-color, #71C184) 5%,transparent)}.concierge-order-history-status-other{color:var(--coh-status-pending-color, #d97706);background:#fffbeb;background:color-mix(in srgb,var(--coh-status-pending-color, #d97706) 8%,white)}.concierge-order-history-status-failed{color:var(--coh-status-failed-color, #dc2626);background:#fef2f2;background:color-mix(in srgb,var(--coh-status-failed-color, #dc2626) 6%,white)}.concierge-order-history-items{display:flex;flex-direction:column;gap:10px}.concierge-order-history-item-row{display:flex;align-items:center;gap:10px}.concierge-order-history-item-image{width:var(--coh-item-image-size, 64px);height:var(--coh-item-image-size, 64px);border-radius:var(--coh-item-image-radius, 6px);overflow:hidden;background:var(--coh-card-bg, #fff);display:flex;align-items:center;justify-content:center;flex-shrink:0}.concierge-order-history-item-image img{max-width:100%;max-height:100%;object-fit:contain}.concierge-order-history-item-details{flex:1;min-width:0}.concierge-order-history-item-title{font-size:var(--coh-item-title-font-size, 12px);color:var(--coh-item-title-color, #1a1a2e);overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.concierge-order-history-item-meta{font-size:var(--coh-meta-font-size, 12px);color:var(--coh-muted-color, #6b7280);display:flex;gap:6px}.concierge-order-history-more-items{font-size:var(--coh-meta-font-size, 12px);color:var(--coh-muted-color, #6b7280)}.concierge-order-history-card-footer{display:flex;justify-content:space-between;margin-top:12px;padding-top:10px;border-top:1px solid var(--coh-footer-border, #e5e7eb);font-size:var(--coh-total-font-size, 13px)}.concierge-order-history-total-label{color:var(--coh-muted-color, #6b7280)}.concierge-order-history-total-amount{font-weight:600;color:var(--coh-total-amount-color, #1a1a2e)}.concierge-order-history-pagination{display:flex;justify-content:center;align-items:center;gap:16px;margin-top:14px;padding-top:4px}.concierge-order-history-page-button{border:none;background:none;font-size:13px;font-weight:500;color:var(--coh-pagination-color, #3b82f6);cursor:pointer;padding:4px 8px;border-radius:6px;transition:background-color .15s}.concierge-order-history-page-button:hover:not(:disabled){background:#eff6ff;background:color-mix(in srgb,var(--coh-pagination-color, #3b82f6) 8%,white)}.concierge-order-history-page-button:disabled{color:#d1d5db;cursor:default}.concierge-order-history-page-info{font-size:var(--coh-meta-font-size, 12px);color:var(--coh-muted-color, #6b7280)}.concierge-order-history-empty{display:flex;flex-direction:column;align-items:center;gap:8px;padding:24px 0;color:var(--coh-muted-color, #6b7280)}.concierge-order-history-empty p{margin:0;font-size:14px;font-weight:500}.concierge-order-history-empty span{font-size:12px}.concierge-order-history-error{font-size:13px;color:var(--coh-status-failed-color, #dc2626);padding:12px 0}.concierge-order-history-retry-link{color:var(--coh-pagination-color, #3b82f6);cursor:pointer;text-decoration:underline}.concierge-order-history-skeleton-list{display:flex;flex-direction:column;gap:var(--coh-card-gap, 12px)}.concierge-order-history-skeleton-card{border:1px solid var(--coh-footer-border, #e5e7eb);border-radius:var(--coh-card-radius, 12px);padding:var(--coh-card-padding, 14px);background:var(--coh-card-bg, #fff)}.concierge-order-history-skeleton-line{height:12px;border-radius:4px;background:linear-gradient(90deg,#f3f4f6 25%,#e5e7eb,#f3f4f6 75%);background-size:200% 100%;animation:concierge-order-history-shimmer 1.5s infinite}",ue=B(se,ce);export{ue as default};

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.