fontdue-js 3.14.0 → 3.15.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 +9 -0
- package/dist/__generated__/CartOrderCompleteOrderMutation.graphql.d.ts +1 -1
- package/dist/__generated__/CartOrderCompleteOrderMutation.graphql.js +3 -3
- package/dist/__generated__/CartOrderRemoveDiscountMutation.graphql.d.ts +1 -1
- package/dist/__generated__/CartOrderRemoveDiscountMutation.graphql.js +3 -3
- package/dist/__generated__/CartOrderUpdateMutation.graphql.d.ts +1 -1
- package/dist/__generated__/CartOrderUpdateMutation.graphql.js +3 -3
- package/dist/__generated__/CartQuery.graphql.d.ts +1 -1
- package/dist/__generated__/CartQuery.graphql.js +3 -3
- package/dist/__generated__/CartStateUpdateMutation.graphql.d.ts +5 -1
- package/dist/__generated__/CartStateUpdateMutation.graphql.js +132 -117
- package/dist/__generated__/CartState_order.graphql.d.ts +4 -1
- package/dist/__generated__/CartState_order.graphql.js +11 -2
- package/dist/__generated__/CheckoutUpdateCustomerMutation.graphql.d.ts +1 -1
- package/dist/__generated__/CheckoutUpdateCustomerMutation.graphql.js +3 -3
- package/dist/__generated__/CheckoutUpdateOrderMutation.graphql.d.ts +1 -1
- package/dist/__generated__/CheckoutUpdateOrderMutation.graphql.js +3 -3
- package/dist/__generated__/FamilyList_node.graphql.d.ts +3 -1
- package/dist/__generated__/FamilyList_node.graphql.js +8 -2
- package/dist/__generated__/FontFamiliesQuery.graphql.d.ts +1 -1
- package/dist/__generated__/FontFamiliesQuery.graphql.js +5 -5
- package/dist/__generated__/PrecartAddToCartMutation.graphql.d.ts +1 -1
- package/dist/__generated__/PrecartAddToCartMutation.graphql.js +3 -3
- package/dist/__generated__/StoreModalCartQuery.graphql.d.ts +1 -1
- package/dist/__generated__/StoreModalCartQuery.graphql.js +69 -69
- package/dist/__generated__/StoreModalFamily_collection.graphql.d.ts +2 -1
- package/dist/__generated__/StoreModalFamily_collection.graphql.js +16 -15
- package/dist/__generated__/StoreModalIndexItem_fontCollection.graphql.d.ts +19 -1
- package/dist/__generated__/StoreModalIndexItem_fontCollection.graphql.js +39 -4
- package/dist/__generated__/StoreModalIndexPaginationQuery.graphql.d.ts +1 -1
- package/dist/__generated__/StoreModalIndexPaginationQuery.graphql.js +40 -5
- package/dist/__generated__/StoreModalIndexQuery.graphql.d.ts +1 -1
- package/dist/__generated__/StoreModalIndexQuery.graphql.js +40 -5
- package/dist/__generated__/StoreModalProductContent_collection.graphql.d.ts +19 -1
- package/dist/__generated__/StoreModalProductContent_collection.graphql.js +46 -11
- package/dist/__generated__/StoreModalProductQuery.graphql.d.ts +1 -1
- package/dist/__generated__/StoreModalProductQuery.graphql.js +198 -167
- package/dist/__generated__/StoreModalProductRefetchQuery.graphql.d.ts +1 -1
- package/dist/__generated__/StoreModalProductRefetchQuery.graphql.js +171 -140
- package/dist/__generated__/StoreModalProductSlugQuery.graphql.d.ts +1 -1
- package/dist/__generated__/StoreModalProductSlugQuery.graphql.js +201 -170
- package/dist/__generated__/StripeProviderCreateCheckoutSessionMutation.graphql.d.ts +5 -2
- package/dist/__generated__/StripeProviderCreateCheckoutSessionMutation.graphql.js +41 -22
- package/dist/__generated__/TestFontsFormUpdateCustomerMutation.graphql.d.ts +1 -1
- package/dist/__generated__/TestFontsFormUpdateCustomerMutation.graphql.js +3 -3
- package/dist/__generated__/TypeTesterStandaloneChangedStylesQuery.graphql.d.ts +1 -1
- package/dist/__generated__/TypeTesterStandaloneChangedStylesQuery.graphql.js +9 -3
- package/dist/__generated__/TypeTesterStandaloneQuery.graphql.d.ts +1 -1
- package/dist/__generated__/TypeTesterStandaloneQuery.graphql.js +9 -3
- package/dist/__generated__/TypeTester_fontStyle.graphql.d.ts +3 -1
- package/dist/__generated__/TypeTester_fontStyle.graphql.js +8 -2
- package/dist/__generated__/TypeTestersChangedStylesQuery.graphql.d.ts +1 -1
- package/dist/__generated__/TypeTestersChangedStylesQuery.graphql.js +9 -3
- package/dist/__generated__/TypeTestersIDQuery.graphql.d.ts +1 -1
- package/dist/__generated__/TypeTestersIDQuery.graphql.js +39 -39
- package/dist/__generated__/TypeTestersRefetchQuery.graphql.d.ts +1 -1
- package/dist/__generated__/TypeTestersRefetchQuery.graphql.js +37 -37
- package/dist/__generated__/TypeTestersSlugQuery.graphql.d.ts +1 -1
- package/dist/__generated__/TypeTestersSlugQuery.graphql.js +39 -39
- package/dist/__tests__/cartDiscountRemoved.test.js +195 -0
- package/dist/__tests__/characterViewerCollapse.test.js +199 -0
- package/dist/__tests__/characterViewerStyleSelect.test.js +52 -0
- package/dist/__tests__/checkoutReturn.test.js +66 -0
- package/dist/__tests__/familyStyleCounts.test.js +71 -0
- package/dist/__tests__/i18n.test.js +171 -0
- package/dist/__tests__/i18nComponents.test.js +408 -0
- package/dist/__tests__/localeEnvironments.test.js +275 -0
- package/dist/__tests__/localeMiddleware.test.js +68 -0
- package/dist/__tests__/localeTransport.test.js +209 -0
- package/dist/__tests__/recaptchaLocale.test.js +62 -0
- package/dist/__tests__/serverEntryLocale.test.js +124 -0
- package/dist/__tests__/storeModalIndexUnlisted.test.js +69 -11
- package/dist/__tests__/useSerializablePreloadedQuery.test.js +4 -3
- package/dist/components/AddToCartBanner/index.js +8 -2
- package/dist/components/BuyButton/index.d.ts +1 -0
- package/dist/components/BuyButton/index.js +8 -2
- package/dist/components/BuyButton/index.server.d.ts +1 -0
- package/dist/components/BuyButton/index.server.js +8 -0
- package/dist/components/BuyingOptions/index.js +3 -1
- package/dist/components/Cart/AddressFields.js +5 -3
- package/dist/components/Cart/CartCouponNotice.d.ts +7 -0
- package/dist/components/Cart/CartCouponNotice.js +21 -0
- package/dist/components/Cart/CartItem/CartItemAdditionalLicenses.js +3 -1
- package/dist/components/Cart/CartItem/CartItemLicense.js +3 -1
- package/dist/components/Cart/CartItem/CartItemProduct.js +6 -3
- package/dist/components/Cart/CartItem/VariableTextInput.js +7 -3
- package/dist/components/Cart/CartItem/index.js +5 -1
- package/dist/components/Cart/CartOrder.js +27 -17
- package/dist/components/Cart/CartState.d.ts +1 -0
- package/dist/components/Cart/CartState.js +18 -3
- package/dist/components/Cart/CartTotals.js +17 -9
- package/dist/components/Cart/Checkout.js +18 -15
- package/dist/components/Cart/CouponCodeInput.js +5 -3
- package/dist/components/Cart/CustomerFields.js +6 -4
- package/dist/components/Cart/EmptyCart.js +4 -2
- package/dist/components/Cart/IdentityBox.js +6 -2
- package/dist/components/Cart/ShareCart.js +8 -6
- package/dist/components/Cart/checkoutReturn.d.ts +17 -0
- package/dist/components/Cart/checkoutReturn.js +38 -0
- package/dist/components/CartButton/index.d.ts +2 -1
- package/dist/components/CartButton/index.js +6 -2
- package/dist/components/CharacterViewer/StyleSelect.js +6 -2
- package/dist/components/CharacterViewer/collapse.d.ts +10 -0
- package/dist/components/CharacterViewer/collapse.js +39 -0
- package/dist/components/CharacterViewer/index.d.ts +4 -0
- package/dist/components/CharacterViewer/index.js +78 -24
- package/dist/components/CharacterViewer/index.server.d.ts +1 -0
- package/dist/components/CharacterViewer/index.server.js +4 -0
- package/dist/components/ConfigContext.d.ts +14 -10
- package/dist/components/ConfigContext.js +12 -7
- package/dist/components/ConsentBanner/index.js +6 -5
- package/dist/components/CookieNotification/index.js +11 -5
- package/dist/components/CouponText/index.js +15 -7
- package/dist/components/CustomerLoginForm/index.js +14 -9
- package/dist/components/CustomerSignIn/CustomerSignInElement.d.ts +1 -1
- package/dist/components/CustomerSignIn/CustomerSignInElement.js +8 -2
- package/dist/components/CustomerSignIn/index.d.ts +6 -1
- package/dist/components/CustomerSignIn/index.js +27 -15
- package/dist/components/Family/FamilyList.js +5 -2
- package/dist/components/Family/index.js +21 -12
- package/dist/components/FeatureTester/FeatureTesters.d.ts +2 -1
- package/dist/components/FeatureTester/FeatureTesters.js +4 -1
- package/dist/components/FeatureTester/FeatureTesters.server.js +4 -0
- package/dist/components/FeatureTester/index.d.ts +1 -0
- package/dist/components/FeatureTester/index.js +3 -1
- package/dist/components/FeatureTester/index.server.js +2 -0
- package/dist/components/FontdueContextProvider/index.d.ts +12 -2
- package/dist/components/FontdueContextProvider/index.js +85 -11
- package/dist/components/FontdueProvider/index.js +7 -1
- package/dist/components/FontdueProvider/index.server.js +21 -3
- package/dist/components/LocaleContext.d.ts +9 -0
- package/dist/components/LocaleContext.js +20 -0
- package/dist/components/NewsletterSignup/index.d.ts +2 -1
- package/dist/components/NewsletterSignup/index.js +20 -11
- package/dist/components/NewsletterSignup/index.server.d.ts +1 -0
- package/dist/components/NewsletterSignup/index.server.js +3 -1
- package/dist/components/NodePasswordForm/index.d.ts +6 -1
- package/dist/components/NodePasswordForm/index.js +14 -6
- package/dist/components/OrderVariableSelection/index.js +7 -5
- package/dist/components/Precart/License.js +4 -2
- package/dist/components/Precart/index.js +15 -12
- package/dist/components/Price/index.d.ts +1 -0
- package/dist/components/Price/index.js +15 -5
- package/dist/components/Root/index.js +2 -1
- package/dist/components/Select/index.d.ts +1 -1
- package/dist/components/Select/index.js +4 -1
- package/dist/components/SelectButton/index.js +3 -1
- package/dist/components/SpecimenLink/index.js +3 -1
- package/dist/components/StoreModal/StoreModalCart.js +6 -0
- package/dist/components/StoreModal/StoreModalContainer.js +14 -12
- package/dist/components/StoreModal/StoreModalDownload.js +3 -1
- package/dist/components/StoreModal/StoreModalFamily.js +16 -7
- package/dist/components/StoreModal/StoreModalFamilyButton.js +14 -9
- package/dist/components/StoreModal/StoreModalIndexItem.js +21 -10
- package/dist/components/StoreModal/StoreModalIndexPackItem.js +8 -3
- package/dist/components/StoreModal/StoreModalPackButton.js +5 -2
- package/dist/components/StoreModal/StoreModalProduct.js +14 -5
- package/dist/components/StoreModal/index.d.ts +1 -0
- package/dist/components/StoreModal/index.js +4 -2
- package/dist/components/StoreModal/offered.d.ts +31 -0
- package/dist/components/StoreModal/offered.js +21 -0
- package/dist/components/StoreModal/types.d.ts +9 -0
- package/dist/components/StoreModalProductLicenseSelection/LicenseVariableElement.js +3 -1
- package/dist/components/StoreModalProductLicenseSelection/StoreModalProductLicense.js +5 -1
- package/dist/components/StoreModalProductSummary/index.js +37 -23
- package/dist/components/StripeProvider/index.js +18 -5
- package/dist/components/TestFontsForm/index.d.ts +2 -1
- package/dist/components/TestFontsForm/index.js +28 -16
- package/dist/components/TestFontsForm/index.server.d.ts +1 -0
- package/dist/components/TestFontsForm/index.server.js +3 -1
- package/dist/components/TestModeBanner/index.js +3 -1
- package/dist/components/TypeTester/TypeTesterEditAll.js +3 -1
- package/dist/components/TypeTester/TypeTesterFeaturesButton.js +4 -2
- package/dist/components/TypeTester/TypeTesterStandalone.d.ts +1 -0
- package/dist/components/TypeTester/TypeTesterStandalone.js +6 -2
- package/dist/components/TypeTester/TypeTesterStandalone.server.js +2 -0
- package/dist/components/TypeTester/TypeTesterStyleSelect.js +5 -3
- package/dist/components/TypeTester/TypeTesterStyleSelectData.js +3 -1
- package/dist/components/TypeTester/TypeTesterToolbar.js +12 -6
- package/dist/components/TypeTester/index.js +7 -2
- package/dist/components/TypeTesters/index.d.ts +2 -1
- package/dist/components/TypeTesters/index.js +3 -1
- package/dist/components/TypeTesters/index.server.d.ts +1 -0
- package/dist/components/TypeTesters/index.server.js +4 -0
- package/dist/components/elements/EmptyCart/index.js +4 -2
- package/dist/components/elements/StoreModalCartLayout/index.d.ts +1 -0
- package/dist/components/elements/StoreModalCartLayout/index.js +2 -1
- package/dist/components/elements/StoreModalContainer/index.js +4 -2
- package/dist/components/elements/StoreModalDownloadLayout/index.js +3 -1
- package/dist/components/elements/StoreModalIndexItem/index.js +3 -1
- package/dist/components/elements/StoreModalIndexLoadMore/index.js +3 -1
- package/dist/components/elements/StoreModalLicenseeIsBillingIdentityElement.js +4 -2
- package/dist/components/elements/StoreModalLoadingScreen/index.js +7 -3
- package/dist/components/elements/StoreModalUnifiedCheckout.js +44 -27
- package/dist/fontdue.css +58 -0
- package/dist/hooks/useRecaptchaTimeout.d.ts +1 -1
- package/dist/hooks/useRecaptchaTimeout.js +4 -2
- package/dist/i18n/de.d.ts +3 -0
- package/dist/i18n/de.js +279 -0
- package/dist/i18n/en.d.ts +212 -0
- package/dist/i18n/en.js +261 -0
- package/dist/i18n/index.d.ts +42 -0
- package/dist/i18n/index.js +115 -0
- package/dist/i18n/types.d.ts +28 -0
- package/dist/i18n/types.js +1 -0
- package/dist/i18n/useT.d.ts +15 -0
- package/dist/i18n/useT.js +21 -0
- package/dist/locale.d.ts +20 -0
- package/dist/locale.js +52 -0
- package/dist/next/tenant.d.ts +3 -1
- package/dist/next/tenant.js +11 -2
- package/dist/relay/environment.d.ts +8 -2
- package/dist/relay/environment.js +65 -15
- package/dist/relay/loadSerializableQuery.d.ts +17 -0
- package/dist/relay/loadSerializableQuery.js +14 -2
- package/dist/relay/serverConfig.d.ts +9 -0
- package/dist/relay/serverConfig.js +16 -0
- package/dist/relay/useSerializablePreloadedQuery.js +27 -6
- package/dist/server/index.d.ts +11 -0
- package/dist/server/index.js +7 -0
- package/dist/server/middleware.d.ts +19 -1
- package/dist/server/middleware.js +56 -13
- package/dist/utils.d.ts +0 -1
- package/dist/utils.js +0 -5
- package/dist/version.js +1 -1
- package/package.json +1 -1
|
@@ -7,6 +7,7 @@ import SKUPrice from '../SKUPrice/index.js';
|
|
|
7
7
|
import ComponentsContext from '../ComponentsContext.js';
|
|
8
8
|
import { isSelected } from '../../utils.js';
|
|
9
9
|
import ConfigContext from '../ConfigContext.js';
|
|
10
|
+
import { useT } from '../../i18n/useT.js';
|
|
10
11
|
const DefaultSelectButton = _ref => {
|
|
11
12
|
let {
|
|
12
13
|
productId,
|
|
@@ -19,6 +20,7 @@ const DefaultSelectButton = _ref => {
|
|
|
19
20
|
const {
|
|
20
21
|
typeTester: config
|
|
21
22
|
} = useContext(ConfigContext);
|
|
23
|
+
const t = useT();
|
|
22
24
|
const handleClick = e => {
|
|
23
25
|
onClick === null || onClick === void 0 ? void 0 : onClick(e);
|
|
24
26
|
dispatch({
|
|
@@ -35,7 +37,7 @@ const DefaultSelectButton = _ref => {
|
|
|
35
37
|
return /*#__PURE__*/React.createElement("button", _extends({}, rest, {
|
|
36
38
|
onClick: handleClick,
|
|
37
39
|
className: "select-button"
|
|
38
|
-
}), config.selectButtonLabel);
|
|
40
|
+
}), config.selectButtonLabel ?? t('typeTester.select'));
|
|
39
41
|
};
|
|
40
42
|
export default function SelectButton(_ref2) {
|
|
41
43
|
let {
|
|
@@ -2,11 +2,13 @@ import _SpecimenLinkQuery from "../../__generated__/SpecimenLinkQuery.graphql.js
|
|
|
2
2
|
import React from 'react';
|
|
3
3
|
import { graphql, useLazyLoadQuery } from 'react-relay';
|
|
4
4
|
import { ArrowRight } from '../Icons/index.js';
|
|
5
|
+
import { useT } from '../../i18n/useT.js';
|
|
5
6
|
const SpecimenLink = _ref => {
|
|
6
7
|
var _node$pdfs;
|
|
7
8
|
let {
|
|
8
9
|
collectionId
|
|
9
10
|
} = _ref;
|
|
11
|
+
const t = useT();
|
|
10
12
|
const {
|
|
11
13
|
node
|
|
12
14
|
} = useLazyLoadQuery((_SpecimenLinkQuery.hash && _SpecimenLinkQuery.hash !== "a718e7ed92035c4bbebafc13d037fa6c" && console.error("The definition of 'SpecimenLinkQuery' appears to have changed. Run `relay-compiler` to update the generated files to receive the expected data."), _SpecimenLinkQuery), {
|
|
@@ -24,7 +26,7 @@ const SpecimenLink = _ref => {
|
|
|
24
26
|
src: pdf.thumbnailUrl ?? ''
|
|
25
27
|
})), /*#__PURE__*/React.createElement("div", {
|
|
26
28
|
className: "specimen-link__text"
|
|
27
|
-
},
|
|
29
|
+
}, t('specimen.link'), /*#__PURE__*/React.createElement("span", {
|
|
28
30
|
className: "specimen-link__arrow"
|
|
29
31
|
}, ' ', /*#__PURE__*/React.createElement(ArrowRight, null))));
|
|
30
32
|
};
|
|
@@ -5,6 +5,7 @@ import CartItem from '../Cart/CartItem/index.js';
|
|
|
5
5
|
import StoreModalPageContainer from '../elements/StoreModalPageContainer/index.js';
|
|
6
6
|
import CartState from '../Cart/CartState.js';
|
|
7
7
|
import CartTotals from '../Cart/CartTotals.js';
|
|
8
|
+
import CartCouponNotice from '../Cart/CartCouponNotice.js';
|
|
8
9
|
// @ts-ignore
|
|
9
10
|
import CouponCodeInput from '../Cart/CouponCodeInput.js';
|
|
10
11
|
import StoreModalCartLayout from '../elements/StoreModalCartLayout/index.js';
|
|
@@ -32,6 +33,7 @@ const StoreModalCart = _ref => {
|
|
|
32
33
|
onUpdateOrderVariableSelections,
|
|
33
34
|
onRemoveDiscount,
|
|
34
35
|
onUpdateOrderItem,
|
|
36
|
+
discountRemoved,
|
|
35
37
|
errors
|
|
36
38
|
} = _ref2;
|
|
37
39
|
return /*#__PURE__*/React.createElement(StoreModalCartLayout, {
|
|
@@ -51,6 +53,10 @@ const StoreModalCart = _ref => {
|
|
|
51
53
|
errors: errors === null || errors === void 0 ? void 0 : (_errors$orderItems = errors.orderItems) === null || _errors$orderItems === void 0 ? void 0 : _errors$orderItems[i]
|
|
52
54
|
});
|
|
53
55
|
}),
|
|
56
|
+
notice: /*#__PURE__*/React.createElement(CartCouponNotice, {
|
|
57
|
+
discountRemoved: discountRemoved,
|
|
58
|
+
errors: errors === null || errors === void 0 ? void 0 : errors.coupon
|
|
59
|
+
}),
|
|
54
60
|
couponCodeInput: !(order && order.discount) && /*#__PURE__*/React.createElement(CouponCodeInput, null),
|
|
55
61
|
shareCart: /*#__PURE__*/React.createElement(ShareCart, {
|
|
56
62
|
key: (_order$total = order.total) === null || _order$total === void 0 ? void 0 : _order$total.amount
|
|
@@ -9,31 +9,32 @@ import useFontStyle from '../useFontStyle.js';
|
|
|
9
9
|
import { fontStyleFamily } from '../../fontLoader.js';
|
|
10
10
|
import StoreModalLoadingScreen from '../elements/StoreModalLoadingScreen/index.js';
|
|
11
11
|
import ConfigContext from '../ConfigContext.js';
|
|
12
|
-
|
|
12
|
+
import { useT } from '../../i18n/useT.js';
|
|
13
|
+
const getPageTitle = (name, t) => {
|
|
13
14
|
switch (name) {
|
|
14
15
|
case 'index':
|
|
15
|
-
return '
|
|
16
|
+
return t('storeModal.allCollections');
|
|
16
17
|
case 'product':
|
|
17
|
-
return '
|
|
18
|
+
return t('storeModal.buyingOptions');
|
|
18
19
|
case 'cart':
|
|
19
|
-
return '
|
|
20
|
+
return t('storeModal.cart');
|
|
20
21
|
case 'checkout':
|
|
21
|
-
return '
|
|
22
|
+
return t('storeModal.checkout');
|
|
22
23
|
case 'review':
|
|
23
|
-
return '
|
|
24
|
+
return t('storeModal.review');
|
|
24
25
|
}
|
|
25
26
|
};
|
|
26
|
-
const getBackLink = (history, currentRoute, hideAllCollections) => {
|
|
27
|
+
const getBackLink = (history, currentRoute, hideAllCollections, t) => {
|
|
27
28
|
if (history.length === 0) {
|
|
28
29
|
if (hideAllCollections) {
|
|
29
|
-
return currentRoute === 'cart' ? null : '
|
|
30
|
+
return currentRoute === 'cart' ? null : t('storeModal.close');
|
|
30
31
|
}
|
|
31
|
-
if (currentRoute !== 'index') return '
|
|
32
|
+
if (currentRoute !== 'index') return t('storeModal.allCollections');
|
|
32
33
|
return null;
|
|
33
34
|
}
|
|
34
35
|
const previous = history[history.length - 1];
|
|
35
36
|
if (!previous) return null;
|
|
36
|
-
return getPageTitle(previous.name);
|
|
37
|
+
return getPageTitle(previous.name, t);
|
|
37
38
|
};
|
|
38
39
|
const StoreModalContainer = _ref => {
|
|
39
40
|
var _settings, _settings2, _currentOrder, _currentOrder$orderIt;
|
|
@@ -60,7 +61,8 @@ const StoreModalContainer = _ref => {
|
|
|
60
61
|
const currentRoute = useSelector(state => state.storeModalRoute.name);
|
|
61
62
|
const history = useSelector(state => state.storeModalHistory);
|
|
62
63
|
const config = useContext(ConfigContext);
|
|
63
|
-
const
|
|
64
|
+
const t = useT();
|
|
65
|
+
const link = getBackLink(history, currentRoute, config.storeModal.hideAllCollections, t);
|
|
64
66
|
const handleBack = () => {
|
|
65
67
|
if (history.length === 0) {
|
|
66
68
|
if (config.storeModal.hideAllCollections) {
|
|
@@ -113,7 +115,7 @@ const StoreModalContainer = _ref => {
|
|
|
113
115
|
routeName: currentRoute
|
|
114
116
|
}, {
|
|
115
117
|
backText: link,
|
|
116
|
-
pageTitle: getPageTitle(currentRoute),
|
|
118
|
+
pageTitle: getPageTitle(currentRoute, t),
|
|
117
119
|
body: /*#__PURE__*/React.createElement(Suspense, {
|
|
118
120
|
fallback: /*#__PURE__*/React.createElement(StoreModalLoadingScreen, null)
|
|
119
121
|
}, children)
|
|
@@ -5,11 +5,13 @@ import { createRefetchContainer, graphql } from 'react-relay';
|
|
|
5
5
|
import StoreModalPageContainer from '../elements/StoreModalPageContainer/index.js';
|
|
6
6
|
import StoreModalDownloadLayout from '../elements/StoreModalDownloadLayout/index.js';
|
|
7
7
|
import useInterval from '../useInterval.js';
|
|
8
|
+
import { useT } from '../../i18n/useT.js';
|
|
8
9
|
const StoreModalDownload = _ref => {
|
|
9
10
|
let {
|
|
10
11
|
order,
|
|
11
12
|
relay
|
|
12
13
|
} = _ref;
|
|
14
|
+
const t = useT();
|
|
13
15
|
useInterval(() => {
|
|
14
16
|
if (order.archiveUrl) return;
|
|
15
17
|
relay.refetch({
|
|
@@ -20,7 +22,7 @@ const StoreModalDownload = _ref => {
|
|
|
20
22
|
body: /*#__PURE__*/React.createElement(StoreModalDownloadLayout, {
|
|
21
23
|
archiveUrl: order.archiveUrl
|
|
22
24
|
}, {
|
|
23
|
-
message: /*#__PURE__*/React.createElement(Fragment, null, /*#__PURE__*/React.createElement("p", null,
|
|
25
|
+
message: /*#__PURE__*/React.createElement(Fragment, null, /*#__PURE__*/React.createElement("p", null, t('download.confirmed')), /*#__PURE__*/React.createElement("p", null, order.archiveUrl ? t('download.ready') : t('download.preparing')), /*#__PURE__*/React.createElement("p", null, t('download.receiptSent')))
|
|
24
26
|
})
|
|
25
27
|
});
|
|
26
28
|
};
|
|
@@ -2,6 +2,7 @@ import _StoreModalFamily_collection from "../../__generated__/StoreModalFamily_c
|
|
|
2
2
|
import React, { useMemo } from 'react';
|
|
3
3
|
import { graphql, useFragment } from 'react-relay';
|
|
4
4
|
import FamilyButton from './StoreModalFamilyButton.js';
|
|
5
|
+
import { hasSomethingToShow, listed } from './offered.js';
|
|
5
6
|
import StyleButton from './StoreModalStyleButton.js';
|
|
6
7
|
import FamilyElement from '../elements/StoreModalFamily/index.js';
|
|
7
8
|
import StoreModalBundleButton from './StoreModalBundleButton.js';
|
|
@@ -44,21 +45,29 @@ export function bundlesGrouped(bundles) {
|
|
|
44
45
|
return chunks.flatMap(chunk => chunk.length === 2 ? [chunk] : chunk.map(b => [b]));
|
|
45
46
|
}
|
|
46
47
|
export default function StoreModalFamily(_ref) {
|
|
47
|
-
var _collection$bundles;
|
|
48
48
|
let {
|
|
49
49
|
collection: collectionKey,
|
|
50
50
|
onSelect,
|
|
51
51
|
title
|
|
52
52
|
} = _ref;
|
|
53
|
-
const collection = useFragment((_StoreModalFamily_collection.hash && _StoreModalFamily_collection.hash !== "
|
|
54
|
-
|
|
53
|
+
const collection = useFragment((_StoreModalFamily_collection.hash && _StoreModalFamily_collection.hash !== "fb9188b2cb9c54e097102022c4c59bd3" && 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), collectionKey);
|
|
54
|
+
// Unlisted styles get no row of their own. Filtered before the pairing in
|
|
55
|
+
// `stylesGrouped`, or an unlisted italic would leave its upright partner
|
|
56
|
+
// looking like half of a pair. Like an unlisted collection or bundle, the
|
|
57
|
+
// style stays in the product state, so it is still reachable as an upgrade.
|
|
58
|
+
const fontStyles = useMemo(() => stylesGrouped(listed(collection.fontStyles)), [collection]);
|
|
59
|
+
const listedBundles = useMemo(
|
|
55
60
|
// An unlisted bundle gets no button, but its price still applies as an
|
|
56
61
|
// upgrade: the product state reads every bundle.
|
|
57
|
-
|
|
62
|
+
() => listed(collection.bundles), [collection.bundles]);
|
|
58
63
|
|
|
59
|
-
//
|
|
60
|
-
//
|
|
61
|
-
|
|
64
|
+
// Nothing left to click. Before per-style visibility only a superfamily
|
|
65
|
+
// could reach this (its families all hidden), and a family always had at
|
|
66
|
+
// least one style to list; now a family can too, with every style unlisted,
|
|
67
|
+
// so the guard covers both. A family that still has a price of its own
|
|
68
|
+
// keeps its button – it is genuinely still for sale, and a superfamily's
|
|
69
|
+
// bundles, across its families, count too.
|
|
70
|
+
if (!hasSomethingToShow(collection)) return null;
|
|
62
71
|
return /*#__PURE__*/React.createElement(FamilyElement, null, {
|
|
63
72
|
title,
|
|
64
73
|
familyButton: /*#__PURE__*/React.createElement(FamilyButton, {
|
|
@@ -9,14 +9,14 @@ import { isSelected } from '../../reducer.js';
|
|
|
9
9
|
import StoreModalFamilyButtonElement from '../elements/StoreModalFamilyButton/index.js';
|
|
10
10
|
import FontStyle from '../FontStyle/index.js';
|
|
11
11
|
import useTotalStyles from '../useTotalStyles.js';
|
|
12
|
-
import {
|
|
13
|
-
const getFamilyType = collection => {
|
|
14
|
-
if (collection.collectionType === 'superfamily') return '
|
|
15
|
-
return '
|
|
12
|
+
import { useT } from '../../i18n/useT.js';
|
|
13
|
+
const getFamilyType = (collection, t) => {
|
|
14
|
+
if (collection.collectionType === 'superfamily') return t('storeModal.collectionType');
|
|
15
|
+
return t('storeModal.familyType');
|
|
16
16
|
};
|
|
17
|
-
const getSuffix = collection => {
|
|
17
|
+
const getSuffix = (collection, t) => {
|
|
18
18
|
if (collection.isVariableFont) return;
|
|
19
|
-
return ' ' + getFamilyType(collection);
|
|
19
|
+
return ' ' + getFamilyType(collection, t);
|
|
20
20
|
};
|
|
21
21
|
export default function FamilyButton(_ref) {
|
|
22
22
|
var _collection$featureSt, _collection$featureSt2;
|
|
@@ -25,6 +25,7 @@ export default function FamilyButton(_ref) {
|
|
|
25
25
|
onSelectSku,
|
|
26
26
|
...rest
|
|
27
27
|
} = _ref;
|
|
28
|
+
const t = useT();
|
|
28
29
|
const collection = useFragment((_StoreModalFamilyButton_collection.hash && _StoreModalFamilyButton_collection.hash !== "3ca5466b4680374b74cf161a9bdef313" && console.error("The definition of 'StoreModalFamilyButton_collection' appears to have changed. Run `relay-compiler` to update the generated files to receive the expected data."), _StoreModalFamilyButton_collection), collectionKey);
|
|
29
30
|
const selector = collection.sku ? isSelected(collection.sku.id) : () => false;
|
|
30
31
|
const selected = useSelector(selector);
|
|
@@ -40,10 +41,14 @@ export default function FamilyButton(_ref) {
|
|
|
40
41
|
});
|
|
41
42
|
let label = [];
|
|
42
43
|
if (totalStyles > 0) {
|
|
43
|
-
label.push(
|
|
44
|
+
label.push(t('common.styleCount', {
|
|
45
|
+
count: totalStyles
|
|
46
|
+
}));
|
|
44
47
|
}
|
|
45
48
|
if (variableFonts > 0) {
|
|
46
|
-
label.push(
|
|
49
|
+
label.push(t('common.variableFontCount', {
|
|
50
|
+
count: variableFonts
|
|
51
|
+
}));
|
|
47
52
|
}
|
|
48
53
|
const supportsEnglish = (_collection$featureSt = collection.featureStyle) === null || _collection$featureSt === void 0 ? void 0 : (_collection$featureSt2 = _collection$featureSt.supportedLanguages) === null || _collection$featureSt2 === void 0 ? void 0 : _collection$featureSt2.includes('en');
|
|
49
54
|
return /*#__PURE__*/React.createElement(StoreModalFamilyButtonElement, _extends({
|
|
@@ -54,7 +59,7 @@ export default function FamilyButton(_ref) {
|
|
|
54
59
|
name: collection.featureStyle && supportsEnglish ? /*#__PURE__*/React.createElement(FontStyle, {
|
|
55
60
|
Component: "span",
|
|
56
61
|
fontStyle: collection.featureStyle
|
|
57
|
-
}, collection.name, getSuffix(collection)) : /*#__PURE__*/React.createElement("span", null, collection.name, " ", getSuffix(collection)),
|
|
62
|
+
}, collection.name, getSuffix(collection, t)) : /*#__PURE__*/React.createElement("span", null, collection.name, " ", getSuffix(collection, t)),
|
|
58
63
|
label: label.join(', '),
|
|
59
64
|
price: collection.sku && /*#__PURE__*/React.createElement(SKUPrice, {
|
|
60
65
|
sku: collection.sku,
|
|
@@ -2,12 +2,19 @@ import _StoreModalIndexItem_fontCollection from "../../__generated__/StoreModalI
|
|
|
2
2
|
import React from 'react';
|
|
3
3
|
import { graphql, useFragment } from 'react-relay';
|
|
4
4
|
import StoreModalIndexEntry from './StoreModalIndexEntry.js';
|
|
5
|
+
import { isOffered } from './offered.js';
|
|
5
6
|
import useTotalStyles from '../useTotalStyles.js';
|
|
6
|
-
import {
|
|
7
|
-
const styleLabel = (totalStyles, variableFonts) => {
|
|
7
|
+
import { useT } from '../../i18n/useT.js';
|
|
8
|
+
const styleLabel = (t, totalStyles, variableFonts) => {
|
|
8
9
|
const label = [];
|
|
9
|
-
if (totalStyles > 0) label.push(
|
|
10
|
-
|
|
10
|
+
if (totalStyles > 0) label.push(t('common.styleCount', {
|
|
11
|
+
count: totalStyles
|
|
12
|
+
}));
|
|
13
|
+
if (variableFonts > 0) {
|
|
14
|
+
label.push(t('common.variableFontCount', {
|
|
15
|
+
count: variableFonts
|
|
16
|
+
}));
|
|
17
|
+
}
|
|
11
18
|
return label.join(', ');
|
|
12
19
|
};
|
|
13
20
|
|
|
@@ -15,28 +22,32 @@ const styleLabel = (totalStyles, variableFonts) => {
|
|
|
15
22
|
// on its own (FD-1239), so it has no entry of its own here either: an unlisted
|
|
16
23
|
// family drops out, and an unlisted superfamily is replaced by its listed
|
|
17
24
|
// families. Those still open the superfamily's page, where selecting them
|
|
18
|
-
// upgrades to the superfamily.
|
|
25
|
+
// upgrades to the superfamily. A collection with nothing to click – every style
|
|
26
|
+
// unlisted and no price of its own – gets no entry either, as the page behind
|
|
27
|
+
// it would be empty.
|
|
19
28
|
const StoreModalIndexItem = _ref => {
|
|
20
29
|
let {
|
|
21
30
|
collection
|
|
22
31
|
} = _ref;
|
|
23
|
-
const
|
|
32
|
+
const t = useT();
|
|
33
|
+
const data = useFragment((_StoreModalIndexItem_fontCollection.hash && _StoreModalIndexItem_fontCollection.hash !== "3cd74ec28b29810eac3c3cf478ce1e55" && console.error("The definition of 'StoreModalIndexItem_fontCollection' appears to have changed. Run `relay-compiler` to update the generated files to receive the expected data."), _StoreModalIndexItem_fontCollection), collection);
|
|
24
34
|
const {
|
|
25
35
|
totalStyles,
|
|
26
36
|
variableFonts
|
|
27
37
|
} = useTotalStyles({
|
|
28
38
|
fontCollection: data
|
|
29
39
|
});
|
|
40
|
+
const families = (data.children ?? []).filter(isOffered);
|
|
41
|
+
if (!isOffered(data) && families.length === 0) return null;
|
|
30
42
|
if (data.visibility === 'UNLISTED') {
|
|
31
|
-
|
|
32
|
-
return /*#__PURE__*/React.createElement(React.Fragment, null, (data.children ?? []).filter(family => family.visibility !== 'UNLISTED').map(family => {
|
|
43
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, families.map(family => {
|
|
33
44
|
const styles = family.totalStyles ?? 0;
|
|
34
45
|
return /*#__PURE__*/React.createElement(StoreModalIndexEntry, {
|
|
35
46
|
key: family.id,
|
|
36
47
|
productId: data.id,
|
|
37
48
|
name: family.name,
|
|
38
49
|
featureStyle: family.featureStyle,
|
|
39
|
-
label: family.isVariableFont ? styleLabel(0, styles) : styleLabel(styles, 0)
|
|
50
|
+
label: family.isVariableFont ? styleLabel(t, 0, styles) : styleLabel(t, styles, 0)
|
|
40
51
|
});
|
|
41
52
|
}));
|
|
42
53
|
}
|
|
@@ -44,7 +55,7 @@ const StoreModalIndexItem = _ref => {
|
|
|
44
55
|
productId: data.id,
|
|
45
56
|
name: data.name,
|
|
46
57
|
featureStyle: data.featureStyle,
|
|
47
|
-
label: styleLabel(totalStyles, variableFonts)
|
|
58
|
+
label: styleLabel(t, totalStyles, variableFonts)
|
|
48
59
|
});
|
|
49
60
|
};
|
|
50
61
|
export default StoreModalIndexItem;
|
|
@@ -2,20 +2,25 @@ import _StoreModalIndexPackItem_fontPack from "../../__generated__/StoreModalInd
|
|
|
2
2
|
import React from 'react';
|
|
3
3
|
import { graphql, useFragment } from 'react-relay';
|
|
4
4
|
import StoreModalIndexEntry from './StoreModalIndexEntry.js';
|
|
5
|
-
import {
|
|
5
|
+
import { useT } from '../../i18n/useT.js';
|
|
6
6
|
// A pack's name alone ("Anniversary Pack") doesn't tell a visitor it spans
|
|
7
7
|
// families, so its subhead says what it is before the style count.
|
|
8
|
-
const packIndexLabel = totalStyles => totalStyles ?
|
|
8
|
+
const packIndexLabel = (t, totalStyles) => totalStyles ? t('storeModal.fontPackWithStyles', {
|
|
9
|
+
styles: t('common.styleCount', {
|
|
10
|
+
count: totalStyles
|
|
11
|
+
})
|
|
12
|
+
}) : t('storeModal.fontPack');
|
|
9
13
|
const StoreModalIndexPackItem = _ref => {
|
|
10
14
|
let {
|
|
11
15
|
pack
|
|
12
16
|
} = _ref;
|
|
17
|
+
const t = useT();
|
|
13
18
|
const data = useFragment((_StoreModalIndexPackItem_fontPack.hash && _StoreModalIndexPackItem_fontPack.hash !== "47273d9e96f713344a4e62f4c5517161" && console.error("The definition of 'StoreModalIndexPackItem_fontPack' appears to have changed. Run `relay-compiler` to update the generated files to receive the expected data."), _StoreModalIndexPackItem_fontPack), pack);
|
|
14
19
|
return /*#__PURE__*/React.createElement(StoreModalIndexEntry, {
|
|
15
20
|
productId: data.id,
|
|
16
21
|
name: data.name,
|
|
17
22
|
featureStyle: data.featureStyle,
|
|
18
|
-
label: packIndexLabel(data.totalStyles)
|
|
23
|
+
label: packIndexLabel(t, data.totalStyles)
|
|
19
24
|
});
|
|
20
25
|
};
|
|
21
26
|
export default StoreModalIndexPackItem;
|
|
@@ -8,7 +8,7 @@ import RelayPrice, { PriceFormat } from '../Price/index.js';
|
|
|
8
8
|
import { isSelected } from '../../reducer.js';
|
|
9
9
|
import StoreModalFamilyButtonElement from '../elements/StoreModalFamilyButton/index.js';
|
|
10
10
|
import FontStyle from '../FontStyle/index.js';
|
|
11
|
-
import {
|
|
11
|
+
import { useT } from '../../i18n/useT.js';
|
|
12
12
|
// The pack's own row at the top of the product page — the family button's
|
|
13
13
|
// markup, buying the whole pack at its one fixed price, under the pack's name
|
|
14
14
|
// exactly as the admin entered it (the index, cart and BuyButton show the
|
|
@@ -21,6 +21,7 @@ export default function StoreModalPackButton(_ref) {
|
|
|
21
21
|
onSelectSku,
|
|
22
22
|
...rest
|
|
23
23
|
} = _ref;
|
|
24
|
+
const t = useT();
|
|
24
25
|
const pack = useFragment((_StoreModalPackButton_fontPack.hash && _StoreModalPackButton_fontPack.hash !== "9075ef7d1f8c2ce1fa8beba0884713cb" && console.error("The definition of 'StoreModalPackButton_fontPack' appears to have changed. Run `relay-compiler` to update the generated files to receive the expected data."), _StoreModalPackButton_fontPack), packKey);
|
|
25
26
|
const selector = pack.sku ? isSelected(pack.sku.id) : () => false;
|
|
26
27
|
const selected = useSelector(selector);
|
|
@@ -39,7 +40,9 @@ export default function StoreModalPackButton(_ref) {
|
|
|
39
40
|
Component: "span",
|
|
40
41
|
fontStyle: pack.featureStyle
|
|
41
42
|
}, pack.name) : /*#__PURE__*/React.createElement("span", null, pack.name),
|
|
42
|
-
label: pack.totalStyles ?
|
|
43
|
+
label: pack.totalStyles ? t('common.styleCount', {
|
|
44
|
+
count: pack.totalStyles
|
|
45
|
+
}) : '',
|
|
43
46
|
price: pack.sku && /*#__PURE__*/React.createElement(React.Fragment, null, showsSaving && /*#__PURE__*/React.createElement("s", {
|
|
44
47
|
className: "store-modal__family-button__styles-price"
|
|
45
48
|
}, /*#__PURE__*/React.createElement(RelayPrice, {
|
|
@@ -6,6 +6,7 @@ import React, { Fragment, useCallback, useContext, useEffect, useMemo } from 're
|
|
|
6
6
|
import { graphql, useRelayEnvironment, useFragment, usePreloadedQuery, useRefetchableFragment } from 'react-relay';
|
|
7
7
|
import { shallowEqual, useDispatch, useSelector, useStore } from 'react-redux';
|
|
8
8
|
import StoreModalFamily from './StoreModalFamily.js';
|
|
9
|
+
import { isOffered } from './offered.js';
|
|
9
10
|
import StoreModalPack from './StoreModalPack.js';
|
|
10
11
|
import StoreModalProductSummary from '../StoreModalProductSummary/index.js';
|
|
11
12
|
import StoreModalPageContainer from '../elements/StoreModalPageContainer/index.js';
|
|
@@ -18,6 +19,7 @@ import { useRefetchOnLicenseChanges } from '../../hooks/useRefetchOnLicenseChang
|
|
|
18
19
|
import StoreModalLicenseeIsBillingSelection from './StoreModalLicenseeIsBillingSelection.js';
|
|
19
20
|
import { useLicenseAndOrderVariables } from '../../hooks/useLicenseAndOrderVariables.js';
|
|
20
21
|
import { trackProductViewed } from '../Cart/storefrontEvents.js';
|
|
22
|
+
import { useT } from '../../i18n/useT.js';
|
|
21
23
|
|
|
22
24
|
// A product – a collection or a font pack – is addressed by id or by slug,
|
|
23
25
|
// the same two identifiers `BuyButton` takes. Two queries rather than one with `@skip`,
|
|
@@ -37,9 +39,10 @@ const StoreModalProductContent = _ref => {
|
|
|
37
39
|
viewer: viewerRef
|
|
38
40
|
} = _ref;
|
|
39
41
|
const config = useContext(ConfigContext);
|
|
42
|
+
const t = useT();
|
|
40
43
|
const environment = useRelayEnvironment();
|
|
41
44
|
const viewer = useFragment(productViewerFragment, viewerRef);
|
|
42
|
-
const [data, refetch] = useRefetchableFragment((_StoreModalProductContent_collection.hash && _StoreModalProductContent_collection.hash !== "
|
|
45
|
+
const [data, refetch] = useRefetchableFragment((_StoreModalProductContent_collection.hash && _StoreModalProductContent_collection.hash !== "a258ce1aade9fa96a42cef5fa3ffa148" && console.error("The definition of 'StoreModalProductContent_collection' appears to have changed. Run `relay-compiler` to update the generated files to receive the expected data."), _StoreModalProductContent_collection), collectionRef ?? null);
|
|
43
46
|
|
|
44
47
|
// The product page sells a collection or a font pack; anything else the id
|
|
45
48
|
// resolves to is not a product.
|
|
@@ -106,7 +109,7 @@ const StoreModalProductContent = _ref => {
|
|
|
106
109
|
const requiredOrderVariablesNotYetSelected = (_viewer$orderVariable = viewer.orderVariables) === null || _viewer$orderVariable === void 0 ? void 0 : _viewer$orderVariable.filter(variable => variable.variableType === 'select').find(variable => !orderVariableSelections.find(selection => selection.orderVariableId === variable.id));
|
|
107
110
|
if (!collection) {
|
|
108
111
|
return /*#__PURE__*/React.createElement(StoreModalPageContainer, null, {
|
|
109
|
-
body: '
|
|
112
|
+
body: t('storeModal.productNotFound')
|
|
110
113
|
});
|
|
111
114
|
}
|
|
112
115
|
const selectLicenseeLabel = /*#__PURE__*/React.createElement("div", {
|
|
@@ -116,7 +119,7 @@ const StoreModalProductContent = _ref => {
|
|
|
116
119
|
});
|
|
117
120
|
const licenseeSelfLabel = /*#__PURE__*/React.createElement("span", {
|
|
118
121
|
dangerouslySetInnerHTML: {
|
|
119
|
-
__html: ((_viewer$settings2 = viewer.settings) === null || _viewer$settings2 === void 0 ? void 0 : _viewer$settings2.storeModalLicenseeSelfLabel) ?? '
|
|
122
|
+
__html: ((_viewer$settings2 = viewer.settings) === null || _viewer$settings2 === void 0 ? void 0 : _viewer$settings2.storeModalLicenseeSelfLabel) ?? t('checkout.licenseeSelf')
|
|
120
123
|
}
|
|
121
124
|
});
|
|
122
125
|
const licenseeSelfDescription = (_viewer$settings3 = viewer.settings) !== null && _viewer$settings3 !== void 0 && _viewer$settings3.storeModalLicenseeSelfDescription ? /*#__PURE__*/React.createElement("div", {
|
|
@@ -126,7 +129,7 @@ const StoreModalProductContent = _ref => {
|
|
|
126
129
|
}) : null;
|
|
127
130
|
const licenseeClientLabel = /*#__PURE__*/React.createElement("span", {
|
|
128
131
|
dangerouslySetInnerHTML: {
|
|
129
|
-
__html: ((_viewer$settings4 = viewer.settings) === null || _viewer$settings4 === void 0 ? void 0 : _viewer$settings4.storeModalLicenseeClientLabel) ?? '
|
|
132
|
+
__html: ((_viewer$settings4 = viewer.settings) === null || _viewer$settings4 === void 0 ? void 0 : _viewer$settings4.storeModalLicenseeClientLabel) ?? t('checkout.licenseeClient')
|
|
130
133
|
}
|
|
131
134
|
});
|
|
132
135
|
const licenseeClientDescription = (_viewer$settings5 = viewer.settings) !== null && _viewer$settings5 !== void 0 && _viewer$settings5.storeModalLicenseeClientDescription ? /*#__PURE__*/React.createElement("div", {
|
|
@@ -154,7 +157,13 @@ const StoreModalProductContent = _ref => {
|
|
|
154
157
|
// styles – but stays in the product state, so selecting its siblings can
|
|
155
158
|
// still upgrade to it (an unlisted superfamily) or to a collection bundle
|
|
156
159
|
// containing it (an unlisted variable family).
|
|
157
|
-
|
|
160
|
+
// `isOffered` includes the test StoreModalFamily applies before
|
|
161
|
+
// rendering nothing at all. Filtering here as well keeps the "Select fonts"
|
|
162
|
+
// heading on a family that actually appears — handing it to the first
|
|
163
|
+
// *unlisted-filtered* family used to lose it entirely whenever that family
|
|
164
|
+
// then bowed out (a superfamily with every family hidden, and now a family
|
|
165
|
+
// with every style unlisted).
|
|
166
|
+
const selectableFamilies = collection.__typename === 'FontCollection' ? [collection, ...(collection.children ?? [])].filter(isOffered) : [];
|
|
158
167
|
return /*#__PURE__*/React.createElement(StoreModalPageContainer, null, {
|
|
159
168
|
body: /*#__PURE__*/React.createElement(Fragment, null, licensesPosition === 'top' && /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(StoreModalLicenseeIsBillingSelection, {
|
|
160
169
|
disabled: false
|
|
@@ -34,10 +34,12 @@ function StoreModalInner() {
|
|
|
34
34
|
// outer config/url/store flow through.
|
|
35
35
|
const StoreModal = _ref => {
|
|
36
36
|
let {
|
|
37
|
-
config
|
|
37
|
+
config,
|
|
38
|
+
locale
|
|
38
39
|
} = _ref;
|
|
39
40
|
return /*#__PURE__*/React.createElement(EnsureFontdueContext, {
|
|
40
|
-
config: config
|
|
41
|
+
config: config,
|
|
42
|
+
locale: locale
|
|
41
43
|
}, /*#__PURE__*/React.createElement(StoreModalInner, null));
|
|
42
44
|
};
|
|
43
45
|
export default StoreModal;
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
type VisibilityLike = {
|
|
2
|
+
readonly visibility: string;
|
|
3
|
+
} | null;
|
|
4
|
+
/**
|
|
5
|
+
* Drops the unlisted entries from a list of styles, bundles or packs. A font
|
|
6
|
+
* pack groups its own style members with `stylesGrouped`, so it needs the same
|
|
7
|
+
* rule applied first.
|
|
8
|
+
*/
|
|
9
|
+
export declare const listed: <T extends VisibilityLike>(items?: readonly T[] | null) => NonNullable<T>[];
|
|
10
|
+
/**
|
|
11
|
+
* Whether this family has anything for a customer to click: a price of its
|
|
12
|
+
* own, a listed bundle, or a listed style.
|
|
13
|
+
*/
|
|
14
|
+
export declare const hasSomethingToShow: (family: {
|
|
15
|
+
readonly sku?: {
|
|
16
|
+
readonly id: string;
|
|
17
|
+
} | null;
|
|
18
|
+
readonly bundles?: readonly VisibilityLike[] | null;
|
|
19
|
+
readonly fontStyles?: readonly VisibilityLike[] | null;
|
|
20
|
+
}) => boolean;
|
|
21
|
+
/**
|
|
22
|
+
* Whether the Store Modal offers this collection a block or entry of its own.
|
|
23
|
+
* The one rule behind both the product page's families and the index's
|
|
24
|
+
* entries, so an index entry can't lead to a page with nothing on it. Relay
|
|
25
|
+
* masks StoreModalFamily's fragment, so each caller selects `visibility`,
|
|
26
|
+
* `sku`, `bundles(acrossFamilies: true)` and `fontStyles` itself.
|
|
27
|
+
*/
|
|
28
|
+
export declare const isOffered: (collection: {
|
|
29
|
+
readonly visibility?: string;
|
|
30
|
+
} & Parameters<typeof hasSomethingToShow>[0]) => boolean;
|
|
31
|
+
export {};
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Drops the unlisted entries from a list of styles, bundles or packs. A font
|
|
3
|
+
* pack groups its own style members with `stylesGrouped`, so it needs the same
|
|
4
|
+
* rule applied first.
|
|
5
|
+
*/
|
|
6
|
+
export const listed = items => (items ?? []).filter(item => Boolean(item && item.visibility !== 'UNLISTED'));
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Whether this family has anything for a customer to click: a price of its
|
|
10
|
+
* own, a listed bundle, or a listed style.
|
|
11
|
+
*/
|
|
12
|
+
export const hasSomethingToShow = family => Boolean(family.sku) || listed(family.bundles).length > 0 || listed(family.fontStyles).length > 0;
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* Whether the Store Modal offers this collection a block or entry of its own.
|
|
16
|
+
* The one rule behind both the product page's families and the index's
|
|
17
|
+
* entries, so an index entry can't lead to a page with nothing on it. Relay
|
|
18
|
+
* masks StoreModalFamily's fragment, so each caller selects `visibility`,
|
|
19
|
+
* `sku`, `bundles(acrossFamilies: true)` and `fontStyles` itself.
|
|
20
|
+
*/
|
|
21
|
+
export const isOffered = collection => collection.visibility !== 'UNLISTED' && hasSomethingToShow(collection);
|
|
@@ -3,4 +3,13 @@ export interface StoreModalConfig {
|
|
|
3
3
|
indexExcludeTags?: string[] | undefined;
|
|
4
4
|
productLicensesPosition?: 'bottom' | 'top';
|
|
5
5
|
hideAllCollections?: boolean;
|
|
6
|
+
/**
|
|
7
|
+
* Where the order page's link back goes once the buyer has paid, instead of
|
|
8
|
+
* the foundry's site – the page this store modal is embedded in, say.
|
|
9
|
+
* Relative URLs resolve against the current page. Must be on one of the
|
|
10
|
+
* store's allowed origins; anything else is refused.
|
|
11
|
+
*/
|
|
12
|
+
returnUrl?: string;
|
|
13
|
+
/** The text of that link. Defaults to "Back to <host>". */
|
|
14
|
+
returnLabel?: string;
|
|
6
15
|
}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { CarrotDown } from '../Icons/index.js';
|
|
3
|
+
import { useT } from '../../i18n/useT.js';
|
|
3
4
|
const LicenseVariableElement = _ref => {
|
|
4
5
|
let {
|
|
5
6
|
value,
|
|
@@ -9,6 +10,7 @@ const LicenseVariableElement = _ref => {
|
|
|
9
10
|
selectionText
|
|
10
11
|
}
|
|
11
12
|
} = _ref;
|
|
13
|
+
const t = useT();
|
|
12
14
|
return /*#__PURE__*/React.createElement("label", {
|
|
13
15
|
className: "store-modal__license-selection__license-label"
|
|
14
16
|
}, selectionText, /*#__PURE__*/React.createElement(CarrotDown, null), /*#__PURE__*/React.createElement("select", {
|
|
@@ -19,7 +21,7 @@ const LicenseVariableElement = _ref => {
|
|
|
19
21
|
}, /*#__PURE__*/React.createElement("option", {
|
|
20
22
|
value: "",
|
|
21
23
|
disabled: true
|
|
22
|
-
},
|
|
24
|
+
}, t('common.selectOption')), options.map(_ref2 => {
|
|
23
25
|
let {
|
|
24
26
|
value,
|
|
25
27
|
text
|
|
@@ -7,6 +7,7 @@ import LicenseVariableElement from './LicenseVariableElement.js';
|
|
|
7
7
|
import VariableTableAmounts from '../VariableTableAmounts/index.js';
|
|
8
8
|
import LicenseVariableRadioElement from './LicenseVariableRadioElement.js';
|
|
9
9
|
import { useTrackProductCustomized } from '../Cart/storefrontEvents.js';
|
|
10
|
+
import { useT } from '../../i18n/useT.js';
|
|
10
11
|
const specFromLicense = license => {
|
|
11
12
|
let licenseOptionSpec = {
|
|
12
13
|
licenseId: license.id
|
|
@@ -35,6 +36,7 @@ export default function StoreModalProduceLicense(_ref) {
|
|
|
35
36
|
license: licenseKey,
|
|
36
37
|
collectionId
|
|
37
38
|
} = _ref;
|
|
39
|
+
const t = useT();
|
|
38
40
|
const license = useFragment((_StoreModalProductLicense_license.hash && _StoreModalProductLicense_license.hash !== "87cd41e76dcd8952d7096940a383b9f3" && console.error("The definition of 'StoreModalProductLicense_license' appears to have changed. Run `relay-compiler` to update the generated files to receive the expected data."), _StoreModalProductLicense_license), licenseKey);
|
|
39
41
|
const licenseOptions = useSelector(state => state.licenseOptions);
|
|
40
42
|
const selectedOptions = licenseOptions.find(_ref2 => {
|
|
@@ -135,7 +137,9 @@ export default function StoreModalProduceLicense(_ref) {
|
|
|
135
137
|
text: option.amount
|
|
136
138
|
}))
|
|
137
139
|
}, {
|
|
138
|
-
selectionText: selectedOption ? selectedOption.amount :
|
|
140
|
+
selectionText: selectedOption ? selectedOption.amount : t('license.selectVariable', {
|
|
141
|
+
name: variable.name ?? ''
|
|
142
|
+
})
|
|
139
143
|
});
|
|
140
144
|
}
|
|
141
145
|
return null;
|