navigateToPage

Relevant to all supported platforms.

Description

An action event. When the user clicks on a navigation button within the Personetics widget, the navigateToPage function in the eventDelegate object will be invoked. The widget will pass the context required for the navigation action, to the navigateToPage function. The navigate target key can be mapped to one of the following:

  • manage-budgets – requires opening a new manage-budgets widgets
  • subscriptions – requires opening a new subscription-widget
  • subscriptionView – requires opening a new subscription-widget
  • Open banking widgets - supported only for web layout:
    • obOnboarding – requires opening a new open banking onboarding widget
    • obManagement - requires opening a new open banking management widget

Return value - None

Example of navigateToPage for web layout:

    this.navigateToPage = function (params) {
        Personetics.log("Customer : navigateToPage, Params : " + JSON.stringify(params));

        const { widgetSelector, data: { navigateTarget, isActiveWidget } = {} } = params;
        const appConfig = window.personetics.config[widgetSelector];

        const channel = personetics.withWidget({ widgetSelector }, () => personetics.getDeviceType());

        switch (channel) {
            case "web": {
                const navigateTargetToWidgetTypeMapping = {
                    manageBudget: "manage-budgets",
                    subscriptions: "subscription-dashboard",
                    recap: "recap",
                    actOnboarding: "actOnboarding",
                    actManagement: "actManagement",
                    obOnboarding: "obOnboarding",
                    obManagement: "obManagement",
                };

                if (Object.prototype.hasOwnProperty.call(navigateTargetToWidgetTypeMapping, navigateTarget) || isActiveWidget) {
                    const widgetType = isActiveWidget ? "activeWidget" : navigateTargetToWidgetTypeMapping[navigateTarget];
                    const startWidgetConfig = $.extend(true, appConfig, {
                        configurations: {
                            widgetType,
                            params: {
                                userId: params.userId,
                                insightId: params.insightId,
                                instanceId: params.instanceId,
                                useCaseId: params.useCaseId,
                                params: params.data.payload,
                                navigateTarget,
                            },
                        },
                        internationalization: {
                            language: params.lang,
                        },
                    });

                    if (this.isPayload === "true") {
                        // note that the getInsightDetails was declared in predefinedData.js
                        startWidgetConfig.configurations.params.payload = {
                            GET_BUDGETS_CATEGORIES: window.getBudgetsCategories,
                        };
                    }

                    // Customer will implement his own widgets call stack.
                    personetics.widgetsCallStack[widgetSelector] = personetics.widgetsCallStack[widgetSelector] ?? [];
                    personetics.widgetsCallStack[widgetSelector].push(appConfig.widgetType);

                    personetics.startWidget(startWidgetConfig);
                }

                break;
            }

            default: {
                this.sendRequestToPServer(null, params);

                break;
            }
        }
    };

Web Layout Params

These Parameters are relevant for the following layouts:

  • Web Vanilla JS
  • Web React JS
  • Web Angular JS
NameTypeMandatoryDescription
params_mapMapYesAdditional information to be accompanied with navigation - e.g: {navigateTarget: link_ID}
manageBudgetStringOptionalNavigate to the budget widget
subscriptionsStringOptionalNavigate to subscriptions widget
recapStringOptionalNavigate to Recap Widget
actOnboardingStringOptionalNavigate to ACT onboarding widget
actManagementStringOptionalNavigate to ACT management widget
obManagementStringOptionalNavigate to open banking onboarding widget
obOnboardingStringOptionalNavigate to open banking management widget

Mobile Layout Params

iOS Swift, Android, React Native

NameTypeMandatoryDescription
params_mapMapYesAdditional information to be accompanied with navigation - e.g: {navigateTarget: link_ID}
manageBudgetStringOptionalNavigate to the budget widget
subscriptionsStringOptionalNavigate to subscriptions widget
recapStringOptoinalNavigate to Recap Widget
actOnboardingStringOptionalNavigate to onboarding widget
actManagementStringOptionalNavigate to management widget

Flutter Parameters

NameTypeMandatoryDescription
contextBuildContextYesThe build context of the webView widget.
requestBodyParamsMap<String, dynamic>YesRequest body to be sent to Personetics server