fontdue-js 1.3.0 → 1.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +16 -0
- package/dist/__generated__/NewsletterSignup_Query.graphql.d.ts +14 -0
- package/dist/__generated__/NewsletterSignup_Query.graphql.js +117 -0
- package/dist/__generated__/NewsletterSignup_viewer.graphql.d.ts +16 -0
- package/dist/__generated__/NewsletterSignup_viewer.graphql.js +56 -0
- package/dist/__generated__/StoreModalFamily_collection.graphql.d.ts +4 -0
- package/dist/__generated__/StoreModalFamily_collection.graphql.js +18 -1
- package/dist/__generated__/StoreModalProductQuery.graphql.js +7 -2
- package/dist/__generated__/StoreModalStyleButton_fontStyle.graphql.d.ts +1 -0
- package/dist/__generated__/StoreModalStyleButton_fontStyle.graphql.js +35 -27
- package/dist/__generated__/productState_Query.graphql.d.ts +4 -0
- package/dist/__generated__/productState_Query.graphql.js +29 -78
- package/dist/__generated__/productState_bundle.graphql.d.ts +1 -0
- package/dist/__generated__/productState_bundle.graphql.js +4 -2
- package/dist/__generated__/productState_collection.graphql.d.ts +2 -0
- package/dist/__generated__/productState_collection.graphql.js +4 -2
- package/dist/__generated__/productState_node.graphql.d.ts +4 -0
- package/dist/__generated__/productState_node.graphql.js +3 -1
- package/dist/components/NewsletterSignup/index.d.ts +4 -3
- package/dist/components/NewsletterSignup/index.js +54 -8
- package/dist/components/Root/productState.d.ts +1 -0
- package/dist/components/Root/productState.js +9 -2
- package/dist/components/StoreModal/StoreModalFamily.js +5 -4
- package/dist/components/StoreModal/StoreModalFamilyButton.js +1 -1
- package/dist/components/StoreModal/StoreModalStyleButton.js +5 -6
- package/dist/components/TestFontsForm/index.js +3 -2
- package/dist/components/elements/StoreModalFamilyButton/index.js +2 -4
- package/dist/components/elements/StoreModalStyleButton/index.d.ts +1 -1
- package/dist/components/elements/StoreModalStyleButton/index.js +3 -3
- package/dist/utils.d.ts +2 -2
- package/dist/utils.js +5 -5
- package/fontdue.css +48 -21
- package/fontdue.css.map +1 -1
- package/package.json +1 -1
|
@@ -10,6 +10,7 @@ export declare type productState_collection = {
|
|
|
10
10
|
};
|
|
11
11
|
} | null;
|
|
12
12
|
readonly fontStyles: ReadonlyArray<{
|
|
13
|
+
readonly id: string;
|
|
13
14
|
readonly sku: {
|
|
14
15
|
readonly id: string;
|
|
15
16
|
readonly price: {
|
|
@@ -27,6 +28,7 @@ export declare type productState_collection = {
|
|
|
27
28
|
};
|
|
28
29
|
} | null;
|
|
29
30
|
readonly fontStyles: ReadonlyArray<{
|
|
31
|
+
readonly id: string;
|
|
30
32
|
readonly sku: {
|
|
31
33
|
readonly id: string;
|
|
32
34
|
readonly price: {
|
|
@@ -58,7 +58,9 @@ const node = function () {
|
|
|
58
58
|
"kind": "LinkedField",
|
|
59
59
|
"name": "fontStyles",
|
|
60
60
|
"plural": true,
|
|
61
|
-
"selections": [
|
|
61
|
+
"selections": [v0
|
|
62
|
+
/*: any*/
|
|
63
|
+
, v2
|
|
62
64
|
/*: any*/
|
|
63
65
|
],
|
|
64
66
|
"storageKey": null
|
|
@@ -101,6 +103,6 @@ const node = function () {
|
|
|
101
103
|
};
|
|
102
104
|
}();
|
|
103
105
|
|
|
104
|
-
node.hash = '
|
|
106
|
+
node.hash = '90e56933f956c6773c0958284de81884';
|
|
105
107
|
var _default = node;
|
|
106
108
|
exports.default = _default;
|
|
@@ -10,6 +10,7 @@ export declare type productState_node = {
|
|
|
10
10
|
};
|
|
11
11
|
} | null;
|
|
12
12
|
readonly fontStyles: ReadonlyArray<{
|
|
13
|
+
readonly id: string;
|
|
13
14
|
readonly sku: {
|
|
14
15
|
readonly id: string;
|
|
15
16
|
readonly price: {
|
|
@@ -27,6 +28,7 @@ export declare type productState_node = {
|
|
|
27
28
|
};
|
|
28
29
|
} | null;
|
|
29
30
|
readonly fontStyles: ReadonlyArray<{
|
|
31
|
+
readonly id: string;
|
|
30
32
|
readonly sku: {
|
|
31
33
|
readonly id: string;
|
|
32
34
|
readonly price: {
|
|
@@ -45,6 +47,7 @@ export declare type productState_node = {
|
|
|
45
47
|
};
|
|
46
48
|
} | null;
|
|
47
49
|
readonly fontStyles: ReadonlyArray<{
|
|
50
|
+
readonly id: string;
|
|
48
51
|
readonly sku: {
|
|
49
52
|
readonly id: string;
|
|
50
53
|
readonly price: {
|
|
@@ -62,6 +65,7 @@ export declare type productState_node = {
|
|
|
62
65
|
};
|
|
63
66
|
} | null;
|
|
64
67
|
readonly fontStyles: ReadonlyArray<{
|
|
68
|
+
readonly id: string;
|
|
65
69
|
readonly sku: {
|
|
66
70
|
readonly id: string;
|
|
67
71
|
readonly price: {
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
interface
|
|
2
|
+
interface NewsletterSignup_baseProps {
|
|
3
3
|
optInLabel?: string;
|
|
4
|
+
successLabel?: string;
|
|
4
5
|
buttonLabel?: string;
|
|
5
6
|
optInCheckboxChecked?: boolean;
|
|
6
7
|
title?: string;
|
|
7
8
|
intro?: string;
|
|
8
9
|
}
|
|
9
|
-
declare const
|
|
10
|
-
export default
|
|
10
|
+
declare const NewsletterSignupFetcher: React.FC<NewsletterSignup_baseProps>;
|
|
11
|
+
export default NewsletterSignupFetcher;
|
|
@@ -13,7 +13,7 @@ var _TextField = _interopRequireDefault(require("../TextField"));
|
|
|
13
13
|
|
|
14
14
|
var _Check = _interopRequireDefault(require("../Icons/Check"));
|
|
15
15
|
|
|
16
|
-
var _NewsletterSignupUpdateCustomerMutation;
|
|
16
|
+
var _NewsletterSignupUpdateCustomerMutation, _NewsletterSignup_viewer, _NewsletterSignup_Query;
|
|
17
17
|
|
|
18
18
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
19
19
|
|
|
@@ -21,16 +21,23 @@ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "functio
|
|
|
21
21
|
|
|
22
22
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
23
23
|
|
|
24
|
+
function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
25
|
+
|
|
24
26
|
const updateCustomerMutation = _NewsletterSignupUpdateCustomerMutation !== void 0 ? _NewsletterSignupUpdateCustomerMutation : (_NewsletterSignupUpdateCustomerMutation = require("../../__generated__/NewsletterSignupUpdateCustomerMutation.graphql"), _NewsletterSignupUpdateCustomerMutation.hash && _NewsletterSignupUpdateCustomerMutation.hash !== "769087891b6f263122bbb630b3f2ca6c" && console.error("The definition of 'NewsletterSignupUpdateCustomerMutation' appears to have changed. Run `relay-compiler` to update the generated files to receive the expected data."), _NewsletterSignupUpdateCustomerMutation);
|
|
25
27
|
|
|
26
28
|
const NewsletterSignup = _ref => {
|
|
29
|
+
var _data$settings, _ref3, _data$settings2;
|
|
30
|
+
|
|
27
31
|
let {
|
|
28
|
-
optInLabel,
|
|
32
|
+
optInLabel: optInLabelProp,
|
|
33
|
+
successLabel: successLabelProp,
|
|
29
34
|
buttonLabel = 'Subscribe',
|
|
30
35
|
optInCheckboxChecked = false,
|
|
31
36
|
title,
|
|
32
|
-
intro
|
|
37
|
+
intro,
|
|
38
|
+
viewer
|
|
33
39
|
} = _ref;
|
|
40
|
+
const data = (0, _reactRelay.useFragment)(_NewsletterSignup_viewer !== void 0 ? _NewsletterSignup_viewer : (_NewsletterSignup_viewer = require("../../__generated__/NewsletterSignup_viewer.graphql"), _NewsletterSignup_viewer.hash && _NewsletterSignup_viewer.hash !== "05823550a311988e999fd9b95cc39dac" && console.error("The definition of 'NewsletterSignup_viewer' appears to have changed. Run `relay-compiler` to update the generated files to receive the expected data."), _NewsletterSignup_viewer), viewer);
|
|
34
41
|
const [name, setName] = (0, _react.useState)('');
|
|
35
42
|
const [email, setEmail] = (0, _react.useState)('');
|
|
36
43
|
const [newsletterOptIn, setNewsletterOptIn] = (0, _react.useState)(optInCheckboxChecked);
|
|
@@ -76,10 +83,19 @@ const NewsletterSignup = _ref => {
|
|
|
76
83
|
});
|
|
77
84
|
};
|
|
78
85
|
|
|
86
|
+
const disabled = submitting || !newsletterOptIn || !email || !name;
|
|
87
|
+
const optInLabel = optInLabelProp || (data === null || data === void 0 ? void 0 : (_data$settings = data.settings) === null || _data$settings === void 0 ? void 0 : _data$settings.newsletterOptInLabel);
|
|
88
|
+
const successLabel = (_ref3 = successLabelProp || (data === null || data === void 0 ? void 0 : (_data$settings2 = data.settings) === null || _data$settings2 === void 0 ? void 0 : _data$settings2.newsletterSuccessLabel)) !== null && _ref3 !== void 0 ? _ref3 : 'Success!';
|
|
89
|
+
|
|
79
90
|
if (submitted) {
|
|
80
91
|
return /*#__PURE__*/_react.default.createElement("div", {
|
|
81
92
|
className: "newsletter-signup"
|
|
82
|
-
}, "
|
|
93
|
+
}, /*#__PURE__*/_react.default.createElement("div", {
|
|
94
|
+
className: "newsletter-signup__success",
|
|
95
|
+
dangerouslySetInnerHTML: {
|
|
96
|
+
__html: successLabel
|
|
97
|
+
}
|
|
98
|
+
}));
|
|
83
99
|
}
|
|
84
100
|
|
|
85
101
|
return /*#__PURE__*/_react.default.createElement("div", {
|
|
@@ -121,16 +137,46 @@ const NewsletterSignup = _ref => {
|
|
|
121
137
|
}), /*#__PURE__*/_react.default.createElement("div", {
|
|
122
138
|
className: "checkbox__icon"
|
|
123
139
|
}, /*#__PURE__*/_react.default.createElement(_Check.default, null))), /*#__PURE__*/_react.default.createElement("label", {
|
|
124
|
-
htmlFor: "customer-newsletter-opt-in"
|
|
125
|
-
|
|
140
|
+
htmlFor: "customer-newsletter-opt-in",
|
|
141
|
+
dangerouslySetInnerHTML: {
|
|
142
|
+
__html: optInLabel !== null && optInLabel !== void 0 ? optInLabel : ''
|
|
143
|
+
}
|
|
144
|
+
})), /*#__PURE__*/_react.default.createElement("div", {
|
|
126
145
|
className: "newsletter-signup__section"
|
|
127
146
|
}, /*#__PURE__*/_react.default.createElement("button", {
|
|
128
147
|
className: "submit-button",
|
|
129
|
-
disabled:
|
|
148
|
+
disabled: disabled
|
|
130
149
|
}, submitting ? 'Submitting...' : buttonLabel, /*#__PURE__*/_react.default.createElement("span", {
|
|
131
150
|
className: "submit-button__arrow"
|
|
132
151
|
}, ' →')))));
|
|
133
152
|
};
|
|
134
153
|
|
|
135
|
-
|
|
154
|
+
const NewsletterSignupFetcher = params => {
|
|
155
|
+
const environment = (0, _reactRelay.useRelayEnvironment)();
|
|
156
|
+
return /*#__PURE__*/_react.default.createElement(_reactRelay.QueryRenderer, {
|
|
157
|
+
environment: environment,
|
|
158
|
+
query: _NewsletterSignup_Query !== void 0 ? _NewsletterSignup_Query : (_NewsletterSignup_Query = require("../../__generated__/NewsletterSignup_Query.graphql"), _NewsletterSignup_Query.hash && _NewsletterSignup_Query.hash !== "ede23ce8fe999201dacb066fcef009af" && console.error("The definition of 'NewsletterSignup_Query' appears to have changed. Run `relay-compiler` to update the generated files to receive the expected data."), _NewsletterSignup_Query),
|
|
159
|
+
variables: {},
|
|
160
|
+
render: _ref4 => {
|
|
161
|
+
let {
|
|
162
|
+
props,
|
|
163
|
+
error
|
|
164
|
+
} = _ref4;
|
|
165
|
+
|
|
166
|
+
if (error) {
|
|
167
|
+
console.error(error); // TODO: centralize error component, report to sentry
|
|
168
|
+
|
|
169
|
+
return null;
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
if (props) {
|
|
173
|
+
return /*#__PURE__*/_react.default.createElement(NewsletterSignup, _extends({}, params, props));
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
return /*#__PURE__*/_react.default.createElement("div", null, "Loading...");
|
|
177
|
+
}
|
|
178
|
+
});
|
|
179
|
+
};
|
|
180
|
+
|
|
181
|
+
var _default = NewsletterSignupFetcher;
|
|
136
182
|
exports.default = _default;
|
|
@@ -4,6 +4,7 @@ import { FontdueState, FontdueAction } from '../../reducer';
|
|
|
4
4
|
export declare const populateProductState: (store: Store<FontdueState, FontdueAction>, environment: Environment, id: string) => import("relay-runtime").Subscription | undefined;
|
|
5
5
|
export interface CollectionStyleSkus {
|
|
6
6
|
fontStyleSkuIds: string[];
|
|
7
|
+
fontStyleIds: string[];
|
|
7
8
|
childrenSkuIds: string[];
|
|
8
9
|
name: string;
|
|
9
10
|
}
|
|
@@ -12,8 +12,8 @@ var _utils = require("../../utils");
|
|
|
12
12
|
var _productState_sku, _productState_collection, _productState_bundle, _productState_node, _productState_Query;
|
|
13
13
|
|
|
14
14
|
_productState_sku !== void 0 ? _productState_sku : (_productState_sku = require("../../__generated__/productState_sku.graphql"), _productState_sku.hash && _productState_sku.hash !== "2cee6ddddc85699f0c90e2607c0634ef" && console.error("The definition of 'productState_sku' appears to have changed. Run `relay-compiler` to update the generated files to receive the expected data."), _productState_sku);
|
|
15
|
-
_productState_collection !== void 0 ? _productState_collection : (_productState_collection = require("../../__generated__/productState_collection.graphql"), _productState_collection.hash && _productState_collection.hash !== "
|
|
16
|
-
_productState_bundle !== void 0 ? _productState_bundle : (_productState_bundle = require("../../__generated__/productState_bundle.graphql"), _productState_bundle.hash && _productState_bundle.hash !== "
|
|
15
|
+
_productState_collection !== void 0 ? _productState_collection : (_productState_collection = require("../../__generated__/productState_collection.graphql"), _productState_collection.hash && _productState_collection.hash !== "90e56933f956c6773c0958284de81884" && console.error("The definition of 'productState_collection' appears to have changed. Run `relay-compiler` to update the generated files to receive the expected data."), _productState_collection);
|
|
16
|
+
_productState_bundle !== void 0 ? _productState_bundle : (_productState_bundle = require("../../__generated__/productState_bundle.graphql"), _productState_bundle.hash && _productState_bundle.hash !== "fa38bbc9f2062a727da4f5062b362054" && console.error("The definition of 'productState_bundle' appears to have changed. Run `relay-compiler` to update the generated files to receive the expected data."), _productState_bundle);
|
|
17
17
|
_productState_node !== void 0 ? _productState_node : (_productState_node = require("../../__generated__/productState_node.graphql"), _productState_node.hash && _productState_node.hash !== "aab1ef07e0192a0d22a4c300084d9d05" && console.error("The definition of 'productState_node' appears to have changed. Run `relay-compiler` to update the generated files to receive the expected data."), _productState_node);
|
|
18
18
|
const query = _productState_Query !== void 0 ? _productState_Query : (_productState_Query = require("../../__generated__/productState_Query.graphql"), _productState_Query.hash && _productState_Query.hash !== "ac3292bae9a274139d5a525fd0162711" && console.error("The definition of 'productState_Query' appears to have changed. Run `relay-compiler` to update the generated files to receive the expected data."), _productState_Query);
|
|
19
19
|
|
|
@@ -76,8 +76,15 @@ const flattenSkuData = collection => {
|
|
|
76
76
|
let collectionData = {};
|
|
77
77
|
|
|
78
78
|
if (collection.sku) {
|
|
79
|
+
var _collection$fontStyle3, _collection$fontStyle4, _collection$children$2, _collection$children2;
|
|
80
|
+
|
|
79
81
|
collectionData = {
|
|
80
82
|
[collection.sku.id]: {
|
|
83
|
+
fontStyleIds: ((_collection$fontStyle3 = (_collection$fontStyle4 = collection.fontStyles) === null || _collection$fontStyle4 === void 0 ? void 0 : _collection$fontStyle4.map(style => style.id)) !== null && _collection$fontStyle3 !== void 0 ? _collection$fontStyle3 : []).concat('children' in collection ? (_collection$children$2 = (_collection$children2 = collection.children) === null || _collection$children2 === void 0 ? void 0 : _collection$children2.flatMap(child => {
|
|
84
|
+
var _child$fontStyles$map, _child$fontStyles;
|
|
85
|
+
|
|
86
|
+
return (_child$fontStyles$map = (_child$fontStyles = child.fontStyles) === null || _child$fontStyles === void 0 ? void 0 : _child$fontStyles.map(style => style.id)) !== null && _child$fontStyles$map !== void 0 ? _child$fontStyles$map : [];
|
|
87
|
+
})) !== null && _collection$children$2 !== void 0 ? _collection$children$2 : [] : []),
|
|
81
88
|
fontStyleSkuIds: allSkus(collection, false, true).map(sku => sku.id),
|
|
82
89
|
childrenSkuIds: allSkus(collection, true, false).map(sku => sku.id).filter(skuId => {
|
|
83
90
|
var _collection$sku;
|
|
@@ -30,7 +30,7 @@ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj &&
|
|
|
30
30
|
// chunk items if they match condition, but only chunk if they match in
|
|
31
31
|
// consecutive order. this prevents the list from being reordered
|
|
32
32
|
function chunkConsecutiveBy(collection, compare) {
|
|
33
|
-
return collection.reduce((acc, item
|
|
33
|
+
return collection.reduce((acc, item) => {
|
|
34
34
|
const last = acc[acc.length - 1];
|
|
35
35
|
|
|
36
36
|
if (last && compare(last[0], item)) {
|
|
@@ -42,7 +42,7 @@ function chunkConsecutiveBy(collection, compare) {
|
|
|
42
42
|
}
|
|
43
43
|
|
|
44
44
|
const stylesGrouped = collection => {
|
|
45
|
-
if (!collection.fontStyles) return
|
|
45
|
+
if (!collection.fontStyles) return [];
|
|
46
46
|
return chunkConsecutiveBy(collection.fontStyles, (left, right) => left.cssFamily === right.cssFamily && left.cssWeight === right.cssWeight && left.cssStretch === right.cssStretch);
|
|
47
47
|
};
|
|
48
48
|
|
|
@@ -54,6 +54,7 @@ const StoreModalFamily = _ref => {
|
|
|
54
54
|
onSelect
|
|
55
55
|
} = _ref;
|
|
56
56
|
const fontStyles = (0, _react.useMemo)(() => stylesGrouped(collection), [collection]);
|
|
57
|
+
if ((fontStyles === null || fontStyles === void 0 ? void 0 : fontStyles.length) === 0 && collection.collectionType === 'superfamily' && !collection.sku) return null;
|
|
57
58
|
return /*#__PURE__*/_react.default.createElement(_StoreModalFamily.default, null, {
|
|
58
59
|
stylesheet: collection.cssUrl && /*#__PURE__*/_react.default.createElement(_Stylesheet.default, {
|
|
59
60
|
href: collection.cssUrl
|
|
@@ -67,7 +68,7 @@ const StoreModalFamily = _ref => {
|
|
|
67
68
|
bundle: bundle,
|
|
68
69
|
onSelectSku: onSelect
|
|
69
70
|
})),
|
|
70
|
-
styleGroups: fontStyles
|
|
71
|
+
styleGroups: fontStyles.map(group => group.map(fontStyle => /*#__PURE__*/_react.default.createElement(_StoreModalStyleButton.default, {
|
|
71
72
|
key: fontStyle.id,
|
|
72
73
|
fontStyle: fontStyle,
|
|
73
74
|
onSelectSku: onSelect
|
|
@@ -76,7 +77,7 @@ const StoreModalFamily = _ref => {
|
|
|
76
77
|
};
|
|
77
78
|
|
|
78
79
|
var _default = (0, _reactRelay.createFragmentContainer)(StoreModalFamily, {
|
|
79
|
-
collection: _StoreModalFamily_collection !== void 0 ? _StoreModalFamily_collection : (_StoreModalFamily_collection = require("../../__generated__/StoreModalFamily_collection.graphql"), _StoreModalFamily_collection.hash && _StoreModalFamily_collection.hash !== "
|
|
80
|
+
collection: _StoreModalFamily_collection !== void 0 ? _StoreModalFamily_collection : (_StoreModalFamily_collection = require("../../__generated__/StoreModalFamily_collection.graphql"), _StoreModalFamily_collection.hash && _StoreModalFamily_collection.hash !== "ba6def0c7ad16af4a476e64ef4e1dcca" && console.error("The definition of 'StoreModalFamily_collection' appears to have changed. Run `relay-compiler` to update the generated files to receive the expected data."), _StoreModalFamily_collection)
|
|
80
81
|
});
|
|
81
82
|
|
|
82
83
|
exports.default = _default;
|
|
@@ -55,7 +55,7 @@ const FamilyButton = _ref => {
|
|
|
55
55
|
|
|
56
56
|
return /*#__PURE__*/_react.default.createElement(_StoreModalFamilyButton.default, _extends({
|
|
57
57
|
selected: selected,
|
|
58
|
-
onClick: handleClick
|
|
58
|
+
onClick: collection.sku ? handleClick : undefined
|
|
59
59
|
}, rest), {
|
|
60
60
|
name: collection.featureStyle && /*#__PURE__*/_react.default.createElement(_FontStyle.default, {
|
|
61
61
|
Component: "span",
|
|
@@ -34,8 +34,7 @@ const StoreModalStyleButton = _ref => {
|
|
|
34
34
|
relay,
|
|
35
35
|
...rest
|
|
36
36
|
} = _ref;
|
|
37
|
-
|
|
38
|
-
const selected = (0, _reactRedux.useSelector)((0, _reducer.isSelected)(fontStyle.sku.id));
|
|
37
|
+
const selected = (0, _reactRedux.useSelector)((0, _reducer.isSelected)(fontStyle.sku ? fontStyle.sku.id : fontStyle.id));
|
|
39
38
|
|
|
40
39
|
const handleSelect = () => {
|
|
41
40
|
if (!fontStyle.sku) return;
|
|
@@ -43,7 +42,7 @@ const StoreModalStyleButton = _ref => {
|
|
|
43
42
|
};
|
|
44
43
|
|
|
45
44
|
return /*#__PURE__*/_react.default.createElement(_StoreModalStyleButton.default, _extends({}, rest, {
|
|
46
|
-
onClick: handleSelect,
|
|
45
|
+
onClick: fontStyle.sku ? handleSelect : undefined,
|
|
47
46
|
selected: selected
|
|
48
47
|
}), {
|
|
49
48
|
aa: /*#__PURE__*/_react.default.createElement(_FontStyle.default, {
|
|
@@ -51,16 +50,16 @@ const StoreModalStyleButton = _ref => {
|
|
|
51
50
|
Component: "span"
|
|
52
51
|
}, "Aa"),
|
|
53
52
|
name: fontStyle.name,
|
|
54
|
-
price: /*#__PURE__*/_react.default.createElement(_SKUPrice.default, {
|
|
53
|
+
price: fontStyle.sku ? /*#__PURE__*/_react.default.createElement(_SKUPrice.default, {
|
|
55
54
|
sku: fontStyle.sku,
|
|
56
55
|
format: _Price.PriceFormat.Truncated,
|
|
57
56
|
showCollectionSavings: !selected
|
|
58
|
-
})
|
|
57
|
+
}) : null
|
|
59
58
|
});
|
|
60
59
|
};
|
|
61
60
|
|
|
62
61
|
var _default = (0, _reactRelay.createFragmentContainer)(StoreModalStyleButton, {
|
|
63
|
-
fontStyle: _StoreModalStyleButton_fontStyle !== void 0 ? _StoreModalStyleButton_fontStyle : (_StoreModalStyleButton_fontStyle = require("../../__generated__/StoreModalStyleButton_fontStyle.graphql"), _StoreModalStyleButton_fontStyle.hash && _StoreModalStyleButton_fontStyle.hash !== "
|
|
62
|
+
fontStyle: _StoreModalStyleButton_fontStyle !== void 0 ? _StoreModalStyleButton_fontStyle : (_StoreModalStyleButton_fontStyle = require("../../__generated__/StoreModalStyleButton_fontStyle.graphql"), _StoreModalStyleButton_fontStyle.hash && _StoreModalStyleButton_fontStyle.hash !== "89e85cab35cfb1e88e83fcb01ba235ac" && console.error("The definition of 'StoreModalStyleButton_fontStyle' appears to have changed. Run `relay-compiler` to update the generated files to receive the expected data."), _StoreModalStyleButton_fontStyle)
|
|
64
63
|
});
|
|
65
64
|
|
|
66
65
|
exports.default = _default;
|
|
@@ -118,7 +118,7 @@ const TestFontsFormBase = _ref2 => {
|
|
|
118
118
|
}, /*#__PURE__*/_react.default.createElement("div", {
|
|
119
119
|
className: "test-fonts__section"
|
|
120
120
|
}, /*#__PURE__*/_react.default.createElement(_TextField.default, {
|
|
121
|
-
label: "Name*",
|
|
121
|
+
label: "Name *",
|
|
122
122
|
value: name,
|
|
123
123
|
onChange: value => setName(value),
|
|
124
124
|
autocomplete: "name",
|
|
@@ -126,7 +126,8 @@ const TestFontsFormBase = _ref2 => {
|
|
|
126
126
|
})), /*#__PURE__*/_react.default.createElement("div", {
|
|
127
127
|
className: "test-fonts__section"
|
|
128
128
|
}, /*#__PURE__*/_react.default.createElement(_TextField.default, {
|
|
129
|
-
label: "Email*",
|
|
129
|
+
label: "Email *",
|
|
130
|
+
type: "email",
|
|
130
131
|
value: email,
|
|
131
132
|
onChange: value => setEmail(value),
|
|
132
133
|
autocomplete: "email",
|
|
@@ -27,14 +27,12 @@ const StoreModalFamilyButton = _ref => {
|
|
|
27
27
|
},
|
|
28
28
|
...rest
|
|
29
29
|
} = _ref;
|
|
30
|
-
if (!price) return /*#__PURE__*/_react.default.createElement("div", {
|
|
31
|
-
className: "store-modal__family-button__no-price"
|
|
32
|
-
});
|
|
33
30
|
return /*#__PURE__*/_react.default.createElement(_Button.default, _extends({
|
|
34
31
|
onClick: onClick,
|
|
35
32
|
className: (0, _classnames.default)('store-modal__family-button__button', className)
|
|
36
33
|
}, rest, {
|
|
37
|
-
"data-selected": selected
|
|
34
|
+
"data-selected": selected,
|
|
35
|
+
"data-clickable": Boolean(onClick)
|
|
38
36
|
}), /*#__PURE__*/_react.default.createElement("div", {
|
|
39
37
|
className: "store-modal__family-button__container"
|
|
40
38
|
}, /*#__PURE__*/_react.default.createElement("div", {
|
|
@@ -7,7 +7,7 @@ exports.default = void 0;
|
|
|
7
7
|
|
|
8
8
|
var _react = _interopRequireDefault(require("react"));
|
|
9
9
|
|
|
10
|
-
var _Button = _interopRequireDefault(require("
|
|
10
|
+
var _Button = _interopRequireDefault(require("../Button"));
|
|
11
11
|
|
|
12
12
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
13
13
|
|
|
@@ -23,9 +23,9 @@ const StoreModalStyleButton = _ref => {
|
|
|
23
23
|
},
|
|
24
24
|
...rest
|
|
25
25
|
} = _ref;
|
|
26
|
-
if (!price) return null;
|
|
27
26
|
return /*#__PURE__*/_react.default.createElement(_Button.default, _extends({}, rest, {
|
|
28
|
-
"data-selected": selected
|
|
27
|
+
"data-selected": selected,
|
|
28
|
+
"data-clickable": Boolean(rest.onClick)
|
|
29
29
|
}), /*#__PURE__*/_react.default.createElement("span", {
|
|
30
30
|
className: "store-modal__style-button__button"
|
|
31
31
|
}, /*#__PURE__*/_react.default.createElement("span", {
|
package/dist/utils.d.ts
CHANGED
|
@@ -3,10 +3,10 @@ import type { FontdueState } from './reducer';
|
|
|
3
3
|
export declare const pluralize: (count: number, singular: string, plural?: string | undefined) => string;
|
|
4
4
|
export declare function notEmpty<TValue>(value: TValue | null | undefined): value is TValue;
|
|
5
5
|
export declare function kebabToCamel(str: string): string;
|
|
6
|
-
export declare const collContainsSkuId: (coll: CollectionStyleSkus | undefined,
|
|
6
|
+
export declare const collContainsSkuId: (coll: CollectionStyleSkus | undefined, skuIdOrStyleId: string) => boolean;
|
|
7
7
|
interface CollectionSkuIdsDifferences {
|
|
8
8
|
[collectionSkuId: string]: number;
|
|
9
9
|
}
|
|
10
|
-
export declare const isSelected: (
|
|
10
|
+
export declare const isSelected: (skuIdOrStyleId: string) => (state: FontdueState) => boolean;
|
|
11
11
|
export declare const collectionSkuIdsDifferences: (state: FontdueState, skuId: string) => CollectionSkuIdsDifferences;
|
|
12
12
|
export {};
|
package/dist/utils.js
CHANGED
|
@@ -27,17 +27,17 @@ function kebabToCamel(str) {
|
|
|
27
27
|
} // where coll is a member of `collectionStyleSkus`;
|
|
28
28
|
|
|
29
29
|
|
|
30
|
-
const collContainsSkuId = (coll,
|
|
30
|
+
const collContainsSkuId = (coll, skuIdOrStyleId) => {
|
|
31
31
|
if (!coll) return false;
|
|
32
|
-
return coll.childrenSkuIds.indexOf(
|
|
32
|
+
return coll.childrenSkuIds.indexOf(skuIdOrStyleId) >= 0 || coll.fontStyleSkuIds.indexOf(skuIdOrStyleId) >= 0 || coll.fontStyleIds.indexOf(skuIdOrStyleId) >= 0;
|
|
33
33
|
};
|
|
34
34
|
|
|
35
35
|
exports.collContainsSkuId = collContainsSkuId;
|
|
36
36
|
|
|
37
|
-
const isSelected =
|
|
37
|
+
const isSelected = skuIdOrStyleId => state => {
|
|
38
38
|
// get the collections that contain this skuId as a fontStyle
|
|
39
|
-
const collectionSkuIds = Object.keys(state.collectionStyleSkus).filter(collSkuId => collContainsSkuId(state.collectionStyleSkus[collSkuId],
|
|
40
|
-
return state.selectedSkuIds[
|
|
39
|
+
const collectionSkuIds = Object.keys(state.collectionStyleSkus).filter(collSkuId => collContainsSkuId(state.collectionStyleSkus[collSkuId], skuIdOrStyleId));
|
|
40
|
+
return state.selectedSkuIds[skuIdOrStyleId] === true || collectionSkuIds.some(collSkuId => state.selectedSkuIds[collSkuId] === true);
|
|
41
41
|
};
|
|
42
42
|
|
|
43
43
|
exports.isSelected = isSelected;
|
package/fontdue.css
CHANGED
|
@@ -820,6 +820,7 @@ div[data-component=TypeTesters] {
|
|
|
820
820
|
text-align: center;
|
|
821
821
|
border: 1px solid;
|
|
822
822
|
margin-bottom: 16px;
|
|
823
|
+
white-space: pre;
|
|
823
824
|
}
|
|
824
825
|
|
|
825
826
|
.character-viewer__monitor__details {
|
|
@@ -1308,24 +1309,18 @@ body[data-fontdue-store-modal=open] {
|
|
|
1308
1309
|
.store-modal__family__bundle-button:not(:disabled) {
|
|
1309
1310
|
cursor: pointer;
|
|
1310
1311
|
}
|
|
1311
|
-
.store-modal__family__style-button:hover:not(:disabled),
|
|
1312
|
-
.store-modal__family__family-button:hover:not(:disabled),
|
|
1313
|
-
.store-modal__family__bundle-button:hover:not(:disabled) {
|
|
1314
|
-
border-color: var(--button_hover_border-color);
|
|
1315
|
-
background: var(--button_hover_background_color);
|
|
1316
|
-
color: var(--button_hover_text_color);
|
|
1317
|
-
}
|
|
1318
1312
|
.store-modal__family__style-button:disabled,
|
|
1319
1313
|
.store-modal__family__family-button:disabled,
|
|
1320
1314
|
.store-modal__family__bundle-button:disabled {
|
|
1321
1315
|
opacity: 0.5;
|
|
1322
1316
|
}
|
|
1323
|
-
.store-modal__family__style-button:hover:not(:disabled),
|
|
1324
|
-
.store-modal__family__family-button:hover:not(:disabled),
|
|
1325
|
-
.store-modal__family__bundle-button:hover:not(:disabled) {
|
|
1317
|
+
.store-modal__family__style-button[data-clickable=true]:hover:not(:disabled),
|
|
1318
|
+
.store-modal__family__family-button[data-clickable=true]:hover:not(:disabled),
|
|
1319
|
+
.store-modal__family__bundle-button[data-clickable=true]:hover:not(:disabled) {
|
|
1320
|
+
border-color: var(--button_hover_border-color);
|
|
1326
1321
|
background: var(--button_hover_background_color);
|
|
1327
1322
|
color: var(--button_hover_text_color);
|
|
1328
|
-
|
|
1323
|
+
background: var(--button_hover_background_color);
|
|
1329
1324
|
z-index: 1;
|
|
1330
1325
|
}
|
|
1331
1326
|
.store-modal__family__style-button[data-selected=true]:not(:disabled),
|
|
@@ -1336,16 +1331,33 @@ body[data-fontdue-store-modal=open] {
|
|
|
1336
1331
|
color: var(--button_selected_text_color);
|
|
1337
1332
|
z-index: 1;
|
|
1338
1333
|
}
|
|
1334
|
+
.store-modal__family__style-button[data-selected=true]:not(:disabled):hover,
|
|
1335
|
+
.store-modal__family__family-button[data-selected=true]:not(:disabled):hover,
|
|
1336
|
+
.store-modal__family__bundle-button[data-selected=true]:not(:disabled):hover {
|
|
1337
|
+
background: var(--button_selected_background_color);
|
|
1338
|
+
}
|
|
1339
|
+
.store-modal__family__style-button[data-clickable=false],
|
|
1340
|
+
.store-modal__family__family-button[data-clickable=false],
|
|
1341
|
+
.store-modal__family__bundle-button[data-clickable=false] {
|
|
1342
|
+
cursor: auto;
|
|
1343
|
+
}
|
|
1344
|
+
|
|
1345
|
+
.store-modal__family__family-button[data-clickable=false] {
|
|
1346
|
+
padding-left: 0;
|
|
1347
|
+
padding-right: 0;
|
|
1348
|
+
box-shadow: none;
|
|
1349
|
+
}
|
|
1339
1350
|
|
|
1340
1351
|
.store-modal__family-button__container {
|
|
1341
1352
|
display: grid;
|
|
1342
1353
|
align-items: baseline;
|
|
1343
1354
|
grid-template-columns: max-content auto max-content;
|
|
1344
1355
|
grid-column-gap: 10px;
|
|
1356
|
+
grid-row-gap: 10px;
|
|
1345
1357
|
}
|
|
1346
1358
|
@media (max-width: 899px) {
|
|
1347
1359
|
.store-modal__family-button__container {
|
|
1348
|
-
grid-template-columns: auto
|
|
1360
|
+
grid-template-columns: auto auto;
|
|
1349
1361
|
}
|
|
1350
1362
|
}
|
|
1351
1363
|
|
|
@@ -1363,6 +1375,12 @@ body[data-fontdue-store-modal=open] {
|
|
|
1363
1375
|
|
|
1364
1376
|
.store-modal__family-button__name {
|
|
1365
1377
|
font-size: 32px;
|
|
1378
|
+
line-height: normal;
|
|
1379
|
+
}
|
|
1380
|
+
@media (max-width: 899px) {
|
|
1381
|
+
.store-modal__family-button__name {
|
|
1382
|
+
grid-column: 1/span 2;
|
|
1383
|
+
}
|
|
1366
1384
|
}
|
|
1367
1385
|
|
|
1368
1386
|
.store-modal__family-button__no-sku {
|
|
@@ -1688,16 +1706,20 @@ body[data-fontdue-store-modal=open] {
|
|
|
1688
1706
|
display: grid;
|
|
1689
1707
|
grid-template-columns: 1fr max-content;
|
|
1690
1708
|
grid-gap: 40px;
|
|
1691
|
-
padding: 30px;
|
|
1692
|
-
border-bottom: 1px solid color(grey);
|
|
1693
1709
|
margin-right: calc(-1 * var(--StoreModalPageContainer-padding));
|
|
1694
1710
|
margin-left: calc(-1 * var(--StoreModalPageContainer-padding));
|
|
1695
1711
|
padding-left: var(--StoreModalPageContainer-padding);
|
|
1696
1712
|
padding-right: var(--StoreModalPageContainer-padding);
|
|
1697
1713
|
}
|
|
1714
|
+
.store-modal__review-item__container:not(:first-child) {
|
|
1715
|
+
padding-top: 30px;
|
|
1716
|
+
border-bottom: 1px solid color(grey);
|
|
1717
|
+
}
|
|
1718
|
+
.store-modal__review-item__container:not(:last-child) {
|
|
1719
|
+
padding-bottom: 30px;
|
|
1720
|
+
}
|
|
1698
1721
|
.store-modal__review-item__container:last-child {
|
|
1699
1722
|
border: none;
|
|
1700
|
-
padding-bottom: 0;
|
|
1701
1723
|
}
|
|
1702
1724
|
|
|
1703
1725
|
.store-modal__review__container {
|
|
@@ -1732,13 +1754,18 @@ body[data-fontdue-store-modal=open] {
|
|
|
1732
1754
|
padding-bottom: 30px;
|
|
1733
1755
|
border-bottom: 1px solid var(--horizontal_rule_color);
|
|
1734
1756
|
display: grid;
|
|
1735
|
-
grid-template-columns: 1fr
|
|
1757
|
+
grid-template-columns: 1fr 2fr;
|
|
1736
1758
|
grid-column-gap: 20px;
|
|
1737
1759
|
margin-right: calc(-1 * var(--StoreModalPageContainer-side-padding));
|
|
1738
1760
|
margin-left: calc(-1 * var(--StoreModalPageContainer-side-padding));
|
|
1739
1761
|
padding-left: var(--StoreModalPageContainer-side-padding);
|
|
1740
1762
|
padding-right: var(--StoreModalPageContainer-side-padding);
|
|
1741
1763
|
}
|
|
1764
|
+
@media (min-width: 900px) {
|
|
1765
|
+
.store-modal__review__section {
|
|
1766
|
+
grid-template-columns: 1fr 1fr;
|
|
1767
|
+
}
|
|
1768
|
+
}
|
|
1742
1769
|
.store-modal__review__section:not(:first-child) {
|
|
1743
1770
|
padding-top: 30px;
|
|
1744
1771
|
}
|
|
@@ -1749,17 +1776,17 @@ body[data-fontdue-store-modal=open] {
|
|
|
1749
1776
|
|
|
1750
1777
|
.store-modal__review__totals {
|
|
1751
1778
|
display: grid;
|
|
1752
|
-
|
|
1779
|
+
grid-template-columns: 1fr 2fr;
|
|
1780
|
+
grid-column-gap: 20px;
|
|
1753
1781
|
}
|
|
1754
1782
|
@media (min-width: 900px) {
|
|
1755
1783
|
.store-modal__review__totals {
|
|
1756
1784
|
grid-template-columns: 1fr 1fr;
|
|
1757
|
-
grid-column-gap: 20px;
|
|
1758
|
-
}
|
|
1759
|
-
.store-modal__review__totals .cart__price-blocks {
|
|
1760
|
-
grid-column: 2;
|
|
1761
1785
|
}
|
|
1762
1786
|
}
|
|
1787
|
+
.store-modal__review__totals .cart__price-blocks {
|
|
1788
|
+
grid-column: 2;
|
|
1789
|
+
}
|
|
1763
1790
|
|
|
1764
1791
|
.store-modal__review__confirm {
|
|
1765
1792
|
margin-right: calc(-1 * var(--StoreModalPageContainer-side-padding));
|