@coveops/abi 1.3.1 → 1.5.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 (65) hide show
  1. package/dist/abi/abi.css +1 -1
  2. package/dist/abi/abi.esm.js +1 -1
  3. package/dist/abi/index.esm.js +1 -1
  4. package/dist/abi/p-224108b8.entry.js +1 -0
  5. package/dist/abi/{p-07a6ff58.entry.js → p-71e7ff5c.entry.js} +1 -1
  6. package/dist/abi/p-952353b8.entry.js +1 -0
  7. package/dist/abi/{p-c058cc61.entry.js → p-9d42030c.entry.js} +1 -1
  8. package/dist/abi/{p-b984457f.js → p-ac870f21.js} +2 -2
  9. package/dist/abi/p-c10b6b7f.js +2 -0
  10. package/dist/abi/p-c602c74e.entry.js +1 -0
  11. package/dist/abi/{p-3303b27f.entry.js → p-cd1744bb.entry.js} +1 -1
  12. package/dist/abi/{p-8c974da8.entry.js → p-d5e62885.entry.js} +1 -1
  13. package/dist/bundle/index.css +1 -1
  14. package/dist/bundle/index.js +64 -18
  15. package/dist/cjs/abi.cjs.js +2 -2
  16. package/dist/cjs/faq-popup-component.cjs.entry.js +5 -4
  17. package/dist/cjs/{index-355878fc.js → index-3cecd23d.js} +82 -3
  18. package/dist/cjs/{index-20ac4bdb.js → index-d1493bab.js} +2 -1
  19. package/dist/cjs/index.cjs.js +13 -10
  20. package/dist/cjs/loader.cjs.js +2 -2
  21. package/dist/cjs/recs-initialization-helper.cjs.entry.js +55 -0
  22. package/dist/cjs/recs-results-manager.cjs.entry.js +26 -0
  23. package/dist/cjs/results-manager.cjs.entry.js +2 -2
  24. package/dist/cjs/sample-component.cjs.entry.js +2 -2
  25. package/dist/cjs/standalone-searchbox-listener.cjs.entry.js +2 -2
  26. package/dist/cjs/strip-html-component.cjs.entry.js +1 -1
  27. package/dist/collection/collection-manifest.json +2 -0
  28. package/dist/collection/components/faq-popup-component/faq-popup-component.css +7 -1
  29. package/dist/collection/components/faq-popup-component/faq-popup-component.js +22 -2
  30. package/dist/collection/components/recs-initialization-helper/recs-initialization-helper.js +66 -0
  31. package/dist/collection/components/recs-results-manager/recs-results-manager.js +24 -0
  32. package/dist/collection/index.js +5 -2
  33. package/dist/components/index.d.ts +12 -0
  34. package/dist/components/index.js +172 -19
  35. package/dist/esm/abi.js +2 -2
  36. package/dist/esm/faq-popup-component.entry.js +5 -4
  37. package/dist/esm/{index-4e0bf5cd.js → index-072be88f.js} +2 -2
  38. package/dist/esm/{index-3c594d24.js → index-66fdbb35.js} +82 -3
  39. package/dist/esm/index.js +13 -10
  40. package/dist/esm/loader.js +2 -2
  41. package/dist/esm/recs-initialization-helper.entry.js +51 -0
  42. package/dist/esm/recs-results-manager.entry.js +22 -0
  43. package/dist/esm/results-manager.entry.js +2 -2
  44. package/dist/esm/sample-component.entry.js +2 -2
  45. package/dist/esm/standalone-searchbox-listener.entry.js +2 -2
  46. package/dist/esm/strip-html-component.entry.js +1 -1
  47. package/dist/types/components/faq-popup-component/faq-popup-component.d.ts +1 -0
  48. package/dist/types/components/recs-initialization-helper/recs-initialization-helper.d.ts +6 -0
  49. package/dist/types/components/recs-results-manager/recs-results-manager.d.ts +8 -0
  50. package/dist/types/components.d.ts +30 -0
  51. package/package.json +1 -1
  52. package/src/components/faq-popup-component/faq-popup-component.css +7 -1
  53. package/src/components/faq-popup-component/faq-popup-component.tsx +4 -4
  54. package/src/components/recs-initialization-helper/recs-initialization-helper.tsx +54 -0
  55. package/src/components/recs-results-manager/FaqTemplateRec.html +19 -0
  56. package/src/components/recs-results-manager/QuickLinksRec.html +16 -0
  57. package/src/components/recs-results-manager/defaultRec.html +14 -0
  58. package/src/components/recs-results-manager/recs-results-manager.tsx +38 -0
  59. package/src/components/results-manager/FAQTemplate.html +1 -1
  60. package/src/components.d.ts +30 -0
  61. package/src/index.ts +4 -2
  62. package/src/pages/recs.html +17 -20
  63. package/src/style/index.css +2 -2
  64. package/dist/abi/p-b267e2bb.entry.js +0 -1
  65. package/dist/abi/p-d6d34d34.js +0 -2
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
 
3
- const index = require('./index-355878fc.js');
3
+ const index = require('./index-3cecd23d.js');
4
4
 
5
5
  /*
6
6
  Stencil Client Patch Browser v2.17.3 | MIT Licensed | https://stenciljs.com
@@ -15,5 +15,5 @@ const patchBrowser = () => {
15
15
  };
16
16
 
17
17
  patchBrowser().then(options => {
18
- return index.bootstrapLazy([["faq-popup-component.cjs",[[1,"faq-popup-component",{"result":[32]}]]],["results-manager.cjs",[[0,"results-manager"]]],["sample-component.cjs",[[1,"sample-component",{"pagerState":[32],"statusState":[32]}]]],["standalone-searchbox-listener.cjs",[[1,"standalone-searchbox-listener",null,[[8,"header/searchbox/query","handleStandaloneSearchbox"]]]]],["strip-html-component.cjs",[[1,"strip-html-component",{"result":[32]}]]]], options);
18
+ return index.bootstrapLazy([["faq-popup-component.cjs",[[1,"faq-popup-component",{"origin":[1],"result":[32]}]]],["recs-initialization-helper.cjs",[[1,"recs-initialization-helper",{"userCountry":[1,"user-country"]}]]],["recs-results-manager.cjs",[[0,"recs-results-manager"]]],["results-manager.cjs",[[0,"results-manager"]]],["sample-component.cjs",[[1,"sample-component",{"pagerState":[32],"statusState":[32]}]]],["standalone-searchbox-listener.cjs",[[1,"standalone-searchbox-listener",null,[[8,"header/searchbox/query","handleStandaloneSearchbox"]]]]],["strip-html-component.cjs",[[1,"strip-html-component",{"result":[32]}]]]], options);
19
19
  });
@@ -2,12 +2,12 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- const index = require('./index-355878fc.js');
6
- const index$1 = require('./index-20ac4bdb.js');
5
+ const index = require('./index-3cecd23d.js');
6
+ const index$1 = require('./index-d1493bab.js');
7
7
  const resultTemplateDecorators881a4c8e = require('./result-template-decorators-881a4c8e-4ff46481.js');
8
8
  require('./headless.esm-085e70ed-f2e18485.js');
9
9
 
10
- const faqPopupComponentCss = "b{color:var(--atomic-primary)}:host{color:#CAA144 !important;font-size:1.7rem !important;max-height:unset !important;line-height:normal !important}";
10
+ const faqPopupComponentCss = "b{color:var(--atomic-primary)}.search-css{color:#CAA144 !important;font-size:1.7rem !important;max-height:unset !important;line-height:normal !important}:host{cursor:pointer}";
11
11
 
12
12
  const FaqPopupComponent = class {
13
13
  constructor(hostRef) {
@@ -134,7 +134,8 @@ const FaqPopupComponent = class {
134
134
  if (!this.result) {
135
135
  return;
136
136
  }
137
- return (index.h(index.Host, { className: "clickable-host", onClick: () => this.openFAQModal(this.result) }, this.result.title));
137
+ const cssCondition = this.origin === 'searchResult' ? 'search-css' : '';
138
+ return (index.h(index.Host, { className: `clickable-host ${cssCondition}`, onClick: () => this.openFAQModal(this.result) }, this.result.title));
138
139
  }
139
140
  get host() { return index.getElement(this); }
140
141
  };
@@ -707,7 +707,7 @@ const updateComponent = async (hostRef, instance, isInitialLoad) => {
707
707
  };
708
708
  const callRender = (hostRef, instance, elm) => {
709
709
  try {
710
- instance = instance.render() ;
710
+ instance = instance.render && instance.render();
711
711
  {
712
712
  hostRef.$flags$ &= ~16 /* isQueuedForUpdate */;
713
713
  }
@@ -830,6 +830,11 @@ const addHydratedFlag = (elm) => elm.classList.add('hydrated')
830
830
  const parsePropertyValue = (propValue, propType) => {
831
831
  // ensure this value is of the correct prop type
832
832
  if (propValue != null && !isComplexType(propValue)) {
833
+ if (propType & 1 /* String */) {
834
+ // could have been passed as a number or boolean
835
+ // but we still want it as a string
836
+ return String(propValue);
837
+ }
833
838
  // redundant return here for better minification
834
839
  return propValue;
835
840
  }
@@ -844,7 +849,7 @@ const setValue = (ref, propName, newVal, cmpMeta) => {
844
849
  const oldVal = hostRef.$instanceValues$.get(propName);
845
850
  const flags = hostRef.$flags$;
846
851
  const instance = hostRef.$lazyInstance$ ;
847
- newVal = parsePropertyValue(newVal);
852
+ newVal = parsePropertyValue(newVal, cmpMeta.$members$[propName][0]);
848
853
  // explicitly check for NaN on both sides, as `NaN === NaN` is always false
849
854
  const areBothNaN = Number.isNaN(oldVal) && Number.isNaN(newVal);
850
855
  const didValueChange = newVal !== oldVal && !areBothNaN;
@@ -879,13 +884,76 @@ const proxyComponent = (Cstr, cmpMeta, flags) => {
879
884
  },
880
885
  set(newValue) {
881
886
  // proxyComponent, set value
882
- setValue(this, memberName, newValue);
887
+ setValue(this, memberName, newValue, cmpMeta);
883
888
  },
884
889
  configurable: true,
885
890
  enumerable: true,
886
891
  });
887
892
  }
888
893
  });
894
+ if ((flags & 1 /* isElementConstructor */)) {
895
+ const attrNameToPropName = new Map();
896
+ prototype.attributeChangedCallback = function (attrName, _oldValue, newValue) {
897
+ plt.jmp(() => {
898
+ const propName = attrNameToPropName.get(attrName);
899
+ // In a web component lifecycle the attributeChangedCallback runs prior to connectedCallback
900
+ // in the case where an attribute was set inline.
901
+ // ```html
902
+ // <my-component some-attribute="some-value"></my-component>
903
+ // ```
904
+ //
905
+ // There is an edge case where a developer sets the attribute inline on a custom element and then
906
+ // programmatically changes it before it has been upgraded as shown below:
907
+ //
908
+ // ```html
909
+ // <!-- this component has _not_ been upgraded yet -->
910
+ // <my-component id="test" some-attribute="some-value"></my-component>
911
+ // <script>
912
+ // // grab non-upgraded component
913
+ // el = document.querySelector("#test");
914
+ // el.someAttribute = "another-value";
915
+ // // upgrade component
916
+ // customElements.define('my-component', MyComponent);
917
+ // </script>
918
+ // ```
919
+ // In this case if we do not unshadow here and use the value of the shadowing property, attributeChangedCallback
920
+ // will be called with `newValue = "some-value"` and will set the shadowed property (this.someAttribute = "another-value")
921
+ // to the value that was set inline i.e. "some-value" from above example. When
922
+ // the connectedCallback attempts to unshadow it will use "some-value" as the initial value rather than "another-value"
923
+ //
924
+ // The case where the attribute was NOT set inline but was not set programmatically shall be handled/unshadowed
925
+ // by connectedCallback as this attributeChangedCallback will not fire.
926
+ //
927
+ // https://developers.google.com/web/fundamentals/web-components/best-practices#lazy-properties
928
+ //
929
+ // TODO(STENCIL-16) we should think about whether or not we actually want to be reflecting the attributes to
930
+ // properties here given that this goes against best practices outlined here
931
+ // https://developers.google.com/web/fundamentals/web-components/best-practices#avoid-reentrancy
932
+ if (this.hasOwnProperty(propName)) {
933
+ newValue = this[propName];
934
+ delete this[propName];
935
+ }
936
+ else if (prototype.hasOwnProperty(propName) &&
937
+ typeof this[propName] === 'number' &&
938
+ this[propName] == newValue) {
939
+ // if the propName exists on the prototype of `Cstr`, this update may be a result of Stencil using native
940
+ // APIs to reflect props as attributes. Calls to `setAttribute(someElement, propName)` will result in
941
+ // `propName` to be converted to a `DOMString`, which may not be what we want for other primitive props.
942
+ return;
943
+ }
944
+ this[propName] = newValue === null && typeof this[propName] === 'boolean' ? false : newValue;
945
+ });
946
+ };
947
+ // create an array of attributes to observe
948
+ // and also create a map of html attribute name to js property name
949
+ Cstr.observedAttributes = members
950
+ .filter(([_, m]) => m[0] & 15 /* HasAttribute */) // filter to only keep props that should match attributes
951
+ .map(([propName, m]) => {
952
+ const attrName = m[1] || propName;
953
+ attrNameToPropName.set(attrName, propName);
954
+ return attrName;
955
+ });
956
+ }
889
957
  }
890
958
  return Cstr;
891
959
  };
@@ -987,6 +1055,17 @@ const connectedCallback = (elm) => {
987
1055
  }
988
1056
  }
989
1057
  }
1058
+ // Lazy properties
1059
+ // https://developers.google.com/web/fundamentals/web-components/best-practices#lazy-properties
1060
+ if (cmpMeta.$members$) {
1061
+ Object.entries(cmpMeta.$members$).map(([memberName, [memberFlags]]) => {
1062
+ if (memberFlags & 31 /* Prop */ && elm.hasOwnProperty(memberName)) {
1063
+ const value = elm[memberName];
1064
+ delete elm[memberName];
1065
+ elm[memberName] = value;
1066
+ }
1067
+ });
1068
+ }
990
1069
  {
991
1070
  initializeComponent(elm, hostRef, cmpMeta);
992
1071
  }