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

@wltech/hooks

Package Overview
Dependencies
Maintainers
8
Versions
216
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@wltech/hooks - npm Package Compare versions

Comparing version 0.0.27-alpha.32 to 0.0.27-alpha.33

2

package.json
{
"name": "@wltech/hooks",
"version": "0.0.27-alpha.32",
"version": "0.0.27-alpha.33",
"private": false,

@@ -5,0 +5,0 @@ "description": "",

@@ -8,3 +8,3 @@ /**

const hash = location.hash;
const title = document.title?.split('-') || [];
const title = document.title?.split("-") || [];
let page_path = hash?.substring(1);

@@ -15,6 +15,31 @@ const arr = page_path?.split("?");

page_query: arr?.[1],
page_title: title.length > 1 ? title.slice(1).join('-') : document.title,
page_title: title.length > 1 ? title.slice(1).join("-") : document.title,
};
};
const formatHistory = (splitTitle = false) => {
const path = window.location.pathname;
const search = window.location.search;
let page_path = path;
const arr = search?.substring(1).split("&");
let page_query: any = {};
if (arr) {
arr.forEach((query) => {
let parts = query.split("=");
page_query[parts[0]] = parts[1];
});
}
let split = "";
if (splitTitle) {
const title = document.title?.split("-") || [];
split = title.length > 1 ? title.slice(1).join("-") : document.title;
}
return {
page_path: page_path,
page_query: page_query,
page_title: splitTitle ? split : document.title,
};
};
/**

@@ -37,6 +62,20 @@ * 获取URL参数

/**
* sentry 设置全局tab
* sentry 设置全局tab hath模式
*/
export const sentryConfigureScopeTag = () => {
Sentry.configureScope((scope) => {
const { page_path, page_query, page_title } = formatHistory();
scope.setTag("url", location.href);
scope.setTag("corp_id", page_query?.["corp_id"]);
scope.setTag("page_search", location.search);
scope.setTag("page_path", page_path);
scope.setTag("page_name", page_title);
});
};
/**
* sentry 设置全局tab history模式
*/
export const sentryHistoryConfigureScopeTag = () => {
Sentry.configureScope((scope) => {
const { page_path, page_query, page_title } = formatHash();

@@ -94,7 +133,4 @@ scope.setTag("url", location.href);

*/
export const sentryCaptureEvent = (
message: string,
param?: {}
) => {
Sentry.captureEvent({ message, level: "info", ...param });
export const sentryCaptureEvent = (message: string, param?: {}) => {
Sentry.captureEvent({ message, level: "info", ...param });
};

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