@builder.io/plugin-sfcc-commerce-api 0.0.3 → 0.0.6
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/README.md +61 -2
- package/dist/plugin.system.js +827 -373
- package/dist/plugin.system.js.map +1 -1
- package/package.json +2 -2
package/dist/plugin.system.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
System.register(['@builder.io/react', '@emotion/core', '@material-ui/core', 'react', 'mobx', 'mobx-react', '@builder.io/app-context'], function () {
|
|
2
2
|
'use strict';
|
|
3
|
-
var Builder, jsx, CircularProgress, Paper, IconButton, Button, ListItem, ListItemAvatar, Avatar, ListItemText,
|
|
3
|
+
var Builder, jsx, CircularProgress, Paper, IconButton, Button, ListItem, ListItemAvatar, Avatar, ListItemText, Typography, Tooltip, TextField, InputAdornment, React, createElement, Component, useEffect, action, runInAction, useLocalStore, useObserver, appState;
|
|
4
4
|
return {
|
|
5
5
|
setters: [function (module) {
|
|
6
6
|
Builder = module.Builder;
|
|
@@ -15,10 +15,10 @@ System.register(['@builder.io/react', '@emotion/core', '@material-ui/core', 'rea
|
|
|
15
15
|
ListItemAvatar = module.ListItemAvatar;
|
|
16
16
|
Avatar = module.Avatar;
|
|
17
17
|
ListItemText = module.ListItemText;
|
|
18
|
-
TextField = module.TextField;
|
|
19
|
-
InputAdornment = module.InputAdornment;
|
|
20
18
|
Typography = module.Typography;
|
|
21
19
|
Tooltip = module.Tooltip;
|
|
20
|
+
TextField = module.TextField;
|
|
21
|
+
InputAdornment = module.InputAdornment;
|
|
22
22
|
}, function (module) {
|
|
23
23
|
React = module.default;
|
|
24
24
|
createElement = module.createElement;
|
|
@@ -35,7 +35,7 @@ System.register(['@builder.io/react', '@emotion/core', '@material-ui/core', 'rea
|
|
|
35
35
|
}],
|
|
36
36
|
execute: function () {
|
|
37
37
|
|
|
38
|
-
|
|
38
|
+
/******************************************************************************
|
|
39
39
|
Copyright (c) Microsoft Corporation.
|
|
40
40
|
|
|
41
41
|
Permission to use, copy, modify, and/or distribute this software for any
|
|
@@ -30331,6 +30331,582 @@ System.register(['@builder.io/react', '@emotion/core', '@material-ui/core', 'rea
|
|
|
30331
30331
|
});
|
|
30332
30332
|
});
|
|
30333
30333
|
|
|
30334
|
+
/**
|
|
30335
|
+
* Checks if `value` is the
|
|
30336
|
+
* [language type](http://www.ecma-international.org/ecma-262/7.0/#sec-ecmascript-language-types)
|
|
30337
|
+
* of `Object`. (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`)
|
|
30338
|
+
*
|
|
30339
|
+
* @static
|
|
30340
|
+
* @memberOf _
|
|
30341
|
+
* @since 0.1.0
|
|
30342
|
+
* @category Lang
|
|
30343
|
+
* @param {*} value The value to check.
|
|
30344
|
+
* @returns {boolean} Returns `true` if `value` is an object, else `false`.
|
|
30345
|
+
* @example
|
|
30346
|
+
*
|
|
30347
|
+
* _.isObject({});
|
|
30348
|
+
* // => true
|
|
30349
|
+
*
|
|
30350
|
+
* _.isObject([1, 2, 3]);
|
|
30351
|
+
* // => true
|
|
30352
|
+
*
|
|
30353
|
+
* _.isObject(_.noop);
|
|
30354
|
+
* // => true
|
|
30355
|
+
*
|
|
30356
|
+
* _.isObject(null);
|
|
30357
|
+
* // => false
|
|
30358
|
+
*/
|
|
30359
|
+
function isObject(value) {
|
|
30360
|
+
var type = typeof value;
|
|
30361
|
+
return value != null && (type == 'object' || type == 'function');
|
|
30362
|
+
}
|
|
30363
|
+
|
|
30364
|
+
var isObject_1 = isObject;
|
|
30365
|
+
|
|
30366
|
+
/** Detect free variable `global` from Node.js. */
|
|
30367
|
+
var freeGlobal = typeof commonjsGlobal == 'object' && commonjsGlobal && commonjsGlobal.Object === Object && commonjsGlobal;
|
|
30368
|
+
|
|
30369
|
+
var _freeGlobal = freeGlobal;
|
|
30370
|
+
|
|
30371
|
+
/** Detect free variable `self`. */
|
|
30372
|
+
var freeSelf = typeof self == 'object' && self && self.Object === Object && self;
|
|
30373
|
+
|
|
30374
|
+
/** Used as a reference to the global object. */
|
|
30375
|
+
var root = _freeGlobal || freeSelf || Function('return this')();
|
|
30376
|
+
|
|
30377
|
+
var _root = root;
|
|
30378
|
+
|
|
30379
|
+
/**
|
|
30380
|
+
* Gets the timestamp of the number of milliseconds that have elapsed since
|
|
30381
|
+
* the Unix epoch (1 January 1970 00:00:00 UTC).
|
|
30382
|
+
*
|
|
30383
|
+
* @static
|
|
30384
|
+
* @memberOf _
|
|
30385
|
+
* @since 2.4.0
|
|
30386
|
+
* @category Date
|
|
30387
|
+
* @returns {number} Returns the timestamp.
|
|
30388
|
+
* @example
|
|
30389
|
+
*
|
|
30390
|
+
* _.defer(function(stamp) {
|
|
30391
|
+
* console.log(_.now() - stamp);
|
|
30392
|
+
* }, _.now());
|
|
30393
|
+
* // => Logs the number of milliseconds it took for the deferred invocation.
|
|
30394
|
+
*/
|
|
30395
|
+
var now = function() {
|
|
30396
|
+
return _root.Date.now();
|
|
30397
|
+
};
|
|
30398
|
+
|
|
30399
|
+
var now_1 = now;
|
|
30400
|
+
|
|
30401
|
+
/** Used to match a single whitespace character. */
|
|
30402
|
+
var reWhitespace = /\s/;
|
|
30403
|
+
|
|
30404
|
+
/**
|
|
30405
|
+
* Used by `_.trim` and `_.trimEnd` to get the index of the last non-whitespace
|
|
30406
|
+
* character of `string`.
|
|
30407
|
+
*
|
|
30408
|
+
* @private
|
|
30409
|
+
* @param {string} string The string to inspect.
|
|
30410
|
+
* @returns {number} Returns the index of the last non-whitespace character.
|
|
30411
|
+
*/
|
|
30412
|
+
function trimmedEndIndex(string) {
|
|
30413
|
+
var index = string.length;
|
|
30414
|
+
|
|
30415
|
+
while (index-- && reWhitespace.test(string.charAt(index))) {}
|
|
30416
|
+
return index;
|
|
30417
|
+
}
|
|
30418
|
+
|
|
30419
|
+
var _trimmedEndIndex = trimmedEndIndex;
|
|
30420
|
+
|
|
30421
|
+
/** Used to match leading whitespace. */
|
|
30422
|
+
var reTrimStart = /^\s+/;
|
|
30423
|
+
|
|
30424
|
+
/**
|
|
30425
|
+
* The base implementation of `_.trim`.
|
|
30426
|
+
*
|
|
30427
|
+
* @private
|
|
30428
|
+
* @param {string} string The string to trim.
|
|
30429
|
+
* @returns {string} Returns the trimmed string.
|
|
30430
|
+
*/
|
|
30431
|
+
function baseTrim(string) {
|
|
30432
|
+
return string
|
|
30433
|
+
? string.slice(0, _trimmedEndIndex(string) + 1).replace(reTrimStart, '')
|
|
30434
|
+
: string;
|
|
30435
|
+
}
|
|
30436
|
+
|
|
30437
|
+
var _baseTrim = baseTrim;
|
|
30438
|
+
|
|
30439
|
+
/** Built-in value references. */
|
|
30440
|
+
var Symbol$1 = _root.Symbol;
|
|
30441
|
+
|
|
30442
|
+
var _Symbol = Symbol$1;
|
|
30443
|
+
|
|
30444
|
+
/** Used for built-in method references. */
|
|
30445
|
+
var objectProto$b = Object.prototype;
|
|
30446
|
+
|
|
30447
|
+
/** Used to check objects for own properties. */
|
|
30448
|
+
var hasOwnProperty$9 = objectProto$b.hasOwnProperty;
|
|
30449
|
+
|
|
30450
|
+
/**
|
|
30451
|
+
* Used to resolve the
|
|
30452
|
+
* [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)
|
|
30453
|
+
* of values.
|
|
30454
|
+
*/
|
|
30455
|
+
var nativeObjectToString$1 = objectProto$b.toString;
|
|
30456
|
+
|
|
30457
|
+
/** Built-in value references. */
|
|
30458
|
+
var symToStringTag$1 = _Symbol ? _Symbol.toStringTag : undefined;
|
|
30459
|
+
|
|
30460
|
+
/**
|
|
30461
|
+
* A specialized version of `baseGetTag` which ignores `Symbol.toStringTag` values.
|
|
30462
|
+
*
|
|
30463
|
+
* @private
|
|
30464
|
+
* @param {*} value The value to query.
|
|
30465
|
+
* @returns {string} Returns the raw `toStringTag`.
|
|
30466
|
+
*/
|
|
30467
|
+
function getRawTag(value) {
|
|
30468
|
+
var isOwn = hasOwnProperty$9.call(value, symToStringTag$1),
|
|
30469
|
+
tag = value[symToStringTag$1];
|
|
30470
|
+
|
|
30471
|
+
try {
|
|
30472
|
+
value[symToStringTag$1] = undefined;
|
|
30473
|
+
var unmasked = true;
|
|
30474
|
+
} catch (e) {}
|
|
30475
|
+
|
|
30476
|
+
var result = nativeObjectToString$1.call(value);
|
|
30477
|
+
if (unmasked) {
|
|
30478
|
+
if (isOwn) {
|
|
30479
|
+
value[symToStringTag$1] = tag;
|
|
30480
|
+
} else {
|
|
30481
|
+
delete value[symToStringTag$1];
|
|
30482
|
+
}
|
|
30483
|
+
}
|
|
30484
|
+
return result;
|
|
30485
|
+
}
|
|
30486
|
+
|
|
30487
|
+
var _getRawTag = getRawTag;
|
|
30488
|
+
|
|
30489
|
+
/** Used for built-in method references. */
|
|
30490
|
+
var objectProto$a = Object.prototype;
|
|
30491
|
+
|
|
30492
|
+
/**
|
|
30493
|
+
* Used to resolve the
|
|
30494
|
+
* [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)
|
|
30495
|
+
* of values.
|
|
30496
|
+
*/
|
|
30497
|
+
var nativeObjectToString = objectProto$a.toString;
|
|
30498
|
+
|
|
30499
|
+
/**
|
|
30500
|
+
* Converts `value` to a string using `Object.prototype.toString`.
|
|
30501
|
+
*
|
|
30502
|
+
* @private
|
|
30503
|
+
* @param {*} value The value to convert.
|
|
30504
|
+
* @returns {string} Returns the converted string.
|
|
30505
|
+
*/
|
|
30506
|
+
function objectToString(value) {
|
|
30507
|
+
return nativeObjectToString.call(value);
|
|
30508
|
+
}
|
|
30509
|
+
|
|
30510
|
+
var _objectToString = objectToString;
|
|
30511
|
+
|
|
30512
|
+
/** `Object#toString` result references. */
|
|
30513
|
+
var nullTag = '[object Null]',
|
|
30514
|
+
undefinedTag = '[object Undefined]';
|
|
30515
|
+
|
|
30516
|
+
/** Built-in value references. */
|
|
30517
|
+
var symToStringTag = _Symbol ? _Symbol.toStringTag : undefined;
|
|
30518
|
+
|
|
30519
|
+
/**
|
|
30520
|
+
* The base implementation of `getTag` without fallbacks for buggy environments.
|
|
30521
|
+
*
|
|
30522
|
+
* @private
|
|
30523
|
+
* @param {*} value The value to query.
|
|
30524
|
+
* @returns {string} Returns the `toStringTag`.
|
|
30525
|
+
*/
|
|
30526
|
+
function baseGetTag(value) {
|
|
30527
|
+
if (value == null) {
|
|
30528
|
+
return value === undefined ? undefinedTag : nullTag;
|
|
30529
|
+
}
|
|
30530
|
+
return (symToStringTag && symToStringTag in Object(value))
|
|
30531
|
+
? _getRawTag(value)
|
|
30532
|
+
: _objectToString(value);
|
|
30533
|
+
}
|
|
30534
|
+
|
|
30535
|
+
var _baseGetTag = baseGetTag;
|
|
30536
|
+
|
|
30537
|
+
/**
|
|
30538
|
+
* Checks if `value` is object-like. A value is object-like if it's not `null`
|
|
30539
|
+
* and has a `typeof` result of "object".
|
|
30540
|
+
*
|
|
30541
|
+
* @static
|
|
30542
|
+
* @memberOf _
|
|
30543
|
+
* @since 4.0.0
|
|
30544
|
+
* @category Lang
|
|
30545
|
+
* @param {*} value The value to check.
|
|
30546
|
+
* @returns {boolean} Returns `true` if `value` is object-like, else `false`.
|
|
30547
|
+
* @example
|
|
30548
|
+
*
|
|
30549
|
+
* _.isObjectLike({});
|
|
30550
|
+
* // => true
|
|
30551
|
+
*
|
|
30552
|
+
* _.isObjectLike([1, 2, 3]);
|
|
30553
|
+
* // => true
|
|
30554
|
+
*
|
|
30555
|
+
* _.isObjectLike(_.noop);
|
|
30556
|
+
* // => false
|
|
30557
|
+
*
|
|
30558
|
+
* _.isObjectLike(null);
|
|
30559
|
+
* // => false
|
|
30560
|
+
*/
|
|
30561
|
+
function isObjectLike(value) {
|
|
30562
|
+
return value != null && typeof value == 'object';
|
|
30563
|
+
}
|
|
30564
|
+
|
|
30565
|
+
var isObjectLike_1 = isObjectLike;
|
|
30566
|
+
|
|
30567
|
+
/** `Object#toString` result references. */
|
|
30568
|
+
var symbolTag = '[object Symbol]';
|
|
30569
|
+
|
|
30570
|
+
/**
|
|
30571
|
+
* Checks if `value` is classified as a `Symbol` primitive or object.
|
|
30572
|
+
*
|
|
30573
|
+
* @static
|
|
30574
|
+
* @memberOf _
|
|
30575
|
+
* @since 4.0.0
|
|
30576
|
+
* @category Lang
|
|
30577
|
+
* @param {*} value The value to check.
|
|
30578
|
+
* @returns {boolean} Returns `true` if `value` is a symbol, else `false`.
|
|
30579
|
+
* @example
|
|
30580
|
+
*
|
|
30581
|
+
* _.isSymbol(Symbol.iterator);
|
|
30582
|
+
* // => true
|
|
30583
|
+
*
|
|
30584
|
+
* _.isSymbol('abc');
|
|
30585
|
+
* // => false
|
|
30586
|
+
*/
|
|
30587
|
+
function isSymbol(value) {
|
|
30588
|
+
return typeof value == 'symbol' ||
|
|
30589
|
+
(isObjectLike_1(value) && _baseGetTag(value) == symbolTag);
|
|
30590
|
+
}
|
|
30591
|
+
|
|
30592
|
+
var isSymbol_1 = isSymbol;
|
|
30593
|
+
|
|
30594
|
+
/** Used as references for various `Number` constants. */
|
|
30595
|
+
var NAN = 0 / 0;
|
|
30596
|
+
|
|
30597
|
+
/** Used to detect bad signed hexadecimal string values. */
|
|
30598
|
+
var reIsBadHex = /^[-+]0x[0-9a-f]+$/i;
|
|
30599
|
+
|
|
30600
|
+
/** Used to detect binary string values. */
|
|
30601
|
+
var reIsBinary = /^0b[01]+$/i;
|
|
30602
|
+
|
|
30603
|
+
/** Used to detect octal string values. */
|
|
30604
|
+
var reIsOctal = /^0o[0-7]+$/i;
|
|
30605
|
+
|
|
30606
|
+
/** Built-in method references without a dependency on `root`. */
|
|
30607
|
+
var freeParseInt = parseInt;
|
|
30608
|
+
|
|
30609
|
+
/**
|
|
30610
|
+
* Converts `value` to a number.
|
|
30611
|
+
*
|
|
30612
|
+
* @static
|
|
30613
|
+
* @memberOf _
|
|
30614
|
+
* @since 4.0.0
|
|
30615
|
+
* @category Lang
|
|
30616
|
+
* @param {*} value The value to process.
|
|
30617
|
+
* @returns {number} Returns the number.
|
|
30618
|
+
* @example
|
|
30619
|
+
*
|
|
30620
|
+
* _.toNumber(3.2);
|
|
30621
|
+
* // => 3.2
|
|
30622
|
+
*
|
|
30623
|
+
* _.toNumber(Number.MIN_VALUE);
|
|
30624
|
+
* // => 5e-324
|
|
30625
|
+
*
|
|
30626
|
+
* _.toNumber(Infinity);
|
|
30627
|
+
* // => Infinity
|
|
30628
|
+
*
|
|
30629
|
+
* _.toNumber('3.2');
|
|
30630
|
+
* // => 3.2
|
|
30631
|
+
*/
|
|
30632
|
+
function toNumber(value) {
|
|
30633
|
+
if (typeof value == 'number') {
|
|
30634
|
+
return value;
|
|
30635
|
+
}
|
|
30636
|
+
if (isSymbol_1(value)) {
|
|
30637
|
+
return NAN;
|
|
30638
|
+
}
|
|
30639
|
+
if (isObject_1(value)) {
|
|
30640
|
+
var other = typeof value.valueOf == 'function' ? value.valueOf() : value;
|
|
30641
|
+
value = isObject_1(other) ? (other + '') : other;
|
|
30642
|
+
}
|
|
30643
|
+
if (typeof value != 'string') {
|
|
30644
|
+
return value === 0 ? value : +value;
|
|
30645
|
+
}
|
|
30646
|
+
value = _baseTrim(value);
|
|
30647
|
+
var isBinary = reIsBinary.test(value);
|
|
30648
|
+
return (isBinary || reIsOctal.test(value))
|
|
30649
|
+
? freeParseInt(value.slice(2), isBinary ? 2 : 8)
|
|
30650
|
+
: (reIsBadHex.test(value) ? NAN : +value);
|
|
30651
|
+
}
|
|
30652
|
+
|
|
30653
|
+
var toNumber_1 = toNumber;
|
|
30654
|
+
|
|
30655
|
+
/** Error message constants. */
|
|
30656
|
+
var FUNC_ERROR_TEXT$1 = 'Expected a function';
|
|
30657
|
+
|
|
30658
|
+
/* Built-in method references for those with the same name as other `lodash` methods. */
|
|
30659
|
+
var nativeMax$1 = Math.max,
|
|
30660
|
+
nativeMin = Math.min;
|
|
30661
|
+
|
|
30662
|
+
/**
|
|
30663
|
+
* Creates a debounced function that delays invoking `func` until after `wait`
|
|
30664
|
+
* milliseconds have elapsed since the last time the debounced function was
|
|
30665
|
+
* invoked. The debounced function comes with a `cancel` method to cancel
|
|
30666
|
+
* delayed `func` invocations and a `flush` method to immediately invoke them.
|
|
30667
|
+
* Provide `options` to indicate whether `func` should be invoked on the
|
|
30668
|
+
* leading and/or trailing edge of the `wait` timeout. The `func` is invoked
|
|
30669
|
+
* with the last arguments provided to the debounced function. Subsequent
|
|
30670
|
+
* calls to the debounced function return the result of the last `func`
|
|
30671
|
+
* invocation.
|
|
30672
|
+
*
|
|
30673
|
+
* **Note:** If `leading` and `trailing` options are `true`, `func` is
|
|
30674
|
+
* invoked on the trailing edge of the timeout only if the debounced function
|
|
30675
|
+
* is invoked more than once during the `wait` timeout.
|
|
30676
|
+
*
|
|
30677
|
+
* If `wait` is `0` and `leading` is `false`, `func` invocation is deferred
|
|
30678
|
+
* until to the next tick, similar to `setTimeout` with a timeout of `0`.
|
|
30679
|
+
*
|
|
30680
|
+
* See [David Corbacho's article](https://css-tricks.com/debouncing-throttling-explained-examples/)
|
|
30681
|
+
* for details over the differences between `_.debounce` and `_.throttle`.
|
|
30682
|
+
*
|
|
30683
|
+
* @static
|
|
30684
|
+
* @memberOf _
|
|
30685
|
+
* @since 0.1.0
|
|
30686
|
+
* @category Function
|
|
30687
|
+
* @param {Function} func The function to debounce.
|
|
30688
|
+
* @param {number} [wait=0] The number of milliseconds to delay.
|
|
30689
|
+
* @param {Object} [options={}] The options object.
|
|
30690
|
+
* @param {boolean} [options.leading=false]
|
|
30691
|
+
* Specify invoking on the leading edge of the timeout.
|
|
30692
|
+
* @param {number} [options.maxWait]
|
|
30693
|
+
* The maximum time `func` is allowed to be delayed before it's invoked.
|
|
30694
|
+
* @param {boolean} [options.trailing=true]
|
|
30695
|
+
* Specify invoking on the trailing edge of the timeout.
|
|
30696
|
+
* @returns {Function} Returns the new debounced function.
|
|
30697
|
+
* @example
|
|
30698
|
+
*
|
|
30699
|
+
* // Avoid costly calculations while the window size is in flux.
|
|
30700
|
+
* jQuery(window).on('resize', _.debounce(calculateLayout, 150));
|
|
30701
|
+
*
|
|
30702
|
+
* // Invoke `sendMail` when clicked, debouncing subsequent calls.
|
|
30703
|
+
* jQuery(element).on('click', _.debounce(sendMail, 300, {
|
|
30704
|
+
* 'leading': true,
|
|
30705
|
+
* 'trailing': false
|
|
30706
|
+
* }));
|
|
30707
|
+
*
|
|
30708
|
+
* // Ensure `batchLog` is invoked once after 1 second of debounced calls.
|
|
30709
|
+
* var debounced = _.debounce(batchLog, 250, { 'maxWait': 1000 });
|
|
30710
|
+
* var source = new EventSource('/stream');
|
|
30711
|
+
* jQuery(source).on('message', debounced);
|
|
30712
|
+
*
|
|
30713
|
+
* // Cancel the trailing debounced invocation.
|
|
30714
|
+
* jQuery(window).on('popstate', debounced.cancel);
|
|
30715
|
+
*/
|
|
30716
|
+
function debounce(func, wait, options) {
|
|
30717
|
+
var lastArgs,
|
|
30718
|
+
lastThis,
|
|
30719
|
+
maxWait,
|
|
30720
|
+
result,
|
|
30721
|
+
timerId,
|
|
30722
|
+
lastCallTime,
|
|
30723
|
+
lastInvokeTime = 0,
|
|
30724
|
+
leading = false,
|
|
30725
|
+
maxing = false,
|
|
30726
|
+
trailing = true;
|
|
30727
|
+
|
|
30728
|
+
if (typeof func != 'function') {
|
|
30729
|
+
throw new TypeError(FUNC_ERROR_TEXT$1);
|
|
30730
|
+
}
|
|
30731
|
+
wait = toNumber_1(wait) || 0;
|
|
30732
|
+
if (isObject_1(options)) {
|
|
30733
|
+
leading = !!options.leading;
|
|
30734
|
+
maxing = 'maxWait' in options;
|
|
30735
|
+
maxWait = maxing ? nativeMax$1(toNumber_1(options.maxWait) || 0, wait) : maxWait;
|
|
30736
|
+
trailing = 'trailing' in options ? !!options.trailing : trailing;
|
|
30737
|
+
}
|
|
30738
|
+
|
|
30739
|
+
function invokeFunc(time) {
|
|
30740
|
+
var args = lastArgs,
|
|
30741
|
+
thisArg = lastThis;
|
|
30742
|
+
|
|
30743
|
+
lastArgs = lastThis = undefined;
|
|
30744
|
+
lastInvokeTime = time;
|
|
30745
|
+
result = func.apply(thisArg, args);
|
|
30746
|
+
return result;
|
|
30747
|
+
}
|
|
30748
|
+
|
|
30749
|
+
function leadingEdge(time) {
|
|
30750
|
+
// Reset any `maxWait` timer.
|
|
30751
|
+
lastInvokeTime = time;
|
|
30752
|
+
// Start the timer for the trailing edge.
|
|
30753
|
+
timerId = setTimeout(timerExpired, wait);
|
|
30754
|
+
// Invoke the leading edge.
|
|
30755
|
+
return leading ? invokeFunc(time) : result;
|
|
30756
|
+
}
|
|
30757
|
+
|
|
30758
|
+
function remainingWait(time) {
|
|
30759
|
+
var timeSinceLastCall = time - lastCallTime,
|
|
30760
|
+
timeSinceLastInvoke = time - lastInvokeTime,
|
|
30761
|
+
timeWaiting = wait - timeSinceLastCall;
|
|
30762
|
+
|
|
30763
|
+
return maxing
|
|
30764
|
+
? nativeMin(timeWaiting, maxWait - timeSinceLastInvoke)
|
|
30765
|
+
: timeWaiting;
|
|
30766
|
+
}
|
|
30767
|
+
|
|
30768
|
+
function shouldInvoke(time) {
|
|
30769
|
+
var timeSinceLastCall = time - lastCallTime,
|
|
30770
|
+
timeSinceLastInvoke = time - lastInvokeTime;
|
|
30771
|
+
|
|
30772
|
+
// Either this is the first call, activity has stopped and we're at the
|
|
30773
|
+
// trailing edge, the system time has gone backwards and we're treating
|
|
30774
|
+
// it as the trailing edge, or we've hit the `maxWait` limit.
|
|
30775
|
+
return (lastCallTime === undefined || (timeSinceLastCall >= wait) ||
|
|
30776
|
+
(timeSinceLastCall < 0) || (maxing && timeSinceLastInvoke >= maxWait));
|
|
30777
|
+
}
|
|
30778
|
+
|
|
30779
|
+
function timerExpired() {
|
|
30780
|
+
var time = now_1();
|
|
30781
|
+
if (shouldInvoke(time)) {
|
|
30782
|
+
return trailingEdge(time);
|
|
30783
|
+
}
|
|
30784
|
+
// Restart the timer.
|
|
30785
|
+
timerId = setTimeout(timerExpired, remainingWait(time));
|
|
30786
|
+
}
|
|
30787
|
+
|
|
30788
|
+
function trailingEdge(time) {
|
|
30789
|
+
timerId = undefined;
|
|
30790
|
+
|
|
30791
|
+
// Only invoke if we have `lastArgs` which means `func` has been
|
|
30792
|
+
// debounced at least once.
|
|
30793
|
+
if (trailing && lastArgs) {
|
|
30794
|
+
return invokeFunc(time);
|
|
30795
|
+
}
|
|
30796
|
+
lastArgs = lastThis = undefined;
|
|
30797
|
+
return result;
|
|
30798
|
+
}
|
|
30799
|
+
|
|
30800
|
+
function cancel() {
|
|
30801
|
+
if (timerId !== undefined) {
|
|
30802
|
+
clearTimeout(timerId);
|
|
30803
|
+
}
|
|
30804
|
+
lastInvokeTime = 0;
|
|
30805
|
+
lastArgs = lastCallTime = lastThis = timerId = undefined;
|
|
30806
|
+
}
|
|
30807
|
+
|
|
30808
|
+
function flush() {
|
|
30809
|
+
return timerId === undefined ? result : trailingEdge(now_1());
|
|
30810
|
+
}
|
|
30811
|
+
|
|
30812
|
+
function debounced() {
|
|
30813
|
+
var time = now_1(),
|
|
30814
|
+
isInvoking = shouldInvoke(time);
|
|
30815
|
+
|
|
30816
|
+
lastArgs = arguments;
|
|
30817
|
+
lastThis = this;
|
|
30818
|
+
lastCallTime = time;
|
|
30819
|
+
|
|
30820
|
+
if (isInvoking) {
|
|
30821
|
+
if (timerId === undefined) {
|
|
30822
|
+
return leadingEdge(lastCallTime);
|
|
30823
|
+
}
|
|
30824
|
+
if (maxing) {
|
|
30825
|
+
// Handle invocations in a tight loop.
|
|
30826
|
+
clearTimeout(timerId);
|
|
30827
|
+
timerId = setTimeout(timerExpired, wait);
|
|
30828
|
+
return invokeFunc(lastCallTime);
|
|
30829
|
+
}
|
|
30830
|
+
}
|
|
30831
|
+
if (timerId === undefined) {
|
|
30832
|
+
timerId = setTimeout(timerExpired, wait);
|
|
30833
|
+
}
|
|
30834
|
+
return result;
|
|
30835
|
+
}
|
|
30836
|
+
debounced.cancel = cancel;
|
|
30837
|
+
debounced.flush = flush;
|
|
30838
|
+
return debounced;
|
|
30839
|
+
}
|
|
30840
|
+
|
|
30841
|
+
var debounce_1 = debounce;
|
|
30842
|
+
|
|
30843
|
+
/** Error message constants. */
|
|
30844
|
+
var FUNC_ERROR_TEXT = 'Expected a function';
|
|
30845
|
+
|
|
30846
|
+
/**
|
|
30847
|
+
* Creates a throttled function that only invokes `func` at most once per
|
|
30848
|
+
* every `wait` milliseconds. The throttled function comes with a `cancel`
|
|
30849
|
+
* method to cancel delayed `func` invocations and a `flush` method to
|
|
30850
|
+
* immediately invoke them. Provide `options` to indicate whether `func`
|
|
30851
|
+
* should be invoked on the leading and/or trailing edge of the `wait`
|
|
30852
|
+
* timeout. The `func` is invoked with the last arguments provided to the
|
|
30853
|
+
* throttled function. Subsequent calls to the throttled function return the
|
|
30854
|
+
* result of the last `func` invocation.
|
|
30855
|
+
*
|
|
30856
|
+
* **Note:** If `leading` and `trailing` options are `true`, `func` is
|
|
30857
|
+
* invoked on the trailing edge of the timeout only if the throttled function
|
|
30858
|
+
* is invoked more than once during the `wait` timeout.
|
|
30859
|
+
*
|
|
30860
|
+
* If `wait` is `0` and `leading` is `false`, `func` invocation is deferred
|
|
30861
|
+
* until to the next tick, similar to `setTimeout` with a timeout of `0`.
|
|
30862
|
+
*
|
|
30863
|
+
* See [David Corbacho's article](https://css-tricks.com/debouncing-throttling-explained-examples/)
|
|
30864
|
+
* for details over the differences between `_.throttle` and `_.debounce`.
|
|
30865
|
+
*
|
|
30866
|
+
* @static
|
|
30867
|
+
* @memberOf _
|
|
30868
|
+
* @since 0.1.0
|
|
30869
|
+
* @category Function
|
|
30870
|
+
* @param {Function} func The function to throttle.
|
|
30871
|
+
* @param {number} [wait=0] The number of milliseconds to throttle invocations to.
|
|
30872
|
+
* @param {Object} [options={}] The options object.
|
|
30873
|
+
* @param {boolean} [options.leading=true]
|
|
30874
|
+
* Specify invoking on the leading edge of the timeout.
|
|
30875
|
+
* @param {boolean} [options.trailing=true]
|
|
30876
|
+
* Specify invoking on the trailing edge of the timeout.
|
|
30877
|
+
* @returns {Function} Returns the new throttled function.
|
|
30878
|
+
* @example
|
|
30879
|
+
*
|
|
30880
|
+
* // Avoid excessively updating the position while scrolling.
|
|
30881
|
+
* jQuery(window).on('scroll', _.throttle(updatePosition, 100));
|
|
30882
|
+
*
|
|
30883
|
+
* // Invoke `renewToken` when the click event is fired, but not more than once every 5 minutes.
|
|
30884
|
+
* var throttled = _.throttle(renewToken, 300000, { 'trailing': false });
|
|
30885
|
+
* jQuery(element).on('click', throttled);
|
|
30886
|
+
*
|
|
30887
|
+
* // Cancel the trailing throttled invocation.
|
|
30888
|
+
* jQuery(window).on('popstate', throttled.cancel);
|
|
30889
|
+
*/
|
|
30890
|
+
function throttle(func, wait, options) {
|
|
30891
|
+
var leading = true,
|
|
30892
|
+
trailing = true;
|
|
30893
|
+
|
|
30894
|
+
if (typeof func != 'function') {
|
|
30895
|
+
throw new TypeError(FUNC_ERROR_TEXT);
|
|
30896
|
+
}
|
|
30897
|
+
if (isObject_1(options)) {
|
|
30898
|
+
leading = 'leading' in options ? !!options.leading : leading;
|
|
30899
|
+
trailing = 'trailing' in options ? !!options.trailing : trailing;
|
|
30900
|
+
}
|
|
30901
|
+
return debounce_1(func, wait, {
|
|
30902
|
+
'leading': leading,
|
|
30903
|
+
'maxWait': wait,
|
|
30904
|
+
'trailing': trailing
|
|
30905
|
+
});
|
|
30906
|
+
}
|
|
30907
|
+
|
|
30908
|
+
var throttle_1 = throttle;
|
|
30909
|
+
|
|
30334
30910
|
var ResourcePreviewCell = function (props) {
|
|
30335
30911
|
return useObserver(function () { return (jsx(ListItem, { className: props.className, button: props.button, selected: props.selected },
|
|
30336
30912
|
props.resource.image && (jsx(ListItemAvatar, null,
|
|
@@ -30347,34 +30923,31 @@ System.register(['@builder.io/react', '@emotion/core', '@material-ui/core', 'rea
|
|
|
30347
30923
|
searchInputText: '',
|
|
30348
30924
|
loading: false,
|
|
30349
30925
|
resources: [],
|
|
30350
|
-
search: function () {
|
|
30351
|
-
|
|
30352
|
-
|
|
30353
|
-
|
|
30354
|
-
|
|
30355
|
-
|
|
30356
|
-
|
|
30357
|
-
|
|
30358
|
-
|
|
30359
|
-
|
|
30360
|
-
|
|
30361
|
-
|
|
30362
|
-
|
|
30363
|
-
|
|
30364
|
-
|
|
30365
|
-
|
|
30366
|
-
|
|
30367
|
-
|
|
30368
|
-
|
|
30369
|
-
|
|
30370
|
-
|
|
30371
|
-
|
|
30372
|
-
|
|
30373
|
-
return [2 /*return*/];
|
|
30374
|
-
}
|
|
30375
|
-
});
|
|
30926
|
+
search: throttle_1(function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
30927
|
+
var catchError, resourcesResponse;
|
|
30928
|
+
return __generator(this, function (_a) {
|
|
30929
|
+
switch (_a.label) {
|
|
30930
|
+
case 0:
|
|
30931
|
+
store.loading = true;
|
|
30932
|
+
catchError = function (err) {
|
|
30933
|
+
console.error('search error:', err);
|
|
30934
|
+
props.context.snackBar.show('Oh no! There was an error searching for resources');
|
|
30935
|
+
};
|
|
30936
|
+
return [4 /*yield*/, props.api[props.resourceName]
|
|
30937
|
+
.search(store.searchInputText)
|
|
30938
|
+
.catch(catchError)];
|
|
30939
|
+
case 1:
|
|
30940
|
+
resourcesResponse = _a.sent();
|
|
30941
|
+
runInAction(function () {
|
|
30942
|
+
if (Array.isArray(resourcesResponse)) {
|
|
30943
|
+
store.resources = resourcesResponse.filter(function (resource) { return !(props.omitIds || []).includes(String(resource.id)); });
|
|
30944
|
+
}
|
|
30945
|
+
store.loading = false;
|
|
30946
|
+
});
|
|
30947
|
+
return [2 /*return*/];
|
|
30948
|
+
}
|
|
30376
30949
|
});
|
|
30377
|
-
},
|
|
30950
|
+
}); }, 400),
|
|
30378
30951
|
}); });
|
|
30379
30952
|
useEffect(function () {
|
|
30380
30953
|
store.search();
|
|
@@ -30465,38 +31038,41 @@ System.register(['@builder.io/react', '@emotion/core', '@material-ui/core', 'rea
|
|
|
30465
31038
|
},
|
|
30466
31039
|
showPickResouceModal: function (title) {
|
|
30467
31040
|
return __awaiter(this, void 0, void 0, function () {
|
|
30468
|
-
var close;
|
|
31041
|
+
var resourcePicker, rest, PickerCompnent, close;
|
|
30469
31042
|
var _this = this;
|
|
30470
31043
|
return __generator(this, function (_a) {
|
|
30471
31044
|
switch (_a.label) {
|
|
30472
|
-
case 0:
|
|
30473
|
-
|
|
30474
|
-
|
|
30475
|
-
|
|
30476
|
-
|
|
30477
|
-
|
|
30478
|
-
|
|
30479
|
-
|
|
30480
|
-
|
|
30481
|
-
|
|
30482
|
-
|
|
30483
|
-
props.onChange(_this.resourceId);
|
|
31045
|
+
case 0:
|
|
31046
|
+
props.value, resourcePicker = props.resourcePicker, rest = __rest(props, ["value", "resourcePicker"]);
|
|
31047
|
+
PickerCompnent = resourcePicker || ResourcePicker;
|
|
31048
|
+
return [4 /*yield*/, props.context.globalState.openDialog(jsx(PickerCompnent, __assign({}, rest, { resourceName: props.resourceName }, (this.resourceInfo && { value: this.resourceInfo }), { title: title, onChange: action(function (value) {
|
|
31049
|
+
var _a;
|
|
31050
|
+
if (value) {
|
|
31051
|
+
_this.resourceHandle = value.handle;
|
|
31052
|
+
_this.resourceId = String(value.id);
|
|
31053
|
+
_this.getResource();
|
|
31054
|
+
if (props.handleOnly) {
|
|
31055
|
+
props.onChange(_this.resourceHandle);
|
|
30484
31056
|
}
|
|
30485
31057
|
else {
|
|
30486
|
-
|
|
31058
|
+
if ((_a = props.field) === null || _a === void 0 ? void 0 : _a.isTargeting) {
|
|
31059
|
+
props.onChange(_this.resourceId);
|
|
31060
|
+
}
|
|
31061
|
+
else {
|
|
31062
|
+
props.onChange(props.api[props.resourceName].getRequestObject(_this.resourceId, value));
|
|
31063
|
+
}
|
|
30487
31064
|
}
|
|
30488
31065
|
}
|
|
30489
|
-
|
|
30490
|
-
|
|
30491
|
-
|
|
30492
|
-
|
|
30493
|
-
|
|
30494
|
-
|
|
30495
|
-
|
|
30496
|
-
|
|
31066
|
+
close();
|
|
31067
|
+
}) })), true, {
|
|
31068
|
+
PaperProps: {
|
|
31069
|
+
// Align modal to top so doesn't jump around centering itself when
|
|
31070
|
+
// grows and shrinks to show more/less resources or loading
|
|
31071
|
+
style: {
|
|
31072
|
+
alignSelf: 'flex-start',
|
|
31073
|
+
},
|
|
30497
31074
|
},
|
|
30498
|
-
}
|
|
30499
|
-
})];
|
|
31075
|
+
})];
|
|
30500
31076
|
case 1:
|
|
30501
31077
|
close = _a.sent();
|
|
30502
31078
|
return [2 /*return*/];
|
|
@@ -30551,24 +31127,6 @@ System.register(['@builder.io/react', '@emotion/core', '@material-ui/core', 'rea
|
|
|
30551
31127
|
});
|
|
30552
31128
|
};
|
|
30553
31129
|
|
|
30554
|
-
/** Detect free variable `global` from Node.js. */
|
|
30555
|
-
var freeGlobal = typeof commonjsGlobal == 'object' && commonjsGlobal && commonjsGlobal.Object === Object && commonjsGlobal;
|
|
30556
|
-
|
|
30557
|
-
var _freeGlobal = freeGlobal;
|
|
30558
|
-
|
|
30559
|
-
/** Detect free variable `self`. */
|
|
30560
|
-
var freeSelf = typeof self == 'object' && self && self.Object === Object && self;
|
|
30561
|
-
|
|
30562
|
-
/** Used as a reference to the global object. */
|
|
30563
|
-
var root = _freeGlobal || freeSelf || Function('return this')();
|
|
30564
|
-
|
|
30565
|
-
var _root = root;
|
|
30566
|
-
|
|
30567
|
-
/** Built-in value references. */
|
|
30568
|
-
var Symbol$1 = _root.Symbol;
|
|
30569
|
-
|
|
30570
|
-
var _Symbol = Symbol$1;
|
|
30571
|
-
|
|
30572
31130
|
/**
|
|
30573
31131
|
* A specialized version of `_.map` for arrays without support for iteratee
|
|
30574
31132
|
* shorthands.
|
|
@@ -30618,156 +31176,6 @@ System.register(['@builder.io/react', '@emotion/core', '@material-ui/core', 'rea
|
|
|
30618
31176
|
|
|
30619
31177
|
var isArray_1 = isArray;
|
|
30620
31178
|
|
|
30621
|
-
/** Used for built-in method references. */
|
|
30622
|
-
var objectProto$b = Object.prototype;
|
|
30623
|
-
|
|
30624
|
-
/** Used to check objects for own properties. */
|
|
30625
|
-
var hasOwnProperty$9 = objectProto$b.hasOwnProperty;
|
|
30626
|
-
|
|
30627
|
-
/**
|
|
30628
|
-
* Used to resolve the
|
|
30629
|
-
* [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)
|
|
30630
|
-
* of values.
|
|
30631
|
-
*/
|
|
30632
|
-
var nativeObjectToString$1 = objectProto$b.toString;
|
|
30633
|
-
|
|
30634
|
-
/** Built-in value references. */
|
|
30635
|
-
var symToStringTag$1 = _Symbol ? _Symbol.toStringTag : undefined;
|
|
30636
|
-
|
|
30637
|
-
/**
|
|
30638
|
-
* A specialized version of `baseGetTag` which ignores `Symbol.toStringTag` values.
|
|
30639
|
-
*
|
|
30640
|
-
* @private
|
|
30641
|
-
* @param {*} value The value to query.
|
|
30642
|
-
* @returns {string} Returns the raw `toStringTag`.
|
|
30643
|
-
*/
|
|
30644
|
-
function getRawTag(value) {
|
|
30645
|
-
var isOwn = hasOwnProperty$9.call(value, symToStringTag$1),
|
|
30646
|
-
tag = value[symToStringTag$1];
|
|
30647
|
-
|
|
30648
|
-
try {
|
|
30649
|
-
value[symToStringTag$1] = undefined;
|
|
30650
|
-
var unmasked = true;
|
|
30651
|
-
} catch (e) {}
|
|
30652
|
-
|
|
30653
|
-
var result = nativeObjectToString$1.call(value);
|
|
30654
|
-
if (unmasked) {
|
|
30655
|
-
if (isOwn) {
|
|
30656
|
-
value[symToStringTag$1] = tag;
|
|
30657
|
-
} else {
|
|
30658
|
-
delete value[symToStringTag$1];
|
|
30659
|
-
}
|
|
30660
|
-
}
|
|
30661
|
-
return result;
|
|
30662
|
-
}
|
|
30663
|
-
|
|
30664
|
-
var _getRawTag = getRawTag;
|
|
30665
|
-
|
|
30666
|
-
/** Used for built-in method references. */
|
|
30667
|
-
var objectProto$a = Object.prototype;
|
|
30668
|
-
|
|
30669
|
-
/**
|
|
30670
|
-
* Used to resolve the
|
|
30671
|
-
* [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)
|
|
30672
|
-
* of values.
|
|
30673
|
-
*/
|
|
30674
|
-
var nativeObjectToString = objectProto$a.toString;
|
|
30675
|
-
|
|
30676
|
-
/**
|
|
30677
|
-
* Converts `value` to a string using `Object.prototype.toString`.
|
|
30678
|
-
*
|
|
30679
|
-
* @private
|
|
30680
|
-
* @param {*} value The value to convert.
|
|
30681
|
-
* @returns {string} Returns the converted string.
|
|
30682
|
-
*/
|
|
30683
|
-
function objectToString(value) {
|
|
30684
|
-
return nativeObjectToString.call(value);
|
|
30685
|
-
}
|
|
30686
|
-
|
|
30687
|
-
var _objectToString = objectToString;
|
|
30688
|
-
|
|
30689
|
-
/** `Object#toString` result references. */
|
|
30690
|
-
var nullTag = '[object Null]',
|
|
30691
|
-
undefinedTag = '[object Undefined]';
|
|
30692
|
-
|
|
30693
|
-
/** Built-in value references. */
|
|
30694
|
-
var symToStringTag = _Symbol ? _Symbol.toStringTag : undefined;
|
|
30695
|
-
|
|
30696
|
-
/**
|
|
30697
|
-
* The base implementation of `getTag` without fallbacks for buggy environments.
|
|
30698
|
-
*
|
|
30699
|
-
* @private
|
|
30700
|
-
* @param {*} value The value to query.
|
|
30701
|
-
* @returns {string} Returns the `toStringTag`.
|
|
30702
|
-
*/
|
|
30703
|
-
function baseGetTag(value) {
|
|
30704
|
-
if (value == null) {
|
|
30705
|
-
return value === undefined ? undefinedTag : nullTag;
|
|
30706
|
-
}
|
|
30707
|
-
return (symToStringTag && symToStringTag in Object(value))
|
|
30708
|
-
? _getRawTag(value)
|
|
30709
|
-
: _objectToString(value);
|
|
30710
|
-
}
|
|
30711
|
-
|
|
30712
|
-
var _baseGetTag = baseGetTag;
|
|
30713
|
-
|
|
30714
|
-
/**
|
|
30715
|
-
* Checks if `value` is object-like. A value is object-like if it's not `null`
|
|
30716
|
-
* and has a `typeof` result of "object".
|
|
30717
|
-
*
|
|
30718
|
-
* @static
|
|
30719
|
-
* @memberOf _
|
|
30720
|
-
* @since 4.0.0
|
|
30721
|
-
* @category Lang
|
|
30722
|
-
* @param {*} value The value to check.
|
|
30723
|
-
* @returns {boolean} Returns `true` if `value` is object-like, else `false`.
|
|
30724
|
-
* @example
|
|
30725
|
-
*
|
|
30726
|
-
* _.isObjectLike({});
|
|
30727
|
-
* // => true
|
|
30728
|
-
*
|
|
30729
|
-
* _.isObjectLike([1, 2, 3]);
|
|
30730
|
-
* // => true
|
|
30731
|
-
*
|
|
30732
|
-
* _.isObjectLike(_.noop);
|
|
30733
|
-
* // => false
|
|
30734
|
-
*
|
|
30735
|
-
* _.isObjectLike(null);
|
|
30736
|
-
* // => false
|
|
30737
|
-
*/
|
|
30738
|
-
function isObjectLike(value) {
|
|
30739
|
-
return value != null && typeof value == 'object';
|
|
30740
|
-
}
|
|
30741
|
-
|
|
30742
|
-
var isObjectLike_1 = isObjectLike;
|
|
30743
|
-
|
|
30744
|
-
/** `Object#toString` result references. */
|
|
30745
|
-
var symbolTag = '[object Symbol]';
|
|
30746
|
-
|
|
30747
|
-
/**
|
|
30748
|
-
* Checks if `value` is classified as a `Symbol` primitive or object.
|
|
30749
|
-
*
|
|
30750
|
-
* @static
|
|
30751
|
-
* @memberOf _
|
|
30752
|
-
* @since 4.0.0
|
|
30753
|
-
* @category Lang
|
|
30754
|
-
* @param {*} value The value to check.
|
|
30755
|
-
* @returns {boolean} Returns `true` if `value` is a symbol, else `false`.
|
|
30756
|
-
* @example
|
|
30757
|
-
*
|
|
30758
|
-
* _.isSymbol(Symbol.iterator);
|
|
30759
|
-
* // => true
|
|
30760
|
-
*
|
|
30761
|
-
* _.isSymbol('abc');
|
|
30762
|
-
* // => false
|
|
30763
|
-
*/
|
|
30764
|
-
function isSymbol(value) {
|
|
30765
|
-
return typeof value == 'symbol' ||
|
|
30766
|
-
(isObjectLike_1(value) && _baseGetTag(value) == symbolTag);
|
|
30767
|
-
}
|
|
30768
|
-
|
|
30769
|
-
var isSymbol_1 = isSymbol;
|
|
30770
|
-
|
|
30771
31179
|
/** Used as references for various `Number` constants. */
|
|
30772
31180
|
var INFINITY = 1 / 0;
|
|
30773
31181
|
|
|
@@ -31115,17 +31523,19 @@ System.register(['@builder.io/react', '@emotion/core', '@material-ui/core', 'rea
|
|
|
31115
31523
|
marginLeft: 'auto',
|
|
31116
31524
|
alignSelf: 'center',
|
|
31117
31525
|
}, onClick: function () {
|
|
31118
|
-
var res = __spreadArrays(props.value).
|
|
31526
|
+
var res = __spreadArrays(props.value.slice(0, props.value.indexOf(item)), props.value.slice(props.value.indexOf(item) + 1));
|
|
31119
31527
|
props.onChange(res);
|
|
31120
31528
|
} },
|
|
31121
31529
|
jsx(Close$1, null))))); })),
|
|
31122
31530
|
jsx(Button, { color: "primary", variant: "outlined", fullWidth: true, css: { marginTop: 10 }, onClick: function () {
|
|
31123
|
-
var
|
|
31531
|
+
props.value; var resourcePicker = props.resourcePicker, rest = __rest(props, ["value", "resourcePicker"]);
|
|
31532
|
+
var PickerCompnent = resourcePicker || ResourcePicker;
|
|
31533
|
+
var close = appState.globalState.openDialog(jsx(PickerCompnent, __assign({}, rest, { context: appState, omitIds: store.value, onChange: action(function (resource) {
|
|
31124
31534
|
if (resource) {
|
|
31125
31535
|
props.onChange(__spreadArrays((store.value || []), [String(resource.id)]));
|
|
31126
31536
|
}
|
|
31127
31537
|
close();
|
|
31128
|
-
}) }));
|
|
31538
|
+
}) })));
|
|
31129
31539
|
} },
|
|
31130
31540
|
"+ ",
|
|
31131
31541
|
capitalize_1(props.resourceName)),
|
|
@@ -31156,38 +31566,6 @@ System.register(['@builder.io/react', '@emotion/core', '@material-ui/core', 'rea
|
|
|
31156
31566
|
});
|
|
31157
31567
|
}
|
|
31158
31568
|
|
|
31159
|
-
/**
|
|
31160
|
-
* Checks if `value` is the
|
|
31161
|
-
* [language type](http://www.ecma-international.org/ecma-262/7.0/#sec-ecmascript-language-types)
|
|
31162
|
-
* of `Object`. (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`)
|
|
31163
|
-
*
|
|
31164
|
-
* @static
|
|
31165
|
-
* @memberOf _
|
|
31166
|
-
* @since 0.1.0
|
|
31167
|
-
* @category Lang
|
|
31168
|
-
* @param {*} value The value to check.
|
|
31169
|
-
* @returns {boolean} Returns `true` if `value` is an object, else `false`.
|
|
31170
|
-
* @example
|
|
31171
|
-
*
|
|
31172
|
-
* _.isObject({});
|
|
31173
|
-
* // => true
|
|
31174
|
-
*
|
|
31175
|
-
* _.isObject([1, 2, 3]);
|
|
31176
|
-
* // => true
|
|
31177
|
-
*
|
|
31178
|
-
* _.isObject(_.noop);
|
|
31179
|
-
* // => true
|
|
31180
|
-
*
|
|
31181
|
-
* _.isObject(null);
|
|
31182
|
-
* // => false
|
|
31183
|
-
*/
|
|
31184
|
-
function isObject(value) {
|
|
31185
|
-
var type = typeof value;
|
|
31186
|
-
return value != null && (type == 'object' || type == 'function');
|
|
31187
|
-
}
|
|
31188
|
-
|
|
31189
|
-
var isObject_1 = isObject;
|
|
31190
|
-
|
|
31191
31569
|
/** `Object#toString` result references. */
|
|
31192
31570
|
var asyncTag = '[object AsyncFunction]',
|
|
31193
31571
|
funcTag$1 = '[object Function]',
|
|
@@ -32953,72 +33331,77 @@ System.register(['@builder.io/react', '@emotion/core', '@material-ui/core', 'rea
|
|
|
32953
33331
|
|
|
32954
33332
|
var template_1 = template;
|
|
32955
33333
|
|
|
32956
|
-
var onEditorLoad = function (config, apiOperations, resourceName) {
|
|
32957
|
-
|
|
32958
|
-
|
|
32959
|
-
|
|
32960
|
-
|
|
32961
|
-
|
|
32962
|
-
|
|
32963
|
-
|
|
32964
|
-
|
|
32965
|
-
var previewField = (_c = (_b = appState.designerState.editingModel) === null || _b === void 0 ? void 0 : _b.fields.find(function (field) {
|
|
32966
|
-
return field.type === "" + config.name + capitalize_1(resourceName) + "Preview";
|
|
32967
|
-
})) === null || _c === void 0 ? void 0 : _c.name;
|
|
32968
|
-
if (previewField && appState.designerState.editingContentModel) {
|
|
32969
|
-
var resourceId = (_d = appState.designerState.editingContentModel.data
|
|
32970
|
-
.get(previewField)) === null || _d === void 0 ? void 0 : _d.options.get(resourceName);
|
|
32971
|
-
return apiOperations[resourceName].findById(resourceId);
|
|
32972
|
-
}
|
|
32973
|
-
var pluginSettings = appState.user.organization.value.settings.plugins.get(config.id);
|
|
32974
|
-
var shouldSync = pluginSettings.get('syncPreviewUrlWithTargeting');
|
|
32975
|
-
var query = (_f = (_e = appState.designerState.editingContentModel) === null || _e === void 0 ? void 0 : _e.query) === null || _f === void 0 ? void 0 : _f.toJSON();
|
|
32976
|
-
var customAttributes = (_g = appState.user.organization.value.customTargetingAttributes) === null || _g === void 0 ? void 0 : _g.toJSON();
|
|
32977
|
-
if (shouldSync && customAttributes && query) {
|
|
32978
|
-
var apiService = apiOperations[resourceName];
|
|
32979
|
-
var _loop_1 = function (key, value) {
|
|
32980
|
-
var targetingValue = (_h = query.find(function (q) { return q.property === key; })) === null || _h === void 0 ? void 0 : _h.value;
|
|
32981
|
-
if (targetingValue && value.type === "" + config.name + capitalize_1(resourceName)) {
|
|
32982
|
-
return { value: apiService.findById(targetingValue) };
|
|
32983
|
-
}
|
|
32984
|
-
if (apiService.findByHandle &&
|
|
32985
|
-
targetingValue &&
|
|
32986
|
-
value.type === "" + config.name + capitalize_1(resourceName) + "Handle") {
|
|
32987
|
-
return { value: apiService.findByHandle(targetingValue) };
|
|
32988
|
-
}
|
|
32989
|
-
};
|
|
32990
|
-
for (var _i = 0, _j = Object.entries(customAttributes); _i < _j.length; _i++) {
|
|
32991
|
-
var _k = _j[_i], key = _k[0], value = _k[1];
|
|
32992
|
-
var state_1 = _loop_1(key, value);
|
|
32993
|
-
if (typeof state_1 === "object")
|
|
32994
|
-
return state_1.value;
|
|
33334
|
+
var onEditorLoad = function (config, apiOperations, resourceName) {
|
|
33335
|
+
return function (_a) {
|
|
33336
|
+
var safeReaction = _a.safeReaction, updatePreviewUrl = _a.updatePreviewUrl;
|
|
33337
|
+
// compile previewResource if any, to allow user to have templated editing urls for their models (e.g in cases of product page template)
|
|
33338
|
+
safeReaction(function () {
|
|
33339
|
+
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
33340
|
+
var modelUrl = (_a = appState.designerState.editingModel) === null || _a === void 0 ? void 0 : _a.examplePageUrl;
|
|
33341
|
+
if (!modelUrl) {
|
|
33342
|
+
return;
|
|
32995
33343
|
}
|
|
32996
|
-
|
|
32997
|
-
|
|
32998
|
-
|
|
32999
|
-
|
|
33000
|
-
|
|
33001
|
-
|
|
33002
|
-
|
|
33003
|
-
|
|
33004
|
-
|
|
33005
|
-
|
|
33006
|
-
|
|
33007
|
-
|
|
33008
|
-
|
|
33009
|
-
|
|
33010
|
-
|
|
33011
|
-
}));
|
|
33012
|
-
if (
|
|
33013
|
-
|
|
33014
|
-
appState.snackBar.show("Previewing " + previewUrl);
|
|
33344
|
+
var previewField = (_c = (_b = appState.designerState.editingModel) === null || _b === void 0 ? void 0 : _b.fields.find(function (field) {
|
|
33345
|
+
return field.type === "" + config.name + capitalize_1(resourceName) + "Preview";
|
|
33346
|
+
})) === null || _c === void 0 ? void 0 : _c.name;
|
|
33347
|
+
if (previewField && appState.designerState.editingContentModel) {
|
|
33348
|
+
var resourceId = (_d = appState.designerState.editingContentModel.data
|
|
33349
|
+
.get(previewField)) === null || _d === void 0 ? void 0 : _d.options.get(resourceName);
|
|
33350
|
+
return apiOperations[resourceName].findById(resourceId);
|
|
33351
|
+
}
|
|
33352
|
+
var pluginSettings = appState.user.organization.value.settings.plugins.get(config.id);
|
|
33353
|
+
var shouldSync = pluginSettings.get('syncPreviewUrlWithTargeting');
|
|
33354
|
+
var query = (_f = (_e = appState.designerState.editingContentModel) === null || _e === void 0 ? void 0 : _e.query) === null || _f === void 0 ? void 0 : _f.toJSON();
|
|
33355
|
+
var customAttributes = (_g = appState.user.organization.value.customTargetingAttributes) === null || _g === void 0 ? void 0 : _g.toJSON();
|
|
33356
|
+
if (shouldSync && customAttributes && query) {
|
|
33357
|
+
var apiService = apiOperations[resourceName];
|
|
33358
|
+
var _loop_1 = function (key, value) {
|
|
33359
|
+
var targetingValue = (_h = query.find(function (q) { return q.property === key; })) === null || _h === void 0 ? void 0 : _h.value;
|
|
33360
|
+
if (targetingValue && value.type === "" + config.name + capitalize_1(resourceName)) {
|
|
33361
|
+
return { value: apiService.findById(targetingValue) };
|
|
33015
33362
|
}
|
|
33016
|
-
|
|
33017
|
-
|
|
33363
|
+
if (apiService.findByHandle &&
|
|
33364
|
+
targetingValue &&
|
|
33365
|
+
value.type === "" + config.name + capitalize_1(resourceName) + "Handle") {
|
|
33366
|
+
return { value: apiService.findByHandle(targetingValue) };
|
|
33367
|
+
}
|
|
33368
|
+
};
|
|
33369
|
+
for (var _i = 0, _j = Object.entries(customAttributes); _i < _j.length; _i++) {
|
|
33370
|
+
var _k = _j[_i], key = _k[0], value = _k[1];
|
|
33371
|
+
var state_1 = _loop_1(key, value);
|
|
33372
|
+
if (typeof state_1 === "object")
|
|
33373
|
+
return state_1.value;
|
|
33374
|
+
}
|
|
33018
33375
|
}
|
|
33019
|
-
})
|
|
33020
|
-
|
|
33021
|
-
|
|
33376
|
+
}, function (resourcePromise) { return __awaiter(void 0, void 0, void 0, function () {
|
|
33377
|
+
var modelUrl, previewResource, compiled, previewUrl;
|
|
33378
|
+
var _a;
|
|
33379
|
+
var _b;
|
|
33380
|
+
return __generator(this, function (_c) {
|
|
33381
|
+
switch (_c.label) {
|
|
33382
|
+
case 0:
|
|
33383
|
+
modelUrl = (_b = appState.designerState.editingModel) === null || _b === void 0 ? void 0 : _b.examplePageUrl;
|
|
33384
|
+
if (!(resourcePromise && modelUrl)) return [3 /*break*/, 2];
|
|
33385
|
+
return [4 /*yield*/, resourcePromise];
|
|
33386
|
+
case 1:
|
|
33387
|
+
previewResource = _c.sent();
|
|
33388
|
+
compiled = template_1(modelUrl);
|
|
33389
|
+
previewUrl = compiled(withDefaults((_a = {
|
|
33390
|
+
previewResource: previewResource
|
|
33391
|
+
},
|
|
33392
|
+
_a["preview" + capitalize_1(resourceName)] = previewResource,
|
|
33393
|
+
_a)));
|
|
33394
|
+
if (modelUrl !== previewUrl) {
|
|
33395
|
+
updatePreviewUrl(previewUrl);
|
|
33396
|
+
appState.snackBar.show("Previewing " + previewUrl);
|
|
33397
|
+
}
|
|
33398
|
+
_c.label = 2;
|
|
33399
|
+
case 2: return [2 /*return*/];
|
|
33400
|
+
}
|
|
33401
|
+
});
|
|
33402
|
+
}); });
|
|
33403
|
+
};
|
|
33404
|
+
};
|
|
33022
33405
|
var withDefaults = function (obj) {
|
|
33023
33406
|
var _a;
|
|
33024
33407
|
return (__assign(__assign({}, obj), { space: {
|
|
@@ -33095,27 +33478,33 @@ System.register(['@builder.io/react', '@emotion/core', '@material-ui/core', 'rea
|
|
|
33095
33478
|
api: apiOperations,
|
|
33096
33479
|
};
|
|
33097
33480
|
Builder.register('editor.onLoad', onEditorLoad(config, apiOperations, resourceName));
|
|
33481
|
+
var resourcePicker = apiOperations[resourceName].resourcePicker;
|
|
33098
33482
|
Builder.registerEditor({
|
|
33099
33483
|
name: "" + config.name + capitalize_1(resourceName),
|
|
33484
|
+
isDataResource: true,
|
|
33485
|
+
pluginId: config.id,
|
|
33100
33486
|
component: function (props) { return (React.createElement(ErrorBoundary, null,
|
|
33101
|
-
React.createElement(ResourcesPickerButton, __assign({}, props, contextProps)))); },
|
|
33102
|
-
});
|
|
33103
|
-
Builder.registerEditor({
|
|
33104
|
-
name: "" + config.name + capitalize_1(resourceName) + "Preview",
|
|
33105
|
-
component: function (props) { return (React.createElement(ErrorBoundary, null,
|
|
33106
|
-
React.createElement(ResourcesPickerButton, __assign({}, props, contextProps, { previewType: "" + config.name + capitalize_1(resourceName) + "Preview", isPreview: true })))); },
|
|
33487
|
+
React.createElement(ResourcesPickerButton, __assign({ resourcePicker: resourcePicker }, props, contextProps)))); },
|
|
33107
33488
|
});
|
|
33489
|
+
if (!config.noPreviewTypes) {
|
|
33490
|
+
Builder.registerEditor({
|
|
33491
|
+
name: "" + config.name + capitalize_1(resourceName) + "Preview",
|
|
33492
|
+
component: function (props) { return (React.createElement(ErrorBoundary, null,
|
|
33493
|
+
React.createElement(ResourcesPickerButton, __assign({ resourcePicker: resourcePicker }, props, contextProps, { previewType: "" + config.name + capitalize_1(resourceName) + "Preview", isPreview: true })))); },
|
|
33494
|
+
});
|
|
33495
|
+
}
|
|
33108
33496
|
if (apiOperations[resourceName].findByHandle) {
|
|
33109
33497
|
Builder.registerEditor({
|
|
33110
33498
|
name: "" + config.name + capitalize_1(resourceName) + "Handle",
|
|
33111
33499
|
component: function (props) { return (React.createElement(ErrorBoundary, null,
|
|
33112
|
-
React.createElement(ResourcesPickerButton, __assign({}, props, contextProps, { handleOnly: true })))); },
|
|
33500
|
+
React.createElement(ResourcesPickerButton, __assign({ resourcePicker: resourcePicker }, props, contextProps, { handleOnly: true })))); },
|
|
33113
33501
|
});
|
|
33114
33502
|
}
|
|
33115
33503
|
Builder.registerEditor({
|
|
33116
33504
|
name: "" + config.name + capitalize_1(pluralize.plural(resourceName)) + "List",
|
|
33505
|
+
enum: true,
|
|
33117
33506
|
component: function (props) { return (React.createElement(ErrorBoundary, null,
|
|
33118
|
-
React.createElement(PickResourcesListButton, __assign({}, props, contextProps)))); },
|
|
33507
|
+
React.createElement(PickResourcesListButton, __assign({ resourcePicker: resourcePicker }, props, contextProps)))); },
|
|
33119
33508
|
});
|
|
33120
33509
|
});
|
|
33121
33510
|
return [2 /*return*/];
|
|
@@ -33174,7 +33563,7 @@ System.register(['@builder.io/react', '@emotion/core', '@material-ui/core', 'rea
|
|
|
33174
33563
|
}); };
|
|
33175
33564
|
|
|
33176
33565
|
var name = "@builder.io/plugin-sfcc-commerce-api";
|
|
33177
|
-
var version = "0.0.
|
|
33566
|
+
var version = "0.0.5";
|
|
33178
33567
|
var description = "";
|
|
33179
33568
|
var keywords = [
|
|
33180
33569
|
];
|
|
@@ -33290,7 +33679,7 @@ System.register(['@builder.io/react', '@emotion/core', '@material-ui/core', 'rea
|
|
|
33290
33679
|
typescript: "^3.0.3"
|
|
33291
33680
|
};
|
|
33292
33681
|
var dependencies = {
|
|
33293
|
-
"@builder.io/commerce-plugin-tools": "^0.
|
|
33682
|
+
"@builder.io/commerce-plugin-tools": "^0.3.1-1",
|
|
33294
33683
|
"commerce-sdk-isomorphic": "^1.7.0"
|
|
33295
33684
|
};
|
|
33296
33685
|
var pkg = {
|
|
@@ -33319,6 +33708,47 @@ System.register(['@builder.io/react', '@emotion/core', '@material-ui/core', 'rea
|
|
|
33319
33708
|
dependencies: dependencies
|
|
33320
33709
|
};
|
|
33321
33710
|
|
|
33711
|
+
const basicCache = new Map();
|
|
33712
|
+
const transformProduct = (resource) => ({
|
|
33713
|
+
...resource,
|
|
33714
|
+
id: resource.id,
|
|
33715
|
+
title: resource.name || "untitled",
|
|
33716
|
+
handle: resource.id,
|
|
33717
|
+
image: {
|
|
33718
|
+
src: resource.imageGroups?.[0].images?.[0].link || "https://unpkg.com/css.gg@2.0.0/icons/svg/toolbox.svg"
|
|
33719
|
+
}
|
|
33720
|
+
});
|
|
33721
|
+
const transformHit = (hit) => ({
|
|
33722
|
+
id: hit.productId,
|
|
33723
|
+
title: hit.productName || "untitled",
|
|
33724
|
+
handle: hit.productId,
|
|
33725
|
+
image: {
|
|
33726
|
+
src: hit.image?.link || "https://unpkg.com/css.gg@2.0.0/icons/svg/toolbox.svg"
|
|
33727
|
+
}
|
|
33728
|
+
});
|
|
33729
|
+
const transformCategory = (cat) => ({
|
|
33730
|
+
id: cat.id,
|
|
33731
|
+
title: cat.name,
|
|
33732
|
+
handle: cat.id,
|
|
33733
|
+
image: {
|
|
33734
|
+
src: cat.image || "https://unpkg.com/css.gg@2.0.0/icons/svg/box.svg"
|
|
33735
|
+
}
|
|
33736
|
+
});
|
|
33737
|
+
const transformRecommender = (rec) => ({
|
|
33738
|
+
...rec,
|
|
33739
|
+
id: rec.name,
|
|
33740
|
+
title: rec.name,
|
|
33741
|
+
image: {
|
|
33742
|
+
src: "https://cdn.builder.io/api/v1/image/assets%2Fd1ed12c3338144da8dd6b63b35d14c30%2Fe1439f0d991c4e2d968c84a38059f1d2"
|
|
33743
|
+
}
|
|
33744
|
+
});
|
|
33745
|
+
const getRecommenders = (siteId, clientId) => {
|
|
33746
|
+
const url = new URL("https://cdn.builder.io/api/v1/proxy-api");
|
|
33747
|
+
url.searchParams.set("url", `https://api.cquotient.com/v3/personalization/recommenders/${siteId}`);
|
|
33748
|
+
url.searchParams.set("headers.x-cq-client-id", clientId);
|
|
33749
|
+
url.searchParams.set("apiKey", appState.user.apiKey);
|
|
33750
|
+
return fetch(url).then((res) => res.json()).then((res) => res.recommenders.map(transformRecommender));
|
|
33751
|
+
};
|
|
33322
33752
|
class Api {
|
|
33323
33753
|
constructor(apiKey, pluginId) {
|
|
33324
33754
|
this.apiKey = apiKey;
|
|
@@ -33330,7 +33760,7 @@ System.register(['@builder.io/react', '@emotion/core', '@material-ui/core', 'rea
|
|
|
33330
33760
|
pluginId: this.pluginId,
|
|
33331
33761
|
apiKey: this.apiKey
|
|
33332
33762
|
});
|
|
33333
|
-
const root =
|
|
33763
|
+
const root = "https://qa.builder.io";
|
|
33334
33764
|
const baseUrl = new URL(`${root}/api/v1/sfcc-commerce/${path}`);
|
|
33335
33765
|
baseUrl.search = params.toString();
|
|
33336
33766
|
return baseUrl.toString();
|
|
@@ -33344,22 +33774,45 @@ System.register(['@builder.io/react', '@emotion/core', '@material-ui/core', 'rea
|
|
|
33344
33774
|
}).then((res) => res.json());
|
|
33345
33775
|
}
|
|
33346
33776
|
getProduct(id) {
|
|
33347
|
-
|
|
33777
|
+
if (basicCache.get(id)) {
|
|
33778
|
+
return Promise.resolve(basicCache.get(id));
|
|
33779
|
+
}
|
|
33780
|
+
return this.request(`products/${id}`).then((product) => {
|
|
33781
|
+
const resource = transformProduct(product);
|
|
33782
|
+
basicCache.set(resource.id, resource);
|
|
33783
|
+
return resource;
|
|
33784
|
+
});
|
|
33348
33785
|
}
|
|
33349
|
-
search(search
|
|
33350
|
-
return this.request("products-search", { method: "GET" }, { q: search })
|
|
33786
|
+
search(search) {
|
|
33787
|
+
return this.request("products-search", { method: "GET" }, { q: search }).then((search2) => {
|
|
33788
|
+
const resources = search2.hits?.map(transformHit) || [];
|
|
33789
|
+
resources.forEach((r) => basicCache.set(r.id, r));
|
|
33790
|
+
return resources;
|
|
33791
|
+
});
|
|
33351
33792
|
}
|
|
33352
33793
|
getCategory(id) {
|
|
33353
|
-
|
|
33794
|
+
if (basicCache.get(id)) {
|
|
33795
|
+
return Promise.resolve(basicCache.get(id));
|
|
33796
|
+
}
|
|
33797
|
+
return this.request(`categories/${id}`).then((cat) => {
|
|
33798
|
+
const resource = transformProduct(cat);
|
|
33799
|
+
basicCache.set(resource.id, resource);
|
|
33800
|
+
return resource;
|
|
33801
|
+
});
|
|
33354
33802
|
}
|
|
33355
33803
|
searchCategories(search) {
|
|
33356
|
-
return this.request("categories-search", { method: "GET" }, { q: search })
|
|
33804
|
+
return this.request("categories-search", { method: "GET" }, { q: search }).then((categories) => {
|
|
33805
|
+
const resources = categories?.map(transformCategory) || [];
|
|
33806
|
+
resources.forEach((r) => basicCache.set(r.id, r));
|
|
33807
|
+
return resources;
|
|
33808
|
+
});
|
|
33357
33809
|
}
|
|
33358
33810
|
}
|
|
33359
33811
|
|
|
33360
33812
|
registerCommercePlugin({
|
|
33361
33813
|
name: "SFCommerce",
|
|
33362
33814
|
id: pkg.name,
|
|
33815
|
+
noPreviewTypes: true,
|
|
33363
33816
|
settings: [
|
|
33364
33817
|
{
|
|
33365
33818
|
name: "clientId",
|
|
@@ -33385,44 +33838,47 @@ System.register(['@builder.io/react', '@emotion/core', '@material-ui/core', 'rea
|
|
|
33385
33838
|
name: "siteId",
|
|
33386
33839
|
type: "string",
|
|
33387
33840
|
required: true
|
|
33841
|
+
},
|
|
33842
|
+
{
|
|
33843
|
+
name: "einsteinId",
|
|
33844
|
+
friendlyName: "Einstein API Client ID",
|
|
33845
|
+
type: "string"
|
|
33846
|
+
},
|
|
33847
|
+
{
|
|
33848
|
+
name: "einsteinSiteId",
|
|
33849
|
+
friendlyName: "Einstein API Site ID",
|
|
33850
|
+
type: "string"
|
|
33388
33851
|
}
|
|
33389
33852
|
],
|
|
33390
33853
|
ctaText: `Connect your Salesforce Commerce API`
|
|
33391
|
-
}, async () => {
|
|
33854
|
+
}, async (settings) => {
|
|
33392
33855
|
const api = new Api(appState.user.apiKey, pkg.name);
|
|
33393
|
-
const
|
|
33394
|
-
|
|
33395
|
-
|
|
33396
|
-
|
|
33397
|
-
|
|
33398
|
-
|
|
33399
|
-
|
|
33400
|
-
|
|
33401
|
-
|
|
33402
|
-
|
|
33403
|
-
|
|
33404
|
-
|
|
33405
|
-
|
|
33406
|
-
|
|
33407
|
-
|
|
33408
|
-
|
|
33409
|
-
|
|
33410
|
-
|
|
33856
|
+
const einsteinId = settings.get("einsteinId");
|
|
33857
|
+
const einsteinSiteId = settings.get("einsteinSiteId");
|
|
33858
|
+
let recommendersType = {};
|
|
33859
|
+
if (einsteinId && einsteinSiteId) {
|
|
33860
|
+
const recommenders = await getRecommenders(einsteinSiteId, einsteinId);
|
|
33861
|
+
recommendersType = {
|
|
33862
|
+
recommender: {
|
|
33863
|
+
search(search = "") {
|
|
33864
|
+
return Promise.resolve(recommenders.filter((rec) => JSON.stringify(rec).includes(search)));
|
|
33865
|
+
},
|
|
33866
|
+
findById(id) {
|
|
33867
|
+
return Promise.resolve(recommenders.find((rec) => rec.id === id));
|
|
33868
|
+
},
|
|
33869
|
+
getRequestObject(id) {
|
|
33870
|
+
return id;
|
|
33871
|
+
}
|
|
33872
|
+
}
|
|
33873
|
+
};
|
|
33874
|
+
}
|
|
33875
|
+
return {
|
|
33411
33876
|
product: {
|
|
33412
33877
|
async findById(id) {
|
|
33413
|
-
|
|
33414
|
-
return transform(product);
|
|
33878
|
+
return await api.getProduct(id);
|
|
33415
33879
|
},
|
|
33416
33880
|
async search(search) {
|
|
33417
|
-
|
|
33418
|
-
return searchResult.hits?.map((hit) => ({
|
|
33419
|
-
id: hit.productId,
|
|
33420
|
-
title: hit.productName || "untitled",
|
|
33421
|
-
handle: hit.productId,
|
|
33422
|
-
image: {
|
|
33423
|
-
src: hit.image?.link || "https://unpkg.com/css.gg@2.0.0/icons/svg/toolbox.svg"
|
|
33424
|
-
}
|
|
33425
|
-
})) || [];
|
|
33881
|
+
return await api.search(search || "womens");
|
|
33426
33882
|
},
|
|
33427
33883
|
getRequestObject(id) {
|
|
33428
33884
|
return {
|
|
@@ -33438,12 +33894,10 @@ System.register(['@builder.io/react', '@emotion/core', '@material-ui/core', 'rea
|
|
|
33438
33894
|
},
|
|
33439
33895
|
category: {
|
|
33440
33896
|
async findById(id) {
|
|
33441
|
-
|
|
33442
|
-
return transformCat(cat);
|
|
33897
|
+
return await api.getCategory(id);
|
|
33443
33898
|
},
|
|
33444
33899
|
async search(search) {
|
|
33445
|
-
|
|
33446
|
-
return categories.map(transformCat);
|
|
33900
|
+
return await api.searchCategories(search || "");
|
|
33447
33901
|
},
|
|
33448
33902
|
getRequestObject(id) {
|
|
33449
33903
|
return {
|
|
@@ -33456,9 +33910,9 @@ System.register(['@builder.io/react', '@emotion/core', '@material-ui/core', 'rea
|
|
|
33456
33910
|
}
|
|
33457
33911
|
};
|
|
33458
33912
|
}
|
|
33459
|
-
}
|
|
33913
|
+
},
|
|
33914
|
+
...recommendersType
|
|
33460
33915
|
};
|
|
33461
|
-
return service;
|
|
33462
33916
|
});
|
|
33463
33917
|
|
|
33464
33918
|
}
|