@thorprovider/blocks 3.0.2 → 4.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +61 -21
- package/dist/blocks/designs/checkout-commerce-v1/block.d.ts +49 -0
- package/dist/blocks/designs/checkout-commerce-v1/block.d.ts.map +1 -0
- package/dist/blocks/designs/checkout-commerce-v1/block.js +2487 -0
- package/dist/blocks/designs/checkout-commerce-v1/block.js.map +1 -0
- package/dist/blocks/designs/checkout-commerce-v1/block.mjs +2467 -0
- package/dist/blocks/designs/checkout-commerce-v1/block.mjs.map +1 -0
- package/dist/blocks/designs/checkout-commerce-v1/data-context.d.ts +8 -0
- package/dist/blocks/designs/checkout-commerce-v1/data-context.d.ts.map +1 -0
- package/dist/blocks/designs/checkout-commerce-v1/data-context.js +44 -0
- package/dist/blocks/designs/checkout-commerce-v1/data-context.js.map +1 -0
- package/dist/blocks/designs/checkout-commerce-v1/data-context.mjs +19 -0
- package/dist/blocks/designs/checkout-commerce-v1/data-context.mjs.map +1 -0
- package/dist/blocks/designs/checkout-commerce-v1/index.d.ts +3 -0
- package/dist/blocks/designs/checkout-commerce-v1/index.d.ts.map +1 -0
- package/dist/blocks/designs/checkout-commerce-v1/index.js +36 -0
- package/dist/blocks/designs/checkout-commerce-v1/index.js.map +1 -0
- package/dist/blocks/designs/checkout-commerce-v1/index.mjs +6 -0
- package/dist/blocks/designs/checkout-commerce-v1/index.mjs.map +1 -0
- package/dist/blocks/designs/marketplace-product-card/block.d.ts +12 -0
- package/dist/blocks/designs/marketplace-product-card/block.d.ts.map +1 -0
- package/dist/blocks/designs/marketplace-product-card/block.js +243 -0
- package/dist/blocks/designs/marketplace-product-card/block.js.map +1 -0
- package/dist/blocks/designs/marketplace-product-card/block.mjs +233 -0
- package/dist/blocks/designs/marketplace-product-card/block.mjs.map +1 -0
- package/dist/blocks/designs/marketplace-product-card/index.d.ts +3 -0
- package/dist/blocks/designs/marketplace-product-card/index.d.ts.map +1 -0
- package/dist/blocks/designs/marketplace-product-card/index.js +36 -0
- package/dist/blocks/designs/marketplace-product-card/index.js.map +1 -0
- package/dist/blocks/designs/marketplace-product-card/index.mjs +6 -0
- package/dist/blocks/designs/marketplace-product-card/index.mjs.map +1 -0
- package/dist/blocks/designs/marketplace-product-card/normalize.d.ts +13 -0
- package/dist/blocks/designs/marketplace-product-card/normalize.d.ts.map +1 -0
- package/dist/blocks/designs/marketplace-product-card/normalize.js +36 -0
- package/dist/blocks/designs/marketplace-product-card/normalize.js.map +1 -0
- package/dist/blocks/designs/marketplace-product-card/normalize.mjs +12 -0
- package/dist/blocks/designs/marketplace-product-card/normalize.mjs.map +1 -0
- package/dist/blocks/designs/marketplace-product-card/variants.d.ts +72 -0
- package/dist/blocks/designs/marketplace-product-card/variants.d.ts.map +1 -0
- package/dist/blocks/designs/marketplace-product-card/variants.js +123 -0
- package/dist/blocks/designs/marketplace-product-card/variants.js.map +1 -0
- package/dist/blocks/designs/marketplace-product-card/variants.mjs +89 -0
- package/dist/blocks/designs/marketplace-product-card/variants.mjs.map +1 -0
- package/dist/blocks/e-commerce/account/account-frame.d.ts +38 -0
- package/dist/blocks/e-commerce/account/account-frame.d.ts.map +1 -0
- package/dist/blocks/e-commerce/account/account-frame.js +102 -0
- package/dist/blocks/e-commerce/account/account-frame.js.map +1 -0
- package/dist/blocks/e-commerce/account/account-frame.mjs +78 -0
- package/dist/blocks/e-commerce/account/account-frame.mjs.map +1 -0
- package/dist/blocks/e-commerce/account/address-book.d.ts +79 -0
- package/dist/blocks/e-commerce/account/address-book.d.ts.map +1 -0
- package/dist/blocks/e-commerce/account/address-book.js +250 -0
- package/dist/blocks/e-commerce/account/address-book.js.map +1 -0
- package/dist/blocks/e-commerce/account/address-book.mjs +225 -0
- package/dist/blocks/e-commerce/account/address-book.mjs.map +1 -0
- package/dist/blocks/e-commerce/account/profile-form.d.ts +35 -0
- package/dist/blocks/e-commerce/account/profile-form.d.ts.map +1 -0
- package/dist/blocks/e-commerce/account/profile-form.js +100 -0
- package/dist/blocks/e-commerce/account/profile-form.js.map +1 -0
- package/dist/blocks/e-commerce/account/profile-form.mjs +76 -0
- package/dist/blocks/e-commerce/account/profile-form.mjs.map +1 -0
- package/dist/blocks/e-commerce/checkout-forms/checkbox-check.js +1 -1
- package/dist/blocks/e-commerce/checkout-forms/checkbox-check.js.map +1 -1
- package/dist/blocks/e-commerce/checkout-forms/checkbox-check.mjs +1 -1
- package/dist/blocks/e-commerce/checkout-forms/checkbox-check.mjs.map +1 -1
- package/dist/blocks/e-commerce/checkout-forms/checkout-address-equality.d.ts +11 -0
- package/dist/blocks/e-commerce/checkout-forms/checkout-address-equality.d.ts.map +1 -0
- package/dist/blocks/e-commerce/checkout-forms/checkout-address-equality.js +46 -0
- package/dist/blocks/e-commerce/checkout-forms/checkout-address-equality.js.map +1 -0
- package/dist/blocks/e-commerce/checkout-forms/checkout-address-equality.mjs +22 -0
- package/dist/blocks/e-commerce/checkout-forms/checkout-address-equality.mjs.map +1 -0
- package/dist/blocks/e-commerce/checkout-forms/checkout-address-fields.d.ts +28 -0
- package/dist/blocks/e-commerce/checkout-forms/checkout-address-fields.d.ts.map +1 -0
- package/dist/blocks/e-commerce/checkout-forms/checkout-address-fields.js +278 -0
- package/dist/blocks/e-commerce/checkout-forms/checkout-address-fields.js.map +1 -0
- package/dist/blocks/e-commerce/checkout-forms/checkout-address-fields.mjs +260 -0
- package/dist/blocks/e-commerce/checkout-forms/checkout-address-fields.mjs.map +1 -0
- package/dist/blocks/e-commerce/checkout-forms/checkout-contact-step.d.ts +12 -9
- package/dist/blocks/e-commerce/checkout-forms/checkout-contact-step.d.ts.map +1 -1
- package/dist/blocks/e-commerce/checkout-forms/checkout-contact-step.js +49 -71
- package/dist/blocks/e-commerce/checkout-forms/checkout-contact-step.js.map +1 -1
- package/dist/blocks/e-commerce/checkout-forms/checkout-contact-step.mjs +50 -72
- package/dist/blocks/e-commerce/checkout-forms/checkout-contact-step.mjs.map +1 -1
- package/dist/blocks/e-commerce/checkout-forms/checkout-country-field.d.ts.map +1 -1
- package/dist/blocks/e-commerce/checkout-forms/checkout-country-field.js +6 -3
- package/dist/blocks/e-commerce/checkout-forms/checkout-country-field.js.map +1 -1
- package/dist/blocks/e-commerce/checkout-forms/checkout-country-field.mjs +6 -3
- package/dist/blocks/e-commerce/checkout-forms/checkout-country-field.mjs.map +1 -1
- package/dist/blocks/e-commerce/checkout-forms/checkout-id-context.d.ts +7 -0
- package/dist/blocks/e-commerce/checkout-forms/checkout-id-context.d.ts.map +1 -0
- package/dist/blocks/e-commerce/checkout-forms/checkout-id-context.js +41 -0
- package/dist/blocks/e-commerce/checkout-forms/checkout-id-context.js.map +1 -0
- package/dist/blocks/e-commerce/checkout-forms/checkout-id-context.mjs +16 -0
- package/dist/blocks/e-commerce/checkout-forms/checkout-id-context.mjs.map +1 -0
- package/dist/blocks/e-commerce/checkout-forms/checkout-location-select.d.ts +24 -0
- package/dist/blocks/e-commerce/checkout-forms/checkout-location-select.d.ts.map +1 -0
- package/dist/blocks/e-commerce/checkout-forms/checkout-location-select.js +75 -0
- package/dist/blocks/e-commerce/checkout-forms/checkout-location-select.js.map +1 -0
- package/dist/blocks/e-commerce/checkout-forms/checkout-location-select.mjs +58 -0
- package/dist/blocks/e-commerce/checkout-forms/checkout-location-select.mjs.map +1 -0
- package/dist/blocks/e-commerce/checkout-forms/checkout-order-summary.d.ts +3 -2
- package/dist/blocks/e-commerce/checkout-forms/checkout-order-summary.d.ts.map +1 -1
- package/dist/blocks/e-commerce/checkout-forms/checkout-order-summary.js +9 -2
- package/dist/blocks/e-commerce/checkout-forms/checkout-order-summary.js.map +1 -1
- package/dist/blocks/e-commerce/checkout-forms/checkout-order-summary.mjs +9 -2
- package/dist/blocks/e-commerce/checkout-forms/checkout-order-summary.mjs.map +1 -1
- package/dist/blocks/e-commerce/checkout-forms/checkout-payment-step.d.ts +23 -8
- package/dist/blocks/e-commerce/checkout-forms/checkout-payment-step.d.ts.map +1 -1
- package/dist/blocks/e-commerce/checkout-forms/checkout-payment-step.js +136 -31
- package/dist/blocks/e-commerce/checkout-forms/checkout-payment-step.js.map +1 -1
- package/dist/blocks/e-commerce/checkout-forms/checkout-payment-step.mjs +143 -32
- package/dist/blocks/e-commerce/checkout-forms/checkout-payment-step.mjs.map +1 -1
- package/dist/blocks/e-commerce/checkout-forms/checkout-review-step.d.ts +13 -7
- package/dist/blocks/e-commerce/checkout-forms/checkout-review-step.d.ts.map +1 -1
- package/dist/blocks/e-commerce/checkout-forms/checkout-review-step.js +179 -28
- package/dist/blocks/e-commerce/checkout-forms/checkout-review-step.js.map +1 -1
- package/dist/blocks/e-commerce/checkout-forms/checkout-review-step.mjs +180 -29
- package/dist/blocks/e-commerce/checkout-forms/checkout-review-step.mjs.map +1 -1
- package/dist/blocks/e-commerce/checkout-forms/checkout-saved-addresses.d.ts +20 -0
- package/dist/blocks/e-commerce/checkout-forms/checkout-saved-addresses.d.ts.map +1 -0
- package/dist/blocks/e-commerce/checkout-forms/checkout-saved-addresses.js +199 -0
- package/dist/blocks/e-commerce/checkout-forms/checkout-saved-addresses.js.map +1 -0
- package/dist/blocks/e-commerce/checkout-forms/checkout-saved-addresses.mjs +175 -0
- package/dist/blocks/e-commerce/checkout-forms/checkout-saved-addresses.mjs.map +1 -0
- package/dist/blocks/e-commerce/checkout-forms/checkout-section-nav.d.ts +14 -0
- package/dist/blocks/e-commerce/checkout-forms/checkout-section-nav.d.ts.map +1 -0
- package/dist/blocks/e-commerce/checkout-forms/checkout-section-nav.js +136 -0
- package/dist/blocks/e-commerce/checkout-forms/checkout-section-nav.js.map +1 -0
- package/dist/blocks/e-commerce/checkout-forms/checkout-section-nav.mjs +109 -0
- package/dist/blocks/e-commerce/checkout-forms/checkout-section-nav.mjs.map +1 -0
- package/dist/blocks/e-commerce/checkout-forms/checkout-shipping-step.d.ts +32 -10
- package/dist/blocks/e-commerce/checkout-forms/checkout-shipping-step.d.ts.map +1 -1
- package/dist/blocks/e-commerce/checkout-forms/checkout-shipping-step.js +265 -147
- package/dist/blocks/e-commerce/checkout-forms/checkout-shipping-step.js.map +1 -1
- package/dist/blocks/e-commerce/checkout-forms/checkout-shipping-step.mjs +272 -148
- package/dist/blocks/e-commerce/checkout-forms/checkout-shipping-step.mjs.map +1 -1
- package/dist/blocks/e-commerce/checkout-forms/checkout-step-header.d.ts +13 -0
- package/dist/blocks/e-commerce/checkout-forms/checkout-step-header.d.ts.map +1 -0
- package/dist/blocks/e-commerce/checkout-forms/checkout-step-header.js +74 -0
- package/dist/blocks/e-commerce/checkout-forms/checkout-step-header.js.map +1 -0
- package/dist/blocks/e-commerce/checkout-forms/checkout-step-header.mjs +50 -0
- package/dist/blocks/e-commerce/checkout-forms/checkout-step-header.mjs.map +1 -0
- package/dist/blocks/e-commerce/checkout-forms/checkout-step-summary.d.ts +7 -0
- package/dist/blocks/e-commerce/checkout-forms/checkout-step-summary.d.ts.map +1 -0
- package/dist/blocks/e-commerce/checkout-forms/checkout-step-summary.js +91 -0
- package/dist/blocks/e-commerce/checkout-forms/checkout-step-summary.js.map +1 -0
- package/dist/blocks/e-commerce/checkout-forms/checkout-step-summary.mjs +65 -0
- package/dist/blocks/e-commerce/checkout-forms/checkout-step-summary.mjs.map +1 -0
- package/dist/blocks/e-commerce/checkout-forms/checkout.d.ts +174 -44
- package/dist/blocks/e-commerce/checkout-forms/checkout.d.ts.map +1 -1
- package/dist/blocks/e-commerce/checkout-forms/checkout.js +532 -108
- package/dist/blocks/e-commerce/checkout-forms/checkout.js.map +1 -1
- package/dist/blocks/e-commerce/checkout-forms/checkout.mjs +542 -109
- package/dist/blocks/e-commerce/checkout-forms/checkout.mjs.map +1 -1
- package/dist/blocks/e-commerce/navigation/storefront-navbar-cart-sheet.d.ts.map +1 -1
- package/dist/blocks/e-commerce/navigation/storefront-navbar-cart-sheet.js +44 -20
- package/dist/blocks/e-commerce/navigation/storefront-navbar-cart-sheet.js.map +1 -1
- package/dist/blocks/e-commerce/navigation/storefront-navbar-cart-sheet.mjs +44 -20
- package/dist/blocks/e-commerce/navigation/storefront-navbar-cart-sheet.mjs.map +1 -1
- package/dist/blocks/e-commerce/navigation/storefront-navbar.d.ts.map +1 -1
- package/dist/blocks/e-commerce/navigation/storefront-navbar.js +21 -10
- package/dist/blocks/e-commerce/navigation/storefront-navbar.js.map +1 -1
- package/dist/blocks/e-commerce/navigation/storefront-navbar.mjs +21 -10
- package/dist/blocks/e-commerce/navigation/storefront-navbar.mjs.map +1 -1
- package/dist/blocks/e-commerce/product-list/product-card.d.ts.map +1 -1
- package/dist/blocks/e-commerce/product-list/product-card.js +36 -9
- package/dist/blocks/e-commerce/product-list/product-card.js.map +1 -1
- package/dist/blocks/e-commerce/product-list/product-card.mjs +36 -9
- package/dist/blocks/e-commerce/product-list/product-card.mjs.map +1 -1
- package/dist/blocks/e-commerce/product-list/product-showcase-1.d.ts.map +1 -1
- package/dist/blocks/e-commerce/product-list/product-showcase-1.js +7 -2
- package/dist/blocks/e-commerce/product-list/product-showcase-1.js.map +1 -1
- package/dist/blocks/e-commerce/product-list/product-showcase-1.mjs +7 -2
- package/dist/blocks/e-commerce/product-list/product-showcase-1.mjs.map +1 -1
- package/dist/blocks/e-commerce/product-overview/product-quick-view-dialog.d.ts.map +1 -1
- package/dist/blocks/e-commerce/product-overview/product-quick-view-dialog.js +5 -1
- package/dist/blocks/e-commerce/product-overview/product-quick-view-dialog.js.map +1 -1
- package/dist/blocks/e-commerce/product-overview/product-quick-view-dialog.mjs +5 -1
- package/dist/blocks/e-commerce/product-overview/product-quick-view-dialog.mjs.map +1 -1
- package/dist/blocks/e-commerce/storefront-hero/storefront-hero.d.ts.map +1 -1
- package/dist/blocks/e-commerce/storefront-hero/storefront-hero.js +71 -51
- package/dist/blocks/e-commerce/storefront-hero/storefront-hero.js.map +1 -1
- package/dist/blocks/e-commerce/storefront-hero/storefront-hero.mjs +71 -51
- package/dist/blocks/e-commerce/storefront-hero/storefront-hero.mjs.map +1 -1
- package/dist/blocks/marketing/banners/banner-1.d.ts.map +1 -1
- package/dist/blocks/marketing/banners/banner-1.js +15 -27
- package/dist/blocks/marketing/banners/banner-1.js.map +1 -1
- package/dist/blocks/marketing/banners/banner-1.mjs +16 -28
- package/dist/blocks/marketing/banners/banner-1.mjs.map +1 -1
- package/dist/index.d.ts +16 -4
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +19 -0
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +13 -0
- package/dist/index.mjs.map +1 -1
- package/dist/lib/contracts/checkout-commerce-v1.d.ts +2350 -0
- package/dist/lib/contracts/checkout-commerce-v1.d.ts.map +1 -0
- package/dist/lib/contracts/checkout-commerce-v1.js +417 -0
- package/dist/lib/contracts/checkout-commerce-v1.js.map +1 -0
- package/dist/lib/contracts/checkout-commerce-v1.mjs +392 -0
- package/dist/lib/contracts/checkout-commerce-v1.mjs.map +1 -0
- package/dist/lib/contracts/marketplace-product-card.d.ts +324 -0
- package/dist/lib/contracts/marketplace-product-card.d.ts.map +1 -0
- package/dist/lib/contracts/marketplace-product-card.js +85 -0
- package/dist/lib/contracts/marketplace-product-card.js.map +1 -0
- package/dist/lib/contracts/marketplace-product-card.mjs +61 -0
- package/dist/lib/contracts/marketplace-product-card.mjs.map +1 -0
- package/dist/lib/contracts.d.ts +2289 -178
- package/dist/lib/contracts.d.ts.map +1 -1
- package/dist/lib/contracts.js +332 -25
- package/dist/lib/contracts.js.map +1 -1
- package/dist/lib/contracts.mjs +278 -5
- package/dist/lib/contracts.mjs.map +1 -1
- package/dist/lib/money-schema.d.ts +19 -0
- package/dist/lib/money-schema.d.ts.map +1 -0
- package/dist/lib/money-schema.js +33 -0
- package/dist/lib/money-schema.js.map +1 -0
- package/dist/lib/money-schema.mjs +9 -0
- package/dist/lib/money-schema.mjs.map +1 -0
- package/dist/lib/motion.d.ts +29 -0
- package/dist/lib/motion.d.ts.map +1 -0
- package/dist/lib/motion.js +65 -0
- package/dist/lib/motion.js.map +1 -0
- package/dist/lib/motion.mjs +41 -0
- package/dist/lib/motion.mjs.map +1 -0
- package/dist/ui/accordion.d.ts +3 -1
- package/dist/ui/accordion.d.ts.map +1 -1
- package/dist/ui/accordion.js +21 -5
- package/dist/ui/accordion.js.map +1 -1
- package/dist/ui/accordion.mjs +21 -5
- package/dist/ui/accordion.mjs.map +1 -1
- package/dist/ui/input-group.d.ts +1 -1
- package/package.json +18 -3
- package/dist/.tsbuildinfo +0 -1
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
"use client";
|
|
3
|
+
var __create = Object.create;
|
|
4
|
+
var __defProp = Object.defineProperty;
|
|
5
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
6
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
7
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
8
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
9
|
+
var __export = (target, all) => {
|
|
10
|
+
for (var name in all)
|
|
11
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
12
|
+
};
|
|
13
|
+
var __copyProps = (to, from, except, desc) => {
|
|
14
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
15
|
+
for (let key of __getOwnPropNames(from))
|
|
16
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
17
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
18
|
+
}
|
|
19
|
+
return to;
|
|
20
|
+
};
|
|
21
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
22
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
23
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
24
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
25
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
26
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
27
|
+
mod
|
|
28
|
+
));
|
|
29
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
30
|
+
var marketplace_product_card_exports = {};
|
|
31
|
+
__export(marketplace_product_card_exports, {
|
|
32
|
+
default: () => import_block.default
|
|
33
|
+
});
|
|
34
|
+
module.exports = __toCommonJS(marketplace_product_card_exports);
|
|
35
|
+
var import_block = __toESM(require("./block.js"));
|
|
36
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../src/blocks/designs/marketplace-product-card/index.tsx"],"sourcesContent":["'use client'\n\nexport { default } from './block'\nexport type { MarketplaceProductCardProps } from './block'\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAEA,mBAAwB;","names":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../src/blocks/designs/marketplace-product-card/index.tsx"],"sourcesContent":["'use client'\n\nexport { default } from './block'\nexport type { MarketplaceProductCardProps } from './block'\n"],"mappings":";AAEA,SAAS,WAAAA,gBAAe;","names":["default"]}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { MarketplaceProductCardData } from '../../../lib/contracts/marketplace-product-card';
|
|
2
|
+
type MarketplaceProductCardNumericData = Omit<MarketplaceProductCardData, "product"> & {
|
|
3
|
+
[K in keyof Pick<MarketplaceProductCardData, "product">]: Omit<NonNullable<MarketplaceProductCardData["product"]>, "variants"> & {
|
|
4
|
+
[K in keyof Pick<NonNullable<MarketplaceProductCardData["product"]>, "variants">]: Array<Omit<NonNullable<NonNullable<MarketplaceProductCardData["product"]>["variants"]>[number], "price" | "compareAtPrice"> & {
|
|
5
|
+
[K in keyof Pick<NonNullable<NonNullable<MarketplaceProductCardData["product"]>["variants"]>[number], "price">]: number;
|
|
6
|
+
} & {
|
|
7
|
+
[K in keyof Pick<NonNullable<NonNullable<MarketplaceProductCardData["product"]>["variants"]>[number], "compareAtPrice">]: number;
|
|
8
|
+
}>;
|
|
9
|
+
};
|
|
10
|
+
};
|
|
11
|
+
export declare function normalizeData(data: MarketplaceProductCardData): MarketplaceProductCardNumericData;
|
|
12
|
+
export {};
|
|
13
|
+
//# sourceMappingURL=normalize.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"normalize.d.ts","sourceRoot":"","sources":["../../../../src/blocks/designs/marketplace-product-card/normalize.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,iDAAiD,CAAA;AAEjG,KAAK,iCAAiC,GAAG,IAAI,CAAC,0BAA0B,EAAE,SAAS,CAAC,GAAG;KAAG,CAAC,IAAI,MAAM,IAAI,CAAC,0BAA0B,EAAE,SAAS,CAAC,GAAG,IAAI,CAAC,WAAW,CAAC,0BAA0B,CAAC,SAAS,CAAC,CAAC,EAAE,UAAU,CAAC,GAAG;SAAG,CAAC,IAAI,MAAM,IAAI,CAAC,WAAW,CAAC,0BAA0B,CAAC,SAAS,CAAC,CAAC,EAAE,UAAU,CAAC,GAAG,KAAK,CAAC,IAAI,CAAC,WAAW,CAAC,WAAW,CAAC,0BAA0B,CAAC,SAAS,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,MAAM,CAAC,EAAE,OAAO,GAAG,gBAAgB,CAAC,GAAG;aAAG,CAAC,IAAI,MAAM,IAAI,CAAC,WAAW,CAAC,WAAW,CAAC,0BAA0B,CAAC,SAAS,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,MAAM,CAAC,EAAE,OAAO,CAAC,GAAG,MAAM;SAAE,GAAG;aAAG,CAAC,IAAI,MAAM,IAAI,CAAC,WAAW,CAAC,WAAW,CAAC,0BAA0B,CAAC,SAAS,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,MAAM,CAAC,EAAE,gBAAgB,CAAC,GAAG,MAAM;SAAE,CAAC;KAAE;CAAE,CAAA;AAQprB,wBAAgB,aAAa,CAAC,IAAI,EAAE,0BAA0B,GAAG,iCAAiC,CAEjG"}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
var normalize_exports = {};
|
|
20
|
+
__export(normalize_exports, {
|
|
21
|
+
normalizeData: () => normalizeData
|
|
22
|
+
});
|
|
23
|
+
module.exports = __toCommonJS(normalize_exports);
|
|
24
|
+
function toFiniteAmount(amount) {
|
|
25
|
+
if (typeof amount !== "string" || amount.trim() === "") return Number.NaN;
|
|
26
|
+
const value = Number(amount);
|
|
27
|
+
return Number.isFinite(value) ? value : Number.NaN;
|
|
28
|
+
}
|
|
29
|
+
function normalizeData(data) {
|
|
30
|
+
return (({ product: __normalized0, ...__rest }) => ({ ...__rest, product: (({ variants: __normalized1, ...__rest2 }) => ({ ...__rest2, variants: __normalized1.map((item2) => (({ price: __normalized3, compareAtPrice: __normalized4, ...__rest3 }) => ({ ...__rest3, price: toFiniteAmount(__normalized3.amount), ...__normalized4 === void 0 ? {} : { compareAtPrice: toFiniteAmount(__normalized4.amount) } }))(item2)) }))(__normalized0) }))(data);
|
|
31
|
+
}
|
|
32
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
33
|
+
0 && (module.exports = {
|
|
34
|
+
normalizeData
|
|
35
|
+
});
|
|
36
|
+
//# sourceMappingURL=normalize.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../src/blocks/designs/marketplace-product-card/normalize.ts"],"sourcesContent":["import type { MarketplaceProductCardData } from '../../../lib/contracts/marketplace-product-card'\n\ntype MarketplaceProductCardNumericData = Omit<MarketplaceProductCardData, \"product\"> & { [K in keyof Pick<MarketplaceProductCardData, \"product\">]: Omit<NonNullable<MarketplaceProductCardData[\"product\"]>, \"variants\"> & { [K in keyof Pick<NonNullable<MarketplaceProductCardData[\"product\"]>, \"variants\">]: Array<Omit<NonNullable<NonNullable<MarketplaceProductCardData[\"product\"]>[\"variants\"]>[number], \"price\" | \"compareAtPrice\"> & { [K in keyof Pick<NonNullable<NonNullable<MarketplaceProductCardData[\"product\"]>[\"variants\"]>[number], \"price\">]: number } & { [K in keyof Pick<NonNullable<NonNullable<MarketplaceProductCardData[\"product\"]>[\"variants\"]>[number], \"compareAtPrice\">]: number }> } }\n\nfunction toFiniteAmount(amount: string): number {\n if (typeof amount !== 'string' || amount.trim() === '') return Number.NaN\n const value = Number(amount)\n return Number.isFinite(value) ? value : Number.NaN\n}\n\nexport function normalizeData(data: MarketplaceProductCardData): MarketplaceProductCardNumericData {\n return (({ product: __normalized0, ...__rest }) => ({ ...__rest, product: (({ variants: __normalized1, ...__rest }) => ({ ...__rest, variants: __normalized1.map((item2) => ((({ price: __normalized3, compareAtPrice: __normalized4, ...__rest }) => ({ ...__rest, price: toFiniteAmount(__normalized3.amount), ...(__normalized4 === undefined ? {} : { compareAtPrice: toFiniteAmount(__normalized4.amount) }) }))(item2))) }))(__normalized0) }))(data)\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAIA,SAAS,eAAe,QAAwB;AAC9C,MAAI,OAAO,WAAW,YAAY,OAAO,KAAK,MAAM,GAAI,QAAO,OAAO;AACtE,QAAM,QAAQ,OAAO,MAAM;AAC3B,SAAO,OAAO,SAAS,KAAK,IAAI,QAAQ,OAAO;AACjD;AAEO,SAAS,cAAc,MAAqE;AACjG,UAAQ,CAAC,EAAE,SAAS,eAAe,GAAG,OAAO,OAAO,EAAE,GAAG,QAAQ,UAAU,CAAC,EAAE,UAAU,eAAe,GAAGA,QAAO,OAAO,EAAE,GAAGA,SAAQ,UAAU,cAAc,IAAI,CAAC,WAAY,CAAC,EAAE,OAAO,eAAe,gBAAgB,eAAe,GAAGA,QAAO,OAAO,EAAE,GAAGA,SAAQ,OAAO,eAAe,cAAc,MAAM,GAAG,GAAI,kBAAkB,SAAY,CAAC,IAAI,EAAE,gBAAgB,eAAe,cAAc,MAAM,EAAE,EAAG,IAAI,KAAK,CAAE,EAAE,IAAI,aAAa,EAAE,IAAI,IAAI;AAC5b;","names":["__rest"]}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
function toFiniteAmount(amount) {
|
|
2
|
+
if (typeof amount !== "string" || amount.trim() === "") return Number.NaN;
|
|
3
|
+
const value = Number(amount);
|
|
4
|
+
return Number.isFinite(value) ? value : Number.NaN;
|
|
5
|
+
}
|
|
6
|
+
function normalizeData(data) {
|
|
7
|
+
return (({ product: __normalized0, ...__rest }) => ({ ...__rest, product: (({ variants: __normalized1, ...__rest2 }) => ({ ...__rest2, variants: __normalized1.map((item2) => (({ price: __normalized3, compareAtPrice: __normalized4, ...__rest3 }) => ({ ...__rest3, price: toFiniteAmount(__normalized3.amount), ...__normalized4 === void 0 ? {} : { compareAtPrice: toFiniteAmount(__normalized4.amount) } }))(item2)) }))(__normalized0) }))(data);
|
|
8
|
+
}
|
|
9
|
+
export {
|
|
10
|
+
normalizeData
|
|
11
|
+
};
|
|
12
|
+
//# sourceMappingURL=normalize.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../src/blocks/designs/marketplace-product-card/normalize.ts"],"sourcesContent":["import type { MarketplaceProductCardData } from '../../../lib/contracts/marketplace-product-card'\n\ntype MarketplaceProductCardNumericData = Omit<MarketplaceProductCardData, \"product\"> & { [K in keyof Pick<MarketplaceProductCardData, \"product\">]: Omit<NonNullable<MarketplaceProductCardData[\"product\"]>, \"variants\"> & { [K in keyof Pick<NonNullable<MarketplaceProductCardData[\"product\"]>, \"variants\">]: Array<Omit<NonNullable<NonNullable<MarketplaceProductCardData[\"product\"]>[\"variants\"]>[number], \"price\" | \"compareAtPrice\"> & { [K in keyof Pick<NonNullable<NonNullable<MarketplaceProductCardData[\"product\"]>[\"variants\"]>[number], \"price\">]: number } & { [K in keyof Pick<NonNullable<NonNullable<MarketplaceProductCardData[\"product\"]>[\"variants\"]>[number], \"compareAtPrice\">]: number }> } }\n\nfunction toFiniteAmount(amount: string): number {\n if (typeof amount !== 'string' || amount.trim() === '') return Number.NaN\n const value = Number(amount)\n return Number.isFinite(value) ? value : Number.NaN\n}\n\nexport function normalizeData(data: MarketplaceProductCardData): MarketplaceProductCardNumericData {\n return (({ product: __normalized0, ...__rest }) => ({ ...__rest, product: (({ variants: __normalized1, ...__rest }) => ({ ...__rest, variants: __normalized1.map((item2) => ((({ price: __normalized3, compareAtPrice: __normalized4, ...__rest }) => ({ ...__rest, price: toFiniteAmount(__normalized3.amount), ...(__normalized4 === undefined ? {} : { compareAtPrice: toFiniteAmount(__normalized4.amount) }) }))(item2))) }))(__normalized0) }))(data)\n}\n"],"mappings":"AAIA,SAAS,eAAe,QAAwB;AAC9C,MAAI,OAAO,WAAW,YAAY,OAAO,KAAK,MAAM,GAAI,QAAO,OAAO;AACtE,QAAM,QAAQ,OAAO,MAAM;AAC3B,SAAO,OAAO,SAAS,KAAK,IAAI,QAAQ,OAAO;AACjD;AAEO,SAAS,cAAc,MAAqE;AACjG,UAAQ,CAAC,EAAE,SAAS,eAAe,GAAG,OAAO,OAAO,EAAE,GAAG,QAAQ,UAAU,CAAC,EAAE,UAAU,eAAe,GAAGA,QAAO,OAAO,EAAE,GAAGA,SAAQ,UAAU,cAAc,IAAI,CAAC,WAAY,CAAC,EAAE,OAAO,eAAe,gBAAgB,eAAe,GAAGA,QAAO,OAAO,EAAE,GAAGA,SAAQ,OAAO,eAAe,cAAc,MAAM,GAAG,GAAI,kBAAkB,SAAY,CAAC,IAAI,EAAE,gBAAgB,eAAe,cAAc,MAAM,EAAE,EAAG,IAAI,KAAK,CAAE,EAAE,IAAI,aAAa,EAAE,IAAI,IAAI;AAC5b;","names":["__rest"]}
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
export type StockTone = 'success' | 'attention' | 'destructive';
|
|
2
|
+
export type OptionValue = {
|
|
3
|
+
id: string;
|
|
4
|
+
label: string;
|
|
5
|
+
image?: string;
|
|
6
|
+
imageAlt?: string;
|
|
7
|
+
};
|
|
8
|
+
export type ProductOption = {
|
|
9
|
+
id: string;
|
|
10
|
+
name: string;
|
|
11
|
+
kind: 'image' | 'text';
|
|
12
|
+
values: OptionValue[];
|
|
13
|
+
};
|
|
14
|
+
export type ProductVariant = {
|
|
15
|
+
id: string;
|
|
16
|
+
optionValueIds: Record<string, string>;
|
|
17
|
+
price: number;
|
|
18
|
+
compareAtPrice?: number;
|
|
19
|
+
image?: string;
|
|
20
|
+
imageAlt?: string;
|
|
21
|
+
available: boolean;
|
|
22
|
+
stockLabel: string;
|
|
23
|
+
stockTone: StockTone;
|
|
24
|
+
};
|
|
25
|
+
export type Product = {
|
|
26
|
+
id: string;
|
|
27
|
+
brand: string;
|
|
28
|
+
title: string;
|
|
29
|
+
badge: string;
|
|
30
|
+
rating: number;
|
|
31
|
+
reviewCount: number;
|
|
32
|
+
ratingLabel: string;
|
|
33
|
+
soldLabel: string;
|
|
34
|
+
shippingLabel: string;
|
|
35
|
+
deliveryLabel: string;
|
|
36
|
+
currency: string;
|
|
37
|
+
locale: string;
|
|
38
|
+
image?: string;
|
|
39
|
+
options: ProductOption[];
|
|
40
|
+
variants: ProductVariant[];
|
|
41
|
+
};
|
|
42
|
+
export type CardLabels = {
|
|
43
|
+
addToCart: string;
|
|
44
|
+
wishlistAdd: string;
|
|
45
|
+
wishlistRemove: string;
|
|
46
|
+
unavailableOption: string;
|
|
47
|
+
unavailablePrice: string;
|
|
48
|
+
outOfStock: string;
|
|
49
|
+
optionSeparator: string;
|
|
50
|
+
};
|
|
51
|
+
export type Glyphs = {
|
|
52
|
+
fullStar: string;
|
|
53
|
+
emptyStar: string;
|
|
54
|
+
heart: string;
|
|
55
|
+
heartFilled: string;
|
|
56
|
+
};
|
|
57
|
+
export type Selection = Record<string, string>;
|
|
58
|
+
export declare function matchesSelection(variant: ProductVariant, selection: Selection): boolean;
|
|
59
|
+
export declare function firstAvailableSelection(product: Product): Selection;
|
|
60
|
+
export declare function findVariant(product: Product, selection: Selection): ProductVariant | undefined;
|
|
61
|
+
export declare function findAvailableVariant(product: Product, selection: Selection): ProductVariant | undefined;
|
|
62
|
+
export declare function isValueDisabled(product: Product, selection: Selection, optionIndex: number, valueId: string): boolean;
|
|
63
|
+
export declare function selectValue(product: Product, selection: Selection, optionIndex: number, valueId: string): Selection;
|
|
64
|
+
export declare function firstNonEmpty(...values: Array<string | undefined>): string | undefined;
|
|
65
|
+
export declare function resolveVariantImage(product: Product, variant: ProductVariant | undefined, selection: Selection): {
|
|
66
|
+
src: string | undefined;
|
|
67
|
+
alt: string;
|
|
68
|
+
};
|
|
69
|
+
export declare function formatPrice(amount: number, locale: string, currency: string): string;
|
|
70
|
+
export declare function discountPercent(price: number, compareAtPrice?: number): number | null;
|
|
71
|
+
export declare function formatDiscount(percent: number, locale: string): string;
|
|
72
|
+
//# sourceMappingURL=variants.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"variants.d.ts","sourceRoot":"","sources":["../../../../src/blocks/designs/marketplace-product-card/variants.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,SAAS,GAAG,SAAS,GAAG,WAAW,GAAG,aAAa,CAAA;AAE/D,MAAM,MAAM,WAAW,GAAG;IACxB,EAAE,EAAE,MAAM,CAAA;IACV,KAAK,EAAE,MAAM,CAAA;IACb,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,QAAQ,CAAC,EAAE,MAAM,CAAA;CAClB,CAAA;AAED,MAAM,MAAM,aAAa,GAAG;IAC1B,EAAE,EAAE,MAAM,CAAA;IACV,IAAI,EAAE,MAAM,CAAA;IACZ,IAAI,EAAE,OAAO,GAAG,MAAM,CAAA;IACtB,MAAM,EAAE,WAAW,EAAE,CAAA;CACtB,CAAA;AAED,MAAM,MAAM,cAAc,GAAG;IAC3B,EAAE,EAAE,MAAM,CAAA;IACV,cAAc,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;IACtC,KAAK,EAAE,MAAM,CAAA;IACb,cAAc,CAAC,EAAE,MAAM,CAAA;IACvB,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,SAAS,EAAE,OAAO,CAAA;IAClB,UAAU,EAAE,MAAM,CAAA;IAClB,SAAS,EAAE,SAAS,CAAA;CACrB,CAAA;AAED,MAAM,MAAM,OAAO,GAAG;IACpB,EAAE,EAAE,MAAM,CAAA;IACV,KAAK,EAAE,MAAM,CAAA;IACb,KAAK,EAAE,MAAM,CAAA;IACb,KAAK,EAAE,MAAM,CAAA;IACb,MAAM,EAAE,MAAM,CAAA;IACd,WAAW,EAAE,MAAM,CAAA;IACnB,WAAW,EAAE,MAAM,CAAA;IACnB,SAAS,EAAE,MAAM,CAAA;IACjB,aAAa,EAAE,MAAM,CAAA;IACrB,aAAa,EAAE,MAAM,CAAA;IACrB,QAAQ,EAAE,MAAM,CAAA;IAChB,MAA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M,GACd,SAAS,CA0BX;AAED,wBAAgB,aAAa,CAAC,GAAG,MAAM,EAAE,KAAK,CAAC,MAAM,GAAG,SAAS,CAAC,GAAG,MAAM,GAAG,SAAS,CAOtF;AAED,wBAAgB,mBAAmB,CACjC,OAAO,EAAE,OAAO,EAChB,OAAO,EAAE,cAAc,GAAG,SAAS,EACnC,SAAS,EAAE,SAAS,GACnB;IAAE,GAAG,EAAE,MAAM,GAAG,SAAS,CAAC;IAAC,GAAG,EAAE,MAAM,CAAA;CAAE,CAW1C;AAED,wBAAgB,WAAW,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,MAAM,CAEpF;AAED,wBAAgB,eAAe,CAAC,KAAK,EAAE,MAAM,EAAE,cAAc,CAAC,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAGrF;AAED,wBAAgB,cAAc,CAAC,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,MAAM,CAKtE"}
|
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
var variants_exports = {};
|
|
20
|
+
__export(variants_exports, {
|
|
21
|
+
discountPercent: () => discountPercent,
|
|
22
|
+
findAvailableVariant: () => findAvailableVariant,
|
|
23
|
+
findVariant: () => findVariant,
|
|
24
|
+
firstAvailableSelection: () => firstAvailableSelection,
|
|
25
|
+
firstNonEmpty: () => firstNonEmpty,
|
|
26
|
+
formatDiscount: () => formatDiscount,
|
|
27
|
+
formatPrice: () => formatPrice,
|
|
28
|
+
isValueDisabled: () => isValueDisabled,
|
|
29
|
+
matchesSelection: () => matchesSelection,
|
|
30
|
+
resolveVariantImage: () => resolveVariantImage,
|
|
31
|
+
selectValue: () => selectValue
|
|
32
|
+
});
|
|
33
|
+
module.exports = __toCommonJS(variants_exports);
|
|
34
|
+
function matchesSelection(variant, selection) {
|
|
35
|
+
return Object.entries(selection).every(
|
|
36
|
+
([optionId, valueId]) => variant.optionValueIds[optionId] === valueId
|
|
37
|
+
);
|
|
38
|
+
}
|
|
39
|
+
function firstAvailableSelection(product) {
|
|
40
|
+
const variant = product.variants.find((candidate) => candidate.available) ?? product.variants[0];
|
|
41
|
+
return variant ? { ...variant.optionValueIds } : {};
|
|
42
|
+
}
|
|
43
|
+
function findVariant(product, selection) {
|
|
44
|
+
return product.variants.find((variant) => matchesSelection(variant, selection));
|
|
45
|
+
}
|
|
46
|
+
function findAvailableVariant(product, selection) {
|
|
47
|
+
return product.variants.find(
|
|
48
|
+
(variant) => variant.available && matchesSelection(variant, selection)
|
|
49
|
+
);
|
|
50
|
+
}
|
|
51
|
+
function isValueDisabled(product, selection, optionIndex, valueId) {
|
|
52
|
+
const option = product.options[optionIndex];
|
|
53
|
+
if (!option) return true;
|
|
54
|
+
const isLast = optionIndex === product.options.length - 1;
|
|
55
|
+
return !product.variants.some((variant) => {
|
|
56
|
+
if (!variant.available || variant.optionValueIds[option.id] !== valueId) return false;
|
|
57
|
+
if (!isLast) return true;
|
|
58
|
+
return product.options.slice(0, optionIndex).every((earlier) => variant.optionValueIds[earlier.id] === selection[earlier.id]);
|
|
59
|
+
});
|
|
60
|
+
}
|
|
61
|
+
function selectValue(product, selection, optionIndex, valueId) {
|
|
62
|
+
const option = product.options[optionIndex];
|
|
63
|
+
if (!option) return selection;
|
|
64
|
+
const next = { ...selection, [option.id]: valueId };
|
|
65
|
+
if (findAvailableVariant(product, next)) return next;
|
|
66
|
+
const earlier = product.options.slice(0, optionIndex + 1);
|
|
67
|
+
const matches = product.variants.filter(
|
|
68
|
+
(variant) => variant.available && earlier.every((entry) => variant.optionValueIds[entry.id] === next[entry.id])
|
|
69
|
+
);
|
|
70
|
+
if (matches.length === 0) return selection;
|
|
71
|
+
const preserved = (variant) => product.options.reduce(
|
|
72
|
+
(count, entry) => count + (variant.optionValueIds[entry.id] === selection[entry.id] ? 1 : 0),
|
|
73
|
+
0
|
|
74
|
+
);
|
|
75
|
+
const best = matches.reduce(
|
|
76
|
+
(current, candidate) => preserved(candidate) > preserved(current) ? candidate : current
|
|
77
|
+
);
|
|
78
|
+
return { ...best.optionValueIds };
|
|
79
|
+
}
|
|
80
|
+
function firstNonEmpty(...values) {
|
|
81
|
+
for (const value of values) {
|
|
82
|
+
if (typeof value !== "string") continue;
|
|
83
|
+
const trimmed = value.trim();
|
|
84
|
+
if (trimmed.length > 0) return trimmed;
|
|
85
|
+
}
|
|
86
|
+
return void 0;
|
|
87
|
+
}
|
|
88
|
+
function resolveVariantImage(product, variant, selection) {
|
|
89
|
+
const imageOption = product.options.find((option) => option.kind === "image");
|
|
90
|
+
const imageValue = imageOption ? imageOption.values.find((value) => value.id === selection[imageOption.id]) : void 0;
|
|
91
|
+
return {
|
|
92
|
+
src: firstNonEmpty(variant?.image, imageValue?.image, product.image),
|
|
93
|
+
alt: firstNonEmpty(variant?.imageAlt, imageValue?.imageAlt, product.title) ?? product.title
|
|
94
|
+
};
|
|
95
|
+
}
|
|
96
|
+
function formatPrice(amount, locale, currency) {
|
|
97
|
+
return new Intl.NumberFormat(locale, { style: "currency", currency }).format(amount);
|
|
98
|
+
}
|
|
99
|
+
function discountPercent(price, compareAtPrice) {
|
|
100
|
+
if (compareAtPrice === void 0 || compareAtPrice <= price) return null;
|
|
101
|
+
return Math.round((1 - price / compareAtPrice) * 100);
|
|
102
|
+
}
|
|
103
|
+
function formatDiscount(percent, locale) {
|
|
104
|
+
return new Intl.NumberFormat(locale, {
|
|
105
|
+
style: "percent",
|
|
106
|
+
maximumFractionDigits: 0
|
|
107
|
+
}).format(-percent / 100);
|
|
108
|
+
}
|
|
109
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
110
|
+
0 && (module.exports = {
|
|
111
|
+
discountPercent,
|
|
112
|
+
findAvailableVariant,
|
|
113
|
+
findVariant,
|
|
114
|
+
firstAvailableSelection,
|
|
115
|
+
firstNonEmpty,
|
|
116
|
+
formatDiscount,
|
|
117
|
+
formatPrice,
|
|
118
|
+
isValueDisabled,
|
|
119
|
+
matchesSelection,
|
|
120
|
+
resolveVariantImage,
|
|
121
|
+
selectValue
|
|
122
|
+
});
|
|
123
|
+
//# sourceMappingURL=variants.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../src/blocks/designs/marketplace-product-card/variants.ts"],"sourcesContent":["export type StockTone = 'success' | 'attention' | 'destructive'\n\nexport type OptionValue = {\n id: string\n label: string\n image?: string\n imageAlt?: string\n}\n\nexport type ProductOption = {\n id: string\n name: string\n kind: 'image' | 'text'\n values: OptionValue[]\n}\n\nexport type ProductVariant = {\n id: string\n optionValueIds: Record<string, string>\n price: number\n compareAtPrice?: number\n image?: string\n imageAlt?: string\n available: boolean\n stockLabel: string\n stockTone: StockTone\n}\n\nexport type Product = {\n id: string\n brand: string\n title: string\n badge: string\n rating: number\n reviewCount: number\n ratingLabel: string\n soldLabel: string\n shippingLabel: string\n deliveryLabel: string\n currency: string\n locale: string\n image?: string\n options: ProductOption[]\n variants: ProductVariant[]\n}\n\nexport type CardLabels = {\n addToCart: string\n wishlistAdd: string\n wishlistRemove: string\n unavailableOption: string\n unavailablePrice: string\n outOfStock: string\n optionSeparator: string\n}\n\nexport type Glyphs = {\n fullStar: string\n emptyStar: string\n heart: string\n heartFilled: string\n}\n\nexport type Selection = Record<string, string>\n\nexport function matchesSelection(variant: ProductVariant, selection: Selection): boolean {\n return Object.entries(selection).every(\n ([optionId, valueId]) => variant.optionValueIds[optionId] === valueId,\n )\n}\n\nexport function firstAvailableSelection(product: Product): Selection {\n const variant = product.variants.find((candidate) => candidate.available) ?? product.variants[0]\n return variant ? { ...variant.optionValueIds } : {}\n}\n\nexport function findVariant(product: Product, selection: Selection): ProductVariant | undefined {\n return product.variants.find((variant) => matchesSelection(variant, selection))\n}\n\nexport function findAvailableVariant(\n product: Product,\n selection: Selection,\n): ProductVariant | undefined {\n return product.variants.find(\n (variant) => variant.available && matchesSelection(variant, selection),\n )\n}\n\nexport function isValueDisabled(\n product: Product,\n selection: Selection,\n optionIndex: number,\n valueId: string,\n): boolean {\n const option = product.options[optionIndex]\n if (!option) return true\n\n const isLast = optionIndex === product.options.length - 1\n\n return !product.variants.some((variant) => {\n if (!variant.available || variant.optionValueIds[option.id] !== valueId) return false\n if (!isLast) return true\n\n return product.options\n .slice(0, optionIndex)\n .every((earlier) => variant.optionValueIds[earlier.id] === selection[earlier.id])\n })\n}\n\nexport function selectValue(\n product: Product,\n selection: Selection,\n optionIndex: number,\n valueId: string,\n): Selection {\n const option = product.options[optionIndex]\n if (!option) return selection\n\n const next = { ...selection, [option.id]: valueId }\n if (findAvailableVariant(product, next)) return next\n\n const earlier = product.options.slice(0, optionIndex + 1)\n const matches = product.variants.filter(\n (variant) =>\n variant.available &&\n earlier.every((entry) => variant.optionValueIds[entry.id] === next[entry.id]),\n )\n if (matches.length === 0) return selection\n\n const preserved = (variant: ProductVariant) =>\n product.options.reduce(\n (count, entry) =>\n count + (variant.optionValueIds[entry.id] === selection[entry.id] ? 1 : 0),\n 0,\n )\n\n const best = matches.reduce((current, candidate) =>\n preserved(candidate) > preserved(current) ? candidate : current,\n )\n return { ...best.optionValueIds }\n}\n\nexport function firstNonEmpty(...values: Array<string | undefined>): string | undefined {\n for (const value of values) {\n if (typeof value !== 'string') continue\n const trimmed = value.trim()\n if (trimmed.length > 0) return trimmed\n }\n return undefined\n}\n\nexport function resolveVariantImage(\n product: Product,\n variant: ProductVariant | undefined,\n selection: Selection,\n): { src: string | undefined; alt: string } {\n const imageOption = product.options.find((option) => option.kind === 'image')\n const imageValue = imageOption\n ? imageOption.values.find((value) => value.id === selection[imageOption.id])\n : undefined\n\n return {\n src: firstNonEmpty(variant?.image, imageValue?.image, product.image),\n alt:\n firstNonEmpty(variant?.imageAlt, imageValue?.imageAlt, product.title) ?? product.title,\n }\n}\n\nexport function formatPrice(amount: number, locale: string, currency: string): string {\n return new Intl.NumberFormat(locale, { style: 'currency', currency }).format(amount)\n}\n\nexport function discountPercent(price: number, compareAtPrice?: number): number | null {\n if (compareAtPrice === undefined || compareAtPrice <= price) return null\n return Math.round((1 - price / compareAtPrice) * 100)\n}\n\nexport function formatDiscount(percent: number, locale: string): string {\n return new Intl.NumberFormat(locale, {\n style: 'percent',\n maximumFractionDigits: 0,\n }).format(-percent / 100)\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAiEO,SAAS,iBAAiB,SAAyB,WAA+B;AACvF,SAAO,OAAO,QAAQ,SAAS,EAAE;AAAA,IAC/B,CAAC,CAAC,UAAU,OAAO,MAAM,QAAQ,eAAe,QAAQ,MAAM;AAAA,EAChE;AACF;AAEO,SAAS,wBAAwB,SAA6B;AACnE,QAAM,UAAU,QAAQ,SAAS,KAAK,CAAC,cAAc,UAAU,SAAS,KAAK,QAAQ,SAAS,CAAC;AAC/F,SAAO,UAAU,EAAE,GAAG,QAAQ,eAA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CAAC,UAAU,GAAG;AAC1B;","names":[]}
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
function matchesSelection(variant, selection) {
|
|
2
|
+
return Object.entries(selection).every(
|
|
3
|
+
([optionId, valueId]) => variant.optionValueIds[optionId] === valueId
|
|
4
|
+
);
|
|
5
|
+
}
|
|
6
|
+
function firstAvailableSelection(product) {
|
|
7
|
+
const variant = product.variants.find((candidate) => candidate.available) ?? product.variants[0];
|
|
8
|
+
return variant ? { ...variant.optionValueIds } : {};
|
|
9
|
+
}
|
|
10
|
+
function findVariant(product, selection) {
|
|
11
|
+
return product.variants.find((variant) => matchesSelection(variant, selection));
|
|
12
|
+
}
|
|
13
|
+
function findAvailableVariant(product, selection) {
|
|
14
|
+
return product.variants.find(
|
|
15
|
+
(variant) => variant.available && matchesSelection(variant, selection)
|
|
16
|
+
);
|
|
17
|
+
}
|
|
18
|
+
function isValueDisabled(product, selection, optionIndex, valueId) {
|
|
19
|
+
const option = product.options[optionIndex];
|
|
20
|
+
if (!option) return true;
|
|
21
|
+
const isLast = optionIndex === product.options.length - 1;
|
|
22
|
+
return !product.variants.some((variant) => {
|
|
23
|
+
if (!variant.available || variant.optionValueIds[option.id] !== valueId) return false;
|
|
24
|
+
if (!isLast) return true;
|
|
25
|
+
return product.options.slice(0, optionIndex).every((earlier) => variant.optionValueIds[earlier.id] === selection[earlier.id]);
|
|
26
|
+
});
|
|
27
|
+
}
|
|
28
|
+
function selectValue(product, selection, optionIndex, valueId) {
|
|
29
|
+
const option = product.options[optionIndex];
|
|
30
|
+
if (!option) return selection;
|
|
31
|
+
const next = { ...selection, [option.id]: valueId };
|
|
32
|
+
if (findAvailableVariant(product, next)) return next;
|
|
33
|
+
const earlier = product.options.slice(0, optionIndex + 1);
|
|
34
|
+
const matches = product.variants.filter(
|
|
35
|
+
(variant) => variant.available && earlier.every((entry) => variant.optionValueIds[entry.id] === next[entry.id])
|
|
36
|
+
);
|
|
37
|
+
if (matches.length === 0) return selection;
|
|
38
|
+
const preserved = (variant) => product.options.reduce(
|
|
39
|
+
(count, entry) => count + (variant.optionValueIds[entry.id] === selection[entry.id] ? 1 : 0),
|
|
40
|
+
0
|
|
41
|
+
);
|
|
42
|
+
const best = matches.reduce(
|
|
43
|
+
(current, candidate) => preserved(candidate) > preserved(current) ? candidate : current
|
|
44
|
+
);
|
|
45
|
+
return { ...best.optionValueIds };
|
|
46
|
+
}
|
|
47
|
+
function firstNonEmpty(...values) {
|
|
48
|
+
for (const value of values) {
|
|
49
|
+
if (typeof value !== "string") continue;
|
|
50
|
+
const trimmed = value.trim();
|
|
51
|
+
if (trimmed.length > 0) return trimmed;
|
|
52
|
+
}
|
|
53
|
+
return void 0;
|
|
54
|
+
}
|
|
55
|
+
function resolveVariantImage(product, variant, selection) {
|
|
56
|
+
const imageOption = product.options.find((option) => option.kind === "image");
|
|
57
|
+
const imageValue = imageOption ? imageOption.values.find((value) => value.id === selection[imageOption.id]) : void 0;
|
|
58
|
+
return {
|
|
59
|
+
src: firstNonEmpty(variant?.image, imageValue?.image, product.image),
|
|
60
|
+
alt: firstNonEmpty(variant?.imageAlt, imageValue?.imageAlt, product.title) ?? product.title
|
|
61
|
+
};
|
|
62
|
+
}
|
|
63
|
+
function formatPrice(amount, locale, currency) {
|
|
64
|
+
return new Intl.NumberFormat(locale, { style: "currency", currency }).format(amount);
|
|
65
|
+
}
|
|
66
|
+
function discountPercent(price, compareAtPrice) {
|
|
67
|
+
if (compareAtPrice === void 0 || compareAtPrice <= price) return null;
|
|
68
|
+
return Math.round((1 - price / compareAtPrice) * 100);
|
|
69
|
+
}
|
|
70
|
+
function formatDiscount(percent, locale) {
|
|
71
|
+
return new Intl.NumberFormat(locale, {
|
|
72
|
+
style: "percent",
|
|
73
|
+
maximumFractionDigits: 0
|
|
74
|
+
}).format(-percent / 100);
|
|
75
|
+
}
|
|
76
|
+
export {
|
|
77
|
+
discountPercent,
|
|
78
|
+
findAvailableVariant,
|
|
79
|
+
findVariant,
|
|
80
|
+
firstAvailableSelection,
|
|
81
|
+
firstNonEmpty,
|
|
82
|
+
formatDiscount,
|
|
83
|
+
formatPrice,
|
|
84
|
+
isValueDisabled,
|
|
85
|
+
matchesSelection,
|
|
86
|
+
resolveVariantImage,
|
|
87
|
+
selectValue
|
|
88
|
+
};
|
|
89
|
+
//# sourceMappingURL=variants.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../src/blocks/designs/marketplace-product-card/variants.ts"],"sourcesContent":["export type StockTone = 'success' | 'attention' | 'destructive'\n\nexport type OptionValue = {\n id: string\n label: string\n image?: string\n imageAlt?: string\n}\n\nexport type ProductOption = {\n id: string\n name: string\n kind: 'image' | 'text'\n values: OptionValue[]\n}\n\nexport type ProductVariant = {\n id: string\n optionValueIds: Record<string, string>\n price: number\n compareAtPrice?: number\n image?: string\n imageAlt?: string\n available: boolean\n stockLabel: string\n stockTone: StockTone\n}\n\nexport type Product = {\n id: string\n brand: string\n title: string\n badge: string\n rating: number\n reviewCount: number\n ratingLabel: string\n soldLabel: string\n shippingLabel: string\n deliveryLabel: string\n currency: string\n locale: string\n image?: string\n options: ProductOption[]\n variants: ProductVariant[]\n}\n\nexport type CardLabels = {\n addToCart: string\n wishlistAdd: string\n wishlistRemove: string\n unavailableOption: string\n unavailablePrice: string\n outOfStock: string\n optionSeparator: string\n}\n\nexport type Glyphs = {\n fullStar: string\n emptyStar: string\n heart: string\n heartFilled: string\n}\n\nexport type Selection = Record<string, string>\n\nexport function matchesSelection(variant: ProductVariant, selection: Selection): boolean {\n return Object.entries(selection).every(\n ([optionId, valueId]) => variant.optionValueIds[optionId] === valueId,\n )\n}\n\nexport function firstAvailableSelection(product: Product): Selection {\n const variant = product.variants.find((candidate) => candidate.available) ?? product.variants[0]\n return variant ? { ...variant.optionValueIds } : {}\n}\n\nexport function findVariant(product: Product, selection: Selection): ProductVariant | undefined {\n return product.variants.find((variant) => matchesSelection(variant, selection))\n}\n\nexport function findAvailableVariant(\n product: Product,\n selection: Selection,\n): ProductVariant | undefined {\n return product.variants.find(\n (variant) => variant.available && matchesSelection(variant, selection),\n )\n}\n\nexport function isValueDisabled(\n product: Product,\n selection: Selection,\n optionIndex: number,\n valueId: string,\n): boolean {\n const option = product.options[optionIndex]\n if (!option) return true\n\n const isLast = optionIndex === product.options.length - 1\n\n return !product.variants.some((variant) => {\n if (!variant.available || variant.optionValueIds[option.id] !== valueId) return false\n if (!isLast) return true\n\n return product.options\n .slice(0, optionIndex)\n .every((earlier) => variant.optionValueIds[earlier.id] === selection[earlier.id])\n })\n}\n\nexport function selectValue(\n product: Product,\n selection: Selection,\n optionIndex: number,\n valueId: string,\n): Selection {\n const option = product.options[optionIndex]\n if (!option) return selection\n\n const next = { ...selection, [option.id]: valueId }\n if (findAvailableVariant(product, next)) return next\n\n const earlier = product.options.slice(0, optionIndex + 1)\n const matches = product.variants.filter(\n (variant) =>\n variant.available &&\n earlier.every((entry) => variant.optionValueIds[entry.id] === next[entry.id]),\n )\n if (matches.length === 0) return selection\n\n const preserved = (variant: ProductVariant) =>\n product.options.reduce(\n (count, entry) =>\n count + (variant.optionValueIds[entry.id] === selection[entry.id] ? 1 : 0),\n 0,\n )\n\n const best = matches.reduce((current, candidate) =>\n preserved(candidate) > preserved(current) ? candidate : current,\n )\n return { ...best.optionValueIds }\n}\n\nexport function firstNonEmpty(...values: Array<string | undefined>): string | undefined {\n for (const value of values) {\n if (typeof value !== 'string') continue\n const trimmed = value.trim()\n if (trimmed.length > 0) return trimmed\n }\n return undefined\n}\n\nexport function resolveVariantImage(\n product: Product,\n variant: ProductVariant | undefined,\n selection: Selection,\n): { src: string | undefined; alt: string } {\n const imageOption = product.options.find((option) => option.kind === 'image')\n const imageValue = imageOption\n ? imageOption.values.find((value) => value.id === selection[imageOption.id])\n : undefined\n\n return {\n src: firstNonEmpty(variant?.image, imageValue?.image, product.image),\n alt:\n firstNonEmpty(variant?.imageAlt, imageValue?.imageAlt, product.title) ?? product.title,\n }\n}\n\nexport function formatPrice(amount: number, locale: string, currency: string): string {\n return new Intl.NumberFormat(locale, { style: 'currency', currency }).format(amount)\n}\n\nexport function discountPercent(price: number, compareAtPrice?: number): number | null {\n if (compareAtPrice === undefined || compareAtPrice <= price) return null\n return Math.round((1 - price / compareAtPrice) * 100)\n}\n\nexport function formatDiscount(percent: number, locale: string): string {\n return new Intl.NumberFormat(locale, {\n style: 'percent',\n maximumFractionDigits: 0,\n }).format(-percent / 100)\n}\n"],"mappings":"AAiEO,SAAS,iBAAiB,SAAyB,WAA+B;AACvF,SAAO,OAAO,QAAQ,SAAS,EAAE;AAAA,IAC/B,CAAC,CAAC,UAAU,OAAO,MAAM,QAAQ,eAAe,QAAQ,MAAM;AAAA,EAChE;AACF;AAEO,SAAS,wBAAwB,SAA6B;AACnE,QAAM,UAAU,QAAQ,SAAS,KAAK,CAAC,cAAc,UAAU,SAAS,KAAK,QAAQ,SAAS,CAAC;AAC/F,SAAO,UAAU,EAAE,GAAG,QAAQ,eAAe,IAAI,CAAC;AACpD;AAEO,SAAS,YAAY,SAAkB,WAAkD;AAC9F,SAAO,QAAQ,SAAS,KAAK,CAAC,YAAY,iBAAiB,SAAS,SAAS,CAAC;AAChF;AAEO,SAAS,qBACd,SACA,WAC4B;AAC5B,SAAO,QAAQ,SAAS;AAAA,IACtB,CAAC,YAAY,QAAQ,aAAa,iBAAiB,SAAS,SAAS;AAAA,EACvE;AACF;AAEO,SAAS,gBACd,SACA,WACA,aACA,SACS;AACT,QAAM,SAAS,QAAQ,QAAQ,WAAW;AAC1C,MAAI,CAAC,OAAQ,QAAO;AAEpB,QAAM,SAAS,gBAAgB,QAAQ,QAAQ,SAAS;AAExD,SAAO,CAAC,QAAQ,SAAS,KAAK,CAAC,YAAY;AACzC,QAAI,CAAC,QAAQ,aAAa,QAAQ,eAAe,OAAO,EAAE,MAAM,QAAS,QAAO;AAChF,QAAI,CAAC,OAAQ,QAAO;AAEpB,WAAO,QAAQ,QACZ,MAAM,GAAG,WAAW,EAC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MAAM,OAAO,UAAU,YAAY,EAAE,CAAC,IACzE;AAEJ,SAAO;AAAA,IACL,KAAK,cAAc,SAAS,OAAO,YAAY,OAAO,QAAQ,KAAK;AAAA,IACnE,KACE,cAAc,SAAS,UAAU,YAAY,UAAU,QAAQ,KAAK,KAAK,QAAQ;AAAA,EACrF;AACF;AAEO,SAAS,YAAY,QAAgB,QAAgB,UAA0B;AACpF,SAAO,IAAI,KAAK,aAAa,QAAQ,EAAE,OAAO,YAAY,SAAS,CAAC,EAAE,OAAO,MAAM;AACrF;AAEO,SAAS,gBAAgB,OAAe,gBAAwC;AACrF,MAAI,mBAAmB,UAAa,kBAAkB,MAAO,QAAO;AACpE,SAAO,KAAK,OAAO,IAAI,QAAQ,kBAAkB,GAAG;AACtD;AAEO,SAAS,eAAe,SAAiB,QAAwB;AACtE,SAAO,IAAI,KAAK,aAAa,QAAQ;AAAA,IACnC,OAAO;AAAA,IACP,uBAAuB;AAAA,EACzB,CAAC,EAAE,OAAO,CAAC,UAAU,GAAG;AAC1B;","names":[]}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
/** The bounded account page shapes. `sidebar` is deliberately not offered. */
|
|
2
|
+
export type AccountFramePresentation = 'stack' | 'tabs';
|
|
3
|
+
/** One account module the host has installed and mounted. */
|
|
4
|
+
export interface AccountModule {
|
|
5
|
+
/** Stable module id; used as the anchor/tab id and reported on selection. */
|
|
6
|
+
id: string;
|
|
7
|
+
/** Visible navigation label. */
|
|
8
|
+
label: string;
|
|
9
|
+
/** Optional explicit destination; the stacked shape defaults to `#<id>`. */
|
|
10
|
+
href?: string;
|
|
11
|
+
}
|
|
12
|
+
/** Every user-facing string the frame renders. */
|
|
13
|
+
export interface AccountFrameLabels {
|
|
14
|
+
title: string;
|
|
15
|
+
navLabel: string;
|
|
16
|
+
}
|
|
17
|
+
export interface AccountFrameProps {
|
|
18
|
+
/** Display name supplied by the host (never fetched by the block). */
|
|
19
|
+
displayName: string;
|
|
20
|
+
/** Optional email; omitted when absent, never rendered as an empty element. */
|
|
21
|
+
email?: string;
|
|
22
|
+
/** Installed modules, in render order. */
|
|
23
|
+
modules: AccountModule[];
|
|
24
|
+
/** The module currently shown in the tabbed shape. */
|
|
25
|
+
activeModule?: string;
|
|
26
|
+
presentation?: AccountFramePresentation;
|
|
27
|
+
labels?: Partial<AccountFrameLabels>;
|
|
28
|
+
/** Report a module selection; the host owns the active module. */
|
|
29
|
+
onSelectModule?: (id: string) => void;
|
|
30
|
+
className?: string;
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* The account surface header: shopper identity plus module navigation. The block
|
|
34
|
+
* renders exactly what the host supplies — no order counts, rewards, or other
|
|
35
|
+
* invented metrics — and owns no state: the active module is host-controlled.
|
|
36
|
+
*/
|
|
37
|
+
export declare function AccountFrame({ displayName, email, modules, activeModule, presentation, labels, onSelectModule, className, }: AccountFrameProps): import("react").JSX.Element;
|
|
38
|
+
//# sourceMappingURL=account-frame.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"account-frame.d.ts","sourceRoot":"","sources":["../../../../src/blocks/e-commerce/account/account-frame.tsx"],"names":[],"mappings":"AAMA,8EAA8E;AAC9E,MAAM,MAAM,wBAAwB,GAAG,OAAO,GAAG,MAAM,CAAA;AAEvD,6DAA6D;AAC7D,MAAM,WAAW,aAAa;IAC5B,6EAA6E;IAC7E,EAAE,EAAE,MAAM,CAAA;IACV,gCAAgC;IAChC,KAAK,EAAE,MAAM,CAAA;IACb,4EAA4E;IAC5E,IAAI,CAAC,EAAE,MAAM,CAAA;CACd;AAED,kDAAkD;AAClD,MAAM,WAAW,kBAAkB;IACjC,KAAK,EAAE,MAAM,CAAA;IACb,QAAQ,EAAE,MAAM,CAAA;CACjB;AAOD,MAAM,WAAW,iBAAiB;IAChC,sEAAsE;IACtE,WAAW,EAAE,MAAM,CAAA;IACnB,+EAA+E;IAC/E,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,0CAA0C;IAC1C,OAAO,EAAE,aAAa,EAAE,CAAA;IACxB,sDAAsD;IACtD,YAAY,CAAC,EAAE,MAAM,CAAA;IACrB,YAAY,CAAC,EAAE,wBAAwB,CAAA;IACvC,MAAM,CAAC,EAAE,OAAO,CAAC,kBAAkB,CAAC,CAAA;IACpC,kEAAkE;IAClE,cAAc,CAAC,EAAE,CAAC,EAAE,EAAE,MAAM,KAAK,IAAI,CAAA;IACrC,SAAS,CAAC,EAAE,MAAM,CAAA;CACnB;AAED;;;;GAIG;AACH,wBAAgB,YAAY,CAAC,EAC3B,WAAW,EACX,KAAK,EACL,OAAO,EACP,YAAY,EACZ,YAAsB,EACtB,MAAM,EACN,cAAc,EACd,SAAS,GACV,EAAE,iBAAiB,+BAoFnB"}
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
"use client";
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
+
var __export = (target, all) => {
|
|
8
|
+
for (var name in all)
|
|
9
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
10
|
+
};
|
|
11
|
+
var __copyProps = (to, from, except, desc) => {
|
|
12
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
13
|
+
for (let key of __getOwnPropNames(from))
|
|
14
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
15
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
16
|
+
}
|
|
17
|
+
return to;
|
|
18
|
+
};
|
|
19
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
20
|
+
var account_frame_exports = {};
|
|
21
|
+
__export(account_frame_exports, {
|
|
22
|
+
AccountFrame: () => AccountFrame
|
|
23
|
+
});
|
|
24
|
+
module.exports = __toCommonJS(account_frame_exports);
|
|
25
|
+
var import_jsx_runtime = require("react/jsx-runtime");
|
|
26
|
+
var import_react = require("react");
|
|
27
|
+
var import_utils = require("../../../lib/utils.js");
|
|
28
|
+
const defaultLabels = {
|
|
29
|
+
title: "Mi cuenta",
|
|
30
|
+
navLabel: "Secciones de la cuenta"
|
|
31
|
+
};
|
|
32
|
+
function AccountFrame({
|
|
33
|
+
displayName,
|
|
34
|
+
email,
|
|
35
|
+
modules,
|
|
36
|
+
activeModule,
|
|
37
|
+
presentation = "stack",
|
|
38
|
+
labels,
|
|
39
|
+
onSelectModule,
|
|
40
|
+
className
|
|
41
|
+
}) {
|
|
42
|
+
if (presentation !== "stack" && presentation !== "tabs") {
|
|
43
|
+
throw new Error(
|
|
44
|
+
`AccountFrame does not support presentation "${String(presentation)}". Use "stack" or "tabs".`
|
|
45
|
+
);
|
|
46
|
+
}
|
|
47
|
+
const copy = { ...defaultLabels, ...labels };
|
|
48
|
+
const tabRefs = (0, import_react.useRef)([]);
|
|
49
|
+
const moveSelection = (event) => {
|
|
50
|
+
if (!["ArrowRight", "ArrowLeft", "Home", "End"].includes(event.key)) return;
|
|
51
|
+
event.preventDefault();
|
|
52
|
+
const current = Math.max(
|
|
53
|
+
0,
|
|
54
|
+
modules.findIndex((module2) => module2.id === activeModule)
|
|
55
|
+
);
|
|
56
|
+
const next = event.key === "Home" ? 0 : event.key === "End" ? modules.length - 1 : event.key === "ArrowRight" ? (current + 1) % modules.length : (current - 1 + modules.length) % modules.length;
|
|
57
|
+
onSelectModule?.(modules[next].id);
|
|
58
|
+
tabRefs.current[next]?.focus();
|
|
59
|
+
};
|
|
60
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("header", { className: (0, import_utils.cn)("border-b pb-6", className), children: [
|
|
61
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { className: "text-muted-foreground text-sm", children: copy.title }),
|
|
62
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("h1", { className: "mt-1 text-2xl font-bold tracking-tight sm:text-3xl", children: displayName }),
|
|
63
|
+
email ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { className: "text-muted-foreground mt-1 text-sm", children: email }) : null,
|
|
64
|
+
modules.length > 0 ? presentation === "stack" ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)("nav", { "aria-label": copy.navLabel, className: "mt-6", children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("ul", { className: "flex flex-wrap gap-x-6 gap-y-2", children: modules.map((module2) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)("li", { children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
65
|
+
"a",
|
|
66
|
+
{
|
|
67
|
+
href: module2.href ?? `#${module2.id}`,
|
|
68
|
+
"aria-current": module2.id === activeModule ? "true" : void 0,
|
|
69
|
+
className: "hover:text-foreground text-muted-foreground text-sm font-medium underline-offset-4 hover:underline",
|
|
70
|
+
children: module2.label
|
|
71
|
+
}
|
|
72
|
+
) }, module2.id)) }) }) : /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { role: "tablist", "aria-label": copy.navLabel, className: "mt-6 flex flex-wrap gap-2", onKeyDown: moveSelection, children: modules.map((module2) => {
|
|
73
|
+
const selected = module2.id === activeModule;
|
|
74
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
75
|
+
"button",
|
|
76
|
+
{
|
|
77
|
+
ref: (node) => {
|
|
78
|
+
tabRefs.current[modules.indexOf(module2)] = node;
|
|
79
|
+
},
|
|
80
|
+
type: "button",
|
|
81
|
+
role: "tab",
|
|
82
|
+
id: `account-tab-${module2.id}`,
|
|
83
|
+
"aria-selected": selected,
|
|
84
|
+
"aria-controls": `account-panel-${module2.id}`,
|
|
85
|
+
tabIndex: selected ? 0 : -1,
|
|
86
|
+
onClick: () => onSelectModule?.(module2.id),
|
|
87
|
+
className: (0, import_utils.cn)(
|
|
88
|
+
"rounded-md border px-3 py-2 text-sm font-medium transition-colors",
|
|
89
|
+
selected ? "bg-foreground text-background border-transparent" : "hover:bg-muted border-border bg-transparent"
|
|
90
|
+
),
|
|
91
|
+
children: module2.label
|
|
92
|
+
},
|
|
93
|
+
module2.id
|
|
94
|
+
);
|
|
95
|
+
}) }) : null
|
|
96
|
+
] });
|
|
97
|
+
}
|
|
98
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
99
|
+
0 && (module.exports = {
|
|
100
|
+
AccountFrame
|
|
101
|
+
});
|
|
102
|
+
//# sourceMappingURL=account-frame.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../src/blocks/e-commerce/account/account-frame.tsx"],"sourcesContent":["'use client'\n\nimport { useRef } from 'react'\nimport type { KeyboardEvent } from 'react'\nimport { cn } from '../../../lib/utils'\n\n/** The bounded account page shapes. `sidebar` is deliberately not offered. */\nexport type AccountFramePresentation = 'stack' | 'tabs'\n\n/** One account module the host has installed and mounted. */\nexport interface AccountModule {\n /** Stable module id; used as the anchor/tab id and reported on selection. */\n id: string\n /** Visible navigation label. */\n label: string\n /** Optional explicit destination; the stacked shape defaults to `#<id>`. */\n href?: string\n}\n\n/** Every user-facing string the frame renders. */\nexport interface AccountFrameLabels {\n title: string\n navLabel: string\n}\n\nconst defaultLabels: AccountFrameLabels = {\n title: 'Mi cuenta',\n navLabel: 'Secciones de la cuenta',\n}\n\nexport interface AccountFrameProps {\n /** Display name supplied by the host (never fetched by the block). */\n displayName: string\n /** Optional email; omitted when absent, never rendered as an empty element. */\n email?: string\n /** Installed modules, in render order. */\n modules: AccountModule[]\n /** The module currently shown in the tabbed shape. */\n activeModule?: string\n presentation?: AccountFramePresentation\n labels?: Partial<AccountFrameLabels>\n /** Report a module selection; the host owns the active module. */\n onSelectModule?: (id: string) => void\n className?: string\n}\n\n/**\n * The account surface header: shopper identity plus module navigation. The block\n * renders exactly what the host supplies — no order counts, rewards, or other\n * invented metrics — and owns no state: the active module is host-controlled.\n */\nexport function AccountFrame({\n displayName,\n email,\n modules,\n activeModule,\n presentation = 'stack',\n labels,\n onSelectModule,\n className,\n}: AccountFrameProps) {\n if (presentation !== 'stack' && presentation !== 'tabs') {\n throw new Error(\n `AccountFrame does not support presentation \"${String(presentation)}\". Use \"stack\" or \"tabs\".`,\n )\n }\n const copy = { ...defaultLabels, ...labels }\n const tabRefs = useRef<Array<HTMLButtonElement | null>>([])\n\n const moveSelection = (event: KeyboardEvent<HTMLDivElement>) => {\n if (!['ArrowRight', 'ArrowLeft', 'Home', 'End'].includes(event.key)) return\n event.preventDefault()\n const current = Math.max(\n 0,\n modules.findIndex((module) => module.id === activeModule),\n )\n const next =\n event.key === 'Home'\n ? 0\n : event.key === 'End'\n ? modules.length - 1\n : event.key === 'ArrowRight'\n ? (current + 1) % modules.length\n : (current - 1 + modules.length) % modules.length\n onSelectModule?.(modules[next].id)\n tabRefs.current[next]?.focus()\n }\n\n return (\n <header className={cn('border-b pb-6', className)}>\n <p className=\"text-muted-foreground text-sm\">{copy.title}</p>\n <h1 className=\"mt-1 text-2xl font-bold tracking-tight sm:text-3xl\">{displayName}</h1>\n {email ? <p className=\"text-muted-foreground mt-1 text-sm\">{email}</p> : null}\n\n {modules.length > 0 ? (\n presentation === 'stack' ? (\n <nav aria-label={copy.navLabel} className=\"mt-6\">\n <ul className=\"flex flex-wrap gap-x-6 gap-y-2\">\n {modules.map((module) => (\n <li key={module.id}>\n <a\n href={module.href ?? `#${module.id}`}\n aria-current={module.id === activeModule ? 'true' : undefined}\n className=\"hover:text-foreground text-muted-foreground text-sm font-medium underline-offset-4 hover:underline\"\n >\n {module.label}\n </a>\n </li>\n ))}\n </ul>\n </nav>\n ) : (\n <div role=\"tablist\" aria-label={copy.navLabel} className=\"mt-6 flex flex-wrap gap-2\" onKeyDown={moveSelection}>\n {modules.map((module) => {\n const selected = module.id === activeModule\n return (\n <button\n key={module.id}\n ref={(node) => {\n tabRefs.current[modules.indexOf(module)] = node\n }}\n type=\"button\"\n role=\"tab\"\n id={`account-tab-${module.id}`}\n aria-selected={selected}\n aria-controls={`account-panel-${module.id}`}\n tabIndex={selected ? 0 : -1}\n onClick={() => onSelectModule?.(module.id)}\n className={cn(\n 'rounded-md border px-3 py-2 text-sm font-medium transition-colors',\n selected\n ? 'bg-foreground text-background border-transparent'\n : 'hover:bg-muted border-border bg-transparent',\n )}\n >\n {module.label}\n </button>\n )\n })}\n </div>\n )\n ) : null}\n </header>\n )\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAyFI;AAvFJ,mBAAuB;AAEvB,mBAAmB;AAqBnB,MAAM,gBAAoC;AAAA,EACxC,OAAO;AAAA,EACP,UAAU;AACZ;AAuBO,SAAS,aAAa;AAAA,EAC3B;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA,eAAe;AAAA,EACf;AAAA,EACA;AAAA,EACA;AACF,GAAsB;AACpB,MAAI,iBAAiB,WAAW,iBAAiB,QAAQ;AACvD,UAAM,IAAI;AAAA,MACR,+CAA+C,OAAO,YAAY,CAAC;AAAA,IACrE;AAAA,EACF;AACA,QAAM,OAAO,EAAE,GAAG,eAAe,GAAG,OAAO;AAC3C,QAAM,cAAU,qBAAwC,CAAC,CAAC;AAE1D,QAAM,gBAAgB,CAAC,UAAyC;AAC9D,QAAI,CAAC,CAAC,cAAc,aAAa,QAAQ,KAAK,EAAE,SAAS,MAAM,GAAG,EAAG;AACrE,UAAM,eAAe;AACrB,UAAM,UAAU,KAAK;AAAA,MACnB;AAAA,MACA,QAAQ,UAAU,CAACA,YAAWA,QAAO,OAAO,YAAY;AAAA,IAC1D;AACA,UAAM,OACJ,MAAM,QAAQ,SACV,IACA,MAAM,QAAQ,QACZ,QAAQ,SAAS,IACjB,MAAM,QAAQ,gBACX,UAAU,KAAK,QAAQ,UACvB,UAAU,IAAI,QAAQ,UAAU,QAAQ;AACnD,qBAAiB,QAAQ,IAAI,EAAE,EAAE;AACjC,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