Skip to content

Commit

Permalink
feat: add type of plugin and version to init
Browse files Browse the repository at this point in the history
  • Loading branch information
jxiwang committed Aug 6, 2024
1 parent ad08175 commit 9e25cd3
Show file tree
Hide file tree
Showing 4 changed files with 40 additions and 34 deletions.
6 changes: 4 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
"author": "Amplitude Inc",
"license": "MIT",
"dependencies": {
"@amplitude/session-replay-browser": "1.9.4",
"@amplitude/session-replay-browser": "1.13.0",
"@segment/analytics-next": "^1.70.0",
"js-cookie": "^3.0.5",
"tslib": "^2.4.1"
Expand All @@ -26,7 +26,9 @@
"format:check": "prettier . --check",
"lint": "eslint . --fix",
"lint:check": "eslint .",
"test": "jest --runInBand ."
"test": "jest --runInBand .",
"version": "yarn version-file && GENERATE_SNIPPET=true yarn build",
"version-file": "echo '// Autogenerated by `yarn version-file`. DO NOT EDIT' > src/version.ts && node -p \"'export const VERSION = \\'' + require('./package.json').version + '\\';'\" >> src/version.ts"
},
"publishConfig": {
"access": "public",
Expand Down
4 changes: 3 additions & 1 deletion src/actions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import * as sessionReplay from '@amplitude/session-replay-browser';
import { Context, Plugin } from '@segment/analytics-next';
import Cookie from 'js-cookie';
import { AmplitudeIntegrationData, PluginOptions } from './types';
import { VERSION } from 'src/version';

const getStoredSessionId = () => {
const storedId = Cookie.get('amp_session_id') as string;
Expand Down Expand Up @@ -46,7 +47,7 @@ export const createSegmentActionsPlugin = async ({
const sessionReplayPlugin: Plugin = {
name: 'Session Replay Events',
type: 'enrichment',
version: '1.0.0',
version: VERSION,

isLoaded: () => true,
load: async (_ctx, ajs) => {
Expand All @@ -57,6 +58,7 @@ export const createSegmentActionsPlugin = async ({
...sessionReplayOptions,
sessionId: storedSessionId,
deviceId: deviceId || undefined,
version: { type: 'segment', version: VERSION },
}).promise;
},

Expand Down
2 changes: 2 additions & 0 deletions src/version.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
// Autogenerated by `yarn version-file`. DO NOT EDIT
export const VERSION = '0.3.1';
62 changes: 31 additions & 31 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,10 @@
"@amplitude/analytics-types" "^2.6.0"
tslib "^2.4.1"

"@amplitude/analytics-remote-config@^0.3.1":
version "0.3.1"
resolved "https://registry.yarnpkg.com/@amplitude/analytics-remote-config/-/analytics-remote-config-0.3.1.tgz#d81d21135a6959385071f465d62da94edc0ef05e"
integrity sha512-7flIkme7YYjyOC1l0ZeJkRPMc2SFl+b2e3k54v58noWmque2l3by2hftBeNM1l5Ao5i7IPkACORp6PvK+abXww==
"@amplitude/analytics-remote-config@^0.3.4":
version "0.3.4"
resolved "https://registry.yarnpkg.com/@amplitude/analytics-remote-config/-/analytics-remote-config-0.3.4.tgz#a9a3fd8db9585dd45e4ebd75da8cd31408606dc1"
integrity sha512-IdGJTJiHzkpUJtIOK3zmPtmMQ6p2z1U7Yxc4oC3kFK5+7MMZKDY1eFjszRzk/wQhCumPEp9MyGVd/SiN3LoBUQ==
dependencies:
"@amplitude/analytics-client-common" ">=1 <3"
"@amplitude/analytics-core" ">=1 <3"
Expand All @@ -41,49 +41,49 @@
resolved "https://registry.yarnpkg.com/@amplitude/analytics-types/-/analytics-types-2.6.0.tgz#00d1957d3f5eecb85e00ef4a1b2f65c497967d46"
integrity sha512-7MSENvLCTGjec7K45JT+RcOuoPTCvq1MMq/HRLiQK/BMR4taX7f/uXldEc8b//o+ZZP45IBqFroR7Bl8LwJQrQ==

"@amplitude/rrdom@^2.0.0-alpha.17":
version "2.0.0-alpha.17"
resolved "https://registry.yarnpkg.com/@amplitude/rrdom/-/rrdom-2.0.0-alpha.17.tgz#71bd4f34df1f13991df42d7744ec703209250a66"
integrity sha512-/U2rd5GWR08+Sv3xTocf+7BBqxwXrt3q355EVyRJBeMtkqZQ/BiXBzg3lPdrQh5jId5hxMIYgSkfDGbWnMMvdQ==
"@amplitude/rrdom@^2.0.0-alpha.19":
version "2.0.0-alpha.19"
resolved "https://registry.yarnpkg.com/@amplitude/rrdom/-/rrdom-2.0.0-alpha.19.tgz#b2f3de23862d7ba6989351e4a08144f90413fa38"
integrity sha512-zqPnAjwlUEPGHq2JpTnPjpI9LRdJeN0koaJ7dbQeQI5eJcNFtOjsLWpYgkBHjyQKKOh5FhBG0KVdX4L7y1Rmfg==
dependencies:
"@amplitude/rrweb-snapshot" "^2.0.0-alpha.17"
"@amplitude/rrweb-snapshot" "^2.0.0-alpha.19"

"@amplitude/rrweb-snapshot@^2.0.0-alpha.17":
version "2.0.0-alpha.17"
resolved "https://registry.yarnpkg.com/@amplitude/rrweb-snapshot/-/rrweb-snapshot-2.0.0-alpha.17.tgz#d1688915817264f8ac4218abbb656a52cc3d81d0"
integrity sha512-58XTamtFvvO9ENecBYIh4S/+QHcliFbM2aW/vCDzPcvmZjKRqhXKFuUshDEb/3M232hELVbB+YSMuUkDF4uLew==
"@amplitude/rrweb-snapshot@^2.0.0-alpha.19":
version "2.0.0-alpha.19"
resolved "https://registry.yarnpkg.com/@amplitude/rrweb-snapshot/-/rrweb-snapshot-2.0.0-alpha.19.tgz#a5c03ec52968a768827c20a8cc001dca6daae074"
integrity sha512-v+X3Ymdn0O4TBf4UFLJzNOWYxJqSu3fF+/FuXjORf74xc+5L6Tme/eY6mNZHigHJOGyIyFhlQXUUKm+CBiJcDw==

"@amplitude/rrweb-types@^2.0.0-alpha.17":
version "2.0.0-alpha.17"
resolved "https://registry.yarnpkg.com/@amplitude/rrweb-types/-/rrweb-types-2.0.0-alpha.17.tgz#c20a5b10bd451dd4813626bd99e32508c7865daf"
integrity sha512-9/azn1zAWe8QAb405szKwvUd2YCAc6l+aOxckYs/osyTGWA+kDQHZLoxvwng0C9LRDKeyXPap7ZZ879jV+Tebw==
"@amplitude/rrweb-types@^2.0.0-alpha.19":
version "2.0.0-alpha.19"
resolved "https://registry.yarnpkg.com/@amplitude/rrweb-types/-/rrweb-types-2.0.0-alpha.19.tgz#96a4d12341e4130f652959e708e2ced37c672220"
integrity sha512-Po0/Gp24Guvye/jr3aYPAVSqijQr1CETWSCK4DEriE8h03PcMs41JDeEjlJpHL/yHj76S6L7t3VCbiPOWT/OIg==
dependencies:
"@amplitude/rrweb-snapshot" "^2.0.0-alpha.17"
"@amplitude/rrweb-snapshot" "^2.0.0-alpha.19"

"@amplitude/rrweb@^2.0.0-alpha.14":
version "2.0.0-alpha.17"
resolved "https://registry.yarnpkg.com/@amplitude/rrweb/-/rrweb-2.0.0-alpha.17.tgz#5b59918524a53b89392e84d9d85fba0c4173732e"
integrity sha512-Kd1y+s/Ild9RChgC5MSbkqj7KaWh5XUPaJQH6Xmg1LpT+dMh+KiYj83IMk4S2ejOAK1ZbbgPt6Zwxtkk/X/Jcw==
"@amplitude/rrweb@2.0.0-alpha.19":
version "2.0.0-alpha.19"
resolved "https://registry.yarnpkg.com/@amplitude/rrweb/-/rrweb-2.0.0-alpha.19.tgz#b1292862f65bc777128715497c9719476e47908b"
integrity sha512-bemevshhw7gVYFT5fMCfRQZgQPV0rsY0zAb91NmRVrOivGXOQtSyPZ5othnGn2it4x5kFZyGAIAlMPtWCqhM8A==
dependencies:
"@amplitude/rrdom" "^2.0.0-alpha.17"
"@amplitude/rrweb-snapshot" "^2.0.0-alpha.17"
"@amplitude/rrweb-types" "^2.0.0-alpha.17"
"@amplitude/rrdom" "^2.0.0-alpha.19"
"@amplitude/rrweb-snapshot" "^2.0.0-alpha.19"
"@amplitude/rrweb-types" "^2.0.0-alpha.19"
"@types/css-font-loading-module" "0.0.7"
"@xstate/fsm" "^1.4.0"
base64-arraybuffer "^1.0.1"
fflate "^0.4.4"
mitt "^3.0.0"

"@amplitude/session-replay-browser@1.9.4":
version "1.9.4"
resolved "https://registry.yarnpkg.com/@amplitude/session-replay-browser/-/session-replay-browser-1.9.4.tgz#1064e020513ef4bc3927943a2dcf3cef5f05394b"
integrity sha512-4pVem47rLmVhC4f3eb4byJdZ53kypC/cIPwsGRsvQ8vHbR+dGormpcBfCxMNrTXc64bjTKqbdSRagMy/5JoBlA==
"@amplitude/session-replay-browser@1.13.0":
version "1.13.0"
resolved "https://registry.yarnpkg.com/@amplitude/session-replay-browser/-/session-replay-browser-1.13.0.tgz#067c84d968dcb3a28dff69749b4f852e778bf1a2"
integrity sha512-pqCA4HHHy2XsWGKqNzTwdiNPCNEOsyAxmra0tY3et5cd0h2m8/7QCI3BSLLB/yFfbtXj32wGaS6U9O6uGlg95w==
dependencies:
"@amplitude/analytics-client-common" ">=1 <3"
"@amplitude/analytics-core" ">=1 <3"
"@amplitude/analytics-remote-config" "^0.3.1"
"@amplitude/analytics-remote-config" "^0.3.4"
"@amplitude/analytics-types" ">=1 <3"
"@amplitude/rrweb" "^2.0.0-alpha.14"
"@amplitude/rrweb" "2.0.0-alpha.19"
idb "^8.0.0"
tslib "^2.4.1"

Expand Down

0 comments on commit 9e25cd3

Please sign in to comment.