@ribajs/shopify
Version:
Shopify extension for Riba.js
50 lines (49 loc) • 1.96 kB
TypeScript
import { Component, ScopeBase } from "@ribajs/core";
import { ShopifyProductVariant, ShopifyProduct } from "@ribajs/shopify";
export interface PreparedProductVariant extends ShopifyProductVariant {
images?: string[];
}
export interface Scope extends ScopeBase {
handle: string | null;
product: ShopifyProduct | null;
variant: PreparedProductVariant | null;
quantity: number;
showDetailMenu: boolean;
chooseOption: ShopifyProductComponent["chooseOption"];
addToCart: ShopifyProductComponent["addToCart"];
toggleDetailMenu: ShopifyProductComponent["toggleDetailMenu"];
decrease: ShopifyProductComponent["decrease"];
increase: ShopifyProductComponent["increase"];
available: boolean;
}
export declare class ShopifyProductComponent extends Component {
static tagName: string;
protected autobind: boolean;
static get observedAttributes(): string[];
scope: Scope;
private colorOption;
private selectedOptions;
private optionChosen;
protected set product(product: ShopifyProduct | null);
protected get product(): ShopifyProduct | null;
protected set variant(variant: ShopifyProductVariant | null);
protected get variant(): ShopifyProductVariant | null;
protected set available(available: boolean);
constructor();
chooseOption(optionValue: string | number, position1: number, optionName: string, event: MouseEvent): void;
addToCart(): void;
toggleDetailMenu(): void;
increase(): void;
decrease(): void;
protected activateOption(optionValue: string, optionName: string): void;
protected activateOptions(): void;
protected beforeBind(): Promise<void>;
protected afterBind(): Promise<void>;
protected requiredAttributes(): string[];
protected template(): Promise<string | null>;
private indexOfUrl;
private getGeneralImages;
private getOptionImages;
private getFeaturedImage;
private prepareVariant;
}