Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix/salesforce middleware #3

Open
wants to merge 26 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
44 changes: 22 additions & 22 deletions admin/manifest.gen.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,34 +2,34 @@
// This file SHOULD be checked into source version control.
// This file is automatically updated during development when running `dev.ts`.

import * as $$$0 from "./loaders/blocks/revision.ts";
import * as $$$1 from "./loaders/blocks/published.ts";
import * as $$$2 from "./loaders/blocks/latest.ts";
import * as $$$3 from "./loaders/blocks/listRevisions.ts";
import * as $$$4 from "./loaders/state.ts";
import * as $$$5 from "./loaders/releases/blocks.ts";
import * as $$$$$$$$$0 from "./actions/blocks/publish.ts";
import * as $$$$$$$$$1 from "./actions/blocks/restore.ts";
import * as $$$$$$$$$2 from "./actions/blocks/safeDelete.ts";
import * as $$$$$$$$$3 from "./actions/blocks/newRevision.ts";
import * as $$$$$$$$$4 from "./actions/blocks/delete.ts";
import * as $$$0 from "./loaders/blocks/latest.ts";
import * as $$$1 from "./loaders/blocks/listRevisions.ts";
import * as $$$2 from "./loaders/blocks/published.ts";
import * as $$$3 from "./loaders/blocks/revision.ts";
import * as $$$4 from "./loaders/releases/blocks.ts";
import * as $$$5 from "./loaders/state.ts";
import * as $$$$$$$$$0 from "./actions/blocks/delete.ts";
import * as $$$$$$$$$1 from "./actions/blocks/newRevision.ts";
import * as $$$$$$$$$2 from "./actions/blocks/publish.ts";
import * as $$$$$$$$$3 from "./actions/blocks/restore.ts";
import * as $$$$$$$$$4 from "./actions/blocks/safeDelete.ts";
import * as $$$$$$$$$5 from "./actions/pages/publish.ts";

const manifest = {
"loaders": {
"deco-sites/admin/loaders/blocks/latest.ts": $$$2,
"deco-sites/admin/loaders/blocks/listRevisions.ts": $$$3,
"deco-sites/admin/loaders/blocks/published.ts": $$$1,
"deco-sites/admin/loaders/blocks/revision.ts": $$$0,
"deco-sites/admin/loaders/releases/blocks.ts": $$$5,
"deco-sites/admin/loaders/state.ts": $$$4,
"deco-sites/admin/loaders/blocks/latest.ts": $$$0,
"deco-sites/admin/loaders/blocks/listRevisions.ts": $$$1,
"deco-sites/admin/loaders/blocks/published.ts": $$$2,
"deco-sites/admin/loaders/blocks/revision.ts": $$$3,
"deco-sites/admin/loaders/releases/blocks.ts": $$$4,
"deco-sites/admin/loaders/state.ts": $$$5,
},
"actions": {
"deco-sites/admin/actions/blocks/delete.ts": $$$$$$$$$4,
"deco-sites/admin/actions/blocks/newRevision.ts": $$$$$$$$$3,
"deco-sites/admin/actions/blocks/publish.ts": $$$$$$$$$0,
"deco-sites/admin/actions/blocks/restore.ts": $$$$$$$$$1,
"deco-sites/admin/actions/blocks/safeDelete.ts": $$$$$$$$$2,
"deco-sites/admin/actions/blocks/delete.ts": $$$$$$$$$0,
"deco-sites/admin/actions/blocks/newRevision.ts": $$$$$$$$$1,
"deco-sites/admin/actions/blocks/publish.ts": $$$$$$$$$2,
"deco-sites/admin/actions/blocks/restore.ts": $$$$$$$$$3,
"deco-sites/admin/actions/blocks/safeDelete.ts": $$$$$$$$$4,
"deco-sites/admin/actions/pages/publish.ts": $$$$$$$$$5,
},
"name": "deco-sites/admin",
Expand Down
Binary file removed algolia/logo.png
Binary file not shown.
20 changes: 10 additions & 10 deletions algolia/manifest.gen.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,24 +2,24 @@
// This file SHOULD be checked into source version control.
// This file is automatically updated during development when running `dev.ts`.

import * as $$$0 from "./loaders/product/listingPage.ts";
import * as $$$1 from "./loaders/product/list.ts";
import * as $$$0 from "./loaders/product/list.ts";
import * as $$$1 from "./loaders/product/listingPage.ts";
import * as $$$2 from "./loaders/product/suggestions.ts";
import * as $$$$$$$$$0 from "./actions/setup.ts";
import * as $$$$$$$$$1 from "./actions/index/product.ts";
import * as $$$$$$$$$2 from "./actions/index/wait.ts";
import * as $$$$$$$$$0 from "./actions/index/product.ts";
import * as $$$$$$$$$1 from "./actions/index/wait.ts";
import * as $$$$$$$$$2 from "./actions/setup.ts";
import * as $$$$$$$$$$0 from "./workflows/index/product.ts";

const manifest = {
"loaders": {
"algolia/loaders/product/list.ts": $$$1,
"algolia/loaders/product/listingPage.ts": $$$0,
"algolia/loaders/product/list.ts": $$$0,
"algolia/loaders/product/listingPage.ts": $$$1,
"algolia/loaders/product/suggestions.ts": $$$2,
},
"actions": {
"algolia/actions/index/product.ts": $$$$$$$$$1,
"algolia/actions/index/wait.ts": $$$$$$$$$2,
"algolia/actions/setup.ts": $$$$$$$$$0,
"algolia/actions/index/product.ts": $$$$$$$$$0,
"algolia/actions/index/wait.ts": $$$$$$$$$1,
"algolia/actions/setup.ts": $$$$$$$$$2,
},
"workflows": {
"algolia/workflows/index/product.ts": $$$$$$$$$$0,
Expand Down
8 changes: 7 additions & 1 deletion analytics/components/Plausible.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import { Head } from "$fresh/runtime.ts";
import { useRouterContext } from "deco/routes/[...catchall].tsx";
import { exclusionScript } from "../../utils/plausible_scripts.ts";

const sanitizeTagAttribute = (inputString: string): string => {
const maxLength = 299; // plausible limit
Expand Down Expand Up @@ -29,6 +28,13 @@ declare global {
}
}

// For localhost debug only
const localAndExclusionScript =
'!function(){"use strict";var l=window.location,o=window.document,p=o.currentScript,s=p.getAttribute("data-api")||new URL(p.src).origin+"/api/event";function c(t,e){t&&console.warn("Ignoring Event: "+t),e&&e.callback&&e.callback()}function t(t,e){try{if("true"===window.localStorage.plausible_ignore)return c("localStorage flag",e)}catch(t){}var a=p&&p.getAttribute("data-include"),i=p&&p.getAttribute("data-exclude");if("pageview"===t){a=!a||a.split(",").some(n),i=i&&i.split(",").some(n);if(!a||i)return c("exclusion rule",e)}function n(t){return l.pathname.match(new RegExp("^"+t.trim().replace(/\\*\\*/g,".*").replace(/([^\\.])\\*/g,"$1[^\\\\s/]*")+"/?$"))}var a={},r=(a.n=t,a.u=l.href,a.d=((w,d)=>{const h=w.location.hostname;return h.replace(/^www\./,"")})(window,document),a.r=o.referrer||null,e&&e.meta&&(a.m=JSON.stringify(e.meta)),e&&e.props&&(a.p=e.props),new XMLHttpRequest);r.open("POST",s,!0),r.setRequestHeader("Content-Type","text/plain"),r.send(JSON.stringify(a)),r.onreadystatechange=function(){4===r.readyState&&e&&e.callback&&e.callback()}}var e=window.plausible&&window.plausible.q||[];window.plausible=t;for(var a,i=0;i<e.length;i++)t.apply(this,e[i]);function n(){a!==l.pathname&&(a=l.pathname,t("pageview"))}var r,u=window.history;u.pushState&&(r=u.pushState,u.pushState=function(){r.apply(this,arguments),n()},window.addEventListener("popstate",n)),"prerender"===o.visibilityState?o.addEventListener("visibilitychange",function(){a||"visible"!==o.visibilityState||n()}):n()}();';

const exclusionScript =
'!function(){"use strict";var l=window.location,s=window.document,u=s.currentScript,c=u.getAttribute("data-api")||new URL(u.src).origin+"/api/event";function p(t,e){t&&console.warn("Ignoring Event: "+t),e&&e.callback&&e.callback()}function t(t,e){if(/^localhost$|^127(\\.[0-9]+){0,2}\\.[0-9]+$|^\\[::1?\\]$/.test(l.hostname)||"file:"===l.protocol)return p("localhost",e);if(window._phantom||window.__nightmare||window.navigator.webdriver||window.Cypress)return p(null,e);try{if("true"===window.localStorage.plausible_ignore)return p("localStorage flag",e)}catch(t){}var i=u&&u.getAttribute("data-include"),n=u&&u.getAttribute("data-exclude");if("pageview"===t){i=!i||i.split(",").some(a),n=n&&n.split(",").some(a);if(!i||n)return p("exclusion rule",e)}function a(t){return l.pathname.match(new RegExp("^"+t.trim().replace(/\\*\\*/g,".*").replace(/([^\\.])\\*/g,"$1[^\\\\s/]*")+"/?$"))}var i={},n=(i.n=t,i.u=l.href,i.d=((w,d)=>{const h=w.location.hostname;return h.replace(/^www\./,"")})(window,document),i.r=s.referrer||null,e&&e.meta&&(i.m=JSON.stringify(e.meta)),e&&e.props&&(i.p=e.props),u.getAttributeNames().filter(function(t){return"event-"===t.substring(0,6)})),r=i.p||{},o=(n.forEach(function(t){var e=t.replace("event-",""),t=u.getAttribute(t);r[e]=r[e]||t}),i.p=r,new XMLHttpRequest);o.open("POST",c,!0),o.setRequestHeader("Content-Type","text/plain"),o.send(JSON.stringify(i)),o.onreadystatechange=function(){4===o.readyState&&e&&e.callback&&e.callback()}}var e=window.plausible&&window.plausible.q||[];window.plausible=t;for(var i,n=0;n<e.length;n++)t.apply(this,e[n]);function a(){i!==l.pathname&&(i=l.pathname,t("pageview"))}var r,o=window.history;o.pushState&&(r=o.pushState,o.pushState=function(){r.apply(this,arguments),a()},window.addEventListener("popstate",a)),"prerender"===s.visibilityState?s.addEventListener("visibilitychange",function(){i||"visible"!==s.visibilityState||a()}):a()}();';

const plausibleScript = exclusionScript;

// This function should be self contained, because it is stringified!
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import {
default as extend,
Props,
} from "../../../../website/loaders/extension.ts";
import { ProductDetailsPage } from "../../../types.ts";
} from "../../../website/loaders/extension.ts";
import { ProductDetailsPage } from "../../types.ts";

/**
* @title Extend your product
Expand Down
6 changes: 0 additions & 6 deletions commerce/loaders/extensions/productDetailsPage.ts

This file was deleted.

18 changes: 13 additions & 5 deletions commerce/loaders/extensions/productListingPage.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,14 @@
import loader from "../product/extensions/listingPage.ts";
import {
default as extend,
Props,
} from "../../../website/loaders/extension.ts";
import { ProductListingPage } from "../../types.ts";

/** @deprecated use product/listingPage instead */
const deprecated = (...args: Parameters<typeof loader>) => loader(...args);

export default deprecated;
/**
* @title Extend your product
*/
export default function ProductDetailsExt(
props: Props<ProductListingPage | null>,
): Promise<ProductListingPage | null> {
return extend(props);
}
18 changes: 13 additions & 5 deletions commerce/loaders/extensions/products.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,14 @@
import loader from "../product/extensions/list.ts";
import {
default as extend,
Props,
} from "../../../website/loaders/extension.ts";
import { Product } from "../../types.ts";

/** @deprecated use product/list instead */
const deprecated = (...args: Parameters<typeof loader>) => loader(...args);

export default deprecated;
/**
* @title Extend your products
*/
export default function ProductsExt(
props: Props<Product[] | null>,
): Promise<Product[] | null> {
return extend(props);
}
14 changes: 0 additions & 14 deletions commerce/loaders/product/extensions/list.ts

This file was deleted.

14 changes: 0 additions & 14 deletions commerce/loaders/product/extensions/listingPage.ts

This file was deleted.

14 changes: 0 additions & 14 deletions commerce/loaders/product/productListingPage.ts

This file was deleted.

14 changes: 0 additions & 14 deletions commerce/loaders/product/products.ts

This file was deleted.

34 changes: 12 additions & 22 deletions commerce/manifest.gen.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,33 +2,23 @@
// This file SHOULD be checked into source version control.
// This file is automatically updated during development when running `dev.ts`.

import * as $$$0 from "./loaders/product/extensions/listingPage.ts";
import * as $$$1 from "./loaders/product/extensions/detailsPage.ts";
import * as $$$2 from "./loaders/product/extensions/list.ts";
import * as $$$3 from "./loaders/product/productListingPage.ts";
import * as $$$4 from "./loaders/product/products.ts";
import * as $$$5 from "./loaders/extensions/productDetailsPage.ts";
import * as $$$6 from "./loaders/extensions/productListingPage.ts";
import * as $$$7 from "./loaders/extensions/products.ts";
import * as $$$8 from "./loaders/navbar.ts";
import * as $$$$$$0 from "./sections/Seo/SeoPLP.tsx";
import * as $$$$$$1 from "./sections/Seo/SeoPDP.tsx";
import * as $$$0 from "./loaders/extensions/productDetails.ts";
import * as $$$1 from "./loaders/extensions/productListingPage.ts";
import * as $$$2 from "./loaders/extensions/products.ts";
import * as $$$3 from "./loaders/navbar.ts";
import * as $$$$$$0 from "./sections/Seo/SeoPDP.tsx";
import * as $$$$$$1 from "./sections/Seo/SeoPLP.tsx";

const manifest = {
"loaders": {
"commerce/loaders/extensions/productDetailsPage.ts": $$$5,
"commerce/loaders/extensions/productListingPage.ts": $$$6,
"commerce/loaders/extensions/products.ts": $$$7,
"commerce/loaders/navbar.ts": $$$8,
"commerce/loaders/product/extensions/detailsPage.ts": $$$1,
"commerce/loaders/product/extensions/list.ts": $$$2,
"commerce/loaders/product/extensions/listingPage.ts": $$$0,
"commerce/loaders/product/productListingPage.ts": $$$3,
"commerce/loaders/product/products.ts": $$$4,
"commerce/loaders/extensions/productDetails.ts": $$$0,
"commerce/loaders/extensions/productListingPage.ts": $$$1,
"commerce/loaders/extensions/products.ts": $$$2,
"commerce/loaders/navbar.ts": $$$3,
},
"sections": {
"commerce/sections/Seo/SeoPDP.tsx": $$$$$$1,
"commerce/sections/Seo/SeoPLP.tsx": $$$$$$0,
"commerce/sections/Seo/SeoPDP.tsx": $$$$$$0,
"commerce/sections/Seo/SeoPLP.tsx": $$$$$$1,
},
"name": "commerce",
"baseUrl": import.meta.url,
Expand Down
2 changes: 1 addition & 1 deletion commerce/utils/productToAnalyticsItem.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ export const mapProductToAnalyticsItem = (
): AnalyticsItem => {
const { name, productID, isVariantOf } = product;
const index = Math.max(
product.isVariantOf?.hasVariant.findIndex((v) => v.url === product.url) ||
product.isVariantOf?.hasVariant?.findIndex((v) => v.url === product.url) ||
0,
0,
);
Expand Down
20 changes: 10 additions & 10 deletions compat/$live/manifest.gen.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,24 +3,24 @@
// This file is automatically updated during development when running `dev.ts`.

import * as $$$0 from "./loaders/state.ts";
import * as $$$$0 from "./handlers/router.ts";
import * as $$$$1 from "./handlers/devPage.ts";
import * as $$$$$$0 from "./sections/Slot.tsx";
import * as $$$$$$1 from "./sections/EmptySection.tsx";
import * as $$$$$$2 from "./sections/PageInclude.tsx";
import * as $$$$0 from "./handlers/devPage.ts";
import * as $$$$1 from "./handlers/router.ts";
import * as $$$$$$0 from "./sections/EmptySection.tsx";
import * as $$$$$$1 from "./sections/PageInclude.tsx";
import * as $$$$$$2 from "./sections/Slot.tsx";

const manifest = {
"loaders": {
"$live/loaders/state.ts": $$$0,
},
"handlers": {
"$live/handlers/devPage.ts": $$$$1,
"$live/handlers/router.ts": $$$$0,
"$live/handlers/devPage.ts": $$$$0,
"$live/handlers/router.ts": $$$$1,
},
"sections": {
"$live/sections/EmptySection.tsx": $$$$$$1,
"$live/sections/PageInclude.tsx": $$$$$$2,
"$live/sections/Slot.tsx": $$$$$$0,
"$live/sections/EmptySection.tsx": $$$$$$0,
"$live/sections/PageInclude.tsx": $$$$$$1,
"$live/sections/Slot.tsx": $$$$$$2,
},
"name": "$live",
"baseUrl": import.meta.url,
Expand Down
Loading