@capillarytech/creatives-library 9.0.35 → 9.0.36

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.
Files changed (51) hide show
  1. package/app.js +175 -10
  2. package/entry.js +1 -67
  3. package/mfe-exposed-components.js +4 -2
  4. package/package.json +2 -2
  5. package/services/api.js +1 -9
  6. package/styles/containers/layout/_layoutPage.scss +6 -8
  7. package/utils/gtmTrackers/gtmEvents/creativeDetails.js +1 -2
  8. package/utils/rcsPayloadUtils.js +2 -5
  9. package/utils/tests/rcsPayloadUtils.test.js +2 -54
  10. package/v2Components/CapActionButton/constants.js +0 -1
  11. package/v2Components/CapActionButton/index.js +9 -77
  12. package/v2Components/CapActionButton/index.scss +0 -13
  13. package/v2Components/CapActionButton/messages.js +0 -13
  14. package/v2Components/CapActionButton/tests/index.test.js +1 -32
  15. package/v2Components/CommonTestAndPreview/index.js +15 -44
  16. package/v2Components/CommonTestAndPreview/tests/index.test.js +0 -78
  17. package/v2Components/CommonTestAndPreview/utils.js +0 -34
  18. package/v2Components/NavigationBar/index.js +7 -9
  19. package/v2Components/NavigationBar/tests/index.test.js +19 -39
  20. package/v2Components/SmsFallback/index.js +0 -6
  21. package/v2Containers/Cap/constants.js +0 -1
  22. package/v2Containers/Cap/index.js +27 -57
  23. package/v2Containers/CreativesContainer/index.js +8 -11
  24. package/v2Containers/CreativesContainer/tests/index.test.js +0 -53
  25. package/v2Containers/Rcs/carouselUtils.js +73 -46
  26. package/v2Containers/Rcs/components/CarouselCard.js +9 -11
  27. package/v2Containers/Rcs/components/CarouselCardButtons.js +0 -20
  28. package/v2Containers/Rcs/constants.js +7 -2
  29. package/v2Containers/Rcs/index.js +205 -226
  30. package/v2Containers/Rcs/rcsLibraryHydrationUtils.js +47 -60
  31. package/v2Containers/Rcs/tests/CarouselCard.test.js +2 -1
  32. package/v2Containers/Rcs/tests/__snapshots__/index.test.js.snap +0 -286
  33. package/v2Containers/Rcs/tests/carouselUtils.test.js +32 -28
  34. package/v2Containers/Rcs/tests/index.test.js +238 -151
  35. package/v2Containers/Rcs/tests/rcsLibraryHydrationUtils.test.js +0 -110
  36. package/v2Containers/Rcs/tests/utils.test.js +17 -36
  37. package/v2Containers/Rcs/utils.js +55 -28
  38. package/v2Containers/SmsTrai/Edit/index.js +24 -35
  39. package/v2Containers/Templates/_templates.scss +1 -1
  40. package/v2Containers/Templates/index.js +0 -1
  41. package/v2Containers/Templates/tests/__snapshots__/index.test.js.snap +0 -5
  42. package/v2Containers/TemplatesV2/TemplatesV2.style.js +3 -8
  43. package/v2Containers/TemplatesV2/index.js +9 -22
  44. package/AppRoot.js +0 -124
  45. package/app-config.js +0 -61
  46. package/bootstrap.js +0 -185
  47. package/utils/getDataLayer.js +0 -15
  48. package/utils/mfeDetect.js +0 -1
  49. package/utils/mfeFirstPaintReady.js +0 -29
  50. package/utils/mfeHistory.js +0 -62
  51. package/v2Components/NavigationBar/mfeModuleHeader.config.js +0 -16
@@ -6782,23 +6782,10 @@ new message content.",
6782
6782
  buttonType="NONE"
6783
6783
  deleteButtonHandler={[Function]}
6784
6784
  host=""
6785
- injectedTags={Object {}}
6786
6785
  isEditFlow={false}
6787
6786
  isFullMode={true}
6788
- location={
6789
- Object {
6790
- "pathname": "/rcs/create",
6791
- "query": Object {
6792
- "module": "default",
6793
- "type": false,
6794
- },
6795
- "search": "",
6796
- }
6797
- }
6798
6787
  maxButtons={4}
6799
- onContextChange={[Function]}
6800
6788
  suggestions={Array []}
6801
- tags={Array []}
6802
6789
  updateButtonChange={[Function]}
6803
6790
  >
6804
6791
  <div
@@ -6806,23 +6793,10 @@ new message content.",
6806
6793
  className="cap-action-button-mock"
6807
6794
  deleteButtonHandler={[Function]}
6808
6795
  host=""
6809
- injectedTags={Object {}}
6810
6796
  isEditFlow={false}
6811
6797
  isFullMode={true}
6812
- location={
6813
- Object {
6814
- "pathname": "/rcs/create",
6815
- "query": Object {
6816
- "module": "default",
6817
- "type": false,
6818
- },
6819
- "search": "",
6820
- }
6821
- }
6822
6798
  maxButtons={4}
6823
- onContextChange={[Function]}
6824
6799
  suggestions={Array []}
6825
- tags={Array []}
6826
6800
  updateButtonChange={[Function]}
6827
6801
  >
6828
6802
  CapActionButton
@@ -22699,23 +22673,10 @@ new message content.",
22699
22673
  buttonType="NONE"
22700
22674
  deleteButtonHandler={[Function]}
22701
22675
  host=""
22702
- injectedTags={Object {}}
22703
22676
  isEditFlow={false}
22704
22677
  isFullMode={true}
22705
- location={
22706
- Object {
22707
- "pathname": "/rcs/create",
22708
- "query": Object {
22709
- "module": "default",
22710
- "type": false,
22711
- },
22712
- "search": "",
22713
- }
22714
- }
22715
22678
  maxButtons={4}
22716
- onContextChange={[Function]}
22717
22679
  suggestions={Array []}
22718
- tags={Array []}
22719
22680
  updateButtonChange={[Function]}
22720
22681
  >
22721
22682
  <div
@@ -22723,23 +22684,10 @@ new message content.",
22723
22684
  className="cap-action-button-mock"
22724
22685
  deleteButtonHandler={[Function]}
22725
22686
  host=""
22726
- injectedTags={Object {}}
22727
22687
  isEditFlow={false}
22728
22688
  isFullMode={true}
22729
- location={
22730
- Object {
22731
- "pathname": "/rcs/create",
22732
- "query": Object {
22733
- "module": "default",
22734
- "type": false,
22735
- },
22736
- "search": "",
22737
- }
22738
- }
22739
22689
  maxButtons={4}
22740
- onContextChange={[Function]}
22741
22690
  suggestions={Array []}
22742
- tags={Array []}
22743
22691
  updateButtonChange={[Function]}
22744
22692
  >
22745
22693
  CapActionButton
@@ -38790,23 +38738,10 @@ new message content.",
38790
38738
  buttonType="NONE"
38791
38739
  deleteButtonHandler={[Function]}
38792
38740
  host=""
38793
- injectedTags={Object {}}
38794
38741
  isEditFlow={false}
38795
38742
  isFullMode={true}
38796
- location={
38797
- Object {
38798
- "pathname": "/rcs/create",
38799
- "query": Object {
38800
- "module": "default",
38801
- "type": false,
38802
- },
38803
- "search": "",
38804
- }
38805
- }
38806
38743
  maxButtons={4}
38807
- onContextChange={[Function]}
38808
38744
  suggestions={Array []}
38809
- tags={Array []}
38810
38745
  updateButtonChange={[Function]}
38811
38746
  >
38812
38747
  <div
@@ -38814,23 +38749,10 @@ new message content.",
38814
38749
  className="cap-action-button-mock"
38815
38750
  deleteButtonHandler={[Function]}
38816
38751
  host=""
38817
- injectedTags={Object {}}
38818
38752
  isEditFlow={false}
38819
38753
  isFullMode={true}
38820
- location={
38821
- Object {
38822
- "pathname": "/rcs/create",
38823
- "query": Object {
38824
- "module": "default",
38825
- "type": false,
38826
- },
38827
- "search": "",
38828
- }
38829
- }
38830
38754
  maxButtons={4}
38831
- onContextChange={[Function]}
38832
38755
  suggestions={Array []}
38833
- tags={Array []}
38834
38756
  updateButtonChange={[Function]}
38835
38757
  >
38836
38758
  CapActionButton
@@ -55471,23 +55393,10 @@ new message content.",
55471
55393
  buttonType="NONE"
55472
55394
  deleteButtonHandler={[Function]}
55473
55395
  host=""
55474
- injectedTags={Object {}}
55475
55396
  isEditFlow={false}
55476
55397
  isFullMode={true}
55477
- location={
55478
- Object {
55479
- "pathname": "/rcs/create",
55480
- "query": Object {
55481
- "module": "default",
55482
- "type": false,
55483
- },
55484
- "search": "",
55485
- }
55486
- }
55487
55398
  maxButtons={4}
55488
- onContextChange={[Function]}
55489
55399
  suggestions={Array []}
55490
- tags={Array []}
55491
55400
  updateButtonChange={[Function]}
55492
55401
  >
55493
55402
  <div
@@ -55495,23 +55404,10 @@ new message content.",
55495
55404
  className="cap-action-button-mock"
55496
55405
  deleteButtonHandler={[Function]}
55497
55406
  host=""
55498
- injectedTags={Object {}}
55499
55407
  isEditFlow={false}
55500
55408
  isFullMode={true}
55501
- location={
55502
- Object {
55503
- "pathname": "/rcs/create",
55504
- "query": Object {
55505
- "module": "default",
55506
- "type": false,
55507
- },
55508
- "search": "",
55509
- }
55510
- }
55511
55409
  maxButtons={4}
55512
- onContextChange={[Function]}
55513
55410
  suggestions={Array []}
55514
- tags={Array []}
55515
55411
  updateButtonChange={[Function]}
55516
55412
  >
55517
55413
  CapActionButton
@@ -72184,23 +72080,10 @@ new message content.",
72184
72080
  buttonType="NONE"
72185
72081
  deleteButtonHandler={[Function]}
72186
72082
  host=""
72187
- injectedTags={Object {}}
72188
72083
  isEditFlow={false}
72189
72084
  isFullMode={true}
72190
- location={
72191
- Object {
72192
- "pathname": "/rcs/create",
72193
- "query": Object {
72194
- "module": "default",
72195
- "type": false,
72196
- },
72197
- "search": "",
72198
- }
72199
- }
72200
72085
  maxButtons={4}
72201
- onContextChange={[Function]}
72202
72086
  suggestions={Array []}
72203
- tags={Array []}
72204
72087
  updateButtonChange={[Function]}
72205
72088
  >
72206
72089
  <div
@@ -72208,23 +72091,10 @@ new message content.",
72208
72091
  className="cap-action-button-mock"
72209
72092
  deleteButtonHandler={[Function]}
72210
72093
  host=""
72211
- injectedTags={Object {}}
72212
72094
  isEditFlow={false}
72213
72095
  isFullMode={true}
72214
- location={
72215
- Object {
72216
- "pathname": "/rcs/create",
72217
- "query": Object {
72218
- "module": "default",
72219
- "type": false,
72220
- },
72221
- "search": "",
72222
- }
72223
- }
72224
72096
  maxButtons={4}
72225
- onContextChange={[Function]}
72226
72097
  suggestions={Array []}
72227
- tags={Array []}
72228
72098
  updateButtonChange={[Function]}
72229
72099
  >
72230
72100
  CapActionButton
@@ -90303,23 +90173,10 @@ new message content.",
90303
90173
  buttonType="NONE"
90304
90174
  deleteButtonHandler={[Function]}
90305
90175
  host=""
90306
- injectedTags={Object {}}
90307
90176
  isEditFlow={false}
90308
90177
  isFullMode={true}
90309
- location={
90310
- Object {
90311
- "pathname": "/rcs/create",
90312
- "query": Object {
90313
- "module": "default",
90314
- "type": false,
90315
- },
90316
- "search": "",
90317
- }
90318
- }
90319
90178
  maxButtons={4}
90320
- onContextChange={[Function]}
90321
90179
  suggestions={Array []}
90322
- tags={Array []}
90323
90180
  updateButtonChange={[Function]}
90324
90181
  >
90325
90182
  <div
@@ -90327,23 +90184,10 @@ new message content.",
90327
90184
  className="cap-action-button-mock"
90328
90185
  deleteButtonHandler={[Function]}
90329
90186
  host=""
90330
- injectedTags={Object {}}
90331
90187
  isEditFlow={false}
90332
90188
  isFullMode={true}
90333
- location={
90334
- Object {
90335
- "pathname": "/rcs/create",
90336
- "query": Object {
90337
- "module": "default",
90338
- "type": false,
90339
- },
90340
- "search": "",
90341
- }
90342
- }
90343
90189
  maxButtons={4}
90344
- onContextChange={[Function]}
90345
90190
  suggestions={Array []}
90346
- tags={Array []}
90347
90191
  updateButtonChange={[Function]}
90348
90192
  >
90349
90193
  CapActionButton
@@ -110175,23 +110019,10 @@ new message content.",
110175
110019
  buttonType="NONE"
110176
110020
  deleteButtonHandler={[Function]}
110177
110021
  host=""
110178
- injectedTags={Object {}}
110179
110022
  isEditFlow={false}
110180
110023
  isFullMode={true}
110181
- location={
110182
- Object {
110183
- "pathname": "/rcs/create",
110184
- "query": Object {
110185
- "module": "default",
110186
- "type": false,
110187
- },
110188
- "search": "",
110189
- }
110190
- }
110191
110024
  maxButtons={4}
110192
- onContextChange={[Function]}
110193
110025
  suggestions={Array []}
110194
- tags={Array []}
110195
110026
  updateButtonChange={[Function]}
110196
110027
  >
110197
110028
  <div
@@ -110199,23 +110030,10 @@ new message content.",
110199
110030
  className="cap-action-button-mock"
110200
110031
  deleteButtonHandler={[Function]}
110201
110032
  host=""
110202
- injectedTags={Object {}}
110203
110033
  isEditFlow={false}
110204
110034
  isFullMode={true}
110205
- location={
110206
- Object {
110207
- "pathname": "/rcs/create",
110208
- "query": Object {
110209
- "module": "default",
110210
- "type": false,
110211
- },
110212
- "search": "",
110213
- }
110214
- }
110215
110035
  maxButtons={4}
110216
- onContextChange={[Function]}
110217
110036
  suggestions={Array []}
110218
- tags={Array []}
110219
110037
  updateButtonChange={[Function]}
110220
110038
  >
110221
110039
  CapActionButton
@@ -129286,23 +129104,10 @@ new message content.",
129286
129104
  buttonType="NONE"
129287
129105
  deleteButtonHandler={[Function]}
129288
129106
  host=""
129289
- injectedTags={Object {}}
129290
129107
  isEditFlow={false}
129291
129108
  isFullMode={true}
129292
- location={
129293
- Object {
129294
- "pathname": "/rcs/create",
129295
- "query": Object {
129296
- "module": "default",
129297
- "type": false,
129298
- },
129299
- "search": "",
129300
- }
129301
- }
129302
129109
  maxButtons={4}
129303
- onContextChange={[Function]}
129304
129110
  suggestions={Array []}
129305
- tags={Array []}
129306
129111
  updateButtonChange={[Function]}
129307
129112
  >
129308
129113
  <div
@@ -129310,23 +129115,10 @@ new message content.",
129310
129115
  className="cap-action-button-mock"
129311
129116
  deleteButtonHandler={[Function]}
129312
129117
  host=""
129313
- injectedTags={Object {}}
129314
129118
  isEditFlow={false}
129315
129119
  isFullMode={true}
129316
- location={
129317
- Object {
129318
- "pathname": "/rcs/create",
129319
- "query": Object {
129320
- "module": "default",
129321
- "type": false,
129322
- },
129323
- "search": "",
129324
- }
129325
- }
129326
129120
  maxButtons={4}
129327
- onContextChange={[Function]}
129328
129121
  suggestions={Array []}
129329
- tags={Array []}
129330
129122
  updateButtonChange={[Function]}
129331
129123
  >
129332
129124
  CapActionButton
@@ -148051,23 +147843,10 @@ new message content.",
148051
147843
  buttonType="NONE"
148052
147844
  deleteButtonHandler={[Function]}
148053
147845
  host=""
148054
- injectedTags={Object {}}
148055
147846
  isEditFlow={false}
148056
147847
  isFullMode={true}
148057
- location={
148058
- Object {
148059
- "pathname": "/rcs/create",
148060
- "query": Object {
148061
- "module": "default",
148062
- "type": false,
148063
- },
148064
- "search": "",
148065
- }
148066
- }
148067
147848
  maxButtons={4}
148068
- onContextChange={[Function]}
148069
147849
  suggestions={Array []}
148070
- tags={Array []}
148071
147850
  updateButtonChange={[Function]}
148072
147851
  >
148073
147852
  <div
@@ -148075,23 +147854,10 @@ new message content.",
148075
147854
  className="cap-action-button-mock"
148076
147855
  deleteButtonHandler={[Function]}
148077
147856
  host=""
148078
- injectedTags={Object {}}
148079
147857
  isEditFlow={false}
148080
147858
  isFullMode={true}
148081
- location={
148082
- Object {
148083
- "pathname": "/rcs/create",
148084
- "query": Object {
148085
- "module": "default",
148086
- "type": false,
148087
- },
148088
- "search": "",
148089
- }
148090
- }
148091
147859
  maxButtons={4}
148092
- onContextChange={[Function]}
148093
147860
  suggestions={Array []}
148094
- tags={Array []}
148095
147861
  updateButtonChange={[Function]}
148096
147862
  >
148097
147863
  CapActionButton
@@ -163948,23 +163714,10 @@ new message content.",
163948
163714
  buttonType="NONE"
163949
163715
  deleteButtonHandler={[Function]}
163950
163716
  host=""
163951
- injectedTags={Object {}}
163952
163717
  isEditFlow={false}
163953
163718
  isFullMode={true}
163954
- location={
163955
- Object {
163956
- "pathname": "/rcs/create",
163957
- "query": Object {
163958
- "module": "default",
163959
- "type": false,
163960
- },
163961
- "search": "",
163962
- }
163963
- }
163964
163719
  maxButtons={4}
163965
- onContextChange={[Function]}
163966
163720
  suggestions={Array []}
163967
- tags={Array []}
163968
163721
  updateButtonChange={[Function]}
163969
163722
  >
163970
163723
  <div
@@ -163972,23 +163725,10 @@ new message content.",
163972
163725
  className="cap-action-button-mock"
163973
163726
  deleteButtonHandler={[Function]}
163974
163727
  host=""
163975
- injectedTags={Object {}}
163976
163728
  isEditFlow={false}
163977
163729
  isFullMode={true}
163978
- location={
163979
- Object {
163980
- "pathname": "/rcs/create",
163981
- "query": Object {
163982
- "module": "default",
163983
- "type": false,
163984
- },
163985
- "search": "",
163986
- }
163987
- }
163988
163730
  maxButtons={4}
163989
- onContextChange={[Function]}
163990
163731
  suggestions={Array []}
163991
- tags={Array []}
163992
163732
  updateButtonChange={[Function]}
163993
163733
  >
163994
163734
  CapActionButton
@@ -179845,23 +179585,10 @@ new message content.",
179845
179585
  buttonType="NONE"
179846
179586
  deleteButtonHandler={[Function]}
179847
179587
  host=""
179848
- injectedTags={Object {}}
179849
179588
  isEditFlow={false}
179850
179589
  isFullMode={true}
179851
- location={
179852
- Object {
179853
- "pathname": "/rcs/create",
179854
- "query": Object {
179855
- "module": "default",
179856
- "type": false,
179857
- },
179858
- "search": "",
179859
- }
179860
- }
179861
179590
  maxButtons={4}
179862
- onContextChange={[Function]}
179863
179591
  suggestions={Array []}
179864
- tags={Array []}
179865
179592
  updateButtonChange={[Function]}
179866
179593
  >
179867
179594
  <div
@@ -179869,23 +179596,10 @@ new message content.",
179869
179596
  className="cap-action-button-mock"
179870
179597
  deleteButtonHandler={[Function]}
179871
179598
  host=""
179872
- injectedTags={Object {}}
179873
179599
  isEditFlow={false}
179874
179600
  isFullMode={true}
179875
- location={
179876
- Object {
179877
- "pathname": "/rcs/create",
179878
- "query": Object {
179879
- "module": "default",
179880
- "type": false,
179881
- },
179882
- "search": "",
179883
- }
179884
- }
179885
179601
  maxButtons={4}
179886
- onContextChange={[Function]}
179887
179602
  suggestions={Array []}
179888
- tags={Array []}
179889
179603
  updateButtonChange={[Function]}
179890
179604
  >
179891
179605
  CapActionButton
@@ -554,13 +554,15 @@ describe('buildCarouselCardsForPreview', () => {
554
554
  expect(
555
555
  buildCarouselCardsForPreview(undefined, {
556
556
  isFullMode: false,
557
- resolveCarouselTemplateWithMap: jest.fn(),
557
+ rcsVarRegex,
558
+ resolveTemplateWithMap: jest.fn(),
558
559
  }),
559
560
  ).toEqual([]);
560
561
  expect(
561
562
  buildCarouselCardsForPreview([], {
562
563
  isFullMode: false,
563
- resolveCarouselTemplateWithMap: jest.fn(),
564
+ rcsVarRegex,
565
+ resolveTemplateWithMap: jest.fn(),
564
566
  }),
565
567
  ).toEqual([]);
566
568
  });
@@ -569,45 +571,47 @@ describe('buildCarouselCardsForPreview', () => {
569
571
  expect(
570
572
  buildCarouselCardsForPreview(null, {
571
573
  isFullMode: false,
572
- resolveCarouselTemplateWithMap: jest.fn(),
574
+ rcsVarRegex,
575
+ resolveTemplateWithMap: jest.fn(),
573
576
  }),
574
577
  ).toEqual([]);
575
578
  });
576
579
 
577
- it('passes title/description through unresolved in full mode without calling resolveCarouselTemplateWithMap', () => {
578
- const resolveCarouselTemplateWithMap = jest.fn();
580
+ it('passes title/description through unresolved in full mode without calling resolveTemplateWithMap', () => {
581
+ const resolveTemplateWithMap = jest.fn();
579
582
  const out = buildCarouselCardsForPreview(
580
583
  [{ title: 'Hi {{a}}', description: 'Bye {{b}}' }],
581
- { isFullMode: true, resolveCarouselTemplateWithMap },
584
+ { isFullMode: true, rcsVarRegex, resolveTemplateWithMap },
582
585
  );
583
- expect(resolveCarouselTemplateWithMap).not.toHaveBeenCalled();
586
+ expect(resolveTemplateWithMap).not.toHaveBeenCalled();
584
587
  expect(out[0].title).toBe('Hi {{a}}');
585
588
  expect(out[0].bodyText).toBe('Bye {{b}}');
586
589
  });
587
590
 
588
- it('resolves title/description through resolveCarouselTemplateWithMap, scoped per card index', () => {
589
- const resolveCarouselTemplateWithMap = jest.fn((str, cardIndex) => `R(${str}|${cardIndex})`);
591
+ it('resolves title/description through resolveCarouselTemplateWithMap, scoped per card index and field', () => {
592
+ const resolveCarouselTemplateWithMap = jest.fn((str, cardIndex, isDescField) => `R(${str}|${cardIndex}|${isDescField})`);
590
593
  const out = buildCarouselCardsForPreview(
591
594
  [
592
595
  { title: 'Hi {{a}}', description: 'Bye {{b}} {{c}}' },
593
596
  { title: 'Solo {{d}}', description: 'none' },
594
597
  ],
595
- { isFullMode: false, resolveCarouselTemplateWithMap },
598
+ { isFullMode: false, rcsVarRegex, resolveTemplateWithMap },
596
599
  );
597
- expect(resolveCarouselTemplateWithMap).toHaveBeenNthCalledWith(1, 'Hi {{a}}', 0);
598
- expect(resolveCarouselTemplateWithMap).toHaveBeenNthCalledWith(2, 'Bye {{b}} {{c}}', 0);
599
- expect(resolveCarouselTemplateWithMap).toHaveBeenNthCalledWith(3, 'Solo {{d}}', 1);
600
- expect(resolveCarouselTemplateWithMap).toHaveBeenNthCalledWith(4, 'none', 1);
601
- expect(out[0].title).toBe('R(Hi {{a}}|0)');
602
- expect(out[0].bodyText).toBe('R(Bye {{b}} {{c}}|0)');
603
- expect(out[1].title).toBe('R(Solo {{d}}|1)');
604
- expect(out[1].bodyText).toBe('R(none|1)');
600
+ expect(resolveCarouselTemplateWithMap).toHaveBeenNthCalledWith(1, 'Hi {{a}}', 0, false);
601
+ expect(resolveCarouselTemplateWithMap).toHaveBeenNthCalledWith(2, 'Bye {{b}} {{c}}', 0, true);
602
+ expect(resolveCarouselTemplateWithMap).toHaveBeenNthCalledWith(3, 'Solo {{d}}', 1, false);
603
+ expect(resolveCarouselTemplateWithMap).toHaveBeenNthCalledWith(4, 'none', 1, true);
604
+ expect(out[0].title).toBe('R(Hi {{a}}|0|false)');
605
+ expect(out[0].bodyText).toBe('R(Bye {{b}} {{c}}|0|true)');
606
+ expect(out[1].title).toBe('R(Solo {{d}}|1|false)');
607
+ expect(out[1].bodyText).toBe('R(none|1|true)');
605
608
  });
606
609
 
607
610
  it('defaults missing card fields, including a default {} for a missing array item', () => {
608
611
  const out = buildCarouselCardsForPreview([undefined], {
609
612
  isFullMode: true,
610
- resolveCarouselTemplateWithMap: jest.fn(),
613
+ rcsVarRegex,
614
+ resolveTemplateWithMap: jest.fn(),
611
615
  });
612
616
  expect(out[0]).toEqual({
613
617
  mediaType: '',
@@ -631,7 +635,7 @@ describe('buildCarouselCardsForPreview', () => {
631
635
  description: '',
632
636
  },
633
637
  ],
634
- { isFullMode: true, resolveCarouselTemplateWithMap: jest.fn() },
638
+ { isFullMode: true, rcsVarRegex, resolveTemplateWithMap: jest.fn() },
635
639
  );
636
640
  expect(out[0].mediaType).toBe('image');
637
641
  expect(out[0].imageSrc).toBe('img.png');
@@ -647,7 +651,7 @@ describe('buildCarouselCardsForPreview', () => {
647
651
  videoAsset: { videoSrc: 'v.mp4', videoThumbnail: 'other-thumb.png' },
648
652
  },
649
653
  ],
650
- { isFullMode: true, resolveCarouselTemplateWithMap: jest.fn() },
654
+ { isFullMode: true, rcsVarRegex, resolveTemplateWithMap: jest.fn() },
651
655
  );
652
656
  expect(out[0].videoPreviewImg).toBe('thumb.png');
653
657
  expect(out[0].videoSrc).toBe('v.mp4');
@@ -661,7 +665,7 @@ describe('buildCarouselCardsForPreview', () => {
661
665
  videoAsset: { videoSrc: 'v.mp4', videoThumbnail: 'other-thumb.png' },
662
666
  },
663
667
  ],
664
- { isFullMode: true, resolveCarouselTemplateWithMap: jest.fn() },
668
+ { isFullMode: true, rcsVarRegex, resolveTemplateWithMap: jest.fn() },
665
669
  );
666
670
  expect(out[0].videoPreviewImg).toBe('other-thumb.png');
667
671
  });
@@ -669,7 +673,7 @@ describe('buildCarouselCardsForPreview', () => {
669
673
  it('defaults videoPreviewImg and videoSrc to empty string when nothing is set', () => {
670
674
  const out = buildCarouselCardsForPreview(
671
675
  [{ mediaType: RCS_MEDIA_TYPES.IMAGE }],
672
- { isFullMode: true, resolveCarouselTemplateWithMap: jest.fn() },
676
+ { isFullMode: true, rcsVarRegex, resolveTemplateWithMap: jest.fn() },
673
677
  );
674
678
  expect(out[0].videoPreviewImg).toBe('');
675
679
  expect(out[0].videoSrc).toBe('');
@@ -853,17 +857,17 @@ describe('buildCarouselCardContentForPayload', () => {
853
857
  expect(out[0].cardVarMapped).toBeUndefined();
854
858
  });
855
859
 
856
- it('builds cardVarMapped from title and description tokens, sanitizing values', () => {
860
+ it('builds cardVarMapped from title and description tokens, keyed by global position, sanitizing values', () => {
857
861
  const out = buildCarouselCardContentForPayload(
858
862
  [{ title: 'Hi {{name}}', description: 'Pts {{points}}', mediaType: RCS_MEDIA_TYPES.NONE }],
859
863
  {
860
864
  isSlotMappingMode: true,
861
- cardVarMapped: { name: 'Bob', points: '{{2}}' },
865
+ cardVarMapped: { 1: 'Bob', 2: '{{2}}' },
862
866
  selectedCarouselHeight: 'SHORT',
863
867
  rcsVarRegex,
864
868
  },
865
869
  );
866
- expect(out[0].cardVarMapped).toEqual({ name: 'Bob', points: '' });
870
+ expect(out[0].cardVarMapped).toEqual({ 1: 'Bob', 2: '' });
867
871
  });
868
872
 
869
873
  it('defaults an unmapped token value to empty string via sanitizeCardVarMappedValue', () => {
@@ -871,7 +875,7 @@ describe('buildCarouselCardContentForPayload', () => {
871
875
  [{ title: 'Hi {{missing}}', description: 'D', mediaType: RCS_MEDIA_TYPES.NONE }],
872
876
  { isSlotMappingMode: true, cardVarMapped: {}, selectedCarouselHeight: 'SHORT', rcsVarRegex },
873
877
  );
874
- expect(out[0].cardVarMapped).toEqual({ missing: '' });
878
+ expect(out[0].cardVarMapped).toEqual({ 1: '' });
875
879
  });
876
880
 
877
881
  it('handles a missing cardVarMapped object entirely', () => {
@@ -879,7 +883,7 @@ describe('buildCarouselCardContentForPayload', () => {
879
883
  [{ title: 'Hi {{name}}', description: 'D', mediaType: RCS_MEDIA_TYPES.NONE }],
880
884
  { isSlotMappingMode: true, cardVarMapped: undefined, selectedCarouselHeight: 'SHORT', rcsVarRegex },
881
885
  );
882
- expect(out[0].cardVarMapped).toEqual({ name: '' });
886
+ expect(out[0].cardVarMapped).toEqual({ 1: '' });
883
887
  });
884
888
 
885
889
  it('skips a matched token that strips down to an empty variable name', () => {