fontdue-js 3.0.0-alpha3 → 3.0.0-alpha5
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/README.md +463 -94
- package/dist/__generated__/ServerConfigProviderQuery.graphql.js +8 -1
- package/dist/__generated__/TestModeBannerQuery.graphql.js +8 -1
- package/dist/__generated__/ThemeConfigQuery.graphql.js +8 -1
- package/dist/__tests__/licenseExclusions.test.js +161 -0
- package/dist/components/BuyButton/index.d.ts +2 -2
- package/dist/components/BuyButton/index.js +3 -3
- package/dist/components/BuyButton/index.server.d.ts +2 -0
- package/dist/components/BuyButton/index.server.js +5 -0
- package/dist/components/BuyingOptions/index.d.ts +9 -0
- package/dist/components/CartButton/index.d.ts +1 -11
- package/dist/components/CartButton/index.js +9 -29
- package/dist/components/CartButton/index.server.d.ts +1 -1
- package/dist/components/CartButton/index.server.js +14 -12
- package/dist/components/CharacterViewer/index.d.ts +2 -2
- package/dist/components/CharacterViewer/index.js +3 -3
- package/dist/components/CharacterViewer/index.server.d.ts +2 -0
- package/dist/components/CharacterViewer/index.server.js +5 -0
- package/dist/components/CookieNotification/index.d.ts +13 -0
- package/dist/components/CookieNotification/index.js +4 -4
- package/dist/components/FontdueProvider/FontdueProviderClientComponent.d.ts +4 -6
- package/dist/components/FontdueProvider/FontdueProviderClientComponent.js +39 -48
- package/dist/components/FontdueProvider/index.d.ts +1 -0
- package/dist/components/FontdueProvider/index.js +1 -0
- package/dist/components/FontdueProvider/index.server.d.ts +2 -0
- package/dist/components/FontdueProvider/index.server.js +12 -4
- package/dist/components/NewsletterSignup/index.d.ts +2 -2
- package/dist/components/NewsletterSignup/index.js +2 -2
- package/dist/components/NewsletterSignup/index.server.d.ts +2 -0
- package/dist/components/NewsletterSignup/index.server.js +5 -0
- package/dist/components/TestFontsForm/index.d.ts +2 -2
- package/dist/components/TestFontsForm/index.js +2 -2
- package/dist/components/TestFontsForm/index.server.d.ts +2 -0
- package/dist/components/TestFontsForm/index.server.js +5 -0
- package/dist/components/ThemeConfig/index.server.js +14 -7
- package/dist/components/TypeTester/TypeTesterStandalone.d.ts +2 -2
- package/dist/components/TypeTester/TypeTesterStandalone.js +2 -2
- package/dist/components/TypeTester/TypeTesterStandalone.server.d.ts +2 -0
- package/dist/components/TypeTester/TypeTesterStandalone.server.js +5 -0
- package/dist/components/TypeTesters/index.d.ts +2 -2
- package/dist/components/TypeTesters/index.js +3 -3
- package/dist/components/TypeTesters/index.server.d.ts +2 -0
- package/dist/components/TypeTesters/index.server.js +5 -0
- package/dist/fontdue.css +12 -12
- package/dist/loadFontdueProviderQuery.d.ts +1 -2
- package/dist/loadFontdueProviderQuery.js +2 -2
- package/dist/relay/environment.js +1 -1
- package/dist/relay/loadSerializableQuery.d.ts +1 -5
- package/dist/relay/loadSerializableQuery.js +2 -2
- package/dist/vite.js +42 -2
- package/package.json +3 -8
|
@@ -1,3 +1,9 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
1
7
|
/**
|
|
2
8
|
* @generated SignedSource<<e36d7651684826ea0cac76a464f23dcd>>
|
|
3
9
|
* @lightSyntaxTransform
|
|
@@ -98,4 +104,5 @@ const node = function () {
|
|
|
98
104
|
};
|
|
99
105
|
}();
|
|
100
106
|
node.hash = "b20ad9bdada6a425ee660a8662a78840";
|
|
101
|
-
|
|
107
|
+
var _default = node;
|
|
108
|
+
exports.default = _default;
|
|
@@ -1,3 +1,9 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
1
7
|
/**
|
|
2
8
|
* @generated SignedSource<<e395904ea5bda751df1ca67f9c74ac55>>
|
|
3
9
|
* @lightSyntaxTransform
|
|
@@ -77,4 +83,5 @@ const node = function () {
|
|
|
77
83
|
};
|
|
78
84
|
}();
|
|
79
85
|
node.hash = "60ad67ee88ec6b74dd04bdf5572e7faf";
|
|
80
|
-
|
|
86
|
+
var _default = node;
|
|
87
|
+
exports.default = _default;
|
|
@@ -1,3 +1,9 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
1
7
|
/**
|
|
2
8
|
* @generated SignedSource<<b292c0ac6583f7d2d7cd8979e5696b21>>
|
|
3
9
|
* @lightSyntaxTransform
|
|
@@ -77,4 +83,5 @@ const node = function () {
|
|
|
77
83
|
};
|
|
78
84
|
}();
|
|
79
85
|
node.hash = "c259bee038c4d2ea14c758fba3381f57";
|
|
80
|
-
|
|
86
|
+
var _default = node;
|
|
87
|
+
exports.default = _default;
|
|
@@ -0,0 +1,161 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _vitest = require("vitest");
|
|
4
|
+
var _reducer = _interopRequireDefault(require("../reducer"));
|
|
5
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
6
|
+
_vitest.vi.mock('react-relay', () => ({
|
|
7
|
+
graphql: () => null,
|
|
8
|
+
fetchQuery: _vitest.vi.fn()
|
|
9
|
+
}));
|
|
10
|
+
function makeState() {
|
|
11
|
+
let overrides = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
12
|
+
return {
|
|
13
|
+
cartOpen: false,
|
|
14
|
+
precartOpen: false,
|
|
15
|
+
selectedSkuIds: {},
|
|
16
|
+
licenseOptions: [],
|
|
17
|
+
collectionStyleSkus: {},
|
|
18
|
+
collectionSkus: {},
|
|
19
|
+
skuPrices: {},
|
|
20
|
+
fetchedCollectionIds: [],
|
|
21
|
+
storeModalRoute: {
|
|
22
|
+
name: 'index'
|
|
23
|
+
},
|
|
24
|
+
storeModalHistory: [],
|
|
25
|
+
orderVariableSelections: [],
|
|
26
|
+
licenseeIsBillingIdentity: null,
|
|
27
|
+
...overrides
|
|
28
|
+
};
|
|
29
|
+
}
|
|
30
|
+
(0, _vitest.describe)('PRECART_SELECT_LICENSE auto-deselect', () => {
|
|
31
|
+
(0, _vitest.it)('drops a currently-selected license when its excluder is selected', () => {
|
|
32
|
+
const state = makeState({
|
|
33
|
+
licenseOptions: [{
|
|
34
|
+
licenseId: 'A',
|
|
35
|
+
licenseOptions: {}
|
|
36
|
+
}]
|
|
37
|
+
});
|
|
38
|
+
const newState = (0, _reducer.default)(state, {
|
|
39
|
+
type: 'PRECART_SELECT_LICENSE',
|
|
40
|
+
licenseOptionSpec: {
|
|
41
|
+
licenseId: 'B',
|
|
42
|
+
licenseOptions: {}
|
|
43
|
+
},
|
|
44
|
+
excludedLicenseIds: ['A']
|
|
45
|
+
});
|
|
46
|
+
(0, _vitest.expect)(newState.licenseOptions.map(o => o.licenseId)).toEqual(['B']);
|
|
47
|
+
});
|
|
48
|
+
(0, _vitest.it)('leaves non-conflicting selections in place', () => {
|
|
49
|
+
const state = makeState({
|
|
50
|
+
licenseOptions: [{
|
|
51
|
+
licenseId: 'A',
|
|
52
|
+
licenseOptions: {}
|
|
53
|
+
}, {
|
|
54
|
+
licenseId: 'C',
|
|
55
|
+
licenseOptions: {}
|
|
56
|
+
}]
|
|
57
|
+
});
|
|
58
|
+
const newState = (0, _reducer.default)(state, {
|
|
59
|
+
type: 'PRECART_SELECT_LICENSE',
|
|
60
|
+
licenseOptionSpec: {
|
|
61
|
+
licenseId: 'B',
|
|
62
|
+
licenseOptions: {}
|
|
63
|
+
},
|
|
64
|
+
excludedLicenseIds: ['A']
|
|
65
|
+
});
|
|
66
|
+
(0, _vitest.expect)(newState.licenseOptions.map(o => o.licenseId).sort()).toEqual(['B', 'C']);
|
|
67
|
+
});
|
|
68
|
+
(0, _vitest.it)('is a no-op when the license is already selected', () => {
|
|
69
|
+
const state = makeState({
|
|
70
|
+
licenseOptions: [{
|
|
71
|
+
licenseId: 'B',
|
|
72
|
+
licenseOptions: {}
|
|
73
|
+
}]
|
|
74
|
+
});
|
|
75
|
+
const newState = (0, _reducer.default)(state, {
|
|
76
|
+
type: 'PRECART_SELECT_LICENSE',
|
|
77
|
+
licenseOptionSpec: {
|
|
78
|
+
licenseId: 'B',
|
|
79
|
+
licenseOptions: {}
|
|
80
|
+
},
|
|
81
|
+
excludedLicenseIds: ['A']
|
|
82
|
+
});
|
|
83
|
+
(0, _vitest.expect)(newState).toBe(state);
|
|
84
|
+
});
|
|
85
|
+
(0, _vitest.it)('handles empty excludedLicenseIds', () => {
|
|
86
|
+
const state = makeState({
|
|
87
|
+
licenseOptions: [{
|
|
88
|
+
licenseId: 'A',
|
|
89
|
+
licenseOptions: {}
|
|
90
|
+
}]
|
|
91
|
+
});
|
|
92
|
+
const newState = (0, _reducer.default)(state, {
|
|
93
|
+
type: 'PRECART_SELECT_LICENSE',
|
|
94
|
+
licenseOptionSpec: {
|
|
95
|
+
licenseId: 'B',
|
|
96
|
+
licenseOptions: {}
|
|
97
|
+
},
|
|
98
|
+
excludedLicenseIds: []
|
|
99
|
+
});
|
|
100
|
+
(0, _vitest.expect)(newState.licenseOptions.map(o => o.licenseId).sort()).toEqual(['A', 'B']);
|
|
101
|
+
});
|
|
102
|
+
(0, _vitest.it)('handles missing excludedLicenseIds (backwards compatibility)', () => {
|
|
103
|
+
const state = makeState({
|
|
104
|
+
licenseOptions: [{
|
|
105
|
+
licenseId: 'A',
|
|
106
|
+
licenseOptions: {}
|
|
107
|
+
}]
|
|
108
|
+
});
|
|
109
|
+
const newState = (0, _reducer.default)(state, {
|
|
110
|
+
type: 'PRECART_SELECT_LICENSE',
|
|
111
|
+
licenseOptionSpec: {
|
|
112
|
+
licenseId: 'B',
|
|
113
|
+
licenseOptions: {}
|
|
114
|
+
}
|
|
115
|
+
});
|
|
116
|
+
(0, _vitest.expect)(newState.licenseOptions.map(o => o.licenseId).sort()).toEqual(['A', 'B']);
|
|
117
|
+
});
|
|
118
|
+
});
|
|
119
|
+
(0, _vitest.describe)('PRECART_TOGGLE_LICENSE auto-deselect', () => {
|
|
120
|
+
(0, _vitest.it)('toggling on a conflicting license drops the conflict', () => {
|
|
121
|
+
const state = makeState({
|
|
122
|
+
licenseOptions: [{
|
|
123
|
+
licenseId: 'A',
|
|
124
|
+
licenseOptions: {}
|
|
125
|
+
}]
|
|
126
|
+
});
|
|
127
|
+
const newState = (0, _reducer.default)(state, {
|
|
128
|
+
type: 'PRECART_TOGGLE_LICENSE',
|
|
129
|
+
licenseId: 'B',
|
|
130
|
+
checked: true,
|
|
131
|
+
licenseOptionSpec: {
|
|
132
|
+
licenseId: 'B',
|
|
133
|
+
licenseOptions: {}
|
|
134
|
+
},
|
|
135
|
+
excludedLicenseIds: ['A']
|
|
136
|
+
});
|
|
137
|
+
(0, _vitest.expect)(newState.licenseOptions.map(o => o.licenseId)).toEqual(['B']);
|
|
138
|
+
});
|
|
139
|
+
(0, _vitest.it)('toggling off does not run auto-deselect', () => {
|
|
140
|
+
const state = makeState({
|
|
141
|
+
licenseOptions: [{
|
|
142
|
+
licenseId: 'A',
|
|
143
|
+
licenseOptions: {}
|
|
144
|
+
}, {
|
|
145
|
+
licenseId: 'B',
|
|
146
|
+
licenseOptions: {}
|
|
147
|
+
}]
|
|
148
|
+
});
|
|
149
|
+
const newState = (0, _reducer.default)(state, {
|
|
150
|
+
type: 'PRECART_TOGGLE_LICENSE',
|
|
151
|
+
licenseId: 'B',
|
|
152
|
+
checked: false,
|
|
153
|
+
licenseOptionSpec: {
|
|
154
|
+
licenseId: 'B',
|
|
155
|
+
licenseOptions: {}
|
|
156
|
+
},
|
|
157
|
+
excludedLicenseIds: ['A']
|
|
158
|
+
});
|
|
159
|
+
(0, _vitest.expect)(newState.licenseOptions.map(o => o.licenseId)).toEqual(['A']);
|
|
160
|
+
});
|
|
161
|
+
});
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { BuyButtonIDQuery } from '../../__generated__/BuyButtonIDQuery.graphql.js';
|
|
3
3
|
import { BuyButtonSlugQuery } from '../../__generated__/BuyButtonSlugQuery.graphql.js';
|
|
4
|
-
import {
|
|
4
|
+
import { SerializablePreloadedQuery } from '../../relay/loadSerializableQuery.js';
|
|
5
5
|
export interface BuyButton_props {
|
|
6
6
|
collectionName?: string;
|
|
7
7
|
label?: string;
|
|
@@ -14,7 +14,7 @@ export type LoadBuyButtonQueryVariables = {
|
|
|
14
14
|
collectionId?: never;
|
|
15
15
|
collectionSlug: string;
|
|
16
16
|
};
|
|
17
|
-
export declare function loadBuyButtonQuery(variables: LoadBuyButtonQueryVariables
|
|
17
|
+
export declare function loadBuyButtonQuery(variables: LoadBuyButtonQueryVariables): Promise<BuyButtonPreloadedQuery>;
|
|
18
18
|
export declare function BuyButtonPreloadedIDQueryRenderer({ preloadedQuery, ...rest }: BuyButton_props & {
|
|
19
19
|
preloadedQuery: SerializablePreloadedQuery<BuyButtonIDQuery>;
|
|
20
20
|
}): React.JSX.Element;
|
|
@@ -57,16 +57,16 @@ function BuyButtonComponent(_ref) {
|
|
|
57
57
|
}
|
|
58
58
|
const idQuery = (_BuyButtonIDQuery.hash && _BuyButtonIDQuery.hash !== "4fbf1dbf9e6c530a5d38c697b174d8b0" && console.error("The definition of 'BuyButtonIDQuery' appears to have changed. Run `relay-compiler` to update the generated files to receive the expected data."), _BuyButtonIDQuery);
|
|
59
59
|
const slugQuery = (_BuyButtonSlugQuery.hash && _BuyButtonSlugQuery.hash !== "6e750adea09698f7cb61f435cd88fd26" && console.error("The definition of 'BuyButtonSlugQuery' appears to have changed. Run `relay-compiler` to update the generated files to receive the expected data."), _BuyButtonSlugQuery);
|
|
60
|
-
export async function loadBuyButtonQuery(variables
|
|
60
|
+
export async function loadBuyButtonQuery(variables) {
|
|
61
61
|
if (variables.collectionId) {
|
|
62
62
|
return loadSerializableQuery(BuyButtonIDQueryNode, {
|
|
63
63
|
collectionId: variables.collectionId
|
|
64
|
-
}
|
|
64
|
+
});
|
|
65
65
|
}
|
|
66
66
|
if (variables.collectionSlug) {
|
|
67
67
|
return loadSerializableQuery(BuyButtonSlugQueryNode, {
|
|
68
68
|
collectionSlug: variables.collectionSlug
|
|
69
|
-
}
|
|
69
|
+
});
|
|
70
70
|
}
|
|
71
71
|
throw new Error('loadBuyButtonQuery expected either a collectionId or collectionSlug');
|
|
72
72
|
}
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { BuyButton_props } from './index.js';
|
|
3
|
+
export type { BuyButtonPreloadedQuery } from './index.js';
|
|
4
|
+
export declare function loadBuyButtonQuery(): never;
|
|
3
5
|
export default function BuyButton({ collectionId, collectionSlug, ...rest }: BuyButton_props & {
|
|
4
6
|
collectionId?: string | null;
|
|
5
7
|
collectionSlug?: string | null;
|
|
@@ -4,6 +4,11 @@ import loadSerializableQuery from '../../relay/loadSerializableQuery.js';
|
|
|
4
4
|
import { BuyButtonPreloadedIDQueryRenderer, BuyButtonPreloadedSlugQueryRenderer } from './index.js';
|
|
5
5
|
import BuyButtonIDQueryNode from '../../__generated__/BuyButtonIDQuery.graphql.js';
|
|
6
6
|
import BuyButtonSlugQueryNode from '../../__generated__/BuyButtonSlugQuery.graphql.js';
|
|
7
|
+
// Stub for the RSC export condition. See FontdueProvider/index.server.tsx
|
|
8
|
+
// for the rationale.
|
|
9
|
+
export function loadBuyButtonQuery() {
|
|
10
|
+
throw new Error("loadBuyButtonQuery isn't needed in React Server Components — " + 'the <BuyButton> server entrypoint awaits its query automatically. ' + 'Drop the manual call.');
|
|
11
|
+
}
|
|
7
12
|
|
|
8
13
|
// Next RSC variant: awaits the query on the server and hands the response to
|
|
9
14
|
// the client `*PreloadedQueryRenderer`. Lets pages just write
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
interface BuyingOptionsProps {
|
|
3
|
+
onPrecartOpen: () => void;
|
|
4
|
+
}
|
|
5
|
+
declare const _default: import("react-redux").ConnectedComponent<({ onPrecartOpen }: BuyingOptionsProps) => React.JSX.Element, {
|
|
6
|
+
context?: React.Context<import("react-redux").ReactReduxContextValue<any, import("redux").UnknownAction> | null> | undefined;
|
|
7
|
+
store?: import("redux").Store | undefined;
|
|
8
|
+
}>;
|
|
9
|
+
export default _default;
|
|
@@ -1,18 +1,8 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { CartButtonQuery } from '../../__generated__/CartButtonQuery.graphql.js';
|
|
3
|
-
import { LoadSerializableQueryOptions, SerializablePreloadedQuery } from '../../relay/loadSerializableQuery.js';
|
|
4
2
|
export interface CartButton_props {
|
|
5
3
|
label?: string;
|
|
6
4
|
buttonStyle?: string;
|
|
7
5
|
children?: React.ReactNode;
|
|
8
6
|
suffix?: string;
|
|
9
7
|
}
|
|
10
|
-
export
|
|
11
|
-
export declare function loadCartButtonQuery(options?: LoadSerializableQueryOptions): Promise<CartButtonPreloadedQuery>;
|
|
12
|
-
export declare function CartButtonPreloadedQueryRenderer({ preloadedQuery, ...rest }: CartButton_props & {
|
|
13
|
-
preloadedQuery: CartButtonPreloadedQuery;
|
|
14
|
-
}): React.JSX.Element;
|
|
15
|
-
export type CartButton_unifiedProps = CartButton_props & {
|
|
16
|
-
preloadedQuery?: CartButtonPreloadedQuery;
|
|
17
|
-
};
|
|
18
|
-
export default function CartButton(props: CartButton_unifiedProps): React.JSX.Element;
|
|
8
|
+
export default function CartButton(props: CartButton_props): React.JSX.Element;
|
|
@@ -5,12 +5,9 @@ import _CartButtonQuery from "../../__generated__/CartButtonQuery.graphql.js";
|
|
|
5
5
|
import _CartButton_order from "../../__generated__/CartButton_order.graphql.js";
|
|
6
6
|
import React, { useEffect, useCallback, useState } from 'react';
|
|
7
7
|
import { useDispatch } from 'react-redux';
|
|
8
|
-
import { graphql, useFragment, useLazyLoadQuery
|
|
9
|
-
import CartButtonQueryNode from '../../__generated__/CartButtonQuery.graphql.js';
|
|
8
|
+
import { graphql, useFragment, useLazyLoadQuery } from 'react-relay';
|
|
10
9
|
import ComponentsContext from '../ComponentsContext.js';
|
|
11
10
|
import { CartNew } from '../Icons/index.js';
|
|
12
|
-
import loadSerializableQuery from '../../relay/loadSerializableQuery.js';
|
|
13
|
-
import useSerializablePreloadedQuery from '../../relay/useSerializablePreloadedQuery.js';
|
|
14
11
|
import Price, { PriceFormat } from '../Price/index.js';
|
|
15
12
|
import { EnsureFontdueContext } from '../FontdueContextProvider/index.js';
|
|
16
13
|
function getOrderCount(order) {
|
|
@@ -91,35 +88,18 @@ function CartButtonComponent(_ref) {
|
|
|
91
88
|
}, suffixNodes))));
|
|
92
89
|
}
|
|
93
90
|
const query = (_CartButtonQuery.hash && _CartButtonQuery.hash !== "5c0da5849bf1215a9d1f264831830f71" && console.error("The definition of 'CartButtonQuery' appears to have changed. Run `relay-compiler` to update the generated files to receive the expected data."), _CartButtonQuery);
|
|
94
|
-
export async function loadCartButtonQuery(options) {
|
|
95
|
-
return loadSerializableQuery(CartButtonQueryNode, {}, options);
|
|
96
|
-
}
|
|
97
|
-
export function CartButtonPreloadedQueryRenderer(_ref2) {
|
|
98
|
-
var _data$viewer;
|
|
99
|
-
let {
|
|
100
|
-
preloadedQuery,
|
|
101
|
-
...rest
|
|
102
|
-
} = _ref2;
|
|
103
|
-
const queryRef = useSerializablePreloadedQuery(preloadedQuery);
|
|
104
|
-
const data = usePreloadedQuery(query, queryRef);
|
|
105
|
-
return /*#__PURE__*/React.createElement(CartButtonComponent, _extends({}, rest, {
|
|
106
|
-
order: ((_data$viewer = data.viewer) === null || _data$viewer === void 0 ? void 0 : _data$viewer.currentOrder) ?? null
|
|
107
|
-
}));
|
|
108
|
-
}
|
|
109
91
|
function CartButtonLazyQueryRenderer(props) {
|
|
110
|
-
var _data$
|
|
92
|
+
var _data$viewer;
|
|
111
93
|
const data = useLazyLoadQuery(query, {});
|
|
112
94
|
return /*#__PURE__*/React.createElement(CartButtonComponent, _extends({}, props, {
|
|
113
|
-
order: ((_data$
|
|
95
|
+
order: ((_data$viewer = data.viewer) === null || _data$viewer === void 0 ? void 0 : _data$viewer.currentOrder) ?? null
|
|
114
96
|
}));
|
|
115
97
|
}
|
|
116
|
-
|
|
117
|
-
//
|
|
118
|
-
//
|
|
119
|
-
//
|
|
120
|
-
//
|
|
98
|
+
|
|
99
|
+
// Cart contents are per-customer-session, so a server-side preload from a
|
|
100
|
+
// CDN-cached SSG/prerender environment (no session cookies) just caches an
|
|
101
|
+
// empty cart and delays the real one. CartButton always lazy-fetches on
|
|
102
|
+
// hydration — same pattern as StoreModal.
|
|
121
103
|
export default function CartButton(props) {
|
|
122
|
-
return /*#__PURE__*/React.createElement(EnsureFontdueContext, null,
|
|
123
|
-
preloadedQuery: props.preloadedQuery
|
|
124
|
-
})) : /*#__PURE__*/React.createElement(CartButtonLazyQueryRenderer, props));
|
|
104
|
+
return /*#__PURE__*/React.createElement(EnsureFontdueContext, null, /*#__PURE__*/React.createElement(CartButtonLazyQueryRenderer, props));
|
|
125
105
|
}
|
|
@@ -1,16 +1,18 @@
|
|
|
1
|
-
|
|
2
|
-
import React from 'react';
|
|
3
|
-
import loadSerializableQuery from '../../relay/loadSerializableQuery.js';
|
|
4
|
-
import { CartButtonPreloadedQueryRenderer } from './index.js';
|
|
5
|
-
import CartButtonQueryNode from '../../__generated__/CartButtonQuery.graphql.js';
|
|
1
|
+
"use strict";
|
|
6
2
|
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = CartButton;
|
|
7
|
+
var _react = _interopRequireDefault(require("react"));
|
|
8
|
+
var _loadSerializableQuery = _interopRequireDefault(require("../../relay/loadSerializableQuery"));
|
|
9
|
+
var _index = require("./index");
|
|
10
|
+
var _CartButtonQuery = _interopRequireDefault(require("../../__generated__/CartButtonQuery.graphql"));
|
|
11
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
12
|
+
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); }
|
|
13
|
+
async function CartButton(props) {
|
|
14
|
+
const preloadedQuery = await (0, _loadSerializableQuery.default)(_CartButtonQuery.default, {});
|
|
15
|
+
return /*#__PURE__*/_react.default.createElement(_index.CartButtonPreloadedQueryRenderer, _extends({
|
|
14
16
|
preloadedQuery: preloadedQuery
|
|
15
17
|
}, props));
|
|
16
18
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import {
|
|
2
|
+
import { SerializablePreloadedQuery } from '../../relay/loadSerializableQuery.js';
|
|
3
3
|
import { CharacterViewerIDQuery } from '../../__generated__/CharacterViewerIDQuery.graphql.js';
|
|
4
4
|
import { CharacterViewerSlugQuery } from '../../__generated__/CharacterViewerSlugQuery.graphql.js';
|
|
5
5
|
export interface CharacterViewer_props {
|
|
@@ -12,7 +12,7 @@ export type LoadCharacterViewerQueryVariables = {
|
|
|
12
12
|
collectionId?: never;
|
|
13
13
|
collectionSlug: string;
|
|
14
14
|
};
|
|
15
|
-
export declare function loadCharacterViewerQuery(variables: LoadCharacterViewerQueryVariables
|
|
15
|
+
export declare function loadCharacterViewerQuery(variables: LoadCharacterViewerQueryVariables): Promise<CharacterViewerPreloadedQuery>;
|
|
16
16
|
export declare function CharacterViewerPreloadedIDQueryRenderer({ preloadedQuery, ...rest }: CharacterViewer_props & {
|
|
17
17
|
preloadedQuery: SerializablePreloadedQuery<CharacterViewerIDQuery>;
|
|
18
18
|
}): React.JSX.Element | null;
|
|
@@ -399,16 +399,16 @@ function CharacterViewerComponent(_ref3) {
|
|
|
399
399
|
}
|
|
400
400
|
const idQuery = (_CharacterViewerIDQuery.hash && _CharacterViewerIDQuery.hash !== "f90b09a4df6d95307b0a5d5fda487cdc" && console.error("The definition of 'CharacterViewerIDQuery' appears to have changed. Run `relay-compiler` to update the generated files to receive the expected data."), _CharacterViewerIDQuery);
|
|
401
401
|
const slugQuery = (_CharacterViewerSlugQuery.hash && _CharacterViewerSlugQuery.hash !== "afa08a8f050e0434308892fea6e3c267" && console.error("The definition of 'CharacterViewerSlugQuery' appears to have changed. Run `relay-compiler` to update the generated files to receive the expected data."), _CharacterViewerSlugQuery);
|
|
402
|
-
export async function loadCharacterViewerQuery(variables
|
|
402
|
+
export async function loadCharacterViewerQuery(variables) {
|
|
403
403
|
if (variables.collectionId) {
|
|
404
404
|
return loadSerializableQuery(CharacterViewerIDQueryNode, {
|
|
405
405
|
collectionId: variables.collectionId
|
|
406
|
-
}
|
|
406
|
+
});
|
|
407
407
|
}
|
|
408
408
|
if (variables.collectionSlug) {
|
|
409
409
|
return loadSerializableQuery(CharacterViewerSlugQueryNode, {
|
|
410
410
|
collectionSlug: variables.collectionSlug
|
|
411
|
-
}
|
|
411
|
+
});
|
|
412
412
|
}
|
|
413
413
|
throw new Error('loadCharacterViewerQuery expected either collectionId or collectionSlug');
|
|
414
414
|
}
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { CharacterViewer_props } from './index.js';
|
|
3
|
+
export type { CharacterViewerPreloadedQuery } from './index.js';
|
|
4
|
+
export declare function loadCharacterViewerQuery(): never;
|
|
3
5
|
export default function CharacterViewer({ collectionId, collectionSlug, ...rest }: CharacterViewer_props & {
|
|
4
6
|
collectionId?: string | null;
|
|
5
7
|
collectionSlug?: string | null;
|
|
@@ -4,6 +4,11 @@ import loadSerializableQuery from '../../relay/loadSerializableQuery.js';
|
|
|
4
4
|
import { CharacterViewerPreloadedIDQueryRenderer, CharacterViewerPreloadedSlugQueryRenderer } from './index.js';
|
|
5
5
|
import CharacterViewerIDQueryNode from '../../__generated__/CharacterViewerIDQuery.graphql.js';
|
|
6
6
|
import CharacterViewerSlugQueryNode from '../../__generated__/CharacterViewerSlugQuery.graphql.js';
|
|
7
|
+
// Stub for the RSC export condition. See FontdueProvider/index.server.tsx
|
|
8
|
+
// for the rationale.
|
|
9
|
+
export function loadCharacterViewerQuery() {
|
|
10
|
+
throw new Error("loadCharacterViewerQuery isn't needed in React Server Components — " + 'the <CharacterViewer> server entrypoint awaits its query automatically. ' + 'Drop the manual call.');
|
|
11
|
+
}
|
|
7
12
|
|
|
8
13
|
// Next RSC variant: awaits the query on the server and hands the response to
|
|
9
14
|
// the client `*PreloadedQueryRenderer`. Lets pages just write
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
interface CookieNotificationProps {
|
|
3
|
+
siteTitle?: string;
|
|
4
|
+
}
|
|
5
|
+
interface CookieNotificationState {
|
|
6
|
+
dismissed: boolean;
|
|
7
|
+
}
|
|
8
|
+
export default class CookieNotification extends React.Component<CookieNotificationProps, CookieNotificationState> {
|
|
9
|
+
constructor(props: CookieNotificationProps);
|
|
10
|
+
dismiss: () => void;
|
|
11
|
+
render(): React.JSX.Element | null;
|
|
12
|
+
}
|
|
13
|
+
export {};
|
|
@@ -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 from 'react';
|
|
3
|
+
// @ts-ignore — `store` package has no published types
|
|
3
4
|
import store from 'store';
|
|
4
5
|
import ComponentsContext from '../ComponentsContext.js';
|
|
5
6
|
const DefaultCookieNotification = _ref => {
|
|
@@ -29,7 +30,7 @@ const DefaultCookieNotification = _ref => {
|
|
|
29
30
|
onClick: onDismiss
|
|
30
31
|
}, "Got it"))));
|
|
31
32
|
};
|
|
32
|
-
|
|
33
|
+
function GetComponent(_ref2) {
|
|
33
34
|
let {
|
|
34
35
|
name,
|
|
35
36
|
fallback,
|
|
@@ -39,7 +40,7 @@ const GetComponent = _ref2 => {
|
|
|
39
40
|
const Component = components[name] || fallback;
|
|
40
41
|
return children(Component);
|
|
41
42
|
});
|
|
42
|
-
}
|
|
43
|
+
}
|
|
43
44
|
const CookieNotificationBase = _ref3 => {
|
|
44
45
|
let {
|
|
45
46
|
siteTitle,
|
|
@@ -48,8 +49,7 @@ const CookieNotificationBase = _ref3 => {
|
|
|
48
49
|
} = _ref3;
|
|
49
50
|
return /*#__PURE__*/React.createElement(GetComponent, {
|
|
50
51
|
name: "CookieNotification",
|
|
51
|
-
fallback: DefaultCookieNotification
|
|
52
|
-
open: open
|
|
52
|
+
fallback: DefaultCookieNotification
|
|
53
53
|
}, Component => /*#__PURE__*/React.createElement(Component, {
|
|
54
54
|
onDismiss: dismiss,
|
|
55
55
|
siteTitle: siteTitle,
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { Store } from 'redux';
|
|
3
|
-
import { Config } from '../ConfigContext
|
|
4
|
-
import { FontdueAction, FontdueState } from '../../reducer
|
|
5
|
-
import { Components } from '../ComponentsContext
|
|
3
|
+
import { Config } from '../ConfigContext';
|
|
4
|
+
import { FontdueAction, FontdueState } from '../../reducer';
|
|
5
|
+
import { Components } from '../ComponentsContext';
|
|
6
6
|
export interface FontdueProvider_props {
|
|
7
7
|
children?: React.ReactNode;
|
|
8
8
|
url?: string;
|
|
@@ -11,6 +11,4 @@ export interface FontdueProvider_props {
|
|
|
11
11
|
components?: Components;
|
|
12
12
|
store?: Store<FontdueState, FontdueAction>;
|
|
13
13
|
}
|
|
14
|
-
export default function FontdueProviderClientComponent({ children, url, stripeIntegration, config, components, store,
|
|
15
|
-
renderAuxUI?: boolean;
|
|
16
|
-
}): React.JSX.Element;
|
|
14
|
+
export default function FontdueProviderClientComponent({ children, url, stripeIntegration, config, components, store, }: FontdueProvider_props): React.JSX.Element;
|