mydnic / laravel-feedback-component

Customizable Feedback Component for Laravel
MIT License
274 stars 24 forks source link

Feature request: support inclusion in 3rd party project #142

Closed pepijnolivier closed 1 year ago

pepijnolivier commented 1 year ago

Looks like a clean component, kudos! This is working as expected in a monolith Laravel project.

I wanted to integrate this in an existing project that has separate repositories and endpoints for frontend vs backend.

I would love to simply create a new React component which includes the script and styles from the API endpoint, but as of now, this does not work.

Simplified, I would love to be able to inject it through creating a simple react wrapper component such as:

import React from 'react';
import useScript from '~/hooks/useScript';

export default () => {
  const apiSrc = 'https://my-api.example.com';

  useScript(
    `${apiSrc}/vendor/kustomer/js/kustomer.js?src=${encodeURIComponent(apiSrc)}`,
  );

  return (
      <div id="kustomer" />
  );
};

Sadly, this does not work as of now, because


Cheers!

mydnic commented 1 year ago

@pepijnolivier yeah the front end component provided by this package is for classic Laravel install only. I didn't plan to do anything else

I have no idea if it's possible to make it work in a React app.

I'd be happy to review and merge any PR though :) Or feel free to fork and adapt to your needs

pepijnolivier commented 1 year ago

Alright thanks for your response!

We can close this issue for now, I was able to recreate the frontend components in the react app. Works smoothly! I might add a PR or more information when I find the time :)