Issue with cross-site tracking in safari (post-purchase)
We are having an issue with Shopify post-purchase where the extension isn't loading with shop-pay.
It works fine when disabling the "do not allow cross-site tracking" setting.
Does anyone know what this setting does, and how to get around it?
Thanks
do you know?
how many words do you know
See also questions close to this topic
-
how to change prettier format for react native
my code formatting prettier didn't works well for react native, i don't understand where to config it but it works well with flutter
from this code
import { View, Text } from 'react-native' import React from 'react' export default function App() { return ( <View> <Text>Apps</Text> </View> ) }
it's formatted to this
import { View, Text } from 'react-native' import React from 'react' export default function App() { return ( < View > < Text > Apps < /Text> < /View> ) }
-
react-router-dom v6 params only numbers
I want add number regex in may param in react-router-dom v6. it work fin in v5 like it:
<Route path="list/:id(\d+)" element={<MyComponent/>} />
but it not work in v6.
-
How can I fixed my problem"FirebaseError: Firebase: Error (auth/invalid-api-key)."
My environment variable is ok. No comas and name mistakes but they given me error like "FirebaseError: Firebase: Error (auth/invalid-api-key)". How can I fixed it. Please Help me...
This my .env file
REACT_APP_apiKey=AIzaSyBWobnhbdeMdNpXXXXXXXXXXXXXXXXXXXX REACT_APP_authDomain=XXXXX.firebaseapp.com REACT_APP_projectId=XXXX REACT_APP_storageBucket=XXXXX.appspot.com REACT_APP_messagingSenderId=4997390XXXXX REACT_APP_appId=1:4997390XXXXX:web:cc7bc80aa1bdb78fXXXXXX REACT_APP_measurementId=G-M1XDXXXXXX
This my firebase config file
const firebaseConfig = { apiKey: process.env.REACT_APP_apiKey, authDomain: process.env.REACT_APP_authDomain, projectId: process.env.REACT_APP_projectId, storageBucket: process.env.REACT_APP_storageBucket, messagingSenderId: process.env.REACT_APP_messagingSenderId, appId: process.env.REACT_APP_appId, measurementId: process.env.REACT_APP_measurementId, }; when I debugging firebaseConfig object console.log(firebaseConfig.apiKey); ==========> undefined console.log(firebaseConfig.authDomain); ==========> undefined console.log(firebaseConfig.projectId); ==========> undefined console.log(firebaseConfig.storageBucket); ==========> undefined console.log(firebaseConfig.measurementId); ==========> undefined console.log(firebaseConfig.appId); ==========> undefined console.log(firebaseConfig.measurementId); ==========> undefined
client side given error this "FirebaseError: Firebase: Error (auth/invalid-api-key)"
-
How to disable scroll on Safari? Nextjs
I am trying to disable scroll when the navbar menu is open on mobile, it works perfectly on chrome but not on safari.
I have seen that many people have similar problems on this browser, as it doesn´t all work the same way.
I am using this useEffect code to disable the scroll on chrome:
const Navbar = (props) => { const [isOpen, setOpen] = useState(false); const toggleMenu = () => setOpen(!isOpen); useEffect(() =>{ document.body.style.overflowY = isOpen ? 'hidden' : 'auto'; }, [isOpen]) return ( <header className="relative bg-black"> <div className=""></div> {isOpen && ( <div className=""></div>
What can I change this to, in order to keep it all working as intended on chrome but also work properly on safari? If anyone could help that would be great!
-
How to open a new window with hidden/uneditable address bar in Safari programatically?
There are questions like this one for opening a new safari window given a URL in macOS. But I'm looking for opening it with hidden / not editable address bar for security reasons. Preferably a separate window like a pop up. Is it possible?
Edit: WKWebView isn't a possible option because of Apple restrictions on getusermedia.
-
JavaScript - safari returns wrong width values
I have built a small gallery which automatically adjusts to the size of the window but the script obviously needs the correct window size to calculate the image sizes.
Theoretically it is easy to get the width with .offsetWidth, .scrollWidth , .clientWidth or window.innerWidth but for some reason Safari returns the wrong width every time. Under Firefox it runs without problems. According to W3Schools all these functions work in all browser types.
I know this question came up before: Safari is returning the wrong width value but there was no solution back then.
My Script: (maybe I have made a mistake)
const body = document.querySelector('body') const row = body.offsetWidth //one row is has the width of the parent elemenet (body) const item = document.getElementsByClassName('gallery-item') window.onload = function () { let columnAmount = 3 //amount of columns the gallery have let imgMargin = 1.5 //half the gap size between images let gaps = columnAmount + 1 //how many gaps are in a row let imgRowSpace = row - (imgMargin * 2 * gaps) //how many space is left for images let imgSize = imgRowSpace / columnAmount //how large is one image for(var i = 0; i < item.length; i++) { //change the properties item[i].style.height = imgSize + 'px' item[i].style.width = imgSize + 'px' item[i].style.margin = imgMargin + 'px' } body.setAttribute('style', 'padding: ' + imgMargin + 'px') }
I hope someone of you has more knowledge than me.
-
How does React hook handle dependency lists when passing objects to child components?
Parent component like this:
function ParentComponent(){ return ( <ChildComponent data={{ x: 1, y: 2 }} /> ) }
Child component like this:
function ChildComponent({ data }){ const [sum, set] = useState(0) useEffect(() => { set(data.x + data.y) }, [data]) return ( <div>{sum}</div> ) }
If it is like the above method, it will cause repeated rendering between subgroups, because the data is always changing. How should I deal with such a scenario?
Of course I know it's possible to cache data in the parent component by
const [data] = useState({ x: 1, y: 2 })
, but I want to know if there is a better solution, if any object parameter is required useState to cache, is this implementation too complicated?In addition, it can also be stored in the child component through
const dataRef = useRef(data)
, but if a value of data changes, it will not be recalculated.Other parameters such as functions and arrays are the same.
What's wrong with my thinking?
-
Angular <p> displayed by *ngFor won't float to the right
I have this chat in which I'm trying to apply styles to the "chat-container".
The messages are displayed with Angular's
*ngFor
as follows:<p *ngFor="let m of messageArray" [ngClass]="this.currentUser.user._id==m.src?'self pr-3':'otherUser pl-3'"> {{m.msg}} </p>
The classes applied only have
float:left
orfloat:right
depending on the user that sent each message. However, they're always being displayed in the left.Any suggestions on how to make the messages float to their corresponding side?
-
Flex direction column and fill screen width
I have a list of elements of varying height and want to lay them out such that the full screen width gets filled (but not overflown with a horizontal scrollbar):
How can I accomplish this via CSS? I cannot simply switch to
flex-direction: row
as there would be large gaps between rows due to the varying heights of the elements.Here is my hacky attempt via JS: https://codesandbox.io/s/dreamy-joliot-9n3woy?file=/src/App.js
import React, { useState, useEffect } from "react"; const BOX_WIDTH = 200; const boxHeights = [...Array(500)].map(() => Math.random() * 100); export default function App() { const ref = React.useRef(); const [originalHeight, setOriginalHeight] = useState(); useEffect(() => { if (!originalHeight && ref.current?.clientHeight) { setOriginalHeight(ref.current?.clientHeight); } }, [originalHeight, ref.current?.clientHeight]); const [height, setHeight] = useState(); useEffect(() => { if (originalHeight && ref.current?.clientWidth) { setHeight( originalHeight / Math.floor(ref.current?.clientWidth / BOX_WIDTH) / 0.9 ); } }, [ref.current?.clientWidth, originalHeight]); return ( <> <div ref={ref} style={{ display: "flex", flexDirection: "column", flexWrap: "wrap", ...(height && { height }) }} > {[...Array(500)].map((_, i) => ( <div style={{ border: "solid", width: BOX_WIDTH, height: boxHeights[i], margin: "10px" }} /> ))} </div> </> ); }
-
Save page of WebKitWebView into file
I have this almost solved. I've found this function:
void webkit_web_view_save_to_file (WebKitWebView *web_view, GFile *file, WebKitSaveMode save_mode, GCancellable *cancellable, GAsyncReadyCallback callback, gpointer user_data);
in the WebKitGTK official documentation
In my project I use it like this:
webkit_web_view_save_to_file( WEBKIT_WEB_VIEW(webview), g_file_new_for_path("/absolute/path/to/file"), WEBKIT_SAVE_MODE_MHTML, NULL, NULL, NULL);
However, it does absolutely nothing (There's no file where it should be - maybe I'm missing something?). I've even put it inside a
while(true)
loop (With asleep(10)
after thewebkit_web_view_save_to_file()
).How can I make it work?
-
How to recognize an audio, using webkitSpeechRecognition?
I need to recognize an audio, which picked there, but the lib uses only micro. How to avoid it and make it right? And if it's just impossible, the can you suggest me any other lib to do that?
So I have this
js
code:function runSpeechRecognition() { // get output div reference var output = document.getElementById("output"); // get action element reference var action = document.getElementById("action"); // new speech recognition object var SpeechRecognition = SpeechRecognition || webkitSpeechRecognition; var recognition = new SpeechRecognition(); // This runs when the speech recognition service starts recognition.onstart = function() { action.innerHTML = "<small>listening, please speak...</small>"; }; recognition.onspeechend = function() { action.innerHTML = "<small>stopped listening, hope you are done...</small>"; recognition.stop(); } // This runs when the speech recognition service returns result recognition.onresult = function(event) { var transcript = event.results[0][0].transcript; var confidence = event.results[0][0].confidence; output.innerHTML = "<b>Text:</b> " + transcript + "<br/> <b>Confidence:</b> " + confidence*100+"%"; output.classList.remove("hide"); }; // start recognition recognition.start(); }
and this html page:
<!DOCTYPE html> <html> <head> <style> --- </style> <title>JavaScript Speech to Text</title> </head> <body> <h2>JavaScript Speech to Text</h2> <p>Click on the below button and speak something...</p> <p><button type="button" onclick="runSpeechRecognition()">Speech to Text</button> <span id="action"></span></p> <div id="output" class="hide"></div> <script src='some.js'> </script> </body> </html> </html>
-
How to add app block to Shopify Customer Account page?
I am trying to add an app block to Shopify Customer Account page.
I am able to add an app block to Home page and Product detail page, but unable to add it to Customer account page.
In Schema settings I have added Customer account template option "templates": ["product", "index", "customers/account"]
-
Shopify - Resource Picker Not Appearing
I've followed a few tutorials however the ResourcePicker is failing to appear.
I have
"@shopify/app-bridge-react": "^2.0.26",
installed.My _app.js has the
Provider
wrapped like so:import { Provider } from '@shopify/app-bridge-react'; const config = { apiKey: API_KEY, shopOrigin, host: Buffer.from(HOST_URL).toString("base64"), forceRedirect: true }; return ( <React.Fragment> <Head> <title>StoreWatch</title> <meta charSet="utf-8" /> </Head> <Provider config={config}> <AppProvider i18n={translations}> <ApolloProvider client={client}> <Component {...pageProps} /> </ApolloProvider> </AppProvider> </Provider> </React.Fragment> );
In my UI just as a test I have the following line, expecting it to show the Products picker, but nothing appears. I see no errors in the console.
<ResourcePicker resourceType="Product" open={true} />
Any ideas? Any help would be appreciated.
Thanks.
-
@shopify/shopify-api jws dependence is not working
im new in shopify, im having a problem when i try to use the @shopify/shopify-api. Im importing this property from the API.
import Shopify from '@shopify/shopify-api'
When I do the import I get the next error.
Uncaught TypeError: util.inherits is not a function at node_modules/jsonwebtoken/node_modules/jws/lib/data-stream.js (data-stream.js:39:6) at __require (chunk-IGMYUX52.js?v=cd28f3b3:40:50) at node_modules/jsonwebtoken/node_modules/jws/lib/sign-stream.js (sign-stream.js:3:18) at __require (chunk-IGMYUX52.js?v=cd28f3b3:40:50) at node_modules/jsonwebtoken/node_modules/jws/index.js (index.js:2:18) at __require (chunk-IGMYUX52.js?v=cd28f3b3:40:50) at node_modules/jsonwebtoken/decode.js (decode.js:1:11) at __require (chunk-IGMYUX52.js?v=cd28f3b3:40:50) at node_modules/jsonwebtoken/index.js (index.js:2:11) at __require (chunk-IGMYUX52.js?v=cd28f3b3:40:50)
So I went to the line in the file where is happening the error:
node_modules/jsonwebtoken/node_modules/jws/lib/data-stream.js
And I discovered that error is a property in a node package
if you cant see the image here the code line.
util.inherits(DataStream, Stream);
So I went to the node documentation and i found that method is discouraged, but is not deprecated, therefore it should be working.
here is the description of the method if you cant see the image.
Usage of util.inherits() is discouraged. Please use the ES6 class and extends keywords to get language level inheritance support. Also note that the two styles are semantically incompatible. Inherit the prototype methods from one constructor into another. The prototype of constructor will be set to a new object created from superConstructor. This mainly adds some input validation on top of Object.setPrototypeOf(constructor.prototype, superConstructor.prototype). As an additional convenience, superConstructor will be accessible through the constructor.super_ property.
The package in question is named jws, im no so sure the porpouse of this package, I had the idea to modify the file and use prototypal inheritance replacing that code line but I don't know how good an idea it is do that. futhermore I would have to do that for each file that has that problem, i havent found any information about this on intenet.
THANKS FOR YOUR ANSWER!!!