How Do I Test Cross (Sub)Domain postMessage?

I have a website, say example.com, with a subdomain mysub.example.com. I am saving it for local storage on the website www.example.com.

BUT, how do I test my code in my Google Chrome browser?

I can load the file in the subdomain mysub.example.com and look at all the breakpoints.

But how do I look at what is going on in the file I am posting the message to (on www.example.com)? Is it possible to put breakpoints in there using my Google Chrome browser?

If it’s important, these are my two files:

The ‘source’ file on mysub.example.com:

<!DOCTYPE html>

<html>
<head>
<title>Test Cross Domain Main - This is the html on the subdomain</title>
</head>
<body style="width:100%; height: 100%; padding: 0 0 0 0; margin: 0 0 0 0; overflow: hidden; background:#000000; font-family: 'Arial', sans-serif;">
    <iframe style="display: none;" src="http://www.example.com/myxdom/testxdommain.html" ></iframe>

    <button onclick="SaveNameToRoot()">Save Name To Local Storage Root</button>
    <button onclick="RemoveNameFromRoot()">Remove Name To Local Storage Root</button>
    <br />
    <label id="name"></label>
</body>
<script type="text/javascript">
function SaveNameToRoot(){
    const iframe = document.querySelector("iframe");
    const wind = iframe.contentWindow;

    const data = {
        isSet: true,
        slot: "name",
        data: "Wibble"
    }
    wind.postMessage(JSON.stringify(data, "*"));
}
function RemoveNameFromRoot(){
    
}

// This is stuff coming back from the other window on main
window.addEventListener("message", function(e){
    const data = e.data;
});
 </script>
 </html>

The ‘destination’ file on www.example.com. This is the file I do not know how to inspect with breakpoints:

<script type="text/javascript">
window.addEventListener("message", function(e){
    if(e.origin !== "example.com"){
        return;
    }

    const data = JSON.parse(e.data);
    if(typeof data.slot !== "undefined"){
        if(data.isSet){
            if(typeof data.data !== "undefined"){
                localStorage.setItem(data.slot, data.data);
            }
        }else{
            
        }
    }
});
</script>>

Is it possible to make a bindable snippet in Svelte 5?

I have two components, a parent and a child. I want to define some content in the child that isn’t rendered in its DOM hierarchy, but rather rendered by the parent in its own hierarchy.

My child component has a bindable prop that the snippet should get assigned to:

<script lang="ts">
    import { type Snippet } from "svelte";
    
    let {
        elementForParent = $bindable(),
    } : {
        elementForParent: () => Snippet;
    } = $props();
</script>

<p>Child content</p>

{#snippet elementForParent()}
    <button>Click me</button>
{/snippet}

Which is bound to and read in the parent:

<script lang="ts">
    import { type Snippet } from "svelte";
    import Child from "./Child.svelte";

    let elementFromChild: (() => Snippet) | null = $state(null);
</script>

<div>
    <p>Some parent content</p>
    <Child bind:elementForParent={elementFromChild}></Child>

    <div>
        <p>Somewhere else in the parent heirarchy, we want to put content defined by the child:</p>
        <div style="background-color: aqua;">
            {#if elementForParent !== null}
                {@render elementForParent()}
            {/if}
        </div>
    </div>
</div>

However, this doesn’t work (REPL link). Am I missing something in the implementation, or is there another way to achieve this?

Adding rating star in JavaScript e-commerce website

I’m having trouble fixing a JavaScript issue and I’d really appreciate your help.I’ll share my HTML and JavaScript code with you.Here’s what I’m trying to achieve:

Before clicking any star, star-value.textContent should be ‘-’.

When a star is clicked, it should change to that star’s value (e.g., poor,average,good…).

But if the same star is clicked again, it should reset star-value.textContent back to ‘-’.

The problem is: clicking the same star again doesn’t reset it to ‘-’. It just stays at the same value.

I hope someone here who’s good with JavaScript can help me out. Thanks in advance!

HTML:

                <div class="rating">
                    <div class="section-header">
                        <p>Rating</p> 
                    </div>
                    <div class="section-main">
                        <span class="stars" id="star-1">&#9734;</span>
                        <span class="stars" id="star-2">&#9734;</span>
                        <span class="stars" id="star-3">&#9734;</span>
                        <span class="stars" id="star-4">&#9734;</span>
                        <span class="stars" id="star-5">&#9734;</span>
                    </div>
                    <div class="star-value">-</div>
                </div>

JavaScript:

const stars = document.querySelectorAll(".stars");
let selectedStars = 0;

stars.forEach(star => {
  star.addEventListener("mouseover", () => {
      const nthStar = parseInt(star.id.split("-")[1]);

      stars.forEach((s, index) => {
          s.textContent = (index < nthStar) ? "★" : "☆";
      });
  });

  star.addEventListener("mouseleave", () => {
      stars.forEach((s, index) => {
          s.textContent = (index < selectedStars) ? "★" : "☆";
      });
  });

  star.addEventListener("click", () => {
      const nthStar = parseInt(star.id.split("-")[1]);
      if (nthStar === selectedStars) {
          selectedStars = 0;
          return;
      } else {
          selectedStars = nthStar;
      }

      stars.forEach((s, index) => {
          s.textContent = (index < selectedStars) ? "★" : "☆";
      });

      valueDetectOfReview(selectedStars);
  });
});


const review = document.querySelector('.star-value');


function valueDetectOfReview(starNumber) {
  switch (starNumber) {
      case 0:
          review.textContent = '-';
          break;
      case 1:
          review.textContent = 'Very Poor';
          break;
      case 2:
          review.textContent = 'Poor';
          break;
      case 3:
          review.textContent = 'Average';
          break;
      case 4:
          review.textContent = 'Good';
          break;
      case 5:
          review.textContent = 'Excellent';
          break;
      default:
          break;
  }
}

how to read static files from a json fille with node and pug?

I run 3 containers with docker

front < bundle assets
back < raw nodejs server
nginx < serve static files and proxy it to my server

and i will have acess to this static folder http://localhost:3000/static

inside this folder i have manifest.json file with the following content

{
  "js": {
    "main": "/static/scripts/index.js",
    "vendors": {
      "gsap": "/static/scripts/vendors/gsap.js"
    }
  },
  "css": {
    "main": "/static/styles/bundle.css",
    "critical": "/static/styles/critical.css"
  },
  "svg": "/static/icons/sprite.svg"
}

now what would be the most efficent way to read this so in my pug templates i can do something like

script(src=manifest.js.maiin defer)

Do i have to make a new http request to parse this file ?

Notifications on Samsung TV screen in WebApp

I’m developing a web app. The idea is a simple form with a title, description, time and date, and a button to submit the data. It should be an app that schedules notifications on a Samsung TV screen.

The problem is that I haven’t been able to get it to work. I’ve already added the permissions in the config.xml. According to my research, the Tizen web simulator application (Samsung TV) doesn’t allow these notifications to be displayed, but I’m not sure (for now, they only appear within the app, similar to an alert).

I’m using tizen.StatusNotification and tizen.Notification.

If anyone knows about this and can clear up my doubts, I’d be very grateful (I don’t have experience with TV developmet).

How can I animate an element that shows up after a function is called?

I’ve been trying to make my navbar responsive for mobile and decided it’d be good to make it a lateral bar when the width gets smaller. Also, in order to not having to change the code in every single page when changing something in the navbar I made it a reusable element with a function inserting it in a placeholder div when the website loads. Thing is, I cannot figure out how to make is slide instead of just showing up on the page. The side bar changes classes whenever you press the hamburger menu button, I’m not able to use transition or translate on it. I’ll leave the css and js here so you can understand better.

Here is the JS calling the navbar whenever the page loads

function injectNavbar() {
  const navbarHTML = `
    <nav class="navigationbar">
      <div class="navbarcontainer">
        <div class="navbaritens navbaritens1">
          <a href="/" class="navbarlogo"><img src="images/RMLevel.png" alt="Navigation Bar Logo"></a>
        </div>
        <button class="navbaritens navbaritens2 navbarmenuhamburger" onclick="toggleMobileMenu()">
          <span class="lines line1"></span>
          <span class="lines line2"></span>
          <span class="lines line3"></span>
        </button>
        <div class="navbaritens navbaritens3">
          <a href="/" class="navbaritem">Início</a>
          <a href="/comprar.html" class="navbaritem">Comprar</a>
          <a href="/empresas.html" class="navbaritem">Empresas</a>
          <a href="/eventos.html" class="navbaritem">Eventos</a>
          <a href="/manutencao.html" class="navbaritem">Manutenção</a>
          <a href="/contato.html" class="navbaritem">Contato</a>
        </div>
      </div>
    </nav>

    <div class="navbaritensmobile closed">
      <a href="/" class="navbaritem mobile-item">Início</a>
      <a href="/comprar.html" class="navbaritem mobile-item">Comprar</a>
      <a href="/empresas.html" class="navbaritem mobile-item">Empresas</a>
      <a href="/eventos.html" class="navbaritem mobile-item">Eventos</a>
      <a href="/manutencao.html" class="navbaritem mobile-item">Manutenção</a>
      <a href="/contato.html" class="navbaritem mobile-item">Contato</a>
    </div>
  `;

  document.querySelectorAll('.navbarplaceholder').forEach(placeholder => {
    placeholder.insertAdjacentHTML('beforeend', navbarHTML);
  });
}

document.addEventListener('DOMContentLoaded', injectNavbar());

And here’s the way I’ve been changing it from hidden and shown, toggleMobileMenu() is called by the hamburger menu button

function toggleMobileMenu() {
  const navbarItensMobile = document.querySelector(".navbaritensmobile");
  const hamburgerButton = document.querySelector(".navbarmenuhamburger");
  if (navbarItensMobile.classList.contains("closed")) { //Abre o menu
    navbarItensMobile.classList.add('open');
    navbarItensMobile.classList.remove('closed');
    hamburgerButton.classList.add('xshape'); // Add 'open' to the button
    hamburgerButton.classList.remove('regularshape'); // Ensure 'closed' is removed from button
  } else if (navbarItensMobile.classList.contains("open")) {  //Fecha o menu
    navbarItensMobile.classList.add('closed');
    navbarItensMobile.classList.remove('open');
    hamburgerButton.classList.add('normalshape'); // Add 'open' to the button
    hamburgerButton.classList.remove('xshape'); // Ensure 'closed' is removed from button
  } else { //Caso o menu não tenha sido aberto ou fechado, adiciona a classe closed
    navbarItensMobile.classList.add('closed');
    navbarItensMobile.classList.remove('open');
    console.error("Elemento '.navbaritensmobile' não encontrado!");
  }
}

And that’s how the css is,

@media (max-width: 960px) {
    .navbarmenuhamburger {
        display: block;
        /* Show on smaller screens */
    }

    .closed {
        display: none;
        /* Hide the menu items on smaller screens */
    }

    .open {
        display: grid;
        /* Show the menu items on smaller screens */
    }

    .navbaritens2.open {
        display: flex;
        /* Show the menu when the 'open' class is applied */
    }

    .navbaritens3 {
        display: none;
        /* Hide the original menu items on smaller screens */
    }
}

I’ve tried to use the following to animate the side bar


.navbaritensmobile {
    position: fixed;
    top: 64px;
    height: calc(100% - 64px);
    border-radius: 5% 0 0 5%;
    width: 200px;
    right: -200;
    display: grid;
    grid-template-rows: auto;
    background-color: #242738;
    padding: 20px 0;
    padding-top: 64px;
    box-shadow: -5px 0px 5px rgba(0, 0, 0, 0.2);
    z-index: 8888;
    transform: translate(-150%);
    transition: transform 0.5s ease-in-out;
}
.navbaritensmobile.open .navbaritem.mobile-item {
    opacity: 1;
    transform: translateY(0);
}

So it would transition from -200 to 0 but it doesn’t work

Why response undefined?

My moto is to write a condition in catch for my login page, Where if the user entered wrong password I will get a response as “Invalid credentials” from backend in response,
I want to add that value in my toast and display. But the value is undefined

I used <response.data.message> or in catch: <error.response.message> to get that value still undefined

While inspecting I can find the message in my response -> data -> message.
But unable to use them

Backend:

  const loginUser = async(req,res) => {
  const { email, password} = req.body;
  if(!email || !password){
   return res.status(400).json({message : "Field cannot be empty"});
 }
try{
const userEmail = await userModel.emailExist(email);
 if(userEmail.length === 0){
  return res.status(404).json({message : "User not registered"})
 } 
const user = userEmail[0];
const isMatch = await bcrypt.compare(password, user.password);
if(!isMatch){
  return res.status(400).json({message : "Invalid credentials"});
}

Frontend:

     try{
  const response = await apiRequest('/login', 'post', loginData);
  const data = response?.data;
  dispatch(userName(data.username));
  const token = response?.headers['authorization'];
  localStorage.setItem('token',token);
  toast.success('Login Successfull');
  navigate('/home'); 
  }
  catch (error: any) {
    const message =
    error?.response?.data?.message || error.message || "Unknown error"
   toast.error(message);
}

}

//I can able to see the response message but it represent as undefined !!??

Response message in my Devpage

Cannot get any response from langchain ChatOpenAI no matter how long i wait

my code is as follows:

import { config } from "dotenv";
import { ChatOpenAI } from "@langchain/openai";

config({ override: true })

const openai = new ChatOpenAI({ model: "gpt-4o-mini" })

openai.invoke("Hello").then(data=>{
  console.log(data.content)
})

And then i use tsx to execute this file, but no matter how long i wait, i cannot get any response from the console and the throw Timneout error, how can i handle with this problem?

Timeout Error Pictur

How to remove this icon in javascript? [closed]

I want to edit https://github.com/nitelin/solana-token-creator-website and remove an icon but cant find the icon anywhere in media or html. Does somebody know which piece of code is should remove. Please help, i have been trying top remove it for two days but i can’t get it to work. The icon is with the red circle.

enter image description here

i tried to edit the javascript file but keep getting “Tokenization is skipped for long lines for performance reasons. This can be configured via editor.maxTokenizationLineLength.” even when i increased maxtokenization length

Hiding Firefox’s autoscroll indicator

I’m implementing a classic “pan & zoom” UI using CSS transforms and mouse events.

I want to implement panning by holding down the mouse wheel button and moving around.

Unfortunately, on Firefox, holding down the mouse wheel button shows this “autoscroll” indicator:

Firefox's autoscroll indicator

Here’s a short GIF to demonstrate the behavior:

a GIF showing a pan-and-zoom interaction, with the Firefox autoscroll indicator showing up on every mouse down event, and remaining at the same position until a mouse up event occurs

I tried using preventDefault, but calling it prevents any mouse movement. calling it on the mousedown event alone does not prevent it from showing up.

I also tried the

window.scrollTo(window.scrollX, window.scrollY)

trick from this answer to the seemingly only related SO question

Web apps like Figma are able to do it, is it that they somehow re-implement a complete “mouse engine” and thus preventDefault everything?

Obviously, any about:config-based solution, like you can find on the Internet, is not relevant here…

Bootstrap Button Collapse

I’m having a problem getting the Bootstrap Buttons to properly expand/collapse. I have two Forms on the page but when I click “Show All” the comments within both Forms are shown.

Can anyone tell me what I’m doing wrong or show me what I need to change?

Solution:
Clicking on “Show All” within one Form only shows all the comments for that Form.

<html>
<header>
</header>
<body>



<link href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-QWTKZyjpPEjISv5WaRU9OFeRpok6YctnYmDr5pNlyT2bRjXh0JMhjY6hW+ALEwIH" crossorigin="anonymous">

<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/jqueryui/1.13.2/themes/cupertino/jquery-ui.min.css" integrity="sha512-9SEz2+WNpf9iyTy855xgweUvhu8Rz9BnU4d/MBFSFSh4kaAFeCA+/Otj5/NaB9PiMpjO1ajRNbplQTXa182X9A==" crossorigin="anonymous" referrerpolicy="no-referrer" />


<script src="https://code.jquery.com/jquery-3.7.1.min.js"></script>

<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/js/bootstrap.bundle.min.js" integrity="sha384-YvpcrYf0tY3lHB60NNkmXc5s9fDVZLESaAA55NDzOxhy9GkcIdslK1eN7N6jIeHz" crossorigin="anonymous"></script>

<p>&nbsp;</p>
                            <form id="messageCodeForm-1" class="row g-3 needs-validation was-validated" novalidate>
                              <div class="row">
                                <div class="col-6">
                                  <fieldset class="border p-2">
                                    <legend  class="float-none w-auto">Form 1 Comments</legend>
                                    <div class="row" style="margin-bottom: 10px;">
                                      <div class="col">
                                        <p class="d-inline-flex gap-1">
                                          <button type="button" class="btn btn-outline-info btn-sm" data-bs-toggle="collapse" data-bs-target="#comment-01-1" aria-expanded="false" aria-controls="collapseExample">
                                            Comment 1
                                          </button>
                                          <button type="button" class="btn btn-outline-info btn-sm" data-bs-toggle="collapse" data-bs-target=".multi-collapse" aria-expanded="false" aria-controls="comment-01-1 comment-02-1">Show All</button>
                                        </p>
                                        <div id="comment-01-1" class="collapse multi-collapse">
                                          <div class="card card-body">
                                            Comment 1
                                          </div>
                                        </div>
                                      </div>
                                    </div>
                                    <div class="row" style="margin-bottom: 10px;">
                                      <div class="col">
                                        <p class="d-inline-flex gap-1">
                                          <button type="button" class="btn btn-outline-info btn-sm" data-bs-toggle="collapse" data-bs-target="#comment-02-1" aria-expanded="false" aria-controls="comment-02-1">
                                            Comment 2
                                          </button>
                                        </p>
                                        <div id="comment-02-1" class="collapse multi-collapse">
                                          <div class="card card-body">
                                            Comment 2
                                          </div>
                                        </div>
                                      </div>
                                    </div>
                                  </fieldset>
                                </div>
                              </div>
                            </form>
<p>&nbsp;</p>
<p>&nbsp;</p>
                            <form id="messageCodeForm-2" class="row g-3 needs-validation was-validated" novalidate>
                              <div class="row">
                                <div class="col-6">
                                  <fieldset class="border p-2">
                                    <legend  class="float-none w-auto">Form 2 Comments</legend>
                                    <div class="row" style="margin-bottom: 10px;">
                                      <div class="col">
                                        <p class="d-inline-flex gap-1">
                                          <button type="button" class="btn btn-outline-info btn-sm" data-bs-toggle="collapse" data-bs-target="#comment-01-2" aria-expanded="false" aria-controls="collapseExample">
                                            Comment 1
                                          </button>
                                          <button type="button" class="btn btn-outline-info btn-sm" data-bs-toggle="collapse" data-bs-target=".multi-collapse" aria-expanded="false" aria-controls="comment-01-2 comment-02-2">Show All</button>
                                        </p>
                                        <div id="comment-01-2" class="collapse multi-collapse">
                                          <div class="card card-body">
                                            Comment 1
                                          </div>
                                        </div>
                                      </div>
                                    </div>
                                    <div class="row" style="margin-bottom: 10px;">
                                      <div class="col">
                                        <p class="d-inline-flex gap-1">
                                          <button type="button" class="btn btn-outline-info btn-sm" data-bs-toggle="collapse" data-bs-target="#comment-02-2" aria-expanded="false" aria-controls="comment-02-2">
                                            Comment 2
                                          </button>
                                        </p>
                                        <div id="comment-02-2" class="collapse multi-collapse">
                                          <div class="card card-body">
                                            Comment 2
                                          </div>
                                        </div>
                                      </div>
                                    </div>
                                  </fieldset>
                                </div>
                              </div>
                            </form>
<body>
</html>

File field keeps deleting the photo after another is taken

Recently I have been having an issue with a PWA where the file inputs keep clearing after new photos are taken. This has happened with multiple users but I am unable to replicate it on my own devices and therefore unable to problem solve it as much as I can, as I cannot get console errors. As they are filling out the form, it seems to have a minor crash that causes it to not only to not upload the photo but not save the others. I have looked around and never saw anything like this.

For reference the website we are using is laravel with query and javascript being used in the front end.

Below is a few snippets of the page that are relevant as well as a video of the issue.

Video of problem in action:
Problem in action (https://storage.googleapis.com/dev_customer_images//stackoverflow/photoVanishing.mp4)

The input field, note this is a dynamic form hence the field id being used in it’s name:

<input name="field_{{$unitField->id}}_photo" id="field_{{$unitField->id}}_photo" class="form-control visitFields fullPhotos" type="file" accept="image/*" capture="camera" @if($unitField->required && empty($unitVisitFields->where('field_id', $unitField->id)->first()->value)) required @endif  />
<br>
                                                    <img src="{{$unitVisitFields->where('field_id', $unitField->id)->first()->value ?? ''}}@if(!empty($unitVisitFields->where('field_id', $unitField->id)->first()->value))?{{rand()}}@endif" id="field_{{$unitField->id}}_photo_display" class="img-thumbnail">

From there it is run through an AJAX call to try and save it to the backend of the website and to one of the tables and automatically downloaded to the users phone.

The download function

function downloadImage(input_value, file_name = "Download", file_type = "jpg"){
    filrURL = URL.createObjectURL(input_value)
    var link = document.createElement('a');
    link.href = filrURL;
    rand = Math.floor(Math.random() * 999)
    link.download = file_name+'_'+rand+'.'+file_type;
    document.body.appendChild(link);
    link.click();
    document.body.removeChild(link);
}

ajax call:

$.ajax({
   type: 'POST',
   url: link,
   contentType: false,
   processData: false,
   data: form_data,
   success:function(response) {

    //tries to parse the response. If nothing is there to parse, ends it.
    try{
       response = JSON.parse(response);
    }
    catch{
       console.log('non json object');
       return;
    }

    //double checks that the response was successful
    if(response[0] != 'success')
       return;

    if(input_type == 'file'){
       if(response[1]){
          document.getElementById(input_name+"_display").src = response[1];
          if($('#'+input_name+"_link").length)
                 document.getElementById(input_name+"_link").value = response[1];
                 $("#"+input_name+"_div").show();
                 $("#"+input_name+"_new").val('false');
                 $("#"+input_name).removeAttr('required');
          }
       }
                        
    },
    error: function(xhr, status, error) {
        console.log(xhr.responseText);
    }
});

I should note: that if the photo does finish the AJAX call, it will be saved and show up on the reload of the page. Sorry if this is not perfect, first time posting to stack overflow.

send data from button to modal form

This script has been running normally so far, as time goes by I want to add more needs.
With the existing script, what other code needs to be added to display the data sent from the button.
data sent from button, how modal receives value sent from button ?

var modal = document.getElementById("myModal");
var btn = document.getElementById("myBtn");
var span = document.getElementsByClassName("close")[0];

btn.onclick = function() {
  modal.style.display = "block";
}

span.onclick = function() {
  modal.style.display = "none";
}

window.onclick = function(event) {
  if (event.target == modal) {
    modal.style.display = "none";
  }
}
/* The Modal (background) */
.modal {
  display: none;
  /* Hidden by default */
  position: fixed;
  /* Stay in place */
  z-index: 1;
  /* Sit on top */
  padding-top: 100px;
  /* Location of the box */
  left: 0;
  top: 0;
  width: 100%;
  /* Full width */
  height: 100%;
  /* Full height */
  overflow: auto;
  /* Enable scroll if needed */
  background-color: rgb(0, 0, 0);
  /* Fallback color */
  background-color: rgba(0, 0, 0, 0.4);
  /* Black w/ opacity */
}

/* Modal Content */
.modal-content {
  position: relative;
  background-color: #fefefe;
  margin: auto;
  padding: 0;
  border: 1px solid #888;
  width: 50%;
  box-shadow: 0 4px 8px 0 rgba(0, 0, 0, 0.2), 0 6px 20px 0 rgba(0, 0, 0, 0.19);
  -webkit-animation-name: animatetop;
  -webkit-animation-duration: 0.4s;
  animation-name: animatetop;
  animation-duration: 0.4s
}

/* Add Animation */
@-webkit-keyframes animatetop {
  from {
    top: -300px;
    opacity: 0
  }

  to {
    top: 0;
    opacity: 1
  }
}

@keyframes animatetop {
  from {
    top: -300px;
    opacity: 0
  }

  to {
    top: 0;
    opacity: 1
  }
}

/* The Close Button */
.close {
  color: white;
  float: right;
  font-size: 28px;
  font-weight: bold;
}

.close:hover,
.close:focus {
  color: #000;
  text-decoration: none;
  cursor: pointer;
}

.modal-body {
  padding: 2px 16px;
}
<div id="myModal" class="modal">
  <div class="modal-content">
    <span class="close">&times;</span>
    <div class="card-body">
      <h4 class="card-title">**data from button**</h4>
    </div>
  </div>
</div>

<button id="myBtn" data-id="<?php echo $row['nomesin']; ?>" type="button" class="btn btn-primary" style="text-align: center;vertical-align:top;padding-top:4px;padding-bottom:4px;" >add product</button>

Storing Files in Strapi Backend and dynamically compiling the files in the frontend

I am creating an application that has some quick actions in the landing page. The quick actions are different for different types of users and also the application is available as a mobile and web application.

Since I had to launch a build, whenever I create a new quick action and it also made the code redundant so I thought of moving it to a CMS system (Strapi) I could store the icon, label and all other constraints in Strapi. However I also want to have the actions in Strapi too which would be a JS and Dart file which I want to map to each quick action. Is there a way to do it? Can you suggest me what are all the other ways through which I can make it possible.

I thought of storing the files in Strapi and somehow load it dynamically in the application but its not possible at least not on both platforms.