@coveo/atomic 3.62.0 → 3.63.0

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 (75) hide show
  1. package/custom-elements.json +131 -10
  2. package/dist/cjs/components/commerce/atomic-commerce-interface/atomic-commerce-interface.cjs +25 -4
  3. package/dist/cjs/components/commerce/atomic-commerce-pager/atomic-commerce-pager.cjs +3 -2
  4. package/dist/cjs/components/commerce/atomic-commerce-products-per-page/atomic-commerce-products-per-page.cjs +1 -1
  5. package/dist/cjs/components/commerce/atomic-commerce-recommendation-interface/atomic-commerce-recommendation-interface.cjs +25 -4
  6. package/dist/cjs/components/common/interface/i18n.cjs +6 -2
  7. package/dist/cjs/components/common/interface/interface-controller.cjs +8 -4
  8. package/dist/cjs/components/common/pager/pager-fit-controller.cjs +72 -0
  9. package/dist/cjs/components/insight/atomic-insight-pager/atomic-insight-pager.cjs +3 -2
  10. package/dist/cjs/components/search/atomic-pager/atomic-pager.cjs +3 -2
  11. package/dist/cjs/components/search/atomic-result-date/atomic-result-date.cjs +11 -16
  12. package/dist/cjs/components/search/atomic-results-per-page/atomic-results-per-page.cjs +1 -1
  13. package/dist/cjs/generated/dayjs-locales-data.cjs +43 -43
  14. package/dist/cjs/global/environment.cjs +1 -1
  15. package/dist/cjs/utils/dayjs-locales.cjs +23 -9
  16. package/dist/cjs/utils/field-utils.cjs +5 -1
  17. package/dist/cjs/utils/locale-utils.cjs +50 -0
  18. package/dist/cjs/versions.cjs +1 -1
  19. package/dist/esm/components/commerce/atomic-commerce-interface/atomic-commerce-interface.js +25 -4
  20. package/dist/esm/components/commerce/atomic-commerce-pager/atomic-commerce-pager.js +3 -2
  21. package/dist/esm/components/commerce/atomic-commerce-products-per-page/atomic-commerce-products-per-page.js +1 -1
  22. package/dist/esm/components/commerce/atomic-commerce-recommendation-interface/atomic-commerce-recommendation-interface.js +25 -4
  23. package/dist/esm/components/common/interface/i18n.js +6 -2
  24. package/dist/esm/components/common/interface/interface-controller.js +8 -4
  25. package/dist/esm/components/common/pager/pager-fit-controller.js +34 -0
  26. package/dist/esm/components/insight/atomic-insight-pager/atomic-insight-pager.js +3 -2
  27. package/dist/esm/components/search/atomic-pager/atomic-pager.js +3 -2
  28. package/dist/esm/components/search/atomic-result-date/atomic-result-date.js +10 -15
  29. package/dist/esm/components/search/atomic-results-per-page/atomic-results-per-page.js +1 -1
  30. package/dist/esm/generated/dayjs-locales-data.js +43 -43
  31. package/dist/esm/global/environment.js +1 -1
  32. package/dist/esm/utils/dayjs-locales.js +23 -9
  33. package/dist/esm/utils/field-utils.js +5 -1
  34. package/dist/esm/utils/locale-utils.js +12 -0
  35. package/dist/esm/versions.js +1 -1
  36. package/dist/lang/cs.json +1 -1
  37. package/dist/lang/da.json +1 -1
  38. package/dist/lang/de.json +1 -1
  39. package/dist/lang/el.json +1 -1
  40. package/dist/lang/es.json +1 -1
  41. package/dist/lang/fi.json +1 -1
  42. package/dist/lang/hu.json +1 -1
  43. package/dist/lang/id.json +1 -1
  44. package/dist/lang/it.json +1 -1
  45. package/dist/lang/ja.json +1 -1
  46. package/dist/lang/ko.json +1 -1
  47. package/dist/lang/nl.json +1 -1
  48. package/dist/lang/no.json +1 -1
  49. package/dist/lang/pl.json +1 -1
  50. package/dist/lang/pt-BR.json +1 -1
  51. package/dist/lang/pt.json +1 -1
  52. package/dist/lang/ru.json +1 -1
  53. package/dist/lang/sv.json +1 -1
  54. package/dist/lang/th.json +1 -1
  55. package/dist/lang/tr.json +1 -1
  56. package/dist/lang/zh-CN.json +1 -1
  57. package/dist/lang/zh-TW.json +1 -1
  58. package/dist/lang/zh.json +1 -1
  59. package/dist/types/components/commerce/atomic-commerce-interface/atomic-commerce-interface.d.ts +17 -0
  60. package/dist/types/components/commerce/atomic-commerce-pager/atomic-commerce-pager.d.ts +1 -0
  61. package/dist/types/components/commerce/atomic-commerce-recommendation-interface/atomic-commerce-recommendation-interface.d.ts +13 -0
  62. package/dist/types/components/common/interface/i18n.d.ts +9 -5
  63. package/dist/types/components/common/pager/pager-fit-controller.d.ts +21 -0
  64. package/dist/types/components/common/suggestions/suggestion-manager.d.ts +1 -1
  65. package/dist/types/components/common/suggestions/suggestions-types.d.ts +1 -1
  66. package/dist/types/components/insight/atomic-insight-interface/atomic-insight-interface.d.ts +4 -0
  67. package/dist/types/components/insight/atomic-insight-pager/atomic-insight-pager.d.ts +1 -0
  68. package/dist/types/components/recommendations/atomic-recs-interface/atomic-recs-interface.d.ts +4 -0
  69. package/dist/types/components/search/atomic-pager/atomic-pager.d.ts +1 -0
  70. package/dist/types/components/search/atomic-result-date/atomic-result-date.d.ts +3 -0
  71. package/dist/types/components/search/atomic-search-interface/atomic-search-interface.d.ts +4 -0
  72. package/dist/types/utils/dayjs-locales.d.ts +1 -1
  73. package/dist/types/utils/field-utils.d.ts +1 -1
  74. package/dist/types/utils/locale-utils.d.ts +7 -0
  75. package/package.json +4 -4
@@ -998,6 +998,12 @@
998
998
  "declarations": [],
999
999
  "exports": []
1000
1000
  },
1001
+ {
1002
+ "kind": "javascript-module",
1003
+ "path": "src/utils/locale-utils.ts",
1004
+ "declarations": [],
1005
+ "exports": []
1006
+ },
1001
1007
  {
1002
1008
  "kind": "javascript-module",
1003
1009
  "path": "src/utils/memoize.ts",
@@ -2994,6 +3000,18 @@
2994
3000
  "attribute": "language",
2995
3001
  "reflects": true
2996
3002
  },
3003
+ {
3004
+ "kind": "field",
3005
+ "name": "localizeWithCountry",
3006
+ "type": {
3007
+ "text": "boolean"
3008
+ },
3009
+ "privacy": "public",
3010
+ "default": "false",
3011
+ "description": "Whether to localize the interface with the country of the commerce context as well as its\nlanguage, for example `fr-CA` rather than `fr`.\n\nNumber, currency, and date formatting then follow the country: with the `en` language and the\n`CA` country, a CAD price renders as `$1,000.10` rather than `CA$1,000.10`.\n\nWhen Atomic has translations for the regional locale (for example `pt-BR` or `zh-TW`), the\ninterface uses them instead of those of the language. To customize strings for such an\ninterface, register them under the regional locale.",
3012
+ "attribute": "localize-with-country",
3013
+ "reflects": true
3014
+ },
2997
3015
  {
2998
3016
  "kind": "field",
2999
3017
  "name": "engine",
@@ -3131,7 +3149,7 @@
3131
3149
  "description": "(Optional) The ISO-4217 currency code (for example, `USD`)."
3132
3150
  }
3133
3151
  ],
3134
- "description": "Updates the locale settings for the commerce interface and headless commerce\nengine. Only the provided parameters will be updated.\n\nCalling this method affects the localization of the interface as well as\nthe catalog configuration being used by the Commerce API. If the resulting\nlanguage-country-currency combination matches no existing catalog\nconfiguration in your Coveo organization, requests made through the\ncommerce engine will start failing."
3152
+ "description": "Updates the locale settings for the commerce interface and headless commerce\nengine. Only the provided parameters will be updated.\n\nCalling this method affects the localization of the interface as well as\nthe catalog configuration being used by the Commerce API. If the resulting\nlanguage-country-currency combination matches no existing catalog\nconfiguration in your Coveo organization, requests made through the\ncommerce engine will start failing.\n\nWith `localize-with-country`, the country also drives the number, currency, and\ndate formatting of the interface."
3135
3153
  },
3136
3154
  {
3137
3155
  "kind": "method",
@@ -3143,6 +3161,11 @@
3143
3161
  "name": "updateLanguage",
3144
3162
  "privacy": "public"
3145
3163
  },
3164
+ {
3165
+ "kind": "method",
3166
+ "name": "toggleLocalizeWithCountry",
3167
+ "privacy": "public"
3168
+ },
3146
3169
  {
3147
3170
  "kind": "method",
3148
3171
  "name": "updateIconAssetsPath",
@@ -3197,6 +3220,26 @@
3197
3220
  "name": "initLanguage",
3198
3221
  "privacy": "private"
3199
3222
  },
3223
+ {
3224
+ "kind": "method",
3225
+ "name": "getLocale",
3226
+ "privacy": "private",
3227
+ "parameters": [
3228
+ {
3229
+ "name": "language",
3230
+ "type": {
3231
+ "text": "string"
3232
+ }
3233
+ },
3234
+ {
3235
+ "name": "country",
3236
+ "optional": true,
3237
+ "type": {
3238
+ "text": "string"
3239
+ }
3240
+ }
3241
+ ]
3242
+ },
3200
3243
  {
3201
3244
  "kind": "method",
3202
3245
  "name": "initRequestStatus",
@@ -3318,6 +3361,15 @@
3318
3361
  "deprecated": "- This property will be removed in the next major version of\nAtomic (v4). Rather than using this property, set the initial language\nthrough the engine configuration when calling `initializeWithEngine`, and\nupdate the language as needed using the `updateLocale` method.",
3319
3362
  "fieldName": "language"
3320
3363
  },
3364
+ {
3365
+ "name": "localize-with-country",
3366
+ "type": {
3367
+ "text": "boolean"
3368
+ },
3369
+ "default": "false",
3370
+ "description": "Whether to localize the interface with the country of the commerce context as well as its\nlanguage, for example `fr-CA` rather than `fr`.\n\nNumber, currency, and date formatting then follow the country: with the `en` language and the\n`CA` country, a CAD price renders as `$1,000.10` rather than `CA$1,000.10`.\n\nWhen Atomic has translations for the regional locale (for example `pt-BR` or `zh-TW`), the\ninterface uses them instead of those of the language. To customize strings for such an\ninterface, register them under the regional locale.",
3371
+ "fieldName": "localizeWithCountry"
3372
+ },
3321
3373
  {
3322
3374
  "name": "reflect-state-in-url",
3323
3375
  "type": {
@@ -4300,6 +4352,12 @@
4300
4352
  "privacy": "protected",
4301
4353
  "default": "new AriaLiveRegionController(this, 'atomic-pager')"
4302
4354
  },
4355
+ {
4356
+ "kind": "field",
4357
+ "name": "pagerFit",
4358
+ "privacy": "private",
4359
+ "default": "new PagerFitController(this)"
4360
+ },
4303
4361
  {
4304
4362
  "kind": "field",
4305
4363
  "name": "previousButton",
@@ -5369,6 +5427,17 @@
5369
5427
  "attribute": "language",
5370
5428
  "reflects": true
5371
5429
  },
5430
+ {
5431
+ "kind": "field",
5432
+ "name": "localizeWithCountry",
5433
+ "type": {
5434
+ "text": "boolean"
5435
+ },
5436
+ "default": "false",
5437
+ "description": "Whether to localize the interface with the country of the commerce context as well as its\nlanguage, for example `fr-CA` rather than `fr`.\n\nNumber, currency, and date formatting then follow the country: with the `en` language and the\n`CA` country, a CAD price renders as `$1,000.10` rather than `CA$1,000.10`.",
5438
+ "attribute": "localize-with-country",
5439
+ "reflects": true
5440
+ },
5372
5441
  {
5373
5442
  "kind": "field",
5374
5443
  "name": "analytics",
@@ -5438,7 +5507,7 @@
5438
5507
  "description": "(Optional) The ISO-4217 currency code (for example, `USD`)."
5439
5508
  }
5440
5509
  ],
5441
- "description": "Updates the locale settings for the commerce recommendation interface and\nheadless commerce engine. Only the provided parameters will be updated.\n\nCalling this method affects the localization of the interface as well as\nthe catalog configuration being used by the Commerce API. If the resulting\nlanguage-country-currency combination matches no existing catalog\nconfiguration in your Coveo organization, requests made through the\ncommerce engine will start failing."
5510
+ "description": "Updates the locale settings for the commerce recommendation interface and\nheadless commerce engine. Only the provided parameters will be updated.\n\nCalling this method affects the localization of the interface as well as\nthe catalog configuration being used by the Commerce API. If the resulting\nlanguage-country-currency combination matches no existing catalog\nconfiguration in your Coveo organization, requests made through the\ncommerce engine will start failing.\n\nWith `localize-with-country`, the country also drives the number, currency, and\ndate formatting of the interface."
5442
5511
  },
5443
5512
  {
5444
5513
  "kind": "method",
@@ -5450,6 +5519,11 @@
5450
5519
  "name": "updateIconAssetsPath",
5451
5520
  "privacy": "public"
5452
5521
  },
5522
+ {
5523
+ "kind": "method",
5524
+ "name": "toggleLocalizeWithCountry",
5525
+ "privacy": "public"
5526
+ },
5453
5527
  {
5454
5528
  "kind": "method",
5455
5529
  "name": "updateLanguage",
@@ -5498,6 +5572,26 @@
5498
5572
  "name": "initLanguage",
5499
5573
  "privacy": "private"
5500
5574
  },
5575
+ {
5576
+ "kind": "method",
5577
+ "name": "getLocale",
5578
+ "privacy": "private",
5579
+ "parameters": [
5580
+ {
5581
+ "name": "language",
5582
+ "type": {
5583
+ "text": "string"
5584
+ }
5585
+ },
5586
+ {
5587
+ "name": "country",
5588
+ "optional": true,
5589
+ "type": {
5590
+ "text": "string"
5591
+ }
5592
+ }
5593
+ ]
5594
+ },
5501
5595
  {
5502
5596
  "kind": "method",
5503
5597
  "name": "isNewLocale",
@@ -5577,6 +5671,15 @@
5577
5671
  "deprecated": "- This property will be removed in the next major version of\nAtomic (v4). Rather than using this property, set the initial language\nthrough the engine configuration when calling `initializeWithEngine`, and\nupdate the language as needed using the `updateLocale` method.",
5578
5672
  "fieldName": "language"
5579
5673
  },
5674
+ {
5675
+ "name": "localize-with-country",
5676
+ "type": {
5677
+ "text": "boolean"
5678
+ },
5679
+ "default": "false",
5680
+ "description": "Whether to localize the interface with the country of the commerce context as well as its\nlanguage, for example `fr-CA` rather than `fr`.\n\nNumber, currency, and date formatting then follow the country: with the `en` language and the\n`CA` country, a CAD price renders as `$1,000.10` rather than `CA$1,000.10`.",
5681
+ "fieldName": "localizeWithCountry"
5682
+ },
5580
5683
  {
5581
5684
  "name": "analytics",
5582
5685
  "type": {
@@ -14762,6 +14865,12 @@
14762
14865
  "declarations": [],
14763
14866
  "exports": []
14764
14867
  },
14868
+ {
14869
+ "kind": "javascript-module",
14870
+ "path": "src/components/common/pager/pager-fit-controller.ts",
14871
+ "declarations": [],
14872
+ "exports": []
14873
+ },
14765
14874
  {
14766
14875
  "kind": "javascript-module",
14767
14876
  "path": "src/components/common/pager/pager-navigation.ts",
@@ -17095,7 +17204,7 @@
17095
17204
  },
17096
17205
  "privacy": "public",
17097
17206
  "default": "'en'",
17098
- "description": "The service insight interface language.",
17207
+ "description": "The service insight interface language.\n\nAccepts a language (`en`) or a [BCP 47](https://www.rfc-editor.org/info/bcp47) locale\n(`en-CA`). The region drives number, currency, and localized date formats, while\ntranslations use the closest available language.",
17099
17208
  "attribute": "language",
17100
17209
  "reflects": true
17101
17210
  },
@@ -17314,7 +17423,7 @@
17314
17423
  "text": "string"
17315
17424
  },
17316
17425
  "default": "'en'",
17317
- "description": "The service insight interface language.",
17426
+ "description": "The service insight interface language.\n\nAccepts a language (`en`) or a [BCP 47](https://www.rfc-editor.org/info/bcp47) locale\n(`en-CA`). The region drives number, currency, and localized date formats, while\ntranslations use the closest available language.",
17318
17427
  "fieldName": "language"
17319
17428
  },
17320
17429
  {
@@ -18517,6 +18626,12 @@
18517
18626
  "privacy": "protected",
18518
18627
  "default": "new AriaLiveRegionController(this, 'atomic-insight-pager')"
18519
18628
  },
18629
+ {
18630
+ "kind": "field",
18631
+ "name": "pagerFit",
18632
+ "privacy": "private",
18633
+ "default": "new PagerFitController(this)"
18634
+ },
18520
18635
  {
18521
18636
  "kind": "field",
18522
18637
  "name": "previousButton",
@@ -25873,7 +25988,7 @@
25873
25988
  },
25874
25989
  "privacy": "public",
25875
25990
  "default": "'en'",
25876
- "description": "The recommendation interface language.",
25991
+ "description": "The recommendation interface language.\n\nAccepts a language (`en`) or a [BCP 47](https://www.rfc-editor.org/info/bcp47) locale\n(`en-CA`). The region drives number, currency, and localized date formats, while\ntranslations use the closest available language.",
25877
25992
  "attribute": "language",
25878
25993
  "reflects": true
25879
25994
  },
@@ -26091,7 +26206,7 @@
26091
26206
  "text": "string"
26092
26207
  },
26093
26208
  "default": "'en'",
26094
- "description": "The recommendation interface language.",
26209
+ "description": "The recommendation interface language.\n\nAccepts a language (`en`) or a [BCP 47](https://www.rfc-editor.org/info/bcp47) locale\n(`en-CA`). The region drives number, currency, and localized date formats, while\ntranslations use the closest available language.",
26095
26210
  "fieldName": "language"
26096
26211
  },
26097
26212
  {
@@ -34384,6 +34499,12 @@
34384
34499
  "privacy": "protected",
34385
34500
  "default": "new AriaLiveRegionController(this, 'atomic-pager')"
34386
34501
  },
34502
+ {
34503
+ "kind": "field",
34504
+ "name": "pagerFit",
34505
+ "privacy": "private",
34506
+ "default": "new PagerFitController(this)"
34507
+ },
34387
34508
  {
34388
34509
  "kind": "field",
34389
34510
  "name": "previousButton",
@@ -38308,7 +38429,7 @@
38308
38429
  },
38309
38430
  "privacy": "public",
38310
38431
  "default": "'D/M/YYYY'",
38311
- "description": "The format of the date.\nAvailable formats: https://day.js.org/docs/en/display/format",
38432
+ "description": "The format of the date.\nAvailable formats: https://day.js.org/docs/en/display/format\n\n[Localized formats](https://day.js.org/docs/en/display/format#localized-formats) such as `L`, `LL`, or `LLL`\nfollow the interface `language`: with `format=\"L\"`, `en-US` renders `09/30/2026` and `en-CA` renders `2026-09-30`.",
38312
38433
  "attribute": "format",
38313
38434
  "reflects": true
38314
38435
  },
@@ -38431,7 +38552,7 @@
38431
38552
  "text": "string"
38432
38553
  },
38433
38554
  "default": "'D/M/YYYY'",
38434
- "description": "The format of the date.\nAvailable formats: https://day.js.org/docs/en/display/format",
38555
+ "description": "The format of the date.\nAvailable formats: https://day.js.org/docs/en/display/format\n\n[Localized formats](https://day.js.org/docs/en/display/format#localized-formats) such as `L`, `LL`, or `LLL`\nfollow the interface `language`: with `format=\"L\"`, `en-US` renders `09/30/2026` and `en-CA` renders `2026-09-30`.",
38435
38556
  "fieldName": "format"
38436
38557
  },
38437
38558
  {
@@ -44497,7 +44618,7 @@
44497
44618
  },
44498
44619
  "privacy": "public",
44499
44620
  "default": "'en'",
44500
- "description": "The search interface language.",
44621
+ "description": "The search interface language.\n\nAccepts a language (`en`) or a [BCP 47](https://www.rfc-editor.org/info/bcp47) locale\n(`en-CA`). The region drives number, currency, and localized date formats, while\ntranslations use the closest available language.",
44501
44622
  "attribute": "language",
44502
44623
  "reflects": true
44503
44624
  },
@@ -44854,7 +44975,7 @@
44854
44975
  "text": "string"
44855
44976
  },
44856
44977
  "default": "'en'",
44857
- "description": "The search interface language.",
44978
+ "description": "The search interface language.\n\nAccepts a language (`en`) or a [BCP 47](https://www.rfc-editor.org/info/bcp47) locale\n(`en-CA`). The region drives number, currency, and localized date formats, while\ntranslations use the closest available language.",
44858
44979
  "fieldName": "language"
44859
44980
  },
44860
44981
  {
@@ -58,6 +58,7 @@ const children_update_complete_mixin_cjs_namespaceObject = require("../../../mix
58
58
  const init_queue_cjs_namespaceObject = require("../../../utils/init-queue.cjs");
59
59
  const initialization_common_utils_cjs_namespaceObject = require("../../../utils/initialization-common-utils.cjs");
60
60
  const local_storage_utils_cjs_namespaceObject = require("../../../utils/local-storage-utils.cjs");
61
+ const locale_utils_cjs_namespaceObject = require("../../../utils/locale-utils.cjs");
61
62
  const external_analytics_config_cjs_namespaceObject = require("./analytics-config.cjs");
62
63
  const external_store_cjs_namespaceObject = require("./store.cjs");
63
64
  function _ts_decorate(decorators, target, key, desc) {
@@ -114,7 +115,7 @@ class AtomicCommerceInterface extends (0, children_update_complete_mixin_cjs_nam
114
115
  }
115
116
  updateLocale(language, country, currency) {
116
117
  if (!this.interfaceController.engineIsCreated(this.engine) || !this.context) return;
117
- language && this.interfaceController.onLanguageChange(language);
118
+ if (language || country && this.localizeWithCountry) this.interfaceController.onLanguageChange(this.getLocale(language || this.context.state.language, country || this.context.state.country));
118
119
  if (this.isNewLocale(language, country, currency)) {
119
120
  const { setContext } = (0, commerce_namespaceObject.loadContextActions)(this.engine);
120
121
  this.engine.dispatch(setContext({
@@ -139,7 +140,11 @@ class AtomicCommerceInterface extends (0, children_update_complete_mixin_cjs_nam
139
140
  if (!this.interfaceController.engineIsCreated(this.engine) || !this.language || !this.context) return;
140
141
  this.engine.logger.warn('The `language` property will be removed in the next major version of Atomic (v4). Rather than using this property, set the initial language through the engine configuration when calling `initialize` or `initializeWithEngine`, and update the language as needed using the `updateLocale` method.');
141
142
  this.context.setLanguage(this.language);
142
- return this.interfaceController.onLanguageChange();
143
+ return this.interfaceController.onLanguageChange(this.getLocale(this.language, this.context.state.country));
144
+ }
145
+ toggleLocalizeWithCountry() {
146
+ if (!this.context) return;
147
+ this.interfaceController.onLanguageChange(this.getLocale(this.context.state.language, this.context.state.country));
143
148
  }
144
149
  updateIconAssetsPath() {
145
150
  this.store.state.iconAssetsPath = this.iconAssetsPath;
@@ -180,7 +185,10 @@ class AtomicCommerceInterface extends (0, children_update_complete_mixin_cjs_nam
180
185
  }
181
186
  initLanguage() {
182
187
  if (!this.context || this.language) return;
183
- this.interfaceController.onLanguageChange(this.context.state.language);
188
+ this.interfaceController.onLanguageChange(this.getLocale(this.context.state.language, this.context.state.country));
189
+ }
190
+ getLocale(language, country) {
191
+ return this.localizeWithCountry ? (0, locale_utils_cjs_namespaceObject.withCountry)(language, country) : language;
184
192
  }
185
193
  initRequestStatus() {
186
194
  this.searchOrListing = 'product-listing' === this.type ? (0, commerce_namespaceObject.buildProductListing)(this.engine) : (0, commerce_namespaceObject.buildSearch)(this.engine);
@@ -244,7 +252,7 @@ class AtomicCommerceInterface extends (0, children_update_complete_mixin_cjs_nam
244
252
  this.bindings.engine.logger.info(`History pushState #${newFragment}`);
245
253
  }
246
254
  constructor(){
247
- super(), this.bindings = {}, this.unsubscribeUrlManager = ()=>{}, this.unsubscribeSummary = ()=>{}, this.initialized = false, this.interfaceController = new interface_controller_cjs_namespaceObject.InterfaceController(this, 'CoveoAtomic', commerce_namespaceObject.VERSION), this.type = 'search', this.analytics = true, this.reflectStateInUrl = true, this.disableStateReflectionInUrl = false, this.scrollContainer = 'atomic-commerce-interface', this.languageAssetsPath = './lang', this.iconAssetsPath = './assets', this.handleInitialization = (event)=>{
255
+ super(), this.bindings = {}, this.unsubscribeUrlManager = ()=>{}, this.unsubscribeSummary = ()=>{}, this.initialized = false, this.interfaceController = new interface_controller_cjs_namespaceObject.InterfaceController(this, 'CoveoAtomic', commerce_namespaceObject.VERSION), this.type = 'search', this.analytics = true, this.localizeWithCountry = false, this.reflectStateInUrl = true, this.disableStateReflectionInUrl = false, this.scrollContainer = 'atomic-commerce-interface', this.languageAssetsPath = './lang', this.iconAssetsPath = './assets', this.handleInitialization = (event)=>{
248
256
  this.interfaceController.onComponentInitializing(event);
249
257
  }, this.onHashChange = ()=>{
250
258
  this.urlManager.synchronize(this.fragment);
@@ -314,6 +322,13 @@ _ts_decorate([
314
322
  }),
315
323
  _ts_metadata("design:type", String)
316
324
  ], AtomicCommerceInterface.prototype, "language", void 0);
325
+ _ts_decorate([
326
+ (0, decorators_js_namespaceObject.property)({
327
+ type: Boolean,
328
+ attribute: 'localize-with-country',
329
+ reflect: true
330
+ })
331
+ ], AtomicCommerceInterface.prototype, "localizeWithCountry", void 0);
317
332
  _ts_decorate([
318
333
  (0, decorators_js_namespaceObject.property)({
319
334
  type: Object,
@@ -369,6 +384,12 @@ _ts_decorate([
369
384
  _ts_metadata("design:paramtypes", []),
370
385
  _ts_metadata("design:returntype", void 0)
371
386
  ], AtomicCommerceInterface.prototype, "updateLanguage", null);
387
+ _ts_decorate([
388
+ (0, watch_cjs_namespaceObject.watch)('localizeWithCountry'),
389
+ _ts_metadata("design:type", Function),
390
+ _ts_metadata("design:paramtypes", []),
391
+ _ts_metadata("design:returntype", void 0)
392
+ ], AtomicCommerceInterface.prototype, "toggleLocalizeWithCountry", null);
372
393
  _ts_decorate([
373
394
  (0, watch_cjs_namespaceObject.watch)('iconAssetsPath'),
374
395
  _ts_metadata("design:type", Function),
@@ -48,6 +48,7 @@ const when_js_namespaceObject = require("lit/directives/when.js");
48
48
  const store_cjs_namespaceObject = require("../../common/interface/store.cjs");
49
49
  const pager_buttons_cjs_namespaceObject = require("../../common/pager/pager-buttons.cjs");
50
50
  const pager_navigation_cjs_namespaceObject = require("../../common/pager/pager-navigation.cjs");
51
+ const pager_fit_controller_cjs_namespaceObject = require("../../common/pager/pager-fit-controller.cjs");
51
52
  const pager_utils_cjs_namespaceObject = require("../../common/pager/pager-utils.cjs");
52
53
  const validate_props_controller_cjs_namespaceObject = require("../../common/validate-props-controller/validate-props-controller.cjs");
53
54
  const bind_state_cjs_namespaceObject = require("../../../decorators/bind-state.cjs");
@@ -81,7 +82,7 @@ class AtomicCommercePager extends external_lit_namespaceObject.LitElement {
81
82
  });
82
83
  }
83
84
  render() {
84
- const pagesRange = (0, pager_utils_cjs_namespaceObject.getCurrentPagesRange)(this.pagerState.page, this.numberOfPages, this.pagerState.totalPages - 1);
85
+ const pagesRange = (0, pager_utils_cjs_namespaceObject.getCurrentPagesRange)(this.pagerState.page, this.pagerFit.getNumberOfPagesToDisplay(this.numberOfPages), this.pagerState.totalPages - 1);
85
86
  return (0, external_lit_namespaceObject.html)`
86
87
  ${(0, when_js_namespaceObject.when)(this.pagerState.totalPages > 1 && this.isAppLoaded, ()=>(0, external_lit_namespaceObject.html)`
87
88
  ${(0, pager_navigation_cjs_namespaceObject.renderPagerNavigation)({
@@ -152,7 +153,7 @@ class AtomicCommercePager extends external_lit_namespaceObject.LitElement {
152
153
  });
153
154
  }
154
155
  constructor(){
155
- super(), this.isAppLoaded = false, this.numberOfPages = 5, this.previousButtonIcon = arrow_left_rounded_cjs_default(), this.nextButtonIcon = arrow_right_rounded_cjs_default(), this.ariaMessage = new accessibility_utils_cjs_namespaceObject.AriaLiveRegionController(this, 'atomic-pager');
156
+ super(), this.isAppLoaded = false, this.numberOfPages = 5, this.previousButtonIcon = arrow_left_rounded_cjs_default(), this.nextButtonIcon = arrow_right_rounded_cjs_default(), this.ariaMessage = new accessibility_utils_cjs_namespaceObject.AriaLiveRegionController(this, 'atomic-pager'), this.pagerFit = new pager_fit_controller_cjs_namespaceObject.PagerFitController(this);
156
157
  new validate_props_controller_cjs_namespaceObject.ValidatePropsController(this, ()=>({
157
158
  numberOfPages: this.numberOfPages
158
159
  }), AtomicCommercePager.propsSchema);
@@ -80,7 +80,7 @@ class AtomicCommerceProductsPerPage extends external_lit_namespaceObject.LitElem
80
80
  render() {
81
81
  return (0, external_lit_namespaceObject.html)`
82
82
  ${(0, when_js_namespaceObject.when)(!this.summaryState.hasError && this.summaryState.hasProducts && this.isAppLoaded, ()=>(0, external_lit_namespaceObject.html)`
83
- <div class="flex items-center">
83
+ <div class="flex flex-wrap items-center">
84
84
  ${(0, label_cjs_namespaceObject.renderLabel)()((0, external_lit_namespaceObject.html)`${this.label}`)}
85
85
  ${(0, fieldset_group_cjs_namespaceObject.renderFieldsetGroup)({
86
86
  props: {
@@ -52,6 +52,7 @@ const with_tailwind_styles_cjs_namespaceObject = require("../../../decorators/wi
52
52
  const children_update_complete_mixin_cjs_namespaceObject = require("../../../mixins/children-update-complete-mixin.cjs");
53
53
  const init_queue_cjs_namespaceObject = require("../../../utils/init-queue.cjs");
54
54
  const initialization_common_utils_cjs_namespaceObject = require("../../../utils/initialization-common-utils.cjs");
55
+ const locale_utils_cjs_namespaceObject = require("../../../utils/locale-utils.cjs");
55
56
  const bindings_context_cjs_namespaceObject = require("../../common/context/bindings-context.cjs");
56
57
  const analytics_config_cjs_namespaceObject = require("../../common/interface/analytics-config.cjs");
57
58
  const interface_controller_cjs_namespaceObject = require("../../common/interface/interface-controller.cjs");
@@ -82,7 +83,7 @@ class AtomicCommerceRecommendationInterface extends (0, children_update_complete
82
83
  }
83
84
  updateLocale(language, country, currency) {
84
85
  if (!this.interfaceController.engineIsCreated(this.engine) || !this.context) return;
85
- language && this.interfaceController.onLanguageChange(language);
86
+ if (language || country && this.localizeWithCountry) this.interfaceController.onLanguageChange(this.getLocale(language || this.context.state.language, country || this.context.state.country));
86
87
  if (this.isNewLocale(language, country, currency)) {
87
88
  const { setContext } = (0, commerce_namespaceObject.loadContextActions)(this.engine);
88
89
  this.engine.dispatch(setContext({
@@ -105,11 +106,15 @@ class AtomicCommerceRecommendationInterface extends (0, children_update_complete
105
106
  updateIconAssetsPath() {
106
107
  this.store.state.iconAssetsPath = this.iconAssetsPath;
107
108
  }
109
+ toggleLocalizeWithCountry() {
110
+ if (!this.context) return;
111
+ this.interfaceController.onLanguageChange(this.getLocale(this.context.state.language, this.context.state.country));
112
+ }
108
113
  async updateLanguage() {
109
114
  if (!this.interfaceController.engineIsCreated(this.engine) || !this.language || !this.context) return;
110
115
  this.engine.logger.warn('The `language` property will be removed in the next major version of Atomic (v4). Rather than using this property, set the initial language through the engine configuration when calling `initializeWithEngine`, and update the language as needed using the `updateLocale` method.');
111
116
  this.context.setLanguage(this.language);
112
- return this.interfaceController.onLanguageChange();
117
+ return this.interfaceController.onLanguageChange(this.getLocale(this.language, this.context.state.country));
113
118
  }
114
119
  disconnectedCallback() {
115
120
  super.disconnectedCallback();
@@ -150,14 +155,17 @@ class AtomicCommerceRecommendationInterface extends (0, children_update_complete
150
155
  }
151
156
  initLanguage() {
152
157
  if (!this.context || this.language) return;
153
- this.interfaceController.onLanguageChange(this.context.state.language);
158
+ this.interfaceController.onLanguageChange(this.getLocale(this.context.state.language, this.context.state.country));
159
+ }
160
+ getLocale(language, country) {
161
+ return this.localizeWithCountry ? (0, locale_utils_cjs_namespaceObject.withCountry)(language, country) : language;
154
162
  }
155
163
  isNewLocale(language, country, currency) {
156
164
  if (!this.context) return false;
157
165
  return language && language !== this.context.state.language || country && country !== this.context.state.country || currency && currency !== this.context.state.currency;
158
166
  }
159
167
  constructor(){
160
- super(), this.bindings = {}, this.interfaceController = new interface_controller_cjs_namespaceObject.InterfaceController(this, 'CoveoAtomic', commerce_namespaceObject.VERSION), this.scrollContainer = 'atomic-commerce-recommendation-interface', this.languageAssetsPath = './lang', this.iconAssetsPath = './assets', this.analytics = true, this.handleInitialization = (event)=>{
168
+ super(), this.bindings = {}, this.interfaceController = new interface_controller_cjs_namespaceObject.InterfaceController(this, 'CoveoAtomic', commerce_namespaceObject.VERSION), this.scrollContainer = 'atomic-commerce-recommendation-interface', this.languageAssetsPath = './lang', this.iconAssetsPath = './assets', this.localizeWithCountry = false, this.analytics = true, this.handleInitialization = (event)=>{
161
169
  this.interfaceController.onComponentInitializing(event);
162
170
  };
163
171
  this.store = (0, external_store_cjs_namespaceObject.createCommerceRecommendationStore)();
@@ -234,6 +242,13 @@ _ts_decorate([
234
242
  }),
235
243
  _ts_metadata("design:type", String)
236
244
  ], AtomicCommerceRecommendationInterface.prototype, "language", void 0);
245
+ _ts_decorate([
246
+ (0, decorators_js_namespaceObject.property)({
247
+ type: Boolean,
248
+ attribute: 'localize-with-country',
249
+ reflect: true
250
+ })
251
+ ], AtomicCommerceRecommendationInterface.prototype, "localizeWithCountry", void 0);
237
252
  _ts_decorate([
238
253
  (0, decorators_js_namespaceObject.property)({
239
254
  type: Boolean,
@@ -254,6 +269,12 @@ _ts_decorate([
254
269
  _ts_metadata("design:paramtypes", []),
255
270
  _ts_metadata("design:returntype", void 0)
256
271
  ], AtomicCommerceRecommendationInterface.prototype, "updateIconAssetsPath", null);
272
+ _ts_decorate([
273
+ (0, watch_cjs_namespaceObject.watch)('localizeWithCountry'),
274
+ _ts_metadata("design:type", Function),
275
+ _ts_metadata("design:paramtypes", []),
276
+ _ts_metadata("design:returntype", void 0)
277
+ ], AtomicCommerceRecommendationInterface.prototype, "toggleLocalizeWithCountry", null);
257
278
  _ts_decorate([
258
279
  (0, watch_cjs_namespaceObject.watch)('language'),
259
280
  _ts_metadata("design:type", Function),
@@ -76,9 +76,13 @@ function i18nBackendOptions(atomicInterface) {
76
76
  }
77
77
  };
78
78
  }
79
- function loadTranslations(atomicInterface, language) {
79
+ async function loadTranslations(atomicInterface, language) {
80
+ const { languageUtils } = atomicInterface.i18n.services;
81
+ const languages = languageUtils.toResolveHierarchy(languageUtils.formatLanguageCode(language), false);
82
+ await Promise.all(languages.filter(isI18nLocaleAvailable).map((lng)=>loadTranslationBundle(atomicInterface, lng)));
83
+ }
84
+ function loadTranslationBundle(atomicInterface, lng) {
80
85
  const { i18n } = atomicInterface;
81
- const lng = language.split('-')[0];
82
86
  return new Promise((resolve)=>{
83
87
  new (external_i18next_http_backend_default())(i18n.services, i18nBackendOptions(atomicInterface)).read(lng, i18nTranslationNamespace, (_error, data)=>{
84
88
  if (data) i18n.addResourceBundle(lng, i18nTranslationNamespace, data, true, false);
@@ -53,8 +53,10 @@ class InterfaceController {
53
53
  this.host.updateIconAssetsPath();
54
54
  initEngine();
55
55
  if (this.host.registerFieldsToInclude) this.host.registerFieldsToInclude();
56
- (0, dayjs_locales_cjs_namespaceObject.loadDayjsLocale)(this.host.language || 'en');
57
- await this.i18nPromise;
56
+ await Promise.all([
57
+ this.i18nPromise,
58
+ (0, dayjs_locales_cjs_namespaceObject.loadDayjsLocale)(this.host.language || 'en')
59
+ ]);
58
60
  this.initComponents();
59
61
  }
60
62
  onAnalyticsChange() {
@@ -67,8 +69,10 @@ class InterfaceController {
67
69
  const language = newLanguage ?? this.host.language;
68
70
  const languageWithFallback = language ?? 'en';
69
71
  const { i18n } = this.host;
70
- (0, dayjs_locales_cjs_namespaceObject.loadDayjsLocale)(languageWithFallback);
71
- (0, external_i18n_cjs_namespaceObject.loadTranslations)(this.host, languageWithFallback).then(()=>{
72
+ Promise.all([
73
+ (0, dayjs_locales_cjs_namespaceObject.loadDayjsLocale)(languageWithFallback),
74
+ (0, external_i18n_cjs_namespaceObject.loadTranslations)(this.host, languageWithFallback)
75
+ ]).then(()=>{
72
76
  i18n.changeLanguage(language);
73
77
  });
74
78
  }
@@ -0,0 +1,72 @@
1
+ "use strict";
2
+ var __webpack_require__ = {};
3
+ (()=>{
4
+ __webpack_require__.d = (exports1, getters, values)=>{
5
+ var define = (defs, kind)=>{
6
+ for(var key in defs)if (__webpack_require__.o(defs, key) && !__webpack_require__.o(exports1, key)) Object.defineProperty(exports1, key, {
7
+ enumerable: true,
8
+ [kind]: defs[key]
9
+ });
10
+ };
11
+ define(getters, "get");
12
+ define(values, "value");
13
+ };
14
+ })();
15
+ (()=>{
16
+ __webpack_require__.o = (obj, prop)=>Object.prototype.hasOwnProperty.call(obj, prop);
17
+ })();
18
+ (()=>{
19
+ __webpack_require__.r = (exports1)=>{
20
+ if ("u" > typeof Symbol && Symbol.toStringTag) Object.defineProperty(exports1, Symbol.toStringTag, {
21
+ value: 'Module'
22
+ });
23
+ Object.defineProperty(exports1, '__esModule', {
24
+ value: true
25
+ });
26
+ };
27
+ })();
28
+ var __webpack_exports__ = {};
29
+ __webpack_require__.r(__webpack_exports__);
30
+ class PagerFitController {
31
+ hostConnected() {
32
+ this.resizeObserver = new ResizeObserver(()=>requestAnimationFrame(()=>this.reset()));
33
+ this.resizeObserver.observe(document.documentElement);
34
+ if (this.host.parentElement) this.resizeObserver.observe(this.host.parentElement);
35
+ }
36
+ hostDisconnected() {
37
+ this.resizeObserver?.disconnect();
38
+ }
39
+ hostUpdated() {
40
+ const root = this.host.shadowRoot;
41
+ const previousButton = root?.querySelector('[part="previous-button"]');
42
+ const nextButton = root?.querySelector('[part="next-button"]');
43
+ const pageButtonCount = root?.querySelectorAll('[part~="page-button"]').length ?? 0;
44
+ const isWrapping = !!previousButton && !!nextButton && nextButton.offsetTop > previousButton.offsetTop;
45
+ if (isWrapping && pageButtonCount > 1) {
46
+ this.maxPages = pageButtonCount - 1;
47
+ queueMicrotask(()=>this.host.requestUpdate());
48
+ }
49
+ }
50
+ getNumberOfPagesToDisplay(numberOfPages) {
51
+ return Math.min(numberOfPages, this.maxPages);
52
+ }
53
+ reset() {
54
+ this.maxPages = 1 / 0;
55
+ this.host.requestUpdate();
56
+ }
57
+ constructor(host){
58
+ this.host = host;
59
+ this.maxPages = 1 / 0;
60
+ host.addController(this);
61
+ }
62
+ }
63
+ __webpack_require__.d(__webpack_exports__, {
64
+ PagerFitController: ()=>PagerFitController
65
+ });
66
+ exports.PagerFitController = __webpack_exports__.PagerFitController;
67
+ for(var __rspack_i in __webpack_exports__)if (-1 === [
68
+ "PagerFitController"
69
+ ].indexOf(__rspack_i)) exports[__rspack_i] = __webpack_exports__[__rspack_i];
70
+ Object.defineProperty(exports, '__esModule', {
71
+ value: true
72
+ });
@@ -47,6 +47,7 @@ const keyed_js_namespaceObject = require("lit/directives/keyed.js");
47
47
  const when_js_namespaceObject = require("lit/directives/when.js");
48
48
  const pager_buttons_cjs_namespaceObject = require("../../common/pager/pager-buttons.cjs");
49
49
  const pager_navigation_cjs_namespaceObject = require("../../common/pager/pager-navigation.cjs");
50
+ const pager_fit_controller_cjs_namespaceObject = require("../../common/pager/pager-fit-controller.cjs");
50
51
  const pager_utils_cjs_namespaceObject = require("../../common/pager/pager-utils.cjs");
51
52
  const validate_props_controller_cjs_namespaceObject = require("../../common/validate-props-controller/validate-props-controller.cjs");
52
53
  const bind_state_cjs_namespaceObject = require("../../../decorators/bind-state.cjs");
@@ -80,7 +81,7 @@ class AtomicInsightPager extends external_lit_namespaceObject.LitElement {
80
81
  });
81
82
  }
82
83
  render() {
83
- const pagesRange = (0, pager_utils_cjs_namespaceObject.getCurrentPagesRange)(this.pagerState.currentPage - 1, this.numberOfPages, this.pagerState.maxPage);
84
+ const pagesRange = (0, pager_utils_cjs_namespaceObject.getCurrentPagesRange)(this.pagerState.currentPage - 1, this.pagerFit.getNumberOfPagesToDisplay(this.numberOfPages), this.pagerState.maxPage);
84
85
  return (0, external_lit_namespaceObject.html)`${(0, when_js_namespaceObject.when)(this.pagerState.maxPage > 1, ()=>(0, external_lit_namespaceObject.html)`
85
86
  ${(0, pager_navigation_cjs_namespaceObject.renderPagerNavigation)({
86
87
  props: {
@@ -149,7 +150,7 @@ class AtomicInsightPager extends external_lit_namespaceObject.LitElement {
149
150
  });
150
151
  }
151
152
  constructor(){
152
- super(), this.numberOfPages = 5, this.ariaMessage = new accessibility_utils_cjs_namespaceObject.AriaLiveRegionController(this, 'atomic-insight-pager');
153
+ super(), this.numberOfPages = 5, this.ariaMessage = new accessibility_utils_cjs_namespaceObject.AriaLiveRegionController(this, 'atomic-insight-pager'), this.pagerFit = new pager_fit_controller_cjs_namespaceObject.PagerFitController(this);
153
154
  new validate_props_controller_cjs_namespaceObject.ValidatePropsController(this, ()=>({
154
155
  numberOfPages: this.numberOfPages
155
156
  }), AtomicInsightPager.propsSchema);