0.0.14 • Published 3 months ago

sg-chatbot-ui v0.0.14

Weekly downloads
-
License
MIT
Repository
github
Last release
3 months ago

Here's the revised README format with your requested changes:


SG Chatbot UI Integration

Follow these steps to set up the SG Chatbot UI in a React.js or Next.js project.


Step 1: Install the Package

npm install sg-chatbot-ui

React.js Setup

  1. Import and Define Custom Elements
    Add the following lines in your App.js file:

    import { defineCustomElements } from 'sg-chatbot-ui/loader';
    defineCustomElements(window);
  2. Use the Custom Element
    Add the <chatbot-ui> component at the bottom of App.js:

    <chatbot-ui></chatbot-ui>
  3. Set Server URL
    In your .env file, add the server URL and update it with your current base URL:

    REACT_APP_SERVER_URL=https://sentientgeeks.com

Next.js Setup

  1. Import and Define Custom Elements in app route or
    In App.js, import and define the custom elements conditionally within a useEffect hook:

    import { useEffect } from 'react';
    import { defineCustomElements } from 'sg-chatbot-ui/loader';
    
    useEffect(() => {
      if (typeof window !== "undefined") {
        defineCustomElements(window);
      }
    }, []);
  2. Import and Define Custom Elements in page route
    In App.js, import and define the custom elements conditionally within a useEffect hook:

    import { useEffect } from 'react';
    
     useEffect(() => {
     if (typeof window !== "undefined") {
       import("sg-chatbot-ui/loader").then((module) => {
         module.defineCustomElements(window);
       });
     }
    }, []);
  3. Declare Custom Element in TypeScript
    Inside the src folder, create a file named global.d.ts to declare the chatbot-ui component:

    declare namespace JSX {
      interface IntrinsicElements {
        "chatbot-ui": React.DetailedHTMLProps<
          React.HTMLAttributes<HTMLElement>,
          HTMLElement
        >;
      }
    }
  4. Use the Custom Element
    Add the <chatbot-ui> component at the bottom of page.tsx:

    <chatbot-ui></chatbot-ui>
  5. Set Server URL
    In your .env file, add the server URL and update it with your current base URL:

    NEXT_PUBLIC_SERVER_URL=https://sentientgeeks.com

With these steps, you should have the SG Chatbot UI integrated and ready to use in your application!

@rollup/plugin-imageagent-baseansi-escapesansi-regexansi-stylesanymatchargparseast-typesb4ababel-jestbabel-plugin-istanbulbabel-plugin-jest-hoistbabel-preset-current-node-syntaxbabel-preset-jestbalanced-matchbare-eventsbase64-jsbasic-ftpbrace-expansionbracesbrowserslistbserbufferbuffer-crc32buffer-fromcallsitescamelcasecaniuse-litechalkchar-regexchromium-bidici-infocjs-module-lexercliuicocollect-v8-coveragecolor-convertcolor-nameconcat-mapconvert-source-mapcosmiconfigcreate-jestcross-fetchcross-spawndata-uri-to-bufferdebugdedentdeepmergedegeneratordetect-newlinedevtools-protocoldiff-sequencesdotenvelectron-to-chromiumemitteryemoji-regexend-of-streamenv-pathserror-exescaladeescape-string-regexpescodegenesprimaestraverseesutilsexecaexitexpectextract-zipfast-fifofast-json-stable-stringifyfb-watchmanfd-slicerfill-rangefind-upfs-extrafs.realpathfunction-bindgensyncget-caller-fileget-package-typeget-streamget-uriglobglobalsgraceful-fshas-flaghasownhtml-escaperhttp-proxy-agenthttps-proxy-agenthuman-signalsieee754import-freshimport-localimurmurhashinflightinheritsip-addressis-arrayishis-core-moduleis-fullwidth-code-pointis-generator-fnis-numberis-streamisexeistanbul-lib-coverageistanbul-lib-instrumentistanbul-lib-reportistanbul-lib-source-mapsistanbul-reportsjest-changed-filesjest-circusjest-configjest-diffjest-docblockjest-eachjest-environment-nodejest-get-typejest-haste-mapjest-leak-detectorjest-matcher-utilsjest-message-utiljest-mockjest-pnp-resolverjest-regex-utiljest-resolvejest-resolve-dependenciesjest-runnerjest-runtimejest-snapshotjest-utiljest-validatejest-watcherjest-workerjs-tokensjs-yamljsbnjsescjson-parse-even-better-errorsjson5jsonfilekleurlevenlines-and-columnslocate-pathlru-cachemake-dirmakeerrormerge-streammicromatchmimic-fnminimatchmittmkdirp-classicmsnatural-comparenetmasknode-fetchnode-int64node-releasesnormalize-pathnpm-run-pathonceonetimep-limitp-locatep-trypac-proxy-agentpac-resolverparent-moduleparse-jsonpath-existspath-is-absolutepath-keypath-parsependpicocolorspicomatchpiratespkg-dirpretty-formatprogresspromptsproxy-agentproxy-from-envpumppuppeteer-corepure-randqueue-tickreact-isrequire-directoryresolveresolve-cwdresolve-fromresolve.exportssemvershebang-commandshebang-regexsignal-exitsisteransislashsmart-buffersocket.io-clientsockssocks-proxy-agentsource-mapsource-map-supportsprintf-jsstack-utilsstreamxstring-lengthstring-widthstrip-ansistrip-bomstrip-final-newlinestrip-json-commentssupports-colorsupports-preserve-symlinks-flagtar-fstar-streamtest-excludetext-decoderthroughtmplto-fast-propertiesto-regex-rangetr46tslibtype-detecttype-festunbzip2-streamuniversalifyupdate-browserslist-dburlpattern-polyfillv8-to-istanbulwalkerwebidl-conversionswhatwg-urlwhichwrap-ansiwrappywrite-file-atomicwsy18nyallistyargsyargs-parseryauzlyocto-queue
0.0.14

3 months ago

0.0.13

4 months ago

0.0.12

6 months ago

0.0.11

6 months ago

0.0.10

6 months ago

0.0.9

6 months ago

0.0.8

6 months ago

0.0.7

6 months ago

0.0.6

6 months ago

0.0.5

6 months ago

0.0.4

6 months ago

0.0.3

6 months ago

0.0.2

6 months ago

0.0.1

7 months ago