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,11 +7,11 @@ import { useSelector, useDispatch, shallowEqual } from 'react-redux';
|
|
|
7
7
|
import RelayPrice, { Price } from '../Price/index.js';
|
|
8
8
|
import Button from '../elements/Button/index.js';
|
|
9
9
|
import StoreModalProductSummaryRefetchQuery from '../../__generated__/StoreModalProductSummaryRefetchQuery.graphql.js';
|
|
10
|
-
import { pluralize } from '../../utils.js';
|
|
11
10
|
import { useLicenseAndOrderVariables } from '../../hooks/useLicenseAndOrderVariables.js';
|
|
12
11
|
import { useRefetchOnLicenseChanges } from '../../hooks/useRefetchOnLicenseChanges.js';
|
|
13
12
|
import ConfigContext from '../ConfigContext.js';
|
|
14
13
|
import { orderTrackingInput } from '../Cart/orderTracking.js';
|
|
14
|
+
import { useT } from '../../i18n/useT.js';
|
|
15
15
|
const addToCartMutation = (_StoreModalProductSummaryAddToCartMutation.hash && _StoreModalProductSummaryAddToCartMutation.hash !== "91ea762e3842af2919da3a4c710a48cc" && console.error("The definition of 'StoreModalProductSummaryAddToCartMutation' appears to have changed. Run `relay-compiler` to update the generated files to receive the expected data."), _StoreModalProductSummaryAddToCartMutation);
|
|
16
16
|
const clearCartMutation = (_StoreModalProductSummaryClearCartMutation.hash && _StoreModalProductSummaryClearCartMutation.hash !== "b5c37f74432030a297c1bcf2be63b6f7" && console.error("The definition of 'StoreModalProductSummaryClearCartMutation' appears to have changed. Run `relay-compiler` to update the generated files to receive the expected data."), _StoreModalProductSummaryClearCartMutation);
|
|
17
17
|
const countStyles = viewer => {
|
|
@@ -46,6 +46,7 @@ const StoreModalProductSummary = _ref => {
|
|
|
46
46
|
viewer: viewerKey
|
|
47
47
|
} = _ref;
|
|
48
48
|
const dispatch = useDispatch();
|
|
49
|
+
const t = useT();
|
|
49
50
|
const environment = useRelayEnvironment();
|
|
50
51
|
const selectedSkuIds = useSelector(state => state.selectedSkuIds, shallowEqual);
|
|
51
52
|
const {
|
|
@@ -114,14 +115,14 @@ const StoreModalProductSummary = _ref => {
|
|
|
114
115
|
variables,
|
|
115
116
|
onError: err => {
|
|
116
117
|
console.error('Failed:', err);
|
|
117
|
-
setError(err.message || '
|
|
118
|
+
setError(err.message || t('common.errorOccurred'));
|
|
118
119
|
setSubmitting(false);
|
|
119
120
|
},
|
|
120
121
|
onCompleted: (_res, errors) => {
|
|
121
122
|
if (errors) {
|
|
122
123
|
var _errors$;
|
|
123
124
|
console.error('Failed:', errors);
|
|
124
|
-
setError(((_errors$ = errors[0]) === null || _errors$ === void 0 ? void 0 : _errors$.message) || '
|
|
125
|
+
setError(((_errors$ = errors[0]) === null || _errors$ === void 0 ? void 0 : _errors$.message) || t('common.errorOccurred'));
|
|
125
126
|
setSubmitting(false);
|
|
126
127
|
return;
|
|
127
128
|
}
|
|
@@ -135,7 +136,7 @@ const StoreModalProductSummary = _ref => {
|
|
|
135
136
|
store.invalidateStore();
|
|
136
137
|
}
|
|
137
138
|
});
|
|
138
|
-
}, [selectedSkuIds, licenseOptions, orderVariableSelections, licenseeIsBillingIdentity, dispatch, commitAddToCart, setError]);
|
|
139
|
+
}, [selectedSkuIds, licenseOptions, orderVariableSelections, licenseeIsBillingIdentity, dispatch, commitAddToCart, setError, t]);
|
|
139
140
|
if (!viewer.precart) return null;
|
|
140
141
|
const anySkusSelected = Object.keys(selectedSkuIds).filter(skuId => selectedSkuIds[skuId]).length > 0;
|
|
141
142
|
const stylesPrice = countStylesPrice(viewer);
|
|
@@ -147,7 +148,7 @@ const StoreModalProductSummary = _ref => {
|
|
|
147
148
|
if (taxSystem === 'stripe') {
|
|
148
149
|
// For Stripe Tax, use the explicit tax behavior setting
|
|
149
150
|
if ((stripeTaxSettings === null || stripeTaxSettings === void 0 ? void 0 : stripeTaxSettings.taxBehavior) === 'exclusive') {
|
|
150
|
-
taxLabel = '
|
|
151
|
+
taxLabel = t('productSummary.exclTax');
|
|
151
152
|
}
|
|
152
153
|
// No label for 'inclusive' or 'inferred_by_currency'
|
|
153
154
|
} else {
|
|
@@ -158,7 +159,7 @@ const StoreModalProductSummary = _ref => {
|
|
|
158
159
|
} = _ref3;
|
|
159
160
|
return !inclusive;
|
|
160
161
|
})) {
|
|
161
|
-
taxLabel = '
|
|
162
|
+
taxLabel = t('productSummary.exclTax');
|
|
162
163
|
}
|
|
163
164
|
}
|
|
164
165
|
let message = null;
|
|
@@ -173,28 +174,41 @@ const StoreModalProductSummary = _ref => {
|
|
|
173
174
|
if (viewer.precart.subtotal) {
|
|
174
175
|
message = /*#__PURE__*/React.createElement("div", {
|
|
175
176
|
className: "store-modal__product-summary__selection-text"
|
|
176
|
-
},
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
}
|
|
183
|
-
|
|
184
|
-
|
|
177
|
+
}, t.rich('productSummary.selection', {
|
|
178
|
+
fonts: t('common.fontCount', {
|
|
179
|
+
count: countStyles(viewer)
|
|
180
|
+
}),
|
|
181
|
+
price: /*#__PURE__*/React.createElement(React.Fragment, null, viewer.precart.subtotal.amount < stylesPrice && /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("span", {
|
|
182
|
+
className: "store-modal__product-summary__styles-price"
|
|
183
|
+
}, /*#__PURE__*/React.createElement(Price, {
|
|
184
|
+
price: {
|
|
185
|
+
amount: stylesPrice,
|
|
186
|
+
currency: viewer.precart.subtotal.currency
|
|
187
|
+
}
|
|
188
|
+
})), ' '), /*#__PURE__*/React.createElement(RelayPrice, {
|
|
189
|
+
price: viewer.precart.subtotal
|
|
190
|
+
}))
|
|
185
191
|
}), taxLabel);
|
|
186
192
|
} else {
|
|
187
193
|
message = /*#__PURE__*/React.createElement("span", {
|
|
188
194
|
className: "store-modal__product-summary__nothing-selected"
|
|
189
|
-
},
|
|
195
|
+
}, t('productSummary.calculating'));
|
|
190
196
|
}
|
|
191
197
|
} else {
|
|
192
198
|
let validationMessage;
|
|
193
|
-
if (!anySkusSelected && licensesPosition === 'top') validationMessage = '
|
|
194
|
-
if (licenseOptions.length === 0) validationMessage = '
|
|
195
|
-
if (requiredOrderVariablesNotYetSelected)
|
|
196
|
-
|
|
197
|
-
|
|
199
|
+
if (!anySkusSelected && licensesPosition === 'top') validationMessage = t('productSummary.selectFonts');
|
|
200
|
+
if (licenseOptions.length === 0) validationMessage = t('productSummary.selectLicense');
|
|
201
|
+
if (requiredOrderVariablesNotYetSelected) {
|
|
202
|
+
const {
|
|
203
|
+
name
|
|
204
|
+
} = requiredOrderVariablesNotYetSelected;
|
|
205
|
+
validationMessage = t('productSummary.selectVariable', {
|
|
206
|
+
name,
|
|
207
|
+
nameLower: name.toLocaleLowerCase(t.locale)
|
|
208
|
+
});
|
|
209
|
+
}
|
|
210
|
+
if (!hasSelectionForLicenseeIsBillingIdentity) validationMessage = t('productSummary.selectLicensee');
|
|
211
|
+
if (!anySkusSelected && licensesPosition === 'bottom') validationMessage = t('productSummary.selectFonts');
|
|
198
212
|
message = /*#__PURE__*/React.createElement("span", {
|
|
199
213
|
className: "store-modal__product-summary__nothing-selected"
|
|
200
214
|
}, validationMessage);
|
|
@@ -207,12 +221,12 @@ const StoreModalProductSummary = _ref => {
|
|
|
207
221
|
className: "store-modal__product-summary__add-to-cart-button",
|
|
208
222
|
onClick: handleAddToCart,
|
|
209
223
|
disabled: submitting || !validSelections
|
|
210
|
-
}, submitting ? '
|
|
224
|
+
}, submitting ? t('productSummary.adding') : t('productSummary.addToCart'))), error && /*#__PURE__*/React.createElement("div", {
|
|
211
225
|
className: "store-modal__product-summary__error"
|
|
212
226
|
}, error, ' ', /*#__PURE__*/React.createElement("button", {
|
|
213
227
|
type: "button",
|
|
214
228
|
onClick: clearCart,
|
|
215
229
|
className: "store-modal__product-summary__error-button"
|
|
216
|
-
},
|
|
230
|
+
}, t('productSummary.emptyCartAndRetry'))));
|
|
217
231
|
};
|
|
218
232
|
export default StoreModalProductSummary;
|
|
@@ -6,6 +6,9 @@ import { Elements, EmbeddedCheckoutProvider } from '@stripe/react-stripe-js';
|
|
|
6
6
|
import { loadStripe } from '@stripe/stripe-js';
|
|
7
7
|
import { parseCustomProperties } from '../../utils.js';
|
|
8
8
|
import ConfigContext from '../ConfigContext.js';
|
|
9
|
+
import { checkoutReturnParams } from '../Cart/checkoutReturn.js';
|
|
10
|
+
import { useLocale } from '../LocaleContext.js';
|
|
11
|
+
import { stripeElementsLocale } from '../../locale.js';
|
|
9
12
|
import StoreModalPageContainer from '../elements/StoreModalPageContainer/index.js';
|
|
10
13
|
const CHECKOUT_ERROR = 'We couldn’t start the checkout – please try again';
|
|
11
14
|
const StripeProvider = _ref => {
|
|
@@ -26,8 +29,10 @@ const StripeProvider = _ref => {
|
|
|
26
29
|
// All hooks must be called before any conditional returns (React rules of hooks)
|
|
27
30
|
const environment = useRelayEnvironment();
|
|
28
31
|
const {
|
|
29
|
-
stripe: config
|
|
32
|
+
stripe: config,
|
|
33
|
+
storeModal: storeModalConfig
|
|
30
34
|
} = useContext(ConfigContext);
|
|
35
|
+
const stripeLocale = stripeElementsLocale(useLocale());
|
|
31
36
|
const [checkoutError, setCheckoutError] = useState(null);
|
|
32
37
|
let customFontSource;
|
|
33
38
|
const woffSrc = (_data$settings = data.settings) === null || _data$settings === void 0 ? void 0 : (_data$settings$uiFont = _data$settings.uiFontStyle) === null || _data$settings$uiFont === void 0 ? void 0 : (_data$settings$uiFont2 = _data$settings$uiFont.webfontSources) === null || _data$settings$uiFont2 === void 0 ? void 0 : (_data$settings$uiFont3 = _data$settings$uiFont2.find(source => (source === null || source === void 0 ? void 0 : source.format) === 'woff2')) === null || _data$settings$uiFont3 === void 0 ? void 0 : _data$settings$uiFont3.url;
|
|
@@ -51,8 +56,10 @@ const StripeProvider = _ref => {
|
|
|
51
56
|
const fetchClientSecret = useCallback(() => {
|
|
52
57
|
return new Promise((resolve, reject) => {
|
|
53
58
|
commitMutation(environment, {
|
|
54
|
-
mutation: (_StripeProviderCreateCheckoutSessionMutation.hash && _StripeProviderCreateCheckoutSessionMutation.hash !== "
|
|
55
|
-
|
|
59
|
+
mutation: (_StripeProviderCreateCheckoutSessionMutation.hash && _StripeProviderCreateCheckoutSessionMutation.hash !== "182092b555f884405afb61050ed98b79" && console.error("The definition of 'StripeProviderCreateCheckoutSessionMutation' appears to have changed. Run `relay-compiler` to update the generated files to receive the expected data."), _StripeProviderCreateCheckoutSessionMutation),
|
|
60
|
+
// Stripe returns to the order page; this names where that page's link
|
|
61
|
+
// back goes (`storeModal.returnUrl`).
|
|
62
|
+
variables: checkoutReturnParams(storeModalConfig, window.location.href),
|
|
56
63
|
onCompleted: (response, errors) => {
|
|
57
64
|
var _response$createOrder, _response$createOrder2, _response$createOrder3;
|
|
58
65
|
const clientSecret = (_response$createOrder = response.createOrderCheckoutSession) === null || _response$createOrder === void 0 ? void 0 : (_response$createOrder2 = _response$createOrder.order) === null || _response$createOrder2 === void 0 ? void 0 : (_response$createOrder3 = _response$createOrder2.stripeCheckoutSession) === null || _response$createOrder3 === void 0 ? void 0 : _response$createOrder3.clientSecret;
|
|
@@ -73,7 +80,7 @@ const StripeProvider = _ref => {
|
|
|
73
80
|
}
|
|
74
81
|
});
|
|
75
82
|
});
|
|
76
|
-
}, [environment]);
|
|
83
|
+
}, [environment, storeModalConfig === null || storeModalConfig === void 0 ? void 0 : storeModalConfig.returnUrl, storeModalConfig === null || storeModalConfig === void 0 ? void 0 : storeModalConfig.returnLabel]);
|
|
77
84
|
const options = {
|
|
78
85
|
appearance: config.appearance ?? {
|
|
79
86
|
theme: 'flat',
|
|
@@ -153,7 +160,13 @@ const StripeProvider = _ref => {
|
|
|
153
160
|
},
|
|
154
161
|
fonts: customFontSource ? [customFontSource] : undefined,
|
|
155
162
|
clientSecret,
|
|
156
|
-
syncAddressCheckbox: 'none'
|
|
163
|
+
syncAddressCheckbox: 'none',
|
|
164
|
+
// The site's language when it configured one (`'auto'` for a language
|
|
165
|
+
// Stripe doesn't offer); with none, Elements is created as before and
|
|
166
|
+
// follows the browser.
|
|
167
|
+
...(stripeLocale ? {
|
|
168
|
+
locale: stripeLocale
|
|
169
|
+
} : {})
|
|
157
170
|
};
|
|
158
171
|
if (providerType === 'checkout') {
|
|
159
172
|
if (checkoutError) {
|
|
@@ -19,5 +19,6 @@ export declare function TestFontsFormPreloadedQueryRenderer({ preloadedQuery, ..
|
|
|
19
19
|
export type TestFontsForm_unifiedProps = TestFontsForm_props & {
|
|
20
20
|
preloadedQuery?: TestFontsFormPreloadedQuery;
|
|
21
21
|
config?: Config;
|
|
22
|
+
locale?: string;
|
|
22
23
|
};
|
|
23
|
-
export default function TestFontsForm({ config, ...props }: TestFontsForm_unifiedProps): React.JSX.Element;
|
|
24
|
+
export default function TestFontsForm({ config, locale, ...props }: TestFontsForm_unifiedProps): React.JSX.Element;
|
|
@@ -9,6 +9,7 @@ import { commitMutation, graphql, useRelayEnvironment, useLazyLoadQuery, usePrel
|
|
|
9
9
|
// package's barebone named export instead was the FD-917 root cause; see
|
|
10
10
|
// ../Recaptcha for the full explanation.
|
|
11
11
|
import { ReCAPTCHA } from '../Recaptcha.js';
|
|
12
|
+
import { useLocale } from '../LocaleContext.js';
|
|
12
13
|
import TextField from '../TextField/index.js';
|
|
13
14
|
import { DownloadFonts } from '../Icons/index.js';
|
|
14
15
|
import TestFontsFormQueryNode from '../../__generated__/TestFontsForm_Query.graphql.js';
|
|
@@ -19,7 +20,8 @@ import { EnsureFontdueContext, LazyQueryBoundary } from '../FontdueContextProvid
|
|
|
19
20
|
import ConfigContext from '../ConfigContext.js';
|
|
20
21
|
import { testFontsFormQueryVariables } from './variables.js';
|
|
21
22
|
import { groupFamilies } from './familyGroups.js';
|
|
22
|
-
import { useRecaptchaTimeout, isRecaptchaScriptLoaded
|
|
23
|
+
import { useRecaptchaTimeout, isRecaptchaScriptLoaded } from '../../hooks/useRecaptchaTimeout.js';
|
|
24
|
+
import { useT } from '../../i18n/useT.js';
|
|
23
25
|
const updateCustomerMutation = (_TestFontsFormUpdateCustomerMutation.hash && _TestFontsFormUpdateCustomerMutation.hash !== "ba56958399f0893bd667ff02c33a6975" && console.error("The definition of 'TestFontsFormUpdateCustomerMutation' appears to have changed. Run `relay-compiler` to update the generated files to receive the expected data."), _TestFontsFormUpdateCustomerMutation);
|
|
24
26
|
// The archive endpoint's family filter: `collection_ids[]` narrows the ZIP to
|
|
25
27
|
// those families; none means every family.
|
|
@@ -33,20 +35,23 @@ const TestFontsDownloading = _ref => {
|
|
|
33
35
|
let {
|
|
34
36
|
archiveUrl
|
|
35
37
|
} = _ref;
|
|
38
|
+
const t = useT();
|
|
36
39
|
return /*#__PURE__*/React.createElement("div", {
|
|
37
40
|
className: "test-fonts__downloading"
|
|
38
41
|
}, /*#__PURE__*/React.createElement("div", {
|
|
39
42
|
className: "test-fonts__downloading__icon"
|
|
40
|
-
}, /*#__PURE__*/React.createElement(DownloadFonts, null)), /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("p", null,
|
|
41
|
-
|
|
42
|
-
|
|
43
|
+
}, /*#__PURE__*/React.createElement(DownloadFonts, null)), /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("p", null, t('testFonts.downloadStarting')), /*#__PURE__*/React.createElement("p", null, t.rich('testFonts.downloadFallback', {
|
|
44
|
+
link: /*#__PURE__*/React.createElement("a", {
|
|
45
|
+
href: archiveUrl
|
|
46
|
+
}, t('testFonts.downloadFallbackLink'))
|
|
47
|
+
}))));
|
|
43
48
|
};
|
|
44
49
|
const TestFontsFormComponent = _ref2 => {
|
|
45
50
|
var _data$viewer$testFont, _data$viewer$fontdueC, _data$viewer$fontdueC2, _data$viewer$settings, _data$viewer$settings2, _data$viewer$testFont2;
|
|
46
51
|
let {
|
|
47
52
|
data,
|
|
48
53
|
agreementLabel,
|
|
49
|
-
downloadLabel
|
|
54
|
+
downloadLabel: downloadLabelProp,
|
|
50
55
|
newsletterCheckboxChecked = false,
|
|
51
56
|
collectionId,
|
|
52
57
|
collectionSlug,
|
|
@@ -65,6 +70,9 @@ const TestFontsFormComponent = _ref2 => {
|
|
|
65
70
|
const [pendingSubmit, setPendingSubmit] = useState(false);
|
|
66
71
|
const downloadForm = useRef(null);
|
|
67
72
|
const recaptchaRef = useRef(null);
|
|
73
|
+
const locale = useLocale();
|
|
74
|
+
const t = useT();
|
|
75
|
+
const downloadLabel = downloadLabelProp ?? t('testFonts.download');
|
|
68
76
|
const recaptchaTimeout = useRecaptchaTimeout();
|
|
69
77
|
const environment = useRelayEnvironment();
|
|
70
78
|
const config = useContext(ConfigContext);
|
|
@@ -177,8 +185,8 @@ const TestFontsFormComponent = _ref2 => {
|
|
|
177
185
|
setPendingSubmit(false);
|
|
178
186
|
setRecaptchaToken(null);
|
|
179
187
|
(_recaptchaRef$current3 = recaptchaRef.current) === null || _recaptchaRef$current3 === void 0 ? void 0 : _recaptchaRef$current3.reset();
|
|
180
|
-
setError(
|
|
181
|
-
}, [recaptchaTimeout]);
|
|
188
|
+
setError(t('recaptcha.unavailable'));
|
|
189
|
+
}, [recaptchaTimeout, t]);
|
|
182
190
|
const handleRecaptchaErrored = useCallback(() => {
|
|
183
191
|
if (pendingSubmit) abortRecaptcha();
|
|
184
192
|
}, [pendingSubmit, abortRecaptcha]);
|
|
@@ -214,7 +222,7 @@ const TestFontsFormComponent = _ref2 => {
|
|
|
214
222
|
if (limited && families.length === 0) {
|
|
215
223
|
return /*#__PURE__*/React.createElement("div", {
|
|
216
224
|
className: "test-fonts test-fonts--unavailable"
|
|
217
|
-
}, /*#__PURE__*/React.createElement("p", null,
|
|
225
|
+
}, /*#__PURE__*/React.createElement("p", null, t('testFonts.unavailable')));
|
|
218
226
|
}
|
|
219
227
|
return /*#__PURE__*/React.createElement("div", {
|
|
220
228
|
className: "test-fonts"
|
|
@@ -228,7 +236,7 @@ const TestFontsFormComponent = _ref2 => {
|
|
|
228
236
|
}, choosing && /*#__PURE__*/React.createElement("div", {
|
|
229
237
|
className: "test-fonts__section test-fonts__families",
|
|
230
238
|
role: "group",
|
|
231
|
-
"aria-label":
|
|
239
|
+
"aria-label": t('testFonts.families')
|
|
232
240
|
}, /*#__PURE__*/React.createElement("div", {
|
|
233
241
|
className: "test-fonts__checkbox-field test-fonts__families__all"
|
|
234
242
|
}, /*#__PURE__*/React.createElement(Checkbox, {
|
|
@@ -237,7 +245,7 @@ const TestFontsFormComponent = _ref2 => {
|
|
|
237
245
|
onChange: event => setChosenIds(event.target.checked ? families.map(family => family.id) : [])
|
|
238
246
|
}), /*#__PURE__*/React.createElement("label", {
|
|
239
247
|
htmlFor: `${idPrefix}-families-all`
|
|
240
|
-
},
|
|
248
|
+
}, t('testFonts.selectAll'))), familyGroups.map((_ref4, groupIndex) => {
|
|
241
249
|
let {
|
|
242
250
|
superfamily,
|
|
243
251
|
families: grouped
|
|
@@ -259,20 +267,20 @@ const TestFontsFormComponent = _ref2 => {
|
|
|
259
267
|
})), /*#__PURE__*/React.createElement("div", {
|
|
260
268
|
className: "test-fonts__section"
|
|
261
269
|
}, /*#__PURE__*/React.createElement(TextField, {
|
|
262
|
-
label:
|
|
270
|
+
label: t('customerFields.nameRequired'),
|
|
263
271
|
value: name,
|
|
264
272
|
onChange: value => setName(value),
|
|
265
273
|
autocomplete: "name",
|
|
266
|
-
placeholder:
|
|
274
|
+
placeholder: t('customerFields.namePlaceholder')
|
|
267
275
|
})), /*#__PURE__*/React.createElement("div", {
|
|
268
276
|
className: "test-fonts__section"
|
|
269
277
|
}, /*#__PURE__*/React.createElement(TextField, {
|
|
270
|
-
label:
|
|
278
|
+
label: t('customerFields.emailRequired'),
|
|
271
279
|
type: "email",
|
|
272
280
|
value: email,
|
|
273
281
|
onChange: value => setEmail(value),
|
|
274
282
|
autocomplete: "email",
|
|
275
|
-
placeholder:
|
|
283
|
+
placeholder: t('customerFields.emailPlaceholder')
|
|
276
284
|
})), /*#__PURE__*/React.createElement("div", {
|
|
277
285
|
className: "test-fonts__agreement test-fonts__checkbox-field",
|
|
278
286
|
"data-highlighted": eulaFail && !eulaAgreed
|
|
@@ -299,6 +307,7 @@ const TestFontsFormComponent = _ref2 => {
|
|
|
299
307
|
})), recaptchaEnabled && recaptchaSiteKey && /*#__PURE__*/React.createElement(ReCAPTCHA, {
|
|
300
308
|
ref: recaptchaRef,
|
|
301
309
|
sitekey: recaptchaSiteKey,
|
|
310
|
+
hl: locale,
|
|
302
311
|
size: "invisible",
|
|
303
312
|
onChange: handleRecaptchaChange,
|
|
304
313
|
onExpired: handleRecaptchaExpired,
|
|
@@ -307,7 +316,7 @@ const TestFontsFormComponent = _ref2 => {
|
|
|
307
316
|
className: "submit-button",
|
|
308
317
|
type: "submit",
|
|
309
318
|
disabled: submitting || pendingSubmit || disabled
|
|
310
|
-
}, submitting || pendingSubmit ? '
|
|
319
|
+
}, submitting || pendingSubmit ? t('common.submittingDots') : downloadLabel, /*#__PURE__*/React.createElement("span", {
|
|
311
320
|
className: "submit-button__arrow"
|
|
312
321
|
}, " \u2192")))), /*#__PURE__*/React.createElement("form", {
|
|
313
322
|
action: archiveUrl ?? undefined,
|
|
@@ -353,12 +362,15 @@ function TestFontsFormLazyQueryRenderer(props) {
|
|
|
353
362
|
// only self-wraps with `FontdueContextProvider` when no parent Fontdue
|
|
354
363
|
// context is present, seeding it with `config`.
|
|
355
364
|
export default function TestFontsForm(_ref6) {
|
|
365
|
+
var _props$preloadedQuery;
|
|
356
366
|
let {
|
|
357
367
|
config,
|
|
368
|
+
locale,
|
|
358
369
|
...props
|
|
359
370
|
} = _ref6;
|
|
360
371
|
return /*#__PURE__*/React.createElement(EnsureFontdueContext, {
|
|
361
|
-
config: config
|
|
372
|
+
config: config,
|
|
373
|
+
locale: locale ?? ((_props$preloadedQuery = props.preloadedQuery) === null || _props$preloadedQuery === void 0 ? void 0 : _props$preloadedQuery.locale)
|
|
362
374
|
}, props.preloadedQuery ? /*#__PURE__*/React.createElement(TestFontsFormPreloadedQueryRenderer, _extends({}, props, {
|
|
363
375
|
preloadedQuery: props.preloadedQuery
|
|
364
376
|
})) : /*#__PURE__*/React.createElement(LazyQueryBoundary, null, /*#__PURE__*/React.createElement(TestFontsFormLazyQueryRenderer, props)));
|
|
@@ -15,7 +15,9 @@ export function loadTestFontsFormQuery() {
|
|
|
15
15
|
// `<TestFontsForm />` in an RSC without manually invoking
|
|
16
16
|
// `loadTestFontsFormQuery` + threading `preloadedQuery` through props.
|
|
17
17
|
export default async function TestFontsForm(props) {
|
|
18
|
-
const preloadedQuery = await loadSerializableQuery(TestFontsFormQueryNode, testFontsFormQueryVariables(props)
|
|
18
|
+
const preloadedQuery = await loadSerializableQuery(TestFontsFormQueryNode, testFontsFormQueryVariables(props), {
|
|
19
|
+
locale: props.locale
|
|
20
|
+
});
|
|
19
21
|
return /*#__PURE__*/React.createElement(TestFontsFormPreloadedQueryRenderer, _extends({
|
|
20
22
|
preloadedQuery: preloadedQuery
|
|
21
23
|
}, props));
|
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
import _TestModeBanner_viewer from "../../__generated__/TestModeBanner_viewer.graphql.js";
|
|
4
4
|
import React from 'react';
|
|
5
5
|
import { graphql, useFragment } from 'react-relay';
|
|
6
|
+
import { useT } from '../../i18n/useT.js';
|
|
6
7
|
const fragment = (_TestModeBanner_viewer.hash && _TestModeBanner_viewer.hash !== "f6b2f851466be9599d63ebf8f39e1a96" && console.error("The definition of 'TestModeBanner_viewer' appears to have changed. Run `relay-compiler` to update the generated files to receive the expected data."), _TestModeBanner_viewer);
|
|
7
8
|
export default function TestModeBanner(_ref) {
|
|
8
9
|
var _data$testMode;
|
|
@@ -10,6 +11,7 @@ export default function TestModeBanner(_ref) {
|
|
|
10
11
|
viewer
|
|
11
12
|
} = _ref;
|
|
12
13
|
const data = useFragment(fragment, viewer);
|
|
14
|
+
const t = useT();
|
|
13
15
|
if (!((_data$testMode = data.testMode) !== null && _data$testMode !== void 0 && _data$testMode.isActive)) return null;
|
|
14
16
|
return /*#__PURE__*/React.createElement("div", {
|
|
15
17
|
className: "test-mode-banner__banner",
|
|
@@ -18,5 +20,5 @@ export default function TestModeBanner(_ref) {
|
|
|
18
20
|
className: "test-mode-banner__content"
|
|
19
21
|
}, /*#__PURE__*/React.createElement("div", {
|
|
20
22
|
className: "test-mode-banner__title"
|
|
21
|
-
},
|
|
23
|
+
}, t('testMode.banner'))));
|
|
22
24
|
}
|
|
@@ -2,10 +2,12 @@ import React, { useContext } from 'react';
|
|
|
2
2
|
import { TypeTesterContext } from './TypeTesterContext.js';
|
|
3
3
|
import Bullet from './TypeTesterBullet.js';
|
|
4
4
|
import ConfigContext from '../ConfigContext.js';
|
|
5
|
+
import { useT } from '../../i18n/useT.js';
|
|
5
6
|
const TypeTesterEditAll = () => {
|
|
6
7
|
const {
|
|
7
8
|
typeTester: config
|
|
8
9
|
} = useContext(ConfigContext);
|
|
10
|
+
const t = useT();
|
|
9
11
|
const {
|
|
10
12
|
mode,
|
|
11
13
|
dispatch
|
|
@@ -21,6 +23,6 @@ const TypeTesterEditAll = () => {
|
|
|
21
23
|
config: config
|
|
22
24
|
}), ' ', /*#__PURE__*/React.createElement("span", {
|
|
23
25
|
className: "type-tester__edit-all__text"
|
|
24
|
-
},
|
|
26
|
+
}, t('typeTester.affectAllStyles')));
|
|
25
27
|
};
|
|
26
28
|
export default TypeTesterEditAll;
|
|
@@ -7,6 +7,7 @@ import Select from '../Select/index.js';
|
|
|
7
7
|
import useTypeTesterState from './TypeTesterState.js';
|
|
8
8
|
import useFeaturesData from './useFeaturesData.js';
|
|
9
9
|
import { graphql, useFragment } from 'react-relay';
|
|
10
|
+
import { useT } from '../../i18n/useT.js';
|
|
10
11
|
const TypeTesterFeaturesButton = _ref => {
|
|
11
12
|
let {
|
|
12
13
|
id,
|
|
@@ -17,6 +18,7 @@ const TypeTesterFeaturesButton = _ref => {
|
|
|
17
18
|
const {
|
|
18
19
|
typeTester: config
|
|
19
20
|
} = useContext(ConfigContext);
|
|
21
|
+
const t = useT();
|
|
20
22
|
const {
|
|
21
23
|
featuresOpen,
|
|
22
24
|
toggleFeaturesOpen,
|
|
@@ -48,7 +50,7 @@ const TypeTesterFeaturesButton = _ref => {
|
|
|
48
50
|
onClick: () => toggleFeaturesOpen()
|
|
49
51
|
}, /*#__PURE__*/React.createElement("span", {
|
|
50
52
|
className: "type-tester__features-button__text"
|
|
51
|
-
}, config.openTypeFeatures.buttonLabel), ' ', featuresOpen ? /*#__PURE__*/React.createElement(CarrotUp, null) : /*#__PURE__*/React.createElement(CarrotDown, null)));
|
|
53
|
+
}, config.openTypeFeatures.buttonLabel ?? t('typeTester.otFeatures')), ' ', featuresOpen ? /*#__PURE__*/React.createElement(CarrotUp, null) : /*#__PURE__*/React.createElement(CarrotDown, null)));
|
|
52
54
|
}
|
|
53
55
|
if (config.openTypeFeatures.interactionStyle === 'select') {
|
|
54
56
|
if (!effectiveFeatures || effectiveFeatures.length === 0) return null;
|
|
@@ -58,7 +60,7 @@ const TypeTesterFeaturesButton = _ref => {
|
|
|
58
60
|
value: selectedFeature ?? '',
|
|
59
61
|
options: [{
|
|
60
62
|
value: '',
|
|
61
|
-
text: '
|
|
63
|
+
text: t('typeTester.otFeatures')
|
|
62
64
|
}].concat(effectiveFeatures.map(feature => ({
|
|
63
65
|
value: feature,
|
|
64
66
|
text: featureNames[feature]
|
|
@@ -38,6 +38,7 @@ export declare function TypeTesterStandalonePreloadedQueryRenderer({ preloadedQu
|
|
|
38
38
|
}): React.JSX.Element;
|
|
39
39
|
export type TypeTesterStandalone_props = TypeTesterStandaloneComponent_props & {
|
|
40
40
|
config?: Config;
|
|
41
|
+
locale?: string;
|
|
41
42
|
} & ({
|
|
42
43
|
preloadedQuery: TypeTesterPreloadedQuery;
|
|
43
44
|
familyName?: never;
|
|
@@ -14,6 +14,7 @@ import TypeTesterStandaloneQueryNode from '../../__generated__/TypeTesterStandal
|
|
|
14
14
|
import ConfigContext from '../ConfigContext.js';
|
|
15
15
|
import { EnsureFontdueContext, LazyQueryBoundary } from '../FontdueContextProvider/index.js';
|
|
16
16
|
import { useLicenseAndOrderVariables } from '../../hooks/useLicenseAndOrderVariables.js';
|
|
17
|
+
import { useT } from '../../i18n/useT.js';
|
|
17
18
|
const changedStylesQuery = (_TypeTesterStandaloneChangedStylesQuery.hash && _TypeTesterStandaloneChangedStylesQuery.hash !== "98374227c6b2c3eceab5b48138e1a662" && console.error("The definition of 'TypeTesterStandaloneChangedStylesQuery' appears to have changed. Run `relay-compiler` to update the generated files to receive the expected data."), _TypeTesterStandaloneChangedStylesQuery);
|
|
18
19
|
function TypeTesterStandaloneComponent(_ref) {
|
|
19
20
|
var _data$viewer, _data$viewer2, _data$viewer2$fontSty, _data$viewer2$fontSty2, _data$viewer2$fontSty3, _data$viewer3, _data$viewer3$fontSty, _data$viewer3$fontSty2;
|
|
@@ -38,6 +39,7 @@ function TypeTesterStandaloneComponent(_ref) {
|
|
|
38
39
|
const {
|
|
39
40
|
typeTester: config
|
|
40
41
|
} = useContext(ConfigContext);
|
|
42
|
+
const t = useT();
|
|
41
43
|
let defaultAlignment = config.initialAlignment;
|
|
42
44
|
if (direction === 'rtl') defaultAlignment = 'right';
|
|
43
45
|
const environment = useRelayEnvironment();
|
|
@@ -70,7 +72,7 @@ function TypeTesterStandaloneComponent(_ref) {
|
|
|
70
72
|
return /*#__PURE__*/React.createElement(TypeTesterContextComponent, {
|
|
71
73
|
testers: {
|
|
72
74
|
standalone: {
|
|
73
|
-
content: content ?? '
|
|
75
|
+
content: content ?? t('typeTester.sampleText'),
|
|
74
76
|
autofit: autofit ?? false,
|
|
75
77
|
size: fontSize ?? 72,
|
|
76
78
|
lineHeight: lineHeight ?? 1,
|
|
@@ -144,7 +146,9 @@ function TypeTesterStandaloneLazyQueryRenderer(_ref4) {
|
|
|
144
146
|
// `EnsureFontdueContext` only self-wraps with `FontdueContextProvider` when
|
|
145
147
|
// no parent Fontdue context is present, seeding it with `config`.
|
|
146
148
|
export default function TypeTesterStandalone(props) {
|
|
149
|
+
var _props$preloadedQuery;
|
|
147
150
|
return /*#__PURE__*/React.createElement(EnsureFontdueContext, {
|
|
148
|
-
config: props.config
|
|
151
|
+
config: props.config,
|
|
152
|
+
locale: props.locale ?? ((_props$preloadedQuery = props.preloadedQuery) === null || _props$preloadedQuery === void 0 ? void 0 : _props$preloadedQuery.locale)
|
|
149
153
|
}, 'preloadedQuery' in props && props.preloadedQuery ? /*#__PURE__*/React.createElement(TypeTesterStandalonePreloadedQueryRenderer, props) : /*#__PURE__*/React.createElement(LazyQueryBoundary, null, /*#__PURE__*/React.createElement(TypeTesterStandaloneLazyQueryRenderer, props)));
|
|
150
154
|
}
|
|
@@ -23,6 +23,8 @@ export default async function TypeTesterStandalone(props) {
|
|
|
23
23
|
const preloadedQuery = await loadSerializableQuery(TypeTesterStandaloneQueryNode, {
|
|
24
24
|
familyName,
|
|
25
25
|
styleName
|
|
26
|
+
}, {
|
|
27
|
+
locale: rest.locale
|
|
26
28
|
});
|
|
27
29
|
return /*#__PURE__*/React.createElement(TypeTesterStandalonePreloadedQueryRenderer, _extends({
|
|
28
30
|
preloadedQuery: preloadedQuery
|
|
@@ -2,6 +2,7 @@ import React, { useRef } from 'react';
|
|
|
2
2
|
import { compareVariableSettings, variableInstanceSettings } from '../../utils.js';
|
|
3
3
|
import Select from '../Select/index.js';
|
|
4
4
|
import usePrefetchWhenNear from './usePrefetchWhenNear.js';
|
|
5
|
+
import { useT } from '../../i18n/useT.js';
|
|
5
6
|
const VARIABLE_AXES = 'VARIABLE_AXES';
|
|
6
7
|
const LOADING = '__loading__';
|
|
7
8
|
const TypeTesterStyleSelect = _ref => {
|
|
@@ -20,6 +21,7 @@ const TypeTesterStyleSelect = _ref => {
|
|
|
20
21
|
onSelectFamilyId,
|
|
21
22
|
includeVariableAxesOption
|
|
22
23
|
} = _ref;
|
|
24
|
+
const t = useT();
|
|
23
25
|
const containerRef = useRef(null);
|
|
24
26
|
usePrefetchWhenNear(containerRef, onOpen);
|
|
25
27
|
const handleSelectFontStyle = selection => {
|
|
@@ -53,7 +55,7 @@ const TypeTesterStyleSelect = _ref => {
|
|
|
53
55
|
});
|
|
54
56
|
if (loadingFamilies) familyOptions.push({
|
|
55
57
|
value: LOADING,
|
|
56
|
-
text: '
|
|
58
|
+
text: t('common.loading')
|
|
57
59
|
});
|
|
58
60
|
let isVariable = false;
|
|
59
61
|
const styleOptions = (selectedFamily === null || selectedFamily === void 0 ? void 0 : (_selectedFamily$fontS4 = selectedFamily.fontStyles) === null || _selectedFamily$fontS4 === void 0 ? void 0 : _selectedFamily$fontS4.flatMap(_ref3 => {
|
|
@@ -77,7 +79,7 @@ const TypeTesterStyleSelect = _ref => {
|
|
|
77
79
|
if (isVariable && includeVariableAxesOption) {
|
|
78
80
|
styleOptions.push({
|
|
79
81
|
value: VARIABLE_AXES,
|
|
80
|
-
text: '
|
|
82
|
+
text: t('typeTester.variableAxes')
|
|
81
83
|
});
|
|
82
84
|
}
|
|
83
85
|
let styleValue = selectedFontStyleId;
|
|
@@ -112,7 +114,7 @@ const TypeTesterStyleSelect = _ref => {
|
|
|
112
114
|
}), styleOptions.length > 0 && /*#__PURE__*/React.createElement(Select, {
|
|
113
115
|
options: styleOptions,
|
|
114
116
|
value: styleValue,
|
|
115
|
-
nullText:
|
|
117
|
+
nullText: t('typeTester.custom'),
|
|
116
118
|
onChange: ignoreLoading(handleSelectFontStyle),
|
|
117
119
|
onMouseDown: () => onOpen === null || onOpen === void 0 ? void 0 : onOpen(),
|
|
118
120
|
onFocus: () => onOpen === null || onOpen === void 0 ? void 0 : onOpen(),
|
|
@@ -6,6 +6,7 @@ import { graphql } from 'relay-runtime';
|
|
|
6
6
|
import { variableInstanceSettings, compareVariableSettings } from '../../utils.js';
|
|
7
7
|
import TypeTesterStyleSelect from './TypeTesterStyleSelect.js';
|
|
8
8
|
import { useTypeTesterFamilies } from './TypeTesterFamilies.js';
|
|
9
|
+
import { useT } from '../../i18n/useT.js';
|
|
9
10
|
_TypeTesterStyleSelectData_fontStyleData.hash && _TypeTesterStyleSelectData_fontStyleData.hash !== "fb09207ccab08c7e73677486469a3c95" && console.error("The definition of 'TypeTesterStyleSelectData_fontStyleData' appears to have changed. Run `relay-compiler` to update the generated files to receive the expected data."), _TypeTesterStyleSelectData_fontStyleData;
|
|
10
11
|
// get a score for similarity between two styles
|
|
11
12
|
// 0 < n <= 1
|
|
@@ -239,6 +240,7 @@ export default function TypeTesterStyleSelectData(_ref2) {
|
|
|
239
240
|
variableSettings,
|
|
240
241
|
includeVariableAxesOption
|
|
241
242
|
} = _ref2;
|
|
243
|
+
const t = useT();
|
|
242
244
|
const fontStyle = useFragment((_TypeTesterStyleSelectData_fontStyle.hash && _TypeTesterStyleSelectData_fontStyle.hash !== "368fd433966e05fc6ebecd2b60c71e3f" && console.error("The definition of 'TypeTesterStyleSelectData_fontStyle' appears to have changed. Run `relay-compiler` to update the generated files to receive the expected data."), _TypeTesterStyleSelectData_fontStyle), fontStyleKey);
|
|
243
245
|
const instance = variableSettings ? (_fontStyle$variableIn2 = fontStyle.variableInstances) === null || _fontStyle$variableIn2 === void 0 ? void 0 : _fontStyle$variableIn2.find(inst => compareVariableSettings(inst, variableSettings)) : null;
|
|
244
246
|
const name = fontStyle.family ? /*#__PURE__*/React.createElement("div", {
|
|
@@ -247,7 +249,7 @@ export default function TypeTesterStyleSelectData(_ref2) {
|
|
|
247
249
|
className: "type-tester__name__family"
|
|
248
250
|
}, fontStyle.family.name), ' ', /*#__PURE__*/React.createElement("span", {
|
|
249
251
|
className: "type-tester__name__style"
|
|
250
|
-
}, variableSettings ? (instance === null || instance === void 0 ? void 0 : instance.name) ?? '
|
|
252
|
+
}, variableSettings ? (instance === null || instance === void 0 ? void 0 : instance.name) ?? t('typeTester.custom') : fontStyle.name.replace(/ /g, '\xa0'))) : null;
|
|
251
253
|
if (!config.selectable) {
|
|
252
254
|
return /*#__PURE__*/React.createElement(React.Fragment, null, name);
|
|
253
255
|
}
|
|
@@ -9,7 +9,9 @@ import TypeTesterAlignButtons from './TypeTesterAlignButtons.js';
|
|
|
9
9
|
import ConfigContext from '../ConfigContext.js';
|
|
10
10
|
import TypeTesterVariableAxes from './TypeTesterVariableAxes.js';
|
|
11
11
|
import { graphql, useFragment } from 'react-relay';
|
|
12
|
+
import { useT } from '../../i18n/useT.js';
|
|
12
13
|
const TypeTesterToolbar = _ref => {
|
|
14
|
+
var _config$letterSpacing, _config$lineHeight;
|
|
13
15
|
let {
|
|
14
16
|
id,
|
|
15
17
|
features,
|
|
@@ -22,6 +24,10 @@ const TypeTesterToolbar = _ref => {
|
|
|
22
24
|
const {
|
|
23
25
|
typeTester: config
|
|
24
26
|
} = useContext(ConfigContext);
|
|
27
|
+
const t = useT();
|
|
28
|
+
const sizeLabel = config.size.label ?? t('typeTester.size');
|
|
29
|
+
const letterSpacingLabel = ((_config$letterSpacing = config.letterSpacing) === null || _config$letterSpacing === void 0 ? void 0 : _config$letterSpacing.label) ?? t('typeTester.letterSpacing');
|
|
30
|
+
const lineHeightLabel = ((_config$lineHeight = config.lineHeight) === null || _config$lineHeight === void 0 ? void 0 : _config$lineHeight.label) ?? t('typeTester.lineHeight');
|
|
25
31
|
const props = useTypeTesterState({
|
|
26
32
|
id
|
|
27
33
|
});
|
|
@@ -34,9 +40,9 @@ const TypeTesterToolbar = _ref => {
|
|
|
34
40
|
}
|
|
35
41
|
}, /*#__PURE__*/React.createElement("div", {
|
|
36
42
|
className: "type-tester__slider"
|
|
37
|
-
},
|
|
43
|
+
}, sizeLabel && /*#__PURE__*/React.createElement("span", {
|
|
38
44
|
className: "type-tester__slider__size-label"
|
|
39
|
-
},
|
|
45
|
+
}, sizeLabel), config.textInput && /*#__PURE__*/React.createElement(TypeTesterInput, {
|
|
40
46
|
min: config.size.min,
|
|
41
47
|
max: config.size.max,
|
|
42
48
|
value: props.size,
|
|
@@ -51,9 +57,9 @@ const TypeTesterToolbar = _ref => {
|
|
|
51
57
|
interpolator: "log10"
|
|
52
58
|
})), config.letterSpacing && /*#__PURE__*/React.createElement("div", {
|
|
53
59
|
className: "type-tester__slider__letter-spacing"
|
|
54
|
-
},
|
|
60
|
+
}, letterSpacingLabel && /*#__PURE__*/React.createElement("span", {
|
|
55
61
|
className: "type-tester__slider__line-height-label"
|
|
56
|
-
},
|
|
62
|
+
}, letterSpacingLabel), /*#__PURE__*/React.createElement(TypeTesterSlider, {
|
|
57
63
|
min: config.letterSpacing.min,
|
|
58
64
|
max: config.letterSpacing.max,
|
|
59
65
|
value: props.letterSpacing,
|
|
@@ -62,9 +68,9 @@ const TypeTesterToolbar = _ref => {
|
|
|
62
68
|
interpolator: "linear"
|
|
63
69
|
})), config.lineHeight && /*#__PURE__*/React.createElement("div", {
|
|
64
70
|
className: "type-tester__slider__line-height"
|
|
65
|
-
},
|
|
71
|
+
}, lineHeightLabel && /*#__PURE__*/React.createElement("span", {
|
|
66
72
|
className: "type-tester__slider__line-height-label"
|
|
67
|
-
},
|
|
73
|
+
}, lineHeightLabel), /*#__PURE__*/React.createElement(TypeTesterSlider, {
|
|
68
74
|
min: config.lineHeight.min,
|
|
69
75
|
max: config.lineHeight.max,
|
|
70
76
|
value: props.lineHeight,
|