medusa-storefront-data 2.4.0 → 2.5.3

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 (214) hide show
  1. package/HOMEPAGE_CONFIG.md +113 -6
  2. package/package.json +6 -116
  3. package/src/server/brand-pillars-from-categories.ts +156 -0
  4. package/src/server/cart.ts +21 -21
  5. package/src/server/customer.ts +11 -11
  6. package/src/server/dynamic-config.ts +130 -181
  7. package/src/server/fulfillment.ts +3 -3
  8. package/src/server/help-faq-section-defaults.json +92 -0
  9. package/src/server/help-sections/help-faq.ts +25 -0
  10. package/src/server/help-sections/index.ts +8 -0
  11. package/src/server/home.ts +36 -211
  12. package/src/server/homepage-config.types.ts +24 -0
  13. package/src/server/homepage-section-defaults.ts +3 -0
  14. package/src/server/normalize-homepage-config.ts +279 -0
  15. package/src/server/orders.ts +6 -6
  16. package/src/server/page-input.ts +3 -1
  17. package/src/server/payment-details.ts +5 -5
  18. package/src/server/payment.ts +2 -2
  19. package/src/server/regions.ts +2 -2
  20. package/src/server/shoppable-looks.ts +1 -1
  21. package/src/util/store-client.ts +0 -3
  22. package/dist/segment-data/default-page-input.json +0 -191
  23. package/dist/src/config.d.ts +0 -3
  24. package/dist/src/config.d.ts.map +0 -1
  25. package/dist/src/config.js +0 -31
  26. package/dist/src/cookies.d.ts +0 -23
  27. package/dist/src/cookies.d.ts.map +0 -1
  28. package/dist/src/cookies.js +0 -140
  29. package/dist/src/edge.d.ts +0 -3
  30. package/dist/src/edge.d.ts.map +0 -1
  31. package/dist/src/edge.js +0 -1
  32. package/dist/src/middleware.d.ts +0 -3
  33. package/dist/src/middleware.d.ts.map +0 -1
  34. package/dist/src/middleware.js +0 -1
  35. package/dist/src/server/cart.d.ts +0 -96
  36. package/dist/src/server/cart.d.ts.map +0 -1
  37. package/dist/src/server/cart.js +0 -797
  38. package/dist/src/server/categories.d.ts +0 -4
  39. package/dist/src/server/categories.d.ts.map +0 -1
  40. package/dist/src/server/categories.js +0 -34
  41. package/dist/src/server/collections.d.ts +0 -8
  42. package/dist/src/server/collections.d.ts.map +0 -1
  43. package/dist/src/server/collections.js +0 -39
  44. package/dist/src/server/config-merge.d.ts +0 -3
  45. package/dist/src/server/config-merge.d.ts.map +0 -1
  46. package/dist/src/server/config-merge.js +0 -31
  47. package/dist/src/server/contact.d.ts +0 -34
  48. package/dist/src/server/contact.d.ts.map +0 -1
  49. package/dist/src/server/contact.js +0 -57
  50. package/dist/src/server/customer-registration.d.ts +0 -142
  51. package/dist/src/server/customer-registration.d.ts.map +0 -1
  52. package/dist/src/server/customer-registration.js +0 -295
  53. package/dist/src/server/customer.d.ts +0 -48
  54. package/dist/src/server/customer.d.ts.map +0 -1
  55. package/dist/src/server/customer.js +0 -413
  56. package/dist/src/server/dynamic-config.d.ts +0 -240
  57. package/dist/src/server/dynamic-config.d.ts.map +0 -1
  58. package/dist/src/server/dynamic-config.js +0 -703
  59. package/dist/src/server/fulfillment.d.ts +0 -5
  60. package/dist/src/server/fulfillment.d.ts.map +0 -1
  61. package/dist/src/server/fulfillment.js +0 -47
  62. package/dist/src/server/guest.d.ts +0 -81
  63. package/dist/src/server/guest.d.ts.map +0 -1
  64. package/dist/src/server/guest.js +0 -183
  65. package/dist/src/server/home-sections/about-brand.d.ts +0 -9
  66. package/dist/src/server/home-sections/about-brand.d.ts.map +0 -1
  67. package/dist/src/server/home-sections/about-brand.js +0 -9
  68. package/dist/src/server/home-sections/baptism-picks.d.ts +0 -10
  69. package/dist/src/server/home-sections/baptism-picks.d.ts.map +0 -1
  70. package/dist/src/server/home-sections/baptism-picks.js +0 -27
  71. package/dist/src/server/home-sections/baptism.d.ts +0 -13
  72. package/dist/src/server/home-sections/baptism.d.ts.map +0 -1
  73. package/dist/src/server/home-sections/baptism.js +0 -43
  74. package/dist/src/server/home-sections/blog-posts.d.ts +0 -9
  75. package/dist/src/server/home-sections/blog-posts.d.ts.map +0 -1
  76. package/dist/src/server/home-sections/blog-posts.js +0 -9
  77. package/dist/src/server/home-sections/brand-marquee.d.ts +0 -8
  78. package/dist/src/server/home-sections/brand-marquee.d.ts.map +0 -1
  79. package/dist/src/server/home-sections/brand-marquee.js +0 -7
  80. package/dist/src/server/home-sections/brand-pillars.d.ts +0 -9
  81. package/dist/src/server/home-sections/brand-pillars.d.ts.map +0 -1
  82. package/dist/src/server/home-sections/brand-pillars.js +0 -9
  83. package/dist/src/server/home-sections/category-pills.d.ts +0 -9
  84. package/dist/src/server/home-sections/category-pills.d.ts.map +0 -1
  85. package/dist/src/server/home-sections/category-pills.js +0 -19
  86. package/dist/src/server/home-sections/celebrity-trust.d.ts +0 -12
  87. package/dist/src/server/home-sections/celebrity-trust.d.ts.map +0 -1
  88. package/dist/src/server/home-sections/celebrity-trust.js +0 -27
  89. package/dist/src/server/home-sections/features.d.ts +0 -9
  90. package/dist/src/server/home-sections/features.d.ts.map +0 -1
  91. package/dist/src/server/home-sections/features.js +0 -9
  92. package/dist/src/server/home-sections/hero.d.ts +0 -9
  93. package/dist/src/server/home-sections/hero.d.ts.map +0 -1
  94. package/dist/src/server/home-sections/hero.js +0 -9
  95. package/dist/src/server/home-sections/instagram-posts.d.ts +0 -9
  96. package/dist/src/server/home-sections/instagram-posts.d.ts.map +0 -1
  97. package/dist/src/server/home-sections/instagram-posts.js +0 -9
  98. package/dist/src/server/home-sections/loved-by-moms.d.ts +0 -12
  99. package/dist/src/server/home-sections/loved-by-moms.d.ts.map +0 -1
  100. package/dist/src/server/home-sections/loved-by-moms.js +0 -20
  101. package/dist/src/server/home-sections/luxe-favourites.d.ts +0 -11
  102. package/dist/src/server/home-sections/luxe-favourites.d.ts.map +0 -1
  103. package/dist/src/server/home-sections/luxe-favourites.js +0 -19
  104. package/dist/src/server/home-sections/new-arrivals-classic.d.ts +0 -8
  105. package/dist/src/server/home-sections/new-arrivals-classic.d.ts.map +0 -1
  106. package/dist/src/server/home-sections/new-arrivals-classic.js +0 -10
  107. package/dist/src/server/home-sections/new-arrivals.d.ts +0 -12
  108. package/dist/src/server/home-sections/new-arrivals.d.ts.map +0 -1
  109. package/dist/src/server/home-sections/new-arrivals.js +0 -28
  110. package/dist/src/server/home-sections/promo-announcements.d.ts +0 -7
  111. package/dist/src/server/home-sections/promo-announcements.d.ts.map +0 -1
  112. package/dist/src/server/home-sections/promo-announcements.js +0 -7
  113. package/dist/src/server/home-sections/promo-countdown.d.ts +0 -6
  114. package/dist/src/server/home-sections/promo-countdown.d.ts.map +0 -1
  115. package/dist/src/server/home-sections/promo-countdown.js +0 -5
  116. package/dist/src/server/home-sections/shared.d.ts +0 -10
  117. package/dist/src/server/home-sections/shared.d.ts.map +0 -1
  118. package/dist/src/server/home-sections/shared.js +0 -29
  119. package/dist/src/server/home-sections/shop-by-age.d.ts +0 -9
  120. package/dist/src/server/home-sections/shop-by-age.d.ts.map +0 -1
  121. package/dist/src/server/home-sections/shop-by-age.js +0 -17
  122. package/dist/src/server/home-sections/shop-by-category.d.ts +0 -10
  123. package/dist/src/server/home-sections/shop-by-category.d.ts.map +0 -1
  124. package/dist/src/server/home-sections/shop-by-category.js +0 -17
  125. package/dist/src/server/home-sections/testimonials.d.ts +0 -9
  126. package/dist/src/server/home-sections/testimonials.d.ts.map +0 -1
  127. package/dist/src/server/home-sections/testimonials.js +0 -9
  128. package/dist/src/server/home-sections/theme-dresses.d.ts +0 -12
  129. package/dist/src/server/home-sections/theme-dresses.d.ts.map +0 -1
  130. package/dist/src/server/home-sections/theme-dresses.js +0 -27
  131. package/dist/src/server/home-sections/video-stories.d.ts +0 -9
  132. package/dist/src/server/home-sections/video-stories.d.ts.map +0 -1
  133. package/dist/src/server/home-sections/video-stories.js +0 -9
  134. package/dist/src/server/home-sections/why-choose-us.d.ts +0 -9
  135. package/dist/src/server/home-sections/why-choose-us.d.ts.map +0 -1
  136. package/dist/src/server/home-sections/why-choose-us.js +0 -9
  137. package/dist/src/server/home.d.ts +0 -62
  138. package/dist/src/server/home.d.ts.map +0 -1
  139. package/dist/src/server/home.js +0 -122
  140. package/dist/src/server/homepage-config.types.d.ts +0 -274
  141. package/dist/src/server/homepage-config.types.d.ts.map +0 -1
  142. package/dist/src/server/homepage-config.types.js +0 -33
  143. package/dist/src/server/homepage-section-defaults.d.ts +0 -188
  144. package/dist/src/server/homepage-section-defaults.d.ts.map +0 -1
  145. package/dist/src/server/homepage-section-defaults.js +0 -188
  146. package/dist/src/server/index.d.ts +0 -25
  147. package/dist/src/server/index.d.ts.map +0 -1
  148. package/dist/src/server/index.js +0 -24
  149. package/dist/src/server/locale-actions.d.ts +0 -14
  150. package/dist/src/server/locale-actions.d.ts.map +0 -1
  151. package/dist/src/server/locale-actions.js +0 -58
  152. package/dist/src/server/locales.d.ts +0 -8
  153. package/dist/src/server/locales.d.ts.map +0 -1
  154. package/dist/src/server/locales.js +0 -12
  155. package/dist/src/server/notifications.d.ts +0 -2
  156. package/dist/src/server/notifications.d.ts.map +0 -1
  157. package/dist/src/server/notifications.js +0 -20
  158. package/dist/src/server/onboarding.d.ts +0 -2
  159. package/dist/src/server/onboarding.d.ts.map +0 -1
  160. package/dist/src/server/onboarding.js +0 -8
  161. package/dist/src/server/orders.d.ts +0 -63
  162. package/dist/src/server/orders.d.ts.map +0 -1
  163. package/dist/src/server/orders.js +0 -230
  164. package/dist/src/server/page-input.d.ts +0 -19
  165. package/dist/src/server/page-input.d.ts.map +0 -1
  166. package/dist/src/server/page-input.js +0 -40
  167. package/dist/src/server/payment-details.d.ts +0 -5
  168. package/dist/src/server/payment-details.d.ts.map +0 -1
  169. package/dist/src/server/payment-details.js +0 -28
  170. package/dist/src/server/payment.d.ts +0 -3
  171. package/dist/src/server/payment.d.ts.map +0 -1
  172. package/dist/src/server/payment.js +0 -13
  173. package/dist/src/server/pincode.d.ts +0 -7
  174. package/dist/src/server/pincode.d.ts.map +0 -1
  175. package/dist/src/server/pincode.js +0 -30
  176. package/dist/src/server/products.d.ts +0 -54
  177. package/dist/src/server/products.d.ts.map +0 -1
  178. package/dist/src/server/products.js +0 -154
  179. package/dist/src/server/regions.d.ts +0 -5
  180. package/dist/src/server/regions.d.ts.map +0 -1
  181. package/dist/src/server/regions.js +0 -57
  182. package/dist/src/server/resolve-home-segment-data.d.ts +0 -25
  183. package/dist/src/server/resolve-home-segment-data.d.ts.map +0 -1
  184. package/dist/src/server/resolve-home-segment-data.js +0 -20
  185. package/dist/src/server/returns.d.ts +0 -29
  186. package/dist/src/server/returns.d.ts.map +0 -1
  187. package/dist/src/server/returns.js +0 -132
  188. package/dist/src/server/shoppable-looks.d.ts +0 -17
  189. package/dist/src/server/shoppable-looks.d.ts.map +0 -1
  190. package/dist/src/server/shoppable-looks.js +0 -136
  191. package/dist/src/server/swaps.d.ts +0 -15
  192. package/dist/src/server/swaps.d.ts.map +0 -1
  193. package/dist/src/server/swaps.js +0 -89
  194. package/dist/src/server/variants.d.ts +0 -3
  195. package/dist/src/server/variants.d.ts.map +0 -1
  196. package/dist/src/server/variants.js +0 -15
  197. package/dist/src/server/wishlist.d.ts +0 -11
  198. package/dist/src/server/wishlist.d.ts.map +0 -1
  199. package/dist/src/server/wishlist.js +0 -49
  200. package/dist/src/util/get-locale-header.d.ts +0 -4
  201. package/dist/src/util/get-locale-header.d.ts.map +0 -1
  202. package/dist/src/util/get-locale-header.js +0 -7
  203. package/dist/src/util/medusa-error.d.ts +0 -2
  204. package/dist/src/util/medusa-error.d.ts.map +0 -1
  205. package/dist/src/util/medusa-error.js +0 -18
  206. package/dist/src/util/revalidate-cart.d.ts +0 -2
  207. package/dist/src/util/revalidate-cart.d.ts.map +0 -1
  208. package/dist/src/util/revalidate-cart.js +0 -8
  209. package/dist/src/util/sort-products.d.ts +0 -3
  210. package/dist/src/util/sort-products.d.ts.map +0 -1
  211. package/dist/src/util/sort-products.js +0 -1
  212. package/dist/src/util/store-client.d.ts +0 -13
  213. package/dist/src/util/store-client.d.ts.map +0 -1
  214. package/dist/src/util/store-client.js +0 -77
@@ -33,7 +33,7 @@ import { medusaCartMerge, medusaCartTransfer } from "medusa-services/cart"
33
33
  import {
34
34
  getAuthClientOptions,
35
35
  getMedusaBackendUrl,
36
- getStoreCartClientOptions,
36
+ getStoreClientOptions,
37
37
  } from "../util/store-client"
38
38
 
39
39
  import { cache } from "react"
@@ -52,7 +52,7 @@ export const retrieveCustomer = cache(
52
52
  if (!("authorization" in authHeaders)) return null
53
53
 
54
54
  try {
55
- const options = await getStoreCartClientOptions()
55
+ const options = await getStoreClientOptions()
56
56
  const { customer } = await medusaCustomerRetrieve(options, { fields: "*addresses" })
57
57
  return customer as unknown as HttpTypes.StoreCustomer
58
58
  } catch (error: unknown) {
@@ -68,7 +68,7 @@ export const retrieveCustomer = cache(
68
68
 
69
69
  export const updateCustomer = async (body: HttpTypes.StoreUpdateCustomer) => {
70
70
  try {
71
- const options = await getStoreCartClientOptions()
71
+ const options = await getStoreClientOptions()
72
72
  const { customer } = await medusaCustomerUpdate(body as Record<string, unknown>, options)
73
73
 
74
74
  const cacheTag = await getCacheTag("customers")
@@ -98,7 +98,7 @@ export async function signup(_currentState: unknown, formData: FormData) {
98
98
 
99
99
  await setAuthToken(token)
100
100
 
101
- const options = await getStoreCartClientOptions()
101
+ const options = await getStoreClientOptions()
102
102
  const { customer: createdCustomer } = await medusaCustomerCreate(customerForm, options)
103
103
 
104
104
  const loginToken = await medusaAuthLogin(
@@ -142,7 +142,7 @@ export async function login(
142
142
  cookieStore.set("_medusa_customer_email", email, { maxAge: 60 * 60 * 24 * 7, path: "/" })
143
143
 
144
144
  try {
145
- const options = await getStoreCartClientOptions()
145
+ const options = await getStoreClientOptions()
146
146
  await medusaCustomerRetrieve({
147
147
  ...options,
148
148
  authorization: `Bearer ${token}`,
@@ -219,7 +219,7 @@ export async function signout(countryCode: string) {
219
219
 
220
220
  export async function transferCart(token?: string) {
221
221
  const cartId = await getCartId()
222
- const options = await getStoreCartClientOptions()
222
+ const options = await getStoreClientOptions()
223
223
  const mergeOptions = token
224
224
  ? { ...options, authorization: `Bearer ${token}` }
225
225
  : options
@@ -285,7 +285,7 @@ export const addCustomerAddress = async (
285
285
  }
286
286
 
287
287
  try {
288
- const options = await getStoreCartClientOptions()
288
+ const options = await getStoreClientOptions()
289
289
  await medusaCustomerCreateAddress(address, options)
290
290
 
291
291
  const customerCacheTag = await getCacheTag("customers")
@@ -300,7 +300,7 @@ export const deleteCustomerAddress = async (
300
300
  addressId: string
301
301
  ): Promise<void> => {
302
302
  try {
303
- const options = await getStoreCartClientOptions()
303
+ const options = await getStoreClientOptions()
304
304
  await medusaCustomerDeleteAddress(addressId, options)
305
305
 
306
306
  const customerCacheTag = await getCacheTag("customers")
@@ -344,7 +344,7 @@ export const updateCustomerAddress = async (
344
344
  }
345
345
 
346
346
  try {
347
- const options = await getStoreCartClientOptions()
347
+ const options = await getStoreClientOptions()
348
348
  await medusaCustomerUpdateAddress(addressId, address, options)
349
349
 
350
350
  const customerCacheTag = await getCacheTag("customers")
@@ -357,7 +357,7 @@ export const updateCustomerAddress = async (
357
357
 
358
358
  export const setDefaultAddress = async (addressId: string) => {
359
359
  try {
360
- const options = await getStoreCartClientOptions()
360
+ const options = await getStoreClientOptions()
361
361
  await medusaCustomerUpdateAddress(addressId, { is_default_shipping: true }, options)
362
362
 
363
363
  const customerCacheTag = await getCacheTag("customers")
@@ -469,7 +469,7 @@ export async function handleGoogleCallback(token: string, email?: string, first_
469
469
  const cookieStore = await cookies()
470
470
  cookieStore.set("_medusa_customer_email", email, { maxAge: 60 * 60 * 24 * 7, path: "/" })
471
471
 
472
- const options = await getStoreCartClientOptions()
472
+ const options = await getStoreClientOptions()
473
473
  if (options.authorization) {
474
474
  try {
475
475
  await medusaCustomerCreate(
@@ -19,8 +19,6 @@ export {
19
19
  type StorefrontPageInput,
20
20
  } from "./page-input"
21
21
 
22
- /** @deprecated Use `DynamicConfigResponse` from `medusa-storefront-data/homepage-config-schema`. */
23
- export type DynamicConfig = DynamicConfigResponse
24
22
 
25
23
  export const getDynamicConfig = cache(async (): Promise<DynamicConfigResponse | null> => {
26
24
  try {
@@ -78,52 +76,8 @@ export function getLogoFromPageInput(
78
76
  return config.logo || null
79
77
  }
80
78
 
81
- /** @deprecated Fetch in main project; pass `pageInput` into layout/pages instead. */
82
- export const getLogoFromConfig = async (): Promise<string | null> => {
83
- const config = await getDynamicConfig()
84
- return getLogoFromPageInput(config?.["homepage-config"] ?? null)
85
- }
86
-
87
- export const getBannerImageFromConfig = async (): Promise<string | null> => {
88
- try {
89
- const config = await getDynamicConfig()
90
- const bannerArray = config?.["homepage-config"]?.["homepage-banner-array"]
91
-
92
- if (bannerArray && bannerArray.length > 0) {
93
- const firstBanner = bannerArray[0]
94
- const image = firstBanner?.["homepage-banner"]?.["homepage-banner-image"]
95
-
96
- return image || null
97
- }
98
-
99
-
100
- return null
101
- } catch (error) {
102
-
103
- return null
104
- }
105
- }
106
-
107
- export const getMobileBannerFromConfig = async (): Promise<{ image: string | null; link: string | null }> => {
108
- try {
109
- const config = await getDynamicConfig()
110
- const bannerArray = config?.["homepage-config"]?.["app-banner-array"]
111
79
 
112
- if (bannerArray && bannerArray.length > 0) {
113
- const firstBanner = bannerArray[0]
114
- const image = firstBanner?.["app-banner"]?.["app-banner-image"] || null
115
- const link = firstBanner?.["app-banner"]?.["app-banner-button-link"] || firstBanner?.["app-banner"]?.["app-banner-link"] || null
116
80
 
117
- return { image, link }
118
- }
119
-
120
-
121
- return { image: null, link: null }
122
- } catch (error) {
123
-
124
- return { image: null, link: null }
125
- }
126
- }
127
81
 
128
82
  export type HomepageBanner = {
129
83
  image?: string
@@ -176,23 +130,9 @@ export function getAppBannersFromPageInput(
176
130
  return null
177
131
  }
178
132
 
179
- /** @deprecated Pass `pageInput` from main project. */
180
- export const getHomeBannersFromConfig = async (): Promise<HomepageBanner[] | null> => {
181
- const config = await getDynamicConfig()
182
- return getHomeBannersFromPageInput(config?.["homepage-config"] ?? null)
183
- }
184
133
 
185
- /** @deprecated Pass `pageInput` from main project. */
186
- export const getAppBannersFromConfig = async (): Promise<HomepageBanner[] | null> => {
187
- const config = await getDynamicConfig()
188
- return getAppBannersFromPageInput(config?.["homepage-config"] ?? null)
189
- }
190
134
 
191
135
  // Legacy function for backward compatibility
192
- export const getMobileBannerImageFromConfig = async (): Promise<string | null> => {
193
- const { image } = await getMobileBannerFromConfig()
194
- return image
195
- }
196
136
 
197
137
  export function getWebsiteDescriptionFromPageInput(
198
138
  pageInput?: HomepageConfig | null
@@ -202,11 +142,6 @@ export function getWebsiteDescriptionFromPageInput(
202
142
  return desc || null
203
143
  }
204
144
 
205
- /** @deprecated Pass `pageInput` from main project. */
206
- export const getWebsiteDescriptionFromConfig = async (): Promise<string | null> => {
207
- const config = await getDynamicConfig()
208
- return getWebsiteDescriptionFromPageInput(config?.["homepage-config"] ?? null)
209
- }
210
145
 
211
146
  /** Why choose us — defaults + `sections.whyChooseUs` override. */
212
147
  export function getFeaturesFromPageInput(
@@ -223,14 +158,6 @@ export function getFeaturesFromPageInput(
223
158
  return { title, features }
224
159
  }
225
160
 
226
- /** @deprecated Pass `pageInput` from main project. */
227
- export const getFeaturesFromConfig = async (): Promise<{
228
- title: string
229
- features: Array<{ name: string; icon: string }>
230
- }> => {
231
- const config = await getDynamicConfig()
232
- return getFeaturesFromPageInput(config?.["homepage-config"] ?? null)
233
- }
234
161
 
235
162
  function parseFeatureIconList(raw: unknown): Array<{ name: string; icon: string }> {
236
163
  if (!Array.isArray(raw)) return []
@@ -398,11 +325,6 @@ export function getHomeSectionsCopyFromPageInput(
398
325
  return copy
399
326
  }
400
327
 
401
- /** @deprecated Pass `pageInput` from main project instead of fetching here. */
402
- export const getHomeSectionsCopyFromConfig = async (): Promise<HomeSectionsCopy> => {
403
- const config = await getDynamicConfig()
404
- return getHomeSectionsCopyFromPageInput(config?.["homepage-config"] ?? null)
405
- }
406
328
 
407
329
  export type TrustFeaturesConfig = {
408
330
  title: string | null
@@ -423,11 +345,6 @@ export function getTrustFeaturesFromPageInput(
423
345
  return { title: title ?? null, description: description ?? null, features }
424
346
  }
425
347
 
426
- /** @deprecated Pass `pageInput` from main project. */
427
- export const getTrustFeaturesFromConfig = async (): Promise<TrustFeaturesConfig> => {
428
- const config = await getDynamicConfig()
429
- return getTrustFeaturesFromPageInput(config?.["homepage-config"] ?? null)
430
- }
431
348
 
432
349
  function normalizeBannerButtonName(value: unknown): string | undefined {
433
350
  const text = normalizeCmsText(value)
@@ -457,11 +374,6 @@ export function getContactInfoFromPageInput(
457
374
  }
458
375
  }
459
376
 
460
- /** @deprecated Pass `pageInput` from main project. */
461
- export const getContactInfoFromConfig = async (): Promise<ContactInfo | null> => {
462
- const config = await getDynamicConfig()
463
- return getContactInfoFromPageInput(config?.["homepage-config"] ?? null)
464
- }
465
377
 
466
378
  function normalizeVideoStoryUrl(entry: unknown): string | null {
467
379
  if (typeof entry === "string" && entry.trim()) return entry.trim()
@@ -506,14 +418,6 @@ export function getVideoStoriesFromPageInput(
506
418
  return { title, videoUrls }
507
419
  }
508
420
 
509
- /** @deprecated Pass `pageInput` from main project. */
510
- export const getVideoStoriesFromConfig = async (): Promise<{
511
- title: string
512
- videoUrls: string[]
513
- } | null> => {
514
- const config = await getDynamicConfig()
515
- return getVideoStoriesFromPageInput(config?.["homepage-config"] ?? null)
516
- }
517
421
 
518
422
  export type TestimonialItem = {
519
423
  id: string
@@ -599,15 +503,6 @@ export function getTestimonialsFromPageInput(
599
503
  return { title, subtitle, testimonials }
600
504
  }
601
505
 
602
- /** @deprecated Pass `pageInput` from main project. */
603
- export const getTestimonialsFromConfig = async (): Promise<{
604
- title: string
605
- subtitle: string | null
606
- testimonials: TestimonialItem[]
607
- }> => {
608
- const config = await getDynamicConfig()
609
- return getTestimonialsFromPageInput(config?.["homepage-config"] ?? null)
610
- }
611
506
 
612
507
  export function getSocialLinksFromPageInput(
613
508
  pageInput?: HomepageConfig | null
@@ -627,32 +522,101 @@ export function getSocialLinksFromPageInput(
627
522
  return socialLinks.length > 0 ? socialLinks : null
628
523
  }
629
524
 
630
- /** @deprecated Pass `pageInput` from main project. */
631
- export const getSocialLinksFromConfig = async (): Promise<Array<{
632
- name: string
633
- url: string
525
+
526
+ export type HelpFaqItem = { q: string; a: string }
527
+
528
+ export type HelpFaqCategory = {
529
+ category: string
634
530
  icon?: string
635
- }> | null> => {
636
- const config = await getDynamicConfig()
637
- return getSocialLinksFromPageInput(config?.["homepage-config"] ?? null)
531
+ color?: string
532
+ items: HelpFaqItem[]
638
533
  }
639
534
 
640
- export function getFaqsFromPageInput(
535
+ export type HelpFaqSectionCopy = {
536
+ eyebrow?: string
537
+ title?: string
538
+ titleHighlight?: string
539
+ subtitle?: string
540
+ }
541
+
542
+ export type HelpFaqConfig = {
543
+ sectionCopy: HelpFaqSectionCopy
544
+ categories: HelpFaqCategory[]
545
+ }
546
+
547
+ function asConfigObject(value: unknown): Record<string, unknown> | null {
548
+ if (value && typeof value === "object" && !Array.isArray(value)) {
549
+ return value as Record<string, unknown>
550
+ }
551
+ return null
552
+ }
553
+
554
+ function asConfigArray(value: unknown): unknown[] {
555
+ return Array.isArray(value) ? value : []
556
+ }
557
+
558
+ function parseHelpFaqItems(itemsRaw: unknown): HelpFaqItem[] {
559
+ const items: HelpFaqItem[] = []
560
+ for (const item of asConfigArray(itemsRaw)) {
561
+ const faq =
562
+ asConfigObject((item as Record<string, unknown>)?.faq) ?? asConfigObject(item)
563
+ if (!faq) continue
564
+ const q = String(
565
+ faq.question ?? faq["faq-question"] ?? faq.q ?? ""
566
+ ).trim()
567
+ const a = String(faq.answer ?? faq["faq-answer"] ?? faq.a ?? "").trim()
568
+ if (q && a) items.push({ q, a })
569
+ }
570
+ return items
571
+ }
572
+
573
+ function parseHelpFaqCategoriesFromBlock(
574
+ block: Record<string, unknown>
575
+ ): HelpFaqCategory[] {
576
+ const raw = block.categories
577
+ if (!Array.isArray(raw)) return []
578
+
579
+ const categories: HelpFaqCategory[] = []
580
+ for (const row of raw) {
581
+ const cat =
582
+ asConfigObject((row as Record<string, unknown>)?.category) ??
583
+ asConfigObject(row)
584
+ if (!cat) continue
585
+ const category = String(cat.category ?? cat.name ?? "").trim()
586
+ const items = parseHelpFaqItems(cat.items)
587
+ if (!category || items.length === 0) continue
588
+ categories.push({
589
+ category,
590
+ icon: String(cat.icon ?? "❓").trim() || "❓",
591
+ color:
592
+ String(cat.color ?? "from-violet-500 to-purple-400").trim() ||
593
+ "from-violet-500 to-purple-400",
594
+ items,
595
+ })
596
+ }
597
+ return categories
598
+ }
599
+
600
+ function parseHelpFaqCategoriesFromLegacyArray(
641
601
  pageInput?: HomepageConfig | null
642
- ): Array<{ category: string; items: Array<{ q: string; a: string }> }> | null {
602
+ ): HelpFaqCategory[] {
643
603
  const config = resolvePageInput(pageInput)
644
604
  const faqsRaw = config["faq-array"] || []
645
- if (!Array.isArray(faqsRaw) || faqsRaw.length === 0) return null
605
+ if (!Array.isArray(faqsRaw) || faqsRaw.length === 0) return []
606
+
646
607
  const categoriesMap: Record<
647
608
  string,
648
- { displayCategory: string; items: Array<{ q: string; a: string }> }
609
+ { displayCategory: string; items: HelpFaqItem[] }
649
610
  > = {}
611
+
650
612
  faqsRaw.forEach((item: Record<string, unknown>) => {
651
- const faq = (item?.["faq"] || item) as Record<string, unknown>
652
- const displayCategory = String(faq?.["faq-category"] || "General Questions").trim()
613
+ const faq = (item?.faq || item) as Record<string, unknown>
614
+ const displayCategory = String(
615
+ faq?.["faq-category"] || faq?.category || "General Questions"
616
+ ).trim()
653
617
  const categoryKey = displayCategory.toLowerCase()
654
- const q = String(faq?.["faq-question"] || "").trim()
655
- const a = String(faq?.["faq-answer"] || "").trim()
618
+ const q = String(faq?.["faq-question"] || faq?.question || "").trim()
619
+ const a = String(faq?.["faq-answer"] || faq?.answer || "").trim()
656
620
  if (q && a) {
657
621
  if (!categoriesMap[categoryKey]) {
658
622
  categoriesMap[categoryKey] = { displayCategory, items: [] }
@@ -660,22 +624,56 @@ export function getFaqsFromPageInput(
660
624
  categoriesMap[categoryKey].items.push({ q, a })
661
625
  }
662
626
  })
663
- const faqs = Object.values(categoriesMap).map((catData) => ({
664
- category: catData.displayCategory,
665
- items: catData.items,
627
+
628
+ return Object.values(categoriesMap).map((cat) => ({
629
+ category: cat.displayCategory,
630
+ icon: "❓",
631
+ color: "from-violet-500 to-purple-400",
632
+ items: cat.items,
666
633
  }))
667
- return faqs.length > 0 ? faqs : null
668
634
  }
669
635
 
670
- /** @deprecated Pass `pageInput` from main project. */
671
- export const getFaqsFromConfig = async (): Promise<Array<{
672
- category: string
673
- items: Array<{ q: string; a: string }>
674
- }> | null> => {
675
- const config = await getDynamicConfig()
676
- return getFaqsFromPageInput(config?.["homepage-config"] ?? null)
636
+ function helpFaqBlockToSectionCopy(
637
+ block: Record<string, unknown>
638
+ ): HelpFaqSectionCopy {
639
+ const copy = parseSectionCopy(block)
640
+ return {
641
+ eyebrow: copy.eyebrow ?? undefined,
642
+ title: copy.title ?? copy.name ?? undefined,
643
+ titleHighlight:
644
+ typeof block.titleHighlight === "string"
645
+ ? block.titleHighlight
646
+ : undefined,
647
+ subtitle: copy.subtitle ?? copy.description ?? copy.text ?? undefined,
648
+ }
677
649
  }
678
650
 
651
+ /**
652
+ * Help page FAQ — `sections.helpFaq` (preferred) with legacy `faq-array` fallback.
653
+ */
654
+ export function getHelpFaqFromPageInput(
655
+ pageInput?: HomepageConfig | null
656
+ ): HelpFaqConfig {
657
+ const block = getMergedSectionBlock("helpFaq", pageInput)
658
+ const sectionCopy = helpFaqBlockToSectionCopy(block)
659
+
660
+ let categories = parseHelpFaqCategoriesFromBlock(block)
661
+ if (categories.length === 0) {
662
+ categories = parseHelpFaqCategoriesFromLegacyArray(pageInput)
663
+ }
664
+
665
+ return { sectionCopy, categories }
666
+ }
667
+
668
+ /** FAQ categories for the help template (null when empty). */
669
+ export function getFaqsFromPageInput(
670
+ pageInput?: HomepageConfig | null
671
+ ): HelpFaqCategory[] | null {
672
+ const { categories } = getHelpFaqFromPageInput(pageInput)
673
+ return categories.length > 0 ? categories : null
674
+ }
675
+
676
+
679
677
  export function getAnnouncementMessagesFromPageInput(
680
678
  pageInput?: HomepageConfig | null
681
679
  ): string[] {
@@ -683,11 +681,6 @@ export function getAnnouncementMessagesFromPageInput(
683
681
  return parseAnnouncementMessages(block)
684
682
  }
685
683
 
686
- /** @deprecated Pass `pageInput` from main project. */
687
- export const getAnnouncementMessagesFromConfig = async (): Promise<string[]> => {
688
- const config = await getDynamicConfig()
689
- return getAnnouncementMessagesFromPageInput(config?.["homepage-config"] ?? null)
690
- }
691
684
 
692
685
  export type AboutBrandConfig = {
693
686
  eyebrow: string
@@ -732,16 +725,12 @@ export function getAboutBrandFromPageInput(
732
725
  }
733
726
  }
734
727
 
735
- /** @deprecated Pass `pageInput` from main project. */
736
- export const getAboutBrandFromConfig = async (): Promise<AboutBrandConfig> => {
737
- const config = await getDynamicConfig()
738
- return getAboutBrandFromPageInput(config?.["homepage-config"] ?? null)
739
- }
740
728
 
741
729
  export type BrandPillarConfig = {
742
730
  title: string
743
731
  description: string
744
732
  image?: string
733
+ href?: string
745
734
  }
746
735
 
747
736
  export function getBrandPillarsFromPageInput(
@@ -765,14 +754,6 @@ export function getBrandPillarsFromPageInput(
765
754
  return { sectionTitle, pillars }
766
755
  }
767
756
 
768
- /** @deprecated Pass `pageInput` from main project. */
769
- export const getBrandPillarsFromConfig = async (): Promise<{
770
- sectionTitle: string
771
- pillars: BrandPillarConfig[]
772
- }> => {
773
- const config = await getDynamicConfig()
774
- return getBrandPillarsFromPageInput(config?.["homepage-config"] ?? null)
775
- }
776
757
 
777
758
  export type BlogPostConfig = {
778
759
  title: string
@@ -808,11 +789,6 @@ export function getBlogPostsFromPageInput(
808
789
  .filter(Boolean) as BlogPostConfig[]
809
790
  }
810
791
 
811
- /** @deprecated Pass `pageInput` from main project. */
812
- export const getBlogPostsFromConfig = async (): Promise<BlogPostConfig[]> => {
813
- const config = await getDynamicConfig()
814
- return getBlogPostsFromPageInput(config?.["homepage-config"] ?? null)
815
- }
816
792
 
817
793
  function readPromoCountdownBlock(block: unknown): {
818
794
  code: string | null
@@ -872,18 +848,6 @@ export function getPromoCountdownFromPageInput(
872
848
  }
873
849
  }
874
850
 
875
- /** @deprecated Pass `pageInput` from main project. */
876
- export const getPromoCountdownFromConfig = async (): Promise<{
877
- code: string | null
878
- message: string | null
879
- endAt: string | null
880
- active: boolean
881
- ctaLabel: string | null
882
- ctaHref: string | null
883
- }> => {
884
- const config = await getDynamicConfig()
885
- return getPromoCountdownFromPageInput(config?.["homepage-config"] ?? null)
886
- }
887
851
 
888
852
  export type InstagramPostConfig = {
889
853
  id: string
@@ -975,11 +939,6 @@ export function getInstagramPostsFromPageInput(
975
939
  }
976
940
  }
977
941
 
978
- /** @deprecated Pass `pageInput` from main project. */
979
- export const getInstagramPostsFromConfig = async (): Promise<InstagramPostsData> => {
980
- const config = await getDynamicConfig()
981
- return getInstagramPostsFromPageInput(config?.["homepage-config"] ?? null)
982
- }
983
942
 
984
943
  export {
985
944
  DEFAULT_HOMEPAGE_SECTIONS,
@@ -1007,13 +966,3 @@ export function getPromoBarFromPageInput(
1007
966
  return { text, code, value, active }
1008
967
  }
1009
968
 
1010
- /** @deprecated Pass `pageInput` from main project. */
1011
- export const getPromoBarConfig = async (): Promise<{
1012
- text: string | null
1013
- code: string | null
1014
- value: string | null
1015
- active: boolean
1016
- }> => {
1017
- const config = await getDynamicConfig()
1018
- return getPromoBarFromPageInput(config?.["homepage-config"] ?? null)
1019
- }
@@ -8,7 +8,7 @@ import {
8
8
  medusaShippingOptionCalculate,
9
9
  medusaShiprocketServiceability,
10
10
  } from "medusa-services/fulfillment"
11
- import { getStoreCartClientOptions } from "../util/store-client"
11
+ import { getStoreClientOptions } from "../util/store-client"
12
12
 
13
13
  export const listCartShippingMethods = async (cartId: string) => {
14
14
  const headers = {
@@ -44,7 +44,7 @@ export const calculatePriceForShippingOption = async (
44
44
  data?: Record<string, unknown>
45
45
  ) => {
46
46
  try {
47
- const options = await getStoreCartClientOptions()
47
+ const options = await getStoreClientOptions()
48
48
  const { shipping_option } = await medusaShippingOptionCalculate(
49
49
  optionId,
50
50
  cartId,
@@ -59,7 +59,7 @@ export const calculatePriceForShippingOption = async (
59
59
 
60
60
  export const getShiprocketServiceability = async (pincode: string, variant_id: string, cod: number = 0) => {
61
61
  try {
62
- const options = await getStoreCartClientOptions()
62
+ const options = await getStoreClientOptions()
63
63
  return await medusaShiprocketServiceability(
64
64
  { pincode, variant_id, cod },
65
65
  options
@@ -0,0 +1,92 @@
1
+ {
2
+ "eyebrow": "Knowledge Base",
3
+ "title": "Frequently Asked",
4
+ "titleHighlight": "Questions",
5
+ "subtitle": "Browse through our most common questions — organized by topic for easy navigation.",
6
+ "categories": [
7
+ {
8
+ "category": "Order & Delivery",
9
+ "icon": "🚚",
10
+ "color": "from-blue-500 to-cyan-400",
11
+ "items": [
12
+ {
13
+ "question": "When will I receive my order?",
14
+ "answer": "Orders are typically processed within 1-2 business days. Delivery takes 3-5 business days depending on your location. Express delivery options may be available at checkout."
15
+ },
16
+ {
17
+ "question": "How can I track my order?",
18
+ "answer": "Once your order ships, you will receive a tracking link via email and SMS. You can also track your order anytime from your account dashboard under 'My Orders'."
19
+ },
20
+ {
21
+ "question": "Can I cancel or change my order?",
22
+ "answer": "You can cancel or change your order within 24 hours of placing it. Please contact our support team immediately or use the cancel option in your account. After 24 hours, the order may already be in processing."
23
+ },
24
+ {
25
+ "question": "Do you offer free shipping?",
26
+ "answer": "Yes! We offer free shipping on all orders above ₹999. For orders below this amount, a nominal shipping fee applies based on your delivery location and the chosen shipping method."
27
+ }
28
+ ]
29
+ },
30
+ {
31
+ "category": "Returns & Exchanges",
32
+ "icon": "📦",
33
+ "color": "from-emerald-500 to-teal-400",
34
+ "items": [
35
+ {
36
+ "question": "What is your return policy?",
37
+ "answer": "We offer a 7-day return policy for unused, unwashed items in their original packaging with tags attached. Items must be in their original condition to qualify for a return."
38
+ },
39
+ {
40
+ "question": "How do I initiate a return?",
41
+ "answer": "Go to your account, click on the specific order, and select 'Return Items'. Follow the instructions to generate a pickup request. Our team will schedule a pickup within 2 business days."
42
+ },
43
+ {
44
+ "question": "Do you offer exchanges?",
45
+ "answer": "Yes, you can request an exchange for a different size or color within 7 days of delivery, subject to availability. Exchange items must be in original condition with all tags intact."
46
+ },
47
+ {
48
+ "question": "When will I receive my exchanged item?",
49
+ "answer": "Once we receive and verify your returned item, the exchange will be dispatched within 2 business days. You'll receive a tracking link as soon as it ships."
50
+ }
51
+ ]
52
+ },
53
+ {
54
+ "category": "Payment & Refunds",
55
+ "icon": "💳",
56
+ "color": "from-violet-500 to-purple-400",
57
+ "items": [
58
+ {
59
+ "question": "When will I receive my refund?",
60
+ "answer": "Refunds are processed within 5-7 business days after we receive and inspect your returned items. The amount will be credited to your original payment method."
61
+ },
62
+ {
63
+ "question": "What payment methods do you accept?",
64
+ "answer": "We accept all major credit/debit cards, UPI, Net Banking, Wallets (Paytm, PhonePe, etc.), and Cash on Delivery (COD) for most PIN codes across India."
65
+ },
66
+ {
67
+ "question": "Is my payment information secure?",
68
+ "answer": "Absolutely! We use industry-standard SSL encryption and our payment gateway (Razorpay) is PCI-DSS compliant. We never store your card details on our servers."
69
+ }
70
+ ]
71
+ },
72
+ {
73
+ "category": "Product Inquiry",
74
+ "icon": "👗",
75
+ "color": "from-pink-500 to-rose-400",
76
+ "items": [
77
+ {
78
+ "question": "How do I find the right size for my child?",
79
+ "answer": "Each product page includes a detailed size chart with measurements in both cm and inches. We recommend measuring your child and comparing with our chart for the best fit. When in doubt, size up!"
80
+ },
81
+ {
82
+ "question": "Are products safe for kids?",
83
+ "answer": "Yes! All our products are certified child-safe. We use non-toxic, hypoallergenic dyes and materials that meet Indian safety standards for children's clothing. Safety is our top priority."
84
+ },
85
+ {
86
+ "question": "How should I care for the clothing?",
87
+ "answer": "Machine wash cold with like colors. Do not bleach. Tumble dry low or hang dry. Iron on low heat if needed. Detailed care instructions are printed on the garment's inner label."
88
+ }
89
+ ]
90
+ }
91
+ ]
92
+ }