0.1.54 • Published 2 years ago

bal-create-autotags-widget v0.1.54

Weekly downloads
-
License
-
Repository
-
Last release
2 years ago

bal-create-autotags-widget

How to run StoryBook locally

cd autotags-ui
npm install
npm run storybook

Publish

Add the .npmrc file to the root folder. Please follow this guideline to compeletely set up the .npmrc file: https://dev.azure.com/baldevops/Development/_artifacts/feed/front-end/connect/npm

cd autotags-ui
npm version <enter-semantic-version-here>
npm run build
npm publish

Install

Add the .npmrc file to your project folder Please follow this guideline to completely set up the .npmrc file: https://dev.azure.com/baldevops/Development/_artifacts/feed/front-end/connect/npm

npm install bal-create-autotags-widget

Usage

import React from 'react';
import { BalCreateAutotagsWidget } from "bal-create-autotags-widget";
import 'bal-create-autotags-widget/dist/style.css';

const ExamplePage = () => {
  // Required props
  const domainName = "docgen";
  const entityName = "template";
  const apiBaseUrl = "https://autotags-api.hippo.balglobal.com/autotags-api";
  const taggableEntities = [
    {
      key: "MigrationId-of-the-entity-in-database-here",
      name: "Displayed name here",
      description: "An optional description here"
    },
    {
      key: '1901ff64-ebfc-ec11-aa82-0a84bca9d23e',
      name: 'US - Filing Transmittal Letter to USCIS / DOL / Consulate (Residence)',
      description: 'WORD, All, Jul 07 2022'
    }
  ];
  const getAccessToken = async () => {
    // Do somethings async here if needed
    return "jwt-access-token";
  };

  // Optional props
  const size = { width: 450, height: 500 }; // Initial size of the widget in pixels.
  const toastPosition = "top-right"; // The displayed position of toast message.
  const autoCloseDuration = 5000; // Set the delay in ms to close the toast automatically.

  return (
    <BalCreateAutotagsWidget
      apiBaseUrl={apiBaseUrl}
      getAccessToken={getAccessToken}
      domainName={domainName}
      entityName={entityName}
      entities={entities}
      size={size}
      toastPosition={toastPosition}
      autoCloseDuration={autoCloseDuration}
    />
  );
};

Confluence page

https://balsoftware.atlassian.net/wiki/spaces/COBALT/pages/458031105/AutoTags+Widget+bal-create-autotags-widget