@amplitude/plugin-custom-enrichment-browser 0.0.1

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 (3) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +63 -0
  3. package/package.json +55 -0
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2022 Amplitude Analytics
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,63 @@
1
+ <p align="center">
2
+ <a href="https://amplitude.com" target="_blank" align="center">
3
+ <img src="https://static.amplitude.com/lightning/46c85bfd91905de8047f1ee65c7c93d6fa9ee6ea/static/media/amplitude-logo-with-text.4fb9e463.svg" width="280">
4
+ </a>
5
+ <br />
6
+ </p>
7
+
8
+ # @amplitude/plugin-custom-enrichment-browser
9
+
10
+ Official Browser SDK plugin for custom enrichment
11
+
12
+ ## Installation
13
+
14
+ This package is published on NPM registry and is available to be installed using npm and yarn.
15
+
16
+ ```sh
17
+ # npm
18
+ npm install @amplitude/plugin-custom-enrichment-browser
19
+
20
+ # yarn
21
+ yarn add @amplitude/plugin-custom-enrichment-browser
22
+ ```
23
+
24
+ ## Usage
25
+
26
+ This plugin works on top of Amplitude Browser SDK and allows the user to execute custom functionality on their events. To use this plugin, you need to install `@amplitude/analytics-browser` version `v2.0.0` or later.
27
+
28
+ ### 1. Import Amplitude packages
29
+
30
+ * `@amplitude/plugin-custom-enrichment-browser`
31
+
32
+ ```typescript
33
+ import { customEnrichmentPlugin } from '@amplitude/plugin-custom-enrichment-browser';
34
+ ```
35
+
36
+ ### 2. Instantiate custom enrichment plugin
37
+ ```typescript
38
+ const customEnrichmentPlugin = customEnrichmentPlugin();
39
+ ```
40
+
41
+ #### Options
42
+
43
+
44
+ ### 3. Install plugin to Amplitude SDK
45
+
46
+ ```typescript
47
+ amplitude.add(customEnrichmentPlugin);
48
+ ```
49
+
50
+ ### 4. Initialize Amplitude SDK
51
+
52
+ ```typescript
53
+ amplitude.init('API_KEY');
54
+ ```
55
+
56
+ ## Result
57
+ This plugin executes a user-defined script, defined within Amplitude Remote Configuration Settings.
58
+
59
+ #### Event type
60
+ * No event type added
61
+
62
+ #### Event properties
63
+ * Defined by user
package/package.json ADDED
@@ -0,0 +1,55 @@
1
+ {
2
+ "name": "@amplitude/plugin-custom-enrichment-browser",
3
+ "version": "0.0.1",
4
+ "description": "",
5
+ "author": "Amplitude Inc",
6
+ "homepage": "https://github.com/amplitude/Amplitude-TypeScript",
7
+ "license": "MIT",
8
+ "main": "lib/cjs/index.js",
9
+ "module": "lib/esm/index.js",
10
+ "types": "lib/esm/index.d.ts",
11
+ "sideEffects": false,
12
+ "publishConfig": {
13
+ "access": "public",
14
+ "tag": "latest"
15
+ },
16
+ "repository": {
17
+ "type": "git",
18
+ "url": "git+https://github.com/amplitude/Amplitude-TypeScript.git"
19
+ },
20
+ "bugs": {
21
+ "url": "https://github.com/amplitude/Amplitude-TypeScript/issues"
22
+ },
23
+ "dependencies": {
24
+ "tslib": "^2.4.1",
25
+ "@amplitude/analytics-core": "2.42.0"
26
+ },
27
+ "devDependencies": {
28
+ "@rollup/plugin-commonjs": "^23.0.4",
29
+ "@rollup/plugin-node-resolve": "^15.0.1",
30
+ "@rollup/plugin-typescript": "^10.0.1",
31
+ "rollup": "^2.79.1",
32
+ "rollup-plugin-execute": "^1.1.1",
33
+ "rollup-plugin-gzip": "^3.1.0",
34
+ "rollup-plugin-terser": "^7.0.2"
35
+ },
36
+ "files": [
37
+ "lib"
38
+ ],
39
+ "scripts": {
40
+ "build": "pnpm bundle && pnpm build:es5 && pnpm build:esm",
41
+ "bundle": "rollup --config rollup.config.js",
42
+ "build:es5": "tsc -p ./tsconfig.es5.json",
43
+ "build:esm": "tsc -p ./tsconfig.esm.json",
44
+ "watch": "tsc -p ./tsconfig.esm.json --watch",
45
+ "clean": "rimraf node_modules lib coverage",
46
+ "fix": "pnpm fix:eslint & pnpm fix:prettier",
47
+ "fix:eslint": "eslint '{src,test}/**/*.ts' --fix",
48
+ "fix:prettier": "prettier --write \"{src,test}/**/*.ts\"",
49
+ "lint": "pnpm lint:eslint & pnpm lint:prettier",
50
+ "lint:eslint": "eslint '{src,test}/**/*.ts'",
51
+ "lint:prettier": "prettier --check \"{src,test}/**/*.ts\"",
52
+ "test": "jest",
53
+ "typecheck": "tsc -p ./tsconfig.json"
54
+ }
55
+ }