From 6ad5ffceaba01b2aa859a14565c3f794ffa9ec37 Mon Sep 17 00:00:00 2001 From: Daniil Bratukhin Date: Wed, 8 May 2024 18:02:50 -0300 Subject: [PATCH 1/2] fix(rumour): include links in patch object --- src/core/Rumour/Rumour.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/core/Rumour/Rumour.ts b/src/core/Rumour/Rumour.ts index 15325dc..7fcf0a2 100644 --- a/src/core/Rumour/Rumour.ts +++ b/src/core/Rumour/Rumour.ts @@ -126,7 +126,7 @@ export class Rumour { if (!Rumour.__isResource(value) || Rumour.__isCollection(value)) return patch; const props = traverse(value).map(function () { - if (this.key?.startsWith('_')) this.delete(true); + if (this.key === '_embedded') return this.delete(true); }); patch.set(value._links.self.href, props); From 8763e5cd843d8add487fd41a70e28831a68ccff5 Mon Sep 17 00:00:00 2001 From: Daniil Bratukhin Date: Wed, 8 May 2024 18:11:51 -0300 Subject: [PATCH 2/2] fix: fix existing type definitions and add new ones --- src/backend/Graph/coupon.d.ts | 9 +++++++++ src/backend/Graph/customer_portal_settings.d.ts | 15 +++++---------- src/backend/Graph/gift_card.d.ts | 3 +++ src/backend/Graph/gift_card_code.d.ts | 2 ++ 4 files changed, 19 insertions(+), 10 deletions(-) diff --git a/src/backend/Graph/coupon.d.ts b/src/backend/Graph/coupon.d.ts index 6f0f6e1..855ab98 100644 --- a/src/backend/Graph/coupon.d.ts +++ b/src/backend/Graph/coupon.d.ts @@ -1,3 +1,4 @@ +import type { Attributes } from './attributes'; import type { CouponCodes } from './coupon_codes'; import type { CouponItemCategories } from './coupon_item_categories'; import type { GenerateCodes } from './generate_codes'; @@ -12,6 +13,8 @@ export interface Coupon extends Graph { 'self': Coupon; /** Store this coupon belongs to. */ 'fx:store': Store; + /** Attributes linked to this coupon. */ + 'fx:attributes': Attributes; /** Codes linked to this coupon. */ 'fx:coupon_codes': CouponCodes; /** POST here to generate random coupon codes. */ @@ -57,6 +60,12 @@ export interface Coupon extends Graph { customer_attribute_restrictions: string; /** Auto-apply coupons only. This coupon will be automatically applied when a subscription includes a product with one of the codes in the list. Wildcards are allowed just like in product code restrictions. Example: `code_1,code_2,sku_*,abc`. */ customer_subscription_restrictions: string; + /** This restricts the usage of a coupon code based on an item's `item_option` key and value. Valid input is a json object with the keys matching the `item_option.name`, and the value an array of comma-separated matching or partially matching strings, using `*` as a wild card at the beginning, end, or middle of the string. So `{"author": ["Agatha*", "*brown"]}` will match the item where item option "author" is "Agatha Christie" or "Dan Brown". It would not match an item with no "author" option, or with an "author" of "John Doe". Optional. 6000 characters or less. */ + item_option_restrictions: null | Record; + /** Enables sharing coupon codes between coupons. */ + shared_codes_allowed: boolean; + /** This param is using for coupon calculation amount for tax inclusive mode. Optional. [0..1]. */ + inclusive_tax_rate: number; /** The date this resource was created. */ date_created: string | null; /** The date this resource was last modified. */ diff --git a/src/backend/Graph/customer_portal_settings.d.ts b/src/backend/Graph/customer_portal_settings.d.ts index 840d1cf..91fc217 100644 --- a/src/backend/Graph/customer_portal_settings.d.ts +++ b/src/backend/Graph/customer_portal_settings.d.ts @@ -76,14 +76,9 @@ export interface CustomerPortalSettings extends Graph { date_created: string | null; /** The date this resource was last modified. */ date_modified: string | null; - } & ( - | { - /** Shared secret key. */ - jwtSharedSecret: string; - } - | { - /** Private key for JWT signing. */ - jwtPrivateKey: string; - } - ); + /** Shared secret key. */ + jwtSharedSecret: string; + /** Private key for JWT signing, read-only. */ + jwtPrivateKey?: string; + }; } diff --git a/src/backend/Graph/gift_card.d.ts b/src/backend/Graph/gift_card.d.ts index 6919793..b3434bf 100644 --- a/src/backend/Graph/gift_card.d.ts +++ b/src/backend/Graph/gift_card.d.ts @@ -1,3 +1,4 @@ +import type { Attributes } from './attributes'; import type { GenerateCodes } from './generate_codes'; import type { GiftCardCodes } from './gift_card_codes'; import type { GiftCardItemCategories } from './gift_card_item_categories'; @@ -12,6 +13,8 @@ export interface GiftCard extends Graph { 'self': GiftCard; /** Store this gift card is assigned to. */ 'fx:store': Store; + /** Attributes linked to this gift card. */ + 'fx:attributes': Attributes; /** POST here to generate random gift card codes. */ 'fx:generate_codes': GenerateCodes; /** Collection of codes for this gift card. */ diff --git a/src/backend/Graph/gift_card_code.d.ts b/src/backend/Graph/gift_card_code.d.ts index f2f36f4..5879103 100644 --- a/src/backend/Graph/gift_card_code.d.ts +++ b/src/backend/Graph/gift_card_code.d.ts @@ -30,6 +30,8 @@ export interface GiftCardCode extends Graph { end_date: string | null; /** Current balance on the gift card. Decimal. Required. */ current_balance: number; + /** PATCH-only: use this field to link this gift card code to a customer. */ + customer_id?: number | string; /** The date this resource was created. Readonly. */ date_created: string | null; /** The date this resource was last modified. Readonly. */