@cimplify/sdk 0.38.3 → 0.38.5

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.
@@ -3538,12 +3538,21 @@ function toCanonicalProductSummary(p) {
3538
3538
  updated_at: p.updated_at
3539
3539
  };
3540
3540
  }
3541
- function deriveRenderHint(p) {
3541
+ var FOOD_REGEX = /food|drink|cake|bread|pastry|dessert|coffee|tea|juice|spice|sweet|breakfast|baked/i;
3542
+ function deriveRenderHint(p, registry) {
3543
+ if (p.render_hint) return p.render_hint;
3542
3544
  if (p.product_type === "service") return "general";
3543
- const foodish = (p.tags ?? []).some(
3544
- (t) => /food|drink|cake|bread|pastry|dessert|coffee|tea|juice|spice/i.test(t)
3545
- );
3546
- return foodish ? "food" : "general";
3545
+ if (p.product_type === "digital") return "general";
3546
+ if ((p.tags ?? []).some((t) => FOOD_REGEX.test(t))) return "food";
3547
+ if (registry) {
3548
+ for (const cid of p.category_ids) {
3549
+ const cat = registry.categories.get(cid);
3550
+ if (cat && (FOOD_REGEX.test(cat.name) || FOOD_REGEX.test(cat.slug))) {
3551
+ return "food";
3552
+ }
3553
+ }
3554
+ }
3555
+ return "general";
3547
3556
  }
3548
3557
  function toApiProduct(p, ctx) {
3549
3558
  const { registry, priceInfo, groups, components, composite, bundle } = ctx;
@@ -3559,7 +3568,7 @@ function toApiProduct(p, ctx) {
3559
3568
  images: p.images,
3560
3569
  default_price: p.base_price,
3561
3570
  type: p.product_type,
3562
- render_hint: deriveRenderHint(p),
3571
+ render_hint: deriveRenderHint(p, registry),
3563
3572
  inventory_type: "none",
3564
3573
  variant_strategy: p.variant_ids.length > 0 ? "use_axes" : "fetch_all",
3565
3574
  is_active: p.is_available,
@@ -3567,6 +3576,12 @@ function toApiProduct(p, ctx) {
3567
3576
  tags: p.tags ?? [],
3568
3577
  calories: p.calories,
3569
3578
  allergies: p.allergies ?? [],
3579
+ display_mode: p.display_mode,
3580
+ digital_product_type: p.digital_product_type,
3581
+ quantity_pricing: p.quantity_pricing,
3582
+ duration_unit: p.duration_unit,
3583
+ duration_minutes: p.duration_minutes,
3584
+ billing_plans: p.billing_plans,
3570
3585
  created_at: p.created_at,
3571
3586
  updated_at: p.updated_at,
3572
3587
  metadata: {
@@ -5057,6 +5072,21 @@ function makeProduct(input, categoryIds) {
5057
5072
  pairings: input.pairings ?? [],
5058
5073
  is_signature: input.isSignature ?? false,
5059
5074
  is_new: input.isNew ?? false,
5075
+ render_hint: input.renderHint,
5076
+ display_mode: input.displayMode,
5077
+ digital_product_type: input.digitalProductType,
5078
+ quantity_pricing: input.quantityPricing,
5079
+ duration_unit: input.durationUnit,
5080
+ duration_minutes: input.durationMinutes,
5081
+ billing_plans: input.billingPlans?.map((b) => ({
5082
+ id: b.id,
5083
+ name: b.name,
5084
+ interval: b.interval,
5085
+ interval_count: b.interval_count,
5086
+ price: b.price,
5087
+ currency: b.currency ?? "GHS",
5088
+ trial_period_days: b.trial_period_days
5089
+ })),
5060
5090
  created_at: ISO,
5061
5091
  updated_at: ISO
5062
5092
  };
@@ -5097,7 +5127,9 @@ function seedDefault(registry) {
5097
5127
  { slug: "pastries", name: "Pastries", description: "Hand-laminated croissants, danishes, brownies." },
5098
5128
  { slug: "cakes", name: "Cakes", description: "Slices and made-to-order showstoppers." },
5099
5129
  { slug: "drinks", name: "Drinks", description: "Locally roasted coffee, brewed teas, fresh juice." },
5100
- { slug: "boxes", name: "Boxes & Bundles", description: "Curated boxes for sharing." }
5130
+ { slug: "boxes", name: "Boxes & Bundles", description: "Curated boxes for sharing." },
5131
+ { slug: "merch", name: "Merch & More", description: "Branded goods, wholesale flour, downloadable recipes, gift cards." },
5132
+ { slug: "classes", name: "Classes & Stays", description: "Hands-on baking classes, kitchen rentals, monthly bread subscriptions." }
5101
5133
  ];
5102
5134
  const catIds = /* @__PURE__ */ new Map();
5103
5135
  for (const c of categoryDefs) {
@@ -5411,6 +5443,154 @@ function seedDefault(registry) {
5411
5443
  imageUrl: img("1486427944299-d1955d23e34d"),
5412
5444
  tags: ["composite", "build-your-own", "gift"],
5413
5445
  productType: "composite"
5446
+ },
5447
+ // ── Merch (Retail card — render_hint=physical) ──
5448
+ {
5449
+ id: "prod_apron",
5450
+ name: "Akua's Bakery Apron",
5451
+ slug: "apron",
5452
+ price: "85.00",
5453
+ description: "Heavy-weight cotton-canvas apron with leather neck strap, embroidered logo, and two front pockets. Made in Accra.",
5454
+ category: "merch",
5455
+ imageUrl: img("1556905055-8f358a7a47b2"),
5456
+ tags: ["merch", "physical"],
5457
+ renderHint: "physical"
5458
+ },
5459
+ {
5460
+ id: "prod_tote",
5461
+ name: "Bakery Tote Bag",
5462
+ slug: "tote-bag",
5463
+ price: "35.00",
5464
+ description: "12oz natural canvas tote, screen-printed with our wheat-stalk crest. Roomy enough for two loaves.",
5465
+ category: "merch",
5466
+ imageUrl: img("1591561954557-26941169b49e"),
5467
+ tags: ["merch", "physical", "gift"],
5468
+ renderHint: "physical",
5469
+ isNew: true
5470
+ },
5471
+ // ── Wholesale (Wholesale card — quantity_pricing tiers) ──
5472
+ {
5473
+ id: "prod_flour-wholesale",
5474
+ name: "Heritage Flour \u2014 25kg Sack",
5475
+ slug: "flour-25kg",
5476
+ price: "320.00",
5477
+ description: "Stone-milled heritage wheat flour, the same we use in our country sourdough. Tiered pricing for caf\xE9s, restaurants, and home-baking co-ops.",
5478
+ category: "merch",
5479
+ imageUrl: img("1568254183919-78a4f43a2877"),
5480
+ tags: ["wholesale", "physical", "trade"],
5481
+ renderHint: "physical",
5482
+ quantityPricing: [
5483
+ { min_quantity: 1, unit_price: "320.00" },
5484
+ { min_quantity: 5, unit_price: "295.00" },
5485
+ { min_quantity: 10, unit_price: "270.00" },
5486
+ { min_quantity: 25, unit_price: "245.00" }
5487
+ ]
5488
+ },
5489
+ // ── Digital products (Digital card — type=digital) ──
5490
+ {
5491
+ id: "prod_recipe-ebook",
5492
+ name: "Sourdough Starter eBook",
5493
+ slug: "sourdough-ebook",
5494
+ price: "45.00",
5495
+ description: "PDF + EPUB walkthrough of our sourdough programme \u2014 starter, levain, autolyse, bulk fermentation, shaping, scoring. Lifetime updates.",
5496
+ category: "merch",
5497
+ imageUrl: img("1543002588-bfa74002ed7e"),
5498
+ tags: ["digital", "download"],
5499
+ productType: "digital",
5500
+ digitalProductType: "download"
5501
+ },
5502
+ {
5503
+ id: "prod_gift-card",
5504
+ name: "Bakery Gift Card",
5505
+ slug: "gift-card",
5506
+ price: "100.00",
5507
+ description: "Send instantly. Redeemable in-store and online toward any product. Choose any amount from GH\u20B550 upward.",
5508
+ category: "merch",
5509
+ imageUrl: img("1556905055-8f358a7a47b2"),
5510
+ tags: ["digital", "gift"],
5511
+ productType: "digital",
5512
+ digitalProductType: "gift_code",
5513
+ isSignature: true
5514
+ },
5515
+ // ── Services (Standard service card — type=service + duration_minutes) ──
5516
+ {
5517
+ id: "prod_baking-class",
5518
+ name: "Sourdough Baking Class",
5519
+ slug: "baking-class",
5520
+ price: "320.00",
5521
+ description: "Two-hour hands-on class: shape your own boule, score it, and take home a baked loaf and a starter jar. Held Saturdays, 10am\u201312pm.",
5522
+ category: "classes",
5523
+ imageUrl: img("1556909114-44e3e9399a2e"),
5524
+ tags: ["class", "service", "hands-on"],
5525
+ productType: "service",
5526
+ durationMinutes: 120
5527
+ },
5528
+ {
5529
+ id: "prod_pastry-workshop",
5530
+ name: "Lamination Workshop",
5531
+ slug: "pastry-workshop",
5532
+ price: "480.00",
5533
+ description: "Three-hour deep-dive on laminated dough. We cover croissants, danishes, kouign-amann. Aprons supplied; pastries to take home.",
5534
+ category: "classes",
5535
+ imageUrl: img("1517433367423-c7e5b0f35086"),
5536
+ tags: ["class", "service", "advanced"],
5537
+ productType: "service",
5538
+ durationMinutes: 180,
5539
+ isNew: true
5540
+ },
5541
+ // ── Rental service (Rental card — duration_unit=hours) ──
5542
+ {
5543
+ id: "prod_kitchen-rental",
5544
+ name: "Pro Kitchen Rental",
5545
+ slug: "kitchen-rental",
5546
+ price: "180.00",
5547
+ description: "Rent our commercial bakery after hours. Deck oven, retarder-proofer, mixers, scales \u2014 bring your team or shoot your content. Hourly.",
5548
+ category: "classes",
5549
+ imageUrl: img("1556909114-44e3e9399a2e"),
5550
+ tags: ["rental", "service", "commercial"],
5551
+ productType: "service",
5552
+ durationUnit: "hours"
5553
+ },
5554
+ // ── Accommodation (Accommodation card — duration_unit=nights) ──
5555
+ {
5556
+ id: "prod_loft-stay",
5557
+ name: "Bakery Loft \u2014 Weekend Stay",
5558
+ slug: "loft-stay",
5559
+ price: "650.00",
5560
+ description: "One-bedroom loft above the bakery. Wakes up to fresh croissants, ends with a private dinner. Ghana Tourism-licensed. Per night.",
5561
+ category: "classes",
5562
+ imageUrl: img("1564013799919-ab600027ffc6"),
5563
+ tags: ["stay", "service", "premium"],
5564
+ productType: "service",
5565
+ durationUnit: "nights"
5566
+ },
5567
+ // ── Subscription (Subscription card — billing_plans, no duration_minutes) ──
5568
+ {
5569
+ id: "prod_loaf-subscription",
5570
+ name: "Weekly Loaf Subscription",
5571
+ slug: "loaf-subscription",
5572
+ price: "0.00",
5573
+ description: "A fresh loaf delivered to your door every week. Pause or skip any time. Choose monthly or quarterly billing for a discount.",
5574
+ category: "classes",
5575
+ imageUrl: img("1509440159596-0249088772ff"),
5576
+ tags: ["subscription", "service", "delivery"],
5577
+ productType: "service",
5578
+ billingPlans: [
5579
+ {
5580
+ id: "plan_loaf_monthly",
5581
+ name: "Monthly",
5582
+ interval: "month",
5583
+ interval_count: 1,
5584
+ price: "90.00"
5585
+ },
5586
+ {
5587
+ id: "plan_loaf_quarterly",
5588
+ name: "Quarterly (save 10%)",
5589
+ interval: "month",
5590
+ interval_count: 3,
5591
+ price: "243.00"
5592
+ }
5593
+ ]
5414
5594
  }
5415
5595
  ];
5416
5596
  for (const input of productInputs) {
@@ -3536,12 +3536,21 @@ function toCanonicalProductSummary(p) {
3536
3536
  updated_at: p.updated_at
3537
3537
  };
3538
3538
  }
3539
- function deriveRenderHint(p) {
3539
+ var FOOD_REGEX = /food|drink|cake|bread|pastry|dessert|coffee|tea|juice|spice|sweet|breakfast|baked/i;
3540
+ function deriveRenderHint(p, registry) {
3541
+ if (p.render_hint) return p.render_hint;
3540
3542
  if (p.product_type === "service") return "general";
3541
- const foodish = (p.tags ?? []).some(
3542
- (t) => /food|drink|cake|bread|pastry|dessert|coffee|tea|juice|spice/i.test(t)
3543
- );
3544
- return foodish ? "food" : "general";
3543
+ if (p.product_type === "digital") return "general";
3544
+ if ((p.tags ?? []).some((t) => FOOD_REGEX.test(t))) return "food";
3545
+ if (registry) {
3546
+ for (const cid of p.category_ids) {
3547
+ const cat = registry.categories.get(cid);
3548
+ if (cat && (FOOD_REGEX.test(cat.name) || FOOD_REGEX.test(cat.slug))) {
3549
+ return "food";
3550
+ }
3551
+ }
3552
+ }
3553
+ return "general";
3545
3554
  }
3546
3555
  function toApiProduct(p, ctx) {
3547
3556
  const { registry, priceInfo, groups, components, composite, bundle } = ctx;
@@ -3557,7 +3566,7 @@ function toApiProduct(p, ctx) {
3557
3566
  images: p.images,
3558
3567
  default_price: p.base_price,
3559
3568
  type: p.product_type,
3560
- render_hint: deriveRenderHint(p),
3569
+ render_hint: deriveRenderHint(p, registry),
3561
3570
  inventory_type: "none",
3562
3571
  variant_strategy: p.variant_ids.length > 0 ? "use_axes" : "fetch_all",
3563
3572
  is_active: p.is_available,
@@ -3565,6 +3574,12 @@ function toApiProduct(p, ctx) {
3565
3574
  tags: p.tags ?? [],
3566
3575
  calories: p.calories,
3567
3576
  allergies: p.allergies ?? [],
3577
+ display_mode: p.display_mode,
3578
+ digital_product_type: p.digital_product_type,
3579
+ quantity_pricing: p.quantity_pricing,
3580
+ duration_unit: p.duration_unit,
3581
+ duration_minutes: p.duration_minutes,
3582
+ billing_plans: p.billing_plans,
3568
3583
  created_at: p.created_at,
3569
3584
  updated_at: p.updated_at,
3570
3585
  metadata: {
@@ -5055,6 +5070,21 @@ function makeProduct(input, categoryIds) {
5055
5070
  pairings: input.pairings ?? [],
5056
5071
  is_signature: input.isSignature ?? false,
5057
5072
  is_new: input.isNew ?? false,
5073
+ render_hint: input.renderHint,
5074
+ display_mode: input.displayMode,
5075
+ digital_product_type: input.digitalProductType,
5076
+ quantity_pricing: input.quantityPricing,
5077
+ duration_unit: input.durationUnit,
5078
+ duration_minutes: input.durationMinutes,
5079
+ billing_plans: input.billingPlans?.map((b) => ({
5080
+ id: b.id,
5081
+ name: b.name,
5082
+ interval: b.interval,
5083
+ interval_count: b.interval_count,
5084
+ price: b.price,
5085
+ currency: b.currency ?? "GHS",
5086
+ trial_period_days: b.trial_period_days
5087
+ })),
5058
5088
  created_at: ISO,
5059
5089
  updated_at: ISO
5060
5090
  };
@@ -5095,7 +5125,9 @@ function seedDefault(registry) {
5095
5125
  { slug: "pastries", name: "Pastries", description: "Hand-laminated croissants, danishes, brownies." },
5096
5126
  { slug: "cakes", name: "Cakes", description: "Slices and made-to-order showstoppers." },
5097
5127
  { slug: "drinks", name: "Drinks", description: "Locally roasted coffee, brewed teas, fresh juice." },
5098
- { slug: "boxes", name: "Boxes & Bundles", description: "Curated boxes for sharing." }
5128
+ { slug: "boxes", name: "Boxes & Bundles", description: "Curated boxes for sharing." },
5129
+ { slug: "merch", name: "Merch & More", description: "Branded goods, wholesale flour, downloadable recipes, gift cards." },
5130
+ { slug: "classes", name: "Classes & Stays", description: "Hands-on baking classes, kitchen rentals, monthly bread subscriptions." }
5099
5131
  ];
5100
5132
  const catIds = /* @__PURE__ */ new Map();
5101
5133
  for (const c of categoryDefs) {
@@ -5409,6 +5441,154 @@ function seedDefault(registry) {
5409
5441
  imageUrl: img("1486427944299-d1955d23e34d"),
5410
5442
  tags: ["composite", "build-your-own", "gift"],
5411
5443
  productType: "composite"
5444
+ },
5445
+ // ── Merch (Retail card — render_hint=physical) ──
5446
+ {
5447
+ id: "prod_apron",
5448
+ name: "Akua's Bakery Apron",
5449
+ slug: "apron",
5450
+ price: "85.00",
5451
+ description: "Heavy-weight cotton-canvas apron with leather neck strap, embroidered logo, and two front pockets. Made in Accra.",
5452
+ category: "merch",
5453
+ imageUrl: img("1556905055-8f358a7a47b2"),
5454
+ tags: ["merch", "physical"],
5455
+ renderHint: "physical"
5456
+ },
5457
+ {
5458
+ id: "prod_tote",
5459
+ name: "Bakery Tote Bag",
5460
+ slug: "tote-bag",
5461
+ price: "35.00",
5462
+ description: "12oz natural canvas tote, screen-printed with our wheat-stalk crest. Roomy enough for two loaves.",
5463
+ category: "merch",
5464
+ imageUrl: img("1591561954557-26941169b49e"),
5465
+ tags: ["merch", "physical", "gift"],
5466
+ renderHint: "physical",
5467
+ isNew: true
5468
+ },
5469
+ // ── Wholesale (Wholesale card — quantity_pricing tiers) ──
5470
+ {
5471
+ id: "prod_flour-wholesale",
5472
+ name: "Heritage Flour \u2014 25kg Sack",
5473
+ slug: "flour-25kg",
5474
+ price: "320.00",
5475
+ description: "Stone-milled heritage wheat flour, the same we use in our country sourdough. Tiered pricing for caf\xE9s, restaurants, and home-baking co-ops.",
5476
+ category: "merch",
5477
+ imageUrl: img("1568254183919-78a4f43a2877"),
5478
+ tags: ["wholesale", "physical", "trade"],
5479
+ renderHint: "physical",
5480
+ quantityPricing: [
5481
+ { min_quantity: 1, unit_price: "320.00" },
5482
+ { min_quantity: 5, unit_price: "295.00" },
5483
+ { min_quantity: 10, unit_price: "270.00" },
5484
+ { min_quantity: 25, unit_price: "245.00" }
5485
+ ]
5486
+ },
5487
+ // ── Digital products (Digital card — type=digital) ──
5488
+ {
5489
+ id: "prod_recipe-ebook",
5490
+ name: "Sourdough Starter eBook",
5491
+ slug: "sourdough-ebook",
5492
+ price: "45.00",
5493
+ description: "PDF + EPUB walkthrough of our sourdough programme \u2014 starter, levain, autolyse, bulk fermentation, shaping, scoring. Lifetime updates.",
5494
+ category: "merch",
5495
+ imageUrl: img("1543002588-bfa74002ed7e"),
5496
+ tags: ["digital", "download"],
5497
+ productType: "digital",
5498
+ digitalProductType: "download"
5499
+ },
5500
+ {
5501
+ id: "prod_gift-card",
5502
+ name: "Bakery Gift Card",
5503
+ slug: "gift-card",
5504
+ price: "100.00",
5505
+ description: "Send instantly. Redeemable in-store and online toward any product. Choose any amount from GH\u20B550 upward.",
5506
+ category: "merch",
5507
+ imageUrl: img("1556905055-8f358a7a47b2"),
5508
+ tags: ["digital", "gift"],
5509
+ productType: "digital",
5510
+ digitalProductType: "gift_code",
5511
+ isSignature: true
5512
+ },
5513
+ // ── Services (Standard service card — type=service + duration_minutes) ──
5514
+ {
5515
+ id: "prod_baking-class",
5516
+ name: "Sourdough Baking Class",
5517
+ slug: "baking-class",
5518
+ price: "320.00",
5519
+ description: "Two-hour hands-on class: shape your own boule, score it, and take home a baked loaf and a starter jar. Held Saturdays, 10am\u201312pm.",
5520
+ category: "classes",
5521
+ imageUrl: img("1556909114-44e3e9399a2e"),
5522
+ tags: ["class", "service", "hands-on"],
5523
+ productType: "service",
5524
+ durationMinutes: 120
5525
+ },
5526
+ {
5527
+ id: "prod_pastry-workshop",
5528
+ name: "Lamination Workshop",
5529
+ slug: "pastry-workshop",
5530
+ price: "480.00",
5531
+ description: "Three-hour deep-dive on laminated dough. We cover croissants, danishes, kouign-amann. Aprons supplied; pastries to take home.",
5532
+ category: "classes",
5533
+ imageUrl: img("1517433367423-c7e5b0f35086"),
5534
+ tags: ["class", "service", "advanced"],
5535
+ productType: "service",
5536
+ durationMinutes: 180,
5537
+ isNew: true
5538
+ },
5539
+ // ── Rental service (Rental card — duration_unit=hours) ──
5540
+ {
5541
+ id: "prod_kitchen-rental",
5542
+ name: "Pro Kitchen Rental",
5543
+ slug: "kitchen-rental",
5544
+ price: "180.00",
5545
+ description: "Rent our commercial bakery after hours. Deck oven, retarder-proofer, mixers, scales \u2014 bring your team or shoot your content. Hourly.",
5546
+ category: "classes",
5547
+ imageUrl: img("1556909114-44e3e9399a2e"),
5548
+ tags: ["rental", "service", "commercial"],
5549
+ productType: "service",
5550
+ durationUnit: "hours"
5551
+ },
5552
+ // ── Accommodation (Accommodation card — duration_unit=nights) ──
5553
+ {
5554
+ id: "prod_loft-stay",
5555
+ name: "Bakery Loft \u2014 Weekend Stay",
5556
+ slug: "loft-stay",
5557
+ price: "650.00",
5558
+ description: "One-bedroom loft above the bakery. Wakes up to fresh croissants, ends with a private dinner. Ghana Tourism-licensed. Per night.",
5559
+ category: "classes",
5560
+ imageUrl: img("1564013799919-ab600027ffc6"),
5561
+ tags: ["stay", "service", "premium"],
5562
+ productType: "service",
5563
+ durationUnit: "nights"
5564
+ },
5565
+ // ── Subscription (Subscription card — billing_plans, no duration_minutes) ──
5566
+ {
5567
+ id: "prod_loaf-subscription",
5568
+ name: "Weekly Loaf Subscription",
5569
+ slug: "loaf-subscription",
5570
+ price: "0.00",
5571
+ description: "A fresh loaf delivered to your door every week. Pause or skip any time. Choose monthly or quarterly billing for a discount.",
5572
+ category: "classes",
5573
+ imageUrl: img("1509440159596-0249088772ff"),
5574
+ tags: ["subscription", "service", "delivery"],
5575
+ productType: "service",
5576
+ billingPlans: [
5577
+ {
5578
+ id: "plan_loaf_monthly",
5579
+ name: "Monthly",
5580
+ interval: "month",
5581
+ interval_count: 1,
5582
+ price: "90.00"
5583
+ },
5584
+ {
5585
+ id: "plan_loaf_quarterly",
5586
+ name: "Quarterly (save 10%)",
5587
+ interval: "month",
5588
+ interval_count: 3,
5589
+ price: "243.00"
5590
+ }
5591
+ ]
5412
5592
  }
5413
5593
  ];
5414
5594
  for (const input of productInputs) {
@@ -1,4 +1,4 @@
1
- import { A as AppHandle, C as CreateAppOptions } from '../server-BNy6Ri-4.mjs';
1
+ import { A as AppHandle, C as CreateAppOptions } from '../server-CVEsjECc.mjs';
2
2
  import 'hono';
3
3
 
4
4
  interface MswHandlerSetup {
@@ -1,4 +1,4 @@
1
- import { A as AppHandle, C as CreateAppOptions } from '../server-BNy6Ri-4.js';
1
+ import { A as AppHandle, C as CreateAppOptions } from '../server-CVEsjECc.js';
2
2
  import 'hono';
3
3
 
4
4
  interface MswHandlerSetup {