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

@arianee/utils

Package Overview
Dependencies
Maintainers
9
Versions
114
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@arianee/utils - npm Package Compare versions

Comparing version 1.0.0 to 1.1.0

4

package.json
{
"name": "@arianee/utils",
"version": "1.0.0",
"version": "1.1.0",
"type": "commonjs",

@@ -9,3 +9,3 @@ "dependencies": {

"peerDependencies": {
"@arianee/common-types": "1.0.0",
"@arianee/common-types": "1.1.0",
"tslib": "2.5.0"

@@ -12,0 +12,0 @@ },

@@ -0,1 +1,2 @@

import { BrandIdentity } from '@arianee/common-types';
/**

@@ -9,3 +10,3 @@ * Creates a valid proof / request / view link for a smart asset based on the protocol slug

*/
export declare const createLink: ({ slug, suffix, tokenId, passphrase, }: {
export declare const createLink: ({ slug, suffix, tokenId, passphrase, brandIdentity, }: {
slug: string;

@@ -15,2 +16,3 @@ suffix?: string | undefined;

passphrase: string;
brandIdentity?: BrandIdentity | undefined;
}) => string;

@@ -14,3 +14,7 @@ "use strict";

*/
const createLink = ({ slug, suffix = '', tokenId, passphrase, }) => {
const createLink = ({ slug, suffix = '', tokenId, passphrase, brandIdentity, }) => {
let customDomain;
if (brandIdentity) {
customDomain = extractCustomDomainFromBrandIdentity(brandIdentity);
}
if ((0, slug_1.isProtocolV2FromSlug)(slug)) {

@@ -20,6 +24,29 @@ return `https://arian.ee${suffix}/${tokenId},${passphrase},${slug}`;

else {
return `https://${(0, readLink_1.getHostnameFromProtocolName)(slug)}${suffix}/${tokenId},${passphrase}`;
return `https://${customDomain !== null && customDomain !== void 0 ? customDomain : (0, readLink_1.getHostnameFromProtocolName)(slug)}${suffix}/${tokenId},${passphrase}`;
}
};
exports.createLink = createLink;
/**
* Extracts the custom domain located in brand identity external contents if any
* @param brandIdentity the brand identity
* @returns the custom domain or undefined
*/
const extractCustomDomainFromBrandIdentity = (brandIdentity) => {
var _a, _b, _c;
let customDomain;
const deepLinkDomainUrl = (_c = (_b = (_a = brandIdentity === null || brandIdentity === void 0 ? void 0 : brandIdentity.rawContent) === null || _a === void 0 ? void 0 : _a.externalContents) === null || _b === void 0 ? void 0 : _b.find((ec) => ec.type === 'deepLinkDomain')) === null || _c === void 0 ? void 0 : _c.url;
if (deepLinkDomainUrl && (deepLinkDomainUrl === null || deepLinkDomainUrl === void 0 ? void 0 : deepLinkDomainUrl.length) > 0) {
customDomain = deepLinkDomainUrl;
if (customDomain.startsWith('http://')) {
customDomain = customDomain.replace('http://', '');
}
if (customDomain.startsWith('https://')) {
customDomain = customDomain.replace('https://', '');
}
if (customDomain.endsWith('/')) {
customDomain = customDomain.slice(0, -1);
}
}
return customDomain;
};
//# sourceMappingURL=createLink.js.map

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