@goodshuffle/gspro-wc
Advanced tools
Comparing version 0.0.1-SNAPSHOT.6 to 0.0.1-SNAPSHOT.7
{ | ||
"entries": [ | ||
"components/gspro-categories/gspro-categories.js", | ||
"components/gspro-duration/gspro-duration.js", | ||
"components/gspro-item-card/gspro-item-card.js", | ||
"components/gspro-categories/gspro-categories.js", | ||
"components/gspro-item-choices/gspro-item-choices.js", | ||
"components/gspro-item-detail/gspro-item-detail.js", | ||
"components/gspro-item-choices/gspro-item-choices.js", | ||
"components/gspro-item-list/gspro-item-list.js", | ||
"components/gspro-item-price/gspro-item-price.js", | ||
"components/gspro-media-gallery/gspro-media-gallery.js", | ||
"components/gspro-wishlist-item/gspro-wishlist-item.js", | ||
"components/gspro-wishlist/gspro-wishlist.js", | ||
"components/gspro-item-price/gspro-item-price.js", | ||
"components/gspro-item-list/gspro-item-list.js", | ||
"components/gspro-media-gallery/gspro-media-gallery.js" | ||
"components/gspro-wishlist/gspro-wishlist.js" | ||
], | ||
@@ -14,0 +14,0 @@ "compiler": { |
@@ -55,3 +55,3 @@ import { h, Host } from "@stencil/core"; | ||
*/ | ||
listenForChange(event) { | ||
listenForItemChange(event) { | ||
let item = event.detail; | ||
@@ -82,2 +82,13 @@ this.updateItem(item); | ||
} | ||
listenForChange(event) { | ||
const input = event.target; | ||
const group = input.getAttribute("data-group"); | ||
if (group === "venue") { | ||
this.venue[input.name] = input.value; | ||
} | ||
if (group === "contact") { | ||
this.contact[input.name] = input.value; | ||
} | ||
this.save(); | ||
} | ||
/** | ||
@@ -98,4 +109,6 @@ * Persist the current state to localStorage. This should be manually invoked | ||
let stash = JSON.parse(restored); | ||
this.duration = stash.duration; | ||
this.items = stash.items; | ||
this.duration = stash.duration || null; | ||
this.items = stash.items || []; | ||
this.venue = stash.venue || {}; | ||
this.contact = stash.contact || {}; | ||
} | ||
@@ -105,2 +118,4 @@ else { | ||
this.items = []; | ||
this.venue = {}; | ||
this.contact = {}; | ||
} | ||
@@ -111,3 +126,5 @@ } | ||
items: this.items, | ||
duration: this.duration | ||
duration: this.duration, | ||
venue: this.venue, | ||
contact: this.contact | ||
}); | ||
@@ -179,8 +196,7 @@ localStorage.setItem(GOSHU_DB_KEY, serialized); | ||
try { | ||
let form = this.el.querySelector("form"); | ||
let wishlist = { | ||
contact: extract(form, "contact"), | ||
items: essentialProperties(this.items), | ||
event: this.duration, | ||
items: minimize(this.items), | ||
location: extract(form, "location") | ||
contact: this.contact, | ||
location: this.venue | ||
}; | ||
@@ -290,23 +306,23 @@ let result = await Service.sendWishlist(wishlist); | ||
h("label", { htmlFor: "venueName" }, "Venue Name")), | ||
h("input", { type: "text", id: "venueName", name: "venueName" })), | ||
h("input", { type: "text", id: "venueName", name: "venueName", "data-group": "venue", value: this.venue.venueName })), | ||
h("div", { class: "gspro-o-form--horiz" }, | ||
h("div", null, | ||
h("label", { htmlFor: "street1" }, "Street Address 1")), | ||
h("input", { type: "text", id: "addressStreet1", name: "addressStreet1" })), | ||
h("input", { type: "text", id: "addressStreet1", name: "addressStreet1", "data-group": "venue", value: this.venue.addressStreet1 })), | ||
h("div", { class: "gspro-o-form--horiz" }, | ||
h("div", null, | ||
h("label", { htmlFor: "street2" }, "Street Address 2")), | ||
h("input", { type: "text", id: "addressStreet2", name: "addressStreet2" })), | ||
h("input", { type: "text", id: "addressStreet2", name: "addressStreet2", "data-group": "venue", value: this.venue.addressStreet2 })), | ||
h("div", { class: "gspro-o-form--horiz" }, | ||
h("div", null, | ||
h("label", { htmlFor: "city" }, "City")), | ||
h("input", { type: "text", id: "city", name: "city" })), | ||
h("input", { type: "text", id: "city", name: "city", "data-group": "venue", value: this.venue.city })), | ||
h("div", { class: "gspro-o-form--horiz" }, | ||
h("div", null, | ||
h("label", { htmlFor: "state" }, "State")), | ||
h("input", { type: "text", id: "state", name: "state" })), | ||
h("input", { type: "text", id: "state", name: "state", "data-group": "venue", value: this.venue.state })), | ||
h("div", { class: "gspro-o-form--horiz" }, | ||
h("div", null, | ||
h("label", { htmlFor: "postalCode" }, "Postal Code")), | ||
h("input", { type: "text", id: "postalCode", name: "postalCode" }))))); | ||
h("input", { type: "text", id: "postalCode", name: "postalCode", "data-group": "venue", value: this.venue.postalCode }))))); | ||
} | ||
@@ -320,15 +336,15 @@ renderWho() { | ||
h("label", { htmlFor: "firstName" }, "First Name")), | ||
h("input", { type: "text", id: "firstName", name: "firstName", required: true })), | ||
h("input", { type: "text", id: "firstName", name: "firstName", required: true, "data-group": "contact", value: this.contact.firstName })), | ||
h("div", { class: "gspro-o-form--horiz" }, | ||
h("div", null, | ||
h("label", { htmlFor: "lastName" }, "Last Name")), | ||
h("input", { type: "text", id: "lastName", name: "lastName", required: true })), | ||
h("input", { type: "text", id: "lastName", name: "lastName", required: true, "data-group": "contact", value: this.contact.lastName })), | ||
h("div", { class: "gspro-o-form--horiz" }, | ||
h("div", null, | ||
h("label", { htmlFor: "email" }, "Email")), | ||
h("input", { type: "email", id: "email", name: "email", required: true })), | ||
h("input", { type: "email", id: "email", name: "email", required: true, "data-group": "contact", value: this.contact.email })), | ||
h("div", { class: "gspro-o-form--horiz" }, | ||
h("div", null, | ||
h("label", { htmlFor: "phone" }, "Phone")), | ||
h("input", { type: "tel", id: "phone", name: "phone" }))))); | ||
h("input", { type: "tel", id: "phone", name: "phone", "data-group": "contact", value: this.contact.phone }))))); | ||
} | ||
@@ -376,2 +392,4 @@ renderError() { | ||
"duration": {}, | ||
"venue": {}, | ||
"contact": {}, | ||
"mode": {}, | ||
@@ -396,3 +414,3 @@ "step": {}, | ||
"name": "gspro-wishlist-item.change", | ||
"method": "listenForChange", | ||
"method": "listenForItemChange", | ||
"target": undefined, | ||
@@ -413,26 +431,15 @@ "capture": false, | ||
"passive": false | ||
}, { | ||
"name": "change", | ||
"method": "listenForChange", | ||
"target": undefined, | ||
"capture": false, | ||
"passive": false | ||
}]; } | ||
} | ||
/** | ||
* Extract all values from a form's fieldset (skip missing blank values). | ||
* | ||
* @param form | ||
* @param fieldset | ||
* @param items | ||
*/ | ||
function extract(form, fieldset) { | ||
try { | ||
let inputs = Array.from(form[fieldset].elements); | ||
let mapping = inputs.reduce((obj, input) => { | ||
if (!!input.value) { | ||
obj[input.name] = input.value; | ||
} | ||
return obj; | ||
}, {}); | ||
return mapping; | ||
} | ||
catch (err) { | ||
console.error(`Could not extract ${fieldset}`); | ||
} | ||
} | ||
function minimize(items) { | ||
function essentialProperties(items) { | ||
let less = items.map(item => { | ||
@@ -439,0 +446,0 @@ let i = {}; |
@@ -1,6 +0,1 @@ | ||
import { p as patchBrowser, g as globals, b as bootstrapLazy } from './core-798f5de9.js'; | ||
patchBrowser().then(options => { | ||
globals(); | ||
return bootstrapLazy([["gspro-item-detail",[[0,"gspro-item-detail",{"itemId":[1537,"item-id"],"item":[1544],"hidePrice":[4,"hide-price"],"hideQuantity":[4,"hide-quantity"],"error":[32],"mode":[32],"back":[32],"choices":[32]},[[8,"gspro.item.picked","itemPickedHandler"],[8,"hashchange","hashchangeListener"],[8,"keydown","handleKeyDown"],[0,"gspro-item-choices.changed","handleChoice"]]]]],["gspro-wishlist",[[0,"gspro-wishlist",{"items":[32],"duration":[32],"mode":[32],"step":[32],"error":[32]},[[8,"gspro.wishlist.add","listenForAdd"],[0,"gspro-wishlist-item.remove","listenForRemove"],[0,"gspro-wishlist-item.change","listenForChange"],[0,"gspro.duration.change","listenToDurationChange"],[0,"click","listenWishlistItemToggle"]]]]],["gspro-item-card",[[0,"gspro-item-card",{"item":[1544],"itemId":[1,"item-id"],"hidePrice":[4,"hide-price"],"hideQuantity":[4,"hide-quantity"],"route":[1],"error":[32]}]]],["gspro-item-list",[[0,"gspro-item-list",{"items":[1040],"category":[1537],"from":[1538],"size":[1538],"total":[1538],"hidePrice":[516,"hide-price"],"hideQuantity":[516,"hide-quantity"],"route":[1],"itemCardRoute":[1,"item-card-route"]},[[8,"hashchange","listenHashchange"]]]]],["gspro-categories",[[0,"gspro-categories",{"current":[1537],"route":[1],"categories":[32],"mode":[32]},[[8,"hashchange","listenForHashChange"]]]]],["gspro-wishlist-item",[[0,"gspro-wishlist-item",{"item":[1544],"error":[32],"mode":[32],"want":[32]},[[2,"input","handleChange"],[0,"gspro-item-choices.changed","handleChoice"]]]]],["gspro-duration",[[0,"gspro-duration",{"dataKey":[1,"data-key"],"value":[8],"startDate":[1544,"start-date"],"startTime":[1544,"start-time"],"endDate":[1544,"end-date"],"endTime":[1544,"end-time"],"mode":[1025]}]]],["gspro-item-price",[[0,"gspro-item-price",{"price":[8]}]]],["gspro-media-gallery",[[0,"gspro-media-gallery",{"images":[16],"picked":[32]}]]],["gspro-item-choices",[[0,"gspro-item-choices",{"item":[1544]},[[0,"change","changeHandler"],[8,"gspro.duration.change","listenDuration"]]]]]], options); | ||
}); | ||
import{p as e,b as i}from"./p-9346166d.js";e().then(e=>i([["p-xjbklxgt",[[0,"gspro-item-detail",{itemId:[1537,"item-id"],item:[1544],hidePrice:[4,"hide-price"],hideQuantity:[4,"hide-quantity"],error:[32],mode:[32],back:[32],choices:[32]},[[8,"gspro.item.picked","itemPickedHandler"],[8,"hashchange","hashchangeListener"],[8,"keydown","handleKeyDown"],[0,"gspro-item-choices.changed","handleChoice"]]],[0,"gspro-wishlist",{items:[32],duration:[32],venue:[32],contact:[32],mode:[32],step:[32],error:[32]},[[8,"gspro.wishlist.add","listenForAdd"],[0,"gspro-wishlist-item.remove","listenForRemove"],[0,"gspro-wishlist-item.change","listenForItemChange"],[0,"gspro.duration.change","listenToDurationChange"],[0,"click","listenWishlistItemToggle"],[0,"change","listenForChange"]]],[0,"gspro-item-list",{items:[1040],category:[1537],from:[1538],size:[1538],total:[1538],hidePrice:[516,"hide-price"],hideQuantity:[516,"hide-quantity"],route:[1],itemCardRoute:[1,"item-card-route"]},[[8,"hashchange","listenHashchange"]]],[0,"gspro-categories",{current:[1537],route:[1],categories:[32],mode:[32]},[[8,"hashchange","listenForHashChange"]]],[0,"gspro-wishlist-item",{item:[1544],error:[32],mode:[32],want:[32]},[[2,"input","handleChange"],[0,"gspro-item-choices.changed","handleChoice"]]],[0,"gspro-duration",{dataKey:[1,"data-key"],value:[8],startDate:[1544,"start-date"],startTime:[1544,"start-time"],endDate:[1544,"end-date"],endTime:[1544,"end-time"],mode:[1025]}],[0,"gspro-item-card",{item:[1544],itemId:[1,"item-id"],hidePrice:[4,"hide-price"],hideQuantity:[4,"hide-quantity"],route:[1],error:[32]}],[0,"gspro-item-price",{price:[8]}],[0,"gspro-media-gallery",{images:[16],picked:[32]}],[0,"gspro-item-choices",{item:[1544]},[[0,"change","changeHandler"],[8,"gspro.duration.change","listenDuration"]]]]]],e)); |
@@ -16,2 +16,4 @@ declare type WishlistItem = { | ||
duration: any; | ||
venue: any; | ||
contact: any; | ||
mode: Mode; | ||
@@ -43,3 +45,3 @@ step: number; | ||
*/ | ||
listenForChange(event: any): void; | ||
listenForItemChange(event: any): void; | ||
/** | ||
@@ -52,2 +54,3 @@ * Handle add events from other elements. | ||
listenWishlistItemToggle(event: any): void; | ||
listenForChange(event: any): void; | ||
/** | ||
@@ -54,0 +57,0 @@ * Persist the current state to localStorage. This should be manually invoked |
{ | ||
"name": "@goodshuffle/gspro-wc", | ||
"version": "0.0.1-SNAPSHOT.6", | ||
"version": "0.0.1-SNAPSHOT.7", | ||
"description": "The Goodshuffle web components library.", | ||
@@ -5,0 +5,0 @@ "author": { |
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
Uses eval
Supply chain riskPackage uses eval() which is a dangerous function. This prevents the code from running in certain environments and increases the risk that the code may contain exploits or malicious behavior.
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
Long strings
Supply chain riskContains long string literals, which may be a sign of obfuscated or packed code.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
Long strings
Supply chain riskContains long string literals, which may be a sign of obfuscated or packed code.
Found 1 instance in 1 package
2724964
97
37825
30
23