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

@appmaker-xyz/web-sdk

v0.1.8

Published

Appmaker xyz web sdk for interacting with mobile app created using appmaker.xyz

Downloads

2,340

Readme

Appmaker Web SDK

Introduction

The Appmaker Web SDK is a JavaScript library that allows you to interact with the Appmaker webview.

Requirements

  • This library is only compatible with the Appmaker webview.

Installation

npm install @appmaker-xyz/web-sdk

Usage

import AppmakerWebSdk from "@appmaker-xyz/web-sdk";

Methods

isAppmakerWebview()

Returns true if the app is running inside the Appmaker webview.

Example:

AppmakerWebSdk.isAppmakerWebview(); 

getPlatform()

Returns the platform the app is running on. Possible values are android and ios.

Example:

AppmakerWebSdk.getPlatform(); 

openCart()

Opens the cart page.

Example:

AppmakerWebSdk.openCart();

openProductById(productId)

Opens the product page for the product with the given id.

Example:

AppmakerWebSdk.openProductById('gid://shopify/Product/6793295167650')

openProductByHandle(productHandle)

Opens the product page for the product with the given handle.

Example:

AppmakerWebSdk.openProductByHandle("t-shirt")

openCollectionById(collectionId)

Opens the collection page for the collection with the given id.

Example:

AppmakerWebSdk.openCollectionById('gid://shopify/Collection/269255016610')

openCollectionByHandle(collectionHandle)

Opens the collection page for the collection with the given handle.

Example:

AppmakerWebSdk.openCollectionByHandle("t-shirts")

applyCoupon(couponCode, { goBackAfterApply = false } )

Applies the given coupon code to the cart. If goBackAfterApply is true, the app will go back to the previous page after the coupon is applied.

Example:

AppmakerWebSdk.applyCoupon("SUMMER20", { goBackAfterApply: true });

removeCoupon(couponCode)

Removes the given coupon code from the cart.

Example:

AppmakerWebSdk.removeCoupon("SUMMER20");

addProductToCart({ product, variant, quantity, customAttributes })

Adds the given product to the cart. product and variant are the product and variant objects returned by the Shopify Storefront API. quantity is the quantity of the product to add to the cart. customAttributes is an object containing custom attributes to add to the line item.

Example:

const customAttributes = [
      {
        "key": "_appmaker",
        "value": "true"
      }
    ]
const variant = {        
   id: 'gid://shopify/ProductVariant/40026424869026',            
  }
const product =  {      
  id: 'gid://shopify/Product/6796049809570',       
  }    
  AppmakerWebSdk.addProductToCart({ product:product, variant:variant, quantity:1, customAttributes:customAttributes }); // make sure to pass the values to its respective keys

updateCartCustomAttributes({ customAttributes })

Updates the custom attributes of the cart. customAttributes is an object containing custom attributes to add to the cart.

Example:

const customAttributes = [
  {
    "key": "test_custom_attribute",
    "value": "true"
  },
  {
    "key": "test_custom_attribute_2",
    "value": "true"
  }
];
AppmakerWebSdk.updateCartCustomAttributes({ customAttributes }); 

// use delete key to remove the custom attribute
// delete can only be used with boolean true, it will throw an error if you use any other value
customAttributes.push({ key: 'test_custom_attribute', value: null, delete: true });

removeProductFromCart(lineItemId, product, variant, quantity, updateCartPageStateRequired)

Removes the product with the given line item id from the cart.

Example:

AppmakerWebSdk.removeProductFromCart( { lineItemId:'gid://shopify/CheckoutLineItem/400264248690260?checkout=9454b13ff3037f9ec0636b57b075a2a9',product:product , variant:variant ,updateCartPageStateRequired:true}) // refer to addProductToCart for product and variant

updateProductQuantityInCart({ lineItemId, product, variant, quantity, updateCartPageStateRequired})

Updates the quantity of the product with the given line item id in the cart.

Example:

AppmakerWebSdk.updateProductQuantityInCart({ lineItemId:'gid://shopify/CheckoutLineItem/400264248690260?checkout=9454b13ff3037f9ec0636b57b075a2a9',product:product , variant:variant , quantity:2,updateCartPageStateRequired:true}) // refer to addProductToCart for product and variant

clearCart()

Clears the cart.

Example:

AppmakerWebSdk.clearCart();

setLineItemProperties({ lineItemId, product, variant, properties })

Sets the custom attributes of the product with the given line item id in the cart.

Example:

const properties = [
        {
          "key": "custom",
          "value": "appmaker"
        }
      ]
AppmakerWebSdk.setLineItemProperties({lineItemId:'gid://shopify/CheckoutLineItem/400264248690260?checkout=9454b13ff3037f9ec0636b57b075a2a9',product:product, variant:variant, properties:properties}); // refer to addProductToCart for product and variant

openInAppPage({ pageId, title, replacePage = false })

Opens the in-app page with the given id. If replacePage is true, the app will replace the current page with the in-app page.

Example:

AppmakerWebSdk.openInAppPage({ pageId: "home", title: "In-app home page", replacePage: true });

openHome({ replacePage = false })

Opens the home page. If replacePage is true, the app will replace the current page with the home page.

Example:

AppmakerWebSdk.openHome({ replacePage: false });

showMessage({ title })

Shows a message with the given title.

Example:

AppmakerWebSdk.showMessage({ title: "Hello world!" });

goBack()

Goes back to the previous page.

Example:

AppmakerWebSdk.goBack();

copyToClipboard({ text })

Copies the given text to the clipboard.

Example:

AppmakerWebSdk.copyToClipboard({ text: "Hello world!" });

openCheckout()

Opens the checkout page.

Example:

AppmakerWebSdk.openCheckout();

openSearch()

Opens the search page.

Example:

AppmakerWebSdk.openSearch();

Usage

import AppmakerWebSdk from "@appmaker-xyz/web-sdk";

AppmakerWebSdk.openCart();