@pvh-afl/graphql 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (202) hide show
  1. package/README.md +135 -0
  2. package/dist/cart/cart.hooks.d.ts +66 -0
  3. package/dist/cart/cart.hooks.d.ts.map +1 -0
  4. package/dist/cart/cart.hooks.js +12 -0
  5. package/dist/cart/cart.hooks.js.map +1 -0
  6. package/dist/cart/cart.module.d.ts +25 -0
  7. package/dist/cart/cart.module.d.ts.map +1 -0
  8. package/dist/cart/cart.module.js +44 -0
  9. package/dist/cart/cart.module.js.map +1 -0
  10. package/dist/cart/cart.resolver.d.ts +23 -0
  11. package/dist/cart/cart.resolver.d.ts.map +1 -0
  12. package/dist/cart/cart.resolver.js +153 -0
  13. package/dist/cart/cart.resolver.js.map +1 -0
  14. package/dist/cart/cart.service.d.ts +31 -0
  15. package/dist/cart/cart.service.d.ts.map +1 -0
  16. package/dist/cart/cart.service.js +305 -0
  17. package/dist/cart/cart.service.js.map +1 -0
  18. package/dist/cart/cart.types.d.ts +144 -0
  19. package/dist/cart/cart.types.d.ts.map +1 -0
  20. package/dist/cart/cart.types.js +629 -0
  21. package/dist/cart/cart.types.js.map +1 -0
  22. package/dist/cart/index.d.ts +6 -0
  23. package/dist/cart/index.d.ts.map +1 -0
  24. package/dist/cart/index.js +9 -0
  25. package/dist/cart/index.js.map +1 -0
  26. package/dist/cms/cms.module.d.ts +3 -0
  27. package/dist/cms/cms.module.d.ts.map +1 -0
  28. package/dist/cms/cms.module.js +18 -0
  29. package/dist/cms/cms.module.js.map +1 -0
  30. package/dist/cms/cms.resolver.d.ts +15 -0
  31. package/dist/cms/cms.resolver.d.ts.map +1 -0
  32. package/dist/cms/cms.resolver.js +44 -0
  33. package/dist/cms/cms.resolver.js.map +1 -0
  34. package/dist/cms/cms.service.d.ts +14 -0
  35. package/dist/cms/cms.service.d.ts.map +1 -0
  36. package/dist/cms/cms.service.js +111 -0
  37. package/dist/cms/cms.service.js.map +1 -0
  38. package/dist/cms/cms.types.d.ts +20 -0
  39. package/dist/cms/cms.types.d.ts.map +1 -0
  40. package/dist/cms/cms.types.js +89 -0
  41. package/dist/cms/cms.types.js.map +1 -0
  42. package/dist/cms/index.d.ts +5 -0
  43. package/dist/cms/index.d.ts.map +1 -0
  44. package/dist/cms/index.js +8 -0
  45. package/dist/cms/index.js.map +1 -0
  46. package/dist/collection/collection.module.d.ts +3 -0
  47. package/dist/collection/collection.module.d.ts.map +1 -0
  48. package/dist/collection/collection.module.js +19 -0
  49. package/dist/collection/collection.module.js.map +1 -0
  50. package/dist/collection/collection.resolver.d.ts +15 -0
  51. package/dist/collection/collection.resolver.d.ts.map +1 -0
  52. package/dist/collection/collection.resolver.js +45 -0
  53. package/dist/collection/collection.resolver.js.map +1 -0
  54. package/dist/collection/collection.service.d.ts +19 -0
  55. package/dist/collection/collection.service.d.ts.map +1 -0
  56. package/dist/collection/collection.service.js +132 -0
  57. package/dist/collection/collection.service.js.map +1 -0
  58. package/dist/collection/collection.types.d.ts +18 -0
  59. package/dist/collection/collection.types.d.ts.map +1 -0
  60. package/dist/collection/collection.types.js +75 -0
  61. package/dist/collection/collection.types.js.map +1 -0
  62. package/dist/collection/index.d.ts +5 -0
  63. package/dist/collection/index.d.ts.map +1 -0
  64. package/dist/collection/index.js +8 -0
  65. package/dist/collection/index.js.map +1 -0
  66. package/dist/common/index.d.ts +8 -0
  67. package/dist/common/index.d.ts.map +1 -0
  68. package/dist/common/index.js +16 -0
  69. package/dist/common/index.js.map +1 -0
  70. package/dist/graphql.module.d.ts +3 -0
  71. package/dist/graphql.module.d.ts.map +1 -0
  72. package/dist/graphql.module.js +46 -0
  73. package/dist/graphql.module.js.map +1 -0
  74. package/dist/header/header.module.d.ts +9 -0
  75. package/dist/header/header.module.d.ts.map +1 -0
  76. package/dist/header/header.module.js +21 -0
  77. package/dist/header/header.module.js.map +1 -0
  78. package/dist/header/header.resolver.d.ts +18 -0
  79. package/dist/header/header.resolver.d.ts.map +1 -0
  80. package/dist/header/header.resolver.js +42 -0
  81. package/dist/header/header.resolver.js.map +1 -0
  82. package/dist/header/index.d.ts +4 -0
  83. package/dist/header/index.d.ts.map +1 -0
  84. package/dist/header/index.js +7 -0
  85. package/dist/header/index.js.map +1 -0
  86. package/dist/header/types/header.types.d.ts +36 -0
  87. package/dist/header/types/header.types.d.ts.map +1 -0
  88. package/dist/header/types/header.types.js +154 -0
  89. package/dist/header/types/header.types.js.map +1 -0
  90. package/dist/header/types/index.d.ts +3 -0
  91. package/dist/header/types/index.d.ts.map +1 -0
  92. package/dist/header/types/index.js +6 -0
  93. package/dist/header/types/index.js.map +1 -0
  94. package/dist/header/types/response.types.d.ts +13 -0
  95. package/dist/header/types/response.types.d.ts.map +1 -0
  96. package/dist/header/types/response.types.js +54 -0
  97. package/dist/header/types/response.types.js.map +1 -0
  98. package/dist/index.d.ts +16 -0
  99. package/dist/index.d.ts.map +1 -0
  100. package/dist/index.js +29 -0
  101. package/dist/index.js.map +1 -0
  102. package/dist/page-content/index.d.ts +5 -0
  103. package/dist/page-content/index.d.ts.map +1 -0
  104. package/dist/page-content/index.js +8 -0
  105. package/dist/page-content/index.js.map +1 -0
  106. package/dist/page-content/page-content.module.d.ts +9 -0
  107. package/dist/page-content/page-content.module.d.ts.map +1 -0
  108. package/dist/page-content/page-content.module.js +25 -0
  109. package/dist/page-content/page-content.module.js.map +1 -0
  110. package/dist/page-content/page-content.resolver.d.ts +18 -0
  111. package/dist/page-content/page-content.resolver.d.ts.map +1 -0
  112. package/dist/page-content/page-content.resolver.js +42 -0
  113. package/dist/page-content/page-content.resolver.js.map +1 -0
  114. package/dist/page-content/page-content.service.d.ts +59 -0
  115. package/dist/page-content/page-content.service.d.ts.map +1 -0
  116. package/dist/page-content/page-content.service.js +253 -0
  117. package/dist/page-content/page-content.service.js.map +1 -0
  118. package/dist/page-content/types/common.types.d.ts +49 -0
  119. package/dist/page-content/types/common.types.d.ts.map +1 -0
  120. package/dist/page-content/types/common.types.js +217 -0
  121. package/dist/page-content/types/common.types.js.map +1 -0
  122. package/dist/page-content/types/index.d.ts +4 -0
  123. package/dist/page-content/types/index.d.ts.map +1 -0
  124. package/dist/page-content/types/index.js +7 -0
  125. package/dist/page-content/types/index.js.map +1 -0
  126. package/dist/page-content/types/response.types.d.ts +8 -0
  127. package/dist/page-content/types/response.types.d.ts.map +1 -0
  128. package/dist/page-content/types/response.types.js +29 -0
  129. package/dist/page-content/types/response.types.js.map +1 -0
  130. package/dist/page-content/types/section.types.d.ts +276 -0
  131. package/dist/page-content/types/section.types.d.ts.map +1 -0
  132. package/dist/page-content/types/section.types.js +1252 -0
  133. package/dist/page-content/types/section.types.js.map +1 -0
  134. package/dist/product/index.d.ts +5 -0
  135. package/dist/product/index.d.ts.map +1 -0
  136. package/dist/product/index.js +8 -0
  137. package/dist/product/index.js.map +1 -0
  138. package/dist/product/product.module.d.ts +3 -0
  139. package/dist/product/product.module.d.ts.map +1 -0
  140. package/dist/product/product.module.js +19 -0
  141. package/dist/product/product.module.js.map +1 -0
  142. package/dist/product/product.resolver.d.ts +15 -0
  143. package/dist/product/product.resolver.d.ts.map +1 -0
  144. package/dist/product/product.resolver.js +45 -0
  145. package/dist/product/product.resolver.js.map +1 -0
  146. package/dist/product/product.service.d.ts +38 -0
  147. package/dist/product/product.service.d.ts.map +1 -0
  148. package/dist/product/product.service.js +337 -0
  149. package/dist/product/product.service.js.map +1 -0
  150. package/dist/product/product.types.d.ts +63 -0
  151. package/dist/product/product.types.d.ts.map +1 -0
  152. package/dist/product/product.types.js +276 -0
  153. package/dist/product/product.types.js.map +1 -0
  154. package/dist/product-content/index.d.ts +5 -0
  155. package/dist/product-content/index.d.ts.map +1 -0
  156. package/dist/product-content/index.js +8 -0
  157. package/dist/product-content/index.js.map +1 -0
  158. package/dist/product-content/product-content.module.d.ts +3 -0
  159. package/dist/product-content/product-content.module.d.ts.map +1 -0
  160. package/dist/product-content/product-content.module.js +27 -0
  161. package/dist/product-content/product-content.module.js.map +1 -0
  162. package/dist/product-content/product-content.resolver.d.ts +20 -0
  163. package/dist/product-content/product-content.resolver.d.ts.map +1 -0
  164. package/dist/product-content/product-content.resolver.js +44 -0
  165. package/dist/product-content/product-content.resolver.js.map +1 -0
  166. package/dist/product-content/product-content.service.d.ts +40 -0
  167. package/dist/product-content/product-content.service.d.ts.map +1 -0
  168. package/dist/product-content/product-content.service.js +239 -0
  169. package/dist/product-content/product-content.service.js.map +1 -0
  170. package/dist/product-content/types/common.types.d.ts +85 -0
  171. package/dist/product-content/types/common.types.d.ts.map +1 -0
  172. package/dist/product-content/types/common.types.js +384 -0
  173. package/dist/product-content/types/common.types.js.map +1 -0
  174. package/dist/product-content/types/index.d.ts +3 -0
  175. package/dist/product-content/types/index.d.ts.map +1 -0
  176. package/dist/product-content/types/index.js +6 -0
  177. package/dist/product-content/types/index.js.map +1 -0
  178. package/dist/product-content/types/response.types.d.ts +10 -0
  179. package/dist/product-content/types/response.types.d.ts.map +1 -0
  180. package/dist/product-content/types/response.types.js +39 -0
  181. package/dist/product-content/types/response.types.js.map +1 -0
  182. package/dist/serviceability/index.d.ts +5 -0
  183. package/dist/serviceability/index.d.ts.map +1 -0
  184. package/dist/serviceability/index.js +8 -0
  185. package/dist/serviceability/index.js.map +1 -0
  186. package/dist/serviceability/serviceability.module.d.ts +3 -0
  187. package/dist/serviceability/serviceability.module.d.ts.map +1 -0
  188. package/dist/serviceability/serviceability.module.js +18 -0
  189. package/dist/serviceability/serviceability.module.js.map +1 -0
  190. package/dist/serviceability/serviceability.resolver.d.ts +19 -0
  191. package/dist/serviceability/serviceability.resolver.d.ts.map +1 -0
  192. package/dist/serviceability/serviceability.resolver.js +40 -0
  193. package/dist/serviceability/serviceability.resolver.js.map +1 -0
  194. package/dist/serviceability/serviceability.service.d.ts +42 -0
  195. package/dist/serviceability/serviceability.service.d.ts.map +1 -0
  196. package/dist/serviceability/serviceability.service.js +169 -0
  197. package/dist/serviceability/serviceability.service.js.map +1 -0
  198. package/dist/serviceability/serviceability.types.d.ts +42 -0
  199. package/dist/serviceability/serviceability.types.d.ts.map +1 -0
  200. package/dist/serviceability/serviceability.types.js +184 -0
  201. package/dist/serviceability/serviceability.types.js.map +1 -0
  202. package/package.json +67 -0
package/README.md ADDED
@@ -0,0 +1,135 @@
1
+ # @afl/graphql
2
+
3
+ Shared GraphQL modules for the AFL multi-brand commerce platform.
4
+
5
+ ## Installation
6
+
7
+ ```bash
8
+ npm install @afl/graphql
9
+ ```
10
+
11
+ ## Peer Dependencies
12
+
13
+ This package requires the following peer dependencies:
14
+
15
+ ```bash
16
+ npm install @afl/core @nestjs/common @nestjs/core @nestjs/graphql @nestjs/apollo graphql
17
+ ```
18
+
19
+ ## Modules
20
+
21
+ ### ProductModule
22
+ Product queries and services for fetching product data from commerce platforms.
23
+
24
+ ```typescript
25
+ import { ProductModule } from '@afl/graphql';
26
+
27
+ @Module({
28
+ imports: [ProductModule],
29
+ })
30
+ export class AppModule {}
31
+ ```
32
+
33
+ ### CartModule
34
+ Cart mutations and services for managing shopping carts.
35
+
36
+ ```typescript
37
+ import { CartModule } from '@afl/graphql';
38
+ ```
39
+
40
+ ### CollectionModule
41
+ Collection queries for fetching product collections.
42
+
43
+ ```typescript
44
+ import { CollectionModule } from '@afl/graphql';
45
+ ```
46
+
47
+ ### ServiceabilityModule
48
+ Serviceability checks for delivery availability.
49
+
50
+ ```typescript
51
+ import { ServiceabilityModule } from '@afl/graphql';
52
+ ```
53
+
54
+ ### PageContentModule
55
+ CMS page content fetching and processing.
56
+
57
+ ```typescript
58
+ import { PageContentModule } from '@afl/graphql';
59
+ ```
60
+
61
+ ### ProductContentModule
62
+ Product-specific CMS content.
63
+
64
+ ```typescript
65
+ import { ProductContentModule } from '@afl/graphql';
66
+ ```
67
+
68
+ ### HeaderModule
69
+ Header configuration and navigation.
70
+
71
+ ```typescript
72
+ import { HeaderModule } from '@afl/graphql';
73
+ ```
74
+
75
+ ### CmsModule
76
+ Generic CMS content fetching.
77
+
78
+ ```typescript
79
+ import { CmsModule } from '@afl/graphql';
80
+ ```
81
+
82
+ ## Usage with NestJS GraphQL
83
+
84
+ Import the modules you need in your application module:
85
+
86
+ ```typescript
87
+ import { Module } from '@nestjs/common';
88
+ import { GraphQLModule } from '@nestjs/graphql';
89
+ import { ApolloDriver, ApolloDriverConfig } from '@nestjs/apollo';
90
+ import {
91
+ ProductModule,
92
+ CartModule,
93
+ CollectionModule,
94
+ ServiceabilityModule,
95
+ PageContentModule,
96
+ HeaderModule,
97
+ } from '@afl/graphql';
98
+
99
+ @Module({
100
+ imports: [
101
+ GraphQLModule.forRoot<ApolloDriverConfig>({
102
+ driver: ApolloDriver,
103
+ autoSchemaFile: true,
104
+ }),
105
+ ProductModule,
106
+ CartModule,
107
+ CollectionModule,
108
+ ServiceabilityModule,
109
+ PageContentModule,
110
+ HeaderModule,
111
+ ],
112
+ })
113
+ export class AppModule {}
114
+ ```
115
+
116
+ ## API Reference
117
+
118
+ See the [API documentation](../../docs/API.md) for detailed usage information.
119
+
120
+ ## Development
121
+
122
+ ```bash
123
+ # Build the package
124
+ npm run build
125
+
126
+ # Run tests
127
+ npm test
128
+
129
+ # Run linting
130
+ npm run lint
131
+ ```
132
+
133
+ ## License
134
+
135
+ UNLICENSED - Private package
@@ -0,0 +1,66 @@
1
+ /**
2
+ * Cart Hooks Interface
3
+ *
4
+ * Defines extension points for brand-specific cart logic.
5
+ * Brands can implement this interface to add custom behavior
6
+ * like loyalty coupon processing, custom validations, etc.
7
+ */
8
+ export declare const CART_HOOKS: unique symbol;
9
+ /**
10
+ * Result of processing discount codes through hooks.
11
+ */
12
+ export interface ProcessedDiscountResult {
13
+ /** Final codes to apply to Shopify cart */
14
+ codes: string[];
15
+ /** Any extra data to include in the cart response */
16
+ extraData?: Record<string, unknown>;
17
+ }
18
+ /**
19
+ * Options for discount code processing.
20
+ */
21
+ export interface DiscountProcessingOptions {
22
+ /** Mobile number for loyalty coupon validation */
23
+ mobile?: string;
24
+ /**
25
+ * If true, skip initial Shopify apply and go directly to loyalty validation.
26
+ * Useful when you know the coupon is a loyalty coupon and want to skip the Shopify failure.
27
+ */
28
+ forceCapillaryValidation?: boolean;
29
+ }
30
+ /**
31
+ * Interface for cart hooks that brands can implement.
32
+ * All methods are optional - only implement what you need.
33
+ */
34
+ export interface ICartHooks {
35
+ /**
36
+ * Check if a discount code should be handled by this hook.
37
+ * Called to determine if the hook should process a failed/unrecognized code.
38
+ *
39
+ * @param code - The discount code to check
40
+ * @returns true if this hook can handle the code
41
+ */
42
+ canHandleDiscountCode?(code: string): boolean;
43
+ /**
44
+ * Process discount codes - validate with loyalty system and sync to Shopify.
45
+ * Called when:
46
+ * 1. forceCapillaryValidation is true (skip Shopify, go directly to loyalty)
47
+ * 2. Shopify apply fails and canHandleDiscountCode returns true
48
+ *
49
+ * @param brand - The brand identifier
50
+ * @param cartId - The cart ID
51
+ * @param codes - Discount codes to process
52
+ * @param options - Processing options including mobile and flags
53
+ * @returns Processed codes (Shopify codes) and optional extra data for response
54
+ */
55
+ processDiscountCodes?(brand: string, cartId: string, codes: string[], options?: DiscountProcessingOptions): Promise<ProcessedDiscountResult>;
56
+ /**
57
+ * Get extra data to include in cart response.
58
+ * Brand can add loyalty info, promo details, etc.
59
+ *
60
+ * @param brand - The brand identifier
61
+ * @param cartId - The cart ID
62
+ * @returns Extra data to merge into cart response
63
+ */
64
+ getExtraCartData?(brand: string, cartId: string): Promise<Record<string, unknown>>;
65
+ }
66
+ //# sourceMappingURL=cart.hooks.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cart.hooks.d.ts","sourceRoot":"","sources":["../../src/cart/cart.hooks.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,eAAO,MAAM,UAAU,eAAuB,CAAC;AAE/C;;GAEG;AACH,MAAM,WAAW,uBAAuB;IACtC,2CAA2C;IAC3C,KAAK,EAAE,MAAM,EAAE,CAAC;IAChB,qDAAqD;IACrD,SAAS,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CACrC;AAED;;GAEG;AACH,MAAM,WAAW,yBAAyB;IACxC,kDAAkD;IAClD,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB;;;OAGG;IACH,wBAAwB,CAAC,EAAE,OAAO,CAAC;CACpC;AAED;;;GAGG;AACH,MAAM,WAAW,UAAU;IACzB;;;;;;OAMG;IACH,qBAAqB,CAAC,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC;IAE9C;;;;;;;;;;;OAWG;IACH,oBAAoB,CAAC,CACnB,KAAK,EAAE,MAAM,EACb,MAAM,EAAE,MAAM,EACd,KAAK,EAAE,MAAM,EAAE,EACf,OAAO,CAAC,EAAE,yBAAyB,GAClC,OAAO,CAAC,uBAAuB,CAAC,CAAC;IAEpC;;;;;;;OAOG;IACH,gBAAgB,CAAC,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC;CACpF"}
@@ -0,0 +1,12 @@
1
+ "use strict";
2
+ /**
3
+ * Cart Hooks Interface
4
+ *
5
+ * Defines extension points for brand-specific cart logic.
6
+ * Brands can implement this interface to add custom behavior
7
+ * like loyalty coupon processing, custom validations, etc.
8
+ */
9
+ Object.defineProperty(exports, "__esModule", { value: true });
10
+ exports.CART_HOOKS = void 0;
11
+ exports.CART_HOOKS = Symbol('CART_HOOKS');
12
+ //# sourceMappingURL=cart.hooks.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cart.hooks.js","sourceRoot":"","sources":["../../src/cart/cart.hooks.ts"],"names":[],"mappings":";AAAA;;;;;;GAMG;;;AAEU,QAAA,UAAU,GAAG,MAAM,CAAC,YAAY,CAAC,CAAC"}
@@ -0,0 +1,25 @@
1
+ import { DynamicModule, Provider } from '@nestjs/common';
2
+ export interface CartModuleOptions {
3
+ /** Provider for cart hooks (e.g., { provide: CART_HOOKS, useClass: MyCartHooks }) */
4
+ hooks?: Provider;
5
+ }
6
+ export declare class CartModule {
7
+ /**
8
+ * Configure the CartModule with optional hooks.
9
+ *
10
+ * @example
11
+ * // Without hooks (standard behavior)
12
+ * CartModule.forRoot()
13
+ *
14
+ * @example
15
+ * // With brand-specific hooks
16
+ * CartModule.forRoot({
17
+ * hooks: {
18
+ * provide: CART_HOOKS,
19
+ * useClass: CapillaryCartHooks,
20
+ * },
21
+ * })
22
+ */
23
+ static forRoot(options?: CartModuleOptions): DynamicModule;
24
+ }
25
+ //# sourceMappingURL=cart.module.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cart.module.d.ts","sourceRoot":"","sources":["../../src/cart/cart.module.ts"],"names":[],"mappings":"AAAA,OAAO,EAAU,aAAa,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAKjE,MAAM,WAAW,iBAAiB;IAChC,qFAAqF;IACrF,KAAK,CAAC,EAAE,QAAQ,CAAC;CAClB;AAED,qBACa,UAAU;IACrB;;;;;;;;;;;;;;;OAeG;IACH,MAAM,CAAC,OAAO,CAAC,OAAO,CAAC,EAAE,iBAAiB,GAAG,aAAa;CAc3D"}
@@ -0,0 +1,44 @@
1
+ "use strict";
2
+ var CartModule_1;
3
+ Object.defineProperty(exports, "__esModule", { value: true });
4
+ exports.CartModule = void 0;
5
+ const tslib_1 = require("tslib");
6
+ const common_1 = require("@nestjs/common");
7
+ const core_1 = require("@pvh-afl/core");
8
+ const cart_resolver_1 = require("./cart.resolver");
9
+ const cart_service_1 = require("./cart.service");
10
+ let CartModule = CartModule_1 = class CartModule {
11
+ /**
12
+ * Configure the CartModule with optional hooks.
13
+ *
14
+ * @example
15
+ * // Without hooks (standard behavior)
16
+ * CartModule.forRoot()
17
+ *
18
+ * @example
19
+ * // With brand-specific hooks
20
+ * CartModule.forRoot({
21
+ * hooks: {
22
+ * provide: CART_HOOKS,
23
+ * useClass: CapillaryCartHooks,
24
+ * },
25
+ * })
26
+ */
27
+ static forRoot(options) {
28
+ const providers = [cart_resolver_1.CartResolver, cart_service_1.CartService];
29
+ if (options?.hooks) {
30
+ providers.push(options.hooks);
31
+ }
32
+ return {
33
+ module: CartModule_1,
34
+ imports: [core_1.IntegrationsModule],
35
+ providers,
36
+ exports: [cart_service_1.CartService],
37
+ };
38
+ }
39
+ };
40
+ exports.CartModule = CartModule;
41
+ exports.CartModule = CartModule = CartModule_1 = tslib_1.__decorate([
42
+ (0, common_1.Module)({})
43
+ ], CartModule);
44
+ //# sourceMappingURL=cart.module.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cart.module.js","sourceRoot":"","sources":["../../src/cart/cart.module.ts"],"names":[],"mappings":";;;;;AAAA,2CAAiE;AACjE,wCAAmD;AACnD,mDAA+C;AAC/C,iDAA6C;AAQtC,IAAM,UAAU,kBAAhB,MAAM,UAAU;IACrB;;;;;;;;;;;;;;;OAeG;IACH,MAAM,CAAC,OAAO,CAAC,OAA2B;QACxC,MAAM,SAAS,GAAe,CAAC,4BAAY,EAAE,0BAAW,CAAC,CAAC;QAE1D,IAAI,OAAO,EAAE,KAAK,EAAE,CAAC;YACnB,SAAS,CAAC,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;QAChC,CAAC;QAED,OAAO;YACL,MAAM,EAAE,YAAU;YAClB,OAAO,EAAE,CAAC,yBAAkB,CAAC;YAC7B,SAAS;YACT,OAAO,EAAE,CAAC,0BAAW,CAAC;SACvB,CAAC;IACJ,CAAC;CACF,CAAA;AA/BY,gCAAU;qBAAV,UAAU;IADtB,IAAA,eAAM,EAAC,EAAE,CAAC;GACE,UAAU,CA+BtB"}
@@ -0,0 +1,23 @@
1
+ import { CartService } from './cart.service';
2
+ import { Cart, CartLineInput, CartLineUpdateInput, CartBuyerIdentityInput, CartAttributeInput } from './cart.types';
3
+ interface GqlContext {
4
+ req: {
5
+ brand: string;
6
+ };
7
+ }
8
+ export declare class CartResolver {
9
+ private readonly cartService;
10
+ constructor(cartService: CartService);
11
+ cart(ctx: GqlContext, id: string): Promise<Cart | null>;
12
+ cartCreate(ctx: GqlContext): Promise<Cart>;
13
+ cartLinesAdd(ctx: GqlContext, cartId: string, lines: CartLineInput[]): Promise<Cart>;
14
+ cartLinesUpdate(ctx: GqlContext, cartId: string, lines: CartLineUpdateInput[]): Promise<Cart>;
15
+ cartLinesRemove(ctx: GqlContext, cartId: string, lineIds: string[]): Promise<Cart>;
16
+ cartDiscountCodesUpdate(ctx: GqlContext, cartId: string, discountCodes: string[], mobile?: string, forceCapillaryValidation?: boolean): Promise<Cart>;
17
+ cartBuyerIdentityUpdate(ctx: GqlContext, cartId: string, buyerIdentity: CartBuyerIdentityInput): Promise<Cart>;
18
+ cartNoteUpdate(ctx: GqlContext, cartId: string, note: string): Promise<Cart>;
19
+ cartAttributesUpdate(ctx: GqlContext, cartId: string, attributes: CartAttributeInput[]): Promise<Cart>;
20
+ cartGiftCardCodesUpdate(ctx: GqlContext, cartId: string, giftCardCodes: string[]): Promise<Cart>;
21
+ }
22
+ export {};
23
+ //# sourceMappingURL=cart.resolver.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cart.resolver.d.ts","sourceRoot":"","sources":["../../src/cart/cart.resolver.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAC7C,OAAO,EACL,IAAI,EACJ,aAAa,EACb,mBAAmB,EACnB,sBAAsB,EACtB,kBAAkB,EACnB,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,GAC7C,OAAO,CAAC,IAAI,GAAG,IAAI,CAAC;IAKjB,UAAU,CAAY,GAAG,EAAE,UAAU,GAAG,OAAO,CAAC,IAAI,CAAC;IAKrD,YAAY,CACL,GAAG,EAAE,UAAU,EACc,MAAM,EAAE,MAAM,EACN,KAAK,EAAE,aAAa,EAAE,GACrE,OAAO,CAAC,IAAI,CAAC;IAKV,eAAe,CACR,GAAG,EAAE,UAAU,EACc,MAAM,EAAE,MAAM,EACA,KAAK,EAAE,mBAAmB,EAAE,GACjF,OAAO,CAAC,IAAI,CAAC;IAKV,eAAe,CACR,GAAG,EAAE,UAAU,EACc,MAAM,EAAE,MAAM,EACX,OAAO,EAAE,MAAM,EAAE,GAC3D,OAAO,CAAC,IAAI,CAAC;IAiBV,uBAAuB,CAChB,GAAG,EAAE,UAAU,EACc,MAAM,EAAE,MAAM,EACL,aAAa,EAAE,MAAM,EAAE,EACuD,MAAM,CAAC,EAAE,MAAM,EACwF,wBAAwB,CAAC,EAAE,OAAO,GACvQ,OAAO,CAAC,IAAI,CAAC;IAKV,uBAAuB,CAChB,GAAG,EAAE,UAAU,EACc,MAAM,EAAE,MAAM,EACS,aAAa,EAAE,sBAAsB,GACnG,OAAO,CAAC,IAAI,CAAC;IAKV,cAAc,CACP,GAAG,EAAE,UAAU,EACc,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;CAGjB"}
@@ -0,0 +1,153 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.CartResolver = void 0;
4
+ const tslib_1 = require("tslib");
5
+ const graphql_1 = require("@nestjs/graphql");
6
+ const common_1 = require("@nestjs/common");
7
+ const core_1 = require("@pvh-afl/core");
8
+ const cart_service_1 = require("./cart.service");
9
+ const cart_types_1 = require("./cart.types");
10
+ let CartResolver = class CartResolver {
11
+ cartService;
12
+ constructor(cartService) {
13
+ this.cartService = cartService;
14
+ }
15
+ async cart(ctx, id) {
16
+ return this.cartService.getCart(ctx.req.brand, id);
17
+ }
18
+ async cartCreate(ctx) {
19
+ return this.cartService.createCart(ctx.req.brand);
20
+ }
21
+ async cartLinesAdd(ctx, cartId, lines) {
22
+ return this.cartService.addLines(ctx.req.brand, cartId, lines);
23
+ }
24
+ async cartLinesUpdate(ctx, cartId, lines) {
25
+ return this.cartService.updateLines(ctx.req.brand, cartId, lines);
26
+ }
27
+ async cartLinesRemove(ctx, cartId, lineIds) {
28
+ return this.cartService.removeLines(ctx.req.brand, cartId, lineIds);
29
+ }
30
+ async cartDiscountCodesUpdate(ctx, cartId, discountCodes, mobile, forceCapillaryValidation) {
31
+ return this.cartService.updateDiscountCodes(ctx.req.brand, cartId, discountCodes, mobile, forceCapillaryValidation);
32
+ }
33
+ async cartBuyerIdentityUpdate(ctx, cartId, buyerIdentity) {
34
+ return this.cartService.updateBuyerIdentity(ctx.req.brand, cartId, buyerIdentity);
35
+ }
36
+ async cartNoteUpdate(ctx, cartId, note) {
37
+ return this.cartService.updateNote(ctx.req.brand, cartId, note);
38
+ }
39
+ async cartAttributesUpdate(ctx, cartId, attributes) {
40
+ return this.cartService.updateAttributes(ctx.req.brand, cartId, attributes);
41
+ }
42
+ async cartGiftCardCodesUpdate(ctx, cartId, giftCardCodes) {
43
+ return this.cartService.updateGiftCardCodes(ctx.req.brand, cartId, giftCardCodes);
44
+ }
45
+ };
46
+ exports.CartResolver = CartResolver;
47
+ tslib_1.__decorate([
48
+ (0, graphql_1.Query)(() => cart_types_1.Cart, { nullable: true, description: 'Get cart by ID' }),
49
+ tslib_1.__param(0, (0, graphql_1.Context)()),
50
+ tslib_1.__param(1, (0, graphql_1.Args)('id', { type: () => String })),
51
+ tslib_1.__metadata("design:type", Function),
52
+ tslib_1.__metadata("design:paramtypes", [Object, String]),
53
+ tslib_1.__metadata("design:returntype", Promise)
54
+ ], CartResolver.prototype, "cart", null);
55
+ tslib_1.__decorate([
56
+ (0, graphql_1.Mutation)(() => cart_types_1.Cart, { description: 'Create a new cart' }),
57
+ tslib_1.__param(0, (0, graphql_1.Context)()),
58
+ tslib_1.__metadata("design:type", Function),
59
+ tslib_1.__metadata("design:paramtypes", [Object]),
60
+ tslib_1.__metadata("design:returntype", Promise)
61
+ ], CartResolver.prototype, "cartCreate", null);
62
+ tslib_1.__decorate([
63
+ (0, graphql_1.Mutation)(() => cart_types_1.Cart, { description: 'Add lines to cart' }),
64
+ tslib_1.__param(0, (0, graphql_1.Context)()),
65
+ tslib_1.__param(1, (0, graphql_1.Args)('cartId', { type: () => String })),
66
+ tslib_1.__param(2, (0, graphql_1.Args)('lines', { type: () => [cart_types_1.CartLineInput] })),
67
+ tslib_1.__metadata("design:type", Function),
68
+ tslib_1.__metadata("design:paramtypes", [Object, String, Array]),
69
+ tslib_1.__metadata("design:returntype", Promise)
70
+ ], CartResolver.prototype, "cartLinesAdd", null);
71
+ tslib_1.__decorate([
72
+ (0, graphql_1.Mutation)(() => cart_types_1.Cart, { description: 'Update cart line quantities' }),
73
+ tslib_1.__param(0, (0, graphql_1.Context)()),
74
+ tslib_1.__param(1, (0, graphql_1.Args)('cartId', { type: () => String })),
75
+ tslib_1.__param(2, (0, graphql_1.Args)('lines', { type: () => [cart_types_1.CartLineUpdateInput] })),
76
+ tslib_1.__metadata("design:type", Function),
77
+ tslib_1.__metadata("design:paramtypes", [Object, String, Array]),
78
+ tslib_1.__metadata("design:returntype", Promise)
79
+ ], CartResolver.prototype, "cartLinesUpdate", null);
80
+ tslib_1.__decorate([
81
+ (0, graphql_1.Mutation)(() => cart_types_1.Cart, { description: 'Remove lines from cart' }),
82
+ tslib_1.__param(0, (0, graphql_1.Context)()),
83
+ tslib_1.__param(1, (0, graphql_1.Args)('cartId', { type: () => String })),
84
+ tslib_1.__param(2, (0, graphql_1.Args)('lineIds', { type: () => [String] })),
85
+ tslib_1.__metadata("design:type", Function),
86
+ tslib_1.__metadata("design:paramtypes", [Object, String, Array]),
87
+ tslib_1.__metadata("design:returntype", Promise)
88
+ ], CartResolver.prototype, "cartLinesRemove", null);
89
+ tslib_1.__decorate([
90
+ (0, graphql_1.Mutation)(() => cart_types_1.Cart, {
91
+ description: `Apply or remove discount codes.
92
+
93
+ Flow (default):
94
+ 1. Apply coupon to Shopify directly
95
+ 2. If not applicable, check if it's a Capillary coupon (CAP_ prefix)
96
+ 3. If yes, validate with Capillary, sync to Shopify, apply again
97
+
98
+ Flow (forceCapillaryValidation=true):
99
+ 1. Skip Shopify check, validate directly with Capillary
100
+ 2. Sync coupon to Shopify
101
+ 3. Apply to cart`,
102
+ }),
103
+ tslib_1.__param(0, (0, graphql_1.Context)()),
104
+ tslib_1.__param(1, (0, graphql_1.Args)('cartId', { type: () => String })),
105
+ tslib_1.__param(2, (0, graphql_1.Args)('discountCodes', { type: () => [String] })),
106
+ tslib_1.__param(3, (0, graphql_1.Args)('mobile', { type: () => String, nullable: true, description: 'Customer mobile number for Capillary coupon validation' })),
107
+ tslib_1.__param(4, (0, graphql_1.Args)('forceCapillaryValidation', { type: () => Boolean, nullable: true, defaultValue: false, description: 'If true, skip Shopify check and validate directly with Capillary. Use when you know the coupon is a Capillary coupon.' })),
108
+ tslib_1.__metadata("design:type", Function),
109
+ tslib_1.__metadata("design:paramtypes", [Object, String, Array, String, Boolean]),
110
+ tslib_1.__metadata("design:returntype", Promise)
111
+ ], CartResolver.prototype, "cartDiscountCodesUpdate", null);
112
+ tslib_1.__decorate([
113
+ (0, graphql_1.Mutation)(() => cart_types_1.Cart, { description: 'Update buyer identity (customer, email, phone, address)' }),
114
+ tslib_1.__param(0, (0, graphql_1.Context)()),
115
+ tslib_1.__param(1, (0, graphql_1.Args)('cartId', { type: () => String })),
116
+ tslib_1.__param(2, (0, graphql_1.Args)('buyerIdentity', { type: () => cart_types_1.CartBuyerIdentityInput })),
117
+ tslib_1.__metadata("design:type", Function),
118
+ tslib_1.__metadata("design:paramtypes", [Object, String, cart_types_1.CartBuyerIdentityInput]),
119
+ tslib_1.__metadata("design:returntype", Promise)
120
+ ], CartResolver.prototype, "cartBuyerIdentityUpdate", null);
121
+ tslib_1.__decorate([
122
+ (0, graphql_1.Mutation)(() => cart_types_1.Cart, { description: 'Update cart note (order notes)' }),
123
+ tslib_1.__param(0, (0, graphql_1.Context)()),
124
+ tslib_1.__param(1, (0, graphql_1.Args)('cartId', { type: () => String })),
125
+ tslib_1.__param(2, (0, graphql_1.Args)('note', { type: () => String })),
126
+ tslib_1.__metadata("design:type", Function),
127
+ tslib_1.__metadata("design:paramtypes", [Object, String, String]),
128
+ tslib_1.__metadata("design:returntype", Promise)
129
+ ], CartResolver.prototype, "cartNoteUpdate", null);
130
+ tslib_1.__decorate([
131
+ (0, graphql_1.Mutation)(() => cart_types_1.Cart, { description: 'Update cart attributes (gift wrap, custom messages, etc.)' }),
132
+ tslib_1.__param(0, (0, graphql_1.Context)()),
133
+ tslib_1.__param(1, (0, graphql_1.Args)('cartId', { type: () => String })),
134
+ tslib_1.__param(2, (0, graphql_1.Args)('attributes', { type: () => [cart_types_1.CartAttributeInput] })),
135
+ tslib_1.__metadata("design:type", Function),
136
+ tslib_1.__metadata("design:paramtypes", [Object, String, Array]),
137
+ tslib_1.__metadata("design:returntype", Promise)
138
+ ], CartResolver.prototype, "cartAttributesUpdate", null);
139
+ tslib_1.__decorate([
140
+ (0, graphql_1.Mutation)(() => cart_types_1.Cart, { description: 'Apply or remove gift card codes' }),
141
+ tslib_1.__param(0, (0, graphql_1.Context)()),
142
+ tslib_1.__param(1, (0, graphql_1.Args)('cartId', { type: () => String })),
143
+ tslib_1.__param(2, (0, graphql_1.Args)('giftCardCodes', { type: () => [String] })),
144
+ tslib_1.__metadata("design:type", Function),
145
+ tslib_1.__metadata("design:paramtypes", [Object, String, Array]),
146
+ tslib_1.__metadata("design:returntype", Promise)
147
+ ], CartResolver.prototype, "cartGiftCardCodesUpdate", null);
148
+ exports.CartResolver = CartResolver = tslib_1.__decorate([
149
+ (0, graphql_1.Resolver)(() => cart_types_1.Cart),
150
+ (0, common_1.UseGuards)(core_1.TenantGuard),
151
+ tslib_1.__metadata("design:paramtypes", [cart_service_1.CartService])
152
+ ], CartResolver);
153
+ //# sourceMappingURL=cart.resolver.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cart.resolver.js","sourceRoot":"","sources":["../../src/cart/cart.resolver.ts"],"names":[],"mappings":";;;;AAAA,6CAA2E;AAC3E,2CAA2C;AAC3C,wCAA4C;AAC5C,iDAA6C;AAC7C,6CAMsB;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;IAGK,AAAN,KAAK,CAAC,UAAU,CAAY,GAAe;QACzC,OAAO,IAAI,CAAC,WAAW,CAAC,UAAU,CAAC,GAAG,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;IACpD,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,CA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AAE,EAAE,IAAI,EAAE,GAAG,EAAE,CAAC,CAAC,MAAM,CAAC,EAAE,CAAC,CAAA;;;;2DAGjD;uBApGU,YAAY;IAFxB,IAAA,kBAAQ,EAAC,GAAG,EAAE,CAAC,iBAAI,CAAC;IACpB,IAAA,kBAAS,EAAC,kBAAW,CAAC;6CAEqB,0BAAW;GAD1C,YAAY,CAqGxB"}
@@ -0,0 +1,31 @@
1
+ import { IntegrationFactory } from '@pvh-afl/core';
2
+ import { Cart, CartLineInput, CartLineUpdateInput, CartBuyerIdentityInput, CartAttributeInput } from './cart.types';
3
+ import { ICartHooks } from './cart.hooks';
4
+ export declare class CartService {
5
+ private readonly integrationFactory;
6
+ private readonly hooks?;
7
+ constructor(integrationFactory: IntegrationFactory, hooks?: ICartHooks | undefined);
8
+ private getCommerceService;
9
+ createCart(brand: string): Promise<Cart>;
10
+ getCart(brand: string, cartId: string): Promise<Cart | null>;
11
+ addLines(brand: string, cartId: string, lines: CartLineInput[]): Promise<Cart>;
12
+ updateLines(brand: string, cartId: string, lines: CartLineUpdateInput[]): Promise<Cart>;
13
+ removeLines(brand: string, cartId: string, lineIds: string[]): Promise<Cart>;
14
+ /**
15
+ * Update discount codes on cart.
16
+ *
17
+ * Flow:
18
+ * 1. If forceCapillaryValidation=true: Skip Shopify, validate with Capillary, sync to Shopify, apply
19
+ * 2. If forceCapillaryValidation=false (default):
20
+ * - Apply to Shopify directly
21
+ * - If any code is not applicable, check if hooks can handle it
22
+ * - If yes, validate with Capillary, sync to Shopify, apply again
23
+ */
24
+ updateDiscountCodes(brand: string, cartId: string, discountCodes: string[], mobile?: string, forceCapillaryValidation?: boolean): Promise<Cart>;
25
+ updateBuyerIdentity(brand: string, cartId: string, buyerIdentity: CartBuyerIdentityInput): Promise<Cart>;
26
+ updateNote(brand: string, cartId: string, note: string): Promise<Cart>;
27
+ updateAttributes(brand: string, cartId: string, attributes: CartAttributeInput[]): Promise<Cart>;
28
+ updateGiftCardCodes(brand: string, cartId: string, giftCardCodes: string[]): Promise<Cart>;
29
+ private mapCart;
30
+ }
31
+ //# sourceMappingURL=cart.service.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cart.service.d.ts","sourceRoot":"","sources":["../../src/cart/cart.service.ts"],"names":[],"mappings":"AACA,OAAO,EACL,kBAAkB,EAMnB,MAAM,eAAe,CAAC;AACvB,OAAO,EACL,IAAI,EACJ,aAAa,EACb,mBAAmB,EACnB,sBAAsB,EACtB,kBAAkB,EACnB,MAAM,cAAc,CAAC;AACtB,OAAO,EAAc,UAAU,EAA6B,MAAM,cAAc,CAAC;AAEjF,qBACa,WAAW;IAEpB,OAAO,CAAC,QAAQ,CAAC,kBAAkB;IACH,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAC;gBADtC,kBAAkB,EAAE,kBAAkB,EACN,KAAK,CAAC,EAAE,UAAU,YAAA;IAGrE,OAAO,CAAC,kBAAkB;IAQpB,UAAU,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAWxC,OAAO,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,GAAG,IAAI,CAAC;IAmB5D,QAAQ,CACZ,KAAK,EAAE,MAAM,EACb,MAAM,EAAE,MAAM,EACd,KAAK,EAAE,aAAa,EAAE,GACrB,OAAO,CAAC,IAAI,CAAC;IAWV,WAAW,CACf,KAAK,EAAE,MAAM,EACb,MAAM,EAAE,MAAM,EACd,KAAK,EAAE,mBAAmB,EAAE,GAC3B,OAAO,CAAC,IAAI,CAAC;IAWV,WAAW,CACf,KAAK,EAAE,MAAM,EACb,MAAM,EAAE,MAAM,EACd,OAAO,EAAE,MAAM,EAAE,GAChB,OAAO,CAAC,IAAI,CAAC;IAWhB;;;;;;;;;OASG;IACG,mBAAmB,CACvB,KAAK,EAAE,MAAM,EACb,MAAM,EAAE,MAAM,EACd,aAAa,EAAE,MAAM,EAAE,EACvB,MAAM,CAAC,EAAE,M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