aidaptive-sdk
TypeScript icon, indicating that this package has built-in type declarations

2.0.3 • Public • Published

Getting Started

Integrate Aidaptive Predictive Recommendations and Search in your React, React Native, Next JS, Angular or other client side npm frameworks.

Installation Steps

  • Install aidaptive-sdk with npm
npm install aidaptive-sdk
  • Add the Jarvis ML CDN "id" script in your project's index.html file:
<script src=“https://cdn.jarvisml.com/jarvisml-id.min.js?cid=your-cid&vertical=your-vertical”></script>

See https://app.aidaptive.com/documentation for more details about parameters you can pass, for example customer_id and item_id.

Usage

Recommendations

import { Component } from '@angular/core';
import { getRecommendations, PublicEntity } from 'aidaptive-sdk';


export class AppComponent {
  results: PublicEntity[] = [];

  constructor() {
    this.getResults();
  }

  async getResults() {
    const response = await getRecommendations({
      recommendationsCount: 4,    // Recommendations Count 
      pageType: "home",           // Source of the Request (Home, PropertyDetails, ...)
      locationFilter: "paris"     // Location Name
    });
    if (!response) throw new Error('request failed');
    this.results = response.recommendations;
  }
}

Search Results

import { Component } from '@angular/core';
import { getSearchResults, VariantData, PublicEntity } from 'aidaptive-sdk';

export class AppComponent {
  results: PublicEntity[] = [];
  
  constructor() {
    this.getResults();
  }

  async getResults() {
    const filters = new VariantData()
      .setValue('search_text', 'beach')
      .setValueIfTruthy('max_price', 3000)
      .setValueIfTruthy('min_bedrooms', 4)
      .setValueIfTruthy('min_bathrooms', 3); // See sample pages for more examples

    const response = await getSearchResults({
      filters,         // Search filters
      pageSize: 10,    // Results per page
    });
    if (!response) throw new Error('request failed');
    this.results = response.results;
  }
}

Contact Us

For more information, email us: support@aidaptive.com

Readme

Keywords

none

Package Sidebar

Install

npm i aidaptive-sdk

Weekly Downloads

31

Version

2.0.3

License

ISC

Unpacked Size

49.1 kB

Total Files

9

Last publish

Collaborators

  • aidaptive