ng-miam 6.4.10 → 6.4.12

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.
@@ -1514,6 +1514,111 @@
1514
1514
  }], function () { return []; }, null);
1515
1515
  })();
1516
1516
 
1517
+ var Ingredient = /** @class */ (function (_super) {
1518
+ __extends(Ingredient, _super);
1519
+ function Ingredient() {
1520
+ var _this = _super.apply(this, __spread(arguments)) || this;
1521
+ _this.attributes = {
1522
+ name: '',
1523
+ quantity: '',
1524
+ unit: '',
1525
+ importance: '',
1526
+ active: true,
1527
+ 'forced-eans': [],
1528
+ 'picture-url': '',
1529
+ position: -1
1530
+ };
1531
+ _this.relationships = {
1532
+ recipe: new i1.DocumentResource(),
1533
+ 'quantity-unit': new i1.DocumentResource()
1534
+ };
1535
+ return _this;
1536
+ }
1537
+ Object.defineProperty(Ingredient.prototype, "quantity", {
1538
+ get: function () {
1539
+ if (this.attributes.quantity) {
1540
+ // /!\ toLocalString can transphorm an dot into a coma
1541
+ return parseFloat(this.attributes.quantity).toString();
1542
+ }
1543
+ else {
1544
+ return '1';
1545
+ }
1546
+ },
1547
+ enumerable: false,
1548
+ configurable: true
1549
+ });
1550
+ Object.defineProperty(Ingredient.prototype, "picture", {
1551
+ get: function () {
1552
+ return this.attributes['picture-url'];
1553
+ },
1554
+ enumerable: false,
1555
+ configurable: true
1556
+ });
1557
+ return Ingredient;
1558
+ }(i1.Resource));
1559
+
1560
+ var Package = /** @class */ (function (_super) {
1561
+ __extends(Package, _super);
1562
+ function Package() {
1563
+ var _this = _super.apply(this, __spread(arguments)) || this;
1564
+ _this.attributes = {
1565
+ title: '',
1566
+ 'author-id': '',
1567
+ // system: '',
1568
+ editable: false,
1569
+ shared: false,
1570
+ 'catalog-category': false,
1571
+ 'catalog-position': '',
1572
+ 'recipes-count': '',
1573
+ 'media-url': '',
1574
+ settings: {}
1575
+ };
1576
+ _this.relationships = {
1577
+ provider: new i1.DocumentResource(),
1578
+ status: new i1.DocumentResource(),
1579
+ recipes: new i1.DocumentCollection(),
1580
+ 'shared-suppliers': new i1.DocumentCollection()
1581
+ };
1582
+ return _this;
1583
+ }
1584
+ Object.defineProperty(Package.prototype, "title", {
1585
+ get: function () {
1586
+ return this.attributes.title;
1587
+ },
1588
+ enumerable: false,
1589
+ configurable: true
1590
+ });
1591
+ Object.defineProperty(Package.prototype, "status", {
1592
+ get: function () {
1593
+ return this.relationships && this.relationships.status && this.relationships.status.data;
1594
+ },
1595
+ enumerable: false,
1596
+ configurable: true
1597
+ });
1598
+ Object.defineProperty(Package.prototype, "subtitle", {
1599
+ get: function () {
1600
+ // tslint:disable-next-line: no-string-literal
1601
+ return this.attributes.settings.subtitle;
1602
+ },
1603
+ enumerable: false,
1604
+ configurable: true
1605
+ });
1606
+ return Package;
1607
+ }(i1.Resource));
1608
+
1609
+ var QuantityUnit = /** @class */ (function (_super) {
1610
+ __extends(QuantityUnit, _super);
1611
+ function QuantityUnit() {
1612
+ var _this = _super.apply(this, __spread(arguments)) || this;
1613
+ _this.attributes = {
1614
+ name: '',
1615
+ plural: ''
1616
+ };
1617
+ return _this;
1618
+ }
1619
+ return QuantityUnit;
1620
+ }(i1.Resource));
1621
+
1517
1622
  var Recipe = /** @class */ (function (_super) {
1518
1623
  __extends(Recipe, _super);
1519
1624
  function Recipe() {
@@ -1802,14 +1907,6 @@
1802
1907
  return Recipe;
1803
1908
  }(i1.Resource));
1804
1909
 
1805
- var RecipePricing = /** @class */ (function () {
1806
- function RecipePricing(attrs) {
1807
- if (attrs === void 0) { attrs = {}; }
1808
- Object.assign(this, attrs);
1809
- }
1810
- return RecipePricing;
1811
- }());
1812
-
1813
1910
  var RecipeProvider = /** @class */ (function (_super) {
1814
1911
  __extends(RecipeProvider, _super);
1815
1912
  function RecipeProvider() {
@@ -1824,370 +1921,86 @@
1824
1921
  return _this;
1825
1922
  }
1826
1923
  return RecipeProvider;
1827
- }(i1.Resource));
1828
-
1829
- var RecipeProviderService = /** @class */ (function (_super) {
1830
- __extends(RecipeProviderService, _super);
1831
- function RecipeProviderService() {
1832
- var _this = _super.call(this) || this;
1833
- _this.resource = RecipeProvider;
1834
- _this.type = 'recipe-providers';
1835
- _this.register();
1836
- return _this;
1837
- }
1838
- RecipeProviderService.prototype.init = function (id) {
1839
- this.register();
1840
- return this.loadCachedProvider(id).toPromise();
1841
- };
1842
- RecipeProviderService.prototype.getCached = function () {
1843
- return this.provider;
1844
- };
1845
- RecipeProviderService.prototype.loadCachedProvider = function (id) {
1846
- var _this = this;
1847
- return rxjs.of(id).pipe(operators.switchMap(function () { return _this.get(id); }), operators.tap(function (status) { return _this.provider = status; }));
1848
- };
1849
- return RecipeProviderService;
1850
- }(i1.Service));
1851
- RecipeProviderService.ɵfac = function RecipeProviderService_Factory(t) { return new (t || RecipeProviderService)(); };
1852
- RecipeProviderService.ɵprov = i0.ɵɵdefineInjectable({ token: RecipeProviderService, factory: RecipeProviderService.ɵfac, providedIn: 'root' });
1853
- /*@__PURE__*/ (function () {
1854
- i0.ɵsetClassMetadata(RecipeProviderService, [{
1855
- type: i0.Injectable,
1856
- args: [{
1857
- providedIn: 'root'
1858
- }]
1859
- }], function () { return []; }, null);
1860
- })();
1861
-
1862
- var RecipeStatus = /** @class */ (function (_super) {
1863
- __extends(RecipeStatus, _super);
1864
- function RecipeStatus() {
1865
- var _this = _super.apply(this, __spread(arguments)) || this;
1866
- _this.attributes = {
1867
- name: '',
1868
- label: ''
1869
- };
1870
- return _this;
1871
- }
1872
- Object.defineProperty(RecipeStatus.prototype, "hidden", {
1873
- get: function () {
1874
- return this.name === 'DELETED';
1875
- },
1876
- enumerable: false,
1877
- configurable: true
1878
- });
1879
- Object.defineProperty(RecipeStatus.prototype, "name", {
1880
- get: function () {
1881
- return this.attributes.name;
1882
- },
1883
- enumerable: false,
1884
- configurable: true
1885
- });
1886
- Object.defineProperty(RecipeStatus.prototype, "label", {
1887
- get: function () {
1888
- return this.attributes.label;
1889
- },
1890
- enumerable: false,
1891
- configurable: true
1892
- });
1893
- Object.defineProperty(RecipeStatus.prototype, "icon", {
1894
- get: function () {
1895
- switch (this.attributes.name) {
1896
- case 'DRAFT': {
1897
- return 'text_snippet';
1898
- }
1899
- case 'SUBMITTED': {
1900
- return 'schedule';
1901
- }
1902
- case 'ACTIVE': {
1903
- return 'done';
1904
- }
1905
- case 'INACTIVE': {
1906
- return 'highlight_off';
1907
- }
1908
- default: {
1909
- return 'highlight_off';
1910
- }
1911
- }
1912
- },
1913
- enumerable: false,
1914
- configurable: true
1915
- });
1916
- Object.defineProperty(RecipeStatus.prototype, "color", {
1917
- get: function () {
1918
- switch (this.attributes.name) {
1919
- case 'DRAFT': {
1920
- return null;
1921
- }
1922
- case 'SUBMITTED': {
1923
- return 'accent';
1924
- }
1925
- case 'ACTIVE': {
1926
- return 'primary';
1927
- }
1928
- case 'INACTIVE': {
1929
- return null;
1930
- }
1931
- default: {
1932
- return null;
1933
- }
1934
- }
1935
- },
1936
- enumerable: false,
1937
- configurable: true
1938
- });
1939
- return RecipeStatus;
1940
- }(i1.Resource));
1941
-
1942
- var RecipeStatusService = /** @class */ (function (_super) {
1943
- __extends(RecipeStatusService, _super);
1944
- function RecipeStatusService() {
1945
- var _this = _super.call(this) || this;
1946
- _this.resource = RecipeStatus;
1947
- _this.type = 'recipe-statuses';
1948
- _this.validated$ = new rxjs.BehaviorSubject(null);
1949
- _this.draft$ = new rxjs.BehaviorSubject(null);
1950
- _this.deleted$ = new rxjs.BehaviorSubject(null);
1951
- _this.inactive$ = new rxjs.BehaviorSubject(null);
1952
- _this.register();
1953
- return _this;
1954
- }
1955
- Object.defineProperty(RecipeStatusService.prototype, "validated", {
1956
- get: function () {
1957
- return this.validated$.asObservable().pipe(operators.skipWhile(function (res) { return res == null; }));
1958
- },
1959
- enumerable: false,
1960
- configurable: true
1961
- });
1962
- Object.defineProperty(RecipeStatusService.prototype, "draft", {
1963
- get: function () {
1964
- return this.draft$.asObservable().pipe(operators.skipWhile(function (res) { return res == null; }));
1965
- },
1966
- enumerable: false,
1967
- configurable: true
1968
- });
1969
- Object.defineProperty(RecipeStatusService.prototype, "deleted", {
1970
- get: function () {
1971
- return this.deleted$.asObservable().pipe(operators.skipWhile(function (res) { return res == null; }));
1972
- },
1973
- enumerable: false,
1974
- configurable: true
1975
- });
1976
- Object.defineProperty(RecipeStatusService.prototype, "inactive", {
1977
- get: function () {
1978
- return this.inactive$.asObservable().pipe(operators.skipWhile(function (res) { return res == null; }));
1979
- },
1980
- enumerable: false,
1981
- configurable: true
1982
- });
1983
- Object.defineProperty(RecipeStatusService.prototype, "validatedValue", {
1984
- /** Only if you are sure value has been loaded */
1985
- get: function () {
1986
- return this.validated$.getValue();
1987
- },
1988
- enumerable: false,
1989
- configurable: true
1990
- });
1991
- Object.defineProperty(RecipeStatusService.prototype, "draftValue", {
1992
- /** Only if you are sure value has been loaded */
1993
- get: function () {
1994
- return this.draft$.getValue();
1995
- },
1996
- enumerable: false,
1997
- configurable: true
1998
- });
1999
- Object.defineProperty(RecipeStatusService.prototype, "deletedValue", {
2000
- /** Only if you are sure value has been loaded */
2001
- get: function () {
2002
- return this.deleted$.getValue();
2003
- },
2004
- enumerable: false,
2005
- configurable: true
2006
- });
2007
- Object.defineProperty(RecipeStatusService.prototype, "inactiveValue", {
2008
- /** Only if you are sure value has been loaded */
2009
- get: function () {
2010
- return this.inactive$.getValue();
2011
- },
2012
- enumerable: false,
2013
- configurable: true
2014
- });
2015
- RecipeStatusService.prototype.fetchStatuses = function () {
2016
- var _this = this;
2017
- this.get('validated').pipe(operators.skipWhile(function (result) { return result.is_loading; })).subscribe(function (validated) { return _this.validated$.next(validated); });
2018
- this.get('draft').pipe(operators.skipWhile(function (result) { return result.is_loading; })).subscribe(function (draft) { return _this.draft$.next(draft); });
2019
- this.get('deleted').pipe(operators.skipWhile(function (result) { return result.is_loading; })).subscribe(function (deleted) { return _this.deleted$.next(deleted); });
2020
- this.get('inactive').pipe(operators.skipWhile(function (result) { return result.is_loading; })).subscribe(function (inactive) { return _this.inactive$.next(inactive); });
2021
- };
2022
- return RecipeStatusService;
2023
- }(i1.Service));
2024
- RecipeStatusService.ɵfac = function RecipeStatusService_Factory(t) { return new (t || RecipeStatusService)(); };
2025
- RecipeStatusService.ɵprov = i0.ɵɵdefineInjectable({ token: RecipeStatusService, factory: RecipeStatusService.ɵfac, providedIn: 'root' });
2026
- /*@__PURE__*/ (function () {
2027
- i0.ɵsetClassMetadata(RecipeStatusService, [{
2028
- type: i0.Injectable,
2029
- args: [{
2030
- providedIn: 'root'
2031
- }]
2032
- }], function () { return []; }, null);
2033
- })();
2034
-
2035
- var RecipeType = /** @class */ (function (_super) {
2036
- __extends(RecipeType, _super);
2037
- function RecipeType() {
2038
- var _this = _super.apply(this, __spread(arguments)) || this;
2039
- _this.attributes = {
2040
- name: ''
2041
- };
2042
- return _this;
2043
- }
2044
- Object.defineProperty(RecipeType.prototype, "name", {
2045
- get: function () {
2046
- return this.attributes.name;
2047
- },
2048
- enumerable: false,
2049
- configurable: true
2050
- });
2051
- return RecipeType;
2052
- }(i1.Resource));
2053
-
2054
- var RecipeTypeService = /** @class */ (function (_super) {
2055
- __extends(RecipeTypeService, _super);
2056
- function RecipeTypeService() {
2057
- var _this = _super.call(this) || this;
2058
- _this.resource = RecipeType;
2059
- _this.type = 'recipe-types';
2060
- _this.register();
2061
- _this.types = new rxjs.BehaviorSubject(null);
2062
- return _this;
2063
- }
2064
- RecipeTypeService.prototype.fetchTypes = function () {
2065
- var _this = this;
2066
- this.all().pipe(operators.tap(function (types) { return _this.types.next(types.data); })).toPromise();
2067
- };
2068
- RecipeTypeService.prototype.getTypes = function () {
2069
- return this.types.asObservable();
2070
- };
2071
- RecipeTypeService.prototype.getTypeByName = function (name) {
2072
- name = name.toLowerCase().trim();
2073
- return this.types.value.filter(function (t) { return t.attributes.name.toLowerCase().trim() === name; })[0];
2074
- };
2075
- return RecipeTypeService;
2076
- }(i1.Service));
2077
- RecipeTypeService.ɵfac = function RecipeTypeService_Factory(t) { return new (t || RecipeTypeService)(); };
2078
- RecipeTypeService.ɵprov = i0.ɵɵdefineInjectable({ token: RecipeTypeService, factory: RecipeTypeService.ɵfac, providedIn: 'root' });
2079
- /*@__PURE__*/ (function () {
2080
- i0.ɵsetClassMetadata(RecipeTypeService, [{
2081
- type: i0.Injectable,
2082
- args: [{
2083
- providedIn: 'root'
2084
- }]
2085
- }], function () { return []; }, null);
2086
- })();
1924
+ }(i1.Resource));
2087
1925
 
2088
- var Ingredient = /** @class */ (function (_super) {
2089
- __extends(Ingredient, _super);
2090
- function Ingredient() {
1926
+ var RecipeStatus = /** @class */ (function (_super) {
1927
+ __extends(RecipeStatus, _super);
1928
+ function RecipeStatus() {
2091
1929
  var _this = _super.apply(this, __spread(arguments)) || this;
2092
1930
  _this.attributes = {
2093
1931
  name: '',
2094
- quantity: '',
2095
- unit: '',
2096
- importance: '',
2097
- active: true,
2098
- 'forced-eans': [],
2099
- 'picture-url': '',
2100
- position: -1
2101
- };
2102
- _this.relationships = {
2103
- recipe: new i1.DocumentResource(),
2104
- 'quantity-unit': new i1.DocumentResource()
1932
+ label: ''
2105
1933
  };
2106
1934
  return _this;
2107
1935
  }
2108
- Object.defineProperty(Ingredient.prototype, "quantity", {
1936
+ Object.defineProperty(RecipeStatus.prototype, "hidden", {
2109
1937
  get: function () {
2110
- if (this.attributes.quantity) {
2111
- // /!\ toLocalString can transphorm an dot into a coma
2112
- return parseFloat(this.attributes.quantity).toString();
2113
- }
2114
- else {
2115
- return '1';
2116
- }
1938
+ return this.name === 'DELETED';
2117
1939
  },
2118
1940
  enumerable: false,
2119
1941
  configurable: true
2120
1942
  });
2121
- Object.defineProperty(Ingredient.prototype, "picture", {
1943
+ Object.defineProperty(RecipeStatus.prototype, "name", {
2122
1944
  get: function () {
2123
- return this.attributes['picture-url'];
1945
+ return this.attributes.name;
2124
1946
  },
2125
1947
  enumerable: false,
2126
1948
  configurable: true
2127
1949
  });
2128
- return Ingredient;
2129
- }(i1.Resource));
2130
-
2131
- var Package = /** @class */ (function (_super) {
2132
- __extends(Package, _super);
2133
- function Package() {
2134
- var _this = _super.apply(this, __spread(arguments)) || this;
2135
- _this.attributes = {
2136
- title: '',
2137
- 'author-id': '',
2138
- // system: '',
2139
- editable: false,
2140
- shared: false,
2141
- 'catalog-category': false,
2142
- 'catalog-position': '',
2143
- 'recipes-count': '',
2144
- 'media-url': '',
2145
- settings: {}
2146
- };
2147
- _this.relationships = {
2148
- provider: new i1.DocumentResource(),
2149
- status: new i1.DocumentResource(),
2150
- recipes: new i1.DocumentCollection(),
2151
- 'shared-suppliers': new i1.DocumentCollection()
2152
- };
2153
- return _this;
2154
- }
2155
- Object.defineProperty(Package.prototype, "title", {
1950
+ Object.defineProperty(RecipeStatus.prototype, "label", {
2156
1951
  get: function () {
2157
- return this.attributes.title;
1952
+ return this.attributes.label;
2158
1953
  },
2159
1954
  enumerable: false,
2160
1955
  configurable: true
2161
1956
  });
2162
- Object.defineProperty(Package.prototype, "status", {
1957
+ Object.defineProperty(RecipeStatus.prototype, "icon", {
2163
1958
  get: function () {
2164
- return this.relationships && this.relationships.status && this.relationships.status.data;
1959
+ switch (this.attributes.name) {
1960
+ case 'DRAFT': {
1961
+ return 'text_snippet';
1962
+ }
1963
+ case 'SUBMITTED': {
1964
+ return 'schedule';
1965
+ }
1966
+ case 'ACTIVE': {
1967
+ return 'done';
1968
+ }
1969
+ case 'INACTIVE': {
1970
+ return 'highlight_off';
1971
+ }
1972
+ default: {
1973
+ return 'highlight_off';
1974
+ }
1975
+ }
2165
1976
  },
2166
1977
  enumerable: false,
2167
1978
  configurable: true
2168
1979
  });
2169
- Object.defineProperty(Package.prototype, "subtitle", {
1980
+ Object.defineProperty(RecipeStatus.prototype, "color", {
2170
1981
  get: function () {
2171
- // tslint:disable-next-line: no-string-literal
2172
- return this.attributes.settings.subtitle;
1982
+ switch (this.attributes.name) {
1983
+ case 'DRAFT': {
1984
+ return null;
1985
+ }
1986
+ case 'SUBMITTED': {
1987
+ return 'accent';
1988
+ }
1989
+ case 'ACTIVE': {
1990
+ return 'primary';
1991
+ }
1992
+ case 'INACTIVE': {
1993
+ return null;
1994
+ }
1995
+ default: {
1996
+ return null;
1997
+ }
1998
+ }
2173
1999
  },
2174
2000
  enumerable: false,
2175
2001
  configurable: true
2176
2002
  });
2177
- return Package;
2178
- }(i1.Resource));
2179
-
2180
- var QuantityUnit = /** @class */ (function (_super) {
2181
- __extends(QuantityUnit, _super);
2182
- function QuantityUnit() {
2183
- var _this = _super.apply(this, __spread(arguments)) || this;
2184
- _this.attributes = {
2185
- name: '',
2186
- plural: ''
2187
- };
2188
- return _this;
2189
- }
2190
- return QuantityUnit;
2003
+ return RecipeStatus;
2191
2004
  }(i1.Resource));
2192
2005
 
2193
2006
  var RecipeStep = /** @class */ (function (_super) {
@@ -2237,6 +2050,25 @@
2237
2050
  return Tag;
2238
2051
  }(i1.Resource));
2239
2052
 
2053
+ var RecipeType = /** @class */ (function (_super) {
2054
+ __extends(RecipeType, _super);
2055
+ function RecipeType() {
2056
+ var _this = _super.apply(this, __spread(arguments)) || this;
2057
+ _this.attributes = {
2058
+ name: ''
2059
+ };
2060
+ return _this;
2061
+ }
2062
+ Object.defineProperty(RecipeType.prototype, "name", {
2063
+ get: function () {
2064
+ return this.attributes.name;
2065
+ },
2066
+ enumerable: false,
2067
+ configurable: true
2068
+ });
2069
+ return RecipeType;
2070
+ }(i1.Resource));
2071
+
2240
2072
  var BasketEntriesItem = /** @class */ (function () {
2241
2073
  function BasketEntriesItem(attrs) {
2242
2074
  if (attrs === void 0) { attrs = {}; }
@@ -2591,8 +2423,176 @@
2591
2423
  enumerable: false,
2592
2424
  configurable: true
2593
2425
  });
2594
- return SponsorBlockType;
2595
- }(i1.Resource));
2426
+ return SponsorBlockType;
2427
+ }(i1.Resource));
2428
+
2429
+ var RecipePricing = /** @class */ (function () {
2430
+ function RecipePricing(attrs) {
2431
+ if (attrs === void 0) { attrs = {}; }
2432
+ Object.assign(this, attrs);
2433
+ }
2434
+ return RecipePricing;
2435
+ }());
2436
+
2437
+ var RecipeProviderService = /** @class */ (function (_super) {
2438
+ __extends(RecipeProviderService, _super);
2439
+ function RecipeProviderService() {
2440
+ var _this = _super.call(this) || this;
2441
+ _this.resource = RecipeProvider;
2442
+ _this.type = 'recipe-providers';
2443
+ _this.register();
2444
+ return _this;
2445
+ }
2446
+ RecipeProviderService.prototype.init = function (id) {
2447
+ this.register();
2448
+ return this.loadCachedProvider(id).toPromise();
2449
+ };
2450
+ RecipeProviderService.prototype.getCached = function () {
2451
+ return this.provider;
2452
+ };
2453
+ RecipeProviderService.prototype.loadCachedProvider = function (id) {
2454
+ var _this = this;
2455
+ return rxjs.of(id).pipe(operators.switchMap(function () { return _this.get(id); }), operators.tap(function (status) { return _this.provider = status; }));
2456
+ };
2457
+ return RecipeProviderService;
2458
+ }(i1.Service));
2459
+ RecipeProviderService.ɵfac = function RecipeProviderService_Factory(t) { return new (t || RecipeProviderService)(); };
2460
+ RecipeProviderService.ɵprov = i0.ɵɵdefineInjectable({ token: RecipeProviderService, factory: RecipeProviderService.ɵfac, providedIn: 'root' });
2461
+ /*@__PURE__*/ (function () {
2462
+ i0.ɵsetClassMetadata(RecipeProviderService, [{
2463
+ type: i0.Injectable,
2464
+ args: [{
2465
+ providedIn: 'root'
2466
+ }]
2467
+ }], function () { return []; }, null);
2468
+ })();
2469
+
2470
+ var RecipeStatusService = /** @class */ (function (_super) {
2471
+ __extends(RecipeStatusService, _super);
2472
+ function RecipeStatusService() {
2473
+ var _this = _super.call(this) || this;
2474
+ _this.resource = RecipeStatus;
2475
+ _this.type = 'recipe-statuses';
2476
+ _this.validated$ = new rxjs.BehaviorSubject(null);
2477
+ _this.draft$ = new rxjs.BehaviorSubject(null);
2478
+ _this.deleted$ = new rxjs.BehaviorSubject(null);
2479
+ _this.inactive$ = new rxjs.BehaviorSubject(null);
2480
+ _this.register();
2481
+ return _this;
2482
+ }
2483
+ Object.defineProperty(RecipeStatusService.prototype, "validated", {
2484
+ get: function () {
2485
+ return this.validated$.asObservable().pipe(operators.skipWhile(function (res) { return res == null; }));
2486
+ },
2487
+ enumerable: false,
2488
+ configurable: true
2489
+ });
2490
+ Object.defineProperty(RecipeStatusService.prototype, "draft", {
2491
+ get: function () {
2492
+ return this.draft$.asObservable().pipe(operators.skipWhile(function (res) { return res == null; }));
2493
+ },
2494
+ enumerable: false,
2495
+ configurable: true
2496
+ });
2497
+ Object.defineProperty(RecipeStatusService.prototype, "deleted", {
2498
+ get: function () {
2499
+ return this.deleted$.asObservable().pipe(operators.skipWhile(function (res) { return res == null; }));
2500
+ },
2501
+ enumerable: false,
2502
+ configurable: true
2503
+ });
2504
+ Object.defineProperty(RecipeStatusService.prototype, "inactive", {
2505
+ get: function () {
2506
+ return this.inactive$.asObservable().pipe(operators.skipWhile(function (res) { return res == null; }));
2507
+ },
2508
+ enumerable: false,
2509
+ configurable: true
2510
+ });
2511
+ Object.defineProperty(RecipeStatusService.prototype, "validatedValue", {
2512
+ /** Only if you are sure value has been loaded */
2513
+ get: function () {
2514
+ return this.validated$.getValue();
2515
+ },
2516
+ enumerable: false,
2517
+ configurable: true
2518
+ });
2519
+ Object.defineProperty(RecipeStatusService.prototype, "draftValue", {
2520
+ /** Only if you are sure value has been loaded */
2521
+ get: function () {
2522
+ return this.draft$.getValue();
2523
+ },
2524
+ enumerable: false,
2525
+ configurable: true
2526
+ });
2527
+ Object.defineProperty(RecipeStatusService.prototype, "deletedValue", {
2528
+ /** Only if you are sure value has been loaded */
2529
+ get: function () {
2530
+ return this.deleted$.getValue();
2531
+ },
2532
+ enumerable: false,
2533
+ configurable: true
2534
+ });
2535
+ Object.defineProperty(RecipeStatusService.prototype, "inactiveValue", {
2536
+ /** Only if you are sure value has been loaded */
2537
+ get: function () {
2538
+ return this.inactive$.getValue();
2539
+ },
2540
+ enumerable: false,
2541
+ configurable: true
2542
+ });
2543
+ RecipeStatusService.prototype.fetchStatuses = function () {
2544
+ var _this = this;
2545
+ this.get('validated').pipe(operators.skipWhile(function (result) { return result.is_loading; })).subscribe(function (validated) { return _this.validated$.next(validated); });
2546
+ this.get('draft').pipe(operators.skipWhile(function (result) { return result.is_loading; })).subscribe(function (draft) { return _this.draft$.next(draft); });
2547
+ this.get('deleted').pipe(operators.skipWhile(function (result) { return result.is_loading; })).subscribe(function (deleted) { return _this.deleted$.next(deleted); });
2548
+ this.get('inactive').pipe(operators.skipWhile(function (result) { return result.is_loading; })).subscribe(function (inactive) { return _this.inactive$.next(inactive); });
2549
+ };
2550
+ return RecipeStatusService;
2551
+ }(i1.Service));
2552
+ RecipeStatusService.ɵfac = function RecipeStatusService_Factory(t) { return new (t || RecipeStatusService)(); };
2553
+ RecipeStatusService.ɵprov = i0.ɵɵdefineInjectable({ token: RecipeStatusService, factory: RecipeStatusService.ɵfac, providedIn: 'root' });
2554
+ /*@__PURE__*/ (function () {
2555
+ i0.ɵsetClassMetadata(RecipeStatusService, [{
2556
+ type: i0.Injectable,
2557
+ args: [{
2558
+ providedIn: 'root'
2559
+ }]
2560
+ }], function () { return []; }, null);
2561
+ })();
2562
+
2563
+ var RecipeTypeService = /** @class */ (function (_super) {
2564
+ __extends(RecipeTypeService, _super);
2565
+ function RecipeTypeService() {
2566
+ var _this = _super.call(this) || this;
2567
+ _this.resource = RecipeType;
2568
+ _this.type = 'recipe-types';
2569
+ _this.register();
2570
+ _this.types = new rxjs.BehaviorSubject(null);
2571
+ return _this;
2572
+ }
2573
+ RecipeTypeService.prototype.fetchTypes = function () {
2574
+ var _this = this;
2575
+ this.all().pipe(operators.tap(function (types) { return _this.types.next(types.data); })).toPromise();
2576
+ };
2577
+ RecipeTypeService.prototype.getTypes = function () {
2578
+ return this.types.asObservable();
2579
+ };
2580
+ RecipeTypeService.prototype.getTypeByName = function (name) {
2581
+ name = name.toLowerCase().trim();
2582
+ return this.types.value.filter(function (t) { return t.attributes.name.toLowerCase().trim() === name; })[0];
2583
+ };
2584
+ return RecipeTypeService;
2585
+ }(i1.Service));
2586
+ RecipeTypeService.ɵfac = function RecipeTypeService_Factory(t) { return new (t || RecipeTypeService)(); };
2587
+ RecipeTypeService.ɵprov = i0.ɵɵdefineInjectable({ token: RecipeTypeService, factory: RecipeTypeService.ɵfac, providedIn: 'root' });
2588
+ /*@__PURE__*/ (function () {
2589
+ i0.ɵsetClassMetadata(RecipeTypeService, [{
2590
+ type: i0.Injectable,
2591
+ args: [{
2592
+ providedIn: 'root'
2593
+ }]
2594
+ }], function () { return []; }, null);
2595
+ })();
2596
2596
 
2597
2597
  var MessageType;
2598
2598
  (function (MessageType) {
@@ -3360,6 +3360,17 @@
3360
3360
  })); }));
3361
3361
  }));
3362
3362
  };
3363
+ /**
3364
+ * Adds mandatory data (guest, pos id) completion to the given filters.
3365
+ */
3366
+ RecipesService.prototype.addMandatoryCompletionToFilter = function (filters) {
3367
+ return this.posService.pos$.pipe(operators.take(1), operators.map(function (pos) {
3368
+ var _a;
3369
+ // number of guests and point of sale id are mandatory in order to use primary_completion_perc filter
3370
+ filters.additionalFilters = Object.assign(Object.assign({}, filters.additionalFilters), { filters: Object.assign(Object.assign({ guests: '4', point_of_sale_id: pos.id }, (_a = filters.additionalFilters) === null || _a === void 0 ? void 0 : _a.filters), { primary_completion_perc: '100,100' }) });
3371
+ return filters;
3372
+ }));
3373
+ };
3363
3374
  // Returns list of filtered recipes.
3364
3375
  // Filters and page parameters are mandatory.
3365
3376
  // Number of guests and randomization are optional parameters
@@ -12194,7 +12205,7 @@
12194
12205
  request = request.clone({
12195
12206
  setHeaders: {
12196
12207
  'miam-origin': context.origin.value,
12197
- 'miam-front-version': '6.4.10',
12208
+ 'miam-front-version': '6.4.12',
12198
12209
  'miam-front-type': 'web',
12199
12210
  'miam-api-version': '4.7.0'
12200
12211
  }
@@ -17342,7 +17353,7 @@
17342
17353
  i0.ɵɵadvance(4);
17343
17354
  i0.ɵɵproperty("ngIf", ctx_r0.recipe && ctx_r0.displayPricing);
17344
17355
  i0.ɵɵadvance(1);
17345
- i0.ɵɵproperty("recipe", ctx_r0.recipe)("cardType", ctx_r0.cardType)("previewAllowed", ctx_r0.previewAllowed)("displayGuests", ctx_r0.displayGuests)("helpButtonAllowed", ctx_r0.helpButtonAllowed);
17356
+ i0.ɵɵproperty("recipe", ctx_r0.recipe)("cardType", ctx_r0.cardType)("previewAllowed", ctx_r0.previewAllowed)("displayGuests", ctx_r0.displayGuests)("helpButtonAllowed", ctx_r0.helpButtonAllowed)("originTrace", ctx_r0.eventTrace());
17346
17357
  }
17347
17358
  }
17348
17359
  function RecipeCardComponent_ng_template_1_Template(rf, ctx) {
@@ -17485,10 +17496,10 @@
17485
17496
  else {
17486
17497
  i18n_6 = $localize(templateObject_4$b || (templateObject_4$b = __makeTemplateObject([":\u241F96cca7cb17582a9b01053a242ca907b721fad7fe\u241F3684169623116339825:Chef d\u00E9butant"], [":\u241F96cca7cb17582a9b01053a242ca907b721fad7fe\u241F3684169623116339825:Chef d\u00E9butant"])));
17487
17498
  }
17488
- return [["class", "miam-recipe-card", 4, "ngIf"], ["cors", ""], [1, "miam-recipe-card"], [1, "miam-recipe-card__bookmark"], ["src", "https://storage.googleapis.com/assets.miam.tech/generic/recipe-card/Bookmark.svg", "alt", "Id\u00E9es repas"], ["class", "miam-recipe-card__picture", 3, "click", 4, "ngIf", "ngIfElse"], ["pictSkeleton", ""], [1, "miam-recipe-card__attributes"], [4, "ngIf", "ngIfElse"], ["textSkeleton", ""], [1, "miam-recipe-card__attributes__infos"], ["class", "miam-recipe-card__attributes__info recipe__total__time", 4, "ngIf", "ngIfElse"], ["class", "miam-recipe-card__attributes__info recipe__difficulty", 3, "ngClass", 4, "ngIf", "ngIfElse"], ["skeletonInfo", ""], [1, "miam-recipe-card__attributes__control"], [1, "miam-recipe-card__control__left__col"], [1, "miam-recipe-card__left__col__custom"], [1, "miam-recipe-card__help", 3, "click"], ["primaryColor", "var(--m-color-grey02)", "secondaryColor", "var(--m-color-grey07)", 3, "width", "height", "iconName"], ["class", "miam-recipe-card__ingredients__pictures", 4, "ngIf"], ["class", "miam-recipe-card__left__col__counter", 4, "ngIf", "ngIfElse"], ["skeletoncounter", ""], [1, "miam-recipe-card__control__right__col"], ["class", "miam-recipe-card__right__col__price", 4, "ngIf"], [3, "recipe", "cardType", "previewAllowed", "displayGuests", "helpButtonAllowed", "displayed", "clicked"], [1, "miam-recipe-card__picture", 3, "click"], ["loading", "lazy", 3, "src"], ["class", "miam-recipe-card__picture__video", 4, "ngIf"], [1, "miam-recipe-card__picture__actions"], ["class", "miam-recipe-card__actions__icon", 3, "recipe", "originTrace", 4, "ngIf"], ["class", "miam-recipe-card__picture__sponsor", 4, "ngIf"], ["class", "miam-recipe-card__picture__filigrane", 4, "ngIf"], [1, "miam-recipe-card__picture__video"], ["primaryColor", "black", 3, "iconName", "width", "height"], [1, "miam-recipe-card__actions__icon", 3, "recipe", "originTrace"], [1, "miam-recipe-card__picture__sponsor"], [3, "src"], [1, "miam-recipe-card__picture__filigrane"], [3, "type"], [1, "miam-recipe-card__attributes__title", 3, "click"], [1, "miam-recipe-card__attributes__info", "recipe__total__time"], [3, "width", "height", "iconName"], [1, "miam-recipe-card__info__label"], [1, "miam-recipe-card__attributes__info", "recipe__difficulty", 3, "ngClass"], [3, "ngSwitch"], [4, "ngSwitchCase"], [4, "ngSwitchDefault"], ["primaryColor", "var(--m-color-black)", 3, "width", "height", "iconName"], ["class", "miam-recipe-card__info__label easy", 4, "ngIf", "ngIfElse"], ["difficultyEasyDefault", ""], [1, "miam-recipe-card__info__label", "easy"], i18n_0, ["class", "miam-recipe-card__info__label medium", 4, "ngIf", "ngIfElse"], ["difficultyMediumDefault", ""], [1, "miam-recipe-card__info__label", "medium"], i18n_2, ["class", "miam-recipe-card__info__label hard", 4, "ngIf", "ngIfElse"], ["difficultyHardDefault", ""], [1, "miam-recipe-card__info__label", "hard"], i18n_4, ["difficultyDefault", ""], i18n_6, [1, "miam-recipe-card__ingredients__pictures"], [1, "miam-recipe-card__ingredients__picture"], ["class", "miam-recipe-card__ingredients__more", 4, "ngIf"], [1, "miam-recipe-card__ingredients__more"], [1, "miam-recipe-card__left__col__counter"], [3, "counter", "counterChange"], [1, "miam-recipe-card__right__col__price"], [3, "recipe", "serves"]];
17499
+ return [["class", "miam-recipe-card", 4, "ngIf"], ["cors", ""], [1, "miam-recipe-card"], [1, "miam-recipe-card__bookmark"], ["src", "https://storage.googleapis.com/assets.miam.tech/generic/recipe-card/Bookmark.svg", "alt", "Id\u00E9es repas"], ["class", "miam-recipe-card__picture", 3, "click", 4, "ngIf", "ngIfElse"], ["pictSkeleton", ""], [1, "miam-recipe-card__attributes"], [4, "ngIf", "ngIfElse"], ["textSkeleton", ""], [1, "miam-recipe-card__attributes__infos"], ["class", "miam-recipe-card__attributes__info recipe__total__time", 4, "ngIf", "ngIfElse"], ["class", "miam-recipe-card__attributes__info recipe__difficulty", 3, "ngClass", 4, "ngIf", "ngIfElse"], ["skeletonInfo", ""], [1, "miam-recipe-card__attributes__control"], [1, "miam-recipe-card__control__left__col"], [1, "miam-recipe-card__left__col__custom"], [1, "miam-recipe-card__help", 3, "click"], ["primaryColor", "var(--m-color-grey02)", "secondaryColor", "var(--m-color-grey07)", 3, "width", "height", "iconName"], ["class", "miam-recipe-card__ingredients__pictures", 4, "ngIf"], ["class", "miam-recipe-card__left__col__counter", 4, "ngIf", "ngIfElse"], ["skeletoncounter", ""], [1, "miam-recipe-card__control__right__col"], ["class", "miam-recipe-card__right__col__price", 4, "ngIf"], [3, "recipe", "cardType", "previewAllowed", "displayGuests", "helpButtonAllowed", "originTrace", "displayed", "clicked"], [1, "miam-recipe-card__picture", 3, "click"], ["loading", "lazy", 3, "src"], ["class", "miam-recipe-card__picture__video", 4, "ngIf"], [1, "miam-recipe-card__picture__actions"], ["class", "miam-recipe-card__actions__icon", 3, "recipe", "originTrace", 4, "ngIf"], ["class", "miam-recipe-card__picture__sponsor", 4, "ngIf"], ["class", "miam-recipe-card__picture__filigrane", 4, "ngIf"], [1, "miam-recipe-card__picture__video"], ["primaryColor", "black", 3, "iconName", "width", "height"], [1, "miam-recipe-card__actions__icon", 3, "recipe", "originTrace"], [1, "miam-recipe-card__picture__sponsor"], [3, "src"], [1, "miam-recipe-card__picture__filigrane"], [3, "type"], [1, "miam-recipe-card__attributes__title", 3, "click"], [1, "miam-recipe-card__attributes__info", "recipe__total__time"], [3, "width", "height", "iconName"], [1, "miam-recipe-card__info__label"], [1, "miam-recipe-card__attributes__info", "recipe__difficulty", 3, "ngClass"], [3, "ngSwitch"], [4, "ngSwitchCase"], [4, "ngSwitchDefault"], ["primaryColor", "var(--m-color-black)", 3, "width", "height", "iconName"], ["class", "miam-recipe-card__info__label easy", 4, "ngIf", "ngIfElse"], ["difficultyEasyDefault", ""], [1, "miam-recipe-card__info__label", "easy"], i18n_0, ["class", "miam-recipe-card__info__label medium", 4, "ngIf", "ngIfElse"], ["difficultyMediumDefault", ""], [1, "miam-recipe-card__info__label", "medium"], i18n_2, ["class", "miam-recipe-card__info__label hard", 4, "ngIf", "ngIfElse"], ["difficultyHardDefault", ""], [1, "miam-recipe-card__info__label", "hard"], i18n_4, ["difficultyDefault", ""], i18n_6, [1, "miam-recipe-card__ingredients__pictures"], [1, "miam-recipe-card__ingredients__picture"], ["class", "miam-recipe-card__ingredients__more", 4, "ngIf"], [1, "miam-recipe-card__ingredients__more"], [1, "miam-recipe-card__left__col__counter"], [3, "counter", "counterChange"], [1, "miam-recipe-card__right__col__price"], [3, "recipe", "serves"]];
17489
17500
  }, template: function RecipeCardComponent_Template(rf, ctx) {
17490
17501
  if (rf & 1) {
17491
- i0.ɵɵtemplate(0, RecipeCardComponent_div_0_Template, 27, 20, "div", 0);
17502
+ i0.ɵɵtemplate(0, RecipeCardComponent_div_0_Template, 27, 21, "div", 0);
17492
17503
  i0.ɵɵtemplate(1, RecipeCardComponent_ng_template_1_Template, 1, 0, "ng-template", null, 1, i0.ɵɵtemplateRefExtractor);
17493
17504
  }
17494
17505
  if (rf & 2) {
@@ -17731,7 +17742,7 @@
17731
17742
  }
17732
17743
  if (rf & 2) {
17733
17744
  var ctx_r4 = i0.ɵɵnextContext();
17734
- i0.ɵɵproperty("recipe", ctx_r4.recipe)("cardType", ctx_r4.cardType)("previewAllowed", ctx_r4.previewAllowed)("helpButtonAllowed", ctx_r4.helpButtonAllowed)("displayGuests", ctx_r4.displayGuests);
17745
+ i0.ɵɵproperty("recipe", ctx_r4.recipe)("cardType", ctx_r4.cardType)("previewAllowed", ctx_r4.previewAllowed)("helpButtonAllowed", ctx_r4.helpButtonAllowed)("displayGuests", ctx_r4.displayGuests)("originTrace", ctx_r4.eventTrace());
17735
17746
  }
17736
17747
  }
17737
17748
  function CatalogRecipeCardComponent_div_11_Template(rf, ctx) {
@@ -18184,7 +18195,7 @@
18184
18195
  else {
18185
18196
  i18n_14 = $localize(templateObject_7$4 || (templateObject_7$4 = __makeTemplateObject([":\u241F96cca7cb17582a9b01053a242ca907b721fad7fe\u241F3684169623116339825:Chef d\u00E9butant"], [":\u241F96cca7cb17582a9b01053a242ca907b721fad7fe\u241F3684169623116339825:Chef d\u00E9butant"])));
18186
18197
  }
18187
- return [[1, "miam-catalog-recipe-card"], [1, "miam-catalog-recipe-card__header"], ["class", "miam-catalog-card__picture", 3, "click", 4, "ngIf", "ngIfElse"], ["pictSkeleton", ""], [1, "miam-catalog-card__attributes"], [1, "miam-catalog-recipe-card__attributes__control"], ["class", "miam-catalog-recipe-card__ingredients__pictures", 4, "ngIf"], [3, "recipe", "cardType", "previewAllowed", "helpButtonAllowed", "displayGuests", "displayed", "clicked", 4, "ngIf"], ["class", "miam-catalog-recipe-card__actions", 4, "ngIf"], ["class", "m-button-primary reverse", 3, "click", 4, "ngIf"], [1, "miam-catalog-card__attributes__infos"], [1, "miam-catalog-card__attributes__infos", "recipe__time-and-difficulty"], ["class", "miam-catalog-card__attributes__info recipe__total__time", 4, "ngIf", "ngIfElse"], ["class", "miam-catalog-card__attributes__info recipe__difficulty", 3, "ngClass", 4, "ngIf"], ["class", "miam-catalog-card__attributes__info recipe__price", 4, "ngIf"], ["skeletonInfo", ""], [3, "close", "actionTriggered", 4, "ngIf"], ["cors", ""], [1, "miam-catalog-card__picture", 3, "click"], [1, "miam-catalog-card__picture__gradient"], ["loading", "lazy", 1, "miam-catalog-card__picture__img", 3, "src"], ["class", "miam-catalog-card__picture__sponsor", 4, "ngIf"], ["class", "miam-catalog-card__picture__filigrane", 4, "ngIf"], ["class", "miam-catalog-recipe-card__picture__video", 4, "ngIf"], [4, "ngIf"], [4, "ngIf", "ngIfElse"], ["textSkeleton", ""], [1, "miam-catalog-recipe-card__picture__actions"], ["class", "miam-catalog-recipe-card__actions__icon m-button-primary reverse", 3, "click", 4, "ngIf", "ngIfElse"], ["like", ""], [1, "miam-catalog-card__picture__sponsor"], [3, "src"], [1, "miam-catalog-card__picture__filigrane"], [1, "miam-catalog-recipe-card__picture__video"], ["primaryColor", "black", 3, "iconName", "width", "height"], ["class", "miam-catalog-recipe-card__picture__tag", 4, "ngIf"], [1, "miam-catalog-recipe-card__picture__tag"], i18n_2, [1, "miam-catalog-recipe-card__attributes__title", 3, "click"], [3, "type"], [1, "miam-catalog-recipe-card__actions__icon", "m-button-primary", "reverse", 3, "click"], ["miamMoreActions", ""], ["primaryColor", "var(--m-color-primary)", 3, "iconName"], ["width", "17", "height", "17", "class", "miam-catalog-recipe-card__actions__icon", 3, "recipe", "originTrace", 4, "ngIf"], ["width", "17", "height", "17", 1, "miam-catalog-recipe-card__actions__icon", 3, "recipe", "originTrace"], [1, "miam-catalog-recipe-card__ingredients__pictures"], [1, "miam-catalog-recipe-card__ingredients__picture"], ["class", "miam-catalog-recipe-card__ingredients__more", 4, "ngIf"], [1, "miam-catalog-recipe-card__ingredients__more"], [3, "recipe", "cardType", "previewAllowed", "helpButtonAllowed", "displayGuests", "displayed", "clicked"], ["cardCta", ""], [1, "miam-catalog-recipe-card__actions"], [1, "miam-catalog-recipe-card__actions__link", "replace", 3, "click"], i18n_4, [1, "miam-catalog-recipe-card__actions__link", "delete", 3, "click"], [1, "m-button-primary", "reverse", 3, "click"], i18n_6, [1, "miam-catalog-card__attributes__info", "recipe__total__time"], ["width", "18", "height", "18", "primaryColor", "var(--m-catalog-card-details-color)", 3, "iconName"], [1, "miam-catalog-card__info__label"], [1, "miam-catalog-card__attributes__info", "recipe__difficulty", 3, "ngClass"], [3, "ngSwitch"], [4, "ngSwitchCase"], [4, "ngSwitchDefault"], ["primaryColor", "var(--m-catalog-card-details-color)", 3, "width", "height", "iconName"], ["class", "miam-catalog-card__info__label easy", 4, "ngIf", "ngIfElse"], ["difficultyEasyDefault", ""], [1, "miam-catalog-card__info__label", "easy"], i18n_8, ["class", "miam-catalog-card__info__label medium", 4, "ngIf", "ngIfElse"], ["difficultyMediumDefault", ""], [1, "miam-catalog-card__info__label", "medium"], i18n_10, ["class", "miam-catalog-card__info__label hard", 4, "ngIf", "ngIfElse"], ["difficultyHardDefault", ""], [1, "miam-catalog-card__info__label", "hard"], i18n_12, ["difficultyDefault", ""], i18n_14, [1, "miam-catalog-card__attributes__info", "recipe__price"], [3, "recipe", "serves", 4, "ngIf"], [3, "recipe", "serves"], [3, "close", "actionTriggered"]];
18198
+ return [[1, "miam-catalog-recipe-card"], [1, "miam-catalog-recipe-card__header"], ["class", "miam-catalog-card__picture", 3, "click", 4, "ngIf", "ngIfElse"], ["pictSkeleton", ""], [1, "miam-catalog-card__attributes"], [1, "miam-catalog-recipe-card__attributes__control"], ["class", "miam-catalog-recipe-card__ingredients__pictures", 4, "ngIf"], [3, "recipe", "cardType", "previewAllowed", "helpButtonAllowed", "displayGuests", "originTrace", "displayed", "clicked", 4, "ngIf"], ["class", "miam-catalog-recipe-card__actions", 4, "ngIf"], ["class", "m-button-primary reverse", 3, "click", 4, "ngIf"], [1, "miam-catalog-card__attributes__infos"], [1, "miam-catalog-card__attributes__infos", "recipe__time-and-difficulty"], ["class", "miam-catalog-card__attributes__info recipe__total__time", 4, "ngIf", "ngIfElse"], ["class", "miam-catalog-card__attributes__info recipe__difficulty", 3, "ngClass", 4, "ngIf"], ["class", "miam-catalog-card__attributes__info recipe__price", 4, "ngIf"], ["skeletonInfo", ""], [3, "close", "actionTriggered", 4, "ngIf"], ["cors", ""], [1, "miam-catalog-card__picture", 3, "click"], [1, "miam-catalog-card__picture__gradient"], ["loading", "lazy", 1, "miam-catalog-card__picture__img", 3, "src"], ["class", "miam-catalog-card__picture__sponsor", 4, "ngIf"], ["class", "miam-catalog-card__picture__filigrane", 4, "ngIf"], ["class", "miam-catalog-recipe-card__picture__video", 4, "ngIf"], [4, "ngIf"], [4, "ngIf", "ngIfElse"], ["textSkeleton", ""], [1, "miam-catalog-recipe-card__picture__actions"], ["class", "miam-catalog-recipe-card__actions__icon m-button-primary reverse", 3, "click", 4, "ngIf", "ngIfElse"], ["like", ""], [1, "miam-catalog-card__picture__sponsor"], [3, "src"], [1, "miam-catalog-card__picture__filigrane"], [1, "miam-catalog-recipe-card__picture__video"], ["primaryColor", "black", 3, "iconName", "width", "height"], ["class", "miam-catalog-recipe-card__picture__tag", 4, "ngIf"], [1, "miam-catalog-recipe-card__picture__tag"], i18n_2, [1, "miam-catalog-recipe-card__attributes__title", 3, "click"], [3, "type"], [1, "miam-catalog-recipe-card__actions__icon", "m-button-primary", "reverse", 3, "click"], ["miamMoreActions", ""], ["primaryColor", "var(--m-color-primary)", 3, "iconName"], ["width", "17", "height", "17", "class", "miam-catalog-recipe-card__actions__icon", 3, "recipe", "originTrace", 4, "ngIf"], ["width", "17", "height", "17", 1, "miam-catalog-recipe-card__actions__icon", 3, "recipe", "originTrace"], [1, "miam-catalog-recipe-card__ingredients__pictures"], [1, "miam-catalog-recipe-card__ingredients__picture"], ["class", "miam-catalog-recipe-card__ingredients__more", 4, "ngIf"], [1, "miam-catalog-recipe-card__ingredients__more"], [3, "recipe", "cardType", "previewAllowed", "helpButtonAllowed", "displayGuests", "originTrace", "displayed", "clicked"], ["cardCta", ""], [1, "miam-catalog-recipe-card__actions"], [1, "miam-catalog-recipe-card__actions__link", "replace", 3, "click"], i18n_4, [1, "miam-catalog-recipe-card__actions__link", "delete", 3, "click"], [1, "m-button-primary", "reverse", 3, "click"], i18n_6, [1, "miam-catalog-card__attributes__info", "recipe__total__time"], ["width", "18", "height", "18", "primaryColor", "var(--m-catalog-card-details-color)", 3, "iconName"], [1, "miam-catalog-card__info__label"], [1, "miam-catalog-card__attributes__info", "recipe__difficulty", 3, "ngClass"], [3, "ngSwitch"], [4, "ngSwitchCase"], [4, "ngSwitchDefault"], ["primaryColor", "var(--m-catalog-card-details-color)", 3, "width", "height", "iconName"], ["class", "miam-catalog-card__info__label easy", 4, "ngIf", "ngIfElse"], ["difficultyEasyDefault", ""], [1, "miam-catalog-card__info__label", "easy"], i18n_8, ["class", "miam-catalog-card__info__label medium", 4, "ngIf", "ngIfElse"], ["difficultyMediumDefault", ""], [1, "miam-catalog-card__info__label", "medium"], i18n_10, ["class", "miam-catalog-card__info__label hard", 4, "ngIf", "ngIfElse"], ["difficultyHardDefault", ""], [1, "miam-catalog-card__info__label", "hard"], i18n_12, ["difficultyDefault", ""], i18n_14, [1, "miam-catalog-card__attributes__info", "recipe__price"], [3, "recipe", "serves", 4, "ngIf"], [3, "recipe", "serves"], [3, "close", "actionTriggered"]];
18188
18199
  }, template: function CatalogRecipeCardComponent_Template(rf, ctx) {
18189
18200
  if (rf & 1) {
18190
18201
  i0.ɵɵelementStart(0, "div", 0);
@@ -18198,7 +18209,7 @@
18198
18209
  i0.ɵɵelementStart(7, "div", 4);
18199
18210
  i0.ɵɵelementStart(8, "div", 5);
18200
18211
  i0.ɵɵtemplate(9, CatalogRecipeCardComponent_div_9_Template, 6, 3, "div", 6);
18201
- i0.ɵɵtemplate(10, CatalogRecipeCardComponent_ng_miam_recipe_card_cta_10_Template, 2, 5, "ng-miam-recipe-card-cta", 7);
18212
+ i0.ɵɵtemplate(10, CatalogRecipeCardComponent_ng_miam_recipe_card_cta_10_Template, 2, 6, "ng-miam-recipe-card-cta", 7);
18202
18213
  i0.ɵɵtemplate(11, CatalogRecipeCardComponent_div_11_Template, 6, 1, "div", 8);
18203
18214
  i0.ɵɵtemplate(12, CatalogRecipeCardComponent_button_12_Template, 3, 0, "button", 9);
18204
18215
  i0.ɵɵelementEnd();
@@ -18838,6 +18849,225 @@
18838
18849
  return RecipeFilters;
18839
18850
  }());
18840
18851
 
18852
+ var _a;
18853
+ var _c0$p = ["recipeCard"];
18854
+ function SuggestionCardComponent_ng_miam_recipe_card_0_Template(rf, ctx) {
18855
+ if (rf & 1) {
18856
+ var _r3_1 = i0.ɵɵgetCurrentView();
18857
+ i0.ɵɵelementStart(0, "ng-miam-recipe-card", 1, 2);
18858
+ i0.ɵɵlistener("guestsChanged", function SuggestionCardComponent_ng_miam_recipe_card_0_Template_ng_miam_recipe_card_guestsChanged_0_listener() { i0.ɵɵrestoreView(_r3_1); var ctx_r2 = i0.ɵɵnextContext(); return ctx_r2.guestsChanged(); });
18859
+ i0.ɵɵelementEnd();
18860
+ }
18861
+ if (rf & 2) {
18862
+ var ctx_r0 = i0.ɵɵnextContext();
18863
+ i0.ɵɵproperty("recipe", ctx_r0.recipe)("headerText", ctx_r0.headerText)("displayPricing", ctx_r0.displayPricing)("displayAddedOnPicture", ctx_r0.displayAddedOnPicture)("originTrace", ctx_r0.eventTrace());
18864
+ }
18865
+ }
18866
+ var recipeIncludes$1 = ['recipe-provider', 'sponsors'];
18867
+ var recipeSparseFields$1 = (_a = {
18868
+ recipes: __spread(['title', 'number-of-guests', 'media-url', 'video-id', 'filigrane-logo-url', 'difficulty', 'preparation-time', 'cooking-time',
18869
+ 'resting-time'], recipeIncludes$1),
18870
+ sponsors: ['logo-url']
18871
+ },
18872
+ _a['recipe-provider'] = ['name'],
18873
+ _a);
18874
+ /**
18875
+ * This is an angular component design to be a web component
18876
+ * that's why we use onPushStrategie with the changeDetetectorRef
18877
+ * to avoid common issue
18878
+ * guide -> https://netbasal.com/a-comprehensive-guide-to-angular-onpush-change-detection-strategy-5bac493074a4
18879
+ * and alsow we use ShadowDom to protect style of our component
18880
+ * and alsow style of the parent aplication that will use it
18881
+ * doc -> https://angular.io/api/core/ViewEncapsulation
18882
+ */
18883
+ var SuggestionCardComponent = /** @class */ (function (_super) {
18884
+ __extends(SuggestionCardComponent, _super);
18885
+ function SuggestionCardComponent(cdr, recipeService, groceriesListsService, contextService, analyticsService, recipeEventsService, element) {
18886
+ var _this = _super.call(this, cdr, recipeService, recipeEventsService, groceriesListsService, contextService, analyticsService, element) || this;
18887
+ _this.cdr = cdr;
18888
+ _this.recipeService = recipeService;
18889
+ _this.groceriesListsService = groceriesListsService;
18890
+ _this.contextService = contextService;
18891
+ _this.analyticsService = analyticsService;
18892
+ _this.recipeEventsService = recipeEventsService;
18893
+ _this.element = element;
18894
+ _this.isEmpty = false;
18895
+ _this.eventsGroupId = uuid.v4();
18896
+ // as the template creates a recipe card, the recipe card send the events
18897
+ _this.sendShowEventOnScroll = false;
18898
+ return _this;
18899
+ }
18900
+ SuggestionCardComponent.prototype.ngOnChanges = function (simpleChanges) {
18901
+ if ((simpleChanges.productIds && !this.randomModeEnable) || !this.recipe) {
18902
+ this.loadRecipe();
18903
+ }
18904
+ };
18905
+ // Only send show event if the recipe has changed while the card was in viewport
18906
+ SuggestionCardComponent.prototype.sendShowEvent = function () {
18907
+ return false;
18908
+ };
18909
+ // If recipe already in basket, update the number of guests so that the pricing gets updated as well
18910
+ // (display = false so that the recipe details don't show up)
18911
+ SuggestionCardComponent.prototype.guestsChanged = function () {
18912
+ var _this = this;
18913
+ this.subscriptions.push(this.groceriesListsService.recipeIsInList(this.recipe.id).pipe(operators.switchMap(function (recipeIsInList) {
18914
+ if (recipeIsInList) {
18915
+ return _this.groceriesListsService.appendRecipeToList(_this.recipe.id, _this.recipe.modifiedGuests, _this.eventTrace())
18916
+ .pipe(operators.take(1));
18917
+ }
18918
+ })).subscribe(function () { return _this.cdr.detectChanges(); }));
18919
+ };
18920
+ SuggestionCardComponent.prototype.loadRecipe = function () {
18921
+ var _this = this;
18922
+ this.subscriptions.push(this.fetchRecipes().pipe(operators.skipWhile(function (results) { return !results; }), operators.catchError(function (err) {
18923
+ _this.hide.emit();
18924
+ return rxjs.of(err);
18925
+ })).subscribe(function (results) { return _this.processResults(results); }));
18926
+ };
18927
+ SuggestionCardComponent.prototype.fetchRecipes = function () {
18928
+ if (this.contextService.displayIngredientPicturesOnRecipeCards && !recipeIncludes$1.includes('ingredients')) {
18929
+ recipeIncludes$1.push('ingredients');
18930
+ recipeSparseFields$1.recipes.push('ingredients');
18931
+ recipeSparseFields$1['ingredients'] = ['name', 'quantity', 'unit', 'active', 'forced-eans', 'picture-url', 'position'];
18932
+ }
18933
+ if (this.randomModeEnable) {
18934
+ return this.recipeService.getRandom(recipeIncludes$1, recipeSparseFields$1);
18935
+ }
18936
+ else {
18937
+ return this.recipeService.getSuggestion(this.productIds, this.eventsGroupId, recipeIncludes$1, recipeSparseFields$1);
18938
+ }
18939
+ };
18940
+ // If the recipe is in basket, will show number of guests as defined in the basket
18941
+ // Otherwise, will show default number of guests for the recipe
18942
+ SuggestionCardComponent.prototype.processResults = function (recipes) {
18943
+ var _this = this;
18944
+ this.isEmpty = (!recipes || recipes.length === 0);
18945
+ if (!this.isEmpty) {
18946
+ // get the first recipe and shallow copy it to permit to send event and do not disturb any other component
18947
+ // if ressource is cached without copy another load will get the attributes
18948
+ this.recipe = recipes[0].shallowCopyWithEvents(this.recipeEventsService.ORIGIN_SUGGESTION, this.eventsGroupId);
18949
+ // Update guests from list only if recipe is in list
18950
+ this.subscriptions.push(this.groceriesListsService.recipeIsInList(this.recipe.id).subscribe(function (isInList) {
18951
+ if (isInList) {
18952
+ _this.recipe.modifiedGuests = _this.groceriesListsService.guestsForRecipe(_this.recipe) || +_this.recipe.guests;
18953
+ _this.recipeCard.cdr.markForCheck();
18954
+ }
18955
+ }));
18956
+ this.recipeCard.cdr.markForCheck();
18957
+ }
18958
+ else {
18959
+ this.hide.emit();
18960
+ }
18961
+ this.cdr.detectChanges();
18962
+ };
18963
+ return SuggestionCardComponent;
18964
+ }(AbstractRecipeCardComponent));
18965
+ SuggestionCardComponent.ɵfac = function SuggestionCardComponent_Factory(t) { return new (t || SuggestionCardComponent)(i0.ɵɵdirectiveInject(i0.ChangeDetectorRef), i0.ɵɵdirectiveInject(RecipesService), i0.ɵɵdirectiveInject(GroceriesListsService), i0.ɵɵdirectiveInject(ContextService), i0.ɵɵdirectiveInject(AnalyticsService), i0.ɵɵdirectiveInject(RecipeEventsService), i0.ɵɵdirectiveInject(i0.ElementRef)); };
18966
+ SuggestionCardComponent.ɵcmp = i0.ɵɵdefineComponent({ type: SuggestionCardComponent, selectors: [["ng-miam-suggestion-card"]], viewQuery: function SuggestionCardComponent_Query(rf, ctx) {
18967
+ if (rf & 1) {
18968
+ i0.ɵɵviewQuery(_c0$p, true);
18969
+ }
18970
+ if (rf & 2) {
18971
+ var _t;
18972
+ i0.ɵɵqueryRefresh(_t = i0.ɵɵloadQuery()) && (ctx.recipeCard = _t.first);
18973
+ }
18974
+ }, inputs: { randomModeEnable: "randomModeEnable", productIds: "productIds" }, features: [i0.ɵɵInheritDefinitionFeature, i0.ɵɵNgOnChangesFeature], decls: 1, vars: 1, consts: [[3, "recipe", "headerText", "displayPricing", "displayAddedOnPicture", "originTrace", "guestsChanged", 4, "ngIf"], [3, "recipe", "headerText", "displayPricing", "displayAddedOnPicture", "originTrace", "guestsChanged"], ["recipeCard", ""]], template: function SuggestionCardComponent_Template(rf, ctx) {
18975
+ if (rf & 1) {
18976
+ i0.ɵɵtemplate(0, SuggestionCardComponent_ng_miam_recipe_card_0_Template, 2, 5, "ng-miam-recipe-card", 0);
18977
+ }
18978
+ if (rf & 2) {
18979
+ i0.ɵɵproperty("ngIf", !ctx.isEmpty);
18980
+ }
18981
+ }, directives: [i2.NgIf, RecipeCardComponent], styles: [""], encapsulation: 2, changeDetection: 0 });
18982
+ /*@__PURE__*/ (function () {
18983
+ i0.ɵsetClassMetadata(SuggestionCardComponent, [{
18984
+ type: i0.Component,
18985
+ args: [{
18986
+ selector: 'ng-miam-suggestion-card',
18987
+ templateUrl: './suggestion-card.component.html',
18988
+ styleUrls: ['./suggestion-card.component.scss'],
18989
+ encapsulation: i0.ViewEncapsulation.None,
18990
+ changeDetection: i0.ChangeDetectionStrategy.OnPush
18991
+ }]
18992
+ }], function () { return [{ type: i0.ChangeDetectorRef }, { type: RecipesService }, { type: GroceriesListsService }, { type: ContextService }, { type: AnalyticsService }, { type: RecipeEventsService }, { type: i0.ElementRef }]; }, { randomModeEnable: [{
18993
+ type: i0.Input
18994
+ }], productIds: [{
18995
+ type: i0.Input
18996
+ }], recipeCard: [{
18997
+ type: i0.ViewChild,
18998
+ args: ['recipeCard']
18999
+ }] });
19000
+ })();
19001
+
19002
+ var RecipeCardsModule = /** @class */ (function () {
19003
+ // Create custom elements so the WebComponents can be interpreted by the browser regardless of the js framework used
19004
+ function RecipeCardsModule(injector) {
19005
+ var webComponents = {
19006
+ 'add-recipe-card': AddRecipeCardComponent,
19007
+ 'catalog-recipe-card': CatalogRecipeCardComponent,
19008
+ 'recipe-card': RecipeCardComponent,
19009
+ 'suggestion-card': SuggestionCardComponent,
19010
+ 'recipe-card-cta': RecipeCardCtaComponent,
19011
+ };
19012
+ Object.keys(webComponents).map(function (compName) {
19013
+ var name = "webc-miam-" + compName;
19014
+ // Avoid duplicate error
19015
+ if (!customElements.get(name)) {
19016
+ var comp = webComponents[compName];
19017
+ var ngElement = elements.createCustomElement(comp, { injector: injector });
19018
+ customElements.define(name, ngElement);
19019
+ }
19020
+ });
19021
+ }
19022
+ return RecipeCardsModule;
19023
+ }());
19024
+ RecipeCardsModule.ɵmod = i0.ɵɵdefineNgModule({ type: RecipeCardsModule });
19025
+ RecipeCardsModule.ɵinj = i0.ɵɵdefineInjector({ factory: function RecipeCardsModule_Factory(t) { return new (t || RecipeCardsModule)(i0.ɵɵinject(i0.Injector)); }, imports: [[
19026
+ i2.CommonModule,
19027
+ i3.FormsModule,
19028
+ UtilsModule,
19029
+ ComponentsModule
19030
+ ]] });
19031
+ (function () {
19032
+ (typeof ngJitMode === "undefined" || ngJitMode) && i0.ɵɵsetNgModuleScope(RecipeCardsModule, { declarations: [AddRecipeCardComponent,
19033
+ CatalogRecipeCardComponent,
19034
+ RecipeCardComponent,
19035
+ SuggestionCardComponent,
19036
+ RecipeCardCtaComponent], imports: [i2.CommonModule,
19037
+ i3.FormsModule,
19038
+ UtilsModule,
19039
+ ComponentsModule], exports: [AddRecipeCardComponent,
19040
+ CatalogRecipeCardComponent,
19041
+ RecipeCardComponent,
19042
+ SuggestionCardComponent] });
19043
+ })();
19044
+ /*@__PURE__*/ (function () {
19045
+ i0.ɵsetClassMetadata(RecipeCardsModule, [{
19046
+ type: i0.NgModule,
19047
+ args: [{
19048
+ imports: [
19049
+ i2.CommonModule,
19050
+ i3.FormsModule,
19051
+ UtilsModule,
19052
+ ComponentsModule
19053
+ ],
19054
+ declarations: [
19055
+ AddRecipeCardComponent,
19056
+ CatalogRecipeCardComponent,
19057
+ RecipeCardComponent,
19058
+ SuggestionCardComponent,
19059
+ RecipeCardCtaComponent
19060
+ ],
19061
+ exports: [
19062
+ AddRecipeCardComponent,
19063
+ CatalogRecipeCardComponent,
19064
+ RecipeCardComponent,
19065
+ SuggestionCardComponent
19066
+ ]
19067
+ }]
19068
+ }], function () { return [{ type: i0.Injector }]; }, null);
19069
+ })();
19070
+
18841
19071
  function CatalogArticleCardComponent_img_4_Template(rf, ctx) {
18842
19072
  if (rf & 1) {
18843
19073
  i0.ɵɵelement(0, "img", 12);
@@ -19056,10 +19286,10 @@
19056
19286
  i0.ɵɵelementEnd();
19057
19287
  }
19058
19288
  }
19059
- var recipeIncludes$1 = ['recipe-provider', 'sponsors'];
19060
- var recipeSparseFields$1 = (_c = {
19289
+ var recipeIncludes$2 = ['recipe-provider', 'sponsors'];
19290
+ var recipeSparseFields$2 = (_c = {
19061
19291
  recipes: __spread(['title', 'number-of-guests', 'media-url', 'video-id', 'filigrane-logo-url', 'difficulty', 'preparation-time', 'cooking-time',
19062
- 'resting-time'], recipeIncludes$1),
19292
+ 'resting-time'], recipeIncludes$2),
19063
19293
  sponsors: ['logo-url']
19064
19294
  },
19065
19295
  _c['recipe-provider'] = ['name'],
@@ -19117,8 +19347,10 @@
19117
19347
  this.initLoadOnScroll();
19118
19348
  };
19119
19349
  CatalogListComponent.prototype.ngOnChanges = function (changes) {
19120
- // Prevents reload loop in angular
19121
- if (!(Object.keys(changes).length === 1 && Object.keys(changes)[0] === 'originTrace')) {
19350
+ var changesKeys = Object.keys(changes);
19351
+ // Prevents reload loop in angular, because originTrace and excludedRecipesIds are passed as methods so they keep refreshing the DOM
19352
+ if (!(changesKeys.includes('originTrace') &&
19353
+ (changesKeys.length === 1 || (changesKeys.length === 2 && changesKeys.includes('excludedRecipesIds'))))) {
19122
19354
  this.filtersToDisplay = this.buildFiltersArray();
19123
19355
  this.reloadPage();
19124
19356
  if (this.filters.search) {
@@ -19170,15 +19402,17 @@
19170
19402
  if (this.noMoreRecipes) {
19171
19403
  return rxjs.of([]);
19172
19404
  }
19173
- // keep a copy of the filters when request is sent, so we can check they are still the same when it is received
19174
- // Because if it's not the case we have to ignore the results
19175
- var requestFilters = this.filters.copy();
19176
- if (this.context.displayIngredientPicturesOnRecipeCards && !recipeIncludes$1.includes('ingredients')) {
19177
- recipeIncludes$1.push('ingredients');
19178
- recipeSparseFields$1.recipes.push('ingredients');
19179
- Object.assign(recipeSparseFields$1, { ingredients: ['name', 'quantity', 'unit', 'active', 'forced-eans', 'picture-url', 'position'] });
19180
- }
19181
- return this.recipesService.filter(requestFilters, { size: 20, number: page }, recipeIncludes$1, recipeSparseFields$1, this.modifiedGuests, this.randomMode, this.sort).pipe(operators.switchMap(function (result) { return _this.processResults(result, requestFilters, page); }));
19405
+ return this.recipesService.addMandatoryCompletionToFilter(this.filters).pipe(operators.switchMap(function () {
19406
+ // keep a copy of the filters when request is sent, so we can check they are still the same when it is received
19407
+ // Because if it's not the case we have to ignore the results
19408
+ var requestFilters = _this.filters.copy();
19409
+ if (_this.context.displayIngredientPicturesOnRecipeCards && !recipeIncludes$2.includes('ingredients')) {
19410
+ recipeIncludes$2.push('ingredients');
19411
+ recipeSparseFields$2.recipes.push('ingredients');
19412
+ Object.assign(recipeSparseFields$2, { ingredients: ['name', 'quantity', 'unit', 'active', 'forced-eans', 'picture-url', 'position'] });
19413
+ }
19414
+ return _this.recipesService.filter(requestFilters, { size: 20, number: page }, recipeIncludes$2, recipeSparseFields$2, _this.modifiedGuests, _this.randomMode, _this.sort).pipe(operators.switchMap(function (result) { return _this.processResults(result, requestFilters, page); }));
19415
+ }));
19182
19416
  };
19183
19417
  CatalogListComponent.prototype.processResults = function (results, requestFilters, page) {
19184
19418
  var _this = this;
@@ -19737,7 +19971,7 @@
19737
19971
  var templateObject_1$w, templateObject_2$q, templateObject_3$j, templateObject_4$f;
19738
19972
 
19739
19973
  var _b$1;
19740
- var _c0$p = ["miamMealsPlannerTopAnchor"];
19974
+ var _c0$q = ["miamMealsPlannerTopAnchor"];
19741
19975
  function MealsPlannerComponent_div_2_ng_miam_icon_13_Template(rf, ctx) {
19742
19976
  if (rf & 1) {
19743
19977
  i0.ɵɵelement(0, "ng-miam-icon", 8);
@@ -19886,10 +20120,10 @@
19886
20120
  i0.ɵɵproperty("ngIf", ctx_r1.form);
19887
20121
  }
19888
20122
  }
19889
- var recipeIncludes$2 = ['recipe-provider', 'sponsors'];
19890
- var recipeSparseFields$2 = (_b$1 = {
20123
+ var recipeIncludes$3 = ['recipe-provider', 'sponsors'];
20124
+ var recipeSparseFields$3 = (_b$1 = {
19891
20125
  recipes: __spread(['title', 'number-of-guests', 'media-url', 'video-id', 'filigrane-logo-url', 'difficulty', 'preparation-time', 'cooking-time',
19892
- 'resting-time'], recipeIncludes$2),
20126
+ 'resting-time'], recipeIncludes$3),
19893
20127
  sponsors: ['logo-url']
19894
20128
  },
19895
20129
  _b$1['recipe-provider'] = ['name'],
@@ -19949,12 +20183,12 @@
19949
20183
  var _this = this;
19950
20184
  this.loading = true;
19951
20185
  this.cdr.detectChanges();
19952
- if (this.contextService.displayIngredientPicturesOnRecipeCards && !recipeIncludes$2.includes('ingredients')) {
19953
- recipeIncludes$2.push('ingredients');
19954
- recipeSparseFields$2.recipes.push('ingredients');
19955
- recipeSparseFields$2['ingredients'] = ['name', 'quantity', 'unit', 'active', 'forced-eans', 'picture-url', 'position'];
20186
+ if (this.contextService.displayIngredientPicturesOnRecipeCards && !recipeIncludes$3.includes('ingredients')) {
20187
+ recipeIncludes$3.push('ingredients');
20188
+ recipeSparseFields$3.recipes.push('ingredients');
20189
+ recipeSparseFields$3['ingredients'] = ['name', 'quantity', 'unit', 'active', 'forced-eans', 'picture-url', 'position'];
19956
20190
  }
19957
- this.recipesService.plan(inputs.budget, inputs.guestsCount, inputs.recipesCount, recipeIncludes$2, recipeSparseFields$2, false).pipe(operators.switchMap(function (recipes) {
20191
+ this.recipesService.plan(inputs.budget, inputs.guestsCount, inputs.recipesCount, recipeIncludes$3, recipeSparseFields$3, false).pipe(operators.switchMap(function (recipes) {
19958
20192
  _this.budgettedRecipes = []; // Refresh the result view
19959
20193
  _this.cdr.detectChanges();
19960
20194
  _this.budgettedRecipes = recipes.map(function (r) {
@@ -20146,7 +20380,7 @@
20146
20380
  MealsPlannerComponent.ɵfac = function MealsPlannerComponent_Factory(t) { return new (t || MealsPlannerComponent)(i0.ɵɵdirectiveInject(i3.FormBuilder), i0.ɵɵdirectiveInject(i0.ChangeDetectorRef), i0.ɵɵdirectiveInject(AnalyticsService), i0.ɵɵdirectiveInject(ContextService), i0.ɵɵdirectiveInject(GroceriesListsService), i0.ɵɵdirectiveInject(RecipesService), i0.ɵɵdirectiveInject(BasketsService), i0.ɵɵdirectiveInject(PointOfSalesService)); };
20147
20381
  MealsPlannerComponent.ɵcmp = i0.ɵɵdefineComponent({ type: MealsPlannerComponent, selectors: [["ng-miam-meals-planner"]], viewQuery: function MealsPlannerComponent_Query(rf, ctx) {
20148
20382
  if (rf & 1) {
20149
- i0.ɵɵviewQuery(_c0$p, true);
20383
+ i0.ɵɵviewQuery(_c0$q, true);
20150
20384
  }
20151
20385
  if (rf & 2) {
20152
20386
  var _t;
@@ -20205,225 +20439,6 @@
20205
20439
  })();
20206
20440
  var templateObject_1$x, templateObject_2$r, templateObject_3$k;
20207
20441
 
20208
- var _a;
20209
- var _c0$q = ["recipeCard"];
20210
- function SuggestionCardComponent_ng_miam_recipe_card_0_Template(rf, ctx) {
20211
- if (rf & 1) {
20212
- var _r3_1 = i0.ɵɵgetCurrentView();
20213
- i0.ɵɵelementStart(0, "ng-miam-recipe-card", 1, 2);
20214
- i0.ɵɵlistener("guestsChanged", function SuggestionCardComponent_ng_miam_recipe_card_0_Template_ng_miam_recipe_card_guestsChanged_0_listener() { i0.ɵɵrestoreView(_r3_1); var ctx_r2 = i0.ɵɵnextContext(); return ctx_r2.guestsChanged(); });
20215
- i0.ɵɵelementEnd();
20216
- }
20217
- if (rf & 2) {
20218
- var ctx_r0 = i0.ɵɵnextContext();
20219
- i0.ɵɵproperty("recipe", ctx_r0.recipe)("headerText", ctx_r0.headerText)("displayPricing", ctx_r0.displayPricing)("displayAddedOnPicture", ctx_r0.displayAddedOnPicture)("originTrace", ctx_r0.eventTrace());
20220
- }
20221
- }
20222
- var recipeIncludes$3 = ['recipe-provider', 'sponsors'];
20223
- var recipeSparseFields$3 = (_a = {
20224
- recipes: __spread(['title', 'number-of-guests', 'media-url', 'video-id', 'filigrane-logo-url', 'difficulty', 'preparation-time', 'cooking-time',
20225
- 'resting-time'], recipeIncludes$3),
20226
- sponsors: ['logo-url']
20227
- },
20228
- _a['recipe-provider'] = ['name'],
20229
- _a);
20230
- /**
20231
- * This is an angular component design to be a web component
20232
- * that's why we use onPushStrategie with the changeDetetectorRef
20233
- * to avoid common issue
20234
- * guide -> https://netbasal.com/a-comprehensive-guide-to-angular-onpush-change-detection-strategy-5bac493074a4
20235
- * and alsow we use ShadowDom to protect style of our component
20236
- * and alsow style of the parent aplication that will use it
20237
- * doc -> https://angular.io/api/core/ViewEncapsulation
20238
- */
20239
- var SuggestionCardComponent = /** @class */ (function (_super) {
20240
- __extends(SuggestionCardComponent, _super);
20241
- function SuggestionCardComponent(cdr, recipeService, groceriesListsService, contextService, analyticsService, recipeEventsService, element) {
20242
- var _this = _super.call(this, cdr, recipeService, recipeEventsService, groceriesListsService, contextService, analyticsService, element) || this;
20243
- _this.cdr = cdr;
20244
- _this.recipeService = recipeService;
20245
- _this.groceriesListsService = groceriesListsService;
20246
- _this.contextService = contextService;
20247
- _this.analyticsService = analyticsService;
20248
- _this.recipeEventsService = recipeEventsService;
20249
- _this.element = element;
20250
- _this.isEmpty = false;
20251
- _this.eventsGroupId = uuid.v4();
20252
- // as the template creates a recipe card, the recipe card send the events
20253
- _this.sendShowEventOnScroll = false;
20254
- return _this;
20255
- }
20256
- SuggestionCardComponent.prototype.ngOnChanges = function (simpleChanges) {
20257
- if ((simpleChanges.productIds && !this.randomModeEnable) || !this.recipe) {
20258
- this.loadRecipe();
20259
- }
20260
- };
20261
- // Only send show event if the recipe has changed while the card was in viewport
20262
- SuggestionCardComponent.prototype.sendShowEvent = function () {
20263
- return false;
20264
- };
20265
- // If recipe already in basket, update the number of guests so that the pricing gets updated as well
20266
- // (display = false so that the recipe details don't show up)
20267
- SuggestionCardComponent.prototype.guestsChanged = function () {
20268
- var _this = this;
20269
- this.subscriptions.push(this.groceriesListsService.recipeIsInList(this.recipe.id).pipe(operators.switchMap(function (recipeIsInList) {
20270
- if (recipeIsInList) {
20271
- return _this.groceriesListsService.appendRecipeToList(_this.recipe.id, _this.recipe.modifiedGuests, _this.eventTrace())
20272
- .pipe(operators.take(1));
20273
- }
20274
- })).subscribe(function () { return _this.cdr.detectChanges(); }));
20275
- };
20276
- SuggestionCardComponent.prototype.loadRecipe = function () {
20277
- var _this = this;
20278
- this.subscriptions.push(this.fetchRecipes().pipe(operators.skipWhile(function (results) { return !results; }), operators.catchError(function (err) {
20279
- _this.hide.emit();
20280
- return rxjs.of(err);
20281
- })).subscribe(function (results) { return _this.processResults(results); }));
20282
- };
20283
- SuggestionCardComponent.prototype.fetchRecipes = function () {
20284
- if (this.contextService.displayIngredientPicturesOnRecipeCards && !recipeIncludes$3.includes('ingredients')) {
20285
- recipeIncludes$3.push('ingredients');
20286
- recipeSparseFields$3.recipes.push('ingredients');
20287
- recipeSparseFields$3['ingredients'] = ['name', 'quantity', 'unit', 'active', 'forced-eans', 'picture-url', 'position'];
20288
- }
20289
- if (this.randomModeEnable) {
20290
- return this.recipeService.getRandom(recipeIncludes$3, recipeSparseFields$3);
20291
- }
20292
- else {
20293
- return this.recipeService.getSuggestion(this.productIds, this.eventsGroupId, recipeIncludes$3, recipeSparseFields$3);
20294
- }
20295
- };
20296
- // If the recipe is in basket, will show number of guests as defined in the basket
20297
- // Otherwise, will show default number of guests for the recipe
20298
- SuggestionCardComponent.prototype.processResults = function (recipes) {
20299
- var _this = this;
20300
- this.isEmpty = (!recipes || recipes.length === 0);
20301
- if (!this.isEmpty) {
20302
- // get the first recipe and shallow copy it to permit to send event and do not disturb any other component
20303
- // if ressource is cached without copy another load will get the attributes
20304
- this.recipe = recipes[0].shallowCopyWithEvents(this.recipeEventsService.ORIGIN_SUGGESTION, this.eventsGroupId);
20305
- // Update guests from list only if recipe is in list
20306
- this.subscriptions.push(this.groceriesListsService.recipeIsInList(this.recipe.id).subscribe(function (isInList) {
20307
- if (isInList) {
20308
- _this.recipe.modifiedGuests = _this.groceriesListsService.guestsForRecipe(_this.recipe) || +_this.recipe.guests;
20309
- _this.recipeCard.cdr.markForCheck();
20310
- }
20311
- }));
20312
- this.recipeCard.cdr.markForCheck();
20313
- }
20314
- else {
20315
- this.hide.emit();
20316
- }
20317
- this.cdr.detectChanges();
20318
- };
20319
- return SuggestionCardComponent;
20320
- }(AbstractRecipeCardComponent));
20321
- SuggestionCardComponent.ɵfac = function SuggestionCardComponent_Factory(t) { return new (t || SuggestionCardComponent)(i0.ɵɵdirectiveInject(i0.ChangeDetectorRef), i0.ɵɵdirectiveInject(RecipesService), i0.ɵɵdirectiveInject(GroceriesListsService), i0.ɵɵdirectiveInject(ContextService), i0.ɵɵdirectiveInject(AnalyticsService), i0.ɵɵdirectiveInject(RecipeEventsService), i0.ɵɵdirectiveInject(i0.ElementRef)); };
20322
- SuggestionCardComponent.ɵcmp = i0.ɵɵdefineComponent({ type: SuggestionCardComponent, selectors: [["ng-miam-suggestion-card"]], viewQuery: function SuggestionCardComponent_Query(rf, ctx) {
20323
- if (rf & 1) {
20324
- i0.ɵɵviewQuery(_c0$q, true);
20325
- }
20326
- if (rf & 2) {
20327
- var _t;
20328
- i0.ɵɵqueryRefresh(_t = i0.ɵɵloadQuery()) && (ctx.recipeCard = _t.first);
20329
- }
20330
- }, inputs: { randomModeEnable: "randomModeEnable", productIds: "productIds" }, features: [i0.ɵɵInheritDefinitionFeature, i0.ɵɵNgOnChangesFeature], decls: 1, vars: 1, consts: [[3, "recipe", "headerText", "displayPricing", "displayAddedOnPicture", "originTrace", "guestsChanged", 4, "ngIf"], [3, "recipe", "headerText", "displayPricing", "displayAddedOnPicture", "originTrace", "guestsChanged"], ["recipeCard", ""]], template: function SuggestionCardComponent_Template(rf, ctx) {
20331
- if (rf & 1) {
20332
- i0.ɵɵtemplate(0, SuggestionCardComponent_ng_miam_recipe_card_0_Template, 2, 5, "ng-miam-recipe-card", 0);
20333
- }
20334
- if (rf & 2) {
20335
- i0.ɵɵproperty("ngIf", !ctx.isEmpty);
20336
- }
20337
- }, directives: [i2.NgIf, RecipeCardComponent], styles: [""], encapsulation: 2, changeDetection: 0 });
20338
- /*@__PURE__*/ (function () {
20339
- i0.ɵsetClassMetadata(SuggestionCardComponent, [{
20340
- type: i0.Component,
20341
- args: [{
20342
- selector: 'ng-miam-suggestion-card',
20343
- templateUrl: './suggestion-card.component.html',
20344
- styleUrls: ['./suggestion-card.component.scss'],
20345
- encapsulation: i0.ViewEncapsulation.None,
20346
- changeDetection: i0.ChangeDetectionStrategy.OnPush
20347
- }]
20348
- }], function () { return [{ type: i0.ChangeDetectorRef }, { type: RecipesService }, { type: GroceriesListsService }, { type: ContextService }, { type: AnalyticsService }, { type: RecipeEventsService }, { type: i0.ElementRef }]; }, { randomModeEnable: [{
20349
- type: i0.Input
20350
- }], productIds: [{
20351
- type: i0.Input
20352
- }], recipeCard: [{
20353
- type: i0.ViewChild,
20354
- args: ['recipeCard']
20355
- }] });
20356
- })();
20357
-
20358
- var RecipeCardsModule = /** @class */ (function () {
20359
- // Create custom elements so the WebComponents can be interpreted by the browser regardless of the js framework used
20360
- function RecipeCardsModule(injector) {
20361
- var webComponents = {
20362
- 'add-recipe-card': AddRecipeCardComponent,
20363
- 'catalog-recipe-card': CatalogRecipeCardComponent,
20364
- 'recipe-card': RecipeCardComponent,
20365
- 'suggestion-card': SuggestionCardComponent,
20366
- 'recipe-card-cta': RecipeCardCtaComponent,
20367
- };
20368
- Object.keys(webComponents).map(function (compName) {
20369
- var name = "webc-miam-" + compName;
20370
- // Avoid duplicate error
20371
- if (!customElements.get(name)) {
20372
- var comp = webComponents[compName];
20373
- var ngElement = elements.createCustomElement(comp, { injector: injector });
20374
- customElements.define(name, ngElement);
20375
- }
20376
- });
20377
- }
20378
- return RecipeCardsModule;
20379
- }());
20380
- RecipeCardsModule.ɵmod = i0.ɵɵdefineNgModule({ type: RecipeCardsModule });
20381
- RecipeCardsModule.ɵinj = i0.ɵɵdefineInjector({ factory: function RecipeCardsModule_Factory(t) { return new (t || RecipeCardsModule)(i0.ɵɵinject(i0.Injector)); }, imports: [[
20382
- i2.CommonModule,
20383
- i3.FormsModule,
20384
- UtilsModule,
20385
- ComponentsModule
20386
- ]] });
20387
- (function () {
20388
- (typeof ngJitMode === "undefined" || ngJitMode) && i0.ɵɵsetNgModuleScope(RecipeCardsModule, { declarations: [AddRecipeCardComponent,
20389
- CatalogRecipeCardComponent,
20390
- RecipeCardComponent,
20391
- SuggestionCardComponent,
20392
- RecipeCardCtaComponent], imports: [i2.CommonModule,
20393
- i3.FormsModule,
20394
- UtilsModule,
20395
- ComponentsModule], exports: [AddRecipeCardComponent,
20396
- CatalogRecipeCardComponent,
20397
- RecipeCardComponent,
20398
- SuggestionCardComponent] });
20399
- })();
20400
- /*@__PURE__*/ (function () {
20401
- i0.ɵsetClassMetadata(RecipeCardsModule, [{
20402
- type: i0.NgModule,
20403
- args: [{
20404
- imports: [
20405
- i2.CommonModule,
20406
- i3.FormsModule,
20407
- UtilsModule,
20408
- ComponentsModule
20409
- ],
20410
- declarations: [
20411
- AddRecipeCardComponent,
20412
- CatalogRecipeCardComponent,
20413
- RecipeCardComponent,
20414
- SuggestionCardComponent,
20415
- RecipeCardCtaComponent
20416
- ],
20417
- exports: [
20418
- AddRecipeCardComponent,
20419
- CatalogRecipeCardComponent,
20420
- RecipeCardComponent,
20421
- SuggestionCardComponent
20422
- ]
20423
- }]
20424
- }], function () { return [{ type: i0.Injector }]; }, null);
20425
- })();
20426
-
20427
20442
  var _c$1;
20428
20443
  var _c0$r = ["categoryContent"];
20429
20444
  var _c1$c = ["categoryCards"];
@@ -20541,17 +20556,14 @@
20541
20556
  CatalogCategoryComponent.prototype.ngOnChanges = function () {
20542
20557
  var _this = this;
20543
20558
  this.subscriptions.push(rxjs.forkJoin([this.loadRecipes(), this.loadArticles()]).pipe(operators.finalize(function () {
20544
- if (_this.recipes.length === 0 && _this.articles.length === 0) {
20545
- _this.hide = true;
20546
- }
20547
- else {
20548
- _this.hide = false;
20549
- }
20559
+ _this.hide = _this.recipes.length === 0 && _this.articles.length === 0;
20550
20560
  _this.loading.emit(false);
20551
20561
  _this.cdr.detectChanges();
20552
20562
  })).subscribe());
20553
20563
  };
20554
- CatalogCategoryComponent.prototype.currentPath = function () { return ''; };
20564
+ CatalogCategoryComponent.prototype.currentPath = function () {
20565
+ return '';
20566
+ };
20555
20567
  CatalogCategoryComponent.prototype.props = function () {
20556
20568
  var _a, _b;
20557
20569
  return { category_id: (_b = (_a = this.filters) === null || _a === void 0 ? void 0 : _a.additionalFilters) === null || _b === void 0 ? void 0 : _b.filters.packages };
@@ -20567,7 +20579,9 @@
20567
20579
  recipeSparseFields$4.recipes.push('ingredients');
20568
20580
  recipeSparseFields$4['ingredients'] = ['name', 'quantity', 'unit', 'active', 'forced-eans', 'picture-url', 'position'];
20569
20581
  }
20570
- return this.recipesService.filter(this.filters, { number: 1, size: this.maxRecipeNumber }, recipeIncludes$4, recipeSparseFields$4, this.modifiedGuests, false, 'position').pipe(operators.tap(function (result) { return _this.recipes = result; }));
20582
+ return this.recipesService.addMandatoryCompletionToFilter(this.filters).pipe(operators.switchMap(function () {
20583
+ return _this.recipesService.filter(_this.filters, { number: 1, size: _this.maxRecipeNumber }, recipeIncludes$4, recipeSparseFields$4, _this.modifiedGuests, false, 'position');
20584
+ }), operators.tap(function (result) { return _this.recipes = result; }));
20571
20585
  };
20572
20586
  CatalogCategoryComponent.prototype.loadArticles = function () {
20573
20587
  var _this = this;