Skip to content

Commit

Permalink
resolve merge
Browse files Browse the repository at this point in the history
  • Loading branch information
ryansantosmz committed Mar 6, 2025
2 parents 7dd0455 + c5ed363 commit 9f8dbe0
Show file tree
Hide file tree
Showing 13 changed files with 32 additions and 25 deletions.
2 changes: 1 addition & 1 deletion deno.json
Original file line number Diff line number Diff line change
Expand Up @@ -62,5 +62,5 @@
"jsx": "react-jsx",
"jsxImportSource": "preact"
},
"version": "0.64.39"
"version": "0.64.43"
}
8 changes: 5 additions & 3 deletions htmx/sections/Deferred.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,9 @@ const Deferred = (props: Props) => {
if (loading === "eager") {
return (
<>
{sections.map((section) => <section.Component {...section.props} />)}
{sections.map((section, index) => (
<section.Component key={index} {...section.props} />
))}
</>
);
}
Expand All @@ -60,8 +62,8 @@ const Deferred = (props: Props) => {
hx-swap="outerHTML"
style={{ height: "100vh" }}
/>
{props.fallbacks?.map((section) =>
section ? <section.Component {...section.props} /> : null
{props.fallbacks?.map((section, index) =>
section ? <section.Component key={index} {...section.props} /> : null
)}
</>
);
Expand Down
1 change: 1 addition & 0 deletions utils/components/Slider.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ function Dot({ index, children }: {
data-dot={index}
aria-label={`go to slider item ${index}`}
class="focus:outline-none group"
type="button"
>
{children}
</button>
Expand Down
7 changes: 4 additions & 3 deletions vtex/loaders/intelligentSearch/productList.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ export interface FacetsProps extends CommonProps {
* @description query to use on search
* @examples "shoes"\n"blue shoes"
*/
query: string;
query?: string;
/**
* @title Facets string
* @description (e.g.: 'catergory-1/moda-feminina/category-2/calcados')
Expand Down Expand Up @@ -296,9 +296,10 @@ export const cacheKey = (
(expandedProps as unknown as Props["props"]);

const url = new URL(req.url);

if (
url.searchParams.has("q") ||
ctx.isInvoke && isProductIDList(props)
// Avoid cache on loader call over call and on search pages
(!isQueryList(props) && url.searchParams.has("q")) || ctx.isInvoke
) {
return null;
}
Expand Down
5 changes: 2 additions & 3 deletions vtex/loaders/legacy/productList.ts
Original file line number Diff line number Diff line change
Expand Up @@ -287,9 +287,8 @@ export const cacheKey = (
const url = new URL(req.url);

if (
url.searchParams.has("q") ||
// loader is invoked directly should not vary
ctx.isInvoke && (isSKUIDProps(props) || isProductIDProps(props))
// Avoid cache on loader call over call and on search pages
(!isTermProps(props) && url.searchParams.has("q")) || ctx.isInvoke
) {
return null;
}
Expand Down
5 changes: 4 additions & 1 deletion vtex/preview/Preview.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,10 @@ export function Indexing() {
name="props"
value="eyJrZXkiOiJ2dGV4L3dvcmtmbG93cy9wcm9kdWN0L2luZGV4LnRzIn0"
/>
<button style="color: white; background-color: #F71963; border-radius: 4px; padding: 4px 8px">
<button
type="submit"
style="color: white; background-color: #F71963; border-radius: 4px; padding: 4px 8px"
>
Start indexing workflow
</button>
</form>
Expand Down
2 changes: 1 addition & 1 deletion website/components/Image.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@ const Image = forwardRef<HTMLImageElement, Props>((props, ref) => {
)}
<img
{...props}
data-fresh-disable-lock={true}
data-fresh-disable-lock
preload={undefined}
src={props.src}
srcSet={srcSet}
Expand Down
11 changes: 4 additions & 7 deletions website/components/OneDollarStats.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,8 @@ declare global {
}
}

// we are forcing domain to be deco.cx
// because the domain is separated from the 'u' property
const trackerOriginal =
`"use strict";function g(t){let e={};return["utm_campaign","utm_source","utm_medium","utm_term","utm_content"].forEach(n=>{let o=t.get(n);o&&(e[n]=o)}),e}function u(t){if(!t)return;let e=t.split(";"),n={};for(let o of e){let r=o.split("=").map(s=>s.trim());r.length!==2||r[0]===""||r[1]===""||(n[r[0]]=r[1])}return Object.keys(n).length===0?void 0:n}window.stonks={event:w,view:S};var l=document.currentScript,h=l?.getAttribute("data-hash-routing")!==null,m={isLocalhost:/^localhost$|^127(\.[0-9]+){0,2}\.[0-9]+$|^\[::1?\]$/.test(location.hostname)||location.protocol==="file:",isHeadlessBrowser:!!(window._phantom||window.__nightmare||window.navigator.webdriver||window.Cypress)};async function y(t){let e=l?.getAttribute("data-url")||"https://collector.onedollarstats.com/events",n=new URL(location.href);n.search="","path"in t&&t.path&&(n.pathname=t.path);let o = n.href.endsWith("/") ? n.href.slice(0, -1) : n.href,r=t.referrer??void 0;if(!r){let i=new URL(location.href),c=document.referrer&&document.referrer!=="null"?document.referrer:void 0;if(c){let p=new URL(c);p.hostname!==i.hostname&&(r=p.href)}}let s={u:o,
d:'deco.cx',
e:[{t:t.type,h,r,p:t.props}]};t.utm&&Object.keys(t.utm).length>0&&(s.qs=t.utm),!(navigator.sendBeacon!==void 0&&navigator.sendBeacon(e,JSON.stringify(s)))&&fetch(e,{body:JSON.stringify(s),headers:{"Content-Type":"application/json"},keepalive:!0,method:"POST"}).catch(i=>console.error('fetch() failed'))}async function w(t,e,n){if(d())return;let o={};typeof e=="string"?(o.path=e,n&&(o.props=n)):typeof e=="object"&&(o.props=e);let r=o?.path||void 0;if(!r){let s=document.body?.getAttribute("data-s:path")||document.querySelector('meta[name="stonks-path"]')?.getAttribute("content");s&&(r=s)}y({type:t,props:o?.props,path:r})}function A(t){if(t.type==="auxclick"&&t.button!==1)return;let e=t.target,n=e.getAttribute("data-s:event");if(!n)return;let o=e.getAttribute("data-s:event-props"),r=o?u(o):void 0,s=e.getAttribute("data-s:event-path")||void 0;w(n,s,r)}async function S(t,e){let n={};typeof t=="string"?(n.path=t,e&&(n.props=e)):typeof t=="object"&&(n.props=t),b({path:n?.path,props:n?.props},!1)}async function b(t,e=!0){if(e&&d())return;let n=new URLSearchParams(location.search),o=g(n),r=t?.path||void 0;if(!r){let i=document.body?.getAttribute("data-s:path")||document.querySelector('meta[name="stonks-path"]')?.getAttribute("content");i&&(r=i)}let s=t.props||void 0;if(!s){let i=l?.getAttribute("data-props"),c=i?u(i)||{}:{},p=document.querySelectorAll("[data-s\\\\:view-props]");for(let v of Array.from(p)){let f=v.getAttribute("data-s:view-props");if(!f)continue;let P=u(f);Object.assign(c,P)}s=c}y({type:"PageView",props:Object.keys(s).length>0?s:void 0,path:r,utm:o})}async function a(){let t=document.querySelector('meta[name="stonks-collect"]')?.getAttribute("content"),e=document.body?.getAttribute("data-s:collect");if(t==="false"||e==="false"||!(l?.getAttribute("data-autocollect")!=="false")&&t!=="true"&&e!=="true")return;if(!h&&a.lastPage===location.pathname){console.warn("Ignoring event PageView - pathname has not changed");return}if(d())return;a.lastPage=location.pathname;let o=l?.getAttribute("data-props"),r=o?u(o)||{}:{},s=document.querySelectorAll("[data-s\\\\:view-props]");for(let i of Array.from(s)){let c=i.getAttribute("data-s:view-props");if(!c)continue;let p=u(c);Object.assign(r,p)}b({props:Object.keys(r).length>0?r:void 0},!1)}(e=>e.lastPage=null)(a||={});function d(){return!!(m.isLocalhost&&l?.getAttribute("data-allow-localhost")!=="true"||m.isHeadlessBrowser)}if(window.history.pushState){let t=window.history.pushState;window.history.pushState=function(e,n,o){t.apply(this,[e,n,o]),a()},window.addEventListener("popstate",a)}document.visibilityState!=="visible"?document.addEventListener("visibilitychange",()=>{!a.lastPage&&document.visibilityState==="visible"&&a()}):a();document.addEventListener("click",A);`;

`"use strict";function g(t){let e={};return["utm_campaign","utm_source","utm_medium","utm_term","utm_content"].forEach(n=>{let o=t.get(n);o&&(e[n]=o)}),e}function p(t){if(!t)return;let e=t.split(";"),n={};for(let o of e){let r=o.split("=").map(s=>s.trim());r.length!==2||r[0]===""||r[1]===""||(n[r[0]]=r[1])}return Object.keys(n).length===0?void 0:n}window.stonks={event:y,view:S};var l=document.currentScript,h=l?.getAttribute("data-hash-routing")!==null,m={isLocalhost:/^localhost$|^127(\.[0-9]+){0,2}\.[0-9]+$|^\[::1?\]$/.test(location.hostname)||location.protocol==="file:",isHeadlessBrowser:!!(window._phantom||window.__nightmare||window.navigator.webdriver||window.Cypress)};async function w(t){let e=l?.getAttribute("data-url")||"https://collector.onedollarstats.com/events",n=new URL(location.href);n.search="","path"in t&&t.path&&(n.pathname=t.path);let o=n.href.replace(/\\/$/,""),r=t.referrer??void 0;if(!r){let i=new URL(location.href),c=document.referrer&&document.referrer!=="null"?document.referrer:void 0;if(c){let u=new URL(c);u.hostname!==i.hostname&&(r=u.href)}}let s={u:o,e:[{t:t.type,h,r,p:t.props}]};t.utm&&Object.keys(t.utm).length>0&&(s.qs=t.utm),!(navigator.sendBeacon!==void 0&&navigator.sendBeacon(e,JSON.stringify(s)))&&fetch(e,{body:JSON.stringify(s),headers:{"Content-Type":"application/json"},keepalive:!0,method:"POST"}).catch(i=>console.error("fetch() failed:"))}async function y(t,e,n){if(d())return;let o={};typeof e=="string"?(o.path=e,n&&(o.props=n)):typeof e=="object"&&(o.props=e);let r=o?.path||void 0;if(!r){let s=document.body?.getAttribute("data-s:path")||document.querySelector('meta[name="stonks-path"]')?.getAttribute("content");s&&(r=s)}w({type:t,props:o?.props,path:r})}function A(t){if(t.type==="auxclick"&&t.button!==1)return;let e=t.target,n=e.getAttribute("data-s:event");if(!n)return;let o=e.getAttribute("data-s:event-props"),r=o?p(o):void 0,s=e.getAttribute("data-s:event-path")||void 0;y(n,s,r)}async function S(t,e){let n={};typeof t=="string"?(n.path=t,e&&(n.props=e)):typeof t=="object"&&(n.props=t),b({path:n?.path,props:n?.props},!1)}async function b(t,e=!0){if(e&&d())return;let n=new URLSearchParams(location.search),o=g(n),r=t?.path||void 0;if(!r){let i=document.body?.getAttribute("data-s:path")||document.querySelector('meta[name="stonks-path"]')?.getAttribute("content");i&&(r=i)}let s=t.props||void 0;if(!s){let i=l?.getAttribute("data-props"),c=i?p(i)||{}:{},u=document.querySelectorAll("[data-s\\:view-props]");for(let v of Array.from(u)){let f=v.getAttribute("data-s:view-props");if(!f)continue;let P=p(f);Object.assign(c,P)}s=c}w({type:"PageView",props:Object.keys(s).length>0?s:void 0,path:r,utm:o})}async function a(){let t=document.querySelector('meta[name="stonks-collect"]')?.getAttribute("content"),e=document.body?.getAttribute("data-s:collect");if(t==="false"||e==="false"){a.lastPage=null;return}if(!(l?.getAttribute("data-autocollect")!=="false")&&t!=="true"&&e!=="true"){a.lastPage=null;return}if(!h&&a.lastPage===location.pathname){console.warn("Ignoring event PageView - pathname has not changed");return}if(d())return;a.lastPage=location.pathname;let o=l?.getAttribute("data-props"),r=o?p(o)||{}:{},s=document.querySelectorAll("[data-s\\:view-props]");for(let i of Array.from(s)){let c=i.getAttribute("data-s:view-props");if(!c)continue;let u=p(c);Object.assign(r,u)}b({props:Object.keys(r).length>0?r:void 0},!1)}(e=>e.lastPage=null)(a||={});function d(){return!!(m.isLocalhost&&l?.getAttribute("data-allow-localhost")!=="true"||m.isHeadlessBrowser)}if(window.history.pushState){let t=window.history.pushState;window.history.pushState=function(e,n,o){t.apply(this,[e,n,o]),window.requestAnimationFrame(()=>{a()})},window.addEventListener("popstate",()=>{window.requestAnimationFrame(()=>{a()})})}document.visibilityState!=="visible"?document.addEventListener("visibilitychange",()=>{!a.lastPage&&document.visibilityState==="visible"&&a()}):a();document.addEventListener("click",A);`;
const snippet = () => {
// Flags and additional dimentions
const props: Record<string, string> = {};
Expand Down Expand Up @@ -85,7 +80,8 @@ const snippet = () => {
};

function Component({ collectorAddress }: Props) {
const collector = collectorAddress ?? "https://collector.deco.cx/events";
const collector = collectorAddress ??
"https://collector.deco.cx/events?tenant=decocx";
const tracker = trackerOriginal.replace("COLLECTOR_ADDRESS", collector);

return (
Expand All @@ -102,6 +98,7 @@ function Component({ collectorAddress }: Props) {
}}
id="tracker"
data-autocollect="false"
data-hash-routing="true"
data-url={collector}
/>
<script defer src={useScriptAsDataURI(snippet)} />
Expand Down
2 changes: 1 addition & 1 deletion website/components/Picture.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ export const Source = forwardRef<HTMLSourceElement, SourceProps>(
)}
<source
{...props}
data-fresh-disable-lock={true}
data-fresh-disable-lock
preload={undefined}
src={undefined} // Avoid deprecated api lighthouse warning
srcSet={srcSet}
Expand Down
2 changes: 1 addition & 1 deletion website/components/_seo/Google.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ function Google(
{url.hostname.replace(/^www./, "")}
</span>
<span class="text-xs font-normal leading-[18px]">
{url.protocol}//{url.hostname}{" "}
{`${url.protocol}//${url.hostname} `}
<span class="text-common ml-2 font-semibold">&#8942;</span>
</span>
</div>
Expand Down
6 changes: 4 additions & 2 deletions website/loaders/secret.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ export interface Props {
*/
name?: string;
}
const cache: Record<string, Promise<string | null>> = {};
const moduleCache: Record<string, Promise<string | null>> = {};
const showWarningOnce = once(() => {
console.warn(
colors.brightYellow(
Expand All @@ -47,7 +47,7 @@ const getSecret = async (props: Props): Promise<string | null> => {
await showWarningOnce();
return Promise.resolve(null);
}
return cache[encrypted] ??= decryptFromHex(encrypted).then((d) => d.decrypted)
return moduleCache[encrypted] ??= decryptFromHex(encrypted).then((d) => d.decrypted)
.catch((err) => {
const prettyName = name ? colors.brightRed(name) : "anonymous secret";
console.error(
Expand All @@ -67,3 +67,5 @@ export default async function Secret(props: Props): Promise<Secret> {
},
};
}

export const cache = "no-cache";
2 changes: 1 addition & 1 deletion website/pages/Page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ export interface Props {
}
export function renderSection(section: Props["sections"][number]) {
if (section === undefined || section === null) {
return <></>;
return <div></div>;
}
const { Component, props } = section;
return <Component {...props} />;
Expand Down
4 changes: 3 additions & 1 deletion website/sections/Rendering/Deferred.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,9 @@ const Deferred = (props: Props) => {
if (display) {
return (
<>
{sections.map(({ Component, props }) => <Component {...props} />)}
{sections.map(({ Component, props }, index) => (
<Component key={index} {...props} />
))}
</>
);
}
Expand Down

0 comments on commit 9f8dbe0

Please sign in to comment.