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 🙏

© 2024 – Pkg Stats / Ryan Hefner

insider-ionic-plugin

v1.0.1

Published

Integration with Insider platform products. Bridge plugin with native Insider SDK's.

Downloads

167

Readme

insider-ionic-plugin

Integration with Insider platform products. Bridge plugin with native Insider SDK's.

Install

npm install insider-ionic-plugin
npx cap sync

Setup

Insider SDK has some native requirements to run, so please follow the Dependencies and setup modules from native SDK's.

Android

  1. Setup the project following the instructions in the Insider's Academy
  2. Add the following dependencies in android/app/build.gradle file
dependencies {
  // ... all your projects other dependencies
  implementation 'com.useinsider:insider:14.2.4-nh'
  implementation 'com.useinsider:insiderhybrid:1.1.5'
}

iOS

  1. Setup the project following the instructions in the Insider's Academy

Push Notifications

For this sdk push notification's config, click here

Insider Capacitor SDK Modules

Initialization

await initialize({partnerId: "insider", appGroup: "group.com.insider.capacitor.demotest"}); 

User

Usage example:

// User object attributes
await setName({ name: `insider` });
await setSurname({ surname: `capacitor-sdk` });
await setAge({ age: 25 });
await setGender({ gender: "female" });
await setBirthday({ birthday: "1996-06-25" }); //Data should be set in (YYYY-MM-DD) format.

await setFacebookID({ facebookId: "facebookId" });
await setTwitterID({ twitterId: "twitterId" });
await setLanguage({ language: "pt" });
await setLocale({ locale: "pt_BR" });

// Optins
await setEmailOptin({ emailOptIn: true });
await setSMSOptin({ smsOptin: true });
await setLocationOptin({ locationOptin: true });
await setPushOptin({ pushOptIn: true });

// Custom User Attributes
await setCustomAttributeWithBoolean({
  key: "boolean_parameter",
  value: false,
});
await setCustomAttributeWithDouble({
  key: "double_parameter",
  value: 20.5,
});
await setCustomAttributeWithInt({
  key: "int_parameter",
  value: 25,
});
await setCustomAttributeWithString({
  key: "string_parameter",
  value: "caaqui",
});
await setCustomAttributeWithArray({
  key: "array_parameter",
  value: ["capacitor", "insider", "ionic"],
});

await setCustomAttributeWithDate({
  key: "date_parameter",
  value: new Date().toISOString(),
});

// Identifiers
await setPhoneAsIdentifier({ phone: "+5511941231111" });
await setEmailIdentifier({ email: `[email protected]` });
await setUserIdAsIdentifier({ uuid: id });
await login(); // Always call LOGIN after set all the identifiers needed. 

await logout();

Product/Track Revenue

   const product = new InsiderProduct(
      "productId",
      "name",
      ["category1"],
      "http://www.insider.com",
      100.0,
      "BRL"
    );
product  
      .setColor("red")
      .setGroupcode("groupcode")
      .setQuantity(1)
      .setStock(10)
      .setPromotionDiscount(0.1)
      .setPromotionName("promotionName")
      .setShippingCost(10.0)
      .setSize("size")
      .setVoucherDiscount(0.2)
      .setSalePrice(90.0);
      .addParameterWithArray("array_parameter", [
        "insider",
        "ionic",
        "capacitor",
      ])
      //custom product parameters
      .addParameterWithBoolean("boolean_parameter", false)
      .addParameterWithDate("date_parameter", new Date().toISOString())
      .addParameterWithDouble("double_parameter", 20.5)
      .addParameterWithInt("int_parameter", 25)
      .addParameterWithString("string_parameter", "caaqui")
    

    await itemAddedToCart({ product: product });
    await itemRemovedFromCart({ productId: "productId" });
    await itemPurchased({ product: product, saleId: "saleId" });
    await cartCleared();

Events

// Events
var event = new InsiderEvent("my_custom_event")
  .addParameterWithBoolean("boolean_parameter", false)
  .addParameterWithDouble("double_parameter", 20.5)
  .addParameterWithInt("int_parameter", 25)
  .addParameterWithString("string_parameter", "insider")
  .addParameterWithArray("array_parameter", [
    "insider",
    "ionic",
    "capacitor",
  ])
  .addParameterWithDate("date_parameter", new Date().toISOString());

await build({
  event: event,
});//Always call build to send event data. If you dont call build, event will not be sent.


// Page View Events

await visitHomePage();
await visitListingPage({taxonomy: ["category1", "category2","category3"]});
await visitProductDetailPage({ product: product });
await visitCartPage({ products: [product, product2] });

Push Notifications

Setup

API

initialize(...)

initialize(_options: { partnerId: string; appGroup?: string; quietPermission?: boolean; }) => Promise<{}>

| Param | Type | | -------------- | --------------------------------------------------------------------------------- | | _options | { partnerId: string; appGroup?: string; quietPermission?: boolean; } |

Returns: Promise<{}>


setPhoneAsIdentifier(...)

setPhoneAsIdentifier(_options: { phone: string; }) => Promise<{}>

| Param | Type | | -------------- | ------------------------------- | | _options | { phone: string; } |

Returns: Promise<{}>


setEmailIdentifier(...)

setEmailIdentifier(_options: { email: string; }) => Promise<{}>

| Param | Type | | -------------- | ------------------------------- | | _options | { email: string; } |

Returns: Promise<{}>


setUserIdAsIdentifier(...)

setUserIdAsIdentifier(_options: { uuid: string; }) => Promise<{}>

| Param | Type | | -------------- | ------------------------------ | | _options | { uuid: string; } |

Returns: Promise<{}>


visitHomePage()

visitHomePage() => Promise<{}>

Returns: Promise<{}>


visitListingPage(...)

visitListingPage(_options: { taxonomy: string[]; }) => Promise<{}>

| Param | Type | | -------------- | ------------------------------------ | | _options | { taxonomy: string[]; } |

Returns: Promise<{}>


visitCartPage(...)

visitCartPage(_options: { products: InsiderProduct[]; }) => Promise<{}>

| Param | Type | | -------------- | -------------------------------------------- | | _options | { products: InsiderProduct[]; } |

Returns: Promise<{}>


visitProductDetailPage(...)

visitProductDetailPage(_options: { product: InsiderProduct; }) => Promise<{}>

| Param | Type | | -------------- | ----------------------------------------- | | _options | { product: InsiderProduct; } |

Returns: Promise<{}>


setGDPRConsent(...)

setGDPRConsent(_options: { consent: boolean; }) => Promise<{}>

| Param | Type | | -------------- | ---------------------------------- | | _options | { consent: boolean; } |

Returns: Promise<{}>


setActiveForegroundPushView()

setActiveForegroundPushView() => Promise<{}>

Returns: Promise<{}>


receivedNotification(...)

receivedNotification(_options: { notification: PushNotificationSchema; }) => Promise<{}>

| Param | Type | | -------------- | -------------------------------------------------------------------------------------------- | | _options | { notification: PushNotificationSchema; } |

Returns: Promise<{}>


addListener(EventTypes.CALLBACK_NOTIFICATION_OPEN, ...)

addListener(eventName: EventTypes.CALLBACK_NOTIFICATION_OPEN, listenerFunc: (data: any) => void) => Promise<PluginListenerHandle>

| Param | Type | | ------------------ | ---------------------------------------------------------------------------- | | eventName | EventTypes.CALLBACK_NOTIFICATION_OPEN | | listenerFunc | (data: any) => void |

Returns: Promise<PluginListenerHandle>


addListener(EventTypes.CALLBACK_INAPP_BUTTON_CLICK, ...)

addListener(eventName: EventTypes.CALLBACK_INAPP_BUTTON_CLICK, listenerFunc: (data: any) => void) => Promise<PluginListenerHandle>

| Param | Type | | ------------------ | ----------------------------------------------------------------------------- | | eventName | EventTypes.CALLBACK_INAPP_BUTTON_CLICK | | listenerFunc | (data: any) => void |

Returns: Promise<PluginListenerHandle>


addListener(EventTypes.CALLBACK_TEMP_STORE_PURCHASE, ...)

addListener(eventName: EventTypes.CALLBACK_TEMP_STORE_PURCHASE, listenerFunc: (data: any) => void) => Promise<PluginListenerHandle>

| Param | Type | | ------------------ | ------------------------------------------------------------------------------ | | eventName | EventTypes.CALLBACK_TEMP_STORE_PURCHASE | | listenerFunc | (data: any) => void |

Returns: Promise<PluginListenerHandle>


addListener(EventTypes.CALLBACK_TEMP_STORE_ADDED_TO_CART, ...)

addListener(eventName: EventTypes.CALLBACK_TEMP_STORE_ADDED_TO_CART, listenerFunc: (data: any) => void) => Promise<PluginListenerHandle>

| Param | Type | | ------------------ | ----------------------------------------------------------------------------------- | | eventName | EventTypes.CALLBACK_TEMP_STORE_ADDED_TO_CART | | listenerFunc | (data: any) => void |

Returns: Promise<PluginListenerHandle>


addListener(EventTypes.CALLBACK_TEMP_STORE_CUSTOM_ACTION, ...)

addListener(eventName: EventTypes.CALLBACK_TEMP_STORE_CUSTOM_ACTION, listenerFunc: (data: any) => void) => Promise<PluginListenerHandle>

| Param | Type | | ------------------ | ----------------------------------------------------------------------------------- | | eventName | EventTypes.CALLBACK_TEMP_STORE_CUSTOM_ACTION | | listenerFunc | (data: any) => void |

Returns: Promise<PluginListenerHandle>


addListener(EventTypes.CALLBACK_INAPP_SEEN, ...)

addListener(eventName: EventTypes.CALLBACK_INAPP_SEEN, listenerFunc: (data: any) => void) => Promise<PluginListenerHandle>

| Param | Type | | ------------------ | --------------------------------------------------------------------- | | eventName | EventTypes.CALLBACK_INAPP_SEEN | | listenerFunc | (data: any) => void |

Returns: Promise<PluginListenerHandle>


addListener(EventTypes.CALLBACK_FOREGROUND_PUSH, ...)

addListener(eventName: EventTypes.CALLBACK_FOREGROUND_PUSH, listenerFunc: () => void) => Promise<PluginListenerHandle>

| Param | Type | | ------------------ | -------------------------------------------------------------------------- | | eventName | EventTypes.CALLBACK_FOREGROUND_PUSH | | listenerFunc | () => void |

Returns: Promise<PluginListenerHandle>


Interfaces

PushNotificationSchema

| Prop | Type | Description | Since | | ------------------ | -------------------- | -------------------------------------------------------------------------------------------------------------------- | ----- | | title | string | The notification title. | 1.0.0 | | subtitle | string | The notification subtitle. | 1.0.0 | | body | string | The main text payload for the notification. | 1.0.0 | | id | string | The notification identifier. | 1.0.0 | | tag | string | The notification tag. Only available on Android (from push notifications). | 4.0.0 | | badge | number | The number to display for the app icon badge. | 1.0.0 | | notification | any | It's not being returned. | 1.0.0 | | data | any | Any additional data that was included in the push notification payload. | 1.0.0 | | click_action | string | The action to be performed on the user opening the notification. Only available on Android. | 1.0.0 | | link | string | Deep link from the notification. Only available on Android. | 1.0.0 | | group | string | Set the group identifier for notification grouping. Only available on Android. Works like threadIdentifier on iOS. | 1.0.0 | | groupSummary | boolean | Designate this notification as the summary for an associated group. Only available on Android. | 1.0.0 |

PluginListenerHandle

| Prop | Type | | ------------ | ----------------------------------------- | | remove | () => Promise<void> |

Enums

EventTypes

| Members | Value | | --------------------------------------- | --------------------------------------- | | CALLBACK_NOTIFICATION_OPEN | 'notification_open' | | CALLBACK_INAPP_BUTTON_CLICK | 'inapp_button_click' | | CALLBACK_TEMP_STORE_PURCHASE | 'temp_store_purchase' | | CALLBACK_TEMP_STORE_ADDED_TO_CART | 'temp_store_added_to_cart' | | CALLBACK_TEMP_STORE_CUSTOM_ACTION | 'temp_store_custom_action' | | CALLBACK_INAPP_SEEN | 'inapp_seen' | | CALLBACK_FOREGROUND_PUSH | "foreground_push" |

InsiderEvent Class

Overview

The InsiderEvent class represents an internal event. It allows the addition of parameters of different types to this event.

Constructor

  • constructor(eventName: string)
    • Creates a new instance of InsiderEvent with the provided event name.

Methods

  • addParameterWithString(key: string, value: string): InsiderEvent

    • Adds a parameter with a string value.
  • addParameterWithInt(key: string, value: number): InsiderEvent

    • Adds a parameter with an integer value.
  • addParameterWithDouble(key: string, value: number): InsiderEvent

    • Adds a parameter with a double value.
  • addParameterWithBoolean(key: string, value: boolean): InsiderEvent

    • Adds a parameter with a boolean value.
  • addParameterWithDate(key: string, value: string): InsiderEvent

    • Adds a parameter with a date value.
  • addParameterWithArray(key: string, value: string[]): InsiderEvent

    • Adds a parameter with an array of strings value.

InsiderProduct Class

Overview

The InsiderProduct class represents an internal product. It allows the addition of both required and optional parameters to this product.

Constructor

  • constructor(productId: string, productName: string, taxonomy: string[], imageURL: string, price: number, currency: string)
    • Creates a new instance of InsiderProduct with the provided required parameters.

Methods

  • Methods to add parameters with different value types, similar to the InsiderEvent class.

  • Methods to set optional parameters of the product:

    • setColor(color: string): InsiderProduct
    • setVoucherName(voucherName: string): InsiderProduct
    • setVoucherDiscount(voucherDiscount: number): InsiderProduct
    • setPromotionName(promotionName: string): InsiderProduct
    • setPromotionDiscount(promotionDiscount: number): InsiderProduct
    • setGroupcode(groupcode: string): InsiderProduct
    • setSize(size: string): InsiderProduct
    • setSalePrice(salePrice: number): InsiderProduct
    • setShippingCost(shippingCost: number): InsiderProduct
    • setQuantity(quantity: number): InsiderProduct
    • setStock(stock: number): InsiderProduct
    • setSubCategory(subCategory: string): InsiderProduct