@commercetools-frontend/application-shell 22.2.1 → 22.3.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 (209) hide show
  1. package/dist/{application-entry-point-32a3b092.cjs.dev.js → application-entry-point-0c3254b0.cjs.dev.js} +10 -19
  2. package/dist/{application-entry-point-ac068fc0.cjs.prod.js → application-entry-point-2333abb6.cjs.prod.js} +10 -19
  3. package/dist/{application-entry-point-07dbf99c.esm.js → application-entry-point-a1dfe994.esm.js} +10 -19
  4. package/dist/{box-8850277f.cjs.prod.js → box-686bc950.cjs.dev.js} +0 -2
  5. package/dist/{box-4395623b.esm.js → box-6ce924c9.esm.js} +0 -2
  6. package/dist/{box-6b5be9a9.cjs.dev.js → box-e17daf6c.cjs.prod.js} +0 -2
  7. package/dist/{cart-a49faf67.esm.js → cart-3b156a46.esm.js} +0 -2
  8. package/dist/{cart-41f0b7bc.cjs.dev.js → cart-796beed7.cjs.dev.js} +0 -2
  9. package/dist/{cart-0698b97d.cjs.prod.js → cart-f2fc1baf.cjs.prod.js} +0 -2
  10. package/dist/commercetools-frontend-application-shell.cjs.dev.js +5 -5
  11. package/dist/commercetools-frontend-application-shell.cjs.prod.js +5 -5
  12. package/dist/commercetools-frontend-application-shell.esm.js +5 -5
  13. package/dist/{configure-apollo-b2a0d497.cjs.prod.js → configure-apollo-70d83707.cjs.prod.js} +64 -181
  14. package/dist/{configure-apollo-4ea370b4.esm.js → configure-apollo-89ea99bf.esm.js} +64 -183
  15. package/dist/{configure-apollo-3daef70c.cjs.dev.js → configure-apollo-de2b9aa2.cjs.dev.js} +64 -183
  16. package/dist/{connected-square-47233754.cjs.dev.js → connected-square-960e046b.cjs.prod.js} +0 -2
  17. package/dist/{connected-square-b2e25621.cjs.prod.js → connected-square-961eb5b6.cjs.dev.js} +0 -2
  18. package/dist/{connected-square-3cac6bd7.esm.js → connected-square-f34a98ff.esm.js} +0 -2
  19. package/dist/{constants-a3c2194a.cjs.prod.js → constants-902cf3f3.cjs.prod.js} +2 -1
  20. package/dist/{constants-940f343f.esm.js → constants-b962b73e.esm.js} +2 -1
  21. package/dist/{constants-b201d328.cjs.dev.js → constants-e51cdcc0.cjs.dev.js} +2 -1
  22. package/dist/declarations/src/components/app-bar/app-bar.d.ts +1 -1
  23. package/dist/declarations/src/components/application-entry-point/application-entry-point.d.ts +1 -1
  24. package/dist/declarations/src/components/application-loader/application-loader.d.ts +1 -1
  25. package/dist/declarations/src/components/application-shell/application-shell.d.ts +1 -1
  26. package/dist/declarations/src/components/application-shell/global-styles.d.ts +1 -1
  27. package/dist/declarations/src/components/application-shell-authenticated/application-shell-authenticated.d.ts +1 -1
  28. package/dist/declarations/src/components/application-shell-provider/application-shell-provider.d.ts +1 -2
  29. package/dist/declarations/src/components/application-shell-provider/utils.d.ts +2 -0
  30. package/dist/declarations/src/components/authenticated/am-i-logged-in.d.ts +1 -1
  31. package/dist/declarations/src/components/authenticated/authenticated.d.ts +1 -1
  32. package/dist/declarations/src/components/authenticated/oidc-callback-error-page.d.ts +1 -1
  33. package/dist/declarations/src/components/authenticated/oidc-callback.async.d.ts +1 -1
  34. package/dist/declarations/src/components/authenticated/oidc-callback.d.ts +1 -1
  35. package/dist/declarations/src/components/back-to-project/back-to-project.d.ts +1 -1
  36. package/dist/declarations/src/components/configure-intl-provider/configure-intl-provider.d.ts +1 -1
  37. package/dist/declarations/src/components/error-apologizer/error-apologizer.d.ts +1 -1
  38. package/dist/declarations/src/components/error-apologizer/index.d.ts +1 -1
  39. package/dist/declarations/src/components/error-boundary/error-boundary.d.ts +1 -1
  40. package/dist/declarations/src/components/fetch-project/fetch-project.d.ts +1 -1
  41. package/dist/declarations/src/components/fetch-user/fetch-user.d.ts +1 -1
  42. package/dist/declarations/src/components/inject-reducers/inject-reducers.d.ts +1 -1
  43. package/dist/declarations/src/components/locale-switcher/locale-switcher.d.ts +2 -2
  44. package/dist/declarations/src/components/navbar/index.d.ts +1 -1
  45. package/dist/declarations/src/components/navbar/legacy-icons/box.d.ts +1 -1
  46. package/dist/declarations/src/components/navbar/legacy-icons/cart.d.ts +1 -1
  47. package/dist/declarations/src/components/navbar/legacy-icons/connected-square.d.ts +1 -1
  48. package/dist/declarations/src/components/navbar/legacy-icons/gear.d.ts +1 -1
  49. package/dist/declarations/src/components/navbar/legacy-icons/heart.d.ts +1 -1
  50. package/dist/declarations/src/components/navbar/legacy-icons/list-with-search.d.ts +1 -1
  51. package/dist/declarations/src/components/navbar/legacy-icons/paperclip.d.ts +1 -1
  52. package/dist/declarations/src/components/navbar/legacy-icons/plugin.d.ts +1 -1
  53. package/dist/declarations/src/components/navbar/legacy-icons/rocket.d.ts +1 -1
  54. package/dist/declarations/src/components/navbar/legacy-icons/speedometer.d.ts +1 -1
  55. package/dist/declarations/src/components/navbar/legacy-icons/star.d.ts +1 -1
  56. package/dist/declarations/src/components/navbar/legacy-icons/tag-multi.d.ts +1 -1
  57. package/dist/declarations/src/components/navbar/legacy-icons/tree-structure.d.ts +1 -1
  58. package/dist/declarations/src/components/navbar/legacy-icons/user-filled.d.ts +1 -1
  59. package/dist/declarations/src/components/navbar/legacy-icons/world.d.ts +1 -1
  60. package/dist/declarations/src/components/navbar/loading-navbar.d.ts +1 -1
  61. package/dist/declarations/src/components/navbar/menu-items.d.ts +8 -8
  62. package/dist/declarations/src/components/navbar/navbar.d.ts +1 -1
  63. package/dist/declarations/src/components/project-container/index.d.ts +1 -1
  64. package/dist/declarations/src/components/project-container/project-container.d.ts +1 -1
  65. package/dist/declarations/src/components/project-data-locale/project-data-locale.d.ts +1 -1
  66. package/dist/declarations/src/components/project-expired/index.d.ts +1 -1
  67. package/dist/declarations/src/components/project-expired/project-expired.d.ts +1 -1
  68. package/dist/declarations/src/components/project-not-found/index.d.ts +1 -1
  69. package/dist/declarations/src/components/project-not-found/project-not-found.d.ts +1 -1
  70. package/dist/declarations/src/components/project-not-initialized/index.d.ts +1 -1
  71. package/dist/declarations/src/components/project-not-initialized/project-not-initialized.d.ts +1 -1
  72. package/dist/declarations/src/components/project-suspended/index.d.ts +1 -1
  73. package/dist/declarations/src/components/project-suspended/project-suspended.d.ts +1 -1
  74. package/dist/declarations/src/components/project-switcher/project-switcher.d.ts +3 -3
  75. package/dist/declarations/src/components/quick-access/butler/butler.d.ts +1 -1
  76. package/dist/declarations/src/components/quick-access/butler-command/butler-command.d.ts +1 -1
  77. package/dist/declarations/src/components/quick-access/index.d.ts +1 -1
  78. package/dist/declarations/src/components/quick-access/quick-access.d.ts +1 -1
  79. package/dist/declarations/src/components/redirect-to-login/index.d.ts +1 -1
  80. package/dist/declarations/src/components/redirect-to-login/redirect-to-login.d.ts +1 -1
  81. package/dist/declarations/src/components/redirect-to-logout/index.d.ts +1 -1
  82. package/dist/declarations/src/components/redirect-to-logout/redirect-to-logout.d.ts +1 -1
  83. package/dist/declarations/src/components/redirect-to-project-create/index.d.ts +1 -1
  84. package/dist/declarations/src/components/redirect-to-project-create/redirect-to-project-create.d.ts +1 -1
  85. package/dist/declarations/src/components/route-catch-all/index.d.ts +1 -1
  86. package/dist/declarations/src/components/route-catch-all/route-catch-all.d.ts +1 -1
  87. package/dist/declarations/src/components/service-page-project-switcher/service-page-project-switcher.d.ts +1 -1
  88. package/dist/declarations/src/components/setup-flop-flip-provider/setup-flop-flip-provider.d.ts +1 -1
  89. package/dist/declarations/src/components/suspended-route/suspended-route.d.ts +1 -1
  90. package/dist/declarations/src/components/theme-switcher/new-design-release-info-dialog.d.ts +1 -1
  91. package/dist/declarations/src/components/theme-switcher/theme-switcher.d.ts +1 -1
  92. package/dist/declarations/src/components/user-settings-menu/index.d.ts +1 -1
  93. package/dist/declarations/src/components/user-settings-menu/user-settings-menu.d.ts +3 -3
  94. package/dist/declarations/src/types/generated/settings.d.ts +89 -1151
  95. package/dist/{error-apologizer-57a2fb57.cjs.prod.js → error-apologizer-24ad0b88.cjs.prod.js} +0 -3
  96. package/dist/{error-apologizer-d0409fcb.esm.js → error-apologizer-55551c07.esm.js} +0 -3
  97. package/dist/{error-apologizer-d20ca326.cjs.dev.js → error-apologizer-a5c03978.cjs.dev.js} +0 -3
  98. package/dist/{gear-300dd24c.esm.js → gear-1f381738.esm.js} +0 -2
  99. package/dist/{gear-2890f7fb.cjs.prod.js → gear-9b394c43.cjs.prod.js} +0 -2
  100. package/dist/{gear-e8014c5a.cjs.dev.js → gear-ab1f6210.cjs.dev.js} +0 -2
  101. package/dist/{get-mc-origin-7968e04f.cjs.prod.js → get-mc-origin-8f7a578c.cjs.prod.js} +10 -16
  102. package/dist/{get-mc-origin-314b77a2.cjs.dev.js → get-mc-origin-a86dff20.cjs.dev.js} +10 -16
  103. package/dist/{get-mc-origin-5df60933.esm.js → get-mc-origin-fecfee07.esm.js} +10 -16
  104. package/dist/{heart-000a023d.cjs.prod.js → heart-a6e7ccf9.cjs.dev.js} +0 -2
  105. package/dist/{heart-dded66b4.esm.js → heart-be7c779b.esm.js} +0 -2
  106. package/dist/{heart-f21b7d39.cjs.dev.js → heart-ebfab4cd.cjs.prod.js} +0 -2
  107. package/dist/{index-894f4596.cjs.dev.js → index-02a17607.cjs.dev.js} +241 -473
  108. package/dist/{index-3239484c.esm.js → index-667035b8.esm.js} +240 -472
  109. package/dist/{index-4e8fd5e2.cjs.prod.js → index-a03f4e81.cjs.prod.js} +237 -465
  110. package/dist/{list-with-search-a3302710.esm.js → list-with-search-3341bbf7.esm.js} +0 -2
  111. package/dist/{list-with-search-a5b72b33.cjs.prod.js → list-with-search-b5e9ae1b.cjs.dev.js} +0 -2
  112. package/dist/{list-with-search-ee796e9e.cjs.dev.js → list-with-search-e3ccba98.cjs.prod.js} +0 -2
  113. package/dist/{navbar-de19b951.cjs.prod.js → navbar-00a55ccf.cjs.prod.js} +53 -110
  114. package/dist/{navbar-af81c703.cjs.dev.js → navbar-1b61993a.cjs.dev.js} +53 -110
  115. package/dist/{navbar-614b1cce.esm.js → navbar-84dc97f9.esm.js} +53 -110
  116. package/dist/{new-design-release-info-dialog-629191c2.cjs.dev.js → new-design-release-info-dialog-57843832.cjs.dev.js} +0 -2
  117. package/dist/{new-design-release-info-dialog-879a4af8.cjs.prod.js → new-design-release-info-dialog-730137e2.cjs.prod.js} +0 -2
  118. package/dist/{new-design-release-info-dialog-6e19106c.esm.js → new-design-release-info-dialog-e2cd95fa.esm.js} +0 -2
  119. package/dist/{oidc-15d3a4c1.cjs.dev.js → oidc-4895bd80.cjs.dev.js} +13 -20
  120. package/dist/{oidc-callback-ab054f67.cjs.prod.js → oidc-callback-121ef6c1.cjs.prod.js} +12 -20
  121. package/dist/{oidc-callback-ec94dbba.esm.js → oidc-callback-cddf8bb4.esm.js} +12 -20
  122. package/dist/{oidc-callback-ca559a40.cjs.dev.js → oidc-callback-e60075ab.cjs.dev.js} +12 -20
  123. package/dist/{oidc-77115492.esm.js → oidc-d7f0409a.esm.js} +13 -20
  124. package/dist/{oidc-6c79100b.cjs.prod.js → oidc-da4ccc69.cjs.prod.js} +13 -20
  125. package/dist/{paperclip-23d1e69c.cjs.prod.js → paperclip-6f0b6ae5.cjs.prod.js} +0 -2
  126. package/dist/{paperclip-a61112e8.esm.js → paperclip-c76aec52.esm.js} +0 -2
  127. package/dist/{paperclip-d653c134.cjs.dev.js → paperclip-ec55e4a0.cjs.dev.js} +0 -2
  128. package/dist/{plugin-0ee6aee4.cjs.dev.js → plugin-16c01245.cjs.dev.js} +0 -2
  129. package/dist/{plugin-3d353a5b.esm.js → plugin-279f88cd.esm.js} +0 -2
  130. package/dist/{plugin-7e57f237.cjs.prod.js → plugin-f199ed20.cjs.prod.js} +0 -2
  131. package/dist/{project-container-8ca21a5f.cjs.dev.js → project-container-51e70095.cjs.dev.js} +21 -46
  132. package/dist/{project-container-493422d8.esm.js → project-container-98c2a789.esm.js} +21 -46
  133. package/dist/{project-container-805662a2.cjs.prod.js → project-container-e7f950b0.cjs.prod.js} +21 -45
  134. package/dist/{project-expired-f660e923.cjs.prod.js → project-expired-1cd4843f.cjs.prod.js} +6 -11
  135. package/dist/{project-expired-fe211a3d.esm.js → project-expired-513a8320.esm.js} +6 -11
  136. package/dist/{project-expired-d020ec6f.cjs.dev.js → project-expired-fd3efa19.cjs.dev.js} +6 -11
  137. package/dist/{project-not-found-b5502e08.esm.js → project-not-found-8bab15e7.esm.js} +6 -9
  138. package/dist/{project-not-found-46f1cd62.cjs.prod.js → project-not-found-9f21b30c.cjs.prod.js} +6 -9
  139. package/dist/{project-not-found-179f39e9.cjs.dev.js → project-not-found-e5eb5b7e.cjs.dev.js} +6 -9
  140. package/dist/{project-not-initialized-e9905ca9.cjs.dev.js → project-not-initialized-3cdb8692.cjs.dev.js} +6 -11
  141. package/dist/{project-not-initialized-0a4c847b.cjs.prod.js → project-not-initialized-a1a8d9dc.cjs.prod.js} +6 -11
  142. package/dist/{project-not-initialized-f14ed881.esm.js → project-not-initialized-a8562fd3.esm.js} +6 -11
  143. package/dist/{project-suspended-a1a46abb.cjs.dev.js → project-suspended-79c67f38.cjs.dev.js} +6 -10
  144. package/dist/{project-suspended-994f5d16.cjs.prod.js → project-suspended-8a558cb8.cjs.prod.js} +6 -10
  145. package/dist/{project-suspended-8e50fb5d.esm.js → project-suspended-e0fb960a.esm.js} +6 -10
  146. package/dist/{quick-access-4f55c2a1.cjs.dev.js → quick-access-0fb30eee.cjs.dev.js} +124 -194
  147. package/dist/{quick-access-9742ff95.esm.js → quick-access-8c7919d2.esm.js} +124 -194
  148. package/dist/{quick-access-e7d9ec95.cjs.prod.js → quick-access-ff6fee75.cjs.prod.js} +123 -191
  149. package/dist/{redirect-to-login-58e4614d.esm.js → redirect-to-login-02167259.esm.js} +14 -18
  150. package/dist/{redirect-to-login-d893ba27.cjs.prod.js → redirect-to-login-3c2a1258.cjs.prod.js} +14 -18
  151. package/dist/{redirect-to-login-7c89cdfd.cjs.dev.js → redirect-to-login-73396807.cjs.dev.js} +14 -18
  152. package/dist/{redirect-to-logout-7fa846f5.cjs.prod.js → redirect-to-logout-838758f3.cjs.prod.js} +7 -12
  153. package/dist/{redirect-to-logout-2967472e.esm.js → redirect-to-logout-b5c8fdbf.esm.js} +7 -12
  154. package/dist/{redirect-to-logout-429bb215.cjs.dev.js → redirect-to-logout-be3e139d.cjs.dev.js} +7 -12
  155. package/dist/{redirect-to-project-create-048efa71.cjs.prod.js → redirect-to-project-create-2266c427.cjs.prod.js} +1 -3
  156. package/dist/{redirect-to-project-create-f0e7b35e.cjs.dev.js → redirect-to-project-create-7b476aa6.cjs.dev.js} +1 -3
  157. package/dist/{redirect-to-project-create-052f293e.esm.js → redirect-to-project-create-c5323504.esm.js} +1 -3
  158. package/dist/{redirector-47a6be71.esm.js → redirector-368eeb0f.esm.js} +1 -8
  159. package/dist/{redirector-0d98f9df.cjs.dev.js → redirector-ec9fa17f.cjs.prod.js} +1 -8
  160. package/dist/{redirector-77ce2f5c.cjs.prod.js → redirector-f71198cc.cjs.dev.js} +1 -8
  161. package/dist/{requests-in-flight-loader-2d2db11b.cjs.dev.js → requests-in-flight-loader-3a40411c.cjs.dev.js} +5 -9
  162. package/dist/{requests-in-flight-loader-30deef32.esm.js → requests-in-flight-loader-78bce8a5.esm.js} +5 -9
  163. package/dist/{requests-in-flight-loader-06e4f458.cjs.prod.js → requests-in-flight-loader-d7963726.cjs.prod.js} +5 -9
  164. package/dist/{rocket-4b088727.esm.js → rocket-067c2f8c.esm.js} +0 -2
  165. package/dist/{rocket-3e3f0a98.cjs.prod.js → rocket-c6d44215.cjs.dev.js} +0 -2
  166. package/dist/{rocket-95b6858d.cjs.dev.js → rocket-f0bfae34.cjs.prod.js} +0 -2
  167. package/dist/{route-catch-all-3b490df1.cjs.prod.js → route-catch-all-293a1269.cjs.dev.js} +6 -6
  168. package/dist/{route-catch-all-9ac99936.cjs.dev.js → route-catch-all-373c69c6.cjs.prod.js} +6 -6
  169. package/dist/{route-catch-all-01cf0095.esm.js → route-catch-all-4af77675.esm.js} +6 -6
  170. package/dist/{service-page-project-switcher-52105f71.cjs.dev.js → service-page-project-switcher-2a4bc3ee.cjs.dev.js} +3 -4
  171. package/dist/{service-page-project-switcher-b1384fa6.cjs.prod.js → service-page-project-switcher-617a204e.cjs.prod.js} +3 -3
  172. package/dist/{service-page-project-switcher-ef6a88ea.esm.js → service-page-project-switcher-b99782a7.esm.js} +3 -4
  173. package/dist/{speedometer-2881cef6.cjs.prod.js → speedometer-0de260cf.cjs.prod.js} +0 -2
  174. package/dist/{speedometer-54f872f2.cjs.dev.js → speedometer-aedd9660.cjs.dev.js} +0 -2
  175. package/dist/{speedometer-08a11d5a.esm.js → speedometer-baa6ae82.esm.js} +0 -2
  176. package/dist/{star-52bf7a64.cjs.dev.js → star-49745c72.cjs.dev.js} +0 -2
  177. package/dist/{star-15244db1.esm.js → star-bd723a9c.esm.js} +0 -2
  178. package/dist/{star-f8502efb.cjs.prod.js → star-c11b0683.cjs.prod.js} +0 -2
  179. package/dist/{tag-multi-3be995ac.esm.js → tag-multi-1dee8212.esm.js} +0 -2
  180. package/dist/{tag-multi-1d1553b6.cjs.dev.js → tag-multi-2e7a68ec.cjs.dev.js} +0 -2
  181. package/dist/{tag-multi-f9acb1c2.cjs.prod.js → tag-multi-f8d9c9e6.cjs.prod.js} +0 -2
  182. package/dist/{tree-structure-c8753526.esm.js → tree-structure-0a1dc6bf.esm.js} +0 -2
  183. package/dist/{tree-structure-4650688d.cjs.dev.js → tree-structure-690366f9.cjs.prod.js} +0 -2
  184. package/dist/{tree-structure-f24ee3f6.cjs.prod.js → tree-structure-8c974c7a.cjs.dev.js} +0 -2
  185. package/dist/{use-applications-menu-a5568a7d.cjs.prod.js → use-applications-menu-2046cce4.cjs.dev.js} +30 -40
  186. package/dist/{use-applications-menu-3e85b058.cjs.dev.js → use-applications-menu-84a888d7.cjs.prod.js} +30 -40
  187. package/dist/{use-applications-menu-824f1519.esm.js → use-applications-menu-daf4a744.esm.js} +30 -40
  188. package/dist/{use-is-served-by-proxy-499bfa16.esm.js → use-is-served-by-proxy-77984220.esm.js} +0 -2
  189. package/dist/{use-is-served-by-proxy-2b4916e5.cjs.dev.js → use-is-served-by-proxy-845cace5.cjs.prod.js} +0 -2
  190. package/dist/{use-is-served-by-proxy-51e76976.cjs.prod.js → use-is-served-by-proxy-ed411f45.cjs.dev.js} +0 -2
  191. package/dist/{user-filled-2e6cb25e.cjs.dev.js → user-filled-58af1ae4.cjs.prod.js} +0 -2
  192. package/dist/{user-filled-815b49a0.cjs.prod.js → user-filled-5dd7a51a.cjs.dev.js} +0 -2
  193. package/dist/{user-filled-2dc4e79e.esm.js → user-filled-d40a7e17.esm.js} +0 -2
  194. package/dist/{user-settings-menu-1e5736ab.esm.js → user-settings-menu-b8ecc868.esm.js} +16 -53
  195. package/dist/{user-settings-menu-92a5cb53.cjs.prod.js → user-settings-menu-c50b95e4.cjs.prod.js} +16 -52
  196. package/dist/{user-settings-menu-615d91e4.cjs.dev.js → user-settings-menu-fe393647.cjs.dev.js} +16 -53
  197. package/dist/{version-tracker-5f6c37e6.cjs.dev.js → version-tracker-3b9eb5c6.cjs.dev.js} +5 -5
  198. package/dist/{version-tracker-73a18ff9.cjs.prod.js → version-tracker-4ad14ed3.cjs.prod.js} +5 -5
  199. package/dist/{version-tracker-3e5d5525.esm.js → version-tracker-f2e3185f.esm.js} +5 -5
  200. package/dist/{world-c5ea311a.esm.js → world-1b0e72fc.esm.js} +0 -2
  201. package/dist/{world-973090a5.cjs.dev.js → world-bfd04f52.cjs.dev.js} +0 -2
  202. package/dist/{world-e1f9dbf8.cjs.prod.js → world-f921d80c.cjs.prod.js} +0 -2
  203. package/package.json +41 -27
  204. package/ssr/dist/commercetools-frontend-application-shell-ssr.cjs.dev.js +2 -2
  205. package/ssr/dist/commercetools-frontend-application-shell-ssr.cjs.prod.js +2 -2
  206. package/ssr/dist/commercetools-frontend-application-shell-ssr.esm.js +2 -2
  207. package/test-utils/dist/commercetools-frontend-application-shell-test-utils.cjs.dev.js +78 -112
  208. package/test-utils/dist/commercetools-frontend-application-shell-test-utils.cjs.prod.js +78 -112
  209. package/test-utils/dist/commercetools-frontend-application-shell-test-utils.esm.js +78 -112
@@ -23,7 +23,7 @@ import _indexOfInstanceProperty from '@babel/runtime-corejs3/core-js-stable/inst
23
23
  import _sliceInstanceProperty from '@babel/runtime-corejs3/core-js-stable/instance/slice';
24
24
  import _includesInstanceProperty from '@babel/runtime-corejs3/core-js-stable/instance/includes';
25
25
  import { reportErrorToSentry } from '@commercetools-frontend/sentry';
26
- import { S as STORAGE_KEYS, L as LOGIN_STRATEGY_OIDC, a as SUPPORTED_HEADERS } from './constants-940f343f.esm.js';
26
+ import { S as STORAGE_KEYS, L as LOGIN_STRATEGY_OIDC, a as SUPPORTED_HEADERS } from './constants-b962b73e.esm.js';
27
27
  import { selectPageNotifications } from '@commercetools-frontend/react-notifications';
28
28
  import _startsWithInstanceProperty from '@babel/runtime-corejs3/core-js-stable/instance/starts-with';
29
29
  import { createLogger } from 'redux-logger';
@@ -52,32 +52,25 @@ import _JSON$stringify from '@babel/runtime-corejs3/core-js-stable/json/stringif
52
52
  import { RetryLink } from '@apollo/client/link/retry';
53
53
 
54
54
  // NOTE: This string will be replaced on build time with the package version.
55
- var applicationShellVersion = "22.2.1";
55
+ var applicationShellVersion = "22.3.0";
56
56
 
57
57
  const isShowRequestInFlightAction = action => action.type === SHOW_LOADING;
58
-
59
58
  const isHideRequestInFlightAction = action => action.type === HIDE_LOADING;
60
-
61
59
  const excludeFirstOccurrence = (list, item) => {
62
60
  const index = _indexOfInstanceProperty(list).call(list, item);
63
-
64
61
  return [..._sliceInstanceProperty(list).call(list, 0, index), ..._sliceInstanceProperty(list).call(list, index + 1)];
65
62
  };
66
-
67
63
  var requestsInFlightReducer = ((requestsInFlight, action) => {
68
64
  if (!requestsInFlight || !action) return [];
69
65
  if (isShowRequestInFlightAction(action)) return [...requestsInFlight, action.payload];
70
-
71
66
  if (isHideRequestInFlightAction(action)) {
72
67
  // may only remove first occurence
73
68
  if (!_includesInstanceProperty(requestsInFlight).call(requestsInFlight, action.payload)) {
74
69
  reportErrorToSentry(new Error("Tried to hide \"".concat(action.payload, "\", but it was not progressing!")));
75
70
  return requestsInFlight;
76
71
  }
77
-
78
72
  return excludeFirstOccurrence(requestsInFlight, action.payload);
79
73
  }
80
-
81
74
  return requestsInFlight;
82
75
  });
83
76
 
@@ -85,27 +78,23 @@ const isAddNotificationErrorAction = action => {
85
78
  const errorAction = action;
86
79
  return errorAction.type === ADD_NOTIFICATION && errorAction.payload && (errorAction.payload.kind === NOTIFICATION_KINDS_PAGE['api-error'] || errorAction.payload.kind === NOTIFICATION_KINDS_PAGE['unexpected-error']);
87
80
  };
88
-
89
81
  const isHideAllNotificationsAction = action => action.type === HIDE_ALL_PAGE_NOTIFICATIONS;
90
-
91
82
  const hideNotificationsMiddleware = _ref => {
92
83
  let getState = _ref.getState;
93
84
  return next => action => {
94
85
  if (isHideAllNotificationsAction(action) || isAddNotificationErrorAction(action)) {
95
86
  var _context;
96
-
97
87
  const state = getState();
98
-
99
88
  _forEachInstanceProperty(_context = selectPageNotifications(state)).call(_context, notification => {
100
89
  next(removeNotification(notification.id));
101
90
  });
102
91
  }
103
-
104
92
  return next(action);
105
93
  };
106
94
  };
107
95
 
108
96
  /* eslint-disable no-console */
97
+
109
98
  const isLoggerEnabled = () => {
110
99
  if (process.env.DEBUG === 'true') return true;
111
100
  if (process.env.NODE_ENV === 'development') return true;
@@ -148,34 +137,33 @@ const loggerMiddleware = createLogger({
148
137
  predicate: (_getState, action) => {
149
138
  if (!action) return false;
150
139
  const type = action.type,
151
- payload = action.payload;
140
+ payload = action.payload;
152
141
  if (!type) return false;
153
142
  if (_startsWithInstanceProperty(type).call(type, 'SHOW_') || _startsWithInstanceProperty(type).call(type, 'HIDE_') || _startsWithInstanceProperty(type).call(type, 'APOLLO_')) return false;
154
-
155
143
  switch (type) {
156
144
  case REMOVE_NOTIFICATION:
157
145
  return false;
158
-
159
146
  case ADD_NOTIFICATION:
160
147
  {
161
148
  const ignoredKinds = ['api-error', 'unexpected-error'];
162
149
  return !_includesInstanceProperty(ignoredKinds).call(ignoredKinds, payload.kind);
163
150
  }
164
-
165
151
  default:
166
152
  return true;
167
153
  }
168
154
  }
169
155
  });
170
156
 
157
+ // Attempt to load the `teamId` from localStorage
171
158
  function selectTeamIdFromLocalStorage() {
172
159
  return window.localStorage.getItem(STORAGE_KEYS.ACTIVE_TEAM_ID) || undefined;
173
160
  }
174
161
 
175
- const staticUrlPathsInPositionOfProjectKey = ['login', 'logout', 'account']; // Attempt to extract the `:projectKey` from the URL.
162
+ const staticUrlPathsInPositionOfProjectKey = ['login', 'logout', 'account'];
163
+
164
+ // Attempt to extract the `:projectKey` from the URL.
176
165
  // If the value matches one of the values in the list above,
177
166
  // return `undefined` as we're not within a project context.
178
-
179
167
  function selectProjectKeyFromUrl() {
180
168
  let locationPath = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : window.location.pathname;
181
169
  const possibleProjectKey = locationPath.split('/')[1];
@@ -186,129 +174,102 @@ function selectProjectKeyFromUrl() {
186
174
  // by the application. This is useful to retrieve on runtime the reference
187
175
  // to the apollo client in other static modules.
188
176
  let cachedApolloClient;
189
-
190
177
  const setCachedApolloClient = apolloClient => {
191
178
  cachedApolloClient = apolloClient;
192
179
  };
193
-
194
180
  const getCachedApolloClient = () => cachedApolloClient;
195
181
 
196
182
  var FetchUserId = { kind: "Document", definitions: [{ kind: "OperationDefinition", operation: "query", name: { kind: "Name", value: "FetchUserId" }, variableDefinitions: [], directives: [], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", alias: { kind: "Name", value: "user" }, name: { kind: "Name", value: "me" }, arguments: [], directives: [], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "id" }, arguments: [], directives: [] }] } }] } }], loc: { start: 0, end: 46, source: { body: "query FetchUserId {\n user: me {\n id\n }\n}\n", name: "GraphQL request", locationOffset: { line: 1, column: 1 } } } };
197
183
  function selectUserId() {
198
184
  const apolloClient = getCachedApolloClient();
199
-
200
185
  if (!apolloClient) {
201
186
  return null;
202
187
  }
203
-
204
188
  try {
205
189
  const queryResult = apolloClient.readQuery({
206
190
  query: FetchUserId
207
191
  });
208
-
209
192
  if (queryResult && queryResult.user) {
210
193
  return queryResult.user.id;
211
194
  }
212
195
  } catch (e) {
213
196
  return null;
214
197
  }
215
-
216
198
  return null;
217
199
  }
218
200
 
219
201
  const VALID_ID_PART_FORMAT = /^[\w-/]+$/;
220
-
221
202
  const skipMalformedPart = part => part && VALID_ID_PART_FORMAT.test(part);
222
-
223
203
  function getCorrelationId() {
224
204
  var _context;
225
-
226
205
  let _ref = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
227
- userId = _ref.userId;
228
-
206
+ userId = _ref.userId;
229
207
  return _filterInstanceProperty(_context = ['mc', selectProjectKeyFromUrl(), userId, v4()]).call(_context, skipMalformedPart).join('/');
230
208
  }
231
209
 
232
210
  // NOTE: Copied from `@application-shell-connectors`.
233
211
  // TODO: Remove this version once the change in the connectors has been released.
212
+
234
213
  const mcHostnameRegex = /^mc(-(\d){4,})?\.(.*)$/;
235
214
  const mcPreviewHostnameRegex = /^.*\.mc-preview\.(.*)$/;
236
-
237
215
  const getMcOriginTld = host => {
238
216
  if (host.match(mcPreviewHostnameRegex)) {
239
217
  return host.replace(mcPreviewHostnameRegex, '$1');
240
218
  }
241
-
242
219
  return host.replace(mcHostnameRegex, '$3');
243
220
  };
244
-
245
221
  const getMcApiUrlFromOrigin = origin => {
246
222
  var _context;
247
-
248
223
  const url = new _URL(origin);
249
224
  const originTld = getMcOriginTld(url.host);
250
225
  return _concatInstanceProperty(_context = "".concat(url.protocol, "//mc-api.")).call(_context, originTld);
251
226
  };
252
-
253
227
  const parseAsBoolean = value => value === true || value === 'true';
254
-
255
228
  function getMcApiUrl() {
256
229
  let environment = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : window.app;
257
230
  let origin = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : window.origin;
258
231
  const isServedByProxy = parseAsBoolean(environment.servedByProxy);
232
+
259
233
  /**
260
234
  * Prefer using the origin URL for the MC API based on the origin value
261
235
  * of the browser's `window.location`.
262
236
  * This ensures that the application always uses the correct URL associated
263
237
  * with that environment, instead of relying on the config value.
264
238
  */
265
-
266
239
  if (isServedByProxy) {
267
240
  return getMcApiUrlFromOrigin(origin);
268
241
  }
269
-
270
242
  return environment.mcApiUrl;
271
243
  }
272
244
 
273
245
  const getSessionToken = () => window.sessionStorage.getItem(STORAGE_KEYS.SESSION_TOKEN);
274
-
275
246
  const setActiveSession = sessionToken => {
276
247
  if (!sessionToken) return;
277
248
  window.sessionStorage.setItem(STORAGE_KEYS.SESSION_TOKEN, sessionToken !== null && sessionToken !== void 0 ? sessionToken : '');
278
- window.localStorage.setItem(STORAGE_KEYS.LOGIN_STRATEGY, LOGIN_STRATEGY_OIDC); // Remove flag for original workflow
279
-
249
+ window.localStorage.setItem(STORAGE_KEYS.LOGIN_STRATEGY, LOGIN_STRATEGY_OIDC);
250
+ // Remove flag for original workflow
280
251
  window.localStorage.removeItem(STORAGE_KEYS.IS_AUTHENTICATED);
281
252
  };
282
-
283
253
  const clearSession = () => {
284
254
  window.sessionStorage.removeItem(STORAGE_KEYS.SESSION_TOKEN);
285
255
  window.sessionStorage.removeItem(STORAGE_KEYS.SESSION_SCOPE);
286
256
  window.sessionStorage.removeItem(STORAGE_KEYS.IS_AUTHENTICATED);
287
257
  };
288
-
289
258
  const getActiveProjectKey = () => window.localStorage.getItem(STORAGE_KEYS.ACTIVE_PROJECT_KEY);
290
-
291
259
  const removeActiveProjectKey = () => {
292
260
  window.localStorage.removeItem(STORAGE_KEYS.ACTIVE_PROJECT_KEY);
293
261
  };
294
-
295
262
  const setActiveProjectKey = projectKey => {
296
263
  window.localStorage.setItem(STORAGE_KEYS.ACTIVE_PROJECT_KEY, projectKey);
297
264
  };
298
-
299
265
  const getSessionScope = () => window.sessionStorage.getItem(STORAGE_KEYS.SESSION_SCOPE);
300
-
301
266
  const setSessionScope = scope => {
302
267
  window.sessionStorage.setItem(STORAGE_KEYS.SESSION_SCOPE, scope);
303
268
  };
304
-
305
269
  const getSessionState = stateId => {
306
270
  var _context;
307
-
308
271
  const sessionStateKey = _concatInstanceProperty(_context = "".concat(STORAGE_KEYS.NONCE, "_")).call(_context, stateId);
309
-
310
272
  const unparsedSessionState = window.sessionStorage.getItem(sessionStateKey);
311
-
312
273
  if (unparsedSessionState) {
313
274
  try {
314
275
  const parsedSessionState = JSON.parse(unparsedSessionState);
@@ -316,46 +277,34 @@ const getSessionState = stateId => {
316
277
  return parsedSessionState;
317
278
  } catch (error) {
318
279
  window.sessionStorage.removeItem(sessionStateKey);
319
-
320
280
  if (process.env.NODE_ENV !== 'production') {
321
281
  var _context2;
322
-
323
282
  // eslint-disable-next-line no-console
324
283
  console.warn(_concatInstanceProperty(_context2 = "Cannot parse session state for \"".concat(sessionStateKey, "\".\n")).call(_context2, unparsedSessionState));
325
284
  }
326
285
  }
327
286
  }
328
-
329
287
  return null;
330
288
  };
331
-
332
289
  const setSessionState = (stateId, state) => {
333
290
  var _context3;
334
-
335
291
  const sessionStateKey = _concatInstanceProperty(_context3 = "".concat(STORAGE_KEYS.NONCE, "_")).call(_context3, stateId);
336
-
337
292
  window.sessionStorage.setItem(sessionStateKey, _JSON$stringify(state));
338
293
  };
339
294
 
340
295
  function ownKeys$4(object, enumerableOnly) { var keys = _Object$keys(object); if (_Object$getOwnPropertySymbols) { var symbols = _Object$getOwnPropertySymbols(object); enumerableOnly && (symbols = _filterInstanceProperty(symbols).call(symbols, function (sym) { return _Object$getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
341
-
342
296
  function _objectSpread$4(target) { for (var i = 1; i < arguments.length; i++) { var _context2, _context3; var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? _forEachInstanceProperty(_context2 = ownKeys$4(Object(source), !0)).call(_context2, function (key) { _defineProperty(target, key, source[key]); }) : _Object$getOwnPropertyDescriptors ? _Object$defineProperties(target, _Object$getOwnPropertyDescriptors(source)) : _forEachInstanceProperty(_context3 = ownKeys$4(Object(source))).call(_context3, function (key) { _Object$defineProperty(target, key, _Object$getOwnPropertyDescriptor(source, key)); }); } return target; }
343
-
344
297
  const mergeObjectValues = object => {
345
298
  var _context;
346
-
347
299
  return _reduceInstanceProperty(_context = _Object$entries(object)).call(_context, (acc, _ref) => {
348
300
  let _ref2 = _slicedToArray(_ref, 2),
349
- value = _ref2[1];
350
-
301
+ value = _ref2[1];
351
302
  return _objectSpread$4(_objectSpread$4({}, acc), value);
352
303
  }, {});
353
304
  };
354
-
355
305
  const patchedGetCorrelationId = () => getCorrelationId({
356
306
  userId: selectUserId()
357
307
  });
358
-
359
308
  const getAdditionalHeaders = () => {
360
309
  const sessionToken = getSessionToken();
361
310
  return omitEmpty({
@@ -364,24 +313,21 @@ const getAdditionalHeaders = () => {
364
313
  [SUPPORTED_HEADERS.X_TEAM_ID]: selectTeamIdFromLocalStorage()
365
314
  });
366
315
  };
367
-
368
316
  const sdkMiddleware = createMiddleware({
369
317
  getCorrelationId: patchedGetCorrelationId,
370
318
  getProjectKey: selectProjectKeyFromUrl,
371
319
  getAdditionalHeaders
372
320
  });
321
+
373
322
  /**
374
323
  * @deprecated: This function should not be used directly anymore.
375
324
  */
376
-
377
325
  const applyDefaultMiddlewares = function () {
378
326
  for (var _len = arguments.length, middlewares = new Array(_len), _key = 0; _key < _len; _key++) {
379
327
  middlewares[_key] = arguments[_key];
380
328
  }
381
-
382
329
  return applyMiddleware(...middlewares, thunk, loggerMiddleware);
383
330
  };
384
-
385
331
  const createInternalReducer = function () {
386
332
  let injectedReducers = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
387
333
  let preloadedState = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
@@ -390,17 +336,18 @@ const createInternalReducer = function () {
390
336
  // notifications:
391
337
  // Unexpected key "new Key" found in preloadedState argument passed to createStore. Expected to find one of the known reducer keys instead: "requestsInFlight", "notifications". Unexpected keys will be ignored.
392
338
  // https://redux.js.org/api/createstore#createstorereducer-preloadedstate-enhancer
393
- const preloadedStateReducers = mapValues(preloadedState, value => () => value); // NOTE: since we don't know in advance which reducers will be injected,
394
- // we pass an `unknown` type to express this uncertainty and make the compiler happy.
339
+ const preloadedStateReducers = mapValues(preloadedState, value => () => value);
395
340
 
341
+ // NOTE: since we don't know in advance which reducers will be injected,
342
+ // we pass an `unknown` type to express this uncertainty and make the compiler happy.
396
343
  return combineReducers(_objectSpread$4(_objectSpread$4({
397
344
  requestsInFlight: requestsInFlightReducer,
398
345
  notifications: reducer
399
346
  }, injectedReducers), preloadedStateReducers));
400
- }; // We use a factory as it's more practicable for tests
401
- // The application can import the configured store (the default export)
402
-
347
+ };
403
348
 
349
+ // We use a factory as it's more practicable for tests
350
+ // The application can import the configured store (the default export)
404
351
  const createReduxStore = function () {
405
352
  let preloadedState = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
406
353
  let additionalMiddlewares = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];
@@ -421,90 +368,76 @@ const createReduxStore = function () {
421
368
  immutableCheck: false
422
369
  }), loggerMiddleware]
423
370
  });
424
- const enhancedStore = store; // Enable reducers to be injected on runtime (see `<InjectReducer>`)
371
+ const enhancedStore = store;
425
372
 
373
+ // Enable reducers to be injected on runtime (see `<InjectReducer>`)
426
374
  enhancedStore.injectedReducers = {};
427
-
428
375
  enhancedStore.injectReducers = _ref3 => {
429
376
  let id = _ref3.id,
430
- reducers = _ref3.reducers;
377
+ reducers = _ref3.reducers;
431
378
  const hasReducerBeenInjected = _Reflect$has(enhancedStore.injectedReducers, id) && enhancedStore.injectedReducers[id] === reducers;
432
-
433
379
  if (!hasReducerBeenInjected) {
434
380
  // Keep track of the reducer by id, so we can check if it's been injected aleady
435
- enhancedStore.injectedReducers[id] = reducers; // ...when we create the new reducer though, we spread the reducers from each namespace
436
-
381
+ enhancedStore.injectedReducers[id] = reducers;
382
+ // ...when we create the new reducer though, we spread the reducers from each namespace
437
383
  enhancedStore.replaceReducer(createInternalReducer(mergeObjectValues(enhancedStore.injectedReducers)));
438
384
  }
439
385
  };
440
-
441
386
  enhancedStore.removeReducers = _ref4 => {
442
387
  let id = _ref4.id;
443
388
  delete enhancedStore.injectedReducers[id];
444
389
  enhancedStore.replaceReducer(createInternalReducer(mergeObjectValues(enhancedStore.injectedReducers)));
445
390
  };
446
-
447
391
  return enhancedStore;
448
392
  };
449
393
  var internalReduxStore = createReduxStore();
450
394
 
451
- const RouteCatchAll = /*#__PURE__*/lazy(() => import('./route-catch-all-01cf0095.esm.js'
452
- /* webpackChunkName: "route-catch-all" */
453
- ));
395
+ const RouteCatchAll = /*#__PURE__*/lazy(() => import('./route-catch-all-4af77675.esm.js' /* webpackChunkName: "route-catch-all" */));
454
396
 
455
397
  function ownKeys$3(object, enumerableOnly) { var keys = _Object$keys(object); if (_Object$getOwnPropertySymbols) { var symbols = _Object$getOwnPropertySymbols(object); enumerableOnly && (symbols = _filterInstanceProperty(symbols).call(symbols, function (sym) { return _Object$getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
456
-
457
398
  function _objectSpread$3(target) { for (var i = 1; i < arguments.length; i++) { var _context2, _context3; var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? _forEachInstanceProperty(_context2 = ownKeys$3(Object(source), !0)).call(_context2, function (key) { _defineProperty(target, key, source[key]); }) : _Object$getOwnPropertyDescriptors ? _Object$defineProperties(target, _Object$getOwnPropertyDescriptors(source)) : _forEachInstanceProperty(_context3 = ownKeys$3(Object(source))).call(_context3, function (key) { _Object$defineProperty(target, key, _Object$getOwnPropertyDescriptor(source, key)); }); } return target; }
458
-
459
399
  const getSkipTokenRetry = context => {
460
400
  const skipTokenRetry = Boolean(context.skipTokenRetry);
461
401
  return skipTokenRetry;
462
402
  };
463
-
464
403
  const forwardTokenRetryHeader = headers => _objectSpread$3(_objectSpread$3({}, headers), {}, {
465
404
  [SUPPORTED_HEADERS.X_TOKEN_RETRY]: 'true'
466
- }); // This link retries requests to the CTP API that have been rejected
405
+ });
406
+
407
+ // This link retries requests to the CTP API that have been rejected
467
408
  // because of an invalid/expired oauth token.
468
409
  // To do so, we resend the request with the header "X-Force-Token: true"
469
410
  // so that the MC BE can issue a new token.
470
411
  // NOTE: the retry is not meant to work for the MC access token.
471
-
472
-
473
412
  const getDoesGraphQLTargetSupportTokenRetry = context => {
474
413
  var _context$headers, _context$headers2, _context;
475
-
476
414
  const graphQLTarget = ((_context$headers = context.headers) === null || _context$headers === void 0 ? void 0 : _context$headers[SUPPORTED_HEADERS.X_GRAPHQL_TARGET]) || ((_context$headers2 = context.headers) === null || _context$headers2 === void 0 ? void 0 : _context$headers2[SUPPORTED_HEADERS.X_GRAPHQL_TARGET.toLowerCase()]);
477
415
  return Boolean(graphQLTarget && _includesInstanceProperty(_context = [GRAPHQL_TARGETS.COMMERCETOOLS_PLATFORM, GRAPHQL_TARGETS.ADMINISTRATION_SERVICE, GRAPHQL_TARGETS.SETTINGS_SERVICE, GRAPHQL_TARGETS.MERCHANT_CENTER_BACKEND]).call(_context, graphQLTarget));
478
416
  };
479
-
480
417
  const isHttpError = error => error.statusCode !== undefined || error.statusCode !== undefined;
481
-
482
418
  const isGraphQLError = error => _Array$isArray(error) && _someInstanceProperty(error).call(error, err => err.message !== undefined || err.extensions !== undefined);
483
419
 
420
+ // Checks response from GraphQL in order to scan 401 errors and redirect the
484
421
  // user to the login page resetting the store and showing the proper message
485
-
486
422
  const errorLink = onError(_ref => {
487
423
  let graphQLErrors = _ref.graphQLErrors,
488
- networkError = _ref.networkError,
489
- operation = _ref.operation,
490
- forward = _ref.forward;
491
-
424
+ networkError = _ref.networkError,
425
+ operation = _ref.operation,
426
+ forward = _ref.forward;
492
427
  if (networkError && isHttpError(networkError) && networkError.statusCode === STATUS_CODES.UNAUTHORIZED) {
493
428
  history.push("/logout?reason=".concat(LOGOUT_REASONS.UNAUTHORIZED));
494
429
  return;
495
- } // In case of graphql errors, we want to retry unauthenticated requests by
430
+ }
431
+
432
+ // In case of graphql errors, we want to retry unauthenticated requests by
496
433
  // forcing our API to fetch a new token, using the `X-Force-Token` header.
497
434
  // https://www.apollographql.com/docs/link/links/error/#retrying-failed-requests
498
435
  // We need to do this as the `token-retry-link` only works for network errors.
499
436
  // https://www.apollographql.com/docs/link/links/retry/
500
-
501
-
502
437
  if (graphQLErrors && isGraphQLError(graphQLErrors)) {
503
438
  const context = operation.getContext();
504
-
505
439
  for (const err of graphQLErrors) {
506
440
  var _err$extensions;
507
-
508
441
  const isNonAuthenticatedViaExtensionCode = (err === null || err === void 0 ? void 0 : (_err$extensions = err.extensions) === null || _err$extensions === void 0 ? void 0 : _err$extensions.code) === 'UNAUTHENTICATED';
509
442
  /**
510
443
  * NOTE:
@@ -513,31 +446,25 @@ const errorLink = onError(_ref => {
513
446
  * property until they introduced support for the `extensions`
514
447
  * field.
515
448
  */
516
-
517
449
  const isNonAuthenticatedViaCode = (err === null || err === void 0 ? void 0 : err.message) === 'invalid_token';
518
-
519
450
  if ((isNonAuthenticatedViaExtensionCode || isNonAuthenticatedViaCode) && getDoesGraphQLTargetSupportTokenRetry(context) && !getSkipTokenRetry(context)) {
520
451
  operation.setContext(_ref2 => {
521
452
  let headers = _ref2.headers;
522
453
  return {
523
454
  headers: forwardTokenRetryHeader(headers)
524
455
  };
525
- }); // retry the request, returning the new observable
526
-
456
+ });
457
+ // retry the request, returning the new observable
527
458
  return forward(operation);
528
459
  }
529
460
  }
530
461
  }
531
-
532
462
  return;
533
463
  });
534
464
 
535
465
  function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = _Reflect$construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
536
-
537
466
  function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !_Reflect$construct) return false; if (_Reflect$construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(_Reflect$construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
538
-
539
467
  function ownKeys$2(object, enumerableOnly) { var keys = _Object$keys(object); if (_Object$getOwnPropertySymbols) { var symbols = _Object$getOwnPropertySymbols(object); enumerableOnly && (symbols = _filterInstanceProperty(symbols).call(symbols, function (sym) { return _Object$getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
540
-
541
468
  function _objectSpread$2(target) { for (var i = 1; i < arguments.length; i++) { var _context3, _context4; var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? _forEachInstanceProperty(_context3 = ownKeys$2(Object(source), !0)).call(_context3, function (key) { _defineProperty(target, key, source[key]); }) : _Object$getOwnPropertyDescriptors ? _Object$defineProperties(target, _Object$getOwnPropertyDescriptors(source)) : _forEachInstanceProperty(_context4 = ownKeys$2(Object(source))).call(_context4, function (key) { _Object$defineProperty(target, key, _Object$getOwnPropertyDescriptor(source, key)); }); } return target; }
542
469
  const defaultUserAgent = createHttpUserAgent({
543
470
  name: 'unknown-http-client',
@@ -545,36 +472,27 @@ const defaultUserAgent = createHttpUserAgent({
545
472
  });
546
473
  const defaultForwardToVersion = 'v2';
547
474
  const defaultForwardToAudiencePolicy = 'forward-url-full-path';
548
-
549
475
  function buildApiUrl(endpoint) {
550
476
  var _context;
551
-
552
477
  const apiUrl = getMcApiUrl().replace(/\/$/, '');
553
478
  return _concatInstanceProperty(_context = "".concat(apiUrl)).call(_context, endpoint);
554
479
  }
555
-
556
480
  const getAppliedForwardToHeaders = forwardToConfig => {
557
481
  var _context2, _forwardToConfig$head, _forwardToConfig$vers, _forwardToConfig$audi;
558
-
559
482
  if (!forwardToConfig) {
560
483
  return {};
561
484
  }
562
-
563
485
  if (!forwardToConfig.uri) {
564
486
  throw new Error("Missing required \"uri\" option.");
565
487
  }
566
-
567
488
  const exchangeTokenClaims = [];
568
-
569
489
  if (forwardToConfig.includeUserPermissions) {
570
490
  exchangeTokenClaims.push('permissions');
571
491
  }
572
-
573
492
  return _objectSpread$2(_objectSpread$2({}, _reduceInstanceProperty(_context2 = _Object$entries((_forwardToConfig$head = forwardToConfig.headers) !== null && _forwardToConfig$head !== void 0 ? _forwardToConfig$head : {})).call(_context2, (customForwardHeaders, _ref) => {
574
493
  let _ref2 = _slicedToArray(_ref, 2),
575
- headerName = _ref2[0],
576
- headerValue = _ref2[1];
577
-
494
+ headerName = _ref2[0],
495
+ headerValue = _ref2[1];
578
496
  return _objectSpread$2(_objectSpread$2({}, customForwardHeaders), {}, {
579
497
  // Prefix headers so that the MC API can allow and forward them.
580
498
  ["x-forward-header-".concat(headerName)]: headerValue
@@ -586,10 +504,8 @@ const getAppliedForwardToHeaders = forwardToConfig => {
586
504
  [SUPPORTED_HEADERS.X_FORWARD_TO_CLAIMS]: exchangeTokenClaims.join(' ')
587
505
  });
588
506
  };
589
-
590
507
  function createHttpClientOptions() {
591
508
  var _config$projectKey;
592
-
593
509
  let config = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
594
510
  const sessionToken = getSessionToken();
595
511
  const projectKey = (_config$projectKey = config.projectKey) !== null && _config$projectKey !== void 0 ? _config$projectKey : selectProjectKeyFromUrl();
@@ -610,37 +526,26 @@ function createHttpClientOptions() {
610
526
  }, getAppliedForwardToHeaders(config.forwardToConfig)))
611
527
  };
612
528
  }
613
-
614
529
  let RenewTokenError = /*#__PURE__*/function (_Error) {
615
530
  _inherits(RenewTokenError, _Error);
616
-
617
531
  var _super = _createSuper(RenewTokenError);
618
-
619
532
  function RenewTokenError(message) {
620
533
  var _this;
621
-
622
534
  _classCallCheck(this, RenewTokenError);
623
-
624
535
  _this = _super.call(this, message);
625
-
626
536
  _Object$defineProperty(_assertThisInitialized(_this), 'name', {
627
537
  value: 'RenewTokenError'
628
538
  });
629
-
630
539
  return _this;
631
540
  }
632
-
633
541
  return _createClass(RenewTokenError);
634
542
  }( /*#__PURE__*/_wrapNativeSuper(Error));
635
-
636
543
  async function executeHttpClientRequest(fetcher) {
637
544
  let config = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
638
-
639
545
  // Wrapper function to be called again (once) on retry.
640
546
  async function sendRequest() {
641
547
  let _ref3 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
642
- shouldRenewToken = _ref3.shouldRenewToken;
643
-
548
+ shouldRenewToken = _ref3.shouldRenewToken;
644
549
  const requestOptions = createHttpClientOptions(config);
645
550
  const response = await fetcher(_objectSpread$2(_objectSpread$2({}, requestOptions), {}, {
646
551
  headers: omitEmpty(_objectSpread$2(_objectSpread$2({}, requestOptions.headers), {}, {
@@ -648,22 +553,19 @@ async function executeHttpClientRequest(fetcher) {
648
553
  [SUPPORTED_HEADERS.X_TOKEN_RETRY]: shouldRenewToken
649
554
  }))
650
555
  }));
651
-
652
556
  if (response.statusCode === STATUS_CODES.UNAUTHORIZED) {
653
557
  throw new RenewTokenError("Unauthorized response, attempting retry.");
654
- } // In case a new session token is returned from the server, save it.
655
-
558
+ }
656
559
 
560
+ // In case a new session token is returned from the server, save it.
657
561
  const refreshedSessionToken = response.getHeader('x-refreshed-session-token');
658
-
659
562
  if (refreshedSessionToken) {
660
563
  setActiveSession(refreshedSessionToken);
661
564
  }
662
-
663
565
  return response.data;
664
- } // Attempt to send the request.
665
-
566
+ }
666
567
 
568
+ // Attempt to send the request.
667
569
  return sendRequest().catch(error => {
668
570
  if (error instanceof RenewTokenError) {
669
571
  // Retry the request and ask to renew the token.
@@ -671,13 +573,11 @@ async function executeHttpClientRequest(fetcher) {
671
573
  shouldRenewToken: true
672
574
  });
673
575
  }
674
-
675
576
  throw error;
676
577
  });
677
578
  }
678
579
 
679
580
  function ownKeys$1(object, enumerableOnly) { var keys = _Object$keys(object); if (_Object$getOwnPropertySymbols) { var symbols = _Object$getOwnPropertySymbols(object); enumerableOnly && (symbols = _filterInstanceProperty(symbols).call(symbols, function (sym) { return _Object$getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
680
-
681
581
  function _objectSpread$1(target) { for (var i = 1; i < arguments.length; i++) { var _context4, _context5; var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? _forEachInstanceProperty(_context4 = ownKeys$1(Object(source), !0)).call(_context4, function (key) { _defineProperty(target, key, source[key]); }) : _Object$getOwnPropertyDescriptors ? _Object$defineProperties(target, _Object$getOwnPropertyDescriptors(source)) : _forEachInstanceProperty(_context5 = ownKeys$1(Object(source))).call(_context5, function (key) { _Object$defineProperty(target, key, _Object$getOwnPropertyDescriptor(source, key)); }); } return target; }
682
582
  const userAgent = createHttpUserAgent({
683
583
  name: 'apollo-client',
@@ -688,47 +588,36 @@ const userAgent = createHttpUserAgent({
688
588
  // points to the appkit repo issues
689
589
  contactEmail: 'support@commercetools.com'
690
590
  });
691
-
692
591
  const isKnownGraphQlTarget = target => {
693
592
  var _context;
694
-
695
593
  return target ? _includesInstanceProperty(_context = _Object$values(GRAPHQL_TARGETS)).call(_context, target) : false;
696
594
  };
697
-
698
595
  const extractSessionTokenFromResponse = context => {
699
596
  var _context$response, _context$response$hea, _context$restResponse;
700
-
701
597
  const refreshedSessionToken = (_context$response = context.response) === null || _context$response === void 0 ? void 0 : (_context$response$hea = _context$response.headers) === null || _context$response$hea === void 0 ? void 0 : _context$response$hea.get('x-refreshed-session-token');
702
-
703
598
  if (refreshedSessionToken) {
704
599
  return refreshedSessionToken !== null && refreshedSessionToken !== void 0 ? refreshedSessionToken : null;
705
600
  }
706
-
707
601
  const restResponseWithRefreshTokenHeader = (_context$restResponse = context.restResponses) === null || _context$restResponse === void 0 ? void 0 : _findInstanceProperty(_context$restResponse).call(_context$restResponse, response => {
708
602
  var _response$headers;
709
-
710
603
  return (_response$headers = response.headers) === null || _response$headers === void 0 ? void 0 : _response$headers.has('x-refreshed-session-token');
711
604
  });
712
-
713
605
  if (restResponseWithRefreshTokenHeader) {
714
606
  var _restResponseWithRefr;
715
-
716
607
  return (_restResponseWithRefr = restResponseWithRefreshTokenHeader.headers.get('x-refreshed-session-token')) !== null && _restResponseWithRefr !== void 0 ? _restResponseWithRefr : null;
717
608
  }
718
-
719
609
  return null;
720
610
  };
611
+
721
612
  /* eslint-disable import/prefer-default-export */
722
613
  // Use a middleware to update the request headers with the correct params.
723
-
724
-
725
614
  const headerLink = new ApolloLink((operation, forward) => {
726
615
  var _context2, _context3;
727
-
728
616
  const apolloContext = operation.getContext();
729
617
  const variables = operation.variables;
730
618
  const graphQlTarget = apolloContext.target || variables.target;
731
619
  if (!apolloContext.skipGraphQlTargetCheck && !isKnownGraphQlTarget(graphQlTarget)) throw new Error(_concatInstanceProperty(_context2 = "GraphQL target \"".concat(graphQlTarget, "\" is missing (or is not supported) in operation \"")).call(_context2, operation.operationName, "\""));
620
+
732
621
  /**
733
622
  * NOTE:
734
623
  * The project key is read from the url in a project related application context.
@@ -737,7 +626,6 @@ const headerLink = new ApolloLink((operation, forward) => {
737
626
  * As a result we allow passing the project key as a variable on the operation allowing
738
627
  * it to be the fallback.
739
628
  */
740
-
741
629
  const projectKey = apolloContext.projectKey || variables.projectKey || selectProjectKeyFromUrl();
742
630
  const teamId = apolloContext.teamId || variables.teamId || selectTeamIdFromLocalStorage();
743
631
  const featureFlag = apolloContext.featureFlag || variables.featureFlag;
@@ -758,11 +646,9 @@ const headerLink = new ApolloLink((operation, forward) => {
758
646
  return _mapInstanceProperty(_context3 = forward(operation)).call(_context3, response => {
759
647
  const context = operation.getContext();
760
648
  const refreshedSessionToken = extractSessionTokenFromResponse(context);
761
-
762
649
  if (refreshedSessionToken) {
763
650
  setActiveSession(refreshedSessionToken);
764
651
  }
765
-
766
652
  return response;
767
653
  });
768
654
  });
@@ -770,7 +656,6 @@ const headerLink = new ApolloLink((operation, forward) => {
770
656
  const tokenRetryLink = new RetryLink({
771
657
  attempts: (count, operation, error) => {
772
658
  const context = operation.getContext();
773
-
774
659
  if ((error === null || error === void 0 ? void 0 : error.statusCode) === STATUS_CODES.UNAUTHORIZED && count === 1 && getDoesGraphQLTargetSupportTokenRetry(context) && !getSkipTokenRetry(context)) {
775
660
  operation.setContext(_ref => {
776
661
  let headers = _ref.headers;
@@ -780,65 +665,61 @@ const tokenRetryLink = new RetryLink({
780
665
  });
781
666
  return true;
782
667
  }
783
-
784
668
  return false;
785
669
  }
786
670
  });
787
671
 
788
672
  function ownKeys(object, enumerableOnly) { var keys = _Object$keys(object); if (_Object$getOwnPropertySymbols) { var symbols = _Object$getOwnPropertySymbols(object); enumerableOnly && (symbols = _filterInstanceProperty(symbols).call(symbols, function (sym) { return _Object$getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
789
-
790
673
  function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var _context, _context2; var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? _forEachInstanceProperty(_context = ownKeys(Object(source), !0)).call(_context, function (key) { _defineProperty(target, key, source[key]); }) : _Object$getOwnPropertyDescriptors ? _Object$defineProperties(target, _Object$getOwnPropertyDescriptors(source)) : _forEachInstanceProperty(_context2 = ownKeys(Object(source))).call(_context2, function (key) { _Object$defineProperty(target, key, _Object$getOwnPropertyDescriptor(source, key)); }); } return target; }
791
674
  const httpLink = createHttpLink({
792
675
  uri: "".concat(getMcApiUrl(), "/graphql"),
793
676
  fetch
794
677
  });
795
-
796
678
  const createApolloLink = function () {
797
679
  let options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
798
- return (// The order of links is IMPORTANT!
680
+ return (
681
+ // The order of links is IMPORTANT!
799
682
  // In the request-phase they are executed top to bottom.
800
683
  // In the response/phase they are executed bottom to top.
801
684
  // The `httpLink` is terminating so it must be last, while `tokenRetryLink` and `errorLink`
802
685
  // wrap the links the their right.
803
- from([headerLink, // See https://www.apollographql.com/docs/react/api/link/apollo-link-rest/#link-order
686
+ from([headerLink,
687
+ // See https://www.apollographql.com/docs/react/api/link/apollo-link-rest/#link-order
804
688
  // State & context links should happen before (to the left of) `restLink`.
805
- ...(options.restLink ? [options.restLink] : []), // Must be before `tokenRetryLink`.
806
- errorLink, // Avoid logging queries in test environment
807
- ...(isLoggerEnabled() ? [loggerLink] : []), // Must be after `errorLink`.
808
- tokenRetryLink, // Must be last.
689
+ ...(options.restLink ? [options.restLink] : []),
690
+ // Must be before `tokenRetryLink`.
691
+ errorLink,
692
+ // Avoid logging queries in test environment
693
+ ...(isLoggerEnabled() ? [loggerLink] : []),
694
+ // Must be after `errorLink`.
695
+ tokenRetryLink,
696
+ // Must be last.
809
697
  httpLink])
810
698
  );
811
- }; // This custom merge function allows to merge two arrays of objects.
699
+ };
700
+
701
+ // This custom merge function allows to merge two arrays of objects.
812
702
  // The incoming list is what we need to update to, but we still need
813
703
  // to ensure that existing cache elements are not removed but updated.
814
704
  // This is usually the case when elements get removed.
815
-
816
-
817
705
  const mergeArraysObjects = function () {
818
706
  let existing = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
819
707
  let incoming = arguments.length > 1 ? arguments[1] : undefined;
820
-
821
708
  let _ref = arguments.length > 2 ? arguments[2] : undefined,
822
- mergeObjects = _ref.mergeObjects;
823
-
709
+ mergeObjects = _ref.mergeObjects;
824
710
  return _reduceInstanceProperty(incoming).call(incoming, (mergedElements, elem) => {
825
711
  const existingElem = _findInstanceProperty(existing).call(existing, el => el.__ref === elem.__ref);
826
-
827
712
  if (existingElem) {
828
713
  const updatedElem = mergeObjects(existingElem, elem);
829
-
830
714
  if (updatedElem) {
831
715
  return [...mergedElements, updatedElem];
832
716
  }
833
717
  }
834
-
835
718
  return [...mergedElements, elem];
836
719
  }, []);
837
720
  };
838
-
839
721
  const createApolloClient = function () {
840
722
  var _options$cache, _customCacheConfig$ty;
841
-
842
723
  let options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
843
724
  const customCacheConfig = (_options$cache = options === null || options === void 0 ? void 0 : options.cache) !== null && _options$cache !== void 0 ? _options$cache : {};
844
725
  return new ApolloClient({