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

mediapicker

Package Overview
Dependencies
Maintainers
1
Versions
100
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

mediapicker - npm Package Compare versions

Comparing version 4.2.2 to 5.0.0-test

lib/types/components/binary.d.ts

9

karma.conf.js

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

/*global process*/
// Karma configuration

@@ -103,2 +104,8 @@ // Generated on Mon Jan 04 2016 20:10:59 GMT+1100 (AEDT)

customLaunchers: {
headlessChrome: {
base: 'Chrome',
flags: [
'--headless'
]
},
bsChrome: {

@@ -112,3 +119,3 @@ base: 'BrowserStack',

}
})
});
};

@@ -40,9 +40,15 @@ var uploads = {};

$(function() {
var startTime = Date.now();
var Picker = MediaPicker.MediaPicker;
config.apiUrl = $('#apiUrl').val();
var contaner = $('body').get()[0];
popup = MediaPicker('popup', config, {container: contaner});
popup1 = MediaPicker('popup', config, {container: contaner});
popup = Picker('popup', config, {container: contaner});
popup1 = Picker('popup', config, {container: contaner});
popup.on('ready', function() {
$('#popup1ReadyLabel').addClass('success');
var loadTime = (Date.now() - startTime) / 1000;
$('#files').append('<div id="loadTime" class="fileitem"><br>Load time: ' + loadTime + 's</div>');
});

@@ -114,2 +120,6 @@

if (!data.preview) {
return;
}
var imageUrl = URL.createObjectURL(data.preview);

@@ -116,0 +126,0 @@

9

package.json
{
"name": "mediapicker",
"version": "4.2.2",
"version": "5.0.0-test",
"description": "Library for handling file uploads",
"main": "./lib/mediapicker.js",
"types": "./lib/types/index.d.ts",
"scripts": {

@@ -21,4 +22,6 @@ "start": "cd lib && http-server -p 8081 --cors",

"test-only": "(npm run start & node_modules/.bin/karma start --single-run); EX=$?; npm run kill-server; exit $EX",
"test-only-watch": "(npm run start & node_modules/.bin/karma start --no-single-run); EX=$?; npm run kill-server; exit $EX",
"s3-upload": "npm run test && npm run build && ./node_modules/.bin/grunt s3",
"pub": "npm run s3-upload && npm publish",
"release": "npm run test && npm run build && ./node_modules/.bin/grunt s3",
"ci-all": "npm run build-local && (npm run start & npm run ci-unit); EX=$?; npm run kill-server; exit $EX",

@@ -65,3 +68,3 @@ "ci-unit": "node_modules/.bin/karma start --single-run --browsers bsChrome"

"json-loader": "^0.5.4",
"karma": "^0.13.21",
"karma": "^1.6.0",
"karma-browserstack-launcher": "^1.1.1",

@@ -85,3 +88,3 @@ "karma-chrome-launcher": "^2.0.0",

"svgo-loader": "^1.1.0",
"ts-loader": "^0.8.1",
"ts-loader": "^0.9.5",
"ts-node": "^0.7.1",

@@ -88,0 +91,0 @@ "tslint": "^4.4.2",

@@ -215,3 +215,3 @@ /* CSS imports */

file: data.file,
preview: base64,
preview: data.preview,
originalEvent: {name: 'upload-preview-update', data}

@@ -224,3 +224,3 @@ });

file: data.file,
preview,
preview: data.preview,
originalEvent: {name: 'upload-preview-update', data}

@@ -227,0 +227,0 @@ });

@@ -19,2 +19,3 @@ import {ClientManager} from '../tools/clientManager';

const ws = new WsApi(urls.apiUrl, client);
parentChannel.send(messages.ready()); //se nding event that popup is ready to show

@@ -28,4 +29,2 @@ ws.on('NotifyIdUpdate', (newNotifyId) => {

parentChannel.send(messages.ready()); //sending event that popup is ready to show
parentChannel.listen('resetView', () => {

@@ -32,0 +31,0 @@ store.dispatch({type: 'RESET_VIEW'});

@@ -8,5 +8,6 @@ import * as $ from 'jquery';

import {MutatedFile} from '../util/typeExtensions';
import {JQueryBound} from './component';
export class MediaPickerClipboard extends MediaLocalUpload {
private _bound: {paste: Function};
private _bound: {paste: JQueryBound};

@@ -13,0 +14,0 @@ constructor(context: MediaPickerContext, config: ModuleConfig) {

@@ -16,2 +16,4 @@ import {MediaPickerContext} from '../domain/context';

export type JQueryBound = (eventObject: JQueryEventObject, ...args: any[]) => any;
export const EVENT_NAMES = {

@@ -18,0 +20,0 @@ UPLOAD_START: 'upload-start',

import {expect} from 'chai';
import * as $ from 'jquery';
import * as MediaPicker from '../index';
import {MediaPicker} from '../index';
import {ModuleConfig} from '../domain/config';

@@ -5,0 +5,0 @@ import {MediaPickerDropzone} from './dropzone';

@@ -9,2 +9,3 @@ import '!style!css!less!./dropzone.less';

import {ModuleConfig} from '../domain/config';
import {JQueryBound} from './component';

@@ -20,4 +21,4 @@ export interface DropzoneConfig {

private _binded: {
'dragover': Function,
'dragleave': Function
'dragover': JQueryBound,
'dragleave': JQueryBound
};

@@ -24,0 +25,0 @@ private _headless: boolean;

@@ -31,3 +31,3 @@ import {MediaAPI} from '../service/mediaAPI';

interface PopupConfig {
export interface PopupConfig {
container?: JQuery;

@@ -79,9 +79,5 @@ }

$(document).ready(() => {
this._createInstance().then(($instance) => {
$(this._$container).append($instance);
this._$instance = $instance;
this._initProtocols();
}, (error: Error) => {
handleError(error.name, error.message)
});
this._$instance = this._createInstance();
$(this._$container).append(this._$instance);
this._initProtocols();
})

@@ -154,16 +150,14 @@ }

private _createInstance(): Promise<JQuery> {
return new Promise<JQuery>((resolve) => {
const url = this.getStaticAssetUrl('popup');
private _createInstance(): JQuery {
const $instance = $(`
<div class="mediaPickerPopup mpAUI">
<section role="dialog" id="demo-dialog" class="aui-layer aui-dialog2 aui-dialog2-large" aria-hidden="false">
<div class="aui-dialog2-content">
<iframe class="mpApp" src="${this.getStaticAssetUrl('popupInject')}"></iframe>
</div>
</section>
</div>
`);
$.ajax(url)
.done((data) => {
const $instance = $($.parseHTML(data));
$instance.find('.mpApp').attr('src', this.getStaticAssetUrl('popupInject'));
resolve($instance);
})
.fail((jqXHR) => {
handleError('popup_load_fail', jqXHR.statusCode().status);
});
});
return $instance;
}

@@ -192,3 +186,7 @@

this.emitUploadStart(mediaFile);
this.emitUploadPreviewUpdate(mediaFile, convertBase64ToBlob(file.preview));
if (file.preview) {
this.emitUploadPreviewUpdate(mediaFile, convertBase64ToBlob(file.preview));
} else {
this.emitUploadPreviewUpdate(mediaFile, undefined);
}

@@ -195,0 +193,0 @@ this._shareFileWithTenant(uploadId, file.id);

import {handleError} from '../util/handleError';
import {ResumableFile} from 'resumablejs';
import {ResumableFile, ResumableChunk} from 'resumablejs';

@@ -93,3 +93,3 @@ export class MediaFile {

get chunks() {
get chunks(): ResumableChunk[] {
return (this._resumableFile) ? this._resumableFile.chunks : undefined;

@@ -96,0 +96,0 @@ }

@@ -15,8 +15,23 @@ import '!style!css!less!./aui-short.less';

const MediaPicker = function (...args: Array<any>) {
const _context: MediaPickerContext = {
interface MediaPickerComponents {
browser: any;
dropzone: any;
clipboard: any;
popup: any;
binary: any;
[propName: string]: any;
}
const isMediaPickerComponent = (component: any): component is Object => {
return !!component;
};
// tslint:disable-next-line:variable-name
export function MediaPicker(componentName: string, ...options: Array<any>): any {
const context: MediaPickerContext = {
trackEvent: trackEvent
};
const _components: any = {
const components: MediaPickerComponents = {
browser: MediaPickerBrowser,

@@ -29,20 +44,20 @@ dropzone: MediaPickerDropzone,

if (typeof args[0] !== 'string') {
if (typeof componentName !== 'string') {
handleError('wrong_component', `The component name is not valid`);
return;
}
const componentName = args.shift();
const component = components[componentName];
if (typeof _components[componentName] !== 'undefined') {
if (args.length === 0) {
return _components[componentName];
} else {
const _args = [null, _context].concat(args);
return new (Function.prototype.bind.apply(_components[componentName], _args));
}
} else {
if (!isMediaPickerComponent(component)) {
handleError('wrong_component', `The component ${componentName} does not exist`);
return;
}
if (options.length === 0) {
return components[componentName];
} else {
const args = [null, context, ...options];
return new (Function.prototype.bind.apply(components[componentName], args));
}
};
export = MediaPicker;
import {expect} from 'chai';
import * as MediaPicker from '../index';
import * as postis from 'postis';
import {InteractionLayer} from './popupInteraction';

@@ -8,3 +6,3 @@

const $container = document.createElement('div');
const popup = MediaPicker('popup', {}, $container);
const popup: any = {};
const iframe = document.createElement('iframe');

@@ -11,0 +9,0 @@

@@ -9,3 +9,3 @@ import {UserEventName} from './tracker';

constructor(name : UserEventName, properties : UserEventProperties) {
constructor(name: UserEventName, properties: UserEventProperties) {
this._prefix = 'files.mediapicker-web.';

@@ -12,0 +12,0 @@ this._name = this._prefix + name;

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

import herment = require('../../lib/herment.js');
import herment from '../../lib/herment';
import { UserEvent } from './events';

@@ -6,3 +6,3 @@

export type UserEventProperties = {
[key : string]: string | number | boolean;
[key: string]: string | number | boolean;
};

@@ -30,3 +30,3 @@

public track() {
public track(): any {
return (userEvent: UserEvent) => {

@@ -36,4 +36,4 @@ const event = userEvent.toJSON();

this._queue.push(event);
}
};
}
}
}

@@ -10,3 +10,3 @@ import axios from 'axios';

interface Client {
export interface Client {
id: string;

@@ -16,3 +16,3 @@ token: string;

interface MediaArtifact {
export interface MediaArtifact {
processingStatus: string;

@@ -19,0 +19,0 @@ url?: string;

{
"compilerOptions": {
"declaration": true,
"declarationDir": "./types",
"module": "commonjs",
"target": "es6",
"moduleResolution": "node",
"target": "es2015",
"noImplicitAny": true,
"outDir": "build/tmp",
"outDir": "./lib",
"rootDir": "./src",
"sourceMap": true,
"jsx": "react",
"allowJs": true,
"allowJs": false,
"typeRoots": [

@@ -12,0 +15,0 @@ "./node_modules/@types",

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

/*global process, __dirname*/
var webpack = require('webpack');
var path = require('path');

@@ -14,13 +16,13 @@ var svgoConfig = JSON.stringify({

publicPath: 'lib/',
path: './lib/',
path: path.resolve(__dirname, './lib'),
filename: 'mediapicker.js',
libraryTarget: "commonjs",
library: "MediaPicker"
libraryTarget: 'commonjs',
library: 'MediaPicker'
},
var: {
publicPath: 'lib/',
path: './lib/',
path: path.resolve(__dirname, './lib'),
filename: 'mediapicker.var.js',
libraryTarget: "var",
library: "MediaPicker"
libraryTarget: 'var',
library: 'MediaPicker'
}

@@ -27,0 +29,0 @@ };

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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