@gethydra/sdk 0.1.35 → 0.1.37
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/index.d.ts +372 -11
- package/dist/index.js +126 -0
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -108,6 +108,8 @@ interface components {
|
|
|
108
108
|
exclude_services: boolean;
|
|
109
109
|
/** @example 0 */
|
|
110
110
|
min_order_total: number;
|
|
111
|
+
/** @example 12 */
|
|
112
|
+
pending_hours: number;
|
|
111
113
|
};
|
|
112
114
|
pricing_config: {
|
|
113
115
|
/** @example 2 */
|
|
@@ -3450,6 +3452,126 @@ interface components {
|
|
|
3450
3452
|
valid: boolean;
|
|
3451
3453
|
staff?: components["schemas"]["PosStaff"];
|
|
3452
3454
|
};
|
|
3455
|
+
PosAnalyticsDashboard: {
|
|
3456
|
+
period: {
|
|
3457
|
+
/** @example 2026-11-17 */
|
|
3458
|
+
from: string;
|
|
3459
|
+
/** @example 2026-11-17 */
|
|
3460
|
+
to: string;
|
|
3461
|
+
};
|
|
3462
|
+
/** @description Comparison date range, or null when compare=none. */
|
|
3463
|
+
comparison_period: {
|
|
3464
|
+
from: string;
|
|
3465
|
+
to: string;
|
|
3466
|
+
} | null;
|
|
3467
|
+
/**
|
|
3468
|
+
* @description Store base currency.
|
|
3469
|
+
* @example gbp
|
|
3470
|
+
*/
|
|
3471
|
+
currency: string;
|
|
3472
|
+
takings: {
|
|
3473
|
+
/** @description Total collected via cash payments (cents). */
|
|
3474
|
+
cash_collected: number;
|
|
3475
|
+
/** @description Total collected via card payments (cents). */
|
|
3476
|
+
card_collected: number;
|
|
3477
|
+
/** @description Total amount paid via gift cards (cents). */
|
|
3478
|
+
gift_card_payments: number;
|
|
3479
|
+
/** @description Total amount paid via store credit (cents). */
|
|
3480
|
+
store_credit_payments: number;
|
|
3481
|
+
/** @description Total discount amount applied (cents). */
|
|
3482
|
+
discounts_given: number;
|
|
3483
|
+
/** @description Cash + card actually received at the till (cents). */
|
|
3484
|
+
net_collected: number;
|
|
3485
|
+
};
|
|
3486
|
+
/** @description Takings for the comparison period, or null. */
|
|
3487
|
+
previous_takings: {
|
|
3488
|
+
/** @description Total collected via cash payments (cents). */
|
|
3489
|
+
cash_collected: number;
|
|
3490
|
+
/** @description Total collected via card payments (cents). */
|
|
3491
|
+
card_collected: number;
|
|
3492
|
+
/** @description Total amount paid via gift cards (cents). */
|
|
3493
|
+
gift_card_payments: number;
|
|
3494
|
+
/** @description Total amount paid via store credit (cents). */
|
|
3495
|
+
store_credit_payments: number;
|
|
3496
|
+
/** @description Total discount amount applied (cents). */
|
|
3497
|
+
discounts_given: number;
|
|
3498
|
+
/** @description Cash + card actually received at the till (cents). */
|
|
3499
|
+
net_collected: number;
|
|
3500
|
+
} | null;
|
|
3501
|
+
summary: {
|
|
3502
|
+
/** @description Sum of order subtotals (cents). */
|
|
3503
|
+
gross_revenue: {
|
|
3504
|
+
/** @description Metric value for the current period. */
|
|
3505
|
+
value: number;
|
|
3506
|
+
/** @description Metric value for the comparison period, or null. */
|
|
3507
|
+
previous: number | null;
|
|
3508
|
+
/** @description Percentage change vs comparison period (2dp), or null. */
|
|
3509
|
+
change: number | null;
|
|
3510
|
+
};
|
|
3511
|
+
/** @description Sum of order totals — actual cash/card received (cents). */
|
|
3512
|
+
net_collected: {
|
|
3513
|
+
/** @description Metric value for the current period. */
|
|
3514
|
+
value: number;
|
|
3515
|
+
/** @description Metric value for the comparison period, or null. */
|
|
3516
|
+
previous: number | null;
|
|
3517
|
+
/** @description Percentage change vs comparison period (2dp), or null. */
|
|
3518
|
+
change: number | null;
|
|
3519
|
+
};
|
|
3520
|
+
/** @description Number of non-cancelled orders. */
|
|
3521
|
+
order_count: {
|
|
3522
|
+
/** @description Metric value for the current period. */
|
|
3523
|
+
value: number;
|
|
3524
|
+
/** @description Metric value for the comparison period, or null. */
|
|
3525
|
+
previous: number | null;
|
|
3526
|
+
/** @description Percentage change vs comparison period (2dp), or null. */
|
|
3527
|
+
change: number | null;
|
|
3528
|
+
};
|
|
3529
|
+
/** @description Gross revenue per order (cents). */
|
|
3530
|
+
average_order_value: {
|
|
3531
|
+
/** @description Metric value for the current period. */
|
|
3532
|
+
value: number;
|
|
3533
|
+
/** @description Metric value for the comparison period, or null. */
|
|
3534
|
+
previous: number | null;
|
|
3535
|
+
/** @description Percentage change vs comparison period (2dp), or null. */
|
|
3536
|
+
change: number | null;
|
|
3537
|
+
};
|
|
3538
|
+
/** @description Total quantity of line items sold. */
|
|
3539
|
+
items_sold: {
|
|
3540
|
+
/** @description Metric value for the current period. */
|
|
3541
|
+
value: number;
|
|
3542
|
+
/** @description Metric value for the comparison period, or null. */
|
|
3543
|
+
previous: number | null;
|
|
3544
|
+
/** @description Percentage change vs comparison period (2dp), or null. */
|
|
3545
|
+
change: number | null;
|
|
3546
|
+
};
|
|
3547
|
+
};
|
|
3548
|
+
top_products: {
|
|
3549
|
+
/** @description Product ID. */
|
|
3550
|
+
product_id: string | null;
|
|
3551
|
+
/** @description Product title. */
|
|
3552
|
+
title: string;
|
|
3553
|
+
/** @description Product image URL. */
|
|
3554
|
+
image_src: string | null;
|
|
3555
|
+
/** @description Total line-item revenue (cents). */
|
|
3556
|
+
revenue: number;
|
|
3557
|
+
/** @description Total quantity sold. */
|
|
3558
|
+
quantity_sold: number;
|
|
3559
|
+
/** @description Number of distinct orders containing this product. */
|
|
3560
|
+
orders: number;
|
|
3561
|
+
}[];
|
|
3562
|
+
staff: {
|
|
3563
|
+
/** @description Staff member ID. */
|
|
3564
|
+
staff_id: string;
|
|
3565
|
+
/** @description Staff member name. */
|
|
3566
|
+
staff_name: string;
|
|
3567
|
+
/** @description Number of orders processed. */
|
|
3568
|
+
order_count: number;
|
|
3569
|
+
/** @description Commissionable amount — actual cash/card collected (cents). */
|
|
3570
|
+
total_collected: number;
|
|
3571
|
+
/** @description Sum of subtotals for orders by this staff (cents). */
|
|
3572
|
+
gross_revenue: number;
|
|
3573
|
+
}[];
|
|
3574
|
+
};
|
|
3453
3575
|
DayAvailability: {
|
|
3454
3576
|
/** @example 2026-11-20 */
|
|
3455
3577
|
date: string;
|
|
@@ -3664,6 +3786,28 @@ interface components {
|
|
|
3664
3786
|
status: "active" | "deactivated";
|
|
3665
3787
|
expires_at: string | null;
|
|
3666
3788
|
};
|
|
3789
|
+
GiftCardConvert: {
|
|
3790
|
+
gift_card: components["schemas"]["GiftCard"];
|
|
3791
|
+
credit_transaction: {
|
|
3792
|
+
id: string;
|
|
3793
|
+
customer_id: string;
|
|
3794
|
+
/** @enum {string} */
|
|
3795
|
+
type: "credit" | "debit" | "expiry";
|
|
3796
|
+
amount: number;
|
|
3797
|
+
balance_after: number;
|
|
3798
|
+
reason: string;
|
|
3799
|
+
note: string | null;
|
|
3800
|
+
related_order_id: string | null;
|
|
3801
|
+
related_refund_id: string | null;
|
|
3802
|
+
expires_at: string | null;
|
|
3803
|
+
metadata: {
|
|
3804
|
+
[key: string]: string | number;
|
|
3805
|
+
};
|
|
3806
|
+
created_at: string;
|
|
3807
|
+
updated_at: string;
|
|
3808
|
+
};
|
|
3809
|
+
customer_balance: number;
|
|
3810
|
+
};
|
|
3667
3811
|
GiftCardTransaction: {
|
|
3668
3812
|
id: string;
|
|
3669
3813
|
gift_card_id: string;
|
|
@@ -4537,6 +4681,8 @@ interface operations {
|
|
|
4537
4681
|
exclude_services?: boolean;
|
|
4538
4682
|
/** @example 0 */
|
|
4539
4683
|
min_order_total?: number;
|
|
4684
|
+
/** @example 12 */
|
|
4685
|
+
pending_hours?: number;
|
|
4540
4686
|
};
|
|
4541
4687
|
gift_card_config?: {
|
|
4542
4688
|
default_expiry_days?: number | null;
|
|
@@ -10119,6 +10265,8 @@ interface operations {
|
|
|
10119
10265
|
"application/json": {
|
|
10120
10266
|
data: {
|
|
10121
10267
|
balance: number;
|
|
10268
|
+
available_balance: number;
|
|
10269
|
+
pending_balance: number;
|
|
10122
10270
|
currency: string;
|
|
10123
10271
|
};
|
|
10124
10272
|
};
|
|
@@ -10169,6 +10317,7 @@ interface operations {
|
|
|
10169
10317
|
related_order_id: string | null;
|
|
10170
10318
|
related_refund_id: string | null;
|
|
10171
10319
|
expires_at: string | null;
|
|
10320
|
+
usable_after: string | null;
|
|
10172
10321
|
metadata: {
|
|
10173
10322
|
[key: string]: string | number;
|
|
10174
10323
|
};
|
|
@@ -10217,6 +10366,7 @@ interface operations {
|
|
|
10217
10366
|
related_order_id: string | null;
|
|
10218
10367
|
related_refund_id: string | null;
|
|
10219
10368
|
expires_at: string | null;
|
|
10369
|
+
usable_after: string | null;
|
|
10220
10370
|
metadata: {
|
|
10221
10371
|
[key: string]: string | number;
|
|
10222
10372
|
};
|
|
@@ -13316,7 +13466,7 @@ interface operations {
|
|
|
13316
13466
|
* "order.paid"
|
|
13317
13467
|
* ]
|
|
13318
13468
|
*/
|
|
13319
|
-
events: ("product.created" | "product.updated" | "product.deleted" | "order.created" | "order.paid" | "order.fulfilled" | "order.cancelled" | "order.refunded" | "channel.created" | "channel.updated" | "channel.archived" | "collection.created" | "collection.updated" | "collection.deleted" | "company.created" | "company.updated" | "company.deleted" | "customer.created" | "customer.updated" | "customer_photo.submitted" | "customer_photo.approved" | "customer_photo.rejected" | "discount.created" | "discount.updated" | "discount.deleted" | "draft_order.created" | "draft_order.updated" | "draft_order.completed" | "draft_order.deleted" | "filter_attribute.created" | "filter_attribute.updated" | "filter_attribute.deleted" | "fulfillment.created" | "fulfillment.updated" | "fulfillment.cancelled" | "fulfillment_order.created" | "inventory.low" | "location.created" | "location.updated" | "location.deleted" | "navigation.created" | "navigation.updated" | "navigation.deleted" | "shipping.zone.created" | "shipping.zone.updated" | "shipping.zone.deleted" | "post.created" | "post.updated" | "post.deleted" | "post.published" | "post.unpublished" | "promotion.created" | "promotion.updated" | "promotion.deleted" | "purchase_order.created" | "purchase_order.updated" | "purchase_order.received" | "purchase_order.cancelled" | "refund.created" | "refund.succeeded" | "refund.failed" | "return.requested" | "return.approved" | "return.received" | "return.rejected" | "return.cancelled" | "return.closed" | "store.published" | "store_credit.issued" | "store_credit.used" | "store_credit.expired" | "loyalty.earned" | "loyalty.clawed_back" | "gift_card.created" | "gift_card.updated" | "gift_card.deactivated" | "gift_card.redeemed" | "gift_card.credited" | "membership.created" | "membership.updated" | "membership.cancelled" | "membership.expired" | "usage.warning" | "booking.created" | "booking.confirmed" | "booking.cancelled" | "booking.completed" | "lookbook.created" | "lookbook.updated" | "lookbook.deleted")[];
|
|
13469
|
+
events: ("product.created" | "product.updated" | "product.deleted" | "order.created" | "order.paid" | "order.fulfilled" | "order.cancelled" | "order.refunded" | "channel.created" | "channel.updated" | "channel.archived" | "collection.created" | "collection.updated" | "collection.deleted" | "company.created" | "company.updated" | "company.deleted" | "customer.created" | "customer.updated" | "customer_photo.submitted" | "customer_photo.approved" | "customer_photo.rejected" | "discount.created" | "discount.updated" | "discount.deleted" | "draft_order.created" | "draft_order.updated" | "draft_order.completed" | "draft_order.deleted" | "filter_attribute.created" | "filter_attribute.updated" | "filter_attribute.deleted" | "fulfillment.created" | "fulfillment.updated" | "fulfillment.cancelled" | "fulfillment_order.created" | "inventory.low" | "location.created" | "location.updated" | "location.deleted" | "navigation.created" | "navigation.updated" | "navigation.deleted" | "shipping.zone.created" | "shipping.zone.updated" | "shipping.zone.deleted" | "post.created" | "post.updated" | "post.deleted" | "post.published" | "post.unpublished" | "promotion.created" | "promotion.updated" | "promotion.deleted" | "purchase_order.created" | "purchase_order.updated" | "purchase_order.received" | "purchase_order.cancelled" | "refund.created" | "refund.succeeded" | "refund.failed" | "return.requested" | "return.approved" | "return.received" | "return.rejected" | "return.cancelled" | "return.closed" | "store.published" | "store_credit.issued" | "store_credit.used" | "store_credit.expired" | "loyalty.earned" | "loyalty.clawed_back" | "gift_card.created" | "gift_card.updated" | "gift_card.deactivated" | "gift_card.redeemed" | "gift_card.credited" | "gift_card.converted" | "membership.created" | "membership.updated" | "membership.cancelled" | "membership.expired" | "usage.warning" | "booking.created" | "booking.confirmed" | "booking.cancelled" | "booking.completed" | "lookbook.created" | "lookbook.updated" | "lookbook.deleted")[];
|
|
13320
13470
|
/**
|
|
13321
13471
|
* @default active
|
|
13322
13472
|
* @example active
|
|
@@ -13410,7 +13560,7 @@ interface operations {
|
|
|
13410
13560
|
* "product.updated"
|
|
13411
13561
|
* ]
|
|
13412
13562
|
*/
|
|
13413
|
-
events?: ("product.created" | "product.updated" | "product.deleted" | "order.created" | "order.paid" | "order.fulfilled" | "order.cancelled" | "order.refunded" | "channel.created" | "channel.updated" | "channel.archived" | "collection.created" | "collection.updated" | "collection.deleted" | "company.created" | "company.updated" | "company.deleted" | "customer.created" | "customer.updated" | "customer_photo.submitted" | "customer_photo.approved" | "customer_photo.rejected" | "discount.created" | "discount.updated" | "discount.deleted" | "draft_order.created" | "draft_order.updated" | "draft_order.completed" | "draft_order.deleted" | "filter_attribute.created" | "filter_attribute.updated" | "filter_attribute.deleted" | "fulfillment.created" | "fulfillment.updated" | "fulfillment.cancelled" | "fulfillment_order.created" | "inventory.low" | "location.created" | "location.updated" | "location.deleted" | "navigation.created" | "navigation.updated" | "navigation.deleted" | "shipping.zone.created" | "shipping.zone.updated" | "shipping.zone.deleted" | "post.created" | "post.updated" | "post.deleted" | "post.published" | "post.unpublished" | "promotion.created" | "promotion.updated" | "promotion.deleted" | "purchase_order.created" | "purchase_order.updated" | "purchase_order.received" | "purchase_order.cancelled" | "refund.created" | "refund.succeeded" | "refund.failed" | "return.requested" | "return.approved" | "return.received" | "return.rejected" | "return.cancelled" | "return.closed" | "store.published" | "store_credit.issued" | "store_credit.used" | "store_credit.expired" | "loyalty.earned" | "loyalty.clawed_back" | "gift_card.created" | "gift_card.updated" | "gift_card.deactivated" | "gift_card.redeemed" | "gift_card.credited" | "membership.created" | "membership.updated" | "membership.cancelled" | "membership.expired" | "usage.warning" | "booking.created" | "booking.confirmed" | "booking.cancelled" | "booking.completed" | "lookbook.created" | "lookbook.updated" | "lookbook.deleted")[];
|
|
13563
|
+
events?: ("product.created" | "product.updated" | "product.deleted" | "order.created" | "order.paid" | "order.fulfilled" | "order.cancelled" | "order.refunded" | "channel.created" | "channel.updated" | "channel.archived" | "collection.created" | "collection.updated" | "collection.deleted" | "company.created" | "company.updated" | "company.deleted" | "customer.created" | "customer.updated" | "customer_photo.submitted" | "customer_photo.approved" | "customer_photo.rejected" | "discount.created" | "discount.updated" | "discount.deleted" | "draft_order.created" | "draft_order.updated" | "draft_order.completed" | "draft_order.deleted" | "filter_attribute.created" | "filter_attribute.updated" | "filter_attribute.deleted" | "fulfillment.created" | "fulfillment.updated" | "fulfillment.cancelled" | "fulfillment_order.created" | "inventory.low" | "location.created" | "location.updated" | "location.deleted" | "navigation.created" | "navigation.updated" | "navigation.deleted" | "shipping.zone.created" | "shipping.zone.updated" | "shipping.zone.deleted" | "post.created" | "post.updated" | "post.deleted" | "post.published" | "post.unpublished" | "promotion.created" | "promotion.updated" | "promotion.deleted" | "purchase_order.created" | "purchase_order.updated" | "purchase_order.received" | "purchase_order.cancelled" | "refund.created" | "refund.succeeded" | "refund.failed" | "return.requested" | "return.approved" | "return.received" | "return.rejected" | "return.cancelled" | "return.closed" | "store.published" | "store_credit.issued" | "store_credit.used" | "store_credit.expired" | "loyalty.earned" | "loyalty.clawed_back" | "gift_card.created" | "gift_card.updated" | "gift_card.deactivated" | "gift_card.redeemed" | "gift_card.credited" | "gift_card.converted" | "membership.created" | "membership.updated" | "membership.cancelled" | "membership.expired" | "usage.warning" | "booking.created" | "booking.confirmed" | "booking.cancelled" | "booking.completed" | "lookbook.created" | "lookbook.updated" | "lookbook.deleted")[];
|
|
13414
13564
|
/**
|
|
13415
13565
|
* @example active
|
|
13416
13566
|
* @enum {string}
|
|
@@ -16699,6 +16849,41 @@ interface operations {
|
|
|
16699
16849
|
};
|
|
16700
16850
|
};
|
|
16701
16851
|
};
|
|
16852
|
+
getPosAnalyticsDashboard: {
|
|
16853
|
+
parameters: {
|
|
16854
|
+
query: {
|
|
16855
|
+
/** @description Location ID to scope analytics to. */
|
|
16856
|
+
location_id: string;
|
|
16857
|
+
/** @description Start date (YYYY-MM-DD). */
|
|
16858
|
+
from: string;
|
|
16859
|
+
/** @description End date (YYYY-MM-DD). */
|
|
16860
|
+
to: string;
|
|
16861
|
+
/** @description Comparison mode. */
|
|
16862
|
+
compare?: "previous_period" | "none";
|
|
16863
|
+
/** @description Number of top products to return (1-20). */
|
|
16864
|
+
top_products_limit?: number;
|
|
16865
|
+
/** @description Sort top products by revenue or quantity sold. */
|
|
16866
|
+
top_products_sort?: "revenue" | "quantity";
|
|
16867
|
+
};
|
|
16868
|
+
header?: never;
|
|
16869
|
+
path?: never;
|
|
16870
|
+
cookie?: never;
|
|
16871
|
+
};
|
|
16872
|
+
requestBody?: never;
|
|
16873
|
+
responses: {
|
|
16874
|
+
/** @description POS analytics dashboard data */
|
|
16875
|
+
200: {
|
|
16876
|
+
headers: {
|
|
16877
|
+
[name: string]: unknown;
|
|
16878
|
+
};
|
|
16879
|
+
content: {
|
|
16880
|
+
"application/json": {
|
|
16881
|
+
data: components["schemas"]["PosAnalyticsDashboard"];
|
|
16882
|
+
};
|
|
16883
|
+
};
|
|
16884
|
+
};
|
|
16885
|
+
};
|
|
16886
|
+
};
|
|
16702
16887
|
listBookableLocations: {
|
|
16703
16888
|
parameters: {
|
|
16704
16889
|
query?: never;
|
|
@@ -17575,6 +17760,40 @@ interface operations {
|
|
|
17575
17760
|
};
|
|
17576
17761
|
};
|
|
17577
17762
|
};
|
|
17763
|
+
convertGiftCardToStoreCredit: {
|
|
17764
|
+
parameters: {
|
|
17765
|
+
query?: never;
|
|
17766
|
+
header?: never;
|
|
17767
|
+
path: {
|
|
17768
|
+
id: string;
|
|
17769
|
+
};
|
|
17770
|
+
cookie?: never;
|
|
17771
|
+
};
|
|
17772
|
+
requestBody?: {
|
|
17773
|
+
content: {
|
|
17774
|
+
"application/json": {
|
|
17775
|
+
/**
|
|
17776
|
+
* @description Customer to receive the store credit.
|
|
17777
|
+
* @example cus_abc123
|
|
17778
|
+
*/
|
|
17779
|
+
customer_id: string;
|
|
17780
|
+
};
|
|
17781
|
+
};
|
|
17782
|
+
};
|
|
17783
|
+
responses: {
|
|
17784
|
+
/** @description Gift card converted to store credit */
|
|
17785
|
+
200: {
|
|
17786
|
+
headers: {
|
|
17787
|
+
[name: string]: unknown;
|
|
17788
|
+
};
|
|
17789
|
+
content: {
|
|
17790
|
+
"application/json": {
|
|
17791
|
+
data: components["schemas"]["GiftCardConvert"];
|
|
17792
|
+
};
|
|
17793
|
+
};
|
|
17794
|
+
};
|
|
17795
|
+
};
|
|
17796
|
+
};
|
|
17578
17797
|
listGiftCardTransactions: {
|
|
17579
17798
|
parameters: {
|
|
17580
17799
|
query?: {
|
|
@@ -20304,7 +20523,7 @@ type Customer = components['schemas']['Customer'];
|
|
|
20304
20523
|
type ListParams$o = NonNullable<operations['listCustomers']['parameters']['query']>;
|
|
20305
20524
|
type CreateBody$h = NonNullable<operations['createCustomer']['requestBody']>['content']['application/json'];
|
|
20306
20525
|
type UpdateBody$k = NonNullable<operations['updateCustomer']['requestBody']>['content']['application/json'];
|
|
20307
|
-
type CreateAddressBody$
|
|
20526
|
+
type CreateAddressBody$2 = NonNullable<operations['createCustomerAddress']['requestBody']>['content']['application/json'];
|
|
20308
20527
|
type CreateNoteBody$1 = NonNullable<operations['createCustomerNote']['requestBody']>['content']['application/json'];
|
|
20309
20528
|
declare class CustomersResource {
|
|
20310
20529
|
private client;
|
|
@@ -20319,7 +20538,7 @@ declare class CustomersResource {
|
|
|
20319
20538
|
update(id: string, body: UpdateBody$k): Promise<DataResponse<Customer>>;
|
|
20320
20539
|
delete(id: string): Promise<void>;
|
|
20321
20540
|
listAddresses(customerId: string): Promise<DataResponse<unknown[]>>;
|
|
20322
|
-
createAddress(customerId: string, body: CreateAddressBody$
|
|
20541
|
+
createAddress(customerId: string, body: CreateAddressBody$2): Promise<DataResponse<unknown>>;
|
|
20323
20542
|
listNotes(customerId: string): Promise<DataResponse<unknown[]>>;
|
|
20324
20543
|
createNote(customerId: string, body: CreateNoteBody$1): Promise<DataResponse<unknown>>;
|
|
20325
20544
|
deleteNote(customerId: string, noteId: string): Promise<void>;
|
|
@@ -20637,8 +20856,8 @@ type Company = components['schemas']['Company'];
|
|
|
20637
20856
|
type ListParams$e = NonNullable<operations['listCompanies']['parameters']['query']>;
|
|
20638
20857
|
type CreateBody$a = NonNullable<operations['createCompany']['requestBody']>['content']['application/json'];
|
|
20639
20858
|
type UpdateBody$a = NonNullable<operations['updateCompany']['requestBody']>['content']['application/json'];
|
|
20640
|
-
type CreateAddressBody = NonNullable<operations['createCompanyAddress']['requestBody']>['content']['application/json'];
|
|
20641
|
-
type UpdateAddressBody = NonNullable<operations['updateCompanyAddress']['requestBody']>['content']['application/json'];
|
|
20859
|
+
type CreateAddressBody$1 = NonNullable<operations['createCompanyAddress']['requestBody']>['content']['application/json'];
|
|
20860
|
+
type UpdateAddressBody$1 = NonNullable<operations['updateCompanyAddress']['requestBody']>['content']['application/json'];
|
|
20642
20861
|
type CreateContactBody = NonNullable<operations['createCompanyContact']['requestBody']>['content']['application/json'];
|
|
20643
20862
|
type UpdateContactBody = NonNullable<operations['updateCompanyContact']['requestBody']>['content']['application/json'];
|
|
20644
20863
|
type CreateNoteBody = NonNullable<operations['createCompanyNote']['requestBody']>['content']['application/json'];
|
|
@@ -20655,8 +20874,8 @@ declare class CompaniesResource {
|
|
|
20655
20874
|
update(id: string, body: UpdateBody$a): Promise<DataResponse<Company>>;
|
|
20656
20875
|
delete(id: string): Promise<void>;
|
|
20657
20876
|
listAddresses(companyId: string): Promise<DataResponse<unknown[]>>;
|
|
20658
|
-
createAddress(companyId: string, body: CreateAddressBody): Promise<DataResponse<unknown>>;
|
|
20659
|
-
updateAddress(companyId: string, addressId: string, body: UpdateAddressBody): Promise<DataResponse<unknown>>;
|
|
20877
|
+
createAddress(companyId: string, body: CreateAddressBody$1): Promise<DataResponse<unknown>>;
|
|
20878
|
+
updateAddress(companyId: string, addressId: string, body: UpdateAddressBody$1): Promise<DataResponse<unknown>>;
|
|
20660
20879
|
deleteAddress(companyId: string, addressId: string): Promise<void>;
|
|
20661
20880
|
listContacts(companyId: string): Promise<DataResponse<unknown[]>>;
|
|
20662
20881
|
createContact(companyId: string, body: CreateContactBody): Promise<DataResponse<unknown>>;
|
|
@@ -20920,7 +21139,7 @@ declare class AnalyticsResource {
|
|
|
20920
21139
|
}
|
|
20921
21140
|
|
|
20922
21141
|
type CreditTransaction = NonNullable<operations['issueCustomerCredit']['responses']['201']['content']['application/json']['data']>;
|
|
20923
|
-
type CreditBalance = NonNullable<operations['getCustomerCredit']['responses']['200']['content']['application/json']['data']>;
|
|
21142
|
+
type CreditBalance$1 = NonNullable<operations['getCustomerCredit']['responses']['200']['content']['application/json']['data']>;
|
|
20924
21143
|
type ListParams$6 = NonNullable<operations['listCustomerCreditTransactions']['parameters']['query']>;
|
|
20925
21144
|
type IssueCreditBody = NonNullable<operations['issueCustomerCredit']['requestBody']>['content']['application/json'];
|
|
20926
21145
|
interface LoyaltySummary {
|
|
@@ -20931,13 +21150,15 @@ interface LoyaltySummary {
|
|
|
20931
21150
|
active_loyalty_points?: number;
|
|
20932
21151
|
clawed_back_credit?: number;
|
|
20933
21152
|
expired_credit?: number;
|
|
21153
|
+
pending_credit?: number;
|
|
21154
|
+
pending_points?: number;
|
|
20934
21155
|
display_multiplier?: number;
|
|
20935
21156
|
earn_rate_bps?: number;
|
|
20936
21157
|
}
|
|
20937
21158
|
declare class StoreCreditResource {
|
|
20938
21159
|
private client;
|
|
20939
21160
|
constructor(client: Hydra);
|
|
20940
|
-
getBalance(customerId: string): Promise<DataResponse<CreditBalance>>;
|
|
21161
|
+
getBalance(customerId: string): Promise<DataResponse<CreditBalance$1>>;
|
|
20941
21162
|
getLoyalty(customerId: string): Promise<DataResponse<LoyaltySummary>>;
|
|
20942
21163
|
issue(customerId: string, body: IssueCreditBody, options?: ResourceRequestOptions): Promise<DataResponse<CreditTransaction>>;
|
|
20943
21164
|
listTransactions(customerId: string, params?: ListParams$6): Promise<ListResponse<CreditTransaction>>;
|
|
@@ -21352,6 +21573,144 @@ declare class GiftCardsResource {
|
|
|
21352
21573
|
lookup(code: string): Promise<DataResponse<GiftCardLookup>>;
|
|
21353
21574
|
}
|
|
21354
21575
|
|
|
21576
|
+
interface AuthCustomer {
|
|
21577
|
+
id: string;
|
|
21578
|
+
email: string;
|
|
21579
|
+
first_name: string;
|
|
21580
|
+
last_name: string;
|
|
21581
|
+
phone: string | null;
|
|
21582
|
+
locale: string | null;
|
|
21583
|
+
email_verified: boolean;
|
|
21584
|
+
created_at: string;
|
|
21585
|
+
updated_at: string;
|
|
21586
|
+
}
|
|
21587
|
+
interface TokenResponse {
|
|
21588
|
+
access_token: string;
|
|
21589
|
+
refresh_token: string;
|
|
21590
|
+
expires_in: number;
|
|
21591
|
+
customer?: AuthCustomer;
|
|
21592
|
+
}
|
|
21593
|
+
interface MessageResponse {
|
|
21594
|
+
message: string;
|
|
21595
|
+
}
|
|
21596
|
+
interface RegisterBody {
|
|
21597
|
+
email: string;
|
|
21598
|
+
password: string;
|
|
21599
|
+
first_name: string;
|
|
21600
|
+
last_name: string;
|
|
21601
|
+
phone?: string;
|
|
21602
|
+
locale?: string;
|
|
21603
|
+
}
|
|
21604
|
+
interface LoginBody {
|
|
21605
|
+
email: string;
|
|
21606
|
+
password: string;
|
|
21607
|
+
}
|
|
21608
|
+
declare class AuthResource {
|
|
21609
|
+
private client;
|
|
21610
|
+
constructor(client: Hydra);
|
|
21611
|
+
/** Register a new customer account. Returns access + refresh tokens. */
|
|
21612
|
+
register(body: RegisterBody): Promise<TokenResponse>;
|
|
21613
|
+
/** Log in with email and password. Returns access + refresh tokens. */
|
|
21614
|
+
login(body: LoginBody): Promise<TokenResponse>;
|
|
21615
|
+
/** Exchange a refresh token for new access + refresh tokens (single-use rotation). */
|
|
21616
|
+
refreshToken(refreshToken: string): Promise<TokenResponse>;
|
|
21617
|
+
/** Invalidate a refresh token. Idempotent — succeeds even if already invalidated. */
|
|
21618
|
+
logout(refreshToken: string): Promise<void>;
|
|
21619
|
+
/** Request a password reset email. Always returns a generic message (prevents enumeration). */
|
|
21620
|
+
forgotPassword(email: string): Promise<MessageResponse>;
|
|
21621
|
+
/** Reset password using a token from the reset email. Invalidates all sessions. */
|
|
21622
|
+
resetPassword(token: string, password: string): Promise<MessageResponse>;
|
|
21623
|
+
/** Verify a customer's email using the token from the verification email. */
|
|
21624
|
+
verifyEmail(token: string): Promise<MessageResponse>;
|
|
21625
|
+
}
|
|
21626
|
+
|
|
21627
|
+
interface UpdateProfileBody {
|
|
21628
|
+
first_name?: string;
|
|
21629
|
+
last_name?: string;
|
|
21630
|
+
phone?: string | null;
|
|
21631
|
+
locale?: string | null;
|
|
21632
|
+
}
|
|
21633
|
+
interface ChangePasswordBody {
|
|
21634
|
+
current_password: string;
|
|
21635
|
+
new_password: string;
|
|
21636
|
+
}
|
|
21637
|
+
interface CreateAddressBody {
|
|
21638
|
+
first_name?: string | null;
|
|
21639
|
+
last_name?: string | null;
|
|
21640
|
+
company?: string | null;
|
|
21641
|
+
line1: string;
|
|
21642
|
+
line2?: string | null;
|
|
21643
|
+
city: string;
|
|
21644
|
+
state?: string | null;
|
|
21645
|
+
postal_code?: string | null;
|
|
21646
|
+
country: string;
|
|
21647
|
+
phone?: string | null;
|
|
21648
|
+
is_default?: boolean;
|
|
21649
|
+
}
|
|
21650
|
+
interface UpdateAddressBody {
|
|
21651
|
+
first_name?: string | null;
|
|
21652
|
+
last_name?: string | null;
|
|
21653
|
+
company?: string | null;
|
|
21654
|
+
line1?: string;
|
|
21655
|
+
line2?: string | null;
|
|
21656
|
+
city?: string;
|
|
21657
|
+
state?: string | null;
|
|
21658
|
+
postal_code?: string | null;
|
|
21659
|
+
country?: string;
|
|
21660
|
+
phone?: string | null;
|
|
21661
|
+
is_default?: boolean;
|
|
21662
|
+
}
|
|
21663
|
+
interface MeOrdersParams {
|
|
21664
|
+
limit?: number;
|
|
21665
|
+
cursor?: string;
|
|
21666
|
+
sort?: 'created_at';
|
|
21667
|
+
order?: 'asc' | 'desc';
|
|
21668
|
+
}
|
|
21669
|
+
interface CreditBalance {
|
|
21670
|
+
balance: number;
|
|
21671
|
+
available: number;
|
|
21672
|
+
pending: number;
|
|
21673
|
+
currency: string;
|
|
21674
|
+
}
|
|
21675
|
+
/**
|
|
21676
|
+
* Customer self-service resource for `/v1/me/*` endpoints.
|
|
21677
|
+
* Every method requires a customer access token (JWT).
|
|
21678
|
+
*/
|
|
21679
|
+
declare class MeResource {
|
|
21680
|
+
private client;
|
|
21681
|
+
constructor(client: Hydra);
|
|
21682
|
+
private opts;
|
|
21683
|
+
/** Get the authenticated customer's profile. */
|
|
21684
|
+
getProfile(accessToken: string): Promise<DataResponse<unknown>>;
|
|
21685
|
+
/** Update profile fields (first_name, last_name, phone, locale). */
|
|
21686
|
+
updateProfile(accessToken: string, body: UpdateProfileBody): Promise<DataResponse<unknown>>;
|
|
21687
|
+
/** Change password. Invalidates all sessions and returns new tokens. */
|
|
21688
|
+
changePassword(accessToken: string, body: ChangePasswordBody): Promise<TokenResponse>;
|
|
21689
|
+
/** List the customer's order history. */
|
|
21690
|
+
listOrders(accessToken: string, params?: MeOrdersParams): Promise<ListResponse<unknown>>;
|
|
21691
|
+
/** List the customer's addresses. */
|
|
21692
|
+
listAddresses(accessToken: string): Promise<DataResponse<unknown[]>>;
|
|
21693
|
+
/** Create a new address. */
|
|
21694
|
+
createAddress(accessToken: string, body: CreateAddressBody): Promise<DataResponse<unknown>>;
|
|
21695
|
+
/** Update an existing address. */
|
|
21696
|
+
updateAddress(accessToken: string, id: string, body: UpdateAddressBody): Promise<DataResponse<unknown>>;
|
|
21697
|
+
/** Delete an address. */
|
|
21698
|
+
deleteAddress(accessToken: string, id: string): Promise<void>;
|
|
21699
|
+
/** Get store credit balance breakdown. */
|
|
21700
|
+
getCredit(accessToken: string): Promise<DataResponse<CreditBalance>>;
|
|
21701
|
+
/** List store credit transactions. */
|
|
21702
|
+
listCreditTransactions(accessToken: string, params?: {
|
|
21703
|
+
limit?: number;
|
|
21704
|
+
cursor?: string;
|
|
21705
|
+
sort?: string;
|
|
21706
|
+
order?: 'asc' | 'desc';
|
|
21707
|
+
}): Promise<ListResponse<unknown>>;
|
|
21708
|
+
/** List the customer's returns. */
|
|
21709
|
+
listReturns(accessToken: string): Promise<DataResponse<unknown[]>>;
|
|
21710
|
+
/** Get active membership. */
|
|
21711
|
+
getMembership(accessToken: string): Promise<DataResponse<unknown>>;
|
|
21712
|
+
}
|
|
21713
|
+
|
|
21355
21714
|
interface AppInfo {
|
|
21356
21715
|
/** Integration/plugin name (e.g. "MyShopTheme") */
|
|
21357
21716
|
name: string;
|
|
@@ -21436,6 +21795,8 @@ declare class Hydra {
|
|
|
21436
21795
|
readonly bookings: BookingsResource;
|
|
21437
21796
|
readonly lookbooks: LookbooksResource;
|
|
21438
21797
|
readonly giftCards: GiftCardsResource;
|
|
21798
|
+
readonly auth: AuthResource;
|
|
21799
|
+
readonly me: MeResource;
|
|
21439
21800
|
constructor(config: HydraConfig);
|
|
21440
21801
|
request<T>(method: string, path: string, options?: RequestOptions): Promise<T>;
|
|
21441
21802
|
/** Multipart upload for file-based endpoints (e.g. images) */
|
|
@@ -21517,4 +21878,4 @@ declare class HydraIdempotencyError extends HydraError {
|
|
|
21517
21878
|
constructor(body: HydraErrorBody, headers: Headers);
|
|
21518
21879
|
}
|
|
21519
21880
|
|
|
21520
|
-
export { AddressesResource, type AnalyticsActionItems$1 as AnalyticsActionItems, type AnalyticsOrdersSeries$1 as AnalyticsOrdersSeries, AnalyticsResource, type AnalyticsSummary$1 as AnalyticsSummary, type AnalyticsTimeSeries$1 as AnalyticsTimeSeries, type AnalyticsTopProduct$1 as AnalyticsTopProduct, type AppInfo, type Appointment$1 as Appointment, type AvailabilityOverride$1 as AvailabilityOverride, BookingsResource, type Cart$1 as Cart, type CartItem, CartResource, type Channel$1 as Channel, ChannelsResource, type CheckoutCreate$1 as CheckoutCreate, type CheckoutGet$1 as CheckoutGet, type CheckoutListItem$1 as CheckoutListItem, CheckoutResource, CheckoutsResource, type Collection$1 as Collection, CollectionsResource, CompaniesResource, type Company$1 as Company, ContentCategoriesResource, type ContentCategory$1 as ContentCategory, type CreateGiftCardBody, type Customer$1 as Customer, type CustomerGroup$1 as CustomerGroup, CustomerGroupsResource, type CustomerMembership$1 as CustomerMembership, type CustomerPhoto$1 as CustomerPhoto, CustomerPhotosResource, CustomersResource, type DataResponse, type DayAvailability$1 as DayAvailability, type Discount$1 as Discount, DiscountsResource, type DraftOrder$1 as DraftOrder, DraftOrdersResource, type ExchangeRate$1 as ExchangeRate, ExchangeRatesResource, type Fulfillment$1 as Fulfillment, type FulfillmentOrder$2 as FulfillmentOrder, FulfillmentOrdersResource, FulfillmentsResource, type GenerateVariantsResult$1 as GenerateVariantsResult, type GiftCard, type GiftCardConvertResult, type CreditDebitBody as GiftCardCreditDebitBody, type GiftCardLookup, type GiftCardTransaction, GiftCardsResource, Hydra, HydraAuthenticationError, type HydraConfig, HydraConnectionError, HydraError, type HydraErrorBody, HydraIdempotencyError, HydraNotFoundError, HydraPermissionError, HydraRateLimitError, HydraValidationError, type Image$2 as Image, ImagesResource, IntegrationsResource, type InventoryLevel$1 as InventoryLevel, InventoryResource, type ListGiftCardTransactionsParams, type ListGiftCardsParams, type ListResponse, type Location$1 as Location, LocationsResource, type Lookbook$1 as Lookbook, type LookbookTag$1 as LookbookTag, LookbooksResource, type LoyaltySummary, type MembershipPlan$1 as MembershipPlan, MembershipPlansResource, MetafieldsResource, type NotificationLog$1 as NotificationLog, NotificationsResource, type Order$2 as Order, OrdersResource, type PaginateOptions, type Pagination, type PosAnalyticsDashboard, type Post$1 as Post, PostsResource, type Product$1 as Product, type ProductStats$1 as ProductStats, ProductsResource, type Promotion$1 as Promotion, PromotionsResource, type PurchaseOrder$1 as PurchaseOrder, PurchaseOrdersResource, type Redirect$1 as Redirect, RedirectsResource, type Refund$1 as Refund, RefundsResource, type RequestOptions, type ResourceRequestOptions, type Return$1 as Return, ReturnsResource, SearchResource, type ShippingRate$1 as ShippingRate, ShippingResource, type ShippingZone$1 as ShippingZone, type Slot, type Store$1 as Store, StoreCreditResource, StoreResource, type SuggestedSlot$1 as SuggestedSlot, type Tag$1 as Tag, TagsResource, type TaxExemption$1 as TaxExemption, type TaxGroup$1 as TaxGroup, type TaxRate$1 as TaxRate, TaxResource, type UpdateGiftCardBody, type Variant$2 as Variant, type VariantPrice$1 as VariantPrice, VariantsResource, type Webhook$1 as Webhook, WebhooksResource, paginate, toArray };
|
|
21881
|
+
export { AddressesResource, type AnalyticsActionItems$1 as AnalyticsActionItems, type AnalyticsOrdersSeries$1 as AnalyticsOrdersSeries, AnalyticsResource, type AnalyticsSummary$1 as AnalyticsSummary, type AnalyticsTimeSeries$1 as AnalyticsTimeSeries, type AnalyticsTopProduct$1 as AnalyticsTopProduct, type AppInfo, type Appointment$1 as Appointment, type AuthCustomer, AuthResource, type AvailabilityOverride$1 as AvailabilityOverride, BookingsResource, type Cart$1 as Cart, type CartItem, CartResource, type ChangePasswordBody, type Channel$1 as Channel, ChannelsResource, type CheckoutCreate$1 as CheckoutCreate, type CheckoutGet$1 as CheckoutGet, type CheckoutListItem$1 as CheckoutListItem, CheckoutResource, CheckoutsResource, type Collection$1 as Collection, CollectionsResource, CompaniesResource, type Company$1 as Company, ContentCategoriesResource, type ContentCategory$1 as ContentCategory, type CreateGiftCardBody, type CreditBalance, type Customer$1 as Customer, type CustomerGroup$1 as CustomerGroup, CustomerGroupsResource, type CustomerMembership$1 as CustomerMembership, type CustomerPhoto$1 as CustomerPhoto, CustomerPhotosResource, CustomersResource, type DataResponse, type DayAvailability$1 as DayAvailability, type Discount$1 as Discount, DiscountsResource, type DraftOrder$1 as DraftOrder, DraftOrdersResource, type ExchangeRate$1 as ExchangeRate, ExchangeRatesResource, type Fulfillment$1 as Fulfillment, type FulfillmentOrder$2 as FulfillmentOrder, FulfillmentOrdersResource, FulfillmentsResource, type GenerateVariantsResult$1 as GenerateVariantsResult, type GiftCard, type GiftCardConvertResult, type CreditDebitBody as GiftCardCreditDebitBody, type GiftCardLookup, type GiftCardTransaction, GiftCardsResource, Hydra, HydraAuthenticationError, type HydraConfig, HydraConnectionError, HydraError, type HydraErrorBody, HydraIdempotencyError, HydraNotFoundError, HydraPermissionError, HydraRateLimitError, HydraValidationError, type Image$2 as Image, ImagesResource, IntegrationsResource, type InventoryLevel$1 as InventoryLevel, InventoryResource, type ListGiftCardTransactionsParams, type ListGiftCardsParams, type ListResponse, type Location$1 as Location, LocationsResource, type LoginBody, type Lookbook$1 as Lookbook, type LookbookTag$1 as LookbookTag, LookbooksResource, type LoyaltySummary, type CreateAddressBody as MeCreateAddressBody, type MeOrdersParams, MeResource, type UpdateAddressBody as MeUpdateAddressBody, type MembershipPlan$1 as MembershipPlan, MembershipPlansResource, type MessageResponse, MetafieldsResource, type NotificationLog$1 as NotificationLog, NotificationsResource, type Order$2 as Order, OrdersResource, type PaginateOptions, type Pagination, type PosAnalyticsDashboard, type Post$1 as Post, PostsResource, type Product$1 as Product, type ProductStats$1 as ProductStats, ProductsResource, type Promotion$1 as Promotion, PromotionsResource, type PurchaseOrder$1 as PurchaseOrder, PurchaseOrdersResource, type Redirect$1 as Redirect, RedirectsResource, type Refund$1 as Refund, RefundsResource, type RegisterBody, type RequestOptions, type ResourceRequestOptions, type Return$1 as Return, ReturnsResource, SearchResource, type ShippingRate$1 as ShippingRate, ShippingResource, type ShippingZone$1 as ShippingZone, type Slot, type Store$1 as Store, StoreCreditResource, StoreResource, type SuggestedSlot$1 as SuggestedSlot, type Tag$1 as Tag, TagsResource, type TaxExemption$1 as TaxExemption, type TaxGroup$1 as TaxGroup, type TaxRate$1 as TaxRate, TaxResource, type TokenResponse, type UpdateGiftCardBody, type UpdateProfileBody, type Variant$2 as Variant, type VariantPrice$1 as VariantPrice, VariantsResource, type Webhook$1 as Webhook, WebhooksResource, paginate, toArray };
|
package/dist/index.js
CHANGED
|
@@ -1807,6 +1807,127 @@ var GiftCardsResource = class {
|
|
|
1807
1807
|
}
|
|
1808
1808
|
};
|
|
1809
1809
|
|
|
1810
|
+
// src/resources/auth.ts
|
|
1811
|
+
var AuthResource = class {
|
|
1812
|
+
constructor(client) {
|
|
1813
|
+
this.client = client;
|
|
1814
|
+
}
|
|
1815
|
+
client;
|
|
1816
|
+
/** Register a new customer account. Returns access + refresh tokens. */
|
|
1817
|
+
async register(body) {
|
|
1818
|
+
return this.client.request("POST", "/v1/auth/register", { body });
|
|
1819
|
+
}
|
|
1820
|
+
/** Log in with email and password. Returns access + refresh tokens. */
|
|
1821
|
+
async login(body) {
|
|
1822
|
+
return this.client.request("POST", "/v1/auth/login", { body });
|
|
1823
|
+
}
|
|
1824
|
+
/** Exchange a refresh token for new access + refresh tokens (single-use rotation). */
|
|
1825
|
+
async refreshToken(refreshToken) {
|
|
1826
|
+
return this.client.request("POST", "/v1/auth/token", {
|
|
1827
|
+
body: { refresh_token: refreshToken }
|
|
1828
|
+
});
|
|
1829
|
+
}
|
|
1830
|
+
/** Invalidate a refresh token. Idempotent — succeeds even if already invalidated. */
|
|
1831
|
+
async logout(refreshToken) {
|
|
1832
|
+
return this.client.request("POST", "/v1/auth/logout", {
|
|
1833
|
+
body: { refresh_token: refreshToken }
|
|
1834
|
+
});
|
|
1835
|
+
}
|
|
1836
|
+
/** Request a password reset email. Always returns a generic message (prevents enumeration). */
|
|
1837
|
+
async forgotPassword(email) {
|
|
1838
|
+
return this.client.request("POST", "/v1/auth/forgot-password", {
|
|
1839
|
+
body: { email }
|
|
1840
|
+
});
|
|
1841
|
+
}
|
|
1842
|
+
/** Reset password using a token from the reset email. Invalidates all sessions. */
|
|
1843
|
+
async resetPassword(token, password) {
|
|
1844
|
+
return this.client.request("POST", "/v1/auth/reset-password", {
|
|
1845
|
+
body: { token, password }
|
|
1846
|
+
});
|
|
1847
|
+
}
|
|
1848
|
+
/** Verify a customer's email using the token from the verification email. */
|
|
1849
|
+
async verifyEmail(token) {
|
|
1850
|
+
return this.client.request("POST", "/v1/auth/verify-email", {
|
|
1851
|
+
body: { token }
|
|
1852
|
+
});
|
|
1853
|
+
}
|
|
1854
|
+
};
|
|
1855
|
+
|
|
1856
|
+
// src/resources/me.ts
|
|
1857
|
+
var MeResource = class {
|
|
1858
|
+
constructor(client) {
|
|
1859
|
+
this.client = client;
|
|
1860
|
+
}
|
|
1861
|
+
client;
|
|
1862
|
+
opts(accessToken, extra) {
|
|
1863
|
+
return {
|
|
1864
|
+
...extra,
|
|
1865
|
+
headers: {
|
|
1866
|
+
Authorization: `Bearer ${accessToken}`,
|
|
1867
|
+
...extra?.headers
|
|
1868
|
+
}
|
|
1869
|
+
};
|
|
1870
|
+
}
|
|
1871
|
+
/** Get the authenticated customer's profile. */
|
|
1872
|
+
async getProfile(accessToken) {
|
|
1873
|
+
return this.client.request("GET", "/v1/me", this.opts(accessToken));
|
|
1874
|
+
}
|
|
1875
|
+
/** Update profile fields (first_name, last_name, phone, locale). */
|
|
1876
|
+
async updateProfile(accessToken, body) {
|
|
1877
|
+
return this.client.request("PATCH", "/v1/me", this.opts(accessToken, { body }));
|
|
1878
|
+
}
|
|
1879
|
+
/** Change password. Invalidates all sessions and returns new tokens. */
|
|
1880
|
+
async changePassword(accessToken, body) {
|
|
1881
|
+
return this.client.request("POST", "/v1/me/password", this.opts(accessToken, { body }));
|
|
1882
|
+
}
|
|
1883
|
+
/** List the customer's order history. */
|
|
1884
|
+
async listOrders(accessToken, params) {
|
|
1885
|
+
return this.client.request("GET", "/v1/me/orders", this.opts(accessToken, {
|
|
1886
|
+
params
|
|
1887
|
+
}));
|
|
1888
|
+
}
|
|
1889
|
+
/** List the customer's addresses. */
|
|
1890
|
+
async listAddresses(accessToken) {
|
|
1891
|
+
return this.client.request("GET", "/v1/me/addresses", this.opts(accessToken));
|
|
1892
|
+
}
|
|
1893
|
+
/** Create a new address. */
|
|
1894
|
+
async createAddress(accessToken, body) {
|
|
1895
|
+
return this.client.request("POST", "/v1/me/addresses", this.opts(accessToken, { body }));
|
|
1896
|
+
}
|
|
1897
|
+
/** Update an existing address. */
|
|
1898
|
+
async updateAddress(accessToken, id, body) {
|
|
1899
|
+
return this.client.request(
|
|
1900
|
+
"PATCH",
|
|
1901
|
+
`/v1/me/addresses/${id}`,
|
|
1902
|
+
this.opts(accessToken, { body })
|
|
1903
|
+
);
|
|
1904
|
+
}
|
|
1905
|
+
/** Delete an address. */
|
|
1906
|
+
async deleteAddress(accessToken, id) {
|
|
1907
|
+
return this.client.request("DELETE", `/v1/me/addresses/${id}`, this.opts(accessToken));
|
|
1908
|
+
}
|
|
1909
|
+
/** Get store credit balance breakdown. */
|
|
1910
|
+
async getCredit(accessToken) {
|
|
1911
|
+
return this.client.request("GET", "/v1/me/credit", this.opts(accessToken));
|
|
1912
|
+
}
|
|
1913
|
+
/** List store credit transactions. */
|
|
1914
|
+
async listCreditTransactions(accessToken, params) {
|
|
1915
|
+
return this.client.request(
|
|
1916
|
+
"GET",
|
|
1917
|
+
"/v1/me/credit/transactions",
|
|
1918
|
+
this.opts(accessToken, { params })
|
|
1919
|
+
);
|
|
1920
|
+
}
|
|
1921
|
+
/** List the customer's returns. */
|
|
1922
|
+
async listReturns(accessToken) {
|
|
1923
|
+
return this.client.request("GET", "/v1/me/returns", this.opts(accessToken));
|
|
1924
|
+
}
|
|
1925
|
+
/** Get active membership. */
|
|
1926
|
+
async getMembership(accessToken) {
|
|
1927
|
+
return this.client.request("GET", "/v1/me/membership", this.opts(accessToken));
|
|
1928
|
+
}
|
|
1929
|
+
};
|
|
1930
|
+
|
|
1810
1931
|
// src/client.ts
|
|
1811
1932
|
var SDK_VERSION = "0.1.0";
|
|
1812
1933
|
var INITIAL_RETRY_DELAY = 0.5;
|
|
@@ -1893,6 +2014,9 @@ var Hydra = class {
|
|
|
1893
2014
|
lookbooks = new LookbooksResource(this);
|
|
1894
2015
|
// P11: Gift Cards
|
|
1895
2016
|
giftCards = new GiftCardsResource(this);
|
|
2017
|
+
// P12: Customer Auth
|
|
2018
|
+
auth = new AuthResource(this);
|
|
2019
|
+
me = new MeResource(this);
|
|
1896
2020
|
constructor(config) {
|
|
1897
2021
|
for (const key of Object.keys(config)) {
|
|
1898
2022
|
if (!VALID_CONFIG_KEYS.has(key)) {
|
|
@@ -2101,6 +2225,7 @@ var Hydra = class {
|
|
|
2101
2225
|
export {
|
|
2102
2226
|
AddressesResource,
|
|
2103
2227
|
AnalyticsResource,
|
|
2228
|
+
AuthResource,
|
|
2104
2229
|
BookingsResource,
|
|
2105
2230
|
CartResource,
|
|
2106
2231
|
ChannelsResource,
|
|
@@ -2132,6 +2257,7 @@ export {
|
|
|
2132
2257
|
InventoryResource,
|
|
2133
2258
|
LocationsResource,
|
|
2134
2259
|
LookbooksResource,
|
|
2260
|
+
MeResource,
|
|
2135
2261
|
MembershipPlansResource,
|
|
2136
2262
|
MetafieldsResource,
|
|
2137
2263
|
NotificationsResource,
|