@companycam/saasquatch-custom-components
TypeScript icon, indicating that this package has built-in type declarations

0.0.12 • Public • Published

How to build and deploy custom widgets

  1. Create new components in ./src/components as new folders, for example ./src/components/sqh-my-component

    1. Components should be built using the HVC pattern
    2. Controller should match the name of the folder: sqh-my-component.tsx
    3. View should match the controller name + "view": sqh-my-component-view.tsx
    4. Hook should have the prefix "use" and the Controller's class name: useMyComponent.ts
    5. Stories should be added to provide visuals of each possible state of the component (MyComponent.stories.tsx) and imported into sqh-stencilbook.tsx. Be sure to import any mixins used in your components into sqh-stencilbook.scss
  2. Develop Stencil components locally

    1. npm start
    2. Edit html: index.html
  3. Build and publish to NPM under @companycam/saasquatch-custom-components@x.y.z

    1. Bump the version number in package.json
    2. npm login
    3. npm install
    4. npm run build
    5. Commit the version bump
    6. npm publish --access public
  4. Implement widget in portal widget editor

    1. Reference deployed components in advanced section of the widget editor:

      dependencies:

      package: @companycam/saasquatch-custom-components
      version: x.y.z
      filePath: /dist/saasquatch-custom-components/saasquatch-custom-components.js
      

      plugins:

      package: @companycam/saasquatch-custom-components
      version: x.y.z
      filePath: /grapesjs/grapesjs.js
      
    2. Import custom html from index.html

  5. Test widget in browser using squatch.js library

    1. go to http://squathjs-demo.surge.sh
    2. Fill out tenantAlias, domain, user, widgetType (p/[programId]/w/referrerWidget), and jwt fields for squatch initObj in config
    3. jwt can be generated at https://jwt.io using the user object from config as the payload
      {
         "user":{
            "id":"my-user-id",
            "accountId":"my-account-id"
         }
      }
      
      and your tenant's API key in the Verify Signature section
    4. Reload config

flowchart

Readme

Keywords

none

Package Sidebar

Install

npm i @companycam/saasquatch-custom-components

Weekly Downloads

123

Version

0.0.12

License

MIT

Unpacked Size

11.1 MB

Total Files

97

Last publish

Collaborators

  • ccdvadnais
  • chrisbmcleod
  • itstheraj
  • milevy1
  • shaun.garwood
  • montara
  • austindf
  • meagerfindings
  • eric2esca
  • ryankuhn
  • alexwitherspoon
  • cc-muchen
  • kaylabeth
  • anabelcurry
  • aisflat439
  • johncocam
  • angelalindow
  • coreycollins
  • keegan.rice-companycam
  • derekdapp
  • sde-ccam
  • sdfreund10
  • pkccnpm
  • spencercarli
  • timross14
  • michaelmosher
  • theantichris
  • jarhartman
  • fola773
  • jenshaeffer
  • groots
  • chrisdrewrycc
  • austinkostelansky
  • elzbthshultz
  • alexmabry
  • allisonkbarr
  • florasaramago
  • cc-ldodge
  • stevenmcmanus-cocam
  • mjmelnick
  • stephaneliu
  • pelagic.dev
  • edwardbarton
  • jasonmcclanathan
  • jeff.mcfadden_cocam
  • rachelb1239
  • alalbrecht
  • whylom
  • tdeboer55
  • jwoockman
  • chadwilken
  • tdmcc
  • jasongaare
  • jaredgoertzen
  • kevincompanycam
  • jasonmck
  • jlstewart379
  • joeygordo
  • charlesharris
  • steve-lorenz
  • zaydion
  • cc-developer
  • kimcrowder
  • personable
  • alisonc
  • dssung
  • cimhoff
  • kait210
  • ebrouillette
  • salvador.og
  • cbryant24
  • dustinfisher
  • groovestation
  • irbrad