commerce-kit 0.55.0 → 0.56.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/api-types.d.ts +471 -11
- package/dist/index.d.ts +17 -3
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/package.json +10 -10
package/dist/api-types.d.ts
CHANGED
|
@@ -4426,6 +4426,472 @@ type APICartRemoveItemResult = {
|
|
|
4426
4426
|
type APICartRemoveItemQueryParams = {
|
|
4427
4427
|
subscriptionPlanId?: string | undefined;
|
|
4428
4428
|
};
|
|
4429
|
+
type APICartCouponApplyBody = {
|
|
4430
|
+
code: string;
|
|
4431
|
+
};
|
|
4432
|
+
type APICartCouponApplyResult = {
|
|
4433
|
+
lineItems: {
|
|
4434
|
+
productVariant: {
|
|
4435
|
+
product: {
|
|
4436
|
+
bundleProducts: {
|
|
4437
|
+
variant: Omit<{
|
|
4438
|
+
storeId: string | null;
|
|
4439
|
+
product: {
|
|
4440
|
+
productTaxRate: {
|
|
4441
|
+
taxRate: {
|
|
4442
|
+
rate: string;
|
|
4443
|
+
label: string | null;
|
|
4444
|
+
};
|
|
4445
|
+
} | null;
|
|
4446
|
+
id: string;
|
|
4447
|
+
name: string;
|
|
4448
|
+
slug: string;
|
|
4449
|
+
images: string[];
|
|
4450
|
+
};
|
|
4451
|
+
id: string;
|
|
4452
|
+
createdAt: string;
|
|
4453
|
+
updatedAt: string;
|
|
4454
|
+
description: string | null;
|
|
4455
|
+
price: string;
|
|
4456
|
+
images: string[];
|
|
4457
|
+
sku: string | null;
|
|
4458
|
+
barcode: string | null;
|
|
4459
|
+
calculatedPrice: string | null;
|
|
4460
|
+
stock: number | null;
|
|
4461
|
+
depth: number | null;
|
|
4462
|
+
width: number | null;
|
|
4463
|
+
height: number | null;
|
|
4464
|
+
weight: number | null;
|
|
4465
|
+
digital: string[] | null;
|
|
4466
|
+
shippable: boolean;
|
|
4467
|
+
externalId: string | null;
|
|
4468
|
+
productId: string;
|
|
4469
|
+
attributes: unknown;
|
|
4470
|
+
originalPrice: string;
|
|
4471
|
+
prices: {
|
|
4472
|
+
createdAt: string;
|
|
4473
|
+
updatedAt: string;
|
|
4474
|
+
currency: string;
|
|
4475
|
+
storeId: string;
|
|
4476
|
+
price: string;
|
|
4477
|
+
calculatedPrice: string | null;
|
|
4478
|
+
variantId: string;
|
|
4479
|
+
}[];
|
|
4480
|
+
}, "prices">;
|
|
4481
|
+
createdAt: string;
|
|
4482
|
+
updatedAt: string;
|
|
4483
|
+
position: number;
|
|
4484
|
+
bundleId: string;
|
|
4485
|
+
maxQuantity: number | null;
|
|
4486
|
+
quantity: number;
|
|
4487
|
+
variantId: string;
|
|
4488
|
+
groupId: string | null;
|
|
4489
|
+
forced: boolean;
|
|
4490
|
+
defaultSelected: boolean;
|
|
4491
|
+
}[];
|
|
4492
|
+
id: string;
|
|
4493
|
+
name: string;
|
|
4494
|
+
createdAt: string;
|
|
4495
|
+
updatedAt: string;
|
|
4496
|
+
type: "set" | "product" | "bundle";
|
|
4497
|
+
slug: string;
|
|
4498
|
+
status: "published" | "draft" | "hidden" | null;
|
|
4499
|
+
flags: unknown;
|
|
4500
|
+
storeId: string;
|
|
4501
|
+
summary: string | null;
|
|
4502
|
+
content: JSONContent | null;
|
|
4503
|
+
images: string[];
|
|
4504
|
+
badge: unknown;
|
|
4505
|
+
bundleDiscountPercentage: string | null;
|
|
4506
|
+
bundlePriceMode: "fixed" | "percent" | "amount";
|
|
4507
|
+
bundleFixedPriceAmount: string | null;
|
|
4508
|
+
bundleAmountOffAmount: string | null;
|
|
4509
|
+
seo: {
|
|
4510
|
+
title?: string | null | undefined;
|
|
4511
|
+
description?: string | null | undefined;
|
|
4512
|
+
canonical?: string | null | undefined;
|
|
4513
|
+
} | null;
|
|
4514
|
+
stripeTaxCode: string | null;
|
|
4515
|
+
categoryId: string | null;
|
|
4516
|
+
brandId: string | null;
|
|
4517
|
+
productTaxRate: {
|
|
4518
|
+
createdAt: string;
|
|
4519
|
+
updatedAt: string;
|
|
4520
|
+
taxRateId: string;
|
|
4521
|
+
productId: string;
|
|
4522
|
+
taxRate: {
|
|
4523
|
+
id: string;
|
|
4524
|
+
name: string;
|
|
4525
|
+
createdAt: string;
|
|
4526
|
+
updatedAt: string;
|
|
4527
|
+
storeId: string;
|
|
4528
|
+
rate: string;
|
|
4529
|
+
label: string | null;
|
|
4530
|
+
};
|
|
4531
|
+
} | null;
|
|
4532
|
+
productCollections: {
|
|
4533
|
+
position: string | null;
|
|
4534
|
+
productId: string;
|
|
4535
|
+
collectionId: string;
|
|
4536
|
+
collection: {
|
|
4537
|
+
id: string;
|
|
4538
|
+
name: string;
|
|
4539
|
+
image: string | null;
|
|
4540
|
+
createdAt: string;
|
|
4541
|
+
updatedAt: string;
|
|
4542
|
+
slug: string;
|
|
4543
|
+
active: boolean;
|
|
4544
|
+
filter: {
|
|
4545
|
+
type: "manual";
|
|
4546
|
+
} | {
|
|
4547
|
+
type: "dynamicPrice";
|
|
4548
|
+
min?: number | null | undefined;
|
|
4549
|
+
max?: number | null | undefined;
|
|
4550
|
+
} | {
|
|
4551
|
+
type: "variantValues";
|
|
4552
|
+
values: Record<string, string[]>;
|
|
4553
|
+
} | {
|
|
4554
|
+
type: "newest";
|
|
4555
|
+
days?: number | null | undefined;
|
|
4556
|
+
};
|
|
4557
|
+
storeId: string;
|
|
4558
|
+
description: JSONContent | null;
|
|
4559
|
+
};
|
|
4560
|
+
}[];
|
|
4561
|
+
setProduct: {
|
|
4562
|
+
selectionCount: number;
|
|
4563
|
+
allowDuplicates: boolean;
|
|
4564
|
+
discountPercentage: string;
|
|
4565
|
+
} | null;
|
|
4566
|
+
};
|
|
4567
|
+
id: string;
|
|
4568
|
+
createdAt: string;
|
|
4569
|
+
updatedAt: string;
|
|
4570
|
+
storeId: string;
|
|
4571
|
+
description: string | null;
|
|
4572
|
+
price: string;
|
|
4573
|
+
images: string[];
|
|
4574
|
+
sku: string | null;
|
|
4575
|
+
barcode: string | null;
|
|
4576
|
+
originalPrice: string;
|
|
4577
|
+
calculatedPrice: string | null;
|
|
4578
|
+
prePromotionPrice: string | null;
|
|
4579
|
+
preVolumePricingPrice: string | null;
|
|
4580
|
+
stock: number | null;
|
|
4581
|
+
depth: number | null;
|
|
4582
|
+
width: number | null;
|
|
4583
|
+
height: number | null;
|
|
4584
|
+
weight: number | null;
|
|
4585
|
+
digital: string[] | null;
|
|
4586
|
+
shippable: boolean;
|
|
4587
|
+
externalId: string | null;
|
|
4588
|
+
productId: string;
|
|
4589
|
+
attributes: unknown;
|
|
4590
|
+
combinations: {
|
|
4591
|
+
createdAt: string;
|
|
4592
|
+
updatedAt: string;
|
|
4593
|
+
productVariantId: string;
|
|
4594
|
+
variantValueId: string;
|
|
4595
|
+
variantValue: {
|
|
4596
|
+
id: string;
|
|
4597
|
+
value: string;
|
|
4598
|
+
variantType: {
|
|
4599
|
+
id: string;
|
|
4600
|
+
label: string;
|
|
4601
|
+
};
|
|
4602
|
+
};
|
|
4603
|
+
}[];
|
|
4604
|
+
};
|
|
4605
|
+
preVolumePricingPrice: string | null;
|
|
4606
|
+
setSelections: {
|
|
4607
|
+
selectedVariant: {
|
|
4608
|
+
combinations: {
|
|
4609
|
+
createdAt: string;
|
|
4610
|
+
updatedAt: string;
|
|
4611
|
+
productVariantId: string;
|
|
4612
|
+
variantValueId: string;
|
|
4613
|
+
variantValue: {
|
|
4614
|
+
id: string;
|
|
4615
|
+
value: string;
|
|
4616
|
+
variantType: {
|
|
4617
|
+
id: string;
|
|
4618
|
+
label: string;
|
|
4619
|
+
};
|
|
4620
|
+
};
|
|
4621
|
+
}[];
|
|
4622
|
+
id: string;
|
|
4623
|
+
price: string;
|
|
4624
|
+
product: {
|
|
4625
|
+
id: string;
|
|
4626
|
+
name: string;
|
|
4627
|
+
};
|
|
4628
|
+
};
|
|
4629
|
+
id: string;
|
|
4630
|
+
createdAt: string;
|
|
4631
|
+
updatedAt: string;
|
|
4632
|
+
position: number;
|
|
4633
|
+
quantity: number;
|
|
4634
|
+
lineItemId: string;
|
|
4635
|
+
selectedVariantId: string;
|
|
4636
|
+
}[];
|
|
4637
|
+
id: string;
|
|
4638
|
+
createdAt: string;
|
|
4639
|
+
updatedAt: string;
|
|
4640
|
+
cartId: string;
|
|
4641
|
+
quantity: number;
|
|
4642
|
+
productVariantId: string;
|
|
4643
|
+
subscriptionPlanId: string | null;
|
|
4644
|
+
attendees: {
|
|
4645
|
+
name: string;
|
|
4646
|
+
email: string | null;
|
|
4647
|
+
}[] | null;
|
|
4648
|
+
subscriptionPlan: {
|
|
4649
|
+
id: string;
|
|
4650
|
+
name: string;
|
|
4651
|
+
createdAt: string;
|
|
4652
|
+
updatedAt: string;
|
|
4653
|
+
interval: number;
|
|
4654
|
+
active: boolean;
|
|
4655
|
+
storeId: string;
|
|
4656
|
+
description: string | null;
|
|
4657
|
+
position: number;
|
|
4658
|
+
cadence: "month" | "week";
|
|
4659
|
+
discountPercent: number;
|
|
4660
|
+
benefits: string | null;
|
|
4661
|
+
} | null;
|
|
4662
|
+
}[];
|
|
4663
|
+
shipping: Omit<{
|
|
4664
|
+
id: string;
|
|
4665
|
+
name: string;
|
|
4666
|
+
createdAt: string;
|
|
4667
|
+
updatedAt: string;
|
|
4668
|
+
type: "courier" | "parcel" | "pickup_point" | "in_store";
|
|
4669
|
+
storeId: string;
|
|
4670
|
+
description: string | null;
|
|
4671
|
+
price: string;
|
|
4672
|
+
minShippingTime: number | null;
|
|
4673
|
+
maxShippingTime: number | null;
|
|
4674
|
+
freeShippingThreshold: string | null;
|
|
4675
|
+
position: number | null;
|
|
4676
|
+
addonId: string | null;
|
|
4677
|
+
addonData: unknown;
|
|
4678
|
+
deliverySlots: unknown;
|
|
4679
|
+
countries: string[] | null;
|
|
4680
|
+
shippingAddon: {
|
|
4681
|
+
id: string;
|
|
4682
|
+
name: string;
|
|
4683
|
+
createdAt: string;
|
|
4684
|
+
updatedAt: string;
|
|
4685
|
+
type: "shipping" | "analytics" | "products" | "invoicing" | "orders";
|
|
4686
|
+
storeId: string;
|
|
4687
|
+
} | null;
|
|
4688
|
+
shippingTaxRate: {
|
|
4689
|
+
createdAt: string;
|
|
4690
|
+
updatedAt: string;
|
|
4691
|
+
shippingId: string;
|
|
4692
|
+
taxRateId: string;
|
|
4693
|
+
taxRate: {
|
|
4694
|
+
id: string;
|
|
4695
|
+
name: string;
|
|
4696
|
+
createdAt: string;
|
|
4697
|
+
updatedAt: string;
|
|
4698
|
+
storeId: string;
|
|
4699
|
+
rate: string;
|
|
4700
|
+
label: string | null;
|
|
4701
|
+
};
|
|
4702
|
+
} | null;
|
|
4703
|
+
prices: {
|
|
4704
|
+
createdAt: string;
|
|
4705
|
+
updatedAt: string;
|
|
4706
|
+
currency: string;
|
|
4707
|
+
storeId: string;
|
|
4708
|
+
price: string;
|
|
4709
|
+
freeShippingThreshold: string | null;
|
|
4710
|
+
shippingId: string;
|
|
4711
|
+
}[];
|
|
4712
|
+
}, "prices"> | null;
|
|
4713
|
+
coupon: Omit<{
|
|
4714
|
+
type: "fixed" | "percentage";
|
|
4715
|
+
value: string;
|
|
4716
|
+
code: string;
|
|
4717
|
+
startDate: string | null;
|
|
4718
|
+
endDate: string | null;
|
|
4719
|
+
minProductCount: number | null;
|
|
4720
|
+
maxProductCount: number | null;
|
|
4721
|
+
products: {
|
|
4722
|
+
id: string;
|
|
4723
|
+
}[];
|
|
4724
|
+
brands: {
|
|
4725
|
+
id: string;
|
|
4726
|
+
}[];
|
|
4727
|
+
collections: {
|
|
4728
|
+
id: string;
|
|
4729
|
+
}[];
|
|
4730
|
+
categories: {
|
|
4731
|
+
id: string;
|
|
4732
|
+
}[];
|
|
4733
|
+
prices: {
|
|
4734
|
+
createdAt: string;
|
|
4735
|
+
updatedAt: string;
|
|
4736
|
+
currency: string;
|
|
4737
|
+
value: string;
|
|
4738
|
+
storeId: string;
|
|
4739
|
+
couponId: string;
|
|
4740
|
+
}[];
|
|
4741
|
+
}, "prices"> | null;
|
|
4742
|
+
customer: {
|
|
4743
|
+
id: string;
|
|
4744
|
+
email: string | null;
|
|
4745
|
+
createdAt: string;
|
|
4746
|
+
updatedAt: string;
|
|
4747
|
+
userId: string | null;
|
|
4748
|
+
storeId: string;
|
|
4749
|
+
couponId: string | null;
|
|
4750
|
+
user: {
|
|
4751
|
+
id: string;
|
|
4752
|
+
name: string;
|
|
4753
|
+
email: string;
|
|
4754
|
+
} | null;
|
|
4755
|
+
coupon: {
|
|
4756
|
+
type: "fixed" | "percentage";
|
|
4757
|
+
value: string;
|
|
4758
|
+
code: string;
|
|
4759
|
+
startDate: string | null;
|
|
4760
|
+
endDate: string | null;
|
|
4761
|
+
minProductCount: number | null;
|
|
4762
|
+
maxProductCount: number | null;
|
|
4763
|
+
products: {
|
|
4764
|
+
id: string;
|
|
4765
|
+
}[];
|
|
4766
|
+
brands: {
|
|
4767
|
+
id: string;
|
|
4768
|
+
}[];
|
|
4769
|
+
collections: {
|
|
4770
|
+
id: string;
|
|
4771
|
+
}[];
|
|
4772
|
+
categories: {
|
|
4773
|
+
id: string;
|
|
4774
|
+
}[];
|
|
4775
|
+
prices: {
|
|
4776
|
+
createdAt: string;
|
|
4777
|
+
updatedAt: string;
|
|
4778
|
+
currency: string;
|
|
4779
|
+
value: string;
|
|
4780
|
+
storeId: string;
|
|
4781
|
+
couponId: string;
|
|
4782
|
+
}[];
|
|
4783
|
+
} | null;
|
|
4784
|
+
} | {
|
|
4785
|
+
coupon: Omit<{
|
|
4786
|
+
type: "fixed" | "percentage";
|
|
4787
|
+
value: string;
|
|
4788
|
+
code: string;
|
|
4789
|
+
startDate: string | null;
|
|
4790
|
+
endDate: string | null;
|
|
4791
|
+
minProductCount: number | null;
|
|
4792
|
+
maxProductCount: number | null;
|
|
4793
|
+
products: {
|
|
4794
|
+
id: string;
|
|
4795
|
+
}[];
|
|
4796
|
+
brands: {
|
|
4797
|
+
id: string;
|
|
4798
|
+
}[];
|
|
4799
|
+
collections: {
|
|
4800
|
+
id: string;
|
|
4801
|
+
}[];
|
|
4802
|
+
categories: {
|
|
4803
|
+
id: string;
|
|
4804
|
+
}[];
|
|
4805
|
+
prices: {
|
|
4806
|
+
createdAt: string;
|
|
4807
|
+
updatedAt: string;
|
|
4808
|
+
currency: string;
|
|
4809
|
+
value: string;
|
|
4810
|
+
storeId: string;
|
|
4811
|
+
couponId: string;
|
|
4812
|
+
}[];
|
|
4813
|
+
}, "prices">;
|
|
4814
|
+
id: string;
|
|
4815
|
+
email: string | null;
|
|
4816
|
+
createdAt: string;
|
|
4817
|
+
updatedAt: string;
|
|
4818
|
+
userId: string | null;
|
|
4819
|
+
storeId: string;
|
|
4820
|
+
couponId: string | null;
|
|
4821
|
+
user: {
|
|
4822
|
+
id: string;
|
|
4823
|
+
name: string;
|
|
4824
|
+
email: string;
|
|
4825
|
+
} | null;
|
|
4826
|
+
} | null;
|
|
4827
|
+
id: string;
|
|
4828
|
+
createdAt: string;
|
|
4829
|
+
updatedAt: string;
|
|
4830
|
+
currency: string | null;
|
|
4831
|
+
storeId: string;
|
|
4832
|
+
addonData: Record<string, unknown> | null | undefined;
|
|
4833
|
+
couponId: string | null;
|
|
4834
|
+
customerId: string | null;
|
|
4835
|
+
stripePaymentIntentId: string | null;
|
|
4836
|
+
checkoutSessionId: string | null;
|
|
4837
|
+
shippingId: string | null;
|
|
4838
|
+
shippingAddressId: string | null;
|
|
4839
|
+
billingAddressId: string | null;
|
|
4840
|
+
deliverySlot: unknown;
|
|
4841
|
+
ucpSessionStatus: "incomplete" | "ready_for_complete" | "requires_escalation" | "complete_in_progress" | "completed" | "canceled" | null;
|
|
4842
|
+
ucpMetadata: {
|
|
4843
|
+
buyerEmail?: string;
|
|
4844
|
+
buyerName?: string;
|
|
4845
|
+
buyerPhone?: string;
|
|
4846
|
+
agentId?: string;
|
|
4847
|
+
externalReference?: string;
|
|
4848
|
+
escalationReason?: string;
|
|
4849
|
+
} | null;
|
|
4850
|
+
acpSessionStatus: "completed" | "canceled" | "not_ready_for_payment" | "ready_for_payment" | null;
|
|
4851
|
+
acpMetadata: {
|
|
4852
|
+
buyerEmail?: string;
|
|
4853
|
+
buyerName?: string;
|
|
4854
|
+
buyerPhone?: string;
|
|
4855
|
+
agentId?: string;
|
|
4856
|
+
externalReference?: string;
|
|
4857
|
+
idempotencyKey?: string;
|
|
4858
|
+
} | null;
|
|
4859
|
+
billingAddress: {
|
|
4860
|
+
id: string;
|
|
4861
|
+
name: string | null;
|
|
4862
|
+
createdAt: string;
|
|
4863
|
+
updatedAt: string;
|
|
4864
|
+
type: "shipping" | "billing" | "merchant";
|
|
4865
|
+
company: string | null;
|
|
4866
|
+
city: string | null;
|
|
4867
|
+
country: string | null;
|
|
4868
|
+
line1: string | null;
|
|
4869
|
+
line2: string | null;
|
|
4870
|
+
postalCode: string | null;
|
|
4871
|
+
state: string | null;
|
|
4872
|
+
phone: string | null;
|
|
4873
|
+
taxId: string | null;
|
|
4874
|
+
} | null;
|
|
4875
|
+
shippingAddress: {
|
|
4876
|
+
id: string;
|
|
4877
|
+
name: string | null;
|
|
4878
|
+
createdAt: string;
|
|
4879
|
+
updatedAt: string;
|
|
4880
|
+
type: "shipping" | "billing" | "merchant";
|
|
4881
|
+
company: string | null;
|
|
4882
|
+
city: string | null;
|
|
4883
|
+
country: string | null;
|
|
4884
|
+
line1: string | null;
|
|
4885
|
+
line2: string | null;
|
|
4886
|
+
postalCode: string | null;
|
|
4887
|
+
state: string | null;
|
|
4888
|
+
phone: string | null;
|
|
4889
|
+
taxId: string | null;
|
|
4890
|
+
} | null;
|
|
4891
|
+
} | null | undefined;
|
|
4892
|
+
type APICartCouponRemoveResult = {
|
|
4893
|
+
ok: boolean;
|
|
4894
|
+
};
|
|
4429
4895
|
type APICouponGetByIdResult = {
|
|
4430
4896
|
id: string;
|
|
4431
4897
|
code: string;
|
|
@@ -7614,20 +8080,14 @@ type APISubscriberCreateBody = {
|
|
|
7614
8080
|
};
|
|
7615
8081
|
type APISubscriberCreateResult = {
|
|
7616
8082
|
id: string;
|
|
7617
|
-
name: string | null;
|
|
7618
8083
|
email: string;
|
|
7619
|
-
|
|
7620
|
-
updatedAt: string;
|
|
7621
|
-
storeId: string;
|
|
7622
|
-
location: string | null;
|
|
8084
|
+
name: string | null;
|
|
7623
8085
|
source: string;
|
|
7624
8086
|
placement: string | null;
|
|
7625
|
-
|
|
7626
|
-
|
|
7627
|
-
unsubscribeToken: string | null;
|
|
7628
|
-
} & {
|
|
8087
|
+
pending: boolean;
|
|
8088
|
+
createdAt: string;
|
|
7629
8089
|
welcomeOffer: {
|
|
7630
|
-
status: "queued" | "off";
|
|
8090
|
+
status: "queued" | "pending_confirmation" | "off";
|
|
7631
8091
|
};
|
|
7632
8092
|
};
|
|
7633
8093
|
type APISubscriberDeleteResult = {
|
|
@@ -8619,4 +9079,4 @@ type APICartDeleteResult = {
|
|
|
8619
9079
|
success: boolean;
|
|
8620
9080
|
};
|
|
8621
9081
|
|
|
8622
|
-
export type { APIBlogCategoriesBrowseQueryParams, APIBlogCategoriesBrowseResult, APIBlogCategoryCreateBody, APIBlogCategoryCreateResult, APIBlogCategoryDeleteResult, APIBlogCategoryGetByIdParams, APIBlogCategoryGetByIdResult, APIBlogCategoryUpdateBody, APIBlogCategoryUpdateResult, APIBrandAssignProductsBody, APIBrandAssignProductsResult, APIBrandCreateBody, APIBrandCreateResult, APIBrandDeleteResult, APIBrandGetByIdParams, APIBrandGetByIdResult, APIBrandUpdateBody, APIBrandUpdateResult, APIBrandsBrowseQueryParams, APIBrandsBrowseResult, APICartAddBody, APICartAddResult, APICartCreateBody, APICartCreateResult, APICartDeleteResult, APICartGetResult, APICartRemoveItemQueryParams, APICartRemoveItemResult, APICategoriesBrowseQueryParams, APICategoriesBrowseResult, APICategoryCreateBody, APICategoryCreateResult, APICategoryDeleteResult, APICategoryGetByIdParams, APICategoryGetByIdQueryParams, APICategoryGetByIdResult, APICategoryUpdateBody, APICategoryUpdateQueryParams, APICategoryUpdateResult, APICollectionCreateBody, APICollectionCreateResult, APICollectionDeleteResult, APICollectionGetByIdParams, APICollectionGetByIdQueryParams, APICollectionGetByIdResult, APICollectionUpdateBody, APICollectionUpdateResult, APICollectionsBrowseQueryParams, APICollectionsBrowseResult, APIContactMessageCreateBody, APIContactMessageCreateResult, APICouponCreateBody, APICouponCreateResult, APICouponDeleteResult, APICouponGetByIdParams, APICouponGetByIdResult, APICouponUpdateBody, APICouponUpdateResult, APICouponsBrowseQueryParams, APICouponsBrowseResult, APICustomerAddressCreateBody, APICustomerAddressCreateResult, APICustomerGetByIdParams, APICustomerGetByIdResult, APICustomerOrdersBrowseQueryParams, APICustomerOrdersBrowseResult, APICustomerUpdateBody, APICustomerUpdateResult, APICustomersBrowseQueryParams, APICustomersBrowseResult, APIEventAttendeesBrowseResult, APIEventCreateBody, APIEventCreateResult, APIEventGetByIdParams, APIEventGetByIdResult, APIEventUpdateBody, APIEventUpdateResult, APIEventsBrowseQueryParams, APIEventsBrowseResult, APIInstaviewImagesBrowseParams, APIInstaviewImagesBrowseQueryParams, APIInstaviewImagesBrowseResult, APIInventoryAdjustBody, APIInventoryAdjustResult, APIInventoryBrowseQueryParams, APIInventoryBrowseResult, APILegalPageCreateBody, APILegalPageCreateQueryParams, APILegalPageCreateResult, APILegalPageGetByPathParams, APILegalPageGetByPathQueryParams, APILegalPageGetByPathResult, APILegalPageUpdateBody, APILegalPageUpdateQueryParams, APILegalPageUpdateResult, APILegalPagesBrowseQueryParams, APILegalPagesBrowseResult, APIMeGetResult, APIMeStore, APIOrderGetByIdParams, APIOrderGetByIdResult, APIOrderRefundGetParams, APIOrderRefundGetResult, APIOrderRefundsBrowseQueryParams, APIOrderRefundsBrowseResult, APIOrderRefundsParams, APIOrderUpdateBody, APIOrderUpdateResult, APIOrdersBrowseQueryParams, APIOrdersBrowseResult, APIPostCommentCreateBody, APIPostCommentCreateResult, APIPostCommentsBrowseQueryParams, APIPostCommentsBrowseResult, APIPostCreateBody, APIPostCreateResult, APIPostDeleteResult, APIPostGetByIdParams, APIPostGetByIdResult, APIPostUpdateBody, APIPostUpdateResult, APIPostsBrowseQueryParams, APIPostsBrowseResult, APIProductBatchBody, APIProductBatchResult, APIProductCreateBody, APIProductCreateResult, APIProductDeleteQueryParams, APIProductDeleteResult, APIProductFiltersResult, APIProductGetByIdParams, APIProductGetByIdQueryParams, APIProductGetByIdResult, APIProductReviewCreateBody, APIProductReviewCreateResult, APIProductReviewsBrowseQueryParams, APIProductReviewsBrowseResult, APIProductUpdateBody, APIProductUpdateQueryParams, APIProductUpdateResult, APIProductsBrowseQueryParams, APIProductsBrowseResult, APISearchQueryParams, APISearchResult, APISocialsGetResult, APISubscriberCreateBody, APISubscriberCreateResult, APISubscriberDeleteResult, APISupportCase, APISupportCaseCreateBody, APISupportCaseCreateResult, APISupportCaseGetParams, APISupportCaseGetResult, APISupportCaseMessage, APISupportCaseMessageCreateBody, APISupportCaseMessageCreateResult, APISupportCaseUpdateBody, APISupportCaseUpdateResult, APISupportCasesBrowseQueryParams, APISupportCasesBrowseResult, APITicketAttendeeGetParams, APITicketAttendeeGetResult, APITicketsGetParams, APITicketsGetQueryParams, APITicketsGetResult, APITicketsUpdateBody, APITicketsUpdateResult, APIVariantCreateBody, APIVariantCreateResult, APIVariantGetByIdParams, APIVariantGetByIdQueryParams, APIVariantGetByIdResult, APIVariantUpdateBody, APIVariantUpdateResult, JSONContent };
|
|
9082
|
+
export type { APIBlogCategoriesBrowseQueryParams, APIBlogCategoriesBrowseResult, APIBlogCategoryCreateBody, APIBlogCategoryCreateResult, APIBlogCategoryDeleteResult, APIBlogCategoryGetByIdParams, APIBlogCategoryGetByIdResult, APIBlogCategoryUpdateBody, APIBlogCategoryUpdateResult, APIBrandAssignProductsBody, APIBrandAssignProductsResult, APIBrandCreateBody, APIBrandCreateResult, APIBrandDeleteResult, APIBrandGetByIdParams, APIBrandGetByIdResult, APIBrandUpdateBody, APIBrandUpdateResult, APIBrandsBrowseQueryParams, APIBrandsBrowseResult, APICartAddBody, APICartAddResult, APICartCouponApplyBody, APICartCouponApplyResult, APICartCouponRemoveResult, APICartCreateBody, APICartCreateResult, APICartDeleteResult, APICartGetResult, APICartRemoveItemQueryParams, APICartRemoveItemResult, APICategoriesBrowseQueryParams, APICategoriesBrowseResult, APICategoryCreateBody, APICategoryCreateResult, APICategoryDeleteResult, APICategoryGetByIdParams, APICategoryGetByIdQueryParams, APICategoryGetByIdResult, APICategoryUpdateBody, APICategoryUpdateQueryParams, APICategoryUpdateResult, APICollectionCreateBody, APICollectionCreateResult, APICollectionDeleteResult, APICollectionGetByIdParams, APICollectionGetByIdQueryParams, APICollectionGetByIdResult, APICollectionUpdateBody, APICollectionUpdateResult, APICollectionsBrowseQueryParams, APICollectionsBrowseResult, APIContactMessageCreateBody, APIContactMessageCreateResult, APICouponCreateBody, APICouponCreateResult, APICouponDeleteResult, APICouponGetByIdParams, APICouponGetByIdResult, APICouponUpdateBody, APICouponUpdateResult, APICouponsBrowseQueryParams, APICouponsBrowseResult, APICustomerAddressCreateBody, APICustomerAddressCreateResult, APICustomerGetByIdParams, APICustomerGetByIdResult, APICustomerOrdersBrowseQueryParams, APICustomerOrdersBrowseResult, APICustomerUpdateBody, APICustomerUpdateResult, APICustomersBrowseQueryParams, APICustomersBrowseResult, APIEventAttendeesBrowseResult, APIEventCreateBody, APIEventCreateResult, APIEventGetByIdParams, APIEventGetByIdResult, APIEventUpdateBody, APIEventUpdateResult, APIEventsBrowseQueryParams, APIEventsBrowseResult, APIInstaviewImagesBrowseParams, APIInstaviewImagesBrowseQueryParams, APIInstaviewImagesBrowseResult, APIInventoryAdjustBody, APIInventoryAdjustResult, APIInventoryBrowseQueryParams, APIInventoryBrowseResult, APILegalPageCreateBody, APILegalPageCreateQueryParams, APILegalPageCreateResult, APILegalPageGetByPathParams, APILegalPageGetByPathQueryParams, APILegalPageGetByPathResult, APILegalPageUpdateBody, APILegalPageUpdateQueryParams, APILegalPageUpdateResult, APILegalPagesBrowseQueryParams, APILegalPagesBrowseResult, APIMeGetResult, APIMeStore, APIOrderGetByIdParams, APIOrderGetByIdResult, APIOrderRefundGetParams, APIOrderRefundGetResult, APIOrderRefundsBrowseQueryParams, APIOrderRefundsBrowseResult, APIOrderRefundsParams, APIOrderUpdateBody, APIOrderUpdateResult, APIOrdersBrowseQueryParams, APIOrdersBrowseResult, APIPostCommentCreateBody, APIPostCommentCreateResult, APIPostCommentsBrowseQueryParams, APIPostCommentsBrowseResult, APIPostCreateBody, APIPostCreateResult, APIPostDeleteResult, APIPostGetByIdParams, APIPostGetByIdResult, APIPostUpdateBody, APIPostUpdateResult, APIPostsBrowseQueryParams, APIPostsBrowseResult, APIProductBatchBody, APIProductBatchResult, APIProductCreateBody, APIProductCreateResult, APIProductDeleteQueryParams, APIProductDeleteResult, APIProductFiltersResult, APIProductGetByIdParams, APIProductGetByIdQueryParams, APIProductGetByIdResult, APIProductReviewCreateBody, APIProductReviewCreateResult, APIProductReviewsBrowseQueryParams, APIProductReviewsBrowseResult, APIProductUpdateBody, APIProductUpdateQueryParams, APIProductUpdateResult, APIProductsBrowseQueryParams, APIProductsBrowseResult, APISearchQueryParams, APISearchResult, APISocialsGetResult, APISubscriberCreateBody, APISubscriberCreateResult, APISubscriberDeleteResult, APISupportCase, APISupportCaseCreateBody, APISupportCaseCreateResult, APISupportCaseGetParams, APISupportCaseGetResult, APISupportCaseMessage, APISupportCaseMessageCreateBody, APISupportCaseMessageCreateResult, APISupportCaseUpdateBody, APISupportCaseUpdateResult, APISupportCasesBrowseQueryParams, APISupportCasesBrowseResult, APITicketAttendeeGetParams, APITicketAttendeeGetResult, APITicketsGetParams, APITicketsGetQueryParams, APITicketsGetResult, APITicketsUpdateBody, APITicketsUpdateResult, APIVariantCreateBody, APIVariantCreateResult, APIVariantGetByIdParams, APIVariantGetByIdQueryParams, APIVariantGetByIdResult, APIVariantUpdateBody, APIVariantUpdateResult, JSONContent };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { APIMeGetResult, APISocialsGetResult, APIBrandsBrowseQueryParams, APIBrandsBrowseResult, APIBrandGetByIdParams, APIBrandGetByIdResult, APIBrandCreateBody, APIBrandCreateResult, APIBrandUpdateBody, APIBrandUpdateResult, APIBrandDeleteResult, APIBrandAssignProductsBody, APIBrandAssignProductsResult, APIOrderRefundsParams, APIOrderRefundsBrowseQueryParams, APIOrderRefundsBrowseResult, APIOrderRefundGetParams, APIOrderRefundGetResult, APIProductBatchBody, APIProductBatchResult, APICartDeleteResult, APIProductsBrowseQueryParams, APIProductsBrowseResult, APIProductFiltersResult, APIProductGetByIdParams, APIProductGetByIdResult, APIOrdersBrowseQueryParams, APIOrdersBrowseResult, APIOrderGetByIdParams, APIOrderGetByIdResult, APICartCreateBody, APICartCreateResult, APICartGetResult, APICouponsBrowseQueryParams, APICouponsBrowseResult, APICouponGetByIdParams, APICouponGetByIdResult, APICouponCreateBody, APICouponCreateResult, APICouponUpdateBody, APICouponUpdateResult, APICouponDeleteResult, APISupportCasesBrowseQueryParams, APISupportCasesBrowseResult, APISupportCaseGetParams, APISupportCaseGetResult, APISupportCaseCreateBody, APISupportCaseCreateResult, APISupportCaseUpdateBody, APISupportCaseUpdateResult, APISupportCaseMessageCreateBody, APISupportCaseMessageCreateResult, APICollectionGetByIdParams, APICollectionGetByIdResult, APICollectionsBrowseQueryParams, APICollectionsBrowseResult, APICollectionCreateBody, APICollectionCreateResult, APICollectionUpdateBody, APICollectionUpdateResult, APICollectionDeleteResult, APICategoryGetByIdParams, APICategoryGetByIdResult, APICategoriesBrowseQueryParams, APICategoriesBrowseResult, APIPostsBrowseQueryParams, APIPostsBrowseResult, APIPostGetByIdParams, APIPostGetByIdResult, APIPostCreateBody, APIPostCreateResult, APIPostUpdateBody, APIPostUpdateResult, APIPostDeleteResult, APIPostCommentsBrowseQueryParams, APIPostCommentsBrowseResult, APIPostCommentCreateBody, APIPostCommentCreateResult, APIBlogCategoriesBrowseQueryParams, APIBlogCategoriesBrowseResult, APIBlogCategoryGetByIdParams, APIBlogCategoryGetByIdResult, APIBlogCategoryCreateBody, APIBlogCategoryCreateResult, APIBlogCategoryUpdateBody, APIBlogCategoryUpdateResult, APIBlogCategoryDeleteResult, APICustomersBrowseQueryParams, APICustomersBrowseResult, APICustomerGetByIdParams, APICustomerGetByIdResult, APICustomerUpdateBody, APICustomerUpdateResult, APICustomerAddressCreateBody, APICustomerAddressCreateResult, APICustomerOrdersBrowseQueryParams, APICustomerOrdersBrowseResult, APIInventoryBrowseQueryParams, APIInventoryBrowseResult, APIInventoryAdjustBody, APIInventoryAdjustResult, APIVariantGetByIdParams, APIVariantGetByIdResult, APIVariantUpdateBody, APIVariantUpdateResult, APIVariantCreateBody, APIVariantCreateResult, APISubscriberCreateBody, APISubscriberCreateResult, APISubscriberDeleteResult, APIContactMessageCreateBody, APIContactMessageCreateResult, APIProductCreateBody, APIProductCreateResult, APIProductUpdateBody, APIProductUpdateResult, APIProductDeleteResult, APIProductReviewsBrowseQueryParams, APIProductReviewsBrowseResult, APIProductReviewCreateBody, APIProductReviewCreateResult, APIEventsBrowseQueryParams, APIEventsBrowseResult, APIEventGetByIdParams, APIEventGetByIdResult, APIEventCreateBody, APIEventCreateResult, APIEventUpdateBody, APIEventUpdateResult, APIEventAttendeesBrowseResult, APITicketsGetResult, APITicketsUpdateBody, APITicketsUpdateResult, APITicketAttendeeGetResult, APICategoryCreateBody, APICategoryCreateResult, APICategoryUpdateBody, APICategoryUpdateResult, APICategoryDeleteResult, APIOrderUpdateBody, APIOrderUpdateResult, APILegalPagesBrowseQueryParams, APILegalPagesBrowseResult, APILegalPageGetByPathQueryParams, APILegalPageGetByPathResult, APILegalPageCreateBody, APILegalPageCreateQueryParams, APILegalPageCreateResult, APILegalPageUpdateBody, APILegalPageUpdateQueryParams, APILegalPageUpdateResult, APISearchQueryParams, APISearchResult, APIInstaviewImagesBrowseParams, APIInstaviewImagesBrowseQueryParams, APIInstaviewImagesBrowseResult } from './api-types.js';
|
|
2
|
-
export { APICartAddBody, APICartAddResult, APICartRemoveItemQueryParams, APICartRemoveItemResult, APICategoryGetByIdQueryParams, APICategoryUpdateQueryParams, APICollectionGetByIdQueryParams, APILegalPageGetByPathParams, APIMeStore, APIProductDeleteQueryParams, APIProductGetByIdQueryParams, APIProductUpdateQueryParams, APISupportCase, APISupportCaseMessage, APITicketAttendeeGetParams, APITicketsGetParams, APITicketsGetQueryParams, APIVariantGetByIdQueryParams, JSONContent } from './api-types.js';
|
|
1
|
+
import { APIMeGetResult, APISocialsGetResult, APIBrandsBrowseQueryParams, APIBrandsBrowseResult, APIBrandGetByIdParams, APIBrandGetByIdResult, APIBrandCreateBody, APIBrandCreateResult, APIBrandUpdateBody, APIBrandUpdateResult, APIBrandDeleteResult, APIBrandAssignProductsBody, APIBrandAssignProductsResult, APIOrderRefundsParams, APIOrderRefundsBrowseQueryParams, APIOrderRefundsBrowseResult, APIOrderRefundGetParams, APIOrderRefundGetResult, APIProductBatchBody, APIProductBatchResult, APICartDeleteResult, APIProductsBrowseQueryParams, APIProductsBrowseResult, APIProductFiltersResult, APIProductGetByIdParams, APIProductGetByIdResult, APIOrdersBrowseQueryParams, APIOrdersBrowseResult, APIOrderGetByIdParams, APIOrderGetByIdResult, APICartCreateBody, APICartCreateResult, APICartGetResult, APICartCouponApplyResult, APICartCouponRemoveResult, APICouponsBrowseQueryParams, APICouponsBrowseResult, APICouponGetByIdParams, APICouponGetByIdResult, APICouponCreateBody, APICouponCreateResult, APICouponUpdateBody, APICouponUpdateResult, APICouponDeleteResult, APISupportCasesBrowseQueryParams, APISupportCasesBrowseResult, APISupportCaseGetParams, APISupportCaseGetResult, APISupportCaseCreateBody, APISupportCaseCreateResult, APISupportCaseUpdateBody, APISupportCaseUpdateResult, APISupportCaseMessageCreateBody, APISupportCaseMessageCreateResult, APICollectionGetByIdParams, APICollectionGetByIdResult, APICollectionsBrowseQueryParams, APICollectionsBrowseResult, APICollectionCreateBody, APICollectionCreateResult, APICollectionUpdateBody, APICollectionUpdateResult, APICollectionDeleteResult, APICategoryGetByIdParams, APICategoryGetByIdResult, APICategoriesBrowseQueryParams, APICategoriesBrowseResult, APIPostsBrowseQueryParams, APIPostsBrowseResult, APIPostGetByIdParams, APIPostGetByIdResult, APIPostCreateBody, APIPostCreateResult, APIPostUpdateBody, APIPostUpdateResult, APIPostDeleteResult, APIPostCommentsBrowseQueryParams, APIPostCommentsBrowseResult, APIPostCommentCreateBody, APIPostCommentCreateResult, APIBlogCategoriesBrowseQueryParams, APIBlogCategoriesBrowseResult, APIBlogCategoryGetByIdParams, APIBlogCategoryGetByIdResult, APIBlogCategoryCreateBody, APIBlogCategoryCreateResult, APIBlogCategoryUpdateBody, APIBlogCategoryUpdateResult, APIBlogCategoryDeleteResult, APICustomersBrowseQueryParams, APICustomersBrowseResult, APICustomerGetByIdParams, APICustomerGetByIdResult, APICustomerUpdateBody, APICustomerUpdateResult, APICustomerAddressCreateBody, APICustomerAddressCreateResult, APICustomerOrdersBrowseQueryParams, APICustomerOrdersBrowseResult, APIInventoryBrowseQueryParams, APIInventoryBrowseResult, APIInventoryAdjustBody, APIInventoryAdjustResult, APIVariantGetByIdParams, APIVariantGetByIdResult, APIVariantUpdateBody, APIVariantUpdateResult, APIVariantCreateBody, APIVariantCreateResult, APISubscriberCreateBody, APISubscriberCreateResult, APISubscriberDeleteResult, APIContactMessageCreateBody, APIContactMessageCreateResult, APIProductCreateBody, APIProductCreateResult, APIProductUpdateBody, APIProductUpdateResult, APIProductDeleteResult, APIProductReviewsBrowseQueryParams, APIProductReviewsBrowseResult, APIProductReviewCreateBody, APIProductReviewCreateResult, APIEventsBrowseQueryParams, APIEventsBrowseResult, APIEventGetByIdParams, APIEventGetByIdResult, APIEventCreateBody, APIEventCreateResult, APIEventUpdateBody, APIEventUpdateResult, APIEventAttendeesBrowseResult, APITicketsGetResult, APITicketsUpdateBody, APITicketsUpdateResult, APITicketAttendeeGetResult, APICategoryCreateBody, APICategoryCreateResult, APICategoryUpdateBody, APICategoryUpdateResult, APICategoryDeleteResult, APIOrderUpdateBody, APIOrderUpdateResult, APILegalPagesBrowseQueryParams, APILegalPagesBrowseResult, APILegalPageGetByPathQueryParams, APILegalPageGetByPathResult, APILegalPageCreateBody, APILegalPageCreateQueryParams, APILegalPageCreateResult, APILegalPageUpdateBody, APILegalPageUpdateQueryParams, APILegalPageUpdateResult, APISearchQueryParams, APISearchResult, APIInstaviewImagesBrowseParams, APIInstaviewImagesBrowseQueryParams, APIInstaviewImagesBrowseResult } from './api-types.js';
|
|
2
|
+
export { APICartAddBody, APICartAddResult, APICartCouponApplyBody, APICartRemoveItemQueryParams, APICartRemoveItemResult, APICategoryGetByIdQueryParams, APICategoryUpdateQueryParams, APICollectionGetByIdQueryParams, APILegalPageGetByPathParams, APIMeStore, APIProductDeleteQueryParams, APIProductGetByIdQueryParams, APIProductUpdateQueryParams, APISupportCase, APISupportCaseMessage, APITicketAttendeeGetParams, APITicketsGetParams, APITicketsGetQueryParams, APIVariantGetByIdQueryParams, JSONContent } from './api-types.js';
|
|
3
3
|
|
|
4
4
|
interface CommerceConfig {
|
|
5
5
|
/** API key. Defaults to process.env.YNS_API_KEY */
|
|
@@ -71,6 +71,20 @@ declare class YNSProvider {
|
|
|
71
71
|
cartGet(params: {
|
|
72
72
|
cartId: string;
|
|
73
73
|
}): Promise<APICartGetResult | null>;
|
|
74
|
+
/**
|
|
75
|
+
* Validate and attach a coupon to the cart. Failures surface as an ApiError with
|
|
76
|
+
* status 422 and a machine-readable `reason` (couponNotFound, couponHasExpired,
|
|
77
|
+
* couponMaxUsesReached, couponIsNotValidYet, couponMinProductCountNotMet,
|
|
78
|
+
* couponMaxProductCountExceeded, couponIsNotApplicable). Returns the updated cart.
|
|
79
|
+
*/
|
|
80
|
+
cartCouponApply(params: {
|
|
81
|
+
cartId: string;
|
|
82
|
+
code: string;
|
|
83
|
+
}): Promise<APICartCouponApplyResult>;
|
|
84
|
+
/** Detach the applied coupon from the cart, if any. */
|
|
85
|
+
cartCouponRemove(params: {
|
|
86
|
+
cartId: string;
|
|
87
|
+
}): Promise<APICartCouponRemoveResult>;
|
|
74
88
|
couponBrowse(params?: APICouponsBrowseQueryParams): Promise<APICouponsBrowseResult>;
|
|
75
89
|
/** Look up a coupon by its UUID or its code. Resolves to `null` when not found. */
|
|
76
90
|
couponGet(params: APICouponGetByIdParams): Promise<APICouponGetByIdResult | null>;
|
|
@@ -204,4 +218,4 @@ declare class YNSProvider {
|
|
|
204
218
|
|
|
205
219
|
declare function Commerce(config?: CommerceConfig): YNSProvider;
|
|
206
220
|
|
|
207
|
-
export { APIBlogCategoriesBrowseQueryParams, APIBlogCategoriesBrowseResult, APIBlogCategoryCreateBody, APIBlogCategoryCreateResult, APIBlogCategoryDeleteResult, APIBlogCategoryGetByIdParams, APIBlogCategoryGetByIdResult, APIBlogCategoryUpdateBody, APIBlogCategoryUpdateResult, APIBrandAssignProductsBody, APIBrandAssignProductsResult, APIBrandCreateBody, APIBrandCreateResult, APIBrandDeleteResult, APIBrandGetByIdParams, APIBrandGetByIdResult, APIBrandUpdateBody, APIBrandUpdateResult, APIBrandsBrowseQueryParams, APIBrandsBrowseResult, APICartCreateBody, APICartCreateResult, APICartDeleteResult, APICartGetResult, APICategoriesBrowseQueryParams, APICategoriesBrowseResult, APICategoryCreateBody, APICategoryCreateResult, APICategoryDeleteResult, APICategoryGetByIdParams, APICategoryGetByIdResult, APICategoryUpdateBody, APICategoryUpdateResult, APICollectionCreateBody, APICollectionCreateResult, APICollectionDeleteResult, APICollectionGetByIdParams, APICollectionGetByIdResult, type APICollectionImportMembershipsBody, type APICollectionImportMembershipsResult, APICollectionUpdateBody, APICollectionUpdateResult, APICollectionsBrowseQueryParams, APICollectionsBrowseResult, APIContactMessageCreateBody, APIContactMessageCreateResult, APICouponCreateBody, APICouponCreateResult, APICouponDeleteResult, APICouponGetByIdParams, APICouponGetByIdResult, APICouponUpdateBody, APICouponUpdateResult, APICouponsBrowseQueryParams, APICouponsBrowseResult, APICustomerAddressCreateBody, APICustomerAddressCreateResult, APICustomerGetByIdParams, APICustomerGetByIdResult, APICustomerOrdersBrowseQueryParams, APICustomerOrdersBrowseResult, APICustomerUpdateBody, APICustomerUpdateResult, APICustomersBrowseQueryParams, APICustomersBrowseResult, APIEventAttendeesBrowseResult, APIEventCreateBody, APIEventCreateResult, APIEventGetByIdParams, APIEventGetByIdResult, APIEventUpdateBody, APIEventUpdateResult, APIEventsBrowseQueryParams, APIEventsBrowseResult, APIInstaviewImagesBrowseParams, APIInstaviewImagesBrowseQueryParams, APIInstaviewImagesBrowseResult, APIInventoryAdjustBody, APIInventoryAdjustResult, APIInventoryBrowseQueryParams, APIInventoryBrowseResult, APILegalPageCreateBody, APILegalPageCreateQueryParams, APILegalPageCreateResult, APILegalPageGetByPathQueryParams, APILegalPageGetByPathResult, APILegalPageUpdateBody, APILegalPageUpdateQueryParams, APILegalPageUpdateResult, APILegalPagesBrowseQueryParams, APILegalPagesBrowseResult, APIMeGetResult, APIOrderGetByIdParams, APIOrderGetByIdResult, APIOrderRefundGetParams, APIOrderRefundGetResult, APIOrderRefundsBrowseQueryParams, APIOrderRefundsBrowseResult, APIOrderRefundsParams, APIOrderUpdateBody, APIOrderUpdateResult, APIOrdersBrowseQueryParams, APIOrdersBrowseResult, APIPostCommentCreateBody, APIPostCommentCreateResult, APIPostCommentsBrowseQueryParams, APIPostCommentsBrowseResult, APIPostCreateBody, APIPostCreateResult, APIPostDeleteResult, APIPostGetByIdParams, APIPostGetByIdResult, APIPostUpdateBody, APIPostUpdateResult, APIPostsBrowseQueryParams, APIPostsBrowseResult, APIProductBatchBody, APIProductBatchResult, APIProductCreateBody, APIProductCreateResult, APIProductDeleteResult, APIProductFiltersResult, APIProductGetByIdParams, APIProductGetByIdResult, APIProductReviewCreateBody, APIProductReviewCreateResult, APIProductReviewsBrowseQueryParams, APIProductReviewsBrowseResult, APIProductUpdateBody, APIProductUpdateResult, APIProductsBrowseQueryParams, APIProductsBrowseResult, APISearchQueryParams, APISearchResult, APISocialsGetResult, APISubscriberCreateBody, APISubscriberCreateResult, APISubscriberDeleteResult, APISupportCaseCreateBody, APISupportCaseCreateResult, APISupportCaseGetParams, APISupportCaseGetResult, APISupportCaseMessageCreateBody, APISupportCaseMessageCreateResult, APISupportCaseUpdateBody, APISupportCaseUpdateResult, APISupportCasesBrowseQueryParams, APISupportCasesBrowseResult, APITicketAttendeeGetResult, APITicketsGetResult, APITicketsUpdateBody, APITicketsUpdateResult, APIVariantCreateBody, APIVariantCreateResult, APIVariantGetByIdParams, APIVariantGetByIdResult, APIVariantUpdateBody, APIVariantUpdateResult, Commerce, type CommerceConfig, YNSProvider };
|
|
221
|
+
export { APIBlogCategoriesBrowseQueryParams, APIBlogCategoriesBrowseResult, APIBlogCategoryCreateBody, APIBlogCategoryCreateResult, APIBlogCategoryDeleteResult, APIBlogCategoryGetByIdParams, APIBlogCategoryGetByIdResult, APIBlogCategoryUpdateBody, APIBlogCategoryUpdateResult, APIBrandAssignProductsBody, APIBrandAssignProductsResult, APIBrandCreateBody, APIBrandCreateResult, APIBrandDeleteResult, APIBrandGetByIdParams, APIBrandGetByIdResult, APIBrandUpdateBody, APIBrandUpdateResult, APIBrandsBrowseQueryParams, APIBrandsBrowseResult, APICartCouponApplyResult, APICartCouponRemoveResult, APICartCreateBody, APICartCreateResult, APICartDeleteResult, APICartGetResult, APICategoriesBrowseQueryParams, APICategoriesBrowseResult, APICategoryCreateBody, APICategoryCreateResult, APICategoryDeleteResult, APICategoryGetByIdParams, APICategoryGetByIdResult, APICategoryUpdateBody, APICategoryUpdateResult, APICollectionCreateBody, APICollectionCreateResult, APICollectionDeleteResult, APICollectionGetByIdParams, APICollectionGetByIdResult, type APICollectionImportMembershipsBody, type APICollectionImportMembershipsResult, APICollectionUpdateBody, APICollectionUpdateResult, APICollectionsBrowseQueryParams, APICollectionsBrowseResult, APIContactMessageCreateBody, APIContactMessageCreateResult, APICouponCreateBody, APICouponCreateResult, APICouponDeleteResult, APICouponGetByIdParams, APICouponGetByIdResult, APICouponUpdateBody, APICouponUpdateResult, APICouponsBrowseQueryParams, APICouponsBrowseResult, APICustomerAddressCreateBody, APICustomerAddressCreateResult, APICustomerGetByIdParams, APICustomerGetByIdResult, APICustomerOrdersBrowseQueryParams, APICustomerOrdersBrowseResult, APICustomerUpdateBody, APICustomerUpdateResult, APICustomersBrowseQueryParams, APICustomersBrowseResult, APIEventAttendeesBrowseResult, APIEventCreateBody, APIEventCreateResult, APIEventGetByIdParams, APIEventGetByIdResult, APIEventUpdateBody, APIEventUpdateResult, APIEventsBrowseQueryParams, APIEventsBrowseResult, APIInstaviewImagesBrowseParams, APIInstaviewImagesBrowseQueryParams, APIInstaviewImagesBrowseResult, APIInventoryAdjustBody, APIInventoryAdjustResult, APIInventoryBrowseQueryParams, APIInventoryBrowseResult, APILegalPageCreateBody, APILegalPageCreateQueryParams, APILegalPageCreateResult, APILegalPageGetByPathQueryParams, APILegalPageGetByPathResult, APILegalPageUpdateBody, APILegalPageUpdateQueryParams, APILegalPageUpdateResult, APILegalPagesBrowseQueryParams, APILegalPagesBrowseResult, APIMeGetResult, APIOrderGetByIdParams, APIOrderGetByIdResult, APIOrderRefundGetParams, APIOrderRefundGetResult, APIOrderRefundsBrowseQueryParams, APIOrderRefundsBrowseResult, APIOrderRefundsParams, APIOrderUpdateBody, APIOrderUpdateResult, APIOrdersBrowseQueryParams, APIOrdersBrowseResult, APIPostCommentCreateBody, APIPostCommentCreateResult, APIPostCommentsBrowseQueryParams, APIPostCommentsBrowseResult, APIPostCreateBody, APIPostCreateResult, APIPostDeleteResult, APIPostGetByIdParams, APIPostGetByIdResult, APIPostUpdateBody, APIPostUpdateResult, APIPostsBrowseQueryParams, APIPostsBrowseResult, APIProductBatchBody, APIProductBatchResult, APIProductCreateBody, APIProductCreateResult, APIProductDeleteResult, APIProductFiltersResult, APIProductGetByIdParams, APIProductGetByIdResult, APIProductReviewCreateBody, APIProductReviewCreateResult, APIProductReviewsBrowseQueryParams, APIProductReviewsBrowseResult, APIProductUpdateBody, APIProductUpdateResult, APIProductsBrowseQueryParams, APIProductsBrowseResult, APISearchQueryParams, APISearchResult, APISocialsGetResult, APISubscriberCreateBody, APISubscriberCreateResult, APISubscriberDeleteResult, APISupportCaseCreateBody, APISupportCaseCreateResult, APISupportCaseGetParams, APISupportCaseGetResult, APISupportCaseMessageCreateBody, APISupportCaseMessageCreateResult, APISupportCaseUpdateBody, APISupportCaseUpdateResult, APISupportCasesBrowseQueryParams, APISupportCasesBrowseResult, APITicketAttendeeGetResult, APITicketsGetResult, APITicketsUpdateBody, APITicketsUpdateResult, APIVariantCreateBody, APIVariantCreateResult, APIVariantGetByIdParams, APIVariantGetByIdResult, APIVariantUpdateBody, APIVariantUpdateResult, Commerce, type CommerceConfig, YNSProvider };
|
package/dist/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import"./chunk-PNKB6P4V.js";var p=process.env.YNS_API_KEY,m={YNS_API_KEY:p};var P={DEBUG:0,LOG:1,WARN:2,ERROR:3},g=process.env.NEXT_PUBLIC_LOG_LEVEL||"LOG",u=P[g],d="\x1B[0m",B="\x1B[34m",C="\x1B[32m",R="\x1B[33m",h="\x1B[31m",f="\u23F1\uFE0F",w="\u{1F41B}",S="\u2714\uFE0F",G="\u26A0\uFE0F",$="\u274C",y=`${f} `,v=`${B}${w}${d} `,U=`${C}${S}${d} `,E=`${R}${G}${d} `,O=`${h}${$}${d} `,I=c=>{let e=c?`[${c}] `:"";return{getLogger(t){return I([c,t].filter(Boolean).join(" > "))},time(t){u>P.DEBUG||console.time([y,e,t].filter(Boolean).join(" "))},timeEnd(t){u>P.DEBUG||console.timeEnd([y,e,t].filter(Boolean).join(" "))},debug(...t){u>P.DEBUG||console.log(...[v,e,...t].filter(Boolean))},log(...t){u>P.LOG||console.log(...[U,e,...t].filter(Boolean))},dir(t,s){u>P.LOG||console.dir(t,s)},warn(...t){u>P.WARN||console.warn(...[E,e,...t].filter(Boolean))},error(...t){u>P.ERROR||console.error(...[O,e,...t].filter(Boolean))}}},L=I();var l=class{#s;#t=I("YNSProvider");constructor(e={}){let t=e.token??m.YNS_API_KEY,s=m.YNS_API_KEY?.startsWith("sk-s-");if(!t)throw new Error("YNS API key is required. Set YNS_API_KEY environment variable or pass token in config.");let r=e.endpoint??(s?"https://yns.cx":"https://yns.store");this.#s={version:"v1",...e,token:t,endpoint:r},this.#t.debug("YNSProvider initialized",{endpoint:r,token:e.token?"from config":"from env"})}async#e(e,t="GET",s){let r=await this.#o(e,t,s);return this.#a(r,e,t)}async#r(e){let t=await this.#o(e,"GET");return t.status===404?null:this.#a(t,e,"GET")}async#o(e,t,s){let r=this.#t.getLogger("#restRequest"),o=`${this.#s.endpoint}/api/${this.#s.version}${e}`;return r.debug(`Making ${t} request to YNS API: ${o}`),fetch(o,{method:t,headers:{"Content-Type":"application/json",Authorization:`Bearer ${this.#s.token}`},body:s?JSON.stringify(s):void 0})}async#a(e,t,s){let r=this.#t.getLogger("#restRequest"),o=`${this.#s.endpoint}/api/${this.#s.version}${t}`;if(!e.ok){let A=e.headers.get("content-type"),i=`YNS REST request failed: ${s} ${o} ${e.status} ${e.statusText}`;if(A?.includes("application/json"))try{let n=await e.json();i=n.error||n.message||i}catch(n){r.error("Failed to parse YNS error response as JSON",n)}else{let n=await e.text();r.error(`YNS API request failed: ${e.status} ${e.statusText}`,i,n)}throw new Error(i)}let a=e.headers.get("content-type");if(!a?.includes("application/json"))throw new Error(`YNS API returned ${a} instead of JSON for ${t}`);return e.json()}async#n(e,t){let s=this.#t.getLogger("#multipartRequest"),r=`${this.#s.endpoint}/api/${this.#s.version}${e}`;s.debug(`Making multipart POST to YNS API: ${r}`);let o=await fetch(r,{method:"POST",headers:{Authorization:`Bearer ${this.#s.token}`},body:t});if(!o.ok){let A=o.headers.get("content-type"),i=`YNS REST request failed: POST ${r} ${o.status} ${o.statusText}`;if(A?.includes("application/json"))try{let n=await o.json();i=n.error||n.message||i}catch(n){s.error("Failed to parse YNS error response as JSON",n)}else{let n=await o.text();s.error(`YNS API request failed: ${o.status} ${o.statusText}`,i,n)}throw new Error(i)}let a=o.headers.get("content-type");if(!a?.includes("application/json"))throw new Error(`YNS API returned ${a} instead of JSON for ${e}`);return o.json()}async meGet(){let e=this.#t.getLogger("meGet");e.debug("Fetching my information");let s=await this.#e("/me");return e.debug("Received my information:",s),s}async socialsGet(){let e=this.#t.getLogger("socialsGet");e.debug("Fetching store social links");let s=await this.#e("/socials");return e.debug("Received store social links:",s),s}async brandBrowse(e={}){let t=new URLSearchParams;e.limit&&t.append("limit",e.limit.toString()),e.offset&&t.append("offset",e.offset.toString()),e.query&&t.append("query",e.query),e.active!==void 0&&t.append("active",e.active.toString()),e.lang&&t.append("lang",e.lang);let r=`/brands${t.size?`?${t}`:""}`;return this.#e(r)}async brandGet(e){let t=`/brands/${e.idOrSlug}`;return this.#e(t)}async brandCreate(e){return this.#e("/brands","POST",e)}async brandUpdate(e,t){let s=`/brands/${e.idOrSlug}`;return this.#e(s,"PATCH",t)}async brandDelete(e){let t=`/brands/${e.idOrSlug}`;return this.#e(t,"DELETE")}async brandAssignProducts(e,t){let s=`/brands/${e.idOrSlug}/products`;return this.#e(s,"POST",t)}async orderRefundsBrowse(e){let t=new URLSearchParams;e.limit&&t.append("limit",e.limit.toString()),e.offset&&t.append("offset",e.offset.toString());let s=t.size?`?${t}`:"",r=`/orders/${e.id}/refunds${s}`;return this.#e(r)}async orderRefundGet(e){let t=`/orders/${e.id}/refunds/${e.refundId}`;return this.#e(t)}async productBatch(e){return this.#e("/products/batch","POST",e)}async cartDelete(e){let t=`/carts/${e.cartId}`;return this.#e(t,"DELETE")}async productBrowse(e){let t=this.#t.getLogger("productBrowse");t.debug("Browsing products with params:",e);let s=new URLSearchParams;e.limit&&s.append("limit",e.limit.toString()),e.offset&&s.append("offset",e.offset.toString()),e.category&&s.append("category",e.category),e.collection&&s.append("collection",e.collection),e.brand&&s.append("brand",e.brand),e.priceMin!==void 0&&s.append("priceMin",e.priceMin.toString()),e.priceMax!==void 0&&s.append("priceMax",e.priceMax.toString()),e.vts&&s.append("vts",e.vts),e.query&&s.append("query",e.query),e.active!==void 0&&s.append("active",e.active.toString()),e.orderBy&&s.append("orderBy",e.orderBy),e.orderDirection&&s.append("orderDirection",e.orderDirection);let o=`/products${s.size?`?${s}`:""}`;t.debug("Constructed pathname:",o);let a=await this.#e(o);return t.debug("Received product browse result:",{meta:a.meta}),a}async productFilters(){return await this.#e("/products/filters")}async productGet(e){let t=`/products/${e.idOrSlug}`,s=await this.#e(t);return s||null}async orderBrowse(e){let t=this.#t.getLogger("orderBrowse");t.debug("Browsing orders with params:",e);let s=new URLSearchParams;e.limit&&s.append("limit",e.limit.toString()),e.offset&&s.append("offset",e.offset.toString());let o=`/orders${s.size?`?${s}`:""}`;t.debug("Constructed pathname:",o);let a=await this.#e(o);return t.debug("Received orders browse result:",{meta:a.meta}),a}async orderGet(e){let t=`/orders/${e.id}`,s=await this.#e(t);return s||null}async cartUpsert(e){return await this.#e("/carts","POST",e)}async cartAddBundle(e){let t={bundleId:e.bundleId,selections:e.selections,...e.cartId?{cartId:e.cartId}:{},...e.currency?{currency:e.currency}:{}};return await this.#e("/carts","POST",t)}async cartRemoveItem(e){let t=`/carts/${e.cartId}/line-items/${e.variantId}`;return this.#e(t,"DELETE")}async cartGet(e){let t=`/carts/${e.cartId}`;return await this.#e(t)}async couponBrowse(e={}){let t=new URLSearchParams;e.limit&&t.append("limit",e.limit.toString()),e.offset&&t.append("offset",e.offset.toString()),e.query&&t.append("query",e.query);let r=`/coupons${t.size?`?${t}`:""}`;return this.#e(r)}async couponGet(e){let t=`/coupons/${e.idOrCode}`;return this.#r(t)}async couponCreate(e){return this.#e("/coupons","POST",e)}async couponUpdate(e,t){let s=`/coupons/${e.idOrCode}`;return this.#e(s,"PATCH",t)}async couponDelete(e){let t=`/coupons/${e.idOrCode}`;return this.#e(t,"DELETE")}async supportCaseBrowse(e={}){let t=new URLSearchParams;e.limit&&t.append("limit",e.limit.toString()),e.offset&&t.append("offset",e.offset.toString()),e.query&&t.append("query",e.query),e.status&&t.append("status",e.status),e.severity&&t.append("severity",e.severity);let r=`/support-cases${t.size?`?${t}`:""}`;return this.#e(r)}async supportCaseGet(e){let t=`/support-cases/${e.idOrNumber}`;return this.#r(t)}async supportCaseCreate(e){return this.#e("/support-cases","POST",e)}async supportCaseUpdate(e,t){let s=`/support-cases/${e.idOrNumber}`;return this.#e(s,"PATCH",t)}async supportCaseReply(e,t){let s=`/support-cases/${e.idOrNumber}/messages`;return this.#e(s,"POST",t)}async collectionGet(e){let t=`/collections/${e.idOrSlug}`;return await this.#e(t)}async collectionBrowse(e){let t=new URLSearchParams;e.limit&&t.append("limit",e.limit.toString()),e.offset&&t.append("offset",e.offset.toString()),e.query&&t.append("query",e.query),e.active!==void 0&&t.append("active",e.active.toString()),e.group&&t.append("group",e.group);let r=`/collections${t.size?`?${t}`:""}`;return await this.#e(r)}async collectionCreate(e){return this.#e("/collections","POST",e)}async collectionUpdate(e,t){let s=`/collections/${e.idOrSlug}`;return this.#e(s,"PATCH",t)}async collectionDelete(e){let t=`/collections/${e.idOrSlug}`;return this.#e(t,"DELETE")}async collectionImportMemberships(e){let t=new FormData;return t.append("file",e.file),this.#n("/collections/import-memberships",t)}async categoryGet(e){let t=`/categories/${e.idOrSlug}`;return await this.#e(t)}async categoriesBrowse(e){let t=new URLSearchParams;e.limit&&t.append("limit",e.limit.toString()),e.offset&&t.append("offset",e.offset.toString()),e.query&&t.append("query",e.query),e.active!==void 0&&t.append("active",e.active.toString());let r=`/categories${t.size?`?${t}`:""}`;return await this.#e(r)}async postBrowse(e={}){let t=new URLSearchParams;e.limit&&t.append("limit",e.limit.toString()),e.offset&&t.append("offset",e.offset.toString()),e.query&&t.append("query",e.query),e.active!==void 0&&t.append("active",e.active.toString()),e.tag&&t.append("tag",e.tag),e.categoryId&&t.append("categoryId",e.categoryId);let r=`/posts${t.size?`?${t}`:""}`;return this.#e(r)}async postGet(e){let t=`/posts/${e.idOrSlug}`;return this.#e(t)}async postCreate(e){return this.#e("/posts","POST",e)}async postUpdate(e,t){let s=`/posts/${e.idOrSlug}`;return this.#e(s,"PATCH",t)}async postDelete(e){let t=`/posts/${e.idOrSlug}`;return this.#e(t,"DELETE")}async postCommentsBrowse(e,t={}){let s=new URLSearchParams;t.limit&&s.append("limit",t.limit.toString()),t.offset&&s.append("offset",t.offset.toString());let r=s.size?`?${s}`:"",o=`/posts/${e.idOrSlug}/comments${r}`;return this.#e(o)}async postCommentCreate(e,t){let s=`/posts/${e.idOrSlug}/comments`;return this.#e(s,"POST",t)}async blogCategoryBrowse(e={}){let t=new URLSearchParams;e.limit&&t.append("limit",e.limit.toString()),e.offset&&t.append("offset",e.offset.toString()),e.query&&t.append("query",e.query),e.active!==void 0&&t.append("active",e.active.toString());let r=`/blog-categories${t.size?`?${t}`:""}`;return this.#e(r)}async blogCategoryGet(e){let t=`/blog-categories/${e.idOrSlug}`;return this.#e(t)}async blogCategoryCreate(e){return this.#e("/blog-categories","POST",e)}async blogCategoryUpdate(e,t){let s=`/blog-categories/${e.idOrSlug}`;return this.#e(s,"PATCH",t)}async blogCategoryDelete(e){let t=`/blog-categories/${e.idOrSlug}`;return this.#e(t,"DELETE")}async customerBrowse(e={}){let t=new URLSearchParams;e.limit&&t.append("limit",e.limit.toString()),e.offset&&t.append("offset",e.offset.toString()),e.search&&t.append("search",e.search);let r=`/customers${t.size?`?${t}`:""}`;return this.#e(r)}async customerGet(e){let t=`/customers/${e.id}`;return this.#e(t)}async customerUpdate(e,t){let s=`/customers/${e.id}`;return this.#e(s,"PATCH",t)}async customerAddressCreate(e,t){let s=`/customers/${e.id}/addresses`;return this.#e(s,"POST",t)}async customerAddressDelete(e){let t=`/customers/${e.customerId}/addresses/${e.addressId}`;await this.#e(t,"DELETE")}async customerOrdersBrowse(e,t={}){let s=new URLSearchParams;t.limit&&s.append("limit",t.limit.toString()),t.offset&&s.append("offset",t.offset.toString());let r=s.size?`?${s}`:"",o=`/customers/${e.id}/orders${r}`;return this.#e(o)}async inventoryBrowse(e={}){let t=new URLSearchParams;e.limit&&t.append("limit",e.limit.toString()),e.cursor&&t.append("cursor",e.cursor),e.lowStock!==void 0&&t.append("lowStock",e.lowStock.toString());let r=`/inventory${t.size?`?${t}`:""}`;return this.#e(r)}async inventoryAdjust(e,t){let s=`/inventory/${encodeURIComponent(e)}/adjust`;return this.#e(s,"POST",t)}async variantGet(e){let t=`/variants/${e.idOrSku}`;return this.#e(t)}async variantUpdate(e,t){let s=`/variants/${e.idOrSku}`;return this.#e(s,"PATCH",t)}async variantDelete(e){let t=`/variants/${e.idOrSku}`;await this.#e(t,"DELETE")}async variantCreate(e,t){let s=`/products/${e}/variants`;return this.#e(s,"POST",t)}async subscriberCreate(e){return this.#e("/subscribers","POST",e)}async subscriberDelete(e){let t=`/subscribers?email=${encodeURIComponent(e)}`;return this.#e(t,"DELETE")}async contactMessageCreate(e){return this.#e("/contact-messages","POST",e)}async productCreate(e){return this.#e("/products","POST",e)}async productUpdate(e,t){let s=`/products/${e.idOrSlug}`;return this.#e(s,"PATCH",t)}async productDelete(e){let t=`/products/${e.idOrSlug}`;return this.#e(t,"DELETE")}async productReviewsBrowse(e,t={}){let s=new URLSearchParams;t.limit&&s.append("limit",t.limit.toString()),t.offset&&s.append("offset",t.offset.toString());let r=s.size?`?${s}`:"",o=`/products/${e.idOrSlug}/reviews${r}`;return this.#e(o)}async productReviewCreate(e,t){let s=`/products/${e.idOrSlug}/reviews`;return this.#e(s,"POST",t)}async eventBrowse(e={}){let t=this.#t.getLogger("eventBrowse"),s=new URLSearchParams;e.offset!==void 0&&s.append("offset",e.offset.toString()),e.limit!==void 0&&s.append("limit",e.limit.toString());let o=`/events${s.size?`?${s}`:""}`;return t.debug("Browsing events:",o),this.#e(o)}async eventGet(e){let t=`/events/${e.idOrSlug}`;return this.#e(t)}async eventCreate(e){return this.#e("/events","POST",e)}async eventUpdate(e,t){let s=`/events/${e.idOrSlug}`;return this.#e(s,"PATCH",t)}async eventAttendeesBrowse(e){let t=`/events/${e.idOrSlug}/attendees`;return this.#e(t)}async ticketsGet(e){let t=this.#t.getLogger("ticketsGet"),s=new URLSearchParams({email:e.email}),r=`/tickets/${encodeURIComponent(e.code)}?${s}`;return t.debug("Fetching ticket bundle:",r),this.#r(r)}async ticketsUpdate(e,t){let s=`/tickets/${encodeURIComponent(e.code)}`;return this.#e(s,"PATCH",t)}async ticketAttendeeGet(e){let t=`/tickets/attendee/${encodeURIComponent(e.token)}`;return this.#r(t)}async categoryCreate(e){return this.#e("/categories","POST",e)}async categoryUpdate(e,t){let s=`/categories/${e.idOrSlug}`;return this.#e(s,"PATCH",t)}async categoryDelete(e){let t=`/categories/${e.idOrSlug}`;return this.#e(t,"DELETE")}async orderUpdate(e,t){let s=`/orders/${e.id}`;return this.#e(s,"PATCH",t)}async legalPageBrowse(e={}){return this.request("/legal-pages",{query:e})}async legalPageGet(e,t={}){let s=e.startsWith("/")?e.slice(1):e,r=`/legal-pages/${encodeURIComponent(s)}`;return this.request(r,{query:t})}async legalPageCreate(e,t={}){return this.request("/legal-pages",{method:"POST",body:e,query:t})}async legalPageUpdate(e,t,s={}){let r=e.startsWith("/")?e.slice(1):e,o=`/legal-pages/${encodeURIComponent(r)}`;return this.request(o,{method:"PATCH",body:t,query:s})}async search(e){return this.request("/search",{query:e})}async instaviewImagesBrowse(e,t={}){let s=new URLSearchParams;t.limit&&s.append("limit",t.limit.toString()),t.cursor&&s.append("cursor",t.cursor);let r=s.size?`?${s}`:"",o=`/instaview/accounts/${e.handle}/images${r}`;return this.#e(o)}async request(e,t){let s=t?.query?Object.entries(t.query).filter(o=>{let[,a]=o;return a!=null}):[],r=s.length>0?`?${new URLSearchParams(s.map(([o,a])=>[o,String(a)]))}`:"";return this.#e(`${e}${r}`,t?.method??"GET",t?.body)}};function T(c={}){return new l(c)}export{T as Commerce,l as YNSProvider};
|
|
1
|
+
import"./chunk-PNKB6P4V.js";var y=process.env.YNS_API_KEY,m={YNS_API_KEY:y};var P={DEBUG:0,LOG:1,WARN:2,ERROR:3},g=process.env.NEXT_PUBLIC_LOG_LEVEL||"LOG",u=P[g],d="\x1B[0m",C="\x1B[34m",B="\x1B[32m",R="\x1B[33m",h="\x1B[31m",f="\u23F1\uFE0F",w="\u{1F41B}",S="\u2714\uFE0F",G="\u26A0\uFE0F",$="\u274C",p=`${f} `,v=`${C}${w}${d} `,E=`${B}${S}${d} `,U=`${R}${G}${d} `,O=`${h}${$}${d} `,I=c=>{let e=c?`[${c}] `:"";return{getLogger(t){return I([c,t].filter(Boolean).join(" > "))},time(t){u>P.DEBUG||console.time([p,e,t].filter(Boolean).join(" "))},timeEnd(t){u>P.DEBUG||console.timeEnd([p,e,t].filter(Boolean).join(" "))},debug(...t){u>P.DEBUG||console.log(...[v,e,...t].filter(Boolean))},log(...t){u>P.LOG||console.log(...[E,e,...t].filter(Boolean))},dir(t,s){u>P.LOG||console.dir(t,s)},warn(...t){u>P.WARN||console.warn(...[U,e,...t].filter(Boolean))},error(...t){u>P.ERROR||console.error(...[O,e,...t].filter(Boolean))}}},L=I();var l=class{#s;#t=I("YNSProvider");constructor(e={}){let t=e.token??m.YNS_API_KEY,s=m.YNS_API_KEY?.startsWith("sk-s-");if(!t)throw new Error("YNS API key is required. Set YNS_API_KEY environment variable or pass token in config.");let r=e.endpoint??(s?"https://yns.cx":"https://yns.store");this.#s={version:"v1",...e,token:t,endpoint:r},this.#t.debug("YNSProvider initialized",{endpoint:r,token:e.token?"from config":"from env"})}async#e(e,t="GET",s){let r=await this.#o(e,t,s);return this.#a(r,e,t)}async#r(e){let t=await this.#o(e,"GET");return t.status===404?null:this.#a(t,e,"GET")}async#o(e,t,s){let r=this.#t.getLogger("#restRequest"),o=`${this.#s.endpoint}/api/${this.#s.version}${e}`;return r.debug(`Making ${t} request to YNS API: ${o}`),fetch(o,{method:t,headers:{"Content-Type":"application/json",Authorization:`Bearer ${this.#s.token}`},body:s?JSON.stringify(s):void 0})}async#a(e,t,s){let r=this.#t.getLogger("#restRequest"),o=`${this.#s.endpoint}/api/${this.#s.version}${t}`;if(!e.ok){let A=e.headers.get("content-type"),i=`YNS REST request failed: ${s} ${o} ${e.status} ${e.statusText}`;if(A?.includes("application/json"))try{let n=await e.json();i=n.error||n.message||i}catch(n){r.error("Failed to parse YNS error response as JSON",n)}else{let n=await e.text();r.error(`YNS API request failed: ${e.status} ${e.statusText}`,i,n)}throw new Error(i)}let a=e.headers.get("content-type");if(!a?.includes("application/json"))throw new Error(`YNS API returned ${a} instead of JSON for ${t}`);return e.json()}async#n(e,t){let s=this.#t.getLogger("#multipartRequest"),r=`${this.#s.endpoint}/api/${this.#s.version}${e}`;s.debug(`Making multipart POST to YNS API: ${r}`);let o=await fetch(r,{method:"POST",headers:{Authorization:`Bearer ${this.#s.token}`},body:t});if(!o.ok){let A=o.headers.get("content-type"),i=`YNS REST request failed: POST ${r} ${o.status} ${o.statusText}`;if(A?.includes("application/json"))try{let n=await o.json();i=n.error||n.message||i}catch(n){s.error("Failed to parse YNS error response as JSON",n)}else{let n=await o.text();s.error(`YNS API request failed: ${o.status} ${o.statusText}`,i,n)}throw new Error(i)}let a=o.headers.get("content-type");if(!a?.includes("application/json"))throw new Error(`YNS API returned ${a} instead of JSON for ${e}`);return o.json()}async meGet(){let e=this.#t.getLogger("meGet");e.debug("Fetching my information");let s=await this.#e("/me");return e.debug("Received my information:",s),s}async socialsGet(){let e=this.#t.getLogger("socialsGet");e.debug("Fetching store social links");let s=await this.#e("/socials");return e.debug("Received store social links:",s),s}async brandBrowse(e={}){let t=new URLSearchParams;e.limit&&t.append("limit",e.limit.toString()),e.offset&&t.append("offset",e.offset.toString()),e.query&&t.append("query",e.query),e.active!==void 0&&t.append("active",e.active.toString()),e.lang&&t.append("lang",e.lang);let r=`/brands${t.size?`?${t}`:""}`;return this.#e(r)}async brandGet(e){let t=`/brands/${e.idOrSlug}`;return this.#e(t)}async brandCreate(e){return this.#e("/brands","POST",e)}async brandUpdate(e,t){let s=`/brands/${e.idOrSlug}`;return this.#e(s,"PATCH",t)}async brandDelete(e){let t=`/brands/${e.idOrSlug}`;return this.#e(t,"DELETE")}async brandAssignProducts(e,t){let s=`/brands/${e.idOrSlug}/products`;return this.#e(s,"POST",t)}async orderRefundsBrowse(e){let t=new URLSearchParams;e.limit&&t.append("limit",e.limit.toString()),e.offset&&t.append("offset",e.offset.toString());let s=t.size?`?${t}`:"",r=`/orders/${e.id}/refunds${s}`;return this.#e(r)}async orderRefundGet(e){let t=`/orders/${e.id}/refunds/${e.refundId}`;return this.#e(t)}async productBatch(e){return this.#e("/products/batch","POST",e)}async cartDelete(e){let t=`/carts/${e.cartId}`;return this.#e(t,"DELETE")}async productBrowse(e){let t=this.#t.getLogger("productBrowse");t.debug("Browsing products with params:",e);let s=new URLSearchParams;e.limit&&s.append("limit",e.limit.toString()),e.offset&&s.append("offset",e.offset.toString()),e.category&&s.append("category",e.category),e.collection&&s.append("collection",e.collection),e.brand&&s.append("brand",e.brand),e.priceMin!==void 0&&s.append("priceMin",e.priceMin.toString()),e.priceMax!==void 0&&s.append("priceMax",e.priceMax.toString()),e.vts&&s.append("vts",e.vts),e.query&&s.append("query",e.query),e.active!==void 0&&s.append("active",e.active.toString()),e.orderBy&&s.append("orderBy",e.orderBy),e.orderDirection&&s.append("orderDirection",e.orderDirection);let o=`/products${s.size?`?${s}`:""}`;t.debug("Constructed pathname:",o);let a=await this.#e(o);return t.debug("Received product browse result:",{meta:a.meta}),a}async productFilters(){return await this.#e("/products/filters")}async productGet(e){let t=`/products/${e.idOrSlug}`,s=await this.#e(t);return s||null}async orderBrowse(e){let t=this.#t.getLogger("orderBrowse");t.debug("Browsing orders with params:",e);let s=new URLSearchParams;e.limit&&s.append("limit",e.limit.toString()),e.offset&&s.append("offset",e.offset.toString());let o=`/orders${s.size?`?${s}`:""}`;t.debug("Constructed pathname:",o);let a=await this.#e(o);return t.debug("Received orders browse result:",{meta:a.meta}),a}async orderGet(e){let t=`/orders/${e.id}`,s=await this.#e(t);return s||null}async cartUpsert(e){return await this.#e("/carts","POST",e)}async cartAddBundle(e){let t={bundleId:e.bundleId,selections:e.selections,...e.cartId?{cartId:e.cartId}:{},...e.currency?{currency:e.currency}:{}};return await this.#e("/carts","POST",t)}async cartRemoveItem(e){let t=`/carts/${e.cartId}/line-items/${e.variantId}`;return this.#e(t,"DELETE")}async cartGet(e){let t=`/carts/${e.cartId}`;return await this.#e(t)}async cartCouponApply(e){let t=`/carts/${e.cartId}/coupon`;return this.#e(t,"POST",{code:e.code})}async cartCouponRemove(e){let t=`/carts/${e.cartId}/coupon`;return this.#e(t,"DELETE")}async couponBrowse(e={}){let t=new URLSearchParams;e.limit&&t.append("limit",e.limit.toString()),e.offset&&t.append("offset",e.offset.toString()),e.query&&t.append("query",e.query);let r=`/coupons${t.size?`?${t}`:""}`;return this.#e(r)}async couponGet(e){let t=`/coupons/${e.idOrCode}`;return this.#r(t)}async couponCreate(e){return this.#e("/coupons","POST",e)}async couponUpdate(e,t){let s=`/coupons/${e.idOrCode}`;return this.#e(s,"PATCH",t)}async couponDelete(e){let t=`/coupons/${e.idOrCode}`;return this.#e(t,"DELETE")}async supportCaseBrowse(e={}){let t=new URLSearchParams;e.limit&&t.append("limit",e.limit.toString()),e.offset&&t.append("offset",e.offset.toString()),e.query&&t.append("query",e.query),e.status&&t.append("status",e.status),e.severity&&t.append("severity",e.severity);let r=`/support-cases${t.size?`?${t}`:""}`;return this.#e(r)}async supportCaseGet(e){let t=`/support-cases/${e.idOrNumber}`;return this.#r(t)}async supportCaseCreate(e){return this.#e("/support-cases","POST",e)}async supportCaseUpdate(e,t){let s=`/support-cases/${e.idOrNumber}`;return this.#e(s,"PATCH",t)}async supportCaseReply(e,t){let s=`/support-cases/${e.idOrNumber}/messages`;return this.#e(s,"POST",t)}async collectionGet(e){let t=`/collections/${e.idOrSlug}`;return await this.#e(t)}async collectionBrowse(e){let t=new URLSearchParams;e.limit&&t.append("limit",e.limit.toString()),e.offset&&t.append("offset",e.offset.toString()),e.query&&t.append("query",e.query),e.active!==void 0&&t.append("active",e.active.toString()),e.group&&t.append("group",e.group);let r=`/collections${t.size?`?${t}`:""}`;return await this.#e(r)}async collectionCreate(e){return this.#e("/collections","POST",e)}async collectionUpdate(e,t){let s=`/collections/${e.idOrSlug}`;return this.#e(s,"PATCH",t)}async collectionDelete(e){let t=`/collections/${e.idOrSlug}`;return this.#e(t,"DELETE")}async collectionImportMemberships(e){let t=new FormData;return t.append("file",e.file),this.#n("/collections/import-memberships",t)}async categoryGet(e){let t=`/categories/${e.idOrSlug}`;return await this.#e(t)}async categoriesBrowse(e){let t=new URLSearchParams;e.limit&&t.append("limit",e.limit.toString()),e.offset&&t.append("offset",e.offset.toString()),e.query&&t.append("query",e.query),e.active!==void 0&&t.append("active",e.active.toString());let r=`/categories${t.size?`?${t}`:""}`;return await this.#e(r)}async postBrowse(e={}){let t=new URLSearchParams;e.limit&&t.append("limit",e.limit.toString()),e.offset&&t.append("offset",e.offset.toString()),e.query&&t.append("query",e.query),e.active!==void 0&&t.append("active",e.active.toString()),e.tag&&t.append("tag",e.tag),e.categoryId&&t.append("categoryId",e.categoryId);let r=`/posts${t.size?`?${t}`:""}`;return this.#e(r)}async postGet(e){let t=`/posts/${e.idOrSlug}`;return this.#e(t)}async postCreate(e){return this.#e("/posts","POST",e)}async postUpdate(e,t){let s=`/posts/${e.idOrSlug}`;return this.#e(s,"PATCH",t)}async postDelete(e){let t=`/posts/${e.idOrSlug}`;return this.#e(t,"DELETE")}async postCommentsBrowse(e,t={}){let s=new URLSearchParams;t.limit&&s.append("limit",t.limit.toString()),t.offset&&s.append("offset",t.offset.toString());let r=s.size?`?${s}`:"",o=`/posts/${e.idOrSlug}/comments${r}`;return this.#e(o)}async postCommentCreate(e,t){let s=`/posts/${e.idOrSlug}/comments`;return this.#e(s,"POST",t)}async blogCategoryBrowse(e={}){let t=new URLSearchParams;e.limit&&t.append("limit",e.limit.toString()),e.offset&&t.append("offset",e.offset.toString()),e.query&&t.append("query",e.query),e.active!==void 0&&t.append("active",e.active.toString());let r=`/blog-categories${t.size?`?${t}`:""}`;return this.#e(r)}async blogCategoryGet(e){let t=`/blog-categories/${e.idOrSlug}`;return this.#e(t)}async blogCategoryCreate(e){return this.#e("/blog-categories","POST",e)}async blogCategoryUpdate(e,t){let s=`/blog-categories/${e.idOrSlug}`;return this.#e(s,"PATCH",t)}async blogCategoryDelete(e){let t=`/blog-categories/${e.idOrSlug}`;return this.#e(t,"DELETE")}async customerBrowse(e={}){let t=new URLSearchParams;e.limit&&t.append("limit",e.limit.toString()),e.offset&&t.append("offset",e.offset.toString()),e.search&&t.append("search",e.search);let r=`/customers${t.size?`?${t}`:""}`;return this.#e(r)}async customerGet(e){let t=`/customers/${e.id}`;return this.#e(t)}async customerUpdate(e,t){let s=`/customers/${e.id}`;return this.#e(s,"PATCH",t)}async customerAddressCreate(e,t){let s=`/customers/${e.id}/addresses`;return this.#e(s,"POST",t)}async customerAddressDelete(e){let t=`/customers/${e.customerId}/addresses/${e.addressId}`;await this.#e(t,"DELETE")}async customerOrdersBrowse(e,t={}){let s=new URLSearchParams;t.limit&&s.append("limit",t.limit.toString()),t.offset&&s.append("offset",t.offset.toString());let r=s.size?`?${s}`:"",o=`/customers/${e.id}/orders${r}`;return this.#e(o)}async inventoryBrowse(e={}){let t=new URLSearchParams;e.limit&&t.append("limit",e.limit.toString()),e.cursor&&t.append("cursor",e.cursor),e.lowStock!==void 0&&t.append("lowStock",e.lowStock.toString());let r=`/inventory${t.size?`?${t}`:""}`;return this.#e(r)}async inventoryAdjust(e,t){let s=`/inventory/${encodeURIComponent(e)}/adjust`;return this.#e(s,"POST",t)}async variantGet(e){let t=`/variants/${e.idOrSku}`;return this.#e(t)}async variantUpdate(e,t){let s=`/variants/${e.idOrSku}`;return this.#e(s,"PATCH",t)}async variantDelete(e){let t=`/variants/${e.idOrSku}`;await this.#e(t,"DELETE")}async variantCreate(e,t){let s=`/products/${e}/variants`;return this.#e(s,"POST",t)}async subscriberCreate(e){return this.#e("/subscribers","POST",e)}async subscriberDelete(e){let t=`/subscribers?email=${encodeURIComponent(e)}`;return this.#e(t,"DELETE")}async contactMessageCreate(e){return this.#e("/contact-messages","POST",e)}async productCreate(e){return this.#e("/products","POST",e)}async productUpdate(e,t){let s=`/products/${e.idOrSlug}`;return this.#e(s,"PATCH",t)}async productDelete(e){let t=`/products/${e.idOrSlug}`;return this.#e(t,"DELETE")}async productReviewsBrowse(e,t={}){let s=new URLSearchParams;t.limit&&s.append("limit",t.limit.toString()),t.offset&&s.append("offset",t.offset.toString());let r=s.size?`?${s}`:"",o=`/products/${e.idOrSlug}/reviews${r}`;return this.#e(o)}async productReviewCreate(e,t){let s=`/products/${e.idOrSlug}/reviews`;return this.#e(s,"POST",t)}async eventBrowse(e={}){let t=this.#t.getLogger("eventBrowse"),s=new URLSearchParams;e.offset!==void 0&&s.append("offset",e.offset.toString()),e.limit!==void 0&&s.append("limit",e.limit.toString());let o=`/events${s.size?`?${s}`:""}`;return t.debug("Browsing events:",o),this.#e(o)}async eventGet(e){let t=`/events/${e.idOrSlug}`;return this.#e(t)}async eventCreate(e){return this.#e("/events","POST",e)}async eventUpdate(e,t){let s=`/events/${e.idOrSlug}`;return this.#e(s,"PATCH",t)}async eventAttendeesBrowse(e){let t=`/events/${e.idOrSlug}/attendees`;return this.#e(t)}async ticketsGet(e){let t=this.#t.getLogger("ticketsGet"),s=new URLSearchParams({email:e.email}),r=`/tickets/${encodeURIComponent(e.code)}?${s}`;return t.debug("Fetching ticket bundle:",r),this.#r(r)}async ticketsUpdate(e,t){let s=`/tickets/${encodeURIComponent(e.code)}`;return this.#e(s,"PATCH",t)}async ticketAttendeeGet(e){let t=`/tickets/attendee/${encodeURIComponent(e.token)}`;return this.#r(t)}async categoryCreate(e){return this.#e("/categories","POST",e)}async categoryUpdate(e,t){let s=`/categories/${e.idOrSlug}`;return this.#e(s,"PATCH",t)}async categoryDelete(e){let t=`/categories/${e.idOrSlug}`;return this.#e(t,"DELETE")}async orderUpdate(e,t){let s=`/orders/${e.id}`;return this.#e(s,"PATCH",t)}async legalPageBrowse(e={}){return this.request("/legal-pages",{query:e})}async legalPageGet(e,t={}){let s=e.startsWith("/")?e.slice(1):e,r=`/legal-pages/${encodeURIComponent(s)}`;return this.request(r,{query:t})}async legalPageCreate(e,t={}){return this.request("/legal-pages",{method:"POST",body:e,query:t})}async legalPageUpdate(e,t,s={}){let r=e.startsWith("/")?e.slice(1):e,o=`/legal-pages/${encodeURIComponent(r)}`;return this.request(o,{method:"PATCH",body:t,query:s})}async search(e){return this.request("/search",{query:e})}async instaviewImagesBrowse(e,t={}){let s=new URLSearchParams;t.limit&&s.append("limit",t.limit.toString()),t.cursor&&s.append("cursor",t.cursor);let r=s.size?`?${s}`:"",o=`/instaview/accounts/${e.handle}/images${r}`;return this.#e(o)}async request(e,t){let s=t?.query?Object.entries(t.query).filter(o=>{let[,a]=o;return a!=null}):[],r=s.length>0?`?${new URLSearchParams(s.map(([o,a])=>[o,String(a)]))}`:"";return this.#e(`${e}${r}`,t?.method??"GET",t?.body)}};function T(c={}){return new l(c)}export{T as Commerce,l as YNSProvider};
|
|
2
2
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/env.ts","../src/logger.ts","../src/providers/yns.ts","../src/commerce.ts"],"sourcesContent":["const YNS_API_KEY = process.env.YNS_API_KEY;\n\nexport const env = {\n\tYNS_API_KEY,\n};\n","import type { InspectOptions } from \"node:util\";\n\ntype LogParms = [message: unknown, ...optionalParams: unknown[]];\n\n/**\n * Vercel only supports 3 levels of logging. We're adding additional DEBUG level.\n * https://vercel.com/docs/observability/runtime-logs#level\n *\n * ERROR - Fatal for a particular request. Should be fixed sooner than later.\n *\n * WARN - A note on something that should probably be looked at eventually.\n *\n * LOG - Detail on regular operation.\n *\n * DEBUG - Debug only info as well as time and timeEnd functions.\n */\nconst LogLevel = {\n\tDEBUG: 0,\n\tLOG: 1,\n\tWARN: 2,\n\tERROR: 3,\n} as const;\ntype LogLevel = keyof typeof LogLevel;\n\nconst strLogLevel = (process.env.NEXT_PUBLIC_LOG_LEVEL || \"LOG\") as LogLevel;\nconst valueLogLevel = LogLevel[strLogLevel];\n\nconst RESET = \"\\x1b[0m\";\nconst BLUE = \"\\x1b[34m\";\nconst GREEN = \"\\x1b[32m\";\nconst YELLOW = \"\\x1b[33m\";\nconst RED = \"\\x1b[31m\";\n\nconst TIME = `⏱️`;\nconst DEBUG = `🐛`;\nconst OK = `✔️`;\nconst WARN = `⚠️`;\nconst ERROR = `❌`;\n\nconst PREFIX_TIME = `${TIME} `;\nconst PREFIX_DEBUG = `${BLUE}${DEBUG}${RESET} `;\nconst PREFIX_OK = `${GREEN}${OK}${RESET} `;\nconst PREFIX_WARN = `${YELLOW}${WARN}${RESET} `;\nconst PREFIX_ERROR = `${RED}${ERROR}${RESET} `;\n\nexport const getLogger = (groupLabel?: string) => {\n\tconst PREFIX = groupLabel ? `[${groupLabel}] ` : \"\";\n\treturn {\n\t\tgetLogger(subGroupLabel: string) {\n\t\t\treturn getLogger([groupLabel, subGroupLabel].filter(Boolean).join(\" > \"));\n\t\t},\n\t\ttime(label: string) {\n\t\t\tif (valueLogLevel > LogLevel.DEBUG) return;\n\t\t\tconsole.time([PREFIX_TIME, PREFIX, label].filter(Boolean).join(\" \"));\n\t\t},\n\t\ttimeEnd(label: string) {\n\t\t\tif (valueLogLevel > LogLevel.DEBUG) return;\n\t\t\tconsole.timeEnd([PREFIX_TIME, PREFIX, label].filter(Boolean).join(\" \"));\n\t\t},\n\t\tdebug(...args: LogParms) {\n\t\t\tif (valueLogLevel > LogLevel.DEBUG) return;\n\t\t\tconsole.log(...[PREFIX_DEBUG, PREFIX, ...args].filter(Boolean));\n\t\t},\n\t\tlog(...args: LogParms) {\n\t\t\tif (valueLogLevel > LogLevel.LOG) return;\n\t\t\tconsole.log(...[PREFIX_OK, PREFIX, ...args].filter(Boolean));\n\t\t},\n\t\tdir(item?: unknown, options?: InspectOptions) {\n\t\t\tif (valueLogLevel > LogLevel.LOG) return;\n\t\t\tconsole.dir(item, options);\n\t\t},\n\t\twarn(...args: LogParms) {\n\t\t\tif (valueLogLevel > LogLevel.WARN) return;\n\t\t\tconsole.warn(...[PREFIX_WARN, PREFIX, ...args].filter(Boolean));\n\t\t},\n\t\terror(...args: LogParms) {\n\t\t\tif (valueLogLevel > LogLevel.ERROR) return;\n\t\t\tconsole.error(...[PREFIX_ERROR, PREFIX, ...args].filter(Boolean));\n\t\t},\n\t};\n};\n\nexport const logger = getLogger();\n","import type {\n\tAPIBlogCategoriesBrowseQueryParams,\n\tAPIBlogCategoriesBrowseResult,\n\tAPIBlogCategoryCreateBody,\n\tAPIBlogCategoryCreateResult,\n\tAPIBlogCategoryDeleteResult,\n\tAPIBlogCategoryGetByIdParams,\n\tAPIBlogCategoryGetByIdResult,\n\tAPIBlogCategoryUpdateBody,\n\tAPIBlogCategoryUpdateResult,\n\tAPIBrandAssignProductsBody,\n\tAPIBrandAssignProductsResult,\n\tAPIBrandCreateBody,\n\tAPIBrandCreateResult,\n\tAPIBrandDeleteResult,\n\tAPIBrandGetByIdParams,\n\tAPIBrandGetByIdResult,\n\tAPIBrandsBrowseQueryParams,\n\tAPIBrandsBrowseResult,\n\tAPIBrandUpdateBody,\n\tAPIBrandUpdateResult,\n\tAPICartCreateBody,\n\tAPICartCreateResult,\n\tAPICartDeleteResult,\n\tAPICartGetResult,\n\tAPICategoriesBrowseQueryParams,\n\tAPICategoriesBrowseResult,\n\tAPICategoryCreateBody,\n\tAPICategoryCreateResult,\n\tAPICategoryDeleteResult,\n\tAPICategoryGetByIdParams,\n\tAPICategoryGetByIdResult,\n\tAPICategoryUpdateBody,\n\tAPICategoryUpdateResult,\n\tAPICollectionCreateBody,\n\tAPICollectionCreateResult,\n\tAPICollectionDeleteResult,\n\tAPICollectionGetByIdParams,\n\tAPICollectionGetByIdResult,\n\tAPICollectionsBrowseQueryParams,\n\tAPICollectionsBrowseResult,\n\tAPICollectionUpdateBody,\n\tAPICollectionUpdateResult,\n\tAPIContactMessageCreateBody,\n\tAPIContactMessageCreateResult,\n\tAPICouponCreateBody,\n\tAPICouponCreateResult,\n\tAPICouponDeleteResult,\n\tAPICouponGetByIdParams,\n\tAPICouponGetByIdResult,\n\tAPICouponsBrowseQueryParams,\n\tAPICouponsBrowseResult,\n\tAPICouponUpdateBody,\n\tAPICouponUpdateResult,\n\tAPICustomerAddressCreateBody,\n\tAPICustomerAddressCreateResult,\n\tAPICustomerGetByIdParams,\n\tAPICustomerGetByIdResult,\n\tAPICustomerOrdersBrowseQueryParams,\n\tAPICustomerOrdersBrowseResult,\n\tAPICustomersBrowseQueryParams,\n\tAPICustomersBrowseResult,\n\tAPICustomerUpdateBody,\n\tAPICustomerUpdateResult,\n\tAPIEventAttendeesBrowseResult,\n\tAPIEventCreateBody,\n\tAPIEventCreateResult,\n\tAPIEventGetByIdParams,\n\tAPIEventGetByIdResult,\n\tAPIEventsBrowseQueryParams,\n\tAPIEventsBrowseResult,\n\tAPIEventUpdateBody,\n\tAPIEventUpdateResult,\n\tAPIInstaviewImagesBrowseParams,\n\tAPIInstaviewImagesBrowseQueryParams,\n\tAPIInstaviewImagesBrowseResult,\n\tAPIInventoryAdjustBody,\n\tAPIInventoryAdjustResult,\n\tAPIInventoryBrowseQueryParams,\n\tAPIInventoryBrowseResult,\n\tAPILegalPageCreateBody,\n\tAPILegalPageCreateQueryParams,\n\tAPILegalPageCreateResult,\n\tAPILegalPageGetByPathQueryParams,\n\tAPILegalPageGetByPathResult,\n\tAPILegalPagesBrowseQueryParams,\n\tAPILegalPagesBrowseResult,\n\tAPILegalPageUpdateBody,\n\tAPILegalPageUpdateQueryParams,\n\tAPILegalPageUpdateResult,\n\tAPIMeGetResult,\n\tAPIOrderGetByIdParams,\n\tAPIOrderGetByIdResult,\n\tAPIOrderRefundGetParams,\n\tAPIOrderRefundGetResult,\n\tAPIOrderRefundsBrowseQueryParams,\n\tAPIOrderRefundsBrowseResult,\n\tAPIOrderRefundsParams,\n\tAPIOrdersBrowseQueryParams,\n\tAPIOrdersBrowseResult,\n\tAPIOrderUpdateBody,\n\tAPIOrderUpdateResult,\n\tAPIPostCommentCreateBody,\n\tAPIPostCommentCreateResult,\n\tAPIPostCommentsBrowseQueryParams,\n\tAPIPostCommentsBrowseResult,\n\tAPIPostCreateBody,\n\tAPIPostCreateResult,\n\tAPIPostDeleteResult,\n\tAPIPostGetByIdParams,\n\tAPIPostGetByIdResult,\n\tAPIPostsBrowseQueryParams,\n\tAPIPostsBrowseResult,\n\tAPIPostUpdateBody,\n\tAPIPostUpdateResult,\n\tAPIProductBatchBody,\n\tAPIProductBatchResult,\n\tAPIProductCreateBody,\n\tAPIProductCreateResult,\n\tAPIProductDeleteResult,\n\tAPIProductFiltersResult,\n\tAPIProductGetByIdParams,\n\tAPIProductGetByIdResult,\n\tAPIProductReviewCreateBody,\n\tAPIProductReviewCreateResult,\n\tAPIProductReviewsBrowseQueryParams,\n\tAPIProductReviewsBrowseResult,\n\tAPIProductsBrowseQueryParams,\n\tAPIProductsBrowseResult,\n\tAPIProductUpdateBody,\n\tAPIProductUpdateResult,\n\tAPISearchQueryParams,\n\tAPISearchResult,\n\tAPISocialsGetResult,\n\tAPISubscriberCreateBody,\n\tAPISubscriberCreateResult,\n\tAPISubscriberDeleteResult,\n\tAPISupportCaseCreateBody,\n\tAPISupportCaseCreateResult,\n\tAPISupportCaseGetParams,\n\tAPISupportCaseGetResult,\n\tAPISupportCaseMessageCreateBody,\n\tAPISupportCaseMessageCreateResult,\n\tAPISupportCasesBrowseQueryParams,\n\tAPISupportCasesBrowseResult,\n\tAPISupportCaseUpdateBody,\n\tAPISupportCaseUpdateResult,\n\tAPITicketAttendeeGetResult,\n\tAPITicketsGetResult,\n\tAPITicketsUpdateBody,\n\tAPITicketsUpdateResult,\n\tAPIVariantCreateBody,\n\tAPIVariantCreateResult,\n\tAPIVariantGetByIdParams,\n\tAPIVariantGetByIdResult,\n\tAPIVariantUpdateBody,\n\tAPIVariantUpdateResult,\n} from \"../api-types\";\nimport { env } from \"../env\";\nimport { getLogger } from \"../logger\";\nimport type { CommerceConfig } from \"../types\";\n\nexport type APICollectionImportMembershipsBody = { file: File | Blob };\n\nexport type APICollectionImportMembershipsResult = {\n\tok: true;\n\tprocessed: number;\n\tinserted: number;\n\tskipped_existing: number;\n\terrors: Array<{\n\t\trow: number;\n\t\tcollection_slug?: string;\n\t\tproduct_slug?: string;\n\t\treason: string;\n\t}>;\n};\n\nexport class YNSProvider {\n\t#config: CommerceConfig;\n\t#logger = getLogger(\"YNSProvider\");\n\n\tconstructor(config: CommerceConfig = {}) {\n\t\tconst token = config.token ?? env.YNS_API_KEY;\n\t\tconst isStaging = env.YNS_API_KEY?.startsWith(\"sk-s-\");\n\n\t\tif (!token) {\n\t\t\tthrow new Error(\n\t\t\t\t\"YNS API key is required. Set YNS_API_KEY environment variable or pass token in config.\",\n\t\t\t);\n\t\t}\n\t\tconst endpoint = config.endpoint ?? (isStaging ? \"https://yns.cx\" : \"https://yns.store\");\n\n\t\tthis.#config = { version: \"v1\", ...config, token, endpoint };\n\n\t\tthis.#logger.debug(\"YNSProvider initialized\", {\n\t\t\tendpoint,\n\t\t\ttoken: config.token ? `from config` : \"from env\",\n\t\t});\n\t}\n\n\tasync #restRequest<T>(\n\t\tpathname: `/${string}`,\n\t\tmethod: \"GET\" | \"POST\" | \"PATCH\" | \"DELETE\" = \"GET\",\n\t\tbody?: unknown,\n\t): Promise<T> {\n\t\tconst response = await this.#fetchJson(pathname, method, body);\n\t\treturn this.#parseResponse<T>(response, pathname, method);\n\t}\n\n\t/**\n\t * Like {@link #restRequest} but resolves to `null` on a 404 response. For lookups where\n\t * \"not found\" is an expected outcome (e.g. ticket access codes answered with a uniform 404).\n\t */\n\tasync #restRequestNullable<T>(pathname: `/${string}`): Promise<T | null> {\n\t\tconst response = await this.#fetchJson(pathname, \"GET\");\n\t\tif (response.status === 404) {\n\t\t\treturn null;\n\t\t}\n\t\treturn this.#parseResponse<T>(response, pathname, \"GET\");\n\t}\n\n\tasync #fetchJson(\n\t\tpathname: `/${string}`,\n\t\tmethod: \"GET\" | \"POST\" | \"PATCH\" | \"DELETE\",\n\t\tbody?: unknown,\n\t): Promise<Response> {\n\t\tconst logger = this.#logger.getLogger(\"#restRequest\");\n\n\t\tconst endpoint = `${this.#config.endpoint}/api/${this.#config.version}${pathname}`;\n\t\tlogger.debug(`Making ${method} request to YNS API: ${endpoint}`);\n\t\treturn fetch(endpoint, {\n\t\t\tmethod,\n\t\t\theaders: {\n\t\t\t\t\"Content-Type\": \"application/json\",\n\t\t\t\tAuthorization: `Bearer ${this.#config.token}`,\n\t\t\t},\n\t\t\tbody: body ? JSON.stringify(body) : undefined,\n\t\t});\n\t}\n\n\tasync #parseResponse<T>(response: Response, pathname: `/${string}`, method: string): Promise<T> {\n\t\tconst logger = this.#logger.getLogger(\"#restRequest\");\n\t\tconst endpoint = `${this.#config.endpoint}/api/${this.#config.version}${pathname}`;\n\n\t\tif (!response.ok) {\n\t\t\t// Handle different error types\n\t\t\tconst contentType = response.headers.get(\"content-type\");\n\t\t\tlet errorMessage = `YNS REST request failed: ${method} ${endpoint} ${response.status} ${response.statusText}`;\n\n\t\t\tif (contentType?.includes(\"application/json\")) {\n\t\t\t\ttry {\n\t\t\t\t\tconst errorData = await response.json();\n\t\t\t\t\terrorMessage = errorData.error || errorData.message || errorMessage;\n\t\t\t\t} catch (error) {\n\t\t\t\t\tlogger.error(\"Failed to parse YNS error response as JSON\", error);\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tconst errorText = await response.text();\n\t\t\t\tlogger.error(\n\t\t\t\t\t`YNS API request failed: ${response.status} ${response.statusText}`,\n\t\t\t\t\terrorMessage,\n\t\t\t\t\terrorText,\n\t\t\t\t);\n\t\t\t}\n\n\t\t\tthrow new Error(errorMessage);\n\t\t}\n\n\t\t// Check if response is JSON before parsing\n\t\tconst contentType = response.headers.get(\"content-type\");\n\t\tif (!contentType?.includes(\"application/json\")) {\n\t\t\tthrow new Error(`YNS API returned ${contentType} instead of JSON for ${pathname}`);\n\t\t}\n\n\t\treturn response.json();\n\t}\n\n\tasync #multipartRequest<T>(pathname: `/${string}`, formData: FormData): Promise<T> {\n\t\tconst logger = this.#logger.getLogger(\"#multipartRequest\");\n\n\t\tconst endpoint = `${this.#config.endpoint}/api/${this.#config.version}${pathname}`;\n\t\tlogger.debug(`Making multipart POST to YNS API: ${endpoint}`);\n\t\tconst response = await fetch(endpoint, {\n\t\t\tmethod: \"POST\",\n\t\t\theaders: {\n\t\t\t\tAuthorization: `Bearer ${this.#config.token}`,\n\t\t\t},\n\t\t\tbody: formData,\n\t\t});\n\n\t\tif (!response.ok) {\n\t\t\tconst contentType = response.headers.get(\"content-type\");\n\t\t\tlet errorMessage = `YNS REST request failed: POST ${endpoint} ${response.status} ${response.statusText}`;\n\n\t\t\tif (contentType?.includes(\"application/json\")) {\n\t\t\t\ttry {\n\t\t\t\t\tconst errorData = await response.json();\n\t\t\t\t\terrorMessage = errorData.error || errorData.message || errorMessage;\n\t\t\t\t} catch (error) {\n\t\t\t\t\tlogger.error(\"Failed to parse YNS error response as JSON\", error);\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tconst errorText = await response.text();\n\t\t\t\tlogger.error(\n\t\t\t\t\t`YNS API request failed: ${response.status} ${response.statusText}`,\n\t\t\t\t\terrorMessage,\n\t\t\t\t\terrorText,\n\t\t\t\t);\n\t\t\t}\n\n\t\t\tthrow new Error(errorMessage);\n\t\t}\n\n\t\tconst contentType = response.headers.get(\"content-type\");\n\t\tif (!contentType?.includes(\"application/json\")) {\n\t\t\tthrow new Error(`YNS API returned ${contentType} instead of JSON for ${pathname}`);\n\t\t}\n\n\t\treturn response.json();\n\t}\n\n\tasync meGet(): Promise<APIMeGetResult> {\n\t\tconst logger = this.#logger.getLogger(\"meGet\");\n\t\tlogger.debug(\"Fetching my information\");\n\n\t\tconst pathname = `/me` as const;\n\t\tconst result = await this.#restRequest<APIMeGetResult>(pathname);\n\t\tlogger.debug(\"Received my information:\", result);\n\t\treturn result;\n\t}\n\n\tasync socialsGet(): Promise<APISocialsGetResult> {\n\t\tconst logger = this.#logger.getLogger(\"socialsGet\");\n\t\tlogger.debug(\"Fetching store social links\");\n\n\t\tconst pathname = `/socials` as const;\n\t\tconst result = await this.#restRequest<APISocialsGetResult>(pathname);\n\t\tlogger.debug(\"Received store social links:\", result);\n\t\treturn result;\n\t}\n\n\t// Brands ---------------------------------------------------------------\n\n\tasync brandBrowse(params: APIBrandsBrowseQueryParams = {}): Promise<APIBrandsBrowseResult> {\n\t\tconst queryParams = new URLSearchParams();\n\t\tif (params.limit) queryParams.append(\"limit\", params.limit.toString());\n\t\tif (params.offset) queryParams.append(\"offset\", params.offset.toString());\n\t\tif (params.query) queryParams.append(\"query\", params.query);\n\t\tif (params.active !== undefined) queryParams.append(\"active\", params.active.toString());\n\t\tif (params.lang) queryParams.append(\"lang\", params.lang);\n\t\tconst searchParams = queryParams.size ? `?${queryParams}` : \"\";\n\t\tconst pathname = `/brands${searchParams}` as const;\n\t\treturn this.#restRequest<APIBrandsBrowseResult>(pathname);\n\t}\n\n\tasync brandGet(params: APIBrandGetByIdParams): Promise<APIBrandGetByIdResult | null> {\n\t\tconst pathname = `/brands/${params.idOrSlug}` as const;\n\t\treturn this.#restRequest<APIBrandGetByIdResult>(pathname);\n\t}\n\n\tasync brandCreate(body: APIBrandCreateBody): Promise<APIBrandCreateResult> {\n\t\treturn this.#restRequest<APIBrandCreateResult>(\"/brands\", \"POST\", body);\n\t}\n\n\tasync brandUpdate(params: APIBrandGetByIdParams, body: APIBrandUpdateBody): Promise<APIBrandUpdateResult> {\n\t\tconst pathname = `/brands/${params.idOrSlug}` as const;\n\t\treturn this.#restRequest<APIBrandUpdateResult>(pathname, \"PATCH\", body);\n\t}\n\n\tasync brandDelete(params: APIBrandGetByIdParams): Promise<APIBrandDeleteResult> {\n\t\tconst pathname = `/brands/${params.idOrSlug}` as const;\n\t\treturn this.#restRequest<APIBrandDeleteResult>(pathname, \"DELETE\");\n\t}\n\n\tasync brandAssignProducts(\n\t\tparams: APIBrandGetByIdParams,\n\t\tbody: APIBrandAssignProductsBody,\n\t): Promise<APIBrandAssignProductsResult> {\n\t\tconst pathname = `/brands/${params.idOrSlug}/products` as const;\n\t\treturn this.#restRequest<APIBrandAssignProductsResult>(pathname, \"POST\", body);\n\t}\n\n\t// Order refunds --------------------------------------------------------\n\n\tasync orderRefundsBrowse(\n\t\tparams: APIOrderRefundsParams & APIOrderRefundsBrowseQueryParams,\n\t): Promise<APIOrderRefundsBrowseResult> {\n\t\tconst queryParams = new URLSearchParams();\n\t\tif (params.limit) queryParams.append(\"limit\", params.limit.toString());\n\t\tif (params.offset) queryParams.append(\"offset\", params.offset.toString());\n\t\tconst searchParams = queryParams.size ? `?${queryParams}` : \"\";\n\t\tconst pathname = `/orders/${params.id}/refunds${searchParams}` as const;\n\t\treturn this.#restRequest<APIOrderRefundsBrowseResult>(pathname);\n\t}\n\n\tasync orderRefundGet(params: APIOrderRefundGetParams): Promise<APIOrderRefundGetResult | null> {\n\t\tconst pathname = `/orders/${params.id}/refunds/${params.refundId}` as const;\n\t\treturn this.#restRequest<APIOrderRefundGetResult>(pathname);\n\t}\n\n\t// Product bulk ---------------------------------------------------------\n\n\tasync productBatch(body: APIProductBatchBody): Promise<APIProductBatchResult> {\n\t\treturn this.#restRequest<APIProductBatchResult>(\"/products/batch\", \"POST\", body);\n\t}\n\n\t// Cart -----------------------------------------------------------------\n\n\tasync cartDelete(params: { cartId: string }): Promise<APICartDeleteResult> {\n\t\tconst pathname = `/carts/${params.cartId}` as const;\n\t\treturn this.#restRequest<APICartDeleteResult>(pathname, \"DELETE\");\n\t}\n\n\tasync productBrowse(params: APIProductsBrowseQueryParams): Promise<APIProductsBrowseResult> {\n\t\tconst logger = this.#logger.getLogger(\"productBrowse\");\n\t\tlogger.debug(\"Browsing products with params:\", params);\n\n\t\tconst queryParams = new URLSearchParams();\n\t\tif (params.limit) queryParams.append(\"limit\", params.limit.toString());\n\t\tif (params.offset) queryParams.append(\"offset\", params.offset.toString());\n\t\tif (params.category) queryParams.append(\"category\", params.category);\n\t\tif (params.collection) queryParams.append(\"collection\", params.collection);\n\t\tif (params.brand) queryParams.append(\"brand\", params.brand);\n\t\tif (params.priceMin !== undefined) queryParams.append(\"priceMin\", params.priceMin.toString());\n\t\tif (params.priceMax !== undefined) queryParams.append(\"priceMax\", params.priceMax.toString());\n\t\tif (params.vts) queryParams.append(\"vts\", params.vts);\n\t\tif (params.query) queryParams.append(\"query\", params.query);\n\t\tif (params.active !== undefined) queryParams.append(\"active\", params.active.toString());\n\t\tif (params.orderBy) queryParams.append(\"orderBy\", params.orderBy);\n\t\tif (params.orderDirection) queryParams.append(\"orderDirection\", params.orderDirection);\n\n\t\tconst searchParams = queryParams.size ? `?${queryParams}` : \"\";\n\t\tconst pathname = `/products${searchParams}` as const;\n\t\tlogger.debug(\"Constructed pathname:\", pathname);\n\t\tconst result = await this.#restRequest<APIProductsBrowseResult>(pathname);\n\t\tlogger.debug(\"Received product browse result:\", { meta: result.meta });\n\t\treturn result;\n\t}\n\n\t/**\n\t * Available storefront filter facets for the store: price bounds, variant\n\t * types/values, and active categories, collections, and brands. Pair with\n\t * `productBrowse`'s `collection`, `brand`, `priceMin`/`priceMax`, and `vts`\n\t * params to build a filter UI.\n\t */\n\tasync productFilters(): Promise<APIProductFiltersResult> {\n\t\tconst result = await this.#restRequest<APIProductFiltersResult>(\"/products/filters\");\n\t\treturn result;\n\t}\n\n\tasync productGet(params: APIProductGetByIdParams): Promise<APIProductGetByIdResult | null> {\n\t\tconst pathname = `/products/${params.idOrSlug}` as const;\n\n\t\tconst result = await this.#restRequest<APIProductGetByIdResult>(pathname);\n\n\t\tif (!result) {\n\t\t\treturn null;\n\t\t}\n\n\t\treturn result;\n\t}\n\n\tasync orderBrowse(params: APIOrdersBrowseQueryParams): Promise<APIOrdersBrowseResult> {\n\t\tconst logger = this.#logger.getLogger(\"orderBrowse\");\n\t\tlogger.debug(\"Browsing orders with params:\", params);\n\n\t\tconst queryParams = new URLSearchParams();\n\n\t\tif (params.limit) queryParams.append(\"limit\", params.limit.toString());\n\t\tif (params.offset) queryParams.append(\"offset\", params.offset.toString());\n\n\t\tconst searchParams = queryParams.size ? `?${queryParams}` : \"\";\n\t\tconst pathname = `/orders${searchParams}` as const;\n\t\tlogger.debug(\"Constructed pathname:\", pathname);\n\t\tconst result = await this.#restRequest<APIOrdersBrowseResult>(pathname);\n\t\tlogger.debug(\"Received orders browse result:\", { meta: result.meta });\n\t\treturn result;\n\t}\n\n\tasync orderGet(params: APIOrderGetByIdParams): Promise<APIOrderGetByIdResult | null> {\n\t\tconst pathname = `/orders/${params.id}` as const;\n\n\t\tconst result = await this.#restRequest<APIOrderGetByIdResult>(pathname);\n\n\t\tif (!result) {\n\t\t\treturn null;\n\t\t}\n\n\t\treturn result;\n\t}\n\n\t// @todo\n\t// async cartAdd(params: APICartAddBody): Promise<APICartAddResult> {\n\t// \tconst body = {\n\t// \t\tvariantId: params.variantId,\n\t// \t\tcartId: params.cartId,\n\t// \t\tquantity: params.quantity,\n\t// \t\tsubscriptionId: params.subscriptionId,\n\t// \t};\n\n\t// \tconst result = await this.#restRequest<APICartCreateResult>(\"/carts\", \"PATCH\", body);\n\t// \treturn result;\n\t// }\n\n\tasync cartUpsert(body: APICartCreateBody): Promise<APICartCreateResult> {\n\t\tconst result = await this.#restRequest<APICartCreateResult>(\"/carts\", \"POST\", body);\n\t\treturn result;\n\t}\n\n\t/**\n\t * Add a configured bundle to the cart in one call. `selections` are the customer's per-group\n\t * choices; always-included (forced) items may be omitted — the server fills them in and\n\t * validates the rest against the bundle's groups. Omit `cartId` to start a new cart. The\n\t * returned cart prices the bundle line (componentTotal × (1 − discount)).\n\t */\n\tasync cartAddBundle(params: {\n\t\tbundleId: string;\n\t\tselections: NonNullable<APICartCreateBody[\"selections\"]>;\n\t\tcartId?: string;\n\t\tcurrency?: string;\n\t}): Promise<APICartCreateResult> {\n\t\tconst body: APICartCreateBody = {\n\t\t\tbundleId: params.bundleId,\n\t\t\tselections: params.selections,\n\t\t\t...(params.cartId ? { cartId: params.cartId } : {}),\n\t\t\t...(params.currency ? { currency: params.currency } : {}),\n\t\t};\n\t\tconst result = await this.#restRequest<APICartCreateResult>(\"/carts\", \"POST\", body);\n\t\treturn result;\n\t}\n\n\tasync cartRemoveItem(params: { cartId: string; variantId: string }): Promise<APICartGetResult> {\n\t\tconst pathname = `/carts/${params.cartId}/line-items/${params.variantId}` as const;\n\t\treturn this.#restRequest<APICartGetResult>(pathname, \"DELETE\");\n\t}\n\n\tasync cartGet(params: { cartId: string }): Promise<APICartGetResult | null> {\n\t\tconst pathname = `/carts/${params.cartId}` as const;\n\t\tconst result = await this.#restRequest<APICartGetResult>(pathname);\n\t\treturn result;\n\t}\n\n\tasync couponBrowse(params: APICouponsBrowseQueryParams = {}): Promise<APICouponsBrowseResult> {\n\t\tconst queryParams = new URLSearchParams();\n\t\tif (params.limit) queryParams.append(\"limit\", params.limit.toString());\n\t\tif (params.offset) queryParams.append(\"offset\", params.offset.toString());\n\t\tif (params.query) queryParams.append(\"query\", params.query);\n\n\t\tconst searchParams = queryParams.size ? `?${queryParams}` : \"\";\n\t\tconst pathname = `/coupons${searchParams}` as const;\n\n\t\treturn this.#restRequest<APICouponsBrowseResult>(pathname);\n\t}\n\n\t/** Look up a coupon by its UUID or its code. Resolves to `null` when not found. */\n\tasync couponGet(params: APICouponGetByIdParams): Promise<APICouponGetByIdResult | null> {\n\t\tconst pathname = `/coupons/${params.idOrCode}` as const;\n\t\treturn this.#restRequestNullable<APICouponGetByIdResult>(pathname);\n\t}\n\n\tasync couponCreate(body: APICouponCreateBody): Promise<APICouponCreateResult> {\n\t\treturn this.#restRequest<APICouponCreateResult>(\"/coupons\", \"POST\", body);\n\t}\n\n\tasync couponUpdate(\n\t\tparams: APICouponGetByIdParams,\n\t\tbody: APICouponUpdateBody,\n\t): Promise<APICouponUpdateResult> {\n\t\tconst pathname = `/coupons/${params.idOrCode}` as const;\n\t\treturn this.#restRequest<APICouponUpdateResult>(pathname, \"PATCH\", body);\n\t}\n\n\tasync couponDelete(params: APICouponGetByIdParams): Promise<APICouponDeleteResult> {\n\t\tconst pathname = `/coupons/${params.idOrCode}` as const;\n\t\treturn this.#restRequest<APICouponDeleteResult>(pathname, \"DELETE\");\n\t}\n\n\t/** List the store's support cases (merchant ↔ YNS support), newest activity first. */\n\tasync supportCaseBrowse(\n\t\tparams: APISupportCasesBrowseQueryParams = {},\n\t): Promise<APISupportCasesBrowseResult> {\n\t\tconst queryParams = new URLSearchParams();\n\t\tif (params.limit) queryParams.append(\"limit\", params.limit.toString());\n\t\tif (params.offset) queryParams.append(\"offset\", params.offset.toString());\n\t\tif (params.query) queryParams.append(\"query\", params.query);\n\t\tif (params.status) queryParams.append(\"status\", params.status);\n\t\tif (params.severity) queryParams.append(\"severity\", params.severity);\n\n\t\tconst searchParams = queryParams.size ? `?${queryParams}` : \"\";\n\t\tconst pathname = `/support-cases${searchParams}` as const;\n\n\t\treturn this.#restRequest<APISupportCasesBrowseResult>(pathname);\n\t}\n\n\t/**\n\t * Look up a case with its message thread by UUID or case number (\"123\" or \"000123\").\n\t * Resolves to `null` when not found. Internal YNS notes are never included.\n\t */\n\tasync supportCaseGet(params: APISupportCaseGetParams): Promise<APISupportCaseGetResult | null> {\n\t\tconst pathname = `/support-cases/${params.idOrNumber}` as const;\n\t\treturn this.#restRequestNullable<APISupportCaseGetResult>(pathname);\n\t}\n\n\t/** Open a support case with the YNS team. Omit `subject` to have one generated from the description. */\n\tasync supportCaseCreate(body: APISupportCaseCreateBody): Promise<APISupportCaseCreateResult> {\n\t\treturn this.#restRequest<APISupportCaseCreateResult>(\"/support-cases\", \"POST\", body);\n\t}\n\n\t/** Close (`status: \"closed\"`) or reopen (`status: \"open\"`) a case. */\n\tasync supportCaseUpdate(\n\t\tparams: APISupportCaseGetParams,\n\t\tbody: APISupportCaseUpdateBody,\n\t): Promise<APISupportCaseUpdateResult> {\n\t\tconst pathname = `/support-cases/${params.idOrNumber}` as const;\n\t\treturn this.#restRequest<APISupportCaseUpdateResult>(pathname, \"PATCH\", body);\n\t}\n\n\t/** Add a merchant-side reply to the case thread; replying reopens a closed or answered case. */\n\tasync supportCaseReply(\n\t\tparams: APISupportCaseGetParams,\n\t\tbody: APISupportCaseMessageCreateBody,\n\t): Promise<APISupportCaseMessageCreateResult> {\n\t\tconst pathname = `/support-cases/${params.idOrNumber}/messages` as const;\n\t\treturn this.#restRequest<APISupportCaseMessageCreateResult>(pathname, \"POST\", body);\n\t}\n\n\tasync collectionGet(params: APICollectionGetByIdParams): Promise<APICollectionGetByIdResult | null> {\n\t\tconst pathname = `/collections/${params.idOrSlug}` as const;\n\n\t\tconst result = await this.#restRequest<APICollectionGetByIdResult>(pathname);\n\t\treturn result;\n\t}\n\n\tasync collectionBrowse(params: APICollectionsBrowseQueryParams): Promise<APICollectionsBrowseResult> {\n\t\tconst queryParams = new URLSearchParams();\n\t\tif (params.limit) queryParams.append(\"limit\", params.limit.toString());\n\t\tif (params.offset) queryParams.append(\"offset\", params.offset.toString());\n\t\tif (params.query) queryParams.append(\"query\", params.query);\n\t\tif (params.active !== undefined) queryParams.append(\"active\", params.active.toString());\n\t\tif (params.group) queryParams.append(\"group\", params.group);\n\n\t\tconst searchParams = queryParams.size ? `?${queryParams}` : \"\";\n\t\tconst pathname = `/collections${searchParams}` as const;\n\n\t\tconst result = await this.#restRequest<APICollectionsBrowseResult>(pathname);\n\t\treturn result;\n\t}\n\n\tasync collectionCreate(body: APICollectionCreateBody): Promise<APICollectionCreateResult> {\n\t\treturn this.#restRequest<APICollectionCreateResult>(\"/collections\", \"POST\", body);\n\t}\n\n\tasync collectionUpdate(\n\t\tparams: APICollectionGetByIdParams,\n\t\tbody: APICollectionUpdateBody,\n\t): Promise<APICollectionUpdateResult> {\n\t\tconst pathname = `/collections/${params.idOrSlug}` as const;\n\t\treturn this.#restRequest<APICollectionUpdateResult>(pathname, \"PATCH\", body);\n\t}\n\n\tasync collectionDelete(params: APICollectionGetByIdParams): Promise<APICollectionDeleteResult> {\n\t\tconst pathname = `/collections/${params.idOrSlug}` as const;\n\t\treturn this.#restRequest<APICollectionDeleteResult>(pathname, \"DELETE\");\n\t}\n\n\tasync collectionImportMemberships(\n\t\tbody: APICollectionImportMembershipsBody,\n\t): Promise<APICollectionImportMembershipsResult> {\n\t\tconst formData = new FormData();\n\t\tformData.append(\"file\", body.file);\n\t\treturn this.#multipartRequest<APICollectionImportMembershipsResult>(\n\t\t\t\"/collections/import-memberships\",\n\t\t\tformData,\n\t\t);\n\t}\n\n\tasync categoryGet(params: APICategoryGetByIdParams): Promise<APICategoryGetByIdResult | null> {\n\t\tconst pathname = `/categories/${params.idOrSlug}` as const;\n\n\t\tconst result = await this.#restRequest<APICategoryGetByIdResult>(pathname);\n\t\treturn result;\n\t}\n\n\tasync categoriesBrowse(params: APICategoriesBrowseQueryParams): Promise<APICategoriesBrowseResult> {\n\t\tconst queryParams = new URLSearchParams();\n\t\tif (params.limit) queryParams.append(\"limit\", params.limit.toString());\n\t\tif (params.offset) queryParams.append(\"offset\", params.offset.toString());\n\t\tif (params.query) queryParams.append(\"query\", params.query);\n\t\tif (params.active !== undefined) queryParams.append(\"active\", params.active.toString());\n\n\t\tconst searchParams = queryParams.size ? `?${queryParams}` : \"\";\n\t\tconst pathname = `/categories${searchParams}` as const;\n\n\t\tconst result = await this.#restRequest<APICategoriesBrowseResult>(pathname);\n\t\treturn result;\n\t}\n\n\t// ============================================\n\t// Posts\n\t// ============================================\n\n\tasync postBrowse(params: APIPostsBrowseQueryParams = {}): Promise<APIPostsBrowseResult> {\n\t\tconst queryParams = new URLSearchParams();\n\t\tif (params.limit) queryParams.append(\"limit\", params.limit.toString());\n\t\tif (params.offset) queryParams.append(\"offset\", params.offset.toString());\n\t\tif (params.query) queryParams.append(\"query\", params.query);\n\t\tif (params.active !== undefined) queryParams.append(\"active\", params.active.toString());\n\t\tif (params.tag) queryParams.append(\"tag\", params.tag);\n\t\tif (params.categoryId) queryParams.append(\"categoryId\", params.categoryId);\n\n\t\tconst searchParams = queryParams.size ? `?${queryParams}` : \"\";\n\t\tconst pathname = `/posts${searchParams}` as const;\n\n\t\treturn this.#restRequest<APIPostsBrowseResult>(pathname);\n\t}\n\n\tasync postGet(params: APIPostGetByIdParams): Promise<APIPostGetByIdResult | null> {\n\t\tconst pathname = `/posts/${params.idOrSlug}` as const;\n\t\treturn this.#restRequest<APIPostGetByIdResult>(pathname);\n\t}\n\n\tasync postCreate(body: APIPostCreateBody): Promise<APIPostCreateResult> {\n\t\treturn this.#restRequest<APIPostCreateResult>(\"/posts\", \"POST\", body);\n\t}\n\n\tasync postUpdate(params: APIPostGetByIdParams, body: APIPostUpdateBody): Promise<APIPostUpdateResult> {\n\t\tconst pathname = `/posts/${params.idOrSlug}` as const;\n\t\treturn this.#restRequest<APIPostUpdateResult>(pathname, \"PATCH\", body);\n\t}\n\n\tasync postDelete(params: APIPostGetByIdParams): Promise<APIPostDeleteResult> {\n\t\tconst pathname = `/posts/${params.idOrSlug}` as const;\n\t\treturn this.#restRequest<APIPostDeleteResult>(pathname, \"DELETE\");\n\t}\n\n\tasync postCommentsBrowse(\n\t\tparams: APIPostGetByIdParams,\n\t\tqueryParams: APIPostCommentsBrowseQueryParams = {},\n\t): Promise<APIPostCommentsBrowseResult> {\n\t\tconst urlParams = new URLSearchParams();\n\t\tif (queryParams.limit) urlParams.append(\"limit\", queryParams.limit.toString());\n\t\tif (queryParams.offset) urlParams.append(\"offset\", queryParams.offset.toString());\n\n\t\tconst searchParams = urlParams.size ? `?${urlParams}` : \"\";\n\t\tconst pathname = `/posts/${params.idOrSlug}/comments${searchParams}` as const;\n\n\t\treturn this.#restRequest<APIPostCommentsBrowseResult>(pathname);\n\t}\n\n\tasync postCommentCreate(\n\t\tparams: APIPostGetByIdParams,\n\t\tbody: APIPostCommentCreateBody,\n\t): Promise<APIPostCommentCreateResult> {\n\t\tconst pathname = `/posts/${params.idOrSlug}/comments` as const;\n\t\treturn this.#restRequest<APIPostCommentCreateResult>(pathname, \"POST\", body);\n\t}\n\n\t// ============================================\n\t// Blog Categories\n\t// ============================================\n\n\tasync blogCategoryBrowse(\n\t\tparams: APIBlogCategoriesBrowseQueryParams = {},\n\t): Promise<APIBlogCategoriesBrowseResult> {\n\t\tconst queryParams = new URLSearchParams();\n\t\tif (params.limit) queryParams.append(\"limit\", params.limit.toString());\n\t\tif (params.offset) queryParams.append(\"offset\", params.offset.toString());\n\t\tif (params.query) queryParams.append(\"query\", params.query);\n\t\tif (params.active !== undefined) queryParams.append(\"active\", params.active.toString());\n\n\t\tconst searchParams = queryParams.size ? `?${queryParams}` : \"\";\n\t\tconst pathname = `/blog-categories${searchParams}` as const;\n\n\t\treturn this.#restRequest<APIBlogCategoriesBrowseResult>(pathname);\n\t}\n\n\tasync blogCategoryGet(params: APIBlogCategoryGetByIdParams): Promise<APIBlogCategoryGetByIdResult | null> {\n\t\tconst pathname = `/blog-categories/${params.idOrSlug}` as const;\n\t\treturn this.#restRequest<APIBlogCategoryGetByIdResult>(pathname);\n\t}\n\n\tasync blogCategoryCreate(body: APIBlogCategoryCreateBody): Promise<APIBlogCategoryCreateResult> {\n\t\treturn this.#restRequest<APIBlogCategoryCreateResult>(\"/blog-categories\", \"POST\", body);\n\t}\n\n\tasync blogCategoryUpdate(\n\t\tparams: APIBlogCategoryGetByIdParams,\n\t\tbody: APIBlogCategoryUpdateBody,\n\t): Promise<APIBlogCategoryUpdateResult> {\n\t\tconst pathname = `/blog-categories/${params.idOrSlug}` as const;\n\t\treturn this.#restRequest<APIBlogCategoryUpdateResult>(pathname, \"PATCH\", body);\n\t}\n\n\tasync blogCategoryDelete(params: APIBlogCategoryGetByIdParams): Promise<APIBlogCategoryDeleteResult> {\n\t\tconst pathname = `/blog-categories/${params.idOrSlug}` as const;\n\t\treturn this.#restRequest<APIBlogCategoryDeleteResult>(pathname, \"DELETE\");\n\t}\n\n\t// ============================================\n\t// Customers\n\t// ============================================\n\n\tasync customerBrowse(params: APICustomersBrowseQueryParams = {}): Promise<APICustomersBrowseResult> {\n\t\tconst queryParams = new URLSearchParams();\n\t\tif (params.limit) queryParams.append(\"limit\", params.limit.toString());\n\t\tif (params.offset) queryParams.append(\"offset\", params.offset.toString());\n\t\tif (params.search) queryParams.append(\"search\", params.search);\n\n\t\tconst searchParams = queryParams.size ? `?${queryParams}` : \"\";\n\t\tconst pathname = `/customers${searchParams}` as const;\n\n\t\treturn this.#restRequest<APICustomersBrowseResult>(pathname);\n\t}\n\n\tasync customerGet(params: APICustomerGetByIdParams): Promise<APICustomerGetByIdResult | null> {\n\t\tconst pathname = `/customers/${params.id}` as const;\n\t\treturn this.#restRequest<APICustomerGetByIdResult>(pathname);\n\t}\n\n\tasync customerUpdate(\n\t\tparams: APICustomerGetByIdParams,\n\t\tbody: APICustomerUpdateBody,\n\t): Promise<APICustomerUpdateResult> {\n\t\tconst pathname = `/customers/${params.id}` as const;\n\t\treturn this.#restRequest<APICustomerUpdateResult>(pathname, \"PATCH\", body);\n\t}\n\n\tasync customerAddressCreate(\n\t\tparams: APICustomerGetByIdParams,\n\t\tbody: APICustomerAddressCreateBody,\n\t): Promise<APICustomerAddressCreateResult> {\n\t\tconst pathname = `/customers/${params.id}/addresses` as const;\n\t\treturn this.#restRequest<APICustomerAddressCreateResult>(pathname, \"POST\", body);\n\t}\n\n\tasync customerAddressDelete(params: { customerId: string; addressId: string }): Promise<void> {\n\t\tconst pathname = `/customers/${params.customerId}/addresses/${params.addressId}` as const;\n\t\tawait this.#restRequest<unknown>(pathname, \"DELETE\");\n\t}\n\n\tasync customerOrdersBrowse(\n\t\tparams: APICustomerGetByIdParams,\n\t\tqueryParams: APICustomerOrdersBrowseQueryParams = {},\n\t): Promise<APICustomerOrdersBrowseResult> {\n\t\tconst urlParams = new URLSearchParams();\n\t\tif (queryParams.limit) urlParams.append(\"limit\", queryParams.limit.toString());\n\t\tif (queryParams.offset) urlParams.append(\"offset\", queryParams.offset.toString());\n\n\t\tconst searchParams = urlParams.size ? `?${urlParams}` : \"\";\n\t\tconst pathname = `/customers/${params.id}/orders${searchParams}` as const;\n\n\t\treturn this.#restRequest<APICustomerOrdersBrowseResult>(pathname);\n\t}\n\n\t// ============================================\n\t// Inventory\n\t// ============================================\n\n\tasync inventoryBrowse(params: APIInventoryBrowseQueryParams = {}): Promise<APIInventoryBrowseResult> {\n\t\tconst queryParams = new URLSearchParams();\n\t\tif (params.limit) queryParams.append(\"limit\", params.limit.toString());\n\t\tif (params.cursor) queryParams.append(\"cursor\", params.cursor);\n\t\tif (params.lowStock !== undefined) queryParams.append(\"lowStock\", params.lowStock.toString());\n\n\t\tconst searchParams = queryParams.size ? `?${queryParams}` : \"\";\n\t\tconst pathname = `/inventory${searchParams}` as const;\n\n\t\treturn this.#restRequest<APIInventoryBrowseResult>(pathname);\n\t}\n\n\tasync inventoryAdjust(sku: string, body: APIInventoryAdjustBody): Promise<APIInventoryAdjustResult> {\n\t\tconst pathname = `/inventory/${encodeURIComponent(sku)}/adjust` as const;\n\t\treturn this.#restRequest<APIInventoryAdjustResult>(pathname, \"POST\", body);\n\t}\n\n\t// ============================================\n\t// Variants\n\t// ============================================\n\n\tasync variantGet(params: APIVariantGetByIdParams): Promise<APIVariantGetByIdResult | null> {\n\t\tconst pathname = `/variants/${params.idOrSku}` as const;\n\t\treturn this.#restRequest<APIVariantGetByIdResult>(pathname);\n\t}\n\n\tasync variantUpdate(\n\t\tparams: APIVariantGetByIdParams,\n\t\tbody: APIVariantUpdateBody,\n\t): Promise<APIVariantUpdateResult> {\n\t\tconst pathname = `/variants/${params.idOrSku}` as const;\n\t\treturn this.#restRequest<APIVariantUpdateResult>(pathname, \"PATCH\", body);\n\t}\n\n\tasync variantDelete(params: APIVariantGetByIdParams): Promise<void> {\n\t\tconst pathname = `/variants/${params.idOrSku}` as const;\n\t\tawait this.#restRequest<unknown>(pathname, \"DELETE\");\n\t}\n\n\tasync variantCreate(productId: string, body: APIVariantCreateBody): Promise<APIVariantCreateResult> {\n\t\tconst pathname = `/products/${productId}/variants` as const;\n\t\treturn this.#restRequest<APIVariantCreateResult>(pathname, \"POST\", body);\n\t}\n\n\t// ============================================\n\t// Subscribers\n\t// ============================================\n\n\tasync subscriberCreate(body: APISubscriberCreateBody): Promise<APISubscriberCreateResult> {\n\t\treturn this.#restRequest<APISubscriberCreateResult>(\"/subscribers\", \"POST\", body);\n\t}\n\n\tasync subscriberDelete(email: string): Promise<APISubscriberDeleteResult> {\n\t\tconst pathname = `/subscribers?email=${encodeURIComponent(email)}` as const;\n\t\treturn this.#restRequest<APISubscriberDeleteResult>(pathname, \"DELETE\");\n\t}\n\n\t// ============================================\n\t// Contact Messages\n\t// ============================================\n\n\tasync contactMessageCreate(body: APIContactMessageCreateBody): Promise<APIContactMessageCreateResult> {\n\t\treturn this.#restRequest<APIContactMessageCreateResult>(\"/contact-messages\", \"POST\", body);\n\t}\n\n\t// ============================================\n\t// Product mutations\n\t// ============================================\n\n\tasync productCreate(body: APIProductCreateBody): Promise<APIProductCreateResult> {\n\t\treturn this.#restRequest<APIProductCreateResult>(\"/products\", \"POST\", body);\n\t}\n\n\tasync productUpdate(\n\t\tparams: APIProductGetByIdParams,\n\t\tbody: APIProductUpdateBody,\n\t): Promise<APIProductUpdateResult> {\n\t\tconst pathname = `/products/${params.idOrSlug}` as const;\n\t\treturn this.#restRequest<APIProductUpdateResult>(pathname, \"PATCH\", body);\n\t}\n\n\tasync productDelete(params: APIProductGetByIdParams): Promise<APIProductDeleteResult> {\n\t\tconst pathname = `/products/${params.idOrSlug}` as const;\n\t\treturn this.#restRequest<APIProductDeleteResult>(pathname, \"DELETE\");\n\t}\n\n\t// ============================================\n\t// Product Reviews\n\t// ============================================\n\n\tasync productReviewsBrowse(\n\t\tparams: APIProductGetByIdParams,\n\t\tqueryParams: APIProductReviewsBrowseQueryParams = {},\n\t): Promise<APIProductReviewsBrowseResult> {\n\t\tconst urlParams = new URLSearchParams();\n\t\tif (queryParams.limit) urlParams.append(\"limit\", queryParams.limit.toString());\n\t\tif (queryParams.offset) urlParams.append(\"offset\", queryParams.offset.toString());\n\n\t\tconst searchParams = urlParams.size ? `?${urlParams}` : \"\";\n\t\tconst pathname = `/products/${params.idOrSlug}/reviews${searchParams}` as const;\n\n\t\treturn this.#restRequest<APIProductReviewsBrowseResult>(pathname);\n\t}\n\n\tasync productReviewCreate(\n\t\tparams: APIProductGetByIdParams,\n\t\tbody: APIProductReviewCreateBody,\n\t): Promise<APIProductReviewCreateResult> {\n\t\tconst pathname = `/products/${params.idOrSlug}/reviews` as const;\n\t\treturn this.#restRequest<APIProductReviewCreateResult>(pathname, \"POST\", body);\n\t}\n\n\t// ============================================\n\t// Events (products flagged `flags.event` with a single non-shippable ticket variant)\n\t// ============================================\n\n\tasync eventBrowse(params: APIEventsBrowseQueryParams = {}): Promise<APIEventsBrowseResult> {\n\t\tconst logger = this.#logger.getLogger(\"eventBrowse\");\n\t\tconst queryParams = new URLSearchParams();\n\t\tif (params.offset !== undefined) queryParams.append(\"offset\", params.offset.toString());\n\t\tif (params.limit !== undefined) queryParams.append(\"limit\", params.limit.toString());\n\n\t\tconst searchParams = queryParams.size ? `?${queryParams}` : \"\";\n\t\tconst pathname = `/events${searchParams}` as const;\n\t\tlogger.debug(\"Browsing events:\", pathname);\n\t\treturn this.#restRequest<APIEventsBrowseResult>(pathname);\n\t}\n\n\tasync eventGet(params: APIEventGetByIdParams): Promise<APIEventGetByIdResult> {\n\t\tconst pathname = `/events/${params.idOrSlug}` as const;\n\t\treturn this.#restRequest<APIEventGetByIdResult>(pathname);\n\t}\n\n\tasync eventCreate(body: APIEventCreateBody): Promise<APIEventCreateResult> {\n\t\treturn this.#restRequest<APIEventCreateResult>(\"/events\", \"POST\", body);\n\t}\n\n\tasync eventUpdate(params: APIEventGetByIdParams, body: APIEventUpdateBody): Promise<APIEventUpdateResult> {\n\t\tconst pathname = `/events/${params.idOrSlug}` as const;\n\t\treturn this.#restRequest<APIEventUpdateResult>(pathname, \"PATCH\", body);\n\t}\n\n\tasync eventAttendeesBrowse(params: APIEventGetByIdParams): Promise<APIEventAttendeesBrowseResult> {\n\t\tconst pathname = `/events/${params.idOrSlug}/attendees` as const;\n\t\treturn this.#restRequest<APIEventAttendeesBrowseResult>(pathname);\n\t}\n\n\t// ============================================\n\t// Tickets (no-login buyer/attendee access to purchased event tickets)\n\t// ============================================\n\n\t/**\n\t * Buyer ticket lookup: the order's 6-character access code plus the purchase email.\n\t * Resolves to `null` on mismatch — the API answers a uniform 404 for an unknown code,\n\t * an email that doesn't match, or an order without tickets.\n\t */\n\tasync ticketsGet(params: { code: string; email: string }): Promise<APITicketsGetResult | null> {\n\t\tconst logger = this.#logger.getLogger(\"ticketsGet\");\n\t\tconst queryParams = new URLSearchParams({ email: params.email });\n\t\tconst pathname = `/tickets/${encodeURIComponent(params.code)}?${queryParams}` as const;\n\t\tlogger.debug(\"Fetching ticket bundle:\", pathname);\n\t\treturn this.#restRequestNullable<APITicketsGetResult>(pathname);\n\t}\n\n\t/**\n\t * Buyer bulk-edit of attendee names/emails. The body carries the purchase email; seat\n\t * tokens not belonging to the order are silently ignored. Throws on code/email mismatch\n\t * (404) or when the order is cancelled/refunded (409).\n\t */\n\tasync ticketsUpdate(params: { code: string }, body: APITicketsUpdateBody): Promise<APITicketsUpdateResult> {\n\t\tconst pathname = `/tickets/${encodeURIComponent(params.code)}` as const;\n\t\treturn this.#restRequest<APITicketsUpdateResult>(pathname, \"PATCH\", body);\n\t}\n\n\t/**\n\t * View-only attendee ticket by per-seat token (the capability embedded in the attendee\n\t * link/QR). Resolves to `null` for an unknown token. Attendee details can only be edited\n\t * by the buyer via {@link ticketsUpdate} — attendee links must not escalate.\n\t */\n\tasync ticketAttendeeGet(params: { token: string }): Promise<APITicketAttendeeGetResult | null> {\n\t\tconst pathname = `/tickets/attendee/${encodeURIComponent(params.token)}` as const;\n\t\treturn this.#restRequestNullable<APITicketAttendeeGetResult>(pathname);\n\t}\n\n\t// ============================================\n\t// Category mutations\n\t// ============================================\n\n\tasync categoryCreate(body: APICategoryCreateBody): Promise<APICategoryCreateResult> {\n\t\treturn this.#restRequest<APICategoryCreateResult>(\"/categories\", \"POST\", body);\n\t}\n\n\tasync categoryUpdate(\n\t\tparams: APICategoryGetByIdParams,\n\t\tbody: APICategoryUpdateBody,\n\t): Promise<APICategoryUpdateResult> {\n\t\tconst pathname = `/categories/${params.idOrSlug}` as const;\n\t\treturn this.#restRequest<APICategoryUpdateResult>(pathname, \"PATCH\", body);\n\t}\n\n\tasync categoryDelete(params: APICategoryGetByIdParams): Promise<APICategoryDeleteResult> {\n\t\tconst pathname = `/categories/${params.idOrSlug}` as const;\n\t\treturn this.#restRequest<APICategoryDeleteResult>(pathname, \"DELETE\");\n\t}\n\n\t// ============================================\n\t// Order mutations\n\t// ============================================\n\n\tasync orderUpdate(params: APIOrderGetByIdParams, body: APIOrderUpdateBody): Promise<APIOrderUpdateResult> {\n\t\tconst pathname = `/orders/${params.id}` as const;\n\t\treturn this.#restRequest<APIOrderUpdateResult>(pathname, \"PATCH\", body);\n\t}\n\n\t// ============================================\n\t// Legal Pages\n\t// ============================================\n\n\tasync legalPageBrowse(\n\t\tqueryParams: APILegalPagesBrowseQueryParams = {},\n\t): Promise<APILegalPagesBrowseResult> {\n\t\treturn this.request<APILegalPagesBrowseResult>(\"/legal-pages\", {\n\t\t\tquery: queryParams,\n\t\t});\n\t}\n\n\tasync legalPageGet(\n\t\tkey: string,\n\t\tqueryParams: APILegalPageGetByPathQueryParams = {},\n\t): Promise<APILegalPageGetByPathResult> {\n\t\tconst normalized = key.startsWith(\"/\") ? key.slice(1) : key;\n\t\tconst pathname = `/legal-pages/${encodeURIComponent(normalized)}` as const;\n\t\treturn this.request<APILegalPageGetByPathResult>(pathname, {\n\t\t\tquery: queryParams,\n\t\t});\n\t}\n\n\tasync legalPageCreate(\n\t\tbody: APILegalPageCreateBody,\n\t\tqueryParams: APILegalPageCreateQueryParams = {},\n\t): Promise<APILegalPageCreateResult> {\n\t\treturn this.request<APILegalPageCreateResult, APILegalPageCreateBody>(\"/legal-pages\", {\n\t\t\tmethod: \"POST\",\n\t\t\tbody,\n\t\t\tquery: queryParams,\n\t\t});\n\t}\n\n\tasync legalPageUpdate(\n\t\tkey: string,\n\t\tbody: APILegalPageUpdateBody,\n\t\tqueryParams: APILegalPageUpdateQueryParams = {},\n\t): Promise<APILegalPageUpdateResult> {\n\t\tconst normalized = key.startsWith(\"/\") ? key.slice(1) : key;\n\t\tconst pathname = `/legal-pages/${encodeURIComponent(normalized)}` as const;\n\t\treturn this.request<APILegalPageUpdateResult, APILegalPageUpdateBody>(pathname, {\n\t\t\tmethod: \"PATCH\",\n\t\t\tbody,\n\t\t\tquery: queryParams,\n\t\t});\n\t}\n\n\tasync search(params: APISearchQueryParams): Promise<APISearchResult> {\n\t\treturn this.request<APISearchResult>(\"/search\", {\n\t\t\tquery: params,\n\t\t});\n\t}\n\n\t// ============================================\n\t// Instaview\n\t// ============================================\n\n\tasync instaviewImagesBrowse(\n\t\tparams: APIInstaviewImagesBrowseParams,\n\t\tqueryParams: APIInstaviewImagesBrowseQueryParams = {},\n\t): Promise<APIInstaviewImagesBrowseResult> {\n\t\tconst urlParams = new URLSearchParams();\n\t\tif (queryParams.limit) urlParams.append(\"limit\", queryParams.limit.toString());\n\t\tif (queryParams.cursor) urlParams.append(\"cursor\", queryParams.cursor);\n\n\t\tconst searchParams = urlParams.size ? `?${urlParams}` : \"\";\n\t\tconst pathname = `/instaview/accounts/${params.handle}/images${searchParams}` as const;\n\n\t\treturn this.#restRequest<APIInstaviewImagesBrowseResult>(pathname);\n\t}\n\n\t/**\n\t * Make a raw API request to any endpoint.\n\t * Use this for new API features not yet supported by typed methods.\n\t *\n\t * @example\n\t * // GET request (default method)\n\t * const webhooks = await provider.request<Webhook[]>('/webhooks');\n\t *\n\t * // POST with typed body\n\t * const webhook = await provider.request<Webhook, CreateWebhookBody>('/webhooks', {\n\t * method: 'POST',\n\t * body: { url: 'https://...' }\n\t * });\n\t *\n\t * // GET with query parameters\n\t * const products = await provider.request<Product[]>('/products', {\n\t * query: { limit: 10, category: 'shoes' }\n\t * });\n\t *\n\t * // Path parameters via template literals\n\t * const product = await provider.request<Product>(`/products/${id}`);\n\t */\n\tasync request<TResponse = unknown, TBody = unknown>(\n\t\tpathname: `/${string}`,\n\t\toptions?: {\n\t\t\tmethod?: \"GET\" | \"POST\" | \"PATCH\" | \"DELETE\";\n\t\t\tbody?: TBody;\n\t\t\tquery?: Record<string, string | number | boolean | null | undefined>;\n\t\t},\n\t) {\n\t\tconst queryEntries = options?.query\n\t\t\t? Object.entries(options.query).filter((entry): entry is [string, string | number | boolean] => {\n\t\t\t\t\tconst [, value] = entry;\n\t\t\t\t\treturn value !== null && value !== undefined;\n\t\t\t\t})\n\t\t\t: [];\n\t\tconst queryString =\n\t\t\tqueryEntries.length > 0 ? `?${new URLSearchParams(queryEntries.map(([k, v]) => [k, String(v)]))}` : \"\";\n\n\t\treturn this.#restRequest<TResponse>(`${pathname}${queryString}`, options?.method ?? \"GET\", options?.body);\n\t}\n}\n","import { YNSProvider } from \"./providers/yns\";\nimport type { CommerceConfig } from \"./types\";\n\nexport function Commerce(config: CommerceConfig = {}): YNSProvider {\n\treturn new YNSProvider(config);\n}\n"],"mappings":"4BAAA,IAAMA,EAAc,QAAQ,IAAI,YAEnBC,EAAM,CAClB,YAAAD,CACD,ECYA,IAAME,EAAW,CAChB,MAAO,EACP,IAAK,EACL,KAAM,EACN,MAAO,CACR,EAGMC,EAAe,QAAQ,IAAI,uBAAyB,MACpDC,EAAgBF,EAASC,CAAW,EAEpCE,EAAQ,UACRC,EAAO,WACPC,EAAQ,WACRC,EAAS,WACTC,EAAM,WAENC,EAAO,eACPC,EAAQ,YACRC,EAAK,eACLC,EAAO,eACPC,EAAQ,SA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C9F,GAAM,CAAC,CAAEC,CAAK,EAAID,EAClB,OAAOC,GAAU,IAClB,CAAC,EACA,CAAC,EACEC,EACLH,EAAa,OAAS,EAAI,IAAI,IAAI,gBAAgBA,EAAa,IAAI,CAAC,CAACI,EAAGC,CAAC,IAAM,CAACD,EAAG,OAAOC,CAAC,CAAC,CAAC,CAAC,CAAC,GAAK,GAErG,OAAO,KAAKhC,GAAwB,GAAGC,CAAQ,GAAG6B,CAAW,GAAIJ,GAAS,QAAU,MAAOA,GAAS,IAAI,CACzG,CACD,EC9pCO,SAASO,EAASC,EAAyB,CAAC,EAAgB,CAClE,OAAO,IAAIC,EAAYD,CAAM,CAC9B","names":["YNS_API_KEY","env","LogLevel","strLogLevel","valueLogLevel","RESET","BLUE","GREEN","YELLOW","RED","TIME","DEBUG","OK","WARN","ERROR","PREFIX_TIME","PREFIX_DEBUG","PREFIX_OK","PREFIX_WARN","PREFIX_ERROR","getLogger","groupLabel","PREFIX","subGroupLabel","label","args","item","options","logger","YNSProvider","#config","#logger","getLogger","config","token","env","isStaging","endpoint","#restRequest","pathname","method","body","response","#fetchJson","#parseResponse","#restRequestNullable","logger","contentType","errorMessage","errorData","error","errorText","#multipartRequest","formData","result","params","queryParams","searchParams","urlParams","sku","productId","email","key","normalized","options","queryEntries","entry","value","queryString","k","v","Commerce","config","YNSProvider"]}
|
|
1
|
+
{"version":3,"sources":["../src/env.ts","../src/logger.ts","../src/providers/yns.ts","../src/commerce.ts"],"sourcesContent":["const YNS_API_KEY = process.env.YNS_API_KEY;\n\nexport const env = {\n\tYNS_API_KEY,\n};\n","import type { InspectOptions } from \"node:util\";\n\ntype LogParms = [message: unknown, ...optionalParams: unknown[]];\n\n/**\n * Vercel only supports 3 levels of logging. We're adding additional DEBUG level.\n * https://vercel.com/docs/observability/runtime-logs#level\n *\n * ERROR - Fatal for a particular request. Should be fixed sooner than later.\n *\n * WARN - A note on something that should probably be looked at eventually.\n *\n * LOG - Detail on regular operation.\n *\n * DEBUG - Debug only info as well as time and timeEnd functions.\n */\nconst LogLevel = {\n\tDEBUG: 0,\n\tLOG: 1,\n\tWARN: 2,\n\tERROR: 3,\n} as const;\ntype LogLevel = keyof typeof LogLevel;\n\nconst strLogLevel = (process.env.NEXT_PUBLIC_LOG_LEVEL || \"LOG\") as LogLevel;\nconst valueLogLevel = LogLevel[strLogLevel];\n\nconst RESET = \"\\x1b[0m\";\nconst BLUE = \"\\x1b[34m\";\nconst GREEN = \"\\x1b[32m\";\nconst YELLOW = \"\\x1b[33m\";\nconst RED = \"\\x1b[31m\";\n\nconst TIME = `⏱️`;\nconst DEBUG = `🐛`;\nconst OK = `✔️`;\nconst WARN = `⚠️`;\nconst ERROR = `❌`;\n\nconst PREFIX_TIME = `${TIME} `;\nconst PREFIX_DEBUG = `${BLUE}${DEBUG}${RESET} `;\nconst PREFIX_OK = `${GREEN}${OK}${RESET} `;\nconst PREFIX_WARN = `${YELLOW}${WARN}${RESET} `;\nconst PREFIX_ERROR = `${RED}${ERROR}${RESET} `;\n\nexport const getLogger = (groupLabel?: string) => {\n\tconst PREFIX = groupLabel ? `[${groupLabel}] ` : \"\";\n\treturn {\n\t\tgetLogger(subGroupLabel: string) {\n\t\t\treturn getLogger([groupLabel, subGroupLabel].filter(Boolean).join(\" > \"));\n\t\t},\n\t\ttime(label: string) {\n\t\t\tif (valueLogLevel > LogLevel.DEBUG) return;\n\t\t\tconsole.time([PREFIX_TIME, PREFIX, label].filter(Boolean).join(\" \"));\n\t\t},\n\t\ttimeEnd(label: string) {\n\t\t\tif (valueLogLevel > LogLevel.DEBUG) return;\n\t\t\tconsole.timeEnd([PREFIX_TIME, PREFIX, label].filter(Boolean).join(\" \"));\n\t\t},\n\t\tdebug(...args: LogParms) {\n\t\t\tif (valueLogLevel > LogLevel.DEBUG) return;\n\t\t\tconsole.log(...[PREFIX_DEBUG, PREFIX, ...args].filter(Boolean));\n\t\t},\n\t\tlog(...args: LogParms) {\n\t\t\tif (valueLogLevel > LogLevel.LOG) return;\n\t\t\tconsole.log(...[PREFIX_OK, PREFIX, ...args].filter(Boolean));\n\t\t},\n\t\tdir(item?: unknown, options?: InspectOptions) {\n\t\t\tif (valueLogLevel > LogLevel.LOG) return;\n\t\t\tconsole.dir(item, options);\n\t\t},\n\t\twarn(...args: LogParms) {\n\t\t\tif (valueLogLevel > LogLevel.WARN) return;\n\t\t\tconsole.warn(...[PREFIX_WARN, PREFIX, ...args].filter(Boolean));\n\t\t},\n\t\terror(...args: LogParms) {\n\t\t\tif (valueLogLevel > LogLevel.ERROR) return;\n\t\t\tconsole.error(...[PREFIX_ERROR, PREFIX, ...args].filter(Boolean));\n\t\t},\n\t};\n};\n\nexport const logger = getLogger();\n","import type {\n\tAPIBlogCategoriesBrowseQueryParams,\n\tAPIBlogCategoriesBrowseResult,\n\tAPIBlogCategoryCreateBody,\n\tAPIBlogCategoryCreateResult,\n\tAPIBlogCategoryDeleteResult,\n\tAPIBlogCategoryGetByIdParams,\n\tAPIBlogCategoryGetByIdResult,\n\tAPIBlogCategoryUpdateBody,\n\tAPIBlogCategoryUpdateResult,\n\tAPIBrandAssignProductsBody,\n\tAPIBrandAssignProductsResult,\n\tAPIBrandCreateBody,\n\tAPIBrandCreateResult,\n\tAPIBrandDeleteResult,\n\tAPIBrandGetByIdParams,\n\tAPIBrandGetByIdResult,\n\tAPIBrandsBrowseQueryParams,\n\tAPIBrandsBrowseResult,\n\tAPIBrandUpdateBody,\n\tAPIBrandUpdateResult,\n\tAPICartCouponApplyResult,\n\tAPICartCouponRemoveResult,\n\tAPICartCreateBody,\n\tAPICartCreateResult,\n\tAPICartDeleteResult,\n\tAPICartGetResult,\n\tAPICategoriesBrowseQueryParams,\n\tAPICategoriesBrowseResult,\n\tAPICategoryCreateBody,\n\tAPICategoryCreateResult,\n\tAPICategoryDeleteResult,\n\tAPICategoryGetByIdParams,\n\tAPICategoryGetByIdResult,\n\tAPICategoryUpdateBody,\n\tAPICategoryUpdateResult,\n\tAPICollectionCreateBody,\n\tAPICollectionCreateResult,\n\tAPICollectionDeleteResult,\n\tAPICollectionGetByIdParams,\n\tAPICollectionGetByIdResult,\n\tAPICollectionsBrowseQueryParams,\n\tAPICollectionsBrowseResult,\n\tAPICollectionUpdateBody,\n\tAPICollectionUpdateResult,\n\tAPIContactMessageCreateBody,\n\tAPIContactMessageCreateResult,\n\tAPICouponCreateBody,\n\tAPICouponCreateResult,\n\tAPICouponDeleteResult,\n\tAPICouponGetByIdParams,\n\tAPICouponGetByIdResult,\n\tAPICouponsBrowseQueryParams,\n\tAPICouponsBrowseResult,\n\tAPICouponUpdateBody,\n\tAPICouponUpdateResult,\n\tAPICustomerAddressCreateBody,\n\tAPICustomerAddressCreateResult,\n\tAPICustomerGetByIdParams,\n\tAPICustomerGetByIdResult,\n\tAPICustomerOrdersBrowseQueryParams,\n\tAPICustomerOrdersBrowseResult,\n\tAPICustomersBrowseQueryParams,\n\tAPICustomersBrowseResult,\n\tAPICustomerUpdateBody,\n\tAPICustomerUpdateResult,\n\tAPIEventAttendeesBrowseResult,\n\tAPIEventCreateBody,\n\tAPIEventCreateResult,\n\tAPIEventGetByIdParams,\n\tAPIEventGetByIdResult,\n\tAPIEventsBrowseQueryParams,\n\tAPIEventsBrowseResult,\n\tAPIEventUpdateBody,\n\tAPIEventUpdateResult,\n\tAPIInstaviewImagesBrowseParams,\n\tAPIInstaviewImagesBrowseQueryParams,\n\tAPIInstaviewImagesBrowseResult,\n\tAPIInventoryAdjustBody,\n\tAPIInventoryAdjustResult,\n\tAPIInventoryBrowseQueryParams,\n\tAPIInventoryBrowseResult,\n\tAPILegalPageCreateBody,\n\tAPILegalPageCreateQueryParams,\n\tAPILegalPageCreateResult,\n\tAPILegalPageGetByPathQueryParams,\n\tAPILegalPageGetByPathResult,\n\tAPILegalPagesBrowseQueryParams,\n\tAPILegalPagesBrowseResult,\n\tAPILegalPageUpdateBody,\n\tAPILegalPageUpdateQueryParams,\n\tAPILegalPageUpdateResult,\n\tAPIMeGetResult,\n\tAPIOrderGetByIdParams,\n\tAPIOrderGetByIdResult,\n\tAPIOrderRefundGetParams,\n\tAPIOrderRefundGetResult,\n\tAPIOrderRefundsBrowseQueryParams,\n\tAPIOrderRefundsBrowseResult,\n\tAPIOrderRefundsParams,\n\tAPIOrdersBrowseQueryParams,\n\tAPIOrdersBrowseResult,\n\tAPIOrderUpdateBody,\n\tAPIOrderUpdateResult,\n\tAPIPostCommentCreateBody,\n\tAPIPostCommentCreateResult,\n\tAPIPostCommentsBrowseQueryParams,\n\tAPIPostCommentsBrowseResult,\n\tAPIPostCreateBody,\n\tAPIPostCreateResult,\n\tAPIPostDeleteResult,\n\tAPIPostGetByIdParams,\n\tAPIPostGetByIdResult,\n\tAPIPostsBrowseQueryParams,\n\tAPIPostsBrowseResult,\n\tAPIPostUpdateBody,\n\tAPIPostUpdateResult,\n\tAPIProductBatchBody,\n\tAPIProductBatchResult,\n\tAPIProductCreateBody,\n\tAPIProductCreateResult,\n\tAPIProductDeleteResult,\n\tAPIProductFiltersResult,\n\tAPIProductGetByIdParams,\n\tAPIProductGetByIdResult,\n\tAPIProductReviewCreateBody,\n\tAPIProductReviewCreateResult,\n\tAPIProductReviewsBrowseQueryParams,\n\tAPIProductReviewsBrowseResult,\n\tAPIProductsBrowseQueryParams,\n\tAPIProductsBrowseResult,\n\tAPIProductUpdateBody,\n\tAPIProductUpdateResult,\n\tAPISearchQueryParams,\n\tAPISearchResult,\n\tAPISocialsGetResult,\n\tAPISubscriberCreateBody,\n\tAPISubscriberCreateResult,\n\tAPISubscriberDeleteResult,\n\tAPISupportCaseCreateBody,\n\tAPISupportCaseCreateResult,\n\tAPISupportCaseGetParams,\n\tAPISupportCaseGetResult,\n\tAPISupportCaseMessageCreateBody,\n\tAPISupportCaseMessageCreateResult,\n\tAPISupportCasesBrowseQueryParams,\n\tAPISupportCasesBrowseResult,\n\tAPISupportCaseUpdateBody,\n\tAPISupportCaseUpdateResult,\n\tAPITicketAttendeeGetResult,\n\tAPITicketsGetResult,\n\tAPITicketsUpdateBody,\n\tAPITicketsUpdateResult,\n\tAPIVariantCreateBody,\n\tAPIVariantCreateResult,\n\tAPIVariantGetByIdParams,\n\tAPIVariantGetByIdResult,\n\tAPIVariantUpdateBody,\n\tAPIVariantUpdateResult,\n} from \"../api-types\";\nimport { env } from \"../env\";\nimport { getLogger } from \"../logger\";\nimport type { CommerceConfig } from \"../types\";\n\nexport type APICollectionImportMembershipsBody = { file: File | Blob };\n\nexport type APICollectionImportMembershipsResult = {\n\tok: true;\n\tprocessed: number;\n\tinserted: number;\n\tskipped_existing: number;\n\terrors: Array<{\n\t\trow: number;\n\t\tcollection_slug?: string;\n\t\tproduct_slug?: string;\n\t\treason: string;\n\t}>;\n};\n\nexport class YNSProvider {\n\t#config: CommerceConfig;\n\t#logger = getLogger(\"YNSProvider\");\n\n\tconstructor(config: CommerceConfig = {}) {\n\t\tconst token = config.token ?? env.YNS_API_KEY;\n\t\tconst isStaging = env.YNS_API_KEY?.startsWith(\"sk-s-\");\n\n\t\tif (!token) {\n\t\t\tthrow new Error(\n\t\t\t\t\"YNS API key is required. Set YNS_API_KEY environment variable or pass token in config.\",\n\t\t\t);\n\t\t}\n\t\tconst endpoint = config.endpoint ?? (isStaging ? \"https://yns.cx\" : \"https://yns.store\");\n\n\t\tthis.#config = { version: \"v1\", ...config, token, endpoint };\n\n\t\tthis.#logger.debug(\"YNSProvider initialized\", {\n\t\t\tendpoint,\n\t\t\ttoken: config.token ? `from config` : \"from env\",\n\t\t});\n\t}\n\n\tasync #restRequest<T>(\n\t\tpathname: `/${string}`,\n\t\tmethod: \"GET\" | \"POST\" | \"PATCH\" | \"DELETE\" = \"GET\",\n\t\tbody?: unknown,\n\t): Promise<T> {\n\t\tconst response = await this.#fetchJson(pathname, method, body);\n\t\treturn this.#parseResponse<T>(response, pathname, method);\n\t}\n\n\t/**\n\t * Like {@link #restRequest} but resolves to `null` on a 404 response. For lookups where\n\t * \"not found\" is an expected outcome (e.g. ticket access codes answered with a uniform 404).\n\t */\n\tasync #restRequestNullable<T>(pathname: `/${string}`): Promise<T | null> {\n\t\tconst response = await this.#fetchJson(pathname, \"GET\");\n\t\tif (response.status === 404) {\n\t\t\treturn null;\n\t\t}\n\t\treturn this.#parseResponse<T>(response, pathname, \"GET\");\n\t}\n\n\tasync #fetchJson(\n\t\tpathname: `/${string}`,\n\t\tmethod: \"GET\" | \"POST\" | \"PATCH\" | \"DELETE\",\n\t\tbody?: unknown,\n\t): Promise<Response> {\n\t\tconst logger = this.#logger.getLogger(\"#restRequest\");\n\n\t\tconst endpoint = `${this.#config.endpoint}/api/${this.#config.version}${pathname}`;\n\t\tlogger.debug(`Making ${method} request to YNS API: ${endpoint}`);\n\t\treturn fetch(endpoint, {\n\t\t\tmethod,\n\t\t\theaders: {\n\t\t\t\t\"Content-Type\": \"application/json\",\n\t\t\t\tAuthorization: `Bearer ${this.#config.token}`,\n\t\t\t},\n\t\t\tbody: body ? JSON.stringify(body) : undefined,\n\t\t});\n\t}\n\n\tasync #parseResponse<T>(response: Response, pathname: `/${string}`, method: string): Promise<T> {\n\t\tconst logger = this.#logger.getLogger(\"#restRequest\");\n\t\tconst endpoint = `${this.#config.endpoint}/api/${this.#config.version}${pathname}`;\n\n\t\tif (!response.ok) {\n\t\t\t// Handle different error types\n\t\t\tconst contentType = response.headers.get(\"content-type\");\n\t\t\tlet errorMessage = `YNS REST request failed: ${method} ${endpoint} ${response.status} ${response.statusText}`;\n\n\t\t\tif (contentType?.includes(\"application/json\")) {\n\t\t\t\ttry {\n\t\t\t\t\tconst errorData = await response.json();\n\t\t\t\t\terrorMessage = errorData.error || errorData.message || errorMessage;\n\t\t\t\t} catch (error) {\n\t\t\t\t\tlogger.error(\"Failed to parse YNS error response as JSON\", error);\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tconst errorText = await response.text();\n\t\t\t\tlogger.error(\n\t\t\t\t\t`YNS API request failed: ${response.status} ${response.statusText}`,\n\t\t\t\t\terrorMessage,\n\t\t\t\t\terrorText,\n\t\t\t\t);\n\t\t\t}\n\n\t\t\tthrow new Error(errorMessage);\n\t\t}\n\n\t\t// Check if response is JSON before parsing\n\t\tconst contentType = response.headers.get(\"content-type\");\n\t\tif (!contentType?.includes(\"application/json\")) {\n\t\t\tthrow new Error(`YNS API returned ${contentType} instead of JSON for ${pathname}`);\n\t\t}\n\n\t\treturn response.json();\n\t}\n\n\tasync #multipartRequest<T>(pathname: `/${string}`, formData: FormData): Promise<T> {\n\t\tconst logger = this.#logger.getLogger(\"#multipartRequest\");\n\n\t\tconst endpoint = `${this.#config.endpoint}/api/${this.#config.version}${pathname}`;\n\t\tlogger.debug(`Making multipart POST to YNS API: ${endpoint}`);\n\t\tconst response = await fetch(endpoint, {\n\t\t\tmethod: \"POST\",\n\t\t\theaders: {\n\t\t\t\tAuthorization: `Bearer ${this.#config.token}`,\n\t\t\t},\n\t\t\tbody: formData,\n\t\t});\n\n\t\tif (!response.ok) {\n\t\t\tconst contentType = response.headers.get(\"content-type\");\n\t\t\tlet errorMessage = `YNS REST request failed: POST ${endpoint} ${response.status} ${response.statusText}`;\n\n\t\t\tif (contentType?.includes(\"application/json\")) {\n\t\t\t\ttry {\n\t\t\t\t\tconst errorData = await response.json();\n\t\t\t\t\terrorMessage = errorData.error || errorData.message || errorMessage;\n\t\t\t\t} catch (error) {\n\t\t\t\t\tlogger.error(\"Failed to parse YNS error response as JSON\", error);\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tconst errorText = await response.text();\n\t\t\t\tlogger.error(\n\t\t\t\t\t`YNS API request failed: ${response.status} ${response.statusText}`,\n\t\t\t\t\terrorMessage,\n\t\t\t\t\terrorText,\n\t\t\t\t);\n\t\t\t}\n\n\t\t\tthrow new Error(errorMessage);\n\t\t}\n\n\t\tconst contentType = response.headers.get(\"content-type\");\n\t\tif (!contentType?.includes(\"application/json\")) {\n\t\t\tthrow new Error(`YNS API returned ${contentType} instead of JSON for ${pathname}`);\n\t\t}\n\n\t\treturn response.json();\n\t}\n\n\tasync meGet(): Promise<APIMeGetResult> {\n\t\tconst logger = this.#logger.getLogger(\"meGet\");\n\t\tlogger.debug(\"Fetching my information\");\n\n\t\tconst pathname = `/me` as const;\n\t\tconst result = await this.#restRequest<APIMeGetResult>(pathname);\n\t\tlogger.debug(\"Received my information:\", result);\n\t\treturn result;\n\t}\n\n\tasync socialsGet(): Promise<APISocialsGetResult> {\n\t\tconst logger = this.#logger.getLogger(\"socialsGet\");\n\t\tlogger.debug(\"Fetching store social links\");\n\n\t\tconst pathname = `/socials` as const;\n\t\tconst result = await this.#restRequest<APISocialsGetResult>(pathname);\n\t\tlogger.debug(\"Received store social links:\", result);\n\t\treturn result;\n\t}\n\n\t// Brands ---------------------------------------------------------------\n\n\tasync brandBrowse(params: APIBrandsBrowseQueryParams = {}): Promise<APIBrandsBrowseResult> {\n\t\tconst queryParams = new URLSearchParams();\n\t\tif (params.limit) queryParams.append(\"limit\", params.limit.toString());\n\t\tif (params.offset) queryParams.append(\"offset\", params.offset.toString());\n\t\tif (params.query) queryParams.append(\"query\", params.query);\n\t\tif (params.active !== undefined) queryParams.append(\"active\", params.active.toString());\n\t\tif (params.lang) queryParams.append(\"lang\", params.lang);\n\t\tconst searchParams = queryParams.size ? `?${queryParams}` : \"\";\n\t\tconst pathname = `/brands${searchParams}` as const;\n\t\treturn this.#restRequest<APIBrandsBrowseResult>(pathname);\n\t}\n\n\tasync brandGet(params: APIBrandGetByIdParams): Promise<APIBrandGetByIdResult | null> {\n\t\tconst pathname = `/brands/${params.idOrSlug}` as const;\n\t\treturn this.#restRequest<APIBrandGetByIdResult>(pathname);\n\t}\n\n\tasync brandCreate(body: APIBrandCreateBody): Promise<APIBrandCreateResult> {\n\t\treturn this.#restRequest<APIBrandCreateResult>(\"/brands\", \"POST\", body);\n\t}\n\n\tasync brandUpdate(params: APIBrandGetByIdParams, body: APIBrandUpdateBody): Promise<APIBrandUpdateResult> {\n\t\tconst pathname = `/brands/${params.idOrSlug}` as const;\n\t\treturn this.#restRequest<APIBrandUpdateResult>(pathname, \"PATCH\", body);\n\t}\n\n\tasync brandDelete(params: APIBrandGetByIdParams): Promise<APIBrandDeleteResult> {\n\t\tconst pathname = `/brands/${params.idOrSlug}` as const;\n\t\treturn this.#restRequest<APIBrandDeleteResult>(pathname, \"DELETE\");\n\t}\n\n\tasync brandAssignProducts(\n\t\tparams: APIBrandGetByIdParams,\n\t\tbody: APIBrandAssignProductsBody,\n\t): Promise<APIBrandAssignProductsResult> {\n\t\tconst pathname = `/brands/${params.idOrSlug}/products` as const;\n\t\treturn this.#restRequest<APIBrandAssignProductsResult>(pathname, \"POST\", body);\n\t}\n\n\t// Order refunds --------------------------------------------------------\n\n\tasync orderRefundsBrowse(\n\t\tparams: APIOrderRefundsParams & APIOrderRefundsBrowseQueryParams,\n\t): Promise<APIOrderRefundsBrowseResult> {\n\t\tconst queryParams = new URLSearchParams();\n\t\tif (params.limit) queryParams.append(\"limit\", params.limit.toString());\n\t\tif (params.offset) queryParams.append(\"offset\", params.offset.toString());\n\t\tconst searchParams = queryParams.size ? `?${queryParams}` : \"\";\n\t\tconst pathname = `/orders/${params.id}/refunds${searchParams}` as const;\n\t\treturn this.#restRequest<APIOrderRefundsBrowseResult>(pathname);\n\t}\n\n\tasync orderRefundGet(params: APIOrderRefundGetParams): Promise<APIOrderRefundGetResult | null> {\n\t\tconst pathname = `/orders/${params.id}/refunds/${params.refundId}` as const;\n\t\treturn this.#restRequest<APIOrderRefundGetResult>(pathname);\n\t}\n\n\t// Product bulk ---------------------------------------------------------\n\n\tasync productBatch(body: APIProductBatchBody): Promise<APIProductBatchResult> {\n\t\treturn this.#restRequest<APIProductBatchResult>(\"/products/batch\", \"POST\", body);\n\t}\n\n\t// Cart -----------------------------------------------------------------\n\n\tasync cartDelete(params: { cartId: string }): Promise<APICartDeleteResult> {\n\t\tconst pathname = `/carts/${params.cartId}` as const;\n\t\treturn this.#restRequest<APICartDeleteResult>(pathname, \"DELETE\");\n\t}\n\n\tasync productBrowse(params: APIProductsBrowseQueryParams): Promise<APIProductsBrowseResult> {\n\t\tconst logger = this.#logger.getLogger(\"productBrowse\");\n\t\tlogger.debug(\"Browsing products with params:\", params);\n\n\t\tconst queryParams = new URLSearchParams();\n\t\tif (params.limit) queryParams.append(\"limit\", params.limit.toString());\n\t\tif (params.offset) queryParams.append(\"offset\", params.offset.toString());\n\t\tif (params.category) queryParams.append(\"category\", params.category);\n\t\tif (params.collection) queryParams.append(\"collection\", params.collection);\n\t\tif (params.brand) queryParams.append(\"brand\", params.brand);\n\t\tif (params.priceMin !== undefined) queryParams.append(\"priceMin\", params.priceMin.toString());\n\t\tif (params.priceMax !== undefined) queryParams.append(\"priceMax\", params.priceMax.toString());\n\t\tif (params.vts) queryParams.append(\"vts\", params.vts);\n\t\tif (params.query) queryParams.append(\"query\", params.query);\n\t\tif (params.active !== undefined) queryParams.append(\"active\", params.active.toString());\n\t\tif (params.orderBy) queryParams.append(\"orderBy\", params.orderBy);\n\t\tif (params.orderDirection) queryParams.append(\"orderDirection\", params.orderDirection);\n\n\t\tconst searchParams = queryParams.size ? `?${queryParams}` : \"\";\n\t\tconst pathname = `/products${searchParams}` as const;\n\t\tlogger.debug(\"Constructed pathname:\", pathname);\n\t\tconst result = await this.#restRequest<APIProductsBrowseResult>(pathname);\n\t\tlogger.debug(\"Received product browse result:\", { meta: result.meta });\n\t\treturn result;\n\t}\n\n\t/**\n\t * Available storefront filter facets for the store: price bounds, variant\n\t * types/values, and active categories, collections, and brands. Pair with\n\t * `productBrowse`'s `collection`, `brand`, `priceMin`/`priceMax`, and `vts`\n\t * params to build a filter UI.\n\t */\n\tasync productFilters(): Promise<APIProductFiltersResult> {\n\t\tconst result = await this.#restRequest<APIProductFiltersResult>(\"/products/filters\");\n\t\treturn result;\n\t}\n\n\tasync productGet(params: APIProductGetByIdParams): Promise<APIProductGetByIdResult | null> {\n\t\tconst pathname = `/products/${params.idOrSlug}` as const;\n\n\t\tconst result = await this.#restRequest<APIProductGetByIdResult>(pathname);\n\n\t\tif (!result) {\n\t\t\treturn null;\n\t\t}\n\n\t\treturn result;\n\t}\n\n\tasync orderBrowse(params: APIOrdersBrowseQueryParams): Promise<APIOrdersBrowseResult> {\n\t\tconst logger = this.#logger.getLogger(\"orderBrowse\");\n\t\tlogger.debug(\"Browsing orders with params:\", params);\n\n\t\tconst queryParams = new URLSearchParams();\n\n\t\tif (params.limit) queryParams.append(\"limit\", params.limit.toString());\n\t\tif (params.offset) queryParams.append(\"offset\", params.offset.toString());\n\n\t\tconst searchParams = queryParams.size ? `?${queryParams}` : \"\";\n\t\tconst pathname = `/orders${searchParams}` as const;\n\t\tlogger.debug(\"Constructed pathname:\", pathname);\n\t\tconst result = await this.#restRequest<APIOrdersBrowseResult>(pathname);\n\t\tlogger.debug(\"Received orders browse result:\", { meta: result.meta });\n\t\treturn result;\n\t}\n\n\tasync orderGet(params: APIOrderGetByIdParams): Promise<APIOrderGetByIdResult | null> {\n\t\tconst pathname = `/orders/${params.id}` as const;\n\n\t\tconst result = await this.#restRequest<APIOrderGetByIdResult>(pathname);\n\n\t\tif (!result) {\n\t\t\treturn null;\n\t\t}\n\n\t\treturn result;\n\t}\n\n\t// @todo\n\t// async cartAdd(params: APICartAddBody): Promise<APICartAddResult> {\n\t// \tconst body = {\n\t// \t\tvariantId: params.variantId,\n\t// \t\tcartId: params.cartId,\n\t// \t\tquantity: params.quantity,\n\t// \t\tsubscriptionId: params.subscriptionId,\n\t// \t};\n\n\t// \tconst result = await this.#restRequest<APICartCreateResult>(\"/carts\", \"PATCH\", body);\n\t// \treturn result;\n\t// }\n\n\tasync cartUpsert(body: APICartCreateBody): Promise<APICartCreateResult> {\n\t\tconst result = await this.#restRequest<APICartCreateResult>(\"/carts\", \"POST\", body);\n\t\treturn result;\n\t}\n\n\t/**\n\t * Add a configured bundle to the cart in one call. `selections` are the customer's per-group\n\t * choices; always-included (forced) items may be omitted — the server fills them in and\n\t * validates the rest against the bundle's groups. Omit `cartId` to start a new cart. The\n\t * returned cart prices the bundle line (componentTotal × (1 − discount)).\n\t */\n\tasync cartAddBundle(params: {\n\t\tbundleId: string;\n\t\tselections: NonNullable<APICartCreateBody[\"selections\"]>;\n\t\tcartId?: string;\n\t\tcurrency?: string;\n\t}): Promise<APICartCreateResult> {\n\t\tconst body: APICartCreateBody = {\n\t\t\tbundleId: params.bundleId,\n\t\t\tselections: params.selections,\n\t\t\t...(params.cartId ? { cartId: params.cartId } : {}),\n\t\t\t...(params.currency ? { currency: params.currency } : {}),\n\t\t};\n\t\tconst result = await this.#restRequest<APICartCreateResult>(\"/carts\", \"POST\", body);\n\t\treturn result;\n\t}\n\n\tasync cartRemoveItem(params: { cartId: string; variantId: string }): Promise<APICartGetResult> {\n\t\tconst pathname = `/carts/${params.cartId}/line-items/${params.variantId}` as const;\n\t\treturn this.#restRequest<APICartGetResult>(pathname, \"DELETE\");\n\t}\n\n\tasync cartGet(params: { cartId: string }): Promise<APICartGetResult | null> {\n\t\tconst pathname = `/carts/${params.cartId}` as const;\n\t\tconst result = await this.#restRequest<APICartGetResult>(pathname);\n\t\treturn result;\n\t}\n\n\t/**\n\t * Validate and attach a coupon to the cart. Failures surface as an ApiError with\n\t * status 422 and a machine-readable `reason` (couponNotFound, couponHasExpired,\n\t * couponMaxUsesReached, couponIsNotValidYet, couponMinProductCountNotMet,\n\t * couponMaxProductCountExceeded, couponIsNotApplicable). Returns the updated cart.\n\t */\n\tasync cartCouponApply(params: { cartId: string; code: string }): Promise<APICartCouponApplyResult> {\n\t\tconst pathname = `/carts/${params.cartId}/coupon` as const;\n\t\treturn this.#restRequest<APICartCouponApplyResult>(pathname, \"POST\", { code: params.code });\n\t}\n\n\t/** Detach the applied coupon from the cart, if any. */\n\tasync cartCouponRemove(params: { cartId: string }): Promise<APICartCouponRemoveResult> {\n\t\tconst pathname = `/carts/${params.cartId}/coupon` as const;\n\t\treturn this.#restRequest<APICartCouponRemoveResult>(pathname, \"DELETE\");\n\t}\n\n\tasync couponBrowse(params: APICouponsBrowseQueryParams = {}): Promise<APICouponsBrowseResult> {\n\t\tconst queryParams = new URLSearchParams();\n\t\tif (params.limit) queryParams.append(\"limit\", params.limit.toString());\n\t\tif (params.offset) queryParams.append(\"offset\", params.offset.toString());\n\t\tif (params.query) queryParams.append(\"query\", params.query);\n\n\t\tconst searchParams = queryParams.size ? `?${queryParams}` : \"\";\n\t\tconst pathname = `/coupons${searchParams}` as const;\n\n\t\treturn this.#restRequest<APICouponsBrowseResult>(pathname);\n\t}\n\n\t/** Look up a coupon by its UUID or its code. Resolves to `null` when not found. */\n\tasync couponGet(params: APICouponGetByIdParams): Promise<APICouponGetByIdResult | null> {\n\t\tconst pathname = `/coupons/${params.idOrCode}` as const;\n\t\treturn this.#restRequestNullable<APICouponGetByIdResult>(pathname);\n\t}\n\n\tasync couponCreate(body: APICouponCreateBody): Promise<APICouponCreateResult> {\n\t\treturn this.#restRequest<APICouponCreateResult>(\"/coupons\", \"POST\", body);\n\t}\n\n\tasync couponUpdate(\n\t\tparams: APICouponGetByIdParams,\n\t\tbody: APICouponUpdateBody,\n\t): Promise<APICouponUpdateResult> {\n\t\tconst pathname = `/coupons/${params.idOrCode}` as const;\n\t\treturn this.#restRequest<APICouponUpdateResult>(pathname, \"PATCH\", body);\n\t}\n\n\tasync couponDelete(params: APICouponGetByIdParams): Promise<APICouponDeleteResult> {\n\t\tconst pathname = `/coupons/${params.idOrCode}` as const;\n\t\treturn this.#restRequest<APICouponDeleteResult>(pathname, \"DELETE\");\n\t}\n\n\t/** List the store's support cases (merchant ↔ YNS support), newest activity first. */\n\tasync supportCaseBrowse(\n\t\tparams: APISupportCasesBrowseQueryParams = {},\n\t): Promise<APISupportCasesBrowseResult> {\n\t\tconst queryParams = new URLSearchParams();\n\t\tif (params.limit) queryParams.append(\"limit\", params.limit.toString());\n\t\tif (params.offset) queryParams.append(\"offset\", params.offset.toString());\n\t\tif (params.query) queryParams.append(\"query\", params.query);\n\t\tif (params.status) queryParams.append(\"status\", params.status);\n\t\tif (params.severity) queryParams.append(\"severity\", params.severity);\n\n\t\tconst searchParams = queryParams.size ? `?${queryParams}` : \"\";\n\t\tconst pathname = `/support-cases${searchParams}` as const;\n\n\t\treturn this.#restRequest<APISupportCasesBrowseResult>(pathname);\n\t}\n\n\t/**\n\t * Look up a case with its message thread by UUID or case number (\"123\" or \"000123\").\n\t * Resolves to `null` when not found. Internal YNS notes are never included.\n\t */\n\tasync supportCaseGet(params: APISupportCaseGetParams): Promise<APISupportCaseGetResult | null> {\n\t\tconst pathname = `/support-cases/${params.idOrNumber}` as const;\n\t\treturn this.#restRequestNullable<APISupportCaseGetResult>(pathname);\n\t}\n\n\t/** Open a support case with the YNS team. Omit `subject` to have one generated from the description. */\n\tasync supportCaseCreate(body: APISupportCaseCreateBody): Promise<APISupportCaseCreateResult> {\n\t\treturn this.#restRequest<APISupportCaseCreateResult>(\"/support-cases\", \"POST\", body);\n\t}\n\n\t/** Close (`status: \"closed\"`) or reopen (`status: \"open\"`) a case. */\n\tasync supportCaseUpdate(\n\t\tparams: APISupportCaseGetParams,\n\t\tbody: APISupportCaseUpdateBody,\n\t): Promise<APISupportCaseUpdateResult> {\n\t\tconst pathname = `/support-cases/${params.idOrNumber}` as const;\n\t\treturn this.#restRequest<APISupportCaseUpdateResult>(pathname, \"PATCH\", body);\n\t}\n\n\t/** Add a merchant-side reply to the case thread; replying reopens a closed or answered case. */\n\tasync supportCaseReply(\n\t\tparams: APISupportCaseGetParams,\n\t\tbody: APISupportCaseMessageCreateBody,\n\t): Promise<APISupportCaseMessageCreateResult> {\n\t\tconst pathname = `/support-cases/${params.idOrNumber}/messages` as const;\n\t\treturn this.#restRequest<APISupportCaseMessageCreateResult>(pathname, \"POST\", body);\n\t}\n\n\tasync collectionGet(params: APICollectionGetByIdParams): Promise<APICollectionGetByIdResult | null> {\n\t\tconst pathname = `/collections/${params.idOrSlug}` as const;\n\n\t\tconst result = await this.#restRequest<APICollectionGetByIdResult>(pathname);\n\t\treturn result;\n\t}\n\n\tasync collectionBrowse(params: APICollectionsBrowseQueryParams): Promise<APICollectionsBrowseResult> {\n\t\tconst queryParams = new URLSearchParams();\n\t\tif (params.limit) queryParams.append(\"limit\", params.limit.toString());\n\t\tif (params.offset) queryParams.append(\"offset\", params.offset.toString());\n\t\tif (params.query) queryParams.append(\"query\", params.query);\n\t\tif (params.active !== undefined) queryParams.append(\"active\", params.active.toString());\n\t\tif (params.group) queryParams.append(\"group\", params.group);\n\n\t\tconst searchParams = queryParams.size ? `?${queryParams}` : \"\";\n\t\tconst pathname = `/collections${searchParams}` as const;\n\n\t\tconst result = await this.#restRequest<APICollectionsBrowseResult>(pathname);\n\t\treturn result;\n\t}\n\n\tasync collectionCreate(body: APICollectionCreateBody): Promise<APICollectionCreateResult> {\n\t\treturn this.#restRequest<APICollectionCreateResult>(\"/collections\", \"POST\", body);\n\t}\n\n\tasync collectionUpdate(\n\t\tparams: APICollectionGetByIdParams,\n\t\tbody: APICollectionUpdateBody,\n\t): Promise<APICollectionUpdateResult> {\n\t\tconst pathname = `/collections/${params.idOrSlug}` as const;\n\t\treturn this.#restRequest<APICollectionUpdateResult>(pathname, \"PATCH\", body);\n\t}\n\n\tasync collectionDelete(params: APICollectionGetByIdParams): Promise<APICollectionDeleteResult> {\n\t\tconst pathname = `/collections/${params.idOrSlug}` as const;\n\t\treturn this.#restRequest<APICollectionDeleteResult>(pathname, \"DELETE\");\n\t}\n\n\tasync collectionImportMemberships(\n\t\tbody: APICollectionImportMembershipsBody,\n\t): Promise<APICollectionImportMembershipsResult> {\n\t\tconst formData = new FormData();\n\t\tformData.append(\"file\", body.file);\n\t\treturn this.#multipartRequest<APICollectionImportMembershipsResult>(\n\t\t\t\"/collections/import-memberships\",\n\t\t\tformData,\n\t\t);\n\t}\n\n\tasync categoryGet(params: APICategoryGetByIdParams): Promise<APICategoryGetByIdResult | null> {\n\t\tconst pathname = `/categories/${params.idOrSlug}` as const;\n\n\t\tconst result = await this.#restRequest<APICategoryGetByIdResult>(pathname);\n\t\treturn result;\n\t}\n\n\tasync categoriesBrowse(params: APICategoriesBrowseQueryParams): Promise<APICategoriesBrowseResult> {\n\t\tconst queryParams = new URLSearchParams();\n\t\tif (params.limit) queryParams.append(\"limit\", params.limit.toString());\n\t\tif (params.offset) queryParams.append(\"offset\", params.offset.toString());\n\t\tif (params.query) queryParams.append(\"query\", params.query);\n\t\tif (params.active !== undefined) queryParams.append(\"active\", params.active.toString());\n\n\t\tconst searchParams = queryParams.size ? `?${queryParams}` : \"\";\n\t\tconst pathname = `/categories${searchParams}` as const;\n\n\t\tconst result = await this.#restRequest<APICategoriesBrowseResult>(pathname);\n\t\treturn result;\n\t}\n\n\t// ============================================\n\t// Posts\n\t// ============================================\n\n\tasync postBrowse(params: APIPostsBrowseQueryParams = {}): Promise<APIPostsBrowseResult> {\n\t\tconst queryParams = new URLSearchParams();\n\t\tif (params.limit) queryParams.append(\"limit\", params.limit.toString());\n\t\tif (params.offset) queryParams.append(\"offset\", params.offset.toString());\n\t\tif (params.query) queryParams.append(\"query\", params.query);\n\t\tif (params.active !== undefined) queryParams.append(\"active\", params.active.toString());\n\t\tif (params.tag) queryParams.append(\"tag\", params.tag);\n\t\tif (params.categoryId) queryParams.append(\"categoryId\", params.categoryId);\n\n\t\tconst searchParams = queryParams.size ? `?${queryParams}` : \"\";\n\t\tconst pathname = `/posts${searchParams}` as const;\n\n\t\treturn this.#restRequest<APIPostsBrowseResult>(pathname);\n\t}\n\n\tasync postGet(params: APIPostGetByIdParams): Promise<APIPostGetByIdResult | null> {\n\t\tconst pathname = `/posts/${params.idOrSlug}` as const;\n\t\treturn this.#restRequest<APIPostGetByIdResult>(pathname);\n\t}\n\n\tasync postCreate(body: APIPostCreateBody): Promise<APIPostCreateResult> {\n\t\treturn this.#restRequest<APIPostCreateResult>(\"/posts\", \"POST\", body);\n\t}\n\n\tasync postUpdate(params: APIPostGetByIdParams, body: APIPostUpdateBody): Promise<APIPostUpdateResult> {\n\t\tconst pathname = `/posts/${params.idOrSlug}` as const;\n\t\treturn this.#restRequest<APIPostUpdateResult>(pathname, \"PATCH\", body);\n\t}\n\n\tasync postDelete(params: APIPostGetByIdParams): Promise<APIPostDeleteResult> {\n\t\tconst pathname = `/posts/${params.idOrSlug}` as const;\n\t\treturn this.#restRequest<APIPostDeleteResult>(pathname, \"DELETE\");\n\t}\n\n\tasync postCommentsBrowse(\n\t\tparams: APIPostGetByIdParams,\n\t\tqueryParams: APIPostCommentsBrowseQueryParams = {},\n\t): Promise<APIPostCommentsBrowseResult> {\n\t\tconst urlParams = new URLSearchParams();\n\t\tif (queryParams.limit) urlParams.append(\"limit\", queryParams.limit.toString());\n\t\tif (queryParams.offset) urlParams.append(\"offset\", queryParams.offset.toString());\n\n\t\tconst searchParams = urlParams.size ? `?${urlParams}` : \"\";\n\t\tconst pathname = `/posts/${params.idOrSlug}/comments${searchParams}` as const;\n\n\t\treturn this.#restRequest<APIPostCommentsBrowseResult>(pathname);\n\t}\n\n\tasync postCommentCreate(\n\t\tparams: APIPostGetByIdParams,\n\t\tbody: APIPostCommentCreateBody,\n\t): Promise<APIPostCommentCreateResult> {\n\t\tconst pathname = `/posts/${params.idOrSlug}/comments` as const;\n\t\treturn this.#restRequest<APIPostCommentCreateResult>(pathname, \"POST\", body);\n\t}\n\n\t// ============================================\n\t// Blog Categories\n\t// ============================================\n\n\tasync blogCategoryBrowse(\n\t\tparams: APIBlogCategoriesBrowseQueryParams = {},\n\t): Promise<APIBlogCategoriesBrowseResult> {\n\t\tconst queryParams = new URLSearchParams();\n\t\tif (params.limit) queryParams.append(\"limit\", params.limit.toString());\n\t\tif (params.offset) queryParams.append(\"offset\", params.offset.toString());\n\t\tif (params.query) queryParams.append(\"query\", params.query);\n\t\tif (params.active !== undefined) queryParams.append(\"active\", params.active.toString());\n\n\t\tconst searchParams = queryParams.size ? `?${queryParams}` : \"\";\n\t\tconst pathname = `/blog-categories${searchParams}` as const;\n\n\t\treturn this.#restRequest<APIBlogCategoriesBrowseResult>(pathname);\n\t}\n\n\tasync blogCategoryGet(params: APIBlogCategoryGetByIdParams): Promise<APIBlogCategoryGetByIdResult | null> {\n\t\tconst pathname = `/blog-categories/${params.idOrSlug}` as const;\n\t\treturn this.#restRequest<APIBlogCategoryGetByIdResult>(pathname);\n\t}\n\n\tasync blogCategoryCreate(body: APIBlogCategoryCreateBody): Promise<APIBlogCategoryCreateResult> {\n\t\treturn this.#restRequest<APIBlogCategoryCreateResult>(\"/blog-categories\", \"POST\", body);\n\t}\n\n\tasync blogCategoryUpdate(\n\t\tparams: APIBlogCategoryGetByIdParams,\n\t\tbody: APIBlogCategoryUpdateBody,\n\t): Promise<APIBlogCategoryUpdateResult> {\n\t\tconst pathname = `/blog-categories/${params.idOrSlug}` as const;\n\t\treturn this.#restRequest<APIBlogCategoryUpdateResult>(pathname, \"PATCH\", body);\n\t}\n\n\tasync blogCategoryDelete(params: APIBlogCategoryGetByIdParams): Promise<APIBlogCategoryDeleteResult> {\n\t\tconst pathname = `/blog-categories/${params.idOrSlug}` as const;\n\t\treturn this.#restRequest<APIBlogCategoryDeleteResult>(pathname, \"DELETE\");\n\t}\n\n\t// ============================================\n\t// Customers\n\t// ============================================\n\n\tasync customerBrowse(params: APICustomersBrowseQueryParams = {}): Promise<APICustomersBrowseResult> {\n\t\tconst queryParams = new URLSearchParams();\n\t\tif (params.limit) queryParams.append(\"limit\", params.limit.toString());\n\t\tif (params.offset) queryParams.append(\"offset\", params.offset.toString());\n\t\tif (params.search) queryParams.append(\"search\", params.search);\n\n\t\tconst searchParams = queryParams.size ? `?${queryParams}` : \"\";\n\t\tconst pathname = `/customers${searchParams}` as const;\n\n\t\treturn this.#restRequest<APICustomersBrowseResult>(pathname);\n\t}\n\n\tasync customerGet(params: APICustomerGetByIdParams): Promise<APICustomerGetByIdResult | null> {\n\t\tconst pathname = `/customers/${params.id}` as const;\n\t\treturn this.#restRequest<APICustomerGetByIdResult>(pathname);\n\t}\n\n\tasync customerUpdate(\n\t\tparams: APICustomerGetByIdParams,\n\t\tbody: APICustomerUpdateBody,\n\t): Promise<APICustomerUpdateResult> {\n\t\tconst pathname = `/customers/${params.id}` as const;\n\t\treturn this.#restRequest<APICustomerUpdateResult>(pathname, \"PATCH\", body);\n\t}\n\n\tasync customerAddressCreate(\n\t\tparams: APICustomerGetByIdParams,\n\t\tbody: APICustomerAddressCreateBody,\n\t): Promise<APICustomerAddressCreateResult> {\n\t\tconst pathname = `/customers/${params.id}/addresses` as const;\n\t\treturn this.#restRequest<APICustomerAddressCreateResult>(pathname, \"POST\", body);\n\t}\n\n\tasync customerAddressDelete(params: { customerId: string; addressId: string }): Promise<void> {\n\t\tconst pathname = `/customers/${params.customerId}/addresses/${params.addressId}` as const;\n\t\tawait this.#restRequest<unknown>(pathname, \"DELETE\");\n\t}\n\n\tasync customerOrdersBrowse(\n\t\tparams: APICustomerGetByIdParams,\n\t\tqueryParams: APICustomerOrdersBrowseQueryParams = {},\n\t): Promise<APICustomerOrdersBrowseResult> {\n\t\tconst urlParams = new URLSearchParams();\n\t\tif (queryParams.limit) urlParams.append(\"limit\", queryParams.limit.toString());\n\t\tif (queryParams.offset) urlParams.append(\"offset\", queryParams.offset.toString());\n\n\t\tconst searchParams = urlParams.size ? `?${urlParams}` : \"\";\n\t\tconst pathname = `/customers/${params.id}/orders${searchParams}` as const;\n\n\t\treturn this.#restRequest<APICustomerOrdersBrowseResult>(pathname);\n\t}\n\n\t// ============================================\n\t// Inventory\n\t// ============================================\n\n\tasync inventoryBrowse(params: APIInventoryBrowseQueryParams = {}): Promise<APIInventoryBrowseResult> {\n\t\tconst queryParams = new URLSearchParams();\n\t\tif (params.limit) queryParams.append(\"limit\", params.limit.toString());\n\t\tif (params.cursor) queryParams.append(\"cursor\", params.cursor);\n\t\tif (params.lowStock !== undefined) queryParams.append(\"lowStock\", params.lowStock.toString());\n\n\t\tconst searchParams = queryParams.size ? `?${queryParams}` : \"\";\n\t\tconst pathname = `/inventory${searchParams}` as const;\n\n\t\treturn this.#restRequest<APIInventoryBrowseResult>(pathname);\n\t}\n\n\tasync inventoryAdjust(sku: string, body: APIInventoryAdjustBody): Promise<APIInventoryAdjustResult> {\n\t\tconst pathname = `/inventory/${encodeURIComponent(sku)}/adjust` as const;\n\t\treturn this.#restRequest<APIInventoryAdjustResult>(pathname, \"POST\", body);\n\t}\n\n\t// ============================================\n\t// Variants\n\t// ============================================\n\n\tasync variantGet(params: APIVariantGetByIdParams): Promise<APIVariantGetByIdResult | null> {\n\t\tconst pathname = `/variants/${params.idOrSku}` as const;\n\t\treturn this.#restRequest<APIVariantGetByIdResult>(pathname);\n\t}\n\n\tasync variantUpdate(\n\t\tparams: APIVariantGetByIdParams,\n\t\tbody: APIVariantUpdateBody,\n\t): Promise<APIVariantUpdateResult> {\n\t\tconst pathname = `/variants/${params.idOrSku}` as const;\n\t\treturn this.#restRequest<APIVariantUpdateResult>(pathname, \"PATCH\", body);\n\t}\n\n\tasync variantDelete(params: APIVariantGetByIdParams): Promise<void> {\n\t\tconst pathname = `/variants/${params.idOrSku}` as const;\n\t\tawait this.#restRequest<unknown>(pathname, \"DELETE\");\n\t}\n\n\tasync variantCreate(productId: string, body: APIVariantCreateBody): Promise<APIVariantCreateResult> {\n\t\tconst pathname = `/products/${productId}/variants` as const;\n\t\treturn this.#restRequest<APIVariantCreateResult>(pathname, \"POST\", body);\n\t}\n\n\t// ============================================\n\t// Subscribers\n\t// ============================================\n\n\tasync subscriberCreate(body: APISubscriberCreateBody): Promise<APISubscriberCreateResult> {\n\t\treturn this.#restRequest<APISubscriberCreateResult>(\"/subscribers\", \"POST\", body);\n\t}\n\n\tasync subscriberDelete(email: string): Promise<APISubscriberDeleteResult> {\n\t\tconst pathname = `/subscribers?email=${encodeURIComponent(email)}` as const;\n\t\treturn this.#restRequest<APISubscriberDeleteResult>(pathname, \"DELETE\");\n\t}\n\n\t// ============================================\n\t// Contact Messages\n\t// ============================================\n\n\tasync contactMessageCreate(body: APIContactMessageCreateBody): Promise<APIContactMessageCreateResult> {\n\t\treturn this.#restRequest<APIContactMessageCreateResult>(\"/contact-messages\", \"POST\", body);\n\t}\n\n\t// ============================================\n\t// Product mutations\n\t// ============================================\n\n\tasync productCreate(body: APIProductCreateBody): Promise<APIProductCreateResult> {\n\t\treturn this.#restRequest<APIProductCreateResult>(\"/products\", \"POST\", body);\n\t}\n\n\tasync productUpdate(\n\t\tparams: APIProductGetByIdParams,\n\t\tbody: APIProductUpdateBody,\n\t): Promise<APIProductUpdateResult> {\n\t\tconst pathname = `/products/${params.idOrSlug}` as const;\n\t\treturn this.#restRequest<APIProductUpdateResult>(pathname, \"PATCH\", body);\n\t}\n\n\tasync productDelete(params: APIProductGetByIdParams): Promise<APIProductDeleteResult> {\n\t\tconst pathname = `/products/${params.idOrSlug}` as const;\n\t\treturn this.#restRequest<APIProductDeleteResult>(pathname, \"DELETE\");\n\t}\n\n\t// ============================================\n\t// Product Reviews\n\t// ============================================\n\n\tasync productReviewsBrowse(\n\t\tparams: APIProductGetByIdParams,\n\t\tqueryParams: APIProductReviewsBrowseQueryParams = {},\n\t): Promise<APIProductReviewsBrowseResult> {\n\t\tconst urlParams = new URLSearchParams();\n\t\tif (queryParams.limit) urlParams.append(\"limit\", queryParams.limit.toString());\n\t\tif (queryParams.offset) urlParams.append(\"offset\", queryParams.offset.toString());\n\n\t\tconst searchParams = urlParams.size ? `?${urlParams}` : \"\";\n\t\tconst pathname = `/products/${params.idOrSlug}/reviews${searchParams}` as const;\n\n\t\treturn this.#restRequest<APIProductReviewsBrowseResult>(pathname);\n\t}\n\n\tasync productReviewCreate(\n\t\tparams: APIProductGetByIdParams,\n\t\tbody: APIProductReviewCreateBody,\n\t): Promise<APIProductReviewCreateResult> {\n\t\tconst pathname = `/products/${params.idOrSlug}/reviews` as const;\n\t\treturn this.#restRequest<APIProductReviewCreateResult>(pathname, \"POST\", body);\n\t}\n\n\t// ============================================\n\t// Events (products flagged `flags.event` with a single non-shippable ticket variant)\n\t// ============================================\n\n\tasync eventBrowse(params: APIEventsBrowseQueryParams = {}): Promise<APIEventsBrowseResult> {\n\t\tconst logger = this.#logger.getLogger(\"eventBrowse\");\n\t\tconst queryParams = new URLSearchParams();\n\t\tif (params.offset !== undefined) queryParams.append(\"offset\", params.offset.toString());\n\t\tif (params.limit !== undefined) queryParams.append(\"limit\", params.limit.toString());\n\n\t\tconst searchParams = queryParams.size ? `?${queryParams}` : \"\";\n\t\tconst pathname = `/events${searchParams}` as const;\n\t\tlogger.debug(\"Browsing events:\", pathname);\n\t\treturn this.#restRequest<APIEventsBrowseResult>(pathname);\n\t}\n\n\tasync eventGet(params: APIEventGetByIdParams): Promise<APIEventGetByIdResult> {\n\t\tconst pathname = `/events/${params.idOrSlug}` as const;\n\t\treturn this.#restRequest<APIEventGetByIdResult>(pathname);\n\t}\n\n\tasync eventCreate(body: APIEventCreateBody): Promise<APIEventCreateResult> {\n\t\treturn this.#restRequest<APIEventCreateResult>(\"/events\", \"POST\", body);\n\t}\n\n\tasync eventUpdate(params: APIEventGetByIdParams, body: APIEventUpdateBody): Promise<APIEventUpdateResult> {\n\t\tconst pathname = `/events/${params.idOrSlug}` as const;\n\t\treturn this.#restRequest<APIEventUpdateResult>(pathname, \"PATCH\", body);\n\t}\n\n\tasync eventAttendeesBrowse(params: APIEventGetByIdParams): Promise<APIEventAttendeesBrowseResult> {\n\t\tconst pathname = `/events/${params.idOrSlug}/attendees` as const;\n\t\treturn this.#restRequest<APIEventAttendeesBrowseResult>(pathname);\n\t}\n\n\t// ============================================\n\t// Tickets (no-login buyer/attendee access to purchased event tickets)\n\t// ============================================\n\n\t/**\n\t * Buyer ticket lookup: the order's 6-character access code plus the purchase email.\n\t * Resolves to `null` on mismatch — the API answers a uniform 404 for an unknown code,\n\t * an email that doesn't match, or an order without tickets.\n\t */\n\tasync ticketsGet(params: { code: string; email: string }): Promise<APITicketsGetResult | null> {\n\t\tconst logger = this.#logger.getLogger(\"ticketsGet\");\n\t\tconst queryParams = new URLSearchParams({ email: params.email });\n\t\tconst pathname = `/tickets/${encodeURIComponent(params.code)}?${queryParams}` as const;\n\t\tlogger.debug(\"Fetching ticket bundle:\", pathname);\n\t\treturn this.#restRequestNullable<APITicketsGetResult>(pathname);\n\t}\n\n\t/**\n\t * Buyer bulk-edit of attendee names/emails. The body carries the purchase email; seat\n\t * tokens not belonging to the order are silently ignored. Throws on code/email mismatch\n\t * (404) or when the order is cancelled/refunded (409).\n\t */\n\tasync ticketsUpdate(params: { code: string }, body: APITicketsUpdateBody): Promise<APITicketsUpdateResult> {\n\t\tconst pathname = `/tickets/${encodeURIComponent(params.code)}` as const;\n\t\treturn this.#restRequest<APITicketsUpdateResult>(pathname, \"PATCH\", body);\n\t}\n\n\t/**\n\t * View-only attendee ticket by per-seat token (the capability embedded in the attendee\n\t * link/QR). Resolves to `null` for an unknown token. Attendee details can only be edited\n\t * by the buyer via {@link ticketsUpdate} — attendee links must not escalate.\n\t */\n\tasync ticketAttendeeGet(params: { token: string }): Promise<APITicketAttendeeGetResult | null> {\n\t\tconst pathname = `/tickets/attendee/${encodeURIComponent(params.token)}` as const;\n\t\treturn this.#restRequestNullable<APITicketAttendeeGetResult>(pathname);\n\t}\n\n\t// ============================================\n\t// Category mutations\n\t// ============================================\n\n\tasync categoryCreate(body: APICategoryCreateBody): Promise<APICategoryCreateResult> {\n\t\treturn this.#restRequest<APICategoryCreateResult>(\"/categories\", \"POST\", body);\n\t}\n\n\tasync categoryUpdate(\n\t\tparams: APICategoryGetByIdParams,\n\t\tbody: APICategoryUpdateBody,\n\t): Promise<APICategoryUpdateResult> {\n\t\tconst pathname = `/categories/${params.idOrSlug}` as const;\n\t\treturn this.#restRequest<APICategoryUpdateResult>(pathname, \"PATCH\", body);\n\t}\n\n\tasync categoryDelete(params: APICategoryGetByIdParams): Promise<APICategoryDeleteResult> {\n\t\tconst pathname = `/categories/${params.idOrSlug}` as const;\n\t\treturn this.#restRequest<APICategoryDeleteResult>(pathname, \"DELETE\");\n\t}\n\n\t// ============================================\n\t// Order mutations\n\t// ============================================\n\n\tasync orderUpdate(params: APIOrderGetByIdParams, body: APIOrderUpdateBody): Promise<APIOrderUpdateResult> {\n\t\tconst pathname = `/orders/${params.id}` as const;\n\t\treturn this.#restRequest<APIOrderUpdateResult>(pathname, \"PATCH\", body);\n\t}\n\n\t// ============================================\n\t// Legal Pages\n\t// ============================================\n\n\tasync legalPageBrowse(\n\t\tqueryParams: APILegalPagesBrowseQueryParams = {},\n\t): Promise<APILegalPagesBrowseResult> {\n\t\treturn this.request<APILegalPagesBrowseResult>(\"/legal-pages\", {\n\t\t\tquery: queryParams,\n\t\t});\n\t}\n\n\tasync legalPageGet(\n\t\tkey: string,\n\t\tqueryParams: APILegalPageGetByPathQueryParams = {},\n\t): Promise<APILegalPageGetByPathResult> {\n\t\tconst normalized = key.startsWith(\"/\") ? key.slice(1) : key;\n\t\tconst pathname = `/legal-pages/${encodeURIComponent(normalized)}` as const;\n\t\treturn this.request<APILegalPageGetByPathResult>(pathname, {\n\t\t\tquery: queryParams,\n\t\t});\n\t}\n\n\tasync legalPageCreate(\n\t\tbody: APILegalPageCreateBody,\n\t\tqueryParams: APILegalPageCreateQueryParams = {},\n\t): Promise<APILegalPageCreateResult> {\n\t\treturn this.request<APILegalPageCreateResult, APILegalPageCreateBody>(\"/legal-pages\", {\n\t\t\tmethod: \"POST\",\n\t\t\tbody,\n\t\t\tquery: queryParams,\n\t\t});\n\t}\n\n\tasync legalPageUpdate(\n\t\tkey: string,\n\t\tbody: APILegalPageUpdateBody,\n\t\tqueryParams: APILegalPageUpdateQueryParams = {},\n\t): Promise<APILegalPageUpdateResult> {\n\t\tconst normalized = key.startsWith(\"/\") ? key.slice(1) : key;\n\t\tconst pathname = `/legal-pages/${encodeURIComponent(normalized)}` as const;\n\t\treturn this.request<APILegalPageUpdateResult, APILegalPageUpdateBody>(pathname, {\n\t\t\tmethod: \"PATCH\",\n\t\t\tbody,\n\t\t\tquery: queryParams,\n\t\t});\n\t}\n\n\tasync search(params: APISearchQueryParams): Promise<APISearchResult> {\n\t\treturn this.request<APISearchResult>(\"/search\", {\n\t\t\tquery: params,\n\t\t});\n\t}\n\n\t// ============================================\n\t// Instaview\n\t// ============================================\n\n\tasync instaviewImagesBrowse(\n\t\tparams: APIInstaviewImagesBrowseParams,\n\t\tqueryParams: APIInstaviewImagesBrowseQueryParams = {},\n\t): Promise<APIInstaviewImagesBrowseResult> {\n\t\tconst urlParams = new URLSearchParams();\n\t\tif (queryParams.limit) urlParams.append(\"limit\", queryParams.limit.toString());\n\t\tif (queryParams.cursor) urlParams.append(\"cursor\", queryParams.cursor);\n\n\t\tconst searchParams = urlParams.size ? `?${urlParams}` : \"\";\n\t\tconst pathname = `/instaview/accounts/${params.handle}/images${searchParams}` as const;\n\n\t\treturn this.#restRequest<APIInstaviewImagesBrowseResult>(pathname);\n\t}\n\n\t/**\n\t * Make a raw API request to any endpoint.\n\t * Use this for new API features not yet supported by typed methods.\n\t *\n\t * @example\n\t * // GET request (default method)\n\t * const webhooks = await provider.request<Webhook[]>('/webhooks');\n\t *\n\t * // POST with typed body\n\t * const webhook = await provider.request<Webhook, CreateWebhookBody>('/webhooks', {\n\t * method: 'POST',\n\t * body: { url: 'https://...' }\n\t * });\n\t *\n\t * // GET with query parameters\n\t * const products = await provider.request<Product[]>('/products', {\n\t * query: { limit: 10, category: 'shoes' }\n\t * });\n\t *\n\t * // Path parameters via template literals\n\t * const product = await provider.request<Product>(`/products/${id}`);\n\t */\n\tasync request<TResponse = unknown, TBody = unknown>(\n\t\tpathname: `/${string}`,\n\t\toptions?: {\n\t\t\tmethod?: \"GET\" | \"POST\" | \"PATCH\" | \"DELETE\";\n\t\t\tbody?: TBody;\n\t\t\tquery?: Record<string, string | number | boolean | null | undefined>;\n\t\t},\n\t) {\n\t\tconst queryEntries = options?.query\n\t\t\t? Object.entries(options.query).filter((entry): entry is [string, string | number | boolean] => {\n\t\t\t\t\tconst [, value] = entry;\n\t\t\t\t\treturn value !== null && value !== undefined;\n\t\t\t\t})\n\t\t\t: [];\n\t\tconst queryString =\n\t\t\tqueryEntries.length > 0 ? `?${new URLSearchParams(queryEntries.map(([k, v]) => [k, String(v)]))}` : \"\";\n\n\t\treturn this.#restRequest<TResponse>(`${pathname}${queryString}`, options?.method ?? \"GET\", options?.body);\n\t}\n}\n","import { YNSProvider } from \"./providers/yns\";\nimport type { CommerceConfig } from \"./types\";\n\nexport function Commerce(config: CommerceConfig = {}): YNSProvider {\n\treturn new YNSProvider(config);\n}\n"],"mappings":"4BAAA,IAAMA,EAAc,QAAQ,IAAI,YAEnBC,EAAM,CAClB,YAAAD,CACD,ECYA,IAAME,EAAW,CAChB,MAAO,EACP,IAAK,EACL,KAAM,EACN,MAAO,CACR,EAGMC,EAAe,QAAQ,IAAI,uBAAyB,MACpDC,EAAgBF,EAASC,CAAW,EAEpCE,EAAQ,UACRC,EAAO,WACPC,EAAQ,WACRC,EAAS,WACTC,EAAM,WAENC,EAAO,eACPC,EAAQ,YACRC,EAAK,eACLC,EAAO,eACPC,EAAQ,SAERC,EAAc,GAAGL,CAAI,IACrBM,EAAe,GAAGV,CAAI,GAAGK,CAAK,GAAGN,CAAK,IACtCY,EAAY,GAAGV,CAAK,GAAGK,CAAE,GAAGP,CAAK,IACjCa,EAAc,GAAGV,CAAM,GAAGK,CAAI,GAAGR,CAAK,IACtCc,EAAe,GAAGV,CAAG,GAAGK,CAAK,GAAGT,CAAK,IAE9Be,EAAaC,GAAwB,CACjD,IAAMC,EAASD,EAAa,IAAIA,CAAU,KAAO,GACjD,MAAO,CACN,UAAUE,EAAuB,CAChC,OAAOH,EAAU,CAACC,EAAYE,CAAa,EAAE,OAAO,OAAO,EAAE,KAAK,KAAK,CAAC,CACzE,EACA,KAAKC,EAAe,CACfpB,EAAgBF,EAAS,OAC7B,QAAQ,KAAK,CAACa,EAAaO,EAAQE,CAAK,EAAE,OAAO,OAAO,EAAE,KAAK,GAAG,CAAC,CACpE,EACA,QAAQA,EAAe,CAClBpB,EAAgBF,EAAS,OAC7B,QAAQ,QAAQ,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ASO,EAASC,EAAyB,CAAC,EAAgB,CAClE,OAAO,IAAIC,EAAYD,CAAM,CAC9B","names":["YNS_API_KEY","env","LogLevel","strLogLevel","valueLogLevel","RESET","BLUE","GREEN","YELLOW","RED","TIME","DEBUG","OK","WARN","ERROR","PREFIX_TIME","PREFIX_DEBUG","PREFIX_OK","PREFIX_WARN","PREFIX_ERROR","getLogger","groupLabel","PREFIX","subGroupLabel","label","args","item","options","logger","YNSProvider","#config","#logger","getLogger","config","token","env","isStaging","endpoint","#restRequest","pathname","method","body","response","#fetchJson","#parseResponse","#restRequestNullable","logger","contentType","errorMessage","errorData","error","errorText","#multipartRequest","formData","result","params","queryParams","searchParams","urlParams","sku","productId","email","key","normalized","options","queryEntries","entry","value","queryString","k","v","Commerce","config","YNSProvider"]}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"$schema": "https://json.schemastore.org/package",
|
|
3
3
|
"name": "commerce-kit",
|
|
4
|
-
"version": "0.
|
|
4
|
+
"version": "0.56.0",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "AGPL-3.0-only",
|
|
7
7
|
"keywords": [
|
|
@@ -55,26 +55,26 @@
|
|
|
55
55
|
"prepublishOnly": "bun run build"
|
|
56
56
|
},
|
|
57
57
|
"devDependencies": {
|
|
58
|
-
"@biomejs/biome": "2.5.
|
|
59
|
-
"@types/node": "^26.1.
|
|
58
|
+
"@biomejs/biome": "2.5.6",
|
|
59
|
+
"@types/node": "^26.1.2",
|
|
60
60
|
"@types/react": "^19.2.17",
|
|
61
61
|
"@types/react-dom": "^19.0.0",
|
|
62
|
-
"@typescript/native-preview": "7.0.0-dev.
|
|
62
|
+
"@typescript/native-preview": "7.0.0-dev.20260707.2",
|
|
63
63
|
"husky": "9.1.7",
|
|
64
|
-
"lint-staged": "17.0
|
|
65
|
-
"react": "^19.2.
|
|
66
|
-
"react-dom": "^19.2.
|
|
64
|
+
"lint-staged": "17.2.0",
|
|
65
|
+
"react": "^19.2.8",
|
|
66
|
+
"react-dom": "^19.2.8",
|
|
67
67
|
"rimraf": "6.1.3",
|
|
68
68
|
"tsup": "8.5.1",
|
|
69
|
-
"tsx": "^4.
|
|
69
|
+
"tsx": "^4.23.1",
|
|
70
70
|
"typescript": "6.0.3",
|
|
71
71
|
"zod": "^4.4.3"
|
|
72
72
|
},
|
|
73
73
|
"peerDependencies": {
|
|
74
|
-
"@types/node": "^26.1.
|
|
74
|
+
"@types/node": "^26.1.2",
|
|
75
75
|
"react": "^19",
|
|
76
76
|
"react-dom": "^19",
|
|
77
|
-
"typescript": "^6.0.3",
|
|
77
|
+
"typescript": "^6.0.3 || ^7.0.0",
|
|
78
78
|
"@typescript/native-preview": "^7.0.0-dev.20260701.1",
|
|
79
79
|
"zod": "^4.4.3"
|
|
80
80
|
},
|