@cshah18/sdk 3.0.3 → 3.0.4
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/cobuy-sdk.esm.js
CHANGED
|
@@ -2633,6 +2633,7 @@ class WidgetRoot {
|
|
|
2633
2633
|
}
|
|
2634
2634
|
/** Fetch latest group data and re-render containers */
|
|
2635
2635
|
async refreshGroupDataFromRealtime() {
|
|
2636
|
+
console.log("request group data realtime callledddd");
|
|
2636
2637
|
// Debounce rapid refreshes to prevent loops and reduce API load
|
|
2637
2638
|
const now = Date.now();
|
|
2638
2639
|
if (now - this.lastGroupDataRefreshTime < this.GROUP_REFRESH_DEBOUNCE) {
|
|
@@ -3047,6 +3048,7 @@ class WidgetRoot {
|
|
|
3047
3048
|
let groupData = null;
|
|
3048
3049
|
if (this.apiClient) {
|
|
3049
3050
|
rewardData = await this.fetchRewardWithRetry(options.productId);
|
|
3051
|
+
console.log("from renderrrr");
|
|
3050
3052
|
groupData = await this.fetchPrimaryGroup(options.productId);
|
|
3051
3053
|
this.currentGroupData = groupData;
|
|
3052
3054
|
this.currentGroupId = (groupData === null || groupData === void 0 ? void 0 : groupData.id) || null;
|
|
@@ -3303,6 +3305,7 @@ class WidgetRoot {
|
|
|
3303
3305
|
*/
|
|
3304
3306
|
async fetchPrimaryGroup(productId) {
|
|
3305
3307
|
var _a;
|
|
3308
|
+
console.log("fetch primary group called");
|
|
3306
3309
|
if (!this.apiClient) {
|
|
3307
3310
|
return null;
|
|
3308
3311
|
}
|
|
@@ -8948,7 +8951,9 @@ class CoBuy {
|
|
|
8948
8951
|
const ref = window.localStorage.getItem(key);
|
|
8949
8952
|
if (ref) {
|
|
8950
8953
|
this.logger.debug(`[SDK] Retrieved checkout reference via prefix: ${key}`);
|
|
8951
|
-
const parsedGroupId = key.startsWith(`${basePrefix}_`)
|
|
8954
|
+
const parsedGroupId = key.startsWith(`${basePrefix}_`)
|
|
8955
|
+
? key.substring(basePrefix.length + 1)
|
|
8956
|
+
: null;
|
|
8952
8957
|
return { key, checkoutRef: ref, groupId: parsedGroupId };
|
|
8953
8958
|
}
|
|
8954
8959
|
}
|
|
@@ -9369,6 +9374,7 @@ class CoBuy {
|
|
|
9369
9374
|
const pid = typeof w.getProductId === "function" ? w.getProductId() : null;
|
|
9370
9375
|
if (!productId || pid === productId) {
|
|
9371
9376
|
if (typeof w.requestRefresh === "function") {
|
|
9377
|
+
console.log("calling refresshh now");
|
|
9372
9378
|
refreshPromises.push(w.requestRefresh());
|
|
9373
9379
|
}
|
|
9374
9380
|
}
|