repo_name
stringlengths
1
62
dataset
stringclasses
1 value
lang
stringclasses
11 values
pr_id
int64
1
20.1k
owner
stringlengths
2
34
reviewer
stringlengths
2
39
diff_hunk
stringlengths
15
262k
code_review_comment
stringlengths
1
99.6k
gateway
github_2023
typescript
30
Portkey-AI
VisargD
@@ -0,0 +1,76 @@ +import { Params } from "../../types/requestBody"; +import { PalmCompleteResponse } from "../../types/responseBody"; +import { ChatCompletionResponse, ErrorResponse, ProviderConfig } from "../types"; + +// TODOS: this configuration does not enforce the maximum token limit for the input parameter. If yo...
Please fix the provider name
gateway
github_2023
typescript
30
Portkey-AI
VisargD
@@ -0,0 +1,43 @@ +import { EmbedParams, EmbedResponse } from "../../types/embedRequestBody"; +import { ProviderConfig } from "../types"; + +export const PalmEmbedConfig: ProviderConfig = { + input: { + param: "text", + required: true, + transform: (params: EmbedParams): string[] => { + ...
This is not a palm model. Please fix
gateway
github_2023
typescript
30
Portkey-AI
VisargD
@@ -0,0 +1,21 @@ +import { ProviderConfigs } from "../types"; +import PalmApiConfig from "./api"; +import { PalmChatCompleteConfig, PalmChatCompleteResponseTransform } from "./chatComplete"; +import { PalmCompleteConfig, PalmCompleteResponseTransform } from "./complete"; +import { PalmEmbedConfig, PalmEmbedResponseTran...
Please remove comments if stream mode is not supported
gateway
github_2023
typescript
30
Portkey-AI
VisargD
@@ -0,0 +1,21 @@ +import { ProviderConfigs } from "../types"; +import PalmApiConfig from "./api"; +import { PalmChatCompleteConfig, PalmChatCompleteResponseTransform } from "./chatComplete"; +import { PalmCompleteConfig, PalmCompleteResponseTransform } from "./complete"; +import { PalmEmbedConfig, PalmEmbedResponseTran...
Please remove comments if stream mode is not supported
gateway
github_2023
typescript
30
Portkey-AI
VisargD
@@ -0,0 +1,43 @@ +import { EmbedParams, EmbedResponse } from "../../types/embedRequestBody"; +import { ProviderConfig } from "../types"; + +export const PalmEmbedConfig: ProviderConfig = { + input: { + param: "text", + required: true, + transform: (params: EmbedParams): string[] => { + ...
Please fix/remove the comment text
gateway
github_2023
typescript
30
Portkey-AI
VisargD
@@ -0,0 +1,23 @@ +import { ProviderAPIConfig } from "../types"; + +export const PalmApiConfig: ProviderAPIConfig = { + baseURL: "https://generativelanguage.googleapis.com/v1beta3", + headers: () => { + return { "Content-Type": "application/json" } + }, + getEndpoint: (fn: string, API_KEY: string, mod...
API key is not required here to determine endpoint. Please remove it and also modify wherever this is called.
gateway
github_2023
typescript
30
Portkey-AI
VisargD
@@ -0,0 +1,81 @@ +import { Params } from "../../types/requestBody"; +import { PalmChatCompleteResponse } from "../../types/responseBody"; +import { ChatCompletionResponse, ErrorResponse, ProviderConfig } from "../types"; + +// TODOS: this configuration does not enforce the maximum token limit for the input parameter. I...
candidate count is in snake case as per PALM docs. https://developers.generativeai.google/tutorials/curl_quickstart
gateway
github_2023
typescript
30
Portkey-AI
VisargD
@@ -0,0 +1,75 @@ +import { Params } from "../../types/requestBody"; +import { PalmCompleteResponse } from "../../types/responseBody"; +import { ChatCompletionResponse, ErrorResponse, ProviderConfig } from "../types"; + +// TODOS: this configuration does not enforce the maximum token limit for the input parameter. If yo...
candidate count is in snake case as per PALM docs. https://developers.generativeai.google/tutorials/curl_quickstart
gateway
github_2023
typescript
30
Portkey-AI
VisargD
@@ -0,0 +1,81 @@ +import { Params } from "../../types/requestBody"; +import { PalmChatCompleteResponse } from "../../types/responseBody"; +import { ChatCompletionResponse, ErrorResponse, ProviderConfig } from "../types"; + +// TODOS: this configuration does not enforce the maximum token limit for the input parameter. I...
Please use camelCase for codebase
third-party-capital
github_2023
php
40
GoogleChromeLabs
adamsilverstein
@@ -0,0 +1,288 @@ +<?php +/** + * Class GoogleChromeLabs\ThirdPartyCapital\Data\ThirdPartyDataFormatter + * + * @package Third Party Capital + * @copyright 2023 Google LLC + * @license https://www.apache.org/licenses/LICENSE-2.0 Apache License 2.0 + */ + +namespace GoogleChromeLabs\ThirdPartyCapital\Data; + +use Go...
align $data with line below
third-party-capital
github_2023
php
40
GoogleChromeLabs
adamsilverstein
@@ -0,0 +1,288 @@ +<?php +/** + * Class GoogleChromeLabs\ThirdPartyCapital\Data\ThirdPartyDataFormatter + * + * @package Third Party Capital + * @copyright 2023 Google LLC + * @license https://www.apache.org/licenses/LICENSE-2.0 Apache License 2.0 + */ + +namespace GoogleChromeLabs\ThirdPartyCapital\Data; + +use Go...
looks good generally; will be great to have tests for this to confirm
third-party-capital
github_2023
php
70
GoogleChromeLabs
adamsilverstein
@@ -181,6 +197,14 @@ public static function formatUrl(string $url, array $params, array $args, array if ($params && $args) { $queryArgs = self::intersectArgs($args, $params); + if ($optionalParams) { + $optionalArgs = self::intersectArgs($optionalParams, $params); + ...
Is avoiding overwriting existing values is to match the JS behavior?
third-party-capital
github_2023
php
70
GoogleChromeLabs
adamsilverstein
@@ -192,21 +216,29 @@ public static function formatUrl(string $url, array $params, array $args, array /** * Formats the given code arguments into a code string. * - * @see https://github.com/GoogleChromeLabs/third-party-capital/blob/0831b937a8468e0f74bd79edd5a59fa8b2e6e763/src/utils/index.ts#L48 + ...
why does this return '""'?
third-party-capital
github_2023
php
70
GoogleChromeLabs
adamsilverstein
@@ -16,6 +16,28 @@ abstract class TestCase extends PHPUnitTestCase { + /** + * Test helper to turn a HTML element name and attributes array into a string. + * + * @param string $element HTML element name. + * @param array<string, string|bool> $attributes Associative array o...
Nice!
third-party-capital
github_2023
typescript
73
GoogleChromeLabs
github-advanced-security[bot]
@@ -54,7 +54,16 @@ args?: Inputs, optionalParams?: Inputs, ) { - return code.replace(/{{(.*?)}}/g, (match) => { + // Conditionals. + code = code.replace(/{{#(.*?)}}(.*){{\/\1}}/g, (match, name, innerCode) => { + if (args?.[name] || optionalParams?.[name]) { + return innerCode; + } + return ''; +...
## Polynomial regular expression used on uncontrolled data This [regular expression](1) that depends on [library input](2) may run slow on strings starting with '{{{{#' and with many repetitions of '{{{{#a'. This [regular expression](3) that depends on [library input](2) may run slow on strings starting with '{{{{#}}}...
third-party-capital
github_2023
typescript
73
GoogleChromeLabs
github-advanced-security[bot]
@@ -60,7 +60,19 @@ args?: Inputs, optionalParams?: Inputs, ) { - return code.replace(/{{(.*?)}}/g, (match) => { + // Conditionals. + code = code.replace( + /{{#([^}]*?)}}(.*){{\/\1}}/g, + (match, name, innerCode) => { + if (args?.[name] || optionalParams?.[name]) { + return innerCode; + ...
## Polynomial regular expression used on uncontrolled data This [regular expression](1) that depends on [library input](2) may run slow on strings starting with '{{{{#' and with many repetitions of '{{{{#|'. This [regular expression](3) that depends on [library input](2) may run slow on strings starting with '{{{{#}}}...
third-party-capital
github_2023
typescript
73
GoogleChromeLabs
github-advanced-security[bot]
@@ -60,7 +60,19 @@ args?: Inputs, optionalParams?: Inputs, ) { - return code.replace(/{{(.*?)}}/g, (match) => { + // Conditionals. + code = code.replace( + /{{#([^{}]*?)}}(.*){{\/\1}}/g, + (match, name, innerCode) => { + if (args?.[name] || optionalParams?.[name]) { + return innerCode; + ...
## Polynomial regular expression used on uncontrolled data This [regular expression](1) that depends on [library input](2) may run slow on strings starting with '{{{{#}}}}' and with many repetitions of '{{{{#}}}}a'. This [regular expression](1) that depends on [library input](3) may run slow on strings starting with '...
third-party-capital
github_2023
typescript
73
GoogleChromeLabs
github-advanced-security[bot]
@@ -60,7 +60,19 @@ args?: Inputs, optionalParams?: Inputs, ) { - return code.replace(/{{(.*?)}}/g, (match) => { + // Conditionals. + code = code.replace( + /{{#([^{}]+?)}}(.*){{\/\1}}/g, + (match, name, innerCode) => { + if (args?.[name] || optionalParams?.[name]) { + return innerCode; + ...
## Polynomial regular expression used on uncontrolled data This [regular expression](1) that depends on [library input](2) may run slow on strings starting with '{{{{#z}}}}' and with many repetitions of '{{{{#z}}}}a'. This [regular expression](1) that depends on [library input](3) may run slow on strings starting with...
third-party-capital
github_2023
typescript
73
GoogleChromeLabs
github-advanced-security[bot]
@@ -60,7 +60,19 @@ args?: Inputs, optionalParams?: Inputs, ) { - return code.replace(/{{(.*?)}}/g, (match) => { + // Conditionals. + code = code.replace( + /{{#([^{}]+)}}(.*){{\/\1}}/g, + (match, name, innerCode) => { + if (args?.[name] || optionalParams?.[name]) { + return innerCode; + ...
## Polynomial regular expression used on uncontrolled data This [regular expression](1) that depends on [library input](2) may run slow on strings starting with '{{{{#z}}}}' and with many repetitions of '{{{{#z}}}}a'. This [regular expression](1) that depends on [library input](3) may run slow on strings starting with...
third-party-capital
github_2023
others
76
GoogleChromeLabs
felixarntz
@@ -19,8 +19,7 @@ "params": ["id"], "optionalParams": { "l": "dataLayer", - "consentType": "default", - "consentValues": null
See https://github.com/GoogleChromeLabs/third-party-capital/pull/72#discussion_r1759740734 - while technically it doesn't matter, I think there is value in keeping parameters explicit in the schema, even if their default is null or undefined.
third-party-capital
github_2023
others
72
GoogleChromeLabs
felixarntz
@@ -15,9 +15,17 @@ "key": "gtm" }, { - "code": "window[{{l}}]=window[{{l}}]||[];window[{{l}}].push({'gtm.start':new Date().getTime(),event:'gtm.js'});", + "code": "window[{{l}}]=window[{{l}}]||[];(function () {window[{{l}}].push(arguments)})('consent', {{consentType}},{{consentValue...
Are we certain that including this in every Analytics `gtag` snippet is safe (i.e. leads to the same behavior as if it wasn't included)? I wonder because it's not mentioned in the default Analytics snippet. Without being certain about this, I'd feel more comfortable if we could make inclusion of this call conditiona...
third-party-capital
github_2023
others
72
GoogleChromeLabs
felixarntz
@@ -15,9 +15,10 @@ "key": "gtm" }, { - "code": "window[{{l}}]=window[{{l}}]||[];window[{{l}}].push({'gtm.start':new Date().getTime(),event:'gtm.js'});", + "code": "window[{{l}}]=window[{{l}}]||[];{{#consentValues}}(function () {window[{{l}}].push(arguments)})('consent', {{consentTyp...
I think `consentValues` needs to be present here, like with Analytics? https://github.com/GoogleChromeLabs/third-party-capital/blob/main/data/google-analytics.json#L23 ```suggestion "consentType": "default", "consentValues": null ```
third-party-capital
github_2023
typescript
72
GoogleChromeLabs
felixarntz
@@ -99,6 +99,16 @@ export interface GoogleTagManagerParams { * The name of the dataLayer object. Defaults to 'dataLayer'. */ l?: string; + /** + * Consent type for Google Tag Manager. + * @default 'default' + */ + consentType?: string; + /** + * Consent values for Google Tag Manager. + * @defaul...
```suggestion * @default null ```
third-party-capital
github_2023
typescript
74
GoogleChromeLabs
huang-julien
@@ -27,22 +27,28 @@ function filterArgs( // Add all required search params with user inputs as values export function formatUrl( url: string, - params?: string[], - args?: Inputs, + paramKeys?: string[], + paramInputs?: Inputs, slug?: Inputs, - optionalParams?: Inputs, + optionalParamKeys?: string[], + o...
I won't impact nuxt scripts. But it may be a breaking change for the PHP and nextJS integration if they use it
third-party-capital
github_2023
typescript
74
GoogleChromeLabs
huang-julien
@@ -152,24 +145,34 @@ export function formatData(data: Data, args: Inputs): Output { // Pass any required query params with user values for relevant scripts scripts: data.scripts ? data.scripts.map((script) => { + const paramKeys = script.params; + const paramInputs = filterArgs(args,...
We could use a reducer if you thikn it's not pretty (but it may end up even more uglier :joy:)
third-party-capital
github_2023
typescript
74
GoogleChromeLabs
felixarntz
@@ -27,22 +27,28 @@ function filterArgs( // Add all required search params with user inputs as values export function formatUrl( url: string, - params?: string[], - args?: Inputs, + paramKeys?: string[], + paramInputs?: Inputs, slug?: Inputs, - optionalParams?: Inputs, + optionalParamKeys?: string[], + o...
I think this is not working as expected? We also need to consider the default values for optional params here. In other words, I think the function needs to receive an `Inputs` object instead of `string[]` for `optionalParamKeys` (which is effectively "optional param keys with their defaults", maybe call it `optionalPa...
third-party-capital
github_2023
typescript
74
GoogleChromeLabs
felixarntz
@@ -152,24 +161,34 @@ export function formatData(data: Data, args: Inputs): Output { // Pass any required query params with user values for relevant scripts scripts: data.scripts ? data.scripts.map((script) => { + const paramKeys = script.params; + const paramInputs = filterArgs(args,...
Okay, it looks like here you're merging the optional param defaults with the actual optional param values provided by the caller. That sort of satisfies my comment above, but I think that's still error-prone IMO, as it means this only works out of the box if you call `formatData()`, but not if you call `formatUrl()` di...
third-party-capital
github_2023
typescript
74
GoogleChromeLabs
felixarntz
@@ -51,13 +57,16 @@ export function formatUrl( export function formatCode( code: string, - args?: Inputs, - optionalParams?: Inputs, + paramInputs?: Inputs, + optionalParamInputs?: Inputs,
Same feedback here, it's a bit error-prone to me that the caller of `formatCode` would be expected to merge the optional param defaults with the optional param values provided by the caller. IMO this should happen inside this function so that it can be called directly without requiring a manual "preparation step" befor...
third-party-capital
github_2023
typescript
74
GoogleChromeLabs
felixarntz
@@ -56,9 +62,8 @@ export function formatCode( ) { return code.replace(/{{(.*?)}}/g, (match) => { const name = match.split(/{{|}}/).filter(Boolean)[0]; - return JSON.stringify( - args?.[name] !== undefined ? args?.[name] : optionalParams?.[name], - ); + + return JSON.stringify(args?.[name] ?? opti...
What's the intention of this change? Or is this just a syntax change that achieves the same behavior?
third-party-capital
github_2023
typescript
74
GoogleChromeLabs
felixarntz
@@ -328,7 +328,7 @@ describe('Utils', () => { params: { val: null, }, - output: `null`, + output: `undefined`,
Shouldn't this still result in `null`, if `null` is the provided value? I guess the question is: Do we treat both `null` and `undefined` as "not set", or only `undefined`?
third-party-capital
github_2023
others
71
GoogleChromeLabs
housseindjirdeh
@@ -15,7 +15,7 @@ "key": "gtag" }, { - "code": "window[{{l}}]=window[{{l}}]||[];window['gtag-'+{{l}}]=function (){window[{{l}}].push(arguments);};window['gtag-'+{{l}}]('js',new Date());window['gtag-'+{{l}}]('config',{{id}})", + "code": "window[{{l}}]=window[{{l}}]||[];window['gtag-'+{{l}}]=fu...
My only concern with this is if anyone wants to have different consent options in the future. Instead of hardcoding, what do you think about including `consent` as optionalParams instead? Something like: ``` //... "optionalParams": { "l": "dataLayer", "consentType": "default", ...
third-party-capital
github_2023
others
71
GoogleChromeLabs
housseindjirdeh
@@ -15,10 +15,18 @@ "key": "gtag" }, { - "code": "window[{{l}}]=window[{{l}}]||[];window['gtag-'+{{l}}]=function (){window[{{l}}].push(arguments);};window['gtag-'+{{l}}]('js',new Date());window['gtag-'+{{l}}]('config',{{id}})", + "code": "window[{{l}}]=window[{{l}}]||[];window['gtag-'+{{l}}]=...
Are these all the default settings? We should definitely have the default values here and then Nuxt (or any consumer) can update them as they fit
third-party-capital
github_2023
typescript
64
GoogleChromeLabs
housseindjirdeh
@@ -12,7 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. -import data from './data.json'; +import data from '../../../data/google-tag-manager.json';
Should we consider including absolute imports via alias (e.g. `@/data/...`)? Might be overkill and something we can worry about in a future PR
third-party-capital
github_2023
typescript
64
GoogleChromeLabs
housseindjirdeh
@@ -1,7 +1,7 @@ -import GooglaAnalyticsData from './google-analytics/data.json'; -import GoogleTagManagerData from './google-tag-manager/data.json'; -import GoogleMapsEmbedData from './google-maps-embed/data.json'; -import GoogleYoutubeEmbedData from './youtube-embed/data.json'; +import GooglaAnalyticsData from '../../...
Seems like a typo from a previous PR squeezed through: ```suggestion import GoogleAnalyticsData from '../../data/google-analytics.json'; ```
third-party-capital
github_2023
others
62
GoogleChromeLabs
huang-julien
@@ -15,7 +15,7 @@ "key": "gtag" }, { - "code": "window[{{l}}]=window[{{l}}]||[];window[{{l}}].push({'js':new Date()});window[{{l}}].push({'config':{{id}}})", + "code": "window[{{l}}]=window[{{l}}]||[];function gtag(){window[{{l}}].push(arguments);};gtag('js',new Date());gtag('config','{{id}}'...
`gtag` was removed because having multiple gtm/ga would override the last `gtag`
third-party-capital
github_2023
typescript
62
GoogleChromeLabs
huang-julien
@@ -56,9 +56,7 @@ export function formatCode( ) { return code.replace(/{{(.*?)}}/g, (match) => { const name = match.split(/{{|}}/).filter(Boolean)[0]; - return JSON.stringify( - args && name in args ? args?.[name] : optionalParams?.[name], - ); + return args?.[name] !== undefined ? args?.[name] :...
so we d'ont stringify it anymore ? would this be a breaking change ?
third-party-capital
github_2023
others
61
GoogleChromeLabs
housseindjirdeh
@@ -43,14 +43,17 @@ The loading recommendation for each third-party resource is defined with the fol key?: string; url: string | { url: string; - params: Array<string> ; }; + params: Array<string> ; + optionalParams?: Record<string, string | number | undefined | null>;
`undefined` as well? Shouldn't `null` be sufficient?
third-party-capital
github_2023
others
59
GoogleChromeLabs
flashdesignory
@@ -6,14 +6,16 @@ { "url": "https://www.googletagmanager.com/gtag/js", "params": ["id", "l"], + "optionalParam": ["l"], "strategy": "worker", "location": "head", "action": "append", "key": "gtag" }, { - "code": "window['{{l}}']=window['{{l}}']||[];windo...
can we use plural here? `optionalParams`
third-party-capital
github_2023
others
59
GoogleChromeLabs
flashdesignory
@@ -6,14 +6,15 @@ { "url": "https://www.googletagmanager.com/gtm.js", "params": ["id", "l"], + "optionalParam": ["l"], "strategy": "worker", "location": "head", "action": "append", "key": "gtm" }, { - "code": "window['{{l}}']=windo...
same as above
third-party-capital
github_2023
typescript
59
GoogleChromeLabs
flashdesignory
@@ -17,6 +17,7 @@ export type HtmlAttributes = { type ScriptBase = { params?: Array<string>; + optionalParam?: Array<string>;
same as above
third-party-capital
github_2023
typescript
59
GoogleChromeLabs
flashdesignory
@@ -17,7 +17,7 @@ export type HtmlAttributes = { type ScriptBase = { params?: Array<string>; - optionalParam?: Array<string>; + optionalParams?: Record<string, string | number | undefined>;
should we include Null as well, since it's assigned as a default value in some scripts?
third-party-capital
github_2023
typescript
54
GoogleChromeLabs
huang-julien
@@ -75,14 +79,20 @@ export interface GTag { (fn: 'config', opt: 'reset'): void; } +export type DataLayer = Record<string, unknown>[]; +export type Maybe<T> = NonNullable<T> | undefined; + export interface GoogleAnalyticsApi { - dataLayers: Record<string, Record<string, any>[]>; - gtag: GTag; + [key: string]: ...
WOuldn't this make any key possibly a DataLayer type ?
third-party-capital
github_2023
typescript
54
GoogleChromeLabs
huang-julien
@@ -100,16 +110,15 @@ type GoogleTagManagerDataLayerStatus = { }; }; -export type GoogleTagManager = GoogleTagManagerDataLayerStatus & { +export type GoogleTagManagerInstance = GoogleTagManagerDataLayerStatus & { [key: string]: { callback: () => void; dataLayer: GoogleTagManagerDataLayerApi; }; }...
google_tag_manager doesn't need to be removed, nor being wrapper with Maybe i think
third-party-capital
github_2023
others
54
GoogleChromeLabs
housseindjirdeh
@@ -5,15 +5,15 @@ "scripts": [ { "url": "https://www.googletagmanager.com/gtag/js", - "params": ["id"], + "params": ["id", "l"],
Just to confirm, `l` is a URL query param correct? I think the `params` property here assigns URL params if I'm not mistaken
third-party-capital
github_2023
typescript
54
GoogleChromeLabs
housseindjirdeh
@@ -62,6 +62,10 @@ export interface Output { /* Google Analytics */ export interface GoogleAnalyticsParams { id: string; + /** + * The name of the dataLayer object. Defaults to 'dataLayer'. + */ + l?: string;
Why `l`? Is that the name we're using to map to Nuxt or something that the gtag docs suggest?
third-party-capital
github_2023
typescript
54
GoogleChromeLabs
harlan-zw
@@ -75,14 +79,15 @@ export interface GTag { (fn: 'config', opt: 'reset'): void; } -export interface GoogleAnalyticsApi {
this is technically a breaking change for the types it's probably safe as i can't imagine anyone besides Nuxt Scripts using it but please be mindful of these changes down the line
third-party-capital
github_2023
others
54
GoogleChromeLabs
harlan-zw
@@ -5,15 +5,15 @@ "scripts": [ { "url": "https://www.googletagmanager.com/gtag/js", - "params": ["id"], + "params": ["id", "l"], "strategy": "worker", "location": "head", "action": "append", "key": "gtag" }, { - "code": "window.dataLayers=window.dataLa...
this is also a breaking change
third-party-capital
github_2023
typescript
49
GoogleChromeLabs
huang-julien
@@ -111,3 +111,21 @@ export interface GoogleTagManagerApi { dataLayer: Record<string, any>[]; google_tag_manager: GoogleTagManager; } + +/* Google Maps Embed */ +export interface GoogleMapsEmbedOptions {
```suggestion export interface GoogleMapsEmbedQueries { ```
third-party-capital
github_2023
typescript
49
GoogleChromeLabs
huang-julien
@@ -111,3 +111,21 @@ export interface GoogleTagManagerApi { dataLayer: Record<string, any>[]; google_tag_manager: GoogleTagManager; } + +/* Google Maps Embed */ +export interface GoogleMapsEmbedOptions { + key: string; + mode: 'place' | 'view' | 'directions' | 'streetview' | 'search'; + q?: string; + center?...
```suggestion export interface YoutubeEmbedAttributes { ```
third-party-capital
github_2023
others
43
GoogleChromeLabs
harlan-zw
@@ -2,28 +2,21 @@ "name": "third-party-capital", "version": "1.0.26", "description": "", - "main": "./lib/cjs/index.js", - "types": "./lib/cjs/types/index.d.ts", - "files": [ - "lib/**/*" - ], + "type": "commonjs",
I'd recommend exporting as a `module` by default
third-party-capital
github_2023
others
43
GoogleChromeLabs
harlan-zw
@@ -2,28 +2,21 @@ "name": "third-party-capital", "version": "1.0.26", "description": "", - "main": "./lib/cjs/index.js", - "types": "./lib/cjs/types/index.d.ts", - "files": [ - "lib/**/*" - ], + "type": "commonjs", "exports": { ".": { - "import": { - "types": "./lib/esm/types/index....
you can provide a top level `types` option and a `types` here to typescript support, see https://github.com/nuxt/nuxt/blob/main/packages/nuxt/package.json#L20
third-party-capital
github_2023
typescript
34
GoogleChromeLabs
housseindjirdeh
@@ -144,6 +150,6 @@ export function formatData(data: Data, args: Inputs) { code: formatCode(script.code, scriptUrlParamInputs), }; }) - : null, + : undefined,
I'm not sure how I feel about returning `undefined` instead of `null`. Is there a particular reason why switched it here?
third-party-capital
github_2023
typescript
34
GoogleChromeLabs
housseindjirdeh
@@ -50,6 +50,15 @@ export interface Inputs { [key: string]: any; } +export interface Output { + id: string; + description: string; + website?: string; + html?: string; + stylesheets?: Array<string>; + scripts?: Scripts; +} +
Just curious, is the idea that this gets checked by the consumer (i.e Nuxt) to make sure that nothing is missing?
third-party-capital
github_2023
typescript
27
GoogleChromeLabs
housseindjirdeh
@@ -15,3 +15,5 @@ export { GoogleAnalytics } from './third-parties/google-analytics'; export { GoogleMapsEmbed } from './third-parties/google-maps-embed'; export { YouTubeEmbed } from './third-parties/youtube-embed'; + +export * from './types';
My TS skills are not as good as I'd like them to be lol Is this how folks generally export types? Do you know if packages usually includes a types file as well?
third-party-capital
github_2023
others
27
GoogleChromeLabs
housseindjirdeh
@@ -11,8 +11,7 @@ "action": "append" }, { - "code": "window.dataLayer=window.dataLayer||[];window.gtag=function gtag(){window.dataLayer.push(arguments);};gtag('js',new Date());gtag('config','${args.id}')", - "strategy": "worker", + "code": "window.dataLayer=window.dataLayer||[];window.gt...
Nit: Identation I thought I already set up Prettier in this package, but maybe I need to take another look 🤔
third-party-capital
github_2023
typescript
24
GoogleChromeLabs
janicklas-ralph
@@ -25,54 +26,151 @@ describe('Utils', () => { it('should construct a HTML element with default attributes and values', () => { const element = 'lite-element'; - const attrs = { + const defaultAttrs = { id: '123', loading: 'lazy', }; - const htmlElement = createHt...
If we pass in inputs like `{ id: "props.id" }` will that be inlined the same? We should highlight that in the test to make it clear
third-party-capital
github_2023
others
24
GoogleChromeLabs
janicklas-ralph
@@ -8,6 +8,7 @@ "loading": "lazy", "src": { "url": "https://www.google.com/maps/embed/v1/place",
Should this be "https://www.google.com/maps/embed/v1/" So when we pass slugParam it would be appended correctly
third-party-capital
github_2023
typescript
24
GoogleChromeLabs
janicklas-ralph
@@ -25,54 +26,209 @@ describe('Utils', () => { it('should construct a HTML element with default attributes and values', () => { const element = 'lite-element'; - const attrs = { + const defaultAttrs = { id: '123', loading: 'lazy', }; - const htmlElement = createHt...
I'm not sure if this is right `src="https://www.example.com/?id=props.id"` since it appends `id=props.id` and I was thinking it would be like `id={props.id}` I think I might be misunderstanding these tests and we don't have to do this. I can test the actual api once updated and revisit this later.
third-party-capital
github_2023
typescript
24
GoogleChromeLabs
janicklas-ralph
@@ -25,54 +26,209 @@ describe('Utils', () => { it('should construct a HTML element with default attributes and values', () => { const element = 'lite-element'; - const attrs = { + const defaultAttrs = { id: '123', loading: 'lazy', }; - const htmlElement = createHt...
Oh, does this replace only the last part of the url?
third-party-capital
github_2023
others
12
GoogleChromeLabs
kara
@@ -41,10 +45,10 @@ These properties provide a heuristic for consumers to decide how, when, and wher - **id** _(required)_: Identifier string - **description** _(required)_: Short description of third-party entity - **website** _(optional)_: URL address of website -- **content** _(optional<sup>\*</sup>)_: HTML eleme...
```suggestion - **html** _(optional<sup>\*</sup>)_: HTML element to be inserted where 3PC component is placed. The `attributes` property allows you to include a list of default or user-required attributes and their values. ```
third-party-capital
github_2023
typescript
12
GoogleChromeLabs
kara
@@ -0,0 +1,56 @@ +import type { Data, Inputs, AttributeVal, HtmlAttributes } from '../types'; + +function formatUrl(url: string, params: string[], args: Inputs) {
Nit: do you want to make `params` and `args` optional in the type system since they may be undefined? (will also allow you to remove the "!" lower down)
third-party-capital
github_2023
typescript
12
GoogleChromeLabs
kara
@@ -0,0 +1,59 @@ +import type { Data, Inputs, AttributeVal, HtmlAttributes } from '../types'; + +// Add all required search params with user inputs as values +function formatUrl(url: string, params: string[], args: Inputs) { + if (!params || !args) return url; + + let newUrl = new URL(url);
Nit, doesn't look like newUrl changes assignment ```suggestion const newUrl = new URL(url); ```
third-party-capital
github_2023
typescript
12
GoogleChromeLabs
kara
@@ -0,0 +1,59 @@ +import type { Data, Inputs, AttributeVal, HtmlAttributes } from '../types'; + +// Add all required search params with user inputs as values +function formatUrl(url: string, params: string[], args: Inputs) { + if (!params || !args) return url; + + let newUrl = new URL(url); + + params.forEach((param...
Let's add a unit test that we're generating the right HTML?
ps-analysis-tool
github_2023
typescript
1,007
GoogleChromeLabs
mohdsayed
@@ -0,0 +1,65 @@ +/* + * Copyright 2025 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by a...
If we want to make it dynamic, shouldn't we make use of an event listener? Something like this ```js useEffect(() => { const mediaQuery = window.matchMedia('(prefers-color-scheme: dark)'); const handleChange = (event: MediaQueryListEvent) => { setIsDarkMode(event.matches); }; setIsDarkMode(medi...
ps-analysis-tool
github_2023
typescript
1,007
GoogleChromeLabs
mohdsayed
@@ -0,0 +1,65 @@ +/* + * Copyright 2025 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by a...
Small thing: though "Loading.." will normally not appear, but if it does, I think it should be center aligned.
ps-analysis-tool
github_2023
javascript
892
GoogleChromeLabs
mohdsayed
@@ -22,6 +22,8 @@ let maxScroll; let scaleVal = 1; let scalingDown = false; let deltaY = 0; +let previousStories = []; +let doesHaveMorePages = false;
Instead of these many variables can we use a single object?
ps-analysis-tool
github_2023
typescript
892
GoogleChromeLabs
mohdsayed
@@ -0,0 +1,517 @@ +/* + * Copyright 2024 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by ...
Shouldn't we use a constant for https://privacysandbox-stories.com/wp-json/web-stories/v1 ?
ps-analysis-tool
github_2023
typescript
892
GoogleChromeLabs
mohdsayed
@@ -0,0 +1,517 @@ +/* + * Copyright 2024 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by ...
Or this part of code could become a function to be used with different params.
ps-analysis-tool
github_2023
javascript
920
GoogleChromeLabs
mohdsayed
@@ -278,6 +286,7 @@ bubbles.reverseBarrageAnimation = async (index) => { } document.getElementById('interest-canvas').style.zIndex = 4; + document.getElementById('bubble-container-div').style.zIndex = 2;
Thinking why we are querying the DOM more than once for `'bubble-container-div'`.
ps-analysis-tool
github_2023
javascript
920
GoogleChromeLabs
mohdsayed
@@ -0,0 +1,46 @@ +/* + * Copyright 2025 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by a...
Shouldn't we avoid querying DOM multiple times?
ps-analysis-tool
github_2023
typescript
919
GoogleChromeLabs
mohdsayed
@@ -24,20 +24,18 @@ interface InfoProps { description?: string; info: string; key: number; - }; + } | null; } const Info = ({ data }: InfoProps) => { - const { title, description, info } = data; - return ( <div className="flex-1 text-raisin-black dark:text-bright-gray border border-gray-30...
Not sure about the need of this change.
ps-analysis-tool
github_2023
typescript
919
GoogleChromeLabs
mohdsayed
@@ -124,7 +125,9 @@ const IGTable = ({ return interestGroupDetails.map((interestGroup) => { const isHighlighted = - interestGroup.name === highlightedInterestGroup.interestGroupName; + interestGroup.name === highlightedInterestGroup.interestGroupName && + new URL(interestGroup?.ownerO...
👍
ps-analysis-tool
github_2023
javascript
915
GoogleChromeLabs
amovar18
@@ -495,9 +496,13 @@ bubbles.bubbleChart = ( .attr('style', `${!app.bubbles.isExpanded ? 'pointer-events: none;' : ''}`) .attr('transform', (d) => `translate(${d.x},${d.y})`); - const eventHandler = (event) => { + const eventHandler = (event, d) => { // eslint-disable-next-line no-console
Artifact left to remove.
ps-analysis-tool
github_2023
typescript
904
GoogleChromeLabs
mayan-000
@@ -13,40 +13,41 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - /** * External dependencies. */ -import { prettyPrintJson } from 'pretty-print-json'; import React from 'react'; -interface InfoPanelProps { - data: any; +interface InfoProps { ...
Typo
ps-analysis-tool
github_2023
others
902
GoogleChromeLabs
mohdsayed
@@ -0,0 +1,24 @@ +# Logs +logs +*.log +npm-debug.log* +yarn-debug.log* +yarn-error.log* +pnpm-debug.log* +lerna-debug.log* + +node_modules +dist +dist-ssr +*.local + +# Editor directories and files +.vscode/* +!.vscode/extensions.json +.idea +.DS_Store +*.suo +*.ntvs* +*.njsproj +*.sln +*.sw?
Is a separate gitignore file required here?
ps-analysis-tool
github_2023
typescript
902
GoogleChromeLabs
mohdsayed
@@ -0,0 +1,47 @@ +/* + * Copyright 2024 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by a...
Add comment for internal dependencies
ps-analysis-tool
github_2023
typescript
902
GoogleChromeLabs
mohdsayed
@@ -0,0 +1,47 @@ +/* + * Copyright 2024 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by a...
Please add some doc of for each class explaining what they do.
ps-analysis-tool
github_2023
typescript
902
GoogleChromeLabs
mohdsayed
@@ -0,0 +1,71 @@ +/* + * Copyright 2024 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by a...
What does this addition do?
ps-analysis-tool
github_2023
typescript
902
GoogleChromeLabs
mohdsayed
@@ -0,0 +1,75 @@ +/* + * Copyright 2024 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by a...
Are we supposed to calculate these coordinates manually for every figure? Any plan to create something like [nextTipCoordinates](https://github.com/GoogleChromeLabs/ps-analysis-tool/blob/c5c5b8729aa1a3909d6394fddffe043e42e2cc1d/packages/explorable-explanations/src/protectedAudience/app.js#L28) ? If we keep it like ...
ps-analysis-tool
github_2023
javascript
903
GoogleChromeLabs
mohdsayed
@@ -0,0 +1,77 @@ +/* + * Copyright 2024 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by a...
As `app.p` is one common object, `p.mouseMoved` doesn't override the global `mouseMoved` event in p5.js?
ps-analysis-tool
github_2023
javascript
901
GoogleChromeLabs
mohdsayed
@@ -20,15 +20,20 @@ import ProgressLine from './progressLine'; import app from '../app'; import config from '../config'; import Box from './box'; -import { wipeAndRecreateInterestCanvas } from '../utils'; +import { delay, wipeAndRecreateInterestCanvas } from '../utils'; const LEFT_MARGIN = 70; // Margin from the ...
A weird place to check condition.
ps-analysis-tool
github_2023
typescript
997
GoogleChromeLabs
mayan-000
@@ -103,7 +103,8 @@ export const FEATURE_LIST = [ name: I18n.getMessage('privateAdvertising'), icon: PrivateAdvertisingIcon, sidebarKey: SIDEBAR_ITEMS_KEYS.PRIVATE_ADVERTISING, - description: I18n.getMessage('privateAdvertisingDescription'), + description: + 'Private-preserving APIs supporting...
Looks like two spaces between `while providing`
ps-analysis-tool
github_2023
typescript
997
GoogleChromeLabs
mayan-000
@@ -0,0 +1,54 @@ +/* + * Copyright 2025 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by a...
missed by mistake
ps-analysis-tool
github_2023
typescript
992
GoogleChromeLabs
mayan-000
@@ -120,7 +120,6 @@ const Animation = ({ return ( <div className="relative"> <div ref={node} className="overflow-auto bg-white" /> - <div className="absolute top-0 left-0 w-20 h-10 bg-white z-50" />
We need this one to cover the loading text that comes for a few milliseconds from p5.js. There are ways to style that, too, but it's unreliable because p5.js sometimes misfires the custom loading.
ps-analysis-tool
github_2023
typescript
991
GoogleChromeLabs
mohdsayed
@@ -174,7 +174,7 @@ const IGTable = ({ const topBarExtraInterface = useCallback(() => { if (isEE) { - return null; + return <></>;
What problem did it create?
ps-analysis-tool
github_2023
typescript
990
GoogleChromeLabs
mohdsayed
@@ -99,7 +99,7 @@ const Box = ({ p.text(title, x + width / 2, y + height / 2); } - if (info && typeof info === 'string') { + if (info) {
Ah, we missed this in https://github.com/GoogleChromeLabs/ps-analysis-tool/pull/983 review.
ps-analysis-tool
github_2023
typescript
977
GoogleChromeLabs
mohdsayed
@@ -0,0 +1,53 @@ +/* + * Copyright 2025 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by a...
```suggestion 'Access documentation, API references, and implementation guides on the Privacy Sandbox Developer site.', ```
ps-analysis-tool
github_2023
typescript
977
GoogleChromeLabs
mohdsayed
@@ -17,67 +17,24 @@ * External dependencies. */ import React from 'react'; -import { - DevGuideIcon, - Help, - SIDEBAR_ITEMS_KEYS, - useSidebar, - WebStoriesIcon, - WikiIcon, -} from '@google-psat/design-system'; - -const ITEMS = [ - { - name: 'Wiki', - icon: WikiIcon, - sidebarKey: SIDEBAR_ITEMS_K...
Should be grouped under "Internal dependencies"
ps-analysis-tool
github_2023
typescript
977
GoogleChromeLabs
mohdsayed
@@ -17,67 +17,24 @@ * External dependencies. */ import React from 'react'; -import { - DevGuideIcon, - Help, - SIDEBAR_ITEMS_KEYS, - useSidebar, - WebStoriesIcon, - WikiIcon, -} from '@google-psat/design-system'; - -const ITEMS = [ - { - name: 'Wiki', - icon: WikiIcon, - sidebarKey: SIDEBAR_ITEMS_K...
Should the `sidebarKey` be using type `SIDEBAR_ITEMS_KEYS` ?
ps-analysis-tool
github_2023
typescript
977
GoogleChromeLabs
mohdsayed
@@ -17,19 +17,28 @@ /** * External dependencies. */ -import { Help } from '@google-psat/design-system'; import React from 'react'; +import { Help, SIDEBAR_ITEMS_KEYS } from '@google-psat/design-system'; + +/** + * Internal dependencies. + */ +import { FEATURED_ITEMS } from '../constants'; +import ExternalLinkPane...
I think this would be more readable ```js const helpIcon = ( <Help className="w-10 h-10 fill-granite-gray dark:fill-bright-gray" /> ); <ExternalLinkPanel description={description} icon={helpIcon} />; ```
ps-analysis-tool
github_2023
typescript
977
GoogleChromeLabs
mohdsayed
@@ -0,0 +1,126 @@ +/* + * Copyright 2024 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by ...
If it is shared, will the test id be `dashboard-content` ?
ps-analysis-tool
github_2023
typescript
977
GoogleChromeLabs
mohdsayed
@@ -0,0 +1,50 @@ +/* + * Copyright 2025 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by a...
```suggestion interface ExternalLinkPanelProps { description: string; icon: React.JSX.Element; } const ExternalLinkPanel = ({ description, icon }: ExternalLinkPanelProps) => { ```
ps-analysis-tool
github_2023
typescript
977
GoogleChromeLabs
mohdsayed
@@ -0,0 +1,140 @@ +/* + * Copyright 2024 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by ...
Shouldn't we use this instead as these are supposed to accept SVG props` ``` import React, { type SVGProps, type ComponentType } from 'react'; icon: ComponentType<SVGProps<SVGSVGElement>>; ```
ps-analysis-tool
github_2023
typescript
977
GoogleChromeLabs
mohdsayed
@@ -0,0 +1,140 @@ +/* + * Copyright 2024 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by ...
```suggestion type CardsPanelProps = { ``` for the sake of consistency with all other components.
ps-analysis-tool
github_2023
typescript
977
GoogleChromeLabs
mohdsayed
@@ -173,9 +173,12 @@ export const SidebarProvider = ({ currentWindow: true, }); - const url = tab[0].url?.split('#')[0].split('?')[0]; - if (url !== item.panel.href) { - chrome?.tabs?.update({ url: item.panel.href }); + // only open if an active tab is found + ...
What's this change ?
ps-analysis-tool
github_2023
typescript
972
GoogleChromeLabs
mayan-000
@@ -54,3 +54,4 @@ export * from './utils/generateReports'; export * from './cookies.types'; export * from './libraryDetection.types'; export * from './protectedAudience.types'; +export * from './ara.Types';
`ara.Types` should be lowercase
ps-analysis-tool
github_2023
typescript
972
GoogleChromeLabs
mohdsayed
@@ -100,6 +116,14 @@ chrome.debugger.onEvent.addListener((source, method, params) => { {} ); + await chrome.debugger.sendCommand( + childDebuggee, + 'Storage.setAttributionReportingLocalTestingMode', + { + enabled: true, + ...
Aren't we doing all of these twice, once here and again in `attachCDP.ts` file? Should we consider refactoring it into a shared function to avoid redundancy? (For a follow-up PR)
ps-analysis-tool
github_2023
others
972
GoogleChromeLabs
mohdsayed
@@ -0,0 +1,188 @@ +[
We can use this for test coverage in the follow-up pr
ps-analysis-tool
github_2023
typescript
972
GoogleChromeLabs
mohdsayed
@@ -36,25 +33,15 @@ import Panel from './panel'; import AdUnits from './adUnits'; import ExplorableExplanation from './explorableExplanation'; import WorkletBreakpoints from './workletBreakpoints'; - -const InfoCard = ({ infoKey }: { infoKey: PSInfoKeyType }) => { - return ( - <> - <InfoCardTemplate infoKey...
👍
ps-analysis-tool
github_2023
typescript
940
GoogleChromeLabs
mohdsayed
@@ -37,22 +37,13 @@ import { setupMainCanvas, setupUserCanvas, } from './canvas'; - +import { P5, Circle } from '../types'; +import { getCoordinateValues } from './utils/getCoordinateValues.ts'; app.setUpTimeLine = () => { - app.auction.auctions = []; - app.joinInterestGroup.joinings = []; - app.timeline.cir...
Have we also done code refactoring? Where is it moved ?