diff --git a/.github/workflows/build-sdk.yml b/.github/workflows/build-sdk.yml index f587c08..3b78c97 100644 --- a/.github/workflows/build-sdk.yml +++ b/.github/workflows/build-sdk.yml @@ -4,29 +4,28 @@ on: pull_request: push: branches: - - master + - master jobs: Build: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 - - uses: actions/setup-node@v2 - with: - node-version: 16 - cache: npm - - uses: actions/cache@v3 - with: - path: node_modules - key: ${{ runner.os }}-node-${{ hashFiles('package-lock.json') }} - restore-keys: | - ${{ runner.os }}-node- + - uses: actions/checkout@v4 + - uses: actions/setup-node@v4 + with: + node-version: 16 + cache: npm + - uses: actions/cache@v4 + with: + path: node_modules + key: ${{ runner.os }}-node-${{ hashFiles('package-lock.json') }} + restore-keys: | + ${{ runner.os }}-node- - - - run: npm install - - run: npm run prettier -- --check - - run: npm run lint - - run: npm run build - - run: npm run test - - run: npm run spellcheck + - run: npm install + - run: npm run prettier -- --check + - run: npm run lint + - run: npm run build + - run: npm run test + - run: npm run spellcheck diff --git a/.github/workflows/integration-tests.yml b/.github/workflows/integration-tests.yml index 2a73550..d3cfd34 100644 --- a/.github/workflows/integration-tests.yml +++ b/.github/workflows/integration-tests.yml @@ -4,41 +4,41 @@ on: pull_request: push: branches: - - master - schedule: - - cron: "0 */6 * * *" # every 6 hours + - master + # schedule: + # - cron: "0 */6 * * *" # every 6 hours jobs: Tests: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 - - uses: actions/setup-node@v2 - with: - node-version: 16 - cache: npm - - uses: actions/cache@v3 - with: - path: | - node_modules - ~/.cache/Cypress - key: ${{ runner.os }}-node-${{ hashFiles('package-lock.json') }} - restore-keys: | - ${{ runner.os }}-node- - - uses: actions/cache@v3 - with: - path: cypress/application/node_modules - key: ${{ runner.os }}-node-${{ hashFiles('cypress/application/package-lock.json') }} - restore-keys: | - ${{ runner.os }}-node- + - uses: actions/checkout@v4 + - uses: actions/setup-node@v4 + with: + node-version: 16 + cache: npm + - uses: actions/cache@v4 + with: + path: | + node_modules + ~/.cache/Cypress + key: ${{ runner.os }}-node-${{ hashFiles('package-lock.json') }} + restore-keys: | + ${{ runner.os }}-node- + - uses: actions/cache@v4 + with: + path: cypress/application/node_modules + key: ${{ runner.os }}-node-${{ hashFiles('cypress/application/package-lock.json') }} + restore-keys: | + ${{ runner.os }}-node- - - run: npm install - - run: npm run test:build - - run: npm run test:integration - env: - CYPRESS_ENVIRONMENT: "${{ github.ref_name == 'master' && 'production' || 'staging' }}" - INTEGRATION_TEST_CLIENT_ID: ${{ secrets.INTEGRATION_TEST_CLIENT_ID }} - INTEGRATION_TEST_API_KEY: ${{ secrets.INTEGRATION_TEST_API_KEY }} - INTEGRATION_TEST_API_HOST: ${{ secrets.INTEGRATION_TEST_API_HOST }} - INTEGRATION_TEST_USER_GUID: ${{ secrets.INTEGRATION_TEST_USER_GUID }} + - run: npm install + - run: npm run test:build + - run: npm run test:integration + env: + CYPRESS_ENVIRONMENT: "${{ github.ref_name == 'master' && 'production' || 'staging' }}" + INTEGRATION_TEST_CLIENT_ID: ${{ secrets.INTEGRATION_TEST_CLIENT_ID }} + INTEGRATION_TEST_API_KEY: ${{ secrets.INTEGRATION_TEST_API_KEY }} + INTEGRATION_TEST_API_HOST: ${{ secrets.INTEGRATION_TEST_API_HOST }} + INTEGRATION_TEST_USER_GUID: ${{ secrets.INTEGRATION_TEST_USER_GUID }} diff --git a/CHANGELOG.md b/CHANGELOG.md index 6f989f9..b64211b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,13 +5,19 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). -## [Unreleased] +## [0.0.14] - 2025-08-01 ### Added +- Support for `additional_product_option` in Connect Widget configuration. +- Support for `use_cases` in Connect Widget configuration. +- Support for `connections_use_case_filter` in Connections Widget configuration. + +## [0.0.13] - 2024-3-11 + ### Changed -### Fixed +- @mxenabled/widget-post-message-definitions to v1.4.0 ## [0.0.12] - 2024-2-12 diff --git a/docs/widget_callback_props.md b/docs/widget_callback_props.md index 378cfd5..d9cf99a 100644 --- a/docs/widget_callback_props.md +++ b/docs/widget_callback_props.md @@ -415,7 +415,7 @@ const widget = widgetSdk.ConnectWidget({ - Payload fields: - `user_guid` (`string`) - `session_guid` (`string`) - - `context` (`string`) + - `context` (optional) (`string`)
Click here to view a sample usage of onBackToSearch. @@ -434,3 +434,31 @@ const widget = widgetSdk.ConnectWidget({
+--- +### Invalid data (`mx/connect/invalidData`) + +- Widget callback prop name: `onInvalidData` +- Payload fields: + - `user_guid` (`string`) + - `session_guid` (`string`) + - `member_guid` (`string`) + - `code` (`number`) + +
+Click here to view a sample usage of onInvalidData. + +```javascript +const widget = widgetSdk.ConnectWidget({ + url: "https://widgets.moneydesktop.com/md/connect/...", + + onInvalidData: (payload) => { + console.log(`User guid: ${payload.user_guid}`) + console.log(`Session guid: ${payload.session_guid}`) + console.log(`Member guid: ${payload.member_guid}`) + console.log(`Code: ${payload.code}`) + } +}) +``` + +
+ diff --git a/example/index.html b/example/index.html index ca0ad66..0d67ee8 100644 --- a/example/index.html +++ b/example/index.html @@ -33,10 +33,6 @@ // language: "es", // colorScheme: "dark", // mode: "verification", - // - // Refer to https://docs.mx.com/connect/guides/sdk#react_native_widget_props and - // https://docs.mx.com/connect/guides/sdk#react_native_generating_the_widget_sso_url - // for information on all of the supported properties. onMessage: (event) => { logEvent(event.data) diff --git a/src/sso/widget_configuration.ts b/src/sso/widget_configuration.ts index 9311cea..b7301c2 100644 --- a/src/sso/widget_configuration.ts +++ b/src/sso/widget_configuration.ts @@ -65,6 +65,7 @@ export type WidgetConfiguration = { export type ConnectWidgetConfigurationProps = Camelize export type ConnectWidgetConfiguration = WidgetConfiguration & { + additional_product_option?: "account_verification" | "transactions" client_redirect_url?: string current_institution_code?: string current_institution_guid?: string @@ -73,14 +74,26 @@ export type ConnectWidgetConfiguration = WidgetConfiguration & { include_transactions?: boolean mode?: ConnectWidgetMode update_credentials?: boolean + use_cases?: Array<"MONEY_MOVEMENT" | "PFM"> +} + +export type ConnectionsWidgetConfigurationProps = Camelize +export type ConnectionsWidgetConfiguration = WidgetConfiguration & { + additional_product_option?: "account_verification" | "transactions" + connections_use_case_filter?: boolean + use_cases?: Array<"MONEY_MOVEMENT" | "PFM"> } export function getWidgetConfigurationFromProps( - props: ConnectWidgetConfigurationProps & InternalWidgetConfigurationProps, + props: ConnectWidgetConfigurationProps & + InternalWidgetConfigurationProps & + ConnectionsWidgetConfigurationProps, ) { return { + additional_product_option: props.additionalProductOption, client_redirect_url: props.clientRedirectUrl, color_scheme: props.colorScheme, + connections_use_case_filter: props.connectionsUseCaseFilter, // Connections specific current_institution_code: props.currentInstitutionCode, current_institution_guid: props.currentInstitutionGuid, current_member_guid: props.currentMemberGuid, @@ -92,6 +105,7 @@ export function getWidgetConfigurationFromProps( ui_message_version: props.uiMessageVersion || 4, ui_message_webview_url_scheme: props.uiMessageWebviewUrlScheme, update_credentials: props.updateCredentials, + use_cases: props.useCases, widget_type: props.widgetType, } } diff --git a/src/version.ts b/src/version.ts index 6d96416..2084f3b 100644 --- a/src/version.ts +++ b/src/version.ts @@ -4,4 +4,4 @@ * DO NOT MODIFY */ -export const sdkVersion = "0.0.11" +export const sdkVersion = "0.0.13" diff --git a/src/widgets.ts b/src/widgets.ts index ac925eb..21f6e24 100644 --- a/src/widgets.ts +++ b/src/widgets.ts @@ -1,4 +1,10 @@ -import { getSsoUrl, Props as UrlLoadingProps, Type, ConnectWidgetConfigurationProps } from "./sso" +import { + getSsoUrl, + Props as UrlLoadingProps, + Type, + ConnectWidgetConfigurationProps, + ConnectionsWidgetConfigurationProps, +} from "./sso" import { sdkVersion } from "./version" import { @@ -265,7 +271,7 @@ export class ConnectWidget extends Widget< } } -export class ConnectionsWidget extends Widget { +export class ConnectionsWidget extends Widget { get widgetType() { return Type.ConnectionsWidget }