Extend Context
The extendContext action is used to add any additional context, information, or metadata to be used within the widget. This can be used to influence user flows, user logic, and more.
Usage
To extend the context within the widget, call the extendContext method on the widget instance with a second object param:
window._asurion_widget('extendContext', { foo: 'bar' });
The type signature of the extendContext method is as follows
(params: Record<string, unknown>) => void
Examples
Adding new context
The data passed to extendContext will be merged with what currently exists in context.
/*
Existing Context
{
"foo": "bar",
"baz": "foo"
}
*/
window._asurion_widget('extendContext', { extended: true });
/*
Extended context
{
"foo": "bar",
"baz": "foo",
"extended": true
}
*/
Overriding existing context
/*
Existing Context
{
"foo": "bar",
"baz": "foo"
}
*/
window._asurion_widget('extendContext', { foo: undefined });
/*
Extended context
{
"baz": "foo"
}
*/