fontdue-js 3.0.0-alpha1 → 3.0.0-alpha3
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/dist/__generated__/FontdueProviderQuery.graphql.d.ts +19 -0
- package/dist/__generated__/FontdueProviderQuery.graphql.js +140 -0
- package/dist/__generated__/ServerConfigProvider_viewer.graphql.d.ts +23 -0
- package/dist/__generated__/ServerConfigProvider_viewer.graphql.js +57 -0
- package/dist/__generated__/TestModeBanner_viewer.graphql.d.ts +19 -0
- package/dist/__generated__/TestModeBanner_viewer.graphql.js +36 -0
- package/dist/__generated__/ThemeConfig_viewer.graphql.d.ts +19 -0
- package/dist/__generated__/ThemeConfig_viewer.graphql.js +36 -0
- package/dist/components/BuyButton/index.d.ts +24 -4
- package/dist/components/BuyButton/index.js +58 -15
- package/dist/components/BuyButton/index.server.d.ts +4 -1
- package/dist/components/BuyButton/index.server.js +5 -0
- package/dist/components/CartButton/index.d.ts +9 -6
- package/dist/components/CartButton/index.js +19 -16
- package/dist/components/CartButton/index.server.js +5 -0
- package/dist/components/CharacterViewer/index.d.ts +26 -6
- package/dist/components/CharacterViewer/index.js +63 -13
- package/dist/components/CharacterViewer/index.server.d.ts +4 -1
- package/dist/components/CharacterViewer/index.server.js +6 -0
- package/dist/components/FontdueContextProvider/index.d.ts +17 -0
- package/dist/components/FontdueContextProvider/index.js +108 -0
- package/dist/components/FontdueContextProvider/index.server.d.ts +4 -0
- package/dist/components/FontdueContextProvider/index.server.js +7 -0
- package/dist/components/FontdueProvider/index.d.ts +9 -3
- package/dist/components/FontdueProvider/index.js +61 -23
- package/dist/components/FontdueProvider/index.server.d.ts +3 -3
- package/dist/components/FontdueProvider/index.server.js +14 -24
- package/dist/components/NewsletterSignup/index.d.ts +9 -6
- package/dist/components/NewsletterSignup/index.js +16 -1
- package/dist/components/NewsletterSignup/index.server.js +5 -0
- package/dist/components/ServerConfigProvider/index.d.ts +3 -1
- package/dist/components/ServerConfigProvider/index.js +7 -6
- package/dist/components/StoreModal/index.js +9 -2
- package/dist/components/TestFontsForm/index.d.ts +8 -3
- package/dist/components/TestFontsForm/index.js +16 -1
- package/dist/components/TestFontsForm/index.server.js +5 -0
- package/dist/components/TestModeBanner/index.d.ts +4 -1
- package/dist/components/TestModeBanner/index.js +9 -17
- package/dist/components/ThemeConfig/index.d.ts +3 -5
- package/dist/components/ThemeConfig/index.js +10 -28
- package/dist/components/TypeTester/TypeTesterStandalone.d.ts +19 -5
- package/dist/components/TypeTester/TypeTesterStandalone.js +21 -2
- package/dist/components/TypeTester/TypeTesterStandalone.preload.js +7 -6
- package/dist/components/TypeTester/TypeTesterStandalone.server.d.ts +4 -2
- package/dist/components/TypeTester/TypeTesterStandalone.server.js +11 -4
- package/dist/components/TypeTesters/index.d.ts +18 -2
- package/dist/components/TypeTesters/index.js +58 -8
- package/dist/components/TypeTesters/index.server.js +5 -0
- package/dist/config.d.ts +2 -1
- package/dist/config.js +17 -6
- package/dist/index.d.ts +2 -2
- package/dist/index.js +1 -1
- package/dist/loadFontdueProviderQuery.d.ts +4 -0
- package/dist/loadFontdueProviderQuery.js +10 -0
- package/dist/relay/environment.js +4 -5
- package/dist/vite.d.ts +2 -1
- package/dist/vite.js +37 -12
- package/package.json +3 -2
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @generated SignedSource<<8a1ab76133c869f1e7c33e1e38525560>>
|
|
3
|
+
* @lightSyntaxTransform
|
|
4
|
+
* @nogrep
|
|
5
|
+
*/
|
|
6
|
+
import { ConcreteRequest } from 'relay-runtime';
|
|
7
|
+
import { FragmentRefs } from "relay-runtime";
|
|
8
|
+
export type FontdueProviderQuery$variables = Record<PropertyKey, never>;
|
|
9
|
+
export type FontdueProviderQuery$data = {
|
|
10
|
+
readonly viewer: {
|
|
11
|
+
readonly " $fragmentSpreads": FragmentRefs<"ServerConfigProvider_viewer" | "TestModeBanner_viewer" | "ThemeConfig_viewer">;
|
|
12
|
+
};
|
|
13
|
+
};
|
|
14
|
+
export type FontdueProviderQuery = {
|
|
15
|
+
response: FontdueProviderQuery$data;
|
|
16
|
+
variables: FontdueProviderQuery$variables;
|
|
17
|
+
};
|
|
18
|
+
declare const node: ConcreteRequest;
|
|
19
|
+
export default node;
|
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @generated SignedSource<<8a1ab76133c869f1e7c33e1e38525560>>
|
|
3
|
+
* @lightSyntaxTransform
|
|
4
|
+
* @nogrep
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
/* tslint:disable */
|
|
8
|
+
/* eslint-disable */
|
|
9
|
+
// @ts-nocheck
|
|
10
|
+
|
|
11
|
+
const node = {
|
|
12
|
+
"fragment": {
|
|
13
|
+
"argumentDefinitions": [],
|
|
14
|
+
"kind": "Fragment",
|
|
15
|
+
"metadata": null,
|
|
16
|
+
"name": "FontdueProviderQuery",
|
|
17
|
+
"selections": [{
|
|
18
|
+
"alias": null,
|
|
19
|
+
"args": null,
|
|
20
|
+
"concreteType": "Viewer",
|
|
21
|
+
"kind": "LinkedField",
|
|
22
|
+
"name": "viewer",
|
|
23
|
+
"plural": false,
|
|
24
|
+
"selections": [{
|
|
25
|
+
"args": null,
|
|
26
|
+
"kind": "FragmentSpread",
|
|
27
|
+
"name": "ThemeConfig_viewer"
|
|
28
|
+
}, {
|
|
29
|
+
"args": null,
|
|
30
|
+
"kind": "FragmentSpread",
|
|
31
|
+
"name": "TestModeBanner_viewer"
|
|
32
|
+
}, {
|
|
33
|
+
"args": null,
|
|
34
|
+
"kind": "FragmentSpread",
|
|
35
|
+
"name": "ServerConfigProvider_viewer"
|
|
36
|
+
}],
|
|
37
|
+
"storageKey": null
|
|
38
|
+
}],
|
|
39
|
+
"type": "RootQueryType",
|
|
40
|
+
"abstractKey": null
|
|
41
|
+
},
|
|
42
|
+
"kind": "Request",
|
|
43
|
+
"operation": {
|
|
44
|
+
"argumentDefinitions": [],
|
|
45
|
+
"kind": "Operation",
|
|
46
|
+
"name": "FontdueProviderQuery",
|
|
47
|
+
"selections": [{
|
|
48
|
+
"alias": null,
|
|
49
|
+
"args": null,
|
|
50
|
+
"concreteType": "Viewer",
|
|
51
|
+
"kind": "LinkedField",
|
|
52
|
+
"name": "viewer",
|
|
53
|
+
"plural": false,
|
|
54
|
+
"selections": [{
|
|
55
|
+
"alias": null,
|
|
56
|
+
"args": null,
|
|
57
|
+
"concreteType": "ThemeConfig",
|
|
58
|
+
"kind": "LinkedField",
|
|
59
|
+
"name": "themeConfig",
|
|
60
|
+
"plural": false,
|
|
61
|
+
"selections": [{
|
|
62
|
+
"alias": null,
|
|
63
|
+
"args": null,
|
|
64
|
+
"kind": "ScalarField",
|
|
65
|
+
"name": "customProperties",
|
|
66
|
+
"storageKey": null
|
|
67
|
+
}],
|
|
68
|
+
"storageKey": null
|
|
69
|
+
}, {
|
|
70
|
+
"alias": null,
|
|
71
|
+
"args": null,
|
|
72
|
+
"concreteType": "TestMode",
|
|
73
|
+
"kind": "LinkedField",
|
|
74
|
+
"name": "testMode",
|
|
75
|
+
"plural": false,
|
|
76
|
+
"selections": [{
|
|
77
|
+
"alias": null,
|
|
78
|
+
"args": null,
|
|
79
|
+
"kind": "ScalarField",
|
|
80
|
+
"name": "isActive",
|
|
81
|
+
"storageKey": null
|
|
82
|
+
}],
|
|
83
|
+
"storageKey": null
|
|
84
|
+
}, {
|
|
85
|
+
"alias": null,
|
|
86
|
+
"args": null,
|
|
87
|
+
"concreteType": "FontdueConfig",
|
|
88
|
+
"kind": "LinkedField",
|
|
89
|
+
"name": "fontdueConfig",
|
|
90
|
+
"plural": false,
|
|
91
|
+
"selections": [{
|
|
92
|
+
"alias": null,
|
|
93
|
+
"args": null,
|
|
94
|
+
"concreteType": "FontdueTrackingConfig",
|
|
95
|
+
"kind": "LinkedField",
|
|
96
|
+
"name": "tracking",
|
|
97
|
+
"plural": false,
|
|
98
|
+
"selections": [{
|
|
99
|
+
"alias": null,
|
|
100
|
+
"args": null,
|
|
101
|
+
"kind": "ScalarField",
|
|
102
|
+
"name": "enabled",
|
|
103
|
+
"storageKey": null
|
|
104
|
+
}, {
|
|
105
|
+
"alias": null,
|
|
106
|
+
"args": null,
|
|
107
|
+
"kind": "ScalarField",
|
|
108
|
+
"name": "consentRequired",
|
|
109
|
+
"storageKey": null
|
|
110
|
+
}, {
|
|
111
|
+
"alias": null,
|
|
112
|
+
"args": null,
|
|
113
|
+
"kind": "ScalarField",
|
|
114
|
+
"name": "consentMessage",
|
|
115
|
+
"storageKey": null
|
|
116
|
+
}],
|
|
117
|
+
"storageKey": null
|
|
118
|
+
}],
|
|
119
|
+
"storageKey": null
|
|
120
|
+
}, {
|
|
121
|
+
"alias": null,
|
|
122
|
+
"args": null,
|
|
123
|
+
"kind": "ScalarField",
|
|
124
|
+
"name": "id",
|
|
125
|
+
"storageKey": null
|
|
126
|
+
}],
|
|
127
|
+
"storageKey": null
|
|
128
|
+
}]
|
|
129
|
+
},
|
|
130
|
+
"params": {
|
|
131
|
+
"cacheID": "8d7caa322aacca72f5aa7fcbef53fd77",
|
|
132
|
+
"id": null,
|
|
133
|
+
"metadata": {},
|
|
134
|
+
"name": "FontdueProviderQuery",
|
|
135
|
+
"operationKind": "query",
|
|
136
|
+
"text": "query FontdueProviderQuery {\n viewer {\n ...ThemeConfig_viewer\n ...TestModeBanner_viewer\n ...ServerConfigProvider_viewer\n id\n }\n}\n\nfragment ServerConfigProvider_viewer on Viewer {\n fontdueConfig {\n tracking {\n enabled\n consentRequired\n consentMessage\n }\n }\n}\n\nfragment TestModeBanner_viewer on Viewer {\n testMode {\n isActive\n }\n}\n\nfragment ThemeConfig_viewer on Viewer {\n themeConfig {\n customProperties\n }\n}\n"
|
|
137
|
+
}
|
|
138
|
+
};
|
|
139
|
+
node.hash = "5cbd582990daa28a99839c20abbc8bda";
|
|
140
|
+
export default node;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @generated SignedSource<<a83ac66ca93de8f6c51ac4c192aec8b4>>
|
|
3
|
+
* @lightSyntaxTransform
|
|
4
|
+
* @nogrep
|
|
5
|
+
*/
|
|
6
|
+
import { ReaderFragment } from 'relay-runtime';
|
|
7
|
+
import { FragmentRefs } from "relay-runtime";
|
|
8
|
+
export type ServerConfigProvider_viewer$data = {
|
|
9
|
+
readonly fontdueConfig: {
|
|
10
|
+
readonly tracking: {
|
|
11
|
+
readonly consentMessage: string | null;
|
|
12
|
+
readonly consentRequired: boolean;
|
|
13
|
+
readonly enabled: boolean;
|
|
14
|
+
} | null;
|
|
15
|
+
} | null;
|
|
16
|
+
readonly " $fragmentType": "ServerConfigProvider_viewer";
|
|
17
|
+
};
|
|
18
|
+
export type ServerConfigProvider_viewer$key = {
|
|
19
|
+
readonly " $data"?: ServerConfigProvider_viewer$data;
|
|
20
|
+
readonly " $fragmentSpreads": FragmentRefs<"ServerConfigProvider_viewer">;
|
|
21
|
+
};
|
|
22
|
+
declare const node: ReaderFragment;
|
|
23
|
+
export default node;
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @generated SignedSource<<a83ac66ca93de8f6c51ac4c192aec8b4>>
|
|
3
|
+
* @lightSyntaxTransform
|
|
4
|
+
* @nogrep
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
/* tslint:disable */
|
|
8
|
+
/* eslint-disable */
|
|
9
|
+
// @ts-nocheck
|
|
10
|
+
|
|
11
|
+
const node = {
|
|
12
|
+
"argumentDefinitions": [],
|
|
13
|
+
"kind": "Fragment",
|
|
14
|
+
"metadata": null,
|
|
15
|
+
"name": "ServerConfigProvider_viewer",
|
|
16
|
+
"selections": [{
|
|
17
|
+
"alias": null,
|
|
18
|
+
"args": null,
|
|
19
|
+
"concreteType": "FontdueConfig",
|
|
20
|
+
"kind": "LinkedField",
|
|
21
|
+
"name": "fontdueConfig",
|
|
22
|
+
"plural": false,
|
|
23
|
+
"selections": [{
|
|
24
|
+
"alias": null,
|
|
25
|
+
"args": null,
|
|
26
|
+
"concreteType": "FontdueTrackingConfig",
|
|
27
|
+
"kind": "LinkedField",
|
|
28
|
+
"name": "tracking",
|
|
29
|
+
"plural": false,
|
|
30
|
+
"selections": [{
|
|
31
|
+
"alias": null,
|
|
32
|
+
"args": null,
|
|
33
|
+
"kind": "ScalarField",
|
|
34
|
+
"name": "enabled",
|
|
35
|
+
"storageKey": null
|
|
36
|
+
}, {
|
|
37
|
+
"alias": null,
|
|
38
|
+
"args": null,
|
|
39
|
+
"kind": "ScalarField",
|
|
40
|
+
"name": "consentRequired",
|
|
41
|
+
"storageKey": null
|
|
42
|
+
}, {
|
|
43
|
+
"alias": null,
|
|
44
|
+
"args": null,
|
|
45
|
+
"kind": "ScalarField",
|
|
46
|
+
"name": "consentMessage",
|
|
47
|
+
"storageKey": null
|
|
48
|
+
}],
|
|
49
|
+
"storageKey": null
|
|
50
|
+
}],
|
|
51
|
+
"storageKey": null
|
|
52
|
+
}],
|
|
53
|
+
"type": "Viewer",
|
|
54
|
+
"abstractKey": null
|
|
55
|
+
};
|
|
56
|
+
node.hash = "6afcb0c3813a418a470e48415f963064";
|
|
57
|
+
export default node;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @generated SignedSource<<e9ace1097ef31e2ed34190d2a31634be>>
|
|
3
|
+
* @lightSyntaxTransform
|
|
4
|
+
* @nogrep
|
|
5
|
+
*/
|
|
6
|
+
import { ReaderFragment } from 'relay-runtime';
|
|
7
|
+
import { FragmentRefs } from "relay-runtime";
|
|
8
|
+
export type TestModeBanner_viewer$data = {
|
|
9
|
+
readonly testMode: {
|
|
10
|
+
readonly isActive: boolean;
|
|
11
|
+
};
|
|
12
|
+
readonly " $fragmentType": "TestModeBanner_viewer";
|
|
13
|
+
};
|
|
14
|
+
export type TestModeBanner_viewer$key = {
|
|
15
|
+
readonly " $data"?: TestModeBanner_viewer$data;
|
|
16
|
+
readonly " $fragmentSpreads": FragmentRefs<"TestModeBanner_viewer">;
|
|
17
|
+
};
|
|
18
|
+
declare const node: ReaderFragment;
|
|
19
|
+
export default node;
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @generated SignedSource<<e9ace1097ef31e2ed34190d2a31634be>>
|
|
3
|
+
* @lightSyntaxTransform
|
|
4
|
+
* @nogrep
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
/* tslint:disable */
|
|
8
|
+
/* eslint-disable */
|
|
9
|
+
// @ts-nocheck
|
|
10
|
+
|
|
11
|
+
const node = {
|
|
12
|
+
"argumentDefinitions": [],
|
|
13
|
+
"kind": "Fragment",
|
|
14
|
+
"metadata": null,
|
|
15
|
+
"name": "TestModeBanner_viewer",
|
|
16
|
+
"selections": [{
|
|
17
|
+
"alias": null,
|
|
18
|
+
"args": null,
|
|
19
|
+
"concreteType": "TestMode",
|
|
20
|
+
"kind": "LinkedField",
|
|
21
|
+
"name": "testMode",
|
|
22
|
+
"plural": false,
|
|
23
|
+
"selections": [{
|
|
24
|
+
"alias": null,
|
|
25
|
+
"args": null,
|
|
26
|
+
"kind": "ScalarField",
|
|
27
|
+
"name": "isActive",
|
|
28
|
+
"storageKey": null
|
|
29
|
+
}],
|
|
30
|
+
"storageKey": null
|
|
31
|
+
}],
|
|
32
|
+
"type": "Viewer",
|
|
33
|
+
"abstractKey": null
|
|
34
|
+
};
|
|
35
|
+
node.hash = "f6b2f851466be9599d63ebf8f39e1a96";
|
|
36
|
+
export default node;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @generated SignedSource<<9eff3b1fe04abdb52e7380c1158bdb71>>
|
|
3
|
+
* @lightSyntaxTransform
|
|
4
|
+
* @nogrep
|
|
5
|
+
*/
|
|
6
|
+
import { ReaderFragment } from 'relay-runtime';
|
|
7
|
+
import { FragmentRefs } from "relay-runtime";
|
|
8
|
+
export type ThemeConfig_viewer$data = {
|
|
9
|
+
readonly themeConfig: {
|
|
10
|
+
readonly customProperties: ReadonlyArray<string> | null;
|
|
11
|
+
} | null;
|
|
12
|
+
readonly " $fragmentType": "ThemeConfig_viewer";
|
|
13
|
+
};
|
|
14
|
+
export type ThemeConfig_viewer$key = {
|
|
15
|
+
readonly " $data"?: ThemeConfig_viewer$data;
|
|
16
|
+
readonly " $fragmentSpreads": FragmentRefs<"ThemeConfig_viewer">;
|
|
17
|
+
};
|
|
18
|
+
declare const node: ReaderFragment;
|
|
19
|
+
export default node;
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @generated SignedSource<<9eff3b1fe04abdb52e7380c1158bdb71>>
|
|
3
|
+
* @lightSyntaxTransform
|
|
4
|
+
* @nogrep
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
/* tslint:disable */
|
|
8
|
+
/* eslint-disable */
|
|
9
|
+
// @ts-nocheck
|
|
10
|
+
|
|
11
|
+
const node = {
|
|
12
|
+
"argumentDefinitions": [],
|
|
13
|
+
"kind": "Fragment",
|
|
14
|
+
"metadata": null,
|
|
15
|
+
"name": "ThemeConfig_viewer",
|
|
16
|
+
"selections": [{
|
|
17
|
+
"alias": null,
|
|
18
|
+
"args": null,
|
|
19
|
+
"concreteType": "ThemeConfig",
|
|
20
|
+
"kind": "LinkedField",
|
|
21
|
+
"name": "themeConfig",
|
|
22
|
+
"plural": false,
|
|
23
|
+
"selections": [{
|
|
24
|
+
"alias": null,
|
|
25
|
+
"args": null,
|
|
26
|
+
"kind": "ScalarField",
|
|
27
|
+
"name": "customProperties",
|
|
28
|
+
"storageKey": null
|
|
29
|
+
}],
|
|
30
|
+
"storageKey": null
|
|
31
|
+
}],
|
|
32
|
+
"type": "Viewer",
|
|
33
|
+
"abstractKey": null
|
|
34
|
+
};
|
|
35
|
+
node.hash = "191db4fda0651cd596efa7f91699f895";
|
|
36
|
+
export default node;
|
|
@@ -1,17 +1,37 @@
|
|
|
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 { SerializablePreloadedQuery } from '../../relay/loadSerializableQuery.js';
|
|
4
|
+
import { LoadSerializableQueryOptions, SerializablePreloadedQuery } from '../../relay/loadSerializableQuery.js';
|
|
5
5
|
export interface BuyButton_props {
|
|
6
|
-
collectionId?: string | null;
|
|
7
|
-
collectionSlug?: string | null;
|
|
8
6
|
collectionName?: string;
|
|
9
7
|
label?: string;
|
|
10
8
|
}
|
|
9
|
+
export type BuyButtonPreloadedQuery = SerializablePreloadedQuery<BuyButtonIDQuery> | SerializablePreloadedQuery<BuyButtonSlugQuery>;
|
|
10
|
+
export type LoadBuyButtonQueryVariables = {
|
|
11
|
+
collectionId: string;
|
|
12
|
+
collectionSlug?: never;
|
|
13
|
+
} | {
|
|
14
|
+
collectionId?: never;
|
|
15
|
+
collectionSlug: string;
|
|
16
|
+
};
|
|
17
|
+
export declare function loadBuyButtonQuery(variables: LoadBuyButtonQueryVariables, options?: LoadSerializableQueryOptions): Promise<BuyButtonPreloadedQuery>;
|
|
11
18
|
export declare function BuyButtonPreloadedIDQueryRenderer({ preloadedQuery, ...rest }: BuyButton_props & {
|
|
12
19
|
preloadedQuery: SerializablePreloadedQuery<BuyButtonIDQuery>;
|
|
13
20
|
}): React.JSX.Element;
|
|
14
21
|
export declare function BuyButtonPreloadedSlugQueryRenderer({ preloadedQuery, ...rest }: BuyButton_props & {
|
|
15
22
|
preloadedQuery: SerializablePreloadedQuery<BuyButtonSlugQuery>;
|
|
16
23
|
}): React.JSX.Element;
|
|
17
|
-
export
|
|
24
|
+
export type BuyButton_unifiedProps = BuyButton_props & ({
|
|
25
|
+
preloadedQuery: BuyButtonPreloadedQuery;
|
|
26
|
+
collectionId?: never;
|
|
27
|
+
collectionSlug?: never;
|
|
28
|
+
} | {
|
|
29
|
+
preloadedQuery?: never;
|
|
30
|
+
collectionId: string;
|
|
31
|
+
collectionSlug?: never;
|
|
32
|
+
} | {
|
|
33
|
+
preloadedQuery?: never;
|
|
34
|
+
collectionId?: never;
|
|
35
|
+
collectionSlug: string;
|
|
36
|
+
});
|
|
37
|
+
export default function BuyButton(props: BuyButton_unifiedProps): React.JSX.Element;
|
|
@@ -9,7 +9,11 @@ import { graphql, useRelayEnvironment, useLazyLoadQuery, useFragment, usePreload
|
|
|
9
9
|
import { useDispatch, useStore } from 'react-redux';
|
|
10
10
|
import ComponentsContext from '../ComponentsContext.js';
|
|
11
11
|
import { populateProductState } from '../Root/productState.js';
|
|
12
|
+
import BuyButtonIDQueryNode from '../../__generated__/BuyButtonIDQuery.graphql.js';
|
|
13
|
+
import BuyButtonSlugQueryNode from '../../__generated__/BuyButtonSlugQuery.graphql.js';
|
|
14
|
+
import loadSerializableQuery from '../../relay/loadSerializableQuery.js';
|
|
12
15
|
import useSerializablePreloadedQuery from '../../relay/useSerializablePreloadedQuery.js';
|
|
16
|
+
import { EnsureFontdueContext } from '../FontdueContextProvider/index.js';
|
|
13
17
|
function BuyButtonComponent(_ref) {
|
|
14
18
|
let {
|
|
15
19
|
collection: collectionKey,
|
|
@@ -36,9 +40,6 @@ function BuyButtonComponent(_ref) {
|
|
|
36
40
|
}, [dispatch, collection]);
|
|
37
41
|
useEffect(() => {
|
|
38
42
|
if (!collection) return;
|
|
39
|
-
// populate as soon as BuyButton mounts. this prepares the StoreModal
|
|
40
|
-
// to be able to apply discounts as soon as the user clicks "BUY" on
|
|
41
|
-
// a style. (this is necessary if the bundle price is <= single style price)
|
|
42
43
|
populateProductState(store, environment, collection.id);
|
|
43
44
|
}, [collection === null || collection === void 0 ? void 0 : collection.id]);
|
|
44
45
|
if (components.BuyButton) {
|
|
@@ -55,6 +56,20 @@ function BuyButtonComponent(_ref) {
|
|
|
55
56
|
}, label ? label : `Buy ${collectionName ?? ''}`);
|
|
56
57
|
}
|
|
57
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
|
+
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, options) {
|
|
61
|
+
if (variables.collectionId) {
|
|
62
|
+
return loadSerializableQuery(BuyButtonIDQueryNode, {
|
|
63
|
+
collectionId: variables.collectionId
|
|
64
|
+
}, options);
|
|
65
|
+
}
|
|
66
|
+
if (variables.collectionSlug) {
|
|
67
|
+
return loadSerializableQuery(BuyButtonSlugQueryNode, {
|
|
68
|
+
collectionSlug: variables.collectionSlug
|
|
69
|
+
}, options);
|
|
70
|
+
}
|
|
71
|
+
throw new Error('loadBuyButtonQuery expected either a collectionId or collectionSlug');
|
|
72
|
+
}
|
|
58
73
|
function BuyButtonIDQueryRenderer(_ref2) {
|
|
59
74
|
let {
|
|
60
75
|
collectionId,
|
|
@@ -74,7 +89,6 @@ export function BuyButtonPreloadedIDQueryRenderer(_ref3) {
|
|
|
74
89
|
const data = usePreloadedQuery(idQuery, queryRef);
|
|
75
90
|
return /*#__PURE__*/React.createElement(BuyButtonComponent, _extends({}, rest, data));
|
|
76
91
|
}
|
|
77
|
-
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);
|
|
78
92
|
function BuyButtonSlugQueryRenderer(_ref4) {
|
|
79
93
|
var _data$viewer, _data$viewer$slug;
|
|
80
94
|
let {
|
|
@@ -100,23 +114,52 @@ export function BuyButtonPreloadedSlugQueryRenderer(_ref5) {
|
|
|
100
114
|
collection: ((_data$viewer2 = data.viewer) === null || _data$viewer2 === void 0 ? void 0 : (_data$viewer2$slug = _data$viewer2.slug) === null || _data$viewer2$slug === void 0 ? void 0 : _data$viewer2$slug.collection) ?? null
|
|
101
115
|
}));
|
|
102
116
|
}
|
|
103
|
-
|
|
104
|
-
// default client export
|
|
105
|
-
export default function BuyButton(_ref6) {
|
|
117
|
+
function BuyButtonPreloadedRenderer(_ref6) {
|
|
106
118
|
let {
|
|
107
|
-
|
|
108
|
-
collectionSlug,
|
|
119
|
+
preloadedQuery,
|
|
109
120
|
...rest
|
|
110
121
|
} = _ref6;
|
|
111
|
-
if (
|
|
112
|
-
return /*#__PURE__*/React.createElement(
|
|
113
|
-
|
|
122
|
+
if (preloadedQuery.params.name === 'BuyButtonIDQuery') {
|
|
123
|
+
return /*#__PURE__*/React.createElement(BuyButtonPreloadedIDQueryRenderer, _extends({
|
|
124
|
+
preloadedQuery: preloadedQuery
|
|
114
125
|
}, rest));
|
|
115
126
|
}
|
|
116
|
-
|
|
117
|
-
|
|
127
|
+
return /*#__PURE__*/React.createElement(BuyButtonPreloadedSlugQueryRenderer, _extends({
|
|
128
|
+
preloadedQuery: preloadedQuery
|
|
129
|
+
}, rest));
|
|
130
|
+
}
|
|
131
|
+
// Unified BuyButton entry. Accepts a preloaded query (server-side preload
|
|
132
|
+
// path) or `{collectionId}`/`{collectionSlug}` for lazy fetch.
|
|
133
|
+
// `EnsureFontdueContext` only self-wraps with `FontdueContextProvider` when
|
|
134
|
+
// no parent Fontdue context is present.
|
|
135
|
+
export default function BuyButton(props) {
|
|
136
|
+
let inner;
|
|
137
|
+
if ('preloadedQuery' in props && props.preloadedQuery) {
|
|
138
|
+
const {
|
|
139
|
+
preloadedQuery,
|
|
140
|
+
...rest
|
|
141
|
+
} = props;
|
|
142
|
+
inner = /*#__PURE__*/React.createElement(BuyButtonPreloadedRenderer, _extends({
|
|
143
|
+
preloadedQuery: preloadedQuery
|
|
144
|
+
}, rest));
|
|
145
|
+
} else if ('collectionId' in props && props.collectionId) {
|
|
146
|
+
const {
|
|
147
|
+
collectionId,
|
|
148
|
+
...rest
|
|
149
|
+
} = props;
|
|
150
|
+
inner = /*#__PURE__*/React.createElement(BuyButtonIDQueryRenderer, _extends({
|
|
151
|
+
collectionId: collectionId
|
|
152
|
+
}, rest));
|
|
153
|
+
} else if ('collectionSlug' in props && props.collectionSlug) {
|
|
154
|
+
const {
|
|
155
|
+
collectionSlug,
|
|
156
|
+
...rest
|
|
157
|
+
} = props;
|
|
158
|
+
inner = /*#__PURE__*/React.createElement(BuyButtonSlugQueryRenderer, _extends({
|
|
118
159
|
collectionSlug: collectionSlug
|
|
119
160
|
}, rest));
|
|
161
|
+
} else {
|
|
162
|
+
throw new Error('BuyButton expected one of preloadedQuery, collectionId, or collectionSlug');
|
|
120
163
|
}
|
|
121
|
-
|
|
164
|
+
return /*#__PURE__*/React.createElement(EnsureFontdueContext, null, inner);
|
|
122
165
|
}
|
|
@@ -1,3 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { BuyButton_props } from './index.js';
|
|
3
|
-
export default function BuyButton({ collectionId, collectionSlug, ...rest }: BuyButton_props
|
|
3
|
+
export default function BuyButton({ collectionId, collectionSlug, ...rest }: BuyButton_props & {
|
|
4
|
+
collectionId?: string | null;
|
|
5
|
+
collectionSlug?: string | null;
|
|
6
|
+
}): Promise<React.JSX.Element | 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
|
+
|
|
8
|
+
// Next RSC variant: awaits the query on the server and hands the response to
|
|
9
|
+
// the client `*PreloadedQueryRenderer`. Lets pages just write
|
|
10
|
+
// `<BuyButton collectionId={id} />` in an RSC without manually invoking
|
|
11
|
+
// `loadBuyButtonQuery` + threading `preloadedQuery` through props.
|
|
7
12
|
export default async function BuyButton(_ref) {
|
|
8
13
|
let {
|
|
9
14
|
collectionId,
|
|
@@ -1,15 +1,18 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { CartButtonQuery } from '__generated__/CartButtonQuery.graphql.js';
|
|
3
|
-
import { SerializablePreloadedQuery } from '../../relay/loadSerializableQuery.js';
|
|
2
|
+
import { CartButtonQuery } from '../../__generated__/CartButtonQuery.graphql.js';
|
|
3
|
+
import { LoadSerializableQueryOptions, SerializablePreloadedQuery } from '../../relay/loadSerializableQuery.js';
|
|
4
4
|
export interface CartButton_props {
|
|
5
5
|
label?: string;
|
|
6
6
|
buttonStyle?: string;
|
|
7
7
|
children?: React.ReactNode;
|
|
8
8
|
suffix?: string;
|
|
9
9
|
}
|
|
10
|
-
type
|
|
10
|
+
export type CartButtonPreloadedQuery = SerializablePreloadedQuery<CartButtonQuery>;
|
|
11
|
+
export declare function loadCartButtonQuery(options?: LoadSerializableQueryOptions): Promise<CartButtonPreloadedQuery>;
|
|
11
12
|
export declare function CartButtonPreloadedQueryRenderer({ preloadedQuery, ...rest }: CartButton_props & {
|
|
12
|
-
preloadedQuery:
|
|
13
|
+
preloadedQuery: CartButtonPreloadedQuery;
|
|
13
14
|
}): React.JSX.Element;
|
|
14
|
-
export
|
|
15
|
-
|
|
15
|
+
export type CartButton_unifiedProps = CartButton_props & {
|
|
16
|
+
preloadedQuery?: CartButtonPreloadedQuery;
|
|
17
|
+
};
|
|
18
|
+
export default function CartButton(props: CartButton_unifiedProps): React.JSX.Element;
|
|
@@ -6,10 +6,13 @@ 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
8
|
import { graphql, useFragment, useLazyLoadQuery, usePreloadedQuery } from 'react-relay';
|
|
9
|
+
import CartButtonQueryNode from '../../__generated__/CartButtonQuery.graphql.js';
|
|
9
10
|
import ComponentsContext from '../ComponentsContext.js';
|
|
10
11
|
import { CartNew } from '../Icons/index.js';
|
|
12
|
+
import loadSerializableQuery from '../../relay/loadSerializableQuery.js';
|
|
11
13
|
import useSerializablePreloadedQuery from '../../relay/useSerializablePreloadedQuery.js';
|
|
12
14
|
import Price, { PriceFormat } from '../Price/index.js';
|
|
15
|
+
import { EnsureFontdueContext } from '../FontdueContextProvider/index.js';
|
|
13
16
|
function getOrderCount(order) {
|
|
14
17
|
return order.orderItems ? order.orderItems.length : 0;
|
|
15
18
|
}
|
|
@@ -33,22 +36,12 @@ function CartButtonComponent(_ref) {
|
|
|
33
36
|
const dispatch = useDispatch();
|
|
34
37
|
const formatSuffix = useCallback(() => {
|
|
35
38
|
if (!suffix) return null;
|
|
36
|
-
|
|
37
|
-
// Check if the suffix contains any substitutions
|
|
38
39
|
const hasSubstitutions = /\{(count|subtotal)\}/.test(suffix);
|
|
39
|
-
|
|
40
|
-
// Hide if there are substitutions and cart is empty
|
|
41
40
|
if (hasSubstitutions && count === 0) return null;
|
|
42
|
-
|
|
43
|
-
// Split into parts: ['text', '{placeholder}', 'text', '{placeholder}', 'text']
|
|
44
41
|
const parts = suffix.split(/(\{[^}]+\})/);
|
|
45
|
-
|
|
46
|
-
// Transform each part based on whether it's a placeholder or text
|
|
47
42
|
const nodes = parts.map((part, index) => {
|
|
48
43
|
const match = part.match(/^\{([^}]+)\}$/);
|
|
49
|
-
if (!match) return part || null;
|
|
50
|
-
|
|
51
|
-
// Handle placeholder
|
|
44
|
+
if (!match) return part || null;
|
|
52
45
|
const placeholder = match[1];
|
|
53
46
|
switch (placeholder) {
|
|
54
47
|
case 'count':
|
|
@@ -61,10 +54,8 @@ function CartButtonComponent(_ref) {
|
|
|
61
54
|
}) : null;
|
|
62
55
|
default:
|
|
63
56
|
return part;
|
|
64
|
-
// Keep unknown placeholders as-is
|
|
65
57
|
}
|
|
66
|
-
}).filter(Boolean);
|
|
67
|
-
|
|
58
|
+
}).filter(Boolean);
|
|
68
59
|
return nodes.length > 0 ? nodes : null;
|
|
69
60
|
}, [suffix, count, orderData === null || orderData === void 0 ? void 0 : orderData.subtotal]);
|
|
70
61
|
const handleClick = useCallback(() => {
|
|
@@ -77,7 +68,6 @@ function CartButtonComponent(_ref) {
|
|
|
77
68
|
dispatch(openCart());
|
|
78
69
|
}, [count, dispatch]);
|
|
79
70
|
useEffect(() => {
|
|
80
|
-
// set count only on the client, because on the server it's always gonna be zero
|
|
81
71
|
setCount(cartButtonCount(orderData));
|
|
82
72
|
}, [orderData, setCount]);
|
|
83
73
|
if (!orderData) return null;
|
|
@@ -101,6 +91,9 @@ function CartButtonComponent(_ref) {
|
|
|
101
91
|
}, suffixNodes))));
|
|
102
92
|
}
|
|
103
93
|
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
|
+
}
|
|
104
97
|
export function CartButtonPreloadedQueryRenderer(_ref2) {
|
|
105
98
|
var _data$viewer;
|
|
106
99
|
let {
|
|
@@ -113,10 +106,20 @@ export function CartButtonPreloadedQueryRenderer(_ref2) {
|
|
|
113
106
|
order: ((_data$viewer = data.viewer) === null || _data$viewer === void 0 ? void 0 : _data$viewer.currentOrder) ?? null
|
|
114
107
|
}));
|
|
115
108
|
}
|
|
116
|
-
|
|
109
|
+
function CartButtonLazyQueryRenderer(props) {
|
|
117
110
|
var _data$viewer2;
|
|
118
111
|
const data = useLazyLoadQuery(query, {});
|
|
119
112
|
return /*#__PURE__*/React.createElement(CartButtonComponent, _extends({}, props, {
|
|
120
113
|
order: ((_data$viewer2 = data.viewer) === null || _data$viewer2 === void 0 ? void 0 : _data$viewer2.currentOrder) ?? null
|
|
121
114
|
}));
|
|
115
|
+
}
|
|
116
|
+
// Unified CartButton entry. Accepts an optional preloaded query (server-side
|
|
117
|
+
// preload path) or fetches lazily on mount. `EnsureFontdueContext` self-wraps
|
|
118
|
+
// with `FontdueContextProvider` only when no parent Fontdue context is
|
|
119
|
+
// present, so the same component works as a standalone island or inside an
|
|
120
|
+
// outer `<FontdueProvider>` tree.
|
|
121
|
+
export default function CartButton(props) {
|
|
122
|
+
return /*#__PURE__*/React.createElement(EnsureFontdueContext, null, props.preloadedQuery ? /*#__PURE__*/React.createElement(CartButtonPreloadedQueryRenderer, _extends({}, props, {
|
|
123
|
+
preloadedQuery: props.preloadedQuery
|
|
124
|
+
})) : /*#__PURE__*/React.createElement(CartButtonLazyQueryRenderer, props));
|
|
122
125
|
}
|
|
@@ -3,6 +3,11 @@ import React from 'react';
|
|
|
3
3
|
import loadSerializableQuery from '../../relay/loadSerializableQuery.js';
|
|
4
4
|
import { CartButtonPreloadedQueryRenderer } from './index.js';
|
|
5
5
|
import CartButtonQueryNode from '../../__generated__/CartButtonQuery.graphql.js';
|
|
6
|
+
|
|
7
|
+
// Next RSC variant: awaits the query on the server and hands the response to
|
|
8
|
+
// the client `CartButtonPreloadedQueryRenderer`. Lets pages just write
|
|
9
|
+
// `<CartButton />` in an RSC without manually invoking
|
|
10
|
+
// `loadCartButtonQuery` + threading `preloadedQuery` through props.
|
|
6
11
|
export default async function CartButton(props) {
|
|
7
12
|
const preloadedQuery = await loadSerializableQuery(CartButtonQueryNode, {});
|
|
8
13
|
return /*#__PURE__*/React.createElement(CartButtonPreloadedQueryRenderer, _extends({
|