@fluid-app/portal-sdk 0.1.408 → 0.1.409

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 (28) hide show
  1. package/dist/AppNavigationContext-C8hrkgZR.d.cts.map +1 -1
  2. package/dist/AppNavigationContext-gM2x-_-D.d.mts.map +1 -1
  3. package/dist/{ShopScreen-DF-YZyBb.mjs → ShopScreen-9pVH8u36.mjs} +16 -27
  4. package/dist/{ShopScreen-DF-YZyBb.mjs.map → ShopScreen-9pVH8u36.mjs.map} +1 -1
  5. package/dist/{ShopScreen-BeC9CZQ2.mjs → ShopScreen-BZACSUxF.mjs} +1 -1
  6. package/dist/{ShopScreen-BH2kMhqj.cjs → ShopScreen-BxSNF5nS.cjs} +1 -1
  7. package/dist/{ShopScreen-BMRdOZeL.cjs → ShopScreen-Cvd1M9TI.cjs} +16 -27
  8. package/dist/{ShopScreen-BMRdOZeL.cjs.map → ShopScreen-Cvd1M9TI.cjs.map} +1 -1
  9. package/dist/hooks/use-company-switch.d.ts.map +1 -1
  10. package/dist/hooks/use-logout.d.ts.map +1 -1
  11. package/dist/index.cjs +4 -4
  12. package/dist/index.d.cts.map +1 -1
  13. package/dist/index.d.mts.map +1 -1
  14. package/dist/index.mjs +4 -4
  15. package/dist/preview/preview-entry.cjs +1 -1
  16. package/dist/preview/preview-entry.mjs +1 -1
  17. package/dist/screens/ShopScreen.d.ts.map +1 -1
  18. package/dist/utils/__tests__/reset-fairshare-sdk.test.d.ts +2 -0
  19. package/dist/utils/__tests__/reset-fairshare-sdk.test.d.ts.map +1 -0
  20. package/dist/utils/reset-fairshare-sdk.d.ts +17 -0
  21. package/dist/utils/reset-fairshare-sdk.d.ts.map +1 -0
  22. package/dist/{widget-package-utils-CKxRuMPy.cjs → widget-package-utils-BM0uHqDS.cjs} +55 -1
  23. package/dist/widget-package-utils-BM0uHqDS.cjs.map +1 -0
  24. package/dist/{widget-package-utils-6S6SWhUM.mjs → widget-package-utils-Bay8iu7A.mjs} +55 -1
  25. package/dist/widget-package-utils-Bay8iu7A.mjs.map +1 -0
  26. package/package.json +9 -9
  27. package/dist/widget-package-utils-6S6SWhUM.mjs.map +0 -1
  28. package/dist/widget-package-utils-CKxRuMPy.cjs.map +0 -1
@@ -52,5 +52,5 @@ import "./ShopWidget-DHt7mIbw.mjs";
52
52
  import "./translation-adapter-CxA_PHry.mjs";
53
53
  import "./translation-adapter-AUVlDFgQ.mjs";
54
54
  import "./ScreenHeaderContext-BR9cGisQ.mjs";
55
- import { r as shopScreenPropertySchema, t as ShopScreen } from "./ShopScreen-DF-YZyBb.mjs";
55
+ import { r as shopScreenPropertySchema, t as ShopScreen } from "./ShopScreen-9pVH8u36.mjs";
56
56
  export { ShopScreen, shopScreenPropertySchema };
@@ -53,6 +53,6 @@ require("./ShopWidget-syBHBQ-q.cjs");
53
53
  require("./translation-adapter-D2la7T-e.cjs");
54
54
  require("./translation-adapter-Bi9lcWv1.cjs");
55
55
  require("./ScreenHeaderContext-NGY43GoF.cjs");
56
- const require_ShopScreen = require("./ShopScreen-BMRdOZeL.cjs");
56
+ const require_ShopScreen = require("./ShopScreen-Cvd1M9TI.cjs");
57
57
  exports.ShopScreen = require_ShopScreen.ShopScreen;
58
58
  exports.shopScreenPropertySchema = require_ShopScreen.shopScreenPropertySchema;
@@ -1633,37 +1633,26 @@ function ShopScreenContent({ background, textColor, accentColor, padding, border
1633
1633
  const { config } = require_FluidProvider.useFluidContext();
1634
1634
  const { t } = require_FluidProvider.useShopTranslation();
1635
1635
  const { data: store } = require_use_store.useStore();
1636
- const { data: account, isPending: accountPending, refetch: refetchAccount } = require_use_account.useAccount();
1636
+ const { data: account, isPending: accountPending } = require_use_account.useAccount();
1637
1637
  const client = require_query_keys.usePortalTenantClient();
1638
1638
  const { currentSlug, navigate } = require_AppNavigationContext.useAppNavigation();
1639
1639
  const handleCheckout = (0, react.useCallback)(async (checkoutUrl) => {
1640
- let member = account;
1641
- if (!member) try {
1642
- member = (await refetchAccount()).data;
1643
- } catch {
1644
- member = void 0;
1645
- }
1646
- if (member?.member_type === "rep") {
1647
- const token = parseCartToken(checkoutUrl);
1648
- if (token) {
1649
- let timeoutId;
1650
- try {
1651
- await Promise.race([require_translation_adapter.carts_claim(client, token), new Promise((_, reject) => {
1652
- timeoutId = setTimeout(() => reject(/* @__PURE__ */ new Error("cart claim timed out")), CART_CLAIM_TIMEOUT_MS);
1653
- })]);
1654
- } catch (error) {
1655
- console.error("Failed to claim cart as buyer_rep:", error);
1656
- } finally {
1657
- if (timeoutId) clearTimeout(timeoutId);
1658
- }
1640
+ const token = parseCartToken(checkoutUrl);
1641
+ let destination = checkoutUrl;
1642
+ if (token) {
1643
+ let timeoutId;
1644
+ try {
1645
+ destination = (await Promise.race([require_translation_adapter.carts_claim(client, token), new Promise((_, reject) => {
1646
+ timeoutId = setTimeout(() => reject(/* @__PURE__ */ new Error("cart claim timed out")), CART_CLAIM_TIMEOUT_MS);
1647
+ })]))?.checkout_url ?? checkoutUrl;
1648
+ } catch (error) {
1649
+ console.error("Failed to claim cart:", error);
1650
+ } finally {
1651
+ if (timeoutId) clearTimeout(timeoutId);
1659
1652
  }
1660
1653
  }
1661
- window.location.assign(checkoutUrl);
1662
- }, [
1663
- account,
1664
- client,
1665
- refetchAccount
1666
- ]);
1654
+ window.location.assign(destination);
1655
+ }, [client]);
1667
1656
  const countryCode = config.countryIso ?? "US";
1668
1657
  const subdomain = store?.subdomain;
1669
1658
  const productId = currentSlug.split("/")[1] ?? null;
@@ -1763,4 +1752,4 @@ Object.defineProperty(exports, "shopScreenPropertySchema", {
1763
1752
  }
1764
1753
  });
1765
1754
 
1766
- //# sourceMappingURL=ShopScreen-BMRdOZeL.cjs.map
1755
+ //# sourceMappingURL=ShopScreen-Cvd1M9TI.cjs.map