@gethydra/sdk 0.1.29 → 0.1.32

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 CHANGED
@@ -92,6 +92,23 @@ interface components {
92
92
  /** @example true */
93
93
  confirmation_email: boolean;
94
94
  } | null;
95
+ /** @description Loyalty programme configuration */
96
+ loyalty_config: {
97
+ /** @example 500 */
98
+ earn_rate_bps: number;
99
+ /** @example 100 */
100
+ display_multiplier: number;
101
+ /** @example 365 */
102
+ expiry_days: number | null;
103
+ /** @example true */
104
+ activity_reset: boolean;
105
+ /** @example true */
106
+ exclude_gift_cards: boolean;
107
+ /** @example false */
108
+ exclude_services: boolean;
109
+ /** @example 0 */
110
+ min_order_total: number;
111
+ };
95
112
  pricing_config: {
96
113
  /** @example 2 */
97
114
  next_key_index: number;
@@ -635,7 +652,7 @@ interface components {
635
652
  * @example physical
636
653
  * @enum {string}
637
654
  */
638
- fulfillment_type: "physical" | "digital" | "service";
655
+ fulfillment_type: "physical" | "digital" | "service" | "gift_card";
639
656
  /** @example Restocking in Q3. */
640
657
  internal_notes: string | null;
641
658
  /** @example Polished Titanium */
@@ -1600,6 +1617,12 @@ interface components {
1600
1617
  * @enum {string|null}
1601
1618
  */
1602
1619
  discount_source: "code" | "manual" | "automatic" | null;
1620
+ /** @example 0 */
1621
+ store_credit_applied: number;
1622
+ /** @example 0 */
1623
+ gift_card_applied: number;
1624
+ /** @example null */
1625
+ gift_card_id: string | null;
1603
1626
  /** @example 7137 */
1604
1627
  total: number;
1605
1628
  /** @example USD */
@@ -3611,6 +3634,53 @@ interface components {
3611
3634
  */
3612
3635
  updated_at: string;
3613
3636
  };
3637
+ GiftCard: {
3638
+ id: string;
3639
+ code: string;
3640
+ /** @enum {string} */
3641
+ status: "active" | "deactivated";
3642
+ initial_balance: number;
3643
+ current_balance: number;
3644
+ currency: string;
3645
+ customer_id: string | null;
3646
+ source_order_id: string | null;
3647
+ recipient_email: string | null;
3648
+ recipient_name: string | null;
3649
+ sender_name: string | null;
3650
+ personal_message: string | null;
3651
+ note: string | null;
3652
+ expires_at: string | null;
3653
+ deactivated_at: string | null;
3654
+ metadata: {
3655
+ [key: string]: string | number;
3656
+ };
3657
+ created_at: string;
3658
+ updated_at: string;
3659
+ };
3660
+ GiftCardLookup: {
3661
+ current_balance: number;
3662
+ currency: string;
3663
+ /** @enum {string} */
3664
+ status: "active" | "deactivated";
3665
+ expires_at: string | null;
3666
+ };
3667
+ GiftCardTransaction: {
3668
+ id: string;
3669
+ gift_card_id: string;
3670
+ /** @enum {string} */
3671
+ type: "credit" | "debit" | "refund";
3672
+ amount: number;
3673
+ balance_after: number;
3674
+ reason: string;
3675
+ note: string | null;
3676
+ related_order_id: string | null;
3677
+ related_refund_id: string | null;
3678
+ metadata: {
3679
+ [key: string]: string | number;
3680
+ };
3681
+ created_at: string;
3682
+ updated_at: string;
3683
+ };
3614
3684
  Post: {
3615
3685
  /** @example post_abc123 */
3616
3686
  id: string;
@@ -4451,6 +4521,23 @@ interface operations {
4451
4521
  /** @example true */
4452
4522
  confirmation_email?: boolean;
4453
4523
  };
4524
+ /** @description Partial update — only provided fields are changed, others are preserved. */
4525
+ loyalty_config?: {
4526
+ /** @example 500 */
4527
+ earn_rate_bps?: number;
4528
+ /** @example 100 */
4529
+ display_multiplier?: number;
4530
+ /** @example 365 */
4531
+ expiry_days?: number | null;
4532
+ /** @example true */
4533
+ activity_reset?: boolean;
4534
+ /** @example true */
4535
+ exclude_gift_cards?: boolean;
4536
+ /** @example false */
4537
+ exclude_services?: boolean;
4538
+ /** @example 0 */
4539
+ min_order_total?: number;
4540
+ };
4454
4541
  };
4455
4542
  };
4456
4543
  };
@@ -6652,7 +6739,7 @@ interface operations {
6652
6739
  * @example physical
6653
6740
  * @enum {string}
6654
6741
  */
6655
- fulfillment_type?: "physical" | "digital" | "service";
6742
+ fulfillment_type?: "physical" | "digital" | "service" | "gift_card";
6656
6743
  /** @example Restocking in Q3. */
6657
6744
  internal_notes?: string;
6658
6745
  /** @example Polished Titanium */
@@ -6811,7 +6898,7 @@ interface operations {
6811
6898
  * @example physical
6812
6899
  * @enum {string}
6813
6900
  */
6814
- fulfillment_type?: "physical" | "digital" | "service";
6901
+ fulfillment_type?: "physical" | "digital" | "service" | "gift_card";
6815
6902
  /** @example Restocking in Q3. */
6816
6903
  internal_notes?: string;
6817
6904
  /** @example Polished Titanium */
@@ -7015,7 +7102,7 @@ interface operations {
7015
7102
  * @example physical
7016
7103
  * @enum {string}
7017
7104
  */
7018
- fulfillment_type?: "physical" | "digital" | "service";
7105
+ fulfillment_type?: "physical" | "digital" | "service" | "gift_card";
7019
7106
  /** @example Restocking in Q3. */
7020
7107
  internal_notes?: string | null;
7021
7108
  /** @example Polished Titanium */
@@ -10098,6 +10185,7 @@ interface operations {
10098
10185
  fields?: string;
10099
10186
  sort?: "created_at" | "updated_at" | "title" | "relevance";
10100
10187
  order?: "asc" | "desc";
10188
+ reason?: string;
10101
10189
  };
10102
10190
  header?: never;
10103
10191
  path: {
@@ -10142,6 +10230,26 @@ interface operations {
10142
10230
  };
10143
10231
  };
10144
10232
  };
10233
+ getCustomerLoyalty: {
10234
+ parameters: {
10235
+ query?: never;
10236
+ header?: never;
10237
+ path: {
10238
+ id: string;
10239
+ };
10240
+ cookie?: never;
10241
+ };
10242
+ requestBody?: never;
10243
+ responses: {
10244
+ /** @description Loyalty summary */
10245
+ 200: {
10246
+ headers: {
10247
+ [name: string]: unknown;
10248
+ };
10249
+ content?: never;
10250
+ };
10251
+ };
10252
+ };
10145
10253
  listCustomerMetafieldValues: {
10146
10254
  parameters: {
10147
10255
  query?: never;
@@ -11707,6 +11815,17 @@ interface operations {
11707
11815
  * @example 0
11708
11816
  */
11709
11817
  store_credit_applied?: number;
11818
+ /**
11819
+ * @description Amount of gift card balance (in minor units) to debit. Requires gift_card_id.
11820
+ * @default 0
11821
+ * @example 0
11822
+ */
11823
+ gift_card_applied?: number;
11824
+ /**
11825
+ * @description ID of the gift card to debit.
11826
+ * @example gc_abc123
11827
+ */
11828
+ gift_card_id?: string;
11710
11829
  /** @default {} */
11711
11830
  metadata?: {
11712
11831
  [key: string]: string | number;
@@ -13194,7 +13313,7 @@ interface operations {
13194
13313
  * "order.paid"
13195
13314
  * ]
13196
13315
  */
13197
- 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" | "membership.created" | "membership.updated" | "membership.cancelled" | "membership.expired" | "usage.warning" | "booking.created" | "booking.confirmed" | "booking.cancelled" | "booking.completed" | "lookbook.created" | "lookbook.updated" | "lookbook.deleted")[];
13316
+ 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")[];
13198
13317
  /**
13199
13318
  * @default active
13200
13319
  * @example active
@@ -13288,7 +13407,7 @@ interface operations {
13288
13407
  * "product.updated"
13289
13408
  * ]
13290
13409
  */
13291
- 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" | "membership.created" | "membership.updated" | "membership.cancelled" | "membership.expired" | "usage.warning" | "booking.created" | "booking.confirmed" | "booking.cancelled" | "booking.completed" | "lookbook.created" | "lookbook.updated" | "lookbook.deleted")[];
13410
+ 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")[];
13292
13411
  /**
13293
13412
  * @example active
13294
13413
  * @enum {string}
@@ -15228,7 +15347,7 @@ interface operations {
15228
15347
  /** @example Approved by Alice */
15229
15348
  staff_note?: string;
15230
15349
  /**
15231
- * @description Where to send the refund. "card" refunds to the original payment method via Stripe; "store_credit" adds the amount to the customer's store credit balance; "cash" is record-keeping only (staff hands cash to customer).
15350
+ * @description Where to send the refund. "card" refunds to the original payment method via Stripe; "store_credit" adds the amount to the customer's store credit balance; "gift_card" credits the gift card used on this order; "cash" is record-keeping only (staff hands cash to customer).
15232
15351
  * @default card
15233
15352
  * @example card
15234
15353
  * @enum {string}
@@ -17240,6 +17359,324 @@ interface operations {
17240
17359
  };
17241
17360
  };
17242
17361
  };
17362
+ listGiftCards: {
17363
+ parameters: {
17364
+ query?: {
17365
+ limit?: number;
17366
+ cursor?: string;
17367
+ fields?: string;
17368
+ sort?: "created_at" | "updated_at";
17369
+ order?: "asc" | "desc";
17370
+ status?: "active" | "deactivated";
17371
+ customer_id?: string;
17372
+ };
17373
+ header?: never;
17374
+ path?: never;
17375
+ cookie?: never;
17376
+ };
17377
+ requestBody?: never;
17378
+ responses: {
17379
+ /** @description Paginated gift card list */
17380
+ 200: {
17381
+ headers: {
17382
+ [name: string]: unknown;
17383
+ };
17384
+ content: {
17385
+ "application/json": {
17386
+ data: components["schemas"]["GiftCard"][];
17387
+ pagination: {
17388
+ cursor: string | null;
17389
+ has_more: boolean;
17390
+ total: number;
17391
+ };
17392
+ };
17393
+ };
17394
+ };
17395
+ };
17396
+ };
17397
+ createGiftCard: {
17398
+ parameters: {
17399
+ query?: never;
17400
+ header?: never;
17401
+ path?: never;
17402
+ cookie?: never;
17403
+ };
17404
+ requestBody?: {
17405
+ content: {
17406
+ "application/json": {
17407
+ /**
17408
+ * @description Initial balance in minor units (e.g. 5000 = £50.00).
17409
+ * @example 5000
17410
+ */
17411
+ initial_balance: number;
17412
+ /**
17413
+ * @description Currency code. Defaults to store currency if omitted.
17414
+ * @example GBP
17415
+ */
17416
+ currency?: string;
17417
+ /**
17418
+ * @description Customer who purchased this gift card.
17419
+ * @example cus_abc123
17420
+ */
17421
+ customer_id?: string;
17422
+ /**
17423
+ * Format: email
17424
+ * @description Email address to deliver the gift card code.
17425
+ * @example recipient@example.com
17426
+ */
17427
+ recipient_email?: string;
17428
+ /** @example Jane Doe */
17429
+ recipient_name?: string;
17430
+ /** @example John Smith */
17431
+ sender_name?: string;
17432
+ /** @example Happy birthday! */
17433
+ personal_message?: string;
17434
+ /** @description Internal staff note. */
17435
+ note?: string;
17436
+ /**
17437
+ * Format: date-time
17438
+ * @description Optional expiration date (ISO 8601).
17439
+ */
17440
+ expires_at?: string;
17441
+ /** @default {} */
17442
+ metadata?: {
17443
+ [key: string]: string | number;
17444
+ };
17445
+ };
17446
+ };
17447
+ };
17448
+ responses: {
17449
+ /** @description Gift card created */
17450
+ 201: {
17451
+ headers: {
17452
+ [name: string]: unknown;
17453
+ };
17454
+ content: {
17455
+ "application/json": {
17456
+ data: components["schemas"]["GiftCard"];
17457
+ };
17458
+ };
17459
+ };
17460
+ };
17461
+ };
17462
+ lookupGiftCard: {
17463
+ parameters: {
17464
+ query: {
17465
+ /** @description Gift card code. */
17466
+ code: string;
17467
+ };
17468
+ header?: never;
17469
+ path?: never;
17470
+ cookie?: never;
17471
+ };
17472
+ requestBody?: never;
17473
+ responses: {
17474
+ /** @description Gift card balance */
17475
+ 200: {
17476
+ headers: {
17477
+ [name: string]: unknown;
17478
+ };
17479
+ content: {
17480
+ "application/json": {
17481
+ data: components["schemas"]["GiftCardLookup"];
17482
+ };
17483
+ };
17484
+ };
17485
+ };
17486
+ };
17487
+ getGiftCard: {
17488
+ parameters: {
17489
+ query?: never;
17490
+ header?: never;
17491
+ path: {
17492
+ id: string;
17493
+ };
17494
+ cookie?: never;
17495
+ };
17496
+ requestBody?: never;
17497
+ responses: {
17498
+ /** @description Gift card details */
17499
+ 200: {
17500
+ headers: {
17501
+ [name: string]: unknown;
17502
+ };
17503
+ content: {
17504
+ "application/json": {
17505
+ data: components["schemas"]["GiftCard"];
17506
+ };
17507
+ };
17508
+ };
17509
+ };
17510
+ };
17511
+ updateGiftCard: {
17512
+ parameters: {
17513
+ query?: never;
17514
+ header?: never;
17515
+ path: {
17516
+ id: string;
17517
+ };
17518
+ cookie?: never;
17519
+ };
17520
+ requestBody?: {
17521
+ content: {
17522
+ "application/json": {
17523
+ note?: string | null;
17524
+ /** Format: date-time */
17525
+ expires_at?: string | null;
17526
+ /** Format: email */
17527
+ recipient_email?: string | null;
17528
+ recipient_name?: string | null;
17529
+ sender_name?: string | null;
17530
+ personal_message?: string | null;
17531
+ metadata?: {
17532
+ [key: string]: string | number;
17533
+ };
17534
+ };
17535
+ };
17536
+ };
17537
+ responses: {
17538
+ /** @description Gift card updated */
17539
+ 200: {
17540
+ headers: {
17541
+ [name: string]: unknown;
17542
+ };
17543
+ content: {
17544
+ "application/json": {
17545
+ data: components["schemas"]["GiftCard"];
17546
+ };
17547
+ };
17548
+ };
17549
+ };
17550
+ };
17551
+ deactivateGiftCard: {
17552
+ parameters: {
17553
+ query?: never;
17554
+ header?: never;
17555
+ path: {
17556
+ id: string;
17557
+ };
17558
+ cookie?: never;
17559
+ };
17560
+ requestBody?: never;
17561
+ responses: {
17562
+ /** @description Gift card deactivated */
17563
+ 200: {
17564
+ headers: {
17565
+ [name: string]: unknown;
17566
+ };
17567
+ content: {
17568
+ "application/json": {
17569
+ data: components["schemas"]["GiftCard"];
17570
+ };
17571
+ };
17572
+ };
17573
+ };
17574
+ };
17575
+ listGiftCardTransactions: {
17576
+ parameters: {
17577
+ query?: {
17578
+ limit?: number;
17579
+ cursor?: string;
17580
+ fields?: string;
17581
+ sort?: "created_at" | "updated_at";
17582
+ order?: "asc" | "desc";
17583
+ };
17584
+ header?: never;
17585
+ path: {
17586
+ id: string;
17587
+ };
17588
+ cookie?: never;
17589
+ };
17590
+ requestBody?: never;
17591
+ responses: {
17592
+ /** @description Paginated transaction list */
17593
+ 200: {
17594
+ headers: {
17595
+ [name: string]: unknown;
17596
+ };
17597
+ content: {
17598
+ "application/json": {
17599
+ data: components["schemas"]["GiftCardTransaction"][];
17600
+ pagination: {
17601
+ cursor: string | null;
17602
+ has_more: boolean;
17603
+ total: number;
17604
+ };
17605
+ };
17606
+ };
17607
+ };
17608
+ };
17609
+ };
17610
+ creditGiftCard: {
17611
+ parameters: {
17612
+ query?: never;
17613
+ header?: never;
17614
+ path: {
17615
+ id: string;
17616
+ };
17617
+ cookie?: never;
17618
+ };
17619
+ requestBody?: {
17620
+ content: {
17621
+ "application/json": {
17622
+ /**
17623
+ * @description Amount to add in minor units.
17624
+ * @example 1000
17625
+ */
17626
+ amount: number;
17627
+ note?: string;
17628
+ };
17629
+ };
17630
+ };
17631
+ responses: {
17632
+ /** @description Credit applied */
17633
+ 201: {
17634
+ headers: {
17635
+ [name: string]: unknown;
17636
+ };
17637
+ content: {
17638
+ "application/json": {
17639
+ data: components["schemas"]["GiftCardTransaction"];
17640
+ };
17641
+ };
17642
+ };
17643
+ };
17644
+ };
17645
+ debitGiftCard: {
17646
+ parameters: {
17647
+ query?: never;
17648
+ header?: never;
17649
+ path: {
17650
+ id: string;
17651
+ };
17652
+ cookie?: never;
17653
+ };
17654
+ requestBody?: {
17655
+ content: {
17656
+ "application/json": {
17657
+ /**
17658
+ * @description Amount to deduct in minor units.
17659
+ * @example 1000
17660
+ */
17661
+ amount: number;
17662
+ note?: string;
17663
+ };
17664
+ };
17665
+ };
17666
+ responses: {
17667
+ /** @description Debit applied */
17668
+ 201: {
17669
+ headers: {
17670
+ [name: string]: unknown;
17671
+ };
17672
+ content: {
17673
+ "application/json": {
17674
+ data: components["schemas"]["GiftCardTransaction"];
17675
+ };
17676
+ };
17677
+ };
17678
+ };
17679
+ };
17243
17680
  listPosts: {
17244
17681
  parameters: {
17245
17682
  query?: {
@@ -18193,7 +18630,7 @@ interface operations {
18193
18630
  sort?: "created_at" | "updated_at" | "title" | "relevance";
18194
18631
  order?: "asc" | "desc";
18195
18632
  /** @description Filter by notification type */
18196
- type?: "email_verification" | "welcome" | "password_reset" | "password_changed" | "order_confirmation" | "order_cancelled" | "refund_issued" | "draft_order_payment_request" | "shipping_confirmation" | "delivery_confirmation" | "cart_recovery" | "booking_confirmation" | "new_order" | "low_stock" | "domain_warning" | "domain_revoked" | "domain_recovered";
18633
+ type?: "email_verification" | "welcome" | "password_reset" | "password_changed" | "order_confirmation" | "order_cancelled" | "refund_issued" | "draft_order_payment_request" | "shipping_confirmation" | "delivery_confirmation" | "cart_recovery" | "booking_confirmation" | "gift_card_delivery" | "new_order" | "low_stock" | "domain_warning" | "domain_revoked" | "domain_recovered";
18197
18634
  /** @description Filter by delivery status */
18198
18635
  status?: "sent" | "failed" | "skipped";
18199
18636
  /** @description Filter by recipient email */
@@ -18266,7 +18703,7 @@ interface operations {
18266
18703
  * @example new_order
18267
18704
  * @enum {string}
18268
18705
  */
18269
- type: "email_verification" | "welcome" | "password_reset" | "password_changed" | "order_confirmation" | "order_cancelled" | "refund_issued" | "draft_order_payment_request" | "shipping_confirmation" | "delivery_confirmation" | "cart_recovery" | "booking_confirmation" | "new_order" | "low_stock" | "domain_warning" | "domain_revoked" | "domain_recovered";
18706
+ type: "email_verification" | "welcome" | "password_reset" | "password_changed" | "order_confirmation" | "order_cancelled" | "refund_issued" | "draft_order_payment_request" | "shipping_confirmation" | "delivery_confirmation" | "cart_recovery" | "booking_confirmation" | "gift_card_delivery" | "new_order" | "low_stock" | "domain_warning" | "domain_revoked" | "domain_recovered";
18270
18707
  /**
18271
18708
  * Format: email
18272
18709
  * @description Email address to send the test to
@@ -19142,6 +19579,7 @@ interface operations {
19142
19579
  fields?: string;
19143
19580
  sort?: "created_at" | "updated_at" | "title" | "relevance";
19144
19581
  order?: "asc" | "desc";
19582
+ reason?: string;
19145
19583
  };
19146
19584
  header?: never;
19147
19585
  path?: never;
@@ -20425,10 +20863,22 @@ type CreditTransaction = NonNullable<operations['issueCustomerCredit']['response
20425
20863
  type CreditBalance = NonNullable<operations['getCustomerCredit']['responses']['200']['content']['application/json']['data']>;
20426
20864
  type ListParams$6 = NonNullable<operations['listCustomerCreditTransactions']['parameters']['query']>;
20427
20865
  type IssueCreditBody = NonNullable<operations['issueCustomerCredit']['requestBody']>['content']['application/json'];
20866
+ interface LoyaltySummary {
20867
+ enabled: boolean;
20868
+ lifetime_earned_credit?: number;
20869
+ lifetime_earned_points?: number;
20870
+ active_loyalty_credit?: number;
20871
+ active_loyalty_points?: number;
20872
+ clawed_back_credit?: number;
20873
+ expired_credit?: number;
20874
+ display_multiplier?: number;
20875
+ earn_rate_bps?: number;
20876
+ }
20428
20877
  declare class StoreCreditResource {
20429
20878
  private client;
20430
20879
  constructor(client: Hydra);
20431
20880
  getBalance(customerId: string): Promise<DataResponse<CreditBalance>>;
20881
+ getLoyalty(customerId: string): Promise<DataResponse<LoyaltySummary>>;
20432
20882
  issue(customerId: string, body: IssueCreditBody, options?: ResourceRequestOptions): Promise<DataResponse<CreditTransaction>>;
20433
20883
  listTransactions(customerId: string, params?: ListParams$6): Promise<ListResponse<CreditTransaction>>;
20434
20884
  iterateTransactions(customerId: string, params?: Omit<ListParams$6, 'cursor'>, options?: PaginateOptions): AsyncGenerator<CreditTransaction, void, undefined>;
@@ -20713,6 +21163,111 @@ declare class LookbooksResource {
20713
21163
  }>;
20714
21164
  }
20715
21165
 
21166
+ /** Gift card object returned by the API. */
21167
+ interface GiftCard {
21168
+ id: string;
21169
+ code: string;
21170
+ status: 'active' | 'deactivated';
21171
+ initial_balance: number;
21172
+ current_balance: number;
21173
+ currency: string;
21174
+ customer_id: string | null;
21175
+ source_order_id: string | null;
21176
+ recipient_email: string | null;
21177
+ recipient_name: string | null;
21178
+ sender_name: string | null;
21179
+ personal_message: string | null;
21180
+ note: string | null;
21181
+ expires_at: string | null;
21182
+ deactivated_at: string | null;
21183
+ metadata: Record<string, string | number>;
21184
+ created_at: string;
21185
+ updated_at: string;
21186
+ }
21187
+ /** Gift card transaction object returned by the API. */
21188
+ interface GiftCardTransaction {
21189
+ id: string;
21190
+ gift_card_id: string;
21191
+ type: 'credit' | 'debit' | 'refund';
21192
+ amount: number;
21193
+ balance_after: number;
21194
+ reason: string;
21195
+ note: string | null;
21196
+ related_order_id: string | null;
21197
+ related_refund_id: string | null;
21198
+ metadata: Record<string, string | number>;
21199
+ created_at: string;
21200
+ updated_at: string;
21201
+ }
21202
+ /** Reduced lookup response (safe for storefront/POS). */
21203
+ interface GiftCardLookup {
21204
+ current_balance: number;
21205
+ currency: string;
21206
+ status: 'active' | 'deactivated';
21207
+ expires_at: string | null;
21208
+ }
21209
+ type ListGiftCardsParams = {
21210
+ limit?: number;
21211
+ cursor?: string;
21212
+ sort?: 'created_at' | 'updated_at';
21213
+ order?: 'asc' | 'desc';
21214
+ status?: 'active' | 'deactivated';
21215
+ customer_id?: string;
21216
+ };
21217
+ type ListGiftCardTransactionsParams = {
21218
+ limit?: number;
21219
+ cursor?: string;
21220
+ sort?: 'created_at' | 'updated_at';
21221
+ order?: 'asc' | 'desc';
21222
+ };
21223
+ interface CreateGiftCardBody {
21224
+ initial_balance: number;
21225
+ currency?: string;
21226
+ customer_id?: string;
21227
+ recipient_email?: string;
21228
+ recipient_name?: string;
21229
+ sender_name?: string;
21230
+ personal_message?: string;
21231
+ note?: string;
21232
+ expires_at?: string;
21233
+ metadata?: Record<string, string | number>;
21234
+ }
21235
+ interface UpdateGiftCardBody {
21236
+ note?: string | null;
21237
+ expires_at?: string | null;
21238
+ recipient_email?: string | null;
21239
+ recipient_name?: string | null;
21240
+ sender_name?: string | null;
21241
+ personal_message?: string | null;
21242
+ metadata?: Record<string, string | number>;
21243
+ }
21244
+ interface CreditDebitBody {
21245
+ amount: number;
21246
+ note?: string;
21247
+ }
21248
+ declare class GiftCardsResource {
21249
+ private client;
21250
+ constructor(client: Hydra);
21251
+ list(params?: ListGiftCardsParams): Promise<ListResponse<GiftCard>>;
21252
+ iterate(params?: Omit<ListGiftCardsParams, 'cursor'>, options?: PaginateOptions): AsyncGenerator<GiftCard, void, undefined>;
21253
+ toArray(params?: Omit<ListGiftCardsParams, 'cursor'>, options?: PaginateOptions & {
21254
+ limit?: number;
21255
+ }): Promise<GiftCard[]>;
21256
+ get(id: string): Promise<DataResponse<GiftCard>>;
21257
+ create(body: CreateGiftCardBody, options?: ResourceRequestOptions): Promise<DataResponse<GiftCard>>;
21258
+ update(id: string, body: UpdateGiftCardBody): Promise<DataResponse<GiftCard>>;
21259
+ deactivate(id: string): Promise<DataResponse<GiftCard>>;
21260
+ listTransactions(id: string, params?: ListGiftCardTransactionsParams): Promise<ListResponse<GiftCardTransaction>>;
21261
+ iterateTransactions(id: string, params?: Omit<ListGiftCardTransactionsParams, 'cursor'>, options?: PaginateOptions): AsyncGenerator<GiftCardTransaction, void, undefined>;
21262
+ transactionsToArray(id: string, params?: Omit<ListGiftCardTransactionsParams, 'cursor'>, options?: PaginateOptions & {
21263
+ limit?: number;
21264
+ }): Promise<GiftCardTransaction[]>;
21265
+ credit(id: string, body: CreditDebitBody, options?: ResourceRequestOptions): Promise<DataResponse<GiftCard>>;
21266
+ debit(id: string, body: CreditDebitBody, options?: ResourceRequestOptions): Promise<DataResponse<GiftCard>>;
21267
+ /** Look up a gift card by code (publishable key OK). */
21268
+ lookup(code: string): Promise<DataResponse<GiftCardLookup>>;
21269
+ }
21270
+
20716
21271
  interface AppInfo {
20717
21272
  /** Integration/plugin name (e.g. "MyShopTheme") */
20718
21273
  name: string;
@@ -20796,6 +21351,7 @@ declare class Hydra {
20796
21351
  readonly membershipPlans: MembershipPlansResource;
20797
21352
  readonly bookings: BookingsResource;
20798
21353
  readonly lookbooks: LookbooksResource;
21354
+ readonly giftCards: GiftCardsResource;
20799
21355
  constructor(config: HydraConfig);
20800
21356
  request<T>(method: string, path: string, options?: RequestOptions): Promise<T>;
20801
21357
  /** Multipart upload for file-based endpoints (e.g. images) */
@@ -20877,4 +21433,4 @@ declare class HydraIdempotencyError extends HydraError {
20877
21433
  constructor(body: HydraErrorBody, headers: Headers);
20878
21434
  }
20879
21435
 
20880
- 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 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, 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 ListResponse, type Location$1 as Location, LocationsResource, type Lookbook$1 as Lookbook, type LookbookTag$1 as LookbookTag, LookbooksResource, type MembershipPlan$1 as MembershipPlan, MembershipPlansResource, MetafieldsResource, type NotificationLog$1 as NotificationLog, NotificationsResource, type Order$2 as Order, OrdersResource, type PaginateOptions, type Pagination, 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 Variant$2 as Variant, type VariantPrice$1 as VariantPrice, VariantsResource, type Webhook$1 as Webhook, WebhooksResource, paginate, toArray };
21436
+ 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 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 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 };
package/dist/index.js CHANGED
@@ -1381,6 +1381,9 @@ var StoreCreditResource = class {
1381
1381
  async getBalance(customerId) {
1382
1382
  return this.client.request("GET", `/v1/customers/${customerId}/credit`);
1383
1383
  }
1384
+ async getLoyalty(customerId) {
1385
+ return this.client.request("GET", `/v1/customers/${customerId}/loyalty`);
1386
+ }
1384
1387
  async issue(customerId, body, options) {
1385
1388
  return this.client.request("POST", `/v1/customers/${customerId}/credit`, {
1386
1389
  body,
@@ -1746,6 +1749,57 @@ var LookbooksResource = class {
1746
1749
  }
1747
1750
  };
1748
1751
 
1752
+ // src/resources/gift-cards.ts
1753
+ var GiftCardsResource = class {
1754
+ constructor(client) {
1755
+ this.client = client;
1756
+ }
1757
+ client;
1758
+ async list(params) {
1759
+ return this.client.request("GET", "/v1/gift-cards", { params });
1760
+ }
1761
+ iterate(params, options) {
1762
+ return paginate((cursor) => this.list({ ...params, cursor }), options);
1763
+ }
1764
+ async toArray(params, options) {
1765
+ return toArray(this.iterate(params, options), options);
1766
+ }
1767
+ async get(id) {
1768
+ return this.client.request("GET", `/v1/gift-cards/${id}`);
1769
+ }
1770
+ async create(body, options) {
1771
+ return this.client.request("POST", "/v1/gift-cards", { body, ...options });
1772
+ }
1773
+ async update(id, body) {
1774
+ return this.client.request("PUT", `/v1/gift-cards/${id}`, { body });
1775
+ }
1776
+ async deactivate(id) {
1777
+ return this.client.request("POST", `/v1/gift-cards/${id}/deactivate`);
1778
+ }
1779
+ async listTransactions(id, params) {
1780
+ return this.client.request("GET", `/v1/gift-cards/${id}/transactions`, { params });
1781
+ }
1782
+ iterateTransactions(id, params, options) {
1783
+ return paginate(
1784
+ (cursor) => this.listTransactions(id, { ...params, cursor }),
1785
+ options
1786
+ );
1787
+ }
1788
+ async transactionsToArray(id, params, options) {
1789
+ return toArray(this.iterateTransactions(id, params, options), options);
1790
+ }
1791
+ async credit(id, body, options) {
1792
+ return this.client.request("POST", `/v1/gift-cards/${id}/credit`, { body, ...options });
1793
+ }
1794
+ async debit(id, body, options) {
1795
+ return this.client.request("POST", `/v1/gift-cards/${id}/debit`, { body, ...options });
1796
+ }
1797
+ /** Look up a gift card by code (publishable key OK). */
1798
+ async lookup(code) {
1799
+ return this.client.request("GET", "/v1/gift-cards/lookup", { params: { code } });
1800
+ }
1801
+ };
1802
+
1749
1803
  // src/client.ts
1750
1804
  var SDK_VERSION = "0.1.0";
1751
1805
  var INITIAL_RETRY_DELAY = 0.5;
@@ -1830,6 +1884,8 @@ var Hydra = class {
1830
1884
  bookings = new BookingsResource(this);
1831
1885
  // P10: Lookbooks
1832
1886
  lookbooks = new LookbooksResource(this);
1887
+ // P11: Gift Cards
1888
+ giftCards = new GiftCardsResource(this);
1833
1889
  constructor(config) {
1834
1890
  for (const key of Object.keys(config)) {
1835
1891
  if (!VALID_CONFIG_KEYS.has(key)) {
@@ -2054,6 +2110,7 @@ export {
2054
2110
  ExchangeRatesResource,
2055
2111
  FulfillmentOrdersResource,
2056
2112
  FulfillmentsResource,
2113
+ GiftCardsResource,
2057
2114
  Hydra,
2058
2115
  HydraAuthenticationError,
2059
2116
  HydraConnectionError,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gethydra/sdk",
3
- "version": "0.1.29",
3
+ "version": "0.1.32",
4
4
  "description": "Official TypeScript SDK for the Hydra Commerce API",
5
5
  "license": "MIT",
6
6
  "author": "Grant Capital Group",