Subscription Manager
    Preparing search index...

    Interface State

    The Redux state contains all the objects available in the Subscription Manager templates.

    interface State {
        addresses: Address[];
        auth_url?: string;
        customer: Customer;
        discount_codes_by_order_id: { [orderId: string]: DiscountCode[] };
        discount_codes_by_subscription_id: {
            [subscriptionId: string]: DiscountCode[];
        };
        environment: {
            api_url: string;
            lego_api: string;
            name: "staging"
            | "prod";
            offers_url: string;
            tracking_url: string;
        };
        incentives_by_product_id: {
            [key: string]: {
                initial: {
                    shipping: { max_amount: number; max_percent: number };
                    subtotal: { max_amount: number; max_percent: number };
                    total: { max_amount: number; max_percent: number };
                };
                ongoing: {
                    shipping: { max_amount: number; max_percent: number };
                    subtotal: { max_amount: number; max_percent: number };
                    total: { max_amount: number; max_percent: number };
                };
            };
        };
        items_by_order: { [key: string]: OrderItem[] };
        loading: boolean;
        locale: string;
        localized_product_by_id: { [key: string]: Product };
        merchant_id: string;
        notifications: Notification[];
        offer_by_product_id: { [key: string]: string };
        order_item_by_id: { [key: string]: OrderItem[] };
        order_items: OrderItem[];
        orders: Order[];
        payments: Payment[];
        product_by_id: { [key: string]: Product };
        products: Product[];
        retention_incentives: {
            default_retention_incentive: RetentionIncentiveTemplate;
            incentive_templates: RetentionIncentiveTemplate[];
        };
        subscriptions: Subscription[];
    }
    Index

    Properties

    addresses: Address[]

    A list of all customer addresses pulled into the state

    auth_url?: string

    Defaults to empty string forcing the smi handles the auth via cookie.

    For ajax or iframe styles, auth_url points to an actual merchant url

    customer: Customer

    This object represents the current customer who is logged into your site that is viewing the SMI

    discount_codes_by_order_id: { [orderId: string]: DiscountCode[] }

    A mapping of order public IDs to discount codes

    discount_codes_by_subscription_id: { [subscriptionId: string]: DiscountCode[] }

    A mapping of order item public IDs to discount codes

    environment: {
        api_url: string;
        lego_api: string;
        name: "staging" | "prod";
        offers_url: string;
        tracking_url: string;
    }

    This object represents the environment that the application is currently running in. You typically will not need to interact with this object unless you're instructed to by an Ordergroove representative.

    Type Declaration

    • api_url: string

      URL of the legacy Ordergroove API cluster that the SMI is using to retrieve data.

      https://api.ordergroove.com

    • lego_api: string

      URL of the Ordergroove REST API cluster that the SMI is using to retrieve data.

      https://restapi.ordergroove.com

    • name: "staging" | "prod"

      The name of the Ordergroove environment where the SMI is currently running.

    • offers_url: string

      URL of the Ordergroove offer endpoint that the SMI is using to fetch offer data.

      https://offers.ordergroove.com

    • tracking_url: string

      URL of the Ordergroove tracking endpoint that handles front-end events.

      https://collect.ordergroove.com

    incentives_by_product_id: {
        [key: string]: {
            initial: {
                shipping: { max_amount: number; max_percent: number };
                subtotal: { max_amount: number; max_percent: number };
                total: { max_amount: number; max_percent: number };
            };
            ongoing: {
                shipping: { max_amount: number; max_percent: number };
                subtotal: { max_amount: number; max_percent: number };
                total: { max_amount: number; max_percent: number };
            };
        };
    }

    A mapping of external product IDs to max incentives structured by type

    items_by_order: { [key: string]: OrderItem[] }
    loading: boolean

    A flag will be true if SMI is loading content, or false once done

    locale: string

    This value will represent the current locale being set on the website. The value is pulled form the lang attribute of the html node. For example

    en
    
    localized_product_by_id: { [key: string]: Product }
    merchant_id: string

    This value is used to identify you as the merchant and is the same value that you would find under the customer.public_id key above.

    notifications: Notification[]

    A list of popups notifications

    offer_by_product_id: { [key: string]: string }

    A mapping of external product IDs to offer IDs

    order_item_by_id: { [key: string]: OrderItem[] }
    order_items: OrderItem[]

    A list of all customer order items pulled into the state

    orders: Order[]

    This array represents the list of all of the customer's orders.

    payments: Payment[]

    A list of all customer payments pulled into the state

    product_by_id: { [key: string]: Product }
    products: Product[]

    A list of products pulled into the state for current subscriptions and order items

    retention_incentives: {
        default_retention_incentive: RetentionIncentiveTemplate;
        incentive_templates: RetentionIncentiveTemplate[];
    }

    A list of retention incentives that the customer is eligible for

    subscriptions: Subscription[]

    A list of all of the customer's subscriptions.