Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[chore] Change package to start with @coinbase #4

Merged
merged 1 commit into from
Dec 7, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,12 +38,12 @@ yarn test

## Packages

- `cb-cookie-manager`: Package that helps with managing first party client side cookies to adhere to CCPA and GDPR Cookie regulations. More information [here](./packages/cb-cookie-manager/README.md)
- `@coinbase/cookie-manager`: Package that helps with managing first party client side cookies to adhere to CCPA and GDPR Cookie regulations. More information [here](./packages/cookie-manager/README.md)

- `cb-cookie-banner`: Banner and modal to allow users to choose their cookie preferences.
More information [here](./packages/cb-cookie-banner/README.md)
- `@coinbase/cookie-banner`: Banner and modal to allow users to choose their cookie preferences.
More information [here](./packages/cookie-banner/README.md)

- `example`: Example app built using NextJS which uses both `cb-cookie-manager` and `cb-cookie-banner`. Code [here](./apps/example/)
- `example`: Example app built using NextJS which uses both `@coinbase/cookie-manager` and `@coinbase/cookie-banner`. Code [here](./apps/example/)

## Contributing

Expand Down
2 changes: 1 addition & 1 deletion apps/example/README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Example

This is an example [Next.js](https://nextjs.org/) project which uses both `cb-cookie-banner` and `cb-cookie-manager`
This is an example [Next.js](https://nextjs.org/) project which uses both `@coinbase/cookie-banner` and `@coinbase/cookie-manager`

## Getting Started

Expand Down
2 changes: 1 addition & 1 deletion apps/example/hooks/useTranslations.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { useTrackingManager } from 'cb-cookie-manager';
import { useTrackingManager } from '@coinbase/cookie-manager';
import { useCallback, useEffect, useRef, useState } from 'react';

type TranslationsType = Record<string, string>;
Expand Down
4 changes: 2 additions & 2 deletions apps/example/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@
"test": "jest --passWithNoTests"
},
"dependencies": {
"cb-cookie-banner": "1.0.0",
"cb-cookie-manager": "1.0.0",
"@coinbase/cookie-banner": "1.0.0",
"@coinbase/cookie-manager": "1.0.0",
"next": "14.0.0",
"react": "^18",
"react-dom": "^18"
Expand Down
2 changes: 1 addition & 1 deletion apps/example/pages/_app.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
'use client';
import '@/styles/globals.css';

import { Provider, Region, TrackingCategory, TrackingPreference } from 'cb-cookie-manager';
import { Provider, Region, TrackingCategory, TrackingPreference } from '@coinbase/cookie-manager';
import type { AppProps } from 'next/app';
import { useCallback, useEffect, useRef, useState } from 'react';

Expand Down
2 changes: 1 addition & 1 deletion apps/example/pages/index.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { CookieBanner } from 'cb-cookie-banner';
import { CookieBanner } from '@coinbase/cookie-banner';
import { Inter } from 'next/font/google';

import useTranslations from '@/hooks/useTranslations';
Expand Down
2 changes: 1 addition & 1 deletion apps/example/utils/cookieManagerConfig.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Framework, Region, TrackerType, TrackingCategory } from 'cb-cookie-manager';
import { Framework, Region, TrackerType, TrackingCategory } from '@coinbase/cookie-manager';

export const cookieManagerConfig = {
categories: [
Expand Down
5 changes: 2 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"name": "@coinbase/cookie-manager",
"name": "cb-cookie-manager",
"version": "1.0.0",
"description": "Cookie Manager",
"author": "Sneh Koul <[email protected]>",
Expand All @@ -11,8 +11,7 @@
"test": "yarn workspaces run test"
},
"workspaces": [
"packages/cb-cookie-manager",
"packages/cb-cookie-banner",
"packages/*",
"apps/example"
],
"devDependencies": {
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -20,18 +20,18 @@ Install the package as follows:
**Note: This package requires react and react-dom as peer dependencies**

```shell
yarn add cb-cookie-manager cb-cookie-banner
yarn add @coinbase/cookie-manager @coinbase/cookie-banner

npm install cb-cookie-manager cb-cookie-banner
npm install @coinbase/cookie-manager @coinbase/cookie-banner

pnpm install cb-cookie-manager cb-cookie-banner
pnpm install @coinbase/cookie-manager @coinbase/cookie-banner
```

## UI

### Cookie Banner

This banner must be a child of `cb-cookie-manager` provider. It takes an optional theme prop (see [theme section](#theme)). Otherwise, it will default to the Coinbase theme.
This banner must be a child of `@coinbase/cookie-manager` provider. It takes an optional theme prop (see [theme section](#theme)). Otherwise, it will default to the Coinbase theme.

It takes the following props:

Expand All @@ -41,7 +41,7 @@ It takes the following props:
Example usage:

```typescript
import { CookieBanner } from 'cb-cookie-banner';
import { CookieBanner } from '@coinbase/cookie-banner';

const SomeComponent = () => {
return (
Expand All @@ -57,7 +57,7 @@ const SomeComponent = () => {

Modal to allow user's to choose their cookie preferences.

This modal must be a child of `cb-cookie-manager` Provider. It takes the following props:
This modal must be a child of `@coinbase/cookie-manager` Provider. It takes the following props:

```typescript
onClose: () => void: Callback to close the modal
Expand All @@ -71,7 +71,7 @@ Usage:

```typescript

import { CookiePreferencesModal } from 'cb-cookie-banner';
import { CookiePreferencesModal } from '@coinbase/cookie-banner';

const CookiePreferences = () => {
const [isOpen, setIsOpen] = useState(false);
Expand Down Expand Up @@ -102,7 +102,7 @@ It is used to determine if the user has already chosen their cookie preferences
If the user deletes this cookie or if `cm_default_preferences`/`cm_eu_preferences` expires (expiry of 1 year), it returns true.

```typescript
import { CookieBanner } from 'cb-cookie-banner';
import { CookieBanner } from '@coinbase/cookie-banner';

const SomeComponent = () => {
const visible = useIsBannerVisible();
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"name": "cb-cookie-banner",
"name": "@coinbase/cookie-banner",
"version": "1.0.0",
"main": "dist/index.js",
"license": "Apache-2.0",
Expand All @@ -25,7 +25,7 @@
"react-dom": "^18.1.0"
},
"dependencies": {
"cb-cookie-manager": "1.0.0",
"@coinbase/cookie-manager": "1.0.0",
"react-intl": "^6.5.1",
"styled-components": "^5.3.6"
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { TrackingCategory } from 'cb-cookie-manager';
import { TrackingCategory } from '@coinbase/cookie-manager';
import React, { memo } from 'react';
import { useIntl } from 'react-intl';

Expand Down
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
import { act, renderHook } from '@testing-library/react';
import {
Provider,
Region,
TrackingCategory,
TrackingPreference,
useSavedTrackingPreference,
} from 'cb-cookie-manager';
} from '@coinbase/cookie-manager';
import { act, renderHook } from '@testing-library/react';
import React from 'react';

import config from '../examples/config';
import { useBanner } from './CookieBanner';

jest.mock('cb-cookie-manager', () => {
const originalModule = jest.requireActual('cb-cookie-manager');
jest.mock('@coinbase/cookie-manager', () => {
const originalModule = jest.requireActual('@coinbase/cookie-manager');

return {
__esModule: true,
Expand All @@ -35,7 +35,7 @@
projectName="consumer-www"
region={region}
onPreferenceChange={onPreferenceChange}
log={console.log}

Check warning on line 38 in packages/cookie-banner/src/components/CookieBanner.test.tsx

View workflow job for this annotation

GitHub Actions / build (18.x)

Unexpected console statement
>
{children}
</Provider>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import {
useSavedTrackingPreferenceFromMobileApp,
useSetTrackingPreference,
useTrackingManager,
} from 'cb-cookie-manager';
} from '@coinbase/cookie-manager';
import React, { memo, useCallback, useEffect, useState } from 'react';

import { EXPIRATION_DAYS } from '../constants';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { useTrackingManager } from 'cb-cookie-manager';
import { useTrackingManager } from '@coinbase/cookie-manager';
import React, { memo, useCallback, useEffect } from 'react';
import { useIntl } from 'react-intl';
import styled, { css } from 'styled-components';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import {
useSetTrackingPreference,
useTrackingManager,
useTrackingPreference,
} from 'cb-cookie-manager';
} from '@coinbase/cookie-manager';
import React, { memo, useCallback, useEffect, useReducer } from 'react';
import { useIntl } from 'react-intl';
import styled from 'styled-components';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { useTrackingManager } from 'cb-cookie-manager';
import { useTrackingManager } from '@coinbase/cookie-manager';
import React from 'react';
import { IntlProvider } from 'react-intl';
import { ThemeProvider } from 'styled-components';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Framework, Region, TrackerType, TrackingCategory } from 'cb-cookie-manager';
import { Framework, Region, TrackerType, TrackingCategory } from '@coinbase/cookie-manager';

export default {
categories: [
Expand Down
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
import { renderHook } from '@testing-library/react';
import {
Region,
TrackingCategory,
TrackingPreference,
useSavedTrackingPreference,
} from 'cb-cookie-manager';
} from '@coinbase/cookie-manager';
import { renderHook } from '@testing-library/react';

import useIsBannerVisible from './useIsBannerVisible';

jest.mock('cb-cookie-manager', () => {
const originalModule = jest.requireActual('cb-cookie-manager');
jest.mock('@coinbase/cookie-manager', () => {
const originalModule = jest.requireActual('@coinbase/cookie-manager');

return {
__esModule: true,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { useSavedTrackingPreference } from 'cb-cookie-manager';
import { useSavedTrackingPreference } from '@coinbase/cookie-manager';

export default function useIsBannerVisible() {
return !useSavedTrackingPreference();
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Provider, Region } from '@coinbase/cookie-manager';
import { renderHook } from '@testing-library/react';
import { Provider, Region } from 'cb-cookie-manager';
import React from 'react';

import config from '../examples/config';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { useTrackingManager } from 'cb-cookie-manager';
import { useTrackingManager } from '@coinbase/cookie-manager';

import messages from '../utils/messages';

Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@

## Introduction

`cb-cookie-manager` helps manage the following first party client side cookie categories:
`@coinbase/cookie-manager` helps manage the following first party client side cookie categories:

- `Necessary Cookies`: Cookies that are necessary for the site to the function
- `Performance Cookies`: Cookies that impact site performance and help mesaure performance
Expand Down Expand Up @@ -50,7 +50,7 @@ import {
Region,
TrackerType,
TrackingCategory,
} from 'cb-cookie-manager';
} from '@coinbase/cookie-manager';

export default {
categories: [
Expand Down Expand Up @@ -138,11 +138,11 @@ In this example: `id_ac7a5c3da45e3612b44543a702e42b01` will also be allowed
Install the package as follows:

```shell
yarn add cb-cookie-manager
yarn add @coinbase/cookie-manager

npm install cb-cookie-manager
npm install @coinbase/cookie-manager

pnpm install cb-cookie-manager
pnpm install @coinbase/cookie-manager
```

## Methods
Expand Down Expand Up @@ -170,7 +170,7 @@ The provider must wrap the entire application and only be instantiated once. On
Example usage:

```typescript
import { Provider, Region, TrackingCategory, TrackingPreference } from 'cb-cookie-manager';
import { Provider, Region, TrackingCategory, TrackingPreference } from '@coinbase/cookie-manager';

<Provider
onError={notifyError}
Expand Down Expand Up @@ -270,7 +270,7 @@ const SomeComponent = () => {
This is a hook for programmatically determining if a tracker (e.g. cookie) has been consented to by the user.

```typescript
import { useHasConsent } from 'cb-cookie-manager';
import { useHasConsent } from '@coinbase/cookie-manager';

const SomeComponent = () => {
const hasConsent = useHasConsent('cookie');
Expand All @@ -289,7 +289,7 @@ This hook is used to determine which category of cookies is required.
Example Usage:

```typescript
import { useRequiredCategories, TRACKER_CATEGORIES } from 'cb-cookie-manager';
import { useRequiredCategories, TRACKER_CATEGORIES } from '@coinbase/cookie-manager';

const SomeComponent = () => {
const requiredCategories = useRequiredCategories();
Expand Down Expand Up @@ -320,7 +320,7 @@ This hook is used to retrieve the saved cookie preference in cache
Example Usage:

```typescript
import { useSavedTrackingPreference } from 'cb-cookie-manager';
import { useSavedTrackingPreference } from '@coinbase/cookie-manager';

const SomeComponent = () => {
const preference = useSavedTrackingPreference();
Expand All @@ -340,7 +340,7 @@ This hook is used to set the saved cookie preference in cache
Example Usage:

```typescript
import { useSetTrackingPreference, Region, TrackingCategory } from 'cb-cookie-manager';
import { useSetTrackingPreference, Region, TrackingCategory } from '@coinbase/cookie-manager';

const SomeComponent = () => {
const setTrackingPreference = useSetTrackingPreference();
Expand Down Expand Up @@ -370,7 +370,7 @@ This hook returns the cached preference and if no preference is cached, it retur
Example Usage:

```typescript
import { useTrackingPreference } from 'cb-cookie-manager';
import { useTrackingPreference } from '@coinbase/cookie-manager';

const SomeComponent = () => {
const initialTrackingPreference = useTrackingPreference();
Expand All @@ -391,7 +391,7 @@ Example usage:

```typescript

import { areCookiesEnabled } from 'cb-cookie-manager';
import { areCookiesEnabled } from '@coinbase/cookie-manager';


const SomeComponent = () => {
Expand All @@ -412,7 +412,7 @@ This hook is used to retrieve the default tracking preference for a given user b
Example usage:

```typescript
import { getDefaultTrackingPreference } from 'cb-cookie-manager';
import { getDefaultTrackingPreference } from '@coinbase/cookie-manager';

const SomeComponent = () => {
const preference = getDefaultTrackingPreference();
Expand All @@ -432,7 +432,7 @@ This hook is used to return `TrackingManagerDependencies` which includes all the
Example usage:

```typescript
import { isOptOut, useTrackingManager } from 'cb-cookie-manager';
import { isOptOut, useTrackingManager } from '@coinbase/cookie-manager';

const SomeComponent = () => {
const { region } = useTrackingManager();
Expand Down Expand Up @@ -460,7 +460,7 @@ It follows the following logic in order:
Example usage:

```typescript
import { isOptOut, useTrackingManager } from 'cb-cookie-manager';
import { isOptOut, useTrackingManager } from '@coinbase/cookie-manager';

const SomeComponent = () => {
const { region } = useTrackingManager();
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"name": "cb-cookie-manager",
"name": "@coinbase/cookie-manager",
"version": "1.0.0",
"description": "Coinbase Cookie Manager",
"main": "dist/index.js",
Expand Down
File renamed without changes.
1 change: 1 addition & 0 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -6693,6 +6693,7 @@ which@^2.0.1:
isexe "^2.0.0"

"wrap-ansi-cjs@npm:wrap-ansi@^7.0.0", wrap-ansi@^7.0.0:
name wrap-ansi-cjs
version "7.0.0"
resolved "https://registry.yarnpkg.com/wrap-ansi/-/wrap-ansi-7.0.0.tgz#67e145cff510a6a6984bdf1152911d69d2eb9e43"
integrity sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q==
Expand Down