TryNow JavaScript SDK

TryNow

The public TryNow interface. Accessible via window.trynow.
This class exposes public SDK methods for interacting with the TryNow Shopify Integration.

Kind: global class

tryNow.config

Gets the current configuration of the TryNow SDK.

Kind: instance property of TryNow

tryNow.config

Sets the configuration of the TryNow SDK

Kind: instance property of TryNow

tryNow.cartId

Sets the cart ID to be used by the TryNow SDK in headless mode. If in headless mode and no cart ID is provided, a new cart will be created.

Kind: instance property of TryNow

tryNow.cartId

Gets the cart ID currently in use by the TryNow SDK.

Kind: instance property of TryNow

tryNow.logger

Gets the TryNow logger instance.

Kind: instance property of TryNow

tryNow.headless

Whether the TryNow SDK is running in headless mode. This is determined by the presence of a Storefront API access token.
Some features may be disabled in headless mode.

Kind: instance property of TryNow

tryNow.initialized

Whether the TryNow SDK has been initialized with a myshopifyDomain.

Kind: instance property of TryNow

tryNow.getConfig() ⇒ TryNowInitConfig

Gets the current configuration of the TryNow SDK.

Kind: instance method of TryNow
Returns: TryNowInitConfig - config

tryNow.reset()

Clears and reloads product page data.

Kind: instance method of TryNow

tryNow.getMyshopifyDomain() ⇒ string

Gets the myshopify domain of the store.

Kind: instance method of TryNow
Returns: string - domain

tryNow.getVersion() ⇒ string

Gets the SDK version. Tries to find from app embed settings, otherwise uses the version set in the config.

Kind: instance method of TryNow
Returns: string - version

tryNow.getTrialPeriodDays() ⇒ Promise.<number>

Gets the number of trial period days.

Kind: instance method of TryNow
Returns: Promise.<number> - days

tryNow.getSellingPlanId() ⇒ Promise.<string>

Gets the selling plan ID number as a string.

Kind: instance method of TryNow
Returns: Promise.<string> - selling plan ID

tryNow.hasPassedTryLink() ⇒ Promise.<boolean>

Checks for the gated_link TryLink.

Kind: instance method of TryNow
Returns: Promise.<boolean> - boolean indicating if the gated_link TryLink has been passed

tryNow.addToCartClicked() ⇒ Promise.<void>

Utility method to log TryNow CTA click analytics event.
This method is called automatically by the TryNow CTA button component, and should only be used
if you are manually creating a CTA button.

Kind: instance method of TryNow

TryNow.getInstance()

Gets the singleton instance of TryNow

Kind: static method of TryNow

TryNow.updateConfig()

Updates config and returns the singleton instance

Kind: static method of TryNow