fontdue-js 2.18.3 → 2.19.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 +15 -0
- package/dist/__generated__/AddToCartBannerQuery.graphql.d.ts +1 -1
- package/dist/__generated__/AddToCartBannerQuery.graphql.js +22 -7
- package/dist/__generated__/AddToCartBanner_item.graphql.d.ts +10 -1
- package/dist/__generated__/AddToCartBanner_item.graphql.js +19 -4
- package/dist/__generated__/AddToCartBanner_order.graphql.d.ts +10 -1
- package/dist/__generated__/AddToCartBanner_order.graphql.js +18 -3
- package/dist/__generated__/CartItemProduct_product.graphql.d.ts +4 -1
- package/dist/__generated__/CartItemProduct_product.graphql.js +15 -5
- package/dist/__generated__/CartOrderCompleteOrderMutation.graphql.d.ts +1 -1
- package/dist/__generated__/CartOrderCompleteOrderMutation.graphql.js +27 -5
- package/dist/__generated__/CartOrderRemoveDiscountMutation.graphql.d.ts +1 -1
- package/dist/__generated__/CartOrderRemoveDiscountMutation.graphql.js +27 -5
- package/dist/__generated__/CartOrderUpdateMutation.graphql.d.ts +1 -1
- package/dist/__generated__/CartOrderUpdateMutation.graphql.js +27 -5
- package/dist/__generated__/CartQuery.graphql.d.ts +1 -1
- package/dist/__generated__/CartQuery.graphql.js +72 -49
- package/dist/__generated__/CartStateRemoveDiscountMutation.graphql.d.ts +1 -1
- package/dist/__generated__/CartStateRemoveDiscountMutation.graphql.js +15 -3
- package/dist/__generated__/CartStateUpdateMutation.graphql.d.ts +1 -1
- package/dist/__generated__/CartStateUpdateMutation.graphql.js +27 -5
- package/dist/__generated__/CartTotals_order.graphql.d.ts +3 -1
- package/dist/__generated__/CartTotals_order.graphql.js +14 -2
- package/dist/__generated__/CheckoutUpdateCustomerMutation.graphql.d.ts +1 -1
- package/dist/__generated__/CheckoutUpdateCustomerMutation.graphql.js +27 -5
- package/dist/__generated__/CheckoutUpdateOrderMutation.graphql.d.ts +1 -1
- package/dist/__generated__/CheckoutUpdateOrderMutation.graphql.js +27 -5
- package/dist/__generated__/CouponCodeInputApplyCouponMutation.graphql.d.ts +1 -1
- package/dist/__generated__/CouponCodeInputApplyCouponMutation.graphql.js +15 -3
- package/dist/__generated__/CustomerLoginFormQuery.graphql.d.ts +20 -0
- package/dist/__generated__/CustomerLoginFormQuery.graphql.js +91 -0
- package/dist/__generated__/PrecartAddToCartMutation.graphql.d.ts +1 -1
- package/dist/__generated__/PrecartAddToCartMutation.graphql.js +32 -10
- package/dist/__generated__/PrecartClearCartMutation.graphql.d.ts +61 -0
- package/dist/__generated__/PrecartClearCartMutation.graphql.js +81 -0
- package/dist/__generated__/StoreModalCartQuery.graphql.d.ts +1 -1
- package/dist/__generated__/StoreModalCartQuery.graphql.js +67 -44
- package/dist/__generated__/StoreModalCheckoutQuery.graphql.d.ts +1 -1
- package/dist/__generated__/StoreModalCheckoutQuery.graphql.js +18 -17
- package/dist/__generated__/StoreModalFamily_collection.graphql.d.ts +2 -1
- package/dist/__generated__/StoreModalFamily_collection.graphql.js +9 -3
- package/dist/__generated__/StoreModalProductQuery.graphql.d.ts +1 -1
- package/dist/__generated__/StoreModalProductQuery.graphql.js +10 -4
- package/dist/__generated__/StoreModalProductRefetchQuery.graphql.d.ts +1 -1
- package/dist/__generated__/StoreModalProductRefetchQuery.graphql.js +10 -4
- package/dist/__generated__/StoreModalProductSummaryClearCartMutation.graphql.d.ts +61 -0
- package/dist/__generated__/StoreModalProductSummaryClearCartMutation.graphql.js +81 -0
- package/dist/__generated__/StoreModalUnifiedCheckoutUpdateOrderMutation.graphql.d.ts +1 -1
- package/dist/__generated__/StoreModalUnifiedCheckoutUpdateOrderMutation.graphql.js +15 -3
- package/dist/__generated__/StripeProvider_viewer.graphql.d.ts +2 -1
- package/dist/__generated__/StripeProvider_viewer.graphql.js +78 -75
- package/dist/__generated__/TestFontsFormUpdateCustomerMutation.graphql.d.ts +1 -1
- package/dist/__generated__/TestFontsFormUpdateCustomerMutation.graphql.js +27 -5
- package/dist/components/AddToCartBanner/index.js +7 -1
- package/dist/components/Cart/CartItem/CartItemProduct.js +3 -2
- package/dist/components/Cart/CartTotals.js +7 -7
- package/dist/components/CharacterViewer/index.js +53 -37
- package/dist/components/ConfigContext.d.ts +10 -0
- package/dist/components/ConfigContext.js +7 -2
- package/dist/components/CorsErrorModal.d.ts +1 -0
- package/dist/components/CorsErrorModal.js +99 -0
- package/dist/components/CustomerLoginForm/index.js +12 -4
- package/dist/components/OrderVariableSelection/OrderVariableSelectionRedux.js +2 -1
- package/dist/components/Precart/index.js +30 -4
- package/dist/components/StoreModal/StoreModalFamily.js +2 -2
- package/dist/components/StoreModalProductSummary/index.js +35 -4
- package/dist/components/StripeProvider/index.js +5 -4
- package/dist/components/TypeTester/index.d.ts +5 -0
- package/dist/components/TypeTester/index.js +2 -1
- package/dist/components/TypeTester/useTypeTesterStyler.d.ts +7 -1
- package/dist/components/TypeTester/useTypeTesterStyler.js +8 -2
- package/dist/corsError.d.ts +5 -0
- package/dist/corsError.js +55 -0
- package/dist/fontdue.css +61 -3
- package/dist/relay/environment.js +33 -19
- package/fontdue.css +197 -121
- package/package.json +1 -1
|
@@ -159,7 +159,8 @@ const TypeTester = _ref => {
|
|
|
159
159
|
direction: props.direction,
|
|
160
160
|
min: config.size.min,
|
|
161
161
|
max: config.size.max,
|
|
162
|
-
autofitOnChange: config.autofitOnChange
|
|
162
|
+
autofitOnChange: config.autofitOnChange,
|
|
163
|
+
columns: config.columns
|
|
163
164
|
}));
|
|
164
165
|
}
|
|
165
166
|
return /*#__PURE__*/_react.default.createElement("div", {
|
|
@@ -1,6 +1,11 @@
|
|
|
1
1
|
import { EditorState } from 'draft-js';
|
|
2
2
|
import { Alignment } from './types';
|
|
3
3
|
import { VariableSettings } from '../../utils';
|
|
4
|
+
export type ColumnsConfig = false | {
|
|
5
|
+
count: 'auto' | number;
|
|
6
|
+
width: string;
|
|
7
|
+
gap: string;
|
|
8
|
+
};
|
|
4
9
|
export interface UseTypeTesterStylerProps {
|
|
5
10
|
autofit: boolean;
|
|
6
11
|
autofitOnChange: boolean;
|
|
@@ -20,8 +25,9 @@ export interface UseTypeTesterStylerProps {
|
|
|
20
25
|
contentEdited: boolean;
|
|
21
26
|
alignment: Alignment;
|
|
22
27
|
variableSettings: VariableSettings | null;
|
|
28
|
+
columns: ColumnsConfig;
|
|
23
29
|
}
|
|
24
|
-
declare const useTypeTesterStyler: ({ size, autofit, autofitOnChange, features, setSize, min, max, truncate, focused, lineHeight, letterSpacing, fontStyles, content, contentEdited, alignment, variableSettings, }: UseTypeTesterStylerProps) => {
|
|
30
|
+
declare const useTypeTesterStyler: ({ size, autofit, autofitOnChange, features, setSize, min, max, truncate, focused, lineHeight, letterSpacing, fontStyles, content, contentEdited, alignment, variableSettings, columns, }: UseTypeTesterStylerProps) => {
|
|
25
31
|
ref: import("react").RefObject<HTMLDivElement | null>;
|
|
26
32
|
style: import("react").CSSProperties;
|
|
27
33
|
};
|
|
@@ -42,7 +42,8 @@ const useTypeTesterStyler = _ref => {
|
|
|
42
42
|
content,
|
|
43
43
|
contentEdited,
|
|
44
44
|
alignment,
|
|
45
|
-
variableSettings
|
|
45
|
+
variableSettings,
|
|
46
|
+
columns
|
|
46
47
|
} = _ref;
|
|
47
48
|
const ref = (0, _react.useRef)(null);
|
|
48
49
|
const fontVariationSettings = variableSettings ? Object.keys(variableSettings).map(axis => `'${axis}' ${variableSettings[axis]}`).join(',') : undefined;
|
|
@@ -125,7 +126,12 @@ const useTypeTesterStyler = _ref => {
|
|
|
125
126
|
marginLeft: alignment === 'right' ? -sideBuffer : 0,
|
|
126
127
|
letterSpacing: `${letterSpacing}em`,
|
|
127
128
|
fontVariationSettings,
|
|
128
|
-
textAlign: alignment
|
|
129
|
+
textAlign: alignment,
|
|
130
|
+
...(columns && {
|
|
131
|
+
columnCount: columns.count,
|
|
132
|
+
columnWidth: columns.width,
|
|
133
|
+
columnGap: columns.gap
|
|
134
|
+
})
|
|
129
135
|
};
|
|
130
136
|
return {
|
|
131
137
|
ref,
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.handlePossibleCorsError = handlePossibleCorsError;
|
|
7
|
+
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
|
|
8
|
+
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
9
|
+
let detected = false;
|
|
10
|
+
let navigating = false;
|
|
11
|
+
if (typeof window !== 'undefined') {
|
|
12
|
+
window.addEventListener('beforeunload', () => {
|
|
13
|
+
navigating = true;
|
|
14
|
+
});
|
|
15
|
+
}
|
|
16
|
+
function isCrossOrigin(fetchUrl) {
|
|
17
|
+
try {
|
|
18
|
+
const url = new URL(fetchUrl, window.location.href);
|
|
19
|
+
return url.origin !== window.location.origin;
|
|
20
|
+
} catch {
|
|
21
|
+
return false;
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
function startPolling(fetchUrl) {
|
|
25
|
+
const interval = setInterval(async () => {
|
|
26
|
+
try {
|
|
27
|
+
await fetch(fetchUrl, {
|
|
28
|
+
method: 'POST',
|
|
29
|
+
credentials: 'include'
|
|
30
|
+
});
|
|
31
|
+
clearInterval(interval);
|
|
32
|
+
window.location.reload();
|
|
33
|
+
} catch {
|
|
34
|
+
// still blocked, keep polling
|
|
35
|
+
}
|
|
36
|
+
}, 3000);
|
|
37
|
+
}
|
|
38
|
+
function handlePossibleCorsError(error, fetchUrl) {
|
|
39
|
+
if (typeof window === 'undefined') return false;
|
|
40
|
+
if (!(error instanceof TypeError)) return false;
|
|
41
|
+
if (navigating) return false;
|
|
42
|
+
if (!isCrossOrigin(fetchUrl)) return false;
|
|
43
|
+
if (detected) return true;
|
|
44
|
+
detected = true;
|
|
45
|
+
const origin = window.location.origin;
|
|
46
|
+
console.error(`[Fontdue] Cross-origin request to ${fetchUrl} was blocked.\n\n` + `Your website (${origin}) is not listed as an allowed origin ` + `in your Fontdue CORS settings.\n\n` + `To fix this:\n` + `1. Log in to your Fontdue dashboard\n` + `2. Go to Settings \u2192 Security\n` + `3. Add "${origin}" to the "Cross-origin API access" field\n` + `4. Save \u2014 this page will reload automatically`);
|
|
47
|
+
Promise.resolve().then(() => _interopRequireWildcard(require('./components/CorsErrorModal'))).then(_ref => {
|
|
48
|
+
let {
|
|
49
|
+
renderCorsErrorModal
|
|
50
|
+
} = _ref;
|
|
51
|
+
renderCorsErrorModal(origin, fetchUrl);
|
|
52
|
+
});
|
|
53
|
+
startPolling(fetchUrl);
|
|
54
|
+
return true;
|
|
55
|
+
}
|
package/dist/fontdue.css
CHANGED
|
@@ -448,6 +448,14 @@ div[data-component=TypeTesters] {
|
|
|
448
448
|
flex: 0 1 250px;
|
|
449
449
|
margin-right: 20px;
|
|
450
450
|
}
|
|
451
|
+
@media (max-width: 899px) {
|
|
452
|
+
.type-tester__toolbar .type-tester__variable-axes {
|
|
453
|
+
display: grid;
|
|
454
|
+
grid-template-columns: 1fr;
|
|
455
|
+
grid-gap: 5px;
|
|
456
|
+
width: 100%;
|
|
457
|
+
}
|
|
458
|
+
}
|
|
451
459
|
.type-tester__toolbar {
|
|
452
460
|
display: flex;
|
|
453
461
|
align-items: center;
|
|
@@ -457,6 +465,14 @@ div[data-component=TypeTesters] {
|
|
|
457
465
|
z-index: 2;
|
|
458
466
|
margin-top: 10px;
|
|
459
467
|
}
|
|
468
|
+
@media (max-width: 899px) {
|
|
469
|
+
.type-tester__toolbar {
|
|
470
|
+
flex-wrap: wrap;
|
|
471
|
+
}
|
|
472
|
+
.type-tester__toolbar .type-tester__select-button-wrapper {
|
|
473
|
+
margin-left: auto;
|
|
474
|
+
}
|
|
475
|
+
}
|
|
460
476
|
.type-tester__toolbar__price-text {
|
|
461
477
|
margin: 0 20px;
|
|
462
478
|
opacity: 0.5;
|
|
@@ -470,6 +486,13 @@ div[data-component=TypeTesters] {
|
|
|
470
486
|
.type-tester__toolbar__tools:not(:last-child) {
|
|
471
487
|
margin-right: 20px;
|
|
472
488
|
}
|
|
489
|
+
@media (max-width: 899px) {
|
|
490
|
+
.type-tester__toolbar__tools {
|
|
491
|
+
order: 1;
|
|
492
|
+
flex: 1 0 100%;
|
|
493
|
+
margin-top: 5px;
|
|
494
|
+
}
|
|
495
|
+
}
|
|
473
496
|
.type-tester[data-shy=hover] .type-tester__toolbar__tools, .type-tester[data-shy=focus] .type-tester__toolbar__tools {
|
|
474
497
|
opacity: 0;
|
|
475
498
|
pointer-events: none;
|
|
@@ -674,9 +697,7 @@ div[data-component=TypeTesters] {
|
|
|
674
697
|
.type-tester__variable-axes__value {
|
|
675
698
|
margin-left: 10px;
|
|
676
699
|
margin-right: 16px;
|
|
677
|
-
width: 3em;
|
|
678
700
|
text-align: right;
|
|
679
|
-
font-feature-settings: "tnum" 1;
|
|
680
701
|
}
|
|
681
702
|
.type-tester__variable-axes__name {
|
|
682
703
|
white-space: nowrap;
|
|
@@ -847,6 +868,10 @@ div[data-component=TypeTesters] {
|
|
|
847
868
|
--section_spacing: 60px;
|
|
848
869
|
}
|
|
849
870
|
|
|
871
|
+
.price {
|
|
872
|
+
font-variant-numeric: tabular-nums;
|
|
873
|
+
}
|
|
874
|
+
|
|
850
875
|
.character-viewer {
|
|
851
876
|
--size: calc(var(--monitor-width) * 1 / 2);
|
|
852
877
|
--half-gap: calc(var(--line-gap) / 2);
|
|
@@ -2068,11 +2093,44 @@ body[data-fontdue-store-modal=open] {
|
|
|
2068
2093
|
}
|
|
2069
2094
|
|
|
2070
2095
|
.store-modal__product-summary__container {
|
|
2096
|
+
display: flex;
|
|
2097
|
+
flex-direction: column;
|
|
2098
|
+
gap: 12px;
|
|
2099
|
+
}
|
|
2100
|
+
|
|
2101
|
+
.store-modal__product-summary__row {
|
|
2071
2102
|
display: flex;
|
|
2072
2103
|
justify-content: space-between;
|
|
2073
2104
|
align-items: center;
|
|
2074
2105
|
}
|
|
2075
2106
|
|
|
2107
|
+
.store-modal__product-summary__error {
|
|
2108
|
+
font-size: 14px;
|
|
2109
|
+
color: var(--error_text_color, #c00);
|
|
2110
|
+
line-height: 1.4;
|
|
2111
|
+
}
|
|
2112
|
+
|
|
2113
|
+
.store-modal__product-summary__error-button {
|
|
2114
|
+
background: none;
|
|
2115
|
+
color: inherit;
|
|
2116
|
+
font: inherit;
|
|
2117
|
+
text-decoration: inherit;
|
|
2118
|
+
text-align: inherit;
|
|
2119
|
+
border: 0;
|
|
2120
|
+
border-radius: 0;
|
|
2121
|
+
padding: 0;
|
|
2122
|
+
margin: 0;
|
|
2123
|
+
appearance: none;
|
|
2124
|
+
text-transform: inherit;
|
|
2125
|
+
text-decoration: underline;
|
|
2126
|
+
}
|
|
2127
|
+
.store-modal__product-summary__error-button:active, .store-modal__product-summary__error-button:focus {
|
|
2128
|
+
outline: none;
|
|
2129
|
+
}
|
|
2130
|
+
.store-modal__product-summary__error-button:not(:disabled) {
|
|
2131
|
+
cursor: pointer;
|
|
2132
|
+
}
|
|
2133
|
+
|
|
2076
2134
|
.store-modal__product-summary__add-to-cart-button {
|
|
2077
2135
|
background: none;
|
|
2078
2136
|
color: inherit;
|
|
@@ -2479,7 +2537,6 @@ body[data-fontdue-store-modal=open] {
|
|
|
2479
2537
|
}
|
|
2480
2538
|
.cart-item__price {
|
|
2481
2539
|
margin-top: 20px;
|
|
2482
|
-
font-variant-numeric: tabular-nums;
|
|
2483
2540
|
}
|
|
2484
2541
|
.cart-item:first-child .cart-item__price {
|
|
2485
2542
|
margin-top: 0;
|
|
@@ -2564,6 +2621,7 @@ body[data-fontdue-store-modal=open] {
|
|
|
2564
2621
|
text-transform: inherit;
|
|
2565
2622
|
margin-left: 10px;
|
|
2566
2623
|
margin-right: -3px;
|
|
2624
|
+
vertical-align: middle;
|
|
2567
2625
|
}
|
|
2568
2626
|
.cart__remove-discount-button:active, .cart__remove-discount-button:focus {
|
|
2569
2627
|
outline: none;
|
|
@@ -8,6 +8,7 @@ exports.responseCache = exports.networkFetch = void 0;
|
|
|
8
8
|
exports.useCurrentEnvironment = useCurrentEnvironment;
|
|
9
9
|
var _react = require("react");
|
|
10
10
|
var _relayRuntime = require("relay-runtime");
|
|
11
|
+
var _corsError = require("../corsError");
|
|
11
12
|
var _package = require("../../package.json");
|
|
12
13
|
// @ts-ignore - JSON import
|
|
13
14
|
|
|
@@ -22,35 +23,48 @@ const CACHE_TTL = 10 * 1000; // 10 seconds, to resolve preloaded results
|
|
|
22
23
|
function createNetworkFetch(options) {
|
|
23
24
|
return async function networkFetch(request, variables) {
|
|
24
25
|
const url = (FONTDUE_URL && `${FONTDUE_URL}/graphql`) ?? ((options === null || options === void 0 ? void 0 : options.url) ?? '') + '/graphql';
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
26
|
+
let resp;
|
|
27
|
+
try {
|
|
28
|
+
resp = await fetch(url + `?queryName=${request.name}`, {
|
|
29
|
+
method: 'POST',
|
|
30
|
+
credentials: 'include',
|
|
31
|
+
headers: {
|
|
32
|
+
Accept: 'application/json',
|
|
33
|
+
'Content-Type': 'application/json',
|
|
34
|
+
'fontdue-stripe-integration': STRIPE_INTEGRATION ?? ((options === null || options === void 0 ? void 0 : options.stripeIntegration) || 'dynamic'),
|
|
35
|
+
'fontdue-client-version': _package.version
|
|
36
|
+
},
|
|
37
|
+
body: JSON.stringify({
|
|
38
|
+
query: request.text,
|
|
39
|
+
variables
|
|
40
|
+
}),
|
|
41
|
+
// @ts-ignore
|
|
42
|
+
next: {
|
|
43
|
+
tags: ['graphql', `operation:${request.name}`]
|
|
44
|
+
}
|
|
45
|
+
});
|
|
46
|
+
} catch (error) {
|
|
47
|
+
if ((0, _corsError.handlePossibleCorsError)(error, url)) {
|
|
48
|
+
return {
|
|
49
|
+
data: undefined,
|
|
50
|
+
errors: [{
|
|
51
|
+
message: 'Cross-origin request blocked'
|
|
52
|
+
}]
|
|
53
|
+
};
|
|
41
54
|
}
|
|
42
|
-
|
|
55
|
+
throw error;
|
|
56
|
+
}
|
|
43
57
|
const json = await resp.json();
|
|
44
58
|
|
|
45
59
|
// GraphQL returns exceptions (for example, a missing required variable) in the "errors"
|
|
46
60
|
// property of the response. If any exceptions occurred when processing the request,
|
|
47
61
|
// throw an error to indicate to the developer what went wrong.
|
|
48
62
|
if (Array.isArray(json.errors)) {
|
|
49
|
-
var _json$errors;
|
|
63
|
+
var _json$errors, _error$extensions;
|
|
50
64
|
const error = (_json$errors = json.errors) === null || _json$errors === void 0 ? void 0 : _json$errors[0];
|
|
51
65
|
console.error('GraphQL Error:', {
|
|
52
66
|
message: error.message,
|
|
53
|
-
code: error.code,
|
|
67
|
+
code: (_error$extensions = error.extensions) === null || _error$extensions === void 0 ? void 0 : _error$extensions.code,
|
|
54
68
|
path: error.path
|
|
55
69
|
});
|
|
56
70
|
}
|