1.0.32 • Published 1 year ago

@bilyai/types v1.0.32

Weekly downloads
-
License
ISC
Repository
github
Last release
1 year ago

Reference Documentation for BilyPayload Data Type

Overview

This document describes the BilyPayload type used in systems requiring a comprehensive payload incorporating client data, order details, and product information. It's primarily utilized in contexts like user activity tracking, analytics, and data integration tasks.

BilyPayload Type Definition

BilyPayload consolidates multiple pieces of data about a user session or activity, potentially including client details, order information, and a list of products being interacted with.

Fields Description

FieldTypeOptionalDescription
clientClientYesDetails of the client involved in the transaction.
orderOrderYesOrder details, if applicable.
productsArrayYesList of products involved in the transaction.
pageTitlestringYesThe title of the page from which the payload is sent.
userAgentstringYesBrowser or client identifier string.
ipstringYesIP address from which the session is initiated.
referrerstringYesReferring URL, if the user came from another site.
sourceUrlstringYesThe URL of the page that initiated the payload.
source'app' | 'web'YesIndicates whether the payload comes from an app or web platform.
searchQuerystringYesContains the search terms input by the user, reflecting the user's interests or immediate needs.
categorystringYesPage category visited
[key: string]anyYesAllows for additional properties as needed for flexibility.

Automatic Data Detection

  • Fields such as pageTitle, userAgent, ip, referrer, and sourceUrl can be detected automatically by Bily tracking systems, especially in browser-based environments. These fields are optional when tracking via client devices and can be auto-populated to reduce manual data entry and ensure accuracy.

Client, Order, and Product Documentation

The BilyPayload utilizes several complex types that are documented separately:

Implementation Guidelines

  1. Automation and Flexibility:

    • Leverage Bily's capability to automatically detect certain fields to streamline data collection processes and reduce client-side scripting requirements.
    • Flexibly integrate additional data as needed with the [key: string]: any pattern for dynamic adaptation to varied business needs.
  2. Data Integrity:

    • Validate data types and enforce quality checks before processing payloads to ensure that received data conforms to expected formats.
  3. Integration with Existing Systems:

    • Seamlessly integrate BilyPayload into existing CRM, e-commerce platforms, or custom business applications using well-documented APIs and data handling protocols.

Example Usage

Here is how a minimal BilyPayload might be structured in a JSON format:

{
  "client": {
    "firstname": "John",
    "lastname": "Doe",
    "email": "john.doe@example.com"
  },
  "products": [
    {
      "id": "prod001",
      "name": "Wireless Keyboard",
      "price": 99.99,
      "currency": "USD",
      "quantity": 1
    }
  ]
}

Reference Documentation for User Data Type Management

Overview

This documentation details the data structures for managing personal and sensitive user information. Bily assures robust encryption of all sensitive data tracked, ensuring compliance with global data protection standards.

Data Encryption Policy

Bily is committed to encrypting all sensitive data, including data in transit and at rest, using industry-standard cryptographic methods.

Types of Data to be Encrypted:

  • Personal identification information (e.g., names, emails, phone numbers).
  • Demographic information (e.g., date of birth, gender).
  • Location data (e.g., addresses).

Data Type Definitions

Address Type

Represents the postal address of a user or client, with all fields encrypted.

FieldTypeOptionalDescriptionEncryption
citystringYesCity or locality of the address.Encrypted
statestringYesState, province, or region of the address.Encrypted
zipstringYesPostal or ZIP code of the address.Encrypted
countrystringYesCountry of the address.Encrypted

Client Type

Contains personal and contact details of a user, ensuring encryption of sensitive data.

FieldTypeOptionalDescriptionEncryption
firstnamestringYesFirst name of the client.Encrypted
lastnamestringYesLast name of the client.Encrypted
dateOfBirthstringYesDate of birth in ISO 8601 format.Encrypted
emailstringYesEmail address of the client.Encrypted
phonestringYesTelephone number of the client.Encrypted
genderstringYesGender of the client.Encrypted
addressAddressYesNested Address object with location details.Encrypted

Implementation Guidelines

  1. Optional Fields:

All fields in the types are optional. Ensure that the application logic treats unspecified fields appropriately and provides graceful handling or defaults as necessary.

  1. Validation:
  • For email fields, implement standard email format validation.
  • For phone fields, consider validating based on the international phone number format.
  • For dateOfBirth, ensure the format is strictly verified and logically valid (e.g., not future-dated).
  1. Security and Privacy:

Securely store sensitive information such as personal details, especially email, phone, and address.

  1. Security and Privacy:

Respect privacy laws applicable to the user's data jurisdiction, such as GDPR in Europe or CCPA in California, which govern the handling of personal information.

Example Usage in API

Example JSON payload for creating a new client, demonstrating encryption:

{
  "client": {
    "firstname": "John",
    "lastname": "Doe",
    "dateOfBirth": "1990-05-15",
    "email": "john.doe@example.com",
    "phone": "+1234567890",
    "gender": "male",
    "address": {
      "city": "San Francisco",
      "state": "CA",
      "zip": "94105",
      "country": "USA"
    }
  }
}

Reference Documentation for Product Data Type

Overview

This document outlines the structure for the Product data type, utilized in systems like e-commerce platforms, inventory management systems, and other applications that require detailed product information.

Product Type Definition

Describes the details of products, including identifiers, pricing, and classification.

Fields Description

FieldTypeOptionalDescription
idstringNoUnique identifier for the product.
namestringNoName of the product.
pricenumberNoCost of one unit of the product.
currencystringNoCurrency in which the price is expressed (e.g., USD, EUR).
quantitynumberYesNumber of units available or in the order.
skustringYesStock Keeping Unit; unique inventory identifier.
categorystringYesCategory of the product.
brandstringYesBrand of the product.
imagestringYesURL or path to an image of the product.

Implementation Guidelines

  1. Required vs. Optional Fields:

    • Fields id, name, price, currency, and quantity are mandatory.
    • Fields sku, category, brand, and image are optional and should be included when relevant.
  2. Validation:

    • ID: Ensure uniqueness.
    • Price: Must be a non-negative number.
    • Currency: Validate based on standard currency codes.
    • SKU: Should be unique if provided.
    • Image URLs: Should be valid and accessible.
  3. API Use:

    • Secure endpoints that expose product data.
    • Include comprehensive API documentation outlining field values and examples.

Example Usage

An example JSON representation of a Product:

{
  "id": "prod123",
  "name": "Wireless Mouse",
  "price": 25.99,
  "currency": "USD",
  "quantity": 100,
  "sku": "WM12345",
  "category": "Electronics",
  "brand": "TechGadget",
  "image": "https://example.com/images/wireless-mouse.jpg"
}

Reference Documentation for Order Data Type

Overview

This document specifies the Order data type used for managing and recording transactions in systems such as e-commerce platforms, point of sale systems, and inventory management software. The structure captures all essential aspects of an order transaction.

Order Type Definition

The Order data type holds data related to a customer's order, including identification, total pricing, and product details included in the order.

Fields Description

FieldTypeOptionalDescription
idstringNoUnique identifier for the order.
totalnumberYesThe total cost of the order.
currencystringYesThe currency in which the total cost is expressed (e.g., USD, EUR).
productsArrayYesA list of products included in the order.
taxnumberYesThe value of payed taxes.
shippingFeesnumberYesThe value of shipping fees.
discountnumberYesValue of discount.
discountCodestringYesUsed discount code.

Details of Embedded Type Product

Refer to product data type documentation.

  1. Order Validation:

    • Ensure the id is unique across the order management system.
    • Validate total to reflect the sum of products included, considering their price and quantity.
    • Confirm currency consistency across total and all Product prices, or implement accurate currency conversion methods.
  2. Data Integrity:

    • Ensure that product details are accurate and correspond with the current catalog data at the time of the order.
    • Handle changes in product availability or price adjustments efficiently.

Example Usage

An example JSON representation of an Order:

{
  "id": "order123",
  "total": 299.99,
  "currency": "USD",
  "products": [
    {
      "id": "prod001",
      "name": "Bluetooth Keyboard",
      "price": 59.99,
      "currency": "USD",
      "quantity": 1,
      "sku": "BK987",
      "category": "Electronics",
      "brand": "KeyTech",
      "image": "https://example.com/images/keyboard.jpg"
    },
    {
      "id": "prod002",
      "name": "Wireless Mouse",
      "price": 24.99,
      "currency": "USD",
      "quantity": 2,
      "sku": "WM123",
      "category": "Electronics",
      "brand": "ClickPlus",
      "image": "https://example.com/images/mouse.jpg"
    }
  ]
}

Events types

EventDescription
SearchUser initiates a search, indicating interest or need for specific information, products, or services.
Category ViewedUser browses a specific category, which could be a product category, content type, or service grouping.
Product ViewedUser views details of a product, plan, or piece of content. Includes viewing pages for services or software features.
Add to WishlistUser saves items or content to a personal list for later review or purchase, applicable for products or saving content like articles or videos.
View WishlistUser reviews items or content saved in their wishlist, signifying ongoing interest.
Remove from WishlistUser removes items or content from their wishlist, indicating a change in preference or interest.
Product AddedUser adds a product, subscription plan, or paid content to their cart, showing intent to purchase or subscribe.
Cart ViewedUser views their cart or list of intended purchases, reviewing chosen items before final actions.
Remove from CartUser removes an item from their cart, reflecting a change in decision regarding a potential purchase.
Cart UpdatedUser changes the quantity or selection of items in the cart, adjusting their intended purchase details.
Checkout StartedUser begins the checkout process, indicating readiness to finalize a purchase or subscription.
Payment Add Contact InfoUser enters contact information during the checkout process, necessary for processing the transaction or for communication.
Payment Add Shipping InfoUser adds shipping information, relevant for physical goods delivery or geographical service personalization.
Payment Add Address InfoUser provides billing or service address details, crucial for invoicing and service provision.
Payment Info EnteredUser inputs payment details, a critical step towards transaction completion.
Order CompletedUser successfully completes an order or subscription, resulting in a transaction or engagement agreement.
SubscriptionUser subscribes to a service or content platform, initiating a recurring relationship or continuous access.
Subscription UpdatedUser modifies their subscription details or preferences, which may involve changing the plan level, altering features, or updating personal information.
Subscription CancelledUser terminates their subscription, ending their recurring access or membership.
Subscription RenewedUser's subscription is automatically or manually renewed, extending their access and terms under the existing agreement.
Order UpdatedChanges made to an existing order post-purchase, which could involve modifications to subscriptions or service terms.
Order CancelledUser cancels an order or subscription, discontinuing the purchase or service relationship.
NewsletterUser subscribes to a newsletter, indicating interest in regular updates, news, or promotional content.
LeadUser shows potential interest in a service or product, often through a form submission or a trial request, initiating a sales lead.
Contact Form SubmittedUser submits a query or feedback via contact forms, important for user support and engagement.
LoginUser logs into their account, initiating access to personalized services, content, or account management.
LogoutUser logs out of their account, ending their current session securely.
1.0.32

1 year ago

1.0.31

1 year ago

1.0.29

1 year ago

1.0.30

1 year ago

1.0.28

1 year ago

1.0.27

1 year ago

1.0.26

1 year ago

1.0.25

1 year ago

1.0.24

1 year ago

1.0.23

1 year ago

1.0.22

1 year ago

1.0.19

1 year ago

1.0.18

1 year ago

1.0.16

1 year ago

1.0.21

1 year ago

1.0.20

1 year ago

1.0.15

1 year ago

1.0.14

1 year ago

1.0.13

1 year ago

1.0.12

1 year ago

1.0.11

1 year ago

1.0.10

1 year ago

1.0.9

1 year ago

1.0.8

1 year ago