New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@internetarchive/ia-sharing-options

Package Overview
Dependencies
Maintainers
13
Versions
15
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@internetarchive/ia-sharing-options - npm Package Compare versions

Comparing version 0.1.3-alpha2 to 0.1.3

2

package.json
{
"name": "@internetarchive/ia-sharing-options",
"version": "0.1.3-alpha2",
"version": "0.1.3",
"description": "Sharing options for Internet Archive items",

@@ -5,0 +5,0 @@ "author": "Shane Riley, Isa Herico Velasco, Internet Archive",

@@ -38,2 +38,3 @@ import { classMap } from 'lit-html/directives/class-map';

renderHeader: { type: Boolean },
fileSubPrefix: { type: String },
};

@@ -46,2 +47,3 @@ }

this.sharingOptions = [];
this.fileSubPrefix = '';
}

@@ -56,2 +58,3 @@

type,
fileSubPrefix,
} = this;

@@ -64,2 +67,3 @@ const params = {

type,
fileSubPrefix,
};

@@ -66,0 +70,0 @@

@@ -14,4 +14,4 @@ import '@internetarchive/icon-email/icon-email';

get url() {
return `mailto:?body=https://${this.baseHost}/details/${this.identifier}&subject=${this.description} : ${this.creator}${this.promoCopy}`;
return `mailto:?body=https://${this.baseHost}/details/${this.itemPath}&subject=${this.description} : ${this.creator}${this.promoCopy}`;
}
}
import '@internetarchive/icon-facebook/icon-facebook';
import { html } from 'lit-element';
import Provider from './provider.js';
export default class {
export default class extends Provider {
constructor(params) {
super(params);
this.name = 'Facebook';
this.icon = html`<ia-icon-facebook></ia-icon-facebook>`;
this.class = 'facebook';
Object.assign(this, params);
}
get url() {
return `https://www.facebook.com/sharer/sharer.php?u=https://${this.baseHost}/details/${this.identifier}`;
return `https://www.facebook.com/sharer/sharer.php?u=https://${this.baseHost}/details/${this.itemPath}`;
}
}

@@ -14,4 +14,4 @@ import '@internetarchive/icon-pinterest/icon-pinterest';

get url() {
return `http://www.pinterest.com/pin/create/button/?url=https://${this.baseHost}/details/${this.identifier}&description=${this.encodedDescription}+%3A+${this.encodedCreator}${this.encodedPromoCopy}`;
return `http://www.pinterest.com/pin/create/button/?url=https://${this.baseHost}/details/${this.itemPath}&description=${this.encodedDescription}+%3A+${this.encodedCreator}${this.encodedPromoCopy}`;
}
}

@@ -20,2 +20,7 @@ /* eslint-disable class-methods-use-this */

get itemPath() {
const encodedFileSubPrefix = this.fileSubPrefix ? encodeURIComponent(this.fileSubPrefix) : '';
return encodedFileSubPrefix ? `${this.identifier}/${encodedFileSubPrefix}` : this.identifier;
}
encodeString(str) {

@@ -22,0 +27,0 @@ return encodeURIComponent(str.replace(/\s/g, '+')).replace(/%2B/g, '+');

@@ -14,4 +14,4 @@ import '@internetarchive/icon-twitter/icon-twitter';

get url() {
return `https://twitter.com/intent/tweet?url=https://${this.baseHost}/details/${this.identifier}&via=internetarchive&text=${this.encodedDescription}+%3A+${this.encodedCreator}${this.encodedPromoCopy}`;
return `https://twitter.com/intent/tweet?url=https://${this.baseHost}/details/${this.itemPath}&via=internetarchive&text=${this.encodedDescription}+%3A+${this.encodedCreator}${this.encodedPromoCopy}`;
}
}
import { html, fixture, expect } from '@open-wc/testing';
import sinon from 'sinon';
import { IASharingOptions } from '../src/ia-sharing-options.js';
import '../src/ia-sharing-options.js';
customElements.define('ia-sharing-options', IASharingOptions);
const identifier = 'goody';

@@ -12,3 +10,3 @@ const itemType = 'book';

const container = () => (
const container = (optionalFileSubprefix = '') => (
html`<ia-sharing-options

@@ -19,2 +17,4 @@ identifier="${identifier}"

description="${description}"
baseHost="archive.org"
fileSubPrefix="${optionalFileSubprefix}"
></ia-sharing-options>`

@@ -69,2 +69,13 @@ );

});
it('sets file subprefix to end of share URLs if present', async () => {
const optionalFileSubprefix = 'foo- bar - 123-';
const el = await fixture(container(optionalFileSubprefix));
el.sharingOptions.forEach((option) => {
if (option.name !== 'Tumblr') {
expect(option.url).to.contain(encodeURIComponent(optionalFileSubprefix));
}
});
});
});

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