PageSourceSearch

https://static.nyse.com/cms/41.10.13/chunks/cms-components/expiry-calendar/Main-CHZjg3PE.js

js nyse.com collected 2026-09-24 15:20:32 UTC 16,612 bytes, 1 lines download raw bytes

1import{D as O,h as W,j as e,a as x,F as T,A as Q}from"../../__generated__/components/demos-BWJdxTKc.js";import{B as P,b as q,S as Z,E as ee}from"../../var/opt/jenkins/workspace/ont-end-monorepo_release_2026-38/packages/website-components/build/components/feedback/Spinner-DUsTxTNV.js";import{u as te}from"../../shared/render-context/useCmsProxyBaseUrl-COjzMAoE.js";import{C as B,A as V,D as se,E as ae,F as re,f as v,o as ne,p as $,G as oe}from"../../node_modules/-pnpm/date-fns@2-30-0/node_modules/date-fns/addYears/index-js-commonjs-es-import-BnwbL-Tz.js";import{D as I}from"../../var/opt/jenkins/workspace/ont-end-monorepo_release_2026-38/packages/website-components/build/components/controls/form/DateTime-BR6WHZP_.js";import{R as ie}from"../../var/opt/jenkins/workspace/ont-end-monorepo_release_2026-38/packages/website-components/build/components/controls/form/Radio-DsnCX6g_.js";import{C as U}from"../../var/opt/jenkins/workspace/ont-end-monorepo_release_2026-38/packages/website-components/build/components/controls/form/Checkbox-B7RWsuLj.js";import{M as ce}from"../../node_modules/-pnpm/@meronex-icons@4-0-0_react@18-3-1/node_modules/@meronex/icons/vsc/VscChevronRight-js-commonjs-es-import-CEDQAU_Y.js";import{M as de}from"../../node_modules/-pnpm/@meronex-icons@4-0-0_react@18-3-1/node_modules/@meronex/icons/md/MdDelete-js-commonjs-es-import-icqPU0qo.js";import{D as ue}from"../../var/opt/jenkins/workspace/ont-end-monorepo_release_2026-38/packages/website-components/build/components/overlays/DropdownButton-YxC5Rwv_.js";import{r as j}from"../../node_modules/-pnpm/@theice-val@4-0-4_@types-express@4-17-25_eslint@9-39-4_jiti@2-6-1__typescript@5-9-3/node_modules/@theice/val/build/required-Dqmey6Jh.js";import{p as g}from"../../node_modules/-pnpm/@theice-val@4-0-4_@types-express@4-17-25_eslint@9-39-4_jiti@2-6-1__typescript@5-9-3/node_modules/@theice/val/build/provideLabel-ry0S_voM.js";import{m as b}from"../../node_modules/-pnpm/@theice-val@4-0-4_@types-express@4-17-25_eslint@9-39-4_jiti@2-6-1__typescript@5-9-3/node_modules/@theice/val/build/minLength-j_-qONci.js";import{c as pe}from"../../node_modules/-pnpm/@theice-val@4-0-4_@types-express@4-17-25_eslint@9-39-4_jiti@2-6-1__typescript@5-9-3/node_modules/@theice/val/build/createStructuredValidator-D7WHQFPw.js";import{c as A}from"../../node_modules/-pnpm/@theice-val@4-0-4_@types-express@4-17-25_eslint@9-39-4_jiti@2-6-1__typescript@5-9-3/node_modules/@theice/val/build/composeValidators-C9n9veTE.js";import{m as H}from"../../node_modules/-pnpm/@theice-val@4-0-4_@types-express@4-17-25_eslint@9-39-4_jiti@2-6-1__typescript@5-9-3/node_modules/@theice/val/build/maybeValidate-aEgRDKgc.js";import{m as le}from"../../node_modules/-pnpm/@theice-val@4-0-4_@types-express@4-17-25_eslint@9-39-4_jiti@2-6-1__typescript@5-9-3/node_modules/@theice/val/build/maxLength-DNznIpGg.js";import{T as he}from"../../var/opt/jenkins/workspace/ont-end-monorepo_release_2026-38/packages/website-components/build/components/controls/form/TypeAhead-DCNouvcT.js";import{D as me}from"../../var/opt/jenkins/workspace/ont-end-monorepo_release_2026-38/packages/website-components/build/components/icons/DownloadIcon-D96NbmIU.js";import{D as xe}from"../../var/opt/jenkins/workspace/ont-end-monorepo_release_2026-38/packages/website-components/build/components/tables/DataTable-COf92ahU.js";import{z as ye,B as X}from"../../node_modules/-pnpm/@theice-pushpop@3-5-0_@types-express@4-17-25/node_modules/@theice/pushpop/build/array/replace-CrA0QeSp.js";import"../../node_modules/-pnpm/react-router@6-30-1_react@18-3-1/node_modules/react-router/dist/index-js-commonjs-proxy-MJ4LALBs.js";import"../../shared/utils/shouldUseProxy-Bv9cgI89.js";import"../../__generated__/components/main-P_GPF7cQ.js";import"../../__generated__/components/meta-BotoKQQI.js";import"../../var/opt/jenkins/workspace/ont-end-monorepo_release_2026-38/packages/website-components/build/components/controls/form/Textbox-BBBKGwC5.js";import"../../node_modules/-pnpm/@meronex-icons@4-0-0_react@18-3-1/node_modules/@meronex/icons/md/MdCheck-js-commonjs-es-import-B2JyXnGp.js";import"../../var/opt/jenkins/workspace/ont-end-monorepo_release_2026-38/packages/website-components/build/components/overlays/Backdrop-BTrDVMz2.js";import"../../var/opt/jenkins/workspace/ont-end-monorepo_release_2026-38/packages/website-components/build/utils/colorClasses-Cqi7H3Wn.js";import"../../var/opt/jenkins/workspace/ont-end-monorepo_release_2026-38/packages/website-components/build/components/navigation/Menu-GGQ54aVN.js";import"../../var/opt/jenkins/workspace/ont-end-monorepo_release_2026-38/packages/website-components/build/components/navigation/MenuButton-c9u2E3uM.js";import"../../var/opt/jenkins/workspace/ont-end-monorepo_release_2026-38/packages/website-components/build/hooks/useIsMounted-BZmvc66K.js";const M="dd-MMM-yyyy",Ee=O["long:date"],L={FTD:"First Trading Date",LTD:"Last Trading Date",FDD:"First Delivery Date",LDD:"Last Delivery Date",FND:"First Notice Date",LND:"Last Notice Date",FSD:"Final Settlement Date"},De=["ICE Futures U.S.","ICE Futures Europe","ICE OTC","ICE Endex","ICE Futures Singapore","ICE Futures Abu Dhabi"],K={exchanges:"All Products by Exchange",products:"Individual Products"},R=({productName:t,hubAlias:s,pcc:r})=>"".concat(t,"-").concat(s,"-").concat(r),Te=(t,s)=>{var r,c;if(s.type==="INIT")return{...t,dateFrom:V(Date.now()),dateTo:B(Date.now())};switch(s.type){case"SET_STRATEGY":return{...t,strategy:s.strategy};case"SET_MONTH":return{...t,dateFrom:s.date?V(s.date):void 0,dateTo:s.date?B(s.date):void 0};case"SET_DATE_FROM":return{...t,dateFrom:(r=s.dateFrom)!=null?r:void 0};case"SET_DATE_TO":return{...t,dateTo:(c=s.dateTo)!=null?c:void 0};case"ADD_EXPIRATION_TYPE":return{...t,expirationTypes:[...t.expirationTypes,s.expirationType]};
1case"REMOVE_EXPIRATION_TYPE":return{...t,expirationTypes:t.expirationTypes.filter(a=>a!==s.expirationType)};case"ADD_EXCHANGE":return{...t,exchanges:[...t.exchanges,s.exchange]};case"REMOVE_EXCHANGE":return{...t,exchanges:t.exchanges.filter(a=>a!==s.exchange)};case"ADD_PRODUCT":return{...t,products:[...t.products,s.product]};case"REMOVE_PRODUCT":return{...t,products:t.products.filter(a=>R(a)!==s.id)};default:{const a=s;throw new Error("Unexpected action: ".concat(a.type))}}},ge=(t,s,r)=>(r==null?void 0:r.strategy)==="exchanges"&&t!=null&&!re(t)?["".concat(s!=null?s:"Start Date"," should be the first day of the month.")]:null,fe=(t,s,r)=>{const{strategy:c,dateFrom:a}=r!=null?r:{};return a==null||t==null?null:a>t?["".concat(s!=null?s:"End Date"," should be ahead of Start Date")]:c==="exchanges"&&(t.getFullYear()!==a.getFullYear()||t.getMonth()!==a.getMonth()||!se(t))?["".concat(s!=null?s:"End Date"," should be the last day of the same month.")]:c==="products"&&ae(a,t)!==0?["".concat(s!=null?s:"End Date"," must be within a year of Start Date.")]:null},je=pe({strategy:g("Get Expiry Dates By",j),dateFrom:g("Start Date",A(j,ge)),dateTo:g("End Date",A(j,fe)),products:g("Products",H(t=>(t==null?void 0:t.strategy)==="products",A(j,b(1),g("Product",le(25))))),exchanges:g("Exchanges",H(t=>(t==null?void 0:t.strategy)==="exchanges",A(j,b(1)))),expirationTypes:g("Expiration Types",A(j,b(1)))}),z=async(t,{strategy:s,dateFrom:r,dateTo:c,expirationTypes:a,products:d,exchanges:o},n="json",l)=>{const p=v(r,M),E=v(c,M),D=s==="products"?{dateFrom:p,dateTo:E,expirationTypes:a,products:d}:{markets:o,expirationTypes:a,dateFrom:p,dateTo:E};let y=t;y="".concat(y,"/marketdata/api/expiry-calendar"),y=s==="products"?"".concat(y,"/products"):"".concat(y,"/exchange"),y=l==="calendar"?"".concat(y,"/calendar"):y,n!=="json"&&(y="".concat(y,"/").concat(n));const f=await fetch(y,{method:"POST",headers:{Accept:n==="csv"?"text/csv":n==="pdf"?"application/pdf":"application/json","Content-Type":"application/json"},body:JSON.stringify(D)});return W(f),f},Re=t=>{const s=t.headers.get("content-disposition");if(s){const r=/filename="?(.*)"?/.exec(s);if(r)return r[1]}},C=async(t,s,r,c)=>{var n;const a=await z(t,s,r,c),d=await a.blob(),o=document.createElement("a");o.href=URL.createObjectURL(d),o.download=(n=Re(a))!=null?n:"expiry-calendar.".concat(r),o.click(),URL.revokeObjectURL(o.href)},_=({minWidth:t,children:s,...r})=>e.jsx("div",{...r,style:{display:"grid",objectFit:"cover",gridTemplateColumns:"repeat(auto-fit, minmax(".concat(t,"px, 1fr))"),gap:"0 0.5rem"},children:s}),Ae=async(t,s)=>{const r=await fetch("".concat(t,"/marketdata/api/expiry-calendar/products/search?token=").concat(encodeURIComponent(s)),{headers:{Accept:"application/json"}});return W(r),await r.json()},Oe=({apiBaseUrl:t,id:s,onSelect:r,onBlur:c,selectedProducts:a})=>{const[d,o]=x.useState(""),n=x.useMemo(()=>new Set(a.map(R)),[a]),l=x.useCallback(async p=>(await Ae(t,p)).filter(D=>!n.has(R(D))),[t,n]);return e.jsx(he,{id:s,placeholder:"Search Products",value:d,onChange:p=>o(p),fetchResults:l,parseResult:p=>({id:R(p),value:"".concat(p.productName," - ").concat(p.hubAlias," - ").concat(p.pcc)}),onSelect:(p,E)=>{r(p,E),o("")},onBlur:c,debounceTime:500})},N=({download:t,children:s,testid:r})=>{const[c,a]=x.useState({status:"IDLE"}),[d,o]=x.useState("default");return x.useEffect(()=>{if(c.status==="READY"){o("good");const n=setTimeout(()=>{a({status:"IDLE"}),o("default")},5e3);return()=>clearTimeout(n)}else c.status==="ERROR"&&o("bad")},[c.status]),e.jsx(P,{type:"button",title:c.status==="ERROR"?c.error.message:r,"data-testid":r,"data-intent":d,disabled:c.status==="LOADING",wide:!0,onClick:()=>{a({status:"LOADING"}),o("default"),t().then(()=>a({status:"READY",data:null}),n=>a({status:"ERROR",error:n instanceof Error?n:new Error("Error: ".concat(String(n)))}))},icon:c.status==="LOADING"?e.jsx(q,{}):e.jsx(me,{}),iconPosition:"right",intent:d,children:s})},Fe={strategy:!0,exchanges:!0,expirationTypes:!0,dateFrom:!0,dateTo:!0,products:!0},Se=({apiBaseUrl:t,savedFilters:s,save:r,isLoading:c})=>{var G,k,Y;
1const[a,d]=x.useState({}),[o,n]=x.useReducer(Te,s!=null?s:{strategy:"exchanges",exchanges:[],products:[],expirationTypes:Object.keys(L)}),{strategy:l,exchanges:p,expirationTypes:E,dateFrom:D,dateTo:y,products:f}=o,u=je(o),F=!u,J=[...(G=u==null?void 0:u.dateFrom)!=null?G:[],...(k=u==null?void 0:u.dateTo)!=null?k:[]],h=i=>d(m=>({...m,[i]:!0})),S=()=>d(Fe);return x.useEffect(()=>{n({type:"INIT"})},[]),e.jsxs("form",{className:"flex flex-col gap-4",children:[e.jsx(T,{label:"Get Expiry Dates By",error:a.strategy?u==null?void 0:u.strategy:null,children:e.jsx(_,{minWidth:250,children:Object.keys(K).map(i=>e.jsx(ie,{id:"strategy-".concat(i),name:"strategy",value:i,checked:l===i,onChange:()=>{n({type:"SET_STRATEGY",strategy:i}),h("strategy")},onBlur:()=>h("strategy"),children:K[i]},i))})}),l==="products"&&e.jsxs(e.Fragment,{children:[e.jsx("label",{children:"Date Range"}),e.jsxs("div",{style:{display:"flex"},children:[e.jsx("div",{style:{flexGrow:1},children:e.jsx(T,{error:a.dateFrom?u==null?void 0:u.dateFrom:null,children:e.jsx(I,{value:D?v(D,O["input:date"]):"",onChange:i=>{const m=i?ne($(i,O["input:date"],0)):null;n({type:"SET_DATE_FROM",dateFrom:m}),h("dateFrom")},onBlur:()=>h("dateFrom"),"aria-label":"Start Date"})})}),e.jsx("div",{style:{margin:"0 1rem"},children:" to "}),e.jsx("div",{style:{flexGrow:1},children:e.jsx(T,{error:a.dateTo?u==null?void 0:u.dateTo:null,children:e.jsx(I,{format:O["input:date"],value:y,onChange:(i,m)=>{const w=m?oe(m):null;n({type:"SET_DATE_TO",dateTo:w}),h("dateTo")},onBlur:()=>h("dateTo"),"aria-label":"End Date"})})})]})]}),l==="exchanges"&&e.jsx(T,{labelFor:"month",label:"Month",error:((Y=a.dateFrom)!=null?Y:a.dateTo)?J:null,children:e.jsx(I,{type:"month",id:"month",format:O["input:month"],value:D,onChange:(i,m)=>{n({type:"SET_MONTH",date:m!=null?m:null}),h("dateFrom"),h("dateTo")},onBlur:()=>{h("dateFrom"),h("dateTo")}})}),e.jsx("div",{className:"mb-4"}),e.jsx(T,{label:"Expiration Date Types",error:a.expirationTypes?u==null?void 0:u.expirationTypes:null,children:e.jsx(_,{minWidth:250,"data-testid":"date-type-checkboxes",children:Object.entries(L).map(([i,m])=>e.jsx("div",{children:e.jsx(U,{id:i,checked:E.includes(i),onChange:w=>{w.currentTarget.checked?n({type:"ADD_EXPIRATION_TYPE",expirationType:i}):n({type:"REMOVE_EXPIRATION_TYPE",expirationType:i}),h("expirationTypes")},onBlur:()=>h("expirationTypes"),children:m})},i))})}),l==="products"&&e.jsxs(T,{labelFor:"products",label:"Products",error:a.products?u==null?void 0:u.products:null,children:[e.jsx(Oe,{id:"products",apiBaseUrl:t,selectedProducts:f,onSelect:(i,m)=>{n({type:"ADD_PRODUCT",product:m}),h("products")},onBlur:()=>h("products")}),e.jsx("div",{className:"mb-4"}),e.jsx("div",{children:f.map(i=>e.jsxs("div",{className:"mb-4",children:[e.jsx(P,{intent:"bad","aria-label":"Remove",onClick:()=>n({type:"REMOVE_PRODUCT",id:R(i)}),icon:e.jsx(de,{})})," ",e.jsx("span",{"data-testid":"product-name",children:i.productName})," — ",i.hubAlias," —"," ",i.pcc]},R(i)))}),!f.length&&e.jsx("i",{children:"No products selected"})]}),l==="exchanges"&&e.jsx(T,{label:"Exchanges",error:a.exchanges?u==null?void 0:u.exchanges:null,children:e.jsx(_,{minWidth:250,children:De.map(i=>e.jsx("div",{children:e.jsx(U,{id:i,checked:p.includes(i),onChange:m=>{m.currentTarget.checked?n({type:"ADD_EXCHANGE",exchange:i}):n({type:"REMOVE_EXCHANGE",exchange:i}),h("exchanges")},onBlur:()=>h("exchanges"),children:i})},i))})}),e.jsxs("div",{className:"flex justify-between !text-center",children:[e.jsx(P,{disabled:c,iconPosition:"right",onClick:()=>{S(),F&&r(o)},wide:!0,icon:c?e.jsx(q,{}):e.jsx(ce,{}),children:"Submit"}),e.jsx(ue,{intent:"black",label:"Download",children:e.jsxs("div",{className:"flex flex-col",children:[e.jsx(N,{download:async()=>{if(S(),!F)throw new Error("Invalid");await C(t,o,"pdf")},testid:"PDF (Table)",children:"PDF (Table)"}),o.strategy==="products"&&e.jsx(N,{download:async()=>{if(S(),!F)throw new Error("Invalid");await C(t,o,"pdf","calendar")},testid:"PDF (Calendar)",children:"PDF (Calendar)"}),e.jsx(N,{download:async()=>{if(S(),!F)throw new Error("Invalid");await C(t,o,"csv")},testid:"Download to Excel",children:"Excel"})]})})]})]})},ve=t=>{var c,a;const s={},r=ye([X(d=>d.expiryDate),(d,o)=>d.expirationType!==o.expirationType?d.expirationType==="LTD"?-1:1:0,X(d=>
1$(d.strip,"MMMyy",0).valueOf())],t);for(const d of r){const o=String(d.expiryDate.valueOf()),n=d.expirationType,l=(c=s[o])!=null?c:{date:d.expiryDate,types:{}},p=(a=l.types[n])!=null?a:{exchange:d.exchange,expirationType:d.expirationType,expiries:[]};p.expiries.push(d),l.types[n]=p,s[o]=l}return s},we=({expiries:t})=>{const s=x.useMemo(()=>ve(t),[t]);return e.jsxs(xe,{"data-testid":"expiries",children:[e.jsx("thead",{children:e.jsxs("tr",{children:[e.jsx("th",{children:"Date"}),e.jsx("th",{children:"Description"})]})}),e.jsxs("tbody",{children:[t.length===0&&e.jsx("tr",{children:e.jsx("td",{colSpan:2,children:"No results found. Please update your search filters and try again."})}),Object.values(s).flatMap(({date:r,types:c})=>Object.values(c).map(({exchange:a,expirationType:d,expiries:o},n)=>e.jsxs("tr",{children:[n===0&&e.jsx("td",{className:"whitespace-nowrap",rowSpan:Object.keys(c).length,children:v(r,Ee)}),e.jsxs("td",{children:[e.jsx("b",{children:L[d]})," for the following:",e.jsx("br",{}),o.map(l=>e.jsxs("div",{children:[e.jsxs("strong",{children:[l.strip,":"]})," ",l.contractName," [",l.commodityCode,"]"]},l.commodityCode))]})]},"".concat(r.valueOf(),"-").concat(a,"-").concat(d))))]})]})},Ie=async(t,s)=>(await(await z(t,s)).json()).map(a=>({...a,expiryDate:$(a.expiryDate,M,0)})),dt=({renderSlot:t})=>{const s=te("ice"),[r,c]=x.useState(null),[a,d]=x.useState(0),[o,n]=x.useState({status:"LOADING"});return x.useEffect(()=>{(async()=>{if(!r){n({status:"IDLE"});return}try{n({status:"LOADING"});const p=await Ie(s,r);n({status:"READY",data:p})}catch(p){n({status:"ERROR",error:p})}})()},[s,r,a]),e.jsxs(e.Fragment,{children:[e.jsx("style",{dangerouslySetInnerHTML:{__html:"\n            @media (min-width: 768px) {\n              #expiry-calendar {\n                display: grid;\n                grid-template-columns: 5fr minmax(200px, 4fr);\n                gap: 1em;\n              }\n            }\n          "}}),e.jsxs("div",{id:"expiry-calendar",className:"mb-6",children:[e.jsxs("div",{style:{order:2},children:[t("sidebar-top"),e.jsx(Se,{apiBaseUrl:s,save:l=>{c(l),d(p=>p+1)},isLoading:o.status==="LOADING"})]}),e.jsx("div",{children:r?o.status==="LOADING"||o.status==="IDLE"?e.jsx(Z,{}):o.status==="ERROR"?e.jsx(ee,{error:o.error}):e.jsx(we,{expiries:o.data}):e.jsx(Q,{intent:"info",children:'Please configure the search filters, and click "Submit".'})})," "]})]})};export{dt 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.