@bruit/component
Advanced tools
Comparing version 1.0.7-beta1 to 1.0.8-1
@@ -0,0 +0,0 @@ # Changelog |
@@ -0,0 +0,0 @@ export function appendCore(brtCoreConfig) { |
@@ -0,0 +0,0 @@ "use strict"; |
@@ -0,0 +0,0 @@ "use strict"; |
@@ -0,0 +0,0 @@ "use strict"; |
// bruit: ES Module |
@@ -0,0 +0,0 @@ "use strict"; |
@@ -0,0 +0,0 @@ "use strict"; |
@@ -0,0 +0,0 @@ "use strict"; |
@@ -0,0 +0,0 @@ "use strict"; |
@@ -0,0 +0,0 @@ "use strict"; |
@@ -0,0 +0,0 @@ "use strict"; |
@@ -0,0 +0,0 @@ "use strict"; |
@@ -0,0 +0,0 @@ "use strict"; |
@@ -0,0 +0,0 @@ "use strict"; |
@@ -0,0 +0,0 @@ "use strict"; |
@@ -40,6 +40,2 @@ import html2canvas from '@bruit/html2canvas'; | ||
const canvas = await html2canvas(div, options); | ||
if (!('toBlob' in canvas)) { | ||
console.log('HTMLCanvasElement does not contain toBlob method, will create it'); | ||
import('../polyfills/canvas.toBlob.polyfill'); | ||
} | ||
canvas.toBlob((result) => { | ||
@@ -46,0 +42,0 @@ resolve(result); |
@@ -48,3 +48,3 @@ import { BrtFieldType } from '@bruit/types/dist/enums/brt-field-type'; | ||
if (NavigatorTool.isMobileOrTablet()) { | ||
return new Promise((resolve) => { | ||
return new Promise(resolve => { | ||
document.getElementById('bruit-io-submit-button').focus(); | ||
@@ -134,2 +134,30 @@ setTimeout(() => resolve(), 500); | ||
} | ||
static catchError(apiKey, agreement, error) { | ||
const errorInfos = []; | ||
errorInfos.push(this.getErrorType(error)); | ||
this.getErrorData(error).forEach(data => { | ||
errorInfos.push(data); | ||
}); | ||
BruitCore.send(apiKey, agreement, errorInfos); | ||
} | ||
static getErrorType(error) { | ||
return { label: 'Type', value: error.constructor.name }; | ||
} | ||
static getErrorData(error) { | ||
const errorData = []; | ||
const errorDataWantedKeys = ['Message', 'Stack']; | ||
errorDataWantedKeys.forEach(displayKey => { | ||
const key = displayKey.substring(0, 1).toLowerCase() + displayKey.substring(1); | ||
if (error[key]) { | ||
errorData.push({ label: displayKey, value: error[key] }); | ||
} | ||
}); | ||
Object.keys(error.constructor).forEach(key => { | ||
const displayKey = key.substring(0, 1).toUpperCase() + key.substring(1); | ||
if (!errorDataWantedKeys.includes(displayKey)) { | ||
errorData.push({ label: displayKey, value: error[key] }); | ||
} | ||
}); | ||
return errorData; | ||
} | ||
destroyFeedback() { | ||
@@ -234,3 +262,7 @@ return this.closeModal().then(() => { | ||
modal() { | ||
return (h("div", { id: "bruit-io-wrapper", class: this.modalOpened ? 'bruit-open' : 'bruit-close', style: { 'background-color': this._bruitIoConfig ? this._bruitIoConfig.colors.background : 'transparent' }, "data-html2canvas-ignore": true }, | ||
return (h("div", { id: "bruit-io-wrapper", class: this.modalOpened ? 'bruit-open' : 'bruit-close', style: { | ||
'background-color': this._bruitIoConfig | ||
? this._bruitIoConfig.colors.background | ||
: 'transparent' | ||
}, "data-html2canvas-ignore": true }, | ||
h("div", { class: "bruit-modal", onClick: event => { | ||
@@ -268,3 +300,6 @@ event.stopPropagation(); | ||
if (!this.modalError) { | ||
return (h("button", { type: "submit", id: "bruit-io-submit-button", style: { color: this._bruitIoConfig.colors.header, 'border-color': this._bruitIoConfig.colors.header } }, | ||
return (h("button", { type: "submit", id: "bruit-io-submit-button", style: { | ||
color: this._bruitIoConfig.colors.header, | ||
'border-color': this._bruitIoConfig.colors.header | ||
} }, | ||
h("svg", { class: "bruit-svg-icon", viewBox: "0 0 20 20" }, | ||
@@ -300,4 +335,10 @@ h("path", { class: "bruit-no-color", fill: this._bruitIoConfig.colors.header, d: "M7.629,14.566c0.125,0.125,0.291,0.188,0.456,0.188c0.164,0,0.329-0.062,0.456-0.188l8.219-8.221c0.252-0.252,0.252-0.659,0-0.911c-0.252-0.252-0.659-0.252-0.911,0l-7.764,7.763L4.152,9.267c-0.252-0.251-0.66-0.251-0.911,0c-0.252,0.252-0.252,0.66,0,0.911L7.629,14.566z" })), | ||
} | ||
case BrtFieldType.SELECT: { | ||
return this.selectField(field); | ||
} | ||
default: { | ||
const err = { code: 116, text: `"${field.type}" field type is not supported` }; | ||
const err = { | ||
code: 116, | ||
text: `"${field.type}" field type is not supported` | ||
}; | ||
console.error('BRUIT.IO error : ', err); | ||
@@ -352,2 +393,11 @@ this.onError.emit(err); | ||
} | ||
selectField(field) { | ||
let options = []; | ||
for (let i = 0; i < field.options.length; i++) { | ||
options.push(h("option", { value: field.options[i] }, field.options[i])); | ||
} | ||
return (h("div", { class: "bruit-group" }, | ||
h("label", { htmlFor: field.id }, field.label), | ||
h("select", { id: field.id }, options))); | ||
} | ||
theming() { | ||
@@ -354,0 +404,0 @@ return (h("style", null, 'bruit-core .bruit-group .bruit-bar:before, bruit-core .bruit-group .bruit-bar:after{' + |
@@ -66,3 +66,3 @@ import { BruitIoConfig } from '../../models/bruit-io-config.class'; | ||
h("svg", { viewBox: "0 0 96 96", width: "30", height: "30", xmlns: "http://www.w3.org/2000/svg" }, | ||
h("path", { d: "M73.3,35.3h-8.9c-1.4-2.5-3.4-4.6-5.8-6.2l5.2-5.2l-4.5-4.5l-6.9,6.9C51,26,49.6,25.8,48,25.8\ns-3,0.2-4.5,0.5l-6.9-6.9L32.2,24l5.1,5.2c-2.3,1.6-4.3,3.7-5.7,6.2h-8.9v6.3h6.6c-0.2,1-0.3,2.1-0.3,3.2V48h-6.3v6.3H29v3.2\nc0,1.1,0.1,2.1,0.3,3.2h-6.6V67h8.9c3.3,5.7,9.4,9.5,16.4,9.5s13.1-3.8,16.4-9.5h8.9v-6.3h-6.6c0.2-1,0.3-2.1,0.3-3.2v-3.2h6.3V48\nH67v-3.2c0-1.1-0.1-2.1-0.3-3.2h6.6V35.3z M54.3,60.7H41.7v-6.3h12.7V60.7z M54.3,48H41.7v-6.3h12.7V48z" })))); | ||
h("path", { d: "M73.3,35.3h-8.9c-1.4-2.5-3.4-4.6-5.8-6.2l5.2-5.2l-4.5-4.5l-6.9,6.9C51,26,49.6,25.8,48,25.8\r\ns-3,0.2-4.5,0.5l-6.9-6.9L32.2,24l5.1,5.2c-2.3,1.6-4.3,3.7-5.7,6.2h-8.9v6.3h6.6c-0.2,1-0.3,2.1-0.3,3.2V48h-6.3v6.3H29v3.2\r\nc0,1.1,0.1,2.1,0.3,3.2h-6.6V67h8.9c3.3,5.7,9.4,9.5,16.4,9.5s13.1-3.8,16.4-9.5h8.9v-6.3h-6.6c0.2-1,0.3-2.1,0.3-3.2v-3.2h6.3V48\r\nH67v-3.2c0-1.1-0.1-2.1-0.3-3.2h6.6V35.3z M54.3,60.7H41.7v-6.3h12.7V60.7z M54.3,48H41.7v-6.3h12.7V48z" })))); | ||
} | ||
@@ -69,0 +69,0 @@ } |
@@ -66,3 +66,4 @@ import { BrtFieldType } from '@bruit/types/dist/enums/brt-field-type'; | ||
} | ||
if (!config.apiKey && (!config.apiUrl || config.apiUrl === Config['BRUIT_IO_API_URL'])) { | ||
if (!config.apiKey && | ||
(!config.apiUrl || config.apiUrl === Config['BRUIT_IO_API_URL'])) { | ||
return { | ||
@@ -123,3 +124,5 @@ code: 101, | ||
const allTypes = Object.keys(BrtFieldType).map(BrtFieldTypeKey => BrtFieldType[BrtFieldTypeKey]); | ||
const badTypes = form.map(field => field.type).filter(type => !allTypes.includes(type)); | ||
const badTypes = form | ||
.map(field => field.type) | ||
.filter(type => !allTypes.includes(type)); | ||
if (badTypes.length > 0) { | ||
@@ -126,0 +129,0 @@ return { |
@@ -0,0 +0,0 @@ export { |
@@ -0,0 +0,0 @@ "use strict"; |
@@ -0,0 +0,0 @@ import { |
@@ -0,0 +0,0 @@ import { BrtFeedback } from '@bruit/types'; |
@@ -0,0 +0,0 @@ import { BrtCookies, BrtData, BrtFeedback, BrtField, BrtLog, BrtNavigatorInfo, BrtScreenInfo, BrtServiceWorker } from '@bruit/types'; |
@@ -0,0 +0,0 @@ export declare class ClickTool { |
@@ -0,0 +0,0 @@ import { BruitCoreConfig } from '../models/bruit-core-config.class'; |
@@ -0,0 +0,0 @@ export declare class HttpTool { |
@@ -0,0 +0,0 @@ import { BrtCookies, BrtNavigatorInfo, BrtNetwork, BrtPermissions, BrtServiceWorker, BrtServiceWorkerState, BrtStorageEstimate } from "@bruit/types"; |
@@ -0,0 +0,0 @@ import { BrtScreenInfo } from '@bruit/types'; |
@@ -0,0 +0,0 @@ export declare class UrlTool { |
@@ -56,4 +56,13 @@ import '../../stencil.core'; | ||
sendFeedback(apiKey: any, agreement: any, data: any, dataFn: any): Promise<any>; | ||
static send(apiKey: any, agreement: any, data: any, dataFn: any): Promise<any>; | ||
static send(apiKey: any, agreement: any, data: any, dataFn?: any): Promise<any>; | ||
static catchError(apiKey: any, agreement: any, error: any): void; | ||
static getErrorType(error: Error): { | ||
label: string; | ||
value: string; | ||
}; | ||
/** | ||
* Search for error keys in error and returns each found keys and its value as BruitData | ||
*/ | ||
static getErrorData(error: Error): any[]; | ||
/** | ||
* close the modal and destroy the _currentFeedback | ||
@@ -94,3 +103,4 @@ */ | ||
ratingField(field: BrtField): JSX.Element; | ||
selectField(field: BrtField): JSX.Element; | ||
theming(): JSX.Element; | ||
} |
@@ -0,0 +0,0 @@ import '../../stencil.core'; |
@@ -0,0 +0,0 @@ import '../../stencil.core'; |
export declare function colorLuminance(hex: any, lum: any): string; |
@@ -0,0 +0,0 @@ export declare enum SubmitButtonState { |
@@ -0,0 +0,0 @@ declare module "*.json" { |
@@ -0,0 +0,0 @@ import { BrtCoreConfig, BrtError } from '@bruit/types'; |
@@ -0,0 +0,0 @@ import { BrtConfig, BrtError, BrtField } from '@bruit/types'; |
@@ -0,0 +0,0 @@ export * from './components'; |
{ | ||
"name": "@bruit/component", | ||
"version": "1.0.7-beta1", | ||
"version": "1.0.8-1", | ||
"description": "send your feedbacks with bruit.io", | ||
@@ -56,3 +56,3 @@ "keywords": [ | ||
"@bruit/html2canvas": "1.0.0-alpha.12.bruit", | ||
"@bruit/types": ">=0.2.26", | ||
"@bruit/types": "0.2.26-4", | ||
"bowser": "^2.4.0", | ||
@@ -59,0 +59,0 @@ "lz-string": "^1.4.4" |
@@ -0,0 +0,0 @@ <p align="center"> |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
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
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 too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
Dynamic require
Supply chain riskDynamic require can indicate the package is performing dangerous or unsafe dynamic code execution.
Found 1 instance in 1 package
Minified code
QualityThis package contains minified code. This may be harmless in some cases where minified code is included in packaged libraries, however packages on npm should not minify code.
Found 1 instance in 1 package
3480587
28176
5
13
41
102
+ Added@bruit/types@0.2.26-4(transitive)
+ Added@firebase/app-types@0.3.10(transitive)
+ Added@firebase/firestore-types@0.7.0(transitive)
- Removed@bruit/types@1.4.0(transitive)
- Removed@firebase/app-types@0.7.0(transitive)
- Removed@firebase/firestore-types@2.5.0(transitive)
- Removed@firebase/util@1.11.0(transitive)
- Removedtslib@2.8.1(transitive)
Updated@bruit/types@0.2.26-4