@medialane/ui 0.132.0 → 0.132.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.
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/utils/use-usd-prices.ts"],"sourcesContent":["\"use client\";\n\nimport useSWR from \"swr\";\n\nexport type UsdPrices = Partial<Record<\"STRK\" | \"ETH\" | \"USDC\" | \"USDT\" | \"WBTC\", number>>;\n\n/** Looks up a USD price by an arbitrary token symbol (not just the pinned\n * set UsdPrices is keyed on) — a coin/memecoin symbol simply has no entry. */\nexport function usdPriceFor(prices: UsdPrices | null, symbol: string): number | undefined {\n return (prices as Record<string, number | undefined> | null)?.[symbol];\n}\n\nconst REFRESH_MS = 60_000;\nconst PRICES_KEY = \"usd-prices\";\nconst PRICES_URL = \"/api/proxy/v1/prices\";\n\nasync function fetchUsdPrices(): Promise<UsdPrices | null> {\n const res = await fetch(PRICES_URL);\n const body = (await res.json()) as { data?: { usd?: UsdPrices } };\n return body.data?.usd ?? null;\n}\n\n/**\n * Shared across every component that calls it: SWR keys the request, so a page\n * mounting twenty price-aware components issues one request, not twenty.\n */\nexport function useUsdPrices(): UsdPrices | null {\n const { data } = useSWR(PRICES_KEY, fetchUsdPrices, {\n refreshInterval: REFRESH_MS,\n dedupingInterval: REFRESH_MS,\n revalidateOnFocus: false,\n revalidateOnReconnect: true,\n keepPreviousData: true,\n onError: () => {},\n });\n return data ?? null;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAEA,iBAAmB;AAMZ,SAAS,YAAY,QAA0B,QAAoC;AACxF,SAAQ,SAAuD,MAAM;AACvE;AAEA,MAAM,aAAa;AACnB,MAAM,aAAa;AACnB,MAAM,aAAa;AAEnB,eAAe,iBAA4C;AACzD,QAAM,MAAM,MAAM,MAAM,UAAU;AAClC,QAAM,OAAQ,MAAM,IAAI,KAAK;AAC7B,SAAO,KAAK,MAAM,OAAO;AAC3B;AAMO,SAAS,eAAiC;AAC/C,QAAM,EAAE,KAAK,QAAI,WAAAA,SAAO,YAAY,gBAAgB;AAAA,IAClD,iBAAiB;AAAA,IACjB,kBAAkB;AAAA,IAClB,mBAAmB;AAAA,IACnB,uBAAuB;AAAA,IACvB,kBAAkB;AAAA,IAClB,SAAS,MAAM;AAAA,IAAC;AAAA,EAClB,CAAC;AACD,SAAO,QAAQ;AACjB;","names":["useSWR"]}
1
+ {"version":3,"sources":["../../src/utils/use-usd-prices.ts"],"sourcesContent":["\"use client\";\n\nimport useSWR from \"swr\";\n\nexport type UsdPrices = Partial<Record<\"STRK\" | \"ETH\" | \"USDC\" | \"USDT\" | \"WBTC\", number>>;\n\n/** Looks up a USD price by an arbitrary token symbol (not just the pinned\n * set UsdPrices is keyed on) — a coin/memecoin symbol simply has no entry. */\nexport function usdPriceFor(prices: UsdPrices | null, symbol: string): number | undefined {\n return (prices as Record<string, number | undefined> | null)?.[symbol];\n}\n\nconst REFRESH_MS = 60_000;\nconst PRICES_KEY = \"usd-prices\";\nconst PRICES_URL = \"/api/proxy/v1/prices\";\n\nasync function fetchUsdPrices(): Promise<UsdPrices | null> {\n const res = await fetch(PRICES_URL);\n const body = (await res.json()) as { data?: { usd?: UsdPrices } };\n return body.data?.usd ?? null;\n}\n\nexport function useUsdPrices(): UsdPrices | null {\n const { data } = useSWR(PRICES_KEY, fetchUsdPrices, {\n refreshInterval: REFRESH_MS,\n dedupingInterval: REFRESH_MS,\n revalidateOnFocus: false,\n revalidateOnReconnect: true,\n keepPreviousData: true,\n onError: () => {},\n });\n return data ?? null;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAEA,iBAAmB;AAMZ,SAAS,YAAY,QAA0B,QAAoC;AACxF,SAAQ,SAAuD,MAAM;AACvE;AAEA,MAAM,aAAa;AACnB,MAAM,aAAa;AACnB,MAAM,aAAa;AAEnB,eAAe,iBAA4C;AACzD,QAAM,MAAM,MAAM,MAAM,UAAU;AAClC,QAAM,OAAQ,MAAM,IAAI,KAAK;AAC7B,SAAO,KAAK,MAAM,OAAO;AAC3B;AAEO,SAAS,eAAiC;AAC/C,QAAM,EAAE,KAAK,QAAI,WAAAA,SAAO,YAAY,gBAAgB;AAAA,IAClD,iBAAiB;AAAA,IACjB,kBAAkB;AAAA,IAClB,mBAAmB;AAAA,IACnB,uBAAuB;AAAA,IACvB,kBAAkB;AAAA,IAClB,SAAS,MAAM;AAAA,IAAC;AAAA,EAClB,CAAC;AACD,SAAO,QAAQ;AACjB;","names":["useSWR"]}
@@ -2,10 +2,6 @@ type UsdPrices = Partial<Record<"STRK" | "ETH" | "USDC" | "USDT" | "WBTC", numbe
2
2
  /** Looks up a USD price by an arbitrary token symbol (not just the pinned
3
3
  * set UsdPrices is keyed on) — a coin/memecoin symbol simply has no entry. */
4
4
  declare function usdPriceFor(prices: UsdPrices | null, symbol: string): number | undefined;
5
- /**
6
- * Shared across every component that calls it: SWR keys the request, so a page
7
- * mounting twenty price-aware components issues one request, not twenty.
8
- */
9
5
  declare function useUsdPrices(): UsdPrices | null;
10
6
 
11
7
  export { type UsdPrices, usdPriceFor, useUsdPrices };
@@ -2,10 +2,6 @@ type UsdPrices = Partial<Record<"STRK" | "ETH" | "USDC" | "USDT" | "WBTC", numbe
2
2
  /** Looks up a USD price by an arbitrary token symbol (not just the pinned
3
3
  * set UsdPrices is keyed on) — a coin/memecoin symbol simply has no entry. */
4
4
  declare function usdPriceFor(prices: UsdPrices | null, symbol: string): number | undefined;
5
- /**
6
- * Shared across every component that calls it: SWR keys the request, so a page
7
- * mounting twenty price-aware components issues one request, not twenty.
8
- */
9
5
  declare function useUsdPrices(): UsdPrices | null;
10
6
 
11
7
  export { type UsdPrices, usdPriceFor, useUsdPrices };
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/utils/use-usd-prices.ts"],"sourcesContent":["\"use client\";\n\nimport useSWR from \"swr\";\n\nexport type UsdPrices = Partial<Record<\"STRK\" | \"ETH\" | \"USDC\" | \"USDT\" | \"WBTC\", number>>;\n\n/** Looks up a USD price by an arbitrary token symbol (not just the pinned\n * set UsdPrices is keyed on) — a coin/memecoin symbol simply has no entry. */\nexport function usdPriceFor(prices: UsdPrices | null, symbol: string): number | undefined {\n return (prices as Record<string, number | undefined> | null)?.[symbol];\n}\n\nconst REFRESH_MS = 60_000;\nconst PRICES_KEY = \"usd-prices\";\nconst PRICES_URL = \"/api/proxy/v1/prices\";\n\nasync function fetchUsdPrices(): Promise<UsdPrices | null> {\n const res = await fetch(PRICES_URL);\n const body = (await res.json()) as { data?: { usd?: UsdPrices } };\n return body.data?.usd ?? null;\n}\n\n/**\n * Shared across every component that calls it: SWR keys the request, so a page\n * mounting twenty price-aware components issues one request, not twenty.\n */\nexport function useUsdPrices(): UsdPrices | null {\n const { data } = useSWR(PRICES_KEY, fetchUsdPrices, {\n refreshInterval: REFRESH_MS,\n dedupingInterval: REFRESH_MS,\n revalidateOnFocus: false,\n revalidateOnReconnect: true,\n keepPreviousData: true,\n onError: () => {},\n });\n return data ?? null;\n}\n"],"mappings":";AAEA,OAAO,YAAY;AAMZ,SAAS,YAAY,QAA0B,QAAoC;AACxF,SAAQ,SAAuD,MAAM;AACvE;AAEA,MAAM,aAAa;AACnB,MAAM,aAAa;AACnB,MAAM,aAAa;AAEnB,eAAe,iBAA4C;AACzD,QAAM,MAAM,MAAM,MAAM,UAAU;AAClC,QAAM,OAAQ,MAAM,IAAI,KAAK;AAC7B,SAAO,KAAK,MAAM,OAAO;AAC3B;AAMO,SAAS,eAAiC;AAC/C,QAAM,EAAE,KAAK,IAAI,OAAO,YAAY,gBAAgB;AAAA,IAClD,iBAAiB;AAAA,IACjB,kBAAkB;AAAA,IAClB,mBAAmB;AAAA,IACnB,uBAAuB;AAAA,IACvB,kBAAkB;AAAA,IAClB,SAAS,MAAM;AAAA,IAAC;AAAA,EAClB,CAAC;AACD,SAAO,QAAQ;AACjB;","names":[]}
1
+ {"version":3,"sources":["../../src/utils/use-usd-prices.ts"],"sourcesContent":["\"use client\";\n\nimport useSWR from \"swr\";\n\nexport type UsdPrices = Partial<Record<\"STRK\" | \"ETH\" | \"USDC\" | \"USDT\" | \"WBTC\", number>>;\n\n/** Looks up a USD price by an arbitrary token symbol (not just the pinned\n * set UsdPrices is keyed on) — a coin/memecoin symbol simply has no entry. */\nexport function usdPriceFor(prices: UsdPrices | null, symbol: string): number | undefined {\n return (prices as Record<string, number | undefined> | null)?.[symbol];\n}\n\nconst REFRESH_MS = 60_000;\nconst PRICES_KEY = \"usd-prices\";\nconst PRICES_URL = \"/api/proxy/v1/prices\";\n\nasync function fetchUsdPrices(): Promise<UsdPrices | null> {\n const res = await fetch(PRICES_URL);\n const body = (await res.json()) as { data?: { usd?: UsdPrices } };\n return body.data?.usd ?? null;\n}\n\nexport function useUsdPrices(): UsdPrices | null {\n const { data } = useSWR(PRICES_KEY, fetchUsdPrices, {\n refreshInterval: REFRESH_MS,\n dedupingInterval: REFRESH_MS,\n revalidateOnFocus: false,\n revalidateOnReconnect: true,\n keepPreviousData: true,\n onError: () => {},\n });\n return data ?? null;\n}\n"],"mappings":";AAEA,OAAO,YAAY;AAMZ,SAAS,YAAY,QAA0B,QAAoC;AACxF,SAAQ,SAAuD,MAAM;AACvE;AAEA,MAAM,aAAa;AACnB,MAAM,aAAa;AACnB,MAAM,aAAa;AAEnB,eAAe,iBAA4C;AACzD,QAAM,MAAM,MAAM,MAAM,UAAU;AAClC,QAAM,OAAQ,MAAM,IAAI,KAAK;AAC7B,SAAO,KAAK,MAAM,OAAO;AAC3B;AAEO,SAAS,eAAiC;AAC/C,QAAM,EAAE,KAAK,IAAI,OAAO,YAAY,gBAAgB;AAAA,IAClD,iBAAiB;AAAA,IACjB,kBAAkB;AAAA,IAClB,mBAAmB;AAAA,IACnB,uBAAuB;AAAA,IACvB,kBAAkB;AAAA,IAClB,SAAS,MAAM;AAAA,IAAC;AAAA,EAClB,CAAC;AACD,SAAO,QAAQ;AACjB;","names":[]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@medialane/ui",
3
- "version": "0.132.0",
3
+ "version": "0.132.1",
4
4
  "description": "Shared UI components for Medialane apps",
5
5
  "type": "module",
6
6
  "sideEffects": false,