1.0.1 ‱ Published 1 year ago

@allomambo/galletita v1.0.1

Weekly downloads
-
License
MIT
Repository
github
Last release
1 year ago

đŸȘ Galletita

Extra simple privacy policy solution.
Can be used as either a plugin or a vueJS library.

Installation

Plugin version

1. Add script to web page

<script id="galletita-js" type="module" src="https://unpkg.com/@allomambo/galletita@1.0.1/dist/index.js"></script>

2. Define your configuration

<script>
const galletita = {
    cookie_name: "privacy_policy_consent",
    text_content: {
        title: "...",
        description: "...",
        consent_button_label: "...",
        reject_button_label: "...",
        learn_more_button_label: "...",
    },
    privacy_policy_url: "https://...",
};
</script>
<script>
# Multilingual
const galletita = {
    cookie_name: "privacy_policy_consent",
    fr: {
        text_content: {
            title: "...",
            description: "...",
            consent_button_label: "...",
            reject_button_label: "...",
            learn_more_button_label: "...",
        },
        privacy_policy_url: "https://...",
    },
    en: {
        text_content: {
            title: "...",
            description: "...",
            consent_button_label: "...",
            reject_button_label: "...",
            learn_more_button_label: "...",
        },
        privacy_policy_url: "https://...",
    },
};
</script>

VueJS library version

Requirements

  • Node ^20.8.10
  • VueJS ^3.3.4

Installation

1. Install the package

# With Yarn:
yarn add @allomambo/galletita

# With npm:
npm install @allomambo/galletita

2. Use the component in your project

<template>
    <galletita :cookie-name="..." :text-content="{...}" :privacy-policy-url="..." />
</template>

<script setup>
import { Galletita } from "@allomambo/galletita";
</script>

Props

PropertyTypeDescriptionDefault Value
cookie_namestringThe name of the cookie.galletita_privacy_policy_consent
text_contentGalletitaTranslationsContains the textual elementsSee table below
privacy_policy_urlstringThe complete URL of the privacy policy. Ex. "https://example.com/privacy-policy"null
text_content
Sub-propertiesTypeDescriptionDefault Value (English EN)Default Value (Français FR)
titlestringThe title of the privacy policy.We value your privacyNous respectons votre vie privée
descriptionstringThe description of the privacy policy.<p>We use cookies to enhance your browsing experience, serve personalized ads or content, and analyze our traffic.</p><p>By clicking "Accept", you consent to our use of cookies.</p><p>Nous utilisons des cookies pour améliorer votre expérience de navigation, diffuser des publicités ou des contenus personnalisés et analyser notre trafic.</p><p>En cliquant sur « Accepter », vous consentez à notre utilisation des cookies.</p>
consent_button_labelstringThe label of the consent button.AcceptAccepter
reject_button_labelstringThe label of the reject button.RejectRefuser
learn_more_button_labelstringThe button label to learn more about the privacy policy.Learn moreEn savoir plus

Slots

NameDescription
defaultWrap the entirety of .galletita-box
copyThe text content (title and description)
copyTitleThe title
copyDescriptionThe description
actionsThe buttons to consent, reject and learn more
actionConsentThe consent button
actionRejectThe reject button
actionLearnMoreThe "learn more" button
Exposed data on every slots
NameTypeDescription
isGalletitaVisiblebooleanIf modal is visible of not
cookieNamestringThe name of the cookie
textContentGalletitaTranslationsThe complete object containing the text content (title, description and button labels)
privacyPolicyUrlstringThe privacy policy url
openGalletitafunctionOpen modal
closeGalletitafunctionClose modal
consentfunctionAdd cookie with positive consent and trigger closeGalletita
rejectfunctionAdd cookie with negative consent and trigger closeGalletita

Emits

NameDescription
galletita:openWhen modal is opened
galletita:closeWhen modal is closed
galletita:consentWhen consent button is clicked
galletita:rejectWhen reject button is clicked
1.0.1

1 year ago

1.0.0

1 year ago

0.0.4

2 years ago

0.0.3

2 years ago

0.0.1

2 years ago