gatsby-core-theme 44.2.18 → 44.2.19

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/CHANGELOG.md CHANGED
@@ -1,3 +1,15 @@
1
+ ## [44.2.19](https://gitlab.com/g2m-gentoo/team-floyd/themes/gatsby-themes/compare/v44.2.18...v44.2.19) (2025-06-24)
2
+
3
+
4
+ ### Bug Fixes
5
+
6
+ * remove unecessary eslint disable ([976eea0](https://gitlab.com/g2m-gentoo/team-floyd/themes/gatsby-themes/commit/976eea0ca4c72e1e3b7f60f66a388849889d0ed9))
7
+ * replace coupon code extra field with promo code in sites data ([2c2fbd9](https://gitlab.com/g2m-gentoo/team-floyd/themes/gatsby-themes/commit/2c2fbd9dd48594c54fce741e28ca54c094276fc0))
8
+ * replace coupon code extra field with promo code in sites data ([96166c2](https://gitlab.com/g2m-gentoo/team-floyd/themes/gatsby-themes/commit/96166c2e3acb43f0806fbca588d672570166e5cb))
9
+
10
+
11
+ * Merge branch 'tm-5539-replace-coupon-code' into 'master' ([ad894e3](https://gitlab.com/g2m-gentoo/team-floyd/themes/gatsby-themes/commit/ad894e372eea6dab322cf04790cd91c528cef647))
12
+
1
13
  ## [44.2.18](https://gitlab.com/g2m-gentoo/team-floyd/themes/gatsby-themes/compare/v44.2.17...v44.2.18) (2025-06-23)
2
14
 
3
15
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "gatsby-core-theme",
3
- "version": "44.2.18",
3
+ "version": "44.2.19",
4
4
  "description": "Gatsby Theme NPM Package",
5
5
  "author": "",
6
6
  "license": "ISC",
@@ -44,6 +44,7 @@ export default function BonusBox({
44
44
  {showVariablesComponent && (
45
45
  <VariableComponent
46
46
  item={item}
47
+ tracker={tracker}
47
48
  moduleName={moduleName}
48
49
  modulePosition={modulePosition}
49
50
  itemPosition={itemPosition}
@@ -88,6 +88,7 @@ export default function BonusBox({
88
88
  {showVariablesComponent && variableInsideContainer && (
89
89
  <VariableComponent
90
90
  item={item}
91
+ tracker={tracker}
91
92
  moduleName={moduleName}
92
93
  clickedElement={`${clickedElement}_cta`}
93
94
  modulePosition={modulePosition}
@@ -98,7 +99,7 @@ export default function BonusBox({
98
99
  )}
99
100
 
100
101
  {showVariablesComponent && !variableInsideContainer && (
101
- <VariableComponent item={item} moduleName={moduleName} modulePosition={modulePosition}
102
+ <VariableComponent item={item} tracker={tracker} moduleName={moduleName} modulePosition={modulePosition}
102
103
  itemPosition={itemPosition} clickedElement={clickedElement} />
103
104
  )}
104
105
  </div>
@@ -241,6 +241,23 @@ export function getBonus(name, operator) {
241
241
  return null;
242
242
  }
243
243
 
244
+ export function getPromoCode(item, tracker) {
245
+
246
+ if (!item) {
247
+ return null;
248
+ }
249
+ if (
250
+ item.bonuses &&
251
+ item.bonuses.hasOwnProperty(tracker) &&
252
+ item.bonuses[tracker].promo_code !== ""
253
+ ) {
254
+
255
+
256
+ return item.bonuses[tracker].promo_code;
257
+ }
258
+ return null;
259
+ }
260
+
244
261
  export function getGameExtraField(relation, key) {
245
262
  if (
246
263
  relation &&
@@ -502,4 +502,56 @@ describe('Getters Helper', () => {
502
502
  test('should handle null content', () => {
503
503
  expect(Getters.trailingSlash(null)).toBeNull();
504
504
  });
505
+ test("returns null if item is null", () => {
506
+ expect(Getters.getPromoCode(null, "main")).toBeNull();
507
+ });
508
+
509
+ test("returns null if bonuses object is missing", () => {
510
+ const item = {};
511
+ expect(Getters.getPromoCode(item, "main")).toBeNull();
512
+ });
513
+
514
+ test("returns null if promo code is an empty string", () => {
515
+ const item = {
516
+ bonuses: {
517
+ main: {
518
+ promo_code: "",
519
+ },
520
+ },
521
+ };
522
+ expect(Getters.getPromoCode(item, "main")).toBeNull();
523
+ });
524
+
525
+ test("returns correct promo code when it exists for tracker", () => {
526
+ const item = {
527
+ bonuses: {
528
+ main: {
529
+ promo_code: "PROMO123",
530
+ },
531
+ },
532
+ };
533
+ expect(Getters.getPromoCode(item, "main")).toBe("PROMO123");
534
+ });
535
+
536
+ test("returns null if tracker does not exist in bonuses", () => {
537
+ const item = {
538
+ bonuses: {
539
+ other: {
540
+ promo_code: "SOMECODE",
541
+ },
542
+ },
543
+ };
544
+ expect(Getters.getPromoCode(item, "main")).toBeNull();
545
+ });
546
+
547
+ test("returns correct promo code for non-main tracker", () => {
548
+ const item = {
549
+ bonuses: {
550
+ exclusive: {
551
+ promo_code: "EXCL2025",
552
+ },
553
+ },
554
+ };
555
+ expect(Getters.getPromoCode(item, "exclusive")).toBe("EXCL2025");
556
+ });
505
557
  });