@ikas/storefront 0.2.0-beta.1 → 0.3.0-alpha.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (40) hide show
  1. package/build/__generated__/global-types.d.ts +34 -0
  2. package/build/api/cart/__generated__/getCart.d.ts +1 -16
  3. package/build/api/index.d.ts +1 -0
  4. package/build/api/raffle/__generated__/getRafflesByCustomerId.d.ts +41 -0
  5. package/build/api/raffle/__generated__/listRaffle.d.ts +58 -0
  6. package/build/api/raffle/__generated__/listRaffleMetaData.d.ts +21 -0
  7. package/build/api/raffle/__generated__/saveRaffleParticipant.d.ts +30 -0
  8. package/build/api/raffle/index.d.ts +24 -0
  9. package/build/index.es.js +1371 -406
  10. package/build/index.js +1382 -405
  11. package/build/models/data/cart/index.d.ts +0 -2
  12. package/build/models/data/index.d.ts +1 -0
  13. package/build/models/data/order/line-item/index.d.ts +0 -2
  14. package/build/models/data/product/index.d.ts +0 -1
  15. package/build/models/data/product-option-set/index.d.ts +3 -18
  16. package/build/models/data/raffle/index.d.ts +63 -0
  17. package/build/models/theme/component/prop/index.d.ts +2 -0
  18. package/build/models/theme/index.d.ts +2 -0
  19. package/build/models/theme/page/component/prop-value/raffle-list.d.ts +5 -0
  20. package/build/models/theme/page/component/prop-value/raffle.d.ts +5 -0
  21. package/build/models/theme/page/index.d.ts +4 -1
  22. package/build/models/ui/index.d.ts +2 -0
  23. package/build/models/ui/raffle-list/index.d.ts +54 -0
  24. package/build/models/ui/validator/form/raffle-form.d.ts +60 -0
  25. package/build/models/ui/validator/rules/index.d.ts +4 -0
  26. package/build/pages/account/raffles.d.ts +6 -0
  27. package/build/pages/index.d.ts +4 -1
  28. package/build/pages/raffle/[slug].d.ts +7 -0
  29. package/build/pages/raffle/index.d.ts +6 -0
  30. package/build/providers/page-data-init.d.ts +7 -1
  31. package/build/providers/placeholders.d.ts +2 -1
  32. package/build/providers/prop-value/custom.d.ts +2 -0
  33. package/build/providers/prop-value/raffle-list.d.ts +5 -0
  34. package/build/providers/prop-value/raffle.d.ts +11 -0
  35. package/build/store/cart.d.ts +2 -4
  36. package/build/store/customer.d.ts +1 -0
  37. package/package.json +1 -1
  38. package/build/models/data/order/line-item/options/index.d.ts +0 -20
  39. package/build/models/data/order/line-item/options/options-value/index.d.ts +0 -6
  40. package/build/models/data/product-cart-item-options/index.d.ts +0 -6
package/build/index.es.js CHANGED
@@ -19867,28 +19867,6 @@ var moment = createCommonjsModule(function (module, exports) {
19867
19867
  })));
19868
19868
  });
19869
19869
 
19870
- var ProductOptionTypeEnum;
19871
- (function (ProductOptionTypeEnum) {
19872
- ProductOptionTypeEnum["CHECKBOX"] = "CHECKBOX";
19873
- ProductOptionTypeEnum["CHOICE"] = "CHOICE";
19874
- ProductOptionTypeEnum["COLOR_PICKER"] = "COLOR_PICKER";
19875
- ProductOptionTypeEnum["DATE_PICKER"] = "DATE_PICKER";
19876
- ProductOptionTypeEnum["FILE"] = "FILE";
19877
- ProductOptionTypeEnum["IMAGE"] = "IMAGE";
19878
- ProductOptionTypeEnum["TEXT"] = "TEXT";
19879
- ProductOptionTypeEnum["TEXT_AREA"] = "TEXT_AREA";
19880
- })(ProductOptionTypeEnum || (ProductOptionTypeEnum = {}));
19881
- var IkasOrderLineOptions = /** @class */ (function () {
19882
- function IkasOrderLineOptions(data) {
19883
- this.name = data.name;
19884
- this.productOptionId = data.productOptionId;
19885
- this.productOptionsSetId = data.productOptionsSetId;
19886
- this.type = data.type;
19887
- this.values = data.values;
19888
- }
19889
- return IkasOrderLineOptions;
19890
- }());
19891
-
19892
19870
  var IkasOrderLineItem = /** @class */ (function () {
19893
19871
  function IkasOrderLineItem(data) {
19894
19872
  this.discount = null;
@@ -19916,9 +19894,6 @@ var IkasOrderLineItem = /** @class */ (function () {
19916
19894
  ? new IkasOrderLineVariant(data.variant)
19917
19895
  : new IkasOrderLineVariant();
19918
19896
  this.status = data.status || OrderLineItemStatusEnum.FULFILLED;
19919
- this.options = data.options
19920
- ? data.options.map(function (oP) { return new IkasOrderLineOptions(oP); })
19921
- : null;
19922
19897
  makeAutoObservable(this);
19923
19898
  }
19924
19899
  Object.defineProperty(IkasOrderLineItem.prototype, "orderedAtDays", {
@@ -21184,19 +21159,6 @@ var IkasProduct = /** @class */ (function () {
21184
21159
  enumerable: false,
21185
21160
  configurable: true
21186
21161
  });
21187
- Object.defineProperty(IkasProduct.prototype, "canAddToCart", {
21188
- get: function () {
21189
- if (this.productOptionSetId) {
21190
- return (!!this.productOptionSet &&
21191
- this.productOptionSet.options.every(function (o) { return o.hasValidValues; }));
21192
- }
21193
- else {
21194
- return true;
21195
- }
21196
- },
21197
- enumerable: false,
21198
- configurable: true
21199
- });
21200
21162
  return IkasProduct;
21201
21163
  }());
21202
21164
  var IkasProductType;
@@ -24053,8 +24015,8 @@ var IkasProductOptionType;
24053
24015
  IkasProductOptionType["CHOICE"] = "CHOICE";
24054
24016
  IkasProductOptionType["TEXT"] = "TEXT";
24055
24017
  IkasProductOptionType["TEXT_AREA"] = "TEXT_AREA";
24056
- // IMAGE = "IMAGE",
24057
- // FILE = "FILE",
24018
+ IkasProductOptionType["IMAGE"] = "IMAGE";
24019
+ IkasProductOptionType["FILE"] = "FILE";
24058
24020
  IkasProductOptionType["COLOR_PICKER"] = "COLOR_PICKER";
24059
24021
  // DATE_PICKER = "DATE_PICKER",
24060
24022
  IkasProductOptionType["CHECKBOX"] = "CHECKBOX";
@@ -24098,16 +24060,16 @@ var IkasProductOptionSetTranslations = /** @class */ (function () {
24098
24060
  var IkasProductOptionSelectValue = /** @class */ (function () {
24099
24061
  function IkasProductOptionSelectValue(data) {
24100
24062
  if (data === void 0) { data = {}; }
24101
- this.thumbnailImage = null;
24102
- this.id = data.id || "";
24103
24063
  this.order = data.order || 0;
24104
24064
  this.value = data.value || "";
24105
24065
  this.price = data.price || null;
24106
24066
  this.thumbnailImageId = data.thumbnailImageId || null;
24107
24067
  this.colorCode = data.colorCode || null;
24108
- this.thumbnailImage = this.thumbnailImageId
24109
- ? new IkasImage(this.thumbnailImageId)
24110
- : null;
24068
+ this.thumbnailImage =
24069
+ data.thumbnailImage ||
24070
+ (this.thumbnailImageId
24071
+ ? new IkasImage(this.thumbnailImageId)
24072
+ : undefined);
24111
24073
  makeAutoObservable(this);
24112
24074
  }
24113
24075
  return IkasProductOptionSelectValue;
@@ -24117,14 +24079,8 @@ var IkasProductOptionSelectSettings = /** @class */ (function () {
24117
24079
  if (data === void 0) { data = {}; }
24118
24080
  var _a;
24119
24081
  this.type = data.type || IkasProductOptionSelectType.BOX;
24120
- this.minSelect =
24121
- data.minSelect !== null && data.minSelect !== undefined
24122
- ? data.minSelect
24123
- : null;
24124
- this.maxSelect =
24125
- data.maxSelect !== null && data.maxSelect !== undefined
24126
- ? data.maxSelect
24127
- : null;
24082
+ this.minSelect = data.minSelect || null;
24083
+ this.maxSelect = data.maxSelect || null;
24128
24084
  this.values =
24129
24085
  ((_a = data.values) === null || _a === void 0 ? void 0 : _a.map(function (o) { return new IkasProductOptionSelectValue(o); })) || [];
24130
24086
  makeAutoObservable(this);
@@ -24142,8 +24098,8 @@ var IkasProductOptionDateSettings = /** @class */ (function () {
24142
24098
  var IkasProductOptionTextSettings = /** @class */ (function () {
24143
24099
  function IkasProductOptionTextSettings(data) {
24144
24100
  if (data === void 0) { data = {}; }
24145
- this.min = data.min !== null && data.min !== undefined ? data.min : null;
24146
- this.max = data.max !== null && data.max !== undefined ? data.max : null;
24101
+ this.min = data.min || null;
24102
+ this.max = data.max || null;
24147
24103
  makeAutoObservable(this);
24148
24104
  }
24149
24105
  return IkasProductOptionTextSettings;
@@ -24151,51 +24107,14 @@ var IkasProductOptionTextSettings = /** @class */ (function () {
24151
24107
  var IkasProductOptionFileSettings = /** @class */ (function () {
24152
24108
  function IkasProductOptionFileSettings(data) {
24153
24109
  this.allowedExtensions = data.allowedExtensions || null;
24154
- this.minQuantity =
24155
- data.minQuantity !== null && data.minQuantity !== undefined
24156
- ? data.minQuantity
24157
- : null;
24158
- this.maxQuantity =
24159
- data.maxQuantity !== null && data.maxQuantity !== undefined
24160
- ? data.maxQuantity
24161
- : null;
24110
+ this.minQuantity = data.minQuantity || null;
24111
+ this.maxQuantity = data.maxQuantity || null;
24162
24112
  makeAutoObservable(this);
24163
24113
  }
24164
24114
  return IkasProductOptionFileSettings;
24165
24115
  }());
24166
24116
  var IkasProductOption = /** @class */ (function () {
24167
24117
  function IkasProductOption(data) {
24168
- var _this = this;
24169
- this._values = [];
24170
- this.childOptions = [];
24171
- this.initValues = function () {
24172
- if (!_this.isOptional) {
24173
- _this.values = [];
24174
- if (_this.childOptions) {
24175
- _this.childOptions.forEach(function (co) { return co.initValues(); });
24176
- }
24177
- }
24178
- };
24179
- this.isValidTextOptionValue = function () {
24180
- return (!!_this.textSettings &&
24181
- (_this.textSettings.min !== null
24182
- ? _this.values[0].length >= _this.textSettings.min
24183
- : true) &&
24184
- (_this.textSettings.max !== null
24185
- ? _this.values[0].length <= _this.textSettings.max
24186
- : true));
24187
- };
24188
- this.isValidChoiceOptionValue = function () {
24189
- return (!!_this.selectSettings &&
24190
- (_this.selectSettings.minSelect !== null
24191
- ? _this.values.length >= _this.selectSettings.minSelect
24192
- : true) &&
24193
- (_this.selectSettings.maxSelect !== null
24194
- ? _this.values.length <= _this.selectSettings.maxSelect
24195
- : true));
24196
- };
24197
- this.id = data.id || "";
24198
- this.productOptionSetId = data.productOptionSetId || "";
24199
24118
  this.name = data.name || "";
24200
24119
  this.order = data.order || 0;
24201
24120
  this.type = data.type || IkasProductOptionType.CHOICE;
@@ -24216,135 +24135,122 @@ var IkasProductOption = /** @class */ (function () {
24216
24135
  this.optionalText = data.optionalText || null;
24217
24136
  this.requiredOptionId = data.requiredOptionId || null;
24218
24137
  this.requiredOptionValueIds = data.requiredOptionValueIds || null;
24219
- this.values = data.values || [];
24220
- this.childOptions = data.childOptions || [];
24221
24138
  makeAutoObservable(this);
24222
24139
  }
24223
- Object.defineProperty(IkasProductOption.prototype, "displayedChildOptions", {
24224
- get: function () {
24225
- var _this = this;
24226
- return this.childOptions.filter(function (co) {
24227
- var _a;
24228
- // Check if all required options are selected
24229
- if ((_a = co.requiredOptionValueIds) === null || _a === void 0 ? void 0 : _a.length) {
24230
- return co.requiredOptionValueIds.every(function (rovId) {
24231
- return _this.values.some(function (v) { return v === rovId; });
24232
- });
24233
- }
24234
- else {
24235
- return !!_this.values.length;
24236
- }
24237
- });
24238
- },
24239
- enumerable: false,
24240
- configurable: true
24241
- });
24242
- Object.defineProperty(IkasProductOption.prototype, "hasValidValues", {
24243
- get: function () {
24244
- if (!this.values.length && !this.isOptional) {
24245
- return false;
24246
- }
24247
- var hasValidValues = false;
24248
- switch (this.type) {
24249
- case IkasProductOptionType.TEXT:
24250
- case IkasProductOptionType.TEXT_AREA:
24251
- hasValidValues = this.isValidTextOptionValue();
24252
- break;
24253
- case IkasProductOptionType.CHECKBOX:
24254
- case IkasProductOptionType.COLOR_PICKER:
24255
- hasValidValues = true;
24256
- break;
24257
- case IkasProductOptionType.CHOICE:
24258
- hasValidValues = this.isValidChoiceOptionValue();
24259
- break;
24260
- }
24261
- return hasValidValues && this.childOptions.every(function (co) { return co.hasValidValues; });
24262
- },
24263
- enumerable: false,
24264
- configurable: true
24265
- });
24266
- Object.defineProperty(IkasProductOption.prototype, "values", {
24267
- get: function () {
24268
- return this._values;
24269
- },
24270
- set: function (values) {
24271
- this._values = values;
24272
- if (!values.length) {
24273
- this.childOptions.forEach(function (co) { return (co.values = []); });
24274
- }
24275
- },
24276
- enumerable: false,
24277
- configurable: true
24278
- });
24279
24140
  return IkasProductOption;
24280
24141
  }());
24281
24142
  var IkasProductOptionSet = /** @class */ (function () {
24282
24143
  function IkasProductOptionSet(data) {
24283
- var _this = this;
24284
24144
  var _a, _b;
24285
- this.initOptionValues = function () { return __awaiter(_this, void 0, void 0, function () {
24286
- return __generator(this, function (_a) {
24287
- this.options.forEach(function (o) { return o.initValues(); });
24288
- return [2 /*return*/];
24289
- });
24290
- }); };
24291
- this.id = data.id || "";
24292
24145
  this.name = data.name || "";
24293
- this.options =
24294
- ((_a = data.options) === null || _a === void 0 ? void 0 : _a.map(function (o) {
24295
- return new IkasProductOption(__assign(__assign({}, o), { productOptionSetId: _this.id }));
24296
- })) || [];
24146
+ this.options = ((_a = data.options) === null || _a === void 0 ? void 0 : _a.map(function (o) { return new IkasProductOption(o); })) || [];
24297
24147
  this.translations = data.translations
24298
24148
  ? (_b = data.translations) === null || _b === void 0 ? void 0 : _b.map(function (o) { return new IkasProductOptionSetTranslations(o); }) : null;
24299
- this.setChildOptions();
24300
- this.setTranslations();
24301
- this.initOptionValues();
24302
24149
  makeAutoObservable(this);
24303
24150
  }
24304
- Object.defineProperty(IkasProductOptionSet.prototype, "displayedOptions", {
24151
+ return IkasProductOptionSet;
24152
+ }());
24153
+
24154
+ var RaffleDateRangeField = /** @class */ (function () {
24155
+ function RaffleDateRangeField(data) {
24156
+ this.start = data.start || null;
24157
+ this.end = data.end || null;
24158
+ makeAutoObservable(this);
24159
+ }
24160
+ return RaffleDateRangeField;
24161
+ }());
24162
+ var IkasRaffleVerificationTypeEnum;
24163
+ (function (IkasRaffleVerificationTypeEnum) {
24164
+ IkasRaffleVerificationTypeEnum["EMAIL"] = "EMAIL";
24165
+ IkasRaffleVerificationTypeEnum["MERSIS"] = "MERSIS";
24166
+ })(IkasRaffleVerificationTypeEnum || (IkasRaffleVerificationTypeEnum = {}));
24167
+ var IkasRaffle = /** @class */ (function () {
24168
+ function IkasRaffle(data) {
24169
+ if (data === void 0) { data = {}; }
24170
+ var _a;
24171
+ this.id = data.id || Date.now() + "";
24172
+ this.createdAt = data.createdAt || Date.now();
24173
+ this.updatedAt = data.updatedAt || Date.now();
24174
+ this.deleted = data.deleted || null;
24175
+ this.name = data.name || "";
24176
+ this.participantCount = data.participantCount || 0;
24177
+ this.requiredCustomerAccount = data.requiredCustomerAccount || false;
24178
+ this.status = data.status || false;
24179
+ this.verificationType =
24180
+ data.verificationType || IkasRaffleVerificationTypeEnum.EMAIL;
24181
+ this.dateRange = data.dateRange
24182
+ ? new RaffleDateRangeField(data.dateRange)
24183
+ : null;
24184
+ this.metadata = data.metadata
24185
+ ? new IkasRaffleMetaData(data.metadata)
24186
+ : null;
24187
+ this.variants =
24188
+ ((_a = data.variants) === null || _a === void 0 ? void 0 : _a.map(function (v) { return new IkasRaffleAppliedProduct(v); })) || [];
24189
+ }
24190
+ Object.defineProperty(IkasRaffle.prototype, "isRaffleAvailable", {
24305
24191
  get: function () {
24306
- return this.options.filter(function (o) { return !o.requiredOptionId; });
24192
+ var _a, _b;
24193
+ var now = moment().utc(true);
24194
+ if (!this.status)
24195
+ return false;
24196
+ else if (!now.isBetween((_a = this.dateRange) === null || _a === void 0 ? void 0 : _a.start, (_b = this.dateRange) === null || _b === void 0 ? void 0 : _b.end, undefined, "[]"))
24197
+ return false;
24198
+ else
24199
+ return true;
24307
24200
  },
24308
24201
  enumerable: false,
24309
24202
  configurable: true
24310
24203
  });
24311
- IkasProductOptionSet.prototype.setTranslations = function () {
24312
- var _this = this;
24313
- var _a;
24314
- var locale = IkasStorefrontConfig.getCurrentLocale();
24315
- if (this.translations &&
24316
- this.translations.some(function (t) { return t.locale === locale; })) {
24317
- var localeTranslations = this.translations.find(function (t) { return t.locale === locale; });
24318
- (_a = localeTranslations === null || localeTranslations === void 0 ? void 0 : localeTranslations.options) === null || _a === void 0 ? void 0 : _a.forEach(function (translatedOption) {
24319
- var _a;
24320
- var option = _this.options.find(function (o) { return o.id === translatedOption.id; });
24321
- if (option) {
24322
- option.name = translatedOption.name || option.name;
24323
- option.optionalText =
24324
- translatedOption.optionalText || option.optionalText;
24325
- if (option.type === IkasProductOptionType.CHOICE) {
24326
- (_a = translatedOption.values) === null || _a === void 0 ? void 0 : _a.forEach(function (translatedValue) {
24327
- var _a;
24328
- var selectValue = (_a = option.selectSettings) === null || _a === void 0 ? void 0 : _a.values.find(function (sv) { return sv.id === translatedValue.id; });
24329
- if (selectValue) {
24330
- selectValue.value = translatedValue.value || selectValue.value;
24331
- }
24332
- });
24333
- }
24334
- }
24335
- });
24336
- }
24337
- };
24338
- IkasProductOptionSet.prototype.setChildOptions = function () {
24339
- var _this = this;
24340
- this.options.forEach(function (option) {
24341
- var childOptions = _this.options.filter(function (o) { return o.requiredOptionId === option.id; });
24342
- if (childOptions.length) {
24343
- option.childOptions = childOptions;
24344
- }
24345
- });
24346
- };
24347
- return IkasProductOptionSet;
24204
+ return IkasRaffle;
24205
+ }());
24206
+ var IkasRaffleMetadataTargetType;
24207
+ (function (IkasRaffleMetadataTargetType) {
24208
+ IkasRaffleMetadataTargetType["RAFFLE"] = "RAFFLE";
24209
+ })(IkasRaffleMetadataTargetType || (IkasRaffleMetadataTargetType = {}));
24210
+ var IkasRaffleMetaData = /** @class */ (function () {
24211
+ function IkasRaffleMetaData(data) {
24212
+ this.id = data.id || Date.now() + "";
24213
+ this.createdAt = data.createdAt || Date.now();
24214
+ this.updatedAt = data.updatedAt || Date.now();
24215
+ this.deleted = data.deleted || null;
24216
+ this.description = data.description || "";
24217
+ this.pageTitle = data.pageTitle || "";
24218
+ this.slug = data.slug || "";
24219
+ this.targetId = data.targetId || "";
24220
+ this.targetType = data.targetType || IkasRaffleMetadataTargetType.RAFFLE;
24221
+ }
24222
+ return IkasRaffleMetaData;
24223
+ }());
24224
+ var IkasRaffleParticipant = /** @class */ (function () {
24225
+ function IkasRaffleParticipant(data) {
24226
+ this.id = data.id || null;
24227
+ this.createdAt = data.createdAt || Date.now();
24228
+ this.updatedAt = data.updatedAt || Date.now();
24229
+ this.deleted = data.deleted || false;
24230
+ this.customerId = data.customerId || null;
24231
+ this.raffleId = data.raffleId || "";
24232
+ this.firstName = data.firstName || "";
24233
+ this.lastName = data.lastName || "";
24234
+ this.fullName = data.fullName || null;
24235
+ this.email = data.email || "";
24236
+ this.applicationDate = data.applicationDate || 0;
24237
+ this.phone = data.phone || null;
24238
+ this.isWinner = data.isWinner || null;
24239
+ this.extraData = data.extraData || {};
24240
+ this.appliedProducts = data.appliedProducts
24241
+ ? data.appliedProducts.map(function (ap) { return new IkasRaffleAppliedProduct(ap); })
24242
+ : [];
24243
+ makeAutoObservable(this);
24244
+ }
24245
+ return IkasRaffleParticipant;
24246
+ }());
24247
+ var IkasRaffleAppliedProduct = /** @class */ (function () {
24248
+ function IkasRaffleAppliedProduct(data) {
24249
+ this.productId = data.productId || "";
24250
+ this.variantId = data.variantId || "";
24251
+ makeAutoObservable(this);
24252
+ }
24253
+ return IkasRaffleAppliedProduct;
24348
24254
  }());
24349
24255
 
24350
24256
  var IkasThemeComponentProp = /** @class */ (function () {
@@ -24385,6 +24291,8 @@ var IkasThemeComponentPropType;
24385
24291
  IkasThemeComponentPropType["BLOG_LIST"] = "BLOG_LIST";
24386
24292
  IkasThemeComponentPropType["BLOG_CATEGORY"] = "BLOG_CATEGORY";
24387
24293
  IkasThemeComponentPropType["BLOG_CATEGORY_LIST"] = "BLOG_CATEGORY_LIST";
24294
+ IkasThemeComponentPropType["RAFFLE"] = "RAFFLE";
24295
+ IkasThemeComponentPropType["RAFFLE_LIST"] = "RAFFLE_LIST";
24388
24296
  IkasThemeComponentPropType["OBJECT"] = "OBJECT";
24389
24297
  IkasThemeComponentPropType["STATIC_LIST"] = "STATIC_LIST";
24390
24298
  IkasThemeComponentPropType["DYNAMIC_LIST"] = "DYNAMIC_LIST";
@@ -24512,6 +24420,9 @@ var IkasThemePageType;
24512
24420
  IkasThemePageType["BLOG_INDEX"] = "BLOG_INDEX";
24513
24421
  IkasThemePageType["BLOG_CATEGORY"] = "BLOG_CATEGORY";
24514
24422
  IkasThemePageType["CHECKOUT"] = "CHECKOUT";
24423
+ IkasThemePageType["RAFFLE"] = "RAFFLE";
24424
+ IkasThemePageType["RAFFLE_DETAIL"] = "RAFFLE_DETAIL";
24425
+ IkasThemePageType["RAFFLE_ACOUNT"] = "RAFFLE_ACCOUNT";
24515
24426
  })(IkasThemePageType || (IkasThemePageType = {}));
24516
24427
 
24517
24428
  // Unique ID creation requires a high quality random # generator. In the browser we therefore
@@ -37961,7 +37872,7 @@ var ProductOptionSelectTypeEnum;
37961
37872
  ProductOptionSelectTypeEnum["SELECT"] = "SELECT";
37962
37873
  ProductOptionSelectTypeEnum["SWATCH"] = "SWATCH";
37963
37874
  })(ProductOptionSelectTypeEnum || (ProductOptionSelectTypeEnum = {}));
37964
- var ProductOptionTypeEnum$1;
37875
+ var ProductOptionTypeEnum;
37965
37876
  (function (ProductOptionTypeEnum) {
37966
37877
  ProductOptionTypeEnum["CHECKBOX"] = "CHECKBOX";
37967
37878
  ProductOptionTypeEnum["CHOICE"] = "CHOICE";
@@ -37971,13 +37882,20 @@ var ProductOptionTypeEnum$1;
37971
37882
  ProductOptionTypeEnum["IMAGE"] = "IMAGE";
37972
37883
  ProductOptionTypeEnum["TEXT"] = "TEXT";
37973
37884
  ProductOptionTypeEnum["TEXT_AREA"] = "TEXT_AREA";
37974
- })(ProductOptionTypeEnum$1 || (ProductOptionTypeEnum$1 = {}));
37885
+ })(ProductOptionTypeEnum || (ProductOptionTypeEnum = {}));
37975
37886
  var ProductSearchShowStockOptionEnum;
37976
37887
  (function (ProductSearchShowStockOptionEnum) {
37977
37888
  ProductSearchShowStockOptionEnum["HIDE_OUT_OF_STOCK"] = "HIDE_OUT_OF_STOCK";
37978
37889
  ProductSearchShowStockOptionEnum["SHOW_ALL"] = "SHOW_ALL";
37979
37890
  ProductSearchShowStockOptionEnum["SHOW_OUT_OF_STOCK_AT_END"] = "SHOW_OUT_OF_STOCK_AT_END";
37980
37891
  })(ProductSearchShowStockOptionEnum || (ProductSearchShowStockOptionEnum = {}));
37892
+ /**
37893
+ * RaffleMetadataTargetTypeEnum
37894
+ */
37895
+ var RaffleMetadataTargetTypeEnum;
37896
+ (function (RaffleMetadataTargetTypeEnum) {
37897
+ RaffleMetadataTargetTypeEnum["RAFFLE"] = "RAFFLE";
37898
+ })(RaffleMetadataTargetTypeEnum || (RaffleMetadataTargetTypeEnum = {}));
37981
37899
  /**
37982
37900
  * Shipping Method Enum
37983
37901
  */
@@ -38060,6 +37978,14 @@ var VariantSelectionTypeEnum;
38060
37978
  VariantSelectionTypeEnum["CHOICE"] = "CHOICE";
38061
37979
  VariantSelectionTypeEnum["COLOR"] = "COLOR";
38062
37980
  })(VariantSelectionTypeEnum || (VariantSelectionTypeEnum = {}));
37981
+ /**
37982
+ * Verification Type Enum
37983
+ */
37984
+ var VerificationTypeEnum;
37985
+ (function (VerificationTypeEnum) {
37986
+ VerificationTypeEnum["EMAIL"] = "EMAIL";
37987
+ VerificationTypeEnum["MERSIS"] = "MERSIS";
37988
+ })(VerificationTypeEnum || (VerificationTypeEnum = {}));
38063
37989
  //==============================================================
38064
37990
  // END Enums and Input Objects
38065
37991
  //==============================================================
@@ -39742,6 +39668,75 @@ var EqualsRule = /** @class */ (function (_super) {
39742
39668
  });
39743
39669
  };
39744
39670
  return EqualsRule;
39671
+ }(ValidationRule));
39672
+ var IdentityNumberRule = /** @class */ (function (_super) {
39673
+ __extends(IdentityNumberRule, _super);
39674
+ function IdentityNumberRule() {
39675
+ return _super !== null && _super.apply(this, arguments) || this;
39676
+ }
39677
+ Object.defineProperty(IdentityNumberRule.prototype, "errorMessage", {
39678
+ get: function () {
39679
+ if (!this.message)
39680
+ return "";
39681
+ if (typeof this.message === "string")
39682
+ return this.message;
39683
+ return this.message(this.model);
39684
+ },
39685
+ enumerable: false,
39686
+ configurable: true
39687
+ });
39688
+ IdentityNumberRule.prototype.run = function () {
39689
+ return __awaiter(this, void 0, void 0, function () {
39690
+ var identityNumber, tcknString, odd, even, result, TCSum, incorrect, i;
39691
+ return __generator(this, function (_a) {
39692
+ identityNumber = this.value;
39693
+ if (!identityNumber)
39694
+ return [2 /*return*/, false];
39695
+ tcknString = identityNumber.toString();
39696
+ odd = 0, even = 0, result = 0, TCSum = 0, incorrect = [
39697
+ 11111111110,
39698
+ 22222222220,
39699
+ 33333333330,
39700
+ 44444444440,
39701
+ 55555555550,
39702
+ 66666666660,
39703
+ 7777777770,
39704
+ 88888888880,
39705
+ 99999999990,
39706
+ ];
39707
+ if (tcknString.length !== 11)
39708
+ return [2 /*return*/, false];
39709
+ if (isNaN(identityNumber))
39710
+ return [2 /*return*/, false];
39711
+ if (tcknString[0] === "0")
39712
+ return [2 /*return*/, false];
39713
+ odd =
39714
+ parseInt(tcknString[0]) +
39715
+ parseInt(tcknString[2]) +
39716
+ parseInt(tcknString[4]) +
39717
+ parseInt(tcknString[6]) +
39718
+ parseInt(tcknString[8]);
39719
+ even =
39720
+ parseInt(tcknString[1]) +
39721
+ parseInt(tcknString[3]) +
39722
+ parseInt(tcknString[5]) +
39723
+ parseInt(tcknString[7]);
39724
+ odd = odd * 7;
39725
+ result = Math.abs(odd - even);
39726
+ if (result % 10 !== parseInt(tcknString[9]))
39727
+ return [2 /*return*/, false];
39728
+ for (i = 0; i < 10; i++) {
39729
+ TCSum += parseInt(tcknString[i]);
39730
+ }
39731
+ if (TCSum % 10 !== parseInt(tcknString[10]))
39732
+ return [2 /*return*/, false];
39733
+ if (incorrect.toString().indexOf(tcknString) !== -1)
39734
+ return [2 /*return*/, false];
39735
+ return [2 /*return*/, true];
39736
+ });
39737
+ });
39738
+ };
39739
+ return IdentityNumberRule;
39745
39740
  }(ValidationRule));
39746
39741
 
39747
39742
  var LoginForm = /** @class */ (function () {
@@ -41146,6 +41141,281 @@ var AccountInfoForm = /** @class */ (function () {
41146
41141
  return AccountInfoForm;
41147
41142
  }());
41148
41143
 
41144
+ var RaffleForm = /** @class */ (function () {
41145
+ function RaffleForm(props) {
41146
+ var _this = this;
41147
+ var _a, _b, _c;
41148
+ this.model = {
41149
+ firstName: ((_a = IkasStorefrontConfig.store.customerStore.customer) === null || _a === void 0 ? void 0 : _a.firstName) || "",
41150
+ lastName: ((_b = IkasStorefrontConfig.store.customerStore.customer) === null || _b === void 0 ? void 0 : _b.lastName) || "",
41151
+ email: ((_c = IkasStorefrontConfig.store.customerStore.customer) === null || _c === void 0 ? void 0 : _c.email) || "",
41152
+ extraData: {
41153
+ birthYear: null,
41154
+ identityNumber: null,
41155
+ },
41156
+ phone: "",
41157
+ };
41158
+ this.onFirstNameChange = function (value) {
41159
+ _this.firstName = value;
41160
+ };
41161
+ this.onLastNameChange = function (value) {
41162
+ _this.lastName = value;
41163
+ };
41164
+ this.onEmailChange = function (value) {
41165
+ _this.email = value;
41166
+ };
41167
+ this.onBirthYearChange = function (value) {
41168
+ _this.birthYear = value;
41169
+ };
41170
+ this.onIdentityNumberChange = function (value) {
41171
+ _this.identityNumber = value;
41172
+ };
41173
+ this.onPhoneChange = function (value) {
41174
+ _this.phone = value;
41175
+ };
41176
+ makeObservable(this, {
41177
+ emailErrorMessage: computed,
41178
+ firstNameErrorMessage: computed,
41179
+ lastNameErrorMessage: computed,
41180
+ birthYearErrorMessage: computed,
41181
+ identityNumberErrorMessage: computed,
41182
+ hasValidatorError: computed,
41183
+ results: computed,
41184
+ redirect: computed,
41185
+ model: observable,
41186
+ validateAll: action,
41187
+ });
41188
+ this.raffle = props.raffle;
41189
+ this.validator = new Validator(this.model, [
41190
+ new RequiredRule({
41191
+ fieldKey: "firstName",
41192
+ valuePath: "firstName",
41193
+ message: props.message.requiredRule,
41194
+ }),
41195
+ new RequiredRule({
41196
+ fieldKey: "lastName",
41197
+ valuePath: "lastName",
41198
+ message: props.message.requiredRule,
41199
+ }),
41200
+ new RequiredRule({
41201
+ fieldKey: "email",
41202
+ valuePath: "email",
41203
+ message: props.message.requiredRule,
41204
+ }),
41205
+ new RequiredRule({
41206
+ fieldKey: "birthYear",
41207
+ valuePath: "extraData.birthYear",
41208
+ message: props.message.requiredRule,
41209
+ }),
41210
+ new RequiredRule({
41211
+ fieldKey: "identityNumber",
41212
+ valuePath: "extraData.identityNumber",
41213
+ message: props.message.requiredRule,
41214
+ }),
41215
+ new EmailRule({
41216
+ fieldKey: "email",
41217
+ valuePath: "email",
41218
+ message: props.message.emailRule,
41219
+ }),
41220
+ new PhoneRule({
41221
+ fieldKey: "phone",
41222
+ valuePath: "phone",
41223
+ message: props.message.phoneRule,
41224
+ }),
41225
+ new MinRule({
41226
+ fieldKey: "birthYear",
41227
+ valuePath: "extraData.birthYear",
41228
+ message: props.message.birthdayRule,
41229
+ minValue: 1000,
41230
+ }),
41231
+ new MaxRule({
41232
+ fieldKey: "birthYear",
41233
+ valuePath: "extraData.birthYear",
41234
+ message: props.message.birthdayRule,
41235
+ maxValue: 9999,
41236
+ }),
41237
+ new IdentityNumberRule({
41238
+ fieldKey: "identityNumber",
41239
+ valuePath: "extraData.identityNumber",
41240
+ message: props.message.identityNumberRule,
41241
+ }),
41242
+ ]);
41243
+ }
41244
+ Object.defineProperty(RaffleForm.prototype, "firstName", {
41245
+ get: function () {
41246
+ return this.model.firstName;
41247
+ },
41248
+ set: function (value) {
41249
+ this.model.firstName = value;
41250
+ },
41251
+ enumerable: false,
41252
+ configurable: true
41253
+ });
41254
+ Object.defineProperty(RaffleForm.prototype, "lastName", {
41255
+ get: function () {
41256
+ return this.model.lastName;
41257
+ },
41258
+ set: function (value) {
41259
+ this.model.lastName = value;
41260
+ },
41261
+ enumerable: false,
41262
+ configurable: true
41263
+ });
41264
+ Object.defineProperty(RaffleForm.prototype, "email", {
41265
+ get: function () {
41266
+ return this.model.email;
41267
+ },
41268
+ set: function (value) {
41269
+ this.model.email = value;
41270
+ },
41271
+ enumerable: false,
41272
+ configurable: true
41273
+ });
41274
+ Object.defineProperty(RaffleForm.prototype, "birthYear", {
41275
+ get: function () {
41276
+ return this.model.extraData.birthYear;
41277
+ },
41278
+ set: function (value) {
41279
+ this.model.extraData.birthYear = value;
41280
+ },
41281
+ enumerable: false,
41282
+ configurable: true
41283
+ });
41284
+ Object.defineProperty(RaffleForm.prototype, "identityNumber", {
41285
+ get: function () {
41286
+ return this.model.extraData.identityNumber;
41287
+ },
41288
+ set: function (value) {
41289
+ this.model.extraData.identityNumber = value;
41290
+ },
41291
+ enumerable: false,
41292
+ configurable: true
41293
+ });
41294
+ Object.defineProperty(RaffleForm.prototype, "phone", {
41295
+ get: function () {
41296
+ return this.model.phone;
41297
+ },
41298
+ set: function (value) {
41299
+ this.model.phone = value;
41300
+ },
41301
+ enumerable: false,
41302
+ configurable: true
41303
+ });
41304
+ Object.defineProperty(RaffleForm.prototype, "firstNameErrorMessage", {
41305
+ get: function () {
41306
+ return this.validator.results.firstName.errorMessage;
41307
+ },
41308
+ enumerable: false,
41309
+ configurable: true
41310
+ });
41311
+ Object.defineProperty(RaffleForm.prototype, "lastNameErrorMessage", {
41312
+ get: function () {
41313
+ return this.validator.results.lastName.errorMessage;
41314
+ },
41315
+ enumerable: false,
41316
+ configurable: true
41317
+ });
41318
+ Object.defineProperty(RaffleForm.prototype, "emailErrorMessage", {
41319
+ get: function () {
41320
+ return this.validator.results.email.errorMessage;
41321
+ },
41322
+ enumerable: false,
41323
+ configurable: true
41324
+ });
41325
+ Object.defineProperty(RaffleForm.prototype, "birthYearErrorMessage", {
41326
+ get: function () {
41327
+ return this.validator.results.birthYear.errorMessage;
41328
+ },
41329
+ enumerable: false,
41330
+ configurable: true
41331
+ });
41332
+ Object.defineProperty(RaffleForm.prototype, "identityNumberErrorMessage", {
41333
+ get: function () {
41334
+ return this.validator.results.identityNumber.errorMessage;
41335
+ },
41336
+ enumerable: false,
41337
+ configurable: true
41338
+ });
41339
+ Object.defineProperty(RaffleForm.prototype, "phoneErrorMessage", {
41340
+ get: function () {
41341
+ return this.validator.results.phone.errorMessage;
41342
+ },
41343
+ enumerable: false,
41344
+ configurable: true
41345
+ });
41346
+ Object.defineProperty(RaffleForm.prototype, "redirect", {
41347
+ get: function () {
41348
+ if (typeof window !== "undefined") {
41349
+ var urlSearch = new URLSearchParams(window.location.search);
41350
+ return urlSearch.get("redirect");
41351
+ }
41352
+ },
41353
+ enumerable: false,
41354
+ configurable: true
41355
+ });
41356
+ Object.defineProperty(RaffleForm.prototype, "hasValidatorError", {
41357
+ get: function () {
41358
+ return this.validator.hasError;
41359
+ },
41360
+ enumerable: false,
41361
+ configurable: true
41362
+ });
41363
+ Object.defineProperty(RaffleForm.prototype, "results", {
41364
+ get: function () {
41365
+ return this.validator.results;
41366
+ },
41367
+ enumerable: false,
41368
+ configurable: true
41369
+ });
41370
+ RaffleForm.prototype.validateAll = function () {
41371
+ return this.validator.validateAll();
41372
+ };
41373
+ RaffleForm.prototype.submit = function () {
41374
+ return __awaiter(this, void 0, void 0, function () {
41375
+ var response, hasFormError, isRaffleFormSuccess;
41376
+ return __generator(this, function (_a) {
41377
+ switch (_a.label) {
41378
+ case 0:
41379
+ response = { isFormError: false, isSuccess: false };
41380
+ return [4 /*yield*/, this.validateAll()];
41381
+ case 1:
41382
+ hasFormError = _a.sent();
41383
+ if (hasFormError) {
41384
+ response.isFormError = true;
41385
+ return [2 /*return*/, response];
41386
+ }
41387
+ _a.label = 2;
41388
+ case 2:
41389
+ _a.trys.push([2, 4, , 5]);
41390
+ return [4 /*yield*/, IkasRaffleAPI.saveRaffleParticipant(new IkasRaffleParticipant({
41391
+ appliedProducts: this.raffle.variants || [],
41392
+ email: this.email,
41393
+ firstName: this.firstName,
41394
+ lastName: this.lastName,
41395
+ raffleId: this.raffle.id,
41396
+ extraData: {
41397
+ birthYear: this.birthYear,
41398
+ identityNumber: this.identityNumber,
41399
+ },
41400
+ phone: this.phone,
41401
+ }))];
41402
+ case 3:
41403
+ isRaffleFormSuccess = _a.sent();
41404
+ if (isRaffleFormSuccess) {
41405
+ response.isSuccess = true;
41406
+ }
41407
+ return [2 /*return*/, response];
41408
+ case 4:
41409
+ _a.sent();
41410
+ return [2 /*return*/, response];
41411
+ case 5: return [2 /*return*/];
41412
+ }
41413
+ });
41414
+ });
41415
+ };
41416
+ return RaffleForm;
41417
+ }());
41418
+
41149
41419
  var CustomerReviewForm = /** @class */ (function () {
41150
41420
  function CustomerReviewForm(props) {
41151
41421
  var _this = this;
@@ -41286,6 +41556,263 @@ var IkasComponentRenderer = /** @class */ (function () {
41286
41556
  return IkasComponentRenderer;
41287
41557
  }());
41288
41558
 
41559
+ var IkasRaffleList = /** @class */ (function () {
41560
+ function IkasRaffleList(data) {
41561
+ var _this = this;
41562
+ if (data === void 0) { data = {}; }
41563
+ this._initialized = false;
41564
+ this._minPage = null;
41565
+ this._isLoading = false;
41566
+ this.getInitial = function () { return __awaiter(_this, void 0, void 0, function () {
41567
+ var response, err_1;
41568
+ var _this = this;
41569
+ return __generator(this, function (_a) {
41570
+ switch (_a.label) {
41571
+ case 0:
41572
+ if (this._isLoading)
41573
+ return [2 /*return*/];
41574
+ this._isLoading = true;
41575
+ _a.label = 1;
41576
+ case 1:
41577
+ _a.trys.push([1, 3, 4, 5]);
41578
+ return [4 /*yield*/, this.getRaffleList(this.page, this.limit)];
41579
+ case 2:
41580
+ response = _a.sent();
41581
+ this.data = response.raffles;
41582
+ this._count = response.count;
41583
+ this._initialized = true;
41584
+ this._minPage = this.page;
41585
+ return [3 /*break*/, 5];
41586
+ case 3:
41587
+ err_1 = _a.sent();
41588
+ console.log(err_1);
41589
+ return [3 /*break*/, 5];
41590
+ case 4:
41591
+ runInAction(function () {
41592
+ _this._isLoading = false;
41593
+ });
41594
+ return [7 /*endfinally*/];
41595
+ case 5: return [2 /*return*/];
41596
+ }
41597
+ });
41598
+ }); };
41599
+ this.getPrev = function () { return __awaiter(_this, void 0, void 0, function () {
41600
+ var minPage_1, response_1, err_2;
41601
+ var _this = this;
41602
+ return __generator(this, function (_a) {
41603
+ switch (_a.label) {
41604
+ case 0:
41605
+ if (this._isLoading || !this.hasPrev)
41606
+ return [2 /*return*/];
41607
+ this._isLoading = true;
41608
+ _a.label = 1;
41609
+ case 1:
41610
+ _a.trys.push([1, 3, 4, 5]);
41611
+ minPage_1 = this._minPage - 1;
41612
+ return [4 /*yield*/, this.getRaffleList(minPage_1, this.limit)];
41613
+ case 2:
41614
+ response_1 = _a.sent();
41615
+ runInAction(function () {
41616
+ _this.data = response_1.raffles.concat(_this.data);
41617
+ _this._count = response_1.count;
41618
+ _this._minPage = minPage_1;
41619
+ });
41620
+ return [3 /*break*/, 5];
41621
+ case 3:
41622
+ err_2 = _a.sent();
41623
+ console.log(err_2);
41624
+ return [3 /*break*/, 5];
41625
+ case 4:
41626
+ runInAction(function () {
41627
+ _this._isLoading = false;
41628
+ });
41629
+ return [7 /*endfinally*/];
41630
+ case 5: return [2 /*return*/];
41631
+ }
41632
+ });
41633
+ }); };
41634
+ this.getNext = function () { return __awaiter(_this, void 0, void 0, function () {
41635
+ var response_2, err_3;
41636
+ var _this = this;
41637
+ return __generator(this, function (_a) {
41638
+ switch (_a.label) {
41639
+ case 0:
41640
+ if (this._isLoading || !this.hasNext)
41641
+ return [2 /*return*/];
41642
+ this._isLoading = true;
41643
+ _a.label = 1;
41644
+ case 1:
41645
+ _a.trys.push([1, 3, 4, 5]);
41646
+ return [4 /*yield*/, this.getRaffleList(this.page + 1, this.limit)];
41647
+ case 2:
41648
+ response_2 = _a.sent();
41649
+ runInAction(function () {
41650
+ _this.data = _this.data.concat(response_2.raffles);
41651
+ _this._count = response_2.count;
41652
+ _this._page = _this.page + 1;
41653
+ });
41654
+ return [3 /*break*/, 5];
41655
+ case 3:
41656
+ err_3 = _a.sent();
41657
+ console.log(err_3);
41658
+ return [3 /*break*/, 5];
41659
+ case 4:
41660
+ runInAction(function () {
41661
+ _this._isLoading = false;
41662
+ });
41663
+ return [7 /*endfinally*/];
41664
+ case 5: return [2 /*return*/];
41665
+ }
41666
+ });
41667
+ }); };
41668
+ this.getPage = function (page) { return __awaiter(_this, void 0, void 0, function () {
41669
+ var response_3, err_4;
41670
+ var _this = this;
41671
+ return __generator(this, function (_a) {
41672
+ switch (_a.label) {
41673
+ case 0:
41674
+ if (this._isLoading)
41675
+ return [2 /*return*/];
41676
+ this._isLoading = true;
41677
+ _a.label = 1;
41678
+ case 1:
41679
+ _a.trys.push([1, 3, 4, 5]);
41680
+ return [4 /*yield*/, this.getRaffleList(page, this.limit)];
41681
+ case 2:
41682
+ response_3 = _a.sent();
41683
+ runInAction(function () {
41684
+ _this.data = response_3.raffles;
41685
+ _this._count = response_3.count;
41686
+ _this._page = page;
41687
+ _this._minPage = page;
41688
+ });
41689
+ return [3 /*break*/, 5];
41690
+ case 3:
41691
+ err_4 = _a.sent();
41692
+ console.log(err_4);
41693
+ return [3 /*break*/, 5];
41694
+ case 4:
41695
+ runInAction(function () {
41696
+ _this._isLoading = false;
41697
+ });
41698
+ return [7 /*endfinally*/];
41699
+ case 5: return [2 /*return*/];
41700
+ }
41701
+ });
41702
+ }); };
41703
+ this.data = data.data ? data.data.map(function (r) { return new IkasRaffle(r); }) : [];
41704
+ this._limit = data.limit || 20;
41705
+ this._page = data.page || 1;
41706
+ this._count = data.count || 0;
41707
+ this._initialized = data.initialized || false;
41708
+ this._minPage = data.minPage || null;
41709
+ this._start = data.start || null;
41710
+ this._end = data.end || null;
41711
+ this._includeDeleted = data.includeDeleted || null;
41712
+ this._name = data.name || null;
41713
+ this._search = data.search || null;
41714
+ this._id = data.id || null;
41715
+ makeAutoObservable(this);
41716
+ }
41717
+ Object.defineProperty(IkasRaffleList.prototype, "limit", {
41718
+ get: function () {
41719
+ return this._limit;
41720
+ },
41721
+ enumerable: false,
41722
+ configurable: true
41723
+ });
41724
+ Object.defineProperty(IkasRaffleList.prototype, "page", {
41725
+ get: function () {
41726
+ return this._page;
41727
+ },
41728
+ enumerable: false,
41729
+ configurable: true
41730
+ });
41731
+ Object.defineProperty(IkasRaffleList.prototype, "count", {
41732
+ get: function () {
41733
+ return this._count;
41734
+ },
41735
+ enumerable: false,
41736
+ configurable: true
41737
+ });
41738
+ Object.defineProperty(IkasRaffleList.prototype, "pageCount", {
41739
+ get: function () {
41740
+ return Math.ceil(this._count / this._limit);
41741
+ },
41742
+ enumerable: false,
41743
+ configurable: true
41744
+ });
41745
+ Object.defineProperty(IkasRaffleList.prototype, "isInitialized", {
41746
+ get: function () {
41747
+ return this._initialized;
41748
+ },
41749
+ enumerable: false,
41750
+ configurable: true
41751
+ });
41752
+ Object.defineProperty(IkasRaffleList.prototype, "hasPrev", {
41753
+ get: function () {
41754
+ if (!this._minPage)
41755
+ return false;
41756
+ return this._minPage > 1;
41757
+ },
41758
+ enumerable: false,
41759
+ configurable: true
41760
+ });
41761
+ Object.defineProperty(IkasRaffleList.prototype, "hasNext", {
41762
+ get: function () {
41763
+ return this.page * this.limit < this.count;
41764
+ },
41765
+ enumerable: false,
41766
+ configurable: true
41767
+ });
41768
+ Object.defineProperty(IkasRaffleList.prototype, "isLoading", {
41769
+ get: function () {
41770
+ return this._isLoading;
41771
+ },
41772
+ enumerable: false,
41773
+ configurable: true
41774
+ });
41775
+ Object.defineProperty(IkasRaffleList.prototype, "minPage", {
41776
+ get: function () {
41777
+ return this._minPage || 1;
41778
+ },
41779
+ enumerable: false,
41780
+ configurable: true
41781
+ });
41782
+ IkasRaffleList.prototype.getRaffleList = function (page, limit) {
41783
+ return __awaiter(this, void 0, void 0, function () {
41784
+ return __generator(this, function (_a) {
41785
+ switch (_a.label) {
41786
+ case 0: return [4 /*yield*/, IkasRaffleAPI.listRaffles({
41787
+ start: this._start,
41788
+ end: this._end,
41789
+ includeDeleted: this._includeDeleted || false,
41790
+ name: this._name,
41791
+ id: this._id,
41792
+ search: this._search || undefined,
41793
+ pagination: {
41794
+ limit: limit,
41795
+ page: page,
41796
+ },
41797
+ })];
41798
+ case 1: return [2 /*return*/, _a.sent()];
41799
+ }
41800
+ });
41801
+ });
41802
+ };
41803
+ IkasRaffleList.prototype.toJSON = function () {
41804
+ return {
41805
+ data: this.data,
41806
+ limit: this._limit,
41807
+ page: this._page,
41808
+ count: this._count,
41809
+ initialized: this._initialized,
41810
+ minPage: this._minPage,
41811
+ };
41812
+ };
41813
+ return IkasRaffleList;
41814
+ }());
41815
+
41289
41816
  var IkasProductListPropValue = /** @class */ (function () {
41290
41817
  function IkasProductListPropValue(data) {
41291
41818
  this.initialSort = null;
@@ -41407,6 +41934,30 @@ var IkasBlogCategoryListPropValue = /** @class */ (function () {
41407
41934
  return IkasBlogCategoryListPropValue;
41408
41935
  }());
41409
41936
 
41937
+ var IkasRafflePropValue = /** @class */ (function () {
41938
+ function IkasRafflePropValue(data) {
41939
+ this.raffleId = null;
41940
+ // Only for raffle detail page
41941
+ this.usePageData = null;
41942
+ this.raffleId = data.raffleId;
41943
+ this.usePageData = data.usePageData;
41944
+ makeAutoObservable(this);
41945
+ }
41946
+ return IkasRafflePropValue;
41947
+ }());
41948
+
41949
+ var IkasRaffleListPropValue = /** @class */ (function () {
41950
+ function IkasRaffleListPropValue(data) {
41951
+ this.initialLimit = null;
41952
+ // Only for static lists
41953
+ this.raffleIds = null;
41954
+ this.initialLimit = data.initialLimit || 20;
41955
+ this.raffleIds = data.raffleIds;
41956
+ makeAutoObservable(this);
41957
+ }
41958
+ return IkasRaffleListPropValue;
41959
+ }());
41960
+
41410
41961
  var IkasBrandAPI = /** @class */ (function () {
41411
41962
  function IkasBrandAPI() {
41412
41963
  }
@@ -41489,7 +42040,7 @@ var IkasCartAPI = /** @class */ (function () {
41489
42040
  return __generator(this, function (_b) {
41490
42041
  switch (_b.label) {
41491
42042
  case 0:
41492
- MUTATION = src(templateObject_1$2 || (templateObject_1$2 = __makeTemplateObject(["\n mutation saveItemToCart($input: SaveItemToCartInput!) {\n saveItemToCart(input: $input) {\n id\n createdAt\n updatedAt\n dueDate\n currencyCode\n customerId\n merchantId\n itemCount\n totalPrice\n salesChannelId\n storefrontId\n storefrontRoutingId\n storefrontThemeId\n taxLines {\n price\n rate\n }\n items {\n createdAt\n currencyCode\n deleted\n discount {\n amount\n amountType\n reason\n }\n discountPrice\n finalPrice\n id\n options {\n name\n productOptionsSetId\n productOptionId\n type\n values {\n name\n price\n value\n }\n }\n originalOrderLineItemId\n price\n quantity\n status\n statusUpdatedAt\n stockLocationId\n taxValue\n updatedAt\n variant {\n id\n name\n sku\n slug\n barcodeList\n mainImageId\n productId\n variantValues {\n order\n variantTypeId\n variantTypeName\n variantValueId\n variantValueName\n }\n }\n }\n }\n }\n "], ["\n mutation saveItemToCart($input: SaveItemToCartInput!) {\n saveItemToCart(input: $input) {\n id\n createdAt\n updatedAt\n dueDate\n currencyCode\n customerId\n merchantId\n itemCount\n totalPrice\n salesChannelId\n storefrontId\n storefrontRoutingId\n storefrontThemeId\n taxLines {\n price\n rate\n }\n items {\n createdAt\n currencyCode\n deleted\n discount {\n amount\n amountType\n reason\n }\n discountPrice\n finalPrice\n id\n options {\n name\n productOptionsSetId\n productOptionId\n type\n values {\n name\n price\n value\n }\n }\n originalOrderLineItemId\n price\n quantity\n status\n statusUpdatedAt\n stockLocationId\n taxValue\n updatedAt\n variant {\n id\n name\n sku\n slug\n barcodeList\n mainImageId\n productId\n variantValues {\n order\n variantTypeId\n variantTypeName\n variantValueId\n variantValueName\n }\n }\n }\n }\n }\n "])));
42043
+ MUTATION = src(templateObject_1$2 || (templateObject_1$2 = __makeTemplateObject(["\n mutation saveItemToCart($input: SaveItemToCartInput!) {\n saveItemToCart(input: $input) {\n id\n createdAt\n updatedAt\n dueDate\n currencyCode\n customerId\n merchantId\n itemCount\n totalPrice\n salesChannelId\n storefrontId\n storefrontRoutingId\n storefrontThemeId\n taxLines {\n price\n rate\n }\n items {\n createdAt\n currencyCode\n deleted\n discount {\n amount\n amountType\n reason\n }\n discountPrice\n finalPrice\n id\n originalOrderLineItemId\n price\n quantity\n status\n statusUpdatedAt\n stockLocationId\n taxValue\n updatedAt\n variant {\n id\n name\n sku\n slug\n barcodeList\n mainImageId\n productId\n variantValues {\n order\n variantTypeId\n variantTypeName\n variantValueId\n variantValueName\n }\n }\n }\n }\n }\n "], ["\n mutation saveItemToCart($input: SaveItemToCartInput!) {\n saveItemToCart(input: $input) {\n id\n createdAt\n updatedAt\n dueDate\n currencyCode\n customerId\n merchantId\n itemCount\n totalPrice\n salesChannelId\n storefrontId\n storefrontRoutingId\n storefrontThemeId\n taxLines {\n price\n rate\n }\n items {\n createdAt\n currencyCode\n deleted\n discount {\n amount\n amountType\n reason\n }\n discountPrice\n finalPrice\n id\n originalOrderLineItemId\n price\n quantity\n status\n statusUpdatedAt\n stockLocationId\n taxValue\n updatedAt\n variant {\n id\n name\n sku\n slug\n barcodeList\n mainImageId\n productId\n variantValues {\n order\n variantTypeId\n variantTypeName\n variantValueId\n variantValueName\n }\n }\n }\n }\n }\n "])));
41493
42044
  _b.label = 1;
41494
42045
  case 1:
41495
42046
  _b.trys.push([1, 3, , 4]);
@@ -41524,7 +42075,7 @@ var IkasCartAPI = /** @class */ (function () {
41524
42075
  return __generator(this, function (_b) {
41525
42076
  switch (_b.label) {
41526
42077
  case 0:
41527
- QUERY = src(templateObject_2$1 || (templateObject_2$1 = __makeTemplateObject(["\n query getCart(\n $cartId: String\n $customerId: String\n $storefrontRoutingId: String\n ) {\n getCart(\n id: $cartId\n customerId: $customerId\n storefrontRoutingId: $storefrontRoutingId\n ) {\n createdAt\n currencyCode\n customerId\n dueDate\n id\n itemCount\n salesChannelId\n storefrontId\n storefrontRoutingId\n storefrontThemeId\n items {\n createdAt\n currencyCode\n discount {\n amount\n amountType\n reason\n }\n discountPrice\n finalPrice\n id\n options {\n name\n productOptionId\n productOptionsSetId\n type\n values {\n name\n price\n value\n }\n }\n originalOrderLineItemId\n price\n quantity\n status\n deleted\n statusUpdatedAt\n stockLocationId\n taxValue\n updatedAt\n variant {\n slug\n barcodeList\n id\n mainImageId\n name\n productId\n sku\n variantValues {\n order\n variantTypeId\n variantTypeName\n variantValueId\n variantValueName\n }\n }\n }\n merchantId\n status\n totalPrice\n updatedAt\n }\n }\n "], ["\n query getCart(\n $cartId: String\n $customerId: String\n $storefrontRoutingId: String\n ) {\n getCart(\n id: $cartId\n customerId: $customerId\n storefrontRoutingId: $storefrontRoutingId\n ) {\n createdAt\n currencyCode\n customerId\n dueDate\n id\n itemCount\n salesChannelId\n storefrontId\n storefrontRoutingId\n storefrontThemeId\n items {\n createdAt\n currencyCode\n discount {\n amount\n amountType\n reason\n }\n discountPrice\n finalPrice\n id\n options {\n name\n productOptionId\n productOptionsSetId\n type\n values {\n name\n price\n value\n }\n }\n originalOrderLineItemId\n price\n quantity\n status\n deleted\n statusUpdatedAt\n stockLocationId\n taxValue\n updatedAt\n variant {\n slug\n barcodeList\n id\n mainImageId\n name\n productId\n sku\n variantValues {\n order\n variantTypeId\n variantTypeName\n variantValueId\n variantValueName\n }\n }\n }\n merchantId\n status\n totalPrice\n updatedAt\n }\n }\n "])));
42078
+ QUERY = src(templateObject_2$1 || (templateObject_2$1 = __makeTemplateObject(["\n query getCart(\n $cartId: String\n $customerId: String\n $storefrontRoutingId: String\n ) {\n getCart(\n id: $cartId\n customerId: $customerId\n storefrontRoutingId: $storefrontRoutingId\n ) {\n createdAt\n currencyCode\n customerId\n dueDate\n id\n itemCount\n salesChannelId\n storefrontId\n storefrontRoutingId\n storefrontThemeId\n items {\n createdAt\n currencyCode\n discount {\n amount\n amountType\n reason\n }\n discountPrice\n finalPrice\n id\n originalOrderLineItemId\n price\n quantity\n status\n deleted\n statusUpdatedAt\n stockLocationId\n taxValue\n updatedAt\n variant {\n slug\n barcodeList\n id\n mainImageId\n name\n productId\n sku\n variantValues {\n order\n variantTypeId\n variantTypeName\n variantValueId\n variantValueName\n }\n }\n }\n merchantId\n status\n totalPrice\n updatedAt\n }\n }\n "], ["\n query getCart(\n $cartId: String\n $customerId: String\n $storefrontRoutingId: String\n ) {\n getCart(\n id: $cartId\n customerId: $customerId\n storefrontRoutingId: $storefrontRoutingId\n ) {\n createdAt\n currencyCode\n customerId\n dueDate\n id\n itemCount\n salesChannelId\n storefrontId\n storefrontRoutingId\n storefrontThemeId\n items {\n createdAt\n currencyCode\n discount {\n amount\n amountType\n reason\n }\n discountPrice\n finalPrice\n id\n originalOrderLineItemId\n price\n quantity\n status\n deleted\n statusUpdatedAt\n stockLocationId\n taxValue\n updatedAt\n variant {\n slug\n barcodeList\n id\n mainImageId\n name\n productId\n sku\n variantValues {\n order\n variantTypeId\n variantTypeName\n variantValueId\n variantValueName\n }\n }\n }\n merchantId\n status\n totalPrice\n updatedAt\n }\n }\n "])));
41528
42079
  _b.label = 1;
41529
42080
  case 1:
41530
42081
  _b.trys.push([1, 3, , 4]);
@@ -43640,9 +44191,7 @@ var IkasProductOptionSetAPI = /** @class */ (function () {
43640
44191
  return [2 /*return*/];
43641
44192
  }
43642
44193
  return [2 /*return*/, {
43643
- data: data.listProductOptionSet.map(function (c) {
43644
- return new IkasProductOptionSet(c);
43645
- }),
44194
+ data: data.listProductOptionSet.map(function (c) { return new IkasProductOptionSet(c); }),
43646
44195
  }];
43647
44196
  case 2:
43648
44197
  err_1 = _b.sent();
@@ -43657,6 +44206,230 @@ var IkasProductOptionSetAPI = /** @class */ (function () {
43657
44206
  }());
43658
44207
  var templateObject_1$i;
43659
44208
 
44209
+ var IkasRaffleAPI = /** @class */ (function () {
44210
+ function IkasRaffleAPI() {
44211
+ }
44212
+ IkasRaffleAPI.listRaffles = function (params) {
44213
+ return __awaiter(this, void 0, void 0, function () {
44214
+ var LIST_QUERY, _a, data, errors, count, raffles, error_1;
44215
+ return __generator(this, function (_b) {
44216
+ switch (_b.label) {
44217
+ case 0:
44218
+ LIST_QUERY = src(templateObject_1$j || (templateObject_1$j = __makeTemplateObject(["\n query listRaffle(\n $end: DateFilterInput\n $start: DateFilterInput\n $id: StringFilterInput\n $includeDeleted: Boolean\n $name: StringFilterInput\n $pagination: PaginationInput\n $search: String\n ) {\n listRaffle(\n start: $start\n end: $end\n id: $id\n includeDeleted: $includeDeleted\n name: $name\n pagination: $pagination\n search: $search\n ) {\n count\n hasNext\n limit\n page\n data {\n createdAt\n variants {\n productId\n variantId\n }\n verificationType\n dateRange {\n end\n start\n }\n deleted\n id\n metadata {\n createdAt\n deleted\n description\n id\n pageTitle\n slug\n targetId\n targetType\n updatedAt\n }\n name\n participantCount\n requiredCustomerAccount\n status\n updatedAt\n }\n }\n }\n "], ["\n query listRaffle(\n $end: DateFilterInput\n $start: DateFilterInput\n $id: StringFilterInput\n $includeDeleted: Boolean\n $name: StringFilterInput\n $pagination: PaginationInput\n $search: String\n ) {\n listRaffle(\n start: $start\n end: $end\n id: $id\n includeDeleted: $includeDeleted\n name: $name\n pagination: $pagination\n search: $search\n ) {\n count\n hasNext\n limit\n page\n data {\n createdAt\n variants {\n productId\n variantId\n }\n verificationType\n dateRange {\n end\n start\n }\n deleted\n id\n metadata {\n createdAt\n deleted\n description\n id\n pageTitle\n slug\n targetId\n targetType\n updatedAt\n }\n name\n participantCount\n requiredCustomerAccount\n status\n updatedAt\n }\n }\n }\n "])));
44219
+ _b.label = 1;
44220
+ case 1:
44221
+ _b.trys.push([1, 3, , 4]);
44222
+ return [4 /*yield*/, apollo
44223
+ .getClient()
44224
+ .query({
44225
+ query: LIST_QUERY,
44226
+ variables: {
44227
+ start: params.start ? { eq: params.start } : undefined,
44228
+ end: params.end ? { eq: params.end } : undefined,
44229
+ id: params.id ? { eq: params.id } : undefined,
44230
+ includeDeleted: params.includeDeleted
44231
+ ? params.includeDeleted
44232
+ : params.includeDeleted,
44233
+ name: params.name ? { eq: params.name } : undefined,
44234
+ pagination: params.pagination
44235
+ ? {
44236
+ limit: params.pagination.limit,
44237
+ page: params.pagination.page,
44238
+ }
44239
+ : undefined,
44240
+ search: params.search,
44241
+ },
44242
+ })];
44243
+ case 2:
44244
+ _a = _b.sent(), data = _a.data, errors = _a.errors;
44245
+ if (errors && errors.length) {
44246
+ return [2 /*return*/, {
44247
+ raffles: [],
44248
+ count: 0,
44249
+ }];
44250
+ }
44251
+ count = data.listRaffle.count;
44252
+ raffles = data.listRaffle.data.map(function (raffle) {
44253
+ var _a, _b;
44254
+ return new IkasRaffle({
44255
+ id: raffle.id,
44256
+ dateRange: {
44257
+ end: (_a = raffle.dateRange) === null || _a === void 0 ? void 0 : _a.end,
44258
+ start: (_b = raffle.dateRange) === null || _b === void 0 ? void 0 : _b.start,
44259
+ },
44260
+ createdAt: raffle.createdAt,
44261
+ deleted: raffle.deleted,
44262
+ metadata: raffle.metadata || undefined,
44263
+ name: raffle.name,
44264
+ participantCount: raffle.participantCount,
44265
+ requiredCustomerAccount: raffle.requiredCustomerAccount,
44266
+ status: raffle.status,
44267
+ updatedAt: raffle.updatedAt,
44268
+ variants: raffle.variants.length > 0
44269
+ ? raffle.variants.map(function (v) { return new IkasRaffleAppliedProduct(v); })
44270
+ : undefined,
44271
+ verificationType: raffle.verificationType,
44272
+ });
44273
+ });
44274
+ return [2 /*return*/, {
44275
+ count: count,
44276
+ raffles: raffles,
44277
+ }];
44278
+ case 3:
44279
+ error_1 = _b.sent();
44280
+ console.log(error_1);
44281
+ return [2 /*return*/, {
44282
+ raffles: [],
44283
+ count: 0,
44284
+ }];
44285
+ case 4: return [2 /*return*/];
44286
+ }
44287
+ });
44288
+ });
44289
+ };
44290
+ IkasRaffleAPI.saveRaffleParticipant = function (participant) {
44291
+ return __awaiter(this, void 0, void 0, function () {
44292
+ var SAVE_RAFFLE_PARTICIPANT, _a, data, errors, error_2;
44293
+ return __generator(this, function (_b) {
44294
+ switch (_b.label) {
44295
+ case 0:
44296
+ SAVE_RAFFLE_PARTICIPANT = src(templateObject_2$9 || (templateObject_2$9 = __makeTemplateObject(["\n mutation saveRaffleParticipant($input: RaffleParticipantsInput!) {\n saveRaffleParticipant(input: $input) {\n applicationDate\n isWinner\n lastName\n phone\n raffleId\n updatedAt\n appliedProducts {\n productId\n variantId\n }\n createdAt\n customerId\n deleted\n email\n extraData\n firstName\n fullName\n id\n }\n }\n "], ["\n mutation saveRaffleParticipant($input: RaffleParticipantsInput!) {\n saveRaffleParticipant(input: $input) {\n applicationDate\n isWinner\n lastName\n phone\n raffleId\n updatedAt\n appliedProducts {\n productId\n variantId\n }\n createdAt\n customerId\n deleted\n email\n extraData\n firstName\n fullName\n id\n }\n }\n "])));
44297
+ _b.label = 1;
44298
+ case 1:
44299
+ _b.trys.push([1, 3, , 4]);
44300
+ return [4 /*yield*/, apollo
44301
+ .getClient()
44302
+ .mutate({
44303
+ mutation: SAVE_RAFFLE_PARTICIPANT,
44304
+ variables: {
44305
+ input: {
44306
+ appliedProducts: participant.appliedProducts,
44307
+ email: participant.email,
44308
+ firstName: participant.firstName,
44309
+ lastName: participant.lastName,
44310
+ raffleId: participant.raffleId,
44311
+ extraData: participant.extraData,
44312
+ phone: participant.phone,
44313
+ },
44314
+ },
44315
+ })];
44316
+ case 2:
44317
+ _a = _b.sent(), data = _a.data, errors = _a.errors;
44318
+ if (errors && errors.length) {
44319
+ console.log(errors);
44320
+ }
44321
+ if (data && data.saveRaffleParticipant)
44322
+ return [2 /*return*/, new IkasRaffleParticipant(data.saveRaffleParticipant)];
44323
+ return [3 /*break*/, 4];
44324
+ case 3:
44325
+ error_2 = _b.sent();
44326
+ console.log(error_2);
44327
+ return [3 /*break*/, 4];
44328
+ case 4: return [2 /*return*/];
44329
+ }
44330
+ });
44331
+ });
44332
+ };
44333
+ IkasRaffleAPI.listRaffleMetaData = function (slug, targetId, targetType) {
44334
+ return __awaiter(this, void 0, void 0, function () {
44335
+ var LIST_QUERY, _a, data, errors, err_1;
44336
+ return __generator(this, function (_b) {
44337
+ switch (_b.label) {
44338
+ case 0:
44339
+ LIST_QUERY = src(templateObject_3$5 || (templateObject_3$5 = __makeTemplateObject(["\n query listRaffleMetaData(\n $slug: StringFilterInput\n $targetId: StringFilterInput\n $targetType: RaffleMetadataTargetTypeEnumFilter\n ) {\n listRaffleMetadata(\n slug: $slug\n targetId: $targetId\n targetType: $targetType\n ) {\n createdAt\n deleted\n description\n id\n pageTitle\n slug\n targetId\n targetType\n updatedAt\n }\n }\n "], ["\n query listRaffleMetaData(\n $slug: StringFilterInput\n $targetId: StringFilterInput\n $targetType: RaffleMetadataTargetTypeEnumFilter\n ) {\n listRaffleMetadata(\n slug: $slug\n targetId: $targetId\n targetType: $targetType\n ) {\n createdAt\n deleted\n description\n id\n pageTitle\n slug\n targetId\n targetType\n updatedAt\n }\n }\n "])));
44340
+ _b.label = 1;
44341
+ case 1:
44342
+ _b.trys.push([1, 3, , 4]);
44343
+ return [4 /*yield*/, apollo
44344
+ .getClient()
44345
+ .query({
44346
+ query: LIST_QUERY,
44347
+ variables: {
44348
+ slug: slug
44349
+ ? {
44350
+ eq: slug,
44351
+ }
44352
+ : undefined,
44353
+ targetId: targetId
44354
+ ? {
44355
+ eq: targetId,
44356
+ }
44357
+ : undefined,
44358
+ targetType: targetType
44359
+ ? {
44360
+ in: targetType,
44361
+ }
44362
+ : undefined,
44363
+ },
44364
+ })];
44365
+ case 2:
44366
+ _a = _b.sent(), data = _a.data, errors = _a.errors;
44367
+ if (errors && errors.length) {
44368
+ return [2 /*return*/, []];
44369
+ }
44370
+ return [2 /*return*/, data.listRaffleMetadata.map(function (d) { return new IkasRaffleMetaData(d); })];
44371
+ case 3:
44372
+ err_1 = _b.sent();
44373
+ console.log(err_1);
44374
+ return [2 /*return*/, []];
44375
+ case 4: return [2 /*return*/];
44376
+ }
44377
+ });
44378
+ });
44379
+ };
44380
+ IkasRaffleAPI.getRafflesByCustomerId = function () {
44381
+ return __awaiter(this, void 0, void 0, function () {
44382
+ var LIST_QUERY, data, raffles, error_3;
44383
+ return __generator(this, function (_a) {
44384
+ switch (_a.label) {
44385
+ case 0:
44386
+ LIST_QUERY = src(templateObject_4$3 || (templateObject_4$3 = __makeTemplateObject(["\n query getRafflesByCustomerId {\n getRafflesByCustomerId {\n createdAt\n variants {\n productId\n variantId\n }\n verificationType\n dateRange {\n end\n start\n }\n deleted\n id\n metadata {\n createdAt\n deleted\n description\n id\n pageTitle\n slug\n targetId\n targetType\n updatedAt\n }\n name\n participantCount\n requiredCustomerAccount\n status\n updatedAt\n }\n }\n "], ["\n query getRafflesByCustomerId {\n getRafflesByCustomerId {\n createdAt\n variants {\n productId\n variantId\n }\n verificationType\n dateRange {\n end\n start\n }\n deleted\n id\n metadata {\n createdAt\n deleted\n description\n id\n pageTitle\n slug\n targetId\n targetType\n updatedAt\n }\n name\n participantCount\n requiredCustomerAccount\n status\n updatedAt\n }\n }\n "])));
44387
+ _a.label = 1;
44388
+ case 1:
44389
+ _a.trys.push([1, 3, , 4]);
44390
+ return [4 /*yield*/, apollo
44391
+ .getClient()
44392
+ .query({
44393
+ query: LIST_QUERY,
44394
+ })];
44395
+ case 2:
44396
+ data = (_a.sent()).data;
44397
+ raffles = data.getRafflesByCustomerId.map(function (raffle) {
44398
+ var _a, _b;
44399
+ return new IkasRaffle({
44400
+ id: raffle.id,
44401
+ dateRange: {
44402
+ end: (_a = raffle.dateRange) === null || _a === void 0 ? void 0 : _a.end,
44403
+ start: (_b = raffle.dateRange) === null || _b === void 0 ? void 0 : _b.start,
44404
+ },
44405
+ createdAt: raffle.createdAt,
44406
+ deleted: raffle.deleted,
44407
+ metadata: raffle.metadata || undefined,
44408
+ name: raffle.name,
44409
+ participantCount: raffle.participantCount,
44410
+ requiredCustomerAccount: raffle.requiredCustomerAccount,
44411
+ status: raffle.status,
44412
+ updatedAt: raffle.updatedAt,
44413
+ variants: raffle.variants.length > 0
44414
+ ? raffle.variants.map(function (v) { return new IkasRaffleAppliedProduct(v); })
44415
+ : undefined,
44416
+ verificationType: raffle.verificationType,
44417
+ });
44418
+ });
44419
+ return [2 /*return*/, raffles];
44420
+ case 3:
44421
+ error_3 = _a.sent();
44422
+ console.log(error_3);
44423
+ return [3 /*break*/, 4];
44424
+ case 4: return [2 /*return*/];
44425
+ }
44426
+ });
44427
+ });
44428
+ };
44429
+ return IkasRaffleAPI;
44430
+ }());
44431
+ var templateObject_1$j, templateObject_2$9, templateObject_3$5, templateObject_4$3;
44432
+
43660
44433
  var IkasProductBackInStockReminderAPI = /** @class */ (function () {
43661
44434
  function IkasProductBackInStockReminderAPI() {
43662
44435
  }
@@ -43666,7 +44439,7 @@ var IkasProductBackInStockReminderAPI = /** @class */ (function () {
43666
44439
  return __generator(this, function (_b) {
43667
44440
  switch (_b.label) {
43668
44441
  case 0:
43669
- QUERY = src(templateObject_1$j || (templateObject_1$j = __makeTemplateObject(["\n query listProductBackInStockRemind(\n $id: StringFilterInput\n $updatedAt: DateFilterInput\n $includeDeleted: Boolean\n $email: StringFilterInput\n $productId: StringFilterInput\n $variantId: StringFilterInput\n ) {\n listProductBackInStockRemind(\n id: $id\n updatedAt: $updatedAt\n includeDeleted: $includeDeleted\n email: $email\n productId: $productId\n variantId: $variantId\n ) {\n createdAt\n customerId\n deleted\n email\n id\n productId\n storefrontId\n updatedAt\n variantId\n }\n }\n "], ["\n query listProductBackInStockRemind(\n $id: StringFilterInput\n $updatedAt: DateFilterInput\n $includeDeleted: Boolean\n $email: StringFilterInput\n $productId: StringFilterInput\n $variantId: StringFilterInput\n ) {\n listProductBackInStockRemind(\n id: $id\n updatedAt: $updatedAt\n includeDeleted: $includeDeleted\n email: $email\n productId: $productId\n variantId: $variantId\n ) {\n createdAt\n customerId\n deleted\n email\n id\n productId\n storefrontId\n updatedAt\n variantId\n }\n }\n "])));
44442
+ QUERY = src(templateObject_1$k || (templateObject_1$k = __makeTemplateObject(["\n query listProductBackInStockRemind(\n $id: StringFilterInput\n $updatedAt: DateFilterInput\n $includeDeleted: Boolean\n $email: StringFilterInput\n $productId: StringFilterInput\n $variantId: StringFilterInput\n ) {\n listProductBackInStockRemind(\n id: $id\n updatedAt: $updatedAt\n includeDeleted: $includeDeleted\n email: $email\n productId: $productId\n variantId: $variantId\n ) {\n createdAt\n customerId\n deleted\n email\n id\n productId\n storefrontId\n updatedAt\n variantId\n }\n }\n "], ["\n query listProductBackInStockRemind(\n $id: StringFilterInput\n $updatedAt: DateFilterInput\n $includeDeleted: Boolean\n $email: StringFilterInput\n $productId: StringFilterInput\n $variantId: StringFilterInput\n ) {\n listProductBackInStockRemind(\n id: $id\n updatedAt: $updatedAt\n includeDeleted: $includeDeleted\n email: $email\n productId: $productId\n variantId: $variantId\n ) {\n createdAt\n customerId\n deleted\n email\n id\n productId\n storefrontId\n updatedAt\n variantId\n }\n }\n "])));
43670
44443
  _b.label = 1;
43671
44444
  case 1:
43672
44445
  _b.trys.push([1, 3, , 4]);
@@ -43706,7 +44479,7 @@ var IkasProductBackInStockReminderAPI = /** @class */ (function () {
43706
44479
  return __generator(this, function (_b) {
43707
44480
  switch (_b.label) {
43708
44481
  case 0:
43709
- MUTATION = src(templateObject_2$9 || (templateObject_2$9 = __makeTemplateObject(["\n mutation saveProductBackInStockRemind(\n $input: ProductBackInStockRemindInput!\n ) {\n saveProductBackInStockRemind(input: $input) {\n createdAt\n customerId\n deleted\n email\n id\n productId\n storefrontId\n updatedAt\n variantId\n }\n }\n "], ["\n mutation saveProductBackInStockRemind(\n $input: ProductBackInStockRemindInput!\n ) {\n saveProductBackInStockRemind(input: $input) {\n createdAt\n customerId\n deleted\n email\n id\n productId\n storefrontId\n updatedAt\n variantId\n }\n }\n "])));
44482
+ MUTATION = src(templateObject_2$a || (templateObject_2$a = __makeTemplateObject(["\n mutation saveProductBackInStockRemind(\n $input: ProductBackInStockRemindInput!\n ) {\n saveProductBackInStockRemind(input: $input) {\n createdAt\n customerId\n deleted\n email\n id\n productId\n storefrontId\n updatedAt\n variantId\n }\n }\n "], ["\n mutation saveProductBackInStockRemind(\n $input: ProductBackInStockRemindInput!\n ) {\n saveProductBackInStockRemind(input: $input) {\n createdAt\n customerId\n deleted\n email\n id\n productId\n storefrontId\n updatedAt\n variantId\n }\n }\n "])));
43710
44483
  _b.label = 1;
43711
44484
  case 1:
43712
44485
  _b.trys.push([1, 3, , 4]);
@@ -43737,7 +44510,7 @@ var IkasProductBackInStockReminderAPI = /** @class */ (function () {
43737
44510
  };
43738
44511
  return IkasProductBackInStockReminderAPI;
43739
44512
  }());
43740
- var templateObject_1$j, templateObject_2$9;
44513
+ var templateObject_1$k, templateObject_2$a;
43741
44514
 
43742
44515
  var IkasProductListPropValueProvider = /** @class */ (function () {
43743
44516
  function IkasProductListPropValueProvider(pageType, productListPropValue, pageSpecificData) {
@@ -43809,6 +44582,9 @@ function getPlaceholderBlog() {
43809
44582
  }
43810
44583
  function getPlaceholderBlogCategory() {
43811
44584
  return new IkasBlogCategory();
44585
+ }
44586
+ function getPlaceholderRaffle() {
44587
+ return new IkasRaffle();
43812
44588
  }
43813
44589
 
43814
44590
  var IkasProductDetailPropValueProvider = /** @class */ (function () {
@@ -44488,6 +45264,64 @@ var IkasBlogCategoryListPropValueProvider = /** @class */ (function () {
44488
45264
  return IkasBlogCategoryListPropValueProvider;
44489
45265
  }());
44490
45266
 
45267
+ var IkasRaffleListPropValueProvider = /** @class */ (function () {
45268
+ function IkasRaffleListPropValueProvider() {
45269
+ }
45270
+ IkasRaffleListPropValueProvider.prototype.getValue = function () {
45271
+ return __awaiter(this, void 0, void 0, function () {
45272
+ var raffleList;
45273
+ return __generator(this, function (_a) {
45274
+ switch (_a.label) {
45275
+ case 0:
45276
+ raffleList = new IkasRaffleList();
45277
+ //@ts-ignore
45278
+ return [4 /*yield*/, raffleList.getInitial()];
45279
+ case 1:
45280
+ //@ts-ignore
45281
+ _a.sent();
45282
+ return [2 /*return*/, raffleList];
45283
+ }
45284
+ });
45285
+ });
45286
+ };
45287
+ return IkasRaffleListPropValueProvider;
45288
+ }());
45289
+
45290
+ var IkasRafflePropValueProvider = /** @class */ (function () {
45291
+ function IkasRafflePropValueProvider(propValue) {
45292
+ this.rafflePropValue = propValue;
45293
+ }
45294
+ IkasRafflePropValueProvider.prototype.getValue = function () {
45295
+ var _a;
45296
+ return __awaiter(this, void 0, void 0, function () {
45297
+ var raffle;
45298
+ return __generator(this, function (_b) {
45299
+ switch (_b.label) {
45300
+ case 0:
45301
+ if ((_a = this.rafflePropValue) === null || _a === void 0 ? void 0 : _a.usePageData) {
45302
+ return [2 /*return*/, {
45303
+ raffle: null,
45304
+ rafflePropValue: this.rafflePropValue,
45305
+ }];
45306
+ }
45307
+ if (!this.rafflePropValue.raffleId)
45308
+ return [2 /*return*/, null];
45309
+ return [4 /*yield*/, IkasRaffleAPI.listRaffles({
45310
+ id: this.rafflePropValue.raffleId,
45311
+ })];
45312
+ case 1:
45313
+ raffle = _b.sent();
45314
+ return [2 /*return*/, {
45315
+ raffle: raffle.raffles[0] || getPlaceholderRaffle(),
45316
+ rafflePropValue: this.rafflePropValue,
45317
+ }];
45318
+ }
45319
+ });
45320
+ });
45321
+ };
45322
+ return IkasRafflePropValueProvider;
45323
+ }());
45324
+
44491
45325
  var IkasCustomPropValueProvider = /** @class */ (function () {
44492
45326
  function IkasCustomPropValueProvider(value, customData, theme, pageType, pageDataProvider, pageSpecificData, pageParams) {
44493
45327
  this.value = value;
@@ -44504,11 +45338,12 @@ var IkasCustomPropValueProvider = /** @class */ (function () {
44504
45338
  return __generator(this, function (_b) {
44505
45339
  switch (_b.label) {
44506
45340
  case 0:
44507
- if (this.value === undefined || this.value === null)
45341
+ if ((this.value === undefined || this.value === null) &&
45342
+ this.customData.type !== IkasThemeComponentPropType.RAFFLE_LIST)
44508
45343
  return [2 /*return*/, { value: null, customData: this.customData }];
44509
45344
  _b.label = 1;
44510
45345
  case 1:
44511
- _b.trys.push([1, 52, , 53]);
45346
+ _b.trys.push([1, 56, , 57]);
44512
45347
  _a = this.customData.type;
44513
45348
  switch (_a) {
44514
45349
  case IkasThemeComponentPropType.TEXT: return [3 /*break*/, 2];
@@ -44537,111 +45372,121 @@ var IkasCustomPropValueProvider = /** @class */ (function () {
44537
45372
  case IkasThemeComponentPropType.BLOG: return [3 /*break*/, 42];
44538
45373
  case IkasThemeComponentPropType.BLOG_LIST: return [3 /*break*/, 44];
44539
45374
  case IkasThemeComponentPropType.BLOG_CATEGORY: return [3 /*break*/, 46];
44540
- case IkasThemeComponentPropType.BLOG_LIST: return [3 /*break*/, 48];
45375
+ case IkasThemeComponentPropType.BLOG_CATEGORY_LIST: return [3 /*break*/, 48];
45376
+ case IkasThemeComponentPropType.RAFFLE: return [3 /*break*/, 50];
45377
+ case IkasThemeComponentPropType.RAFFLE_LIST: return [3 /*break*/, 52];
44541
45378
  }
44542
- return [3 /*break*/, 50];
45379
+ return [3 /*break*/, 54];
44543
45380
  case 2: return [4 /*yield*/, this.getTextValue()];
44544
45381
  case 3:
44545
45382
  customDataValue = _b.sent();
44546
- return [3 /*break*/, 51];
45383
+ return [3 /*break*/, 55];
44547
45384
  case 4: return [4 /*yield*/, this.getRichTextPropValue()];
44548
45385
  case 5:
44549
45386
  customDataValue = _b.sent();
44550
- return [3 /*break*/, 51];
45387
+ return [3 /*break*/, 55];
44551
45388
  case 6: return [4 /*yield*/, this.getBooleanValue()];
44552
45389
  case 7:
44553
45390
  customDataValue = _b.sent();
44554
- return [3 /*break*/, 51];
45391
+ return [3 /*break*/, 55];
44555
45392
  case 8: return [4 /*yield*/, this.getBrandListPropValue()];
44556
45393
  case 9:
44557
45394
  customDataValue = _b.sent();
44558
- return [3 /*break*/, 51];
45395
+ return [3 /*break*/, 55];
44559
45396
  case 10: return [4 /*yield*/, this.getBrandPropValue()];
44560
45397
  case 11:
44561
45398
  customDataValue = _b.sent();
44562
- return [3 /*break*/, 51];
45399
+ return [3 /*break*/, 55];
44563
45400
  case 12: return [4 /*yield*/, this.getCategoryListPropValue()];
44564
45401
  case 13:
44565
45402
  customDataValue = _b.sent();
44566
- return [3 /*break*/, 51];
45403
+ return [3 /*break*/, 55];
44567
45404
  case 14: return [4 /*yield*/, this.getCategoryPropValue()];
44568
45405
  case 15:
44569
45406
  customDataValue = _b.sent();
44570
- return [3 /*break*/, 51];
45407
+ return [3 /*break*/, 55];
44571
45408
  case 16: return [4 /*yield*/, this.getColorPropValue()];
44572
45409
  case 17:
44573
45410
  customDataValue = _b.sent();
44574
- return [3 /*break*/, 51];
45411
+ return [3 /*break*/, 55];
44575
45412
  case 18: return [4 /*yield*/, this.getImageListPropValue()];
44576
45413
  case 19:
44577
45414
  customDataValue = _b.sent();
44578
- return [3 /*break*/, 51];
45415
+ return [3 /*break*/, 55];
44579
45416
  case 20: return [4 /*yield*/, this.getImagePropValue()];
44580
45417
  case 21:
44581
45418
  customDataValue = _b.sent();
44582
- return [3 /*break*/, 51];
45419
+ return [3 /*break*/, 55];
44583
45420
  case 22: return [4 /*yield*/, this.getLinkPropValue()];
44584
45421
  case 23:
44585
45422
  customDataValue = _b.sent();
44586
- return [3 /*break*/, 51];
45423
+ return [3 /*break*/, 55];
44587
45424
  case 24: return [4 /*yield*/, this.getProductDetailPropValue()];
44588
45425
  case 25:
44589
45426
  customDataValue = _b.sent();
44590
- return [3 /*break*/, 51];
45427
+ return [3 /*break*/, 55];
44591
45428
  case 26: return [4 /*yield*/, this.getProductListPropValue()];
44592
45429
  case 27:
44593
45430
  customDataValue = _b.sent();
44594
- return [3 /*break*/, 51];
45431
+ return [3 /*break*/, 55];
44595
45432
  case 28: return [4 /*yield*/, this.getProductAttributePropValue()];
44596
45433
  case 29:
44597
45434
  customDataValue = _b.sent();
44598
- return [3 /*break*/, 51];
45435
+ return [3 /*break*/, 55];
44599
45436
  case 30: return [4 /*yield*/, this.getProductAttributeListPropValue()];
44600
45437
  case 31:
44601
45438
  customDataValue = _b.sent();
44602
- return [3 /*break*/, 51];
45439
+ return [3 /*break*/, 55];
44603
45440
  case 32: return [4 /*yield*/, this.getObjectValue()];
44604
45441
  case 33:
44605
45442
  customDataValue = _b.sent();
44606
- return [3 /*break*/, 51];
45443
+ return [3 /*break*/, 55];
44607
45444
  case 34: return [4 /*yield*/, this.getArrayValue()];
44608
45445
  case 35:
44609
45446
  customDataValue = _b.sent();
44610
- return [3 /*break*/, 51];
45447
+ return [3 /*break*/, 55];
44611
45448
  case 36: return [4 /*yield*/, this.getEnumValue()];
44612
45449
  case 37:
44613
45450
  customDataValue = _b.sent();
44614
- return [3 /*break*/, 51];
45451
+ return [3 /*break*/, 55];
44615
45452
  case 38: return [4 /*yield*/, this.getCustomDataValue()];
44616
45453
  case 39:
44617
45454
  customDataValue = _b.sent();
44618
- return [3 /*break*/, 51];
45455
+ return [3 /*break*/, 55];
44619
45456
  case 40: return [4 /*yield*/, this.getComponentListValue()];
44620
45457
  case 41:
44621
45458
  customDataValue = _b.sent();
44622
- return [3 /*break*/, 51];
45459
+ return [3 /*break*/, 55];
44623
45460
  case 42: return [4 /*yield*/, this.getBlogValue()];
44624
45461
  case 43:
44625
45462
  customDataValue = _b.sent();
44626
- return [3 /*break*/, 51];
45463
+ return [3 /*break*/, 55];
44627
45464
  case 44: return [4 /*yield*/, this.getBlogListValue()];
44628
45465
  case 45:
44629
45466
  customDataValue = _b.sent();
44630
- return [3 /*break*/, 51];
45467
+ return [3 /*break*/, 55];
44631
45468
  case 46: return [4 /*yield*/, this.getBlogCategoryValue()];
44632
45469
  case 47:
44633
45470
  customDataValue = _b.sent();
44634
- return [3 /*break*/, 51];
45471
+ return [3 /*break*/, 55];
44635
45472
  case 48: return [4 /*yield*/, this.getBlogCategoryListValue()];
44636
45473
  case 49:
44637
45474
  customDataValue = _b.sent();
44638
- return [3 /*break*/, 51];
44639
- case 50: return [3 /*break*/, 51];
44640
- case 51: return [3 /*break*/, 53];
44641
- case 52:
45475
+ return [3 /*break*/, 55];
45476
+ case 50: return [4 /*yield*/, this.getRaffleValue()];
45477
+ case 51:
45478
+ customDataValue = _b.sent();
45479
+ return [3 /*break*/, 55];
45480
+ case 52: return [4 /*yield*/, this.getRaffleListValue()];
45481
+ case 53:
45482
+ customDataValue = _b.sent();
45483
+ return [3 /*break*/, 55];
45484
+ case 54: return [3 /*break*/, 55];
45485
+ case 55: return [3 /*break*/, 57];
45486
+ case 56:
44642
45487
  _b.sent();
44643
45488
  return [2 /*return*/];
44644
- case 53:
45489
+ case 57:
44645
45490
  if (this.customData.isRequired &&
44646
45491
  ((customDataValue === null || customDataValue === void 0 ? void 0 : customDataValue.value) === undefined || (customDataValue === null || customDataValue === void 0 ? void 0 : customDataValue.value) === null))
44647
45492
  return [2 /*return*/];
@@ -44936,6 +45781,7 @@ var IkasCustomPropValueProvider = /** @class */ (function () {
44936
45781
  return [3 /*break*/, 3];
44937
45782
  nestedValue = this.value[nestedData.key];
44938
45783
  if (nestedData.isRequired &&
45784
+ nestedData.type !== IkasThemeComponentPropType.RAFFLE_LIST &&
44939
45785
  (nestedValue === undefined || nestedValue === null))
44940
45786
  throw new Error("Required data is missing");
44941
45787
  nestedProvider = new IkasCustomPropValueProvider(nestedValue, nestedData, this.theme, this.pageType, this.pageDataProvider, this.pageSpecificData);
@@ -44974,6 +45820,7 @@ var IkasCustomPropValueProvider = /** @class */ (function () {
44974
45820
  if (!(_i < _a.length)) return [3 /*break*/, 4];
44975
45821
  itemValue = _a[_i];
44976
45822
  if (nestedData.isRequired &&
45823
+ nestedData.type !== IkasThemeComponentPropType.RAFFLE_LIST &&
44977
45824
  (itemValue === undefined || itemValue === null))
44978
45825
  throw new Error("Required data is missing");
44979
45826
  provider = new IkasCustomPropValueProvider(itemValue, nestedData, this.theme, this.pageType, this.pageDataProvider, this.pageSpecificData);
@@ -45124,6 +45971,42 @@ var IkasCustomPropValueProvider = /** @class */ (function () {
45124
45971
  });
45125
45972
  });
45126
45973
  };
45974
+ IkasCustomPropValueProvider.prototype.getRaffleValue = function () {
45975
+ return __awaiter(this, void 0, void 0, function () {
45976
+ var provider, value;
45977
+ return __generator(this, function (_a) {
45978
+ switch (_a.label) {
45979
+ case 0:
45980
+ provider = new IkasRafflePropValueProvider(this.value);
45981
+ return [4 /*yield*/, provider.getValue()];
45982
+ case 1:
45983
+ value = _a.sent();
45984
+ return [2 /*return*/, {
45985
+ value: value,
45986
+ customData: this.customData,
45987
+ }];
45988
+ }
45989
+ });
45990
+ });
45991
+ };
45992
+ IkasCustomPropValueProvider.prototype.getRaffleListValue = function () {
45993
+ return __awaiter(this, void 0, void 0, function () {
45994
+ var provider, value;
45995
+ return __generator(this, function (_a) {
45996
+ switch (_a.label) {
45997
+ case 0:
45998
+ provider = new IkasRaffleListPropValueProvider();
45999
+ return [4 /*yield*/, provider.getValue()];
46000
+ case 1:
46001
+ value = _a.sent();
46002
+ return [2 /*return*/, {
46003
+ value: value,
46004
+ customData: this.customData,
46005
+ }];
46006
+ }
46007
+ });
46008
+ });
46009
+ };
45127
46010
  return IkasCustomPropValueProvider;
45128
46011
  }());
45129
46012
 
@@ -45248,12 +46131,12 @@ var IkasPageDataProvider = /** @class */ (function () {
45248
46131
  });
45249
46132
  };
45250
46133
  IkasPageDataProvider.prototype.getPageSpecificData = function () {
45251
- var _a, _b;
46134
+ var _a, _b, _c;
45252
46135
  return __awaiter(this, void 0, void 0, function () {
45253
- var slug, metaDataList, metaData, handleProductPage, handleBrandPage, handleCategoryPage, handleBlogPage, handleBlogCategoryPage, _c;
46136
+ var slug, metaDataList, metaData, handleProductPage, handleBrandPage, handleCategoryPage, handleBlogPage, handleBlogCategoryPage, handleRafflePage, _d;
45254
46137
  var _this = this;
45255
- return __generator(this, function (_d) {
45256
- switch (_d.label) {
46138
+ return __generator(this, function (_e) {
46139
+ switch (_e.label) {
45257
46140
  case 0:
45258
46141
  if (this.pageType &&
45259
46142
  ![
@@ -45262,6 +46145,7 @@ var IkasPageDataProvider = /** @class */ (function () {
45262
46145
  IkasThemePageType.CATEGORY,
45263
46146
  IkasThemePageType.BLOG,
45264
46147
  IkasThemePageType.BLOG_CATEGORY,
46148
+ IkasThemePageType.RAFFLE_DETAIL,
45265
46149
  ].includes(this.pageType))
45266
46150
  return [2 /*return*/];
45267
46151
  slug = this.pageParams.slug;
@@ -45272,17 +46156,25 @@ var IkasPageDataProvider = /** @class */ (function () {
45272
46156
  if (!(((_a = this.possiblePageTypes) === null || _a === void 0 ? void 0 : _a.includes(IkasThemePageType.BLOG)) || ((_b = this.possiblePageTypes) === null || _b === void 0 ? void 0 : _b.includes(IkasThemePageType.BLOG_CATEGORY)))) return [3 /*break*/, 2];
45273
46157
  return [4 /*yield*/, IkasBlogAPI.listBlogMetaData(slug)];
45274
46158
  case 1:
45275
- metaDataList = _d.sent();
46159
+ metaDataList = _e.sent();
45276
46160
  if (!metaDataList.length)
45277
46161
  return [2 /*return*/];
45278
- return [3 /*break*/, 4];
45279
- case 2: return [4 /*yield*/, IkasHTMLMetaDataAPI.listHTMLMetaData(slug)];
46162
+ return [3 /*break*/, 6];
46163
+ case 2:
46164
+ if (!((_c = this.possiblePageTypes) === null || _c === void 0 ? void 0 : _c.includes(IkasThemePageType.RAFFLE_DETAIL))) return [3 /*break*/, 4];
46165
+ return [4 /*yield*/, IkasRaffleAPI.listRaffleMetaData(slug)];
45280
46166
  case 3:
45281
- metaDataList = _d.sent();
46167
+ metaDataList = _e.sent();
46168
+ if (!metaDataList.length)
46169
+ return [2 /*return*/];
46170
+ return [3 /*break*/, 6];
46171
+ case 4: return [4 /*yield*/, IkasHTMLMetaDataAPI.listHTMLMetaData(slug)];
46172
+ case 5:
46173
+ metaDataList = _e.sent();
45282
46174
  if (!metaDataList || !metaDataList.length)
45283
46175
  return [2 /*return*/];
45284
- _d.label = 4;
45285
- case 4:
46176
+ _e.label = 6;
46177
+ case 6:
45286
46178
  metaData = metaDataList[0];
45287
46179
  if (!metaData.targetId)
45288
46180
  return [2 /*return*/];
@@ -45407,27 +46299,49 @@ var IkasPageDataProvider = /** @class */ (function () {
45407
46299
  }
45408
46300
  });
45409
46301
  }); };
45410
- _c = metaData.targetType;
45411
- switch (_c) {
45412
- case IkasHTMLMetaDataTargetType.BRAND: return [3 /*break*/, 5];
45413
- case IkasHTMLMetaDataTargetType.CATEGORY: return [3 /*break*/, 7];
45414
- case IkasHTMLMetaDataTargetType.PRODUCT: return [3 /*break*/, 9];
45415
- case IkasBlogMetadataTargetType.BLOG: return [3 /*break*/, 11];
45416
- case IkasBlogMetadataTargetType.BLOG_CATEGORY: return [3 /*break*/, 13];
46302
+ handleRafflePage = function () { return __awaiter(_this, void 0, void 0, function () {
46303
+ var response, raffle;
46304
+ return __generator(this, function (_a) {
46305
+ switch (_a.label) {
46306
+ case 0: return [4 /*yield*/, IkasRaffleAPI.listRaffles({
46307
+ id: metaData.targetId,
46308
+ })];
46309
+ case 1:
46310
+ response = _a.sent();
46311
+ if (!response)
46312
+ return [2 /*return*/];
46313
+ raffle = response.raffles[0];
46314
+ this.pageSpecificData = raffle;
46315
+ this.pageType = IkasThemePageType.RAFFLE_DETAIL;
46316
+ this.setPageMetaData(metaData);
46317
+ return [2 /*return*/];
46318
+ }
46319
+ });
46320
+ }); };
46321
+ _d = metaData.targetType;
46322
+ switch (_d) {
46323
+ case IkasHTMLMetaDataTargetType.BRAND: return [3 /*break*/, 7];
46324
+ case IkasHTMLMetaDataTargetType.CATEGORY: return [3 /*break*/, 9];
46325
+ case IkasHTMLMetaDataTargetType.PRODUCT: return [3 /*break*/, 11];
46326
+ case IkasBlogMetadataTargetType.BLOG: return [3 /*break*/, 13];
46327
+ case IkasBlogMetadataTargetType.BLOG_CATEGORY: return [3 /*break*/, 15];
46328
+ case IkasRaffleMetadataTargetType.RAFFLE: return [3 /*break*/, 17];
45417
46329
  }
45418
- return [3 /*break*/, 15];
45419
- case 5: return [4 /*yield*/, handleBrandPage()];
45420
- case 6: return [2 /*return*/, _d.sent()];
45421
- case 7: return [4 /*yield*/, handleCategoryPage()];
45422
- case 8: return [2 /*return*/, _d.sent()];
45423
- case 9: return [4 /*yield*/, handleProductPage()];
45424
- case 10: return [2 /*return*/, _d.sent()];
45425
- case 11: return [4 /*yield*/, handleBlogPage()];
45426
- case 12: return [2 /*return*/, _d.sent()];
45427
- case 13: return [4 /*yield*/, handleBlogCategoryPage()];
45428
- case 14: return [2 /*return*/, _d.sent()];
45429
- case 15: return [3 /*break*/, 16];
45430
- case 16: return [2 /*return*/];
46330
+ return [3 /*break*/, 19];
46331
+ case 7: return [4 /*yield*/, handleBrandPage()];
46332
+ case 8: return [2 /*return*/, _e.sent()];
46333
+ case 9: return [4 /*yield*/, handleCategoryPage()];
46334
+ case 10: return [2 /*return*/, _e.sent()];
46335
+ case 11: return [4 /*yield*/, handleProductPage()];
46336
+ case 12: return [2 /*return*/, _e.sent()];
46337
+ case 13: return [4 /*yield*/, handleBlogPage()];
46338
+ case 14: return [2 /*return*/, _e.sent()];
46339
+ case 15: return [4 /*yield*/, handleBlogCategoryPage()];
46340
+ case 16: return [2 /*return*/, _e.sent()];
46341
+ case 17: return [4 /*yield*/, handleRafflePage()];
46342
+ case 18: return [2 /*return*/, _e.sent()];
46343
+ case 19: return [3 /*break*/, 20];
46344
+ case 20: return [2 /*return*/];
45431
46345
  }
45432
46346
  });
45433
46347
  });
@@ -45469,13 +46383,15 @@ var IkasPageDataProvider = /** @class */ (function () {
45469
46383
  };
45470
46384
  IkasPageDataProvider.prototype.getPageComponentPropValue = function (pageComponent, prop) {
45471
46385
  return __awaiter(this, void 0, void 0, function () {
45472
- var propValueProvider, propValue, _a, customData, pageComponents;
46386
+ var propValueProvider, propValue, emptyPropValueTypes, _a, customData, pageComponents;
45473
46387
  var _this = this;
45474
46388
  return __generator(this, function (_b) {
45475
46389
  switch (_b.label) {
45476
46390
  case 0:
45477
46391
  propValue = pageComponent.propValues[prop.name];
45478
- if (propValue === null || propValue === undefined)
46392
+ emptyPropValueTypes = [IkasThemeComponentPropType.RAFFLE_LIST];
46393
+ if ((propValue === null || propValue === undefined) &&
46394
+ !emptyPropValueTypes.includes(prop.type))
45479
46395
  return [2 /*return*/, null];
45480
46396
  _a = prop.type;
45481
46397
  switch (_a) {
@@ -45502,78 +46418,86 @@ var IkasPageDataProvider = /** @class */ (function () {
45502
46418
  case IkasThemeComponentPropType.BLOG_LIST: return [3 /*break*/, 20];
45503
46419
  case IkasThemeComponentPropType.BLOG_CATEGORY: return [3 /*break*/, 21];
45504
46420
  case IkasThemeComponentPropType.BLOG_CATEGORY_LIST: return [3 /*break*/, 22];
46421
+ case IkasThemeComponentPropType.RAFFLE: return [3 /*break*/, 23];
46422
+ case IkasThemeComponentPropType.RAFFLE_LIST: return [3 /*break*/, 24];
45505
46423
  }
45506
- return [3 /*break*/, 23];
46424
+ return [3 /*break*/, 25];
45507
46425
  case 1:
45508
46426
  propValueProvider = new IkasTextPropValueProvider(propValue);
45509
- return [3 /*break*/, 24];
46427
+ return [3 /*break*/, 26];
45510
46428
  case 2:
45511
46429
  propValueProvider = new IkasRichTextPropValueProvider(propValue);
45512
- return [3 /*break*/, 24];
46430
+ return [3 /*break*/, 26];
45513
46431
  case 3:
45514
46432
  propValueProvider = new IkasBooleanPropValueProvider(propValue);
45515
- return [3 /*break*/, 24];
46433
+ return [3 /*break*/, 26];
45516
46434
  case 4:
45517
46435
  propValueProvider = new IkasImagePropValueProvider(propValue);
45518
- return [3 /*break*/, 24];
46436
+ return [3 /*break*/, 26];
45519
46437
  case 5:
45520
46438
  propValueProvider = new IkasImageListPropValueProvider(propValue);
45521
- return [3 /*break*/, 24];
46439
+ return [3 /*break*/, 26];
45522
46440
  case 6:
45523
46441
  propValueProvider = new IkasBrandPropValueProvider(propValue);
45524
- return [3 /*break*/, 24];
46442
+ return [3 /*break*/, 26];
45525
46443
  case 7:
45526
46444
  propValueProvider = new IkasBrandListPropValueProvider(propValue);
45527
- return [3 /*break*/, 24];
46445
+ return [3 /*break*/, 26];
45528
46446
  case 8:
45529
46447
  propValueProvider = new IkasProductListPropValueProvider(this.pageType, propValue, this.pageSpecificData);
45530
- return [3 /*break*/, 24];
46448
+ return [3 /*break*/, 26];
45531
46449
  case 9:
45532
46450
  propValueProvider = new IkasProductDetailPropValueProvider(propValue);
45533
- return [3 /*break*/, 24];
46451
+ return [3 /*break*/, 26];
45534
46452
  case 10:
45535
46453
  propValueProvider = new IkasAttributePropValueProvider(propValue);
45536
- return [3 /*break*/, 24];
46454
+ return [3 /*break*/, 26];
45537
46455
  case 11:
45538
46456
  propValueProvider = new IkasAttributeListPropValueProvider(propValue);
45539
- return [3 /*break*/, 24];
46457
+ return [3 /*break*/, 26];
45540
46458
  case 12:
45541
46459
  propValueProvider = new IkasCategoryPropValueProvider(propValue);
45542
- return [3 /*break*/, 24];
46460
+ return [3 /*break*/, 26];
45543
46461
  case 13:
45544
46462
  propValueProvider = new IkasCategoryListPropValueProvider(propValue);
45545
- return [3 /*break*/, 24];
46463
+ return [3 /*break*/, 26];
45546
46464
  case 14:
45547
46465
  propValueProvider = new IkasLinkPropValueProvider(propValue, this.theme);
45548
- return [3 /*break*/, 24];
46466
+ return [3 /*break*/, 26];
45549
46467
  case 15:
45550
46468
  propValueProvider = new IkasColorPropValueProvider(propValue);
45551
- return [3 /*break*/, 24];
46469
+ return [3 /*break*/, 26];
45552
46470
  case 16:
45553
46471
  customData = this.theme.customData.find(function (cd) { return cd.id === prop.customDataId; });
45554
46472
  if (!customData)
45555
46473
  return [2 /*return*/];
45556
46474
  propValueProvider = new IkasCustomPropValueProvider(propValue, customData, this.theme, this.pageType, this, this.pageSpecificData, this.pageParams);
45557
- return [3 /*break*/, 24];
46475
+ return [3 /*break*/, 26];
45558
46476
  case 17:
45559
46477
  pageComponents = propValue;
45560
46478
  return [4 /*yield*/, Promise.all(pageComponents.map(function (tp) { return _this.getPageComponentPropValues(tp); }))];
45561
46479
  case 18: return [2 /*return*/, _b.sent()];
45562
46480
  case 19:
45563
46481
  propValueProvider = new IkasBlogPropValueProvider(propValue);
45564
- return [3 /*break*/, 24];
46482
+ return [3 /*break*/, 26];
45565
46483
  case 20:
45566
46484
  propValueProvider = new IkasBlogListPropValueProvider(this.pageType, propValue, this.pageSpecificData);
45567
- return [3 /*break*/, 24];
46485
+ return [3 /*break*/, 26];
45568
46486
  case 21:
45569
46487
  propValueProvider = new IkasBlogCategoryPropValueProvider(propValue);
45570
- return [3 /*break*/, 24];
46488
+ return [3 /*break*/, 26];
45571
46489
  case 22:
45572
46490
  propValueProvider = new IkasBlogCategoryListPropValueProvider(propValue);
45573
- return [3 /*break*/, 24];
45574
- case 23: return [3 /*break*/, 24];
45575
- case 24: return [4 /*yield*/, (propValueProvider === null || propValueProvider === void 0 ? void 0 : propValueProvider.getValue())];
45576
- case 25: return [2 /*return*/, _b.sent()];
46491
+ return [3 /*break*/, 26];
46492
+ case 23:
46493
+ propValueProvider = new IkasRafflePropValueProvider(propValue);
46494
+ return [3 /*break*/, 26];
46495
+ case 24:
46496
+ propValueProvider = new IkasRaffleListPropValueProvider();
46497
+ return [3 /*break*/, 26];
46498
+ case 25: return [3 /*break*/, 26];
46499
+ case 26: return [4 /*yield*/, (propValueProvider === null || propValueProvider === void 0 ? void 0 : propValueProvider.getValue())];
46500
+ case 27: return [2 /*return*/, _b.sent()];
45577
46501
  }
45578
46502
  });
45579
46503
  });
@@ -45631,6 +46555,10 @@ var IkasPageDataInit = /** @class */ (function () {
45631
46555
  var blogCategory = parsed;
45632
46556
  IkasPageDataInit.pageSpecificData = new IkasBlogCategory(blogCategory);
45633
46557
  break;
46558
+ case IkasThemePageType.RAFFLE_DETAIL:
46559
+ var raffle_detail = parsed;
46560
+ IkasPageDataInit.pageSpecificData = new IkasRaffle(raffle_detail);
46561
+ break;
45634
46562
  }
45635
46563
  };
45636
46564
  IkasPageDataInit.isServer = function () {
@@ -45705,6 +46633,12 @@ var IkasPageDataInit = /** @class */ (function () {
45705
46633
  case IkasThemeComponentPropType.BLOG_LIST:
45706
46634
  IkasPageDataInit.initBlogCategoryListPropValue(prop, propValue, pageComponentPropValue);
45707
46635
  break;
46636
+ case IkasThemeComponentPropType.RAFFLE:
46637
+ IkasPageDataInit.initRafflePropValue(prop, propValue, pageComponentPropValue);
46638
+ break;
46639
+ case IkasThemeComponentPropType.RAFFLE_LIST:
46640
+ IkasPageDataInit.initRaffleListPropValue(prop, propValue, pageComponentPropValue);
46641
+ break;
45708
46642
  }
45709
46643
  });
45710
46644
  });
@@ -45893,6 +46827,10 @@ var IkasPageDataInit = /** @class */ (function () {
45893
46827
  return this._initBlogCategoryPropValue(propValue);
45894
46828
  case IkasThemeComponentPropType.BLOG_CATEGORY_LIST:
45895
46829
  return this._initBlogCategoryListPropValue(propValue);
46830
+ case IkasThemeComponentPropType.RAFFLE:
46831
+ return this._initRafflePropValue(propValue);
46832
+ case IkasThemeComponentPropType.RAFFLE_LIST:
46833
+ return this._initRaffleListPropValue(propValue);
45896
46834
  case IkasThemeComponentPropType.OBJECT:
45897
46835
  var objectValue = {};
45898
46836
  for (var _i = 0, _a = customData.nestedData || []; _i < _a.length; _i++) {
@@ -45998,6 +46936,24 @@ var IkasPageDataInit = /** @class */ (function () {
45998
46936
  IkasPageDataInit._initBlogCategoryListPropValue = function (propValue) {
45999
46937
  return new IkasBlogCategoryList(propValue);
46000
46938
  };
46939
+ IkasPageDataInit.initRafflePropValue = function (prop, propValue, pageComponentPropValue) {
46940
+ pageComponentPropValue.propValues[prop.name] = IkasPageDataInit._initRafflePropValue(propValue);
46941
+ };
46942
+ IkasPageDataInit._initRafflePropValue = function (propValue) {
46943
+ if (propValue.rafflePropValue.usePageData) {
46944
+ return this.pageSpecificData;
46945
+ }
46946
+ if (propValue.raffle) {
46947
+ return new IkasRaffle(propValue.raffle);
46948
+ }
46949
+ return getPlaceholderRaffle();
46950
+ };
46951
+ IkasPageDataInit.initRaffleListPropValue = function (prop, propValue, pageComponentPropValue) {
46952
+ pageComponentPropValue.propValues[prop.name] = this._initRaffleListPropValue(propValue);
46953
+ };
46954
+ IkasPageDataInit._initRaffleListPropValue = function (propValue) {
46955
+ return new IkasRaffleList(propValue);
46956
+ };
46001
46957
  IkasPageDataInit.pageSpecificData = observable({});
46002
46958
  return IkasPageDataInit;
46003
46959
  }());
@@ -46443,7 +47399,7 @@ var IkasStorefront = /** @class */ (function () {
46443
47399
  return IkasStorefront;
46444
47400
  }());
46445
47401
 
46446
- var PACKAGE_VERSION = "0.0.163-alpha.13";
47402
+ var PACKAGE_VERSION = "0.2.0";
46447
47403
  // import { version as PACKAGE_VERSION } from "../../../package.json";
46448
47404
  var IkasPageEditorViewModel = /** @class */ (function () {
46449
47405
  function IkasPageEditorViewModel(router) {
@@ -46561,9 +47517,9 @@ var IkasPageEditorViewModel = /** @class */ (function () {
46561
47517
  this.getPagePropValues = function () { return __awaiter(_this, void 0, void 0, function () {
46562
47518
  var pageDataProvider;
46563
47519
  var _this = this;
46564
- var _a, _b, _c;
46565
- return __generator(this, function (_d) {
46566
- switch (_d.label) {
47520
+ var _a, _b, _c, _d;
47521
+ return __generator(this, function (_e) {
47522
+ switch (_e.label) {
46567
47523
  case 0:
46568
47524
  pageDataProvider = new IkasPageDataProvider(this.theme, this.pageParams, (_a = this.page) === null || _a === void 0 ? void 0 : _a.type);
46569
47525
  if (((_b = this.pageParams) === null || _b === void 0 ? void 0 : _b.blogId) || ((_c = this.pageParams) === null || _c === void 0 ? void 0 : _c.blogCategoryId)) {
@@ -46572,10 +47528,13 @@ var IkasPageEditorViewModel = /** @class */ (function () {
46572
47528
  IkasThemePageType.BLOG_CATEGORY,
46573
47529
  ];
46574
47530
  }
47531
+ if ((_d = this.pageParams) === null || _d === void 0 ? void 0 : _d.raffleId) {
47532
+ pageDataProvider.possiblePageTypes = [IkasThemePageType.RAFFLE_DETAIL];
47533
+ }
46575
47534
  this.isLoading = true;
46576
47535
  return [4 /*yield*/, pageDataProvider.getPageData()];
46577
47536
  case 1:
46578
- _d.sent();
47537
+ _e.sent();
46579
47538
  if (pageDataProvider.pageSpecificData) {
46580
47539
  IkasPageDataInit.setPageSpecificData(JSON.stringify(pageDataProvider.pageSpecificData), this.page.type, true);
46581
47540
  }
@@ -46787,7 +47746,7 @@ var IkasPageEditorViewModel = /** @class */ (function () {
46787
47746
  Object.defineProperty(IkasPageEditorViewModel.prototype, "specification", {
46788
47747
  get: function () {
46789
47748
  var _this = this;
46790
- var _a, _b, _c, _d, _e;
47749
+ var _a, _b, _c, _d, _e, _f;
46791
47750
  var selectedPage = this.page;
46792
47751
  var specification;
46793
47752
  if ((selectedPage === null || selectedPage === void 0 ? void 0 : selectedPage.type) === IkasThemePageType.PRODUCT) {
@@ -46805,6 +47764,9 @@ var IkasPageEditorViewModel = /** @class */ (function () {
46805
47764
  if ((selectedPage === null || selectedPage === void 0 ? void 0 : selectedPage.type) === IkasThemePageType.BLOG_CATEGORY) {
46806
47765
  specification = (_e = selectedPage.specifications) === null || _e === void 0 ? void 0 : _e.find(function (s) { var _a; return s.id === ((_a = _this.pageParams) === null || _a === void 0 ? void 0 : _a.blogCategoryId); });
46807
47766
  }
47767
+ if ((selectedPage === null || selectedPage === void 0 ? void 0 : selectedPage.type) === IkasThemePageType.RAFFLE_DETAIL) {
47768
+ specification = (_f = selectedPage.specifications) === null || _f === void 0 ? void 0 : _f.find(function (s) { var _a; return s.id === ((_a = _this.pageParams) === null || _a === void 0 ? void 0 : _a.raffleId); });
47769
+ }
46808
47770
  return specification;
46809
47771
  },
46810
47772
  enumerable: false,
@@ -70737,17 +71699,6 @@ var Note = observer(function (_a) {
70737
71699
  isSuccessStep ? (createElement("div", { className: styles$g.CheckoutNoteDisplay }, vm.checkout.note)) : (createElement(FormItem, { style: { width: "100%" }, type: FormItemType.TEXT_AREA, disableResize: true, label: "", value: vm.checkout.note || "", onChange: onCheckoutNoteChange }))))));
70738
71700
  });
70739
71701
 
70740
- var IkasProductCartLineOption = /** @class */ (function () {
70741
- function IkasProductCartLineOption(data) {
70742
- if (data === void 0) { data = {}; }
70743
- this.productOptionId = data.productOptionId || "";
70744
- this.productOptionsSetId = data.productOptionsSetId || "";
70745
- this.values = data.values || [];
70746
- makeAutoObservable(this);
70747
- }
70748
- return IkasProductCartLineOption;
70749
- }());
70750
-
70751
71702
  var CART_LS_KEY = "cartId";
70752
71703
  var CHECKOUT_LS_KEY = "checkoutId";
70753
71704
  var IkasCartStore = /** @class */ (function () {
@@ -70773,7 +71724,9 @@ var IkasCartStore = /** @class */ (function () {
70773
71724
  cartId = ((_b = this.cart) === null || _b === void 0 ? void 0 : _b.id) || localStorage.getItem(CART_LS_KEY);
70774
71725
  if (!cartId && !customerId)
70775
71726
  return [2 /*return*/];
70776
- return [4 /*yield*/, IkasCartAPI.getCart(cartId || undefined)];
71727
+ return [4 /*yield*/, IkasCartAPI.getCart(cartId || undefined
71728
+ // customerId || undefined // TODO reopen this when we have a way of telling backend that we cleared a cart
71729
+ )];
70777
71730
  case 2:
70778
71731
  cart = _c.sent();
70779
71732
  if (!cart) return [3 /*break*/, 4];
@@ -70837,89 +71790,28 @@ var IkasCartStore = /** @class */ (function () {
70837
71790
  }
70838
71791
  });
70839
71792
  }); };
70840
- this.findExistingItem = function (variant, product) {
70841
- var _a, _b, _c, _d, _e;
70842
- if (!product.productOptionSetId) {
70843
- return (_a = _this.cart) === null || _a === void 0 ? void 0 : _a.items.find(function (item) { return item.variant.id === variant.id; });
70844
- }
70845
- var existingItems = ((_b = _this.cart) === null || _b === void 0 ? void 0 : _b.items.filter(function (item) { return item.variant.id === variant.id; })) || [];
70846
- for (var _i = 0, existingItems_1 = existingItems; _i < existingItems_1.length; _i++) {
70847
- var item = existingItems_1[_i];
70848
- if (item.options) {
70849
- var hasSameOptionValues = true;
70850
- var _loop_1 = function (option) {
70851
- var existingOptionValues = option.values.map(function (v) { return v.value; });
70852
- var productOptionValues = (_e = (_d = (_c = product.productOptionSet) === null || _c === void 0 ? void 0 : _c.options) === null || _d === void 0 ? void 0 : _d.find(function (o) { return o.id === option.productOptionId; })) === null || _e === void 0 ? void 0 : _e.values;
70853
- hasSameOptionValues =
70854
- hasSameOptionValues &&
70855
- existingOptionValues.length === (productOptionValues === null || productOptionValues === void 0 ? void 0 : productOptionValues.values.length) &&
70856
- existingOptionValues.every(function (val) { return productOptionValues === null || productOptionValues === void 0 ? void 0 : productOptionValues.includes(val); });
70857
- if (!hasSameOptionValues)
70858
- return "break";
70859
- };
70860
- for (var _f = 0, _g = item.options; _f < _g.length; _f++) {
70861
- var option = _g[_f];
70862
- var state_1 = _loop_1(option);
70863
- if (state_1 === "break")
70864
- break;
70865
- }
70866
- if (hasSameOptionValues)
70867
- return item;
70868
- }
70869
- }
70870
- };
70871
- this.createCartLineOptions = function (item) {
70872
- if (item && item.options) {
70873
- var options = [];
70874
- for (var _i = 0, _a = item.options; _i < _a.length; _i++) {
70875
- var option = _a[_i];
70876
- var data = new IkasProductCartLineOption({});
70877
- data.productOptionId = option.productOptionId;
70878
- data.productOptionsSetId = option.productOptionsSetId;
70879
- data.values = option.values.map(function (val) { return val.value; });
70880
- options.push(data);
70881
- }
70882
- return options;
70883
- }
70884
- else {
70885
- return null;
70886
- }
70887
- };
70888
71793
  this.addItem = function (variant, product, initialQuantity) {
70889
71794
  if (initialQuantity === void 0) { initialQuantity = 1; }
70890
71795
  return __awaiter(_this, void 0, void 0, function () {
70891
- var existingItem, optionValues_1, cartId, input, cart, eventId, item, err_2;
70892
- var _a, _b, _c, _d, _e;
70893
- return __generator(this, function (_f) {
70894
- switch (_f.label) {
71796
+ var existingItem, cartId, input, cart, eventId, item, err_2;
71797
+ var _a, _b, _c;
71798
+ return __generator(this, function (_d) {
71799
+ switch (_d.label) {
70895
71800
  case 0:
70896
- _f.trys.push([0, 5, , 6]);
70897
- if (!product.canAddToCart)
70898
- return [2 /*return*/, false];
71801
+ _d.trys.push([0, 5, , 6]);
70899
71802
  return [4 /*yield*/, this.beforeCartOperationCheck()];
70900
71803
  case 1:
70901
- _f.sent();
71804
+ _d.sent();
70902
71805
  if (this.cart) {
70903
- existingItem = this.findExistingItem(variant, product);
71806
+ existingItem = this.cart.items.find(function (item) { return item.variant.id === variant.id; });
70904
71807
  if (existingItem) {
70905
- (_a = product.productOptionSet) === null || _a === void 0 ? void 0 : _a.initOptionValues();
70906
71808
  return [2 /*return*/, this.changeItemQuantity(existingItem, existingItem.quantity + 1)];
70907
71809
  }
70908
71810
  }
70909
- optionValues_1 = [];
70910
- (_b = product.productOptionSet) === null || _b === void 0 ? void 0 : _b.options.forEach(function (o) {
70911
- if (o.values.length) {
70912
- optionValues_1.push(new IkasProductCartLineOption({
70913
- productOptionId: o.id,
70914
- productOptionsSetId: o.productOptionSetId,
70915
- values: o.values,
70916
- }));
70917
- }
70918
- });
70919
- cartId = ((_c = this.cart) === null || _c === void 0 ? void 0 : _c.id) || localStorage.getItem(CART_LS_KEY);
71811
+ cartId = ((_a = this.cart) === null || _a === void 0 ? void 0 : _a.id) || localStorage.getItem(CART_LS_KEY);
70920
71812
  input = {
70921
71813
  cartId: cartId,
70922
- customerId: ((_d = this.cart) === null || _d === void 0 ? void 0 : _d.customerId) || ((_e = this.baseStore.customerStore.customer) === null || _e === void 0 ? void 0 : _e.id) ||
71814
+ customerId: ((_b = this.cart) === null || _b === void 0 ? void 0 : _b.customerId) || ((_c = this.baseStore.customerStore.customer) === null || _c === void 0 ? void 0 : _c.id) ||
70923
71815
  null,
70924
71816
  item: {
70925
71817
  id: null,
@@ -70929,7 +71821,6 @@ var IkasCartStore = /** @class */ (function () {
70929
71821
  name: product.name,
70930
71822
  },
70931
71823
  },
70932
- options: optionValues_1.length ? optionValues_1 : null,
70933
71824
  priceListId: IkasStorefrontConfig.priceListId || null,
70934
71825
  salesChannelId: IkasStorefrontConfig.salesChannelId,
70935
71826
  storefrontId: IkasStorefrontConfig.storefrontId,
@@ -70938,12 +71829,12 @@ var IkasCartStore = /** @class */ (function () {
70938
71829
  };
70939
71830
  return [4 /*yield*/, IkasCartAPI.saveItemToCart(input)];
70940
71831
  case 2:
70941
- cart = _f.sent();
71832
+ cart = _d.sent();
70942
71833
  if (!cart) return [3 /*break*/, 4];
70943
71834
  return [4 /*yield*/, this.setCart(cart)];
70944
71835
  case 3:
70945
- _f.sent();
70946
- _f.label = 4;
71836
+ _d.sent();
71837
+ _d.label = 4;
70947
71838
  case 4:
70948
71839
  if (this.cart) {
70949
71840
  eventId = this.cart.id + "-" + this.cart.updatedAt;
@@ -70952,11 +71843,11 @@ var IkasCartStore = /** @class */ (function () {
70952
71843
  Analytics.addToCart(item, initialQuantity, eventId, this.cart);
70953
71844
  }
70954
71845
  }
70955
- return [2 /*return*/, true];
71846
+ return [3 /*break*/, 6];
70956
71847
  case 5:
70957
- err_2 = _f.sent();
71848
+ err_2 = _d.sent();
70958
71849
  console.log(err_2);
70959
- return [2 /*return*/, false];
71850
+ return [3 /*break*/, 6];
70960
71851
  case 6: return [2 /*return*/];
70961
71852
  }
70962
71853
  });
@@ -70984,7 +71875,6 @@ var IkasCartStore = /** @class */ (function () {
70984
71875
  name: item.variant.name,
70985
71876
  },
70986
71877
  },
70987
- options: this.createCartLineOptions(item),
70988
71878
  priceListId: IkasStorefrontConfig.priceListId || null,
70989
71879
  salesChannelId: IkasStorefrontConfig.salesChannelId,
70990
71880
  storefrontId: IkasStorefrontConfig.storefrontId,
@@ -71011,11 +71901,11 @@ var IkasCartStore = /** @class */ (function () {
71011
71901
  Analytics.addToCart(item, quantity - oldQuantity, eventId, this.cart);
71012
71902
  }
71013
71903
  }
71014
- return [2 /*return*/, true];
71904
+ return [3 /*break*/, 6];
71015
71905
  case 5:
71016
71906
  err_3 = _d.sent();
71017
71907
  console.log(err_3);
71018
- return [2 /*return*/, false];
71908
+ return [3 /*break*/, 6];
71019
71909
  case 6: return [2 /*return*/];
71020
71910
  }
71021
71911
  });
@@ -71848,7 +72738,7 @@ var IkasStorefrontAPI = /** @class */ (function () {
71848
72738
  return __generator(this, function (_b) {
71849
72739
  switch (_b.label) {
71850
72740
  case 0:
71851
- QUERY = src(templateObject_1$k || (templateObject_1$k = __makeTemplateObject(["\n query getStorefront($id: String!) {\n getStorefront(id: $id) {\n createdAt\n emailSettingsId\n fbpId\n gtmId\n id\n localizations {\n createdAt\n id\n isDefault\n locale\n name\n }\n mainStorefrontThemeId\n name\n salesChannelId\n routings {\n countryCodes\n createdAt\n domain\n id\n locale\n path\n priceListId\n updatedAt\n }\n status\n themes {\n createdAt\n id\n isMainTheme\n name\n status\n themeId\n themeVersionId\n updatedAt\n }\n }\n }\n "], ["\n query getStorefront($id: String!) {\n getStorefront(id: $id) {\n createdAt\n emailSettingsId\n fbpId\n gtmId\n id\n localizations {\n createdAt\n id\n isDefault\n locale\n name\n }\n mainStorefrontThemeId\n name\n salesChannelId\n routings {\n countryCodes\n createdAt\n domain\n id\n locale\n path\n priceListId\n updatedAt\n }\n status\n themes {\n createdAt\n id\n isMainTheme\n name\n status\n themeId\n themeVersionId\n updatedAt\n }\n }\n }\n "])));
72741
+ QUERY = src(templateObject_1$l || (templateObject_1$l = __makeTemplateObject(["\n query getStorefront($id: String!) {\n getStorefront(id: $id) {\n createdAt\n emailSettingsId\n fbpId\n gtmId\n id\n localizations {\n createdAt\n id\n isDefault\n locale\n name\n }\n mainStorefrontThemeId\n name\n salesChannelId\n routings {\n countryCodes\n createdAt\n domain\n id\n locale\n path\n priceListId\n updatedAt\n }\n status\n themes {\n createdAt\n id\n isMainTheme\n name\n status\n themeId\n themeVersionId\n updatedAt\n }\n }\n }\n "], ["\n query getStorefront($id: String!) {\n getStorefront(id: $id) {\n createdAt\n emailSettingsId\n fbpId\n gtmId\n id\n localizations {\n createdAt\n id\n isDefault\n locale\n name\n }\n mainStorefrontThemeId\n name\n salesChannelId\n routings {\n countryCodes\n createdAt\n domain\n id\n locale\n path\n priceListId\n updatedAt\n }\n status\n themes {\n createdAt\n id\n isMainTheme\n name\n status\n themeId\n themeVersionId\n updatedAt\n }\n }\n }\n "])));
71852
72742
  _b.label = 1;
71853
72743
  case 1:
71854
72744
  _b.trys.push([1, 3, , 4]);
@@ -71879,7 +72769,7 @@ var IkasStorefrontAPI = /** @class */ (function () {
71879
72769
  };
71880
72770
  return IkasStorefrontAPI;
71881
72771
  }());
71882
- var templateObject_1$k;
72772
+ var templateObject_1$l;
71883
72773
 
71884
72774
  var IkasNextPageDataProvider = /** @class */ (function () {
71885
72775
  function IkasNextPageDataProvider() {
@@ -72073,7 +72963,8 @@ var IkasNextPageDataProvider = /** @class */ (function () {
72073
72963
  IkasStorefrontConfig.productBackInStockSettings = productBackInStockSettings;
72074
72964
  IkasStorefrontConfig.customerReviewSettings = customerReviewSettings;
72075
72965
  provider = new IkasPageDataProvider(themeLocalization.themeJson, context.params, pageType);
72076
- provider.possiblePageTypes = possiblePageTypes;
72966
+ provider.possiblePageTypes =
72967
+ possiblePageTypes || (pageType ? [pageType] : []);
72077
72968
  if (!!isEditor) return [3 /*break*/, 3];
72078
72969
  return [4 /*yield*/, provider.getPageData()];
72079
72970
  case 2:
@@ -72697,6 +73588,72 @@ var _slug_$3 = /*#__PURE__*/Object.freeze({
72697
73588
  getStaticProps: getStaticProps$h
72698
73589
  });
72699
73590
 
73591
+ var Page$i = function (props) {
73592
+ return createElement(IkasPage, __assign({}, props));
73593
+ };
73594
+ var _slug_$4 = observer(Page$i);
73595
+ var getStaticPaths$3 = function () { return __awaiter(void 0, void 0, void 0, function () {
73596
+ return __generator(this, function (_a) {
73597
+ return [2 /*return*/, {
73598
+ paths: [],
73599
+ fallback: "blocking",
73600
+ }];
73601
+ });
73602
+ }); };
73603
+ var getStaticProps$i = function (context) { return __awaiter(void 0, void 0, void 0, function () {
73604
+ return __generator(this, function (_a) {
73605
+ switch (_a.label) {
73606
+ case 0: return [4 /*yield*/, IkasNextPageDataProvider.getStaticProps(context, IkasThemePageType.RAFFLE_DETAIL)];
73607
+ case 1: return [2 /*return*/, _a.sent()];
73608
+ }
73609
+ });
73610
+ }); };
73611
+
73612
+ var _slug_$5 = /*#__PURE__*/Object.freeze({
73613
+ __proto__: null,
73614
+ 'default': _slug_$4,
73615
+ getStaticPaths: getStaticPaths$3,
73616
+ getStaticProps: getStaticProps$i
73617
+ });
73618
+
73619
+ var Page$j = function (props) {
73620
+ return createElement(IkasPage, __assign({}, props, { addOgpMetas: true }));
73621
+ };
73622
+ var index$9 = observer(Page$j);
73623
+ var getStaticProps$j = function (context) { return __awaiter(void 0, void 0, void 0, function () {
73624
+ return __generator(this, function (_a) {
73625
+ switch (_a.label) {
73626
+ case 0: return [4 /*yield*/, IkasNextPageDataProvider.getStaticProps(context, IkasThemePageType.RAFFLE)];
73627
+ case 1: return [2 /*return*/, _a.sent()];
73628
+ }
73629
+ });
73630
+ }); };
73631
+
73632
+ var index$a = /*#__PURE__*/Object.freeze({
73633
+ __proto__: null,
73634
+ 'default': index$9,
73635
+ getStaticProps: getStaticProps$j
73636
+ });
73637
+
73638
+ var Page$k = function (props) {
73639
+ return createElement(IkasPage, __assign({}, props));
73640
+ };
73641
+ var raffles = observer(Page$k);
73642
+ var getStaticProps$k = function (context) { return __awaiter(void 0, void 0, void 0, function () {
73643
+ return __generator(this, function (_a) {
73644
+ switch (_a.label) {
73645
+ case 0: return [4 /*yield*/, IkasNextPageDataProvider.getStaticProps(context, IkasThemePageType.RAFFLE_ACOUNT)];
73646
+ case 1: return [2 /*return*/, _a.sent()];
73647
+ }
73648
+ });
73649
+ }); };
73650
+
73651
+ var raffles$1 = /*#__PURE__*/Object.freeze({
73652
+ __proto__: null,
73653
+ 'default': raffles,
73654
+ getStaticProps: getStaticProps$k
73655
+ });
73656
+
72700
73657
  /**
72701
73658
  * Flattens `array` a single level deep.
72702
73659
  *
@@ -73294,6 +74251,14 @@ var IkasCustomerStore = /** @class */ (function () {
73294
74251
  }, 100);
73295
74252
  });
73296
74253
  };
74254
+ this.getRaffles = function () { return __awaiter(_this, void 0, void 0, function () {
74255
+ return __generator(this, function (_a) {
74256
+ switch (_a.label) {
74257
+ case 0: return [4 /*yield*/, IkasRaffleAPI.getRafflesByCustomerId()];
74258
+ case 1: return [2 /*return*/, _a.sent()];
74259
+ }
74260
+ });
74261
+ }); };
73297
74262
  this.baseStore = baseStore;
73298
74263
  this.init();
73299
74264
  makeAutoObservable(this);
@@ -74000,4 +74965,4 @@ var en$1 = /*#__PURE__*/Object.freeze(/*#__PURE__*/Object.assign(/*#__PURE__*/Ob
74000
74965
  'default': en
74001
74966
  }));
74002
74967
 
74003
- export { AccountInfoForm, index$4 as AccountPage, AddressForm, addresses$1 as AddressesPage, Analytics, AnalyticsBody, AnalyticsHead, index$8 as BlogPage, _slug_$3 as BlogSlugPage, cart$1 as CartPage, checkout$1 as CheckoutPage, ContactForm, _slug_$1 as CustomPage, CustomerReviewForm, editor$1 as EditorPage, EmailRule, EqualsRule, favoriteProducts$1 as FavoriteProductsPage, ForgotPasswordForm, forgotPassword$1 as ForgotPasswordPage, IkasAmountTypeEnum$1 as IkasAmountTypeEnum, IkasApplicableProductFilterValue, IkasAttributeDetail, IkasAttributeList, IkasBaseStore, IkasBlog, IkasBlogAPI, IkasBlogCategory, IkasBlogCategoryList, IkasBlogCategoryListPropValue, IkasBlogCategoryListType, IkasBlogCategoryPropValue, IkasBlogContent, IkasBlogList, IkasBlogListPropValue, IkasBlogListType, IkasBlogMetaData, IkasBlogMetadataTargetType, IkasBlogPropValue, IkasBlogTag, IkasBlogWriter, IkasBrand, IkasBrandAPI, IkasBrandList, IkasBrandListPropValue, IkasBrandListSortType, IkasBrandListType, IkasBrandPropValue, IkasCardAssociation, IkasCardType, IkasCartAPI, IkasCategory, IkasCategoryAPI, IkasCategoryList, IkasCategoryListPropValue, IkasCategoryListSortType, IkasCategoryListType, IkasCategoryPropValue, IkasCheckout, IkasCheckoutAPI, IkasCheckoutCustomer, IkasCheckoutRecoveryEmailStatus, IkasCheckoutRecoveryStatus, IkasCheckoutStatus, IkasCityAPI, IkasComponentRenderer, IkasContactForm, IkasContactFormAPI, IkasCountryAPI, IkasCustomer, IkasCustomerAPI, IkasCustomerAddress, IkasCustomerReview, IkasCustomerReviewAPI, IkasCustomerReviewList, IkasDistrictAPI, IkasFavoriteProduct, IkasFavoriteProductAPI, IkasHTMLMetaData, IkasHTMLMetaDataAPI, IkasHTMLMetaDataTargetType, IkasImage, IkasLinkPropValue, IkasLinkType, IkasMerchantAPI, IkasMerchantSettings, IkasNavigationLink, IkasOrder, IkasOrderCancelledReason, IkasOrderLineItem, IkasOrderPackageFulfillStatus, IkasOrderPackageStatus, IkasOrderPaymentStatus, IkasOrderRefundSettings, IkasOrderShippingMethod, IkasOrderStatus, IkasOrderTransaction, IkasPage, IkasPageEditor, IkasPageHead, IkasPaymentMethod, IkasProduct, IkasProductAttribute, IkasProductAttributeAPI, IkasProductAttributeType, IkasProductAttributeValue, IkasProductBackInStockReminderAPI, IkasProductDetail, IkasProductDetailPropValue, IkasProductFilter, IkasProductFilterDisplayType, IkasProductFilterSettings, IkasProductFilterSortType, IkasProductFilterType, IkasProductFilterValue, IkasProductList, IkasProductListPropValue, IkasProductListSortType, IkasProductListType, IkasProductOption, IkasProductOptionDateSettings, IkasProductOptionFileSettings, IkasProductOptionSelectSettings, IkasProductOptionSelectType, IkasProductOptionSelectValue, IkasProductOptionSelectValueTranslations, IkasProductOptionSet, IkasProductOptionSetAPI, IkasProductOptionSetTranslations, IkasProductOptionTextSettings, IkasProductOptionTranslations, IkasProductOptionType, IkasProductPrice, IkasProductSearchAPI, IkasProductType, IkasProductVariant, IkasProductVariantType, IkasShippingMethod, IkasShippingMethodEnum, IkasStateAPI, IkasStorefrontConfig, IkasTheme, IkasThemeComponent, IkasThemeComponentProp, IkasThemeComponentPropType, IkasThemeCustomData, IkasThemePage, IkasThemePageComponent, IkasThemePageType, IkasThemeSettings, IkasTransactionStatusEnum, IkasTransactionTypeEnum, IkasVariantSelectionType, IkasVariantType, IkasVariantTypeAPI, IkasVariantValue, Image, home$1 as IndexPage, LessThanRule, LoginForm, login$1 as LoginPage, MaxRule, MinRule, _404 as NotFoundPage, _id_$1 as OrderDetailPage, OrderLineItemStatusEnum$1 as OrderLineItemStatusEnum, index$6 as OrdersPage, PhoneRule, RangeValue, RecoverPasswordForm, recoverPassword$1 as RecoverPasswordPage, RegisterForm, register$1 as RegisterPage, RequiredRule, search$1 as SearchPage, index$2 as SlugPage, ValidationRule, Validator, ValidatorErrorType, apollo, createTranslationInputData, decodeBase64, findAllIndexes, formatDate, formatMoney, getCurrencySymbol, parseRangeStr, pascalCase, stringSorter, stringToSlug, tryForEach, useTranslation, validatePhoneNumber };
74968
+ export { AccountInfoForm, index$4 as AccountPage, raffles$1 as AccountRafflesPage, AddressForm, addresses$1 as AddressesPage, Analytics, AnalyticsBody, AnalyticsHead, index$8 as BlogPage, _slug_$3 as BlogSlugPage, cart$1 as CartPage, checkout$1 as CheckoutPage, ContactForm, _slug_$1 as CustomPage, CustomerReviewForm, editor$1 as EditorPage, EmailRule, EqualsRule, favoriteProducts$1 as FavoriteProductsPage, ForgotPasswordForm, forgotPassword$1 as ForgotPasswordPage, IdentityNumberRule, IkasAmountTypeEnum$1 as IkasAmountTypeEnum, IkasApplicableProductFilterValue, IkasAttributeDetail, IkasAttributeList, IkasBaseStore, IkasBlog, IkasBlogAPI, IkasBlogCategory, IkasBlogCategoryList, IkasBlogCategoryListPropValue, IkasBlogCategoryListType, IkasBlogCategoryPropValue, IkasBlogContent, IkasBlogList, IkasBlogListPropValue, IkasBlogListType, IkasBlogMetaData, IkasBlogMetadataTargetType, IkasBlogPropValue, IkasBlogTag, IkasBlogWriter, IkasBrand, IkasBrandAPI, IkasBrandList, IkasBrandListPropValue, IkasBrandListSortType, IkasBrandListType, IkasBrandPropValue, IkasCardAssociation, IkasCardType, IkasCartAPI, IkasCategory, IkasCategoryAPI, IkasCategoryList, IkasCategoryListPropValue, IkasCategoryListSortType, IkasCategoryListType, IkasCategoryPropValue, IkasCheckout, IkasCheckoutAPI, IkasCheckoutCustomer, IkasCheckoutRecoveryEmailStatus, IkasCheckoutRecoveryStatus, IkasCheckoutStatus, IkasCityAPI, IkasComponentRenderer, IkasContactForm, IkasContactFormAPI, IkasCountryAPI, IkasCustomer, IkasCustomerAPI, IkasCustomerAddress, IkasCustomerReview, IkasCustomerReviewAPI, IkasCustomerReviewList, IkasDistrictAPI, IkasFavoriteProduct, IkasFavoriteProductAPI, IkasHTMLMetaData, IkasHTMLMetaDataAPI, IkasHTMLMetaDataTargetType, IkasImage, IkasLinkPropValue, IkasLinkType, IkasMerchantAPI, IkasMerchantSettings, IkasNavigationLink, IkasOrder, IkasOrderCancelledReason, IkasOrderLineItem, IkasOrderPackageFulfillStatus, IkasOrderPackageStatus, IkasOrderPaymentStatus, IkasOrderRefundSettings, IkasOrderShippingMethod, IkasOrderStatus, IkasOrderTransaction, IkasPage, IkasPageEditor, IkasPageHead, IkasPaymentMethod, IkasProduct, IkasProductAttribute, IkasProductAttributeAPI, IkasProductAttributeType, IkasProductAttributeValue, IkasProductBackInStockReminderAPI, IkasProductDetail, IkasProductDetailPropValue, IkasProductFilter, IkasProductFilterDisplayType, IkasProductFilterSettings, IkasProductFilterSortType, IkasProductFilterType, IkasProductFilterValue, IkasProductList, IkasProductListPropValue, IkasProductListSortType, IkasProductListType, IkasProductOption, IkasProductOptionDateSettings, IkasProductOptionFileSettings, IkasProductOptionSelectSettings, IkasProductOptionSelectType, IkasProductOptionSelectValue, IkasProductOptionSelectValueTranslations, IkasProductOptionSet, IkasProductOptionSetAPI, IkasProductOptionSetTranslations, IkasProductOptionTextSettings, IkasProductOptionTranslations, IkasProductOptionType, IkasProductPrice, IkasProductSearchAPI, IkasProductType, IkasProductVariant, IkasProductVariantType, IkasRaffle, IkasRaffleAPI, IkasRaffleList, IkasRaffleListPropValue, IkasRaffleMetaData, IkasRaffleParticipant, IkasRafflePropValue, IkasShippingMethod, IkasShippingMethodEnum, IkasStateAPI, IkasStorefrontConfig, IkasTheme, IkasThemeComponent, IkasThemeComponentProp, IkasThemeComponentPropType, IkasThemeCustomData, IkasThemePage, IkasThemePageComponent, IkasThemePageType, IkasThemeSettings, IkasTransactionStatusEnum, IkasTransactionTypeEnum, IkasVariantSelectionType, IkasVariantType, IkasVariantTypeAPI, IkasVariantValue, Image, home$1 as IndexPage, LessThanRule, LoginForm, login$1 as LoginPage, MaxRule, MinRule, _404 as NotFoundPage, _id_$1 as OrderDetailPage, OrderLineItemStatusEnum$1 as OrderLineItemStatusEnum, index$6 as OrdersPage, PhoneRule, RaffleForm, _slug_$5 as RafflePage, index$a as RafflesPage, RangeValue, RecoverPasswordForm, recoverPassword$1 as RecoverPasswordPage, RegisterForm, register$1 as RegisterPage, RequiredRule, search$1 as SearchPage, index$2 as SlugPage, ValidationRule, Validator, ValidatorErrorType, apollo, createTranslationInputData, decodeBase64, findAllIndexes, formatDate, formatMoney, getCurrencySymbol, parseRangeStr, pascalCase, stringSorter, stringToSlug, tryForEach, useTranslation, validatePhoneNumber };