@getlupa/client 0.8.0-alpha-3 → 0.8.1-alpha-1

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.
@@ -6,5 +6,6 @@ export default class SearchBoxProductCustom extends Vue {
6
6
  options: CustomDocumentElement;
7
7
  get text(): string;
8
8
  get className(): string;
9
+ get label(): string | undefined;
9
10
  get isHtml(): boolean;
10
11
  }
@@ -6,5 +6,6 @@ export default class SearchResultsProductCustom extends Vue {
6
6
  options: CustomDocumentElement;
7
7
  get text(): string;
8
8
  get className(): string;
9
+ get label(): string | undefined;
9
10
  get isHtml(): boolean;
10
11
  }
@@ -11640,6 +11640,9 @@ let SearchBoxProductCustom = class SearchBoxProductCustom extends Vue$1 {
11640
11640
  get className() {
11641
11641
  return this.options.className;
11642
11642
  }
11643
+ get label() {
11644
+ return this.options.label;
11645
+ }
11643
11646
  get isHtml() {
11644
11647
  var _a;
11645
11648
  return (_a = this.options.isHtml) !== null && _a !== void 0 ? _a : false;
@@ -11670,7 +11673,17 @@ var __vue_render__$13 = function () {
11670
11673
  domProps: { innerHTML: _vm._s(_vm.text) },
11671
11674
  })
11672
11675
  : _c("div", { class: [_vm.className, "lupa-search-box-product-custom"] }, [
11673
- _vm._v("\n " + _vm._s(_vm.text) + "\n"),
11676
+ !_vm.label
11677
+ ? _c("div", [_vm._v("\n " + _vm._s(_vm.text) + "\n ")])
11678
+ : _c("div", [
11679
+ _c("div", { staticClass: "lupa-search-box-custom-label" }, [
11680
+ _vm._v(_vm._s(_vm.label)),
11681
+ ]),
11682
+ _vm._v(" "),
11683
+ _c("div", { staticClass: "lupa-search-box-custom-text" }, [
11684
+ _vm._v(_vm._s(_vm.text)),
11685
+ ]),
11686
+ ]),
11674
11687
  ])
11675
11688
  };
11676
11689
  var __vue_staticRenderFns__$13 = [];
@@ -14121,7 +14134,10 @@ var Env = {
14121
14134
  staging: staging
14122
14135
  };
14123
14136
 
14124
- const getApiUrl = (environment) => {
14137
+ const getApiUrl = (environment, customBaseUrl) => {
14138
+ if (customBaseUrl) {
14139
+ return customBaseUrl;
14140
+ }
14125
14141
  return Env[environment] || Env["production"];
14126
14142
  };
14127
14143
 
@@ -14164,8 +14180,8 @@ const suggestCustom = (query, options) => __awaiter(void 0, void 0, void 0, func
14164
14180
  const errors = yield res.json();
14165
14181
  return { success: false, errors };
14166
14182
  });
14167
- const search = (queryKey, query, environment) => __awaiter(void 0, void 0, void 0, function* () {
14168
- const res = yield fetch(`${getApiUrl(environment)}query/${queryKey}`, Object.assign(Object.assign({}, defaultConfig), { body: JSON.stringify(query) }));
14183
+ const search = (queryKey, query, environment, customBaseUrl) => __awaiter(void 0, void 0, void 0, function* () {
14184
+ const res = yield fetch(`${getApiUrl(environment, customBaseUrl)}query/${queryKey}`, Object.assign(Object.assign({}, defaultConfig), { body: JSON.stringify(query) }));
14169
14185
  if (res.status < 400) {
14170
14186
  const data = yield res.json();
14171
14187
  return Object.assign(Object.assign({}, data), { success: true });
@@ -14173,8 +14189,8 @@ const search = (queryKey, query, environment) => __awaiter(void 0, void 0, void
14173
14189
  const errors = yield res.json();
14174
14190
  return { success: false, errors };
14175
14191
  });
14176
- const suggest = (queryKey, query, environment) => __awaiter(void 0, void 0, void 0, function* () {
14177
- const res = yield fetch(`${getApiUrl(environment)}query/${queryKey}`, Object.assign(Object.assign({}, defaultConfig), { body: JSON.stringify(query) }));
14192
+ const suggest = (queryKey, query, environment, customBaseUrl) => __awaiter(void 0, void 0, void 0, function* () {
14193
+ const res = yield fetch(`${getApiUrl(environment, customBaseUrl)}query/${queryKey}`, Object.assign(Object.assign({}, defaultConfig), { body: JSON.stringify(query) }));
14178
14194
  if (res.status < 400) {
14179
14195
  const items = yield res.json();
14180
14196
  return { items, success: true };
@@ -14182,8 +14198,8 @@ const suggest = (queryKey, query, environment) => __awaiter(void 0, void 0, void
14182
14198
  const errors = yield res.json();
14183
14199
  return { success: false, errors };
14184
14200
  });
14185
- const track$1 = (queryKey, event, environment) => __awaiter(void 0, void 0, void 0, function* () {
14186
- const res = yield fetch(`${getApiUrl(environment)}events`, Object.assign(Object.assign({}, defaultConfig), { body: JSON.stringify(Object.assign({ queryKey }, event)) }));
14201
+ const track$1 = (queryKey, event, environment, customBaseUrl) => __awaiter(void 0, void 0, void 0, function* () {
14202
+ const res = yield fetch(`${getApiUrl(environment, customBaseUrl)}events`, Object.assign(Object.assign({}, defaultConfig), { body: JSON.stringify(Object.assign({ queryKey }, event)) }));
14187
14203
  if (res.status < 400) {
14188
14204
  return { success: false };
14189
14205
  }
@@ -14195,16 +14211,16 @@ const getLupaSdk = {
14195
14211
  if (options === null || options === void 0 ? void 0 : options.customUrl) {
14196
14212
  return searchCustom(publicQuery, options);
14197
14213
  }
14198
- return search(queryKey, publicQuery, (options === null || options === void 0 ? void 0 : options.environment) || "production");
14214
+ return search(queryKey, publicQuery, (options === null || options === void 0 ? void 0 : options.environment) || "production", options === null || options === void 0 ? void 0 : options.customBaseUrl);
14199
14215
  },
14200
14216
  suggestions: (queryKey, suggestionQuery, options = null) => {
14201
14217
  if (options === null || options === void 0 ? void 0 : options.customUrl) {
14202
14218
  return suggestCustom(suggestionQuery, options);
14203
14219
  }
14204
- return suggest(queryKey, suggestionQuery, (options === null || options === void 0 ? void 0 : options.environment) || "production");
14220
+ return suggest(queryKey, suggestionQuery, (options === null || options === void 0 ? void 0 : options.environment) || "production", options === null || options === void 0 ? void 0 : options.customBaseUrl);
14205
14221
  },
14206
14222
  track: (queryKey, eventData, options = null) => {
14207
- return track$1(queryKey, eventData, (options === null || options === void 0 ? void 0 : options.environment) || "production");
14223
+ return track$1(queryKey, eventData, (options === null || options === void 0 ? void 0 : options.environment) || "production", options === null || options === void 0 ? void 0 : options.customBaseUrl);
14208
14224
  },
14209
14225
  };
14210
14226
 
@@ -17756,6 +17772,9 @@ let SearchResultsProductCustom = class SearchResultsProductCustom extends Vue$1
17756
17772
  get className() {
17757
17773
  return this.options.className;
17758
17774
  }
17775
+ get label() {
17776
+ return this.options.label;
17777
+ }
17759
17778
  get isHtml() {
17760
17779
  var _a;
17761
17780
  return (_a = this.options.isHtml) !== null && _a !== void 0 ? _a : false;
@@ -17787,7 +17806,19 @@ var __vue_render__$p = function () {
17787
17806
  class: _vm.className,
17788
17807
  domProps: { innerHTML: _vm._s(_vm.text) },
17789
17808
  })
17790
- : _c("div", { class: _vm.className }, [_vm._v(_vm._s(_vm.text))])
17809
+ : _c("div", { class: _vm.className }, [
17810
+ !_vm.label
17811
+ ? _c("div", [_vm._v("\n " + _vm._s(_vm.text) + "\n ")])
17812
+ : _c("div", [
17813
+ _c("div", { staticClass: "lupa-search-box-custom-label" }, [
17814
+ _vm._v(_vm._s(_vm.label)),
17815
+ ]),
17816
+ _vm._v(" "),
17817
+ _c("div", { staticClass: "lupa-search-box-custom-text" }, [
17818
+ _vm._v(_vm._s(_vm.text)),
17819
+ ]),
17820
+ ]),
17821
+ ])
17791
17822
  };
17792
17823
  var __vue_staticRenderFns__$p = [];
17793
17824
  __vue_render__$p._withStripped = true;
@@ -20695,6 +20726,10 @@ __vue_render__$5._withStripped = true;
20695
20726
  undefined
20696
20727
  );
20697
20728
 
20729
+ const setDocumentTitle = (template, textToInsert = "") => {
20730
+ document.title = addParamsToLabel(template, textToInsert);
20731
+ };
20732
+
20698
20733
  const searchResult$1 = namespace("searchResult");
20699
20734
  const params$1 = namespace("params");
20700
20735
  const options$1 = namespace("options");
@@ -20742,6 +20777,9 @@ let SearchResults = class SearchResults extends Vue$1 {
20742
20777
  }
20743
20778
  handleMounted() {
20744
20779
  this.handleResize();
20780
+ if (this.isProductList) {
20781
+ setDocumentTitle(this.options.labels.htmlTitleTemplate, "");
20782
+ }
20745
20783
  const params = new URLSearchParams(window.location.search);
20746
20784
  this.handleUrlChange(params);
20747
20785
  this.addParams(parseParams(params));
@@ -21945,10 +21983,6 @@ HistoryModule = __decorate([
21945
21983
  ], HistoryModule);
21946
21984
  var history = HistoryModule;
21947
21985
 
21948
- const setDocumentTitle = (template, textToInsert = "") => {
21949
- document.title = addParamsToLabel(template, textToInsert);
21950
- };
21951
-
21952
21986
  let SearchResultModule = class SearchResultModule extends VuexModule {
21953
21987
  constructor() {
21954
21988
  super(...arguments);
@@ -22198,7 +22232,9 @@ let ParamsModule = class ParamsModule extends VuexModule {
22198
22232
  if (!params) {
22199
22233
  return { params: this.params };
22200
22234
  }
22201
- return { params };
22235
+ const url = getPageUrl();
22236
+ const searchString = url.search;
22237
+ return { params, searchString };
22202
22238
  }
22203
22239
  removeAllFilters() {
22204
22240
  const url = getPageUrl();
@@ -20,6 +20,7 @@ export default class ParamsModule extends VuexModule {
20
20
  }): void;
21
21
  add(params: QueryParams): {
22
22
  params: QueryParams;
23
+ searchString?: string;
23
24
  };
24
25
  removeAllFilters(): {
25
26
  params: QueryParams;
@@ -38,6 +38,7 @@ export declare type CustomDocumentElement<T = any> = DocumentElementBase<T> & {
38
38
  maxLines?: number;
39
39
  className: string;
40
40
  key: string;
41
+ label?: string;
41
42
  };
42
43
  export declare type PriceElement<T = any> = DocumentElementBase<T> & {
43
44
  type: DocumentElementType.PRICE;
@@ -2,6 +2,7 @@ import { AnalyticsOptions } from "./AnalyticsOptions";
2
2
  import { Environment as SdkEnvironment } from "@getlupa/client-sdk/Types";
3
3
  export declare type SdkOptions = {
4
4
  environment: SdkEnvironment;
5
+ customBaseUrl?: string;
5
6
  customUrl?: string;
6
7
  customPayload?: Record<string, unknown>;
7
8
  customHeaders?: Record<string, string>;
@@ -6,5 +6,6 @@ export default class SearchBoxProductCustom extends Vue {
6
6
  options: CustomDocumentElement;
7
7
  get text(): string;
8
8
  get className(): string;
9
+ get label(): string | undefined;
9
10
  get isHtml(): boolean;
10
11
  }
@@ -6,5 +6,6 @@ export default class SearchResultsProductCustom extends Vue {
6
6
  options: CustomDocumentElement;
7
7
  get text(): string;
8
8
  get className(): string;
9
+ get label(): string | undefined;
9
10
  get isHtml(): boolean;
10
11
  }
@@ -11636,6 +11636,9 @@ let SearchBoxProductCustom = class SearchBoxProductCustom extends Vue$1 {
11636
11636
  get className() {
11637
11637
  return this.options.className;
11638
11638
  }
11639
+ get label() {
11640
+ return this.options.label;
11641
+ }
11639
11642
  get isHtml() {
11640
11643
  var _a;
11641
11644
  return (_a = this.options.isHtml) !== null && _a !== void 0 ? _a : false;
@@ -11666,7 +11669,17 @@ var __vue_render__$13 = function () {
11666
11669
  domProps: { innerHTML: _vm._s(_vm.text) },
11667
11670
  })
11668
11671
  : _c("div", { class: [_vm.className, "lupa-search-box-product-custom"] }, [
11669
- _vm._v("\n " + _vm._s(_vm.text) + "\n"),
11672
+ !_vm.label
11673
+ ? _c("div", [_vm._v("\n " + _vm._s(_vm.text) + "\n ")])
11674
+ : _c("div", [
11675
+ _c("div", { staticClass: "lupa-search-box-custom-label" }, [
11676
+ _vm._v(_vm._s(_vm.label)),
11677
+ ]),
11678
+ _vm._v(" "),
11679
+ _c("div", { staticClass: "lupa-search-box-custom-text" }, [
11680
+ _vm._v(_vm._s(_vm.text)),
11681
+ ]),
11682
+ ]),
11670
11683
  ])
11671
11684
  };
11672
11685
  var __vue_staticRenderFns__$13 = [];
@@ -14117,7 +14130,10 @@ var Env = {
14117
14130
  staging: staging
14118
14131
  };
14119
14132
 
14120
- const getApiUrl = (environment) => {
14133
+ const getApiUrl = (environment, customBaseUrl) => {
14134
+ if (customBaseUrl) {
14135
+ return customBaseUrl;
14136
+ }
14121
14137
  return Env[environment] || Env["production"];
14122
14138
  };
14123
14139
 
@@ -14160,8 +14176,8 @@ const suggestCustom = (query, options) => __awaiter(void 0, void 0, void 0, func
14160
14176
  const errors = yield res.json();
14161
14177
  return { success: false, errors };
14162
14178
  });
14163
- const search = (queryKey, query, environment) => __awaiter(void 0, void 0, void 0, function* () {
14164
- const res = yield fetch(`${getApiUrl(environment)}query/${queryKey}`, Object.assign(Object.assign({}, defaultConfig), { body: JSON.stringify(query) }));
14179
+ const search = (queryKey, query, environment, customBaseUrl) => __awaiter(void 0, void 0, void 0, function* () {
14180
+ const res = yield fetch(`${getApiUrl(environment, customBaseUrl)}query/${queryKey}`, Object.assign(Object.assign({}, defaultConfig), { body: JSON.stringify(query) }));
14165
14181
  if (res.status < 400) {
14166
14182
  const data = yield res.json();
14167
14183
  return Object.assign(Object.assign({}, data), { success: true });
@@ -14169,8 +14185,8 @@ const search = (queryKey, query, environment) => __awaiter(void 0, void 0, void
14169
14185
  const errors = yield res.json();
14170
14186
  return { success: false, errors };
14171
14187
  });
14172
- const suggest = (queryKey, query, environment) => __awaiter(void 0, void 0, void 0, function* () {
14173
- const res = yield fetch(`${getApiUrl(environment)}query/${queryKey}`, Object.assign(Object.assign({}, defaultConfig), { body: JSON.stringify(query) }));
14188
+ const suggest = (queryKey, query, environment, customBaseUrl) => __awaiter(void 0, void 0, void 0, function* () {
14189
+ const res = yield fetch(`${getApiUrl(environment, customBaseUrl)}query/${queryKey}`, Object.assign(Object.assign({}, defaultConfig), { body: JSON.stringify(query) }));
14174
14190
  if (res.status < 400) {
14175
14191
  const items = yield res.json();
14176
14192
  return { items, success: true };
@@ -14178,8 +14194,8 @@ const suggest = (queryKey, query, environment) => __awaiter(void 0, void 0, void
14178
14194
  const errors = yield res.json();
14179
14195
  return { success: false, errors };
14180
14196
  });
14181
- const track$1 = (queryKey, event, environment) => __awaiter(void 0, void 0, void 0, function* () {
14182
- const res = yield fetch(`${getApiUrl(environment)}events`, Object.assign(Object.assign({}, defaultConfig), { body: JSON.stringify(Object.assign({ queryKey }, event)) }));
14197
+ const track$1 = (queryKey, event, environment, customBaseUrl) => __awaiter(void 0, void 0, void 0, function* () {
14198
+ const res = yield fetch(`${getApiUrl(environment, customBaseUrl)}events`, Object.assign(Object.assign({}, defaultConfig), { body: JSON.stringify(Object.assign({ queryKey }, event)) }));
14183
14199
  if (res.status < 400) {
14184
14200
  return { success: false };
14185
14201
  }
@@ -14191,16 +14207,16 @@ const getLupaSdk = {
14191
14207
  if (options === null || options === void 0 ? void 0 : options.customUrl) {
14192
14208
  return searchCustom(publicQuery, options);
14193
14209
  }
14194
- return search(queryKey, publicQuery, (options === null || options === void 0 ? void 0 : options.environment) || "production");
14210
+ return search(queryKey, publicQuery, (options === null || options === void 0 ? void 0 : options.environment) || "production", options === null || options === void 0 ? void 0 : options.customBaseUrl);
14195
14211
  },
14196
14212
  suggestions: (queryKey, suggestionQuery, options = null) => {
14197
14213
  if (options === null || options === void 0 ? void 0 : options.customUrl) {
14198
14214
  return suggestCustom(suggestionQuery, options);
14199
14215
  }
14200
- return suggest(queryKey, suggestionQuery, (options === null || options === void 0 ? void 0 : options.environment) || "production");
14216
+ return suggest(queryKey, suggestionQuery, (options === null || options === void 0 ? void 0 : options.environment) || "production", options === null || options === void 0 ? void 0 : options.customBaseUrl);
14201
14217
  },
14202
14218
  track: (queryKey, eventData, options = null) => {
14203
- return track$1(queryKey, eventData, (options === null || options === void 0 ? void 0 : options.environment) || "production");
14219
+ return track$1(queryKey, eventData, (options === null || options === void 0 ? void 0 : options.environment) || "production", options === null || options === void 0 ? void 0 : options.customBaseUrl);
14204
14220
  },
14205
14221
  };
14206
14222
 
@@ -17752,6 +17768,9 @@ let SearchResultsProductCustom = class SearchResultsProductCustom extends Vue$1
17752
17768
  get className() {
17753
17769
  return this.options.className;
17754
17770
  }
17771
+ get label() {
17772
+ return this.options.label;
17773
+ }
17755
17774
  get isHtml() {
17756
17775
  var _a;
17757
17776
  return (_a = this.options.isHtml) !== null && _a !== void 0 ? _a : false;
@@ -17783,7 +17802,19 @@ var __vue_render__$p = function () {
17783
17802
  class: _vm.className,
17784
17803
  domProps: { innerHTML: _vm._s(_vm.text) },
17785
17804
  })
17786
- : _c("div", { class: _vm.className }, [_vm._v(_vm._s(_vm.text))])
17805
+ : _c("div", { class: _vm.className }, [
17806
+ !_vm.label
17807
+ ? _c("div", [_vm._v("\n " + _vm._s(_vm.text) + "\n ")])
17808
+ : _c("div", [
17809
+ _c("div", { staticClass: "lupa-search-box-custom-label" }, [
17810
+ _vm._v(_vm._s(_vm.label)),
17811
+ ]),
17812
+ _vm._v(" "),
17813
+ _c("div", { staticClass: "lupa-search-box-custom-text" }, [
17814
+ _vm._v(_vm._s(_vm.text)),
17815
+ ]),
17816
+ ]),
17817
+ ])
17787
17818
  };
17788
17819
  var __vue_staticRenderFns__$p = [];
17789
17820
  __vue_render__$p._withStripped = true;
@@ -20691,6 +20722,10 @@ __vue_render__$5._withStripped = true;
20691
20722
  undefined
20692
20723
  );
20693
20724
 
20725
+ const setDocumentTitle = (template, textToInsert = "") => {
20726
+ document.title = addParamsToLabel(template, textToInsert);
20727
+ };
20728
+
20694
20729
  const searchResult$1 = namespace("searchResult");
20695
20730
  const params$1 = namespace("params");
20696
20731
  const options$1 = namespace("options");
@@ -20738,6 +20773,9 @@ let SearchResults = class SearchResults extends Vue$1 {
20738
20773
  }
20739
20774
  handleMounted() {
20740
20775
  this.handleResize();
20776
+ if (this.isProductList) {
20777
+ setDocumentTitle(this.options.labels.htmlTitleTemplate, "");
20778
+ }
20741
20779
  const params = new URLSearchParams(window.location.search);
20742
20780
  this.handleUrlChange(params);
20743
20781
  this.addParams(parseParams(params));
@@ -21941,10 +21979,6 @@ HistoryModule = __decorate([
21941
21979
  ], HistoryModule);
21942
21980
  var history = HistoryModule;
21943
21981
 
21944
- const setDocumentTitle = (template, textToInsert = "") => {
21945
- document.title = addParamsToLabel(template, textToInsert);
21946
- };
21947
-
21948
21982
  let SearchResultModule = class SearchResultModule extends VuexModule {
21949
21983
  constructor() {
21950
21984
  super(...arguments);
@@ -22194,7 +22228,9 @@ let ParamsModule = class ParamsModule extends VuexModule {
22194
22228
  if (!params) {
22195
22229
  return { params: this.params };
22196
22230
  }
22197
- return { params };
22231
+ const url = getPageUrl();
22232
+ const searchString = url.search;
22233
+ return { params, searchString };
22198
22234
  }
22199
22235
  removeAllFilters() {
22200
22236
  const url = getPageUrl();
@@ -20,6 +20,7 @@ export default class ParamsModule extends VuexModule {
20
20
  }): void;
21
21
  add(params: QueryParams): {
22
22
  params: QueryParams;
23
+ searchString?: string;
23
24
  };
24
25
  removeAllFilters(): {
25
26
  params: QueryParams;
@@ -38,6 +38,7 @@ export declare type CustomDocumentElement<T = any> = DocumentElementBase<T> & {
38
38
  maxLines?: number;
39
39
  className: string;
40
40
  key: string;
41
+ label?: string;
41
42
  };
42
43
  export declare type PriceElement<T = any> = DocumentElementBase<T> & {
43
44
  type: DocumentElementType.PRICE;
@@ -2,6 +2,7 @@ import { AnalyticsOptions } from "./AnalyticsOptions";
2
2
  import { Environment as SdkEnvironment } from "@getlupa/client-sdk/Types";
3
3
  export declare type SdkOptions = {
4
4
  environment: SdkEnvironment;
5
+ customBaseUrl?: string;
5
6
  customUrl?: string;
6
7
  customPayload?: Record<string, unknown>;
7
8
  customHeaders?: Record<string, string>;
@@ -6,5 +6,6 @@ export default class SearchBoxProductCustom extends Vue {
6
6
  options: CustomDocumentElement;
7
7
  get text(): string;
8
8
  get className(): string;
9
+ get label(): string | undefined;
9
10
  get isHtml(): boolean;
10
11
  }
@@ -6,5 +6,6 @@ export default class SearchResultsProductCustom extends Vue {
6
6
  options: CustomDocumentElement;
7
7
  get text(): string;
8
8
  get className(): string;
9
+ get label(): string | undefined;
9
10
  get isHtml(): boolean;
10
11
  }