PhoenixKitEcommerce.Catalogue.Extension (PhoenixKitEcommerce v0.5.0)

Copy Markdown View Source

Structurally implements PhoenixKitCatalogue.Extension — the catalogue item/category form "extension slot" (spec §2 principle 8). phoenix_kit_catalogue is an optional dependency, so this module does NOT declare @behaviour PhoenixKitCatalogue.Extension; that would force it to be loaded at compile time. Discovery is duck-typed, the same pattern as PhoenixKitEcommerce.AITranslatable / ai_translatables/0: catalogue finds this module via PhoenixKitEcommerce.catalogue_extensions/0 and is responsible for checking it is actually usable before calling it.

Summary

Functions

Validates and shapes category["ecommerce"] — see CategoryCommerce.cast/2.

Validates and shapes item["ecommerce"] — see ItemCommerce.cast/2.

Renders the Shop section inside the catalogue category form.

Whether the Shop section should be shown / absorbed.

Renders the Shop section inside the catalogue item form.

Namespace under data this extension owns.

Functions

cast_category(params, current)

@spec cast_category(map(), map()) :: {:ok, map()} | {:error, [{atom(), String.t()}]}

Validates and shapes category["ecommerce"] — see CategoryCommerce.cast/2.

cast_item(params, current)

@spec cast_item(map(), map()) :: {:ok, map()} | {:error, [{atom(), String.t()}]}

Validates and shapes item["ecommerce"] — see ItemCommerce.cast/2.

category_section(assigns)

@spec category_section(map()) :: Phoenix.LiveView.Rendered.t()

Renders the Shop section inside the catalogue category form.

enabled?()

@spec enabled?() :: boolean()

Whether the Shop section should be shown / absorbed.

item_section(assigns)

@spec item_section(map()) :: Phoenix.LiveView.Rendered.t()

Renders the Shop section inside the catalogue item form.

key()

@spec key() :: String.t()

Namespace under data this extension owns.