Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

aws-rum-react

Package Overview
Dependencies
Maintainers
1
Versions
9
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

aws-rum-react - npm Package Compare versions

Comparing version 1.0.3 to 1.0.4

dist/types/components/mock-aws-rum-provider/index.d.ts

153

dist/esm/index.js

@@ -1,15 +0,124 @@

import { _ as __rest, A as AwsRumContext, a as __assign, b as __spreadArray, c as __read } from './aws-rum-9399e3a5.js';
import { jsx } from 'react/jsx-runtime';
import { AwsRum } from 'aws-rum-web';
import { useMemo, useContext, useCallback } from 'react';
import {jsx}from'react/jsx-runtime';import {AwsRum}from'aws-rum-web';import {createContext,useMemo,useRef,useContext,useCallback}from'react';/******************************************************************************
Copyright (c) Microsoft Corporation.
function AwsRumProvider(_a) {
Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
PERFORMANCE OF THIS SOFTWARE.
***************************************************************************** */
var __assign = function() {
__assign = Object.assign || function __assign(t) {
for (var s, i = 1, n = arguments.length; i < n; i++) {
s = arguments[i];
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
}
return t;
};
return __assign.apply(this, arguments);
};
function __rest(s, e) {
var t = {};
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
t[p] = s[p];
if (s != null && typeof Object.getOwnPropertySymbols === "function")
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
t[p[i]] = s[p[i]];
}
return t;
}
function __read(o, n) {
var m = typeof Symbol === "function" && o[Symbol.iterator];
if (!m) return o;
var i = m.call(o), r, ar = [], e;
try {
while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
}
catch (error) { e = { error: error }; }
finally {
try {
if (r && !r.done && (m = i["return"])) m.call(i);
}
finally { if (e) throw e.error; }
}
return ar;
}
function __spreadArray(to, from, pack) {
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
if (ar || !(i in from)) {
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
ar[i] = from[i];
}
}
return to.concat(ar || Array.prototype.slice.call(from));
}var AwsRumContext = createContext(null);function AwsRumProvider(_a) {
var children = _a.children, id = _a.id, region = _a.region, version = _a.version, config = __rest(_a, ["children", "id", "region", "version"]);
var client = useMemo(function () { return new AwsRum(id, version, region, config); }, [config, id, region, version]);
return (jsx(AwsRumContext.Provider, __assign({ value: client }, { children: children })));
}
var MISSING_AWS_RUM_CONTEXT_ERROR = new Error('Expected the AWS RUM context to be provided.');
function useAwsRum() {
}function mapRefToFunction(ref) {
return function refFunction() {
var args = [];
for (var _i = 0; _i < arguments.length; _i++) {
args[_i] = arguments[_i];
}
return ref.current.apply(ref, __spreadArray([], __read(args), false));
};
}function noop() {
return;
}function MockAwsRumProvider(_a) {
var _b = _a.addPlugin, addPlugin = _b === void 0 ? noop : _b, _c = _a.addSessionAttributes, addSessionAttributes = _c === void 0 ? noop : _c, _d = _a.allowCookies, allowCookies = _d === void 0 ? noop : _d, children = _a.children, _e = _a.disable, disable = _e === void 0 ? noop : _e, _f = _a.dispatch, dispatch = _f === void 0 ? noop : _f, _g = _a.dispatchBeacon, dispatchBeacon = _g === void 0 ? noop : _g, _h = _a.enable, enable = _h === void 0 ? noop : _h, _j = _a.recordError, recordError = _j === void 0 ? noop : _j, _k = _a.recordEvent, recordEvent = _k === void 0 ? noop : _k, _l = _a.recordPageView, recordPageView = _l === void 0 ? noop : _l, _m = _a.registerDomEvents, registerDomEvents = _m === void 0 ? noop : _m, _o = _a.setAwsCredentials, setAwsCredentials = _o === void 0 ? noop : _o;
var addPluginRef = useRef(addPlugin);
var addSessionAttributesRef = useRef(addSessionAttributes);
var allowCookiesRef = useRef(allowCookies);
var disableRef = useRef(disable);
var dispatchBeaconRef = useRef(dispatchBeacon);
var dispatchRef = useRef(dispatch);
var enableRef = useRef(enable);
var registerDomEventsRef = useRef(registerDomEvents);
var recordErrorRef = useRef(recordError);
var recordEventRef = useRef(recordEvent);
var recordPageViewRef = useRef(recordPageView);
var setAwsCredentialsRef = useRef(setAwsCredentials);
addPluginRef.current = addPlugin;
addSessionAttributesRef.current = addSessionAttributes;
allowCookiesRef.current = allowCookies;
disableRef.current = disable;
dispatchBeaconRef.current = dispatchBeacon;
dispatchRef.current = dispatch;
enableRef.current = enable;
recordErrorRef.current = recordError;
recordEventRef.current = recordEvent;
recordPageViewRef.current = recordPageView;
registerDomEventsRef.current = registerDomEvents;
setAwsCredentialsRef.current = setAwsCredentials;
var client = useMemo(function () {
var newClient = {
addSessionAttributes: mapRefToFunction(addSessionAttributesRef),
addPlugin: mapRefToFunction(addPluginRef),
allowCookies: mapRefToFunction(allowCookiesRef),
disable: mapRefToFunction(disableRef),
dispatch: mapRefToFunction(dispatchRef),
dispatchBeacon: mapRefToFunction(dispatchBeaconRef),
enable: mapRefToFunction(enableRef),
recordError: mapRefToFunction(recordErrorRef),
recordEvent: mapRefToFunction(recordEventRef),
recordPageView: mapRefToFunction(recordPageViewRef),
registerDomEvents: mapRefToFunction(registerDomEventsRef),
setAwsCredentials: mapRefToFunction(setAwsCredentialsRef),
};
Object.setPrototypeOf(newClient, AwsRum.prototype);
return newClient;
}, []);
return (jsx(AwsRumContext.Provider, __assign({ value: client }, { children: children })));
}var MISSING_AWS_RUM_CONTEXT_ERROR = new Error('Expected the AWS RUM context to be provided.');function useAwsRum() {
var client = useContext(AwsRumContext);

@@ -20,5 +129,3 @@ if (client === null) {

return client;
}
function withAwsRum(Component) {
}function withAwsRum(Component) {
return function AwsRumComponent(props) {

@@ -28,5 +135,3 @@ var awsRum = useAwsRum();

};
}
function withRecordError(Component) {
}function withRecordError(Component) {
return function AwsRumComponent(props) {

@@ -39,5 +144,3 @@ var awsRum = useAwsRum();

};
}
function useRecordError() {
}function useRecordError() {
var client = useAwsRum();

@@ -51,5 +154,3 @@ return useCallback(function () {

}, [client]);
}
function useRecordEvent() {
}function useRecordEvent() {
var client = useAwsRum();

@@ -63,5 +164,3 @@ return useCallback(function () {

}, [client]);
}
function useRecordPageView() {
}function useRecordPageView() {
var client = useAwsRum();

@@ -75,4 +174,2 @@ return useCallback(function () {

}, [client]);
}
export { AwsRumProvider, useAwsRum, useRecordError, useRecordEvent, useRecordPageView, withAwsRum, withRecordError };
}export{AwsRumProvider,MockAwsRumProvider,useAwsRum,useRecordError,useRecordEvent,useRecordPageView,withAwsRum,withRecordError};
export type { AwsRum, AwsRumConfig, ClientBuilder, PageIdFormat, PartialCookieAttributes, Plugin, Telemetry, } from 'aws-rum-web';
export { default as AwsRumProvider } from './components/aws-rum-provider';
export { default as MockAwsRumProvider } from './components/mock-aws-rum-provider';
export { default as withAwsRum } from './hocs/with-aws-rum';

@@ -4,0 +5,0 @@ export { default as withRecordError } from './hocs/with-record-error';

31

package.json
{
"name": "aws-rum-react",
"version": "1.0.3",
"version": "1.0.4",
"author": "Charles Stover <aws-rum-react@charlesstover.com>",

@@ -26,8 +26,2 @@ "description": "Amazon CloudWatch RUM React client",

"default": "./dist/esm/index.js"
},
"./jest": {
"types": "./dist/types/jest.d.ts",
"import": "./dist/esm/jest.js",
"require": "./dist/cjs/jest.cjs",
"default": "./dist/esm/jest.js"
}

@@ -53,12 +47,12 @@ },

"devDependencies": {
"@babel/core": "^7.20.5",
"@babel/core": "^7.20.7",
"@babel/preset-env": "^7.20.2",
"@babel/preset-react": "^7.18.6",
"@babel/preset-typescript": "^7.18.6",
"@monorepo-template/eslint-config": "^1.0.4",
"@monorepo-template/jest-module-preset": "^1.1.2",
"@monorepo-template/rollup-config": "^2.4.1",
"@monorepo-template/eslint-config": "^1.0.5",
"@monorepo-template/jest-module-preset": "^1.1.3",
"@monorepo-template/rollup-config": "^3.0.0",
"@monorepo-template/tsconfig": "^1.1.2",
"@rollup/plugin-commonjs": "^23.0.5",
"@rollup/plugin-json": "^5.0.2",
"@rollup/plugin-commonjs": "^24.0.0",
"@rollup/plugin-json": "^6.0.0",
"@rollup/plugin-node-resolve": "^15.0.1",

@@ -68,7 +62,7 @@ "@testing-library/react": "^13.4.0",

"@types/jest": "^29.2.4",
"@types/node": "^18.11.15",
"@types/node": "^18.11.17",
"@types/react": "^18.0.26",
"aws-rum-web": "^1.12.0",
"babel-jest": "^29.3.1",
"eslint": "^8.29.0",
"eslint": "^8.30.0",
"eslint-plugin-jsx-a11y": "^6.6.1",

@@ -82,13 +76,14 @@ "eslint-plugin-react": "^7.31.11",

"react-dom": "^18.2.0",
"rollup": "^3.7.4",
"rollup": "^3.8.1",
"rollup-plugin-insert": "^1.3.2",
"rollup-plugin-typescript2": "^0.34.1",
"tslib": "^2.4.1",
"typescript": "4.9.3",
"typescript": "^4.9.4",
"unknown2string": "^1.0.0",
"whatwg-fetch": "^3.6.2"
},
"peerDependencies": {
"aws-rum-web": "^1.0.0",
"aws-rum-web": ">=1.0.0",
"react": ">=17.0.0"
}
}

@@ -227,3 +227,3 @@ # Amazon CloudWatch RUM React client

import { render } from '@testing-library/react';
import { TestAwsRumProvider } from 'aws-rum-react/jest';
import { MockAwsRumProvider } from 'aws-rum-react';
import type { PropsWithChildren, ReactElement } from 'react';

@@ -239,5 +239,5 @@ import MyComponent from './MyComponent';

return (
<TestAwsRumProvider recordError={TEST_RECORD_ERROR}>
<MockAwsRumProvider recordError={TEST_RECORD_ERROR}>
{children}
</TestAwsRumProvider>
</MockAwsRumProvider>
);

@@ -244,0 +244,0 @@ },

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc