@yuno-payments/dashboard-api-mfe 2.7.1 → 2.9.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,11 +1,10 @@
1
1
  /**
2
- * Tests for the FEATURE_FLAGS_PROVIDER kill-switch in feature-flags/index.ts.
2
+ * Tests for the feature-flags/index.ts routing.
3
3
  *
4
- * The switch resolves at module-load time, so each test isolates a fresh
5
- * module instance via `jest.isolateModules` after re-stubbing the env var.
6
- *
7
- * `require()` is used inside `isolateModules` because that API is the
8
- * synchronous CJS entry point Jest exposes for re-loading modules under
9
- * a mutated env. ESM `import()` would be evaluated asynchronously outside
10
- * the isolated scope and break the test contract.
4
+ * As of v2.7.2 the switch is hardcoded to datadog (see
5
+ * `src/utils/feature-flags-provider.ts`). The legacy hooks file is kept
6
+ * around for a one-revert rollback path but is no longer reachable from
7
+ * the public hooks. These tests cover both: the public entry always
8
+ * exposes the datadog impls, and both modules still share the same
9
+ * function shape so a future env-var-driven rollback would Just Work.
11
10
  */
@@ -2,6 +2,8 @@ export declare namespace ConciergeAccess {
2
2
  interface SlackChannels {
3
3
  channel_ids: string[];
4
4
  dm_user_ids: string[];
5
+ channel_names?: string[];
6
+ dm_user_emails?: string[];
5
7
  }
6
8
  interface WhatsappChannels {
7
9
  group_ids: string[];
@@ -25,6 +27,7 @@ export declare namespace ConciergeAccess {
25
27
  day_of_month: string;
26
28
  delivery_time: string;
27
29
  content: string;
30
+ preferred_language?: string;
28
31
  }
29
32
  interface HeartbeatConfig {
30
33
  merchant_id: string;
@@ -1,3 +1,6 @@
1
+ /**
2
+ * @deprecated Use ConversionRateBody directly — all fields have been merged into the body.
3
+ */
1
4
  export interface ConversionRateParams {
2
5
  start_date: string;
3
6
  end_date: string;
@@ -11,9 +14,24 @@ export interface ConversionRateParams {
11
14
  payment_statuses: string;
12
15
  card_brand: string;
13
16
  }
17
+ /**
18
+ * Full body sent to datalake-ms /v3/insights/conversion-rate/* endpoints.
19
+ * All filters are in the request body; no query params are used.
20
+ */
14
21
  export interface ConversionRateBody {
15
22
  account_codes: string[];
16
- connection_name: string[];
23
+ start_date?: string;
24
+ end_date?: string;
25
+ periodicity?: string;
26
+ timezone?: string;
27
+ currency_codes?: string[];
28
+ payment_method_types?: string[];
29
+ provider_ids?: string[];
30
+ payment_statuses?: string[];
31
+ connection_name?: string[];
32
+ card_brand?: string[];
33
+ source?: string;
34
+ new_version?: boolean;
17
35
  }
18
36
  export interface ConversionRatePeriodicityRecord {
19
37
  [key: string]: number;
@@ -1,5 +1,5 @@
1
1
  export declare namespace DataReport {
2
- export enum InsightsVolumeMetricsV2Path {
2
+ enum InsightsVolumeMetricsV2Path {
3
3
  REFUNDS_AND_CHARGEBACKS = "refunds-and-chargebacks",
4
4
  APPROVED_PAYMENTS = "approved-payments",
5
5
  PAYMENT_METHODS = "payment-methods",
@@ -11,7 +11,7 @@ export declare namespace DataReport {
11
11
  CARD_BRANDS = "card-brands",
12
12
  ISSUERS = "issuers"
13
13
  }
14
- export interface SmartRouting {
14
+ interface SmartRouting {
15
15
  version: string;
16
16
  code_integration: string;
17
17
  Conditions: {
@@ -24,7 +24,7 @@ export declare namespace DataReport {
24
24
  cost: number;
25
25
  }[];
26
26
  }
27
- export enum OverviewMetricType {
27
+ enum OverviewMetricType {
28
28
  GENERAL = "volume-and-total-payments",
29
29
  LATENCY = "provider-latency",
30
30
  STATUS = "status",
@@ -41,30 +41,69 @@ export declare namespace DataReport {
41
41
  conditional: string;
42
42
  values: string | string[];
43
43
  }
44
- export interface InsightMetricParams {
44
+ interface InsightMetricParams {
45
45
  [a: string]: string | boolean | number | string[] | MetadataField[] | undefined;
46
46
  account_code?: string;
47
47
  connection_name?: string;
48
48
  stored_credentials_usage?: string;
49
49
  metadata?: MetadataField[];
50
50
  }
51
- export interface InsightMetricBody {
51
+ /**
52
+ * Full body shape expected by the BFF / datalake-ms for /insights/* endpoints.
53
+ * All filters are sent as JSON body (no query params).
54
+ */
55
+ interface InsightMetricBody {
56
+ organization_code?: string;
52
57
  account_codes?: string[];
58
+ /** @deprecated use account_codes */
53
59
  account_code?: string[];
60
+ start_date?: string;
61
+ end_date?: string;
62
+ timezone?: string;
63
+ periodicity?: string;
64
+ currency_codes?: string[];
65
+ payment_method_types?: string[];
66
+ provider_ids?: string[];
67
+ payment_statuses?: string[];
68
+ card_types?: string[];
69
+ condition_set_ids?: string[];
70
+ card_country_code?: string[];
71
+ card_iins?: string[];
72
+ stored_credentials_usage?: string[];
73
+ card_brand?: string[];
54
74
  connection_name?: string[];
75
+ country?: string[];
76
+ authentication_method?: string[];
77
+ nts?: string[];
78
+ attempts?: string[];
79
+ has_cvv?: string[];
80
+ bin?: string;
81
+ brand?: string;
82
+ card_type?: string;
83
+ issuer_name?: string;
84
+ decline_reason?: string;
85
+ chargebacks_filtered_date?: string;
86
+ size?: number;
87
+ page?: number;
88
+ export?: boolean;
89
+ sorted_params?: {
90
+ field: string;
91
+ order: string;
92
+ };
55
93
  metadata_filters?: MetadataFieldFilter[];
56
94
  metadata?: MetadataField[];
95
+ source?: string;
96
+ new_version?: boolean;
57
97
  }
58
- export interface InsightExportParams {
98
+ interface InsightExportParams {
59
99
  type?: string;
60
100
  code?: string;
61
101
  }
62
- export interface InsightsHomeMetrics {
102
+ interface InsightsHomeMetrics {
63
103
  account_codes?: string[];
64
104
  organization_code?: string;
65
105
  currency_code?: string;
66
106
  timezone?: string;
67
107
  isLiveMode?: boolean;
68
108
  }
69
- export {};
70
109
  }
@@ -11,9 +11,26 @@ export interface InsightsFraudParams {
11
11
  payment_statuses: string;
12
12
  card_brand: string;
13
13
  }
14
+ /**
15
+ * Body shape sent to datalake-ms /insights/* endpoints.
16
+ * account_codes and connection_name are the legacy body fields; additional
17
+ * filter fields (plural array names) come from merging InsightsFraudParams
18
+ * inside each api method.
19
+ */
14
20
  export interface InsightsFraudBody {
15
21
  account_codes: string[];
16
22
  connection_name: string[];
23
+ start_date?: string;
24
+ end_date?: string;
25
+ periodicity?: string;
26
+ timezone?: string;
27
+ currency_codes?: string[];
28
+ payment_method_types?: string[];
29
+ provider_ids?: string[];
30
+ payment_statuses?: string[];
31
+ card_brand?: string[];
32
+ source?: string;
33
+ new_version?: boolean;
17
34
  }
18
35
  export interface PeriodicityRecord {
19
36
  [key: string]: number;
@@ -1,21 +1,21 @@
1
1
  /**
2
- * Feature-flag provider switch (kill-switch for DAS-15798 migration).
2
+ * Feature-flag provider switch (DAS-15798 migration).
3
3
  *
4
- * Set via the `FEATURE_FLAGS_PROVIDER` build env var (inlined at build
5
- * time by rspack DefinePlugin). Defaults to 'legacy' (the in-house Go
6
- * service via React Query). Flip to 'datadog' once the Datadog Feature
7
- * Flags integration is bootstrapped by container-mfe.
4
+ * Hardcoded to 'datadog' as of v2.7.2. The env-var-based switch
5
+ * (`FEATURE_FLAGS_PROVIDER`) is gone: api-mfe queries always route to
6
+ * `./datadog-hooks`, and `dashboard-container-mfe`'s bootstrap effect
7
+ * (which checks this function) always proceeds to set up the
8
+ * OpenFeature Datadog provider.
8
9
  *
9
- * Read by `src/queries/feature-flags/index.ts` to route hook consumers
10
- * between `./datadog-hooks` and `./legacy-hooks`. Also re-exported from
11
- * the package public API so `dashboard-container-mfe` can read the same
12
- * inlined value to gate its Datadog OpenFeature bootstrap single
13
- * source of truth across both MFEs.
10
+ * The function and type are kept around (instead of inlining the
11
+ * constant) so:
12
+ * 1. Consumers like container-mfe don't need a code change.
13
+ * 2. Rollback to the legacy hooks (revert this file + republish) stays
14
+ * a single-file change.
14
15
  *
15
- * Rollback path: flip the env var and rebuild/redeploy api-mfe
16
- * (~5–10 min). No code revert needed.
17
- *
18
- * Delete this file (and the legacy hooks branch) after Phase 4 soak.
16
+ * Once we're confident no rollback is needed, delete `./legacy-hooks`,
17
+ * delete this file, and inline the datadog branch in
18
+ * `queries/feature-flags/index.ts` (Phase 5 cleanup).
19
19
  */
20
20
  export type FeatureFlagsProvider = 'datadog' | 'legacy';
21
21
  export declare function getFeatureFlagsProvider(): FeatureFlagsProvider;
@@ -9,3 +9,4 @@ export * from './websockets';
9
9
  export * from './utils';
10
10
  export { getFeatureFlagsProvider, type FeatureFlagsProvider, } from './utils/feature-flags-provider';
11
11
  export { emitExpired, resetExpiredGuard, SESSION_EXPIRED_MESSAGE_TYPE, } from './lib/session-expired';
12
+ export { OpenFeature } from '@openfeature/web-sdk';
package/build/index.d.ts CHANGED
@@ -4,6 +4,7 @@ import { AxiosInterceptorManager, AxiosRequestConfig, AxiosResponse, AxiosInstan
4
4
  import { Request } from 'express';
5
5
  import * as _tanstack_react_query from '@tanstack/react-query';
6
6
  import { UseMutationResult, UseMutationOptions, UseQueryResult, UseQueryOptions, QueryCache, QueryClient } from '@tanstack/react-query';
7
+ export { OpenFeature } from '@openfeature/web-sdk';
7
8
 
8
9
  declare class Axios {
9
10
  interceptors?: {
@@ -2661,7 +2662,7 @@ declare namespace Team {
2661
2662
  }
2662
2663
 
2663
2664
  declare namespace DataReport {
2664
- export enum InsightsVolumeMetricsV2Path {
2665
+ enum InsightsVolumeMetricsV2Path {
2665
2666
  REFUNDS_AND_CHARGEBACKS = "refunds-and-chargebacks",
2666
2667
  APPROVED_PAYMENTS = "approved-payments",
2667
2668
  PAYMENT_METHODS = "payment-methods",
@@ -2673,7 +2674,7 @@ declare namespace DataReport {
2673
2674
  CARD_BRANDS = "card-brands",
2674
2675
  ISSUERS = "issuers"
2675
2676
  }
2676
- export interface SmartRouting {
2677
+ interface SmartRouting {
2677
2678
  version: string;
2678
2679
  code_integration: string;
2679
2680
  Conditions: {
@@ -2686,7 +2687,7 @@ declare namespace DataReport {
2686
2687
  cost: number;
2687
2688
  }[];
2688
2689
  }
2689
- export enum OverviewMetricType {
2690
+ enum OverviewMetricType {
2690
2691
  GENERAL = "volume-and-total-payments",
2691
2692
  LATENCY = "provider-latency",
2692
2693
  STATUS = "status",
@@ -2703,32 +2704,71 @@ declare namespace DataReport {
2703
2704
  conditional: string;
2704
2705
  values: string | string[];
2705
2706
  }
2706
- export interface InsightMetricParams {
2707
+ interface InsightMetricParams {
2707
2708
  [a: string]: string | boolean | number | string[] | MetadataField[] | undefined;
2708
2709
  account_code?: string;
2709
2710
  connection_name?: string;
2710
2711
  stored_credentials_usage?: string;
2711
2712
  metadata?: MetadataField[];
2712
2713
  }
2713
- export interface InsightMetricBody {
2714
+ /**
2715
+ * Full body shape expected by the BFF / datalake-ms for /insights/* endpoints.
2716
+ * All filters are sent as JSON body (no query params).
2717
+ */
2718
+ interface InsightMetricBody {
2719
+ organization_code?: string;
2714
2720
  account_codes?: string[];
2721
+ /** @deprecated use account_codes */
2715
2722
  account_code?: string[];
2723
+ start_date?: string;
2724
+ end_date?: string;
2725
+ timezone?: string;
2726
+ periodicity?: string;
2727
+ currency_codes?: string[];
2728
+ payment_method_types?: string[];
2729
+ provider_ids?: string[];
2730
+ payment_statuses?: string[];
2731
+ card_types?: string[];
2732
+ condition_set_ids?: string[];
2733
+ card_country_code?: string[];
2734
+ card_iins?: string[];
2735
+ stored_credentials_usage?: string[];
2736
+ card_brand?: string[];
2716
2737
  connection_name?: string[];
2738
+ country?: string[];
2739
+ authentication_method?: string[];
2740
+ nts?: string[];
2741
+ attempts?: string[];
2742
+ has_cvv?: string[];
2743
+ bin?: string;
2744
+ brand?: string;
2745
+ card_type?: string;
2746
+ issuer_name?: string;
2747
+ decline_reason?: string;
2748
+ chargebacks_filtered_date?: string;
2749
+ size?: number;
2750
+ page?: number;
2751
+ export?: boolean;
2752
+ sorted_params?: {
2753
+ field: string;
2754
+ order: string;
2755
+ };
2717
2756
  metadata_filters?: MetadataFieldFilter[];
2718
2757
  metadata?: MetadataField[];
2758
+ source?: string;
2759
+ new_version?: boolean;
2719
2760
  }
2720
- export interface InsightExportParams {
2761
+ interface InsightExportParams {
2721
2762
  type?: string;
2722
2763
  code?: string;
2723
2764
  }
2724
- export interface InsightsHomeMetrics {
2765
+ interface InsightsHomeMetrics {
2725
2766
  account_codes?: string[];
2726
2767
  organization_code?: string;
2727
2768
  currency_code?: string;
2728
2769
  timezone?: string;
2729
2770
  isLiveMode?: boolean;
2730
2771
  }
2731
- export {};
2732
2772
  }
2733
2773
 
2734
2774
  interface InsightsFraudParams {
@@ -2744,9 +2784,26 @@ interface InsightsFraudParams {
2744
2784
  payment_statuses: string;
2745
2785
  card_brand: string;
2746
2786
  }
2787
+ /**
2788
+ * Body shape sent to datalake-ms /insights/* endpoints.
2789
+ * account_codes and connection_name are the legacy body fields; additional
2790
+ * filter fields (plural array names) come from merging InsightsFraudParams
2791
+ * inside each api method.
2792
+ */
2747
2793
  interface InsightsFraudBody {
2748
2794
  account_codes: string[];
2749
2795
  connection_name: string[];
2796
+ start_date?: string;
2797
+ end_date?: string;
2798
+ periodicity?: string;
2799
+ timezone?: string;
2800
+ currency_codes?: string[];
2801
+ payment_method_types?: string[];
2802
+ provider_ids?: string[];
2803
+ payment_statuses?: string[];
2804
+ card_brand?: string[];
2805
+ source?: string;
2806
+ new_version?: boolean;
2750
2807
  }
2751
2808
  interface PeriodicityRecord {
2752
2809
  [key: string]: number;
@@ -2897,6 +2954,9 @@ interface InsightsChargebacksByCardBrand {
2897
2954
  }[];
2898
2955
  }
2899
2956
 
2957
+ /**
2958
+ * @deprecated Use ConversionRateBody directly — all fields have been merged into the body.
2959
+ */
2900
2960
  interface ConversionRateParams {
2901
2961
  start_date: string;
2902
2962
  end_date: string;
@@ -2910,9 +2970,24 @@ interface ConversionRateParams {
2910
2970
  payment_statuses: string;
2911
2971
  card_brand: string;
2912
2972
  }
2973
+ /**
2974
+ * Full body sent to datalake-ms /v3/insights/conversion-rate/* endpoints.
2975
+ * All filters are in the request body; no query params are used.
2976
+ */
2913
2977
  interface ConversionRateBody {
2914
2978
  account_codes: string[];
2915
- connection_name: string[];
2979
+ start_date?: string;
2980
+ end_date?: string;
2981
+ periodicity?: string;
2982
+ timezone?: string;
2983
+ currency_codes?: string[];
2984
+ payment_method_types?: string[];
2985
+ provider_ids?: string[];
2986
+ payment_statuses?: string[];
2987
+ connection_name?: string[];
2988
+ card_brand?: string[];
2989
+ source?: string;
2990
+ new_version?: boolean;
2916
2991
  }
2917
2992
  interface ConversionRatePeriodicityRecord {
2918
2993
  [key: string]: number;
@@ -5632,6 +5707,8 @@ declare namespace ConciergeAccess {
5632
5707
  interface SlackChannels {
5633
5708
  channel_ids: string[];
5634
5709
  dm_user_ids: string[];
5710
+ channel_names?: string[];
5711
+ dm_user_emails?: string[];
5635
5712
  }
5636
5713
  interface WhatsappChannels {
5637
5714
  group_ids: string[];
@@ -5655,6 +5732,7 @@ declare namespace ConciergeAccess {
5655
5732
  day_of_month: string;
5656
5733
  delivery_time: string;
5657
5734
  content: string;
5735
+ preferred_language?: string;
5658
5736
  }
5659
5737
  interface HeartbeatConfig {
5660
5738
  merchant_id: string;
@@ -8399,23 +8477,23 @@ type DatadogEnvironment = 'dev' | 'stg' | 'sb' | 'prod';
8399
8477
  declare function getDatadogEnvironment(): DatadogEnvironment;
8400
8478
 
8401
8479
  /**
8402
- * Feature-flag provider switch (kill-switch for DAS-15798 migration).
8403
- *
8404
- * Set via the `FEATURE_FLAGS_PROVIDER` build env var (inlined at build
8405
- * time by rspack DefinePlugin). Defaults to 'legacy' (the in-house Go
8406
- * service via React Query). Flip to 'datadog' once the Datadog Feature
8407
- * Flags integration is bootstrapped by container-mfe.
8480
+ * Feature-flag provider switch (DAS-15798 migration).
8408
8481
  *
8409
- * Read by `src/queries/feature-flags/index.ts` to route hook consumers
8410
- * between `./datadog-hooks` and `./legacy-hooks`. Also re-exported from
8411
- * the package public API so `dashboard-container-mfe` can read the same
8412
- * inlined value to gate its Datadog OpenFeature bootstrap single
8413
- * source of truth across both MFEs.
8482
+ * Hardcoded to 'datadog' as of v2.7.2. The env-var-based switch
8483
+ * (`FEATURE_FLAGS_PROVIDER`) is gone: api-mfe queries always route to
8484
+ * `./datadog-hooks`, and `dashboard-container-mfe`'s bootstrap effect
8485
+ * (which checks this function) always proceeds to set up the
8486
+ * OpenFeature Datadog provider.
8414
8487
  *
8415
- * Rollback path: flip the env var and rebuild/redeploy api-mfe
8416
- * (~5–10 min). No code revert needed.
8488
+ * The function and type are kept around (instead of inlining the
8489
+ * constant) so:
8490
+ * 1. Consumers like container-mfe don't need a code change.
8491
+ * 2. Rollback to the legacy hooks (revert this file + republish) stays
8492
+ * a single-file change.
8417
8493
  *
8418
- * Delete this file (and the legacy hooks branch) after Phase 4 soak.
8494
+ * Once we're confident no rollback is needed, delete `./legacy-hooks`,
8495
+ * delete this file, and inline the datadog branch in
8496
+ * `queries/feature-flags/index.ts` (Phase 5 cleanup).
8419
8497
  */
8420
8498
  type FeatureFlagsProvider = 'datadog' | 'legacy';
8421
8499
  declare function getFeatureFlagsProvider(): FeatureFlagsProvider;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@yuno-payments/dashboard-api-mfe",
3
- "version": "2.7.1",
3
+ "version": "2.9.0",
4
4
  "types": "build/index.d.ts",
5
5
  "main": "build/cjs/index.js",
6
6
  "module": "build/esm/index.js",