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 🙏

© 2025 – Pkg Stats / Ryan Hefner

plugin-cmf

v0.2.1

Published

Plugin de avaliação de vagas da Cadê meu Feedback

Downloads

1,645

Readme

CMF Plugin Installation and Usage Guide

Overview

The CMF Plugin allows you to integrate a feedback form into your website, enabling users to provide feedback on job descriptions. This guide will walk you through the updated installation and configuration process, ensuring seamless integration with your website while maintaining complete CSS and DOM isolation.

Installation

Step 1: Include the Plugin Script

Add the following script to your HTML file to include the CMF plugin. Ensure that this script is placed before the closing </body> tag to allow the DOM to load properly.

<script src="path/to/cade-plugin.js"></script>

Step 2: Add Meta Tags

Include the following meta tags in the <head> section of your HTML to configure the plugin. These meta tags provide essential configuration values that the plugin uses for initialization.

<meta name="cmf-client-secret" content="your-client-secret">
<meta name="cmf-base-url" content="your-base-url">
<meta name="cmf-foreign-id" content="your-foreign-id">
<meta name="cmf-role-title" content="your-role-title">

Parameters Explained:

  • cmf-client-secret: Your unique client secret for authentication with the CMF service.
  • cmf-base-url: The base URL path where the plugin is enabled on your website.
  • cmf-foreign-id: An identifier for the foreign entity, such as a specific job posting or role.
  • cmf-role-title: The title of the role or job posting that users will provide feedback on.

Step 3: Add Vacancy Title Element

To provide context for the feedback form, include an element with the cade-title-vacancy attribute in your HTML. This element should contain the title of the role or job posting you want users to provide feedback on.

<div cade-title-vacancy="Senior JavaScript Developer">Senior JavaScript Developer</div>

Important: The plugin relies on this element to display the role title within the feedback form. Ensure that this element is present on every page where you intend to use the feedback form.

Step 4: Initialize the Plugin

Initialize the plugin by calling the start method. This method can be invoked without parameters, in which case the plugin will use the values from the meta tags. Alternatively, you can pass the parameters directly to the start method if you prefer.

Using Meta Tags:

<script>
  CadePlugin.start();
</script>

Passing Parameters Directly:

<script> CadePlugin.start('your-client-secret', 'your-base-url', 'your-foreign-id'); </script>

Note: Passing parameters directly can be useful if you want to override the meta tag values or if you prefer configuring the plugin via JavaScript.

Usage

Meta Tags Configuration

The meta tags provide essential configuration for the CMF Plugin:

  • cmf-client-secret: The client secret used for authenticating requests to the CMF service.
  • cmf-base-url: The base URL path on your website where the plugin should be active.
  • cmf-foreign-id: An identifier for the specific job posting or role the feedback pertains to.
  • cmf-role-title: The title of the role/job posting, displayed within the feedback form.

Methods

The CMF Plugin class provides several methods to manage the feedback form and handle user interactions:

  • start(clientSecret, baseUrl, foreignId): Initializes the plugin with the provided parameters. If parameters are not provided, it will use the values from the meta tags.

    Usage:

    CadePlugin.start(); // Uses meta tags
    // or
    CadePlugin.start('your-client-secret', 'your-base-url', 'your-foreign-id'); // Uses provided parameters
  • toggle(): Toggles the visibility of the feedback form. This method is primarily used internally but can be invoked externally if needed.

    Usage:

    CadePlugin.toggle();

Example Usage

Here is a complete example of how to set up and use the CMF Plugin within your HTML page:

<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Job Feedback</title>

  <!-- Meta Tags for Plugin Configuration -->
  <meta name="cmf-client-secret" content="your-client-secret">
  <meta name="cmf-base-url" content="/jobs">
  <meta name="cmf-foreign-id" content="job-12345">
  <meta name="cmf-role-title" content="Senior JavaScript Developer">

  <!-- Optional: Include other head elements like stylesheets or fonts -->
</head>
<body>

  <!-- Vacancy Title Element -->
  <div cade-title-vacancy="Senior JavaScript Developer">Senior JavaScript Developer</div>

  <!-- Other content of your webpage -->

  <!-- Include the CMF Plugin Script -->
  <script src="path/to/cade-plugin.js"></script>

  <!-- Initialize the Plugin -->
  <script> // Initialize using meta tags
    CadePlugin.start();

    // Or initialize by passing parameters directly
    // CadePlugin.start('your-client-secret', '/jobs', 'job-12345'); </script>
</body>
</html>

Explanation:

  1. Meta Tags: Provide the necessary configuration for the plugin.
  2. Vacancy Title Element: Supplies the role title that the plugin displays.
  3. Plugin Script: Includes the CMF Plugin JavaScript file.
  4. Initialization Script: Calls the start method to initialize the plugin, either using meta tags or by passing parameters directly.

Troubleshooting

Common Issues

  1. Plugin Not Displaying:

    • Ensure Meta Tags Are Correct: Verify that all required meta tags are present and contain valid values.
    • Check Vacancy Title Element: Ensure that an element with the cade-title-vacancy attribute exists on the page.
    • Console Errors: Open the browser's developer console to check for any JavaScript errors that might prevent the plugin from initializing.
  2. Error: "Não encontramos o nome da vaga. Por favor, insira o atributo 'cade-title-vacancy'."

    • Cause: The plugin cannot find an element with the cade-title-vacancy attribute.

    • Solution: Add an element with the cade-title-vacancy attribute containing the role title.

      Example:

      <div cade-title-vacancy="Senior JavaScript Developer">Senior JavaScript Developer</div>
  3. Feedback Submission Failing:

    • Check Client Secret: Ensure that the cmf-client-secret meta tag contains a valid client secret.
    • Network Issues: Verify that there are no network issues preventing the plugin from communicating with the CMF service.
    • CORS Restrictions: Ensure that your server allows cross-origin requests if necessary.

Debugging Steps

  1. Verify Element Presence:

    • Use the browser's developer tools to confirm that the cade-title-vacancy element is present and correctly formatted.
  2. Check Console Logs:

    • Look for any error messages or warnings in the console that can provide insights into what might be going wrong.
  3. Ensure Proper Script Loading:

    • Make sure that the plugin script (cade-plugin.js) is correctly referenced and loaded without errors.

Best Practices

  • Secure Your Client Secret: Keep the cmf-client-secret confidential to prevent unauthorized access to the CMF service.
  • Responsive Design: Ensure that your website is responsive so that the feedback form displays correctly on all devices.
  • Regular Updates: Keep the plugin updated to benefit from the latest features, security patches, and improvements.
  • Accessibility Compliance: Continuously test and enhance the plugin's accessibility to provide an inclusive user experience.

Support

If you encounter issues not covered in this guide or need further assistance with the CMF Plugin, please reach out to our support team at [email protected].