npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@one-platform/opc-feedback

v0.2.3-alpha

Published

opc-feedback component follows the One Platform design system and can be used as a popup to collect feedback from the end-users.

Downloads

1,676

Readme

opc-feedback Component 👋

Version Build Status Maintenance

Feedback Component follows the One Platform design system and can be used as a popup to collect feedback from the end-users.

Prerequisites

The opc-feedback component is partially dependent on the Patternfly library for styles. So to avoid any missing styles, add the patternfly.css file before the component script tag. ion-icons has used for rendering icons in the opc-feedback component this also should be included for displaying icons.

<link type="text/css" rel="stylesheet" href="https://unpkg.com/@patternfly/[email protected]/patternfly.min.css" crossorigin="anonymous" />
<link type="text/css" rel="stylesheet" href="https://unpkg.com/@patternfly/[email protected]/patternfly-addons.css" crossorigin="anonymous" />

<script type="module" src="https://cdnjs.cloudflare.com/ajax/libs/ionicons/5.5.0/ionicons/ionicons.esm.js"></script>
<script nomodule="" src="https://cdnjs.cloudflare.com/ajax/libs/ionicons/5.2.3/ionicons/ionicons.js"></script>

Install

npm install --save @one-platform/opc-feedback

Usage

For VanillaJS

  • Import component
import '@one-platform/opc-feedback/dist/opc-feedback';

For Angular

  • In your app.module include the CUSTOM_ELEMENTS_SCHEMA and import the component
import { NgModule, CUSTOM_ELEMENTS_SCHEMA } from '@angular/core';
import '@one-platform/opc-feedback/dist/opc-feedback';

@NgModule({
  declarations: [AppComponent],
  imports: [BrowserModule],
  schemas: [CUSTOM_ELEMENTS_SCHEMA],
  providers: [],
  bootstrap: [AppComponent],
})
export class AppModule {}
  • Add component in any component html template

For React

  • Import the component in App.js
import '@one-platform/opc-feedback/dist/opc-feedback';

Inject component to the index of your app

<opc-feedback id="opc-feedback"> </opc-feedback>

Themes

| Theme Name | Example | | ---------------------------------- | -------------------------------------------- | | red (default and fallback color) | <opc-feedback theme="red"></opc-feedback> | | blue | <opc-feedback theme="blue"></opc-feedback> | | dark | <opc-feedback theme="dark"></opc-feedback> |

Color pallette

| Color | hex (default-fallback) | | ----------------------------------------- | ---------------------- | | --opc-feedback--BackgroundColor | #a30000 | | --opc-feedback--TextColor | #fff | | --opc-feedback__submit--BackgroundColor | #a30000 | | --opc-feedback__submit--TextColor | #fff |

Properties

| Name | value | | --------------- | ----------------------------------------------------------------------------------------------------------------------- | | spa | String value is expected, View Feedback link is hidden by default. | | docs | String value is expected, it is undefined by default. | | summaryLimit | Number value is expected, it is Infinite by default. | | app | Object value is expected { name: 'one platform', url: '/' } is the default fallback url for docs | | theme | Refer themes section. | | target | String value is expected, it is _self by default. Specifies where to open the linked document Url | | beetleIcon | String value is expected, it is show by default. Specifies to show or hide the parent beetle icon on the button |

Default Template

When opc-feedback is launched it is loaded with the following the default template in ui.

{
  feedbackFAB: 'Send Feedback',
  dialogTitle: 'Share your thoughts with us',
  bugReportTitle: 'Report Bug',
  feedbackReportTitle: 'Send Feedback',
  documentationTitle: 'Documentation',
  spaRedirectTitle: 'View Feedback',
  errorTitle: 'What is wrong?',
  bugSubmissionNote: 'Note: By submitting a bug it will open an issue in jira',
  feedbackTitle: 'How was your overall experience?',
  feedbackSubtitle: 'It will help us to improve platform',
  summary: 'Summary',
  summaryPlaceholder: 'How can we do better?',
  confirmationTitle: 'Thanks for your feedback. Your experience is important to us!',
  confirmationSubTitle: 'Each time a friend submits a experience, it creates a task for our developer team to resolve it with priority.',
  confirmationEventMessage: 'Submitted the feedback',
  experienceList: [{
    name: 'Excellent',
    assetUrl: './assets/happy.svg',
  },
  {
    name: 'Good',
    assetUrl: './assets/good.svg',
  },
  {
    name: 'Needs Improvement',
    assetUrl: './assets/improvement.svg'
  }],
  errorList: [{
    name: 'Slow Loading'
  },
  {
    name: 'Not Responsive'
  },
  {
    name: 'Navigation'
  },
  {
    name: 'UI Issues'
  },
  {
    name: 'Other'
  }]
}

Custom Template Example

We can override the data with the default template with custom template by passing the custom properties in the following format as per defined structure of default json.

  • Use the feedbackTemplate setter function to set the template ui.
document.querySelector('opc-feedback').feedbackTemplate = {
  feedbackFAB: 'Share Feedback',
};

| Template Properties | Datatype | | -------------------- | -------- | | feedbackFAB | String | | dialogTitle | String | | bugReportTitle | String | | feedbackReportTitle | String | | documentationTitle | String | | spaRedirectTitle | String | | errorTitle | String | | bugSubmissionNote | String | | feedbackTitle | String | | feedbackSubtitle | String | | summary | String | | summaryPlaceholder | String | | confirmationTitle | String | | confirmationSubtitle | String | | experienceList | Array | | errorList | Array |

Event Handling

Trigger the modal outside the component

document.querySelector('opc-feedback').toggle();

opc-feedback emits an event with submit operation

  • You can use the data for sending it to backend.
document
  .querySelector('opc-feedback')
  .addEventListener('opc-feedback:submit', (event) =>
    console.log(event.detail.data)
  );

(new) Submit data using callback function:

  • You can set onSubmit() fucntion on opc-feedback component
function callbackFn(event) {
  console.log(event.detail.data);
}
document.querySelector('opc-feedback').onSubmit = callbackFn;

Development server

Prerequisites

  • NodeJS >= 8

  • IDE (VSCode/Atom)

  • Browser (Mozilla Firefox/Google Chrome)

Run development server

npm run dev opc-feedback

Build

npm run build opc-feedback

Run tests

npm run test

🤝 Contributors

👤 Rigin Oommen

👤 Sumeet Ingole

👤 Akhil Mohan

👤 Shamsuddin