@dotdev/next-components
Advanced tools
Comparing version 0.1.1 to 0.2.0
@@ -40,33 +40,32 @@ "use strict"; | ||
React.createElement(react_router_dom_1.Switch, null, | ||
React.createElement(react_router_dom_1.Route, { exact: true, path: "/", render: function (props) { return (React.createElement(_this.props.templates.home, __assign({}, props, _this.props))); } }), | ||
React.createElement(react_router_dom_1.Route, { exact: true, path: "/collections", render: function (props) { return (React.createElement(_this.props.templates.collections, __assign({}, props, _this.props))); } }), | ||
React.createElement(react_router_dom_1.Route, { exact: true, path: "/collections/:collection", render: function (props) { return (React.createElement(_this.props.templates.collection, __assign({}, props, _this.props))); } }), | ||
React.createElement(react_router_dom_1.Route, { exact: true, path: "/collections/:collection/:tag", render: function (props) { return (React.createElement(_this.props.templates.collection, __assign({}, props, _this.props))); } }), | ||
React.createElement(react_router_dom_1.Route, { exact: true, path: "/products/:productId", render: function (props) { return (React.createElement(_this.props.templates.product, __assign({}, props, _this.props))); } }), | ||
React.createElement(react_router_dom_1.Route, { exact: true, path: "/collections/:collection/products/:productId", render: function (props) { return (React.createElement(_this.props.templates.product, __assign({}, props, _this.props))); } }), | ||
React.createElement(react_router_dom_1.Route, { exact: true, path: "/search", render: function (props) { return (React.createElement(_this.props.templates.search, __assign({}, props, _this.props))); } }), | ||
React.createElement(react_router_dom_1.Route, { exact: true, path: "/cart", render: function (props) { return (React.createElement(_this.props.templates.cart, __assign({}, props, _this.props))); } }), | ||
React.createElement(react_router_dom_1.Route, { exact: true, path: "/checkout", render: function (props) { return (React.createElement(_this.props.templates.checkout, __assign({}, props, _this.props))); } }), | ||
React.createElement(react_router_dom_1.Route, { exact: true, path: "/pages/:page", render: function (props) { return (React.createElement(_this.props.templates.page, __assign({}, props, _this.props))); } }), | ||
React.createElement(react_router_dom_1.Route, { exact: true, path: "/blogs/:blog", render: function (props) { return (React.createElement(_this.props.templates.blog, __assign({}, props, _this.props))); } }), | ||
React.createElement(react_router_dom_1.Route, { exact: true, path: "/blogs/:blog/tagged/:tag", render: function (props) { return (React.createElement(_this.props.templates.blog, __assign({}, props, _this.props))); } }), | ||
React.createElement(react_router_dom_1.Route, { exact: true, path: "/blogs/:blog/:article", render: function (props) { return (React.createElement(_this.props.templates.article, __assign({}, props, _this.props))); } }), | ||
React.createElement(react_router_dom_1.Route, { exact: true, path: "/account", render: function (props) { return (React.createElement(_this.props.templates.account.details, __assign({}, props, _this.props))); } }), | ||
React.createElement(react_router_dom_1.Route, { exact: true, path: "/account/login", render: function (props) { return (React.createElement(_this.props.templates.account.login, __assign({}, props, _this.props))); } }), | ||
React.createElement(react_router_dom_1.Route, { exact: true, path: "/account/register", render: function (props) { return (React.createElement(_this.props.templates.account.register, __assign({}, props, _this.props))); } }), | ||
React.createElement(react_router_dom_1.Route, { exact: true, path: "/account/addresses", render: function (props) { return (React.createElement(_this.props.templates.account.addresses, __assign({}, props, _this.props))); } }), | ||
React.createElement(react_router_dom_1.Route, { exact: true, path: "/account/orders/:orderId", render: function (props) { return (React.createElement(_this.props.templates.account.order, __assign({}, props, _this.props))); } }), | ||
React.createElement(react_router_dom_1.Route, { exact: true, path: "/account/reset/:id/:token", render: function (props) { return (React.createElement(_this.props.templates.account.reset, __assign({}, props, _this.props))); } }), | ||
React.createElement(react_router_dom_1.Route, { exact: true, path: "/account/logout", render: function (props) { return (React.createElement(_this.props.templates.account.logout, __assign({}, props, _this.props))); } }), | ||
React.createElement(react_router_dom_1.Route, { exact: true, path: "/giftcard/:number", render: function (props) { return (React.createElement(_this.props.templates.giftcard, __assign({}, props, _this.props))); } }), | ||
React.createElement(react_router_dom_1.Route, { exact: true, path: "/password", render: function (props) { return (React.createElement(_this.props.templates.password, __assign({}, props, _this.props))); } }), | ||
React.createElement(react_router_dom_1.Route, { render: function (props) { return (React.createElement(_this.props.templates.notFound, __assign({}, props, _this.props))); } })))); | ||
React.createElement(react_router_dom_1.Route, { exact: true, path: "/", render: function (props) { return React.createElement(_this.props.templates.home, __assign({}, props, _this.props)); } }), | ||
React.createElement(react_router_dom_1.Route, { exact: true, path: "/collections", render: function (props) { return React.createElement(_this.props.templates.collections, __assign({}, props, _this.props)); } }), | ||
React.createElement(react_router_dom_1.Route, { exact: true, path: "/collections/:collection", render: function (props) { return React.createElement(_this.props.templates.collection, __assign({}, props, _this.props)); } }), | ||
React.createElement(react_router_dom_1.Route, { exact: true, path: "/collections/:collection/:tag", render: function (props) { return React.createElement(_this.props.templates.collection, __assign({}, props, _this.props)); } }), | ||
React.createElement(react_router_dom_1.Route, { exact: true, path: "/products/:productId", render: function (props) { return React.createElement(_this.props.templates.product, __assign({}, props, _this.props)); } }), | ||
React.createElement(react_router_dom_1.Route, { exact: true, path: "/collections/:collection/products/:productId", render: function (props) { return React.createElement(_this.props.templates.product, __assign({}, props, _this.props)); } }), | ||
React.createElement(react_router_dom_1.Route, { exact: true, path: "/search", render: function (props) { return React.createElement(_this.props.templates.search, __assign({}, props, _this.props)); } }), | ||
React.createElement(react_router_dom_1.Route, { exact: true, path: "/cart", render: function (props) { return React.createElement(_this.props.templates.cart, __assign({}, props, _this.props)); } }), | ||
React.createElement(react_router_dom_1.Route, { exact: true, path: "/checkout", render: function (props) { return React.createElement(_this.props.templates.checkout, __assign({}, props, _this.props)); } }), | ||
React.createElement(react_router_dom_1.Route, { exact: true, path: "/pages/:page", render: function (props) { return React.createElement(_this.props.templates.page, __assign({}, props, _this.props)); } }), | ||
React.createElement(react_router_dom_1.Route, { exact: true, path: "/blogs/:blog", render: function (props) { return React.createElement(_this.props.templates.blog, __assign({}, props, _this.props)); } }), | ||
React.createElement(react_router_dom_1.Route, { exact: true, path: "/blogs/:blog/tagged/:tag", render: function (props) { return React.createElement(_this.props.templates.blog, __assign({}, props, _this.props)); } }), | ||
React.createElement(react_router_dom_1.Route, { exact: true, path: "/blogs/:blog/:article", render: function (props) { return React.createElement(_this.props.templates.article, __assign({}, props, _this.props)); } }), | ||
React.createElement(react_router_dom_1.Route, { exact: true, path: "/account", render: function (props) { return React.createElement(_this.props.templates.account.details, __assign({}, props, _this.props)); } }), | ||
React.createElement(react_router_dom_1.Route, { exact: true, path: "/account/login", render: function (props) { return React.createElement(_this.props.templates.account.login, __assign({}, props, _this.props)); } }), | ||
React.createElement(react_router_dom_1.Route, { exact: true, path: "/account/register", render: function (props) { return React.createElement(_this.props.templates.account.register, __assign({}, props, _this.props)); } }), | ||
React.createElement(react_router_dom_1.Route, { exact: true, path: "/account/addresses", render: function (props) { return React.createElement(_this.props.templates.account.addresses, __assign({}, props, _this.props)); } }), | ||
React.createElement(react_router_dom_1.Route, { exact: true, path: "/account/orders/:orderId", render: function (props) { return React.createElement(_this.props.templates.account.order, __assign({}, props, _this.props)); } }), | ||
React.createElement(react_router_dom_1.Route, { exact: true, path: "/account/reset/:id/:token", render: function (props) { return React.createElement(_this.props.templates.account.reset, __assign({}, props, _this.props)); } }), | ||
React.createElement(react_router_dom_1.Route, { exact: true, path: "/account/logout", render: function (props) { return React.createElement(_this.props.templates.account.logout, __assign({}, props, _this.props)); } }), | ||
React.createElement(react_router_dom_1.Route, { exact: true, path: "/giftcard/:number", render: function (props) { return React.createElement(_this.props.templates.giftcard, __assign({}, props, _this.props)); } }), | ||
React.createElement(react_router_dom_1.Route, { exact: true, path: "/password", render: function (props) { return React.createElement(_this.props.templates.password, __assign({}, props, _this.props)); } }), | ||
React.createElement(react_router_dom_1.Route, { render: function (props) { return React.createElement(_this.props.templates.notFound, __assign({}, props, _this.props)); } })))); | ||
}; | ||
Bootstrap.bootstrap = function (element, templates, sections, data) { | ||
var foo = ReactDom.render(React.createElement(provider_1.ThemeProvider, { value: { cart: null, error: null } }, | ||
ReactDom.render(React.createElement(provider_1.ThemeProvider, { value: { cart: null, error: null } }, | ||
React.createElement(Bootstrap, { templates: templates, sections: sections, data: data })), document.getElementById(element)); | ||
console.log({ foo: foo }); | ||
}; | ||
Bootstrap.element = function (templates, sections, data) { | ||
return React.createElement(Bootstrap, { templates: templates, sections: sections, data: data }); | ||
return (React.createElement(Bootstrap, { templates: templates, sections: sections, data: data })); | ||
}; | ||
@@ -73,0 +72,0 @@ return Bootstrap; |
@@ -5,3 +5,4 @@ import * as React from "react"; | ||
section(data: any, i: number): JSX.Element; | ||
sections(): JSX.Element[]; | ||
sections(sections: any): JSX.Element[]; | ||
private transform; | ||
render(): JSX.Element; | ||
@@ -11,2 +12,3 @@ } | ||
interface Props extends ShopifyNext.Props { | ||
dtkSections?: any; | ||
className?: string; | ||
@@ -13,0 +15,0 @@ } |
@@ -31,19 +31,38 @@ "use strict"; | ||
function DynamicSections() { | ||
return _super !== null && _super.apply(this, arguments) || this; | ||
var _this = _super !== null && _super.apply(this, arguments) || this; | ||
_this.transform = function (data) { | ||
var sections = []; | ||
data.map(function (item) { | ||
Object.keys(item).forEach(function (key) { | ||
var section = item[key]; | ||
var blocks = section.blocks; | ||
delete section.blocks; | ||
var fields = section; | ||
sections.push({ | ||
id: key, | ||
type: "dynamic", | ||
name: key, | ||
settings: fields, | ||
blocks: blocks.length ? blocks.map(function (block, i) { return ({ | ||
id: i, | ||
type: "default", | ||
settings: block | ||
}); }) : [] | ||
}); | ||
}); | ||
}); | ||
return sections; | ||
}; | ||
return _this; | ||
} | ||
DynamicSections.prototype.section = function (data, i) { | ||
var SectionComponent = Object.values(this.props.sections).find(function (section) { return section.sectionId === data.name; }); | ||
return SectionComponent ? (React.createElement("section", { id: "shopify-section-" + data.id, className: "shopify-section" }, | ||
React.createElement(SectionComponent, __assign({ key: i, section: data }, this.props)))) : null; | ||
return SectionComponent ? (React.createElement(SectionComponent, __assign({ key: i, section: data }, this.props))) : null; | ||
}; | ||
DynamicSections.prototype.sections = function () { | ||
DynamicSections.prototype.sections = function (sections) { | ||
var _this = this; | ||
return this.props.data.sections | ||
? this.props.data.sections.map(function (section, i) { | ||
return _this.section(section, i); | ||
}) | ||
: []; | ||
return sections ? 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(this.props.dtkSections ? this.transform(this.props.dtkSections) : this.props.data.sections))); | ||
}; | ||
@@ -50,0 +69,0 @@ return DynamicSections; |
@@ -23,10 +23,6 @@ "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)); | ||
@@ -33,0 +29,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 { |
@@ -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); |
@@ -73,2 +73,3 @@ import * as React from "react"; | ||
product: any; | ||
paginate: any; | ||
search: Search; | ||
@@ -75,0 +76,0 @@ section: SectionData; |
@@ -45,5 +45,3 @@ "use strict"; | ||
var scriptProperty = scriptTag.getAttribute("data-property"); | ||
var scriptData = !!scriptTag.innerHTML | ||
? JSON.parse(scriptTag.innerHTML) | ||
: null; | ||
var scriptData = JSON.parse(scriptTag.innerHTML); | ||
var objectKey = scriptProperty.includes(".") | ||
@@ -50,0 +48,0 @@ ? scriptProperty.split(".")[1] |
@@ -35,2 +35,3 @@ import { Metafield } from "./metafield"; | ||
metafields: Metafield; | ||
checkout_buttons: any; | ||
} |
@@ -13,7 +13,5 @@ "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,6 +6,4 @@ "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.1", | ||
"version": "0.2.0", | ||
"license": "UNLICENSED", | ||
@@ -5,0 +5,0 @@ "description": "Common components for Next projects", |
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
68494
1041