@ikas/storefront 0.0.23 → 0.0.25
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/build/index.es.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { makeAutoObservable, toJS, runInAction, reaction, action, computed, configure } from 'mobx';
|
|
2
|
-
import queryString
|
|
2
|
+
import queryString from 'querystring';
|
|
3
3
|
import React, { createElement, useState, useEffect, Fragment, useCallback, useRef } from 'react';
|
|
4
4
|
import { observer } from 'mobx-react-lite';
|
|
5
5
|
import { useRouter } from 'next/router';
|
|
@@ -11034,505 +11034,6 @@ var IkasBrandListPropValueProvider = /** @class */ (function () {
|
|
|
11034
11034
|
return IkasBrandListPropValueProvider;
|
|
11035
11035
|
}());
|
|
11036
11036
|
|
|
11037
|
-
var strictUriEncode = str => encodeURIComponent(str).replace(/[!'()*]/g, x => `%${x.charCodeAt(0).toString(16).toUpperCase()}`);
|
|
11038
|
-
|
|
11039
|
-
var token = '%[a-f0-9]{2}';
|
|
11040
|
-
var singleMatcher = new RegExp(token, 'gi');
|
|
11041
|
-
var multiMatcher = new RegExp('(' + token + ')+', 'gi');
|
|
11042
|
-
|
|
11043
|
-
function decodeComponents(components, split) {
|
|
11044
|
-
try {
|
|
11045
|
-
// Try to decode the entire string first
|
|
11046
|
-
return decodeURIComponent(components.join(''));
|
|
11047
|
-
} catch (err) {
|
|
11048
|
-
// Do nothing
|
|
11049
|
-
}
|
|
11050
|
-
|
|
11051
|
-
if (components.length === 1) {
|
|
11052
|
-
return components;
|
|
11053
|
-
}
|
|
11054
|
-
|
|
11055
|
-
split = split || 1;
|
|
11056
|
-
|
|
11057
|
-
// Split the array in 2 parts
|
|
11058
|
-
var left = components.slice(0, split);
|
|
11059
|
-
var right = components.slice(split);
|
|
11060
|
-
|
|
11061
|
-
return Array.prototype.concat.call([], decodeComponents(left), decodeComponents(right));
|
|
11062
|
-
}
|
|
11063
|
-
|
|
11064
|
-
function decode(input) {
|
|
11065
|
-
try {
|
|
11066
|
-
return decodeURIComponent(input);
|
|
11067
|
-
} catch (err) {
|
|
11068
|
-
var tokens = input.match(singleMatcher);
|
|
11069
|
-
|
|
11070
|
-
for (var i = 1; i < tokens.length; i++) {
|
|
11071
|
-
input = decodeComponents(tokens, i).join('');
|
|
11072
|
-
|
|
11073
|
-
tokens = input.match(singleMatcher);
|
|
11074
|
-
}
|
|
11075
|
-
|
|
11076
|
-
return input;
|
|
11077
|
-
}
|
|
11078
|
-
}
|
|
11079
|
-
|
|
11080
|
-
function customDecodeURIComponent(input) {
|
|
11081
|
-
// Keep track of all the replacements and prefill the map with the `BOM`
|
|
11082
|
-
var replaceMap = {
|
|
11083
|
-
'%FE%FF': '\uFFFD\uFFFD',
|
|
11084
|
-
'%FF%FE': '\uFFFD\uFFFD'
|
|
11085
|
-
};
|
|
11086
|
-
|
|
11087
|
-
var match = multiMatcher.exec(input);
|
|
11088
|
-
while (match) {
|
|
11089
|
-
try {
|
|
11090
|
-
// Decode as big chunks as possible
|
|
11091
|
-
replaceMap[match[0]] = decodeURIComponent(match[0]);
|
|
11092
|
-
} catch (err) {
|
|
11093
|
-
var result = decode(match[0]);
|
|
11094
|
-
|
|
11095
|
-
if (result !== match[0]) {
|
|
11096
|
-
replaceMap[match[0]] = result;
|
|
11097
|
-
}
|
|
11098
|
-
}
|
|
11099
|
-
|
|
11100
|
-
match = multiMatcher.exec(input);
|
|
11101
|
-
}
|
|
11102
|
-
|
|
11103
|
-
// Add `%C2` at the end of the map to make sure it does not replace the combinator before everything else
|
|
11104
|
-
replaceMap['%C2'] = '\uFFFD';
|
|
11105
|
-
|
|
11106
|
-
var entries = Object.keys(replaceMap);
|
|
11107
|
-
|
|
11108
|
-
for (var i = 0; i < entries.length; i++) {
|
|
11109
|
-
// Replace all decoded components
|
|
11110
|
-
var key = entries[i];
|
|
11111
|
-
input = input.replace(new RegExp(key, 'g'), replaceMap[key]);
|
|
11112
|
-
}
|
|
11113
|
-
|
|
11114
|
-
return input;
|
|
11115
|
-
}
|
|
11116
|
-
|
|
11117
|
-
var decodeUriComponent = function (encodedURI) {
|
|
11118
|
-
if (typeof encodedURI !== 'string') {
|
|
11119
|
-
throw new TypeError('Expected `encodedURI` to be of type `string`, got `' + typeof encodedURI + '`');
|
|
11120
|
-
}
|
|
11121
|
-
|
|
11122
|
-
try {
|
|
11123
|
-
encodedURI = encodedURI.replace(/\+/g, ' ');
|
|
11124
|
-
|
|
11125
|
-
// Try the built in decoder first
|
|
11126
|
-
return decodeURIComponent(encodedURI);
|
|
11127
|
-
} catch (err) {
|
|
11128
|
-
// Fallback to a more advanced decoder
|
|
11129
|
-
return customDecodeURIComponent(encodedURI);
|
|
11130
|
-
}
|
|
11131
|
-
};
|
|
11132
|
-
|
|
11133
|
-
var splitOnFirst = (string, separator) => {
|
|
11134
|
-
if (!(typeof string === 'string' && typeof separator === 'string')) {
|
|
11135
|
-
throw new TypeError('Expected the arguments to be of type `string`');
|
|
11136
|
-
}
|
|
11137
|
-
|
|
11138
|
-
if (separator === '') {
|
|
11139
|
-
return [string];
|
|
11140
|
-
}
|
|
11141
|
-
|
|
11142
|
-
const separatorIndex = string.indexOf(separator);
|
|
11143
|
-
|
|
11144
|
-
if (separatorIndex === -1) {
|
|
11145
|
-
return [string];
|
|
11146
|
-
}
|
|
11147
|
-
|
|
11148
|
-
return [
|
|
11149
|
-
string.slice(0, separatorIndex),
|
|
11150
|
-
string.slice(separatorIndex + separator.length)
|
|
11151
|
-
];
|
|
11152
|
-
};
|
|
11153
|
-
|
|
11154
|
-
var queryString = createCommonjsModule(function (module, exports) {
|
|
11155
|
-
|
|
11156
|
-
|
|
11157
|
-
|
|
11158
|
-
|
|
11159
|
-
const isNullOrUndefined = value => value === null || value === undefined;
|
|
11160
|
-
|
|
11161
|
-
function encoderForArrayFormat(options) {
|
|
11162
|
-
switch (options.arrayFormat) {
|
|
11163
|
-
case 'index':
|
|
11164
|
-
return key => (result, value) => {
|
|
11165
|
-
const index = result.length;
|
|
11166
|
-
|
|
11167
|
-
if (
|
|
11168
|
-
value === undefined ||
|
|
11169
|
-
(options.skipNull && value === null) ||
|
|
11170
|
-
(options.skipEmptyString && value === '')
|
|
11171
|
-
) {
|
|
11172
|
-
return result;
|
|
11173
|
-
}
|
|
11174
|
-
|
|
11175
|
-
if (value === null) {
|
|
11176
|
-
return [...result, [encode(key, options), '[', index, ']'].join('')];
|
|
11177
|
-
}
|
|
11178
|
-
|
|
11179
|
-
return [
|
|
11180
|
-
...result,
|
|
11181
|
-
[encode(key, options), '[', encode(index, options), ']=', encode(value, options)].join('')
|
|
11182
|
-
];
|
|
11183
|
-
};
|
|
11184
|
-
|
|
11185
|
-
case 'bracket':
|
|
11186
|
-
return key => (result, value) => {
|
|
11187
|
-
if (
|
|
11188
|
-
value === undefined ||
|
|
11189
|
-
(options.skipNull && value === null) ||
|
|
11190
|
-
(options.skipEmptyString && value === '')
|
|
11191
|
-
) {
|
|
11192
|
-
return result;
|
|
11193
|
-
}
|
|
11194
|
-
|
|
11195
|
-
if (value === null) {
|
|
11196
|
-
return [...result, [encode(key, options), '[]'].join('')];
|
|
11197
|
-
}
|
|
11198
|
-
|
|
11199
|
-
return [...result, [encode(key, options), '[]=', encode(value, options)].join('')];
|
|
11200
|
-
};
|
|
11201
|
-
|
|
11202
|
-
case 'comma':
|
|
11203
|
-
case 'separator':
|
|
11204
|
-
return key => (result, value) => {
|
|
11205
|
-
if (value === null || value === undefined || value.length === 0) {
|
|
11206
|
-
return result;
|
|
11207
|
-
}
|
|
11208
|
-
|
|
11209
|
-
if (result.length === 0) {
|
|
11210
|
-
return [[encode(key, options), '=', encode(value, options)].join('')];
|
|
11211
|
-
}
|
|
11212
|
-
|
|
11213
|
-
return [[result, encode(value, options)].join(options.arrayFormatSeparator)];
|
|
11214
|
-
};
|
|
11215
|
-
|
|
11216
|
-
default:
|
|
11217
|
-
return key => (result, value) => {
|
|
11218
|
-
if (
|
|
11219
|
-
value === undefined ||
|
|
11220
|
-
(options.skipNull && value === null) ||
|
|
11221
|
-
(options.skipEmptyString && value === '')
|
|
11222
|
-
) {
|
|
11223
|
-
return result;
|
|
11224
|
-
}
|
|
11225
|
-
|
|
11226
|
-
if (value === null) {
|
|
11227
|
-
return [...result, encode(key, options)];
|
|
11228
|
-
}
|
|
11229
|
-
|
|
11230
|
-
return [...result, [encode(key, options), '=', encode(value, options)].join('')];
|
|
11231
|
-
};
|
|
11232
|
-
}
|
|
11233
|
-
}
|
|
11234
|
-
|
|
11235
|
-
function parserForArrayFormat(options) {
|
|
11236
|
-
let result;
|
|
11237
|
-
|
|
11238
|
-
switch (options.arrayFormat) {
|
|
11239
|
-
case 'index':
|
|
11240
|
-
return (key, value, accumulator) => {
|
|
11241
|
-
result = /\[(\d*)\]$/.exec(key);
|
|
11242
|
-
|
|
11243
|
-
key = key.replace(/\[\d*\]$/, '');
|
|
11244
|
-
|
|
11245
|
-
if (!result) {
|
|
11246
|
-
accumulator[key] = value;
|
|
11247
|
-
return;
|
|
11248
|
-
}
|
|
11249
|
-
|
|
11250
|
-
if (accumulator[key] === undefined) {
|
|
11251
|
-
accumulator[key] = {};
|
|
11252
|
-
}
|
|
11253
|
-
|
|
11254
|
-
accumulator[key][result[1]] = value;
|
|
11255
|
-
};
|
|
11256
|
-
|
|
11257
|
-
case 'bracket':
|
|
11258
|
-
return (key, value, accumulator) => {
|
|
11259
|
-
result = /(\[\])$/.exec(key);
|
|
11260
|
-
key = key.replace(/\[\]$/, '');
|
|
11261
|
-
|
|
11262
|
-
if (!result) {
|
|
11263
|
-
accumulator[key] = value;
|
|
11264
|
-
return;
|
|
11265
|
-
}
|
|
11266
|
-
|
|
11267
|
-
if (accumulator[key] === undefined) {
|
|
11268
|
-
accumulator[key] = [value];
|
|
11269
|
-
return;
|
|
11270
|
-
}
|
|
11271
|
-
|
|
11272
|
-
accumulator[key] = [].concat(accumulator[key], value);
|
|
11273
|
-
};
|
|
11274
|
-
|
|
11275
|
-
case 'comma':
|
|
11276
|
-
case 'separator':
|
|
11277
|
-
return (key, value, accumulator) => {
|
|
11278
|
-
const isArray = typeof value === 'string' && value.includes(options.arrayFormatSeparator);
|
|
11279
|
-
const isEncodedArray = (typeof value === 'string' && !isArray && decode(value, options).includes(options.arrayFormatSeparator));
|
|
11280
|
-
value = isEncodedArray ? decode(value, options) : value;
|
|
11281
|
-
const newValue = isArray || isEncodedArray ? value.split(options.arrayFormatSeparator).map(item => decode(item, options)) : value === null ? value : decode(value, options);
|
|
11282
|
-
accumulator[key] = newValue;
|
|
11283
|
-
};
|
|
11284
|
-
|
|
11285
|
-
default:
|
|
11286
|
-
return (key, value, accumulator) => {
|
|
11287
|
-
if (accumulator[key] === undefined) {
|
|
11288
|
-
accumulator[key] = value;
|
|
11289
|
-
return;
|
|
11290
|
-
}
|
|
11291
|
-
|
|
11292
|
-
accumulator[key] = [].concat(accumulator[key], value);
|
|
11293
|
-
};
|
|
11294
|
-
}
|
|
11295
|
-
}
|
|
11296
|
-
|
|
11297
|
-
function validateArrayFormatSeparator(value) {
|
|
11298
|
-
if (typeof value !== 'string' || value.length !== 1) {
|
|
11299
|
-
throw new TypeError('arrayFormatSeparator must be single character string');
|
|
11300
|
-
}
|
|
11301
|
-
}
|
|
11302
|
-
|
|
11303
|
-
function encode(value, options) {
|
|
11304
|
-
if (options.encode) {
|
|
11305
|
-
return options.strict ? strictUriEncode(value) : encodeURIComponent(value);
|
|
11306
|
-
}
|
|
11307
|
-
|
|
11308
|
-
return value;
|
|
11309
|
-
}
|
|
11310
|
-
|
|
11311
|
-
function decode(value, options) {
|
|
11312
|
-
if (options.decode) {
|
|
11313
|
-
return decodeUriComponent(value);
|
|
11314
|
-
}
|
|
11315
|
-
|
|
11316
|
-
return value;
|
|
11317
|
-
}
|
|
11318
|
-
|
|
11319
|
-
function keysSorter(input) {
|
|
11320
|
-
if (Array.isArray(input)) {
|
|
11321
|
-
return input.sort();
|
|
11322
|
-
}
|
|
11323
|
-
|
|
11324
|
-
if (typeof input === 'object') {
|
|
11325
|
-
return keysSorter(Object.keys(input))
|
|
11326
|
-
.sort((a, b) => Number(a) - Number(b))
|
|
11327
|
-
.map(key => input[key]);
|
|
11328
|
-
}
|
|
11329
|
-
|
|
11330
|
-
return input;
|
|
11331
|
-
}
|
|
11332
|
-
|
|
11333
|
-
function removeHash(input) {
|
|
11334
|
-
const hashStart = input.indexOf('#');
|
|
11335
|
-
if (hashStart !== -1) {
|
|
11336
|
-
input = input.slice(0, hashStart);
|
|
11337
|
-
}
|
|
11338
|
-
|
|
11339
|
-
return input;
|
|
11340
|
-
}
|
|
11341
|
-
|
|
11342
|
-
function getHash(url) {
|
|
11343
|
-
let hash = '';
|
|
11344
|
-
const hashStart = url.indexOf('#');
|
|
11345
|
-
if (hashStart !== -1) {
|
|
11346
|
-
hash = url.slice(hashStart);
|
|
11347
|
-
}
|
|
11348
|
-
|
|
11349
|
-
return hash;
|
|
11350
|
-
}
|
|
11351
|
-
|
|
11352
|
-
function extract(input) {
|
|
11353
|
-
input = removeHash(input);
|
|
11354
|
-
const queryStart = input.indexOf('?');
|
|
11355
|
-
if (queryStart === -1) {
|
|
11356
|
-
return '';
|
|
11357
|
-
}
|
|
11358
|
-
|
|
11359
|
-
return input.slice(queryStart + 1);
|
|
11360
|
-
}
|
|
11361
|
-
|
|
11362
|
-
function parseValue(value, options) {
|
|
11363
|
-
if (options.parseNumbers && !Number.isNaN(Number(value)) && (typeof value === 'string' && value.trim() !== '')) {
|
|
11364
|
-
value = Number(value);
|
|
11365
|
-
} else if (options.parseBooleans && value !== null && (value.toLowerCase() === 'true' || value.toLowerCase() === 'false')) {
|
|
11366
|
-
value = value.toLowerCase() === 'true';
|
|
11367
|
-
}
|
|
11368
|
-
|
|
11369
|
-
return value;
|
|
11370
|
-
}
|
|
11371
|
-
|
|
11372
|
-
function parse(query, options) {
|
|
11373
|
-
options = Object.assign({
|
|
11374
|
-
decode: true,
|
|
11375
|
-
sort: true,
|
|
11376
|
-
arrayFormat: 'none',
|
|
11377
|
-
arrayFormatSeparator: ',',
|
|
11378
|
-
parseNumbers: false,
|
|
11379
|
-
parseBooleans: false
|
|
11380
|
-
}, options);
|
|
11381
|
-
|
|
11382
|
-
validateArrayFormatSeparator(options.arrayFormatSeparator);
|
|
11383
|
-
|
|
11384
|
-
const formatter = parserForArrayFormat(options);
|
|
11385
|
-
|
|
11386
|
-
// Create an object with no prototype
|
|
11387
|
-
const ret = Object.create(null);
|
|
11388
|
-
|
|
11389
|
-
if (typeof query !== 'string') {
|
|
11390
|
-
return ret;
|
|
11391
|
-
}
|
|
11392
|
-
|
|
11393
|
-
query = query.trim().replace(/^[?#&]/, '');
|
|
11394
|
-
|
|
11395
|
-
if (!query) {
|
|
11396
|
-
return ret;
|
|
11397
|
-
}
|
|
11398
|
-
|
|
11399
|
-
for (const param of query.split('&')) {
|
|
11400
|
-
let [key, value] = splitOnFirst(options.decode ? param.replace(/\+/g, ' ') : param, '=');
|
|
11401
|
-
|
|
11402
|
-
// Missing `=` should be `null`:
|
|
11403
|
-
// http://w3.org/TR/2012/WD-url-20120524/#collect-url-parameters
|
|
11404
|
-
value = value === undefined ? null : ['comma', 'separator'].includes(options.arrayFormat) ? value : decode(value, options);
|
|
11405
|
-
formatter(decode(key, options), value, ret);
|
|
11406
|
-
}
|
|
11407
|
-
|
|
11408
|
-
for (const key of Object.keys(ret)) {
|
|
11409
|
-
const value = ret[key];
|
|
11410
|
-
if (typeof value === 'object' && value !== null) {
|
|
11411
|
-
for (const k of Object.keys(value)) {
|
|
11412
|
-
value[k] = parseValue(value[k], options);
|
|
11413
|
-
}
|
|
11414
|
-
} else {
|
|
11415
|
-
ret[key] = parseValue(value, options);
|
|
11416
|
-
}
|
|
11417
|
-
}
|
|
11418
|
-
|
|
11419
|
-
if (options.sort === false) {
|
|
11420
|
-
return ret;
|
|
11421
|
-
}
|
|
11422
|
-
|
|
11423
|
-
return (options.sort === true ? Object.keys(ret).sort() : Object.keys(ret).sort(options.sort)).reduce((result, key) => {
|
|
11424
|
-
const value = ret[key];
|
|
11425
|
-
if (Boolean(value) && typeof value === 'object' && !Array.isArray(value)) {
|
|
11426
|
-
// Sort object keys, not values
|
|
11427
|
-
result[key] = keysSorter(value);
|
|
11428
|
-
} else {
|
|
11429
|
-
result[key] = value;
|
|
11430
|
-
}
|
|
11431
|
-
|
|
11432
|
-
return result;
|
|
11433
|
-
}, Object.create(null));
|
|
11434
|
-
}
|
|
11435
|
-
|
|
11436
|
-
exports.extract = extract;
|
|
11437
|
-
exports.parse = parse;
|
|
11438
|
-
|
|
11439
|
-
exports.stringify = (object, options) => {
|
|
11440
|
-
if (!object) {
|
|
11441
|
-
return '';
|
|
11442
|
-
}
|
|
11443
|
-
|
|
11444
|
-
options = Object.assign({
|
|
11445
|
-
encode: true,
|
|
11446
|
-
strict: true,
|
|
11447
|
-
arrayFormat: 'none',
|
|
11448
|
-
arrayFormatSeparator: ','
|
|
11449
|
-
}, options);
|
|
11450
|
-
|
|
11451
|
-
validateArrayFormatSeparator(options.arrayFormatSeparator);
|
|
11452
|
-
|
|
11453
|
-
const shouldFilter = key => (
|
|
11454
|
-
(options.skipNull && isNullOrUndefined(object[key])) ||
|
|
11455
|
-
(options.skipEmptyString && object[key] === '')
|
|
11456
|
-
);
|
|
11457
|
-
|
|
11458
|
-
const formatter = encoderForArrayFormat(options);
|
|
11459
|
-
|
|
11460
|
-
const objectCopy = {};
|
|
11461
|
-
|
|
11462
|
-
for (const key of Object.keys(object)) {
|
|
11463
|
-
if (!shouldFilter(key)) {
|
|
11464
|
-
objectCopy[key] = object[key];
|
|
11465
|
-
}
|
|
11466
|
-
}
|
|
11467
|
-
|
|
11468
|
-
const keys = Object.keys(objectCopy);
|
|
11469
|
-
|
|
11470
|
-
if (options.sort !== false) {
|
|
11471
|
-
keys.sort(options.sort);
|
|
11472
|
-
}
|
|
11473
|
-
|
|
11474
|
-
return keys.map(key => {
|
|
11475
|
-
const value = object[key];
|
|
11476
|
-
|
|
11477
|
-
if (value === undefined) {
|
|
11478
|
-
return '';
|
|
11479
|
-
}
|
|
11480
|
-
|
|
11481
|
-
if (value === null) {
|
|
11482
|
-
return encode(key, options);
|
|
11483
|
-
}
|
|
11484
|
-
|
|
11485
|
-
if (Array.isArray(value)) {
|
|
11486
|
-
return value
|
|
11487
|
-
.reduce(formatter(key), [])
|
|
11488
|
-
.join('&');
|
|
11489
|
-
}
|
|
11490
|
-
|
|
11491
|
-
return encode(key, options) + '=' + encode(value, options);
|
|
11492
|
-
}).filter(x => x.length > 0).join('&');
|
|
11493
|
-
};
|
|
11494
|
-
|
|
11495
|
-
exports.parseUrl = (url, options) => {
|
|
11496
|
-
options = Object.assign({
|
|
11497
|
-
decode: true
|
|
11498
|
-
}, options);
|
|
11499
|
-
|
|
11500
|
-
const [url_, hash] = splitOnFirst(url, '#');
|
|
11501
|
-
|
|
11502
|
-
return Object.assign(
|
|
11503
|
-
{
|
|
11504
|
-
url: url_.split('?')[0] || '',
|
|
11505
|
-
query: parse(extract(url), options)
|
|
11506
|
-
},
|
|
11507
|
-
options && options.parseFragmentIdentifier && hash ? {fragmentIdentifier: decode(hash, options)} : {}
|
|
11508
|
-
);
|
|
11509
|
-
};
|
|
11510
|
-
|
|
11511
|
-
exports.stringifyUrl = (object, options) => {
|
|
11512
|
-
options = Object.assign({
|
|
11513
|
-
encode: true,
|
|
11514
|
-
strict: true
|
|
11515
|
-
}, options);
|
|
11516
|
-
|
|
11517
|
-
const url = removeHash(object.url).split('?')[0] || '';
|
|
11518
|
-
const queryFromUrl = exports.extract(object.url);
|
|
11519
|
-
const parsedQueryFromUrl = exports.parse(queryFromUrl, {sort: false});
|
|
11520
|
-
|
|
11521
|
-
const query = Object.assign(parsedQueryFromUrl, object.query);
|
|
11522
|
-
let queryString = exports.stringify(query, options);
|
|
11523
|
-
if (queryString) {
|
|
11524
|
-
queryString = `?${queryString}`;
|
|
11525
|
-
}
|
|
11526
|
-
|
|
11527
|
-
let hash = getHash(object.url);
|
|
11528
|
-
if (object.fragmentIdentifier) {
|
|
11529
|
-
hash = `#${encode(object.fragmentIdentifier, options)}`;
|
|
11530
|
-
}
|
|
11531
|
-
|
|
11532
|
-
return `${url}${queryString}${hash}`;
|
|
11533
|
-
};
|
|
11534
|
-
});
|
|
11535
|
-
|
|
11536
11037
|
var IkasBrandPropValueProvider = /** @class */ (function () {
|
|
11537
11038
|
function IkasBrandPropValueProvider(prop, pageSpecificData) {
|
|
11538
11039
|
this.brandPropValue = prop;
|
|
@@ -11886,24 +11387,16 @@ var IkasPageDataProvider = /** @class */ (function () {
|
|
|
11886
11387
|
};
|
|
11887
11388
|
IkasPageDataProvider.prototype.getPageSpecificData = function () {
|
|
11888
11389
|
return __awaiter(this, void 0, void 0, function () {
|
|
11889
|
-
var slug, metaDataList, metaData,
|
|
11390
|
+
var slug, metaDataList, metaData, handleBrandPage, handleCategoryPage, _a;
|
|
11890
11391
|
var _this = this;
|
|
11891
11392
|
return __generator(this, function (_b) {
|
|
11892
11393
|
switch (_b.label) {
|
|
11893
11394
|
case 0:
|
|
11894
11395
|
if (this.pageType &&
|
|
11895
|
-
[
|
|
11896
|
-
IkasThemePageType.
|
|
11897
|
-
IkasThemePageType.
|
|
11898
|
-
IkasThemePageType.
|
|
11899
|
-
IkasThemePageType.ORDERS,
|
|
11900
|
-
IkasThemePageType.ORDER_DETAIL,
|
|
11901
|
-
IkasThemePageType.LOGIN,
|
|
11902
|
-
IkasThemePageType.REGISTER,
|
|
11903
|
-
IkasThemePageType.FORGOT_PASSWORD,
|
|
11904
|
-
IkasThemePageType.RECOVER_PASSWORD,
|
|
11905
|
-
IkasThemePageType.CUSTOM,
|
|
11906
|
-
IkasThemePageType.CART,
|
|
11396
|
+
![
|
|
11397
|
+
IkasThemePageType.BRAND,
|
|
11398
|
+
IkasThemePageType.PRODUCT,
|
|
11399
|
+
IkasThemePageType.CATEGORY,
|
|
11907
11400
|
].includes(this.pageType))
|
|
11908
11401
|
return [2 /*return*/];
|
|
11909
11402
|
slug = this.pageParams.slug;
|
|
@@ -11911,15 +11404,9 @@ var IkasPageDataProvider = /** @class */ (function () {
|
|
|
11911
11404
|
case 1:
|
|
11912
11405
|
metaDataList = _b.sent();
|
|
11913
11406
|
if (!metaDataList || !metaDataList.length) {
|
|
11914
|
-
return [2 /*return
|
|
11407
|
+
return [2 /*return*/, this.getPageSpecificProduct()];
|
|
11915
11408
|
}
|
|
11916
11409
|
metaData = metaDataList[0];
|
|
11917
|
-
setPageMetaData = function () {
|
|
11918
|
-
if (_this.page) {
|
|
11919
|
-
_this.page.pageTitle = metaData.pageTitle;
|
|
11920
|
-
_this.page.description = metaData.description;
|
|
11921
|
-
}
|
|
11922
|
-
};
|
|
11923
11410
|
handleBrandPage = function () { return __awaiter(_this, void 0, void 0, function () {
|
|
11924
11411
|
var brandsResponse, brand;
|
|
11925
11412
|
return __generator(this, function (_a) {
|
|
@@ -11934,7 +11421,7 @@ var IkasPageDataProvider = /** @class */ (function () {
|
|
|
11934
11421
|
brand = brandsResponse.brands[0];
|
|
11935
11422
|
this.pageSpecificData = brand;
|
|
11936
11423
|
this.pageType = IkasThemePageType.BRAND;
|
|
11937
|
-
setPageMetaData();
|
|
11424
|
+
this.setPageMetaData(metaData);
|
|
11938
11425
|
return [2 /*return*/];
|
|
11939
11426
|
}
|
|
11940
11427
|
});
|
|
@@ -11953,26 +11440,7 @@ var IkasPageDataProvider = /** @class */ (function () {
|
|
|
11953
11440
|
category = categoriesResponse.categories[0];
|
|
11954
11441
|
this.pageSpecificData = category;
|
|
11955
11442
|
this.pageType = IkasThemePageType.CATEGORY;
|
|
11956
|
-
setPageMetaData();
|
|
11957
|
-
return [2 /*return*/];
|
|
11958
|
-
}
|
|
11959
|
-
});
|
|
11960
|
-
}); };
|
|
11961
|
-
handleProductPage = function () { return __awaiter(_this, void 0, void 0, function () {
|
|
11962
|
-
var productsResponse, product;
|
|
11963
|
-
return __generator(this, function (_a) {
|
|
11964
|
-
switch (_a.label) {
|
|
11965
|
-
case 0: return [4 /*yield*/, IkasProductAPI.listProducts({
|
|
11966
|
-
idList: [metaData.targetId],
|
|
11967
|
-
})];
|
|
11968
|
-
case 1:
|
|
11969
|
-
productsResponse = _a.sent();
|
|
11970
|
-
if (!productsResponse.products.length)
|
|
11971
|
-
return [2 /*return*/];
|
|
11972
|
-
product = productsResponse.products[0];
|
|
11973
|
-
this.pageSpecificData = new IkasProductDetail(product, product.variants[0].variantValues, true);
|
|
11974
|
-
this.pageType = IkasThemePageType.PRODUCT;
|
|
11975
|
-
setPageMetaData();
|
|
11443
|
+
this.setPageMetaData(metaData);
|
|
11976
11444
|
return [2 /*return*/];
|
|
11977
11445
|
}
|
|
11978
11446
|
});
|
|
@@ -11988,7 +11456,7 @@ var IkasPageDataProvider = /** @class */ (function () {
|
|
|
11988
11456
|
case 3: return [2 /*return*/, _b.sent()];
|
|
11989
11457
|
case 4: return [4 /*yield*/, handleCategoryPage()];
|
|
11990
11458
|
case 5: return [2 /*return*/, _b.sent()];
|
|
11991
|
-
case 6: return [4 /*yield*/,
|
|
11459
|
+
case 6: return [4 /*yield*/, this.getPageSpecificProduct()];
|
|
11992
11460
|
case 7: return [2 /*return*/, _b.sent()];
|
|
11993
11461
|
case 8: return [3 /*break*/, 9];
|
|
11994
11462
|
case 9: return [2 /*return*/];
|
|
@@ -11996,6 +11464,82 @@ var IkasPageDataProvider = /** @class */ (function () {
|
|
|
11996
11464
|
});
|
|
11997
11465
|
});
|
|
11998
11466
|
};
|
|
11467
|
+
IkasPageDataProvider.prototype.getPageSpecificProduct = function () {
|
|
11468
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
11469
|
+
var slug, getProductMetaData, metaDataResponse, productsResponse, product, isMainProductSlug, selectedVariantValues, variantSlugPart, variantSlugs, _i, _a, variant, isSelectedVariant, _loop_1, _b, variantSlugs_1, variantSlug, state_1;
|
|
11470
|
+
var _this = this;
|
|
11471
|
+
return __generator(this, function (_c) {
|
|
11472
|
+
switch (_c.label) {
|
|
11473
|
+
case 0:
|
|
11474
|
+
slug = this.pageParams.slug;
|
|
11475
|
+
getProductMetaData = function (slug) { return __awaiter(_this, void 0, void 0, function () {
|
|
11476
|
+
var metaDataList, splitParts, newSlug;
|
|
11477
|
+
return __generator(this, function (_a) {
|
|
11478
|
+
switch (_a.label) {
|
|
11479
|
+
case 0: return [4 /*yield*/, IkasHTMLMetaDataAPI.listHTMLMetaData(slug)];
|
|
11480
|
+
case 1:
|
|
11481
|
+
metaDataList = _a.sent();
|
|
11482
|
+
if (!(!metaDataList || !metaDataList.length)) return [3 /*break*/, 3];
|
|
11483
|
+
splitParts = slug.split("-");
|
|
11484
|
+
newSlug = splitParts.slice(0, splitParts.length - 1).join("-");
|
|
11485
|
+
return [4 /*yield*/, getProductMetaData(newSlug)];
|
|
11486
|
+
case 2: return [2 /*return*/, _a.sent()];
|
|
11487
|
+
case 3: return [2 /*return*/, {
|
|
11488
|
+
metaData: metaDataList[0],
|
|
11489
|
+
slug: slug,
|
|
11490
|
+
}];
|
|
11491
|
+
}
|
|
11492
|
+
});
|
|
11493
|
+
}); };
|
|
11494
|
+
return [4 /*yield*/, getProductMetaData(slug)];
|
|
11495
|
+
case 1:
|
|
11496
|
+
metaDataResponse = _c.sent();
|
|
11497
|
+
if (!metaDataResponse)
|
|
11498
|
+
return [2 /*return*/];
|
|
11499
|
+
return [4 /*yield*/, IkasProductAPI.listProducts({
|
|
11500
|
+
idList: [metaDataResponse.metaData.targetId],
|
|
11501
|
+
})];
|
|
11502
|
+
case 2:
|
|
11503
|
+
productsResponse = _c.sent();
|
|
11504
|
+
if (!productsResponse.products.length)
|
|
11505
|
+
return [2 /*return*/];
|
|
11506
|
+
product = productsResponse.products[0];
|
|
11507
|
+
isMainProductSlug = slug.length === metaDataResponse.slug.length;
|
|
11508
|
+
selectedVariantValues = [];
|
|
11509
|
+
if (!isMainProductSlug) {
|
|
11510
|
+
variantSlugPart = slug.slice(metaDataResponse.slug.length + 1);
|
|
11511
|
+
variantSlugs = variantSlugPart.split("-");
|
|
11512
|
+
for (_i = 0, _a = product.variants; _i < _a.length; _i++) {
|
|
11513
|
+
variant = _a[_i];
|
|
11514
|
+
isSelectedVariant = true;
|
|
11515
|
+
_loop_1 = function (variantSlug) {
|
|
11516
|
+
if (!variant.variantValues.some(function (vv) { return vv.slug === variantSlug; })) {
|
|
11517
|
+
isSelectedVariant = false;
|
|
11518
|
+
return "break";
|
|
11519
|
+
}
|
|
11520
|
+
};
|
|
11521
|
+
for (_b = 0, variantSlugs_1 = variantSlugs; _b < variantSlugs_1.length; _b++) {
|
|
11522
|
+
variantSlug = variantSlugs_1[_b];
|
|
11523
|
+
state_1 = _loop_1(variantSlug);
|
|
11524
|
+
if (state_1 === "break")
|
|
11525
|
+
break;
|
|
11526
|
+
}
|
|
11527
|
+
if (isSelectedVariant) {
|
|
11528
|
+
selectedVariantValues = variant.variantValues;
|
|
11529
|
+
break;
|
|
11530
|
+
}
|
|
11531
|
+
}
|
|
11532
|
+
}
|
|
11533
|
+
this.pageSpecificData = new IkasProductDetail(product, selectedVariantValues.length
|
|
11534
|
+
? selectedVariantValues
|
|
11535
|
+
: product.variants[0].variantValues, true);
|
|
11536
|
+
this.pageType = IkasThemePageType.PRODUCT;
|
|
11537
|
+
this.setPageMetaData(metaDataResponse.metaData);
|
|
11538
|
+
return [2 /*return*/];
|
|
11539
|
+
}
|
|
11540
|
+
});
|
|
11541
|
+
});
|
|
11542
|
+
};
|
|
11999
11543
|
IkasPageDataProvider.prototype.getPageComponentPropValues = function (pageComponent) {
|
|
12000
11544
|
return __awaiter(this, void 0, void 0, function () {
|
|
12001
11545
|
var component, result, setPageComponentPropValue;
|
|
@@ -12081,14 +11625,16 @@ var IkasPageDataProvider = /** @class */ (function () {
|
|
|
12081
11625
|
});
|
|
12082
11626
|
});
|
|
12083
11627
|
};
|
|
11628
|
+
IkasPageDataProvider.prototype.setPageMetaData = function (metaData) {
|
|
11629
|
+
if (this.page) {
|
|
11630
|
+
this.page.pageTitle = metaData.pageTitle;
|
|
11631
|
+
this.page.description = metaData.description;
|
|
11632
|
+
}
|
|
11633
|
+
};
|
|
12084
11634
|
IkasPageDataProvider.isServer = function () {
|
|
12085
11635
|
return typeof window === "undefined";
|
|
12086
11636
|
};
|
|
12087
|
-
IkasPageDataProvider.initPropValues = function (propValuesStr, router
|
|
12088
|
-
var _queryParams = queryParams ||
|
|
12089
|
-
(IkasPageDataProvider.isServer()
|
|
12090
|
-
? {}
|
|
12091
|
-
: queryString.parse(location.search.replace("?", "")));
|
|
11637
|
+
IkasPageDataProvider.initPropValues = function (propValuesStr, router) {
|
|
12092
11638
|
var pageComponentPropValues = JSON.parse(propValuesStr).map(function (v) { return ({
|
|
12093
11639
|
pageComponent: new IkasThemePageComponent(v.pageComponent),
|
|
12094
11640
|
component: new IkasThemeComponent(v.component),
|
|
@@ -12123,7 +11669,7 @@ var IkasPageDataProvider = /** @class */ (function () {
|
|
|
12123
11669
|
IkasPageDataProvider.initProductListPropValue(prop, propValue, pageComponentPropValue);
|
|
12124
11670
|
break;
|
|
12125
11671
|
case IkasThemeComponentPropType.PRODUCT_DETAIL:
|
|
12126
|
-
IkasPageDataProvider.initProductDetailPropValue(prop, propValue, pageComponentPropValue,
|
|
11672
|
+
IkasPageDataProvider.initProductDetailPropValue(prop, propValue, pageComponentPropValue, router);
|
|
12127
11673
|
break;
|
|
12128
11674
|
case IkasThemeComponentPropType.LINK:
|
|
12129
11675
|
case IkasThemeComponentPropType.LIST_OF_LINK:
|
|
@@ -12154,47 +11700,11 @@ var IkasPageDataProvider = /** @class */ (function () {
|
|
|
12154
11700
|
var productList = new IkasProductList(propValue);
|
|
12155
11701
|
pageComponentPropValue.propValues[prop.name] = productList;
|
|
12156
11702
|
};
|
|
12157
|
-
IkasPageDataProvider.initProductDetailPropValue = function (prop, propValue, pageComponentPropValue,
|
|
11703
|
+
IkasPageDataProvider.initProductDetailPropValue = function (prop, propValue, pageComponentPropValue, router) {
|
|
12158
11704
|
var usePageData = propValue.usePageData;
|
|
12159
11705
|
var _propValue = propValue;
|
|
12160
11706
|
var productDetail = new IkasProductDetail(_propValue.product, _propValue.selectedVariantValues);
|
|
12161
|
-
|
|
12162
|
-
var selectedVariantValues = [];
|
|
12163
|
-
if (usePageData && product.variantTypes.length) {
|
|
12164
|
-
var vid_1 = queryParams.vid;
|
|
12165
|
-
var hasVid = false;
|
|
12166
|
-
if (vid_1 && typeof vid_1 === "string") {
|
|
12167
|
-
var variant = product.variants.find(function (v) { return v.id === vid_1; });
|
|
12168
|
-
if (variant) {
|
|
12169
|
-
selectedVariantValues = variant.variantValues;
|
|
12170
|
-
hasVid = true;
|
|
12171
|
-
}
|
|
12172
|
-
}
|
|
12173
|
-
if (!hasVid) {
|
|
12174
|
-
product.variantTypes.forEach(function (pvt) {
|
|
12175
|
-
var slug = pvt.variantType.slug;
|
|
12176
|
-
var variantValueParam = queryParams[slug];
|
|
12177
|
-
if (variantValueParam) {
|
|
12178
|
-
var variantValueSlug_1 = variantValueParam;
|
|
12179
|
-
if (Array.isArray(variantValueParam)) {
|
|
12180
|
-
variantValueSlug_1 = variantValueParam[0];
|
|
12181
|
-
}
|
|
12182
|
-
var variantValue = pvt.variantType.values.find(function (vv) { return vv.slug === variantValueSlug_1; });
|
|
12183
|
-
if (variantValue)
|
|
12184
|
-
selectedVariantValues.push(variantValue);
|
|
12185
|
-
else
|
|
12186
|
-
selectedVariantValues.push(pvt.variantType.values[0]);
|
|
12187
|
-
}
|
|
12188
|
-
else {
|
|
12189
|
-
selectedVariantValues.push(pvt.variantType.values[0]);
|
|
12190
|
-
}
|
|
12191
|
-
});
|
|
12192
|
-
}
|
|
12193
|
-
}
|
|
12194
|
-
else {
|
|
12195
|
-
selectedVariantValues = productDetail.selectedVariantValues || [];
|
|
12196
|
-
}
|
|
12197
|
-
pageComponentPropValue.propValues[prop.name] = new IkasProductDetail(productDetail.product, selectedVariantValues, usePageData, router);
|
|
11707
|
+
pageComponentPropValue.propValues[prop.name] = new IkasProductDetail(productDetail.product, productDetail.selectedVariantValues, usePageData, router);
|
|
12198
11708
|
};
|
|
12199
11709
|
IkasPageDataProvider.initLinkPropValue = function (prop, propValue, pageComponentPropValue) {
|
|
12200
11710
|
if (Array.isArray(propValue)) {
|
|
@@ -12508,7 +12018,7 @@ var IkasOrderLineVariant = /** @class */ (function () {
|
|
|
12508
12018
|
queryParams_1[orderLineVariant.variantTypeSlug] =
|
|
12509
12019
|
orderLineVariant.variantNameSlug;
|
|
12510
12020
|
});
|
|
12511
|
-
return "/" + this.slug + "?" + queryString
|
|
12021
|
+
return "/" + this.slug + "?" + queryString.stringify(queryParams_1);
|
|
12512
12022
|
}
|
|
12513
12023
|
return "/" + this.slug;
|
|
12514
12024
|
},
|
|
@@ -13006,6 +12516,24 @@ var IkasProductPrice = /** @class */ (function () {
|
|
|
13006
12516
|
enumerable: false,
|
|
13007
12517
|
configurable: true
|
|
13008
12518
|
});
|
|
12519
|
+
Object.defineProperty(IkasProductPrice.prototype, "discountAmount", {
|
|
12520
|
+
get: function () {
|
|
12521
|
+
if (this.hasDiscount)
|
|
12522
|
+
return this.sellPrice - this.discountPrice;
|
|
12523
|
+
return 0;
|
|
12524
|
+
},
|
|
12525
|
+
enumerable: false,
|
|
12526
|
+
configurable: true
|
|
12527
|
+
});
|
|
12528
|
+
Object.defineProperty(IkasProductPrice.prototype, "discountPercentage", {
|
|
12529
|
+
get: function () {
|
|
12530
|
+
if (this.hasDiscount)
|
|
12531
|
+
return (100 - (this.finalPrice * 100) / this.sellPrice).toFixed(0);
|
|
12532
|
+
return 0;
|
|
12533
|
+
},
|
|
12534
|
+
enumerable: false,
|
|
12535
|
+
configurable: true
|
|
12536
|
+
});
|
|
13009
12537
|
return IkasProductPrice;
|
|
13010
12538
|
}());
|
|
13011
12539
|
|
|
@@ -14097,17 +13625,13 @@ var IkasProductDetail = /** @class */ (function () {
|
|
|
14097
13625
|
});
|
|
14098
13626
|
Object.defineProperty(IkasProductDetail.prototype, "href", {
|
|
14099
13627
|
get: function () {
|
|
14100
|
-
var _this = this;
|
|
14101
13628
|
var metaData = this.product.metaData;
|
|
14102
13629
|
if (!(metaData === null || metaData === void 0 ? void 0 : metaData.slug))
|
|
14103
13630
|
return "";
|
|
14104
13631
|
if (this.product.hasVariant) {
|
|
14105
|
-
|
|
14106
|
-
|
|
14107
|
-
|
|
14108
|
-
queryParams_1[vt.variantType.slug] = vv.slug;
|
|
14109
|
-
});
|
|
14110
|
-
return "/" + metaData.slug + "?" + queryString$1.stringify(queryParams_1);
|
|
13632
|
+
return "/" + metaData.slug + "-" + this.selectedVariantValues
|
|
13633
|
+
.map(function (vv) { return vv.slug; })
|
|
13634
|
+
.join("-");
|
|
14111
13635
|
}
|
|
14112
13636
|
return "/" + metaData.slug;
|
|
14113
13637
|
},
|
|
@@ -14115,20 +13639,18 @@ var IkasProductDetail = /** @class */ (function () {
|
|
|
14115
13639
|
configurable: true
|
|
14116
13640
|
});
|
|
14117
13641
|
IkasProductDetail.prototype.selectVariantValue = function (variantValue) {
|
|
14118
|
-
var _this = this;
|
|
14119
13642
|
var _a;
|
|
13643
|
+
var metaData = this.product.metaData;
|
|
14120
13644
|
var selectedVariantValues = this.selectedVariantValues.map(function (vv) {
|
|
14121
13645
|
if (vv.variantTypeId === variantValue.variantTypeId)
|
|
14122
13646
|
return variantValue;
|
|
14123
13647
|
return vv;
|
|
14124
13648
|
});
|
|
14125
|
-
var queryParams = {};
|
|
14126
|
-
selectedVariantValues.forEach(function (vv) {
|
|
14127
|
-
var vt = _this.product.variantTypes.find(function (vt) { return vt.variantType.id === vv.variantTypeId; });
|
|
14128
|
-
queryParams[vt.variantType.slug] = vv.slug;
|
|
14129
|
-
});
|
|
14130
13649
|
this.selectedVariantValues = selectedVariantValues;
|
|
14131
|
-
|
|
13650
|
+
var newUrl = "/" + metaData.slug + "-" + this.selectedVariantValues
|
|
13651
|
+
.map(function (vv) { return vv.slug; })
|
|
13652
|
+
.join("-");
|
|
13653
|
+
(_a = this.router) === null || _a === void 0 ? void 0 : _a.replace(newUrl);
|
|
14132
13654
|
};
|
|
14133
13655
|
return IkasProductDetail;
|
|
14134
13656
|
}());
|
|
@@ -23474,7 +22996,7 @@ var PageViewModel = /** @class */ (function () {
|
|
|
23474
22996
|
return [4 /*yield*/, pageDataProvider.getPageData()];
|
|
23475
22997
|
case 1:
|
|
23476
22998
|
_b.sent();
|
|
23477
|
-
pageDataProvider.pageComponentPropValues = IkasPageDataProvider.initPropValues(JSON.stringify(pageDataProvider.pageComponentPropValues), this.router
|
|
22999
|
+
pageDataProvider.pageComponentPropValues = IkasPageDataProvider.initPropValues(JSON.stringify(pageDataProvider.pageComponentPropValues), this.router);
|
|
23478
23000
|
runInAction(function () {
|
|
23479
23001
|
_this.pageDataProvider = pageDataProvider;
|
|
23480
23002
|
_this.isLoading = false;
|
|
@@ -23819,18 +23341,76 @@ var home = /*#__PURE__*/Object.freeze({
|
|
|
23819
23341
|
});
|
|
23820
23342
|
|
|
23821
23343
|
var Page$1 = function (_a) {
|
|
23822
|
-
var page = _a.page, pageSpecificDataStr = _a.pageSpecificDataStr, propValuesStr = _a.propValuesStr
|
|
23344
|
+
var page = _a.page, pageSpecificDataStr = _a.pageSpecificDataStr, propValuesStr = _a.propValuesStr;
|
|
23823
23345
|
var router = useRouter();
|
|
23824
23346
|
var propValues = computed(function () {
|
|
23825
|
-
return IkasPageDataProvider.initPropValues(propValuesStr, router
|
|
23826
|
-
? queryString.parse(window.location.search.replace("?", ""))
|
|
23827
|
-
: queryParams);
|
|
23347
|
+
return IkasPageDataProvider.initPropValues(propValuesStr, router);
|
|
23828
23348
|
});
|
|
23829
23349
|
handleGTM(page, pageSpecificDataStr);
|
|
23830
23350
|
return createElement(IkasPage, { page: page, propValues: propValues.get() });
|
|
23831
23351
|
};
|
|
23832
23352
|
var index$1 = observer(Page$1);
|
|
23833
|
-
var
|
|
23353
|
+
var getStaticPaths = function (context) { return __awaiter(void 0, void 0, void 0, function () {
|
|
23354
|
+
var metaData, targetTypes, brandCategoryMetaData, productMetaData, productsResponse, productParams, _loop_1, _i, _a, product;
|
|
23355
|
+
return __generator(this, function (_b) {
|
|
23356
|
+
switch (_b.label) {
|
|
23357
|
+
case 0: return [4 /*yield*/, IkasHTMLMetaDataAPI.listHTMLMetaData()];
|
|
23358
|
+
case 1:
|
|
23359
|
+
metaData = _b.sent();
|
|
23360
|
+
targetTypes = [
|
|
23361
|
+
IkasHTMLMetaDataTargetType.BRAND,
|
|
23362
|
+
IkasHTMLMetaDataTargetType.CATEGORY,
|
|
23363
|
+
];
|
|
23364
|
+
brandCategoryMetaData = metaData.filter(function (m) { return m.targetType && targetTypes.includes(m.targetType); });
|
|
23365
|
+
productMetaData = metaData.filter(function (m) { return m.targetType && m.targetType === IkasHTMLMetaDataTargetType.PRODUCT; });
|
|
23366
|
+
return [4 /*yield*/, IkasProductAPI.listProducts({
|
|
23367
|
+
idList: productMetaData.map(function (p) { return p.targetId; }),
|
|
23368
|
+
})];
|
|
23369
|
+
case 2:
|
|
23370
|
+
productsResponse = _b.sent();
|
|
23371
|
+
productParams = [];
|
|
23372
|
+
_loop_1 = function (product) {
|
|
23373
|
+
var meta = productMetaData.find(function (pm) { return pm.targetId === product.id; });
|
|
23374
|
+
if (meta) {
|
|
23375
|
+
for (var _i = 0, _a = product.variants; _i < _a.length; _i++) {
|
|
23376
|
+
var variant = _a[_i];
|
|
23377
|
+
if (product.hasVariant) {
|
|
23378
|
+
var variantSlug = variant.variantValues
|
|
23379
|
+
.map(function (vv) { return vv.slug; })
|
|
23380
|
+
.join("-");
|
|
23381
|
+
productParams.push({
|
|
23382
|
+
slug: meta.slug + "-" + variantSlug,
|
|
23383
|
+
});
|
|
23384
|
+
}
|
|
23385
|
+
else {
|
|
23386
|
+
productParams.push({
|
|
23387
|
+
slug: meta.slug,
|
|
23388
|
+
});
|
|
23389
|
+
}
|
|
23390
|
+
}
|
|
23391
|
+
}
|
|
23392
|
+
};
|
|
23393
|
+
for (_i = 0, _a = productsResponse.products; _i < _a.length; _i++) {
|
|
23394
|
+
product = _a[_i];
|
|
23395
|
+
_loop_1(product);
|
|
23396
|
+
}
|
|
23397
|
+
return [2 /*return*/, {
|
|
23398
|
+
paths: brandCategoryMetaData
|
|
23399
|
+
.map(function (m) { return ({
|
|
23400
|
+
params: {
|
|
23401
|
+
slug: m.slug,
|
|
23402
|
+
originalSlug: m.slug,
|
|
23403
|
+
},
|
|
23404
|
+
}); })
|
|
23405
|
+
.concat(productParams.map(function (pp) { return ({
|
|
23406
|
+
params: pp,
|
|
23407
|
+
}); })),
|
|
23408
|
+
fallback: "blocking",
|
|
23409
|
+
}];
|
|
23410
|
+
}
|
|
23411
|
+
});
|
|
23412
|
+
}); };
|
|
23413
|
+
var getStaticProps$1 = function (context) { return __awaiter(void 0, void 0, void 0, function () {
|
|
23834
23414
|
var theme, provider;
|
|
23835
23415
|
return __generator(this, function (_a) {
|
|
23836
23416
|
switch (_a.label) {
|
|
@@ -23847,7 +23427,8 @@ var getServerSideProps = function (context) { return __awaiter(void 0, void 0, v
|
|
|
23847
23427
|
}];
|
|
23848
23428
|
}
|
|
23849
23429
|
return [2 /*return*/, {
|
|
23850
|
-
props: __assign(__assign({}, provider.nextPageData.props), { pageSpecificDataStr: JSON.stringify(provider.pageSpecificData || {})
|
|
23430
|
+
props: __assign(__assign({}, provider.nextPageData.props), { pageSpecificDataStr: JSON.stringify(provider.pageSpecificData || {}) }),
|
|
23431
|
+
revalidate: 60,
|
|
23851
23432
|
}];
|
|
23852
23433
|
}
|
|
23853
23434
|
});
|
|
@@ -23871,7 +23452,8 @@ function handleGTM(page, pageSpecificDataStr) {
|
|
|
23871
23452
|
var index$2 = /*#__PURE__*/Object.freeze({
|
|
23872
23453
|
__proto__: null,
|
|
23873
23454
|
'default': index$1,
|
|
23874
|
-
|
|
23455
|
+
getStaticPaths: getStaticPaths,
|
|
23456
|
+
getStaticProps: getStaticProps$1
|
|
23875
23457
|
});
|
|
23876
23458
|
|
|
23877
23459
|
var Page$2 = function (_a) {
|
|
@@ -23880,7 +23462,7 @@ var Page$2 = function (_a) {
|
|
|
23880
23462
|
var propValues = IkasPageDataProvider.initPropValues(propValuesStr, router);
|
|
23881
23463
|
return createElement(IkasPage, { page: page, propValues: propValues });
|
|
23882
23464
|
};
|
|
23883
|
-
var getStaticPaths = function (context) { return __awaiter(void 0, void 0, void 0, function () {
|
|
23465
|
+
var getStaticPaths$1 = function (context) { return __awaiter(void 0, void 0, void 0, function () {
|
|
23884
23466
|
var theme, customPages, customPagePaths;
|
|
23885
23467
|
return __generator(this, function (_a) {
|
|
23886
23468
|
switch (_a.label) {
|
|
@@ -23900,7 +23482,7 @@ var getStaticPaths = function (context) { return __awaiter(void 0, void 0, void
|
|
|
23900
23482
|
}
|
|
23901
23483
|
});
|
|
23902
23484
|
}); };
|
|
23903
|
-
var getStaticProps$
|
|
23485
|
+
var getStaticProps$2 = function (context) { return __awaiter(void 0, void 0, void 0, function () {
|
|
23904
23486
|
var theme, provider;
|
|
23905
23487
|
return __generator(this, function (_a) {
|
|
23906
23488
|
switch (_a.label) {
|
|
@@ -23919,8 +23501,8 @@ var getStaticProps$1 = function (context) { return __awaiter(void 0, void 0, voi
|
|
|
23919
23501
|
var _slug_ = /*#__PURE__*/Object.freeze({
|
|
23920
23502
|
__proto__: null,
|
|
23921
23503
|
'default': Page$2,
|
|
23922
|
-
getStaticPaths: getStaticPaths,
|
|
23923
|
-
getStaticProps: getStaticProps$
|
|
23504
|
+
getStaticPaths: getStaticPaths$1,
|
|
23505
|
+
getStaticProps: getStaticProps$2
|
|
23924
23506
|
});
|
|
23925
23507
|
|
|
23926
23508
|
var CheckoutPage = function (_a) {
|
|
@@ -23930,7 +23512,7 @@ var CheckoutPage = function (_a) {
|
|
|
23930
23512
|
return createElement(IkasCheckoutPage, { checkout: checkout, queryParams: queryParams });
|
|
23931
23513
|
};
|
|
23932
23514
|
var _id_ = observer(CheckoutPage);
|
|
23933
|
-
var getServerSideProps
|
|
23515
|
+
var getServerSideProps = function (context) { return __awaiter(void 0, void 0, void 0, function () {
|
|
23934
23516
|
var id, redirect, checkout;
|
|
23935
23517
|
return __generator(this, function (_a) {
|
|
23936
23518
|
switch (_a.label) {
|
|
@@ -23965,7 +23547,7 @@ var getServerSideProps$1 = function (context) { return __awaiter(void 0, void 0,
|
|
|
23965
23547
|
var _id_$1 = /*#__PURE__*/Object.freeze({
|
|
23966
23548
|
__proto__: null,
|
|
23967
23549
|
'default': _id_,
|
|
23968
|
-
getServerSideProps: getServerSideProps
|
|
23550
|
+
getServerSideProps: getServerSideProps
|
|
23969
23551
|
});
|
|
23970
23552
|
|
|
23971
23553
|
var Page$3 = function (_a) {
|
|
@@ -23974,7 +23556,7 @@ var Page$3 = function (_a) {
|
|
|
23974
23556
|
var propValues = IkasPageDataProvider.initPropValues(propValuesStr, router);
|
|
23975
23557
|
return createElement(IkasPage, { page: page, propValues: propValues });
|
|
23976
23558
|
};
|
|
23977
|
-
var getStaticProps$
|
|
23559
|
+
var getStaticProps$3 = function (context) { return __awaiter(void 0, void 0, void 0, function () {
|
|
23978
23560
|
var theme, provider;
|
|
23979
23561
|
return __generator(this, function (_a) {
|
|
23980
23562
|
switch (_a.label) {
|
|
@@ -23993,7 +23575,7 @@ var getStaticProps$2 = function (context) { return __awaiter(void 0, void 0, voi
|
|
|
23993
23575
|
var index$3 = /*#__PURE__*/Object.freeze({
|
|
23994
23576
|
__proto__: null,
|
|
23995
23577
|
'default': Page$3,
|
|
23996
|
-
getStaticProps: getStaticProps$
|
|
23578
|
+
getStaticProps: getStaticProps$3
|
|
23997
23579
|
});
|
|
23998
23580
|
|
|
23999
23581
|
var Page$4 = function (_a) {
|
|
@@ -24002,7 +23584,7 @@ var Page$4 = function (_a) {
|
|
|
24002
23584
|
var propValues = IkasPageDataProvider.initPropValues(propValuesStr, router);
|
|
24003
23585
|
return createElement(IkasPage, { page: page, propValues: propValues });
|
|
24004
23586
|
};
|
|
24005
|
-
var getStaticProps$
|
|
23587
|
+
var getStaticProps$4 = function (context) { return __awaiter(void 0, void 0, void 0, function () {
|
|
24006
23588
|
var theme, provider;
|
|
24007
23589
|
return __generator(this, function (_a) {
|
|
24008
23590
|
switch (_a.label) {
|
|
@@ -24021,7 +23603,7 @@ var getStaticProps$3 = function (context) { return __awaiter(void 0, void 0, voi
|
|
|
24021
23603
|
var addresses = /*#__PURE__*/Object.freeze({
|
|
24022
23604
|
__proto__: null,
|
|
24023
23605
|
'default': Page$4,
|
|
24024
|
-
getStaticProps: getStaticProps$
|
|
23606
|
+
getStaticProps: getStaticProps$4
|
|
24025
23607
|
});
|
|
24026
23608
|
|
|
24027
23609
|
var Page$5 = function (_a) {
|
|
@@ -24030,7 +23612,7 @@ var Page$5 = function (_a) {
|
|
|
24030
23612
|
var propValues = IkasPageDataProvider.initPropValues(propValuesStr, router);
|
|
24031
23613
|
return createElement(IkasPage, { page: page, propValues: propValues });
|
|
24032
23614
|
};
|
|
24033
|
-
var getStaticProps$
|
|
23615
|
+
var getStaticProps$5 = function (context) { return __awaiter(void 0, void 0, void 0, function () {
|
|
24034
23616
|
var theme, provider;
|
|
24035
23617
|
return __generator(this, function (_a) {
|
|
24036
23618
|
switch (_a.label) {
|
|
@@ -24049,7 +23631,7 @@ var getStaticProps$4 = function (context) { return __awaiter(void 0, void 0, voi
|
|
|
24049
23631
|
var index$4 = /*#__PURE__*/Object.freeze({
|
|
24050
23632
|
__proto__: null,
|
|
24051
23633
|
'default': Page$5,
|
|
24052
|
-
getStaticProps: getStaticProps$
|
|
23634
|
+
getStaticProps: getStaticProps$5
|
|
24053
23635
|
});
|
|
24054
23636
|
|
|
24055
23637
|
var Page$6 = function (_a) {
|
|
@@ -24058,7 +23640,7 @@ var Page$6 = function (_a) {
|
|
|
24058
23640
|
var propValues = IkasPageDataProvider.initPropValues(propValuesStr, router);
|
|
24059
23641
|
return createElement(IkasPage, { page: page, propValues: propValues });
|
|
24060
23642
|
};
|
|
24061
|
-
var getServerSideProps$
|
|
23643
|
+
var getServerSideProps$1 = function (context) { return __awaiter(void 0, void 0, void 0, function () {
|
|
24062
23644
|
var theme, provider;
|
|
24063
23645
|
return __generator(this, function (_a) {
|
|
24064
23646
|
switch (_a.label) {
|
|
@@ -24077,7 +23659,7 @@ var getServerSideProps$2 = function (context) { return __awaiter(void 0, void 0,
|
|
|
24077
23659
|
var _id_$2 = /*#__PURE__*/Object.freeze({
|
|
24078
23660
|
__proto__: null,
|
|
24079
23661
|
'default': Page$6,
|
|
24080
|
-
getServerSideProps: getServerSideProps$
|
|
23662
|
+
getServerSideProps: getServerSideProps$1
|
|
24081
23663
|
});
|
|
24082
23664
|
|
|
24083
23665
|
var Page$7 = function (_a) {
|
|
@@ -24086,7 +23668,7 @@ var Page$7 = function (_a) {
|
|
|
24086
23668
|
var propValues = IkasPageDataProvider.initPropValues(propValuesStr, router);
|
|
24087
23669
|
return createElement(IkasPage, { page: page, propValues: propValues });
|
|
24088
23670
|
};
|
|
24089
|
-
var getStaticProps$
|
|
23671
|
+
var getStaticProps$6 = function (context) { return __awaiter(void 0, void 0, void 0, function () {
|
|
24090
23672
|
var theme, provider;
|
|
24091
23673
|
return __generator(this, function (_a) {
|
|
24092
23674
|
switch (_a.label) {
|
|
@@ -24105,7 +23687,7 @@ var getStaticProps$5 = function (context) { return __awaiter(void 0, void 0, voi
|
|
|
24105
23687
|
var login = /*#__PURE__*/Object.freeze({
|
|
24106
23688
|
__proto__: null,
|
|
24107
23689
|
'default': Page$7,
|
|
24108
|
-
getStaticProps: getStaticProps$
|
|
23690
|
+
getStaticProps: getStaticProps$6
|
|
24109
23691
|
});
|
|
24110
23692
|
|
|
24111
23693
|
var Page$8 = function (_a) {
|
|
@@ -24114,7 +23696,7 @@ var Page$8 = function (_a) {
|
|
|
24114
23696
|
var propValues = IkasPageDataProvider.initPropValues(propValuesStr, router);
|
|
24115
23697
|
return createElement(IkasPage, { page: page, propValues: propValues });
|
|
24116
23698
|
};
|
|
24117
|
-
var getStaticProps$
|
|
23699
|
+
var getStaticProps$7 = function (context) { return __awaiter(void 0, void 0, void 0, function () {
|
|
24118
23700
|
var theme, provider;
|
|
24119
23701
|
return __generator(this, function (_a) {
|
|
24120
23702
|
switch (_a.label) {
|
|
@@ -24133,7 +23715,7 @@ var getStaticProps$6 = function (context) { return __awaiter(void 0, void 0, voi
|
|
|
24133
23715
|
var register = /*#__PURE__*/Object.freeze({
|
|
24134
23716
|
__proto__: null,
|
|
24135
23717
|
'default': Page$8,
|
|
24136
|
-
getStaticProps: getStaticProps$
|
|
23718
|
+
getStaticProps: getStaticProps$7
|
|
24137
23719
|
});
|
|
24138
23720
|
|
|
24139
23721
|
var Page$9 = function (_a) {
|
|
@@ -24142,7 +23724,7 @@ var Page$9 = function (_a) {
|
|
|
24142
23724
|
var propValues = IkasPageDataProvider.initPropValues(propValuesStr, router);
|
|
24143
23725
|
return createElement(IkasPage, { page: page, propValues: propValues });
|
|
24144
23726
|
};
|
|
24145
|
-
var getStaticProps$
|
|
23727
|
+
var getStaticProps$8 = function (context) { return __awaiter(void 0, void 0, void 0, function () {
|
|
24146
23728
|
var theme, provider;
|
|
24147
23729
|
return __generator(this, function (_a) {
|
|
24148
23730
|
switch (_a.label) {
|
|
@@ -24161,7 +23743,7 @@ var getStaticProps$7 = function (context) { return __awaiter(void 0, void 0, voi
|
|
|
24161
23743
|
var forgotPassword = /*#__PURE__*/Object.freeze({
|
|
24162
23744
|
__proto__: null,
|
|
24163
23745
|
'default': Page$9,
|
|
24164
|
-
getStaticProps: getStaticProps$
|
|
23746
|
+
getStaticProps: getStaticProps$8
|
|
24165
23747
|
});
|
|
24166
23748
|
|
|
24167
23749
|
var Page$a = function (_a) {
|
|
@@ -24170,7 +23752,7 @@ var Page$a = function (_a) {
|
|
|
24170
23752
|
var propValues = IkasPageDataProvider.initPropValues(propValuesStr, router);
|
|
24171
23753
|
return createElement(IkasPage, { page: page, propValues: propValues });
|
|
24172
23754
|
};
|
|
24173
|
-
var getStaticProps$
|
|
23755
|
+
var getStaticProps$9 = function (context) { return __awaiter(void 0, void 0, void 0, function () {
|
|
24174
23756
|
var theme, provider;
|
|
24175
23757
|
return __generator(this, function (_a) {
|
|
24176
23758
|
switch (_a.label) {
|
|
@@ -24189,7 +23771,7 @@ var getStaticProps$8 = function (context) { return __awaiter(void 0, void 0, voi
|
|
|
24189
23771
|
var recoverPassword = /*#__PURE__*/Object.freeze({
|
|
24190
23772
|
__proto__: null,
|
|
24191
23773
|
'default': Page$a,
|
|
24192
|
-
getStaticProps: getStaticProps$
|
|
23774
|
+
getStaticProps: getStaticProps$9
|
|
24193
23775
|
});
|
|
24194
23776
|
|
|
24195
23777
|
var Page$b = function (_a) {
|
|
@@ -24198,7 +23780,7 @@ var Page$b = function (_a) {
|
|
|
24198
23780
|
var propValues = IkasPageDataProvider.initPropValues(propValuesStr, router);
|
|
24199
23781
|
return createElement(IkasPage, { page: page, propValues: propValues });
|
|
24200
23782
|
};
|
|
24201
|
-
var getStaticProps$
|
|
23783
|
+
var getStaticProps$a = function (context) { return __awaiter(void 0, void 0, void 0, function () {
|
|
24202
23784
|
var theme, provider;
|
|
24203
23785
|
return __generator(this, function (_a) {
|
|
24204
23786
|
switch (_a.label) {
|
|
@@ -24217,7 +23799,7 @@ var getStaticProps$9 = function (context) { return __awaiter(void 0, void 0, voi
|
|
|
24217
23799
|
var cart = /*#__PURE__*/Object.freeze({
|
|
24218
23800
|
__proto__: null,
|
|
24219
23801
|
'default': Page$b,
|
|
24220
|
-
getStaticProps: getStaticProps$
|
|
23802
|
+
getStaticProps: getStaticProps$a
|
|
24221
23803
|
});
|
|
24222
23804
|
|
|
24223
23805
|
var IkasPageEditor$1 = dynamic(function () { return Promise.resolve().then(function () { return index; }).then(function (mod) { return mod.IkasPageEditor; }); }, { ssr: false });
|