1.1.0 • Published 2 years ago

use-rebuy-hooks v1.1.0

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

Rebuy

Rebuy integration for Shogun Frontend.

Rebuy creates intelligent shopping experience with data-driven persoanlization and providing merchandizing solutions.

Rebuy website →

Installation

yarn add @frontend-sdk/rebuy npm install @frontend-sdk/rebuy


Usage

Rebuy Widgets

  1. Inject Rebuy's script with your shopify domain (myshopify):

    import { useRebuyWidget } from '@frontend-sdk/rebuy'
    
    const App = () => {
      useRebuyWidget('<insert Shopify domain here>')
      return <>…</>
    }
  2. Add div with the widget ID:

    const RebuyWidget = ({ widgetId }) => {
      return (
        <div
          data-rebuy-id="widgetId"
          data-rebuy-shopify-product-ids="<Product ID>"
        </div>
      )
    }

Rebuy Data

  1. Add div with the widget's data source API endpoint (You can find it here: https://rebuyengine.com/data_sources/id//preview):

    import { useRebuyData } from '@frontend-sdk/rebuy'
    
    const RebuyWidget = ({ dataSourceUrl }) => {
      const rebuyData = useRebuyData('<insert data source URL>')
    
      return (
        <div>
          { 
            rebuyData && 
            Object.keys(rebuyData).length > 0 &&
            <div className="rebuy-widget">
              <h1>Rebuy Section</h1>
              <div>
                { 
                  rebuyData.data.map(each => {
                    return (
                      <div> {each.title} </div>
                    )
                  })
                }
              </div>
            </div>
          }
        </div>
      )
    }

Links

1.1.0

2 years ago

1.0.9

2 years ago

1.0.8

2 years ago

1.0.7

2 years ago

1.0.6

2 years ago

1.0.5

2 years ago

1.0.4

2 years ago

1.0.3

2 years ago

1.0.2

2 years ago

1.0.1

2 years ago

1.0.0

2 years ago

0.0.2

2 years ago

0.0.1

2 years ago