• Add a entry to the SM notifications state. In the default template, this will show a toast notification to the user.

    Parameters

    • message: string

      The message to display in the notification. This can also be a locale key, e.g. "cancel_subscription_success". The default notifications.liquid implementation will attempt to look up the entry for the key in the notifications locale object.

    • options: {
          target?: any;
          type?: "error" | "success";
      } = ...
      • Optional target?: any

        An optional target object related to the notification. This can be used to make the locale entry dynamic, e.g. notify('change_one_time_quantity_success', { target: { quantity: 3 } })

      • Optional type?: "error" | "success"

        The type of notification, either 'error' or 'success'. Defaults to 'success'.

    Returns void

    Example

    og.smi.notify('Your subscription has been updated successfully.', { type: 'success' });
    og.smi.notify('There was an error updating your subscription.', { type: 'error' });
    og.smi.notify('cancel_subscription_success');
    og.smi.notify('change_one_time_quantity_success', { target: { quantity: 3 } });