@pvh-afl/graphql 1.2.50 → 1.2.51

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.
@@ -1,5 +1,6 @@
1
+ import { AuthUser } from '@pvh-afl/core';
1
2
  import { CartService } from './cart.service';
2
- import { Cart, CartLineInput, CartLineUpdateInput, CartBuyerIdentityInput, CartAttributeInput } from './cart.types';
3
+ import { Cart, CartLineInput, CartLineUpdateInput, CartBuyerIdentityInput, CartAttributeInput, SyncCapillaryCouponResult } from './cart.types';
3
4
  interface GqlContext {
4
5
  req: {
5
6
  brand: string;
@@ -18,6 +19,7 @@ export declare class CartResolver {
18
19
  cartNoteUpdate(ctx: GqlContext, cartId: string, note: string): Promise<Cart>;
19
20
  cartAttributesUpdate(ctx: GqlContext, cartId: string, attributes: CartAttributeInput[]): Promise<Cart>;
20
21
  cartGiftCardCodesUpdate(ctx: GqlContext, cartId: string, giftCardCodes: string[]): Promise<Cart>;
22
+ syncCapillaryCoupon(user: AuthUser, ctx: GqlContext, couponCode: string, mobile: string, shopifyCustomerId: string): Promise<SyncCapillaryCouponResult>;
21
23
  }
22
24
  export {};
23
25
  //# sourceMappingURL=cart.resolver.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"cart.resolver.d.ts","sourceRoot":"","sources":["../../src/cart/cart.resolver.ts"],"names":[],"mappings":"AAYA,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAC7C,OAAO,EACL,IAAI,EACJ,aAAa,EACb,mBAAmB,EACnB,sBAAsB,EACtB,kBAAkB,EAGnB,MAAM,cAAc,CAAC;AAEtB,UAAU,UAAU;IAClB,GAAG,EAAE;QAAE,KAAK,EAAE,MAAM,CAAA;KAAE,CAAC;CACxB;AAED,qBAEa,YAAY;IACX,OAAO,CAAC,QAAQ,CAAC,WAAW;gBAAX,WAAW,EAAE,WAAW;IAG/C,IAAI,CACG,GAAG,EAAE,UAAU,EACU,EAAE,EAAE,MAAM,G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ACc,MAAM,EAAE,MAAM,EAChB,IAAI,EAAE,MAAM,GACjD,OAAO,CAAC,IAAI,CAAC;IAKV,oBAAoB,CACb,GAAG,EAAE,UAAU,EACc,MAAM,EAAE,MAAM,EACI,UAAU,EAAE,kBAAkB,EAAE,GACzF,OAAO,CAAC,IAAI,CAAC;IAKV,uBAAuB,CAChB,GAAG,EAAE,UAAU,EACc,MAAM,EAAE,MAAM,EACL,aAAa,EAAE,MAAM,EAAE,GACvE,OAAO,CAAC,IAAI,CAAC;IA2BV,mBAAmB,CACR,IAAI,EAAE,QAAQ,EAClB,GAAG,EAAE,UAAU,EAC4E,UAAU,EAAE,MAAM,EACW,MAAM,EAAE,MAAM,EACd,iBAAiB,EAAE,MAAM,GAC3J,OAAO,CAAC,yBAAyB,CAAC;CAYtC"}
@@ -42,6 +42,27 @@ let CartResolver = class CartResolver {
42
42
  async cartGiftCardCodesUpdate(ctx, cartId, giftCardCodes) {
43
43
  return this.cartService.updateGiftCardCodes(ctx.req.brand, cartId, giftCardCodes);
44
44
  }
45
+ // ===================================================================
46
+ // The syncCapillaryCoupon mutation validates a coupon with Capillary and
47
+ // syncs it to Shopify. Gated by CAPILLARY_ENABLED (isCapillaryEnabled): it
48
+ // stays in the schema, but when the flag is off it short-circuits before
49
+ // touching the CART_HOOKS binding, so there is no runtime throw in production.
50
+ // NOTE: this file is shared (@pvh-afl/graphql) — the mutation exists for every
51
+ // brand consuming the package; only brands with the flag on and hooks bound
52
+ // will exercise it.
53
+ // -------------------------------------------------------------------
54
+ async syncCapillaryCoupon(user, ctx, couponCode, mobile, shopifyCustomerId) {
55
+ if (!(0, core_1.isCapillaryEnabled)()) {
56
+ throw new common_1.ServiceUnavailableException('Loyalty (Capillary) is not enabled');
57
+ }
58
+ // This validates a coupon against a Capillary account and then creates a
59
+ // Shopify discount bound to a customer. Both identifiers must be the
60
+ // caller's own, or a coupon belonging to one customer could be attached to
61
+ // another customer's account.
62
+ (0, core_1.assertOwnsPhone)(user, mobile);
63
+ (0, core_1.assertOwnsCustomer)(user, shopifyCustomerId);
64
+ return this.cartService.syncCapillaryCoupon(ctx.req.brand, couponCode, mobile, shopifyCustomerId);
65
+ }
45
66
  };
46
67
  exports.CartResolver = CartResolver;
47
68
  tslib_1.__decorate([
@@ -146,6 +167,30 @@ tslib_1.__decorate([
146
167
  tslib_1.__metadata("design:paramtypes", [Object, String, Array]),
147
168
  tslib_1.__metadata("design:returntype", Promise)
148
169
  ], CartResolver.prototype, "cartGiftCardCodesUpdate", null);
170
+ tslib_1.__decorate([
171
+ (0, graphql_1.Mutation)(() => cart_types_1.SyncCapillaryCouponResult, {
172
+ description: `Sync a Capillary coupon to Shopify.
173
+
174
+ Validates the coupon with Capillary and creates/updates the corresponding Shopify discount code.
175
+
176
+ Flow:
177
+ 1. Validate coupon with Capillary API
178
+ 2. If valid, create or update Shopify discount code with customer in prerequisite_customer_ids
179
+ 3. Return result with discount details
180
+
181
+ Use this mutation when you need to pre-sync a coupon before checkout, or when handling
182
+ coupon eligibility for specific customers.`,
183
+ }),
184
+ (0, common_1.UseGuards)(core_1.JwtAuthGuard),
185
+ tslib_1.__param(0, (0, core_1.CurrentUser)()),
186
+ tslib_1.__param(1, (0, graphql_1.Context)()),
187
+ tslib_1.__param(2, (0, graphql_1.Args)('couponCode', { type: () => String, description: 'The Capillary coupon code (original code)' })),
188
+ tslib_1.__param(3, (0, graphql_1.Args)('mobile', { type: () => String, description: "Customer mobile number for Capillary validation. Must be the caller's own." })),
189
+ tslib_1.__param(4, (0, graphql_1.Args)('shopifyCustomerId', { type: () => String, description: "Shopify customer ID (GID or numeric). Must be the caller's own." })),
190
+ tslib_1.__metadata("design:type", Function),
191
+ tslib_1.__metadata("design:paramtypes", [Object, Object, String, String, String]),
192
+ tslib_1.__metadata("design:returntype", Promise)
193
+ ], CartResolver.prototype, "syncCapillaryCoupon", null);
149
194
  exports.CartResolver = CartResolver = tslib_1.__decorate([
150
195
  (0, graphql_1.Resolver)(() => cart_types_1.Cart),
151
196
  (0, common_1.UseGuards)(core_1.TenantGuard),
@@ -1 +1 @@
1
- {"version":3,"file":"cart.resolver.js","sourceRoot":"","sources":["../../src/cart/cart.resolver.ts"],"names":[],"mappings":";;;;AAAA,6CAA2E;AAC3E,2CAA2C;AAC3C,wCASuB;AACvB,iDAA6C;AAC7C,6CAQsB;AAQf,IAAM,YAAY,GAAlB,MAAM,YAAY;IACM;IAA7B,YAA6B,WAAwB;QAAxB,gBAAW,GAAX,WAAW,CAAa;IAAG,CAAC;IAGnD,AAAN,KAAK,CAAC,IAAI,CACG,GAAe,EACU,EAAU;QAE9C,OAAO,IAAI,CAAC,WAAW,CAAC,OAAO,CAAC,GAAG,CAAC,GAAG,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC;IACrD,CAAC;IAMK,AAAN,KAAK,CAAC,UAAU,CACH,GAAe,EAO1B,UAAiC;QAEjC,OAAO,IAAI,CAAC,WAAW,CAAC,UAAU,CAAC,GAAG,CAAC,GAAG,CAAC,KAAK,EAAE,UAAU,CAAC,CAAC;IAChE,CAAC;IAGK,AAAN,KAAK,CAAC,YAAY,CACL,GAAe,EACc,MAAc,EACN,KAAsB;QAEtE,OAAO,IAAI,CAAC,WAAW,CAAC,QAAQ,CAAC,GAAG,CAAC,GAAG,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,CAAC,CAAC;IACjE,CAAC;IAGK,AAAN,KAAK,CAAC,eAAe,CACR,GAAe,EACc,MAAc,EACA,KAA4B;QAElF,OAAO,IAAI,CAAC,WAAW,CAAC,WAAW,CAAC,GAAG,CAAC,GAAG,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,CAAC,CAAC;IACpE,CAAC;IAGK,AAAN,KAAK,CAAC,eAAe,CACR,GAAe,EACc,MAAc,EACX,OAAiB;QAE5D,OAAO,IAAI,CAAC,WAAW,CAAC,WAAW,CAAC,GAAG,CAAC,GAAG,CAAC,KAAK,EAAE,MAAM,EAAE,OAAO,CAAC,CAAC;IACtE,CAAC;IAU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User } from '@pvh-afl/core';
1
2
  import { LoyaltyService } from './loyalty.service';
2
- import { ShopifyDiscountsByTagInput, ShopifyDiscountsByTagResult } from './loyalty.types';
3
+ import { CustomerCouponsInput, CustomerCouponsResult, ShopifyDiscountsByTagInput, ShopifyDiscountsByTagResult, CapillaryCustomerInput, CapillaryCustomerResult, THClubCustomerInput, THClubCustomerResult } from './loyalty.types';
3
4
  /**
4
5
  * Loyalty Resolver
5
6
  *
@@ -8,8 +9,17 @@ import { ShopifyDiscountsByTagInput, ShopifyDiscountsByTagResult } from './loyal
8
9
  export declare class LoyaltyResolver {
9
10
  private readonly loyaltyService;
10
11
  constructor(loyaltyService: LoyaltyService);
12
+ getCustomerCoupons(user: AuthUser, input: CustomerCouponsInput, context: {
13
+ brand: string;
14
+ }): Promise<CustomerCouponsResult>;
15
+ getCapillaryCustomer(user: AuthUser, input: CapillaryCustomerInput, context: {
16
+ brand: string;
17
+ }): Promise<CapillaryCustomerResult>;
11
18
  getShopifyDiscountsByTag(input: ShopifyDiscountsByTagInput, context: {
12
19
  brand: string;
13
20
  }): Promise<ShopifyDiscountsByTagResult>;
21
+ createOrUpdateTHClubCustomer(user: AuthUser, input: THClubCustomerInput, context: {
22
+ brand: string;
23
+ }): Promise<THClubCustomerResult>;
14
24
  }
15
25
  //# sourceMappingURL=loyalty.resolver.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"loyalty.resolver.d.ts","sourceRoot":"","sources":["../../src/loyalty/loyalty.resolver.ts"],"names":[],"mappings":"AAYA,OAAO,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AACnD,OAAO,EAML,0BAA0B,EAC1B,2BAA2B,EAK5B,MAAM,iBAAiB,CAAC;AAEzB;;;;GAIG;AACH,qBACa,eAAe;IACd,OAAO,CAAC,QAAQ,CAAC,cAAc;gBAAd,cAAc,EAAE,cAAc;IAiDrD,wBAAwB,CACb,KAAK,EAAE,0BAA0B,EACrC,OAAO,EAAE;QAAE,KAAK,EAAE,MAAM,CAAA;KAAE,GACpC,OAAO,CAAC,2BAA2B,CAAC;CA0BxC"}
1
+ {"version":3,"file":"loyalty.resolver.d.ts","sourceRoot":"","sources":["../../src/loyalty/loyalty.resolver.ts"],"names":[],"mappings":"AAEA,OAAO,EACL,QAAQ,EAMT,MAAM,eAAe,CAAC;AACvB,OAAO,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AACnD,OAAO,EACL,oBAAoB,EACpB,qBAAqB,EACrB,0BAA0B,EAC1B,2BAA2B,EAC3B,sBAAsB,EACtB,uBAAuB,EACvB,mBAAmB,EACnB,oBAAoB,EACrB,MAAM,iBAAiB,CAAC;AAEzB;;;;GAIG;AACH,qBACa,eAAe;IACd,OAAO,CAAC,QAAQ,CAAC,cAAc;gBAAd,cAAc,EAAE,cAAc;IAkBrD,kBAAkB,CACP,IAAI,EAAE,QAAQ,EACd,KAAK,EAAE,oBAAoB,EAC/B,OAAO,EAAE;QAAE,KAAK,EAAE,MAAM,CAAA;KAAE,GACpC,OAAO,CAAC,qBAAqB,CAAC;IAgB3B,oBAAoB,CACT,IAAI,EAAE,QAAQ,EACd,KAAK,EAAE,sBAAsB,EACjC,OAAO,EAAE;QAAE,KAAK,EAAE,MAAM,CAAA;KAAE,GACpC,OAAO,CAAC,uBAAuB,CAAC;IAY7B,wBAAwB,CACb,KAAK,EAAE,0BAA0B,EACrC,OAAO,EAAE;QAAE,KAAK,EAAE,MAAM,CAAA;KAAE,GACpC,OAAO,CAAC,2BAA2B,CAAC;IAiBjC,4BAA4B,CACjB,IAAI,EAAE,QAAQ,EACd,KAAK,EAAE,mBAAmB,EAC9B,OAAO,EAAE;QAAE,KAAK,EAAE,MAAM,CAAA;KAAE,GACpC,OAAO,CAAC,oBAAoB,CAAC;CAOjC"}
@@ -2,8 +2,6 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.LoyaltyResolver = void 0;
4
4
  const tslib_1 = require("tslib");
5
- // CAPILLARY PAUSED: `Mutation` is only used by the disabled
6
- // createOrUpdateTHClubCustomer mutation below — dropped from this import.
7
5
  const graphql_1 = require("@nestjs/graphql");
8
6
  const common_1 = require("@nestjs/common");
9
7
  const core_1 = require("@pvh-afl/core");
@@ -20,52 +18,77 @@ let LoyaltyResolver = class LoyaltyResolver {
20
18
  this.loyaltyService = loyaltyService;
21
19
  }
22
20
  // ===================================================================
23
- // CAPILLARY PAUSED
24
- // getCustomerCoupons and getCapillaryCustomer are Capillary-backed and are
25
- // disabled while loyalty is paused. Removed from the schema (rather than left
26
- // to throw "not configured" at runtime). The non-Capillary
27
- // getShopifyDiscountsByTag query below stays live. Restore by uncommenting
28
- // these two methods and their imports.
21
+ // Capillary-backed loyalty queries. Gated by the CAPILLARY_ENABLED env var
22
+ // (isCapillaryEnabled): they stay in the schema, but when the flag is off
23
+ // (e.g. production) they never touch Capillary — the guard short-circuits
24
+ // before any config read or API call, so there is no runtime error. In normal
25
+ // production operation the frontend does not call these while Capillary is
26
+ // off. The non-Capillary getShopifyDiscountsByTag query below is always live.
29
27
  // -------------------------------------------------------------------
30
- // @Query(() => CustomerCouponsResult, {
31
- // description: `Get the logged-in customer's coupons by coupon state.
32
- //
33
- // Requires authentication. The \`mobile\` in the input must be the caller's own —
34
- // these are spendable coupon codes, so returning them for an arbitrary number
35
- // would let anyone collect another customer's coupons.`,
36
- // })
37
- // @UseGuards(TenantGuard, JwtAuthGuard)
38
- // async getCustomerCoupons(
39
- // @CurrentUser() user: AuthUser,
40
- // @Args('input') input: CustomerCouponsInput,
41
- // @Context() context: { brand: string },
42
- // ): Promise<CustomerCouponsResult> {
43
- // assertOwnsPhone(user, input.mobile);
44
- // return this.loyaltyService.getCustomerCoupons(context.brand, input);
45
- // }
46
- //
47
- // @Query(() => CapillaryCustomerResult, {
48
- // description: `Get the logged-in customer's TH Club (Capillary loyalty) profile by mobile.
49
- //
50
- // Requires authentication. The \`mobile\` in the input must be the caller's own —
51
- // this returns personal data, so it must not be a lookup for arbitrary numbers.
52
- // \`registered\` is false when the mobile has no TH Club profile.`,
53
- // })
54
- // @UseGuards(TenantGuard, JwtAuthGuard)
55
- // async getCapillaryCustomer(
56
- // @CurrentUser() user: AuthUser,
57
- // @Args('input') input: CapillaryCustomerInput,
58
- // @Context() context: { brand: string },
59
- // ): Promise<CapillaryCustomerResult> {
60
- // assertOwnsPhone(user, input.mobile);
61
- // return this.loyaltyService.getCapillaryCustomer(context.brand, input);
62
- // }
63
- // ===================================================================
28
+ async getCustomerCoupons(user, input, context) {
29
+ if (!(0, core_1.isCapillaryEnabled)()) {
30
+ throw new common_1.ServiceUnavailableException('Loyalty (Capillary) is not enabled');
31
+ }
32
+ (0, core_1.assertOwnsPhone)(user, input.mobile);
33
+ return this.loyaltyService.getCustomerCoupons(context.brand, input);
34
+ }
35
+ async getCapillaryCustomer(user, input, context) {
36
+ if (!(0, core_1.isCapillaryEnabled)()) {
37
+ throw new common_1.ServiceUnavailableException('Loyalty (Capillary) is not enabled');
38
+ }
39
+ (0, core_1.assertOwnsPhone)(user, input.mobile);
40
+ return this.loyaltyService.getCapillaryCustomer(context.brand, input);
41
+ }
64
42
  async getShopifyDiscountsByTag(input, context) {
65
43
  return this.loyaltyService.getShopifyDiscountsByTag(context.brand, input);
66
44
  }
45
+ // ===================================================================
46
+ // createOrUpdateTHClubCustomer writes the customer into Capillary (TH Club).
47
+ // Gated by CAPILLARY_ENABLED (isCapillaryEnabled): present in the schema but
48
+ // inert when the flag is off — the guard short-circuits before any Capillary
49
+ // write, so there is no runtime error in production.
50
+ // -------------------------------------------------------------------
51
+ async createOrUpdateTHClubCustomer(user, input, context) {
52
+ if (!(0, core_1.isCapillaryEnabled)()) {
53
+ throw new common_1.ServiceUnavailableException('Loyalty (Capillary) is not enabled');
54
+ }
55
+ (0, core_1.assertOwnsPhone)(user, input.mobile);
56
+ return this.loyaltyService.createOrUpdateTHClubCustomer(context.brand, input);
57
+ }
67
58
  };
68
59
  exports.LoyaltyResolver = LoyaltyResolver;
60
+ tslib_1.__decorate([
61
+ (0, graphql_1.Query)(() => loyalty_types_1.CustomerCouponsResult, {
62
+ description: `Get the logged-in customer's coupons by coupon state.
63
+
64
+ Requires authentication. The \`mobile\` in the input must be the caller's own —
65
+ these are spendable coupon codes, so returning them for an arbitrary number
66
+ would let anyone collect another customer's coupons.`,
67
+ }),
68
+ (0, common_1.UseGuards)(core_1.TenantGuard, core_1.JwtAuthGuard),
69
+ tslib_1.__param(0, (0, core_1.CurrentUser)()),
70
+ tslib_1.__param(1, (0, graphql_1.Args)('input')),
71
+ tslib_1.__param(2, (0, graphql_1.Context)()),
72
+ tslib_1.__metadata("design:type", Function),
73
+ tslib_1.__metadata("design:paramtypes", [Object, loyalty_types_1.CustomerCouponsInput, Object]),
74
+ tslib_1.__metadata("design:returntype", Promise)
75
+ ], LoyaltyResolver.prototype, "getCustomerCoupons", null);
76
+ tslib_1.__decorate([
77
+ (0, graphql_1.Query)(() => loyalty_types_1.CapillaryCustomerResult, {
78
+ description: `Get the logged-in customer's TH Club (Capillary loyalty) profile by mobile.
79
+
80
+ Requires authentication. The \`mobile\` in the input must be the caller's own —
81
+ this returns personal data, so it must not be a lookup for arbitrary numbers.
82
+ \`registered\` is false when the mobile has no TH Club profile.`,
83
+ }),
84
+ (0, common_1.UseGuards)(core_1.TenantGuard, core_1.JwtAuthGuard),
85
+ tslib_1.__param(0, (0, core_1.CurrentUser)()),
86
+ tslib_1.__param(1, (0, graphql_1.Args)('input')),
87
+ tslib_1.__param(2, (0, graphql_1.Context)()),
88
+ tslib_1.__metadata("design:type", Function),
89
+ tslib_1.__metadata("design:paramtypes", [Object, loyalty_types_1.CapillaryCustomerInput, Object]),
90
+ tslib_1.__metadata("design:returntype", Promise)
91
+ ], LoyaltyResolver.prototype, "getCapillaryCustomer", null);
69
92
  tslib_1.__decorate([
70
93
  (0, graphql_1.Query)(() => loyalty_types_1.ShopifyDiscountsByTagResult, {
71
94
  description: `Get Shopify discount codes filtered by tag.`,
@@ -77,6 +100,21 @@ tslib_1.__decorate([
77
100
  tslib_1.__metadata("design:paramtypes", [loyalty_types_1.ShopifyDiscountsByTagInput, Object]),
78
101
  tslib_1.__metadata("design:returntype", Promise)
79
102
  ], LoyaltyResolver.prototype, "getShopifyDiscountsByTag", null);
103
+ tslib_1.__decorate([
104
+ (0, graphql_1.Mutation)(() => loyalty_types_1.THClubCustomerResult, {
105
+ description: `Create or update the logged-in customer in TH Club (Capillary loyalty).
106
+
107
+ Requires authentication. The \`mobile\` in the input must be the caller's own —
108
+ a customer can only ever create or update their own TH Club profile.`,
109
+ }),
110
+ (0, common_1.UseGuards)(core_1.TenantGuard, core_1.JwtAuthGuard),
111
+ tslib_1.__param(0, (0, core_1.CurrentUser)()),
112
+ tslib_1.__param(1, (0, graphql_1.Args)('input')),
113
+ tslib_1.__param(2, (0, graphql_1.Context)()),
114
+ tslib_1.__metadata("design:type", Function),
115
+ tslib_1.__metadata("design:paramtypes", [Object, loyalty_types_1.THClubCustomerInput, Object]),
116
+ tslib_1.__metadata("design:returntype", Promise)
117
+ ], LoyaltyResolver.prototype, "createOrUpdateTHClubCustomer", null);
80
118
  exports.LoyaltyResolver = LoyaltyResolver = tslib_1.__decorate([
81
119
  (0, graphql_1.Resolver)(),
82
120
  tslib_1.__metadata("design:paramtypes", [loyalty_service_1.LoyaltyService])
@@ -1 +1 @@
1
- {"version":3,"file":"loyalty.resolver.js","sourceRoot":"","sources":["../../src/loyalty/loyalty.resolver.ts"],"names":[],"mappings":";;;;AAAA,4DAA4D;AAC5D,0EAA0E;AAC1E,6CAAiE;AACjE,2CAA2C;AAC3C,wCAOuB;AACvB,uDAAmD;AACnD,mDAYyB;AAEzB;;;;GAIG;AAEI,IAAM,eAAe,GAArB,MAAM,eAAe;IACG;IAA7B,YAA6B,cAA8B;QAA9B,mBAAc,GAAd,cAAc,CAAgB;IAAG,CAAC;IAE/D,sEAAsE;IACtE,mBAAmB;IACnB,2EAA2E;IAC3E,8EAA8E;IAC9E,2DAA2D;IAC3D,2EAA2E;IAC3E,uCAAuC;IACvC,sEAAsE;IACtE,wCAAwC;IACxC,wEAAwE;IACxE,EAAE;IACF,kFAAkF;IAClF,8EAA8E;IAC9E,yDAAyD;IACzD,KAAK;IACL,wCAAwC;IACxC,4BAA4B;IAC5B,mCAAmC;IACnC,gDAAgD;IAChD,2CAA2C;IAC3C,sCAAsC;IACtC,yCAAyC;IACzC,yEAAyE;IACzE,IAAI;IACJ,EAAE;IACF,0CAA0C;IAC1C,8FAA8F;IAC9F,EAAE;IACF,kFAAkF;IAClF,gFAAgF;IAChF,oEAAoE;IACpE,KAAK;IACL,wCAAwC;IACxC,8BAA8B;IAC9B,mCAAmC;IACnC,kDAAkD;IAClD,2CAA2C;IAC3C,wCAAwC;IACxC,yCAAyC;IACzC,2EAA2E;IAC3E,IAAI;IACJ,sEAAsE;IAMhE,AAAN,KAAK,CAAC,wBAAwB,CACb,KAAiC,EACrC,OAA0B;QAErC,OAAO,IAAI,CAAC,cAAc,CAAC,wBAAwB,CAAC,OAAO,CAAC,KAAK,EAAE,KAAK,CAAC,CAAC;IAC5E,CAAC;CAwBF,CAAA;AA/EY,0CAAe;AAkDpB;IAJL,IAAA,eAAK,EAAC,GAAG,EAAE,CAAC,2CAA2B,EAAE;QACxC,WAAW,EAAE,6CAA6C;KAC3D,CAAC;IACD,IAAA,kBAAS,EAAC,kBAAW,CAAC;IAEpB,mBAAA,IAAA,cAAI,EAAC,OAAO,CAAC,CAAA;IACb,mBAAA,IAAA,iBAAO,GAAE,CAAA;;6CADY,0CAA0B;;+DAIjD;0BAvDU,eAAe;IAD3B,IAAA,kBAAQ,GAAE;6CAEoC,gCAAc;GADhD,eAAe,CA+E3B"}
1
+ {"version":3,"file":"loyalty.resolver.js","sourceRoot":"","sources":["../../src/loyalty/loyalty.resolver.ts"],"names":[],"mappings":";;;;AAAA,6CAA2E;AAC3E,2CAAwE;AACxE,wCAOuB;AACvB,uDAAmD;AACnD,mDASyB;AAEzB;;;;GAIG;AAEI,IAAM,eAAe,G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,GAAG,EAAE,CAAC,oCAAoB,EAAE;QACpC,WAAW,EAAE;;;qEAGoD;KAClE,CAAC;IACD,IAAA,kBAAS,EAAC,kBAAW,EAAE,mBAAY,CAAC;IAElC,mBAAA,IAAA,kBAAW,GAAE,CAAA;IACb,mBAAA,IAAA,cAAI,EAAC,OAAO,CAAC,CAAA;IACb,mBAAA,IAAA,iBAAO,GAAE,CAAA;;qDADY,mCAAmB;;mEAQ1C;0BArFU,eAAe;IAD3B,IAAA,kBAAQ,GAAE;6CAEoC,gCAAc;GADhD,eAAe,CAsF3B"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pvh-afl/graphql",
3
- "version": "1.2.50",
3
+ "version": "1.2.51",
4
4
  "description": "AFL GraphQL - Shared GraphQL modules for multi-brand commerce platform",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -22,7 +22,7 @@
22
22
  "@nestjs/common": "^10.0.0",
23
23
  "@nestjs/core": "^10.0.0",
24
24
  "@nestjs/graphql": "^12.0.0",
25
- "@pvh-afl/core": "^1.2.36",
25
+ "@pvh-afl/core": "^1.2.40",
26
26
  "graphql": "^16.0.0"
27
27
  },
28
28
  "devDependencies": {
@@ -32,7 +32,7 @@
32
32
  "@nestjs/core": "^10.4.0",
33
33
  "@nestjs/graphql": "^12.2.0",
34
34
  "@nestjs/testing": "^10.4.0",
35
- "@pvh-afl/core": "^1.2.36",
35
+ "@pvh-afl/core": "^1.2.40",
36
36
  "@types/jest": "^29.5.0",
37
37
  "graphql": "^16.9.0",
38
38
  "graphql-type-json": "^0.3.2",