@cimplify/sdk 0.81.0 → 0.83.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/dist/advanced.d.mts +3 -3
- package/dist/advanced.d.ts +3 -3
- package/dist/{chunk-SRJEMEVZ.js → chunk-FKBXZ2A6.js} +212 -6
- package/dist/{chunk-7PAQR3VC.mjs → chunk-I6RE4BKH.mjs} +4 -2
- package/dist/{chunk-IZDJEDR4.js → chunk-ODEPW244.js} +5 -3
- package/dist/{chunk-BRVIXGUW.mjs → chunk-PLTP6HWW.mjs} +212 -6
- package/dist/{client-C51FFhDz.d.mts → client-Cogz7C1t.d.mts} +2 -2
- package/dist/{client-Q_m-GkTl.d.ts → client-Cq3B-WXv.d.ts} +2 -2
- package/dist/{client-Cx3WLhMj.d.mts → client-DnHP_2Jw.d.mts} +3 -2
- package/dist/{client-BmDNlUMx.d.ts → client-xc2aQSB4.d.ts} +3 -2
- package/dist/{index-Moe4cGMB.d.ts → index-C4xE31-D.d.ts} +3 -3
- package/dist/{index-Bu76UyFz.d.mts → index-Dy8D3r9b.d.mts} +3 -3
- package/dist/index.d.mts +6 -6
- package/dist/index.d.ts +6 -6
- package/dist/mock/cli.mjs +309 -19
- package/dist/mock/library.js +223 -6
- package/dist/mock/library.mjs +216 -7
- package/dist/mock/msw.js +212 -6
- package/dist/mock/msw.mjs +212 -6
- package/dist/{payment-B7qzWdaJ.d.mts → payment-T_0MUE9o.d.mts} +1 -1
- package/dist/{payment-mVIJIJcq.d.ts → payment-nH9OCUg2.d.ts} +1 -1
- package/dist/{price-CS1IsORZ.d.ts → price-B8WMoldA.d.ts} +1 -1
- package/dist/{price-BfOaGqjx.d.mts → price-Bg7hujK_.d.mts} +1 -1
- package/dist/{product-BgFOFmQw.d.mts → product-DXhjLQ_w.d.mts} +1 -0
- package/dist/{product-BgFOFmQw.d.ts → product-DXhjLQ_w.d.ts} +1 -0
- package/dist/react.d.mts +4 -4
- package/dist/react.d.ts +4 -4
- package/dist/react.js +2 -1
- package/dist/react.mjs +2 -1
- package/dist/{server-hP9NLtTh.d.mts → server-DaovvB9J.d.mts} +87 -3
- package/dist/{server-N4Q24CnO.d.ts → server-ZGCyuz4V.d.ts} +87 -3
- package/dist/server.d.mts +4 -4
- package/dist/server.d.ts +4 -4
- package/dist/testing/msw.d.mts +2 -2
- package/dist/testing/msw.d.ts +2 -2
- package/dist/testing/msw.js +2 -2
- package/dist/testing/msw.mjs +1 -1
- package/dist/testing/suite.d.mts +6 -6
- package/dist/testing/suite.d.ts +6 -6
- package/dist/testing/suite.js +21 -21
- package/dist/testing/suite.mjs +2 -2
- package/dist/testing.d.mts +11 -5
- package/dist/testing.d.ts +11 -5
- package/dist/testing.js +77 -77
- package/dist/testing.mjs +3 -3
- package/dist/utils.d.mts +4 -4
- package/dist/utils.d.ts +4 -4
- package/package.json +1 -1
package/dist/mock/msw.js
CHANGED
|
@@ -5899,6 +5899,14 @@ function createLinkService({ clock, ids }) {
|
|
|
5899
5899
|
};
|
|
5900
5900
|
}
|
|
5901
5901
|
|
|
5902
|
+
// src/mock/state/snapshot.ts
|
|
5903
|
+
function applySnapshot(reg, data) {
|
|
5904
|
+
for (const [k, v] of Object.entries(data)) {
|
|
5905
|
+
const store = reg[k];
|
|
5906
|
+
if (store) store.loadJSON(v);
|
|
5907
|
+
}
|
|
5908
|
+
}
|
|
5909
|
+
|
|
5902
5910
|
// src/mock/seeds/image.ts
|
|
5903
5911
|
var CDN_BASE_URL = "https://static-tmp.cimplify.io";
|
|
5904
5912
|
function seedImage(industry, slug) {
|
|
@@ -10266,15 +10274,214 @@ function applySeed(registry, name) {
|
|
|
10266
10274
|
return fn(registry);
|
|
10267
10275
|
}
|
|
10268
10276
|
|
|
10277
|
+
// src/mock/seeds/context.ts
|
|
10278
|
+
var SEED_ISO = "2026-01-01T00:00:00.000Z";
|
|
10279
|
+
var ID_PREFIX = {
|
|
10280
|
+
business: "bus_",
|
|
10281
|
+
category: "cat_",
|
|
10282
|
+
collection: "col_",
|
|
10283
|
+
product: "prod_",
|
|
10284
|
+
service: "svc_"
|
|
10285
|
+
};
|
|
10286
|
+
var DEFAULT_CURRENCY = "GHS";
|
|
10287
|
+
function slugify(value) {
|
|
10288
|
+
return value.toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/^-+|-+$/g, "");
|
|
10289
|
+
}
|
|
10290
|
+
function makeSeedContext(registry) {
|
|
10291
|
+
let current;
|
|
10292
|
+
const requireBusiness = () => {
|
|
10293
|
+
if (current) return current;
|
|
10294
|
+
const sole = registry.businesses.list();
|
|
10295
|
+
if (sole.length === 1) {
|
|
10296
|
+
current = sole[0];
|
|
10297
|
+
return current;
|
|
10298
|
+
}
|
|
10299
|
+
throw new Error("Seed must create a business (ctx.business) before adding child records.");
|
|
10300
|
+
};
|
|
10301
|
+
const resolveCategoryId = (cat) => {
|
|
10302
|
+
if (!cat) return void 0;
|
|
10303
|
+
if (typeof cat !== "string") return cat.id;
|
|
10304
|
+
if (registry.categories.get(cat)) return cat;
|
|
10305
|
+
return registry.categories.list().find((c) => c.slug === cat)?.id;
|
|
10306
|
+
};
|
|
10307
|
+
const resolveCollectionId = (col) => {
|
|
10308
|
+
if (!col) return void 0;
|
|
10309
|
+
if (typeof col !== "string") return col.id;
|
|
10310
|
+
if (registry.collections.get(col)) return col;
|
|
10311
|
+
return registry.collections.list().find((c) => c.slug === col)?.id;
|
|
10312
|
+
};
|
|
10313
|
+
return {
|
|
10314
|
+
registry,
|
|
10315
|
+
business(input) {
|
|
10316
|
+
const handle = input.handle ?? slugify(input.name);
|
|
10317
|
+
const id = `${ID_PREFIX.business}${slugify(handle)}`;
|
|
10318
|
+
const business = {
|
|
10319
|
+
business_type: "other",
|
|
10320
|
+
email: `hello@${handle}.test`,
|
|
10321
|
+
default_currency: DEFAULT_CURRENCY,
|
|
10322
|
+
default_offers_table_service: false,
|
|
10323
|
+
default_accepts_online_orders: true,
|
|
10324
|
+
status: "active",
|
|
10325
|
+
created_by: "seed",
|
|
10326
|
+
preferences: {},
|
|
10327
|
+
is_online_only: true,
|
|
10328
|
+
enabled_payment_types: ["mobile_money"],
|
|
10329
|
+
default_location_settings: {},
|
|
10330
|
+
country_code: "GH",
|
|
10331
|
+
timezone: "Africa/Accra",
|
|
10332
|
+
...input,
|
|
10333
|
+
id,
|
|
10334
|
+
handle,
|
|
10335
|
+
created_at: input.created_at ?? SEED_ISO,
|
|
10336
|
+
updated_at: input.updated_at ?? SEED_ISO
|
|
10337
|
+
};
|
|
10338
|
+
registry.businesses.put(id, business);
|
|
10339
|
+
current = business;
|
|
10340
|
+
return business;
|
|
10341
|
+
},
|
|
10342
|
+
category(input) {
|
|
10343
|
+
const business = requireBusiness();
|
|
10344
|
+
const slug = input.slug ?? slugify(input.name);
|
|
10345
|
+
const id = `${ID_PREFIX.category}${slug}`;
|
|
10346
|
+
const category = {
|
|
10347
|
+
id,
|
|
10348
|
+
business_id: business.id,
|
|
10349
|
+
name: input.name,
|
|
10350
|
+
slug,
|
|
10351
|
+
description: input.description,
|
|
10352
|
+
image: input.image,
|
|
10353
|
+
product_ids: [],
|
|
10354
|
+
display_order: input.displayOrder ?? 0,
|
|
10355
|
+
is_active: true,
|
|
10356
|
+
created_at: SEED_ISO,
|
|
10357
|
+
updated_at: SEED_ISO
|
|
10358
|
+
};
|
|
10359
|
+
registry.categories.put(id, category);
|
|
10360
|
+
return category;
|
|
10361
|
+
},
|
|
10362
|
+
collection(input) {
|
|
10363
|
+
const business = requireBusiness();
|
|
10364
|
+
const slug = input.slug ?? slugify(input.name);
|
|
10365
|
+
const id = `${ID_PREFIX.collection}${slug}`;
|
|
10366
|
+
const collection = {
|
|
10367
|
+
id,
|
|
10368
|
+
business_id: business.id,
|
|
10369
|
+
name: input.name,
|
|
10370
|
+
slug,
|
|
10371
|
+
description: input.description,
|
|
10372
|
+
product_ids: [],
|
|
10373
|
+
is_active: true,
|
|
10374
|
+
created_at: SEED_ISO,
|
|
10375
|
+
updated_at: SEED_ISO
|
|
10376
|
+
};
|
|
10377
|
+
registry.collections.put(id, collection);
|
|
10378
|
+
return collection;
|
|
10379
|
+
},
|
|
10380
|
+
product(input) {
|
|
10381
|
+
const business = requireBusiness();
|
|
10382
|
+
const slug = input.slug ?? slugify(input.name);
|
|
10383
|
+
const id = `${ID_PREFIX.product}${slug}`;
|
|
10384
|
+
const categoryId = resolveCategoryId(input.category);
|
|
10385
|
+
const collectionId = resolveCollectionId(input.collection);
|
|
10386
|
+
const product = {
|
|
10387
|
+
id,
|
|
10388
|
+
business_id: business.id,
|
|
10389
|
+
name: input.name,
|
|
10390
|
+
slug,
|
|
10391
|
+
description: input.description,
|
|
10392
|
+
product_type: input.productType ?? "product",
|
|
10393
|
+
base_price: input.price,
|
|
10394
|
+
currency: input.currency ?? business.default_currency,
|
|
10395
|
+
image: input.image,
|
|
10396
|
+
images: input.images ?? (input.image ? [input.image] : []),
|
|
10397
|
+
is_available: true,
|
|
10398
|
+
category_ids: categoryId ? [categoryId] : [],
|
|
10399
|
+
collection_ids: collectionId ? [collectionId] : [],
|
|
10400
|
+
add_on_ids: [],
|
|
10401
|
+
variant_ids: [],
|
|
10402
|
+
tags: input.tags ?? [],
|
|
10403
|
+
calories: input.calories,
|
|
10404
|
+
allergies: input.allergies ?? [],
|
|
10405
|
+
ingredients: input.ingredients ?? [],
|
|
10406
|
+
pairings: [],
|
|
10407
|
+
is_signature: input.isSignature ?? false,
|
|
10408
|
+
is_new: input.isNew ?? false,
|
|
10409
|
+
duration_minutes: input.durationMinutes,
|
|
10410
|
+
metadata: input.metadata,
|
|
10411
|
+
created_at: SEED_ISO,
|
|
10412
|
+
updated_at: SEED_ISO
|
|
10413
|
+
};
|
|
10414
|
+
registry.products.put(id, product);
|
|
10415
|
+
if (categoryId) {
|
|
10416
|
+
const cat = registry.categories.get(categoryId);
|
|
10417
|
+
if (cat && !cat.product_ids.includes(id)) cat.product_ids.push(id);
|
|
10418
|
+
}
|
|
10419
|
+
if (collectionId) {
|
|
10420
|
+
const col = registry.collections.get(collectionId);
|
|
10421
|
+
if (col && !col.product_ids.includes(id)) col.product_ids.push(id);
|
|
10422
|
+
}
|
|
10423
|
+
return product;
|
|
10424
|
+
},
|
|
10425
|
+
service(input) {
|
|
10426
|
+
const business = requireBusiness();
|
|
10427
|
+
const id = `${ID_PREFIX.service}${slugify(input.name)}`;
|
|
10428
|
+
const service = {
|
|
10429
|
+
id,
|
|
10430
|
+
business_id: business.id,
|
|
10431
|
+
name: input.name,
|
|
10432
|
+
description: input.description,
|
|
10433
|
+
duration_minutes: input.durationMinutes,
|
|
10434
|
+
price: input.price,
|
|
10435
|
+
is_available: true
|
|
10436
|
+
};
|
|
10437
|
+
registry.services.put(id, service);
|
|
10438
|
+
return service;
|
|
10439
|
+
},
|
|
10440
|
+
image: seedImage,
|
|
10441
|
+
extend(name) {
|
|
10442
|
+
const result = applySeed(registry, name);
|
|
10443
|
+
current = registry.businesses.get(result.businessId) ?? current;
|
|
10444
|
+
return result;
|
|
10445
|
+
}
|
|
10446
|
+
};
|
|
10447
|
+
}
|
|
10448
|
+
|
|
10449
|
+
// src/mock/seeds/source.ts
|
|
10450
|
+
var SNAPSHOT_META_KEY = "__meta";
|
|
10451
|
+
function loadSnapshot(registry, data, businessId) {
|
|
10452
|
+
applySnapshot(registry, data);
|
|
10453
|
+
if (businessId) return { businessId };
|
|
10454
|
+
const meta = data[SNAPSHOT_META_KEY];
|
|
10455
|
+
if (meta?.defaultBusinessId) return { businessId: meta.defaultBusinessId };
|
|
10456
|
+
const businesses = registry.businesses.list();
|
|
10457
|
+
if (businesses.length === 1) return { businessId: businesses[0].id };
|
|
10458
|
+
if (businesses.length === 0) {
|
|
10459
|
+
throw new Error("Seed snapshot has no business. Add one, or set __meta.defaultBusinessId.");
|
|
10460
|
+
}
|
|
10461
|
+
throw new Error(
|
|
10462
|
+
`Seed snapshot has ${businesses.length} businesses; set __meta.defaultBusinessId to pick one.`
|
|
10463
|
+
);
|
|
10464
|
+
}
|
|
10465
|
+
function resolveSeed(registry, source) {
|
|
10466
|
+
if (typeof source === "string") return applySeed(registry, source);
|
|
10467
|
+
switch (source.kind) {
|
|
10468
|
+
case "builtin":
|
|
10469
|
+
return applySeed(registry, source.name);
|
|
10470
|
+
case "json":
|
|
10471
|
+
return loadSnapshot(registry, source.data, source.businessId);
|
|
10472
|
+
case "fn":
|
|
10473
|
+
return source.seed(makeSeedContext(registry));
|
|
10474
|
+
}
|
|
10475
|
+
}
|
|
10476
|
+
|
|
10269
10477
|
// src/mock/deps.ts
|
|
10270
10478
|
function createDeps(options = {}) {
|
|
10271
10479
|
const clock = createClock({ frozenAt: options.frozenAt });
|
|
10272
10480
|
const ids = createIdGen(options.rngSeed);
|
|
10273
10481
|
const bus = createBus({ idGen: () => ids.raw("evt"), clock: () => clock.now() });
|
|
10274
10482
|
const registry = createStateRegistry();
|
|
10275
|
-
const
|
|
10276
|
-
|
|
10277
|
-
let defaultBusinessId = seedResult.businessId;
|
|
10483
|
+
const seedSource = options.seed ?? "default";
|
|
10484
|
+
let defaultBusinessId = resolveSeed(registry, seedSource).businessId;
|
|
10278
10485
|
const auth = createAuthService({
|
|
10279
10486
|
registry,
|
|
10280
10487
|
clock,
|
|
@@ -10328,11 +10535,10 @@ function createDeps(options = {}) {
|
|
|
10328
10535
|
return defaultBusinessId;
|
|
10329
10536
|
},
|
|
10330
10537
|
chaos,
|
|
10331
|
-
resetAll(
|
|
10538
|
+
resetAll(next) {
|
|
10332
10539
|
for (const store of Object.values(registry)) store.reset();
|
|
10333
10540
|
bus.clear();
|
|
10334
|
-
|
|
10335
|
-
defaultBusinessId = r.businessId;
|
|
10541
|
+
defaultBusinessId = resolveSeed(registry, next ?? seedSource).businessId;
|
|
10336
10542
|
return defaultBusinessId;
|
|
10337
10543
|
}
|
|
10338
10544
|
};
|
package/dist/mock/msw.mjs
CHANGED
|
@@ -5897,6 +5897,14 @@ function createLinkService({ clock, ids }) {
|
|
|
5897
5897
|
};
|
|
5898
5898
|
}
|
|
5899
5899
|
|
|
5900
|
+
// src/mock/state/snapshot.ts
|
|
5901
|
+
function applySnapshot(reg, data) {
|
|
5902
|
+
for (const [k, v] of Object.entries(data)) {
|
|
5903
|
+
const store = reg[k];
|
|
5904
|
+
if (store) store.loadJSON(v);
|
|
5905
|
+
}
|
|
5906
|
+
}
|
|
5907
|
+
|
|
5900
5908
|
// src/mock/seeds/image.ts
|
|
5901
5909
|
var CDN_BASE_URL = "https://static-tmp.cimplify.io";
|
|
5902
5910
|
function seedImage(industry, slug) {
|
|
@@ -10264,15 +10272,214 @@ function applySeed(registry, name) {
|
|
|
10264
10272
|
return fn(registry);
|
|
10265
10273
|
}
|
|
10266
10274
|
|
|
10275
|
+
// src/mock/seeds/context.ts
|
|
10276
|
+
var SEED_ISO = "2026-01-01T00:00:00.000Z";
|
|
10277
|
+
var ID_PREFIX = {
|
|
10278
|
+
business: "bus_",
|
|
10279
|
+
category: "cat_",
|
|
10280
|
+
collection: "col_",
|
|
10281
|
+
product: "prod_",
|
|
10282
|
+
service: "svc_"
|
|
10283
|
+
};
|
|
10284
|
+
var DEFAULT_CURRENCY = "GHS";
|
|
10285
|
+
function slugify(value) {
|
|
10286
|
+
return value.toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/^-+|-+$/g, "");
|
|
10287
|
+
}
|
|
10288
|
+
function makeSeedContext(registry) {
|
|
10289
|
+
let current;
|
|
10290
|
+
const requireBusiness = () => {
|
|
10291
|
+
if (current) return current;
|
|
10292
|
+
const sole = registry.businesses.list();
|
|
10293
|
+
if (sole.length === 1) {
|
|
10294
|
+
current = sole[0];
|
|
10295
|
+
return current;
|
|
10296
|
+
}
|
|
10297
|
+
throw new Error("Seed must create a business (ctx.business) before adding child records.");
|
|
10298
|
+
};
|
|
10299
|
+
const resolveCategoryId = (cat) => {
|
|
10300
|
+
if (!cat) return void 0;
|
|
10301
|
+
if (typeof cat !== "string") return cat.id;
|
|
10302
|
+
if (registry.categories.get(cat)) return cat;
|
|
10303
|
+
return registry.categories.list().find((c) => c.slug === cat)?.id;
|
|
10304
|
+
};
|
|
10305
|
+
const resolveCollectionId = (col) => {
|
|
10306
|
+
if (!col) return void 0;
|
|
10307
|
+
if (typeof col !== "string") return col.id;
|
|
10308
|
+
if (registry.collections.get(col)) return col;
|
|
10309
|
+
return registry.collections.list().find((c) => c.slug === col)?.id;
|
|
10310
|
+
};
|
|
10311
|
+
return {
|
|
10312
|
+
registry,
|
|
10313
|
+
business(input) {
|
|
10314
|
+
const handle = input.handle ?? slugify(input.name);
|
|
10315
|
+
const id = `${ID_PREFIX.business}${slugify(handle)}`;
|
|
10316
|
+
const business = {
|
|
10317
|
+
business_type: "other",
|
|
10318
|
+
email: `hello@${handle}.test`,
|
|
10319
|
+
default_currency: DEFAULT_CURRENCY,
|
|
10320
|
+
default_offers_table_service: false,
|
|
10321
|
+
default_accepts_online_orders: true,
|
|
10322
|
+
status: "active",
|
|
10323
|
+
created_by: "seed",
|
|
10324
|
+
preferences: {},
|
|
10325
|
+
is_online_only: true,
|
|
10326
|
+
enabled_payment_types: ["mobile_money"],
|
|
10327
|
+
default_location_settings: {},
|
|
10328
|
+
country_code: "GH",
|
|
10329
|
+
timezone: "Africa/Accra",
|
|
10330
|
+
...input,
|
|
10331
|
+
id,
|
|
10332
|
+
handle,
|
|
10333
|
+
created_at: input.created_at ?? SEED_ISO,
|
|
10334
|
+
updated_at: input.updated_at ?? SEED_ISO
|
|
10335
|
+
};
|
|
10336
|
+
registry.businesses.put(id, business);
|
|
10337
|
+
current = business;
|
|
10338
|
+
return business;
|
|
10339
|
+
},
|
|
10340
|
+
category(input) {
|
|
10341
|
+
const business = requireBusiness();
|
|
10342
|
+
const slug = input.slug ?? slugify(input.name);
|
|
10343
|
+
const id = `${ID_PREFIX.category}${slug}`;
|
|
10344
|
+
const category = {
|
|
10345
|
+
id,
|
|
10346
|
+
business_id: business.id,
|
|
10347
|
+
name: input.name,
|
|
10348
|
+
slug,
|
|
10349
|
+
description: input.description,
|
|
10350
|
+
image: input.image,
|
|
10351
|
+
product_ids: [],
|
|
10352
|
+
display_order: input.displayOrder ?? 0,
|
|
10353
|
+
is_active: true,
|
|
10354
|
+
created_at: SEED_ISO,
|
|
10355
|
+
updated_at: SEED_ISO
|
|
10356
|
+
};
|
|
10357
|
+
registry.categories.put(id, category);
|
|
10358
|
+
return category;
|
|
10359
|
+
},
|
|
10360
|
+
collection(input) {
|
|
10361
|
+
const business = requireBusiness();
|
|
10362
|
+
const slug = input.slug ?? slugify(input.name);
|
|
10363
|
+
const id = `${ID_PREFIX.collection}${slug}`;
|
|
10364
|
+
const collection = {
|
|
10365
|
+
id,
|
|
10366
|
+
business_id: business.id,
|
|
10367
|
+
name: input.name,
|
|
10368
|
+
slug,
|
|
10369
|
+
description: input.description,
|
|
10370
|
+
product_ids: [],
|
|
10371
|
+
is_active: true,
|
|
10372
|
+
created_at: SEED_ISO,
|
|
10373
|
+
updated_at: SEED_ISO
|
|
10374
|
+
};
|
|
10375
|
+
registry.collections.put(id, collection);
|
|
10376
|
+
return collection;
|
|
10377
|
+
},
|
|
10378
|
+
product(input) {
|
|
10379
|
+
const business = requireBusiness();
|
|
10380
|
+
const slug = input.slug ?? slugify(input.name);
|
|
10381
|
+
const id = `${ID_PREFIX.product}${slug}`;
|
|
10382
|
+
const categoryId = resolveCategoryId(input.category);
|
|
10383
|
+
const collectionId = resolveCollectionId(input.collection);
|
|
10384
|
+
const product = {
|
|
10385
|
+
id,
|
|
10386
|
+
business_id: business.id,
|
|
10387
|
+
name: input.name,
|
|
10388
|
+
slug,
|
|
10389
|
+
description: input.description,
|
|
10390
|
+
product_type: input.productType ?? "product",
|
|
10391
|
+
base_price: input.price,
|
|
10392
|
+
currency: input.currency ?? business.default_currency,
|
|
10393
|
+
image: input.image,
|
|
10394
|
+
images: input.images ?? (input.image ? [input.image] : []),
|
|
10395
|
+
is_available: true,
|
|
10396
|
+
category_ids: categoryId ? [categoryId] : [],
|
|
10397
|
+
collection_ids: collectionId ? [collectionId] : [],
|
|
10398
|
+
add_on_ids: [],
|
|
10399
|
+
variant_ids: [],
|
|
10400
|
+
tags: input.tags ?? [],
|
|
10401
|
+
calories: input.calories,
|
|
10402
|
+
allergies: input.allergies ?? [],
|
|
10403
|
+
ingredients: input.ingredients ?? [],
|
|
10404
|
+
pairings: [],
|
|
10405
|
+
is_signature: input.isSignature ?? false,
|
|
10406
|
+
is_new: input.isNew ?? false,
|
|
10407
|
+
duration_minutes: input.durationMinutes,
|
|
10408
|
+
metadata: input.metadata,
|
|
10409
|
+
created_at: SEED_ISO,
|
|
10410
|
+
updated_at: SEED_ISO
|
|
10411
|
+
};
|
|
10412
|
+
registry.products.put(id, product);
|
|
10413
|
+
if (categoryId) {
|
|
10414
|
+
const cat = registry.categories.get(categoryId);
|
|
10415
|
+
if (cat && !cat.product_ids.includes(id)) cat.product_ids.push(id);
|
|
10416
|
+
}
|
|
10417
|
+
if (collectionId) {
|
|
10418
|
+
const col = registry.collections.get(collectionId);
|
|
10419
|
+
if (col && !col.product_ids.includes(id)) col.product_ids.push(id);
|
|
10420
|
+
}
|
|
10421
|
+
return product;
|
|
10422
|
+
},
|
|
10423
|
+
service(input) {
|
|
10424
|
+
const business = requireBusiness();
|
|
10425
|
+
const id = `${ID_PREFIX.service}${slugify(input.name)}`;
|
|
10426
|
+
const service = {
|
|
10427
|
+
id,
|
|
10428
|
+
business_id: business.id,
|
|
10429
|
+
name: input.name,
|
|
10430
|
+
description: input.description,
|
|
10431
|
+
duration_minutes: input.durationMinutes,
|
|
10432
|
+
price: input.price,
|
|
10433
|
+
is_available: true
|
|
10434
|
+
};
|
|
10435
|
+
registry.services.put(id, service);
|
|
10436
|
+
return service;
|
|
10437
|
+
},
|
|
10438
|
+
image: seedImage,
|
|
10439
|
+
extend(name) {
|
|
10440
|
+
const result = applySeed(registry, name);
|
|
10441
|
+
current = registry.businesses.get(result.businessId) ?? current;
|
|
10442
|
+
return result;
|
|
10443
|
+
}
|
|
10444
|
+
};
|
|
10445
|
+
}
|
|
10446
|
+
|
|
10447
|
+
// src/mock/seeds/source.ts
|
|
10448
|
+
var SNAPSHOT_META_KEY = "__meta";
|
|
10449
|
+
function loadSnapshot(registry, data, businessId) {
|
|
10450
|
+
applySnapshot(registry, data);
|
|
10451
|
+
if (businessId) return { businessId };
|
|
10452
|
+
const meta = data[SNAPSHOT_META_KEY];
|
|
10453
|
+
if (meta?.defaultBusinessId) return { businessId: meta.defaultBusinessId };
|
|
10454
|
+
const businesses = registry.businesses.list();
|
|
10455
|
+
if (businesses.length === 1) return { businessId: businesses[0].id };
|
|
10456
|
+
if (businesses.length === 0) {
|
|
10457
|
+
throw new Error("Seed snapshot has no business. Add one, or set __meta.defaultBusinessId.");
|
|
10458
|
+
}
|
|
10459
|
+
throw new Error(
|
|
10460
|
+
`Seed snapshot has ${businesses.length} businesses; set __meta.defaultBusinessId to pick one.`
|
|
10461
|
+
);
|
|
10462
|
+
}
|
|
10463
|
+
function resolveSeed(registry, source) {
|
|
10464
|
+
if (typeof source === "string") return applySeed(registry, source);
|
|
10465
|
+
switch (source.kind) {
|
|
10466
|
+
case "builtin":
|
|
10467
|
+
return applySeed(registry, source.name);
|
|
10468
|
+
case "json":
|
|
10469
|
+
return loadSnapshot(registry, source.data, source.businessId);
|
|
10470
|
+
case "fn":
|
|
10471
|
+
return source.seed(makeSeedContext(registry));
|
|
10472
|
+
}
|
|
10473
|
+
}
|
|
10474
|
+
|
|
10267
10475
|
// src/mock/deps.ts
|
|
10268
10476
|
function createDeps(options = {}) {
|
|
10269
10477
|
const clock = createClock({ frozenAt: options.frozenAt });
|
|
10270
10478
|
const ids = createIdGen(options.rngSeed);
|
|
10271
10479
|
const bus = createBus({ idGen: () => ids.raw("evt"), clock: () => clock.now() });
|
|
10272
10480
|
const registry = createStateRegistry();
|
|
10273
|
-
const
|
|
10274
|
-
|
|
10275
|
-
let defaultBusinessId = seedResult.businessId;
|
|
10481
|
+
const seedSource = options.seed ?? "default";
|
|
10482
|
+
let defaultBusinessId = resolveSeed(registry, seedSource).businessId;
|
|
10276
10483
|
const auth = createAuthService({
|
|
10277
10484
|
registry,
|
|
10278
10485
|
clock,
|
|
@@ -10326,11 +10533,10 @@ function createDeps(options = {}) {
|
|
|
10326
10533
|
return defaultBusinessId;
|
|
10327
10534
|
},
|
|
10328
10535
|
chaos,
|
|
10329
|
-
resetAll(
|
|
10536
|
+
resetAll(next) {
|
|
10330
10537
|
for (const store of Object.values(registry)) store.reset();
|
|
10331
10538
|
bus.clear();
|
|
10332
|
-
|
|
10333
|
-
defaultBusinessId = r.businessId;
|
|
10539
|
+
defaultBusinessId = resolveSeed(registry, next ?? seedSource).businessId;
|
|
10334
10540
|
return defaultBusinessId;
|
|
10335
10541
|
}
|
|
10336
10542
|
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { aM as Money, ab as CurrencyCode } from './product-
|
|
1
|
+
import { aM as Money, ab as CurrencyCode } from './product-DXhjLQ_w.mjs';
|
|
2
2
|
|
|
3
3
|
type PaymentStatus = "initialized" | "pending" | "processing" | "authorized" | "captured" | "failed" | "cancelled" | "refunded" | "unknown" | "voided" | "requires_action" | "abandoned" | "reversed" | "disputed" | "refund_pending";
|
|
4
4
|
type PaymentProvider = "stripe" | "paystack" | "cellulant" | "mtnmomo" | "offline" | "mtn" | "vodafone" | "airtel" | "cash" | "manual";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { aM as Money, ab as CurrencyCode } from './product-
|
|
1
|
+
import { aM as Money, ab as CurrencyCode } from './product-DXhjLQ_w.js';
|
|
2
2
|
|
|
3
3
|
type PaymentStatus = "initialized" | "pending" | "processing" | "authorized" | "captured" | "failed" | "cancelled" | "refunded" | "unknown" | "voided" | "requires_action" | "abandoned" | "reversed" | "disputed" | "refund_pending";
|
|
4
4
|
type PaymentProvider = "stripe" | "paystack" | "cellulant" | "mtnmomo" | "offline" | "mtn" | "vodafone" | "airtel" | "cash" | "manual";
|
package/dist/react.d.mts
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import React$1, { ReactNode } from 'react';
|
|
2
2
|
import { d as AdSlot, c as AdPosition, a as AdContextValue, S as SignInOptions } from './sign-in-DQlIdqsi.mjs';
|
|
3
3
|
export { A as AdConfig, g as getVariantDisplayName } from './sign-in-DQlIdqsi.mjs';
|
|
4
|
-
import { ad as CimplifyClient, cm as ProcessCheckoutResult, aa as CheckoutStatus, ab as CheckoutStatusContext, aX as EnrichedOrderItem, aW as EnrichedOrder, w as Business, bs as Location, cD as ReorderResult, c2 as OrderStatus, bI as Order, co as QuoteBundleSelectionInput, cp as QuoteCompositeSelectionInput, ci as PriceQuote, cs as QuoteUiMessage, cY as Service, r as AvailableSlot, av as DayAvailability, an as CustomerBooking, M as CancelBookingResult, f as ActivityStateResponse, d5 as SessionMessage, c as ActivityRecommendation, ax as DeliveryFeeResponse, az as DeliveryOptionsResponse, b8 as FxRateResponse, de as StoreCreditBalance, dg as StorefrontBootstrap, Y as ChatWidgetStarter, X as ChatMessage, h as AddressInfo, n as AuthenticatedData, aV as ElementsOptions, cc as PaymentMethodInfo, aT as ElementsCheckoutResult, cl as ProcessCheckoutOptions, ag as CimplifyElements, bj as LineItem, d8 as Staff, cT as Room } from './client-
|
|
4
|
+
import { ad as CimplifyClient, cm as ProcessCheckoutResult, aa as CheckoutStatus, ab as CheckoutStatusContext, aX as EnrichedOrderItem, aW as EnrichedOrder, w as Business, bs as Location, cD as ReorderResult, c2 as OrderStatus, bI as Order, co as QuoteBundleSelectionInput, cp as QuoteCompositeSelectionInput, ci as PriceQuote, cs as QuoteUiMessage, cY as Service, r as AvailableSlot, av as DayAvailability, an as CustomerBooking, M as CancelBookingResult, f as ActivityStateResponse, d5 as SessionMessage, c as ActivityRecommendation, ax as DeliveryFeeResponse, az as DeliveryOptionsResponse, b8 as FxRateResponse, de as StoreCreditBalance, dg as StorefrontBootstrap, Y as ChatWidgetStarter, X as ChatMessage, h as AddressInfo, n as AuthenticatedData, aV as ElementsOptions, cc as PaymentMethodInfo, aT as ElementsCheckoutResult, cl as ProcessCheckoutOptions, ag as CimplifyElements, bj as LineItem, d8 as Staff, cT as Room } from './client-DnHP_2Jw.mjs';
|
|
5
5
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
6
|
-
import { ab as CurrencyCode, aX as Product, aO as Pagination, T as CimplifyError, b9 as ProductWithDetails, Q as Category, aM as Money, C as BundleSelectionInput, $ as ComponentSelectionInput, z as BundleSelectionData, a8 as CompositeSelectionData, U as Collection, b4 as ProductTaxonomy, bt as TaxonomyWithChildren, b5 as ProductTimeProfile, ah as Deal, b0 as ProductDealInfo, an as DiscountValidation, E as BundleSummary, a6 as CompositePriceResult, bo as SubscriptionWithDetails, bn as SubscriptionStatus, bk as Subscription, ac as CustomAttributeDefinition, ba as PropertyFacet, a$ as ProductBillingPlan, bL as VariantView, bF as VariantAxisWithValues, f as AddOnWithOptions, w as BundleComponentView, x as BundlePriceType, a4 as CompositeGroupView, aq as DisplayCart, b1 as ProductInputField, bg as SchedulingMode, at as DurationUnit, aj as DepositType, ad as CustomAttributeValue, b2 as ProductProperty, bc as QuantityPricingTier } from './product-
|
|
7
|
-
import { P as ProductWithPrice } from './price-
|
|
6
|
+
import { ab as CurrencyCode, aX as Product, aO as Pagination, T as CimplifyError, b9 as ProductWithDetails, Q as Category, aM as Money, C as BundleSelectionInput, $ as ComponentSelectionInput, z as BundleSelectionData, a8 as CompositeSelectionData, U as Collection, b4 as ProductTaxonomy, bt as TaxonomyWithChildren, b5 as ProductTimeProfile, ah as Deal, b0 as ProductDealInfo, an as DiscountValidation, E as BundleSummary, a6 as CompositePriceResult, bo as SubscriptionWithDetails, bn as SubscriptionStatus, bk as Subscription, ac as CustomAttributeDefinition, ba as PropertyFacet, a$ as ProductBillingPlan, bL as VariantView, bF as VariantAxisWithValues, f as AddOnWithOptions, w as BundleComponentView, x as BundlePriceType, a4 as CompositeGroupView, aq as DisplayCart, b1 as ProductInputField, bg as SchedulingMode, at as DurationUnit, aj as DepositType, ad as CustomAttributeValue, b2 as ProductProperty, bc as QuantityPricingTier } from './product-DXhjLQ_w.mjs';
|
|
7
|
+
import { P as ProductWithPrice } from './price-Bg7hujK_.mjs';
|
|
8
8
|
import { ClassValue } from 'clsx';
|
|
9
9
|
import { Matcher } from 'react-day-picker';
|
|
10
|
-
import './payment-
|
|
10
|
+
import './payment-T_0MUE9o.mjs';
|
|
11
11
|
|
|
12
12
|
interface UserIdentity {
|
|
13
13
|
uid: string;
|
package/dist/react.d.ts
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import React$1, { ReactNode } from 'react';
|
|
2
2
|
import { d as AdSlot, c as AdPosition, a as AdContextValue, S as SignInOptions } from './sign-in-DQlIdqsi.js';
|
|
3
3
|
export { A as AdConfig, g as getVariantDisplayName } from './sign-in-DQlIdqsi.js';
|
|
4
|
-
import { ad as CimplifyClient, cm as ProcessCheckoutResult, aa as CheckoutStatus, ab as CheckoutStatusContext, aX as EnrichedOrderItem, aW as EnrichedOrder, w as Business, bs as Location, cD as ReorderResult, c2 as OrderStatus, bI as Order, co as QuoteBundleSelectionInput, cp as QuoteCompositeSelectionInput, ci as PriceQuote, cs as QuoteUiMessage, cY as Service, r as AvailableSlot, av as DayAvailability, an as CustomerBooking, M as CancelBookingResult, f as ActivityStateResponse, d5 as SessionMessage, c as ActivityRecommendation, ax as DeliveryFeeResponse, az as DeliveryOptionsResponse, b8 as FxRateResponse, de as StoreCreditBalance, dg as StorefrontBootstrap, Y as ChatWidgetStarter, X as ChatMessage, h as AddressInfo, n as AuthenticatedData, aV as ElementsOptions, cc as PaymentMethodInfo, aT as ElementsCheckoutResult, cl as ProcessCheckoutOptions, ag as CimplifyElements, bj as LineItem, d8 as Staff, cT as Room } from './client-
|
|
4
|
+
import { ad as CimplifyClient, cm as ProcessCheckoutResult, aa as CheckoutStatus, ab as CheckoutStatusContext, aX as EnrichedOrderItem, aW as EnrichedOrder, w as Business, bs as Location, cD as ReorderResult, c2 as OrderStatus, bI as Order, co as QuoteBundleSelectionInput, cp as QuoteCompositeSelectionInput, ci as PriceQuote, cs as QuoteUiMessage, cY as Service, r as AvailableSlot, av as DayAvailability, an as CustomerBooking, M as CancelBookingResult, f as ActivityStateResponse, d5 as SessionMessage, c as ActivityRecommendation, ax as DeliveryFeeResponse, az as DeliveryOptionsResponse, b8 as FxRateResponse, de as StoreCreditBalance, dg as StorefrontBootstrap, Y as ChatWidgetStarter, X as ChatMessage, h as AddressInfo, n as AuthenticatedData, aV as ElementsOptions, cc as PaymentMethodInfo, aT as ElementsCheckoutResult, cl as ProcessCheckoutOptions, ag as CimplifyElements, bj as LineItem, d8 as Staff, cT as Room } from './client-xc2aQSB4.js';
|
|
5
5
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
6
|
-
import { ab as CurrencyCode, aX as Product, aO as Pagination, T as CimplifyError, b9 as ProductWithDetails, Q as Category, aM as Money, C as BundleSelectionInput, $ as ComponentSelectionInput, z as BundleSelectionData, a8 as CompositeSelectionData, U as Collection, b4 as ProductTaxonomy, bt as TaxonomyWithChildren, b5 as ProductTimeProfile, ah as Deal, b0 as ProductDealInfo, an as DiscountValidation, E as BundleSummary, a6 as CompositePriceResult, bo as SubscriptionWithDetails, bn as SubscriptionStatus, bk as Subscription, ac as CustomAttributeDefinition, ba as PropertyFacet, a$ as ProductBillingPlan, bL as VariantView, bF as VariantAxisWithValues, f as AddOnWithOptions, w as BundleComponentView, x as BundlePriceType, a4 as CompositeGroupView, aq as DisplayCart, b1 as ProductInputField, bg as SchedulingMode, at as DurationUnit, aj as DepositType, ad as CustomAttributeValue, b2 as ProductProperty, bc as QuantityPricingTier } from './product-
|
|
7
|
-
import { P as ProductWithPrice } from './price-
|
|
6
|
+
import { ab as CurrencyCode, aX as Product, aO as Pagination, T as CimplifyError, b9 as ProductWithDetails, Q as Category, aM as Money, C as BundleSelectionInput, $ as ComponentSelectionInput, z as BundleSelectionData, a8 as CompositeSelectionData, U as Collection, b4 as ProductTaxonomy, bt as TaxonomyWithChildren, b5 as ProductTimeProfile, ah as Deal, b0 as ProductDealInfo, an as DiscountValidation, E as BundleSummary, a6 as CompositePriceResult, bo as SubscriptionWithDetails, bn as SubscriptionStatus, bk as Subscription, ac as CustomAttributeDefinition, ba as PropertyFacet, a$ as ProductBillingPlan, bL as VariantView, bF as VariantAxisWithValues, f as AddOnWithOptions, w as BundleComponentView, x as BundlePriceType, a4 as CompositeGroupView, aq as DisplayCart, b1 as ProductInputField, bg as SchedulingMode, at as DurationUnit, aj as DepositType, ad as CustomAttributeValue, b2 as ProductProperty, bc as QuantityPricingTier } from './product-DXhjLQ_w.js';
|
|
7
|
+
import { P as ProductWithPrice } from './price-B8WMoldA.js';
|
|
8
8
|
import { ClassValue } from 'clsx';
|
|
9
9
|
import { Matcher } from 'react-day-picker';
|
|
10
|
-
import './payment-
|
|
10
|
+
import './payment-nH9OCUg2.js';
|
|
11
11
|
|
|
12
12
|
interface UserIdentity {
|
|
13
13
|
uid: string;
|
package/dist/react.js
CHANGED
|
@@ -430,7 +430,8 @@ function transformToCheckoutCart(cart, fx) {
|
|
|
430
430
|
currency: fx?.displayCurrency ?? cart.pricing.currency,
|
|
431
431
|
tax_inclusive: cart.pricing.tax_inclusive ?? false,
|
|
432
432
|
deposit_required: cart.pricing.deposit_required ?? false,
|
|
433
|
-
deposit_amount: cart.pricing.deposit_amount != null ? amt(cart.pricing.deposit_amount) : void 0
|
|
433
|
+
deposit_amount: cart.pricing.deposit_amount != null ? amt(cart.pricing.deposit_amount) : void 0,
|
|
434
|
+
requires_delivery: cart.requires_delivery
|
|
434
435
|
};
|
|
435
436
|
}
|
|
436
437
|
|
package/dist/react.mjs
CHANGED
|
@@ -406,7 +406,8 @@ function transformToCheckoutCart(cart, fx) {
|
|
|
406
406
|
currency: fx?.displayCurrency ?? cart.pricing.currency,
|
|
407
407
|
tax_inclusive: cart.pricing.tax_inclusive ?? false,
|
|
408
408
|
deposit_required: cart.pricing.deposit_required ?? false,
|
|
409
|
-
deposit_amount: cart.pricing.deposit_amount != null ? amt(cart.pricing.deposit_amount) : void 0
|
|
409
|
+
deposit_amount: cart.pricing.deposit_amount != null ? amt(cart.pricing.deposit_amount) : void 0,
|
|
410
|
+
requires_delivery: cart.requires_delivery
|
|
410
411
|
};
|
|
411
412
|
}
|
|
412
413
|
|