@growth-labs/store 0.2.3 → 0.3.1
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/index.d.ts +10 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +10 -0
- package/dist/index.js.map +1 -1
- package/dist/options.d.ts +75 -0
- package/dist/options.d.ts.map +1 -1
- package/dist/options.js +47 -0
- package/dist/options.js.map +1 -1
- package/dist/products.d.ts +25 -0
- package/dist/products.d.ts.map +1 -0
- package/dist/products.js +38 -0
- package/dist/products.js.map +1 -0
- package/package.json +1 -1
- package/src/components/StoreCartPage.astro +3 -0
- package/src/components/StoreIndexPage.astro +3 -0
- package/src/components/StoreLegalFooter.astro +50 -0
- package/src/components/StoreProductPage.astro +31 -0
- package/src/index.ts +10 -0
- package/src/options.ts +49 -0
- package/src/products.ts +41 -0
package/dist/index.d.ts
CHANGED
|
@@ -18,6 +18,7 @@ export type { ResolvedStoreOptions, StoreOptions } from './options.js';
|
|
|
18
18
|
export { storeOptionsSchema } from './options.js';
|
|
19
19
|
export type { OrderTelemetryOptions } from './orders.js';
|
|
20
20
|
export { buildStoreOrderWAEDataPoint, createD1OrderHandler } from './orders.js';
|
|
21
|
+
export { resolveStoreProduct } from './products.js';
|
|
21
22
|
/**
|
|
22
23
|
* `getConfig`/`getConfigOrNull` resolve this site's fully-parsed `StoreOptions`
|
|
23
24
|
* at runtime — the same mechanism `.astro` page components use internally
|
|
@@ -30,6 +31,15 @@ export { buildStoreOrderWAEDataPoint, createD1OrderHandler } from './orders.js';
|
|
|
30
31
|
*/
|
|
31
32
|
export { getConfig, getConfigOrNull } from './state.js';
|
|
32
33
|
export type * from './types.js';
|
|
34
|
+
/**
|
|
35
|
+
* Real runtime export, not just a type — sites need `instanceof
|
|
36
|
+
* FourthwallError` to distinguish "not found" from other failures in their
|
|
37
|
+
* own pre-checks (see `resolveStoreProduct`). Previously only reachable via
|
|
38
|
+
* `export type * from './types.js'` below, which strips it at compile time;
|
|
39
|
+
* a site working around that by duck-typing `.name`/`.status` was the sign
|
|
40
|
+
* this was missing (found during the channel-store-recovery B3 rollout).
|
|
41
|
+
*/
|
|
42
|
+
export { FourthwallError } from './types.js';
|
|
33
43
|
export type { MerchantReturnPolicy, StoreVariantClientData } from './variant.js';
|
|
34
44
|
export { buildStoreProductJsonLd, buildStoreVariantClientData, createStoreAddToCartAvailabilityState, isStoreVariantAvailable, normalizeStoreVariantSku, selectStoreVariant, } from './variant.js';
|
|
35
45
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,OAAO,CAAA;AAE7C,OAAO,EAAE,KAAK,YAAY,EAAsB,MAAM,cAAc,CAAA;AAepE,MAAM,CAAC,OAAO,UAAU,KAAK,CAAC,WAAW,EAAE,YAAY,GAAG,gBAAgB,CAyCzE;AAED,YAAY,EAAE,WAAW,EAAE,kBAAkB,EAAE,UAAU,EAAE,MAAM,UAAU,CAAA;AAC3E,OAAO,EAAE,2BAA2B,EAAE,mBAAmB,EAAE,qBAAqB,EAAE,MAAM,UAAU,CAAA;AAClG,YAAY,EAAE,sBAAsB,EAAE,4BAA4B,EAAE,MAAM,mBAAmB,CAAA;AAC7F,OAAO,EAAE,6BAA6B,EAAE,MAAM,mBAAmB,CAAA;AACjE,OAAO,EAAE,aAAa,EAAE,UAAU,EAAE,oBAAoB,EAAE,iBAAiB,EAAE,MAAM,YAAY,CAAA;AAC/F,OAAO,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAA;AACpD,YAAY,EAAE,gBAAgB,EAAE,sBAAsB,EAAE,MAAM,aAAa,CAAA;AAC3E,OAAO,EAAE,sBAAsB,EAAE,MAAM,aAAa,CAAA;AACpD,YAAY,EACX,eAAe,EACf,uBAAuB,E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Y,EAAE,oBAAoB,EAAE,sBAAsB,EAAE,MAAM,cAAc,CAAA;AAChF,OAAO,EACN,uBAAuB,EACvB,2BAA2B,EAC3B,qCAAqC,EACrC,uBAAuB,EACvB,wBAAwB,EACxB,kBAAkB,GAClB,MAAM,cAAc,CAAA"}
|
package/dist/index.js
CHANGED
|
@@ -57,6 +57,7 @@ export { createStoreHealthCheck } from './health.js';
|
|
|
57
57
|
export { hasProductImages, optimizeFwImage } from './image.js';
|
|
58
58
|
export { storeOptionsSchema } from './options.js';
|
|
59
59
|
export { buildStoreOrderWAEDataPoint, createD1OrderHandler } from './orders.js';
|
|
60
|
+
export { resolveStoreProduct } from './products.js';
|
|
60
61
|
/**
|
|
61
62
|
* `getConfig`/`getConfigOrNull` resolve this site's fully-parsed `StoreOptions`
|
|
62
63
|
* at runtime — the same mechanism `.astro` page components use internally
|
|
@@ -68,5 +69,14 @@ export { buildStoreOrderWAEDataPoint, createD1OrderHandler } from './orders.js';
|
|
|
68
69
|
* read, throwing in the deployed Worker).
|
|
69
70
|
*/
|
|
70
71
|
export { getConfig, getConfigOrNull } from './state.js';
|
|
72
|
+
/**
|
|
73
|
+
* Real runtime export, not just a type — sites need `instanceof
|
|
74
|
+
* FourthwallError` to distinguish "not found" from other failures in their
|
|
75
|
+
* own pre-checks (see `resolveStoreProduct`). Previously only reachable via
|
|
76
|
+
* `export type * from './types.js'` below, which strips it at compile time;
|
|
77
|
+
* a site working around that by duck-typing `.name`/`.status` was the sign
|
|
78
|
+
* this was missing (found during the channel-store-recovery B3 rollout).
|
|
79
|
+
*/
|
|
80
|
+
export { FourthwallError } from './types.js';
|
|
71
81
|
export { buildStoreProductJsonLd, buildStoreVariantClientData, createStoreAddToCartAvailabilityState, isStoreVariantAvailable, normalizeStoreVariantSku, selectStoreVariant, } from './variant.js';
|
|
72
82
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRo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AqB,EACrB,kBAAkB,EAClB,kBAAkB,EAClB,sBAAsB,GACtB,MAAM,kBAAkB,CAAA;AAEzB,OAAO,EAAE,sBAAsB,EAAE,MAAM,aAAa,CAAA;AACpD,OAAO,EAAE,gBAAgB,EAAE,eAAe,EAAE,MAAM,YAAY,CAAA;AAE9D,OAAO,EAAE,kBAAkB,EAAE,MAAM,cAAc,CAAA;AAEjD,OAAO,EAAE,2BAA2B,EAAE,oBAAoB,EAAE,MAAM,aAAa,CAAA;AAC/E,OAAO,EAAE,mBAAmB,EAAE,MAAM,eAAe,CAAA;AACnD;;;;;;;;;GASG;AACH,OAAO,EAAE,SAAS,EAAE,eAAe,EAAE,MAAM,YAAY,CAAA;AAEvD;;;;;;;GAOG;AACH,OAAO,EAAE,eAAe,EAAE,MAAM,YAAY,CAAA;AAE5C,OAAO,EACN,uBAAuB,EACvB,2BAA2B,EAC3B,qCAAqC,EACrC,uBAAuB,EACvB,wBAAwB,EACxB,kBAAkB,GAClB,MAAM,cAAc,CAAA"}
|
package/dist/options.d.ts
CHANGED
|
@@ -93,6 +93,45 @@ export declare const storeOptionsSchema: z.ZodEffects<z.ZodObject<{
|
|
|
93
93
|
applicableCountry: string;
|
|
94
94
|
returnPolicyCategory: string;
|
|
95
95
|
}>>;
|
|
96
|
+
/** B5: business identity + policy links rendered in the store footer and product-page summary line. See `storeLegalSchema`. */
|
|
97
|
+
legal: z.ZodDefault<z.ZodObject<{
|
|
98
|
+
/** e.g. "Fulcrum Enterprises s.r.o." — shown in the store footer and product-page policy line. */
|
|
99
|
+
operator: z.ZodOptional<z.ZodString>;
|
|
100
|
+
/** Full mailing address shown beside `operator`. */
|
|
101
|
+
address: z.ZodOptional<z.ZodString>;
|
|
102
|
+
/** Site-relative path to the returns/refunds policy page. Kept as a path (not a fixed slug) since sites keep their own existing URLs. */
|
|
103
|
+
returnsPath: z.ZodOptional<z.ZodString>;
|
|
104
|
+
/** Site-relative path to the shipping/delivery policy page. */
|
|
105
|
+
shippingPath: z.ZodOptional<z.ZodString>;
|
|
106
|
+
/** Site-relative path to the terms of service page. */
|
|
107
|
+
termsPath: z.ZodOptional<z.ZodString>;
|
|
108
|
+
/** Site-relative path to the contact page. */
|
|
109
|
+
contactPath: z.ZodOptional<z.ZodString>;
|
|
110
|
+
/**
|
|
111
|
+
* Payment methods accepted at checkout. Defaults to Fourthwall's
|
|
112
|
+
* verified accepted-methods list (help.fourthwall.com, "Payment methods
|
|
113
|
+
* accepted on Fourthwall") since every site on this package checks out
|
|
114
|
+
* through Fourthwall — override only if a specific site's checkout
|
|
115
|
+
* genuinely differs.
|
|
116
|
+
*/
|
|
117
|
+
paymentMethods: z.ZodDefault<z.ZodArray<z.ZodString, "many">>;
|
|
118
|
+
}, "strip", z.ZodTypeAny, {
|
|
119
|
+
paymentMethods: string[];
|
|
120
|
+
operator?: string | undefined;
|
|
121
|
+
address?: string | undefined;
|
|
122
|
+
returnsPath?: string | undefined;
|
|
123
|
+
shippingPath?: string | undefined;
|
|
124
|
+
termsPath?: string | undefined;
|
|
125
|
+
contactPath?: string | undefined;
|
|
126
|
+
}, {
|
|
127
|
+
operator?: string | undefined;
|
|
128
|
+
address?: string | undefined;
|
|
129
|
+
returnsPath?: string | undefined;
|
|
130
|
+
shippingPath?: string | undefined;
|
|
131
|
+
termsPath?: string | undefined;
|
|
132
|
+
contactPath?: string | undefined;
|
|
133
|
+
paymentMethods?: string[] | undefined;
|
|
134
|
+
}>>;
|
|
96
135
|
imageTransform: z.ZodDefault<z.ZodObject<{
|
|
97
136
|
enabled: z.ZodDefault<z.ZodBoolean>;
|
|
98
137
|
}, "strip", z.ZodTypeAny, {
|
|
@@ -154,6 +193,15 @@ export declare const storeOptionsSchema: z.ZodEffects<z.ZodObject<{
|
|
|
154
193
|
supportedCurrencies: string[];
|
|
155
194
|
cartOrigin: string;
|
|
156
195
|
checkoutEnabled: boolean;
|
|
196
|
+
legal: {
|
|
197
|
+
paymentMethods: string[];
|
|
198
|
+
operator?: string | undefined;
|
|
199
|
+
address?: string | undefined;
|
|
200
|
+
returnsPath?: string | undefined;
|
|
201
|
+
shippingPath?: string | undefined;
|
|
202
|
+
termsPath?: string | undefined;
|
|
203
|
+
contactPath?: string | undefined;
|
|
204
|
+
};
|
|
157
205
|
imageTransform: {
|
|
158
206
|
enabled: boolean;
|
|
159
207
|
};
|
|
@@ -193,6 +241,15 @@ export declare const storeOptionsSchema: z.ZodEffects<z.ZodObject<{
|
|
|
193
241
|
applicableCountry: string;
|
|
194
242
|
returnPolicyCategory: string;
|
|
195
243
|
} | undefined;
|
|
244
|
+
legal?: {
|
|
245
|
+
operator?: string | undefined;
|
|
246
|
+
address?: string | undefined;
|
|
247
|
+
returnsPath?: string | undefined;
|
|
248
|
+
shippingPath?: string | undefined;
|
|
249
|
+
termsPath?: string | undefined;
|
|
250
|
+
contactPath?: string | undefined;
|
|
251
|
+
paymentMethods?: string[] | undefined;
|
|
252
|
+
} | undefined;
|
|
196
253
|
imageTransform?: {
|
|
197
254
|
enabled?: boolean | undefined;
|
|
198
255
|
} | undefined;
|
|
@@ -230,6 +287,15 @@ export declare const storeOptionsSchema: z.ZodEffects<z.ZodObject<{
|
|
|
230
287
|
supportedCurrencies: string[];
|
|
231
288
|
cartOrigin: string;
|
|
232
289
|
checkoutEnabled: boolean;
|
|
290
|
+
legal: {
|
|
291
|
+
paymentMethods: string[];
|
|
292
|
+
operator?: string | undefined;
|
|
293
|
+
address?: string | undefined;
|
|
294
|
+
returnsPath?: string | undefined;
|
|
295
|
+
shippingPath?: string | undefined;
|
|
296
|
+
termsPath?: string | undefined;
|
|
297
|
+
contactPath?: string | undefined;
|
|
298
|
+
};
|
|
233
299
|
imageTransform: {
|
|
234
300
|
enabled: boolean;
|
|
235
301
|
};
|
|
@@ -263,6 +329,15 @@ export declare const storeOptionsSchema: z.ZodEffects<z.ZodObject<{
|
|
|
263
329
|
applicableCountry: string;
|
|
264
330
|
returnPolicyCategory: string;
|
|
265
331
|
} | undefined;
|
|
332
|
+
legal?: {
|
|
333
|
+
operator?: string | undefined;
|
|
334
|
+
address?: string | undefined;
|
|
335
|
+
returnsPath?: string | undefined;
|
|
336
|
+
shippingPath?: string | undefined;
|
|
337
|
+
termsPath?: string | undefined;
|
|
338
|
+
contactPath?: string | undefined;
|
|
339
|
+
paymentMethods?: string[] | undefined;
|
|
340
|
+
} | undefined;
|
|
266
341
|
imageTransform?: {
|
|
267
342
|
enabled?: boolean | undefined;
|
|
268
343
|
} | undefined;
|
package/dist/options.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"options.d.ts","sourceRoot":"","sources":["../src/options.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAEvB,QAAA,MAAM,qBAAqB;;IAE1B,qGAAqG;;;;;;;;;;;;;;;;;;;;;;;EAOpG,CAAA;
|
|
1
|
+
{"version":3,"file":"options.d.ts","sourceRoot":"","sources":["../src/options.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAEvB,QAAA,MAAM,qBAAqB;;IAE1B,qGAAqG;;;;;;;;;;;;;;;;;;;;;;;EAOpG,CAAA;AAkIF,eAAO,MAAM,kBAAkB;IA5E9B,6DAA6D;;IAG7D;;;;;;;;OAQG;;;QAxEH,qGAAqG;;;;;;;;;;;;;;;;;;;;;;;;IA2ErG,8EAA8E;;IAG9E;;;;;OAKG;;;;IAMH,2FAA2F;;IAG3F;;;;;OAKG;;;;;;;;;;;;IAKH,+HAA+H;;QA7E9H,kGAAkG;;QAElG,oDAAoD;;QAEpD,yIAAyI;;QAEzI,+DAA+D;;QAE/D,uDAAuD;;QAEvD,8CAA8C;;QAE9C;;;;;;WAMG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IA4EJ;;;;;;OAMG;;;;;QAMD,gGAAgG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAYhG,CAAA;AAEH,MAAM,MAAM,YAAY,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,kBAAkB,CAAC,CAAA;AAC7D,MAAM,MAAM,oBAAoB,GAAG,CAAC,CAAC,MAAM,CAAC,OAAO,kBAAkB,CAAC,CAAA;AACtE,MAAM,MAAM,oBAAoB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,qBAAqB,CAAC,CAAA"}
|
package/dist/options.js
CHANGED
|
@@ -13,6 +13,51 @@ const merchantReturnPolicySchema = z.object({
|
|
|
13
13
|
applicableCountry: z.string().min(1),
|
|
14
14
|
returnPolicyCategory: z.string().min(1),
|
|
15
15
|
});
|
|
16
|
+
/**
|
|
17
|
+
* B5 (channel-store-recovery): Google Merchant Center suspended every
|
|
18
|
+
* channel's sub-account for Misrepresentation because none of the sites
|
|
19
|
+
* disclosed a business identity, return window, shipping estimate, or
|
|
20
|
+
* payment methods on the store pages themselves. All optional so existing
|
|
21
|
+
* sites don't break on upgrade; the package renders nothing for a field a
|
|
22
|
+
* site hasn't set, but the merchant-review acceptance criteria require all
|
|
23
|
+
* of them to be present before requesting re-review.
|
|
24
|
+
*/
|
|
25
|
+
const storeLegalSchema = z
|
|
26
|
+
.object({
|
|
27
|
+
/** e.g. "Fulcrum Enterprises s.r.o." — shown in the store footer and product-page policy line. */
|
|
28
|
+
operator: z.string().min(1).optional(),
|
|
29
|
+
/** Full mailing address shown beside `operator`. */
|
|
30
|
+
address: z.string().min(1).optional(),
|
|
31
|
+
/** Site-relative path to the returns/refunds policy page. Kept as a path (not a fixed slug) since sites keep their own existing URLs. */
|
|
32
|
+
returnsPath: z.string().optional(),
|
|
33
|
+
/** Site-relative path to the shipping/delivery policy page. */
|
|
34
|
+
shippingPath: z.string().optional(),
|
|
35
|
+
/** Site-relative path to the terms of service page. */
|
|
36
|
+
termsPath: z.string().optional(),
|
|
37
|
+
/** Site-relative path to the contact page. */
|
|
38
|
+
contactPath: z.string().optional(),
|
|
39
|
+
/**
|
|
40
|
+
* Payment methods accepted at checkout. Defaults to Fourthwall's
|
|
41
|
+
* verified accepted-methods list (help.fourthwall.com, "Payment methods
|
|
42
|
+
* accepted on Fourthwall") since every site on this package checks out
|
|
43
|
+
* through Fourthwall — override only if a specific site's checkout
|
|
44
|
+
* genuinely differs.
|
|
45
|
+
*/
|
|
46
|
+
paymentMethods: z
|
|
47
|
+
.array(z.string())
|
|
48
|
+
.default([
|
|
49
|
+
'Visa',
|
|
50
|
+
'Mastercard',
|
|
51
|
+
'American Express',
|
|
52
|
+
'Discover',
|
|
53
|
+
'Apple Pay',
|
|
54
|
+
'Google Pay',
|
|
55
|
+
'PayPal',
|
|
56
|
+
'Afterpay',
|
|
57
|
+
'Klarna',
|
|
58
|
+
]),
|
|
59
|
+
})
|
|
60
|
+
.default({});
|
|
16
61
|
const baseStoreOptionsSchema = z.object({
|
|
17
62
|
/** Shown in the store JSON-LD `brand.name` and page copy. */
|
|
18
63
|
brandName: z.string().min(1),
|
|
@@ -47,6 +92,8 @@ const baseStoreOptionsSchema = z.object({
|
|
|
47
92
|
*/
|
|
48
93
|
checkoutEnabled: z.boolean().default(true),
|
|
49
94
|
merchantReturnPolicy: merchantReturnPolicySchema.optional(),
|
|
95
|
+
/** B5: business identity + policy links rendered in the store footer and product-page summary line. See `storeLegalSchema`. */
|
|
96
|
+
legal: storeLegalSchema,
|
|
50
97
|
imageTransform: z
|
|
51
98
|
.object({
|
|
52
99
|
enabled: z.boolean().default(false),
|
package/dist/options.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"options.js","sourceRoot":"","sources":["../src/options.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAA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E,CAAC,CAAC,MAAM,EAAE,CAAC,OAAO,CAAC,oBAAoB,CAAC;QACrD,iBAAiB,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,OAAO,CAAC,2BAA2B,CAAC;KAClE,CAAC;SACD,OAAO,CAAC,EAAE,CAAC;IAEb;;;;;;OAMG;IACH,SAAS,EAAE,CAAC;SACV,MAAM,CAAC;QACP,SAAS,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,OAAO,CAAC,IAAI,CAAC;QACnC,UAAU,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,OAAO,CAAC,WAAW,CAAC;QAC3C,MAAM,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,QAAQ,EAAE;QACpC,gGAAgG;QAChG,mBAAmB,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,CAAC,QAAQ,EAAE,CAAC,OAAO,CAAC,CAAC,CAAC;KAC3D,CAAC;SACD,OAAO,CAAC,EAAE,CAAC;CACb,CAAC,CAAA;AAEF,MAAM,CAAC,MAAM,kBAAkB,GAAG,sBAAsB,CAAC,SAAS,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,CAAC;IAChF,GAAG,OAAO;IACV,SAAS,EAAE;QACV,GAAG,OAAO,CAAC,SAAS;QACpB,MAAM,EAAE,OAAO,CAAC,SAAS,CAAC,MAAM,IAAI,OAAO,CAAC,UAAU;KACtD;CACD,CAAC,CAAC,CAAA"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import type { FourthwallClient } from './client.js';
|
|
2
|
+
import { type FwProduct } from './types.js';
|
|
3
|
+
/**
|
|
4
|
+
* Resolves a product by slug from the live Fourthwall shop, returning `null`
|
|
5
|
+
* for an unknown slug instead of throwing — for a site's own top-level
|
|
6
|
+
* pre-check (see `StoreProductPage`'s doc comment).
|
|
7
|
+
*
|
|
8
|
+
* B5 (channel-store-recovery, Google Merchant Center Misrepresentation
|
|
9
|
+
* suspension): an unknown product slug must answer a real 404, never a 500.
|
|
10
|
+
* `StoreProductPage.astro`'s own `return new Response(...)` for a missing
|
|
11
|
+
* product only works when the component isn't nested inside a layout that
|
|
12
|
+
* has already started streaming output — exactly the same limitation
|
|
13
|
+
* `StoreCollectionPage` already documents and `resolveShopCollections`'s
|
|
14
|
+
* `getConfig()` pre-check pattern already solves for collections. A site
|
|
15
|
+
* calls this in its own page frontmatter, before rendering its layout, and
|
|
16
|
+
* returns its own top-level 404 `Response` when it gets `null` back —
|
|
17
|
+
* mirroring `src/pages/store/collections/[slug].astro`'s existing pattern
|
|
18
|
+
* exactly, rather than relying on a child component to hijack the response.
|
|
19
|
+
*/
|
|
20
|
+
export declare function resolveStoreProduct(input: {
|
|
21
|
+
client: FourthwallClient | null;
|
|
22
|
+
slug: string;
|
|
23
|
+
currency: string;
|
|
24
|
+
}): Promise<FwProduct | null>;
|
|
25
|
+
//# sourceMappingURL=products.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"products.d.ts","sourceRoot":"","sources":["../src/products.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAA;AACnD,OAAO,EAAmB,KAAK,SAAS,EAAE,MAAM,YAAY,CAAA;AAE5D;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAsB,mBAAmB,CAAC,KAAK,EAAE;IAChD,MAAM,EAAE,gBAAgB,GAAG,IAAI,CAAA;IAC/B,IAAI,EAAE,MAAM,CAAA;IACZ,QAAQ,EAAE,MAAM,CAAA;CAChB,GAAG,OAAO,CAAC,SAAS,GAAG,IAAI,CAAC,CAe5B"}
|
package/dist/products.js
ADDED
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { cachedJson } from './cache.js';
|
|
2
|
+
import { FourthwallError } from './types.js';
|
|
3
|
+
/**
|
|
4
|
+
* Resolves a product by slug from the live Fourthwall shop, returning `null`
|
|
5
|
+
* for an unknown slug instead of throwing — for a site's own top-level
|
|
6
|
+
* pre-check (see `StoreProductPage`'s doc comment).
|
|
7
|
+
*
|
|
8
|
+
* B5 (channel-store-recovery, Google Merchant Center Misrepresentation
|
|
9
|
+
* suspension): an unknown product slug must answer a real 404, never a 500.
|
|
10
|
+
* `StoreProductPage.astro`'s own `return new Response(...)` for a missing
|
|
11
|
+
* product only works when the component isn't nested inside a layout that
|
|
12
|
+
* has already started streaming output — exactly the same limitation
|
|
13
|
+
* `StoreCollectionPage` already documents and `resolveShopCollections`'s
|
|
14
|
+
* `getConfig()` pre-check pattern already solves for collections. A site
|
|
15
|
+
* calls this in its own page frontmatter, before rendering its layout, and
|
|
16
|
+
* returns its own top-level 404 `Response` when it gets `null` back —
|
|
17
|
+
* mirroring `src/pages/store/collections/[slug].astro`'s existing pattern
|
|
18
|
+
* exactly, rather than relying on a child component to hijack the response.
|
|
19
|
+
*/
|
|
20
|
+
export async function resolveStoreProduct(input) {
|
|
21
|
+
if (!input.client)
|
|
22
|
+
return null;
|
|
23
|
+
const client = input.client;
|
|
24
|
+
try {
|
|
25
|
+
return await cachedJson({
|
|
26
|
+
pathSegment: `/products/${encodeURIComponent(input.slug)}`,
|
|
27
|
+
query: { cur: input.currency },
|
|
28
|
+
ttlSeconds: 600,
|
|
29
|
+
fetcher: () => client.getProduct({ slug: input.slug, currency: input.currency }),
|
|
30
|
+
});
|
|
31
|
+
}
|
|
32
|
+
catch (err) {
|
|
33
|
+
if (err instanceof FourthwallError && err.status === 404)
|
|
34
|
+
return null;
|
|
35
|
+
throw err;
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
//# sourceMappingURL=products.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"products.js","sourceRoot":"","sources":["../src/products.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,YAAY,CAAA;AAEvC,OAAO,EAAE,eAAe,EAAkB,MAAM,YAAY,CAAA;AAE5D;;;;;;;;;;;;;;;;GAgBG;AACH,MAAM,CAAC,KAAK,UAAU,mBAAmB,CAAC,KAIzC;IACA,IAAI,CAAC,KAAK,CAAC,MAAM;QAAE,OAAO,IAAI,CAAA;IAE9B,MAAM,MAAM,GAAG,KAAK,CAAC,MAAM,CAAA;IAC3B,IAAI,CAAC;QACJ,OAAO,MAAM,UAAU,CAAC;YACvB,WAAW,EAAE,aAAa,kBAAkB,CAAC,KAAK,CAAC,IAAI,CAAC,EAAE;YAC1D,KAAK,EAAE,EAAE,GAAG,EAAE,KAAK,CAAC,QAAQ,EAAE;YAC9B,UAAU,EAAE,GAAG;YACf,OAAO,EAAE,GAAG,EAAE,CAAC,MAAM,CAAC,UAAU,CAAC,EAAE,IAAI,EAAE,KAAK,CAAC,IAAI,EAAE,QAAQ,EAAE,KAAK,CAAC,QAAQ,EAAE,CAAC;SAChF,CAAC,CAAA;IACH,CAAC;IAAC,OAAO,GAAG,EAAE,CAAC;QACd,IAAI,GAAG,YAAY,eAAe,IAAI,GAAG,CAAC,MAAM,KAAK,GAAG;YAAE,OAAO,IAAI,CAAA;QACrE,MAAM,GAAG,CAAA;IACV,CAAC;AACF,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
import { env as cloudflareEnv } from 'cloudflare:workers'
|
|
3
3
|
import { getConfig } from '../state.js'
|
|
4
|
+
import StoreLegalFooter from './StoreLegalFooter.astro'
|
|
4
5
|
|
|
5
6
|
interface FwEnv {
|
|
6
7
|
PUBLIC_FW_STOREFRONT_TOKEN?: string
|
|
@@ -73,6 +74,8 @@ const currency = env?.PUBLIC_FW_DEFAULT_CURRENCY ?? config.defaultCurrency
|
|
|
73
74
|
)}
|
|
74
75
|
</section>
|
|
75
76
|
|
|
77
|
+
<StoreLegalFooter />
|
|
78
|
+
|
|
76
79
|
<script>
|
|
77
80
|
import { cart, type CartSnapshot } from '../cart-client.js'
|
|
78
81
|
import { initiateCheckout } from '../checkout-client.js'
|
|
@@ -12,6 +12,7 @@ import { getConfig } from '../state.js'
|
|
|
12
12
|
import type { FwProduct } from '../types.js'
|
|
13
13
|
import CollectionCard from './CollectionCard.astro'
|
|
14
14
|
import ProductCard from './ProductCard.astro'
|
|
15
|
+
import StoreLegalFooter from './StoreLegalFooter.astro'
|
|
15
16
|
|
|
16
17
|
interface FwEnv {
|
|
17
18
|
PUBLIC_FW_STOREFRONT_TOKEN?: string
|
|
@@ -196,4 +197,6 @@ if (client) {
|
|
|
196
197
|
<p class="text-[var(--muted-foreground)]">New arrivals will appear here soon.</p>
|
|
197
198
|
)}
|
|
198
199
|
</section>
|
|
200
|
+
|
|
201
|
+
<StoreLegalFooter />
|
|
199
202
|
</div>
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
---
|
|
2
|
+
/**
|
|
3
|
+
* B5 (channel-store-recovery): Google Merchant Center's Misrepresentation
|
|
4
|
+
* suspension requires a clear business identity and policy links on the
|
|
5
|
+
* store pages themselves, not just linked from a global site footer. Renders
|
|
6
|
+
* nothing for any field a site hasn't set in `storeOptions.legal` — safe to
|
|
7
|
+
* drop into every store page unconditionally; a site mid-migration to B5
|
|
8
|
+
* content just doesn't get the block yet instead of rendering broken links.
|
|
9
|
+
*/
|
|
10
|
+
import { getConfig } from '../state.js'
|
|
11
|
+
|
|
12
|
+
const config = await getConfig()
|
|
13
|
+
const legal = config.legal
|
|
14
|
+
const hasIdentity = Boolean(legal.operator || legal.address)
|
|
15
|
+
const links: Array<{ href: string; label: string }> = [
|
|
16
|
+
legal.returnsPath ? { href: legal.returnsPath, label: 'Returns & refunds' } : null,
|
|
17
|
+
legal.shippingPath ? { href: legal.shippingPath, label: 'Shipping & delivery' } : null,
|
|
18
|
+
legal.termsPath ? { href: legal.termsPath, label: 'Terms of service' } : null,
|
|
19
|
+
legal.contactPath ? { href: legal.contactPath, label: 'Contact' } : null,
|
|
20
|
+
].filter((link): link is { href: string; label: string } => link !== null)
|
|
21
|
+
|
|
22
|
+
const hasContent = hasIdentity || links.length > 0 || Boolean(legal.paymentMethods?.length)
|
|
23
|
+
---
|
|
24
|
+
|
|
25
|
+
{
|
|
26
|
+
hasContent && (
|
|
27
|
+
<footer class="space-y-2 border-t border-[var(--border)] pt-6 text-sm text-[var(--muted-foreground)]">
|
|
28
|
+
{hasIdentity && (
|
|
29
|
+
<p>
|
|
30
|
+
{legal.operator}
|
|
31
|
+
{legal.operator && legal.address && ' · '}
|
|
32
|
+
{legal.address}
|
|
33
|
+
</p>
|
|
34
|
+
)}
|
|
35
|
+
{links.length > 0 && (
|
|
36
|
+
<nav aria-label="Store policies" class="flex flex-wrap gap-x-4 gap-y-1">
|
|
37
|
+
{links.map((link, index) => (
|
|
38
|
+
<>
|
|
39
|
+
{index > 0 && <span aria-hidden="true">·</span>}
|
|
40
|
+
<a href={link.href} class="underline-offset-4 hover:underline">
|
|
41
|
+
{link.label}
|
|
42
|
+
</a>
|
|
43
|
+
</>
|
|
44
|
+
))}
|
|
45
|
+
</nav>
|
|
46
|
+
)}
|
|
47
|
+
{legal.paymentMethods && legal.paymentMethods.length > 0 && <p>Payment methods: {legal.paymentMethods.join(', ')}</p>}
|
|
48
|
+
</footer>
|
|
49
|
+
)
|
|
50
|
+
}
|
|
@@ -13,6 +13,7 @@ import {
|
|
|
13
13
|
} from '../variant.js'
|
|
14
14
|
import AddToCartButton from './AddToCartButton.astro'
|
|
15
15
|
import Price from './Price.astro'
|
|
16
|
+
import StoreLegalFooter from './StoreLegalFooter.astro'
|
|
16
17
|
import VariantPicker from './VariantPicker.astro'
|
|
17
18
|
|
|
18
19
|
interface FwEnv {
|
|
@@ -71,6 +72,19 @@ if (!token) {
|
|
|
71
72
|
}
|
|
72
73
|
}
|
|
73
74
|
} catch (err) {
|
|
75
|
+
// This `return new Response()` only takes effect when this component is
|
|
76
|
+
// the top-level thing Astro renders for the request. A site that nests
|
|
77
|
+
// this component inside its own layout (e.g. `<Base><StoreProductPage
|
|
78
|
+
// .../></Base>`) has already started streaming that layout's markup by
|
|
79
|
+
// the time this runs, so the response can't be hijacked here -- Astro
|
|
80
|
+
// surfaces that as a 500, not the 404 a shopper (and Google's Merchant
|
|
81
|
+
// Center review) needs to see. Nested sites must pre-check with
|
|
82
|
+
// `resolveStoreProduct()` at the top of their own page frontmatter,
|
|
83
|
+
// before rendering their layout, and return their own 404 `Response`
|
|
84
|
+
// there -- exactly the pattern `src/pages/store/collections/[slug].astro`
|
|
85
|
+
// already uses for collections (see `resolveShopCollections`'s doc
|
|
86
|
+
// comment). This catch only actually reaches a shopper when a site uses
|
|
87
|
+
// this component directly as its page (no surrounding layout).
|
|
74
88
|
if (err instanceof FourthwallError && err.status === 404) {
|
|
75
89
|
return new Response('Not Found', { status: notFoundResponseStatus })
|
|
76
90
|
}
|
|
@@ -253,6 +267,21 @@ const fourthwallProductUrl = fourthwallShopBaseUrl && product ? `${fourthwallSho
|
|
|
253
267
|
mode="buy-now"
|
|
254
268
|
checkoutPath={config.routes.checkoutPath}
|
|
255
269
|
/>
|
|
270
|
+
{(config.legal.returnsPath || config.legal.shippingPath) && (
|
|
271
|
+
<p class="text-sm text-[var(--muted-foreground)]">
|
|
272
|
+
{config.legal.shippingPath && (
|
|
273
|
+
<a href={config.legal.shippingPath} class="underline-offset-4 hover:underline">
|
|
274
|
+
Shipping
|
|
275
|
+
</a>
|
|
276
|
+
)}
|
|
277
|
+
{config.legal.shippingPath && config.legal.returnsPath && ' & '}
|
|
278
|
+
{config.legal.returnsPath && (
|
|
279
|
+
<a href={config.legal.returnsPath} class="underline-offset-4 hover:underline">
|
|
280
|
+
returns
|
|
281
|
+
</a>
|
|
282
|
+
)}
|
|
283
|
+
</p>
|
|
284
|
+
)}
|
|
256
285
|
</div>
|
|
257
286
|
)}
|
|
258
287
|
{selectedVariant && !config.checkoutEnabled && (
|
|
@@ -262,6 +291,8 @@ const fourthwallProductUrl = fourthwallShopBaseUrl && product ? `${fourthwallSho
|
|
|
262
291
|
</div>
|
|
263
292
|
)}
|
|
264
293
|
|
|
294
|
+
<StoreLegalFooter />
|
|
295
|
+
|
|
265
296
|
<script>
|
|
266
297
|
document.querySelectorAll<HTMLElement>('[data-product-root]').forEach((root) => {
|
|
267
298
|
const mainImage = root.querySelector<HTMLImageElement>('[data-main-product-image]')
|
package/src/index.ts
CHANGED
|
@@ -86,6 +86,7 @@ export type { ResolvedStoreOptions, StoreOptions } from './options.js'
|
|
|
86
86
|
export { storeOptionsSchema } from './options.js'
|
|
87
87
|
export type { OrderTelemetryOptions } from './orders.js'
|
|
88
88
|
export { buildStoreOrderWAEDataPoint, createD1OrderHandler } from './orders.js'
|
|
89
|
+
export { resolveStoreProduct } from './products.js'
|
|
89
90
|
/**
|
|
90
91
|
* `getConfig`/`getConfigOrNull` resolve this site's fully-parsed `StoreOptions`
|
|
91
92
|
* at runtime — the same mechanism `.astro` page components use internally
|
|
@@ -98,6 +99,15 @@ export { buildStoreOrderWAEDataPoint, createD1OrderHandler } from './orders.js'
|
|
|
98
99
|
*/
|
|
99
100
|
export { getConfig, getConfigOrNull } from './state.js'
|
|
100
101
|
export type * from './types.js'
|
|
102
|
+
/**
|
|
103
|
+
* Real runtime export, not just a type — sites need `instanceof
|
|
104
|
+
* FourthwallError` to distinguish "not found" from other failures in their
|
|
105
|
+
* own pre-checks (see `resolveStoreProduct`). Previously only reachable via
|
|
106
|
+
* `export type * from './types.js'` below, which strips it at compile time;
|
|
107
|
+
* a site working around that by duck-typing `.name`/`.status` was the sign
|
|
108
|
+
* this was missing (found during the channel-store-recovery B3 rollout).
|
|
109
|
+
*/
|
|
110
|
+
export { FourthwallError } from './types.js'
|
|
101
111
|
export type { MerchantReturnPolicy, StoreVariantClientData } from './variant.js'
|
|
102
112
|
export {
|
|
103
113
|
buildStoreProductJsonLd,
|
package/src/options.ts
CHANGED
|
@@ -16,6 +16,52 @@ const merchantReturnPolicySchema = z.object({
|
|
|
16
16
|
returnPolicyCategory: z.string().min(1),
|
|
17
17
|
})
|
|
18
18
|
|
|
19
|
+
/**
|
|
20
|
+
* B5 (channel-store-recovery): Google Merchant Center suspended every
|
|
21
|
+
* channel's sub-account for Misrepresentation because none of the sites
|
|
22
|
+
* disclosed a business identity, return window, shipping estimate, or
|
|
23
|
+
* payment methods on the store pages themselves. All optional so existing
|
|
24
|
+
* sites don't break on upgrade; the package renders nothing for a field a
|
|
25
|
+
* site hasn't set, but the merchant-review acceptance criteria require all
|
|
26
|
+
* of them to be present before requesting re-review.
|
|
27
|
+
*/
|
|
28
|
+
const storeLegalSchema = z
|
|
29
|
+
.object({
|
|
30
|
+
/** e.g. "Fulcrum Enterprises s.r.o." — shown in the store footer and product-page policy line. */
|
|
31
|
+
operator: z.string().min(1).optional(),
|
|
32
|
+
/** Full mailing address shown beside `operator`. */
|
|
33
|
+
address: z.string().min(1).optional(),
|
|
34
|
+
/** Site-relative path to the returns/refunds policy page. Kept as a path (not a fixed slug) since sites keep their own existing URLs. */
|
|
35
|
+
returnsPath: z.string().optional(),
|
|
36
|
+
/** Site-relative path to the shipping/delivery policy page. */
|
|
37
|
+
shippingPath: z.string().optional(),
|
|
38
|
+
/** Site-relative path to the terms of service page. */
|
|
39
|
+
termsPath: z.string().optional(),
|
|
40
|
+
/** Site-relative path to the contact page. */
|
|
41
|
+
contactPath: z.string().optional(),
|
|
42
|
+
/**
|
|
43
|
+
* Payment methods accepted at checkout. Defaults to Fourthwall's
|
|
44
|
+
* verified accepted-methods list (help.fourthwall.com, "Payment methods
|
|
45
|
+
* accepted on Fourthwall") since every site on this package checks out
|
|
46
|
+
* through Fourthwall — override only if a specific site's checkout
|
|
47
|
+
* genuinely differs.
|
|
48
|
+
*/
|
|
49
|
+
paymentMethods: z
|
|
50
|
+
.array(z.string())
|
|
51
|
+
.default([
|
|
52
|
+
'Visa',
|
|
53
|
+
'Mastercard',
|
|
54
|
+
'American Express',
|
|
55
|
+
'Discover',
|
|
56
|
+
'Apple Pay',
|
|
57
|
+
'Google Pay',
|
|
58
|
+
'PayPal',
|
|
59
|
+
'Afterpay',
|
|
60
|
+
'Klarna',
|
|
61
|
+
]),
|
|
62
|
+
})
|
|
63
|
+
.default({})
|
|
64
|
+
|
|
19
65
|
const baseStoreOptionsSchema = z.object({
|
|
20
66
|
/** Shown in the store JSON-LD `brand.name` and page copy. */
|
|
21
67
|
brandName: z.string().min(1),
|
|
@@ -58,6 +104,9 @@ const baseStoreOptionsSchema = z.object({
|
|
|
58
104
|
|
|
59
105
|
merchantReturnPolicy: merchantReturnPolicySchema.optional(),
|
|
60
106
|
|
|
107
|
+
/** B5: business identity + policy links rendered in the store footer and product-page summary line. See `storeLegalSchema`. */
|
|
108
|
+
legal: storeLegalSchema,
|
|
109
|
+
|
|
61
110
|
imageTransform: z
|
|
62
111
|
.object({
|
|
63
112
|
enabled: z.boolean().default(false),
|
package/src/products.ts
ADDED
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { cachedJson } from './cache.js'
|
|
2
|
+
import type { FourthwallClient } from './client.js'
|
|
3
|
+
import { FourthwallError, type FwProduct } from './types.js'
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Resolves a product by slug from the live Fourthwall shop, returning `null`
|
|
7
|
+
* for an unknown slug instead of throwing — for a site's own top-level
|
|
8
|
+
* pre-check (see `StoreProductPage`'s doc comment).
|
|
9
|
+
*
|
|
10
|
+
* B5 (channel-store-recovery, Google Merchant Center Misrepresentation
|
|
11
|
+
* suspension): an unknown product slug must answer a real 404, never a 500.
|
|
12
|
+
* `StoreProductPage.astro`'s own `return new Response(...)` for a missing
|
|
13
|
+
* product only works when the component isn't nested inside a layout that
|
|
14
|
+
* has already started streaming output — exactly the same limitation
|
|
15
|
+
* `StoreCollectionPage` already documents and `resolveShopCollections`'s
|
|
16
|
+
* `getConfig()` pre-check pattern already solves for collections. A site
|
|
17
|
+
* calls this in its own page frontmatter, before rendering its layout, and
|
|
18
|
+
* returns its own top-level 404 `Response` when it gets `null` back —
|
|
19
|
+
* mirroring `src/pages/store/collections/[slug].astro`'s existing pattern
|
|
20
|
+
* exactly, rather than relying on a child component to hijack the response.
|
|
21
|
+
*/
|
|
22
|
+
export async function resolveStoreProduct(input: {
|
|
23
|
+
client: FourthwallClient | null
|
|
24
|
+
slug: string
|
|
25
|
+
currency: string
|
|
26
|
+
}): Promise<FwProduct | null> {
|
|
27
|
+
if (!input.client) return null
|
|
28
|
+
|
|
29
|
+
const client = input.client
|
|
30
|
+
try {
|
|
31
|
+
return await cachedJson({
|
|
32
|
+
pathSegment: `/products/${encodeURIComponent(input.slug)}`,
|
|
33
|
+
query: { cur: input.currency },
|
|
34
|
+
ttlSeconds: 600,
|
|
35
|
+
fetcher: () => client.getProduct({ slug: input.slug, currency: input.currency }),
|
|
36
|
+
})
|
|
37
|
+
} catch (err) {
|
|
38
|
+
if (err instanceof FourthwallError && err.status === 404) return null
|
|
39
|
+
throw err
|
|
40
|
+
}
|
|
41
|
+
}
|