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[];
    subscriptions: Subscription[];
}

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

Type declaration

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

A mapping of order item public IDs to discount codes

Type declaration

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.

    Defaults

    https://api.ordergroove.com

  • lego_api: string

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

    Default

    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.

    Default

    https://offers.ordergroove.com

  • tracking_url: string

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

    Default

    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

Type declaration

  • [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;
            };
        };
    }
    • initial: {
          shipping: {
              max_amount: number;
              max_percent: number;
          };
          subtotal: {
              max_amount: number;
              max_percent: number;
          };
          total: {
              max_amount: number;
              max_percent: number;
          };
      }
      • shipping: {
            max_amount: number;
            max_percent: number;
        }
        • max_amount: number
        • max_percent: number
      • subtotal: {
            max_amount: number;
            max_percent: number;
        }
        • max_amount: number
        • max_percent: number
      • total: {
            max_amount: number;
            max_percent: number;
        }
        • 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;
          };
      }
      • shipping: {
            max_amount: number;
            max_percent: number;
        }
        • max_amount: number
        • max_percent: number
      • subtotal: {
            max_amount: number;
            max_percent: number;
        }
        • max_amount: number
        • max_percent: number
      • total: {
            max_amount: number;
            max_percent: number;
        }
        • max_amount: number
        • max_percent: number
items_by_order: {
    [key: string]: OrderItem[];
}

Type declaration

Deprecated

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

Default

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

Type declaration

Deprecated

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

Type declaration

  • [key: string]: string
order_item_by_id: {
    [key: string]: OrderItem[];
}

Type declaration

Deprecated

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;
}

Type declaration

Deprecated

products: Product[]

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

subscriptions: Subscription[]

A list of all of the customer's subscriptions.