@misiki/gocommerce-connector 0.4.5 → 0.4.7
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/dist/{index-CmPI-hcH.d.cts → index-CQTW5q1J.d.cts} +47 -1
- package/dist/{index-CmPI-hcH.d.ts → index-CQTW5q1J.d.ts} +47 -1
- package/dist/index.cjs +50 -4
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +50 -4
- package/dist/index.js.map +1 -1
- package/dist/services/index.cjs +50 -4
- package/dist/services/index.cjs.map +1 -1
- package/dist/services/index.d.cts +1 -1
- package/dist/services/index.d.ts +1 -1
- package/dist/services/index.js +50 -4
- package/dist/services/index.js.map +1 -1
- package/package.json +1 -1
|
@@ -374,6 +374,8 @@ type Customer = {
|
|
|
374
374
|
id: number;
|
|
375
375
|
email: string;
|
|
376
376
|
email_verified: boolean;
|
|
377
|
+
/** The phone was proved with a code and signs in to this account (D118). */
|
|
378
|
+
phone_verified?: boolean;
|
|
377
379
|
name: string;
|
|
378
380
|
phone: string;
|
|
379
381
|
created_at: string;
|
|
@@ -1126,6 +1128,7 @@ declare function toUser(c: Customer): {
|
|
|
1126
1128
|
email: string;
|
|
1127
1129
|
emailVerified: boolean;
|
|
1128
1130
|
phone: string | null;
|
|
1131
|
+
phoneVerified: boolean;
|
|
1129
1132
|
firstName: string;
|
|
1130
1133
|
lastName: string;
|
|
1131
1134
|
name: string;
|
|
@@ -1286,6 +1289,11 @@ declare class StoreFacts extends BaseService {
|
|
|
1286
1289
|
}>;
|
|
1287
1290
|
/** The store's own name and how a buyer reaches it, as set in its panel. */
|
|
1288
1291
|
profile(): Promise<StoreProfile>;
|
|
1292
|
+
/** Where the store delivers (D117): its priced zones' countries, or everywhere. */
|
|
1293
|
+
shipsTo(): Promise<{
|
|
1294
|
+
everywhere: boolean;
|
|
1295
|
+
countries: string[];
|
|
1296
|
+
}>;
|
|
1289
1297
|
checkoutOptions(): Promise<CheckoutOptions>;
|
|
1290
1298
|
/**
|
|
1291
1299
|
* The whole tree, flat and depth-first. Past 500 categories the engine
|
|
@@ -4681,6 +4689,7 @@ declare class UserService extends BaseService {
|
|
|
4681
4689
|
avatar: null;
|
|
4682
4690
|
role: string;
|
|
4683
4691
|
emailVerified: boolean;
|
|
4692
|
+
phoneVerified: boolean;
|
|
4684
4693
|
storeId: null;
|
|
4685
4694
|
}>;
|
|
4686
4695
|
signup({ email, password, firstName, lastName, phone, }: {
|
|
@@ -4703,6 +4712,7 @@ declare class UserService extends BaseService {
|
|
|
4703
4712
|
avatar: null;
|
|
4704
4713
|
role: string;
|
|
4705
4714
|
emailVerified: boolean;
|
|
4715
|
+
phoneVerified: boolean;
|
|
4706
4716
|
storeId: null;
|
|
4707
4717
|
}>;
|
|
4708
4718
|
/** Signs out here and on the engine. The storefront assigns the answer to its user: `null`. */
|
|
@@ -4713,6 +4723,7 @@ declare class UserService extends BaseService {
|
|
|
4713
4723
|
email: string;
|
|
4714
4724
|
emailVerified: boolean;
|
|
4715
4725
|
phone: string | null;
|
|
4726
|
+
phoneVerified: boolean;
|
|
4716
4727
|
firstName: string;
|
|
4717
4728
|
lastName: string;
|
|
4718
4729
|
name: string;
|
|
@@ -4734,6 +4745,7 @@ declare class UserService extends BaseService {
|
|
|
4734
4745
|
email: string;
|
|
4735
4746
|
emailVerified: boolean;
|
|
4736
4747
|
phone: string | null;
|
|
4748
|
+
phoneVerified: boolean;
|
|
4737
4749
|
firstName: string;
|
|
4738
4750
|
lastName: string;
|
|
4739
4751
|
name: string;
|
|
@@ -4758,6 +4770,7 @@ declare class UserService extends BaseService {
|
|
|
4758
4770
|
email: string;
|
|
4759
4771
|
emailVerified: boolean;
|
|
4760
4772
|
phone: string | null;
|
|
4773
|
+
phoneVerified: boolean;
|
|
4761
4774
|
firstName: string;
|
|
4762
4775
|
lastName: string;
|
|
4763
4776
|
name: string;
|
|
@@ -4788,6 +4801,7 @@ declare class UserService extends BaseService {
|
|
|
4788
4801
|
avatar: null;
|
|
4789
4802
|
role: string;
|
|
4790
4803
|
emailVerified: boolean;
|
|
4804
|
+
phoneVerified: boolean;
|
|
4791
4805
|
storeId: null;
|
|
4792
4806
|
}>;
|
|
4793
4807
|
/**
|
|
@@ -4913,6 +4927,7 @@ declare class UserService extends BaseService {
|
|
|
4913
4927
|
avatar: null;
|
|
4914
4928
|
role: string;
|
|
4915
4929
|
emailVerified: boolean;
|
|
4930
|
+
phoneVerified: boolean;
|
|
4916
4931
|
storeId: null;
|
|
4917
4932
|
}>;
|
|
4918
4933
|
/** An identity call, with a 404 from a build without the module said in words. */
|
|
@@ -4929,7 +4944,7 @@ declare class AuthService extends UserService {
|
|
|
4929
4944
|
* How this store signs customers in: `email_password` or `phone_otp`.
|
|
4930
4945
|
* A store whose accounts module says nothing signs in by email.
|
|
4931
4946
|
*/
|
|
4932
|
-
loginMethod(): Promise<'email_password' | 'phone_otp'>;
|
|
4947
|
+
loginMethod(): Promise<'email_password' | 'phone_otp' | 'email_or_phone'>;
|
|
4933
4948
|
forgotPassword({ email }: {
|
|
4934
4949
|
email: string;
|
|
4935
4950
|
referrer?: string;
|
|
@@ -4953,6 +4968,7 @@ declare class AuthService extends UserService {
|
|
|
4953
4968
|
avatar: null;
|
|
4954
4969
|
role: string;
|
|
4955
4970
|
emailVerified: boolean;
|
|
4971
|
+
phoneVerified: boolean;
|
|
4956
4972
|
storeId: null;
|
|
4957
4973
|
}>;
|
|
4958
4974
|
/** Answers `{ errorCode, message }` on failure rather than throwing: that is how the page reads it. */
|
|
@@ -4963,6 +4979,7 @@ declare class AuthService extends UserService {
|
|
|
4963
4979
|
email: string;
|
|
4964
4980
|
emailVerified: boolean;
|
|
4965
4981
|
phone: string | null;
|
|
4982
|
+
phoneVerified: boolean;
|
|
4966
4983
|
firstName: string;
|
|
4967
4984
|
lastName: string;
|
|
4968
4985
|
name: string;
|
|
@@ -4998,6 +5015,7 @@ declare class AuthService extends UserService {
|
|
|
4998
5015
|
avatar: null;
|
|
4999
5016
|
role: string;
|
|
5000
5017
|
emailVerified: boolean;
|
|
5018
|
+
phoneVerified: boolean;
|
|
5001
5019
|
storeId: null;
|
|
5002
5020
|
}>;
|
|
5003
5021
|
joinAsAdmin(): Promise<never>;
|
|
@@ -5010,6 +5028,7 @@ declare class ProfileService extends UserService {
|
|
|
5010
5028
|
email: string;
|
|
5011
5029
|
emailVerified: boolean;
|
|
5012
5030
|
phone: string | null;
|
|
5031
|
+
phoneVerified: boolean;
|
|
5013
5032
|
firstName: string;
|
|
5014
5033
|
lastName: string;
|
|
5015
5034
|
name: string;
|
|
@@ -5030,6 +5049,33 @@ declare class ProfileService extends UserService {
|
|
|
5030
5049
|
email: string;
|
|
5031
5050
|
emailVerified: boolean;
|
|
5032
5051
|
phone: string | null;
|
|
5052
|
+
phoneVerified: boolean;
|
|
5053
|
+
firstName: string;
|
|
5054
|
+
lastName: string;
|
|
5055
|
+
name: string;
|
|
5056
|
+
fullName: string;
|
|
5057
|
+
avatar: null;
|
|
5058
|
+
role: string;
|
|
5059
|
+
createdAt: string;
|
|
5060
|
+
updatedAt: string;
|
|
5061
|
+
}>;
|
|
5062
|
+
/** Texts a code to a phone the signed-in shopper wants to add (D118). */
|
|
5063
|
+
requestPhoneLink({ phone }: {
|
|
5064
|
+
phone: string;
|
|
5065
|
+
}): Promise<{
|
|
5066
|
+
expiresInMinutes: number;
|
|
5067
|
+
}>;
|
|
5068
|
+
/** Adds the phone with its code; from then on it signs in to this account too. */
|
|
5069
|
+
verifyPhoneLink({ phone, otp }: {
|
|
5070
|
+
phone: string;
|
|
5071
|
+
otp: string;
|
|
5072
|
+
}): Promise<{
|
|
5073
|
+
id: string;
|
|
5074
|
+
userId: string;
|
|
5075
|
+
email: string;
|
|
5076
|
+
emailVerified: boolean;
|
|
5077
|
+
phone: string | null;
|
|
5078
|
+
phoneVerified: boolean;
|
|
5033
5079
|
firstName: string;
|
|
5034
5080
|
lastName: string;
|
|
5035
5081
|
name: string;
|
|
@@ -374,6 +374,8 @@ type Customer = {
|
|
|
374
374
|
id: number;
|
|
375
375
|
email: string;
|
|
376
376
|
email_verified: boolean;
|
|
377
|
+
/** The phone was proved with a code and signs in to this account (D118). */
|
|
378
|
+
phone_verified?: boolean;
|
|
377
379
|
name: string;
|
|
378
380
|
phone: string;
|
|
379
381
|
created_at: string;
|
|
@@ -1126,6 +1128,7 @@ declare function toUser(c: Customer): {
|
|
|
1126
1128
|
email: string;
|
|
1127
1129
|
emailVerified: boolean;
|
|
1128
1130
|
phone: string | null;
|
|
1131
|
+
phoneVerified: boolean;
|
|
1129
1132
|
firstName: string;
|
|
1130
1133
|
lastName: string;
|
|
1131
1134
|
name: string;
|
|
@@ -1286,6 +1289,11 @@ declare class StoreFacts extends BaseService {
|
|
|
1286
1289
|
}>;
|
|
1287
1290
|
/** The store's own name and how a buyer reaches it, as set in its panel. */
|
|
1288
1291
|
profile(): Promise<StoreProfile>;
|
|
1292
|
+
/** Where the store delivers (D117): its priced zones' countries, or everywhere. */
|
|
1293
|
+
shipsTo(): Promise<{
|
|
1294
|
+
everywhere: boolean;
|
|
1295
|
+
countries: string[];
|
|
1296
|
+
}>;
|
|
1289
1297
|
checkoutOptions(): Promise<CheckoutOptions>;
|
|
1290
1298
|
/**
|
|
1291
1299
|
* The whole tree, flat and depth-first. Past 500 categories the engine
|
|
@@ -4681,6 +4689,7 @@ declare class UserService extends BaseService {
|
|
|
4681
4689
|
avatar: null;
|
|
4682
4690
|
role: string;
|
|
4683
4691
|
emailVerified: boolean;
|
|
4692
|
+
phoneVerified: boolean;
|
|
4684
4693
|
storeId: null;
|
|
4685
4694
|
}>;
|
|
4686
4695
|
signup({ email, password, firstName, lastName, phone, }: {
|
|
@@ -4703,6 +4712,7 @@ declare class UserService extends BaseService {
|
|
|
4703
4712
|
avatar: null;
|
|
4704
4713
|
role: string;
|
|
4705
4714
|
emailVerified: boolean;
|
|
4715
|
+
phoneVerified: boolean;
|
|
4706
4716
|
storeId: null;
|
|
4707
4717
|
}>;
|
|
4708
4718
|
/** Signs out here and on the engine. The storefront assigns the answer to its user: `null`. */
|
|
@@ -4713,6 +4723,7 @@ declare class UserService extends BaseService {
|
|
|
4713
4723
|
email: string;
|
|
4714
4724
|
emailVerified: boolean;
|
|
4715
4725
|
phone: string | null;
|
|
4726
|
+
phoneVerified: boolean;
|
|
4716
4727
|
firstName: string;
|
|
4717
4728
|
lastName: string;
|
|
4718
4729
|
name: string;
|
|
@@ -4734,6 +4745,7 @@ declare class UserService extends BaseService {
|
|
|
4734
4745
|
email: string;
|
|
4735
4746
|
emailVerified: boolean;
|
|
4736
4747
|
phone: string | null;
|
|
4748
|
+
phoneVerified: boolean;
|
|
4737
4749
|
firstName: string;
|
|
4738
4750
|
lastName: string;
|
|
4739
4751
|
name: string;
|
|
@@ -4758,6 +4770,7 @@ declare class UserService extends BaseService {
|
|
|
4758
4770
|
email: string;
|
|
4759
4771
|
emailVerified: boolean;
|
|
4760
4772
|
phone: string | null;
|
|
4773
|
+
phoneVerified: boolean;
|
|
4761
4774
|
firstName: string;
|
|
4762
4775
|
lastName: string;
|
|
4763
4776
|
name: string;
|
|
@@ -4788,6 +4801,7 @@ declare class UserService extends BaseService {
|
|
|
4788
4801
|
avatar: null;
|
|
4789
4802
|
role: string;
|
|
4790
4803
|
emailVerified: boolean;
|
|
4804
|
+
phoneVerified: boolean;
|
|
4791
4805
|
storeId: null;
|
|
4792
4806
|
}>;
|
|
4793
4807
|
/**
|
|
@@ -4913,6 +4927,7 @@ declare class UserService extends BaseService {
|
|
|
4913
4927
|
avatar: null;
|
|
4914
4928
|
role: string;
|
|
4915
4929
|
emailVerified: boolean;
|
|
4930
|
+
phoneVerified: boolean;
|
|
4916
4931
|
storeId: null;
|
|
4917
4932
|
}>;
|
|
4918
4933
|
/** An identity call, with a 404 from a build without the module said in words. */
|
|
@@ -4929,7 +4944,7 @@ declare class AuthService extends UserService {
|
|
|
4929
4944
|
* How this store signs customers in: `email_password` or `phone_otp`.
|
|
4930
4945
|
* A store whose accounts module says nothing signs in by email.
|
|
4931
4946
|
*/
|
|
4932
|
-
loginMethod(): Promise<'email_password' | 'phone_otp'>;
|
|
4947
|
+
loginMethod(): Promise<'email_password' | 'phone_otp' | 'email_or_phone'>;
|
|
4933
4948
|
forgotPassword({ email }: {
|
|
4934
4949
|
email: string;
|
|
4935
4950
|
referrer?: string;
|
|
@@ -4953,6 +4968,7 @@ declare class AuthService extends UserService {
|
|
|
4953
4968
|
avatar: null;
|
|
4954
4969
|
role: string;
|
|
4955
4970
|
emailVerified: boolean;
|
|
4971
|
+
phoneVerified: boolean;
|
|
4956
4972
|
storeId: null;
|
|
4957
4973
|
}>;
|
|
4958
4974
|
/** Answers `{ errorCode, message }` on failure rather than throwing: that is how the page reads it. */
|
|
@@ -4963,6 +4979,7 @@ declare class AuthService extends UserService {
|
|
|
4963
4979
|
email: string;
|
|
4964
4980
|
emailVerified: boolean;
|
|
4965
4981
|
phone: string | null;
|
|
4982
|
+
phoneVerified: boolean;
|
|
4966
4983
|
firstName: string;
|
|
4967
4984
|
lastName: string;
|
|
4968
4985
|
name: string;
|
|
@@ -4998,6 +5015,7 @@ declare class AuthService extends UserService {
|
|
|
4998
5015
|
avatar: null;
|
|
4999
5016
|
role: string;
|
|
5000
5017
|
emailVerified: boolean;
|
|
5018
|
+
phoneVerified: boolean;
|
|
5001
5019
|
storeId: null;
|
|
5002
5020
|
}>;
|
|
5003
5021
|
joinAsAdmin(): Promise<never>;
|
|
@@ -5010,6 +5028,7 @@ declare class ProfileService extends UserService {
|
|
|
5010
5028
|
email: string;
|
|
5011
5029
|
emailVerified: boolean;
|
|
5012
5030
|
phone: string | null;
|
|
5031
|
+
phoneVerified: boolean;
|
|
5013
5032
|
firstName: string;
|
|
5014
5033
|
lastName: string;
|
|
5015
5034
|
name: string;
|
|
@@ -5030,6 +5049,33 @@ declare class ProfileService extends UserService {
|
|
|
5030
5049
|
email: string;
|
|
5031
5050
|
emailVerified: boolean;
|
|
5032
5051
|
phone: string | null;
|
|
5052
|
+
phoneVerified: boolean;
|
|
5053
|
+
firstName: string;
|
|
5054
|
+
lastName: string;
|
|
5055
|
+
name: string;
|
|
5056
|
+
fullName: string;
|
|
5057
|
+
avatar: null;
|
|
5058
|
+
role: string;
|
|
5059
|
+
createdAt: string;
|
|
5060
|
+
updatedAt: string;
|
|
5061
|
+
}>;
|
|
5062
|
+
/** Texts a code to a phone the signed-in shopper wants to add (D118). */
|
|
5063
|
+
requestPhoneLink({ phone }: {
|
|
5064
|
+
phone: string;
|
|
5065
|
+
}): Promise<{
|
|
5066
|
+
expiresInMinutes: number;
|
|
5067
|
+
}>;
|
|
5068
|
+
/** Adds the phone with its code; from then on it signs in to this account too. */
|
|
5069
|
+
verifyPhoneLink({ phone, otp }: {
|
|
5070
|
+
phone: string;
|
|
5071
|
+
otp: string;
|
|
5072
|
+
}): Promise<{
|
|
5073
|
+
id: string;
|
|
5074
|
+
userId: string;
|
|
5075
|
+
email: string;
|
|
5076
|
+
emailVerified: boolean;
|
|
5077
|
+
phone: string | null;
|
|
5078
|
+
phoneVerified: boolean;
|
|
5033
5079
|
firstName: string;
|
|
5034
5080
|
lastName: string;
|
|
5035
5081
|
name: string;
|
package/dist/index.cjs
CHANGED
|
@@ -205,6 +205,7 @@ function toMe(c) {
|
|
|
205
205
|
avatar: null,
|
|
206
206
|
role: "USER",
|
|
207
207
|
emailVerified: c.email_verified,
|
|
208
|
+
phoneVerified: !!c.phone_verified,
|
|
208
209
|
storeId: null
|
|
209
210
|
};
|
|
210
211
|
}
|
|
@@ -986,6 +987,7 @@ function toUser(c) {
|
|
|
986
987
|
email: c.email,
|
|
987
988
|
emailVerified: c.email_verified,
|
|
988
989
|
phone: c.phone || null,
|
|
990
|
+
phoneVerified: !!c.phone_verified,
|
|
989
991
|
firstName: firstName || "",
|
|
990
992
|
lastName: rest.join(" "),
|
|
991
993
|
name: c.name,
|
|
@@ -1032,6 +1034,13 @@ var StoreFacts = class extends BaseService {
|
|
|
1032
1034
|
profile() {
|
|
1033
1035
|
return remember(this.key("profile"), () => this.data("/api/store"));
|
|
1034
1036
|
}
|
|
1037
|
+
/** Where the store delivers (D117): its priced zones' countries, or everywhere. */
|
|
1038
|
+
shipsTo() {
|
|
1039
|
+
return remember(this.key("ships-to"), async () => {
|
|
1040
|
+
const r = await this.data("/api/checkout/countries");
|
|
1041
|
+
return { everywhere: r?.everywhere ?? true, countries: r?.countries ?? [] };
|
|
1042
|
+
});
|
|
1043
|
+
}
|
|
1035
1044
|
checkoutOptions() {
|
|
1036
1045
|
return remember(this.key("checkout"), () => this.data("/api/checkout"));
|
|
1037
1046
|
}
|
|
@@ -2213,7 +2222,7 @@ var AuthService = class extends UserService {
|
|
|
2213
2222
|
async loginMethod() {
|
|
2214
2223
|
try {
|
|
2215
2224
|
const method = (await this.facts.plugins()).get("identity")?.settings?.login_method;
|
|
2216
|
-
return method === "phone_otp"
|
|
2225
|
+
return method === "phone_otp" || method === "email_or_phone" ? method : "email_password";
|
|
2217
2226
|
} catch {
|
|
2218
2227
|
return "email_password";
|
|
2219
2228
|
}
|
|
@@ -2271,6 +2280,25 @@ var ProfileService = class extends UserService {
|
|
|
2271
2280
|
async save(profile) {
|
|
2272
2281
|
return this.updateProfile(profile);
|
|
2273
2282
|
}
|
|
2283
|
+
/** Texts a code to a phone the signed-in shopper wants to add (D118). */
|
|
2284
|
+
async requestPhoneLink({ phone }) {
|
|
2285
|
+
const res = await this.account("/x/identity/me/phone", {
|
|
2286
|
+
method: "POST",
|
|
2287
|
+
auth: true,
|
|
2288
|
+
body: { phone: String(phone ?? "").trim() }
|
|
2289
|
+
});
|
|
2290
|
+
return { expiresInMinutes: res?.expires_in_minutes ?? 10 };
|
|
2291
|
+
}
|
|
2292
|
+
/** Adds the phone with its code; from then on it signs in to this account too. */
|
|
2293
|
+
async verifyPhoneLink({ phone, otp }) {
|
|
2294
|
+
const c = await this.account("/x/identity/me/phone/verify", {
|
|
2295
|
+
method: "POST",
|
|
2296
|
+
auth: true,
|
|
2297
|
+
body: { phone: String(phone ?? "").trim(), code: String(otp ?? "").trim() }
|
|
2298
|
+
});
|
|
2299
|
+
updateMe(c);
|
|
2300
|
+
return toUser(c);
|
|
2301
|
+
}
|
|
2274
2302
|
};
|
|
2275
2303
|
var userService = new UserService();
|
|
2276
2304
|
var authService = new AuthService();
|
|
@@ -2576,12 +2604,14 @@ var StoreService = class extends BaseService {
|
|
|
2576
2604
|
return super.post(path, data);
|
|
2577
2605
|
}
|
|
2578
2606
|
async live() {
|
|
2579
|
-
const [ready, plugins, menus, base, profile] = await Promise.all([
|
|
2607
|
+
const [ready, plugins, menus, base, profile, ships] = await Promise.all([
|
|
2580
2608
|
this.facts.ready(),
|
|
2581
2609
|
this.facts.plugins().catch(() => /* @__PURE__ */ new Map()),
|
|
2582
2610
|
new MenuService(this._fetch).engineMenus(),
|
|
2583
2611
|
readStaticStore(),
|
|
2584
|
-
this.facts.profile().catch(() => null)
|
|
2612
|
+
this.facts.profile().catch(() => null),
|
|
2613
|
+
// An engine without the route rules nothing out.
|
|
2614
|
+
this.facts.shipsTo().catch(() => ({ everywhere: true, countries: [] }))
|
|
2585
2615
|
]);
|
|
2586
2616
|
const code = ready.currency;
|
|
2587
2617
|
const sameCurrency = (base.currency?.code ?? base.currencyCode) === code;
|
|
@@ -2611,14 +2641,30 @@ var StoreService = class extends BaseService {
|
|
|
2611
2641
|
}
|
|
2612
2642
|
},
|
|
2613
2643
|
...menus?.length ? { menu: menus } : {},
|
|
2644
|
+
...deliverable(base, ships),
|
|
2614
2645
|
// The one way this store signs customers in (D116), which the sign-in
|
|
2615
2646
|
// form reads as PHONE or EMAIL. Without the accounts module the static
|
|
2616
2647
|
// record says.
|
|
2617
|
-
...plugins.has("identity") ? { loginType: plugins.get("identity")?.settings?.login_method
|
|
2648
|
+
...plugins.has("identity") ? { loginType: LOGIN_TYPES[String(plugins.get("identity")?.settings?.login_method)] ?? "EMAIL" } : {}
|
|
2618
2649
|
};
|
|
2619
2650
|
}
|
|
2620
2651
|
};
|
|
2621
2652
|
var storeService = new StoreService();
|
|
2653
|
+
function deliverable(base, ships) {
|
|
2654
|
+
if (ships.everywhere || !ships.countries.length) return {};
|
|
2655
|
+
const known = new Map((base.countries ?? []).map((c) => [String(c.code).toUpperCase(), c]));
|
|
2656
|
+
const countries = ships.countries.map((code) => known.get(code) ?? { code, name: regionName(code) });
|
|
2657
|
+
const keep = base.country && ships.countries.includes(String(base.country.code).toUpperCase());
|
|
2658
|
+
return { countries, ...keep ? {} : { country: countries[0] } };
|
|
2659
|
+
}
|
|
2660
|
+
function regionName(code) {
|
|
2661
|
+
try {
|
|
2662
|
+
return new Intl.DisplayNames(["en"], { type: "region" }).of(code) ?? code;
|
|
2663
|
+
} catch {
|
|
2664
|
+
return code;
|
|
2665
|
+
}
|
|
2666
|
+
}
|
|
2667
|
+
var LOGIN_TYPES = { phone_otp: "PHONE", email_or_phone: "BOTH", email_password: "EMAIL" };
|
|
2622
2668
|
|
|
2623
2669
|
// src/services/page-service.ts
|
|
2624
2670
|
var PageService = class extends BaseService {
|