INNER CODE UNIT · JavaScript
storefront_to_kvs
store-craft/storecraft · packages/core/ai/agents/store/index.js:169
const storefront_to_kvs = async (app, sf) => {
sf ??= await app.api.storefronts.get_default_auto_generated_storefront();
sf.all_used_products_tags ??=
await app.api.products.list_used_products_tags() ?? [];
const kvs = {
store_info: store_info(app),
storefront_collections: sf.collections?.map(
c => ({title: c.title, handle: c.handle, description: c.description})
) ?? [],
storefront_discounts: sf.discounts?.map(
c => ({title: c.title, handle: c.handle, description: c.description})
) ?? [],
storefront_shipping_methods: sf.shipping_methods?.map(
c => ({price:c.price, title: c.title, handle: c.handle, description: c.description})