@inappstory/react-sdk 1.11.2 → 1.11.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.
@@ -2489,6 +2489,29 @@ 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
+ if (!prefix)
2507
+ return text;
2508
+ let result = text;
2509
+ for (const name of INTERNAL_FONT_FAMILY_NAMES) {
2510
+ result = replaceAll(result, name, `${prefix}${name}`);
2511
+ }
2512
+ return result;
2513
+ }
2514
+
2492
2515
  ;// ../core/src/helpers/isPassiveSupported.ts
2493
2516
  const isPassiveSupported = () => {
2494
2517
  let passiveSupported = false;
@@ -2994,16 +3017,6 @@ function defineValue(obj, key, val) {
2994
3017
  });
2995
3018
  }
2996
3019
 
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
3020
  ;// ../core/src/helpers/sleep.ts
3008
3021
  const sleep = async (startAt, minTimeout = 300) => {
3009
3022
  return new Promise(resolve => {
@@ -3087,6 +3100,7 @@ function safeJson(input) {
3087
3100
 
3088
3101
 
3089
3102
 
3103
+
3090
3104
  ;// ../core/src/api/deviceDescriptor.ts
3091
3105
 
3092
3106
 
@@ -3306,10 +3320,13 @@ class Session {
3306
3320
  get imagePlaceholders() {
3307
3321
  return this._imagePlaceholders;
3308
3322
  }
3309
- get fontsResources() {
3310
- return this.resources.filter(resource => resource.type === "font-face");
3311
- }
3312
- constructor(sessionStore, sessionDto) {
3323
+ constructor(storyManager, sessionStore, sessionDto) {
3324
+ Object.defineProperty(this, "storyManager", {
3325
+ enumerable: true,
3326
+ configurable: true,
3327
+ writable: true,
3328
+ value: storyManager
3329
+ });
3313
3330
  Object.defineProperty(this, "sessionStore", {
3314
3331
  enumerable: true,
3315
3332
  configurable: true,
@@ -3370,12 +3387,19 @@ class Session {
3370
3387
  writable: true,
3371
3388
  value: void 0
3372
3389
  });
3390
+ Object.defineProperty(this, "fontsResources", {
3391
+ enumerable: true,
3392
+ configurable: true,
3393
+ writable: true,
3394
+ value: []
3395
+ });
3373
3396
  this.id = sessionDto.session.id;
3374
3397
  this.expireIn = sessionDto.session.expire_in;
3375
3398
  this.userKey = sessionDto.user_key || DEFAULT_USER_KEY;
3376
3399
  this.previewAspectRatio = sessionDto.preview_aspect_ratio;
3377
3400
  this.share = sessionDto.share;
3378
3401
  this.resources = this.getResources(sessionDto);
3402
+ this.fontsResources = this.applyFontPrefix(this.resources.filter(resource => resource.type === "font-face"));
3379
3403
  this._textPlaceholders = this.mapTextPlaceholders(sessionDto.placeholders);
3380
3404
  this._imagePlaceholders = this.mapImagePlaceholders(sessionDto.image_placeholders);
3381
3405
  this.isAllowStatisticV2 = Boolean(sessionDto.is_allow_statistic_v2);
@@ -3383,6 +3407,14 @@ class Session {
3383
3407
  loadResources() {
3384
3408
  initAndLoadFonts(this.fontsResources);
3385
3409
  }
3410
+ getAllFontFamilies() {
3411
+ return [...new Set(this.fontsResources.map(fontResource => fontResource.family))];
3412
+ }
3413
+ applyFontPrefix(fontsResources) {
3414
+ return fontsResources.map(fontResource => {
3415
+ return Object.assign(Object.assign({}, fontResource), { family: `${this.storyManager.config.fontPrefix}${fontResource.family}` });
3416
+ });
3417
+ }
3386
3418
  getResources(sessionDto) {
3387
3419
  if (sessionDto.cache && Array.isArray(sessionDto.cache))
3388
3420
  return sessionDto.cache;
@@ -4384,7 +4416,13 @@ let StorySlide = (() => {
4384
4416
  }
4385
4417
  constructor(storySlideDto) {
4386
4418
  var _b, _c;
4387
- _StorySlide__html_accessor_storage.set(this, (storySlide_runInitializers(this, _instanceExtraInitializers), storySlide_runInitializers(this, __html_initializers, "")));
4419
+ Object.defineProperty(this, "_rawHtml", {
4420
+ enumerable: true,
4421
+ configurable: true,
4422
+ writable: true,
4423
+ value: (storySlide_runInitializers(this, _instanceExtraInitializers), "")
4424
+ });
4425
+ _StorySlide__html_accessor_storage.set(this, storySlide_runInitializers(this, __html_initializers, ""));
4388
4426
  Object.defineProperty(this, "index", {
4389
4427
  enumerable: true,
4390
4428
  configurable: true,
@@ -4446,7 +4484,8 @@ let StorySlide = (() => {
4446
4484
  rangeEnd: resource.range_end,
4447
4485
  contentType: resource.content_type
4448
4486
  }))) !== null && _c !== void 0 ? _c : [];
4449
- this._html = this.replaceSlideNonce(storySlideDto.html);
4487
+ this._rawHtml = this.replaceSlideNonce(storySlideDto.html);
4488
+ this._html = this._rawHtml;
4450
4489
  }
4451
4490
  static createEmpty() {
4452
4491
  return new _a({
@@ -4460,8 +4499,12 @@ let StorySlide = (() => {
4460
4499
  html: ""
4461
4500
  });
4462
4501
  }
4502
+ applyFontPrefix(prefix) {
4503
+ this._rawHtml = applyInternalFontFamilyPrefix(this._rawHtml, prefix);
4504
+ this._html = this._rawHtml;
4505
+ }
4463
4506
  updatePlaceholders(placeholders) {
4464
- let slideHtml = this._html;
4507
+ let slideHtml = this._rawHtml;
4465
4508
  for (const placeholder of placeholders)
4466
4509
  slideHtml = replaceAll(slideHtml, `%${placeholder.key}%`, placeholder.value);
4467
4510
  this._html = slideHtml;
@@ -4594,7 +4637,7 @@ var story_classPrivateFieldSet = (undefined && undefined.__classPrivateFieldSet)
4594
4637
 
4595
4638
 
4596
4639
  let Story = (() => {
4597
- var _a, _Story__slidesLoaded_accessor_storage, _Story__error_accessor_storage, _Story__context_accessor_storage, _Story__like_accessor_storage, _Story__favorite_accessor_storage, _Story__shareUrl_accessor_storage, _Story__slides_accessor_storage, _Story__isOpened_accessor_storage, _Story__canBeShown_accessor_storage;
4640
+ var _a, _Story__slidesLoaded_accessor_storage, _Story__error_accessor_storage, _Story__context_accessor_storage, _Story__like_accessor_storage, _Story__favorite_accessor_storage, _Story__shareUrl_accessor_storage, _Story__slides_accessor_storage, _Story__isOpened_accessor_storage, _Story__canBeShown_accessor_storage, _Story__title_accessor_storage;
4598
4641
  let _instanceExtraInitializers = [];
4599
4642
  let __slidesLoaded_decorators;
4600
4643
  let __slidesLoaded_initializers = [];
@@ -4623,6 +4666,9 @@ let Story = (() => {
4623
4666
  let __canBeShown_decorators;
4624
4667
  let __canBeShown_initializers = [];
4625
4668
  let __canBeShown_extraInitializers = [];
4669
+ let __title_decorators;
4670
+ let __title_initializers = [];
4671
+ let __title_extraInitializers = [];
4626
4672
  let _setSlides_decorators;
4627
4673
  let _setCanBeShown_decorators;
4628
4674
  return _a = class Story {
@@ -4644,6 +4690,8 @@ let Story = (() => {
4644
4690
  set _isOpened(value) { story_classPrivateFieldSet(this, _Story__isOpened_accessor_storage, value, "f"); }
4645
4691
  get _canBeShown() { return story_classPrivateFieldGet(this, _Story__canBeShown_accessor_storage, "f"); }
4646
4692
  set _canBeShown(value) { story_classPrivateFieldSet(this, _Story__canBeShown_accessor_storage, value, "f"); }
4693
+ get _title() { return story_classPrivateFieldGet(this, _Story__title_accessor_storage, "f"); }
4694
+ set _title(value) { story_classPrivateFieldSet(this, _Story__title_accessor_storage, value, "f"); }
4647
4695
  constructor(storyDto) {
4648
4696
  var _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z;
4649
4697
  Object.defineProperty(this, "id", {
@@ -4775,7 +4823,7 @@ let Story = (() => {
4775
4823
  writable: true,
4776
4824
  value: {}
4777
4825
  });
4778
- Object.defineProperty(this, "_title", {
4826
+ Object.defineProperty(this, "_rawTitle", {
4779
4827
  enumerable: true,
4780
4828
  configurable: true,
4781
4829
  writable: true,
@@ -4820,10 +4868,12 @@ let Story = (() => {
4820
4868
  _Story__slides_accessor_storage.set(this, (story_runInitializers(this, __shareUrl_extraInitializers), story_runInitializers(this, __slides_initializers, [])));
4821
4869
  _Story__isOpened_accessor_storage.set(this, (story_runInitializers(this, __slides_extraInitializers), story_runInitializers(this, __isOpened_initializers, false)));
4822
4870
  _Story__canBeShown_accessor_storage.set(this, (story_runInitializers(this, __isOpened_extraInitializers), story_runInitializers(this, __canBeShown_initializers, false)));
4823
- story_runInitializers(this, __canBeShown_extraInitializers);
4871
+ _Story__title_accessor_storage.set(this, (story_runInitializers(this, __canBeShown_extraInitializers), story_runInitializers(this, __title_initializers, void 0)));
4872
+ story_runInitializers(this, __title_extraInitializers);
4824
4873
  this.id = storyDto.id;
4825
4874
  this._context = new StoryContext(this.id, { style: "", widgetsData: {} });
4826
- this._title = (_b = storyDto.title) !== null && _b !== void 0 ? _b : "";
4875
+ this._rawTitle = (_b = storyDto.title) !== null && _b !== void 0 ? _b : "";
4876
+ this._title = this._rawTitle;
4827
4877
  this._isOpened = (_c = storyDto.is_opened) !== null && _c !== void 0 ? _c : false;
4828
4878
  this.statTitle = (_d = storyDto.stat_title) !== null && _d !== void 0 ? _d : "";
4829
4879
  this.titleColor = (_e = storyDto.title_color) !== null && _e !== void 0 ? _e : "";
@@ -4941,6 +4991,10 @@ let Story = (() => {
4941
4991
  setShareUrl(shareUrl) {
4942
4992
  this._shareUrl = shareUrl;
4943
4993
  }
4994
+ applyFontPrefix(prefix) {
4995
+ for (const slide of this.slides)
4996
+ slide.applyFontPrefix(prefix);
4997
+ }
4944
4998
  updatePlaceholders(placeholders) {
4945
4999
  if (!this.needPlaceholders)
4946
5000
  return;
@@ -4952,7 +5006,7 @@ let Story = (() => {
4952
5006
  slide.updatePlaceholders(placeholders);
4953
5007
  }
4954
5008
  updateTitlePlaceholders(placeholders) {
4955
- let title = this._title;
5009
+ let title = this._rawTitle;
4956
5010
  for (const placeholder of placeholders)
4957
5011
  title = replaceAll(title, `%${placeholder.key}%`, placeholder.value);
4958
5012
  this._title = title;
@@ -4970,6 +5024,7 @@ let Story = (() => {
4970
5024
  _Story__slides_accessor_storage = new WeakMap(),
4971
5025
  _Story__isOpened_accessor_storage = new WeakMap(),
4972
5026
  _Story__canBeShown_accessor_storage = new WeakMap(),
5027
+ _Story__title_accessor_storage = new WeakMap(),
4973
5028
  (() => {
4974
5029
  const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(null) : void 0;
4975
5030
  __slidesLoaded_decorators = [__WEBPACK_EXTERNAL_MODULE_mobx_observable__];
@@ -4981,6 +5036,7 @@ let Story = (() => {
4981
5036
  __slides_decorators = [__WEBPACK_EXTERNAL_MODULE_mobx_observable__];
4982
5037
  __isOpened_decorators = [__WEBPACK_EXTERNAL_MODULE_mobx_observable__];
4983
5038
  __canBeShown_decorators = [__WEBPACK_EXTERNAL_MODULE_mobx_observable__];
5039
+ __title_decorators = [__WEBPACK_EXTERNAL_MODULE_mobx_observable__];
4984
5040
  _setSlides_decorators = [__WEBPACK_EXTERNAL_MODULE_mobx_action__];
4985
5041
  _setCanBeShown_decorators = [__WEBPACK_EXTERNAL_MODULE_mobx_action__];
4986
5042
  story_esDecorate(_a, null, __slidesLoaded_decorators, { kind: "accessor", name: "_slidesLoaded", static: false, private: false, access: { has: obj => "_slidesLoaded" in obj, get: obj => obj._slidesLoaded, set: (obj, value) => { obj._slidesLoaded = value; } }, metadata: _metadata }, __slidesLoaded_initializers, __slidesLoaded_extraInitializers);
@@ -4992,6 +5048,7 @@ let Story = (() => {
4992
5048
  story_esDecorate(_a, null, __slides_decorators, { kind: "accessor", name: "_slides", static: false, private: false, access: { has: obj => "_slides" in obj, get: obj => obj._slides, set: (obj, value) => { obj._slides = value; } }, metadata: _metadata }, __slides_initializers, __slides_extraInitializers);
4993
5049
  story_esDecorate(_a, null, __isOpened_decorators, { kind: "accessor", name: "_isOpened", static: false, private: false, access: { has: obj => "_isOpened" in obj, get: obj => obj._isOpened, set: (obj, value) => { obj._isOpened = value; } }, metadata: _metadata }, __isOpened_initializers, __isOpened_extraInitializers);
4994
5050
  story_esDecorate(_a, null, __canBeShown_decorators, { kind: "accessor", name: "_canBeShown", static: false, private: false, access: { has: obj => "_canBeShown" in obj, get: obj => obj._canBeShown, set: (obj, value) => { obj._canBeShown = value; } }, metadata: _metadata }, __canBeShown_initializers, __canBeShown_extraInitializers);
5051
+ story_esDecorate(_a, null, __title_decorators, { kind: "accessor", name: "_title", static: false, private: false, access: { has: obj => "_title" in obj, get: obj => obj._title, set: (obj, value) => { obj._title = value; } }, metadata: _metadata }, __title_initializers, __title_extraInitializers);
4995
5052
  story_esDecorate(_a, null, _setSlides_decorators, { kind: "method", name: "setSlides", static: false, private: false, access: { has: obj => "setSlides" in obj, get: obj => obj.setSlides }, metadata: _metadata }, null, _instanceExtraInitializers);
4996
5053
  story_esDecorate(_a, null, _setCanBeShown_decorators, { kind: "method", name: "setCanBeShown", static: false, private: false, access: { has: obj => "setCanBeShown" in obj, get: obj => obj.setCanBeShown }, metadata: _metadata }, null, _instanceExtraInitializers);
4997
5054
  if (_metadata) Object.defineProperty(_a, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
@@ -9818,7 +9875,7 @@ class GameClientConfig {
9818
9875
  value: void 0
9819
9876
  });
9820
9877
  const storyManagerConfig = this.storyManager.config;
9821
- const sdkVersion = "1.11.2";
9878
+ const sdkVersion = "1.11.4";
9822
9879
  const placeholders = this.storyManager.rootStore.placeholderStore.placeholders;
9823
9880
  const session = this.storyManager.rootStore.sessionStore.session;
9824
9881
  this.sessionId = session.id;
@@ -14389,6 +14446,12 @@ let StoryManagerConfig = (() => {
14389
14446
  writable: true,
14390
14447
  value: (storyManagerConfig_runInitializers(this, __options_extraInitializers), null)
14391
14448
  });
14449
+ Object.defineProperty(this, "_fontsPrefix", {
14450
+ enumerable: true,
14451
+ configurable: true,
14452
+ writable: true,
14453
+ value: ""
14454
+ });
14392
14455
  this.update(configDto);
14393
14456
  this._isInited = true;
14394
14457
  }
@@ -14431,6 +14494,9 @@ let StoryManagerConfig = (() => {
14431
14494
  get anonymous() {
14432
14495
  return this._anonymous;
14433
14496
  }
14497
+ get fontPrefix() {
14498
+ return this._fontsPrefix;
14499
+ }
14434
14500
  get options() {
14435
14501
  return this._options;
14436
14502
  }
@@ -14521,19 +14587,20 @@ let StoryManagerConfig = (() => {
14521
14587
  this._options = options;
14522
14588
  }
14523
14589
  update(configDto) {
14524
- var _b, _c, _d, _e, _f, _g;
14525
- this._appPackageId = (_b = configDto.appPackageId) !== null && _b !== void 0 ? _b : "";
14590
+ var _b, _c, _d, _e, _f, _g, _h;
14591
+ this._fontsPrefix = (_b = configDto.fontPrefix) !== null && _b !== void 0 ? _b : "";
14592
+ this._appPackageId = (_c = configDto.appPackageId) !== null && _c !== void 0 ? _c : "";
14526
14593
  this._disableDeviceId = Boolean(configDto.disableDeviceId);
14527
14594
  this.setOptions(configDto.options);
14528
14595
  this.setApiKey(configDto.apiKey).catch(console.error);
14529
14596
  this.setAnonymous(configDto.anonymous);
14530
- this.setUserId((_c = configDto.userId) !== null && _c !== void 0 ? _c : "", configDto.userIdSign).catch(console.error);
14597
+ this.setUserId((_d = configDto.userId) !== null && _d !== void 0 ? _d : "", configDto.userIdSign).catch(console.error);
14531
14598
  this.setLang(configDto.lang).catch(console.error);
14532
- this.setTextPlaceholders((_d = configDto.placeholders) !== null && _d !== void 0 ? _d : {});
14533
- this.setImagePlaceholders((_e = configDto.imagePlaceholders) !== null && _e !== void 0 ? _e : {});
14534
- this.setTags((_f = configDto.tags) !== null && _f !== void 0 ? _f : []);
14599
+ this.setTextPlaceholders((_e = configDto.placeholders) !== null && _e !== void 0 ? _e : {});
14600
+ this.setImagePlaceholders((_f = configDto.imagePlaceholders) !== null && _f !== void 0 ? _f : {});
14601
+ this.setTags((_g = configDto.tags) !== null && _g !== void 0 ? _g : []);
14535
14602
  this.setDir(configDto.dir);
14536
- this._cache = configDto.cache ? Object.assign(Object.assign({}, configDto.cache), { prefetch: (_g = configDto.cache.prefetch) !== null && _g !== void 0 ? _g : true }) : null;
14603
+ this._cache = configDto.cache ? Object.assign(Object.assign({}, configDto.cache), { prefetch: (_h = configDto.cache.prefetch) !== null && _h !== void 0 ? _h : true }) : null;
14537
14604
  }
14538
14605
  mapTextPlaceholders(textPlaceholderDtos) {
14539
14606
  const textPlaceholders = [];
@@ -14640,6 +14707,9 @@ class NullStoryManagerConfig {
14640
14707
  get anonymous() {
14641
14708
  return false;
14642
14709
  }
14710
+ get fontPrefix() {
14711
+ return "";
14712
+ }
14643
14713
  get options() {
14644
14714
  return {};
14645
14715
  }
@@ -15020,9 +15090,12 @@ let IamApi = (() => {
15020
15090
  });
15021
15091
  return response.data.messages;
15022
15092
  }
15023
- async fetchContext(messageIds) {
15093
+ async fetchContext({ needFetchStyles, messageIds }) {
15024
15094
  const response = await api.get("inappmessaging/message-context", {
15025
- params: { fields: "style,widgetsData", id: messageIds.join() }
15095
+ params: {
15096
+ fields: "widgetsData" + (needFetchStyles ? ",style" : ""),
15097
+ id: messageIds.join()
15098
+ }
15026
15099
  });
15027
15100
  return response.data;
15028
15101
  }
@@ -15428,13 +15501,6 @@ class IamAppearanceOptionsFactory {
15428
15501
 
15429
15502
 
15430
15503
  ;// ../core/src/domain/inAppMessaging/models/messageSlide/iamMessageSlide.ts
15431
- var iamMessageSlide_runInitializers = (undefined && undefined.__runInitializers) || function (thisArg, initializers, value) {
15432
- var useValue = arguments.length > 2;
15433
- for (var i = 0; i < initializers.length; i++) {
15434
- value = useValue ? initializers[i].call(thisArg, value) : initializers[i].call(thisArg);
15435
- }
15436
- return useValue ? value : void 0;
15437
- };
15438
15504
  var iamMessageSlide_esDecorate = (undefined && undefined.__esDecorate) || function (ctor, descriptorIn, decorators, contextIn, initializers, extraInitializers) {
15439
15505
  function accept(f) { if (f !== void 0 && typeof f !== "function") throw new TypeError("Function expected"); return f; }
15440
15506
  var kind = contextIn.kind, key = kind === "getter" ? "get" : kind === "setter" ? "set" : "value";
@@ -15462,6 +15528,13 @@ var iamMessageSlide_esDecorate = (undefined && undefined.__esDecorate) || functi
15462
15528
  if (target) Object.defineProperty(target, contextIn.name, descriptor);
15463
15529
  done = true;
15464
15530
  };
15531
+ var iamMessageSlide_runInitializers = (undefined && undefined.__runInitializers) || function (thisArg, initializers, value) {
15532
+ var useValue = arguments.length > 2;
15533
+ for (var i = 0; i < initializers.length; i++) {
15534
+ value = useValue ? initializers[i].call(thisArg, value) : initializers[i].call(thisArg);
15535
+ }
15536
+ return useValue ? value : void 0;
15537
+ };
15465
15538
  var iamMessageSlide_classPrivateFieldGet = (undefined && undefined.__classPrivateFieldGet) || function (receiver, state, kind, f) {
15466
15539
  if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
15467
15540
  if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
@@ -15477,11 +15550,9 @@ var iamMessageSlide_classPrivateFieldSet = (undefined && undefined.__classPrivat
15477
15550
 
15478
15551
  let IamMessageSlide = (() => {
15479
15552
  var _a, _IamMessageSlide__html_accessor_storage;
15480
- let _instanceExtraInitializers = [];
15481
15553
  let __html_decorators;
15482
15554
  let __html_initializers = [];
15483
15555
  let __html_extraInitializers = [];
15484
- let _get_html_decorators;
15485
15556
  return _a = class IamMessageSlide {
15486
15557
  get _html() { return iamMessageSlide_classPrivateFieldGet(this, _IamMessageSlide__html_accessor_storage, "f"); }
15487
15558
  set _html(value) { iamMessageSlide_classPrivateFieldSet(this, _IamMessageSlide__html_accessor_storage, value, "f"); }
@@ -15490,7 +15561,7 @@ let IamMessageSlide = (() => {
15490
15561
  enumerable: true,
15491
15562
  configurable: true,
15492
15563
  writable: true,
15493
- value: (iamMessageSlide_runInitializers(this, _instanceExtraInitializers), message)
15564
+ value: message
15494
15565
  });
15495
15566
  _IamMessageSlide__html_accessor_storage.set(this, iamMessageSlide_runInitializers(this, __html_initializers, ""));
15496
15567
  Object.defineProperty(this, "_payload", {
@@ -15499,6 +15570,12 @@ let IamMessageSlide = (() => {
15499
15570
  writable: true,
15500
15571
  value: iamMessageSlide_runInitializers(this, __html_extraInitializers)
15501
15572
  });
15573
+ Object.defineProperty(this, "_rawHtml", {
15574
+ enumerable: true,
15575
+ configurable: true,
15576
+ writable: true,
15577
+ value: ""
15578
+ });
15502
15579
  }
15503
15580
  get html() {
15504
15581
  return this._html;
@@ -15508,29 +15585,32 @@ let IamMessageSlide = (() => {
15508
15585
  }
15509
15586
  updateByDto(messageSlideDto) {
15510
15587
  var _b;
15511
- this._html = this.getSlideHtml(messageSlideDto);
15588
+ this._rawHtml = this.getSlideHtml(messageSlideDto);
15589
+ this._html = this._rawHtml;
15512
15590
  this._payload = (_b = messageSlideDto.event_payload) === null || _b === void 0 ? void 0 : _b.payload;
15513
15591
  }
15514
- getSlideHtml(messageSlideDto) {
15515
- var _b;
15516
- let slideHtml = messageSlideDto.html;
15517
- slideHtml = replaceAll(slideHtml, `{{nonce}}`, (_b = getNonce()) !== null && _b !== void 0 ? _b : "");
15518
- return slideHtml;
15592
+ applyFontPrefix(prefix) {
15593
+ this._rawHtml = applyInternalFontFamilyPrefix(this._rawHtml, prefix);
15594
+ this._html = this._rawHtml;
15519
15595
  }
15520
15596
  updatePlaceholders(placeholders) {
15521
- let slideHtml = this._html;
15597
+ let slideHtml = this._rawHtml;
15522
15598
  for (const placeholder of placeholders)
15523
15599
  slideHtml = replaceAll(slideHtml, `%${placeholder.key}%`, placeholder.value);
15524
15600
  this._html = slideHtml;
15525
15601
  }
15602
+ getSlideHtml(messageSlideDto) {
15603
+ var _b;
15604
+ let slideHtml = messageSlideDto.html;
15605
+ slideHtml = replaceAll(slideHtml, `{{nonce}}`, (_b = getNonce()) !== null && _b !== void 0 ? _b : "");
15606
+ return slideHtml;
15607
+ }
15526
15608
  },
15527
15609
  _IamMessageSlide__html_accessor_storage = new WeakMap(),
15528
15610
  (() => {
15529
15611
  const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(null) : void 0;
15530
15612
  __html_decorators = [__WEBPACK_EXTERNAL_MODULE_mobx_observable__];
15531
- _get_html_decorators = [__WEBPACK_EXTERNAL_MODULE_mobx_computed__];
15532
15613
  iamMessageSlide_esDecorate(_a, null, __html_decorators, { kind: "accessor", name: "_html", static: false, private: false, access: { has: obj => "_html" in obj, get: obj => obj._html, set: (obj, value) => { obj._html = value; } }, metadata: _metadata }, __html_initializers, __html_extraInitializers);
15533
- iamMessageSlide_esDecorate(_a, null, _get_html_decorators, { kind: "getter", name: "html", static: false, private: false, access: { has: obj => "html" in obj, get: obj => obj.html }, metadata: _metadata }, null, _instanceExtraInitializers);
15534
15614
  if (_metadata) Object.defineProperty(_a, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
15535
15615
  })(),
15536
15616
  _a;
@@ -15908,6 +15988,10 @@ let IamMessage = (() => {
15908
15988
  this._openTime = Date.now();
15909
15989
  return this._iterationId;
15910
15990
  }
15991
+ applyFontPrefix(prefix) {
15992
+ for (const slide of this._slides)
15993
+ slide.applyFontPrefix(prefix);
15994
+ }
15911
15995
  updatePlaceholders(placeholders) {
15912
15996
  for (const slide of this._slides)
15913
15997
  slide.updatePlaceholders(placeholders);
@@ -20060,11 +20144,11 @@ let IamStore = (() => {
20060
20144
  _IamStore__messages_accessor_storage.set(this, iamStore_runInitializers(this, __messages_initializers, __WEBPACK_EXTERNAL_MODULE_mobx_observable__.map()));
20061
20145
  _IamStore__isLoaded_accessor_storage.set(this, (iamStore_runInitializers(this, __messages_extraInitializers), iamStore_runInitializers(this, __isLoaded_initializers, false)));
20062
20146
  _IamStore__isLoading_accessor_storage.set(this, (iamStore_runInitializers(this, __isLoaded_extraInitializers), iamStore_runInitializers(this, __isLoading_initializers, false)));
20063
- Object.defineProperty(this, "_messageContext", {
20147
+ Object.defineProperty(this, "iamCSS", {
20064
20148
  enumerable: true,
20065
20149
  configurable: true,
20066
20150
  writable: true,
20067
- value: (iamStore_runInitializers(this, __isLoading_extraInitializers), null)
20151
+ value: (iamStore_runInitializers(this, __isLoading_extraInitializers), "")
20068
20152
  });
20069
20153
  }
20070
20154
  get messages() {
@@ -20076,9 +20160,6 @@ let IamStore = (() => {
20076
20160
  get isLoading() {
20077
20161
  return this._isLoading;
20078
20162
  }
20079
- get messageContext() {
20080
- return this._messageContext;
20081
- }
20082
20163
  async preload(params) {
20083
20164
  try {
20084
20165
  this._isLoaded = false;
@@ -20112,37 +20193,45 @@ let IamStore = (() => {
20112
20193
  }
20113
20194
  async fetchById(messageId) {
20114
20195
  await this.rootStore.sessionStore.open();
20115
- await this.fetchMessageContext({ messageIds: [messageId] });
20196
+ const messageContext = await this.fetchMessageContext({ messageIds: [messageId] });
20116
20197
  const messageDto = await this.iamApi.fetchById(messageId);
20117
- return this.createMessageByDto(messageDto);
20198
+ return this.createMessageByDto(messageDto, messageContext);
20118
20199
  }
20119
20200
  async fetchAll(params) {
20120
20201
  await this.rootStore.sessionStore.open();
20121
20202
  const config = this.rootStore.storyManagerConfigStore.config;
20122
20203
  const tags = params.tags ? params.tags : config.tags;
20123
20204
  const messageDtos = await this.iamApi.fetchAll({ tags: filterTags(tags), options: config.options });
20124
- await this.fetchMessageContext({ messageIds: messageDtos.map(message => message.id) });
20125
- return this.createMessagesByDtos(messageDtos);
20205
+ const messageContext = await this.fetchMessageContext({
20206
+ messageIds: messageDtos.map(message => message.id)
20207
+ });
20208
+ return this.createMessagesByDtos(messageDtos, messageContext);
20126
20209
  }
20127
20210
  async fetchMessageContext({ messageIds }) {
20128
20211
  await this.rootStore.sessionStore.open();
20129
- if (!this._messageContext)
20130
- this._messageContext = await this.iamApi.fetchContext(messageIds);
20212
+ const messageContextDto = await this.iamApi.fetchContext({
20213
+ needFetchStyles: !this.iamCSS,
20214
+ messageIds
20215
+ });
20216
+ if (!this.iamCSS && messageContextDto.style) {
20217
+ this.iamCSS = applyInternalFontFamilyPrefix(messageContextDto.style, this.rootStore.storyManagerConfigStore.config.fontPrefix);
20218
+ }
20219
+ messageContextDto.style = this.iamCSS;
20220
+ return messageContextDto;
20131
20221
  }
20132
- createMessagesByDtos(messageDtos) {
20222
+ createMessagesByDtos(messageDtos, messageContext) {
20133
20223
  this._messages.clear();
20134
20224
  const messages = [];
20135
20225
  for (const messageDto of messageDtos) {
20136
- const message = this.createMessageByDto(messageDto);
20226
+ const message = this.createMessageByDto(messageDto, messageContext);
20137
20227
  messages.push(message);
20138
20228
  }
20139
20229
  return messages;
20140
20230
  }
20141
- createMessageByDto(messageDto) {
20142
- if (!this.messageContext)
20143
- throw new Error("[IAS]: IAM context not found");
20231
+ createMessageByDto(messageDto, messageContext) {
20144
20232
  const message = IamMessage.createByDto(messageDto);
20145
- const context = new IamMessageContext(messageDto.id, this.messageContext);
20233
+ const context = new IamMessageContext(messageDto.id, messageContext);
20234
+ message.applyFontPrefix(this.rootStore.storyManagerConfigStore.config.fontPrefix);
20146
20235
  message.setContext(context);
20147
20236
  if (!this._messages.has(message.id.toString()))
20148
20237
  this._messages.set(message.id.toString(), message);
@@ -20277,7 +20366,7 @@ let SessionStore = (() => {
20277
20366
  userIdSign: config.userIdSign,
20278
20367
  anonymous: config.anonymous
20279
20368
  });
20280
- const session = new Session(this, sessionDto);
20369
+ const session = new Session(this.storyManager, this, sessionDto);
20281
20370
  session.loadResources();
20282
20371
  this.updatePlaceholders(session);
20283
20372
  this._session = session;
@@ -20419,6 +20508,7 @@ let StoryStore = (() => {
20419
20508
  if (storiesById.has(storyDto.id))
20420
20509
  return storiesById.get(storyDto.id);
20421
20510
  const story = new Story(storyDto);
20511
+ story.applyFontPrefix(this.storyManager.config.fontPrefix);
20422
20512
  story.updatePlaceholders(this.rootStore.placeholderStore.placeholders);
20423
20513
  storiesById.set(storyDto.id, story);
20424
20514
  return story;
@@ -20502,6 +20592,7 @@ let StoryStore = (() => {
20502
20592
  story.setContext(storyContext);
20503
20593
  const storyDto = await this.storiesApi.fetchStorySlides({ id: story.id, feedSlug });
20504
20594
  story.setSlides((_b = storyDto.slides) !== null && _b !== void 0 ? _b : []);
20595
+ story.applyFontPrefix(this.storyManager.config.fontPrefix);
20505
20596
  story.updatePlaceholders(this.rootStore.placeholderStore.placeholders);
20506
20597
  await sleep(startAt);
20507
20598
  story.setCanBeShown(true);
@@ -20515,6 +20606,7 @@ let StoryStore = (() => {
20515
20606
  const storyDto = await this.storiesApi.fetchStory({ id: storyId, feedSlug, fetchShareUrl, once });
20516
20607
  const story = this.addStoryByDto(storyDto);
20517
20608
  story.setSlides((_b = storyDto.slides) !== null && _b !== void 0 ? _b : []);
20609
+ story.applyFontPrefix(this.storyManager.config.fontPrefix);
20518
20610
  story.updatePlaceholders(this.rootStore.placeholderStore.placeholders);
20519
20611
  return story;
20520
20612
  }
@@ -20522,6 +20614,7 @@ let StoryStore = (() => {
20522
20614
  if (this.storyCSS)
20523
20615
  return;
20524
20616
  this.storyCSS = await this.storiesApi.fetchStoryCSS();
20617
+ this.storyCSS = applyInternalFontFamilyPrefix(this.storyCSS, this.storyManager.config.fontPrefix);
20525
20618
  }
20526
20619
  async fetchStoryContext({ id, feedSlug }) {
20527
20620
  const storyContextDto = await this.storiesApi.fetchStoryContext({
@@ -20906,7 +20999,7 @@ class UgcEditorStore {
20906
20999
  const session = await this.storyManager.rootStore.sessionStore.open();
20907
21000
  const ugcEditorConfigDto = await this.ugcEditorApi.fetchUgcEditorConfig();
20908
21001
  const storyManagerConfig = this.storyManager.config;
20909
- const sdkVersion = "1.11.2";
21002
+ const sdkVersion = "1.11.4";
20910
21003
  this._config = {
20911
21004
  sessionId: session.id,
20912
21005
  apiKey: storyManagerConfig.apiKey,
@@ -21366,11 +21459,11 @@ class StoryManager extends TypedEventEmitter {
21366
21459
  return deviceDescriptor.deviceId;
21367
21460
  }
21368
21461
  get sdkVersionName() {
21369
- const sdkVersionName = "1.11.2";
21462
+ const sdkVersionName = "1.11.4";
21370
21463
  return sdkVersionName || "0.0.0";
21371
21464
  }
21372
21465
  get sdkVersionCode() {
21373
- const sdkVersionCode = 11102;
21466
+ const sdkVersionCode = 11104;
21374
21467
  return sdkVersionCode ? parseInt(sdkVersionCode) : 0;
21375
21468
  }
21376
21469
  get lang() {
@@ -21434,7 +21527,7 @@ class StoryManager extends TypedEventEmitter {
21434
21527
  this.rootStore.storyManagerConfigStore.setConfig(configDto);
21435
21528
  }
21436
21529
  setUserAgent(userAgent) {
21437
- const sdkVersionCode = 11102;
21530
+ const sdkVersionCode = 11104;
21438
21531
  const buildVersion = sdkVersionCode ? parseInt(sdkVersionCode) : 0;
21439
21532
  // According to RFC5987, HTTP header values can legitimately be supplied using the ISO-8859-1 encoding.
21440
21533
  this._userAgent = `${userAgent} ${convertStrToLatin1(navigator.userAgent)}`;
@@ -29430,7 +29523,9 @@ const useStoryListImperativeHandle = (ref, storyListViewModel) => {
29430
29523
 
29431
29524
 
29432
29525
 
29526
+
29433
29527
  const StoryListWrapper = __WEBPACK_EXTERNAL_MODULE_react_forwardRef__((props, ref) => {
29528
+ const { storyManager } = useIASProvider();
29434
29529
  const cardOptions = props.sliderOptions.card;
29435
29530
  const favoriteCardOptions = props.sliderOptions.favoriteCard;
29436
29531
  const cardBorderOptions = cardOptions.border;
@@ -29486,7 +29581,7 @@ const StoryListWrapper = __WEBPACK_EXTERNAL_MODULE_react_forwardRef__((props, re
29486
29581
  : favoriteCardOptions.gap,
29487
29582
  "--storiesListCardUgcMaskColor": props.sliderOptions.ugcCard.mask.color,
29488
29583
  "--storiesListCardUgcMaskLinearGradient": composeCardMaskLinearGradient(props.sliderOptions.ugcCard.mask),
29489
- "--storiesListItemTitleFontFamily": "InternalPrimaryFont",
29584
+ "--storiesListItemTitleFontFamily": `${storyManager.config.fontPrefix}InternalPrimaryFont`,
29490
29585
  "--storiesListItemTitleFont": cardOptions.title.font,
29491
29586
  "--storiesListItemTitlePadding": isNumeric(cardOptions.title.padding.toString())
29492
29587
  ? cardOptions.title.padding + "px"