4.32.2

Free trial product panel

AUI module to render a free trial panel

Demo

const freeTrialObligations = [{ "obligationSource": "Zuora", "Id": "8a8aa29b86e43f150186e7ef697561ef", "productCatalogId": "2c92a0f9483d9217014841c1b58c6673", "itemName": "AvaTax - SDK - Free Trial - Developer - SERVICE", "isAccessPermitted": true, "type": "Recurring", "accessStart": "2023-01-16", "termStart": "2023-03-16", "termEnd": "2023-10-16", "initialTerm": 2, "renewalTerm": 12, "connectorId": "a0n3300000FSOpWAAX", "connectorName": "FoxyCart", "connectorMarketplaceName": "Foxy.io", "connectorLevel": "Level 2", "connectorPOS": false, "connectorIsExtractor": "No", "billingFrequency": "Annual", "quantity": 1, "price": 0, "OveragePrice": null, "productCategory": "AvaTax", "productSubCategory": "FreeTrial" }, { "obligationSource": "Zuora", "Id": "8a12a29b86e43f150186e7ef697561ef", "productCatalogId": "2c92a0f9483d9217014841c1b58c6673", "itemName": "AvaTax Calc Sandbox - 2 Month API Sandbox (Free) - 2 Month API", "isAccessPermitted": true, "type": "Recurring", "accessStart": "2023-01-16", "termStart": "2023-03-16", "termEnd": "2023-12-16", "initialTerm": 2, "renewalTerm": 12, "connectorId": "a0n3300000FSOpWAAX", "connectorName": "FoxyCart", "connectorMarketplaceName": "Foxy.io", "connectorLevel": "Level 2", "connectorPOS": false, "connectorIsExtractor": "No", "billingFrequency": "Specific_Months", "quantity": 1, "price": 0, "OveragePrice": null, "productCategory": "Sandbox", "productSubCategory": "FreeTrial" }, { "obligationSource": "Zuora", "Id": "8a12a29b86e43f150186e7ef697561ef", "productCatalogId": "2c92a0f9483d9217014841c1b58c6673", "itemName": "Returns for Small Business - Avalara Returns for Small Business Free Trial - Avalara Returns for Small Business", "isAccessPermitted": true, "type": "Recurring", "accessStart": "2023-01-16", "termStart": "2023-03-16", "termEnd": "2023-12-16", "initialTerm": 2, "renewalTerm": 12, "connectorId": "a0n3300000FSOpWAAX", "connectorName": "FoxyCart", "connectorMarketplaceName": "Foxy.io", "connectorLevel": "Level 2", "connectorPOS": false, "connectorIsExtractor": "No", "billingFrequency": "Month", "quantity": 1, "price": 0, "OveragePrice": null, "productCategory": "Returns", "productSubCategory": "FreeTrial" }]; const freeTrial = document.querySelector("aui-trial-products"); freeTrial.obligations = freeTrialObligations; freeTrial.emitUpgradeEvents = ["avatax"]; freeTrial.addEventListener("s-upgrade", (e) => { // perform app specific business here if (e.detail.productName === "avatax") alert(`Upgrade url: ${e.detail.url}`); });

API

Tag

Name Description
<aui-trial-products> Custom Element, no content

Attributes

Name Value Required Description
obligations Array of obligations

Stringified JSON of obligations array retrieved from https://api.biztech.avalara.com/business-activity/customer-accounts/:id/obligations?includeFuture=true (this will be deprecated soon) OR https://api.auth1.avalara.com/ws/rest/obligations/customer/:customerId. See Guidelines for more details.

emitupgradeevents Array of product names

Stringified JSON array of string values representing trial products that should emit an s-upgrade event instead of using the default link.

The component will recognize any of the following values: 'avatax', 'avataxSandbox', 'returnsForSmallBusiness'

You may also use 'all' to dispatch an event for all products instead of using the default link.

upgradereturnurl URL to be sent to after upgrading

NOTE: buy.avalara.com only supports URLs within the avalara.com domain.

qa.buy.web.avalara.io also supports URLs within the avalara.io domain.

Properties

Name Value Required Description
obligations Array of obligations

Stringified JSON of obligations array retrieved from https://api.biztech.avalara.com/business-activity/customer-accounts/:id/obligations?includeFuture=true (this will be deprecated soon) OR https://api.auth1.avalara.com/ws/rest/obligations/customer/:customerId. See Guidelines for more details.

emitUpgradeEvents Array of product names

Array of string values representing trial products that should emit an s-upgrade event instead of using the default link.

The component will recognize any of the following values: 'avatax', 'avataxSandbox', 'returnsForSmallBusiness'

You may also use 'all' to dispatch an event for all products instead of using the default link.

upgradeReturnUrl URL to be sent to after upgrading

NOTE: buy.avalara.com only supports URLs within the avalara.com domain.

qa.buy.web.avalara.io also supports URLs within the avalara.io domain.

Events

Name Detail Description
s-upgrade

The clicked upgrade button's url, dataRef, displayName, productName, and returnUrl values are available on e.detail.

Fired after an upgrade button is clicked, if the emitUpgradeEvents property includes that product, or the "all" value is included.

When using the url in an iframe the embedded=true query param must be present in the product url link used. See How to Embed BuyDot for more information.

Guidelines

Usage

Please contact BuyDot product manager if you would like to use this component or add additional products to it!

Obligations object

This component works with two different obligations objects for now. See examples below.

The endpoint https://api.biztech.avalara.com/business-activity/customer-accounts/:id/obligations?includeFuture=true returns an object like this:

const freeTrialObligations = [{ id: 'ABC123', transactionId: 'ABC123', invoiceOwnerId: null, externalId: 'ABC123', quantity: 1, featureDetailId: 'ABC123', cpqId: 'ABC123', currency: 'USD', discountedExtendedAmount: 0, discountAmount: null, discountPercentage: null, endOfAgreementBehavior: 'Terminate', accessStart: '2021-02-21T00:00:00.000Z', termStart: '2021-02-21T00:00:00.000Z', termEnd: '2021-04-20T00:00:00.000Z', billingFrequency: 'Annual', connectorId: 'a0n4000000ChMvfAAF', listPrice: 0, isActive: 1, createdAt: '2021-02-21T16:08:22.519Z', includedUnits: 0, unitOfMeasure: null, termsId: '2018Terms', termsUrl: 'www.avalara.com/terms', replacedAt: '2021-02-21T16:08:22.519Z', connectorName: '3dcart', connectorMarketplaceName: '3dcart', connectorLevel: 'Level 1', connectorPOS: false, connectorIsExtractor: 'No', featureDetail: { id: 'ABC123', cpqId: 'ABC123', featureId: 'ABC123', tierFrom: null, tierTo: null, unitOfMeasure: null, connectorId: null, endOfAgreementBehavior: 'Terminate', renewalBehavior: '', chargeModel: '', chargeType: '', priceFormat: null, serviceDiscountAppliesToUsage: 0, provisioningTreatmentName: 'Avalara Avatax', listSubscriptionDuration: 2, createdAt: '2018-06-12T17:31:59.000Z', modifiedAt: '2018-08-08T16:30:40.355Z', includedUnits: 0, feature: { id: 'ABC123', name: 'Avalara Avatax - Free Trial - Service', description: 'Avalara Avatax - Free Trial - Service', productName: 'Avalara AvaTax', canonicalName: 'Avatax', createdAt: '2018-06-12T17:31:55.000Z', modifiedAt: '2018-07-03T18:01:55.172Z', }, entitlements: [], }, }]

The endpoint https://api.auth1.avalara.com/ws/rest/obligations/customer/:customerId returns an object like this:

const freeTrialObligations = [{ "obligationSource": "Zuora", "Id": "8a8aa29b86e43f150186e7ef697561ef", "productCatalogId": "2c92a0f9483d9217014841c1b58c6673", "itemName": "AvaTax - SDK - Free Trial - Developer - SERVICE", "isAccessPermitted": true, "type": "Recurring", "accessStart": "2023-01-16", "termStart": "2023-03-16", "termEnd": "2023-04-16", "initialTerm": 2, "renewalTerm": 12, "connectorId": "a0n3300000FSOpWAAX", "connectorName": "FoxyCart", "connectorMarketplaceName": "Foxy.io", "connectorLevel": "Level 2", "connectorPOS": false, "connectorIsExtractor": "No", "billingFrequency": "Annual", "quantity": 1, "price": 0, "OveragePrice": null, "productCategory": "AvaTax", "productSubCategory": "FreeTrial" } ]

Design

Design resources can be found on the Skylab design documentation site: skylab.avalara.com