@gfed-medusa/sf-lib-common 3.7.3 → 3.8.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 (127) hide show
  1. package/dist/components/breadcrumbs/index.d.ts +2 -2
  2. package/dist/components/breadcrumbs/index.d.ts.map +1 -1
  3. package/dist/components/cart-mismatch-banner/index.d.ts +2 -2
  4. package/dist/components/cart-mismatch-banner/index.d.ts.map +1 -1
  5. package/dist/components/delete-button/index.d.ts +2 -2
  6. package/dist/components/delete-button/index.d.ts.map +1 -1
  7. package/dist/components/device-id-setter/index.d.ts +5 -0
  8. package/dist/components/device-id-setter/index.d.ts.map +1 -0
  9. package/dist/components/device-id-setter/index.js +16 -0
  10. package/dist/components/device-id-setter/index.js.map +1 -0
  11. package/dist/components/error-message/index.d.ts +2 -2
  12. package/dist/components/error-message/index.d.ts.map +1 -1
  13. package/dist/components/free-shipping-price-nudge/index.d.ts +2 -2
  14. package/dist/components/interactive-link/index.d.ts +2 -2
  15. package/dist/components/line-item-options/index.d.ts +2 -2
  16. package/dist/components/localized-client-link/index.d.ts +2 -2
  17. package/dist/components/modal/index.d.ts +2 -2
  18. package/dist/components/modal/index.d.ts.map +1 -1
  19. package/dist/components/personalized-content/components/hero-banner.d.ts +31 -0
  20. package/dist/components/personalized-content/components/hero-banner.d.ts.map +1 -0
  21. package/dist/components/personalized-content/components/hero-banner.js +85 -0
  22. package/dist/components/personalized-content/components/hero-banner.js.map +1 -0
  23. package/dist/components/personalized-content/components/index.d.ts +2 -0
  24. package/dist/components/personalized-content/components/index.js +3 -0
  25. package/dist/components/preview-price/index.d.ts +2 -2
  26. package/dist/components/product-card/index.d.ts +2 -2
  27. package/dist/components/product-preview/index.d.ts +2 -4
  28. package/dist/components/product-preview/index.d.ts.map +1 -1
  29. package/dist/components/product-preview/index.js +1 -2
  30. package/dist/components/product-preview/index.js.map +1 -1
  31. package/dist/components/submit-button/index.d.ts +2 -2
  32. package/dist/components/submit-button/index.d.ts.map +1 -1
  33. package/dist/components/thumbnail/index.d.ts +0 -1
  34. package/dist/components/thumbnail/index.d.ts.map +1 -1
  35. package/dist/components/thumbnail/index.js +9 -11
  36. package/dist/components/thumbnail/index.js.map +1 -1
  37. package/dist/lib/context/apollo-context.d.ts +2 -2
  38. package/dist/lib/context/apollo-context.d.ts.map +1 -1
  39. package/dist/lib/context/modal-context.d.ts +2 -2
  40. package/dist/lib/data/context.d.ts +2 -2
  41. package/dist/lib/data/context.d.ts.map +1 -1
  42. package/dist/lib/data/personalization.d.ts +51 -0
  43. package/dist/lib/data/personalization.d.ts.map +1 -0
  44. package/dist/lib/data/personalization.js +77 -0
  45. package/dist/lib/data/personalization.js.map +1 -0
  46. package/dist/lib/gql/apollo-client.d.ts.map +1 -1
  47. package/dist/lib/gql/apollo-client.js +6 -2
  48. package/dist/lib/gql/apollo-client.js.map +1 -1
  49. package/dist/lib/gql/fragments/cart.d.ts +9 -9
  50. package/dist/lib/gql/fragments/cart.d.ts.map +1 -1
  51. package/dist/lib/gql/fragments/customer.d.ts +3 -3
  52. package/dist/lib/gql/fragments/product.d.ts +8 -8
  53. package/dist/lib/gql/fragments/product.d.ts.map +1 -1
  54. package/dist/lib/gql/mutations/cart.d.ts +6 -6
  55. package/dist/lib/gql/queries/cart-summary.d.ts +2 -2
  56. package/dist/lib/gql/queries/cart-summary.js +1 -1
  57. package/dist/lib/gql/queries/cart-summary.js.map +1 -1
  58. package/dist/lib/gql/queries/cart-total.d.ts +7 -0
  59. package/dist/lib/gql/queries/cart-total.d.ts.map +1 -0
  60. package/dist/lib/gql/queries/cart-total.js +14 -0
  61. package/dist/lib/gql/queries/cart-total.js.map +1 -0
  62. package/dist/lib/gql/queries/cart.d.ts +2 -2
  63. package/dist/lib/gql/queries/cart.d.ts.map +1 -1
  64. package/dist/lib/gql/queries/cart.js +1 -1
  65. package/dist/lib/gql/queries/cart.js.map +1 -1
  66. package/dist/lib/gql/queries/collections.d.ts +3 -3
  67. package/dist/lib/gql/queries/collections.d.ts.map +1 -1
  68. package/dist/lib/gql/queries/customer.d.ts +2 -2
  69. package/dist/lib/gql/queries/customer.d.ts.map +1 -1
  70. package/dist/lib/gql/queries/footer.d.ts +3 -3
  71. package/dist/lib/gql/queries/footer.d.ts.map +1 -1
  72. package/dist/lib/gql/queries/home-banner.d.ts +2 -2
  73. package/dist/lib/gql/queries/order.d.ts +4 -4
  74. package/dist/lib/gql/queries/order.d.ts.map +1 -1
  75. package/dist/lib/gql/queries/order.js +5 -0
  76. package/dist/lib/gql/queries/order.js.map +1 -1
  77. package/dist/lib/gql/queries/product-personalization.d.ts +7 -0
  78. package/dist/lib/gql/queries/product-personalization.d.ts.map +1 -0
  79. package/dist/lib/gql/queries/product-personalization.js +22 -0
  80. package/dist/lib/gql/queries/product-personalization.js.map +1 -0
  81. package/dist/lib/gql/queries/product.d.ts +2 -2
  82. package/dist/lib/gql/queries/regions.d.ts +3 -3
  83. package/dist/lib/hooks/use-apollo.d.ts +2 -2
  84. package/dist/lib/hooks/use-time-on-page.d.ts +13 -0
  85. package/dist/lib/hooks/use-time-on-page.d.ts.map +1 -0
  86. package/dist/lib/hooks/use-time-on-page.js +46 -0
  87. package/dist/lib/hooks/use-time-on-page.js.map +1 -0
  88. package/dist/lib/personalization/behavior-tracker.d.ts +1 -5
  89. package/dist/lib/personalization/behavior-tracker.d.ts.map +1 -1
  90. package/dist/lib/personalization/behavior-tracker.js +6 -20
  91. package/dist/lib/personalization/behavior-tracker.js.map +1 -1
  92. package/dist/lib/personalization/client-signal.d.ts +26 -0
  93. package/dist/lib/personalization/client-signal.d.ts.map +1 -0
  94. package/dist/lib/personalization/client-signal.js +105 -0
  95. package/dist/lib/personalization/client-signal.js.map +1 -0
  96. package/dist/lib/personalization/config.d.ts +2 -6
  97. package/dist/lib/personalization/config.d.ts.map +1 -1
  98. package/dist/lib/personalization/config.js +2 -16
  99. package/dist/lib/personalization/config.js.map +1 -1
  100. package/dist/lib/personalization/device-id.d.ts +5 -0
  101. package/dist/lib/personalization/device-id.d.ts.map +1 -0
  102. package/dist/lib/personalization/device-id.js +24 -0
  103. package/dist/lib/personalization/device-id.js.map +1 -0
  104. package/dist/lib/personalization/personalization-gql.d.ts +9 -0
  105. package/dist/lib/personalization/personalization-gql.d.ts.map +1 -0
  106. package/dist/lib/personalization/personalization-gql.js +42 -0
  107. package/dist/lib/personalization/personalization-gql.js.map +1 -0
  108. package/dist/lib/utils/imagekit.d.ts +2 -2
  109. package/dist/lib/utils/imagekit.js +1 -1
  110. package/dist/lib/utils/imagekit.js.map +1 -1
  111. package/dist/types/graphql.d.ts +247 -5
  112. package/dist/types/graphql.d.ts.map +1 -1
  113. package/dist/types/graphql.js +410 -3
  114. package/dist/types/graphql.js.map +1 -1
  115. package/package.json +1 -1
  116. package/dist/lib/data/contextual-banner.d.ts +0 -15
  117. package/dist/lib/data/contextual-banner.d.ts.map +0 -1
  118. package/dist/lib/data/contextual-banner.js +0 -19
  119. package/dist/lib/data/contextual-banner.js.map +0 -1
  120. package/dist/lib/gql/queries/contextual-banner.d.ts +0 -7
  121. package/dist/lib/gql/queries/contextual-banner.d.ts.map +0 -1
  122. package/dist/lib/gql/queries/contextual-banner.js +0 -21
  123. package/dist/lib/gql/queries/contextual-banner.js.map +0 -1
  124. package/dist/lib/personalization/user-profile.d.ts +0 -15
  125. package/dist/lib/personalization/user-profile.d.ts.map +0 -1
  126. package/dist/lib/personalization/user-profile.js +0 -47
  127. package/dist/lib/personalization/user-profile.js.map +0 -1
@@ -0,0 +1,51 @@
1
+ import { StorefrontContext } from "./context.js";
2
+
3
+ //#region src/lib/data/personalization.d.ts
4
+ declare function getDeviceIdFromCookieHeader(cookieHeader?: string): string;
5
+ declare function sendSignal(type: string, ctx: StorefrontContext, payload?: Record<string, unknown>, url?: string, userId?: string): Promise<boolean>;
6
+ declare function sendPageViewSignal(surface: string, ctx: StorefrontContext, payload?: Record<string, unknown>, userId?: string): Promise<boolean>;
7
+ interface PersonalizedComponent {
8
+ component: string;
9
+ contentId: string | null;
10
+ propsOverrides: Record<string, unknown>;
11
+ priority: number;
12
+ reasoning: string;
13
+ score: number;
14
+ }
15
+ interface PersonalizationReasoning {
16
+ intent: string;
17
+ confidence: number;
18
+ factors: string[];
19
+ modelVersion: string;
20
+ }
21
+ interface PersonalizationResult {
22
+ components: PersonalizedComponent[];
23
+ reasoning: PersonalizationReasoning;
24
+ cacheKey: string;
25
+ servedAt: string;
26
+ }
27
+ declare function getPersonalization(surface: string, page: string, deviceId: string, ctx: StorefrontContext, context?: {
28
+ productId?: string;
29
+ cartValue?: number;
30
+ category?: string;
31
+ searchQuery?: string;
32
+ }, userId?: string): Promise<PersonalizationResult | null>;
33
+ interface ConversionInput {
34
+ deviceId: string;
35
+ userId?: string;
36
+ checkoutSignalId?: string;
37
+ orderId: string;
38
+ amount: number;
39
+ currency: string;
40
+ items?: Array<{
41
+ productId: string;
42
+ variantId?: string;
43
+ quantity: number;
44
+ price: number;
45
+ category?: string;
46
+ }>;
47
+ }
48
+ declare function submitConversion(input: ConversionInput, ctx: StorefrontContext): Promise<boolean>;
49
+ //#endregion
50
+ export { PersonalizationReasoning, PersonalizationResult, PersonalizedComponent, getDeviceIdFromCookieHeader, getPersonalization, sendPageViewSignal, sendSignal, submitConversion };
51
+ //# sourceMappingURL=personalization.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"personalization.d.ts","names":[],"sources":["../../../src/lib/data/personalization.ts"],"sourcesContent":[],"mappings":";;;iBAWgB,2BAAA;iBAMM,UAAA,oBAEf,6BACK,yDAGT;AAZa,iBA0CA,kBAAA,CA1C2B,OAAA,EAAA,MAAA,EAAA,GAAA,EA4CpC,iBA5CoC,EAAA,OAAA,CAAA,EA6C/B,MA7C+B,CAAA,MAAA,EAAA,OAAA,CAAA,EAAA,MAAA,CAAA,EAAA,MAAA,CAAA,EA+CxC,OA/CwC,CAAA,OAAA,CAAA;AAMrB,UA6CL,qBAAA,CA7Ce;EAEzB,SAAA,EAAA,MAAA;EACK,SAAA,EAAA,MAAA,GAAA,IAAA;EAGT,cAAA,EA0Ce,MA1Cf,CAAA,MAAA,EAAA,OAAA,CAAA;EAAO,QAAA,EAAA,MAAA;EA8BM,SAAA,EAAA,MAAA;EAET,KAAA,EAAA,MAAA;;AAGJ,UAac,wBAAA,CAbd;EAAO,MAAA,EAAA,MAAA;EAIO,UAAA,EAAA,MAAA;EASA,OAAA,EAAA,MAAA,EAAA;EAOA,YAAA,EAAA,MAAA;AAwBjB;AAIO,UA5BU,qBAAA,CA4BV;EAQI,UAAA,EAnCG,qBAmCH,EAAA;EAAR,SAAA,EAlCU,wBAkCV;EAAO,QAAA,EAAA,MAAA;EA6BA,QAAA,EAAA,MAAA;AAUV;AACS,iBApDa,kBAAA,CAoDb,OAAA,EAAA,MAAA,EAAA,IAAA,EAAA,MAAA,EAAA,QAAA,EAAA,MAAA,EAAA,GAAA,EAhDF,iBAgDE,EAAA,QAAA,EAAA;EACF,SAAA,CAAA,EAAA,MAAA;EACJ,SAAA,CAAA,EAAA,MAAA;EAAO,QAAA,CAAA,EAAA,MAAA;;qBA1CP,QAAQ;UA6BD,eAAA;;;;;;;UAOA;;;;;;;;iBAGY,gBAAA,QACb,sBACF,oBACJ"}
@@ -0,0 +1,77 @@
1
+ import { createServerApolloClient, graphqlFetch, graphqlMutation } from "../gql/apollo-client.js";
2
+ import { PERSONALIZE_QUERY, SEND_SIGNAL_MUTATION, SUBMIT_CONVERSION_MUTATION } from "../personalization/personalization-gql.js";
3
+
4
+ //#region src/lib/data/personalization.ts
5
+ const DEVICE_ID_COOKIE = "_jg_device_id";
6
+ function getDeviceIdFromCookieHeader(cookieHeader) {
7
+ if (!cookieHeader) return "";
8
+ const match = cookieHeader.match(/* @__PURE__ */ new RegExp(`${DEVICE_ID_COOKIE}=([^;]+)`));
9
+ return match ? decodeURIComponent(match[1] ?? "") : "";
10
+ }
11
+ async function sendSignal(type, ctx, payload, url, userId) {
12
+ const deviceId = getDeviceIdFromCookieHeader(ctx.cookieHeader);
13
+ if (!deviceId) return false;
14
+ const apolloClient = createServerApolloClient(ctx.cookieHeader);
15
+ try {
16
+ await graphqlMutation({
17
+ mutation: SEND_SIGNAL_MUTATION,
18
+ variables: { input: {
19
+ deviceId,
20
+ ...userId ? { userId } : {},
21
+ type,
22
+ payload: payload ?? {},
23
+ url: url ?? "",
24
+ timestamp: Date.now()
25
+ } }
26
+ }, apolloClient);
27
+ return true;
28
+ } catch (error) {
29
+ console.warn("[sendSignal] Failed to send signal:", type, error);
30
+ return false;
31
+ }
32
+ }
33
+ function sendPageViewSignal(surface, ctx, payload, userId) {
34
+ return sendSignal("PAGE_VIEW", ctx, {
35
+ ...payload,
36
+ surface
37
+ }, void 0, userId);
38
+ }
39
+ async function getPersonalization(surface, page, deviceId, ctx, context, userId) {
40
+ if (!deviceId) return null;
41
+ const apolloClient = createServerApolloClient(ctx.cookieHeader);
42
+ try {
43
+ return (await graphqlFetch({
44
+ query: PERSONALIZE_QUERY,
45
+ variables: {
46
+ input: {
47
+ surface,
48
+ page,
49
+ ...context
50
+ },
51
+ deviceId,
52
+ ...userId ? { userId } : {}
53
+ }
54
+ }, apolloClient))?.personalize ?? null;
55
+ } catch (error) {
56
+ console.error("[getPersonalization]", error);
57
+ return null;
58
+ }
59
+ }
60
+ async function submitConversion(input, ctx) {
61
+ if (!input.deviceId) return false;
62
+ const apolloClient = createServerApolloClient(ctx.cookieHeader);
63
+ try {
64
+ await graphqlMutation({
65
+ mutation: SUBMIT_CONVERSION_MUTATION,
66
+ variables: { input }
67
+ }, apolloClient);
68
+ return true;
69
+ } catch (error) {
70
+ console.error("[submitConversion] Failed:", error);
71
+ return false;
72
+ }
73
+ }
74
+
75
+ //#endregion
76
+ export { getDeviceIdFromCookieHeader, getPersonalization, sendPageViewSignal, sendSignal, submitConversion };
77
+ //# sourceMappingURL=personalization.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"personalization.js","names":[],"sources":["../../../src/lib/data/personalization.ts"],"sourcesContent":["import { createServerApolloClient, graphqlFetch, graphqlMutation } from '@/lib/gql/apollo-client';\n\nimport {\n PERSONALIZE_QUERY,\n SEND_SIGNAL_MUTATION,\n SUBMIT_CONVERSION_MUTATION,\n} from '@/lib/personalization/personalization-gql';\nimport type { StorefrontContext } from './context';\n\nconst DEVICE_ID_COOKIE = '_jg_device_id';\n\nexport function getDeviceIdFromCookieHeader(cookieHeader?: string): string {\n if (!cookieHeader) return '';\n const match = cookieHeader.match(new RegExp(`${DEVICE_ID_COOKIE}=([^;]+)`));\n return match ? decodeURIComponent(match[1] ?? '') : '';\n}\n\nexport async function sendSignal(\n type: string,\n ctx: StorefrontContext,\n payload?: Record<string, unknown>,\n url?: string,\n userId?: string\n): Promise<boolean> {\n const deviceId = getDeviceIdFromCookieHeader(ctx.cookieHeader);\n if (!deviceId) return false;\n\n const apolloClient = createServerApolloClient(ctx.cookieHeader);\n\n try {\n await graphqlMutation<Record<string, unknown>, { input: Record<string, unknown> }>(\n {\n mutation: SEND_SIGNAL_MUTATION,\n variables: {\n input: {\n deviceId,\n ...(userId ? { userId } : {}),\n type,\n payload: payload ?? {},\n url: url ?? '',\n timestamp: Date.now(),\n },\n },\n },\n apolloClient\n );\n return true;\n } catch (error) {\n console.warn('[sendSignal] Failed to send signal:', type, error);\n return false;\n }\n}\n\nexport function sendPageViewSignal(\n surface: string,\n ctx: StorefrontContext,\n payload?: Record<string, unknown>,\n userId?: string\n): Promise<boolean> {\n return sendSignal('PAGE_VIEW', ctx, { ...payload, surface }, undefined, userId);\n}\n\nexport interface PersonalizedComponent {\n component: string;\n contentId: string | null;\n propsOverrides: Record<string, unknown>;\n priority: number;\n reasoning: string;\n score: number;\n}\n\nexport interface PersonalizationReasoning {\n intent: string;\n confidence: number;\n factors: string[];\n modelVersion: string;\n}\n\nexport interface PersonalizationResult {\n components: PersonalizedComponent[];\n reasoning: PersonalizationReasoning;\n cacheKey: string;\n servedAt: string;\n}\n\ntype PersonalizeQueryResult = {\n personalize: PersonalizationResult;\n};\n\ntype PersonalizeQueryVariables = {\n input: {\n surface: string;\n page: string;\n productId?: string;\n cartValue?: number;\n category?: string;\n searchQuery?: string;\n };\n deviceId: string;\n userId?: string;\n};\n\nexport async function getPersonalization(\n surface: string,\n page: string,\n deviceId: string,\n ctx: StorefrontContext,\n context?: {\n productId?: string;\n cartValue?: number;\n category?: string;\n searchQuery?: string;\n },\n userId?: string\n): Promise<PersonalizationResult | null> {\n if (!deviceId) return null;\n\n const apolloClient = createServerApolloClient(ctx.cookieHeader);\n\n try {\n const data = await graphqlFetch<PersonalizeQueryResult, PersonalizeQueryVariables>(\n {\n query: PERSONALIZE_QUERY,\n variables: {\n input: {\n surface,\n page,\n ...context,\n },\n deviceId,\n ...(userId ? { userId } : {}),\n },\n },\n apolloClient\n );\n\n return data?.personalize ?? null;\n } catch (error) {\n console.error('[getPersonalization]', error);\n return null;\n }\n}\n\ninterface ConversionInput {\n deviceId: string;\n userId?: string;\n checkoutSignalId?: string;\n orderId: string;\n amount: number;\n currency: string;\n items?: Array<{ productId: string; variantId?: string; quantity: number; price: number; category?: string }>;\n}\n\nexport async function submitConversion(\n input: ConversionInput,\n ctx: StorefrontContext\n): Promise<boolean> {\n if (!input.deviceId) return false;\n\n const apolloClient = createServerApolloClient(ctx.cookieHeader);\n\n try {\n await graphqlMutation<Record<string, boolean>, { input: ConversionInput }>(\n {\n mutation: SUBMIT_CONVERSION_MUTATION,\n variables: { input },\n },\n apolloClient\n );\n return true;\n } catch (error) {\n console.error('[submitConversion] Failed:', error);\n return false;\n }\n}\n"],"mappings":";;;;AASA,MAAM,mBAAmB;AAEzB,SAAgB,4BAA4B,cAA+B;AACzE,KAAI,CAAC,aAAc,QAAO;CAC1B,MAAM,QAAQ,aAAa,sBAAM,IAAI,OAAO,GAAG,iBAAiB,UAAU,CAAC;AAC3E,QAAO,QAAQ,mBAAmB,MAAM,MAAM,GAAG,GAAG;;AAGtD,eAAsB,WACpB,MACA,KACA,SACA,KACA,QACkB;CAClB,MAAM,WAAW,4BAA4B,IAAI,aAAa;AAC9D,KAAI,CAAC,SAAU,QAAO;CAEtB,MAAM,eAAe,yBAAyB,IAAI,aAAa;AAE/D,KAAI;AACF,QAAM,gBACJ;GACE,UAAU;GACV,WAAW,EACT,OAAO;IACL;IACA,GAAI,SAAS,EAAE,QAAQ,GAAG,EAAE;IAC5B;IACA,SAAS,WAAW,EAAE;IACtB,KAAK,OAAO;IACZ,WAAW,KAAK,KAAK;IACtB,EACF;GACF,EACD,aACD;AACD,SAAO;UACA,OAAO;AACd,UAAQ,KAAK,uCAAuC,MAAM,MAAM;AAChE,SAAO;;;AAIX,SAAgB,mBACd,SACA,KACA,SACA,QACkB;AAClB,QAAO,WAAW,aAAa,KAAK;EAAE,GAAG;EAAS;EAAS,EAAE,QAAW,OAAO;;AA2CjF,eAAsB,mBACpB,SACA,MACA,UACA,KACA,SAMA,QACuC;AACvC,KAAI,CAAC,SAAU,QAAO;CAEtB,MAAM,eAAe,yBAAyB,IAAI,aAAa;AAE/D,KAAI;AAiBF,UAhBa,MAAM,aACjB;GACE,OAAO;GACP,WAAW;IACT,OAAO;KACL;KACA;KACA,GAAG;KACJ;IACD;IACA,GAAI,SAAS,EAAE,QAAQ,GAAG,EAAE;IAC7B;GACF,EACD,aACD,GAEY,eAAe;UACrB,OAAO;AACd,UAAQ,MAAM,wBAAwB,MAAM;AAC5C,SAAO;;;AAcX,eAAsB,iBACpB,OACA,KACkB;AAClB,KAAI,CAAC,MAAM,SAAU,QAAO;CAE5B,MAAM,eAAe,yBAAyB,IAAI,aAAa;AAE/D,KAAI;AACF,QAAM,gBACJ;GACE,UAAU;GACV,WAAW,EAAE,OAAO;GACrB,EACD,aACD;AACD,SAAO;UACA,OAAO;AACd,UAAQ,MAAM,8BAA8B,MAAM;AAClD,SAAO"}
@@ -1 +1 @@
1
- {"version":3,"file":"apollo-client.d.ts","names":[],"sources":["../../../src/lib/gql/apollo-client.ts"],"sourcesContent":[],"mappings":";;;;cA2BM,cAAY;;AAnBM;AAmCxB;AA2BA;AASA;;AAIqC,iBAxCrB,wBAAA,CAwCqB,YAAA,CAAA,EAAA,MAAA,CAAA,EAxCyB,YAwCzB;AAAS,iBAb9B,gBAAA,CAa8B,GAAA,CAAA,EAbR,eAaQ,GAAA,IAAA,CAAA,EAbqB,YAarB;AAAnC,iBAJW,YAIE,CAAA,OAAA,EAAA,mBAFH,kBAEG,CAAA,CAAA,OAAA,EAAb,YAAA,CAAa,YAAA,CAAa,OAAb,EAAsB,UAAtB,CAAA,EAAA,oBAAA,CAAA,EACC,YADD,CAAA,EAErB,OAFqB,CAEb,OAFa,GAAA,SAAA,CAAA;AACC,iBAiBH,eAjBG,CAAA,OAAA,EAAA,mBAmBJ,kBAnBI,CAAA,CAAA,OAAA,EAqBd,YAAA,CAAa,aArBC,CAqBa,OArBb,EAqBsB,UArBtB,CAAA,EAAA,oBAAA,CAAA,EAsBA,YAtBA,CAAA,EAuBtB,OAvBsB,CAuBd,OAvBc,GAAA,SAAA,CAAA"}
1
+ {"version":3,"file":"apollo-client.d.ts","names":[],"sources":["../../../src/lib/gql/apollo-client.ts"],"sourcesContent":[],"mappings":";;;;cA2BM,cAAY;;AAnBM;AAmCxB;AAqCA;AASA;;AAIqC,iBAlDrB,wBAAA,CAkDqB,YAAA,CAAA,EAAA,MAAA,CAAA,EAlDyB,YAkDzB;AAAS,iBAb9B,gBAAA,CAa8B,GAAA,CAAA,EAbR,eAaQ,GAAA,IAAA,CAAA,EAbqB,YAarB;AAAnC,iBAJW,YAIE,CAAA,OAAA,EAAA,mBAFH,kBAEG,CAAA,CAAA,OAAA,EAAb,YAAA,CAAa,YAAA,CAAa,OAAb,EAAsB,UAAtB,CAAA,EAAA,oBAAA,CAAA,EACC,YADD,CAAA,EAErB,OAFqB,CAEb,OAFa,GAAA,SAAA,CAAA;AACC,iBAgBH,eAhBG,CAAA,OAAA,EAAA,mBAkBJ,kBAlBI,CAAA,CAAA,OAAA,EAoBd,YAAA,CAAa,aApBC,CAoBa,OApBb,EAoBsB,UApBtB,CAAA,EAAA,oBAAA,CAAA,EAqBA,YArBA,CAAA,EAsBtB,OAtBsB,CAsBd,OAtBc,GAAA,SAAA,CAAA"}
@@ -24,11 +24,15 @@ const apolloClient = new ApolloClient({
24
24
  * @returns Server-side Apollo client
25
25
  */
26
26
  function createServerApolloClient(cookieHeader) {
27
+ const bffApiKey = process.env.BFF_API_KEY;
27
28
  return new ApolloClient({
28
29
  link: new ApolloLink((operation, forward) => {
29
- if (cookieHeader) operation.setContext({
30
+ const headers = {};
31
+ if (cookieHeader) headers.Cookie = cookieHeader;
32
+ if (bffApiKey) headers["x-bff-api-key"] = bffApiKey;
33
+ if (Object.keys(headers).length > 0) operation.setContext({
30
34
  http: { includeCredentials: true },
31
- headers: { Cookie: cookieHeader }
35
+ headers
32
36
  });
33
37
  return forward(operation);
34
38
  }).concat(httpLink),
@@ -1 +1 @@
1
- {"version":3,"file":"apollo-client.js","names":["error: any"],"sources":["../../../src/lib/gql/apollo-client.ts"],"sourcesContent":["import { IncomingMessage } from 'http';\n\nimport { ApolloLink } from '@apollo/client';\nimport {\n ApolloClient,\n HttpLink,\n InMemoryCache,\n OperationVariables,\n} from '@apollo/client';\n\nimport { getBaseURL } from '../utils/env';\n\nconst isServer = () => typeof window === 'undefined';\n\nconst getGraphQLEndpoint = () => {\n const endpoint = process.env.NEXT_PUBLIC_GRAPHQL_ENDPOINT;\n if (endpoint) return isServer() ? `${getBaseURL()}${endpoint}` : endpoint;\n\n // Defaults to home's graphql endpoint\n return isServer() ? `${getBaseURL()}/api/graphql` : '/api/graphql';\n};\n\nconst httpLink = new HttpLink({\n uri: getGraphQLEndpoint(),\n credentials: 'include',\n});\n\nconst apolloClient = new ApolloClient({\n link: httpLink,\n cache: new InMemoryCache({}),\n defaultOptions: {\n watchQuery: {\n notifyOnNetworkStatusChange: true,\n },\n },\n});\n\n/**\n * When requests are sent from the server, cookies need to be manually attached.\n *\n * @param cookieHeader Cookies string to forward\n * @returns Server-side Apollo client\n */\nexport function createServerApolloClient(cookieHeader?: string) {\n const authLink = new ApolloLink((operation, forward) => {\n if (cookieHeader) {\n operation.setContext({\n http: {\n includeCredentials: true,\n },\n headers: {\n Cookie: cookieHeader,\n },\n });\n }\n\n return forward(operation);\n });\n\n return new ApolloClient({\n link: authLink.concat(httpLink),\n cache: new InMemoryCache({}),\n defaultOptions: {\n watchQuery: {\n notifyOnNetworkStatusChange: true,\n },\n },\n });\n}\n\nexport function initializeApollo(req: IncomingMessage | null = null) {\n if (isServer()) {\n const cookieHeader = req?.headers.cookie;\n return createServerApolloClient(cookieHeader);\n }\n\n return apolloClient;\n}\n\nexport async function graphqlFetch<\n TResult,\n TVariables extends OperationVariables,\n>(\n options: ApolloClient.QueryOptions<TResult, TVariables>,\n apolloClientOverride?: ApolloClient\n): Promise<TResult | undefined> {\n try {\n const client = apolloClientOverride || apolloClient;\n\n const { data } = await client.query<TResult, TVariables>({\n ...options,\n fetchPolicy: 'network-only',\n });\n\n return data;\n } catch (error: any) {\n // TODO - Better error handling\n throw new Error(error.message || 'GraphQL error');\n }\n}\n\nexport async function graphqlMutation<\n TResult,\n TVariables extends OperationVariables,\n>(\n options: ApolloClient.MutateOptions<TResult, TVariables>,\n apolloClientOverride?: ApolloClient\n): Promise<TResult | undefined> {\n try {\n const client = apolloClientOverride || apolloClient;\n\n const { data } = await client.mutate<TResult, TVariables>({\n ...options,\n fetchPolicy: 'network-only',\n });\n\n return data;\n } catch (error: any) {\n // TODO - Better error handling\n throw new Error(error.message || 'GraphQL error');\n }\n}\nexport default apolloClient;\n"],"mappings":";;;;AAYA,MAAM,iBAAiB,OAAO,WAAW;AAEzC,MAAM,2BAA2B;CAC/B,MAAM,WAAW,QAAQ,IAAI;AAC7B,KAAI,SAAU,QAAO,UAAU,GAAG,GAAG,YAAY,GAAG,aAAa;AAGjE,QAAO,UAAU,GAAG,GAAG,YAAY,CAAC,gBAAgB;;AAGtD,MAAM,WAAW,IAAI,SAAS;CAC5B,KAAK,oBAAoB;CACzB,aAAa;CACd,CAAC;AAEF,MAAM,eAAe,IAAI,aAAa;CACpC,MAAM;CACN,OAAO,IAAI,cAAc,EAAE,CAAC;CAC5B,gBAAgB,EACd,YAAY,EACV,6BAA6B,MAC9B,EACF;CACF,CAAC;;;;;;;AAQF,SAAgB,yBAAyB,cAAuB;AAgB9D,QAAO,IAAI,aAAa;EACtB,MAhBe,IAAI,YAAY,WAAW,YAAY;AACtD,OAAI,aACF,WAAU,WAAW;IACnB,MAAM,EACJ,oBAAoB,MACrB;IACD,SAAS,EACP,QAAQ,cACT;IACF,CAAC;AAGJ,UAAO,QAAQ,UAAU;IACzB,CAGe,OAAO,SAAS;EAC/B,OAAO,IAAI,cAAc,EAAE,CAAC;EAC5B,gBAAgB,EACd,YAAY,EACV,6BAA6B,MAC9B,EACF;EACF,CAAC;;AAGJ,SAAgB,iBAAiB,MAA8B,MAAM;AACnE,KAAI,UAAU,EAAE;EACd,MAAM,eAAe,KAAK,QAAQ;AAClC,SAAO,yBAAyB,aAAa;;AAG/C,QAAO;;AAGT,eAAsB,aAIpB,SACA,sBAC8B;AAC9B,KAAI;EAGF,MAAM,EAAE,SAAS,OAFF,wBAAwB,cAET,MAA2B;GACvD,GAAG;GACH,aAAa;GACd,CAAC;AAEF,SAAO;UACAA,OAAY;AAEnB,QAAM,IAAI,MAAM,MAAM,WAAW,gBAAgB;;;AAIrD,eAAsB,gBAIpB,SACA,sBAC8B;AAC9B,KAAI;EAGF,MAAM,EAAE,SAAS,OAFF,wBAAwB,cAET,OAA4B;GACxD,GAAG;GACH,aAAa;GACd,CAAC;AAEF,SAAO;UACAA,OAAY;AAEnB,QAAM,IAAI,MAAM,MAAM,WAAW,gBAAgB;;;AAGrD,4BAAe"}
1
+ {"version":3,"file":"apollo-client.js","names":["headers: Record<string, string>","error: any"],"sources":["../../../src/lib/gql/apollo-client.ts"],"sourcesContent":["import { IncomingMessage } from 'http';\n\nimport { ApolloLink } from '@apollo/client';\nimport {\n ApolloClient,\n HttpLink,\n InMemoryCache,\n OperationVariables,\n} from '@apollo/client';\n\nimport { getBaseURL } from '../utils/env';\n\nconst isServer = () => typeof window === 'undefined';\n\nconst getGraphQLEndpoint = () => {\n const endpoint = process.env.NEXT_PUBLIC_GRAPHQL_ENDPOINT;\n if (endpoint) return isServer() ? `${getBaseURL()}${endpoint}` : endpoint;\n\n // Defaults to home's graphql endpoint\n return isServer() ? `${getBaseURL()}/api/graphql` : '/api/graphql';\n};\n\nconst httpLink = new HttpLink({\n uri: getGraphQLEndpoint(),\n credentials: 'include',\n});\n\nconst apolloClient = new ApolloClient({\n link: httpLink,\n cache: new InMemoryCache({}),\n defaultOptions: {\n watchQuery: {\n notifyOnNetworkStatusChange: true,\n },\n },\n});\n\n/**\n * When requests are sent from the server, cookies need to be manually attached.\n *\n * @param cookieHeader Cookies string to forward\n * @returns Server-side Apollo client\n */\nexport function createServerApolloClient(cookieHeader?: string) {\n const bffApiKey = process.env.BFF_API_KEY;\n\n const authLink = new ApolloLink((operation, forward) => {\n const headers: Record<string, string> = {};\n\n if (cookieHeader) {\n headers.Cookie = cookieHeader;\n }\n\n if (bffApiKey) {\n headers['x-bff-api-key'] = bffApiKey;\n }\n\n if (Object.keys(headers).length > 0) {\n operation.setContext({\n http: {\n includeCredentials: true,\n },\n headers,\n });\n }\n\n return forward(operation);\n });\n\n return new ApolloClient({\n link: authLink.concat(httpLink),\n cache: new InMemoryCache({}),\n defaultOptions: {\n watchQuery: {\n notifyOnNetworkStatusChange: true,\n },\n },\n });\n}\n\nexport function initializeApollo(req: IncomingMessage | null = null) {\n if (isServer()) {\n const cookieHeader = req?.headers.cookie;\n return createServerApolloClient(cookieHeader);\n }\n\n return apolloClient;\n}\n\nexport async function graphqlFetch<\n TResult,\n TVariables extends OperationVariables,\n>(\n options: ApolloClient.QueryOptions<TResult, TVariables>,\n apolloClientOverride?: ApolloClient\n): Promise<TResult | undefined> {\n try {\n const client = apolloClientOverride || apolloClient;\n\n const { data } = await client.query<TResult, TVariables>({\n ...options,\n fetchPolicy: 'network-only',\n });\n\n return data;\n } catch (error: any) {\n throw new Error(error.message || 'GraphQL error');\n }\n}\n\nexport async function graphqlMutation<\n TResult,\n TVariables extends OperationVariables,\n>(\n options: ApolloClient.MutateOptions<TResult, TVariables>,\n apolloClientOverride?: ApolloClient\n): Promise<TResult | undefined> {\n try {\n const client = apolloClientOverride || apolloClient;\n\n const { data } = await client.mutate<TResult, TVariables>({\n ...options,\n fetchPolicy: 'network-only',\n });\n\n return data;\n } catch (error: any) {\n throw new Error(error.message || 'GraphQL error');\n }\n}\nexport default apolloClient;\n"],"mappings":";;;;AAYA,MAAM,iBAAiB,OAAO,WAAW;AAEzC,MAAM,2BAA2B;CAC/B,MAAM,WAAW,QAAQ,IAAI;AAC7B,KAAI,SAAU,QAAO,UAAU,GAAG,GAAG,YAAY,GAAG,aAAa;AAGjE,QAAO,UAAU,GAAG,GAAG,YAAY,CAAC,gBAAgB;;AAGtD,MAAM,WAAW,IAAI,SAAS;CAC5B,KAAK,oBAAoB;CACzB,aAAa;CACd,CAAC;AAEF,MAAM,eAAe,IAAI,aAAa;CACpC,MAAM;CACN,OAAO,IAAI,cAAc,EAAE,CAAC;CAC5B,gBAAgB,EACd,YAAY,EACV,6BAA6B,MAC9B,EACF;CACF,CAAC;;;;;;;AAQF,SAAgB,yBAAyB,cAAuB;CAC9D,MAAM,YAAY,QAAQ,IAAI;AAyB9B,QAAO,IAAI,aAAa;EACtB,MAxBe,IAAI,YAAY,WAAW,YAAY;GACtD,MAAMA,UAAkC,EAAE;AAE1C,OAAI,aACF,SAAQ,SAAS;AAGnB,OAAI,UACF,SAAQ,mBAAmB;AAG7B,OAAI,OAAO,KAAK,QAAQ,CAAC,SAAS,EAChC,WAAU,WAAW;IACnB,MAAM,EACJ,oBAAoB,MACrB;IACD;IACD,CAAC;AAGJ,UAAO,QAAQ,UAAU;IACzB,CAGe,OAAO,SAAS;EAC/B,OAAO,IAAI,cAAc,EAAE,CAAC;EAC5B,gBAAgB,EACd,YAAY,EACV,6BAA6B,MAC9B,EACF;EACF,CAAC;;AAGJ,SAAgB,iBAAiB,MAA8B,MAAM;AACnE,KAAI,UAAU,EAAE;EACd,MAAM,eAAe,KAAK,QAAQ;AAClC,SAAO,yBAAyB,aAAa;;AAG/C,QAAO;;AAGT,eAAsB,aAIpB,SACA,sBAC8B;AAC9B,KAAI;EAGF,MAAM,EAAE,SAAS,OAFF,wBAAwB,cAET,MAA2B;GACvD,GAAG;GACH,aAAa;GACd,CAAC;AAEF,SAAO;UACAC,OAAY;AACnB,QAAM,IAAI,MAAM,MAAM,WAAW,gBAAgB;;;AAIrD,eAAsB,gBAIpB,SACA,sBAC8B;AAC9B,KAAI;EAGF,MAAM,EAAE,SAAS,OAFF,wBAAwB,cAET,OAA4B;GACxD,GAAG;GACH,aAAa;GACd,CAAC;AAEF,SAAO;UACAA,OAAY;AACnB,QAAM,IAAI,MAAM,MAAM,WAAW,gBAAgB;;;AAGrD,4BAAe"}
@@ -1,14 +1,14 @@
1
- import * as _apollo_client29 from "@apollo/client";
1
+ import * as _apollo_client5 from "@apollo/client";
2
2
 
3
3
  //#region src/lib/gql/fragments/cart.d.ts
4
- declare const LINE_ITEM_FRAGMENT: _apollo_client29.DocumentNode;
5
- declare const COUNTRY_FRAGMENT: _apollo_client29.DocumentNode;
6
- declare const REGION_FRAGMENT: _apollo_client29.DocumentNode;
7
- declare const SHIPPING_METHODS_FRAGMENT: _apollo_client29.DocumentNode;
8
- declare const PAYMENT_COLLECTION_FRAGMENT: _apollo_client29.DocumentNode;
9
- declare const ADDRESS_FRAGMENT: _apollo_client29.DocumentNode;
10
- declare const PROMOTION_FRAGMENT: _apollo_client29.DocumentNode;
11
- declare const CART_FRAGMENT: _apollo_client29.DocumentNode;
4
+ declare const LINE_ITEM_FRAGMENT: _apollo_client5.DocumentNode;
5
+ declare const COUNTRY_FRAGMENT: _apollo_client5.DocumentNode;
6
+ declare const REGION_FRAGMENT: _apollo_client5.DocumentNode;
7
+ declare const SHIPPING_METHODS_FRAGMENT: _apollo_client5.DocumentNode;
8
+ declare const PAYMENT_COLLECTION_FRAGMENT: _apollo_client5.DocumentNode;
9
+ declare const ADDRESS_FRAGMENT: _apollo_client5.DocumentNode;
10
+ declare const PROMOTION_FRAGMENT: _apollo_client5.DocumentNode;
11
+ declare const CART_FRAGMENT: _apollo_client5.DocumentNode;
12
12
  //#endregion
13
13
  export { ADDRESS_FRAGMENT, CART_FRAGMENT, COUNTRY_FRAGMENT, LINE_ITEM_FRAGMENT, PAYMENT_COLLECTION_FRAGMENT, PROMOTION_FRAGMENT, REGION_FRAGMENT, SHIPPING_METHODS_FRAGMENT };
14
14
  //# sourceMappingURL=cart.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"cart.d.ts","names":[],"sources":["../../../../src/lib/gql/fragments/cart.ts"],"sourcesContent":[],"mappings":";;;cAIa,oBAiBZ,gBAAA,CAjB8B;cAmBlB,kBAOZ,gBAAA,CAP4B;cAShB,iBAWZ,gBAAA,CAX2B;AA5Bf,cAyCA,yBAxBZ,EAkCA,gBAAA,CAVqC,YAxBrC;AAEY,cAkCA,2BA3BZ,EA6CA,gBAAA,CAlBuC,YA3BvC;AAEY,cA6CA,gBAlCZ,EA4CA,gBAAA,CAV4B,YAlC5B;AAEY,cA4CA,kBAlCZ,EA4CA,gBAAA,CAV8B,YAlC9B;AAEY,cA4CA,aA1BZ,EAqEA,gBAAA,CA3CyB,YA5Cc"}
1
+ {"version":3,"file":"cart.d.ts","names":[],"sources":["../../../../src/lib/gql/fragments/cart.ts"],"sourcesContent":[],"mappings":";;;cAIa,oBAiBZ,eAAA,CAjB8B;cAmBlB,kBAOZ,eAAA,CAP4B;cAShB,iBAWZ,eAAA,CAX2B;AA5Bf,cAyCA,yBAxBZ,EAkCA,eAAA,CAVqC,YAxBrC;AAEY,cAkCA,2BA3BZ,EA6CA,eAAA,CAlBuC,YA3BvC;AAEY,cA6CA,gBAlCZ,EA4CA,eAAA,CAV4B,YAlC5B;AAEY,cA4CA,kBAlCZ,EA4CA,eAAA,CAV8B,YAlC9B;AAEY,cA4CA,aA1BZ,EAqEA,eAAA,CA3CyB,YA5Cc"}
@@ -1,8 +1,8 @@
1
- import * as _apollo_client37 from "@apollo/client";
1
+ import * as _apollo_client13 from "@apollo/client";
2
2
 
3
3
  //#region src/lib/gql/fragments/customer.d.ts
4
- declare const CUSTOMER_ADDRESS_FRAGMENT: _apollo_client37.DocumentNode;
5
- declare const CUSTOMER_FRAGMENT: _apollo_client37.DocumentNode;
4
+ declare const CUSTOMER_ADDRESS_FRAGMENT: _apollo_client13.DocumentNode;
5
+ declare const CUSTOMER_FRAGMENT: _apollo_client13.DocumentNode;
6
6
  //#endregion
7
7
  export { CUSTOMER_ADDRESS_FRAGMENT, CUSTOMER_FRAGMENT };
8
8
  //# sourceMappingURL=customer.d.ts.map
@@ -1,13 +1,13 @@
1
- import * as _apollo_client9 from "@apollo/client";
1
+ import * as _apollo_client18 from "@apollo/client";
2
2
 
3
3
  //#region src/lib/gql/fragments/product.d.ts
4
- declare const PRICE_FRAGMENT: _apollo_client9.DocumentNode;
5
- declare const PRODUCT_VARIANT_FRAGMENT: _apollo_client9.DocumentNode;
6
- declare const PRODUCT_CATEGORY_FRAGMENT: _apollo_client9.DocumentNode;
7
- declare const PRODUCT_COLLECTION_FRAGMENT: _apollo_client9.DocumentNode;
8
- declare const PRODUCT_IMAGE_FRAGMENT: _apollo_client9.DocumentNode;
9
- declare const COLLECTION_PRODUCTS_FRAGMENT: _apollo_client9.DocumentNode;
10
- declare const COLLECTION_PRODUCTS_HOME_FRAGMENT: _apollo_client9.DocumentNode;
4
+ declare const PRICE_FRAGMENT: _apollo_client18.DocumentNode;
5
+ declare const PRODUCT_VARIANT_FRAGMENT: _apollo_client18.DocumentNode;
6
+ declare const PRODUCT_CATEGORY_FRAGMENT: _apollo_client18.DocumentNode;
7
+ declare const PRODUCT_COLLECTION_FRAGMENT: _apollo_client18.DocumentNode;
8
+ declare const PRODUCT_IMAGE_FRAGMENT: _apollo_client18.DocumentNode;
9
+ declare const COLLECTION_PRODUCTS_FRAGMENT: _apollo_client18.DocumentNode;
10
+ declare const COLLECTION_PRODUCTS_HOME_FRAGMENT: _apollo_client18.DocumentNode;
11
11
  //#endregion
12
12
  export { COLLECTION_PRODUCTS_FRAGMENT, COLLECTION_PRODUCTS_HOME_FRAGMENT, PRICE_FRAGMENT, PRODUCT_CATEGORY_FRAGMENT, PRODUCT_COLLECTION_FRAGMENT, PRODUCT_IMAGE_FRAGMENT, PRODUCT_VARIANT_FRAGMENT };
13
13
  //# sourceMappingURL=product.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"product.d.ts","names":[],"sources":["../../../../src/lib/gql/fragments/product.ts"],"sourcesContent":[],"mappings":";;;cAEa,gBAMZ,eAAA,CAN0B;cAQd,0BAqBZ,eAAA,CArBoC;cAuBxB,2BAOZ,eAAA,CAPqC;AA/BzB,cAwCA,2BAlCZ,EAwCA,eAAA,CANuC,YAlCvC;AAEY,cAwCA,sBAnBZ,EAwBA,eAAA,CALkC,YAnBlC;AAEY,cAwBA,4BAjBZ,EAwCA,eAAA,CAvBwC,YAjBxC;AAEY,cAwCA,iCAlCZ,EA4CA,eAAA,CAV6C,YAlC7C"}
1
+ {"version":3,"file":"product.d.ts","names":[],"sources":["../../../../src/lib/gql/fragments/product.ts"],"sourcesContent":[],"mappings":";;;cAEa,gBAMZ,gBAAA,CAN0B;cAQd,0BAqBZ,gBAAA,CArBoC;cAuBxB,2BAOZ,gBAAA,CAPqC;AA/BzB,cAwCA,2BAlCZ,EAwCA,gBAAA,CANuC,YAlCvC;AAEY,cAwCA,sBAnBZ,EAwBA,gBAAA,CALkC,YAnBlC;AAEY,cAwBA,4BAjBZ,EAwCA,gBAAA,CAvBwC,YAjBxC;AAEY,cAwCA,iCAlCZ,EA4CA,gBAAA,CAV6C,YAlC7C"}
@@ -1,11 +1,11 @@
1
- import * as _apollo_client19 from "@apollo/client";
1
+ import * as _apollo_client33 from "@apollo/client";
2
2
 
3
3
  //#region src/lib/gql/mutations/cart.d.ts
4
- declare const CREATE_CART_MUTATION: _apollo_client19.DocumentNode;
5
- declare const CREATE_LINE_ITEM_MUTATION: _apollo_client19.DocumentNode;
6
- declare const UPDATE_CART_MUTATION: _apollo_client19.DocumentNode;
7
- declare const DELETE_LINE_ITEM_MUTATION: _apollo_client19.DocumentNode;
8
- declare const TRANSFER_CART_MUTATION: _apollo_client19.DocumentNode;
4
+ declare const CREATE_CART_MUTATION: _apollo_client33.DocumentNode;
5
+ declare const CREATE_LINE_ITEM_MUTATION: _apollo_client33.DocumentNode;
6
+ declare const UPDATE_CART_MUTATION: _apollo_client33.DocumentNode;
7
+ declare const DELETE_LINE_ITEM_MUTATION: _apollo_client33.DocumentNode;
8
+ declare const TRANSFER_CART_MUTATION: _apollo_client33.DocumentNode;
9
9
  //#endregion
10
10
  export { CREATE_CART_MUTATION, CREATE_LINE_ITEM_MUTATION, DELETE_LINE_ITEM_MUTATION, TRANSFER_CART_MUTATION, UPDATE_CART_MUTATION };
11
11
  //# sourceMappingURL=cart.d.ts.map
@@ -1,7 +1,7 @@
1
- import * as _apollo_client25 from "@apollo/client";
1
+ import * as _apollo_client15 from "@apollo/client";
2
2
 
3
3
  //#region src/lib/gql/queries/cart-summary.d.ts
4
- declare const GET_CART_ITEM_COUNT_QUERY: _apollo_client25.DocumentNode;
4
+ declare const GET_CART_ITEM_COUNT_QUERY: _apollo_client15.DocumentNode;
5
5
  //#endregion
6
6
  export { GET_CART_ITEM_COUNT_QUERY };
7
7
  //# sourceMappingURL=cart-summary.d.ts.map
@@ -2,7 +2,7 @@ import { gql } from "@apollo/client";
2
2
 
3
3
  //#region src/lib/gql/queries/cart-summary.ts
4
4
  const GET_CART_ITEM_COUNT_QUERY = gql`
5
- query GetCartItemCount($id: ID!) {
5
+ query GetCartItemCount($id: String!) {
6
6
  cart(id: $id) {
7
7
  items {
8
8
  quantity
@@ -1 +1 @@
1
- {"version":3,"file":"cart-summary.js","names":[],"sources":["../../../../src/lib/gql/queries/cart-summary.ts"],"sourcesContent":["import { gql } from '@apollo/client';\n\nexport const GET_CART_ITEM_COUNT_QUERY = gql`\n query GetCartItemCount($id: ID!) {\n cart(id: $id) {\n items {\n quantity\n }\n }\n }\n`;\n"],"mappings":";;;AAEA,MAAa,4BAA4B,GAAG"}
1
+ {"version":3,"file":"cart-summary.js","names":[],"sources":["../../../../src/lib/gql/queries/cart-summary.ts"],"sourcesContent":["import { gql } from '@apollo/client';\n\nexport const GET_CART_ITEM_COUNT_QUERY = gql`\n query GetCartItemCount($id: String!) {\n cart(id: $id) {\n items {\n quantity\n }\n }\n }\n`;\n"],"mappings":";;;AAEA,MAAa,4BAA4B,GAAG"}
@@ -0,0 +1,7 @@
1
+ import * as _apollo_client40 from "@apollo/client";
2
+
3
+ //#region src/lib/gql/queries/cart-total.d.ts
4
+ declare const GET_CART_TOTAL_QUERY: _apollo_client40.DocumentNode;
5
+ //#endregion
6
+ export { GET_CART_TOTAL_QUERY };
7
+ //# sourceMappingURL=cart-total.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cart-total.d.ts","names":[],"sources":["../../../../src/lib/gql/queries/cart-total.ts"],"sourcesContent":[],"mappings":";;;cAEa,sBAMZ,gBAAA,CANgC"}
@@ -0,0 +1,14 @@
1
+ import { gql } from "@apollo/client";
2
+
3
+ //#region src/lib/gql/queries/cart-total.ts
4
+ const GET_CART_TOTAL_QUERY = gql`
5
+ query GetCartTotal($id: String!) {
6
+ cart(id: $id) {
7
+ total
8
+ }
9
+ }
10
+ `;
11
+
12
+ //#endregion
13
+ export { GET_CART_TOTAL_QUERY };
14
+ //# sourceMappingURL=cart-total.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cart-total.js","names":[],"sources":["../../../../src/lib/gql/queries/cart-total.ts"],"sourcesContent":["import { gql } from '@apollo/client';\n\nexport const GET_CART_TOTAL_QUERY = gql`\n query GetCartTotal($id: String!) {\n cart(id: $id) {\n total\n }\n }\n`;"],"mappings":";;;AAEA,MAAa,uBAAuB,GAAG"}
@@ -1,7 +1,7 @@
1
- import * as _apollo_client4 from "@apollo/client";
1
+ import * as _apollo_client17 from "@apollo/client";
2
2
 
3
3
  //#region src/lib/gql/queries/cart.d.ts
4
- declare const GET_CART_QUERY: _apollo_client4.DocumentNode;
4
+ declare const GET_CART_QUERY: _apollo_client17.DocumentNode;
5
5
  //#endregion
6
6
  export { GET_CART_QUERY };
7
7
  //# sourceMappingURL=cart.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"cart.d.ts","names":[],"sources":["../../../../src/lib/gql/queries/cart.ts"],"sourcesContent":[],"mappings":";;;cAIa,gBAOZ,eAAA,CAP0B"}
1
+ {"version":3,"file":"cart.d.ts","names":[],"sources":["../../../../src/lib/gql/queries/cart.ts"],"sourcesContent":[],"mappings":";;;cAIa,gBAOZ,gBAAA,CAP0B"}
@@ -3,7 +3,7 @@ import { gql } from "@apollo/client";
3
3
 
4
4
  //#region src/lib/gql/queries/cart.ts
5
5
  const GET_CART_QUERY = gql`
6
- query GetCart($id: ID!) {
6
+ query GetCart($id: String!) {
7
7
  cart(id: $id) {
8
8
  ...CartFields
9
9
  }
@@ -1 +1 @@
1
- {"version":3,"file":"cart.js","names":[],"sources":["../../../../src/lib/gql/queries/cart.ts"],"sourcesContent":["import { gql } from '@apollo/client';\n\nimport { CART_FRAGMENT } from '../fragments/cart';\n\nexport const GET_CART_QUERY = gql`\n query GetCart($id: ID!) {\n cart(id: $id) {\n ...CartFields\n }\n }\n ${CART_FRAGMENT}\n`;\n"],"mappings":";;;;AAIA,MAAa,iBAAiB,GAAG;;;;;;IAM7B,cAAc"}
1
+ {"version":3,"file":"cart.js","names":[],"sources":["../../../../src/lib/gql/queries/cart.ts"],"sourcesContent":["import { gql } from '@apollo/client';\n\nimport { CART_FRAGMENT } from '../fragments/cart';\n\nexport const GET_CART_QUERY = gql`\n query GetCart($id: String!) {\n cart(id: $id) {\n ...CartFields\n }\n }\n ${CART_FRAGMENT}\n`;\n"],"mappings":";;;;AAIA,MAAa,iBAAiB,GAAG;;;;;;IAM7B,cAAc"}
@@ -1,8 +1,8 @@
1
- import * as _apollo_client1 from "@apollo/client";
1
+ import * as _apollo_client25 from "@apollo/client";
2
2
 
3
3
  //#region src/lib/gql/queries/collections.d.ts
4
- declare const GET_COLLECTIONS_QUERY: _apollo_client1.DocumentNode;
5
- declare const GET_COLLECTIONS_HOME_QUERY: _apollo_client1.DocumentNode;
4
+ declare const GET_COLLECTIONS_QUERY: _apollo_client25.DocumentNode;
5
+ declare const GET_COLLECTIONS_HOME_QUERY: _apollo_client25.DocumentNode;
6
6
  //#endregion
7
7
  export { GET_COLLECTIONS_HOME_QUERY, GET_COLLECTIONS_QUERY };
8
8
  //# sourceMappingURL=collections.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"collections.d.ts","names":[],"sources":["../../../../src/lib/gql/queries/collections.ts"],"sourcesContent":[],"mappings":";;;cAQa,uBAWZ,eAAA,CAXiC;cAarB,4BAWZ,eAAA,CAXsC"}
1
+ {"version":3,"file":"collections.d.ts","names":[],"sources":["../../../../src/lib/gql/queries/collections.ts"],"sourcesContent":[],"mappings":";;;cAQa,uBAWZ,gBAAA,CAXiC;cAarB,4BAWZ,gBAAA,CAXsC"}
@@ -1,7 +1,7 @@
1
- import * as _apollo_client6 from "@apollo/client";
1
+ import * as _apollo_client16 from "@apollo/client";
2
2
 
3
3
  //#region src/lib/gql/queries/customer.d.ts
4
- declare const GET_CUSTOMER_QUERY: _apollo_client6.DocumentNode;
4
+ declare const GET_CUSTOMER_QUERY: _apollo_client16.DocumentNode;
5
5
  //#endregion
6
6
  export { GET_CUSTOMER_QUERY };
7
7
  //# sourceMappingURL=customer.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"customer.d.ts","names":[],"sources":["../../../../src/lib/gql/queries/customer.ts"],"sourcesContent":[],"mappings":";;;cAIa,oBAOZ,eAAA,CAP8B"}
1
+ {"version":3,"file":"customer.d.ts","names":[],"sources":["../../../../src/lib/gql/queries/customer.ts"],"sourcesContent":[],"mappings":";;;cAIa,oBAOZ,gBAAA,CAP8B"}
@@ -1,8 +1,8 @@
1
- import * as _apollo_client7 from "@apollo/client";
1
+ import * as _apollo_client27 from "@apollo/client";
2
2
 
3
3
  //#region src/lib/gql/queries/footer.d.ts
4
- declare const GET_FOOTER_QUERY: _apollo_client7.DocumentNode;
5
- declare const GET_FOOTER_DATA_QUERY: _apollo_client7.DocumentNode;
4
+ declare const GET_FOOTER_QUERY: _apollo_client27.DocumentNode;
5
+ declare const GET_FOOTER_DATA_QUERY: _apollo_client27.DocumentNode;
6
6
  //#endregion
7
7
  export { GET_FOOTER_DATA_QUERY, GET_FOOTER_QUERY };
8
8
  //# sourceMappingURL=footer.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"footer.d.ts","names":[],"sources":["../../../../src/lib/gql/queries/footer.ts"],"sourcesContent":[],"mappings":";;;cAEa,kBAcZ,eAAA,CAd4B;cAgBhB,uBAwBZ,eAAA,CAxBiC"}
1
+ {"version":3,"file":"footer.d.ts","names":[],"sources":["../../../../src/lib/gql/queries/footer.ts"],"sourcesContent":[],"mappings":";;;cAEa,kBAcZ,gBAAA,CAd4B;cAgBhB,uBAwBZ,gBAAA,CAxBiC"}
@@ -1,7 +1,7 @@
1
- import * as _apollo_client24 from "@apollo/client";
1
+ import * as _apollo_client32 from "@apollo/client";
2
2
 
3
3
  //#region src/lib/gql/queries/home-banner.d.ts
4
- declare const GET_HOME_BANNER_QUERY: _apollo_client24.DocumentNode;
4
+ declare const GET_HOME_BANNER_QUERY: _apollo_client32.DocumentNode;
5
5
  //#endregion
6
6
  export { GET_HOME_BANNER_QUERY };
7
7
  //# sourceMappingURL=home-banner.d.ts.map
@@ -1,9 +1,9 @@
1
- import * as _apollo_client16 from "@apollo/client";
1
+ import * as _apollo_client29 from "@apollo/client";
2
2
 
3
3
  //#region src/lib/gql/queries/order.d.ts
4
- declare const ORDER_FRAGMENT: _apollo_client16.DocumentNode;
5
- declare const GET_ORDER_QUERY: _apollo_client16.DocumentNode;
6
- declare const GET_ORDERS_QUERY: _apollo_client16.DocumentNode;
4
+ declare const ORDER_FRAGMENT: _apollo_client29.DocumentNode;
5
+ declare const GET_ORDER_QUERY: _apollo_client29.DocumentNode;
6
+ declare const GET_ORDERS_QUERY: _apollo_client29.DocumentNode;
7
7
  //#endregion
8
8
  export { GET_ORDERS_QUERY, GET_ORDER_QUERY, ORDER_FRAGMENT };
9
9
  //# sourceMappingURL=order.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"order.d.ts","names":[],"sources":["../../../../src/lib/gql/queries/order.ts"],"sourcesContent":[],"mappings":";;;cAEa,gBA2EZ,gBAAA,CA3E0B;cA6Ed,iBAOZ,gBAAA,CAP2B;cASf,kBAYZ,gBAAA,CAZ4B"}
1
+ {"version":3,"file":"order.d.ts","names":[],"sources":["../../../../src/lib/gql/queries/order.ts"],"sourcesContent":[],"mappings":";;;cAEa,gBAgFZ,gBAAA,CAhF0B;cAkFd,iBAOZ,gBAAA,CAP2B;cASf,kBAYZ,gBAAA,CAZ4B"}
@@ -39,6 +39,11 @@ const ORDER_FRAGMENT = gql`
39
39
  handle
40
40
  thumbnail
41
41
  createdAt
42
+ categories {
43
+ id
44
+ name
45
+ handle
46
+ }
42
47
  }
43
48
  }
44
49
  }
@@ -1 +1 @@
1
- {"version":3,"file":"order.js","names":[],"sources":["../../../../src/lib/gql/queries/order.ts"],"sourcesContent":["import { gql } from '@apollo/client';\n\nexport const ORDER_FRAGMENT = gql`\n fragment OrderFields on Order {\n id\n displayId\n email\n customerId\n regionId\n status\n paymentStatus\n fulfillmentStatus\n currencyCode\n total\n subtotal\n discountTotal\n giftCardTotal\n shippingTotal\n taxTotal\n createdAt\n items {\n id\n title\n quantity\n unitPrice\n total\n originalTotal\n thumbnail\n productHandle\n productTitle\n variant {\n id\n title\n sku\n product {\n id\n title\n handle\n thumbnail\n createdAt\n }\n }\n }\n shippingMethods {\n id\n name\n amount\n shippingOptionId\n }\n shippingAddress {\n firstName\n lastName\n address1\n address2\n city\n postalCode\n countryCode\n phone\n }\n paymentCollections {\n id\n currencyCode\n amount\n status\n paymentProviders {\n id\n }\n payments {\n id\n amount\n currencyCode\n providerId\n cardLast4\n createdAt\n }\n }\n }\n`;\n\nexport const GET_ORDER_QUERY = gql`\n query GetOrder($id: ID!) {\n order(id: $id) {\n ...OrderFields\n }\n }\n ${ORDER_FRAGMENT}\n`;\n\nexport const GET_ORDERS_QUERY = gql`\n query GetOrders($limit: Int, $offset: Int) {\n orders(limit: $limit, offset: $offset) {\n orders {\n ...OrderFields\n }\n count\n limit\n offset\n }\n }\n ${ORDER_FRAGMENT}\n`;\n"],"mappings":";;;AAEA,MAAa,iBAAiB,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA6EjC,MAAa,kBAAkB,GAAG;;;;;;IAM9B,eAAe;;AAGnB,MAAa,mBAAmB,GAAG;;;;;;;;;;;IAW/B,eAAe"}
1
+ {"version":3,"file":"order.js","names":[],"sources":["../../../../src/lib/gql/queries/order.ts"],"sourcesContent":["import { gql } from '@apollo/client';\n\nexport const ORDER_FRAGMENT = gql`\n fragment OrderFields on Order {\n id\n displayId\n email\n customerId\n regionId\n status\n paymentStatus\n fulfillmentStatus\n currencyCode\n total\n subtotal\n discountTotal\n giftCardTotal\n shippingTotal\n taxTotal\n createdAt\n items {\n id\n title\n quantity\n unitPrice\n total\n originalTotal\n thumbnail\n productHandle\n productTitle\n variant {\n id\n title\n sku\n product {\n id\n title\n handle\n thumbnail\n createdAt\n categories {\n id\n name\n handle\n }\n }\n }\n }\n shippingMethods {\n id\n name\n amount\n shippingOptionId\n }\n shippingAddress {\n firstName\n lastName\n address1\n address2\n city\n postalCode\n countryCode\n phone\n }\n paymentCollections {\n id\n currencyCode\n amount\n status\n paymentProviders {\n id\n }\n payments {\n id\n amount\n currencyCode\n providerId\n cardLast4\n createdAt\n }\n }\n }\n`;\n\nexport const GET_ORDER_QUERY = gql`\n query GetOrder($id: ID!) {\n order(id: $id) {\n ...OrderFields\n }\n }\n ${ORDER_FRAGMENT}\n`;\n\nexport const GET_ORDERS_QUERY = gql`\n query GetOrders($limit: Int, $offset: Int) {\n orders(limit: $limit, offset: $offset) {\n orders {\n ...OrderFields\n }\n count\n limit\n offset\n }\n }\n ${ORDER_FRAGMENT}\n`;\n"],"mappings":";;;AAEA,MAAa,iBAAiB,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAkFjC,MAAa,kBAAkB,GAAG;;;;;;IAM9B,eAAe;;AAGnB,MAAa,mBAAmB,GAAG;;;;;;;;;;;IAW/B,eAAe"}
@@ -0,0 +1,7 @@
1
+ import * as _apollo_client41 from "@apollo/client";
2
+
3
+ //#region src/lib/gql/queries/product-personalization.d.ts
4
+ declare const GET_PRODUCT_BY_HANDLE_FOR_PERSONALIZATION: _apollo_client41.DocumentNode;
5
+ //#endregion
6
+ export { GET_PRODUCT_BY_HANDLE_FOR_PERSONALIZATION };
7
+ //# sourceMappingURL=product-personalization.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"product-personalization.d.ts","names":[],"sources":["../../../../src/lib/gql/queries/product-personalization.ts"],"sourcesContent":[],"mappings":";;;cAEa,2CAcZ,gBAAA,CAdqD"}
@@ -0,0 +1,22 @@
1
+ import { gql } from "@apollo/client";
2
+
3
+ //#region src/lib/gql/queries/product-personalization.ts
4
+ const GET_PRODUCT_BY_HANDLE_FOR_PERSONALIZATION = gql`
5
+ query GetProductByHandleForPersonalization($handle: String!) {
6
+ products(handle: $handle, limit: 1) {
7
+ products {
8
+ id
9
+ variants {
10
+ id
11
+ calculatedPrice {
12
+ amount
13
+ }
14
+ }
15
+ }
16
+ }
17
+ }
18
+ `;
19
+
20
+ //#endregion
21
+ export { GET_PRODUCT_BY_HANDLE_FOR_PERSONALIZATION };
22
+ //# sourceMappingURL=product-personalization.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"product-personalization.js","names":[],"sources":["../../../../src/lib/gql/queries/product-personalization.ts"],"sourcesContent":["import { gql } from '@apollo/client';\n\nexport const GET_PRODUCT_BY_HANDLE_FOR_PERSONALIZATION = gql`\n query GetProductByHandleForPersonalization($handle: String!) {\n products(handle: $handle, limit: 1) {\n products {\n id\n variants {\n id\n calculatedPrice {\n amount\n }\n }\n }\n }\n }\n`;"],"mappings":";;;AAEA,MAAa,4CAA4C,GAAG"}
@@ -1,7 +1,7 @@
1
- import * as _apollo_client26 from "@apollo/client";
1
+ import * as _apollo_client42 from "@apollo/client";
2
2
 
3
3
  //#region src/lib/gql/queries/product.d.ts
4
- declare const GET_PRODUCT_CATEGORIES_QUERY: _apollo_client26.DocumentNode;
4
+ declare const GET_PRODUCT_CATEGORIES_QUERY: _apollo_client42.DocumentNode;
5
5
  //#endregion
6
6
  export { GET_PRODUCT_CATEGORIES_QUERY };
7
7
  //# sourceMappingURL=product.d.ts.map
@@ -1,8 +1,8 @@
1
- import * as _apollo_client27 from "@apollo/client";
1
+ import * as _apollo_client38 from "@apollo/client";
2
2
 
3
3
  //#region src/lib/gql/queries/regions.d.ts
4
- declare const LIST_REGIONS_QUERY: _apollo_client27.DocumentNode;
5
- declare const GET_REGION_QUERY: _apollo_client27.DocumentNode;
4
+ declare const LIST_REGIONS_QUERY: _apollo_client38.DocumentNode;
5
+ declare const GET_REGION_QUERY: _apollo_client38.DocumentNode;
6
6
  //#endregion
7
7
  export { GET_REGION_QUERY, LIST_REGIONS_QUERY };
8
8
  //# sourceMappingURL=regions.d.ts.map
@@ -1,7 +1,7 @@
1
- import * as _apollo_client3 from "@apollo/client";
1
+ import * as _apollo_client1 from "@apollo/client";
2
2
 
3
3
  //#region src/lib/hooks/use-apollo.d.ts
4
- declare function useApollo(): _apollo_client3.ApolloClient;
4
+ declare function useApollo(): _apollo_client1.ApolloClient;
5
5
  //#endregion
6
6
  export { useApollo };
7
7
  //# sourceMappingURL=use-apollo.d.ts.map
@@ -0,0 +1,13 @@
1
+ //#region src/lib/hooks/use-time-on-page.d.ts
2
+ /**
3
+ * Fires TIME_ON_PAGE analytics signals at configurable time thresholds.
4
+ * Cleans up timers on unmount. Each threshold fires only once per mount.
5
+ *
6
+ * @param pageSurface - A label identifying the page surface (e.g. "pdp", "plp", "home")
7
+ * @param enabled - Allows conditional activation (default: true)
8
+ * @param thresholds - Custom time thresholds in seconds (default: [15, 30, 60, 120, 180])
9
+ */
10
+ declare function useTimeOnPage(pageSurface: string, enabled?: boolean, thresholds?: readonly number[]): void;
11
+ //#endregion
12
+ export { useTimeOnPage };
13
+ //# sourceMappingURL=use-time-on-page.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"use-time-on-page.d.ts","names":[],"sources":["../../../src/lib/hooks/use-time-on-page.ts"],"sourcesContent":[],"mappings":";;AAgBA;;;;;;;iBAAgB,aAAA"}