@iblai/web-utils 1.6.5 → 1.6.6

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.
package/dist/index.js CHANGED
@@ -442,6 +442,14 @@ const BASE_CONFIG = {
442
442
  description: "Default mentor to open on the platform",
443
443
  type: "string",
444
444
  },
445
+ /* {
446
+ slug: "monetization_base_path",
447
+ label: "Public Monetization Base Path",
448
+ defaultValue: "https://ibl.ai/buy/",
449
+ description:
450
+ "Base URL for public paywall product pages. The product unique ID will be appended to this path.",
451
+ type: "string",
452
+ }, */
445
453
  ],
446
454
  };
447
455
  // SkillsAI platform configuration
@@ -2882,6 +2890,12 @@ async function validateJwtToken(storageService) {
2882
2890
  if (!edxJwtToken || !userData) {
2883
2891
  return false;
2884
2892
  }
2893
+ // Skip JWT validation if token is not in JWT format (e.g. opaque LTI tokens)
2894
+ const parts = edxJwtToken.split(".");
2895
+ if (parts.length !== 3) {
2896
+ console.warn("[AuthProvider] Token is not a valid JWT format, skipping validation");
2897
+ return false;
2898
+ }
2885
2899
  const decodedToken = jwtDecode(edxJwtToken);
2886
2900
  const userDataObj = JSON.parse(userData);
2887
2901
  // Compare user_id from token with user_id from user_data
@@ -15583,6 +15597,15 @@ createApi({
15583
15597
  }),
15584
15598
  invalidatesTags: ['paywallConfig', 'paywalls'],
15585
15599
  }),
15600
+ updatePaywall: builder.mutation({
15601
+ query: ({ platform_key, item_type, item_id, ...body }) => ({
15602
+ url: MONETIZATION_ENDPOINTS.PAYWALL_CONFIG.path(platform_key, item_type, item_id),
15603
+ service: MONETIZATION_ENDPOINTS.PAYWALL_CONFIG.service,
15604
+ method: 'PUT',
15605
+ body: JSON.stringify(body),
15606
+ }),
15607
+ invalidatesTags: ['paywallConfig', 'paywalls'],
15608
+ }),
15586
15609
  disablePaywall: builder.mutation({
15587
15610
  query: ({ platform_key, item_type, item_id }) => ({
15588
15611
  url: MONETIZATION_ENDPOINTS.PAYWALL_CONFIG.path(platform_key, item_type, item_id),
@@ -15642,6 +15665,9 @@ createApi({
15642
15665
  url: MONETIZATION_ENDPOINTS.ACCESS_CHECK.path(platform_key, item_type, item_id),
15643
15666
  service: MONETIZATION_ENDPOINTS.ACCESS_CHECK.service,
15644
15667
  method: 'GET',
15668
+ // Treat paywall-related 4xx (e.g. 402 Payment Required) as success so the
15669
+ // response body (has_access, pricing, reason, …) reaches the caller as `data`.
15670
+ validateStatus: (response) => response.ok || [402].includes(response.status),
15645
15671
  }),
15646
15672
  providesTags: ['accessCheck'],
15647
15673
  }),