New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@siteone/pagebuilder-core

Package Overview
Dependencies
Maintainers
3
Versions
148
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@siteone/pagebuilder-core

State management and stuff

  • 0.9.0
  • latest
  • npm
  • Socket score

Version published
Weekly downloads
18
decreased by-76.62%
Maintainers
3
Weekly downloads
 
Created
Source

@siteone/pagebuilder-core

TODO: State management and stuff

Usage

const pagebuilderCore = require('@siteone/pagebuilder-core');

// TODO: DEMONSTRATE API

API

BlockMeta

Pro jednoduché testování se přidávají základní informace o bloku do DOM jako data- attributy k bloku

předáváme data-blockname a data-blockid, v konkrétních blocích je pak potřeba myslet na to, aby se tyto props předali do nejvyšší úrovně bloku

BlockMetaContext

Každý block, který je vyrenderovaný pagebuilderem, předává do BlockMetaContextu informace o daném bloku, které jsou primárně určeny pro analytiku, ale může být použita na více věcí

Context obsahuje data v tomto formátu

type BlockMetaType = {
  /**
   * @description name of block
   */
  name: string,
  /**
   * @description unique identification of block on page
   */
  id: string,
  /**
   * @description says on what breakpoints is component visible
   */
  displayOn: string,
  /**
   * @description what theme is used for this block
   */
  theme: string,
}

Použití

import React, { useContext } from 'react' 
import { BlockMetaContext } from '@siteone/pagebuilder-core'

function ButtonContainer () {
  const blockMeta = useContext(BlockMetaContext)
  const dispatch = useDispatch()

  const handleClick = () => {
    dispatch({
      type: '@@analytics/BUTTON_CLICK',
      payload: {
        action: 'click',
        block: blockMeta.name,
        theme: blockMeta.theme,
        // some other stuff
      },
    })

    function() { console.log('do some other magic') }
  }

  return <button onClick={handleClick}>awesome button</button>
}


FAQs

Package last updated on 04 Oct 2022

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc