@dotdev/next-components
Advanced tools
Comparing version 0.1.0 to 0.1.1
@@ -40,6 +40,10 @@ "use strict"; | ||
var _this = this; | ||
return this.props.data.sections ? this.props.data.sections.map(function (section, i) { return _this.section(section, i); }) : []; | ||
return this.props.data.sections | ||
? this.props.data.sections.map(function (section, i) { | ||
return _this.section(section, i); | ||
}) | ||
: []; | ||
}; | ||
DynamicSections.prototype.render = function () { | ||
return (React.createElement("main", { className: this.props.className }, this.sections())); | ||
return React.createElement("main", { className: this.props.className }, this.sections()); | ||
}; | ||
@@ -46,0 +50,0 @@ return DynamicSections; |
@@ -23,6 +23,10 @@ "use strict"; | ||
Forms.prototype.render = function () { | ||
return (React.createElement("form", { id: this.props.data.form.id, method: this.props.data.form.method, action: this.props.data.form.action, acceptCharset: this.props.data.form.accept_charset ? this.props.data.form.accept_charset : '', encType: this.props.data.form.enctype ? this.props.data.form.enctype : '', className: (this.props.data.form.class ? this.props.data.form.class : '') + " " + this.props.className }, | ||
this.props.data.fields.length ? this.props.data.fields.map(function (field, i) { | ||
return React.createElement("input", { key: i, name: field.name, type: field.type, value: field.value }); | ||
}) : null, | ||
return (React.createElement("form", { id: this.props.data.form.id, method: this.props.data.form.method, action: this.props.data.form.action, acceptCharset: this.props.data.form.accept_charset | ||
? this.props.data.form.accept_charset | ||
: "", encType: this.props.data.form.enctype ? this.props.data.form.enctype : "", className: (this.props.data.form.class ? this.props.data.form.class : "") + " " + this.props.className }, | ||
this.props.data.fields.length | ||
? this.props.data.fields.map(function (field, i) { | ||
return (React.createElement("input", { key: i, name: field.name, type: field.type, value: field.value })); | ||
}) | ||
: null, | ||
this.props.children)); | ||
@@ -29,0 +33,0 @@ }; |
@@ -1,2 +0,2 @@ | ||
import * as React from 'react'; | ||
import * as React from "react"; | ||
export declare const ThemeContext: React.Context<ThemeContext.Store>; | ||
@@ -3,0 +3,0 @@ export declare namespace ThemeContext { |
@@ -71,6 +71,12 @@ "use strict"; | ||
if (err_1.status == 422) { | ||
this.context.update({ message: "CART_ITEM_ADDED_QTY_NOT_AVAILABLE", error: err_1.message }); | ||
this.context.update({ | ||
message: "CART_ITEM_ADDED_QTY_NOT_AVAILABLE", | ||
error: err_1.message | ||
}); | ||
} | ||
else { | ||
this.context.update({ message: "CART_ITEM_ADDED_FAILED", error: err_1.message }); | ||
this.context.update({ | ||
message: "CART_ITEM_ADDED_FAILED", | ||
error: err_1.message | ||
}); | ||
} | ||
@@ -96,3 +102,6 @@ return [3 /*break*/, 3]; | ||
err_2 = _a.sent(); | ||
this.context.update({ message: "CART_ITEM_REMOVED_FAILED", error: err_2.message }); | ||
this.context.update({ | ||
message: "CART_ITEM_REMOVED_FAILED", | ||
error: err_2.message | ||
}); | ||
return [3 /*break*/, 3]; | ||
@@ -117,3 +126,6 @@ case 3: return [2 /*return*/]; | ||
err_3 = _a.sent(); | ||
this.context.update({ message: "CART_QTY_UPDATE_FAILED", error: err_3.message }); | ||
this.context.update({ | ||
message: "CART_QTY_UPDATE_FAILED", | ||
error: err_3.message | ||
}); | ||
return [3 /*break*/, 3]; | ||
@@ -143,3 +155,6 @@ case 3: return [2 /*return*/]; | ||
err_4 = _a.sent(); | ||
this.context.update({ message: "CART_VARIANT_UPDATE_FAILED", error: err_4.message }); | ||
this.context.update({ | ||
message: "CART_VARIANT_UPDATE_FAILED", | ||
error: err_4.message | ||
}); | ||
return [3 /*break*/, 5]; | ||
@@ -163,3 +178,6 @@ case 5: return [2 /*return*/]; | ||
err_5 = _a.sent(); | ||
this.context.update({ message: "CART_REQUEST_FAILED", error: err_5.message }); | ||
this.context.update({ | ||
message: "CART_REQUEST_FAILED", | ||
error: err_5.message | ||
}); | ||
return [3 /*break*/, 3]; | ||
@@ -184,3 +202,6 @@ case 3: return [2 /*return*/]; | ||
err_6 = _a.sent(); | ||
this.context.update({ message: "CART_CLEARED_FAILED", error: err_6.message }); | ||
this.context.update({ | ||
message: "CART_CLEARED_FAILED", | ||
error: err_6.message | ||
}); | ||
return [3 /*break*/, 3]; | ||
@@ -205,3 +226,6 @@ case 3: return [2 /*return*/]; | ||
err_7 = _a.sent(); | ||
this.context.update({ message: "SHIPPING_RATES_FAILED", error: err_7.message }); | ||
this.context.update({ | ||
message: "SHIPPING_RATES_FAILED", | ||
error: err_7.message | ||
}); | ||
return [3 /*break*/, 3]; | ||
@@ -212,8 +236,5 @@ case 3: return [2 /*return*/]; | ||
}); }; | ||
this.toggleFreeShipping = function (event) { | ||
}; | ||
this.toggleUpsells = function (event) { | ||
}; | ||
this.toggleFreeGift = function (event) { | ||
}; | ||
this.toggleFreeShipping = function (event) { }; | ||
this.toggleUpsells = function (event) { }; | ||
this.toggleFreeGift = function (event) { }; | ||
this.cart = cart; | ||
@@ -220,0 +241,0 @@ } |
@@ -11,3 +11,3 @@ "use strict"; | ||
}; | ||
this.set = function (messages) { return _this.messages = messages; }; | ||
this.set = function (messages) { return (_this.messages = messages); }; | ||
this.get = function (message) { return _this.messages[message]; }; | ||
@@ -14,0 +14,0 @@ } |
@@ -1,2 +0,2 @@ | ||
import * as React from 'react'; | ||
import * as React from "react"; | ||
export declare class ThemeProvider extends React.Component<ThemeProvider.Props, ThemeProvider.State> { | ||
@@ -3,0 +3,0 @@ constructor(props: any); |
import * as React from "react"; | ||
import { RouterProps } from "react-router"; | ||
import { ThemeContext } from './context'; | ||
import { ThemeContext } from "./context"; | ||
import { Shop, Template, LinkList, Filters, Form, Breadcrumbs, Search } from "./types"; | ||
@@ -5,0 +5,0 @@ import { Cart, Notifications } from "./helpers"; |
@@ -45,6 +45,13 @@ "use strict"; | ||
var scriptProperty = scriptTag.getAttribute("data-property"); | ||
var scriptData = JSON.parse(scriptTag.innerHTML); | ||
var objectKey = scriptProperty.includes('.') ? scriptProperty.split('.')[1] : scriptProperty; | ||
var objectType = scriptProperty.includes('.') ? scriptProperty.split('.')[0] : false; | ||
return !objectType ? __assign({}, result, (_a = {}, _a[scriptProperty] = scriptData, _a)) : __assign({}, result, (_b = {}, _b[objectType] = __assign({}, result[objectType], (_c = {}, _c[objectKey] = scriptData, _c)), _b)); | ||
var scriptData = !!scriptTag.innerHTML | ||
? JSON.parse(scriptTag.innerHTML) | ||
: null; | ||
var objectKey = scriptProperty.includes(".") | ||
? scriptProperty.split(".")[1] | ||
: scriptProperty; | ||
var objectType = scriptProperty.includes(".") | ||
? scriptProperty.split(".")[0] | ||
: false; | ||
return !objectType | ||
? __assign({}, result, (_a = {}, _a[scriptProperty] = scriptData, _a)) : __assign({}, result, (_b = {}, _b[objectType] = __assign({}, result[objectType], (_c = {}, _c[objectKey] = scriptData, _c)), _b)); | ||
}, {}); | ||
@@ -61,7 +68,8 @@ if (searchParamView) | ||
var scriptData = JSON.parse(scriptTag.innerHTML); | ||
return (scriptData.type == "static") ? __assign({}, result, (_a = {}, _a[scriptProperty] = scriptData, _a)) : result; | ||
return scriptData.type == "static" | ||
? __assign({}, result, (_a = {}, _a[scriptProperty] = scriptData, _a)) : result; | ||
}, {}); | ||
var dynamicSections = Object.values(scriptTags).reduce(function (result, scriptTag) { | ||
var scriptData = JSON.parse(scriptTag.innerHTML); | ||
return (scriptData.type == "dynamic") ? result.concat([scriptData]) : result; | ||
return scriptData.type == "dynamic" ? result.concat([scriptData]) : result; | ||
}, []); | ||
@@ -68,0 +76,0 @@ return { |
@@ -13,5 +13,7 @@ "use strict"; | ||
}; | ||
var replacement = Numeral(cents).divide(100).format(shopifyFormat[stringFormat.match(regex)[1]]); | ||
var replacement = Numeral(cents) | ||
.divide(100) | ||
.format(shopifyFormat[stringFormat.match(regex)[1]]); | ||
return stringFormat.replace(regex, replacement); | ||
}; | ||
//# sourceMappingURL=format-money.js.map |
@@ -6,4 +6,6 @@ "use strict"; | ||
if (wrap === void 0) { wrap = false; } | ||
return (React.createElement("span", { dangerouslySetInnerHTML: { __html: !html.startsWith('<') && wrap ? "<p>" + html + "</p>" : html } })); | ||
return (React.createElement("span", { dangerouslySetInnerHTML: { | ||
__html: !html.startsWith("<") && wrap ? "<p>" + html + "</p>" : html | ||
} })); | ||
}; | ||
//# sourceMappingURL=parse-html.js.map |
@@ -5,4 +5,4 @@ "use strict"; | ||
if (ellipse === void 0) { ellipse = "..."; } | ||
return (str.length > length) ? "" + str.slice(0, length) + ellipse : str; | ||
return str.length > length ? "" + str.slice(0, length) + ellipse : str; | ||
}; | ||
//# sourceMappingURL=truncate-string.js.map |
{ | ||
"name": "@dotdev/next-components", | ||
"version": "0.1.0", | ||
"version": "0.1.1", | ||
"license": "UNLICENSED", | ||
@@ -28,5 +28,3 @@ "description": "Common components for Next projects", | ||
"watch": "tsc --project tsconfig.json --watch", | ||
"build": "tsc --project tsconfig.json", | ||
"publish": "yarn build && npm publish", | ||
"postversion": "git push --follow-tags" | ||
"build": "tsc --project tsconfig.json" | ||
}, | ||
@@ -33,0 +31,0 @@ "files": [ |
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 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 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
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
67450
1028