This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//Previous | |
document.addEventListener("DOMContentLoaded", async function () => {}); | |
//Patched | |
/** | |
* | |
* First, pull your callback into an independent function | |
* Here we call it `boot` since that's what I wanna shove up | |
* "optimization" apps' butts. | |
* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import dynamic from "next/dynamic"; | |
const dynamicPolarisVizImport = (componentName) => { | |
return dynamic( | |
() => | |
import( | |
`@shopify/polaris-viz/build/esm/components/${componentName}/${componentName}.js` | |
).then((mod) => mod[componentName]), | |
{ | |
loading: () => <></>, | |
ssr: false, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html lang="en"> | |
<head> | |
<meta charset="UTF-8" /> | |
<title>Overwritten Fetch Example</title> | |
</head> | |
<body> | |
<script> | |
// Overwrite fetch to emulate a broken or hijacked fetch | |
function fetch() { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{% comment %} | |
Measurement translation based on locale | |
- US/UK/Myanmar: Imperial (inches, feet) | |
- Rest of world: Metric (cm, m) | |
{% endcomment %} | |
{% assign current_measurement = "25 inches" %} | |
{% assign measurement = current_measurement | downcase | strip %} | |
{% assign locale = request.locale.iso_code | downcase %} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { useEffect } from "react"; | |
const ShopifyRedirect = () => { | |
useEffect(() => { | |
const params = new URLSearchParams(window.location.search); | |
const store = params.get("store"); | |
const password = params.get("password"); | |
if (!store) { | |
alert("Store param is missing"); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
async function getHrefFromUrl(url) { | |
try { | |
const response = await fetch(url, { | |
headers: { | |
"User-Agent": | |
"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36", | |
Accept: | |
"text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8", | |
"Accept-Language": "en-US,en;q=0.5", | |
Connection: "keep-alive", |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
DATABASE_URL="mysql://root:@localhost:3306/shopify-app" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { useRouter } from "next/router"; | |
import { useEffect } from "react"; | |
/** | |
* Prefetch routes to make navigation between pages faster | |
* | |
* @param {Array<string>} paths An array of paths (URLs) to prefetch. | |
*/ | |
const usePrefetchRoutes = (paths) => { | |
const router = useRouter(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{% assign parsed_content = order.metafields.namespace.key | json_parse %} | |
{% for item in parsed_content.children %} | |
{% case item.type %} | |
{% when 'paragraph' %} | |
<p> | |
{% for child in item.children %} | |
{% if child.bold and child.italic %} | |
<strong><em>{{ child.value }}</em></strong> | |
{% elsif child.bold %} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { Box } from "@shopify/polaris"; | |
import { useEffect, useRef } from "react"; | |
/** | |
* @typedef {Object} Action | |
* @property {string} content | |
* @property {'critical'} [tone] | |
* @property {() => void} onAction | |
*/ |
NewerOlder