@oursprivacy/platform-sdk 1.22.0 → 1.24.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.
Files changed (95) hide show
  1. package/CHANGELOG.md +17 -0
  2. package/README.md +17 -14
  3. package/client.d.mts +12 -9
  4. package/client.d.mts.map +1 -1
  5. package/client.d.ts +12 -9
  6. package/client.d.ts.map +1 -1
  7. package/client.js +6 -3
  8. package/client.js.map +1 -1
  9. package/client.mjs +6 -3
  10. package/client.mjs.map +1 -1
  11. package/package.json +1 -1
  12. package/resources/allowed-events.d.mts +206 -5
  13. package/resources/allowed-events.d.mts.map +1 -1
  14. package/resources/allowed-events.d.ts +206 -5
  15. package/resources/allowed-events.d.ts.map +1 -1
  16. package/resources/allowed-events.js +48 -4
  17. package/resources/allowed-events.js.map +1 -1
  18. package/resources/allowed-events.mjs +48 -4
  19. package/resources/allowed-events.mjs.map +1 -1
  20. package/resources/consent-analytics.d.mts +57 -0
  21. package/resources/consent-analytics.d.mts.map +1 -0
  22. package/resources/consent-analytics.d.ts +57 -0
  23. package/resources/consent-analytics.d.ts.map +1 -0
  24. package/resources/consent-analytics.js +22 -0
  25. package/resources/consent-analytics.js.map +1 -0
  26. package/resources/consent-analytics.mjs +18 -0
  27. package/resources/consent-analytics.mjs.map +1 -0
  28. package/resources/consent-settings.d.mts +198 -1
  29. package/resources/consent-settings.d.mts.map +1 -1
  30. package/resources/consent-settings.d.ts +198 -1
  31. package/resources/consent-settings.d.ts.map +1 -1
  32. package/resources/consent-settings.js +40 -0
  33. package/resources/consent-settings.js.map +1 -1
  34. package/resources/consent-settings.mjs +40 -0
  35. package/resources/consent-settings.mjs.map +1 -1
  36. package/resources/data-governance.d.mts +793 -0
  37. package/resources/data-governance.d.mts.map +1 -0
  38. package/resources/data-governance.d.ts +793 -0
  39. package/resources/data-governance.d.ts.map +1 -0
  40. package/resources/data-governance.js +70 -0
  41. package/resources/data-governance.js.map +1 -0
  42. package/resources/data-governance.mjs +66 -0
  43. package/resources/data-governance.mjs.map +1 -0
  44. package/resources/default-mappings.d.mts +60 -3
  45. package/resources/default-mappings.d.mts.map +1 -1
  46. package/resources/default-mappings.d.ts +60 -3
  47. package/resources/default-mappings.d.ts.map +1 -1
  48. package/resources/destinations.d.mts +7 -7
  49. package/resources/destinations.d.mts.map +1 -1
  50. package/resources/destinations.d.ts +7 -7
  51. package/resources/destinations.d.ts.map +1 -1
  52. package/resources/index.d.mts +5 -4
  53. package/resources/index.d.mts.map +1 -1
  54. package/resources/index.d.ts +5 -4
  55. package/resources/index.d.ts.map +1 -1
  56. package/resources/index.js +5 -3
  57. package/resources/index.js.map +1 -1
  58. package/resources/index.mjs +2 -1
  59. package/resources/index.mjs.map +1 -1
  60. package/resources/mappings.d.mts +174 -15
  61. package/resources/mappings.d.mts.map +1 -1
  62. package/resources/mappings.d.ts +174 -15
  63. package/resources/mappings.d.ts.map +1 -1
  64. package/resources/sources.d.mts +213 -45
  65. package/resources/sources.d.mts.map +1 -1
  66. package/resources/sources.d.ts +213 -45
  67. package/resources/sources.d.ts.map +1 -1
  68. package/resources/sources.js +18 -7
  69. package/resources/sources.js.map +1 -1
  70. package/resources/sources.mjs +18 -7
  71. package/resources/sources.mjs.map +1 -1
  72. package/src/client.ts +60 -27
  73. package/src/resources/allowed-events.ts +232 -4
  74. package/src/resources/consent-analytics.ts +76 -0
  75. package/src/resources/consent-settings.ts +272 -0
  76. package/src/resources/data-governance.ts +1091 -0
  77. package/src/resources/default-mappings.ts +60 -3
  78. package/src/resources/destinations.ts +9 -2
  79. package/src/resources/index.ts +27 -12
  80. package/src/resources/mappings.ts +174 -15
  81. package/src/resources/sources.ts +337 -88
  82. package/src/version.ts +1 -1
  83. package/version.d.mts +1 -1
  84. package/version.d.ts +1 -1
  85. package/version.js +1 -1
  86. package/version.mjs +1 -1
  87. package/resources/global-dispatch-centers.d.mts +0 -349
  88. package/resources/global-dispatch-centers.d.mts.map +0 -1
  89. package/resources/global-dispatch-centers.d.ts +0 -349
  90. package/resources/global-dispatch-centers.d.ts.map +0 -1
  91. package/resources/global-dispatch-centers.js +0 -43
  92. package/resources/global-dispatch-centers.js.map +0 -1
  93. package/resources/global-dispatch-centers.mjs +0 -39
  94. package/resources/global-dispatch-centers.mjs.map +0 -1
  95. package/src/resources/global-dispatch-centers.ts +0 -458
@@ -66,6 +66,61 @@ export class ConsentSettings extends APIResource {
66
66
  delete(id: string, options?: RequestOptions): APIPromise<ConsentSettingDeleteResponse> {
67
67
  return this._client.delete(path`/rest/v1/consent-settings/${id}`, options);
68
68
  }
69
+
70
+ /**
71
+ * Time-series consent analytics for a single consent settings record: banner
72
+ * views, opt-ins, opt-outs, close-icon clicks, and derived opt-in/out rates per
73
+ * UTC day (or per UTC hour with `granularity=HOURLY`). The window is zero-filled
74
+ * so callers get a contiguous series, and rates are person-level
75
+ * (`COUNT(DISTINCT visitor_id)`). Use the optional `pagePath` and `region` filters
76
+ * to scope to one page or one visitor region; use `compareWithPreviousPeriod=true`
77
+ * to also receive the matching prior window. `DAILY` allows a 90-day window;
78
+ * `HOURLY` is capped at 14 days. Reuses the API-key scope `consentSettings:find`
79
+ * because the endpoint is identified by a consent settings `id`. Requires scope:
80
+ * consentSettings:find
81
+ */
82
+ analytics(
83
+ id: string,
84
+ query: ConsentSettingAnalyticsParams,
85
+ options?: RequestOptions,
86
+ ): APIPromise<ConsentSettingAnalyticsResponse> {
87
+ return this._client.get(path`/rest/v1/consent-settings/${id}/analytics`, { query, ...options });
88
+ }
89
+
90
+ /**
91
+ * Per-page consent breakdown for one consent settings record, ranked by opt-outs
92
+ * (descending). Each row bundles banner views, opt-outs, close-icon clicks, and
93
+ * the derived opt-out rate. Documented exception to the cursor-pagination
94
+ * standard: this is a derived read whose underlying GraphQL contract is
95
+ * offset/limit-based; cursors are not used. `search` is a substring match against
96
+ * `pathname`; `region` filters to one visitor region. Reuses the API-key scope
97
+ * `consentSettings:find`. Requires scope: consentSettings:find
98
+ */
99
+ pageAnalysis(
100
+ id: string,
101
+ query: ConsentSettingPageAnalysisParams,
102
+ options?: RequestOptions,
103
+ ): APIPromise<ConsentSettingPageAnalysisResponse> {
104
+ return this._client.get(path`/rest/v1/consent-settings/${id}/page-analysis`, { query, ...options });
105
+ }
106
+
107
+ /**
108
+ * Region-grouped consent totals for the window: banner views, opt-ins, opt-outs,
109
+ * close-icon clicks, and derived rates per visitor `country_region_name`, ranked
110
+ * by banner views (descending). Visitors whose region cannot be resolved (e.g. bot
111
+ * traffic, IP geo failure) are bucketed under the literal `Unknown` so per-region
112
+ * counts always sum to the global totals. Use this to discover the region names
113
+ * you can later pass to the `region` filter on
114
+ * `GET /rest/v1/consent-settings/{id}/analytics`. Reuses the API-key scope
115
+ * `consentSettings:find`. Requires scope: consentSettings:find
116
+ */
117
+ analyticsByRegion(
118
+ id: string,
119
+ query: ConsentSettingAnalyticsByRegionParams,
120
+ options?: RequestOptions,
121
+ ): APIPromise<ConsentSettingAnalyticsByRegionResponse> {
122
+ return this._client.get(path`/rest/v1/consent-settings/${id}/analytics-by-region`, { query, ...options });
123
+ }
69
124
  }
70
125
 
71
126
  export interface ConsentSettingListResponse {
@@ -2624,6 +2679,115 @@ export namespace ConsentSettingDeleteResponse {
2624
2679
  }
2625
2680
  }
2626
2681
 
2682
+ export interface ConsentSettingAnalyticsResponse {
2683
+ /**
2684
+ * One entry per time bucket (day or hour, depending on `granularity`) covering the
2685
+ * full window — empty windows are zero-filled so callers can render contiguous
2686
+ * time series without gap-handling logic.
2687
+ */
2688
+ items: Array<ConsentSettingAnalyticsResponse.Item>;
2689
+ }
2690
+
2691
+ export namespace ConsentSettingAnalyticsResponse {
2692
+ export interface Item {
2693
+ bannerViews: number;
2694
+
2695
+ closeIconClicks: number;
2696
+
2697
+ dateTime: string;
2698
+
2699
+ explicitOptIns: number;
2700
+
2701
+ explicitOptOuts: number;
2702
+
2703
+ optInRate: number;
2704
+
2705
+ optOutRate: number;
2706
+
2707
+ percentageChangeBannerViews?: number | null;
2708
+
2709
+ percentageChangeCloseIconClicks?: number | null;
2710
+
2711
+ percentageChangeExplicitOptIns?: number | null;
2712
+
2713
+ percentageChangeExplicitOptOuts?: number | null;
2714
+
2715
+ previousBannerViews?: number | null;
2716
+
2717
+ previousCloseIconClicks?: number | null;
2718
+
2719
+ previousExplicitOptIns?: number | null;
2720
+
2721
+ previousExplicitOptOuts?: number | null;
2722
+
2723
+ previousOptInRate?: number | null;
2724
+
2725
+ previousOptOutRate?: number | null;
2726
+ }
2727
+ }
2728
+
2729
+ export interface ConsentSettingPageAnalysisResponse {
2730
+ /**
2731
+ * True when at least one more page is available beyond the current window.
2732
+ */
2733
+ hasMore: boolean;
2734
+
2735
+ /**
2736
+ * Pages with consent activity in the window, ranked by opt-outs (descending). Each
2737
+ * page bundles banner views, opt-outs, close-icon clicks, and the derived opt-out
2738
+ * rate.
2739
+ */
2740
+ items: Array<ConsentSettingPageAnalysisResponse.Item>;
2741
+
2742
+ /**
2743
+ * Running count of pages loaded so far (`offset + items.length`). Approximate for
2744
+ * load-more flows; query without `offset` to get the exact size of the first page.
2745
+ */
2746
+ total: number;
2747
+ }
2748
+
2749
+ export namespace ConsentSettingPageAnalysisResponse {
2750
+ export interface Item {
2751
+ bannerViews: number;
2752
+
2753
+ closeIconClicks: number;
2754
+
2755
+ optOutRate: number;
2756
+
2757
+ optOuts: number;
2758
+
2759
+ page: string;
2760
+ }
2761
+ }
2762
+
2763
+ export interface ConsentSettingAnalyticsByRegionResponse {
2764
+ /**
2765
+ * Per-region totals for the window, ranked by banner views (descending). Visitors
2766
+ * whose region cannot be resolved (e.g. bot traffic, IP geo failure) are bucketed
2767
+ * under the literal `Unknown`, so the per-region counts always sum to the global
2768
+ * totals.
2769
+ */
2770
+ regions: Array<ConsentSettingAnalyticsByRegionResponse.Region>;
2771
+ }
2772
+
2773
+ export namespace ConsentSettingAnalyticsByRegionResponse {
2774
+ export interface Region {
2775
+ bannerViews: number;
2776
+
2777
+ closeIconClicks: number;
2778
+
2779
+ explicitOptIns: number;
2780
+
2781
+ explicitOptOuts: number;
2782
+
2783
+ optInRate: number;
2784
+
2785
+ optOutRate: number;
2786
+
2787
+ regionName: string;
2788
+ }
2789
+ }
2790
+
2627
2791
  export interface ConsentSettingReplaceParams {
2628
2792
  /**
2629
2793
  * Top-level consent categories. Server re-stamps `priority` to 0..N.
@@ -3422,6 +3586,108 @@ export namespace ConsentSettingUpdateParams {
3422
3586
  }
3423
3587
  }
3424
3588
 
3589
+ export interface ConsentSettingAnalyticsParams {
3590
+ /**
3591
+ * Inclusive lower bound of the analytics window, as a UTC calendar day in
3592
+ * `YYYY-MM-DD` format. The window between `from` and `to` must be 90 days or fewer
3593
+ * (14 for `HOURLY` granularity).
3594
+ */
3595
+ from: string;
3596
+
3597
+ /**
3598
+ * Inclusive upper bound of the analytics window, as a UTC calendar day in
3599
+ * `YYYY-MM-DD` format. The window between `from` and `to` must be 90 days or fewer
3600
+ * (14 for `HOURLY` granularity).
3601
+ */
3602
+ to: string;
3603
+
3604
+ /**
3605
+ * When `true`, each bucket also returns the matching bucket from the immediately
3606
+ * preceding window of equal length (in `previous*` and `percentageChange*`
3607
+ * fields). Defaults to `false`.
3608
+ */
3609
+ compareWithPreviousPeriod?: boolean;
3610
+
3611
+ /**
3612
+ * Bucket size for the time-series rollup. `DAILY` (default) buckets per UTC day;
3613
+ * `HOURLY` buckets per UTC hour and limits the window to 14 days.
3614
+ */
3615
+ granularity?: 'DAILY' | 'HOURLY';
3616
+
3617
+ /**
3618
+ * Filter to events whose `default_properties.pathname` equals this value (exact
3619
+ * match, case-sensitive). Use this to drill into a single page.
3620
+ */
3621
+ pagePath?: string;
3622
+
3623
+ /**
3624
+ * Filter results to events whose `request_context.country_region_name` is in this
3625
+ * set. Pass a single region (e.g. `California`) or a comma-separated list
3626
+ * (`California,Texas`). Case-sensitive. Use
3627
+ * `GET /rest/v1/consent-settings/{id}/analytics-by-region` to discover the region
3628
+ * names available for an account.
3629
+ */
3630
+ regions?: string;
3631
+ }
3632
+
3633
+ export interface ConsentSettingPageAnalysisParams {
3634
+ /**
3635
+ * Inclusive lower bound of the analytics window, as a UTC calendar day in
3636
+ * `YYYY-MM-DD` format. The window between `from` and `to` must be 90 days or fewer
3637
+ * (14 for `HOURLY` granularity).
3638
+ */
3639
+ from: string;
3640
+
3641
+ /**
3642
+ * Inclusive upper bound of the analytics window, as a UTC calendar day in
3643
+ * `YYYY-MM-DD` format. The window between `from` and `to` must be 90 days or fewer
3644
+ * (14 for `HOURLY` granularity).
3645
+ */
3646
+ to: string;
3647
+
3648
+ /**
3649
+ * Maximum number of pages to return. Defaults to 50.
3650
+ */
3651
+ limit?: number;
3652
+
3653
+ /**
3654
+ * Skip this many top-ranked pages before returning. Use together with `limit` for
3655
+ * load-more pagination.
3656
+ */
3657
+ offset?: number | null;
3658
+
3659
+ /**
3660
+ * Filter results to events whose `request_context.country_region_name` is in this
3661
+ * set. Pass a single region (e.g. `California`) or a comma-separated list
3662
+ * (`California,Texas`). Case-sensitive. Use
3663
+ * `GET /rest/v1/consent-settings/{id}/analytics-by-region` to discover the region
3664
+ * names available for an account.
3665
+ */
3666
+ regions?: string;
3667
+
3668
+ /**
3669
+ * Case-sensitive substring match against `default_properties.pathname`. Wrapped in
3670
+ * `%...%` server-side.
3671
+ */
3672
+ search?: string;
3673
+ }
3674
+
3675
+ export interface ConsentSettingAnalyticsByRegionParams {
3676
+ /**
3677
+ * Inclusive lower bound of the analytics window, as a UTC calendar day in
3678
+ * `YYYY-MM-DD` format. The window between `from` and `to` must be 90 days or fewer
3679
+ * (14 for `HOURLY` granularity).
3680
+ */
3681
+ from: string;
3682
+
3683
+ /**
3684
+ * Inclusive upper bound of the analytics window, as a UTC calendar day in
3685
+ * `YYYY-MM-DD` format. The window between `from` and `to` must be 90 days or fewer
3686
+ * (14 for `HOURLY` granularity).
3687
+ */
3688
+ to: string;
3689
+ }
3690
+
3425
3691
  export declare namespace ConsentSettings {
3426
3692
  export {
3427
3693
  type ConsentSettingListResponse as ConsentSettingListResponse,
@@ -3430,7 +3696,13 @@ export declare namespace ConsentSettings {
3430
3696
  type ConsentSettingReplaceResponse as ConsentSettingReplaceResponse,
3431
3697
  type ConsentSettingUpdateResponse as ConsentSettingUpdateResponse,
3432
3698
  type ConsentSettingDeleteResponse as ConsentSettingDeleteResponse,
3699
+ type ConsentSettingAnalyticsResponse as ConsentSettingAnalyticsResponse,
3700
+ type ConsentSettingPageAnalysisResponse as ConsentSettingPageAnalysisResponse,
3701
+ type ConsentSettingAnalyticsByRegionResponse as ConsentSettingAnalyticsByRegionResponse,
3433
3702
  type ConsentSettingReplaceParams as ConsentSettingReplaceParams,
3434
3703
  type ConsentSettingUpdateParams as ConsentSettingUpdateParams,
3704
+ type ConsentSettingAnalyticsParams as ConsentSettingAnalyticsParams,
3705
+ type ConsentSettingPageAnalysisParams as ConsentSettingPageAnalysisParams,
3706
+ type ConsentSettingAnalyticsByRegionParams as ConsentSettingAnalyticsByRegionParams,
3435
3707
  };
3436
3708
  }