Introduced InsightsDataProvider and new special logic for insights data inside Widget.
⚠️
until there are Cox users with policies and the ACL is implemented, the InsightsDataProvider won't work unless you use EQWorks/firstorder#687
explanation
multiple widgets with INSIGHTS_DATA data sources should be wrapped in a single instance of InsightsDataProvider that receives a year prop and a month prop (the latter is technically optional in some cases, as some insights data is only refreshed yearly)
these widgets will send a signal to InsightsDataProvider with the insights data name that they require (for example dta_dealertrack_deals, or visitor_visitation, or dta_census, etc.
the InsightsDataProvider combines this information from its children with the current month and/or year to fetch all the requested data and pass it back to each widget. Side benefit is that API requests are deduplicated if there is more than one widget that requests the same data.
I've created+used widgets with the following IDs to demonstrate the new functionality: 100056, 100057, 100058, and 100084. These are copies of 56, 57, 58 and 84 respectively with the only difference being that the data source has changed from something like this:
so, the idea is that the widget config itself is generic therefore widget 100084 can be used in the same dashboard for all dealers -- InsightsDataProvider and firstorder take care of adding the dynamic aspects (attaching the month/year and dealer ID).
Introduced
InsightsDataProvider
and new special logic for insights data insideWidget
.⚠️
until there are Cox users with policies and the ACL is implemented, the
InsightsDataProvider
won't work unless you use EQWorks/firstorder#687explanation
INSIGHTS_DATA
data sources should be wrapped in a single instance ofInsightsDataProvider
that receives ayear
prop and amonth
prop (the latter is technically optional in some cases, as some insights data is only refreshed yearly)InsightsDataProvider
with the insights data name that they require (for exampledta_dealertrack_deals
, orvisitor_visitation
, ordta_census
, etc.InsightsDataProvider
combines this information from its children with the currentmonth
and/oryear
to fetch all the requested data and pass it back to each widget. Side benefit is that API requests are deduplicated if there is more than one widget that requests the same data.Note that firstorder automatically scopes the data to the dealer ID embedded in the user's
access
object.explanation of the
InsightsDataProvider
storyI've created+used widgets with the following IDs to demonstrate the new functionality:
100056
,100057
,100058
, and100084
. These are copies of56
,57
,58
and84
respectively with the only difference being that the data source has changed from something like this:to something like this:
so, the idea is that the widget config itself is generic therefore widget
100084
can be used in the same dashboard for all dealers --InsightsDataProvider
andfirstorder
take care of adding the dynamic aspects (attaching the month/year and dealer ID).