@inappstory/react-sdk 1.11.1 → 1.11.3
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.esm.mjs
CHANGED
|
@@ -2489,6 +2489,27 @@ const focusElementOnIOS = (input) => {
|
|
|
2489
2489
|
// @ts-ignore
|
|
2490
2490
|
const getNonce = () => ( true ? __webpack_require__.nc !== null && __webpack_require__.nc !== void 0 ? __webpack_require__.nc : "" : 0);
|
|
2491
2491
|
|
|
2492
|
+
;// ../core/src/helpers/replaceAll.ts
|
|
2493
|
+
//Taken from https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Regular_Expressions
|
|
2494
|
+
function escapeRegExp(val) {
|
|
2495
|
+
return val.replace(/[.*+?^${}()|[\]\\]/g, "\\$&"); // $& means the whole matched string
|
|
2496
|
+
}
|
|
2497
|
+
// replaceAll does not work in safari
|
|
2498
|
+
function replaceAll(val, match, replacement) {
|
|
2499
|
+
return String(val).replace(new RegExp(escapeRegExp(match), "g"), () => replacement);
|
|
2500
|
+
}
|
|
2501
|
+
|
|
2502
|
+
;// ../core/src/helpers/internalFontNames.ts
|
|
2503
|
+
|
|
2504
|
+
const INTERNAL_FONT_FAMILY_NAMES = ["InternalPrimaryFont", "InternalSecondaryFont"];
|
|
2505
|
+
function applyInternalFontFamilyPrefix(text, prefix) {
|
|
2506
|
+
let result = text;
|
|
2507
|
+
for (const name of INTERNAL_FONT_FAMILY_NAMES) {
|
|
2508
|
+
result = replaceAll(result, name, `${prefix}${name}`);
|
|
2509
|
+
}
|
|
2510
|
+
return result;
|
|
2511
|
+
}
|
|
2512
|
+
|
|
2492
2513
|
;// ../core/src/helpers/isPassiveSupported.ts
|
|
2493
2514
|
const isPassiveSupported = () => {
|
|
2494
2515
|
let passiveSupported = false;
|
|
@@ -2994,16 +3015,6 @@ function defineValue(obj, key, val) {
|
|
|
2994
3015
|
});
|
|
2995
3016
|
}
|
|
2996
3017
|
|
|
2997
|
-
;// ../core/src/helpers/replaceAll.ts
|
|
2998
|
-
//Taken from https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Regular_Expressions
|
|
2999
|
-
function escapeRegExp(val) {
|
|
3000
|
-
return val.replace(/[.*+?^${}()|[\]\\]/g, "\\$&"); // $& means the whole matched string
|
|
3001
|
-
}
|
|
3002
|
-
// replaceAll does not work in safari
|
|
3003
|
-
function replaceAll(val, match, replacement) {
|
|
3004
|
-
return String(val).replace(new RegExp(escapeRegExp(match), "g"), () => replacement);
|
|
3005
|
-
}
|
|
3006
|
-
|
|
3007
3018
|
;// ../core/src/helpers/sleep.ts
|
|
3008
3019
|
const sleep = async (startAt, minTimeout = 300) => {
|
|
3009
3020
|
return new Promise(resolve => {
|
|
@@ -3087,6 +3098,7 @@ function safeJson(input) {
|
|
|
3087
3098
|
|
|
3088
3099
|
|
|
3089
3100
|
|
|
3101
|
+
|
|
3090
3102
|
;// ../core/src/api/deviceDescriptor.ts
|
|
3091
3103
|
|
|
3092
3104
|
|
|
@@ -3306,10 +3318,13 @@ class Session {
|
|
|
3306
3318
|
get imagePlaceholders() {
|
|
3307
3319
|
return this._imagePlaceholders;
|
|
3308
3320
|
}
|
|
3309
|
-
|
|
3310
|
-
|
|
3311
|
-
|
|
3312
|
-
|
|
3321
|
+
constructor(storyManager, sessionStore, sessionDto) {
|
|
3322
|
+
Object.defineProperty(this, "storyManager", {
|
|
3323
|
+
enumerable: true,
|
|
3324
|
+
configurable: true,
|
|
3325
|
+
writable: true,
|
|
3326
|
+
value: storyManager
|
|
3327
|
+
});
|
|
3313
3328
|
Object.defineProperty(this, "sessionStore", {
|
|
3314
3329
|
enumerable: true,
|
|
3315
3330
|
configurable: true,
|
|
@@ -3370,12 +3385,19 @@ class Session {
|
|
|
3370
3385
|
writable: true,
|
|
3371
3386
|
value: void 0
|
|
3372
3387
|
});
|
|
3388
|
+
Object.defineProperty(this, "fontsResources", {
|
|
3389
|
+
enumerable: true,
|
|
3390
|
+
configurable: true,
|
|
3391
|
+
writable: true,
|
|
3392
|
+
value: []
|
|
3393
|
+
});
|
|
3373
3394
|
this.id = sessionDto.session.id;
|
|
3374
3395
|
this.expireIn = sessionDto.session.expire_in;
|
|
3375
3396
|
this.userKey = sessionDto.user_key || DEFAULT_USER_KEY;
|
|
3376
3397
|
this.previewAspectRatio = sessionDto.preview_aspect_ratio;
|
|
3377
3398
|
this.share = sessionDto.share;
|
|
3378
3399
|
this.resources = this.getResources(sessionDto);
|
|
3400
|
+
this.fontsResources = this.applyFontsPrefix(this.resources.filter(resource => resource.type === "font-face"));
|
|
3379
3401
|
this._textPlaceholders = this.mapTextPlaceholders(sessionDto.placeholders);
|
|
3380
3402
|
this._imagePlaceholders = this.mapImagePlaceholders(sessionDto.image_placeholders);
|
|
3381
3403
|
this.isAllowStatisticV2 = Boolean(sessionDto.is_allow_statistic_v2);
|
|
@@ -3383,6 +3405,14 @@ class Session {
|
|
|
3383
3405
|
loadResources() {
|
|
3384
3406
|
initAndLoadFonts(this.fontsResources);
|
|
3385
3407
|
}
|
|
3408
|
+
getAllFontFamilies() {
|
|
3409
|
+
return [...new Set(this.fontsResources.map(fontResource => fontResource.family))];
|
|
3410
|
+
}
|
|
3411
|
+
applyFontsPrefix(fontsResources) {
|
|
3412
|
+
return fontsResources.map(fontResource => {
|
|
3413
|
+
return Object.assign(Object.assign({}, fontResource), { family: `${this.storyManager.config.fontsPrefix}${fontResource.family}` });
|
|
3414
|
+
});
|
|
3415
|
+
}
|
|
3386
3416
|
getResources(sessionDto) {
|
|
3387
3417
|
if (sessionDto.cache && Array.isArray(sessionDto.cache))
|
|
3388
3418
|
return sessionDto.cache;
|
|
@@ -4460,6 +4490,9 @@ let StorySlide = (() => {
|
|
|
4460
4490
|
html: ""
|
|
4461
4491
|
});
|
|
4462
4492
|
}
|
|
4493
|
+
applyFontsPrefix(prefix) {
|
|
4494
|
+
this._html = applyInternalFontFamilyPrefix(this._html, prefix);
|
|
4495
|
+
}
|
|
4463
4496
|
updatePlaceholders(placeholders) {
|
|
4464
4497
|
let slideHtml = this._html;
|
|
4465
4498
|
for (const placeholder of placeholders)
|
|
@@ -4941,6 +4974,10 @@ let Story = (() => {
|
|
|
4941
4974
|
setShareUrl(shareUrl) {
|
|
4942
4975
|
this._shareUrl = shareUrl;
|
|
4943
4976
|
}
|
|
4977
|
+
applyFontsPrefix(prefix) {
|
|
4978
|
+
for (const slide of this.slides)
|
|
4979
|
+
slide.applyFontsPrefix(prefix);
|
|
4980
|
+
}
|
|
4944
4981
|
updatePlaceholders(placeholders) {
|
|
4945
4982
|
if (!this.needPlaceholders)
|
|
4946
4983
|
return;
|
|
@@ -9818,7 +9855,7 @@ class GameClientConfig {
|
|
|
9818
9855
|
value: void 0
|
|
9819
9856
|
});
|
|
9820
9857
|
const storyManagerConfig = this.storyManager.config;
|
|
9821
|
-
const sdkVersion = "1.11.
|
|
9858
|
+
const sdkVersion = "1.11.3";
|
|
9822
9859
|
const placeholders = this.storyManager.rootStore.placeholderStore.placeholders;
|
|
9823
9860
|
const session = this.storyManager.rootStore.sessionStore.session;
|
|
9824
9861
|
this.sessionId = session.id;
|
|
@@ -14389,6 +14426,12 @@ let StoryManagerConfig = (() => {
|
|
|
14389
14426
|
writable: true,
|
|
14390
14427
|
value: (storyManagerConfig_runInitializers(this, __options_extraInitializers), null)
|
|
14391
14428
|
});
|
|
14429
|
+
Object.defineProperty(this, "_fontsPrefix", {
|
|
14430
|
+
enumerable: true,
|
|
14431
|
+
configurable: true,
|
|
14432
|
+
writable: true,
|
|
14433
|
+
value: "_IAS"
|
|
14434
|
+
});
|
|
14392
14435
|
this.update(configDto);
|
|
14393
14436
|
this._isInited = true;
|
|
14394
14437
|
}
|
|
@@ -14431,6 +14474,9 @@ let StoryManagerConfig = (() => {
|
|
|
14431
14474
|
get anonymous() {
|
|
14432
14475
|
return this._anonymous;
|
|
14433
14476
|
}
|
|
14477
|
+
get fontsPrefix() {
|
|
14478
|
+
return this._fontsPrefix;
|
|
14479
|
+
}
|
|
14434
14480
|
get options() {
|
|
14435
14481
|
return this._options;
|
|
14436
14482
|
}
|
|
@@ -14521,19 +14567,20 @@ let StoryManagerConfig = (() => {
|
|
|
14521
14567
|
this._options = options;
|
|
14522
14568
|
}
|
|
14523
14569
|
update(configDto) {
|
|
14524
|
-
var _b, _c, _d, _e, _f, _g;
|
|
14525
|
-
this.
|
|
14570
|
+
var _b, _c, _d, _e, _f, _g, _h;
|
|
14571
|
+
this._fontsPrefix = (_b = configDto.fontsPrefix) !== null && _b !== void 0 ? _b : "_IAS";
|
|
14572
|
+
this._appPackageId = (_c = configDto.appPackageId) !== null && _c !== void 0 ? _c : "";
|
|
14526
14573
|
this._disableDeviceId = Boolean(configDto.disableDeviceId);
|
|
14527
14574
|
this.setOptions(configDto.options);
|
|
14528
14575
|
this.setApiKey(configDto.apiKey).catch(console.error);
|
|
14529
14576
|
this.setAnonymous(configDto.anonymous);
|
|
14530
|
-
this.setUserId((
|
|
14577
|
+
this.setUserId((_d = configDto.userId) !== null && _d !== void 0 ? _d : "", configDto.userIdSign).catch(console.error);
|
|
14531
14578
|
this.setLang(configDto.lang).catch(console.error);
|
|
14532
|
-
this.setTextPlaceholders((
|
|
14533
|
-
this.setImagePlaceholders((
|
|
14534
|
-
this.setTags((
|
|
14579
|
+
this.setTextPlaceholders((_e = configDto.placeholders) !== null && _e !== void 0 ? _e : {});
|
|
14580
|
+
this.setImagePlaceholders((_f = configDto.imagePlaceholders) !== null && _f !== void 0 ? _f : {});
|
|
14581
|
+
this.setTags((_g = configDto.tags) !== null && _g !== void 0 ? _g : []);
|
|
14535
14582
|
this.setDir(configDto.dir);
|
|
14536
|
-
this._cache = configDto.cache ? Object.assign(Object.assign({}, configDto.cache), { prefetch: (
|
|
14583
|
+
this._cache = configDto.cache ? Object.assign(Object.assign({}, configDto.cache), { prefetch: (_h = configDto.cache.prefetch) !== null && _h !== void 0 ? _h : true }) : null;
|
|
14537
14584
|
}
|
|
14538
14585
|
mapTextPlaceholders(textPlaceholderDtos) {
|
|
14539
14586
|
const textPlaceholders = [];
|
|
@@ -14640,6 +14687,9 @@ class NullStoryManagerConfig {
|
|
|
14640
14687
|
get anonymous() {
|
|
14641
14688
|
return false;
|
|
14642
14689
|
}
|
|
14690
|
+
get fontsPrefix() {
|
|
14691
|
+
return "_IAS";
|
|
14692
|
+
}
|
|
14643
14693
|
get options() {
|
|
14644
14694
|
return {};
|
|
14645
14695
|
}
|
|
@@ -14988,7 +15038,7 @@ var iamApi_esDecorate = (undefined && undefined.__esDecorate) || function (ctor,
|
|
|
14988
15038
|
|
|
14989
15039
|
|
|
14990
15040
|
|
|
14991
|
-
const messageFields = "campaign_name,id,events,appearance,
|
|
15041
|
+
const messageFields = "campaign_name,id,events,appearance,type,frequency_limit,display_to,display_from,disable_close,need_placeholders,has_limit,slides";
|
|
14992
15042
|
const messageFieldsWithPrefix = messageFields
|
|
14993
15043
|
.split(",")
|
|
14994
15044
|
.map(field => `messages.${field}`)
|
|
@@ -15014,22 +15064,26 @@ let IamApi = (() => {
|
|
|
15014
15064
|
options
|
|
15015
15065
|
}, {
|
|
15016
15066
|
params: {
|
|
15017
|
-
fields: messageFieldsWithPrefix
|
|
15067
|
+
fields: messageFieldsWithPrefix,
|
|
15068
|
+
expand: "messages.slides"
|
|
15018
15069
|
}
|
|
15019
15070
|
});
|
|
15020
15071
|
return response.data.messages;
|
|
15021
15072
|
}
|
|
15022
|
-
async fetchContext(messageIds) {
|
|
15073
|
+
async fetchContext({ needFetchStyles, messageIds }) {
|
|
15023
15074
|
const response = await api.get("inappmessaging/message-context", {
|
|
15024
|
-
params: {
|
|
15075
|
+
params: {
|
|
15076
|
+
fields: "widgetsData" + (needFetchStyles ? ",style" : ""),
|
|
15077
|
+
id: messageIds.join()
|
|
15078
|
+
}
|
|
15025
15079
|
});
|
|
15026
15080
|
return response.data;
|
|
15027
15081
|
}
|
|
15028
15082
|
async fetchById(messageId) {
|
|
15029
15083
|
const response = await api.get(`inappmessaging/message/${messageId}`, {
|
|
15030
15084
|
params: {
|
|
15031
|
-
expand: "
|
|
15032
|
-
fields: messageFields
|
|
15085
|
+
expand: "slides",
|
|
15086
|
+
fields: messageFields,
|
|
15033
15087
|
}
|
|
15034
15088
|
});
|
|
15035
15089
|
const messageDto = response.data;
|
|
@@ -15492,21 +15546,33 @@ let IamMessageSlide = (() => {
|
|
|
15492
15546
|
value: (iamMessageSlide_runInitializers(this, _instanceExtraInitializers), message)
|
|
15493
15547
|
});
|
|
15494
15548
|
_IamMessageSlide__html_accessor_storage.set(this, iamMessageSlide_runInitializers(this, __html_initializers, ""));
|
|
15495
|
-
|
|
15496
|
-
|
|
15549
|
+
Object.defineProperty(this, "_payload", {
|
|
15550
|
+
enumerable: true,
|
|
15551
|
+
configurable: true,
|
|
15552
|
+
writable: true,
|
|
15553
|
+
value: iamMessageSlide_runInitializers(this, __html_extraInitializers)
|
|
15554
|
+
});
|
|
15497
15555
|
}
|
|
15498
15556
|
get html() {
|
|
15499
15557
|
return this._html;
|
|
15500
15558
|
}
|
|
15559
|
+
get payload() {
|
|
15560
|
+
return this._payload;
|
|
15561
|
+
}
|
|
15501
15562
|
updateByDto(messageSlideDto) {
|
|
15563
|
+
var _b;
|
|
15502
15564
|
this._html = this.getSlideHtml(messageSlideDto);
|
|
15565
|
+
this._payload = (_b = messageSlideDto.event_payload) === null || _b === void 0 ? void 0 : _b.payload;
|
|
15503
15566
|
}
|
|
15504
15567
|
getSlideHtml(messageSlideDto) {
|
|
15505
15568
|
var _b;
|
|
15506
|
-
let slideHtml = messageSlideDto;
|
|
15569
|
+
let slideHtml = messageSlideDto.html;
|
|
15507
15570
|
slideHtml = replaceAll(slideHtml, `{{nonce}}`, (_b = getNonce()) !== null && _b !== void 0 ? _b : "");
|
|
15508
15571
|
return slideHtml;
|
|
15509
15572
|
}
|
|
15573
|
+
applyFontsPrefix(prefix) {
|
|
15574
|
+
this._html = applyInternalFontFamilyPrefix(this._html, prefix);
|
|
15575
|
+
}
|
|
15510
15576
|
updatePlaceholders(placeholders) {
|
|
15511
15577
|
let slideHtml = this._html;
|
|
15512
15578
|
for (const placeholder of placeholders)
|
|
@@ -15854,7 +15920,7 @@ let IamMessage = (() => {
|
|
|
15854
15920
|
this._hasLimit = Boolean(messageDto.has_limit);
|
|
15855
15921
|
this._appearanceOptions = new IamAppearanceOptionsFactory().create(this._type, messageDto.appearance);
|
|
15856
15922
|
this._needPlaceholders = messageDto.need_placeholders;
|
|
15857
|
-
this.updateMessageSlides(messageDto.
|
|
15923
|
+
this.updateMessageSlides(messageDto.slides);
|
|
15858
15924
|
}
|
|
15859
15925
|
hasEvent(eventName) {
|
|
15860
15926
|
return Boolean(this._events[eventName]);
|
|
@@ -15898,6 +15964,10 @@ let IamMessage = (() => {
|
|
|
15898
15964
|
this._openTime = Date.now();
|
|
15899
15965
|
return this._iterationId;
|
|
15900
15966
|
}
|
|
15967
|
+
applyFontsPrefix(prefix) {
|
|
15968
|
+
for (const slide of this._slides)
|
|
15969
|
+
slide.applyFontsPrefix(prefix);
|
|
15970
|
+
}
|
|
15901
15971
|
updatePlaceholders(placeholders) {
|
|
15902
15972
|
for (const slide of this._slides)
|
|
15903
15973
|
slide.updatePlaceholders(placeholders);
|
|
@@ -16739,6 +16809,7 @@ let IamReaderViewModel = (() => {
|
|
|
16739
16809
|
this.emitCloseEvent(activeMessage);
|
|
16740
16810
|
}
|
|
16741
16811
|
async open(message, appearance) {
|
|
16812
|
+
message.applyFontsPrefix(this.storyManager.config.fontsPrefix);
|
|
16742
16813
|
message.updatePlaceholders(this.storyManager.rootStore.placeholderStore.placeholders);
|
|
16743
16814
|
if ((appearance === null || appearance === void 0 ? void 0 : appearance.zIndex) !== undefined) {
|
|
16744
16815
|
message.appearanceOptions.zIndex = appearance.zIndex;
|
|
@@ -16754,6 +16825,7 @@ let IamReaderViewModel = (() => {
|
|
|
16754
16825
|
if (!this.activeMessage)
|
|
16755
16826
|
return;
|
|
16756
16827
|
this.emit(IamReaderEvent.WidgetEvent, {
|
|
16828
|
+
payload: this.activeMessage.payload,
|
|
16757
16829
|
message: this.activeMessage.toPublicDto(),
|
|
16758
16830
|
name: widgetEvent.type,
|
|
16759
16831
|
data: widgetEvent.widgetPayload
|
|
@@ -16765,6 +16837,7 @@ let IamReaderViewModel = (() => {
|
|
|
16765
16837
|
}
|
|
16766
16838
|
emitCloseEvent(message) {
|
|
16767
16839
|
this.emit(IamReaderEvent.Close, {
|
|
16840
|
+
payload: message.payload,
|
|
16768
16841
|
message: message.toPublicDto()
|
|
16769
16842
|
});
|
|
16770
16843
|
}
|
|
@@ -16873,10 +16946,12 @@ class openUrlAction_OpenUrlAction {
|
|
|
16873
16946
|
const event = {
|
|
16874
16947
|
src: StoryManagerLinkEventSource.IamReader,
|
|
16875
16948
|
data: {
|
|
16949
|
+
type: this.iamMessage.type,
|
|
16876
16950
|
id: this.iamMessage.id,
|
|
16877
16951
|
index: this.iamMessage.activeSlideIndex,
|
|
16878
16952
|
url,
|
|
16879
|
-
elementId: payload.elementId
|
|
16953
|
+
elementId: payload.elementId,
|
|
16954
|
+
payload: this.iamMessage.payload,
|
|
16880
16955
|
}
|
|
16881
16956
|
};
|
|
16882
16957
|
this.storyManager.storyLinkClickHandler(event);
|
|
@@ -17390,6 +17465,11 @@ let IamMultiSlideMessageViewModel = (() => {
|
|
|
17390
17465
|
get type() {
|
|
17391
17466
|
return this.iamMessage.type;
|
|
17392
17467
|
}
|
|
17468
|
+
get payload() {
|
|
17469
|
+
var _b;
|
|
17470
|
+
const slide = this.iamMessage.slides[this._activeSlideIndex];
|
|
17471
|
+
return (_b = slide === null || slide === void 0 ? void 0 : slide.payload) !== null && _b !== void 0 ? _b : null;
|
|
17472
|
+
}
|
|
17393
17473
|
get needShowErrorScreen() {
|
|
17394
17474
|
return this._needShowErrorScreen;
|
|
17395
17475
|
}
|
|
@@ -20041,11 +20121,11 @@ let IamStore = (() => {
|
|
|
20041
20121
|
_IamStore__messages_accessor_storage.set(this, iamStore_runInitializers(this, __messages_initializers, __WEBPACK_EXTERNAL_MODULE_mobx_observable__.map()));
|
|
20042
20122
|
_IamStore__isLoaded_accessor_storage.set(this, (iamStore_runInitializers(this, __messages_extraInitializers), iamStore_runInitializers(this, __isLoaded_initializers, false)));
|
|
20043
20123
|
_IamStore__isLoading_accessor_storage.set(this, (iamStore_runInitializers(this, __isLoaded_extraInitializers), iamStore_runInitializers(this, __isLoading_initializers, false)));
|
|
20044
|
-
Object.defineProperty(this, "
|
|
20124
|
+
Object.defineProperty(this, "iamCSS", {
|
|
20045
20125
|
enumerable: true,
|
|
20046
20126
|
configurable: true,
|
|
20047
20127
|
writable: true,
|
|
20048
|
-
value: (iamStore_runInitializers(this, __isLoading_extraInitializers),
|
|
20128
|
+
value: (iamStore_runInitializers(this, __isLoading_extraInitializers), "")
|
|
20049
20129
|
});
|
|
20050
20130
|
}
|
|
20051
20131
|
get messages() {
|
|
@@ -20057,9 +20137,6 @@ let IamStore = (() => {
|
|
|
20057
20137
|
get isLoading() {
|
|
20058
20138
|
return this._isLoading;
|
|
20059
20139
|
}
|
|
20060
|
-
get messageContext() {
|
|
20061
|
-
return this._messageContext;
|
|
20062
|
-
}
|
|
20063
20140
|
async preload(params) {
|
|
20064
20141
|
try {
|
|
20065
20142
|
this._isLoaded = false;
|
|
@@ -20093,37 +20170,44 @@ let IamStore = (() => {
|
|
|
20093
20170
|
}
|
|
20094
20171
|
async fetchById(messageId) {
|
|
20095
20172
|
await this.rootStore.sessionStore.open();
|
|
20096
|
-
await this.fetchMessageContext({ messageIds: [messageId] });
|
|
20173
|
+
const messageContext = await this.fetchMessageContext({ messageIds: [messageId] });
|
|
20097
20174
|
const messageDto = await this.iamApi.fetchById(messageId);
|
|
20098
|
-
return this.createMessageByDto(messageDto);
|
|
20175
|
+
return this.createMessageByDto(messageDto, messageContext);
|
|
20099
20176
|
}
|
|
20100
20177
|
async fetchAll(params) {
|
|
20101
20178
|
await this.rootStore.sessionStore.open();
|
|
20102
20179
|
const config = this.rootStore.storyManagerConfigStore.config;
|
|
20103
20180
|
const tags = params.tags ? params.tags : config.tags;
|
|
20104
20181
|
const messageDtos = await this.iamApi.fetchAll({ tags: filterTags(tags), options: config.options });
|
|
20105
|
-
await this.fetchMessageContext({
|
|
20106
|
-
|
|
20182
|
+
const messageContext = await this.fetchMessageContext({
|
|
20183
|
+
messageIds: messageDtos.map(message => message.id)
|
|
20184
|
+
});
|
|
20185
|
+
return this.createMessagesByDtos(messageDtos, messageContext);
|
|
20107
20186
|
}
|
|
20108
20187
|
async fetchMessageContext({ messageIds }) {
|
|
20109
20188
|
await this.rootStore.sessionStore.open();
|
|
20110
|
-
|
|
20111
|
-
|
|
20189
|
+
const messageContextDto = await this.iamApi.fetchContext({
|
|
20190
|
+
needFetchStyles: !this.iamCSS,
|
|
20191
|
+
messageIds
|
|
20192
|
+
});
|
|
20193
|
+
if (!this.iamCSS && messageContextDto.style) {
|
|
20194
|
+
this.iamCSS = applyInternalFontFamilyPrefix(messageContextDto.style, this.rootStore.storyManagerConfigStore.config.fontsPrefix);
|
|
20195
|
+
}
|
|
20196
|
+
messageContextDto.style = this.iamCSS;
|
|
20197
|
+
return messageContextDto;
|
|
20112
20198
|
}
|
|
20113
|
-
createMessagesByDtos(messageDtos) {
|
|
20199
|
+
createMessagesByDtos(messageDtos, messageContext) {
|
|
20114
20200
|
this._messages.clear();
|
|
20115
20201
|
const messages = [];
|
|
20116
20202
|
for (const messageDto of messageDtos) {
|
|
20117
|
-
const message = this.createMessageByDto(messageDto);
|
|
20203
|
+
const message = this.createMessageByDto(messageDto, messageContext);
|
|
20118
20204
|
messages.push(message);
|
|
20119
20205
|
}
|
|
20120
20206
|
return messages;
|
|
20121
20207
|
}
|
|
20122
|
-
createMessageByDto(messageDto) {
|
|
20123
|
-
if (!this.messageContext)
|
|
20124
|
-
throw new Error("[IAS]: IAM context not found");
|
|
20208
|
+
createMessageByDto(messageDto, messageContext) {
|
|
20125
20209
|
const message = IamMessage.createByDto(messageDto);
|
|
20126
|
-
const context = new IamMessageContext(messageDto.id,
|
|
20210
|
+
const context = new IamMessageContext(messageDto.id, messageContext);
|
|
20127
20211
|
message.setContext(context);
|
|
20128
20212
|
if (!this._messages.has(message.id.toString()))
|
|
20129
20213
|
this._messages.set(message.id.toString(), message);
|
|
@@ -20258,7 +20342,7 @@ let SessionStore = (() => {
|
|
|
20258
20342
|
userIdSign: config.userIdSign,
|
|
20259
20343
|
anonymous: config.anonymous
|
|
20260
20344
|
});
|
|
20261
|
-
const session = new Session(this, sessionDto);
|
|
20345
|
+
const session = new Session(this.storyManager, this, sessionDto);
|
|
20262
20346
|
session.loadResources();
|
|
20263
20347
|
this.updatePlaceholders(session);
|
|
20264
20348
|
this._session = session;
|
|
@@ -20400,6 +20484,7 @@ let StoryStore = (() => {
|
|
|
20400
20484
|
if (storiesById.has(storyDto.id))
|
|
20401
20485
|
return storiesById.get(storyDto.id);
|
|
20402
20486
|
const story = new Story(storyDto);
|
|
20487
|
+
story.applyFontsPrefix(this.storyManager.config.fontsPrefix);
|
|
20403
20488
|
story.updatePlaceholders(this.rootStore.placeholderStore.placeholders);
|
|
20404
20489
|
storiesById.set(storyDto.id, story);
|
|
20405
20490
|
return story;
|
|
@@ -20483,6 +20568,7 @@ let StoryStore = (() => {
|
|
|
20483
20568
|
story.setContext(storyContext);
|
|
20484
20569
|
const storyDto = await this.storiesApi.fetchStorySlides({ id: story.id, feedSlug });
|
|
20485
20570
|
story.setSlides((_b = storyDto.slides) !== null && _b !== void 0 ? _b : []);
|
|
20571
|
+
story.applyFontsPrefix(this.storyManager.config.fontsPrefix);
|
|
20486
20572
|
story.updatePlaceholders(this.rootStore.placeholderStore.placeholders);
|
|
20487
20573
|
await sleep(startAt);
|
|
20488
20574
|
story.setCanBeShown(true);
|
|
@@ -20496,6 +20582,7 @@ let StoryStore = (() => {
|
|
|
20496
20582
|
const storyDto = await this.storiesApi.fetchStory({ id: storyId, feedSlug, fetchShareUrl, once });
|
|
20497
20583
|
const story = this.addStoryByDto(storyDto);
|
|
20498
20584
|
story.setSlides((_b = storyDto.slides) !== null && _b !== void 0 ? _b : []);
|
|
20585
|
+
story.applyFontsPrefix(this.storyManager.config.fontsPrefix);
|
|
20499
20586
|
story.updatePlaceholders(this.rootStore.placeholderStore.placeholders);
|
|
20500
20587
|
return story;
|
|
20501
20588
|
}
|
|
@@ -20503,6 +20590,7 @@ let StoryStore = (() => {
|
|
|
20503
20590
|
if (this.storyCSS)
|
|
20504
20591
|
return;
|
|
20505
20592
|
this.storyCSS = await this.storiesApi.fetchStoryCSS();
|
|
20593
|
+
this.storyCSS = applyInternalFontFamilyPrefix(this.storyCSS, this.storyManager.config.fontsPrefix);
|
|
20506
20594
|
}
|
|
20507
20595
|
async fetchStoryContext({ id, feedSlug }) {
|
|
20508
20596
|
const storyContextDto = await this.storiesApi.fetchStoryContext({
|
|
@@ -20887,7 +20975,7 @@ class UgcEditorStore {
|
|
|
20887
20975
|
const session = await this.storyManager.rootStore.sessionStore.open();
|
|
20888
20976
|
const ugcEditorConfigDto = await this.ugcEditorApi.fetchUgcEditorConfig();
|
|
20889
20977
|
const storyManagerConfig = this.storyManager.config;
|
|
20890
|
-
const sdkVersion = "1.11.
|
|
20978
|
+
const sdkVersion = "1.11.3";
|
|
20891
20979
|
this._config = {
|
|
20892
20980
|
sessionId: session.id,
|
|
20893
20981
|
apiKey: storyManagerConfig.apiKey,
|
|
@@ -21347,11 +21435,11 @@ class StoryManager extends TypedEventEmitter {
|
|
|
21347
21435
|
return deviceDescriptor.deviceId;
|
|
21348
21436
|
}
|
|
21349
21437
|
get sdkVersionName() {
|
|
21350
|
-
const sdkVersionName = "1.11.
|
|
21438
|
+
const sdkVersionName = "1.11.3";
|
|
21351
21439
|
return sdkVersionName || "0.0.0";
|
|
21352
21440
|
}
|
|
21353
21441
|
get sdkVersionCode() {
|
|
21354
|
-
const sdkVersionCode =
|
|
21442
|
+
const sdkVersionCode = 11103;
|
|
21355
21443
|
return sdkVersionCode ? parseInt(sdkVersionCode) : 0;
|
|
21356
21444
|
}
|
|
21357
21445
|
get lang() {
|
|
@@ -21415,7 +21503,7 @@ class StoryManager extends TypedEventEmitter {
|
|
|
21415
21503
|
this.rootStore.storyManagerConfigStore.setConfig(configDto);
|
|
21416
21504
|
}
|
|
21417
21505
|
setUserAgent(userAgent) {
|
|
21418
|
-
const sdkVersionCode =
|
|
21506
|
+
const sdkVersionCode = 11103;
|
|
21419
21507
|
const buildVersion = sdkVersionCode ? parseInt(sdkVersionCode) : 0;
|
|
21420
21508
|
// According to RFC5987, HTTP header values can legitimately be supplied using the ISO-8859-1 encoding.
|
|
21421
21509
|
this._userAgent = `${userAgent} ${convertStrToLatin1(navigator.userAgent)}`;
|
|
@@ -29411,7 +29499,9 @@ const useStoryListImperativeHandle = (ref, storyListViewModel) => {
|
|
|
29411
29499
|
|
|
29412
29500
|
|
|
29413
29501
|
|
|
29502
|
+
|
|
29414
29503
|
const StoryListWrapper = __WEBPACK_EXTERNAL_MODULE_react_forwardRef__((props, ref) => {
|
|
29504
|
+
const { storyManager } = useIASProvider();
|
|
29415
29505
|
const cardOptions = props.sliderOptions.card;
|
|
29416
29506
|
const favoriteCardOptions = props.sliderOptions.favoriteCard;
|
|
29417
29507
|
const cardBorderOptions = cardOptions.border;
|
|
@@ -29467,7 +29557,7 @@ const StoryListWrapper = __WEBPACK_EXTERNAL_MODULE_react_forwardRef__((props, re
|
|
|
29467
29557
|
: favoriteCardOptions.gap,
|
|
29468
29558
|
"--storiesListCardUgcMaskColor": props.sliderOptions.ugcCard.mask.color,
|
|
29469
29559
|
"--storiesListCardUgcMaskLinearGradient": composeCardMaskLinearGradient(props.sliderOptions.ugcCard.mask),
|
|
29470
|
-
"--storiesListItemTitleFontFamily":
|
|
29560
|
+
"--storiesListItemTitleFontFamily": `${storyManager.config.fontsPrefix}InternalPrimaryFont`,
|
|
29471
29561
|
"--storiesListItemTitleFont": cardOptions.title.font,
|
|
29472
29562
|
"--storiesListItemTitlePadding": isNumeric(cardOptions.title.padding.toString())
|
|
29473
29563
|
? cardOptions.title.padding + "px"
|