@ikas/storefront 2.0.13 → 2.0.14-alpha.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/__generated__/global-types.d.ts +7 -1
- package/build/api/customer-review/__generated__/listCustomerReviews.d.ts +1 -0
- package/build/api/customer-review/index.js +1 -1
- package/build/api/product-option-set/__generated__/ListProductOptionSet.d.ts +2 -0
- package/build/ikas.js +2 -2
- package/build/models/data/customer-review/index.d.ts +3 -0
- package/build/models/data/customer-review/index.js +1 -1
- package/build/models/data/product-option-set/index.d.ts +4 -0
- package/build/models/data/product-option-set/index.js +1 -1
- package/package.json +1 -1
|
@@ -1,9 +1,11 @@
|
|
|
1
|
+
import { IkasImage } from "../image";
|
|
1
2
|
export declare class IkasCustomerReview {
|
|
2
3
|
comment: string;
|
|
3
4
|
createdAt: string;
|
|
4
5
|
customerId: string;
|
|
5
6
|
deleted: boolean;
|
|
6
7
|
id: string;
|
|
8
|
+
imageIds: string[] | null;
|
|
7
9
|
orderId: string;
|
|
8
10
|
orderNumber: string;
|
|
9
11
|
productId: string;
|
|
@@ -13,6 +15,7 @@ export declare class IkasCustomerReview {
|
|
|
13
15
|
storefrontId: string;
|
|
14
16
|
title: string;
|
|
15
17
|
updatedAt: string;
|
|
18
|
+
images: IkasImage[] | null;
|
|
16
19
|
constructor(data: Partial<IkasCustomerReview>);
|
|
17
20
|
}
|
|
18
21
|
declare enum CustomerReviewStatusEnum {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{makeAutoObservable as t}from"mobx";var
|
|
1
|
+
import{makeAutoObservable as t}from"mobx";import{IkasImage as e}from"../image/index.js";var s,d=function(d){this.comment=d.comment||"",this.createdAt=d.createdAt||"",this.customerId=d.customerId||"",this.deleted=d.deleted||!1,this.id=d.id||"",this.imageIds=d.imageIds||[],this.orderId=d.orderId||"",this.orderNumber=d.orderNumber||"",this.productId=d.productId||"",this.salesChannelId=d.salesChannelId||"",this.star=d.star||0,this.status=d.status||s.APPROVED,this.storefrontId=d.storefrontId||"",this.title=d.title||"",this.updatedAt=d.updatedAt||"",this.images=d.imageIds?d.imageIds.map((function(t){return new e(t)})):null,t(this)};!function(t){t.APPROVED="APPROVED",t.REJECTED="REJECTED",t.WAITING="WAITING"}(s||(s={}));export{d as IkasCustomerReview};
|
|
@@ -3,6 +3,7 @@ export declare enum IkasProductOptionType {
|
|
|
3
3
|
CHOICE = "CHOICE",
|
|
4
4
|
TEXT = "TEXT",
|
|
5
5
|
TEXT_AREA = "TEXT_AREA",
|
|
6
|
+
FILE = "FILE",
|
|
6
7
|
COLOR_PICKER = "COLOR_PICKER",
|
|
7
8
|
DATE_PICKER = "DATE_PICKER",
|
|
8
9
|
CHECKBOX = "CHECKBOX"
|
|
@@ -83,12 +84,15 @@ export declare class IkasProductOption {
|
|
|
83
84
|
private childOptions;
|
|
84
85
|
constructor(data: Partial<IkasProductOption>);
|
|
85
86
|
get displayedChildOptions(): IkasProductOption[];
|
|
87
|
+
private getBase64;
|
|
88
|
+
productOptionFileUpload: (files: File[]) => Promise<string[]>;
|
|
86
89
|
get hasValidValues(): boolean;
|
|
87
90
|
get values(): string[];
|
|
88
91
|
set values(values: string[]);
|
|
89
92
|
initValues: () => void;
|
|
90
93
|
private isValidTextOptionValue;
|
|
91
94
|
private isValidChoiceOptionValue;
|
|
95
|
+
private isValidFileOptionValue;
|
|
92
96
|
private isValidDateOptionValue;
|
|
93
97
|
}
|
|
94
98
|
export declare class IkasProductOptionSet {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{__awaiter as t,__generator as e,__assign as i}from'../../../ext/tslib/tslib.es6.js';import{makeAutoObservable as n}from"mobx";import{IkasImage as
|
|
1
|
+
import{__awaiter as t,__generator as e,__assign as i}from'../../../ext/tslib/tslib.es6.js';import{makeAutoObservable as n}from"mobx";import{IkasImage as s}from"../image/index.js";import{IkasStorefrontConfig as l}from"../../../storefront/index.js";import a from'../../../ext/lodash/sortBy.js';var o,u;!function(t){t.CHOICE="CHOICE",t.TEXT="TEXT",t.TEXT_AREA="TEXT_AREA",t.FILE="FILE",t.COLOR_PICKER="COLOR_PICKER",t.DATE_PICKER="DATE_PICKER",t.CHECKBOX="CHECKBOX"}(o||(o={})),function(t){t.SELECT="SELECT",t.BOX="BOX",t.SWATCH="SWATCH"}(u||(u={}));var r=function(t){this.id=t.id||"",this.value=t.value||null,n(this)},d=function(t){var e;this.id=t.id||"",this.name=t.name||null,this.optionalText=t.optionalText||null,this.values=(null===(e=t.values)||void 0===e?void 0:e.map((function(t){return new r(t)})))||[],n(this)},h=function(t){var e;this.locale=t.locale||"",this.options=(null===(e=t.options)||void 0===e?void 0:e.map((function(t){return new d(t)})))||[],n(this)},c=function(t){void 0===t&&(t={}),this.thumbnailImage=null,this.id=t.id||"",this.order=t.order||0,this.value=t.value||"",this.price=t.price||null,this.thumbnailImageId=t.thumbnailImageId||null,this.colorCode=t.colorCode||null,this.thumbnailImage=this.thumbnailImageId?new s(this.thumbnailImageId):null,n(this)},p=function(t){var e;void 0===t&&(t={}),this.type=t.type||u.BOX,this.minSelect=null!==t.minSelect&&void 0!==t.minSelect?t.minSelect:null,this.maxSelect=null!==t.maxSelect&&void 0!==t.maxSelect?t.maxSelect:null,this.values=a((null===(e=t.values)||void 0===e?void 0:e.map((function(t){return new c(t)})))||[],"order"),n(this)},f=function(t){this.min=t.min||null,this.max=t.max||null,this.minRelativeNextDate=t.minRelativeNextDate||null,this.maxRelativeNextDate=t.maxRelativeNextDate||null,n(this)},m=function(t){void 0===t&&(t={}),this.min=null!==t.min&&void 0!==t.min?t.min:null,this.max=null!==t.max&&void 0!==t.max?t.max:null,n(this)},v=function(t){this.allowedExtensions=t.allowedExtensions||null,this.minQuantity=null!==t.minQuantity&&void 0!==t.minQuantity?t.minQuantity:null,this.maxQuantity=null!==t.maxQuantity&&void 0!==t.maxQuantity?t.maxQuantity:null,n(this)},g=function(){function i(i){var s=this;this._values=[],this.childOptions=[],this.productOptionFileUpload=function(i){return t(s,void 0,void 0,(function(){var n,s,a=this;return e(this,(function(o){switch(o.label){case 0:return 0===i.length||this.fileSettings&&this.fileSettings.maxQuantity&&this.fileSettings.maxQuantity<i.length?[2,[]]:(n="".concat(process.env.NEXT_PUBLIC_BASE_URL,"/api/sf/admin/upload-product-option-file"),s=function(i){return t(a,void 0,void 0,(function(){var t,s,a,o,u,r;return e(this,(function(e){switch(e.label){case 0:return t=fetch,s=[n],u={method:"POST",headers:{"x-api-key":l.config.apiKey||"","x-sfid":l.storefrontId||"","x-sfrid":l.storefrontRoutingId||"","Content-Type":"application/json",Accept:"application/json"}},o=(a=JSON).stringify,r={productOptionSetId:this.productOptionSetId,productOptionId:this.id},[4,this.getBase64(i)];case 1:return[4,t.apply(void 0,s.concat([(u.body=o.apply(a,[(r.base64=e.sent(),r)]),u)]))];case 2:return[4,e.sent().text()];case 3:return[2,e.sent()]}}))}))},[4,Promise.all(i.map((function(t){return s(t)})))]);case 1:return[2,o.sent()]}}))}))},this.initValues=function(){s.isOptional||(s.values=[],s.childOptions&&s.childOptions.forEach((function(t){return t.initValues()})))},this.isValidTextOptionValue=function(){var t=s.values[0];return t?!!s.textSettings&&(null===s.textSettings.min||t.length>=s.textSettings.min)&&(null===s.textSettings.max||t.length<=s.textSettings.max):!!s.isOptional},this.isValidChoiceOptionValue=function(){return s.values.length?!!s.selectSettings&&(null===s.selectSettings.minSelect||s.values.length>=s.selectSettings.minSelect)&&(null===s.selectSettings.maxSelect||s.values.length<=s.selectSettings.maxSelect):!!s.isOptional},this.isValidFileOptionValue=function(){return s.values.length?!!s.fileSettings&&(null===s.fileSettings.minQuantity||s.values.length>=s.fileSettings.minQuantity)&&(null===s.fileSettings.maxQuantity||s.values.length<=s.fileSettings.maxQuantity):!!s.isOptional},this.isValidDateOptionValue=function(){if(!s.values.length)return!!s.isOptional;if(s.dateSettings){var t=new Date,e=new Date;null!==s.dateSettings.minRelativeNextDate&&(t=s.dateSettings.minRelativeNextDate<0?new Date(t.setDate(t.getDate()-Math.abs(s.dateSettings.minRelativeNextDate))):new Date(t.setDate(t.getDate()+Math.abs(s.dateSettings.minRelativeNextDate)))),null!==s.dateSettings.maxRelativeNextDate&&(e=s.dateSettings.maxRelativeNextDate<0?new Date(e.setDate(e.getDate()-Math.abs(s.dateSettings.maxRelativeNextDate))):new Date(e.setDate(e.getDate()+Math.abs(s.dateSettings.maxRelativeNextDate))));var i=new Date(new Date(s.values[0]).setHours(23,59,59));return i.getTime()>=t.getTime()&&i.getTime()<=e.getTime()}return!0},this.id=i.id||"",this.productOptionSetId=i.productOptionSetId||"",this.name=i.name||"",this.order=i.order||0,this.type=i.type||o.CHOICE,this.selectSettings=i.selectSettings?new p(i.selectSettings||{}):null,this.textSettings=i.textSettings?new m(i.textSettings||{}):null,this.fileSettings=i.fileSettings?new v(i.fileSettings||{}):null,this.dateSettings=i.dateSettings?new f(i.dateSettings||{}):null,this.price=i.price||null,this.isOptional=i.isOptional||!1,this.optionalText=i.optionalText||null,this.requiredOptionId=i.requiredOptionId||null,this.requiredOptionValueIds=i.requiredOptionValueIds||null,this.values=i.values||[],this.childOptions=i.childOptions||[],n(this)}return Object.defineProperty(i.prototype,"displayedChildOptions",{get:function(){var t=this;return a(this.childOptions.filter((function(e){var i;return(null===(i=e.requiredOptionValueIds)||void 0===i?void 0:i.length)?e.requiredOptionValueIds.every((function(e){return t.values.some((function(t){return t===e}))})):t.type===o.CHECKBOX?!!t.values.length&&"true"===t.values[0]:!!t.values.length})),"order")},enumerable:!1,configurable:!0}),i.prototype.getBase64=function(t){return new Promise((function(e){var i=new FileReader;i.addEventListener("load",(function(){return e(i.result)})),i.readAsDataURL(t)}))},Object.defineProperty(i.prototype,"hasValidValues",{get:function(){if(!this.values.length&&!this.isOptional)return!1;var t=!1;switch(this.type){case o.TEXT:case o.TEXT_AREA:t=this.isValidTextOptionValue();break;case o.CHECKBOX:case o.COLOR_PICKER:t=!0;break;case o.CHOICE:t=this.isValidChoiceOptionValue();break;case o.DATE_PICKER:t=this.isValidDateOptionValue();break;case o.FILE:t=this.isValidFileOptionValue()}return t&&this.displayedChildOptions.every((function(t){return t.hasValidValues}))},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"values",{get:function(){return this._values},set:function(t){this._values=t,t.length||this.childOptions.forEach((function(t){return t.values=[]}))},enumerable:!1,configurable:!0}),i}(),O=function(){function s(s){var l,a,o=this;this.initOptionValues=function(){return t(o,void 0,void 0,(function(){return e(this,(function(t){return this.options.forEach((function(t){return t.initValues()})),[2]}))}))},this.id=s.id||"",this.name=s.name||"",this.options=(null===(l=s.options)||void 0===l?void 0:l.map((function(t){return new g(i(i({},t),{productOptionSetId:o.id}))})))||[],this.translations=s.translations?null===(a=s.translations)||void 0===a?void 0:a.map((function(t){return new h(t)})):null,this.setChildOptions(),this.setTranslations(),this.initOptionValues(),n(this)}return Object.defineProperty(s.prototype,"displayedOptions",{get:function(){return a(this.options.filter((function(t){return!t.requiredOptionId})),"order")},enumerable:!1,configurable:!0}),s.prototype.setTranslations=function(){var t,e=this,i=l.getCurrentLocale();if(this.translations&&this.translations.some((function(t){return t.locale===i}))){var n=this.translations.find((function(t){return t.locale===i}));null===(t=null==n?void 0:n.options)||void 0===t||t.forEach((function(t){var i,n=e.options.find((function(e){return e.id===t.id}));n&&(n.name=t.name||n.name,n.optionalText=t.optionalText||n.optionalText,n.type===o.CHOICE&&(null===(i=t.values)||void 0===i||i.forEach((function(t){var e,i=null===(e=n.selectSettings)||void 0===e?void 0:e.values.find((function(e){return e.id===t.id}));i&&(i.value=t.value||i.value)}))))}))}},s.prototype.setChildOptions=function(){var t=this;this.options.forEach((function(e){var i=t.options.filter((function(t){return t.requiredOptionId===e.id}));i.length&&(e.childOptions=i)}))},s}();export{g as IkasProductOption,f as IkasProductOptionDateSettings,v as IkasProductOptionFileSettings,p as IkasProductOptionSelectSettings,u as IkasProductOptionSelectType,c as IkasProductOptionSelectValue,r as IkasProductOptionSelectValueTranslations,O as IkasProductOptionSet,h as IkasProductOptionSetTranslations,m as IkasProductOptionTextSettings,d as IkasProductOptionTranslations,o as IkasProductOptionType};
|