@inappstory/slide-api 0.1.50 → 0.1.51
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.cjs +146 -22
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +5 -0
- package/dist/index.d.ts +5 -0
- package/dist/index.js +146 -22
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -489,6 +489,8 @@ declare class WidgetProducts extends WidgetBase<WidgetProductsOptions> {
|
|
|
489
489
|
closeProductsView(): void;
|
|
490
490
|
private createCardView;
|
|
491
491
|
private showProductDetails;
|
|
492
|
+
private statEventGoToCart;
|
|
493
|
+
private statEventAddToCart;
|
|
492
494
|
private createScrollView;
|
|
493
495
|
private createProductsView;
|
|
494
496
|
private scrollViewRef;
|
|
@@ -565,6 +567,9 @@ declare class WidgetProductCarousel extends WidgetBase<WidgetProductCarouselOpti
|
|
|
565
567
|
private addToCart;
|
|
566
568
|
private getBottomSheetParams;
|
|
567
569
|
private statEventWidgetCardClick;
|
|
570
|
+
private statEventClickPurchaseButton;
|
|
571
|
+
private statEventAddToCart;
|
|
572
|
+
private statEventGoToCart;
|
|
568
573
|
private isCartSupported;
|
|
569
574
|
private disableHostUIInteraction;
|
|
570
575
|
private enableHostUIInteraction;
|
package/dist/index.d.ts
CHANGED
|
@@ -489,6 +489,8 @@ declare class WidgetProducts extends WidgetBase<WidgetProductsOptions> {
|
|
|
489
489
|
closeProductsView(): void;
|
|
490
490
|
private createCardView;
|
|
491
491
|
private showProductDetails;
|
|
492
|
+
private statEventGoToCart;
|
|
493
|
+
private statEventAddToCart;
|
|
492
494
|
private createScrollView;
|
|
493
495
|
private createProductsView;
|
|
494
496
|
private scrollViewRef;
|
|
@@ -565,6 +567,9 @@ declare class WidgetProductCarousel extends WidgetBase<WidgetProductCarouselOpti
|
|
|
565
567
|
private addToCart;
|
|
566
568
|
private getBottomSheetParams;
|
|
567
569
|
private statEventWidgetCardClick;
|
|
570
|
+
private statEventClickPurchaseButton;
|
|
571
|
+
private statEventAddToCart;
|
|
572
|
+
private statEventGoToCart;
|
|
568
573
|
private isCartSupported;
|
|
569
574
|
private disableHostUIInteraction;
|
|
570
575
|
private enableHostUIInteraction;
|
package/dist/index.js
CHANGED
|
@@ -5894,7 +5894,7 @@ let SlideApi$1 = class SlideApi {
|
|
|
5894
5894
|
handled = true;
|
|
5895
5895
|
}
|
|
5896
5896
|
}
|
|
5897
|
-
if (handled) {
|
|
5897
|
+
if (handled && linkType !== "products") {
|
|
5898
5898
|
try {
|
|
5899
5899
|
const cardId = this.slide.cardId;
|
|
5900
5900
|
const cardType = this.slide.cardType;
|
|
@@ -20939,11 +20939,12 @@ class ProductComponentsFactory {
|
|
|
20939
20939
|
},
|
|
20940
20940
|
});
|
|
20941
20941
|
}
|
|
20942
|
-
createProductCheckout(bottomSheet) {
|
|
20942
|
+
createProductCheckout(bottomSheet, params) {
|
|
20943
20943
|
return new ProductCheckout({
|
|
20944
20944
|
onClose: () => bottomSheet.close(),
|
|
20945
20945
|
onCheckout: () => {
|
|
20946
20946
|
this.widgetDeps.slideApiDeps.productCartClicked();
|
|
20947
|
+
params.onCheckout();
|
|
20947
20948
|
},
|
|
20948
20949
|
translations: this.props.translations,
|
|
20949
20950
|
});
|
|
@@ -20986,9 +20987,9 @@ class ProductOfferMapper {
|
|
|
20986
20987
|
oldPrice: offerDto.oldPrice,
|
|
20987
20988
|
currency: offerDto.currency,
|
|
20988
20989
|
description: offerDto.description,
|
|
20989
|
-
imageUrls: offerDto.
|
|
20990
|
+
imageUrls: offerDto.blobImages?.map(image => image.url) ?? [],
|
|
20990
20991
|
adult: offerDto.adult,
|
|
20991
|
-
coverUrl: offerDto.
|
|
20992
|
+
coverUrl: offerDto.blobCoverUrl,
|
|
20992
20993
|
groupId: offerDto.groupId,
|
|
20993
20994
|
url: offerDto.url,
|
|
20994
20995
|
};
|
|
@@ -21054,6 +21055,7 @@ class ProductDetailsBottomSheet extends RenderableComponent {
|
|
|
21054
21055
|
quantity: payload.quantity,
|
|
21055
21056
|
});
|
|
21056
21057
|
this.showProductCheckout();
|
|
21058
|
+
this.props.onAddToCart({ offer, quantity: payload.quantity });
|
|
21057
21059
|
},
|
|
21058
21060
|
isCartSupported,
|
|
21059
21061
|
isCartQuantityEnabled,
|
|
@@ -21061,7 +21063,9 @@ class ProductDetailsBottomSheet extends RenderableComponent {
|
|
|
21061
21063
|
this.updateBottomSheetContent(productDetails);
|
|
21062
21064
|
}
|
|
21063
21065
|
showProductCheckout() {
|
|
21064
|
-
const productCheckout = this.factory.createProductCheckout(this.bottomSheet
|
|
21066
|
+
const productCheckout = this.factory.createProductCheckout(this.bottomSheet, {
|
|
21067
|
+
onCheckout: this.props.onCheckout,
|
|
21068
|
+
});
|
|
21065
21069
|
this.updateBottomSheetContent(productCheckout);
|
|
21066
21070
|
}
|
|
21067
21071
|
updateBottomSheetContent(content) {
|
|
@@ -21113,7 +21117,9 @@ class ProductCheckoutBottomSheet extends RenderableComponent {
|
|
|
21113
21117
|
return this.bottomSheet.render();
|
|
21114
21118
|
}
|
|
21115
21119
|
open() {
|
|
21116
|
-
const productCheckout = this.factory.createProductCheckout(this.bottomSheet
|
|
21120
|
+
const productCheckout = this.factory.createProductCheckout(this.bottomSheet, {
|
|
21121
|
+
onCheckout: this.props.onCheckout,
|
|
21122
|
+
});
|
|
21117
21123
|
this.updateBottomSheetContent(productCheckout);
|
|
21118
21124
|
this.bottomSheet.open();
|
|
21119
21125
|
}
|
|
@@ -21284,33 +21290,34 @@ class ProductOfferRepository {
|
|
|
21284
21290
|
}
|
|
21285
21291
|
}
|
|
21286
21292
|
static collectDistinctImageUrls(offers, into) {
|
|
21287
|
-
for (const
|
|
21288
|
-
if (
|
|
21289
|
-
into.add(
|
|
21293
|
+
for (const offer of offers) {
|
|
21294
|
+
if (offer.coverUrl) {
|
|
21295
|
+
into.add(offer.coverUrl);
|
|
21290
21296
|
}
|
|
21291
|
-
if (
|
|
21292
|
-
for (const img of
|
|
21297
|
+
if (offer.images?.length) {
|
|
21298
|
+
for (const img of offer.images) {
|
|
21293
21299
|
if (img.url) {
|
|
21294
21300
|
into.add(img.url);
|
|
21295
21301
|
}
|
|
21296
21302
|
}
|
|
21297
21303
|
}
|
|
21298
|
-
if (
|
|
21299
|
-
this.collectDistinctImageUrls(
|
|
21304
|
+
if (offer.subOffersApi?.length) {
|
|
21305
|
+
this.collectDistinctImageUrls(offer.subOffersApi, into);
|
|
21300
21306
|
}
|
|
21301
21307
|
}
|
|
21302
21308
|
}
|
|
21303
21309
|
static applyImageBlobMap(offers, originalToBlob) {
|
|
21304
|
-
for (const
|
|
21305
|
-
const coverOrig =
|
|
21310
|
+
for (const offer of offers) {
|
|
21311
|
+
const coverOrig = offer.coverUrl;
|
|
21306
21312
|
if (coverOrig) {
|
|
21307
21313
|
const blobUrl = originalToBlob.get(coverOrig);
|
|
21308
21314
|
if (blobUrl) {
|
|
21309
|
-
|
|
21315
|
+
offer.blobCoverUrl = blobUrl;
|
|
21310
21316
|
}
|
|
21311
21317
|
}
|
|
21312
|
-
if (
|
|
21313
|
-
|
|
21318
|
+
if (offer.images?.length) {
|
|
21319
|
+
offer.blobImages = offer.images.map(image => ({ ...image }));
|
|
21320
|
+
for (const img of offer.blobImages) {
|
|
21314
21321
|
const urlOrig = img.url;
|
|
21315
21322
|
const blobUrl = originalToBlob.get(urlOrig);
|
|
21316
21323
|
if (blobUrl) {
|
|
@@ -21318,8 +21325,8 @@ class ProductOfferRepository {
|
|
|
21318
21325
|
}
|
|
21319
21326
|
}
|
|
21320
21327
|
}
|
|
21321
|
-
if (
|
|
21322
|
-
this.applyImageBlobMap(
|
|
21328
|
+
if (offer.subOffersApi?.length) {
|
|
21329
|
+
this.applyImageBlobMap(offer.subOffersApi, originalToBlob);
|
|
21323
21330
|
}
|
|
21324
21331
|
}
|
|
21325
21332
|
}
|
|
@@ -21673,6 +21680,12 @@ class WidgetProducts extends WidgetBase {
|
|
|
21673
21680
|
openUrl: getTagData(this.element, "msgOpenUrl") ?? "",
|
|
21674
21681
|
},
|
|
21675
21682
|
height: backgroundViewHeight + scrollViewGroupHeight,
|
|
21683
|
+
onCheckout: () => {
|
|
21684
|
+
this.statEventGoToCart();
|
|
21685
|
+
},
|
|
21686
|
+
onAddToCart: (event) => {
|
|
21687
|
+
this.statEventAddToCart(event);
|
|
21688
|
+
},
|
|
21676
21689
|
});
|
|
21677
21690
|
const isCartEnabled = getTagData(this.element, "isCartEnabled") === "true";
|
|
21678
21691
|
const isCartQuantityEnabled = !getTagData(this.element, "isCartQuantityEnabled") || getTagData(this.element, "isCartQuantityEnabled") === "true";
|
|
@@ -21680,6 +21693,49 @@ class WidgetProducts extends WidgetBase {
|
|
|
21680
21693
|
this.productsView.appendChild(bs.render());
|
|
21681
21694
|
bs.open({ offer, isCartSupported, isCartQuantityEnabled });
|
|
21682
21695
|
};
|
|
21696
|
+
statEventGoToCart() {
|
|
21697
|
+
try {
|
|
21698
|
+
const captionViewText = this.captionView?.textContent ?? "";
|
|
21699
|
+
this.sendStatisticEventToApp("w-products-go-to-cart", {
|
|
21700
|
+
...this.statisticEventBaseFieldsShortForm,
|
|
21701
|
+
wi: this.elementId,
|
|
21702
|
+
wl: captionViewText,
|
|
21703
|
+
}, {
|
|
21704
|
+
...this.statisticEventBaseFieldsFullForm,
|
|
21705
|
+
widget_id: this.elementId,
|
|
21706
|
+
widget_label: captionViewText,
|
|
21707
|
+
}, {
|
|
21708
|
+
forceEnableStatisticV2: false,
|
|
21709
|
+
});
|
|
21710
|
+
}
|
|
21711
|
+
catch (error) {
|
|
21712
|
+
console.error(error);
|
|
21713
|
+
}
|
|
21714
|
+
}
|
|
21715
|
+
statEventAddToCart({ offer, quantity }) {
|
|
21716
|
+
try {
|
|
21717
|
+
const captionViewText = this.captionView?.textContent ?? "";
|
|
21718
|
+
this.sendStatisticEventToApp("w-products-add-to-cart", {
|
|
21719
|
+
...this.statisticEventBaseFieldsShortForm,
|
|
21720
|
+
wi: this.elementId,
|
|
21721
|
+
wl: captionViewText,
|
|
21722
|
+
wv: offer.offerId,
|
|
21723
|
+
wvi: offer.id,
|
|
21724
|
+
}, {
|
|
21725
|
+
...this.statisticEventBaseFieldsFullForm,
|
|
21726
|
+
widget_id: this.elementId,
|
|
21727
|
+
widget_label: captionViewText,
|
|
21728
|
+
widget_value: offer.offerId,
|
|
21729
|
+
quantity,
|
|
21730
|
+
widget_value_id: offer.id,
|
|
21731
|
+
}, {
|
|
21732
|
+
forceEnableStatisticV2: false,
|
|
21733
|
+
});
|
|
21734
|
+
}
|
|
21735
|
+
catch (error) {
|
|
21736
|
+
console.error(error);
|
|
21737
|
+
}
|
|
21738
|
+
}
|
|
21683
21739
|
createScrollView(offers) {
|
|
21684
21740
|
const scrollViewGroup = document.createElement("div");
|
|
21685
21741
|
scrollViewGroup.classList.add("ias-products-scroll-view-group");
|
|
@@ -22167,7 +22223,7 @@ class WidgetProductCarousel extends WidgetBase {
|
|
|
22167
22223
|
this.onWidgetRequirePauseUI();
|
|
22168
22224
|
}
|
|
22169
22225
|
e.stopPropagation();
|
|
22170
|
-
this.
|
|
22226
|
+
this.statEventClickPurchaseButton(offer);
|
|
22171
22227
|
if (isCartSupported) {
|
|
22172
22228
|
this.addToCart(offer, button);
|
|
22173
22229
|
}
|
|
@@ -22213,6 +22269,7 @@ class WidgetProductCarousel extends WidgetBase {
|
|
|
22213
22269
|
bs.open();
|
|
22214
22270
|
this.isBottomSheetOpened = true;
|
|
22215
22271
|
this.disableHostUIInteraction();
|
|
22272
|
+
this.statEventAddToCart({ offer: offerDto, quantity: 1 });
|
|
22216
22273
|
}
|
|
22217
22274
|
catch (error) {
|
|
22218
22275
|
if (error instanceof Error) {
|
|
@@ -22252,6 +22309,12 @@ class WidgetProductCarousel extends WidgetBase {
|
|
|
22252
22309
|
this.productsView = null;
|
|
22253
22310
|
}
|
|
22254
22311
|
},
|
|
22312
|
+
onCheckout: () => {
|
|
22313
|
+
this.statEventGoToCart();
|
|
22314
|
+
},
|
|
22315
|
+
onAddToCart: (event) => {
|
|
22316
|
+
this.statEventAddToCart(event);
|
|
22317
|
+
},
|
|
22255
22318
|
};
|
|
22256
22319
|
}
|
|
22257
22320
|
statEventWidgetCardClick(offer) {
|
|
@@ -22260,8 +22323,8 @@ class WidgetProductCarousel extends WidgetBase {
|
|
|
22260
22323
|
this.sendStatisticEventToApp("w-product-carousel-card-click", {
|
|
22261
22324
|
...this.statisticEventBaseFieldsShortForm,
|
|
22262
22325
|
wi: this.elementId,
|
|
22263
|
-
wl: captionViewText,
|
|
22264
22326
|
wv: offer.offerId,
|
|
22327
|
+
wl: captionViewText,
|
|
22265
22328
|
wvi: offer.id,
|
|
22266
22329
|
}, {
|
|
22267
22330
|
...this.statisticEventBaseFieldsFullForm,
|
|
@@ -22277,6 +22340,63 @@ class WidgetProductCarousel extends WidgetBase {
|
|
|
22277
22340
|
console.error(error);
|
|
22278
22341
|
}
|
|
22279
22342
|
}
|
|
22343
|
+
statEventClickPurchaseButton(offer) {
|
|
22344
|
+
try {
|
|
22345
|
+
this.sendStatisticEventToApp("w-product-carousel-buy-click", {
|
|
22346
|
+
...this.statisticEventBaseFieldsShortForm,
|
|
22347
|
+
wi: this.elementId,
|
|
22348
|
+
wv: offer.offerId,
|
|
22349
|
+
wvi: offer.id,
|
|
22350
|
+
}, {
|
|
22351
|
+
...this.statisticEventBaseFieldsFullForm,
|
|
22352
|
+
widget_id: this.elementId,
|
|
22353
|
+
widget_value: offer.offerId,
|
|
22354
|
+
widget_value_id: offer.id,
|
|
22355
|
+
}, {
|
|
22356
|
+
forceEnableStatisticV2: false,
|
|
22357
|
+
});
|
|
22358
|
+
}
|
|
22359
|
+
catch (error) {
|
|
22360
|
+
console.error(error);
|
|
22361
|
+
}
|
|
22362
|
+
}
|
|
22363
|
+
statEventAddToCart({ offer, quantity }) {
|
|
22364
|
+
try {
|
|
22365
|
+
this.sendStatisticEventToApp("w-product-carousel-add-to-cart", {
|
|
22366
|
+
...this.statisticEventBaseFieldsShortForm,
|
|
22367
|
+
wi: this.elementId,
|
|
22368
|
+
wv: offer.offerId,
|
|
22369
|
+
wvi: offer.id,
|
|
22370
|
+
}, {
|
|
22371
|
+
...this.statisticEventBaseFieldsFullForm,
|
|
22372
|
+
widget_id: this.elementId,
|
|
22373
|
+
widget_value: offer.offerId,
|
|
22374
|
+
quantity,
|
|
22375
|
+
widget_value_id: offer.id,
|
|
22376
|
+
}, {
|
|
22377
|
+
forceEnableStatisticV2: false,
|
|
22378
|
+
});
|
|
22379
|
+
}
|
|
22380
|
+
catch (error) {
|
|
22381
|
+
console.error(error);
|
|
22382
|
+
}
|
|
22383
|
+
}
|
|
22384
|
+
statEventGoToCart() {
|
|
22385
|
+
try {
|
|
22386
|
+
this.sendStatisticEventToApp("w-product-carousel-go-to-cart", {
|
|
22387
|
+
...this.statisticEventBaseFieldsShortForm,
|
|
22388
|
+
wi: this.elementId,
|
|
22389
|
+
}, {
|
|
22390
|
+
...this.statisticEventBaseFieldsFullForm,
|
|
22391
|
+
widget_id: this.elementId,
|
|
22392
|
+
}, {
|
|
22393
|
+
forceEnableStatisticV2: false,
|
|
22394
|
+
});
|
|
22395
|
+
}
|
|
22396
|
+
catch (error) {
|
|
22397
|
+
console.error(error);
|
|
22398
|
+
}
|
|
22399
|
+
}
|
|
22280
22400
|
isCartSupported() {
|
|
22281
22401
|
const isCartEnabled = getTagData(this.element, "isCartEnabled") === "true";
|
|
22282
22402
|
return this.widgetDeps.slideApiDeps.isSdkSupportProductCart && isCartEnabled;
|
|
@@ -26896,6 +27016,10 @@ class WidgetScratchCard extends WidgetBase {
|
|
|
26896
27016
|
...this.statisticEventBaseFieldsShortForm,
|
|
26897
27017
|
wi: this.elementId,
|
|
26898
27018
|
d: duration,
|
|
27019
|
+
}, {
|
|
27020
|
+
...this.statisticEventBaseFieldsFullForm,
|
|
27021
|
+
widget_id: this.elementId,
|
|
27022
|
+
duration_ms: duration,
|
|
26899
27023
|
});
|
|
26900
27024
|
}
|
|
26901
27025
|
saveToLocalData() {
|