fontdue-js 3.13.0 → 3.15.0-beta.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 +5 -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 +3 -1
- package/dist/__generated__/StoreModalFamily_collection.graphql.js +17 -10
- 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__/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__/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__/storeModalBundlePairs.test.js +142 -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/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 +10 -10
- package/dist/components/ConfigContext.js +8 -5
- 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.d.ts +3 -0
- package/dist/components/StoreModal/StoreModalFamily.js +28 -9
- 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/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 +10 -1
- 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/StoreModalFamily/index.d.ts +1 -1
- package/dist/components/elements/StoreModalFamily/index.js +6 -3
- 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 +35 -25
- package/dist/fontdue.css +85 -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
|
@@ -32,6 +32,7 @@ import StoreModalIndexItem from '../components/StoreModal/StoreModalIndexItem.js
|
|
|
32
32
|
const family = function (name, visibility) {
|
|
33
33
|
let totalStyles = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 4;
|
|
34
34
|
let isVariableFont = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false;
|
|
35
|
+
let overrides = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : {};
|
|
35
36
|
return {
|
|
36
37
|
id: `collection:${name}`,
|
|
37
38
|
name,
|
|
@@ -40,19 +41,32 @@ const family = function (name, visibility) {
|
|
|
40
41
|
isVariableFont,
|
|
41
42
|
totalStyles,
|
|
42
43
|
featureStyle: null,
|
|
43
|
-
|
|
44
|
+
sku: null,
|
|
45
|
+
bundles: [],
|
|
46
|
+
fontStyles: [{
|
|
47
|
+
visibility: 'VISIBLE'
|
|
48
|
+
}],
|
|
49
|
+
children: [],
|
|
50
|
+
...overrides
|
|
51
|
+
};
|
|
52
|
+
};
|
|
53
|
+
const superfamily = function (visibility, children) {
|
|
54
|
+
let overrides = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
|
|
55
|
+
return {
|
|
56
|
+
id: 'collection:Super',
|
|
57
|
+
name: 'Super',
|
|
58
|
+
visibility,
|
|
59
|
+
collectionType: 'SUPERFAMILY',
|
|
60
|
+
isVariableFont: false,
|
|
61
|
+
totalStyles: 10,
|
|
62
|
+
featureStyle: null,
|
|
63
|
+
sku: null,
|
|
64
|
+
bundles: [],
|
|
65
|
+
fontStyles: [],
|
|
66
|
+
children,
|
|
67
|
+
...overrides
|
|
44
68
|
};
|
|
45
69
|
};
|
|
46
|
-
const superfamily = (visibility, children) => ({
|
|
47
|
-
id: 'collection:Super',
|
|
48
|
-
name: 'Super',
|
|
49
|
-
visibility,
|
|
50
|
-
collectionType: 'SUPERFAMILY',
|
|
51
|
-
isVariableFont: false,
|
|
52
|
-
totalStyles: 10,
|
|
53
|
-
featureStyle: null,
|
|
54
|
-
children
|
|
55
|
-
});
|
|
56
70
|
const markup = collection => renderToStaticMarkup( /*#__PURE__*/React.createElement(StoreModalIndexItem, {
|
|
57
71
|
collection: collection
|
|
58
72
|
}));
|
|
@@ -68,4 +82,48 @@ describe('StoreModalIndexItem visibility', () => {
|
|
|
68
82
|
const html = markup(superfamily('UNLISTED', [family('Sans', 'VISIBLE'), family('Serif', 'VISIBLE', 6), family('Sans Variable', 'UNLISTED', 2, true), family('Mono Variable', 'VISIBLE', 1, true)]));
|
|
69
83
|
expect(html).toBe('<li data-product="collection:Super">Sans (4 styles)</li>' + '<li data-product="collection:Super">Serif (6 styles)</li>' + '<li data-product="collection:Super">Mono Variable (1 variable font)</li>');
|
|
70
84
|
});
|
|
85
|
+
|
|
86
|
+
// Nothing to click means no entry: the page behind it would offer licenses
|
|
87
|
+
// for fonts nobody can select (FD-1273).
|
|
88
|
+
describe('with nothing to buy', () => {
|
|
89
|
+
const empty = {
|
|
90
|
+
fontStyles: []
|
|
91
|
+
};
|
|
92
|
+
it('leaves out a family with no styles', () => {
|
|
93
|
+
expect(markup(family('Sans', 'VISIBLE', 0, false, empty))).toBe('');
|
|
94
|
+
});
|
|
95
|
+
it('leaves out a family whose styles are all unlisted and which has no price', () => {
|
|
96
|
+
const unlisted = {
|
|
97
|
+
fontStyles: [{
|
|
98
|
+
visibility: 'UNLISTED'
|
|
99
|
+
}]
|
|
100
|
+
};
|
|
101
|
+
expect(markup(family('Sans', 'VISIBLE', 4, false, unlisted))).toBe('');
|
|
102
|
+
});
|
|
103
|
+
it('keeps a family with no styles left but a price of its own', () => {
|
|
104
|
+
const priced = {
|
|
105
|
+
...empty,
|
|
106
|
+
sku: {
|
|
107
|
+
id: 'sku:1'
|
|
108
|
+
}
|
|
109
|
+
};
|
|
110
|
+
expect(markup(family('Sans', 'VISIBLE', 0, false, priced))).toBe('<li data-product="collection:Sans">Sans ()</li>');
|
|
111
|
+
});
|
|
112
|
+
it('leaves out a superfamily when none of its families has anything to buy', () => {
|
|
113
|
+
const html = markup(superfamily('VISIBLE', [family('Sans', 'VISIBLE', 0, false, empty)]));
|
|
114
|
+
expect(html).toBe('');
|
|
115
|
+
});
|
|
116
|
+
it('keeps a superfamily sold only through a bundle', () => {
|
|
117
|
+
const html = markup(superfamily('VISIBLE', [family('Sans', 'VISIBLE', 0, false, empty)], {
|
|
118
|
+
bundles: [{
|
|
119
|
+
visibility: 'VISIBLE'
|
|
120
|
+
}]
|
|
121
|
+
}));
|
|
122
|
+
expect(html).toBe('<li data-product="collection:Super">Super (10 styles)</li>');
|
|
123
|
+
});
|
|
124
|
+
it('skips such a family in place of an unlisted superfamily', () => {
|
|
125
|
+
const html = markup(superfamily('UNLISTED', [family('Sans', 'VISIBLE'), family('Serif', 'VISIBLE', 0, false, empty)]));
|
|
126
|
+
expect(html).toBe('<li data-product="collection:Super">Sans (4 styles)</li>');
|
|
127
|
+
});
|
|
128
|
+
});
|
|
71
129
|
});
|
|
@@ -24,7 +24,7 @@ describe('useSerializablePreloadedQuery (browser cache priming)', () => {
|
|
|
24
24
|
async function prime(response) {
|
|
25
25
|
const {
|
|
26
26
|
createEnvironment,
|
|
27
|
-
|
|
27
|
+
responseCacheFor
|
|
28
28
|
} = await import("../relay/environment.js");
|
|
29
29
|
const {
|
|
30
30
|
default: useSerializablePreloadedQuery
|
|
@@ -37,10 +37,11 @@ describe('useSerializablePreloadedQuery (browser cache priming)', () => {
|
|
|
37
37
|
});
|
|
38
38
|
return null;
|
|
39
39
|
}
|
|
40
|
+
const environment = createEnvironment({});
|
|
40
41
|
renderToString( /*#__PURE__*/React.createElement(RelayEnvironmentProvider, {
|
|
41
|
-
environment:
|
|
42
|
+
environment: environment
|
|
42
43
|
}, /*#__PURE__*/React.createElement(Probe, null)));
|
|
43
|
-
return
|
|
44
|
+
return responseCacheFor(environment).get(params.cacheID, {});
|
|
44
45
|
}
|
|
45
46
|
it('warms the response cache with a preload that has data', async () => {
|
|
46
47
|
var _await$prime;
|
|
@@ -4,6 +4,7 @@ import _AddToCartBanner_item from "../../__generated__/AddToCartBanner_item.grap
|
|
|
4
4
|
import React, { useEffect, useState, useRef } from 'react';
|
|
5
5
|
import { graphql, useFragment, useLazyLoadQuery } from 'react-relay';
|
|
6
6
|
import equal from 'fast-deep-equal';
|
|
7
|
+
import { useT } from '../../i18n/useT.js';
|
|
7
8
|
const getOrderItemName = item => {
|
|
8
9
|
var _item$sku;
|
|
9
10
|
const product = item === null || item === void 0 ? void 0 : (_item$sku = item.sku) === null || _item$sku === void 0 ? void 0 : _item$sku.product;
|
|
@@ -27,6 +28,7 @@ function AddToCartBanner(_ref) {
|
|
|
27
28
|
let {
|
|
28
29
|
order: orderKey
|
|
29
30
|
} = _ref;
|
|
31
|
+
const t = useT();
|
|
30
32
|
const order = useFragment((_AddToCartBanner_order.hash && _AddToCartBanner_order.hash !== "29516fe27686b4937b1856979f13d22b" && console.error("The definition of 'AddToCartBanner_order' appears to have changed. Run `relay-compiler` to update the generated files to receive the expected data."), _AddToCartBanner_order), orderKey);
|
|
31
33
|
const [active, setActive] = useState(false);
|
|
32
34
|
const prevOrderItemIds = useRef(order === null || order === void 0 ? void 0 : (_order$orderItems = order.orderItems) === null || _order$orderItems === void 0 ? void 0 : _order$orderItems.map(item => item.id));
|
|
@@ -60,11 +62,15 @@ function AddToCartBanner(_ref) {
|
|
|
60
62
|
if (timeoutRef.current) clearTimeout(timeoutRef.current);
|
|
61
63
|
};
|
|
62
64
|
}, [order === null || order === void 0 ? void 0 : order.orderItems]);
|
|
63
|
-
const itemText = (newOrderItems === null || newOrderItems === void 0 ? void 0 : newOrderItems.length) === 1 ? getOrderItemName(newOrderItems[0]) :
|
|
65
|
+
const itemText = (newOrderItems === null || newOrderItems === void 0 ? void 0 : newOrderItems.length) === 1 ? getOrderItemName(newOrderItems[0]) : t('common.itemCount', {
|
|
66
|
+
count: (newOrderItems === null || newOrderItems === void 0 ? void 0 : newOrderItems.length) ?? 0
|
|
67
|
+
});
|
|
64
68
|
return /*#__PURE__*/React.createElement("div", {
|
|
65
69
|
className: "add-to-cart-banner",
|
|
66
70
|
"data-active": active
|
|
67
|
-
},
|
|
71
|
+
}, t('addToCart.banner', {
|
|
72
|
+
item: itemText ?? ''
|
|
73
|
+
}));
|
|
68
74
|
}
|
|
69
75
|
function AddToCartBannerQueryRenderer() {
|
|
70
76
|
const {
|
|
@@ -47,6 +47,7 @@ export declare function BuyButtonPreloadedPackSlugQueryRenderer({ preloadedQuery
|
|
|
47
47
|
type BuyButton_lazyProps = LoadBuyButtonQueryVariables;
|
|
48
48
|
export type BuyButton_unifiedProps = BuyButton_props & {
|
|
49
49
|
config?: Config;
|
|
50
|
+
locale?: string;
|
|
50
51
|
} & ({
|
|
51
52
|
preloadedQuery: BuyButtonPreloadedQuery;
|
|
52
53
|
collectionId?: never;
|
|
@@ -18,6 +18,7 @@ import BuyButtonPackSlugQueryNode from '../../__generated__/BuyButtonPackSlugQue
|
|
|
18
18
|
import loadSerializableQuery from '../../relay/loadSerializableQuery.js';
|
|
19
19
|
import useSerializablePreloadedQuery from '../../relay/useSerializablePreloadedQuery.js';
|
|
20
20
|
import { EnsureFontdueContext, LazyQueryBoundary } from '../FontdueContextProvider/index.js';
|
|
21
|
+
import { useT } from '../../i18n/useT.js';
|
|
21
22
|
function BuyButtonComponent(_ref) {
|
|
22
23
|
let {
|
|
23
24
|
product: productKey,
|
|
@@ -28,6 +29,7 @@ function BuyButtonComponent(_ref) {
|
|
|
28
29
|
// which renders whichever it is given.
|
|
29
30
|
const product = useFragment((_BuyButton_product.hash && _BuyButton_product.hash !== "007b16f72407229f0f743958a541c39a" && console.error("The definition of 'BuyButton_product' appears to have changed. Run `relay-compiler` to update the generated files to receive the expected data."), _BuyButton_product), productKey);
|
|
30
31
|
const store = useStore();
|
|
32
|
+
const t = useT();
|
|
31
33
|
const components = useContext(ComponentsContext);
|
|
32
34
|
const dispatch = useDispatch();
|
|
33
35
|
const environment = useRelayEnvironment();
|
|
@@ -64,7 +66,9 @@ function BuyButtonComponent(_ref) {
|
|
|
64
66
|
className: "buy-button",
|
|
65
67
|
onClick: handleClick,
|
|
66
68
|
type: "button"
|
|
67
|
-
}, label ? label :
|
|
69
|
+
}, label ? label : productName ? t('buyButton.label', {
|
|
70
|
+
name: productName
|
|
71
|
+
}) : t('buyButton.labelNoName'));
|
|
68
72
|
}
|
|
69
73
|
const idQuery = (_BuyButtonIDQuery.hash && _BuyButtonIDQuery.hash !== "602547ee927b734b5fa2d6d1f2c93765" && console.error("The definition of 'BuyButtonIDQuery' appears to have changed. Run `relay-compiler` to update the generated files to receive the expected data."), _BuyButtonIDQuery);
|
|
70
74
|
const slugQuery = (_BuyButtonSlugQuery.hash && _BuyButtonSlugQuery.hash !== "14c9d7a1ef98d03b73b22374983b5fb4" && console.error("The definition of 'BuyButtonSlugQuery' appears to have changed. Run `relay-compiler` to update the generated files to receive the expected data."), _BuyButtonSlugQuery);
|
|
@@ -220,6 +224,7 @@ function BuyButtonPreloadedRenderer(_ref10) {
|
|
|
220
224
|
// `EnsureFontdueContext` only self-wraps with `FontdueContextProvider` when
|
|
221
225
|
// no parent Fontdue context is present, seeding it with `config`.
|
|
222
226
|
export default function BuyButton(props) {
|
|
227
|
+
var _props$preloadedQuery;
|
|
223
228
|
let inner;
|
|
224
229
|
if ('preloadedQuery' in props && props.preloadedQuery) {
|
|
225
230
|
const {
|
|
@@ -265,6 +270,7 @@ export default function BuyButton(props) {
|
|
|
265
270
|
throw new Error('BuyButton expected one of preloadedQuery, collectionId, collectionSlug, fontPackId, or fontPackSlug');
|
|
266
271
|
}
|
|
267
272
|
return /*#__PURE__*/React.createElement(EnsureFontdueContext, {
|
|
268
|
-
config: props.config
|
|
273
|
+
config: props.config,
|
|
274
|
+
locale: props.locale ?? ((_props$preloadedQuery = props.preloadedQuery) === null || _props$preloadedQuery === void 0 ? void 0 : _props$preloadedQuery.locale)
|
|
269
275
|
}, inner);
|
|
270
276
|
}
|
|
@@ -28,6 +28,8 @@ export default async function BuyButton(_ref) {
|
|
|
28
28
|
if (collectionId) {
|
|
29
29
|
const preloadedQuery = await loadSerializableQuery(BuyButtonIDQueryNode, {
|
|
30
30
|
collectionId
|
|
31
|
+
}, {
|
|
32
|
+
locale: rest.locale
|
|
31
33
|
});
|
|
32
34
|
return /*#__PURE__*/React.createElement(BuyButtonPreloadedIDQueryRenderer, _extends({
|
|
33
35
|
preloadedQuery: preloadedQuery
|
|
@@ -36,6 +38,8 @@ export default async function BuyButton(_ref) {
|
|
|
36
38
|
if (collectionSlug) {
|
|
37
39
|
const preloadedQuery = await loadSerializableQuery(BuyButtonSlugQueryNode, {
|
|
38
40
|
collectionSlug
|
|
41
|
+
}, {
|
|
42
|
+
locale: rest.locale
|
|
39
43
|
});
|
|
40
44
|
return /*#__PURE__*/React.createElement(BuyButtonPreloadedSlugQueryRenderer, _extends({
|
|
41
45
|
preloadedQuery: preloadedQuery
|
|
@@ -44,6 +48,8 @@ export default async function BuyButton(_ref) {
|
|
|
44
48
|
if (fontPackId) {
|
|
45
49
|
const preloadedQuery = await loadSerializableQuery(BuyButtonPackIDQueryNode, {
|
|
46
50
|
fontPackId
|
|
51
|
+
}, {
|
|
52
|
+
locale: rest.locale
|
|
47
53
|
});
|
|
48
54
|
return /*#__PURE__*/React.createElement(BuyButtonPreloadedPackIDQueryRenderer, _extends({
|
|
49
55
|
preloadedQuery: preloadedQuery
|
|
@@ -52,6 +58,8 @@ export default async function BuyButton(_ref) {
|
|
|
52
58
|
if (fontPackSlug) {
|
|
53
59
|
const preloadedQuery = await loadSerializableQuery(BuyButtonPackSlugQueryNode, {
|
|
54
60
|
fontPackSlug
|
|
61
|
+
}, {
|
|
62
|
+
locale: rest.locale
|
|
55
63
|
});
|
|
56
64
|
return /*#__PURE__*/React.createElement(BuyButtonPreloadedPackSlugQueryRenderer, _extends({
|
|
57
65
|
preloadedQuery: preloadedQuery
|
|
@@ -1,14 +1,16 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { connect } from 'react-redux';
|
|
3
|
+
import { useT } from '../../i18n/useT.js';
|
|
3
4
|
const BuyingOptions = _ref => {
|
|
4
5
|
let {
|
|
5
6
|
onPrecartOpen
|
|
6
7
|
} = _ref;
|
|
8
|
+
const t = useT();
|
|
7
9
|
return /*#__PURE__*/React.createElement("button", {
|
|
8
10
|
type: "button",
|
|
9
11
|
className: "buying-options buy-family__options__button",
|
|
10
12
|
onClick: onPrecartOpen
|
|
11
|
-
},
|
|
13
|
+
}, t('storeModal.buyingOptions'));
|
|
12
14
|
};
|
|
13
15
|
const mapDispatchToProps = dispatch => ({
|
|
14
16
|
onPrecartOpen: () => dispatch({
|
|
@@ -5,6 +5,7 @@ import TextField from '../TextField/index.js';
|
|
|
5
5
|
import AddressFieldsRefetchQuery from '../../__generated__/AddressFieldsRefetchQuery.graphql.js';
|
|
6
6
|
import { notEmpty } from '../../utils.js';
|
|
7
7
|
import { AddressElement } from '@stripe/react-stripe-js';
|
|
8
|
+
import { useT } from '../../i18n/useT.js';
|
|
8
9
|
const MAPS_API_KEY = 'AIzaSyB9rSjGVPZYcRkPl1PDezIuAp3XCUs2Crk';
|
|
9
10
|
const AddressFields = _ref => {
|
|
10
11
|
var _viewer$countryData, _value$street, _viewer$settings;
|
|
@@ -16,6 +17,7 @@ const AddressFields = _ref => {
|
|
|
16
17
|
errorsObject,
|
|
17
18
|
allowedCountries
|
|
18
19
|
} = _ref;
|
|
20
|
+
const t = useT();
|
|
19
21
|
const [refetching, setRefetching] = useState(false);
|
|
20
22
|
const [viewer, refetch] = useRefetchableFragment((_AddressFields_viewer.hash && _AddressFields_viewer.hash !== "2369fc95f554723701a8294b4522137a" && console.error("The definition of 'AddressFields_viewer' appears to have changed. Run `relay-compiler` to update the generated files to receive the expected data."), _AddressFields_viewer), viewerKey);
|
|
21
23
|
const countryData = (_viewer$countryData = viewer.countryData) === null || _viewer$countryData === void 0 ? void 0 : _viewer$countryData.response;
|
|
@@ -99,7 +101,7 @@ const AddressFields = _ref => {
|
|
|
99
101
|
return /*#__PURE__*/React.createElement(Fragment, null, /*#__PURE__*/React.createElement("div", {
|
|
100
102
|
className: "checkout-modal__section"
|
|
101
103
|
}, /*#__PURE__*/React.createElement(TextField, {
|
|
102
|
-
label:
|
|
104
|
+
label: t('address.organization'),
|
|
103
105
|
value: value.organization || '',
|
|
104
106
|
onChange: v => onChange({
|
|
105
107
|
organization: v
|
|
@@ -107,7 +109,7 @@ const AddressFields = _ref => {
|
|
|
107
109
|
})), /*#__PURE__*/React.createElement("div", {
|
|
108
110
|
className: "checkout-modal__section"
|
|
109
111
|
}, /*#__PURE__*/React.createElement(TextField, {
|
|
110
|
-
label: identityType === 'licensee' ? '
|
|
112
|
+
label: identityType === 'licensee' ? t('address.contactEmail') : t('address.email'),
|
|
111
113
|
autocomplete: "email",
|
|
112
114
|
type: "email",
|
|
113
115
|
value: value.email || '',
|
|
@@ -139,7 +141,7 @@ const AddressFields = _ref => {
|
|
|
139
141
|
})), identityType === 'billing' ? countryData && !refetching ? /*#__PURE__*/React.createElement(Fragment, null, (countryData.isEuCountry || value.country === 'GB') && /*#__PURE__*/React.createElement("div", {
|
|
140
142
|
className: "checkout-modal__section"
|
|
141
143
|
}, /*#__PURE__*/React.createElement(TextField, {
|
|
142
|
-
label:
|
|
144
|
+
label: t('address.vatNumber'),
|
|
143
145
|
autocomplete: "vat",
|
|
144
146
|
placeholder: "12345678",
|
|
145
147
|
value: value.vatNumber || '',
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
interface CartCouponNoticeProps {
|
|
3
|
+
discountRemoved: boolean;
|
|
4
|
+
errors?: ReadonlyArray<string | null> | null;
|
|
5
|
+
}
|
|
6
|
+
export default function CartCouponNotice({ discountRemoved, errors }: CartCouponNoticeProps): React.JSX.Element | null;
|
|
7
|
+
export {};
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { useT } from '../../i18n/useT.js';
|
|
3
|
+
export default function CartCouponNotice(_ref) {
|
|
4
|
+
let {
|
|
5
|
+
discountRemoved,
|
|
6
|
+
errors
|
|
7
|
+
} = _ref;
|
|
8
|
+
const t = useT();
|
|
9
|
+
const error = errors === null || errors === void 0 ? void 0 : errors[0];
|
|
10
|
+
if (error) {
|
|
11
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
12
|
+
className: "store-modal__cart__error",
|
|
13
|
+
role: "alert"
|
|
14
|
+
}, error);
|
|
15
|
+
}
|
|
16
|
+
if (!discountRemoved) return null;
|
|
17
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
18
|
+
className: "store-modal__cart__notice",
|
|
19
|
+
role: "status"
|
|
20
|
+
}, t('coupon.removed'));
|
|
21
|
+
}
|
|
@@ -2,6 +2,7 @@ import _CartItemAdditionalLicenses_orderItem from "../../../__generated__/CartIt
|
|
|
2
2
|
import _CartItemAdditionalLicenses_licenses from "../../../__generated__/CartItemAdditionalLicenses_licenses.graphql.js";
|
|
3
3
|
import React from 'react';
|
|
4
4
|
import { graphql, useFragment } from 'react-relay';
|
|
5
|
+
import { useT } from '../../../i18n/useT.js';
|
|
5
6
|
export default function CartItemAdditionalLicenses(_ref) {
|
|
6
7
|
var _orderItem$licenseSel, _orderItem$licenseSel2;
|
|
7
8
|
let {
|
|
@@ -9,6 +10,7 @@ export default function CartItemAdditionalLicenses(_ref) {
|
|
|
9
10
|
orderItem: orderItemKey,
|
|
10
11
|
onAddLicense
|
|
11
12
|
} = _ref;
|
|
13
|
+
const t = useT();
|
|
12
14
|
const licenses = useFragment((_CartItemAdditionalLicenses_licenses.hash && _CartItemAdditionalLicenses_licenses.hash !== "a00d0c8ac3643f7c12911fad6f62ec4e" && console.error("The definition of 'CartItemAdditionalLicenses_licenses' appears to have changed. Run `relay-compiler` to update the generated files to receive the expected data."), _CartItemAdditionalLicenses_licenses), licensesKey);
|
|
13
15
|
const orderItem = useFragment((_CartItemAdditionalLicenses_orderItem.hash && _CartItemAdditionalLicenses_orderItem.hash !== "52f514c1954a1d93863d7dd4c4871e3a" && console.error("The definition of 'CartItemAdditionalLicenses_orderItem' appears to have changed. Run `relay-compiler` to update the generated files to receive the expected data."), _CartItemAdditionalLicenses_orderItem), orderItemKey);
|
|
14
16
|
if (!licenses) return null;
|
|
@@ -28,7 +30,7 @@ export default function CartItemAdditionalLicenses(_ref) {
|
|
|
28
30
|
if (additionalLicenses.length < 1) return null;
|
|
29
31
|
return /*#__PURE__*/React.createElement("div", {
|
|
30
32
|
className: "cart-item__additional-licenses"
|
|
31
|
-
},
|
|
33
|
+
}, t('cartItem.addLicense'), ' ', additionalLicenses.map(license => /*#__PURE__*/React.createElement("button", {
|
|
32
34
|
type: "button",
|
|
33
35
|
className: "cart-item__additional-licenses__item",
|
|
34
36
|
key: license.id,
|
|
@@ -3,6 +3,7 @@ import React, { useState } from 'react';
|
|
|
3
3
|
import { graphql, useFragment } from 'react-relay';
|
|
4
4
|
import { X } from '../../Icons/index.js';
|
|
5
5
|
import CartItemVariable from './CartItemVariable.js';
|
|
6
|
+
import { useT } from '../../../i18n/useT.js';
|
|
6
7
|
export default function CartItemLicense(_ref) {
|
|
7
8
|
var _selections$filter;
|
|
8
9
|
let {
|
|
@@ -12,6 +13,7 @@ export default function CartItemLicense(_ref) {
|
|
|
12
13
|
closeButtonMouseLeave: parentCloseButtonMouseLeave,
|
|
13
14
|
selections: selectionsKey
|
|
14
15
|
} = _ref;
|
|
16
|
+
const t = useT();
|
|
15
17
|
const selections = useFragment((_CartItemLicense_selection.hash && _CartItemLicense_selection.hash !== "8a249e2954a1c0d5279a28d666abe1c0" && console.error("The definition of 'CartItemLicense_selection' appears to have changed. Run `relay-compiler` to update the generated files to receive the expected data."), _CartItemLicense_selection), selectionsKey);
|
|
16
18
|
if (selections.length === 0) return null;
|
|
17
19
|
const license = selections[0].license;
|
|
@@ -36,7 +38,7 @@ export default function CartItemLicense(_ref) {
|
|
|
36
38
|
}, /*#__PURE__*/React.createElement("button", {
|
|
37
39
|
type: "button",
|
|
38
40
|
className: "cart-item__license__delete-button",
|
|
39
|
-
"aria-label":
|
|
41
|
+
"aria-label": t('cartItem.removeLicense'),
|
|
40
42
|
onClick: handleClickRemove,
|
|
41
43
|
onMouseEnter: closeButtonMouseEnter,
|
|
42
44
|
onMouseLeave: closeButtonMouseLeave
|
|
@@ -3,12 +3,13 @@ import React from 'react';
|
|
|
3
3
|
import { CollectionAa } from '../../CollectionAa/index.js';
|
|
4
4
|
import FontStyle from '../../FontStyle/index.js';
|
|
5
5
|
import { graphql, useFragment } from 'react-relay';
|
|
6
|
-
import {
|
|
6
|
+
import { useT } from '../../../i18n/useT.js';
|
|
7
7
|
export default function CartItemProduct(_ref) {
|
|
8
8
|
var _product$name, _product$variableInst;
|
|
9
9
|
let {
|
|
10
10
|
product: productKey
|
|
11
11
|
} = _ref;
|
|
12
|
+
const t = useT();
|
|
12
13
|
const product = useFragment((_CartItemProduct_product.hash && _CartItemProduct_product.hash !== "15b269b9bb33a3bfa7b10486e99da183" && console.error("The definition of 'CartItemProduct_product' appears to have changed. Run `relay-compiler` to update the generated files to receive the expected data."), _CartItemProduct_product), productKey);
|
|
13
14
|
let productName = (product === null || product === void 0 ? void 0 : product.name) ?? '??';
|
|
14
15
|
if ((product === null || product === void 0 ? void 0 : product.__typename) === 'FontStyle' && product.family) productName = `${product.family.name} ${product.name}`;
|
|
@@ -25,7 +26,9 @@ export default function CartItemProduct(_ref) {
|
|
|
25
26
|
className: "cart-item__name"
|
|
26
27
|
}, productName), product !== null && product !== void 0 && product.isVariableFont || product !== null && product !== void 0 && (_product$variableInst = product.variableInstances) !== null && _product$variableInst !== void 0 && _product$variableInst.length ? /*#__PURE__*/React.createElement("div", {
|
|
27
28
|
className: "cart-item__label"
|
|
28
|
-
},
|
|
29
|
+
}, t('cartItem.variableFont')) : ((product === null || product === void 0 ? void 0 : product.__typename) === 'FontCollection' || (product === null || product === void 0 ? void 0 : product.__typename) === 'CollectionBundle' || (product === null || product === void 0 ? void 0 : product.__typename) === 'FontPack') && /*#__PURE__*/React.createElement("div", {
|
|
29
30
|
className: "cart-item__label"
|
|
30
|
-
}, "(",
|
|
31
|
+
}, "(", t('common.styleCount', {
|
|
32
|
+
count: product.totalStyles ?? 0
|
|
33
|
+
}), ")")));
|
|
31
34
|
}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
|
|
2
2
|
import React, { useEffect, useRef, useState } from 'react';
|
|
3
|
+
import { useT } from '../../../i18n/useT.js';
|
|
3
4
|
export default function VariableTextInput(_ref) {
|
|
4
5
|
let {
|
|
5
6
|
defaultValue,
|
|
@@ -7,6 +8,7 @@ export default function VariableTextInput(_ref) {
|
|
|
7
8
|
placeholder,
|
|
8
9
|
...rest
|
|
9
10
|
} = _ref;
|
|
11
|
+
const t = useT();
|
|
10
12
|
const [value, setValue] = useState(defaultValue || '');
|
|
11
13
|
const [editing, setEditing] = useState(!defaultValue);
|
|
12
14
|
const [submitting, setSubmitting] = useState(false);
|
|
@@ -48,7 +50,7 @@ export default function VariableTextInput(_ref) {
|
|
|
48
50
|
if (submitting) {
|
|
49
51
|
return /*#__PURE__*/React.createElement("div", {
|
|
50
52
|
className: "cart-item__license-variable__loading"
|
|
51
|
-
},
|
|
53
|
+
}, t('cartItem.updating'));
|
|
52
54
|
}
|
|
53
55
|
if (editing) {
|
|
54
56
|
return /*#__PURE__*/React.createElement("form", {
|
|
@@ -62,12 +64,14 @@ export default function VariableTextInput(_ref) {
|
|
|
62
64
|
value: value,
|
|
63
65
|
onChange: handleChange,
|
|
64
66
|
onBlur: handleBlur,
|
|
65
|
-
placeholder:
|
|
67
|
+
placeholder: t('cartItem.enterValue', {
|
|
68
|
+
name: placeholder
|
|
69
|
+
})
|
|
66
70
|
}, rest)));
|
|
67
71
|
}
|
|
68
72
|
return /*#__PURE__*/React.createElement("button", {
|
|
69
73
|
className: "cart-item__license-variable__text-input-button",
|
|
70
74
|
type: "button",
|
|
71
75
|
onClick: handleEditButtonClick
|
|
72
|
-
}, defaultValue, " ", /*#__PURE__*/React.createElement("span", null,
|
|
76
|
+
}, defaultValue, " ", /*#__PURE__*/React.createElement("span", null, t('common.edit')));
|
|
73
77
|
}
|
|
@@ -5,6 +5,7 @@ import Price from '../../Price/index.js';
|
|
|
5
5
|
import CartItemLicense from './CartItemLicense.js';
|
|
6
6
|
import CartItemAdditionalLicenses from './CartItemAdditionalLicenses.js';
|
|
7
7
|
import CartItemProduct from './CartItemProduct.js';
|
|
8
|
+
import { useT } from '../../../i18n/useT.js';
|
|
8
9
|
export default function CartItem(_ref) {
|
|
9
10
|
var _node$licenseSelectio, _node$licenseSelectio2, _node$sku2, _node$sku3, _node$sku3$product;
|
|
10
11
|
let {
|
|
@@ -12,6 +13,7 @@ export default function CartItem(_ref) {
|
|
|
12
13
|
onChange,
|
|
13
14
|
errors
|
|
14
15
|
} = _ref;
|
|
16
|
+
const t = useT();
|
|
15
17
|
const node = useFragment((_CartItem_node.hash && _CartItem_node.hash !== "c17a59a874f66eaed523d8928f9f1171" && console.error("The definition of 'CartItem_node' appears to have changed. Run `relay-compiler` to update the generated files to receive the expected data."), _CartItem_node), nodeKey);
|
|
16
18
|
const [closeButtonIsHovered, setCloseButtonIsHovered] = useState(false);
|
|
17
19
|
const closeButtonMouseEnter = () => {
|
|
@@ -83,7 +85,9 @@ export default function CartItem(_ref) {
|
|
|
83
85
|
closeButtonMouseLeave: closeButtonMouseLeave
|
|
84
86
|
}))), errors !== null && errors !== void 0 && errors.licenseSelections ? /*#__PURE__*/React.createElement("div", {
|
|
85
87
|
className: "cart-item__error"
|
|
86
|
-
},
|
|
88
|
+
}, t('cartItem.licenseSelectionsError', {
|
|
89
|
+
errors: errors.licenseSelections
|
|
90
|
+
})) : null), node.price && /*#__PURE__*/React.createElement("div", {
|
|
87
91
|
className: "cart-item__price"
|
|
88
92
|
}, /*#__PURE__*/React.createElement(Price, {
|
|
89
93
|
price: node.price
|
|
@@ -21,7 +21,9 @@ import { textVariablesAllHaveText } from './utils.js';
|
|
|
21
21
|
import { useStripe } from '@stripe/react-stripe-js';
|
|
22
22
|
import { useDispatch } from 'react-redux';
|
|
23
23
|
import CartState from './CartState.js';
|
|
24
|
+
import CartCouponNotice from './CartCouponNotice.js';
|
|
24
25
|
import { sendOrderTracking } from './orderTracking.js';
|
|
26
|
+
import { useT } from '../../i18n/useT.js';
|
|
25
27
|
|
|
26
28
|
// note here we're only updating the order (by id).
|
|
27
29
|
// careful not to update the current customer's reference
|
|
@@ -45,6 +47,7 @@ const CartOrder = _ref => {
|
|
|
45
47
|
const environment = useRelayEnvironment();
|
|
46
48
|
const stripe = useStripe();
|
|
47
49
|
const dispatch = useDispatch();
|
|
50
|
+
const t = useT();
|
|
48
51
|
|
|
49
52
|
// Capture analytics consent + attribution on the order for the purchase
|
|
50
53
|
// event the server emits on completion (from a Stripe webhook, where no
|
|
@@ -116,7 +119,7 @@ const CartOrder = _ref => {
|
|
|
116
119
|
return;
|
|
117
120
|
}
|
|
118
121
|
if (requiresAction === 'enter_new_payment_method') {
|
|
119
|
-
setPaymentError('
|
|
122
|
+
setPaymentError(t('cart.paymentRetry'));
|
|
120
123
|
setCompleting(false);
|
|
121
124
|
setCheckingOut(true);
|
|
122
125
|
setCheckoutStep(CheckoutSteps.Payment);
|
|
@@ -187,17 +190,17 @@ const CartOrder = _ref => {
|
|
|
187
190
|
})
|
|
188
191
|
}, /*#__PURE__*/React.createElement(X, null)), /*#__PURE__*/React.createElement("div", {
|
|
189
192
|
className: "cart__nav__title"
|
|
190
|
-
},
|
|
193
|
+
}, t('cart.yourCart'))), (order.customer || order.billingIdentity || order.licenseeIdentity || order.stripePaymentMethod) && /*#__PURE__*/React.createElement("div", {
|
|
191
194
|
className: "cart__review"
|
|
192
195
|
}, order.billingIdentity && /*#__PURE__*/React.createElement(IdentityBox, {
|
|
193
196
|
identity: order.billingIdentity,
|
|
194
|
-
title:
|
|
197
|
+
title: t('cart.billingInformation'),
|
|
195
198
|
onClick: () => openCheckoutStep(CheckoutSteps.Billing)
|
|
196
199
|
}, {
|
|
197
200
|
icon: /*#__PURE__*/React.createElement(Receipt, null)
|
|
198
201
|
}), order.licenseeIdentity && /*#__PURE__*/React.createElement(IdentityBox, {
|
|
199
202
|
identity: order.licenseeIdentity,
|
|
200
|
-
title:
|
|
203
|
+
title: t('cart.licenseeInformation'),
|
|
201
204
|
onClick: () => openCheckoutStep(CheckoutSteps.Licensee)
|
|
202
205
|
}, {
|
|
203
206
|
icon: /*#__PURE__*/React.createElement(License, null)
|
|
@@ -207,9 +210,9 @@ const CartOrder = _ref => {
|
|
|
207
210
|
onClick: () => openCheckoutStep(CheckoutSteps.Customer)
|
|
208
211
|
}, /*#__PURE__*/React.createElement("div", {
|
|
209
212
|
className: "cart__review__label"
|
|
210
|
-
}, /*#__PURE__*/React.createElement(User, null), "
|
|
213
|
+
}, /*#__PURE__*/React.createElement(User, null), " ", t('cart.contactInformation'), ' ', /*#__PURE__*/React.createElement("span", {
|
|
211
214
|
className: "cart__review__label__text"
|
|
212
|
-
},
|
|
215
|
+
}, t('common.edit'))), /*#__PURE__*/React.createElement("div", {
|
|
213
216
|
className: "cart__review__section"
|
|
214
217
|
}, order.customer.name), /*#__PURE__*/React.createElement("div", {
|
|
215
218
|
className: "cart__review__section"
|
|
@@ -219,29 +222,36 @@ const CartOrder = _ref => {
|
|
|
219
222
|
onClick: () => openCheckoutStep(CheckoutSteps.Payment)
|
|
220
223
|
}, /*#__PURE__*/React.createElement("div", {
|
|
221
224
|
className: "cart__review__label"
|
|
222
|
-
}, /*#__PURE__*/React.createElement(CreditCard, null), "
|
|
225
|
+
}, /*#__PURE__*/React.createElement(CreditCard, null), " ", t('cart.payment'), ' ', /*#__PURE__*/React.createElement("span", {
|
|
223
226
|
className: "cart__review__label__text"
|
|
224
|
-
},
|
|
227
|
+
}, t('common.edit'))), /*#__PURE__*/React.createElement("div", {
|
|
225
228
|
className: "cart__review__section"
|
|
226
229
|
}, "\u2013\u2013\u2013\u2013\u2013\u2013 \u2013\u2013\u2013\u2013\u2013\u2013 ", (_order$stripePaymentM = order.stripePaymentMethod.card) === null || _order$stripePaymentM === void 0 ? void 0 : _order$stripePaymentM.last4)))), (error || errors) && /*#__PURE__*/React.createElement("div", {
|
|
227
230
|
className: "cart__error"
|
|
228
|
-
},
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
231
|
+
}, t.rich('cart.orderProblem', {
|
|
232
|
+
button: /*#__PURE__*/React.createElement("button", {
|
|
233
|
+
type: "button",
|
|
234
|
+
onClick: clearError,
|
|
235
|
+
className: "cart__error__button"
|
|
236
|
+
}, t('cart.orderProblemButton'))
|
|
237
|
+
})), /*#__PURE__*/React.createElement("div", {
|
|
233
238
|
className: "cart__middle"
|
|
234
239
|
}, /*#__PURE__*/React.createElement(CartState, {
|
|
235
240
|
order: order
|
|
236
241
|
}, _ref2 => {
|
|
237
242
|
let {
|
|
238
|
-
onUpdateOrderItem
|
|
243
|
+
onUpdateOrderItem,
|
|
244
|
+
discountRemoved,
|
|
245
|
+
errors
|
|
239
246
|
} = _ref2;
|
|
240
247
|
return /*#__PURE__*/React.createElement(React.Fragment, null, orderItems.map((item, i) => /*#__PURE__*/React.createElement(CartItem, {
|
|
241
248
|
key: i,
|
|
242
249
|
node: item,
|
|
243
250
|
onChange: onUpdateOrderItem
|
|
244
|
-
}))
|
|
251
|
+
})), /*#__PURE__*/React.createElement(CartCouponNotice, {
|
|
252
|
+
discountRemoved: discountRemoved,
|
|
253
|
+
errors: errors === null || errors === void 0 ? void 0 : errors.coupon
|
|
254
|
+
}));
|
|
245
255
|
})), /*#__PURE__*/React.createElement("div", {
|
|
246
256
|
className: "cart__bottom"
|
|
247
257
|
}, /*#__PURE__*/React.createElement("div", {
|
|
@@ -281,7 +291,7 @@ const CartOrder = _ref => {
|
|
|
281
291
|
"data-label": "submit",
|
|
282
292
|
type: "button",
|
|
283
293
|
"data-highlighted": true
|
|
284
|
-
}, completing ? '
|
|
294
|
+
}, completing ? t('common.submittingDots') : /*#__PURE__*/React.createElement(Fragment, null, order.canCompleteWithCoupon ? t('cart.completeWithCoupon') : t('cart.submitPayment'), /*#__PURE__*/React.createElement("span", {
|
|
285
295
|
className: "submit-button__arrow"
|
|
286
296
|
}, ' →')))) : /*#__PURE__*/React.createElement("div", {
|
|
287
297
|
className: "cart__checkout-button"
|
|
@@ -289,7 +299,7 @@ const CartOrder = _ref => {
|
|
|
289
299
|
className: "submit-button",
|
|
290
300
|
onClick: openCheckout,
|
|
291
301
|
type: "button"
|
|
292
|
-
},
|
|
302
|
+
}, requiresCheckout() ? t('cart.proceedToCheckout') : t('cart.proceed'), /*#__PURE__*/React.createElement("span", {
|
|
293
303
|
className: "submit-button__arrow"
|
|
294
304
|
}, ' →'))))), /*#__PURE__*/React.createElement("div", {
|
|
295
305
|
style: {
|
|
@@ -8,6 +8,7 @@ interface CartStateProps {
|
|
|
8
8
|
onUpdateOrderVariableSelections: (variables: OrderVariableSelectionInput[]) => void;
|
|
9
9
|
onUpdateOrderItem: (item: CartItemChangeInput) => void;
|
|
10
10
|
onRemoveDiscount: () => void;
|
|
11
|
+
discountRemoved: boolean;
|
|
11
12
|
error: any;
|
|
12
13
|
errors: any;
|
|
13
14
|
}) => React.ReactElement<any>;
|