@cimplify/sdk 0.44.18 → 0.44.19
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/{chunk-VDH3O7UB.mjs → chunk-GLOO4HUN.mjs} +82 -10
- package/dist/{chunk-MJBSVUHO.mjs → chunk-KSKZAXG2.mjs} +2 -0
- package/dist/{chunk-CCSONJCO.js → chunk-PGSM3NQ2.js} +2 -0
- package/dist/{chunk-53J2WE4S.js → chunk-Q4I7JRGO.js} +86 -10
- package/dist/mock/cli.mjs +2 -0
- package/dist/mock/library.js +2 -0
- package/dist/mock/library.mjs +2 -0
- package/dist/mock/msw.js +2 -0
- package/dist/mock/msw.mjs +2 -0
- package/dist/testing/msw.js +2 -2
- package/dist/testing/msw.mjs +1 -1
- package/dist/testing/suite.js +21 -21
- package/dist/testing/suite.mjs +2 -2
- package/dist/testing.d.mts +329 -27
- package/dist/testing.d.ts +329 -27
- package/dist/testing.js +89 -73
- package/dist/testing.mjs +3 -3
- package/package.json +1 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { createCimplifyClient } from './chunk-5OK3YDZC.mjs';
|
|
2
|
-
import { createMockApp } from './chunk-
|
|
2
|
+
import { createMockApp } from './chunk-KSKZAXG2.mjs';
|
|
3
3
|
import { z } from 'zod';
|
|
4
4
|
|
|
5
5
|
var cimplifyRegistry = z.registry();
|
|
@@ -282,14 +282,16 @@ var VariantInfoSchema = registerSchema(
|
|
|
282
282
|
id: z.string(),
|
|
283
283
|
name: z.string(),
|
|
284
284
|
sku: z.string().optional(),
|
|
285
|
+
price: MoneySchema,
|
|
285
286
|
price_adjustment: MoneySchema,
|
|
287
|
+
is_default: z.boolean(),
|
|
286
288
|
display_attributes: z.array(VariantDisplayAttributeSchema).optional(),
|
|
287
289
|
images: z.array(z.string()).optional()
|
|
288
290
|
}),
|
|
289
291
|
{
|
|
290
292
|
id: "VariantInfo",
|
|
291
293
|
description: "Variant axis values + display attributes \u2014 emitted on cart line items",
|
|
292
|
-
version: "1.
|
|
294
|
+
version: "1.1.0"
|
|
293
295
|
}
|
|
294
296
|
);
|
|
295
297
|
var VariantDetailsSchema = z.object({
|
|
@@ -305,11 +307,81 @@ var ChosenPriceSchema = z.object({
|
|
|
305
307
|
markup_discount_percentage: MoneySchema,
|
|
306
308
|
markup_discount_amount: MoneySchema
|
|
307
309
|
});
|
|
308
|
-
var
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
310
|
+
var SelectedAddOnOptionSchema = registerSchema(
|
|
311
|
+
z.object({
|
|
312
|
+
option_id: z.string(),
|
|
313
|
+
add_on_id: z.string(),
|
|
314
|
+
name: z.string(),
|
|
315
|
+
price: MoneySchema,
|
|
316
|
+
quantity: z.number().int().nonnegative(),
|
|
317
|
+
is_required: z.boolean(),
|
|
318
|
+
selected_at: TimestampSchema,
|
|
319
|
+
price_info: z.unknown().optional()
|
|
320
|
+
}),
|
|
321
|
+
{
|
|
322
|
+
id: "SelectedAddOnOption",
|
|
323
|
+
description: "A specific add-on option chosen for a cart line",
|
|
324
|
+
version: "1.0.0"
|
|
325
|
+
}
|
|
326
|
+
);
|
|
327
|
+
var AddOnInDetailsSchema = registerSchema(
|
|
328
|
+
z.object({
|
|
329
|
+
add_on_id: z.string(),
|
|
330
|
+
name: z.string(),
|
|
331
|
+
min_selections: z.number().int().nonnegative(),
|
|
332
|
+
max_selections: z.number().int().nonnegative(),
|
|
333
|
+
selected_options: z.array(z.string()),
|
|
334
|
+
is_required: z.boolean()
|
|
335
|
+
}),
|
|
336
|
+
{
|
|
337
|
+
id: "AddOnInDetails",
|
|
338
|
+
description: "Add-on group as embedded inside add_on_details \u2014 selected_options is an ID list",
|
|
339
|
+
version: "1.0.0"
|
|
340
|
+
}
|
|
341
|
+
);
|
|
342
|
+
var AddOnDetailsSchema = registerSchema(
|
|
343
|
+
z.object({
|
|
344
|
+
selected_options: z.array(SelectedAddOnOptionSchema),
|
|
345
|
+
total_add_on_price: MoneySchema,
|
|
346
|
+
add_ons: z.array(AddOnInDetailsSchema)
|
|
347
|
+
}),
|
|
348
|
+
{
|
|
349
|
+
id: "AddOnDetails",
|
|
350
|
+
description: "Combined add-on selection state for a cart line",
|
|
351
|
+
version: "1.0.0"
|
|
352
|
+
}
|
|
353
|
+
);
|
|
354
|
+
var AddOnOptionDetailsSchema = registerSchema(
|
|
355
|
+
z.object({
|
|
356
|
+
id: z.string(),
|
|
357
|
+
name: z.string(),
|
|
358
|
+
is_required: z.boolean(),
|
|
359
|
+
description: z.string().optional(),
|
|
360
|
+
price: MoneySchema.optional(),
|
|
361
|
+
image_url: z.string().optional()
|
|
362
|
+
}),
|
|
363
|
+
{
|
|
364
|
+
id: "AddOnOptionDetails",
|
|
365
|
+
description: "Option-level details (one per chosen add-on option)",
|
|
366
|
+
version: "1.0.0"
|
|
367
|
+
}
|
|
368
|
+
);
|
|
369
|
+
var AddOnGroupDetailsSchema = registerSchema(
|
|
370
|
+
z.object({
|
|
371
|
+
id: z.string(),
|
|
372
|
+
name: z.string(),
|
|
373
|
+
is_multiple_allowed: z.boolean(),
|
|
374
|
+
min_selections: z.number().int().nonnegative(),
|
|
375
|
+
max_selections: z.number().int().nonnegative(),
|
|
376
|
+
required: z.boolean(),
|
|
377
|
+
options: z.array(AddOnOptionDetailsSchema)
|
|
378
|
+
}),
|
|
379
|
+
{
|
|
380
|
+
id: "AddOnGroupDetails",
|
|
381
|
+
description: "Group-level details for an add-on; contains its options",
|
|
382
|
+
version: "1.0.0"
|
|
383
|
+
}
|
|
384
|
+
);
|
|
313
385
|
var BundleResolvedSchema = z.looseObject({
|
|
314
386
|
bundle_id: z.string(),
|
|
315
387
|
selections: z.array(z.unknown())
|
|
@@ -355,8 +427,8 @@ var CartItemSchema = registerSchema(
|
|
|
355
427
|
add_on_option_ids: z.array(z.string()),
|
|
356
428
|
add_on_ids: z.array(z.string()),
|
|
357
429
|
add_on_details: AddOnDetailsSchema,
|
|
358
|
-
add_on_options: z.array(
|
|
359
|
-
add_ons: z.array(
|
|
430
|
+
add_on_options: z.array(AddOnOptionDetailsSchema),
|
|
431
|
+
add_ons: z.array(AddOnGroupDetailsSchema),
|
|
360
432
|
scheduled_start: z.string().optional(),
|
|
361
433
|
scheduled_end: z.string().optional(),
|
|
362
434
|
staff_id: z.string().optional(),
|
|
@@ -601,4 +673,4 @@ var fixtures = {
|
|
|
601
673
|
}
|
|
602
674
|
};
|
|
603
675
|
|
|
604
|
-
export { AddItemPayloadSchema, AddOnDetailsSchema, AuthorizationTypeSchema, BrandContactSchema, BrandFaqSchema, BrandHeroSchema, BrandNavLinkSchema, BrandPolicyPageSchema, BrandPolicySectionSchema, BrandSchema, BrandSocialSchema, BundleResolvedSchema, BundleSelectionInputSchema, CartItemSchema, CartPricingSchema, CartSchema, CheckoutBodySchema, CheckoutCustomerSchema, CheckoutResponseSchema, ChosenPriceSchema, CompositeResolvedSchema, CompositeSelectionInputSchema, CountryCodeSchema, CurrencyCodeSchema, CustomerInputValueSchema, DiscountDetailsSchema, IsoDateTimeSchema, LineTypeSchema, LocaleSchema, MoneyLooseSchema, MoneySchema, NextActionSchema, PhoneE164Schema, ProductTypeSchema, SchemaViolationError, SeedNameSchema, ServiceStatusSchema, TimestampSchema, VariantDetailsSchema, VariantDisplayAttributeSchema, VariantInfoSchema, assertAddItemPayload, assertBrand, assertCart, assertCartItem, assertCheckoutBody, assertCheckoutResponse, cimplifyRegistry, createTestClient, fixtures, makeAssertion, registerSchema };
|
|
676
|
+
export { AddItemPayloadSchema, AddOnDetailsSchema, AddOnGroupDetailsSchema, AddOnInDetailsSchema, AddOnOptionDetailsSchema, AuthorizationTypeSchema, BrandContactSchema, BrandFaqSchema, BrandHeroSchema, BrandNavLinkSchema, BrandPolicyPageSchema, BrandPolicySectionSchema, BrandSchema, BrandSocialSchema, BundleResolvedSchema, BundleSelectionInputSchema, CartItemSchema, CartPricingSchema, CartSchema, CheckoutBodySchema, CheckoutCustomerSchema, CheckoutResponseSchema, ChosenPriceSchema, CompositeResolvedSchema, CompositeSelectionInputSchema, CountryCodeSchema, CurrencyCodeSchema, CustomerInputValueSchema, DiscountDetailsSchema, IsoDateTimeSchema, LineTypeSchema, LocaleSchema, MoneyLooseSchema, MoneySchema, NextActionSchema, PhoneE164Schema, ProductTypeSchema, SchemaViolationError, SeedNameSchema, SelectedAddOnOptionSchema, ServiceStatusSchema, TimestampSchema, VariantDetailsSchema, VariantDisplayAttributeSchema, VariantInfoSchema, assertAddItemPayload, assertBrand, assertCart, assertCartItem, assertCheckoutBody, assertCheckoutResponse, cimplifyRegistry, createTestClient, fixtures, makeAssertion, registerSchema };
|
|
@@ -4274,7 +4274,9 @@ function toUICart(registry, cart) {
|
|
|
4274
4274
|
id: variant.id,
|
|
4275
4275
|
name: variantName,
|
|
4276
4276
|
sku: variant.sku,
|
|
4277
|
+
price: i.price,
|
|
4277
4278
|
price_adjustment: variant.price_adjustment,
|
|
4279
|
+
is_default: variant.is_default ?? false,
|
|
4278
4280
|
display_attributes: variantDisplayAttributes,
|
|
4279
4281
|
images: variant.images
|
|
4280
4282
|
} : void 0,
|
|
@@ -4276,7 +4276,9 @@ function toUICart(registry, cart) {
|
|
|
4276
4276
|
id: variant.id,
|
|
4277
4277
|
name: variantName,
|
|
4278
4278
|
sku: variant.sku,
|
|
4279
|
+
price: i.price,
|
|
4279
4280
|
price_adjustment: variant.price_adjustment,
|
|
4281
|
+
is_default: variant.is_default ?? false,
|
|
4280
4282
|
display_attributes: variantDisplayAttributes,
|
|
4281
4283
|
images: variant.images
|
|
4282
4284
|
} : void 0,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
var chunk3FS3ZDKX_js = require('./chunk-3FS3ZDKX.js');
|
|
4
|
-
var
|
|
4
|
+
var chunkPGSM3NQ2_js = require('./chunk-PGSM3NQ2.js');
|
|
5
5
|
var zod = require('zod');
|
|
6
6
|
|
|
7
7
|
var cimplifyRegistry = zod.z.registry();
|
|
@@ -284,14 +284,16 @@ var VariantInfoSchema = registerSchema(
|
|
|
284
284
|
id: zod.z.string(),
|
|
285
285
|
name: zod.z.string(),
|
|
286
286
|
sku: zod.z.string().optional(),
|
|
287
|
+
price: MoneySchema,
|
|
287
288
|
price_adjustment: MoneySchema,
|
|
289
|
+
is_default: zod.z.boolean(),
|
|
288
290
|
display_attributes: zod.z.array(VariantDisplayAttributeSchema).optional(),
|
|
289
291
|
images: zod.z.array(zod.z.string()).optional()
|
|
290
292
|
}),
|
|
291
293
|
{
|
|
292
294
|
id: "VariantInfo",
|
|
293
295
|
description: "Variant axis values + display attributes \u2014 emitted on cart line items",
|
|
294
|
-
version: "1.
|
|
296
|
+
version: "1.1.0"
|
|
295
297
|
}
|
|
296
298
|
);
|
|
297
299
|
var VariantDetailsSchema = zod.z.object({
|
|
@@ -307,11 +309,81 @@ var ChosenPriceSchema = zod.z.object({
|
|
|
307
309
|
markup_discount_percentage: MoneySchema,
|
|
308
310
|
markup_discount_amount: MoneySchema
|
|
309
311
|
});
|
|
310
|
-
var
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
312
|
+
var SelectedAddOnOptionSchema = registerSchema(
|
|
313
|
+
zod.z.object({
|
|
314
|
+
option_id: zod.z.string(),
|
|
315
|
+
add_on_id: zod.z.string(),
|
|
316
|
+
name: zod.z.string(),
|
|
317
|
+
price: MoneySchema,
|
|
318
|
+
quantity: zod.z.number().int().nonnegative(),
|
|
319
|
+
is_required: zod.z.boolean(),
|
|
320
|
+
selected_at: TimestampSchema,
|
|
321
|
+
price_info: zod.z.unknown().optional()
|
|
322
|
+
}),
|
|
323
|
+
{
|
|
324
|
+
id: "SelectedAddOnOption",
|
|
325
|
+
description: "A specific add-on option chosen for a cart line",
|
|
326
|
+
version: "1.0.0"
|
|
327
|
+
}
|
|
328
|
+
);
|
|
329
|
+
var AddOnInDetailsSchema = registerSchema(
|
|
330
|
+
zod.z.object({
|
|
331
|
+
add_on_id: zod.z.string(),
|
|
332
|
+
name: zod.z.string(),
|
|
333
|
+
min_selections: zod.z.number().int().nonnegative(),
|
|
334
|
+
max_selections: zod.z.number().int().nonnegative(),
|
|
335
|
+
selected_options: zod.z.array(zod.z.string()),
|
|
336
|
+
is_required: zod.z.boolean()
|
|
337
|
+
}),
|
|
338
|
+
{
|
|
339
|
+
id: "AddOnInDetails",
|
|
340
|
+
description: "Add-on group as embedded inside add_on_details \u2014 selected_options is an ID list",
|
|
341
|
+
version: "1.0.0"
|
|
342
|
+
}
|
|
343
|
+
);
|
|
344
|
+
var AddOnDetailsSchema = registerSchema(
|
|
345
|
+
zod.z.object({
|
|
346
|
+
selected_options: zod.z.array(SelectedAddOnOptionSchema),
|
|
347
|
+
total_add_on_price: MoneySchema,
|
|
348
|
+
add_ons: zod.z.array(AddOnInDetailsSchema)
|
|
349
|
+
}),
|
|
350
|
+
{
|
|
351
|
+
id: "AddOnDetails",
|
|
352
|
+
description: "Combined add-on selection state for a cart line",
|
|
353
|
+
version: "1.0.0"
|
|
354
|
+
}
|
|
355
|
+
);
|
|
356
|
+
var AddOnOptionDetailsSchema = registerSchema(
|
|
357
|
+
zod.z.object({
|
|
358
|
+
id: zod.z.string(),
|
|
359
|
+
name: zod.z.string(),
|
|
360
|
+
is_required: zod.z.boolean(),
|
|
361
|
+
description: zod.z.string().optional(),
|
|
362
|
+
price: MoneySchema.optional(),
|
|
363
|
+
image_url: zod.z.string().optional()
|
|
364
|
+
}),
|
|
365
|
+
{
|
|
366
|
+
id: "AddOnOptionDetails",
|
|
367
|
+
description: "Option-level details (one per chosen add-on option)",
|
|
368
|
+
version: "1.0.0"
|
|
369
|
+
}
|
|
370
|
+
);
|
|
371
|
+
var AddOnGroupDetailsSchema = registerSchema(
|
|
372
|
+
zod.z.object({
|
|
373
|
+
id: zod.z.string(),
|
|
374
|
+
name: zod.z.string(),
|
|
375
|
+
is_multiple_allowed: zod.z.boolean(),
|
|
376
|
+
min_selections: zod.z.number().int().nonnegative(),
|
|
377
|
+
max_selections: zod.z.number().int().nonnegative(),
|
|
378
|
+
required: zod.z.boolean(),
|
|
379
|
+
options: zod.z.array(AddOnOptionDetailsSchema)
|
|
380
|
+
}),
|
|
381
|
+
{
|
|
382
|
+
id: "AddOnGroupDetails",
|
|
383
|
+
description: "Group-level details for an add-on; contains its options",
|
|
384
|
+
version: "1.0.0"
|
|
385
|
+
}
|
|
386
|
+
);
|
|
315
387
|
var BundleResolvedSchema = zod.z.looseObject({
|
|
316
388
|
bundle_id: zod.z.string(),
|
|
317
389
|
selections: zod.z.array(zod.z.unknown())
|
|
@@ -357,8 +429,8 @@ var CartItemSchema = registerSchema(
|
|
|
357
429
|
add_on_option_ids: zod.z.array(zod.z.string()),
|
|
358
430
|
add_on_ids: zod.z.array(zod.z.string()),
|
|
359
431
|
add_on_details: AddOnDetailsSchema,
|
|
360
|
-
add_on_options: zod.z.array(
|
|
361
|
-
add_ons: zod.z.array(
|
|
432
|
+
add_on_options: zod.z.array(AddOnOptionDetailsSchema),
|
|
433
|
+
add_ons: zod.z.array(AddOnGroupDetailsSchema),
|
|
362
434
|
scheduled_start: zod.z.string().optional(),
|
|
363
435
|
scheduled_end: zod.z.string().optional(),
|
|
364
436
|
staff_id: zod.z.string().optional(),
|
|
@@ -507,7 +579,7 @@ async function toForwardedRequest(input, init) {
|
|
|
507
579
|
};
|
|
508
580
|
}
|
|
509
581
|
function createTestClient(options = {}) {
|
|
510
|
-
const mock =
|
|
582
|
+
const mock = chunkPGSM3NQ2_js.createMockApp(options);
|
|
511
583
|
let sessionToken;
|
|
512
584
|
const fetchImpl = async (input, init) => {
|
|
513
585
|
const url = typeof input === "string" ? input : input instanceof URL ? input.toString() : input.url;
|
|
@@ -605,6 +677,9 @@ var fixtures = {
|
|
|
605
677
|
|
|
606
678
|
exports.AddItemPayloadSchema = AddItemPayloadSchema;
|
|
607
679
|
exports.AddOnDetailsSchema = AddOnDetailsSchema;
|
|
680
|
+
exports.AddOnGroupDetailsSchema = AddOnGroupDetailsSchema;
|
|
681
|
+
exports.AddOnInDetailsSchema = AddOnInDetailsSchema;
|
|
682
|
+
exports.AddOnOptionDetailsSchema = AddOnOptionDetailsSchema;
|
|
608
683
|
exports.AuthorizationTypeSchema = AuthorizationTypeSchema;
|
|
609
684
|
exports.BrandContactSchema = BrandContactSchema;
|
|
610
685
|
exports.BrandFaqSchema = BrandFaqSchema;
|
|
@@ -639,6 +714,7 @@ exports.PhoneE164Schema = PhoneE164Schema;
|
|
|
639
714
|
exports.ProductTypeSchema = ProductTypeSchema;
|
|
640
715
|
exports.SchemaViolationError = SchemaViolationError;
|
|
641
716
|
exports.SeedNameSchema = SeedNameSchema;
|
|
717
|
+
exports.SelectedAddOnOptionSchema = SelectedAddOnOptionSchema;
|
|
642
718
|
exports.ServiceStatusSchema = ServiceStatusSchema;
|
|
643
719
|
exports.TimestampSchema = TimestampSchema;
|
|
644
720
|
exports.VariantDetailsSchema = VariantDetailsSchema;
|
package/dist/mock/cli.mjs
CHANGED
|
@@ -4978,7 +4978,9 @@ function toUICart(registry, cart) {
|
|
|
4978
4978
|
id: variant.id,
|
|
4979
4979
|
name: variantName,
|
|
4980
4980
|
sku: variant.sku,
|
|
4981
|
+
price: i.price,
|
|
4981
4982
|
price_adjustment: variant.price_adjustment,
|
|
4983
|
+
is_default: variant.is_default ?? false,
|
|
4982
4984
|
display_attributes: variantDisplayAttributes,
|
|
4983
4985
|
images: variant.images
|
|
4984
4986
|
} : void 0,
|
package/dist/mock/library.js
CHANGED
|
@@ -4346,7 +4346,9 @@ function toUICart(registry, cart) {
|
|
|
4346
4346
|
id: variant.id,
|
|
4347
4347
|
name: variantName,
|
|
4348
4348
|
sku: variant.sku,
|
|
4349
|
+
price: i.price,
|
|
4349
4350
|
price_adjustment: variant.price_adjustment,
|
|
4351
|
+
is_default: variant.is_default ?? false,
|
|
4350
4352
|
display_attributes: variantDisplayAttributes,
|
|
4351
4353
|
images: variant.images
|
|
4352
4354
|
} : void 0,
|
package/dist/mock/library.mjs
CHANGED
|
@@ -4344,7 +4344,9 @@ function toUICart(registry, cart) {
|
|
|
4344
4344
|
id: variant.id,
|
|
4345
4345
|
name: variantName,
|
|
4346
4346
|
sku: variant.sku,
|
|
4347
|
+
price: i.price,
|
|
4347
4348
|
price_adjustment: variant.price_adjustment,
|
|
4349
|
+
is_default: variant.is_default ?? false,
|
|
4348
4350
|
display_attributes: variantDisplayAttributes,
|
|
4349
4351
|
images: variant.images
|
|
4350
4352
|
} : void 0,
|
package/dist/mock/msw.js
CHANGED
|
@@ -4344,7 +4344,9 @@ function toUICart(registry, cart) {
|
|
|
4344
4344
|
id: variant.id,
|
|
4345
4345
|
name: variantName,
|
|
4346
4346
|
sku: variant.sku,
|
|
4347
|
+
price: i.price,
|
|
4347
4348
|
price_adjustment: variant.price_adjustment,
|
|
4349
|
+
is_default: variant.is_default ?? false,
|
|
4348
4350
|
display_attributes: variantDisplayAttributes,
|
|
4349
4351
|
images: variant.images
|
|
4350
4352
|
} : void 0,
|
package/dist/mock/msw.mjs
CHANGED
|
@@ -4342,7 +4342,9 @@ function toUICart(registry, cart) {
|
|
|
4342
4342
|
id: variant.id,
|
|
4343
4343
|
name: variantName,
|
|
4344
4344
|
sku: variant.sku,
|
|
4345
|
+
price: i.price,
|
|
4345
4346
|
price_adjustment: variant.price_adjustment,
|
|
4347
|
+
is_default: variant.is_default ?? false,
|
|
4346
4348
|
display_attributes: variantDisplayAttributes,
|
|
4347
4349
|
images: variant.images
|
|
4348
4350
|
} : void 0,
|
package/dist/testing/msw.js
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var chunkPGSM3NQ2_js = require('../chunk-PGSM3NQ2.js');
|
|
4
4
|
require('../chunk-QBQCMQ4F.js');
|
|
5
5
|
|
|
6
6
|
// src/mock/msw.ts
|
|
7
7
|
async function createMswHandlers(options = {}) {
|
|
8
8
|
const baseUrl = options.baseUrl ?? "http://localhost:8787";
|
|
9
|
-
const handle =
|
|
9
|
+
const handle = chunkPGSM3NQ2_js.createMockApp(options);
|
|
10
10
|
const msw = await import('msw').catch(() => {
|
|
11
11
|
throw new Error("msw is required to use @cimplify/sdk/mock/msw \u2014 install it as a peer dependency");
|
|
12
12
|
});
|
package/dist/testing/msw.mjs
CHANGED
package/dist/testing/suite.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var chunkQ4I7JRGO_js = require('../chunk-Q4I7JRGO.js');
|
|
4
4
|
require('../chunk-3FS3ZDKX.js');
|
|
5
5
|
require('../chunk-HBRCVJL4.js');
|
|
6
6
|
require('../chunk-BN2CXGMO.js');
|
|
7
|
-
require('../chunk-
|
|
7
|
+
require('../chunk-PGSM3NQ2.js');
|
|
8
8
|
require('../chunk-QBQCMQ4F.js');
|
|
9
9
|
var vitest = require('vitest');
|
|
10
10
|
|
|
@@ -19,11 +19,11 @@ var PLACEHOLDER_PHRASES = [
|
|
|
19
19
|
function createBrandSuite(opts) {
|
|
20
20
|
vitest.describe(opts.label ?? "brand schema", () => {
|
|
21
21
|
vitest.it("conforms to the Cimplify brand contract", () => {
|
|
22
|
-
vitest.expect(() =>
|
|
22
|
+
vitest.expect(() => chunkQ4I7JRGO_js.assertBrand(opts.brand)).not.toThrow();
|
|
23
23
|
});
|
|
24
24
|
vitest.it("declares a known mock seed", () => {
|
|
25
25
|
const b = opts.brand;
|
|
26
|
-
vitest.expect(
|
|
26
|
+
vitest.expect(chunkQ4I7JRGO_js.SeedNameSchema.safeParse(b.mock?.seed).success).toBe(true);
|
|
27
27
|
});
|
|
28
28
|
vitest.it("has no placeholder copy left in", () => {
|
|
29
29
|
const flat = JSON.stringify(opts.brand).toLowerCase();
|
|
@@ -36,7 +36,7 @@ function createBrandSuite(opts) {
|
|
|
36
36
|
vitest.expect(b.mock?.businessId).toMatch(/^bus_/);
|
|
37
37
|
});
|
|
38
38
|
vitest.it("zod-parses cleanly", () => {
|
|
39
|
-
const result =
|
|
39
|
+
const result = chunkQ4I7JRGO_js.BrandSchema.safeParse(opts.brand);
|
|
40
40
|
if (!result.success) {
|
|
41
41
|
throw new Error(
|
|
42
42
|
"Brand schema violations:\n" + result.error.issues.map((i) => ` \u2022 brand.${i.path.join(".")}: ${i.message}`).join("\n")
|
|
@@ -51,23 +51,23 @@ function createCartFlowSuite(opts = {}) {
|
|
|
51
51
|
vitest.describe(opts.label ?? "cart flow against in-process mock", () => {
|
|
52
52
|
let h;
|
|
53
53
|
vitest.beforeEach(() => {
|
|
54
|
-
h =
|
|
54
|
+
h = chunkQ4I7JRGO_js.createTestClient(opts);
|
|
55
55
|
});
|
|
56
56
|
vitest.afterEach(() => h.dispose());
|
|
57
57
|
vitest.it("starts with an empty cart matching the canonical shape", async () => {
|
|
58
58
|
const res = await h.client.cart.get();
|
|
59
59
|
vitest.expect(res.ok).toBe(true);
|
|
60
60
|
if (!res.ok) return;
|
|
61
|
-
vitest.expect(() =>
|
|
61
|
+
vitest.expect(() => chunkQ4I7JRGO_js.assertCart(res.value)).not.toThrow();
|
|
62
62
|
vitest.expect(res.value.items).toHaveLength(0);
|
|
63
63
|
});
|
|
64
64
|
vitest.it("adds the first product, persists it, and returns a shape-valid cart", async () => {
|
|
65
|
-
const { product, variantId } = await
|
|
65
|
+
const { product, variantId } = await chunkQ4I7JRGO_js.fixtures.addFirstProduct(h.client);
|
|
66
66
|
vitest.expect(product.id).toBeTruthy();
|
|
67
67
|
const get = await h.client.cart.get();
|
|
68
68
|
vitest.expect(get.ok).toBe(true);
|
|
69
69
|
if (!get.ok) return;
|
|
70
|
-
vitest.expect(() =>
|
|
70
|
+
vitest.expect(() => chunkQ4I7JRGO_js.assertCart(get.value)).not.toThrow();
|
|
71
71
|
vitest.expect(get.value.items).toHaveLength(1);
|
|
72
72
|
vitest.expect(get.value.items[0]?.item_id).toBe(product.id);
|
|
73
73
|
if (variantId) {
|
|
@@ -78,8 +78,8 @@ function createCartFlowSuite(opts = {}) {
|
|
|
78
78
|
vitest.expect(parseFloat(String(get.value.pricing.subtotal))).toBeGreaterThan(0);
|
|
79
79
|
});
|
|
80
80
|
vitest.it("dedupes by line_key when adding the same product twice", async () => {
|
|
81
|
-
await
|
|
82
|
-
await
|
|
81
|
+
await chunkQ4I7JRGO_js.fixtures.addFirstProduct(h.client);
|
|
82
|
+
await chunkQ4I7JRGO_js.fixtures.addFirstProduct(h.client);
|
|
83
83
|
const res = await h.client.cart.get();
|
|
84
84
|
vitest.expect(res.ok).toBe(true);
|
|
85
85
|
if (!res.ok) return;
|
|
@@ -87,7 +87,7 @@ function createCartFlowSuite(opts = {}) {
|
|
|
87
87
|
vitest.expect(res.value.items[0]?.quantity).toBe(2);
|
|
88
88
|
});
|
|
89
89
|
vitest.it("removes items and zeroes the subtotal", async () => {
|
|
90
|
-
await
|
|
90
|
+
await chunkQ4I7JRGO_js.fixtures.addFirstProduct(h.client);
|
|
91
91
|
const before = await h.client.cart.get();
|
|
92
92
|
if (!before.ok) throw before.error;
|
|
93
93
|
const itemId = before.value.items[0]?.id;
|
|
@@ -113,28 +113,28 @@ function createContractSuite(opts = {}) {
|
|
|
113
113
|
vitest.describe(opts.label ?? "SDK \u2194 mock contract", () => {
|
|
114
114
|
let h;
|
|
115
115
|
vitest.beforeEach(() => {
|
|
116
|
-
h =
|
|
116
|
+
h = chunkQ4I7JRGO_js.createTestClient(opts);
|
|
117
117
|
});
|
|
118
118
|
vitest.afterEach(() => h.dispose());
|
|
119
119
|
vitest.it("AddItemPayload schema accepts a minimal valid body", () => {
|
|
120
|
-
const result =
|
|
120
|
+
const result = chunkQ4I7JRGO_js.AddItemPayloadSchema.safeParse({ item_id: "prod_x", quantity: 1 });
|
|
121
121
|
vitest.expect(result.success).toBe(true);
|
|
122
122
|
});
|
|
123
123
|
vitest.it("AddItemPayload schema rejects negative quantity", () => {
|
|
124
|
-
const result =
|
|
124
|
+
const result = chunkQ4I7JRGO_js.AddItemPayloadSchema.safeParse({ item_id: "prod_x", quantity: -1 });
|
|
125
125
|
vitest.expect(result.success).toBe(false);
|
|
126
126
|
});
|
|
127
127
|
vitest.it("AddItemPayload schema rejects empty item_id", () => {
|
|
128
|
-
const result =
|
|
128
|
+
const result = chunkQ4I7JRGO_js.AddItemPayloadSchema.safeParse({ item_id: "", quantity: 1 });
|
|
129
129
|
vitest.expect(result.success).toBe(false);
|
|
130
130
|
});
|
|
131
131
|
vitest.it("Cart line items returned by the mock match CartItemSchema", async () => {
|
|
132
|
-
const { product } = await
|
|
132
|
+
const { product } = await chunkQ4I7JRGO_js.fixtures.addFirstProduct(h.client);
|
|
133
133
|
const get = await h.client.cart.get();
|
|
134
134
|
if (!get.ok) throw get.error;
|
|
135
135
|
vitest.expect(get.value.items.length).toBeGreaterThan(0);
|
|
136
136
|
for (const item of get.value.items) {
|
|
137
|
-
const result =
|
|
137
|
+
const result = chunkQ4I7JRGO_js.CartItemSchema.safeParse(item);
|
|
138
138
|
if (!result.success) {
|
|
139
139
|
const issues = result.error.issues.map((i) => ` \u2022 ${i.path.join(".")}: ${i.message}`).join("\n");
|
|
140
140
|
throw new Error(`Cart item shape mismatch for ${product.name}:
|
|
@@ -144,19 +144,19 @@ ${issues}`);
|
|
|
144
144
|
}
|
|
145
145
|
});
|
|
146
146
|
vitest.it("CheckoutResponse from the mock includes bill_token", async () => {
|
|
147
|
-
await
|
|
147
|
+
await chunkQ4I7JRGO_js.fixtures.addFirstProduct(h.client);
|
|
148
148
|
const cartRes = await h.client.cart.get();
|
|
149
149
|
if (!cartRes.ok) throw cartRes.error;
|
|
150
150
|
const checkout = await h.client.checkout.process({
|
|
151
151
|
cart_id: cartRes.value.id,
|
|
152
|
-
customer:
|
|
152
|
+
customer: chunkQ4I7JRGO_js.fixtures.customer(),
|
|
153
153
|
order_type: "delivery",
|
|
154
154
|
payment_method: "mobile_money",
|
|
155
155
|
mobile_money_details: { phone_number: "+233244000000", provider: "mtn" }
|
|
156
156
|
});
|
|
157
157
|
vitest.expect(checkout.ok).toBe(true);
|
|
158
158
|
if (!checkout.ok) return;
|
|
159
|
-
const result =
|
|
159
|
+
const result = chunkQ4I7JRGO_js.CheckoutResponseSchema.safeParse(checkout.value);
|
|
160
160
|
if (!result.success) {
|
|
161
161
|
const issues = result.error.issues.map((i) => ` \u2022 ${i.path.join(".")}: ${i.message}`).join("\n");
|
|
162
162
|
throw new Error(`CheckoutResponse shape mismatch:
|
package/dist/testing/suite.mjs
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { assertBrand, SeedNameSchema, BrandSchema, createTestClient, assertCart, fixtures, AddItemPayloadSchema, CartItemSchema, CheckoutResponseSchema } from '../chunk-
|
|
1
|
+
import { assertBrand, SeedNameSchema, BrandSchema, createTestClient, assertCart, fixtures, AddItemPayloadSchema, CartItemSchema, CheckoutResponseSchema } from '../chunk-GLOO4HUN.mjs';
|
|
2
2
|
import '../chunk-5OK3YDZC.mjs';
|
|
3
3
|
import '../chunk-XZPO5GEM.mjs';
|
|
4
4
|
import '../chunk-NRT6PVW5.mjs';
|
|
5
|
-
import '../chunk-
|
|
5
|
+
import '../chunk-KSKZAXG2.mjs';
|
|
6
6
|
import '../chunk-XPXAZXF2.mjs';
|
|
7
7
|
import { describe, it, expect, beforeEach, afterEach } from 'vitest';
|
|
8
8
|
|