@ikas/storefront 2.0.0-alpha.17 → 2.0.0-alpha.18
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 +4 -1
- package/build/__generated__/global-types.js +1 -1
- package/build/_virtual/index.js_commonjs-proxy2.js +1 -1
- package/build/_virtual/index.js_commonjs-proxy3.js +1 -1
- package/build/api/raffle/__generated__/listRaffle.d.ts +14 -16
- package/build/api/raffle/__generated__/saveRaffleParticipant.d.ts +2 -2
- package/build/api/raffle/index.js +1 -1
- package/build/components/page-editor/model.js +1 -1
- package/build/ikas.js +1 -1
- package/build/models/data/raffle/index.d.ts +1 -1
- package/build/models/data/raffle/index.js +1 -1
- package/package.json +1 -1
|
@@ -130,6 +130,7 @@ export declare enum OrderPackageFulfillStatusEnum {
|
|
|
130
130
|
DELIVERED = "DELIVERED",
|
|
131
131
|
ERROR = "ERROR",
|
|
132
132
|
FULFILLED = "FULFILLED",
|
|
133
|
+
READY_FOR_PICK_UP = "READY_FOR_PICK_UP",
|
|
133
134
|
READY_FOR_SHIPMENT = "READY_FOR_SHIPMENT",
|
|
134
135
|
REFUNDED = "REFUNDED",
|
|
135
136
|
REFUND_REJECTED = "REFUND_REJECTED",
|
|
@@ -149,6 +150,7 @@ export declare enum OrderPackageStatusEnum {
|
|
|
149
150
|
PARTIALLY_DELIVERED = "PARTIALLY_DELIVERED",
|
|
150
151
|
PARTIALLY_FULFILLED = "PARTIALLY_FULFILLED",
|
|
151
152
|
PARTIALLY_REFUNDED = "PARTIALLY_REFUNDED",
|
|
153
|
+
READY_FOR_PICK_UP = "READY_FOR_PICK_UP",
|
|
152
154
|
READY_FOR_SHIPMENT = "READY_FOR_SHIPMENT",
|
|
153
155
|
REFUNDED = "REFUNDED",
|
|
154
156
|
REFUND_REJECTED = "REFUND_REJECTED",
|
|
@@ -550,7 +552,7 @@ export interface RaffleMetadataTargetTypeEnumFilter {
|
|
|
550
552
|
in?: RaffleMetadataTargetTypeEnum[] | null;
|
|
551
553
|
}
|
|
552
554
|
export interface RaffleParticipantsInput {
|
|
553
|
-
|
|
555
|
+
appliedProduct: AppliedProductInput;
|
|
554
556
|
createdAt?: any | null;
|
|
555
557
|
deleted?: boolean | null;
|
|
556
558
|
email: string;
|
|
@@ -583,6 +585,7 @@ export interface SaveCheckoutInput {
|
|
|
583
585
|
shippingMethod: ShippingMethodEnum;
|
|
584
586
|
shippingSettingsId?: string | null;
|
|
585
587
|
shippingZoneRateId?: string | null;
|
|
588
|
+
stockLocationId?: string | null;
|
|
586
589
|
updatedAt?: any | null;
|
|
587
590
|
}
|
|
588
591
|
export interface SaveItemToCartInput {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
var E,T,A,
|
|
1
|
+
var E,T,R,A,D,C,I,L,_,N,O,U,S,P,F,n,M,Y,H,B,V,o,t,c,f,i,u,G,W,K,Q,X,J,Z,r,a,e,p,v,x,b;!function(E){E.DECREMENT="DECREMENT",E.INCREMENT="INCREMENT"}(E||(E={})),function(E){E.AMOUNT="AMOUNT",E.RATIO="RATIO"}(T||(T={})),function(E){E.BLOG="BLOG",E.BLOG_CATEGORY="BLOG_CATEGORY"}(R||(R={})),function(E){E.CUSTOMER="CUSTOMER",E.DECLINED="DECLINED",E.INVENTORY="INVENTORY",E.OTHER="OTHER"}(A||(A={})),function(E){E.ACTIVE="ACTIVE",E.FREEZE="FREEZE",E.PASSIVE="PASSIVE"}(D||(D={})),function(E){E.BEST_SELLER="BEST_SELLER",E.HIGHEST_DISCOUNT_RATIO="HIGHEST_DISCOUNT_RATIO",E.HIGHEST_PRICE="HIGHEST_PRICE",E.LOWEST_DISCOUNT_RATIO="LOWEST_DISCOUNT_RATIO",E.LOWEST_PRICE="LOWEST_PRICE",E.MANUALLY="MANUALLY",E.NEWEST="NEWEST",E.OLDEST="OLDEST"}(C||(C={})),function(E){E.NOT_SENT="NOT_SENT",E.SENT="SENT"}(I||(I={})),function(E){E.NOT_RECOVERED="NOT_RECOVERED",E.RECOVERED="RECOVERED"}(L||(L={})),function(E){E.INVISIBLE="INVISIBLE",E.MANDATORY="MANDATORY",E.OPTIONAL="OPTIONAL"}(_||(_={})),function(E){E.COMPLETED="COMPLETED",E.KILLED="KILLED",E.OPEN="OPEN"}(N||(N={})),function(E){E.ACTIVE_ACCOUNT="ACTIVE_ACCOUNT",E.DECLINED_ACCOUNT_INVITATION="DECLINED_ACCOUNT_INVITATION",E.DISABLED_ACCOUNT="DISABLED_ACCOUNT",E.INVITED_TO_CREATE_ACCOUNT="INVITED_TO_CREATE_ACCOUNT"}(O||(O={})),function(E){E.NOT_SUBSCRIBED="NOT_SUBSCRIBED",E.PENDING_CONFIRMATION="PENDING_CONFIRMATION",E.SUBSCRIBED="SUBSCRIBED"}(U||(U={})),function(E){E.BRAND="BRAND",E.CATEGORY="CATEGORY",E.PAGE="PAGE",E.PRODUCT="PRODUCT"}(S||(S={})),function(E){E.CANCELLED="CANCELLED",E.CANCEL_REJECTED="CANCEL_REJECTED",E.CANCEL_REQUESTED="CANCEL_REQUESTED",E.DELIVERED="DELIVERED",E.FULFILLED="FULFILLED",E.REFUNDED="REFUNDED",E.REFUND_REJECTED="REFUND_REJECTED",E.REFUND_REQUESTED="REFUND_REQUESTED",E.REFUND_REQUEST_ACCEPTED="REFUND_REQUEST_ACCEPTED",E.UNFULFILLED="UNFULFILLED"}(P||(P={})),function(E){E.CANCELLED="CANCELLED",E.CANCEL_REJECTED="CANCEL_REJECTED",E.CANCEL_REQUESTED="CANCEL_REQUESTED",E.DELIVERED="DELIVERED",E.ERROR="ERROR",E.FULFILLED="FULFILLED",E.READY_FOR_PICK_UP="READY_FOR_PICK_UP",E.READY_FOR_SHIPMENT="READY_FOR_SHIPMENT",E.REFUNDED="REFUNDED",E.REFUND_REJECTED="REFUND_REJECTED",E.REFUND_REQUESTED="REFUND_REQUESTED",E.REFUND_REQUEST_ACCEPTED="REFUND_REQUEST_ACCEPTED"}(F||(F={})),function(E){E.CANCELLED="CANCELLED",E.CANCEL_REJECTED="CANCEL_REJECTED",E.CANCEL_REQUESTED="CANCEL_REQUESTED",E.DELIVERED="DELIVERED",E.FULFILLED="FULFILLED",E.PARTIALLY_CANCELLED="PARTIALLY_CANCELLED",E.PARTIALLY_DELIVERED="PARTIALLY_DELIVERED",E.PARTIALLY_FULFILLED="PARTIALLY_FULFILLED",E.PARTIALLY_REFUNDED="PARTIALLY_REFUNDED",E.READY_FOR_PICK_UP="READY_FOR_PICK_UP",E.READY_FOR_SHIPMENT="READY_FOR_SHIPMENT",E.REFUNDED="REFUNDED",E.REFUND_REJECTED="REFUND_REJECTED",E.REFUND_REQUESTED="REFUND_REQUESTED",E.REFUND_REQUEST_ACCEPTED="REFUND_REQUEST_ACCEPTED",E.UNABLE_TO_DELIVER="UNABLE_TO_DELIVER",E.UNFULFILLED="UNFULFILLED"}(n||(n={})),function(E){E.PAID="PAID",E.PARTIALLY_PAID="PARTIALLY_PAID",E.WAITING="WAITING"}(M||(M={})),function(E){E.CANCELLED="CANCELLED",E.CREATED="CREATED",E.DRAFT="DRAFT",E.PARTIALLY_CANCELLED="PARTIALLY_CANCELLED",E.PARTIALLY_REFUNDED="PARTIALLY_REFUNDED",E.REFUNDED="REFUNDED",E.REFUND_REJECTED="REFUND_REJECTED",E.REFUND_REQUESTED="REFUND_REQUESTED"}(Y||(Y={})),function(E){E.DECREMENT="DECREMENT",E.INCREMENT="INCREMENT"}(H||(H={})),function(E){E.AMOUNT="AMOUNT",E.RATIO="RATIO"}(B||(B={})),function(E){E.EXTERNAL="EXTERNAL",E.INTERNAL="INTERNAL",E.THIRD_PARTY="THIRD_PARTY"}(V||(V={})),function(E){E.APP_PAYMENT="APP_PAYMENT",E.BUY_ONLINE_PAY_AT_STORE="BUY_ONLINE_PAY_AT_STORE",E.CASH="CASH",E.CASH_ON_DELIVERY="CASH_ON_DELIVERY",E.CREDIT_CARD="CREDIT_CARD",E.CREDIT_CARD_ON_DELIVERY="CREDIT_CARD_ON_DELIVERY",E.GIFT_CARD="GIFT_CARD",E.MONEY_ORDER="MONEY_ORDER",E.OTHER="OTHER",E.WALLET="WALLET"}(o||(o={})),function(E){E.BOOLEAN="BOOLEAN",E.CHOICE="CHOICE",E.DATETIME="DATETIME",E.HTML="HTML",E.MULTIPLE_CHOICE="MULTIPLE_CHOICE",E.NUMERIC="NUMERIC",E.PRODUCT="PRODUCT",E.TABLE="TABLE",E.TEXT="TEXT"}(t||(t={})),function(E){E.BOX="BOX",E.DATE_RANGE="DATE_RANGE",E.LIST="LIST",E.NUMBER_RANGE="NUMBER_RANGE",E.NUMBER_RANGE_LIST="NUMBER_RANGE_LIST",E.SWATCH="SWATCH"}(c||(c={})),function(E){E.ALPHABETICAL_ASC="ALPHABETICAL_ASC",E.ALPHABETICAL_DESC="ALPHABETICAL_DESC",E.CUSTOM_SORT="CUSTOM_SORT",E.PRODUCT_COUNT_ASC="PRODUCT_COUNT_ASC",E.PRODUCT_COUNT_DESC="PRODUCT_COUNT_DESC"}(f||(f={})),function(E){E.ATTRIBUTE="ATTRIBUTE",E.AVAILABLE_VARIANT_VALUE="AVAILABLE_VARIANT_VALUE",E.BRAND="BRAND",E.DISCOUNT_RATIO="DISCOUNT_RATIO",E.PRICE="PRICE",E.STOCK_STATUS="STOCK_STATUS",E.TAG="TAG",E.VARIANT_TYPE="VARIANT_TYPE"}(i||(i={})),function(E){E.BOX="BOX",E.SELECT="SELECT",E.SWATCH="SWATCH"}(u||(u={})),function(E){E.CHECKBOX="CHECKBOX",E.CHOICE="CHOICE",E.COLOR_PICKER="COLOR_PICKER",E.DATE_PICKER="DATE_PICKER",E.FILE="FILE",E.IMAGE="IMAGE",E.TEXT="TEXT",E.TEXT_AREA="TEXT_AREA"}(G||(G={})),function(E){E.HIDE_OUT_OF_STOCK="HIDE_OUT_OF_STOCK",E.SHOW_ALL="SHOW_ALL",E.SHOW_OUT_OF_STOCK_AT_END="SHOW_OUT_OF_STOCK_AT_END"}(W||(W={})),function(E){E.RAFFLE="RAFFLE"}(K||(K={})),function(E){E.CLICK_AND_COLLECT="CLICK_AND_COLLECT",E.NO_SHIPMENT="NO_SHIPMENT",E.SHIPMENT="SHIPMENT"}(Q||(Q={})),function(E){E.ASC="ASC",E.DESC="DESC"}(X||(X={})),function(E){E.CREATED_AT="CREATED_AT",E.DISCOUNT_RATIO="DISCOUNT_RATIO",E.MANUAL_SORT="MANUAL_SORT",E.NAME="NAME",E.PRICE="PRICE"}(J||(J={})),function(E){E.FAILED="FAILED",E.NOT_DEPLOYED="NOT_DEPLOYED",E.READY="READY",E.WAITING="WAITING"}(Z||(Z={})),function(E){E.FAILED="FAILED",E.NOT_DEPLOYED="NOT_DEPLOYED",E.READY="READY",E.WAITING="WAITING"}(r||(r={})),function(E){E.AMERICAN_EXPRESS="AMERICAN_EXPRESS",E.MASTER_CARD="MASTER_CARD",E.TROY="TROY",E.VISA="VISA"}(a||(a={})),function(E){E.CREDIT="CREDIT",E.DEBIT="DEBIT",E.PREPAID="PREPAID"}(e||(e={})),function(E){E.AUTHORIZED="AUTHORIZED",E.FAILED="FAILED",E.PENDING="PENDING",E.SUCCESS="SUCCESS"}(p||(p={})),function(E){E.REFUND="REFUND",E.SALE="SALE",E.VOID="VOID"}(v||(v={})),function(E){E.CHOICE="CHOICE",E.COLOR="COLOR"}(x||(x={})),function(E){E.EMAIL="EMAIL",E.MERSIS="MERSIS"}(b||(b={}));export{E as AdjustmentEnum,T as AmountTypeEnum,R as BlogMetadataTargetTypeEnum,A as CancelledReasonEnum,D as CartStatusEnum,C as CategoryProductsOrderTypeEnum,I as CheckoutRecoveryEmailStatusEnum,L as CheckoutRecoveryStatusEnum,_ as CheckoutRequirementEnum,N as CheckoutStatusEnum,O as CustomerAccountStatusEnum,U as CustomerEmailSubscriptionStatusesEnum,S as HTMLMetaDataTargetTypeEnum,P as OrderLineItemStatusEnum,F as OrderPackageFulfillStatusEnum,n as OrderPackageStatusEnum,M as OrderPaymentStatusEnum,Y as OrderStatusEnum,H as PaymentGatewayAdditionalPriceTypeEnum,B as PaymentGatewayTransactionFeeTypeEnum,V as PaymentGatewayTypeEnum,o as PaymentMethodEnum,t as ProductAttributeTypeEnum,c as ProductFilterDisplayTypeEnum,f as ProductFilterSortTypeEnum,i as ProductFilterTypeEnum,u as ProductOptionSelectTypeEnum,G as ProductOptionTypeEnum,W as ProductSearchShowStockOptionEnum,K as RaffleMetadataTargetTypeEnum,Q as ShippingMethodEnum,X as SortByDirectionEnum,J as SortByTypeEnum,Z as StorefrontStatusTypes,r as StorefrontThemeStatus,a as TransactionCardAssociationEnum,e as TransactionCardTypeEnum,p as TransactionStatusEnum,v as TransactionTypeEnum,x as VariantSelectionTypeEnum,b as VerificationTypeEnum};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import e from'../ext/
|
|
1
|
+
import e from'../ext/decode-uri-component/index.js';export{default}from"../node_modules/decode-uri-component/index.js";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import e from'../ext/
|
|
1
|
+
import e from'../ext/strict-uri-encode/index.js';export{default}from"../node_modules/strict-uri-encode/index.js";
|
|
@@ -39,32 +39,30 @@ export interface listRaffle_listRaffle_data {
|
|
|
39
39
|
export interface listRaffle_listRaffle {
|
|
40
40
|
__typename: "RafflePaginationResponse";
|
|
41
41
|
/**
|
|
42
|
-
* Returns the first three records of each page in the records returned as a
|
|
43
|
-
*
|
|
44
|
-
* records that will return as a response are the records
|
|
42
|
+
* Returns the first three records of each page in the records returned as a response.
|
|
43
|
+
* For example, **let's say page = 3, limit = 30, count = 3.**
|
|
44
|
+
* The records that will return as a response are the records **between 60-62.**
|
|
45
45
|
*/
|
|
46
46
|
count: number;
|
|
47
47
|
/**
|
|
48
|
-
* In the records returned as Response, it shows whether there are any more
|
|
49
|
-
* records or not. For example, let's say our page field is three and our limit
|
|
50
|
-
* field is thirty. Records between 60 and 90 will be returned. If hasNext is
|
|
51
|
-
* ```true``` despite these records, ***it means there are more records.*** If
|
|
52
|
-
* hasNext is ```false```, it means there are a total of ***90 records.***
|
|
48
|
+
* In the records returned as Response, it shows whether there are any more records or not. For example, let's say our page field is three and our limit field is thirty. Records between 60 and 90 will be returned. If hasNext is `true` despite these records, **it means there are more records.** If hasNext is `false`, it means there are a total of **90 records.**
|
|
53
49
|
*/
|
|
54
50
|
hasNext: boolean;
|
|
55
51
|
/**
|
|
56
|
-
* The maximum number of data you want to see on a page in the records returned
|
|
57
|
-
*
|
|
58
|
-
*
|
|
59
|
-
* given. If no value is entered, default 50 is accepted
|
|
52
|
+
* The maximum number of data you want to see on a page in the records returned as a response.
|
|
53
|
+
* For example, if the limit is **20**, the data will be displayed ** as 20 each. **
|
|
54
|
+
* :::note
|
|
55
|
+
* min 1, max 200 values can be given. If no value is entered, default 50 is accepted.
|
|
56
|
+
* :::
|
|
60
57
|
*/
|
|
61
58
|
limit: number;
|
|
62
59
|
/**
|
|
63
60
|
* The number of the page you want to see in the records that return as response.
|
|
64
|
-
* For example: We entered the page field as
|
|
65
|
-
*
|
|
66
|
-
*
|
|
67
|
-
*
|
|
61
|
+
* For example: We entered the page field as **3**.And let our limit field be **30**.
|
|
62
|
+
* The records that will return as a response are the records **between 60-90.**
|
|
63
|
+
* :::note
|
|
64
|
+
* If no value is entered, default 1 is accepted.
|
|
65
|
+
* :::
|
|
68
66
|
*/
|
|
69
67
|
page: number;
|
|
70
68
|
data: listRaffle_listRaffle_data[];
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { RaffleParticipantsInput } from "./../../../__generated__/global-types";
|
|
2
|
-
export interface
|
|
2
|
+
export interface saveRaffleParticipant_saveRaffleParticipant_appliedProduct {
|
|
3
3
|
__typename: "AppliedProduct";
|
|
4
4
|
productId: string | null;
|
|
5
5
|
variantId: string;
|
|
@@ -12,7 +12,7 @@ export interface saveRaffleParticipant_saveRaffleParticipant {
|
|
|
12
12
|
phone: string | null;
|
|
13
13
|
raffleId: string;
|
|
14
14
|
updatedAt: any | null;
|
|
15
|
-
|
|
15
|
+
appliedProduct: saveRaffleParticipant_saveRaffleParticipant_appliedProduct;
|
|
16
16
|
createdAt: any | null;
|
|
17
17
|
customerId: string | null;
|
|
18
18
|
deleted: boolean | null;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{__awaiter as n,__generator as t,__makeTemplateObject as e}from'../../ext/tslib/tslib.es6.js';import a from'../../ext/graphql-tag/src/index.js';import{apollo as i}from"../apollo.js";import{IkasRaffle as r,IkasRaffleAppliedProduct as d,IkasRaffleParticipant as l,IkasRaffleMetaData as s}from"../../models/data/raffle/index.js";var u,o,p,c,g=function(){function g(){}return g.listRaffles=function(l){return n(this,void 0,void 0,(function(){var n,s,o,p,c,g,f;return t(this,(function(t){switch(t.label){case 0:n=a(u||(u=e(["\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 "]))),t.label=1;case 1:return t.trys.push([1,3,,4]),[4,i.getClient().query({query:n,variables:{start:l.start?{eq:l.start}:void 0,end:l.end?{eq:l.end}:void 0,id:l.id?{eq:l.id}:void 0,includeDeleted:(l.includeDeleted,l.includeDeleted),name:l.name?{eq:l.name}:void 0,pagination:l.pagination?{limit:l.pagination.limit,page:l.pagination.page}:void 0,search:l.search}})];case 2:return s=t.sent(),o=s.data,(p=s.errors)&&p.length?[2,{raffles:[],count:0}]:(c=o.listRaffle.count,g=o.listRaffle.data.map((function(n){var t,e;return new r({id:n.id,dateRange:{end:null===(t=n.dateRange)||void 0===t?void 0:t.end,start:null===(e=n.dateRange)||void 0===e?void 0:e.start},createdAt:n.createdAt,deleted:n.deleted,metadata:n.metadata||void 0,name:n.name,participantCount:n.participantCount,requiredCustomerAccount:n.requiredCustomerAccount,status:n.status,updatedAt:n.updatedAt,variants:n.variants.length>0?n.variants.map((function(n){return new d(n)})):void 0,verificationType:n.verificationType})})),[2,{count:c,raffles:g}]);case 3:return f=t.sent(),console.log(f),[2,{raffles:[],count:0}];case 4:return[2]}}))}))},g.saveRaffleParticipant=function(r){return n(this,void 0,void 0,(function(){var n,d,s,u,p;return t(this,(function(t){switch(t.label){case 0:n=a(o||(o=e(["\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 "]))),t.label=1;case 1:return t.trys.push([1,3,,4]),[4,i.getClient().mutate({mutation:n,variables:{input:{appliedProducts:r.appliedProducts,email:r.email,firstName:r.firstName,lastName:r.lastName,raffleId:r.raffleId,extraData:r.extraData,phone:r.phone}}})];case 2:return d=t.sent(),s=d.data,(u=d.errors)&&u.length&&console.log(u),s&&s.saveRaffleParticipant?[2,new l(s.saveRaffleParticipant)]:[3,4];case 3:return p=t.sent(),console.log(p),[3,4];case 4:return[2]}}))}))},g.listRaffleMetaData=function(r,d,l,u,o){return void 0===u&&(u=1),void 0===o&&(o=200),n(this,void 0,void 0,(function(){var n,c,g,f,m;return t(this,(function(t){switch(t.label){case 0:n=a(p||(p=e(["\n query listRaffleMetaData(\n $slug: StringFilterInput\n $targetId: StringFilterInput\n $targetType: RaffleMetadataTargetTypeEnumFilter\n $pagination: PaginationInput\n ) {\n listRaffleMetadata(\n slug: $slug\n targetId: $targetId\n targetType: $targetType\n pagination: $pagination\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 $pagination: PaginationInput\n ) {\n listRaffleMetadata(\n slug: $slug\n targetId: $targetId\n targetType: $targetType\n pagination: $pagination\n ) {\n createdAt\n deleted\n description\n id\n pageTitle\n slug\n targetId\n targetType\n updatedAt\n }\n }\n "]))),t.label=1;case 1:return t.trys.push([1,3,,4]),[4,i.getClient().query({query:n,variables:{slug:r?{eq:r}:void 0,targetId:d?{in:d}:void 0,targetType:l?{in:l}:void 0,pagination:{page:u,limit:o}}})];case 2:return c=t.sent(),g=c.data,(f=c.errors)&&f.length?[2,[]]:[2,g.listRaffleMetadata.map((function(n){return new s(n)}))];case 3:return m=t.sent(),console.log(m),[2,[]];case 4:return[2]}}))}))},g.getRafflesByCustomerId=function(l){return n(this,void 0,void 0,(function(){var n,s,u,o,p,g;return t(this,(function(t){switch(t.label){case 0:n=a(c||(c=e(["\n query getRafflesByCustomerId($winnerFilter: Boolean) {\n getRafflesByCustomerId(winnerFilter: $winnerFilter) {\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($winnerFilter: Boolean) {\n getRafflesByCustomerId(winnerFilter: $winnerFilter) {\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 "]))),t.label=1;case 1:return t.trys.push([1,3,,4]),[4,i.getClient().query({query:n,variables:{winnerFilter:l||void 0}})];case 2:return s=t.sent(),u=s.data,(o=s.errors)&&o.length?[2]:(p=u.getRafflesByCustomerId.map((function(n){var t,e;return new r({id:n.id,dateRange:{end:null===(t=n.dateRange)||void 0===t?void 0:t.end,start:null===(e=n.dateRange)||void 0===e?void 0:e.start},createdAt:n.createdAt,deleted:n.deleted,metadata:n.metadata||void 0,name:n.name,participantCount:n.participantCount,requiredCustomerAccount:n.requiredCustomerAccount,status:n.status,updatedAt:n.updatedAt,variants:n.variants.length>0?n.variants.map((function(n){return new d(n)})):void 0,verificationType:n.verificationType})})),[2,p]);case 3:return g=t.sent(),console.log(g),[3,4];case 4:return[2]}}))}))},g}();export{g as IkasRaffleAPI};
|
|
1
|
+
import{__awaiter as n,__generator as t,__makeTemplateObject as e}from'../../ext/tslib/tslib.es6.js';import a from'../../ext/graphql-tag/src/index.js';import{apollo as i}from"../apollo.js";import{IkasRaffle as r,IkasRaffleAppliedProduct as d,IkasRaffleParticipant as l,IkasRaffleMetaData as u}from"../../models/data/raffle/index.js";var s,o,p,c,g=function(){function g(){}return g.listRaffles=function(l){return n(this,void 0,void 0,(function(){var n,u,o,p,c,g,f;return t(this,(function(t){switch(t.label){case 0:n=a(s||(s=e(["\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 "]))),t.label=1;case 1:return t.trys.push([1,3,,4]),[4,i.getClient().query({query:n,variables:{start:l.start?{eq:l.start}:void 0,end:l.end?{eq:l.end}:void 0,id:l.id?{eq:l.id}:void 0,includeDeleted:(l.includeDeleted,l.includeDeleted),name:l.name?{eq:l.name}:void 0,pagination:l.pagination?{limit:l.pagination.limit,page:l.pagination.page}:void 0,search:l.search}})];case 2:return u=t.sent(),o=u.data,(p=u.errors)&&p.length?[2,{raffles:[],count:0}]:(c=o.listRaffle.count,g=o.listRaffle.data.map((function(n){var t,e;return new r({id:n.id,dateRange:{end:null===(t=n.dateRange)||void 0===t?void 0:t.end,start:null===(e=n.dateRange)||void 0===e?void 0:e.start},createdAt:n.createdAt,deleted:n.deleted,metadata:n.metadata||void 0,name:n.name,participantCount:n.participantCount,requiredCustomerAccount:n.requiredCustomerAccount,status:n.status,updatedAt:n.updatedAt,variants:n.variants.length>0?n.variants.map((function(n){return new d(n)})):void 0,verificationType:n.verificationType})})),[2,{count:c,raffles:g}]);case 3:return f=t.sent(),console.log(f),[2,{raffles:[],count:0}];case 4:return[2]}}))}))},g.saveRaffleParticipant=function(r){return n(this,void 0,void 0,(function(){var n,d,u,s,p;return t(this,(function(t){switch(t.label){case 0:n=a(o||(o=e(["\n mutation saveRaffleParticipant($input: RaffleParticipantsInput!) {\n saveRaffleParticipant(input: $input) {\n applicationDate\n isWinner\n lastName\n phone\n raffleId\n updatedAt\n appliedProduct {\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 appliedProduct {\n productId\n variantId\n }\n createdAt\n customerId\n deleted\n email\n extraData\n firstName\n fullName\n id\n }\n }\n "]))),t.label=1;case 1:return t.trys.push([1,3,,4]),[4,i.getClient().mutate({mutation:n,variables:{input:{appliedProduct:r.appliedProduct,email:r.email,firstName:r.firstName,lastName:r.lastName,raffleId:r.raffleId,extraData:r.extraData,phone:r.phone}}})];case 2:return d=t.sent(),u=d.data,(s=d.errors)&&s.length&&console.log(s),u&&u.saveRaffleParticipant?[2,new l(u.saveRaffleParticipant)]:[3,4];case 3:return p=t.sent(),console.log(p),[3,4];case 4:return[2]}}))}))},g.listRaffleMetaData=function(r,d,l,s,o){return void 0===s&&(s=1),void 0===o&&(o=200),n(this,void 0,void 0,(function(){var n,c,g,f,m;return t(this,(function(t){switch(t.label){case 0:n=a(p||(p=e(["\n query listRaffleMetaData(\n $slug: StringFilterInput\n $targetId: StringFilterInput\n $targetType: RaffleMetadataTargetTypeEnumFilter\n $pagination: PaginationInput\n ) {\n listRaffleMetadata(\n slug: $slug\n targetId: $targetId\n targetType: $targetType\n pagination: $pagination\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 $pagination: PaginationInput\n ) {\n listRaffleMetadata(\n slug: $slug\n targetId: $targetId\n targetType: $targetType\n pagination: $pagination\n ) {\n createdAt\n deleted\n description\n id\n pageTitle\n slug\n targetId\n targetType\n updatedAt\n }\n }\n "]))),t.label=1;case 1:return t.trys.push([1,3,,4]),[4,i.getClient().query({query:n,variables:{slug:r?{eq:r}:void 0,targetId:d?{in:d}:void 0,targetType:l?{in:l}:void 0,pagination:{page:s,limit:o}}})];case 2:return c=t.sent(),g=c.data,(f=c.errors)&&f.length?[2,[]]:[2,g.listRaffleMetadata.map((function(n){return new u(n)}))];case 3:return m=t.sent(),console.log(m),[2,[]];case 4:return[2]}}))}))},g.getRafflesByCustomerId=function(l){return n(this,void 0,void 0,(function(){var n,u,s,o,p,g;return t(this,(function(t){switch(t.label){case 0:n=a(c||(c=e(["\n query getRafflesByCustomerId($winnerFilter: Boolean) {\n getRafflesByCustomerId(winnerFilter: $winnerFilter) {\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($winnerFilter: Boolean) {\n getRafflesByCustomerId(winnerFilter: $winnerFilter) {\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 "]))),t.label=1;case 1:return t.trys.push([1,3,,4]),[4,i.getClient().query({query:n,variables:{winnerFilter:l||void 0}})];case 2:return u=t.sent(),s=u.data,(o=u.errors)&&o.length?[2]:(p=s.getRafflesByCustomerId.map((function(n){var t,e;return new r({id:n.id,dateRange:{end:null===(t=n.dateRange)||void 0===t?void 0:t.end,start:null===(e=n.dateRange)||void 0===e?void 0:e.start},createdAt:n.createdAt,deleted:n.deleted,metadata:n.metadata||void 0,name:n.name,participantCount:n.participantCount,requiredCustomerAccount:n.requiredCustomerAccount,status:n.status,updatedAt:n.updatedAt,variants:n.variants.length>0?n.variants.map((function(n){return new d(n)})):void 0,verificationType:n.verificationType})})),[2,p]);case 3:return g=t.sent(),console.log(g),[3,4];case 4:return[2]}}))}))},g}();export{g as IkasRaffleAPI};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{__awaiter as e,__generator as t}from'../../ext/tslib/tslib.es6.js';import{makeAutoObservable as i,runInAction as o}from"mobx";import{IkasBlogMetadataTargetType as n}from"../../models/data/blog/index.js";import"../../models/data/brand/index.js";import"../../models/data/category/index.js";import"../../models/data/checkout/index.js";import"../../models/data/customer/address/index.js";import"../../models/data/customer/index.js";import"../../models/data/customer-review/index.js";import{IkasHTMLMetaDataTargetType as a}from"../../models/data/html-meta-data/index.js";import"../../models/data/image/index.js";import"../../models/data/installment-info/index.js";import"../../models/data/order/index.js";import"../../models/data/order/line-item/index.js";import"../../models/data/product/index.js";import"../../models/data/variant-type/index.js";import"../../models/data/product/variant/index.js";import"../../models/data/product/variant/price/index.js";import"../../models/data/product-attribute/index.js";import"../../models/data/product/attribute-value/index.js";import"../../models/data/product-filter/index.js";import"../../models/data/variant-type/variant-value/index.js";import"../../models/data/order-transaction/index.js";import"../../models/data/product-option-set/index.js";import"../../models/data/raffle/index.js";import{IkasTheme as s}from"../../models/theme/theme.js";import{IkasThemePageType as r}from"../../models/theme/page/index.js";import{IkasThemePageComponent as d}from"../../models/theme/page/component/index.js";import{IkasThemeComponent as p}from"../../models/theme/component/index.js";import{IkasThemeComponentPropType as l}from"../../models/theme/component/prop/index.js";import"../../models/theme/page/component/prop-value/link.js";import"../../models/ui/brand-list/index.js";import"../../models/ui/blog-list/index.js";import"../../models/ui/blog-category-list/index.js";import"../../models/ui/category-list/index.js";import"../../models/ui/product-detail/index.js";import"../../models/ui/product-list/index.js";import"../../models/ui/product-attribute-detail/index.js";import"../../models/ui/product-attribute-list/index.js";import"../../models/ui/customer-review-list/index.js";import"../../models/ui/validator/index.js";import"../../models/ui/validator/rules/index.js";import"../../models/ui/validator/form/login.js";import"../../models/ui/validator/form/address.js";import"../../models/ui/validator/form/register.js";import"../../models/ui/validator/form/contact-form.js";import"../../models/ui/validator/form/forgot-password.js";import"../../models/ui/validator/form/recover-password.js";import"../../models/ui/validator/form/account-info.js";import"../../models/ui/validator/form/raffle-form.js";import"../../models/ui/validator/form/customer-review.js";import"../../models/ui/raffle-list/index.js";import{IkasThemeSettings as m}from"../../models/theme/settings/index.js";import"../../models/theme/custom-data/index.js";import{IkasPageDataProvider as c}from"../../providers/page-data-get.js";import{IkasPageDataInit as u}from"../../providers/page-data-init.js";import{IkasBlogAPI as h}from"../../api/blog/index.js";import"../../api/brand/index.js";import"../../api/cart/index.js";import"../../api/category/index.js";import"../../api/checkout/index.js";import"../../api/city/index.js";import"../../api/country/index.js";import"../../api/customer/index.js";import"../../api/customer-review/index.js";import"../../api/district/index.js";import{IkasHTMLMetaDataAPI as g}from"../../api/html-meta-data/index.js";import"../../api/merchant/index.js";import"../../api/product-search/index.js";import{apollo as f}from"../../api/apollo.js";import"../../api/favorite-product/index.js";import"../../api/contact-form/index.js";import"../../api/state/index.js";import"../../api/product-option-set/index.js";import{IkasRaffleAPI as E}from"../../api/raffle/index.js";import"../../api/back-in-stock-reminder/index.js";import{IkasStorefrontConfig as P}from"../../storefront/index.js";import{IkasStorefront as O}from"../../models/data/storefront/index.js";var v,C=function(){function C(C){var T=this;this.theme=null,this.page=null,this.selectedPageComponentId=null,this.hoveredPageComponentId=null,this.componentRefs={},this.isLoading=!1,this.locale="en",this.pageParams={},this.apiKey=null,this.pageDataProvider=null,this.startMessaging=function(){window.addEventListener("message",T.onMessage,!1),T.sendMessage(v.FRAME_DID_LOAD,"2.0.0")},this.onMessage=function(i){return e(T,void 0,void 0,(function(){var e,o;return t(this,(function(t){switch(t.label){case 0:switch(e=i.data.type,o=i.data.data,e){case v.UPDATE_FRAME_DATA:return[3,1];case v.UPDATE_PROP_VALUE:return[3,3];case v.UPDATE_PAGE_PARAMS:return[3,5];case v.UPDATE_PAGE_COMPONENT_ORDER:return[3,7];case v.ADD_COMPONENT:return[3,9];case v.DELETE_COMPONENT:return[3,10];case v.UPDATE_COMPONENT:return[3,11];case v.ADD_PAGE_COMPONENT:return[3,12];case v.DELETE_PAGE_COMPONENT:return[3,14];case v.SET_SELECTED_COMPONENT:return[3,15];case v.SET_HOVERED_COMPONENT:return[3,16];case v.SCROLL_TO_COMPONENT:return[3,17];case v.UPDATE_THEME_SETTINGS:return[3,18]}return[3,19];case 1:return[4,this.handleUpdateFrameData(o)];case 2:case 4:case 6:case 8:case 13:return t.sent(),[3,20];case 3:return[4,this.handleUpdatePropValue(o)];case 5:return[4,this.handleUpdatePageParams(o)];case 7:return[4,this.handleUpdatePageComponentOrder(o)];case 9:return this.handleAddNewComponent(o),[3,20];case 10:return this.handleDeleteComponent(o),[3,20];case 11:return this.handleUpdateComponent(o),[3,20];case 12:return[4,this.handleAddNewPageComponent(o)];case 14:return this.handleDeletePageComponent(o),[3,20];case 15:return this.handleSetSelectedComponent(o),[3,20];case 16:return this.handleSetHoveredComponent(o),[3,20];case 17:return this.handleScrollToComponent(o),[3,20];case 18:return this.updateThemeSettings(o),[3,20];case 19:return[3,20];case 20:return[2]}}))}))},this.onClick=function(e){T.sendMessage(v.COMPONENT_CLICK,{componentId:e})},this.onMouseOver=function(e){T.sendMessage(v.COMPONENT_MOUSE_OVER,{componentId:e})},this.onMouseLeave=function(e){T.sendMessage(v.COMPONENT_MOUSE_LEAVE,{componentId:e})},this.onPageChange=function(i){return e(T,void 0,void 0,(function(){var e,s,d,p,l,m,c,u=this;return t(this,(function(t){switch(t.label){case 0:return e=i.slice(1),s=e.split("?"),e=s[0],this.pageParams={},i.startsWith("/account/orders/")?d=r.ORDER_DETAIL:i.startsWith("/account/orders")?d=r.ORDERS:i.startsWith("/account/addresses")?d=r.ADDRESSES:i.startsWith("/account/favorite-products")?d=r.FAVORITE_PRODUCTS:i.startsWith("/account/forgot-password")?d=r.FORGOT_PASSWORD:i.startsWith("/account/login")?d=r.LOGIN:i.startsWith("/account/raffles")?d=r.RAFFLE_ACCOUNT:i.startsWith("/account/recover-password")?d=r.RECOVER_PASSWORD:i.startsWith("/account/register")?d=r.REGISTER:i.startsWith("/account")?d=r.ACCOUNT:i.startsWith("/blog/")?d=r.BLOG:i.startsWith("/blog")?d=r.BLOG_INDEX:i.startsWith("/pages")?(d=r.CUSTOM,this.pageParams={slug:e.split("/")[1]}):d=i.startsWith("/raffle/")?r.RAFFLE_DETAIL:i.startsWith("/raffle")?r.RAFFLE:i.startsWith("/404")?r.NOT_FOUND:i.startsWith("/cart")?r.CART:i.startsWith("/checkout")?r.CHECKOUT:"/"===i?r.INDEX:i.startsWith("/search")?r.SEARCH:r.PRODUCT,d!==r.PRODUCT?[3,2]:[4,g.listHTMLMetaData(e)];case 1:if(!(p=t.sent()).length)return[2];if((l=p[0]).targetType===a.PRODUCT)this.pageParams={productId:l.targetId,slug:e};else if(l.targetType===a.CATEGORY)d=r.CATEGORY,this.pageParams={categoryId:l.targetId,slug:e};else{if(l.targetType!==a.BRAND)return[2];d=r.BRAND,this.pageParams={brandId:l.targetId,slug:e}}t.label=2;case 2:return d!==r.BLOG?[3,4]:[4,h.listBlogMetaData(e)];case 3:if(!(p=t.sent()).length)return[2];if((l=p[0]).targetType===n.BLOG)this.pageParams={blogId:l.targetId,slug:e};else{if(l.targetType!==n.BLOG_CATEGORY)return[2];d=r.BLOG_CATEGORY,this.pageParams={blogCategoryId:l.targetId,slug:e}}t.label=4;case 4:return d!==r.RAFFLE_DETAIL?[3,6]:[4,E.listRaffleMetaData(e)];case 5:if(!(p=t.sent()).length)return[2];l=p[0],this.pageParams={raffleId:l.targetId,slug:e},t.label=6;case 6:return[4,this.getPagePropValues(this.theme,d,this.pageParams)];case 7:return m=t.sent(),o((function(){var e,t;P.store.currentPageType=d,u.pageDataProvider=m,d===r.CUSTOM?u.page=null===(e=u.theme)||void 0===e?void 0:e.pages.find((function(e){return e.type===d&&e.slug===u.pageParams.slug})):u.page=null===(t=u.theme)||void 0===t?void 0:t.pages.find((function(e){return e.type===d})),requestAnimationFrame((function(){document.body.scrollTop=0,document.scrollingElement&&(document.scrollingElement.scrollTop=0)}))})),this.sendMessage(v.EDITOR_PAGE_CHANGE,{pageType:d,pageParams:this.pageParams,pageSpecificData:(null===(c=this.pageDataProvider)||void 0===c?void 0:c.pageSpecificData)||null}),[2]}}))}))},this.sendMessage=function(e,t){window.parent.postMessage({type:e,data:JSON.parse(JSON.stringify(t))},"*")},this.getPagePropValues=function(i,o,n){return e(T,void 0,void 0,(function(){var e,a,s;return t(this,(function(t){switch(t.label){case 0:return e=new c(i,n,o),(n.blogId||n.blogCategoryId)&&(e.possiblePageTypes=[r.BLOG,r.BLOG_CATEGORY]),n.raffleId&&(e.possiblePageTypes=[r.RAFFLE_DETAIL]),[4,e.getPageData()];case 1:return t.sent(),e.pageSpecificData&&(u.setPageSpecificData(JSON.stringify(e.pageSpecificData),o,!0),o===r.PRODUCT&&u.pageSpecificData&&(a=u.pageSpecificData,(s=a.product.variants.find((function(e){return e.id===n.variantId})))&&(a.selectedVariantValues=s.variantValues))),e.pageComponentPropValues=u.initPropValues(JSON.stringify(e.pageComponentPropValues),this.router,JSON.stringify(i.settings),!1),[2,e]}}))}))},this.setComponentRef=function(e,t){T.componentRefs[t.id]=e},this.isScrolledIntoView=function(e){var t=e.getBoundingClientRect(),i=t.top,o=t.bottom;return i<window.innerHeight&&o>=0&&o<window.innerHeight&&i>0},this.handleUpdateFrameData=function(i){return e(T,void 0,void 0,(function(){var e,o,n,a,r=this;return t(this,(function(t){switch(t.label){case 0:return this.theme=new s(i.theme),this.page=this.theme.pages.find((function(e){return e.id===i.selectedPage.id})),this.pageParams=i.pageParams,this.apiKey=i.apiKey,this.locale=i.locale||"en",this.translations=i.translations||void 0,this.page?((e=i.storefront)&&(o=new O(e),n=o.routings.find((function(e){return e.locale===r.locale})),P.storefrontId=o.id,P.storefrontRoutingId=null==n?void 0:n.id,o.mainStorefrontThemeId&&(P.storefrontThemeId=o.mainStorefrontThemeId),o.salesChannelId&&(P.salesChannelId=o.salesChannelId),(null==n?void 0:n.priceListId)&&(P.priceListId=n.priceListId),P.routings=o.routings,P.stockPreference=this.theme.settings.stockPreference),this.translations&&(P.translations=this.translations),P.isEditor=!0,f.createApolloClient(this.apiKey||void 0),window.editorApiKey=i.apiKey,this.isLoading=!0,[4,this.getPagePropValues(this.theme,this.page.type,this.pageParams||{})]):[2];case 1:return a=t.sent(),this.pageDataProvider=a,this.isLoading=!1,[2]}}))}))},this.handleUpdatePropValue=function(i){return e(T,void 0,void 0,(function(){var e,n,a,s,r,d,p,m,c=this;return t(this,(function(t){switch(t.label){case 0:return e=i.propName,n=i.value,(a=null===(p=null===(d=this.selectedComponent)||void 0===d?void 0:d.props)||void 0===p?void 0:p.find((function(t){return t.name===e})))&&this.selectedPageComponent?(s=null===(m=this.pageDataProvider)||void 0===m?void 0:m.pageComponentPropValues.find((function(e){return e.pageComponent.id===c.selectedPageComponentId})),this.selectedPageComponent.propValues[e]=n,this.pageDataProvider?[4,this.pageDataProvider.getPageComponentPropValue(this.selectedPageComponent,a)]:[2]):[2];case 1:return r=t.sent(),o((function(){s&&(s.propValues[e]=r,a.type===l.CUSTOM?u.initCustomDataPropValue(a,r,s,c.router,c.theme.settings,!0):a.type===l.COMPONENT?u.initComponentPropValue(a,r,s,c.router,c.theme.settings,!0):a.type===l.COMPONENT_LIST&&u.initComponentListPropValue(a,r,s,c.router,c.theme.settings,!0))})),[2]}}))}))},this.handleUpdatePageParams=function(i){return e(T,void 0,void 0,(function(){var e;return t(this,(function(t){switch(t.label){case 0:return this.pageParams=i.pageParams,this.isLoading=!0,[4,this.getPagePropValues(this.theme,this.page.type,this.pageParams||{})];case 1:return e=t.sent(),this.pageDataProvider=e,this.isLoading=!1,[2]}}))}))},this.handleUpdatePageComponentOrder=function(i){return e(T,void 0,void 0,(function(){return t(this,(function(e){return this.specification?this.specification.components=i.pageComponents.map((function(e){return new d(e)})):this.page.components=i.pageComponents.map((function(e){return new d(e)})),[2]}))}))},this.handleAddNewComponent=function(e){var t,i=new p(e.component);null===(t=T.theme)||void 0===t||t.components.push(i)},this.handleDeleteComponent=function(e){var t,i;(null===(t=T.theme)||void 0===t?void 0:t.components)&&(T.theme.components=T.theme.components.filter((function(t){return t.id!==e.componentId})));var o=T.pageComponents.filter((function(t){return t.componentId!==e.componentId}))||[];T.specification&&T.specification.components&&(T.specification.components=o),!T.specification&&(null===(i=T.page)||void 0===i?void 0:i.components)&&(T.page.components=o)},this.handleUpdateComponent=function(e){var t=T.theme.components.findIndex((function(t){return t.id===e.component.id}));-1!==t&&(T.theme.components[t]=new p(e.component))},this.handleAddNewPageComponent=function(i){return e(T,void 0,void 0,(function(){var e,n,a=this;return t(this,(function(t){switch(t.label){case 0:return e=new d(i.pageComponent),this.pageComponents.some((function(t){return t.id===e.id}))?[2]:[4,this.pageDataProvider.getPageComponentPropValues(e)];case 1:return n=t.sent(),o((function(){n.component.props.filter((function(e){return e.type===l.CUSTOM})).forEach((function(e){u.initCustomDataPropValue(e,n.propValues[e.name],n,a.router,a.theme.settings,!0)})),a.pageDataProvider.pageComponentPropValues.push(n),a.pageComponents.push(e)})),[2]}}))}))},this.handleDeletePageComponent=function(e){T.specification?T.specification.components=T.pageComponents.filter((function(t){return t.id!==e.pageComponentId})):T.page.components=T.pageComponents.filter((function(t){return t.id!==e.pageComponentId}))},this.handleSetSelectedComponent=function(e){T.selectedPageComponentId=e.componentId},this.handleSetHoveredComponent=function(e){T.hoveredPageComponentId=e.componentId},this.handleScrollToComponent=function(e){var t=e.componentId,i=T.componentRefs[t];i&&(T.isScrolledIntoView(i)||window.scrollTo({top:i.offsetTop,behavior:"smooth"}))},this.updateThemeSettings=function(e){var t=e.settings;T.theme&&(T.theme.settings=new m(t))},this.router=C,i(this),this.startMessaging()}return Object.defineProperty(C.prototype,"specification",{get:function(){var e,t,i,o,n,a,s,d=this,p=this.page;return(null==p?void 0:p.type)===r.PRODUCT&&(s=null===(e=p.specifications)||void 0===e?void 0:e.find((function(e){var t;return e.id===(null===(t=d.pageParams)||void 0===t?void 0:t.productId)}))),(null==p?void 0:p.type)===r.CATEGORY&&(s=null===(t=p.specifications)||void 0===t?void 0:t.find((function(e){var t;return e.id===(null===(t=d.pageParams)||void 0===t?void 0:t.categoryId)}))),(null==p?void 0:p.type)===r.BRAND&&(s=null===(i=p.specifications)||void 0===i?void 0:i.find((function(e){var t;return e.id===(null===(t=d.pageParams)||void 0===t?void 0:t.brandId)}))),(null==p?void 0:p.type)===r.BLOG&&(s=null===(o=p.specifications)||void 0===o?void 0:o.find((function(e){var t;return e.id===(null===(t=d.pageParams)||void 0===t?void 0:t.blogId)}))),(null==p?void 0:p.type)===r.BLOG_CATEGORY&&(s=null===(n=p.specifications)||void 0===n?void 0:n.find((function(e){var t;return e.id===(null===(t=d.pageParams)||void 0===t?void 0:t.blogCategoryId)}))),(null==p?void 0:p.type)===r.RAFFLE_DETAIL&&(s=null===(a=p.specifications)||void 0===a?void 0:a.find((function(e){var t;return e.id===(null===(t=d.pageParams)||void 0===t?void 0:t.raffleId)}))),s},enumerable:!1,configurable:!0}),Object.defineProperty(C.prototype,"pageComponents",{get:function(){var e;return this.specification?this.specification.components:(null===(e=this.page)||void 0===e?void 0:e.components)||[]},enumerable:!1,configurable:!0}),Object.defineProperty(C.prototype,"selectedPageComponent",{get:function(){var e=this;return this.pageComponents.find((function(t){return t.id===e.selectedPageComponentId}))},enumerable:!1,configurable:!0}),Object.defineProperty(C.prototype,"selectedComponent",{get:function(){var e,t=this;return null===(e=this.theme)||void 0===e?void 0:e.components.find((function(e){var i;return e.id===(null===(i=t.selectedPageComponent)||void 0===i?void 0:i.componentId)}))},enumerable:!1,configurable:!0}),C}();!function(e){e.FRAME_DID_LOAD="FRAME_DID_LOAD",e.UPDATE_FRAME_DATA="UPDATE_FRAME_DATA",e.UPDATE_PROP_VALUE="UPDATE_PROP_VALUE",e.UPDATE_PAGE_PARAMS="UPDATE_PAGE_PARAMS",e.UPDATE_PAGE_COMPONENT_ORDER="UPDATE_PAGE_COMPONENT_ORDER",e.ADD_COMPONENT="ADD_COMPONENT",e.DELETE_COMPONENT="DELETE_COMPONENT",e.UPDATE_COMPONENT="UPDATE_COMPONENT",e.ADD_PAGE_COMPONENT="ADD_PAGE_COMPONENT",e.DELETE_PAGE_COMPONENT="DELETE_PAGE_COMPONENT",e.COMPONENT_MOUSE_OVER="COMPONENT_MOUSE_OVER",e.COMPONENT_MOUSE_LEAVE="COMPONENT_MOUSE_LEAVE",e.COMPONENT_CLICK="COMPONENT_CLICK",e.SET_SELECTED_COMPONENT="SET_SELECTED_COMPONENT",e.SET_HOVERED_COMPONENT="SET_HOVERED_COMPONENT",e.SCROLL_TO_COMPONENT="SCROLL_TO_COMPONENT",e.UPDATE_THEME_SETTINGS="UPDATE_THEME_SETTINGS",e.EDITOR_PAGE_CHANGE="EDITOR_PAGE_CHANGE"}(v||(v={}));export{v as BridgeMessageType,C as default};
|
|
1
|
+
import{__awaiter as e,__generator as t}from'../../ext/tslib/tslib.es6.js';import{makeAutoObservable as i,runInAction as o}from"mobx";import{IkasBlogMetadataTargetType as n}from"../../models/data/blog/index.js";import"../../models/data/brand/index.js";import"../../models/data/category/index.js";import"../../models/data/checkout/index.js";import"../../models/data/customer/address/index.js";import"../../models/data/customer/index.js";import"../../models/data/customer-review/index.js";import{IkasHTMLMetaDataTargetType as a}from"../../models/data/html-meta-data/index.js";import"../../models/data/image/index.js";import"../../models/data/installment-info/index.js";import"../../models/data/order/index.js";import"../../models/data/order/line-item/index.js";import"../../models/data/product/index.js";import"../../models/data/variant-type/index.js";import"../../models/data/product/variant/index.js";import"../../models/data/product/variant/price/index.js";import"../../models/data/product-attribute/index.js";import"../../models/data/product/attribute-value/index.js";import"../../models/data/product-filter/index.js";import"../../models/data/variant-type/variant-value/index.js";import"../../models/data/order-transaction/index.js";import"../../models/data/product-option-set/index.js";import"../../models/data/raffle/index.js";import{IkasTheme as r}from"../../models/theme/theme.js";import{IkasThemePageType as s}from"../../models/theme/page/index.js";import{IkasThemePageComponent as d}from"../../models/theme/page/component/index.js";import{IkasThemeComponent as p}from"../../models/theme/component/index.js";import{IkasThemeComponentPropType as l}from"../../models/theme/component/prop/index.js";import"../../models/theme/page/component/prop-value/link.js";import"../../models/ui/brand-list/index.js";import"../../models/ui/blog-list/index.js";import"../../models/ui/blog-category-list/index.js";import"../../models/ui/category-list/index.js";import"../../models/ui/product-detail/index.js";import"../../models/ui/product-list/index.js";import"../../models/ui/product-attribute-detail/index.js";import"../../models/ui/product-attribute-list/index.js";import"../../models/ui/customer-review-list/index.js";import"../../models/ui/validator/index.js";import"../../models/ui/validator/rules/index.js";import"../../models/ui/validator/form/login.js";import"../../models/ui/validator/form/address.js";import"../../models/ui/validator/form/register.js";import"../../models/ui/validator/form/contact-form.js";import"../../models/ui/validator/form/forgot-password.js";import"../../models/ui/validator/form/recover-password.js";import"../../models/ui/validator/form/account-info.js";import"../../models/ui/validator/form/raffle-form.js";import"../../models/ui/validator/form/customer-review.js";import"../../models/ui/raffle-list/index.js";import{IkasThemeSettings as m}from"../../models/theme/settings/index.js";import"../../models/theme/custom-data/index.js";import{IkasPageDataProvider as u}from"../../providers/page-data-get.js";import{IkasPageDataInit as c}from"../../providers/page-data-init.js";import{IkasBlogAPI as h}from"../../api/blog/index.js";import"../../api/brand/index.js";import"../../api/cart/index.js";import"../../api/category/index.js";import"../../api/checkout/index.js";import"../../api/city/index.js";import"../../api/country/index.js";import"../../api/customer/index.js";import"../../api/customer-review/index.js";import"../../api/district/index.js";import{IkasHTMLMetaDataAPI as g}from"../../api/html-meta-data/index.js";import"../../api/merchant/index.js";import"../../api/product-search/index.js";import{apollo as f}from"../../api/apollo.js";import"../../api/favorite-product/index.js";import"../../api/contact-form/index.js";import"../../api/state/index.js";import"../../api/product-option-set/index.js";import{IkasRaffleAPI as E}from"../../api/raffle/index.js";import"../../api/back-in-stock-reminder/index.js";import{IkasStorefrontConfig as P}from"../../storefront/index.js";import{IkasStorefront as O}from"../../models/data/storefront/index.js";var v,C=function(){function C(C){var T=this;this.theme=null,this.page=null,this.selectedPageComponentId=null,this.hoveredPageComponentId=null,this.componentRefs={},this.isLoading=!1,this.locale="en",this.pageParams={},this.apiKey=null,this.pageDataProvider=null,this.startMessaging=function(){window.addEventListener("message",T.onMessage,!1),T.sendMessage(v.FRAME_DID_LOAD,"2.0.0")},this.onMessage=function(i){return e(T,void 0,void 0,(function(){var e,o;return t(this,(function(t){switch(t.label){case 0:switch(e=i.data.type,o=i.data.data,e){case v.UPDATE_FRAME_DATA:return[3,1];case v.UPDATE_PROP_VALUE:return[3,3];case v.UPDATE_PAGE_PARAMS:return[3,5];case v.UPDATE_PAGE_COMPONENT_ORDER:return[3,7];case v.ADD_COMPONENT:return[3,9];case v.DELETE_COMPONENT:return[3,10];case v.UPDATE_COMPONENT:return[3,11];case v.ADD_PAGE_COMPONENT:return[3,12];case v.DELETE_PAGE_COMPONENT:return[3,14];case v.SET_SELECTED_COMPONENT:return[3,15];case v.SET_HOVERED_COMPONENT:return[3,16];case v.SCROLL_TO_COMPONENT:return[3,17];case v.UPDATE_THEME_SETTINGS:return[3,18]}return[3,19];case 1:return[4,this.handleUpdateFrameData(o)];case 2:case 4:case 6:case 8:case 13:return t.sent(),[3,20];case 3:return[4,this.handleUpdatePropValue(o)];case 5:return[4,this.handleUpdatePageParams(o)];case 7:return[4,this.handleUpdatePageComponentOrder(o)];case 9:return this.handleAddNewComponent(o),[3,20];case 10:return this.handleDeleteComponent(o),[3,20];case 11:return this.handleUpdateComponent(o),[3,20];case 12:return[4,this.handleAddNewPageComponent(o)];case 14:return this.handleDeletePageComponent(o),[3,20];case 15:return this.handleSetSelectedComponent(o),[3,20];case 16:return this.handleSetHoveredComponent(o),[3,20];case 17:return this.handleScrollToComponent(o),[3,20];case 18:return this.updateThemeSettings(o),[3,20];case 19:return[3,20];case 20:return[2]}}))}))},this.onClick=function(e){T.sendMessage(v.COMPONENT_CLICK,{componentId:e})},this.onMouseOver=function(e){T.sendMessage(v.COMPONENT_MOUSE_OVER,{componentId:e})},this.onMouseLeave=function(e){T.sendMessage(v.COMPONENT_MOUSE_LEAVE,{componentId:e})},this.onPageChange=function(i){return e(T,void 0,void 0,(function(){var e,r,d,p,l,m,u,c=this;return t(this,(function(t){switch(t.label){case 0:return e=i.slice(1),r=e.split("?"),e=r[0],this.pageParams={},i.startsWith("/account/orders/")?d=s.ORDER_DETAIL:i.startsWith("/account/orders")?d=s.ORDERS:i.startsWith("/account/addresses")?d=s.ADDRESSES:i.startsWith("/account/favorite-products")?d=s.FAVORITE_PRODUCTS:i.startsWith("/account/forgot-password")?d=s.FORGOT_PASSWORD:i.startsWith("/account/login")?d=s.LOGIN:i.startsWith("/account/raffles")?d=s.RAFFLE_ACCOUNT:i.startsWith("/account/recover-password")?d=s.RECOVER_PASSWORD:i.startsWith("/account/register")?d=s.REGISTER:i.startsWith("/account")?d=s.ACCOUNT:i.startsWith("/blog/")?d=s.BLOG:i.startsWith("/blog")?d=s.BLOG_INDEX:i.startsWith("/pages")?(d=s.CUSTOM,this.pageParams={slug:e.split("/")[1]}):d=i.startsWith("/raffle/")?s.RAFFLE_DETAIL:i.startsWith("/raffle")?s.RAFFLE:i.startsWith("/404")?s.NOT_FOUND:i.startsWith("/cart")?s.CART:i.startsWith("/checkout")?s.CHECKOUT:"/"===i?s.INDEX:i.startsWith("/search")?s.SEARCH:s.PRODUCT,d!==s.PRODUCT?[3,2]:[4,g.listHTMLMetaData(e)];case 1:if(!(p=t.sent()).length)return[2];if((l=p[0]).targetType===a.PRODUCT)this.pageParams={productId:l.targetId,slug:e};else if(l.targetType===a.CATEGORY)d=s.CATEGORY,this.pageParams={categoryId:l.targetId,slug:e};else{if(l.targetType!==a.BRAND)return[2];d=s.BRAND,this.pageParams={brandId:l.targetId,slug:e}}t.label=2;case 2:return d!==s.BLOG?[3,4]:[4,h.listBlogMetaData(e)];case 3:if(!(p=t.sent()).length)return[2];if((l=p[0]).targetType===n.BLOG)this.pageParams={blogId:l.targetId,slug:e};else{if(l.targetType!==n.BLOG_CATEGORY)return[2];d=s.BLOG_CATEGORY,this.pageParams={blogCategoryId:l.targetId,slug:e}}t.label=4;case 4:return d!==s.RAFFLE_DETAIL?[3,6]:[4,E.listRaffleMetaData(e)];case 5:if(!(p=t.sent()).length)return[2];l=p[0],this.pageParams={raffleId:l.targetId,slug:e},t.label=6;case 6:return[4,this.getPagePropValues(this.theme,d,this.pageParams)];case 7:return m=t.sent(),o((function(){var e,t;P.store.currentPageType=d,c.pageDataProvider=m,d===s.CUSTOM?c.page=null===(e=c.theme)||void 0===e?void 0:e.pages.find((function(e){return e.type===d&&e.slug===c.pageParams.slug})):c.page=null===(t=c.theme)||void 0===t?void 0:t.pages.find((function(e){return e.type===d})),requestAnimationFrame((function(){document.body.scrollTop=0,document.scrollingElement&&(document.scrollingElement.scrollTop=0)}))})),this.sendMessage(v.EDITOR_PAGE_CHANGE,{pageType:d,pageParams:this.pageParams,pageSpecificData:(null===(u=this.pageDataProvider)||void 0===u?void 0:u.pageSpecificData)||null}),[2]}}))}))},this.sendMessage=function(e,t){window.parent.postMessage({type:e,data:JSON.parse(JSON.stringify(t))},"*")},this.getPagePropValues=function(i,o,n){return e(T,void 0,void 0,(function(){var e,a,r;return t(this,(function(t){switch(t.label){case 0:return e=new u(i,n,o),(n.blogId||n.blogCategoryId)&&(e.possiblePageTypes=[s.BLOG,s.BLOG_CATEGORY]),n.raffleId&&(e.possiblePageTypes=[s.RAFFLE_DETAIL]),[4,e.getPageData()];case 1:return t.sent(),e.pageSpecificData&&(c.setPageSpecificData(JSON.stringify(e.pageSpecificData),o,!0),o===s.PRODUCT&&c.pageSpecificData&&(a=c.pageSpecificData,(r=a.product.variants.find((function(e){return e.id===n.variantId})))&&(a.selectedVariantValues=r.variantValues))),e.pageComponentPropValues=c.initPropValues(JSON.stringify(e.pageComponentPropValues),this.router,JSON.stringify(i.settings),!1),[2,e]}}))}))},this.setComponentRef=function(e,t){T.componentRefs[t.id]=e},this.isScrolledIntoView=function(e){var t=e.getBoundingClientRect(),i=t.top,o=t.bottom;return i<window.innerHeight&&o>=0&&o<window.innerHeight&&i>0},this.handleUpdateFrameData=function(i){return e(T,void 0,void 0,(function(){var e,o,n,a,s=this;return t(this,(function(t){switch(t.label){case 0:return this.theme=new r(i.theme),this.page=this.theme.pages.find((function(e){return e.id===i.selectedPage.id})),this.pageParams=i.pageParams,this.apiKey=i.apiKey,this.locale=i.locale||"en",this.translations=i.translations||void 0,this.page?((e=i.storefront)&&(o=new O(e),n=o.routings.find((function(e){return e.locale===s.locale})),P.storefrontId=o.id,P.storefrontRoutingId=null==n?void 0:n.id,o.mainStorefrontThemeId&&(P.storefrontThemeId=o.mainStorefrontThemeId),o.salesChannelId&&(P.salesChannelId=o.salesChannelId),(null==n?void 0:n.priceListId)&&(P.priceListId=n.priceListId),P.routings=o.routings,P.stockPreference=this.theme.settings.stockPreference),this.translations&&(P.translations=this.translations),P.isEditor=!0,f.createApolloClient(this.apiKey||void 0),window.editorApiKey=i.apiKey,this.isLoading=!0,[4,this.getPagePropValues(this.theme,this.page.type,this.pageParams||{})]):[2];case 1:return a=t.sent(),this.pageDataProvider=a,this.isLoading=!1,[2]}}))}))},this.handleUpdatePropValue=function(i){return e(T,void 0,void 0,(function(){var e,n,a,r,s,d,p,m,u=this;return t(this,(function(t){switch(t.label){case 0:return e=i.propName,n=i.value,(a=null===(p=null===(d=this.selectedComponent)||void 0===d?void 0:d.props)||void 0===p?void 0:p.find((function(t){return t.name===e})))&&this.selectedPageComponent?(r=null===(m=this.pageDataProvider)||void 0===m?void 0:m.pageComponentPropValues.find((function(e){return e.pageComponent.id===u.selectedPageComponentId})),this.selectedPageComponent.propValues[e]=n,this.pageDataProvider?[4,this.pageDataProvider.getPageComponentPropValue(this.selectedPageComponent,a)]:[2]):[2];case 1:return s=t.sent(),o((function(){r&&(r.propValues[e]=s,a.type===l.CUSTOM?c.initCustomDataPropValue(a,s,r,u.router,u.theme.settings,!0):a.type===l.COMPONENT?c.initComponentPropValue(a,s,r,u.router,u.theme.settings,!0):a.type===l.COMPONENT_LIST?c.initComponentListPropValue(a,s,r,u.router,u.theme.settings,!0):a.type===l.PRODUCT_DETAIL?c.initProductDetailPropValue(a,s,r,u.router):a.type===l.CATEGORY?c.initCategoryPropValue(a,s,r):a.type===l.BRAND?c.initBrandPropValue(a,s,r):a.type===l.BLOG?c.initBlogPropValue(a,s,r):a.type===l.BLOG_CATEGORY?c.initBlogCategoryPropValue(a,s,r):a.type===l.RAFFLE&&c.initRafflePropValue(a,s,r))})),[2]}}))}))},this.handleUpdatePageParams=function(i){return e(T,void 0,void 0,(function(){var e;return t(this,(function(t){switch(t.label){case 0:return this.pageParams=i.pageParams,this.isLoading=!0,[4,this.getPagePropValues(this.theme,this.page.type,this.pageParams||{})];case 1:return e=t.sent(),this.pageDataProvider=e,this.isLoading=!1,[2]}}))}))},this.handleUpdatePageComponentOrder=function(i){return e(T,void 0,void 0,(function(){return t(this,(function(e){return this.specification?this.specification.components=i.pageComponents.map((function(e){return new d(e)})):this.page.components=i.pageComponents.map((function(e){return new d(e)})),[2]}))}))},this.handleAddNewComponent=function(e){var t,i=new p(e.component);null===(t=T.theme)||void 0===t||t.components.push(i)},this.handleDeleteComponent=function(e){var t,i;(null===(t=T.theme)||void 0===t?void 0:t.components)&&(T.theme.components=T.theme.components.filter((function(t){return t.id!==e.componentId})));var o=T.pageComponents.filter((function(t){return t.componentId!==e.componentId}))||[];T.specification&&T.specification.components&&(T.specification.components=o),!T.specification&&(null===(i=T.page)||void 0===i?void 0:i.components)&&(T.page.components=o)},this.handleUpdateComponent=function(e){var t=T.theme.components.findIndex((function(t){return t.id===e.component.id}));-1!==t&&(T.theme.components[t]=new p(e.component))},this.handleAddNewPageComponent=function(i){return e(T,void 0,void 0,(function(){var e,n,a=this;return t(this,(function(t){switch(t.label){case 0:return e=new d(i.pageComponent),this.pageComponents.some((function(t){return t.id===e.id}))?[2]:[4,this.pageDataProvider.getPageComponentPropValues(e)];case 1:return n=t.sent(),o((function(){n.component.props.filter((function(e){return e.type===l.CUSTOM})).forEach((function(e){c.initCustomDataPropValue(e,n.propValues[e.name],n,a.router,a.theme.settings,!0)})),a.pageDataProvider.pageComponentPropValues.push(n),a.pageComponents.push(e)})),[2]}}))}))},this.handleDeletePageComponent=function(e){T.specification?T.specification.components=T.pageComponents.filter((function(t){return t.id!==e.pageComponentId})):T.page.components=T.pageComponents.filter((function(t){return t.id!==e.pageComponentId}))},this.handleSetSelectedComponent=function(e){T.selectedPageComponentId=e.componentId},this.handleSetHoveredComponent=function(e){T.hoveredPageComponentId=e.componentId},this.handleScrollToComponent=function(e){var t=e.componentId,i=T.componentRefs[t];i&&(T.isScrolledIntoView(i)||window.scrollTo({top:i.offsetTop,behavior:"smooth"}))},this.updateThemeSettings=function(e){var t=e.settings;T.theme&&(T.theme.settings=new m(t))},this.router=C,i(this),this.startMessaging()}return Object.defineProperty(C.prototype,"specification",{get:function(){var e,t,i,o,n,a,r,d=this,p=this.page;return(null==p?void 0:p.type)===s.PRODUCT&&(r=null===(e=p.specifications)||void 0===e?void 0:e.find((function(e){var t;return e.id===(null===(t=d.pageParams)||void 0===t?void 0:t.productId)}))),(null==p?void 0:p.type)===s.CATEGORY&&(r=null===(t=p.specifications)||void 0===t?void 0:t.find((function(e){var t;return e.id===(null===(t=d.pageParams)||void 0===t?void 0:t.categoryId)}))),(null==p?void 0:p.type)===s.BRAND&&(r=null===(i=p.specifications)||void 0===i?void 0:i.find((function(e){var t;return e.id===(null===(t=d.pageParams)||void 0===t?void 0:t.brandId)}))),(null==p?void 0:p.type)===s.BLOG&&(r=null===(o=p.specifications)||void 0===o?void 0:o.find((function(e){var t;return e.id===(null===(t=d.pageParams)||void 0===t?void 0:t.blogId)}))),(null==p?void 0:p.type)===s.BLOG_CATEGORY&&(r=null===(n=p.specifications)||void 0===n?void 0:n.find((function(e){var t;return e.id===(null===(t=d.pageParams)||void 0===t?void 0:t.blogCategoryId)}))),(null==p?void 0:p.type)===s.RAFFLE_DETAIL&&(r=null===(a=p.specifications)||void 0===a?void 0:a.find((function(e){var t;return e.id===(null===(t=d.pageParams)||void 0===t?void 0:t.raffleId)}))),r},enumerable:!1,configurable:!0}),Object.defineProperty(C.prototype,"pageComponents",{get:function(){var e;return this.specification?this.specification.components:(null===(e=this.page)||void 0===e?void 0:e.components)||[]},enumerable:!1,configurable:!0}),Object.defineProperty(C.prototype,"selectedPageComponent",{get:function(){var e=this;return this.pageComponents.find((function(t){return t.id===e.selectedPageComponentId}))},enumerable:!1,configurable:!0}),Object.defineProperty(C.prototype,"selectedComponent",{get:function(){var e,t=this;return null===(e=this.theme)||void 0===e?void 0:e.components.find((function(e){var i;return e.id===(null===(i=t.selectedPageComponent)||void 0===i?void 0:i.componentId)}))},enumerable:!1,configurable:!0}),C}();!function(e){e.FRAME_DID_LOAD="FRAME_DID_LOAD",e.UPDATE_FRAME_DATA="UPDATE_FRAME_DATA",e.UPDATE_PROP_VALUE="UPDATE_PROP_VALUE",e.UPDATE_PAGE_PARAMS="UPDATE_PAGE_PARAMS",e.UPDATE_PAGE_COMPONENT_ORDER="UPDATE_PAGE_COMPONENT_ORDER",e.ADD_COMPONENT="ADD_COMPONENT",e.DELETE_COMPONENT="DELETE_COMPONENT",e.UPDATE_COMPONENT="UPDATE_COMPONENT",e.ADD_PAGE_COMPONENT="ADD_PAGE_COMPONENT",e.DELETE_PAGE_COMPONENT="DELETE_PAGE_COMPONENT",e.COMPONENT_MOUSE_OVER="COMPONENT_MOUSE_OVER",e.COMPONENT_MOUSE_LEAVE="COMPONENT_MOUSE_LEAVE",e.COMPONENT_CLICK="COMPONENT_CLICK",e.SET_SELECTED_COMPONENT="SET_SELECTED_COMPONENT",e.SET_HOVERED_COMPONENT="SET_HOVERED_COMPONENT",e.SCROLL_TO_COMPONENT="SCROLL_TO_COMPONENT",e.UPDATE_THEME_SETTINGS="UPDATE_THEME_SETTINGS",e.EDITOR_PAGE_CHANGE="EDITOR_PAGE_CHANGE"}(v||(v={}));export{v as BridgeMessageType,C as default};
|